<template>
  <div class="checkExtraction">
    <div v-show="this.$route.query.status != 1">
      <br />
      <el-row>
        <el-col :span="24">
          <h2 class="title_style">抽取：</h2>
        </el-col>
      </el-row>
      <br />
      <el-row>
        <el-col :span="24">
          <el-table
            ref="mutipleTable"
            :data="procuratorialPersonnelList"
            :border="true"
            highlight-current-row
            :header-cell-style="{'background':'#FAFAFA','color':'#333','font-weight':'600'}"
            style="width: 100%;margin:20px 10px 0 0"
            :default-expand-all="true"
          >
            <el-table-column property="name" label="组长*" align="center">
              <template slot-scope="scope">
                <el-select style="margin: 5px;" v-model="scope.row.zz" multiple placeholder="必填">
                  <el-option
                    v-for="item in jczList"
                    :key="item.id"
                    :label="item.ryxm"
                    :value="item.rybh"
                  ></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column property="name" label="组员*" align="center">
              <template slot-scope="scope">
                <el-select v-model="scope.row.zy" multiple placeholder="必填">
                  <el-option
                    v-for="item in jczList"
                    :key="item.id"
                    :label="item.ryxm"
                    :value="item.rybh"
                  ></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column property="name" label="外部人员" align="center">
              <template slot-scope="scope">
                <el-input v-model="scope.row.wbry"></el-input>
              </template>
            </el-table-column>
            <el-table-column property="name" label="外部人员所属单位" align="center">
              <template slot-scope="scope">
                <el-input v-model="scope.row.wbryssdw"></el-input>
              </template>
            </el-table-column>
            <el-table-column property="name" label="被检单位数量*" align="center">
              <template slot-scope="scope">
                <el-input v-model="scope.row.bjdwNumber" placeholder="必填"></el-input>
              </template>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
      <br />
      <el-row>
        <el-col :span="24" style="text-align: center">
          <el-button
            style="background: #409EFF;"
            @click="plus()"
            type="primary"
            icon="el-icon-plus"
            circle
          ></el-button>
          <el-button
            style="background: #409EFF;"
            @click="minus()"
            type="primary"
            icon="el-icon-minus"
            circle
          ></el-button>
          <br />
        </el-col>
      </el-row>
      <br />
      <el-row>
        <el-col :span="24" style="text-align: center">
          <el-button type="primary" style="margin-left: 10px;" @click="bjdwcqlbsj()">抽取</el-button>
          <!--被检单位抽泣按钮-->
          <br />
        </el-col>
      </el-row>
      <br />
      <div class="dashed_border" v-show="is_shows">
        <el-row>
          <el-col :span="24">
            <h1>抽取结果：</h1>
          </el-col>
        </el-row>
        <div v-for="(item,index) in bjdwdlist" :key="index">
          <el-row>
            <el-col :span="24">
              <span>{{item.jczName}}：</span>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="10">
              <el-table
                ref="mutipleTable"
                :data="item.members"
                :border="true"
                highlight-current-row
                :header-cell-style="{'background':'#FAFAFA','color':'#333','font-weight':'600'}"
                style="width: 100%;margin:20px 10px 0 0"
                :default-expand-all="true"
              >
                <el-table-column label="人员属性" align="center">
                  <template slot-scope="scope">
                    <span v-if="scope.row.zylx == 0">组长</span>
                    <span v-if="scope.row.zylx == 1">组员</span>
                    <span v-if="scope.row.zylx == 2">外部人员</span>
                  </template>
                </el-table-column>
                <el-table-column label="人员名称" align="center">
                  <template slot-scope="scope">{{scope.row.zyName}}</template>
                </el-table-column>
                <el-table-column label="所属单位" align="center">
                  <template slot-scope="scope">{{scope.row.zydw}}</template>
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template>
                    <span>更换</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
            <el-col :span="1">
              <span>&nbsp;</span>
            </el-col>
            <el-col :span="10">
              <el-table
                ref="mutipleTable"
                :data="item.organizes"
                :border="true"
                highlight-current-row
                :header-cell-style="{'background':'#FAFAFA','color':'#333','font-weight':'600'}"
                style="width: 100%;margin:20px 10px 0 0"
                :default-expand-all="true"
              >
                <el-table-column property="name" label="被检单位" align="center">
                  <template slot-scope="scope">{{scope.row.bjdwName}}</template>
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template>
                    <span>新增被检单位</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
          </el-row>

          <br />
        </div>
      </div>
      <br />
      <el-row style="text-align: center;">
        <el-col :span="24">
          <el-button type="primary" @click="save1()">确定</el-button>
          <!--被检单位抽取结果保存按钮-->
          <el-button type="primary" @click="go_dailyinspection()">取消</el-button>
        </el-col>
      </el-row>
      <br />
    </div>
    <br />

    <div v-show="this.$route.query.status != 2">
      <el-row>
        <el-col :span="24">
          <h2 class="title_style">检查组抽取条件：</h2>
        </el-col>
      </el-row>
      <br />
      <el-row>
        <el-col :span="12" style="margin-top:8px;">
          <span>检查组要求：</span>
          <el-radio-group v-model="radio" style="width: 50%;">
            <el-radio :label="0" @change="inspectRules()">规则一致</el-radio>
            <el-radio :label="1" @change="inspectRules()">规则不一致</el-radio>
          </el-radio-group>
        </el-col>
        <el-col :span="12" v-show="condition">
          <span>
            <span style="color:red;">*</span> 检查组数量：
          </span>
          <el-input style="width: 70%;" v-model="jczsl"></el-input>
        </el-col>
      </el-row>
      <br />
      <br />
      <div class="dashed_border">
        <el-row>
          <el-col :span="24">
            <h1>抽取规则</h1>
          </el-col>
        </el-row>
        <!-- <br />
        <el-row>
          <el-col :span="24">
            <inspectTableView
              :list="list1"
              @handleSelectionChange="handleSelectionChange"
              :options="tablePar"
              :columns="columns1"
            ></inspectTableView>
          </el-col>
        </el-row>-->
        <el-table v-show="radio == 1" border :data="list1" stripe style="width: 100%">
          <el-table-column align="center" label="组长数量">
            <template slot-scope="scope">
              <el-input type="Number" v-model="scope.row.value1" placeholder="必填"></el-input>
            </template>
          </el-table-column>
          <el-table-column align="center" label="组员数量">
            <template slot-scope="scope">
              <el-input type="Number" v-model="scope.row.value2" placeholder="必填"></el-input>
            </template>
          </el-table-column>
          <el-table-column align="center" label="被检单位数量">
            <template slot-scope="scope">
              <el-input type="Number" v-model="scope.row.value3" placeholder="必填"></el-input>
            </template>
          </el-table-column>
          <el-table-column align="center" label="持证人员数量">
            <template slot-scope="scope">
              <el-input type="Number" style="margin:10px;" v-model="scope.row.value4" placeholder="必填"></el-input>
            </template>
          </el-table-column>
              <el-table-column align="center" label="操作" width="150">
            <template slot-scope="scope">
              <el-tooltip class="item" effect="light" content="添加" placement="top">
                <i @click="ssjplus(scope.$index)" class="iconfont iconxinzeng"></i>
              </el-tooltip>
              <el-tooltip class="item" effect="light" content="删除" placement="top">
                <i
                  style="margin-left: 10px;"
                  @click="ssjminus(scope.$index)"
                  class="el-icon-minus"
                ></i>
              </el-tooltip>
            </template>
          </el-table-column>
          
        </el-table>

        <el-table v-show="radio == 0" border :data="list1" stripe style="width: 100%">
          <el-table-column align="center" label="组长数量">
            <template slot-scope="scope">
              <el-input type="Number" v-model="scope.row.value1" placeholder="必填"></el-input>
            </template>
          </el-table-column>
          <el-table-column align="center" label="组员数量">
            <template slot-scope="scope">
              <el-input type="Number" v-model="scope.row.value2" placeholder="必填"></el-input>
            </template>
          </el-table-column>
          <el-table-column align="center" label="被检单位数量">
            <template slot-scope="scope">
              <el-input type="Number" v-model="scope.row.value3" placeholder="必填"></el-input>
            </template>
          </el-table-column>
          <el-table-column align="center" label="持证人员数量">
            <template slot-scope="scope">
              <el-input type="Number" style="margin:10px;" v-model="scope.row.value4" placeholder="必填"></el-input>
            </template>
          </el-table-column>
        </el-table>
        <br />
        <el-row style="text-align: center;">
          <el-col :span="24">
            <el-button type="primary" @click="extracted()">抽取</el-button>
            <!--双随机抽取-->
          </el-col>
        </el-row>
      </div>
      <br />
      <div class="dashed_border" v-show="is_shows">
        <el-row>
          <el-col :span="24">
            <h1>抽取结果：</h1>
          </el-col>
        </el-row>
        <div v-for="(item,index) in bjdwdlist" :key="index">
          <el-row>
            <el-col :span="24">
              <span>{{item.jczName}}：</span>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="10">
              <el-table
                ref="mutipleTable"
                :data="item.members"
                :border="true"
                highlight-current-row
                :header-cell-style="{'background':'#FAFAFA','color':'#333','font-weight':'600'}"
                style="width: 100%;margin:20px 10px 0 0"
                :default-expand-all="true"
              >
                <el-table-column label="人员属性" align="center">
                  <template slot-scope="scope">
                    <span v-if="scope.row.zylx == 0">组长</span>
                    <span v-if="scope.row.zylx == 1">组员</span>
                    <span v-if="scope.row.zylx == 2">外部人员</span>
                  </template>
                </el-table-column>
                <el-table-column label="人员名称" align="center">
                  <template slot-scope="scope">{{scope.row.zyName}}</template>
                </el-table-column>
                <el-table-column label="所属单位" align="center">
                  <template slot-scope="scope">{{scope.row.zydw}}</template>
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template>
                    <span>更换</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
            <el-col :span="1">
              <span>&nbsp;</span>
            </el-col>
            <el-col :span="10">
              <el-table
                ref="mutipleTable"
                :data="item.organizes"
                :border="true"
                highlight-current-row
                :header-cell-style="{'background':'#FAFAFA','color':'#333','font-weight':'600'}"
                style="width: 100%;margin:20px 10px 0 0"
                :default-expand-all="true"
              >
                <el-table-column property="name" label="被检单位" align="center">
                  <template slot-scope="scope">{{scope.row.bjdwName}}</template>
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template>
                    <span>新增被检单位</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
          </el-row>
        </div>
      </div>
      <br />
      <el-row style="text-align: center;">
        <!--双随机抽取保存-->
        <el-col :span="24">
          <el-button type="primary" @click="go_back()">上一步</el-button>
          <el-button type="primary" @click="save()">确定</el-button>
          <el-button type="primary" @click="go_list()">取消</el-button>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import inspectTableView from "../../../../components/table/el-index";
