Browse Source

Merge branch 'master' of http://git.cc-lotus.info/live/web-achieve

guhongwei 4 năm trước cách đây
mục cha
commit
2b28a287d5

+ 13 - 0
src/store/index.js

@@ -6,10 +6,19 @@ import * as umutations from './user/mutations';
 import adminLogin from './adminLogin';
 // 个人
 import personal from '@common/src/store/personal';
+// 专家
+import expert from '@common/src/store/expert';
 // 机构
 import organization from '@common/src/store/organization';
 // 菜单
 import menu from '@common/src/store/menu';
+// 科技评价
+import achieveApply from '@common/src/store/achieve/achieve_apply.js';
+// 科技评价审核记录
+import verifyRecord from '@common/src/store/achieve/achieve_verify_record.js';
+// 专家临时
+import achieveExpert from '@common/src/store/achieve/achieve_expert.js';
+
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -19,7 +28,11 @@ export default new Vuex.Store({
   modules: {
     adminLogin,
     personal,
+    expert,
     organization,
     menu,
+    achieveApply,
+    verifyRecord,
+    achieveExpert,
   },
 });

+ 33 - 60
src/views/adminCenter/adminExamine/detail.vue

@@ -58,6 +58,8 @@ import brief from './parts/brief.vue';
 import research from './parts/research.vue';
 import detailed from './parts/detailed.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: achieveApply } = createNamespacedHelpers('achieveApply');
+const { mapActions: verifyRecord } = createNamespacedHelpers('verifyRecord');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -75,64 +77,11 @@ export default {
       // 标签
       active: 'first',
       form: {
-        basic: {
-          achieve_name: '成果名称',
-          achieve_type: '成果类别',
-          achieve_num: '成果编号',
-          achieve_date: '成果取得时间',
-          achieve_form: '成果形式',
-          apply_personal: '申请人',
-          apply_company: '申请单位',
-          address: '地址',
-          apply_nature: '申请人/申请人属性',
-          contacts: '联系人',
-          phone: '联系电话',
-          email: '邮箱',
-          fax: '传真',
-          objective: '评价目的',
-          stage: '成果所处阶段',
-          output: '经济效益产值',
-          profit: '经济效益利润',
-          revenue: '经济效益税收',
-        },
-        brief: {
-          achieve_brief: '成果简介',
-          field: '应用领域和技术原理',
-          kpi_index: '性能指标',
-          compare: '与国内外同类技术比较',
-          advanced: '成果的创造性,先进性',
-          sense: '作用意义',
-          prospect: '推广应用的范围,条件和前景',
-          opinion: '存在的问题和改进意见',
-        },
-        research: [
-          {
-            research_name: '姓名',
-            card: '220182199603257019',
-            gender: '性别',
-            position: '技术职称',
-            education: '文化程度',
-            degree: '学位',
-            abroad: '是否留学归国',
-            research_company: '工作单位',
-            devote: '对成果创造性贡献',
-          },
-        ],
-        datalist: {
-          work_report: '研究工作报告(必备)',
-          techol_report: '研究技术报告(必备)',
-          benefit: '经济效益分析(必备)',
-          science_report: '科技查新报告(科技项目成果,必备)',
-          assess_report: '法律价值评估报告(专利成果,必备)',
-          app_prove: '推广应用证明(两家以上应用单位,必备)',
-          techol_ppt: '成果技术汇报PPT(必备)',
-          testing_report: '检测报告(根据项目需要提供)',
-          quality: '质量标准(检测报告所依据的标准,企业标准,行业标准,国家标准,国际标准)',
-          patent: '与本成果相关的授权专利证书',
-          special: '特殊行业需要提供的相应证明材料',
-          budget: '项目经费预算书',
-          final: '项目经费决算书',
-        },
+        basic: {},
+        brief: {},
+        research: [],
+        datalist: {},
+        status: '0',
       },
       rules: {
         desc: [{ required: true, message: '请输入审核意见', trigger: 'blur' }],
@@ -140,8 +89,18 @@ export default {
       },
     };
   },
-  created() {},
+  created() {
+    if (this.id) this.search();
+  },
   methods: {
+    ...achieveApply(['fetch']),
+    ...verifyRecord(['create']),
+    async search() {
+      const res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, 'form', res.data);
+      }
+    },
     // 返回
     back() {
       this.$router.push({ path: '/adminExamine' });
@@ -149,16 +108,30 @@ export default {
     onSubmit(formName) {
       this.$refs[formName].validate(valid => {
         if (valid) {
-          alert('submit!');
+          this.toVerify();
         } else {
           console.log('error submit!!');
           return false;
         }
       });
     },
+    async toVerify() {
+      let data = _.pick(this.form, ['desc', 'status']);
+      data.apply_id = _.get(this.user, '_id');
+      data.verify = _.get(this.user, 'name');
+      data.verify_phone = _.get(this.user, 'phone');
+      data.verify_id = _.get(this.user, '_id');
+      const res = await this.create(data);
+      if (this.$checkRes(res, '审核成功', res.errmsg || '审核失败')) {
+        this.$router.push('./');
+      }
+    },
   },
   computed: {
     ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
   },
   watch: {},
 };

