<template>
  <div class="sign_box">
    <el-form label-position="right" ref="form" :rules="rules" :model="form" label-width="80px">
      <el-row :gutter="10" class="mb8 roiyy">
        <el-col :span="1.5" v-if="setrd % 2 == 1">
          <el-button type="primary" v-hasPermi="['system:config:add']" @click="upBtn">提交</el-button>
        </el-col>
        <el-col :span="1.5" v-if="setrd % 2 == 1">
          <el-button type="primary" v-hasPermi="['system:config:edit']" @click="submitForm">暂存</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button type="primary" v-hasPermi="['system:config:edit']" @click="goBtn">取消</el-button>
        </el-col>
        <el-col :span="1.5" :offset="18" v-if="setrd % 2 == 0">
          <el-button type="danger" @click="applyBtn" v-hasPermi="['bmProject:project:pass']">审核</el-button>
          <el-button type="danger" @click="backBtn" v-hasPermi="['bmProject:project:reject']">驳回</el-button>
        </el-col>
        <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
      </el-row>
      <div class="sign_tit">项目签约信息</div>
      <el-row>
        <el-form-item label-width="120px" label="签约日期:" class="elItem" prop="orderDate">
          <el-col :span="6">
            <el-date-picker value-format="yyyy-MM-dd" type="date" placeholder="请选择签约日期" v-model="form.orderDate" style="width: 100%"></el-date-picker>
          </el-col>
        </el-form-item>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="120px" label="投资方式:" class="elItem" prop="investmentType">
            <el-col :span="24">
              <el-radio-group v-model="form.investmentType" style="width: 100%">
                <el-col :span="12">
                  <el-radio label="1">独资</el-radio>
                </el-col>
                <el-col :span="12">
                  <el-radio label="2">合资</el-radio>
                </el-col>
              </el-radio-group>
            </el-col>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="是否外资:" class="elItem" prop="isOutInvestment">
            <el-col :span="6">
              <el-checkbox-group v-model="form.isOutInvestment">
                <el-checkbox :label="1" name="type">外资</el-checkbox>
              </el-checkbox-group>
            </el-col>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="7">
          <el-form-item label-width="120px" label="总投资额度:" class="elItem" prop="totInvestment">
            <el-col :span="18">
              <el-input type="number" placeholder="请输入总投资额度" v-model="form.totInvestment"></el-input>
            </el-col>
            <div class="dw_name">万元</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="1">
          <div class="qz_name">其中</div>
        </el-col>
        <el-col :span="10">
          <el-form-item label-width="182px" label="境外投资(含港澳台投资):" class="elItem" prop="overseasInvestment">
            <el-col :span="18">
              <el-input type="number" placeholder="请输入总投资额度" v-model="form.overseasInvestment"></el-input>
            </el-col>
            <div class="dw_name">万元</div>
          </el-form-item>
          <el-form-item label-width="182px" label="境内省外投资:" class="elItem" prop="jnswInvestm">
            <el-col :span="18">
              <el-input type="number" placeholder="请输入境内省外投资额度" v-model="form.jnswInvestm"></el-input>
            </el-col>
            <div class="dw_name">万元</div>
          </el-form-item>
          <el-form-item label-width="182px" label="省内市外投资:" class="elItem" prop="snswInvestm">
            <el-col :span="18">
              <el-input type="number" placeholder="请输入省内市外投资额度" v-model="form.snswInvestm"></el-input>
            </el-col>
            <div class="dw_name">万元</div>
          </el-form-item>
          <el-form-item label-width="182px" label="市内县外投资:" class="elItem" prop="snxwInvestm">
            <el-col :span="18">
              <el-input type="number" placeholder="请输入市内县外投资额度" v-model="form.snxwInvestm"></el-input>
            </el-col>
            <div class="dw_name">万元</div>
          </el-form-item>
          <el-form-item label-width="182px" label="县内投资:" class="elItem" prop="xnInvestm">
            <el-col :span="18">
              <el-input type="number" placeholder="请输入县内投资额度" v-model="form.xnInvestm"></el-input>
            </el-col>
            <div class="dw_name">万元</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="5">
          <el-form-item label-width="121px" label="是否独立供地:" class="elItem" prop="isIndependentLan">
            <el-select v-model="form.isIndependentLan" placeholder="请选择">
              <el-option label="是" value="Y"></el-option>
              <el-option label="否" value="N"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="93px" label="供地面积:" class="elItem" prop="landArea">
            <el-col :span="20">
              <el-input placeholder="请输入供地面积" v-model="form.landArea"></el-input>
            </el-col>
            <div class="dw_name">亩</div>
          </el-form-item>
        </el-col>
        <el-col :span="9">
          <el-form-item label-width="93px" label="供地位置:" class="elItem" prop="landAddress">
            <el-input placeholder="请输入供地位置" v-model="form.landAddress"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label-width="82px" label="土地证:" class="elItem" prop="landPhoto">
            <el-upload class="upload-demo" list-type="picture" :limit="1" :file-list="fileListTdz" :on-success="upl_fn" :action="defaultSettings.urls + '/prod-api/common/upload'">
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="121px" label="流转土地面积:" class="elItem" prop="circulationLand">
            <el-col :span="18">
              <el-input placeholder="请输入" v-model="form.circulationLand"></el-input>
            </el-col>
            <div class="dw_name">亩</div>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label-width="111px" label="流转土地位置:" class="elItem" prop="circulationAddres">
            <el-input placeholder="请输入流转土地位置" v-model="form.circulationAddres"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label-width="119px" label="土地流转合同:" class="elItem" prop="circulationDoc">
            <el-upload class="upload-demo" :file-list="fileListTdls" :limit="1" :on-success="upl_fn_lzht" :action="defaultSettings.urls + '/prod-api/common/upload'">
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label-width="94px" label="产权证:" class="elItem" prop="circulationPhoto">
            <el-upload class="upload-demo" :limit="1" :file-list="fileListCqz" :on-success="upl_fn_cqz" :action="defaultSettings.urls + '/prod-api/common/upload'">
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="7">
          <el-form-item label-width="121px" label="租赁厂房面积:" class="elItem" prop="leasePlantArea">
            <el-col :span="16">
              <el-input placeholder="请输入" v-model="form.leasePlantArea"></el-input>
            </el-col>
            <div class="dw_name">平方米</div>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label-width="111px" label="租赁厂房位置:" class="elItem" prop="leasePlantAddress">
            <el-input placeholder="请输入租赁厂房位置" v-model="form.leasePlantAddress"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label-width="94px" label="租赁合同:" class="elItem" prop="leasePlantDoc">
            <el-upload class="upload-demo" :limit="1" :file-list="fileListZht" :on-success="upl_fn_zlht" :action="defaultSettings.urls + '/prod-api/common/upload'">
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label-width="94px" label="产权证:" class="elItem" prop="leasePlantPhoto">
            <el-upload class="upload-demo" :limit="1" :file-list="fileListZcq" :on-success="upl_fn_zlcqz" :action="defaultSettings.urls + '/prod-api/common/upload'">
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label-width="121px" label="合同约定产值:" class="elItem" prop="agreementTot">
            <el-col :span="18">
              <el-input placeholder="请输入" v-model="form.agreementTot"></el-input>
            </el-col>
            <div class="dw_name">万元</div>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label-width="121px" label="合同约定税收:" class="elItem" prop="agreementTax">
            <el-col :span="18">
              <el-input placeholder="请输入" v-model="form.agreementTax"></el-input>
            </el-col>
            <div class="dw_name">万元</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row style="margin-left: -10px">
        <el-col :span="8">
          <el-form-item label-width="141px" label="合同约定开工时间:" class="elItem" prop="agreementStartdate">
            <el-col :span="18">
              <el-date-picker value-format="yyyy-MM-dd" type="date" placeholder="请选择开工时间" v-model="form.agreementStartdate"
                style="width: 100%"></el-date-picker>
            </el-col>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label-width="141px" label="合同约定竣工时间:" class="elItem" prop="agreementEnddate">
            <el-col :span="18">
              <el-date-picker value-format="yyyy-MM-dd" type="date" placeholder="请选择竣工时间" v-model="form.agreementEnddate"
                style="width: 100%"></el-date-picker>
            </el-col>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-form-item label-width="121px" label="合同签约方:" class="elItem" prop="je">
        </el-form-item>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="121px" label="对方:" class="elItem" prop="agreementPartner">
            <el-input placeholder="请输入对方" v-model="form.agreementPartner"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="121px" label="签约人:" class="elItem" prop="partner">
            <el-input placeholder="请输入签约人" v-model="form.partner"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="121px" label="我方:" class="elItem" prop="agreementUs">
            <el-input placeholder="请输入我方" v-model="form.agreementUs"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="121px" label="签约人:" class="elItem" prop="signUs">
            <el-input placeholder="请输入签约人" v-model="form.signUs"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="121px" label="第三方:" class="elItem" prop="agreementThird">
            <el-input placeholder="请输入第三方" v-model="form.agreementThird"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="121px" label="签约人:" class="elItem" prop="third">
            <el-input placeholder="请输入签约人" v-model="form.third"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="18">
          <el-form-item label-width="121px" label="合同文本:" class="elItem" prop="agreementUrl">
            <el-upload class="upload-demo" ref="upload" :file-list="flieListHt" :action="defaultSettings.urls + '/prod-api/common/upload'" :on-preview="handlePreview"
              :on-success="up_loat_htwb" :on-remove="handleRemove" :auto-upload="false">
              <el-button slot="trigger" size="small" type="primary">选择图片</el-button>
              <el-button style="margin-left: 10px" size="small" type="success" @click="submitUpload">开始上传</el-button>
              <div slot="tip" class="el-upload__tip">
                只能上传jpg/png文件，且不超过500kb
              </div>
            </el-upload>
          </el-form-item>
        </el-col>
      </el-row>
      <div class="sign_tit">企业注册信息</div>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="141px" label="在潜注册公司名称:" class="elItem" prop="name">
            <el-input placeholder="请输入在潜注册公司名称" v-model="form.name"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="109px" label="法定代表人:" class="elItem" prop="legalRep">
            <el-input placeholder="请输入法定代表人" v-model="form.legalRep"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="141px" label="注册资本金:" class="elItem" prop="totMoney">
            <el-input placeholder="请输入注册资本金" v-model="form.totMoney"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label-width="109px" label="注册地址:" class="elItem" prop="address">
            <el-input placeholder="请输入注册地址" v-model="form.address"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="141px" label="统一社会信用代码:" class="elItem" prop="code">
            <el-input placeholder="请输入注册资本金" v-model="form.code"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label-width="173px" label="营业执照复印件:" class="elItem" prop="bussinessUrl">
            <el-upload class="upload-demo" :limit="1" :file-list="flieListYzz" :on-success="upl_fn_zzfyj" :action="defaultSettings.urls + '/prod-api/common/upload'">
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
          </el-form-item>
        </el-col>
      </el-row>
      <div class="sign_tit">企业股东构成<span>*</span></div>
      <el-row>
        <div class="ads_box" @click="addshareBtn">
          <img src="../../assets/images/icon_add@2x.png" alt="" class="add_icon" />
          <span>添加企业股东构成</span>
        </div>
      </el-row>
      <el-row>
        <el-table v-loading="loading" class="elItem" :data="shareholderList">
          <!-- <el-table-column type="selection" width="55" align="center" /> -->
          <el-table-column label="姓名" align="center" prop="name" />
          <el-table-column label="股权比例" align="center" prop="equityRatio" :show-overflow-tooltip="true">
            <template slot-scope="scope">
              <span>{{ scope.row.equityRatio }}%</span>
            </template>
          </el-table-column>
          <el-table-column label="身份证号码" align="center" prop="idcard" :show-overflow-tooltip="true" />
          <el-table-column label="身份证(正面)" align="center" prop="idcardFront">
            <template slot-scope="scope">
              <img :src="scope.row.idcardFront" alt="" class="imgs" />
            </template>
          </el-table-column>
          <el-table-column label="身份证(反面)" align="center" prop="idcardBack">
            <template slot-scope="scope">
              <img :src="scope.row.idcardBack" alt="" class="imgs" />
            </template>
          </el-table-column>
          <!-- <el-table-column label="操作" align="center" prop="remark" :show-overflow-tooltip="true" /> -->
          <el-table-column label="操作" align="center">
            <!-- class-name="small-padding fixed-width" -->
            <template slot-scope="scope">
              <el-button size="mini" type="warning" @click="handleUpdate(scope.row)" v-hasPermi="['system:config:edit']">修改</el-button>
              <el-button size="mini" type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['system:config:remove']">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
          @pagination="getShareholderList" />
      </el-row>
      <div class="sign_tit">企业备案信息</div>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="121px" label="备案单位:" class="elItem" prop="recordName">
            <el-input placeholder="请输入备案单位" v-model="form.recordName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="109px" label="备案文号:" class="elItem" prop="recordCode">
            <el-input placeholder="请输入备案文号" v-model="form.recordCode"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label-width="121px" label="备案总投资额:" class="elItem" prop="recordTot">
            <el-col :span="18">
              <el-input placeholder="请输入备案总投资额" v-model="form.recordTot"></el-input>
            </el-col>
            <div class="dw_name">万元</div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="139px" label="备案建设周期:" class="elItem" prop="recordTime">
            <el-input placeholder="请输入备案建设周期" v-model="form.recordTime"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="18">
          <el-form-item label-width="121px" label="备案表:" class="elItem" prop="recordUrl">
            <el-upload class="upload-demo" ref="bAupload" :file-list="flieListBa" :action="defaultSettings.urls + '/prod-api/common/upload'" :on-preview="handlePreview"
              :on-success="up_loat_bab" :on-remove="handleRemove_bab" :auto-upload="false">
              <el-button slot="trigger" size="small" type="primary">选择图片</el-button>
              <el-button style="margin-left: 10px" size="small" type="success" @click="submitUpload_bab">开始上传</el-button>
              <div slot="tip" class="el-upload__tip">
                只能上传jpg/png文件，且不超过500kb
              </div>
            </el-upload>
          </el-form-item>
        </el-col>
      </el-row>
      <div class="sign_tit">企业包保服务</div>
      <el-row>
        <el-col :span="8">
          <el-form-item label-width="122px" label="联系领导:" class="elItem" prop="contactLeader">
            <el-input placeholder="请输入联系领导" v-model="form.contactLeader"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="98px" label="联系方式:" class="elItem" prop="contactPhone">
            <el-input placeholder="请输入联系方式" v-model="form.contactPhone"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label-width="122px" label="责任单位:" class="elItem" prop="contactCompany">
            <el-input placeholder="请输入责任单位" v-model="form.contactCompany"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="98px" label="责任人:" class="elItem" prop="contactPerson">
            <el-input placeholder="请输入责任人" v-model="form.contactPerson"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label-width="98px" label="联系方式:" class="elItem" prop="contactPersonPhone">
            <el-input placeholder="请输入联系方式" v-model="form.contactPersonPhone"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <!-- 添加或修改岗位对话框 -->
    <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="forms" :model="sharData" :rules="sharRules" label-width="120px">
        <el-form-item label="姓名" prop="name">
          <el-input v-model="sharData.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="股权比例" prop="equityRatio">
          <el-input-number :min="0" :max="100" style="width: 140px" v-model="sharData.equityRatio" /><span style="margin: 0 10px; font-size: 16px">%</span>
        </el-form-item>
        <el-form-item label="身份证号码" prop="idcard">
          <el-input v-model="sharData.idcard" placeholder="请输入身份证号码" />
        </el-form-item>
        <el-form-item label="身份证(正面)" prop="idcardFront">
          <el-upload class="upload-demo" :file-list="idcardFrontFlie" :on-remove="upl_remove_sfzzm" :on-success="upl_fn_sfzzm"
            :action="defaultSettings.urls + '/prod-api/common/upload'">
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        <el-form-item label="身份证(反面)" prop="idcardBack">
          <el-upload class="upload-demo" :file-list="idcardBackFlie" :on-remove="upl_remove_sfzfm" :on-success="upl_fn_sfzfm"
            :action="defaultSettings.urls + '/prod-api/common/upload'">
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForms">确 定</el-button>
        <el-button @click="open = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {
    getOrderinfo,
    getShareholderList,
    getShareholder,
    delShareholder,
    addShareholder,
    setShareholder,
    setOrderinfo,
    addOrderinfo,
    getExamine,
  } from "@/api/system/signContract";
  import {
    setExamine,
    setReject
  } from "@/api/projectInfo/info.js";
  const defaultSettings = require("@/settings.js");
  export default {
    data() {
      return {
        fileListZcq: [],
        fileListZht: [],
        fileListCqz: [],
        fileListTdls: [],
        fileListTdz: [],

        flieListHt: [],
        flieListYzz: [],
        flieListBa: [],
        defaultSettings,
        title: "",
        // 是否显示弹出层
        open: false,
        configList: [],
        setrd: 0,
        sharRules: {
          name: [{
            required: true,
            message: "请输入姓名",
            trigger: "blur",
          }, ],
          equityRatio: [{
            required: true,
            message: "请输入股权比例",
            trigger: "blur",
          }, ],
          idcard: [{
            required: true,
            message: "请输入身份证号",
            trigger: "blur",
          }, {
          pattern:  /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/,
          message: '身份证格式错误',
          trigger: 'blur'
        }],
          idcardFront: [{
            required: true,
            message: "请上传身份证正面",
            trigger: "blur",
          }],
          idcardBack: [{
            required: true,
            message: "请上传身份证反面",
            trigger: "blur",
          }, ],
        },
        sharData: {
          bmProjectId: this.$route.query.setid,
          name: "",
          equityRatio: 0,
          idcard: "",
          idcardFront: "",
          idcardBack: "",
        },
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          bmProjectId: "",
        },
        total: 0,
        shareholderList: [],
        // showSearch: true,
        loading: true,
        rules: {
          orderDate: [{
            required: true,
            message: "请选择签约日期",
            trigger: "blur",
          }, ],
          investmentType: [{
            required: true,
            message: "请选择投资方式",
            trigger: "blur",
          }, ],
          totInvestment: [{
            required: true,
            message: "请输入总投资额度",
            trigger: "blur",
          }, ],
          overseasInvestment: [{
            required: true,
            message: "请输入境外投资",
            trigger: "blur",
          }, ],
          isIndependentLan: [{
            required: true,
            message: "请选择是否独立供地",
            trigger: "blur",
          }, ],
          agreementTot: [{
            required: true,
            message: "请输入合同约定产值",
            trigger: "blur",
          }, ],
          agreementTax: [{
            required: true,
            message: "请输入合同约定税收",
            trigger: "blur",
          }, ],
          agreementStartdate: [{
            required: true,
            message: "请选择合同约定开工时间",
            trigger: "blur",
          }, ],
          agreementEnddate: [{
            required: true,
            message: "请选择合同约定竣工时间",
            trigger: "blur",
          }, ],
          agreementPartner: [{
            required: true,
            message: "请输入合同签约对方",
            trigger: "blur",
          }, ],
          partner: [{
            required: true,
            message: "请输入对方合同签约人",
            trigger: "blur",
          }, ],
          agreementUs: [{
            required: true,
            message: "请输入合同签约我方",
            trigger: "blur",
          }, ],
          signUs: [{
            required: true,
            message: "请输入我方合同签约人",
            trigger: "blur",
          }, ],
          agreementUrl: [{
            required: true,
            message: "请上传合同文本",
            trigger: "blur",
          }, ],
          name: [{
            required: true,
            message: "请输入在潜注册公司名称",
            trigger: "blur",
          }, ],
          legalRep: [{
            required: true,
            message: "请输入法定代表人",
            trigger: "blur",
          }, ],
          totMoney: [{
            required: true,
            message: "请输入注册资本金",
            trigger: "blur",
          }, ],
          address: [{
            required: true,
            message: "请输入注册地址",
            trigger: "blur",
          }, ],
          code: [{
            required: true,
            message: "请输入统一社会信用代码",
            trigger: "blur",
          }, ],
          bussinessUrl: [{
            required: true,
            message: "请上传营业执照",
            trigger: "blur",
          }, ],
          recordName: [{
            required: true,
            message: "请输入备案单位",
            trigger: "blur",
          }, ],
          recordCode: [{
            required: true,
            message: "请输入备案文号",
            trigger: "blur",
          }, ],
          recordTot: [{
            required: true,
            message: "请输入备案总投资额",
            trigger: "blur",
          }, ],
          recordTime: [{
            required: true,
            message: "请输入备案建设周期",
            trigger: "blur",
          }, ],
          recordUrl: [{
            required: true,
            message: "请上传备案表信息",
            trigger: "blur",
          }, ],
          contactLeader: [{
            required: true,
            message: "请输入联系领导",
            trigger: "blur",
          }, ],
          contactPhone: [{
            required: true,
            message: "请输入联系方式",
            trigger: "blur",
          }, ],
          contactCompany: [{
            required: true,
            message: "请输入责任单位",
            trigger: "blur",
          }, ],
          contactPerson: [{
            required: true,
            message: "请输入责任人",
            trigger: "blur",
          }, ],
          contactPersonPhone: [{
            required: true,
            message: "请输入责任人联系方式",
            trigger: "blur",
          }, ],
        },
        form: {
          bmProjectId: this.$route.query.setid,
          id: -1,
          orderDate: "", //签约日期
          investmentType: "", //投资方式
          isOutInvestment: "", // 是否外资(N:Y)
          totInvestment: "", //总投资额度
          fixedAssets: "", //固定资产投资额度
          overseasInvestment: "", //境外投资
          jnswInvestm: "", //境内省外投资
          snswInvestm: "", //省内市外投资
          snxwInvestm: "", //市内县外投资
          xnInvestm: "", //县内投资
          isIndependentLan: "", //是否独立供地(N:Y)
          landArea: "", //供地面积
          landAddress: "", //供地位置
          landPhoto: "", //土地证ur
          circulationLand: "", //流转土地面积
          circulationAddres: "", //流转土地位置
          circulationDoc: "", //土地流转合同
          circulationPhoto: "", //产权证
          leasePlantArea: "", //租赁厂房面积
          leasePlantAddress: "", //租赁厂房位置
          leasePlantDoc: "", //租赁合同
          leasePlantPhoto: "", //租赁产权证
          agreementTot: "", //租赁产权证
          agreementTax: "", // 合同约定税收
          agreementStartdate: "", // 合同约定开工时间
          agreementEnddate: "", //合同约定竣工时间
          agreementPartner: "", //合同签约对方
          partner: "", //对方合同签约人
          agreementUs: "", //合同签约我方
          signUs: "", //我方合同签约人
          agreementThird: "", //第三方
          third: "", //第三方签约人
          agreementUrl: [], //合同url
          name: "", //在潜注册公司名称
          legalRep: "", //法定代表人
          totMoney: "", //注册资本金
          address: "", //注册地址
          code: "", //统一社会信用代码
          bussinessUrl: "", //营业执照图片url
          recordName: "", //备案单位
          recordCode: "", //备案文号
          recordTot: "", //备案总投资额
          recordTime: "", //备案建设周期
          recordUrl: [], //备案表url
          contactLeader: "", //企业包服务-联系领导
          contactPhone: "", //联系方式
          contactCompany: "", //责任单位
          contactPerson: "", //责任人
          contactPersonPhone: "", //责任人联系方式
        },
        idcardFrontFlie: [],
        idcardBackFlie: [],
        fileList: [],
      };
    },
    mounted() {
      this.queryParams.bmProjectId = this.$route.query.setid;
      this.setrd = this.$route.query.setrd;
      this.getOrderinfo();
      this.getShareholderList();
    },
    methods: {
      //审核
      applyBtn() {
        var that = this
        this.$confirm("是否确认审核", "提醒", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
          .then(function() {
            return setExamine({
              code: 3,
              bmProjectId: that.queryParams.bmProjectId,
            });
          })
          .then(() => {
            this.msgSuccess("审核成功");
            setTimeout(res => {
              this.$router.go(-1)
            }, 1000)
          });
      },
      //驳回
      backBtn() {
        var that = this
        this.$confirm("是否确认驳回", "提醒", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
          .then(function() {
            return setReject({
              code: 2,
              bmProjectId: that.queryParams.bmProjectId,
            });
          })
          .then(() => {
            this.msgSuccess("驳回成功");
            setTimeout(res => {
              this.$router.go(-1)
            }, 1000)
          });
      },
      upBtn() {
        var that = this
        this.$refs["form"].validate((valid) => {
          if (valid) {
            let  zNum =  (this.form.overseasInvestment-0)+ (this.form.jnswInvestm-0)+ (this.form.snswInvestm-0)+ (this.form.snxwInvestm-0)+ (this.form.xnInvestm-0)
            console.log(this.form.totInvestment,zNum)
            if (this.form.totInvestment != zNum) {
              this.msgError("请重新填写总投资额,总投资额度与其他投资数总和不等");
              return;
            }
            if (this.total == 0) {
              this.msgError("企业股东不能为空，请上传企业股东");
              return;
            }
            let data = JSON.parse(JSON.stringify(this.form));
            data.isOutInvestment = Number(data.isOutInvestment)
            data.agreementUrl = data.agreementUrl.join(",");
            data.recordUrl = data.recordUrl.join(",");
            if (this.form.id) {
              // 修改
              setOrderinfo(JSON.stringify(data)).then((res) => {
                this.$confirm("是否确认提交?", "提醒", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                  })
                  .then(function() {
                    return getExamine({
                      code: 1,
                      bmProjectId: that.$route.query.setid,
                    })
                  })
                  .then(() => {
                    this.msgSuccess("提交成功");
                    setTimeout(res => {
                      this.$router.go(-1)
                    }, 1000)

                  });

              });
            } else {
              // 新增
              addOrderinfo(JSON.stringify(data)).then((res) => {
                this.$confirm("是否确认提交?", "提醒", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                  })
                  .then(function() {
                    return getExamine({
                      code: 1,
                      bmProjectId: that.$route.query.setid,
                    })
                  })
                  .then(() => {
                    this.msgSuccess("提交成功");
                    setTimeout(res => {
                      this.$router.go(-1)
                    }, 1000)
                  });
              });
            }
          }
        });


      },
      goBtn() {
        this.$router.go(-1);
      },
      addshareBtn() {
        this.reset();
        this.title = "添加企业股东";
        this.open = true;
      },
      // 表单重置
      reset() {
        this.sharData = {
          bmProjectId: this.$route.query.setid,
          name: "",
          equityRatio: 0,
          idcard: "",
          idcardFront: "",
          idcardBack: "",
        };
        this.idcardFrontFlie = [];
        this.idcardBackFlie = [];
        this.resetForm("forms");
      },
      upl_fn(res, file) {
        this.form.landPhoto = res.url;
      },
      upl_fn_lzht(res, file) {
        this.form.circulationDoc = res.url;
      },
      upl_fn_cqz(res, file) {
        this.form.circulationPhoto = res.url;
      },
      upl_fn_zlht(res, file) {
        this.form.leasePlantDoc = res.url;
      },
      upl_fn_zlcqz(res, file) {
        this.form.leasePlantPhoto = res.url;
      },
      up_loat_htwb(res, file) {
        this.form.agreementUrl.push(res.url);
      },
      up_loat_bab(res, file) {
        this.form.recordUrl.push(res.url);
      },
      upl_fn_zzfyj(res, file) {
        this.form.bussinessUrl = res.url;
      },
      upl_fn_sfzzm(res, file) {
        this.idcardFrontFlie = [];
        this.idcardFrontFlie = [{
          name: res.url,
          url: res.url,
        }, ];
        this.sharData.idcardFront = res.url;
      },
      upl_remove_sfzzm() {
        this.idcardFrontFlie = [];
        this.sharData.idcardFront = "";
      },
      upl_remove_sfzfm() {
        this.idcardBackFlie = [];
        this.sharData.idcardBack = "";
      },
      upl_fn_sfzfm(res, file) {
        this.idcardBackFlie = [];
        this.idcardBackFlie = [{
          name: res.url,
          url: res.url,
        }, ];
        this.sharData.idcardBack = res.url;
      },
      getShareholderList() {
        getShareholderList(this.queryParams).then((res) => {
          this.shareholderList = res.rows;
          this.total = res.total;
          this.loading = false;
        });
      },
      submitForms() {
        this.$refs["forms"].validate((valid) => {
          if (valid) {
            if (this.sharData.id) {
              setShareholder(this.sharData).then((res) => {
                this.open = false;
                this.msgSuccess("修改成功");
                this.getShareholderList();
              });
            } else {
              addShareholder(this.sharData).then((res) => {
                this.open = false;
                this.msgSuccess("新增成功");
                this.getShareholderList();
              });
            }
          }
        });
      },
      submitForm() {
        this.$refs["form"].validate((valid) => {
          if (valid) {
            let  zNum =  (this.form.overseasInvestment-0)+ (this.form.jnswInvestm-0)+ (this.form.snswInvestm-0)+ (this.form.snxwInvestm-0)+ (this.form.xnInvestm-0)
            console.log(this.form.totInvestment,zNum)
            if (this.form.totInvestment != zNum) {
              this.msgError("请重新填写总投资额,总投资额度与其他投资数总和不等");
              return;
            }
            if (this.total == 0) {
              this.msgError("企业股东不能为空，请上传企业股东");
              return;
            }
            let data = JSON.parse(JSON.stringify(this.form));
            data.isOutInvestment = Number(data.isOutInvestment)
            data.agreementUrl = data.agreementUrl.join(",");
            data.recordUrl = data.recordUrl.join(",");
            if (this.form.id!=-1) {
              // 修改
              setOrderinfo(JSON.stringify(data)).then((res) => {
                this.msgSuccess("修改成功");
                this.$router.push({
                  path: "/management/info/index",
                });
              });
            } else {
              // 新增
              addOrderinfo(JSON.stringify(data)).then((res) => {
                this.msgSuccess("缓存成功");
                this.$router.push({
                  path: "/management/info/index",
                });
              });
            }
          }
        });
      },
      getOrderinfo() {
        getOrderinfo(this.queryParams.bmProjectId).then((res) => {
          console.log(res);
          if (res.data) {
            let data = res.data
            let arr = []
            for(let item of data.agreementUrl.split(',')){
              arr.push({
                name: item,
                url: item,
              })
            }
            this.flieListHt = arr

            let arrs = []
            for(let item of data.recordUrl.split(',')){
              arrs.push({
                name: item,
                url: item,
              })
            }
            this.flieListBa = arrs

            this.flieListYzz = [{
              name: data.bussinessUrl,
              url: data.bussinessUrl,
            }]
            this.fileListZcq = [{
              name: data.leasePlantPhoto,
              url: data.leasePlantPhoto,
            }]
            this.fileListZht = [{
              name: data.leasePlantDoc,
              url: data.leasePlantDoc,
            }]
            this.fileListCqz = [{
              name: data.circulationPhoto,
              url: data.circulationPhoto,
            }]
            this.fileListTdls = [{
              name: data.circulationDoc,
              url: data.circulationDoc,
            }]
            this.fileListTdz = [{
              name: data.landPhoto,
              url: data.landPhoto,
            }]
            
            data.isOutInvestment = Boolean(data.isOutInvestment - 0)
            data.agreementUrl = data.agreementUrl.split(',')
            data.recordUrl = data.recordUrl.split(',')
            this.form = data;
          }
        });
      },
      submitUpload_bab() {
        this.$refs.bAupload.submit();
      },
      submitUpload() {
        this.$refs.upload.submit();
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        const id = row.id || this.ids;
        getShareholder(id).then((response) => {
          this.sharData = response.data;
          this.idcardFrontFlie = [{
            name: response.data.idcardBack,
            url: response.data.idcardBack,
          }, ];
          this.idcardBackFlie = [{
            name: response.data.idcardFront,
            url: response.data.idcardFront,
          }, ];
          this.open = true;
          this.title = "修改股东信息";
        });
      },
      /** 删除按钮操作 */
      handleDelete(id) {
        this.$confirm("是否确认删除该股东", "警告", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
          .then(function() {
            return delShareholder(id);
          })
          .then(() => {
            this.getShareholderList();
            this.msgSuccess("删除成功");
          });
      },
      handleRemove(file, fileList) {
        for (let i = this.form.agreementUrl.length - 1; i >= 0; i--) {
          if (this.form.agreementUrl[i] == file.response.url) {
            this.form.agreementUrl.splice(i, 1);
          }
        }
      },
      handleRemove_bab(file, fileList) {
        for (let i = this.form.recordUrl.length - 1; i >= 0; i--) {
          if (this.form.recordUrl[i] == file.response.url) {
            this.form.recordUrl.splice(i, 1);
          }
        }
      },
      handlePreview(file) {
        console.log(file, 22);
      },
    },
  };
</script>

<style lang="scss" scoped>
  .imgs {
    width: 100px;
    height: 100px;
    object-fit: cover;
  }

  .roiyy {

    position: fixed;
    top: 95px;
    left: 0;
    width: 100%;
    padding-left: 230px;
    padding-right: 30px;
    box-sizing: border-box;
    z-index: 999;
  }

  .ads_box {
    margin: 18px 0;
    font-size: 14px;
    color: #666;
    width: 140px;
    display: flex;
    align-items: center;
    cursor: pointer;

    .add_icon {
      margin-right: 6px;
      width: 15px;
      height: 15px;
    }
  }

  .sign_box {
    padding: 26px 23px;

    .sign_tit {
      font-size: 14px;
      border-left: 3px solid #1c84c6;
      padding: 5px 0 5px 13px;
      color: #343434;
      line-height: 1;
      margin: 8px 0;
      font-weight: bold;

      span {
        color: #df0024;
        margin-left: 10px;
      }
    }

    .elItem {
      margin: 15px 0;
    }
  }

  .qz_name {
    font-size: 14px;
    color: #606266;
    display: inline-block;
    margin: 15px 0 15px;
    font-weight: bold;
    text-align: right;
    line-height: 36px;
    width: 100%;
  }
</style>
