update 文档比对
This commit is contained in:
@@ -0,0 +1,264 @@
|
||||
<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')">
|
||||
<j-input :placeholder="$t('pleaseEnter') + $t('projectLibrary.projectName')" v-model="queryParam.projectName"></j-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.projectHealth"
|
||||
:placeholder="$t('pleaseSelect') + $t('docTool.split.splitState')"
|
||||
:type="'select'"
|
||||
:triggerChange="false"
|
||||
:dictCode="'project_health'" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!--编辑人-->
|
||||
<a-col :md="6" :sm="12">
|
||||
<a-form-item :label="$t('docTool.split.editor')">
|
||||
<j-input :placeholder="$t('pleaseEnter') + $t('docTool.split.editor')" v-model="queryParam.projectName"></j-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="6" :sm="8">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchReset" icon="reload" ghost>{{ $t('reset') }}</a-button>
|
||||
<a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 8px">
|
||||
{{ $t('query') }}
|
||||
</a-button>
|
||||
</span>
|
||||
</a-col>
|
||||
</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>
|
||||
</div>
|
||||
<div>
|
||||
<j-table
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:can-drag="true"
|
||||
rowKey="id"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
||||
:pagination="ipagination"
|
||||
:scroll="{x: '100%'}"
|
||||
:loading="loading"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template v-slot:operation="{text, record}">
|
||||
<a @click="operationClick(operationList[0],record)">{{ operationList[0].text }}</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown placement="bottomCenter">
|
||||
<a-icon type="more" class="operate-icon-btn operate-icon-more" />
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index">
|
||||
<a @click="operationClick(operation,record)">
|
||||
<div class="operate-btn">
|
||||
<!-- 编辑图标-->
|
||||
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
|
||||
<!-- 删除图标-->
|
||||
<i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operation.text === $t('delete')" />
|
||||
{{ operation.text }}
|
||||
</div>
|
||||
</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
|
||||
</j-table>
|
||||
</div>
|
||||
|
||||
<!--拆分已入库文本弹框-->
|
||||
<split-text ref="splitText" @visible="splitTextVisible"></split-text>
|
||||
<!--导入拆分结果弹框-->
|
||||
<import-result ref="importResult" @visible="importResultVisible"></import-result>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import '../../../assets/less/common.less'
|
||||
import JTable from '../../../components/jero/JTable.vue'
|
||||
// 拆分已入库文本弹框
|
||||
import SplitText from '../modules/SplitText.vue'
|
||||
// 导入拆分结果弹框
|
||||
import ImportResult from '../modules/ImportResult.vue'
|
||||
import { JeroListMixin } from '../../../mixins/JeroListMixin.js'
|
||||
import { releaseSplitStandard } from '../../../api/documentToolApi.js'
|
||||
|
||||
export default {
|
||||
name: 'DocumentSplit',
|
||||
components: { JTable, SplitText, ImportResult },
|
||||
mixins: [JeroListMixin],
|
||||
data () {
|
||||
return {
|
||||
operationList: [
|
||||
// 发布
|
||||
{
|
||||
text: this.$t('release'),
|
||||
clickEvent: 'handleRelease',
|
||||
has: ''
|
||||
},
|
||||
// 查看
|
||||
{
|
||||
text: this.$t('view'),
|
||||
clickEvent: 'handleDetail',
|
||||
has: ''
|
||||
},
|
||||
// 编辑
|
||||
{
|
||||
text: this.$t('edit'),
|
||||
clickEvent: 'handleEdit',
|
||||
has: ''
|
||||
},
|
||||
// 删除
|
||||
{
|
||||
text: this.$t('delete'),
|
||||
clickEvent: 'handleDelete',
|
||||
has: ''
|
||||
}
|
||||
],
|
||||
columns: [
|
||||
// 标准号
|
||||
{
|
||||
dataIndex: '1',
|
||||
title: this.$t('standardSelect.standardNumber'),
|
||||
width: 150
|
||||
},
|
||||
// 标准名称
|
||||
{
|
||||
dataIndex: '2',
|
||||
title: this.$t('standardSelect.standardName'),
|
||||
width: 150
|
||||
},
|
||||
// 文件状态
|
||||
{
|
||||
dataIndex: '3',
|
||||
title: this.$t('docTool.split.fileStatus'),
|
||||
width: 150
|
||||
},
|
||||
// 文件名称
|
||||
{
|
||||
dataIndex: '4',
|
||||
title: this.$t('fileName'),
|
||||
width: 150
|
||||
},
|
||||
// 拆分状态
|
||||
{
|
||||
dataIndex: '5',
|
||||
title: this.$t('docTool.split.splitState'),
|
||||
width: 150
|
||||
},
|
||||
// 编辑人
|
||||
{
|
||||
dataIndex: '6',
|
||||
title: this.$t('docTool.split.editor'),
|
||||
width: 150
|
||||
},
|
||||
// 拆分时间
|
||||
{
|
||||
dataIndex: '7',
|
||||
title: this.$t('docTool.split.splitTime'),
|
||||
width: 150
|
||||
},
|
||||
// 拆分结果
|
||||
{
|
||||
dataIndex: '91',
|
||||
title: this.$t('docTool.split.splitResult'),
|
||||
sorter: true,
|
||||
width: 150
|
||||
},
|
||||
// 操作
|
||||
{
|
||||
title: this.$t('operation'),
|
||||
fixed: 'right',
|
||||
width: 150,
|
||||
scopedSlots: { customRender: 'operation' }
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: '/split/sarFileSplitInfo/page', // 表格数据
|
||||
deleteBatch: '', // 批量删除
|
||||
deleteUrl: '',
|
||||
backDocument: '' // 回传至文档库
|
||||
},
|
||||
dataSource: [
|
||||
{ id: 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 拆分已入库文本按钮点击
|
||||
handleModule () {
|
||||
this.$refs.splitText.open()
|
||||
},
|
||||
// 导入拆分结果
|
||||
handleExport () {
|
||||
this.$refs.importResult.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
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表格操作列的查看
|
||||
handleEdit (record) {
|
||||
this.$router.push({
|
||||
path: '/documentTool/DocumentSplitDetail',
|
||||
query: {
|
||||
infoId: record.id,
|
||||
infoNumber: record.serialNumber,
|
||||
createBy: record.createBy,
|
||||
standardName: 'GB 7258-2020 机动车运行安全'
|
||||
}
|
||||
})
|
||||
},
|
||||
splitTextVisible (val, num) {
|
||||
if (num === 1) {
|
||||
this.$refs.tableData.$emit('searchGetData')
|
||||
}
|
||||
},
|
||||
importResultVisible (val, num) {
|
||||
if (num === 1) {
|
||||
this.$refs.tableData.$emit('searchGetData')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
@@ -0,0 +1,564 @@
|
||||
<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="loading">
|
||||
<a-tree :show-line="true" :show-icon="true" :tree-data="treeData" :selected-keys="selectedKeys">
|
||||
<a-icon type="folder" slot="folder" class="tree-icon" />
|
||||
<a-icon type="file" slot="file" class="tree-icon" />
|
||||
|
||||
<template #custom="record">
|
||||
<div class="tree-operate-node"
|
||||
@mouseenter="handleTreeMouseover(record.key)"
|
||||
@mouseleave="handleTreeMouseout(record.key)"
|
||||
@click="handleSelectTreeNode(record)">
|
||||
<a-tooltip>
|
||||
<template #title>
|
||||
{{ record.title }}
|
||||
</template>
|
||||
<span class="tree-node-custom-title">{{ record.title }}</span>
|
||||
</a-tooltip>
|
||||
<div class="tree-operate-node-btn-box" :class="{'tree-operate-node-btn-box-hide': record.key !== 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-has="'split:sarFileSplitMenu:update'">
|
||||
<i class="iconfont icon-bianji" />
|
||||
</a-button>
|
||||
<!--删除,根节点不能删除-->
|
||||
<a-button class="tree-operate-node-btn"
|
||||
v-has="'split:sarFileSplitMenu:delete'"
|
||||
@click.stop="orgDelete(record)">
|
||||
<i class="iconfont icon-shanchu_" />
|
||||
</a-button>
|
||||
<!--节点上移,是否可以上移在树形数据中应该有字段标识-->
|
||||
<a-button icon="up"
|
||||
class="tree-operate-node-btn"
|
||||
@click.stop="orgMoveUp(record)"
|
||||
v-has="'split:sarFileSplitMenu:moveUp'">
|
||||
</a-button>
|
||||
<!--节点下移,是否可以下移在树形数据中应该有字段标识-->
|
||||
<a-button icon="up"
|
||||
class="tree-operate-node-btn"
|
||||
@click.stop="orgmoveDown(record)"
|
||||
v-has="'split:sarFileSplitMenu:moveDown'">
|
||||
</a-button>
|
||||
</div>
|
||||
<!--<template #overlay>-->
|
||||
<!-- <a-menu v-if="$route.query.createBy === userInfo.username || administrators"-->
|
||||
<!-- @click="({ key: menuKey }) => onContextMenuClick(treeKey, menuKey, record)">-->
|
||||
<!-- <a-menu-item key="1" @click="orgAdd" v-has="'split:sarFileSplitMenu:add'">-->
|
||||
<!-- {{ $t('newNode') }}-->
|
||||
<!-- </a-menu-item>-->
|
||||
<!-- <a-menu-item key="2" @click="orgEdit" v-has="'split:sarFileSplitMenu:update'">-->
|
||||
<!-- {{ $t('modifyNode') }}-->
|
||||
<!-- </a-menu-item>-->
|
||||
<!-- <a-menu-item key="3" @click="orgDelete" v-if="deleteNode"-->
|
||||
<!-- v-has="'split:sarFileSplitMenu:delete'">{{ $t('deleteNode') }}-->
|
||||
<!-- </a-menu-item>-->
|
||||
<!-- <a-menu-item key="4" @click="orgMoveUp" v-if="deleteNode && moveUpFlag"-->
|
||||
<!-- v-has="'split:sarFileSplitMenu:moveUp'">{{ $t('moveUp') }}-->
|
||||
<!-- </a-menu-item>-->
|
||||
<!-- <a-menu-item key="5" @click="orgmoveDown" v-if="deleteNode && moveDownFlag"-->
|
||||
<!-- v-has="'split:sarFileSplitMenu:moveDown'">{{ $t('moveDown') }}-->
|
||||
<!-- </a-menu-item>-->
|
||||
<!-- </a-menu>-->
|
||||
<!--</template>-->
|
||||
</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="domesticStandard:search"
|
||||
@search="searchQuery"
|
||||
@reset="searchReset" />
|
||||
</div>
|
||||
<!--操作按钮-->
|
||||
<div class="table-operator">
|
||||
<!--新增-->
|
||||
<a-button icon="plus" type="primary" @click="handleAdd" v-has="'domesticStandard:add'">{{ $t('newlyAdded') }}</a-button>
|
||||
<!--导入-->
|
||||
<a-upload name="file"
|
||||
:showUploadList="false"
|
||||
:multiple="false"
|
||||
:headers="tokenHeader"
|
||||
:action="importExcelUrl"
|
||||
@change="handleImportExcel">
|
||||
<a-button type="primary" icon="download" ghost>{{ $t('import') }}</a-button>
|
||||
</a-upload>
|
||||
<!--导出-->
|
||||
<a-button icon="upload"
|
||||
type="primary"
|
||||
ghost
|
||||
@click="handleExportXls($t('standardRegulationLibrary.domesticStandard.exportFileName'))">
|
||||
{{ $t('export') }}
|
||||
</a-button>
|
||||
<!--批量删除-->
|
||||
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'domesticStandard:batchDel'">{{ $t('batchDelete') }}</a-button>
|
||||
<!--模板下载-->
|
||||
<a-button type="primary"
|
||||
icon="download"
|
||||
ghost
|
||||
@click="downTemplate($t('standardRegulationLibrary.domesticStandard.templateName'))">
|
||||
{{ $t('templateDownload') }}
|
||||
</a-button>
|
||||
<!--批量复制-->
|
||||
<a-button type="primary" ghost @click="handleCopyManage">{{ $t('docTool.split.batchCopy') }}</a-button>
|
||||
<!--批量编辑-->
|
||||
<a-button type="primary" ghost @click="handleManage">{{ $t('docTool.split.batchEdit') }}</a-button>
|
||||
<!--合并条款-->
|
||||
<a-button type="primary" ghost @click="handleMergeManage">{{ $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%'}"
|
||||
@change="tableOnChange">
|
||||
|
||||
<template slot="operation" slot-scope="{text, record}">
|
||||
<a v-for="(operation, index) in operationList" :key="index" @click="operationClick(operation,record)">
|
||||
<!-- v-has="operation.has"-->
|
||||
<span class="text">
|
||||
{{ operation.text }}
|
||||
</span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- 详情-->
|
||||
<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="showContent" slot-scope="text, record">
|
||||
<span class="content-show"
|
||||
@click="showContent(text,record)">{{ record.iterms_conditions && record.iterms_conditions !== 'null' ? record.iterms_conditions.replace(/<.*?>/ig, ' ') : ''
|
||||
}}</span>
|
||||
</template>
|
||||
|
||||
</j-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 条款详情 -->
|
||||
<split-clause-detail ref="splitClauseDetail"></split-clause-detail>
|
||||
<!-- 添加节点 -->
|
||||
<split-detail-node-add ref="splitDetailNodeAdd" @ok="nodeAddOk" @update="nodeUpdateOk"></split-detail-node-add>
|
||||
<!-- 批量设置弹框 -->
|
||||
<split-detail-batch-setting ref="splitDetailBatchSetting" @ok="batchSettingOk"></split-detail-batch-setting>
|
||||
<!--条款添加-->
|
||||
<split-add-form ref="modalForm" :flag="'4'"
|
||||
:url="url" :infoId="infoId" :menuId="menuId" :itemId="itemId"
|
||||
@sumber="sumber"></split-add-form>
|
||||
</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 SplitDetailBatchSetting from '../modules/SplitDetailBatchSetting.vue'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { postAction, getAction } from '../../../api/manage.js'
|
||||
import { ConfigurableTableMixin } from '../../../mixins/ConfigurableTableMixin.js'
|
||||
import { getDocSplitTableHeader, getDocSplitSearch } from '../../../api/documentToolApi.js'
|
||||
import Search from '../../../components/customField/Search.vue'
|
||||
|
||||
export default {
|
||||
name: 'DocumentSplitDetail',
|
||||
components: {
|
||||
InternalDetailPage,
|
||||
JTable,
|
||||
SplitAddForm,
|
||||
SplitClauseDetail,
|
||||
SplitDetailNodeAdd,
|
||||
SplitDetailBatchSetting,
|
||||
Search
|
||||
},
|
||||
mixins: [ConfigurableTableMixin],
|
||||
data () {
|
||||
return {
|
||||
data: [],
|
||||
loading: false, // 提交的加载
|
||||
confirmLoading: false,
|
||||
nodeTreeItem: null, // 右键菜单
|
||||
tmpStyle: '', // 右键菜单位置
|
||||
infoId: '',
|
||||
menuId: '',
|
||||
itemId: '',
|
||||
itemVal: {},
|
||||
uploadMenuId: '',
|
||||
deleteNode: false,
|
||||
moveDownFlag: false,
|
||||
moveUpFlag: false,
|
||||
fullWidth: '',
|
||||
parameter: {},
|
||||
administrators: false,
|
||||
showAction: this.isCanOperate,
|
||||
flag: '4', // 查询要用到
|
||||
|
||||
getQueryConditionFunc: getDocSplitSearch,
|
||||
getTableHeaderFunc: getDocSplitTableHeader,
|
||||
treeData: [],
|
||||
searchValue: '',
|
||||
selectedKeys: [],
|
||||
mouseInNodeKey: null, // 鼠标悬浮的节点key值
|
||||
// 操作栏
|
||||
operationList: [
|
||||
{
|
||||
text: this.$t('edit'),
|
||||
ClickEvent: 'handleEdit'
|
||||
},
|
||||
{
|
||||
text: this.$t('delete'),
|
||||
ClickEvent: 'handleDelete'
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: '',
|
||||
importUrl: '', // 导入
|
||||
exportXlsUrl: '', // 导出
|
||||
delete: '', // 删除
|
||||
deleteBatch: '', // 批量删除
|
||||
downTemplateUrl: '' // 模板下载
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isCanOperate () {
|
||||
return !!(this.$route.query.createBy === this.userInfo.username || this.administrators)
|
||||
},
|
||||
// 页面标题是标准名称
|
||||
pageTitle () {
|
||||
return this.$route.query.standardName
|
||||
},
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
created () {
|
||||
this.filters = {
|
||||
menu_id: this.menuId,
|
||||
info_id: this.infoId
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.administrators = false
|
||||
if (this.userInfo.userRoleList && this.userInfo.userRoleList.length > 0) {
|
||||
this.userInfo.userRoleList.forEach(res => {
|
||||
if (res.roleCode === 'admin') {
|
||||
this.administrators = true
|
||||
}
|
||||
})
|
||||
}
|
||||
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.key]
|
||||
this.filters.nodeCode = dataRef.nodeCode
|
||||
this.loadData(1)
|
||||
},
|
||||
|
||||
// 显示条款内容弹框
|
||||
showContent (val) {
|
||||
this.$refs.splitClauseDetail.open(val)
|
||||
},
|
||||
// 获取左侧目录数据
|
||||
loadMenuData () {
|
||||
const params = {
|
||||
infoId: this.infoId
|
||||
}
|
||||
this.loading = true
|
||||
getAction(`split/sarFileSplitMenu/getSplitMenusByInfoId`, params).then(res => {
|
||||
if (res.success) {
|
||||
this.data = this.toTree(res.result)
|
||||
this.treeData = [...this.data]
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 将数据拼成树形结构
|
||||
toTree (config) {
|
||||
// 删除 所有 children,以防止多次调用
|
||||
config.forEach(function (item) {
|
||||
delete item.children
|
||||
})
|
||||
// 将数据存储为 以 id 为 KEY 的 map 索引数据列
|
||||
const map = {}
|
||||
config.forEach((item) => {
|
||||
if (!item.name) {
|
||||
item.name = ''
|
||||
}
|
||||
item.label = item.name
|
||||
item.key = item.id
|
||||
item.title = item.name + (item.itemName ? ' ' + item.itemName : '')
|
||||
map[item.id] = item
|
||||
})
|
||||
const val = []
|
||||
config.forEach((item) => {
|
||||
// 以当前遍历项,的pid,去map对象中找到索引的id
|
||||
const parent = map[item.pid]
|
||||
// 如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
|
||||
if (parent) {
|
||||
(parent.children || (parent.children = [])).push(item)
|
||||
} else {
|
||||
// 如果没有在map中找到对应的索引ID,那么直接把 当前的item添加到 val结果集中,作为顶级
|
||||
val.push(item)
|
||||
}
|
||||
})
|
||||
return val
|
||||
},
|
||||
// 用于点击空白处隐藏增删改菜单
|
||||
clearMenu () {
|
||||
this.nodeTreeItem = null
|
||||
},
|
||||
// 选择树节点
|
||||
onSelect (selectedKeys) {
|
||||
this.menuId = selectedKeys[0]
|
||||
this.uploadMenuId = selectedKeys[0]
|
||||
this.selectedKeys = selectedKeys
|
||||
this.filters.info_id = this.infoId
|
||||
this.filters.menu_id = this.menuId
|
||||
this.loadData()
|
||||
},
|
||||
// 树形新增
|
||||
orgAdd () {
|
||||
this.$refs.splitDetailNodeAdd.add(this.nodeItem, this.infoId)
|
||||
},
|
||||
// 树形修改
|
||||
orgEdit () {
|
||||
this.$refs.splitDetailNodeAdd.edit(this.nodeItem, this.infoId)
|
||||
},
|
||||
// 添加节点完成后的回调
|
||||
nodeAddOk () {
|
||||
this.loadMenuData()
|
||||
this.loadData()
|
||||
},
|
||||
// 修改节点完成后的回调
|
||||
nodeUpdateOk (expandId) {
|
||||
this.onExpand(expandId)
|
||||
this.loadMenuData()
|
||||
},
|
||||
// 树形删除
|
||||
orgDelete () {
|
||||
this.$confirm({
|
||||
content: this.$t('confirmDeleteNodes'),
|
||||
onOk:
|
||||
async () => {
|
||||
getAction(`split/sarFileSplitMenu/deleteMenu`, { id: this.nodeItem.id }).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.loadMenuData()
|
||||
this.loadData()
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 树上移
|
||||
orgMoveUp () {
|
||||
const query = {
|
||||
moveFlag: 'up',
|
||||
infoId: this.infoId,
|
||||
sarFileSplitMenu: {
|
||||
id: this.nodeItem.id,
|
||||
pId: this.nodeItem.pid,
|
||||
displaySeq: this.nodeItem.displaySeq
|
||||
}
|
||||
}
|
||||
postAction(`split/sarFileSplitMenu/moveUpOrDown`, query).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.loadMenuData()
|
||||
this.loadData()
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
},
|
||||
// 树下移
|
||||
orgmoveDown () {
|
||||
const query = {
|
||||
moveFlag: 'down',
|
||||
infoId: this.infoId,
|
||||
SarFileSplitMenu: {
|
||||
id: this.nodeItem.id,
|
||||
pId: this.nodeItem.pid,
|
||||
displaySeq: this.nodeItem.displaySeq
|
||||
}
|
||||
}
|
||||
postAction(`split/sarFileSplitMenu/moveUpOrDown`, query).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.loadMenuData()
|
||||
this.loadData()
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
},
|
||||
onContextMenuClick (treeKey, menuKey) {
|
||||
// console.log(`treeKey: ${treeKey}, menuKey: ${menuKey}`);
|
||||
},
|
||||
// 复制按钮
|
||||
handleCopyManage (record) {
|
||||
const ids = []
|
||||
const infoIds = []
|
||||
const menuIds = []
|
||||
this.selectedRows.forEach(item => {
|
||||
ids.push(item.id)
|
||||
infoIds.push(item.info_id)
|
||||
menuIds.push(item.menu_id)
|
||||
})
|
||||
const params = {
|
||||
ids: ids.join(','),
|
||||
infoIds: infoIds.join(','),
|
||||
menuids: menuIds.join(',')
|
||||
}
|
||||
if (menuIds && menuIds.length > 0) {
|
||||
this.$confirm({
|
||||
title: this.$t('confirmReplication'),
|
||||
content: '',
|
||||
onOk: () => {
|
||||
getAction('/split/sarFileSplitItems/batchCopyItems', params).then((res) => {
|
||||
if (res.data.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.onClearSelected()
|
||||
this.loadMenuData()
|
||||
this.loadData()
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (menuIds.length === 0) {
|
||||
this.$message.warning(this.$t('pleaseSelectData'))
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
handleAddManage () {
|
||||
// console.log('this.menuId',this.menuId)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.splitForm.add()
|
||||
this.$refs.splitForm.formTitle = this.$t('add')
|
||||
})
|
||||
},
|
||||
// 合并条款
|
||||
handleMergeManage () {
|
||||
if (this.selectedRowKeys && this.selectedRowKeys.length < 2) {
|
||||
this.$message.warning(this.$t('leastTwo'))
|
||||
} else {
|
||||
const ids = this.selectedRowKeys.join(',')
|
||||
this.$confirm({
|
||||
title: this.$t('docTool.split.mergeTerms'),
|
||||
content: '',
|
||||
onOk: () => {
|
||||
getAction('/split/sarFileSplitItems/batchMergeItems', { ids: ids }).then(res => {
|
||||
if (res.data.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.onClearSelected()
|
||||
this.loadMenuData()
|
||||
this.loadData()
|
||||
this.selectedRowKeys = []
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
// 批量设置
|
||||
handleManage () {
|
||||
const ids = this.selectedRowKeys.join(',')
|
||||
if (this.selectedRowKeys && this.selectedRowKeys.length < 1) {
|
||||
this.$message.warning(this.$t('selectLeastOne'))
|
||||
} else {
|
||||
this.$refs.splitDetailBatchSetting.open(ids)
|
||||
}
|
||||
},
|
||||
// 批量设置完成的回调
|
||||
batchSettingOk () {
|
||||
this.onClearSelected()
|
||||
this.loadData()
|
||||
},
|
||||
// 保存成功
|
||||
sumber () {
|
||||
this.loadData()
|
||||
this.loadMenuData()
|
||||
},
|
||||
onSearch () {
|
||||
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
window.removeEventListener('resize', {}, false)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
|
||||
.page-left-right-layout {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user