guhongwei 3 years ago
parent
commit
e5bc56dbdd

+ 7 - 1
src/router/index.js

@@ -116,14 +116,20 @@ const twoweb = [
   },
   {
     path: '/twoweb/service/made/detail',
-    meta: { title: '订制问卷' },
+    meta: { title: '调查问卷' },
     component: () => import('../views/twoweb/service/made/detail.vue'),
   },
+
   {
     path: '/twoweb/service/helpCompany/detail',
     meta: { title: '调查问卷' },
     component: () => import('../views/twoweb/service/helpCompany/detail.vue'),
   },
+  {
+    path: '/twoweb/service/comDemand/detail',
+    meta: { title: '调查问卷' },
+    component: () => import('../views/twoweb/service/comDemand/detail.vue'),
+  },
   {
     path: '/twoweb/service/product',
     name: 'twoweb_service_product_index',

+ 178 - 0
src/views/twoweb/service/comDemand/detail.vue

@@ -0,0 +1,178 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main">
+        <div class="w_1200">
+          <el-col :span="24" class="info">
+            <el-form :model="form" :rules="rules" ref="form">
+              <el-col :span="24" class="one">
+                <el-col :span="24" class="title">
+                  {{ data.title }}
+                </el-col>
+                <el-col :span="24" class="brief">
+                  {{ data.brief }}
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="two">
+                <el-col :span="24" class="common">
+                  <el-col :span="24" class="txt">
+                    <span>问卷详情</span>
+                  </el-col>
+                  <el-col :span="24" class="info">
+                    <two :form="form" :rules="rules"></two>
+                  </el-col>
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="btn">
+                <el-button type="primary" size="mini" @click="onSubmit">提交</el-button>
+              </el-col>
+            </el-form>
+          </el-col>
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const fields = require('./fields');
+import two from './parts/two.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: answer } = createNamespacedHelpers('answer');
+const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
+export default {
+  name: 'detail',
+  props: {},
+  components: {
+    two,
+  },
+  data: function() {
+    return {
+      data: {},
+      form: {
+        comDemand_zycp: [],
+      },
+      rules: {},
+    };
+  },
+  created() {
+    if (this.id) this.search();
+  },
+  methods: {
+    ...answer(['create']),
+    ...questionnaire(['fetch']),
+    async search() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `data`, res.data);
+      }
+    },
+    // 提交
+    async onSubmit() {
+      let data = this.form;
+      let { ...others } = data;
+      let obj = { questionnaire_id: this.id };
+      const fields = this.setFields();
+      const arr = [];
+      const keys = Object.keys(others);
+      for (const key of keys) {
+        const label = fields[key];
+        const answer = others[key];
+        arr.push({ label, answer });
+      }
+      obj.answer = arr;
+      const res = await this.create(obj);
+      if (this.$checkRes(res, '提交成功', '提交失败')) {
+        this.$router.push({ path: '/twoweb/service/question' });
+      }
+    },
+    setFields() {
+      const fkeys = Object.keys(fields);
+      let object = [];
+      for (const key of fkeys) {
+        const narr = fields[key];
+        for (const obj of narr) {
+          if (!obj.children) {
+            object[obj.model] = obj.label;
+          } else {
+            for (const child of obj.children) {
+              object[child.model] = child.label;
+            }
+          }
+        }
+      }
+      return object;
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  padding: 10px 0;
+  .info {
+    .one {
+      border-bottom: 1px dashed #ccc;
+      padding: 0 20px;
+      margin: 0 0 22px 0;
+      .title {
+        font-size: 30px;
+        font-weight: bold;
+        margin: 20px 0;
+        text-align: center;
+      }
+      .brief {
+        font-size: 16px;
+        padding: 0 0 20px 0;
+      }
+    }
+    .two {
+      .common {
+        position: relative;
+        border: 1px solid #41719c;
+        margin: 0 0 35px 0;
+        min-height: 150px;
+        .txt {
+          position: absolute;
+          top: -22px;
+          text-align: center;
+          span {
+            height: 40px;
+            line-height: 40px;
+            display: inline-block;
+            padding: 0 35px;
+            background: #fff;
+            font-weight: bold;
+            font-size: 18px;
+          }
+        }
+        .info {
+          padding: 20px 10px 10px 10px;
+        }
+      }
+      .btn {
+        text-align: center;
+      }
+    }
+    .btn {
+      text-align: center;
+    }
+  }
+}
+</style>

+ 139 - 0
src/views/twoweb/service/comDemand/fields.js

