diff --git a/src/views/material/back/component/addReturn.vue b/src/views/material/back/component/addReturn.vue index f46e1a66..7c29184a 100644 --- a/src/views/material/back/component/addReturn.vue +++ b/src/views/material/back/component/addReturn.vue @@ -11,7 +11,14 @@ > - + + > --> - + + > --> + :options="unitList" :normalizer="normalizer" + :show-count="true" style="width: 240px" :disable-branch-nodes="true" + noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果" + placeholder="请选择退料单位" @select="unitChange" + /> - - + :options="proList" :normalizer="normalizer" + :show-count="true" style="width: 240px" :disable-branch-nodes="true" + noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果" + placeholder="请选择退料工程" @select="proChange" + /> { - // this.companyId = res.user.companyId - // this.getList() - // }) - }, + /** 转换菜单数据结构 */ + normalizer(node) { + if (node.children && !node.children.length) { + delete node.children; + } + return { + id: node.id, + label: node.name, + children: node.children, + }; + }, initSelectData() { this.GetUnitData() this.GetProData() @@ -508,37 +478,30 @@ export default { // 获取 来往单位 列表数据 async GetUnitData() { const params = { - projectId: this.queryParams.proId /* */, + // projectId: this.queryParams.proId /* */, } const res = await getUnitList(params) - this.unitList = res.data + 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() - }, - + unitChange(val){ + setTimeout(()=>{ + this.GetProData() + },500) + }, // 获取 工程名称 列表数据 async GetProData() { const params = { unitId: this.queryParams.unitId, } const res = await getProjectList(params) - this.proList = res.data + 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() - }, - + proChange(val){ + setTimeout(()=>{ + this.GetUnitData() + },500) + }, /** 查询列表 startTime,结束日期endTime */ async getList() { this.loading = true