From c819024e241b9f7c54cc3786373ad0d2998f2190 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期五, 05 五月 2023 08:55:46 +0800
Subject: [PATCH] 修改

---
 src/views/specialWorkManage/workTicket/myJobApply/index.vue |   79 +++++++++++++++++++++++++++++----------
 1 files changed, 58 insertions(+), 21 deletions(-)

diff --git a/src/views/specialWorkManage/workTicket/myJobApply/index.vue b/src/views/specialWorkManage/workTicket/myJobApply/index.vue
index 5b3379c..244da37 100644
--- a/src/views/specialWorkManage/workTicket/myJobApply/index.vue
+++ b/src/views/specialWorkManage/workTicket/myJobApply/index.vue
@@ -32,8 +32,8 @@
                             <el-table ref="multipleTableRef" :data="applyData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }">
                                 <el-table-column property="workPermitNo" label="作业申请单号" width="180" />
                                 <el-table-column property="applyUname" label="申请人" />
-                                <el-table-column property="depName" label="部门名称" />
-                                <el-table-column property="operators" label="作业人" />
+                                <el-table-column property="operatorCompanys" label="施工单位" />
+                                <el-table-column property="operatorUnames" label="作业人" />
                                 <el-table-column property="workTypeDesc" label="作业类型" />
                                 <el-table-column property="workLevelDesc" label="作业等级" />
                                 <el-table-column property="applyTime" label="申请时间" width="180" />
@@ -47,6 +47,7 @@
                                         <el-button link type="text"   @click="viewRecord(scope.row)">查看</el-button>
                                         <el-button link type="text"   @click="viewStatus(scope.row)">进度</el-button>
                                         <el-button link type="text"  @click="deleteRecordBtn(scope.row)">取消</el-button>
+                                        <el-button :disabled="scope.row.status == 7 ? false : true" link type="text" @click="downLoadRecord(scope.row)">导出作业票</el-button>
                                     </template>
                                 </el-table-column>
                             </el-table>
@@ -74,9 +75,12 @@
                     </template>
                 </el-dialog>
                 <el-dialog :visible.sync="dialogStatus" title="作业申请进度" width="60%">
-                    <el-form v-if="approveInfo.operators.length > 0" style="margin-bottom: 40px">
-                        <el-form-item label="申请作业人">
-                            <el-input v-model="approveInfo.operators" readonly type="textarea" />
+                    <el-form style="margin-bottom: 40px">
+                        <el-form-item label="作业人" v-if="approveInfo.operatorUnames">
+                            <el-input v-model="approveInfo.operatorUnames" readonly type="textarea" />
+                        </el-form-item>
+                        <el-form-item label="作业人" v-else>
+                            <el-input placeholder="无" readonly type="textarea" />
                         </el-form-item>
                     </el-form>
                     <div style="display: flex; flex-direction: column-reverse">
@@ -88,7 +92,10 @@
                                         审批结果:<span>{{ item.approvalResultDesc }}</span>
                                     </div>
                                     <div class="text">
-                                        审批类型:<span>{{ item.typeDesc }}</span>
+                                        审批层级:<span>{{ item.typeDesc }}</span>
+                                    </div>
+                                    <div class="text" v-if="item.auditTypeDesc">
+                                        审批类型:<span>{{ item.auditTypeDesc }}</span>
                                     </div>
                                     <div class="text" v-show="item.startApprovalTime != null">
                                         开始时间:<span>{{ item.startApprovalTime }}</span>
@@ -100,7 +107,7 @@
                                             ><span>{{ i.resultDesc }}</span>
                                         </div>
                                     </div>
-                                    <div class="approveItem">
+                                    <div class="approveItem" v-if="item.stepItems && item.stepItems.length>0">
                                         <div class="item-tit">
                                             <span>审批项目</span>
 <!--                                            <span>类型</span>-->
@@ -109,7 +116,7 @@
                                         <div class="item-cont" v-for="i in item.stepItems">
                                             <span>{{ i.itemName }}</span>
 <!--                                            <span>{{ i.typeDesc }}</span>-->
