Browse Source

修复部门错误代码配置,导致点击商品修改时富文本框中数据有概率加载不出来

Guos 21 hours ago
parent
commit
e7b4290091
1 changed files with 25 additions and 33 deletions
  1. 25 33
      src/views/hisStore/storeProduct/index.vue

+ 25 - 33
src/views/hisStore/storeProduct/index.vue

@@ -1625,7 +1625,7 @@ export default {
         businessExpire: null,
         indications: '',
         dosage: '',
-        instructionManual: '',
+        instructionManual: null,
         business:null,
         licenseExpire:null,
         license:null,
@@ -2260,6 +2260,7 @@ export default {
         isBest: "0",
         isNew: "0",
         description: null,
+        instructionManual: null,
         createTime: null,
         updateTime: null,
         isPostage: null,
@@ -2326,12 +2327,6 @@ export default {
       this.certificateArr = [];
       this.voucherArr = [];
       this.gmpAuthArr = [];
-
-      setTimeout(() => {
-        if (this.$refs.instructionManualRef) {
-          this.$refs.instructionManualRef.setText("");
-        }
-      }, 500);
     },
     /** 搜索按钮操作 */
     handleQuery() {
@@ -2390,16 +2385,18 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
+      this.reset();
       if (this.ids.length > 1) {
         this.title = "批量修改商品";
         this.open1 = true;
         return;
       }
       var that = this;
-      this.reset();
       this.clearExpireErrors(); // 清空过期错误提示
       const productId = row.productId || this.ids
       getStoreProduct(productId).then(response => {
+        this.open = true;
+        this.title = "修改商品";
         this.form = response.data;
         this.form.isShow = response.data.isShow.toString();
         this.form.isHot = response.data.isHot.toString();
@@ -2408,6 +2405,7 @@ export default {
         this.form.isNew = response.data.isNew.toString();
         this.form.productType = response.data.productType.toString();
         this.form.isDisplay = response.data.isDisplay.toString();
+
         if (this.form.business) {
           this.businessArr = this.form.business.split(',');
         }
@@ -2423,20 +2421,28 @@ export default {
         if (this.form.gmpAuth) {
           this.gmpAuthArr = this.form.gmpAuth.split(',');
         }
-        if (this.form.tuiCateId != null) {
-          this.form.tuiCateId = response.data.tuiCateId.toString();
+        if (this.form.image != null) {
+          this.imageArr = this.form.image.split(",");
         }
-        if (this.form.reviewAudit != null) {
-          this.form.reviewAudit = response.data.reviewAudit.toString();
+        if (this.form.sliderImage != null) {
+          this.photoArr = this.form.sliderImage.split(",");
         }
-        // this.form.isDrug = response.data.isDrug ? response.data.isDrug.toString() : "1";
-        this.form.isDrug = response.data.isDrug === 0 ? "0" : (response.data.isDrug ? response.data.isDrug.toString() : "1");
         if (this.form.drugImage != null) {
           this.drugImageArr = this.form.drugImage.split(",");
         }
         if (this.form.qualificationCertificate != null) {
           this.qualificationArr = this.form.qualificationCertificate.split(",");
         }
+        if (this.form.tuiCateId != null) {
+          this.form.tuiCateId = response.data.tuiCateId.toString();
+        }
+        if (this.form.reviewAudit != null) {
+          this.form.reviewAudit = response.data.reviewAudit.toString();
+        }
+
+        // this.form.isDrug = response.data.isDrug ? response.data.isDrug.toString() : "1";
+        this.form.isDrug = response.data.isDrug === 0 ? "0" :
+          (response.data.isDrug ? response.data.isDrug.toString() : "1");
 
         if (this.form.isBusinessPermanent == 1) {
           this.businessValue = true
@@ -2522,27 +2528,13 @@ export default {
             }
           ]
         }
-        setTimeout(() => {
-          if (this.form.description == null) {
-            this.$refs.myeditor.setText("");
-          } else {
-            this.$refs.myeditor.setText(this.form.description);
-          }
 
-          if (this.form.instructionManual == null) {
-            this.$refs.instructionManualRef.setText("");
-          } else {
-            this.$refs.instructionManualRef.setText(this.form.instructionManual);
-          }
+        setTimeout(() => {
+          this.$refs.myeditor.setText(this.form.description==null?"":this.form.description);
+          this.$refs.instructionManualRef.setText(this.form.instructionManual == null?""
+            :this.form.instructionManual);
         }, 200);
-        if (this.form.image != null) {
-          this.imageArr = this.form.image.split(",");
-        }
-        if (this.form.sliderImage != null) {
-          this.photoArr = this.form.sliderImage.split(",");
-        }
-        this.open = true;
-        this.title = "修改商品";
+
         // 加载数据后立即校验过期状态
         this.$nextTick(() => {
           this.isFormInitialized = true;