693 lines
28 KiB
Vue
693 lines
28 KiB
Vue
<template>
|
|
<a-card :bordered="false" class="page-left-right-layout">
|
|
<div class="page-left-box">
|
|
<a-input-search v-model="treeInput"
|
|
class="tree-search"
|
|
:placeholder="$t('pleaseEnterTreeSystem')"
|
|
@search="handleTreeSearch" />
|
|
<div class="page-tree-box page-tree-box-has-search">
|
|
<a-spin :spinning="treeLoading">
|
|
<a-tree
|
|
v-if="treeData.length > 0"
|
|
:show-line="true"
|
|
:show-icon="true"
|
|
:tree-data="treeData"
|
|
:selectedKeys="currentTreeNode"
|
|
:default-expand-all="defaultExpandAll">
|
|
<template #title="record">
|
|
<div class="tree-operate-node"
|
|
@mouseenter="handleTreeMouseover(record.key)"
|
|
@mouseleave="handleTreeMouseout(record.key)"
|
|
@click="treeSelect(record)">
|
|
<a-icon class="parent-node-icon" type="folder" v-if="record.dataRef.children && record.dataRef.children.length > 0" />
|
|
<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 || record.key === 'myCollect'}">
|
|
<!-- 新增 -->
|
|
<a-button icon="plus" class="tree-operate-node-btn" v-has="'enterpriseStandard:tree:add'"
|
|
@click="handleTreeAdd(record)"></a-button>
|
|
<!-- 编辑 -->
|
|
<a-button v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value"
|
|
v-has="'enterpriseStandard:tree:edit'"
|
|
class="tree-operate-node-btn" @click="handleTreeEdit(record)">
|
|
<i class="iconfont icon-bianji"></i>
|
|
</a-button>
|
|
<!-- 删除 -->
|
|
<a-button v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value"
|
|
v-has="'enterpriseStandard:tree:delete'"
|
|
class="tree-operate-node-btn" @click="handleTreeDelete(record.id)">
|
|
<i class="iconfont icon-shanchu_"></i>
|
|
</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"
|
|
:flag="flag"
|
|
:get-query-condition-func="getQueryConditionFunc"
|
|
search-has="enterpriseStandard:search"
|
|
@search="searchQuery"
|
|
@reset="searchReset" />
|
|
</div>
|
|
<div class="table-operator">
|
|
<!-- 新增 -->
|
|
<a-button icon="plus" type="primary" @click="handleAdd" v-has="'enterpriseStandard:add'">{{ $t('newlyAdded') }}</a-button>
|
|
<!-- 导入 -->
|
|
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
|
<a-button icon="upload" type="primary" ghost v-has="'enterpriseStandard:upload'">{{ $t('import') }}</a-button>
|
|
</a-upload>
|
|
<!-- 导出 -->
|
|
<a-button icon="export" type="primary" ghost @click="handleExportXls($t('enterpriseStandardLibrary.standard.exportExcelFile'))" v-has="'enterpriseStandard:export'">{{ $t('export') }}</a-button>
|
|
<!-- 带文件导出 -->
|
|
<a-button icon="mail" type="primary" ghost @click="handleFileExport($t('enterpriseStandardLibrary.standard.exportZipFile'))" v-has="'enterpriseStandard:fileExport'">{{ $t('exportWithFile') }}</a-button>
|
|
<!-- 模板下载 -->
|
|
<a-button icon="download" type="primary" ghost @click="downTemplate($t('enterpriseStandardLibrary.standard.templateExport'))" v-has="'enterpriseStandard:templateDownload'">{{ $t('templateDownload') }}</a-button>
|
|
<!-- 批量删除 -->
|
|
<a-button icon="delete" type="primary" ghost @click="batchDel" v-has="'enterpriseStandard:batchDel'">{{ $t('batchDelete') }}</a-button>
|
|
<!-- 配置标准 -->
|
|
<a-button icon="setting" type="primary" ghost @click="handleAllocationStandard" v-has="'enterpriseStandard:allocationStandard'">{{ $t('enterpriseStandardLibrary.standard.allocationStandard') }}</a-button>
|
|
<!-- 移出标准 -->
|
|
<a-button icon="minus-circle" type="primary" ghost @click="handleShiftOutStandard" v-has="'enterpriseStandard:shiftOutStandard'">{{ $t('enterpriseStandardLibrary.standard.shiftOutStandard') }}</a-button>
|
|
<!-- 发起更改 -->
|
|
<a-button icon="setting" type="primary" ghost @click="handleInitChange" v-has="'enterpriseStandard:initChange'">{{ $t('enterpriseStandardLibrary.standard.initChange') }}</a-button>
|
|
<!-- 临时权限设置 -->
|
|
<a-button icon="setting" type="primary" ghost @click="handleTemporaryPermissSet" v-has="'enterpriseStandard:temporaryPermissSet'">{{ $t('enterpriseStandardLibrary.standard.temporaryPermissionSet') }}</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%'}"
|
|
:loading="loading"
|
|
@change="tableOnChange">
|
|
<!-- 在混入里已经过滤过没有权限的按钮了 -->
|
|
<template slot="operation" slot-scope="{text, record}">
|
|
<!-- 有编辑删除权限 -->
|
|
<template v-if="record.editFlag">
|
|
<a v-for="(operation, index) in operationList.slice(0, operateMaxNum)" :key="index" @click="operationClick(operation,record)">
|
|
<template v-if="operation.text === $t('enterpriseStandardLibrary.standard.collection')">
|
|
<i class="iconfont icon-star1" v-show="record.collectionFlag" />
|
|
<i class="iconfont icon-star" v-show="!record.collectionFlag" />
|
|
</template>
|
|
</a>
|
|
<a-divider v-if="operationList.length >= operateMaxNum" type="vertical" />
|
|
<a-dropdown v-if="operationList.length >= operateMaxNum" placement="bottomCenter">
|
|
<a-icon type="more" class="operate-icon-btn operate-icon-more" />
|
|
<a-menu slot="overlay">
|
|
<!-- 有删除权限 -->
|
|
<template v-if="record.del_flag">
|
|
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index">
|
|
<a @click="operationClick(operation,record)">
|
|
<!-- 编辑图标 -->
|
|
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
|
|
<!-- 分享图标 -->
|
|
<i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operation.text === $t('share')" />
|
|
<!-- 删除图标 -->
|
|
<i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operation.text === $t('delete')" />
|
|
{{ operation.text }}
|
|
</a>
|
|
</a-menu-item>
|
|
</template>
|
|
<!-- 没有删除权限 -->
|
|
<template v-else>
|
|
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum).filter(item => item.text !== $t('delete'))" :key="index">
|
|
<a @click="operationClick(operation,record)">
|
|
<!-- 编辑图标 -->
|
|
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
|
|
<!-- 分享图标 -->
|
|
<i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operation.text === $t('share')" />
|
|
{{ operation.text }}
|
|
</a>
|
|
</a-menu-item>
|
|
</template>
|
|
</a-menu>
|
|
</a-dropdown>
|
|
</template>
|
|
<!-- 没有编辑删除权限 -->
|
|
<template v-else>
|
|
<template v-if="operationList.find(item => item.text === $t('enterpriseStandardLibrary.standard.collection'))">
|
|
<a @click="operationClick(operationList.find(item => item.text === $t('enterpriseStandardLibrary.standard.collection')),record)">
|
|
<i class="iconfont icon-star1" v-show="record.collectionFlag" />
|
|
<i class="iconfont icon-star" v-show="!record.collectionFlag" />
|
|
</a>
|
|
</template>
|
|
<a-divider v-if="operationList.find(item => item.text === $t('share')) &&
|
|
operationList.find(item => item.text === $t('enterpriseStandardLibrary.standard.collection'))"
|
|
type="vertical" />
|
|
<template v-if="operationList.find(item => item.text === $t('share'))">
|
|
<template v-for="(operation, index) in operationList.slice(operateMaxNum)">
|
|
<a :key="index" @click="operationClick(operation,record)" v-if="operation.text === $t('share')">
|
|
<!-- 分享图标 -->
|
|
<i class="iconfont icon-fangxingfenxiang operate-btn-icon" />{{ operation.text }}
|
|
</a>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
|
|
<!-- 企标编号 -->
|
|
<template v-slot:standard_number="{text, record}">
|
|
<a-tooltip overlay-class-name="tooltip-style">
|
|
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
|
|
<a class="link-a" @click="detailClick(record)" v-if="(text || text === 0) && record.detailFlag">{{ text }}</a>
|
|
<div class="table-text" v-else-if="(text || text === 0) && !record.detailFlag">{{ text }}</div>
|
|
<div class="table-text" v-else>{{ global.emptyLine }}</div>
|
|
</a-tooltip>
|
|
</template>
|
|
|
|
<!-- 企标名称 -->
|
|
<template v-slot:standard_name="{text, record}">
|
|
<a-tooltip overlay-class-name="tooltip-style">
|
|
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
|
|
<a class="link-a" @click="detailClick(record)" v-if="(text || text === 0) && record.detailFlag">{{ text }}</a>
|
|
<div class="table-text" v-else-if="(text || text === 0) && !record.detailFlag">{{ text }}</div>
|
|
<div class="table-text" v-else>{{ global.emptyLine }}</div>
|
|
</a-tooltip>
|
|
</template>
|
|
|
|
</j-table>
|
|
</div>
|
|
</div>
|
|
<!-- 新增、编辑弹框 -->
|
|
<enterprise-standard-modal ref="modalForm" @ok="modalFormOk"></enterprise-standard-modal>
|
|
<!-- 配置标准-标准选择弹框 -->
|
|
<allocation-standard-drawer ref="allocationStandardDrawer" @ok="modalOkDoNotRefreshTree"></allocation-standard-drawer>
|
|
<!-- 临时权限设置 -->
|
|
<temporary-permission-set ref="temporaryPermissionSet" @ok="modalFormOk"></temporary-permission-set>
|
|
<!-- 左侧树节点的新增和编辑 -->
|
|
<tree-node-modal ref="treeNodeModal" @ok="treeNodeModalOk"></tree-node-modal>
|
|
<!-- 分享需要选人 -->
|
|
<user-select-modal ref="userSelectModal" type="checkbox" @change="userSelectChange"></user-select-modal>
|
|
</a-card>
|
|
</template>
|
|
|
|
<script>
|
|
import { StandardSystemTreeNodeType } from '@/enums/commonEnums'
|
|
import JTable from '@/components/jero/JTable'
|
|
// 搜索组件
|
|
import Search from '@/components/customField/Search'
|
|
import { ConfigurableTableMixin } from '@/mixins/ConfigurableTableMixin'
|
|
import {
|
|
getTreeList,
|
|
getEnterpriseStandardTableHeader,
|
|
getEnterpriseStandardSearchForm,
|
|
shiftStandard,
|
|
initChange,
|
|
collectStandard,
|
|
cancelCollectStandard,
|
|
shareStandard,
|
|
deleteTreeNode
|
|
} from '@api/enterpriseStandardLibraryApi'
|
|
// 添加、编辑弹框
|
|
import EnterpriseStandardModal from './modules/EnterpriseStandardModal'
|
|
// 临时权限设置
|
|
import TemporaryPermissionSet from './modules/TemporaryPermissionSet'
|
|
import TreeNodeModal from './modules/TreeNodeModal'
|
|
import UserSelectModal from '../../../components/selection/UserSelectModal'
|
|
// 配置标准弹框
|
|
import AllocationStandardDrawer from './modules/AllocationStandardDrawer'
|
|
import { postDownFile, downloadFile, postAction } from '@/api/manage'
|
|
|
|
export default {
|
|
name: 'EnterpriseStandardList',
|
|
components: { AllocationStandardDrawer, UserSelectModal, TreeNodeModal, TemporaryPermissionSet, EnterpriseStandardModal, JTable, Search },
|
|
mixins: [ConfigurableTableMixin],
|
|
data () {
|
|
return {
|
|
StandardSystemTreeNodeType,
|
|
flag: '3',
|
|
treeInput: '', // 左侧树搜索框内容
|
|
treeData: [], // 左侧树数据
|
|
treeLoading: false,
|
|
collectionFlag: false,
|
|
defaultExpandAll: false, // 左侧树默认展开所有
|
|
currentTreeNode: null, // 当前选中的树节点key值
|
|
currentTreeNodeCode: null, // 当前选中的树节点的code值
|
|
mouseInNodeKey: null, // 鼠标悬浮的节点key值
|
|
operationList: [
|
|
{ // 收藏
|
|
text: this.$t('enterpriseStandardLibrary.standard.collection'),
|
|
clickEvent: 'handleCollection',
|
|
has: 'enterpriseStandard:collection'
|
|
},
|
|
{ // 编辑
|
|
text: this.$t('edit'),
|
|
clickEvent: 'handleEdit',
|
|
has: 'enterpriseStandard:edit'
|
|
},
|
|
{ // 分享
|
|
text: this.$t('share'),
|
|
clickEvent: 'handleShare',
|
|
has: 'enterpriseStandard:share'
|
|
},
|
|
{ // 删除
|
|
text: this.$t('delete'),
|
|
clickEvent: 'handleDelete',
|
|
has: 'enterpriseStandard:delete'
|
|
}
|
|
],
|
|
selectedRowKeys: [],
|
|
loading: false,
|
|
getTableHeaderFunc: getEnterpriseStandardTableHeader,
|
|
getQueryConditionFunc: getEnterpriseStandardSearchForm,
|
|
tableSlotField: ['standard_number', 'standard_name'], // 表格中需要插槽的字段
|
|
// url传参严格按照当前命名
|
|
url: {
|
|
list: '/laws/standard/enterprise/getCommonPage', // 表格数据
|
|
delete: '/laws/standard/enterprise/singleDelete', // 删除
|
|
deleteBatch: '/laws/standard/enterprise/deleteByIdsAndModule', // 批量删除
|
|
importUrl: '/laws/standard/enterprise/importExcelWithData', // 导入
|
|
exportXlsUrl: '/laws/standard/enterprise/exportData', // 导出
|
|
exportZipUrl: '/laws/standard/enterprise/exportDataWithFile', // 带文件导出
|
|
downTemplateUrl: '/laws/standard/enterprise/templateDownload' // 下载导入模板
|
|
},
|
|
showAction: true, // 是否显示操作列
|
|
currentShare: {}
|
|
}
|
|
},
|
|
mounted () {
|
|
this.initTreeData()
|
|
},
|
|
methods: {
|
|
// 获取左侧树数据
|
|
initTreeData (params) {
|
|
this.treeLoading = true
|
|
getTreeList(params).then(res => {
|
|
this.treeData = []
|
|
this.currentTreeNode = []
|
|
this.currentTreeNodeCode = []
|
|
this.filters.nodeCode = null
|
|
if (res.success) {
|
|
this.treeData = res.result || []
|
|
} else {
|
|
this.treeData = []
|
|
}
|
|
}).finally(() => {
|
|
this.$nextTick(() => {
|
|
this.defaultExpandAll = true
|
|
})
|
|
this.treeLoading = false
|
|
})
|
|
},
|
|
// 左侧树搜索
|
|
handleTreeSearch () {
|
|
this.treeData = []
|
|
this.initTreeData({ nodeName: this.treeInput })
|
|
},
|
|
// 左侧树点击选中
|
|
treeSelect ({ dataRef }) {
|
|
this.currentTreeNode = [dataRef.key]
|
|
this.currentTreeNodeCode = [dataRef.nodeCode]
|
|
this.filters.nodeCode = dataRef.nodeCode
|
|
this.loadData(1)
|
|
},
|
|
// 左侧树点击新增
|
|
handleTreeAdd (record) {
|
|
this.$refs.treeNodeModal.title = this.$t('newlyAdded')
|
|
this.$refs.treeNodeModal.add(record)
|
|
},
|
|
// 左侧树点击编辑
|
|
handleTreeEdit (record) {
|
|
console.log(record)
|
|
this.$refs.treeNodeModal.title = this.$t('edit')
|
|
this.$refs.treeNodeModal.edit(record)
|
|
},
|
|
// 左侧树点击删除
|
|
handleTreeDelete (id) {
|
|
const param = {}
|
|
param.id = id
|
|
this.$confirm({
|
|
title: this.$t('confirmDeletion'),
|
|
content: this.$t('confirmDeleteNodes'),
|
|
onOk: () => {
|
|
deleteTreeNode(param).then(res => {
|
|
if (res.success) {
|
|
this.$message.success(res.message)
|
|
this.initTreeData()
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 左侧树节点新增或编辑完成
|
|
treeNodeModalOk () {
|
|
this.initTreeData()
|
|
},
|
|
// 左侧树鼠标移入某一目录
|
|
handleTreeMouseover (key) {
|
|
this.mouseInNodeKey = key
|
|
},
|
|
// 左侧树鼠标移出某一目录
|
|
handleTreeMouseout (key) {
|
|
if (this.mouseInNodeKey === key) {
|
|
this.mouseInNodeKey = null
|
|
}
|
|
},
|
|
/**
|
|
* 重置查询
|
|
*/
|
|
searchReset () {
|
|
this.currentTreeNode = null
|
|
this.searchParams = {}
|
|
this.selectedRowKeys = []
|
|
delete this.filters.nodeCode
|
|
this.getTableHeader()
|
|
this.loadData()
|
|
},
|
|
// 导出改成用post
|
|
handleExportXls (fileName) {
|
|
if (!fileName || typeof fileName !== 'string') {
|
|
fileName = '导出文件'
|
|
}
|
|
const param = this.getQueryParams()
|
|
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
|
|
param.selections = this.selectedRowKeys.join(',')
|
|
}
|
|
console.log('导出参数', param)
|
|
// 加一个大的提示
|
|
const modalLoading = this.$info({
|
|
title: '提示',
|
|
content: <span>正在导出,请稍候 <a-spin size="small" /></span>,
|
|
keyboard: false
|
|
})
|
|
// 把知道了这个按钮去掉
|
|
this.$nextTick(() => {
|
|
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
|
|
})
|
|
postDownFile(this.url.exportXlsUrl, param).then((data) => {
|
|
if (!data) {
|
|
this.$message.warning('文件下载失败')
|
|
return
|
|
}
|
|
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
|
|
} 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 + '.xlsx')
|
|
document.body.appendChild(link)
|
|
link.click()
|
|
document.body.removeChild(link) // 下载完成移除元素
|
|
window.URL.revokeObjectURL(url) // 释放掉blob对象
|
|
}
|
|
}).finally(() => {
|
|
// 销毁这个提示
|
|
modalLoading.destroy()
|
|
})
|
|
},
|
|
// 带文件导出
|
|
handleFileExport (fileName) {
|
|
if (!fileName || typeof fileName !== 'string') {
|
|
fileName = '导出文件'
|
|
}
|
|
const param = this.getQueryParams()
|
|
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
|
|
param.selections = this.selectedRowKeys.join(',')
|
|
}
|
|
console.log('导出参数', param)
|
|
// 加一个大的提示
|
|
const modalLoading = this.$info({
|
|
title: '提示',
|
|
content: <span>正在导出,请稍候 <a-spin size="small" /></span>,
|
|
keyboard: false
|
|
})
|
|
// 把知道了这个按钮去掉
|
|
this.$nextTick(() => {
|
|
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
|
|
})
|
|
postDownFile(this.url.exportZipUrl, param).then((data) => {
|
|
if (!data) {
|
|
this.$message.warning('文件下载失败')
|
|
}
|
|
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
window.navigator.msSaveBlob(new Blob([data]), fileName + '.zip')
|
|
} else {
|
|
const url = window.URL.createObjectURL(new Blob([data]))
|
|
const link = document.createElement('a')
|
|
link.style.display = 'none'
|
|
link.href = url
|
|
link.setAttribute('download', fileName + '.zip')
|
|
document.body.appendChild(link)
|
|
link.click()
|
|
document.body.removeChild(link) // 下载完成移除元素
|
|
window.URL.revokeObjectURL(url) // 释放掉blob对象
|
|
}
|
|
// }
|
|
}).finally(() => {
|
|
// 销毁这个提示
|
|
modalLoading.destroy()
|
|
})
|
|
},
|
|
// 下载导入模板
|
|
downTemplate (fileName) {
|
|
if (!fileName || typeof fileName !== 'string') {
|
|
fileName = '模板文件'
|
|
}
|
|
downloadFile(this.url.downTemplateUrl, fileName + '.zip')
|
|
},
|
|
/**
|
|
* 批量删除
|
|
*/
|
|
batchDel () {
|
|
if (this.selectedRowKeys.length <= 0) {
|
|
this.$message.warning(this.$t('selectARecord'))
|
|
return
|
|
}
|
|
console.log(this.selectionRows)
|
|
if (this.selectionRows.find(item => !item.editFlag)) {
|
|
// 有没有查看权限的数据
|
|
this.$message.warning(this.$t('enterpriseStandardLibrary.standard.disabledBatchDel'))
|
|
return
|
|
}
|
|
const ids = this.selectedRowKeys.join(',')
|
|
this.$confirm({
|
|
title: this.$t('confirmBatchDeletion'),
|
|
content: this.$t('deleteAData'),
|
|
onOk: () => {
|
|
this.loading = true
|
|
postAction(this.url.deleteBatch, { ids: ids }).then((res) => {
|
|
if (res.success) {
|
|
// 重新计算分页问题
|
|
this.reCalculatePage(this.selectedRowKeys.length)
|
|
this.$message.success(res.message)
|
|
this.loadData()
|
|
this.onClearSelected()
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 配置标准
|
|
handleAllocationStandard () {
|
|
console.log(this.currentTreeNode)
|
|
// 没选择左侧树节点,需要提示“请先选择二级及以下体系”
|
|
if (!this.currentTreeNode || this.currentTreeNode.length === 0 ||
|
|
this.currentTreeNode.includes('myCollect') || this.currentTreeNode.includes('adb15f66ce174f7295ab51fbc39c15b8')) {
|
|
this.$message.warn(this.$t('enterpriseStandardLibrary.standard.pleaseSelectLeastOneNode'))
|
|
return
|
|
}
|
|
this.$refs.allocationStandardDrawer.open(this.currentTreeNodeCode[0])
|
|
},
|
|
// 移出标准
|
|
handleShiftOutStandard () {
|
|
// 没选择左侧树节点,需要提示“请先选择左侧体系”
|
|
if (!this.currentTreeNode || this.currentTreeNode.length === 0 ||
|
|
this.currentTreeNode.includes('myCollect') || this.currentTreeNode.includes('adb15f66ce174f7295ab51fbc39c15b8')) {
|
|
this.$message.warn(this.$t('enterpriseStandardLibrary.standard.pleaseSelectLeastOneNode'))
|
|
return
|
|
}
|
|
// 左侧节点选的是我的收藏,不可移出标准
|
|
if (this.currentTreeNode[0] === 'myCollect') {
|
|
this.$message.warn(this.$t('enterpriseStandardLibrary.standard.myCollectNotRemove'))
|
|
return
|
|
}
|
|
// 没有选择列表数据,需要提示“选中至少一条列表数据”
|
|
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
|
|
this.$message.warning(this.$t('selectAtLeastOne'))
|
|
return
|
|
}
|
|
this.loading = true
|
|
const params = {
|
|
nodeCode: this.currentTreeNodeCode[0],
|
|
ids: this.selectedRowKeys.join(',')
|
|
}
|
|
shiftStandard(params).then(res => {
|
|
if (res.success) {
|
|
this.$message.success(res.message)
|
|
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
|
|
if (this.ipagination.current > 1 && ((this.ipagination.current - 1) * this.ipagination.pageSize) + 1 === this.ipagination.total) {
|
|
this.ipagination.current -= 1
|
|
}
|
|
this.modalOkDoNotRefreshTree()
|
|
} else {
|
|
this.$message.warn(res.message)
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
// 发起更改
|
|
handleInitChange () {
|
|
// 没有选择列表数据,需要提示“选中至少一条列表数据”
|
|
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
|
|
this.$message.warning(this.$t('selectLeastOne'))
|
|
return
|
|
}
|
|
this.loading = true
|
|
const params = {
|
|
ids: this.selectedRowKeys.join(',')
|
|
}
|
|
initChange(params).then(res => {
|
|
if (res.success) {
|
|
this.$message.success(res.message)
|
|
this.modalFormOk()
|
|
} else {
|
|
this.$message.warn(res.message)
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
// 临时权限设置
|
|
handleTemporaryPermissSet () {
|
|
// 没有选择列表数据,需要提示“选中至少一条列表数据”
|
|
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
|
|
this.$message.warning(this.$t('selectLeastOne'))
|
|
return
|
|
}
|
|
const notPremissData = this.selectionRows.filter(item => !item.detailFlag).map(item => item.standard_number)
|
|
if (notPremissData && notPremissData.length > 0) {
|
|
// 选中数据存在没有查看权限的数据
|
|
this.$message.warning(this.$t('enterpriseStandardLibrary.standard.youNot') +
|
|
notPremissData.join(',') + this.$t('enterpriseStandardLibrary.standard.dataPremissReCheck'))
|
|
return
|
|
}
|
|
this.$refs.temporaryPermissionSet.open(this.selectedRowKeys.join(','))
|
|
},
|
|
// 操作栏的点击
|
|
operationClick (operation, record) {
|
|
if (operation.clickEvent === 'handleDelete') {
|
|
this.handleDelete(record.id)
|
|
} else {
|
|
this[operation.clickEvent](record)
|
|
}
|
|
},
|
|
// 收藏
|
|
handleCollection (record) {
|
|
if (this.collectionFlag || this.loading) {
|
|
return
|
|
}
|
|
this.collectionFlag = true
|
|
if (record.collectionFlag) {
|
|
const params = {}
|
|
params.id = record.id
|
|
// 说明已收藏,调取消收藏接口
|
|
cancelCollectStandard(params).then(res => {
|
|
if (res.success) {
|
|
this.$message.success(res.message)
|
|
this.loadData()
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
}).finally(() => {
|
|
this.collectionFlag = false
|
|
})
|
|
} else {
|
|
const params = {}
|
|
params.standardId = record.id
|
|
params.standardNumber = record.standard_number
|
|
collectStandard(params).then(res => {
|
|
if (res.success) {
|
|
this.$message.success(res.message)
|
|
this.loadData()
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
}).finally(() => {
|
|
this.collectionFlag = false
|
|
})
|
|
}
|
|
},
|
|
// 分享
|
|
handleShare (record) {
|
|
this.currentShare = record
|
|
this.$refs.userSelectModal.open()
|
|
},
|
|
// 分享选完人的回调
|
|
userSelectChange (value) {
|
|
const params = {}
|
|
params.standardId = this.currentShare.id
|
|
params.standardNumber = this.currentShare.standard_number
|
|
params.recipientId = value
|
|
shareStandard(params).then(res => {
|
|
if (res.success) {
|
|
this.$message.success(res.message)
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
})
|
|
},
|
|
// 跳转详情
|
|
detailClick (record) {
|
|
this.$openPageNewSheet({
|
|
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
|
|
query: {
|
|
id: record.id
|
|
}
|
|
})
|
|
},
|
|
// 操作完需要刷树的回调
|
|
modalFormOk () {
|
|
this.selectedTreeKeys = []
|
|
this.filters.nodeCode = null
|
|
this.initTreeData()
|
|
// 新增/修改 成功时,重载列表
|
|
this.loadData()
|
|
// 清空列表选中
|
|
this.onClearSelected()
|
|
},
|
|
modalOkDoNotRefreshTree () {
|
|
// 新增/修改 成功时,重载列表
|
|
this.loadData()
|
|
// 清空列表选中
|
|
this.onClearSelected()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
@import '~@assets/less/common.less';
|
|
/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>
|