guhongwei 4 年之前
父節點
當前提交
59909c0e28

+ 2 - 8
src/views/achieveLive/apply.vue

@@ -29,12 +29,6 @@
                 <el-select v-model="form.productList" value-key="id" clearable filterable multiple collapse-tags placeholder="请选择选择产品">
                   <el-option v-for="(item, index) in goodsList" :key="index" :label="`${item.name}(${getType(item.type)})`" :value="item"> </el-option>
                 </el-select>
-                <!-- <el-select v-model="form.productList" value-key="id" clearable filterable multiple collapse-tags placeholder="请选择选择产品">
-                  <el-option v-for="(item, index) in goodsList" :key="index" :label="item.name" :value="item">
-                    <span style="float: left">{{ item.name }}</span>
-                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.type }}</span>
-                  </el-option>
-                </el-select> -->
               </el-form-item>
               <el-col :span="24" class="btn">
                 <el-button type="danger" size="mini" @click="resetBtn">取消申请</el-button>
@@ -77,7 +71,7 @@ export default {
     async search() {
       let data = { name: this.user.name, phone: this.user.phone, user_id: this.user.id, dock_id: this.dock_id };
       this.$set(this, `form`, data);
-      let res = await this.query({ user_id: this.user.id });
+      let res = await this.query({ user_id: this.user.id, stauts: '2' });
       if (this.$checkRes(res)) {
         this.$set(this, `goodsList`, res.data);
       }
@@ -94,7 +88,7 @@ export default {
               message: '申请参展成功!',
               type: 'success',
             });
-            this.search();
+            this.resetBtn();
           }
         } else {
           console.log('error submit!!');

+ 0 - 112
src/views/userCenter/dock/applyAchieve.vue

@@ -1,112 +0,0 @@
-<template>
-  <div id="applyAchieve">
-    <el-row>
-      <el-col :span="24">
-        <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 {
-  name: 'applyAchieve',
-  props: {
-    dock_id: { type: String },
-  },
-  components: { dataForm },
-  data: function() {
-    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: '1', 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');
-    },
-  },
-  computed: {
-    ...mapState(['user']),
-  },
-  watch: {},
-};
-</script>
-
-<style lang="less" scoped></style>

+ 0 - 112
src/views/userCenter/dock/applyTechol.vue

@@ -1,112 +0,0 @@
-<template>
-  <div id="applyAchieve">
-    <el-row>
-      <el-col :span="24">
-        <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 {
-  name: 'applyAchieve',
-  props: {
-    dock_id: { type: String },
-  },
-  components: { dataForm },
-  data: function() {
-    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');
-    },
-  },
-  computed: {
-    ...mapState(['user']),
-  },
-  watch: {},
-};
-</script>
-
-<style lang="less" scoped></style>

+ 2 - 2
src/views/userCenter/dock/next.vue

@@ -32,7 +32,7 @@ export default {
         { label: '名称', prop: 'title', showTip: true },
         { label: '开始时间', prop: 'start_time', showTip: true },
         { label: '结束时间', prop: 'end_time', showTip: true },
-        { label: '负责人', prop: 'adminuser', showTip: true },
+        { label: '负责人', prop: 'admin', showTip: true },
         { label: '联系电话', prop: 'phone', showTip: true },
       ],
       list: [],
