guhongwei преди 2 години
родител
ревизия
11a2e58094

+ 10 - 0
src/router/module/account.js

@@ -53,5 +53,15 @@ export default [
     path: '/user/company/info',
     meta: { title: '详细信息' },
     component: () => import('@/views/user/company/info.vue')
+  },
+  {
+    path: '/user/expert',
+    meta: { title: '专家用户' },
+    component: () => import('@/views/user/expert/index.vue')
+  },
+  {
+    path: '/user/expert/detail',
+    meta: { title: '信息管理' },
+    component: () => import('@/views/user/expert/detail.vue')
   }
 ];

+ 4 - 1
src/views/admin/admins/detail.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="detail">
     <el-row>
-      <el-col :span="24" class="main">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <cSearch :is_back="true" @toBack="toBack"></cSearch>
         </el-col>
@@ -45,6 +45,7 @@ const admin = AdminStore();
 const dictData = DictDataStore();
 const role = RoleStore();
 const route = useRoute();
+const loading = ref(false);
 let form: Ref<any> = ref({});
 let roleList: Ref<any> = ref([]);
 let pidList: Ref<any> = ref([]);
@@ -74,8 +75,10 @@ const rules = reactive<FormRules>({
   type: [{ required: true, message: '用户类型', trigger: 'blur' }]
 });
 onMounted(async () => {
+  loading.value = true;
   await searchOther();
   await search();
+  loading.value = false;
 });
 const search = async () => {
   if (route.query.id) {

+ 4 - 1
src/views/admin/admins/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch"> </cSearch>
         </el-col>
@@ -26,6 +26,7 @@ import type { IQueryResult } from '@/util/types.util';
 const admin = AdminStore();
 const router = useRouter();
 const { proxy } = getCurrentInstance() as any;
+const loading = ref(false);
 // 列表数据
 let list: Ref<any> = ref([]);
 // 总数
@@ -50,7 +51,9 @@ let opera: Ref<any[]> = ref([
 let searchForm: Ref<any> = ref({});
 
 onMounted(async () => {
+  loading.value = true;
   await search({ skip, limit });
+  loading.value = false;
 });
 // 查询
 const search = async (e: { skip: number; limit: number }) => {

+ 5 - 4
src/views/admin/business/detail.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="detail">
     <el-row>
-      <el-col :span="24" class="main">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <cSearch :is_back="true" @toBack="toBack"></cSearch>
         </el-col>
@@ -45,6 +45,7 @@ const admin = AdminStore();
 const dictData = DictDataStore();
 const role = RoleStore();
 const route = useRoute();
+const loading = ref(false);
 let form: Ref<any> = ref({});
 let roleList: Ref<any> = ref([]);
 let pidList: Ref<any> = ref([]);
@@ -74,15 +75,15 @@ const rules = reactive<FormRules>({
   type: [{ required: true, message: '用户类型', trigger: 'blur' }]
 });
 onMounted(async () => {
+  loading.value = true;
   await searchOther();
   await search();
+  loading.value = false;
 });
 const search = async () => {
   if (route.query.id) {
     let res: IQueryResult = await admin.fetch(route.query.id);
-    if (res.errcode == 0) {
-      form.value = res.data as {};
-    }
+    if (res.errcode == 0) form.value = res.data as {};
   } else form.value.type = '3';
 };
 // 提交

+ 4 - 1
src/views/admin/business/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch"> </cSearch>
         </el-col>
@@ -26,6 +26,7 @@ import type { IQueryResult } from '@/util/types.util';
 const admin = AdminStore();
 const router = useRouter();
 const { proxy } = getCurrentInstance() as any;
+const loading = ref(false);
 // 列表数据
 let list: Ref<any> = ref([]);
 // 总数
@@ -50,7 +51,9 @@ let opera: Ref<any[]> = ref([
 let searchForm: Ref<any> = ref({});
 
 onMounted(async () => {
+  loading.value = true;
   await search({ skip, limit });
+  loading.value = false;
 });
 // 查询
 const search = async (e: { skip: number; limit: number }) => {

+ 4 - 1
src/views/admin/mechanism/detail.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="detail">
     <el-row>
-      <el-col :span="24" class="main">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <cSearch :is_back="true" @toBack="toBack"></cSearch>
         </el-col>
@@ -45,6 +45,7 @@ const admin = AdminStore();
 const dictData = DictDataStore();
 const role = RoleStore();
 const route = useRoute();
+const loading = ref(false);
 let form: Ref<any> = ref({});
 let roleList: Ref<any> = ref([]);
 let pidList: Ref<any> = ref([]);
@@ -74,8 +75,10 @@ const rules = reactive<FormRules>({
   type: [{ required: true, message: '用户类型', trigger: 'blur' }]
 });
 onMounted(async () => {
+  loading.value = true;
   await searchOther();
   await search();
+  loading.value = false;
 });
 const search = async () => {
   if (route.query.id) {

+ 4 - 1
src/views/admin/mechanism/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch"> </cSearch>
         </el-col>
@@ -26,6 +26,7 @@ import type { IQueryResult } from '@/util/types.util';
 const admin = AdminStore();
 const router = useRouter();
 const { proxy } = getCurrentInstance() as any;
+const loading = ref(false);
 // 列表数据
 let list: Ref<any> = ref([]);
 // 总数
@@ -50,7 +51,9 @@ let opera: Ref<any[]> = ref([
 let searchForm: Ref<any> = ref({});
 
 onMounted(async () => {
+  loading.value = true;
   await search({ skip, limit });
+  loading.value = false;
 });
 // 查询
 const search = async (e: { skip: number; limit: number }) => {

+ 4 - 1
src/views/system/dict/detail.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <c-search :is_title="false" :is_back="true" @toBack="toBack" :is_search="true" :fields="fields" @search="toSearch">
             <template #type>
@@ -51,6 +51,7 @@ const dictType = DictTypeStore();
 const dictData = DictDataStore();
 const route = useRoute();
 const { proxy } = getCurrentInstance() as any;
+const loading = ref(false);
 // 列表数据
 let list: Ref<any> = ref([]);
 // 总数
@@ -95,8 +96,10 @@ let type: Ref<any> = ref('');
 let typeList: Ref<any> = ref([]);
 
 onMounted(async () => {
+  loading.value = true;
   await searchOther();
   await search({ skip, limit });
+  loading.value = false;
 });
 // 查询
 const search = async (e: { skip: number; limit: number }) => {

+ 4 - 1
src/views/system/dict/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch">
             <template #type>
@@ -48,6 +48,7 @@ const dictType = DictTypeStore();
 const dictData = DictDataStore();
 const router = useRouter();
 const { proxy } = getCurrentInstance() as any;
+const loading = ref(false);
 // 列表数据
 let list: Ref<any> = ref([]);
 // 总数
@@ -85,8 +86,10 @@ const rules = reactive<FormRules>({
 let searchForm: Ref<any> = ref({});
 
 onMounted(async () => {
+  loading.value = true;
   await searchOther();
   await search({ skip, limit });
+  loading.value = false;
 });
 // 查询
 const search = async (e: { skip: number; limit: number }) => {

+ 152 - 0
src/views/user/expert/detail.vue

@@ -0,0 +1,152 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">
+          <cSearch :is_back="true" @toBack="toBack"></cSearch>
+        </el-col>
+        <el-col :span="24" class="two">
+          <cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="onSubmit" :disabled="disabled">
+            <template #type>
+              <el-option v-for="(i, index) in typeList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #code>
+              <el-option v-for="(i, index) in codeList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #password>
+              <el-input v-model="form.password" placeholder="请输入密码" :disabled="form._id ? true : false" show-password></el-input>
+            </template>
+            <template #area>
+              <el-option v-for="(i, index) in areaList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #icon="{ item }">
+              <cUpload :model="item.model" :limit="1" url="/files/expert/upload" :list="form[item.model]" listType="picture" @change="onUpload"></cUpload>
+            </template>
+            <template #status>
+              <el-option v-for="(i, index) in statusList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #personal_id>
+              <el-option v-for="(i, index) in personalList" :key="index" :label="i.name" :value="i._id"></el-option>
+            </template>
+          </cForm>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+import type { FormRules } from 'element-plus';
+import type { Ref } from 'vue';
+import { ref, reactive, onMounted } from 'vue';
+import { ElMessage } from 'element-plus';
+import { useRoute } from 'vue-router';
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import { RoleStore } from '@common/src/stores/system/role'; // 角色
+import { ExpertStore } from '@common/src/stores/admins/expert'; // 角色
+import { PersonalStore } from '@common/src/stores/admins/personal';
+import type { IQueryResult } from '@/util/types.util';
+const expert = ExpertStore();
+const dictData = DictDataStore();
+const role = RoleStore();
+const personal = PersonalStore();
+const route = useRoute();
+const loading = ref(false);
+let form: Ref<any> = ref({});
+let roleList: Ref<any> = ref([]);
+let statusList: Ref<any> = ref([]);
+let codeList: Ref<any> = ref([]);
+let typeList: Ref<any> = ref([{ label: '专家', value: '6' }]);
+let areaList: Ref<any> = ref([]);
+let personalList: Ref<any> = ref([]);
+let disabled: Ref<any> = ref(false);
+// 表单
+let formFields: Ref<any[]> = ref([
+  { label: '用户类型', model: 'type', type: 'select', options: { disabled: true } },
+  { label: '邀请码', model: 'code', type: 'select' },
+  { label: '账号', model: 'account' },
+  { label: '密码', model: 'password', custom: true },
+  { label: '名称', model: 'name' },
+  { label: '手机号', model: 'phone' },
+  { label: '电子邮箱', model: 'email' },
+  { label: '联系地址', model: 'address' },
+  { label: '办公电话', model: 'work_phone' },
+  { label: '所属行业', model: 'industry' },
+  { label: '所属辖区', model: 'area', type: 'select' },
+  { label: '身份证号', model: 'card' },
+  { label: '出生日期', model: 'birth' },
+  { label: 'qq&&微信', model: 'qqwx' },
+  { label: '所在院校', model: 'school' },
+  { label: '最高学历', model: 'education' },
+  { label: '所学专业', model: 'major' },
+  { label: '单位名称', model: 'company' },
+  { label: '职务职称', model: 'zwzc' },
+  { label: '头像图片', model: 'icon', custom: true },
+  { label: '擅长领域', model: 'expertise' },
+  { label: '工作经历', model: 'workexperience' },
+  { label: '科研综述', model: 'scientific' },
+  { label: '承担项目', model: 'undertakingproject' },
+  { label: '科技奖励', model: 'scienceaward' },
+  { label: '社会任职', model: 'social' },
+  { label: '状态', model: 'status', type: 'select' },
+  { label: '个人用户id', model: 'personal_id', type: 'select' } //查询个人用户,选择
+]);
+const rules = reactive<FormRules>({
+  name: [{ required: true, message: '名称', trigger: 'blur' }],
+  account: [{ required: true, message: '账号', trigger: 'blur' }],
+  type: [{ required: true, message: '用户类型', trigger: 'blur' }]
+});
+onMounted(async () => {
+  loading.value = true;
+  if (route.query.isdisabled == 'true') disabled.value = true;
+  await searchOther();
+  await search();
+  loading.value = false;
+});
+const search = async () => {
+  if (route.query.id) {
+    let res: IQueryResult = await expert.fetch(route.query.id);
+    if (res.errcode == 0) form.value = res.data as {};
+  } else form.value = { type: '6', status: '1' };
+};
+const onUpload = (e: { model: string; value: Array<[]> }) => {
+  const { model, value } = e;
+  form.value[model] = value;
+};
+// 提交
+const onSubmit = async (data) => {
+  let res: IQueryResult;
+  if (data._id) res = await expert.update(data);
+  else res = await expert.create(data);
+  if (res.errcode == 0) {
+    ElMessage({ type: `success`, message: `维护信息成功` });
+    toBack();
+  }
+};
+
+// 返回上一页
+const toBack = () => {
+  window.history.go(-1);
+};
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 邀请码
+  res = await dictData.query({ type: 'account_code' });
+  if (res.errcode == 0) {
+    let data: any = res.data;
+    codeList.value = data.filter((i) => i.value != 'CJGLY');
+  }
+  // 角色
+  res = await role.query();
+  if (res.errcode == 0) roleList.value = res.data;
+  // 所属辖区
+  res = await dictData.query({ type: 'jl_area' });
+  if (res.errcode == 0) areaList.value = res.data;
+  // 状态
+  res = await dictData.query({ type: 'common_status' });
+  if (res.errcode == 0) statusList.value = res.data;
+  res = await personal.query();
+  if (res.errcode == 0) personalList.value = res.data;
+};
+</script>
+<style scoped lang="scss"></style>

+ 169 - 0
src/views/user/expert/index.vue

@@ -0,0 +1,169 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">
+          <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch"> </cSearch>
+        </el-col>
+        <el-col :span="24" class="two">
+          <cButton @toAdd="toAdd()"> </cButton>
+        </el-col>
+        <el-col :span="24" class="thr">
+          <cTable
+            :fields="fields"
+            :opera="opera"
+            :list="list"
+            @query="search"
+            :total="total"
+            @view="toView"
+            @edit="toEdit"
+            @exam="toExam"
+            @del="toDel"
+            :select="false"
+          >
+          </cTable>
+        </el-col>
+      </el-col>
+    </el-row>
+    <cDialog :dialog="dialog" @handleClose="toClose">
+      <template v-slot:info>
+        <cForm v-if="dialog.type == '1'" :span="24" :fields="formFields" :form="form" :rules="{}" @save="onSubmit">
+          <template #status>
+            <el-option v-for="(i, index) in statusList" :key="index" :label="i.label" :value="i.value"></el-option>
+          </template>
+        </cForm>
+      </template>
+    </cDialog>
+  </div>
+</template>
+<script lang="ts" setup>
+import _ from 'lodash';
+import type { Ref } from 'vue';
+import { ref, onMounted, getCurrentInstance } from 'vue';
+import { ElMessage } from 'element-plus';
+import { useRouter } from 'vue-router';
+import { ExpertStore } from '@common/src/stores/admins/expert';
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import type { IQueryResult } from '@/util/types.util';
+const expert = ExpertStore();
+const dictData = DictDataStore();
+const router = useRouter();
+const { proxy } = getCurrentInstance() as any;
+const loading = ref(false);
+// 列表数据
+let list: Ref<any> = ref([]);
+// 总数
+let total: Ref<number> = ref(0);
+let skip = 0;
+let limit: number = proxy.$limit;
+// 列表
+let fields: Ref<any[]> = ref([
+  { label: '邀请码', model: 'code', isSearch: true },
+  { label: '账号', model: 'account', isSearch: true },
+  { label: '姓名', model: 'name', isSearch: true },
+  { label: '手机号', model: 'phone', isSearch: true },
+  { label: '所属辖区', model: 'area' },
+  { label: '状态', model: 'status', format: (i) => getDict(i, 'status') }
+]);
+// 操作
+let opera: Ref<any[]> = ref([
+  { label: '查看', method: 'view', type: 'success' },
+  { label: '修改', method: 'edit' },
+  { label: '审核', method: 'exam', type: 'warning' },
+  { label: '删除', method: 'del', confirm: true, type: 'danger' }
+]);
+const dialog: Ref<{ type: string; show: boolean; title: string }> = ref({ type: '1', show: false, title: '信息管理' });
+let form: Ref<{}> = ref({});
+// 表单
+let formFields: Ref<any[]> = ref([{ label: '状态', model: 'status', type: 'select' }]);
+// 查询数据
+let searchForm: Ref<any> = ref({});
+let statusList: Ref<any> = ref([]);
+onMounted(async () => {
+  loading.value = true;
+  await searchOther();
+  await search({ skip, limit });
+  loading.value = false;
+});
+// 查询
+const search = async (e: { skip: number; limit: number }) => {
+  const { skip, limit } = e;
+  const condition = _.cloneDeep(searchForm.value);
+  let info = { limit: limit, skip: skip, ...condition, type: '6' };
+  let res: IQueryResult = await expert.query(info);
+  if (res.errcode == 0) {
+    list.value = res.data;
+    total.value = res.total;
+  }
+};
+const toSearch = (query) => {
+  searchForm.value = query;
+  search({ skip, limit });
+};
+const getDict = (e, model) => {
+  if (model == 'status') {
+    let data: any = statusList.value.find((i: any) => i.value == e);
+    if (data) return data.label;
+    else return '暂无';
+  }
+};
+// 新增
+const toAdd = () => {
+  router.push({ path: '/user/expert/detail' });
+};
+const toView = (data) => {
+  router.push({ path: '/user/expert/detail', query: { id: data._id, isdisabled: 'true' } });
+};
+// 修改
+const toEdit = async (data) => {
+  router.push({ path: '/user/expert/detail', query: { id: data._id } });
+};
+const toExam = async (data) => {
+  let res: IQueryResult = await expert.fetch(data._id);
+  if (res.errcode == 0) {
+    form.value = res.data;
+    dialog.value = { title: '信息管理', show: true, type: '1' };
+  }
+};
+// 提交
+const onSubmit = async (data) => {
+  let res: IQueryResult;
+  if (data._id) res = await expert.update(data);
+  else res = await expert.create(data);
+  if (res.errcode == 0) {
+    ElMessage({ type: `success`, message: `审核成功` });
+    toClose();
+  }
+};
+// 弹框关闭
+const toClose = () => {
+  form.value = {};
+  searchForm.value = {};
+  dialog.value = { title: '信息管理', show: false, type: '1' };
+  search({ skip, limit });
+};
+// 删除
+const toDel = async (data) => {
+  let res: IQueryResult = await expert.del(data._id);
+  if (res.errcode == 0) {
+    ElMessage({ type: `success`, message: `刪除信息成功` });
+    search({ skip, limit });
+  }
+};
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 状态
+  res = await dictData.query({ type: 'common_status' });
+  if (res.errcode == 0) statusList.value = res.data;
+};
+</script>
+<style lang="scss" scoped>
+.main {
+  .one {
+    margin: 0 0 10px 0;
+  }
+  .two {
+    margin: 0 0 10px 0;
+  }
+}
+</style>

+ 7 - 2
src/views/user/personal/detail.vue

@@ -1,12 +1,12 @@
 <template>
   <div id="detail">
     <el-row>
-      <el-col :span="24" class="main">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <cSearch :is_back="true" @toBack="toBack"></cSearch>
         </el-col>
         <el-col :span="24" class="two">
-          <cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="onSubmit">
+          <cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="onSubmit" :disabled="disabled">
             <template #type>
               <el-option v-for="(i, index) in typeList" :key="index" :label="i.label" :value="i.value"></el-option>
             </template>
@@ -43,12 +43,14 @@ const personal = PersonalStore();
 const dictData = DictDataStore();
 const role = RoleStore();
 const route = useRoute();
+const loading = ref(false);
 let form: Ref<any> = ref({});
 let roleList: Ref<any> = ref([]);
 let statusList: Ref<any> = ref([]);
 let codeList: Ref<any> = ref([]);
 let typeList: Ref<any> = ref([{ label: '个人', value: '4' }]);
 let areaList: Ref<any> = ref([]);
+let disabled: Ref<any> = ref(false);
 // 表单
 let formFields: Ref<any[]> = ref([
   { label: '用户类型', model: 'type', type: 'select', options: { disabled: true } },
@@ -74,8 +76,11 @@ const rules = reactive<FormRules>({
   type: [{ required: true, message: '用户类型', trigger: 'blur' }]
 });
 onMounted(async () => {
+  loading.value = true;
+  if (route.query.isdisabled == 'true') disabled.value = true;
   await searchOther();
   await search();
+  loading.value = false;
 });
 const search = async () => {
   if (route.query.id) {

+ 77 - 6
src/views/user/personal/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight">
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch"> </cSearch>
         </el-col>
@@ -9,10 +9,31 @@
           <cButton @toAdd="toAdd()"> </cButton>
         </el-col>
         <el-col :span="24" class="thr">
-          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @edit="toEdit" @del="toDel" :select="false"> </cTable>
+          <cTable
+            :fields="fields"
+            :opera="opera"
+            :list="list"
+            @query="search"
+            :total="total"
+            @view="toView"
+            @edit="toEdit"
+            @exam="toExam"
+            @del="toDel"
+            :select="false"
+          >
+          </cTable>
         </el-col>
       </el-col>
     </el-row>
+    <cDialog :dialog="dialog" @handleClose="toClose">
+      <template v-slot:info>
+        <cForm v-if="dialog.type == '1'" :span="24" :fields="formFields" :form="form" :rules="{}" @save="onSubmit">
+          <template #status>
+            <el-option v-for="(i, index) in statusList" :key="index" :label="i.label" :value="i.value"></el-option>
+          </template>
+        </cForm>
+      </template>
+    </cDialog>
   </div>
 </template>
 <script lang="ts" setup>
@@ -22,10 +43,13 @@ import { ref, onMounted, getCurrentInstance } from 'vue';
 import { ElMessage } from 'element-plus';
 import { useRouter } from 'vue-router';
 import { PersonalStore } from '@common/src/stores/admins/personal';
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
 import type { IQueryResult } from '@/util/types.util';
 const personal = PersonalStore();
+const dictData = DictDataStore();
 const router = useRouter();
 const { proxy } = getCurrentInstance() as any;
+const loading = ref(false);
 // 列表数据
 let list: Ref<any> = ref([]);
 // 总数
@@ -39,19 +63,27 @@ let fields: Ref<any[]> = ref([
   { label: '姓名', model: 'name', isSearch: true },
   { label: '手机号', model: 'phone', isSearch: true },
   { label: '所属辖区', model: 'area' },
-  { label: '状态', model: 'status' }
+  { label: '状态', model: 'status', format: (i) => getDict(i, 'status') }
 ]);
 // 操作
 let opera: Ref<any[]> = ref([
+  { label: '查看', method: 'view', type: 'success' },
   { label: '修改', method: 'edit' },
+  { label: '审核', method: 'exam', type: 'warning' },
   { label: '删除', method: 'del', confirm: true, type: 'danger' }
 ]);
-
+const dialog: Ref<{ type: string; show: boolean; title: string }> = ref({ type: '1', show: false, title: '信息管理' });
+let form: Ref<{}> = ref({});
+// 表单
+let formFields: Ref<any[]> = ref([{ label: '状态', model: 'status', type: 'select' }]);
 // 查询数据
 let searchForm: Ref<any> = ref({});
-
+let statusList: Ref<any> = ref([]);
 onMounted(async () => {
+  loading.value = true;
+  await searchOther();
   await search({ skip, limit });
+  loading.value = false;
 });
 // 查询
 const search = async (e: { skip: number; limit: number }) => {
@@ -68,15 +100,48 @@ const toSearch = (query) => {
   searchForm.value = query;
   search({ skip, limit });
 };
+const getDict = (e, model) => {
+  if (model == 'status') {
+    let data: any = statusList.value.find((i: any) => i.value == e);
+    if (data) return data.label;
+    else return '暂无';
+  }
+};
 // 新增
 const toAdd = () => {
   router.push({ path: '/user/personal/detail' });
 };
+const toView = (data) => {
+  router.push({ path: '/user/personal/detail', query: { id: data._id, isdisabled: 'true' } });
+};
 // 修改
 const toEdit = async (data) => {
   router.push({ path: '/user/personal/detail', query: { id: data._id } });
 };
-
+const toExam = async (data) => {
+  let res: IQueryResult = await personal.fetch(data._id);
+  if (res.errcode == 0) {
+    form.value = res.data;
+    dialog.value = { title: '信息管理', show: true, type: '1' };
+  }
+};
+// 提交
+const onSubmit = async (data) => {
+  let res: IQueryResult;
+  if (data._id) res = await personal.update(data);
+  else res = await personal.create(data);
+  if (res.errcode == 0) {
+    ElMessage({ type: `success`, message: `审核成功` });
+    toClose();
+  }
+};
+// 弹框关闭
+const toClose = () => {
+  form.value = {};
+  searchForm.value = {};
+  dialog.value = { title: '信息管理', show: false, type: '1' };
+  search({ skip, limit });
+};
 // 删除
 const toDel = async (data) => {
   let res: IQueryResult = await personal.del(data._id);
@@ -85,6 +150,12 @@ const toDel = async (data) => {
     search({ skip, limit });
   }
 };
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 状态
+  res = await dictData.query({ type: 'common_status' });
+  if (res.errcode == 0) statusList.value = res.data;
+};
 </script>
 <style lang="scss" scoped>
 .main {

+ 9 - 9
vite.config.ts

@@ -1,10 +1,10 @@
-import { fileURLToPath, URL } from 'node:url'
-import { defineConfig, loadEnv } from 'vite'
-import vue from '@vitejs/plugin-vue'
-const path = require('path')
-const common = path.resolve(__dirname, '../common')
+import { fileURLToPath, URL } from 'node:url';
+import { defineConfig, loadEnv } from 'vite';
+import vue from '@vitejs/plugin-vue';
+const path = require('path');
+const common = path.resolve(__dirname, '../common');
 export default defineConfig(({ mode }) => {
-  const env = loadEnv(mode, __dirname)
+  const env = loadEnv(mode, __dirname);
   return {
     // 静态路径
     base: env.VITE_BASE_URL,
@@ -17,7 +17,7 @@ export default defineConfig(({ mode }) => {
       port: 8003,
       proxy: {
         '/files': {
-          target: 'http://broadcast.kqyjy.com'
+          target: 'http://broadcast.waityou24.cn'
         },
         '/zkzx/v2/api': {
           target: 'http://192.168.1.113:12001',
@@ -33,5 +33,5 @@ export default defineConfig(({ mode }) => {
         '@common': common
       }
     }
-  }
-})
+  };
+});