guhongwei 4 лет назад
Родитель
Сommit
f26f55c616

+ 5 - 0
src/router/index.js

@@ -71,6 +71,11 @@ export default new Router({
           component: () => import('../views/user/index.vue'),
           meta: { title: '用户管理' },
         },
+        {
+          path: '/user/detail',
+          component: () => import('../views/user/detail.vue'),
+          meta: { title: '用户信息管理' },
+        },
       ],
     },
     {

+ 132 - 0
src/views/user/detail.vue

@@ -0,0 +1,132 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="back">
+          <el-button type="primary" size="mini" @click="back">返回</el-button>
+        </el-col>
+        <el-col :span="24" class="info">
+          <span v-if="type == '4'">
+            <perDetail :form="form" @toSave="perSave"></perDetail>
+          </span>
+          <span v-else-if="type == '5'">
+            <orgDetail :form="form" @toSave="orgSave"></orgDetail>
+          </span>
+          <span v-else-if="type == '6'">
+            <expDetail :form="form" @toSave="expSave"></expDetail>
+          </span>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import perDetail from './parts/perDetail.vue';
+import orgDetail from './parts/orgDetail.vue';
+import expDetail from './parts/expDetail.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: personal } = createNamespacedHelpers('personal');
+const { mapActions: organization } = createNamespacedHelpers('organization');
+const { mapActions: expert } = createNamespacedHelpers('expert');
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'detail',
+  props: {},
+  components: {
+    perDetail,
+    orgDetail,
+    expDetail,
+  },
+  data: function() {
+    return {
+      form: {},
+    };
+  },
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...personal({ personalFetch: 'fetch', personalUpdate: 'update' }),
+    ...organization({ organizationFetch: 'fetch', organizationUpdate: 'update' }),
+    ...expert({ expertFetch: 'fetch', expertUpdate: 'update' }),
+    async search() {
+      let type = this.type;
+      if (type == '4') {
+        let res = await this.personalFetch(this.id);
+        if (this.$checkRes(res)) {
+          this.$set(this, `form`, res.data);
+        }
+      } else if (type == '5') {
+        let res = await this.organizationFetch(this.id);
+        if (this.$checkRes(res)) {
+          this.$set(this, `form`, res.data);
+        }
+      } else if (type == '6') {
+        let res = await this.expertFetch(this.id);
+        if (this.$checkRes(res)) {
+          this.$set(this, `form`, res.data);
+        }
+      }
+    },
+    // 提交审核-个人用户
+    async perSave(data) {
+      let res = await this.personalUpdate(data);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '信息审核成功',
+          type: 'success',
+        });
+        this.back();
+      }
+    },
+    // 提交审核-机构用户
+    async orgSave(data) {
+      let res = await this.organizationUpdate(data);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '信息审核成功',
+          type: 'success',
+        });
+        this.back();
+      }
+    },
+    // 提交审核-专家用户
+    async expSave(data) {
+      let res = await this.expertUpdate(data);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '信息审核成功',
+          type: 'success',
+        });
+        this.back();
+      }
+    },
+    // 返回列表
+    back() {
+      this.$router.push({ path: '/user' });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+    type() {
+      return this.$route.query.type;
+    },
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .back {
+    text-align: right;
+    margin: 0 0 15px 0s;
+  }
+}
+</style>

+ 73 - 0
src/views/user/parts/expDetail.vue

