This commit is contained in:
wenhua
2024-06-23 01:36:20 +08:00
11 changed files with 363 additions and 193 deletions

View File

@@ -15,7 +15,7 @@ export const getAllocationDetail = (allocationId) => {
}; };
export const getAllocationDetails = (allocationId) => { export const getAllocationDetails = (allocationId) => {
return request({ return request({
url: `/workflow/mosr/cost/allocation/usr/detail`, url: `/workflow/mosr/cost/allocation/usr/detail/${allocationId}`,
method: "get" method: "get"
}); });
}; };

View File

@@ -145,3 +145,10 @@ export const getPreProcess= () => {
method: "get" method: "get"
}); });
}; };
export const updateLedger = (data) => {
return request({
url: '/workflow/mosr/expense/ledger/replenishment',
method: "post",
data: data
});
};

View File

@@ -14,15 +14,27 @@
:label="childColumn.label" :label="childColumn.label"
:width="childColumn.prop === 'subtotal' ? 160 : 130"> :width="childColumn.prop === 'subtotal' ? 160 : 130">
<template #default="columnScope"> <template #default="columnScope">
{{ columnScope.row[column.prop][childColumn.prop] }} <template v-if="(tableData.length -1) !== columnScope.$index">
{{
columnScope.row[column.prop][childColumn.prop] ? columnScope.row[column.prop][childColumn.prop] : '/'
}}
</template>
<template v-else>
{{ columnScope.row[column.prop][childColumn.prop] }}
</template>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
<template v-else> <template v-else>
<!--分摊金额合计与分摊金额总计计算-->
<template <template
v-if="(column.prop === 'totalSeparation' || column.prop === 'totalSeparationCost') && (tableData.length- 1) !== scope.$index"> v-if="(column.prop === 'totalSeparation' || column.prop === 'totalSeparationCost') && (tableData.length -1) !== scope.$index">
{{ getTotalSeparation(scope.row, column.prop) }} {{ getTotalSeparation(scope.row, column.prop) }}
</template> </template>
<template
v-else-if="(tableData.length -1) === scope.$index && (column.prop === 'totalSeparation' || column.prop === 'totalSeparationCost')">
{{ getTotalSummary(scope.row, column.prop) }}
</template>
<template v-else> <template v-else>
{{ scope.row[column.prop] }} {{ scope.row[column.prop] }}
</template> </template>
@@ -33,12 +45,10 @@
</el-table> </el-table>
</template> </template>
<script setup lang="jsx">
import {getResearchUser, getAllocationDetailList, getAllocationDetails} from "@/api/expense-manage";
import {ElNotification} from "element-plus";
import {exportExcel} from "@/utils/export-excel";
import {toThousands} from '@/utils/changePrice.js' <script setup lang="jsx">
import {getResearchUser, getAllocationDetails} from "@/api/expense-manage";
import {exportExcel} from "@/utils/export-excel";
const route = useRoute() const route = useRoute()
const tableIns = ref() const tableIns = ref()
@@ -49,93 +59,6 @@ const tableData = ref([])
const loading = ref(false) const loading = ref(false)
const researchOptions = ref([]) const researchOptions = ref([])
// const getSummaries = (param) => {
// const {columns, data} = param
// const sums = []
// columns.forEach((column, index) => {
// if (index === 1) {
// sums[index] = '合计'
// }
// // else if (index == (columns.length - 1)) {//分摊金额总计
// // const values = data.map((item) => {
// // // Number()
// // console.log('column.property',column.property)
// // console.log('item]',item)
// // })
// // if (!values.every((value) => Number.isNaN(value))) {
// // sums[index] = `${values.reduce((prev, curr) => {
// // const value = Number(curr)
// // if (!Number.isNaN(value)) {
// // return prev + curr
// // } else {
// // return prev
// // }
// // }, 0)}`
// // sums[index] = toThousands(sums[index])
// // } else {
// // sums[index] = '-'
// // }
// // }
// // else if (index == (columns.length - 2)) {//分摊金额合计
// // const values = data.map((item) => Number(item[column.property]))
// // console.log('values',values)
// // if (!values.every((value) => Number.isNaN(value))) {
// // sums[index] = `${values.reduce((prev, curr) => {
// // const value = Number(curr)
// // if (!Number.isNaN(value)) {
// // return prev + curr
// // } else {
// // return prev
// // }
// // }, 0)}`
// // sums[index] = toThousands(sums[index])
// // } else {
// // sums[index] = '-'
// // }
// // }
// const parts = column.property.split('.');
// if (column.property.startsWith('personInfo') && parts[1] === 'separationAmount') {
// console.log('column',column,index)
// const values = data.map((item) => {
// // console.log('parts[0]',parts)
// // console.log(item[parts[0]])
// })
// // console.log('values',values)
// if (!values.every((value) => Number.isNaN(value))) {
// sums[index] = `${values.reduce((prev, curr) => {
// const value = Number(curr)
// if (!Number.isNaN(value)) {
// return prev + curr
// } else {
// return prev
// }
// }, 0)}`
// sums[index] = toThousands(sums[index])
// } else {
// sums[index] = '-'
// }
// } else {
// if (column.property.startsWith('personInfo') && parts[1] === 'subtotal') {
// const values = data.map((item) => Number(item[parts[0]].subtotal))
// if (!values.every((value) => Number.isNaN(value))) {
// sums[index] = `${values.reduce((prev, curr) => {
// const value = Number(curr)
// if (!Number.isNaN(value)) {
// return prev + curr
// } else {
// return prev
// }
// }, 0)}`
// sums[index] = toThousands(sums[index])
// } else {
// sums[index] = '-'
// }
// }
// }
// })
// return sums
// }
const objectSpanMethod = ({row, column, rowIndex, columnIndex}) => { const objectSpanMethod = ({row, column, rowIndex, columnIndex}) => {
if (columnIndex === 0) { if (columnIndex === 0) {
if (monthConcat.has(rowIndex)) { if (monthConcat.has(rowIndex)) {
@@ -151,8 +74,9 @@ const objectSpanMethod = ({row, column, rowIndex, columnIndex}) => {
} }
} else { } else {
let length = Object.keys(row).length let length = Object.keys(row).length
console.log(length)
if (length > 5) { if (length > 5) {
if (concatColumn(columnIndex, length)) { if (concatColumn(columnIndex, length, rowIndex)) {
if (rowIndex % 5 === 0) { if (rowIndex % 5 === 0) {
return { return {
rowspan: 5, rowspan: 5,
@@ -174,7 +98,7 @@ const getTotalSeparation = (row, prop) => {
let totalSeparation = 0.00 let totalSeparation = 0.00
for (let key of Object.keys(row)) { for (let key of Object.keys(row)) {
if (key.startsWith('personInfo')) { if (key.startsWith('personInfo')) {
let value = prop === 'totalSeparation' ? row[key].separationAmount : row[key].subtotal let value = prop === 'totalSeparation' ? (row[key].separationAmount ? row[key].separationAmount : 0) : row[key].subtotal
if ("/" !== value) { if ("/" !== value) {
try { try {
totalSeparation += parseFloat(value) totalSeparation += parseFloat(value)
@@ -190,7 +114,33 @@ const getTotalSeparation = (row, prop) => {
} }
} }
const concatColumn = (columnIndex, length) => {
const getTotalSummary = (row, prop) => {
let key;
if (prop === 'totalSeparation') {
key = 'separationAmount'
} else {
key = 'subtotal'
}
let result = 0
for (const rowKey of Object.keys(row)) {
if (rowKey.startsWith('personInfo')) {
let value = row[rowKey][key]
if (value && "/" !== value) {
try {
result += parseFloat(value)
} catch (e) {
}
}
}
}
return result.toFixed(2);
}
const concatColumn = (columnIndex, length, rowIndex) => {
if (rowIndex === tableData.value.length - 1) {
return false
}
let columnLength = 5 + (length - 5) * 5 let columnLength = 5 + (length - 5) * 5
if (columnIndex === 1 if (columnIndex === 1
|| columnIndex === columnLength - 1) { || columnIndex === columnLength - 1) {
@@ -205,22 +155,69 @@ const concatColumn = (columnIndex, length) => {
} }
return false return false
} }
const init = () => { const init = () => {
loading.value = true loading.value = true
getAllocationDetails().then(res => { getAllocationDetails(route.query.id).then(res => {
columnInfo.value = res.data.columns columnInfo.value = res.data.columns
let tableDataLet = res.data.tableData; let tableDataLet = res.data.tableData;
let personInfoKey = []
columnInfo.value.forEach(item => {
if (item.prop.startsWith('personInfo')) {
personInfoKey.push(item.prop)
}
})
tableData.value = [] tableData.value = []
let rowIndex = 0; let rowIndex = 0;
tableDataLet.forEach((tableDatum, index) => { let summary = {
month: "",
salaryType: '',
projectName: "合计",
totalSeparation: 10,
totalSeparationCost: 10
}
for (const key of personInfoKey) {
summary[key] = {
researchDuration: "",
separationAmount: 0,
subtotal: 0,
wagesPayable: "",
workday: "",
}
}
tableDataLet.forEach((tableDatum) => {
let rowspan = tableDatum.rows.length * 5 let rowspan = tableDatum.rows.length * 5
monthConcat.set(rowIndex, rowspan) monthConcat.set(rowIndex, rowspan)
rowIndex += rowspan rowIndex += rowspan
for (const tableDatumElement of tableDatum.rows) { for (const tableDatumElement of tableDatum.rows) {
tableData.value = tableData.value.concat(tableDatumElement) tableData.value = tableData.value.concat(tableDatumElement)
let row = tableDatumElement[0]
for (const key of personInfoKey) {
try {
if (row[key].subtotal && '/' !== row[key].subtotal) {
summary[key].subtotal += parseFloat(row[key].subtotal)
}
} catch (e) {
}
}
} }
}) })
for (const row of tableData.value) {
for (const key of personInfoKey) {
try {
if (row[key].separationAmount && '/' !== row[key].separationAmount) {
summary[key].separationAmount += parseFloat(row[key].separationAmount)
}
} catch (e) {
}
}
}
for (const key of personInfoKey) {
summary[key].subtotal = summary[key].subtotal.toFixed(2)
summary[key].separationAmount = summary[key].separationAmount.toFixed(2)
}
monthConcat.set(rowIndex, 1)
tableData.value.push(summary)
loading.value = false loading.value = false
}) })
} }
@@ -229,17 +226,6 @@ const getResearchOptions = async () => {
const res = await getResearchUser() const res = await getResearchUser()
researchOptions.value = res.data researchOptions.value = res.data
} }
const getResearchName = (id) => {
let label = ''
if (id !== undefined) {
researchOptions.value.forEach(item => {
if (item.value == id) {
label = item.label
}
})
}
return label
}
const search = (val) => { const search = (val) => {
tableConfig.params = { tableConfig.params = {
allocationId: route.query.id, allocationId: route.query.id,
@@ -257,6 +243,6 @@ const exportTable = () => {
if (!$table) { if (!$table) {
$table = $e $table = $e
} }
exportExcel($table, (5 + (Object.keys(tableData.value[0]).length - 5) * 5), "四川省国有资产经营投资管理有限责任公司科技创新项目人工成本分摊明细表",2) exportExcel($table, (5 + (Object.keys(tableData.value[0]).length - 5) * 5), "四川省国有资产经营投资管理有限责任公司科技创新项目人工成本分摊明细表", 2)
} }
</script> </script>

View File

@@ -97,7 +97,7 @@ const handleVisitedP = () => {
ElNotification({ ElNotification({
title: '提示', title: '提示',
message: res.msg, message: res.msg,
type: res.code === 1000 ? 'success' : 'error' type: 'error'
}) })
} }
accountList.value = res.data accountList.value = res.data

View File

@@ -7,8 +7,9 @@ import XLSX from "xlsx-style-vite";
* @param $table 表格html dom元素 * @param $table 表格html dom元素
* @param columnLength 列长度 * @param columnLength 列长度
* @param excelName 导出文件名称 * @param excelName 导出文件名称
* @param bigWidthIndex 更宽列的索引
*/ */
export function exportExcel($table, columnLength, excelName,bigWidth) { export function exportExcel($table, columnLength, excelName, bigWidthIndex) {
//从el-table表生成工作簿对象 //从el-table表生成工作簿对象
//使用原始的格式,保留表格中的格式如%、小数末尾的0等 //使用原始的格式,保留表格中的格式如%、小数末尾的0等
let workbook = utils.table_to_book($table, { let workbook = utils.table_to_book($table, {
@@ -16,7 +17,7 @@ export function exportExcel($table, columnLength, excelName,bigWidth) {
}); });
//列宽需要导出的表格有多少列这里的i就小于多少 //列宽需要导出的表格有多少列这里的i就小于多少
for (let i = 1; i < columnLength; i++) { for (let i = 1; i < columnLength; i++) {
if(i==bigWidth){ if (i === bigWidthIndex) {
workbook.Sheets.Sheet1["!cols"].push({wpx: 300}); workbook.Sheets.Sheet1["!cols"].push({wpx: 300});
} }
workbook.Sheets.Sheet1["!cols"].push({wpx: 100}); workbook.Sheets.Sheet1["!cols"].push({wpx: 100});

View File

@@ -38,20 +38,11 @@
</el-table-column> </el-table-column>
<el-table-column prop="researchPersonnel" label="研发人员" width="230"> <el-table-column prop="researchPersonnel" label="研发人员" width="230">
<template #default="scope"> <template #default="scope">
<el-form-item prop="time" :rules="scope.row.researchPersonnel?'1':rules.researchPersonnel"> <el-form-item prop="researchPersonnel">
{{ chooseUserInfo() }} {{ scope.row.researchPersonnelName ? scope.row.researchPersonnelName : currentReachPerson.name }}
<el-button @click="showPersonnelPicker"> <el-button @click="showPersonnelPicker(scope.row,scope.$index)">
{{ chooseUserInfo() == null ? '请选择研发人员' : '更改' }} {{ scope.row.researchPersonnelName || currentReachPerson.name ? '更改' : '请选择研发人员' }}
</el-button> </el-button>
<!-- <el-select v-model="scope.row.researchPersonnel" placeholder="请选择研发人员" clearable>-->
<!-- <el-option-->
<!-- v-for="item in researchOptions"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- >-->
<!-- </el-option>-->
<!-- </el-select>-->
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
@@ -64,7 +55,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="performance" label="绩效" width="175"> <el-table-column prop="performance" label="绩效" width="175">
<template #default="scope"> <template #default="scope">
<el-form-item prop="time" :rules="scope.row.performance?'1':rules.performance"> <el-form-item prop="time">
<el-input-number v-model="scope.row.performance" placeholder="请输入绩效" :controls="false"/> <el-input-number v-model="scope.row.performance" placeholder="请输入绩效" :controls="false"/>
</el-form-item> </el-form-item>
</template> </template>
@@ -104,18 +95,6 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="time" label="时间">-->
<!-- <template #default="scope">-->
<!-- <el-input v-model="scope.row.time" placeholder="请输入时间" clearable>-->
<!-- </el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="subtotal" label="小计">-->
<!-- <template #default="scope">-->
<!-- <el-input v-model="scope.row.subtotal" placeholder="请输入小计" clearable>-->
<!-- </el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="oper" label="操作"> <el-table-column prop="oper" label="操作">
<template #default="scope"> <template #default="scope">
<el-button type="primary" @click="handleCopy(scope.row)" link style="font-size: 18px">复制</el-button> <el-button type="primary" @click="handleCopy(scope.row)" link style="font-size: 18px">复制</el-button>
@@ -125,7 +104,8 @@
</el-table> </el-table>
</el-row> </el-row>
</el-form> </el-form>
<user-picker :multiple="true" ref="userPicker" title="请选择研发人员" v-model:value="userList" @ok="selected"/> <user-picker :multiple="false" ref="userPicker" title="请选择研发人员" v-model:value="userList" @ok="selected"
:setNullToSelectList="true"/>
<div style="width:100%;text-align: center;padding: 10px"> <div style="width:100%;text-align: center;padding: 10px">
<el-button type="primary" @click="handleAdd" link style="font-size: 18px">添加一行</el-button> <el-button type="primary" @click="handleAdd" link style="font-size: 18px">添加一行</el-button>
@@ -183,7 +163,7 @@ const rules = reactive({
shareName: [{required: true, message: '请输入分摊名称', trigger: 'blur'}], shareName: [{required: true, message: '请输入分摊名称', trigger: 'blur'}],
apportionmentMonth: [{required: true, message: '请选择月份', trigger: 'blur'}], apportionmentMonth: [{required: true, message: '请选择月份', trigger: 'blur'}],
projectId: [{required: true, message: '请选择项目名称', trigger: 'blur'}], projectId: [{required: true, message: '请选择项目名称', trigger: 'blur'}],
researchPersonnel: [{required: true, message: '请选择研发人员', trigger: 'blur'}], // researchPersonnel: [{required: true, message: '请选择研发人员', trigger: 'blur'}],
wagesPayable: [{required: true, message: '请输入应发工资', trigger: 'blur'}], wagesPayable: [{required: true, message: '请输入应发工资', trigger: 'blur'}],
performance: [{required: true, message: '请输入绩效', trigger: 'blur'}], performance: [{required: true, message: '请输入绩效', trigger: 'blur'}],
reserveFund: [{required: true, message: '请输入公积金', trigger: 'blur'}], reserveFund: [{required: true, message: '请输入公积金', trigger: 'blur'}],
@@ -220,22 +200,26 @@ const formData = ref({
}) })
const userPicker = ref() const userPicker = ref()
const form = ref() const form = ref()
const currentReachPerson = ref({})
const currentRow = ref()
const currentIndex = ref()
const nameOptions = ref([]) const nameOptions = ref([])
const researchOptions = ref([]) const researchOptions = ref([])
const showPersonnelPicker = () => { const showPersonnelPicker = (row, index) => {
currentRow.value = row
currentIndex.value = index
userPicker.value.showUserPicker() userPicker.value.showUserPicker()
} }
const chooseUserInfo = () => {
if (userList.value.length > 0) {
return userList.value.map(item => {
return item.name
}).join('')
} else {
return null
}
}
const selected = (select) => { const selected = (select) => {
userList.value = select for (const selectElement of select) {
currentReachPerson.value = selectElement
}
formData.value.tableData.forEach((item, index) => {
if (index == currentIndex.value) {
item.researchPersonnel = currentReachPerson.value.id
item.researchPersonnelName = currentReachPerson.value.name
}
})
} }
const getResearchOptions = async () => { const getResearchOptions = async () => {
const res = await getResearchUser() const res = await getResearchUser()
@@ -288,18 +272,20 @@ const handleDelete = (index) => {
formData.value.tableData.splice(index, 1) formData.value.tableData.splice(index, 1)
} }
const handleSubmit = (instance) => { const handleSubmit = (instance) => {
// if (!instance) return if (!instance) return
// instance.validate(async (valid) => { instance.validate(async (valid) => {
// if (!valid) { if (!valid) {
// return ElNotification({ return ElNotification({
// title: '提示', title: '提示',
// message: '请完善数据,再提交!', message: '请完善数据,再提交!',
// type: 'error' type: 'error'
// }) })
// } }
formData.value.tableData.forEach(item => { formData.value.tableData.forEach(item => {
item.projectName = getProjectName(item.projectId) item.projectName = getProjectName(item.projectId)
// item.researchPersonnel if (item.performance == 0) {
item.performance = null
}
}) })
let params = { let params = {
shareName: formData.value.shareName, shareName: formData.value.shareName,
@@ -307,20 +293,20 @@ const handleSubmit = (instance) => {
usrAllocations: formData.value.tableData, usrAllocations: formData.value.tableData,
deploymentId: processInstanceData.value.deploymentId, deploymentId: processInstanceData.value.deploymentId,
} }
console.log('params',params,formData.value.tableData) console.log('params', params, formData.value.tableData)
// const {code, msg} = await addAllocation(params) const {code, msg} = await addAllocation(params)
// ElNotification({ ElNotification({
// title: '提示', title: '提示',
// message: msg, message: msg,
// type: code === 1000 ? 'success' : 'error' type: code === 1000 ? 'success' : 'error'
// }) })
// if (code === 1000) { if (code === 1000) {
// tagsViewStore.delVisitedViews(router.currentRoute.value.path) tagsViewStore.delVisitedViews(router.currentRoute.value.path)
// router.push({ router.push({
// name: 'Expense/share' name: 'Expense/share'
// }) })
// } }
// }) })
} }
const handleResubmit = (instance) => { const handleResubmit = (instance) => {
if (!instance) return if (!instance) return
@@ -335,6 +321,9 @@ const handleResubmit = (instance) => {
formData.value.tableData.forEach(item => { formData.value.tableData.forEach(item => {
item.allocationId = formData.value.allocationId item.allocationId = formData.value.allocationId
item.projectName = getProjectName(item.projectId) item.projectName = getProjectName(item.projectId)
if (item.performance == 0) {
item.performance = null
}
}) })
let params = { let params = {
allocationId: formData.value.allocationId, allocationId: formData.value.allocationId,
@@ -343,7 +332,7 @@ const handleResubmit = (instance) => {
usrAllocations: formData.value.tableData, usrAllocations: formData.value.tableData,
deploymentId: processInstanceData.value.deploymentId, deploymentId: processInstanceData.value.deploymentId,
} }
// console.log('params',params) console.log('params', params)
const {code, msg} = await editAllocation(params) const {code, msg} = await editAllocation(params)
ElNotification({ ElNotification({
title: '提示', title: '提示',

View File

@@ -36,6 +36,10 @@ const schema = computed(() => {
] ]
}) })
const baseForm = ref() const baseForm = ref()
const tableIns = ref()
const btns=ref([
{name: '表格更新', key: 'update', color: '#DED0B2', auth: ''}
])
const searchConfig = reactive([ const searchConfig = reactive([
{ {
label: '时间', label: '时间',
@@ -146,17 +150,25 @@ const tableConfig = reactive({
currentRender: ({row}) => { currentRender: ({row}) => {
return <span>{toThousands(row.afterTax)}</span> return <span>{toThousands(row.afterTax)}</span>
} }
} },
], ],
api: '/workflow/mosr/expense/ledger', api: '/workflow/mosr/expense/ledger',
params: { params: {
projectId: route.query.id projectId: route.query.id
}, },
btns: [ btns: btns.value
{name: '上传费用', key: 'add', color: '#DED0B2', auth: ''}
]
}) })
const tableIns = ref() if(route.query.state!=4){
btns.value.push({name: '上传费用', key: 'add', color: '#DED0B2', auth: ''})
}
const handleUpdateTable=()=>{
router.push({
name: 'Implementation/update',
query: {
id: route.query.id
}
})
}
const getBaseInfo = async () => { const getBaseInfo = async () => {
try { try {
const {code, data} = await getBaseInfoApi(route.query.id) const {code, data} = await getBaseInfoApi(route.query.id)
@@ -171,6 +183,9 @@ const headBtnClick = (key) => {
case 'add': case 'add':
handleUploadFee() handleUploadFee()
break; break;
case 'update':
handleUpdateTable()
break;
} }
} }
const handleUploadFee = () => { const handleUploadFee = () => {

View File

@@ -344,11 +344,11 @@ const handleEdit = (row) => {
}) })
} }
const handleStandingBook = (row) => { const handleStandingBook = (row) => {
localStorage.setItem('projectName', row.projectName)
router.push({ router.push({
name: 'Implementation/account', name: 'Implementation/account',
query: { query: {
id: row.projectId id: row.projectId,
state:row.state
} }
}) })
} }

View File

@@ -0,0 +1,166 @@
<template>
<baseTitle title="表格更新"></baseTitle>
<el-form :model="tableForm" ref="form">
<el-row>
<el-col :span="24">
<el-form-item prop="projectName" label="项目名称">
<span>{{ tableForm.projectName }}</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="projectChargePerson" label="项目负责人">
{{currentPerson.name}}
<el-button @click="showPersonnelPicker">
{{ currentPerson.name ? '更改' : '请选择研发人员' }}
</el-button>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="startTime" label="项目开始时间">
<el-date-picker
v-model="tableForm.startTime"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="选择项目开始时间"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="endTime" label="项目预计持续时间" :title="!tableForm.startTime?'请先选择项目开始时间!':''">
<el-date-picker
v-model="tableForm.endTime"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="选择项目预计持续时间"
:disabled="!tableForm.startTime"
:disabled-date="disabledDate"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="projectDevelopmentWay" label="项目开展方式" style="width: 100%">
<el-input v-model="tableForm.projectDevelopmentWay" placeholder="请输入项目开展方式" clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="projectBudgetDescription" label="项目预算" style="width: 100%">
<el-input v-model="tableForm.projectBudgetDescription" placeholder="请输入项目预算" clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item prop="projectCompletionRate" label="项目总体完成率">
<el-input v-model="tableForm.projectCompletionRate" placeholder="请输入项目总体完成率" clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="16" :offset="1">
<el-form-item prop="completeWork" label="已完成工作量">
<el-input v-model="tableForm.completeWork" placeholder="请输入已完成工作量" clearable>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<user-picker :multiple="false" ref="userPicker" title="请选择项目负责人" @ok="selected"/>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit">提交</el-button>
<el-button @click="handleBack">返回</el-button>
</div>
</template>
<script setup lang="jsx">
import {ElMessage, ElNotification} from "element-plus";
import {updateLedger} from "@/api/project-manage";
import {getBaseInfoApi} from "@/components/steps/api";
import {ref} from "vue";
import UserPicker from "@/views/workflow/process/common/UserPicker.vue";
import {useTagsView} from '@/stores/tagsview.js'
const tagsViewStore = useTagsView()
const baseForm = ref()
const route = useRoute()
const router = useRouter()
const currentPerson = ref({})
const tableForm = ref({
projectName: '',
completeWork: '',
endTime: '',
projectBudgetDescription: '',
projectChargePerson: '',
projectCompletionRate: '',
projectDevelopmentWay: '',
projectId: '',
startTime: '',
})
const userPicker = ref()
const selected = (select) => {
for (const selectElement of select) {
currentPerson.value = selectElement
tableForm.value.projectChargePerson=selectElement.id
}
}
const disabledDate = (time) => {
return time.getTime() < new Date(tableForm.value.startTime).getTime();
}
const handleBack = () => {
history.back()
}
const showPersonnelPicker = () => {
userPicker.value.showUserPicker()
}
const handleSubmit = async () => {
console.log('tableForm', tableForm.value)
let params={
...tableForm.value,
projectId:route.query.id
}
// tableForm.value={
// "projectName": "测试上报622",
// "completeWork": "已完成系统性需求调研、核心业务流程梳理以及研发计划的制定。",
// "endTime": "2024-06-26",
// "projectBudgetDescription": "本项目总研发投入预算为xx万元其中支付给外部专业机构的合作研发费用预计为xx万元。示例",
// "projectChargePerson": 161,
// "projectCompletionRate": "40",
// "projectDevelopmentWay": "项目采用合作研发模式,由省国经公司牵头,联合本领域外部专业研究机构作为合作方共同开展。",
// "projectId": "",
// "startTime": "2024-06-11"
// }
updateLedger(params).then(res => {
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Implementation/account',
query: {
id: route.query.id
}
})
} else {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}
const getBaseInfo = async () => {
const {code, data} = await getBaseInfoApi(route.query.id)
tableForm.value.projectName = data.projectName
}
getBaseInfo()
const init = () => {
}
</script>
<style scoped>
</style>

View File

@@ -56,8 +56,8 @@
<el-table-column prop="afterTax" label="税后余额(元)" width="220"> <el-table-column prop="afterTax" label="税后余额(元)" width="220">
<template #default="scope"> <template #default="scope">
<el-form-item prop="afterTax" :rules="scope.row.afterTax?'1':rules.afterTax"> <el-form-item prop="afterTax" :rules="scope.row.afterTax?'1':rules.afterTax">
<el-input v-model="scope.row.afterTax" placeholder="请输入税后余额" clearable> <el-input-number v-model="scope.row.afterTax" placeholder="请输入税后余额" :controls="false">
</el-input> </el-input-number>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
@@ -127,7 +127,7 @@ const tableForm = reactive({
projectCost: '', projectCost: '',
researchStage: '', researchStage: '',
digest: '', digest: '',
afterTax: '' afterTax: null
} }
] ]
}) })
@@ -148,7 +148,7 @@ const handleAdd = () => {
projectCost: '', projectCost: '',
researchStage: '', researchStage: '',
digest: '', digest: '',
afterTax: '' afterTax: null
} }
tableForm.tableData.push(row) tableForm.tableData.push(row)
} }

View File

@@ -88,6 +88,11 @@ const props = defineProps({
showCheckbox: { //是否显示左侧选择框 showCheckbox: { //是否显示左侧选择框
default: true, default: true,
type: Boolean type: Boolean
},
//打开弹窗时是否重置选中数据
setNullToSelectList: {
default: false,
type: Boolean
} }
}); });
const radio = ref(0); const radio = ref(0);
@@ -151,7 +156,6 @@ const getList = (flag) => {
} }
} }
getMosrDept(params).then(res => { getMosrDept(params).then(res => {
console.log('selectItem.type', selectItem.type)
// if (res.data) { // if (res.data) {
if (selectItem.type === -1) { if (selectItem.type === -1) {
dataList.value = res.data; dataList.value = res.data;
@@ -189,7 +193,9 @@ const showUserPicker = () => {
value: "0" value: "0"
}; };
dataList.value = []; dataList.value = [];
// selectList.value = [] if(props.setNullToSelectList){
selectList.value = []
}
chooseId.value = 0; chooseId.value = 0;
radio.value = 0; radio.value = 0;
visible.value = true; visible.value = true;