Browse Source

部门新增主负责人

master
牧羊人 3 years ago
parent
commit
ab929028fc
1 changed files with 26 additions and 3 deletions
  1. +26
    -3
      src/views/system/dept/index.vue

+ 26
- 3
src/views/system/dept/index.vue View File

@@ -27,6 +27,7 @@
<el-table-column label="部门名称" show-overflow-tooltip min-width="200">
<template slot-scope="{row}">{{ row.name }}</template>
</el-table-column>
<el-table-column prop="principalName" label="主负责人" min-width="100" align="center"/>
<el-table-column label="部门类型" width="100px" align="center">
<template slot-scope="{row}">
<el-tag :type="['primary','success'][row.type]" size="mini">{{ ['其他', '考核部门', '被考核部门'][row.type] }}</el-tag>
@@ -52,7 +53,7 @@
</el-table>
</el-card>
<!-- 编辑弹窗 -->
<el-dialog :title="form.id?'修改部门':'添加部门'" :visible.sync="showEdit" width="400px"
<el-dialog :title="form.id?'修改部门':'添加部门'" :visible.sync="showEdit" width="450px"
@closed="form={}" :destroy-on-close="true" :lock-scroll="false">
<el-form :model="form" ref="editForm" :rules="rules" label-width="82px">
<el-form-item label="部门名称:" prop="name">
@@ -60,11 +61,18 @@
</el-form-item>
<el-form-item label="部门类型:">
<el-radio-group v-model="form.type">
<el-radio :label="1">其他</el-radio>
<el-radio :label="0">其他</el-radio>
<el-radio :label="1">考核部门</el-radio>
<el-radio :label="2">被考核部门</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="主负责人" prop="principal" :rules="{
required: true, message: '主负责人不能为空', trigger: 'change'
}">
<el-select filterable clearable v-model="form.principal" size="small" placeholder="-请选择主负责人-" class="ele-block">
<el-option v-for="item in userList" :key="item.id" :label="item.realname" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="排序号:" prop="sort">
<el-input-number v-model="form.sort" controls-position="right" :min="0"
placeholder="请输入排序号" class="ele-fluid ele-text-left"/>
@@ -99,11 +107,14 @@ export default {
sort: [
{required: true, message: '请输入排序号', trigger: 'blur'}
]
}
},
// 主负责人
userList:[],
}
},
mounted() {
this.query();
this.getUserList(); // 查询主负责人列表
},
methods: {
/* 查询 */
@@ -121,6 +132,18 @@ export default {
this.$message.error(e.message);
});
},
// 获取主负责人列表
getUserList() {
this.$http.get('/user/getUserList').then(res => {
if (res.data.code === 0) {
this.userList = res.data.data;
} else {
this.$message.error(res.data.msg);
}
}).catch(e => {
this.$message.error(e.message);
});
},
/* 显示添加 */
add(row) {
this.form = {sort: 0, pid: row ? row.id : null};

Loading…
Cancel
Save