[update] 企业标准模块

This commit is contained in:
lideqin
2023-09-08 10:51:38 +08:00
parent 750129271b
commit 4234096d4f
4 changed files with 217 additions and 66 deletions
+11 -3
View File
@@ -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
}
+1 -1
View File
@@ -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))
@@ -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>