<template>
  <div class="table_box">
    <div class="header">
      <el-row class="top_search_nav">
        <div>
          <el-radio-group v-model="tabPosition" @change="getClearData" v-loading="loadingGroup">
            <el-radio-button label="申请"> &nbsp;&nbsp;&nbsp;申请&nbsp;&nbsp;&nbsp; </el-radio-button>
            <el-radio-button label="监测历史">监测历史</el-radio-button>
          </el-radio-group>
        </div>
      </el-row>
    </div>
    <div v-if="tabPosition == '申请'" class="coop_table">
    <!-- 合作社评定页面 -->
    <div class="coop">
        <div class="applycontent">
            <el-card class="box-card" :style="applybg">
              <div class="apply-b">
                  <div class="h">
                    <span>
                        临安区规范化农民专业合作社申报表
                    </span>
                  </div>
                  <span style="color:#7c7c7c;padding-top:60px;">状态：{{apply}}</span>
                  <div class="btnstyle">
                      <el-button type="primary" class="applybtn" v-if="apply=='未申请'" @click="sendformHandle">立即申请</el-button>
                      <el-button type="primary" class="applybtn" v-if="apply!=='未申请'" @click="applyflowHandle(1)">申请信息</el-button>
                  </div>
              </div>
            </el-card>
            <el-card class="box-card" v-if="graybtn.background !='linear-gradient(90deg, #999999, #cccccc)'" :style="checkbg">
              <div class="apply-b">
                  <div class="h">
                    <span>
                        临安区规范化农民专业合作社监测表
                    </span>
                  </div>
                  <span style="color:#7c7c7c;padding-top:60px;">状态：{{checkapply}}</span>
                  <div class="btnstyle">
                      <!-- <el-button type="primary" class="applybtn" v-if="checkapply!=='未申请'" @click="checkfilesHandle">表单信息</el-button> -->
                      <el-button type="primary" :style="graybtn" v-if="checkapply=='未申请'" @click="checkformHandle" :disabled='disable'>
                        立即申请
                      </el-button>
                      <!-- <el-button type="primary" class="applybtn" v-if="checkapply=='审核中' || checkapply=='已驳回' || checkapply=='已通过'" @click="applyflowHandle(2)">审核进度</el-button> -->
                      <el-button type="primary" class="applybtn" v-if="checkapply!=='未申请'" @click="applyflowHandle(2)">申请信息</el-button>
                  </div>
              </div>
            </el-card>
            <el-card class="box-card" v-if="graybtn.background =='linear-gradient(90deg, #999999, #cccccc)'" style="background:linear-gradient(#999999, #cccccc);">
              <div class="apply-b">
                  <div class="h">
                    <span>
                        临安区规范化农民专业合作社监测表
                    </span>
                  </div>
                  <span style="color:#7c7c7c;padding-top:60px;">状态：未公示</span>
                  <div class="btnstyle">
                      <el-button type="primary" :style="graybtn" @click="checkformHandle" disabled>
                        立即申请
                      </el-button>
                  </div>
              </div>
            </el-card>
        </div>
    </div>
    <div style="height:80px;">
    </div>
    <!-- 合作社申报表 -->
    <el-dialog
      title="临安区规范化农民专业合作社申报表"
      :visible.sync="applyshow"
      :close-on-click-modal = "false"
      @close="closedialog"
      width="800px">
        <div class="formcontent">
            <div class="applyform">
                <div class="form">
                    <!-- 专业合作社名称、代表 -->
                    <el-form :model="formname" :rules="rules3" ref="formname" :label-position="labelPosition" label-width="150px">
                        <el-form-item label="专业合作社名称" prop="coopname">
                          <el-input v-model="formname.coopname" placeholder="专业合作社名称"></el-input>
                        </el-form-item>
                        <el-form-item label="法人代表" prop="pre">
                          <el-input v-model="formname.pre" placeholder="法人代表"></el-input>
                        </el-form-item>
                    </el-form>
                    <!-- 表单信息 -->
                    <el-form :model="formLabelAlign" :rules="rules1" ref="formLabelAlign" :label-position="labelPosition" label-width="150px">
                        <el-form-item label="详细地址" prop="coopaddr">
                          <el-input v-model="formLabelAlign.coopaddr" placeholder="专业合作社详细地址"></el-input>
                        </el-form-item>
                        <el-form-item label="联系方式" prop="tel">
                          <el-input v-model="formLabelAlign.tel" placeholder="联系方式"></el-input>
                        </el-form-item>
                        <el-form-item label="工商登记注册时间" prop="create">
                          <el-date-picker type="date" value-format="yyyy-MM-dd" placeholder="选择日期" v-model="formLabelAlign.create" style="width: 100%;"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="奖励/称号" prop="aware">
                          <el-input v-model="formLabelAlign.aware" placeholder="获得何种奖励/称号"></el-input>
                        </el-form-item>
                        <el-form-item label="成员" prop="numberper">
                          <el-input v-model="formLabelAlign.numberper" placeholder="成员数"><template slot="append">&nbsp;&nbsp;人&nbsp;&nbsp;</template></el-input>
                        </el-form-item>
                        <el-form-item label="农民成员" prop="nongmin">
                          <el-input v-model="formLabelAlign.nongmin" placeholder="农民成员数"><template slot="append">&nbsp;&nbsp;人&nbsp;&nbsp;</template></el-input>
                        </el-form-item>
                        <el-form-item label="主营产品" prop="mainpro">
                          <el-input v-model="formLabelAlign.mainpro" placeholder="主营产品名称"></el-input>
                        </el-form-item>
                        <el-form-item label="商标名称" prop="mark">
                          <el-input v-model="formLabelAlign.mark" placeholder="注册商标名称或使用品牌"></el-input>
                        </el-form-item>
                      <el-form-item label="核心基地" prop="plant">
                        <el-input v-model="formLabelAlign.plant" placeholder="种植面积（亩）/养殖量（头、只）"></el-input>
                      </el-form-item>
                      <el-form-item label="联结基地" prop="area">
                        <el-input v-model="formLabelAlign.area" placeholder="面积（亩）/养殖量（头、只）（农机植保服务合作社服务面积）"></el-input>
                      </el-form-item>
                      <el-form-item label="非成员农户" prop="cloth">
                        <el-input v-model="formLabelAlign.cloth" placeholder="带动非成员农户数"><template slot="append">&nbsp;&nbsp;户&nbsp;&nbsp;</template></el-input>
                      </el-form-item>
                      <el-form-item label="成员采购供应比" prop="common">
                        <el-input v-model="formLabelAlign.common" placeholder="统一为成员采购供应农业投入品比例"><template slot="append">&nbsp;&nbsp;%&nbsp;&nbsp;</template></el-input>
                      </el-form-item>
                      <el-form-item label="追溯方式" prop="caiyong">
                        <el-select v-model="formLabelAlign.caiyong" placeholder="请选择">
                          <el-option label="二维码" value="二维码"></el-option>
                          <el-option label="标签" value="标签"></el-option>
                          <el-option label="耳标" value="耳标"></el-option>
                        </el-select>
                      </el-form-item>
                      <el-form-item label="认证" prop="renzheng">
                        <el-input v-model="formLabelAlign.renzheng" placeholder="基地、产品得到何种认证"></el-input>
                      </el-form-item>
                      <el-form-item label="质量认证比" prop="zhiliang">
                        <el-input v-model="formLabelAlign.zhiliang" placeholder="产品质量认证比例"><template slot="append">&nbsp;&nbsp;%&nbsp;&nbsp;</template></el-input>
                      </el-form-item>
                      <el-form-item label="成员培训" prop="peixun">
                        <el-input v-model="formLabelAlign.peixun" placeholder="上年度成员培训"><template slot="append">&nbsp;&nbsp;人&nbsp;&nbsp;</template></el-input>
                      </el-form-item>
                      <el-form-item label="固定资产总额" prop="guding">
                        <el-input v-model="formLabelAlign.guding" placeholder="上年度固定资产总额"><template slot="append">万元</template></el-input>
                      </el-form-item>
                      <el-form-item label="经营收入" prop="jingying">
                        <el-input v-model="formLabelAlign.jingying" placeholder="上年度经营收入"><template slot="append">万元</template></el-input>
                      </el-form-item>
                      <el-form-item label="盈余" prop="yingkui">
                        <el-input v-model="formLabelAlign.yingkui" placeholder="上年度盈余"><template slot="append">万元</template></el-input>
                      </el-form-item>
                      <el-form-item label="盈余返还总额" prop="fanhuizonge">
                        <el-input v-model="formLabelAlign.fanhuizonge" placeholder="盈余返还总额"><template slot="append">万元</template></el-input>
                      </el-form-item>
                      <el-form-item label="交易额返还比" prop="jiaoyi">
                        <el-input v-model="formLabelAlign.jiaoyi" placeholder="按交易额返还占盈余分配比例"><template slot="append">&nbsp;&nbsp;%&nbsp;&nbsp;</template></el-input>
                      </el-form-item>
                      <el-form-item label="股金返还比" prop="gujin">
                        <el-input v-model="formLabelAlign.gujin" placeholder="按股金返还占盈余分配比例"><template slot="append">&nbsp;&nbsp;%&nbsp;&nbsp;</template></el-input>
                      </el-form-item>
                    </el-form>
                </div>
            </div>
            <div class="lastnextbtn">
                <el-button @click="clearapplyHandle">取消</el-button>
                <el-button type="primary" @click="nextapplyHandle('formLabelAlign')">下一步</el-button>
            </div>
        </div>
    </el-dialog>
    <!-- 申报表附件 -->
    <el-dialog
      title="临安区规范化农民专业合作社申报表附件"
      :visible.sync="filesapplyshow"
      :close-on-click-modal = "false"
      width="800px">
        <div class="formcontent">
            <div class="fileslist">
                <div class="items">
                    <span class="files">1.专业合作社主要情况说明</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf" :http-request="uploadHttpRequest1" :on-remove="handleRemove" :before-remove="beforeRemove"  :before-upload="beforeUpload" :on-change="successVideo"
                          :file-list="afile1"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">2.专业合作社营业执照复印件</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf" :http-request="uploadHttpRequest2" :on-remove="handleRemove" :before-upload="beforeUpload" :before-remove="beforeRemove" :on-change="successVideo"
                          :file-list="afile2"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">3.专业合作社章程</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf" :http-request="uploadHttpRequest3" :on-remove="handleRemove" :before-upload="beforeUpload" :before-remove="beforeRemove" :on-change="successVideo"
                          :file-list="afile3"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">4.成员名册及出资表</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf" :http-request="uploadHttpRequest4" :on-remove="handleRemove" :before-upload="beforeUpload" :before-remove="beforeRemove" :on-change="successVideo"
                          :file-list="afile4"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">5.成员账户</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf" :http-request="uploadHttpRequest5" :on-remove="handleRemove" :before-upload="beforeUpload" :before-remove="beforeRemove" :on-change="successVideo"
                          :file-list="afile5"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">6.上年度资产负债表、盈余及盈余分配表、成员权益变动表</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf" :http-request="uploadHttpRequest6" :on-remove="handleRemove" :before-upload="beforeUpload" :before-remove="beforeRemove" :on-change="successVideo"
                          :file-list="afile6"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">7.产品和基地认证证书复印件</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf" :http-request="uploadHttpRequest7" :on-remove="handleRemove" :before-upload="beforeUpload" :before-remove="beforeRemove" :on-change="successVideo"
                          :file-list="afile7"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">8.注册商标证书复印件或授权使用合同复印件</span>
                    <div class="unload"> 
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf" :http-request="uploadHttpRequest8" :on-remove="handleRemove" :before-upload="beforeUpload" :before-remove="beforeRemove" :on-change="successVideo"
                          :file-list="afile8"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">9.农产品生产记录和农业投入使用记录</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf" :http-request="uploadHttpRequest9" :on-remove="handleRemove" :before-upload="beforeUpload" :before-remove="beforeRemove" :on-change="successVideo"
                          :file-list="afile9"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
            </div>
            <div class="last">
                <el-button @click="aginapplyHandle">上一步</el-button>
                <el-button type="primary" @click="applylookHandle">提交</el-button>
            </div>
        </div>
    </el-dialog>
    <!-- 合作社检测表 -->
    <el-dialog
      title="临安区规范化农民专业合作社监测表"
      :visible.sync="checkshow"
      :close-on-click-modal = "false"
      @close="closedialog"
      width="800px">
        <div class="formcontent">
            <div class="applyform">
                <div class="form1">
                    <el-form :model="formcheckAlign" :rules="rules2" ref="formcheckAlign" :label-position="labelPosition" label-width="270px">
                        <el-form-item label="入社成员和农民成员比例" prop="rushe">
                          <el-input v-model="formcheckAlign.rushe"></el-input>
                          <el-tooltip content="有无增减（如有增减，说明增减数量）" placement="top">
                            <i class="el-icon-question" style="color:#ebb563;padding:13px 0 0 5px;"></i>
                          </el-tooltip>
                        </el-form-item>
                        <el-form-item label="养殖规模/农机/植保服务作业面积" prop="yangzhi">
                          <el-input v-model="formcheckAlign.yangzhi"></el-input>
                          <el-tooltip content="有无增减（如有增减，说明增减数量）" placement="top">
                            <i class="el-icon-question" style="color:#ebb563;padding:13px 0 0 5px;"></i>
                          </el-tooltip>
                        </el-form-item>
                        <el-form-item label="上年度投入品与采购供应比例" prop="shangniandu">
                          <el-input v-model="formcheckAlign.shangniandu"></el-input>
                          <el-tooltip content="有无达到80%以上，有无违规使用投入品行为" placement="top">
                            <i class="el-icon-question" style="color:#ebb563;padding:13px 0 0 5px;"></i>
                          </el-tooltip>
                        </el-form-item>
                        <el-form-item label="上年度产品质量认证比例" prop="nongchang">
                          <el-input v-model="formcheckAlign.nongchang"></el-input>
                          <el-tooltip content="农产品上市前抽检及合格证制度是否落实、上年度产品质量认证比例是否达到80%以上" placement="top">
                            <i class="el-icon-question" style="color:#ebb563;padding:13px 0 0 5px;"></i>
                          </el-tooltip>
                        </el-form-item>
                        <el-form-item label="注册商标是否有效" prop="zhuce">
                          <el-input v-model="formcheckAlign.zhuce"></el-input>
                          <el-tooltip content="注册商标或经许可使用的品牌是否在有效期内" placement="top">
                            <i class="el-icon-question" style="color:#ebb563;padding:13px 0 0 5px;"></i>
                          </el-tooltip>
                        </el-form-item>
                        <el-form-item label="上年度经营服务收入" prop="jingying">
                          <el-input v-model="formcheckAlign.jingying"></el-input>
                          <el-tooltip content="上年度经营服务收入是否达到80万元以上" placement="top">
                            <i class="el-icon-question" style="color:#ebb563;padding:13px 0 0 5px;"></i>
                          </el-tooltip>
                        </el-form-item>
                        <el-form-item label="有无完整的基本信息" prop="xinxing">
                          <el-input v-model="formcheckAlign.xinxing"></el-input>
                          <el-tooltip content="省新型农业经营主体数据库中有无完整的基本信息" placement="top">
                            <i class="el-icon-question" style="color:#ebb563;padding:13px 0 0 5px;"></i>
                          </el-tooltip>
                        </el-form-item>
                        <el-form-item label="有无不良信用记录" prop="xinyong">
                          <el-input v-model="formcheckAlign.xinyong"></el-input>
                          <el-tooltip content="有无不良信用记录" placement="top">
                            <i class="el-icon-question" style="color:#ebb563;padding:13px 0 0 5px;"></i>
                          </el-tooltip>
                        </el-form-item>
                    </el-form>
                </div>
            </div>
            <div class="lastnextbtn">
                <el-button @click="clearcheckHandle">取消</el-button>
                <el-button type="primary" @click="nextcheckHandle('formcheckAlign')">下一步</el-button>
            </div>
        </div>
    </el-dialog>
    <!-- 监测表附件 -->
    <el-dialog
      title="临安区规范化农民专业合作社监测表附件"
      :visible.sync="filescheckshow"
      :close-on-click-modal = "false"
      width="800px">
        <div class="formcontent">
            <div class="fileslist">
                <div class="items">
                    <span class="files">1.自查总结</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf"  :on-remove="handleRemove" :before-remove="beforeRemove" :http-request="uploadHttpRequestcheck1" :before-upload="beforeUpload" :on-change="successVideo"
                          :file-list="cfile1"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">2.上年度资产负债表和收益分配表</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf"  :on-remove="handleRemove" :before-remove="beforeRemove" :http-request="uploadHttpRequestcheck2" :before-upload="beforeUpload" :on-change="successVideo"
                          :file-list="cfile2"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">3.新获得各种认证、奖励证书复印件</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf"  :on-remove="handleRemove" :before-remove="beforeRemove" :http-request="uploadHttpRequestcheck3" :before-upload="beforeUpload" :on-change="successVideo"
                          :file-list="cfile3"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
                <div class="items">
                    <span class="files">4.台作社相关信息变更材料</span>
                    <div class="unload">
                        <el-upload action="#" :limit="1" class="avatar-uploader" accept=".xls,.xlsx,.doc,.docx,.pdf"  :on-remove="handleRemove" :before-remove="beforeRemove" :http-request="uploadHttpRequestcheck4" :before-upload="beforeUpload" :on-change="successVideo"
                          :file-list="cfile4"><i :class="unloadicon"></i></el-upload>
                    </div>
                </div>
            </div>
            <div class="last">
                <el-button @click="agincheckHandle">上一步</el-button>
                <el-button type="primary" @click="checklookHandle">提交</el-button>
            </div>
        </div>
    </el-dialog>
    <!-- -------审核流程------- -->
    <!-- zzzzzzzzzzzzzzzzzz -->
    <el-dialog
      title="申请信息"
      :visible.sync="checkapplyflowshow"
      :close-on-click-modal = "false"
      @close="closeflowdialog"
      width="800px">
        <div class="checkflow">
            <div class="content-box">
              <!-- 申报表审核情况 -->
                <div class="top" v-if="applynum==1">
                  <span class="title">表单详情</span>
                  <div class="content">
                    <el-descriptions style="border:1px solid #ebebeb;padding:30px 20px;" :column="1">
                      <!-- <el-descriptions-item label="专业合作社名称"><div style="width:100%;">{{applyfileObj.name}}</div></el-descriptions-item> -->
                      <!-- <el-descriptions-item label="法人代表"><div>{{applyfileObj.person}}</div></el-descriptions-item> -->
                      <el-descriptions-item label="专业合作社名称"><div style="width:100%;">{{coopname}}</div></el-descriptions-item>
                      <el-descriptions-item label="法人代表"><div>{{pre}}</div></el-descriptions-item>

                      <el-descriptions-item label="联系方式">{{applyfileObj.param.tel}}</el-descriptions-item>
                      <el-descriptions-item label="工商登记注册时间">{{applyfileObj.param.create}}</el-descriptions-item>
                      <el-descriptions-item label="专业合作社详细地址">{{applyfileObj.param.coopaddr}}</el-descriptions-item>
                      <el-descriptions-item label="获得何种奖励/称号">{{applyfileObj.param.aware}}</el-descriptions-item>
                      <el-descriptions-item label="成员数">{{applyfileObj.param.numberper}} 人</el-descriptions-item>
                      <el-descriptions-item label="农民成员数">{{applyfileObj.param.nongmin}} 人</el-descriptions-item>
                      <el-descriptions-item label="主营产品名称">{{applyfileObj.param.mainpro}}</el-descriptions-item>
                      <el-descriptions-item label="商标名称">{{applyfileObj.param.mark}}</el-descriptions-item>
                      <el-descriptions-item label="核心基地种植">{{applyfileObj.param.plant}}</el-descriptions-item>
                      <el-descriptions-item label="联结基地">{{applyfileObj.param.area}}</el-descriptions-item>
                      <el-descriptions-item label="带动非成员衣户数">{{applyfileObj.param.cloth}} 人</el-descriptions-item>
                      <el-descriptions-item label="成员采购供应比">{{applyfileObj.param.common}} %</el-descriptions-item>
                      <el-descriptions-item label="追溯方式">{{applyfileObj.param.caiyong}}</el-descriptions-item>
                      <el-descriptions-item label="基地/产品认证">{{applyfileObj.param.renzheng}}</el-descriptions-item>
                      <el-descriptions-item label="产品质量认证比">{{applyfileObj.param.zhiliang}} %</el-descriptions-item>
                      <el-descriptions-item label="上年度成员培训">{{applyfileObj.param.peixun}} 人</el-descriptions-item>
                      <el-descriptions-item label="上年度固定资产总额">{{applyfileObj.param.guding}} 万元</el-descriptions-item>
                      <el-descriptions-item label="上年度经营收入">{{applyfileObj.param.jingying}} 万元</el-descriptions-item>
                      <el-descriptions-item label="上年度盈余">{{applyfileObj.param.yingkui}} 万元</el-descriptions-item>
                      <el-descriptions-item label="盈余返还总额">{{applyfileObj.param.fanhuizonge}} 万元</el-descriptions-item>
                      <el-descriptions-item label="交易额返还比">{{applyfileObj.param.jiaoyi}} %</el-descriptions-item>
                      <el-descriptions-item label="股金返还比">{{applyfileObj.param.gujin}} %</el-descriptions-item>
                    </el-descriptions>
                      <el-table :data="applyfileObj.fileParam" style="width: 100%">
                        <el-table-column prop="name" label="附件" align="center">
                        </el-table-column>
                        <el-table-column prop="fileName" label="文件名" align="center">
                        </el-table-column>
                        <el-table-column prop="operate" align="center" label="操作">
                          <template slot-scope="scope">
                            <el-button
                              size="mini"
                              type="success"
                              @click="handleApplyEdit(scope.$index, scope.row)">下载</el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                  </div>
                  <span class="title">审核状态</span>
                  <el-descriptions class="margin-top" :column="1" :size="size" border>
                      <el-descriptions-item>
                        <template slot="label">
                          镇（街道）意见
                        </template>
                        <span class="rejectinfo ct" style="color:#2ab999;cursor:pointer;text-align:center;" v-if="townres == '驳 回'" @click="applyrejectHandle"><el-tag type="danger">{{townres}}</el-tag></span>
                        <span class="ct" v-if="townres !== '驳 回'"><el-tag type="success">{{townres}}</el-tag></span>
                      </el-descriptions-item>
                      <el-descriptions-item>
                        <template slot="label">
                          区供销总社意见
                        </template>
                        <span class="rejectinfo ct" style="color:#2ab999;cursor:pointer;" v-if="communityres == '驳 回'" @click="applyrejectHandle"><el-tag type="danger">{{communityres}}</el-tag></span>
                        <span class="ct" v-if="communityres !== '驳 回'"><el-tag type="success">{{communityres}}</el-tag></span>
                      </el-descriptions-item>
                    </el-descriptions>
                </div>
              <!-- 监测表审核情况 -->
                <div class="bottom" v-if="applynum==2">
                  <span class="title">表单详情</span>
                  <div class="content">
                    <!-- 监测表审核 -->
                    <el-descriptions style="border:1px solid #ebebeb;padding:30px 20px;" :column="1">
                      <el-descriptions-item v-for="(item,index) in checkfileObj.param" :key="index" :label="item.name">{{item.userSelfCheck}}</el-descriptions-item>
                    </el-descriptions>
                    <el-table :data="checkfileObj.fileParam" style="width: 100%">
                        <el-table-column prop="name" label="附件" align="center">
                        </el-table-column>
                        <el-table-column prop="fileName" label="文件名" align="center">
                        </el-table-column>
                        <el-table-column prop="operate" align="center" label="操作">
                          <template slot-scope="scope">
                            <el-button
                              size="mini"
                              type="success"
                              @click="handleEdit(scope.$index, scope.row)">下载</el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                  </div>
                  <span class="title">审核状态</span>
                  <!-- 监测表数据展示描述 -->
                    <el-descriptions title="区审核状态" :column="1" :size="size" border>
                      <el-descriptions-item v-for="(item,index) in checkstatusdata" :key="index">
                        <template slot="label">
                          {{item.name}}
                        </template>
                        <span class="rejectinfo ct" style="color:#2ab999;cursor:pointer;" v-if="item.status == -1" @click="rejectHandle"><el-tag type="danger">驳 回</el-tag></span>
                        <span class="ct" v-if="item.status !== -1"><el-tag type="success">{{item.status ==2?"待审核":"通 过"}}</el-tag></span>
                      </el-descriptions-item>
                    </el-descriptions>
                    <el-descriptions class="margin-top" style="margin-top:20px;" title="区总供销社意见状态" :column="1" :size="size" border>
                      <el-descriptions-item>
                        <template slot="label">
                          区供销总社意见
                        </template>
                        <span class="rejectinfo ct" style="color:#2ab999;cursor:pointer;" v-if="checkcommunityres == '驳 回'" @click="rejectHandle"><el-tag type="danger">{{checkcommunityres}}</el-tag></span>
                        <span class="ct" v-if="checkcommunityres !== '驳 回'"><el-tag type="success">{{checkcommunityres}}</el-tag></span>
                      </el-descriptions-item>
                    </el-descriptions>
                </div>
                <div class="last" v-if="applynum==1">
                  <el-button @click="cancelflowingFn">返回</el-button>
                  <el-button type="primary" @click="applycheckagain" v-if="apply == '已驳回'">复审</el-button>
                </div>
                <div class="last" v-if="applynum==2">
                  <el-button @click="cancelflowingFn">返回</el-button>
                  <el-button type="primary" @click="checkagain" v-if="checkapply == '已驳回'">复审</el-button>
                </div>
            </div>
            <!-- 申报表驳回弹框 -->
            <el-form v-if="rejectminshow" :model="rejectData" label-width="100px" class="rejectcontainer">
                <div class="cause">驳回原因</div>
                <div class="reject" style="padding:10px;box-sizing:border-box;">{{rejectmsg}}</div>
                <el-form-item class="btn">
                  <div class="lastre">
                    <el-button @click="cancelFn">取消</el-button>
                  </div>
                </el-form-item>
            </el-form>
            <!-- 监测表驳回弹框 -->
            <el-form v-if="rejectcheckshow" :model="checkrejectData" label-width="100px" class="rejectcontainer">
                <div class="cause">驳回原因</div>
                <div class="reject" style="padding:10px;box-sizing:border-box;">{{checkrejectmsg}}</div>
                <el-form-item class="btn">
                  <div class="lastre">
                    <el-button @click="cancelFn">取消</el-button>
                  </div>
                </el-form-item>
            </el-form>
        </div>
    </el-dialog>
    </div>
    <div class="checkhistory" v-if="tabPosition == '监测历史'">
      <div style="
          box-shadow: 0px 0px 10px 2px rgb(153 153 153 / 20%);
          margin-top: 20px;
          padding: 16px 16px 0 16px;
          background: #fff;
          min-height:800px;
        ">
        <Tables
          v-loading="loadingTable"
          :header="headerName"
          :data="tableData"
          :columnWidths="columnWidths"
          :slotColumns="slotColumns"
        >
          <el-table-column :resizable="false" align="center" label="序号" type="index" width="60" />
          <template width="160px" slot="coopName" slot-scope="scope">
            <div>{{ scope.row.name}}</div>
          </template>
          <template width="160px" slot="legalRepresent" slot-scope="scope">
            <span>{{ scope.row.person}}</span>
          </template>
          <template width="160px" slot="showTime" slot-scope="scope">
            <span>{{ scope.row.createTime | formatTime }}</span>
          </template>
          <template slot="oprate">
            <el-table-column label="操作" align="center">
              <template slot-scope="scope">
                <el-button
                  v-if="tabPosition == '监测历史'" @click="looklistFun(scope.row)" type="text" size="small" v-loading="btnLoading"
                  ><i class="line-icon line-edit-icon"></i>查看
                </el-button>
              </template>
            </el-table-column>
          </template>
        </Tables>
        <!--分页-->
        <div style="text-align: center" class="pagination">
          <page-nation
            :total="totals"
            @pageChange="pageChange"
            :defaultPage.sync="currentPage"
            :pageSizes="pageSizes"
          ></page-nation>
        </div>
      </div>

    </div>
    <!-- 查看监测表文件 -->
    <checkfiledialog :dataObj="checkfileObj"></checkfiledialog>
  </div>

