Files
laws_weilai/jero-web/src/views/documentManage/splitting/modules/SplitDetail.vue
T
2022-03-30 22:19:08 +08:00

1073 lines
34 KiB
Java

<template>
<div class="split-detail" @click="clearMenu">
<a-card :bordered="false" >
<div class="split-detail-wrap">
<div class="split-detail-left">
<div class="split-detail-left-tree">
<a-input-search style="margin-bottom: 8px" :placeholder="$t('NodeQuickLookup')" @change="onLeftChange" @search="onSearch" />
<a-tree
v-if="gData.length>0"
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:defaultExpandAll="true"
:tree-data="gData"
@expand="onExpand"
@rightClick="rightClick"
@select="onSelect"
>
<template slot="title" slot-scope="{ title }">
<span v-if="title.indexOf(searchValue) > -1">
{{ title.substr(0, title.indexOf(searchValue)) }}<span style="color: #f50">{{ searchValue }}</span>{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ title }}</span>
</template>
</a-tree>
<div v-if="NodeTreeItem" :style="tmpStyle" >
<div class="menu-item" @click="orgAdd">
{{$t('newNode')}}
</div>
<div class="menu-item" @click="orgEdit">
{{$t('modifyNode')}}
</div>
<div class="menu-item menu-bottom" @click="orgDelete" v-if="NodeTreeItem">
{{$t('deleteNode')}}
</div>
</div>
</div>
</div>
<div class="split-detail-right">
<div class="split-detail-right-wraper">
<div class="split-detail-search-header">
<search :flag="'4'" :url="url"/>
</div>
<div class="table-operator">
<div class="operator-text" @click="handleCopyManage">
<a-icon type="copy" />
{{ $t('copy') }}
</div>
<div class="operator-text" @click="handleAddManage">
<a-icon type="plus" />
{{ $t('add') }}
</div>
<div class="operator-text upload-split" @click="handleImportManage">
<a-icon type="import" :rotate="-90" v-if="!uploadMenuId" />
{{ uploadMenuId===''? $t('import'):'' }}
<upload v-if="menuId" ref="uploadSplit":infoId="infoId" :menuId="uploadMenuId" @uploadSuccess="uploadSuccess"></upload>
<!-- <ImportFile :url="url"/>-->
</div>
<div class="operator-text" @click="handleExportManage">
<a-icon type="export" :rotate="-90"/>
{{ $t('export') }}
</div>
<div class="operator-text" @click="handleDownManage">
<a-icon type="download" />
{{ $t('TemplateDownload') }}
</div>
<div class="operator-text" @click="handleMergeManage">
<a-icon type="snippets" />
{{ $t('MergerClause') }}
</div>
<div class="operator-text" @click="handleManage">
<a-icon type="setting" />
{{ $t('BatchSetting') }}
</div>
<div class="operator-text" @click="handleBatCancel">
<a-icon type="delete" />
{{ $t('BatchDelete') }}
</div>
</div>
<div class="split-detail-table">
<table-data
:url="url"
:flag="'4'"
:OperationList="OperationList"
:infoId="$route.query.infoId"
:menuId="menuId"
showAction
@onSelectChange="onSelectChange"
@deleteClick="deleteClick"
@editClick="editClick"
@showContent="showContent"
></table-data>
</div>
</div>
</div>
<!-- 条款详情-->
<a-modal
:title="$t('clauseContent')"
:visible="contentVisible"
:confirm-loading="confirmLoading"
:footer="false"
@cancel="handleCancel"
>
<p>{{contentValue}}</p>
</a-modal>
<!-- 添加节点-->
<a-modal
class="add-menus"
:title="menuTitle"
:visible="menuRightVisible"
:confirm-loading="confirmLoading"
@cancel="handleCancelMenuRight"
@ok="hideModalMenuRight"
>
<a-form-model
v-if="menuRightVisible"
class="split-click-right-form"
ref="ruleForm"
:model="form"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-model-item :label="$t('clauseNo')" prop="name">
<a-input v-model="form.name" :placeholder="$t('PleaseEnter')+$t('clauseNo')" />
</a-form-model-item>
<a-form-model-item :label="$t('clauseName')" prop="itemName">
<a-input v-model="form.itemName" :placeholder="$t('PleaseEnter')+$t('clauseName')" />
</a-form-model-item>
<a-form-model-item :label="$t('serialNumber')" prop="displaySeq">
<a-input-number v-model="form.displaySeq" :min="1" :max="99999" :placeholder="$t('PleaseEnter')+$t('serialNumber')" :formatter="limitNumber" :parser="limitNumber" style="width: 100%" />
<!-- <a-input-number v-model="rowCount" :min="1" :placeholder="$t('pleaseEnter')+$t('numberRows')" :formatter="limitNumber" :parser="limitNumber" />-->
</a-form-model-item>
</a-form-model>
</a-modal>
<!-- 批量设置弹框-->
<a-modal
class="show-setting"
:title="$t('batSetting')"
:visible="batSetVisible"
:confirm-loading="confirmLoading"
@ok="modalOk"
@cancel="batSetCancel"
style="width: 1000px"
>
<split-bat-form
ref="fileForm"
@addFormClick="addFormClick"
:flag="'4'"
v-if="batSetVisible&&ids"
:url="urlBatSet"
:ids="ids">
</split-bat-form>
</a-modal>
<split-add-form ref="splitForm" v-if="addVisible" :addVisible="addVisible" :formTitle="formTitle" :flag="'4'" :url="url" :infoId="infoId" :menuId="menuId" :itemId="itemId" :itemVal="itemVal" @closeVisible="closeVisible" @sumber="sumber"></split-add-form>
</div>
</a-card>
</div>
</template>
<script>
import { getAction, postAction, deleteAction, putAction, downloadFile } from '@/api/manage'
import search from '@/components/search/index'
import TableData from '@/components/SplitDetailTable/index'
// import upload from '@/components/uploadFile/file.vue'
import SplitBatForm from '@/components/SplitBatForm/index'
import SplitAddForm from './SplitAddForm'
import upload from '@/components/SplitImport/index'
import axios from 'axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import eventBUs from '@/common/event'
import Vue from 'vue'
export default {
name: 'SplitDetail',
components:{
search,
TableData,
SplitBatForm,
SplitAddForm,
upload,
// ImportFile
},
data() {
return {
labelCol: { span: 6 },
wrapperCol: { span: 16 },
contentVisible:false, //条款内容弹框显示
queryParams:{
pageNo:1,
pageSize:10
},
total:0,
tableData:[],
selectedRowKeys: [],
selectedRows:[],
expandedKeys: [],
searchValue: '',
autoExpandParent: true,
dataList: [],
contentValue:'',
gData: [],
selecIds:[],
loading:false,
columns: [],
addVisible:false,
attId:'',
data:[],
confirmLoading:false,
NodeTreeItem:null, //右键菜单
tmpStyle:'', //右键菜单位置
menuTitle:this.$t('add'),
formTitle:'',
menuRightVisible:false,
form:{},
rules: {
name: [
{ required: true, message: this.$t('PleaseEnter')+this.$t('clauseNo'), trigger: 'blur' },
{ min: 1, max: 20, message: this.$t('cantExeed') + '20' + this.$t('characters'), trigger: 'blur' },
],
itemName: [
{ required: true, message: this.$t('PleaseEnter')+this.$t('clauseName'), trigger: 'blur' },
{ min: 1, max: 20, message: this.$t('cantExeed') + '20' + this.$t('characters'), 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' },
],
},
infoId:'',
menuId:'',
itemId:'',
itemVal:{},
// NodeTreeItemVisible:false,
flag:false, //提交按钮标识
isEdit:false,
OperationList: [ //操作栏
{
text: this.$t('edit'),
ClickEvent: 'editClick'
}, //编辑
{
text: this.$t('delete'),
ClickEvent: 'deleteClick'
} //删除
],
url:{
tableHeader: 'language/switch/getHeader', //表格头部字段
seachList: 'language/switch/queryCondition', //搜索字段
tableList: 'split/sarFileSplitItems/getSplitItemsByPage', //表格数据
getAddForm: 'language/switch/getForm', // 表单的字段
addInfo: '/jero-boot/split/sarFileSplitItems/addSplitItems', //新增
updateInfo:'/jero-boot/split/sarFileSplitItems/updateSplitItems', //编辑
getDocumentInfo:'split/sarFileSplitInfo/queryById',
importZipUrl: '/split/sarFileSplitItems/importSplitItems',//导入
},
urlBatSet:{
getAddForm:'split/sarFileSplitItems/getBatchSetForm',
addInfo:'/jero-boot/split/sarFileSplitItems/batchSet',
},
batSetVisible:false, //批量设置弹框显示
ids:'',
token:Vue.ls.get(ACCESS_TOKEN),
// upAccept:'.zip', //导入文件类型
uploadMenuId:''
}
},
mounted() {
this.infoId=this.$route.query.infoId
// console.log('info',this.$route.query)
this.loadMenuData()
// this.loadData()
this.generateList(this.gData);
},
methods: {
//显示条款内容弹框
showContent(){
// this.contentVisible=true
},
//关闭条款内容弹框
handleCancel(){
this.contentVisible = false;
},
generateList(data){
for (let i = 0; i < data.length; i++) {
const node = data[i];
const key = node.key;
this.dataList.push({ key, title: key });
if (node.children) {
this.generateList(node.children);
}
}
},
getParentKey(key, tree){
let parentKey;
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
if (node.children) {
if (node.children.some(item => item.key === key)) {
parentKey = node.key;
} else if (this.getParentKey(key, node.children)) {
parentKey = this.getParentKey(key, node.children);
}
}
}
return parentKey;
},
onExpand(expandedKeys){
this.expandedKeys = expandedKeys;
this.autoExpandParent = false;
},
onLeftChange(e) {
const value = e.target.value;
const expandedKeys = this.dataList
.map(item => {
if (item.title.indexOf(value) > -1) {
return this.getParentKey(item.key, this.gData);
}
return null;
})
.filter((item, i, self) => item && self.indexOf(item) === i);
Object.assign(this, {
expandedKeys,
searchValue: value,
autoExpandParent: true,
})
this.onSearch()
},
//获取左侧目录数据
loadMenuData(){
let params={
infoId:this.infoId
}
this.loading=true
getAction(`split/sarFileSplitMenu/getSplitMenusByInfoId`, params).then(res => {
if (res.success) {
this.data = this.toTree(res.result)
this.gData= [...this.data]
}
}).finally(()=>{
this.loading=false
})
},
//将数据拼成树形结构
toTree(config) {
// 删除 所有 children,以防止多次调用
config.forEach(function(item) {
delete item.children;
});
// 将数据存储为 以 id 为 KEY 的 map 索引数据列
let map = {};
config.forEach((item) => {
item.label = item.name;
item.key=item.id;
item.title=item.name+(item.itemName?' '+item.itemName:'')
map[item.id] = item;
});
let val = [];
config.forEach((item) => {
// 以当前遍历项,的pid,去map对象中找到索引的id
let parent = map[item.pid];
// 如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
if (parent) {
(parent.children || (parent.children = [])).push(item);
} else {
//如果没有在map中找到对应的索引ID,那么直接把 当前的item添加到 val结果集中,作为顶级
val.push(item);
}
});
return val;
},
//鼠标右键
rightClick({event,node}){
console.log('eee',event,node)
// this.NodeTreeItemVisible=true
const x =
event.currentTarget.offsetLeft + event.currentTarget.clientWidth;
const y = event.currentTarget.offsetTop;
this.NodeTreeItem = {
pageX: x,
pageY: y,
id: node._props.dataRef.id,
name:node._props.dataRef.name,
itemName:node._props.dataRef.itemName,
displaySeq:node._props.dataRef.displaySeq,
title: node._props.dataRef.title,
pid: node._props.dataRef.pid || null
};
this.nodeItem=JSON.parse(JSON.stringify(this.NodeTreeItem))
// this.form.pid=this.NodeTreeItem.id
// this.form.id=this.NodeTreeItem.id
this.tmpStyle = {
position: 'absolute',
maxHeight: 40,
textAlign: 'center',
left: `${x + 10 - 0}px`,
top: `${y + 6 - 0}px`,
background:`#FFFFFF`,
zIndex:`2`
};
// console.log('NodeTreeItem',this.NodeTreeItem)
},
// 用于点击空白处隐藏增删改菜单
clearMenu () {
this.NodeTreeItem = null;
// this.NodeTreeItemVisible=false
},
//选择树节点
onSelect(selectedKeys){
this.menuId=selectedKeys[0]
this.uploadMenuId=selectedKeys[0]
// eventBUs.$emit('searchReset')
// console.log('sele',selectedKeys)
},
//树形新增
orgAdd(){
this.menuTitle=this.$t('add')
this.isEdit=false
this.form={}
this.menuRightVisible=true
},
//树形修改
orgEdit(){
this.menuTitle=this.$t('edit')
this.isEdit=true
this.form.id=this.nodeItem.id
this.form.pid=this.nodeItem.pid
this.form.name=this.nodeItem.name
this.form.itemName=this.nodeItem.itemName
this.form.displaySeq=this.nodeItem.displaySeq
this.menuRightVisible=true
},
//树形删除
orgDelete(){
this.$confirm({
content: this.$t('deleteNodes'),
onOk:
async () => {
getAction(`split/sarFileSplitMenu/deleteMenu`, { id: this.nodeItem.id }).then(res => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.loadMenuData()
eventBUs.$emit('searchReset')
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
},
handleCancelMenuRight(){
this.menuRightVisible=false
},
//增加条款确定
hideModalMenuRight(){
this.menuRightVisible=false
let expandId=[]
expandId.push(this.form.pid)
if(!this.isEdit){
let params={
infoId: this.infoId,
pid:this.nodeItem.id,
...this.form,
}
this.flag=true
// console.log('parms',this.params)
if(this.flag){
postAction(`split/sarFileSplitMenu/addMenu`,params).then(res=>{
if(res.success){
this.$message.success(this.$t('OperationSuccessful'))
this.onExpand(expandId)
this.form={}
this.loadMenuData()
eventBUs.$emit('searchReset')
}else{
this.$message.warning(this.$t('operationFailed'))
}
}).finally(()=>{
this.flag=false
})
}
}else{
let params = {
info_id: this.infoId,
...this.form,
}
this.flag=true
// console.log('parms',params)
putAction(`split/sarFileSplitMenu/updateMenu`,params).then(res=>{
if(res.success){
this.$message.success(this.$t('OperationSuccessful'))
this.onExpand(expandId)
this.form={}
this.loadMenuData()
}else{
this.$message.warning(this.$t('operationFailed'))
}
}).finally(()=>{
this.flag=false
})
}
},
//获取列表数据
loadData(){
let params={
...this.queryParams,
info_id:this.infoId
}
this.loading=true
postAction(`split/sarFileSplitItems/getSplitItemsByPage`,params).then(res=>{
if(res.success){
this.tableData= [ ...res.result.records ]
this.loading=false
}
})
},
//搜索
searchQuery(){
},
//清空
searchReset(){
this.queryParams={
pageNo: 1,
pageSize: 10
}
this.loadData()
},
//复制按钮
handleCopyManage(record){
// console.log('')
let ids=[]
let infoIds=[]
let menuIds=[]
this.selectedRows.forEach(item=>{
ids.push(item.id)
infoIds.push(item.info_id)
menuIds.push(item.menu_id)
})
let params={
ids:ids.join(','),
infoIds:infoIds.join(','),
menuids:menuIds.join(',')
}
this.$confirm({
title: this.$t('ConfirmReplication'),
content: '',
onOk:
async () => {
axios({
url: '/jero-boot/split/sarFileSplitMenu/copyMenuNotChildren',
method: 'post',
data: params,
transformRequest: [function (data) {
// Do whatever you want to transform the data
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':this.token
}
})
.then( (res) => {
if(res.data.success){
this.$message.success(this.$t('OperationSuccessful'))
// this.loadData()
this.loadMenuData()
eventBUs.$emit('searchReset')
}else{
this.$message.warning(this.$t('operationFailed'))
}
})
},
onCancel() {},
});
},
//新增
handleAddManage(){
// console.log('this.menuId',this.menuId)
if(this.menuId){
this.formTitle=this.$t('add')
this.itemId=''
this.addVisible=true
this.$nextTick(() => {
this.$refs.splitForm.add()
})
}else{
this.$message.warning(this.$t('selectDirectoryTerms'))
}
},
closeVisible(val){
this.addVisible=val
},
//导入
handleImportManage(){
if(!this.menuId){
this.$message.warning(this.$t('selectDirectoryTerms'))
}
},
//上传成功
uploadSuccess(data){
let attIdList = []
if(data && data.length > 0){
data.forEach(item => {
attIdList.push(item.id || data.name)
})
this.attId = attIdList.join(',')
}
},
//导出
handleExportManage(){
let name = this.$t('DocumentSplitting')+'.zip'
let query = {
infoId:this.infoId,
exportName:'',
idList:this.selectedRowKeys.join(',')
}
downloadFile('split/sarFileSplitItems/exportSplitInfoZip', name, query)
},
//模板下载
handleDownManage(){
let name = this.$t('documentSplitTemplate')+'.xls'
downloadFile('split/sarFileSplitItems/exportTemplate',name, {})
},
//合并条款
handleMergeManage(){
if(this.selectedRowKeys&&this.selectedRowKeys.length<2){
this.$message.warning(this.$t('leastTwo'))
}else{
let ids = this.selectedRowKeys.join(',')
this.$confirm({
title: this.$t('mergeTerms'),
content: '',
onOk:
async () => {
axios({
url: '/jero-boot/split/sarFileSplitItems/batchMergeItems',
method: 'get',
params: {
ids:ids
},
headers: {
'X-Access-Token':this.token
}
})
.then( (res) => {
if (res.data.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.loadMenuData()
eventBUs.$emit('searchReset')
this.selectedRowKeys=[]
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(()=>{
})
// getAction(`split/sarFileSplitItems/batchMergeItems`, { ids: ids }).then(res => {
// if (res.success) {
// this.$message.success(this.$t('OperationSuccessful'))
//
// } else {
// this.$message.warning(this.$t('operationFailed'))
// }
// }).finally(()=>{
// this.selectedRowKeys=[]
// })
}
})
}
},
//批量设置
handleManage(){
this.ids = this.selectedRowKeys.join(',')
if(this.selectedRowKeys&&this.selectedRowKeys.length<1){
this.$message.warning(this.$t('selectLeastOne'))
}else {
// console.log('idsss',this.ids)
this.batSetVisible=true
}
},
//批量设置确定
modalOk(){
// this.confirmLoading=true
this.$refs.fileForm.sumber()
},
//批量设置取消
batSetCancel(){
this.batSetVisible=false
},
//批量设置确定提交
addFormClick(){
this.batSetVisible=false
},
//批量删除
handleBatCancel(){
let params={
ids:this.selecIds.join(',')
}
if(this.selecIds&&this.selecIds.length>0){
this.$confirm({
title: this.$t('ConfirmBatchDeletion'),
content: '',
onOk:
async () => {
axios({
url: '/jero-boot/split/sarFileSplitItems/batchDeleteItems',
method: 'post',
data: params,
transformRequest: [function (data) {
// Do whatever you want to transform the data
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':this.token
}
})
.then( (res) =>{
if (res.data.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.loadMenuData()
eventBUs.$emit('searchReset')
}else{
this.$message.warning(this.$t('operationFailed'))
}
})
.catch( (error) =>{
console.log(error);
});
// postAction(`split/sarFileSplitItems/batchDeleteItems`,params).then(res=> {
// if(res.success){
// this.$message.success(this.$t('OperationSuccessful'))
// // if(this.selecIds.length==this.tableData.length&&this.queryParams.pageNo!=1){
// // this.queryParams.pageNo=this.queryParams.pageNo-1
// // }
// // this.loadData()
// this.loadMenuData()
// eventBUs.$emit('searchReset')
// }else{
// this.$message.warning(this.$t('operationFailed'))
// }
// })
},
onCancel() {},
});
}else{
this.$message.warning(this.$t('selectLeastOne'))
}
},
//编辑
editClick(val){
this.formTitle=this.$t('edit')
this.itemVal=val
this.itemId=val.id
this.addVisible=true
this.$nextTick(() => {
this.$refs.splitForm.edit(val)
})
},
//保存成功
sumber(){
this.loadMenuData()
},
//删除
deleteClick(val){
let params={
ids:val.id
}
this.$confirm({
title: this.$t('ConfirmBatchDeletion'),
content: '',
onOk:
async () => {
axios({
url: '/jero-boot/split/sarFileSplitItems/batchDeleteItems',
method: 'post',
data: params,
transformRequest: [function (data) {
// Do whatever you want to transform the data
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':this.token
}
})
.then( (res) =>{
if (res.data.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.loadMenuData()
eventBUs.$emit('searchReset')
}else{
this.$message.warning(this.$t('operationFailed'))
}
})
.catch( (error) =>{
console.log(error);
});
// postAction(`split/sarFileSplitItems/batchDeleteItems`,params).then(res=> {
// if(res.success){
// this.$message.success(this.$t('OperationSuccessful'))
// // if(this.selecIds.length==this.tableData.length&&this.queryParams.pageNo!=1){
// // this.queryParams.pageNo=this.queryParams.pageNo-1
// // }
// // this.loadData()
// this.loadMenuData()
// eventBUs.$emit('searchReset')
// }else{
// this.$message.warning(this.$t('operationFailed'))
// }
// })
},
onCancel() {},
});
},
//选择框
onSelectChange(selectedRowKeys,rows) {
this.selectedRowKeys = selectedRowKeys;
this.selectedRows=rows
this.selecIds=selectedRowKeys
// console.log('rows',this.selectedRows)
},
//点击页数
onChangePage(page,pageSize){
this.queryParams.pageNo = page
this.loadData()
},
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo = 1
this.loadData()
},
onSearch() {
let self = this;
let tree = JSON.parse(JSON.stringify(this.data))
this.expandedKeys=[]
if (this.searchValue.trim() == "") {
this.gData=JSON.parse(JSON.stringify(this.data))
return;
}
if (tree && tree.length > 0) {
tree.forEach((n, i, a) => {
self.searchEach(n,this.searchValue);
});
// 没有叶子节点的根节点也要清理掉
let length = tree.length;
for (let i = length - 1; i >= 0; i--) {
let e2 = tree[i];
if (!this.isHasChildren(e2) && e2.title.indexOf(this.searchValue) <= -1) {
tree.splice(i, 1);
this.expandedKeys.push(e2.key)
}
}
this.gData=[...tree]
}
},
searchEach(node, value) {
let depth = this.getTreeDepth(node);
let self = this;
for (let i = 0; i < depth - 1; i++) {
let spliceCounter = 0;
this.traverseTree(node, n => {
if (self.isHasChildren(n)) {
let children = n.children;
let length = children.length;
for (let j = length - 1; j >= 0; j--) {
let e3 = children[j];
if (!self.isHasChildren(e3) && e3.title.indexOf(value) <= -1) {
children.splice(j, 1);
spliceCounter++;
}else{
this.expandedKeys.push(e3.key)
}
}
}
});
if (spliceCounter == 0) {
break;
}
}
},
// 判断树形结构中的一个节点是否具有孩子节点
isHasChildren(node){
let flag = false;
if (node.children && node.children.length > 0) {
flag = true;
}
return flag;
},
// 通过传入根节点获得树的深度
getTreeDepth(node){
if (undefined == node || null == node) {
return 0;
}
let r = 0;
let currentLevelNodes = [node];
while(currentLevelNodes.length > 0){
r++;
let nextLevelNodes = new Array();
for(let i = 0; i < currentLevelNodes.length; i++) {
let e = currentLevelNodes[i];
if (this.isHasChildren(e)) {
nextLevelNodes = nextLevelNodes.concat(e.children);
}
}
currentLevelNodes = nextLevelNodes;
}
return r;
},
traverseTree(node, callback) {
if (!node) {
return;
}
let stack = [];
stack.push(node);
let tmpNode;
while (stack.length > 0) {
tmpNode = stack.pop();
callback(tmpNode);
if (tmpNode.children && tmpNode.children.length > 0) {
for (let i = tmpNode.children.length - 1; i >= 0; i--) {
stack.push(tmpNode.children[i]);
}
}
}
},
//正则替换小数点
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 lang="less" scoped>
@import '~@assets/less/common.less';
.split-detail{
.split-detail-wrap{
display: flex;
justify-content: space-between;
.split-detail-left{
min-width: 260px;
padding-right: 20px;
border-right: 1px solid #666666;
.menu-item{
padding: 2px 8px;
border: 1px solid #000000;
border-bottom: none;
cursor: pointer;
}
.menu-bottom{
border-bottom: 1px solid #000000;
}
.menu-item:hover{
background: #00B3BE;
color: #ffffff;
}
}
.split-detail-right{
padding-left: 20px;
flex: 1;
.split-detail-search-header{
margin-bottom: 20px;
.table-page-search-submitButtons{
display: flex;
}
}
.split-detail-table{
.action-edit{
margin-right: 20px;
}
.content-show{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
height: 60px;
line-height: 20px;
white-space: pre-wrap;
}
.page{
text-align: right;
}
}
.split-item{
display: flex;
}
}
.page{
margin-top: 20px;
}
}
}
/deep/.ant-table-body{
overflow: hidden!important;
}
</style>
<style lang="less">
.split-item{
.ant-form-item-label{
min-width: 100px;
}
}
.add-menus{
.ant-modal-wrap{
.ant-modal-footer{
text-align: center;
}
}
}
.split-detail-right-wraper{
.table-page-search-submitButtons{
.ant-col-md-6{
display: flex;
}
}
.split-detail-search-header{
.ant-col-sm-8{
min-width: 300px;
}
}
.upload-split{
.ant-upload{
color:#040B29;
}
}
}
.show-setting{
.ant-modal{
min-width:700px;
}
.ant-modal-footer{
text-align: center;
}
}
</style>