From 7c723bef7e4d9aaf1ac07da4a369b28f572e551c Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期二, 28 五月 2024 11:58:48 +0800 Subject: [PATCH] 修改 --- web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue | 35 ++++++++++++++++++++++++++++------- 1 files changed, 28 insertions(+), 7 deletions(-) diff --git a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue index 65addad..361ed3c 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,7 +31,8 @@ export default { data() { return { - url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`, + disabled: false, + url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getSvgImage?token=${Cookies.get('token')}&id=`, isTree: false, isShow: true, fileId: '', @@ -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