Browse Source

点检内容优化

wyh 1 year ago
parent
commit
76ef6c9c97

+ 29 - 10
src/views/module_cmms/spotcheckContent/modules/SpotcheckContentForm.vue

@@ -175,6 +175,15 @@
         getAction(this.url.queryById, record).then((res) => {
             console.log(88,res)
             this.model = res.result
+            this.model.spotcheckContentItemList = this.model.spotcheckContentItemList.map((res) => {
+              return {
+                id: res.spotcheckitemid,
+                itemcode: res.itemcode,
+                itemname: res.itemname,
+                conditions: res.conditions,
+                remark: res.remark
+              }
+            })
         })
         // this.model = Object.assign({}, record);
         this.visible = true;
@@ -191,21 +200,31 @@
               httpurl+=this.url.add;
               method = 'post';
               this.model.status = 1
+              this.model.spotcheckContentItemList = this.model.spotcheckContentItemList.map((res) => {
+                return {
+                  spotcheckitemid: res.id
+                }
+              })
             }else{
               httpurl+=this.url.edit;
               method = 'put';
+              this.model.spotcheckContentItemList = this.model.spotcheckContentItemList.map((res) => {
+                return {
+                  spotcheckitemid: res.id
+                }
+              })
             }
             console.log(99,this.model)
-            // httpAction(httpurl,this.model,method).then((res)=>{
-            //   if(res.success){
-            //     that.$message.success(res.message);
-            //     that.$emit('ok');
-            //   }else{
-            //     that.$message.warning(res.message);
-            //   }
-            // }).finally(() => {
-            //   that.confirmLoading = false;
-            // })
+            httpAction(httpurl,this.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+            })
           }
 
         })

+ 2 - 0
src/views/module_cmms/spotcheckContent/modules/SpotcheckContentModalAdd.vue

@@ -105,9 +105,11 @@ import { httpAction, getAction } from '@/api/manage'
         getAction(`/cmmsSpotcheckItem/cmmsSpotcheckItem/listbyequipmentid/${this.modelForm.equipmentid}`).then((res) => {
             this.dataSource = res.result
         })
+        this.selectList()
       },
       // 将以选中的值重新在列表中选中
       selectList() {
+        console.log(111,this.dataList)
         this.selectionRows = this.dataList
         this.selectedRowKeys = this.dataList.map((res) => {
             return res.id