新增一键确定

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

@ -15,12 +15,22 @@
<el-option v-for="item in sheets" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="toggleExpandAll(true)">一键展开</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="toggleExpandAll(false)">一键收起</el-button>
</el-form-item>
<el-form-item>
<el-button
type="primary"
:disabled="versionsData.status != 'draft'"
@click="handleSave(null, 'all')"
v-hasPermi="['tender:tenderPlanLimitList:edit']"
>一键确定</el-button
>
</el-form-item>
<el-form-item>
<el-upload
ref="uploadRef"
@ -63,7 +73,12 @@
<template #default="scope">
<el-input-number
:model-value="scope.row.unitPrice"
@change="(val) => (scope.row.unitPrice = val)"
@change="
(val) => {
scope.row.unitPrice = val;
changePrice(scope.row);
}
"
:precision="2"
:step="0.1"
:controls="false"
@ -82,7 +97,7 @@
<el-button
type="primary"
size="small"
@click="handleSave(scope.row)"
@click="handleSave(scope.row, 'single')"
v-if="scope.row.quantity && scope.row.quantity != 0"
v-hasPermi="['tender:tenderPlanLimitList:edit']"
:disabled="versionsData.status != 'draft'"
@ -257,29 +272,51 @@ const handleExport = () => {
`招标一览表${queryForm.value.sheet}.xlsx`
);
};
//确认修改
const handleSave = (row: any) => {
const modifyPrice = new Map();
const changePrice = (row: any) => {
modifyPrice.set(row.id, row);
// if (!row.unitPrice) {
// modifyPrice.delete(row.id);
// }
};
//修改单价
const handleSave = (row?: any, type?: any) => {
try {
if (!row.unitPrice) {
ElMessage({
message: '请输入单价',
type: 'warning'
if (type == 'single') {
loading.value = true;
const list = [{ ...row, type: activeTab.value }];
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: activeTab.value });
});
updatePrice(list).then((res) => {
if (res.code == 200) {
ElMessage({
message: '修改成功',
type: 'success'
});
getTableData();
}
});
return;
}
loading.value = true;
updatePrice(row).then((res) => {
if (res.code == 200) {
ElMessage({
message: '修改成功',
type: 'success'
});
getTableData();
}
});
} catch (error) {
console.log(error);
loading.value = false;
ElMessage({
message: '修改失败',
type: 'error'
});
} finally {
loading.value = false;
}