Browse Source

Merge remote-tracking branch 'origin/master'

ZaiZai 1 year ago
parent
commit
2f0088dcb5
3 changed files with 83 additions and 67 deletions
  1. 61 59
      src/views/patrol/add.vue
  2. 10 4
      src/views/patrol/manage.vue
  3. 12 4
      src/views/patrol/safe.vue

+ 61 - 59
src/views/patrol/add.vue

@@ -13,7 +13,7 @@
                     <span>返回</span>
                     <span>返回</span>
                 </el-button>
                 </el-button>
                 <el-button
                 <el-button
-                    v-if="type !== 'view' && type !== 'review'"
+                    v-if="type !== 'view' && type !== 'review' && type !== 'changeRow'"
                     hc-btn
                     hc-btn
                     color="#e54d42"
                     color="#e54d42"
                     style="color: white;"
                     style="color: white;"
@@ -23,7 +23,7 @@
                     <span>清空数据</span>
                     <span>清空数据</span>
                 </el-button>
                 </el-button>
                 <el-button
                 <el-button
-                    v-if="type === ''"
+                    v-if="type === 'add'"
                     hc-btn
                     hc-btn
                     color="#12C060"
                     color="#12C060"
                     style="color: white;"
                     style="color: white;"
@@ -158,21 +158,31 @@
                             <hc-table-input v-model="row.rectifyFeedback" type="textarea" :disabled="type === 'review' || type === 'view'" />
                             <hc-table-input v-model="row.rectifyFeedback" type="textarea" :disabled="type === 'review' || type === 'view'" />
                         </template>
                         </template>
                         <template #rectifyAttachment="{ row, index }">
                         <template #rectifyAttachment="{ row, index }">
-                            <el-link v-if="row?.rectifyAttachmentName" type="primary" :disabled="type === 'review' || type === 'view'" @click="clickAttachment(row)">{{ row.rectifyAttachmentName }}</el-link>
-                            <el-link v-else type="primary" @click="clickAttachment(row, index)">上传</el-link>
+                            <template v-if="row?.rectifyAttachment">
+                                <el-link v-if=" type === 'changeRow' || type === 'add'" type="primary" @click="clickAttachment(row, index)">{{ row.rectifyAttachmentName }}</el-link>
+                                <el-link v-else @click="openAttachment(row)">{{ row.rectifyAttachmentName }}</el-link>
+                            </template>
+                              
+                            <el-link v-else type="primary" :disabled="type === 'review' || type === 'view'" @click="clickAttachment(row, index)">
+                                上传
+                            </el-link>
                         </template>
                         </template>
                         <template #inspectUserName="{ row }">
                         <template #inspectUserName="{ row }">
                             <hc-table-input v-model="row.inspectUserName" type="textarea" :disabled="type === 'review' || type === 'view'" />
                             <hc-table-input v-model="row.inspectUserName" type="textarea" :disabled="type === 'review' || type === 'view'" />
                         </template>
                         </template>
                         <template #inspectPdfUrl="{ row, index }">
                         <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-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;cursor: pointer;" :src="row?.inspectPdfUrl" @click="clickUploadInspect(row, index)" />
+                            <template v-else>
+                                <el-image v-if="type === 'confirmChange' || type === 'add'" style="width: 100px; height: 100px;cursor: pointer;" :src="row?.inspectPdfUrl" @click="clickUploadInspect(row, index)" />
+                                <el-image v-else style="width: 100px; height: 100px;cursor: pointer;" :src="row?.inspectPdfUrl" :preview-src-list="[row?.inspectPdfUrl]" :initial-index="0" hide-on-click-modal preview-teleported />
+                            </template>
                         </template>
                         </template>
                         <template #rectifyPdfUrl="{ row, index }">
                         <template #rectifyPdfUrl="{ row, index }">
                             <el-link v-if="!row.rectifyPdfUrl" type="primary" :disabled="type === 'review' || type === 'view'" @click="clickRectifyPdfUrl(row, index)">上传</el-link>
                             <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;cursor: pointer;" :src="row.rectifyPdfUrl" @click="clickRectifyPdfUrl(row, index)" />
