马宇豪
2024-01-26 c694cffc8541d921e5256d33e14e3237454de950
src/views/newSpecialWorkSystem/workTicket/wdsq/index.vue
@@ -6,7 +6,7 @@
                    <el-row class="homeCard">
                      <div class="basic-line" style="display:flex;white-space:nowrap;line-height: 40px">
                        <span>时间筛选:</span>
                        <el-date-picker v-model="timeRange" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" @change="giveTime()" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" />
                        <el-date-picker v-model="timeRange" value-format="YYYY-MM-DD" type="daterange" @change="giveTime" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" />
                      </div>
                      <div class="basic-line" style="display:flex;white-space:nowrap;line-height: 40px">
                        <span>负责人:</span>
@@ -44,7 +44,7 @@
                            <el-row class="cardTop">
                                <el-col :span="12" class="mainCardBtn">
                                    <el-button type="primary" :icon="Plus" size="default" @click="toApply()">申请</el-button>
                                    <el-button type="primary" :icon="Download" size="default" @click="exportSheet()">导出当日记录</el-button>
                                    <el-button type="primary" :icon="Download" size="default" @click="exportSheet()">导出记录</el-button>
                                </el-col>
                                <el-button type="primary" :icon="Refresh" size="default" @click="reLoadData()" />
                            </el-row>
@@ -93,7 +93,7 @@
                                        <el-button v-else link type="primary" size="small" @click="openReport('查看', scope.row)">查看研判报告</el-button>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" label="操作" align="center" width="300">
                                <el-table-column fixed="right" label="操作" align="center" width="150">
                                    <template #default="scope">
                                        <span v-if="scope.row.status == -1">已废止</span>
                                        <el-button v-if="scope.row.status == 0 || scope.row.status == 1" link type="danger" size="small" :icon="Delete" @click="abortRecordBtn(scope.row)">作废</el-button>
@@ -293,7 +293,7 @@
        const giveTime = () => {
          if (state.timeRange && state.timeRange !== null) {
            state.searPara.startTime = state.timeRange[0];
            state.searPara.endTime = state.timeRange[1];
            state.searPara.endTime = state.timeRange[1]
          } else {
            state.searPara.startTime = '';
            state.searPara.endTime = '';
@@ -382,6 +382,7 @@
        // 关键词查询记录
        const searchRecord = async () => {
          state.pageIndex1 = 1
          getListByPage();
        };
        // 重置搜索
@@ -485,13 +486,17 @@
        // 导出方法
        const exportSheet = async () => {
            // let res = await workApplyApi().postPrinting(data);
            axios.post(import.meta.env.VITE_API_URL + `/specialwork9step/work/export/excel`,{},{headers:{'Content-Type': 'application/json','Authorization': `${Cookies.get('token')}`,'uid':`${Cookies.get('uid')}`},responseType: 'blob'}).then(res=>{
            axios.post(import.meta.env.VITE_API_URL + `/specialwork9step/work/export/excel`,{startTime: state.searPara.startTime,endTime: state.searPara.endTime,secondDepId: state.searPara.secondDepId},{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/excel'})
                    link.style.display = "none";
                    link.href = URL.createObjectURL(blob); // 创建URL
                    link.setAttribute("download", "作业申报记录.xlsx");
                    if(state.searPara.startTime !== '' && state.searPara.endTime !==''){
                      link.setAttribute("download", state.searPara.startTime + '—' + state.searPara.endTime +"作业申报记录.xlsx")
                    }else{
                      link.setAttribute("download", "作业申报记录.xlsx")
                    }
                    document.body.appendChild(link);
                    link.click();
                    document.body.removeChild(link);