采购申请修改

This commit is contained in:
吴红兵
2026-02-27 13:31:29 +08:00
parent ab667f3cdd
commit 2e4be039ee
5 changed files with 596 additions and 1 deletions

View File

@@ -235,6 +235,13 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8" class="mb12">
<el-form-item label="采购分管校领导" prop="purchaseManagerUserId" :required="!isDeptPurchase">
<el-select v-model="dataForm.purchaseManagerUserId" placeholder="请选择采购分管" clearable filterable @change="handlePurchaseManagerChange" style="width: 100%" :disabled="flowFieldDisabled('purchaseManagerUserId')">
<el-option v-for="item in purchasingManagerList" :key="item.id" :label="item.name" :value="item.userId" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8" class="mb12" v-if="dataForm.budget && dataForm.budget >= BUDGET_FEASIBILITY_THRESHOLD">
<el-form-item label="项目可行性论证报告" prop="feasibilityReport" required>
<upload-file v-model="dataForm.feasibilityReport" :limit="1" :file-type="['doc', 'docx', 'pdf']" :data="{ fileType: FILE_TYPE_MAP.feasibilityReport }" upload-file-url="/purchase/purchasingfiles/upload" :disabled="flowFieldDisabled('feasibilityReport')" />
@@ -482,6 +489,7 @@ import other from '/@/utils/other';
import { Document, Download, QuestionFilled } from '@element-plus/icons-vue';
import { fetchList as getBusinessDeptList } from '/@/api/purchase/purchasingBusinessDept';
import { getPage as getSchoolLeaderPage } from '/@/api/finance/purchasingschoolleader';
import { fetchList as getPurchasingManagerList} from '/@/api/purchase/purchasingPurchaseManager';
import { Session } from '/@/utils/storage';
import * as orderVue from '/@/api/order/order-key-vue';
@@ -598,6 +606,9 @@ const dataForm = reactive({
deptClassifyName: '',
schoolLeaderUserId: '',
schoolLeaderName: '',
// 采购分管
purchaseManagerUserId: '',
purchaseManagerName: '',
// 其他材料zip压缩包
otherMaterials: '',
// 实施采购信息(查看时展示)
@@ -619,6 +630,7 @@ const purchaseModeSchoolList = ref<any[]>([]);
const purchaseTypeUnionList = ref<any[]>([]);
const businessDeptList = ref<any[]>([]);
const schoolLeaderList = ref<any[]>([]);
const purchasingManagerList = ref<any[]>([]);
const loading = ref(false);
const helpDialogVisible = ref(false);
@@ -1121,6 +1133,20 @@ const dataRules = reactive({
trigger: 'change'
}
],
purchaseManagerUserId: [
{
validator: (_rule: any, value: string, callback: (e?: Error) => void) => {
if (!isDeptPurchase.value) {
if (!value || String(value).trim() === '') {
callback(new Error('请选择采购分管'));
return;
}
}
callback();
},
trigger: 'change'
}
],
});
// 取消
@@ -1190,6 +1216,8 @@ async function loadDetail(applyId: string | number) {
deptClassifyName: detail.deptClassifyName ?? '',
schoolLeaderUserId: detail.schoolLeaderUserId ?? '',
schoolLeaderName: detail.schoolLeaderName ?? '',
purchaseManagerUserId: detail.purchaseManagerUserId ?? '',
purchaseManagerName: detail.purchaseManagerName ?? '',
otherMaterials: detail.otherMaterials ?? '',
implementType: detail.implementType ?? '',
fileFlowInstId: detail.fileFlowInstId ?? '',
@@ -1468,6 +1496,15 @@ const getBusinessDeptListData = async () => {
name: item.name,
username: item.username
}));
businessDeptList.value.push({
id: '0',
deptId: '0',
deptName: '无',
userId: '0',
name: '无',
username: '无'
});
}
} catch (err) {
console.error('获取业务分管处室列表失败:', err);
@@ -1493,6 +1530,25 @@ const getSchoolLeaderListData = async () => {
}
};
// 获取采购分管列表
const getPurchasingManagerListData = async () => {
try {
const res = await getPurchasingManagerList({ records: 1000 }); // 获取所有数据
if (res.data && res.data.records) {
purchasingManagerList.value = res.data.records.map((item: any) => ({
id: item.id,
userId: item.userId,
name: item.name,
username: item.username,
deptName: item.deptName
}));
}
} catch (err) {
console.error('获取采购分管列表失败:', err);
purchasingManagerList.value = [];
}
};
// 处理业务分管处室选择变化
const handleBusinessDeptChange = (value: string) => {
if (value) {
@@ -1521,6 +1577,20 @@ const handleSchoolLeaderChange = (value: string) => {
}
};
// 处理采购分管选择变化
const handlePurchaseManagerChange = (value: string) => {
if (value) {
const selected = purchasingManagerList.value.find(item => item.userId === value);
if (selected) {
dataForm.purchaseManagerUserId = selected.userId;
dataForm.purchaseManagerName = selected.name || '';
}
} else {
dataForm.purchaseManagerUserId = '';
dataForm.purchaseManagerName = '';
}
};
// 处理文件ID字符串或对象数组转ID数组
// 支持:逗号分隔的字符串、字符串数组、{ id, name? }[](编辑回填时的格式)
const getFileIdsArray = (fileIds: string | string[] | { id?: string; name?: string }[]): string[] => {
@@ -1801,6 +1871,7 @@ onMounted(async () => {
getPurchaseTypeUnionDict(),
getBusinessDeptListData(),
getSchoolLeaderListData(),
getPurchasingManagerListData(),
]);
// 编辑/查看:从 URL 或流程 currJob.orderId 加载详情