优化结算页面

This commit is contained in:
BianLzhaoMin 2024-07-30 11:07:51 +08:00
parent a5635d173a
commit a591d01bb3
2 changed files with 91 additions and 44 deletions

View File

@ -19,6 +19,7 @@
:totalPrice="settleTotalPrice_01" :totalPrice="settleTotalPrice_01"
:tableData="settleTableData_01" :tableData="settleTableData_01"
@handelSaveSuccess="handelSaveSuccess" @handelSaveSuccess="handelSaveSuccess"
v-if="settleTableData_01.length > 0"
/> />
<!-- 03承担方 --> <!-- 03承担方 -->
<FinishTable <FinishTable
@ -29,6 +30,7 @@
:totalPrice="settleTotalPrice_03" :totalPrice="settleTotalPrice_03"
:tableData="settleTableData_03" :tableData="settleTableData_03"
@handelSaveSuccess="handelSaveSuccess" @handelSaveSuccess="handelSaveSuccess"
v-if="settleTableData_03.length > 0"
/> />
<FinishTable <FinishTable
:tableColumns="repairTableColumns" :tableColumns="repairTableColumns"

View File

@ -6,6 +6,7 @@
调整天数批量设置 调整天数批量设置
<el-input <el-input
v-model="batchNum" v-model="batchNum"
ref="batchNumRef"
type="number" type="number"
clearable clearable
style="width: 120px" style="width: 120px"
@ -38,6 +39,7 @@
size="mini" size="mini"
type="success" type="success"
v-if="!isEdit && isCostBear" v-if="!isEdit && isCostBear"
@click="submitSell"
>确认结算</el-button >确认结算</el-button
> >
<el-button <el-button
@ -60,30 +62,36 @@
:width="t.t_slot === 't_date' ? '180' : ''" :width="t.t_slot === 't_date' ? '180' : ''"
show-overflow-tooltip show-overflow-tooltip
> >
<template slot-scope="{ row }"> <template slot-scope="scope">
<template v-if="t.t_slot && isEdit"> <template v-if="t.t_slot && isEdit">
<!-- 调整天数时的输入框 -->
<el-input <el-input
v-if="t.t_slot === 't_ipt'" v-if="t.t_slot === 't_ipt'"
v-model.number="row[t.t_prop]" v-model.number="scope.row[t.t_prop]"
style="width: 80px" style="width: 80px"
type="number" type="number"
:ref="`editIpt_${scope.$index}`"
:class="{
active: activeIndex === scope.$index,
}"
/> />
<template v-if="t.t_slot === 't_date'"> <!-- 调整终结日期的日期选择组件 -->
<el-date-picker <el-date-picker
v-model="row[t.t_prop]" v-model="scope.row[t.t_prop]"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
v-if="!row[t.t_prop]" v-if="t.t_slot === 't_date'"
value-format="yyyy-M-d"
:ref="`editTime_${scope.$index}`"
:class="{
active: activeIndexTime === scope.$index,
}"
style="width: 150px" style="width: 150px"
/> />
<template v-else>
{{ row[t.t_prop] }}
</template>
</template>
</template> </template>
<template v-else> <template v-else>
{{ row[t.t_prop] }} {{ scope.row[t.t_prop] }}
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
@ -134,15 +142,20 @@ export default {
data() { data() {
return { return {
isEdit: false, isEdit: false, //
batchNum: 0, batchNum: '', //
// tableDataList: [], activeIndex: '', // index class
activeIndexTime: '', // index class
} }
}, },
methods: { methods: {
// /** 编辑按钮 */
handleEdit() { handleEdit() {
this.isEdit = !this.isEdit this.isEdit = !this.isEdit
if (!this.isEdit) {
this.batchNum = ''
this.$emit('handelSaveSuccess')
}
}, },
/** 调整天数 */ /** 调整天数 */
iptChange(val) { iptChange(val) {
@ -161,40 +174,67 @@ export default {
const regex = /^-?\d+$/ const regex = /^-?\d+$/
let isNum = false let isNum = false
try { try {
this.tableData.map((e) => { // 1.
this.tableData.map((e, v) => {
console.log(e.endTime, '选择的时间')
if (!e.endTime) {
this.$message.error('请选择终结日期!')
this.activeIndexTime = v
this.$refs[`editTime_${v}`][0].focus()
isNum = true
throw new Error()
}
if (!regex.test(e.trimDay)) { if (!regex.test(e.trimDay)) {
this.$message.error('请输入正整数和负整数或0')
this.activeIndex = v
this.$refs[`editIpt_${v}`][0].focus()
isNum = true isNum = true
throw new Error() throw new Error()
} }
}) })
} catch {}
if (isNum) { if (isNum) return
this.$message.error('请输入正整数和负整数或0')
return
}
// 2.
let saveParams = [] let saveParams = []
this.tableData.map((e) => { this.tableData.map((e) => {
const item = { const item = {
agreementId: e.agreementId, agreementId: e.agreementId, // id
typeId: e.typeId, typeId: e.typeId, // id
trimDay: e.trimDay, trimDay: e.trimDay, //
maId: e.maId || '', maId: e.maId || '',
} }
saveParams.push(item) saveParams.push(item)
}) })
console.log(saveParams, '保存时的参数---') // 3.
const res = await editSaveApi(saveParams) const res = await editSaveApi(saveParams)
if (res.code == 200) { if (res.code == 200) {
this.$message.success('保存成功!') this.$message.success('保存成功!')
this.activeIndex = ''
this.activeIndexTime = ''
this.batchNum = ''
this.isEdit = false this.isEdit = false
this.$emit('handelSaveSuccess') this.$emit('handelSaveSuccess')
} }
} catch {}
},
/** 单个列表确认结算 */
submitSell() {
this.$confirm(
'确定后则会生成财务报表,数据将不可修改,请确认检查无误',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
).then(() => {
console.log('确定,后续走确定逻辑')
})
}, },
}, },
} }
@ -254,4 +294,9 @@ export default {
line-height: 36px; line-height: 36px;
} }
} }
::v-deep .active {
.el-input__inner:focus {
border-color: #f56c6c;
}
}
</style> </style>