update 自定义比对
This commit is contained in:
@@ -77,21 +77,25 @@ const getCommentList = (params) => getAction('/compare/sarFileCompareResComment/
|
||||
// 自定义比对-标准列表
|
||||
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)
|
||||
// 自定义比对-通过id获取表单数据
|
||||
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 getMaintainList = (params) => getAction('/customCompare/lawsCustomCompareInfo/queryInventory', params)
|
||||
// 自定义比对-编辑特点、对比项列表
|
||||
const editMaintainList = (params) => postAction('/customCompare/lawsCustomCompareInfo/editInventory', params)
|
||||
|
||||
export {
|
||||
// 文档拆分
|
||||
@@ -144,5 +148,7 @@ export {
|
||||
saveFormData,
|
||||
getFormDataById,
|
||||
saveStandard,
|
||||
getTableData
|
||||
getTableData,
|
||||
getMaintainList,
|
||||
editMaintainList
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ const editProfileCenterTree = (params) => postAction('', params)
|
||||
// 资料中心-删除树节点
|
||||
const deleteProfileCenterTree = (params) => postAction('', params)
|
||||
// 资料中心-获取树节点树
|
||||
const getProfileCenterTree = (params) => getAction('', params)
|
||||
const getProfileCenterTree = (params) => getAction('/laws/dataCenter/lawsDataCenterFolder/getTreeList', params)
|
||||
|
||||
export {
|
||||
// 国内标准
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
{{ toggleSearchStatus ? $t('putAway') : $t('open') }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
|
||||
</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>
|
||||
</div>
|
||||
</a-row>
|
||||
@@ -63,7 +63,7 @@
|
||||
<!--操作按钮-->
|
||||
<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>
|
||||
<j-table
|
||||
@@ -148,19 +148,19 @@ export default {
|
||||
operationList: [
|
||||
{ // 查看
|
||||
text: this.$t('view'),
|
||||
clickEvent: 'handleDetail'
|
||||
// has: 'enterpriseStandardLibrary:plan:detail'
|
||||
clickEvent: 'handleDetail',
|
||||
has: 'customComparison:view'
|
||||
},
|
||||
// 编辑
|
||||
{
|
||||
text: this.$t('edit'),
|
||||
clickEvent: 'handleEdit'
|
||||
// has: 'documentComparison:edit'
|
||||
clickEvent: 'handleEdit',
|
||||
has: 'customComparison:edit'
|
||||
},
|
||||
{ // 删除
|
||||
text: this.$t('delete'),
|
||||
clickEvent: 'handleDelete'
|
||||
// has: 'enterpriseStandardLibrary:plan:delete'
|
||||
clickEvent: 'handleDelete',
|
||||
has: 'customComparison:delete'
|
||||
}
|
||||
],
|
||||
url: {
|
||||
@@ -182,6 +182,11 @@ export default {
|
||||
this.$refs.modalForm.edit(id)
|
||||
this.$refs.modalForm.title = this.$t('edit')
|
||||
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">
|
||||
<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">
|
||||
<a-input v-decorator="[`specialtyList[${index}].proertyVal`]"
|
||||
<a-input v-model="specialtyList[index].cellTitle"
|
||||
:maxLength="50"
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}" />
|
||||
<a-button @click="addSpecialty(index)">{{ $t('newlyAdded') }}</a-button>
|
||||
@@ -23,12 +23,12 @@
|
||||
{{ $t('delete') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-form-model-item>
|
||||
<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">
|
||||
<a-input v-decorator="[`comparisonItemList[${index}].proertyVal`]"
|
||||
<a-input v-model="comparisonItemList[index].cellTitle"
|
||||
:maxLength="50"
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}" />
|
||||
<a-button @click="addComparisonItem(index)">{{ $t('newlyAdded') }}</a-button>
|
||||
@@ -36,8 +36,8 @@
|
||||
{{ $t('delete') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</a-spin>
|
||||
</div>
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMaintainList, editMaintainList } from '../../../../api/documentToolApi'
|
||||
|
||||
export default {
|
||||
name: 'ComparisonMaintainDrawer',
|
||||
data () {
|
||||
@@ -59,7 +61,6 @@ export default {
|
||||
confirmLoading: false,
|
||||
width: 900,
|
||||
visible: false,
|
||||
form: this.$form.createForm(this),
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 2 }
|
||||
@@ -69,55 +70,77 @@ export default {
|
||||
sm: { span: 22 }
|
||||
},
|
||||
specialtyList: [], // 特点
|
||||
comparisonItemList: [] // 比对项
|
||||
comparisonItemList: [], // 比对项
|
||||
infoId: null // 最外层数据的id,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open () {
|
||||
open (id) {
|
||||
this.visible = true
|
||||
this.infoId = id
|
||||
this.initList()
|
||||
},
|
||||
initList () {
|
||||
// 如果没有数据,就默认给俩
|
||||
if (this.specialtyList.length === 0) {
|
||||
this.specialtyList = [
|
||||
{
|
||||
proertyVal: '章节'
|
||||
},
|
||||
{
|
||||
proertyVal: '法规内容'
|
||||
this.confirmLoading = true
|
||||
getMaintainList({ infoId: this.infoId }).then(res => {
|
||||
if (res.success) {
|
||||
this.specialtyList = res.result['特点']
|
||||
this.comparisonItemList = res.result['对比项']
|
||||
// 如果没有数据,就默认给俩
|
||||
if (this.specialtyList.length === 0) {
|
||||
this.specialtyList = [
|
||||
{
|
||||
cellTitle: '章节',
|
||||
infoId: this.infoId
|
||||
},
|
||||
{
|
||||
cellTitle: '法规内容',
|
||||
infoId: this.infoId
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
if (this.comparisonItemList.length === 0) {
|
||||
this.comparisonItemList = [
|
||||
{
|
||||
proertyVal: '适用范围'
|
||||
},
|
||||
{
|
||||
proertyVal: '定义'
|
||||
if (this.comparisonItemList.length === 0) {
|
||||
this.comparisonItemList = [
|
||||
{
|
||||
cellTitle: '适用范围',
|
||||
infoId: this.infoId
|
||||
},
|
||||
{
|
||||
cellTitle: '定义',
|
||||
infoId: this.infoId
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({
|
||||
specialtyList: this.specialtyList,
|
||||
comparisonItemList: this.comparisonItemList
|
||||
})
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
close() {
|
||||
close () {
|
||||
this.visible = false
|
||||
this.form.resetFields()
|
||||
},
|
||||
handleOk () {
|
||||
this.form.validateFields((errors, values) => {
|
||||
if (!errors) {
|
||||
console.log(values)
|
||||
this.confirmLoading = true
|
||||
const formData = {
|
||||
'对比项': 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) {
|
||||
this.specialtyList.splice(index + 1, 0, {
|
||||
proertyVal: null
|
||||
})
|
||||
const formData = this.form.getFieldValue('specialtyList')
|
||||
formData.splice(index + 1, 0, {
|
||||
proertyVal: null
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ specialtyList: formData })
|
||||
cellTitle: null,
|
||||
infoId: this.infoId
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -140,25 +157,14 @@ export default {
|
||||
*/
|
||||
deleteSpecialty (index) {
|
||||
this.specialtyList.splice(index, 1)
|
||||
const formData = this.form.getFieldValue('specialtyList')
|
||||
formData.splice(index, 1)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ specialtyList: formData })
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 新增比对项
|
||||
*/
|
||||
addComparisonItem (index) {
|
||||
this.comparisonItemList.splice(index + 1, 0, {
|
||||
proertyVal: null
|
||||
})
|
||||
const formData = this.form.getFieldValue('comparisonItemList')
|
||||
formData.splice(index + 1, 0, {
|
||||
proertyVal: null
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ comparisonItemList: formData })
|
||||
cellTitle: null,
|
||||
infoId: this.infoId
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -166,11 +172,6 @@ export default {
|
||||
*/
|
||||
deleteComparisonItem (index) {
|
||||
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;
|
||||
}
|
||||
|
||||
.form-wrapper {
|
||||
/deep/ .form-wrapper {
|
||||
display: flex;
|
||||
margin: 3px 0 20px;
|
||||
}
|
||||
|
||||
.form-wrapper > .ant-input {
|
||||
/deep/ .form-wrapper > .ant-input {
|
||||
flex: 1;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
<a-form :form="form">
|
||||
<!--文本-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.split.text')">
|
||||
<a-input v-decorator="[`text`]"
|
||||
<a-input v-decorator="[`content`]"
|
||||
:maxLength="50"
|
||||
:disabled="!isEdit"
|
||||
:placeholder="$t('pleaseEnter') + $t('docTool.split.text')"
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}" />
|
||||
</a-form-item>
|
||||
@@ -23,13 +24,13 @@
|
||||
<a-form-item :labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
: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>
|
||||
</a-spin>
|
||||
</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">
|
||||
{{ $t('preservation') }}
|
||||
</a-button>
|
||||
@@ -58,12 +59,17 @@ export default {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 }
|
||||
},
|
||||
model: {}
|
||||
model: {},
|
||||
isEdit: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open (record) {
|
||||
open (record, isEdit) {
|
||||
this.visible = true
|
||||
this.isEdit = isEdit
|
||||
if (!this.isEdit) {
|
||||
this.title = this.$t('details')
|
||||
}
|
||||
this.model = Object.assign({}, record)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(this.model)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@ export default {
|
||||
* @param record
|
||||
*/
|
||||
operationClick (operation, record) {
|
||||
console.log(record)
|
||||
if (operation.clickEvent === 'handleDelete') {
|
||||
this.handleDelete(record.id)
|
||||
} else {
|
||||
@@ -143,7 +144,7 @@ export default {
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
handleDelete ({ id }) {
|
||||
handleDelete (id) {
|
||||
this.$confirm({
|
||||
title: this.$t('confirmDeletion'),
|
||||
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) {
|
||||
this.ipagination.current -= 1
|
||||
}
|
||||
this.loadData()
|
||||
this.$emit('ok')
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
@@ -210,7 +213,7 @@ export default {
|
||||
const params = {
|
||||
pageNo: this.ipagination.current,
|
||||
pageSize: this.ipagination.pageSize,
|
||||
id: this.infoId
|
||||
infoId: this.infoId
|
||||
}
|
||||
getCustomComparisonStandardList(params).then(res => {
|
||||
if (res.success) {
|
||||
@@ -234,4 +237,15 @@ export default {
|
||||
<style scoped lang="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>
|
||||
Reference in New Issue
Block a user