feat(material): 基础信息列表加“出库/借库需审批”开关列
- material_base.ts 新增 batchSetApprovalRequired - material/list.vue:列配置/权限/表格 switch,单行拨动即保存(乐观更新)
This commit is contained in:
@ -71,6 +71,15 @@ export function batchSetInspection(data: { ids: number[], isInspectionRequired:
|
||||
})
|
||||
}
|
||||
|
||||
// 6.1 批量设置“出库/借库需审批”
|
||||
export function batchSetApprovalRequired(data: { ids: number[], isApprovalRequired: boolean }) {
|
||||
return request({
|
||||
url: '/inbound/base/batch-approval',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 7. 获取智能分组规格最大连号
|
||||
export function getLatestSpecs() {
|
||||
return request({
|
||||
|
||||
@ -328,6 +328,15 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="columns.isApprovalRequired.visible" label="出库/借库需审批" min-width="130" align="center">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
:model-value="!!scope.row.isApprovalRequired"
|
||||
:disabled="!userStore.hasPermission('material_list:operation')"
|
||||
@change="(val: boolean) => toggleApprovalRequired(scope.row, val)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="columns.referencePrice.visible" prop="referencePrice" label="参考价格" min-width="120" align="center" sortable="custom">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.referencePrice != null" class="money-text">{{ scope.row.referencePrice?.toFixed(2) }}</span>
|
||||
@ -729,6 +738,7 @@ import {
|
||||
exportAssetStatistics,
|
||||
batchSetWarning,
|
||||
batchSetInspection,
|
||||
batchSetApprovalRequired,
|
||||
markWarningOrdered,
|
||||
getMaterialUnitsAPI
|
||||
} from '@/api/material_base';
|
||||
@ -958,6 +968,7 @@ const columns = reactive({
|
||||
files: { visible: true },
|
||||
isEnabled: { visible: true },
|
||||
isInspectionRequired: { visible: true },
|
||||
isApprovalRequired: { visible: true },
|
||||
referencePrice: { visible: true },
|
||||
warningStatus: { visible: true }
|
||||
});
|
||||
@ -977,6 +988,7 @@ const permissionMap: Record<string, string> = {
|
||||
files: 'material_list:files',
|
||||
isEnabled: 'material_list:isEnabled',
|
||||
isInspectionRequired: 'material_list:operation',
|
||||
isApprovalRequired: 'material_list:operation',
|
||||
referencePrice: 'material_list:referencePrice',
|
||||
warningStatus: 'material_list:view_warning'
|
||||
};
|
||||
@ -1747,6 +1759,20 @@ const submitBatchInspection = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 单行切换“出库/借库需审批”
|
||||
const toggleApprovalRequired = async (row: any, val: boolean) => {
|
||||
if (!row || !row.id) return;
|
||||
const prev = !!row.isApprovalRequired;
|
||||
row.isApprovalRequired = val; // 乐观更新
|
||||
try {
|
||||
await batchSetApprovalRequired({ ids: [row.id], isApprovalRequired: val });
|
||||
ElMessage.success(val ? '已标记:该物料出库/借库需审批' : '已取消:该物料出库/借库免审批');
|
||||
} catch (error: any) {
|
||||
row.isApprovalRequired = prev;
|
||||
ElMessage.error(error?.msg || '设置失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 表格行样式(根据预警状态)
|
||||
const tableRowClassName = ({ row }: { row: MaterialBaseVO }) => {
|
||||
if (row.warningStatus === 2) {
|
||||
|
||||
Reference in New Issue
Block a user