@@ -0,0 +1,139 @@
+export const two = [
+  {
+    label: '企业名称',
+    model: 'comDemand_qymc',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '通讯地址',
+    model: 'comDemand_txdz',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '所属领域',
+    model: 'comDemand_scly',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '注册资金',
+    model: 'comDemand_zczj',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '注册时间',
+    model: 'comDemand_zcsj',
+    list: '',
+    type: 'datePicker',
+  },
+  {
+    label: '网址',
+    model: 'comDemand_wz',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '企业法定代表人情况',
+    model: 'helpCom_frdb',
+    list: '',
+    type: 'frdb',
+    children: [
+      { label: '姓名', model: 'frdb_xm', list: '', type: 'text' },
+      { label: '性别', model: 'frdb_xb', list: '', type: 'text' },
+      {
+        label: '出生年月',
+        model: 'frdb_cs',
+        list: '',
+        type: 'datePicker',
+      },
+      { label: '最高学历', model: 'frdb_xl', list: '', type: 'text' },
+    ],
+  },
+  {
+    label: '注册登记类型',
+    model: 'comDemand_djlx',
+    list: 'comDemand_djlx',
+    type: 'radio',
+  },
+  {
+    label: '职工总数',
+    model: 'comDemand_zgzs',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '本科以上人数',
+    model: 'comDemand_bkys',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '研究开发人数',
+    model: 'comDemand_yjkf',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '高级职称人数',
+    model: 'comDemand_gjzc',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '联系人',
+    model: 'comDemand_personal',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '联系电话',
+    model: 'comDemand_phone',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '电子邮箱',
+    model: 'comDemand_email',
+    list: '',
+    type: 'text',
+  },
+  {
+    label: '企业概况',
+    model: 'comDemand_qygk',
+    list: '',
+    type: 'textarea',
+  },
+  {
+    label: '主要产品',
+    model: 'comDemand_zycp',
+    list: '',
+    type: 'zycp',
+  },
+  {
+    label: '技术需求',
+    model: 'comDemand_jsxq',
+    list: '',
+    type: 'textarea',
+  },
+  {
+    label: '资金需求',
+    model: 'comDemand_zjxq',
+    list: '',
+    type: 'textarea',
+  },
+  {
+    label: '人才需求',
+    model: 'comDemand_rcxq',
+    list: '',
+    type: 'textarea',
+  },
+  {
+    label: '其他需求',
+    model: 'comDemand_qtxq',
+    list: '',
+    type: 'textarea',
+  },
+];

+ 146 - 0
src/views/twoweb/service/comDemand/parts/two.vue

