Przeglądaj źródła

Merge branch 'master' of http://gogs.renlianiot.com:4000/zmcoding/smart-tool-ui

tongshanglei 2 lat temu
rodzic
commit
c8fe76a624

+ 55 - 24
src/views/work_record/work_plan/formModel.vue

@@ -18,6 +18,7 @@
 export default {
   props: ["formModelVisible", "title"],
   data() {
+    let that = this;
     return {
       formData: {},
       formFieldsData: {
@@ -30,6 +31,7 @@ export default {
         boit_type_sign: "",
         status:'',
         info: "",
+        fan_model:""
       }, 
       url: "workplan",
       formConfig: {
@@ -40,13 +42,18 @@ export default {
             label: "计划名称"
           },
           wind_id: {
-          
             type: "cascader",
             label: "风场名称",
             isOptions: true,
             options: [],
             required: true,
             vif: true,
+            on: {
+              change: (val) => {
+
+                that.queryWorkByFanModel(val);
+              }
+            },
             attrs: {
               //查询 
               filterable: true,
@@ -59,21 +66,35 @@ export default {
             }
 
           },
-          //风id
+          //风id
           fan_id:{
-             
               type: "cascader",
               label: "风机编号",
               isOptions: true,
+             // isReloadOptions: true,
               options: [],
               required: true,
-              vif:true,
+              vif: true,
+              on: {
+                change: (val) => {
+                  let arr = this.formConfig.formDesc.fan_id.options;
+                  let model_id = '';
+                  arr.forEach(item => {
+                    if (item.id == val)
+                    {
+                      model_id = item.fan_model;
+                    }
+                    
+                  });
+                  that.queryWorkByFanModel(model_id);
+              }
+              },
               attrs: {
                 //查询 
                 filterable:true,
                 props: {
-                  label: "name",
-                  value: "value",
+                  label: "number",
+                  value: "id",
                   emitPath: false,
                   multiple:false
                 }
@@ -141,22 +162,14 @@ export default {
 
           },
           status: {
-            break: true,
-           
-            type: "select",
+            type: "switch",
             label: "使用状态",
-            required: true,
             isOptions: true,
-            options: [
-              {
-                text: "使用",
-                value: 1
-              },
-              {
-                text: "未使用",
-                value: -1
-              },
-            ]
+            default:1,
+            attrs: {
+              activeValue: 1,
+              inactiveValue:-1
+            }
           },
           info: {
             type: "textarea",
@@ -172,9 +185,9 @@ export default {
       this.formConfig.formDesc.wind_id.options = response.data;
     });
    
-    this.$http.get("get_mainten_option?type=" + "2").then((response) => {
-      this.formConfig.formDesc.work_sign.options = response.data;
-    });
+    // this.$http.get("get_mainten_option?type=" + "2").then((response) => {
+    //   this.formConfig.formDesc.work_sign.options = response.data;
+    // });
     this.$http.get("get_mainten_option?type=" + "1").then((response) => {
       this.formConfig.formDesc.parts_sign.options = response.data;
     });
@@ -194,7 +207,20 @@ export default {
     },
     handleRequestSuccess() {
       this.$message.success("发送成功");
+    },
+    queryFanByWindId(id)
+    {
+      this.$http.get("queryFanByWindId?id=" +id).then((response) => {
+        this.formConfig.formDesc.fan_id.options = response.data;
+      });
+    },
+    queryWorkByFanModel(fan_model)
+    {
+      this.$http.get("get_mainten_option?type=2&fan_model=" +fan_model).then((response) => {
+        this.formConfig.formDesc.work_sign.options = response.data;
+      });
     }
+
   },
 
   computed: {
@@ -203,7 +229,12 @@ export default {
         this.$emit("sendVal", val); // 表示将子组件改变的值传递给父组件
       },
       get() {
-     
+        if (this.formModelVisible)
+        {
+          this.queryFanByWindId(this.formFieldsData.wind_id)
+          this.queryWorkByFanModel(this.formFieldsData.fan_model);
+
+        }
         return this.formModelVisible; // 表示获取父组件的值
       }
     }

+ 29 - 1
src/views/work_record/work_plan/index.vue

@@ -231,6 +231,18 @@
         v-if="showColumn.boit_type_sign_name"
         :show-overflow-tooltip="true"
       />
+        <el-table-column
+        prop=""
+        label="状态"
+        align="center"
+        v-if="showColumn.status"
+        :show-overflow-tooltip="true"
+      >
+        <template slot-scope="scope">
+                <p  v-if="scope.row.status==1">启用中</p>
+                <p  v-else>未启用</p>
+        </template>
+      </el-table-column>
       <el-table-column
         prop="creat_name"
         label="创建人名称"
@@ -247,11 +259,23 @@
       />
       <el-table-column
         label="操作"
-        width="150"
+        width="200"
         align="center"
         fixed="right"
       >
       <template slot-scope="record">
+       <el-tooltip
+            content="修改"
+            placement="top"
+            :enterable="false"
+          >
+            <el-button
+              type="primary"
+              size="mini"
+              icon="el-icon-edit"
+              @click="handleUpdate(record.row)"
+            ></el-button>
+          </el-tooltip>
           <el-tooltip
             content="查看"
             placement="top"
@@ -264,6 +288,7 @@
               @click="handleDetail(record.row)"
             ></el-button>
           </el-tooltip>
+          <el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete(record.row.id)" />
         </template>
       </el-table-column>
     </el-table>
@@ -279,6 +304,7 @@
             <el-checkbox v-model="checkList.work_sign_name">工作位置</el-checkbox>
             <el-checkbox v-model="checkList.parts_sign_name">部件</el-checkbox>
             <el-checkbox v-model="checkList.boit_type_sign_name">螺栓型号</el-checkbox>
+             <el-checkbox v-model="checkList.status">状态</el-checkbox>
             <el-checkbox v-model="checkList.creat_name">创建人名称</el-checkbox>
             <el-checkbox v-model="checkList.created_at">创建时间</el-checkbox>
 
@@ -413,6 +439,7 @@ export default {
         work_sign_name: true,
         parts_sign_name:true,
         boit_type_sign_name: true,
+        status: true,
         creat_name: true,
         created_at:true,
       }
@@ -524,6 +551,7 @@ export default {
         work_sign_name: true,
         parts_sign_name: true,
         boit_type_sign_name: true,
+        status:true,
         creat_name: true,
         created_at: true,
       };