岗位管理完成

pull/1/head
李强 2021-02-27 00:02:05 +08:00
parent e54eccec46
commit 7a68aee719
4 changed files with 22 additions and 22 deletions

View File

@ -4,10 +4,10 @@ from apps.op_drf.models import CoreModel
class Post(CoreModel):
name = CharField(null=False, max_length=64, verbose_name="岗位名称")
web_path = CharField(max_length=32, verbose_name="岗位编码")
orderNum = IntegerField(verbose_name="岗位顺序")
status = BooleanField(default=False, verbose_name="岗位状态")
postName = CharField(null=False, max_length=64, verbose_name="岗位名称")
postCode = CharField(max_length=32, verbose_name="岗位编码")
postSort = IntegerField(verbose_name="岗位顺序")
status = CharField(max_length=8, verbose_name="岗位状态")
remark = TextField(verbose_name="备注", help_text="备注", null=True)
class Meta:
@ -15,4 +15,4 @@ class Post(CoreModel):
verbose_name_plural = verbose_name
def __str__(self):
return f"{self.name}"
return f"{self.postName}"

View File

@ -96,7 +96,7 @@ class PostModelViewSet(CustomModelViewSet):
# destroy_extra_permission_classes = (IsManagerPermission,)
# create_extra_permission_classes = (IsManagerPermission,)
search_fields = ('name',)
ordering = 'create_datetime' # 默认排序
ordering = ['postSort','create_datetime'] # 默认排序
class RoleModelViewSet(CustomModelViewSet):

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询岗位列表
export function listPost(query) {
return request({
url: '/system/post/list',
url: '/permission/post/',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listPost(query) {
// 查询岗位详细
export function getPost(postId) {
return request({
url: '/system/post/' + postId,
url: '/permission/post/' + postId + '/',
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getPost(postId) {
// 新增岗位
export function addPost(data) {
return request({
url: '/system/post',
url: '/permission/post/',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addPost(data) {
// 修改岗位
export function updatePost(data) {
return request({
url: '/system/post',
url: '/permission/post/' + data.id + '/',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updatePost(data) {
// 删除岗位
export function delPost(postId) {
return request({
url: '/system/post/' + postId,
url: '/permission/post/' + postId + '/',
method: 'delete'
})
}
@ -46,8 +46,8 @@ export function delPost(postId) {
// 导出岗位
export function exportPost(query) {
return request({
url: '/system/post/export',
url: '/permission/post/export/',
method: 'get',
params: query
})
}
}

View File

@ -83,7 +83,7 @@
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="岗位编号" align="center" prop="postId" />
<el-table-column label="岗位编号" align="center" prop="id" />
<el-table-column label="岗位编码" align="center" prop="postCode" />
<el-table-column label="岗位名称" align="center" prop="postName" />
<el-table-column label="岗位排序" align="center" prop="postSort" />
@ -216,8 +216,8 @@ export default {
getList() {
this.loading = true;
listPost(this.queryParams).then(response => {
this.postList = response.rows;
this.total = response.total;
this.postList = response.data.results;
this.total = response.data.count;
this.loading = false;
});
},
@ -233,7 +233,7 @@ export default {
//
reset() {
this.form = {
postId: undefined,
id: undefined,
postCode: undefined,
postName: undefined,
postSort: 0,
@ -254,7 +254,7 @@ export default {
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.postId)
this.ids = selection.map(item => item.id)
this.single = selection.length!=1
this.multiple = !selection.length
},
@ -267,8 +267,8 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const postId = row.postId || this.ids
getPost(postId).then(response => {
const id = row.id || this.ids
getPost(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改岗位";
@ -278,7 +278,7 @@ export default {
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.postId != undefined) {
if (this.form.id != undefined) {
updatePost(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
@ -296,7 +296,7 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
const postIds = row.postId || this.ids;
const postIds = row.id || this.ids;
this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",