From 99b054ab39f3b67134a0f04f856de887b8bb275e Mon Sep 17 00:00:00 2001 From: lb Date: Mon, 10 Apr 2023 15:47:02 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=AF=BC=E5=85=A5=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierrc | 6 +- src/views/modules/pms/finishedOrder/config.js | 25 -- src/views/modules/pms/finishedOrder/index.vue | 11 +- .../pms/order/components/DialogUpload.vue | 128 ++++++++++ .../order/components/ListSectionWithHead.vue | 228 ++++++++++++++---- 5 files changed, 311 insertions(+), 87 deletions(-) create mode 100644 src/views/modules/pms/order/components/DialogUpload.vue diff --git a/.prettierrc b/.prettierrc index 01cdf34..3e7e729 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,7 @@ { - "printWidth": 150 + "printWidth": 120, + "bracketSameLine": true, + "htmlWhitespaceSensitivity": "ignore", + "semi": true, + "trailingComma": "es5" } \ No newline at end of file diff --git a/src/views/modules/pms/finishedOrder/config.js b/src/views/modules/pms/finishedOrder/config.js index fd29d56..6134e29 100644 --- a/src/views/modules/pms/finishedOrder/config.js +++ b/src/views/modules/pms/finishedOrder/config.js @@ -125,34 +125,9 @@ export default function () { }, }; - const carPayloadDialogConfigs = { - dialogWidth: '70%', - carPayloadDialog: true, - clickModalToClose: true, - tableConfig: { - table: null, - column: [ - // 窑车的 装载详情 - // tableProps - { width: 56, type: "index", label: "序号" }, - { prop: "orderCode", label: "订单号" }, - { width: 80, prop: "orderCate", label: "订单子号" }, - { prop: "bomCode", label: "配方" }, - { prop: "shapeCode", label: "砖型" }, - { width: 80, prop: "qty", label: "订单数量" }, - { width: 72, prop: "goodqty", label: "合格数" }, - { width: 72, prop: "badqty", label: "废砖数" }, - // { prop: "startTime", label: "开始时间" }, - // { prop: "endTime", label: "结束时间" }, - // { prop: "remark", label: "备注" }, - ], - }, - }; - return { - carPayloadDialogConfigs, dialogConfigs: dialogJustFormConfigs, tableConfig: { table: null, // 此处可省略,el-table 上的配置项 diff --git a/src/views/modules/pms/finishedOrder/index.vue b/src/views/modules/pms/finishedOrder/index.vue index ac9e422..6f9b824 100644 --- a/src/views/modules/pms/finishedOrder/index.vue +++ b/src/views/modules/pms/finishedOrder/index.vue @@ -8,8 +8,7 @@ /** { pos: [] } **/ ]" :trigger-update="triggerUpdateKey" - /> - + /> + + diff --git a/src/views/modules/pms/order/components/ListSectionWithHead.vue b/src/views/modules/pms/order/components/ListSectionWithHead.vue index 36faa8f..e66350d 100644 --- a/src/views/modules/pms/order/components/ListSectionWithHead.vue +++ b/src/views/modules/pms/order/components/ListSectionWithHead.vue @@ -6,20 +6,55 @@ --> @@ -28,12 +63,13 @@ import BaseListTable from "./BaseListTable.vue"; import BaseSearchForm from "./BaseSearchForm.vue"; import DialogJustForm from "./DialogJustForm.vue"; import DialogWithMenu from "./DialogWithMenu.vue"; +import DialogUpload from "./DialogUpload.vue"; import moment from "moment"; -const dictList = JSON.parse(localStorage.getItem("dictList")); +// const dictList = JSON.parse(localStorage.getItem("dictList")); export default { name: "ListSectionWithHead", - components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm }, + components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogUpload }, props: { headConfig: { type: Object, @@ -75,7 +111,14 @@ export default { watch: { refreshKey(newVal) { // 外部触发更新列表 - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign( + {}, + this.listQuery, + this.extraSearchConditions, + this.params + ) + ); }, }, data() { @@ -92,10 +135,13 @@ export default { totalPage: 0, renderDialog: false, renderMenuDialog: false, + uploadDialogVisible: false, }; }, mounted() { - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions)); + this.getAList( + Object.assign({}, this.listQuery, this.extraSearchConditions) + ); }, activated() { this.refreshLayoutKey = this.layoutTable(); @@ -142,19 +188,17 @@ export default { switch (type) { // 确认订单 case "confirm-order": { - this.$confirm(`是否要确认订单?`, "提示", { confirmButtonText: "是", cancelButtonText: "否", type: "warning", }) .then(() => { - return this.$http - .post("/pms/order/confirm", data, { - headers: { - "Content-Type": "application/json", - }, - }) + return this.$http.post("/pms/order/confirm", data, { + headers: { + "Content-Type": "application/json", + }, + }); }) .then(({ data: res }) => { if (res.code === 0) { @@ -164,7 +208,14 @@ export default { type: "success", duration: 2000, onClose: () => { - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign( + {}, + this.listQuery, + this.extraSearchConditions, + this.params + ) + ); this.$emit("refresh-tables", ["ongoing"]); }, }); @@ -186,18 +237,21 @@ export default { case "destroy-order": // 结束订单 case "end-order": { - this.$confirm(`确定${type === 'end-order' ? '结束订单' : '废除订单'}?`, "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", - }) + this.$confirm( + `确定${type === "end-order" ? "结束订单" : "废除订单"}?`, + "提示", + { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + } + ) .then(() => { - return this.$http - .post("/pms/order/end", data, { - headers: { - "Content-Type": "application/json", - }, - }) + return this.$http.post("/pms/order/end", data, { + headers: { + "Content-Type": "application/json", + }, + }); }) .then(({ data: res }) => { if (res.code === 0) { @@ -207,7 +261,14 @@ export default { type: "success", duration: 2000, onClose: () => { - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign( + {}, + this.listQuery, + this.extraSearchConditions, + this.params + ) + ); this.$emit("refresh-tables", ["finished"]); }, }); @@ -241,11 +302,20 @@ export default { }; return this.$http - .get("/pms/order/change", { params: { id: data, location: locationMap[type] } }) + .get("/pms/order/change", { + params: { id: data, location: locationMap[type] }, + }) .then(({ data: res }) => { if (res.code === 0) { // success - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign( + {}, + this.listQuery, + this.extraSearchConditions, + this.params + ) + ); } else { // failed throw new Error(res.msg); @@ -261,11 +331,15 @@ export default { } case "delete": { // 确认是否删除 - return this.$confirm(`确定要删除 "${data.code ?? data.id}" 吗?`, "提示", { - confirmButtonText: "确认", - cancelButtonText: "我再想想", - type: "warning", - }) + return this.$confirm( + `确定要删除 "${data.code ?? data.id}" 吗?`, + "提示", + { + confirmButtonText: "确认", + cancelButtonText: "我再想想", + type: "warning", + } + ) .then(() => { // this.$http.delete(this.urls.base + `/${data}`).then((res) => { this.$http({ @@ -276,11 +350,18 @@ export default { if (res.code === 0) { this.$message.success("删除成功!"); // 获取数据 - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign( + {}, + this.listQuery, + this.extraSearchConditions, + this.params + ) + ); } }); }) - .catch((err) => { }); + .catch((err) => {}); } case "edit": { this.openDialog(data); /** data is ==> id */ @@ -292,7 +373,7 @@ export default { break; } case "view-ongoing": { - console.log('view-ongoing', data) + console.log("view-ongoing", data); this.openMenuDialog(data, false); break; } @@ -304,6 +385,8 @@ export default { }, handleBtnClick({ btnName, payload }) { + console.log("SearchForm", btnName, payload); + switch (btnName) { case "查询": { this.params = Object.assign({}, payload); @@ -312,30 +395,66 @@ export default { // 处理时间段 if (!!payload.timerange) { const [startTime, endTime] = payload["timerange"]; - this.params.startTime = moment(startTime).format("YYYY-MM-DDTHH:mm:ss"); - this.params.endTime = moment(endTime).format("YYYY-MM-DDTHH:mm:ss"); + this.params.startTime = moment(startTime).format( + "YYYY-MM-DDTHH:mm:ss" + ); + this.params.endTime = moment(endTime).format( + "YYYY-MM-DDTHH:mm:ss" + ); } delete this.params.timerange; } // 发起请求 - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign( + {}, + this.listQuery, + this.extraSearchConditions, + this.params + ) + ); break; } case "新增": this.openDialog(); break; + case "导入订单": + this.showUploadDialog(payload); + // alert('/pms/order/importExcelOrder'); + break; } }, + showUploadDialog(data) { + this.uploadDialogVisible = true; + this.$nextTick(() => { + this.$refs.uploadDialog.init(data); + }); + }, + /** 导航器的操作 */ handleSizeChange(newSize) { this.listQuery.page = 1; this.listQuery.limit = newSize; - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign( + {}, + this.listQuery, + this.extraSearchConditions, + this.params + ) + ); }, handlePageChange(newPage) { - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign( + {}, + this.listQuery, + this.extraSearchConditions, + this.params + ) + ); }, /** 打开对话框 */ @@ -344,13 +463,16 @@ export default { this.$nextTick(() => { // console.log("init dialog", row_id, detail_mode); - this.$refs["order-dialog"].init(/** some args... */ row_id, detail_mode); + this.$refs["order-dialog"].init( + /** some args... */ row_id, + detail_mode + ); }); }, openMenuDialog(row, detail) { this.renderMenuDialog = true; - console.log("this.renderMenuDialog = true;", row, detail) + console.log("this.renderMenuDialog = true;", row, detail); this.$nextTick(() => { this.$refs["menu-dialog"].init(/** some args... */ row, detail); });