guhongwei 4 年 前
コミット
64ad4a1951

+ 21 - 13
src/views/achieveLive/detail/productData.vue

@@ -7,10 +7,10 @@
             <el-col :span="24" class="first">
               <el-col :span="5" class="achieveList" v-for="(item, index) in achieveList" :key="index">
                 <el-col :span="24" class="top">
-                  <p class="textOver">{{ item.name }}</p>
-                  <p>{{ item.achievebrief }}</p>
-                  <p class="textOver">领域:{{ item.field }}</p>
-                  <p class="textOver">联系人{{ item.contacts }}</p>
+                  <p class="textOver">{{ item.name || '暂无' }}</p>
+                  <p>{{ item.achievebrief || '暂无' }}</p>
+                  <p class="textOver">领域:{{ item.field || '暂无' }}</p>
+                  <p class="textOver">联系人{{ item.contacts || '暂无' }}</p>
                 </el-col>
                 <el-col :span="24" class="down">
                   <el-button size="mini" type="primary" @click="detail(item, '1')">详情</el-button>
@@ -26,8 +26,8 @@
             <el-col :span="24" class="second">
               <el-col :span="5" class="techolList" v-for="(item, index) in techolList" :key="index">
                 <el-col :span="24" class="top">
-                  <p>{{ item.name }}</p>
-                  <p class="textOver">领域:{{ item.field }}</p>
+                  <p>{{ item.name || '暂无' }}</p>
+                  <p class="textOver">领域:{{ item.field || '暂无' }}</p>
                 </el-col>
                 <el-col :span="24" class="down">
                   <el-button size="mini" type="primary" @click="detail(item, '0')">详情</el-button>
@@ -56,6 +56,7 @@ import achieveInfo from '../product/achieveInfo.vue';
 import techolInfo from '../product/techolInfo.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: dock } = createNamespacedHelpers('dock');
