综合查询单位工程树状修改

This commit is contained in:
zzyuan 2024-12-30 11:32:23 +08:00
parent 3f0cb56e31
commit 56d4919ab9
3 changed files with 162 additions and 51 deletions

View File

@ -21,7 +21,14 @@
/>
</el-form-item> -->
<el-form-item label="往来单位" prop="unitId">
<el-cascader v-model="unitId"
<treeselect
v-model="queryParams.unitId"
:options="unitList" :normalizer="normalizer"
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择往来单位" @select="unitChange"
/>
<!-- <el-cascader v-model="unitId"
:show-all-levels="false"
:options="unitList"
:props="selectTreeProps"
@ -30,10 +37,17 @@
collapse-tags
@change="unitChange"
placeholder="请选择往来单位"
></el-cascader>
></el-cascader> -->
</el-form-item>
<el-form-item label="工程名称" prop="proId">
<el-cascader v-model="projectId"
<treeselect
v-model="queryParams.proId"
:options="proList" :normalizer="normalizer"
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择工程名称" @select="proChange"
/>
<!-- <el-cascader v-model="projectId"
:show-all-levels="false"
:options="proList"
:props="selectTreeProps"
@ -41,7 +55,7 @@
collapse-tags
@change="proChange"
placeholder="请选择工程名称"
></el-cascader>
></el-cascader> -->
</el-form-item>
<el-form-item label="物资名称" prop="typeName">
<el-input
@ -145,9 +159,12 @@ import {
getProjectList,
getUnitList,
} from '@/api/back/index.js'
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: '',
dicts: [],
components: { Treeselect },
data() {
return {
//
@ -184,6 +201,8 @@ export default {
pageSize: 10,
time: null,
keyWord: null,
unitId: null,
proId: null,
typeName: null, //
typeModelName: null, //
outStyle:null
@ -199,35 +218,53 @@ export default {
this.GetUnitData()
this.GetProData()
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
//
async GetUnitData() {
const params = {
projectId: this.queryParams.proId /* */,
// projectId: this.queryParams.proId /* */,
}
const res = await getUnitList(params)
this.unitList = res.data
},
unitChange(val){
if(val&&val.length>0){
this.queryParams.unitId=this.unitId[this.unitId.length - 1]
}else if(val&&val.length==0){
this.queryParams.unitId=""
}
this.GetProData()
// if(val&&val.length>0){
// this.queryParams.unitId=this.unitId[this.unitId.length - 1]
// }else if(val&&val.length==0){
// this.queryParams.unitId=""
// }
// this.GetProData()
setTimeout(()=>{
this.GetProData()
},500)
},
//
async GetProData() {
const params = { unitId: this.queryParams.unitId}
const res = await getProjectList(params)
this.proList = res.data
this.queryParams.proId=null
},
proChange(val){
if(val&&val.length>0){
this.queryParams.proId=this.projectId[this.projectId.length - 1]
}else if(val&&val.length==0){
this.queryParams.proId=""
}
this.GetUnitData()
// if(val&&val.length>0){
// this.queryParams.proId=this.projectId[this.projectId.length - 1]
// }else if(val&&val.length==0){
// this.queryParams.proId=""
// }
// this.GetUnitData()
setTimeout(()=>{
this.GetUnitData()
},500)
},
//
jumpLease(code){

View File

@ -21,7 +21,14 @@
/>
</el-form-item>
<el-form-item label="往来单位" prop="unitId">
<el-cascader v-model="unitId"
<treeselect
v-model="queryParams.unitId"
:options="unitList" :normalizer="normalizer"
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择往来单位" @select="unitChange"
/>
<!-- <el-cascader v-model="unitId"
:show-all-levels="false"
:options="unitList"
:props="selectTreeProps"
@ -30,10 +37,17 @@
collapse-tags
@change="unitChange"
placeholder="请选择往来单位"
></el-cascader>
></el-cascader> -->
</el-form-item>
<el-form-item label="工程名称" prop="proId">
<el-cascader v-model="projectId"
<treeselect
v-model="queryParams.proId"
:options="proList" :normalizer="normalizer"
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择工程名称" @select="proChange"
/>
<!-- <el-cascader v-model="projectId"
:show-all-levels="false"
:options="proList"
:props="selectTreeProps"
@ -41,7 +55,7 @@
collapse-tags
@change="proChange"
placeholder="请选择工程名称"
></el-cascader>
></el-cascader> -->
</el-form-item>
<el-form-item label="物资名称" prop="typeName">
<el-input
@ -131,9 +145,12 @@ import {
getProjectList,
getUnitList,
} from '@/api/back/index.js'
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: '',
dicts: [],
components: { Treeselect },
data() {
return {
//
@ -169,6 +186,8 @@ export default {
pageNum: 1,
pageSize: 10,
time: null,
unitId: null,
proId: null,
keyWord: null,
typeName: null, //
statusName: null //
@ -184,35 +203,53 @@ export default {
this.GetUnitData()
this.GetProData()
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
//
async GetUnitData() {
const params = {
projectId: this.queryParams.proId /* */,
// projectId: this.queryParams.proId /* */,
}
const res = await getUnitList(params)
this.unitList = res.data
},
unitChange(val){
if(val&&val.length>0){
this.queryParams.unitId=this.unitId[this.unitId.length - 1]
}else if(val&&val.length==0){
this.queryParams.unitId=""
}
this.GetProData()
// if(val&&val.length>0){
// this.queryParams.unitId=this.unitId[this.unitId.length - 1]
// }else if(val&&val.length==0){
// this.queryParams.unitId=""
// }
// this.GetProData()
setTimeout(()=>{
this.GetProData()
},500)
},
//
async GetProData() {
const params = { unitId: this.queryParams.unitId}
const res = await getProjectList(params)
this.proList = res.data
this.queryParams.proId=null
},
proChange(val){
if(val&&val.length>0){
this.queryParams.proId=this.projectId[this.projectId.length - 1]
}else if(val&&val.length==0){
this.queryParams.proId=""
}
this.GetUnitData()
// if(val&&val.length>0){
// this.queryParams.proId=this.projectId[this.projectId.length - 1]
// }else if(val&&val.length==0){
// this.queryParams.proId=""
// }
// this.GetUnitData()
setTimeout(()=>{
this.GetUnitData()
},500)
},
//

View File

@ -21,7 +21,14 @@
/>
</el-form-item>
<el-form-item label="往来单位" prop="unitId">
<el-cascader v-model="unitId"
<treeselect
v-model="queryParams.unitId"
:options="unitList" :normalizer="normalizer"
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择往来单位" @select="unitChange"
/>
<!-- <el-cascader v-model="unitId"
:show-all-levels="false"
:options="unitList"
:props="selectTreeProps"
@ -30,10 +37,17 @@
collapse-tags
@change="unitChange"
placeholder="请选择往来单位"
></el-cascader>
></el-cascader> -->
</el-form-item>
<el-form-item label="工程名称" prop="proId">
<el-cascader v-model="projectId"
<treeselect
v-model="queryParams.proId"
:options="proList" :normalizer="normalizer"
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择工程名称" @select="proChange"
/>
<!-- <el-cascader v-model="projectId"
:show-all-levels="false"
:options="proList"
:props="selectTreeProps"
@ -41,7 +55,7 @@
collapse-tags
@change="proChange"
placeholder="请选择工程名称"
></el-cascader>
></el-cascader> -->
</el-form-item>
<el-form-item label="物资名称" prop="typeName">
<el-input
@ -133,9 +147,12 @@ import {
getProjectList,
getUnitList,
} from '@/api/back/index.js'
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: '',
dicts: [],
components: { Treeselect },
data() {
return {
//
@ -171,6 +188,8 @@ export default {
pageNum: 1,
pageSize: 10,
time: null,
unitId: null,
proId: null,
keyWord: null,
typeName: null, //
isSlt: null //
@ -186,35 +205,53 @@ export default {
this.GetUnitData()
this.GetProData()
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
//
async GetUnitData() {
const params = {
projectId: this.queryParams.proId /* */,
// projectId: this.queryParams.proId /* */,
}
const res = await getUnitList(params)
this.unitList = res.data
},
unitChange(val){
if(val&&val.length>0){
this.queryParams.unitId=this.unitId[this.unitId.length - 1]
}else if(val&&val.length==0){
this.queryParams.unitId=""
}
this.GetProData()
// if(val&&val.length>0){
// this.queryParams.unitId=this.unitId[this.unitId.length - 1]
// }else if(val&&val.length==0){
// this.queryParams.unitId=""
// }
// this.GetProData()
setTimeout(()=>{
this.GetProData()
},500)
},
//
async GetProData() {
const params = { unitId: this.queryParams.unitId}
const res = await getProjectList(params)
this.proList = res.data
this.queryParams.proId=null
},
proChange(val){
if(val&&val.length>0){
this.queryParams.proId=this.projectId[this.projectId.length - 1]
}else if(val&&val.length==0){
this.queryParams.proId=""
}
this.GetUnitData()
// if(val&&val.length>0){
// this.queryParams.proId=this.projectId[this.projectId.length - 1]
// }else if(val&&val.length==0){
// this.queryParams.proId=""
// }
// this.GetUnitData()
setTimeout(()=>{
this.GetUnitData()
},500)
},
//