guhongwei 1 tahun lalu
induk
melakukan
b8e7b4aa85

+ 135 - 3
package-lock.json

@@ -27,11 +27,13 @@
         "@rushstack/eslint-patch": "^1.2.0",
         "@types/node": "^18.14.2",
         "@vitejs/plugin-vue": "^4.0.0",
+        "@vue/eslint-config-prettier": "^7.1.0",
         "@vue/eslint-config-typescript": "^11.0.2",
         "@vue/tsconfig": "^0.1.3",
-        "eslint": "^8.34.0",
+        "eslint": "^8.38.0",
         "eslint-plugin-vue": "^9.9.0",
         "npm-run-all": "^4.1.5",
+        "prettier": "^2.8.7",
         "sass": "^1.62.0",
         "sass-loader": "^13.2.2",
         "typescript": "~4.8.4",
@@ -1055,6 +1057,20 @@
       "resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.5.0.tgz",
       "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q=="
     },
+    "node_modules/@vue/eslint-config-prettier": {
+      "version": "7.1.0",
+      "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-7.1.0.tgz",
+      "integrity": "sha512-Pv/lVr0bAzSIHLd9iz0KnvAr4GKyCEl+h52bc4e5yWuDVtLgFwycF7nrbWTAQAS+FU6q1geVd07lc6EWfJiWKQ==",
+      "dev": true,
+      "dependencies": {
+        "eslint-config-prettier": "^8.3.0",
+        "eslint-plugin-prettier": "^4.0.0"
+      },
+      "peerDependencies": {
+        "eslint": ">= 7.28.0",
+        "prettier": ">= 2.0.0"
+      }
+    },
     "node_modules/@vue/eslint-config-typescript": {
       "version": "11.0.2",
       "resolved": "https://registry.npmmirror.com/@vue/eslint-config-typescript/-/eslint-config-typescript-11.0.2.tgz",
@@ -2244,7 +2260,7 @@
     },
     "node_modules/eslint": {
       "version": "8.38.0",
-      "resolved": "https://registry.npmmirror.com/eslint/-/eslint-8.38.0.tgz",
+      "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz",
       "integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==",
       "dev": true,
       "dependencies": {
@@ -2294,6 +2310,42 @@
       },
       "engines": {
         "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+      },
+      "funding": {
+        "url": "https://opencollective.com/eslint"
+      }
+    },
+    "node_modules/eslint-config-prettier": {
+      "version": "8.8.0",
+      "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz",
+      "integrity": "sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==",
+      "dev": true,
+      "bin": {
+        "eslint-config-prettier": "bin/cli.js"
+      },
+      "peerDependencies": {
+        "eslint": ">=7.0.0"
+      }
+    },
+    "node_modules/eslint-plugin-prettier": {
+      "version": "4.2.1",
+      "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz",
+      "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==",
+      "dev": true,
+      "dependencies": {
+        "prettier-linter-helpers": "^1.0.0"
+      },
+      "engines": {
+        "node": ">=12.0.0"
+      },
+      "peerDependencies": {
+        "eslint": ">=7.28.0",
+        "prettier": ">=2.0.0"
+      },
+      "peerDependenciesMeta": {
+        "eslint-config-prettier": {
+          "optional": true
+        }
       }
     },
     "node_modules/eslint-plugin-vue": {
@@ -2478,6 +2530,12 @@
       "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
       "dev": true
     },
+    "node_modules/fast-diff": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz",
+      "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==",
+      "dev": true
+    },
     "node_modules/fast-glob": {
       "version": "3.2.12",
       "resolved": "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.2.12.tgz",
@@ -4038,6 +4096,33 @@
         "node": ">= 0.8.0"
       }
     },
+    "node_modules/prettier": {
+      "version": "2.8.7",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz",
+      "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==",
+      "dev": true,
+      "bin": {
+        "prettier": "bin-prettier.js"
+      },
+      "engines": {
+        "node": ">=10.13.0"
+      },
+      "funding": {
+        "url": "https://github.com/prettier/prettier?sponsor=1"
+      }
+    },
+    "node_modules/prettier-linter-helpers": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
+      "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
+      "dev": true,
+      "dependencies": {
+        "fast-diff": "^1.1.2"
+      },
+      "engines": {
+        "node": ">=6.0.0"
+      }
+    },
     "node_modules/prismjs": {
       "version": "1.29.0",
       "resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.29.0.tgz",
@@ -5788,6 +5873,16 @@
       "resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.5.0.tgz",
       "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q=="
     },
