From f1f40e9a28fafab5d884630b8900b11060ebe9fc Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 31 十月 2023 08:53:35 +0800
Subject: [PATCH] 修改

---
 src/views/analyse/plan/components/planDialog.vue |  157 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 91 insertions(+), 66 deletions(-)

diff --git a/src/views/analyse/plan/components/planDialog.vue b/src/views/analyse/plan/components/planDialog.vue
index 2ee4fe9..aab3fce 100644
--- a/src/views/analyse/plan/components/planDialog.vue
+++ b/src/views/analyse/plan/components/planDialog.vue
@@ -16,51 +16,48 @@
                         </el-form-item>
                     </el-col>
                     <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
+                      <el-form-item label="评估时间" prop="assessTime">
+                        <el-date-picker
+                            :disabled="planDialogState.disabled"
+                            type="datetimerange"
+                            v-model="planDialogState.planForm.assessTime"
+                            start-placeholder="开始时间"
+                            end-placeholder="结束时间"
+                            format="YYYY-MM-DD HH:mm:ss"
+                            value-format="YYYY-MM-DD HH:mm:ss"
+                            popper-class="pickTime"
+                            @change="formatTime">
+                        </el-date-picker>
+                      </el-form-item>
+                    </el-col>
+                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                         <el-form-item label="计划制定人" prop="planUserId">
                             <el-select :disabled="planDialogState.disabled" v-model="planDialogState.planForm.planUserId" style="width:100%"  placeholder="计划制定人" clearable>
                                 <el-option v-for="item in planDialogState.personList" :key="item.id" :label="item.realName" :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="assessPlanName">
-                            <el-date-picker
-                                :disabled="planDialogState.disabled"
-                                type="datetimerange"
-                                v-model="planDialogState.time"
-                                start-placeholder="开始时间"
-                                end-placeholder="结束时间"
-                                format="YYYY-MM-DD HH:mm:ss"
-                                value-format="YYYY-MM-DD HH:mm:ss"
-                                @change="formatTime">
-                            </el-date-picker>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
-                        <el-form-item label="辨识方法" prop="identificationMethod">
-                            <el-select :disabled="planDialogState.disabled" v-model="planDialogState.planForm.identificationMethod" style="width:100%" placeholder="辨识方法" clearable>
-                                <el-option v-for="item in planDialogState.identificationMethodList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20 valueSelect">
+                        <el-form-item label="辨识专家" prop="identificationUserId">
+                            <el-select :disabled="planDialogState.disabled" v-model="planDialogState.planForm.identificationUserId" style="width:100%" :teleported="false" placeholder="辨识专家" clearable>
+                                <el-option v-for="item in planDialogState.bsExperts" :key="item.id" :label="item.realName" :value="item.id">
+                                  <div class="valueTable">
+                                    <div><div>姓名:</div><span>{{item.realName}}</span></div>
+                                    <div><div>专业:</div><span>{{item.userIdentities?.map(i=>i.userIdentity).join(',')}}</span></div>
+                                  </div>
+                                </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="identificationUserId">
-                            <el-select :disabled="planDialogState.disabled" v-model="planDialogState.planForm.identificationUserId" style="width:100%"  placeholder="负责人" clearable>
-                                <el-option v-for="item in planDialogState.personList" :key="item.id" :label="item.realName" :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="evaluateMethod">
-                            <el-select :disabled="planDialogState.disabled" v-model="planDialogState.planForm.evaluateMethod" style="width:100%"  placeholder="推荐评价方法" clearable>
-                                <el-option v-for="item in planDialogState.evaluateMethodList" :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-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20 valueSelect">
                         <el-form-item label="评价专家" prop="evaluateUserId">
-                            <el-select :disabled="planDialogState.disabled" v-model="planDialogState.planForm.evaluateUserId" style="width:100%"  placeholder="评价专家" clearable>
-                                <el-option v-for="item in planDialogState.personList" :key="item.id" :label="item.realName" :value="item.id"></el-option>
+                            <el-select :disabled="planDialogState.disabled" v-model="planDialogState.planForm.evaluateUserId" style="width:100%" :teleported="false" placeholder="评价专家" clearable>
+                                <el-option v-for="item in planDialogState.pjExperts" :key="item.id" :label="item.realName" :value="item.id">
+                                  <div class="valueTable">
+                                    <div><div>姓名:</div><span>{{item.realName}}</span></div>
+                                    <div><div>专业:</div><span>{{item.userIdentities?.map(i=>i.userIdentity).join(',')}}</span></div>
+                                  </div>
+                                </el-option>
                             </el-select>
                         </el-form-item>
                     </el-col>
@@ -77,7 +74,7 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from "vue";
+import { reactive, ref, getCurrentInstance } from "vue";
 import {ElMessage} from "element-plus";
 import {planApi} from "/@/api/analyse/plan";
 import {isValidKey} from "/@/utils/methods";
