lrf402788946 4 роки тому
батько
коміт
fdec013b31

+ 24 - 0
src/router/index.js

@@ -111,6 +111,30 @@ const web = [
         meta: { title: '专利管理' },
         component: () => import('../views/adminCenter/patent/detail.vue'),
       },
+      {
+        path: '/adminCenter/roadShow',
+        name: 'admin_road_show',
+        meta: { title: '路演管理' },
+        component: () => import('../views/adminCenter/road_show/index.vue'),
+      },
+      {
+        path: '/adminCenter/roadShow/detail',
+        name: 'admin_road_show_detail',
+        meta: { title: '路演管理' },
+        component: () => import('../views/adminCenter/road_show/detail.vue'),
+      },
+      {
+        path: '/adminCenter/expert',
+        name: 'admin_expert',
+        meta: { title: '专家管理' },
+        component: () => import('../views/adminCenter/expert/index.vue'),
+      },
+      {
+        path: '/adminCenter/expert/detail',
+        name: 'admin_expert_detail',
+        meta: { title: '专家管理' },
+        component: () => import('../views/adminCenter/expert/detail.vue'),
+      },
     ],
   },
 ];

+ 2 - 0
src/store/index.js

@@ -7,6 +7,7 @@ import news from '@common/src/store/news';
 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';
 
 Vue.use(Vuex);
 
@@ -20,5 +21,6 @@ export default new Vuex.Store({
     product,
     patent,
     roadShow,
+    expert,
   },
 });

+ 88 - 0
src/views/adminCenter/expert/detail.vue

@@ -0,0 +1,88 @@
+<template>
+  <div id="detail">
+    <data-form :fields="fields" :data="data" @save="toSave" returns="/adminCenter/expert">
+      <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>
+        </template>
+      </template>
+    </data-form>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: expert } = createNamespacedHelpers('expert');
+export default {
+  name: 'expertDetail',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      data: {
+        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: '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' },
+      ],
+    };
+  },
+  created() {
+    if (this.id) this.search();
+  },
+  methods: {
+    ...expert(['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/expert');
+      }
+    },
+  },
+  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>

+ 79 - 0
src/views/adminCenter/expert/index.vue

@@ -0,0 +1,79 @@
+<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>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: expert } = createNamespacedHelpers('expert');
+export default {
+  name: 'expertIndex',
+  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: 'phone' },
+        { label: '最高学历', prop: 'education' },
+        { label: '毕业院校', prop: 'school' },
+        { label: '擅长领域', prop: 'expertise' },
+      ],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...expert(['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/expert/detail');
+    },
+    toEdit({ data }) {
+      this.$router.push({ path: '/adminCenter/expert/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>

+ 12 - 5
src/views/adminCenter/patent/detail.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="detail">
-    <data-form :fields="fields" :data="data" @save="toSave" returns="/adminCenter/news">
+    <data-form :fields="fields" :data="data" @save="toSave" returns="/adminCenter/patent">
       <template #options="{ item }">
         <template v-if="item.model === 'column_name'">
           <el-option v-for="(i, index) in typeList" :key="`columns-name-${index}`" :label="i" :value="i"></el-option>
@@ -8,7 +8,7 @@
       </template>
       <template #custom="{ item }">
         <template v-if="item.model === 'img_url'">
-          <e-upload url="/files/cysci/news_image/upload" v-model="data[item.model]"></e-upload>
+          <e-upload url="/files/cysci/patent_image/upload" v-model="data[item.model]"></e-upload>
         </template>
       </template>
     </data-form>
@@ -25,8 +25,7 @@ export default {
   data: function () {
     return {
       data: {
-        image: [],
-        fileUrl: [],
+        img_url: [],
       },
       fields: [
         { label: '申请号', model: 'create_number' },
@@ -55,6 +54,14 @@ export default {
     async search() {
       const res = await this.fetch(this.id);
       if (this.$checkRes(res)) {
+        const { img_url } = res.data;
+        if (_.isArray(img_url) && img_url.length > 0) {
+          const arr = [];
+          for (let i = 0; i < img_url.length; i++) {
+            if (_.isString(img_url[i])) arr.push({ name: `img${i + 1}`, url: img_url[i] });
+          }
+          res.data.img_url = arr;
+        }
         this.$set(this, `data`, res.data);
       }
     },
@@ -67,7 +74,7 @@ export default {
         res = await this.create(dup);
       }
       if (this.$checkRes(res, '保存成功', '保存失败')) {
-        if (!this.$dev_mode) this.$router.push('/adminCenter/news');
+        if (!this.$dev_mode) this.$router.push('/adminCenter/patent');
       }
     },
   },

+ 95 - 0
src/views/adminCenter/road_show/detail.vue

@@ -0,0 +1,95 @@
+<template>
+  <div id="detail">
+    <data-form :fields="fields" :data="data" @save="toSave" returns="/adminCenter/roadShow">
+      <template #custom="{ item }">
+        <template v-if="item.model === 'picture'">
+          <e-upload url="/files/cysci/roadShow_image/upload" v-model="data[item.model]"></e-upload>
+        </template>
+        <template v-if="item.model === 'filepath'">
+          <e-upload url="/files/cysci/roadShow_file/upload" v-model="data[item.model]" type="text"></e-upload>
+        </template>
+      </template>
+    </data-form>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: roadShow } = createNamespacedHelpers('roadShow');
+export default {
+  name: 'roadShowDetail',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      data: {
+        picture: [],
+        filepath: [],
+      },
+      fields: [
+        { label: '标题', model: 'title' },
+        { label: '简介', model: 'brief', type: 'textarea', options: { maxRows: 5, minRows: 3 } },
+        { label: '来源', model: 'origin' },
+        { label: '发布时间', model: 'publish_time', type: 'datetime' },
+        { label: '内容', model: 'content' },
+        { label: '图片', model: 'picture', custom: true },
+        { label: '附件', model: 'filepath', custom: true },
+      ],
+    };
+  },
+  created() {
+    if (this.id) this.search();
+  },
+  methods: {
+    ...roadShow(['fetch', 'create', 'update']),
+    async search() {
+      const res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        const { picture, filepath } = res.data;
+        if (_.isArray(picture) && picture.length > 0) {
+          const arr = [];
+          for (let i = 0; i < picture.length; i++) {
+            if (_.isString(picture[i])) arr.push({ name: `img${i + 1}`, url: picture[i] });
+          }
+          res.data.picture = arr;
+        }
+        if (_.isArray(filepath) && filepath.length > 0) {
+          const arr = [];
+          for (let i = 0; i < filepath.length; i++) {
+            if (_.isString(filepath[i])) arr.push({ name: `file${i + 1}`, url: filepath[i] });
+          }
+          res.data.filepath = arr;
+        }
+        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/news');
+      }
+    },
+  },
+  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>

+ 78 - 0
src/views/adminCenter/road_show/index.vue

@@ -0,0 +1,78 @@
+<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>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: roadShow } = createNamespacedHelpers('roadShow');
+export default {
+  name: 'roadShowIndex',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      list: [],
+      total: 0,
+      opera: [
+        {
+          label: '修改',
+          method: 'edit',
+        },
+        {
+          label: '删除',
+          method: 'delete',
+          type: 'danger',
+        },
+      ],
+      fields: [
+        { label: '标题', prop: 'title', filter: true },
+        { label: '简介', prop: 'brief' },
+        { label: '来源', prop: 'origin' },
+        { label: '发布时间', prop: 'publish_time' },
+      ],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...roadShow(['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/roadShow/detail');
+    },
+    toEdit({ data }) {
+      this.$router.push({ path: '/adminCenter/roadShow/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>