feat : 年度计划生成功能及分摊汇总导出功能

This commit is contained in:
2024-07-06 02:21:26 +08:00
parent fce1708f5c
commit 8180c248ac
11 changed files with 471 additions and 38 deletions

View File

@@ -1,5 +1,5 @@
<template>
<el-button color="#DED0B2" style="float: right;margin: 0 10px 10px 0" @click="exportTable">导出</el-button>
<el-button color="#DED0B2" style="float: right;margin: 0 10px 10px 0" @click="exportExcelHandler">导出</el-button>
<el-table ref="table" :data="tableData" style="width: 100%;height: 479px" :show-summary="true" border
:summary-method="getSummaries" v-loading="loading" :header-cell-style="{background:'#f5f7fa'}">
<el-table-column type="index" label="序号" align="center" width="60"/>
@@ -34,8 +34,8 @@
</template>
<script setup>
import {exportExcel} from "@/utils/export-excel";
import {getAllocationSummaryDetails} from "@/api/expense-manage";
import {shareExportExcel} from "@/api/expense-manage";
const tableData = ref([{
id: '12987122',
@@ -80,13 +80,28 @@ const getSummaries = (param) => {
})
return sums
}
const exportTable = () => {
const $e = table.value.$el
let $table = $e.querySelector('.el-table__fixed')
if (!$table) {
$table = $e
}
exportExcel($table, (5 + (Object.keys(tableData.value[0]).length - 5) * 5), "四川省国有资产经营投资管理有限责任公司科技创新项目费用分摊表", 2)
// const exportTable = () => {
// const $e = table.value.$el
// let $table = $e.querySelector('.el-table__fixed')
// if (!$table) {
// $table = $e
// }
// exportExcel($table, (5 + (Object.keys(tableData.value[0]).length - 5) * 5), "四川省国有资产经营投资管理有限责任公司科技创新项目费用分摊表", 2)
// }
const exportExcelHandler = () => {
shareExportExcel(route.query.id).then(res => {
console.log(res)
let reg = /filename=([^&]+)/;
let contentDisposition = decodeURI(res.headers['content-disposition'])
let result = reg.exec(contentDisposition)
let fileName = result[1]
fileName = fileName.replace(/\"/g, '')
const blob = new Blob([res.data])
let a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = fileName
a.click()
})
}
const init = () => {
loading.value = true

View File

@@ -148,7 +148,7 @@
:file-list-show="fileListShow"/>
</el-col>
<el-col :span="24">
<div v-if="data.taskId">
<div v-if="data.taskId||data.state==='5'">
<baseTitle title="审核意见"></baseTitle>
<el-form-item prop="_value">
<el-input
@@ -180,6 +180,11 @@
</div>
</div>
</el-form>
<div class="oper-page-btn" v-if="data.state==='5'">
<el-button type="danger" @click="handleRejectPlan">驳回年度计划</el-button>
<el-button color="#DED0B2" @click="handleAgreePlan">通过年度计划</el-button>
</div>
</div>
</template>
@@ -193,6 +198,8 @@ import {getFundOption} from "@/api/special-fund";
import {useCacheStore} from '@/stores/cache.js'
import {getSubCompOpt} from "@/api/user/user";
import FileComponent from "./FileComponent.vue";
import {ElNotification} from "element-plus";
import {approvePlan} from "@/api/project-demand/summary";
const emit = defineEmits(['update:value'])
const tagsViewStore = useTagsView()
@@ -225,6 +232,7 @@ const props = defineProps({
})
const changeDiagram = ref(false)
const localFormData = ref({})
const route = useRoute()
const router = useRouter()
const fundOption = ref([])
const companyOption = ref([])
@@ -240,6 +248,46 @@ const _value = computed({
emit("update:value", val);
}
})
const handleRejectPlan = async () => {
// const values = form.value.getValues()
console.log('route',route.query.projectId)
if (!_value.value) {
ElNotification({
title: '提示',
message: '请填写审核意见',
type: 'warning'
})
return
}
const params = {
auditOpinion:_value.value,
projectId:parseInt(route.query.projectId),
state:false
}
console.log('params', params)
const res = await approvePlan(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
}
const handleAgreePlan = async () => {
const params = {
auditOpinion:_value.value,
projectId:parseInt(route.query.projectId),
state:true
}
console.log('params', params)
const res = await approvePlan(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
}
const filterDict = (data, value) => {
if (data === undefined || value === undefined) return;
let label = ''