From 6dc95fb76aef7eac78552e879e0ab1f3c37643bd Mon Sep 17 00:00:00 2001 From: lb Date: Tue, 17 Jan 2023 09:44:32 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=B7=B7=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 70 ++++++++++++------- src/components/DialogWithMenu.vue | 12 +++- src/components/SmallDialog.vue | 11 +-- .../operationComponent.js | 2 +- src/views/atomViews/ListViewWithHead.vue | 2 +- src/views/modules/pms/blenderStep/config.js | 2 +- 6 files changed, 63 insertions(+), 36 deletions(-) diff --git a/src/App.vue b/src/App.vue index f57d30a..71d547a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,34 +1,52 @@ + + diff --git a/src/components/DialogWithMenu.vue b/src/components/DialogWithMenu.vue index 15f420e..46fdf2a 100644 --- a/src/components/DialogWithMenu.vue +++ b/src/components/DialogWithMenu.vue @@ -7,7 +7,9 @@ >
-

编辑

+

+ {{ detailMode ? "查看详情" : dataForm.id ? "编辑" : "新增" }} +

@@ -201,6 +203,10 @@ export default { /** init **/ init(id, detailMode) { + if (this.$refs.dataForm && this.$refs.dataForm.length) { + // 当不是首次渲染dialog的时候,一开始就清空验证信息,本组件的循环里只有一个 dataForm 所以只用取 [0] 即可 + this.$refs.dataForm[0].clearValidate() + } console.log("[dialog] DialogWithHead init():", id, detailMode); this.detailMode = detailMode ?? false; @@ -254,13 +260,13 @@ export default { // }); // } } + this.selfVisible = true; }); } else { // 如果不是编辑 + this.selfVisible = true; } }); - - this.selfVisible = true; }, /** handlers */ diff --git a/src/components/SmallDialog.vue b/src/components/SmallDialog.vue index 9dfae04..a7802ba 100644 --- a/src/components/SmallDialog.vue +++ b/src/components/SmallDialog.vue @@ -149,8 +149,10 @@ export default { }, init(id, isdetail = false) { - this.detailMode = isdetail; console.log("[small dialog] init", id, isdetail); + + this.detailMode = isdetail; + if (this.$refs.dataForm) this.$refs.dataForm.clearValidate() this.$nextTick(() => { // this.$refs['dataForm'].resetFields(); @@ -168,13 +170,13 @@ export default { const dataFormKeys = Object.keys(this.dataForm); this.dataForm = __pick(res.data, dataFormKeys); } + this.visible = true; }); } else { // 如果不是编辑 + this.visible = true } }); - - this.visible = true; }, handleSelectChange(col, event) {}, @@ -190,13 +192,14 @@ export default { break; case "add": case "update": { + console.log('update extraParam: ', this.configs.extraParam) const method = payload.name === "add" ? "POST" : "PUT"; this.$http({ url: this.urls.subase, method, data: { ...this.dataForm, - [this.configs.extraParams]: this.relatedId, + [this.configs.extraParam]: this.relatedId, // this.configs.extraParam 只能是字符串 }, }).then(({ data: res }) => { console.log("[add&update] res is: ", res); diff --git a/src/components/noTemplateComponents/operationComponent.js b/src/components/noTemplateComponents/operationComponent.js index d04c9ee..12f3fb5 100644 --- a/src/components/noTemplateComponents/operationComponent.js +++ b/src/components/noTemplateComponents/operationComponent.js @@ -67,7 +67,7 @@ export default { // 可能需要验证权限,如 opt.permission 选项 // 注意:为空字符串或null/undefined都会不验证权限 if (!opt.permission || (opt.permission && this.$hasPermission(opt.permission))) { - console.log('[operation component]: ', opt.permission, this.$hasPermission(opt.permission)) + // console.log('[operation component]: ', opt.permission, this.$hasPermission(opt.permission)) btns.push( h('el-button', { diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index be0525a..92fccf9 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -235,6 +235,6 @@ export default { min-height: inherit; border-radius: 6px; padding: 16px; - box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.125); + box-shadow: 0 0 1.125px .125px rgba(0, 0, 0, 0.125); } diff --git a/src/views/modules/pms/blenderStep/config.js b/src/views/modules/pms/blenderStep/config.js index c41e213..63fb0d5 100644 --- a/src/views/modules/pms/blenderStep/config.js +++ b/src/views/modules/pms/blenderStep/config.js @@ -107,7 +107,7 @@ export default function () { }, subDialog: { - extraParams: 'stepId', + extraParam: 'stepId', rows: [ [ { input: true, label: '步骤', prop: 'sort', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入步骤' } },