From 17bc12d7414dedab9d8eb60794603e61e8cce01e Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: 星期二, 25 十月 2022 17:20:35 +0800
Subject: [PATCH] '更新'

---
 src/views/specialWorkManage/workTicket/myJobApply/index.vue |   47 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/src/views/specialWorkManage/workTicket/myJobApply/index.vue b/src/views/specialWorkManage/workTicket/myJobApply/index.vue
index 38e6013..392a136 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,9 @@
                     </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 style="margin-bottom: 40px">
                         <el-form-item label="申请作业人">
-                            <el-input v-model="approveInfo.operators" readonly type="textarea" />
+                            <el-input v-model="approveInfo.operatorUnames" readonly type="textarea" />
                         </el-form-item>
                     </el-form>
                     <div style="display: flex; flex-direction: column-reverse">
@@ -198,6 +199,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: {
@@ -294,6 +297,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({
@@ -341,9 +372,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',
@@ -382,7 +413,7 @@
             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){
+            if(!this.details.workDetail.otherSpecialWork || this.details.workDetail.otherSpecialWork == ''){
                 this.details.workDetail.otherSpecialWork = ''
             }
             else {

--
Gitblit v1.9.2