|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" >
|
|
|
<el-form-item label="部门名称" prop="deptName">
|
|
|
- <el-input v-model="queryParams.deptName" placeholder="请输入部门名称" clearable @keyup.enter.native="handleQuery" class="se"/>
|
|
|
+ <el-input v-model="queryParams.deptName" placeholder="请输入部门名称" clearable @keyup.enter.native="handleQuery" class="se" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="状态" prop="status">
|
|
|
<el-select v-model="queryParams.status" placeholder="部门状态" clearable>
|
|
@@ -16,9 +16,7 @@
|
|
|
</el-form>
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5"><el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-hasPermi="['system:dept:add']">新增</el-button></el-col>
|
|
|
<el-col :span="1.5"><el-button type="info" icon="el-icon-sort" @click="toggleExpandAll">展开/折叠</el-button></el-col>
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
<el-table v-if="refreshTable" :data="deptList" row-key="deptId" :default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
|
@@ -34,13 +32,11 @@
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" >
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
<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>
|
|
|
+ <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="empty">
|
|
@@ -51,41 +47,16 @@
|
|
|
<!-- 添加或修改部门对话框 -->
|
|
|
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="600px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24" v-if="form.parentId !== 0">
|
|
|
- <el-form-item label="上级部门" prop="parentId">
|
|
|
- <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="部门名称" prop="deptName"><el-input v-model="form.deptName" placeholder="请输入部门名称" /></el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="显示排序" prop="orderNum"><el-input-number v-model="form.orderNum" controls-position="right" :min="0" /></el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="负责人" prop="leader"><el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" /></el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="联系电话" prop="phone"><el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" /></el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="邮箱" prop="email"><el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" /></el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="部门状态">
|
|
|
- <el-radio-group v-model="form.status">
|
|
|
- <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>
|
|
|
- </el-row>
|
|
|
+ <el-form-item label="上级科室" prop="parentId" v-if="form.parentId !== 0">
|
|
|
+ <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级科室" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="科室名称" prop="deptName"><el-input v-model="form.deptName" placeholder="请输入科室名称" /></el-form-item>
|
|
|
+ <el-form-item label="显示排序" prop="orderNum"><el-input-number v-model="form.orderNum" controls-position="right" :min="0" /></el-form-item>
|
|
|
+ <el-form-item label="科室状态">
|
|
|
+ <el-radio-group v-model="form.status">
|
|
|
+ <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-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
@@ -155,7 +126,7 @@ export default {
|
|
|
methods: {
|
|
|
/** 查询部门列表 */
|
|
|
getList() {
|
|
|
- listDept(this.queryParams).then(response => {
|
|
|
+ listDept(this.queryParams).then((response) => {
|
|
|
this.deptList = this.handleTree(response.data, 'deptId');
|
|
|
});
|
|
|
},
|
|
@@ -205,8 +176,8 @@ export default {
|
|
|
this.form.parentId = row.deptId;
|
|
|
}
|
|
|
this.open = true;
|
|
|
- this.title = '添加部门';
|
|
|
- listDept().then(response => {
|
|
|
+ this.title = '添加科室';
|
|
|
+ listDept().then((response) => {
|
|
|
this.deptOptions = this.handleTree(response.data, 'deptId');
|
|
|
});
|
|
|
},
|
|
@@ -222,10 +193,10 @@ export default {
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
this.open = true;
|
|
|
- this.title = '修改部门';
|
|
|
- getDept(row.deptId).then(response => {
|
|
|
+ this.title = '修改科室';
|
|
|
+ getDept(row.deptId).then((response) => {
|
|
|
this.form = response.data;
|
|
|
- listDeptExcludeChild(row.deptId).then(response => {
|
|
|
+ listDeptExcludeChild(row.deptId).then((response) => {
|
|
|
this.deptOptions = this.handleTree(response.data, 'deptId');
|
|
|
if (this.deptOptions.length == 0) {
|
|
|
const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] };
|
|
@@ -235,17 +206,17 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
- submitForm: function() {
|
|
|
- this.$refs['form'].validate(valid => {
|
|
|
+ submitForm: function () {
|
|
|
+ this.$refs['form'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (this.form.deptId != undefined) {
|
|
|
- updateDept(this.form).then(response => {
|
|
|
+ updateDept(this.form).then((response) => {
|
|
|
this.$modal.msgSuccess('修改成功');
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
- addDept(this.form).then(response => {
|
|
|
+ addDept(this.form).then((response) => {
|
|
|
this.$modal.msgSuccess('新增成功');
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
@@ -258,7 +229,7 @@ export default {
|
|
|
handleDelete(row) {
|
|
|
this.$modal
|
|
|
.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?')
|
|
|
- .then(function() {
|
|
|
+ .then(function () {
|
|
|
return delDept(row.deptId);
|
|
|
})
|
|
|
.then(() => {
|