|
|
@@ -1,28 +1,25 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
|
|
- <el-form-item label="部门名称" prop="deptName">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
|
|
|
+ <el-form-item>
|
|
|
<el-input
|
|
|
v-model="queryParams.deptName"
|
|
|
placeholder="请输入部门名称"
|
|
|
clearable
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
+ style="width: 200px;"
|
|
|
/>
|
|
|
</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-select v-model="queryParams.status" clearable placeholder="状态" class="filter-item" style="width: 200px;">
|
|
|
+ <el-option :key="item.value" v-for="item in statusList" :label="item.label" :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-form-item>
|
|
|
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleQuery">查找</el-button>
|
|
|
- <el-button class="filter-item" type="primary" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
|
- <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleAdd">添加</el-button>
|
|
|
+ <el-button class="filter-item" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
|
+ <el-button class="filter-item" type="primary" icon="el-icon-plus" @click="handleAdd">添加</el-button>
|
|
|
<el-button class="filter-item" type="info" icon="el-icon-sort" @click="toggleExpandAll">展开/折叠</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -36,33 +33,34 @@
|
|
|
: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">
|
|
|
+ <el-table-column align="center" prop="deptName" label="部门名称" min-width="260"></el-table-column>
|
|
|
+ <el-table-column align="center" prop="orderNum" label="排序" min-width="100"></el-table-column>
|
|
|
+ <el-table-column align="center" min-width="80px" label="状态">
|
|
|
+ <template slot-scope="props">
|
|
|
+ <span v-if="props.row.status == 0" style="color: #67C23A;font-weight: bold;">启用</span>
|
|
|
+ <span v-if="props.row.status == 1" style="color: #E6A23C;font-weight: bold;">停用</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="创建时间" align="center" prop="createTime" min-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>
|
|
|
+ <span>{{ scope.row.createTime }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column label="操作" align="center" min-width="110px">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
- size="mini"
|
|
|
+ size="small"
|
|
|
type="primary"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
>修改</el-button>
|
|
|
<el-button
|
|
|
- size="mini"
|
|
|
+ size="small"
|
|
|
type="success"
|
|
|
@click="handleAdd(scope.row)"
|
|
|
>添加</el-button>
|
|
|
<el-button
|
|
|
v-if="scope.row.parentId != 0"
|
|
|
- size="mini"
|
|
|
+ size="small"
|
|
|
type="danger"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
>删除</el-button>
|
|
|
@@ -110,17 +108,17 @@
|
|
|
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <!-- <el-col :span="12">
|
|
|
+ <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"
|
|
|
+ v-for="dict in statusList"
|
|
|
:key="dict.value"
|
|
|
:label="dict.value"
|
|
|
>{{dict.label}}</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- </el-col> -->
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
@@ -138,10 +136,19 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
|
export default {
|
|
|
name: "Dept",
|
|
|
- // dicts: ['sys_normal_disable'],
|
|
|
components: { Treeselect },
|
|
|
data() {
|
|
|
return {
|
|
|
+ statusList: [
|
|
|
+ {
|
|
|
+ value: '0',
|
|
|
+ label: '启用'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '1',
|
|
|
+ label: '停用'
|
|
|
+ },
|
|
|
+ ],
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
// 显示搜索条件
|
|
|
@@ -201,7 +208,7 @@ export default {
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
listDept(this.queryParams).then(response => {
|
|
|
- this.deptList = this.handleTree(response.data, "deptId");
|
|
|
+ this.deptList = this.handleTree(response.data.data, "deptId");
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
@@ -253,7 +260,7 @@ export default {
|
|
|
this.open = true;
|
|
|
this.title = "添加部门";
|
|
|
listDept().then(response => {
|
|
|
- this.deptOptions = this.handleTree(response.data, "deptId");
|
|
|
+ this.deptOptions = this.handleTree(response.data.data, "deptId");
|
|
|
});
|
|
|
},
|
|
|
/** 展开/折叠操作 */
|
|
|
@@ -268,11 +275,11 @@ export default {
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
getDept(row.deptId).then(response => {
|
|
|
- this.form = response.data;
|
|
|
+ this.form = response.data.data;
|
|
|
this.open = true;
|
|
|
this.title = "修改部门";
|
|
|
listDeptExcludeChild(row.deptId).then(response => {
|
|
|
- this.deptOptions = this.handleTree(response.data, "deptId");
|
|
|
+ this.deptOptions = this.handleTree(response.data.data, "deptId");
|
|
|
if (this.deptOptions.length == 0) {
|
|
|
const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] };
|
|
|
this.deptOptions.push(noResultsOptions);
|
|
|
@@ -286,13 +293,23 @@ export default {
|
|
|
if (valid) {
|
|
|
if (this.form.deptId != undefined) {
|
|
|
updateDept(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
addDept(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
|
@@ -302,11 +319,11 @@ export default {
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
- this.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {
|
|
|
+ this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {
|
|
|
return delDept(row.deptId);
|
|
|
}).then(() => {
|
|
|
this.getList();
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
+ this.$msgSuccess("删除成功");
|
|
|
}).catch(() => {});
|
|
|
}
|
|
|
}
|