收款完成不允许删除
This commit is contained in:
parent
2ab727e6e2
commit
0289dac11c
@ -66,7 +66,7 @@
|
||||
<el-col>
|
||||
<el-card class="hl-incard">
|
||||
<el-col>
|
||||
<el-button type="primary" size="large" @click="onAddItem">新增</el-button>
|
||||
<el-button type="primary" size="large" @click="onAddItem" v-if="formData.cgTypee==1">新增</el-button>
|
||||
</el-col>
|
||||
<el-form ref="subFormRef" :model="formData.orderYsDetails" label-width="0">
|
||||
<el-table :data="formData.orderYsDetails" class="hl-table">
|
||||
@ -110,7 +110,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="120" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" size="small" @click.prevent="onDeleteItem(scope.$index)" v-if="!scope.row.id">
|
||||
<el-button link type="danger" size="small" @click.prevent="onDeleteItem(scope.$index)" v-if="formData.cgTypee==1">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@ -182,7 +182,6 @@ const open = async (type: string, id?: number) => {
|
||||
date.setDate(o.paymentDate[2]);
|
||||
o.paymentDate=date
|
||||
})
|
||||
console.log(formData.value.orderYsDetails)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
@ -204,7 +203,14 @@ const onAddItem = () => {
|
||||
}
|
||||
/** 删除子项操作 */
|
||||
const onDeleteItem = async (index) => {
|
||||
formData.value.orderYsDetails.splice(index, 1)
|
||||
if (index!=formData.value.orderYsDetails.length-1){
|
||||
message.error(`请从最后一条数据开始删除`)
|
||||
return false
|
||||
}
|
||||
let deletedItems = formData.value.orderYsDetails.splice(index, 1)
|
||||
let id = deletedItems[0].id;
|
||||
if (id) await OrderYsDetailApi.deleteOrderYsDetail(id)
|
||||
formData.value.cgYishou=formData.value.orderYsDetails.reduce((sum, item) => sum + Number(item.cgYishou), 0);
|
||||
}
|
||||
const sum = async () => {
|
||||
formData.value.cgYishou=formData.value.orderYsDetails.reduce((sum, item) => sum + Number(item.cgYishou), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user