Parcourir la source

巡检管理接口调试

duy il y a 1 an
Parent
commit
6f0c7f40f7
4 fichiers modifiés avec 452 ajouts et 97 suppressions
  1. 77 0
      src/api/modules/patrol/patrol.js
  2. 250 70
      src/views/patrol/add.vue
  3. 57 13
      src/views/patrol/manage.vue
  4. 68 14
      src/views/patrol/safe.vue

+ 77 - 0
src/api/modules/patrol/patrol.js

@@ -0,0 +1,77 @@
+import { httpApi } from '../../request/httpApi'
+
+export default {
+    //获取巡检列表分页
+    async queryPage(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/routingInspection/page',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+ 
+    //获取新增巡检任务
+    async add(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/routingInspection/add',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+    //修改巡检
+    async update(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/routingInspection/Update',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+    //删除
+    async delete(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/routingInspection/delete',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //提交整改记录
+    async submitRectify(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/routingInspection/submitRectify',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+    //整改记录分页
+    async page2(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/routingInspection/page2',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //复核检测
+    async reviewInspect(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/routingInspection/reviewInspect',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //撤回提交
+    async revokeSubmit(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/routingInspection/revokeSubmit',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //获取巡检详情
+    async detail(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/routingInspection/detail',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+}

+ 250 - 70
src/views/patrol/add.vue

@@ -17,6 +17,7 @@
                     hc-btn
                     color="#e54d42"
                     style="color: white;"
+                    @click="clearInfo"
                 >
                     <HcIcon name="delete-bin-3" />
                     <span>清空数据</span>
@@ -26,6 +27,8 @@
                     hc-btn
                     color="#12C060"
                     style="color: white;"
+                    :loading="saveLoading"
+                    @click="saveInfo"
                 >
                     <HcIcon name="save" />
                     <span>保存数据</span>
@@ -35,6 +38,8 @@
                     hc-btn
                     color="#12C060"
                     style="color: white;"
+                    :loading="changeRowLoaing"
+                    @click="changeRowInfo"
                 >
                     <HcIcon name="save" />
                     <span>提交整改记录</span>
@@ -44,6 +49,8 @@
                     hc-btn
                     color="#12C060"
                     style="color: white;"
+                    :loading="updateLoaing"
+                    @click="updateInfo"
                 >
                     <HcIcon name="save" />
                     <span>确认修改</span>
@@ -53,7 +60,8 @@
                     hc-btn
                     color="#12C060"
                     style="color: white;"
-                    @click="goList"
+                    :loading="reviewInspectLoaing"
+                    @click="reviewInspect(2)"
                 >
                     <HcIcon name="save" />
                     <span>复核检查通过</span>
@@ -63,7 +71,8 @@
                     hc-btn
                     color="rgb(189, 49, 36)"
                     style="color: white;"
-                    @click="goList"
+                    :loading="reviewInspectLoaing1"
+                    @click="reviewInspect(1)"
                 >
                     <HcIcon name="save" />
                     <span>复核检查未通过</span>
@@ -88,8 +97,8 @@
                     <el-col :span="12">
                         <el-form-item label="是否需要整改" prop="isRectify">
                             <el-radio-group v-model="addForm.isRectify" class="ml-4" :disabled="type === 'view'">
-                                <el-radio label="1" size="large">需要整改</el-radio>
-                                <el-radio label="2" size="large">不要整改</el-radio>
+                                <el-radio :label="1" size="large">需要整改</el-radio>
+                                <el-radio :label="2" size="large">不要整改</el-radio>
                             </el-radio-group>
                         </el-form-item>
                     </el-col>
@@ -100,7 +109,7 @@
                             <el-date-picker
                                 v-model="addForm.rectifyDate"
                                 type="date"
-                               
+                                value-format="YYYY-MM-DD"
                                 placeholder="请选择整改日期"
                                 :disabled="type === 'changeRow' || type === 'review' || type === 'view'"
                             />
@@ -121,7 +130,7 @@
                 <el-divider border-style="dashed" style="border: 1px dashed #cdd4e3;" />
                 <el-row :gutter="20">
                     <el-col :span="4">
-                        <el-form-item label="检查部位" prop="inspectLocation">
+                        <el-form-item label="检查部位" prop="list">
                             <el-button
                                 hc-btn
                                 type="primary"
@@ -133,20 +142,8 @@
                             </el-button>
                         </el-form-item>
                     </el-col>
-                    <!-- <el-col :span="24">
-                        <div class="hc-process-box">
-                            <el-scrollbar style="max-height: 200px;overflow-y: auto;">
-                                <div v-for="(item, index) in processDataList" class="process-item-box">
-                                    <div class="process-item">
-                                        {{ item.path }}
-                                    </div>
-                                    <HcIcon class="process-icon" fill name="close-circle" @click="deleProcess(index)" />
-                                </div>
-                            </el-scrollbar>
-                        </div>
-                    </el-col> -->
                 </el-row>
-                <div style="position: relative; height: 400px">
+                <div style="position: relative; height: 400px;margin-top: 20px;">
                     <HcTable :column="tableColumn" :datas="processDataList">
                         <template #inspectProject="{ row }">
                             <hc-table-input v-model="row.inspectProject" type="textarea" :disabled="type === 'changeRow' || type === 'review' || type === 'view'" />
@@ -160,25 +157,25 @@
                         <template #rectifyFeedback="{ row }">
                             <hc-table-input v-model="row.rectifyFeedback" type="textarea" :disabled="type === 'review' || type === 'view'" />
                         </template>
-                        <template #rectifyAttachment="{ row }">
-                            <el-link v-if="row.rectifyAttachment" type="primary" :disabled="type === 'review' || type === 'view'">{{ row.key12 }}</el-link>
-                            <el-link v-else type="primary" @click="clickUpload">上传</el-link>
+                        <template #rectifyAttachment="{ row, index }">
+                            <el-link v-if="row?.rectifyAttachmentName" type="primary" :disabled="type === 'review' || type === 'view'" @click="openAttachment(row)">{{ row.rectifyAttachmentName }}</el-link>
+                            <el-link v-else type="primary" @click="clickAttachment(row, index)">上传</el-link>
                         </template>
                         <template #inspectUserName="{ row }">
                             <hc-table-input v-model="row.inspectUserName" type="textarea" :disabled="type === 'review' || type === 'view'" />
                         </template>
-                        <template #inspectPdfUrl="{ row }">
-                            <el-link v-if="!row?.ishowImage" type="primary" :disabled="type === 'review' || type === 'view'" @click="clickUpload(row)">上传</el-link>
+                        <template #inspectPdfUrl="{ row, index }">
+                            <el-link v-if="row?.isShowImage == 0" type="primary" :disabled="type === 'review' || type === 'view'" @click="clickUploadInspect(row, index)">上传</el-link>
                        
-                            <el-image v-else style="width: 100px; height: 100px" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" />
+                            <el-image v-else style="width: 100px; height: 100px" :src="row?.inspectPdfUrl" />
                         </template>
-                        <template #rectifyPdfUrl="{ row }">
-                            <el-link v-if="!row?.ishowImage" type="primary" :disabled="type === 'review' || type === 'view'" @click="clickUpload(row)">上传</el-link>
+                        <template #rectifyPdfUrl="{ row, index }">
+                            <el-link v-if="!row.rectifyPdfUrl" type="primary" :disabled="type === 'review' || type === 'view'" @click="clickRectifyPdfUrl(row, index)">上传</el-link>
                        
-                            <el-image v-else style="width: 100px; height: 100px" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" />
+                            <el-image v-else style="width: 100px; height: 100px" :src="row.rectifyPdfUrl" />
                         </template>
-                        <template #action="{ row }">
-                            <el-link type="danger">删除</el-link>
+                        <template #action="{ row, index }">
+                            <el-link type="danger" @click="deleProcess(row, index)">删除</el-link>
                         </template>
                     </HcTable>
                 </div>
@@ -202,6 +199,7 @@
                                 default-expand-all
                                 :default-checked-keys="defaultChecked"
                                 :auto-expand-keys="TreeAutoExpandKeys"
+                                check-strictly
                                 @nodeTap="wbsElTreeClick"
                                 @check="divisionTreeCheck"
                             >
@@ -218,6 +216,7 @@
                                 show-checkbox
                                 :default-checked-keys="defaultChecked"
                                 :auto-expand-keys="TreeAutoExpandKeys"
+                                check-strictly
                                 @check="divisionTreeCheck"
                                 @load="treeLoadNode"
                                 @nodeTap="wbsElTreeClick"
@@ -248,9 +247,10 @@
 import { nextTick, onActivated, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import queryApi from '~api/data-fill/query'
-import { getArrValue, getObjValue } from 'js-fast-way'
+import { arrToKey, formValidate, getArrValue, getObjValue } from 'js-fast-way'
 import { useRoute, useRouter } from 'vue-router'
 import { getTokenHeader } from '~src/api/request/header'
+import patrolApi from '~api/patrol/patrol'
 
 //初始变量
 const router = useRouter()
@@ -258,6 +258,7 @@ const useAppState = useAppStore()
 const useRoutes = useRoute()
 const routerQuery = useRoutes?.query
 const type = ref(routerQuery?.type || '')
+const id = ref(routerQuery?.id || '')
 const projectId = ref(useAppState.getProjectId)
 const contractId = ref(useAppState.getContractId)
 const addFormRef = ref(null)
@@ -283,7 +284,7 @@ const addRules = {
         trigger: 'blur',
         message: '请选择整改人',
     },
-    inspectLocation: {
+    list: {
         required: true,
         trigger: 'blur',
         message: '请选择检查部位',
@@ -307,43 +308,42 @@ const tableColumn = ref([
 { key: 'inspectProject', name: '检查项目' },
             { key: 'inspectContent', name: '检查内容' },
             { key: 'rectifyFeedback', name: '整改反馈' },
-            { key: 'rectifyAttachment', name: '整改附件' },
+            { key: 'rectifyAttachment', name: '整改附件', width:150 },
             { key: 'inspectPdfUrl', name: '图片', width:150 },
             { key: 'action', name: '操作', width:100 },
 ])
 //整改显示列
 
-const tableData = ref([
-    { id: 1, name: '名称1', text: '文本1', color: 'red', key12:'xxxxx.pdf' },
-    { id: 2, name: '名称2', text: '文本2', color: 'blue', key12:'xxxxx.pdf' },
-    { id: 3, name: '名称3', text: '文本3', color: '无', key12:'' },
- 
 
-])
 
 
 onActivated(()=>{
     const routerQuery = useRoutes?.query
     type.value = routerQuery?.type || ''
-    console.log( type.value, ' type.value')
+    id.value = routerQuery?.id || ''
+    if (id.value.length > 0) {
+        getDetail( id.value)
+    }
     if (type.value === 'changeRow') {
+
         tableColumn.value = [
             { key: 'inspectProject', name: '检查项目' },
             { key: 'inspectContent', name: '检查内容' },
             { key: 'rectifyFeedback', name: '整改反馈' },
-            { key: 'rectifyAttachment', name: '整改附件' },
-            { key: 'inspectPdfUrl', name: '图片', width:150 },
+            { key: 'rectifyAttachment', name: '整改附件', width:150 },
+            { key: 'rectifyPdfUrl', name: '图片', width:150 },
             { key: 'action', name: '操作', width:100 },
         ]
     } else if (type.value === 'review') {
+       
         tableColumn.value = [
             { key: 'inspectProject', name: '检查项目' },
             { key: 'inspectContent', name: '检查内容' },
             { key: 'deductionStandard', name: '扣分标准' },
             { key: 'inspectUserName', name: '检查人名称' },
-            { key: 'key5', name: '图片', width:150 },
+            { key: 'inspectPdfUrl', name: '图片', width:150 },
             { key: 'rectifyFeedback', name: '整改反馈' },
-            { key: 'rectifyAttachment', name: '整改附件' },
+            { key: 'rectifyAttachment', name: '整改附件', width:150 },
             { key: 'rectifyPdfUrl', name: '整改后图片', width:150 },
          
         ]
@@ -358,15 +358,74 @@ onActivated(()=>{
         ]
     }
 })
+
+//获取巡检详情
+const getDetail = async (id)=>{
+    const { error, code, data } = await patrolApi.detail({
+        id:id,
+
+    })
+    //判断状态
+   
+    if (!error && code === 200) {
+        console.log(data, 'data')
+        addForm.value = getObjValue(data)
+        processDataList.value = addForm.value.list
+        peoples.value = addForm.value.rectifyUser
+    } else {
+        addForm.value = {}
+        processDataList.value = []
+    }
+}
 const HcUploadFileRef = ref(null)
-const clickUpload = ()=>{
+//上传配置
+const UploadFileOptions = ref({})
+//上传检查图片
+const clickUploadInspect = (row, index)=>{
+    UploadFileOptions.value = {
+            url: '/api/blade-resource/oss/endpoint/put-file',
+            accept: 'image/png,image/jpg,image/jpeg',
+            accept_tip: 'png、jpg、jpeg',
+            headers: getTokenHeader(),
+            multiple: false,
+    }
+    HcUploadFileRef.value?.cancelUpload()
     HcUploadFileRef.value?.selectFile()
-    uploadFileEchoParams.value = { type:'image' }
+    uploadFileEchoParams.value = { type:'image', index:index }
 }
-//上传配置
-const UploadFileOptions = {
-    //此处设置header
-    headers: getTokenHeader(),
+//上传整改图片
+const clickRectifyPdfUrl = (row, index)=>{
+    UploadFileOptions.value = {
+            url: '/api/blade-resource/oss/endpoint/put-file',
+            accept: 'image/png,image/jpg,image/jpeg',
+            accept_tip: 'png、jpg、jpeg',
+            headers: getTokenHeader(),
+            multiple: false,
+    }
+    HcUploadFileRef.value?.cancelUpload()
+    HcUploadFileRef.value?.selectFile()
+    uploadFileEchoParams.value = { type:'rectify', index:index }
+}
+//上传整改附件
+const clickAttachment = (row, index)=>{
+    UploadFileOptions.value = {
+            url: '/api/blade-resource/oss/endpoint/put-file',
+            accept: 'image/png,image/jpg,image/jpeg,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/pdf,.doc,.docx,application/msword',
+            accept_tip: '图片(png、jpg、jpeg)<br/>Excel(xls、xlsx)<br/>PDF<br/>Word(doc、docx)',
+            headers: getTokenHeader(),
+            multiple: false,
+    }
+    HcUploadFileRef.value?.cancelUpload()
+    HcUploadFileRef.value?.selectFile()
+    uploadFileEchoParams.value = { type:'attachment', index:index }
+}
+
+const openAttachment = (row)=>{
+    if (row?.rectifyAttachment) {
+        window.open(row?.rectifyAttachment, '_blank')
+    } else {
+        window.$message?.warning('获取PDF失败')
+    }
 }
 const uploadFileParams = ref({})
 const uploadFileEchoParams = ref({})
@@ -377,8 +436,29 @@ const HcUploadFileProgress = (res) => {
 // 文件上传成功的回调
 const HcUploadFileSuccess = ({ echoParams, resData }) => {
    
-    console.log(echoParams, 'echoParams')
-    console.log(resData, 'resData')
+    if (echoParams['type'] === 'image' && resData?.link) {
+        setUploadImage(echoParams, resData)
+    } else if (echoParams['type'] === 'attachment' && resData?.link) {
+        setAttchment(echoParams, resData)
+    } else if (echoParams['type'] === 'rectify' && resData?.link) {
+        setRectify(echoParams, resData)
+    }
+}
+//设置上传图片
+const setUploadImage = (echoParams, resData)=>{
+        processDataList.value[echoParams['index']].isShowImage = 1
+        processDataList.value[echoParams['index']].inspectPdfUrl = resData?.link
+}
+//这种上传整改图片
+const setRectify = (echoParams, resData)=>{
+    console.log(resData, 'resData11111')
+        processDataList.value[echoParams['index']].rectifyPdfUrl = resData?.link
+}
+//设置上传附件
+const setAttchment = (echoParams, resData)=>{
+    console.log(resData, 'resData11111')
+        processDataList.value[echoParams['index']].rectifyAttachmentName = resData?.originalName
+        processDataList.value[echoParams['index']].rectifyAttachment = resData?.link
 }
 
 // 文件全部上传成功
@@ -389,26 +469,30 @@ const HcUploadFileChange = () => {
 const HcUploadFileFinish = ()=>{
     HcUploadFileRef.value?.setModalShow(false)
 }
-const ishowPeople = ref(false)
+
 //选择整改人
 const peoples = ref('')
 //任务人选择改变
 const tasksUserChange = (a, b, users) => {
-    addForm.value.key4 = users
+    addForm.value.rectifyUser = users
 }
 //关联工程用途及部位
 const linksRelateModal = ref(false)
 const linksRelateModalClick = ()=>{
+    TreeAutoExpandKeys.value = processDataList.value[processDataList.value.length - 1].autoExpandKeys
+    console.log( TreeAutoExpandKeys.value, '  TreeAutoExpandKeys.value')
     linksRelateModal.value = true
+   
+    defaultChecked.value = arrToKey(processDataList.value, 'primaryKeyId', ',').split(',')
 }
 const linksRelateModalClose = ()=>{
     linksRelateModal.value = false
 }
 const processDataList = ref([])
 const linksRelateModalSave = ()=>{
-    console.log('baocun')
+    console.log('baocun', processDataList.value )
     const keys = processElTree.value.treeRef.getCheckedKeys()
-    let linkTabIds = []
+    let linkTabIds = processDataList.value 
     if (keys.length === 0) {
         linkTabIds = []
     }
@@ -421,19 +505,37 @@ const linksRelateModalSave = ()=>{
        })
     }
     for (let index = 0; index < keys.length; index++) {
-        let pathArr = []
         let node = processElTree.value.treeRef.getNode(keys[index])
-        getPathName(node, pathArr)
+        console.log(node, 'NODE')
         linkTabIds.push({
-            inspectProject: pathArr.join('/'),
+            inspectProject: node.data.title,
             primaryKeyId: keys[index],
             autoExpandKeys:TreeAutoExpandKeys.value,
+            isShowImage:0,
+
         })
     }
      //去除掉重复的
      getNorepeatArr(linkTabIds)
      console.log(linkTabIds, 'linkTabIds')
+     console.log(processDataList.value, 'processDataList.value')
+    linkTabIds.forEach((ele)=>{
+        processDataList.value.forEach((ele1)=>{
+            if (ele.primaryKeyId === ele1.primaryKeyId) {
+                ele.isShowImage = ele1.isShowImage
+                ele.inspectContent = ele1.inspectContent
+                ele.deductionStandard = ele1.deductionStandard
+                ele.inspectUserName = ele1.inspectUserName
+                ele.inspectPdfUrl = ele1.inspectPdfUrl
+                ele.autoExpandKeys = ele1.autoExpandKeys
+            
+            }
+        })
+    })
+    console.log(linkTabIds, 'linkTabIds1111')
      processDataList.value = linkTabIds
+     linksRelateModal.value = false
+     addForm.value.list = linkTabIds
  
    
 }
@@ -450,17 +552,9 @@ const getNorepeatArr = (tempArr)=> {
     return tempArr
 
 }
-//获取节点的路径名字
-const getPathName = (node, pathArr) => {
-    if (node.parent?.parent) {
-        pathArr.unshift(node.data?.title.replace(/(^\s*)|(\s*$)/g, '')) //去掉头尾空格
-        getPathName(node.parent, pathArr)
-    } else {
-        return //根节点结束
-    }
-}
+
 //移除工序
-const deleProcess = (index) => {
+const deleProcess = (row, index) => {
     const linkTabIds = processDataList.value
     linkTabIds.splice(index, 1)
 
@@ -514,7 +608,6 @@ const wbsElTreeClick = ({ node, data, keys })=>{
     console.log(data, 'data')
     TreeAutoExpandKeys.value = keys || []
 }
-const wbstree = ref(null)
 //懒加载的数据
 const treeLoadNode = async ({ node, item, level }, resolve) => {
     let contractIdRelation = '', parentId = '', primaryKeyId = ''
@@ -540,6 +633,9 @@ const treeLoadNode = async ({ node, item, level }, resolve) => {
 const divisionTreeItemInfo = ref({})
 const divisionTreeCheck = ({ data }) => {
     divisionTreeItemInfo.value = data
+    console.log(data, 'data')
+  
+
 }
 const defaultChecked = ref([]) //默认选中
 const TreeAutoExpandKeys = ref([])//默认展开
@@ -553,6 +649,90 @@ const goList = ()=>{
 const goBack = ()=>{
     router.back()
 }
+
+//保存数据
+const saveLoading = ref(false)
+const saveInfo = async ()=>{
+    const validate = await formValidate(addFormRef.value)
+    if (validate) {
+        console.log(addForm.value, '数据')
+        addForm.value.projectId = projectId.value
+        addForm.value.list = processDataList.value
+        saveLoading.value = true
+        const { error, code } = await patrolApi.add(
+          addForm.value,
+        )
+        saveLoading.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('操作成功')
+        }
+    }
+}
+//修改数据
+const updateLoaing = ref(false)
+const updateInfo = async ()=>{
+    const validate = await formValidate(addFormRef.value)
+    if (validate) {
+        console.log(addForm.value, '数据')
+        addForm.value.projectId = projectId.value
+        addForm.value.list = processDataList.value
+        updateLoaing.value = true
+        const { error, code } = await patrolApi.update(
+          addForm.value,
+        )
+        updateLoaing.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('操作成功')
+        }
+    }
+}
+//清除数据
+const clearInfo = ()=>{
+   processDataList.value = []
+   addForm.value = {}
+   peoples.value = ''
+   addForm.value.id = id.value
+}
+//提交整改记录
+const changeRowLoaing = ref(false)
+const changeRowInfo = async ()=>{
+    const validate = await formValidate(addFormRef.value)
+    if (validate) {
+        console.log(addForm.value, '数据')
+        addForm.value.projectId = projectId.value
+        addForm.value.list = processDataList.value
+        changeRowLoaing.value = true
+        const { error, code } = await patrolApi.submitRectify(
+          addForm.value,
+        )
+        changeRowLoaing.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('操作成功')
+        }
+    }
+}
+//复核检测
+const reviewInspectLoaing = ref(false)
+const reviewInspectLoaing1 = ref(false)
+const reviewInspect = async (type)=>{
+    if (type === 2) {
+        reviewInspectLoaing.value = true
+    } else if (type === 1) {
+        reviewInspectLoaing1.value = false
+    }
+
+        const { error, code } = await patrolApi.reviewInspect(
+            { id:id.value,
+            status:type },
+        )
+        reviewInspectLoaing.value = false
+        reviewInspectLoaing1.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('操作成功')
+            goList()
+        }
+    
+}
 </script>
 
 <style lang='scss' scoped>

+ 57 - 13
src/views/patrol/manage.vue

@@ -3,12 +3,16 @@
     <div class="hc-page-box">
         <HcNewCard>
             <HcTable is-new :column="tableColumn" :datas="tableData">
-                <template #key3="{ row }">
-                    <span class="text-link" @click="tableRowEdit(row)">{{ row?.key3 }}</span>
+                <template #inspectName="{ row }">
+                    <span class="text-link" @click="tableRowEdit(row)">{{ row?.inspectName }}</span>
+                </template>
+                <template #isRectify="{ row }">
+                    <span v-if="row.isRectify == 1">需要</span>
+                    <span v-else>不需要</span>
                 </template>
                 <template #action="{ row }">
-                    <el-link v-if="row.isType" type="primary" @click="changeRow(row)">整改</el-link>
-                    <el-link v-else type="primary">撤回提交</el-link>
+                    <el-link v-if="row.submitRectify == 1" type="primary" @click="changeRow(row)">整改</el-link>
+                    <el-link v-else type="primary" @click="cancleSubmit(row)">撤回提交</el-link>
                 </template>
             </HcTable>
             <template #action>
@@ -19,18 +23,23 @@
 </template>
 
 <script setup>
-import { ref, watch } from 'vue'
+import { onActivated, onMounted, ref, watch } from 'vue'
 import { useRouter } from 'vue-router'
+import patrolApi from '~api/patrol/patrol'
+import { useAppStore } from '~src/store'
+import { getArrValue } from 'js-fast-way'
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId)
 //初始变量
 const router = useRouter()
 const tableColumn = [
-    { key: 'key1', name: '项目' },
-    { key: 'key2', name: '检查类别' },
-    { key: 'key3', name: '检查名称' },
-    { key: 'key4', name: '复核检查状态' },
-    { key: 'key5', name: '是否需要整改' },
-    { key: 'key6', name: '需求整改完成日期' },
-    { key: 'key7', name: '实际整改完成日期' },
+    { key: 'projectName', name: '项目' },
+    { key: 'inspectTypeName', name: '检查类别' },
+    { key: 'inspectName', name: '检查名称' },
+    { key: 'reviewInspectStatusName', name: '复核检查状态' },
+    { key: 'isRectify', name: '是否需要整改' },
+    { key: 'rectifyDate', name: '需求整改完成日期' },
+    { key: 'actualRectifyDate', name: '实际整改完成日期' },
     { key: 'action', name: '操作' },
 ]
 const tableData = ref([
@@ -46,8 +55,29 @@ const searchForm = ref({
 const pageChange = ({ current, size }) => {
     searchForm.value.current = current
     searchForm.value.size = size
-    // getTableData()
+    getTableData()
+}
+const tableLoading = ref(false)
+const getTableData = async () => {
+    tableLoading.value = true
+    const { error, code, data } = await patrolApi.page2({
+        ...searchForm.value,
+        projectId: projectId.value,
+
+    })
+    //判断状态
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data['total'] || 0
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
 }
+onActivated(()=>{
+    getTableData()
+})
 const tableRowEdit = (row)=>{
     changeRow(row)
 }
@@ -57,9 +87,23 @@ const changeRow = (row)=>{
         path: '/patrol/add',
         query: {
             type: 'changeRow',
+            id:row.id,
         },
     })
 }
+//撤回提交
+const cancleSubmit = async (row)=>{
+    tableLoading.value = true
+    const { error, code, msg } = await patrolApi.revokeSubmit({
+       id:row.id,
+
+    })
+    //判断状态
+    if (!error && code === 200) {
+        window.$message.success(msg)
+        getTableData()
+    } 
+}
 </script>
 
 <style lang='scss' scoped>

+ 68 - 14
src/views/patrol/safe.vue

@@ -3,13 +3,17 @@
     <div class="hc-page-box">
         <HcNewCard>
             <HcTable is-new :column="tableColumn" :datas="tableData">
-                <template #key3="{ row }">
-                    <span class="text-link" @click="tableRowEdit(row)">{{ row?.key3 }}</span>
+                <template #inspectName="{ row }">
+                    <span class="text-link" @click="tableRowEdit(row)">{{ row?.inspectName }}</span>
+                </template>
+                <template #isRectify="{ row }">
+                    <span v-if="row.isRectify == 1">需要</span>
+                    <span v-else>不需要</span>
                 </template>
                 <template #action="{ row }">
-                    <el-link type="primary" @click="reviewRow(row)">复核</el-link>
+                    <el-link v-if="row.submitRectify == 2 && row.isRectify == 1" type="primary" @click="reviewRow(row)">复核</el-link>
                     <el-link type="primary" @click="updateRow(row)">修改</el-link>
-                    <el-link type="primary">删除</el-link>
+                    <el-link type="primary" @click="delRow(row)">删除</el-link>
                 </template>
             </HcTable>
             <template #action>
@@ -20,25 +24,27 @@
 </template>
 
 <script setup>
-import { ref, watch } from 'vue'
+import { onActivated, onMounted, ref } from 'vue'
 import { useRouter } from 'vue-router'
+import patrolApi from '~api/patrol/patrol'
+import { useAppStore } from '~src/store'
+import { getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId)
 //初始变量
 const router = useRouter()
 const tableColumn = [
-    { key: 'projectName	', name: '项目' },
+    { key: 'projectName', name: '项目' },
     { key: 'inspectTypeName', name: '检查类别' },
     { key: 'inspectName', name: '检查名称' },
     { key: 'reviewInspectStatusName', name: '复核检查状态' },
-    { key: 'submitRectify', name: '是否需要整改' },
+    { key: 'isRectify', name: '是否需要整改' },
     { key: 'rectifyDate', name: '需求整改完成日期' },
     { key: 'actualRectifyDate', name: '实际整改完成日期' },
     { key: 'action', name: '操作' },
 ]
-const tableData = ref([
-    { key1: 'xx至xx高速公路-演示项(本地测试)', key2: '安全巡检', key3: '原地面检查', key4:'检查状态', key5:'需要整改', key6:'2023-09-27', key7:'2023-09-27' },
-    { key1: 'xx至xx高速公路-演示项(本地测试)', key2: '安全巡检', key3: '原地面检查', key4:'检查状态', key5:'需要整改', key6:'2023-09-27', key7:'2023-09-27' },
-    { key1: 'xx至xx高速公路-演示项(本地测试)', key2: '安全巡检', key3: '原地面检查', key4:'检查状态', key5:'需要整改', key6:'2023-09-27', key7:'2023-09-27' },
-])
+const tableData = ref([])
 //搜索表单
 const searchForm = ref({
     current: 1, size: 20, total: 0,
@@ -47,13 +53,35 @@ const searchForm = ref({
 const pageChange = ({ current, size }) => {
     searchForm.value.current = current
     searchForm.value.size = size
-    // getTableData()
+    getTableData()
 }
-const tableRowEdit = ()=>{
+const tableLoading = ref(false)
+const getTableData = async () => {
+    tableLoading.value = true
+    const { error, code, data } = await patrolApi.queryPage({
+        ...searchForm.value,
+        projectId: projectId.value,
+
+    })
+    //判断状态
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data['total'] || 0
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
+}
+onActivated(()=>{
+    getTableData()
+})
+const tableRowEdit = (row)=>{
     router.push({
         path: '/patrol/add',
         query: {
             type: 'view',
+            id:row.id,
         },
     })
 }
@@ -62,6 +90,7 @@ const updateRow = (row)=>{
         path: '/patrol/add',
         query: {
             type: 'confirmChange',
+            id:row.id,
         },
     })
 }
@@ -70,9 +99,34 @@ const reviewRow = (row)=>{
         path: '/patrol/add',
         query: {
             type: 'review',
+            id:row.id,
         },
     })
 }
+//删除
+const delRow = (row)=>{
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                delInfo(row)
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
+}
+const delInfo = async (row)=>{
+    const { error, code, msg } = await patrolApi.delete({
+        id:row.id,
+
+    })
+    //判断状态
+    if (!error && code === 200) {
+        window.$message.success(msg)
+        getTableData()
+    } 
+}
 </script>
 
 <style lang='scss' scoped>