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

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> -->
<el-form-item label="往来单位" prop="unitId"> <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" :show-all-levels="false"
:options="unitList" :options="unitList"
:props="selectTreeProps" :props="selectTreeProps"
@ -30,10 +37,17 @@
collapse-tags collapse-tags
@change="unitChange" @change="unitChange"
placeholder="请选择往来单位" placeholder="请选择往来单位"
></el-cascader> ></el-cascader> -->
</el-form-item> </el-form-item>
<el-form-item label="工程名称" prop="proId"> <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" :show-all-levels="false"
:options="proList" :options="proList"
:props="selectTreeProps" :props="selectTreeProps"
@ -41,7 +55,7 @@
collapse-tags collapse-tags
@change="proChange" @change="proChange"
placeholder="请选择工程名称" placeholder="请选择工程名称"
></el-cascader> ></el-cascader> -->
</el-form-item> </el-form-item>
<el-form-item label="物资名称" prop="typeName"> <el-form-item label="物资名称" prop="typeName">
<el-input <el-input
@ -145,9 +159,12 @@ import {
getProjectList, getProjectList,
getUnitList, getUnitList,
} from '@/api/back/index.js' } from '@/api/back/index.js'
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: '', name: '',
dicts: [], dicts: [],
components: { Treeselect },
data() { data() {
return { return {
// //
@ -184,6 +201,8 @@ export default {
pageSize: 10, pageSize: 10,
time: null, time: null,
keyWord: null, keyWord: null,
unitId: null,
proId: null,
typeName: null, // typeName: null, //
typeModelName: null, // typeModelName: null, //
outStyle:null outStyle:null
@ -199,35 +218,53 @@ export default {
this.GetUnitData() this.GetUnitData()
this.GetProData() 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() { async GetUnitData() {
const params = { const params = {
projectId: this.queryParams.proId /* */, // projectId: this.queryParams.proId /* */,
} }
const res = await getUnitList(params) const res = await getUnitList(params)
this.unitList = res.data this.unitList = res.data
}, },
unitChange(val){ unitChange(val){
if(val&&val.length>0){ // if(val&&val.length>0){
this.queryParams.unitId=this.unitId[this.unitId.length - 1] // this.queryParams.unitId=this.unitId[this.unitId.length - 1]
}else if(val&&val.length==0){ // }else if(val&&val.length==0){
this.queryParams.unitId="" // this.queryParams.unitId=""
} // }
this.GetProData() // this.GetProData()
setTimeout(()=>{
this.GetProData()
},500)
}, },
// //
async GetProData() { async GetProData() {
const params = { unitId: this.queryParams.unitId} const params = { unitId: this.queryParams.unitId}
const res = await getProjectList(params) const res = await getProjectList(params)
this.proList = res.data this.proList = res.data
this.queryParams.proId=null
}, },
proChange(val){ proChange(val){
if(val&&val.length>0){ // if(val&&val.length>0){
this.queryParams.proId=this.projectId[this.projectId.length - 1] // this.queryParams.proId=this.projectId[this.projectId.length - 1]
}else if(val&&val.length==0){ // }else if(val&&val.length==0){
this.queryParams.proId="" // this.queryParams.proId=""
} // }
this.GetUnitData() // this.GetUnitData()
setTimeout(()=>{
this.GetUnitData()
},500)
}, },
// //
jumpLease(code){ jumpLease(code){

View File

@ -21,7 +21,14 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="往来单位" prop="unitId"> <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" :show-all-levels="false"
:options="unitList" :options="unitList"
:props="selectTreeProps" :props="selectTreeProps"
@ -30,10 +37,17 @@
collapse-tags collapse-tags
@change="unitChange" @change="unitChange"
placeholder="请选择往来单位" placeholder="请选择往来单位"
></el-cascader> ></el-cascader> -->
</el-form-item> </el-form-item>
<el-form-item label="工程名称" prop="proId"> <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" :show-all-levels="false"
:options="proList" :options="proList"
:props="selectTreeProps" :props="selectTreeProps"
@ -41,7 +55,7 @@
collapse-tags collapse-tags
@change="proChange" @change="proChange"
placeholder="请选择工程名称" placeholder="请选择工程名称"
></el-cascader> ></el-cascader> -->
</el-form-item> </el-form-item>
<el-form-item label="物资名称" prop="typeName"> <el-form-item label="物资名称" prop="typeName">
<el-input <el-input
@ -131,9 +145,12 @@ import {
getProjectList, getProjectList,
getUnitList, getUnitList,
} from '@/api/back/index.js' } from '@/api/back/index.js'
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: '', name: '',
dicts: [], dicts: [],
components: { Treeselect },
data() { data() {
return { return {
// //
@ -169,6 +186,8 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
time: null, time: null,
unitId: null,
proId: null,
keyWord: null, keyWord: null,
typeName: null, // typeName: null, //
statusName: null // statusName: null //
@ -184,35 +203,53 @@ export default {
this.GetUnitData() this.GetUnitData()
this.GetProData() 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() { async GetUnitData() {
const params = { const params = {
projectId: this.queryParams.proId /* */, // projectId: this.queryParams.proId /* */,
} }
const res = await getUnitList(params) const res = await getUnitList(params)
this.unitList = res.data this.unitList = res.data
}, },
unitChange(val){ unitChange(val){
if(val&&val.length>0){ // if(val&&val.length>0){
this.queryParams.unitId=this.unitId[this.unitId.length - 1] // this.queryParams.unitId=this.unitId[this.unitId.length - 1]
}else if(val&&val.length==0){ // }else if(val&&val.length==0){
this.queryParams.unitId="" // this.queryParams.unitId=""
} // }
this.GetProData() // this.GetProData()
setTimeout(()=>{
this.GetProData()
},500)
}, },
// //
async GetProData() { async GetProData() {
const params = { unitId: this.queryParams.unitId} const params = { unitId: this.queryParams.unitId}
const res = await getProjectList(params) const res = await getProjectList(params)
this.proList = res.data this.proList = res.data
this.queryParams.proId=null
}, },
proChange(val){ proChange(val){
if(val&&val.length>0){ // if(val&&val.length>0){
this.queryParams.proId=this.projectId[this.projectId.length - 1] // this.queryParams.proId=this.projectId[this.projectId.length - 1]
}else if(val&&val.length==0){ // }else if(val&&val.length==0){
this.queryParams.proId="" // this.queryParams.proId=""
} // }
this.GetUnitData() // this.GetUnitData()
setTimeout(()=>{
this.GetUnitData()
},500)
}, },
// //

View File

@ -21,7 +21,14 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="往来单位" prop="unitId"> <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" :show-all-levels="false"
:options="unitList" :options="unitList"
:props="selectTreeProps" :props="selectTreeProps"
@ -30,10 +37,17 @@
collapse-tags collapse-tags
@change="unitChange" @change="unitChange"
placeholder="请选择往来单位" placeholder="请选择往来单位"
></el-cascader> ></el-cascader> -->
</el-form-item> </el-form-item>
<el-form-item label="工程名称" prop="proId"> <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" :show-all-levels="false"
:options="proList" :options="proList"
:props="selectTreeProps" :props="selectTreeProps"
@ -41,7 +55,7 @@
collapse-tags collapse-tags
@change="proChange" @change="proChange"
placeholder="请选择工程名称" placeholder="请选择工程名称"
></el-cascader> ></el-cascader> -->
</el-form-item> </el-form-item>
<el-form-item label="物资名称" prop="typeName"> <el-form-item label="物资名称" prop="typeName">
<el-input <el-input
@ -133,9 +147,12 @@ import {
getProjectList, getProjectList,
getUnitList, getUnitList,
} from '@/api/back/index.js' } from '@/api/back/index.js'
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: '', name: '',
dicts: [], dicts: [],
components: { Treeselect },
data() { data() {
return { return {
// //
@ -171,6 +188,8 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
time: null, time: null,
unitId: null,
proId: null,
keyWord: null, keyWord: null,
typeName: null, // typeName: null, //
isSlt: null // isSlt: null //
@ -186,35 +205,53 @@ export default {
this.GetUnitData() this.GetUnitData()
this.GetProData() 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() { async GetUnitData() {
const params = { const params = {
projectId: this.queryParams.proId /* */, // projectId: this.queryParams.proId /* */,
} }
const res = await getUnitList(params) const res = await getUnitList(params)
this.unitList = res.data this.unitList = res.data
}, },
unitChange(val){ unitChange(val){
if(val&&val.length>0){ // if(val&&val.length>0){
this.queryParams.unitId=this.unitId[this.unitId.length - 1] // this.queryParams.unitId=this.unitId[this.unitId.length - 1]
}else if(val&&val.length==0){ // }else if(val&&val.length==0){
this.queryParams.unitId="" // this.queryParams.unitId=""
} // }
this.GetProData() // this.GetProData()
setTimeout(()=>{
this.GetProData()
},500)
}, },
// //
async GetProData() { async GetProData() {
const params = { unitId: this.queryParams.unitId} const params = { unitId: this.queryParams.unitId}
const res = await getProjectList(params) const res = await getProjectList(params)
this.proList = res.data this.proList = res.data
this.queryParams.proId=null
}, },
proChange(val){ proChange(val){
if(val&&val.length>0){ // if(val&&val.length>0){
this.queryParams.proId=this.projectId[this.projectId.length - 1] // this.queryParams.proId=this.projectId[this.projectId.length - 1]
}else if(val&&val.length==0){ // }else if(val&&val.length==0){
this.queryParams.proId="" // this.queryParams.proId=""
} // }
this.GetUnitData() // this.GetUnitData()
setTimeout(()=>{
this.GetUnitData()
},500)
}, },
// //