|
|
@@ -4,30 +4,16 @@
|
|
|
<!--机构数据-->
|
|
|
<el-col :span="4" :xs="24">
|
|
|
<div class="head-container">
|
|
|
- <el-input
|
|
|
- v-model="deptName"
|
|
|
- placeholder="请输入机构名称"
|
|
|
- clearable
|
|
|
- size="small"
|
|
|
- prefix-icon="el-icon-search"
|
|
|
- style="margin-bottom: 20px"
|
|
|
- />
|
|
|
+ <el-input v-model="deptName" placeholder="请输入机构名称" clearable size="small" prefix-icon="el-icon-search"
|
|
|
+ style="margin-bottom: 20px" />
|
|
|
</div>
|
|
|
<div class="tree-container">
|
|
|
<div style="margin-bottom: 10px;">
|
|
|
<el-checkbox v-model="queryParams.checkSub" @change="changeCheckBox">是否关联下级机构</el-checkbox>
|
|
|
</div>
|
|
|
- <el-tree
|
|
|
- :data="deptOptions"
|
|
|
- :props="defaultProps"
|
|
|
- :expand-on-click-node="false"
|
|
|
- :filter-node-method="filterNode"
|
|
|
- ref="tree"
|
|
|
- node-key="id"
|
|
|
- :default-expanded-keys="defaultKeys"
|
|
|
- :default-checked-keys="defaultKeys"
|
|
|
- @node-click="handleNodeClick"
|
|
|
- />
|
|
|
+ <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
|
|
|
+ :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="defaultKeys"
|
|
|
+ :default-checked-keys="defaultKeys" @node-click="handleNodeClick" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<!--用户数据-->
|
|
|
@@ -35,43 +21,28 @@
|
|
|
|
|
|
<!-- 搜索条件 -->
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
|
|
- <el-form-item label="机构名称" prop="name">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.name"
|
|
|
- placeholder="请输入机构名称"
|
|
|
- clearable
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="状态" prop="isLock">
|
|
|
- <el-select v-model="queryParams.isLock" 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-form-item label="机构名称" prop="name">
|
|
|
+ <el-input v-model="queryParams.name" placeholder="请输入机构名称" clearable @keyup.enter.native="handleQuery" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="状态" prop="isLock">
|
|
|
+ <el-select v-model="queryParams.isLock" 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">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="el-icon-plus"
|
|
|
- size="mini"
|
|
|
- @click="handleAdd"
|
|
|
- v-hasPermi="['system:dept:add']"
|
|
|
- >新增</el-button>
|
|
|
- </el-col>
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
- </el-row>
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
|
|
+ v-hasPermi="['system:dept:add']">新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
|
|
|
<el-table v-loading="loading" :data="deptList" @selection-change="handleSelectionChange">
|
|
|
<el-table-column label="序号" align="center" min-width="30">
|
|
|
@@ -79,21 +50,21 @@
|
|
|
<span v-text="getPageIndex(scope.$index)"> </span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="code" label="编码" ></el-table-column>
|
|
|
- <el-table-column prop="type" label="机构类型" >
|
|
|
+ <el-table-column prop="code" label="编码"></el-table-column>
|
|
|
+ <el-table-column prop="type" label="机构类型">
|
|
|
<template v-slot="scope">
|
|
|
- <dict-tag :options="dict.type.sys_org_type" :value="scope.row.type"/>
|
|
|
+ <dict-tag :options="dict.type.sys_org_type" :value="scope.row.type" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="机构名称" ></el-table-column>
|
|
|
- <el-table-column prop="isLock" label="状态" >
|
|
|
+ <el-table-column prop="name" label="机构名称"></el-table-column>
|
|
|
+ <el-table-column prop="isLock" label="状态">
|
|
|
<template v-slot="scope">
|
|
|
- <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.isLock"/>
|
|
|
+ <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.isLock" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="weatherCityCode" label="天气区域编码" ></el-table-column>
|
|
|
- <el-table-column prop="address" label="地址" ></el-table-column>
|
|
|
- <el-table-column label="负责人及电话" align="center" >
|
|
|
+ <el-table-column prop="weatherCityCode" label="天气区域编码"></el-table-column>
|
|
|
+ <el-table-column prop="address" label="地址"></el-table-column>
|
|
|
+ <el-table-column label="负责人及电话" align="center">
|
|
|
<template v-slot:default="scope">
|
|
|
<span v-text="scope.row.manager"></span>-
|
|
|
<span v-text="scope.row.managerPhone"> </span>
|
|
|
@@ -101,42 +72,21 @@
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
- <template slot-scope="scope">
|
|
|
- <router-link :to="'/system/dept-extend/extend/'+ scope.row.id " class="link-type">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-plus"
|
|
|
- v-hasPermi="['system:dept:extend']"
|
|
|
- >补充信息</el-button
|
|
|
- >
|
|
|
- </router-link>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
- v-hasPermi="['system:dept:edit']"
|
|
|
- >修改</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>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <router-link :to="'/system/dept-extend/extend/' + scope.row.id" class="link-type">
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-plus"
|
|
|
+ v-hasPermi="['system:dept:extend']">补充信息</el-button>
|
|
|
+ </router-link>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['system:dept:edit']">修改</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>
|
|
|
|
|
|
- <pagination
|
|
|
- v-show="total>0"
|
|
|
- :total="total"
|
|
|
- :page.sync="queryParams.pageNum"
|
|
|
- :limit.sync="queryParams.pageSize"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
+ <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList" />
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
@@ -145,7 +95,7 @@
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="上级机构" prop="parentId">
|
|
|
+ <el-form-item v-if="this.pId != -1" label="上级机构" prop="parentId">
|
|
|
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级机构" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -183,11 +133,8 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="机构状态" prop="isLock">
|
|
|
<el-radio-group v-model="form.isLock">
|
|
|
- <el-radio
|
|
|
- v-for="dict in dict.type.sys_normal_disable"
|
|
|
- :key="dict.value"
|
|
|
- :label="dict.value"
|
|
|
- >{{dict.label}}</el-radio>
|
|
|
+ <el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label
|
|
|
+ }}</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -203,7 +150,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild} from "@/api/system/dept";
|
|
|
+import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
|
|
|
import { deptTreeSelect } from "@/api/system/public";
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
@@ -211,7 +158,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
|
export default {
|
|
|
name: "Dept",
|
|
|
- dicts: ['sys_normal_disable','sys_org_type'],
|
|
|
+ dicts: ['sys_normal_disable', 'sys_org_type'],
|
|
|
components: { Treeselect },
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -225,6 +172,7 @@ export default {
|
|
|
total: 0,
|
|
|
// 机构树选项
|
|
|
deptOptions: [],
|
|
|
+ pId: -1,
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
|
@@ -247,7 +195,7 @@ export default {
|
|
|
pageSize: 10,
|
|
|
name: undefined,
|
|
|
status: undefined,
|
|
|
- parentId:undefined,
|
|
|
+ parentId: undefined,
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
@@ -262,8 +210,8 @@ export default {
|
|
|
orderNum: [
|
|
|
{ required: true, message: "显示排序不能为空", trigger: "blur" }
|
|
|
],
|
|
|
- isLock:[
|
|
|
- { required: true, message: "状态不能为空", trigger: "blur" }
|
|
|
+ isLock: [
|
|
|
+ { required: true, message: "状态不能为空", trigger: "blur" }
|
|
|
],
|
|
|
email: [
|
|
|
{
|
|
|
@@ -281,7 +229,7 @@ export default {
|
|
|
]
|
|
|
},
|
|
|
//默认选中节点
|
|
|
- defaultKeys:[]
|
|
|
+ defaultKeys: []
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -294,8 +242,8 @@ export default {
|
|
|
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
|
|
|
|
|
|
},
|
|
|
- //自定义数据
|
|
|
- tenantIdnormalizer(node, instanceId) {
|
|
|
+ //自定义数据
|
|
|
+ tenantIdnormalizer(node, instanceId) {
|
|
|
if (node.children && !node.children.length) {
|
|
|
delete node.children
|
|
|
}
|
|
|
@@ -306,14 +254,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
/** 下穿状态改变*/
|
|
|
- changeCheckBox(){
|
|
|
+ changeCheckBox() {
|
|
|
this.getList();
|
|
|
},
|
|
|
/** 查询机构下拉树结构 */
|
|
|
getDeptTree() {
|
|
|
deptTreeSelect().then(response => {
|
|
|
this.deptOptions = response.data;
|
|
|
- console.log( this.deptOptions,' this.deptOptions')
|
|
|
this.defaultKeys.push(response.data[0].id);
|
|
|
this.queryParams.parentId = response.data[0].id;
|
|
|
this.handleQuery();
|
|
|
@@ -401,12 +348,15 @@ export default {
|
|
|
this.reset();
|
|
|
getDept(row.id).then(response => {
|
|
|
this.form = response.data;
|
|
|
+ this.pId = response.data.parentId;
|
|
|
this.open = true;
|
|
|
this.title = "修改机构";
|
|
|
});
|
|
|
- listDeptExcludeChild(row.id).then(response => {
|
|
|
- this.deptOptions = this.handleTree(response.data, "id");
|
|
|
- });
|
|
|
+ if (this.pId != -1) {
|
|
|
+ listDeptExcludeChild(row.id).then(response => {
|
|
|
+ this.deptOptions = this.handleTree(response.data, "id");
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
changeSubmitForm() {
|
|
|
@@ -435,13 +385,13 @@ export default {
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
- this.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function() {
|
|
|
+ this.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function () {
|
|
|
return delDept(row.id);
|
|
|
}).then(() => {
|
|
|
this.getList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
this.getDeptTree();
|
|
|
- }).catch(() => {});
|
|
|
+ }).catch(() => { });
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
@@ -451,14 +401,12 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
- // 根据名称筛选机构树
|
|
|
- deptName(val) {
|
|
|
+ // 根据名称筛选机构树
|
|
|
+ deptName(val) {
|
|
|
this.$refs.tree.filter(val);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+<style lang="scss" scoped></style>
|