+                            <template v-else>
+                                <el-image v-if="type === 'changeRow' || type === 'add' || type === 'confirmChange'" style="width: 100px; height: 100px;cursor: pointer;" :src="row.rectifyPdfUrl" @click="clickRectifyPdfUrl(row, index)" />
+                                <el-image v-else style="width: 100px; height: 100px;cursor: pointer;" :src="row?.rectifyPdfUrl" :preview-src-list="[row?.rectifyPdfUrl]" :initial-index="0" hide-on-click-modal preview-teleported />
+                            </template>
                         </template>
                         </template>
                         <template #action="{ row, index }">
                         <template #action="{ row, index }">
                             <el-link type="danger" :disabled="type === 'view' || type === 'changeRow'" @click="deleProcess(row, index)">删除</el-link>
                             <el-link type="danger" :disabled="type === 'view' || type === 'changeRow'" @click="deleProcess(row, index)">删除</el-link>
@@ -202,6 +212,7 @@
                                 check-strictly
                                 check-strictly
                                 @nodeTap="wbsElTreeClick"
                                 @nodeTap="wbsElTreeClick"
                                 @check="divisionTreeCheck"
                                 @check="divisionTreeCheck"
+                                @check-change="divisionTreeCheckChange"
                             >
                             >
                                 <template #default="{ node, data }">
                                 <template #default="{ node, data }">
                                     <span style="font-size: 16px;">{{ data.title }}</span>
                                     <span style="font-size: 16px;">{{ data.title }}</span>
@@ -217,6 +228,7 @@
                                 :default-checked-keys="defaultChecked"
                                 :default-checked-keys="defaultChecked"
                                 :auto-expand-keys="TreeAutoExpandKeys"
                                 :auto-expand-keys="TreeAutoExpandKeys"
                                 check-strictly
                                 check-strictly
+                                @check-change="divisionTreeCheckChange"
                                 @check="divisionTreeCheck"
                                 @check="divisionTreeCheck"
                                 @load="treeLoadNode"
                                 @load="treeLoadNode"
                                 @nodeTap="wbsElTreeClick"
                                 @nodeTap="wbsElTreeClick"
@@ -258,7 +270,7 @@ const router = useRouter()
 const useAppState = useAppStore()
 const useAppState = useAppStore()
 const useRoutes = useRoute()
 const useRoutes = useRoute()
 const routerQuery = useRoutes?.query
 const routerQuery = useRoutes?.query
-const type = ref(routerQuery?.type || '')
+const type = ref(routerQuery?.type || 'add')
 const id = ref(routerQuery?.id || '')
 const id = ref(routerQuery?.id || '')
 const projectId = ref(useAppState.getProjectId)
 const projectId = ref(useAppState.getProjectId)
 const contractId = ref(useAppState.getContractId)
 const contractId = ref(useAppState.getContractId)
