Initial commit
This commit is contained in:
@@ -0,0 +1,871 @@
|
||||
<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"
|
||||
:expanded-keys.sync="expandedKeys"
|
||||
: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"
|
||||
:default-search-params="defaultSearchParams"
|
||||
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="download" type="primary" ghost v-has="'enterpriseStandard:upload'">{{ $t('import') }}</a-button>
|
||||
</a-upload>
|
||||
<!-- 导出 -->
|
||||
<a-button icon="upload" type="primary" ghost @click="handleExportXls($t('enterpriseStandardLibrary.standard.exportExcelFile'))" v-has="'enterpriseStandard:export'">{{ $t('export') }}</a-button>
|
||||
<!-- 带文件导出 -->
|
||||
<a-button icon="upload" 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>
|
||||
<!-- 临时权限记录 -->
|
||||
<a-button icon="setting" type="primary" ghost @click="handleTemporaryPermissionRecord" v-has="'enterpriseStandard:temporaryPermissRecord'">{{ $t('enterpriseStandardLibrary.standard.temporaryPermissionRecord') }}</a-button>
|
||||
</div>
|
||||
<div>
|
||||
<j-table
|
||||
v-if="columns && columns.length > 0"
|
||||
ref="tableRef"
|
||||
: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="record.del_flag ? operationList.length > operateMaxNum : operationList.length - 1 > operateMaxNum" type="vertical" />
|
||||
<a-dropdown v-if="record.del_flag ? operationList.length > operateMaxNum : operationList.length - 1 > 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-link operate-btn-icon" v-if="operation.text === $t('viewDetail')" />
|
||||
<!-- 编辑图标 -->
|
||||
<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 }}
|
||||
</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-link operate-btn-icon" v-if="operation.text === $t('viewDetail')" />
|
||||
<!-- 编辑图标 -->
|
||||
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
|
||||
{{ 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.slice(operateMaxNum).filter(item => ![$t('edit'), $t('delete')].includes(item.text)).length > 0 &&
|
||||
operationList.find(item => item.text === $t('enterpriseStandardLibrary.standard.collection'))"
|
||||
type="vertical" />
|
||||
<template v-if="operationList.slice(operateMaxNum).filter(item => ![$t('edit'), $t('delete')].includes(item.text)).length > 0">
|
||||
<!--{{operationList.slice(operateMaxNum).filter(item => ![$t('edit'), $t('delete')].includes(item.text))}}-->
|
||||
<template
|
||||
v-if="operationList.slice(operateMaxNum).filter(item => ![$t('edit'), $t('delete')].includes(item.text)).length <= 1">
|
||||
<template v-for="(operation, index) in operationList.slice(operateMaxNum).filter(item => ![$t('edit'), $t('delete')].includes(item.text))">
|
||||
<a :key="index" @click="operationClick(operation,record)">
|
||||
<!-- 查看图标-->
|
||||
<i class="iconfont icon-link operate-btn-icon" v-if="operation.text === $t('viewDetail')" />
|
||||
{{ operation.text }}
|
||||
</a>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<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).filter(item => ![$t('edit'), $t('delete')].includes(item.text))" :key="index">
|
||||
<a @click="operationClick(operation,record)">
|
||||
<!-- 查看图标-->
|
||||
<i class="iconfont icon-link operate-btn-icon" v-if="operation.text === $t('viewDetail')" />
|
||||
{{ operation.text }}
|
||||
</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</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="filePreview(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="filePreview(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>
|
||||
<!-- 临时权限记录 -->
|
||||
<temporary-permission-record ref="temporaryPermissionRecord" @ok="modalFormOk"></temporary-permission-record>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { StandardSystemTreeNodeType, EnterpriseStandardStatus } 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,
|
||||
collectStandard,
|
||||
cancelCollectStandard,
|
||||
deleteTreeNode,
|
||||
getEnterpriseStandardInfoById,
|
||||
getEnterpriseStandardAddForm
|
||||
} from '@api/enterpriseStandardLibraryApi'
|
||||
// 添加、编辑弹框
|
||||
import EnterpriseStandardModal from './modules/EnterpriseStandardModal'
|
||||
// 临时权限设置
|
||||
import TemporaryPermissionSet from './modules/TemporaryPermissionSet'
|
||||
import TreeNodeModal from './modules/TreeNodeModal'
|
||||
// 配置标准弹框
|
||||
import AllocationStandardDrawer from './modules/AllocationStandardDrawer'
|
||||
import { postDownFile, downloadFile, postAction } from '@/api/manage'
|
||||
import TemporaryPermissionRecord from './modules/TemporaryPermissionRecord'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { previewPdf } from '@/utils/previewPdf'
|
||||
import { kkFilePreview } from '@/utils/kkFilePreview'
|
||||
import { getFileInfo } from '@api/api'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { isHasPermission } from '@/utils/hasPermission'
|
||||
|
||||
export default {
|
||||
name: 'EnterpriseStandardList',
|
||||
components: { TemporaryPermissionRecord, AllocationStandardDrawer, 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('viewDetail'),
|
||||
clickEvent: 'detailClick',
|
||||
has: 'enterpriseStandard:view'
|
||||
},
|
||||
{ // 编辑
|
||||
text: this.$t('edit'),
|
||||
clickEvent: 'handleEdit',
|
||||
has: 'enterpriseStandard:edit'
|
||||
},
|
||||
{ // 删除
|
||||
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, // 是否显示操作列
|
||||
expandedKeys: [], // 体系展开的节点
|
||||
defaultSearchParams: {
|
||||
standard_state: `${EnterpriseStandardStatus.CURRENTLY_EFFECTIVE.value},${EnterpriseStandardStatus.TRIAL_OPERATION.value},${EnterpriseStandardStatus.RELEASE.value},${EnterpriseStandardStatus.PRE_RELEASE.value}`
|
||||
},
|
||||
disabledMixinsCreate: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo']),
|
||||
// 当前用户是否管理员
|
||||
isAdmin () {
|
||||
const adminRoleList = window._CONFIG.adminRoleCode.split(',')
|
||||
const userRoleList = this.userInfo.roleCode.split(',')
|
||||
return userRoleList.some(tt => adminRoleList.includes(tt))
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 消息当前页跳转,需要带入参数
|
||||
$route: {
|
||||
deep: true,
|
||||
handler (to, from) {
|
||||
// 如果有消息跳转参数就带入参数查询
|
||||
if (to.query.standard_number) {
|
||||
this.$set(this.$refs.searchRef.queryParam, 'standard_number', to.query.standard_number)
|
||||
this.searchParams = Object.assign({}, this.$refs.searchRef.queryParam)
|
||||
this.loadData()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
// 从消息跳转进来带企业编号
|
||||
this.$set(this.$refs.searchRef.queryParam, 'standard_number', this.$route.query.standard_number)
|
||||
this.searchParams = Object.assign({}, this.$refs.searchRef.queryParam)
|
||||
this.getTableHeader()
|
||||
this.loadData()
|
||||
// 过滤没有权限的按钮
|
||||
if (this.needFilterTableBtn) {
|
||||
this.operationList = this.operationList.filter(item => !item.has || isHasPermission(item.has))
|
||||
console.log(this.operationList)
|
||||
}
|
||||
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 || []
|
||||
this.expandedKeys = [this.treeData[0].key]
|
||||
} 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
|
||||
}
|
||||
},
|
||||
// 管理员直接新增企标到企标库,非管理员新增跳转到企标制修订发起页面
|
||||
handleAdd () {
|
||||
if (!this.isAdmin) {
|
||||
this.$router.push({
|
||||
path: '/workCenter/enterpriseStandardRevision/enterpriseStandardRevisionFlow'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$refs.modalForm.add()
|
||||
this.$refs.modalForm.title = this.$t('newlyAdded')
|
||||
this.$refs.modalForm.disableSubmit = false
|
||||
},
|
||||
/**
|
||||
* 重置查询
|
||||
*/
|
||||
searchReset (params) {
|
||||
this.currentTreeNode = null
|
||||
this.searchParams = Object.assign({}, params)
|
||||
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 !== 1) {
|
||||
this.$message.warning(this.$t('selectOne'))
|
||||
return
|
||||
}
|
||||
this.$router.push({
|
||||
path: '/workCenter/enterpriseStandardChange/enterpriseStandardChangeFlow',
|
||||
query: {
|
||||
enStandardId: this.selectedRowKeys[0]
|
||||
}
|
||||
})
|
||||
},
|
||||
// 临时权限设置
|
||||
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(','))
|
||||
},
|
||||
// 临时权限记录
|
||||
handleTemporaryPermissionRecord () {
|
||||
this.$refs.temporaryPermissionRecord.open()
|
||||
},
|
||||
// 操作栏的点击
|
||||
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
|
||||
})
|
||||
}
|
||||
},
|
||||
// 跳转详情
|
||||
detailClick (record) {
|
||||
this.$openPageNewSheet({
|
||||
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
|
||||
query: {
|
||||
id: record.id
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 按顺序打开最新的pdf或word
|
||||
*/
|
||||
async filePreview (record) {
|
||||
console.log('filePreview', record)
|
||||
// 获取并处理过程稿件数据
|
||||
let res = await getEnterpriseStandardAddForm({ type: 1 })
|
||||
if (!res.success) {
|
||||
this.$message.warn(res.message)
|
||||
console.log('getDomesticStandardFormModal error:', res)
|
||||
return
|
||||
}
|
||||
console.log('res.result', res.result)
|
||||
const data = res.result || {}
|
||||
const form = data
|
||||
const partList = Object.keys(data)
|
||||
let part
|
||||
const partZh = '过程稿件'
|
||||
const partEn = 'Process Manuscript'
|
||||
if (partList.includes(partEn))part = partEn
|
||||
if (partList.includes(partZh))part = partZh
|
||||
console.log('part', part)
|
||||
const processManuscript = form[part]
|
||||
console.log('过程稿件', processManuscript)
|
||||
|
||||
// 获取并处理详情数据
|
||||
res = await getEnterpriseStandardInfoById({ id: record.id, type: 1 })
|
||||
if (!res.success) {
|
||||
this.$message.warn(res.message)
|
||||
console.log('getDomesticStandardDetail error:', res)
|
||||
return
|
||||
}
|
||||
const detailData = Object.assign({}, res.result || {})
|
||||
console.log('detailData', detailData)
|
||||
|
||||
// 选择合适的文件
|
||||
let file = null
|
||||
const pdfFileList = []
|
||||
const docFileList = []
|
||||
let newestFileList = []
|
||||
let manuscriptName = '' // 记录找到哪个稿件就找到文件了
|
||||
// 按照过程稿件顺序寻找文件
|
||||
for (const formItem of processManuscript) {
|
||||
const keyId = formItem.dbFieldName
|
||||
const keyName = formItem.dbFieldName + '_dictText'
|
||||
if (!detailData[keyId]) continue
|
||||
const idArray = detailData[keyId].split(',')
|
||||
const nameArray = detailData[keyName].split(',')
|
||||
// 每个过程中可能有多个文件
|
||||
for (let i = 0; i < idArray.length; i++) {
|
||||
const id = idArray[i]
|
||||
const name = nameArray[i]
|
||||
var suffix = name.substring(name.lastIndexOf('.') + 1).toLowerCase()
|
||||
if (suffix === 'pdf') {
|
||||
pdfFileList.push({ id, name, suffix })
|
||||
}
|
||||
if (suffix === 'docx') {
|
||||
docFileList.push({ id, name, suffix })
|
||||
}
|
||||
}
|
||||
// 一旦一个过程中找到pdf或者doc,就可以退出
|
||||
if (pdfFileList.length > 0 || docFileList.length > 0) {
|
||||
manuscriptName = formItem.dbFieldName
|
||||
break
|
||||
}
|
||||
}
|
||||
if (manuscriptName === 'publish_of_original') {
|
||||
// 在发布稿就找到了,合并pdf和doc文件列表排序
|
||||
newestFileList = [...pdfFileList, ...docFileList]
|
||||
} else {
|
||||
newestFileList = pdfFileList // 默认从pdf里选最新的文件
|
||||
if (pdfFileList.length === 0)newestFileList = docFileList // 如果没有pdf文件,就从doc文件里选
|
||||
}
|
||||
file = await this.selectNewestFile(newestFileList)
|
||||
if (file === null) { // 没有找到文件就退出
|
||||
console.log('没有找到符合要求的文件!')
|
||||
this.$message.error('该标准暂无预览文件,请联系标准管理员。')
|
||||
return
|
||||
}
|
||||
console.log('seletedFile', file)
|
||||
|
||||
// 是onlyOffice生成的,预览关联的pdf文件
|
||||
if (file.pdfId) {
|
||||
// 说明是onlyOffice生成的
|
||||
const url = previewPdf(file.pdfId)
|
||||
window.open(url)
|
||||
return
|
||||
}
|
||||
|
||||
// 预览选择的文件
|
||||
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
|
||||
console.log(fileFullUrl)
|
||||
if (file.suffix === 'pdf') { // pdf预览
|
||||
const url = previewPdf(file.id)
|
||||
window.open(url)
|
||||
return
|
||||
}
|
||||
kkFilePreview(fileFullUrl)// 其余可预览文件仍使用KKFile进行预览
|
||||
},
|
||||
/**
|
||||
* 从文件列表里选择最新文件
|
||||
* @param fileList
|
||||
*/
|
||||
async selectNewestFile (fileList) {
|
||||
if (!fileList || fileList.length === 0) return null
|
||||
if (fileList.length === 1) {
|
||||
const res = await getFileInfo(fileList[0])
|
||||
return { ...fileList[0], ...res.result }
|
||||
}
|
||||
const newFileList = []
|
||||
// 获取时间信息
|
||||
for (const file of fileList) {
|
||||
const res = await getFileInfo(file)
|
||||
newFileList.push({ ...file, ...res.result })
|
||||
}
|
||||
// 排序取出最新
|
||||
newFileList.sort((a, b) => b.id - a.id) // 日期只精确到天,用id更能区分
|
||||
console.log('newFileList', newFileList)
|
||||
return newFileList[0]
|
||||
},
|
||||
// 操作完需要刷树的回调
|
||||
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>
|
||||
Reference in New Issue
Block a user