履约验收

This commit is contained in:
吴红兵
2026-02-25 12:16:58 +08:00
parent 50e4cf71c7
commit b8af3ae5e0
3 changed files with 30 additions and 2 deletions

View File

@@ -59,8 +59,17 @@
</el-col>
</template>
<!-- 上传方式 -->
<!-- 上传方式先模版下载再上传 -->
<template v-if="form.acceptType === '2'">
<el-col :span="12" class="mb20">
<el-form-item label="模版下载">
<el-link type="primary" :href="lyysTemplateUrl" :download="lyysTemplateDownloadName" target="_blank">
<el-icon><Download /></el-icon>
{{ lyysTemplateLabel }}
</el-link>
<!-- <div class="el-form-item__tip">下载后填写并上传模板文件templates/lyys-template-{{ projectTypeKey }}.docx</div>-->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="履约验收模版" prop="templateFileIds">
<UploadFile
@@ -164,6 +173,14 @@
<script setup lang="ts">
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 对应 */
const LYYS_TEMPLATE_MAP: Record<string, { label: string }> = {
A: { label: '履约验收表模板(货物)' },
B: { label: '履约验收表模板(工程)' },
C: { label: '履约验收表模板(服务)' },
}
const props = withDefaults(
defineProps<{
@@ -171,11 +188,13 @@ const props = withDefaults(
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: '', batchNum: 1, previousBatchesTeams: () => [] }
{ readonly: false, canFill: true, purchaseId: '', projectType: 'A', batchNum: 1, previousBatchesTeams: () => [] }
)
const emit = defineEmits(['update:modelValue'])
@@ -184,6 +203,11 @@ const formRef = ref<FormInstance>()
const templateFileIdsStr = ref('')
const copyFromBatch = ref<number | null>(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)
const lyysTemplateDownloadName = computed(() => `${lyysTemplateLabel.value}.docx`)
const lyysTemplateUrl = computed(() => `/templates/lyys-template-${projectTypeKey.value}.docx`)
const form = reactive({
acceptType: '1',
acceptDate: '',

View File

@@ -63,6 +63,7 @@
: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)"
@@ -165,6 +166,9 @@ const activeBatchId = computed(() => {
return b?.id || ''
})
/** 项目类型 A:货物 B:工程 C:服务,用于批次表单模版下载 */
const acceptProjectType = computed(() => applyInfo.value?.projectType || rowProjectType.value || 'A')
const getPreviousBatchesTeams = (batchNum: number) => {
const list: { batch: number; team: any[] }[] = []
for (let n = 1; n < batchNum; n++) {