浏览代码

Merge branch 'master' of http://git.cc-lotus.info/Free-cysci/cysci-website

guhongwei 4 年之前
父节点
当前提交
29f5d1b998

+ 24 - 0
src/router/index.js

@@ -141,6 +141,30 @@ const web = [
         meta: { title: '专家管理' },
         component: () => import('../views/adminCenter/expert/detail.vue'),
       },
+      {
+        path: '/adminCenter/organization',
+        name: 'admin_organization',
+        meta: { title: '企业管理' },
+        component: () => import('../views/adminCenter/organization/index.vue'),
+      },
+      {
+        path: '/adminCenter/organization/detail',
+        name: 'admin_organization_detail',
+        meta: { title: '企业管理' },
+        component: () => import('../views/adminCenter/organization/detail.vue'),
+      },
+      {
+        path: '/adminCenter/mechanism',
+        name: 'admin_mechanism',
+        meta: { title: '机构管理' },
+        component: () => import('../views/adminCenter/mechanism/index.vue'),
+      },
+      {
+        path: '/adminCenter/mechanism/detail',
+        name: 'admin_mechanism_detail',
+        meta: { title: '机构管理' },
+        component: () => import('../views/adminCenter/mechanism/detail.vue'),
+      },
     ],
   },
 ];

+ 4 - 0
src/store/index.js

@@ -8,6 +8,8 @@ import product from '@common/src/store/product';
 import patent from '@common/src/store/patent';
 import roadShow from '@common/src/store/roadShow';
 import expert from '@common/src/store/expert';
+import organization from '@common/src/store/organization';
+import mechanism from '@common/src/store/mechanism';
 
 Vue.use(Vuex);
 
@@ -22,5 +24,7 @@ export default new Vuex.Store({
     patent,
     roadShow,
     expert,
+    organization,
+    mechanism,
   },
 });

+ 29 - 20
src/views/adminCenter/expert/detail.vue

@@ -1,9 +1,15 @@
 <template>
   <div id="detail">
-    <data-form :fields="fields" :data="data" @save="toSave" returns="/adminCenter/expert">
+    <data-form :fields="fields" :data="data" @save="toSave" returns="/adminCenter/expert" submitText="审核">
+      <template #radios="{ item }">
+        <template v-if="item.model === 'status'">
+          <el-radio v-for="(i, index) in statusList" :key="`status-${index}`" :label="i.value">{{ i.label }}</el-radio>
+        </template>
+      </template>
       <template #custom="{ item }">
         <template v-if="item.model === 'img_path'">
-          <e-upload url="/files/cysci/expert_image/upload" :limit="1" v-model="data[item.model]"></e-upload>
+          <!-- <e-upload url="/files/cysci/expert_image/upload" :limit="1" v-model="data[item.model]"></e-upload> -->
+          <img v-for="(i, index) in data[item.model]" :key="`icon-${index}`" :src="i.url" width="150px" height="150px" />
         </template>
       </template>
     </data-form>
@@ -11,6 +17,7 @@
 </template>
 
 <script>
