新增一键确定
This commit is contained in:
		| @ -32,6 +32,15 @@ | ||||
|           <el-form-item> | ||||
|             <el-button type="primary" @click="handleExport()" v-hasPermi="['bidding:biddingLimitList:export']">导出excel</el-button> | ||||
|           </el-form-item> | ||||
|           <el-form-item> | ||||
|             <el-button | ||||
|               type="primary" | ||||
|               :disabled="versionObj.status != 'draft'" | ||||
|               @click="handleSave(null, 'all')" | ||||
|               v-hasPermi="['tender:billofquantitiesLimitList:edit']" | ||||
|               >一键确定</el-button | ||||
|             > | ||||
|           </el-form-item> | ||||
|           <el-form-item> | ||||
|             <el-button | ||||
|               type="primary" | ||||
| @ -66,7 +75,12 @@ | ||||
|             <el-input-number | ||||
|               :disabled="versionObj.status != 'draft'" | ||||
|               :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" | ||||
| @ -85,7 +99,7 @@ | ||||
|               type="primary" | ||||
|               size="small" | ||||
|               :disabled="versionObj.status != 'draft'" | ||||
|               @click="handleSave(scope.row)" | ||||
|               @click="handleSave(scope.row, 'single')" | ||||
|               v-if="scope.row.quantity && scope.row.quantity != 0" | ||||
|               v-hasPermi="['bidding:biddingLimitList:edit']" | ||||
|               >确定</el-button | ||||
| @ -187,31 +201,53 @@ const getTableData = async () => { | ||||
|     } | ||||
|   } | ||||
| }; | ||||
| //修改单价 | ||||
| const handleSave = (row: any) => { | ||||
| const modifyPrice = new Map(); | ||||
|  | ||||
| const changePrice = (row: any) => { | ||||
|   modifyPrice.set(row.id, row); | ||||
|   // if (!row.unitPrice) { | ||||
|   //   modifyPrice.delete(row.id); | ||||
|   // } | ||||
| }; | ||||
| //修改单价  biddingLimitListUpdate | ||||
| const handleSave = (row?: any, type?: any) => { | ||||
|   try { | ||||
|     if (!row.unitPrice) { | ||||
|       ElMessage({ | ||||
|         message: '请输入单价', | ||||
|         type: 'warning' | ||||
|     if (type == 'single') { | ||||
|       loading.value = true; | ||||
|       const list = [{ ...row }]; | ||||
|       biddingLimitListUpdate(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 }); | ||||
|       }); | ||||
|       biddingLimitListUpdate(list).then((res) => { | ||||
|         if (res.code == 200) { | ||||
|           ElMessage({ | ||||
|             message: '修改成功', | ||||
|             type: 'success' | ||||
|           }); | ||||
|           getTableData(); | ||||
|         } | ||||
|       }); | ||||
|       return; | ||||
|     } | ||||
|     loading.value = true; | ||||
|     biddingLimitListUpdate(row).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>(); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user