</template>
<script>
import PageNation from "../common/PageNation.vue"
import Tables from "../common/Table.vue"
import { year_day } from "@/units/tool"
import checkfiledialog from "../cooperative/dialog/checkfiledialog.vue"
import { 
    // 提交申报表
    postApplyCooplist,
    // 提交监测表
    postApplycheckCooplist,
    // 获取申报表信息
    getapplymsg,
    // 获取监测表信息
    getcheckmsg,
    // 获取公司名和代表
    getcoop,
    // 获取监测历史
    getmonitorHis
    } from "../../apis/modules/cooperative.js";
 export default {
    name:'cooperative',
    filters: {
      formatTime(v) {
        return year_day(v);
      },
      formatProposer(val) {
        return proposerType[val];
      },
      formatStatus(val) {
        return stateMap[val];
      },
    },
    // ddddd
    data () {
     return {
      //  分页
      totals:1,
      pageSizes: [10, 30, 50, 120], //控制每页显示的条数
      currentPage: 1,
      checkfileObj:{},
      pageSize: 10,
      //  监测历史
        loadingTable:false,//loadin表格加载
        headerName: {
          coopName: "专业合作社名称",
          legalRepresent: "法人代表",
          showTime: "提交时间",
        },
        tableData:[],
        columnWidths: { state: "100px", releaseTime: "160px" }, //控制某一列的宽度，设置对应字段即可
        slotColumns: [
          "coopName",
          "legalRepresent",
          "showTime",
        ], //多个灵活调用插槽
        tabPosition: "申请",
        //公示状态
        publicityStatus:1,
        //状态边框  
        // zzzzzz
        checkbg:{
          // background: 'linear-gradient(#37CA84, #B5EAD1)'
          background: ''
        },
        applybg:{
          // background: 'linear-gradient(#FDAC17, #FAD881)'
          background: ''
        },
        // 申报表未提交为灰色
        graybtn:{
          border: 'none',
          fontSize: '18px',
          background: 'linear-gradient(90deg, #999999, #cccccc)'
        },
        disable:true,
        //表单附加弹框
        applyfileObj:{},
        checkfileObj:{},
        //判断是否都通过  
        showcoop:false,
        //保存八个审核状态
        checkstatusdata:[],
        //保存申报表信息
        applydataObj:{},
        //保存申报表信息
        checkdataObj:{},
        // 描述
        size:'',
        // 用户申报表数据
        applynum:0,
        // 申报表附件
        // zzzzzz
        afile1:[],afile2:[],afile3:[],afile4:[],afile5:[],afile6:[],afile7:[],afile8:[],afile9:[],fileList:[],
        // 监测表附件
        cfile1:[],cfile2:[],cfile3:[],cfile4:[],fileListcheck:[],
        unloadicon:'el-icon-upload avatar-uploader-icon',
        // 申报表两个意见
        townres:'',communityres:'',
        // 监测表两个意见
        checktownres:'',checkcommunityres:'',
        // 申报表驳回信息
        rejectmsg:'',
        // 监测表驳回信息
        checkrejectmsg:'',
        //  保存token
        token:'',
        // 保存用户
        userId:'',
        labelPosition: 'right',
        // 公司`法人代表
        formname: {
          coopname:'',
          pre:'',
        },
        coopname:'',
        pre:'',
        //  申报表表格提交数据
        formLabelAlign: {
          coopaddr:'',tel:'',create:'',aware:'',numberper:'',nongmin:'',mainpro:'',mark:'',
          plant:'',area:'',cloth:'',common:'',caiyong:'',renzheng:'',zhiliang:'',peixun:'',guding:'',
          jingying:'',yingkui:'',fanhuizonge:'',jiaoyi:'',gujin:''
        },
        //  监测表表格提交数据
        formcheckAlign:{rushe:'',yangzhi:'',shangniandu:'',nongchang:'',zhuce:'',jingying:'',xinxing:'',xinyong:''},
        // 申报表保存json
        paramInfo:'',
        //检测表保存数据
        paramInfocheck:{},
        //  驳回相关
        rejectData: {
          rejecttitle: ''
        },
        checkrejectData: {
          rejecttitle: ''
        },
        // 申请驳回弹框
        rejectminshow: false,
        // 监测驳回弹框
        rejectcheckshow: false,
        pageSize: 10,
        btnLoading: false,
        loadingGroup: false,
        // 状态
        apply:'未申请',
        checkapply:'未申请',
        // 点击申请报表
        applyshow: false,
        // 申报表附件
        filesapplyshow: false,
        // 点击检测表
        checkshow: false,
        filescheckshow: false,
        // 申报表\监测表流程显示
        // new RegExp(/^[1-9]\d*$/, 'g')  整数
        // new RegExp(/([1-9]\d*\.?\d*)|(0\.\d*[1-9])/,'g')   小数
        checkapplyflowshow:false,
        rules3:{
          coopname: [{ required: true, message: '请输入专业合作社名称', trigger: 'blur' }],
          pre: [{ required: true, message: '请输入法人代表', trigger: 'blur' }],
        },
        rules1:{
          // coopname: [{ required: true, message: '请输入专业合作社名称', trigger: 'blur' }],
          // pre: [{ required: true, message: '请输入法人代表', trigger: 'blur' }],
          coopaddr: [{ required: true, message: '请输入详细地址', trigger: 'blur' }],
          tel: [
            { required: true, message: '请输入联系方式', trigger: 'blur' },
            { pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: '请正确输入联系方式', trigger: 'blur' }
          ],
          create: [{ required: true, message: '请输入注册时间', trigger: 'blur' }],
          aware: [{ required: true, message: '请输入奖励和称号', trigger: 'blur' }],
          numberper: [
            { required: true, message: '请输入成员数', trigger: 'blur' },
            { pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: '必须为数字', trigger: 'blur' }
          ],
          nongmin: [
            { required: true, message: '请输入农民成员数', trigger: 'blur' },
            { pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: '必须为数字', trigger: 'blur' }
          ],
          mainpro: [{ required: true, message: '请输入主营产品', trigger: 'blur' }],
          mark: [{ required: true, message: '请输入商标名称', trigger: 'blur' }],
          plant: [{ required: true, message: '请输入核心基地内容', trigger: 'blur' }],
          area: [{ required: true, message: '请输入核心基地内容', trigger: 'blur' }],
          cloth: [{ required: true, message: '请输入带动非成员户数', trigger: 'blur' },
            { pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: '必须为数字!', trigger: 'blur' }
          ],
          common: [{ required: true, message: '请输入成员采购供应比', trigger: 'blur' },
            { pattern: new RegExp(/([1-9]\d*\.?\d*)|(0\.\d*[1-9])/,'g'), message: '必须为数字!', trigger: 'blur' }
          ],
          caiyong: [{ required: true, message: '请选择何种追溯方式', trigger: 'blur' }],
          renzheng: [{ required: true, message: '请输入认证内容', trigger: 'blur' }],
          zhiliang: [{ required: true, message: '请输入质量认证比', trigger: 'blur' },
            { pattern: new RegExp(/([1-9]\d*\.?\d*)|(0\.\d*[1-9])/,'g'), message: '必须为数字!', trigger: 'blur' }
          ],
          peixun: [{ required: true, message: '请输入成员培训数', trigger: 'blur' },
            { pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: '必须为数字!', trigger: 'blur' }
          ],
          guding: [{ required: true, message: '请输入固定资产总额', trigger: 'blur' },
            { pattern: new RegExp(/([1-9]\d*\.?\d*)|(0\.\d*[1-9])/,'g'), message: '必须为数字!', trigger: 'blur' }
          ],
          jingying: [{ required: true, message: '请输入经营收入', trigger: 'blur' },
            { pattern: new RegExp(/([1-9]\d*\.?\d*)|(0\.\d*[1-9])/,'g'), message: '必须为数字!', trigger: 'blur' }
          ],
          yingkui: [{ required: true, message: '请输入盈余', trigger: 'blur' },
            { pattern: new RegExp(/([1-9]\d*\.?\d*)|(0\.\d*[1-9])/,'g'), message: '必须为数字!', trigger: 'blur' }
          ],
          fanhuizonge: [{ required: true, message: '请输入盈余返还总额', trigger: 'blur' },
            { pattern: new RegExp(/([1-9]\d*\.?\d*)|(0\.\d*[1-9])/,'g'), message: '必须为数字!', trigger: 'blur' }
          ],
          jiaoyi: [{ required: true, message: '请输入交易额返还比', trigger: 'blur' },
            { pattern: new RegExp(/([1-9]\d*\.?\d*)|(0\.\d*[1-9])/,'g'), message: '必须为数字!', trigger: 'blur' }
          ],
          gujin: [{ required: true, message: '请输入股金返还比', trigger: 'blur' },
            { pattern: new RegExp(/([1-9]\d*\.?\d*)|(0\.\d*[1-9])/,'g'), message: '必须为数字!', trigger: 'blur' }
          ]
        },
        rules2:{
          rushe: [{ required: true, message: '请完整输入内容', trigger: 'blur' }],
          yangzhi: [{ required: true, message: '请完整输入内容', trigger: 'blur' }],
          shangniandu: [{ required: true, message: '请完整输入内容', trigger: 'blur' }],
          nongchang: [{ required: true, message: '请完整输入内容', trigger: 'blur' }],
          zhuce: [{ required: true, message: '请完整输入内容', trigger: 'blur' }],
          jingying: [{ required: true, message: '请完整输入内容', trigger: 'blur' }],
          xinxing: [{ required: true, message: '请完整输入内容', trigger: 'blur' }],
          xinyong: [{ required: true, message: '请完整输入内容', trigger: 'blur' }]
        }
      }
    },
    mounted() {
        this.token = localStorage.getItem('token')
        this.userId = localStorage.getItem('userId')
        // 获取状态
        this.applystatus()
        this.checkstatus()
        // 统一数据处理
        this.getapplymsgHandle()
        this.getcheckmsgHandle()
        // 获取合作社信息
        this.getcoopmsg()
    },
    methods: {
          //显示不同条的数据 
    pageChange(pageNum) {
      this.currentPage = pageNum.page;
      this.pageSize = pageNum.pageSize;
      this.getHistory()
    },
    // 审核查看按钮点击
    looklistFun(rowObj){
      this.checkfileObj = {
        detailDialog: true,
        param:JSON.parse(rowObj.param),
        fileParam:rowObj.fileParam,
      }
    },
    getHistory(){
      // 获取监测历史
      this.loadingTable = true;
      let params = {
        page: this.currentPage,
        pageSize: this.pageSize,
      };
      getmonitorHis(params,this.userId).then((res)=>{
        if (res.status == 0) {
          this.tableData = res.data.items
          this.totals = res.data.total
          this.tableData.forEach((item,index) => {
            this.tableData[index] = {...item,name:this.coopname,person:this.pre}
          })
          this.loadingTable = false;
        }
      })
    },
      // 点击切换
      getClearData(){
        this.currentPage = 1
        if (this.tabPosition == '监测历史') {
          this.getHistory()
        }else{
                  // 统一数据处理
          this.getapplymsgHandle()
          this.getcheckmsgHandle()
        }
      },
      // 查看信息文件下载监测表下载
        handleApplyEdit(sort, row) {
          let _this = this
          this.applyfileObj.fileParam.forEach((item,index) => {
            if (item.sort == (sort+1)) {
              _this.downLoad(item.fileUrl,item.fileName);
              this.$message({
                message: '下载成功',
                type: 'success'
              });
            }
          });
        },
        filemonitordownload(sort){
          let _this = this
          this.applyfileObj.fileParam.forEach((item,index) => {
            if (item.sort == (sort+1)) {
              _this.downLoad(item.fileUrl,item.fileName);
            }
          });
          this.$refs.textcheck[sort].innerText = '已下载'
        },
        downLoad(content, fileName) {
          var aEle = document.createElement("a"); // 创建a标签
          aEle.download = fileName; // 设置下载文件的文件名
          aEle.href = content; // content为后台返回的下载地址
          aEle.click(); // 设置点击事件
        },

        handleRemove(file, fileList) {
          this.$message({
            message: '移除成功',
            type: 'success'
          });
        },
        beforeRemove(file, fileList) {
          return this.$confirm(`确定移除 ${ file.name }？`);
        },
        // dialog里的x号关闭验证
        closedialog(){
          this.$refs['formname'].resetFields();
          this.$refs['formLabelAlign'].resetFields();
          this.$refs['formcheckAlign'].resetFields();
        },
        // zzzzzzzzzzzzzzzzzzz
        //查看申请表附件
        applyfilesHandle(){
          this.applyfileObj = {
            ...this.applyfileObj,
            name:this.coopname,
            person:this.pre
          }
        }, 
        //查看监测表附件
        checkfilesHandle(){
          this.checkfileObj = {
            ...this.checkfileObj,
          }
        }, 
        // zzzzzzzzzzzzzzzz
        // 取消审核流程
        cancelflowingFn(){
          this.rejectcheckshow = false
          this.rejectminshow = false
          this.checkapplyflowshow=false
        },
        closeflowdialog(){
          this.rejectcheckshow = false
          this.rejectminshow = false
          this.checkapplyflowshow=false
        },
        //获取公司名和法人代表
        getcoopmsg(){
          getcoop({},this.userId).then((res)=>{
            // 防止警告
            if (res.data.length == 0) {
              return false
            }
            if (res.status == 0) {
              this.coopname = res.data[0].name
              this.pre = res.data[0].person
            }
          })
        }, 
        //申报表复审按钮
        applycheckagain(){
          this.rejectminshow = false
          this.checkapplyflowshow = false
          this.applyshow =true
        },
        //监测表复审按钮
        checkagain(){
          this.rejectcheckshow = false
          this.checkapplyflowshow = false
          this.checkshow =true
        },
        // 申报表驳回信息查询
        applyrejectHandle(){
          this.rejectminshow = true
          this.getapplymsgHandle()
        },
        // 监测表驳回信息查询
        rejectHandle(){
          this.rejectcheckshow = true
          this.getcheckmsgHandle()
        },
        //申报表附件上传 
        uploadHttpRequest1(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileList.push({fileUrl:url,sort:1,fileName:data.fileName,name:'1.专业合作社主要情况说明'})
          });
        },
        uploadHttpRequest2(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileList.push({fileUrl:url,sort:2,fileName:data.fileName,name:'2.专业合作社营业执照复印件'});
          });
        },
        uploadHttpRequest3(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileList.push({fileUrl:url,sort:3,fileName:data.fileName,name:'3.专业合作社章程'});
          });
        },
        uploadHttpRequest4(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileList.push({fileUrl:url,sort:4,fileName:data.fileName,name:'4.成员名册及出资表'});
          });
        },
        uploadHttpRequest5(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileList.push({fileUrl:url,sort:5,fileName:data.fileName,name:'5.成员账户'});
          });
        },
        uploadHttpRequest6(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileList.push({fileUrl:url,sort:6,fileName:data.fileName,name:'6.上年度资产负债表、盈余及盈余分配表、成员权益变动表'});
          });
        },
        uploadHttpRequest7(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileList.push({fileUrl:url,sort:7,fileName:data.fileName,name:'7.产品和基地认证证书复印件'});
          });
        },
        uploadHttpRequest8(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileList.push({fileUrl:url,sort:8,fileName:data.fileName,name:'8.注册商标证书复印件或授权使用合同复印件'});
          });
        },
        uploadHttpRequest9(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileList.push({fileUrl:url,sort:9,fileName:data.fileName,name:'9.农产品生产记录和农业投入使用记录'});
          });
        },
        // 检测表附件上传
        uploadHttpRequestcheck1(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileListcheck.push({fileUrl:url,sort:1,fileName:data.fileName,name:'1.自查总结'});
          });
        },
        uploadHttpRequestcheck2(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileListcheck.push({fileUrl:url,sort:2,fileName:data.fileName,name:'2.上年度资产负债表和收益分配表'});
          });
        },
        uploadHttpRequestcheck3(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileListcheck.push({fileUrl:url,sort:3,fileName:data.fileName,name:'3.新获得各种认证、奖励证书复印件'});
          });
        },
        uploadHttpRequestcheck4(res) {
          this._getFileByOss(res.file, (url, data) => {
            this.fileListcheck.push({fileUrl:url,sort:4,fileName:data.fileName,name:'4.台作社相关信息变更材料'});
          });
        },
        // 上传文件前判断文件
        beforeUpload(file) {
          const fileType = file.name.substring(file.name.lastIndexOf("."));
          if (fileType.toLowerCase() != ".xls" && fileType.toLowerCase() != ".xlsx" && fileType.toLowerCase() != ".doc" && fileType.toLowerCase() != ".docx" && fileType.toLowerCase() != ".pdf"  ){
            this.$message.error("上传的文件格式错误");
            return false;
          }
        },
        successVideo(file, fileList){
          if(file.size > 1000000){
            this.loading = true;
            this.$message({
              message: '文件过大，正在上传中，请稍等',
              type: 'warning'
            });
          }
        },
        // 申请合作社按钮
        applyHandle(){
        },
        delHandle(){
        },
        // // 1、申报表部分
        applystatus(){
            // 获取申报表信息
            getapplymsg({},this.userId).then((res)=>{
                if (res.status==0) {
                  if (res.data[0]==null || res.data[0]==undefined) {
                    this.apply = "未申请"
                    this.applybg.background = 'linear-gradient(#37CA84, #B5EAD1)'
                  }else if (res.data[0].status == 2) {
                    this.apply = "审核中"
                    this.applybg.background ='linear-gradient(#FDAC17, #FAD881)'
                  }else if (res.data[0].status == 1) {
                    this.apply = "已通过"
                    this.applybg.background ='linear-gradient(#81d2d8, #78e3ed)'
                  }else{
                    this.apply = "已驳回"
                    this.applybg.background ='linear-gradient(#f92f2d, #fbc4c4)'
                  }
                }
                if (this.apply == '已通过'&&this.checkapply == '已通过') {
                  this.showcoop = true
                }
            })
        },
        // // 点击立即申请申报表
        sendformHandle(){
          this.applyshow = true
        },
        // // 取消申报表按钮
        clearapplyHandle(){
            this.applyshow = false
            // 防止验证报错
            this.$refs['formname'].resetFields();
            this.$refs['formLabelAlign'].resetFields();
        },
        // // 下一步申报表按钮
        nextapplyHandle(formName){
          this.$refs["formname"].validate((valid) => {
            if (valid) {
              this.coopname = this.formname.coopname
              this.pre = this.formname.pre
            } else {
              return false;
            }
          })
          this.$refs[formName].validate((valid) => {
            if (valid) {
              this.paramInfo = JSON.stringify(this.formLabelAlign)
              this.filesapplyshow = true
              this.applyshow = false
            } else {
              this.$message({
                message: '请完整填写内容',
                type: 'error'
              });
              return false;
            }
          });
        },
        //申报表提交按钮
        applylookHandle(){
            // 文件上传
            let data = {fileList:this.fileList,paramInfo:this.paramInfo,token:this.token,name:this.coopname,person:this.pre}
            // 提交申报表
            postApplyCooplist(data).then((res) => {
              if (res.status == 0) {
                this.applystatus()
                this.checkstatus()
                // 再次获取数据
                this.getapplymsgHandle()
                this.$message({
                  message: '已提交',
                  type: 'success'
                });
              }
            });
            // 数据清除
            this.afile1=[];this.afile2=[];this.afile3=[];this.afile4=[];this.afile5=[];this.afile6=[];this.afile7=[];this.afile8=[];this.afile9=[];
            this.fileList = []
            for(let key in this.formname){
              this.formname[key] = ''
            }
            for(let key in this.formLabelAlign){
              this.formLabelAlign[key] = ''
            }
            this.filesapplyshow = false
        },
        // 上一步申报表按钮
        aginapplyHandle(){
          // 上一步数据返回
          this.formname.coopname = this.coopname
          this.formname.pre = this.pre
          this.formLabelAlign = JSON.parse(this.paramInfo)
          this.filesapplyshow = false
          this.applyshow = true
        },
        // 2、监测表部分
        checkstatus(){
            // 获取监测表信息
            getcheckmsg({},this.userId).then((res)=>{
              if (res.status==0) {
                if (res.data[0]==null || res.data[0]==undefined) {
                  this.checkapply = "未申请"
                  this.checkbg.background = 'linear-gradient(#37CA84, #B5EAD1)'
                }else if (res.data[0].status == 2) {
                  this.checkapply = "审核中"
                  this.checkbg.background ='linear-gradient(#FDAC17, #FAD881)'
                }else if (res.data[0].status == 1) {
                  this.checkapply = "已通过"
                  this.checkbg.background ='linear-gradient(#81d2d8, #78e3ed)'
                }else{
                  this.checkapply = "已驳回"
                  this.checkbg.background ='linear-gradient(#f92f2d, #fbc4c4)'
                }
              }

            })
        },
        // 点击申请监测表
        checkformHandle(){
          // 合作社信息赋值给监测表
          this.checkshow = true
        },
        // 取消监测表按钮
        clearcheckHandle(){
          this.checkshow = false
          this.$refs['formcheckAlign'].resetFields()
        },
        // 下一步监测表按钮
        nextcheckHandle(formName){
            this.$refs[formName].validate((valid) => {
              if (valid) {
                // 监测表的内容
                this.paramInfocheck = {
                  ...this.formcheckAlign
                }
                this.filescheckshow = true
                this.checkshow = false
              } else {
                this.$message({
                  message: '请完整填写内容',
                  type: 'error'
                });
                return false;
              }
            });

        },
        // // 监测表审核按钮
        checklookHandle(){
            // paramInfo的数据处理
            let paramdata = [{key: "number",name: "入社成员和农民成员比例",desc: "如有增减，说明增 减数量",
              userSelfCheck: this.paramInfocheck.rushe,
              sort: 0,reviewNumber: [{reviewId: "1",status: 2,desc: "意见"}],
              "status": 2
            },{key: "number1",name: "养殖规模/农机/植保服务作业面积",desc: "如有增减，说明增 减数量1111",
              userSelfCheck: this.paramInfocheck.yangzhi,
              sort: 1,reviewNumber: [{reviewId: "2",status: 2,desc: "意见"}],
              "status": 2
            },{key: "number2",name: "上年度投入品与采购供应比例",desc: "如有增减，说明增 减数量1111",
              userSelfCheck: this.paramInfocheck.shangniandu,
              sort: 2,reviewNumber: [{reviewId: "3",status: 2,desc: "意见"}],
              "status": 2
            },{key: "number3",name: "上年度产品质量认证比例",desc: "如有增减，说明增 减数量1111",
              userSelfCheck: this.paramInfocheck.nongchang,
              sort: 3,reviewNumber: [{reviewId: "4",status: 2,desc: "意见"}],
              "status": 2
            },{key: "number4",name: "注册商标是否有效",desc: "如有增减，说明增 减数量1111",
              userSelfCheck: this.paramInfocheck.zhuce,
              sort: 4,reviewNumber: [{reviewId: "5",status: 2,desc: "意见"}],
              "status": 2
            },{key: "number5",name: "上年度经营服务收入",desc: "如有增减，说明增 减数量1111",
              userSelfCheck: this.paramInfocheck.jingying,
              sort: 5,reviewNumber: [{reviewId: "6",status: 2,desc: "意见"}],
              "status": 2
            },{key: "number6",name: "有无完整的基本信息",desc: "如有增减，说明增 减数量1111",
              userSelfCheck: this.paramInfocheck.xinxing,
              sort: 6,reviewNumber: [{reviewId: "7",status: 2,desc: "意见"}],
              "status": 2
            },{key: "number7",name: "有无不良信用记录",desc: "如有增减，说明增 减数量1111",
              userSelfCheck: this.paramInfocheck.xinyong,
              sort: 7,reviewNumber: [{reviewId: "8",status: 2,desc: "意见"}],
              "status": 2
            }
            ]
            // 转json字符串
            let paramInfo = JSON.stringify(paramdata)
            // 监测表附件
            let data = {fileList:this.fileListcheck,paramInfo,token:this.token,name:this.coopname,person:this.pre}
            postApplycheckCooplist(data).then((res) => {
              if (res.status == 0) {
                this.$message({
                  message: '已提交',
                  type: 'success'
                });
                this.checkstatus()
                this.applystatus()
                this.getcheckmsgHandle()
                this.filescheckshow = false
              }
            });
            // 数据清除
            this.cfile1=[];this.cfile2=[];this.cfile3=[];this.cfile4=[]
            this.fileListcheck=[]
            for(let key in this.formcheckAlign){
              this.formcheckAlign[key] = ''
            }
        },
        // 上一步申报表按钮
        agincheckHandle(){
            this.formcheckAlign = this.paramInfocheck
            this.filescheckshow = false
            this.checkshow = true
        },
        // 查看审核进度
        // 统一数据处理 获取表格信息 获取审核状态
        getapplymsgHandle(){
            getapplymsg({},this.userId).then((res)=>{
              if (res.data[0] == undefined) {
                return
              }
              if (res.status == 0) {
                if (res.data[0].publicityStatus == 0) {
                  this.disable = false
                  this.graybtn.background = 'linear-gradient(90deg, #34c49b, #34bdba)' 
                }else{
                  this.disable = true
                  this.graybtn.background = 'linear-gradient(90deg, #999999, #cccccc)'
                }
                this.applydataObj = {
                  ...res.data[0],
                  paramInfo:JSON.parse(res.data[0].paramInfo),
                  param:JSON.parse(res.data[0].param)
                }
                this.rejectmsg = this.applydataObj.rejectInfo
                // 申报表表单/附件
                this.applyfileObj = {
                  param:JSON.parse(res.data[0].param),
                  fileParam:res.data[0].fileParam
                }
              }
            })
        },
        getcheckmsgHandle(){
            getcheckmsg({},this.userId).then((res)=>{
              if (res.data[0] == undefined) {
                return
              }
              if (res.status == 0) {
                this.checkdataObj = {
                  ...res.data[0],
                  paramInfo:JSON.parse(res.data[0].paramInfo),
                  param:JSON.parse(res.data[0].param)
                }
                this.checkrejectmsg = this.checkdataObj.rejectInfo
                // 监测表表单/附件
                this.checkfileObj = {
                  param:JSON.parse(res.data[0].param),
                  fileParam:res.data[0].fileParam
                }           
              }

            })
        },
        // num:1 请求申报表 2 请求监测表（获取状态、驳回信息等）
        applyflowHandle(num){
          if (num == 1) {
            // zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
            this.applyfilesHandle()
            this.applynum = num
            getapplymsg({},this.userId).then((res)=>{
                // 审核流程的申报表
                let advice = JSON.parse(res.data[0].paramInfo)
                if (advice[0].status == 2) {
                  this.townres = '待审核'
                }else if (advice[0].status == 1) {
                  this.townres = '通 过'
                }else{
                  this.townres = '驳 回'
                }
                if (advice[1].status == 2) {
                  this.communityres = '待审核'
                }else if (advice[1].status == 1) {
                  this.communityres = '通 过'
                }else{
                  this.communityres = '驳 回'
                }
            })
          }else if(num == 2){
            this.checkfilesHandle()
            this.applynum = num
            getcheckmsg({},this.userId).then((res)=>{
              this.checkstatusdata = JSON.parse(res.data[0].param)
              let advice = JSON.parse(res.data[0].paramInfo)
              if (advice[0].status == 2) {
                this.checktownres = '待审核'
              }else if (advice[0].status == 1) {
                this.checktownres = '通 过'
              }else{
                this.checktownres = '驳 回'
              }
              if (advice[1].status == 2) {
                this.checkcommunityres = '待审核'
              }else if (advice[1].status == 1) {
                this.checkcommunityres = '通 过'
              }else{
                this.checkcommunityres = '驳 回'
              }
            })
          }
          this.checkapplyflowshow = true
        },
        // 取消
        cancelFn(){
          this.rejectminshow = false
          this.rejectcheckshow = false
          this.rejectData = {}
          this.checkrejectData = {}
        }
    },
    components: {
       PageNation,
       Tables,
       checkfiledialog
    }
 }