@@ -0,0 +1,73 @@
+<template>
+  <div id="expDetail">
+    <el-row>
+      <el-col :span="24">
+        <data-form :data="form" :fields="formFields" :rules="{}" @save="toSave">
+          <template #radios="{item}">
+            <template v-if="item.model === 'status'">
+              <el-radio label="0">待审核</el-radio>
+              <el-radio label="1">审核通过</el-radio>
+              <el-radio label="2">审核拒绝</el-radio>
+            </template>
+          </template>
+          <template #custom="{item,form}">
+            <template v-if="item.model === 'img_path'">
+              <el-image :src="form.img_path">
+                <div slot="error" class="image-slot">
+                  <i class="el-icon-picture-outline"></i></div
+              ></el-image>
+            </template>
+          </template>
+        </data-form>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import dataForm from '@common/src/components/frame/form.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'expDetail',
+  props: { form: { type: Object } },
+  components: {
+    dataForm,
+  },
+  data: function() {
+    return {
+      formFields: [
+        { label: '姓名', model: 'name' },
+        { label: '手机号', model: 'phone' },
+        { label: '机构代码', model: 'code' },
+        { label: '头像', model: 'img_path', custom: true },
+        { label: '最高学历', model: 'education' },
+        { label: '毕业院校', model: 'school' },
+        { label: '出生日期', model: 'birthDate', type: 'date' },
+        { label: 'QQ/微信', model: 'qqwx' },
+        { label: '电子邮箱', model: 'email' },
+        { label: '工作单位', model: 'company' },
+        { label: '职务职称', model: 'zwzc' },
+        { label: '擅长领域', model: 'expertise' },
+        { 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' },
+        { label: '状态', model: 'status', type: 'radio' },
+      ],
+    };
+  },
+  created() {},
+  methods: {
+    toSave({ data }) {
+      this.$emit('toSave', data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped></style>

+ 27 - 6
src/views/user/parts/expeUser.vue

@@ -21,6 +21,7 @@
 <script>
 import dataTable from '@common/src/components/frame/filter-page-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: expert } = createNamespacedHelpers('expert');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -35,7 +36,7 @@ export default {
       active: 'first',
       opera: [
         {
-          label: '编辑',
+          label: '审核&查看',
           method: 'edit',
         },
         {
@@ -71,17 +72,37 @@ export default {
     await this.search();
   },
   methods: {
+    ...expert(['query', 'delete']),
     // 查询列表
-    search({ skip = 0, limit = 10, ...info } = {}) {
-      console.log('列表');
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let user = this.user;
+      if (user.role != '0') info.code = user.code;
+      let one = await this.query({ skip, limit, status: '0', ...info });
+      let two = await this.query({ skip, limit, status: '1', ...info });
+      let thr = await this.query({ skip, limit, status: '2', ...info });
+      if (this.$checkRes(one) || this.$checkRes(two) || this.$checkRes(thr)) {
+        this.$set(this, `oneList`, one.data);
+        this.$set(this, `oneTotal`, one.total);
+        this.$set(this, `twoList`, two.data);
+        this.$set(this, `twoTotal`, two.total);
+        this.$set(this, `thrList`, thr.data);
+        this.$set(this, `thrTotal`, thr.total);
+      }
     },
     // 修改
     toEdit({ data }) {
-      console.log('修改');
+      this.$router.push({ path: '/user/detail', query: { id: data.id, type: '6' } });
     },
     // 删除
-    toDelete({ data }) {
-      console.log('删除');
+    async toDelete({ data }) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '信息修改成功',
+          type: 'success',
+        });
+        this.search();
+      }
     },
   },
   computed: {

+ 27 - 6
src/views/user/parts/mechUser.vue

@@ -21,6 +21,7 @@
 <script>
 import dataTable from '@common/src/components/frame/filter-page-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: organization } = createNamespacedHelpers('organization');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -35,7 +36,7 @@ export default {
       active: 'first',
       opera: [
         {
-          label: '编辑',
+          label: '审核&查看',
           method: 'edit',
         },
         {
@@ -72,17 +73,37 @@ export default {
     await this.search();
   },
   methods: {
+    ...organization(['query', 'delete']),
     // 查询列表
-    search({ skip = 0, limit = 10, ...info } = {}) {
-      console.log('列表');
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let user = this.user;
+      if (user.role != '0') info.code = user.code;
+      let one = await this.query({ skip, limit, status: '0', ...info });
+      let two = await this.query({ skip, limit, status: '1', ...info });
+      let thr = await this.query({ skip, limit, status: '2', ...info });
+      if (this.$checkRes(one) || this.$checkRes(two) || this.$checkRes(thr)) {
+        this.$set(this, `oneList`, one.data);
+        this.$set(this, `oneTotal`, one.total);
+        this.$set(this, `twoList`, two.data);
+        this.$set(this, `twoTotal`, two.total);
+        this.$set(this, `thrList`, thr.data);
+        this.$set(this, `thrTotal`, thr.total);
+      }
     },
     // 修改
     toEdit({ data }) {
-      console.log('修改');
+      this.$router.push({ path: '/user/detail', query: { id: data.id, type: '5' } });
     },
     // 删除
-    toDelete({ data }) {
-      console.log('删除');
+    async toDelete({ data }) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '信息修改成功',
+          type: 'success',
+        });
+        this.search();
+      }
     },
   },
   computed: {

+ 68 - 0
src/views/user/parts/orgDetail.vue

@@ -0,0 +1,68 @@
+<template>
+  <div id="orgDetail">
+    <el-row>
+      <el-col :span="24">
+        <data-form :data="form" :fields="formFields" :rules="{}" @save="toSave" labelWidth="130px">
+          <template #radios="{item}">
+            <template v-if="item.model === 'status'">
+              <el-radio label="0">待审核</el-radio>
+              <el-radio label="1">审核通过</el-radio>
+              <el-radio label="2">审核拒绝</el-radio>
+            </template>
+          </template>
+        </data-form>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import dataForm from '@common/src/components/frame/form.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'orgDetail',
+  props: { form: { type: Object } },
+  components: {
+    dataForm,
+  },
+  data: function() {
+    return {
+      formFields: [
+        { label: '姓名', model: 'name' },
+        { label: '手机号', model: 'phone' },
+        { label: '机构代码', model: 'code' },
+        { label: '电子邮箱', model: 'email' },
+        { label: '联系地址', model: 'addr' },
+        { label: '办公电话', model: 'office_phone' },
+        { label: '所属行业', model: 'profession' },
+        { label: '机构代码', model: 'institution_code' },
+        { label: '统一社会信用代码', model: 'code' },
+        { label: '注册类型', model: 'companytype' },
+        { label: '注册时间', model: 'companydate' },
+        { 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' },
+        { label: '状态', model: 'status', type: 'radio' },
+      ],
+    };
+  },
+  created() {},
+  methods: {
+    toSave({ data }) {
+      this.$emit('toSave', data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped></style>

+ 57 - 0
src/views/user/parts/perDetail.vue

@@ -0,0 +1,57 @@
+<template>
+  <div id="perDetail">
+    <el-row>
+      <el-col :span="24">
+        <data-form :data="form" :fields="formFields" :rules="{}" @save="toSave">
+          <template #radios="{item}">
+            <template v-if="item.model === 'status'">
+              <el-radio label="0">待审核</el-radio>
+              <el-radio label="1">审核通过</el-radio>
+              <el-radio label="2">审核拒绝</el-radio>
+            </template>
+          </template>
+        </data-form>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import dataForm from '@common/src/components/frame/form.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'perDetail',
+  props: {
+    form: { type: Object },
+  },
+  components: {
+    dataForm,
+  },
+  data: function() {
+    return {
+      formFields: [
+        { label: '姓名', model: 'name' },
+        { label: '手机号', model: 'phone' },
+        { label: '机构代码', model: 'code' },
+        { label: '电子邮箱', model: 'email' },
+        { label: '地址', model: 'addr' },
+        { label: '办公电话', model: 'office_phone' },
+        { label: '所属行业', model: 'profession' },
+        { label: '状态', model: 'status', type: 'radio' },
+      ],
+    };
+  },
+  created() {},
+  methods: {
+    toSave({ data }) {
+      this.$emit('toSave', data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped></style>

+ 27 - 6
src/views/user/parts/perUser.vue

@@ -21,6 +21,7 @@
 <script>
 import dataTable from '@common/src/components/frame/filter-page-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: personal } = createNamespacedHelpers('personal');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -35,7 +36,7 @@ export default {
       active: 'first',
       opera: [
         {
-          label: '编辑',
+          label: '审核&查看',
           method: 'edit',
         },
         {
@@ -71,17 +72,37 @@ export default {
     await this.search();
   },
   methods: {
+    ...personal(['query', 'delete']),
     // 查询列表
-    search({ skip = 0, limit = 10, ...info } = {}) {
-      console.log('列表');
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let user = this.user;
+      if (user.role != '0') info.code = user.code;
+      let one = await this.query({ skip, limit, status: '0', ...info });
+      let two = await this.query({ skip, limit, status: '1', ...info });
+      let thr = await this.query({ skip, limit, status: '2', ...info });
+      if (this.$checkRes(one) || this.$checkRes(two) || this.$checkRes(thr)) {
+        this.$set(this, `oneList`, one.data);
+        this.$set(this, `oneTotal`, one.total);
+        this.$set(this, `twoList`, two.data);
+        this.$set(this, `twoTotal`, two.total);
+        this.$set(this, `thrList`, thr.data);
+        this.$set(this, `thrTotal`, thr.total);
+      }
     },
     // 修改
     toEdit({ data }) {
-      console.log('修改');
+      this.$router.push({ path: '/user/detail', query: { id: data.id, type: '4' } });
     },
     // 删除
-    toDelete({ data }) {
-      console.log('删除');
+    async toDelete({ data }) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '信息修改成功',
+          type: 'success',
+        });
+        this.search();
+      }
     },
   },
   computed: {