<template>
  <div class="app-conta">
    <el-row :gutter="10" class="mb8 roiyy">
      <el-col :span="1.5" v-if="setrd % 2 == 1">
        <el-button
          type="primary"
          @click="submitCtion"
          v-hasPermi="['bmProject:projec:examine']"
          >提交</el-button
        >
      </el-col>
      <el-col :span="1.5" v-if="setrd % 2 == 1">
        <el-button
          type="primary"
          @click="emporary"
          v-hasPermi="['projectInfo:info:add']"
          >暂存</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          @click="cancelqiu"
          v-hasPermi="['system:config:edit']"
          >取消</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>
    </el-row>
    <!-- 内容的显示隐藏 -->
    <div class="mation">
      <div class="nvestor">
        <p>投资方 <i>*</i></p>
      </div>
      <p class="enterprise">企业</p>
      <p class="enterprise_tw" @click="handleAdd">
        <i class="el-icon-circle-plus-outline"></i>添加企业
      </p>
      <el-table v-loading="loading" :data="configList">
        <!-- <el-table-column type="selection" width="55" align="center" /> -->
        <el-table-column label="企业名称" align="center" prop="companyName" />
        <el-table-column
          label="企业所在地"
          align="center"
          prop="companyAddress"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="法人代表姓名"
          align="center"
          prop="companyLegal"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="统一社会信用代码"
          align="center"
          prop="companyCode"
        />
        <el-table-column label="联系方式" align="center" prop="phone" />
        <!-- <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)"
              v-hasPermi="['system:config:remove']"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <p class="enterprise">自然人</p>
      <p class="enterprise_tw" @click="handleAddtwo">
        <i class="el-icon-circle-plus-outline"></i>添加自然人
      </p>
      <el-table v-loading="loading" :data="configListtwoL">
        <!-- <el-table-column type="selection" width="55" align="center" /> -->
        <el-table-column label="姓名" align="center" prop="name" />
        <el-table-column
          label="自然人所在地"
          align="center"
          prop="address"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="身份证号码"
          align="center"
          prop="idcode"
          :show-overflow-tooltip="true"
        />
        <el-table-column label="联系方式" align="center" prop="phone" />
        <!-- <el-table-column label="联系方式" align="center" prop="configType" :formatter="typeFormat" /> -->
        <!-- <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="handleUpdatetwo(scope.row)"
              v-hasPermi="['system:config:edit']"
              >修改</el-button
            >
            <el-button
              size="mini"
              type="danger"
              @click="handleDeletetwo(scope.row)"
              v-hasPermi="['system:config:remove']"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-form
        :model="queryParams"
        :rules="queryForm"
        ref="queryParams"
        :inline="true"
        v-show="showSearch"
        label-width="115px"
        label-position="center"
        class="manager_form"
      >
        <!-- <el-form ref="queryForm" :model="queryParams" :rules="queryForm" label-width="115px" label-position="center" class="manager_form"> -->
        <el-form-item label="投资方联系人" prop="contactor">
          <el-input
            v-model="queryParams.contactor"
            placeholder="请输入投资方联系人"
            clearable
            :disabled = "disfal"
            size="small"
            style="width: 223px"
          />
        </el-form-item>
        <el-form-item label="投资方联系方式:" prop="phone" class="weiru">
          <el-input
            v-model.number="queryParams.phone"
            placeholder="请输入联系方式"
            :disabled = "disfal"
            clearable
            size="small"
            style="width: 233px"
          />
        </el-form-item>
        <div class="nvestor">
          <p>引荐方 <i>*</i></p>
        </div>

        <!-- <div v-if="queryParams.referralList == null" > -->
          <el-form-item label="引荐单位:" prop="sysDeptId"  style="width: 24%;">
            <el-cascader
               v-model="queryParams.referralList[0].sysDeptId"
               :show-all-levels="false"
               :disabled = "disfal"
               :options="typeOptionstwo"
               @change="handleChange"
               style="width: 128px"
                ></el-cascader>
          </el-form-item>
          <el-form-item label="投资分配额:"  style="width: 18%;" class="fenpe" prop="investmentAllcocation">
            <el-input
              v-model="queryParams.referralList[0].investmentAllcocation"
              placeholder="数"
              clearable
              :disabled = "disfal"
              size="small"
              style="width:66px; padding: 0;"
              @keyup.enter.native="handleQuery"
            />
            <span class="souu">%</span>
          </el-form-item>
          <el-form-item label="引荐方联系人:" prop="referral"   style="width: 21%;">
            <el-input
              v-model="queryParams.referralList[0].referral"
              placeholder="请输入"
              clearable
              :disabled = "disfal"
              size="small"
              style="width: 98px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>

          <el-form-item label="引荐方联系方式:" prop="referralPhone" style="width: 33%;">
            <el-input
              v-model="queryParams.referralList[0].referralPhone"
              placeholder="请输入联系方式"
              clearable
              :disabled = "disfal"
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="引荐单位:" style="width: 24%;" prop="sysDeptId">
            <el-cascader
                :show-all-levels = "false"
                v-model="queryParams.referralList[1].sysDeptId"
                :options="typeOptionstwo"
                style="width: 128px"
                :disabled = "disfal"
                @change="handleChangete"></el-cascader>
          </el-form-item>
          <el-form-item label="投资分配额:" style="width: 18%;" class="fenpe" prop="investmentAllcocation">
            <el-input
              v-model="queryParams.referralList[1].investmentAllcocation"
              placeholder="数"
              :disabled = "disfal"
              clearable
              size="small"
              style="width:66px;padding: 0;"
              @keyup.enter.native="handleQuery"
            />
            <span class="souu">%</span>
          </el-form-item>
          <el-form-item label="引荐方联系人:" prop="referral"  style="width: 21%;">
            <el-input
              v-model="queryParams.referralList[1].referral"
              placeholder="请输入"
              :disabled = "disfal"
              clearable
              size="small"
              style="width: 98px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>

          <el-form-item label="引荐方联系方式:" prop="referralPhone" style="width: 33%;">
            <el-input
              v-model="queryParams.referralList[1].referralPhone"
              placeholder="请输入联系方式"
              clearable
              :disabled = "disfal"
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        <!-- </div> -->
        <div class="nvestor">
          <p>项目基本信息 <i>*</i></p>
        </div>
        <el-form-item label="预计投资额" prop="needAmt">
          <el-input
            v-model.number="queryParams.needAmt"
            placeholder="请输入预计投资额"
            clearable
            :disabled = "disfal"
            size="small"
            style="width: 223px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="其中 固定资产投资:"
          prop="fixedAssets"
          class="manager_lab"

        >
          <el-input
            v-model.number="queryParams.fixedAssets"
            placeholder="请输入"
            clearable
            :disabled = "disfal"
            size="small"
            style="width: 223px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <div class="lage_div">
          <span>项目主营产品</span>
        <!-- </div> -->
          <el-form-item label="产品名称:" prop="productName" class="maneg_lar">
            <el-input
              v-model="queryParams.productName"
              placeholder="请输入产品名称"
              clearable
              :disabled = "disfal"
              size="small"
              style="width: 470px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </div>
        <el-form-item
          label="设计产能:"
          prop="productQty"
          class="manager_labtwo"
        >
          <el-input
            v-model="queryParams.productQty"
            placeholder="请输入设计产能"
            clearable
            :disabled = "disfal"
            size="small"
            style="width: 470px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <div class="lage_div">
          <span>项目预计收益</span>
          <el-form-item label="预计产值:" prop="productPrice" class="maneg_lar">
            <el-input
              v-model.number="queryParams.productPrice"
              placeholder="请输入预计产值"
              clearable
              :disabled = "disfal"
              size="small"
              style="width: 470px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </div>
        <el-form-item
          label="预计税收:"
          prop="productTax"
          class="manager_labtwo"
        >
          <el-input
            v-model.number="queryParams.productTax"
            placeholder="请输入预计税收"
            clearable
            :disabled = "disfal"
            size="small"
            style="width: 470px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="预计用工:"
          prop="productEmp"
          class="manager_labtwo"
        >
          <el-input
            v-model="queryParams.productEmp"
            placeholder="请输入预计用工"
            size="small"
            :disabled = "disfal"
            style="width: 470px"
          />
        </el-form-item>
        <div class="nvestor">
          <p>项目基本需求</p>
        </div>
        <el-form-item
          label="项目计划用地:"
          prop="plannedLand"

          class="manager_labthre"
        >
          <el-input
            v-model="queryParams.plannedLand"
            placeholder="请输入"
            clearable
            size="small"
            :disabled = "disfal"
            style="width: 237px"
            @keyup.enter.native="handleQuery"
          />
          <span class="souu">亩</span>
        </el-form-item>
        <el-form-item label="其中 独立供地:" prop="independentLand">
          <el-input
            v-model="queryParams.independentLand"
            placeholder="请输入"
            clearable
            :disabled = "disfal"
            size="small"
            style="width: 237px"
            @keyup.enter.native="handleQuery"
          />
          <span class="souu">亩</span>
        </el-form-item>
        <el-form-item label="流转土地:" prop="circulationLan" class="mage_ter">
          <el-input
            v-model="queryParams.circulationLan"
            placeholder="请输入"
            clearable
            :disabled = "disfal"
            size="small"
            style="width: 237px"
            @keyup.enter.native="handleQuery"
          />
          <span class="souu">亩</span>
        </el-form-item>
        <el-form-item
          label="项目计划租赁用房:"
          prop="needRoom"
          class="manager_labthre"
        >
          <el-input
            v-model="queryParams.needRoom"
            placeholder="请输入"
            clearable
            :disabled = "disfal"
            size="small"
            style="width: 237px"
            @keyup.enter.native="handleQuery"
          />
          <span class="souu">平方米</span>
        </el-form-item>
        <el-form-item label="其中 厂房:" prop="needFactoryRoom">
          <el-input
            v-model="queryParams.needFactoryRoom"
            placeholder="请输入"
            :disabled = "disfal"
            clearable
            size="small"
            style="width: 237px"
            @keyup.enter.native="handleQuery"
          />
          <span class="souu">平方米</span>
        </el-form-item>
        <el-form-item label="办公生活用房:" prop="needBusRoom" class="mage_ter">
          <el-input
            v-model="queryParams.needBusRoom"
            placeholder="请输入"
            :disabled = "disfal"
            clearable
            size="small"
            style="width: 237px"
            @keyup.enter.native="handleQuery"
          />
          <span class="souu">平方米</span>
        </el-form-item>
        <el-form-item label="其他需求:" prop="other" class="maget_ty">
          <el-input
            v-model="queryParams.other"
            placeholder="请输入项目概况"
            :disabled = "disfal"
            clearable
            type="textarea"
            size="small"
            style="width: 480px; height: 78px"
            class="ieuyr"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="拟落户地点:" prop="address">
          <el-input
            v-model="queryParams.address"
            placeholder="请输入拟落户地点"
            :disabled = "disfal"
            size="small"
            style="width: 188px"
          />
        </el-form-item>
        <el-form-item
          label="是否签订框架协议:"
          prop="isFrameorder"
          class="maget_tyty"
        >
          <el-select
            v-model="queryParams.isFrameorder"
            placeholder="请选择是否签订框架协议"
            clearable
            size="small"
            :disabled = "disfal"
            style="width: 298px"
          >
            <el-option
              v-for="dict in typeOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="添加附件:" prop="configType" class="maget_ty">
          <div class="forieu" style="width: 618px">
            <div class="bure burert">
              <el-upload
                :action="defaultSettings.urls+process+'/common/upload'"
                :auto-upload="false"
                ref="upload"
                :before-upload="beforeAvatarUpload"
                list-type="picture-card"
                :on-preview="handlePictureCardPreview"
                :on-remove="handleRemove"
                :on-success="handleSuccntry"
                :multiple="true"
                :file-list="fileList"
                :disabled = "disfal"
              >
                <!-- <i slot="default" class="el-icon-plus"></i> -->

                <div class="ijeut">
                  <el-button plain slot="trigger" size="small" type="primary"
                    >选择图片</el-button
                  >
                  <!-- margin-top: 15%; transform: translateY(-50%); -->
                </div>
                <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
              </el-upload>
              <div class="ijeut">
                <el-button
                  style="margin-left: 10px; height: 32px"
                  size="small"
                  type="primary"
                  @click="submitUpload"
                  >开始上传</el-button
                >
              </div>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="备注:"  prop="description" class="maget_ty">
          <el-input
            v-model="queryParams.description"
            placeholder="请输入备注"
            clearable
            type="textarea"
            :disabled = "disfal"
            size="small"
            style="width: 480px; height: 78px"
            class="ieuyr"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      </el-form>
    </div>

    <!-- </div> -->

    <!-- 添加或修改参数配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
        <el-form-item label="企业名称" prop="companyName">
          <el-input v-model="form.companyName" :disabled = "disfal" placeholder="请输入企业名称" />
        </el-form-item>
        <el-form-item label="企业所在地" prop="companyAddress">
          <el-input
            v-model="form.companyAddress"
            :disabled = "disfal"
            placeholder="请输入企业所在地"
          />
        </el-form-item>
        <el-form-item label="法人代表姓名" prop="companyLegal">
          <el-input
            v-model="form.companyLegal"
            :disabled = "disfal"
            placeholder="请输入法人代表姓名"
          />
        </el-form-item>
        <!-- <el-form-item label="系统内置" prop="configType">
          <el-radio-group v-model="form.configType">
            <el-radio
              v-for="dict in typeOptions"
              :key="dict.dictValue"
              :label="dict.dictValue"
            >{{dict.dictLabel}}</el-radio>
          </el-radio-group>
        </el-form-item> -->
        <el-form-item label="统一社会信用代码" prop="companyCode">
          <el-input
            v-model="form.companyCode"
            :disabled = "disfal"
            placeholder="请输入统一社会信用代码"
          />
        </el-form-item>
        <el-form-item label="联系方式" prop="phone">
          <el-input v-model.number="form.phone" :disabled = "disfal" placeholder="请输入联系方式" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog
      :title="titletwo"
      :visible.sync="opentwo"
      width="800px"
      append-to-body
      :close-on-click-modal="false"
    >
      <el-form
        ref="formtwo"
        :model="formtwo"
        :rules="rulestwo"
        label-width="150px"
      >
        <el-form-item label="姓名" prop="name">
          <el-input :disabled = "disfal" v-model="formtwo.name" placeholder="请输入自然人姓名" />
        </el-form-item>
        <el-form-item label="自然人所在地" prop="address">
          <el-input
            v-model="formtwo.address"
            :disabled = "disfal"
            placeholder="请输入自然人所在地"
          />
        </el-form-item>
        <el-form-item label="身份证号码" prop="idcode">
          <el-input :disabled = "disfal" v-model="formtwo.idcode" placeholder="请输入身份证号码" />
        </el-form-item>
        <!--      <el-form-item label="系统内置" prop="configType">
          <el-radio-group v-model="form.configType">
            <el-radio
              v-for="dict in typeOptions"
              :key="dict.dictValue"
              :label="dict.dictValue"
            >{{dict.dictLabel}}</el-radio>
          </el-radio-group>
        </el-form-item> -->
        <el-form-item label="联系方式" prop="phone">
          <el-input
            v-model="formtwo.phone"
            :disabled = "disfal"
            type="phone"
            placeholder="请输入联系方式"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormtwo">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogVisible">
      <img width="100%" :src="dialogImageUrl" alt="" />
    </el-dialog>
  </div>
