|
@@ -87,6 +87,21 @@
|
|
|
<el-checkbox v-for="role in state.roleList" :key="role.id" :label="role.id">{{ role.roleName }}</el-checkbox>
|
|
<el-checkbox v-for="role in state.roleList" :key="role.id" :label="role.id">{{ role.roleName }}</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
</el-checkbox-group>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
|
|
+
|
|
|
|
|
+ <el-card header="管理站点" style="margin-top: 20px;">
|
|
|
|
|
+ <ext-select
|
|
|
|
|
+ v-model="state.adminUserStationIdList"
|
|
|
|
|
+ multiple
|
|
|
|
|
+ placeholder="关联站点"
|
|
|
|
|
+ url="station/list"
|
|
|
|
|
+ url-method="get"
|
|
|
|
|
+ label-key="stationName"
|
|
|
|
|
+ value-key="stationId"
|
|
|
|
|
+ data-key=""
|
|
|
|
|
+ clearable
|
|
|
|
|
+ class="w100 mt5">
|
|
|
|
|
+ </ext-select>
|
|
|
|
|
+ </el-card>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
|
|
<template #footer>
|
|
<template #footer>
|
|
@@ -107,6 +122,8 @@ import u from '/@/utils/u'
|
|
|
import type {FormInstance, FormRules} from 'element-plus';
|
|
import type {FormInstance, FormRules} from 'element-plus';
|
|
|
import ExtDSelect from "/@/components/form/ExtDSelect.vue";
|
|
import ExtDSelect from "/@/components/form/ExtDSelect.vue";
|
|
|
import ExtUpload from "/@/components/form/ExtUpload.vue";
|
|
import ExtUpload from "/@/components/form/ExtUpload.vue";
|
|
|
|
|
+import ExtSelect from "/@/components/form/ExtSelect.vue";
|
|
|
|
|
+import {Session} from "/@/utils/storage";
|
|
|
|
|
|
|
|
// 引入组件
|
|
// 引入组件
|
|
|
// const ExtDetailForm = defineAsyncComponent(() => import('/@/components/form/ExtDetailForm.vue'));
|
|
// const ExtDetailForm = defineAsyncComponent(() => import('/@/components/form/ExtDetailForm.vue'));
|
|
@@ -128,13 +145,15 @@ const initState = () => ({
|
|
|
},
|
|
},
|
|
|
rules: {
|
|
rules: {
|
|
|
username: [u.validator.required],
|
|
username: [u.validator.required],
|
|
|
- mobilePhone: [u.validator.required,u.validator.mobile],
|
|
|
|
|
|
|
+ mobilePhone: [u.validator.required, u.validator.mobile],
|
|
|
nickname: [u.validator.required],
|
|
nickname: [u.validator.required],
|
|
|
status: [u.validator.required],
|
|
status: [u.validator.required],
|
|
|
password: [u.validator.required],
|
|
password: [u.validator.required],
|
|
|
},
|
|
},
|
|
|
roleList: [],
|
|
roleList: [],
|
|
|
- checkRoleIdList: []
|
|
|
|
|
|
|
+ checkRoleIdList: [],
|
|
|
|
|
+ adminUserStationList: [],
|
|
|
|
|
+ adminUserStationIdList: []
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// 定义变量内容
|
|
// 定义变量内容
|
|
@@ -150,6 +169,7 @@ const open = (action: string = 'add', row: any) => {
|
|
|
state.dialog.isShowDialog = true;
|
|
state.dialog.isShowDialog = true;
|
|
|
if (action !== 'add') {
|
|
if (action !== 'add') {
|
|
|
loadData(row.id);
|
|
loadData(row.id);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
};
|
|
};
|
|
@@ -174,27 +194,39 @@ const onCancel = () => {
|
|
|
// 提交
|
|
// 提交
|
|
|
const onSubmit = () => {
|
|
const onSubmit = () => {
|
|
|
formRef.value.validate((valid, fields) => {
|
|
formRef.value.validate((valid, fields) => {
|
|
|
- // console.log('basic checkForm!', valid,fields)
|
|
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
state.btnLoading = true;
|
|
state.btnLoading = true;
|
|
|
const url = state.ruleForm.id > 0 ? "admin-user/modify" : "admin-user/add"
|
|
const url = state.ruleForm.id > 0 ? "admin-user/modify" : "admin-user/add"
|
|
|
$body(url, state.ruleForm).then((id) => {
|
|
$body(url, state.ruleForm).then((id) => {
|
|
|
- console.log(id)
|
|
|
|
|
- if(id){
|
|
|
|
|
|
|
+ if (id) {
|
|
|
state.ruleForm.id = id;
|
|
state.ruleForm.id = id;
|
|
|
}
|
|
}
|
|
|
- state.btnLoading = false;
|
|
|
|
|
|
|
+
|
|
|
Msg.message('操作成功');
|
|
Msg.message('操作成功');
|
|
|
- console.log('submit!')
|
|
|
|
|
if (state.ruleForm.id > 0) {
|
|
if (state.ruleForm.id > 0) {
|
|
|
$body(`admin-user/updateRole`, {userId: state.ruleForm.id, roleIdList: state.checkRoleIdList}).then(() => {
|
|
$body(`admin-user/updateRole`, {userId: state.ruleForm.id, roleIdList: state.checkRoleIdList}).then(() => {
|
|
|
- onClose();
|
|
|
|
|
emit('refresh');
|
|
emit('refresh');
|
|
|
|
|
+ state.btnLoading = false;
|
|
|
|
|
+ if(state.adminUserStationIdList.length ===0){
|
|
|
|
|
+ onClose()
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
- onClose();
|
|
|
|
|
emit('refresh');
|
|
emit('refresh');
|
|
|
}
|
|
}
|
|
|
|
|
+ if (state.adminUserStationIdList.length > 0) {
|
|
|
|
|
+ let adminUserStationList = state.adminUserStationIdList.map(k => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ adminUserId: state.ruleForm.id,
|
|
|
|
|
+ stationId: k
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ $body(`admin-user-station/save`, adminUserStationList).then(() => {
|
|
|
|
|
+ emit('refresh');
|
|
|
|
|
+ state.btnLoading = false;
|
|
|
|
|
+ onClose()
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}).catch(() => {
|
|
}).catch(() => {
|
|
|
state.btnLoading = false;
|
|
state.btnLoading = false;
|
|
|
})
|
|
})
|
|
@@ -233,9 +265,24 @@ const loadData = (id: number) => {
|
|
|
let {adminUser, roles} = res;
|
|
let {adminUser, roles} = res;
|
|
|
state.ruleForm = adminUser;
|
|
state.ruleForm = adminUser;
|
|
|
state.checkRoleIdList = roles.map(k => k.roleId)
|
|
state.checkRoleIdList = roles.map(k => k.roleId)
|
|
|
|
|
+ loadAdminUserStationList()
|
|
|
})
|
|
})
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+const loadAdminUserStationList = () => {
|
|
|
|
|
+ if(state.ruleForm.id<=0){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ let param = {
|
|
|
|
|
+ userId: state.ruleForm.id,
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 1024
|
|
|
|
|
+ }
|
|
|
|
|
+ $get(`admin-user-station/list`, param).then((res: any) => {
|
|
|
|
|
+ let {list} = res;
|
|
|
|
|
+ state.adminUserStationIdList = list.map(k => k.stationId)
|
|
|
|
|
+ state.adminUserStationList = res.list;
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 暴露变量
|
|
// 暴露变量
|