@@ -86,52 +83,39 @@
 
 const planDialogState = reactive<PlanDialogType>({
     title: '',
-    time:[],
     disabled: false,
     planDialogVisible: false,
     planForm: {
         riskUnitId: null,
         planUserId: null,
         assessPlanName: '',
+        assessTime: [],
         assessStartTime: '',
         assessEndTime: '',
-        identificationMethod: null,
         identificationUserId: null,
-        evaluateMethod: null,
         evaluateUserId: null,
+        riskType: 2
     },
     planFormRules: {
-        deviceCode: [{ required: true, message: '请填写设备编号', trigger: 'blur' }],
-        deviceName: [{ required: true, message: '请填写设备名称', trigger: 'blur' }],
-        devicePower: [{ required: true, message: '请填写设备功率', trigger: 'blur' }],
         riskUnitId: [{ required: true, message: '请选择风险分析单元', trigger: 'change' }],
+        assessPlanName: [{ required: true, message: '请填写评估计划名称', trigger: 'blur' }],
+        assessTime: [{ required: true, message: '请选择评估时间', trigger: 'blur' }],
         planUserId: [{ required: true, message: '请选择计划制定人', trigger: 'change' }],
-        identificationMethod: [{ required: true, message: '请选择辨识方法', trigger: 'change' }],
-        identificationUserId: [{ required: true, message: '请选择负责人', trigger: 'change' }],
-        evaluateMethod: [{ required: true, message: '请选择推荐评价方法', trigger: 'change' }],
+        identificationUserId: [{ required: true, message: '请选择辨识专家', trigger: 'change' }],
         evaluateUserId: [{ required: true, message: '请选择评价专家', trigger: 'change' }],
     },
     riskUnitList: [],
     personList: [],
-    identificationMethodList: [
-        {id:1, name: 'PHA'},
-        {id:2, name: 'JHA'},
-        {id:3, name: 'SCL'},
-        {id:4, name: 'HAZOP'},
-        {id:5, name: '类比法'},
-    ],
-    evaluateMethodList: [
-        {id:1, name: 'LEC'},
-        {id:2, name: 'LS'},
-        {id:3, name: 'MES'},
-        {id:4, name: 'RS'},
-    ]
+    bsExperts: [],
+    pjExperts: []
 })
 
-const showPlanDialog = (title: string, value: PlanType, riskUnitList: RiskUnitType [], personList: SystemPersonType []) => {
+const showPlanDialog = (title: string, value: PlanType, riskUnitList: RiskUnitType [], personList: SystemPersonType [],bsExperts:[],pjExperts:[]) => {
     planDialogState.planDialogVisible = true;
     planDialogState.riskUnitList = riskUnitList;
     planDialogState.personList = personList;
+    planDialogState.bsExperts = bsExperts;
+    planDialogState.pjExperts = pjExperts;
     planDialogState.disabled = false
     setTimeout(() => {
         planFormRef.value.clearValidate();
@@ -142,42 +126,45 @@
             riskUnitId: null,
             planUserId: null,
             assessPlanName: '',
+            assessTime: [],
             assessStartTime: '',
             assessEndTime: '',
-            identificationMethod: null,
             identificationUserId: null,
-            evaluateMethod: null,
             evaluateUserId: null,
+            riskType: 2
         };
     }else if(title === '查看'){
         planDialogState.title = '查看';
         planDialogState.disabled = true
-        planDialogState.time = [value.assessStartTime, value.assessEndTime]
         for(let i in planDialogState.planForm){
             if(isValidKey(i, planDialogState.planForm)){
                 planDialogState.planForm[i] = value[i]
             }
         }
+        planDialogState.planForm.assessTime=[value.assessStartTime, value.assessEndTime]
+        console.log(value,planDialogState.planForm.assessTime,'time')
     }else{
         planDialogState.title = '编辑';
         planDialogState.planForm.id = value.id
-        planDialogState.time = [value.assessStartTime, value.assessEndTime]
         for(let i in planDialogState.planForm){
             if(isValidKey(i, planDialogState.planForm)){
                 planDialogState.planForm[i] = value[i]
             }
         }
+        planDialogState.planForm.assessTime=[value.assessStartTime, value.assessEndTime]
     }
 };
 
 const formatTime = () => {
-    planDialogState.planForm.assessStartTime = planDialogState.time === null ? '' : planDialogState.time[0]
-    planDialogState.planForm.assessEndTime = planDialogState.time === null ? '' : planDialogState.time[1]
+    planDialogState.planForm.assessStartTime = planDialogState.planForm.assessTime == [] ? '' : planDialogState.planForm.assessTime[0]
+    planDialogState.planForm.assessEndTime = planDialogState.planForm.assessTime == [] ? '' : planDialogState.planForm.assessTime[1]
 };
 
 const onSubmitPlan = () => {
     planFormRef.value.validate(async(valid: boolean) => {
         if(valid){
+            formatTime()
+            delete planDialogState.planForm.assessTime
             if(planDialogState.title === '新增'){
                 let res = await planApi().addPlan(planDialogState.planForm);
                 if(res.data.code === 100){
@@ -225,6 +212,44 @@
 })
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
+    ::v-deep(.pickTime){
+      position: absolute !important;
+      top: 0 !important;
+    }
+    .valueSelect{
+      ::v-deep(.el-popper){
+        .el-select-dropdown__item{
+          width: 100%;
+          height: auto;
+          white-space: normal;
+          word-break: break-all;
+          word-wrap: break-word;
+          overflow: auto;
+          padding: 10px 25px;
+          border-bottom: 1px solid #ccc;
 
+          .valueTable{
+            &>div{
+              line-height: 1.5;
+              margin-bottom: 6px;
+              display: flex;
+              align-items: center;
+
+              div{
+                color: #999;
+              }
+
+              span{
+                font-weight: bolder;
+              }
+
+              &:last-of-type{
+                margin-bottom: 0;
+              }
+            }
+          }
+        }
+      }
+    }
 </style>

--
Gitblit v1.9.2