guhongwei 4 years ago
parent
commit
b5947b1d3e
3 changed files with 103 additions and 100 deletions
  1. 10 14
      src/views/market/list/achieve.vue
  2. 10 14
      src/views/market/list/expert.vue
  3. 83 72
      src/views/market/marketlists.vue

+ 10 - 14
src/views/market/list/achieve.vue

@@ -11,15 +11,12 @@
               <!-- 主要成果单位 -->
               <span v-for="(item, index) in firDroplist" :key="index" @click="change(item.name)">{{ item.name }}</span>
               <!-- 其他 -->
-              <el-select v-model="dropTxt" clearable filterable placeholder="其他" @change="change" class="select">
-                <el-option v-for="(item, index) in dropList" :key="index" :label="item.name" :value="item.name"> </el-option>
-              </el-select>
-              <!-- <el-dropdown trigger="click" @command="change">
-                <span class="el-dropdown-link"> 其他<i class="el-icon-arrow-down el-icon--right"></i> </span>
+              <el-dropdown trigger="click" @command="change">
+                <span class="el-dropdown-link btn"><i class="el-icon-d-arrow-right"></i> </span>
                 <el-dropdown-menu slot="dropdown">
                   <el-dropdown-item v-for="(item, index) in dropList" :key="index" :command="item.name">{{ item.name }}</el-dropdown-item>
                 </el-dropdown-menu>
-              </el-dropdown> -->
+              </el-dropdown>
             </el-col>
             <el-col :span="12" class="search">
               <el-input placeholder="请输入名称" v-model="infoName" class="input-with-select" clearable>
@@ -165,14 +162,13 @@ export default {
           cursor: pointer;
           color: #409eff;
         }