</script>
<style lang="scss" scoped>
.header{
  margin: 30px 0;
}
/* 表单填写样式 */
.form{
  padding-left: 100px;
  width: 500px;
}
.form1{
  width: 500px;
  padding-left: 100px;
  /deep/ .el-form-item__content{
    display: flex;
    justify-content: space-around;
  }
}
.coop_table{
    position: relative;
}
/* 申报表样式 */
.applycontent{
    display: flex;
    flex-direction: column;
    justify-content: center;
    /deep/ .el-card__body{
      padding: 0;
    }
    /* zzzzzz */
    .box-card{
      margin: 15px 0;
      border-radius: 10px;
      border-left: 20px solid transparent;
    }
    .apply-b{
      background-color: #fff;
      display: flex;
      height: 140px;
      justify-content: space-between;
      .h{
        display: flex;
        justify-content: center;
        align-items: center;
        color: #000000;
        padding-left: 20px;
        font-weight: bold;
        font-size: 24px;
      }
    }
}
/* 审核流程样式 */
.ct{
  display: block;
  text-align: center;
}
.checkflow{
  .content-box{
    .title{
      display: block;
      width: 100%;
      text-align: center;
      font-size: 18px;
      color: #000000;
      margin: 0 0 30px 0;
    }
    .title:nth-of-type(2){
      margin: 30px 0 30px 0;
    }
    /* 描述样式 */
    /deep/ .el-descriptions-item__label{
      width: 300px;
    }
  }
}
.rejectcontainer{
  .reject{
    margin: 20px;
    height: 50%;
    border: 1px solid #cccccc;
  }
  background-color: #fff;
  .cause{
    width: 100%;
    font-size: 18px;
    text-align: center;
    line-height: 40px;
    background:#2ab999;

  }
  border: 1px solid #cccccc;
  position: absolute;
  width: 50%;
  left: 0;top: 0;bottom: 0;right: 0;margin: auto;
  height: 270px;
/deep/ .el-form-item__content{
    width: 90%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-left: 0 !important;
  }
}
/deep/ .el-dialog__header {
  background: #2ab999;
  .el-dialog__title {
    color: white;
  }
}
/* 按钮右下角 */
.lastnextbtn{width: 81%;display: flex;justify-content: flex-end;}
.last{width: 100%;display: flex;justify-content: flex-end;margin-top: 20px;}
.lastre{display: flex;justify-content: flex-end;}
/* 附件的颜色 */
.fileslist{
  .items{display: flex;justify-content: space-between;padding: 10px;}
  .el-icon-upload{
    color: #2ab999;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-size: 30px;
  }
}
/* 状态样式 */
.status{
  margin-bottom: 20px;
  display: flex;
  justify-content: flex-end;
  .state{
    padding:0 30px 0 15px;
    line-height: 30px;
  }
}
/* 弹框滚动条 */
/deep/ .el-dialog__body {
  max-height: 62vh;
  overflow: auto;
}
/* 审核进度按钮样式 */
.btnstyle{
  display: flex;
  justify-content: center;
  align-items: center;
  padding-right: 20px;
  .applybtn{
    border: none;
    font-size: 18px;
    background: linear-gradient(90deg, #34c49b, #34bdba);
  }
}
/* 附件x号 */
/deep/ .el-upload-list{
  /* background:red; */
  .el-icon-close{
    padding-top: 3px;
    display: block;
    border-radius: 50%;
    font-size: 12px;
  }
  .el-icon-close::before{
    color: red !important;
  }
}
/deep/ .el-upload-list:hover{
  /* background:red; */
  opacity: 1;
}
.el-tag{
  width: 58px;
}
</style>
