<template>
  <div style="flex:1;" class="flex">
    <button class="btn btn-xs" v-show="!criteriaShow" @click="show()">
      <span class="glyphicon glyphicon-chevron-down" style="color: #000;"></span>
    </button>
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' v-show="$parent.criteriaShow" @condition-changed='$parent.search' v-ref:criteria>
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
          <div class="row">
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">街&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;道</label>
              <input type="text" class="form-control" v-model="model.f_street" id="f_street"
                     style="height:34px;margin-top: 8px"
                     placeholder="街道" condition="tua.f_street like '%{}%'">
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">小&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区</label>
              <input type="text" class="form-control" v-model="model.f_residential_area"
                     style="height:34px;margin-top: 8px"
                     placeholder="小区" condition="tua.f_residential_area like '%{}%'">
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">楼&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</label>
              <input type="text" class="form-control" v-model="model.f_building" id="f_building"
                     style="height:34px;margin-top: 8px"
                     placeholder="楼号" condition="tua.f_building = '{}'">
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">单&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;元</label>
              <input type="text" class="form-control" v-model="model.f_unit" style="height:34px;margin-top: 8px"
                     placeholder="单元" condition="tua.f_unit = '{}'">
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">用户状态</label>
              <v-select
                placeholder='用户状态'
                :value-single="true" style="margin-top: 8px"
                :value.sync="$parent.$parent.model.f_table_state"
                :options='$parent.$parent.tableStates'
                v-model="$parent.$parent.model.f_table_state"
                close-on-select clear-button></v-select>
            </div>
          </div>
          <div class="row">
            <div class="col-sm-3 form-group form-input-group" style="width: 20%"
                 v-if="$parent.$parent.model.SafeCheckXZ == '应安检'">
              <label class="control-label">应检起始</label>
              <datepicker
                :value.sync="$parent.$parent.model.f_shouldcheck_start"
                placeholder='应检时间起始'
                :disabled-days-of-week="[]"
                :format="'yyyy-MM-dd'" style="margin-top: 8px"
                :show-rest-button="reset"
                v-model="$parent.$parent.model.f_shouldcheck_start">
              </datepicker>
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%"
                 v-if="$parent.$parent.model.SafeCheckXZ == '应安检'">
              <label class="control-label">应检结束</label>
              <datepicker
                :value.sync="$parent.$parent.model.f_shouldcheck_end"
                placeholder='应检时间结束' style="margin-top: 8px"
                :disabled-days-of-week="[]"
                :format="'yyyy-MM-dd'"
                :show-rest-button="reset"
                v-model="$parent.$parent.model.f_issue_end"
              >
              </datepicker>
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%"
                 v-if="$parent.$parent.model.SafeCheckXZ != '未安检' && $parent.$parent.model.SafeCheckSC != ''">
              <label class="control-label">生成起始</label>
              <datepicker
                :value.sync="$parent.$parent.model.f_issue_start"
                placeholder='最后生成时间起始' style="margin-top: 8px"
                :disabled-days-of-week="[]"
                :format="'yyyy-MM-dd'"
                :show-rest-button="reset"
                v-model="$parent.$parent.model.f_issue_start">
              </datepicker>
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%"
                 v-if="$parent.$parent.model.SafeCheckXZ != '未安检' && $parent.$parent.model.SafeCheckSC != ''">
              <label class="control-label">生成结束</label>
              <datepicker style="margin-top: 8px"
                          :value.sync="$parent.$parent.model.f_issue_end"
                          placeholder='最后生成时间结束'
                          :disabled-days-of-week="[]"
                          :format="'yyyy-MM-dd'"
                          :show-rest-button="reset"
                          v-model="$parent.$parent.model.f_issue_end"
              >
              </datepicker>
            </div>
          </div>
          <div class="row">
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">建档日期</label>
              <datepicker
                :value.sync="model.f_createfile_date"
                placeholder='建档日期'
                :disabled-days-of-week="[]"
                condition="ui.f_createfile_date >= '{}'"
                :format="'yyyy-MM-dd'"
                v-model="model.f_createfile_date">
              </datepicker>
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">气表品牌</label>
              <v-select placeholder='气表品牌'
                        :value-single="true" style="margin-top: 8px"
                        :value.sync="model.f_meter_brand"
                        :options='$parent.$parent.f_meter_brands'
                        condition="gb.f_meter_brand = '{}'"
                        v-model="model.f_meter_brand"
                        close-on-select clear-button></v-select>
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">开始卡号</label>
              <input type="text" class="form-control" v-model="model.f_card_id_start"
                     style="height:34px;margin-top: 8px"
                     placeholder="开始卡号" condition="ui.f_userinfo_code >= '{}'">
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">结束卡号</label>
              <input type="text" class="form-control" v-model="model.f_card_id_end" style="height:34px;margin-top: 8px"
                     placeholder="结束卡号" condition="ui.f_userinfo_code <= '{}'">
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">新档案</label>
              <v-select placeholder='是否第二套档案'
                        :value-single="true" style="margin-top: 8px"
                        :value.sync="model.f_second_state"
                        v-model="model.f_second_state"
                        condition="ui.f_second_state {} "
                        :options='$parent.$parent.is_to_userinfos'
                        close-on-select clear-button></v-select>
            </div>
          </div>
          <div class="row">

            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">小区ID</label>
              <input type="text" class="form-control" v-model="model.oldareaid" style="height:34px;margin-top: 8px"
                     placeholder="小区ID" condition="tua.oldareaid = '{}'">
            </div>
            <div class="col-sm-3 form-group form-input-group" style="width: 20%">
              <label class="control-label">在用状态</label>
              <v-select placeholder='在用状态'
                        :value-single="true" style="margin-top: 8px"
                        :value.sync="$parent.$parent.is_reuse_state"
                        :options='$parent.$parent.is_reuse_states'
                        v-model="$parent.$parent.is_reuse_state"
                        close-on-select clear-button></v-select>
            </div>


            <div class="span" style="float:right;margin-top:5px">
              <button class="button_search button_spacing" @click="search()">查询</button>
              <button type="button" class="button_export button_spacing" @click="$parent.$parent.ToShowTemplate()"
                      v-if="!$parent.$parent.checkplan">生成计划
              </button>
              <button type="button" class="button_export button_spacing" @click="$parent.$parent.AllPlan()"
                      v-if="!$parent.$parent.checkplan">全部生成
              </button>
              <button class="btn" @click="$parent.$parent.hidden()">
                <span class="glyphicon glyphicon-chevron-up"></span>
              </button>
            </div>
          </div>
          <modal :show.sync="$parent.$parent.showModal" v-ref:modal backdrop="false">
            <div slot="modal-header" class="modal-header">
              <h4 class="modal-title">
                生成计划
              </h4>
            </div>
            <div slot="modal-body" class="modal-body">
              <div class="row">
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">计划名称</label>
                  <input class="form-control" type="text" v-model="$parent.$parent.checkboxModel.f_plan_name"
                         placeholder="计划名称(必填)">
                </div>

                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">计划年份</label>
                  <v-select id="c_plan_year" :value.sync="$parent.$parent.f_plan_year" :value-single="true"
                            :options='$parent.$parent.c_year_list' close-on-select clear-button></v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">计划月份</label>
                  <v-select id="c_plan_month" :value.sync="$parent.$parent.f_plan_month" :value-single="true"
                            :options='$parent.$parent.c_month_list' close-on-select clear-button></v-select>
                </div>

              </div>
            </div>
            <div slot="modal-footer" class="modal-footer">
              <button type="button" class="button_spacing button_search" @click="$parent.$parent.confirm">生成</button>
              <button type="button" class="button_spacing button_clear" @click="$parent.$parent.cancel">取消</button>
            </div>
          </modal>
          <modal :show.sync="$parent.$parent.showTemplateGenerate" v-ref:modal backdrop="false">
            <div slot="modal-header" class="modal-header">
              <h4 class="modal-title">
                计划模板
              </h4>
            </div>
            <h4>用户基本信息</h4>
            <hr>
            <div slot="modal-body" class="modal-body">
              <div class="row">
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">区&ensp;/&ensp;县</label>
                  <input class="form-control" type="text" style="width: 60%"
                         v-model="$parent.$parent.templateInfo[0].value" placeholder="区/县"/>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">街&ensp;&ensp;&ensp;&ensp;道</label>
                  <input class="form-control" type="text" style="width: 60%"
                         v-model="$parent.$parent.templateInfo[1].value" placeholder="街道"/>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">小区性质</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[2].value"
                            v-model="$parent.$parent.templateInfo[2].value"
                            :options='$parent.$parent.communityNature'
                            placeholder='小区性质'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">小区&ensp;&ensp;ID</label>
                  <input class="form-control" type="text" style="width: 60%" readonly disabled
                         v-model="$parent.$parent.checkrows[0].oldareaid" placeholder="小区ID"/>
                </div>


                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">所属区域</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[3].value"
                            v-model="$parent.$parent.templateInfo[3].value"
                            :options='$parent.$parent.area'
                            placeholder='所属区域'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">运行区域</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[23].value"
                            v-model="$parent.$parent.templateInfo[23].value"
                            :options='$parent.$parent.opera_areas'
                            placeholder='运行区域'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">供暖方式</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[4].value"
                            v-model="$parent.$parent.templateInfo[4].value"
                            :options='$parent.$parent.heatingMethod'
                            placeholder='供暖方式'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">租&ensp;&ensp;&ensp;&ensp;住</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[5].value"
                            v-model="$parent.$parent.templateInfo[5].value"
                            :options='$parent.$parent.rents'
                            placeholder='租住'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">用气设备</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[6].value"
                            v-model="$parent.$parent.templateInfo[6].value"
                            :options='$parent.$parent.equipmens'
                            placeholder='用气设备'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
              </div>
              <h4>燃气表</h4>
              <hr>
              <div class="row">
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">表&ensp;&ensp;&ensp;&ensp;型</label>
                  <input class="form-control" type="text" style="width: 60%" readonly disabled
                         v-model="$parent.$parent.templateInfo[7].value" placeholder="表型"/>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">左右表&ensp;&ensp;</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[8].value"
                            v-model="$parent.$parent.templateInfo[8].value"
                            :options='$parent.$parent.leftRightTable'
                            placeholder='左右表'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">生产时间</label>
                  <datepicker
                    :value.sync="$parent.$parent.templateInfo[9].value"
                    placeholder='生产时间'
                    :disabled-days-of-week="[]"
                    :format="'yyyy-MM-dd'"
                    style="width: 60%;"
                    :show-rest-button="reset"
                    v-model="$parent.$parent.templateInfo[9].value">
                  </datepicker>
                </div>
                <!--<div class="col-sm-6  form-group form-fix-width">-->
                <!--<label class="control-label">基表厂家</label>-->
                <!--<v-select :value.sync="$parent.$parent.templateInfo[10].value"-->
                <!--v-model="$parent.$parent.templateInfo[10].value"-->
                <!--:options='$parent.$parent.baseWatchManufacturer'-->
                <!--placeholder='基表厂家'-->
                <!--value-single-->
                <!--close-on-select>-->
                <!--</v-select>-->
                <!--</div>-->
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">基表读数</label>
                  <input class="form-control" type="text" style="width: 60%;"
                         v-model="$parent.$parent.templateInfo[11].value"
                         placeholder="基表读数"/>
                </div>
                <!--<div class="col-sm-6  form-group form-fix-width">-->
                <!--<label class="control-label">IC卡表厂家</label>-->
                <!--<v-select :value.sync="$parent.$parent.templateInfo[12].value"-->
                <!--v-model="$parent.$parent.templateInfo[12].value"-->
                <!--:options='$parent.$parent.icCardManufacturer'-->
                <!--placeholder='IC卡表厂家'-->
                <!--value-single-->
                <!--close-on-select>-->
                <!--</v-select>-->
                <!--</div>-->
                <!--                <div class="col-sm-6  form-group form-fix-width">
                                  <label class="control-label">IC卡表类型</label>
                                  <v-select :value.sync="$parent.$parent.templateInfo[13].value"
                                            v-model="$parent.$parent.templateInfo[13].value"
                                            :options='$parent.$parent.icCardType'
                                            placeholder='IC卡表类型'
                                            :value-single="true"
                                            close-on-select>
                                  </v-select>
                                </div>-->
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">剩余气量</label>
                  <input class="form-control" type="text" style="width: 60%;"
                         v-model="$parent.$parent.templateInfo[14].value"
                         placeholder="剩余气量"/>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">剩余金额</label>
                  <input class="form-control" type="text" style="width: 60%;"
                         v-model="$parent.$parent.templateInfo[15].value"
                         placeholder="剩余金额"/>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">表&ensp;&ensp;&ensp;&ensp;封</label>

                  <v-select :value.sync="$parent.$parent.templateInfo[16].value"
                            v-model="$parent.$parent.templateInfo[16].value"
                            :options='$parent.$parent.tableSeal'
                            placeholder='表封'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
              </div>
              <h4>报警器</h4>
              <hr>
              <div class="row">
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">有&ensp;&ensp;&ensp;&ensp;否</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[24].value"
                            v-model="$parent.$parent.templateInfo[24].value"
                            :options='$parent.$parent.IsThereAnAlarms'
                            placeholder='有否'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">厂&ensp;&ensp;&ensp;&ensp;家</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[17].value"
                            v-model="$parent.$parent.templateInfo[17].value"
                            :options='$parent.$parent.alarmManufacturer'
                            placeholder='厂家'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">安装时间</label>
                  <datepicker
                    :value.sync="$parent.$parent.templateInfo[18].value"
                    placeholder='安装时间'
                    :disabled-days-of-week="[]"
                    :format="'yyyy-MM-dd'"
                    style="width: 60%;"
                    :show-rest-button="reset"
                    v-model="$parent.$parent.templateInfo[18].value">
                  </datepicker>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">到期时间</label>
                  <datepicker
                    :value.sync="$parent.$parent.templateInfo[19].value"
                    placeholder='到期时间'
                    :disabled-days-of-week="[]"
                    :format="'yyyy-MM-dd'"
                    :show-rest-button="reset"
                    style="width: 60%;"
                    v-model="$parent.$parent.templateInfo[19].value">
                  </datepicker>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">是否通电</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[20].value"
                            v-model="$parent.$parent.templateInfo[20].value"
                            :options='$parent.$parent.alarmPower'
                            placeholder='是否通电'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
                <div class="col-sm-6  form-group form-fix-width">
                  <label class="control-label">安装渠道</label>
                  <v-select :value.sync="$parent.$parent.templateInfo[21].value"
                            v-model="$parent.$parent.templateInfo[21].value"
                            :options='$parent.$parent.alarmInstallationChannel'
                            placeholder='安装渠道'
                            :value-single="true"
                            close-on-select>
                  </v-select>
                </div>
              </div>
            </div>
            <div slot="modal-footer" class="modal-footer">
              <button type="button" class="button_spacing button_search" @click="$parent.$parent.ToShowModal">
                生成计划
              </button>
              <button type="button" class="button_spacing button_clear" @click="$parent.$parent.cancel">取消</button>
            </div>
          </modal>
        </div>
      </criteria>
      <data-grid :model="model" partial="list" class="table table-bordered table table-hover" v-ref:grid>
        <template partial='head'>
          <tr>
            <!--<th>-->
            <!--<nobr>全选<input type="checkbox" @click='$parent.$parent.$parent.changeStates'-->
            <!--v-model='$parent.$parent.$parent.checkedAll'></nobr>-->
            <!--</th>-->
            <th>
              <nobr></nobr>
            </th>
            <th>
              <nobr>小区编号</nobr>
            </th>
            <th>
              <nobr>区/县</nobr>
            </th>
            <!--            <th> <nobr>街道</nobr> </th>-->
            <th>
              <nobr>小区名称</nobr>
            </th>

            <th>
              <nobr>小区地址</nobr>
            </th>
            <th>
              <nobr>用户类型</nobr>
            </th>
            <th>
              <nobr>用户数量</nobr>
            </th>
            <th>
              <nobr>小区气表品牌</nobr>
            </th>
            <th v-if="$parent.model.f_table_state != ''">
              <nobr>用户状态</nobr>
            </th>
            <!--<th>-->
            <!--<nobr>调压箱名称</nobr>-->
            <!--</th>-->
            <!--<th>-->
            <!--<nobr>调压箱地址</nobr>-->
            <!--</th>-->
            <!--<th>-->
            <!--<nobr>最后安检日期</nobr>-->
            <!--</th>-->
            <!--<th><nobr>最后安检状态</nobr></th>-->
          </tr>
        </template>
        <template partial='body'>
          <td style="text-align: center">
            <nobr><input type="checkbox" style="width: 22px;height: 22px;" v-model="row.checked"
                         v-bind:checked="row.checked"
                         @click="$parent.$parent.$parent.addChecked(row)"></nobr>
          </td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center;">{{ row.oldareaid }}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center;">{{ row.f_area }}</td>
          <!--          <td v-bind:class="{newcolor:row.code=='1'}" style="text-align: center">{{row.f_street}}</td>-->
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center;">{{ row.f_residential_area }}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{ row.f_area_address }}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{ row.f_user_type }}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{ row.f_user_num }}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{ row.uad_meter_brand }}</td>
          <td v-if="$parent.model.f_table_state != ''" v-bind:class="{newcolor:row.code==1}" style="text-align: center">
            {{ row.f_table_state }}
          </td>
          <!--<td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.f_adjustable_name}}</td>-->
          <!--<td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.f_adjustable_address}}</td>-->
          <!--<td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.f_last_check_date}}</td>-->
          <!--<td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.f_last_check_state}}</td>-->
          <!--          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center"><span-->
          <!--            @click="$parent.$parent.$parent.ToShowTemplate(row)" style="color: #00A3F0">生成计划</span></td>-->
        </template>
      </data-grid>
    </criteria-paged>
  </div>
  <!--<button @click="click">ddd</button>-->
  <work-busy :is-busy="showWait"></work-busy>