@@ -0,0 +1,146 @@
+<template>
+  <div id="two">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-form :model="form" :rules="rules" ref="form" label-width="100px">
+          <template v-for="(i, index) in question">
+            <el-col :span="24" :key="`two${index}`">
+              <el-form-item v-if="i.type === 'radio'" :prop="`${index}`" :key="`two${index}`" :label="`${i.label}`">
+                <el-radio-group v-model="form[i.model]">
+                  <el-radio v-for="(item, index) in getList(i.list)" :key="index" :label="item"></el-radio>
+                </el-radio-group>
+              </el-form-item>
+              <el-form-item v-if="i.type === 'text'" :prop="`${index}`" :key="`two${index}`" :label="`${i.label}`">
+                <el-input v-model="form[i.model]"></el-input>
+              </el-form-item>
+              <el-form-item v-if="i.type === 'textarea'" :prop="`${index}`" :key="`two${index}`" :label="`${i.label}`">
+                <el-input v-model="form[i.model]" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" maxlength="1000" show-word-limit></el-input>
+              </el-form-item>
+              <el-form-item v-if="i.type === 'datePicker'" :prop="`${index}`" :key="`two${index}`" :label="`${i.label}`">
+                <el-date-picker v-model="form[i.model]" placeholder="请选择" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" style="width:100%">
+                </el-date-picker>
+              </el-form-item>
+              <el-form-item v-if="i.type === 'frdb'" :prop="`${index}`" :key="`two${index}`" :label="`${i.label}`" label-width="140px">
+                <el-col :span="12" v-for="(tag, index) in i.children" :key="index" class="frdb">
+                  <el-form-item :label="tag.label">
+                    <el-input v-model="form[tag.model]" style="width:100%;margin:0 0 10px 0;"></el-input>
+                  </el-form-item>
+                </el-col>
+              </el-form-item>
+              <el-form-item v-if="i.type === 'zycp'" :prop="`${index}`" :key="`two${index}`" :label="`${i.label}`">
+                <el-col :span="24" style="text-align:right;margin:0 0 10px 0;">
+                  <el-button type="primary" size="small" @click="toZycp()">添加</el-button>
+                </el-col>
+                <el-col :span="24">
+                  <el-table :data="form.comDemand_zycp" border style="width: 100%">
+                    <el-table-column prop="name" label="主要产品名称" align="center" show-overflow-tooltip> </el-table-column>
+                    <el-table-column prop="mix" label="占企业销售收入总额比例" align="center" show-overflow-tooltip> </el-table-column>
+                    <el-table-column label="操作" align="center">
+                      <template slot-scope="scope">
+                        <el-button size="mini" type="danger" @click="toDel(scope.$index, scope.row)">删除</el-button>
+                      </template>
+                    </el-table-column>
+                  </el-table>
+                </el-col>
+              </el-form-item>
+            </el-col>
+          </template>
+        </el-form>
+      </el-col>
+    </el-row>
+    <el-dialog :title="dialog.title" :visible.sync="dialog.show" :width="dialog.width" :before-close="toClose">
+      <el-form ref="form" :model="marketForm" label-width="80px">
+        <el-form-item label="产品名称">
+          <el-input v-model="marketForm.name" placeholder="请输入产品名称"></el-input>
+        </el-form-item>
+        <el-form-item label="总额占比">
+          <el-input v-model="marketForm.mix" placeholder="请输入总额占比"></el-input>
+        </el-form-item>
+        <el-form-item style="text-align:center">
+          <el-button type="primary" @click="marketSubmit">提交保存</el-button>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { two } from '../fields.js';
+import * as select from '../select.js';
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'two',
+  props: {
+    form: { type: Object },
+    rules: { type: Object },
+  },
+  model: {
+    prop: 'form',
+    event: 'change',
+  },
+  components: {},
+  data: function() {
+    return {
+      question: two,
+      marketForm: {},
+      // 弹框
+      dialog: { titla: '产品管理', show: false, width: '50%' },
+    };
+  },
+  created() {},
+  methods: {
+    // 获取列表
+    getList(type) {
+      return select[type];
+    },
+    toZycp() {
+      this.dialog = { titla: '产品管理', show: true, width: '30%' };
+    },
+    // 提交保存
+    marketSubmit() {
+      let data = this.marketForm;
+      this.form.comDemand_zycp.push(data);
+      this.toClose();
+    },
+    // 删除
+    toDel(index, data) {
+      this.form.comDemand_zycp.splice(index, 1);
+    },
+    // 关闭
+    toClose() {
+      this.marketForm = {};
+      this.dialog = { titla: '产品管理', show: false, width: '30%' };
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.sbzc {
+  /deep/.el-input {
+    float: left;
+    width: 20%;
+    margin: 0 10px 0 0px;
+  }
+}
+.rzbq {
+  /deep/.el-input {
+    float: left;
+    width: 10%;
+    margin: 0 10px 0 0px;
+  }
+}
+</style>

+ 2 - 0
src/views/twoweb/service/comDemand/select.js

@@ -0,0 +1,2 @@
+const comDemand_djlx = ['国有企业', '集体企业', '股份合作企业', '联营企业', '有限责任公司', '股份有限公司', '私营企业', '其他企业'];
+export { comDemand_djlx };

+ 18 - 6
src/views/twoweb/service/question/index.vue

@@ -70,19 +70,31 @@ export default {
     },
     // 答卷
     btn(data) {
+      console.log(data);
       if (data.column == '定制问卷') {
         if (data.title == '『科研助企』活动企业调查问卷') {
           this.$router.push({ path: '/twoweb/service/helpCompany/detail', query: { id: data.id } });
-        } else {
+        } else if (data.title == '企业科技创新能力评价调查问卷') {
           this.$router.push({ path: '/twoweb/service/made/detail', query: { id: data.id } });
+        } else if (data.title == '“院省合作”-企业需求调查表') {
+          this.$router.push({ path: '/twoweb/service/comDemand/detail', query: { id: data.id } });
         }
       } else {
-        if (data.title == '『科研助企』活动企业调查问卷') {
-          this.$router.push({ path: '/twoweb/service/helpCompany/detail', query: { id: data.id } });
-        } else {
-          this.$router.push({ path: '/twoweb/service/question/detail', query: { id: data.id } });
-        }
+        this.$router.push({ path: '/twoweb/service/question/detail', query: { id: data.id } });
       }
+      // if (data.column == '定制问卷') {
+      //   if (data.title == '『科研助企』活动企业调查问卷') {
+      //     this.$router.push({ path: '/twoweb/service/helpCompany/detail', query: { id: data.id } });
+      //   } else {
+      //     this.$router.push({ path: '/twoweb/service/made/detail', query: { id: data.id } });
+      //   }
+      // } else {
+      //   if (data.title == '『科研助企』活动企业调查问卷') {
+      //     this.$router.push({ path: '/twoweb/service/helpCompany/detail', query: { id: data.id } });
+      //   } else {
+      //
+      //   }
+      // }
     },
   },
   computed: {