diff --git a/src/api/purchase/purchasingBusinessLeader.ts b/src/api/purchase/purchasingBusinessLeader.ts new file mode 100644 index 0000000..ad5f58b --- /dev/null +++ b/src/api/purchase/purchasingBusinessLeader.ts @@ -0,0 +1,61 @@ +import request from '/@/utils/request'; + +/** + * 分页查询 + * @param params 查询参数 + */ +export function fetchList(params?: any) { + return request({ + url: '/purchase/purchasingBusinessLeader/page', + method: 'get', + params + }); +} + +/** + * 通过id查询 + * @param id ID + */ +export function getObj(id: string | number) { + return request({ + url: '/purchase/purchasingBusinessLeader/details', + method: 'get', + params: { id } + }); +} + +/** + * 新增业务分管校领导 + * @param obj 对象数据 + */ +export function addObj(obj: any) { + return request({ + url: '/purchase/purchasingBusinessLeader', + method: 'post', + data: obj + }); +} + +/** + * 修改业务分管校领导 + * @param obj 对象数据 + */ +export function putObj(obj: any) { + return request({ + url: '/purchase/purchasingBusinessLeader', + method: 'put', + data: obj + }); +} + +/** + * 删除业务分管校领导 + * @param ids ID数组 + */ +export function delObjs(ids: string[] | number[]) { + return request({ + url: '/purchase/purchasingBusinessLeader', + method: 'delete', + data: ids + }); +} \ No newline at end of file diff --git a/src/views/finance/purchasingrequisition/add.vue b/src/views/finance/purchasingrequisition/add.vue index cc68a2c..a305ae0 100644 --- a/src/views/finance/purchasingrequisition/add.vue +++ b/src/views/finance/purchasingrequisition/add.vue @@ -229,15 +229,24 @@ - - + + - + + + + + + + + + + - + @@ -490,6 +499,7 @@ 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 { fetchList as getBusinessLeaderList} from '/@/api/purchase/purchasingBusinessLeader'; import { Session } from '/@/utils/storage'; import * as orderVue from '/@/api/order/order-key-vue'; @@ -606,6 +616,9 @@ const dataForm = reactive({ deptClassifyName: '', schoolLeaderUserId: '', schoolLeaderName: '', + // 业务分管校领导 + schoolBusinessLeaderUserId: '', + schoolBusinessLeaderName: '', // 采购分管 purchaseManagerUserId: '', purchaseManagerName: '', @@ -631,6 +644,7 @@ const purchaseTypeUnionList = ref([]); const businessDeptList = ref([]); const schoolLeaderList = ref([]); const purchasingManagerList = ref([]); +const businessLeaderList = ref([]); const loading = ref(false); const helpDialogVisible = ref(false); @@ -769,6 +783,11 @@ const schoolUnifiedPurchaseFormDisabled = computed(() => { // 特殊情况字典 value:0否 1紧急 2单一 3进口 const isUrgentSpecial = computed(() => dataForm.isSpecial === '1'); +// 是否为特殊情况(非0即为特殊情况:紧急、单一、进口) +const isSpecialCase = computed(() => { + return dataForm.isSpecial && dataForm.isSpecial !== '0'; +}); + // 第二步标题 const stepTwoTitle = computed(() => { return isDeptPurchase.value ? '部门自行采购' : '学校统一采购'; @@ -1124,7 +1143,22 @@ const dataRules = reactive({ validator: (_rule: any, value: string, callback: (e?: Error) => void) => { if (!isDeptPurchase.value) { if (!value || String(value).trim() === '') { - callback(new Error('请选择分管校领导')); + callback(new Error('请选择校党委')); + return; + } + } + callback(); + }, + trigger: 'change' + } + ], + schoolBusinessLeaderUserId: [ + { + validator: (_rule: any, value: string, callback: (e?: Error) => void) => { + // 仅非特殊情况时校验 + if (!isDeptPurchase.value && !isSpecialCase.value) { + if (!value || String(value).trim() === '') { + callback(new Error('请选择业务分管校领导')); return; } } @@ -1136,9 +1170,10 @@ const dataRules = reactive({ purchaseManagerUserId: [ { validator: (_rule: any, value: string, callback: (e?: Error) => void) => { - if (!isDeptPurchase.value) { + // 仅特殊情况时校验 + if (!isDeptPurchase.value && isSpecialCase.value) { if (!value || String(value).trim() === '') { - callback(new Error('请选择采购分管')); + callback(new Error('请选择采购分管校领导')); return; } } @@ -1216,6 +1251,8 @@ async function loadDetail(applyId: string | number) { deptClassifyName: detail.deptClassifyName ?? '', schoolLeaderUserId: detail.schoolLeaderUserId ?? '', schoolLeaderName: detail.schoolLeaderName ?? '', + schoolBusinessLeaderUserId: detail.schoolBusinessLeaderUserId ?? '', + schoolBusinessLeaderName: detail.schoolBusinessLeaderName ?? '', purchaseManagerUserId: detail.purchaseManagerUserId ?? '', purchaseManagerName: detail.purchaseManagerName ?? '', otherMaterials: detail.otherMaterials ?? '', @@ -1549,6 +1586,24 @@ const getPurchasingManagerListData = async () => { } }; +// 获取业务分管校领导列表 +const getBusinessLeaderListData = async () => { + try { + const res = await getBusinessLeaderList({ size: 1000 }); // 获取所有数据 + if (res.data && res.data.records) { + businessLeaderList.value = res.data.records.map((item: any) => ({ + id: item.id, + userId: item.userId, + name: item.name, + username: item.username + })); + } + } catch (err) { + console.error('获取业务分管校领导列表失败:', err); + businessLeaderList.value = []; + } +}; + // 处理业务分管处室选择变化 const handleBusinessDeptChange = (value: string) => { if (value) { @@ -1591,6 +1646,20 @@ const handlePurchaseManagerChange = (value: string) => { } }; +// 处理业务分管校领导选择变化 +const handleBusinessLeaderChange = (value: string) => { + if (value) { + const selected = businessLeaderList.value.find(item => item.userId === value); + if (selected) { + dataForm.schoolBusinessLeaderUserId = selected.userId; + dataForm.schoolBusinessLeaderName = selected.name || ''; + } + } else { + dataForm.schoolBusinessLeaderUserId = ''; + dataForm.schoolBusinessLeaderName = ''; + } +}; + // 处理文件ID字符串或对象数组转ID数组 // 支持:逗号分隔的字符串、字符串数组、{ id, name? }[](编辑回填时的格式) const getFileIdsArray = (fileIds: string | string[] | { id?: string; name?: string }[]): string[] => { @@ -1872,6 +1941,7 @@ onMounted(async () => { getBusinessDeptListData(), getSchoolLeaderListData(), getPurchasingManagerListData(), + getBusinessLeaderListData(), ]); // 编辑/查看:从 URL 或流程 currJob.orderId 加载详情 diff --git a/src/views/purchase/purchasingBusinessLeader/form.vue b/src/views/purchase/purchasingBusinessLeader/form.vue new file mode 100644 index 0000000..d88a7b8 --- /dev/null +++ b/src/views/purchase/purchasingBusinessLeader/form.vue @@ -0,0 +1,182 @@ + + + + + \ No newline at end of file diff --git a/src/views/purchase/purchasingBusinessLeader/index.vue b/src/views/purchase/purchasingBusinessLeader/index.vue new file mode 100644 index 0000000..253c48d --- /dev/null +++ b/src/views/purchase/purchasingBusinessLeader/index.vue @@ -0,0 +1,240 @@ + + + + + \ No newline at end of file