Commit a013869e authored by 张伯涛's avatar 张伯涛

岗位,字典前端功能更改接口调节

parent 99ee7450
import request from '@/utils/request'
import Qs from 'qs'
// 查询字典类型列表
export function listType(query) {
return request({
url: '/authority/system/dict/type/list',
url: '/system/dict/type/list',
method: 'get',
params: query
})
......@@ -12,7 +12,7 @@ export function listType(query) {
// 查询字典类型详细
export function getType(dictId) {
return request({
url: '/authority/system/dict/type/' + dictId,
url: '/system/dict/type/detail/' + dictId,
method: 'get'
})
}
......@@ -42,8 +42,9 @@ export function checkDictNameUnique(dictType) {
// 新增字典类型
export function addType(data) {
data = Qs.stringify(data)
return request({
url: '/authority/system/dict/type',
url: '/system/dict/type/add',
method: 'post',
data: data
})
......@@ -51,8 +52,10 @@ export function addType(data) {
// 修改字典类型
export function updateType(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/authority/system/dict/type',
url: '/system/dict/type/update/',
method: 'put',
data: data
})
......@@ -61,7 +64,7 @@ export function updateType(data) {
// 删除字典类型
export function delType(dictId) {
return request({
url: '/authority/system/dict/type/' + dictId,
url: '/system/dict/type/deleteLogical/' + dictId,
method: 'delete'
})
}
......@@ -69,7 +72,7 @@ export function delType(dictId) {
// 清理参数缓存
export function clearCache() {
return request({
url: '/authority/system/dict/type/clearCache',
url: '/system/dict/type/clearCache',
method: 'delete'
})
}
......@@ -77,9 +80,10 @@ export function clearCache() {
// 导出字典类型
export function exportType(query) {
return request({
url: '/authority/system/dict/type/export',
url: '/system/dict/type/export',
method: 'get',
params: query
params: query,
responseType: 'blob'
})
}
......@@ -93,7 +97,7 @@ export function optionselect() {
// 获取字典选择框列表
export function selectDictType(dictType) {
return request({
url: '/authority/system/dict/data/type/' + dictType,
url: '/system/dict/type/optionselect' + dictType,
method: 'get'
})
}
......@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询岗位列表
export function listPost(query) {
return request({
url: '/authority/system/post/list',
url: '/system/post/list',
method: 'get',
params: query
})
......@@ -12,7 +12,7 @@ export function listPost(query) {
// 查询岗位详细
export function getPost(postId) {
return request({
url: '/authority/system/post/' + postId,
url: '/system/post/detail/' + postId,
method: 'get'
})
}
......@@ -20,7 +20,7 @@ export function getPost(postId) {
// 新增岗位
export function addPost(data) {
return request({
url: '/authority/system/post',
url: '/system/post/add',
method: 'post',
data: data
})
......@@ -29,7 +29,7 @@ export function addPost(data) {
// 修改岗位
export function updatePost(data) {
return request({
url: '/authority/system/post',
url: '/system/post/update/',
method: 'put',
data: data
})
......@@ -38,7 +38,7 @@ export function updatePost(data) {
// 删除岗位
export function delPost(postId) {
return request({
url: '/authority/system/post/' + postId,
url: '/system/post/deleteLogical/' + postId,
method: 'delete'
})
}
......@@ -60,8 +60,9 @@ export function checkpostNameUnique(postName) {
// 导出岗位
export function exportPost(query) {
return request({
url: '/authority/system/post/export',
url: '/system/post/export',
method: 'get',
params: query
params: query,
responseType: 'blob'
})
}
......@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询角色列表
export function listRole(query) {
return request({
url: '/authority/system/role/list',
url: '/system/role/list',
method: 'get',
params: query
})
......@@ -12,7 +12,7 @@ export function listRole(query) {
// 查询角色详细
export function getRole(roleId) {
return request({
url: '/authority/system/role/' + roleId,
url: '/system/role/' + roleId,
method: 'get'
})
}
......
......@@ -8,7 +8,7 @@
clearable
:maxlength="30"
size="small"
style="width: 240px"
style="width: 200px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
......@@ -19,36 +19,92 @@
clearable
:maxlength="30"
size="small"
style="width: 240px"
style="width: 200px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="flag">
<el-select
v-model="queryParams.flag"
placeholder="字典状态"
clearable
size="small"
style="width: 200px"
>
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
size="small"
style="width: 200px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="handleQuery">查询</el-button>
<!-- <el-button size="small" @click="resetQuery">重置</el-button>-->
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
</el-form-item>
<div style="float: right">
<el-form-item>
<el-button
v-hasPermi="['system:dict:add']"
type="primary"
size="small"
@click="handleAdd"
>新增</el-button>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-hasPermi="['system:dict:add']"
type="primary"
icon="el-icon-plus"
size="small"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:dict:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:dict:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:dict:export']"
type="success"
icon="el-icon-download"
size="small"
@click="handleExport"
>导出</el-button>
</el-form-item>
</div>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-form>
<div class="placeholder" />
<div style="min-height: 445px;padding:10px">
<h5 style="margin: 0 0 12px 0;font-size: 14px">字典管理列表</h5>
<el-table v-loading="loading" border :data="typeList">
<el-table-column type="index" label="序号" width="50" />
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="字典编号" align="center" prop="businessId"/>
<el-table-column label="字典名称" prop="dictName" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.dictName || '-' }}
......@@ -58,9 +114,9 @@
<template slot-scope="scope">
<!-- v-hasPermi="['system:dictConfig:list']"-->
<router-link
v-if="scope.row.dictId"
v-if="scope.row.businessId"
:style="{ pointerEvents: $haveAuth('system:dictConfig:list') ? '' : 'none' }"
:to="'/dictData?dictId=' + scope.row.dictId"
:to="'/dictData?businessId=' + scope.row.businessId"
class="link-type"
>
<span :style="{color: $haveAuth('system:dictConfig:list') ? '#20a0ff' : '#333333' }">{{ scope.row.dictType }}</span>
......@@ -68,14 +124,15 @@
<div v-else>-</div>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="flag" :formatter="statusFormat"/>
<el-table-column label="备注" prop="remark" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.remark || '-' }}
{{ scope.row.remarks || '-' }}
</template>
</el-table-column>
<el-table-column label="创建时间" :show-overflow-tooltip="true" prop="createTime">
<template slot-scope="scope">
<span>{{ scope.row.createTime | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
<span>{{ scope.row.createDate | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width">
......@@ -108,43 +165,53 @@
<el-dialog title="字典信息" :visible.sync="open" width="500px" append-to-body @close="reset">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="字典名称" prop="dictName">
<el-input v-model.trim="form.dictName" show-word-limit :maxlength="30" placeholder="请输入字典名称" />
<el-input v-model.trim="form.dictName" :maxlength="30" placeholder="请输入字典名称" />
</el-form-item>
<el-form-item label="字典类型" prop="dictType">
<el-input v-model.trim="form.dictType" show-word-limit :maxlength="30" placeholder="请输入字典类型" />
<el-input v-model.trim="form.dictType" :maxlength="30" placeholder="请输入字典类型" />
</el-form-item>
<el-form-item label="父字典名称">
<el-select v-model="form.parentId" style="width: 100%" clearable placeholder="请选择父字典类型" @change="getOptions">
<el-option
v-for="item in options"
:key="item.dictId"
:label="item.dictName"
:value="item.dictId"
/>
</el-select>
<el-form-item label="状态" prop="flag">
<el-radio-group v-model="form.flag">
<el-radio
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictValue"
>{{ dict.dictLabel }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.parentId">
<el-select v-model="form.dataId" style="width: 100%" clearable placeholder="请选择父字典类型" @visible-change="clearSelected">
<el-option
v-for="item in optionsDict"
:key="item.dictCode"
:label="item.dictLabel"
:disabled="item.status == 1"
:value="item.dictCode"
>
<!-- <el-form-item label="父字典名称">-->
<!-- <el-select v-model="form.parentId" style="width: 100%" clearable placeholder="请选择父字典类型" @change="getOptions">-->
<!-- <el-option-->
<!-- v-for="item in options"-->
<!-- :key="item.businessId"-->
<!-- :label="item.dictName"-->
<!-- :value="item.businessId"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item v-show="form.parentId">-->
<!-- <el-select v-model="form.dataId" style="width: 100%" clearable placeholder="请选择父字典类型" @visible-change="clearSelected">-->
<!-- <el-option-->
<!-- v-for="item in optionsDict"-->
<!-- :key="item.dictCode"-->
<!-- :label="item.dictLabel"-->
<!-- :disabled="item.status == 1"-->
<!-- :value="item.dictCode"-->
<!-- >-->
<span style="float: left">{{ item.dictLabel }}</span>
<span v-if="item.status === '1'" style="float: right; color: #8492a6; font-size: 12px;padding-left: 10px">{{ '已停用' }}</span>
</el-option>
</el-select>
</el-form-item>
<!-- <span style="float: left">{{ item.dictLabel }}</span>-->
<!-- <span v-if="item.status === '1'" style="float: right; color: #8492a6; font-size: 12px;padding-left: 10px">{{ '已停用' }}</span>-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" show-word-limit maxlength="200" type="textarea" placeholder="请输入内容" />
<el-input v-model.trim="form.remark" maxlength="200" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" :loading="manageLoading" :disabled="manageLoading" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
......@@ -287,6 +354,7 @@ export default {
/** 查询字典类型列表 */
getList() {
listType(this.queryParams).then(response => {
console.log(response)
this.typeList = response.rows
this.total = response.total
this.loading = false
......@@ -295,7 +363,7 @@ export default {
},
// 获取当前父字典数据
getOptions(val) {
selectDictType(this.options.find(item => { return item.dictId === val }).dictType).then(response => {
selectDictType(this.options.find(item => { return item.businessId === val }).dictType).then(response => {
this.optionsDict = response.data
})
this.form.dataId = ''
......@@ -343,7 +411,7 @@ export default {
this.form = {
dataId: '',
parentId: '',
dictId: undefined,
businessId: undefined,
dictName: undefined,
dictType: undefined,
status: '0',
......@@ -368,7 +436,7 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.dictId)
this.ids = selection.map(item => item.businessId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
......@@ -380,11 +448,11 @@ export default {
this.form.remark = row.remark
this.form.dictNameOne = row.dictName
this.form.dictTypeOne = row.dictType
this.form.dictId = row.dictId
this.form.businessId = row.businessId
const parentId = row.parentId
if (parentId) {
this.form.parentId = parentId
selectDictType(this.options.find(item => { return item.dictId === parentId }).dictType).then(response => {
selectDictType(this.options.find(item => { return item.businessId === parentId }).dictType).then(response => {
this.optionsDict = response.data
})
}
......@@ -431,13 +499,13 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
const dictIds = row.dictId
const businessIds = row.businessId
this.$confirm('所选择数据被删除后不可再恢复,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return delType(dictIds)
return delType(businessIds)
}).then(() => {
this.getList()
this.$message({
......
<template>
<div class="app-container">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true" label-width="68px">
<el-form-item label="职务编码" prop="postCode">
<el-input
v-model="queryParams.postCode"
placeholder="请输入职务编码"
clearable
:maxlength="30"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="职务名称" prop="postName">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="岗位名称" prop="postName">
<el-input
v-model="queryParams.postName"
placeholder="请输入职务名称"
placeholder="请输入岗位名称"
clearable
:maxlength="30"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="职务状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择职务状态" clearable size="small">
<el-form-item label="状态" prop="flag">
<el-select v-model="queryParams.flag" placeholder="岗位状态" clearable size="small">
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
......@@ -31,79 +21,125 @@
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="职务状态" prop="status">-->
<!-- <el-select v-model="queryParams.status" placeholder="请选择职务状态" clearable size="small">-->
<!-- <el-option-->
<!-- v-for="dict in statusOptions"-->
<!-- :key="dict.dictValue"-->
<!-- :label="dict.dictLabel"-->
<!-- :value="dict.dictValue"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" size="small" @click="handleQuery">查询</el-button>
<!-- <el-button size="small" @click="resetQuery">重置</el-button>-->
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
</el-form-item>
<div style="float: right">
<el-form-item>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-hasPermi="['system:post:add']"
type="primary"
icon="el-icon-plus"
size="small"
@click="handleAdd"
>新增</el-button>
</el-form-item>
</div>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:post:edit']"
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:post:remove']"
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-form>
<div class="placeholder" />
<div style="padding:10px">
<div class="mb12 font-small-bold">职务管理列表</div>
<div class="mb12 font-small-bold">岗位管理列表</div>
<el-table :data="postList" border>
<el-table-column
label="序号"
type="index"
width="50"
/>
<el-table-column :show-overflow-tooltip="true" label="职务编号" prop="postId">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :show-overflow-tooltip="true" label="岗位编号" align="center" prop="businessId">
<template slot-scope="scope">
{{ scope.row.postId || '-' }}
{{ scope.row.businessId || '-' }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="职务编码" prop="postCode">
<!-- <el-table-column :show-overflow-tooltip="true" label="职务编码" prop="postCode">-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.deptId || '-' }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column :show-overflow-tooltip="true" label="岗位名称" align="center" prop="postName">
<template slot-scope="scope">
{{ scope.row.postCode || '-' }}
{{ scope.row.postName || '-' }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="职务名称" prop="postName">
<el-table-column :show-overflow-tooltip="true" label="岗位排序" align="center" prop="postSort">
<template slot-scope="scope">
{{ scope.row.postName || '-' }}
{{ scope.row.postSort || '-' }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="职务排序" prop="postSort">
<el-table-column :show-overflow-tooltip="true" label="状态" align="center" prop="flag">
<template slot-scope="scope">
{{ scope.row.postSort || '-' }}
{{ scope.row.flag || '-' }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="创建时间" prop="createTime" width="180">
<el-table-column :show-overflow-tooltip="true" label="创建时间" align="center" prop="createDate" width="180">
<template slot-scope="scope">
<span>{{ scope.row.createTime | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
<span>{{ scope.row.createDate | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-hasPermi="['system:post:update']"
v-hasPermi="['system:post:edit']"
size="mini"
type="text"
style="color: #49cec9"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
v-hasPermi="['system:post:delete']"
v-hasPermi="['system:post:remove']"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
<el-switch
v-model="scope.row.status"
v-hasPermi="['system:post:toggle']"
active-value="0"
inactive-value="1"
:disabled="true"
class="switchDisabledStyle"
@click.native="handleStatusChange(scope.row)"
/>
<!-- <el-switch-->
<!-- v-model="scope.row.status"-->
<!-- v-hasPermi="['system:post:toggle']"-->
<!-- active-value="0"-->
<!-- inactive-value="1"-->
<!-- :disabled="true"-->
<!-- class="switchDisabledStyle"-->
<!-- @click.native="handleStatusChange(scope.row)"-->
<!-- />-->
</template>
</el-table-column>
</el-table>
......@@ -111,36 +147,63 @@
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
@pagination="getList"
/>
<!-- 添加或修改职务对话框 -->
<el-dialog title="职务信息" :visible.sync="open" width="500px" append-to-body>
<el-dialog title="岗位信息" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="职务名称" prop="postName">
<el-input v-model.trim="form.postName" maxlength="20" show-word-limit placeholder="请输入职务名称" />
<el-form-item label="岗位名称" prop="postName">
<el-input v-model.trim="form.postName" placeholder="岗位名称" disabled />
</el-form-item>
<el-form-item label="职务编码" prop="postCode">
<el-input v-model.trim="form.postCode" maxlength="20" show-word-limit placeholder="请输入编码名称" />
<el-form-item label="部门名称" prop="deptName">
<treeselect
v-model="form.deptId"
:options="deptOptions"
:normalizer="normalizer"
:show-count="true"
:clearable="false"
placeholder="请选择部门"
@select="getBefore"
/>
</el-form-item>
<el-form-item label="职务排序" prop="postSort">
<el-input-number style="width: 100%" v-model="form.postSort" controls-position="right" :min="0" />
<el-form-item label="角色名称">
<el-select v-model="form.roleId" placeholder="请选择角色" clearable size="small" @change="getAfter">
<el-option
v-for="item in roleOptions"
:key="item.businessId"
:label="item.roleName"
:value="item.businessId"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="职务编码" prop="postCode">-->
<!-- <el-input v-model.trim="form.postCode" maxlength="20" placeholder="请输入编码名称" />-->
<!-- </el-form-item>-->
<el-form-item label="岗位排序" prop="postSort">
<el-input-number v-model="form.postSort" style="width: 100%" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="职务状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio label="0">启用</el-radio>
<el-radio label="1">停用</el-radio>
<el-form-item label="岗位状态" prop="flag">
<el-radio-group v-model="form.flag">
<el-radio
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictValue"
>{{ dict.dictLabel }}
<!-- <el-radio label="0">正常</el-radio>-->
<!-- <el-radio label="1">停用</el-radio>-->
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="form.remark" maxlength="500" show-word-limit type="textarea" placeholder="请输入内容" />
<el-input v-model.trim="form.remark" maxlength="500" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
......@@ -148,9 +211,14 @@
<script>
import { listPost, getPost, delPost, addPost, updatePost, exportPost, checkpostIdUnique, checkpostNameUnique } from '@/api/system/post'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import dictCons from '@/utils/dictCons'
import { listDept } from '@/api/system/dept'
import { listRole } from '@/api/system/role'
export default {
name: 'Post',
components: { Treeselect },
data() {
const verifyIDProp = (rule, value, callback) => {
if (value === '' || value === undefined || value === null) {
......@@ -215,12 +283,18 @@ export default {
multiple: true,
// 总条数
total: 0,
// 职务表格数据
// 崗位表格数据
postList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 显示搜索条件
showSearch: true,
// 角色树选项
roleOptions: [],
// 部门树选项
deptOptions: [],
// 状态数据字典
statusOptions: [
{
......@@ -238,10 +312,11 @@ export default {
],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
page: 1,
rows: 10,
postCode: undefined,
postName: undefined,
flag: undefined,
status: ''
},
// 表单参数
......@@ -252,31 +327,76 @@ export default {
// 表单校验
rules: {
postName: [
{ required: true, message: '请输入职务名称', trigger: 'blur' },
{ required: true, message: '岗位名称不能为空', trigger: 'blur' },
{ validator: verifyNameProp, trigger: 'blur' }
],
postCode: [
{ required: true, message: '请输入职务编码', trigger: 'blur' },
{ required: true, message: '岗位编码不能为空', trigger: 'blur' },
{ validator: verifyIDProp, trigger: 'blur' }
],
postSort: [
{ required: true, message: '请输入职务排序', trigger: 'blur' }
{ required: true, message: '岗位顺序不能为空', trigger: 'blur' }
]
}
}
},
created() {
this.getList()
// this.getDicts('sys_normal_disable').then(response => {
// this.statusOptions = response.data
// })
this.getDicts(dictCons.NORMAL_DISABLE).then(response => {
this.statusOptions = response.data
})
},
methods: {
/** 查询职务列表 */
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.businessId,
label: node.deptName,
children: node.children
}
},
getBefore(val) {
// eslint-disable-next-line eqeqeq
if (this.form.postNameAfter == undefined) {
this.form.postNameAfter = '待选择角色'
}
this.form.postNameBefore = val.deptName
this.form.postName = this.form.postNameBefore + '-' + this.form.postNameAfter
},
getAfter(val) {
if (this.form.postNameBefore === undefined) {
this.form.postNameBefore = '待选择部门'
}
const obj = this.roleOptions.find((item) => {
return item.businessId === val
})
if (obj !== undefined && obj !== '') {
this.form.postNameAfter = obj.roleName
} else {
this.form.postNameAfter = '待选择角色'
}
this.form.postName = this.form.postNameBefore + '-' + this.form.postNameAfter
},
/** 查询崗位位列表 */
getList() {
this.loading = true
listPost(this.queryParams).then(response => {
this.postList = response.rows
this.total = response.total
this.loading = false
})
},
/** 查询部门、角色下拉树结构 */
getTreeselect() {
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, 'businessId')
this.form.deptName = response.data.deptName
})
listRole().then(response => {
this.roleOptions = response.rows
})
},
handleStatusChange(row) {
......@@ -297,9 +417,9 @@ export default {
})
})
},
// 职务状态字典翻译
// 岗位状态字典翻译
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status)
return this.selectDictLabel(this.statusOptions, row.flag)
},
// 取消按钮
cancel() {
......@@ -312,13 +432,18 @@ export default {
postId: undefined,
postCode: undefined,
postName: undefined,
roleId: undefined,
deptId: undefined,
postSort: 0,
flag: '1',
status: '0',
remark: undefined
remark: undefined,
postNameAfter: undefined,
postNameBefore: undefined
}
this.resetForm('form')
},
/** 查询按钮操作 */
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
......@@ -330,33 +455,39 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.postId)
this.ids = selection.map(item => item.businessId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.deptOptions = []
this.roleOptions = []
this.getTreeselect()
this.open = true
this.title = '添加'
this.title = '添加岗位'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const postId = row.postId || this.ids
this.deptOptions = []
this.roleOptions = []
this.getTreeselect()
const postId = row.businessId || this.ids
getPost(postId).then(response => {
this.form = response.data
this.form.postCodeOne = response.data.postCode
this.form.postNameOne = response.data.postName
this.open = true
this.title = '修改'
this.form.postNameBefore = response.data.deptName
this.form.postNameAfter = response.data.roleName
this.title = '修改岗位'
})
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.postId !== undefined) {
if (this.form.businessId !== undefined) {
updatePost(this.form).then(response => {
if (response.code === 200) {
this.$message({
......@@ -384,7 +515,7 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
const postIds = row.postId || this.ids
const postIds = row.businessId || this.ids
this.$confirm('所选择数据被删除后不可再恢复,是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
......
......@@ -156,7 +156,7 @@
</template>
<script>
import { queryWfGroupByPagination, addWfGroup, updateWfGroup, delWfGroup } from '@/api/workflow'
import { queryInAdhibitions } from '@/api/banner.js'
import { selectAppInformation } from '../../../api/mobileIntegrated/appManage'
export default {
name: 'Index',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment