[update] 企业标准模块
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
import { getAction } from './manage'
|
||||
|
||||
const getEnterpriseStandardTableHeader = (params) => getAction('', params)
|
||||
const getEnterpriseStandardSearchForm = (params) => getAction('', params)
|
||||
// 获取表格头部数据
|
||||
const getEnterpriseStandardTableHeader = (params) => getAction('/laws/standard/enterprise/getCommonHeader', params)
|
||||
// 获取搜索区域数据
|
||||
const getEnterpriseStandardSearchForm = (params) => getAction('/laws/standard/enterprise/getQueryCondition', params)
|
||||
// 获取新增表单数据
|
||||
const getEnterpriseStandardAddForm = (params) => getAction('/laws/standard/enterprise/getFormModel', params)
|
||||
// 根据id获取详情
|
||||
const getEnterpriseStandardInfoById = (params) => getAction('/laws/standard/enterprise/getByIdAndModule', params)
|
||||
|
||||
export {
|
||||
getEnterpriseStandardTableHeader,
|
||||
getEnterpriseStandardSearchForm
|
||||
getEnterpriseStandardSearchForm,
|
||||
getEnterpriseStandardAddForm,
|
||||
getEnterpriseStandardInfoById
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export const ConfigurableTableMixin = {
|
||||
},
|
||||
mounted () {
|
||||
this.getTableHeader()
|
||||
// this.loadData()
|
||||
this.loadData()
|
||||
// 过滤没有权限的按钮
|
||||
// if (this.needFilterTableBtn) {
|
||||
// this.operationList = this.operationList.filter(item => isHasPermission(item.has))
|
||||
|
||||
+102
-62
@@ -3,19 +3,28 @@
|
||||
<div class="page-left-box">
|
||||
<!-- $t('standardRegulationLibrary.domesticStandard.treeSearchPlaceholder')-->
|
||||
<a-input-search v-model="treeInput" :placeholder="$t('pleaseEnterTreeSystem')"
|
||||
@search="handleTableSearch" />
|
||||
<a-tree :show-line="true" :show-icon="true" :tree-data=treeData>
|
||||
@change="handleTreeChange" />
|
||||
<a-tree
|
||||
:show-line="true"
|
||||
:show-icon="true"
|
||||
:tree-data="treeData"
|
||||
:selectedKeys="currentTreeNode"
|
||||
:replaceFields="{children: 'subset', title: 'name', key: 'id'}"
|
||||
:expanded-keys="expandedKeys"
|
||||
:auto-expand-parent="autoExpandParent"
|
||||
@expand="treeExpand"
|
||||
@select="treeSelect">
|
||||
<a-icon type="folder" slot="folder" class="tree-icon" />
|
||||
|
||||
<template #custom="{title, key}">
|
||||
<div class="tree-operate-node" @mouseenter="handleTreeMouseover(key)" @mouseleave="handleTreeMouseout(key)">
|
||||
<template #custom="{name, id}">
|
||||
<div class="tree-operate-node" @mouseenter="handleTreeMouseover(id)" @mouseleave="handleTreeMouseout(id)">
|
||||
<a-tooltip>
|
||||
<template #title>
|
||||
{{ title }}
|
||||
{{ name }}
|
||||
</template>
|
||||
<span class="tree-node-custom-title">{{ title }}</span>
|
||||
<span class="tree-node-custom-title">{{ name }}</span>
|
||||
</a-tooltip>
|
||||
<template v-if="key === mouseInNodeKey">
|
||||
<template v-if="id === mouseInNodeKey">
|
||||
<a-button icon="plus" class="tree-operate-node-btn">
|
||||
</a-button>
|
||||
<a-button class="tree-operate-node-btn">
|
||||
@@ -38,48 +47,18 @@
|
||||
@reset="searchReset" />
|
||||
</div>
|
||||
<div class="table-operator">
|
||||
<div class="operator-text" @click="handleAdd">
|
||||
<a-icon type="plus" />
|
||||
{{ $t('newlyAdded') }}
|
||||
</div>
|
||||
<a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<div class="operator-text">
|
||||
<a-icon type="upload" />
|
||||
{{ $t('import') }}
|
||||
</div>
|
||||
<a-button icon="upload">{{ $t('import') }}</a-button>
|
||||
</a-upload>
|
||||
<div class="operator-text" @click="handleExportXls">
|
||||
<a-icon type="export" />
|
||||
{{ $t('export') }}
|
||||
</div>
|
||||
<div class="operator-text" @click="handleFileExport">
|
||||
<a-icon type="mail" />
|
||||
{{ $t('exportWithFile') }}
|
||||
</div>
|
||||
<div class="operator-text" @click="downTemplate($t('enterpriseStandardLibrary.enterpriseStandard.templateExport'))">
|
||||
<a-icon type="download" />
|
||||
{{ $t('templateDownload') }}
|
||||
</div>
|
||||
<div class="operator-text" @click="batchDel">
|
||||
<a-icon type="delete" />
|
||||
{{ $t('batchDelete') }}
|
||||
</div>
|
||||
<div class="operator-text" @click="handleAllocationStandard">
|
||||
<a-icon type="setting" />
|
||||
{{ $t('enterpriseStandardLibrary.enterpriseStandard.allocationStandard') }}
|
||||
</div>
|
||||
<div class="operator-text" @click="handleShiftOutStandard">
|
||||
<a-icon type="setting" />
|
||||
{{ $t('enterpriseStandardLibrary.enterpriseStandard.shiftOutStandard') }}
|
||||
</div>
|
||||
<div class="operator-text" @click="handleInitChange">
|
||||
<a-icon type="setting" />
|
||||
{{ $t('enterpriseStandardLibrary.enterpriseStandard.initChange') }}
|
||||
</div>
|
||||
<div class="operator-text" @click="handleTemporaryPermissSet">
|
||||
<a-icon type="setting" />
|
||||
{{ $t('enterpriseStandardLibrary.enterpriseStandard.temporaryPermissionSet') }}
|
||||
</div>
|
||||
<a-button icon="export" @click="handleExportXls">{{ $t('export') }}</a-button>
|
||||
<a-button icon="mail" @click="handleFileExport">{{ $t('exportWithFile') }}</a-button>
|
||||
<a-button icon="download" @click="downTemplate($t('enterpriseStandardLibrary.enterpriseStandard.templateExport'))">{{ $t('templateDownload') }}</a-button>
|
||||
<a-button icon="delete" @click="batchDel">{{ $t('batchDelete') }}</a-button>
|
||||
<a-button icon="setting" @click="handleAllocationStandard">{{ $t('enterpriseStandardLibrary.enterpriseStandard.allocationStandard') }}</a-button>
|
||||
<a-button icon="setting" @click="handleShiftOutStandard">{{ $t('enterpriseStandardLibrary.enterpriseStandard.shiftOutStandard') }}</a-button>
|
||||
<a-button icon="setting" @click="handleInitChange">{{ $t('enterpriseStandardLibrary.enterpriseStandard.initChange') }}</a-button>
|
||||
<a-button icon="setting" @click="handleTemporaryPermissSet">{{ $t('enterpriseStandardLibrary.enterpriseStandard.temporaryPermissionSet') }}</a-button>
|
||||
</div>
|
||||
<div>
|
||||
<j-table
|
||||
@@ -96,18 +75,22 @@
|
||||
<template slot="operation" slot-scope="{text, record}">
|
||||
<a v-for="(operation, index) in operationList.slice(0, operateMaxNum)" :key="index" @click="operationClick(operation,record)">
|
||||
<template v-if="operation.text === $t('enterpriseStandardLibrary.enterpriseStandard.collection')">
|
||||
{{ !record.collectFlag || record.collectFlag === '0' ? $t('enterpriseStandardLibrary.enterpriseStandard.collection') : $t('enterpriseStandardLibrary.enterpriseStandard.cancelCollection')
|
||||
}}
|
||||
<i class="iconfont icon-star1" v-show="record.collectFlag === 1" />
|
||||
<i class="iconfont icon-star" v-show="!record.collectFlag || record.collectFlag === 0" />
|
||||
</template>
|
||||
</a>
|
||||
<a-divider v-if="operationList.length >= operateMaxNum" type="vertical" />
|
||||
<a-dropdown v-if="operationList.length >= operateMaxNum">
|
||||
<a class="ant-dropdown-link">
|
||||
{{ $t('more') }} <a-icon type="down"/>
|
||||
</a>
|
||||
<a-dropdown v-if="operationList.length >= operateMaxNum" placement="bottomCenter">
|
||||
<a-icon type="more" class="operate-icon-btn operate-icon-more" />
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index">
|
||||
<a @click="operationClick(operation,record)">
|
||||
<!-- 编辑图标-->
|
||||
<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>
|
||||
@@ -127,6 +110,7 @@
|
||||
</j-table>
|
||||
</div>
|
||||
</div>
|
||||
<enterprise-standard-modal ref="modalForm" @ok="modalFormOk"></enterprise-standard-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
@@ -137,16 +121,21 @@ import JTable from '@/components/jero/JTable'
|
||||
import Search from '@/components/customField/Search'
|
||||
import { ConfigurableTableMixin } from '@/mixins/ConfigurableTableMixin'
|
||||
import { getEnterpriseStandardTableHeader, getEnterpriseStandardSearchForm } from '@api/enterpriseStandardLibraryApi'
|
||||
import EnterpriseStandardModal from './modules/EnterpriseStandardModal'
|
||||
|
||||
export default {
|
||||
name: 'EnterpriseStandardList',
|
||||
components: { JTable, Search },
|
||||
components: { EnterpriseStandardModal, JTable, Search },
|
||||
mixins: [ConfigurableTableMixin],
|
||||
data () {
|
||||
return {
|
||||
flag: '3',
|
||||
treeInput: '', // 左侧树搜索框内容
|
||||
treeData: [], // 左侧树数据
|
||||
treeDataList: [], // 左侧树的数组结构,用于搜索
|
||||
expandedKeys: [],
|
||||
autoExpandParent: true,
|
||||
currentTreeNode: null, // 当前选中的树节点
|
||||
mouseInNodeKey: null, // 鼠标悬浮的节点key值
|
||||
operationList: [
|
||||
{
|
||||
@@ -176,11 +165,7 @@ export default {
|
||||
getQueryConditionFunc: getEnterpriseStandardSearchForm,
|
||||
// url传参严格按照当前命名
|
||||
url: {
|
||||
list: '/laws/common/getCommonPage', // 表格数据
|
||||
getAddForm: '/laws/common/getFormModel', // 表单的字段
|
||||
addInfo: '', // 新增
|
||||
updateInfo: '', // 编辑
|
||||
getDocumentInfo: '', // 查看
|
||||
list: '/laws/standard/enterprise/getCommonPage', // 表格数据
|
||||
delete: '', // 删除
|
||||
deleteBatch: '', // 批量删除
|
||||
importUrl: '', // 导入
|
||||
@@ -206,9 +191,64 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 左侧树搜索
|
||||
handleTableSearch () {
|
||||
|
||||
// 获取左侧树数据
|
||||
initTreeData (params) {
|
||||
getWorkGroupTreeList(params).then(res => {
|
||||
if (res.success) {
|
||||
this.treeData = this.dealTreeData(res.result)
|
||||
// this.treeData = res.result
|
||||
this.treeData[0].scopedSlots = { title: 'customNoDelete' }
|
||||
this.generateList(this.treeData)
|
||||
} else {
|
||||
this.treeData = []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 处理左侧树数据结构
|
||||
dealTreeData (treeData) {
|
||||
return treeData.map(item => {
|
||||
item.scopedSlots = { title: 'custom' }
|
||||
if (item.subset && item.subset.length > 0) {
|
||||
item.subset = this.dealTreeData(item.subset)
|
||||
}
|
||||
return item
|
||||
})
|
||||
},
|
||||
// 获取左侧树的数组结构(非树结构)
|
||||
generateList (data) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const node = data[i]
|
||||
const id = node.id
|
||||
this.treeDataList.push({ id, name: node.name, pid: node.pid })
|
||||
if (node.subset) {
|
||||
this.generateList(node.subset)
|
||||
}
|
||||
}
|
||||
},
|
||||
// 左侧树搜索框改变
|
||||
handleTreeChange (e) {
|
||||
const value = e.target.value
|
||||
const expandedKeys = this.treeDataList
|
||||
.map(item => {
|
||||
if (item.name.indexOf(value) > -1) {
|
||||
return item.pid
|
||||
}
|
||||
return null
|
||||
})
|
||||
.filter((item, i, self) => item && self.indexOf(item) === i)
|
||||
this.expandedKeys = expandedKeys
|
||||
this.autoExpandParent = true
|
||||
},
|
||||
// 左侧树点击展开
|
||||
treeExpand (expandedKeys) {
|
||||
this.expandedKeys = expandedKeys
|
||||
this.autoExpandParent = false
|
||||
},
|
||||
// 左侧树点击选中
|
||||
treeSelect (selectedKeys) {
|
||||
this.currentTreeNode = selectedKeys
|
||||
this.queryParam.workingGroupId = selectedKeys[0]
|
||||
this.loadData()
|
||||
},
|
||||
// 左侧树鼠标移入某一目录
|
||||
handleTreeMouseover (key) {
|
||||
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
:width="width"
|
||||
placement="right"
|
||||
:closable="true"
|
||||
@close="handleCancel"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
class="custom-drawer-style"
|
||||
>
|
||||
<a-spin :spinning="confirmLoading" style="width: 100%;height:100%">
|
||||
<div class="custom-drawer-style-scroll">
|
||||
<add-form ref="addForm"
|
||||
:get-form-func="getFormFunc"
|
||||
:get-document-info-func="getDocumentInfoFunc"
|
||||
@submitFormData="submitFormData" />
|
||||
</div>
|
||||
<div class="custom-drawer-style-bottom-btn">
|
||||
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;">
|
||||
{{ $t('preservation') }}
|
||||
</a-button>
|
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">{{ $t('close') }}</a-button>
|
||||
</div>
|
||||
</a-spin>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import '@assets/less/common.less'
|
||||
import AddForm from '@/components/customField/AddForm'
|
||||
import { getEnterpriseStandardAddForm, getEnterpriseStandardInfoById } from '@/api/enterpriseStandardLibraryApi'
|
||||
import { postAction } from '@/api/manage'
|
||||
|
||||
export default {
|
||||
name: 'EnterpriseStandardModal',
|
||||
components: { AddForm },
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
title: '',
|
||||
width: 800,
|
||||
// 存储表单的数据
|
||||
form: {},
|
||||
confirmLoading: false,
|
||||
getFormFunc: getEnterpriseStandardAddForm,
|
||||
getDocumentInfoFunc: getEnterpriseStandardInfoById,
|
||||
url: {
|
||||
add: '/laws/standard/domestic/commonAdd',
|
||||
edit: '/laws/standard/domestic/commonEdit'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addForm.add()
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.visible = true
|
||||
},
|
||||
handleOk () {
|
||||
this.confirmLoading = true
|
||||
this.$refs.addForm.submit()
|
||||
},
|
||||
// 表单提交的回调,获取表单数据
|
||||
submitFormData (formInline) {
|
||||
let url = ''
|
||||
if (formInline.id) {
|
||||
url = this.url.edit
|
||||
} else {
|
||||
url = this.url.add
|
||||
}
|
||||
postAction(url, formInline).then((res) => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
if (this.formInline.id) {
|
||||
this.$emit('ok')
|
||||
} else {
|
||||
this.$emit('ok')
|
||||
}
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
close () {
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user