| | |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | :disabled="!isApproved(scope.row.status)" |
| | | :disabled="isApproving(scope.row.status)" |
| | | @click="openForm('edit', scope.row)">编辑</el-button> |
| | | <el-button |
| | | link |
| | | type="danger" |
| | | size="small" |
| | | :disabled="!isApproved(scope.row.status)" |
| | | :disabled="isApproving(scope.row.status)" |
| | | @click="handleDeleteSingle(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | |
| | | // 打开弹框 |
| | | const openForm = async (type, row) => { |
| | | // 编辑时检查审核状态 |
| | | if (type === 'edit' && row && !isApproved(row.status)) { |
| | | proxy.$modal.msgWarning("只能编辑审核通过的数据"); |
| | | // 编辑时检查审核状态,只有审核中不能编辑 |
| | | if (type === 'edit' && row && isApproving(row.status)) { |
| | | proxy.$modal.msgWarning("审核中的数据不能编辑"); |
| | | return; |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | // 检查选中的行是否都是"审核通过"状态 |
| | | const notApprovedRows = selectedRows.value.filter(row => !isApproved(row.status)); |
| | | if (notApprovedRows.length > 0) { |
| | | proxy.$modal.msgWarning("只能删除审核通过的数据"); |
| | | // 检查选中的行是否有"审核中"状态 |
| | | const approvingRows = selectedRows.value.filter(row => isApproving(row.status)); |
| | | if (approvingRows.length > 0) { |
| | | proxy.$modal.msgWarning("审核中的数据不能删除"); |
| | | return; |
| | | } |
| | | |
| | |
| | | |
| | | // 单个删除 |
| | | const handleDeleteSingle = (row) => { |
| | | // 检查是否为"审核通过"状态 |
| | | if (!isApproved(row.deliveryLedger)) { |
| | | proxy.$modal.msgWarning("只能删除审核通过的数据"); |
| | | // 检查是否为"审核中"状态 |
| | | if (isApproving(row.status)) { |
| | | proxy.$modal.msgWarning("审核中的数据不能删除"); |
| | | return; |
| | | } |
| | | |
| | |
| | | return statusStr === '审核通过' || statusStr === '3'; |
| | | }; |
| | | |
| | | // 检查审核状态是否为"审核中" |
| | | const isApproving = (status) => { |
| | | if (status === null || status === undefined || status === '') { |
| | | return false; |
| | | } |
| | | // 如果是数字,1 表示审核中 |
| | | if (typeof status === 'number') { |
| | | return status === 1; |
| | | } |
| | | // 如果是字符串 |
| | | const statusStr = String(status).trim(); |
| | | return statusStr === '审核中' || statusStr === '1'; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |