From 1621b3719092d93e6c29f7a27e401529e0454420 Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期一, 01 八月 2022 18:57:45 +0800
Subject: [PATCH] 双重预防

---
 src/views/doublePrevent/riskLevel/device/components/productionDeviceDialog.vue |   54 +++++++++++++++---------------------------------------
 1 files changed, 15 insertions(+), 39 deletions(-)

diff --git a/src/views/doublePrevent/riskLevel/device/components/productionDeviceDialog.vue b/src/views/doublePrevent/riskLevel/device/components/productionDeviceDialog.vue
index 6b9616e..c64cc93 100644
--- a/src/views/doublePrevent/riskLevel/device/components/productionDeviceDialog.vue
+++ b/src/views/doublePrevent/riskLevel/device/components/productionDeviceDialog.vue
@@ -1,67 +1,35 @@
 <template>
     <div class="system-add-menu-container">
-        <el-dialog :title="title" v-model="isShowProductionDeviceDialog" width="600px">
-            <el-form
-                :model="productionDeviceForm"
-                :rules="productionDeviceFormRules"
-                ref="productionDeviceFormRef"
-                size="default"
-                label-width="120px"
-            >
+        <el-dialog :title="title" v-model="isShowProductionDeviceDialog" width="600px" :close-on-click-modal="false">
+            <el-form :model="productionDeviceForm" :rules="productionDeviceFormRules" ref="productionDeviceFormRef" size="default" label-width="120px">
                 <el-row :gutter="35">
                     <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                         <el-form-item label="生产装置名称" prop="produceDeviceName">
-                            <el-input
-                                class="input-length"
-                                v-model.trim="productionDeviceForm.produceDeviceName"
-                                placeholder="请输入生产装置名称"
-                                clearable
-                            ></el-input>
+                            <el-input class="input-length" v-model.trim="productionDeviceForm.produceDeviceName" placeholder="请输入生产装置名称" clearable></el-input>
                         </el-form-item>
                     </el-col>
                     <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                         <el-form-item label="所属部门" prop="depId">
-                            <el-cascader
-                                :options="departmentList"
-                                :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }"
-                                placeholder="请选择部门"
-                                clearable
-                                filterable
-                                style="width: 85%"
-                                v-model="productionDeviceForm.depId"
-                            >
-                            </el-cascader>
+                            <el-cascader :options="departmentList" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" placeholder="请选择部门" clearable filterable style="width: 85%" v-model="productionDeviceForm.depId"> </el-cascader>
                             <!--                            <el-select class="input-length" v-model="productionDeviceForm.depName" placeholder="请选择所属部门" clearable filterable></el-select>-->
                         </el-form-item>
                     </el-col>
                     <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                         <el-form-item label="风险等级" prop="riskLevel">
-                            <el-select
-                                class="input-length"
-                                v-model="productionDeviceForm.riskLevel"
-                                placeholder="请选择风险等级"
-                                clearable
-                                filterable
-                            >
+                            <el-select class="input-length" v-model="productionDeviceForm.riskLevel" placeholder="请选择风险等级" clearable filterable>
                                 <el-option v-for="item in levelList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                             </el-select>
                         </el-form-item>
                     </el-col>
                     <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                         <el-form-item label="区域位置" prop="location">
-                            <el-input
-                                class="input-length"
-                                v-model.trim="productionDeviceForm.location"
-                                type="textarea"
-                                placeholder="请输入区域位置"
-                                maxlength="150"
-                            ></el-input>
+                            <el-input class="input-length" v-model.trim="productionDeviceForm.location" type="textarea" placeholder="请输入区域位置" maxlength="150"></el-input>
                         </el-form-item>
                     </el-col>
                 </el-row>
             </el-form>
             <template #footer>
-                <span class="dialog-footer">
+                <span class="dialog-footer" v-show="disabled">
                     <el-button @click="isShowProductionDeviceDialog = !isShowProductionDeviceDialog" size="default">取 消</el-button>
                     <el-button type="primary" @click="submitProductionDevice" v-throttle size="default">确 实</el-button>
                 </span>
@@ -73,6 +41,7 @@
 <script lang="ts">
 interface stateType {
     isShowProductionDeviceDialog: Boolean;
+    disabled: Boolean;
     productionDeviceForm: {
         produceDeviceName: string;
         depId: number | null;
@@ -94,6 +63,7 @@
         const productionDeviceFormRef = ref();
         const state = reactive<stateType>({
             title: '',
+            disabled: false,
             departmentList: [],
             isShowProductionDeviceDialog: false,
             levelList: [
@@ -124,6 +94,7 @@
                 productionDeviceFormRef.value.clearValidate();
             });
             if (type === '新增') {
+                state.disabled = true;
                 state.title = '新增生产装置';
                 state.productionDeviceForm = {
                     produceDeviceName: '',
@@ -131,7 +102,12 @@
                     riskLevel: null,
                     location: ''
                 };
+            } else if (type === '查看') {
+                state.disabled = false;
+                state.title = '查看生产装置';
+                state.productionDeviceForm = JSON.parse(JSON.stringify(value));
             } else {
+                state.disabled = true;
                 state.title = '修改生产装置';
                 state.productionDeviceForm = JSON.parse(JSON.stringify(value));
             }

--
Gitblit v1.9.2