档案管理2
This commit is contained in:
parent
e48b5160d2
commit
40dd5fb57e
26
src/api/company/archives/archivesRole.js
Normal file
26
src/api/company/archives/archivesRole.js
Normal file
@ -0,0 +1,26 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查看档案名称
|
||||
export function getArchivesCatalogList(dictType){
|
||||
return request({
|
||||
url: "/archives/role/list?dictType=" + dictType,
|
||||
method: "get"
|
||||
})
|
||||
}
|
||||
|
||||
// 新增或修改档案名称
|
||||
export function updateArchivesRoleAndDict(data){
|
||||
return request({
|
||||
url: "/archives/role/update",
|
||||
method: "post",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除档案名称
|
||||
export function removeArchivesRoleAndDict(ids){
|
||||
return request({
|
||||
url: "/archives/role/remove/" + ids,
|
||||
method: "delete"
|
||||
})
|
||||
}
|
@ -164,10 +164,8 @@ export const DICT_TYPE = {
|
||||
JY_ORDER_STATUS: 'jy_order_status',
|
||||
// 车辆类型
|
||||
RESCUE_CAR_TYPE: 'rescue_car_type',
|
||||
// 合同分类
|
||||
CONTRACT_TYPE: 'contract_type',
|
||||
// 资料分类
|
||||
MATERIAL_TYPE: 'material_type',
|
||||
// 档案分类
|
||||
ARCHIVES_TYPE: 'archives_type',
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,19 +1,13 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-tabs v-model="activeTab" @tab-click="handleClick">
|
||||
<!-- 合同管理 -->
|
||||
<el-tab-pane label="合同管理" :name="DICT_TYPE.CONTRACT_TYPE">
|
||||
<ArchivesTable :active-tab="activeTab" />
|
||||
</el-tab-pane>
|
||||
<!-- 资料管理 -->
|
||||
<el-tab-pane label="资料管理" :name="DICT_TYPE.MATERIAL_TYPE">
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tab-pane :label="item.label" :name="item.value" v-for="(item, index) in this.getDictDatas(DICT_TYPE.ARCHIVES_TYPE)">
|
||||
<ArchivesTable :active-tab="activeTab" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import ArchivesTable from '@/views/knowledge/views/archives/components/ArchivesTable'
|
||||
|
||||
export default {
|
||||
@ -23,13 +17,10 @@ export default {
|
||||
},
|
||||
data(){
|
||||
return{
|
||||
activeTab: DICT_TYPE.CONTRACT_TYPE,
|
||||
activeTab: "contract_type",
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
handleClick(tab, event) {
|
||||
console.log(this.activeTab)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -7,39 +7,47 @@
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8" style="margin-top: 1rem">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openCreateForm"
|
||||
v-hasPermi="['archives:catalog:create']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="el-icon-edit" :disabled="updateMultiple" size="mini" @click="openForm(undefined)"
|
||||
<el-button type="success" plain icon="el-icon-edit" :disabled="updateMultiple" size="mini"
|
||||
@click="openUpdateForm"
|
||||
v-hasPermi="['archives:catalog:update']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" :disabled="deleteMultiple" size="mini" @click="openForm(undefined)"
|
||||
<el-button type="danger" plain icon="el-icon-delete" :disabled="deleteMultiple" size="mini"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['archives:catalog:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-input placeholder="请输入名称" size="small" style="margin:1rem 0 1rem 0" v-model="filterText"/>
|
||||
<el-tree @check="handleSelectionChange" show-checkbox :data="this.getDictDatas(activeTab)" ref="tree" :filter-node-method="filterNode"
|
||||
<el-skeleton v-if="treeLoading"/>
|
||||
<el-tree v-else @check="handleSelectionChange" show-checkbox :data="dictDataTree" ref="tree"
|
||||
:filter-node-method="filterNode"
|
||||
@node-click="handleNodeClick"
|
||||
highlight-current
|
||||
>
|
||||
<template v-slot="{ node, data }">
|
||||
<!-- 自定义节点内容 -->
|
||||
<span class="custom-tree-node">
|
||||
{{ truncateText(data.label, 15) }}
|
||||
{{ truncateText(data.dictLabel, 15) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
|
||||
<el-empty style="margin-top: 10%" v-if="!chooseData" description="请先选择目录"></el-empty>
|
||||
<div v-else>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="90px"
|
||||
>
|
||||
<el-form-item label="名称" prop="fileName">
|
||||
<el-input v-model="queryParams.fileName" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
@ -59,7 +67,7 @@
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini"
|
||||
v-hasPermi="['company:staff:create']"
|
||||
>新增
|
||||
</el-button>
|
||||
@ -68,11 +76,21 @@
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ArchivesCatalogForm ref="formRef" @success="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { getArchivesCatalogList, removeArchivesRoleAndDict } from '@/api/company/archives/archivesRole'
|
||||
import ArchivesCatalogForm from '@/views/knowledge/views/archives/form/ArchivesCatalogForm'
|
||||
|
||||
export default {
|
||||
name: 'ArchivesTable',
|
||||
components: {
|
||||
ArchivesCatalogForm
|
||||
},
|
||||
props: {
|
||||
activeTab: {
|
||||
type: String,
|
||||
@ -86,29 +104,60 @@ export default {
|
||||
chooseData: '',
|
||||
queryParams: {
|
||||
fileName: null,
|
||||
fileDateArray: null,
|
||||
fileDateArray: null
|
||||
},
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
deleteMultiple: true,
|
||||
updateMultiple: true,
|
||||
dictDataTree: [],
|
||||
selectNodes: [],
|
||||
// 档案目录加载遮罩
|
||||
treeLoading : true
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.tree.filter(val)
|
||||
},
|
||||
activeTab() {
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openForm(row){
|
||||
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
getList(){
|
||||
|
||||
methods: {
|
||||
// 新增
|
||||
openCreateForm() {
|
||||
const data = {
|
||||
activeTab: this.activeTab
|
||||
}
|
||||
this.$refs['formRef'].open(data)
|
||||
},
|
||||
// 修改
|
||||
openUpdateForm() {
|
||||
const data = {
|
||||
...this.selectNodes[0],
|
||||
activeTab: this.activeTab
|
||||
}
|
||||
this.$refs['formRef'].open(data)
|
||||
},
|
||||
async getList() {
|
||||
this.selectNodes = []
|
||||
this.deleteMultiple = !this.selectNodes.length > 0
|
||||
this.updateMultiple = !(this.selectNodes.length === 1)
|
||||
try {
|
||||
this.treeLoading = true
|
||||
const res = await getArchivesCatalogList(this.activeTab)
|
||||
this.dictDataTree = res.data
|
||||
} finally {
|
||||
this.treeLoading = false
|
||||
}
|
||||
},
|
||||
// 节点事件
|
||||
handleNodeClick(e) {
|
||||
this.chooseData = e.label
|
||||
this.chooseData = e.dictLabel
|
||||
},
|
||||
// 节点筛选
|
||||
filterNode(value, data) {
|
||||
@ -130,7 +179,26 @@ export default {
|
||||
this.handleQuery()
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
console.log(selection)
|
||||
const flag = this.selectNodes.findIndex(item => item.dataId === selection.dataId)
|
||||
if (flag > -1) {
|
||||
this.selectNodes.splice(flag, 1)
|
||||
} else {
|
||||
this.selectNodes.push(selection)
|
||||
}
|
||||
this.deleteMultiple = !this.selectNodes.length > 0
|
||||
this.updateMultiple = !(this.selectNodes.length === 1)
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete() {
|
||||
const dataIds = this.selectNodes.map(item => item.dataId)
|
||||
const dictLabels = this.selectNodes.map(item => item.dictLabel)
|
||||
try {
|
||||
await this.$modal.confirm('是否确认删除名称为"' + dictLabels + '"的数据项?')
|
||||
await removeArchivesRoleAndDict(dataIds)
|
||||
await this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -171,6 +239,7 @@ div {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
::v-deep .el-tree-node__expand-icon.is-leaf {
|
||||
display: none;
|
||||
}
|
||||
|
206
src/views/knowledge/views/archives/form/ArchivesCatalogForm.vue
Normal file
206
src/views/knowledge/views/archives/form/ArchivesCatalogForm.vue
Normal file
@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="40%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="80px">
|
||||
<el-row :gutter="1">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="档案名称" prop="dictLabel">
|
||||
<el-input v-model="formData.dictLabel" placeholder="请输入档案名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="1">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="查看权限" prop="queryRoleIds">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
filterable
|
||||
clearable
|
||||
v-model="formData.queryRoleIds" multiple placeholder="请选择有查看权限的角色"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in roleList"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="1">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="新增权限" prop="createRoleIds">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
filterable
|
||||
clearable
|
||||
v-model="formData.createRoleIds" multiple placeholder="请选择有新增权限的角色"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in roleList"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="1">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="修改权限" prop="updateRoleIds">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
filterable
|
||||
clearable
|
||||
v-model="formData.updateRoleIds" multiple placeholder="请选择有修改权限的角色"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in roleList"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="1">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="删除权限" prop="deleteRoleIds">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
filterable
|
||||
clearable
|
||||
v-model="formData.deleteRoleIds" multiple placeholder="请选择有修改权限的角色"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in roleList"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {updateArchivesRoleAndDict} from '@/api/company/archives/archivesRole'
|
||||
import {getRoleList} from '@/api/company/staff'
|
||||
|
||||
export default {
|
||||
name: 'ArchivesCatalogForm',
|
||||
data(){
|
||||
return{
|
||||
dialogTitle: null,
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
formData: {
|
||||
dictType: null,
|
||||
dataId: null,
|
||||
queryRoleIds: null,
|
||||
updateRoleIds: null,
|
||||
createRoleIds: null,
|
||||
deleteRoleIds: null,
|
||||
dictLabel: null,
|
||||
},
|
||||
formRules:{
|
||||
queryRoleIds: [{required: true, message: "查看权限不能为空", trigger: "blur"}],
|
||||
updateRoleIds: [{required: true, message: "修改权限不能为空", trigger: "blur"}],
|
||||
deleteRoleIds: [{required: true, message: "删除权限不能为空", trigger: "blur"}],
|
||||
createRoleIds: [{required: true, message: "新增权限不能为空", trigger: "blur"}],
|
||||
dictLabel: [{required: true, message: "档案名称不能为空", trigger: "blur"}],
|
||||
},
|
||||
roleList: [],
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
/** 打开弹窗 */
|
||||
async open(data) {
|
||||
this.dialogVisible = true
|
||||
this.reset()
|
||||
// 修改时,设置数据
|
||||
if (data.dataId) {
|
||||
this.formData = {
|
||||
...data,
|
||||
queryRoleIds: data.queryRoleIds.split(",").map(item => parseInt(item)),
|
||||
createRoleIds: data.createRoleIds.split(",").map(item => parseInt(item)),
|
||||
updateRoleIds: data.updateRoleIds.split(",").map(item => parseInt(item)),
|
||||
deleteRoleIds: data.deleteRoleIds.split(",").map(item => parseInt(item))
|
||||
}
|
||||
}
|
||||
await this.listRoles()
|
||||
this.formData.dictType = data.activeTab
|
||||
this.dialogTitle = data.dataId ? '修改档案目录' : '新增档案目录'
|
||||
},
|
||||
async listRoles(){
|
||||
const res = await getRoleList()
|
||||
this.roleList = res.data
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm(){
|
||||
// 校验主表
|
||||
await this.$refs['formRef'].validate()
|
||||
this.formLoading = true
|
||||
try {
|
||||
const data = {
|
||||
...this.formData,
|
||||
queryRoleIds: this.formData.queryRoleIds.join(","),
|
||||
updateRoleIds: this.formData.updateRoleIds.join(","),
|
||||
deleteRoleIds: this.formData.deleteRoleIds.join(","),
|
||||
createRoleIds: this.formData.createRoleIds.join(","),
|
||||
}
|
||||
console.log(data)
|
||||
// 修改的提交
|
||||
if (data.dataId) {
|
||||
await updateArchivesRoleAndDict(data)
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.dialogVisible = false
|
||||
this.$emit('success')
|
||||
return
|
||||
}
|
||||
// 添加的提交
|
||||
await updateArchivesRoleAndDict(data)
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
this.dialogVisible = false
|
||||
this.$emit('success')
|
||||
} finally {
|
||||
this.formLoading = false
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
dictType: null,
|
||||
dataId: null,
|
||||
queryRoleIds: null,
|
||||
updateRoleIds: null,
|
||||
createRoleIds: null,
|
||||
deleteRoleIds: null,
|
||||
dictLabel: null,
|
||||
}
|
||||
this.resetForm('formRef')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user