Commit fea34c06 authored by 张莎莎's avatar 张莎莎

提交

parent fc124286
......@@ -31,7 +31,6 @@
ref="selectTree"
:accordion="accordion"
:data="options"
:default-expand-all="defaultExpandAll"
:props="props"
:node-key="props.value"
:default-expanded-keys="defaultExpandedKey"
......
......@@ -72,19 +72,17 @@ export const constantRoutes = [{
// }
// ]
// },
{
path: '/',
component: Layout,
redirect: '/permission/organize',
// children: [
// {
// path: 'messageReport',
// component: (resolve) => require(['@/views/messageReport'], resolve),
// name: 'messageReport',
// meta: { title: '信息填报', icon: 'index', affix: true, noCache: true, hasSubMenu: true }
// }
// ]
/* {
path: '/department',
component: (resolve) => require(['@/views/permission/department'], resolve),
name: 'department',
},
{
name:'/organize',
path: '/organize',
component: (resolve) => require(['@/views/permission/organize'], resolve),
}, */
{
path: '/loading',
component: (resolve) => require(['@/views/loading'], resolve),
......
......@@ -29,8 +29,8 @@ const actions = {
...baseRouters,
...route,
{
path: '/404',
component: (resolve) => require(['@/views/error-page/404'], resolve),
path: '/permission/department',
component: (resolve) => require(['@/views/permission/department'], resolve),
hidden: true
}
]
......@@ -39,7 +39,7 @@ const actions = {
dtRoutes,
{
path: '*',
redirect: '/404',
redirect: '/permission/department',
hidden: true
}
]
......
......@@ -20,13 +20,13 @@
</div>
<el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading">
<el-tree ref="treeBox" :data="treeData" :props="defaultProps"
highlight-current :expand-on-click-node="false" node-key="id"
highlight-current :expand-on-click-node="false" node-key="id" :render-content="renderContent"
@node-click="handleNodeClick" class="JNPF-common-el-tree" v-if="refreshTree"
:filter-node-method="filterNode">
<span class="custom-tree-node" slot-scope="{ data }" :title="data.fullName">
<!-- <span class="custom-tree-node" slot-scope="{ data }" :title="data.fullName">
<i :class="data.icon" />
<span class="text" :title="data.fullName" :class="{ 'disabled-node': data.id === null }">{{data.fullName}}</span>
</span>
</span>-->
</el-tree>
</el-scrollbar>
</div>
......@@ -62,7 +62,7 @@
<JNPF-table v-loading="listLoading" :data="tableData" row-key="id" default-expand-all
:tree-props="{children: 'children', hasChildren: ''}">
<el-table-column prop="fullName" label="部门名称" />
<el-table-column prop="enCode" label="部门编码" />
<!-- <el-table-column prop="enCode" label="部门编码" />-->
<el-table-column prop="manager" label="部门主管" />
<el-table-column prop="creatorTime" label="创建时间" :formatter="jnpf.tableDateFormat"
width="120" />
......@@ -143,6 +143,31 @@ export default {
this.getOrganizeList(true)
},
methods: {
renderContent(h, { node, data, store }) {
return h('span', {
class: {
'custom-tree-node': true,
'disabled-node': data.id === null
},
attrs: {
title: data.fullName
},
on: {
click: (e) => {
e.stopPropagation();
// 切换展开状态
node.expanded = !node.expanded;
// 如果是点击文字切换组织
this.handleNodeClick(data);
}
}
}, [
h('i', { class: data.icon }),
h('span', { class: 'text' }, node.label)
]);
},
showDiagram() {
this.diagramVisible = true
this.$nextTick(() => {
......@@ -217,13 +242,21 @@ export default {
})
},
handleNodeClick(data) {
if (this.companyId === data.id) return
/* if (this.companyId === data.id) return
if (data.id === null) {
this.$message.warning('这一级不能点击');
return;
}
this.companyId = data.id
this.reset()
this.reset() */
if (this.companyId === data.id) return
if (data.id === null) {
}else{
this.companyId= data.id
this.type = data.type
this.reset()
}
},
addOrUpdateHandle(id) {
this.formVisible = true
......
......@@ -33,7 +33,7 @@
<!-- <el-input v-model="dataForm.relation" placeholder="输入上级单位关联关系" />-->
<el-select v-model="dataForm.relation" placeholder="请选择">
<el-option
v-for="item in relationData"
v-for="item in relativeData"
:key="item.enCode"
:label="item.fullName"
:value="parseInt(item.enCode)">
......@@ -173,7 +173,7 @@ import {
} from '@/api/permission/organize'
export default {
props:['typeData'],
props:['typeData','relativeData'],
data() {
return {
......@@ -181,7 +181,7 @@ export default {
strInfo:'教育行政机构代码/学校标识码',
btnLoading: false,
formLoading: false,
relationData:[],
/* relationData:[], */
isEdit:false,
dataForm: {
id: '',
......@@ -280,10 +280,10 @@ export default {
/*查询上下级关系接口*/
getrelativeData().then((res)=>{
/* getrelativeData().then((res)=>{
console.log(res)
this.relationData=res.data.list;
})
}) */
if (this.dataForm.id) {
/*this.formLoading = true*/
/*this.isEdit=true;*/
......
......@@ -39,18 +39,19 @@
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="treeList" row-key="id" v-if="refreshTable"
:default-expand-all="expands" :tree-props="{children: 'children', hasChildren: ''}">
<JNPF-table v-loading="listLoading" :data="treeList" row-key="fullName" v-if="refreshTable"
:tree-props="{children: 'children', hasChildren: ''}">
<el-table-column prop="fullName" label="名称" />
<el-table-column prop="shortName" label="简称" />
<el-table-column prop="systemCode" label="教育行政机构代码/学校标识码" />
<el-table-column prop="relation" label="上级单位关联关系" :formatter="personFormatter"/>
<el-table-column prop="genre" label="机构类型" :formatter="typeFormatter"/>
<el-table-column prop="address" label="机构地址" />
<!-- <el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间"
width="120" />
<el-table-column prop="sortCode" label="排序" width="70" align="center" />-->
<el-table-column label="操作" width="150">
<template slot-scope="scope">
<el-table-column label="操作" width="150 ">
<template slot-scope="scope" >
<div v-if="scope.row.id!=null">
<tableOpts @edit="addOrUpdateHandle(scope.row.id)" @del="handleDel(scope.row.id)">
<el-dropdown hide-on-click>
<span class="el-dropdown-link">
......@@ -65,12 +66,13 @@
</el-dropdown-menu>
</el-dropdown>
</tableOpts>
</div>
</template>
</el-table-column>
</JNPF-table>
</div>
</div>
<Form v-show="formVisible" ref="Form" @close="closeForm" :typeData="typeDataInfo"/>
<Form v-show="formVisible" ref="Form" @close="closeForm" :relativeData="relativeInfo" :typeData="typeDataInfo"/>
<gradeForm v-if="gradeFormVisible" ref="gradeForm" @close="gradeFormVisible=false" />
</div>
</template>
......@@ -78,7 +80,7 @@
<script>
import {
getOrganizeList,
delOrganize, gettypeData, ceshi, getOrganizezuzhi
delOrganize, gettypeData, ceshi, getOrganizezuzhi, getrelativeData
} from '@/api/permission/organize'
import Form from './Form'
import GradeForm from './GradeForm'
......@@ -92,6 +94,7 @@ export default {
listQuery: {
keyword: ''
},
relativeInfo:[],
typeDataInfo:[],
treeList: [],
expands: false,
......@@ -106,11 +109,28 @@ export default {
this.initData()
},
methods: {
personFormatter(row){
let str=''
if(row.relation){
this.relativeInfo.map((item,index)=>{
if(Number(item.enCode)==row.relation){
str=item.fullName
}
})
return str
}else{
return ''
}
},
initData() {
this.listLoading= true
this.organizeId=this.$store.state.user.userInfo.organizeId;
if(this.organizeId=='96240625-934F-490B-8AA6-0BC775B18468'){
getOrganizezuzhi(this.listQuery).then(res => {
/* 上下级关系 */
getrelativeData().then((res)=>{
this.relativeInfo=res.data.list;
})
getOrganizeList(this.listQuery).then(res => {
let data=res.data.list
// 递归处理函数
function processObject(obj) {
......@@ -132,6 +152,7 @@ export default {
// 处理所有顶层对象
data.forEach(item => processObject(item));
console.log(data,'vvvvvvvvvvvv')
this.treeList=data
/* this.treeList=processData(res.data.list)*/
......@@ -141,28 +162,7 @@ export default {
this.listLoading = false
this.btnLoading = false
})
}else{
getOrganize(this.organizeId).then(res => {
console.log(res,'ggggggggggg')
this.listLoading = false
this.btnLoading = false
this.treeList = res.data
/* this.$nextTick(() => {
if (!this.treeData.length) {
this.treeLoading = false
this.listLoading = false
return
}
if (isInit) this.listQuery.organizeId = this.treeData[0].id
this.$refs.treeBox.setCurrentKey(this.treeData[0].id)
this.treeLoading = false
if (isInit) this.initData()
})*/
}).catch(() => {
this.listLoading = false
this.btnLoading = false
})
}
/*查询机构接口*/
gettypeData().then((res)=>{
......
......@@ -20,13 +20,13 @@
</div>
<el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading">
<el-tree ref="treeBox" :data="treeData" :props="defaultProps"
highlight-current :expand-on-click-node="false" node-key="id"
highlight-current :expand-on-click-node="false" node-key="id" :render-content="renderContent"
@node-click="handleNodeClick" class="JNPF-common-el-tree" v-if="refreshTree"
:filter-node-method="filterNode">
<span class="custom-tree-node" slot-scope="{ data }" :title="data.fullName">
<!-- <span class="custom-tree-node" slot-scope="{ data }" :title="data.fullName">
<i :class="data.icon" />
<span class="text" :title="data.fullName" :class="{ 'disabled-node': data.id === null }">{{data.fullName}}</span>
</span>
</span>-->
</el-tree>
</el-scrollbar>
</div>
......@@ -61,7 +61,7 @@
</div>
<JNPF-table v-loading="listLoading" :data="tableData">
<el-table-column prop="fullName" label="岗位名称" width="200" />
<el-table-column prop="enCode" label="岗位编码" width="150" />
<!-- <el-table-column prop="enCode" label="岗位编码" width="150" />-->
<el-table-column prop="type" label="岗位类型" width="100" />
<el-table-column prop="department" label="所属组织" min-width="150" show-overflow-tooltip />
<el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间"
......@@ -145,6 +145,31 @@ export default {
this.getOrganizeList(true)
},
methods: {
renderContent(h, { node, data, store }) {
return h('span', {
class: {
'custom-tree-node': true,
'disabled-node': data.id === null
},
attrs: {
title: data.fullName
},
on: {
click: (e) => {
e.stopPropagation();
// 切换展开状态
node.expanded = !node.expanded;
// 如果是点击文字切换组织
this.handleNodeClick(data);
}
}
}, [
h('i', { class: data.icon }),
h('span', { class: 'text' }, node.label)
]);
},
showDiagram() {
this.diagramVisible = true
this.$nextTick(() => {
......@@ -252,12 +277,16 @@ export default {
handleNodeClick(data) {
if (this.listQuery.organizeId === data.id) return
if (data.id === null) {
this.$message.warning('这一级不能点击');
return;
}else{
this.listQuery.organizeId = data.id
this.type = data.type
this.reset()
}
this.listQuery.organizeId = data.id
/* this.listQuery.organizeId = data.id
this.type = data.type
this.reset()
this.reset() */
},
addOrUpdateHandle(id) {
this.formVisible = true
......
......@@ -20,13 +20,13 @@
</div>
<el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading">
<el-tree ref="treeBox" :data="treeData" :props="defaultProps" :default-expanded-keys="expandedKeys"
highlight-current :expand-on-click-node="false" node-key="id"
highlight-current :expand-on-click-node="false" node-key="id" :render-content="renderContent"
@node-click="handleNodeClick" class="JNPF-common-el-tree" v-if="refreshTree"
:filter-node-method="filterNode">
<span class="custom-tree-node" slot-scope="{ data, node }" :title="data.fullName">
<!-- <span class="custom-tree-node" slot-scope="{ data, node }" :title="data.fullName">
<i :class="data.icon" />
<span class="text" :title="data.fullName" :class="{ 'disabled-node': data.id === null }">{{node.label}}</span>
</span>
</span>-->
</el-tree>
</el-scrollbar>
</div>
......@@ -227,6 +227,31 @@ export default {
this.getOrganizeList(true)
},
methods: {
renderContent(h, { node, data, store }) {
return h('span', {
class: {
'custom-tree-node': true,
'disabled-node': data.id === null
},
attrs: {
title: data.fullName
},
on: {
click: (e) => {
e.stopPropagation();
// 切换展开状态
node.expanded = !node.expanded;
// 如果是点击文字切换组织
this.handleNodeClick(data);
}
}
}, [
h('i', { class: data.icon }),
h('span', { class: 'text' }, node.label)
]);
},
showDiagram() {
this.diagramVisible = true
this.$nextTick(() => {
......@@ -295,6 +320,7 @@ export default {
this.organizeId=this.$store.state.user.userInfo.organizeId;
if(this.organizeId=='96240625-934F-490B-8AA6-0BC775B18468'){
getOrganizeList().then(res => {
let topItem = {
fullName: "全部",
hasChildren: true,
......@@ -390,13 +416,14 @@ export default {
handleNodeClick(data) {
if (this.listQuery.organizeId === data.id) return
if (data.id === null) {
this.$message.warning('这一级不能点击');
return;
}else{
this.listQuery.organizeId = data.id
this.type = data.type
this.reset()
}
this.listQuery.organizeId = data.id
this.type = data.type
this.reset()
},
addOrUpdateHandle(id) {
this.formVisible = true
......
......@@ -245,7 +245,33 @@ export default {
this.loading=true;
if(organizeId=='96240625-934F-490B-8AA6-0BC775B18468'){
getOrganizeList().then(res => {
this.treeData = res.data.list
/* this.treeData = res.data.list */
function removeDepartments(data) {
// 遍历数组中的每个对象
for (let i = 0; i < data.length; i++) {
const item = data[i];
// 如果当前对象有children数组
if (item.children && Array.isArray(item.children)) {
// 过滤掉fullName为"各处室"的项
item.children = item.children.filter(child => child.fullName !== "各处室");
// 递归处理剩余的children
item.children.forEach(child => {
if (child.children) {
removeDepartments([child]);
}
});
}
}
return data;
}
// 使用示例
const processedData = removeDepartments(res.data.list);
console.log(processedData);
this.treeData=processedData;
this.allList = this.treeToArray(this.treeData)
this.loading=false;
})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment