update 自定义拆分
This commit is contained in:
@@ -53,7 +53,10 @@
|
||||
<!--在线对比-->
|
||||
<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 v-if="!isDetail" @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" v-if="!isDetail">
|
||||
@@ -113,7 +116,7 @@
|
||||
<template v-slot:resultCell="text, record">
|
||||
<a-tooltip overlay-class-name="tooltip-style">
|
||||
<template slot="title">{{ text }}</template>
|
||||
<div class="table-text" :style="{background: record.color}" @click="handleEditCell(text,record)">
|
||||
<div class="table-text" :style="{background: record.colour}" @click="handleEditResult(text,record)">
|
||||
{{ text }}
|
||||
</div>
|
||||
</a-tooltip>
|
||||
@@ -131,6 +134,8 @@
|
||||
<comparison-maintain-drawer ref="comparisonMaintainDrawer" @ok="reloadTableData" />
|
||||
<!--单元格数据处理-->
|
||||
<custom-comparison-cell-drawer ref="cellDrawer" @ok="reloadTableData" />
|
||||
<!--对比分析结果-->
|
||||
<comparison-result-modal ref="resultModal" @ok="reloadTableHasResult" />
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
@@ -149,10 +154,18 @@ import {
|
||||
} from '../../../../api/documentToolApi'
|
||||
import CustomComparisonCellDrawer from './CustomComparisonCellDrawer'
|
||||
import { getFormDictTreeList } from '../../../../api/api'
|
||||
import { YesOrNoEnum } from '../../../../enums/commonEnums'
|
||||
import ComparisonResultModal from './ComparisonResultModal'
|
||||
|
||||
export default {
|
||||
name: 'CustomComparisonDrawer',
|
||||
components: { StandardSelection, StandardListDrawer, ComparisonMaintainDrawer, CustomComparisonCellDrawer },
|
||||
components: {
|
||||
StandardSelection,
|
||||
StandardListDrawer,
|
||||
ComparisonMaintainDrawer,
|
||||
CustomComparisonCellDrawer,
|
||||
ComparisonResultModal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title: '',
|
||||
@@ -203,13 +216,17 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
title() {
|
||||
title () {
|
||||
this.isDetail = this.title === this.$t('details')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible = true
|
||||
this.modal.isShow = YesOrNoEnum.NO.value
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(this.modal)
|
||||
})
|
||||
this.initDictConfig()
|
||||
},
|
||||
edit (id) {
|
||||
@@ -258,7 +275,7 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
|
||||
})
|
||||
downFile(this.url.exportXlsUrl).then((data) => {
|
||||
downFile('/customCompare/lawsCustomCompareInfo/exportExcel').then((data) => {
|
||||
if (!data) {
|
||||
this.$message.warning('文件下载失败')
|
||||
return
|
||||
@@ -291,7 +308,6 @@ export default {
|
||||
* 查看标准列表
|
||||
*/
|
||||
viewStandardList () {
|
||||
console.log(this.form.getFieldValue('serialNumber'))
|
||||
this.$refs.standardListDrawer.open(this.modal.id)
|
||||
},
|
||||
/**
|
||||
@@ -307,6 +323,10 @@ export default {
|
||||
this.getFormData()
|
||||
this.initTableData()
|
||||
},
|
||||
async reloadTableHasResult () {
|
||||
await this.initTableData()
|
||||
this.handleResult()
|
||||
},
|
||||
/**
|
||||
* 对比维护
|
||||
*/
|
||||
@@ -349,7 +369,7 @@ export default {
|
||||
if (this.specialtyItemList && this.specialtyItemList.length > 0) {
|
||||
this.specialtyItemList.forEach((specialtyItem, specialtyItemIndex) => {
|
||||
objLevelTwo.children.push({
|
||||
dataIndex: `${standard.standardNumber}-${specialtyItem.id}-label`,
|
||||
dataIndex: `${standard.id}-${specialtyItem.id}-label`,
|
||||
slots: { title: 'specialtyItem' + standardIndex + specialtyItemIndex },
|
||||
width: 200,
|
||||
customCell (record) {
|
||||
@@ -380,15 +400,15 @@ export default {
|
||||
const maintainObj = {
|
||||
maintainData, // 维护项的数据
|
||||
maintainItem: maintainData.cellTitle, // 维护项显示字段
|
||||
color: maintainData.color, // 对比分析结果列的背景颜色
|
||||
result: maintainData.result // 对比分析结果文本
|
||||
colour: maintainData.colour, // 对比分析结果列的背景颜色
|
||||
compareResult: maintainData.compareResult // 对比分析结果文本
|
||||
}
|
||||
// 按行筛选出符合条件的单元格数据
|
||||
const listData = result.list.filter(tt => tt.itemId === maintainData.id)
|
||||
const listData = result.list.filter(tt => tt.compareItemId === maintainData.id)
|
||||
const obj = {}
|
||||
listData.forEach(item => {
|
||||
obj[`${item.standardId}-${item.compareItemId}-label`] = item.formContent
|
||||
obj[`${item.standardId}-${item.compareItemId}`] = item
|
||||
obj[`${item.standardId}-${item.featureId}-label`] = item.content
|
||||
obj[`${item.standardId}-${item.featureId}`] = item
|
||||
|
||||
})
|
||||
return { ...maintainObj, ...obj }
|
||||
@@ -436,14 +456,15 @@ export default {
|
||||
* @param record 行数据内容,包含对比项数据
|
||||
*/
|
||||
handleEditCell (standard, specialtyItem, record) {
|
||||
console.log(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
|
||||
content: (record[`${standard.id}-${specialtyItem.id}`] || {}).content,
|
||||
id: (record[`${standard.id}-${specialtyItem.id}`] || {}).id,
|
||||
fileId: (record[`${standard.id}-${specialtyItem.id}`] || {}).fileId
|
||||
}
|
||||
this.$refs.cellDrawer.open(params, this.isEdit)
|
||||
},
|
||||
@@ -451,12 +472,12 @@ export default {
|
||||
* 比对分析结果,在末尾加一列,如果已经有了,就隐藏这列
|
||||
*/
|
||||
handleResult () {
|
||||
if (this.columns && this.columns.length > 0 && this.columns[this.columns.length - 1].dataIndex === 'result') {
|
||||
if (this.columns && this.columns.length > 0 && this.columns[this.columns.length - 1].dataIndex === 'compareResult') {
|
||||
this.columns.splice(this.columns.length - 1, 1)
|
||||
} else {
|
||||
this.columns.push({
|
||||
title: this.$t('docTool.customComparison.comparativeAnalysisResult'),
|
||||
dataIndex: 'result',
|
||||
dataIndex: 'compareResult',
|
||||
width: 150,
|
||||
align: 'center',
|
||||
scopedSlots: { customRender: 'resultCell' }
|
||||
@@ -550,22 +571,35 @@ export default {
|
||||
* 获取表格数据
|
||||
*/
|
||||
initTableData () {
|
||||
this.confirmLoading = true
|
||||
getTableData({ infoId: this.modal.id }).then(res => {
|
||||
if (res.success) {
|
||||
// 平铺一些数据
|
||||
this.processData(res.result || {})
|
||||
// 把数据处理成表格需要的样子
|
||||
this.processTableData(res.result || {})
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
return new Promise(resolve => {
|
||||
this.confirmLoading = true
|
||||
getTableData({ infoId: this.modal.id }).then(res => {
|
||||
if (res.success) {
|
||||
// 平铺一些数据
|
||||
this.processData(res.result || {})
|
||||
// 把数据处理成表格需要的样子
|
||||
this.processTableData(res.result || {})
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
},
|
||||
customCell (record, rowIndex) {
|
||||
console.log(record, rowIndex)
|
||||
/**
|
||||
* 编辑对比分析结果
|
||||
* @param text
|
||||
* @param record
|
||||
*/
|
||||
handleEditResult (text, record) {
|
||||
const params = {
|
||||
id: record.maintainData.id,
|
||||
colour: record.colour,
|
||||
compareResult: record.compareResult
|
||||
}
|
||||
this.$refs.resultModal.open(params)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user