|
@@ -93,6 +93,9 @@ import { mapState, createNamespacedHelpers } from 'vuex';
|
|
const { mapActions: staff } = createNamespacedHelpers('staff');
|
|
const { mapActions: staff } = createNamespacedHelpers('staff');
|
|
const { mapActions: expert } = createNamespacedHelpers('expert');
|
|
const { mapActions: expert } = createNamespacedHelpers('expert');
|
|
const { mapActions: user } = createNamespacedHelpers('user');
|
|
const { mapActions: user } = createNamespacedHelpers('user');
|
|
|
|
+const { mapActions: department } = createNamespacedHelpers('department');
|
|
|
|
+const { mapActions: level } = createNamespacedHelpers('level');
|
|
|
|
+const { mapActions: login } = createNamespacedHelpers('login');
|
|
export default {
|
|
export default {
|
|
name: 'pinfo',
|
|
name: 'pinfo',
|
|
props: {},
|
|
props: {},
|
|
@@ -128,20 +131,40 @@ export default {
|
|
...mapState(['user']),
|
|
...mapState(['user']),
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- ...user(['update']),
|
|
|
|
|
|
+ ...user(['update', 'fetch']),
|
|
...staff({ staffQuery: 'query', staffUpdate: 'update', staffFetch: 'fetch' }),
|
|
...staff({ staffQuery: 'query', staffUpdate: 'update', staffFetch: 'fetch' }),
|
|
...expert({ expertQuery: 'query', expertUpdate: 'update', expertFetch: 'fetch' }),
|
|
...expert({ expertQuery: 'query', expertUpdate: 'update', expertFetch: 'fetch' }),
|
|
|
|
+ ...department({ departmentQuery: 'query', departmentFetch: 'fetch' }),
|
|
|
|
+ ...level({ levelQuery: 'query', levelFetch: 'fetch' }),
|
|
|
|
+ ...login({ logout: 'logout' }),
|
|
async search() {
|
|
async search() {
|
|
|
|
+ this.searchInfo();
|
|
|
|
+ this.selectChild();
|
|
if (this.user.type === '3') {
|
|
if (this.user.type === '3') {
|
|
- this.$set(this, `form`, this.user);
|
|
|
|
|
|
+ const user = await this.fetch(this.user.uid);
|
|
|
|
+ this.$set(this, `form`, user.data);
|
|
} else if (this.user.type === '2') {
|
|
} else if (this.user.type === '2') {
|
|
- const expert = this.expertFetch(this.user.userid);
|
|
|
|
|
|
+ const expert = await this.expertFetch(this.user.userid);
|
|
this.$set(this, `form`, expert.data);
|
|
this.$set(this, `form`, expert.data);
|
|
} else if (this.user.type === '1' || this.user.type === '0') {
|
|
} else if (this.user.type === '1' || this.user.type === '0') {
|
|
- const staff = this.staffFetch(this.user.userid);
|
|
|
|
|
|
+ const staff = await this.staffFetch(this.user.userid);
|
|
this.$set(this, `form`, staff.data);
|
|
this.$set(this, `form`, staff.data);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ // 部门
|
|
|
|
+ async searchInfo() {
|
|
|
|
+ let res = await this.departmentQuery();
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, `deptList`, res.data);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 职务
|
|
|
|
+ async selectChild(dept_id) {
|
|
|
|
+ let res = await this.levelQuery(dept_id);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, `levelList`, res.data);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
inputIdnumber() {
|
|
inputIdnumber() {
|
|
let card = this.form.id_number;
|
|
let card = this.form.id_number;
|
|
if (card.length == 18) {
|
|
if (card.length == 18) {
|
|
@@ -158,7 +181,7 @@ export default {
|
|
this.form.gender = gender;
|
|
this.form.gender = gender;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async onSubmit(from) {
|
|
|
|
|
|
+ async onSubmit() {
|
|
let res = {};
|
|
let res = {};
|
|
let data = JSON.parse(JSON.stringify(this.form));
|
|
let data = JSON.parse(JSON.stringify(this.form));
|
|
if (this.user.type === '3') {
|
|
if (this.user.type === '3') {
|
|
@@ -179,10 +202,18 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.$message.error('信息修改失败');
|
|
this.$message.error('信息修改失败');
|
|
}
|
|
}
|
|
|
|
+ if (data.phone != this.user.phone) {
|
|
|
|
+ this.logoutBtn();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
uploadSuccess({ type, data }) {
|
|
uploadSuccess({ type, data }) {
|
|
this.$set(this.form, `${type}`, data.uri);
|
|
this.$set(this.form, `${type}`, data.uri);
|
|
},
|
|
},
|
|
|
|
+ // 退出登录
|
|
|
|
+ logoutBtn() {
|
|
|
|
+ this.logout();
|
|
|
|
+ this.$router.push({ path: '/' });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|