+    "@vue/eslint-config-prettier": {
+      "version": "7.1.0",
+      "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-7.1.0.tgz",
+      "integrity": "sha512-Pv/lVr0bAzSIHLd9iz0KnvAr4GKyCEl+h52bc4e5yWuDVtLgFwycF7nrbWTAQAS+FU6q1geVd07lc6EWfJiWKQ==",
+      "dev": true,
+      "requires": {
+        "eslint-config-prettier": "^8.3.0",
+        "eslint-plugin-prettier": "^4.0.0"
+      }
+    },
     "@vue/eslint-config-typescript": {
       "version": "11.0.2",
       "resolved": "https://registry.npmmirror.com/@vue/eslint-config-typescript/-/eslint-config-typescript-11.0.2.tgz",
@@ -6742,7 +6837,7 @@
     },
     "eslint": {
       "version": "8.38.0",
-      "resolved": "https://registry.npmmirror.com/eslint/-/eslint-8.38.0.tgz",
+      "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz",
       "integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==",
       "dev": true,
       "requires": {
@@ -6806,6 +6901,22 @@
         }
       }
     },
+    "eslint-config-prettier": {
+      "version": "8.8.0",
+      "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz",
+      "integrity": "sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==",
+      "dev": true,
+      "requires": {}
+    },
+    "eslint-plugin-prettier": {
+      "version": "4.2.1",
+      "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz",
+      "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==",
+      "dev": true,
+      "requires": {
+        "prettier-linter-helpers": "^1.0.0"
+      }
+    },
     "eslint-plugin-vue": {
       "version": "9.11.0",
       "resolved": "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-9.11.0.tgz",
@@ -6936,6 +7047,12 @@
       "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
       "dev": true
     },
+    "fast-diff": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz",
+      "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==",
+      "dev": true
+    },
     "fast-glob": {
       "version": "3.2.12",
       "resolved": "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.2.12.tgz",
@@ -8183,6 +8300,21 @@
       "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
       "dev": true
     },
