Initial commit

This commit is contained in:
danshihao
2024-06-11 15:39:01 +08:00
commit 00acf31aa3
1589 changed files with 520803 additions and 0 deletions
@@ -0,0 +1,569 @@
<template>
<internal-detail-page :loading="loading" :title="$t('docTool.comparison.comparisonResults')" :content-padding="0">
<template #titleRightCustom>
<!--查看差异项-->
<a-button type="primary"
ghost
class="header-btn"
icon="eye"
@click="viewVarianceAssessmentClick"
v-has="'docComparison:result:viewVarianceAssessment'">
{{ $t('docTool.comparison.viewVarianceAssessment') }}
</a-button>
<!--查看一致项-->
<a-button type="primary"
ghost
class="header-btn"
icon="eye"
@click="viewConsistentAssessmentClick"
v-has="'docComparison:result:viewConsistentAssessment'">
{{ $t('docTool.comparison.viewConsistentAssessment') }}
</a-button>
<!--查看全部-->
<a-button type="primary" ghost class="header-btn" icon="eye" @click="viewAllClick" v-has="'docComparison:result:viewAll'">
{{ $t('docTool.comparison.viewAll') }}
</a-button>
<!--导出对比报告-->
<a-button type="primary"
ghost
class="header-btn"
icon="export"
@click="exportComparisonReportClick"
v-has="'docComparison:result:exportComparisonReport'">
{{ $t('docTool.comparison.exportComparisonReport') }}
</a-button>
<!--评论-->
<a-button type="primary" ghost class="header-btn" icon="message" @click="commentClick" v-has="'docComparison:result:comment'">
{{ $t('docTool.comparison.comment') }}
</a-button>
</template>
<div class="result-content">
<div class="result-content-header" :class="{'result-content-header-has-scroll': hasScrollBar}">
<a-checkbox @change="onChange" :indeterminate="indeterminate" :checked="checkAll"></a-checkbox>
<div class="result-content-header-content">
<div class="result-content-header-content-item result-content-header-content-item-standard"
:title="resultData.serialNumberLeft + resultData.fileNameLeft"
:class="{'result-content-header-content-item-no-operation': isDisplay}">
{{ $t('docTool.comparison.selectedStandard') }}{{ resultData.serialNumberLeft }}
<!--点击文件名可以预览-->
<span style="cursor: pointer"
@click="fileClick(resultData.fileNameLeft,resultData.fileIdLeft)">{{ resultData.fileNameLeft }}</span>
</div>
<div class="result-content-header-content-item result-content-header-content-item-standard"
:title="resultData.serialNumberRight + resultData.fileNameRight"
:class="{'result-content-header-content-item-no-operation':isDisplay}">
{{ $t('docTool.comparison.selectedStandard') }}{{ resultData.serialNumberRight }}
<span style="cursor: pointer"
@click="fileClick(resultData.fileNameRight,resultData.fileIdRight)">{{ resultData.fileNameRight }}</span>
</div>
<div class="result-content-header-content-item result-content-header-content-item-comment"
:title="$t('docTool.comparison.comparisonDifferenceComment')">
{{ $t('docTool.comparison.comparisonDifferenceComment') }}
</div>
<div class="result-content-header-content-item result-content-header-content-item-operation" v-if="!isDisplay">
{{ $t('operation') }}
</div>
</div>
</div>
<!--条款对比内容-->
<div class="scroll-content">
<a-checkbox-group @change="checkboxChange" v-model="checkboxList">
<div class="clause-item" v-for="(item,index) in resultData.resList" :key="index">
<a-checkbox :value="item.id" class="clause-item-checkbox"></a-checkbox>
<div class="clause-item-content" :class="{'clause-item-content-selected':checkboxList.join(',').includes(item.id)}">
<!--内容isDisplay===true时不显示操作列内容部分宽度设为100%-->
<!--第一个标准的内容-->
<div class="clause-item-content-standard" :class="{'clause-item-content-standard-no-operation': isDisplay}">
<div class="clause-item-content-standard-title">
<span>{{ item.itemsNumLeft }}</span>
<span style="margin-left: 10px">{{ item.itemsNameLeft }}</span>
</div>
<div class="clause-item-content-text" v-html="item.itemsTextLeft"></div>
</div>
<!--第二个标准的内容-->
<div class="clause-item-content-standard" :class="{'clause-item-content-standard-no-operation': isDisplay}">
<div class="clause-item-content-standard-title">
<span>{{ item.itemsNumRight }}</span>
<span style="margin-left: 10px">{{ item.itemsNameRight }}</span>
</div>
<div class="clause-item-content-text" v-html="item.itemsTextRight"></div>
</div>
<!--对比差异评论-->
<div class="clause-item-content-comment">
<div class="clause-item-content-text">
{{ item.comment }}
</div>
</div>
<!--操作-->
<div class="clause-item-content-operation" v-if="!isDisplay">
<!--编辑-->
<a class="text-button" @click="comparaEdit(item)" v-has="'docComparison:result:edit'">{{ $t('edit') }}</a>
<!--删除-->
<a class="text-button" @click="comparaDelete(item)" v-has="'docComparison:result:delete'">{{ $t('delete') }}</a>
</div>
</div>
</div>
</a-checkbox-group>
</div>
<!--全文评论部分-->
<div class="clause-item full-text-review">
<a-checkbox @change="fullCheckboxChange" v-model="fullCheckbox" class="clause-item-checkbox"></a-checkbox>
<div class="full-text-review-content" :class="{'clause-item-content-selected':fullCheckbox}">
<div class="full-text-review-text" :class="{'full-text-review-text-no-operation':isDisplay}">
<a-tooltip>
<template #title>{{ $t('docTool.comparison.fullTextComments') }}{{ resultData.comments }}</template>
<span>{{ $t('docTool.comparison.fullTextComments') }}{{ resultData.comments }}</span>
</a-tooltip>
</div>
<div class="full-text-review-operation" v-if="!isDisplay">
<!--全文评论-编辑-->
<a class="text-button" @click="fullTextEdit" v-has="'docComparison:result:editFullTextComments'">{{ $t('edit') }}</a>
<!-- <a class="text-button">{{$t('delete')}}</a>-->
</div>
</div>
</div>
</div>
<!--评论-->
<comment-list ref="commentListRef" />
<!--编辑对比评论-->
<comparison-result-edit-modal ref="comparisonResultEditModal" @ok="getData" />
<div id="images">
<div class="image" v-viewer="{movable: false}">
<img v-show="image" :src="imageUrl">
</div>
</div>
</internal-detail-page>
</template>
<script>
import { getAction, downloadFile, getFileAccessHttpUrl } from '../../../api/manage.js'
import { previewPdf } from '../../../utils/previewPdf.js'
import { Base64 } from 'js-base64'
import { mapGetters } from 'vuex'
import CommentList from './modules/CommentList.vue'
import ComparisonResultEditModal from './modules/ComparisonResultEditModal.vue'
import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import { deleteComparisonResult, getComparisonResultDetail } from '../../../api/documentToolApi.js'
export default {
name: 'ComparisonResults',
components: { CommentList, ComparisonResultEditModal, InternalDetailPage },
data () {
return {
loading: false,
checkboxList: [],
isVarianceOne: false,
isVarianceTwo: false,
isVarianceThe: false,
downLoadFileUrl: window._CONFIG.domianPreviewURL + '/sys/common/download',
downLoadImgUrl: window._CONFIG.domianWebImgURL + '/sys/common/download',
indeterminate: false,
checkAll: false,
isDisplay: false,
fullCheckbox: false,
resultData: {},
comment: '',
language: '',
url: {
exportData: '/compare/sarFileCompareItemComment/exportResXls'
},
image: false,
imageUrl: '',
hasScrollBar: false // 页面中间部分是否有滚动条
}
},
mounted () {
if (this.$route.query.isDisplay === '2') {
this.isDisplay = false
} else {
this.isDisplay = true
}
this.language = localStorage.getItem('language') || ''
this.getData()
},
methods: {
...mapGetters(['userInfo']),
goBack () {
this.$router.push({
path: '/docTool/docComparison'
})
},
// 评论按钮点击
commentClick () {
this.$refs.commentListRef.getData()
},
// 导出对比报告按钮点击
exportComparisonReportClick () {
const checkboxList = JSON.parse(JSON.stringify(this.checkboxList))
const fullCheckbox = this.fullCheckbox
const query = {
selectIds: checkboxList.join(','),
includeComments: fullCheckbox,
infoId: this.$route.query.id,
comment: this.comment
}
downloadFile(this.url.exportData, this.resultData.serialNumberLeft + ' - ' + this.resultData.serialNumberRight + this.$t('docTool.comparison.comparisonResults') + '.xls', query, this.deselect)
},
deselect () {
this.checkboxList = []
this.fullCheckbox = false
this.indeterminate = false
this.checkAll = false
},
// 查看一致性按钮点击
viewConsistentAssessmentClick () {
this.comment = '一致'
this.isVarianceTwo = true
this.isVarianceOne = false
this.isVarianceThe = false
this.getData()
},
// 查看差异项按钮点击
viewVarianceAssessmentClick () {
this.isVarianceOne = true
this.isVarianceTwo = false
this.isVarianceThe = false
this.comment = '差异'
this.getData()
},
// 查看全部按钮点击
viewAllClick () {
this.comment = ''
this.isVarianceThe = true
this.isVarianceOne = false
this.isVarianceTwo = false
this.getData()
},
// 点击文件名
fileClick (name, id) {
const fileName = name
const index1 = fileName.lastIndexOf('.')
const index2 = fileName.length
const fileSuffix = fileName.substring(index1, index2)
if (fileSuffix === '.pdf') {
// window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + id + '&userName=' + this.userInfo().username))
const url = previewPdf(id)
window.open(url)
} else if (fileSuffix === '.docx' || fileSuffix === '.doc') {
const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + id + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix === '.xlsx' || fileSuffix === '.xls') {
const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + id + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix === '.png' || fileSuffix === '.jpeg' || fileSuffix === '.gif' || fileSuffix === '.jpg') {
// const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadImgUrl + '/' + id + fileSuffix)
// window.open(url, '_blank')
this.image = true
this.imageUrl = getFileAccessHttpUrl(id)
// 获取viewer实例
const viewer = this.$el.querySelector('.image').$viewer
// 调用show方法进行显示预览图
viewer.show()
} else {
downloadFile('/sys/common/downLoadFile', name, { id: id })
}
},
// 获取对比结果详情
getData () {
const query = {
id: this.$route.query.id,
infoId: this.$route.query.id,
comment: this.comment
}
this.loading = true
getComparisonResultDetail(query).then((res) => {
if (res.success) {
this.resultData = res.result || {}
// 处理页面中部滚动导致表格对不齐的问题
this.$nextTick(() => {
const scrollBoxDom = document.getElementsByClassName('scroll-content')[0]
if (scrollBoxDom && scrollBoxDom.scrollHeight > scrollBoxDom.clientHeight) {
this.hasScrollBar = true
} else {
this.hasScrollBar = false
}
})
} else {
this.resultData = {}
}
}).finally(() => {
this.loading = false
})
},
// 复选框组改变
checkboxChange (checkedList) {
this.indeterminate = (!!checkedList.length && checkedList.length < this.resultData.resList.length) || (this.fullCheckbox && this.checkboxList.length < this.resultData.resList.length) || (!this.fullCheckbox && !!checkedList.length)
this.checkAll = checkedList.length === this.resultData.resList.length && this.fullCheckbox
},
// 全文评论复选框改变
fullCheckboxChange (event) {
this.indeterminate = (!!this.checkboxList.length && this.checkboxList.length < this.resultData.resList.length) || (event.target.checked && this.checkboxList.length < this.resultData.resList.length) || (!this.fullCheckbox && !!this.checkboxList.length)
this.checkAll = this.checkboxList.length === this.resultData.resList.length && event.target.checked
},
// 全选复选框改变
onChange (event) {
this.checkAll = event.target.checked
if (event.target.checked) {
this.resultData.resList.forEach(res => {
this.checkboxList.push(res.id)
})
this.fullCheckbox = true
this.indeterminate = false
} else {
this.checkboxList = []
this.fullCheckbox = false
}
if (this.checkboxList.length === 0 && !this.fullCheckbox) {
this.checkAll = false
this.indeterminate = false
}
},
// 全文评论编辑点击
fullTextEdit (item) {
this.$refs.comparisonResultEditModal.title = this.$t('docTool.comparison.fullTextComments')
this.$refs.comparisonResultEditModal.open({ comment: this.resultData.comments || '' })
},
// 对比结果编辑按钮点击
comparaEdit (item) {
this.$refs.comparisonResultEditModal.title = this.$t('docTool.comparison.comparativeComments')
this.$refs.comparisonResultEditModal.open(item)
},
// 对比结果删除按钮点击
comparaDelete (val) {
this.$confirm({
content: this.$t('confirmDeletion'),
onOk: () => {
deleteComparisonResult({ id: val.id }).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.getData()
} else {
this.$message.warning(res.message)
}
})
}
})
}
}
}
</script>
<style scoped lang="less">
.result-content {
padding: 24px 32px 0 32px;
box-sizing: border-box;
background: #fff;
height: 100%;
&-header {
width: 100%;
height: 56px;
line-height: 56px;
margin-bottom: 20px;
display: flex;
align-items: center;
}
&-header > .ant-checkbox-wrapper {
margin-left: 20px;
}
}
.result-content-header-content {
width: calc(100% - 56px);
margin-left: 20px;
display: inline-block;
height: 56px;
font-size: 14px;
font-family: Blue Sky Noto, sans-serif;
font-weight: bold;
color: #040B29;
background: rgba(4, 11, 41, 0.0300);
border-radius: 4px;
&-item {
height: 56px;
display: inline-block;
border-right: 1px #EFF1F3 solid;
padding: 0 24px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&-item:last-child {
border-right: none;
}
&-item-standard {
width: calc((100% - 128px - 260px) / 2);
span {
cursor: pointer;
}
}
&-item-no-operation {
width: calc((100% - 260px) / 2);
}
&-item-comment {
width: 260px;
}
&-item-operation {
width: 128px;
}
}
.result-content-header-has-scroll {
padding-right: 8px;
}
.scroll-content {
height: calc(100% - 76px - 71px - 58px);
overflow: auto;
}
.ant-checkbox-group {
width: 100%;
}
.clause-item {
width: 100%;
height: auto;
display: flex;
align-items: center;
&-checkbox {
margin-left: 20px;
}
}
.clause-item-content {
width: calc(100% - 56px);
margin-left: 20px;
border: 1px solid #EFF1F3;
border-radius: 4px;
overflow: hidden;
display: flex;
align-items: stretch;
&-selected {
border: 1px solid #00B3BE;
background: rgba(0, 179, 190, 0.0300);
}
&-standard {
width: calc((100% - 128px - 260px) / 2);
padding: 24px;
border-right: 1px #EFF1F3 solid;
&-title {
font-size: 16px;
font-family: Blue Sky Noto, sans-serif;
font-weight: 400;
color: #040B29;
}
}
&-standard-no-operation {
width: calc((100% - 260px) / 2);
}
&-text {
font-size: 14px;
font-weight: 400;
color: #040B29;
margin-top: 10px;
/deep/ table {
width: 100%;
}
}
&-comment {
width: 260px;
padding: 24px;
border-right: 1px #EFF1F3 solid;
}
&-operation {
width: 128px;
display: flex;
align-items: center;
justify-content: center;
.text-button {
margin-left: 10px;
}
.text-button:first-child {
margin-left: 0;
}
}
}
.full-text-review {
height: 109px;
margin: 10px 0;
&-content {
margin-left: 20px;
height: 100%;
flex: 1;
width: 0;
display: flex;
align-items: stretch;
border: 1px #EFF1F3 solid;
border-radius: 4px;
}
&-text {
width: calc(100% - 128px);
padding: 24px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
text-overflow: ellipsis;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
/*! autoprefixer: on;*/
word-break: break-word;
span {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
text-overflow: ellipsis;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
/*! autoprefixer: on;*/
word-break: break-word;
}
}
&-text-no-operation {
width: 100%;
}
&-operation {
width: 128px;
display: flex;
justify-content: center;
align-items: center;
}
}
.header-btn {
margin-left: 12px;
}
.header-btn:first-child {
margin-left: 0;
}
</style>
@@ -0,0 +1,396 @@
<template>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<!--文本号-->
<a-col :md="6" :sm="8">
<a-form-item :label="$t('docTool.comparison.textNumber')" :labelCol="{span: 6}" :wrapperCol="{span: 14}">
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.comparison.textNumber')"
v-model="queryParam.serialNumber"></a-input>
</a-form-item>
</a-col>
<!--文本名称-->
<a-col :md="6" :sm="8">
<a-form-item :label="$t('docTool.comparison.textName')" :labelCol="{span: 6}" :wrapperCol="{span: 14}">
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.comparison.textName')"
v-model="queryParam.title"></a-input>
</a-form-item>
</a-col>
<!--发布情况-->
<a-col :md="6" :sm="8">
<a-form-item :label="$t('docTool.comparison.releaseSituation')" :labelCol="{span: 6}" :wrapperCol="{span: 14}">
<j-dict-select-tag v-model="queryParam.releaseState"
:placeholder="$t('pleaseSelect')+$t('docTool.comparison.releaseSituation')"
type="select"
:triggerChange="false" dictCode="release_state" />
</a-form-item>
</a-col>
<div style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search" v-has="'documentComparison:search'">{{
$t('query')
}}
</a-button>
<a-button style="margin-left: 8px" icon="reload" @click="searchReset">{{ $t('reset') }}</a-button>
</div>
</a-row>
</a-form>
</div>
<div class="table-operator">
<!--发起对比-->
<a-button icon="block" type="primary" @click="initiatingProcessClick" v-has="'documentComparison:initiateComparison'">
{{ $t('docTool.comparison.initiateComparison') }}
</a-button>
<!--批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDelete" v-has="'documentComparison:deleteBatch'">
{{ $t('batchDelete') }}
</a-button>
</div>
<div>
<j-table
ref="table"
size="middle"
:columns="columns"
:data-source="dataSource"
rowKey="id"
:can-drag="true"
:loading="loading"
:pagination="ipagination"
:scroll="{x: '100%', y: yScrollHeight}"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:operation-list="operationList"
@change="handleTableChange"
@operationClick="operationClick">
<!--旧文本跳转标准详情-->
<template v-slot:oldTextDetail="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage('old', record)">{{
text
}}
</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!--新文本跳转标准详情-->
<template v-slot:newTextDetail="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage('new', record)">{{
text
}}
</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
</j-table>
</div>
</a-card>
</template>
<script>
import '../../../assets/less/common.less'
import { postAction } from '../../../api/manage.js'
import { mapGetters } from 'vuex'
import JDictSelectTag from '../../../components/dict/JDictSelectTag.vue'
import JTable from '../../../components/jero/JTable.vue'
import { JeroListMixin } from '../../../mixins/JeroListMixin.js'
import { StandardSource } from '../../../enums/commonEnums.js'
import { withdrawPublication } from '../../../api/documentToolApi.js'
export default {
name: 'DocumentComparison',
components: { JDictSelectTag, JTable },
mixins: [JeroListMixin],
data () {
return {
// url传参严格按照当前命名
url: {
list: '/compare/sarFileCompareInfo/page',
delete: '/compare/sarFileCompareInfo/delete',
deleteBatch: '/compare/sarFileCompareInfo/deleteBatch'
},
loading: false,
downLoadFileUrl: window._CONFIG.domianPreviewURL + '/sys/common/download',
downLoadImgUrl: window._CONFIG.domianWebImgURL + '/sys/common/download',
userInfoQuery: {},
columns: [
// 旧文档文本号
{
title: this.$t('docTool.comparison.oldDocumentTextNumber'),
dataIndex: 'serialNumberLeft',
width: 170,
ellipsis: true,
scopedSlots: { customRender: 'oldTextDetail' }
},
// 旧文档文本名称
{
title: this.$t('docTool.comparison.oldDocumentTextName'),
dataIndex: 'titleLeft',
width: 170,
scopedSlots: { customRender: 'oldTextDetail' }
},
// 旧文本状态
{
title: this.$t('docTool.comparison.oldTextState'),
width: 150,
dataIndex: 'fileTypeLeft_dictText'
},
// 新文档文本号
{
title: this.$t('docTool.comparison.newDocumentTextNumber'),
dataIndex: 'serialNumberRight',
width: 170,
scopedSlots: { customRender: 'newTextDetail' }
},
// 新文档文本名称
{
title: this.$t('docTool.comparison.newDocumentTextName'),
dataIndex: 'titleRight',
width: 170,
scopedSlots: { customRender: 'newTextDetail' }
},
// 新文本状态
{
title: this.$t('docTool.comparison.newTextState'),
width: 150,
dataIndex: 'fileTypeRight_dictText'
},
// 发布情况
{
title: this.$t('docTool.comparison.releaseSituation'),
width: 150,
dataIndex: 'releaseState_dictText'
},
// 创建人
{
title: this.$t('creator'),
width: 180,
dataIndex: 'createNameNo'
},
// 备注
{
title: this.$t('remarks'),
width: 270,
dataIndex: 'remark'
},
// 操作
{
title: this.$t('operation'),
fixed: 'right',
width: 250,
scopedSlots: { customRender: 'action' }
}
],
operationList: [
// 对比结果
{
text: this.$t('docTool.comparison.comparisonResults'),
clickEvent: 'comparisonResultsClick',
has: 'documentComparison:comparisonResults'
},
// 发布
{
text: this.$t('release'),
clickEvent: 'subscribe',
has: 'documentComparison:publishWithdraw',
show: (record) => {
return record.createBy === this.userInfo.username && (!record.releaseState || record.releaseState === 'draft')
}
},
// 撤回
{
text: this.$t('withdraw'),
clickEvent: 'subscribe',
has: 'documentComparison:publishWithdraw',
show: (record) => {
return record.createBy === this.userInfo.username && !(!record.releaseState || record.releaseState === 'draft')
}
},
// 编辑
{
text: this.$t('edit'),
clickEvent: 'edit',
has: 'documentComparison:edit',
show: (record) => {
return (record.createBy === this.userInfo.username || this.administrators) && (!record.releaseState || record.releaseState === 'draft')
}
},
// 删除
{
text: this.$t('delete'),
clickEvent: 'handleDelete',
has: 'documentComparison:delete',
show: (record) => {
return (record.createBy === this.userInfo.username || this.administrators) && (!record.releaseState || record.releaseState === 'draft')
}
}
]
}
},
computed: {
...mapGetters(['userInfo']),
administrators () {
const adminRoleList = window._CONFIG.adminRoleCode.split(',')
const userRoleList = this.userInfo.roleCode.split(',')
return userRoleList.some(tt => adminRoleList.includes(tt))
}
},
created () {
if (this.$route.query.serialNumber) {
this.queryParam.serialNumber = this.$route.query.serialNumber
this.queryParam = { ...this.queryParam }
}
this.loadData(1)
},
methods: {
batchDelete () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectLeastOne'))
return
}
this.$confirm({
content: this.$t('confirmBatchDeletion'),
onOk: () => {
const idList = []
const selectionRows = JSON.parse(JSON.stringify(this.selectionRows))
for (let i = 0; i < selectionRows.length; i++) {
if (selectionRows[i].createBy === this.userInfo.username &&
selectionRows[i].releaseState === 'draft') {
idList.push(selectionRows[i].id)
}
}
if (idList.length > 0) {
postAction(this.url.deleteBatch, { ids: idList.join(',') }).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.selectedRowKeys = []
this.loadData(1)
} else {
this.$message.warning(res.message)
}
})
} else {
this.$message.warning(this.$t('doNotHavePermissionDeleteData'))
}
}
})
},
// 对比结果按钮点击
comparisonResultsClick (item) {
if (item.createBy === this.userInfo.username && item.releaseState === 'draft') {
item.isDisplay = 2
} else {
item.isDisplay = 1
}
this.$router.push({
path: '/docTool/ComparisonResults',
query: {
id: item.id,
isDisplay: item.isDisplay
}
})
},
// 撤回按钮点击
subscribe (record) {
this.$confirm({
content: record.releaseState === 'draft' ? this.$t('confirmRelease') : this.$t('confirmWithdraw'),
onOk: () => {
let releaseState = ''
if (record.releaseState === 'draft') {
releaseState = 'draft'
} else {
releaseState = 'published'
}
const query = {
releaseState: releaseState,
id: record.id
}
withdrawPublication(query).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.loadData(1)
} else {
this.$message.warning(res.message)
}
})
}
})
},
/**
* 编辑
* @param row
*/
edit (row) {
this.$router.push({
path: '/docTool/DocDataComparison',
query: {
id: row.id
}
})
},
/**
* 发起比对
*/
initiatingProcessClick () {
this.$router.push({
path: '/docTool/InitiateComparison'
})
},
/**
* 跳转标准详情
* @param type
* @param record
*/
toDetailPage (type, record) {
let standardId, standardSource, path
// 判断是新旧那个标准点击的,取字段
if (type === 'old') {
standardId = record.standardIdLeft
standardSource = record.standardSourceLeft
}
if (type === 'new') {
standardId = record.standardIdRight
standardSource = record.standardSourceRight
}
// 根据来源跳转不同的详情页
switch (standardSource) {
// 国内
case StandardSource.DOMESTIC.value:
path = '/standardRegulationLibrary/DomesticStandardDetail'
break
// 海外
case StandardSource.OVERSEAS.value:
path = '/standardRegulationLibrary/OverseasStandardDetail'
break
// 企标
case StandardSource.ENTERPRISE.value:
path = '/enterpriseStandardLibrary/enterpriseStandardDetail'
break
default:
break
}
if (!path) {
return
}
const query = {
id: standardId
}
this.$openPageNewSheet({
path, query
})
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
/deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item > .ant-form-item-label {
min-width: 80px;
}
</style>
@@ -0,0 +1,778 @@
<template>
<internal-detail-page :title="$t('docTool.comparison.documentComparison')"
:content-padding="0"
:loading="loading"
need-custom-back-func
@back="handleBack">
<template v-slot:titleRightCustom>
<!--查看比对结果-->
<a-button class="header-btn"
type="primary"
icon="eye"
ghost
@click="viewTheComparisonResultsClick"
v-has="'docComparison:dataComparison:viewTheComparisonResults'">
{{ $t('docTool.comparison.viewTheComparisonResults') }}
</a-button>
<!--添加全文评论-->
<a-button class="header-btn"
type="primary"
icon="message"
ghost
@click="addFullTextCommentClick"
v-has="'docComparison:dataComparison:addFullTextComment'">
{{ $t('docTool.comparison.addFullTextComment') }}
</a-button>
<!--关闭/打开自动匹配-->
<a-button class="header-btn"
type="primary"
:icon="isMatching?'close-circle':'check-circle'"
ghost
@click="turnOffAutomaticMatchingClick"
v-has="'docComparison:dataComparison:turnOffAutomaticMatching'">
{{ isMatching ? $t('docTool.comparison.turnOffAutomaticMatching') : $t('docTool.comparison.turnOnAutoMatch') }}
</a-button>
</template>
<div class="can-scroll-content">
<div class="detail-content">
<!--左边的文档-->
<div class="detail-content-left">
<!--左边的目录-->
<div class="standard-catalogue part-common" :class="{'hide-catalogue': !leftCatalogueShow}">
<div class="catalogue-show" @click="changeLeftCatalogueShow">
<a-icon :type="leftCatalogueShow ? 'left' : 'right'" />
</div>
<div class="part-title" v-show="leftCatalogueShow">{{ $t('standardRegulationLibrary.standardCatalogue') }}</div>
<div class="has-title-part-content" v-show="leftCatalogueShow">
<a-tree
class="draggable-tree"
:selected-keys="leftTreeSelectedKeys"
:replace-fields="{key: 'menuId'}"
@select="onSelectLeft"
:tree-data="resultData.menuLeft">
<a-icon slot="switcherIcon" type="down" :style="{ fontSize: '12px', color: '#103770' }" />
<template slot="title" slot-scope="{title}">
<!-- 目录前三个和有子集的标题加粗 -->
<span :style="title.indexOf('.')===-1?'font-weight: 600;':''" :title="title">{{ title }}</span>
</template>
</a-tree>
</div>
</div>
<!--左侧标准信息-->
<div class="detail-content-left-container">
<!--标准名称-->
<div class="standard-name">
<a-tooltip placement="topLeft">
<template #title>
{{ resultData.serialNumberLeft }} {{ resultData.fileNameLeft }}
</template>
<span>{{ resultData.serialNumberLeft }} {{ resultData.fileNameLeft }}</span>
</a-tooltip>
</div>
<div class="detail-content-left-scroll">
<div class="detail-content-left-item" @click="detailLeft(index,item)"
v-for="(item,index) in resultData.textLeft" :key="index"
:class="{'detail-content-item-selected': leftHighlightMenuId === item.menuId && leftHighlightId === item.id,'detail-content-item-saved':item.reviewed + '' === '1'}">
<div class="detail-content-item-text" style="margin-bottom: 10px;">
<span>{{ item.itemsNum }}</span> <span v-html="item.itemsName"></span>
</div>
<div class="detail-content-item-text" v-html="item.itemsText"></div>
</div>
</div>
</div>
</div>
<!--右侧文档-->
<div class="detail-content-right">
<!--右侧目录-->
<div class="standard-catalogue part-common" :class="{'hide-catalogue': !rightCatalogueShow}">
<div class="catalogue-show" @click="changeRightCatalogueShow">
<a-icon :type="rightCatalogueShow ? 'left' : 'right'" />
</div>
<div class="part-title" v-show="rightCatalogueShow">{{ $t('standardRegulationLibrary.standardCatalogue') }}</div>
<div class="has-title-part-content" v-show="rightCatalogueShow">
<a-tree
class="draggable-tree"
:selected-keys="rightTreeSelectedKeys"
:replace-fields="{key: 'menuId'}"
@select="onSelectRight"
:tree-data="resultData.menuRight">
<a-icon slot="switcherIcon" type="down" :style="{ fontSize: '12px', color: '#103770' }" />
<template slot="title" slot-scope="{title}">
<!-- 目录前三个和有子集的标题加粗 -->
<span :style="title.indexOf('.')===-1?'font-weight: 600;':''" :title="title">{{ title }}</span>
</template>
</a-tree>
</div>
</div>
<!--右侧标准信息-->
<div class="detail-content-right-container">
<!--标准名称-->
<div class="standard-name">
<a-tooltip placement="topLeft">
<template #title>
{{ resultData.serialNumberRight }} {{ resultData.fileNameRight }}
</template>
<span>{{ resultData.serialNumberRight }} {{ resultData.fileNameRight }}</span>
</a-tooltip>
</div>
<div class="detail-content-right-scroll">
<div class="detail-content-right-item" @click="detailRight(index,item)"
v-for="(item,index) in resultData.textRight" :key="index"
:class="{'detail-content-item-selected': item.menuId === rightHighlightMenuId && rightHighlightId === item.id, 'detail-content-item-saved':item.reviewed + '' === '1'}">
<div class="detail-content-item-text" style="margin-bottom: 10px;">
<span>{{ item.itemsNum }}</span> <span v-html="item.itemsName"></span>
</div>
<div class="detail-content-item-text" v-html="item.itemsText">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="remarks">
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<div class="box-title-text-remarks">
<div class="title-text-remarks" :title="$t('docTool.comparison.comparisonOfArticles')" style="width: 84px">
<span>{{ $t('docTool.comparison.comparisonOfArticles') }}</span>
</div>
<a-form-model-item class="item-model" prop="comment">
<a-textarea :placeholder="$t('pleaseEnter')+$t('docTool.comparison.comparisonOfArticles')"
v-model="formInline.comment"
:maxLength="500"
:rows="3" />
</a-form-model-item>
</div>
</a-form-model>
</div>
</div>
<div class="submit-button">
<!--一致-->
<a-button style="margin-right: 10px"
type="primary"
@click="consistentAssessmentClick"
v-has="'docComparison:dataComparison:consistentAssessment'">
{{ $t('docTool.comparison.consistentAssessment') }}
</a-button>
<!--保存-->
<a-button type="primary" @click="submit" v-has="'docComparison:dataComparison:save'">{{ $t('preservation') }}</a-button>
</div>
<!--全文评论-->
<comparison-add-full-comment ref="comparisonAddFullComment" />
</internal-detail-page>
</template>
<script>
// 添加全文评论弹框
import ComparisonAddFullComment from './modules/ComparisonAddFullComment.vue'
import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import { docComparsionConsistentAndSave, getComparisonDetail, clauseComparison } from '../../../api/documentToolApi.js'
export default {
name: 'DocumentDataComparison',
components: { ComparisonAddFullComment, InternalDetailPage },
data () {
return {
formInline: {},
loadingText: false,
rules: {},
loading: false,
resultData: {},
isMatching: true, // 自动匹配是否开启
dataLeft: {},
dataRight: {},
pageFrom: null,
leftCatalogueShow: true, // 左侧的标准目录是否展示
rightCatalogueShow: true, // 右侧的标准目录是否展示
leftTreeSelectedKeys: [], // 左侧被选中树节点
rightTreeSelectedKeys: [], // 右侧被选中树节点
leftHighlightMenuId: null, // 左侧高亮数据的menuId
rightHighlightMenuId: null, // 右侧高亮数据的menuId
leftHighlightId: null, // 左侧高亮数据的id
rightHighlightId: null // 右侧高亮数据的id
}
},
mounted () {
this.getData()
},
methods: {
// 文档对比的一致按钮点击
consistentAssessmentClick () {
if (!this.dataLeft.id && !this.dataRight.id) {
this.$message.warning(this.$t('docTool.comparison.pleaseSelectTheDataCompared'))
return
}
const query = {
itemsIdLeft: this.dataLeft.id,
itemsIdRight: this.dataRight.id,
infoId: this.$route.query.id,
comment: '一致'
}
this.loading = true
docComparsionConsistentAndSave(query).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.formInline = {}
// 保存之后会有一个淡蓝色的边框
if (this.leftHighlightMenuId === this.dataLeft.menuId) {
this.leftHighlightMenuId = null
}
if (this.rightHighlightMenuId === this.dataRight.menuId) {
this.rightHighlightMenuId = null
}
this.resultData.textRight.forEach(val => {
if (val.id === this.dataRight.id) {
val.reviewed = '1'
}
})
this.resultData.textLeft.forEach(val => {
if (val.id === this.dataLeft.id) {
val.reviewed = '1'
}
})
this.resultData = { ...this.resultData }
this.dataLeft = {}
this.dataRight = {}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 文档对比的保存按钮点击
submit () {
if (!this.dataLeft.id && !this.dataRight.id) {
this.$message.warning(this.$t('docTool.comparison.pleaseSelectTheDataCompared'))
return
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
const query = {
itemsIdLeft: this.dataLeft.id,
itemsIdRight: this.dataRight.id,
infoId: this.$route.query.id,
comment: this.formInline.comment
}
this.loading = true
docComparsionConsistentAndSave(query).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.formInline = {}
// 保存之后会有一个淡蓝色的边框
if (this.leftHighlightMenuId === this.dataLeft.menuId) {
this.leftHighlightMenuId = null
}
if (this.rightHighlightMenuId === this.dataRight.menuId) {
this.rightHighlightMenuId = null
}
this.resultData.textRight.forEach(val => {
if (val.id === this.dataRight.id) {
val.reviewed = '1'
}
})
this.resultData.textLeft.forEach(val => {
if (val.id === this.dataLeft.id) {
val.reviewed = '1'
}
})
this.resultData = { ...this.resultData }
this.dataLeft = {}
this.dataRight = {}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
// 查看对比结果按钮点击
viewTheComparisonResultsClick () {
this.$router.push({
path: '/docTool/ComparisonResults',
query: {
id: this.$route.query.id,
isDisplay: 2
}
})
},
// 添加全文评论按钮点击
addFullTextCommentClick () {
const query = {
id: this.$route.query.id
}
getComparisonDetail(query).then((res) => {
if (res.success) {
this.$refs.comparisonAddFullComment.open(res.result.comments || '')
}
})
},
// 关闭自动匹配、开启自动匹配
turnOffAutomaticMatchingClick () {
this.isMatching = !this.isMatching
this.$message.success(this.$t('operationSuccessful'))
},
// 获取文件对比详情
getData () {
const query = {
id: this.$route.query.id
}
this.loading = true
getComparisonDetail(query).then((res) => {
if (res.success) {
this.resultData = res.result || {}
} else {
this.resultData = {}
}
}).finally(() => {
this.loading = false
})
},
// 点击左侧文档内容
detailLeft (num, item) {
this.leftTreeSelectedKeys = [item.menuId]
if (item.id === this.dataLeft.id && !this.isMatching) {
this.dataLeft = {}
this.leftHighlightMenuId = null
this.leftHighlightId = null
return
}
this.leftHighlightMenuId = item.menuId
this.leftHighlightId = item.id
this.dataLeft = item
this.dataLeft.numIndex = num
// 自动匹配,右侧数据需要跳转
if (this.isMatching) {
const index = this.dataLeft.targetStand
if (index > -1) {
this.dataRight = this.resultData.textRight[index]
this.dataRight.numIndex = index
this.rightHighlightMenuId = this.dataRight.menuId
this.rightHighlightId = this.dataRight.id
this.rightTreeSelectedKeys = [this.dataRight.menuId]
this.handleJumpRightData(index)
this.clauseComparison()
}
}
},
// 点击右侧文档内容
detailRight (num, item) {
this.rightTreeSelectedKeys = [item.menuId]
if (item.id === this.dataRight.id && !this.isMatching) {
this.dataRight = {}
this.rightHighlightMenuId = null
this.rightHighlightId = null
return
}
this.dataRight = item
this.dataRight.numIndex = num
this.rightHighlightMenuId = item.menuId
this.rightHighlightId = item.id
if (this.isMatching) {
const index = this.dataRight.targetStand
if (index > -1) {
this.dataLeft = this.resultData.textLeft[index]
this.dataLeft.numIndex = index
this.leftHighlightMenuId = this.dataLeft.menuId
this.leftHighlightId = this.dataLeft.id
this.leftTreeSelectedKeys = [this.dataLeft.menuId]
this.handleJumpLeftData(index)
this.clauseComparison()
}
}
},
// 自动匹配
clauseComparison () {
const query = {
leftId: this.dataLeft.id,
rightId: this.dataRight.id
}
this.loadingText = true
clauseComparison(query).then((res) => {
if (res.success) {
this.loadingText = false
this.resultData.textLeft[this.dataLeft.numIndex].itemsText = res.result[0]
this.resultData.textRight[this.dataRight.numIndex].itemsText = res.result[1]
this.resultData.textLeft[this.dataLeft.numIndex].itemsName = res.result[2]
this.resultData.textRight[this.dataRight.numIndex].itemsName = res.result[3]
} else {
this.loadingText = false
}
})
},
// 左侧树选择
onSelectLeft (selectedKeys, exports) {
const node = exports.node.$vnode.data.props.dataRef
const index = this.resultData.textLeft.findIndex(tt => tt.menuId === node.menuId)
this.dataLeft = this.resultData.textLeft[index]
console.log(this.dataLeft)
this.dataLeft.numIndex = index
this.leftHighlightMenuId = this.dataLeft.menuId
this.leftHighlightId = this.dataLeft.id
this.leftTreeSelectedKeys = [this.dataLeft.menuId]
this.handleJumpLeftData(index)
// 处理选中右侧树
if (this.isMatching) {
const indexRight = this.dataLeft.targetStand
if (indexRight > -1) {
this.dataRight = this.resultData.textRight[indexRight]
this.dataRight.numIndex = indexRight
this.rightHighlightMenuId = this.dataRight.menuId
this.rightHighlightId = this.dataRight.id
this.rightTreeSelectedKeys = [this.dataRight.menuId]
this.handleJumpRightData(indexRight)
this.clauseComparison()
}
}
},
// 右侧树选中
onSelectRight (selectedKeys, exports) {
const node = exports.node.$vnode.data.props.dataRef
const index = this.resultData.textRight.findIndex(tt => tt.menuId === node.menuId)
this.dataRight = this.resultData.textRight[index]
this.dataRight.numIndex = index
this.rightHighlightMenuId = this.dataRight.menuId
this.rightHighlightId = this.dataRight.id
this.rightTreeSelectedKeys = [this.dataRight.menuId]
this.handleJumpRightData(index)
// 处理选中左侧树
if (this.isMatching) {
const indexLeft = this.dataRight.targetStand
if (indexLeft > -1) {
this.dataLeft = this.resultData.textLeft[indexLeft]
this.dataLeft.numIndex = indexLeft
this.leftHighlightMenuId = this.dataLeft.menuId
this.leftHighlightId = this.dataLeft.Id
this.leftTreeSelectedKeys = [this.dataLeft.menuId]
this.handleJumpLeftData(indexLeft)
this.clauseComparison()
}
}
},
/**
* 左侧数据跳转
*/
handleJumpLeftData (index) {
if (index > -1) {
const scrollContent = document.getElementsByClassName('detail-content-left-scroll')
const clauseItemDom = document.getElementsByClassName('detail-content-left-item')
scrollContent[0].scrollTop = clauseItemDom[index].offsetTop - 150
}
},
/**
* 右侧数据跳转
*/
handleJumpRightData (index) {
if (index > -1) {
const detailContent = document.getElementsByClassName('detail-content-right-scroll')
const detailRight = document.getElementsByClassName('detail-content-right-item')
detailContent[0].scrollTop = detailRight[index].offsetTop - 150
}
},
handleBack () {
this.$router.push({
path: '/docTool/docComparison'
})
},
changeLeftCatalogueShow () {
this.leftCatalogueShow = !this.leftCatalogueShow
},
changeRightCatalogueShow () {
this.rightCatalogueShow = !this.rightCatalogueShow
}
}
}
</script>
<style scoped lang="less">
.header-btn {
margin-left: 12px;
}
.header-btn:first-child {
margin-left: 0;
}
.can-scroll-content {
height: calc(100% - 52px);
overflow: auto;
}
.detail-content {
height: calc(100% - 131px);
background-color: #eff1f4;
}
.detail-content-left {
width: 50%;
float: left;
height: 100%;
border-right: 2px #EFF1F3 solid;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
display: flex;
}
.detail-content-right {
width: 50%;
height: 100%;
float: left;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
display: flex;
}
.detail-content-left-header {
width: 100%;
font-size: 16px;
font-family: Blue Sky Noto;
font-weight: 400;
color: #040B29;
margin-bottom: 24px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-title-text-remarks {
line-height: 1.4;
display: flex;
/*align-items: center;*/
margin-bottom: 10px;
}
.item-model {
width: calc(100% - 232px);
}
.title-text-remarks {
width: 68px;
color: #000F16;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
margin-top: 6px;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
.remarks {
margin-top: 20px;
width: 50%;
display: inline-block;
padding: 0 32px;
box-sizing: border-box;
}
.itemModel {
width: calc(100% - 232px);
}
.submit-button {
height: 52px;
text-align: right;
padding: 10px 24px;
}
.detail-content-left-container {
height: 100%;
overflow-y: auto;
transition: all 1s;
scroll-behavior: smooth;
flex: 1;
}
.detail-content-right-container {
height: 100%;
overflow-y: auto;
transition: all 1s;
scroll-behavior: smooth;
flex: 1;
.standard-name {
margin-right: 0;
}
}
.detail-content-left-scroll {
height: calc(100% - 25px - 40px);
width: calc(100% - 20px);
display: inline-block;
margin: 0 10px 0 10px;
overflow: auto;
background-color: white;
}
.detail-content-right-scroll {
height: calc(100% - 25px - 40px);
width: calc(100% - 10px);
display: inline-block;
margin-left: 10px;
overflow: auto;
background-color: white;
}
.detail-content-left-item {
padding: 16px 20px;
box-sizing: border-box;
border: 1px solid #EFF1F3;
cursor: pointer;
background-color: white;
}
.detail-content-right-item {
padding: 16px 20px;
box-sizing: border-box;
border: 1px solid #EFF1F3;
cursor: pointer;
background-color: white;
}
.detail-content-left-item:last-child {
margin-bottom: 0;
}
.detail-content-item-text {
font-size: 16px;
font-weight: 400;
color: #040B29;
word-break: break-word;
/deep/ table {
width: 100%;
}
/deep/ img {
max-width: 100%;
}
}
.detail-content-item-selected {
border: 2px red solid !important;
}
.detail-content-item-saved {
border: 2px #21c9cc solid;
}
::v-deep .delClass {
color: #ff7168;
}
::v-deep .insertClass {
color: green;
}
/deep/ .ant-tree li span.ant-tree-switcher {
float: right;
}
::-webkit-scrollbar {
width: 3px;
}
.part-common {
border-radius: 8px;
background: #FFFFFF;
}
.standard-catalogue {
height: calc(100% - 20px);
width: 200px;
margin: 10px 10px 10px 0;
position: relative;
transition: width .2s linear;
/deep/ .ant-tree li .ant-tree-node-content-wrapper{
max-width: calc(100% - 24px);
&:hover {
max-width: 100%;
}
}
/deep/ .ant-tree li .ant-tree-node-content-wrapper.ant-tree-node-selected {
background-color: transparent !important;
color: @primary-color;
}
.catalogue-show {
position: absolute;
width: 12px;
height: 24px;
left: 100%;
top: 50%;
transform: translateY(-50%);
background-color: @primary-color;
border-radius: 0 12px 12px 0;
cursor: pointer;
color: white;
.anticon {
left: -2px;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
}
}
.hide-catalogue {
width: 0;
min-width: 0;
}
.part-title {
height: 40px;
background: rgba(213, 44, 38, 0.12);
border-radius: 8px 8px 0 0;
line-height: 40px;
padding: 0 24px;
font-size: 16px;
font-family: PingFang SC-Semibold, PingFang SC, sans-serif;
font-weight: 600;
color: #1D2129;
white-space: nowrap;
overflow: hidden;
}
.has-title-part-content {
height: calc(100% - 40px);
overflow: auto;
padding: 0 20px;
}
.standard-name {
margin: 10px 10px 5px 10px;
height: 40px;
background: #FFFFFF;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
}
.standard-name > span {
font-size: 16px;
font-family: PingFang SC-Semibold, PingFang SC, sans-serif;
font-weight: 600;
color: #1D2129;
flex: 1;
width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
}
</style>
@@ -0,0 +1,581 @@
<template>
<internal-detail-page :title="$t('docTool.comparison.initiateComparison')" :content-padding="0" :loading="loading">
<div class="can-scroll-content">
<div class="detail-content-box">
<div class="detail-content-left">
<a-form layout="inline" @keyup.enter.native="searchQueryLeft">
<a-row>
<a-col :md="8" :sm="8">
<a-form-item :label="$t('number')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('number')"
v-model="queryParamLeft.serialNumber"></a-input>
</a-form-item>
</a-col>
<a-col :md="8" :sm="8">
<a-form-item :label="$t('title')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('title')"
v-model="queryParamLeft.title"></a-input>
</a-form-item>
</a-col>
<span style="text-align:right;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="8" :sm="24">
<a-button type="primary" @click="searchQueryLeft" v-has="'docComparsion:initiate:search'">
{{ $t('query') }}
</a-button>
<a-button style="margin-left: 8px" @click="searchResetLeft">{{ $t('reset') }}</a-button>
</a-col>
</span>
</a-row>
</a-form>
<j-table
ref="table"
size="middle"
:can-drag="true"
:loading="loadingLeft"
:pagination="false"
:scroll="{x: '100%',y:340}"
rowKey="id"
:data-source="dataSourceLeft"
:row-selection="{ selectedRowKeys: selectedRowKeysLeft, onChange: onSelectChangeLeft, columnTitle:' ', type: 'radio'}"
:columns="columns"
@change="tableChangeLeft"
>
</j-table>
<div class="box-button-standard">
<span class="box-button-standard-left" :title="$t('docTool.comparison.selectedStandard')">
{{ $t('docTool.comparison.selectedStandard') }}
</span>
<span class="box-button-standard-right"
@click="selectLeftClick(selectedRowsLeft[0])"
:title="selectedRowsLeft[0]?selectedRowsLeft[0].serialNumber+' '+selectedRowsLeft[0].fileName:$t('docTool.comparison.noComparisonDocumentSelected')"
:class="{'box-button-standard-right-color':selectedRowsLeft[0]}">
{{
selectedRowsLeft[0] ? selectedRowsLeft[0].serialNumber + ' ' + selectedRowsLeft[0].fileName : $t('docTool.comparison.noComparisonDocumentSelected')
}}
</span>
</div>
</div>
<div class="detail-content-right">
<a-form layout="inline" @keyup.enter.native="searchQueryRight">
<a-row>
<a-col :md="8" :sm="8">
<a-form-item :label="$t('number')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('number')"
v-model="queryParamRight.serialNumber"></a-input>
</a-form-item>
</a-col>
<a-col :md="8" :sm="8">
<a-form-item :label="$t('title')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('title')"
v-model="queryParamRight.title"></a-input>
</a-form-item>
</a-col>
<span style="text-align:right;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="8" :sm="24">
<a-button type="primary" @click="searchQueryRight" v-has="'docComparsion:initiate:search'">
{{ $t('query') }}
</a-button>
<a-button style="margin-left: 8px" @click="searchResetRight">{{ $t('reset') }}</a-button>
</a-col>
</span>
</a-row>
</a-form>
<j-table
ref="table"
size="middle"
:can-drag="true"
:loading="loadingRight"
:pagination="false"
:scroll="{x: '100%',y:340}"
rowKey="id"
:data-source="dataSourceRight"
:row-selection="{ selectedRowKeys: selectedRowKeysRight, onChange: onSelectChangeRight, columnTitle:' ', type: 'radio'}"
:columns="tableColumns"
@change="tableChangeRight"
>
</j-table>
<div class="box-button-standard">
<span class="box-button-standard-left" :title="$t('docTool.comparison.selectedStandard')">
{{ $t('docTool.comparison.selectedStandard') }}
</span>
<span class="box-button-standard-right"
@click="selectLeftClick(selectedRowsRight[0])"
:title="selectedRowsRight[0]?selectedRowsRight[0].serialNumber+' '+selectedRowsRight[0].fileName:$t('docTool.comparison.noComparisonDocumentSelected')"
:class="{'box-button-standard-right-color':selectedRowsRight[0]}">
{{
selectedRowsRight[0] ? selectedRowsRight[0].serialNumber + ' ' + selectedRowsRight[0].fileName : $t('docTool.comparison.noComparisonDocumentSelected')
}}
</span>
</div>
</div>
</div>
<div class="remarks">
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<div class="box-title-text-remarks">
<div class="title-text-remarks" :title="$t('docTool.comparison.remarkInfo')">
<span>{{ $t('docTool.comparison.remarkInfo') }}</span>
</div>
<a-form-model-item class="item-model" prop="remark">
<a-textarea :placeholder="$t('pleaseEnter')+$t('docTool.comparison.remarkInfo')"
:maxLength="500"
v-model="formInline.remark"
:rows="4" />
</a-form-model-item>
</div>
</a-form-model>
</div>
</div>
<div class="box-button">
<!--发起文档对比-->
<a-button type="primary" @click="submit" v-has="'docComparsion:initiate:initiateComparison'">
{{ $t('docTool.comparison.initiateDocumentComparison') }}
</a-button>
</div>
<div id="images">
<div class="image" v-viewer="{movable: false}">
<img v-show="image" :src="imageUrl">
</div>
</div>
</internal-detail-page>
</template>
<script>
import JTable from '../../../components/jero/JTable.vue'
import { downloadFile, getFileAccessHttpUrl } from '../../../api/manage.js'
import { previewPdf } from '../../../utils/previewPdf.js'
import { Base64 } from 'js-base64'
import { mapGetters } from 'vuex'
import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import { getInitComparsionPageData, submitInitComparsion } from '../../../api/documentToolApi.js'
export default {
name: 'InitiateComparison',
components: { JTable, InternalDetailPage },
data () {
return {
loading: false,
labelCol: {
span: 6
},
wrapperCol: {
span: 18
},
loadingLeft: false,
queryParamLeft: {},
ipaginationLeft: {
current: 1,
pageSize: 50,
pageSizeOptions: ['10', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
selectedRowKeysLeft: [],
selectedRowsLeft: [],
dataSourceLeft: [],
loadingRight: false,
queryParamRight: {},
ipaginationRight: {
current: 1,
pageSize: 50,
pageSizeOptions: ['10', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
selectedRowKeysRight: [],
dataSourceRight: [],
selectedRowsRight: [],
formInline: {},
downLoadFileUrl: window._CONFIG.domianPreviewURL + '/sys/common/download',
downLoadImgUrl: window._CONFIG.domianWebImgURL + '/sys/common/download',
rules: {
// remark: [
// {
// max: 300,
// message: this.$t('RemarkInfo') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
// trigger: 'blur'
// }
// ]
},
columns: [
{
title: this.$t('number'),
width: 60,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: this.$t('number'),
ellipsis: true,
dataIndex: 'serialNumber',
width: 100
},
{
title: this.$t('title'),
ellipsis: true,
dataIndex: 'title',
width: 100
},
{
title: this.$t('docTool.comparison.textStatus'),
ellipsis: true,
dataIndex: 'fileType_dictText',
width: 100
},
{
title: this.$t('fileName'),
ellipsis: true,
dataIndex: 'fileName',
width: 100
}
],
tableColumns: [
{
title: this.$t('number'),
width: 60,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: this.$t('number'),
ellipsis: true,
dataIndex: 'serialNumber',
width: 100
},
{
title: this.$t('title'),
ellipsis: true,
dataIndex: 'title',
width: 100
},
{
title: this.$t('docTool.comparison.textStatus'),
ellipsis: true,
dataIndex: 'fileType_dictText',
width: 100
},
{
title: this.$t('fileName'),
ellipsis: true,
dataIndex: 'fileName',
width: 100
}
],
image: false,
imageUrl: ''
}
},
mounted () {
this.getListLeft()
this.getListRight()
},
methods: {
...mapGetters(['userInfo']),
goBack () {
this.$router.push({
path: '/docTool/docComparison'
})
},
searchQueryLeft () {
this.ipaginationLeft.current = 1
this.getListLeft()
},
searchResetLeft () {
this.queryParamLeft = {}
this.ipaginationLeft.current = 1
this.getListLeft()
},
onSelectChangeLeft (value, record) {
this.selectedRowKeysLeft = value
// this.selectedRowsLeft = []
// if (this.selectedRowKeysLeft.length > 1) {
// this.selectedRowKeysLeft.shift()
// }
// const content = record.filter(res => {
// return res.id === this.selectedRowKeysLeft[0]
// })
this.selectedRowsLeft = record
},
tableChangeLeft (pagination) {
this.ipaginationLeft = pagination
this.getListLeft()
},
searchQueryRight () {
this.ipaginationRight.current = 1
this.getListRight()
},
searchResetRight () {
this.queryParamRight = {}
this.ipaginationRight.current = 1
this.getListRight()
},
onSelectChangeRight (value, record) {
this.selectedRowKeysRight = value
// this.selectedRowsRight = []
// if (this.selectedRowKeysRight.length > 1) {
// this.selectedRowKeysRight.shift()
// }
// const content = record.filter(res => {
// return res.id === this.selectedRowKeysRight[0]
// })
this.selectedRowsRight = record
},
tableChangeRight (pagination) {
this.ipaginationRight = pagination
this.getListRight()
},
submit () {
if (!this.selectedRowsRight[0] || !this.selectedRowsLeft[0]) {
this.$message.warning(this.$t('docTool.comparison.pleaseSelectTheDataCompared'))
return
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.loading = true
const query = {
leftStandard: this.selectedRowsLeft[0].id,
rightStandard: this.selectedRowsRight[0].id,
remark: this.formInline.remark
}
submitInitComparsion(query).then((res) => {
if (res.success) {
console.log(res)
this.loading = false
this.$message.success(this.$t('operationSuccessful'))
this.$router.push({
path: '/docTool/DocDataComparison',
query: {
id: res.result
}
})
} else {
this.loading = false
this.$message.warning(res.message)
}
})
}
})
},
getListLeft () {
const queryParam = JSON.parse(JSON.stringify(this.queryParamLeft))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
const query = {
pageNo: this.ipaginationLeft.current,
pageSize: this.ipaginationLeft.pageSize,
fileId: '1',
splitStatus: '2',
...queryParam
}
this.loadingLeft = true
getInitComparsionPageData(query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length === 0) {
this.ipaginationLeft.current = 1
this.getListLeft()
return
}
this.dataSourceLeft = res.result.records || []
this.ipaginationLeft.total = res.result.total
}
}).finally(() => {
this.loadingLeft = false
})
},
selectLeftClick (fileQuery) {
if (fileQuery) {
const fileName = fileQuery.fileName
const index1 = fileName.lastIndexOf('.')
const index2 = fileName.length
const fileSuffix = fileName.substring(index1, index2)
if (fileSuffix === '.pdf') {
// window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + fileQuery.fileId + '&userName=' + this.userInfo().username))
const url = previewPdf(fileQuery.fileId)
window.open(url)
} else if (fileSuffix === '.docx' || fileSuffix === '.doc') {
const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.fileId + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix === '.xlsx' || fileSuffix === '.xls') {
const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.fileId + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix === '.png' || fileSuffix === '.jpeg' || fileSuffix === '.gif' || fileSuffix === '.jpg') {
// const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadImgUrl + '/' + fileQuery.fileId + fileSuffix)
// window.open(url, '_blank')
this.image = true
this.imageUrl = getFileAccessHttpUrl(fileQuery.fileId)
// 获取viewer实例
const viewer = this.$el.querySelector('.image').$viewer
// 调用show方法进行显示预览图
viewer.show()
} else {
downloadFile('/sys/common/downLoadFile', fileQuery.fileName, { id: fileQuery.fileId })
}
}
},
getListRight () {
const queryParam = JSON.parse(JSON.stringify(this.queryParamRight))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
const query = {
pageNo: this.ipaginationRight.current,
pageSize: this.ipaginationRight.pageSize,
fileId: '1',
splitStatus: '2',
...queryParam
}
this.loadingRight = true
getInitComparsionPageData(query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length === 0) {
this.pageNoRight = 1
this.getListRight()
return
}
this.dataSourceRight = res.result.records || []
this.ipaginationRight.total = res.result.total
}
}).finally(() => {
this.loadingRight = false
})
}
}
}
</script>
<style scoped lang="less">
@import '~../../../assets/less/common.less';
.can-scroll-content {
height: calc(100% - 52px);
overflow: auto;
}
.detail-content-box {
display: flex;
height: calc(100% - 152px);
min-height: calc(340px + 46px + 40px + 72px + 48px);
}
.detail-content-left {
width: 50%;
border-right: 2px #EFF1F3 solid;
padding: 24px 32px;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
height: 100%;
}
.detail-content-right {
width: 50%;
padding: 24px 32px;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
height: 100%;
}
.box-title-text-remarks {
line-height: 1.4;
display: flex;
margin-bottom: 10px;
}
.title-text-remarks {
width: 68px;
color: #000F16;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
margin-top: 6px;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-button {
padding: 10px 24px;
text-align: right;
}
.box-button-standard {
width: 100%;
margin-top: 20px;
}
.box-button-standard-left {
width: 111px;
height: 46px;
padding: 0 6px;
box-sizing: border-box;
display: inline-block;
border: 1px solid #CED0D8;
border-right: none;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
line-height: 46px;
color: #040B29;
}
.box-button-standard-right {
width: calc(100% - 111px);
height: 46px;
padding: 0 4px;
box-sizing: border-box;
display: inline-block;
border: 1px solid #CED0D8;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
line-height: 46px;
color: #9B9DA9;
}
.remarks {
margin-top: 20px;
width: 50%;
padding: 0 32px;
box-sizing: border-box;
}
.item-model {
width: calc(100% - 232px);
}
.submit-button {
width: 100%;
height: 60px;
text-align: right;
padding: 14px 32px 0;
box-sizing: border-box;
border-top: 2px #eff1f3 solid;
background: #ffffff;
position: fixed;
bottom: 0;
}
.box-button-standard-right-color {
color: #040B29;
cursor: pointer;
}
</style>
@@ -0,0 +1,254 @@
<template>
<div>
<a-drawer
:title="$t('docTool.comparison.comment')"
:maskClosable="false"
:width="482"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible">
<div class="button-box">
<a-input-search class="box-input box-input-search" allowClear
@search="allowClearChange"
:placeholder="$t('pleaseEnter')+$t('docTool.comparison.comment')"
v-model="commentContent"></a-input-search>
<a-button @click="submitQuery" style="margin-right: 8px;" type="primary">{{ $t('query') }}</a-button>
<!--发表评论-->
<a-button @click="handleSubmit" :title="$t('docTool.comparison.publishComment')" type="primary">
{{ $t('docTool.comparison.publishComment') }}
</a-button>
</div>
<div class="comment-box" v-if="dataList && dataList.length > 0">
<div class="comment-box-top-box" v-for="(item,index) in dataList" :key="index">
<div class="comment-item">
<div class="comment-item-img">
<img src="../../../../assets/image/daiban.png" class="img" alt="">
</div>
<div class="comment-item-content">
<div class="comment-item-title">
<a-tooltip>
<template #title>{{ item.name }}</template>
<div class="comment-item-title-name">{{ item.name }}</div>
</a-tooltip>
<div class="comment-item-title-time">{{ item.createTime }}</div>
<div class="comment-item-title-icon" @click="messageClick(item)"><a-icon type="message" /></div>
</div>
<div class="comment-item-content-text">{{ item.content }}</div>
</div>
</div>
<div class="inside-box" v-if="item.resComVoList && item.resComVoList.length > 0">
<div class="comment-item inside-comment-item" v-for="(val,indexOne) in item.resComVoList" :key="indexOne">
<div class="comment-item-img">
<img src="../../../../assets/image/daiban.png" class="img" alt="">
</div>
<div class="comment-item-content">
<div class="comment-item-title">
<a-tooltip>
<template #title>{{ val.name }}</template>
<div class="comment-item-title-name">{{ val.name }}</div>
</a-tooltip>
<div class="comment-item-title-time">{{ val.createTime }}</div>
<div class="comment-item-title-icon" @click="messageClick(item)"><a-icon type="message" /></div>
</div>
<div class="comment-item-content-text">{{ val.content }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="comment-box-text" v-else>{{ $t('docTool.comparison.noComment') }}</div>
</a-drawer>
<!--发表评论-->
<comparison-add-reply-comment ref="comparisonAddReplyComment" @ok="getList" />
</div>
</template>
<script>
import { getCommentList } from '../../../../api/documentToolApi.js'
// 添加评论和回复评论弹框
import ComparisonAddReplyComment from './ComparisonAddReplyComment.vue'
export default {
name: 'CommentList',
components: { ComparisonAddReplyComment },
data () {
return {
visible: false,
dataList: [],
commentContent: '',
loading: false
}
},
methods: {
handleCancel () {
this.visible = false
},
getData () {
this.visible = true
this.commentContent = ''
this.getList()
},
handleSubmit () {
this.$refs.comparisonAddReplyComment.title = this.$t('docTool.comparison.publishComment')
this.$refs.comparisonAddReplyComment.open({})
},
allowClearChange () {
this.getList()
},
submitQuery () {
this.getList()
},
getList () {
this.loading = true
getCommentList({
id: this.$route.query.id,
str: this.commentContent
}).then((res) => {
if (res.success) {
this.dataList = res.result || []
} else {
this.dataList = []
}
}).finally(() => {
this.loading = false
})
},
messageClick (row) {
const obj = {}
obj.projectCommentId = row.id
this.$refs.comparisonAddReplyComment.title = this.$t('docTool.comparison.replyToComments')
this.$refs.comparisonAddReplyComment.open(obj)
}
}
}
</script>
<style scoped lang="less">
.comment-box {
position: absolute;
left: 0;
height: calc(100% - 140px);
width: 100%;
overflow: auto;
padding: 0 24px 24px 24px;
box-sizing: border-box;
}
.comment-box-top-box {
padding: 30px 24px 24px 24px;
box-sizing: border-box;
border: 1px solid #F1F2F4;
border-radius: 4px;
margin-bottom: 24px;
}
.img-box {
width: 32px;
height: 32px;
border-radius: 50%;
display: inline-block;
margin-right: 8px;
position: absolute;
.img {
width: 100%;
height: 100%;
}
}
.inside-box {
background: #F6F7FA;
border-radius: 4px;
margin-left: 40px;
width: calc(100% - 40px);
padding: 18px;
box-sizing: border-box;
margin-top: 15px;
}
.button-box {
text-align: right;
margin-bottom: 24px;
}
.comment-box-text {
text-align: center;
margin-top: 40px;
}
.box-input {
width: calc(100% - 183px);
margin-right: 8px;
}
.box-input-search {
/deep/ .ant-input-search-icon {
display: none;
}
}
.comment-item {
display: flex;
&-img {
width: 32px;
height: 32px;
border-radius: 50%;
margin-right: 8px;
.img {
width: 100%;
height: 100%;
}
}
&-content {
flex: 1;
width: 0;
&-text {
font-size: 14px;
font-weight: 400;
color: #040B29;
word-break: break-word;
}
}
&-title {
width: 100%;
display: flex;
&-name {
font-size: 14px;
font-weight: bold;
color: #040B29;
margin-right: 8px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
&-time {
flex-shrink: 0;
font-size: 14px;
font-weight: 400;
color: #6F7385;
margin-right: 8px;
}
&-icon {
flex-shrink: 0;
margin-left: auto;
}
}
}
.inside-comment-item {
margin-bottom: 15px;
}
</style>
@@ -0,0 +1,82 @@
<template>
<j-modal
:title="$t('docTool.comparison.fullTextComments')"
:width="600"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
switchFullscreen
@cancel="visible = false">
<template slot="footer">
<a-button type="primary" :loading="confirmLoading" @click="fullTextCommentsSubmit">
{{ $t('submit') }}
</a-button>
</template>
<a-form-model :model="formInlineText" class="formAdd" :rules="rulesText" ref="ruleFormText">
<a-form-model-item prop="comment"
:labelCol="labelCol" :wrapperCol="wrapperCol"
:label="$t('docTool.comparison.fullTextComments')">
<a-textarea :placeholder="$t('pleaseEnter')+' '+$t('docTool.comparison.fullTextComments')"
v-model="formInlineText.comment"
:maxLength="500"
:rows="4" />
</a-form-model-item>
</a-form-model>
</j-modal>
</template>
<script>
import { addFullTextComment } from '../../../../api/documentToolApi.js'
export default {
name: 'ComparisonAddFullComment',
data () {
return {
visible: false, // 全文评论弹框是否显示
confirmLoading: false,
formInlineText: {},
rulesText: {},
labelCol: {
span: 5
},
wrapperCol: {
span: 18
}
}
},
methods: {
open (comments) {
this.formInlineText.comment = comments
this.visible = true
},
// 添加全文评论弹框的提交按钮
fullTextCommentsSubmit () {
this.$refs.ruleFormText.validate(valid => {
if (valid) {
const formInlineText = Object.assign({}, this.formInlineText)
this.confirmLoading = true
const query = {
id: this.$route.query.id,
comments: formInlineText.comment
}
addFullTextComment(query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
}
})
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,117 @@
<template>
<j-modal
:title="title"
:width="500"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
@ok="handleOkComment"
switchFullscreen
@cancel="handleCancelComment"
>
<a-form-model :model="formInline" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="title">{{ title }}</span>
</div>
<a-form-model-item v-if="title === $t('docTool.comparison.replyToComments')" class="item-model" :prop="'replyContent'">
<a-textarea
:placeholder="$t('pleaseEnter')+title"
:disabled="false"
:maxLength="500"
v-model="formInline.replyContent"
:autoSize="{ minRows: 2, maxRows: 6 }" />
</a-form-model-item>
<a-form-model-item v-else-if="title === $t('docTool.comparison.publishComment')" class="item-model" :prop="'commentContent'">
<a-textarea
:placeholder="$t('pleaseEnter')+title"
:disabled="false"
:maxLength="500"
v-model="formInline.commentContent"
:autoSize="{ minRows: 2, maxRows: 6 }" />
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</j-modal>
</template>
<script>
import { addComment } from '../../../../api/documentToolApi.js'
export default {
name: 'ComparisonAddReplyComment',
data () {
return {
title: this.$t('docTool.comparison.comment'),
visible: false,
confirmLoading: false,
formInline: {},
rules: {
commentContent: [
{
required: true,
message: this.$t('docTool.comparison.publishComment') + this.$t('cannotEmpty'),
trigger: 'blur'
}
],
replyContent: [
{
required: true,
message: this.$t('docTool.comparison.replyToComments') + this.$t('cannotEmpty'),
trigger: 'blur'
}
]
}
}
},
methods: {
open (formInLine) {
this.visible = true
this.formInline = Object.assign({}, formInLine)
},
handleOkComment () {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let query = {}
if (this.title === this.$t('docTool.comparison.publishComment')) {
query = {
comment: this.formInline.commentContent,
infoId: this.$route.query.id
}
} else if (this.title === this.$t('docTool.comparison.replyToComments')) {
query = {
comment: this.formInline.replyContent,
parentId: this.formInline.projectCommentId,
infoId: this.$route.query.id
}
}
this.confirmLoading = true
addComment(query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.$emit('ok')
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
handleCancelComment () {
this.visible = false
}
}
}
</script>
<style scoped lang="less">
@import '~../../../../assets/less/common.less';
</style>
@@ -0,0 +1,135 @@
<template>
<j-modal
:title="title"
:width="600"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
switchFullscreen
@cancel="visible = false"
>
<template slot="footer">
<a-button key="back" @click="visible = false">
{{ $t('cancel') }}
</a-button>
<a-button type="primary" :loading="confirmLoading" @click="fullTextCommentsSubmit">
{{ $t('submit') }}
</a-button>
</template>
<a-form-model :model="formInlineText" class="formAdd" :rules="rulesText" ref="ruleFormText">
<a-form-model-item class="item-model"
prop="comment"
v-if="title === $t('docTool.comparison.fullTextComments')"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
:label="$t('docTool.comparison.fullTextComments')">
<a-textarea :placeholder="$t('pleaseEnter') + $t('docTool.comparison.fullTextComments')"
v-model="formInlineText.comment"
:maxLength="500"
:rows="4" />
</a-form-model-item>
<a-form-model-item class="item-model"
prop="comment"
v-if="title === $t('docTool.comparison.comparativeComments')"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
:label="$t('docTool.comparison.comparativeComments')">
<a-textarea :placeholder="$t('pleaseEnter')+$t('docTool.comparison.comparativeComments')"
v-model="formInlineText.comment"
:maxLength="500"
:rows="4" />
</a-form-model-item>
</a-form-model>
</j-modal>
</template>
<script>
import { putAction } from '../../../../api/manage.js'
import { addFullTextComment, editComparisonComment } from '../../../../api/documentToolApi.js'
export default {
name: 'ComparisonResultEditModal',
data () {
return {
title: '',
visible: false,
confirmLoading: false,
formInlineText: {},
rulesText: {},
labelCol: {
span: 5
},
wrapperCol: {
span: 18
}
}
},
methods: {
open (form) {
this.initData()
this.visible = true
this.formInlineText = Object.assign({}, form)
},
initData () {
this.$nextTick(() => {
this.$refs.ruleFormText.clearValidate()
})
},
// 发表评论弹框的提交按钮点击
fullTextCommentsSubmit () {
this.$refs.ruleFormText.validate(valid => {
if (valid) {
if (this.title === this.$t('docTool.comparison.fullTextComments')) {
this.fullTextComments()
} else {
this.comparaComments()
}
}
})
},
// 全文评论提交
fullTextComments () {
this.confirmLoading = true
const query = {
id: this.$route.query.id,
comments: this.formInlineText.comment
}
addFullTextComment(query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.$emit('ok')
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
},
// 发表评论提交
comparaComments () {
this.confirmLoading = true
const query = {
infoId: this.$route.query.id,
id: this.formInlineText.id,
comment: this.formInlineText.comment
}
editComparisonComment(query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.$emit('ok')
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
}
}
}
</script>
<style scoped lang="less">
@import '~../../../../assets/less/common.less';
</style>
@@ -0,0 +1,388 @@
<template>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<!--标准号/标准名称-->
<a-col :md="6" :sm="12">
<a-form-item :label="$t('standardSelect.standardNumOrName')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardNumOrName')"
v-model="queryParam.serialNumberOrName"></a-input>
</a-form-item>
</a-col>
<!--拆分状态-->
<a-col :md="6" :sm="12">
<a-form-item :label="$t('docTool.split.splitState')">
<j-dict-select-tag
class="box-input"
v-model="queryParam.splitStatus"
:placeholder="$t('pleaseSelect') + $t('docTool.split.splitState')"
:type="'select'"
:triggerChange="false"
dictCode="split_status" />
</a-form-item>
</a-col>
<!--编辑人-->
<a-col :md="6" :sm="12">
<a-form-item :label="$t('docTool.split.editor')">
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.split.editor')" v-model="queryParam.author"></a-input>
</a-form-item>
</a-col>
<div style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 8px" v-has="'split:sarFileSplitInfo:search'">
{{ $t('query') }}
</a-button>
<a-button type="primary" @click="searchReset" icon="reload" ghost>{{ $t('reset') }}</a-button>
</div>
</a-row>
</a-form>
</div>
<div class="table-operator">
<!--拆分已入库文本-->
<a-button icon="plus" type="primary" @click="handleModule" v-has="'split:sarFileSplitInfo:splitFile'">{{
$t('docTool.split.splitText')
}}
</a-button>
<!--导入拆分结果-->
<a-button icon="download" type="primary" ghost @click="handleExport" v-has="'split:sarFileSplitInfo:splitResult'">
{{ $t('docTool.split.importResults') }}
</a-button>
<!--批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'split:sarFileSplitInfo:deleteBatch'">
{{ $t('batchDelete') }}
</a-button>
<!--更改权限-->
<a-button type="primary" icon="sync" ghost @click="handleChangePermission" v-has="'split:sarFileSplitInfo:changePermissions'">
{{ $t('docTool.split.changePermissions') }}
</a-button>
</div>
<div>
<j-table
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="ipagination"
:scroll="{x: '100%', y: yScrollHeight}"
:loading="loading"
:operation-list="operationList"
@change="handleTableChange"
@operationClick="operationClick">
<!--跳转标准详情-->
<template v-slot:detail="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{ text }}</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
</j-table>
</div>
<!--拆分已入库文本弹框-->
<split-text ref="splitText" @ok="modalFormOk" />
<!--导入拆分结果-->
<import-split-result-modal ref="importResultModal" @ok="modalFormOk" />
<!--更改权限-->
<user-select-modal ref="userSelectModal" check-required @change="continueChangePermission" />
</a-card>
</template>
<script>
import '../../../assets/less/common.less'
import JTable from '../../../components/jero/JTable.vue'
import SplitText from './modules/SplitText.vue'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { releaseSplitStandard, changePermission, withdraw } from '@api/documentToolApi'
import ImportSplitResultModal from './modules/ImportSplitResultModal.vue'
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
import { SplitStatus, StandardSource } from '@/enums/commonEnums'
import { mapGetters } from 'vuex'
export default {
name: 'DocumentSplit',
components: { JTable, SplitText, ImportSplitResultModal, UserSelectModal },
mixins: [JeroListMixin],
computed: {
...mapGetters(['userInfo']),
administrators () {
const adminRoleList = window._CONFIG.adminRoleCode.split(',')
const userRoleList = this.userInfo.roleCode.split(',')
return userRoleList.some(tt => adminRoleList.includes(tt))
}
},
data () {
return {
operationList: [
// 发布
{
text: this.$t('release'),
clickEvent: 'handleRelease',
has: 'split:sarFileSplitInfo:release',
show: (record) => {
// 创建人(更改权限更改的是这个字段)是当前登录人,且状态为编辑中可以发布
return record.createBy === this.userInfo.id && record.splitStatus === SplitStatus.EDITING.value
}
},
// 撤回
{
text: this.$t('withdraw'),
clickEvent: 'handleWithdraw',
has: 'split:sarFileSplitInfo:withdraw',
show: (record) => {
// 创建人(更改权限更改的是这个字段)是当前登录人,且状态为已发布可以撤回
return record.createBy === this.userInfo.id && record.splitStatus === SplitStatus.RELEASED.value
}
},
// 查看
{
text: this.$t('view'),
clickEvent: 'handleDetail',
has: 'split:sarFileSplitItems:page'
},
// 编辑
{
text: this.$t('edit'),
clickEvent: 'handleEdit',
has: 'split:sarFileSplitItems:edit',
show: (record) => {
// 创建人(更改权限更改的是这个字段)是当前登录人,且状态为编辑中可以编辑
return record.createBy === this.userInfo.id && record.splitStatus === SplitStatus.EDITING.value
}
},
// 删除
{
text: this.$t('delete'),
clickEvent: 'handleDelete',
has: 'split:sarFileSplitInfo:delete',
show: (record) => {
// 创建人(更改权限更改的是这个字段)是当前登录人或用户为管理员,且状态为编辑中可以删除
return (record.createBy === this.userInfo.id || this.administrators)
}
}
],
columns: [
// 标准号
{
dataIndex: 'serialNumber',
title: this.$t('standardSelect.standardNumber'),
width: 150,
scopedSlots: { customRender: 'detail' }
},
// 标准名称
{
dataIndex: 'title',
title: this.$t('standardSelect.standardName'),
width: 150,
scopedSlots: { customRender: 'detail' }
},
// 文件状态
{
dataIndex: 'fileType_dictText',
title: this.$t('docTool.split.fileStatus'),
width: 150
},
// 文件名称
{
dataIndex: 'fileName',
title: this.$t('fileName'),
width: 180
},
// 拆分状态
{
dataIndex: 'splitStatus_dictText',
title: this.$t('docTool.split.splitState'),
width: 150
},
// 编辑人
{
dataIndex: 'author',
title: this.$t('docTool.split.editor'),
width: 150
},
// 拆分时间
{
dataIndex: 'createTime',
title: this.$t('docTool.split.splitTime'),
width: 150
},
// 拆分结果
{
dataIndex: 'splitResult',
title: this.$t('docTool.split.splitResult'),
sorter: true,
width: 150
},
// 操作
{
title: this.$t('operation'),
fixed: 'right',
width: 150,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/laws/DocumentTool/documentSplit/queryByPage', // 表格数据
deleteBatch: '/laws/DocumentTool/documentSplit/deleteBatch', // 批量删除
delete: '/laws/DocumentTool/documentSplit/delete'
}
}
},
methods: {
// 拆分已入库文本按钮点击
handleModule () {
this.$refs.splitText.open()
},
// 导入拆分结果
handleExport () {
this.$refs.importResultModal.open()
},
/**
* 发布
*/
handleRelease ({ id }) {
this.$confirm({
title: this.$t('confirmRelease'),
content: this.$t('confirmReleaseContent'),
onOk: () => {
this.loading = true
releaseSplitStandard({ id }).then(res => {
if (res.success) {
this.$message.success(res.message)
this.modalFormOk()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
/**
* 撤回
* @param id
*/
handleWithdraw ({ id }) {
this.$confirm({
title: this.$t('confirmWithdraw'),
content: this.$t('confirmWithdrawContent'),
onOk: () => {
this.loading = true
withdraw({ id }).then(res => {
if (res.success) {
this.$message.success(res.message)
this.modalFormOk()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
// 编辑
handleEdit (record) {
this.$router.push({
path: '/docTool/DocSplitDetail',
query: {
infoId: record.id,
infoNumber: record.serialNumber,
createBy: record.createBy,
standardName: record.title
}
})
},
/**
* 表格操作列的查看
* @param id
*/
handleDetail ({ id }) {
this.$openPageNewSheet({
path: '/docTool/StandardSplitSheet',
query: {
id
}
})
},
splitTextVisible (val, num) {
if (num === 1) {
this.$refs.tableData.$emit('searchGetData')
}
},
importResultVisible (val, num) {
if (num === 1) {
this.$refs.tableData.$emit('searchGetData')
}
},
/**
* 更改权限
*/
handleChangePermission () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectAtLeastOne'))
return
}
this.$refs.userSelectModal.open()
},
continueChangePermission (id) {
this.loading = true
const params = {
ids: this.selectedRowKeys.join(','),
createBy: id
}
changePermission(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.modalFormOk()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 跳转标准详情
* @param record
*/
toDetailPage ({ standardId, splitStandardSource }) {
let path
// 根据来源跳转不同的详情页
switch (splitStandardSource) {
// 国内
case StandardSource.DOMESTIC.value:
path = '/standardRegulationLibrary/DomesticStandardDetail'
break
// 海外
case StandardSource.OVERSEAS.value:
path = '/standardRegulationLibrary/OverseasStandardDetail'
break
// 企标
case StandardSource.ENTERPRISE.value:
path = '/enterpriseStandardLibrary/enterpriseStandardDetail'
break
default:
break
}
if (!path) {
return
}
const query = {
id: standardId
}
this.$openPageNewSheet({
path, query
})
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>
@@ -0,0 +1,677 @@
<template>
<internal-detail-page :title="pageTitle" :content-padding="0">
<div class="page-left-right-layout">
<!--树部分-->
<div class="page-left-box">
<a-input-search class="tree-search" v-model="searchValue" :placeholder="$t('nodeQuickLookup')" @search="onSearch" />
<div class="page-tree-box page-tree-box-has-search">
<a-spin :spinning="treeLoading">
<a-tree :show-line="true"
:show-icon="true"
:tree-data="treeData"
:selected-keys="selectedKeys"
:expanded-keys.sync="expandedKeys"
:replaceFields="{key: 'id'}">
<template #title="record">
<div class="tree-operate-node"
@mouseenter="handleTreeMouseover(record.id)"
@mouseleave="handleTreeMouseout(record.id)"
@click="handleSelectTreeNode(record)">
<a-icon class="parent-node-icon"
type="folder"
v-if="record.dataRef.children && record.dataRef.children.length > 0" />
<a-tooltip>
<template #title>
{{ record.name }}{{ record.itemName }}
</template>
<span class="tree-node-custom-title">{{ record.name }} {{ record.itemName }}</span>
</a-tooltip>
<div class="tree-operate-node-btn-box"
:class="{'tree-operate-node-btn-box-hide': record.id !== mouseInNodeKey}">
<!--新增-->
<a-button icon="plus"
class="tree-operate-node-btn"
@click.stop="orgAdd(record)"
v-has="'split:sarFileSplitMenu:add'"></a-button>
<!--编辑-->
<a-button class="tree-operate-node-btn"
@click.stop="orgEdit(record)"
v-if="record.pid"
v-has="'split:sarFileSplitMenu:update'">
<i class="iconfont icon-bianji" />
</a-button>
<!--删除根节点不能删除-->
<a-button class="tree-operate-node-btn"
v-if="record.pid"
v-has="'split:sarFileSplitMenu:delete'"
@click.stop="orgDelete(record)">
<i class="iconfont icon-shanchu_" />
</a-button>
<!--节点上移是否可以上移在树形数据中应该有字段标识-->
<a-button icon="up"
v-if="record.pid"
class="tree-operate-node-btn"
@click.stop="orgMoveUp(record)"
v-has="'split:sarFileSplitMenu:moveUp'">
</a-button>
<!--节点下移是否可以下移在树形数据中应该有字段标识-->
<a-button icon="down"
v-if="record.pid"
class="tree-operate-node-btn"
@click.stop="orgmoveDown(record)"
v-has="'split:sarFileSplitMenu:moveDown'">
</a-button>
</div>
</div>
</template>
</a-tree>
</a-spin>
</div>
</div>
<!--表格部分-->
<div class="page-right-box">
<div class="table-page-search-wrapper">
<search ref="searchRef"
:url="url"
:get-query-condition-func="getQueryConditionFunc"
search-has="split:sarFileSplitItems:search"
@search="searchQuery"
@reset="searchReset" />
</div>
<!--操作按钮-->
<div class="table-operator">
<!--新增-->
<!--<a-button icon="plus" type="primary" @click="handleAdd" v-has="'split:sarFileSplitItems:add'">{{ $t('newlyAdded') }}</a-button>-->
<!--导入-->
<span @click="handleImport">
<a-button type="primary" icon="download" ghost v-if="!menuId">{{ $t('import') }}</a-button>
<a-upload v-if="menuId"
name="file"
:showUploadList="false"
:multiple="false"
:headers="tokenHeader"
:action="importExcelUrl"
v-has="'split:sarFileSplitItems:import'"
:data="uploadData"
@change="handleImportExcel">
<a-button type="primary" icon="download" ghost>{{ $t('import') }}</a-button>
</a-upload>
</span>
<!--导出-->
<a-button icon="upload"
type="primary"
ghost
v-has="'split:sarFileSplitItems:export'"
@click="handleExportXls">
{{ $t('export') }}
</a-button>
<!--批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'split:sarFileSplitItems:batchDelete'">
{{ $t('batchDelete') }}
</a-button>
<!--模板下载-->
<a-button type="primary"
icon="download"
ghost
v-has="'split:sarFileSplitItems:template'"
@click="downTemplate($t('docTool.split.documentSplitTemplate'), '.zip')">
{{ $t('templateDownload') }}
</a-button>
<!--批量复制-->
<a-button type="primary" ghost @click="handleBatchCopy" v-has="'split:sarFileSplitItems:batchCopy'">
{{ $t('docTool.split.batchCopy') }}
</a-button>
<!--批量编辑-->
<a-button type="primary" ghost @click="handleBatchEdit" v-has="'split:sarFileSplitItems:batchUpdate'">
{{ $t('docTool.split.batchEdit') }}
</a-button>
<!--合并条款-->
<a-button type="primary" ghost @click="handleMerge" v-has="'split:sarFileSplitItems:merge'">
{{ $t('docTool.split.mergerClause') }}
</a-button>
</div>
<div>
<j-table
v-if="columns && columns.length > 0"
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="ipagination"
:scroll="{x: '100%', y: yScrollHeight}"
:operation-list="operationList"
:loading="loading"
@change="tableOnChange"
@operationClick="operationClick">
<!-- 详情-->
<template slot="detailClick" slot-scope="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a class="table-text textName" @click="detailClick(record)" v-if="text || text === 0">{{ text }}</a>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!--条文内容-->
<template slot="item_content" slot-scope="{text, record}">
<div class="table-text" v-if="text || text === 0" @click="showContent('item_content', text,record)">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
<!--条文解读-->
<template slot="interpretation_articles" slot-scope="{text, record}">
<div class="table-text" v-if="text || text === 0" @click="showContent('interpretation_articles', text,record)">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
</j-table>
</div>
</div>
</div>
<!--条文内容条文解读-->
<split-clause-detail ref="splitClauseDetail" />
<!--添加节点-->
<split-detail-node-add ref="splitDetailNodeAdd" @ok="nodeAddOk" />
<!--批量编辑-->
<split-detail-batch-edit-drawer ref="batchEditDrawer" @ok="modalFormOk" />
<!--条款添加-->
<split-add-form ref="modalForm" :flag="'4'" :infoId="infoId" :menuId="menuId" :itemId="itemId" @ok="modalFormOk" />
</internal-detail-page>
</template>
<script>
import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import JTable from '../../../components/jero/JTable.vue'
// 条款添加
import SplitAddForm from './modules/SplitAddForm.vue'
// 条款内容弹框
import SplitClauseDetail from './modules/SplitClauseDetail.vue'
// 添加左侧树节点弹框
import SplitDetailNodeAdd from './modules/SplitDetailNodeAdd.vue'
import { mapGetters } from 'vuex'
import { ConfigurableTableMixin } from '../../../mixins/ConfigurableTableMixin.js'
import {
getDocSplitTableHeader,
getDocSplitSearch,
deleteClauseTreeNode,
moveUpOrDownClauseTreeNode,
batchCopyClause,
merageClause,
getClauseTreeData,
copyClause
} from '../../../api/documentToolApi.js'
import Search from '../../../components/customField/Search.vue'
import { isHasPermission } from '../../../utils/hasPermission.js'
import SplitDetailBatchEditDrawer from './modules/SplitDetailBatchEditDrawer.vue'
import { downFile, downloadFile, postAction } from '../../../api/manage'
export default {
name: 'DocumentSplitDetail',
components: {
InternalDetailPage,
JTable,
SplitAddForm,
SplitClauseDetail,
SplitDetailNodeAdd,
Search,
SplitDetailBatchEditDrawer
},
mixins: [ConfigurableTableMixin],
data () {
return {
data: [],
loading: false, // 提交的加载
treeLoading: false, // 树形区域的加载
confirmLoading: false,
nodeTreeItem: null, // 右键菜单
tmpStyle: '', // 右键菜单位置
infoId: '',
menuId: '',
itemId: '',
itemVal: {},
uploadMenuId: '',
deleteNode: false,
moveDownFlag: false,
moveUpFlag: false,
fullWidth: '',
parameter: {},
showAction: false,
flag: '4', // 查询要用到
operateSlotName: 'action',
getQueryConditionFunc: getDocSplitSearch,
getTableHeaderFunc: getDocSplitTableHeader,
treeData: [],
searchValue: '',
selectedKeys: [],
mouseInNodeKey: null, // 鼠标悬浮的节点key值
// 操作栏
operationList: [
// 编辑
{
text: this.$t('edit'),
clickEvent: 'handleEdit',
has: 'split:sarFileSplitItems:update'
},
// 复制
{
text: this.$t('copy'),
clickEvent: 'handleCopy',
has: 'split:sarFileSplitItems:copy'
},
// 删除
{
text: this.$t('delete'),
clickEvent: 'handleDelete',
has: 'split:sarFileSplitItems:delete'
}
],
url: {
list: '/laws/DocumentTool/documentSplit/queryDocumentSplitDetail',
importUrl: '/split/sarFileSplitItems/importSplitItems', // 导入
exportXlsUrl: '/split/sarFileSplitItems/exportSplitInfoZip', // 导出
delete: '/laws/DocumentTool/documentSplit/deleteDocumentSplitDetail', // 删除
deleteBatch: '/laws/DocumentTool/documentSplit/deleteBatchDocumentSplitDetail', // 批量删除
downTemplateUrl: '/laws/DocumentTool/documentSplit/downloadImportTemplate' // 模板下载
},
disabledMixinsCreate: true,
tableSlotField: ['item_content', 'interpretation_articles'],
uploadData: {},
isBackTitle: true,
expandedKeys: []
}
},
computed: {
// 页面标题是标准名称
pageTitle () {
return this.$route.query.infoNumber + ' ' + this.$route.query.standardName
},
yScrollHeight () {
/**
* 前几个使用变量是为了配合iframe嵌套,算出页面显示范围的高度
* 48px:分页器的高度
* 48pxa-card的padding(上24+下24
* 54px:表头行的高度
*/
return `calc(100vh - ${this.defaultHeight['user-info-height']} - ${this.defaultHeight['breadcrumb-height']} - ${this.defaultHeight.oneLineOperationHeight} - 48px - 48px - 54px - ${this.isBackTitle ? '56px' : '0px'})`
},
...mapGetters(['userInfo']),
administrators () {
const adminRoleList = window._CONFIG.adminRoleCode.split(',')
const userRoleList = this.userInfo.roleCode.split(',')
return userRoleList.some(tt => adminRoleList.includes(tt))
}
},
mounted () {
this.operateColumn.scopedSlots.customRender = 'action'
this.showAction = this.$route.query.createBy === this.userInfo.id || this.administrators
this.infoId = this.$route.query.infoId
this.filters = {
menu_id: this.menuId,
info_id: this.infoId
}
this.getTableHeader()
this.loadData()
// 过滤没有权限的按钮
if (this.needFilterTableBtn) {
this.operationList = this.operationList.filter(item => !item.has || isHasPermission(item.has))
}
this.infoId = this.$route.query.infoId
this.loadMenuData()
},
methods: {
/**
* 树节点鼠标移入
* @param key
*/
handleTreeMouseover (key) {
this.mouseInNodeKey = key
},
/**
* 树节点鼠标移出
* @param key
*/
handleTreeMouseout (key) {
if (this.mouseInNodeKey === key) {
this.mouseInNodeKey = null
}
},
/**
* 选中树节点
* @param dataRef
*/
handleSelectTreeNode ({ dataRef }) {
this.selectedKeys = [dataRef.id]
this.menuId = this.selectedKeys[0]
this.uploadData = {
menuId: this.menuId,
infoId: this.infoId
}
this.filters.info_id = this.infoId
this.filters.menu_id = this.menuId
this.loadData()
},
/**
* 显示条款内容、条文解读弹框
* @param fieldName
* @param val
*/
showContent (fieldName, val) {
const title = (this.columns.find(tt => tt.dbFieldName === fieldName) || {}).dbFieldTxt
if (title) {
this.$refs.splitClauseDetail.title = title
}
this.$refs.splitClauseDetail.open(val)
},
// 获取左侧目录数据
loadMenuData () {
const params = {
infoId: this.infoId,
name: this.searchValue
}
this.treeLoading = true
getClauseTreeData(params).then(res => {
if (res.success) {
this.treeData = res.result || []
this.expandedKeys = this.treeData.length > 0 ? [this.treeData[0].id] : []
}
}).finally(() => {
this.treeLoading = false
})
},
// 用于点击空白处隐藏增删改菜单
clearMenu () {
this.nodeTreeItem = null
},
// 树形新增
orgAdd (record) {
console.log(record)
this.$refs.splitDetailNodeAdd.add(record.dataRef, this.infoId)
},
// 树形修改
orgEdit (record) {
this.$refs.splitDetailNodeAdd.edit(record.dataRef, this.infoId)
},
// 添加节点完成后的回调
nodeAddOk (expandId) {
if (expandId && expandId.length > 0) {
this.onExpand(expandId)
}
this.loadMenuData()
this.loadData()
},
// 树形删除
orgDelete (record) {
this.$confirm({
content: this.$t('confirmDeleteNodes'),
onOk:
async () => {
deleteClauseTreeNode({ id: record.dataRef.id }).then(res => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.loadMenuData()
this.loadData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
},
// 树上移
orgMoveUp (record) {
const query = {
moveFlag: 'up',
infoId: this.infoId,
sarFileSplitMenu: {
id: record.dataRef.id,
pId: record.dataRef.pid,
displaySeq: record.dataRef.displaySeq
}
}
moveUpOrDownClauseTreeNode(query).then(res => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.loadMenuData()
this.loadData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
},
// 树下移
orgmoveDown (record) {
const query = {
moveFlag: 'down',
infoId: this.infoId,
sarFileSplitMenu: {
id: record.dataRef.id,
pId: record.dataRef.pid,
displaySeq: record.dataRef.displaySeq
}
}
moveUpOrDownClauseTreeNode(query).then(res => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.loadMenuData()
this.loadData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
},
handleCopy ({ id }) {
this.$confirm({
title: this.$t('confirmReplication'),
content: '',
onOk: () => {
this.loading = true
copyClause({ id }).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
/**
* 批量复制
*/
handleBatchCopy () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectLeastOne'))
return
}
this.$confirm({
title: this.$t('confirmReplication'),
content: '',
onOk: () => {
batchCopyClause({ ids: this.selectedRowKeys.join(',') }).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.onClearSelected()
this.loadMenuData()
this.loadData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
},
// 新增
handleAdd () {
if (!this.menuId) {
this.$message.warning(this.$t('docTool.split.selectDirectoryTerms'))
return
}
if (this.menuId) {
this.formTitle = this.$t('add')
this.itemId = ''
this.$refs.modalForm.add()
}
},
// 合并条款
handleMerge () {
if (this.selectedRowKeys && this.selectedRowKeys.length < 2) {
this.$message.warning(this.$t('leastTwo'))
return
}
const ids = this.selectedRowKeys.join(',')
this.$confirm({
title: this.$t('docTool.split.mergeTerms'),
content: '',
onOk: () => {
this.loading = true
merageClause({ ids: ids }).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loading = false
this.onClearSelected()
this.loadMenuData()
this.loadData()
this.selectedRowKeys = []
} else {
this.$message.warning(res.message)
this.loading = false
}
})
}
})
},
/**
* 批量编辑
*/
handleBatchEdit () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectLeastOne'))
return
}
this.$refs.batchEditDrawer.open(this.selectedRowKeys.join(','))
},
onSearch () {
this.loadMenuData()
},
/**
* 删除
* @param id
*/
handleDelete (id) {
if (!this.url.delete) {
this.$message.warning('请设置url.delete属性!')
return
}
const that = this
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
postAction(that.url.delete, { id: id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) {
that.ipagination.current -= 1
}
that.loadData()
} else {
that.$message.warning(res.message)
}
})
}
})
},
/**
* 导出
*/
handleExportXls () {
const fileName = this.$route.query.infoNumber + ' ' + this.$route.query.standardName
const fileSuffix = '.zip'
const param = {}
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
param.idList = this.selectedRowKeys.join(',')
}
param.parameter = this.getQueryParams()
param.exportName = fileName + fileSuffix
// 加一个大的提示
const modalLoading = this.$info({
title: this.$t('tips'),
content: <span>{this.$t('exportTip')}
<a-spin size="small" /></span>,
keyboard: false
})
// 把知道了这个按钮去掉
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
})
downFile(this.url.exportXlsUrl, param).then((data) => {
if (!data) {
this.$message.warning(this.$t('fileDownloadFail'))
return
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + fileSuffix)
} else {
const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', fileName + fileSuffix)
document.body.appendChild(link)
link.click()
document.body.removeChild(link) // 下载完成移除元素
window.URL.revokeObjectURL(url) // 释放掉blob对象
}
}).finally(() => {
// 销毁这个提示
modalLoading.destroy()
})
},
handleImport () {
if (!this.menuId) {
this.$message.warning(this.$t('docTool.split.selectDirectoryTerms'))
}
},
// 下载导入模板
downTemplate (fileName, fileSuffix = '.xls') {
if (!fileName || typeof fileName !== 'string') {
fileName = '模板文件'
}
downloadFile(this.url.downTemplateUrl, fileName + fileSuffix, { infoId: this.$route.query.infoId })
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
.page-left-right-layout {
height: 100%;
width: 100%;
display: flex;
}
/deep/ .ant-tree li span.ant-tree-switcher.ant-tree-switcher-noop {
color: #1D2129;
}
.parent-node-icon {
color: #1D2129;
font-size: 16px;
margin-right: 10px;
}
</style>
@@ -0,0 +1,34 @@
<template>
<div class="split-content">
<standard-resolution-sheet ref="resolutionSheet" :horizontal-overstep="true"/>
</div>
</template>
<script>
import '@assets/less/common.less'
import StandardResolutionSheet from '../../../components/StandardResolutionSheet.vue'
export default {
name: 'StandardSplitSheet',
components: { StandardResolutionSheet },
mounted () {
this.$nextTick(() => {
this.$refs.resolutionSheet.queryParams = { id: this.$route.query.id }
this.$refs.resolutionSheet.initClauseFieldList()
this.$refs.resolutionSheet.initDetailInfo()
})
}
}
</script>
<style scoped lang="less">
.split-content {
height: 100vh;
padding: 20px 0 20px 20px;
background-color: #eff1f4;
}
/deep/ .clause-label-change {
border-radius: 0;
}
</style>
@@ -0,0 +1,220 @@
<template>
<j-modal
:title="$t('docTool.split.importResults')"
:width="width"
:visible="visible"
switchFullscreen
:maskClosable="false"
:confirmLoading="confirmLoading"
:ok-text="$t('docTool.split.split')"
:cancel-text="$t('cancel')"
@ok="handleOk"
@cancel="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<!--标准号-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardSelect.standardNumber')">
<standard-selection :placeholder="$t('pleaseSelect') + $t('standardSelect.standardNumber')"
type="radio"
@nameChange="handleStandardNumberChange"
:select-only="true"
:can-selected-source="[StandardSource.DOMESTIC.value, StandardSource.ENTERPRISE.value]"
class="readonly-input"
v-decorator="['serialNumber', validatorRules.serialNumber]" />
</a-form-item>
<!--标准名称-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardSelect.standardName')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardName')"
:maxLength="50"
disabled
v-decorator="['title', validatorRules.title]" />
</a-form-item>
<!--文本状态-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.comparison.textStatus')">
<j-dict-select-tag
class="box-input"
v-decorator="['fileType', validatorRules.fileType]"
:placeholder="$t('pleaseSelect') + $t('docTool.comparison.textStatus')"
:type="'select'"
:triggerChange="false"
:dictCode="'process_manuscript'" />
</a-form-item>
<!--拆分结果文件-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.split.splitResultFile')">
<div class="result-file-box">
<j-upload v-decorator="['splitFileId', validatorRules.splitFileId]"
return-id
:number="1"
class="line-btn"
file-type="zip" />
<a-button class="line-btn" @click="downTemplate($t('docTool.split.documentSplitTemplate'), '.zip')">
{{ $t('templateDownload') }}
</a-button>
</div>
</a-form-item>
</a-form>
<div class="tip">
<a-icon type="exclamation-circle" class="tip-icon" />
<span>{{ $t('docTool.split.splitImportResultTip') }}</span>
<span class="tip-click" @click="showTips">{{ $t('docTool.split.clickToView') }}</span>
</div>
</a-spin>
</j-modal>
</template>
<script>
import StandardSelection from '../../../../components/selection/StandardSelection.vue'
import { importSplitResult } from '@api/documentToolApi'
import { getFileInfo } from '@api/api'
import { downloadFile } from '@api/manage'
import { StandardSource } from '../../../../enums/commonEnums'
export default {
name: 'ImportSplitResultModal',
components: { StandardSelection },
data () {
return {
StandardSource,
width: 600,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
validatorRules: {
// 标准号
serialNumber: {
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('standardSelect.standardNumber') }],
validateTrigger: 'change'
},
// 标准名称
title: {
rules: [{ required: false, message: this.$t('pleaseEnter') + this.$t('standardSelect.standardName') }],
validateTrigger: 'blur'
},
// 文本状态
fileType: {
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('docTool.comparison.textStatus') }],
validateTrigger: 'change'
},
// 拆分结果文件
splitFileId: {
rules: [{ required: true, message: this.$t('uploadFile.pleaseUpload') + this.$t('docTool.split.splitResultFile') }],
validateTrigger: 'change'
}
},
downTemplateUrl: '/laws/DocumentTool/documentSplit/downloadImportTemplate' // 模板下载
}
},
methods: {
open () {
this.visible = true
},
handleOk () {
this.form.validateFields(async (errors, values) => {
if (!errors) {
this.confirmLoading = true
const formData = values
const fileInfo = await getFileInfo({ id: formData.splitFileId })
if (fileInfo.success) {
formData.fileName = fileInfo.result.fileName
}
importSplitResult(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()
},
showTips () {
this.$info({
closeable: true, // 展示右上角关闭
cancelText: this.$t('docTool.split.gotIt'),
title: this.$t('docTool.split.formatRequirement'),
content: (h) => {
const contentArr = [this.$t('docTool.split.formatRequirementContentOne'), this.$t('docTool.split.formatRequirementContentTwo'), this.$t('docTool.split.formatRequirementContentThree'), this.$t('docTool.split.formatRequirementContentFour')]
const contentDomArr = []
for (const content of contentArr) {
console.log(content)
contentDomArr.push(h('div', {}, content))
}
return contentDomArr
}
})
},
handleStandardNumberChange (name) {
this.form.setFieldsValue({ title: name })
},
// 下载导入模板
downTemplate (fileName, fileSuffix = '.xls') {
if (!fileName || typeof fileName !== 'string') {
fileName = '模板文件'
}
downloadFile(this.downTemplateUrl, fileName + fileSuffix)
}
}
}
</script>
<style scoped lang="less">
.line-btn {
display: inline-block;
}
.line-btn:last-child {
margin-left: 12px;
}
.tip {
margin: 0 42px;
&-icon {
color: @primary-color;
margin-right: 8px;
}
&-click {
color: @primary-color;
cursor: pointer;
}
}
.result-file-box {
display: flex;
align-items: baseline;
}
.result-file-box > div {
flex: 1;
width: 0;
}
.readonly-input {
/deep/ .ant-input[disabled] {
background-color: white;
color: rgba(0, 0, 0, 0.65);
}
}
</style>
@@ -0,0 +1,960 @@
<template>
<a-drawer
:title="title"
placement="right"
:visible="visible"
@close="handleCancel"
width="900"
class="custom-drawer-style">
<div class="custom-drawer-style-scroll">
<a-spin :spinning="loading">
<!--表单部分-->
<a-form-model :model="formInline" v-if="isFormInline" class="form-add" :rules="rules" ref="ruleForm">
<div class="form-flex-box">
<template v-for="(item, index) in dataList">
<div :key="index"
class="box-title-text form-flex-item"
v-if="!hiddenFieldList.includes(item.dbFieldName)">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<!--条文解读-->
<template v-if="item.dbFieldName === 'interpretation_articles'">
<div class="unscramble-item"
v-for="(unscramble, unscrambleIndex) in interpretationArticlesList"
:key="unscrambleIndex + 'interpretation_articles'">
<div class="unscramble-item-content">
<!--文本-->
<a-input type="textarea" :maxLength="500" v-model="unscramble.itemContent" />
</div>
<div class="unscramble-item-operate">
<a-button @click="handleAddUnscramble(unscrambleIndex)" icon='plus'></a-button>
<a-button @click="handleDeleteUnscramble(unscrambleIndex, unscramble)" icon='minus'
:disabled="interpretationArticlesList.length === 1 && unscrambleIndex === interpretationArticlesList.length - 1">
</a-button>
</div>
</div>
</template>
<!-- 1, 日期单选 -->
<a-date-picker v-else-if="item.fieldShowType === FieldType.DATE_SINGLE.value"
class="box-input"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
:getCalendarContainer="(trigger) => trigger.parentNode"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
@change="updateDom"
style="width: 100%" />
<!-- 2, 单选用户 -->
<user-selection v-else-if="item.fieldShowType === FieldType.USER_SINGLE.value"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
v-model="formInline[item.dbFieldName]"
:filedName="item.dbFieldName"
@nameChange="userSelectNameChange"
:nameStr="formInline[item.dbFieldName + '_dictText']"
type="radio"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)" />
<!-- 3, 单选组织机构 -->
<j-select-depart v-else-if="item.fieldShowType === FieldType.ORGAN_SINGLE.value"
v-model="formInline[item.dbFieldName]"
:backDepart="true" />
<!-- 4, 日期多选 -->
<j-multiple-date-picker v-else-if="item.fieldShowType === FieldType.DATE_MORE.value"
class="box-input"
v-model="formInline[item.dbFieldName]"
:fieldName="item.dbFieldName"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)" />
<!-- 5, 多行文本 -->
<a-textarea v-else-if="item.fieldShowType === FieldType.TEXTAREA.value"
:placeholder="$t('pleaseEnter')+item.dbFieldTxt + getPlaceholderSuffix(item)"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:maxLength="500"
v-model="formInline[item.dbFieldName]" :rows="4" />
<!-- 6, 标准多选 -->
<standard-selection v-else-if="item.fieldShowType === FieldType.STANDARD_MORE.value"
:source="flag"
:disabledSourceSearch="true"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="formInline[item.dbFieldName]" />
<!-- 7, 多选组织机构 -->
<j-select-depart v-else-if="item.fieldShowType === FieldType.ORGAN_MORE.value"
v-model="formInline[item.dbFieldName]"
:multi="true"
:backDepart="true"
:treeOpera="true" />
<!-- 8, 上传文件 -->
<a-button v-else-if="item.fieldShowType === FieldType.FILE_UP.value" type="primary" class="button-text"
@click="clickButtonToUpload(item)">
{{
(formInline[item.dbFieldName] === 'null' || formInline[item.dbFieldName] === ''
|| formInline[item.dbFieldName] === null || formInline[item.dbFieldName] === undefined)
? $t('uploadFile.clickUpload')
: $t('uploadFile.viewUploadedFiles')
}}
</a-button>
<!-- 9, 文本框 -->
<a-input v-else-if="item.fieldShowType === FieldType.TEXT_BOX.value"
class="box-input"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="formInline[item.dbFieldName]"
:maxLength="50"
:placeholder="(specialPlaceholder[item.dbFieldName] || $t('pleaseEnter')+item.dbFieldTxt) || + getPlaceholderSuffix(item)" />
<!-- 10, 下拉单选数据字典 -->
<j-dict-select-tag v-else-if="item.fieldShowType === FieldType.OPTION_SINGLE.value"
class="box-input"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
:type="radioDictSelect.includes(item.dbFieldName)? 'radio' : 'select'"
:triggerChange="false"
@change="updateDom"
:dictCode="item.dictField" />
<!-- 11, 下拉多选数据字典 -->
<j-multi-select-tag v-else-if="item.fieldShowType === FieldType.OPTION_MORE.value"
class="box-input"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
:type="'select'"
@change="updateDom"
:triggerChange="false"
:dictCode="item.dictField" />
<!-- 12, 树选择 -->
<s-tree-select
v-else-if="item.fieldShowType === FieldType.TREE.value"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:tree-data="optionsData[item.dbFieldName]"
tree-checkable
treeCheckStrictly
:label-in-value="false"
@change="updateDom"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)" />
<!-- 14, 年份选择 -->
<j-date v-else-if="item.fieldShowType === FieldType.YEAR_PICKER.value"
show-type="year"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="formInline[item.dbFieldName]"
:default-value="defaultValue[item.dbFieldName]"
date-format="YYYY"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)" />
<!-- 15, 树选择单选 -->
<s-tree-select v-else-if="item.fieldShowType === FieldType.TREE_SINGLE.value"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:tree-data="optionsData[item.dbFieldName]"
:label-in-value="false"
@change="updateDom"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)" />
<!--16树形弹框选择-->
<tree-selection v-else-if="item.fieldShowType === FieldType.TREE_MODAL_SELECT.value"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
v-model="formInline[item.dbFieldName]"
:filedName="item.dbFieldName"
type="checkbox"
:options-href="item.fieldHref"
:nameStr="formInline[item.dbFieldName + '_dictText']"
:dict-id="item.dictId"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:children-column-name="getTreeSelectionChildrenColumnName(item)"
:is-tag-library-restriction="item.dbFieldName === 'property_tag'"
:search-field-name="item.dbFieldName === 'property_tag' ? 'firstNodeName' : null" />
</a-form-model-item>
</div>
</template>
</div>
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false"></upload-file>
</a-form-model>
<!--条款内容部分-->
<div class="header-text">
{{ $t('docTool.split.clauseContent') }}
<!--新增条款项-->
<a-button type="primary" icon="plus" ghost @click="handleAddClauseContent(-1)">{{ $t('newlyAdded') }}</a-button>
</div>
<template v-if="contentList && contentList.length > 0">
<div class="clause-item" v-for="(clause, index) in contentList" :key="index + 'clause'">
<div class="clause-item-content">
<!--文本-->
<a-input type="textarea"
:maxLength="500"
v-model="clause.itemContent"
v-if="clause.type === TypeOfClauseItem.TEXT.value" />
<!--图片-->
<viewer>
<img v-if="clause.type === TypeOfClauseItem.IMG.value"
:src="clause.thumbUrl?clause.thumbUrl:clause.itemContent"
alt="">
</viewer>
<!--表格-->
<div v-if="clause.type === TypeOfClauseItem.TABLE.value" v-html="clause.itemContent"></div>
</div>
<div class="clause-item-operate">
<a-button @click="handleAddClauseContent(index)">{{ $t('newlyAdded') }}</a-button>
<a-button v-if="clause.type === TypeOfClauseItem.TABLE.value" @click="splitEdit(index,clause)">{{
$t('edit')
}}
</a-button>
<a-button @click="handleDeleteClauseContent(index, clause)">{{ $t('delete') }}</a-button>
</div>
</div>
</template>
</a-spin>
</div>
<div class="custom-drawer-style-bottom-btn">
<a-button @click="handleCancel">{{ $t('cancel') }}</a-button>
<a-button type="primary" class="footer-btn-save" @click="handleSave">{{ $t('preservation') }}</a-button>
</div>
<!-- 类型选择弹框 -->
<split-detail-add-type-check ref="splitDetailAddTypeCheck" @ok="handleAddOk" />
<!-- 编辑表格弹框 -->
<split-detail-add-table ref="splitDetailAddTable" @editOk="editTableOk" />
</a-drawer>
</template>
<script>
import UploadFile from '../../../../components/UploadFile.vue'
import StandardSelection from '../../../../components/selection/StandardSelection.vue'
// 类型选择弹框
import SplitDetailAddTypeCheck from './SplitDetailAddTypeCheck.vue'
import SplitDetailAddTable from './SplitDetailAddTable.vue'
import {
getDocSplitEditForm,
getDocSplitEditFormData,
addClause,
editClause,
getEditClauseContent,
getInterpretationArticlesList
} from '../../../../api/documentToolApi.js'
import UserSelection from '../../../../components/selection/UserSelection.vue'
import JMultipleDatePicker from '../../../../components/JMultipleDatePicker.vue'
import { ClauseUsableRange, FieldType, TypeOfClauseItem, YesOrNoEnum } from '../../../../enums/commonEnums'
import { getAction } from '../../../../api/manage'
import { getFormDictTreeList } from '../../../../api/api'
import STreeSelect from '../../../../components/STreeSelect'
import TreeSelection from '../../../../components/selection/TreeSelection'
export default {
name: 'SplitAddForm',
components: {
TreeSelection,
JMultipleDatePicker, UserSelection,
SplitDetailAddTable,
UploadFile,
StandardSelection,
SplitDetailAddTypeCheck,
STreeSelect
},
data () {
return {
FieldType,
TypeOfClauseItem,
hiddenFieldList: ['item_content'], // 隐藏的字段
radioDictSelect: ['is_long_effect'], // 使用radio样式的数据字典单选
disabledFieldList: [], // 禁用的字段
specialPlaceholder: {}, // 特殊的placeholder
optionsData: {}, // 通过接口获取的下拉数据
title: this.$t('newlyAdded'),
contentList: [], // 条款内容数据
visible: false,
addIndex: 0, // 新增条款的index
disabled: false,
formInline: {},
isFormInline: false,
dataList: [],
ruleList: [],
rules: {},
uploadName: '',
type: 'add',
loading: false,
submitFlag: false,
deleteIds: [],
itemVal: {},
contentTrees: '',
isTableEdit: false,
interpretationArticlesList: [] // 条文解读数据
}
},
props: {
flag: {
type: String,
default: ''
},
infoId: {
type: String,
default: ''
},
menuId: {
type: String,
default: ''
},
itemId: {
type: String,
default: ''
}
},
watch: {
// 是否长期有效,是的话新认证实施日期、已认证实施日期、新注册实施日期为多选,否则为单选
'formInline.is_long_effect': {
handler (value) {
const indexArr = []
// 新认证实施日期
indexArr[0] = this.dataList.findIndex(tt => tt.dbFieldName === 'new_cer_implement_date')
// 已认证实施日期
indexArr[1] = this.dataList.findIndex(tt => tt.dbFieldName === 'cer_implement_date')
// 新注册实施日期
indexArr[2] = this.dataList.findIndex(tt => tt.dbFieldName === 'new_register_implement_date')
if (value === YesOrNoEnum.YES.value) {
indexArr.forEach(index => {
this.$set(this.dataList[index], 'fieldShowType', FieldType.DATE_MORE.value)
})
} else if (value === YesOrNoEnum.NO.value) {
indexArr.forEach(index => {
this.$set(this.dataList[index], 'fieldShowType', FieldType.DATE_SINGLE.value)
})
}
this.$forceUpdate()
}
}
},
methods: {
/**
* 新增
*/
add () {
this.visible = true
this.formInline = {}
this.contentList = []
this.type = 'add'
this.getForm()
},
/**
* 编辑
* @param item
*/
edit (item) {
this.visible = true
this.type = 'edit'
this.itemVal = item
this.formInline = {}
this.getForm(() => {
this.loadFormInfo()
this.getClauseContentList()
this.initInterpretationArticlesList()
})
},
/**
* 获取表单字段
* @param callBack
*/
getForm (callBack) {
this.loading = true
const params = {
flag: this.flag,
type: this.type
}
getDocSplitEditForm(params).then((res) => {
if (res.success) {
this.dataList = res.result
this.ruleList = res.result
this.integrateData()
this.getOptionsData()
callBack && callBack()
}
}).finally(() => {
this.loading = false
})
},
/**
* 处理需要通过接口获取的下拉数据
*/
getOptionsData () {
const formList = Object.values(this.dataList).reduce((acc, cur) => acc.concat(cur), [])
formList.forEach(item => {
if (item.fieldShowType === FieldType.TREE.value || item.fieldShowType === FieldType.TREE_SINGLE.value) {
// 展示类型是树选择,且有接口的
if (item.fieldHref) {
getAction(item.fieldHref).then(res => {
if (res.success) {
this.$set(this.optionsData, item.dbFieldName, res.result)
}
})
} else if (item.dictId) {
getFormDictTreeList({ dictId: item.dictId }).then(res => {
if (res.success) {
this.$set(this.optionsData, item.dbFieldName, res.result)
}
})
}
}
})
},
/**
* 设置表单校验信息
*/
integrateData () {
this.isFormInline = false
const ruleList = JSON.parse(JSON.stringify(this.ruleList))
console.log(this.ruleList)
const rules = {}
ruleList.forEach((res, index) => {
const rule = []
if (res.fieldMustInput === '1') {
if ([FieldType.TEXT_BOX.value, FieldType.TEXTAREA.value].includes(res.fieldShowType)) {
rule.push({
required: true,
message: res.dbFieldTxt + this.$t('cannotEmpty'),
trigger: 'blur'
})
} else {
rule.push({
required: true,
message: res.dbFieldTxt + this.$t('cannotEmpty'),
trigger: 'change'
})
}
} else {
if ([FieldType.TEXT_BOX.value, FieldType.TEXTAREA.value].includes(res.fieldShowType)) {
rule.push({
required: false,
message: res.dbFieldTxt + this.$t('cannotEmpty'),
trigger: 'blur'
})
} else {
rule.push({
required: false,
message: res.dbFieldTxt + this.$t('cannotEmpty'),
trigger: 'change'
})
}
}
if (rule.length > 0) {
rules[res.dbFieldName] = rule
}
})
this.rules = rules
this.isFormInline = true
this.loading = false
},
/**
* 获取表单信息
*/
loadFormInfo () {
getDocSplitEditFormData({ id: this.itemVal.id }).then(res => {
if (res.success) {
// 处理树结构多选回显
const formList = Object.values(this.dataList).reduce((acc, cur) => acc.concat(cur), [])
const treeMultipleField = formList.filter(tt => tt.fieldShowType === FieldType.TREE.value)
const data = res.result || {}
treeMultipleField.forEach(field => {
const valueArr = []
if (data[field.dbFieldName]) {
const values = data[field.dbFieldName].split(',')
for (let i = 0; i < values.length; i++) {
valueArr[i] = {
value: values[i]
}
}
data[field.dbFieldName] = valueArr
} else {
data[field.dbFieldName] = undefined
}
})
const dictField = formList.filter(tt => tt.fieldShowType === FieldType.OPTION_SINGLE.value)
dictField.forEach(field => {
data[field.dbFieldName] = data[field.dbFieldName] || null
})
// 是否长期有效默认选否
if (!data.is_long_effect) {
data.is_long_effect = YesOrNoEnum.NO.value
}
// 处理条文解读
if (!data.interpretation_articles) {
data.interpretation_articles = ''
}
this.formInline = Object.assign({}, { ...data })
}
})
},
/**
* 获取条款内容列表
*/
getClauseContentList () {
this.loading = true
getEditClauseContent({ id: this.itemVal.id }).then(res => {
if (res.success) {
this.contentList = [...res.result]
this.contentList.forEach(item => {
const imgData = item.itemContent.split('fileName=')[1]
item.thumbUrl = window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + imgData
})
}
}).finally(() => {
this.loading = false
})
},
/**
* 新增条款内容
* @param index
*/
handleAddClauseContent (index) {
if (index === -1) {
this.addIndex = this.contentList.length - 1
} else {
this.addIndex = index
}
this.$refs.splitDetailAddTypeCheck.open()
},
// 增加条款内容成功
handleAddOk (type, content) {
const headerArr = this.contentList.splice(0, this.addIndex + 1)
const footerArr = this.contentList.splice(-this.addIndex)
const insertArr = []
switch (type) {
case TypeOfClauseItem.TEXT.value:
for (let i = 0; i < content; i++) {
insertArr.push({
id: '',
type: TypeOfClauseItem.TEXT.value,
itemContent: ''
})
}
break
case TypeOfClauseItem.IMG.value:
insertArr[0] = {
id: '',
type: TypeOfClauseItem.IMG.value,
itemContent: content.file.response.result.url,
thumbUrl: window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + content.file.response.result.url.split('fileName=')[1]
}
break
case TypeOfClauseItem.TABLE.value:
insertArr[0] = {
id: '',
type: 'TABLE',
itemContent: content[0]
}
}
this.contentList = [...headerArr, ...insertArr, ...footerArr]
},
/**
* 表格编辑
* @param index
* @param item
*/
splitEdit (index, item) {
this.addIndex = index
this.$refs.splitDetailAddTable.open(item.itemContent)
this.$refs.splitDetailAddTable.isTableEdit = true
},
/**
* 编辑表格类型成功
* @param ueContent
*/
editTableOk (ueContent) {
this.contentList[this.addIndex] = {
id: '',
type: 'TABLE',
itemContent: ueContent[0]
}
this.contentList = JSON.parse(JSON.stringify(this.contentList))
},
// 点击点击上传按钮
clickButtonToUpload (item) {
this.$refs.uploadFile.open(this.formInline[item.dbFieldName])
this.uploadName = item.dbFieldName
},
// 文件上传改变后的回调
uploadFileChange (data) {
const attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
},
// 正则替换小数点
limitNumber (value) {
if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0
} else if (typeof value === 'number') {
return !isNaN(value) ? String(value).replace(/\./g, '') : 0
} else {
return 0
}
},
/**
* 删除条款内容
* @param index
* @param clause
*/
handleDeleteClauseContent (index, clause) {
this.contentList.splice(index, 1)
if (clause.id) {
this.deleteIds.push(clause.id)
}
},
handleCancel () {
this.close()
},
close () {
this.visible = false
this.formInline = {}
this.contentList = []
this.interpretationArticlesList = []
},
handleSave () {
if (this.submitFlag) {
return
}
this.$refs.ruleForm.validate(valid => {
console.log(valid)
if (valid) {
this.submitFlag = true
this.loading = true
// 判断新增编辑
let submitFunc
if (this.formInline.id) {
submitFunc = editClause
} else {
submitFunc = addClause
}
// 处理请求参数
const formData = JSON.parse(JSON.stringify(this.formInline))
// 处理动态表单多选的值
Object.keys(formData).forEach(res => {
if (formData[res] instanceof Array) {
if (formData[res][0] instanceof Object) {
// 说明是树选择
formData[res] = formData[res].map(item => item.value).join(',')
} else {
formData[res] = formData[res].join(',')
}
}
})
formData.info_id = this.infoId
formData.menu_id = this.menuId
const contentList = JSON.parse(JSON.stringify(this.contentList))
contentList.forEach((item, index) => {
if (item.type === 'IMG') {
delete item.thumbUrl
}
})
formData.itemValEOList = contentList
formData.interpretationArticlesList = this.interpretationArticlesList.filter(tt => !!tt.itemContent)
formData.delItemIds = this.deleteIds.join(',')
submitFunc(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
this.submitFlag = false
})
}
})
},
/**
* 新增一条条文解读
* @param index
*/
handleAddUnscramble (index) {
this.interpretationArticlesList.splice(index + 1, 0, { id: '', itemContent: null, displaySeq: 1 })
},
/**
* 删除条文解读
*/
handleDeleteUnscramble (index, item) {
this.interpretationArticlesList.splice(index, 1)
if (item.id) {
this.deleteIds.push(item.id)
}
},
/**
* 获取条文解读数据
*/
initInterpretationArticlesList () {
getInterpretationArticlesList({ id: this.itemVal.id }).then(res => {
if (res.success) {
if (res.result && res.result.length > 0) {
this.interpretationArticlesList = res.result
} else {
this.interpretationArticlesList = [{
itemContent: null,
displaySeq: 1
}]
}
}
})
},
updateDom () {
this.$forceUpdate()
},
filterTreeOption (input, option) {
const text = option.componentOptions.propsData.title || option.componentOptions.propsData.label
return text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
/**
* 属性标识的子集字段处理
* @param field
* @returns {null|string}
*/
getTreeSelectionChildrenColumnName (field) {
if (field.dbFieldName === 'property_tag') {
return 'childrenList'
}
return null
},
/**
* 如果字段中的usableRange只有一个值,那么就需要在placeholder中标识
* @param field
*/
getPlaceholderSuffix (field) {
let fieldUsableRange = []
if (field.usableRange) {
fieldUsableRange = field.usableRange.split(',')
}
if (fieldUsableRange.length === 1) {
return `${ClauseUsableRange.nameOfIndex(fieldUsableRange[0])}`
}
return ''
}
}
}
</script>
<style scoped lang="less">
.split-content {
.box-title-text {
line-height: 1.4;
display: flex;
.title-text {
width: 114px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 42px;
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
}
.item-model {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
}
.con-divider {
font-size: 16px;
font-weight: 500;
color: rgba(0, 0, 0, 0.85)
}
.table-operator {
margin-bottom: 20px;
text-align: right;
}
}
.split-content-row {
.split-row {
display: flex;
justify-content: space-between;
margin: 0 20px 20px;
.row-left {
flex: 1;
/*border:1px solid #9e9e9e;*/
img {
cursor: pointer;
width: 32px;
height: 32px;
}
.item-table {
/deep/ table {
width: 100% !important;
}
}
}
.row-right {
min-width: 150px;
margin-left: 20px;
.row-btn-add, .row-btn-edit {
margin-right: 20px;
}
}
}
}
.split-form-footer {
margin-top: 20px;
text-align: center;
position: fixed;
bottom: 0px;
right: 0;
width: 900px;
padding-bottom: 10px;
background: #FFFFFF;
.footer-btn-save {
margin-right: 20px;
}
}
.split-title {
.title-wraper {
.title-top {
display: flex;
justify-content: space-around;
.title-flex {
width: 75px;
height: 35px;
text-align: center;
border-radius: 5px;
border: 1px solid #d9d9d9;
padding: 7px;
cursor: pointer;
}
.title-flex-active {
background: #00B3BE;
border-color: #00B3BE;
color: #FFFFFF;
}
}
.title-num {
margin: 20px 20px 0;
line-height: 32px;
.title-num-add {
min-width: 70px;
}
.title-num-edit {
flex: 1;
}
}
}
}
.split-img {
margin-top: 20px;
text-align: center;
img {
}
}
/*用到的css代码*/
.form-flex-box {
display: flex;
flex-wrap: wrap;
}
.form-flex-item {
width: 100%;
}
.header-text {
display: flex;
justify-content: space-between;
align-items: center;
}
.clause-item {
display: flex;
justify-content: space-between;
margin: 0 0 20px 20px;
&-content {
width: 0;
flex: 1;
/deep/ table {
width: 100%;
border: 1px solid;
td {
border: 1px solid;
}
}
/deep/ img {
max-width: 100%;
max-height: 500px;
}
}
&-operate {
.ant-btn {
margin-left: 15px
}
}
}
.clause-item:last-child {
margin-bottom: 0;
}
/deep/ .ant-select-tree-dropdown {
max-height: 50vh !important;
}
.unscramble-item {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
&-content {
width: 0;
flex: 1;
}
&-operate {
.ant-btn {
margin-left: 15px
}
}
}
.unscramble-item:last-child {
margin-bottom: 0;
}
</style>
@@ -0,0 +1,53 @@
<template>
<j-modal
:title="title"
:visible="contentVisible"
:width="1000"
:confirm-loading="confirmLoading"
:footer="false"
switchFullscreen
@cancel="handleCancel"
>
<div class="clause-content" v-html="contentValue"></div>
</j-modal>
</template>
<script>
export default {
name: 'SplitClauseDetail',
data () {
return {
title: this.$t('docTool.split.clauseContent'),
contentVisible: false,
confirmLoading: false,
contentValue: ''
}
},
methods: {
open (val) {
this.contentVisible = true
this.contentValue = val
},
handleCancel () {
this.contentVisible = false
}
}
}
</script>
<style scoped lang="less">
.clause-content {
max-height: calc(100vh - 200px - 55px);
overflow: auto;
margin: 0 -24px;
padding: 0 24px;
/deep/ table {
width: 100%;
border: 1px solid;
td {
border: 1px solid;
}
}
}
</style>
@@ -0,0 +1,174 @@
<template>
<j-modal
:title="title"
class="split-table-title"
:visible="tableVisible"
switchFullscreen
:confirm-loading="confirmLoading"
@ok="handleOkTable"
@cancel="handleCancelTable"
:width="700"
>
<u-editor :content="ueContent" :config="config" ref="ueditor" @editor-onChange="uEditorChange"></u-editor>
</j-modal>
</template>
<script>
import UEditor from '../../../../components/uEditor/UEditor.vue'
export default {
name: 'SplitDetailAddTable',
components: { UEditor },
data () {
return {
title: this.$t('docTool.split.table'),
tableVisible: false,
confirmLoading: false,
ueContent: '',
// UE编辑器配置
config: {
// 可以在此处定义工具栏的内容
toolbars: [
[
'undo', // 撤销
'redo', // 重做
'bold', // 加粗
'italic', // 斜体
'underline', // 下划线
'strikethrough', // 删除线
'subscript', // 下标
'superscript', // 上标
'fontborder', // 字符边框
'fontfamily', // 字体
'fontsize', // 字号
'forecolor', // 字体颜色
// 'backcolor', // 背景色
'paragraph', // 段落格式
'customstyle', // 自定义标题
'indent', // 首行缩进
'justifyleft', // 居左对齐
'fullscreen', // 全屏
'justifyright', // 居右对齐
'justifycenter', // 居中对齐
'justifyjustify', // 两端对齐
'lineheight', // 行间距,
'rowspacingtop', // 段前距
'rowspacingbottom', // 段后距
'directionalityltr', // 从左向右输入
'directionalityrtl', // 从右向左输入
'cleardoc', // 清空文档
'formatmatch', // 格式刷
'removeformat', // 清除格式
'source', // 源代码
'blockquote', // 引用
'pasteplain', // 纯文本粘贴模式
'selectall', // 全选
'horizontal', // 分隔线
'time', // 时间
'date', // 日期
'link', // 超链接
'unlink', // 取消链接
// 'background', // 背景
// 'simpleupload', // 单图上传
'imagenone', // 默认
'imageleft', // 左浮动
'imageright', // 右浮动
'imagecenter', // 居中
'touppercase', // 字母大写
'tolowercase', // 字母小写
'emotion', // 表情
'spechars', // 特殊字符
'searchreplace', // 查询替换
'insertunorderedlist', // 无序列表
'insertorderedlist', // 有序列表
'pagebreak', // 分页
'insertframe', // 插入Iframe
'charts', // 图表
'edittip ', // 编辑提示
'autotypeset', // 自动排版
'drafts', // 从草稿箱加载
'inserttable', // 插入表格
'deletetable', // 删除表格,
'insertparagraphbeforetable', // ”表格前插入行”
'insertrow', // 前插入行
'insertcol', // 前插入列
'mergeright', // 右合并单元格
'mergedown', // 下合并单元格
'deleterow', // 删除行
'deletecol', // 删除列
'splittorows', // 拆分成行
'splittocols', // 拆分成列
'splittocells', // 完全拆分单元格
'inserttitle', // 插入标题
'deletecaption', // 删除表格标题,
'mergecells', // 合并多个单元格
'edittable', // 表格属性
'edittd' // 单元格属性
]
],
autoHeightEnabled: false,
autoFloatEnabled: false,
initialContent: '', // 初始化编辑器的内容,也可以通过textarea/script给值,看官网例子
autoClearinitialContent: true, // 是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
initialFrameWidth: 650,
elementPathEnabled: false,
initialFrameHeight: 300,
maximumWords: 4000,
BaseUrl: '',
UEDITOR_HOME_URL: '/ueditor/',
editTableIndex: 1
},
isTableEdit: false
}
},
methods: {
open (tableStr) {
console.log('$$$$$$$$$$$$', tableStr)
this.tableVisible = true
this.ueContent = tableStr
this.$nextTick(() => {
this.$refs.ueditor.setContent(this.ueContent)
})
},
// 表格确认按钮
handleOkTable () {
let ueContent = []
ueContent = this.ueContent.match(/<table.{0,}?.+?>{0,}?<\/table>/g) || []
if (ueContent && ueContent.length > 1) {
this.$message.warning(this.$t('oneTableAdded'))
} else if (!ueContent || ueContent.length < 1) {
this.$message.warning(this.$t('addATable'))
} if (ueContent && ueContent.length === 1) {
console.log(ueContent)
console.log(this.isTableEdit)
if (this.isTableEdit) {
this.$emit('editOk', ueContent)
} else {
this.$emit('addOk', ueContent)
}
this.close()
}
},
// 表格取消按钮
handleCancelTable () {
this.close()
},
close () {
this.tableVisible = false
this.isTableEdit = false
this.ueContent = ''
this.$nextTick(() => {
this.$refs.ueditor.execCommand()
})
},
// 获取表格内容
uEditorChange (val) {
console.log('--------------uEditorChange------------', val)
this.ueContent = val
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,296 @@
<template>
<j-modal
:title="$t('add')"
class="split-title"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel">
<div class="title-wraper">
<div class="title-top">
<span class="title-flex title-text-flex"
:class="{'title-flex-active':selected===TypeOfClauseItem.TEXT.value}"
@click="selectTitle(TypeOfClauseItem.TEXT.value)">{{ $t('docTool.split.text') }}</span>
<span class="title-flex title-pic"
:class="{'title-flex-active':selected===TypeOfClauseItem.IMG.value}"
@click="selectTitle(TypeOfClauseItem.IMG.value)">{{ $t('docTool.split.picture') }}</span>
<span class="title-flex title-table"
:class="{'title-flex-active':selected===TypeOfClauseItem.TABLE.value}"
@click="selectTitle(TypeOfClauseItem.TABLE.value)">{{ $t('docTool.split.table') }}</span>
</div>
<!-- 选择文本类型时需要填写个数 -->
<div class="title-num" v-if="selected===TypeOfClauseItem.TEXT.value">
<a-form>
<a-form-model
class="number-content"
:model="numberForm"
:rules="validatorRules"
ref="numberForm"
>
<a-form-model-item :label="$t('docTool.split.addQuantity')" prop="textNumber">
<a-input-number
style="width: 100%"
:min="0"
:max="100"
v-model="numberForm.textNumber"
:placeholder="$t('docTool.split.enterQuantity')"
:formatter="limitNumber"
:parser="limitNumber"/>
</a-form-model-item>
</a-form-model>
</a-form>
</div>
<!-- 选择表格时需要填写行列数 -->
<div class="title-num" v-if="selected===TypeOfClauseItem.TABLE.value">
<a-form>
<a-form-model
class="number-content"
:model="rowColForm"
:rules="validatorRowColRules"
ref="numberRowColForm"
>
<a-form-model-item :label="$t('docTool.split.numberRows')" prop="rowCount">
<a-input-number
style="width: 100%"
v-model="rowColForm.rowCount"
:min="1"
:max="100"
:placeholder="$t('pleaseEnter')+$t('docTool.split.numberRows')"
:formatter="limitNumber"
:parser="limitNumber"
/>
</a-form-model-item>
<a-form-model-item :label="$t('docTool.split.numberColumns')" prop="colCount">
<a-input-number
style="width: 100%"
v-model="rowColForm.colCount"
:min="1"
:max="100"
:placeholder="$t('pleaseEnter')+$t('docTool.split.numberColumns')"
:formatter="limitNumber"
:parser="limitNumber"
/>
</a-form-model-item>
</a-form-model>
</a-form>
</div>
</div>
<!-- 上传图片弹框 -->
<split-add-clause-upload-image
ref="uploadFile"
:disabled="disabled"
:title="titleImg"
:listType="listType"
:accept="accept"
@uploadSuccess="uploadSuccess">
</split-add-clause-upload-image>
<!-- 表格弹框 -->
<split-detail-add-table ref="splitDetailAddTable" @addOk="tableAddOk"></split-detail-add-table>
</j-modal>
</template>
<script>
// 上传图片弹框
import SplitAddClauseUploadImage from '../../../../components/splitUpload/SplitAddClauseUploadImage.vue'
// 编辑表格的弹框
import SplitDetailAddTable from './SplitDetailAddTable.vue'
import { TypeOfClauseItem } from '../../../../enums/commonEnums'
export default {
name: 'SplitDetailAddTypeCheck',
components: { SplitAddClauseUploadImage, SplitDetailAddTable },
watch: {
selected (val) {
if (this.selected === TypeOfClauseItem.TEXT.value) {
this.selectedNum = true
} else {
this.selectedNum = false
}
}
},
data () {
return {
TypeOfClauseItem,
visible: false,
confirmLoading: false,
selected: TypeOfClauseItem.TEXT.value,
selectedNum: true,
numberForm: {},
validatorRules: {
textNumber: [
{ required: true, message: this.$t('docTool.split.enterQuantity'), trigger: 'blur' }
]
},
// 文件上传弹框相关
splitVisible: false,
disabled: false,
titleImg: this.$t('uploadPictures'),
listType: 'picture',
accept: '.png,.jpeg,.jpg,.gif',
// 表格行列相关数据
rowColForm: {},
validatorRowColRules: {
colCount: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('docTool.split.numberRows'), trigger: 'blur' }
],
rowCount: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('docTool.split.numberColumns'), trigger: 'blur' }
]
}
}
},
methods: {
open () {
this.visible = true
},
selectTitle (val) {
this.selected = val
if (val === TypeOfClauseItem.TEXT.value) {
this.$nextTick(() => {
this.$refs.numberForm && this.$refs.numberForm.clearValidate()
})
} else if (TypeOfClauseItem.TABLE.value) {
this.$nextTick(() => {
this.$refs.numberRowColForm && this.$refs.numberRowColForm.clearValidate()
})
}
},
// 上传文件
uploadSuccess (file, data, imgs) {
this.$emit('ok', TypeOfClauseItem.IMG.value, { file, data, imgs })
this.visible = false
// this.$emit('addImageOk', file, data, imgs)
},
// 确定增加的类型
handleOk () {
if (this.confirmLoading) {
return
}
if (this.selected === TypeOfClauseItem.TEXT.value) { // 文本类型
this.$refs.numberForm.validate(valid => {
if (valid) {
this.confirmLoading = true
this.$emit('ok', TypeOfClauseItem.TEXT.value, this.numberForm.textNumber)
this.visible = false
this.confirmLoading = false
this.numberForm.textNumber = null
}
})
return
}
if (this.selected === TypeOfClauseItem.IMG.value) { // 图片类型
this.$refs.uploadFile.open()
// this.visible = false
return
}
if (this.selected === TypeOfClauseItem.TABLE.value) { // 表格类型
this.$refs.numberRowColForm.validate(valid => {
if (valid) {
if (this.rowColForm.rowCount > 0 && this.rowColForm.colCount > 0) {
const tableList = []
let tableStr = ''
tableStr = '<table class="word-table" border="1" cellpadding="0" cellspacing="0">'
for (let r = 0; r < this.rowColForm.rowCount; r++) {
const rowTableList = []
tableStr += '<tr>'
for (let c = 0; c < this.rowColForm.colCount; c++) {
tableStr += `<td></td>`
const tableItem = {}
tableItem.id = ''
tableItem.rowNum = r + 1
tableItem.colNum = c + 1
tableItem.content = ''
rowTableList.push(tableItem)
}
tableStr += `</tr>`
tableList.push(rowTableList)
}
tableStr += `</table>`
this.$nextTick(() => {
this.$refs.splitDetailAddTable.isTableEdit = false
this.$refs.splitDetailAddTable.open(tableStr)
})
// this.visible = false
this.rowColForm = {}
}
}
})
}
},
handleCancel () {
this.visible = false
},
// 添加表格的回调
tableAddOk (ueContent) {
this.$emit('ok', TypeOfClauseItem.TABLE.value, ueContent)
this.visible = false
},
// 正则替换小数点
limitNumber (value) {
if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0
} else if (typeof value === 'number') {
return !isNaN(value) ? String(value).replace(/\./g, '') : 0
} else {
return 0
}
}
}
}
</script>
<style scoped lang="less">
.split-title {
.title-wraper {
.title-top {
display: flex;
justify-content: space-around;
.title-flex {
width: 75px;
height: 35px;
text-align: center;
border-radius: 5px;
border: 1px solid #d9d9d9;
padding: 7px;
cursor: pointer;
}
.title-flex-active {
background: @primary-color;
border-color: @primary-color;
color: #FFFFFF;
}
}
.title-num {
margin: 20px 20px 0;
line-height: 32px;
.title-num-add {
min-width: 70px;
}
.title-num-edit {
flex: 1;
}
}
}
}
.number-content {
.ant-form-item {
display: flex;
.ant-form-item-control-wrapper {
flex: 1;
.title-num-edit {
width: 100%;
}
}
}
}
</style>
@@ -0,0 +1,511 @@
<template>
<a-drawer
:title="title"
placement="right"
:visible="visible"
@close="handleCancel"
width="900"
class="custom-drawer-style">
<div class="custom-drawer-style-scroll">
<a-spin :spinning="confirmLoading">
<a-form-model :model="formInline" v-if="isFormInline" class="form-add" :rules="rules" ref="ruleForm">
<div class="form-flex-box">
<template v-for="(item, index) in dataList">
<div :key="index"
class="box-title-text form-flex-item"
:class="{'form-flex-item-line': item.fieldShowType === FieldType.STANDARD_MORE.value}"
v-if="!hiddenFieldList.includes(item.dbFieldName)">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<!--条文解读-->
<!--<template v-if="item.dbFieldName === 'interpretation_articles'">-->
<!-- <div class="unscramble-item"-->
<!-- v-for="(unscramble, unscrambleIndex) in interpretationArticlesList"-->
<!-- :key="unscrambleIndex + 'interpretation_articles'">-->
<!-- <div class="unscramble-item-content">-->
<!-- &lt;!&ndash;文本&ndash;&gt;-->
<!-- <a-input type="textarea" :maxLength="500" v-model="unscramble.itemContent"/>-->
<!-- </div>-->
<!-- <div class="unscramble-item-operate">-->
<!-- <a-button @click="handleAddUnscramble(unscrambleIndex)">{{ $t('newlyAdded') }}</a-button>-->
<!-- <a-button @click="handleDeleteUnscramble(unscrambleIndex, unscramble)">{{ $t('delete') }}</a-button>-->
<!-- </div>-->
<!-- </div>-->
<!--</template>-->
<!-- 1, 日期单选 -->
<a-date-picker v-if="item.fieldShowType === FieldType.DATE_SINGLE.value"
class="box-input"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
:getCalendarContainer="(trigger) => trigger.parentNode"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
style="width: 100%" />
<!-- 2, 单选用户 -->
<user-selection v-else-if="item.fieldShowType === FieldType.USER_SINGLE.value"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
v-model="formInline[item.dbFieldName]"
:filedName="item.dbFieldName"
@nameChange="userSelectNameChange"
:nameStr="formInline[item.dbFieldName + '_dictText']"
type="radio"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)" />
<!-- 3, 单选组织机构 -->
<j-select-depart v-else-if="item.fieldShowType === FieldType.ORGAN_SINGLE.value"
v-model="formInline[item.dbFieldName]"
:backDepart="true" />
<!-- 4, 日期多选 -->
<j-multiple-date-picker v-else-if="item.fieldShowType === FieldType.DATE_MORE.value"
class="box-input"
v-model="formInline[item.dbFieldName]"
:fieldName="item.dbFieldName"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)" />
<!-- 5, 多行文本 -->
<a-textarea v-else-if="item.fieldShowType === FieldType.TEXTAREA.value"
:placeholder="$t('pleaseEnter')+item.dbFieldTxt + getPlaceholderSuffix(item)"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:maxLength="500"
v-model="formInline[item.dbFieldName]" :rows="4" />
<!-- 6, 标准多选 -->
<standard-selection v-else-if="item.fieldShowType === FieldType.STANDARD_MORE.value"
:source="flag"
:disabledSourceSearch="true"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="formInline[item.dbFieldName]" />
<!-- 7, 多选组织机构 -->
<j-select-depart v-else-if="item.fieldShowType === FieldType.ORGAN_MORE.value"
v-model="formInline[item.dbFieldName]"
:multi="true"
:backDepart="true"
:treeOpera="true" />
<!-- 8, 上传文件 -->
<a-button v-else-if="item.fieldShowType === FieldType.FILE_UP.value" type="primary" class="button-text"
@click="clickButtonToUpload(item)">
{{
(formInline[item.dbFieldName] === 'null' || formInline[item.dbFieldName] === ''
|| formInline[item.dbFieldName] === null || formInline[item.dbFieldName] === undefined)
? $t('uploadFile.clickUpload')
: $t('uploadFile.viewUploadedFiles')
}}
</a-button>
<!-- 9, 文本框 -->
<a-input v-else-if="item.fieldShowType === FieldType.TEXT_BOX.value"
class="box-input"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="formInline[item.dbFieldName]"
:maxLength="50"
:placeholder="(specialPlaceholder[item.dbFieldName] || $t('pleaseEnter')+item.dbFieldTxt) + getPlaceholderSuffix(item)" />
<!-- 10, 下拉单选数据字典 -->
<j-dict-select-tag v-else-if="item.fieldShowType === FieldType.OPTION_SINGLE.value"
class="box-input"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
:type="radioDictSelect.includes(item.dbFieldName)? 'radio' : 'select'"
:triggerChange="false"
:dictCode="item.dictField" />
<!-- 11, 下拉多选数据字典 -->
<j-multi-select-tag v-else-if="item.fieldShowType === FieldType.OPTION_MORE.value"
class="box-input"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
:type="'select'"
:triggerChange="false"
:dictCode="item.dictField" />
<!-- 12, 树选择 -->
<s-tree-select
v-else-if="item.fieldShowType === FieldType.TREE.value"
v-model="formInline[item.dbFieldName]"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:tree-data="optionsData[item.dbFieldName]"
tree-checkable
treeCheckStrictly
:label-in-value="false"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)" />
<!-- 14, 年份选择 -->
<j-date v-else-if="item.fieldShowType === FieldType.YEAR_PICKER.value"
show-type="year"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
v-model="formInline[item.dbFieldName]"
:default-value="defaultValue[item.dbFieldName]"
date-format="YYYY"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)" />
<!-- 15, 树选择单选 -->
<s-tree-select v-else-if="item.fieldShowType === FieldType.TREE_SINGLE.value"
v-model="formInline[item.dbFieldName]"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
style="width: 100%"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:tree-data="optionsData[item.dbFieldName]"
:label-in-value="false"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)" />
<!--16树形弹框选择-->
<tree-selection v-else-if="item.fieldShowType === FieldType.TREE_MODAL_SELECT.value"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt + getPlaceholderSuffix(item)"
v-model="formInline[item.dbFieldName]"
:filedName="item.dbFieldName"
type="checkbox"
:options-href="item.fieldHref"
:nameStr="formInline[item.dbFieldName + '_dictText']"
:dict-id="item.dictId"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:children-column-name="getTreeSelectionChildrenColumnName(item)"
:is-tag-library-restriction="item.dbFieldName === 'property_tag'"
:search-field-name="item.dbFieldName === 'property_tag' ? 'firstNodeName' : null" />
</a-form-model-item>
</div>
</template>
</div>
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false"></upload-file>
</a-form-model>
</a-spin>
</div>
<div class="custom-drawer-style-bottom-btn">
<!--取消-->
<a-button @click="handleCancel">{{ $t('cancel') }}</a-button>
<!--保存-->
<a-button type="primary" class="footer-btn-save" @click="handleSave">{{ $t('preservation') }}</a-button>
</div>
</a-drawer>
</template>
<script>
import JMultipleDatePicker from '../../../../components/JMultipleDatePicker.vue'
import UploadFile from '../../../../components/UploadFile.vue'
import StandardSelection from '../../../../components/selection/StandardSelection.vue'
import UserSelection from '../../../../components/selection/UserSelection.vue'
import { getDocSplitEditForm, editBatchEditClause } from '../../../../api/documentToolApi'
import { ClauseUsableRange, FieldType, YesOrNoEnum } from '../../../../enums/commonEnums'
import { getFormDictTreeList } from '../../../../api/api'
import { getAction } from '../../../../api/manage'
import STreeSelect from '../../../../components/STreeSelect'
import TreeSelection from '../../../../components/selection/TreeSelection'
export default {
name: 'SplitDetailBatchEditDrawer',
components: { TreeSelection, UserSelection, StandardSelection, UploadFile, JMultipleDatePicker, STreeSelect },
data () {
return {
FieldType,
title: this.$t('docTool.split.batchEdit'),
visible: false,
confirmLoading: false,
disabled: false,
formInline: {},
isFormInline: false,
dataList: [],
ruleList: [],
rules: {},
uploadName: '',
type: 'add',
hiddenFieldList: ['item_num', 'item_title', 'item_content', 'interpretation_articles'], // 隐藏的字段
radioDictSelect: ['is_long_effect'], // 使用radio样式的数据字典单选
disabledFieldList: [], // 禁用的字段
specialPlaceholder: {}, // 特殊的placeholder
optionsData: {} // 通过接口获取的下拉数据
// interpretationArticlesList: [] // 条文解读数据
}
},
watch: {
// 是否长期有效,是的话新认证实施日期、已认证实施日期、新注册实施日期为多选,否则为单选
'formInline.is_long_effect': {
handler (value) {
console.log('是否长期有效', value)
const indexArr = []
// 新认证实施日期
indexArr[0] = this.dataList.findIndex(tt => tt.dbFieldName === 'new_cer_implement_date')
// 已认证实施日期
indexArr[1] = this.dataList.findIndex(tt => tt.dbFieldName === 'cer_implement_date')
// 新注册实施日期
indexArr[2] = this.dataList.findIndex(tt => tt.dbFieldName === 'new_register_implement_date')
if (value === YesOrNoEnum.YES.value) {
indexArr.forEach(index => {
this.$set(this.dataList[index], 'fieldShowType', FieldType.DATE_MORE.value)
})
} else if (value === YesOrNoEnum.NO.value) {
indexArr.forEach(index => {
this.$set(this.dataList[index], 'fieldShowType', FieldType.DATE_SINGLE.value)
})
}
this.$forceUpdate()
},
immediate: true
}
},
methods: {
open (ids) {
this.visible = true
this.formInline = {}
this.formInline.ids = ids
this.getForm()
},
/**
* 获取表单字段
* @param callBack
*/
getForm (callBack) {
this.loading = true
const params = {
flag: this.flag,
type: this.type
}
getDocSplitEditForm(params).then((res) => {
if (res.success) {
const indexArr = []
// 新认证实施日期
indexArr[0] = res.result.findIndex(tt => tt.dbFieldName === 'new_cer_implement_date')
// 已认证实施日期
indexArr[1] = res.result.findIndex(tt => tt.dbFieldName === 'cer_implement_date')
// 新注册实施日期
indexArr[2] = res.result.findIndex(tt => tt.dbFieldName === 'new_register_implement_date')
// 条文解读数据处理
// this.interpretationArticlesList = [
// { id: '', itemContent: null }
// ]
// 是否长期有效默认选否
this.$set(this.formInline, 'is_long_effect', YesOrNoEnum.NO.value)
this.dataList = res.result
this.ruleList = res.result
this.integrateData()
this.getOptionsData()
callBack && callBack()
}
}).finally(() => {
this.loading = false
})
},
/**
* 处理需要通过接口获取的下拉数据
*/
getOptionsData () {
const formList = Object.values(this.dataList).reduce((acc, cur) => acc.concat(cur), [])
formList.forEach(item => {
if (item.fieldShowType === FieldType.TREE.value || item.fieldShowType === FieldType.TREE_SINGLE.value) {
// 展示类型是树选择,且有接口的
if (item.fieldHref) {
getAction(item.fieldHref).then(res => {
if (res.success) {
this.$set(this.optionsData, item.dbFieldName, res.result)
}
})
} else if (item.dictId) {
getFormDictTreeList({ dictId: item.dictId }).then(res => {
if (res.success) {
this.$set(this.optionsData, item.dbFieldName, res.result)
}
})
}
}
})
},
/**
* 设置表单校验信息
*/
integrateData () {
this.isFormInline = false
const rules = {}
this.ruleList.forEach((res, index) => {
const rule = []
if (res.field_must_input === 1) {
if (res.field_show_type === '1') {
rule.push({
required: true,
message: res.db_field_txt + this.$t('cannotEmpty'),
trigger: 'blur'
})
} else if (res.field_show_type === '4' || res.field_show_type === '6' ||
res.field_show_type === '5' || res.field_show_type === '7'
) {
rule.push({
required: true,
message: res.db_field_txt + this.$t('cannotEmpty'),
trigger: 'change'
})
} else if (res.field_show_type === '2') {
rule.push({
required: true,
message: res.db_field_txt + this.$t('cannotEmpty'),
trigger: 'blur'
})
} else if (res.field_show_type === '8' || res.field_show_type === '9' || res.field_show_type === '10' || res.field_show_type === '11') {
rule.push({
required: true,
message: res.db_field_txt + this.$t('cannotEmpty'),
trigger: 'blur'
})
} else if (res.field_show_type === '3') {
rule.push({
required: true,
message: res.db_field_txt + this.$t('cannotEmpty'),
trigger: 'change'
})
}
}
if (res.field_show_type === '1' ||
res.field_show_type === '8' || res.field_show_type === '9' || res.field_show_type === '10' ||
res.field_show_type === '11') {
rule.push({
max: res.db_length,
message: res.db_field_txt + this.$t('cantExeed') + res.db_length + this.$t('characters'),
trigger: 'blur'
})
}
if (rule.length > 0) {
rules[res.db_field_name] = rule
}
})
this.$set(this, 'rules', rules)
// console.log('rules',this.rules)
this.isFormInline = true
this.loading = false
// console.log('this.column',this.column)
},
// 点击点击上传按钮
clickButtonToUpload (item) {
this.$refs.uploadFile.open(this.formInline[item.db_field_name])
this.uploadName = item.db_field_name
},
// 文件上传改变后的回调
uploadFileChange (data) {
const attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
},
handleSave () {
if (this.confirmLoading) {
return
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.confirmLoading = true
// 处理请求参数
const formData = JSON.parse(JSON.stringify(this.formInline))
// 处理动态表单多选的值
Object.keys(formData).forEach(res => {
if (formData[res] instanceof Array) {
if (formData[res][0] instanceof Object) {
// 说明是树选择
formData[res] = formData[res].map(item => item.value).join(',')
} else {
formData[res] = formData[res].join(',')
}
}
})
// 处理条文解读数据
// formData.interpretationArticlesList = this.interpretationArticlesList
editBatchEditClause(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.formInline = {}
},
/**
* 新增一条条文解读
* @param index
*/
handleAddUnscramble (index) {
this.interpretationArticlesList.splice(index + 1, 0, { id: '', itemContent: null })
},
/**
* 删除条文解读
*/
handleDeleteUnscramble (index, item) {
this.interpretationArticlesList.splice(index, 1)
if (item.id) {
this.deleteIds.push(item.id)
}
},
filterTreeOption (input, option) {
const text = option.componentOptions.propsData.title || option.componentOptions.propsData.label
return text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
/**
* 属性标识的子集字段处理
* @param field
* @returns {null|string}
*/
getTreeSelectionChildrenColumnName (field) {
if (field.dbFieldName === 'property_tag') {
return 'childrenList'
}
return null
},
/**
* 如果字段中的usableRange只有一个值,那么就需要在placeholder中标识
* @param field
*/
getPlaceholderSuffix (field) {
const fieldUsableRange = (field.usableRange || '').split(',')
if (fieldUsableRange.length === 1) {
return `${ClauseUsableRange.nameOfIndex(fieldUsableRange[0])}`
}
return ''
}
}
}
</script>
<style scoped lang="less">
.form-flex-box {
display: flex;
flex-wrap: wrap;
}
.form-flex-item {
width: 100%;
}
.unscramble-item {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
&-content {
width: 0;
flex: 1;
table {
width: 100%;
}
}
&-operate {
.ant-btn {
margin-left: 15px
}
}
}
.unscramble-item:last-child {
margin-bottom: 0;
}
</style>
@@ -0,0 +1,151 @@
<template>
<j-modal
class="add-menus"
:title="title"
:visible="visible"
:confirm-loading="confirmLoading"
switchFullscreen
@cancel="handleCancel"
@ok="handleOk">
<a-form-model
class="split-click-right-form"
ref="ruleForm"
:model="form"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol">
<!--条款号-->
<a-form-model-item :label="$t('docTool.split.clauseNo')" prop="name">
<a-input class="box-input"
v-model="form.name"
:placeholder="$t('pleaseEnter')+$t('docTool.split.clauseNo')"
:maxLength="50" />
</a-form-model-item>
<!--条款名称-->
<a-form-model-item :label="$t('docTool.split.clauseName')" prop="itemName">
<a-input class="box-input"
v-model="form.itemName"
:placeholder="$t('pleaseEnter')+$t('docTool.split.clauseName')"
:maxLength="50" />
</a-form-model-item>
<!--序号-->
<a-form-model-item :label="$t('serialNumber')" prop="displaySeq">
<a-input-number v-model="form.displaySeq" :min="1" :max="99999"
class="box-input"
:placeholder="$t('pleaseEnter')+$t('serialNumber')"
:formatter="limitNumber"
:parser="limitNumber" style="width: 100%" />
</a-form-model-item>
</a-form-model>
</j-modal>
</template>
<script>
import { addClauseTreeNode, editClauseTreeNode } from '../../../../api/documentToolApi'
export default {
name: 'SplitDetailNodeAdd',
data () {
return {
title: this.$t('add'),
visible: false,
confirmLoading: false,
labelCol: { span: 6 },
wrapperCol: { span: 16 },
form: {},
rules: {
name: [
// { required: true, message: this.$t('PleaseEnter') + this.$t('clauseNo'), trigger: 'blur' },
],
itemName: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('docTool.split.clauseName'), trigger: 'blur' }
],
displaySeq: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('serialNumber'), trigger: 'blur' }
// { min: 1, max: 99999, message: this.$t('cantExeed') + '99999' + this.$t('characters'), trigger: 'blur' },
]
},
nodeItem: {},
infoId: ''
}
},
methods: {
add (nodeItem, infoId) {
this.title = this.$t('add')
this.form = {}
this.visible = true
this.nodeItem = nodeItem
this.infoId = infoId
},
edit (nodeItem, infoId) {
this.title = this.$t('edit')
this.nodeItem = nodeItem
this.form = Object.assign({}, nodeItem)
this.infoId = infoId
this.visible = true
},
handleCancel () {
this.visible = false
},
// 增加节点确定
handleOk () {
if (this.confirmLoading) {
return
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
const expandId = []
expandId.push(this.form.pid)
let submitFunc
const params = Object.assign({
infoId: this.infoId,
pid: this.nodeItem.id
}, this.form)
if (this.form.id) {
submitFunc = editClauseTreeNode
} else {
submitFunc = addClauseTreeNode
}
this.confirmLoading = true
submitFunc(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.form = {}
this.visible = false
if (this.form.id) {
this.$emit('ok', expandId)
} else {
this.$emit('ok')
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
// 正则替换小数点
limitNumber (value) {
if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0
} else if (typeof value === 'number') {
return !isNaN(value) ? String(value).replace(/\./g, '') : 0
} else {
return 0
}
}
}
}
</script>
<style scoped lang="less">
.add-menus {
.ant-modal-wrap {
.ant-modal-footer {
text-align: center;
}
}
}
</style>
@@ -0,0 +1,200 @@
<template>
<a-drawer
:title="$t('docTool.split.splitText')"
placement="right"
:visible="visible"
@close="onClose"
width="1100"
class="custom-drawer-style">
<div class="custom-drawer-style-scroll">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row :gutter="24">
<!--来源-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('standardSelect.source')">
<j-dict-select-tag
class="box-input"
v-model="queryParam.origin"
:placeholder="$t('pleaseSelect') + $t('standardSelect.source')"
:type="'select'"
:triggerChange="false"
:dictCode="'split_standard_source'" />
</a-form-item>
</a-col>
<!--标准号-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('standardSelect.standardNumber')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardNumber')"
v-model="queryParam.standardNumber"></a-input>
</a-form-item>
</a-col>
<!--标准名称-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('standardSelect.standardName')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardName')"
v-model="queryParam.standardName"></a-input>
</a-form-item>
</a-col>
<!--文本状态-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('docTool.comparison.textStatus')">
<j-dict-select-tag
class="box-input"
v-model="queryParam.standardFileType"
:placeholder="$t('pleaseSelect') + $t('docTool.comparison.textStatus')"
:type="'select'"
:triggerChange="false"
:dictCode="'process_manuscript'" />
</a-form-item>
</a-col>
</a-row>
</a-form>
<div class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">
{{ $t('query') }}
</a-button>
<a-button type="primary" @click="searchReset" icon="reload" ghost style="margin-left: 8px">{{ $t('reset') }}</a-button>
</div>
</div>
<j-table
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:loading="loading"
:scroll="{x: '100%'}"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'checkbox' }"
:pagination="ipagination"
@change="handleTableChange">
</j-table>
</div>
<div class="custom-drawer-style-bottom-btn">
<a-button @click="cancelSplit" style='margin-right: 15px'>{{ $t('cancel') }}</a-button>
<a-button type="primary" :loading="loading" @click="submitSplit">{{ $t('docTool.split.split') }}</a-button>
</div>
</a-drawer>
</template>
<script>
import JTable from '../../../../components/jero/JTable.vue'
import { JeroListMixin } from '../../../../mixins/JeroListMixin.js'
import { addDocSplit } from '../../../../api/documentToolApi.js'
export default {
name: 'SplitText',
components: { JTable },
mixins: [JeroListMixin],
data () {
return {
visible: false,
loading: false,
labelCol: {
span: 6
},
wrapperCol: {
span: 14
},
columns: [
// 资料类型
{
dataIndex: 'origin_dictText',
title: this.$t('docTool.split.dataType'),
width: 150
},
// 标准号
{
dataIndex: 'standardNumber',
title: this.$t('standardSelect.standardNumber'),
width: 150
},
// 标准名称
{
dataIndex: 'standardName',
title: this.$t('standardSelect.standardName'),
width: 150
},
// 文件状态
{
dataIndex: 'standardFileType_dictText',
title: this.$t('docTool.comparison.textStatus'),
width: 150
},
// 附件
{
dataIndex: 'fileName',
title: this.$t('businessSupport.questionAnswer.attach'),
width: 150
}
],
url: {
list: '/laws/DocumentTool/documentSplit/querySplitFileInfoByPage' // 表格数据
},
type: 'pdfdoc',
operationList: [],
showAction: false,
flag: 'header',
disableMixinCreated: true
}
},
methods: {
open () {
this.visible = true
this.queryParam = {}
this.loadData(1)
},
// 抽屉关闭
onClose () {
this.visible = false
this.onClearSelected()
},
// 取消
cancelSplit () {
this.onClose()
},
// 拆分
submitSplit () {
if (this.loading) {
return
}
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectOne'))
return
}
// 最多同时拆分十条
if (this.selectedRowKeys.length > 10) {
this.$message.warning(this.$t('docTool.split.maximumSelection') + '10' + this.$t('docTool.split.pieceOfData'))
return
}
this.loading = true
addDocSplit({ ids: this.selectedRowKeys.join(',') }).then(res => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.onClose()
} else {
this.messageLineFeedByBr(this.$t('operationFailed'), res.message)
}
this.$emit('ok')
}).finally(() => {
this.loading = false
})
}
}
}
</script>
<style scoped lang="less">
@import '~../../../../assets/less/common.less';
.table-page-search-wrapper {
display: flex;
.ant-form {
flex: 1;
}
}
.table-page-search-submitButtons {
margin-left: 10px;
}
</style>
@@ -0,0 +1,220 @@
<template>
<a-card :bordered="false">
<div class="table-operator">
<!-- 上传 -->
<a-button icon="plus" type="primary" @click="handleAdd" v-has="'docTool:ocrTextRecognition:add'">{{$t('docTool.ocrTextRecognition.upload') }}</a-button>
<!-- 批量删除 -->
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'docTool:ocrTextRecognition:batchDel'">{{$t('batchDelete')}}</a-button>
</div>
<div>
<j-table
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="ipagination"
:scroll="{x: '100%', y: yScrollHeight}"
:loading="loading"
:operation-list="operationList"
@change="handleTableChange"
@operationClick="operationClick">
<!--跳转标准详情-->
<template v-slot:tag="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text" v-if="text || text === 0"><a-tag :color="getTagColor(record)">{{ text }}</a-tag></div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
</j-table>
</div>
<!-- 新增编辑弹框 -->
<ocr-text-recognition-modal ref="modalForm" @ok="modalFormOk"/>
</a-card>
</template>
<script>
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JTable from '@comp/jero/JTable'
import OcrTextRecognitionModal from '@views/documentTool/ocrTextRecognition/modules/OcrTextRecognitionModal'
import { downloadFile, getAction, postAction } from '@api/manage'
export default {
name: 'OcrTextRecognition',
components: { OcrTextRecognitionModal, JTable },
mixins: [JeroListMixin],
data () {
return {
url: {
list: '/laws/ocr/OCRRestful/getAllOcrResult',
deleteBatch: '/laws/ocr/OCRRestful/deleteOcrRecord'
},
columns: [
{ // 序号
title: this.$t('serialNumber'),
key: 'rowIndex',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
// { // 标准类别
// title: this.$t('docTool.ocrTextRecognition.standardCategory'),
// align: 'center',
// width: 180,
// dataIndex: 'fileType2',
// scopedSlots: { customRender: 'text' }
// },
{ // 标准编号
title: this.$t('docTool.ocrTextRecognition.standardNumber'),
align: 'center',
width: 180,
dataIndex: 'standNumber',
scopedSlots: { customRender: 'text' }
},
{ // 标准名称
title: this.$t('docTool.ocrTextRecognition.standardName'),
align: 'center',
width: 180,
dataIndex: 'standName',
scopedSlots: { customRender: 'text' }
},
{ // 文本状态
title: this.$t('docTool.ocrTextRecognition.textStatus'),
align: 'center',
width: 180,
dataIndex: 'fileType',
scopedSlots: { customRender: 'text' }
},
{ // 转换结果
title: this.$t('docTool.ocrTextRecognition.conversionResults'),
align: 'center',
width: 180,
dataIndex: 'resultContent',
scopedSlots: { customRender: 'tag' }
},
{ // 消耗时间
title: this.$t('docTool.ocrTextRecognition.timeConsuming'),
align: 'center',
width: 180,
dataIndex: 'spendTime',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
fixed: 'right',
width: 200
}
],
operationList: [
// 获取文件
{
text: this.$t('docTool.ocrTextRecognition.getFile'),
clickEvent: 'handleDownload',
has: 'docTool:ocrTextRecognition:download',
show: (record) => {
return record.resultContent !== '转换中'
}
},
// 编辑
{
text: this.$t('edit'),
clickEvent: 'handleEdit',
has: 'docTool:ocrTextRecognition:edit'
}
// 删除
// {
// text: this.$t('delete'),
// clickEvent: 'handleDelete',
// has: 'split:sarFileSplitInfo:release'
// }
]
}
},
mounted () {
console.log(this.$refs.modalForm)
},
methods: {
loadData (arg) {
if (!this.url.list) {
this.$message.warning('请设置url.list属性!')
return
}
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
const params = this.getQueryParams()// 查询条件
console.log(params)
this.loading = true
postAction(this.url.list, params).then((res) => {
if (res.ok) {
this.dataSource = res.data.list
if (res.data.count) {
this.ipagination.total = res.data.count
} else {
this.ipagination.total = 0
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
handleDownload (data) {
downloadFile(`/sys/common/download/${data.wordAttId}`, data.docRealName)
},
getTagColor (row) {
if (row.resultContent === '转换成功') {
return 'green'
} else if (row.resultContent === '转换中') {
return 'blue'
} else {
return 'red'
}
},
batchDel: function () {
if (!this.url.deleteBatch) {
this.$message.warning('请设置url.deleteBatch属性!')
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning(this.$t('selectARecord'))
} else {
const ids = this.selectedRowKeys.join(',')
const that = this
this.$confirm({
title: this.$t('confirmBatchDeletion'),
content: this.$t('deleteAData'),
onOk: function () {
that.loading = true
getAction(that.url.deleteBatch, { ids: ids }).then((res) => {
if (res.ok) {
// 重新计算分页问题
that.reCalculatePage(that.selectedRowKeys.length)
that.$message.success(res.message)
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.loading = false
})
}
})
}
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,176 @@
<template>
<j-modal
:title="title"
:width="800"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
:cancelText="$t('close')"
switchFullscreen
wrapClassName="ant-modal-cust-warp"
style="top:5%;overflow-y: hidden">
<a-spin :spinning="confirmLoading">
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 16 }">
<!--文件-->
<a-form-item label="文件">
<j-upload v-decorator="['attId', validatorRules.attId]"
@change="changeAttIdFile"
:number="1"
return-id
class="line-btn"
accept=".pdf"
file-type="pdf" />
</a-form-item>
<!--标准编号-->
<a-form-item :label="$t('docTool.ocrTextRecognition.standardNumber')">
<standard-selection :placeholder="$t('pleaseSelect') + $t('docTool.ocrTextRecognition.standardNumber')"
@nameChange="changeStandardName" type="radio"
v-decorator="['standNumber']" />
</a-form-item>
<!--标准名称-->
<a-form-item :label="$t('docTool.ocrTextRecognition.standardName')">
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.ocrTextRecognition.standardName')"
class="box-input" :maxLength="500"
v-decorator="['standName']" />
</a-form-item>
<!--文本状态-->
<a-form-item :label="$t('docTool.ocrTextRecognition.textStatus')">
<a-select
:placeholder="$t('pleaseSelect') + $t('docTool.ocrTextRecognition.textStatus')"
v-decorator="['fileType', validatorRules.fileType]"
show-search
:filter-option="filterOption"
>
<a-select-option v-for="item in fileTypeList" :key="item.value" :value="item.value">{{ item.text || item.label }}</a-select-option>
</a-select>
</a-form-item>
</a-form>
</a-spin>
</j-modal>
</template>
<script>
import StandardSelection from '@comp/selection/StandardSelection'
import { getFileInfo } from '@api/api'
import { postAction } from '@api/manage'
import pick from 'lodash.pick'
export default {
name: 'OcrTextRecognitionModal',
components: { StandardSelection },
data () {
return {
form: this.$form.createForm(this),
title: '操作',
visible: false,
model: {},
url: {
add: '/laws/ocr/OCRRestful/addOcrRecord',
edit: '/laws/ocr/OCRRestful/updateOcrRecord'
},
// 文本状态下拉
fileTypeList: [
{ label: '修改单', value: '修改单' },
{ label: '草稿', value: '草稿' },
{ label: '报批稿', value: '报批稿' },
{ label: '发布稿(原文)', value: '发布稿(原文)' },
{ label: '相关文件', value: '相关文件' },
{ label: '关联文件', value: '关联文件' },
{ label: '征求意见稿', value: '征求意见稿' },
{ label: '发布稿(译文)', value: '发布稿(译文)' },
{ label: '送审稿', value: '送审稿' }
],
confirmLoading: false,
validatorRules: {
// 文件
attId: {
rules: [
{ required: true, trigger: 'change', message: this.$t('uploadFile.pleaseUpload') + this.$t('docTool.ocrTextRecognition.file') }
]
},
// 文本状态
fileType: {
rules: [
{ required: true, trigger: 'change', message: this.$t('pleaseSelect') + this.$t('docTool.ocrTextRecognition.textStatus') }
]
}
}
}
},
methods: {
add () {
this.edit()
},
edit (record) {
this.model = Object.assign({}, record)
console.log(record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'attId', 'fileType', 'standName', 'standNumber'))
})
},
close () {
this.form.resetFields()
this.$emit('close')
this.visible = false
},
handleOk () {
const that = this
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
const params = Object.assign({}, this.model, values)
const url = this.model.id ? this.url.edit : this.url.add
postAction(url, params).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
}
})
},
handleCancel () {
this.close()
},
changeStandardName (value) {
this.form.setFieldsValue({
standName: value
})
},
filterOption (input, option) {
return (
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
)
},
// 文件上传,通过id获取文件名
changeAttIdFile (fileId) {
this.getFileInfo(fileId).then(res => {
if (res && res.fileName) {
this.model.fileName = res.fileName
}
})
},
/**
* 通过文件的id获取文件的相关信息
* @param id
*/
getFileInfo (id) {
return getFileInfo({ id: id }).then(res => {
if (res.success) {
return res.result
}
})
}
}
}
</script>
<style scoped>
</style>