From baf475f44f0a940bbdc2dde36fff9cdf97da58bc Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期四, 17 八月 2023 16:43:28 +0800
Subject: [PATCH] 证书修改

---
 src/views/system/user/component/ctfDialog.vue |   65 ++++++++++++++++----------------
 1 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/src/views/system/user/component/ctfDialog.vue b/src/views/system/user/component/ctfDialog.vue
index a8f7f59..60f9f2f 100644
--- a/src/views/system/user/component/ctfDialog.vue
+++ b/src/views/system/user/component/ctfDialog.vue
@@ -3,13 +3,13 @@
         <el-dialog :title="title" v-model="isShowCtfDialog" width="769px" @close="restForm">
             <el-form :model="ctfForm" size="default" ref="ctfRef" :rules="ctfFormRules" 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="roleId">
-                        <el-select v-model="ctfForm.roleId" placeholder="请选择" clearable class="w100" :disabled="disabled">
-                          <el-option v-for="item in roleData" :key="item.roleId" :label="item.roleName" :value="item.roleId"> </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="roleId">-->
+<!--                        <el-select v-model="ctfForm.roleId" placeholder="请选择" clearable class="w100" :disabled="disabled">-->
+<!--                          <el-option v-for="item in roleData" :key="item.roleId" :label="item.roleName" :value="item.roleId"> </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="certNo">
                             <el-input v-model.trim="ctfForm.certNo" :disabled="disabled" placeholder="" clearable></el-input>
@@ -21,10 +21,10 @@
                         </el-form-item>
                     </el-col>
                   <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
-                    <el-form-item label="作业类型" prop="workType">
-                      <el-select v-model="ctfForm.workType" placeholder="请选择作业类型" :disabled="disabled">
+                    <el-form-item label="证书类型" prop="certTypeId">
+                      <el-select v-model="ctfForm.certTypeId" placeholder="请选择证书类型" :disabled="disabled">
                         <el-option
-                            v-for="item in workTypeList"
+                            v-for="item in certTypeIdList"
                             :key="item.id"
                             :label="item.name"
                             :value="item.id"
@@ -64,6 +64,7 @@
 import {workApplyApi} from "/@/api/specialWorkSystem/workApply";
 import axios from "axios";
 import {useUserInfo} from "/@/stores/userInfo";
+import {certApi} from "/@/api/systemManage/certificate";
 
 // 定义接口来定义对象的类型
 interface DeptData {}
@@ -78,10 +79,9 @@
     dialogImg: boolean
     ctfForm: {
       userCertId?: string
-      roleId: number| null
       certNo: string
       certExpiredAt: string
-      workType: number| null
+      certTypeId: number| null
       certUrl: string
       uid: string | null
     };
@@ -90,7 +90,7 @@
     fileList: Array<file>
     delList: Array<any>
     uploadUrl: string
-    workTypeList: Array<any>
+    certTypeIdList: Array<any>
 }
 interface file {
   url: string;
@@ -111,48 +111,37 @@
             dialogImg: false,
             ctfForm: {
               userCertId: '',
-              roleId: null,
               certNo: '',
               certExpiredAt: '',
-              workType: null,
+              certTypeId: null,
               certUrl: '',
               uid: ''
             },
             ctfFormRules:{
-                roleId: [{ required: true, message: '请选择证书相关角色', trigger: 'blur' }],
                 certNo: [{ required: true, message: '请输入证书编号', trigger: 'blur' }],
                 certExpiredAt: [{ required: true, message: '请选择证书到期时间', trigger: 'change' }],
-                workType: [{ required: true, message: '请选择作业类型', trigger: 'blur' }],
+                certTypeId: [{ required: true, message: '请选择证书类型', trigger: 'blur' }],
                 certUrl: [{ required: true, message: '请上传证书', trigger: 'change' }],
             },
             dialogImageUrl: null,
             fileList: [],
             delList: [],
             uploadUrl: '',
-            workTypeList: [
-              { id: 1, name: '动火作业' },
-              { id: 2, name: '受限空间作业' },
-              { id: 3, name: '吊装作业' },
-              { id: 4, name: '动土作业' },
-              { id: 5, name: '断路作业' },
-              { id: 6, name: '高处作业' },
-              { id: 7, name: '临时用电作业' },
-              { id: 8, name: '盲板抽堵作业' }
-            ]
+            certTypeIdList: []
         });
 
         // 打开弹窗
         const openDialog = (type: string, value: any, uid: string) => {
-            state.isShowCtfDialog = true;
+            state.isShowCtfDialog = true
+            getCerttypeList()
             state.fileList = []
             if (type === 'add') {
                 state.disabled = false
                 state.title = '新增证书';
                 state.ctfForm = {
-                  roleId: null,
                   certNo: '',
                   certExpiredAt: '',
-                  workType: null,
+                  certTypeId: null,
                   certUrl: '',
                   uid: uid
                 };
@@ -174,7 +163,6 @@
               if(type === 'edit'){
                 state.disabled = false
                 state.title = '修改证书';
-                console.log(state.ctfForm,'555')
               }else{
                 state.disabled = true
                 state.title = '查看';
@@ -186,6 +174,18 @@
         const isValidKey =(key: string | number | symbol, data:object): key is keyof typeof data => {
           return key in data
         }
+
+        const getCerttypeList = async () => {
+          let res = await certApi().getCerttypeList({pageIndex: 1, pageSize: 99, searchParams: {name:''}});
+          if (res.data.code === '200') {
+            state.certTypeIdList = res.data.data;
+          } else {
+            ElMessage({
+              type: 'warning',
+              message: res.data.msg
+            });
+          }
+        };
 
         // 新增修改
         const onSubmit = async () => {
@@ -322,10 +322,9 @@
       const restForm = ()=>{
         state.ctfForm = {
           userCertId: '',
-          roleId: null,
           certNo: '',
           certExpiredAt: '',
-          workType: null,
+          certTypeId: null,
           certUrl: '',
           uid: ''
         }

--
Gitblit v1.9.2