Kaynağa Gözat

Merge branch 'master' of http://git.cc-lotus.info/zkzx/zkzx_user

YY 1 yıl önce
ebeveyn
işleme
150017768d

+ 2 - 2
src/views/basic/index.vue

@@ -2,9 +2,9 @@
   <div id="index">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
-        <Cpersonal v-if="user.type == '4'"></Cpersonal>
+        <Cpersonal v-if="user.type == '4'" :user="user"></Cpersonal>
         <Ccompany v-else-if="user.type == '5'" :user="user"></Ccompany>
-        <Cexpert v-else-if="user.type == '6'"></Cexpert>
+        <Cexpert v-else-if="user.type == '6'" :user="user"></Cexpert>
       </el-col>
     </el-row>
   </div>

+ 1 - 1
src/views/basic/parts/c-company.vue

@@ -41,7 +41,7 @@ const form: Ref<any> = ref({});
 const fields: Ref<any> = ref([
   { label: '邀请码', model: 'code', type: 'select', options: { disabled: true } },
   { label: '账号', model: 'account', options: { disabled: true } },
-  { label: '名', model: 'name' },
+  { label: '用户名', model: 'name' },
   { label: '手机号', model: 'phone' },
   { label: '电子邮箱', model: 'email' },
   { label: '联系地址', model: 'address' },

+ 103 - 17
src/views/basic/parts/c-expert.vue

@@ -1,8 +1,21 @@
 <template>
   <div id="c-expert">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
-        <el-col :span="24" class="one">系统首页</el-col>
+      <el-col :span="24" class="expert" v-loading="loading">
+        <cForm :fields="fields" :rules="rules" :form="form" labelWidth="auto" @save="toSave" :span="12">
+          <template #code>
+            <el-option v-for="(i, index) in codeList" :key="index" :label="i.label" :value="i.value"></el-option>
+          </template>
+          <template #area>
+            <el-option v-for="(i, index) in areaList" :key="index" :label="i.label" :value="i.value"></el-option>
+          </template>
+          <template #icon>
+            <cUpload :model="`${'icon'}`" :limit="1" url="/files/expert/upload" :list="form.icon" listType="picture-card" @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>
+        </cForm>
       </el-col>
     </el-row>
   </div>
@@ -11,28 +24,101 @@
 <script setup lang="ts">
 // 基础
 import type { Ref } from 'vue';
-// reactive,
-import { onMounted, ref, getCurrentInstance } from 'vue';
+import { onMounted, ref, toRefs, reactive } from 'vue';
+import type { FormRules } from 'element-plus';
+import { ElMessage } from 'element-plus';
 // 接口
-//import { TestStore } from '@common/src/stores/test';
-//import type { IQueryResult } from '@/util/types.util';
-//const testAxios = TestStore();
-const { proxy } = getCurrentInstance() as any;
+import { ExpertStore } from '@common/src/stores/admins/expert'; // 专家
+import { DictDataStore } from '@common/src/stores/system/dictData';
+import type { IQueryResult } from '@/util/types.util';
+const expertAxios = ExpertStore();
+const dictAxios = DictDataStore();
+
+// 组件传值
+const props = defineProps({
+  user: { type: Boolean, default: () => {} }
+});
+const { user } = toRefs(props);
+
 // 加载中
 const loading: Ref<any> = ref(false);
-// 分页数据
-//  const skip = 0;
-//  const limit = proxy.limit;;
+// 表单
+const form: Ref<any> = ref({});
+const fields: Ref<any> = ref([
+  { label: '邀请码', model: 'code', type: 'select', options: { disabled: true } },
+  { label: '账号', model: 'account', options: { disabled: 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', type: 'date' },
+  { label: 'qq&&微信', model: 'qqwx' },
+  { label: '所在院校', model: 'school' },
+  { label: '最高学历', model: 'education' },
+  { label: '所学专业', model: 'major' },
+  { label: '单位名称', model: 'company' },
+  { label: '头像图片', model: 'icon', custom: true },
+  { label: '职务职称', model: 'zwzc' },
+  { label: '擅长领域', model: 'expertise', type: 'textarea' },
+  { label: '工作经历', model: 'workexperience', type: 'textarea' },
+  { label: '科研综述', model: 'scientific', type: 'textarea' },
+  { label: '承担项目', model: 'undertakingproject', type: 'textarea' },
+  { label: '科技奖励', model: 'scienceaward', type: 'textarea' },
+  { label: '社会任职', model: 'social', type: 'textarea' }
+]);
+const rules = reactive<FormRules>({});
+
+// 字典表
+const statusList: Ref<any> = ref([]);
+const codeList: Ref<any> = ref([]);
+const areaList: Ref<any> = ref([]);
+
 // 请求
 onMounted(async () => {
   loading.value = true;
-  //  await search({ skip, limit });
+  await searchOther();
+  await search();
   loading.value = false;
 });
-//const search = async (e: { skip: number; limit: number }) => {
-//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
-//  const res: IQueryResult = await testAxios.query(info);
-//  console.log(res);
-//};
+const search = async () => {
+  let users: any = user.value;
+  if (users && users._id) {
+    let res: IQueryResult = await expertAxios.fetch(users._id);
+    if (res.errcode == '0') form.value = res.data;
+  }
+};
+const onUpload = (e: { model: string; value: Array<[]> }) => {
+  const { model, value } = e;
+  form.value[model] = value;
+};
+// 提交保存
+const toSave = async (data) => {
+  let res: IQueryResult = await expertAxios.update(data);
+  if (res.errcode == '0') {
+    ElMessage({ message: `信息修改成功`, type: 'success' });
+    search();
+  } else {
+    ElMessage({ message: `${res.errmsg}`, type: 'error' });
+  }
+  console.log(data);
+};
+// 查询其他信息
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 邀请码
+  res = await dictAxios.query({ type: 'account_code' });
+  if (res.errcode == 0) {
+    let data: any = res.data;
+    codeList.value = data.filter((i) => i.value != 'CJGLY');
+  }
+  // 所属辖区
+  res = await dictAxios.query({ type: 'jl_area' });
+  if (res.errcode == 0) areaList.value = res.data;
+};
+// watch(test, (newVal: any) => {});
 </script>
 <style scoped lang="scss"></style>