+ 10 - 11
src/views/adminCenter/adminExamine/index.vue

@@ -13,6 +13,7 @@
 <script>
 import dataTable from '@common/src/components/frame/filter-page-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: achieveApply } = createNamespacedHelpers('achieveApply');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -36,16 +37,7 @@ export default {
         { label: '成果类别', prop: 'basic.achieve_type', showTip: true },
         { label: '状态', prop: 'status' },
       ],
-      list: [
-        {
-          basic: {
-            achieve_num: '成果编号',
-            achieve_name: '成果名称',
-            achieve_type: '成果类别',
-          },
-          status: '0',
-        },
-      ],
+      list: [],
       total: 0,
     };
   },
@@ -53,8 +45,15 @@ export default {
     await this.search();
   },
   methods: {
+    ...achieveApply(['query']),
     // 查询列表
-    async search({ skip = 0, limit = 10, ...info } = {}) {},
+    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);
+      }
+    },
     // 资料审核
     toCheck({ data }) {
       this.$router.push({ path: '/adminExamine/detail', query: { id: data.id } });

+ 60 - 36
src/views/adminCenter/adminScore/detail.vue

@@ -12,7 +12,13 @@
       </el-col>
     </el-row>
     <el-dialog title="专家信息管理" width="40%" :visible.sync="dialog" @closed="handleClose" :destroy-on-close="true">
-      <data-form :data="form" :fields="formfields" :rules="rules" @save="toSave"> </data-form>
+      <data-form :data="form" :fields="formfields" :rules="rules" @save="toSave" @filterReturn="expertSelect">
+        <template #options="{item}">
+          <template v-if="item.model === 'expert_user_id'">
+            <el-option v-for="(i, index) in expertList" :key="`expert${index}`" :label="i.name" :value="i.user_id"></el-option>
+          </template>
+        </template>
+      </data-form>
     </el-dialog>
     <el-dialog title="评分详情" width="40%" :visible.sync="scoreDialog" @closed="handleClose" :destroy-on-close="true">
       <scoreInfo :form="info"></scoreInfo>
@@ -21,10 +27,13 @@
 </template>
 
 <script>
+const _ = require('lodash');
 import scoreInfo from './parts/scoreInfo.vue';
 import dataTable from '@common/src/components/frame/filter-page-table.vue';
 import dataForm from '@common/src/components/frame/form.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: expert } = createNamespacedHelpers('expert');
+const { mapActions: achieveExpert } = createNamespacedHelpers('achieveExpert');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -42,66 +51,57 @@ export default {
         {
           label: '编辑',
           method: 'edit',
+          display: i => !_.isObject(i.verify),
         },
         {
           label: '删除',
           method: 'delete',
+          display: i => !_.isObject(i.verify),
         },
         {
           label: '评分详情',
           method: 'view',
-          // 只有专家已评分,才可看评分相亲
-          display: item => {
-            return item.status == '1' ? true : false;
-          },
+          display: i => _.isObject(i.verify),
         },
       ],
       fields: [
-        { label: '专家姓名', prop: 'name', filter: 'input', showTip: true },
+        { label: '专家姓名', prop: 'expert_name', filter: 'input', showTip: true },
         { label: '联系电话', prop: 'phone', showTip: true },
-        { label: '登录密码', prop: 'password', showTip: true },
-        { label: '评分', prop: 'score', showTip: true },
-        { label: '状态', prop: 'status' },
-      ],
-      list: [
-        {
-          name: '专家姓名',
-          phone: '17319450324',
-          password: '123456',
-          score: '10',
-          content: '评分详情',
-          status: '0',
-        },
-        {
-          name: '专家姓名',
-          phone: '17319450324',
-          password: '123456',
-          score: '10',
-          content: '评分详情',
-          status: '1',
-        },
+        { label: '评分', prop: 'verify.score', showTip: true },
+        { label: '状态', prop: 'verify', format: i => (_.isObject(i) ? '已评分' : '未评分') },
       ],
+      list: [],
       total: 0,
       // 创建专家账号
       dialog: false,
       form: {},
       rules: {},
       formfields: [
-        { label: '姓名', model: 'name' },
+        { label: '专家', model: 'expert_user_id', type: 'select', filterReturn: true },
         { label: '联系电话', model: 'phone' },
         { label: '登录密码', model: 'password', type: 'password' },
       ],
       // 评分详情
       scoreDialog: false,
       info: {},
+      expertList: [],
     };
   },
   async created() {
     await this.search();
+    this.toGetExpert();
   },
   methods: {
+    ...achieveExpert(['query', 'create', 'update', 'delete']),
+    ...expert({ getExpert: 'query' }),
     // 查询列表
-    async search({ skip = 0, limit = 10, ...info } = {}) {},
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, ...info, apply_id: this.id });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
     // 专家评分查看
     toView({ data }) {
       this.$set(this, `info`, data);
@@ -112,19 +112,24 @@ export default {
       this.dialog = true;
     },
     // 提交
-    toSave({ data }) {
-      console.log(data);
-      this.handleClose();
+    async toSave({ data }) {
+      const duplicate = _.cloneDeep(data);
+      duplicate.apply_id = this.id;
+      let method = _.get(duplicate, '_id') ? 'update' : 'create';
+      let res = await this[method](duplicate);
+      if (this.$checkRes(res, '专家保存成功', res.errmsg || '专家保存失败')) this.handleClose();
     },
     // 修改
     toEdit({ data }) {
-      console.log(data);
+      this.$set(this, 'form', _.cloneDeep(data));
       this.dialog = true;
     },
     // 删除
-    toDelete({ data }) {
-      console.log(data);
-      this.search();
+    async toDelete({ data }) {
+      const res = await this.delete(data._id);
+      if (this.$checkRes(res, '删除成功', res.errmsg || '删除失败')) {
+        this.search();
+      }
     },
     // 取消
     handleClose() {
@@ -136,9 +141,28 @@ export default {
     back() {
       this.$router.push({ path: '/adminScore' });
     },
+    // 选择专家,返回电话
+    expertSelect({ data, model }) {
+      if (model === 'expert_user_id') {
+        const res = this.expertList.find(f => f.user_id === data);
+        if (res) {
+          const { phone, name } = res;
+          this.$set(this.form, 'phone', phone);
+          this.$set(this.form, 'expert_name', name);
+        }
+      }
+    },
+    // 获取专家列表
+    async toGetExpert() {
+      const res = await this.getExpert();
+      if (this.$checkRes(res)) this.$set(this, 'expertList', res.data);
+    },
   },
   computed: {
     ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
   },
   watch: {},
 };

+ 10 - 11
src/views/adminCenter/adminScore/index.vue

@@ -24,6 +24,7 @@
 import dataForm from '@common/src/components/frame/form.vue';
 import dataTable from '@common/src/components/frame/filter-page-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: achieveApply } = createNamespacedHelpers('achieveApply');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -52,16 +53,7 @@ export default {
         { label: '成果类别', prop: 'basic.achieve_type', showTip: true },
         { label: '状态', prop: 'status' },
       ],
-      list: [
-        {
-          basic: {
-            achieve_num: '成果编号',
-            achieve_name: '成果名称',
-            achieve_type: '成果类别',
-          },
-          status: '0',
-        },
-      ],
+      list: [],
       total: 0,
       // 会审总结
       sumDialog: false,
@@ -76,8 +68,15 @@ export default {
     await this.search();
   },
   methods: {
+    ...achieveApply(['query']),
     // 查询列表
-    async search({ skip = 0, limit = 10, ...info } = {}) {},
+    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);
+      }
+    },
     // 专家评分查看
     toView({ data }) {
       this.$router.push({ path: '/adminScore/detail', query: { id: data.id } });

+ 3 - 3
src/views/adminCenter/adminScore/parts/scoreInfo.vue

@@ -5,16 +5,16 @@
         <el-col :span="24" class="name">
           <el-form ref="form" :model="form" label-width="80px">
             <el-form-item label="专家姓名">
-              <el-input v-model="form.name" readonly></el-input>
+              <el-input v-model="form.expert_name" readonly></el-input>
             </el-form-item>
             <el-form-item label="联系电话">
               <el-input v-model="form.phone" readonly></el-input>
             </el-form-item>
             <el-form-item label="评分">
-              <el-input v-model="form.score" readonly></el-input>
+              <el-input v-model="form.verify.score" readonly></el-input>
             </el-form-item>
             <el-form-item label="评分详情">
-              <el-input type="textarea" v-model="form.content" :autosize="{ minRows: 4, maxRows: 6 }"> </el-input>
+              <el-input type="textarea" v-model="form.verify.content" :autosize="{ minRows: 4, maxRows: 6 }" readonly> </el-input>
             </el-form-item>
           </el-form>
         </el-col>

+ 7 - 2
vue.config.js

@@ -24,8 +24,13 @@ module.exports = {
       '/files': {
         target: 'http://broadcast.waityou24.cn',
       },
-      '/api': {
-        target: 'http://broadcast.waityou24.cn',
+      '/api/live': {
+        target: 'http://192.168.1.19:9101',
+        changeOrigin: true,
+        ws: false,
+      },
+      '/api/achieve': {
+        target: 'http://192.168.1.19:9103',
         changeOrigin: true,
         ws: false,
       },