update 自定义比对
This commit is contained in:
@@ -17,12 +17,14 @@
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.customComparison.listName')"
|
||||
@change="event => event.target.value = event.target.value.trim()"
|
||||
:maxLength="50"
|
||||
:disabled="isDetail"
|
||||
v-decorator="['listName', validatorRules.listName]" />
|
||||
</a-form-item>
|
||||
<!--涉及标准-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.referenceStandard')">
|
||||
<standard-selection :placeholder="$t('pleaseSelect') + $t('docTool.customComparison.referenceStandard')"
|
||||
v-decorator="['referenceStandard', validatorRules.referenceStandard]"
|
||||
:disabled="isDetail"
|
||||
@change="handleStandardChange" />
|
||||
</a-form-item>
|
||||
<!--涉及国家-->
|
||||
@@ -45,19 +47,19 @@
|
||||
:placeholder="$t('pleaseSelect')+$t('docTool.customComparison.whetherToMakePublic')"
|
||||
type="radio"
|
||||
:triggerChange="false"
|
||||
:disabled="isDetail"
|
||||
dict-code="yn" />
|
||||
</a-form-item>
|
||||
<!--在线对比-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.onlineComparison')">
|
||||
<a-switch default-checked v-model="isStartComparison" @change="handleSwitchChange" />
|
||||
<a-button type="primary" class="submit-btn" ghost @click="handleSaveForm">{{ $t('submit') }}</a-button>
|
||||
<a-button type="primary" class="submit-btn" ghost v-if="!isDetail" @click="handleSaveForm">{{ $t('submit') }}</a-button>
|
||||
</a-form-item>
|
||||
<div v-show="isStartComparison" class="comparison-box">
|
||||
<div class="operation-box">
|
||||
<div class="operation-box" v-if="!isDetail">
|
||||
<!--标准列表-->
|
||||
<a-button type="primary" ghost @click="viewStandardList">{{
|
||||
$t('docTool.customComparison.standardList')
|
||||
}}
|
||||
<a-button type="primary" ghost @click="viewStandardList">
|
||||
{{ $t('docTool.customComparison.standardList') }}
|
||||
</a-button>
|
||||
<!--对比维护-->
|
||||
<a-button type="primary" ghost @click="handleComparisonMaintain">
|
||||
@@ -87,8 +89,8 @@
|
||||
<template :slot="`specialtyItem${standardIndex}${specialtyItemIndex}`">
|
||||
<div class="column-cell">
|
||||
<a-tooltip overlay-class-name="tooltip-style">
|
||||
<template slot="title">{{ specialtyItem.proertyVal }}</template>
|
||||
<div class="column-text">{{ specialtyItem.proertyVal }}</div>
|
||||
<template slot="title">{{ specialtyItem.cellTitle }}</template>
|
||||
<div class="column-text">{{ specialtyItem.cellTitle }}</div>
|
||||
</a-tooltip>
|
||||
<a-icon type="close" v-show="isEdit" @click="handleDeleteSpecialty(specialtyItem)" />
|
||||
</div>
|
||||
@@ -107,14 +109,6 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!--单元格点击-->
|
||||
<template v-slot:cell="text, record">
|
||||
<a-tooltip overlay-class-name="tooltip-style">
|
||||
<template slot="title">{{ text }}</template>
|
||||
<div class="table-text" @click="handleEditCell(text,record)">{{ text }}</div>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
|
||||
<!--比对分析结果-->
|
||||
<template v-slot:resultCell="text, record">
|
||||
<a-tooltip overlay-class-name="tooltip-style">
|
||||
@@ -132,7 +126,7 @@
|
||||
</div>
|
||||
|
||||
<!--标准列表-->
|
||||
<standard-list-drawer ref="standardListDrawer" @delete="handleDeleteStandard" />
|
||||
<standard-list-drawer ref="standardListDrawer" @ok="reloadData" />
|
||||
<!--对比维护-->
|
||||
<comparison-maintain-drawer ref="comparisonMaintainDrawer" @ok="reloadTableData" />
|
||||
<!--单元格数据处理-->
|
||||
@@ -146,12 +140,12 @@ import { downFile } from '../../../../api/manage'
|
||||
import StandardListDrawer from './StandardListDrawer'
|
||||
import ComparisonMaintainDrawer from './ComparisonMaintainDrawer'
|
||||
import {
|
||||
deleteSpecialtyItem,
|
||||
deleteMaintainItem,
|
||||
saveFormData,
|
||||
deleteSpecialtyItem,
|
||||
getFormDataById,
|
||||
saveStandard,
|
||||
getTableData
|
||||
getTableData,
|
||||
saveFormData,
|
||||
saveStandard
|
||||
} from '../../../../api/documentToolApi'
|
||||
import CustomComparisonCellDrawer from './CustomComparisonCellDrawer'
|
||||
import { getFormDictTreeList } from '../../../../api/api'
|
||||
@@ -201,12 +195,18 @@ export default {
|
||||
},
|
||||
isStartComparison: false, // 是否发起比对,为是的时候显示下面的内容
|
||||
isEdit: false, // 是否在编辑状态里
|
||||
isDetail: false, // 是否查看
|
||||
standardList: [], // 标准的列表
|
||||
specialtyItemList: [], // 特点的列表(三级表头)
|
||||
isFirstOpenComparison: true, // 第一次打开在线比对
|
||||
countryTreeData: [] // 涉及国家数据
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
title() {
|
||||
this.isDetail = this.title === this.$t('details')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible = true
|
||||
@@ -294,35 +294,32 @@ export default {
|
||||
console.log(this.form.getFieldValue('serialNumber'))
|
||||
this.$refs.standardListDrawer.open(this.modal.id)
|
||||
},
|
||||
/**
|
||||
* 删除标准
|
||||
* @param standardNumber
|
||||
*/
|
||||
handleDeleteStandard (standardNumber) {
|
||||
let selectedStandards = this.form.getFieldValue('serialNumber').split(',')
|
||||
selectedStandards = selectedStandards.filter(tt => tt !== standardNumber)
|
||||
const str = selectedStandards.join(',')
|
||||
this.form.setFieldsValue({ serialNumber: str })
|
||||
},
|
||||
/**
|
||||
* 重新加载表格数据
|
||||
*/
|
||||
reloadTableData () {
|
||||
this.initTableData()
|
||||
},
|
||||
/**
|
||||
* 重新加载所有数据
|
||||
*/
|
||||
reloadData () {
|
||||
this.getFormData()
|
||||
this.initTableData()
|
||||
},
|
||||
/**
|
||||
* 对比维护
|
||||
*/
|
||||
handleComparisonMaintain () {
|
||||
this.$refs.comparisonMaintainDrawer.open()
|
||||
this.$refs.comparisonMaintainDrawer.open(this.modal.id)
|
||||
},
|
||||
/**
|
||||
* 处理页面需要用到的数据
|
||||
* @param result
|
||||
*/
|
||||
processData (result) {
|
||||
this.standardList = Object.values(result.countryMap).reduce((acc, cur) => acc.concat(cur), [])
|
||||
this.specialtyItemList = result.ranksMap.NATURE || []
|
||||
this.standardList = Object.values(result.countryMap || {}).reduce((acc, cur) => acc.concat(cur), [])
|
||||
this.specialtyItemList = result.ranksMap.特点 || []
|
||||
},
|
||||
/**
|
||||
* 处理表头和表格数据
|
||||
@@ -333,7 +330,8 @@ export default {
|
||||
this.columns = [
|
||||
{ title: '', width: 100, dataIndex: 'maintainItem', scopedSlots: { customRender: 'deleteCell' } }
|
||||
]
|
||||
const countryList = Object.keys(result.countryMap)
|
||||
const countryList = Object.keys(result.countryMap || {})
|
||||
const _this = this
|
||||
// 国家是第一级表头
|
||||
countryList.forEach(country => {
|
||||
const countryStandardList = result.countryMap[country]
|
||||
@@ -354,7 +352,15 @@ export default {
|
||||
dataIndex: `${standard.standardNumber}-${specialtyItem.id}-label`,
|
||||
slots: { title: 'specialtyItem' + standardIndex + specialtyItemIndex },
|
||||
width: 200,
|
||||
scopedSlots: { customRender: 'cell' }
|
||||
customCell (record) {
|
||||
return {
|
||||
on: {
|
||||
click: () => {
|
||||
_this.handleEditCell(standard, specialtyItem, record)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -367,13 +373,13 @@ export default {
|
||||
|
||||
// 处理表格数据
|
||||
// 把比对项的数据放在里面,对比项取proertyVal为显示字段,其余属性用数据本身的
|
||||
const maintainItemList = result.ranksMap.ITEM || []
|
||||
const maintainItemList = result.ranksMap.对比项 || []
|
||||
// 有多少对比项决定了有多少行数据
|
||||
this.dataSource = maintainItemList.map(maintainData => {
|
||||
// 第一列数据,用对象留存一下
|
||||
const maintainObj = {
|
||||
maintainData, // 维护项的数据
|
||||
maintainItem: maintainData.proertyVal, // 维护项显示字段
|
||||
maintainItem: maintainData.cellTitle, // 维护项显示字段
|
||||
color: maintainData.color, // 对比分析结果列的背景颜色
|
||||
result: maintainData.result // 对比分析结果文本
|
||||
}
|
||||
@@ -381,12 +387,11 @@ export default {
|
||||
const listData = result.list.filter(tt => tt.itemId === maintainData.id)
|
||||
const obj = {}
|
||||
listData.forEach(item => {
|
||||
obj[`${item.sarNumber}-${item.natureId}-label`] = item.formContent
|
||||
obj[`${item.sarNumber}-${item.natureId}`] = item
|
||||
obj[`${item.standardId}-${item.compareItemId}-label`] = item.formContent
|
||||
obj[`${item.standardId}-${item.compareItemId}`] = item
|
||||
|
||||
})
|
||||
const line = { ...maintainObj, ...obj }
|
||||
return line
|
||||
return { ...maintainObj, ...obj }
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -426,15 +431,21 @@ export default {
|
||||
},
|
||||
/**
|
||||
* 点击编辑单元格数据
|
||||
* @param record
|
||||
* @param standard 标准信息
|
||||
* @param specialtyItem 特点信息
|
||||
* @param record 行数据内容,包含对比项数据
|
||||
*/
|
||||
handleEditCell (text, record) {
|
||||
const columnDataIndex = Object.keys(record).find(key => record[key] === text)
|
||||
let cellData = {}
|
||||
if (columnDataIndex) {
|
||||
cellData = record[columnDataIndex.replace('-label', '')]
|
||||
handleEditCell (standard, specialtyItem, record) {
|
||||
const params = {
|
||||
compareItemId: record.maintainData.id,
|
||||
featureId: specialtyItem.id,
|
||||
infoId: this.modal.id,
|
||||
standardId: standard.id,
|
||||
content: record.content,
|
||||
id: record.id,
|
||||
fileId: record.fileId
|
||||
}
|
||||
this.$refs.cellDrawer.open(cellData)
|
||||
this.$refs.cellDrawer.open(params, this.isEdit)
|
||||
},
|
||||
/**
|
||||
* 比对分析结果,在末尾加一列,如果已经有了,就隐藏这列
|
||||
@@ -518,11 +529,14 @@ export default {
|
||||
*/
|
||||
handleStandardChange (value) {
|
||||
this.confirmLoading = true
|
||||
const params = this.form.getFieldsValue()
|
||||
const params = {
|
||||
lawsCustomCompareInfo: Object.assign(this.modal, this.form.getFieldsValue())
|
||||
}
|
||||
params.standardNumber = value
|
||||
saveStandard(params).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
this.modal.id = res.result
|
||||
this.getFormData()
|
||||
this.reloadTableData()
|
||||
} else {
|
||||
@@ -537,7 +551,7 @@ export default {
|
||||
*/
|
||||
initTableData () {
|
||||
this.confirmLoading = true
|
||||
getTableData({ id: this.modal.id }).then(res => {
|
||||
getTableData({ infoId: this.modal.id }).then(res => {
|
||||
if (res.success) {
|
||||
// 平铺一些数据
|
||||
this.processData(res.result || {})
|
||||
@@ -549,6 +563,9 @@ export default {
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
},
|
||||
customCell (record, rowIndex) {
|
||||
console.log(record, rowIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user