</template>

<script>
import {HttpResetClass, PagedList} from 'vue-client'
import co from 'co'
import * as Util from '../Util'

let AddItem = function* (self, val) {
  self.checkboxModel.f_filialeids = self.$login.f.f_orgids
  self.checkboxModel.f_orgstr = self.$login.f.orgpathstr
  self.checkboxModel.planid = self.checkplan.id
  self.checkboxModel.rows = self.checkrows
  self.checkboxModel.model = self.model
  self.checkboxModel.sqlname = self.sqlname
  self.checkboxModel.nostrids = ''
  if (val == 'single') {
    yield self.$resetpost('rs/logic/GenPlanItemAdd', {data: self.checkboxModel}).then((res) => {
      console.log(res.data)
      self.$showMessage(`共选择 ${self.checkboxModel.rows.length} 个用户，其中${res.data.existitem}个在${self.checkplan.f_plan_name}已存在，新增${res.data.updateitem}个！`)
      self.$emit('finish')
    })
  } else if (val == 'all') {
    console.log('self.model', self.model)
    if (self.model.rows == 0) {
      self.$showMessage('暂无可下发用户，请重新查询！')
      return
    }
    self.checkboxModel.planWay = 'add'
    yield self.$resetpost('rs/logic/GenCallInAllPlan', {data: self.checkboxModel}).then((res) => {
      console.log(res.data)
      self.$showMessage(`预计下发 ${self.checkboxModel.model.count} 个用户，其中${res.data.existitem}个在${self.checkplan.f_plan_name}已存在，新增${res.data.updateitem}个！`)
      self.$emit('finish')
    })
  }
}

