应急管理厅专家管理系统
zhouwx
15 hours ago b6740c65ba8485fc281f0cf38028497b92fbdc94
src/views/safetyReview/projectManage/index.vue
@@ -78,8 +78,9 @@
            }}</span>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="180">
      <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200">
        <template #default="scope">
          <el-button link type="danger" v-if="isAdmin && scope.row.state === 4 && scope.row.evaluationState" @click="toBack(scope.row)">退回</el-button>
          <el-button link type="primary" @click="toProcess('view',scope.row)">查看</el-button>
          <el-button link type="primary" v-if="scope.row.step !== 4" @click="toProcess('edit',scope.row)">编辑
          </el-button>
@@ -163,7 +164,7 @@
// import {delProject, getProjectList, getProjectStatistics} from "@/api/projectManage/project";
import {ElMessage, ElMessageBox} from "element-plus";
import Cookies from "js-cookie"
import {delProject, exportData, exportExpertData, getProjectList, getProjectNum} from "@/api/projectManage";
import {backInfo, delProject, exportData, exportExpertData, getProjectList, getProjectNum} from "@/api/projectManage";
// import * as XLSX from 'xlsx';
import XLSX from 'xlsx-js-style';
import {listDept} from "@/api/system/dept";
@@ -205,7 +206,7 @@
const fields = ref({
  '姓名':'expertName',
  '处室':'deptName',
  '专家费': 'expertFee',
  '发票金额': 'expertFee',
  '交通费': 'travelExpenses',
  '住宿费':'accommodationFee',
  '申请时间': 'createTime',
@@ -240,6 +241,8 @@
const dataList = ref([]);
const deptList = ref([])
const total = ref(0);
const isAdmin = ref(false);
const userInfo = ref()
const isAgency = ref(false);
onMounted(() => {
  Cookies.remove('projectId')
@@ -259,6 +262,8 @@
  };
  // const userInfo = JSON.parse(Cookies.get('userInfo'))
  // isAgency.value = userInfo.identity === 1;
  userInfo.value = JSON.parse(Cookies.get('userInfo'))
  isAdmin.value = userInfo.value.admin
});
const chooseType = ref('');
@@ -351,6 +356,28 @@
        }
      })
}
const toBack = (val) => {
  ElMessageBox.confirm(
      '确定退回此条数据?',
      '提示',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
      .then(async () => {
        const res = await backInfo({id:val.id})
        if (res.code == 200) {
          ElMessage.success('数据退回成功')
          await getList()
          await getStatistics()
        } else {
          ElMessage.warning(res.msg)
        }
      })
}
const confirmClick = () => {
  reset()
  showDrawer.value = false;
@@ -369,17 +396,17 @@
    const title = [[`自治区应急管理厅外聘专家劳务费发放表(项目编码${row.projectCode})`]]
    // 固定一行:填报处室和单位
    const fixedHeader = [
      ["填报处室:" + row.deptName, "", "", "", "", "单位:元", "", "", "", "制表日期:"+row.updateTime,"", "",""]
      ["填报处室:" + row.deptName, "", "", "", "", "单位:元", "", "", "","", "制表日期:"+row.updateTime,"", "","",""]
    ]
    if(res.data && res.data[0] && Array.isArray(res.data[0].projectExpertExportResps) && res.data[0].projectExpertExportResps.length>0){
      let mainData = res.data[0].projectExpertExportResps
      const data = mainData.map((item,index)=>{
        return [index+1,item.name,item.companyName,item.title,item.idCard,item.freightBasis,item.billingDuration,item.taxExpertFee,item.incomeTaxPayable,item.travelExpenses,item.accommodationFee,item.openBank,item.bankCard]
        return [index+1,item.name,item.companyName,item.title,item.idCard,item.freightBasis,item.billingDuration,item.taxExpertFee,item.incomeTaxPayable,(item.taxExpertFee-item.incomeTaxPayable).toFixed(2),item.travelExpenses,item.accommodationFee,item.openBank,item.bankCard]
      })
      console.log(data,'data')
      // 定义表头
      const headers = [
        ["序号", "姓名", "工作单位", "职称", "身份证号", "计费标准", "计费时长", "专家费", "应缴税费", "交通费", "住宿费","开户银行", "卡号"]
        ["序号", "姓名", "工作单位", "职称", "身份证号", "计费标准", "计费时长", "发票金额", "应缴税费","发放金额", "交通费", "住宿费","开户银行", "卡号", "疆内/疆外"]
      ]
      // 固定一行:经办人和负责人
      const footer = [
@@ -387,7 +414,9 @@
          return accumulator + currentValue[7]
        }, 0).toFixed(2)}`,`合计:${data.reduce((accumulator, currentValue) => {
          return accumulator + currentValue[8]
        }, 0).toFixed(2)}`,"",""]
        }, 0).toFixed(2)}`,`合计:${data.reduce((accumulator, currentValue) => {
          return accumulator + Number(currentValue[9])
        }, 0).toFixed(2)}`,"",""],
      ]
      // 创建工作表
      const ws = XLSX.utils.aoa_to_sheet([
@@ -403,8 +432,8 @@
      ws['!merges'] = [
        { s: { r: 0, c: 0 }, e: { r: 0, c: 12 } },  // 合并标题:第1行 0列到12列
        { s: { r: 1, c: 0 }, e: { r: 1, c: 4 } },  // 合并填报处室:第2行 第0列到4列
        { s: { r: 1, c: 5 }, e: { r: 1, c: 8 } },  // 合并单位:第2行 第5列到8列
        { s: { r: 1, c: 9 }, e: { r: 1, c: 12 } },  // 合并单位:第2行 第5列到8列
        { s: { r: 1, c: 5 }, e: { r: 1, c: 9 } },  // 合并单位:第2行 第5列到8列
        { s: { r: 1, c: 10 }, e: { r: 1, c: 13 } },  // 合并单位:第2行 第5列到8列
        { s: { r: 3 + dataRowCount, c: 0 }, e: { r: 3 + dataRowCount, c: 4 } },  // 合并经办人:最后一行的第0列到4列
        { s: { r: 3 + dataRowCount, c: 5 }, e: { r: 3 + dataRowCount, c: 6} },  // 合并负责人:最后一行的第5列到+6列
      ]
@@ -424,7 +453,7 @@
      // 设置数据区(包括填报处室、单位、数据行和最后一行)为左对齐
      const totalRows = 3 + dataRowCount + 1; // 标题、固定行和数据行的总数
      for (let r = 3; r <= totalRows; r++) {  // 遍历每一行
        for (let c = 0; c < 13; c++) {  // 遍历每一列
        for (let c = 0; c < 14; c++) {  // 遍历每一列
          const cellRef = `${String.fromCharCode(65 + c)}${r}`;
          if (!ws[cellRef]) ws[cellRef] = {};  // 确保单元格存在
          ws[cellRef].s = {
@@ -444,11 +473,11 @@
      }
      // 设置最后一行(经办人、负责人)左对齐
      const lastRowStart = 3 + dataRowCount;
      for (let c = 0; c < 13; c++) {
      for (let c = 0; c < 14; c++) {
        const cellRef = `${String.fromCharCode(65 + c)}${lastRowStart + 1}`;
        console.log(cellRef,'ref')
        if (!ws[cellRef]) ws[cellRef] = {};  // 确保单元格存在
        if(cellRef == 'H'+ (4 + dataRowCount) || cellRef == 'I'+ (4 + dataRowCount)){
        if(cellRef == 'H'+ (4 + dataRowCount) || cellRef == 'I'+ (4 + dataRowCount) || cellRef == 'J'+ (4 + dataRowCount)){
          ws[cellRef].s = {
            alignment: { horizontal: 'center', vertical: 'center' } // 设置居中对齐
          }
@@ -461,7 +490,7 @@
      // 设置列宽,计算每列的最大宽度
      const MIN_COL_WIDTH = 60;
      const colWidths = [];
      for (let c = 0; c < 13; c++) {
      for (let c = 0; c < 14; c++) {
        let maxLength = 0;
        // 计算每列最大单元格内容长度
        for (let r = 0; r < totalRows; r++) {