@@ -46,7 +46,7 @@ export default {
     ...dock(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询下期直播展会
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      let res = await this.query({ skip, limit, status: 0, ...info });
+      let res = await this.query({ skip, limit, status: '0', ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);

+ 2 - 2
src/views/userCenter/dock/past.vue

@@ -27,7 +27,7 @@ export default {
         { label: '名称', prop: 'title', showTip: true },
         { label: '开始时间', prop: 'start_time', showTip: true },
         { label: '结束时间', prop: 'end_time', showTip: true },
-        { label: '负责人', prop: 'adminuser', showTip: true },
+        { label: '负责人', prop: 'admin', showTip: true },
         { label: '联系电话', prop: 'phone', showTip: true },
       ],
       list: [],
@@ -41,7 +41,7 @@ export default {
     ...dock(['query']),
     // 查询下期直播展会
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      let res = await this.query({ skip, limit, status: 2, ...info });
+      let res = await this.query({ skip, limit, status: '-1', ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);

+ 82 - 20
src/views/userCenter/menuParst/dockInfo.vue

@@ -16,15 +16,27 @@
               </el-tab-pane>
             </el-tabs>
           </el-col>
-          <el-col :span="24" v-else-if="display == 'apply'">
-            <el-tabs v-model="applyActive" type="card">
-              <el-tab-pane label="技术成果" name="first">
-                <applyAchieve :dock_id="dock_id" @toRest="toRest"></applyAchieve>
-              </el-tab-pane>
-              <el-tab-pane label="科技需求" name="second">
-                <applyTechol :dock_id="dock_id" @toRest="toRest"></applyTechol>
-              </el-tab-pane>
-            </el-tabs>
+          <el-col :span="24" class="two" v-else-if="display == 'apply'">
+            <el-form :model="form" :rules="rules" ref="form" label-width="100px">
+              <el-form-item label="用户名称" prop="name">
+                <el-input v-model="form.name"></el-input>
+              </el-form-item>
+              <el-form-item label="联系电话" prop="phone">
+                <el-input v-model="form.phone"></el-input>
+              </el-form-item>
+              <el-form-item label="申请时间" prop="create_time">
+                <el-date-picker v-model="form.create_time" placeholder="请选择" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"> </el-date-picker>
+              </el-form-item>
+              <el-form-item label="参展项目" prop="productList">
+                <el-select v-model="form.productList" value-key="id" clearable filterable multiple collapse-tags placeholder="请选择选择产品">
+                  <el-option v-for="(item, index) in goodsList" :key="index" :label="`${item.name}(${getType(item.type)})`" :value="item"> </el-option>
+                </el-select>
+              </el-form-item>
+              <el-col :span="24" class="btn">
+                <el-button type="danger" size="mini" @click="resetBtn">取消申请</el-button>
+                <el-button type="success" size="mini" @click="onSubmit('form')">提交申请</el-button>
+              </el-col>
+            </el-form>
           </el-col>
         </el-col>
       </el-col>
@@ -35,36 +47,75 @@
 <script>
 import next from '../dock/next.vue';
 import past from '../dock/past.vue';
-import applyAchieve from '../dock/applyAchieve.vue';
-import applyTechol from '../dock/applyTechol.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: 'dockInfo',
   props: {},
-  components: { next, past, applyAchieve, applyTechol },
+  components: { next, past },
   data: function() {
     return {
+      active: 'first',
       // 显示
       display: 'list',
-      // 列表
-      active: 'first',
-      // 申请展会(技术成果,科技需求)
-      applyActive: 'first',
-      dock_id: '',
+      form: {
+        productList: [],
+      },
+      rules: {},
+      // 企业成果
+      goodsList: [],
     };
   },
-  created() {},
+  created() {
+    if (this.user) this.search();
+  },
   methods: {
+    ...product(['query']),
+    ...dockUser(['create']),
+    async search() {
+      let data = { name: this.user.name, phone: this.user.phone, user_id: this.user.id };
+      this.$set(this, `form`, data);
+      let res = await this.query({ user_id: this.user.id, status: 2 });
+      if (this.$checkRes(res)) {
+        this.$set(this, `goodsList`, res.data);
+      }
+    },
     // 申请展会
     toApply(data) {
-      this.$set(this, `dock_id`, data.id);
+      this.$set(this.form, `dock_id`, data.id);
       this.display = 'apply';
     },
+    // 提交申请
+    onSubmit(formName) {
+      this.$refs[formName].validate(async valid => {
+        if (valid) {
+          let data = this.form;
+          let res = await this.create(data);
+          if (this.$checkRes(res)) {
+            this.$message({
+              message: '申请参展成功!',
+              type: 'success',
+            });
+            this.resetBtn();
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 整理类型
+    getType(type) {
+      if (type == '0') return '科技需求';
+      else if (type == '1') return '技术成果';
+      else if (type == '2') return '商务服务';
+    },
     // 取消申请
-    toRest() {
+    resetBtn() {
       this.display = 'list';
     },
   },
@@ -88,5 +139,16 @@ export default {
     color: #22529a;
     margin: 0 0 10px 0;
   }
+  .two {
+    .el-date-editor {
+      width: 100%;
+    }
+    .el-select {
+      width: 100%;
+    }
+    .btn {
+      text-align: center;
+    }
+  }
 }
 </style>