From 01f3e49f3763a25ef67a4c3e5786491703a1aece Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期四, 13 七月 2023 14:39:58 +0800
Subject: [PATCH] 特殊作业对接修改

---
 src/views/specialWorkSystem/specialIndex/index.vue |  337 +++++++++++++++++++++++++++++--------------------------
 1 files changed, 179 insertions(+), 158 deletions(-)

diff --git a/src/views/specialWorkSystem/specialIndex/index.vue b/src/views/specialWorkSystem/specialIndex/index.vue
index b7dd2da..c93cfb0 100644
--- a/src/views/specialWorkSystem/specialIndex/index.vue
+++ b/src/views/specialWorkSystem/specialIndex/index.vue
@@ -126,7 +126,7 @@
           <el-col :span="5" style="display:flex;align-items: center">
             <span style="white-space: nowrap">作业状态:</span>
             <div class="grid-content topInfo">
-              <el-select :teleported="false" v-model="searchParams.workStatus" size="small">
+              <el-select :teleported="false" v-model="searchParams.workAllStatus" size="small">
                 <el-option
                     v-for="item in workStatusList"
                     :key="item.value"
@@ -162,56 +162,86 @@
           <el-button plain @click="clearSearch" size="small">重置</el-button>
         </el-row>
         <div class="main-card">
-          <el-row class="cardTop" style="justify-content: space-between">
-            <el-col :span="2" class="mainCardBtn">
-              <el-button type="primary" :icon="Plus" size="default" @click="toApply()">新作业申请</el-button>
-            </el-col>
-            <el-col :span="22" style="display: flex;justify-content: end;align-items: center">
-              <div class="top-info">
-                <el-icon :size="18" color="#F3001E" style="margin-right: 4px"><BellFilled /></el-icon>
-                作业编号
-                <div v-if="unchecked != 0">
-                  <el-tooltip
-                      class="box-item"
-                      effect="light"
-                      content="查看预警详情"
-                      placement="bottom-start"
-                  ><span>123456</span></el-tooltip>
-                </div>
-                可燃气体浓度超过18%
-                ,请及时处理!
-              </div>
-              <el-button type="primary" :icon="Refresh" size="default" @click="reLoadData()" />
-            </el-col>
-          </el-row>
+<!--          <el-row class="cardTop" style="justify-content: space-between">-->
+<!--            <el-col :span="2" class="mainCardBtn">-->
+<!--              <el-button type="primary" :icon="Plus" size="default" @click="toApply()">新作业申请</el-button>-->
+<!--            </el-col>-->
+<!--            <el-col :span="22" style="display: flex;justify-content: end;align-items: center">-->
+<!--              <div class="top-info">-->
+<!--                <el-icon :size="18" color="#F3001E" style="margin-right: 4px"><BellFilled /></el-icon>-->
+<!--                作业编号-->
+<!--                <div v-if="unchecked != 0">-->
+<!--                  <el-tooltip-->
+<!--                      class="box-item"-->
+<!--                      effect="light"-->
+<!--                      content="查看预警详情"-->
+<!--                      placement="bottom-start"-->
+<!--                  ><span>123456</span></el-tooltip>-->
+<!--                </div>-->
+<!--                可燃气体浓度超过18%-->
+<!--                ,请及时处理!-->
+<!--              </div>-->
+<!--              <el-button type="primary" :icon="Refresh" size="default" @click="reLoadData()" />-->
+<!--            </el-col>-->
+<!--          </el-row>-->
           <el-table ref="multipleTableRef" stripe border :data="workData" style="width: 100%" :header-cell-style="{ background: '#fafafa' }">
             <el-table-column property="workPermitNo" label="作业证编号" align="center"/>