let saveGen = function* (self) {
  self.checkboxModel.isAll = self.isAll
  self.checkboxModel.f_create_time = Util.toStandardTimeString()
  self.checkboxModel.f_end_type = '未完成'
  self.checkboxModel.f_plan_type = '点火通气计划'
  self.checkboxModel.f_issued = '否'
  self.checkboxModel.f_filialeids = self.$login.f.f_orgids
  self.checkboxModel.f_orgstr = self.$login.f.orgpathstr
  self.checkboxModel.f_plan_year = self.f_plan_year
  self.checkboxModel.f_plan_month = self.f_plan_month
  self.checkboxModel.f_subcompany = self.$login.f.f_fengongsi
  self.checkboxModel.f_create_operator = self.$login.f.name
  self.checkboxModel.f_effective_start_time = self.f_effective_start_time
  self.checkboxModel.f_effective_end_time = self.f_effective_end_time
  self.checkboxModel.model = self.model
  self.checkboxModel.sqlname = self.sqlname
  self.checkboxModel.nostrids = ''
  self.checkboxModel.strids = self.areaname
  self.checkboxModel.templateInfo = self.templateInfo
  console.log('====> ', self.checkrows)
  let residentialAreaCondtion = ''
  for (let i in self.checkrows) {
    if (self.checkrows[i].f_residential_area && self.checkrows[i].oldareaid && self.checkrows[i].f_area ) {
      if (residentialAreaCondtion == '') {
        residentialAreaCondtion += `(tua.f_residential_area = '${self.checkrows[i].f_residential_area}' and tua.oldareaid = '${self.checkrows[i].oldareaid}' and tua.f_pcd = '${self.checkrows[i].f_area}' )`
      } else {
        residentialAreaCondtion += ` or (tua.f_residential_area = '${self.checkrows[i].f_residential_area}' and tua.oldareaid = '${self.checkrows[i].oldareaid}' and tua.f_pcd = '${self.checkrows[i].f_area}')`
      }
    } else if (self.checkrows[i].f_residential_area && self.checkrows[i].oldareaid) {
      if (residentialAreaCondtion == '') {
        residentialAreaCondtion += `(tua.f_residential_area = '${self.checkrows[i].f_residential_area}' and tua.oldareaid = '${self.checkrows[i].oldareaid}' )`
      } else {
        residentialAreaCondtion += ` or (tua.f_residential_area = '${self.checkrows[i].f_residential_area}' and tua.oldareaid = '${self.checkrows[i].oldareaid}')`
      }
    } else if (self.checkrows[i].f_residential_area) {
      if (residentialAreaCondtion == '') {
        residentialAreaCondtion += `(tua.f_residential_area = '${self.checkrows[i].f_residential_area}')`
      } else {
        residentialAreaCondtion += ` or (tua.f_residential_area = '${self.checkrows[i].f_residential_area}')`
      }
    }
    console.log('residentialAreaCondtion==>', residentialAreaCondtion)
  }
  self.checkboxModel.residentialAreaCondtion = residentialAreaCondtion

  // if (self.creatPlanWay == 'single') {
  self.$resetpost('rs/logic/GenCallInPlanByArea', {data: self.checkboxModel}).then((respanse) => {
    console.log(respanse)
    self.showModal = false
    if (respanse.data.code == 200) {
      self.$showMessage("点火通气计划生成成功!")
      self.checkrows = []
      self.checker = {}
      // self.IsShare = '否',
      self.checkboxModel = {}
      self.creatPlanWay = ''
      self.f_effective_start_time = ''
      self.f_effective_end_time = ''
      self.showWait = false
      self.$refs.paged.$refs.criteria.search()
    } else {
      self.$showMessage("点火通气计划生成失败!")
    }
  })
  // }

}