+const { status } = require('@common/dict/index');
 const _ = require('lodash');
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: expert } = createNamespacedHelpers('expert');
@@ -24,26 +31,28 @@ export default {
         img_path: [],
       },
       fields: [
-        { label: '姓名', model: 'name' },
-        { label: '电话号码', model: 'phone', options: { maxLength: 11 } },
-        { label: '地址', model: 'addr' },
-        { label: '办公电话', model: 'office_phone' },
-        { label: '所属行业', model: 'profession' },
-        { 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: 'name', type: 'text' },
+        { label: '电话号码', model: 'phone', options: { maxLength: 11 }, type: 'text' },
+        { label: '地址', model: 'addr', type: 'text' },
+        { label: '办公电话', model: 'office_phone', type: 'text' },
+        { label: '所属行业', model: 'profession', type: 'text' },
+        { label: '最高学历', model: 'education', type: 'text' },
+        { label: '毕业院校', model: 'school', type: 'text' },
+        { label: '出生日期', model: 'birthDate', type: 'date', type: 'text' },
+        { label: 'qq&微信', model: 'qqwx', type: 'text' },
+        { label: '邮箱', model: 'email', type: 'text' },
+        { label: '单位名称', model: 'company', type: 'text' },
+        { label: '职务职称', model: 'zwzc', type: 'text' },
+        { label: '擅长领域', model: 'expertise', type: 'text' },
         { label: '头像图片', model: 'img_path', custom: true },
-        { label: '工作经历', model: 'workexperience', type: 'textarea', options: { maxRows: 5, minRows: 3 } },
-        { label: '科研综述', model: 'scientific', type: 'textarea', options: { maxRows: 5, minRows: 3 } },
-        { label: '承担项目', model: 'undertakingproject' },
-        { label: '科技奖励', model: 'scienceaward' },
-        { label: '社会任职', model: 'social' },
+        { label: '工作经历', model: 'workexperience', type: 'textarea', options: { maxRows: 5, minRows: 3 }, type: 'text' },
+        { label: '科研综述', model: 'scientific', type: 'textarea', options: { maxRows: 5, minRows: 3 }, type: 'text' },
+        { label: '承担项目', model: 'undertakingproject', type: 'text' },
+        { label: '科技奖励', model: 'scienceaward', type: 'text' },
+        { label: '社会任职', model: 'social', type: 'text' },
+        { label: '账号状态', model: 'status', type: 'radio' },
       ],
