diff --git a/src/views/productionSchedulingPlan/basic/oemProcess.vue b/src/views/productionSchedulingPlan/basic/oemProcess.vue index b1ee4aa..14129bb 100644 --- a/src/views/productionSchedulingPlan/basic/oemProcess.vue +++ b/src/views/productionSchedulingPlan/basic/oemProcess.vue @@ -89,31 +89,52 @@ export default { searchMenuPosition: 'right', align: 'center', column: [ - { label: '工序', - prop: 'processId', - search: true, + prop: 'processIds', + search: false, sortable: true, span: 12, type: 'select', filterable: true, + multiple: true, + hide: true, dicUrl: '/blade-scheduling/processSet/findList', props: { label: 'name', value: 'id', }, change: (val, row) => { - this.onChangeData(val.item, 'processId'); + console.log('change', val, row); + this.onChangeData(val, 'processIds', row); }, }, + { + label: '工序', + prop: 'processIds', + search: true, + sortable: true, + span: 12, + type: 'select', + filterable: true, + multiple: false, + hide: true, + display:false, + dicUrl: '/blade-scheduling/processSet/findList', + props: { + label: 'name', + value: 'id', + }, + // change: (val, row) => { + // this.onChangeData(val, 'processIds', row); + // }, + }, { label: '工序', prop: 'processName', search: false, sortable: true, span: 12, - hide: true, display: false, }, { @@ -123,7 +144,7 @@ export default { sortable: true, span: 12, type: 'number', - precision: 0 + precision: 0, }, { label: '备注', @@ -139,16 +160,41 @@ export default { }; }, methods: { - onChangeData(val, type) { - if (val && type == 'workCenterId') { - this.form.workCenterName = val.wcName; - } - if (val && type == 'processId') { - this.form.processName = val.name; - } - if (val && type == 'craftId') { - this.form.craftName = val.caName; + onChangeData(val, type, row) { + // if (val && type == 'workCenterId') { + // this.form.workCenterName = val.wcName; + // } + if (val.value && type == 'processIds') { + // this.form.processName = val.name; + if(!val.value){ + return false + } + // 获取字典数据(从select的选项中) + // const processDic = val.dic.find(col => col.prop === 'processId').dicData || []; + // console.log('processDic',val.dic) + // 筛选选中id对应的名称并拼接 + const selectedNames = val.value.map(id => { + const item = val.dic.find(dic => dic.id === id); + console.log('item',item) + return item ? item.name : ''; + }) + .filter(name => name) // 过滤空值 + .join(','); + + // 根据场景赋值(新增/编辑) + if (row) { + // 编辑状态 - 给当前行赋值 + this.form.processName = selectedNames; + this.form.processId = val.value.join(','); + } else { + // 新增状态 - 给表单赋值 + this.form.processName = selectedNames; + this.form.processId = val.value.join(','); + } } + // if (val && type == 'craftId') { + // this.form.craftName = val.caName; + // } }, rowSave(row, done, loading) { addOutsourceProcess(row).then( @@ -215,7 +261,7 @@ export default { }, selectionClear() { this.selectionList = []; - this.$refs.crud.toggleSelection(); + // this.$refs.crud.toggleSelection(); }, currentChange(currentPage) { @@ -229,14 +275,16 @@ export default { }, onLoad(page, params = {}) { this.loading = true; - getListOutsourceProcess(page.currentPage, page.pageSize, Object.assign(params, this.query)).then( - res => { - this.data = res.data.data.records; - this.loading = false; - this.page.total = res.data.data.total; - this.selectionClear(); - } - ); + getListOutsourceProcess( + page.currentPage, + page.pageSize, + Object.assign(params, this.query) + ).then(res => { + this.data = res.data.data.records; + this.loading = false; + this.page.total = res.data.data.total; + this.selectionClear(); + }); }, }, mounted() {},