</template>

<script>
  const defaultSettings = require("@/settings.js");
import {
  listConfig,
  listConfigtwo,
  listConfigthert,
  listConfigfour,
  listConfigfieu,
  getConfig,
  getConfigKeytwo,
  delConfig,
  delConfigtwo,
  addConfig,
  addConfigtwo,
  addConfigalking,
  addConfigbout,
  updateConfig,
  updateConfigtwo,
  updateConfigalking,
  exportConfig,
  clearCache,
} from "@/api/system/config";
import{
  setExamine,
  setReject
} from "@/api/projectInfo/info.js";
export default {
  name: "Config",
  props: {
    // queryParams: Object,
    tabIndex: Number,
  },
  data() {
    return {
      process: process.env.VUE_APP_BASE_API,
      defaultSettings,
      disfal:false,
      // 遮罩层
      loading: true,
      //步骤条
      naueactive: 2,
      tab: 1,
      tabNume: ["线索信息", "签约信息", "在建信息", "投产信息"],
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 参数表格数据
      configList: [],
      configListtwoL: [],
      // 弹出层标题
      title: "",
      titletwo: "",
      // 是否显示弹出层
      open: false,
      opentwo: false,
      // 类型数据字典
      typeOptions: [],
      typeOptionstwo: [],
      typeOptionstwos:[],
      typeOptionstwoss:[],
      // 日期范围
      dateRange: [],
      setrd: 0,
      // 查询参数
      queryParams: {
        contactor: "",
        phone: "",
        referralList: [
          {
            bmProjectId: "",
            sysDeptId: "",
            investmentAllcocation: "",
            referral: "",
            referralPhone: "",
          },
          {
            bmProjectId: "",
            sysDeptId: "",
            investmentAllcocation: "",
            referral: "",
            referralPhone: "",
          },
        ],
      },
      dialogImageUrl: "",
      dialogVisible: false,
      disabled: false,
      bmProjectId: 0,
      // 表单参数
      form: {},
      formtwo: {},
      queryFormhye: {},
      fileList: [],
      fileListhye: [],
      // 表单校验
      rules: {
        companyName: [
          { required: true, message: "企业名称不能为空", trigger: "blur" },
        ],
        companyAddress: [
          { required: true, message: "企业所在地不能为空", trigger: "blur" },
        ],
        companyLegal: [
          { required: true, message: "法人代表姓名不能为空", trigger: "blur" },
        ],
        companyCode: [
          {
            required: true,
            message: "统一社会信用代码不能为空",
            trigger: "blur",
          },
        ],
        phone: [
          { required: true, message: "联系方式不能为空", trigger: "blur" },
          {
            pattern: /^1(3|4|5|7|8|9)\d{9}$/,
            message: "手机号格式不对",
            trigger: "blur",
          },
        ],
      },
      rulestwo: {
        name: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
        address: [
          { required: true, message: "所在地不能为空", trigger: "blur" },
        ],
        idcode: [
          { 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]$)/,
            message: "身份证号码格式不对",
            trigger: "blur",
          }
        ],
        phone: [
          { required: true, message: "联系方式不能为空", trigger: "blur" },
          {
            pattern: /^1(3|4|5|7|8|9)\d{9}$/,
            message: "手机号格式不对",
            trigger: "blur",
          }
        ],
      },

      queryForm: {
        contactor: [
          { required: true, message: "投资方联系人不能为空", trigger: "blur" },
        ],
        phone: [
          {
            required: true,
            message: "投资方联系方式不能为空",
            trigger: "blur",
          },
          {
            pattern: /^1(3|4|5|7|8|9)\d{9}$/,
            message: "手机号格式不对",
            trigger: "blur",
          }
        ],
        needAmt: [
          { required: true, message: "预计投资额不能为空", trigger: "blur" },
          { type: "number", message: "预计投资额必须为数字值" },
        ],
        fixedAssets: [
          { required: true, message: "固定资产投资不能为空", trigger: "blur" },
          { type: "number", message: "固定资产投资必须为数字值" },
        ],
        productName: [
          { required: true, message: "产品名称不能为空", trigger: "blur" },
        ],
        productQty: [
          { required: true, message: "设计产能不能为空", trigger: "blur" },
        ],
        productPrice: [
          { required: true, message: "预计产值不能为空", trigger: "blur" },
          { type: "number", message: "预计产值必须为数字值" },
        ],
        productTax: [
          { required: true, message: "预计税收不能为空", trigger: "blur" },
          { type: "number", message: "预计税收必须为数字值" },
        ],
        productEmp: [
          { required: true, message: "预计用工不能为空", trigger: "blur" },
        ],
        address: [
          { required: true, message: "拟落户地点不能为空", trigger: "blur" },
        ],
        isFrameorder: [
          {
            required: true,
            message: "请选择是否签订框架协议",
            trigger: "blur",
          },
        ],
      },
      ntry: [],
      // 判断是修改还是增加
      sbuen: 0, //0  新增   1  修改
      jeutu:{
        bmProjectId:0
      },
      // id:0
      value: [],
      valuess:[],
      values:[]
    };
  },
  created() {
    this.bmProjectId = this.$route.query.setid;
    this.jeutu.bmProjectId = this.bmProjectId
    this.setrd = this.$route.query.setrd;
    console.log(this.setrd );
    if(this.setrd != 1){
      this.disfal  = true
      console.log(this.disfal,1)
    }else{
      this.disfal  = false
      console.log(this.disfal,2)
    }
    this.getList();
    this.getListtwo();
    this.getListther();
    this.getDicts("sys_yes_no").then((response) => {
      this.typeOptions = response.data;
    });
    this.getListthuy();
    console.log(this.queryParams);
  },
  methods: {
    handleChange(value){
      //0
      this.queryParams.referralList[0].sysDeptId = value.pop()
      console.log(value)
    },
    handleChangete(value){
      this.queryParams.referralList[1].sysDeptId = value.pop()
      //1
    console.log(value)
    },
    handleChangess(value){
     console.log(value)

    },
    //审核
    applyBtn() {
      var that=this
      this.$confirm("是否确认审核", "提醒", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return setExamine({
            code: 3,
            bmProjectId: that.bmProjectId,
          });
        })
        .then(() => {
          this.$router.go(-1);
          this.getList();
          this.msgSuccess("审核成功");
        });
    },
    //驳回
    backBtn() {
      var that=this
      this.$prompt("请输入驳回意见", "提醒", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
      .then(({ value }) => {
          return setReject({
            code: 2,
            bmProjectId: that.bmProjectId,
            remark:value
          });
         })
        .then(() => {
          this.$router.go(-1);
          this.getList();
          this.msgSuccess("驳回成功");
        });
    },
    submitUpload() {
      this.$refs.upload.submit();
    },
    handleRemove(file) {
      console.log(file, 87);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    handleDownload(file) {
      console.log(file);
    },
    handleSuccntry(response, file, fileList) {
      // this.ontract = []
      this.ntry.push(file.response.url);
      this.queryParams.attachment = this.ntry.join(",");
    },
    beforeAvatarUpload(file) {
      console.log(file.type);
      const isJPG =
        file.type === "image/jpeg" ||
        file.type === "image/png" ||
        file.type === "image/jpg";
      const isPNG = file.type === "image/png";
      const isLt2M = file.size / 1024 / 1024 < 2;

      if (!isJPG) {
        this.$message.error("图片只能是 JPG 格式! 或者 PNG 格式!");
      }
      // if(!isPNG){
      //   this.$message.error('图片只能是 JPG 格式! 或者 PNG 格式!');
      // }
      if (!isLt2M) {
        this.$message.error("图片大小不能超过 2MB!");
      }
      return isJPG && isLt2M;
    },
    /** 查询参数列表 */
    getList() {
      this.loading = true;
      listConfigtwo(this.bmProjectId).then((response) => {
        console.log(response);
        if (response.data == undefined) {
          console.log(876);
          //新增
          this.sbuen = 0;
          (this.queryParams = {
            referralList: [
              {
                bmProjectId: this.bmProjectId,
                sysDeptId: "",
                investmentAllcocation: "",
                referral: "",
                referralPhone: "",
              },
              {
                bmProjectId: this.bmProjectId,
                sysDeptId: "",
                investmentAllcocation: "",
                referral: "",
                referralPhone: "",
              },
            ],
          }),
            (this.queryParams.bmProjectId = this.bmProjectId);
        } else if (response.data !== undefined) {
          //修改
          this.sbuen = 1;
          this.queryParams = response.data;
          if (this.queryParams.referralList == null) {
            this.queryParams.referralList = [
              {
                bmProjectId: this.bmProjectId,
                sysDeptId: "",
                investmentAllcocation: "",
                referral: "",
                referralPhone: "",
              },
              {
                bmProjectId: this.bmProjectId,
                sysDeptId: "",
                investmentAllcocation: "",
                referral: "",
                referralPhone: "",
              },
            ];

            // }
          }
          if(this.queryParams.referralList.length ==1){
            this.queryParams.referralList = [
              {
                bmProjectId: this.bmProjectId,
                sysDeptId: response.data.referralList[0].sysDeptId,
                investmentAllcocation: response.data.referralList[0].investmentAllcocation,
                referral: response.data.referralList[0].referral,
                referralPhone: response.data.referralList[0].referralPhone,
              },
              {
                bmProjectId: this.bmProjectId,
                sysDeptId: "",
                investmentAllcocation: "",
                referral: "",
                referralPhone: "",
              },
            ];
          }
          // this.queryParams.phone = 987
          console.log(this.queryParams, 98755);
          // this.queryParams = this.queryParams.bmProjectId
          this.fileListhye = []
          if(this.queryParams.attachment !== null){
            this.fileListhye = this.queryParams.attachment.split(",");
            for (var i = 0; i < this.fileListhye.length; i++) {
              this.fileList.push({
                name: this.fileListhye[i],
                url: this.fileListhye[i],
              });
            }
          }

          // this.fileList.push({name:this.queryParams.attachment,url:this.queryParams.attachment})
        }

        // this.fileList =  this.queryParams.attachment
        // this.total = response.total;
        this.loading = false;
      });
    },
    //企业列表
    getListtwo() {
      this.loading = true;
      listConfigthert(this.jeutu).then((response) => {
        console.log(response);
        this.configList = response.rows;
        // this.fileList =  this.queryParams.attachment
        // this.total = response.total;
        this.loading = false;
      });
    },
    //自然人列表
    getListther() {
      this.loading = true;
      listConfigfour(this.jeutu).then((response) => {
        console.log(response.rows);
        this.configListtwoL = response.rows;
        // this.fileList =  this.queryParams.attachment
        // this.total = response.total;
        this.loading = false;
      });
    },
    //部门列表
    getListthuy() {
      this.loading = true;
      listConfigfieu().then((response) => {
        console.log(response);

        if(response.data !== undefined){
          this.typeOptionstwo = response.data;
          // this.dietj(this.typeOptionstwo)
        }
        this.typeOptionstwos= response.data ,
        this.typeOptionstwoss= response.data,

        // this.typeOptionstwo.filter((route) => {
        //   route.value = route.id
        //   route.children.filter((router) =>{
        //     router.value = router.id
        //      // this.getListthuy()
        //     // router.children.filter((routers) =>{
        //     //   routers.value = routers.id

        //     // })
        //   })

        // });


        // this.fileList =  this.queryParams.attachment
        // this.total = response.total;
        this.loading = false;
      });
    },
    //递归
    dietj(index){
       console.log(index)
       let iuy = []
      for(var i = 0 ; i < index.length; i++){
        index[i].value = index[i].id
        iuy = index[i].children
        // this.dietj(index[i].children)
         console.log(iuy)
         if(index[i].children !== undefined){
           if(index[i].children != 0){
             console.log(index[i].children)
             this.dietj(index[i].children)
           }else{
             return
           }
         }

      }
    },
    // 参数系统内置字典翻译
    typeFormat(row, column) {
      return this.selectDictLabel(this.typeOptions, row.configType);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.opentwo = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        // configId: undefined,
        // configName: undefined,
        // configKey: undefined,
        // configValue: undefined,
        // configType: "Y",
        // remark: undefined
      };
      this.resetForm("form");
    },
    resettwo() {
      this.formtwo = {
        // configId: undefined,
        // configName: undefined,
        // configKey: undefined,
        // configValue: undefined,
        // configType: "Y",
        // remark: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      // this.opentwo =  true
      this.title = "添加信息";
      // this.titletwo = "添加参数";
    },
    handleAddtwo() {
      this.resettwo();
      // this.open = true;
      this.opentwo = true;
      // this.title = "添加参数";
      this.titletwo = "添加信息";
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.configId);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
      this.open = true;
      getConfig(id).then((response) => {
        console.log(345);
        this.form = response.data;

        // this.opentwo = true
        this.title = "修改信息";
        // this.titletwo = "修改参数";
      });
    },
    handleUpdatetwo(row) {
      this.reset();
      const id = row.id;
      getConfigKeytwo(id).then((response) => {
        console.log(345);
        this.formtwo = response.data;
        // this.open = true;
        this.opentwo = true;
        // this.title = "修改参数";
        this.titletwo = "修改信息";
      });
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != undefined) {
            updateConfig(this.form).then((response) => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getListtwo();
            });
          } else {
            this.form.bmProjectId = this.bmProjectId;
            addConfig(this.form).then((response) => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getListtwo();
            });
          }
        }
      });
    },
    /** 提交按钮 */
    submitFormtwo: function () {
      this.$refs["formtwo"].validate((valid) => {
        if (valid) {
          if (this.formtwo.id != undefined) {
            updateConfigtwo(this.formtwo).then((response) => {
              this.msgSuccess("修改成功");
              this.opentwo = false;
              this.getListther();
            });
          } else {
            this.formtwo.bmProjectId = this.bmProjectId;
            addConfigtwo(this.formtwo).then((response) => {
              this.msgSuccess("新增成功");
              this.opentwo = false;
              this.getListther();
            });
          }
        }
      });
    },
    // 暂存接口
    emporary() {
      console.log(this.queryParams)

      this.$refs["queryParams"].validate((valid) => {
        if (valid) {
          if (this.sbuen == 1) {
            updateConfigalking(this.queryParams).then((response) => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getListtwo();
              this.$router.go(-1);
            });
          } else {
              // if(this.queryParams.referralList[0].sysDeptId !== ''){
              //   this.queryParams.referralList[0].sysDeptId = this.queryParams.referralList[0].sysDeptId.pop()
              //   console.log(this.queryParams.referralList[0].sysDeptId)
              // }
              // if(this.queryParams.referralList[1].sysDeptId !== ''){
              //   this.queryParams.referralList[1].sysDeptId = this.queryParams.referralList[1].sysDeptId.pop()
              // }
            // this.queryParams.bmProjectId = this.bmProjectId
            console.log(this.queryParams, 87);
            addConfigalking(this.queryParams).then((response) => {
              console.log(response);
              this.msgSuccess("新增成功");
              this.open = false;
              this.getListtwo();
              this.$router.go(-1);
            });
          }
        }
      });
    },
    submitCtion() {
      this.queryFormhye.code = 1;
      this.queryFormhye.bmProjectId = this.bmProjectId;
	  console.log(this.queryFormhye)
	  // if(){

	  // }
      // addConfigbout(this.queryFormhye).then((response) => {
      //   console.log(response);
      //   this.msgSuccess("提交成功");
      //   this.$router.go(-1);
      //   // 就可以回到上一页。
      //   // this.open = false;
      //   // this.getListtwo();
      // });
      console.log(this.queryParams);
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const configIds = row.id;
      this.$confirm('是否确认删除"' + row.companyName + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return delConfig(configIds);
        })
        .then(() => {
          this.getListtwo();
          this.msgSuccess("删除成功");
        });
    },
    handleDeletetwo(row) {
      const configIds = row.id;
      this.$confirm('是否确认删除"' + row.name + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return delConfigtwo(configIds);
        })
        .then(() => {
          this.getListther();
          this.msgSuccess("删除成功");
        });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm("是否确认导出所有参数数据项?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return exportConfig(queryParams);
        })
        .then((response) => {
          this.download(response.msg);
        });
    },
    /** 清理缓存按钮操作 */
    handleClearCache() {
      clearCache().then((response) => {
        this.msgSuccess("清理成功");
      });
    },
    //tab
    changeTab(index) {
      this.$emit("changeTab", index);
      // this.tab = index
    },
    // 取消按钮
    cancelqiu(){
      this.$router.go(-1);
    }
  },
};
</script>
<style  lang="scss"  >
.roiyy {
  position: fixed;
  top: 95px;
  left: 0;
  width: 100%;
  padding-left: 230px;
  padding-right: 30px;
  box-sizing: border-box;
  z-index: 999;
}
.weiru {
  .el-form-item__label {
    width: 130px !important;
  }
}
.manager_form {
  margin-top: 30px;
  .manager_lab {
    .el-form-item__label {
      width: 145px !important;
    }
  }
  .maneg_lar {
    position: relative;
    .el-form-item__label {
      width: 134px !important;
    }
    span {
      position: absolute;
      left: -95%;
    }
  }
  .manager_labtwo {
    .el-form-item__label {
      width: 244px !important;
    }
  }
  .manager_labthre {
    // .el-form-item{
    .el-form-item__label {
      width: 130px !important;
    }
    margin-right: 40px !important;
    // }
  }
  .ieuyr {
    .el-textarea__inner {
      height: 80px !important;
    }
  }
  .mage_ter {
    .el-form-item__label {
      width: 533px !important;
    }
  }
  .maget_ty {
    .el-form-item__label {
      width: 140px !important;
    }
  }
  .yijeu{
    .el-form-item__label {
      width: 90px !important;
    }
  }
  .maget_tyty {
    .el-form-item__label {
      width: 140px !important;
    }
  }
  .fenpe{
    .el-form-item__label {
      width: 100px !important;
    }
  }
  .forieu {
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    width: 480px;
    height: 90px;
    position: relative;
    .bure {
      position: absolute;
      right: 20px;
      top: 50%;
      transform: translateY(-50%);
    }
    .burert {
      .el-upload--picture-card {
        height: 78px;
        line-height: 78px;
        width: 80px;
        vertical-align: center;
        border: 0 !important;
        background-color: #fff;
      }
      .el-upload-list--picture-card .el-upload-list__item {
        height: 78px !important;
        width: 78px !important;
      }
    }
  }
}
.lage_div {
  padding-left: 15px;
  display: flex;
  align-items: center;
  margin-bottom: 22px;
  .el-form-item {
    margin-bottom: 0 !important;
  }
}
.app-conta {
  .header {
    padding-left: 22px;
    height: 45px;
    line-height: 40px;
    background-color: #f1f1f1;
    font-size: 18px;
    color: #343434;
    margin-bottom: 40px;
  }
  // .naue{
  // border: 1px solid #DADADA;
  // padding:  20px;
  // margin-top: 40px;
  .nuae_wtu {
    display: flex;
    justify-content: center;
    align-content: center;
    .naue_one {
      width: 30%;
      p {
        font-size: 12px;
        font-family: PingFang SC;
        font-weight: 400;
        color: #343434;
      }
      .naue_name {
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: bold;
        color: #0669b2;
        margin-bottom: 30px;
      }
    }
    .naue_two {
      flex: 1;
      padding-top: 20px;
      // display: flex;
      // align-items: center;
      // justify-content: center;
    }
  }
  //tab
  // .naue_tab {
  //   border-bottom: 1px solid #cdcdcd;
  //   display: flex;
  //   margin-top: 30px;
  //   padding: 0 10px;
  //   margin-bottom: 30px;
  //   p {
  //     font-size: 16px;
  //     font-family: PingFang SC;
  //     font-weight: 700;
  //     color: #fff;
  //     padding: 11px 15px;
  //     margin: 10px;
  //   }
  //   .p {
  //     border-bottom: 2px solid #1c84c6;
  //     margin-bottom: -1px;
  //   }
  // }
  .mation {
    .enterprise {
      font-size: 14px;
      font-family: PingFang SC;
      font-weight: bold;
      color: #1c84c6;
      margin-top: 25px;
      margin-bottom: 20px;
    }
    .enterprise_tw {
      i {
        margin-right: 5px;
      }
      font-size: 14px;
      font-family: PingFang SC;
      font-weight: 600;
      color: #666666;
    }
  }

  // }
  .nvestor {
    margin-bottom: 10px;
    p {
      margin: 0;
      font-size: 14px;
      font-family: PingFang SC;
      font-weight: bold;
      color: #343434;
      height: 24px;
      line-height: 24px;
      border-left: 3px solid #1c84c6;
      padding-left: 13px;
      i {
        color: red;
      }
    }
  }
  .souu {
    font-size: 14px;
    font-family: PingFang SC;
    font-weight: 400;
    color: #343434;
    margin-left: 5px;
  }
}
//在建项目
.nstruction {
  display: flex;
  align-items: center;
  .nstruction_nav {
    display: flex;
    align-items: center;
    p:nth-child(1) {
      margin-right: 10px;
      span {
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: bold;
        color: #343434;
      }
      span:nth-child(1) {
        color: #df0024;
      }
    }
    p:nth-child(2) {
      width: 233px;
      height: 30px;
      line-height: 30px;
      border: 1px solid #cdcdcd;
      border-radius: 3px;
      padding-left: 14px;
    }
  }
  .nstruction_navne {
    margin-left: 50px;
    display: flex;
    align-items: center;
    p:nth-child(1) {
      margin-right: 10px;
      span {
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: bold;
        color: #343434;
      }
      span:nth-child(1) {
        color: #df0024;
      }
    }
    p:nth-child(2) {
      width: 233px;
      height: 30px;
      line-height: 30px;
      border: 1px solid #cdcdcd;
      border-radius: 3px;
      padding-left: 14px;
    }
  }
}
.kaieu {
  padding-left: 60px;
  font-size: 14px;
  font-family: PingFang SC;
  font-weight: 800;
  color: #343434;
}
.kaieu_tw {
  padding-left: 60px;
  font-size: 14px;
  font-family: PingFang SC;
  font-weight: 500;
  color: #666666;
}
</style>