+const { mapActions: dockUser } = createNamespacedHelpers('dockUser');
 export default {
   name: 'productData',
   props: {},
@@ -86,13 +87,20 @@ export default {
   },
   methods: {
     ...dock(['productQuery']),
+    ...dockUser(['query']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      // 技术成果
-      let res = await this.productQuery({ skip, limit, type: '1', dock_id: this.id, ...info });
-      if (this.$checkRes(res)) this.$set(this, `achieveList`, res.data);
-      // 科技需求
-      res = await this.productQuery({ skip, limit, type: '0', dock_id: this.id, ...info });
-      if (this.$checkRes(res)) this.$set(this, `techolList`, res.data);
+      info.dock_id = this.id;
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        for (const val of res.data) {
+          // 成果
+          let achieve = val.goodsList.filter(i => i.type == '1');
+          if (achieve) this.$set(this, `achieveList`, achieve);
+          // 需求
+          let techol = val.goodsList.filter(i => i.type == '0');
+          if (techol) this.$set(this, `techolList`, techol);
+        }
+      }
     },
     // 查看更多项目
     moreBtn(type) {
@@ -108,7 +116,7 @@ export default {
     },
     // 对接
     trans(data, type) {
-      this.$router.push({ path: '/achieveLive/product/detail', query: { dock_id: this.id, id: data._id, type: data.type } });
+      this.$router.push({ path: '/achieveLive/product/detail', query: { dock_id: this.id, id: data.id, type: data.type } });
     },
     // 取消查看
     handleClose() {

+ 1 - 0
src/views/achieveLive/detail/topInfo.vue

@@ -42,6 +42,7 @@ export default {
     async search() {
       let res = await this.dockQuery({ dock_id: this.id });
       if (this.$checkRes(res)) {
+        console.log(res.data);
         this.$set(this, `list`, res.data);
       }
     },

+ 27 - 13
src/views/achieveLive/product/index.vue

@@ -15,7 +15,7 @@
                 </el-col>
               </el-col>
               <el-col :span="24" class="list">
-                <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @check="toCheck"></data-table>
+                <data-table :fields="fields" :opera="opera" :data="list" :total="total" :limit="15" @query="search" @check="toCheck"></data-table>
               </el-col>
             </el-col>
           </div>
@@ -30,7 +30,7 @@ import subTop from '../parts/subTop.vue';
 import dataTable from '@common/src/components/frame/filter-page-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: dock } = createNamespacedHelpers('dock');
-const { mapActions: expert } = createNamespacedHelpers('expert');
+const { mapActions: dockUser } = createNamespacedHelpers('dockUser');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -67,6 +67,7 @@ export default {
   },
   methods: {
     ...dock(['fetch', 'productQuery']),
+    ...dockUser(['query']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       if (this.dock_id) {
         let res = await this.fetch(this.dock_id);
@@ -74,21 +75,34 @@ export default {
           this.$set(this, `liveInfo`, res.data);
         }
       }
-      if (this.type == '0') {
-        // 科技需求
-        let res = await this.productQuery({ skip, limit, type: '0', dock_id: this.dock_id, ...info });
-        if (this.$checkRes(res)) this.$set(this, `list`, res.data);
-        this.$set(this, `total`, res.total);
-      } else {
-        // 技术成果
-        let res = await this.productQuery({ skip, limit, type: '1', dock_id: this.dock_id, ...info });
-        if (this.$checkRes(res)) this.$set(this, `list`, res.data);
-        this.$set(this, `total`, res.total);
+      let res = await this.query({ skip, limit, dock_id: this.dock_id, ...info });
+      if (this.$checkRes(res)) {
+        for (const val of res.data) {
+          // 成果
+          let achieve = val.goodsList.filter(i => i.type == '1');
+          if (achieve) this.$set(this, `list`, achieve);
+          this.$set(this, `total`, achieve.length);
+          // 需求
+          let techol = val.goodsList.filter(i => i.type == '0');
+          if (techol) this.$set(this, `list`, techol);
+          this.$set(this, `total`, techol.length);
+        }
       }
+      // if (this.type == '0') {
+      //   // 科技需求
+      //   let res = await this.productQuery({ skip, limit, type: '0', dock_id: this.dock_id, ...info });
+      //   if (this.$checkRes(res)) this.$set(this, `list`, res.data);
+      //   this.$set(this, `total`, res.total);
+      // } else {
+      //   // 技术成果
+      //   let res = await this.productQuery({ skip, limit, type: '1', dock_id: this.dock_id, ...info });
+      //   if (this.$checkRes(res)) this.$set(this, `list`, res.data);
+      //   this.$set(this, `total`, res.total);
+      // }
     },
     // 对接
     toCheck({ data }) {
-      this.$router.push({ path: '/achieveLive/product/detail', query: { dock_id: this.dock_id, id: data._id, type: data.type } });
+      this.$router.push({ path: '/achieveLive/product/detail', query: { dock_id: this.dock_id, id: data.id, type: data.type } });
     },
     // 返回
     back() {

+ 4 - 4
src/views/achieveLive/product/techolInfo.vue

@@ -10,7 +10,7 @@
               </el-carousel-item>
             </el-carousel>
           </el-col>
-          <el-col :span="7" v-else class="achieveImage">
+          <el-col :span="7" class="achieveImage">
             <p>紧急程度</p>
             <p><el-rate v-model="value" disabled :max="max" :texts="texts" :colors="colors"> </el-rate></p>
           </el-col>
@@ -236,9 +236,9 @@ export default {
       }
     },
     searchdegre() {
-      if (this.form.degreeurgency == '一般') this.$set(this, `value`, 1);
-      else if (this.form.degreeurgency == '紧急') this.$set(this, `value`, 2);
-      else if (this.form.degreeurgency == '长期') this.$set(this, `value`, 3);
+      // if (this.form.degreeurgency == '一般') this.$set(this, `value`, 1);
+      // else if (this.form.degreeurgency == '紧急') this.$set(this, `value`, 2);
+      // else if (this.form.degreeurgency == '长期') this.$set(this, `value`, 3);
     },
   },
   computed: {

+ 1 - 0
src/views/admin/live/achieve/apply.vue

@@ -88,6 +88,7 @@ export default {
   methods: {
     ...dockUser(['query', 'update', 'delete', 'goodsCheck']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
+      info.dock_id = this.user.id;
       const res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);

+ 1 - 1
src/views/admin/live/achieve/apply/goodsList.vue

@@ -42,7 +42,7 @@ export default {
         { label: '联系电话', prop: 'phone' },
         { label: '所属领域', prop: 'field' },
         { label: '合作方式', prop: 'cooperation' },
-        { label: '审核状态', prop: 'dockStatus', format: i => (i == '1' ? '已通过' : i == '2' ? '已拒绝' : '未审核') },
+        { label: '审核状态', prop: 'status', format: i => (i == '1' ? '已通过' : i == '2' ? '已拒绝' : '未审核') },
       ],
       info: {},
     };

+ 1 - 1
src/views/userCenter/dock/applyAchieve.vue

@@ -55,7 +55,7 @@ export default {
       // 查询用户
       let res = await this.dockUser({ dock_id: this.dock_id, user_id: this.user.id });
       if (this.$checkRes(res)) {
-        if (res.total > 0) {
+        if (res) {
           this.$set(this, `form`, res.data);
           this.$set(this, `isNews`, false);
         } else {

+ 90 - 10
src/views/userCenter/dock/applyTechol.vue

@@ -1,27 +1,107 @@
 <template>
-  <div id="applyTechol">
+  <div id="applyAchieve">
     <el-row>
       <el-col :span="24">
-        <p>applyTechol</p>
+        <data-form :data="form" :fields="fields" :rules="{}" :needSave="false">
+          <template #custom="{item,form}">
+            <template v-if="item.model === 'goodsList'">
+              <el-select v-model="form.goodsList" value-key="id" multiple collapse-tags placeholder="请选择选择产品">
+                <el-option v-for="(item, index) in goodsList" :key="index" :label="item.name" :value="item"> </el-option>
+              </el-select>
+            </template>
+          </template>
+          <template slot="submit">
+            <el-button type="danger" size="mini" @click="toRest">取消</el-button>
+            <el-button type="primary" size="mini" @click="toSave">确认</el-button>
+          </template>
+        </data-form>
       </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
+import dataForm from '@common/src/components/frame/form.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: product } = createNamespacedHelpers('product');
+const { mapActions: dockUser } = createNamespacedHelpers('dockUser');
 export default {
-  metaInfo() {
-    return { title: this.$route.meta.title };
+  name: 'applyAchieve',
+  props: {
+    dock_id: { type: String },
   },
-  name: 'applyTechol',
-  props: {},
-  components: {},
+  components: { dataForm },
   data: function() {
-    return {};
+    return {
+      fields: [
+        { label: '用户名称', model: 'user_name' },
+        { label: '联系电话', model: 'contact_tel' },
+        { label: '申请时间', model: 'apply_time', type: 'date' },
+        { label: '成果列表', model: 'goodsList', custom: true },
+      ],
+      form: {},
+      // 成果列表
+      goodsList: [],
+      isNews: true,
+    };
+  },
+  async created() {
+    await this.searchOther();
+  },
+  methods: {
+    ...product({ productQuery: 'query' }),
+    ...dockUser(['dockUser', 'fetch', , 'update', 'create']),
+    async searchOther() {
+      // 查询用户
+      let res = await this.dockUser({ dock_id: this.dock_id, user_id: this.user.id });
+      if (this.$checkRes(res)) {
+        if (res) {
+          this.$set(this, `form`, res.data);
+          this.$set(this, `isNews`, false);
+        } else {
+          let data = {
+            dock_id: this.dock_id,
+            user_id: this.user.id,
+            user_name: this.user.name,
+            contact_tel: this.user.phone,
+          };
+          this.$set(this, `form`, data);
+        }
+      }
+      // 查询用户产品
+      res = await this.productQuery({ type: '0', status: '2', user_id: this.user.id });
+      if (this.$checkRes(res)) {
+        this.$set(this, `goodsList`, res.data);
+      }
+    },
+    // 确认
+    async toSave() {
+      let data = this.form;
+      if (this.isNews) {
+        let res = await this.create(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '创建参展信息成功',
+            type: 'success',
+          });
+          this.toRest();
+        }
+      } else {
+        let res = await this.update(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '修改参展信息成功',
+            type: 'success',
+          });
+          this.toRest();
+        }
+      }
+    },
+    // 取消
+    toRest() {
+      this.$emit('toRest');
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
   },

+ 2 - 2
src/views/userCenter/menuParst/dockInfo.vue

@@ -21,8 +21,8 @@
               <el-tab-pane label="技术成果" name="first">
                 <applyAchieve :dock_id="dock_id" @toRest="toRest"></applyAchieve>
               </el-tab-pane>
-              <el-tab-pane label="科技需求" name="second" disabled>
-                <applyTechol></applyTechol>
+              <el-tab-pane label="科技需求" name="second">
+                <applyTechol :dock_id="dock_id" @toRest="toRest"></applyTechol>
               </el-tab-pane>
             </el-tabs>
           </el-col>