Admin
2022-10-11 8c84adf2d3cd83d0c5f8ee77d3fb615ae9a02ba7
src/views/specialWorkSystem/workTicket/myJobApply/index.vue
@@ -43,11 +43,12 @@
                                        <el-tag :type="scope.row.status==2?'success':(scope.row.status==8||scope.row.status==9)?'warning':'danger'">{{ scope.row.statusDesc }}</el-tag>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" label="操作" align="center" width="250">
                                <el-table-column fixed="right" label="操作" align="center" width="300">
                                    <template #default="scope">
                                        <el-button link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看</el-button>
                                        <el-button link type="success" size="small" :icon="Finished" @click="viewStatus(scope.row)">进度</el-button>
                                        <el-button link type="warning" size="small" :icon="Delete" @click="deleteRecordBtn(scope.row)">取消</el-button>
                                        <el-button :disabled="scope.row.status == 7 ? false : true" link type="primary" size="small" :icon="Download" @click="downLoadBtn(scope.row)">导出作业票</el-button>
                                    </template>
                                </el-table-column>
                            </el-table>
@@ -86,10 +87,13 @@
                            <div class="stepCard">
                                <el-card class="box-card" shadow="always">
                                    <div class="text">
                                        审批结果:<span>{{ item.approvalResultDesc }}</span>
                                        审批结果:<span class="bold-text">{{ item.approvalResultDesc }}</span>
                                    </div>
                                    <div class="text">
                                        审批类型:<span>{{ item.typeDesc }}</span>
                                        审批类型:<span class="bold-text">{{ item.typeDesc }}</span>
                                    </div>
                                    <div class="text" v-if="item.auditTypeDesc">
                                        审批类型:<span class="bold-text">{{ item.auditTypeDesc }}</span>
                                    </div>
                                    <div class="text" v-show="item.startApprovalTime != null">
                                        开始时间:<span>{{ item.startApprovalTime }}</span>
@@ -128,7 +132,7 @@
                                            </div>
                                        </div>
                                    </div>
                                    <div class="text" v-show="item.expFinishApprovalTime != null">
                                    <div class="text" v-show="item.expFinishApprovalTime && item.expFinishApprovalTime != null">
                                        期望结束时间:<span>{{ item.expFinishApprovalTime }}</span>
                                    </div>
                                    <div class="text" v-show="item.finishApprovalTime != null">
@@ -139,13 +143,22 @@
                        </div>
                    </div>
                </el-dialog>
                <el-dialog v-model="deleteDialog" title="提示" width="30%" center @close="indexClear">
                <el-dialog v-model="deleteDialog" title="提示" width="30%" center>
                    <span>您确定要取消该条申请吗?</span>
                    <template #footer>
                        <span class="dialog-footer">
                            <el-button @click="deleteDialog = false" size="default">取消</el-button>
                            <el-button type="primary" @click="conFirmDelete" size="default">确认</el-button>
                        </span>
                    </template>
                </el-dialog>
                <el-dialog v-model="downLoadDialog" title="提示" width="30%" center>
                    <span>您确定要导出该条记录吗?</span>
                    <template #footer>
                                <span class="dialog-footer">
                                    <el-button @click="downLoadDialog = false" size="default">取消</el-button>
                                    <el-button type="primary" @click="conFirmDownLoad" size="default">确认</el-button>
                                </span>
                    </template>
                </el-dialog>
