update 自定义拆分
This commit is contained in:
@@ -96,6 +96,8 @@ const getTableData = (params) => getAction('/customCompare/lawsCustomCompareInfo
|
||||
const getMaintainList = (params) => getAction('/customCompare/lawsCustomCompareInfo/queryInventory', params)
|
||||
// 自定义比对-编辑特点、对比项列表
|
||||
const editMaintainList = (params) => postAction('/customCompare/lawsCustomCompareInfo/editInventory', params)
|
||||
// 自定义比对-对比分析结果保存
|
||||
const editComparsionResult = (params) => postAction('/customCompare/lawsCustomCompareInfo/saveCellCompareResult', params)
|
||||
|
||||
export {
|
||||
// 文档拆分
|
||||
@@ -150,5 +152,6 @@ export {
|
||||
saveStandard,
|
||||
getTableData,
|
||||
getMaintainList,
|
||||
editMaintainList
|
||||
editMaintainList,
|
||||
editComparsionResult
|
||||
}
|
||||
|
||||
@@ -111,3 +111,9 @@ export const Recheck = {
|
||||
ANNUL: { text: '废止', value: '1' },
|
||||
SEAL_SAVE: { text: '封存', value: '1' }
|
||||
}
|
||||
|
||||
// 清单维护类型
|
||||
export const InventoryType = {
|
||||
SPECIALTY: { text: '特点', value: '1' },
|
||||
COMPARISON_ITEM: { text: '对比项', value: '2' }
|
||||
}
|
||||
@@ -52,6 +52,7 @@
|
||||
|
||||
<script>
|
||||
import { getMaintainList, editMaintainList } from '../../../../api/documentToolApi'
|
||||
import { InventoryType } from '../../../../enums/commonEnums'
|
||||
|
||||
export default {
|
||||
name: 'ComparisonMaintainDrawer',
|
||||
@@ -91,11 +92,13 @@ export default {
|
||||
this.specialtyList = [
|
||||
{
|
||||
cellTitle: '章节',
|
||||
infoId: this.infoId
|
||||
infoId: this.infoId,
|
||||
inventoryType: InventoryType.SPECIALTY.value
|
||||
},
|
||||
{
|
||||
cellTitle: '法规内容',
|
||||
infoId: this.infoId
|
||||
infoId: this.infoId,
|
||||
inventoryType: InventoryType.SPECIALTY.value
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -103,11 +106,13 @@ export default {
|
||||
this.comparisonItemList = [
|
||||
{
|
||||
cellTitle: '适用范围',
|
||||
infoId: this.infoId
|
||||
infoId: this.infoId,
|
||||
inventoryType: InventoryType.COMPARISON_ITEM.value
|
||||
},
|
||||
{
|
||||
cellTitle: '定义',
|
||||
infoId: this.infoId
|
||||
infoId: this.infoId,
|
||||
inventoryType: InventoryType.COMPARISON_ITEM.value
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -149,7 +154,8 @@ export default {
|
||||
addSpecialty (index) {
|
||||
this.specialtyList.splice(index + 1, 0, {
|
||||
cellTitle: null,
|
||||
infoId: this.infoId
|
||||
infoId: this.infoId,
|
||||
inventoryType: InventoryType.SPECIALTY.value
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -164,7 +170,8 @@ export default {
|
||||
addComparisonItem (index) {
|
||||
this.comparisonItemList.splice(index + 1, 0, {
|
||||
cellTitle: null,
|
||||
infoId: this.infoId
|
||||
infoId: this.infoId,
|
||||
inventoryType: InventoryType.COMPARISON_ITEM.value
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:confirmLoading="confirmLoading"
|
||||
:ok-text="$t('preservation')"
|
||||
:cancel-text="$t('cancel')"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel">
|
||||
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<!--颜色选择-->
|
||||
<div class="color-box">
|
||||
<div class="color-item" :class="{'color-item-selected': color === '#ff7168'}" @click="handleChangeColor('#ff7168')">
|
||||
<div class="color-item-bg color-red"></div>
|
||||
</div>
|
||||
<div class="color-item" :class="{'color-item-selected': color === 'green'}" @click="handleChangeColor('green')">
|
||||
<div class="color-item-bg color-green"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--文本-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.split.text')">
|
||||
<a-input v-decorator="['compareResult']" :placeholder="$t('pleaseEnter') + $t('docTool.split.text')" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { editComparsionResult } from '../../../../api/documentToolApi'
|
||||
|
||||
export default {
|
||||
name: 'ComparisonResultModal',
|
||||
data () {
|
||||
return {
|
||||
title: this.$t('docTool.customComparison.comparativeAnalysisResult'),
|
||||
width: 500,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
model: {},
|
||||
form: this.$form.createForm(this),
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 3 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 20 }
|
||||
},
|
||||
color: 'green'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open (record) {
|
||||
this.model = Object.assign(this.model, record)
|
||||
this.color = record.color
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(this.model)
|
||||
})
|
||||
},
|
||||
handleOk () {
|
||||
this.form.validateFields((errors, values) => {
|
||||
if (!errors) {
|
||||
this.confirmLoading = true
|
||||
const formData = Object.assign(this.model, values)
|
||||
formData.colour = this.color
|
||||
editComparsionResult(formData).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
this.$emit('ok')
|
||||
this.close()
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
close () {
|
||||
this.visible = false
|
||||
this.form.resetFields()
|
||||
this.color = null
|
||||
},
|
||||
handleChangeColor (value) {
|
||||
this.color = value
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.color-red {
|
||||
background-color: #ff7168;
|
||||
}
|
||||
|
||||
.color-green {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.color-item {
|
||||
height: 50px;
|
||||
margin: 10px;
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.color-item-selected {
|
||||
border: 1px solid rgba(128, 128, 128, 0.5);
|
||||
}
|
||||
|
||||
.color-item-bg {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -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