update 自定义比对

This commit is contained in:
赵霄
2023-10-30 16:44:10 +08:00
parent 51bef13b1b
commit 93496eef14
7 changed files with 189 additions and 140 deletions
+12 -6
View File
@@ -77,21 +77,25 @@ const getCommentList = (params) => getAction('/compare/sarFileCompareResComment/
// 自定义比对-标准列表 // 自定义比对-标准列表
const getCustomComparisonStandardList = (params) => getAction('/customCompare/lawsCustomCompareInfo/queryStandardByInfoId', params) const getCustomComparisonStandardList = (params) => getAction('/customCompare/lawsCustomCompareInfo/queryStandardByInfoId', params)
// 自定义比对-标准列表-删除 // 自定义比对-标准列表-删除
const deleteCustomComparisonStandard = (params) => postAction('/customCompare/lawsCustomCompareInfo/delStandard', params) const deleteCustomComparisonStandard = (params) => getAction('/customCompare/lawsCustomCompareInfo/delStandard', params)
// 自定义比对-特点删除 // 自定义比对-特点删除
const deleteSpecialtyItem = (params) => postAction('', params) const deleteSpecialtyItem = (params) => postAction('/customCompare/lawsCustomCompareInfo/delInventoryById', params)
// 自定义比对-比对项删除 // 自定义比对-比对项删除
const deleteMaintainItem = (params) => postAction('', params) const deleteMaintainItem = (params) => postAction('/customCompare/lawsCustomCompareInfo/delInventoryById', params)
// 自定义比对-表格单元格编辑 // 自定义比对-表格单元格编辑
const editCell = (params) => postAction('', params) const editCell = (params) => postAction('/customCompare/lawsCustomCompareInfo/saveCell', params)
// 自定义比对-保存表单数据 // 自定义比对-保存表单数据
const saveFormData = (params) => postAction('/customCompare/lawsCustomCompareInfo/save', params) const saveFormData = (params) => postAction('/customCompare/lawsCustomCompareInfo/save', params)
// 自定义比对-通过id获取表单数据 // 自定义比对-通过id获取表单数据
const getFormDataById = (params) => getAction('/customCompare/lawsCustomCompareInfo/queryById', params) const getFormDataById = (params) => getAction('/customCompare/lawsCustomCompareInfo/queryById', params)
// 自定义比对-保存标准 // 自定义比对-保存标准
const saveStandard = (params) => getAction('/customCompare/lawsCustomCompareInfo/saveStandard', params) const saveStandard = (params) => postAction('/customCompare/lawsCustomCompareInfo/saveStandard', params)
// 自定义比对-获取复杂表格数据 // 自定义比对-获取复杂表格数据
const getTableData = (params) => getAction('/customCompare/lawsCustomCompareInfo/queryTableDetail', params) const getTableData = (params) => getAction('/customCompare/lawsCustomCompareInfo/queryTableDetail', params)
// 自定义比对-获取特点、对比项列表
const getMaintainList = (params) => getAction('/customCompare/lawsCustomCompareInfo/queryInventory', params)
// 自定义比对-编辑特点、对比项列表
const editMaintainList = (params) => postAction('/customCompare/lawsCustomCompareInfo/editInventory', params)
export { export {
// 文档拆分 // 文档拆分
@@ -144,5 +148,7 @@ export {
saveFormData, saveFormData,
getFormDataById, getFormDataById,
saveStandard, saveStandard,
getTableData getTableData,
getMaintainList,
editMaintainList
} }
+1 -1
View File
@@ -92,7 +92,7 @@ const editProfileCenterTree = (params) => postAction('', params)
// 资料中心-删除树节点 // 资料中心-删除树节点
const deleteProfileCenterTree = (params) => postAction('', params) const deleteProfileCenterTree = (params) => postAction('', params)
// 资料中心-获取树节点树 // 资料中心-获取树节点树
const getProfileCenterTree = (params) => getAction('', params) const getProfileCenterTree = (params) => getAction('/laws/dataCenter/lawsDataCenterFolder/getTreeList', params)
export { export {
// 国内标准 // 国内标准
@@ -54,7 +54,7 @@
{{ toggleSearchStatus ? $t('putAway') : $t('open') }} {{ toggleSearchStatus ? $t('putAway') : $t('open') }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'" /> <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
</a> </a>
<a-button type="primary" @click="searchQuery">{{ $t('query') }}</a-button> <a-button type="primary" @click="searchQuery" v-has="'customComparison:search'">{{ $t('query') }}</a-button>
<a-button style="margin-left: 8px" @click="searchReset">{{ $t('reset') }}</a-button> <a-button style="margin-left: 8px" @click="searchReset">{{ $t('reset') }}</a-button>
</div> </div>
</a-row> </a-row>
@@ -63,7 +63,7 @@
<!--操作按钮--> <!--操作按钮-->
<div class="table-operator"> <div class="table-operator">
<!--新增--> <!--新增-->
<a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button> <a-button icon="plus" type="primary" @click="handleAdd" v-has="'customComparison:add'">{{ $t('newlyAdded') }}</a-button>
</div> </div>
<div> <div>
<j-table <j-table
@@ -148,19 +148,19 @@ export default {
operationList: [ operationList: [
{ // 查看 { // 查看
text: this.$t('view'), text: this.$t('view'),
clickEvent: 'handleDetail' clickEvent: 'handleDetail',
// has: 'enterpriseStandardLibrary:plan:detail' has: 'customComparison:view'
}, },
// 编辑 // 编辑
{ {
text: this.$t('edit'), text: this.$t('edit'),
clickEvent: 'handleEdit' clickEvent: 'handleEdit',
// has: 'documentComparison:edit' has: 'customComparison:edit'
}, },
{ // 删除 { // 删除
text: this.$t('delete'), text: this.$t('delete'),
clickEvent: 'handleDelete' clickEvent: 'handleDelete',
// has: 'enterpriseStandardLibrary:plan:delete' has: 'customComparison:delete'
} }
], ],
url: { url: {
@@ -182,6 +182,11 @@ export default {
this.$refs.modalForm.edit(id) this.$refs.modalForm.edit(id)
this.$refs.modalForm.title = this.$t('edit') this.$refs.modalForm.title = this.$t('edit')
this.$refs.modalForm.disableSubmit = false this.$refs.modalForm.disableSubmit = false
},
handleDetail ({ id }) {
this.$refs.modalForm.edit(id)
this.$refs.modalForm.title = this.$t('details')
this.$refs.modalForm.disableSubmit = false
} }
} }
} }
@@ -11,11 +11,11 @@
<div class="custom-drawer-style-scroll"> <div class="custom-drawer-style-scroll">
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-form :form="form"> <a-form-model>
<!--特点--> <!--特点-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.specialty')"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.specialty')">
<div v-for="(item, index) in specialtyList" :key="index" class="form-wrapper"> <div v-for="(item, index) in specialtyList" :key="index" class="form-wrapper">
<a-input v-decorator="[`specialtyList[${index}].proertyVal`]" <a-input v-model="specialtyList[index].cellTitle"
:maxLength="50" :maxLength="50"
@change="e => {e.target.value = (e.target.value + '').trim()}" /> @change="e => {e.target.value = (e.target.value + '').trim()}" />
<a-button @click="addSpecialty(index)">{{ $t('newlyAdded') }}</a-button> <a-button @click="addSpecialty(index)">{{ $t('newlyAdded') }}</a-button>
@@ -23,12 +23,12 @@
{{ $t('delete') }} {{ $t('delete') }}
</a-button> </a-button>
</div> </div>
</a-form-item> </a-form-model-item>
<a-divider dashed /> <a-divider dashed />
<!--比对项--> <!--比对项-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.comparisonItem')"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.comparisonItem')">
<div v-for="(item, index) in comparisonItemList" :key="index" class="form-wrapper"> <div v-for="(item, index) in comparisonItemList" :key="index" class="form-wrapper">
<a-input v-decorator="[`comparisonItemList[${index}].proertyVal`]" <a-input v-model="comparisonItemList[index].cellTitle"
:maxLength="50" :maxLength="50"
@change="e => {e.target.value = (e.target.value + '').trim()}" /> @change="e => {e.target.value = (e.target.value + '').trim()}" />
<a-button @click="addComparisonItem(index)">{{ $t('newlyAdded') }}</a-button> <a-button @click="addComparisonItem(index)">{{ $t('newlyAdded') }}</a-button>
@@ -36,8 +36,8 @@
{{ $t('delete') }} {{ $t('delete') }}
</a-button> </a-button>
</div> </div>
</a-form-item> </a-form-model-item>
</a-form> </a-form-model>
</a-spin> </a-spin>
</div> </div>
@@ -51,6 +51,8 @@
</template> </template>
<script> <script>
import { getMaintainList, editMaintainList } from '../../../../api/documentToolApi'
export default { export default {
name: 'ComparisonMaintainDrawer', name: 'ComparisonMaintainDrawer',
data () { data () {
@@ -59,7 +61,6 @@ export default {
confirmLoading: false, confirmLoading: false,
width: 900, width: 900,
visible: false, visible: false,
form: this.$form.createForm(this),
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 2 } sm: { span: 2 }
@@ -69,55 +70,77 @@ export default {
sm: { span: 22 } sm: { span: 22 }
}, },
specialtyList: [], // 特点 specialtyList: [], // 特点
comparisonItemList: [] // 比对项 comparisonItemList: [], // 比对项
infoId: null // 最外层数据的id,
} }
}, },
methods: { methods: {
open () { open (id) {
this.visible = true this.visible = true
this.infoId = id
this.initList() this.initList()
}, },
initList () { initList () {
// 如果没有数据,就默认给俩 this.confirmLoading = true
if (this.specialtyList.length === 0) { getMaintainList({ infoId: this.infoId }).then(res => {
this.specialtyList = [ if (res.success) {
{ this.specialtyList = res.result['特点']
proertyVal: '章节' this.comparisonItemList = res.result['对比项']
}, // 如果没有数据,就默认给俩
{ if (this.specialtyList.length === 0) {
proertyVal: '法规内容' this.specialtyList = [
{
cellTitle: '章节',
infoId: this.infoId
},
{
cellTitle: '法规内容',
infoId: this.infoId
}
]
} }
] if (this.comparisonItemList.length === 0) {
} this.comparisonItemList = [
if (this.comparisonItemList.length === 0) { {
this.comparisonItemList = [ cellTitle: '适用范围',
{ infoId: this.infoId
proertyVal: '适用范围' },
}, {
{ cellTitle: '定义',
proertyVal: '定义' infoId: this.infoId
}
]
} }
] } else {
} this.$message.warning(res.message)
this.$nextTick(() => { }
this.form.setFieldsValue({ }).finally(() => {
specialtyList: this.specialtyList, this.confirmLoading = false
comparisonItemList: this.comparisonItemList
})
}) })
}, },
handleCancel () { handleCancel () {
this.close() this.close()
}, },
close() { close () {
this.visible = false this.visible = false
this.form.resetFields()
}, },
handleOk () { handleOk () {
this.form.validateFields((errors, values) => { this.confirmLoading = true
if (!errors) { const formData = {
console.log(values) '对比项': this.comparisonItemList,
'特点': this.specialtyList,
infoId: this.infoId
}
editMaintainList(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
}) })
}, },
/** /**
@@ -125,14 +148,8 @@ export default {
*/ */
addSpecialty (index) { addSpecialty (index) {
this.specialtyList.splice(index + 1, 0, { this.specialtyList.splice(index + 1, 0, {
proertyVal: null cellTitle: null,
}) infoId: this.infoId
const formData = this.form.getFieldValue('specialtyList')
formData.splice(index + 1, 0, {
proertyVal: null
})
this.$nextTick(() => {
this.form.setFieldsValue({ specialtyList: formData })
}) })
}, },
/** /**
@@ -140,25 +157,14 @@ export default {
*/ */
deleteSpecialty (index) { deleteSpecialty (index) {
this.specialtyList.splice(index, 1) this.specialtyList.splice(index, 1)
const formData = this.form.getFieldValue('specialtyList')
formData.splice(index, 1)
this.$nextTick(() => {
this.form.setFieldsValue({ specialtyList: formData })
})
}, },
/** /**
* 新增比对项 * 新增比对项
*/ */
addComparisonItem (index) { addComparisonItem (index) {
this.comparisonItemList.splice(index + 1, 0, { this.comparisonItemList.splice(index + 1, 0, {
proertyVal: null cellTitle: null,
}) infoId: this.infoId
const formData = this.form.getFieldValue('comparisonItemList')
formData.splice(index + 1, 0, {
proertyVal: null
})
this.$nextTick(() => {
this.form.setFieldsValue({ comparisonItemList: formData })
}) })
}, },
/** /**
@@ -166,11 +172,6 @@ export default {
*/ */
deleteComparisonItem (index) { deleteComparisonItem (index) {
this.comparisonItemList.splice(index, 1) this.comparisonItemList.splice(index, 1)
const formData = this.form.getFieldValue('comparisonItemList')
formData.splice(index, 1)
this.$nextTick(() => {
this.form.setFieldsValue({ comparisonItemList: formData })
})
} }
} }
} }
@@ -183,12 +184,12 @@ export default {
margin-bottom: 0; margin-bottom: 0;
} }
.form-wrapper { /deep/ .form-wrapper {
display: flex; display: flex;
margin: 3px 0 20px; margin: 3px 0 20px;
} }
.form-wrapper > .ant-input { /deep/ .form-wrapper > .ant-input {
flex: 1; flex: 1;
width: 0; width: 0;
} }
@@ -14,8 +14,9 @@
<a-form :form="form"> <a-form :form="form">
<!--文本--> <!--文本-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.split.text')"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.split.text')">
<a-input v-decorator="[`text`]" <a-input v-decorator="[`content`]"
:maxLength="50" :maxLength="50"
:disabled="!isEdit"
:placeholder="$t('pleaseEnter') + $t('docTool.split.text')" :placeholder="$t('pleaseEnter') + $t('docTool.split.text')"
@change="e => {e.target.value = (e.target.value + '').trim()}" /> @change="e => {e.target.value = (e.target.value + '').trim()}" />
</a-form-item> </a-form-item>
@@ -23,13 +24,13 @@
<a-form-item :labelCol="labelCol" <a-form-item :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
:label="$t('docTool.customComparison.relatedAccessory')"> :label="$t('docTool.customComparison.relatedAccessory')">
<j-upload return-id v-decorator="[`fileId`]" /> <j-upload return-id v-decorator="[`fileId`]" :disabled="!isEdit"/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-spin> </a-spin>
</div> </div>
<div class="custom-drawer-style-bottom-btn"> <div class="custom-drawer-style-bottom-btn" v-if="isEdit">
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;" :loading="confirmLoading"> <a-button @click="handleOk" type="primary" style="margin-bottom: 0;" :loading="confirmLoading">
{{ $t('preservation') }} {{ $t('preservation') }}
</a-button> </a-button>
@@ -58,12 +59,17 @@ export default {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 18 } sm: { span: 18 }
}, },
model: {} model: {},
isEdit: true
} }
}, },
methods: { methods: {
open (record) { open (record, isEdit) {
this.visible = true this.visible = true
this.isEdit = isEdit
if (!this.isEdit) {
this.title = this.$t('details')
}
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(this.model) this.form.setFieldsValue(this.model)
@@ -17,12 +17,14 @@
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.customComparison.listName')" <a-input :placeholder="$t('pleaseEnter') + $t('docTool.customComparison.listName')"
@change="event => event.target.value = event.target.value.trim()" @change="event => event.target.value = event.target.value.trim()"
:maxLength="50" :maxLength="50"
:disabled="isDetail"
v-decorator="['listName', validatorRules.listName]" /> v-decorator="['listName', validatorRules.listName]" />
</a-form-item> </a-form-item>
<!--涉及标准--> <!--涉及标准-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.referenceStandard')"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.referenceStandard')">
<standard-selection :placeholder="$t('pleaseSelect') + $t('docTool.customComparison.referenceStandard')" <standard-selection :placeholder="$t('pleaseSelect') + $t('docTool.customComparison.referenceStandard')"
v-decorator="['referenceStandard', validatorRules.referenceStandard]" v-decorator="['referenceStandard', validatorRules.referenceStandard]"
:disabled="isDetail"
@change="handleStandardChange" /> @change="handleStandardChange" />
</a-form-item> </a-form-item>
<!--涉及国家--> <!--涉及国家-->
@@ -45,19 +47,19 @@
:placeholder="$t('pleaseSelect')+$t('docTool.customComparison.whetherToMakePublic')" :placeholder="$t('pleaseSelect')+$t('docTool.customComparison.whetherToMakePublic')"
type="radio" type="radio"
:triggerChange="false" :triggerChange="false"
:disabled="isDetail"
dict-code="yn" /> dict-code="yn" />
</a-form-item> </a-form-item>
<!--在线对比--> <!--在线对比-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.onlineComparison')"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.onlineComparison')">
<a-switch default-checked v-model="isStartComparison" @change="handleSwitchChange" /> <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> </a-form-item>
<div v-show="isStartComparison" class="comparison-box"> <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">{{ <a-button type="primary" ghost @click="viewStandardList">
$t('docTool.customComparison.standardList') {{ $t('docTool.customComparison.standardList') }}
}}
</a-button> </a-button>
<!--对比维护--> <!--对比维护-->
<a-button type="primary" ghost @click="handleComparisonMaintain"> <a-button type="primary" ghost @click="handleComparisonMaintain">
@@ -87,8 +89,8 @@
<template :slot="`specialtyItem${standardIndex}${specialtyItemIndex}`"> <template :slot="`specialtyItem${standardIndex}${specialtyItemIndex}`">
<div class="column-cell"> <div class="column-cell">
<a-tooltip overlay-class-name="tooltip-style"> <a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ specialtyItem.proertyVal }}</template> <template slot="title">{{ specialtyItem.cellTitle }}</template>
<div class="column-text">{{ specialtyItem.proertyVal }}</div> <div class="column-text">{{ specialtyItem.cellTitle }}</div>
</a-tooltip> </a-tooltip>
<a-icon type="close" v-show="isEdit" @click="handleDeleteSpecialty(specialtyItem)" /> <a-icon type="close" v-show="isEdit" @click="handleDeleteSpecialty(specialtyItem)" />
</div> </div>
@@ -107,14 +109,6 @@
</div> </div>
</template> </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"> <template v-slot:resultCell="text, record">
<a-tooltip overlay-class-name="tooltip-style"> <a-tooltip overlay-class-name="tooltip-style">
@@ -132,7 +126,7 @@
</div> </div>
<!--标准列表--> <!--标准列表-->
<standard-list-drawer ref="standardListDrawer" @delete="handleDeleteStandard" /> <standard-list-drawer ref="standardListDrawer" @ok="reloadData" />
<!--对比维护--> <!--对比维护-->
<comparison-maintain-drawer ref="comparisonMaintainDrawer" @ok="reloadTableData" /> <comparison-maintain-drawer ref="comparisonMaintainDrawer" @ok="reloadTableData" />
<!--单元格数据处理--> <!--单元格数据处理-->
@@ -146,12 +140,12 @@ import { downFile } from '../../../../api/manage'
import StandardListDrawer from './StandardListDrawer' import StandardListDrawer from './StandardListDrawer'
import ComparisonMaintainDrawer from './ComparisonMaintainDrawer' import ComparisonMaintainDrawer from './ComparisonMaintainDrawer'
import { import {
deleteSpecialtyItem,
deleteMaintainItem, deleteMaintainItem,
saveFormData, deleteSpecialtyItem,
getFormDataById, getFormDataById,
saveStandard, getTableData,
getTableData saveFormData,
saveStandard
} from '../../../../api/documentToolApi' } from '../../../../api/documentToolApi'
import CustomComparisonCellDrawer from './CustomComparisonCellDrawer' import CustomComparisonCellDrawer from './CustomComparisonCellDrawer'
import { getFormDictTreeList } from '../../../../api/api' import { getFormDictTreeList } from '../../../../api/api'
@@ -201,12 +195,18 @@ export default {
}, },
isStartComparison: false, // 是否发起比对,为是的时候显示下面的内容 isStartComparison: false, // 是否发起比对,为是的时候显示下面的内容
isEdit: false, // 是否在编辑状态里 isEdit: false, // 是否在编辑状态里
isDetail: false, // 是否查看
standardList: [], // 标准的列表 standardList: [], // 标准的列表
specialtyItemList: [], // 特点的列表(三级表头) specialtyItemList: [], // 特点的列表(三级表头)
isFirstOpenComparison: true, // 第一次打开在线比对 isFirstOpenComparison: true, // 第一次打开在线比对
countryTreeData: [] // 涉及国家数据 countryTreeData: [] // 涉及国家数据
} }
}, },
watch: {
title() {
this.isDetail = this.title === this.$t('details')
}
},
methods: { methods: {
add () { add () {
this.visible = true this.visible = true
@@ -294,35 +294,32 @@ export default {
console.log(this.form.getFieldValue('serialNumber')) console.log(this.form.getFieldValue('serialNumber'))
this.$refs.standardListDrawer.open(this.modal.id) 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 () { reloadTableData () {
this.initTableData() this.initTableData()
}, },
/**
* 重新加载所有数据
*/
reloadData () {
this.getFormData()
this.initTableData()
},
/** /**
* 对比维护 * 对比维护
*/ */
handleComparisonMaintain () { handleComparisonMaintain () {
this.$refs.comparisonMaintainDrawer.open() this.$refs.comparisonMaintainDrawer.open(this.modal.id)
}, },
/** /**
* 处理页面需要用到的数据 * 处理页面需要用到的数据
* @param result * @param result
*/ */
processData (result) { processData (result) {
this.standardList = Object.values(result.countryMap).reduce((acc, cur) => acc.concat(cur), []) this.standardList = Object.values(result.countryMap || {}).reduce((acc, cur) => acc.concat(cur), [])
this.specialtyItemList = result.ranksMap.NATURE || [] this.specialtyItemList = result.ranksMap.特点 || []
}, },
/** /**
* 处理表头和表格数据 * 处理表头和表格数据
@@ -333,7 +330,8 @@ export default {
this.columns = [ this.columns = [
{ title: '', width: 100, dataIndex: 'maintainItem', scopedSlots: { customRender: 'deleteCell' } } { 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 => { countryList.forEach(country => {
const countryStandardList = result.countryMap[country] const countryStandardList = result.countryMap[country]
@@ -354,7 +352,15 @@ export default {
dataIndex: `${standard.standardNumber}-${specialtyItem.id}-label`, dataIndex: `${standard.standardNumber}-${specialtyItem.id}-label`,
slots: { title: 'specialtyItem' + standardIndex + specialtyItemIndex }, slots: { title: 'specialtyItem' + standardIndex + specialtyItemIndex },
width: 200, width: 200,
scopedSlots: { customRender: 'cell' } customCell (record) {
return {
on: {
click: () => {
_this.handleEditCell(standard, specialtyItem, record)
}
}
}
}
}) })
}) })
} }
@@ -367,13 +373,13 @@ export default {
// 处理表格数据 // 处理表格数据
// 把比对项的数据放在里面,对比项取proertyVal为显示字段,其余属性用数据本身的 // 把比对项的数据放在里面,对比项取proertyVal为显示字段,其余属性用数据本身的
const maintainItemList = result.ranksMap.ITEM || [] const maintainItemList = result.ranksMap.对比项 || []
// 有多少对比项决定了有多少行数据 // 有多少对比项决定了有多少行数据
this.dataSource = maintainItemList.map(maintainData => { this.dataSource = maintainItemList.map(maintainData => {
// 第一列数据,用对象留存一下 // 第一列数据,用对象留存一下
const maintainObj = { const maintainObj = {
maintainData, // 维护项的数据 maintainData, // 维护项的数据
maintainItem: maintainData.proertyVal, // 维护项显示字段 maintainItem: maintainData.cellTitle, // 维护项显示字段
color: maintainData.color, // 对比分析结果列的背景颜色 color: maintainData.color, // 对比分析结果列的背景颜色
result: maintainData.result // 对比分析结果文本 result: maintainData.result // 对比分析结果文本
} }
@@ -381,12 +387,11 @@ export default {
const listData = result.list.filter(tt => tt.itemId === maintainData.id) const listData = result.list.filter(tt => tt.itemId === maintainData.id)
const obj = {} const obj = {}
listData.forEach(item => { listData.forEach(item => {
obj[`${item.sarNumber}-${item.natureId}-label`] = item.formContent obj[`${item.standardId}-${item.compareItemId}-label`] = item.formContent
obj[`${item.sarNumber}-${item.natureId}`] = item obj[`${item.standardId}-${item.compareItemId}`] = item
}) })
const line = { ...maintainObj, ...obj } return { ...maintainObj, ...obj }
return line
}) })
}, },
/** /**
@@ -426,15 +431,21 @@ export default {
}, },
/** /**
* 点击编辑单元格数据 * 点击编辑单元格数据
* @param record * @param standard 标准信息
* @param specialtyItem 特点信息
* @param record 行数据内容,包含对比项数据
*/ */
handleEditCell (text, record) { handleEditCell (standard, specialtyItem, record) {
const columnDataIndex = Object.keys(record).find(key => record[key] === text) const params = {
let cellData = {} compareItemId: record.maintainData.id,
if (columnDataIndex) { featureId: specialtyItem.id,
cellData = record[columnDataIndex.replace('-label', '')] 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) { handleStandardChange (value) {
this.confirmLoading = true this.confirmLoading = true
const params = this.form.getFieldsValue() const params = {
lawsCustomCompareInfo: Object.assign(this.modal, this.form.getFieldsValue())
}
params.standardNumber = value params.standardNumber = value
saveStandard(params).then(res => { saveStandard(params).then(res => {
if (res.success) { if (res.success) {
this.$message.success(res.message) this.$message.success(res.message)
this.modal.id = res.result
this.getFormData() this.getFormData()
this.reloadTableData() this.reloadTableData()
} else { } else {
@@ -537,7 +551,7 @@ export default {
*/ */
initTableData () { initTableData () {
this.confirmLoading = true this.confirmLoading = true
getTableData({ id: this.modal.id }).then(res => { getTableData({ infoId: this.modal.id }).then(res => {
if (res.success) { if (res.success) {
// 平铺一些数据 // 平铺一些数据
this.processData(res.result || {}) this.processData(res.result || {})
@@ -549,6 +563,9 @@ export default {
}).finally(() => { }).finally(() => {
this.confirmLoading = false this.confirmLoading = false
}) })
},
customCell (record, rowIndex) {
console.log(record, rowIndex)
} }
} }
} }
@@ -133,6 +133,7 @@ export default {
* @param record * @param record
*/ */
operationClick (operation, record) { operationClick (operation, record) {
console.log(record)
if (operation.clickEvent === 'handleDelete') { if (operation.clickEvent === 'handleDelete') {
this.handleDelete(record.id) this.handleDelete(record.id)
} else { } else {
@@ -143,7 +144,7 @@ export default {
* 删除 * 删除
* @param id * @param id
*/ */
handleDelete ({ id }) { handleDelete (id) {
this.$confirm({ this.$confirm({
title: this.$t('confirmDeletion'), title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'), content: this.$t('areYouSure'),
@@ -160,6 +161,8 @@ export default {
if (this.ipagination.current > 1 && ((this.ipagination.current - 1) * this.ipagination.pageSize) + 1 === this.ipagination.total) { if (this.ipagination.current > 1 && ((this.ipagination.current - 1) * this.ipagination.pageSize) + 1 === this.ipagination.total) {
this.ipagination.current -= 1 this.ipagination.current -= 1
} }
this.loadData()
this.$emit('ok')
} else { } else {
this.$message.warning(res.message) this.$message.warning(res.message)
} }
@@ -210,7 +213,7 @@ export default {
const params = { const params = {
pageNo: this.ipagination.current, pageNo: this.ipagination.current,
pageSize: this.ipagination.pageSize, pageSize: this.ipagination.pageSize,
id: this.infoId infoId: this.infoId
} }
getCustomComparisonStandardList(params).then(res => { getCustomComparisonStandardList(params).then(res => {
if (res.success) { if (res.success) {
@@ -234,4 +237,15 @@ export default {
<style scoped lang="less"> <style scoped lang="less">
@import '~@assets/less/common.less'; @import '~@assets/less/common.less';
/deep/ .ant-table-tbody > tr > td {
padding: 12px 8px !important;
}
.table-text {
padding: 12px 8px;
}
/deep/ .action-span-cell {
padding: 12px 8px;
}
</style> </style>