diff --git a/src/application/mk/libs/function/funs.js b/src/application/mk/libs/function/funs.js index 9e4c918..6d95441 100644 --- a/src/application/mk/libs/function/funs.js +++ b/src/application/mk/libs/function/funs.js @@ -1,4 +1,5 @@ +import XEUtils from 'xe-utils' // 加载xe-utils import JSONbig from 'json-bigint' export default { @@ -11,6 +12,16 @@ export default { }, + getDateString(cellValue) { + if (!cellValue) { + return ''; + } + if (typeof (cellValue) == "number") { + cellValue = new Date(cellValue * 1000); + } + return XEUtils.toDateString(cellValue, 'yyyy-MM-dd HH:mm:ss') + }, + formatDetailData({ data, rules }) { if (data.create_time) { @@ -55,29 +66,29 @@ export default { //格式化提交的明细类型 字段 //如果要提交的数据(value) 已经不存在 原有数据 (oldlistdata) ,那么需要把id放到 value.deleteList - formatPostFieldValue({dataId,oldlistdata,value}){ - if(!dataId){ + formatPostFieldValue({ dataId, oldlistdata, value }) { + if (!dataId) { return; } - if(!oldlistdata){ + if (!oldlistdata) { return; } - if(!value){ + if (!value) { return; } - if(!value.insertList){ + if (!value.insertList) { return; } - oldlistdata.forEach(item=>{ - if(!item.id){ + oldlistdata.forEach(item => { + if (!item.id) { return; } - let exist1 = value.insertList.filter(a=>a.id && a.id.toString() == item.id.toString()).length; - let exist2 = value.updateList.filter(a=>a.id && a.id.toString() == item.id.toString()).length; - let exist3 = value.deleteList.filter(a=>a == item.id.toString()).length; - if(!exist1 && !exist2 && !exist3){ + let exist1 = value.insertList.filter(a => a.id && a.id.toString() == item.id.toString()).length; + let exist2 = value.updateList.filter(a => a.id && a.id.toString() == item.id.toString()).length; + let exist3 = value.deleteList.filter(a => a == item.id.toString()).length; + if (!exist1 && !exist2 && !exist3) { value.deleteList.push(item.id.toString()); - } + } }) return value; @@ -104,13 +115,13 @@ export default { item[rule.field] = parseFloat(value); } else if (rule.type == "timestamp") { - if(value){ - if(typeof(value) == 'string'){ + if (value) { + if (typeof (value) == 'string') { item[rule.field] = parseInt(new Date(value).getTime() / 1000); } - + } - + } else if (rule.type == "bigint") { if (typeof (item[rule.field]) == 'string') { @@ -127,7 +138,7 @@ export default { list.forEach(item => { item[fieldName] = dataId; }) - } + } if (dataId && type !== 'array') { diff --git a/src/pages/Middle/Mold/MoldProductionOrder/ComponentDetail.vue b/src/pages/Middle/Mold/MoldProductionOrder/ComponentDetail.vue index 567566c..3a242f8 100644 --- a/src/pages/Middle/Mold/MoldProductionOrder/ComponentDetail.vue +++ b/src/pages/Middle/Mold/MoldProductionOrder/ComponentDetail.vue @@ -19,8 +19,8 @@ - + - - - - - + + + + + + 完成 + + {{ $mk.getDateString(row.complete_time) }} + - - - - - - - - - - - - - - - - - - + @@ -91,8 +70,8 @@ :edit-render="{ name: 'MkGridDataSelector' }"> - + @@ -102,13 +81,23 @@ :edit-render="{ name: '$input', props: { type: 'date' } }"> - - + + + + 发料 + {{ $mk.getDateString(row.send_time) }} + + + - - + + + + 完成 + {{ $mk.getDateString(row.complete_time) }} + + + @@ -143,6 +132,10 @@ export default { type: String, default: "edit" }, + readonly: { + type: Boolean, + default: false + }, itemData: { type: Object }, @@ -371,12 +364,57 @@ export default { this.detailsData = JSON.parse(JSON.stringify(this.itemData.mold_production_order_component || [])); this.detailsData2 = JSON.parse(JSON.stringify(this.itemData.mold_production_order_component_processes || [])); + this.loadDepartment(); + this.detailsDataInit(); this.postDataUpdate(); }, + loadDepartment() { + + for (let i = 0; i < this.detailsData2.length; i++) { + if (this.detailsData2[i].process_id && !this.detailsData2[i].department_id) { + + this.$mk.post({ + url: `${BASE_URL.BASE_URL}/MesProcesses/v1/mes/processes/detail`, + data: { + id: this.$mk.toBigInt(this.detailsData2[i].process_id) + }, + useBigInt: true, + }).then(a => { + if (a.code == 200) { + let row = a.data.mes_processes; + if (row.department_id) { + this.detailsData2[i].department_id = row.department_id; + this.detailsData2[i].department_detail = row.department_detail; + + } + } + }); + + + } + } + }, + + + + pageIsComplete() { + for (let i = 0; i < this.detailsData.length; i++) { + if (this.detailsData[i].is_complete) { + return false; + } + } + for (let i = 0; i < this.detailsData2.length; i++) { + if (!this.detailsData2[i].is_complete) { + return false; + } + } + return true; + }, + getDateValue(v) { @@ -397,17 +435,57 @@ export default { }, // 获取路由的id参数 getDataId() { - let dataId = this.dataId; + let dataId = this.dataId; return dataId; }, getDataId_BigInt() { let dataId = this.getDataId(); return this.$mk.toBigInt(dataId); }, + pageComplete(row) { + this.$mk.post({ + url: `${BASE_URL.BASE_URL}/MoldProductionOrder/v1/mold/production/order/component/reporting`, + data: { + id: row.id + }, + useBigInt: true, + }).then(a => { + if (a.code == 200) { + this.$mk.success("操作成功"); + this.$emit("reloadData"); + } + }); + }, + pageDone(row) { + this.$mk.post({ + url: `${BASE_URL.BASE_URL}/MoldProductionOrder/v1/mold/production/order/component/processes/Reporting`, + data: { + id: row.id + }, + useBigInt: true, + }).then(a => { + if (a.code == 200) { + this.$mk.success("操作成功"); + this.$emit("reloadData"); + } + }); + }, - - + pageSend(row) { + this.$mk.post({ + url: `${BASE_URL.BASE_URL}/MoldProductionOrder/v1/mold/production/order/component/processes/SendMaterial`, + data: { + id: row.id + }, + useBigInt: true, + }).then(a => { + if (a.code == 200) { + this.$mk.success("操作成功"); + this.$emit("reloadData"); + } + }); + }, pageAdd(row) { const $table = this.$refs.xTable @@ -435,7 +513,6 @@ export default { this.postDataUpdate(); }, - pageAdd2(row) { const $table = this.$refs.xTable2 const record = { @@ -462,7 +539,7 @@ export default { this.postDataUpdate(); }, - postDataUpdate(){ + postDataUpdate() { let postdata = {}; postdata.mold_production_order_component = this.$mk.getPostFieldValue({ rowFilter: (row) => { return row.id || row.component_id }, @@ -475,9 +552,10 @@ export default { { field: 'component_num', type: 'integer' }, { field: 'prepare_process_time', type: 'timestamp' }, { field: 'plan_complete_time', type: 'timestamp' }, - + { field: 'id', type: 'bigint' }, { field: 'update_uid', type: 'bigint' }, + { field: 'complete_uid', type: 'bigint' }, { field: 'create_uid', type: 'bigint' }, { field: 'mold_id', type: 'bigint' }, { field: 'component_id', type: 'bigint' }, @@ -497,8 +575,10 @@ export default { { field: 'id', type: 'bigint' }, { field: 'prepare_process_time', type: 'timestamp' }, { field: 'plan_complete_time', type: 'timestamp' }, + - + { field: 'send_uid', type: 'bigint' }, + { field: 'complete_uid', type: 'bigint' }, { field: 'update_uid', type: 'bigint' }, { field: 'create_uid', type: 'bigint' }, { field: 'component_id', type: 'bigint' }, @@ -523,10 +603,13 @@ export default { this.postDataUpdate(); - + }, beforeEditEvent({ column, row }) { console.log(column, row); + if(this.readonly){ + return false; + } }, onPulldownSelected({ row, selectedData, column }) { console.log(selectedData); diff --git a/src/pages/Middle/Mold/MoldProductionOrder/Detail.vue b/src/pages/Middle/Mold/MoldProductionOrder/Detail.vue new file mode 100644 index 0000000..baaf8ce --- /dev/null +++ b/src/pages/Middle/Mold/MoldProductionOrder/Detail.vue @@ -0,0 +1,907 @@ + + + + + + + + + + 打印 + + 关闭 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/pages/Middle/Mold/MoldProductionOrder/Edit.vue b/src/pages/Middle/Mold/MoldProductionOrder/Edit.vue index 3113588..3eea6d9 100644 --- a/src/pages/Middle/Mold/MoldProductionOrder/Edit.vue +++ b/src/pages/Middle/Mold/MoldProductionOrder/Edit.vue @@ -9,7 +9,7 @@ 选择订单 保存 - 审批 + 审批 打印 @@ -33,7 +33,7 @@ - + @@ -284,6 +284,9 @@ export default { dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list` }, + + loadCount : 0, + }; @@ -354,6 +357,7 @@ export default { this.setPageReadonly(this.pageStatus == 'approved'); + this.$forceUpdate(); }); @@ -377,13 +381,13 @@ export default { let keys = []; let infos = []; - + this.loadCount ++; this.detailsData.forEach(item => { if (!item.component_id) { return; } - let key = infos.length + ''; + let key = infos.length + '' + (this.loadCount + ''); let info = { key: key, data: { mold_production_order_component: [item], @@ -404,6 +408,8 @@ export default { this.collapseActiveKey = keys; this.infos = infos + + console.log(JSON.stringify(this.infos)) }, setPageReadonly(readonly) { diff --git a/src/pages/Middle/Mold/MoldProductionOrder/List.vue b/src/pages/Middle/Mold/MoldProductionOrder/List.vue index c97b7e7..cf8b0f7 100644 --- a/src/pages/Middle/Mold/MoldProductionOrder/List.vue +++ b/src/pages/Middle/Mold/MoldProductionOrder/List.vue @@ -1,5 +1,9 @@ - + + + {{ row.code }} + + \ No newline at end of file + diff --git a/src/router/Middle/Mold/router.map.js b/src/router/Middle/Mold/router.map.js index 18325d6..ce18bf8 100644 --- a/src/router/Middle/Mold/router.map.js +++ b/src/router/Middle/Mold/router.map.js @@ -183,7 +183,19 @@ routerMap['MoldProductionOrderUpdate']= { } }; - +routerMap['MoldProductionOrderDetail']= { + name: '工艺布产', + icon: 'idcard', + path: `/Mold/MoldProductionOrderDetail/:id`, + meta:{ + invisible: true, + page:{ cacheAble:false} + }, + component: () => import(`@/pages/Middle/Mold/MoldProductionOrder/Detail`), + authority: { + permission: [], + } +}; routerMap['MoldScheme']= { name: '模具设计',