let seachData = function* (self) {
  let getParams = yield self.$resetpost('rs/logic/getSaleInitData', {data: {f_filialeids: self.$login.f.f_orgids}}, {
    resolveMsg: null,
    rejectMsg: '获取营收参数出错！！！'
  })
  console.log('获取营收参数', getParams)
  if (getParams.data) {
    let arr = []
    getParams.data.adjustable.forEach((item, index) => {
      let temp = {}
      temp.label = `[${item.f_adjustable_id}]-${item.f_adjustable_name}`
      temp.value = `${item.id}`
      arr.push(temp)
    })
    self.adjustables = [{label: '全部', value: ''}, ...arr]
  }
}
let select = function* (self) {
  console.log(3)
  let http = new HttpResetClass()
  let getGasman = yield http.load('POST', '/rs/search', {
    source: 'this.getParentByType($organization$).getChildByName($安检员$).getUsers()',
    userid: self.$login.f.id
  }, {resolveMsg: null, rejectMsg: null})
  console.log(4)
  console.log('获取安检员', getGasman)
  getGasman.data.forEach((checker) => {
    self.checkers.push({label: checker.name, value: checker})
  })
}

//   let searchSafeCycle= function* (self){
//     console.log('获取民用非民用安检周期')
//     let http = new HttpResetClass()
//     yield http.load('POST', 'rs/logic/getSafeCheckCycle', {},{resolveMsg: null, rejectMsg: null}).then((res)=>{
//       console.log('安检周期',res.data)
//       if(res.data.code == 200){
//         self.civil = res.data.civil.value
//         self.civilian = res.data.civilian.value
//         self.model.safeCycle = self.civil
//       }else{
//         self.$showMessage(res.data.msg)
//       }
//     })
// }
export default {
  title: '点火通气计划生成',
  data() {
    let options = []
    let year = (new Date()).getFullYear()
    for (let i = year; i <= year + 3; i++)
      options.push({label: i + '', value: i + ''})
    let moptions = []
    for (let i = 1; i <= 12; i++)
      moptions.push({label: i + '', value: i + ''})
    let model = new PagedList('rs/sql/根据安检员查询小区档案', 50, {
      orderitem: '"f_residential_area"',
      f_filialeids: 'this.f_filialeids',
      month: 'this.month',
      SafeCheckSX: 'this.SafeCheckSX',
      f_table_state: 'this.f_table_state',
      // f_usertype:'this.f_usertype',
      // f_last_check_state: 'this.f_last_check_state',
      // f_checktime_start: 'this.f_checktime_start',
      // f_checktime_end:  'this.f_checktime_end',
      // safeCycle: 'this.safeCycle',
      SafeCheckCQ: 'this.SafeCheckCQ',
      SafeCheckSC: 'this.SafeCheckSC',
      f_issue_start: 'this.f_issue_start',
      f_issue_end: 'this.f_issue_end',
      SafeCheckXZ: 'this.SafeCheckXZ',
      f_shouldcheck_start: 'this.f_shouldcheck_start',
      f_shouldcheck_end: 'this.f_shouldcheck_end'
    })
    model.month = ''
    model.f_table_state = ''
    // model.f_last_check_state = ''
    // model.f_checktime_start = ''
    model.f_usertype = []
    // model.f_checktime_end = ''
    // model.safeCycle = ''
    model.SafeCheckCQ = ''   //安检筛选是否超期
    model.SafeCheckSC = '否',    //  安检筛选去除生成标记
      model.f_issue_start = Util.toStartDateYearString(),
      model.f_issue_end = Util.toStandardDateString(),
      // model.SafeCheckXZ = '应安检',  //  安检筛选标记
      model.SafeCheckXZ = '未安检',  //  安检筛选标记
      model.f_shouldcheck_start = Util.toStartDateString(),
      model.f_shouldcheck_end = Util.toEndDateString(),
      // 安检筛选所用时间
      model.SafeCheckSX = {
        f_check_end: '', // 安检时间  查询起始条件
        f_check_start: ''// 安检时间  查询终止条件
      }
    return {
      f_meter_brands: [{label: '全部', value: ''}],
      is_to_userinfos: [{label: '全部', value: ''}, {label: '否', value: 'is null'}, {
        label: '是',
        value: 'is not null'
      }],
      is_reuse_states: [{label: '全部', value: ''}, {label: '在用', value: '在用'}],
      is_reuse_state: '在用',
      isAll: '',
      civil: '',   //民用安检周期
      civilian: '',      //非民用安检周期
      // SafeCheckXZs: [{label: '未安检', value: '未安检'}, {label: '已安检', value: '已安检'},{label: '应安检', value: '应安检'},{label: '超期安检', value: '超期安检'}], // 安检筛选选项
      SafeCheckXZs: [{label: '未安检', value: '未安检'}, {label: '已安检', value: '已安检'}], // 安检筛选选项
      SafeCheckSXs: [{label: '是', value: '是'}, {label: '否', value: '否'}, {label: '全部', value: ''},],
      IsShares: [{label: '是', value: '是'}, {label: '否', value: '否'}],
      tableStates: [{label: '全部', value: ''}, {label: '正常', value: '正常'}, {label: '停用', value: '停用'}],
      // IsShare:'否',
      checker: {},
      criteriaShow: true,
      model: model,
      checkers: [],
      chosenOrg: {id: 0},
      showModal: false,
      checkedAll: false,
      showWait: false,
      checkrows: [],
      adjustables: [],
      f_plan_year: year + '',
      f_plan_month: moptions[new Date().getMonth()].value,
      f_effective_start_time: '',  //计划有效起始时间
      f_effective_end_time: '',    //计划有效结束时间
      checkboxModel: {},
      c_year_list: options,
      c_month_list: moptions,
      // areas: this.areas(),
      // checkstatus: this.checkstatus(),
      // usertypes: this.usertypes(),
      // userstates: this.userstates(),
      sqlname: '',
      creatPlanWay: '',
      areaname: '',
      row: '',   //当前选中小区
      showTemplateGenerate: false, // 显示模板控制
      templateInfo: [
        {type: '用户基本信息', name: '区/县', value: ''},
        {type: '用户基本信息', name: '街道', value: ''},
        {type: '用户基本信息', name: '小区性质', value: ''},
        {type: '用户基本信息', name: '所属区域', value: ''},
        {type: '用户基本信息', name: '供暖方式', value: ''},
        {type: '用户基本信息', name: '租住', value: ''},
        {type: '用户基本信息', name: '用气设备', value: ''},
        {type: '燃气表', name: '表型', value: ''},
        {type: '燃气表', name: '左右表', value: ''},
        {type: '燃气表', name: '生产时间', value: ''},
        {type: '燃气表', name: '基表厂家', value: ''},
        {type: '燃气表', name: '基表读数', value: '0'},
        {type: '燃气表', name: 'IC卡表厂家', value: ''},
        {type: '燃气表', name: 'IC卡表类型', value: ''},
        {type: '燃气表', name: '剩余气量', value: '0'},
        {type: '燃气表', name: '剩余金额', value: '0'},
        {type: '燃气表', name: '表封', value: '钢质'},
        // {type: '报警器',name: '有否',value: '有'},
        {type: '报警器', name: '厂家', value: ''},
        {type: '报警器', name: '安装时间', value: ''},
        {type: '报警器', name: '到期时间', value: ''},
        {type: '报警器', name: '是否通电', value: ''},
        {type: '报警器', name: '安装渠道', value: ''},
        // {type: '报警器',name: '电磁阀接口漏气',value: '否'},
        {type: '立管', name: '立管类型', value: '暗设'},
        {type: '用户基本信息', name: '运行区域', value: ''},
        {type: '报警器', name: '有否', value: ''},
        // {type: '立管',name: '管件详情',value: ''},
        // {type: '立管',name: '立管隐患类型',value: '正常'},
        // {type: '阀门',name: '表前阀类型',value: ''},
        // {type: '阀门',name: '表前阀',value: '正常'},
        // {type: '阀门',name: '灶前阀',value: '正常'},
        // {type: '阀门',name: '自闭阀',value: '正常'},
        // {type: '表后管',name: '表后管隐患类型',value: '正常'},
        // {type: '灶具',name: '灶具连接管安装类型',value: ''},
        // {type: '灶具',name: '灶具连接管隐患类型',value: '正常'},
        // {type: '灶具连接管',name: '灶具连接管安装类型',value: ''}
      ],
      rents: [
        {label: '否', value: '否'},
        {label: '普通居住', value: '普通居住'},
        {label: '托管培训', value: '托管培训'},
        {label: '办公', value: '办公'},
        {label: '餐饮', value: '餐饮'},
        {label: '集体宿舍', value: '集体宿舍'}
      ],
      equipmens: [
        {label: '请选择', value: ''},
        {label: '单灶', value: '单灶'},
        {label: '灶具+热水器', value: '灶具+热水器'},
        {label: '灶具+壁挂锅炉', value: '灶具+壁挂锅炉'},
        {label: '灶具+燃气取暖器', value: '灶具+燃气取暖器'},
        {label: '未用', value: '未用'},
        {label: '灶具+热水器+壁挂锅炉', value: '灶具+热水器+壁挂锅炉'},
        {label: '单热水器', value: '单热水器'},
        {label: '单壁挂锅炉', value: '单壁挂锅炉'}
      ],
      communityNature: [
        {label: '物业小区', value: '物业小区'},
        {label: '企事业单位', value: '企事业单位'},
        {label: '安置小区', value: '安置小区'},
        {label: '自建房', value: '自建房'},
        {label: '公租房', value: '公租房'},
        {label: '廉租房', value: '廉租房'}
      ],
      opera_areas: [
        {label: '航天', value: '航天'},
        {label: '韦曲', value: '韦曲'},
        {label: '高新', value: '高新'},
        {label: '沣东', value: '沣东'},
        {label: '中心站', value: '中心站'}
      ],
      area: [
        {label: '中心站', value: '中心站'}, ...this.$appdata.getParam("行政区域")
      ],
      heatingMethod: [
        {label: '壁挂炉供暖', value: '壁挂炉供暖'},
        {label: '集中供暖', value: '集中供暖'},
        {label: '燃气取暖器供暖', value: '燃气取暖器供暖'},
        {label: '其他', value: '其他'}
      ],
      phenotype: [
        {label: "莱德非接触G4", value: '莱德非接触G4'},
        {label: "莱德非接触G2.5", value: '莱德非接触G2.5'},
        {label: "莱德物联网表", value: '莱德物联网表'},
        {label: "莱德普通G4", value: '莱德普通G4'},
        {label: "莱德普通G2.5", value: '莱德普通G2.5'},
        {label: "秦港G4", value: '秦港G4'},
        {label: "秦港G2.5", value: '秦港G2.5'},
        {label: "秦港民用无线G4", value: '秦港民用无线G4'},
        {label: "秦港民用无线G2.5", value: '秦港民用无线G2.5'},
        {label: "赛福", value: '赛福'},
        {label: "秦川", value: '秦川'},
        {label: "天庆", value: '天庆'},
        {label: "山城", value: '山城'},
        {label: "其他", value: '其他'}
      ],
      leftRightTable: [
        {label: '左表', value: '左表'},
        {label: '右表', value: '右表'}
      ],
      baseWatchManufacturer: [
        {label: '山城', value: '山城'},
        {label: '莱德', value: '莱德'},
        {label: '秦港', value: '秦港'},
        {label: '其他', value: '其他'}
      ],
      icCardManufacturer: [
        {label: '山城', value: '山城'},
        {label: '莱德', value: '莱德'},
        {label: '秦港', value: '秦港'},
        {label: '其他', value: '其他'}
      ],
      icCardType: [
        {label: '102卡', value: '102卡'},
        {label: '射频卡', value: '射频卡'},
        {label: '067射频卡', value: '067射频卡'}
      ],
      tableSeal: [
        {label: '无', value: '无'},
        {label: '钢质', value: '钢质'},
        {label: '塑质', value: '塑质'}
      ],
      alarmManufacturer: [
        {label: '汉威', value: '汉威'},
        {label: '鑫豪斯', value: '鑫豪斯'},
        {label: '友谊', value: '友谊'},
        {label: '富昌', value: '富昌'},
        {label: '科信', value: '科信'},
        {label: '其他', value: '其他'}
      ],
      IsThereAnAlarms: [
        {label: '有', value: '有'},
        {label: '无', value: '无'}
      ],
      alarmPower: [
        {label: '是', value: '是'},
        {label: '否', value: '否'}
      ],
      alarmInstallationChannel: [
        {label: '惠众', value: '惠众'},
        {label: '其他', value: '其他'}
      ]
    }
  },
  props: {
    checkplan: { // 传入一条安检计划信息
      type: Object
    },
    additemshow: {
      type: Boolean,
      default: false
    }
  },
  created() {
    // 请求收费的数据
    this.$LoadSaleParams.loadSaleParams().then(res => {
      let met = []
      this.$GetSaleParam.getGasbrand().forEach(item => {
        met.push({label: item.label, value: item.value.f_meter_brand})
      })
      this.f_meter_brands = [{label: '全部', value: ''}, ...met]
    })
  },
  ready() {
    this.model.chosenOrg = {id: 0}
    console.log(this.$login.f)
    this.model.f_filialeids = this.$login.f.f_orgids
    this.model.f_filiale = this.$login.f.f_fengongsi
    this.model.f_OrgStr = this.$login.f.orgpathstr
    console.log(0)
    let param = seachData(this)
    co(param)
  },
  methods: {
    changse(val) {
      console.log('val====>', val)
    },
    itemAddBack() {
      this.$emit('finish')
    },
    itemAdd(val) {
      let _gen = AddItem(this, val)
      return co(_gen)
    },
    // 选择安检员
    IsShareschange(val) {
      this.IsShare = val
      if (val == '是') {
        this.checker = null
      }
    },
    checkerchange(val) {
      this.checkboxModel.f_checker = val.name
      this.checkboxModel.f_checker_id = val.id
    },
    search(args) {
      this.checkrows = []
      this.checkedAll = false
      if (this.is_reuse_state == '在用') {
        args.condition += ` and (( ui.f_second_state is null and f_user_state != '弃用')  or (ui.f_second_state is not null and uf.f_meternumber is not null)) `
      }

      this.model.search(args.condition, args.model)
    },
    userstates() {
      return [{label: '全部', value: ''}, ...this.$appdata.getParam('用户状态')]
    },
    show() {
      this.criteriaShow = true
    },
    hidden() {
      this.criteriaShow = false
    },
    confirm() {
      if (!this.checkboxModel.f_plan_name) {
        this.$showMessage('请填写安检计划名称!')
        return
      }
      if (!this.templateInfo[7].value) {
        return this.$showMessage('表型号必须填写，请前往维护该小区的默认表型号')
      }
      this.showWait = true
      let gen = saveGen(this)
      return co(gen)
    },
    changeStates() {
      if (this.checkedAll) {//实现反选/
        this.checkrows = [];
        for (let i = 0; i < this.$refs.paged.model.rows.length; i++) {
          this.$set('$refs.paged.model.rows[' + i + '].checked', false)
        }
      } else {//实现全选
        for (let i = 0; i < this.$refs.paged.model.rows.length; i++) {
          this.$set('$refs.paged.model.rows[' + i + '].checked', true)
        }
        let _this = this
        let condition = this.$refs.paged.$refs.criteria.condition
        let url = this.model.url
        this.$resetpost(`${url}?pageSize=9999999`, {
          data: {
            condition: condition,
            groupitem: '',
            orderitem: 'f_residential_area',
            // f_usertype:this.model.f_usertype,
            f_filialeids: this.model.f_filialeids,
            month: this.model.month,
            // safeCycle:this.model.safeCycle,
            f_checktime_start: this.model.f_checktime_start,
            f_checktime_end: this.model.f_checktime_end,
            SafeCheckSX: this.model.SafeCheckSX,
            // f_last_check_state: this.model.f_last_check_state
          },
        }, {resolveMsg: null, rejectMsg: null}, -1).then(
          (respanse) => {
            if (respanse.data.length >= 5000) {
              this.$showMessage("数据量太大，请重新选择")
            } else {
              _this.checkrows = []
              for (let j = 0; j < respanse.data.length; j++) {
                _this.checkrows.push(respanse.data[j])
              }
              console.log(_this.checkrows);
            }
          })
      }
    },
    addChecked(item) {
      console.log(item);
      if (!item.checked) {
        this.checkrows.push(item);
        console.log(this.checkrows);
      } else {
        for (let i = 0; i < this.checkrows.length; i++) {
          if (item.f_userinfo_id == this.checkrows[i].f_userinfo_id) {
            this.checkrows.splice(i, 1)
          }
        }
      }
    },
    // 先显示模板
    ToShowTemplate() {
      if (this.checkrows.length == 1) {
        if (this.checkrows[0].oldareaid) {
          let http = new HttpResetClass()
          http.load('POST', `${this.$androidUtil.getProxyUrl()}/rs/sql/selAreaToAreaIdInfoCip`, {
            data: {
              oldareaid: this.checkrows[0].oldareaid
            }
          }, {resolveMsg: null, rejectMsg: null}).then((res) => {
            console.log("以小区id查询当前小区的信息" + JSON.stringify(res.data))
            let resp = res.data[0]
            this.templateInfo[0].value = resp.f_pcd
            this.templateInfo[1].value = resp.f_street
            this.templateInfo[2].value = resp.f_residential_properties //小区性质
            this.templateInfo[3].value = resp.f_distinct //所属区域
            this.templateInfo[4].value = resp.f_heating_style //供暖方式
            this.templateInfo[6].value = this.item_default_devices(resp.default_devices)//用气设备
            this.templateInfo[7].value = resp.f_meter_brand_b // 气表型号
            this.templateInfo[13].value = resp.f_size_card // IC卡表类型
            this.templateInfo[23].value = resp.f_opera_area // 运行区域
          })
          this.showTemplateGenerate = true
          this.showModal = false
        } else {
          this.showTemplateGenerate = true
          this.showModal = false
          this.$showAlert("自动回写档案数据错误，当前小区没有小区id，请核实数据！", "warning", 2000)
        }
      } else {
        this.showTemplateGenerate = true
        this.showModal = false
        this.$showAlert("当前已进行多选操作,无法进行小区数据自动回写", "warning", 2000)
      }
    },
    // 模板之后显示生成计划
    ToShowModal() {
      this.creatPlanWay = 'single'
      this.showTemplateGenerate = false
      this.showModal = true
    },
    FiltrationPlan() {
      if (this.model.rows.length == 0) {
        this.$showMessage("暂无可生成的计划！")
        return
      }
      this.creatPlanWay = 'filtration'
      this.showModal = true
    },
    AllPlan() {
      this.isAll = 'all'
      if (this.model.rows.length == 0) {
        this.$showMessage("暂无可生成的计划！")
        return
      }
      this.ToShowTemplate()
      this.creatPlanWay = 'all'
      // this.showModal = true
    },
    cancel() {
      this.showTemplateGenerate = false
      this.showModal = false
    },

    initAdjustables() {
      console.log('初始化调压箱', this.$GetSaleParam)
      let arr = []
      let filter = this.$login.f.f_orgids
      this.$GetSaleParam.getAdjustable(filter).forEach((item) => {
        let temp = {}
        temp.label = `[${item.value.f_adjustable_id}]-${item.label}`
        temp.value = `${item.value.id}`
        arr.push(temp)
      })
      this.adjustables = [{label: '全部', value: ''}, ...arr]
    },
    // 处理多个设备
    item_default_devices(default_devices_str) {
      if (!default_devices_str) {
        return default_devices_str;
      }
      let default_devices_json = JSON.parse(default_devices_str)
      let strEnd = ''
      for (let i = 0; i < default_devices_json.length; i++) {
        if (strEnd == '') {
          strEnd = default_devices_json[i]
        } else {
          strEnd = strEnd + '+' + default_devices_json[i]
        }
      }
      return strEnd
    }
  },

  watch: {
    'templateInfo[18].value'(val) {
      console.log('templateInfo[18].value===>', val)
      this.templateInfo[19].value = Util.addYear(val)
    },
    'model.SafeCheckXZ'(val) {
      this.model.SafeCheckSC = ''
      if (val == '已安检') {
        this.model.SafeCheckCQ = ''
        this.model.SafeCheckSX = {
          f_check_end: '', // 安检时间  查询起始条件
          f_check_start: ''// 安检时间  查询终止条件
        }
      } else {
        // 当使用筛选条件时，清空不需要的条件选项
        this.model.f_issue_start = ''
        this.model.f_issue_end = ''
        this.$refs.paged.$refs.criteria.model.f_check_start = ''
        this.$refs.paged.$refs.criteria.model.f_check_end = ''
        // this.$refs.paged.$refs.criteria.model.f_last_check_state = ''
        this.model.month = ''
        if (val == '应安检') {
          this.model.SafeCheckSC = '否'

          this.model.f_issue_start = Util.toStartDateString()
          this.model.f_issue_end = Util.toStandardDateString()
        }

      }
    },
    'model.SafeCheckSC'(val) {
      if (val == '') {
        this.model.f_issue_start = ''
        this.model.f_issue_end = ''
      }
    },

    'model.rows'() {
      // if (!this.checkedAll) {//实现反选/
      // this.checkrows = [];
      for (let i = 0; i < this.$refs.paged.model.rows.length; i++) {
        var k = false
        for (let j = 0; j < this.checkrows.length; j++) {
          if (this.$refs.paged.model.rows[i].f_userinfo_id == this.checkrows[j].f_userinfo_id) {
            this.$set('$refs.paged.model.rows[' + i + '].checked', true)
            k = true
            continue
          }
        }
        if (!k) {
          this.$set('$refs.paged.model.rows[' + i + '].checked', false)
        }
      }

    }
  },
  computed: {
    selected() {
      return this.$refs.paged.$refs.grid.selected
    },

  }
}
</script>
<style scoped>
.newcolor {
  color: red;
}

.table th {
  background-color: #f2f6fa;
  color: black;
}
</style>
