From 3594ee8af853949d39589f4dbdf86c7f5d7f088b Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期二, 02 四月 2024 10:01:57 +0800
Subject: [PATCH] 修改

---
 web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
index cb15cbf..65addad 100644
--- a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
+++ b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
@@ -8,11 +8,12 @@
         <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"></zt-dict>
+        <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg"></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-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">
         <el-input v-model="dataForm.sort" :readonly="readonly"></el-input>
@@ -25,10 +26,12 @@
 
 <script>
   import PictureSelect from "@/views/modules/basicInfo/SelectPicture";
+  import Cookies from "js-cookie";
 
   export default {
     data() {
       return {
+        url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`,
         isTree: false,
         isShow: true,
         fileId: '',
@@ -50,12 +53,13 @@
     },
     methods: {
       init(id,params) {
-        if (params.type == 'tree') {
+        if (params.type === 'tree') {
           this.isTree = true
           this.isShow = false
           this.getProductList()
         } else {
           this.dataForm.pid = params.pid
+          this.dataForm.productType = params.type
         }
       },
       // 鑾峰彇绯荤粺鍒楄〃
@@ -64,8 +68,17 @@
         this.productList = res.data
         console.log(this.productList, 'getProductList')
       },
+      async getDefaultImg(selected) {
+        console.log(selected, 'async getDefaultImg')
+        let params = {
+          productType: selected
+        }
+        let res = await this.$http.get(`/sysPictureBase/getDefaultImg`, {params:params})
+        this.dataForm.operatImgName = res.data.name
+        this.dataForm.operatImg = res.data.id
+      },
       selectPicture() {
-        this.$refs.pictureSelect.$refs.dialog.init()
+        this.$refs.pictureSelect.$refs.dialog.init(this.dataForm.productType)
       },
       openAddWin(row) {
         this.dataForm.operatImgName = row.name

--
Gitblit v1.9.1