|
@@ -18,6 +18,7 @@
|
|
|
@query="search"
|
|
|
@edit="toEdit"
|
|
|
@del="toDel"
|
|
|
+ @reset="toReset"
|
|
|
></data-table>
|
|
|
</template>
|
|
|
<template v-else>
|
|
@@ -43,6 +44,7 @@ import methodsUtil from '@/util/opera';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: admins } = createNamespacedHelpers('admins');
|
|
|
const { mapActions: role } = createNamespacedHelpers('role');
|
|
|
+const { mapActions: emailResetPwd } = createNamespacedHelpers('emailResetPwd');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -57,6 +59,7 @@ export default {
|
|
|
],
|
|
|
opera: [
|
|
|
{ label: '修改', method: 'edit' },
|
|
|
+ { label: '重置密码', method: 'reset' },
|
|
|
{ label: '删除', method: 'del', confirm: true, type: 'danger' },
|
|
|
],
|
|
|
btnList: [{ label: '添加', method: 'add' }],
|
|
@@ -70,7 +73,8 @@ export default {
|
|
|
{ label: '名称', model: 'name' },
|
|
|
{ label: '账号', model: 'account' },
|
|
|
{ label: '角色', model: 'role', type: 'select' },
|
|
|
- { label: '密码', model: 'password', type: 'password' },
|
|
|
+ { label: '邮箱', model: 'email' },
|
|
|
+ { label: '密码', model: 'password', type: 'password', display: (i) => i.password == '' },
|
|
|
],
|
|
|
rules: {},
|
|
|
form: {},
|
|
@@ -84,7 +88,9 @@ export default {
|
|
|
methods: {
|
|
|
...methodsUtil,
|
|
|
...role({ roleQuery: 'query' }),
|
|
|
+ ...emailResetPwd({ pwdCreate: 'create' }),
|
|
|
...admins(['query', 'delete', 'fetch', 'update', 'create']),
|
|
|
+ // 重置
|
|
|
async search({ skip = 0, limit = this.limit, ...others } = {}) {
|
|
|
others.shop = this.id;
|
|
|
let query = { skip, limit, ...others };
|
|
@@ -95,10 +101,12 @@ export default {
|
|
|
this.$set(this, `total`, res.total);
|
|
|
}
|
|
|
},
|
|
|
+ // 添加自定义
|
|
|
initAddData() {
|
|
|
const obj = { shop: this.id };
|
|
|
this.$set(this, 'form', obj);
|
|
|
},
|
|
|
+ // 修改
|
|
|
async toEdit({ data }) {
|
|
|
const res = await this.fetch(data._id);
|
|
|
if (this.$checkRes(res)) {
|
|
@@ -109,6 +117,20 @@ export default {
|
|
|
this.$message.error('未找到指定数据');
|
|
|
}
|
|
|
},
|
|
|
+ // 重置密码
|
|
|
+ async toReset({ data }) {
|
|
|
+ this.$confirm('忘记密码,是否确认重置密码?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(async () => {
|
|
|
+ const res = await this.pwdCreate({ account: data.account });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({ type: `success`, message: `重置密码成功` });
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 删除
|
|
|
async toDel({ data }) {
|
|
|
let res = await this.delete(data._id);
|
|
@@ -117,6 +139,7 @@ export default {
|
|
|
this.search();
|
|
|
}
|
|
|
},
|
|
|
+ // 保存
|
|
|
async toSave({ data }) {
|
|
|
let res;
|
|
|
if (data.id) res = await this.update(data);
|
|
@@ -126,15 +149,18 @@ export default {
|
|
|
this.toBackList();
|
|
|
}
|
|
|
},
|
|
|
+ // 查询其他信息
|
|
|
async searchOthers() {
|
|
|
let res = await this.roleQuery();
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `roleList`, res.data);
|
|
|
}
|
|
|
},
|
|
|
+ // 返回
|
|
|
toBack() {
|
|
|
window.history.go('-1');
|
|
|
},
|
|
|
+ // 返回列表
|
|
|
toBackList() {
|
|
|
this.view = 'list';
|
|
|
this.form = {};
|