|
|
|
@ -1,100 +1,118 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<div class="app-container">
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
|
|
|
|
|
|
|
<el-form-item label="部门名称" prop="deptName">
|
|
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
|
|
v-model="queryParams.deptName"
|
|
|
|
|
|
|
|
placeholder="请输入部门名称"
|
|
|
|
|
|
|
|
clearable
|
|
|
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="状态" prop="status">
|
|
|
|
|
|
|
|
<el-select v-model="queryParams.status" placeholder="部门状态" clearable>
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="dict in dict.type.sys_normal_disable"
|
|
|
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
|
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
<div class="company" v-if="!$store.state.user.tenantId">
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-input
|
|
|
|
<el-button
|
|
|
|
style="width: 200px"
|
|
|
|
type="primary"
|
|
|
|
placeholder="公司名称"
|
|
|
|
plain
|
|
|
|
prefix-icon="el-icon-search"
|
|
|
|
icon="el-icon-plus"
|
|
|
|
v-model="gsInfo.tenantName"
|
|
|
|
size="mini"
|
|
|
|
@keyup.enter.native="getGsInfoList">
|
|
|
|
@click="handleAdd"
|
|
|
|
</el-input>
|
|
|
|
v-hasPermi="['system:dept:add']"
|
|
|
|
<div class="cp-content" style="width: 200px">
|
|
|
|
>新增</el-button>
|
|
|
|
<div :class="gsInfo.active_id===item.id?'cp-item active':'cp-item'" @click="changCompany(item.id)" v-for="item in gsInfo.list">{{ item.name }}</div>
|
|
|
|
</el-col>
|
|
|
|
</div>
|
|
|
|
<el-col :span="1.5">
|
|
|
|
</div>
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
type="info"
|
|
|
|
|
|
|
|
plain
|
|
|
|
|
|
|
|
icon="el-icon-sort"
|
|
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
|
|
@click="toggleExpandAll"
|
|
|
|
|
|
|
|
>展开/折叠</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
<div :class="$store.state.user.tenantId?'content-all':'content'">
|
|
|
|
v-if="refreshTable"
|
|
|
|
|
|
|
|
v-loading="loading"
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
|
|
|
:data="deptList"
|
|
|
|
<el-form-item label="部门名称" prop="deptName">
|
|
|
|
row-key="deptId"
|
|
|
|
<el-input
|
|
|
|
:default-expand-all="isExpandAll"
|
|
|
|
v-model="queryParams.deptName"
|
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
|
placeholder="请输入部门名称"
|
|
|
|
>
|
|
|
|
clearable
|
|
|
|
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
|
|
|
|
/>
|
|
|
|
<el-table-column prop="status" label="状态" width="100">
|
|
|
|
</el-form-item>
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-form-item label="状态" prop="status">
|
|
|
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
|
|
|
<el-select v-model="queryParams.status" placeholder="部门状态" clearable>
|
|
|
|
</template>
|
|
|
|
<el-option
|
|
|
|
</el-table-column>
|
|
|
|
v-for="dict in dict.type.sys_normal_disable"
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
|
|
|
:key="dict.value"
|
|
|
|
<template slot-scope="scope">
|
|
|
|
:label="dict.label"
|
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
|
:value="dict.value"
|
|
|
|
</template>
|
|
|
|
/>
|
|
|
|
</el-table-column>
|
|
|
|
</el-select>
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
</el-form-item>
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-form-item>
|
|
|
|
<el-button
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
size="mini"
|
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
type="text"
|
|
|
|
</el-form-item>
|
|
|
|
icon="el-icon-edit"
|
|
|
|
</el-form>
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
|
|
|
|
v-hasPermi="['system:dept:edit']"
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
>修改</el-button>
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="primary"
|
|
|
|
type="text"
|
|
|
|
plain
|
|
|
|
icon="el-icon-plus"
|
|
|
|
icon="el-icon-plus"
|
|
|
|
@click="handleAdd(scope.row)"
|
|
|
|
size="mini"
|
|
|
|
|
|
|
|
@click="handleAdd"
|
|
|
|
v-hasPermi="['system:dept:add']"
|
|
|
|
v-hasPermi="['system:dept:add']"
|
|
|
|
>新增</el-button>
|
|
|
|
>新增</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
v-if="scope.row.parentId != 0"
|
|
|
|
type="info"
|
|
|
|
|
|
|
|
plain
|
|
|
|
|
|
|
|
icon="el-icon-sort"
|
|
|
|
size="mini"
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
@click="toggleExpandAll"
|
|
|
|
icon="el-icon-delete"
|
|
|
|
>展开/折叠</el-button>
|
|
|
|
@click="handleDelete(scope.row)"
|
|
|
|
</el-col>
|
|
|
|
v-hasPermi="['system:dept:remove']"
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
>删除</el-button>
|
|
|
|
</el-row>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
<el-table
|
|
|
|
</el-table>
|
|
|
|
v-if="refreshTable"
|
|
|
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
|
|
|
:data="deptList"
|
|
|
|
|
|
|
|
row-key="deptId"
|
|
|
|
|
|
|
|
:default-expand-all="isExpandAll"
|
|
|
|
|
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column prop="status" label="状态" width="100">
|
|
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
|
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
|
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
|
|
|
|
v-hasPermi="['system:dept:edit']"
|
|
|
|
|
|
|
|
>修改</el-button>
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
|
|
|
@click="handleAdd(scope.row)"
|
|
|
|
|
|
|
|
v-hasPermi="['system:dept:add']"
|
|
|
|
|
|
|
|
>新增</el-button>
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
v-if="scope.row.parentId != 0"
|
|
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
icon="el-icon-delete"
|
|
|
|
|
|
|
|
@click="handleDelete(scope.row)"
|
|
|
|
|
|
|
|
v-hasPermi="['system:dept:remove']"
|
|
|
|
|
|
|
|
>删除</el-button>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改部门对话框 -->
|
|
|
|
<!-- 添加或修改部门对话框 -->
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
|
|
|
@ -161,6 +179,7 @@
|
|
|
|
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
|
|
|
|
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
|
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
|
|
|
import { listTenant } from "@/api/pay/tenant";
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "Dept",
|
|
|
|
name: "Dept",
|
|
|
|
@ -168,6 +187,12 @@ export default {
|
|
|
|
components: { Treeselect },
|
|
|
|
components: { Treeselect },
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
|
|
|
|
// 公司信息
|
|
|
|
|
|
|
|
gsInfo:{
|
|
|
|
|
|
|
|
tenantName:'',
|
|
|
|
|
|
|
|
active_id:this.$store.state.user.tenantId,
|
|
|
|
|
|
|
|
list:[]
|
|
|
|
|
|
|
|
},
|
|
|
|
// 遮罩层
|
|
|
|
// 遮罩层
|
|
|
|
loading: true,
|
|
|
|
loading: true,
|
|
|
|
// 显示搜索条件
|
|
|
|
// 显示搜索条件
|
|
|
|
@ -220,12 +245,37 @@ export default {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
this.getList();
|
|
|
|
if (!this.$store.state.user.tenantId) {
|
|
|
|
|
|
|
|
this.getGsInfoList()
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
this.gsInfo.active_id = this.$store.state.user.tenantId
|
|
|
|
|
|
|
|
this.getList();
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
// 获取左侧公司列表
|
|
|
|
|
|
|
|
getGsInfoList(){
|
|
|
|
|
|
|
|
listTenant({ name: this.gsInfo.tenantName }).then(response => {
|
|
|
|
|
|
|
|
if(response.rows.length>0){
|
|
|
|
|
|
|
|
this.gsInfo.list = response.rows;
|
|
|
|
|
|
|
|
this.gsInfo.active_id = this.gsInfo.list[0].id
|
|
|
|
|
|
|
|
this.getList()
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
this.$alert(`没有查到相关公司,暂无数据!`, `提示`, {
|
|
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 选择公司
|
|
|
|
|
|
|
|
changCompany(id){
|
|
|
|
|
|
|
|
this.gsInfo.active_id = id
|
|
|
|
|
|
|
|
this.getList()
|
|
|
|
|
|
|
|
},
|
|
|
|
/** 查询部门列表 */
|
|
|
|
/** 查询部门列表 */
|
|
|
|
getList() {
|
|
|
|
getList() {
|
|
|
|
this.loading = true;
|
|
|
|
this.loading = true;
|
|
|
|
|
|
|
|
this.queryParams.tenantId = this.gsInfo.active_id;
|
|
|
|
listDept(this.queryParams).then(response => {
|
|
|
|
listDept(this.queryParams).then(response => {
|
|
|
|
this.deptList = this.handleTree(response.data, "deptId");
|
|
|
|
this.deptList = this.handleTree(response.data, "deptId");
|
|
|
|
this.loading = false;
|
|
|
|
this.loading = false;
|
|
|
|
@ -278,7 +328,7 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.open = true;
|
|
|
|
this.open = true;
|
|
|
|
this.title = "添加部门";
|
|
|
|
this.title = "添加部门";
|
|
|
|
listDept().then(response => {
|
|
|
|
listDept(this.queryParams).then(response => {
|
|
|
|
this.deptOptions = this.handleTree(response.data, "deptId");
|
|
|
|
this.deptOptions = this.handleTree(response.data, "deptId");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -310,6 +360,7 @@ export default {
|
|
|
|
submitForm: function() {
|
|
|
|
submitForm: function() {
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
|
|
|
|
this.form.tenantId = this.gsInfo.active_id;
|
|
|
|
if (this.form.deptId != undefined) {
|
|
|
|
if (this.form.deptId != undefined) {
|
|
|
|
updateDept(this.form).then(response => {
|
|
|
|
updateDept(this.form).then(response => {
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
@ -338,3 +389,43 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
|
|
.app-container {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
.company {
|
|
|
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
|
|
|
width: 230px;
|
|
|
|
|
|
|
|
height: calc(100vh - 115px);
|
|
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
|
|
.cp-content {
|
|
|
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
|
|
|
.cp-item {
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
padding: 6px 10px 6px 5px;
|
|
|
|
|
|
|
|
color: #424242;
|
|
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
|
|
background: #f6f6f6;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.active{
|
|
|
|
|
|
|
|
background: #edf6ff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.content{
|
|
|
|
|
|
|
|
padding-left: 15px;
|
|
|
|
|
|
|
|
width: calc(100% - 250px);
|
|
|
|
|
|
|
|
.el-button--medium {
|
|
|
|
|
|
|
|
padding: 2px 0px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.content-all{
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
.el-button--medium {
|
|
|
|
|
|
|
|
padding: 2px 0px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|