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

提交

parent fc124286
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
ref="selectTree" ref="selectTree"
:accordion="accordion" :accordion="accordion"
:data="options" :data="options"
:default-expand-all="defaultExpandAll"
:props="props" :props="props"
:node-key="props.value" :node-key="props.value"
:default-expanded-keys="defaultExpandedKey" :default-expanded-keys="defaultExpandedKey"
......
...@@ -72,19 +72,17 @@ export const constantRoutes = [{ ...@@ -72,19 +72,17 @@ export const constantRoutes = [{
// } // }
// ] // ]
// }, // },
{ /* {
path: '/', path: '/department',
component: Layout, component: (resolve) => require(['@/views/permission/department'], resolve),
redirect: '/permission/organize', name: 'department',
// children: [
// {
// path: 'messageReport',
// component: (resolve) => require(['@/views/messageReport'], resolve),
// name: 'messageReport',
// meta: { title: '信息填报', icon: 'index', affix: true, noCache: true, hasSubMenu: true }
// }
// ]
}, },
{
name:'/organize',
path: '/organize',
component: (resolve) => require(['@/views/permission/organize'], resolve),
}, */
{ {
path: '/loading', path: '/loading',
component: (resolve) => require(['@/views/loading'], resolve), component: (resolve) => require(['@/views/loading'], resolve),
......
...@@ -29,8 +29,8 @@ const actions = { ...@@ -29,8 +29,8 @@ const actions = {
...baseRouters, ...baseRouters,
...route, ...route,
{ {
path: '/404', path: '/permission/department',
component: (resolve) => require(['@/views/error-page/404'], resolve), component: (resolve) => require(['@/views/permission/department'], resolve),
hidden: true hidden: true
} }
] ]
...@@ -39,7 +39,7 @@ const actions = { ...@@ -39,7 +39,7 @@ const actions = {
dtRoutes, dtRoutes,
{ {
path: '*', path: '*',
redirect: '/404', redirect: '/permission/department',
hidden: true hidden: true
} }
] ]
......
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
</div> </div>
<el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading"> <el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading">
<el-tree ref="treeBox" :data="treeData" :props="defaultProps" <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" @node-click="handleNodeClick" class="JNPF-common-el-tree" v-if="refreshTree"
:filter-node-method="filterNode"> :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" /> <i :class="data.icon" />
<span class="text" :title="data.fullName" :class="{ 'disabled-node': data.id === null }">{{data.fullName}}</span> <span class="text" :title="data.fullName" :class="{ 'disabled-node': data.id === null }">{{data.fullName}}</span>
</span> </span>-->
</el-tree> </el-tree>
</el-scrollbar> </el-scrollbar>
</div> </div>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<JNPF-table v-loading="listLoading" :data="tableData" row-key="id" default-expand-all <JNPF-table v-loading="listLoading" :data="tableData" row-key="id" default-expand-all
:tree-props="{children: 'children', hasChildren: ''}"> :tree-props="{children: 'children', hasChildren: ''}">
<el-table-column prop="fullName" label="部门名称" /> <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="manager" label="部门主管" />
<el-table-column prop="creatorTime" label="创建时间" :formatter="jnpf.tableDateFormat" <el-table-column prop="creatorTime" label="创建时间" :formatter="jnpf.tableDateFormat"
width="120" /> width="120" />
...@@ -143,6 +143,31 @@ export default { ...@@ -143,6 +143,31 @@ export default {
this.getOrganizeList(true) this.getOrganizeList(true)
}, },
methods: { 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() { showDiagram() {
this.diagramVisible = true this.diagramVisible = true
this.$nextTick(() => { this.$nextTick(() => {
...@@ -217,13 +242,21 @@ export default { ...@@ -217,13 +242,21 @@ export default {
}) })
}, },
handleNodeClick(data) { handleNodeClick(data) {
if (this.companyId === data.id) return /* if (this.companyId === data.id) return
if (data.id === null) { if (data.id === null) {
this.$message.warning('这一级不能点击'); this.$message.warning('这一级不能点击');
return; return;
} }
this.companyId = data.id this.companyId = data.id
this.reset() */
if (this.companyId === data.id) return
if (data.id === null) {
}else{
this.companyId= data.id
this.type = data.type
this.reset() this.reset()
}
}, },
addOrUpdateHandle(id) { addOrUpdateHandle(id) {
this.formVisible = true this.formVisible = true
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<!-- <el-input v-model="dataForm.relation" placeholder="输入上级单位关联关系" />--> <!-- <el-input v-model="dataForm.relation" placeholder="输入上级单位关联关系" />-->
<el-select v-model="dataForm.relation" placeholder="请选择"> <el-select v-model="dataForm.relation" placeholder="请选择">
<el-option <el-option
v-for="item in relationData" v-for="item in relativeData"
:key="item.enCode" :key="item.enCode"
:label="item.fullName" :label="item.fullName"
:value="parseInt(item.enCode)"> :value="parseInt(item.enCode)">
...@@ -173,7 +173,7 @@ import { ...@@ -173,7 +173,7 @@ import {
} from '@/api/permission/organize' } from '@/api/permission/organize'
export default { export default {
props:['typeData'], props:['typeData','relativeData'],
data() { data() {
return { return {
...@@ -181,7 +181,7 @@ export default { ...@@ -181,7 +181,7 @@ export default {
strInfo:'教育行政机构代码/学校标识码', strInfo:'教育行政机构代码/学校标识码',
btnLoading: false, btnLoading: false,
formLoading: false, formLoading: false,
relationData:[], /* relationData:[], */
isEdit:false, isEdit:false,
dataForm: { dataForm: {
id: '', id: '',
...@@ -280,10 +280,10 @@ export default { ...@@ -280,10 +280,10 @@ export default {
/*查询上下级关系接口*/ /*查询上下级关系接口*/
getrelativeData().then((res)=>{ /* getrelativeData().then((res)=>{
console.log(res) console.log(res)
this.relationData=res.data.list; this.relationData=res.data.list;
}) }) */
if (this.dataForm.id) { if (this.dataForm.id) {
/*this.formLoading = true*/ /*this.formLoading = true*/
/*this.isEdit=true;*/ /*this.isEdit=true;*/
......
...@@ -39,18 +39,19 @@ ...@@ -39,18 +39,19 @@
</el-tooltip> </el-tooltip>
</div> </div>
</div> </div>
<JNPF-table v-loading="listLoading" :data="treeList" row-key="id" v-if="refreshTable" <JNPF-table v-loading="listLoading" :data="treeList" row-key="fullName" v-if="refreshTable"
:default-expand-all="expands" :tree-props="{children: 'children', hasChildren: ''}"> :tree-props="{children: 'children', hasChildren: ''}">
<el-table-column prop="fullName" label="名称" /> <el-table-column prop="fullName" label="名称" />
<el-table-column prop="shortName" 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="genre" label="机构类型" :formatter="typeFormatter"/>
<el-table-column prop="address" label="机构地址" /> <el-table-column prop="address" label="机构地址" />
<!-- <el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间" <!-- <el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间"
width="120" /> width="120" />
<el-table-column prop="sortCode" label="排序" width="70" align="center" />--> <el-table-column prop="sortCode" label="排序" width="70" align="center" />-->
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150 ">
<template slot-scope="scope"> <template slot-scope="scope" >
<div v-if="scope.row.id!=null">
<tableOpts @edit="addOrUpdateHandle(scope.row.id)" @del="handleDel(scope.row.id)"> <tableOpts @edit="addOrUpdateHandle(scope.row.id)" @del="handleDel(scope.row.id)">
<el-dropdown hide-on-click> <el-dropdown hide-on-click>
<span class="el-dropdown-link"> <span class="el-dropdown-link">
...@@ -65,12 +66,13 @@ ...@@ -65,12 +66,13 @@
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</tableOpts> </tableOpts>
</div>
</template> </template>
</el-table-column> </el-table-column>
</JNPF-table> </JNPF-table>
</div> </div>
</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" /> <gradeForm v-if="gradeFormVisible" ref="gradeForm" @close="gradeFormVisible=false" />
</div> </div>
</template> </template>
...@@ -78,7 +80,7 @@ ...@@ -78,7 +80,7 @@
<script> <script>
import { import {
getOrganizeList, getOrganizeList,
delOrganize, gettypeData, ceshi, getOrganizezuzhi delOrganize, gettypeData, ceshi, getOrganizezuzhi, getrelativeData
} from '@/api/permission/organize' } from '@/api/permission/organize'
import Form from './Form' import Form from './Form'
import GradeForm from './GradeForm' import GradeForm from './GradeForm'
...@@ -92,6 +94,7 @@ export default { ...@@ -92,6 +94,7 @@ export default {
listQuery: { listQuery: {
keyword: '' keyword: ''
}, },
relativeInfo:[],
typeDataInfo:[], typeDataInfo:[],
treeList: [], treeList: [],
expands: false, expands: false,
...@@ -106,11 +109,28 @@ export default { ...@@ -106,11 +109,28 @@ export default {
this.initData() this.initData()
}, },
methods: { 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() { initData() {
this.listLoading= true this.listLoading= true
this.organizeId=this.$store.state.user.userInfo.organizeId; 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 let data=res.data.list
// 递归处理函数 // 递归处理函数
function processObject(obj) { function processObject(obj) {
...@@ -132,6 +152,7 @@ export default { ...@@ -132,6 +152,7 @@ export default {
// 处理所有顶层对象 // 处理所有顶层对象
data.forEach(item => processObject(item)); data.forEach(item => processObject(item));
console.log(data,'vvvvvvvvvvvv')
this.treeList=data this.treeList=data
/* this.treeList=processData(res.data.list)*/ /* this.treeList=processData(res.data.list)*/
...@@ -141,28 +162,7 @@ export default { ...@@ -141,28 +162,7 @@ export default {
this.listLoading = false this.listLoading = false
this.btnLoading = 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)=>{ gettypeData().then((res)=>{
......
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
</div> </div>
<el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading"> <el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading">
<el-tree ref="treeBox" :data="treeData" :props="defaultProps" <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" @node-click="handleNodeClick" class="JNPF-common-el-tree" v-if="refreshTree"
:filter-node-method="filterNode"> :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" /> <i :class="data.icon" />
<span class="text" :title="data.fullName" :class="{ 'disabled-node': data.id === null }">{{data.fullName}}</span> <span class="text" :title="data.fullName" :class="{ 'disabled-node': data.id === null }">{{data.fullName}}</span>
</span> </span>-->
</el-tree> </el-tree>
</el-scrollbar> </el-scrollbar>
</div> </div>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</div> </div>
<JNPF-table v-loading="listLoading" :data="tableData"> <JNPF-table v-loading="listLoading" :data="tableData">
<el-table-column prop="fullName" label="岗位名称" width="200" /> <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="type" label="岗位类型" width="100" />
<el-table-column prop="department" label="所属组织" min-width="150" show-overflow-tooltip /> <el-table-column prop="department" label="所属组织" min-width="150" show-overflow-tooltip />
<el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间" <el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间"
...@@ -145,6 +145,31 @@ export default { ...@@ -145,6 +145,31 @@ export default {
this.getOrganizeList(true) this.getOrganizeList(true)
}, },
methods: { 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() { showDiagram() {
this.diagramVisible = true this.diagramVisible = true
this.$nextTick(() => { this.$nextTick(() => {
...@@ -252,12 +277,16 @@ export default { ...@@ -252,12 +277,16 @@ export default {
handleNodeClick(data) { handleNodeClick(data) {
if (this.listQuery.organizeId === data.id) return if (this.listQuery.organizeId === data.id) return
if (data.id === null) { if (data.id === null) {
this.$message.warning('这一级不能点击');
return; }else{
}
this.listQuery.organizeId = data.id this.listQuery.organizeId = data.id
this.type = data.type this.type = data.type
this.reset() this.reset()
}
/* this.listQuery.organizeId = data.id
this.type = data.type
this.reset() */
}, },
addOrUpdateHandle(id) { addOrUpdateHandle(id) {
this.formVisible = true this.formVisible = true
......
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
</div> </div>
<el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading"> <el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading">
<el-tree ref="treeBox" :data="treeData" :props="defaultProps" :default-expanded-keys="expandedKeys" <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" @node-click="handleNodeClick" class="JNPF-common-el-tree" v-if="refreshTree"
:filter-node-method="filterNode"> :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" /> <i :class="data.icon" />
<span class="text" :title="data.fullName" :class="{ 'disabled-node': data.id === null }">{{node.label}}</span> <span class="text" :title="data.fullName" :class="{ 'disabled-node': data.id === null }">{{node.label}}</span>
</span> </span>-->
</el-tree> </el-tree>
</el-scrollbar> </el-scrollbar>
</div> </div>
...@@ -227,6 +227,31 @@ export default { ...@@ -227,6 +227,31 @@ export default {
this.getOrganizeList(true) this.getOrganizeList(true)
}, },
methods: { 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() { showDiagram() {
this.diagramVisible = true this.diagramVisible = true
this.$nextTick(() => { this.$nextTick(() => {
...@@ -295,6 +320,7 @@ export default { ...@@ -295,6 +320,7 @@ export default {
this.organizeId=this.$store.state.user.userInfo.organizeId; this.organizeId=this.$store.state.user.userInfo.organizeId;
if(this.organizeId=='96240625-934F-490B-8AA6-0BC775B18468'){ if(this.organizeId=='96240625-934F-490B-8AA6-0BC775B18468'){
getOrganizeList().then(res => { getOrganizeList().then(res => {
let topItem = { let topItem = {
fullName: "全部", fullName: "全部",
hasChildren: true, hasChildren: true,
...@@ -390,13 +416,14 @@ export default { ...@@ -390,13 +416,14 @@ export default {
handleNodeClick(data) { handleNodeClick(data) {
if (this.listQuery.organizeId === data.id) return if (this.listQuery.organizeId === data.id) return
if (data.id === null) { if (data.id === null) {
this.$message.warning('这一级不能点击');
return;
}
}else{
this.listQuery.organizeId = data.id this.listQuery.organizeId = data.id
this.type = data.type this.type = data.type
this.reset() this.reset()
}
}, },
addOrUpdateHandle(id) { addOrUpdateHandle(id) {
this.formVisible = true this.formVisible = true
......
...@@ -245,7 +245,33 @@ export default { ...@@ -245,7 +245,33 @@ export default {
this.loading=true; this.loading=true;
if(organizeId=='96240625-934F-490B-8AA6-0BC775B18468'){ if(organizeId=='96240625-934F-490B-8AA6-0BC775B18468'){
getOrganizeList().then(res => { 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.allList = this.treeToArray(this.treeData)
this.loading=false; 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