-                                            <div v-if="i.measure !== null">
+                                            <div v-if="i.measure">
                                                 <div>
                                                     <span>作业类型:</span><span>{{ i.measure.workTypeDesc }}</span>
                                                 </div>
@@ -117,7 +124,7 @@
                                                     <span>措施内容:</span><span>{{ i.measure.context }}</span>
                                                 </div>
                                             </div>
-                                            <div v-if="i.stand !== null">
+                                            <div v-if="i.stand">
                                                 <div>
                                                     <span>标题名称:</span><span>{{ i.stand.title }}</span>
                                                 </div>
@@ -195,6 +202,8 @@
 import power from './components/powerLog'
 import plate from './components/plateLog'
 import {workApplyApi} from "../../../../api/workApply";
+import Cookies from 'js-cookie';
+import axios from 'axios';
 export default{
     name: 'myApply',
     components: {
@@ -291,6 +300,34 @@
             this.getListByPage();
         },
 
+        // 导出方法
+        downLoadRecord(row) {
+            if(row.status == 7){
+                axios.post(process.env.BASE_API + `/work/apply/printing`,{applyWorkId: row.workApplyId},{headers:{'Content-Type': 'application/json','Authorization': `${Cookies.get('token')}`},responseType: 'blob'}).then(res=>{
+                    if (res) {
+                        const link = document.createElement('a')
+                        let blob = new Blob([res.data],{type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'})
+                        link.style.display = "none";
+                        link.href = URL.createObjectURL(blob); // 创建URL
+                        link.setAttribute("download", row.workTypeDesc + row.workPermitNo + "作业证.docx");
+                        document.body.appendChild(link);
+                        link.click();
+                        document.body.removeChild(link);
+                    } else {
+                        this.$message({
+                            type: 'warning',
+                            message: res.data.msg
+                        });
+                    }
+                })
+            }else{
+                this.$message({
+                    type: 'warning',
+                    message: '该作业申请未完成审批流程,不可导出'
+                });
+            }
+        },
+
         // 填写表单
         toApply() {
             this.$router.push({
@@ -338,9 +375,9 @@
             let res = await workApplyApi().getStatus(data);
             if (res.data.code === '200') {
                 this.approveInfo = JSON.parse(JSON.stringify(res.data.data));
-                this.approveInfo.operators = this.approveInfo.operators.map(item => {
-                    return item.operatorUname
-                }).join('、')
+                // this.approveInfo.operators = this.approveInfo.operators.map(item => {
+                //     return item.operatorUname
+                // }).join('、')
             } else {
                 this.$message({
                     type: 'warning',
@@ -379,15 +416,15 @@
             this.dialogType = row.workType
             this.details = JSON.parse(JSON.stringify(row));
             this.details.operators = this.details.operators.join('、')
-            if(this.details.workDetail.otherSpecialWork == '' || !this.details.workDetail.otherSpecialWork){
-                this.details.workDetail.otherSpecialWork = ''
-            }
-            else {
-                const a = this.details.workDetail.otherSpecialWork
-                this.details.workDetail.otherSpecialWork = a.split(',').map((item) => {
-                    return this.workType.find((i) => i.id === Number(item)).name;
-                }).join('、');
-            }
+            // if(!this.details.workDetail.otherSpecialWork || this.details.workDetail.otherSpecialWork == ''){
+            //     this.details.workDetail.otherSpecialWork = ''
+            // }
+            // else {
+            //     const a = this.details.workDetail.otherSpecialWork
+            //     this.details.workDetail.otherSpecialWork = a.split(',').map((item) => {
+            //         return this.workType.find((i) => i.id === Number(item)).name;
+            //     }).join('、');
+            // }
             if(this.details.workDetail.involvedDepIds == '' || !this.details.workDetail.involvedDepIds){
                 this.details.workDetail.involvedDepIds = ''
             }

--
Gitblit v1.9.2