Files
laws_weilai/jero-web/src/views/externalReports/index.vue
T
2022-08-10 17:35:32 +08:00

1389 lines
42 KiB
Java

<template>
<div class='mainItem'>
<div class="split-detail" @click="clearMenu" :style="'width:' + (fullWidth - 200) + 'px'">
<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
:selected-keys="selectedKeys"
:expanded-keys.sync="expandedKeys"
:auto-expand-parent="autoExpandParent"
:defaultExpandAll="true"
:tree-data="gData"
@expand="onExpand"
@rightClick="rightClick"
@select="onSelect"
>
<!-- @rightClick="rightClick"-->
<template #title="{ key: treeKey, title, record }">
<a-dropdown :trigger="['contextmenu']">
<!-- <span>{{ title }}</span>-->
<span v-if="title.indexOf(searchValue) >= -1 && title.length <= 18" :title="title"
class="expand-title">
{{ title.substr(0, title.indexOf(searchValue)) }}<span
style="color: #f50">{{ searchValue }}</span>{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
</span>
<span
v-else-if="title.indexOf(searchValue) >= -1 && title.length > 18 && title.indexOf(searchValue)>18"
:title="title">
{{title && title.length > 18?title.slice(0,17)+'...':title}}
</span>
<span
v-else-if="title.indexOf(searchValue) >= -1 && title.length > 18 && title.indexOf(searchValue)<=18"
:title="title">
{{ title.substr(0, title.indexOf(searchValue)) }}<span style="color: #f50">{{ title.indexOf(searchValue)+searchValue.length>18?searchValue.substr(0,18-title.indexOf(searchValue)) : searchValue }}</span>{{ title.indexOf(searchValue)+searchValue.length>18?'...': title.substr(title.indexOf(searchValue) + searchValue.length,18-title.indexOf(searchValue) - searchValue.length)+'...' }}
</span>
<span v-else :title="title">
{{title && title.length > 18?title.slice(0,17)+'...':title}}
</span>
<template #overlay >
<a-menu @click="({ key: menuKey }) => onContextMenuClick(treeKey, menuKey, record)">
<a-menu-item key="1" @click="orgAdd" v-has="'externalReports:folder'">{{$t('Addingfolder')}}</a-menu-item>
<a-menu-item key="4" @click="orgAdds" v-has="'externalReports:folder'" v-if="deleteNode">{{$t('Addingsubfolders')}}</a-menu-item>
<a-menu-item key="2" @click="orgEdit" v-has="'externalReports:folder'">{{$t('Editfolder')}}</a-menu-item>
<a-menu-item key="3" @click="orgDelete" v-has="'externalReports:folder'">{{$t('Deletefolders')}}</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</template>
</a-tree>
</div>
</div>
<div class="split-detail-right">
<div class="split-detail-right-wraper">
<div class="split-detail-search-header">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('fileName')">
<span>{{ $t('fileName') }}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('fileName')"
v-model="queryParams.fileName"></a-input>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('uploadedBy')">
<span>{{$t('uploadedBy')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('uploadedBy')"
v-model="queryParams.createBy"></a-input>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('uploadTime')">
<span>{{ $t('uploadTime') }}</span>
</div>
<!-- :placeholder="$t('PleaseSelect')+$t('uploadTime')"-->
<a-range-picker
class="box-input"
@change="onChange"
style='margin-left: -1px'
format="YYYY-MM-DD"
:getCalendarContainer="(trigger) => trigger.parentNode"
v-model="queryParams.time"
:disabled="false"/>
</div>
</a-col>
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<!-- <globalAdvancedQuery ref="globalAdvancedQueryRef"-->
<!-- @handleSuperQuery="handleSuperQuery"-->
<!-- :fieldList="fieldList"/>-->
<a-button class="box-button" type="primary" @click="searchQuery">{{ $t('query') }}</a-button>
<a-button class="box-button" style="margin-left: 8px"
@click="searchReset">{{ $t('reset') }}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<div class="table-operator" style="overflow:hidden;margin-bottom: 20px">
<div style="float: right;margin-bottom: 0px;margin-left: 20px">
<div class="operator-text" @click="handleuploadFile()" v-if='authmanage'>
<a-icon type="import"/>
{{ $t('UploadFile') }}
</div>
<div class="operator-text" @click="handleDel()" v-if='authmanage'>
<a-icon type="delete"/>
{{ $t('BatchDelete') }}
</div>
</div>
</div>
<div>
<!-- :scroll="{x: 10,y:'calc(100vh - 130px)'}"-->
<a-table
ref="table"
size="middle"
:loading="loading"
:pagination="false"
rowKey="id"
:scroll="{x: '100%',y:'calc(100vh - 180px)'}"
:data-source="dataSource"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
>
<span slot="projectName" slot-scope="text,record" :title="text">
{{ text && text.length > 15 ? text.slice(0, 14) + '...' : text }}
</span>
<span slot="fileName" slot-scope="text,record" :title="text">
{{ text && text.length > 15 ? text.slice(0, 14) + '...' : text }}
</span>
<span slot="operation" slot-scope="text,record">
<!-- <a class="text-operation" @click="handlelist(record)">{{$t('view')}}</a>-->
<a class="text-operation" @click="download(record)">{{$t('download')}}</a>
<a class="text-operation" @click="handleEdit(record)" v-if='authmanage'>{{$t('edit')}}</a>
<a class="text-operation" @click="batchDel(record)" v-if='authmanage'>{{$t('delete')}}</a>
</span>
</a-table>
</div>
<div class="page">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
:current="pageNo"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
<!-- 上传文件-->
<addModel ref="addModelRef" @addModelList="addModelList"/>
<!-- 文件详情-->
<handleModel :url="url" ref="handleModelRef" />
<!-- 添加节点-->
<a-modal
class="add-menus"
:title="menuTitle"
:width="600"
: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-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="$t('Foldername')">{{$t('Foldername')}}</span>
</div>
<a-form-model-item prop="folderName" style='width: 72%'>
<a-input v-model="form.folderName" :min="1" :max="100" style='width: 130%' class="box-input add-input" :placeholder="$t('PleaseEnter')+$t('Foldername')" />
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text"
:title="$t('Administrativeprivileges')">{{$t('Administrativeprivileges')}}</span>
</div>
<a-form-model-item class="itemModel" prop="authManageIdsName">
<PersonnelSelection class="box-input add-input"
:personneQuery="form"
:query="{db_field_name:'authManageIds',db_field_txt:$t('Administrativeprivileges')}"
@change="PersonnelSelectionChange"
v-model="form.authManageIdsName"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text"
:title="$t('Checkthepermissions')">{{$t('Checkthepermissions')}}</span>
</div>
<a-form-model-item class="itemModel" prop="authViewIdsName">
<PersonnelSelection
class="box-input add-input"
:personneQuery="form"
:query="{db_field_name:'authViewIds',db_field_txt:$t('Checkthepermissions')}"
@change="PersonnelSelectionChange"
v-model="form.authViewIdsName"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<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="$t('Folderorder')">{{$t('Folderorder')}}</span>
</div>
<a-form-model-item class="itemModel" prop="orderId">
<a-input-number v-model="form.orderId" :min="1" :max="9999" class="box-input add-input"
:placeholder="$t('PleaseEnter')+$t('Folderorder')" :formatter="limitNumber"
:parser="limitNumber" />
<!-- <a-input-number v-model="rowCount" :min="1" :placeholder="$t('pleaseEnter')+$t('numberRows')" :formatter="limitNumber" :parser="limitNumber" />-->
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-modal>
</div>
</div>
</div>
</a-card>
</div>
</div>
</template>
<script>
import addModel from './components/addModel'
import handleModel from './components/handle'
import { getAction, postAction, downloadFile, deleteAction,putAction } from '@/api/manage'
import globalAdvancedQuery from '@/components/globalAdvancedQuery/index'
// import exportTree from '@/components/exportTree/index'
import axios from 'axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
// import eventBUs from '../../../common/event'
import Vue from 'vue'
import moment from 'moment'
import eventBUs from '@/common/event'
import { mapGetters } from 'vuex'
import PersonnelSelection from '@/components/PersonnelSelection/index'
export default {
name: 'SplitDetail',
components: {
addModel,
handleModel,
PersonnelSelection,
globalAdvancedQuery
// ImportFile
},
data() {
return {
labelCol: { span: 6 },
userData: {},
wrapperCol: { span: 16 },
contentVisible: false, //条款内容弹框显示
queryParams: {
pageNo: 1,
pageSize: 10
},
pageSize: 10,
pageNo: 1,
disabled:false,
total: 0,
tableData: [],
selectedRowKeys: [],
dataSource: [],
selectedRows: [],
expandedKeys: [],
searchValue: '',
autoExpandParent: true,
dataList: [],
contentValue: '',
gData: [],
selecIds: [],
loading: false,
addVisible: false,
attId: '',
data: [],
confirmLoading: false,
NodeTreeItem: null, //右键菜单
tmpStyle: '', //右键菜单位置
menuTitle: this.$t('add'),
formTitle: '',
menuRightVisible: false,
form: {},
rules: {
folderName: [
{ required: true, message: this.$t('PleaseEnter') + this.$t('Foldername'), trigger: 'blur' },
{ min: 1, max: 100, message: this.$t('cantExeed') + '100' + this.$t('characters'), trigger: 'blur' }
],
// authManageIdsName: [
// { required: true, message: this.$t('PleaseSelect') + this.$t('Administrativeprivileges'), trigger: 'change' },
// ],
// authViewIdsName: [
// { required: true, message: this.$t('PleaseSelect') + this.$t('Checkthepermissions'), trigger: 'change' },
// ],
orderId: [
{ required: true, message: this.$t('PleaseEnter') + this.$t('Folderorder'), 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'
} //删除
],
columns: [
{
title: this.$t('fileName'),
align: 'center',
dataIndex: 'fileName',
scopedSlots: { customRender: 'fileName' },
width: 200
},
{
title: this.$t('fileDeclaration'),
align: 'center',
dataIndex: 'fileDescription',
scopedSlots: { customRender: 'projectName' },
width: 150
},
{
title: this.$t('uploadedBy'),
align: 'center',
dataIndex: 'createBy',
width: 150
},
// {
// title: this.$t('category'),
// align: 'center',
// dataIndex: 'category'
// },
{
title: this.$t('uploadTime'),
align: 'center',
dataIndex: 'createTime',
width: 250
},
{
title: this.$t('operation'),
align: 'center',
fixed: 'right',
width: 250,
scopedSlots: { customRender: 'operation' }
}
],
url: {
list: 'com.jero.modules.extRepo/extRepoData/page',
getSysCategoryTree: '/sys/category/getSysCategoryTree',
},
ids: '',
token: Vue.ls.get(ACCESS_TOKEN),
// upAccept:'.zip', //导入文件类型
uploadMenuId: '',
selectedKeys: [],
deleteNode: false,
authmanage:false,
fullWidth: '',
parameter: {},
widthBrown: '',
}
},
watch: {
deleteNode() {
},
screenWidth: {
immediate: true,
handler(newValue) {
// console.log(newValue)
}
}
},
computed: {},
mounted() {
const that = this
let client = ''
let width = ''
this.userData = this.userInfo()
// this.infoId = this.$route.query.infoId
// console.log('info', this.$route.query)
this.loadMenuData()
// this.loadData()
this.generateList(this.gData)
},
methods: {
...mapGetters(['userInfo']),
//显示条款内容弹框
showContent(val) {
this.contentVisible = true
this.contentValue = val
},
PersonnelSelectionChange(value, id) {
this.form[value] = id
this.form = { ...this.form }
console.log(this.form)
},
//关闭条款内容弹框
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) {
// console.log('expandedKeys',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(`extRepo/extRepoFolder/list`, {}).then(res => {
if (res.success) {
// this.data = this.toTree(res.result)
this.data = res.result
this.menuId = this.data[0].key
console.log(this.menuId)
let queryParam = {
supFolder: this.menuId
}
this.loadData(JSON.parse(JSON.stringify(queryParam)))
this.gData = [...this.data]
Object.assign(this, {
expandedKeys: this.expandedKeys,
autoExpandParent: true
})
}
}).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.title
// item.key = item.key
// item.title = item.title
// map[item.key] = item
// })
// let val = []
// config.forEach((item) => {
// // 以当前遍历项,的pid,去map对象中找到索引的id
// let parent = map[item.orderId]
// // 如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
// if (parent) {
// (parent.children || (parent.children = [])).push(item)
// } else {
// //如果没有在map中找到对应的索引ID,那么直接把 当前的item添加到 val结果集中,作为顶级
// val.push(item)
// }
// })
// return val
// },
//鼠标右键
rightClick({ event, node }) {
this.deleteNode = node._props.dataRef.level == 4 ? false : true
// console.log('eee',event,node)
// this.NodeTreeItemVisible=true
const x =
event.currentTarget.offsetLeft + event.currentTarget.clientWidth
const y = event.currentTarget.offsetTop
console.log(node._props.dataRef)
this.NodeTreeItem = {
pageX: x,
pageY: y,
authManageIdsName: node._props.dataRef.authManageIdsName,
authViewIds: node._props.dataRef.authViewIds,
key: node._props.dataRef.key,
authManageIds: node._props.dataRef.authManageIds,
authViewIdsName: node._props.dataRef.authViewIdsName,
title: node._props.dataRef.title,
folderName: node._props.dataRef.folderName,
orderId: node._props.dataRef.orderId,
}
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]
this.selectedKeys = selectedKeys
let queryParam = {
supFolder: this.menuId
}
this.parameter.supFolder = this.menuId
// eventBUs.$emit('searchQuery', JSON.parse(JSON.stringify(queryParam)))
this.searchQuery(JSON.parse(JSON.stringify(queryParam)))
// eventBUs.$emit('searchReset')
console.log('sele', this.menuId, selectedKeys)
// console.log('uploadMenuId',this.uploadMenuId)
},
//树形新增
orgAdd() {
this.menuTitle = this.$t('Addingfolder')
this.isEdit = false
this.form = {}
let supFolder = ''
this.supFolder = this.nodeItem.key
this.menuRightVisible = true
},
orgAdds(){
this.menuTitle = this.$t('Addingsubfolders')
this.isEdit = false
this.form = {}
let supFolder = ''
this.supFolder = this.nodeItem.key
this.menuRightVisible = true
},
//树形修改
orgEdit() {
this.menuTitle = this.$t('Editfolder')
this.isEdit = true
let supFolder = ''
this.form.id = this.nodeItem.key
this.form.authManageIds = this.nodeItem.authManageIds
this.form.authViewIds = this.nodeItem.authViewIds
this.form.authManageIdsName = this.nodeItem.authManageIdsName
this.form.authViewIdsName = this.nodeItem.authViewIdsName
this.form.folderName = this.nodeItem.folderName
this.form.orderId = this.nodeItem.orderId
this.menuRightVisible = true
},
//树形删除
orgDelete() {
this.$confirm({
content: this.$t('deleteNode'),
onOk:
async () => {
deleteAction(`extRepo/extRepoFolder/delete`, { id: this.nodeItem.key }).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loadMenuData()
let queryParam = {
supFolder: this.menuId
}
// eventBUs.$emit('searchQuery', JSON.parse(JSON.stringify(queryParam)))
this.searchQuery(JSON.parse(JSON.stringify(queryParam)))
// eventBUs.$emit('searchReset')
} else {
this.$message.warning(res.message)
}
})
}
})
},
onContextMenuClick(treeKey, menuKey) {
// console.log(`treeKey: ${treeKey}, menuKey: ${menuKey}`);
},
//清空按钮
resetSearch() {
this.menuId = ''
this.uploadMenuId = ''
this.selectedKeys = []
},
handleCancelMenuRight() {
this.menuRightVisible = false
this.$refs['ruleForm'].clearValidate()
},
//增加文件夹确定
hideModalMenuRight() {
if (!this.isEdit) {
let params = {
supFolder: this.supFolder,
...this.form
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
// console.log('parms',this.params)
if (!this.flag) {
this.flag = true
postAction(`extRepo/extRepoFolder/add`, params).then(res => {
if (res.success) {
this.menuRightVisible = false
this.$message.success(res.message)
// this.onExpand(expandId)
this.form = {}
this.expandedKeys.push(this.nodeItem.id)
// console.log('expandedKeys1111',this.expandedKeys)
this.loadMenuData()
let queryParam = {
supFolder: this.menuId
}
// eventBUs.$emit('searchQuery', JSON.parse(JSON.stringify(queryParam)))
this.searchQuery(JSON.parse(JSON.stringify(queryParam)))
// eventBUs.$emit('searchReset')
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.flag = false
this.menuRightVisible = false
})
}
}
})
} else {
let params = {
...this.form
}
if (!this.flag) {
this.flag = true
// console.log('parms',params)
putAction(`extRepo/extRepoFolder/edit`, params).then(res => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.form = {}
this.loadMenuData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.flag = false
this.menuRightVisible = false
})
}
}
},
pageOnChange(page, pageSize) {
this.queryParams.pageNo = page
this.loadData()
},
addModelList() {
this.pageNo = 1
let queryParam = {
supFolder: this.menuId
}
this.loadData(JSON.parse(JSON.stringify(queryParam)))
},
//获取列表数据
loadData(item) {
this.queryParams.supFolder = this.menuId
let params = {
...this.queryParams,
...item,
}
this.loading = true
getAction(this.url.list, params).then(res => {
if (res.success) {
this.dataSource = res.result.pageList.records || []
this.authmanage =res.result.auth_manage
this.total = res.result.pageList.total
this.loading = false
}
})
},
//搜索
searchQuery(item) {
this.pageNo = 1
if(this.queryParams.time){
this.queryParams.time = this.queryParams.time.join(',')
}
this.loadData(item)
},
//清空
searchReset() {
this.queryParams = {
pageNo: 1,
pageSize: 10
}
this.loadData()
},
//新增
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, status) {
// console.log('data111',data)
if (status === 'success') {
let queryParam = {
supFolder: this.menuId
}
this.loadMenuData()
// eventBUs.$emit('searchQuery', JSON.parse(JSON.stringify(queryParam)))
this.searchQuery(JSON.parse(JSON.stringify(queryParam)))
}
let attIdList = []
if (data && data.length > 0) {
data.forEach(item => {
attIdList.push(item.id || data.name)
})
this.attId = attIdList.join(',')
// eventBUs.$emit('searchReset')
}
},
queryParamsValues(search) {
Object.keys(search).forEach(res => {
if (search[res] instanceof Array) {
search[res] = search[res].join(',')
}
})
this.parameter = search
this.parameter.info_id = this.infoId
this.parameter.menu_id = this.menuId
},
onChange(value,dateString){
if (this.queryParams.time && this.queryParams.time.length > 0) {
let dateOne = moment(dateString[0]).format('YYYY-MM-DD')
let dateTwo = moment(dateString[1]).format('YYYY-MM-DD')
this.queryParams.time = [dateOne, dateTwo]
} else {
this.queryParams.time = []
// this.queryParamOne[item + '_name'] = []
}
},
selectClear() {
this.$refs.splitDetailTabel.selectedRowKeys = []
this.selectedRowKeys = []
this.selectedRows = []
this.selecIds = []
},
//查看
handlelist(){
this.$refs.handleModelRef.addModel()
},
//编辑
handleEdit(item) {
this.$refs.addModelRef.editModel(JSON.parse(JSON.stringify(item)))
},
//下载
download(item){
let query = {
id: item.fileKey
}
downloadFile('/sys/common/downLoadFile', item.fileName, query, this.Deselect)
},
//删除
batchDel(val) {
console.log(this.menuId)
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
let queryParam = {
supFolder: _this.menuId
}
deleteAction('com.jero.modules.extRepo/extRepoData/delete', { id: val.id }).then((res) => {
if (res.success) {
_this.$message.success(res.message)
_this.loadData(JSON.parse(JSON.stringify(queryParam)))
} else {
_this.$message.warning(res.message)
}
})
}
})
},
//批量删除
handleDel() {
if (this.selectedRowKeys.length > 0) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
let idList = JSON.parse(JSON.stringify(_this.selectedRowKeys))
let queryParam = {
supFolder: _this.menuId
}
deleteAction('com.jero.modules.extRepo/extRepoData/deleteBatch', { ids: idList.join(',') }).then((res) => {
if (res.success) {
_this.$message.success(res.message)
_this.selectedRowKeys = []
_this.loadData(JSON.parse(JSON.stringify(queryParam)))
} else {
_this.$message.warning(res.message)
}
})
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
//保存成功
sumber() {
this.loadMenuData()
},
//选择框
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()
},
// 上传文件
handleuploadFile(e) {
if (this.menuId) {
this.$refs.addModelRef.addModel(this.menuId)
} else {
this.$message.warning(this.$t('selectDirectorylocation'))
}
},
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
}
}
},
beforeDestroy() {
window.removeEventListener('resize', {}, false)
}
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
/deep/.ant-table td{
white-space: nowrap;
}
.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: 48px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.add-input {
width: 82%;
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
.text-operation {
margin-right: 8px;
}
.page {
text-align: right;
margin-top: 20px;
}
.box-title-text-add {
line-height: 1.4;
display: flex;
}
.title-text-add {
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;
margin-top: 3px;
}
.box-input-add {
display: inline-block;
height: 38px;
width: 100%;
}
.Required {
color: red;
margin-right: 4px;
}
.split-detail {
/*height: 100% !important;*/
.split-detail-wrap {
/*display: flex;*/
/*justify-content: space-between;*/
.split-detail-left {
/*height: 100%;*/
width: 300px;
float: left;
padding-right: 20px;
/*border-right: 1px solid #E6E7EC;*/
overflow-y: auto;
.split-detail-left-tree {
}
.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;
width: calc(100% - 300px);
float: right;
border-left: 1px solid #E6E7EC;
/*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;
}
.ant-select-selection--multiple {
ul {
height: 36px;
overflow-y: auto;
}
}
}
.upload-split {
.ant-upload {
color: #040B29;
}
.anticon-import {
display: inline-block;
margin-right: 3px !important;
}
}
}
.show-setting {
.ant-modal {
min-width: 700px;
}
.ant-select-dropdown--multiple {
max-height: 39vh !important;
}
.ant-modal-body {
overflow-y: visible !important;
}
.ant-modal-footer {
text-align: center;
}
}
.split-detail-left {
.ant-tree-node-content-wrapper-normal {
}
ant-tree-node-content-wrapper {
.expand-title {
}
}
.ant-tree-title {
span {
//display: block;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
}
}
.ant-tree-child-tree {
.ant-tree-title {
span {
//display: block;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
.ant-modal-body {
max-height: 500px;
overflow-y: auto;
}
.split-detail-table {
.ant-table-body {
overflow: auto !important;
}
}
.item-content-show {
.wordImg {
width: 40px;
height: auto;
}
}
@media screen and (min-width: 600px) and (max-width: 1600px) {
.operator-text {
margin-right: 20px !important;
}
/*.title-text {*/
/* min-width: 73px !important;*/
/*}*/
/*.split-detail-wrap {*/
/* height: 481px !important;*/
/*}*/
/*.mainItem {*/
/* height: 500px;*/
/*}*/
}
@media screen and (min-width: 1600px) and (max-width: 2000px) {
/*.split-detail .split-detail-wrap .split-detail-left {*/
/* height: 735px !important;*/
/*}*/
/*.mainItem {*/
/* height: 800px !important;*/
/*}*/
}
</style>