<template>
  <div id="productForm">
    <el-row>
      <div class="w_1200">
        <el-tabs v-model="activeName">
          <el-tab-pane label="技术成果信息征集" name="first"></el-tab-pane>
          <el-tab-pane label="科技需求信息征集" name="second"></el-tab-pane>
        </el-tabs>
        <el-col :span="24">
          <el-col :span="24">
            <h3>企业信息</h3>
            <el-col :span="24">
              <span>企业名称：</span>
              <el-input v-model="form.company" placeholder="请输入企业名称"></el-input>
            </el-col>
            <el-col :span="24">
              <el-col :span="12">
                <span>注册类型:</span>
                <el-input v-model="form.type" placeholder="请输入注册类型"></el-input>
              </el-col>
              <el-col :span="12">
                <span>组织机构代码:</span>
                <el-input v-model="form.zzjgdm" placeholder="请输入组织机构代码"></el-input>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="12">
                <span>注册时间:</span>
                <el-input v-model="form.companydate" placeholder="请输入注册时间"></el-input>
              </el-col>
              <el-col :span="12">
                <span>注册资金:</span>
                <el-input v-model="form.companycapital" placeholder="请输入注册资金"></el-input>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="12">
                <span>企业法人:</span>
                <el-input v-model="form.companyperson" placeholder="请输入企业法人"></el-input>
              </el-col>
              <el-col :span="12">
                <span>企业网站:</span>
                <el-input v-model="form.companyweb" placeholder="请输入企业网站"></el-input>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="12">
                <span>上年度企业总收入:</span>
                <el-input v-model="form.sndqyzsr" placeholder="请输入上年度企业总收入"></el-input>
              </el-col>
              <el-col :span="12">
                <span>上年度研发费用:</span>
                <el-input v-model="form.sndyffy" placeholder="请输入上年度研发费用"></el-input>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="12">
                <span>企业总人数:</span>
                <el-input v-model="form.companytotal" placeholder="请输入企业总人数"></el-input>
              </el-col>
              <el-col :span="12">
                <span>专&兼职研发人数:</span>
                <el-input v-model="form.zjzyfrs" placeholder="请输入专&兼职研发人数"></el-input>
              </el-col>
            </el-col>
          </el-col>
          <el-col :span="24">
            <h3>技术需求</h3>
            <el-col :span="24">
              <span>技术难题名称：</span>
              <el-input v-model="form.name" placeholder="请输入技术难题名称"></el-input>
            </el-col>
            <el-col :span="24">
              <el-col :span="12">
                <span>需求紧急程度:</span>
                <el-input v-model="form.degreeurgency" placeholder="请输入需求紧急程度"></el-input>
              </el-col>
              <el-col :span="12">
                <span>所属领域:</span>
                <el-input v-model="form.field" placeholder="请输入所属领域"></el-input>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="12">
                <span>合作方式:</span>
                <el-input v-model="form.cooperation" placeholder="请输入合作方式"></el-input>
              </el-col>
              <el-col :span="12">
                <span>投资预算:</span>
                <el-input v-model="form.budget" placeholder="请输入投资预算"></el-input>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="12">
                <span>技术难题说明:</span>
                <el-input v-model="form.requirementdesc" placeholder="请输入技术难题说明"></el-input>
              </el-col>
              <el-col :span="12">
                <span>预期技术目标描述:</span>
                <el-input v-model="form.expect" placeholder="请输入预期技术目标描述"></el-input>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="12">
                <span>需求现状及应对措施:</span>
                <el-input v-model="form.present" placeholder="请输入需求现状及应对措施"></el-input>
              </el-col>
              <el-col :span="12">
                <span>合作条件及要求:</span>
                <el-input v-model="form.condition" placeholder="请输入合作条件及要求"></el-input>
              </el-col>
            </el-col>

            <el-button type="primary" @click="isenableBtn()">保存</el-button>
          </el-col>
        </el-col>
      </div>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: notice } = createNamespacedHelpers('notice');
export default {
  name: 'productForm',
  props: {},
  components: {},
  data: function() {
    return {
      activeName: 'second',
      form: {},
    };
  },
  created() {},
  methods: {
    async isenableBtn() {
      let arr = await this.query();
      let data = arr.data.filter(i => i.isenable == '1');
      if (data.length > 0 && this.noticeInfo.isenable == '1') {
        alert('已有信息启用');
      } else {
        console.log(this.noticeInfo);
        let res = await this.update(this.noticeInfo);
        if (this.$checkRes(res)) {
          this.$message({
            message: '添加信息成功',
            type: 'success',
          });
        }
        this.handleClose();
      }
      this.search();
    },
  },
  computed: {
    ...mapState(['user']),
    pageTitle() {
      return `${this.$route.meta.title}`;
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
};
</script>

<style lang="less" scoped>
.w_1200 {
  width: 80%;
  margin: 0 auto;
}
</style>
