| | |
| | | <el-table v-loading="loading" :data="dataList" :border="true" ref="tableRef" :height="tableHeight" |
| | | style="width: 100%;"> |
| | | <el-table-column label="序号" width="80" align="center" type="index"></el-table-column> |
| | | <el-table-column label="项目编码" width="180" align="center" prop="projectCode"></el-table-column> |
| | | <el-table-column label="申请时间" prop="createTime" align="center" :show-overflow-tooltip="true" width="180"/> |
| | | <el-table-column label="出差事由" prop="projectName" align="center" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="部门" prop="deptName" align="center" width="180"/> |
| | |
| | | <el-input v-model.trim="search.queryParams.projectName" placeholder="请输入项目名称"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="部门名称"> |
| | | <el-input v-model.trim="search.queryParams.deptName" placeholder="请输入部门名称"></el-input> |
| | | <!-- <el-input v-model.trim="search.queryParams.deptName" placeholder="请输入部门名称"></el-input>--> |
| | | <el-cascader |
| | | style="width: 100%" |
| | | clearable |
| | | v-model.trim="search.queryParams.deptId" |
| | | :show-all-levels="false" |
| | | placeholder="请选择部门" |
| | | :options="deptList" |
| | | :props="{ value: 'deptId',label: 'deptName',emitPath: false,checkStrictly: true}"></el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="项目编码"> |
| | | <el-input v-model.trim="search.queryParams.projectCode" placeholder="请输入项目编码"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | <template #footer> |
| | | <div style="flex: auto"> |
| | | <el-button type="primary" @click="searchClick">查询</el-button> |
| | | <el-button type="warning" @click="reset">重置</el-button> |
| | | <el-button @click="confirmClick">取消</el-button> |
| | | |
| | | <div style="display: flex;align-items: center;justify-content: space-between"> |
| | | <vue3-json-excel |
| | | :json-data="expertList" |
| | | :fields="fields" |
| | | name="专家汇总表.xlsx" |
| | | > |
| | | <el-button type="primary" plain @click="handleExport">导出专家汇总表</el-button> |
| | | </vue3-json-excel> |
| | | <div> |
| | | <el-button type="primary" @click="searchClick">查询</el-button> |
| | | <el-button type="warning" @click="reset">重置</el-button> |
| | | <el-button @click="confirmClick">取消</el-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-drawer> |
| | |
| | | // import {delProject, getProjectList, getProjectStatistics} from "@/api/projectManage/project"; |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import Cookies from "js-cookie" |
| | | import {delProject, exportData, getProjectList, getProjectNum} from "@/api/projectManage"; |
| | | import {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"; |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const router = useRouter(); |
| | | |
| | |
| | | projectName: '', |
| | | projectDateStart: '', |
| | | projectDateEnd: '', |
| | | step: null |
| | | |
| | | step: null, |
| | | deptId: null, |
| | | projectCode: '' |
| | | }, |
| | | num: { |
| | | approval: 0, |
| | |
| | | staging: 0, |
| | | total: 0 |
| | | } |
| | | }); |
| | | |
| | | const expertList = ref([]) |
| | | // 导出表格 |
| | | const fields = ref({ |
| | | '姓名':'expertName', |
| | | '处室':'deptName', |
| | | '专家费': 'expertFee', |
| | | '交通费': 'travelExpenses', |
| | | '住宿费':'accommodationFee', |
| | | '申请时间': 'createTime', |
| | | '事由': 'projectName', |
| | | '发现重大隐患':'majorDangers', |
| | | '发现一般隐患': 'generalHazards' |
| | | |
| | | }); |
| | | |
| | | const searchTime = ref([]); |
| | |
| | | const tableRef = ref(null); |
| | | const tableHeight = ref(0); |
| | | const dataList = ref([]); |
| | | const deptList = ref([]) |
| | | const total = ref(0); |
| | | const isAgency = ref(false); |
| | | onMounted(() => { |
| | | Cookies.remove('projectId') |
| | | Cookies.remove('end') |
| | | Cookies.remove('btn') |
| | | getList(); |
| | | getStatistics(); |
| | | getList() |
| | | getDeptList() |
| | | getStatistics() |
| | | exportEData() |
| | | // getArea(); |
| | | // getBusinessList(); |
| | | // getRiskList(); |
| | |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | |
| | | const exportEData = async () => { |
| | | const {pageSize,pageNum,step,...data} = search.queryParams |
| | | const res = await exportExpertData(data); |
| | | if (res.code == 200) { |
| | | |
| | | if(res.data && res.data.length > 0){ |
| | | expertList.value = res.data |
| | | }else { |
| | | expertList.value = [] |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | const handleExport = () => { |
| | | if(expertList.value && expertList.value.length == 0){ |
| | | ElMessage.warning('暂无数据导出') |
| | | } |
| | | } |
| | | function getDeptList() { |
| | | listDept({ |
| | | deptName: undefined, |
| | | status: undefined |
| | | }).then(response => { |
| | | deptList.value = proxy.handleTree(response.data, "deptId",'parentId','children'); |
| | | }); |
| | | console.log(deptList.value,999) |
| | | } |
| | | |
| | | const getStatistics = async () => { |
| | | const res = await getProjectNum(); |
| | | if (res.code == 200) { |
| | |
| | | const res = await exportData({projectId: row.id}) |
| | | if (res.code == 200) { |
| | | // 定义标题 |
| | | const title = [["自治区应急管理厅外聘专家劳务费发放表"]] |
| | | const title = [[`自治区应急管理厅外聘专家劳务费发放表(项目编码${row.projectCode})`]] |
| | | // 固定一行:填报处室和单位 |
| | | const fixedHeader = [ |
| | | ["填报处室:" + row.deptName, "", "", "", "", "单位:元", "", "", "", "",""] |
| | | ["填报处室:" + row.deptName, "", "", "", "", "单位:元", "", "", "", "","", "",""] |
| | | ] |
| | | 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.openBank,item.bankCard] |
| | | 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] |
| | | }) |
| | | console.log(data,'data') |
| | | // 定义表头 |
| | | const headers = [ |
| | | ["序号", "姓名", "工作单位", "职称", "身份证号", "计费标准", "计费时长", "专家费", "应缴税费", "开户银行", "卡号"] |
| | | ["序号", "姓名", "工作单位", "职称", "身份证号", "计费标准", "计费时长", "专家费", "应缴税费", "交通费", "住宿费","开户银行", "卡号"] |
| | | ] |
| | | // 固定一行:经办人和负责人 |
| | | const footer = [ |
| | |
| | | const dataRowCount = data.length; |
| | | // 合并单元格的范围 |
| | | ws['!merges'] = [ |
| | | { s: { r: 0, c: 0 }, e: { r: 0, c: 10 } }, // 合并标题:第1行 0列到12列 |
| | | { 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: 10 } }, // 合并单位:第2行 第5列到12列 |
| | | { s: { r: 1, c: 5 }, e: { r: 1, c: 12 } }, // 合并单位:第2行 第5列到12列 |
| | | { 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列 |
| | | ] |
| | |
| | | // 设置数据区(包括填报处室、单位、数据行和最后一行)为左对齐 |
| | | const totalRows = 3 + dataRowCount + 1; // 标题、固定行和数据行的总数 |
| | | for (let r = 3; r <= totalRows; r++) { // 遍历每一行 |
| | | for (let c = 0; c < 11; c++) { // 遍历每一列 |
| | | for (let c = 0; c < 13; c++) { // 遍历每一列 |
| | | const cellRef = `${String.fromCharCode(65 + c)}${r}`; |
| | | if (!ws[cellRef]) ws[cellRef] = {}; // 确保单元格存在 |
| | | ws[cellRef].s = { |
| | |
| | | } |
| | | // 设置最后一行(经办人、负责人)左对齐 |
| | | const lastRowStart = 3 + dataRowCount; |
| | | for (let c = 0; c < 11; c++) { |
| | | for (let c = 0; c < 13; c++) { |
| | | const cellRef = `${String.fromCharCode(65 + c)}${lastRowStart + 1}`; |
| | | console.log(cellRef,'ref') |
| | | if (!ws[cellRef]) ws[cellRef] = {}; // 确保单元格存在 |
| | |
| | | } |
| | | getList(); |
| | | getStatistics(); |
| | | exportEData() |
| | | showDrawer.value = false; |
| | | } |
| | | const reset = () => { |
| | |
| | | projectName: '', |
| | | projectDateStart: '', |
| | | projectDateEnd: '', |
| | | step: null |
| | | step: null, |
| | | deptId: null, |
| | | projectCode: '' |
| | | } |
| | | chooseType.value = ''; |
| | | getList(); |