Browse Source

巡检计划

yuhan 1 year ago
parent
commit
2373ebbec4

+ 37 - 1
src/views/module_cmms/inspectPlan/InspectPlanList.vue

@@ -67,6 +67,10 @@
           </a-button>
         </template>
 
+        <template slot="status" slot-scope="text, record">
+          <a-switch :checked="record.status === '0' ? true : false" checked-children="启动" un-checked-children="停用" @click="changeStatus(record)"/>
+        </template>
+
         <span slot="action" slot-scope="text, record">
           <a @click="handleEdit(record)">编辑</a>
 
@@ -173,7 +177,8 @@
           {
             title:'状态(0启用 1停用)',
             align:"center",
-            dataIndex: 'status_dictText'
+            dataIndex: 'status',
+            scopedSlots: { customRender: 'status' }
           },
           {
             title:'待办人',
@@ -241,6 +246,37 @@
       },
     },
     methods: {
+      changeStatus(record){
+        console.log(record.status)
+        const that = this
+        that.$confirm({
+          title: "提示",
+          content: record.status ==='0'?'确定停用吗?':'确定启用吗?',
+          onOk() {
+            let httpurl = '';
+            let method = 'put';
+            httpurl+=that.url.edit;
+            if (record.status == 1) {
+              that.model = record
+              that.model.status = 0
+            } else {
+              that.model = record
+              that.model.status = 1
+            }
+            httpAction(httpurl,that.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.modalFormOk()
+              }else{
+                that.$message.warning(res.message);
+              }
+            })
+          },
+          onCancel() {
+            // that.modalFormOk()
+          }
+        });
+      },
       initDictConfig(){
       },
       getSuperFieldList(){

+ 8 - 4
src/views/module_cmms/inspectPlan/modules/InspectPlanFormList.vue

@@ -347,8 +347,10 @@
         console.log(addLines)
         var addLines = addData.map(item=>{
           return {
-            inspectLineVo: item,
-            tasktype: '巡检路线'
+            inspectLineVo: item, // 不需要传给后端,前端显示用的
+            tasktype: '巡检路线', // 需要传后端的
+            ifmustexec: 1, // 需要传后端的
+            relid: item.id, // 需要传后端的(所选择的巡检路线或巡检点的真正id)
           }
         })
         this.tableData.push(...addLines)
@@ -378,8 +380,10 @@
         console.log(addSpots)
         var addSpots = addData.map(item=>{
           return {
-            inspectSpotVo: item,
-            tasktype: '巡检点'
+            inspectSpotVo: item, // 不需要传给后端,前端显示用的
+            tasktype: '巡检点', // 需要传后端的
+            ifmustexec: 1, // 需要传后端的
+            relid: item.id, // 需要传后端的(所选择的巡检路线或巡检点的真正id)
           }
         })
         this.tableData.push(...addSpots)

+ 1 - 1
src/views/module_cmms/inspectPlan/modules/InspectPlanFormSet.vue

@@ -16,7 +16,7 @@
           <a-col :span="12">
             <a-form-model-item label="负责人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargeruser">
               <!-- <a-input v-model="model.chargeruser" placeholder="请输入待办人"  ></a-input> -->
-              <j-dict-select-tag v-model="model.chargeruser" placeholder="请选择负责人" dictCode="sys_user,realname,id"/>
+              <j-dict-select-tag v-model="model.chargeruser" placeholder="请选择负责人" dictCode="sys_user,realname,username"/>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">