From 64863f35946b2aa499660b3435d155da71c057e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E8=BF=90=E6=A8=A1?= <1724894114@qq.com> Date: Thu, 31 Oct 2024 13:14:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=A4=87=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/route.js | 104 +++++++++--------- .../setting/partsMag/components/info.vue | 64 +++++++---- .../setting/partsMag/components/library.vue | 73 ++++++------ src/views/setting/partsMag/index.vue | 2 +- 4 files changed, 132 insertions(+), 111 deletions(-) diff --git a/src/config/route.js b/src/config/route.js index 8cfc0d2..268a038 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -17,60 +17,56 @@ const routes = [ }, }, - { - name: "home", - path: "/home", - meta: { - icon: "sc-icon-Home", - title: "首页", - hidden: true - }, - children: [{ - name: "dashboard", - path: "/dashboard", - component: "home/console", - meta: { - icon: "sc-icon-Console", - title: "控制台", - } - },{ - name: "userCenter", - path: "/user-center", - component: "userCenter", - meta: { - icon: "sc-icon-UserInfo", - title: "个人信息", - } - },{ - name: "document", - path: "/document", - component: "docsManager/index", - meta: { - icon: "sc-icon-UserInfo", - title: "文档管理", - } - },{ - name: "earlyWarning", - path: "/early-warning", - component: "earlyManager/index", - meta: { - icon: "sc-icon-UserInfo", - title: "预警管理", - } - },{ - name: "mail", - path: "/mail", - component: "userCenter", - meta: { - icon: "sc-icon-UserInfo", - title: "我的邮件", - } - }] - }, - - - - + // { + // name: "home", + // path: "/home", + // meta: { + // icon: "sc-icon-Home", + // title: "首页", + // hidden: true + // }, + // children: [{ + // name: "dashboard", + // path: "/dashboard", + // component: "home/console", + // meta: { + // icon: "sc-icon-Console", + // title: "控制台", + // } + // },{ + // name: "userCenter", + // path: "/user-center", + // component: "userCenter", + // meta: { + // icon: "sc-icon-UserInfo", + // title: "个人信息", + // } + // },{ + // name: "document", + // path: "/document", + // component: "docsManager/index", + // meta: { + // icon: "sc-icon-UserInfo", + // title: "文档管理", + // } + // },{ + // name: "earlyWarning", + // path: "/early-warning", + // component: "earlyManager/index", + // meta: { + // icon: "sc-icon-UserInfo", + // title: "预警管理", + // } + // },{ + // name: "mail", + // path: "/mail", + // component: "userCenter", + // meta: { + // icon: "sc-icon-UserInfo", + // title: "我的邮件", + // } + // }] + // }, // { // name: "setting", diff --git a/src/views/setting/partsMag/components/info.vue b/src/views/setting/partsMag/components/info.vue index 5bd8339..9a7c87a 100644 --- a/src/views/setting/partsMag/components/info.vue +++ b/src/views/setting/partsMag/components/info.vue @@ -17,7 +17,7 @@
{{searchShow?'收起':'更多'}} 查询 - 重置 + 重置
@@ -67,18 +67,16 @@ export default { selection: [], searchList:[ {name:'创建日期',type:'date',code:'created_at',show:true}, - {name:'ERP编号',type:'text',code:['sn'],placeholder:"请输入备件SN",show:true}, - {name:'供应商',type:'text',code:['receive_city'],placeholder:"请输入收获城市",isOpen:true,show:false}, - {name:'名称',type:'date',code:'receive_date',show:true}, - {name:'制造商型号',type:'text',code:['final_status'],placeholder:"请输入最终状态",isOpen:true,show:false}, - {name:'规格',type:'text',code:['order_number'],placeholder:"请输入单号",isOpen:true,show:false}, - {name:'创建人',type:'text',code:['warehouse'],placeholder:"请输入库房",isOpen:true,show:false}, - {name:'关键字',type:'text',code:['remark','erp_pn'],keyword:true,show:true}, + {name:'ERP编号',type:'select',code:['erp_pn'],data:[],placeholder:"请输入ERP编号",show:true}, + {name:'供应商',type:'select',code:['vendor'],data:[],placeholder:"请输入供应商",isOpen:true,show:false}, + {name:'名称',type:'text',code:['name'],data:[],placeholder:"请输入名称",show:true}, + {name:'制造商型号',type:'select',code:['mpn'],data:[],placeholder:"请输入制造商型号",isOpen:true,show:false}, + {name:'规格',type:'text',code:['specification'],placeholder:"请输入规格",isOpen:true,show:false}, + {name:'创建人',type:'select',code:['creator_name'],data:[], placeholder:"请输入创建人",isOpen:true,show:false}, + {name:'关键字',type:'text',code:['remark','name'],keyword:true,show:true}, ], searchShow:false, - params: { - keyword: null - } + params: {} } }, mounted() { @@ -93,8 +91,31 @@ export default { } }) }, - getSelectData(){ - + async getSelectData(item){ + let {data, params} = item; + this.params = params; + let searchParams = this.$TOOL.objCopy(params); + searchParams.field = "" + if (typeof data.code === 'string') { + searchParams.field = data.code; + } else { + searchParams.field = data.code[0]; + } + if (data.type == 'select') { + const res = await this.$API.system.spareInfo.field.post(searchParams); + if (res.code == 200) { + if (res.data && res.data.length > 0) { + res.data.forEach(item => { + item.label = item[data.code]; + }) + } + this.searchList.forEach(item => { + if (item.code == data.code) { + item.data = res.data; + } + }) + } + } }, //添加 @@ -157,19 +178,14 @@ export default { selectionChange(selection){ this.selection = selection; }, - //表格内开关 - changeSwitch(val, row){ - row.status = row.status === '1'?'0':'1' - row.$switch_status = true; - setTimeout(()=>{ - delete row.$switch_status; - row.status = val; - this.$message.success("操作成功") - }, 500) - }, //搜索 upSearch(){ - this.$refs.table.refresh(); + this.$refs.table.upData(this.params); + }, + reset(){ + this.params = {}; + this.$refs.scSearch.reload(); + this.$refs.table.reload(); }, //本地更新数据 diff --git a/src/views/setting/partsMag/components/library.vue b/src/views/setting/partsMag/components/library.vue index a1672ee..3d66f31 100644 --- a/src/views/setting/partsMag/components/library.vue +++ b/src/views/setting/partsMag/components/library.vue @@ -17,10 +17,10 @@
{{searchShow?'收起':'更多'}} 查询 - 重置 + 重置
- + @@ -67,20 +67,18 @@ export default { selection: [], searchList:[ {name:'创建日期',type:'date',code:'created_at',show:true}, - {name:'备件SN',type:'text',code:['sn'],placeholder:"请输入备件SN",show:true}, - {name:'收获城市',type:'text',code:['receive_city'],placeholder:"请输入收获城市",isOpen:true,show:false}, + {name:'备件SN',type:'select',code:['sn'],data:[],placeholder:"请输入备件SN",show:true}, + {name:'收获城市',type:'select',code:['receive_city'],data:[],placeholder:"请输入收获城市",isOpen:true,show:false}, {name:'收货日期',type:'date',code:'receive_date',show:true}, - {name:'最终状态',type:'text',code:['final_status'],placeholder:"请输入最终状态",isOpen:true,show:false}, - {name:'单号',type:'text',code:['order_number'],placeholder:"请输入单号",isOpen:true,show:false}, - {name:'库房',type:'text',code:['warehouse'],placeholder:"请输入库房",isOpen:true,show:false}, - {name:'FW',type:'text',code:['fw'],placeholder:"请输入FW",isOpen:true,show:false}, - {name:'到货类型',type:'text',code:['delivery_type'],placeholder:"请输入到货类型",isOpen:true,show:false}, + {name:'最终状态',type:'select',code:['final_status'],data:[],placeholder:"请输入最终状态",isOpen:true,show:false}, + {name:'单号',type:'select',code:['order_number'],data:[],placeholder:"请输入单号",isOpen:true,show:false}, + {name:'库房',type:'select',code:['warehouse'],data:[],placeholder:"请输入库房",isOpen:true,show:false}, + {name:'FW',type:'select',code:['fw'],data:[],placeholder:"请输入FW",isOpen:true,show:false}, + {name:'到货类型',type:'select',code:['delivery_type'],data:[],placeholder:"请输入到货类型",isOpen:true,show:false}, {name:'关键字',type:'text',code:['remark','erp_pn'],keyword:true,show:true}, ], searchShow:false, - params: { - keyword: null - } + params: {} } }, mounted() { @@ -95,8 +93,31 @@ export default { } }) }, - getSelectData(){ - + async getSelectData(item) { + let {data, params} = item; + this.params = params; + let searchParams = this.$TOOL.objCopy(params); + searchParams.field = "" + if (typeof data.code === 'string') { + searchParams.field = data.code; + } else { + searchParams.field = data.code[0]; + } + if (data.type == 'select') { + const res = await this.$API.system.spare.field.post(searchParams); + if (res.code == 200) { + if (res.data && res.data.length > 0) { + res.data.forEach(item => { + item.label = item[data.code]; + }) + } + this.searchList.forEach(item => { + if (item.code == data.code) { + item.data = res.data; + } + }) + } + } }, //添加 @@ -120,13 +141,6 @@ export default { this.$refs.saveDialog.open('show').setData(row); }) }, - //权限设置 - permission(){ - this.dialog.permission = true - this.$nextTick(() => { - this.$refs.permissionDialog.open(); - }) - }, //删除 async table_del(row){ const reqData = {ids: [row.id]}; @@ -159,19 +173,14 @@ export default { selectionChange(selection){ this.selection = selection; }, - //表格内开关 - changeSwitch(val, row){ - row.status = row.status === '1'?'0':'1' - row.$switch_status = true; - setTimeout(()=>{ - delete row.$switch_status; - row.status = val; - this.$message.success("操作成功") - }, 500) - }, //搜索 upSearch(){ - this.$refs.table.refresh(); + this.$refs.table.upData(this.params); + }, + reset(){ + this.params = {}; + this.$refs.scSearch.reload(); + this.$refs.table.reload(); }, //本地更新数据 diff --git a/src/views/setting/partsMag/index.vue b/src/views/setting/partsMag/index.vue index a6016ce..3fac0f7 100644 --- a/src/views/setting/partsMag/index.vue +++ b/src/views/setting/partsMag/index.vue @@ -1,6 +1,6 @@