Browse Source

档案分类/归档范围

master
xuhuajiao 1 year ago
parent
commit
39f6b47807
  1. 54
      src/api/system/archivesScope.js
  2. 2
      src/assets/styles/yxk-admin.scss
  3. 283
      src/views/system/archiveScopeManage/index.vue
  4. 531
      src/views/system/archiveScopeManage/module/tableList.vue
  5. 43
      src/views/system/archivesClassify/module/tableList.vue
  6. 164
      src/views/system/fieldCorresManage/index.vue
  7. 7
      src/views/system/fieldCorresManage/module/detail.vue
  8. 62
      src/views/system/fieldCorresManage/module/form.vue

54
src/api/system/archivesScope.js

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 获取归档范围列表
export function FetchInitArchivesScope(params) {
return request({
url: 'api/archivesScope/initArchivesScope',
method: 'get',
params
})
}
// 获取子集
export function FetchSonArchivesScope(params) {
return request({
url: 'api/archivesScope/getSonArchivesScope',
method: 'get',
params
})
}
// 获取树
export function FetchArchivesScopeTree(params) {
return request({
url: 'api/archivesScope/getArchivesScopeTree',
method: 'get',
params
})
}
export function add(data) {
return request({
url: 'api/archivesScope/editArchivesScope',
method: 'post',
data
})
}
export function edit(data) {
return request({
url: 'api/archivesScope/editArchivesScope',
method: 'post',
data
})
}
export function del(data) {
return request({
url: 'api/archivesScope/delArchivesClass',
method: 'post',
data
})
}
export default { add, edit, del, FetchInitArchivesScope, FetchSonArchivesScope, FetchArchivesScopeTree }

2
src/assets/styles/yxk-admin.scss

@ -1786,7 +1786,7 @@ input[type ='number'] {
font-weight: normal;
font-size: 12px;
line-height: 20px;
background: url('~@/assets/images/icon/tip-icon.png') no-repeat left center;
background: url('~@/assets/images/icon/tip-icon.png') no-repeat left 6px;
background-size: 14px 14px;
}

283
src/views/system/archiveScopeManage/index.vue

