审核工作流

This commit is contained in:
Teo
2025-08-09 18:02:06 +08:00
parent b6e4f84570
commit 6bbe8a83f7
16 changed files with 264 additions and 204 deletions

View File

@ -15,7 +15,7 @@
</el-row>
</template>
<el-input v-model="queryParams.batchNumber" placeholder="请输入批次号" @input="getBatchList" prefix-icon="Search" clearable />
<el-input v-model="batchNumber" placeholder="请输入批次号" @input="searchBatchList" prefix-icon="Search" clearable />
<el-tree
ref="batchTreeRef"
class="mt-2"
@ -26,7 +26,14 @@
highlight-current
default-expand-all
@node-click="handleNodeClick"
></el-tree>
>
<template #default="{ node, data }">
<div class="custom-tree-node">
{{node.label }}
<dict-tag :options="wf_business_status" :value="data.approvalProject" />
</div>
</template>
</el-tree>
<pagination
v-show="total > 0"
:total="total"
@ -41,10 +48,10 @@
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-col :span="1.5" v-if="form.approvalProject == 'draft'">
<el-button type="primary" plain icon="SemiSelect" @click="handleAdd" v-hasPermi="['cailiaoshebei:cailiaoshebei:add']">选择</el-button>
</el-col>
<el-col :span="1.5">
<el-col :span="1.5" v-if="form.approvalProject == 'draft'">
<el-button type="success" plain icon="Check" @click="submitForm" v-hasPermi="['cailiaoshebei:cailiaoshebei:delete']">保存</el-button>
</el-col>
<el-col :span="1.5">
@ -66,21 +73,16 @@
<el-table-column label="供应周期(天)" align="center" prop="estimatedCycle" />
<el-table-column label="需求数量" align="center" prop="demandQuantity">
<template #default="scope">
<el-input v-model="scope.row.demandQuantity" type="number" />
<el-input v-model="scope.row.demandQuantity" type="number" :disabled="form.approvalProject != 'draft'"/>
</template>
</el-table-column>
<el-table-column label="计划到场时间" align="center" prop="arrivalTime" width="250">
<template #default="scope">
<div class="flex justify-center w100%">
<el-date-picker v-model="scope.row.arrivalTime" type="date" value-format="YYYY-MM-DD" />
<el-date-picker v-model="scope.row.arrivalTime" type="date" value-format="YYYY-MM-DD" :disabled="form.approvalProject != 'draft'" />
</div>
</template>
</el-table-column>
<el-table-column label="流程状态" align="center" prop="planAuditStatus">
<template #default="scope">
<dict-tag :options="wf_business_status" :value="scope.row.planAuditStatus" />
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
@ -94,9 +96,12 @@
:data="cailiaoshebeiAllList"
:props="{
label: 'name',
key: 'id'
key: 'cailiaoshebeiId'
}"
/>
><template #default="{ option }">
{{ `${option.specification || ''} ${option.name || ''}` }}1
</template>
</el-transfer>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitTransferForm"> </el-button>
@ -116,7 +121,8 @@ import {
updateCailiaoshebei,
listBatch,
getBatch,
delBatch
delBatch,
listSelectCailiaoshebei
} from '@/api/materials/batchPlan';
import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/batchPlan/types';
@ -198,7 +204,7 @@ const data = reactive<PageData<CailiaoshebeiForm, CailiaoshebeiQuery>>({
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }]
}
});
const batchNumber = ref('');
const { queryParams, form, rules } = toRefs(data);
/** 查询物资-材料设备列表 */
@ -241,6 +247,11 @@ const handleNodeClick = (data: any) => {
getList();
};
const searchBatchList = async () => {
queryParams.value.batchNumber = batchNumber.value;
getBatchList();
};
/** 取消按钮 */
const cancel = () => {
reset();
@ -250,7 +261,8 @@ const cancel = () => {
/** 表单重置 */
const reset = () => {
const preservedBatchId = form.value.batchNumber; // 先保存当前的 batchNumber
form.value = { ...initFormData, batchNumber: preservedBatchId }; // 重置但保留
const status=form.value.approvalProject
form.value = { ...initFormData, batchNumber: preservedBatchId,approvalProject:status }; // 重置但保留
cailiaoshebeiFormRef.value?.resetFields();
};
@ -276,7 +288,8 @@ const handleSelectionChange = (selection: CailiaoshebeiVO[]) => {
/** 新增按钮操作 */
const handleAdd = () => {
reset();
listCailiaoshebei({
listSelectCailiaoshebei({
projectId: currentProject.value.id
}).then((res) => {
cailiaoshebeiAllList.value = res.rows;
@ -295,7 +308,8 @@ const submitForm = async () => {
}
});
await addCailiaoshebei({ addDataList: cailiaoshebeiList.value } as any).finally(() => (buttonLoading.value = false));
await addCailiaoshebei({ addDataList: cailiaoshebeiList.value,batchNumber:form.value.batchNumber,projectId:currentProject.value.id } as any).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
};
@ -303,7 +317,7 @@ const submitForm = async () => {
/** 提交穿梭框数据 */
const submitTransferForm = async () => {
cailiaoshebeiList.value = cailiaoshebeiSelectedList.value.map((id) => {
const item = cailiaoshebeiAllList.value.find((option) => option.id === id);
const item = cailiaoshebeiAllList.value.find((option) => option.cailiaoshebeiId === id);
return item;
});
dialog.visible = false;
@ -312,8 +326,8 @@ const submitTransferForm = async () => {
/** 新增批次 */
const addBatch = async () => {
await proxy?.$modal.confirm('是否确认新增批次?').finally(() => (loading.value = false));
const res = await getBatch({ projectId: currentProject.value.id });
console.log('🚀 ~ addBatch ~ res:', res);
await getBatch({ projectId: currentProject.value.id });
queryParams.value.batchNumber = '';
await getBatchList();
proxy?.$modal.msgSuccess('新增成功');
@ -384,3 +398,14 @@ onUnmounted(() => {
listeningProject();
});
</script>
<style scoped lang="scss">
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
</style