-            <el-table-column property="depName" label="部门" align="center"/>
-            <el-table-column property="applyer" label="申请人" align="center"/>
-            <el-table-column property="finishUname" label="作业人" align="center"/>
+            <el-table-column property="workDepName" label="作业单位" align="center"/>
+            <el-table-column property="applyUname" label="申请人" align="center"/>
+            <el-table-column property="applyDepName" label="申请单位" align="center"/>
+            <el-table-column property="applyTime" label="申请时间" align="center"/>
+            <el-table-column property="startUname" label="开始人" align="center">
+              <template #default="scope">
+                <span>{{scope.row.startUname?scope.row.startUname:'--'}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column property="finishUname" label="结束人" align="center">
+              <template #default="scope">
+                <span>{{scope.row.finishUname?scope.row.finishUname:'--'}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column property="workStartTime" label="作业开始时间" align="center">
+              <template #default="scope">
+                <span>{{scope.row.workStartTime?scope.row.workStartTime:'--'}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column property="workFinishTime" label="作业结束时间" align="center">
+              <template #default="scope">
+                <span>{{scope.row.workFinishTime?scope.row.workFinishTime:'--'}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column property="acceptUname" label="验收人" align="center">
+              <template #default="scope">
+                <span>{{scope.row.acceptUname?scope.row.acceptUname:'--'}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column property="workAcceptContent" label="验收内容" align="center">
+              <template #default="scope">
+                <span>{{scope.row.workAcceptContent?scope.row.workAcceptContent:'--'}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column property="workAcceptTime" label="验收时间" align="center">
+              <template #default="scope">
+                <span>{{scope.row.workAcceptTime?scope.row.workAcceptTime:'--'}}</span>
+              </template>
+            </el-table-column>
             <el-table-column property="workTypeDesc" label="作业类型" align="center"/>
             <el-table-column property="workLevelDesc" label="作业等级" align="center"/>
-            <el-table-column property="gmtCreate" label="申请时间" align="center"/>
-            <el-table-column property="workStartTime" label="作业开始时间" align="center"/>
-            <el-table-column property="workFinishTime" label="作业结束时间" align="center"/>
-            <el-table-column property="workStatusDesc" label="作业状态" align="center"/>
-            <el-table-column property="reason" label="中止原因" align="center"/>
-            <el-table-column label="安全预警" align="center">
+            <el-table-column property="abortReason" label="中止原因" align="center">
               <template #default="scope">
-                <el-tag>--</el-tag>
+                <span>{{scope.row.abortReason?scope.row.abortReason:'--'}}</span>
               </template>
             </el-table-column>
-            <el-table-column property="message" label="报警信息" align="center">
-              <template #default="scope">
-                <el-button type="text" size="small" v-if="scope.row.message == 1">查看</el-button>
-                <span v-else>无</span>
-              </template>
-            </el-table-column>
+            <el-table-column property="workAllStatusDesc" label="作业状态" align="center"/>
             <el-table-column fixed="right" label="操作" align="center" width="250">
               <template #default="scope">
-                <el-button link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看作业票</el-button>
-                <el-button link type="primary" size="small" :icon="FolderChecked" @click="handleReview(scope.row)">验收</el-button>
-                <el-button link type="primary" size="small" :icon="VideoPlay" @click="openVideo(scope.row)">查看实时监控</el-button>
+                <el-button link
+                 v-if="scope.row.workAllStatus == -1|| scope.row.workAllStatus == 1 || scope.row.workAllStatus == 3 || scope.row.workAllStatus == 7"
+                  type="primary" size="small" :icon="VideoPlay" @click="openVideo(scope.row)">查看监控视频</el-button>
+                <el-button link type="primary" size="small" :icon="View" @click="viewRecord(scope.row.workApplyId)">查看记录</el-button>
+                <el-button link type="primary" size="small" :icon="View" @click="viewTicket(scope.row)">查看作业票</el-button>
+                <el-button link type="primary" size="small" :icon="Download" @click="downLoadTicket(scope.row)">导出作业票</el-button>
+<!--                <el-button link type="primary" size="small" :icon="FolderChecked" @click="handleReview(scope.row)">验收</el-button>-->
               </template>
             </el-table-column>
           </el-table>
@@ -238,24 +268,25 @@
               </span>
       </template>
     </el-dialog>
-    <el-dialog v-model="dialogReview" title="填报验收意见" center>
-      <el-form ref="reviewFormRef" :model="reviewForm" :rules="reviewRules" label-width="120px">
-        <el-form-item label="填报验收意见:" prop="advice">
-          <el-input
-              v-model="reviewForm.advice"
-              :autosize="{ minRows: 4, maxRows: 10 }"
-              type="textarea"
-              placeholder="请填写验收意见"
-          />
-        </el-form-item>
-      </el-form>
-      <template #footer>
-              <span class="dialog-footer">
-                <el-button type="primary" @click="submitReview(reviewFormRef)">提交验收</el-button>
-              </span>
-      </template>
-    </el-dialog>
+<!--    <el-dialog v-model="dialogReview" title="填报验收意见" center>-->
+<!--      <el-form ref="reviewFormRef" :model="reviewForm" :rules="reviewRules" label-width="120px">-->
+<!--        <el-form-item label="填报验收意见:" prop="advice">-->
+<!--          <el-input-->
+<!--              v-model="reviewForm.advice"-->
+<!--              :autosize="{ minRows: 4, maxRows: 10 }"-->
+<!--              type="textarea"-->
+<!--              placeholder="请填写验收意见"-->
+<!--          />-->
+<!--        </el-form-item>-->
+<!--      </el-form>-->
+<!--      <template #footer>-->
+<!--              <span class="dialog-footer">-->
+<!--                <el-button type="primary" @click="submitReview(reviewFormRef)">提交验收</el-button>-->
+<!--              </span>-->
+<!--      </template>-->
+<!--    </el-dialog>-->
     <video-detail ref="videoRef"></video-detail>
+    <Work-record ref="recordRef"></Work-record>
   </div>
 </template>
 
@@ -269,16 +300,17 @@
 import { Edit, View, Plus, Delete, Refresh, Search, Finished, Download, FolderChecked, VideoPlay } from '@element-plus/icons-vue';
 import { ElTable, ElMessage } from 'element-plus';
 import { specialIndexApi } from '/@/api/specialWorkSystem/specialIndex';
-import { workApplyApi } from '/@/api/specialWorkSystem/workApply';
-import type { TabsPaneContext } from 'element-plus';
 import type { FormInstance, FormRules } from 'element-plus'
 import {teamManageApi} from "/@/api/systemManage/basicDateManage/personShiftManage/teamManage";
+import { workApplyApi } from '/@/api/specialWorkSystem/workApply'
 import Cookies from 'js-cookie';
 import axios from 'axios';
 import * as echarts from "echarts";
 import screenfull from "screenfull";
 import VideoDetail from "/@/views/specialWorkSystem/specialIndex/components/videoDetail.vue";
+import WorkRecord from "/@/views/specialWorkSystem/specialIndex/components/workRecord.vue";
 import { BorderBox10 as DvBorderBox10 } from '@kjgl77/datav-vue3'
+import {productionDeviceApi} from "/@/api/doublePreventSystem/productionDevice";
 
 // 定义接口来定义对象的类型
 interface stateType {
@@ -336,6 +368,7 @@
   name: 'specialIndex',
   components: {
     VideoDetail,
+    WorkRecord,
     fire: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/fireLog.vue')),
     space: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/spaceLog.vue')),
     hoist: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/wdsq/components/hoistLog.vue')),
@@ -354,6 +387,7 @@
     const slfx = ref("eChartSlfx" + Date.now() + Math.random())
     const zyqs = ref("eChartZyqs" + Date.now() + Math.random())
     const videoRef = ref();
+    const recordRef = ref()
     const state = reactive<stateType>({
       pageIndex: 1,
       pageSize: 10,
@@ -365,9 +399,7 @@
         workPermitNo: '',
         startTime: '',
         endTime: '',
-        workStatus: null,
-        acceptStatus: null,
-        workAnalysisStatus: null
+        workAllStatus: null
       },
       dialogReview: false,
       departmentList: [],
@@ -395,83 +427,7 @@
       searchDep2: null,
       searchDep: null,
       searchDate: [],
-      workData: [
-        // {
-        //   num: '111',
-        //   dep: '部门1',
-        //   applyer: '张凤',
-        //   worker: '李羽飞',
-        //   type: '动火作业',
-        //   level: '一级',
-        //   applyTime: '2023-03-08',
-        //   startTime: '2023-03-08',
-        //   endTime: '2023-03-08',
-        //   status: 0,
-        //   reason: '分析超时',
-        //   warning: 0,
-        //   message: 1
-        // },
-        // {
-        //   num: '222',
-        //   dep: '部门2',
-        //   applyer: '张凤',
-        //   worker: '李羽飞',
-        //   type: '动土作业',
-        //   level: '一级',
-        //   applyTime: '2023-03-08',
-        //   startTime: '2023-03-08',
-        //   endTime: '2023-03-08',
-        //   status: 1,
-        //   reason: '分析超时',
-        //   warning: 1,
-        //   message: 0
-        // },
-        // {
-        //   num: '333',
-        //   dep: '部门3',
-        //   applyer: '张凤',
-        //   worker: '李羽飞',
-        //   type: '动火作业',
-        //   level: '一级',
-        //   applyTime: '2023-03-08',
-        //   startTime: '2023-03-08',
-        //   endTime: '2023-03-08',
-        //   status: 2,
-        //   reason: '分析超时',
-        //   warning: 2,
-        //   message: 0
-        // },
-        // {
-        //   num: '222',
-        //   dep: '部门2',
-        //   applyer: '张凤',
-        //   worker: '李羽飞',
-        //   type: '动土作业',
-        //   level: '一级',
-        //   applyTime: '2023-03-08',
-        //   startTime: '2023-03-08',
-        //   endTime: '2023-03-08',
-        //   status: 1,
-        //   reason: '分析超时',
-        //   warning: 1,
-        //   message: 0
-        // },
-        // {
-        //   num: '333',
-        //   dep: '部门3',
-        //   applyer: '张凤',
-        //   worker: '李羽飞',
-        //   type: '动火作业',
-        //   level: '一级',
-        //   applyTime: '2023-03-08',
-        //   startTime: '2023-03-08',
-        //   endTime: '2023-03-08',
-        //   status: 2,
-        //   reason: '分析超时',
-        //   warning: 2,
-        //   message: 0
-        // }
-      ],
+      workData: [],
       isFull: false,
       themeColor: '#333',
       workTimeList: [],
@@ -708,7 +664,7 @@
         },
         series: [
           {
-            name: 'Access From',
+            name: '',
             type: 'pie',
             radius: ['40%', '70%'],
             avoidLabelOverlap: false,
@@ -915,9 +871,7 @@
             workPermitNo: '',
             startTime: '',
             endTime: '',
-            workStatus: null,
-            acceptStatus: null,
-            workAnalysisStatus: null
+            workAllStatus: null
       }
       state.searchDate = []
       getMydepList()
@@ -933,7 +887,7 @@
     };
 
     // 查看记录
-    const viewRecord = (row: any) => {
+    const viewDetail = (row: any) => {
       state.dialogType = row.workType
       state.details = JSON.parse(JSON.stringify(row));
       if(state.details.workDetail.otherSpecialWork == '' || !state.details.workDetail.otherSpecialWork){
@@ -972,22 +926,85 @@
       state.dialogDetails = true;
     };
 
-    const handleReview = (row)=>{
-      state.dialogReview = true
+    // const handleReview = (row: object)=>{
+    //   state.dialogReview = true
+    // }
+    const openVideo = (row:object)=>{
+      videoRef.value.openDialog(row)
     }
-    const openVideo = ()=>{
-      videoRef.value.openDialog()
+
+    const viewRecord = (id: string | null)=>{
+      recordRef.value.openDialog(id)
     }
-    const submitReview = async (formEl: FormInstance | undefined) => {
-      if (!formEl) return
-      await formEl.validate((valid, fields) => {
-        if (valid) {
-          console.log('submit!')
+
+    const viewTicket = async(row)=>{
+      let res = await workApplyApi().viewTicket({id:row.workApplyId})
+      if(res.data.code == 200){
+        console.log(res.data,666)
+      }
+      axios.post(import.meta.env.VITE_API_URL + `/specialwork9step/work/down/load/pdf`,{id: row.workApplyId},{headers:{'Content-Type': 'application/json','Authorization': `${Cookies.get('token')}`,'uid':`${Cookies.get('uid')}`},responseType: 'blob'}).then(res=>{
+        if (res) {
+          const link = document.createElement('a')
+          let blob = new Blob([res.data],{type: 'application/pdf'})
+          link.style.display = "none";
+          link.href = URL.createObjectURL(blob); // 创建URL
+          link.setAttribute("download", row.workPermitNo + "(" + row.workTypeDesc +")作业证.pdf");
+          window.open(link)
         } else {
-          console.log('error submit!', fields)
+          ElMessage({
+            type: 'warning',
+            message: '预览失败'
+          });
         }
       })
     }
+
+    // 导出方法
+    const downLoadTicket = async (row) => {
+      // let res = await workApplyApi().postPrinting(data);
+      axios.post(import.meta.env.VITE_API_URL + `/specialwork9step/work/down/load/pdf`,{id: row.workApplyId},{headers:{'Content-Type': 'application/json','Authorization': `${Cookies.get('token')}`,'uid':`${Cookies.get('uid')}`},responseType: 'blob'}).then(res=>{
+        if (res) {
+          const link = document.createElement('a')
+          let blob = new Blob([res.data],{type: 'application/pdf'})
+          link.style.display = "none";
+          link.href = URL.createObjectURL(blob); // 创建URL
+          link.setAttribute("download", row.workPermitNo + "(" + row.workTypeDesc +")作业证.pdf");
+          document.body.appendChild(link);
+          link.click();
+          document.body.removeChild(link);
+        } else {
+          ElMessage({
+            type: 'warning',
+            message: '导出失败'
+          });
+        }
+      })
+    }
+
+    // const submitReview = async (formEl: FormInstance | undefined) => {
+    //   if (!formEl) return
+    //   await formEl.validate(async(valid, fields) => {
+    //     if (valid) {
+    //       let res = await workApplyApi().acceptWork(state.reviewForm);
+    //       if (res.data.code === '200') {
+    //         ElMessage({
+    //           type: 'success',
+    //           message: '作业验收成功',
+    //           duration: 2000
+    //         });
+    //         state.dialogReview = false;
+    //         await getMydepList()
+    //       } else {
+    //         ElMessage({
+    //           type: 'warning',
+    //           message: res.data.msg
+    //         });
+    //       }
+    //     } else {
+    //       console.log('error submit!', fields)
+    //     }
+    //   })
+    // }
 
     // 折线图
     const renderMenu = async (value: string) => {
@@ -1008,6 +1025,7 @@
       VideoPlay,
       reviewFormRef,
       videoRef,
+      recordRef,
       zyfb,
       slfx,
       zyqs,
@@ -1017,14 +1035,17 @@
       changeType2,
       changeDep3,
       toFullscreen,
-      handleReview,
+      // handleReview,
       openVideo,
-      submitReview,
+      // submitReview,
       reLoadData,
       toApply,
       searchRecord,
       clearSearch,
+      viewDetail,
       viewRecord,
+      viewTicket,
+      downLoadTicket,
       // getListByPage,
       handleSizeChange,
       handleCurrentChange,

--
Gitblit v1.9.2