From e1aa0ecffbabd618c71e4ad94370fb8dffe6ee1c Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期日, 21 一月 2024 20:54:49 +0800 Subject: [PATCH] 优化 --- src/views/operate/fivepack/threepack/components/updateUser/index.vue | 82 ++++++++++++++++++++++++++++++---------- 1 files changed, 61 insertions(+), 21 deletions(-) diff --git a/src/views/operate/fivepack/threepack/components/updateUser/index.vue b/src/views/operate/fivepack/threepack/components/updateUser/index.vue index cc23488..2717eb6 100644 --- a/src/views/operate/fivepack/threepack/components/updateUser/index.vue +++ b/src/views/operate/fivepack/threepack/components/updateUser/index.vue @@ -82,6 +82,27 @@ ></el-option> </el-select> </el-form-item> + + <!-- 搴楅摵鐘舵�� --> + <el-form-item + v-if="isStorePage" + class="optionItem" + label="搴楅摵鐘舵��:" + prop="status" + > + <el-select + v-model="store.status" + placeholder="璇烽�夋嫨搴楅摵鐘舵��" + :disabled="isView()" + > + <el-option + v-for="item in statusList" + :key="item.id" + :value="item.id" + :label="item.name" + ></el-option> + </el-select> + </el-form-item> <el-form-item v-if="!isStorePage" class="optionItem" @@ -147,6 +168,7 @@ relationVideo: "", type: null, storeScore: null, + status: null, }, rules: { type: [{ required: true, validator: validateStoreType }], @@ -168,24 +190,38 @@ relationVideo: [ { required: true, trigger: "blur", message: "璇疯緭鍏ュ叧鑱旀憚鍍忔満" }, ], + status: [ + { required: true, trigger: "blur", message: "璇烽�夋嫨搴楅摵鐘舵��" }, + ], }, shopTypeList: [], relationVideoList: [], + statusList: [ + { id: 1, name: "缁忚惀" }, + { id: 2, name: "鍊掗棴" }, + ], }; }, async created() { const result = await getVideoPoint({ current: 1, size: 1000 }); this.relationVideoList = result.records; - if (this.storeInfo) { - this.$set(this, "store", this.storeInfo); - if (this.storeInfo && this.isStorePage) { - this.store.relationVideo = this.store.videoPoint.name; - } - } - if (!this.isView()) { await this.getShopTypeList(); + } + + if (this.storeInfo) { + this.$set(this, "store", this.storeInfo); + if (this.storeInfo && this.isStorePage && this.store.videoPoint) { + this.store.relationVideo = this.store.videoPoint.name; + } + + const selectedStoreType = this.getSelectedStoreType(this.shopTypeList); + + this.$set(this.store, "type", [ + selectedStoreType.parentId, + selectedStoreType.id, + ]); } }, @@ -193,7 +229,6 @@ onSubmit() { this.$refs.store.validate((valid) => { if (valid) { - debugger this.store.type = this.store.type[1]; if (this.isCreated()) { addStoreInfo(this.store) @@ -228,16 +263,6 @@ async getShopTypeList() { let arr = await getCodeList("16"); this.shopTypeList = this.createShopTypeTree(arr); - - if (this.dialogType === "update") { - const selectedStoreType = arr.find( - (item) => item.name === this.store.typeName - ); - this.$set(this.store, "type", [ - selectedStoreType.parentId, - selectedStoreType.id, - ]); - } }, // 鍒涘缓鍟嗛摵绫诲瀷鏍� @@ -261,6 +286,21 @@ return treeRoot; } }, + getSelectedStoreType(shopTypeList) { + let selectedItem = null; + shopTypeList.forEach((item) => { + + if (item.name === this.store.typeName) { + selectedItem = item; + } else if (item.children) { + let selected = this.getSelectedStoreType(item.children); + if (selected) { + selectedItem = selected; + } + } + }); + return selectedItem; + }, }, beforeDestroy() { @@ -272,12 +312,12 @@ <style lang="scss" scoped> .updateUser { border-radius: 1px; - background-color: #09152f; + // background-color: #09152f; main { text-align: left; padding: 0 55px; - background-color: #09152f; + background-color: #ffffff; .mainContent { display: flex; @@ -322,7 +362,7 @@ } .updateUser::v-deep .el-input__inner { - background-color: #09152f; + // background-color: #09152f; border: 1px solid #17324c; } </style> \ No newline at end of file -- Gitblit v1.8.0