From 91861fec4e3113339b2e7e34a10318ff7d891df2 Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期二, 16 七月 2024 15:20:26 +0800 Subject: [PATCH] 修改 --- web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue | 39 ++++++++++++++++++++++++++++----------- 1 files changed, 28 insertions(+), 11 deletions(-) diff --git a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue index 65addad..cb0524c 100644 --- a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue +++ b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue @@ -1,18 +1,18 @@ <template> <zt-dialog ref="dialog" @confirm="formSubmit"> <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> - <zt-form-item label="涓婄骇绯荤粺" prop="pid" v-if="isTree"> + <zt-form-item label="涓婄骇绯荤粺" prop="pid" v-if="isShow"> <zt-combo-tree v-model="dataForm.pid" :datas="productList"/> </zt-form-item> <zt-form-item label="鍚嶇О" prop="name" rules="required"> <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,8 +31,8 @@ export default { data() { return { - url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`, - isTree: false, + disabled: false, + url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getSvgImage?token=${Cookies.get('token')}&id=`, isShow: true, fileId: '', productList: [], @@ -42,7 +42,7 @@ name: '', productType: '', operatImg: '', - operatImgName:'', + operatImgName: '', sort: '', status: '' } @@ -52,14 +52,21 @@ PictureSelect }, methods: { - init(id,params) { - if (params.type === 'tree') { - this.isTree = true + init(id, params) { + if (params.type === 'xh') { this.isShow = false + this.dataForm.pid = null + this.dataForm.productType = 1 + } else if (params.type === 'zt') { + this.dataForm.pid = params.pid + this.dataForm.productType = 2 this.getProductList() } else { this.dataForm.pid = params.pid this.dataForm.productType = params.type + } + if (this.dataForm.productType === 10 && id == null) { + this.getDefaultImg(this.dataForm.productType) } }, // 鑾峰彇绯荤粺鍒楄〃 @@ -73,7 +80,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 +102,16 @@ }, // 琛ㄥ崟鎻愪氦 async formSubmit() { + let flag = true + if (this.isShow) { + if (this.dataForm.productType === '1') { + 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