<!--            </el-tab-pane>-->
@@ -193,12 +206,14 @@
import { useUserInfo } from '/@/stores/userInfo';
import { Session } from '/@/utils/storage';
import { useRouter } from 'vue-router';
import { Edit, View, Plus, Delete, Refresh, Search, Finished } from '@element-plus/icons-vue';
import { Edit, View, Plus, Delete, Refresh, Search, Finished, Download } from '@element-plus/icons-vue';
import { ElTable } from 'element-plus';
import { FormInstance, FormRules, ElMessage } from 'element-plus';
import { workApplyApi } from '/@/api/specialWorkSystem/workApply';
import type { TabsPaneContext } from 'element-plus';
import {teamManageApi} from "/@/api/systemManage/basicDateManage/personShiftManage/teamManage";
import Cookies from 'js-cookie';
import axios from 'axios';
// 定义接口来定义对象的类型
interface stateType {
@@ -210,10 +225,13 @@
    dialogDetails: boolean;
    dialogStatus: boolean;
    deleteDialog: boolean;
    downLoadDialog: boolean;
    pageIndex1: number;
    pageSize1: number;
    chosenIndex: null | number;
    deleteId: null | number;
    downLoadId: null | number;
    downLoadName: string;
    searchWord: string;
    totalSize1: number;
    activeName: string;
@@ -269,10 +287,13 @@
            dialogDetails: false,
            dialogStatus: false,
            deleteDialog: false,
            downLoadDialog: false,
            addRecord: {},
            details: {},
            statusInfo: {},
            deleteId: null,
            downLoadId: null,
            downLoadName: '',
            deleteArr: [],
            workType: [
                { id: 1, name: '动火作业' },
@@ -299,12 +320,11 @@
        // 填写表单
        const toApply = () => {
            router.push({
                path: 'workApply'
                path: 'apply'
            });
        };
        const handleClick = (tab: TabsPaneContext, event: Event) => {
            console.log(tab, event);
        };
        // 获取部门列表
@@ -332,12 +352,13 @@
            }
        };
        // 分页获取工作时间组列表
        // 分页获取
        const getListByPage = async () => {
            const data = { pageSize: state.pageSize1, pageIndex: state.pageIndex1, searchParams: { workType: state.searchWord } };
            let res = await workApplyApi().getApplyListPage(data);
            if (res.data.code === '200') {
                state.applyData = JSON.parse(JSON.stringify(res.data.data));
                console.log(state.applyData,'applyData')
                state.applyData = state.applyData.map((item) => {
                    if (item.operators == null || item.operators == []) {
                        item.operators = [];
@@ -401,7 +422,6 @@
            if (res.data.code === '200') {
                state.approveInfo = JSON.parse(JSON.stringify(res.data.data));
                state.approveInfo.operators = Array.from(state.approveInfo.operators, ({ operatorUname }) => operatorUname);
                console.log(state.approveInfo, 'steps');
            } else {
                ElMessage({
                    type: 'warning',
@@ -421,7 +441,7 @@
            if (res.data.code === '200') {
                ElMessage({
                    type: 'success',
                    message: res.data.msg
                    message: '删除成功!'
                });
                getListByPage();
            } else {
@@ -435,6 +455,41 @@
        const conFirmDelete = () => {
            deleteRecord({ workApplyId: state.deleteId });
            state.deleteDialog = false;
        };
        // 导出图表
        const downLoadBtn = (row:any) =>{
            state.downLoadId = row.workApplyId;
            state.downLoadName = row.workTypeDesc + row.workPermitNo
            state.downLoadDialog = true;
        }
        // 导出方法
        const downLoadRecord = async (data: any) => {
            // let res = await workApplyApi().postPrinting(data);
            axios.post(import.meta.env.VITE_API_URL + `/work/apply/printing`,data,{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/vnd.openxmlformats-officedocument.wordprocessingml.document'})
                    link.style.display = "none";
                    link.href = URL.createObjectURL(blob); // 创建URL
                    link.setAttribute("download", state.downLoadName + "作业证.docx");
                    document.body.appendChild(link);
                    link.click();
                    document.body.removeChild(link);
                } else {
                    ElMessage({
                        type: 'warning',
                        message: res.data.msg
                    });
                }
            })
        };
        const conFirmDownLoad = () => {
            downLoadRecord({ applyWorkId: state.downLoadId });
            state.downLoadDialog = false;
        };
        const handleSizeChange1 = (val: number) => {
@@ -454,7 +509,6 @@
                state.details.workDetail.otherSpecialWork=[]
            }
            else {
                console.log(state.details.workDetail.otherSpecialWork,'split')
                const a = state.details.workDetail.otherSpecialWork
                state.details.workDetail.otherSpecialWork = a.split(',').map((item) => {
                    return state.workType.find((i: { id: number }) => i.id === Number(item))?.name;
@@ -507,6 +561,7 @@
            Refresh,
            Plus,
            Finished,
            Download,
            reLoadData,
            toApply,
            handleClick,
@@ -516,7 +571,9 @@
            viewRecord,
            viewStatus,
            deleteRecordBtn,
            downLoadBtn,
            conFirmDelete,
            conFirmDownLoad,
            getListByPage,
            handleSizeChange1,
            handleCurrentChange1,
@@ -637,10 +694,13 @@
                    padding-left: 10px;
                    span {
                        font-weight: bolder;
                        color: #409eff;
                    }
                    .bold-text{
                        font-weight: bolder;
                    }
                    &:last-of-type {
                        margin-bottom: 0;
                    }