From 5f7092c13f47dceeec78247881a56fb6b0383c89 Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期三, 22 六月 2022 12:22:56 +0800
Subject: [PATCH] 'lct'

---
 src/views/majorHazardSourceMonitoring/productionEquipment/index.vue |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/src/views/majorHazardSourceMonitoring/productionEquipment/index.vue b/src/views/majorHazardSourceMonitoring/productionEquipment/index.vue
index ede80cb..8c41171 100644
--- a/src/views/majorHazardSourceMonitoring/productionEquipment/index.vue
+++ b/src/views/majorHazardSourceMonitoring/productionEquipment/index.vue
@@ -2,6 +2,13 @@
     <div class="app-container">
         <el-form ref="form" :model="form" label-width="80px">
             <el-row>
+                <el-col :span="6">
+                    <el-form-item label="设备区域">
+                        <el-select v-model="listQuery.filter.areaId" placeholder="请选择设备区域" clearable style="width: 100%">
+                            <el-option v-for="item in areaList" :key="item.id" :label="item.value" :value="item.id"></el-option>
+                        </el-select>
+                    </el-form-item>
+                </el-col>
                 <el-col :span="5">
                     <el-form-item label="设备名称">
                         <el-input v-model="listQuery.filter.name" placeholder="请输入设备名称" clearable></el-input>
@@ -36,6 +43,8 @@
             </el-table-column>
             <el-table-column prop="name" align="center" label="设备名称">
             </el-table-column>
+            <el-table-column prop="areaName" align="center" label="设备区域">
+            </el-table-column>
             <el-table-column label="状态" align="center">
                 <template slot-scope="scope">
                     <span v-if="scope.row.status == 0">在用</span>
@@ -64,7 +73,7 @@
                 </template>
             </el-table-column>
         </el-table>
-        <div style="text-align:right">
+        <div style="text-align:right;margin-top: 20px;">
             <el-pagination
                 v-show="recordTotal>0"
                 @size-change="handleSizeChange"
@@ -80,6 +89,7 @@
         <el-dialog
             :title="title"
             :visible.sync="dialogVisible"
+            :close-on-click-modal="false"
             width="40%"
         >
             <el-form ref="form" :rules="rules" :model="form" label-width="80px">
@@ -128,11 +138,29 @@
                                 v-model="form.userId"
                                 placeholder="请选择负责人"
                                 style="width: 100%"
+                                filterable
                             >
                                 <el-option
                                     v-for="item in personInCharge"
                                     :key="item.id"
                                     :label="item.realname"
+                                    :value="item.id"
+                                >
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="设备区域" prop="areaId">
+                            <el-select
+                                v-model="form.areaId"
+                                placeholder="请选择设备区域"
+                                style="width: 100%"
+                            >
+                                <el-option
+                                    v-for="item in areaList"
+                                    :key="item.id"
+                                    :label="item.value"
                                     :value="item.id"
                                 >
                                 </el-option>
@@ -145,7 +173,7 @@
         <el-button type="primary" class="btns" @click="AddelementManagement()"
         >确 定</el-button
         >
-        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button @click="cancel()">取 消</el-button>
       </span>
         </el-dialog>
     </div>
@@ -158,6 +186,7 @@
         majorEquipmentDel,
         majorEquipmentLis
     } from "@/api/majorEquipment.js";
+    import {getItemsByType} from '@/api/dictionary'
     export default {
         data() {
             return {
@@ -196,16 +225,26 @@
                     name:{ required: true, message: "设备名称不能为空", trigger: "change" },
                     status:{ required: true, message: "状态不能为空", trigger: "change" },
                     userId:{ required: true, message: "负责人不能为空", trigger: "change" },
+                    areaId:{ required: true, message: "设备区域不能为空", trigger: "change" },
                 },
                 unitIdOptions:[{label:"在用",value:0},{label:"停用",value:1}],
                 personInCharge:[],
+                areaList:[],
             };
         },
         created() {
             this.elementManagementL();
+            this.initDictionaryAllItems()
             this.productionMajorEquipmentErt();
         },
         methods: {
+            initDictionaryAllItems(){
+                getItemsByType('设备区域').then(res=>{
+                    if (res.data.code ==200){
+                        this.areaList=res.data.result
+                    }
+                })
+            },
             productionMajorEquipmentErt(){
                 majorEquipmentLis().then(res=>{
                     if (res.data.code ==200){
@@ -227,7 +266,6 @@
                 this.$nextTick(() => {
                     this.$refs["form"].clearValidate();
                 });
-
                 if (type == "新增") {
                     this.title = "新增";
                     this.form = {
@@ -239,7 +277,7 @@
                     };
                 } else {
                     this.title = "编辑";
-                    this.form = value;
+                    this.form=JSON.parse(JSON.stringify(value));
                 }
             },
             AddelementManagement() {
@@ -275,7 +313,7 @@
                                         title: "成功",
                                     });
                                 } else {
-                                    his.$message({
+                                    this.$message({
                                         type: "warning",
                                         message: res.data.message,
                                     });
@@ -301,12 +339,22 @@
                                    type: "success",
                                    duration: 2000,
                                });
+                           }else {
+                               this.$message({
+                               type: "warning",
+                               message: res.data.message,
+                           });
+
                            }
                        });
                     })
                     .catch(error =>{
                     });
             },
+            cancel(){
+                this.elementManagementL();
+                this.dialogVisible = false;
+            },
             find(){
                 this.elementManagementL();
             },

--
Gitblit v1.9.2