-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- onRoleChange(idx, val as string)"
- >
-
-
-
-
-
-
- onTeamUserChange(idx, list)"
- />
-
-
-
-
-
- 删除
-
-
+ 增加成员
-
-
- 至少3人,且为单数
-
- ;
-
- 从往期带入
-
-
-
-
-
+
+
+ 下载{{ lyysTemplateLabel }}
+
@@ -175,7 +48,7 @@ import { ref, reactive, computed, watch } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import { Download } from '@element-plus/icons-vue'
-/** 项目类型 A:货物 B:工程 C:服务,与 public/templates/lyys-template-A|B|C.docx 对应 */
+/** 项目类型 A:货物 B:工程 C:服务 */
const LYYS_TEMPLATE_MAP: Record
= {
A: { label: '履约验收表模板(货物)' },
B: { label: '履约验收表模板(工程)' },
@@ -185,23 +58,19 @@ const LYYS_TEMPLATE_MAP: Record = {
const props = withDefaults(
defineProps<{
modelValue: Record
- canFill: boolean
readonly?: boolean
purchaseId?: string
/** 项目类型 A:货物 B:工程 C:服务,用于模版下载 */
projectType?: string
- acceptanceItems?: any[]
batchNum?: number
- previousBatchesTeams?: { batch: number; team: any[] }[]
}>(),
- { readonly: false, canFill: true, purchaseId: '', projectType: 'A', batchNum: 1, previousBatchesTeams: () => [] }
+ { readonly: false, purchaseId: '', projectType: 'A', batchNum: 1 }
)
const emit = defineEmits(['update:modelValue'])
const formRef = ref()
const templateFileIdsStr = ref('')
-const copyFromBatch = ref(null)
const projectTypeKey = computed(() => (props.projectType === 'A' || props.projectType === 'B' || props.projectType === 'C' ? props.projectType : 'A'))
const lyysTemplateLabel = computed(() => LYYS_TEMPLATE_MAP[projectTypeKey.value]?.label || LYYS_TEMPLATE_MAP.A.label)
@@ -209,56 +78,20 @@ const lyysTemplateDownloadName = computed(() => `${lyysTemplateLabel.value}.docx
const lyysTemplateUrl = computed(() => `/templates/lyys-template-${projectTypeKey.value}.docx`)
const form = reactive({
- acceptType: '1',
+ acceptType: '2', // 固定为上传模式
acceptDate: '',
- acceptContents: [] as any[],
- acceptTeam: [
- { name: '', deptCode: '', deptName: '', teacherNo: '', roleType: '' },
- { name: '', deptCode: '', deptName: '', teacherNo: '', roleType: '' },
- { name: '', deptCode: '', deptName: '', teacherNo: '', roleType: '' },
- ] as any[],
templateFileIds: [] as string[],
- acceptAddress: '',
- question: '',
remark: '',
...props.modelValue,
})
+// 确保acceptType始终为'2'
watch(() => props.modelValue, (val) => {
Object.assign(form, val || {})
- // 金额≥30万时,强制为上传方式
- if (!props.canFill && form.acceptType === '1') {
- form.acceptType = '2'
- }
- // 编辑回显:校内成员根据 name/deptCode/deptName/teacherNo 构建 userList 供 org-selector 显示
- if (Array.isArray(form.acceptTeam)) {
- form.acceptTeam.forEach((m: any) => {
- const isIn = m.roleType === 'LEADER_IN' || m.roleType === 'MEMBER_IN'
- if (isIn && (m.name || m.teacherNo) && !(m.userList && m.userList.length)) {
- m.userList = buildUserListFromTeamItem(m)
- }
- })
- }
+ form.acceptType = '2' // 强制上传模式
}, { deep: true })
-watch(form, () => emit('update:modelValue', { ...form }), { deep: true })
-// 金额≥30万时,默认选中上传方式
-watch(() => props.canFill, (val) => {
- if (!val && form.acceptType === '1') {
- form.acceptType = '2'
- }
-}, { immediate: true })
-watch(() => props.acceptanceItems, (items) => {
- if (items?.length && form.acceptContents.length === 0) {
- form.acceptContents = items.map((it: any) => ({
- configId: it.id,
- itemName: it.itemName,
- type: it.type,
- isQualified: '1',
- remark: '',
- }))
- }
-}, { immediate: true })
+watch(form, () => emit('update:modelValue', { ...form }), { deep: true })
watch(templateFileIdsStr, (s) => {
const arr = s ? s.split(',').map((x: string) => x.trim()).filter(Boolean) : []
@@ -271,84 +104,10 @@ watch(() => form.templateFileIds, (arr) => {
if (Array.isArray(arr) && arr.length) templateFileIdsStr.value = arr.join(',')
}, { immediate: true, deep: true })
-const addTeam = () => {
- form.acceptTeam.push({ name: '', deptCode: '', deptName: '', teacherNo: '', roleType: '' })
-}
-
-const removeTeam = (idx: number) => {
- form.acceptTeam.splice(idx, 1)
-}
-
-const onCopyFromBatch = (n: number | null) => {
- if (!n) return
- const item = props.previousBatchesTeams?.find((x) => x.batch === n)
- if (item?.team?.length) {
- form.acceptTeam = item.team.map((m: any) => ({
- name: m.name || '',
- deptCode: m.deptCode || '',
- deptName: m.deptName || '',
- teacherNo: m.teacherNo || '',
- roleType: m.roleType || '',
- userList: buildUserListFromTeamItem(m),
- }))
- }
- copyFromBatch.value = null
-}
-
const rules: FormRules = {
- acceptType: [{ required: true, message: '请选择验收方式', trigger: 'change' }],
acceptDate: [{ required: true, message: '请选择验收日期', trigger: 'change' }],
}
-const onRoleChange = (idx: number, val: string) => {
- const isLeader = val === 'LEADER_IN' || val === 'LEADER_OUT'
- if (isLeader) {
- const hasOtherLeader = form.acceptTeam.some((m, i) =>
- i !== idx && (m.roleType === 'LEADER_IN' || m.roleType === 'LEADER_OUT')
- )
- if (hasOtherLeader) {
- // 只能有一个组长
- form.acceptTeam[idx].roleType = ''
- return
- }
- }
-}
-
-/** 从接口返回的成员项构建 org-selector 所需的 userList(编辑回显用) */
-const buildUserListFromTeamItem = (t: any) => {
- if (!t?.name && !t?.teacherNo) return []
- return [
- {
- id: t.teacherNo || t.name,
- name: t.name || '',
- type: 'user',
- deptCode: t.deptCode,
- deptName: t.deptName,
- teacherNo: t.teacherNo,
- realName: t.name,
- },
- ]
-}
-
-const onTeamUserChange = (idx: number, list: any[]) => {
- const m = form.acceptTeam[idx]
- if (!m) return
- if (list && list.length) {
- const u = list[0]
- m.name = u.name || u.realName || ''
- m.deptCode = u.deptCode || u.commonDeptCode || ''
- m.deptName = u.deptName || u.commonDeptName || ''
- m.teacherNo = u.teacherNo ?? u.username ?? u.id ?? ''
- m.userList = list
- } else {
- m.name = ''
- m.deptCode = ''
- m.deptName = ''
- m.teacherNo = ''
- m.userList = []
- }
-}
-
const validate = () => formRef.value?.validate()
defineExpose({ validate, form })
@@ -358,13 +117,9 @@ defineExpose({ validate, form })
.mb20 {
margin-bottom: 20px;
}
-.copy-from-inline {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- margin-left: 4px;
-}
-.copy-from-inline :deep(.el-select) {
- vertical-align: middle;
+.upload-with-template {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
}
diff --git a/src/views/finance/purchasingrequisition/accept/PurchasingAcceptModal.vue b/src/views/finance/purchasingrequisition/accept/PurchasingAcceptModal.vue
index 34a0777..b2b4784 100644
--- a/src/views/finance/purchasingrequisition/accept/PurchasingAcceptModal.vue
+++ b/src/views/finance/purchasingrequisition/accept/PurchasingAcceptModal.vue
@@ -60,13 +60,10 @@
:key="b.id"
:ref="(el) => setBatchFormRef(b.batch, el)"
v-model="batchForms[b.batch]"
- :can-fill="canFillForm"
:readonly="false"
:purchase-id="String(purchaseId)"
:project-type="acceptProjectType"
- :acceptance-items="acceptanceItems"
:batch-num="b.batch"
- :previous-batches-teams="getPreviousBatchesTeams(b.batch)"
/>