Commit 78a3a205 authored by shen_yan_pu's avatar shen_yan_pu

修改

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