|
|
@@ -408,6 +408,7 @@
|
|
|
documentWhId: '',
|
|
|
electronicDocumentUrl: '',
|
|
|
enterpriseId: [],
|
|
|
+ enterpriseName: '',
|
|
|
feedbackDocumentUrl: '',
|
|
|
feedbackTime: '',
|
|
|
generateTime: '',
|
|
|
@@ -538,24 +539,45 @@
|
|
|
this.activeDocumentTypeId = data.id
|
|
|
this.$emit('refresh', data)
|
|
|
},
|
|
|
- getEnterpriseName(row) {
|
|
|
- let unit = this.allUnits.find(
|
|
|
- (item) => item.unitId === row.enterpriseId
|
|
|
- )
|
|
|
- // 处理enterpriseId,无论是数组还是逗号分隔的字符串
|
|
|
- let enterpriseIds = []
|
|
|
- if (Array.isArray(row.enterpriseId)) {
|
|
|
- enterpriseIds = row.enterpriseId
|
|
|
- } else if (typeof row.enterpriseId === 'string') {
|
|
|
- // 处理逗号分隔的字符串
|
|
|
- enterpriseIds = row.enterpriseId
|
|
|
+
|
|
|
+ // 安全 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) => id.trim())
|
|
|
- .filter((id) => id)
|
|
|
- } else if (row.enterpriseId) {
|
|
|
- // 处理其他可能的非空值
|
|
|
- enterpriseIds = [row.enterpriseId]
|
|
|
+ .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
|
|
|
+ },
|
|
|
+
|
|
|
+ getEnterpriseName(row) {
|
|
|
+ // 处理enterpriseId,无论是数组还是逗号分隔的字符串
|
|
|
+ const enterpriseIds = this.normalizeEnterpriseIds(row.enterpriseId)
|
|
|
|
|
|
if (enterpriseIds.length > 0) {
|
|
|
// 返回多个企业名称,用逗号分隔
|
|
|
@@ -580,7 +602,7 @@
|
|
|
// 加载选项数据
|
|
|
loadOpts() {
|
|
|
// 加载所有单位列表
|
|
|
- getAllUnitList().then((res) => {
|
|
|
+ return getAllUnitList().then((res) => {
|
|
|
this.allUnits = res.value || []
|
|
|
// 过滤掉状态为停用的数据
|
|
|
this.allUnits = this.allUnits.filter((item) => item.status == 1)
|
|
|
@@ -607,6 +629,7 @@
|
|
|
auditedUnitIds.includes(item.unitId)
|
|
|
)
|
|
|
}
|
|
|
+ return this.allUnits
|
|
|
})
|
|
|
},
|
|
|
|
|
|
@@ -719,66 +742,96 @@
|
|
|
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()
|
|
|
+
|
|
|
this.costDocumentTemplateFiles = this.costDocumentTemplateFiles.filter(
|
|
|
- (row) => row.pinyin !== 'ChengBenXiangMu' && row.pinyin !== 'XingCi'
|
|
|
+ (row) =>
|
|
|
+ !this.strIncludes(row.pinyin, 'ChengBenXiangMu') &&
|
|
|
+ !this.strIncludes(row.pinyin, 'XingCi')
|
|
|
)
|
|
|
let document = this.documentData.documentTypes.find(
|
|
|
(item) => item.id == this.document.documentId
|
|
|
)
|
|
|
let documenName =
|
|
|
document.documentTypeName || document.documentName || ''
|
|
|
- this.costDocumentTemplateFiles.forEach((item) => {
|
|
|
- if (item.pinyin.includes('BeiJianShenDanWei')) {
|
|
|
- item.dataValue = unit.unitName
|
|
|
+ ;(res.value || []).forEach((item) => {
|
|
|
+ if (this.strIncludes(item.pinyin, 'BeiJianShenDanWei')) {
|
|
|
+ item.dataValue = this.document.enterpriseName
|
|
|
}
|
|
|
- if (item.pinyin.includes('ShouSongDaRen')) {
|
|
|
- item.dataValue = unit.contactName
|
|
|
- }
|
|
|
- if (item.pinyin.includes('BeiJianShenDanWeiBanGongDiDian')) {
|
|
|
- item.dataValue = unit.address
|
|
|
+ })
|
|
|
+ this.costDocumentTemplateFiles.forEach((item) => {
|
|
|
+ // 被监审单位:无论是通过 pinyin 还是 originalText,只要匹配到就回填选中的单位名称
|
|
|
+ if (
|
|
|
+ this.strIncludes(item.pinyin, 'BeiJianShenDanWei') ||
|
|
|
+ this.strIncludes(item.originalText, '被监审单位')
|
|
|
+ ) {
|
|
|
+ item.dataValue = this.document.enterpriseName
|
|
|
}
|
|
|
- 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) {
|
|
|
+
|
|
|
+ if (
|
|
|
+ this.strIncludes(item.originalText, '需要提供材料') &&
|
|
|
+ item.dataValue
|
|
|
+ ) {
|
|
|
this.dataUploadUrl = item.dataValue
|
|
|
}
|
|
|
- if (item.pinyin.includes('DiGaoNeiRong') && item.dataValue) {
|
|
|
+ if (this.strIncludes(item.pinyin, 'DiGaoNeiRong') && item.dataValue) {
|
|
|
// 移除所有HTML标签
|
|
|
- item.dataValue = item.dataValue.replace(/<[^>]+>/g, '')
|
|
|
+ // item.dataValue = item.dataValue.replace(/<[^>]+>/g, '')
|
|
|
+ item.dataValue = item.dataValue
|
|
|
}
|
|
|
if (
|
|
|
- item.pinyin.includes('ShiJian') &&
|
|
|
+ this.strIncludes(item.pinyin, 'ShiJian') &&
|
|
|
(item.dataValue == null || item.dataValue == '')
|
|
|
) {
|
|
|
// 获取当前时间,格式为YYYY年MM月DD日
|
|
|
item.dataValue = moment(new Date()).format('YYYY年MM月DD日')
|
|
|
- } else if (item.pinyin.includes('ShiJian') && item.dataValue) {
|
|
|
- item.dataValue = item.dataValue.includes('年')
|
|
|
+ } else if (
|
|
|
+ this.strIncludes(item.pinyin, 'ShiJian') &&
|
|
|
+ item.dataValue
|
|
|
+ ) {
|
|
|
+ item.dataValue = this.strIncludes(item.dataValue, '年')
|
|
|
? item.dataValue
|
|
|
: moment(item.dataValue).format('YYYY年MM月DD日')
|
|
|
}
|
|
|
- if (item.pinyin.includes('RiQi') && item.dataValue) {
|
|
|
- item.dataValue = item.dataValue.includes('年')
|
|
|
+ if (this.strIncludes(item.pinyin, 'RiQi') && item.dataValue) {
|
|
|
+ item.dataValue = this.strIncludes(item.dataValue, '年')
|
|
|
? item.dataValue
|
|
|
: moment(item.dataValue).format('YYYY年MM月DD日')
|
|
|
}
|
|
|
- if (item.pinyin.includes('DiGaoNeiRong') && item.dataValue) {
|
|
|
+ if (this.strIncludes(item.pinyin, 'DiGaoNeiRong') && item.dataValue) {
|
|
|
// 移除所有HTML标签
|
|
|
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 (this.strIncludes(documenName, '成本监审通知书')) {
|
|
|
+ if (primaryUnit) {
|
|
|
+ if (this.strIncludes(item.pinyin, 'DanWeiMingCheng')) {
|
|
|
+ item.dataValue = primaryUnit.unitName
|
|
|
+ }
|
|
|
+ if (this.strIncludes(item.pinyin, 'FaRenDaiBiao')) {
|
|
|
+ item.dataValue = primaryUnit?.corporateRepresentative || ''
|
|
|
+ }
|
|
|
}
|
|
|
if (
|
|
|
- item.pinyin.includes(
|
|
|
+ this.strIncludes(
|
|
|
+ item.pinyin,
|
|
|
'ChengBenJianShenTongZhiShuChuangJianRiQi'
|
|
|
) &&
|
|
|
(item.dataValue == null || item.dataValue == '')
|
|
|
@@ -786,83 +839,93 @@
|
|
|
// 获取当前时间
|
|
|
item.dataValue = moment(new Date()).format('YYYY年MM月DD日')
|
|
|
}
|
|
|
- if (item.pinyin.includes('ChuangJianRiQi')) {
|
|
|
+ if (this.strIncludes(item.pinyin, 'ChuangJianRiQi')) {
|
|
|
// 获取当前时间或使用有效日期
|
|
|
item.dataValue =
|
|
|
- item.dataValue && !item.dataValue.includes('年')
|
|
|
+ item.dataValue && !this.strIncludes(item.dataValue, '年')
|
|
|
? moment(item.dataValue).format('YYYY年MM月DD日')
|
|
|
: moment(new Date()).format('YYYY年MM月DD日')
|
|
|
}
|
|
|
}
|
|
|
- if (documenName.includes('成本监审提取资料登记表')) {
|
|
|
+ if (this.strIncludes(documenName, '成本监审提取资料登记表')) {
|
|
|
if (
|
|
|
- item.pinyin.includes('DengJiBiaoShengChengRiQi') &&
|
|
|
+ this.strIncludes(item.pinyin, 'DengJiBiaoShengChengRiQi') &&
|
|
|
(item.dataValue == null || item.dataValue == '')
|
|
|
) {
|
|
|
// 获取当前时间,格式为YYYY年MM月DD日
|
|
|
item.dataValue = moment(new Date()).format('YYYY年MM月DD日')
|
|
|
}
|
|
|
}
|
|
|
- if (documenName.includes('成本审核初步意见表')) {
|
|
|
+ if (this.strIncludes(documenName, '成本审核初步意见表')) {
|
|
|
if (
|
|
|
- item.pinyin.includes('YiJianBiaoShengChengRiQi') &&
|
|
|
+ this.strIncludes(item.pinyin, 'YiJianBiaoShengChengRiQi') &&
|
|
|
(item.dataValue == null || item.dataValue == '')
|
|
|
) {
|
|
|
// 获取当前时间,格式为YYYY年MM月DD日
|
|
|
item.dataValue = moment(new Date()).format('YYYY年MM月DD日')
|
|
|
}
|
|
|
}
|
|
|
- if (documenName.includes('政府定价成本监审结论报告')) {
|
|
|
+ if (this.strIncludes(documenName, '政府定价成本监审结论报告')) {
|
|
|
if (
|
|
|
- item.pinyin.includes('BaoGaoRiQi') &&
|
|
|
+ this.strIncludes(item.pinyin, 'BaoGaoRiQi') &&
|
|
|
(item.dataValue == null || item.dataValue == '')
|
|
|
) {
|
|
|
// 获取当前时间,格式为YYYY年MM月DD日
|
|
|
item.dataValue = moment(new Date()).format('YYYY年MM月DD日')
|
|
|
}
|
|
|
- if (item.pinyin.includes('JieLunBaoGaoChuangJianRiQi')) {
|
|
|
+ if (this.strIncludes(item.pinyin, 'JieLunBaoGaoChuangJianRiQi')) {
|
|
|
// 获取当前时间,格式为YYYY年MM月DD日
|
|
|
item.dataValue = moment(new Date()).format('YYYY年MM月DD日')
|
|
|
}
|
|
|
- if (item.pinyin.includes('JianShenRenWuFaBuShiJian')) {
|
|
|
+ if (this.strIncludes(item.pinyin, '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 = !this.strIncludes(dataValue, '年')
|
|
|
+ ? moment(dataValue).format('YYYY年MM月DD日')
|
|
|
+ : dataValue
|
|
|
+ }
|
|
|
}
|
|
|
if (
|
|
|
- item.pinyin.includes(
|
|
|
+ this.strIncludes(
|
|
|
+ item.pinyin,
|
|
|
'ChengBenJianShenTongZhiShuShengChengShiJian'
|
|
|
)
|
|
|
) {
|
|
|
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 = !this.strIncludes(dataValue, '年')
|
|
|
+ ? moment(dataValue).format('YYYY年MM月DD日')
|
|
|
+ : dataValue
|
|
|
+ }
|
|
|
}
|
|
|
- if (item.pinyin.includes('ChengBenZiLiaoShangBaoShiJian')) {
|
|
|
+ if (
|
|
|
+ this.strIncludes(item.pinyin, '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 = !this.strIncludes(dataValue, '年')
|
|
|
+ ? moment(dataValue).format('YYYY年MM月DD日')
|
|
|
+ : dataValue
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if (documenName.includes('成本审核初步意见告知书')) {
|
|
|
+ if (this.strIncludes(documenName, '成本审核初步意见告知书')) {
|
|
|
if (
|
|
|
- item.pinyin.includes(
|
|
|
+ this.strIncludes(
|
|
|
+ item.pinyin,
|
|
|
'ChengBenJianShenTongZhiShuChuangJianShiJian'
|
|
|
) &&
|
|
|
item.dataValue
|
|
|
) {
|
|
|
// 获取当前时间,格式为YYYY年MM月DD日
|
|
|
- item.dataValue = !item.dataValue.includes('年')
|
|
|
+ item.dataValue = !this.strIncludes(item.dataValue, '年')
|
|
|
? moment(item.dataValue).format('YYYY年MM月DD日')
|
|
|
: item.dataValue
|
|
|
}
|
|
|
@@ -872,12 +935,12 @@
|
|
|
const selectedDocument = this.selectDocumentWhSelection[0]
|
|
|
if (selectedDocument) {
|
|
|
if (
|
|
|
- item.pinyin.includes('WenHao') ||
|
|
|
- item.pinyin.includes('WenJianHao')
|
|
|
+ this.strIncludes(item.pinyin, 'WenHao') ||
|
|
|
+ this.strIncludes(item.pinyin, 'WenJianHao')
|
|
|
) {
|
|
|
item.dataValue = selectedDocument.whNo
|
|
|
}
|
|
|
- if (item.pinyin.includes('SongDaWenShuMingCheng')) {
|
|
|
+ if (this.strIncludes(item.pinyin, 'SongDaWenShuMingCheng')) {
|
|
|
item.dataValue = selectedDocument.whName
|
|
|
}
|
|
|
}
|
|
|
@@ -941,10 +1004,21 @@
|
|
|
this.activeView = 'form'
|
|
|
},
|
|
|
handleEnterpriseChange(val) {
|
|
|
- if (this.document.enterpriseId) {
|
|
|
- // BeiJianShenDanWei
|
|
|
+ const selectedLabel = this.allUnits.find(
|
|
|
+ (item) => item.unitId === val
|
|
|
+ ).unitName
|
|
|
+ this.document.enterpriseName = selectedLabel
|
|
|
+ if (!this.document.enterpriseId) return
|
|
|
+
|
|
|
+ // 确保 allUnits 已经加载完成,再去取单位名称回填到“数据内容”里
|
|
|
+ const ensureUnitsLoaded =
|
|
|
+ this.allUnits && this.allUnits.length
|
|
|
+ ? Promise.resolve(this.allUnits)
|
|
|
+ : this.loadOpts()
|
|
|
+
|
|
|
+ ensureUnitsLoaded.then(() => {
|
|
|
this.getDocumentData()
|
|
|
- }
|
|
|
+ })
|
|
|
},
|
|
|
// 保存文档
|
|
|
handleSaveDocument() {
|
|
|
@@ -1408,6 +1482,7 @@
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
@import '@/styles/costAudit.scss';
|
|
|
+
|
|
|
.documents-layout {
|
|
|
display: flex;
|
|
|
margin-bottom: 20px;
|
|
|
@@ -1467,15 +1542,19 @@
|
|
|
.mt20 {
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
+
|
|
|
.document-edit-container {
|
|
|
display: flex;
|
|
|
+
|
|
|
.document-params {
|
|
|
width: 50%;
|
|
|
}
|
|
|
+
|
|
|
.document-preview {
|
|
|
width: 50%;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 响应式:小屏时左侧列表占满一行并堆叠到上方
|
|
|
@media (max-width: 992px) {
|
|
|
.documents-type-list {
|
|
|
@@ -1492,6 +1571,7 @@
|
|
|
margin-right: 0;
|
|
|
margin-bottom: 12px;
|
|
|
}
|
|
|
+
|
|
|
.documents-content {
|
|
|
flex: 1 1 100%;
|
|
|
width: 100%;
|