<template>
  <div class="app-container">
    <van-nav-bar
      left-arrow
      fixed
      placeholder
      @click-left="$router.back(-1)"
    >
      <template #title>
        <p style="font-weight: bold;">结案</p>
      </template>
    </van-nav-bar>
    <div class="main_box">
      <van-field
        readonly
        label="是否在建建筑物"
        v-model="sfzjjzw"
        input-align="right"
        label-width="auto"
      />
      <van-field readonly label="宅基地代码" v-model="jgList.zjddm" input-align="right" />
      <!--        <van-popup v-model="showZjd" position="bottom">-->
      <!--          <van-picker-->
      <!--            show-toolbar-->
      <!--            @cancel="showZjd = false"-->
      <!--          />-->
      <!--        </van-popup>-->
      <van-field
        readonly
        label="监管类型"
        v-model="jglx"
        input-align="right"
      />
      <van-field
        readonly
        v-model="jgList.lasj"
        label="立案时间"
        input-align="right"
      />
      <van-field readonly label="巡查人" v-model="jgList.inspector" input-align="right" label-width="auto"/>
      <van-field
        readonly
        label="巡查时间"
        v-model="jgList.inspectorTime"
        input-align="right"
      />
    </div>

    <p class="main_title">违法信息</p>
    <div class="main_box">
      <van-field
        readonly
        label="违法用地类型"
        v-model="wfydlx"
        input-align="right"
      />
      <van-field readonly v-model="jgList.wfydmj" label="违法用地面积" input-align="right" label-width="auto"/>
      <van-field readonly v-model="jgList.fmkje" label="罚没款金额" input-align="right" label-width="auto"/>
      <van-field readonly v-model="jgList.msmj" label="没收面积" input-align="right" label-width="auto"/>
      <van-field readonly v-model="jgList.ccmj" label="拆除面积" input-align="right" label-width="auto"/>
    </div>
  </div>
</template>

<script>
  import { closeCase , getJg } from "@/api/onlineHome/homestead/reporting";
  export default {
    name: "taskCloseCaseAdd",
    data() {
      return {
        showSys:false,
        showjglx:false,
        showlasj:false,
        showinspectorTime:false,
        showwfydlx:false,

        minDate: new Date(),
        maxDate: new Date(2025, 10, 1),
        currentDate: new Date(),
        jgList:{},

        sfzjjzw:'',
        jglx:'',
        wfydlx:'',

        wfydlxDictionaries:[],
        jglxDictionaries:[],
        sysDictionaries:[],

      };
    },
    created() {
      this.jgList.taskId = this.$route.query.id;
      this.houseGetDicts("jglx").then((res) => {
        this.jglxDictionaries = res.data;
      });
      this.houseGetDicts("sys_yes_no").then((res) => {
        console.log(res)
        this.sysDictionaries = res.data;
      });
      this.getDictionaries();
    },
    methods: {
      getDictionaries(){
        getJg(this.$route.query.id).then(response => {
          console.log(this.selectDictLabel(this.jglxDictionaries, response.data.jglx))
          this.houseGetDicts("villations_type").then((res) => {
            for(var i = 0 ; i < res.data.length ; i++){
              this.wfydlxDictionaries.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
            }
            this.wfydlx = this.selectDictLabel(res.data, response.data.wfydlx);
          });
          this.jglx = this.selectDictLabel(this.jglxDictionaries, response.data.jglx);
          this.sfzjjzw = this.selectDictLabel(this.sysDictionaries, response.data.sfzjjzw);

          this.jgList = response.data;
        })
      },
      onConfirmWfydlx(data){
        this.wfydlx = data.text;
        this.jgList.wfydlx = data.value;
        this.showwfydlx = false;
      },
      goAdd(){
        closeCase(this.jgList).then(response => {
          console.log(response);
          this.$toast.success('结案成功');
          setTimeout(function(){
            history.go(-1)
          },2000)
        });
      },
      goBack(){
        window.history.go(-1)
      }
    },
  }
</script>

<style scoped lang="scss">
  .app-container {
    padding: 2% 0;
  }
  .main_title{
    font-size: 0.4rem;
    color: #1D6FE9;
    margin: 0.2rem 6%;
    position: relative;
  }
  .main_box{
    width: 96%;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
    overflow: hidden;
    background-color: #FFF;
  }
  .submitButton{
    width: 80%;
    margin: 0 auto;
    background-color: #1D6FE9;
  }
</style>