@@ -331,7 +343,7 @@ const tableColumn = ref([
 onActivated(()=>{
 onActivated(()=>{
     getTypeOptions()
     getTypeOptions()
     const routerQuery = useRoutes?.query
     const routerQuery = useRoutes?.query
-    type.value = routerQuery?.type || ''
+    type.value = routerQuery?.type || 'add'
     id.value = routerQuery?.id || ''
     id.value = routerQuery?.id || ''
     if (id.value.length > 0) {
     if (id.value.length > 0) {
         getDetail( id.value)
         getDetail( id.value)
@@ -503,6 +515,7 @@ const linksRelateModalClick = ()=>{
     TreeAutoExpandKeys.value = processDataList.value[0]?.autoExpandKeys || []
     TreeAutoExpandKeys.value = processDataList.value[0]?.autoExpandKeys || []
     linksRelateModal.value = true
     linksRelateModal.value = true
     isSearchTree.value = false
     isSearchTree.value = false
+    newPushArr.value = []
    
    
     defaultChecked.value = arrToKey(processDataList.value, 'primaryKeyId', ',').split(',')
     defaultChecked.value = arrToKey(processDataList.value, 'primaryKeyId', ',').split(',')
 }
 }
@@ -510,65 +523,41 @@ const linksRelateModalClose = ()=>{
     linksRelateModal.value = false
     linksRelateModal.value = false
 }
 }
 const processDataList = ref([])
 const processDataList = ref([])
+
+    //获取展开节点
 const linksRelateModalSave = ()=>{
 const linksRelateModalSave = ()=>{
-    console.log('baocun', processDataList.value )
-    console.log(defaultChecked.value, 'defaultChecked.value')
-    const keys = processElTree.value.treeRef.getCheckedKeys()
-    // const keys = defaultChecked.value
-    console.log(keys, 'keys')
-    let linkTabIds = processDataList.value 
-    if (keys.length === 0) {
-        linkTabIds = []
-    }
-     //去出掉取消勾选的
-    for (let index = 0; index < keys.length; index++) {
-       linkTabIds = linkTabIds.filter((ele)=>{
-            if (ele.primaryKeyId === keys[index]) {
-                return ele
+    let arr = []//当前选中的节点
+    processDataList.value.forEach((ele)=>{
+        defaultChecked.value.forEach((ele1)=>{
+            if (ele.primaryKeyId === ele1) {
+                arr.push(ele)
             }
             }
-       })
-    }
-    for (let index = 0; index < keys.length; index++) {
-        console.log(keys[index], 'keys[index]')
+        })
+    })
+        const keys = processElTree.value.treeRef.getCheckedKeys()
+        for (let index = 0; index < keys.length; index++) {
         let node = processElTree.value.treeRef.getNode(keys[index])
         let node = processElTree.value.treeRef.getNode(keys[index])
-        console.log(node, 'NODE')
+
         let pathArr = []
         let pathArr = []
         getKeys(node, pathArr)
         getKeys(node, pathArr)
         TreeAutoExpandKeys.value = pathArr
         TreeAutoExpandKeys.value = pathArr
-        linkTabIds.push({
-            inspectProject: node.data.title,
-            primaryKeyId: keys[index],
+  
+    }
+    newPushArr.value.forEach((ele)=>{
+        arr.push({
+            inspectProject:ele.title,
+            primaryKeyId: ele.primaryKeyId,
             autoExpandKeys:TreeAutoExpandKeys.value,
             autoExpandKeys:TreeAutoExpandKeys.value,
             isShowImage:0,
             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
-            
-            }
+            contractId:contractId.value,
+  
         })
         })
     })
     })
-    console.log(linkTabIds, 'linkTabIds1111')
-     processDataList.value = linkTabIds
+    processDataList.value = arr
+    addForm.value.list = arr
      linksRelateModal.value = false
      linksRelateModal.value = false
-     addForm.value.list = linkTabIds
- 
    
    
 }
 }
-    //获取展开节点
     const getKeys = (node, pathArr) => {
     const getKeys = (node, pathArr) => {
     if (node.parent) {
     if (node.parent) {
         pathArr.unshift(node.data?.primaryKeyId.replace(/(^\s*)|(\s*$)/g, '')) //去掉头尾空格
         pathArr.unshift(node.data?.primaryKeyId.replace(/(^\s*)|(\s*$)/g, '')) //去掉头尾空格
@@ -668,9 +657,20 @@ const treeLoadNode = async ({ node, item, level }, resolve) => {
     resolve(getArrValue(data))
     resolve(getArrValue(data))
 }
 }
 
 
-const divisionTreeCheck = () => {
-
-
+const divisionTreeCheck = (data, { checkedNodes, checkedKeys }) => {
+}
+const newPushArr = ref([])
+const divisionTreeCheckChange = (data, ischeck, data1)=>{
+    if (!ischeck) {
+        defaultChecked.value.forEach((ele, index)=>{
+            if (ele === data.primaryKeyId) {
+                defaultChecked.value.splice(index, 1)
+            }
+        })
+    } else {
+        defaultChecked.value.push(data.primaryKeyId)
+        newPushArr.value.push(data)
+    }
 }
 }
 
 
 
 
@@ -694,6 +694,7 @@ const saveInfo = async ()=>{
     if (validate) {
     if (validate) {
         console.log(addForm.value, '数据')
         console.log(addForm.value, '数据')
         addForm.value.projectId = projectId.value
         addForm.value.projectId = projectId.value
+        addForm.value.contractId = contractId.value
         addForm.value.list = processDataList.value
         addForm.value.list = processDataList.value
         saveLoading.value = true
         saveLoading.value = true
         const { error, code } = await patrolApi.add(
         const { error, code } = await patrolApi.add(
@@ -702,6 +703,7 @@ const saveInfo = async ()=>{
         saveLoading.value = false
         saveLoading.value = false
         if (!error && code === 200) {
         if (!error && code === 200) {
             window?.$message?.success('操作成功')
             window?.$message?.success('操作成功')
+      
             goList()
             goList()
         }
         }
     }
     }

+ 10 - 4
src/views/patrol/manage.vue

@@ -7,12 +7,16 @@
                     <span class="text-link" @click="tableRowEdit(row)">{{ row?.inspectName }}</span>
                     <span class="text-link" @click="tableRowEdit(row)">{{ row?.inspectName }}</span>
                 </template>
                 </template>
                 <template #isRectify="{ row }">
                 <template #isRectify="{ row }">
-                    <span v-if="row.isRectify == 1">需要</span>
-                    <span v-else>不需要</span>
+                    <el-tag
+                        v-if="row?.isRectify"
+                        :type="`${row.isRectify === 3 ? 'success' : row.isRectify === 1 ? 'warning' : 'info'}`" class="mx-1" effect="dark"
+                    >
+                        {{ row.isRectify === 3 ? '已整改' : row.isRectify === 2 ? '不需要' : '需要' }}
+                    </el-tag>
                 </template>
                 </template>
                 <template #action="{ row }">
                 <template #action="{ row }">
-                    <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>
+                    <el-link v-if="row.submitRectify == 1" type="primary" :disabled="row.isRectifyUser === 0" @click="changeRow(row)">整改</el-link>
+                    <el-link v-else type="primary" :disabled="row.isRectifyUser === 0" @click="cancleSubmit(row)">撤回提交</el-link>
                 </template>
                 </template>
             </HcTable>
             </HcTable>
             <template #action>
             <template #action>
@@ -30,6 +34,7 @@ import { useAppStore } from '~src/store'
 import { getArrValue } from 'js-fast-way'
 import { getArrValue } from 'js-fast-way'
 const useAppState = useAppStore()
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
 const projectId = ref(useAppState.getProjectId)
+const contractId = ref(useAppState.contractId)
 //初始变量
 //初始变量
 const router = useRouter()
 const router = useRouter()
 const tableColumn = [
 const tableColumn = [
@@ -63,6 +68,7 @@ const getTableData = async () => {
     const { error, code, data } = await patrolApi.page2({
     const { error, code, data } = await patrolApi.page2({
         ...searchForm.value,
         ...searchForm.value,
         projectId: projectId.value,
         projectId: projectId.value,
+        contractId:contractId.value,
 
 
     })
     })
     //判断状态
     //判断状态

+ 12 - 4
src/views/patrol/safe.vue

@@ -7,13 +7,19 @@
                     <span class="text-link" @click="tableRowEdit(row)">{{ row?.inspectName }}</span>
                     <span class="text-link" @click="tableRowEdit(row)">{{ row?.inspectName }}</span>
                 </template>
                 </template>
                 <template #isRectify="{ row }">
                 <template #isRectify="{ row }">
-                    <span v-if="row.isRectify == 1">需要</span>
-                    <span v-else>不需要</span>
+                    <!-- <span v-if="row.isRectify == 1">需要</span>
+                    <span v-else>不需要</span> -->
+                    <el-tag
+                        v-if="row?.isRectify"
+                        :type="`${row.isRectify === 3 ? 'success' : row.isRectify === 1 ? 'warning' : 'info'}`" class="mx-1" effect="dark"
+                    >
+                        {{ row.isRectify === 3 ? '已整改' : row.isRectify === 2 ? '不需要' : '需要' }}
+                    </el-tag>
                 </template>
                 </template>
                 <template #action="{ row }">
                 <template #action="{ row }">
                     <el-link v-if="row.submitRectify == 2 && row.isRectify == 1" 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" @click="delRow(row)">删除</el-link>
+                    <el-link type="primary" :disabled="row.isRectify === 3" @click="updateRow(row)">修改</el-link>
+                    <el-link type="primary" :disabled="row.isRectify === 3" @click="delRow(row)">删除</el-link>
                 </template>
                 </template>
             </HcTable>
             </HcTable>
             <template #action>
             <template #action>
@@ -32,6 +38,7 @@ import { getArrValue } from 'js-fast-way'
 import { delMessageV2 } from '~com/message/index.js'
 import { delMessageV2 } from '~com/message/index.js'
 const useAppState = useAppStore()
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
 const projectId = ref(useAppState.getProjectId)
+const contractId = ref(useAppState.contractId)
 //初始变量
 //初始变量
 const router = useRouter()
 const router = useRouter()
 const tableColumn = [
 const tableColumn = [
@@ -61,6 +68,7 @@ const getTableData = async () => {
     const { error, code, data } = await patrolApi.queryPage({
     const { error, code, data } = await patrolApi.queryPage({
         ...searchForm.value,
         ...searchForm.value,
         projectId: projectId.value,
         projectId: projectId.value,
+        contractId:contractId.value,
 
 
     })
     })
     //判断状态
     //判断状态