-        .select {
-          width: 19%;
-          /deep/.el-input__inner {
-            height: 30px;
-            line-height: 30px;
-          }
-          /deep/.el-input__icon {
-            line-height: 30px;
+        .btn {
+          padding: 0px 0 0 0;
+          position: relative;
+          top: 1px;
+          i {
+            font-size: 20px;
+            font-weight: bold;
           }
         }
       }

+ 10 - 14
src/views/market/list/expert.vue

@@ -11,15 +11,12 @@
               <!-- 主要成果单位 -->
               <span v-for="(item, index) in firDroplist" :key="index" @click="change(item.name)">{{ item.name }}</span>
               <!-- 其他 -->
-              <el-select v-model="dropTxt" clearable filterable placeholder="其他" @change="change" class="select">
-                <el-option v-for="(item, index) in dropList" :key="index" :label="item.name" :value="item.name"> </el-option>
-              </el-select>
-              <!-- <el-dropdown trigger="click" @command="change">
-                <span class="el-dropdown-link"> 其他<i class="el-icon-arrow-down el-icon--right"></i> </span>
+              <el-dropdown trigger="click" @command="change">
+                <span class="el-dropdown-link btn"><i class="el-icon-d-arrow-right"></i> </span>
                 <el-dropdown-menu slot="dropdown">
                   <el-dropdown-item v-for="(item, index) in dropList" :key="index" :command="item.name">{{ item.name }}</el-dropdown-item>
                 </el-dropdown-menu>
-              </el-dropdown> -->
+              </el-dropdown>
             </el-col>
             <el-col :span="12" class="search">
               <el-input placeholder="请输入名称" v-model="infoName" class="input-with-select" clearable>
@@ -160,14 +157,13 @@ export default {
           cursor: pointer;
           color: #409eff;
         }
-        .select {
-          width: 19%;
-          /deep/.el-input__inner {
-            height: 30px;
-            line-height: 30px;
-          }
-          /deep/.el-input__icon {
-            line-height: 30px;
+        .btn {
+          padding: 0px 0 0 0;
+          position: relative;
+          top: 1px;
+          i {
+            font-size: 20px;
+            font-weight: bold;
           }
         }
       }

+ 83 - 72
src/views/market/marketlists.vue

@@ -111,6 +111,7 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: product } = createNamespacedHelpers('marketproduct');
 const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
 const { mapActions: transaction } = createNamespacedHelpers('transaction');
+const { mapActions: markettype } = createNamespacedHelpers('markettype');
 import _ from 'lodash';
 export default {
   name: 'marketlists',
@@ -149,6 +150,10 @@ export default {
       technologyTotal: 0,
       techDetail: {},
       // 技术成果
+      // 原数组
+      priAchieve: [],
+      priAchieveTotal: 0,
+      // 显示数组
       achieveList: [],
       achieveTotal: 0,
       achiDetail: {},
@@ -159,6 +164,9 @@ export default {
       businessTotal: 0,
       busiDetail: {},
       // 专家信息
+      // 原数组
+      priExpert: [],
+      priExpertTotal: 0,
       expertList: [],
       expertTotal: 0,
       expeDetail: {},
@@ -176,6 +184,7 @@ export default {
     ...product({ productList: 'newquery', productFetch: 'newfetch' }),
     ...expertsuser({ expertsuserList: 'query', expertsuserFetch: 'fetch' }),
     ...transaction({ transactioncreate: 'create', transactionfetch: 'fetch' }),
+    ...markettype({ markettypeList: 'query' }),
     // 查询栏目,列表,详情
     async searchColumn() {
       if (this.type == 0) {
@@ -212,7 +221,9 @@ export default {
         this.$set(this, `technologyTotal`, res.total);
       } else if (columnName == '技术成果') {
         let res = await this.productList({ skip, type: '1', status: '1', ...info });
-        if (this.$checkRes(res)) this.$set(this, `achieveList`, res.data);
+        if (this.$checkRes(res)) this.$set(this, `priAchieve`, res.data);
+        this.$set(this, `priAchieveTotal`, res.total);
+        this.$set(this, `achieveList`, res.data);
         this.$set(this, `achieveTotal`, res.total);
       } else if (columnName == '商务服务') {
         let res = await this.productList({ skip, type: '2', status: '1', ...info });
@@ -220,7 +231,9 @@ export default {
         this.$set(this, `businessTotal`, res.total);
       } else if (columnName == '专家智库') {
         let res = await this.expertsuserList({ skip, ...info });
-        if (this.$checkRes(res)) this.$set(this, `expertList`, res.data);
+        if (this.$checkRes(res)) this.$set(this, `priExpert`, res.data);
+        this.$set(this, `priExpertTotal`, res.total);
+        this.$set(this, `expertList`, res.data);
         this.$set(this, `expertTotal`, res.total);
       }
     },
@@ -301,94 +314,92 @@ export default {
     // 查询成果单位,专家工作单位
     async searchCom() {
       // 成果单位
-      let res = await this.productList({ type: '1', status: '1' });
+      let res = await this.markettypeList({ category: '05' });
       if (this.$checkRes(res)) {
-        let newRes = _.uniqBy(
-          res.data.map(i => ({ name: i.company })),
-          'name'
-        ).filter(
-          i =>
-            i.name != '中科院长春分院' &&
-            i.name != '中科院长春光学精密机械与物理研究所' &&
-            i.name != '中国科学院长春应用化学研究所' &&
-            i.name != '吉林大学' &&
-            i.name != '长春工业大学'
-        );
-        if (newRes) this.$set(this, `dropList`, newRes);
+        let newRes = res.data;
+        newRes.push({ name: '其他' });
+        this.$set(this, `dropList`, newRes);
       }
       // 专家工作单位
-      res = await this.expertsuserList();
+      res = await this.markettypeList({ category: '06' });
       if (this.$checkRes(res)) {
-        let newRes = _.uniqBy(
-          res.data.map(i => ({ name: i.company })),
-          'name'
-        ).filter(
-          i =>
-            i.name != '中国科学院东北地理与农业生态研究所' &&
-            i.name != '中国科学院长春应用化学研究所' &&
-            i.name != '中科院长春光学精密机械与物理研究所' &&
-            i.name != '吉林大学' &&
-            i.name != '长春工业大学'
-        );
-        if (newRes) this.$set(this, `expertdropList`, newRes);
+        let newRes = res.data;
+        newRes.push({ name: '其他' });
+        this.$set(this, `expertdropList`, newRes);
       }
     },
     // 成果选择单位
     async changeCom(data) {
-      if (data == '中科系') {
-        let res = await this.productList({ type: '1', status: '1', company: '中科院长春分院' });
-        let arr = await this.productList({ type: '1', status: '1', company: '中科院长春光学精密机械与物理研究所' });
-        let val = await this.productList({ type: '1', status: '1', company: '中国科学院长春应用化学研究所' });
-        if (res || arr || val) {
-          var newData = res.data.concat(arr.data).concat(val.data);
-          if (newData) {
-            this.$set(this, `achieveList`, newData);
-            this.$set(this, `achieveTotal`, newData.length);
-          }
-        }
-      } else {
-        if (data) {
-          let res = await this.productList({ type: '1', status: '1', company: data });
-          if (this.$checkRes(res)) {
-            this.$set(this, `achieveList`, res.data);
-            this.$set(this, `achieveTotal`, res.total);
-          }
+      if (data) {
+        if (data == '中科系') {
+          let newRes = this.priAchieve.filter(
+            i =>
+              i.company == '中科院长春分院' ||
+              i.company == '中国科学院东北地理与农业生态研究所' ||
+              i.company == '中国科学院长春应用化学研究所' ||
+              i.company == '中科院长春光学精密机械与物理研究所'
+          );
+          this.$set(this, `achieveList`, newRes);
+          this.$set(this, `achieveTotal`, newRes.length);
+        } else if (data == '其他') {
+          let newRes = this.priAchieve.filter(
+            i =>
+              i.company != '中科院长春分院' &&
+              i.company != '中国科学院东北地理与农业生态研究所' &&
+              i.company != '中国科学院长春应用化学研究所' &&
+              i.company != '中科院长春光学精密机械与物理研究所' &&
+              i.company != '吉林大学' &&
+              i.company != '长春工业大学'
+          );
+          this.$set(this, `achieveList`, newRes);
+          this.$set(this, `achieveTotal`, newRes.length);
         } else {
-          let res = await this.productList({ type: '1', status: '1' });
-          if (this.$checkRes(res)) {
-            this.$set(this, `achieveList`, res.data);
-            this.$set(this, `achieveTotal`, res.total);
+          let newRes = this.priAchieve.filter(i => i.company == data);
+          if (newRes) {
+            this.$set(this, `achieveList`, newRes);
+            this.$set(this, `achieveTotal`, newRes.length);
           }
         }
+      } else {
+        this.$set(this, `achieveList`, this.priAchieve);
+        this.$set(this, `achieveTotal`, this.priAchieve.length);
       }
     },
     // 专家选择单位
     async changeExpertCom(data) {
-      if (data == '中科系') {
-        let res = await this.expertsuserList({ company: '中国科学院东北地理与农业生态研究所' });
-        let arr = await this.expertsuserList({ company: '中国科学院长春应用化学研究所' });
-        let val = await this.expertsuserList({ company: '中科院长春光学精密机械与物理研究所' });
-        if (res || arr || val) {
-          var newData = res.data.concat(arr.data).concat(val.data);
-          if (newData) {
-            this.$set(this, `expertList`, newData);
-            this.$set(this, `expertTotal`, newData.length);
-          }
-        }
-      } else {
-        if (data) {
-          let res = await this.expertsuserList({ company: data });
-          if (this.$checkRes(res)) {
-            this.$set(this, `expertList`, res.data);
-            this.$set(this, `expertTotal`, res.total);
-          }
+      if (data) {
+        if (data == '中科系') {
+          let newRes = this.priExpert.filter(
+            i =>
+              i.company == '中科院长春分院' ||
+              i.company == '中国科学院东北地理与农业生态研究所' ||
+              i.company == '中国科学院长春应用化学研究所' ||
+              i.company == '中科院长春光学精密机械与物理研究所'
+          );
+          this.$set(this, `expertList`, newRes);
+          this.$set(this, `expertTotal`, newRes.length);
+        } else if (data == '其他') {
+          let newRes = this.priExpert.filter(
+            i =>
+              i.company != '中科院长春分院' &&
+              i.company != '中国科学院东北地理与农业生态研究所' &&
+              i.company != '中国科学院长春应用化学研究所' &&
+              i.company != '中科院长春光学精密机械与物理研究所' &&
+              i.company != '吉林大学' &&
+              i.company != '长春工业大学'
+          );
+          this.$set(this, `expertList`, newRes);
+          this.$set(this, `expertTotal`, newRes.length);
         } else {
-          let res = await this.expertsuserList();
-          if (this.$checkRes(res)) {
-            this.$set(this, `expertList`, res.data);
-            this.$set(this, `expertTotal`, res.total);
+          let newRes = this.priExpert.filter(i => i.company == data);
+          if (newRes) {
+            this.$set(this, `expertList`, newRes);
+            this.$set(this, `expertTotal`, newRes.length);
           }
         }
+      } else {
+        this.$set(this, `expertList`, this.priExpert);
+        this.$set(this, `expertTotal`, this.priExpert.legnth);
       }
     },
   },