新增一键确定

This commit is contained in:
ljx
2025-08-27 11:17:30 +08:00
parent f637e65635
commit ab68bbcd40
7 changed files with 164 additions and 69 deletions

View File

@ -35,6 +35,15 @@
<el-form-item>
<el-button type="primary" @click="handleExport()" v-hasPermi="['tender:billofquantitiesLimitList:export']">导出excel</el-button>
</el-form-item>
<el-form-item>
<el-button
type="primary"
:disabled="reviewStatus != 'draft'"
@click="handleSave(null, 'all')"
v-hasPermi="['tender:billofquantitiesLimitList:edit']"
>一键确定</el-button
>
</el-form-item>
<el-form-item>
<el-button type="primary" v-if="reviewStatus == 'draft'" @click="clickApprovalSheet()">审核</el-button>
</el-form-item>
@ -65,6 +74,7 @@
@change="
(val) => {
scope.row.unitPrice = val;
changePrice(scope.row);
}
"
:precision="2"
@ -87,7 +97,7 @@
type="primary"
size="small"
:disabled="reviewStatus != 'draft'"
@click="handleSave(scope.row)"
@click="handleSave(scope.row, 'single')"
v-if="scope.row.quantity && scope.row.quantity != 0"
v-hasPermi="['tender:billofquantitiesLimitList:edit']"
>确定</el-button
@ -220,31 +230,50 @@ const getTableData = async () => {
loading.value = false;
}
};
const modifyPrice = new Map();
const changePrice = (row: any) => {
modifyPrice.set(row.id, row);
};
//修改单价
const handleSave = (row: any) => {
const handleSave = (row?: any, type?: any) => {
try {
if (!row.unitPrice) {
ElMessage({
message: '请输入单价',
type: 'warning'
if (type == 'single') {
loading.value = true;
const list = [{ ...row, type: '1' }];
updatePrice(list).then((res) => {
if (res.code == 200) {
ElMessage({
message: '修改成功',
type: 'success'
});
getTableData();
}
});
}
if (type == 'all') {
loading.value = true;
const list = [];
modifyPrice.forEach((item) => {
list.push({ ...item, type: '1' });
});
updatePrice(list).then((res) => {
if (res.code == 200) {
ElMessage({
message: '修改成功',
type: 'success'
});
getTableData();
}
});
return;
}
loading.value = true;
updatePrice({ ...row, type: '1' }).then((res) => {
if (res.code == 200) {
ElMessage({
message: '修改成功',
type: 'success'
});
getTableData();
}
});
} catch (error) {
ElMessage({
message: '修改失败',
type: 'error'
});
} finally {
loading.value = false;
}
};
const tableRef = ref<any>();