|
@@ -104,20 +104,16 @@
|
|
|
<el-option :label="item.name" :value="item.adminRoleId" v-for="(item, index) in roleList" :key="index"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="部门" prop="department" v-show="accountType === 0">
|
|
|
- <el-tree
|
|
|
- :data="departmentList"
|
|
|
- show-checkbox
|
|
|
- node-key="id"
|
|
|
- ref="tree"
|
|
|
- highlight-current
|
|
|
- :props="props">
|
|
|
- </el-tree>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="商户" prop="merchant" v-show="accountType === 1 || accountType === 2">
|
|
|
- <el-select v-model="addForm.merchant" placeholder="请选择商户" style="width: 100%;">
|
|
|
- <el-option :label="item.companyName" :value="item.companyWechatId" v-for="(item, index) in merchantList" :key="index"></el-option>
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="部门" prop="adminWebsitId">
|
|
|
+ <el-cascader
|
|
|
+ style="width: 100%"
|
|
|
+ :options="departmentList"
|
|
|
+ :props="{ checkStrictly: true, value: 'websitId', label: 'name' }"
|
|
|
+ v-model="addForm.adminWebsitId"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ </el-cascader>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="密码" prop="newPassword">
|
|
|
<el-input v-model="addForm.newPassword" ref="password1" autocomplete="off" placeholder="请输入密码" :type="passwordType1"></el-input>
|
|
@@ -144,7 +140,6 @@
|
|
|
|
|
|
<script>
|
|
|
import { getAccountList, getRoleList, changeAccountStatus, resetPassword, addAccount, editAccount, getUserInfo, getDepartmentList, getMerchantList } from '@/api/setting'
|
|
|
-
|
|
|
export default {
|
|
|
data() {
|
|
|
var validatePass = (rule, value, callback) => {
|
|
@@ -230,14 +225,13 @@ export default {
|
|
|
},
|
|
|
|
|
|
editId: null,
|
|
|
- accountType: '',
|
|
|
addFormType: 'add',
|
|
|
addFormVisible: false,
|
|
|
addForm: {
|
|
|
account: '', // 账号
|
|
|
nickName: '', // 用户名
|
|
|
- merchant: '', // 商户
|
|
|
role: '', // 角色组
|
|
|
+ adminWebsitId:'',
|
|
|
newPassword: '', // 新密码
|
|
|
confirmPassword: '', // 确认密码
|
|
|
},
|
|
@@ -251,6 +245,9 @@ export default {
|
|
|
role: [
|
|
|
{ required: true, message: '请选择角色组', trigger: 'change' }
|
|
|
],
|
|
|
+ adminWebsitId: [
|
|
|
+ { required: true, message: '请选择部门', trigger: 'change' }
|
|
|
+ ],
|
|
|
newPassword: [
|
|
|
{ required: true, validator: validatePass3, trigger: 'blur' }
|
|
|
],
|
|
@@ -273,13 +270,9 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
'addForm.role'() {
|
|
|
- console.log('change role');
|
|
|
if(this.addForm.role) {
|
|
|
let index = this.$findElem(this.roleList, 'adminRoleId', this.addForm.role);
|
|
|
- this.accountType = this.roleList[index].type - 1;
|
|
|
}
|
|
|
- // this.$refs.tree.setCheckedKeys([]);
|
|
|
- // this.addForm.merchant = '';
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -332,21 +325,6 @@ export default {
|
|
|
return result;
|
|
|
},
|
|
|
|
|
|
- // 获取商户列表
|
|
|
- async getMerchantList() {
|
|
|
- const result = await new Promise((resolve, reject) => {
|
|
|
- getMerchantList({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 1000
|
|
|
- }).then(res => {
|
|
|
- resolve(res.data.records);
|
|
|
- }).catch(res => {
|
|
|
- resolve([]);
|
|
|
- })
|
|
|
- })
|
|
|
- return result;
|
|
|
- },
|
|
|
-
|
|
|
// 更改每页数量
|
|
|
handleSizeChange(val) {
|
|
|
this.pageSize = val;
|
|
@@ -429,7 +407,6 @@ export default {
|
|
|
this.addFormType = type;
|
|
|
this.addFormVisible = true;
|
|
|
this.departmentList = await this.getDepartmentList();
|
|
|
- this.merchantList = await this.getMerchantList();
|
|
|
|
|
|
if(type == 'edit') {
|
|
|
this.editId = id;
|
|
@@ -438,9 +415,8 @@ export default {
|
|
|
account: res.data.userName,
|
|
|
role: res.data.roleId,
|
|
|
nickName: res.data.nickName,
|
|
|
- merchant: res.data.companyWechatId
|
|
|
+ adminWebsitId: res.data.adminWebsitId
|
|
|
}
|
|
|
- this.$refs.tree.setCheckedKeys(res.data.adminWebsitIds || []);
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -457,22 +433,18 @@ export default {
|
|
|
submitAddForm() {
|
|
|
this.$refs.addForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ let adminWebsitId = null
|
|
|
+ if (this.addForm.adminWebsitId instanceof Array) {
|
|
|
+ adminWebsitId = this.addForm.adminWebsitId[this.addForm.adminWebsitId.length - 1]
|
|
|
+ } else {
|
|
|
+ adminWebsitId = this.addForm.adminWebsitId
|
|
|
+ }
|
|
|
let params = {
|
|
|
userName: this.addForm.account,
|
|
|
nickName: this.addForm.nickName,
|
|
|
roleId: this.addForm.role,
|
|
|
+ adminWebsitId: adminWebsitId,
|
|
|
password: this.addForm.newPassword,
|
|
|
- type: this.accountType
|
|
|
- }
|
|
|
- if(this.accountType === 0) {
|
|
|
- params.adminWebsitIds = this.$refs.tree.getCheckedKeys();
|
|
|
- }else {
|
|
|
- let index = this.$findElem(this.merchantList, 'companyWechatId', this.addForm.merchant);
|
|
|
- params.companyWechatId = this.addForm.merchant;
|
|
|
- params.linkName = this.merchantList[index].linkName || '';
|
|
|
- params.linkPhone = this.merchantList[index].linkPhone || '';
|
|
|
- params.email = this.merchantList[index].email || '';
|
|
|
- params.address = this.merchantList[index].address || '';
|
|
|
}
|
|
|
if(this.addFormType == 'edit') {
|
|
|
params.adminUserId = this.editId;
|