|
@@ -10,11 +10,17 @@
|
|
<template #gender>
|
|
<template #gender>
|
|
<el-option v-for="i in genderList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
<el-option v-for="i in genderList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
</template>
|
|
</template>
|
|
- <template #type>
|
|
|
|
- <el-option v-for="i in typeList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
|
|
|
+ <template #role>
|
|
|
|
+ <el-option v-for="i in roleList" :key="i.code" :label="i.name" :value="i.code"></el-option>
|
|
|
|
+ </template>
|
|
|
|
+ <template #street>
|
|
|
|
+ <el-option @click="toChange(i)" v-for="i in streetList" :key="i._id" :label="i.name" :value="i._id"></el-option>
|
|
|
|
+ </template>
|
|
|
|
+ <template #community>
|
|
|
|
+ <el-option v-for="i in communityList" :key="i._id" :label="i.name" :value="i._id"></el-option>
|
|
</template>
|
|
</template>
|
|
<template #icon>
|
|
<template #icon>
|
|
- <cUpload :model="`${'icon'}`" listType="picture-card" :limit="1" url="/files/ball/match/upload" :list="form.icon" @change="onUpload"></cUpload>
|
|
|
|
|
|
+ <cUpload :model="`${'icon'}`" listType="picture-card" :limit="1" url="/files/material/user/upload" :list="form.icon" @change="onUpload"></cUpload>
|
|
</template>
|
|
</template>
|
|
</cForm>
|
|
</cForm>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -32,10 +38,14 @@ import type { FormRules } from 'element-plus';
|
|
import { useRoute } from 'vue-router';
|
|
import { useRoute } from 'vue-router';
|
|
// 接口
|
|
// 接口
|
|
import { UserStore } from '@/stores/users/user';
|
|
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 { DictDataStore } from '@/stores/dict/dictData'; // 字典表
|
|
import type { IQueryResult } from '@/util/types.util';
|
|
import type { IQueryResult } from '@/util/types.util';
|
|
const userAxios = UserStore();
|
|
const userAxios = UserStore();
|
|
const dictAxios = DictDataStore();
|
|
const dictAxios = DictDataStore();
|
|
|
|
+const officeAxios = OfficeStore();
|
|
|
|
+const roleAxios = RoleStore();
|
|
// 路由
|
|
// 路由
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
// 加载中
|
|
// 加载中
|
|
@@ -44,19 +54,21 @@ const loading: Ref<any> = ref(false);
|
|
let form: Ref<any> = ref({});
|
|
let form: Ref<any> = ref({});
|
|
let fields: Ref<any[]> = ref([
|
|
let fields: Ref<any[]> = ref([
|
|
{ label: '微信用户标识', model: 'openid', options: { disabled: true } },
|
|
{ label: '微信用户标识', model: 'openid', options: { disabled: true } },
|
|
- { label: '账号', model: 'username', options: { disabled: true } },
|
|
|
|
- { label: '名称', model: 'name' },
|
|
|
|
- { label: '手机号', model: 'phone' },
|
|
|
|
- { label: '电子邮箱', model: 'email' },
|
|
|
|
|
|
+ { label: '联系电话', model: 'tel' },
|
|
|
|
+ { label: '姓名', model: 'name' },
|
|
{ label: '性别', model: 'gender', type: 'select' },
|
|
{ label: '性别', model: 'gender', type: 'select' },
|
|
- { label: '年龄', model: 'age' },
|
|
|
|
- { label: '工作单位', model: 'work' },
|
|
|
|
|
|
+ { label: '角色', model: 'role', type: 'select' },
|
|
|
|
+ { label: '所属街道', model: 'street', type: 'select' },
|
|
|
|
+ { label: '所属社区', model: 'community', type: 'select' },
|
|
{ label: '头像', model: 'icon', custom: true }
|
|
{ label: '头像', model: 'icon', custom: true }
|
|
]);
|
|
]);
|
|
const rules = reactive<FormRules>({});
|
|
const rules = reactive<FormRules>({});
|
|
// 字典表
|
|
// 字典表
|
|
const genderList: Ref<any> = ref([]);
|
|
const genderList: Ref<any> = ref([]);
|
|
-const typeList: Ref<any> = ref([]);
|
|
|
|
|
|
+const roleList: Ref<any> = ref([]);
|
|
|
|
+const streetList: Ref<any> = ref([]);
|
|
|
|
+const communityList: Ref<any> = ref([]);
|
|
|
|
+const statusList: Ref<any> = ref([]);
|
|
// 请求
|
|
// 请求
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
loading.value = true;
|
|
loading.value = true;
|
|
@@ -71,6 +83,9 @@ const search = async () => {
|
|
if (res.errcode == '0') {
|
|
if (res.errcode == '0') {
|
|
let info: any = res.data as {};
|
|
let info: any = res.data as {};
|
|
form.value = info;
|
|
form.value = info;
|
|
|
|
+ // 所属社区
|
|
|
|
+ res = await officeAxios.query({ belong: info.street, type: '1', is_use: '0' });
|
|
|
|
+ if (res.errcode == '0') communityList.value = res.data;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -78,6 +93,13 @@ const onUpload = (e: { model: string; value: Array<[]> }) => {
|
|
const { model, value } = e;
|
|
const { model, value } = e;
|
|
form.value[model] = value;
|
|
form.value[model] = value;
|
|
};
|
|
};
|
|
|
|
+const toChange = async (val: any) => {
|
|
|
|
+ form.value.community = '';
|
|
|
|
+ let res: IQueryResult;
|
|
|
|
+ // 所属社区
|
|
|
|
+ res = await officeAxios.query({ belong: val._id, type: '1', is_use: '0' });
|
|
|
|
+ if (res.errcode == '0') communityList.value = res.data;
|
|
|
|
+};
|
|
// 保存
|
|
// 保存
|
|
const toSave = async (data) => {
|
|
const toSave = async (data) => {
|
|
let res: IQueryResult;
|
|
let res: IQueryResult;
|
|
@@ -92,11 +114,17 @@ const toSave = async (data) => {
|
|
const searchOther = async () => {
|
|
const searchOther = async () => {
|
|
let res: IQueryResult;
|
|
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;
|
|
if (res.errcode == '0') genderList.value = res.data;
|
|
- // 类别
|
|
|
|
- res = await dictAxios.query({ type: 'type' });
|
|
|
|
- if (res.errcode == '0') typeList.value = res.data;
|
|
|
|
|
|
+ // 角色
|
|
|
|
+ res = await roleAxios.query({ type: 'role', is_use: '0' });
|
|
|
|
+ if (res.errcode == '0') roleList.value = res.data;
|
|
|
|
+ // 所属街道
|
|
|
|
+ res = await officeAxios.query({ type: '0', is_use: '0' });
|
|
|
|
+ if (res.errcode == '0') streetList.value = res.data;
|
|
|
|
+ // 状态
|
|
|
|
+ res = await dictAxios.query({ type: 'status', is_use: '0' });
|
|
|
|
+ if (res.errcode == '0') statusList.value = res.data;
|
|
};
|
|
};
|
|
// 返回上一页
|
|
// 返回上一页
|
|
const toBack = () => {
|
|
const toBack = () => {
|