fix: 优化移动端项目管理功能

This commit is contained in:
dj
2025-04-06 22:38:14 +08:00
parent e8a5b4e788
commit a307697028
7 changed files with 145 additions and 31 deletions

View File

@@ -2,7 +2,7 @@
<!-- <fvSearchForm :searchConfig="searchConfig" @search="search" style="margin-left: 16px"></fvSearchForm>-->
<!-- <el-button color="#DED0B2" style="float: left;margin: 0 10px 10px 0" @click="exportTable">导出</el-button>-->
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick" style="margin-top: 15px">
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick" style="margin-top: 15px" @selectionChange="selectionChange">
<template #empty>
<el-empty description="暂无数据"/>
</template>
@@ -10,11 +10,10 @@
</template>
<script setup lang="jsx">
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import {toThousands} from '@/utils/changePrice.js'
import { getSubCompOpt } from '@/api/user/user.js';
import {reactive, ref} from "vue";
import {shareExportExcel} from "@/api/expense-manage";
import {shareDetailExport, shareExportExcel} from "@/api/expense-manage";
import {ElMessage} from "element-plus";
const router = useRouter()
const route = useRoute()
const searchConfig = reactive([
@@ -54,8 +53,13 @@ const searchConfig = reactive([
// },
])
const tableIns = ref()
const selectData = ref([])
const tableConfig = reactive({
columns: [
{
type: 'selection',
prop: 'selection',
},
// {
// prop: 'name',
// type: 'index',
@@ -100,7 +104,16 @@ const tableConfig = reactive({
{
prop: 'personnelNature',
label: '人员性质',
align: 'center'
align: 'center',
width: 120,
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if (row.personnelNature&&row.personnelNature !== null&&row.personnelNature!==undefined) {
return (<Tag dictType={'nature_of_personnel'} value={row.personnelNature}/>)
} else {
return '--'
}
}
},
{
prop: 'researchDuration',
@@ -126,23 +139,15 @@ const tableConfig = reactive({
api: '/workflow/mosr/cost/share',
params: {},
btns: [
{name: '添加分摊', key: 'add', color: '#DED0B2'}
{name: '添加分摊', key: 'add', color: '#DED0B2'},
{name: '导出', key: 'export', color: '#DED0B2'}
],
export:{
open :false,
}
})
// const exportTable = () => {
// shareExportExcel().then(res => {
// console.log(res)
// let fileName = `科技研发项目工时及成本分摊汇总表.xlsx`
// const blob = new Blob([res.data])
// let a = document.createElement('a')
// a.href = URL.createObjectURL(blob)
// a.download = fileName
// a.click()
// })
// }
const search = (val) => {
tableConfig.params = {...val}
tableIns.value.refresh()
@@ -152,8 +157,32 @@ const headBtnClick = (key) => {
case 'add':
handleAdd()
break;
case 'export':
exportTable()
break;
}
}
const selectionChange = (data) => {
console.log('data', data)
selectData.value=data
}
const exportTable = () => {
console.log('selectData',selectData.value)
if (selectData.value.length === 0) {
ElMessage.warning('请选择要导出的费用分摊')
return
}
shareDetailExport(selectData.value[0]).then(res => {
console.log(res)
let fileName = `科技研发项目工时及成本分摊汇总表.xlsx`
const blob = new Blob([res.data])
let a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = fileName
a.click()
})
}
const handleAdd = () => {
router.push({
name: 'Sharedetail/add',
@@ -172,7 +201,7 @@ const init = async () => {
:deep(.el-table__header) {
.is-leaf:first-child {
.cell {
margin-left: -25px !important;
//margin-left: -25px !important;
}
}
}
@@ -180,7 +209,7 @@ const init = async () => {
:deep(.el-table__body) {
.el-table__cell:first-child {
.cell {
margin-left: -13px !important;
//margin-left: -13px !important;
}
}
}