<template>
  <div class="auto">
    <criteria-paged :model="model"  v-ref:paged>
      <criteria partial='criteria' @condition-changed='search' v-ref:cri>
        <div partial>
          <form>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../../assets/用户ID.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">用户编号：</label>
              </div>
              <div class="col-xs-8" >
                <input class="search_input input-font"
                       v-model=model.f_userinfo_code condition="f_userinfo_code = '{}'" placeholder="请输入用户编号" />
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../../assets/用户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">用户名称：</label>
              </div>
              <div class="col-xs-8" >
                <input class="search_input input-font" v-model="model.f_username"  condition="f_user_name like '%{}%'"   placeholder="请输入用户名称（可模糊查询）">
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <label class="font text-left">原计划名称：</label>
              </div>
              <div class="col-xs-8" >
                <input class="search_input input-font" v-model="model.oldname"   condition="oldname like '%{}%'" placeholder="原计划名称">
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <label class="font text-left">移入计划名称：</label>
              </div>
              <div class="col-xs-8" >
                <input class="search_input input-font" v-model="model.newname" condition="newname like '%{}%'"  placeholder="移入计划名称">
              </div>
            </div>
            <div class="row app-row">
              <label class="font_normal_body">开始时间</label>
              <datepicker
                :value.sync="model.f_check_start"
                placeholder='提交开始时间'
                :disabled-days-of-week="[]" style="width: 60%"
                :format="'yyyy-MM-dd'"
                :show-rest-button="reset"
                v-model = "model.f_check_start"
                condition="f_approved_time > ='{} 00:00:00'">
              </datepicker>
            </div>
            <div class="row app-row">
              <label class="font_normal_body">结束时间</label>
              <datepicker
                :value.sync="model.f_check_end"
                placeholder='提交结束时间'
                :disabled-days-of-week="[]"
                :format="'yyyy-MM-dd'" style="width: 60%"
                :show-rest-button="reset"
                v-model = "model.f_check_end"
                condition="f_approved_time<=  '{} 23:59:59'">
              </datepicker>
            </div>
            <div class="row app-row">
              <label class="font_normal_body">审核状态</label>
              <v-select id="f_approved"
                        placeholder='审核状态' style="width: 60%"
                        v-model='model.f_approved'
                        :value.sync="model.f_approved"
                        :options='$parent.$parent.f_approval_states'
                        condition="f_pass_approved =  '{}'"
                        close-on-select clear-button></v-select>
            </div>
            <div class="row text-center" style="margin-top: 20px;">
              <button type="button" class="btn btn-lg btn-font btn-color" style="width: 45%;" @click="search">查询</button>
            </div>
            <div style="height:30px;"></div>
          </form>
        </div>
      </criteria>
      <list :model="model" partial='list'>
        <div partial>
          <div  class="auto app-text" style="margin-top: 5px;">
            <div class="panel" style="padding: 10px 10px 5px 10px;">
              <div class="panel-body panel-self">
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户编号</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_userinfo_code }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户名称</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_user_name }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">原计划名称</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.oldname }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">移入计划名称</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.newname}}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">提交人</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_author_name}}</p>
                </div>

                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">提交时间</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_author_time}}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">审核人</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_approved_by}}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">审核时间</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_approved_time}}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">审核状态</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_pass_approved}}</p>
                </div>
                <div class="col-xs-12">
                  <button type="button" name="button" class="btn btn-primary" style="background-color:#499edf;float: right"  @click="$parent.$parent.$parent.change(row)">通过</button>
                  <button type="button" name="button" class="btn btn-primary" style="background-color:#499edf;float: right;margin-right:10px;"  @click="$parent.$parent.$parent.Nochange(row)">不通过</button>
                </div>
              </div>
            </div>

          </div>
        </div>
      </list>
    </criteria-paged>
  </div>
</template>

<script>
import {HttpResetClass, PagedList} from 'vue-client'
import Vue from 'vue'
import * as Util from '../../Util'
export default {
  title: '安检转单审核',
  data () {
    let model = new PagedList(`${this.$androidUtil.getProxyUrl()}/rs/sql/SecurityAudit`, 20, {})
    return {
      model: model,
      cbc:[],
      showModal:false,
      ischecks: [
      ],
      f_approval_states:this.$appdata.getParam('转发审核状态'),
      user_types: [
        {label: '请选择用户类型', value: ''},
        {label: '民用', value: '民用'},
        {label: '非民用', value: '非民用'},
      ],
    }
  },
  ready () {
  },
  computed: {
    reload(){
      this.$refs.paged.loadPage(this.$refs.paged.model.pageIndex)
    },
    selected () {
      return this.$refs.paged.$refs.grid.selected
    }
  },
  methods:{
    search(args) {
      this.model.search(args.condition, args.model)
    },
    Nochange(row){
      new HttpResetClass().load('post',`${this.$androidUtil.getProxyUrl()}/rs/logic/NoSecurityPass`, {
        id: row.itemid,
      }, {resolveMsg: null, rejectMsg: null}).then((res) => {
        this.$refs.paged.$refs.cri.search()
        this.$showMessage('审核成功')
      }).catch(()=>{
        this.$showMessage('审核失败,请稍候重新尝试')
      })
    },
    change(row) {
      new HttpResetClass().load('post',`${this.$androidUtil.getProxyUrl()}/rs/logic/SecurityPass`, {
        f_newplan_id: row.f_newplan_id,
        f_plan_id: row.f_plan_id,
        id:row.itemid
      }, {resolveMsg: null, rejectMsg: null}).then((res) => {
        this.$refs.paged.$refs.cri.search()
        this.$showMessage('审核成功')
      }).catch(()=>{
        this.$showMessage('审核失败,请稍候重新尝试')
      })

    },
  }
}
</script>
<style scoped>
.app-row {
  background-color: white;
  padding: 10px 10px 0 10px;
  border-bottom: 1px solid rgba(235, 235, 235, 0.5);
}
.search_input {
  border: 0;
  outline: none;
}
.font{
  font: 15px PingFang-SC-Medium;
  color: #666666;
}
.input-font{
  font: 15px PingFang-SC-Medium;
  color: #333333;
}
.btn-font{
  font:600 16px PingFang-SC-Bold;
  color: #499EDF;
}
.btn-color{
  background-color: #FFFFFF;
  border-radius: 10px ;
  border: 1px solid #499EDF;
}
.app-text {
  font-size: 12px;
}
.panel-self{
  border-radius: 10px;
  border:1px solid #499EDF;
  background-color: #F8F8F8;
}
.yybtn-color{
  border-radius: 4px ;
  border: 1px solid #499EDF;
}
.qxbtn-color{
  background-color: #FFFFFF;
  border-radius: 4px ;
  border: 1px solid #499EDF;
}
</style>