+    "prettier": {
+      "version": "2.8.7",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz",
+      "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==",
+      "dev": true
+    },
+    "prettier-linter-helpers": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
+      "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
+      "dev": true,
+      "requires": {
+        "fast-diff": "^1.1.2"
+      }
+    },
     "prismjs": {
       "version": "1.29.0",
       "resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.29.0.tgz",

+ 3 - 1
package.json

@@ -30,11 +30,13 @@
     "@rushstack/eslint-patch": "^1.2.0",
     "@types/node": "^18.14.2",
     "@vitejs/plugin-vue": "^4.0.0",
+    "@vue/eslint-config-prettier": "^7.1.0",
     "@vue/eslint-config-typescript": "^11.0.2",
     "@vue/tsconfig": "^0.1.3",
-    "eslint": "^8.34.0",
+    "eslint": "^8.38.0",
     "eslint-plugin-vue": "^9.9.0",
     "npm-run-all": "^4.1.5",
+    "prettier": "^2.8.7",
     "sass": "^1.62.0",
     "sass-loader": "^13.2.2",
     "typescript": "~4.8.4",

+ 11 - 17
src/views/basic/index.vue

@@ -2,7 +2,9 @@
   <div id="index">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
-        <el-col :span="24" class="one">系统首页</el-col>
+        <Cpersonal v-if="user.type=='4'"></Cpersonal>
+        <Ccompany v-else-if="user.type=='5'" :user="user"></Ccompany>
+        <Cexpert v-else-if="user.type=='6'"></Cexpert>
       </el-col>
     </el-row>
   </div>
@@ -10,29 +12,21 @@
 
 <script setup lang="ts">
 // 基础
+import Cpersonal from "./parts/c-personal.vue";
+import Ccompany from "./parts/c-company.vue";
+import Cexpert from "./parts/c-expert.vue";
+import store from '@/stores/counter';
 import type { Ref } from 'vue';
-// reactive,
-import { onMounted, ref, getCurrentInstance } from 'vue';
-// 接口
-//import { TestStore } from '@common/src/stores/test';
-//import type { IQueryResult } from '@/util/types.util';
-//const testAxios = TestStore();
-const { proxy } = getCurrentInstance() as any;
+import { onMounted, ref } from 'vue';
 // 加载中
 const loading: Ref<any> = ref(false);
-// 分页数据
-//  const skip = 0;
-//  const limit = proxy.limit;;
+// 用户
+const user: Ref<any> = ref({});
 // 请求
 onMounted(async () => {
   loading.value = true;
-  //  await search({ skip, limit });
+  user.value = store.state.user;
   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);
-//};
 </script>
 <style scoped lang="scss"></style>

+ 111 - 0
src/views/basic/parts/c-company.vue

@@ -0,0 +1,111 @@
+<template>
+  <div id="c-company">
+    <el-row>
+      <el-col :span="24" class="company" v-loading="loading">
+        <cForm :fields="fields" :rules="rules" :form="form" labelWidth="auto" @save="toSave" :span="12">
+          <template #code>
+            <el-option v-for="i in codeList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+          </template>
+          <template #area>
+            <el-option v-for="i in areaList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+          </template>
+        </cForm>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+import { onMounted, ref, toRefs, reactive } from 'vue';
+import type { FormRules } from 'element-plus';
+import { ElMessage } from 'element-plus';
+// 接口
+import { CompanyStore } from '@common/src/stores/admins/company';
+import { DictDataStore } from '@common/src/stores/system/dictData';
+import type { IQueryResult } from '@/util/types.util';
+const companyAxios = CompanyStore();
+const dictAxios = DictDataStore();
+
+// 组件传值
+const props = defineProps({
+  user: { type: Boolean, default: () => {} }
+});
+const { user } = toRefs(props);
+
+// 加载中
+const loading: Ref<any> = ref(false);
+// 表单
+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: 'institution_code' },
+  { label: '注册类型', model: 'companytype' },
+  { label: '注册时间', model: 'companydate', type: 'date' },
+  { label: '注册资金', model: 'companycapital' },
+  { label: '企业法人', model: 'companyperson' },
+  { label: '上年度企业总收入', model: 'sndqyzsr' },
+  { label: '上年度研发费用', model: 'sndyffy' },
+  { label: '企业总人数', model: 'companytotal' },
+  { label: '专&兼职研发人数', model: 'zjzyfrs' },
+  { label: '企业简介', model: 'companybrief', type: 'textarea' },
+  { label: '主要产品', model: 'mainproduct', type: 'textarea' },
+  { label: '企业资质&荣誉', model: 'qualifications', type: 'textarea' }
+]);
+const rules = reactive<FormRules>({});
+
+// 字典表
+const areaList: Ref<any> = ref([]);
+const codeList: Ref<any> = ref([]);
+
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  await searchOther();
+  await search();
+  loading.value = false;
+});
+const search = async () => {
+  let users: any = user.value;
+  if (users && users._id) {
+    let res: IQueryResult = await companyAxios.fetch(users._id);
+    if (res.errcode == '0') form.value = res.data;
+  }
+};
+// 提交保存
+const toSave = async (data) => {
+  let res: IQueryResult = await companyAxios.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: 'jl_area' });
+  if (res.errcode == '0') areaList.value = res.data;
+  // 邀请码
+  res = await dictAxios.query({ type: 'account_code' });
+  if (res.errcode == '0') {
+    let list = res.data as any;
+    list = list.filter((i) => i.value != 'CJGLY');
+    codeList.value = list;
+  }
+};
+// watch(test, (newVal: any) => {});
+</script>
+<style scoped lang="scss"></style>

+ 38 - 0
src/views/basic/parts/c-expert.vue

@@ -0,0 +1,38 @@
+<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>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  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);
+//};
+</script>
+<style scoped lang="scss"></style>

+ 38 - 0
src/views/basic/parts/c-personal.vue

@@ -0,0 +1,38 @@
+<template>
+  <div id="c-personal">
+    <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>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  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);
+//};
+</script>
+<style scoped lang="scss"></style>