import {
  jczssjcq,
  savercjcfpjczxxbc,
  bjdwcqsj,
  getrcjcfpjczxxbc,
  bjdwmchq
} from "@/api/missionDispatchManage/dailyinspection/index.js";

export default {
  components: {
    inspectTableView
  },
  name: "checkExtraction",
  data() {
    return {
      stop: true,
      bjdwstop: true,
      bjdwNumber: "", //被检单位数量
      jczsl: "", //检查组数量
      value1: [],
      value2: [],
      value3: [],
      zzslmsg: "",
      zyslmsg: "",
      bjdwslmsg: "",
      czryslmsg: "",
      msg: "",
      aaaa: "",
      wbry: "", //外部人员
      wbrydw: "", //外部人员所属单位
      cqjglist: [],
      condition: true, //显示隐藏检查组数量选项jczList
      radio: 0,
      extract: false,
      list1: [],
      pageInfo: {
        currentPage: 2,
        pageSize: 10,
        total: 100,
        handleSizeChange: val => {
          console.log(val);
        },
        handleCurrentChange: val => {
          console.log(val);
        }
      },
      tablePar: {
        stripe: true, // 是否为斑马纹 tableTypeError: Cannot read property 'data' of undefined
        loading: false, // 是否添加表格loading加载动画
        highlightCurrentRow: true, // 是否支持当前行高亮显示
        mutiSelect: false, // 是否支持列表项选中功能
        showIndex: true //是否显示选择框
      },
      options: {
        stripe: true, // 是否为斑马纹 table
        loading: false, // 是否添加表格loading加载动画
        highlightCurrentRow: true, // 是否支持当前行高亮显示
        mutiSelect: false // 是否支持列表项选中功能
      },
      handleSelectionChange(val) {
        console.log("val:", val);
      },
      columns: [
        {
          prop: "title",
          label: "表单名称",
          align: "center"
        },
        {
          prop: "title",
          label: "操作",
          align: "center",
          render: (h, params) => {
            return h("div", [
              h(
                "span",
                {
                  on: {
                    click: () => {
                      console.log(1);
                    }
                  }
                },
                "查看"
              )
            ]);
          }
        }
      ],
      objs:{
        value1: "",
        value2: "",
        value3: "",
        value4: ""
      },
      jcrylisthx: [],
      bjdwlisthx: [],
      bjdwdlist: [],
      jczList: [], //组长组员列表
      beijiandanweiList: [], //单位列表
      procuratorialPersonnelList: [],
      is_shows: false,
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      }
    };
  },
  mounted() {
    console.log(this.$route);
    this.getrcjcfpjczxxbcs();
    this.plus();
    this.ssjplus();
  },
  methods: {
    //返回上一级
    go_back(){
      this.$router.go(-1)
    },
    //生成双随机抽取完保存数据
    getInf_ssj() {
      let returnData = [];
      let obj = {
        rwId: this.$route.query.rwid,
        members: [],
        organizes: []
      };
      this.bjdwdlist.forEach(items => {
        // debugger
        items.members.forEach(msg => {
          obj.members.push({
            isCz: msg.isCz,
            zyId: msg.zyId,
            zyName: msg.zyName,
            zydw: msg.zydw,
            zyks: msg.zyks,
            zylx: msg.zylx
          });
        });
        items.organizes.forEach(res => {
          obj.organizes.push({
            bjdwId: res.bjdwId,
            bjdwName: res.bjdwName
          });
        });
      });
      returnData.push(obj);
      console.log(returnData);
      return returnData;
    },
    //生成被检单位抽取完保存数据
    getInfo() {
      let returnData = [];
      let obj = {
        rwId: this.$route.query.rwid,
        members: [],
        organizes: []
      };
      this.bjdwdlist.forEach(items => {
        // debugger
        items.members.forEach(msg => {
          obj.members.push({
            isCz: msg.isCz,
            zyId: msg.zyId,
            zyName: msg.zyName,
            zydw: msg.zydw,
            zyks: msg.zyks,
            zylx: msg.zylx
          });
        });
        items.organizes.forEach(res => {
          obj.organizes.push({
            bjdwId: res.bjdwId,
            bjdwName: res.bjdwName
          });
        });
      });
      returnData.push(obj);
      console.log(returnData);
      return returnData;
    },
    //合并单元格
    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 1) {
        if (rowIndex === 0) {
          return {
            rowspan: row.length,
            colspan: 1
          };
        }
      }
    },
    //检查组增加
    plus() {
      this.procuratorialPersonnelList.push({
        zz: [], //组长
        zy: [], //组员
        wbry: "", //外部人员
        wbryssdw: "", //外部人员所属单位
        bjdwNumber: "" //被检单位数量
      });
    },
    //双随机增加
    ssjplus() {
      this.objs = {}
      this.list1.push(this.objs);
    },
    //双随机检查组后删
    ssjminus(rowIndex) {
      this.list1.splice(rowIndex, 1);
    },
    //检查组后删
    minus() {
      this.procuratorialPersonnelList.pop();
    },
    //获取检查组组长组员信息
    getrcjcfpjczxxbcs() {
      getrcjcfpjczxxbc()
        .then(res => {
          this.jczList = res.data;
        })
        .catch(err => {
          console.log(err);
        });
    },
    //生成被检单位抽取时需要的数据
    beijianchouqushuju() {
      let returnData = [];
      this.procuratorialPersonnelList.forEach(items => {
        // debugger
        let obj = {
          rwId: this.$route.query.rwid,
          bjdwNumber: items.bjdwNumber,
          wbryList: [],
          zyList: [],
          zzList: [],
          orgId: sessionStorage.getItem("orgCode"),
          bjqyxzfs: this.$route.query.bjqyxzfs,
          bjdwgbList: []
        };
        if (this.$route.query.gbdwArr == "[]") {
        } else {
          let JSONgbdwArr = JSON.parse(this.$route.query.gbdwArr);
          JSONgbdwArr.forEach(item => {
            obj.bjdwgbList.push({
              gbCode: item.gbCode,
              gbName: item.gbName,
              rwId: this.$route.query.rwid
            });
          });
        }
        if (items.wbry == "" || items.wbryssdw == "") {
          console.log("1");
        } else {
          obj.wbryList.push({
            zyName: items.wbry,
            zydw: items.wbryssdw,
            zylx: 2
          });
        }

        items.zz.forEach(item => {
          this.jczList.forEach(res => {
            if (item == res.rybh) {
              obj.zzList.push({
                zyId: res.rybh,
                zyName: res.ryxm,
                zydw: res.zzjgmc,
                zyks: res.bmmc,
                zylx: 0
              });
            }
          });
        });
        items.zy.forEach(item => {
          this.jczList.forEach(res => {
            if (item == res.rybh) {
              obj.zyList.push({
                zyId: res.rybh,
                zyName: res.ryxm,
                zydw: res.zzjgmc,
                zyks: res.bmmc,
                zylx: 1
              });
            }
          });
        });
        //
        // items.bjdw.forEach(item => {
        //     this.beijiandanweiList.forEach(res => {
        //         if (item == res.qyjgdm) {
        //             obj.organizes.push({
        //                 bjdwId: res.qyjgdm,
        //                 bjdwName: res.qymc
        //             });
        //         }
        //     })
        // })

        returnData.push(obj);
      });
      // console.log(returnData)
      return returnData;
    },
    //被检单位抽取列表数据(被检单位抽取按钮)bjdwstop
    bjdwcqlbsj() {
      console.log(this.procuratorialPersonnelList);
      this.procuratorialPersonnelList.forEach(item => {
        if (
          item.zy.length == 0 ||
          item.zz.length == 0 ||
          item.bjdwNumber == ""
        ) {
          this.bjdwstop = true;
          this.$message({
            showClose: true,
            message: "请填入必填项",
            type: "warning"
          });
          return false;
        } else {
          this.bjdwstop = false;
        }
      });
      if (this.bjdwstop == false) {
        let params = this.beijianchouqushuju();
        bjdwcqsj(params)
          .then(res => {
            if (res.infoCode == 200) {
              this.bjdwdlist = res.data;
              res.data.forEach(item => {
                if (item.members == []) {
                  console.log("空");
                  // debugger
                } else {
                  this.is_shows = true;
                }
              });
            } else {
              this.$message({
                showClose: true,
                message: res.msg,
                type: "warning"
              });
            }
            console.log(res);
          })
          .catch(err => {
            this.$message({
              showClose: true,
              message: 抽取失败,
              type: "warning"
            });
          });
      }
    },
    //生成双随机时保存的数据（双随机抽取完成保存时需要的数据）
    ssjpsavelist() {
      let ssjArr = [];
      let ssjObj = {
        jczname: "",
        members: [],
        organizes: [],
        rwId: this.$route.query.rwid
      };

      ssjArr.push(ssjObj);
      return ssjArr;
    },
    //点击确定保存当前下数据(双随机保存按钮)
    save() {
      let params = this.getInf_ssj();
      savercjcfpjczxxbc(params)
        .then(res => {
          if (res.infoCode == 200) {
            this.$message({
              message: res.msg,
              type: "success"
            });
            if(this.$route.query.zdrw == 1){
              this.$router.push("/inspection/setATaskManageList");
            }else{
              this.$router.push("/inspection/dailyinspection");
            }
          } else {
            this.$message({
              showClose: true,
              message: res.data,
              type: "warning"
            });
          }
        })
        .catch(err => {
          this.$message({
            showClose: true,
            message: "保存失败",
            type: "warning"
          });
          console.log(err);
        });
    },
    //点击确定保存当前上数据(被检单位抽取保存按钮)
    save1() {
      let params = this.getInfo();
      savercjcfpjczxxbc(params)
        .then(res => {
          if (res.infoCode == 200) {
            this.$message({
              message: res.msg,
              type: "success"
            });
            if(this.$route.query.zdrw == 1){
              this.$router.push("/inspection/setATaskManageList");
            }else{
              this.$router.push("/inspection/dailyinspection");
            }
            
          } else {
            this.$message({
              showClose: true,
              message: res.data,
              type: "warning"
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    //点击取消返回列表页
    go_list() {
      this.$router.push("/inspection/dailyinspection");
    },

    //检查组双随机抽取
    jczssjcqs() {
      console.log(this.$route.query)
      // return false
      // debugger
      let params = this.setmsg();
      jczssjcq(params)
        .then(res => {
          if (res.infoCode == 200) {
            this.bjdwdlist = res.data;
            this.is_shows = true;
          } else {
            this.$message({
              showClose: true,
              message: res.data,
              type: "warning"
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },

    //（被检单位抽取完保存时的数据）
    setmsg1() {
      let arr = [];
      let obj = {
        bjdwNumber: this.bjdwsl,
        bjdwgbList: [],
        bjqyxzfs: this.$route.query.bjqyxzfs,
        companyTypeList: JSON.parse(this.$route.query.companyTypeList),
        orgId: sessionStorage.getItem("orgCode"),
        wbryList: [],
        zyList: [],
        zzList: []
      };
      // debugger

      //被检单位规避列表
      if (this.$route.query.gbdwArr.length == 0) {
      } else {
        let JSONgbdwArr = JSON.parse(this.$route.query.gbdwArr);
        JSONgbdwArr.forEach(item => {
          obj.bjdwgbList.push({
            gbCode: item.gbCode,
            gbName: item.gbName
          });
        });
      }

      //企业类型规避列表
      // if (this.$route.query.companyTypeList.length == 0) {
      // } else {
      //   let companyTypeLists = JSON.parse(this.$route.query.companyTypeList);
      //   companyTypeLists.forEach(item => {
      //     obj.companyTypeList.push({
      //       qylx: item.qylx,
      //       qylxmc: item.qylxmc
      //     });
      //   });
      // }

      //遍历组长
      if (this.value1.length == 0 || this.jczList.length == 0) {
      } else {
        this.value1.forEach(item => {
          //遍历那个数组
          this.jczList.forEach(res => {
            if (item == res.rybh) {
              obj.zzList.push({
                isCz: res.sfyz == "Y" ? 1 : 0,
                zyId: res.rybh,
                zyName: res.ryxm,
                zydw: res.zzjgmc,
                zyks: res.bmmc,
                zylx: 0
              });
            }
          });
        });
      }

      //遍历组员
      if (this.value2.length == 0 || this.jczList.length == 0) {
      } else {
        this.value2.forEach(item => {
          this.jczList.forEach(res => {
            if (item == res.rybh) {
              obj.zyList.push({
                isCz: res.sfyz == "Y" ? 1 : 0,
                zyId: res.rybh,
                zyName: res.ryxm,
                zydw: res.zzjgmc,
                zyks: res.bmmc,
                zylx: 1
              });
            }
          });
        });
      }

      obj.wbryList.push({
        zyName: this.wbry,
        zydw: this.wbrydw,
        zylx: 2
      });
      arr.push(obj);
      
      return arr;
    },

    //拼出双随机抽取的数据
    setmsg() {
      let obj = {
        bjdwgbList: [], ///
        bjqyxzfs: this.$route.query.bjqyxzfs,
        companyTypeList: JSON.parse(this.$route.query.companyTypeList),
        jczgzList: [], ///////
        jczsl: this.jczsl ? this.jczsl : 0, ////
        orgId: sessionStorage.getItem("orgCode"),
        qygbqyList: [], ////
        rygbList: [], //////////
        rygbqyList: [], /////
        rylx: [], /////
        zczyq: this.radio //////
      };

      //规避单位遍历
      if (this.$route.query.gbdwArr == "[]") {
      } else {
        let JSONgbdwArr = JSON.parse(this.$route.query.gbdwArr);
        JSONgbdwArr.forEach(item => {
          obj.bjdwgbList.push({
            gbCode: item.gbCode,
            gbName: item.gbName,
            rwId: this.$route.query.rwid
          });
        });
      }
      if (this.$route.query.gbryArr == "[]") {
      } else {
        let JSONgbryArr = JSON.parse(this.$route.query.gbryArr);
        JSONgbryArr.forEach(item => {
          obj.rygbList.push({
            gbCode: item.gbCode,
            gbName: item.gbName,
            rwId: this.$route.query.rwid
          });
        });
      }

      if (this.list1.length == 0) {
      } else {
        this.list1.forEach(item => {
          obj.jczgzList.push({
            zzNumber: item.value1,
            zyNumber: item.value2,
            bjdwNumber: item.value3,
            czryNumber: item.value4
          });
        });
      }
      // if (this.$route.query.companyTypeList.length == 0) {
      // } else {
      //   let companyTypeLists = JSON.parse(this.$route.query.companyTypeList);
      //   companyTypeLists.forEach(item => {
      //     obj.companyTypeList.push({
      //       qylx: item.qylx,
      //       qylxmc: item.qylxmc
      //     });
      //   });
      // }

      return obj;
    },
    inspectRules() {
      if (this.radio == 0) {
        this.condition = true;
      } else {
        this.condition = false;
      }
    },
    extracted() {
      console.log(this.list1);
      if (this.list1.length == 0) {
        this.$message({
          message: "请添加检查组",
          type: "warning"
        });
        return;
      }
      this.list1.forEach(item => {
        console.log(item.value1);
        if (
          item.value1 == "" ||
          item.value2 == "" ||
          item.value3 == "" ||
          item.value4 == ""
        ) {
          this.stop = true;
          this.$message({
            message: "请填入必填项",
            type: "warning"
          });
          return;
        } else {
          this.stop = false;
        }
      });
      if (this.stop == false) {
        this.jczssjcqs();
      }
    },
    go_dailyinspection() {
      this.$router.push("/inspection/dailyinspection");
    }
  }
};
</script>

<style scoped>
.btn_ {
  text-align: center;
}

.checkExtraction {
  /*border: 1px solid #ccc;*/
  padding: 10px;
}

.dashed_border {
  border: 1px dashed #ccc;
  padding: 10px;
  border-radius: 8px;
}

.title_style {
  border-left: 3px solid #409eff;
  padding-left: 4px;
  font-size: 15px;
  margin-bottom: 10px;
}

.btn_operation {
  text-align: center;
}

.checkExtraction {
  background: rgb(244, 245, 248);
  margin: 10px;
  height: 74vh;
  width: calc(100% - 30px);
  overflow: hidden;
  overflow-y: auto;
}
</style>
