From eac497630415449c7e94c77e85c35ae3fa3dbae4 Mon Sep 17 00:00:00 2001 From: lb Date: Thu, 6 Jul 2023 09:59:08 +0800 Subject: [PATCH] bugfix 0706 zentao --- src/components/DialogJustForm.vue | 37 +++++++++++++++---- src/filters/sys-filter.js | 3 +- src/views/atomViews/ListViewWithHead.vue | 37 ++++++++++++------- .../pms/materialUsageEstimate/index.vue | 3 +- .../pms/qualityInspectionRecord/config.js | 4 +- .../modules/pms/qualityPackOrder/config.js | 6 +-- 6 files changed, 62 insertions(+), 28 deletions(-) diff --git a/src/components/DialogJustForm.vue b/src/components/DialogJustForm.vue index f3d2a28..cd27b82 100644 --- a/src/components/DialogJustForm.vue +++ b/src/components/DialogJustForm.vue @@ -75,9 +75,7 @@ :label="opt.label" :value="opt.value"> {{ opt.label }} - + {{ opt[col.customLabel] || "-" }} @@ -187,10 +185,14 @@ export default { const savedDatalist = {}; const cachedList = {}; const watchList = []; + const resetFields = []; this.configs.form.rows.forEach((row) => { row.forEach((col) => { - if (col == null) return + if (col == null) return; + if (!col.disableOnEdit && !col.forceDisabled && !col.forceDisabledSelect) { + resetFields.push(col.prop); + } if (!col.eraseOnSubmit && col.prop) dataForm[col.prop] = col.default ?? null; else shadowDataForm[col.prop] = col.default ?? null; @@ -206,6 +208,7 @@ export default { }); return { + resetFields, loadingStatus: false, dataForm, shadowDataForm, @@ -401,7 +404,7 @@ export default { this.configs.form.rows.forEach((row) => { row.forEach((col) => { - if (col == null) return + if (col == null) return; if (col.fetchData && typeof col.fetchData === "function" && !col.hasPrev) { getData(col); } @@ -411,7 +414,7 @@ export default { /** 必须要遍历两遍 */ this.configs.form.rows.forEach((row) => { row.forEach((col) => { - if (col == null) return + if (col == null) return; if (col.fetchData && typeof col.fetchData === "function" && col.hasPrev) { console.log("[hasPrev] set watcher: ", col.hasPrev); @@ -481,7 +484,7 @@ export default { IsNotAvaliable(col) { return this.detailMode || (col.disableOnEdit && this.editMode); }, - handleFilelistUpdate(newFilelist, isDelete=false) { + handleFilelistUpdate(newFilelist, isDelete = false) { // TODO: 直接访问 .files 可能不太合适 this.dataForm.files = newFilelist.map((file) => ({ id: file.id, @@ -492,7 +495,8 @@ export default { // 更新请求 // if ("id" in this.dataForm && this.dataForm.id != null) this.addOrUpdate("PUT"); // else - !isDelete && this.$notify({ + !isDelete && + this.$notify({ title: "等待保存", message: "已添加文件,请手动点击保存!", type: "warning", @@ -510,6 +514,18 @@ export default { return notDetailMode && (showAlways || ((editMode || addMode) && permission)); }, + resetSpecificFields(fields) { + Object.keys(this.dataForm).forEach((key) => { + // console.log(`${key} ${fields}`, key in fields, fields.indexOf(key)) + if (fields.indexOf(key) !== -1) { + // console.log(`key ${key} in fields`) + // this.dataForm[key] = null; + this.$set(this.dataForm, key, null) + } + }); + console.log("this.dataform", this.dataForm); + }, + resetForm(excludeId = false, immediate = false) { setTimeout( () => { @@ -718,6 +734,11 @@ export default { case "reset": this.resetForm(true, true); // true means exclude id, immediate execution break; + case "resetSpecific": + // qualityInspectionRecord config 里引用 + console.log("resetFields", this.resetFields); + this.resetSpecificFields(this.resetFields); + break; case "add": case "update": this.addOrUpdate(payload.name === "add" ? "POST" : "PUT"); diff --git a/src/filters/sys-filter.js b/src/filters/sys-filter.js index 6c6562c..e609b4f 100644 --- a/src/filters/sys-filter.js +++ b/src/filters/sys-filter.js @@ -11,7 +11,8 @@ import i18n from "@/i18n"; const table = { sex: { '0': '男', - '1': '女' + '1': '女', + '2': '保密' }, userStatus: { '0': i18n.t('user.status0'), diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index 4486b26..0844391 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -15,6 +15,7 @@ :refresh-layout-key="refreshLayoutKey" /> + @destroy-dialog=" + () => { + uploadDialogVisible = false; + } + " /> @@ -81,6 +86,10 @@ export default { Overlay, }, props: { + navigator: { + type: Boolean, + default: true + }, tableConfig: { type: Object, default: () => ({ @@ -126,11 +135,11 @@ export default { this.refreshLayoutKey = this.layoutTable(); }, watch: { - page: val => { - console.log('page changed:', val) + page: (val) => { + console.log("page changed:", val); }, - size: val => { - console.log('size changed:', val) + size: (val) => { + console.log("size changed:", val); }, triggerUpdate(val, oldVal) { if (val && val !== oldVal) { @@ -157,7 +166,7 @@ export default { refreshLayoutKey: null, uploadDialogVisible: false, overlayVisible: false, - cachedSearchCondition: {} + cachedSearchCondition: {}, }; }, inject: ["urls"], @@ -177,7 +186,7 @@ export default { ? { ...queryParams, page: this.page, limit: this.size } : { page: this.page, - limit: this.size + limit: this.size, }; if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) { @@ -189,7 +198,7 @@ export default { }); } }); - this.cachedSearchCondition = Object.assign({}, params) + this.cachedSearchCondition = Object.assign({}, params); } this.$http[this.urls.pageIsPostApi ? "post" : "get"]( @@ -231,6 +240,8 @@ export default { id: item._id ?? item.id, })); this.totalPage = res.data.total; + } else if (Array.isArray(res.data)) { + this.dataList = res.data } else { this.dataList.splice(0); this.totalPage = 0; @@ -273,7 +284,7 @@ export default { promptName = data[deleteConfig.promptField]; } - let currenPageListLength = this.dataList.length + let currenPageListLength = this.dataList.length; // 确认是否删除 return this.$confirm(`确定要删除记录 "${promptName}" 吗?`, "提示", { confirmButtonText: "确认", @@ -296,8 +307,8 @@ export default { // this.page = 1; // this.size = // "defaultPageSize" in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20; - if (currenPageListLength == 1) this.page = this.page > 1 ? this.page - 1 : 1 - + if (currenPageListLength == 1) this.page = this.page > 1 ? this.page - 1 : 1; + this.getList(); } else { this.$message({ @@ -359,7 +370,7 @@ export default { break; } case "view-attachment-justform-version": { - console.log(data) + console.log(data); break; } case "view-recipe": { @@ -573,7 +584,7 @@ export default { this.openDialog(); return; } - case "查询": { + case "查询": { if (typeof payload === "object") { // BaseSearchForm 给这个组件传递了数据 Object.assign(this.cachedSearchCondition, payload); diff --git a/src/views/modules/pms/materialUsageEstimate/index.vue b/src/views/modules/pms/materialUsageEstimate/index.vue index 7d3d853..0d6b688 100644 --- a/src/views/modules/pms/materialUsageEstimate/index.vue +++ b/src/views/modules/pms/materialUsageEstimate/index.vue @@ -4,7 +4,8 @@ :table-config="tableConfig" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" - :listQueryExtra="['']" /> + :listQueryExtra="['']" + :navigator="false" />