<template>
  <div>
    <title-bar :title="title" @clickLef="onClick">
      <van-icon slot="left" name="cross" size="24" />
    </title-bar>
    <anchor-nav ref="anchorNav" :navList="navList">
      <template slot="conditionInfoList">
        <div class="content">
          <div class="customer-management-information-content">
            <div v-if="conditionInfoList.length >0">
              <table class="customer-management-information-form">
                <tr>
                  <td style="width:10%">签发日期</td>
                  <td style="width:15%">处罚决定书文号</td>
                  <td style="widtLSBGViewh:30%">主要违法事实</td>
                  <td style="width:30%">行政处罚内容</td>
                  <td style="width:15%">处罚执行情况</td>
                </tr>
                <tr v-for="(item, index) in conditionInfoList" :key="index">
                  <td>{{ item.PENALIZE_DATE }}</td>
                  <td>{{ item.WRIT_NO }}</td>
                  <td>{{ item.ILLEGAL_TYPE }}</td>
                  <td>{{ item.PENALIZE_CONTENT }}</td>
                  <td>{{ item.CONDITION_TYPE }}</td>
                </tr>
              </table>
            </div>
            <div v-else>
              <table class="customer-management-information-form">
                <tr>
                  <td style="width:10%">签发日期</td>
                  <td style="width:15%">处罚决定书文号</td>
                  <td style="width:30%">主要违法事实</td>
                  <td style="width:30%">行政处罚内容</td>
                  <td style="width:15%">处罚执行情况</td>
                </tr>
                <tr>
                  <td colspan="5">暂无数据</td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </template>
      <template slot="illegalInfoList">
        <div class="content">
          <div class="customer-management-information-content">
            <div v-if="illegalInfoList.length>0">
              <table class="customer-management-information-form">
                <tr>
                  <td>列入日期</td>
                  <td>列入原因</td>
                  <td>列入做出决定文号</td>
                  <td>移出日期</td>
                  <td>移出原因</td>
                </tr>
                <tr v-for="(item, index) in illegalInfoList " :key="index">
                  <td style="width:10%">{{ item.IN_DATE }}</td>
                  <td style="width:35%">{{ item.IN_SN }}</td>
                  <td style="width:15%">{{ item.IN_REASON }}</td>
                  <td style="width:10%">{{ item.OUT_DATE }}</td>
                  <td style="width:30%">{{ item.OUT_REASON }}</td>
                </tr>
              </table>
            </div>
            <div v-else>
              <table class="customer-management-information-form">
                <tr>
                  <td>列入日期</td>
                  <td>列入原因</td>
                  <td>列入做出决定文号</td>
                  <td>移出日期</td>
                  <td>移出原因</td>
                </tr>
                <tr>
                  <td colspan="5">暂无数据</td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </template>
      <template slot="warningInfoList">
        <div class="content">
          <div class="customer-management-information-content">
            <div v-if="warningInfoList.length > 0">
              <table class="customer-management-information-form">
                <tr>
                  <td>警示情况</td>
                  <td>警示内容</td>
                  <td>警示开始日期</td>
                  <td>警示结束日期</td>
                  <td>警示决定部门</td>
                  <td>是否撤销</td>
                </tr>
                <tr v-for="(item, index) in warningInfoList " :key="index">
                  <td style="width:25%">{{ item.CONDITION }}</td>
                  <td style="width:35%">{{ item.CONTENT }}</td>
                  <td style="width:10%">{{ item.START_DATE }}</td>
                  <td style="width:10%">{{ item.END_DATE }}</td>
                  <td style="width:10%">{{ item.DEPARTMENT }}</td>
                  <td style="width:10%">{{ item.IS_REVOCATION }}</td>
                </tr>
              </table>
            </div>
            <div v-else>
              <table class="customer-management-information-form">
                <tr>
                  <td>警示情况</td>
                  <td>警示内容</td>
                  <td>警示开始日期</td>
                  <td>警示结束日期</td>
                  <td>警示决定部门</td>
                  <td>是否撤销</td>
                </tr>
                <tr>
                  <td colspan="6">暂无数据</td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </template>
    </anchor-nav>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import TitleBar from "@/components/general/TitleBar.vue";
import Public from "@/public/ts/Public";
import nettyApi from "@/constants/api/ms-netty/netty.api";
import { NativeUI } from "@/public/ts/NativeUI";
import IF from "@/public/factory/InterFaceFactory";
import { getText } from "@/stores";

/**
 * @Description 处罚信息
 * @Author JiangTao
 * @Date 2022-02-10 上午 11:58
 */
@Component({
  name: "CFXXList",
  components: { TitleBar }
})
export default class CFXXList extends Vue {
  title = "工商-处罚信息"; // 页面标题
  conditionInfoList = []; //行政处罚列表数据
  illegalInfoList = []; //严重违法信息信息列表
  warningInfoList = []; //警示信息列表
  navList = [{ key: "conditionInfoList", titleText: "行政处罚历史信息" },
    { key: "illegalInfoList", titleText: "严重违法信息" },
    { key: "warningInfoList", titleText: "严重违法信息" }
  ];

  onClick() {
  }

  mounted() {
    this.selectXZCF();
  }

  /**
   * @Description 行政处罚历史信息
   * @Author JiangTao
   * @Date 2021-11-25 下午 04:54
   */
  selectXZCF(pageNo = 1) {
    let param = {
      CUST_FULL_NAME: this.$store.getters.getCusInfo.cus_name,
      CERT_ARRAY_INFO: [
        {
          CERT_TYPE: Public.getGScode(this.$store.getters.getCusInfo.cert_type),
          CERT_NO: this.$store.getters.getCusInfo.cert_code
        }
      ],
      GS_QUERY_OPTION_ARRAY: [
        {
          GS_QUERY_OPTION_LIST: "11"
        },
        {
          GS_QUERY_OPTION_LIST: "13"
        },
        {
          GS_QUERY_OPTION_LIST: "20"
        }
      ],
      ProdId: Public.getProdId(),
      SvrCode: Public.getSvrCode(nettyApi.TRADE_CODE.selectGSXXCX),
      ClientNo: this.$store.getters.getCustInfo.cus_id,
      ValidTime: this.$store.getters.getCusInfo.ValidTime,
      tc: nettyApi.TRADE_CODE.selectGSXXCX
    };
    NativeUI.showWaiting("正在查询...");
    IF.transferDataInter(nettyApi.commonRq, param).then((res: any) => {
      NativeUI.closeWaiting();
      if (res.rc === "1") {
        //行政处罚列表数据
        if (res.V_YS_XZCFXX_ARRAY.length !== 0) {
          this.conditionInfoList = res.V_YS_XZCFXX_ARRAY;
        }
        //严重违法信息信息列表
        if (res.BREAK_LAW_INFO.length !== 0) {
          this.illegalInfoList = res.BREAK_LAW_INFO;
        }
        //其他警示信息
        if (res.V_YS_QTTSJS_ARRAY.length !== 0) {
          for (let obj of res.V_YS_QTTSJS_ARRAY) {
            obj.IS_REVOCATION = getText(obj.IS_REVOCATION, "ISREVOCATION");
          }
          this.warningInfoList = res.V_YS_QTTSJS_ARRAY;
        }
      } else {
        if (res.ret_code != "4999999") {
          NativeUI.toast(res.msg);
        }
      }
    });
  }
}
</script>

<style scoped>
/*右侧导航栏 , 控制导航位置*/
::v-deep .van-index-bar__sidebar {
  top: 130px !important;
  right: 5px !important;
  transform: unset;
}
</style>
