From 4a476243e0928236472f0a916467630cb5706ee5 Mon Sep 17 00:00:00 2001 From: xyc <jc_xiong@hotmail.com> Date: 星期五, 17 五月 2024 11:40:50 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-) diff --git a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue index 65addad..e0f2b52 100644 --- a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue +++ b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue @@ -8,11 +8,11 @@ <el-input v-model="dataForm.name"></el-input> </zt-form-item> <zt-form-item label="鑺傜偣绫诲瀷" prop="productType" rules="required"> - <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg"></zt-dict> + <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg" + :disabled="disabled"></zt-dict> </zt-form-item> <zt-form-item label="杩愯鐘舵�佸浘" prop="operatImg" v-if="isShow"> - <el-input v-model="dataForm.operatImgName" @focus="selectPicture()" - :readonly="readonly"></el-input> + <el-input v-model="dataForm.operatImgName" @focus="selectPicture()"></el-input> <el-image v-if="dataForm.operatImg" :src="url+dataForm.operatImg" style="height: 50px;width: 50px"></el-image> </zt-form-item> <zt-form-item label="鎺掑簭" prop="sort"> @@ -31,6 +31,7 @@ export default { data() { return { + disabled: false, url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`, isTree: false, isShow: true, @@ -42,7 +43,7 @@ name: '', productType: '', operatImg: '', - operatImgName:'', + operatImgName: '', sort: '', status: '' } @@ -52,7 +53,7 @@ PictureSelect }, methods: { - init(id,params) { + init(id, params) { if (params.type === 'tree') { this.isTree = true this.isShow = false @@ -61,6 +62,10 @@ this.dataForm.pid = params.pid this.dataForm.productType = params.type } + if (this.dataForm.productType === 10 && id == null) { + this.getDefaultImg(this.dataForm.productType) + } + this.disabled = !!id; }, // 鑾峰彇绯荤粺鍒楄〃 async getProductList() { @@ -73,7 +78,7 @@ let params = { productType: selected } - let res = await this.$http.get(`/sysPictureBase/getDefaultImg`, {params:params}) + let res = await this.$http.get(`/sysPictureBase/getDefaultImg`, {params: params}) this.dataForm.operatImgName = res.data.name this.dataForm.operatImg = res.data.id }, @@ -95,6 +100,22 @@ }, // 琛ㄥ崟鎻愪氦 async formSubmit() { + let flag = true + if (this.isTree) { + if (this.dataForm.productType !== '5' || this.dataForm.productType !== '4') { + this.$alert("涓嶆敮鎸佹柊澧炴鑺傜偣") + flag = false + } + } else { + if (this.dataForm.productType === '5' || this.dataForm.productType === '4') { + this.$alert("涓嶆敮鎸佹柊澧炴鑺傜偣") + flag = false + } + } + + if (!flag) { + return + } let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/basicInfo/XhProductModel/', this.dataForm) if (res.success) { await this.$tip.success() -- Gitblit v1.9.1