+      statusList: status,
     };
   },
   created() {

+ 13 - 2
src/views/adminCenter/expert/index.vue

@@ -2,13 +2,14 @@
   <div id="index">
     <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit" @delete="toDelete">
       <template #selfbtn>
-        <el-button type="primary" size="mini" @click="toAdd">添加专家</el-button>
+        <!-- <el-button type="primary" size="mini" @click="toAdd">添加专家</el-button> -->
       </template>
     </data-table>
   </div>
 </template>
 
 <script>
+const { status } = require('@common/dict/index');
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: expert } = createNamespacedHelpers('expert');
 export default {
@@ -21,7 +22,7 @@ export default {
       total: 0,
       opera: [
         {
-          label: '修改',
+          label: '查看与审核',
           method: 'edit',
         },
         {
@@ -36,7 +37,17 @@ export default {
         { label: '最高学历', prop: 'education' },
         { label: '毕业院校', prop: 'school' },
         { label: '擅长领域', prop: 'expertise' },
+        {
+          label: '状态',
+          prop: 'status',
+          format: (i) => {
+            const r = status.find((f) => f.value === i);
+            if (r) return r.label;
+            return '未知状态';
+          },
+        },
       ],
+      statusList: status,
     };
   },
   created() {

+ 84 - 0
src/views/adminCenter/mechanism/detail.vue

@@ -0,0 +1,84 @@
+<template>
+  <div id="detail">
+    <data-form :fields="fields" :data="data" @save="toSave" returns="/adminCenter/mechanism" submitText="审核">
+      <template #radios="{ item }">
+        <template v-if="item.model === 'status'">
+          <el-radio v-for="(i, index) in statusList" :key="`status-${index}`" :label="i.value">{{ i.label }}</el-radio>
+        </template>
+      </template>
+      <template #custom="{ item }">
+        <template v-if="item.model === 'img_path'">
+          <!-- <e-upload url="/files/cysci/mechanism_image/upload" :limit="1" v-model="data[item.model]"></e-upload> -->
+          <img v-for="(i, index) in data[item.model]" :key="`icon-${index}`" :src="i.url" width="150px" height="150px" />
+        </template>
+      </template>
+    </data-form>
+  </div>
+</template>
+
+<script>
+const { status } = require('@common/dict/index');
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: mechanism } = createNamespacedHelpers('mechanism');
+export default {
+  name: 'mechanismDetail',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      data: {
+        img_path: [],
+      },
+      fields: [
+        { label: '机构名称', model: 'name', type: 'text' },
+        { label: '联系人', model: 'contacts', type: 'text' },
+        { label: '联系电话', model: 'phone', type: 'text' },
+        { label: '电子邮箱', model: 'email', type: 'text' },
+        { label: '联系地址', model: 'address', type: 'text' },
+        { label: '所属行业', model: 'industry', type: 'text' },
+        { label: '账号状态', model: 'status', type: 'radio' },
+      ],
+      statusList: status,
+    };
+  },
+  created() {
+    if (this.id) this.search();
+  },
+  methods: {
+    ...mechanism(['fetch', 'create', 'update']),
+    async search() {
+      const res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `data`, res.data);
+      }
+    },
+    async toSave({ data }) {
+      let dup = _.cloneDeep(data);
+      let res;
+      if (_.get(dup, 'id')) {
+        res = await this.update(dup);
+      } else {
+        res = await this.create(dup);
+      }
+      if (this.$checkRes(res, '保存成功', '保存失败')) {
+        if (!this.$dev_mode) this.$router.push('/adminCenter/mechanism');
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user', 'menuParams']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 91 - 0
src/views/adminCenter/mechanism/index.vue

@@ -0,0 +1,91 @@
+<template>
+  <div id="index">
+    <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit" @delete="toDelete">
+      <template #selfbtn>
+        <!-- <el-button type="primary" size="mini" @click="toAdd">添加专家</el-button> -->
+      </template>
+    </data-table>
+  </div>
+</template>
+
+<script>
+const { status } = require('@common/dict/index');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: mechanism } = createNamespacedHelpers('mechanism');
+export default {
+  name: 'mechanismIndex',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      list: [],
+      total: 0,
+      opera: [
+        {
+          label: '查看与审核',
+          method: 'edit',
+        },
+        {
+          label: '删除',
+          method: 'delete',
+          type: 'danger',
+        },
+      ],
+      fields: [
+        { label: '机构名称', prop: 'name', filter: true },
+        { label: '联系人', prop: 'contacts' },
+        { label: '联系电话', prop: 'phone' },
+        { label: '电子邮箱', prop: 'email' },
+        { label: '联系地址', prop: 'address' },
+        { label: '所属行业', prop: 'industry' },
+        {
+          label: '状态',
+          prop: 'status',
+          format: (i) => {
+            const r = status.find((f) => f.value === i);
+            if (r) return r.label;
+            return '未知状态';
+          },
+        },
+      ],
+      statusList: status,
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...mechanism(['query', 'delete']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    toAdd() {
+      this.$router.push('/adminCenter/mechanism/detail');
+    },
+    toEdit({ data }) {
+      this.$router.push({ path: '/adminCenter/mechanism/detail', query: { id: data._id } });
+    },
+    async toDelete({ data }) {
+      const res = await this.delete(data._id);
+      if (this.$checkRes(res, '删除成功', '删除失败')) {
+        this.search();
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user', 'menuParams']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 89 - 0
src/views/adminCenter/organization/detail.vue

@@ -0,0 +1,89 @@
+<template>
+  <div id="detail">
+    <data-form :fields="fields" :data="data" @save="toSave" labelWidth="150px" returns="/adminCenter/organization" submitText="审核">
+      <template #radios="{ item }">
+        <template v-if="item.model === 'status'">
+          <el-radio v-for="(i, index) in statusList" :key="`status-${index}`" :label="i.value">{{ i.label }}</el-radio>
+        </template>
+      </template>
+    </data-form>
+  </div>
+</template>
+
+<script>
+const { status } = require('@common/dict/index');
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: organization } = createNamespacedHelpers('organization');
+export default {
+  name: 'organizationDetail',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      data: {},
+      fields: [
+        { label: '企业名称', model: 'name', type: 'text' },
+        { label: '电话号码', model: 'phone', options: { maxLength: 11 }, type: 'text' },
+        { label: '邮箱', model: 'email', type: 'text' },
+        { label: '地址', model: 'addr', type: 'text' },
+        { label: '办公电话', model: 'office_phone', type: 'text' },
+        { label: '所属行业', model: 'profession', type: 'text' },
+        { label: '机构代码', model: 'institution_code', type: 'text' },
+
+        { label: '注册类型', model: 'companytype', type: 'text' },
+        { label: '注册时间', model: 'companydate', type: 'text' },
+        { label: '注册资金', model: 'companycapital', type: 'text' },
+        { label: '企业法人', model: 'companyperson', type: 'text' },
+        { label: '上年度企业总收入', model: 'sndqyzsr', type: 'text' },
+        { label: '上年度研发费用', model: 'sndyffy', type: 'text' },
+        { label: '企业总人数', model: 'companytotal', type: 'text' },
+        { label: '专&兼职研发人数', model: 'zjzyfrs', type: 'text' },
+        { label: '企业简介', model: 'companybrief', type: 'textarea', options: { maxRows: 5, minRows: 3 }, type: 'text' },
+        { label: '主要产品', model: 'mainproduct', type: 'textarea', options: { maxRows: 5, minRows: 3 }, type: 'text' },
+        { label: '企业资质&荣誉', model: 'qualifications', type: 'text' },
+        { label: '账号状态', model: 'status', type: 'radio' },
+      ],
+      statusList: status,
+    };
+  },
+  created() {
+    if (this.id) this.search();
+  },
+  methods: {
+    ...organization(['fetch', 'create', 'update']),
+    async search() {
+      const res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `data`, res.data);
+      }
+    },
+    async toSave({ data }) {
+      let dup = _.cloneDeep(data);
+      let res;
+      if (_.get(dup, 'id')) {
+        res = await this.update(dup);
+      } else {
+        res = await this.create(dup);
+      }
+      if (this.$checkRes(res, '保存成功', '保存失败')) {
+        if (!this.$dev_mode) this.$router.push('/adminCenter/organization');
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user', 'menuParams']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 91 - 0
src/views/adminCenter/organization/index.vue

@@ -0,0 +1,91 @@
+<template>
+  <div id="index">
+    <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit" @delete="toDelete">
+      <template #selfbtn>
+        <!-- <el-button type="primary" size="mini" @click="toAdd">添加专家</el-button> -->
+      </template>
+    </data-table>
+  </div>
+</template>
+
+<script>
+const { status } = require('@common/dict/index');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: organization } = createNamespacedHelpers('organization');
+export default {
+  name: 'organizationIndex',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      list: [],
+      total: 0,
+      opera: [
+        {
+          label: '查看与审核',
+          method: 'edit',
+        },
+        {
+          label: '删除',
+          method: 'delete',
+          type: 'danger',
+        },
+      ],
+      fields: [
+        { label: '企业名称', prop: 'name', filter: true },
+        { label: '机构代码', prop: 'institution_code', filter: true },
+        { label: '联系电话', prop: 'phone' },
+        { label: '邮箱', prop: 'email' },
+        { label: '所属行业', prop: 'profession' },
+        { label: '注册类型', prop: 'companytype' },
+        {
+          label: '状态',
+          prop: 'status',
+          format: (i) => {
+            const r = status.find((f) => f.value === i);
+            if (r) return r.label;
+            return '未知状态';
+          },
+        },
+      ],
+      statusList: status,
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...organization(['query', 'delete']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    toAdd() {
+      this.$router.push('/adminCenter/organization/detail');
+    },
+    toEdit({ data }) {
+      this.$router.push({ path: '/adminCenter/organization/detail', query: { id: data._id } });
+    },
+    async toDelete({ data }) {
+      const res = await this.delete(data._id);
+      if (this.$checkRes(res, '删除成功', '删除失败')) {
+        this.search();
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user', 'menuParams']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>