diff --git a/ant-design-vue-jeecg/src/views/device/ZyDeviceListRef.vue b/ant-design-vue-jeecg/src/views/device/ZyDeviceListRef.vue new file mode 100644 index 00000000..0299a93c --- /dev/null +++ b/ant-design-vue-jeecg/src/views/device/ZyDeviceListRef.vue @@ -0,0 +1,195 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/devicetype/ZyDevicetypeListRef.vue b/ant-design-vue-jeecg/src/views/devicetype/ZyDevicetypeListRef.vue index 9a27a0cc..ecfcb124 100644 --- a/ant-design-vue-jeecg/src/views/devicetype/ZyDevicetypeListRef.vue +++ b/ant-design-vue-jeecg/src/views/devicetype/ZyDevicetypeListRef.vue @@ -1,304 +1,301 @@ - + + + + + + + + + + + + - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList.vue b/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList.vue index bef4569a..2a210fd6 100644 --- a/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList.vue +++ b/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList.vue @@ -1,111 +1,30 @@ @@ -114,189 +33,135 @@ import '@/assets/less/TableExpand.less' import {mixinDevice} from '@/utils/mixin' import {JeecgListMixin} from '@/mixins/JeecgListMixin' -import ZyPlanProcessModal from './modules/ZyPlanProcessModal2' -import {getAction} from "@api/manage"; -import {filterObj} from "@/utils/util"; +import {getAction, postAction} from "@api/manage"; +import {filterObj, pushIfNotExist, randomNumber, randomUUID} from "@/utils/util"; +import {JVXETypes} from '@/components/jeecg/JVxeTable' export default { - name: 'ZyPlanProcessList', + name: 'ZyPlanProcessDataList', mixins: [JeecgListMixin, mixinDevice], - components: { - ZyPlanProcessModal - }, data() { - // this.cacheData = this.dataSource.map(item => ({ ...item })); - this.cacheData = []; return { + toolbarConfig: { + // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮 + btn: ['save'] + }, description: '生产计划工序管理页面', + loading: false, + // 分页器参数 + // pagination: { + // // 当前页码 + // current: 1, + // // 每页的条数 + // pageSize: 10, + // // 可切换的条数 + // pageSizeOptions: ['10', '20', '30', '50'], + // // 数据总数(目前并不知道真实的总数,所以先填写0,在后台查出来后再赋值) + // total: 0, + // }, + // 选择的行 + // selectedRows: [], + // 数据源,控制表格的数据 + dataSource: [], // columns, - // 表头 columns: [ - { - title: '#', - dataIndex: 'productProcessId', - key: 'rowIndex', - width: 60, - align: "center", - customRender: function (t, r, index) { - return parseInt(index) + 1; - } - }, - /* { - title: '计划id', - align: "center", - dataIndex: 'planId' - },*/ - { - title: '工单编号', - align: "center", - dataIndex: 'workOrderId', - scopedSlots: {customRender: 'workOrderId'} - }, - /*{ - title: '产品id', - align: "center", - dataIndex: 'productId' - }, - { - title: '工序id', - align: "center", - dataIndex: 'productProcessId' - },*/ - { - title: '产品', - align: "center", - dataIndex: 'productName' - }, - { - title: '车间', - align: "center", - dataIndex: 'departName' - }, - { - title: '工序', - align: "center", - dataIndex: 'processName' - }, + {key: 'workOrderId', title: '工单编号', width: '180px'}, + {key: 'productName', title: '产品名称', width: '180px'}, + {key: 'departName', title: '车间名称', width: '180px'}, + {key: 'processName', title: '工序名称', width: '180px'}, { title: '工位列表', - align: "center", - dataIndex: 'stationList', - width: 150, - scopedSlots: {customRender: 'stationList'} - }, - { - title: '工位工具列表', - align: "center", - dataIndex: 'toolsList', - width: 150, - // scopedSlots: {customRender: this.toolsList} - scopedSlots: {customRender: 'toolsList'} - }, - { - title: '工具设备列表', - align: "center", - dataIndex: 'machineList', - width: 150, - scopedSlots: {customRender: 'machineList'} + key: 'stationId', + type: JVXETypes.select, + width: '200px', + options: [], + placeholder: '请选择${title}', + }, { + title: '设备列表', + key: 'machineIds', + type: JVXETypes.selectMultiple, + width: '200px', + options: [], + placeholder: '请选择${title}', + }, { + title: '工具列表', + key: 'toolsIds', + type: JVXETypes.selectMultiple, + width: '200px', + options: [], + placeholder: '请选择${title}', }, { + key: 'proProcess', title: '前导工序', - align: "center", - dataIndex: 'proProcess', - width: 150, - scopedSlots: {customRender: 'proProcess'} + dictCode: 'zy_process,process_name,id,id in(select process_id from zy_product_process where product_id="1")', + width: '150', + type: JVXETypes.select }, - { - title: '后导工序', - align: "center", - dataIndex: 'proProcess', - width: 150, - scopedSlots: {customRender: 'postProcess'} - }, - { - title: '输入产品', - align: "center", - dataIndex: 'inputProduct', - width: 150, - scopedSlots: {customRender: 'inputProduct'} - }, - { - title: '成品/半成品', - align: "center", - dataIndex: 'semiProduct', - width: 150, - scopedSlots: {customRender: 'semiProduct'} - }, - - // { - // title: 'operation', - // dataIndex: 'operation', - // scopedSlots: {customRender: 'operation'}, - // }, - - // { - // title: '操作', - // dataIndex: 'action', - // align: "center", - // fixed: "right", - // width: 147, - // scopedSlots: {customRender: 'action'} - // } + {key: 'postProcess', title: '后导工序', width: '150', type: JVXETypes.select}, + {key: 'inputProduct', title: '输入产品', width: '150', type: JVXETypes.input}, + {key: 'semiProduct', title: '成品/半成品', width: '150', type: JVXETypes.input}, ], - editingKey: '', url: { list: "/org.jeecg.modules.productplan/zyPlanProcess/getProcessDatalist", - stationToolslist: "/stationTool/list", - stationMachinelist: "/stationMachine/list", - // productPlanlist: "/org.jeecg.modules.productplan/zyProductPlan/list", - delete: "/org.jeecg.modules.productplan/zyPlanProcess/delete", - // deleteBatch: "/org.jeecg.modules.productplan/zyPlanProcess/deleteBatch", - // exportXlsUrl: "/org.jeecg.modules.productplan/zyPlanProcess/exportXls", - // importExcelUrl: "org.jeecg.modules.productplan/zyPlanProcess/importExcel", + stationToolslist: "/stationTool/list2", + stationMachinelist: "/stationMachine/list2", + addProcessBatch: "/org.jeecg.modules.productplan/zyPlanProcess/addProcessBatch", }, loadRouteType: false, planId: "", dictOptions: {}, - // superFieldList: [], + superFieldList: [], + stationList: [], toolsList: [], machineList: [], + clickTrue: true, } }, created() { - this.getSuperFieldList(); - }, - computed: { - importExcelUrl: function () { - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; - }, }, methods: { + + // 【整体保存】点击保存按钮时触发的事件 + handleTableSave({$table, target}) { + console.log("保存开始-----") + // 校验整个表格 + $table.validate().then((errMap) => { + // 校验通过 + if (!errMap) { + // 获取所有数据 + let tableData = target.getTableData() + tableData.forEach(item => { + item.id = ''; + }) + console.log('当前保存的数据是:', tableData) + // // 获取新增的数据 + // let newData = target.getNewData() + // console.log('-- 新增的数据:', newData) + // // 获取删除的数据 + // let deleteData = target.getDeleteData() + // console.log('-- 删除的数据:', deleteData) + + // 【模拟保存】 + this.loading = true + postAction(this.url.addProcessBatch, tableData).then(res => { + if (res.success) { + this.$message.success(`保存成功!`) + } else { + this.$message.warn(`保存失败:` + res.message) + } + }).finally(() => { + this.loading = false + }) + } + }) + }, fanHui() { this.$router.push({ path: '/productplan/ZyPlanProcessList', }); }, - getToolAndMachine(stationId) { - // alert("stationId=" + stationId); - getAction(this.url.stationToolslist, {"stationId": stationId}).then((res) => { - if (res.success) { - this.toolsList = res.result.records || res.result; - console.log("toolsList", JSON.stringify(this.toolsList)) - } else { - this.$message.warning(res.message) - } - }); - getAction(this.url.stationMachinelist, {"stationId": stationId}).then((res) => { - if (res.success) { - this.machineList = res.result.records || res.result; - console.log("machineList", JSON.stringify(this.toolsList)) - } else { - this.$message.warning(res.message) - } - }); - }, //加载传递参数 loadParameter() { if (this.loadRouteType === false) { @@ -307,14 +172,16 @@ export default { } }, loadData(arg) { + console.log("the loadData---------开始"); + // var that = this; if (!this.url.list) { this.$message.error("请设置url.list属性!") return } //加载数据 若传入参数1则加载第一页的内容 - if (arg === 1) { - this.ipagination.current = 1; - } + // if (arg === 1) { + // this.ipagination.current = 1; + // } this.loadParameter(); var params = this.getQueryParams();//查询条件 this.loading = true; @@ -322,19 +189,12 @@ export default { getAction(this.url.list, params).then((res) => { if (res.success) { this.dataSource = res.result.records || res.result; - if (res.result.total) { - this.ipagination.total = res.result.total; - } else { - this.ipagination.total = 0; - } + this.stationList = this.dataSource[0].stationList; } else { + // this.stationIdCode = "station,station_name,id,depart_id in (select workshop_id from zy_product_plan where id='" + this.planId + "')"; this.$message.warning(res.message) } }).finally(() => { - // this.dataSource.forEach(item => { - // item['stationName'] = this.stationName; - // item['stationNum'] = this.stationNum; - // }) this.loading = false }) }, @@ -352,78 +212,61 @@ export default { param.planId = this.planId; return filterObj(param); }, - // initDictConfig() { - // }, - getSuperFieldList() { - // let fieldList = []; - // fieldList.push({type: 'string', value: 'id', text: 'id', dictCode: ''}) - // fieldList.push({type: 'string', value: 'planId', text: '生产计划id', dictCode: ''}) - // fieldList.push({type: 'string', value: 'productName', text: '生产计划id', dictCode: ''}) - // fieldList.push({type: 'string', value: 'stationId', text: '工位id', dictCode: ''}) - // fieldList.push({type: 'string', value: 'machineIds', text: '设备id列表', dictCode: ''}) - // fieldList.push({type: 'string', value: 'toolsIds', text: '工具id列表', dictCode: ''}) - // fieldList.push({type: 'string', value: 'productProcessId', text: '工序id列表', dictCode: ''}) - // fieldList.push({type: 'string', value: 'productProcessId', text: '工序id列表', dictCode: ''}) - // fieldList.push({type: 'string', value: 'userIds', text: '成员id列表', dictCode: ''}) - // this.superFieldList = fieldList - }, - // handleChange(value, key, column) { - // const newData = [...this.data]; - // const target = newData.find(item => key === item.key); - // if (target) { - // target[column] = value; - // this.data = newData; - // } - // }, - edit(key) { - alert("the edit() record =" + JSON.stringify(key)) - // const newData = [...this.data]; - const newData = [...this.dataSource]; - // const newData = record; - console.log("the edit() newData =", JSON.stringify(newData)); - // this.editingKey = '0'; - // record.editable = true; - // const target = newData.find(item => key === item.key); - const target = newData[0]; - console.log("the edit() target =", JSON.stringify(target)); - this.editingKey = key; - console.log("the edit() editingKey =", this.editingKey); - if (target) { - // debugger; - target.editable = true; - this.dataSource = newData; - } - }, - save(key) { - // const newData = [...this.data]; - const newData = this.dataSource; - console.log("save() newData=", JSON.stringify(newData)) - const newCacheData = [...this.cacheData]; - const target = newData.find(item => key === item.key); - const targetCache = newCacheData.find(item => key === item.key); - if (target && targetCache) { - delete target.editable; - this.dataSource = newData; - Object.assign(targetCache, target); - this.cacheData = newCacheData; - } - this.editingKey = ''; + + // 当选择的行变化时触发的事件 + handleSelectRowChange(event) { + console.log("handleSelectRowChange") + console.log("handleSelectRowChange-event:", event) + const {type, row, column, value, target, $table} = event + console.log(JSON.stringify(this.stationList)); + // target.$refs.vxe.columns[6].dictCode = this.stationIdCode; + target.$refs.vxe.columns[6].options = this.stationList; + // 清空后两列的数据 + // target.setValues([{ + // rowKey: row.id, + // values: {machineIds: '', toolsIds: ''} + // }]) + // target.$refs.vxe.columns[4].options = [] }, - cancel(key) { - const newData = this.dataSource; - const target = newData.find(item => key === item.key); - this.editingKey = ''; - if (target) { - Object.assign(target, this.cacheData.find(item => key === item.key)); - delete target.editable; - this.dataSource = newData; + /** 当选项被改变时,联动其他组件 */ + handleValueChange(event) { + const {type, row, column, value, target} = event + console.log("event", event) + console.log("row", row) + // if (type === JVXETypes.select) { + // 第一列 + if (column.key === 'stationId') { + // 设置第二列的 options + console.log('this stationid(row.id):', row.stationId) + // 清空后两列的数据 + target.setValues([{ + rowKey: row.id, + values: {machineIds: '', toolsIds: ''} + }]) + target.$refs.vxe.columns[7].options = [] + target.$refs.vxe.columns[8].options = [] + + getAction(this.url.stationMachinelist, {"stationId": row.stationId}).then((res) => { + if (res.success) { + this.machineList = res.result.records || res.result; + console.log("machineList", JSON.stringify(this.machineList)) + target.$refs.vxe.columns[7].options = this.machineList; + } else { + this.$message.warning(res.message) + } + }); + + getAction(this.url.stationToolslist, {"stationId": row.stationId}).then((res) => { + if (res.success) { + this.toolsList = res.result.records || res.result; + console.log("toolsList", JSON.stringify(this.toolsList)) + target.$refs.vxe.columns[8].options = this.toolsList; + } else { + this.$message.warning(res.message) + } + }); } - }, + } }, }; - \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList_back1223.vue b/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList_back1223.vue index f17cd089..6f91939d 100644 --- a/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList_back1223.vue +++ b/ant-design-vue-jeecg/src/views/productplan/ZyPlanProcessDataList_back1223.vue @@ -1,52 +1,13 @@