|
@@ -32,10 +32,14 @@ import { ElMessage } from 'element-plus';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
// 接口
|
|
|
import { UserStore } from '@/stores/users/user';
|
|
|
+import { OfficeStore } from '@/stores/office/office';
|
|
|
+import { RoleStore } from '@/stores/role/role'; // 角色
|
|
|
import { DictDataStore } from '@/stores/dict/dictData'; // 字典表
|
|
|
import type { IQueryResult } from '@/util/types.util';
|
|
|
const userAxios = UserStore();
|
|
|
const dictAxios = DictDataStore();
|
|
|
+const officeAxios = OfficeStore();
|
|
|
+const roleAxios = RoleStore();
|
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
// 路由
|
|
|
const router = useRouter();
|
|
@@ -48,12 +52,12 @@ let limit: number = proxy.$limit;
|
|
|
let fields: Ref<any[]> = ref([
|
|
|
{ label: '微信用户标识', model: 'openid' },
|
|
|
{ label: '手机号', model: 'tel', isSearch: true },
|
|
|
- { label: '用户姓名', model: 'name', isSearch: true },
|
|
|
{ label: '姓名', model: 'name', isSearch: true },
|
|
|
- { label: '性别', model: 'gender', format: (i: any) => getDict(i, genderList.value) },
|
|
|
- { label: '角色', model: 'role', format: (i: any) => getDict(i, roleList.value) },
|
|
|
- { label: '所属', model: 'belong', format: (i: any) => getDict(i, belongList.value) },
|
|
|
- { label: '状态', model: 'status', format: (i: any) => getDict(i, statusList.value) }
|
|
|
+ { label: '性别', model: 'gender', format: (i: any) => getDict(i, genderList.value, 'dict') },
|
|
|
+ { label: '角色', model: 'role', format: (i: any) => getDict(i, roleList.value, 'role') },
|
|
|
+ { label: '所属街道', model: 'street', format: (i: any) => getDict(i, belongList.value) },
|
|
|
+ { label: '所属社区', model: 'community', format: (i: any) => getDict(i, belongList.value) },
|
|
|
+ { label: '状态', model: 'status', format: (i: any) => getDict(i, statusList.value, 'dict') }
|
|
|
]);
|
|
|
// 操作
|
|
|
let opera: Ref<any[]> = ref([
|
|
@@ -80,7 +84,7 @@ onMounted(async () => {
|
|
|
loading.value = false;
|
|
|
});
|
|
|
const search = async (e: { skip: number; limit: number }) => {
|
|
|
- const info = { skip: e.skip, limit: e.limit, ...searchForm.value, code: 'sqry' };
|
|
|
+ const info = { skip: e.skip, limit: e.limit, ...searchForm.value, role: 'sqry' };
|
|
|
const res: IQueryResult = await userAxios.query(info);
|
|
|
if (res.errcode == '0') {
|
|
|
list.value = res.data;
|
|
@@ -91,10 +95,20 @@ const toSearch = (query) => {
|
|
|
searchForm.value = query;
|
|
|
search({ skip, limit });
|
|
|
};
|
|
|
-const getDict = (e, model) => {
|
|
|
- let data: any = model.find((i: any) => i.value == e);
|
|
|
- if (data) return data.label;
|
|
|
- else return '暂无';
|
|
|
+const getDict = (e, model, type) => {
|
|
|
+ if (type == 'dict') {
|
|
|
+ let data: any = model.find((i: any) => i.value == e);
|
|
|
+ if (data) return data.label;
|
|
|
+ else return '暂无';
|
|
|
+ } else if (type == 'role') {
|
|
|
+ let data: any = model.find((i: any) => i.code == e);
|
|
|
+ if (data) return data.name;
|
|
|
+ else return '暂无';
|
|
|
+ } else {
|
|
|
+ let data: any = model.find((i: any) => i._id == e);
|
|
|
+ if (data) return data.name;
|
|
|
+ else return '暂无';
|
|
|
+ }
|
|
|
};
|
|
|
// 审核
|
|
|
const toExam = async (data) => {
|
|
@@ -116,7 +130,7 @@ const toSave = async (data) => {
|
|
|
};
|
|
|
// 修改
|
|
|
const toEdit = (data) => {
|
|
|
- router.push({ path: '/users/detail', query: { id: data._id } });
|
|
|
+ router.push({ path: '/users/match/detail', query: { id: data._id } });
|
|
|
};
|
|
|
// 删除
|
|
|
const toDel = async (data: any) => {
|
|
@@ -138,16 +152,16 @@ const toClose = () => {
|
|
|
const searchOther = async () => {
|
|
|
let res: IQueryResult;
|
|
|
// 性别
|
|
|
- res = await dictAxios.query({ type: 'gender' });
|
|
|
+ res = await dictAxios.query({ type: 'gender', is_use: '0' });
|
|
|
if (res.errcode == '0') genderList.value = res.data;
|
|
|
// 角色
|
|
|
- res = await dictAxios.query({ type: 'role' });
|
|
|
+ res = await roleAxios.query({ type: 'role', is_use: '0' });
|
|
|
if (res.errcode == '0') roleList.value = res.data;
|
|
|
// 所属
|
|
|
- res = await dictAxios.query({ type: 'type' });
|
|
|
+ res = await officeAxios.query({ is_use: '0' });
|
|
|
if (res.errcode == '0') belongList.value = res.data;
|
|
|
// 状态
|
|
|
- res = await dictAxios.query({ type: 'status' });
|
|
|
+ res = await dictAxios.query({ type: 'status', is_use: '0' });
|
|
|
if (res.errcode == '0') statusList.value = res.data;
|
|
|
};
|
|
|
</script>
|