|
@@ -121,7 +121,7 @@ import bind from '@/components/bind.vue';
|
|
|
// import search from '@/components/search.vue';
|
|
|
import listNormal from '@/layout/list-normal.vue';
|
|
|
import _ from 'lodash';
|
|
|
-import { mapActions, mapState } from 'vuex';
|
|
|
+import { mapActions, mapState, mapMutations } from 'vuex';
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
// metaInfo: {
|
|
@@ -153,11 +153,13 @@ export default {
|
|
|
created() {
|
|
|
this.search();
|
|
|
this.otherList();
|
|
|
+ this.setUser();
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapMutations(['setUser']),
|
|
|
...mapActions(['getList', 'hrOperation']),
|
|
|
async search() {
|
|
|
let result;
|
|
@@ -257,12 +259,12 @@ export default {
|
|
|
console.log(item.mobile);
|
|
|
let result = await this.hrOperation({ type: 'search', data: { tel: item.mobile } });
|
|
|
this.$set(this, `formUser`, result.data);
|
|
|
- console.log(result.data);
|
|
|
this.dialogUser = true;
|
|
|
},
|
|
|
async otherList() {
|
|
|
let result = await this.hrOperation({ type: 'list', data: this.user.corpid });
|
|
|
if (`${result.errcode}` === '0') {
|
|
|
+ console.log(result.data);
|
|
|
this.$set(this, `regionList`, result.data);
|
|
|
} else {
|
|
|
this.$message.error(result.errmsg ? result.errmsg : 'error');
|
|
@@ -272,9 +274,29 @@ export default {
|
|
|
let res = this.regionList.filter(item => {
|
|
|
return `${item.name}` === `${select}`;
|
|
|
});
|
|
|
+ console.log(res);
|
|
|
},
|
|
|
- onSubmitUser() {
|
|
|
- this.dialogUser = false;
|
|
|
+ async onSubmitUser() {
|
|
|
+ let adminres = this.regionList.filter(item => item.role === '0');
|
|
|
+ let adminid;
|
|
|
+ for (const item of adminres) {
|
|
|
+ adminid = item._id;
|
|
|
+ }
|
|
|
+ let newres = this.regionList.filter(item => item.role === '1');
|
|
|
+ let newid;
|
|
|
+ for (const item of newres) {
|
|
|
+ newid = item._id;
|
|
|
+ }
|
|
|
+ let result = await this.hrOperation({ type: 'change', data: { corpid: this.user.corpid, adminid: adminid, id: newid } });
|
|
|
+ if (`${result.errcode}` === '0') {
|
|
|
+ this.$message.success('修改管理成功');
|
|
|
+ sessionStorage.removeItem('token');
|
|
|
+ sessionStorage.removeItem('user');
|
|
|
+ this.setUser(undefined);
|
|
|
+ this.$router.push('/login');
|
|
|
+ } else {
|
|
|
+ this.$message.error(result.errmsg);
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|