瀏覽代碼

修改用户管理

zs 1 年之前
父節點
當前提交
ccaa1f1411

+ 42 - 14
src/views/users/detail/index.vue

@@ -10,11 +10,17 @@
             <template #gender>
               <el-option v-for="i in genderList" :key="i.value" :label="i.label" :value="i.value"></el-option>
             </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 #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>
           </cForm>
         </el-col>
@@ -32,10 +38,14 @@ import type { FormRules } from 'element-plus';
 import { useRoute } 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 route = useRoute();
 // 加载中
@@ -44,19 +54,21 @@ const loading: Ref<any> = ref(false);
 let form: Ref<any> = ref({});
 let fields: Ref<any[]> = ref([
   { 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: 'age' },
-  { label: '工作单位', model: 'work' },
+  { label: '角色', model: 'role', type: 'select' },
+  { label: '所属街道', model: 'street', type: 'select' },
+  { label: '所属社区', model: 'community', type: 'select' },
   { label: '头像', model: 'icon', custom: true }
 ]);
 const rules = reactive<FormRules>({});
 // 字典表
 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 () => {
   loading.value = true;
@@ -71,6 +83,9 @@ const search = async () => {
     if (res.errcode == '0') {
       let info: any = res.data as {};
       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;
   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) => {
   let res: IQueryResult;
@@ -92,11 +114,17 @@ const toSave = async (data) => {
 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: '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 = () => {

+ 1 - 1
src/views/users/five/index.vue

@@ -130,7 +130,7 @@ const toSave = async (data) => {
 };
 // 修改
 const toEdit = (data) => {
-  router.push({ path: '/users/match/detail', query: { id: data._id } });
+  router.push({ path: '/users/detail', query: { id: data._id } });
 };
 // 删除
 const toDel = async (data: any) => {

+ 1 - 1
src/views/users/four/index.vue

@@ -130,7 +130,7 @@ const toSave = async (data) => {
 };
 // 修改
 const toEdit = (data) => {
-  router.push({ path: '/users/match/detail', query: { id: data._id } });
+  router.push({ path: '/users/detail', query: { id: data._id } });
 };
 // 删除
 const toDel = async (data: any) => {

+ 1 - 1
src/views/users/one/index.vue

@@ -130,7 +130,7 @@ const toSave = async (data) => {
 };
 // 修改
 const toEdit = (data) => {
-  router.push({ path: '/users/match/detail', query: { id: data._id } });
+  router.push({ path: '/users/detail', query: { id: data._id } });
 };
 // 删除
 const toDel = async (data: any) => {

+ 1 - 1
src/views/users/six/index.vue

@@ -130,7 +130,7 @@ const toSave = async (data) => {
 };
 // 修改
 const toEdit = (data) => {
-  router.push({ path: '/users/match/detail', query: { id: data._id } });
+  router.push({ path: '/users/detail', query: { id: data._id } });
 };
 // 删除
 const toDel = async (data: any) => {

+ 1 - 1
src/views/users/thr/index.vue

@@ -130,7 +130,7 @@ const toSave = async (data) => {
 };
 // 修改
 const toEdit = (data) => {
-  router.push({ path: '/users/match/detail', query: { id: data._id } });
+  router.push({ path: '/users/detail', query: { id: data._id } });
 };
 // 删除
 const toDel = async (data: any) => {

+ 1 - 1
src/views/users/two/index.vue

@@ -130,7 +130,7 @@ const toSave = async (data) => {
 };
 // 修改
 const toEdit = (data) => {
-  router.push({ path: '/users/match/detail', query: { id: data._id } });
+  router.push({ path: '/users/detail', query: { id: data._id } });
 };
 // 删除
 const toDel = async (data: any) => {