Commit 78a3a205 authored by shen_yan_pu's avatar shen_yan_pu

修改

parent 98b4034e
...@@ -37,7 +37,7 @@ export function editBanner(data) { ...@@ -37,7 +37,7 @@ export function editBanner(data) {
// 查询角色列表 // 查询角色列表
export function listRole(query) { export function listRole(query) {
return request({ return request({
url: '/authority/system/role/list', url: '/system/role/list',
method: 'get', method: 'get',
params: query params: query
}) })
......
...@@ -3,7 +3,7 @@ import request from '@/utils/request' ...@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询参数列表 // 查询参数列表
export function listConfig(query) { export function listConfig(query) {
return request({ return request({
url: '/authority/system/config/list', url: '/system/config/list',
method: 'get', method: 'get',
params: query params: query
}) })
...@@ -20,7 +20,7 @@ export function getConfig(configId) { ...@@ -20,7 +20,7 @@ export function getConfig(configId) {
// 根据参数键名查询参数值 // 根据参数键名查询参数值
export function getConfigKey(configKey) { export function getConfigKey(configKey) {
return request({ return request({
url: '/authority/system/config/configKey/' + configKey, // url: '/system/config/configKey/' + configKey,
method: 'get' method: 'get'
}) })
} }
...@@ -28,7 +28,7 @@ export function getConfigKey(configKey) { ...@@ -28,7 +28,7 @@ export function getConfigKey(configKey) {
// 新增参数配置 // 新增参数配置
export function addConfig(data) { export function addConfig(data) {
return request({ return request({
url: '/authority/system/config', url: '/system/config',
method: 'post', method: 'post',
data: data data: data
}) })
...@@ -37,7 +37,7 @@ export function addConfig(data) { ...@@ -37,7 +37,7 @@ export function addConfig(data) {
// 修改参数配置 // 修改参数配置
export function updateConfig(data) { export function updateConfig(data) {
return request({ return request({
url: '/authority/system/config', url: '/system/config',
method: 'put', method: 'put',
data: data data: data
}) })
...@@ -46,7 +46,7 @@ export function updateConfig(data) { ...@@ -46,7 +46,7 @@ export function updateConfig(data) {
// 删除参数配置 // 删除参数配置
export function delConfig(configId) { export function delConfig(configId) {
return request({ return request({
url: '/authority/system/config/' + configId, url: '/system/config/' + configId,
method: 'delete' method: 'delete'
}) })
} }
...@@ -54,7 +54,7 @@ export function delConfig(configId) { ...@@ -54,7 +54,7 @@ export function delConfig(configId) {
// 清理参数缓存 // 清理参数缓存
export function clearCache() { export function clearCache() {
return request({ return request({
url: '/authority/system/config/clearCache', url: '/system/config/clearCache',
method: 'delete' method: 'delete'
}) })
} }
...@@ -62,7 +62,7 @@ export function clearCache() { ...@@ -62,7 +62,7 @@ export function clearCache() {
// 导出参数 // 导出参数
export function exportConfig(query) { export function exportConfig(query) {
return request({ return request({
url: '/authority/system/config/export', url: '/system/config/export',
method: 'get', method: 'get',
params: query params: query
}) })
......
...@@ -31,17 +31,21 @@ export function addUser(data) { ...@@ -31,17 +31,21 @@ export function addUser(data) {
return request({ return request({
url: '/system/user/add', url: '/system/user/add',
method: 'post', method: 'post',
data: data data
}) })
} }
// 修改用户 // 修改用户
export function updateUser(data) { export function updateUser(data) {
const businessId = data.businessId const businessId = data.businessId
data = Qs.stringify(data)
return request({ return request({
url: '/system/user/update/' + businessId, url: '/system/user/update/' + businessId,
method: 'put', method: 'put',
data: data data: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}) })
} }
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="能否登录" prop="status"> <el-form-item label="状态" prop="flag">
<el-select <el-select
v-model="queryParams.allowLogin" v-model="queryParams.flag"
placeholder="请选择用户状态" placeholder="请选择用户状态"
clearable clearable
size="small" size="small"
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
> >
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.status" :key="dict.dictValue"
:label="dict.status" :label="dict.dictLabel"
:value="dict.status" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -152,15 +152,16 @@ ...@@ -152,15 +152,16 @@
v-hasPermi="['sys:user:resetPwd']" v-hasPermi="['sys:user:resetPwd']"
size="mini" size="mini"
type="text" type="text"
:loading="addLoading"
@click="handleResetPwd(scope.row)" @click="handleResetPwd(scope.row)"
>重置</el-button> >重置</el-button>
<el-button <el-button
v-if="scope.row.businessId !== 1" v-if="scope.row.businessId !== 1"
v-hasPermi="['sys:user:delete']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['sys:user:delete']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
...@@ -191,7 +192,7 @@ ...@@ -191,7 +192,7 @@
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
></el-option> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -234,35 +235,36 @@ ...@@ -234,35 +235,36 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="状态" > <el-form-item label="状态">
<el-radio-group v-model="form.flag"> <el-radio-group v-model="form.flag">
<el-radio <el-radio
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictValue" :label="dict.dictValue"
>{{dict.dictLabel}}</el-radio> >{{ dict.dictLabel }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="岗位" prop="postId" > <el-form-item label="岗位" prop="postId">
<treeSelect <treeSelect
v-model="form.postId"
:disable-branch-nodes="true" :disable-branch-nodes="true"
v-model="form.postIds"
multiple multiple
:options="deptChildren" :options="deptChildren"
:show-count="true" :show-count="true"
placeholder="请选择归属部门"
@input="changeValue" @input="changeValue"
placeholder="请选择归属部门" /> />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input v-model="form.remarks" type="textarea" placeholder="请输入内容"></el-input> <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -341,7 +343,6 @@ ...@@ -341,7 +343,6 @@
<script> <script>
import { import {
listUser, listUser,
// selectUserIdsListDept,
getUser, getUser,
delUser, delUser,
addUser, addUser,
...@@ -349,13 +350,15 @@ import { ...@@ -349,13 +350,15 @@ import {
exportUser, exportUser,
resetUserPwd, resetUserPwd,
changeUserStatus, changeUserStatus,
importTemplate, importTemplate
// userLoginManage // userLoginManage
} from '@/api/system/user' } from '@/api/system/user'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { getChildrenDept, treeselect } from '@/api/system/dept' import { getChildrenDept, treeselect } from '@/api/system/dept'
import TreeSelect from '@riophae/vue-treeselect' import TreeSelect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
// import business from '../../../../mock/business'
// import business from '../../../../mock/business'
export default { export default {
name: 'User', name: 'User',
...@@ -415,11 +418,11 @@ export default { ...@@ -415,11 +418,11 @@ export default {
dictValue: '' dictValue: ''
}, },
{ {
dictLabel: '', dictLabel: '启用',
dictValue: '1' dictValue: '1'
}, },
{ {
dictLabel: '', dictLabel: '停用',
dictValue: '0' dictValue: '0'
} }
], ],
...@@ -468,7 +471,9 @@ export default { ...@@ -468,7 +471,9 @@ export default {
allowLogin: '', allowLogin: '',
status: '', status: '',
phone: '', phone: '',
deptId: '' deptId: '',
flag: undefined,
name: undefined
}, },
// 表单校验 // 表单校验
rules: { rules: {
...@@ -517,7 +522,8 @@ export default { ...@@ -517,7 +522,8 @@ export default {
}, },
userInfoLoading: false, userInfoLoading: false,
userImportLoading: false, userImportLoading: false,
userRestLoading: false userRestLoading: false,
addLoading: false
} }
}, },
watch: { watch: {
...@@ -581,9 +587,11 @@ export default { ...@@ -581,9 +587,11 @@ export default {
}, },
/** 查询子部门 */ /** 查询子部门 */
getChildrenDept(userId) { getChildrenDept(userId) {
console.log(userId)
getChildrenDept(userId).then(response => { getChildrenDept(userId).then(response => {
this.deptChildren = response.data.postOptions console.log(response)
this.form.postIds = response.data.checkedKeys this.deptChildren = response.data.postChildren
this.form.postId = response.data.checkedKeys
}) })
}, },
// 筛选节点 // 筛选节点
...@@ -622,7 +630,7 @@ export default { ...@@ -622,7 +630,7 @@ export default {
type: 'success' type: 'success'
}) })
}).catch(function() { }).catch(function() {
row.flag = row.flag === '0' ? '1' : '0' row.flag = row.flag === '1' ? '0' : '1'
}) })
}, },
// 取消按钮 // 取消按钮
...@@ -667,37 +675,27 @@ export default { ...@@ -667,37 +675,27 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.open = true
this.reset() this.reset()
this.getChildrenDept()
this.getTreeSelect()
// this.title = '添加用户'
// this.form.password = '111111'
getUser().then(response => { getUser().then(response => {
this.open = true
this.postOptions = response.posts this.postOptions = response.posts
this.roleOptions = response.roles this.roleOptions = response.roles
// this.open = true this.getChildrenDept()
this.title = '添加' this.title = '添加'
this.form.password = this.initPassword this.form.password = this.initPassword
}) })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.open = true
this.reset() this.reset()
this.getTreeSelect()
const businessId = row.businessId || this.ids const businessId = row.businessId || this.ids
getUser(businessId).then(response => { getUser(row.businessId).then(response => {
this.form = response.data this.form = response.data
this.postOptions = response.posts this.open = true
this.roleOptions = response.roles
this.form.postIds = response.postIds[0]
this.form.roleIds = response.roleIds
this.form.roleIdsSave = JSON.parse(JSON.stringify(response.roleIds)).sort()
// this.open = true
this.title = '修改' this.title = '修改'
this.form.password = '' this.form.password = ''
}) })
this.getChildrenDept(businessId)
}, },
/** 重置密码按钮操作 */ /** 重置密码按钮操作 */
handleResetPwd(row) { handleResetPwd(row) {
...@@ -712,9 +710,6 @@ export default { ...@@ -712,9 +710,6 @@ export default {
}) })
}).catch(() => {}) }).catch(() => {})
}, },
// this.ruleForm.newPassword = ''
// this.ruleForm.row = row.userId
// this.resetPwdDiaLog = !this.resetPwdDiaLog
handleResetPwdSure() { handleResetPwdSure() {
this.$refs.ruleForm.validate(pass => { this.$refs.ruleForm.validate(pass => {
if (pass) { if (pass) {
...@@ -746,106 +741,41 @@ export default { ...@@ -746,106 +741,41 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
// this.$refs[ 'form' ].validate(valid => {
// if (valid) {
// if (this.form.businessId !== undefined) {
// updateUser(this.form).then(response => {
// this.$message('修改成功')
// this.open = false
// this.getList()
// })
// } else {
// addUser(this.form).then(response => {
// this.$message('新增成功')
// this.open = false
// this.getList()
// })
// }
// }
// })
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.businessId) { if (this.form.businessId !== undefined) {
const temp = Object.assign({}, this.form) updateUser(this.form).then(response => {
if (typeof (temp.postIds) === 'number') {
temp.postIds = [this.form.postIds]
} else {
temp.postIds = []
}
delete temp.phone
delete temp.email
const saveRoleList = JSON.stringify(temp.roleIdsSave)
const nowRoleList = JSON.stringify(JSON.parse(JSON.stringify(temp.roleIds)).sort())
if (saveRoleList !== nowRoleList) {
this.$confirm('请确认您的操作,该操作可能会影响业务使用', '提示', {
cancelButtonText: '取消',
confirmButtonText: '确定',
type: 'warning'
}).then(res => {
this.userInfoLoading = true
updateUser(temp).then(response => {
if (response.code === 200) {
this.$message({ this.$message({
message: '修改成功', message: '修改成功',
type: 'success' type: 'success'
}) })
this.upload.open = false
this.open = false this.open = false
this.getList() this.getList()
}
this.userInfoLoading = false
}).catch(e => { this.userInfoLoading = false })
}).catch()
} else {
this.userInfoLoading = true
updateUser(temp).then(response => {
if (response.code === 200) {
this.$message({
message: '修改成功',
type: 'success'
}) })
this.upload.open = false
this.open = false
this.getList()
}
this.userInfoLoading = false
}).catch(e => { this.userInfoLoading = false })
}
} else { } else {
this.userInfoLoading = true
const temp = Object.assign({}, this.form)
if (typeof (temp.postIds) === 'number') {
temp.postIds = [this.form.postIds]
} else {
temp.postIds = []
}
addUser(this.form).then(response => { addUser(this.form).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({ this.$message({
message: '新增成功', message: '新增成功',
type: 'success' type: 'success'
}) })
this.upload.open = false
this.open = false this.open = false
this.getList() this.getList()
} }
this.userInfoLoading = false })
}).catch(e => { this.userInfoLoading = false })
} }
} else {
return false
} }
}) })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const userIds = row.businessId || this.ids const userId = row.businessId || this.ids
this.$confirm('所选择数据被删除后不可再恢复,是否继续?', '提示', { this.$confirm('所选择数据被删除后不可再恢复,是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
return delUser(userIds) return delUser(userId)
}).then(() => { }).then(() => {
this.getList() this.getList()
this.$message({ this.$message({
......
...@@ -58,6 +58,7 @@ export default { ...@@ -58,6 +58,7 @@ export default {
return { return {
form: { form: {
name: '', name: '',
idNumber: '',
groupId: '', groupId: '',
type: '', type: '',
level: '', level: '',
......
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