[update] 市场法规清单查看相同标准编号下的其他字段相同则合并行

This commit is contained in:
lideqin
2024-09-02 10:00:16 +08:00
parent b4a2d7a419
commit 028e8dbe20
@@ -226,119 +226,323 @@ export default {
align: 'center',
width: 180,
dataIndex: 'newProductImplDate',
scopedSlots: { customRender: 'text' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.newProductImplDateCol ? row.newProductImplDateCol : 0
}
}
}
// scopedSlots: { customRender: 'text' }
},
{ // 新认证车实施日期
title: this.$t('standardRegulationLibrary.marketListField.newCertifiedVehicleImplementationDate'),
align: 'center',
width: 180,
dataIndex: 'newAuthImplDate',
scopedSlots: { customRender: 'text' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.newAuthImplDateCol ? row.newAuthImplDateCol : 0
}
}
}
// scopedSlots: { customRender: 'text' }
},
{ // 注册日期
title: this.$t('standardRegulationLibrary.marketListField.dateOfRegistration'),
align: 'center',
width: 180,
dataIndex: 'registrationDate',
scopedSlots: { customRender: 'text' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.registrationDateCol ? row.registrationDateCol : 0
}
}
}
// scopedSlots: { customRender: 'text' }
},
{ // 适用国家/地区
title: this.$t('standardRegulationLibrary.marketListField.applicableCountryRegion'),
align: 'center',
width: 180,
dataIndex: 'country_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.countryCol ? row.countryCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 适用车型
title: this.$t('standardRegulationLibrary.marketListField.applicableVehicleType'),
align: 'center',
width: 180,
dataIndex: 'applicableVehicle_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.applicableVehicleCol ? row.applicableVehicleCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 认证对象
title: this.$t('standardRegulationLibrary.marketListField.authenticationObject'),
align: 'center',
width: 180,
dataIndex: 'authenticationObject_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.authenticationObjectCol ? row.authenticationObjectCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 认证交付物
title: this.$t('standardRegulationLibrary.marketListField.certifiedDeliverables'),
align: 'center',
width: 180,
dataIndex: 'certifyTheDeliverables',
scopedSlots: { customRender: 'text' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.certifyTheDeliverablesCol ? row.certifyTheDeliverablesCol : 0
}
}
}
// scopedSlots: { customRender: 'text' }
},
{ // 类型
title: this.$t('standardRegulationLibrary.marketListField.type'),
align: 'center',
width: 180,
dataIndex: 'type_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.typeCol ? row.typeCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 动力类型
title: this.$t('standardRegulationLibrary.marketListField.dynamicType'),
align: 'center',
width: 180,
dataIndex: 'dynamicType_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.dynamicTypeCol ? row.dynamicTypeCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 主控部门
title: this.$t('standardRegulationLibrary.marketListField.mainControlDepartment'),
align: 'center',
width: 180,
dataIndex: 'mainDept_dictText',
scopedSlots: { customRender: 'text' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.mainDeptCol ? row.mainDeptCol : 0
}
}
}
// scopedSlots: { customRender: 'text' }
},
{ // 主控部门专业模块
title: this.$t('standardRegulationLibrary.marketListField.masterControlDepartmentProfessionalModule'),
align: 'center',
width: 180,
dataIndex: 'mainDeptProfMode_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.mainDeptProfModeCol ? row.mainDeptProfModeCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 关联部门
title: this.$t('standardRegulationLibrary.marketListField.relatedDepartment'),
align: 'center',
width: 180,
dataIndex: 'associateDept_dictText',
scopedSlots: { customRender: 'text' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.associateDeptCol ? row.associateDeptCol : 0
}
}
}
// scopedSlots: { customRender: 'text' }
},
{ // 关联部门专业模块
title: this.$t('standardRegulationLibrary.marketListField.associateDepartmentSpecializedModules'),
align: 'center',
width: 180,
dataIndex: 'associateDeptProfMode_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.associateDeptProfModeCol ? row.associateDeptProfModeCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 批量限制
title: this.$t('standardRegulationLibrary.marketListField.batchRestriction'),
align: 'center',
width: 180,
dataIndex: 'batchLimit_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.batchLimitCol ? row.batchLimitCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 自动驾驶等级
title: this.$t('standardRegulationLibrary.marketListField.automaticDrivingLevel'),
align: 'center',
width: 180,
dataIndex: 'autopilotLevel_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.autopilotLevelCol ? row.autopilotLevelCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 要求类型
title: this.$t('standardRegulationLibrary.marketListField.requirementType'),
align: 'center',
width: 180,
dataIndex: 'requireType_dictText',
scopedSlots: { customRender: 'dictText' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.requireTypeCol ? row.requireTypeCol : 0
}
}
}
// scopedSlots: { customRender: 'dictText' }
},
{ // 备注
title: this.$t('standardRegulationLibrary.marketListField.remarks'),
align: 'center',
width: 180,
dataIndex: 'remark',
scopedSlots: { customRender: 'text' }
customRender: (text, row, index) => {
return {
children: <a-tooltip overlay-class-name="tooltip-style">
<template slot={'title'}>{text || text === 0 ? text : Vue.prototype.global.emptyLine}</template>
<div class="table-text">{text || text === 0 ? text : Vue.prototype.global.emptyLine}</div>
</a-tooltip>,
attrs: {
// 合并行 含col字段则合并,其他的必须设置为0!!
rowSpan: row.remarkCol ? row.remarkCol : 0
}
}
}
// scopedSlots: { customRender: 'text' }
}
],
dataSource: [],
@@ -421,9 +625,61 @@ export default {
const result = res.result.records || res.result
this.dataSource = result.map(item => {
const arr = this.indexcount(result, item.standardNumber)
const newProductImplDateArr = this.indexCountOther(arr, item.newProductImplDate, 'newProductImplDate')
const newAuthImplDateArr = this.indexCountOther(arr, item.newAuthImplDate, 'newAuthImplDate')
const registrationDateArr = this.indexCountOther(arr, item.registrationDate, 'registrationDate')
const countryArr = this.indexCountOther(arr, item.country, 'country')
const applicableVehicleArr = this.indexCountOther(arr, item.applicableVehicle, 'applicableVehicle')
const authenticationObjectArr = this.indexCountOther(arr, item.authenticationObject, 'authenticationObject')
const certifyTheDeliverablesArr = this.indexCountOther(arr, item.certifyTheDeliverables, 'certifyTheDeliverables')
const typeArr = this.indexCountOther(arr, item.type, 'type')
const dynamicTypeArr = this.indexCountOther(arr, item.dynamicType, 'dynamicType')
const mainDeptArr = this.indexCountOther(arr, item.mainDept, 'mainDept')
const mainDeptProfModeArr = this.indexCountOther(arr, item.mainDeptProfMode, 'mainDeptProfMode')
const associateDeptArr = this.indexCountOther(arr, item.associateDept, 'associateDept')
const associateDeptProfModeArr = this.indexCountOther(arr, item.associateDeptProfMode, 'associateDeptProfMode')
const batchLimitArr = this.indexCountOther(arr, item.batchLimit, 'batchLimit')
const autopilotLevelArr = this.indexCountOther(arr, item.autopilotLevel, 'autopilotLevel')
const requireTypeArr = this.indexCountOther(arr, item.requireType, 'requireType')
const remarkArr = this.indexCountOther(arr, item.remark, 'remark')
return {
...item,
col: item.id === arr[0] ? arr.length : 0
// 标准编号、标准名称、标准英文名称行合并
col: item.id === arr[0].id ? arr.length : 0,
// 新生产车实施日期行合并
newProductImplDateCol: item.id === newProductImplDateArr[0].id ? newProductImplDateArr.length : 0,
// 新认证车实施日期行合并
newAuthImplDateCol: item.id === newAuthImplDateArr[0].id ? newAuthImplDateArr.length : 0,
// 注册日期行合并
registrationDateCol: item.id === registrationDateArr[0].id ? registrationDateArr.length : 0,
// 适用国家/地区行合并
countryCol: item.id === countryArr[0].id ? countryArr.length : 0,
// 适用车型行合并
applicableVehicleCol: item.id === applicableVehicleArr[0].id ? applicableVehicleArr.length : 0,
// 认证对象行合并
authenticationObjectCol: item.id === authenticationObjectArr[0].id ? authenticationObjectArr.length : 0,
// 认证交付物行合并
certifyTheDeliverablesCol: item.id === certifyTheDeliverablesArr[0].id ? certifyTheDeliverablesArr.length : 0,
// 类型
typeCol: item.id === typeArr[0].id ? typeArr.length : 0,
// 动力类型
dynamicTypeCol: item.id === dynamicTypeArr[0].id ? dynamicTypeArr.length : 0,
// 主控部门
mainDeptCol: item.id === mainDeptArr[0].id ? mainDeptArr.length : 0,
// 主控部门专业模块
mainDeptProfModeCol: item.id === mainDeptProfModeArr[0].id ? mainDeptProfModeArr.length : 0,
// 关联部门
associateDeptCol: item.id === associateDeptArr[0].id ? associateDeptArr.length : 0,
// 关联部门专业模块
associateDeptProfModeCol: item.id === associateDeptProfModeArr[0].id ? associateDeptProfModeArr.length : 0,
// 批量限制
batchLimitCol: item.id === batchLimitArr[0].id ? batchLimitArr.length : 0,
// 自动驾驶等级
autopilotLevelCol: item.id === autopilotLevelArr[0].id ? autopilotLevelArr.length : 0,
// 要求类型
requireTypeCol: item.id === requireTypeArr[0].id ? requireTypeArr.length : 0,
// 备注
remarkCol: item.id === remarkArr[0].id ? remarkArr.length : 0
}
})
if (res.result.total) {
@@ -439,12 +695,22 @@ export default {
this.loading = false
})
},
// 出现次数
// 标准编号出现次数
indexcount (arr, item) {
const arr1 = []
for (var i = 0; i < arr.length; i++) {
if (arr[i].standardNumber === item) {
arr1.push(arr[i].id)
arr1.push(arr[i])
}
}
return arr1
},
// 其他出现次数
indexCountOther (arr, item, fieldName) {
const arr1 = []
for (var i = 0; i < arr.length; i++) {
if (arr[i][fieldName] === item) {
arr1.push(arr[i])
}
}
return arr1