|
|
@@ -283,13 +283,6 @@
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="scope.row.originalText !== '需要提供材料'">
|
|
|
<el-input
|
|
|
- v-if="scope.row.originalText.includes('时间')"
|
|
|
- v-model="scope.row.dataValue.split(' ')[0]"
|
|
|
- size="small"
|
|
|
- placeholder="请输入数据值"
|
|
|
- ></el-input>
|
|
|
- <el-input
|
|
|
- v-else
|
|
|
v-model="scope.row.dataValue"
|
|
|
size="small"
|
|
|
placeholder="请输入数据值"
|
|
|
@@ -610,6 +603,41 @@
|
|
|
this.loadOpts()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 安全 includes:避免字段为 null/undefined 时调用 includes 报错
|
|
|
+ strIncludes(val, keyword) {
|
|
|
+ return String(val || '').includes(keyword)
|
|
|
+ },
|
|
|
+
|
|
|
+ // 将 enterpriseId 统一转换为数组(兼容:数组 / 逗号分隔字符串 / 单值)
|
|
|
+ normalizeEnterpriseIds(enterpriseId) {
|
|
|
+ if (!enterpriseId) return []
|
|
|
+ if (Array.isArray(enterpriseId)) return enterpriseId.filter(Boolean)
|
|
|
+ if (typeof enterpriseId === 'string') {
|
|
|
+ return enterpriseId
|
|
|
+ .split(',')
|
|
|
+ .map((id) => String(id).trim())
|
|
|
+ .filter(Boolean)
|
|
|
+ }
|
|
|
+ return [enterpriseId]
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取当前选择的被监审单位名称(多选用逗号拼接)
|
|
|
+ getSelectedEnterpriseNames() {
|
|
|
+ const ids = this.normalizeEnterpriseIds(this.document.enterpriseId)
|
|
|
+ if (!ids.length) return ''
|
|
|
+ return ids
|
|
|
+ .map((id) => this.allUnits.find((u) => u.unitId == id)?.unitName)
|
|
|
+ .filter(Boolean)
|
|
|
+ .join(', ')
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取第一个被监审单位(多选场景下,诸如联系人/地址等字段取第一个单位信息)
|
|
|
+ getPrimaryEnterpriseUnit() {
|
|
|
+ const ids = this.normalizeEnterpriseIds(this.document.enterpriseId)
|
|
|
+ if (!ids.length) return null
|
|
|
+ return this.allUnits.find((u) => u.unitId == ids[0]) || null
|
|
|
+ },
|
|
|
+
|
|
|
handleDocumentTypeClick(data) {
|
|
|
this.activeDocumentTypeId = data.id
|
|
|
this.getData(data)
|
|
|
@@ -837,9 +865,10 @@
|
|
|
JSON.parse(JSON.stringify(res.value || [])) || []
|
|
|
this.resCostDocumentTemplateFiles =
|
|
|
JSON.parse(JSON.stringify(res.value || [])) || []
|
|
|
- let unit = this.allUnits.find(
|
|
|
- (item) => item.unitId === this.document.enterpriseId
|
|
|
- )
|
|
|
+
|
|
|
+ const primaryUnit = this.getPrimaryEnterpriseUnit()
|
|
|
+ const selectedEnterpriseNames = this.getSelectedEnterpriseNames()
|
|
|
+
|
|
|
this.costDocumentTemplateFiles = this.costDocumentTemplateFiles.filter(
|
|
|
(row) => row.pinyin !== 'ChengBenXiangMu' && row.pinyin !== 'XingCi'
|
|
|
)
|
|
|
@@ -848,19 +877,30 @@
|
|
|
)
|
|
|
let documenName =
|
|
|
document.documentTypeName || document.documentName || ''
|
|
|
+
|
|
|
this.costDocumentTemplateFiles.forEach((item) => {
|
|
|
- if (item.pinyin.includes('BeiJianShenDanWei')) {
|
|
|
- item.dataValue = unit.unitName
|
|
|
+ // 被监审单位名称:多选时用逗号拼接
|
|
|
+ if (this.strIncludes(item.pinyin, 'BeiJianShenDanWei')) {
|
|
|
+ item.dataValue = selectedEnterpriseNames
|
|
|
}
|
|
|
- if (item.pinyin.includes('ShouSongDaRen')) {
|
|
|
- item.dataValue = unit.contactName
|
|
|
- }
|
|
|
- if (item.pinyin.includes('BeiJianShenDanWeiBanGongDiDian')) {
|
|
|
- item.dataValue = unit.address
|
|
|
- }
|
|
|
- if (item.pinyin.includes('BeiJianShenDanWeiLianXiRenDianHua')) {
|
|
|
- item.dataValue = unit.contactMobile
|
|
|
+
|
|
|
+ // 以下字段依赖单位详情,多选场景取第一个单位
|
|
|
+ if (primaryUnit) {
|
|
|
+ if (this.strIncludes(item.pinyin, 'ShouSongDaRen')) {
|
|
|
+ item.dataValue = primaryUnit.contactName
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ this.strIncludes(item.pinyin, 'BeiJianShenDanWeiBanGongDiDian')
|
|
|
+ ) {
|
|
|
+ item.dataValue = primaryUnit.address
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ this.strIncludes(item.pinyin, 'BeiJianShenDanWeiLianXiRenDianHua')
|
|
|
+ ) {
|
|
|
+ item.dataValue = primaryUnit.contactMobile
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if (item.originalText.includes('需要提供材料') && item.dataValue) {
|
|
|
this.dataUploadUrl = item.dataValue
|
|
|
}
|
|
|
@@ -889,11 +929,13 @@
|
|
|
item.dataValue = item.dataValue.replace(/<[^>]+>/g, '')
|
|
|
}
|
|
|
if (documenName.includes('成本监审通知书')) {
|
|
|
- if (item.pinyin.includes('DanWeiMingCheng')) {
|
|
|
- item.dataValue = unit.unitName
|
|
|
- }
|
|
|
- if (item.pinyin.includes('FaRenDaiBiao')) {
|
|
|
- item.dataValue = unit?.corporateRepresentative || ''
|
|
|
+ if (primaryUnit) {
|
|
|
+ if (item.pinyin.includes('DanWeiMingCheng')) {
|
|
|
+ item.dataValue = primaryUnit.unitName
|
|
|
+ }
|
|
|
+ if (item.pinyin.includes('FaRenDaiBiao')) {
|
|
|
+ item.dataValue = primaryUnit?.corporateRepresentative || ''
|
|
|
+ }
|
|
|
}
|
|
|
if (
|
|
|
item.pinyin.includes(
|
|
|
@@ -945,10 +987,12 @@
|
|
|
if (item.pinyin.includes('JianShenRenWuFaBuShiJian')) {
|
|
|
let dataValue = this.resCostDocumentTemplateFiles.find(
|
|
|
(item2) => item2.pinyin === 'JianShenRenWuFaBuShiJian'
|
|
|
- ).dataValue
|
|
|
- item.dataValue = !dataValue.includes('年')
|
|
|
- ? moment(dataValue).format('YYYY年MM月DD日')
|
|
|
- : dataValue
|
|
|
+ )?.dataValue
|
|
|
+ if (dataValue) {
|
|
|
+ item.dataValue = !dataValue.includes('年')
|
|
|
+ ? moment(dataValue).format('YYYY年MM月DD日')
|
|
|
+ : dataValue
|
|
|
+ }
|
|
|
}
|
|
|
if (
|
|
|
item.pinyin.includes(
|
|
|
@@ -958,18 +1002,22 @@
|
|
|
let dataValue = this.resCostDocumentTemplateFiles.find(
|
|
|
(item2) =>
|
|
|
item2.pinyin === 'ChengBenJianShenTongZhiShuShengChengShiJian'
|
|
|
- ).dataValue
|
|
|
- item.dataValue = !dataValue.includes('年')
|
|
|
- ? moment(dataValue).format('YYYY年MM月DD日')
|
|
|
- : dataValue
|
|
|
+ )?.dataValue
|
|
|
+ if (dataValue) {
|
|
|
+ item.dataValue = !dataValue.includes('年')
|
|
|
+ ? moment(dataValue).format('YYYY年MM月DD日')
|
|
|
+ : dataValue
|
|
|
+ }
|
|
|
}
|
|
|
if (item.pinyin.includes('ChengBenZiLiaoShangBaoShiJian')) {
|
|
|
let dataValue = this.resCostDocumentTemplateFiles.find(
|
|
|
(item2) => item2.pinyin === 'ChengBenZiLiaoShangBaoShiJian'
|
|
|
- ).dataValue
|
|
|
- item.dataValue = !dataValue.includes('年')
|
|
|
- ? moment(dataValue).format('YYYY年MM月DD日')
|
|
|
- : dataValue
|
|
|
+ )?.dataValue
|
|
|
+ if (dataValue) {
|
|
|
+ item.dataValue = !dataValue.includes('年')
|
|
|
+ ? moment(dataValue).format('YYYY年MM月DD日')
|
|
|
+ : dataValue
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (documenName.includes('成本审核初步意见告知书')) {
|
|
|
@@ -1449,7 +1497,6 @@
|
|
|
})
|
|
|
},
|
|
|
handleUploadClick(row) {
|
|
|
- console.log('handleUploadClick', row)
|
|
|
let loading = null
|
|
|
// 第一步:创建文件选择器
|
|
|
const input = document.createElement('input')
|