@ -8,202 +8,57 @@
<span class="left-bottom-line" />
<!--门类树状结构-->
<div class="tree-scroll">
<el-tree ref="tree" v-loading="crud.loading" :data="crud.data" :props="defaultProps" node-key="id" :expand-on-click-node="false" highlight-current @node-click="handleNodeClick" />
<el-tree
ref="tree"
v-loading="crud.loading"
:data="crud.data"
node-key="id"
:props="defaultProps"
:expand-on-click-node="false"
@node-click="handleNodeClick"
/>
</div>
</div>
</div>
<div class="elect-cont-right">
<!--工具栏-->
<div class="head-container">
<crudOperation :permission="permission">
<template v-slot:left>
<el-button v-permission="permission.add" size="mini" @click="crud.toAdd">
<i class="iconfont icon-xinzeng" />
新增
</el-button>
<el-button v-permission="permission.edit" size="mini" :disabled="crud.selections.length !== 1 || crud.selections[0].pid === '0' || crud.selections[0].isType === 4" @click="crud.toEdit(crud.selections[0])">
<i class="iconfont icon-bianji" />
编辑
</el-button>
<el-button v-permission="permission.del" size="mini" :loading="crud.delAllLoading" @click="toDelete(crud.selections)">
<i class="iconfont icon-shanchu" />
删除
</el-button>
</template>
<template v-slot:right>
<span class="tip">注意门类节点下才可新增归档范围定义</span>
</template>
</crudOperation>
</div>
<div class="container-right">
<span class="right-top-line" />
<span class="left-bottom-line" />
<!--表单渲染-->
<el-dialog :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title">
<div class="setting-dialog">
<el-form ref="form" :inline="true" :model="form" :rules="rules" label-width="90px">
<el-form-item label="所属门类" prop="category">
<el-input v-model="form.category" />
</el-form-item>
<el-form-item label="档案分类" prop="classify">
<treeselect
v-model="form.classify"
:load-options="loadCategorys"
:options="scopes"
placeholder="选择档案分类"
/>
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" @keydown.native="keydown($event)" />
</el-form-item>
<el-form-item label="编码" prop="number">
<el-input v-model="form.number" />
</el-form-item>
<el-form-item label="顶级范围" prop="isTop">
<el-radio-group v-model="form.isTop">
<el-radio label="1"></el-radio>
<el-radio label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="保管期限" prop="retentionPeriod">
<el-select v-model="form.retentionPeriod" placeholder="请选择" style="width:225px;">
<el-option v-for="item in periodOptions" :key="item.value" :label="item.label" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item
v-if="form.isTop === '0'"
label="上级分类"
prop="pid"
>
<treeselect
v-model="form.scope"
:load-options="loadCategorys"
:options="scopes"
placeholder="选择上级范围"
style="width: 584px;"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确定</el-button>
</div>
</div>
</el-dialog>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="tableData"
style="width: 100%;"
:default-expand-all="isExpand"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
@row-click="clickRowHandler"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" align="center" width="55" />
<el-table-column :show-overflow-tooltip="true" prop="number" label="编码" />
<el-table-column :show-overflow-tooltip="true" prop="name" label="名称" type="expand" />
<el-table-column :show-overflow-tooltip="true" prop="retentionPeriod" label="保管期限" />
<el-table-column :show-overflow-tooltip="true" prop="category" label="所属门类" />
<el-table-column :show-overflow-tooltip="true" prop="classify" label="所属分类" />
</el-table>
<!--分页组件-->
<pagination v-if="tableData.length !== 0" />
</div>
</div>
<!--删除对话框组件-->
<el-dialog class="tip-dialog" title="提示" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="deleteVisible">
<div class="setting-dialog">
<div class="tip-content">
<p class="tipMsg">此操作将移除当前所选范围</p>
<span>你是否还要继续?</span>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="deleteVisible = false">取消</el-button>
<el-button type="primary" @click.native="handleDelConfirm">确定</el-button>
</div>
</div>
</el-dialog>
<TableList ref="tableList" :selected-category="selectedCategory" />
</div>
</div>
</template>
<script>
import crudCategory from '@/api/category/category'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
const defaultForm = { id: null, pid: null, name: null, category: null, classify: null, retentionPeriod: null, number: null, isTop: '0' }
import CRUD, { presenter, header, crud } from '@crud/crud'
import TableList from './module/tableList'
import Vue from 'vue'
export default {
name: 'ArchiveScopeManage',
components: { crudOperation, pagination, Treeselect },
components: { TableList },
cruds() {
return [
CRUD({
title: '归档范围', url: 'api/archives-type/menu',
crudMethod: { ...crudCategory },
optShow: {
add: false,
edit: false,
del: false,
download: true,
group: false
}
title: '归档范围', url: 'api/category/menu',
crudMethod: {}, sort: []
})
]
},
mixins: [presenter(), header(), form(defaultForm), crud()],
mixins: [presenter(), header(), crud()],
data() {
return {
tableData: [],
scopes: [],
deleteVisible: false,
isExpand: false,
permission: {
add: ['admin', 'category:add'],
edit: ['admin', 'category:edit'],
del: ['admin', 'category:del'],
sort: ['admin', 'category:sort']
},
defaultProps: {
children: 'children',
label: 'cnName'
},
periodOptions: [
{
id: 1,
value: '1',
label: '永久'
},
{
id: 2,
value: '2',
label: '定期30年'
},
{
id: 3,
value: '3',
label: '定期10年'
}
],
selectedCategory: {},
rules: {
category: [{ required: true, message: '所属门类不为空', trigger: 'blur' }],
classify: [{ required: true, message: '请选择档案分类', trigger: 'change' }],
number: [{ required: true, message: '编码不可为空', trigger: 'blur' }],
name: [{ required: true, message: '名称不可为空', trigger: 'blur' }],
isTop: [{ required: true, message: '请选择是否为顶级分类', trigger: 'change' }],
pid: [{ required: true, message: '请选择上级分类', trigger: 'change' }]
}
defaultProps: { children: 'children', label: 'cnName' }
}
},
computed: {
},
methods: {
filterData(data) {
return data.filter(node => {
if (node.children && node.children.length > 0) {
node.children = this.filterData(node.children) //
}
return node.isType !== 3 // isType3
})
},
//
findNode(tree, func) {
for (const node of tree) {
@ -223,46 +78,47 @@ export default {
}
},
[CRUD.HOOK.afterRefresh]() {
let currentKey
if (localStorage.getItem('currentCategoryKey')) {
currentKey = JSON.parse(localStorage.getItem('currentCategoryKey'))
} else {
if (this.crud.data[0].isType === 1) {
currentKey = this.findNode(this.crud.data[0].children, (node) => {
return node.isType !== 1
})
this.crud.data = this.filterData(this.crud.data)
this.$nextTick(() => {
let currentKey
if (localStorage.getItem('scopeCategoryKey')) {
currentKey = JSON.parse(localStorage.getItem('scopeCategoryKey'))
} else {
currentKey = this.crud.data[0]
if (this.crud.data[0].isType === 1) {
currentKey = this.findNode(this.crud.data[0].children, (node) => {
return node.isType !== 1
})
} else {
currentKey = this.crud.data[0]
}
}
}
//
this.$refs.tree.setCurrentKey(currentKey.id)
this.$nextTick(() => {
//
this.$refs.tree.setCurrentKey(currentKey.id)
this.$nextTick(() => {
//
const selectedKey = this.$refs.tree.getCurrentNode()
if (this.$refs.tree.getNode(selectedKey) && this.$refs.tree.getNode(selectedKey).parent) {
this.expandParents(this.$refs.tree.getNode(selectedKey).parent)
}
//
this.handleNodeClick(selectedKey)
const selectedKey = this.$refs.tree.getCurrentNode()
if (this.$refs.tree.getNode(selectedKey) && this.$refs.tree.getNode(selectedKey).parent) {
this.expandParents(this.$refs.tree.getNode(selectedKey).parent)
}
//
this.handleNodeClick(selectedKey)
})
})
},
//
handleNodeClick(val) {
if (val) {
// this.crud.selectionChangeHandler([val])
this.selectedCategory = val
// if (val.pid !== '0') {
// Vue.set(this.selectedCategory, 'parentName', this.$refs.tree.getNode(val.pid).data.cnName)
// }
// this.changeActiveTab(0)
if (val.pid !== '0') {
Vue.set(this.selectedCategory, 'parentName', this.$refs.tree.getNode(val.pid).data.cnName)
}
//
localStorage.setItem('currentCategoryKey', JSON.stringify(val))
localStorage.setItem('scopeCategoryKey', JSON.stringify(val))
}
},
// - /
[CRUD.HOOK.beforeToAdd](crud, form, btn) {
const isCanAddKey = JSON.parse(localStorage.getItem('currentCategoryKey'))
const isCanAddKey = JSON.parse(localStorage.getItem('scopeCategoryKey'))
if (isCanAddKey.isType === 4 || isCanAddKey.isType === 5) {
this.$message({
message: '此门类下不可新建门类',
@ -276,32 +132,7 @@ export default {
[CRUD.HOOK.afterSubmit](crud, addedCategory) {
if (addedCategory) {
//
localStorage.setItem('currentCategoryKey', JSON.stringify(addedCategory))
}
},
clickRowHandler(row) {
// this.$refs.table.toggleRowSelection(row) //
},
toDelete(val) {
this.deleteVisible = true
},
handleDelConfirm() {
this.deleteVisible = false
},
//
loadCategorys({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
// crudDict.getDicts().then(res => {
// parentNode.children = res.map(function(obj) {
// if (obj.children) {
// obj.childMenus = null
// }
// return obj
// })
// setTimeout(() => {
// callback()
// }, 100)
// })
localStorage.setItem('scopeCategoryKey', JSON.stringify(addedCategory))
}
}
}
@ -321,7 +152,5 @@ export default {
.tree-scroll{
font-size: 14px;
}
.tip{
line-height: 28px;
}
</style>

531
src/views/system/archiveScopeManage/module/tableList.vue

@ -0,0 +1,531 @@
<template>
<!--用户数据-->
<div class="elect-cont-right">
<!--工具栏-->
<div class="head-container">
<crudOperation :permission="permission">
<template v-slot:left>
<el-button v-permission="permission.add" size="mini" @click="crud.toAdd">
<i class="iconfont icon-xinzeng" />
新增
</el-button>
<el-button v-permission="permission.edit" size="mini" :disabled="selections.length !== 1" @click="crud.toEdit(selections[0])">
<i class="iconfont icon-bianji" />
编辑
</el-button>
<el-button slot="reference" v-permission="permission.del" size="mini" :loading="crud.delAllLoading" :disabled="selections.length === 0" @click="toDelete(selections)">
<i class="iconfont icon-shanchu" />
删除
</el-button>
</template>
<template v-slot:right>
<el-button :loading="crud.downloadLoading" size="mini" :disabled="selections.length === 0" @click="doExport(selections)">
<i class="iconfont icon-daochu" />
导出
</el-button>
<span class="tip">注意门类节点下才可新增归档范围定义</span>
</template>
</crudOperation>
</div>
<!--表单渲染-->
<el-dialog :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title">
<div class="setting-dialog">
<el-form ref="form" :inline="true" :model="form" :rules="rules" label-width="90px">
<el-form-item v-if="crud.status.add === 1" label="所属门类" prop="categoryId">
<treeselect
v-model="form.categoryId"
:options="categoryDatas"
placeholder="选择所属门类"
flat
:multiple="false"
:normalizer="normalizer"
@select="selectCategoryTree"
/>
</el-form-item>
<el-form-item v-if="crud.status.edit === 1" label="所属门类" prop="categoryId">
<el-input v-model="form.category.cnName" disabled />
</el-form-item>
<el-form-item label="档案分类" prop="archivesClassId">
<!-- :load-options="loadClassifyTree" -->
<treeselect
v-model="form.archivesClassId"
:options="classifyOptions"
:normalizer="classifyNormalizer"
placeholder="选择门类之后再选择档案分类"
/>
</el-form-item>
<el-form-item label="名称" prop="scopeName">
<el-input v-model="form.scopeName" />
</el-form-item>
<el-form-item label="编码" prop="scopeCode">
<el-input v-model="form.scopeCode" />
</el-form-item>
<el-form-item label="顶级范围" prop="isTop">
<el-radio-group v-model="form.isTop" @input="changeIsTop">
<el-radio label="1"></el-radio>
<el-radio label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="保管期限" prop="retention">
<el-select v-model="form.retention" placeholder="请选择" style="width:225px;">
<el-option v-for="item in periodOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item
v-if="form.isTop === '0'"
label="上级分类"
prop="pid"
>
<!-- :load-options="loadScopeTree" -->
<treeselect
v-model="form.pid"
:options="scopes"
placeholder="选择门类之后再选择上级范围"
:normalizer="scopeNormalizer"
style="width: 584px;"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确定</el-button>
</div>
</div>
</el-dialog>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
lazy
:data="tableData"
:row-key="getRowKey"
:load="getSonClass"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
highlight-current-row
@select-all="selectAll"
@select="selectTr"
@selection-change="selectionChangeHandler"
@row-click="clickRowHandler"
>
<el-table-column type="selection" align="center" width="55" />
<el-table-column :show-overflow-tooltip="true" prop="scopeCode" label="编码" />
<el-table-column :show-overflow-tooltip="true" prop="scopeName" label="名称" />
<el-table-column :show-overflow-tooltip="true" prop="retention" label="保管期限">
<template slot-scope="scope">
<div>{{ scope.row.retention === 0 ? '永久' : scope.row.retention === 1 ? '定期30年' : '定期10年' }}</div>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="category" label="所属门类">
<template slot-scope="scope">
<div v-if="scope.row.category">{{ scope.row.category.cnName }}</div>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="archivesClass" label="所属分类">
<template slot-scope="scope">
<div v-if="scope.row.archivesClass">{{ scope.row.archivesClass.name }}</div>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination v-if="tableData.length !== 0" />
</div>
</template>
<script>
import { FetchCategoryMenu } from '@/api/system/category/category'
import { FetchArchivesClassTree } from '@/api/system/archivesClass'
import crudScope from '@/api/system/archivesScope'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
// import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import { exportFile } from '@/utils/index'
import qs from 'qs'
import { mapGetters } from 'vuex'
const defaultForm = {
id: null,
categoryId: null,
archivesClassId: null,
scopeName: null,
scopeCode: null,
isTop: '1',
pid: null,
retention: 0
}
export default {
name: 'Classify',
components: { crudOperation, pagination, Treeselect },
cruds() {
return CRUD({ title: '范围', url: 'api/archivesScope/initArchivesScope', crudMethod: { ...crudScope }, optShow: {
add: false,
edit: false,
del: false,
reset: false,
download: false,
group: false
}})
},
mixins: [presenter(), header(), form(defaultForm), crud()],
props: {
selectedCategory: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
tableData: [],
classifyOptions: [],
categoryDatas: [],
scopes: [],
selections: [],
isAllSelect: false,
rules: {
categoryId: [{ required: true, message: '请选择所属门类', trigger: 'change' }],
archivesClassId: [{ required: true, message: '请选择档案分类', trigger: 'change' }],
scopeCode: [{ required: true, message: '编码不可为空', trigger: 'blur' }],
scopeName: [{ required: true, message: '名称不可为空', trigger: 'blur' }],
isTop: [{ required: true, message: '请选择是否为顶级分类', trigger: 'change' }],
pid: [{ required: true, message: '请选择上级分类', trigger: 'change' }],
retention: [{ required: true, message: '请选择保管期限', trigger: 'change' }]
},
permission: {
add: ['admin', 'scope:add'],
edit: ['admin', 'scope:edit'],
del: ['admin', 'scope:del']
},
defaultProps: {
children: 'children',
label: 'cnName'
},
periodOptions: [
{
value: 0,
label: '永久'
},
{
value: 1,
label: '定期30年'
},
{
value: 2,
label: '定期10年'
}
]
}
},
computed: {
...mapGetters([
'baseApi'
])
},
watch: {
selectedCategory: function(newValue, oldValue) {
this.crud.refresh()
}
},
created() {
},
methods: {
getRowKey(row) {
return row.id
},
//
[CRUD.HOOK.beforeRefresh]() {
this.tableData = []
this.crud.query.categoryId = this.selectedCategory.id
},
[CRUD.HOOK.afterRefresh](crud) {
crud.data.forEach(function(item, index) {
if (item.sonNum !== 0) {
item.hasChildren = true
item.children = null
} else {
item.hasChildren = false
}
})
this.tableData = this.crud.data
},
//
[CRUD.HOOK.afterValidateCU](crud) {
console.log(crud.form)
delete crud.form.isTop
return true
},
changeIsTop(val) {
if (this.crud.status.edit) {
if (val === '1') {
this.form.pid = null
}
}
},
//
[CRUD.HOOK.afterToCU](crud, form) {
this.getCategoryDataTree()
if (this.crud.status.edit) {
this.form.categoryId = this.form.category.id
this.form.archivesClassId = this.form.archivesClass.id
this.getScopeTree(this.form.category.id)
this.getClassifyTree(this.form.category.id)
} else {
this.form.categoryId = null
this.scopes = []
}
if (form.id != null) {
if (form.pid === null) {
form.isTop = '1'
} else {
form.isTop = '0'
}
}
},
selectCategoryTree(val) {
console.log(val)
// this.form.categoryId = val.id
this.getScopeTree(val.id)
this.getClassifyTree(val.id)
},
filterData(data) {
return data.filter(node => {
if (node.children && node.children.length > 0) {
node.children = this.filterData(node.children) //
}
return node.isType !== 3 // isType3
})
},
getCategoryDataTree() {
FetchCategoryMenu().then(res => {
this.categoryDatas = this.filterData(res)
})
},
getClassifyTree(categoryId) {
FetchArchivesClassTree({ 'categoryId': categoryId }).then(res => {
this.classifyOptions = res.map(function(obj) {
if (obj.childArchivesClass !== null) {
obj.hasChildren = true
} else {
obj.hasChildren = false
}
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
// loadClassifyTree({ action, parentNode, callback }) {
// if (action === LOAD_CHILDREN_OPTIONS) {
// FetchArchivesClassTree().then(res => {
// parentNode.children = res.map(function(obj) {
// if (obj.childArchivesClass !== 0) {
// obj.hasChildren = true
// } else {
// obj.hasChildren = false
// }
// if (obj.hasChildren) {
// obj.children = null
// }
// return obj
// })
// setTimeout(() => {
// callback()
// }, 100)
// })
// }
// },
getSonClass(tree, treeNode, resolve) {
setTimeout(() => {
crudScope.FetchSonArchivesScope({ pid: tree.id }).then(res => {
const data = res.map(function(obj) {
if (obj.sonNum !== 0 && obj.sonNum) {
obj.hasChildren = true
obj.children = null
} else {
obj.hasChildren = false
}
return obj
})
resolve(data)
})
}, 100)
},
getScopeTree(categoryId) {
crudScope.FetchArchivesScopeTree({ 'categoryId': categoryId }).then(res => {
this.scopes = res.map(function(obj) {
if (obj.childArchivesClass !== null) {
obj.hasChildren = true
} else {
obj.hasChildren = false
}
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
//
// loadScopeTree({ action, parentNode, callback }) {
// if (action === LOAD_CHILDREN_OPTIONS) {
// crudScope.FetchArchivesScopeTree().then(res => {
// parentNode.children = res.map(function(obj) {
// if (obj.childArchivesClass !== 0) {
// obj.hasChildren = true
// } else {
// obj.hasChildren = false
// }
// if (obj.hasChildren) {
// obj.children = null
// }
// return obj
// })
// setTimeout(() => {
// callback()
// }, 100)
// })
// }
// },
selectAll() {
this.isAllSelect = !this.isAllSelect
const data = this.tableData
this.toggleSelect(data, this.isAllSelect, 'all')
},
//
selectTr(selection, row) {
this.$set(row, 'isChecked', !row.isChecked)
this.$nextTick(() => {
this.isAllSelect = row.isChecked
this.toggleSelect(row, row.isChecked, 'tr')
})
},
//
toggleSelect(data, flag, type) {
if (type === 'all') {
if (data.length > 0) {
data.forEach((item) => {
this.toggleSelection(item, flag)
if (item.children && item.children.length > 0) {
this.toggleSelect(item.children, flag, type)
}
})
}
} else {
if (data.children && data.children.length > 0) {
data.children.forEach((item) => {
item.isChecked = flag
this.$refs.table.toggleRowSelection(item, flag)
this.toggleSelect(item, flag, type)
})
}
}
},
//
toggleSelection(row, flag) {
this.$set(row, 'isChecked', flag)
this.$nextTick(() => {
if (flag) {
this.$refs.table.toggleRowSelection(row, flag)
} else {
this.$refs.table.clearSelection()
}
})
},
// table - row
clickRowHandler(row) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(row)
},
selectionChangeHandler(val) {
this.selections = val
},
doExport(data) {
crud.downloadLoading = true
this.$confirm('此操作将导出所选数据' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
const ids = []
data.forEach(val => {
ids.push(val.id)
})
const params = {
'classIds': ids
}
exportFile(this.baseApi + '/api/archivesScope/download?' + qs.stringify(params, { indices: false }))
}).catch(() => {
})
},
toDelete(datas) {
this.$confirm('此操作将删除当前所选' + this.crud.title + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
this.crud.delAllLoading = true
const ids = []
datas.forEach(val => {
ids.push(val.id)
})
// const params = {
// 'scopeIds': ids
// }
crudScope.del(ids).then(() => {
this.crud.notify('删除成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.delAllLoading = false
this.crud.refresh()
}).catch(err => {
this.crud.delAllLoading = false
console.log(err)
})
}).catch(() => {
})
},
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.id,
label: node.cnName,
children: node.children,
isDisabled: node.isType !== 2
}
},
classifyNormalizer(node) {
if (node.childArchivesClass && !node.childArchivesClass.length) {
delete node.childArchivesClass
}
return {
id: node.id,
label: node.name,
children: node.childArchivesClass
}
},
scopeNormalizer(node) {
if (node.archivesScopeDTOs && !node.archivesScopeDTOs.length) {
delete node.archivesScopeDTOs
}
return {
id: node.id,
label: node.scopeName,
children: node.archivesScopeDTOs
}
}
}
}
</script>
<style lang="scss" scoped>
.tip{
line-height: 28px;
}
</style>

43
src/views/system/archivesClassify/module/tableList.vue

@ -45,6 +45,7 @@
flat
:multiple="false"
:normalizer="normalizer"
@select="selectCategoryTree"
/>
</el-form-item>
<el-form-item v-if="crud.status.edit === 1" label="所属门类" prop="categoryId">
@ -76,12 +77,12 @@
label="上级分类"
prop="pid"
>
<!-- :load-options="loadClassifyTree" -->
<treeselect
v-model="form.pid"
:load-options="loadClassifyTree"
:options="classifyOptions"
:normalizer="classifyNormalizer"
placeholder="选择上级类目"
placeholder="选择门类之后再选择上级范围"
/>
</el-form-item>
</el-row>
@ -247,7 +248,12 @@ export default {
//
[CRUD.HOOK.afterToCU](crud, form) {
this.getCategoryDataTree()
this.getClassifyTree()
if (this.crud.status.edit) {
this.getClassifyTree(this.form.categoryId)
} else {
this.form.categoryId = null
this.classifyOptions = []
}
if (form.id != null) {
if (form.pid === null) {
form.isTop = '1'
@ -256,6 +262,10 @@ export default {
}
}
},
selectCategoryTree(val) {
console.log(val)
this.getClassifyTree(val.id)
},
filterData(data) {
return data.filter(node => {
if (node.children && node.children.length > 0) {
@ -269,8 +279,8 @@ export default {
this.categoryDatas = this.filterData(res)
})
},
getClassifyTree() {
crudClassify.FetchArchivesClassTree().then(res => {
getClassifyTree(categoryId) {
crudClassify.FetchArchivesClassTree({ 'categoryId': categoryId }).then(res => {
this.classifyOptions = res.map(function(obj) {
if (obj.childArchivesClass !== null) {
obj.hasChildren = true
@ -393,6 +403,29 @@ export default {
}).catch(() => {
})
},
toDelete(datas) {
this.$confirm('此操作将删除当前所选' + this.crud.title + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
this.crud.delAllLoading = true
const ids = []
datas.forEach(val => {
ids.push(val.id)
})
crudClassify.del(ids).then(() => {
this.crud.notify('删除成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.delAllLoading = false
this.crud.refresh()
}).catch(err => {
this.crud.delAllLoading = false
console.log(err)
})
}).catch(() => {
})
},
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children

164
src/views/system/fieldCorresManage/index.vue

@ -103,9 +103,9 @@
<script>
//
import { FetchDocumentMenu, FetchInitDocumentFieldByPid } from '@/api/system/fileLibrary/fileLibrary'
import { FetchDocumentMenu, FetchInitDocumentFieldByPid, FetchInitDocumentField } from '@/api/system/fileLibrary/fileLibrary'
//
import { FetchCategoryMenu, FetchInitCategoryFieldByPid } from '@/api/system/category/category'
import { FetchCategoryMenu, FetchInitCategoryFieldByPid, FetchInitCategoryField } from '@/api/system/category/category'
import crudFieldMate from '@/api/system/fieldMate'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
@ -163,9 +163,6 @@ export default {
this.getDocumentDataTree()
},
methods: {
//
[CRUD.HOOK.afterToCU](crud, form) {
},
filterData(data) {
return data.filter(node => {
if (node.children && node.children.length > 0) {
@ -182,67 +179,41 @@ export default {
getDocumentDataTree() {
FetchDocumentMenu().then(res => {
this.documentTree = this.filterData(res)
// this.documentTree = res
})
},
// getDisplayFieldData(id) {
// FetchInitDocumentField({ documentId: id, isType: 2 }).then((res) => {
// })
// },
handleSelectCategory(val) {
console.log(val)
this.selectedCategoryName = val.cnName
},
handleSelectDocument(val) {
console.log(val)
this.selectedDocumentName = val.cnName
},
toCorresForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
console.log(this.form)
crudFieldMate.FetchCheckRepeat(this.form).then((res) => {
this.$refs.corresForm.corresVisible = true
if (res) {
this.$refs.corresForm.isHasCorres = 0
this.initFiledList(this.form.documentId, this.form.categoryId)
if (res === {}) {
//
this.$refs.corresForm.corresVisible = true
this.$refs.corresForm.documentName = this.selectedDocumentName
this.$refs.corresForm.cuform.documentId = this.form.documentId
this.$refs.corresForm.categoryName = this.selectedCategoryName
FetchInitDocumentFieldByPid({ documentId: this.form.documentId }).then((res) => {
console.log('field', res)
this.$refs.corresForm.options = res
}).catch(err => {
console.log(err)
})
FetchInitCategoryFieldByPid({ categoryId: this.form.categoryId }).then((res) => {
console.log('field2', res)
this.$refs.corresForm.targetData = res
res.forEach((item, index) => {
console.log('dd', item.isDisplay)
this.$refs.corresForm.selectStatus.push({ mode: true, value: '', isDisplay: item.isDisplay })
})
}).catch(err => {
this.$refs.corresForm.cuform.categoryId = this.form.categoryId
} else {
//
this.$confirm('当前所选存在对应关系,点击继续会进入编辑操作' + this.crud.title + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
this.$refs.corresForm.title = '编辑对应关系'
this.$refs.corresForm.corresVisible = true
this.editGetMate(res.id)
}).catch((err) => {
console.log(err)
})
// FetchInitDocumentField({ documentId: this.form.documentId, isType: 2 }).then((res) => {
// console.log('field', res)
// }).catch(err => {
// console.log(err)
// })
} else {
this.$refs.corresForm.isHasCorres = 1
// const params = {
// 'id': '1'
// }
// crudFieldMate.FetchInitFieldMate(params).then((res) => {
// this.$refs.corresForm.cuform = res
// this.$refs.corresForm.targetData = res
// }).catch(err => {
// console.log(err)
// })
}
}).catch(err => {
console.log(err)
})
} else {
console.log('error submit!!')
@ -250,24 +221,101 @@ export default {
}
})
},
// pid
initFiledList(documentId, categoryId) {
this.$refs.corresForm.selectStatus = []
this.$refs.corresForm.leftLoading = true
this.$refs.corresForm.rightLoading = true
//
FetchInitDocumentFieldByPid({ documentId: documentId, isType: 2 }).then((res) => {
this.$refs.corresForm.options = res.sort((a, b) => {
if (a.isDisplay !== b.isDisplay) {
return a.isDisplay ? -1 : 1
} else {
return a.isSequence - b.isSequence
}
})
this.$refs.corresForm.leftLoading = false
})
//
FetchInitCategoryFieldByPid({ categoryId: categoryId, isType: 2 }).then((res) => {
this.$refs.corresForm.targetData = res.sort((a, b) => {
if (a.isDisplay !== b.isDisplay) {
return a.isDisplay ? -1 : 1
} else {
return a.isSequence - b.isSequence
}
})
res.forEach((item, index) => {
this.$refs.corresForm.selectStatus.push({ mode: true, value: '', field: item, isDisplay: item.isDisplay })
})
this.$refs.corresForm.rightLoading = false
})
},
// table -
tableDoubleClick(row) {
const params = {
'id': row.id
}
this.getInitDetail(params)
this.getInitDetail(row.id)
},
getInitDetail(params) {
crudFieldMate.FetchInitFieldMate(params).then((res) => {
getInitDetail(id) {
crudFieldMate.FetchInitFieldMate({ 'id': id }).then((res) => {
this.$refs.detail.detailVisible = true
this.$refs.detail.detailData = res
}).catch(err => {
console.log(err)
})
},
toEdit() {
this.$refs.corresForm.title = '编辑对应关系'
this.$refs.corresForm.corresVisible = true
toEdit(row) {
this.$refs.corresForm.leftLoading = true
this.$refs.corresForm.rightLoading = true
this.$refs.corresForm.selectStatus = []
FetchInitDocumentField({ documentId: row.document_id, isType: 2 }).then((res) => {
this.$refs.corresForm.options = res.sort((a, b) => {
if (a.isDisplay !== b.isDisplay) {
return a.isDisplay ? -1 : 1
} else {
return a.isSequence - b.isSequence
}
})
this.$refs.corresForm.leftLoading = false
})
//
FetchInitCategoryField({ categoryId: row.category_id, isType: 2 }).then((res) => {
this.$refs.corresForm.targetData = res.sort((a, b) => {
if (a.isDisplay !== b.isDisplay) {
return a.isDisplay ? -1 : 1
} else {
return a.isSequence - b.isSequence
}
})
res.forEach((item, index) => {
this.$refs.corresForm.selectStatus.push({ mode: true, value: '', field: item, isDisplay: item.isDisplay })
})
this.$refs.corresForm.rightLoading = false
})
this.$nextTick(() => {
this.$refs.corresForm.title = '编辑对应关系'
this.$refs.corresForm.corresVisible = true
this.editGetMate(row.id)
})
},
editGetMate(id) {
crudFieldMate.FetchInitFieldMate({ id: id }).then((res) => {
this.$refs.corresForm.cuform.id = res.id
this.$refs.corresForm.cuform.ruleName = res.ruleName
this.$refs.corresForm.documentName = res.documentName
this.$refs.corresForm.categoryName = res.categoryName
this.$refs.corresForm.cuform.documentId = res.fieldMateDetails[0].pid.documentId.pid
this.$refs.corresForm.cuform.categoryId = res.fieldMateDetails[0].pid.categoryId.pid
const getIndexByCategory = (categoryFieldId) => {
return this.$refs.corresForm.targetData.findIndex(item => item.fieldCnName === categoryFieldId)
}
res.fieldMateDetails.map(item => {
const index = getIndexByCategory(item.categoryFieldId.fieldCnName)
this.$refs.corresForm.selectStatus.splice(index, 1, { mode: false, value: item.documentFieldId.fieldCnName, field: item.documentFieldId, isDisplay: item.documentFieldId.isDisplay })
})
}).catch(err => {
console.log(err)
})
},
normalizer(node) {
if (node.children && !node.children.length) {

7
src/views/system/fieldCorresManage/module/detail.vue

@ -24,7 +24,7 @@
<p>
{{ item.documentFieldId.fieldCnName }}
</p>
<div class="field-state"><span :class=" item.isDisplay ? 'is-select' : 'is-hide'">{{ item.isDisplay ? '显示': '隐藏' }}</span></div>
<div class="field-state"><span :class=" item.documentFieldId.isDisplay ? 'is-select' : 'is-hide'">{{ item.documentFieldId.isDisplay ? '显示': '隐藏' }}</span></div>
</div>
</div>
</div>
@ -36,13 +36,13 @@
<div class="field-list">
<div v-for="(item,index) in detailData.fieldMateDetails" :key="index" class="field-item">
<p>{{ item.categoryFieldId.fieldCnName }}</p>
<div class="field-state"><span :class=" item.isDisplay ? 'is-select' : 'is-hide'">{{ item.isDisplay ? '显示': '隐藏' }}</span></div>
<div class="field-state"><span :class=" item.categoryFieldId.isDisplay ? 'is-select' : 'is-hide'">{{ item.categoryFieldId.isDisplay ? '显示': '隐藏' }}</span></div>
</div>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="detailVisible = falseS"> 确定 </el-button>
<el-button type="primary" @click="detailVisible = false"> 确定 </el-button>
</div>
</div>
</el-dialog>
@ -56,7 +56,6 @@ export default {
},
data() {
return {
title: '对应关系',
detailVisible: false,
detailData: {}
}

62
src/views/system/fieldCorresManage/module/form.vue

@ -11,7 +11,6 @@
<div class="setting-dialog">
<el-form ref="cuForm" :model="cuform" :rules="rules" inline size="small" label-width="100px">
<el-form-item label="规则名称:" prop="ruleName">
<!-- :disabled="isHasCorres" -->
<el-input v-model="cuform.ruleName" />
</el-form-item>
</el-form>
@ -21,7 +20,7 @@
<p>源分类文件库-文件表</p>
<span>{{ documentName }}</span>
</div>
<div class="field-list">
<div v-loading="leftLoading" class="field-list">
<div v-for="(item, index) in selectStatus" :key="index" class="field-item">
<el-select v-if="item.mode" :key="index" v-model="item.value" @change="selectChange(index)">
<el-option
@ -34,11 +33,11 @@
<p v-if="!item.mode" @click="textMode(index)">
{{ item.value }}
</p>
<div v-if="!item.mode" class="field-state"><span :class="item.isDisplay ? 'is-select' : 'is-hide'">{{ item.isDisplay !== null ? '显示': '隐藏' }}</span></div>
<div v-if="!item.mode" class="field-state"><span :class="item.isDisplay ? 'is-select' : 'is-hide'">{{ item.isDisplay ? '显示': '隐藏' }}</span></div>
</div>
</div>
</div>
<div class="corres-field-list corres-field-right">
<div v-loading="rightLoading" class="corres-field-list corres-field-right">
<div class="corres-field-title">
<p>目标门类整理库/管理库-文件表</p>
<span>{{ categoryName }}</span>
@ -60,21 +59,24 @@
</template>
<script>
import { edit } from '@/api/system/fieldMate'
import { crud } from '@crud/crud'
export default {
mixins: [crud()],
props: {
},
data() {
return {
isHasCorres: 0,
leftLoading: false,
rightLoading: false,
title: '新增对应关系',
documentName: null,
categoryName: null,
corresVisible: false,
cuform: {
id: null,
ruleName: ''
ruleName: '',
documentId: null,
categoryId: null,
fieldMateDetails: []
},
options: [],
selectStatus: [],
@ -87,33 +89,51 @@ export default {
}
},
created() {
},
mounted() {
this.$nextTick(() => {
console.log(this.targetData)
})
// this.targetData.forEach((item, index) => {
// this.selectStatus.push({ mode: true, value: '' })
// })
},
methods: {
selectChange(index) {
this.options.forEach((item) => {
if (item.value === this.selectStatus[index].value) {
this.selectStatus.splice(index, 1, { mode: false, value: this.selectStatus[index].value, isDisplay: item.isDisplay })
if (item.fieldCnName === this.selectStatus[index].value) {
this.selectStatus.splice(index, 1, { mode: false, value: this.selectStatus[index].value, field: item, isDisplay: item.isDisplay })
}
})
},
textMode(index) {
this.selectStatus.splice(index, 1, { mode: true, value: this.selectStatus[index].value, isDisplay: this.selectStatus[index].isDisplay })
this.selectStatus.splice(index, 1, { mode: true, value: this.selectStatus[index].value, field: null, isDisplay: this.selectStatus[index].isDisplay })
},
doSubmit() {
this.$refs['cuForm'].validate((valid) => {
console.log(this.cuform)
console.log(this.selectStatus)
this.loading = true
if (valid) {
this.loading = true
const getIndicesByMode = (modeValue) => {
return this.selectStatus.reduce((indices, item, index) => {
if (item.mode === modeValue) {
indices.push(index)
}
return indices
}, [])
}
const indices = getIndicesByMode(false)
const filteredFields = this.selectStatus.filter(field => field.value !== '')
const values = indices.map(index => this.targetData[index])
indices.forEach(i => {
const result = filteredFields.map((item, index) => ({
categoryFieldId: values[index],
documentFieldId: item.field
}))
this.cuform.fieldMateDetails = result
})
console.log(this.cuform)
edit(this.cuform).then((res) => {
this.corresVisible = false
this.crud.refresh()
this.crud.cancelCU()
}).catch(err => {
console.log(err)
})
} else {
return false
}

Loading…
Cancel
Save