feat : 台账导入

This commit is contained in:
2024-07-18 22:56:08 +08:00
parent 9d5c393ebe
commit 5deae5d846
4 changed files with 138 additions and 34 deletions

View File

@@ -5,19 +5,25 @@
<el-row>
<el-col :span="8">
<el-form-item prop="requirementName" label="征集名称" label-width="122">
<span>{{basicData.requirementName}}</span>
<span>{{ basicData.requirementName }}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item prop="projectName" label="项目名称" label-width="130">
<span>{{basicData.projectName}}</span>
<span>{{ basicData.projectName }}</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
<fvForm :schema="schema" @getInstance="(e)=>baseForm = e"></fvForm>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick" @selectionChange="selectionChange">
<div style="display: flex">
<el-button color="#DED0B2" @click="exportExcelHandler">导出</el-button>
<import-excel v-if="buttonShow" @success="importTheExpenseLedger"/>
<el-button color="#DED0B2" v-if="buttonShow" @click="handleUploadFee">上传费用</el-button>
<el-button color="#DED0B2" v-if="buttonShow" @click="handleUpdateTable">表格更新</el-button>
</div>
<fvTable ref="tableIns" :tableConfig="tableConfig" @selectionChange="selectionChange">
<template #empty>
<el-empty description="暂无数据"/>
</template>
@@ -30,11 +36,12 @@
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import {toThousands} from '@/utils/changePrice.js'
import {getBaseInfoApi} from "@/components/steps/api";
import {searchUpdateLedgerData,exportExcel} from "@/api/project-manage";
import {searchUpdateLedgerData, exportExcel} from "@/api/project-manage";
// import ImportExcel from "../../../components/ImportExcel";
const router = useRouter()
const route = useRoute()
const basicData=ref({})
const basicData = ref({})
const tableData = ref({})
const formDataArray = ref([
{
@@ -78,7 +85,7 @@ const formDataArray = ref([
colProps: {
span: 6
},
component: ()=><span>{tableData.value.projectCompletionRate}%</span>
component: () => <span>{tableData.value.projectCompletionRate}%</span>
},
{
label: '已完成工作量',
@@ -88,8 +95,9 @@ const formDataArray = ref([
}
}
])
const buttonShow = ref(false)
const schema = computed(() => {
return formDataArray.value
return formDataArray.value
})
const baseForm = ref()
const tableIns = ref()
@@ -102,7 +110,7 @@ const searchConfig = reactive([
prop: 'time',
component: 'el-date-picker',
props: {
type:'month',
type: 'month',
placeholder: '请选择月份',
clearable: true,
format: 'YYYY-MM',
@@ -218,12 +226,12 @@ const tableConfig = reactive({
params: {
projectId: route.query.id
},
btns: btns.value
// btns: btns.value
})
// const exportIds=ref([])
const selectionChange=(data)=>{
console.log('data',data)
console.log(' data.forEach(item=>item.id)', data.forEach(item=>item.id))
// const exportIds=ref([])
const selectionChange = (data) => {
console.log('data', data)
console.log(' data.forEach(item=>item.id)', data.forEach(item => item.id))
}
const handleUpdateTable = () => {
router.push({
@@ -236,17 +244,22 @@ const handleUpdateTable = () => {
const getBaseInfo = async () => {
try {
const {code, data} = await getBaseInfoApi(route.query.id)
basicData.value=data
basicData.value = data
} catch {
}
}
const init = async () => {
buttonShow.value = false
const {code, msg, data} = await searchUpdateLedgerData(route.query.id)
if (code===1000) {
if (code === 1000) {
tableData.value = data
if(!data.view){
btns.value.push({name: '上传费用', key: 'add', color: '#DED0B2', auth: ''},{name: '表格更新', key: 'update', color: '#DED0B2', auth: ''},)
}
nextTick(() => {
buttonShow.value = !data.view
})
// if (!data.view) {
// btns.value.push({name: '上传费用', key: 'add', color: '#DED0B2', auth: ''},
// {name: '表格更新', key: 'update', color: '#DED0B2', auth: ''})
// }
baseForm.value.setValues(data)
}
// if (code !== 1000) {
@@ -259,18 +272,8 @@ const init = async () => {
}
getBaseInfo()
init()
const headBtnClick = (key) => {
switch (key) {
case 'add':
handleUploadFee()
break;
case 'update':
handleUpdateTable()
break;
case 'export':
exportExcelHandler()
break;
}
const importTheExpenseLedger = () => {
tableIns.value.refresh()
}
const handleUploadFee = () => {
router.push({
@@ -301,13 +304,13 @@ const search = (val) => {
tableConfig.params = {...val, projectId: route.query.id}
tableIns.value.refresh()
}
onActivated(()=>{
onActivated(() => {
init()
})
</script>
<style scoped>
:deep(.el-table--fit){
min-height: 400px!important;
:deep(.el-table--fit) {
min-height: 400px !important;
}
</style>