<template>
  <!-- 风险预警信号详情 -->
  <div>
    <title-bar title="预警信号详情" @clickLef="onClick">
      <van-icon slot="left" name="cross" size="24" />
    </title-bar>
    <!-- <div class="text-content"> -->
    <anchor-nav ref="anchorNav" :navList="navList">
      <template>
        <div slot="riskDetail">
          <!--  -->
          <table-double-view
            :data="riskArray"
            :keyValue="keyValueDouble"
          ></table-double-view>
          <table-single-view
            :data="riskArray"
            :keyValue="keyValueSingle"
          ></table-single-view>
          <table-single-view
            v-for="(item,index) in rewDescList"
            :key="index"
            :data="item"
            :keyValue="keyValueSingle2"
          ></table-single-view>
        </div>
      </template>
    </anchor-nav>
    <!-- </div> -->
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import nettyApi from "@/constants/api/ms-netty/netty.api.ts";
import IF from "@/public/factory/InterFaceFactory";
import { NativeUI } from "@/public/ts/NativeUI";
import TableDoubleView from "@/public/TableDoubleView.vue";
import TableSingleView from "@/public/TableSingleView.vue";
/**
 *@description: 风险预警信号
 *@author: wanghang
 *@date: 2022-02-18
 */

@Component({
  name: "RiskWarning",
  components: { TableDoubleView, TableSingleView },
})
export default class RiskWarningItemDetail extends Vue {
  riskInfo: any = {};
  navList = [{ key: "riskDetail", titleText: "预警详情信息" }];
  riskArray = {};
  keyValueDouble = {
    rule_type: "规则大类",
    rule_name: "规则名称",
    serno: "流水号",
    occur_date: "生成日期",
    release_type: "解除方式",
    data_source: "数据来源",
    // rew_level: "20",
    // rew_status: "20",
  };
  keyValueSingle = {
    check_desc: "情况说明",
  };
  keyValueSingle2 = {
    rew_desc: "预警说明",
  };

  rewDescList: any[] = [];

  goRiskDeail(item: any) {}
  onClick() {}
  //风险预警详情信息
  selectFXYJXQCX() {
    let param = {
      serno: this.$route.query.serno,
      tc: nettyApi.TRADE_CODE.selectFXYJXQCX,
    };
    NativeUI.showWaiting("正在查询...");
    return IF.transferDataInter(nettyApi.commonRq, param).then((res: any) => {
      NativeUI.closeWaiting();
      if (res.rc == "1") {
        this.riskArray = res;
        if (res.rew_desc != "" && res.rew_desc != null) {
          this.rewDescList.push({ rew_desc: res.rew_desc });
        }
        if (res.col1 != "" && res.col1 != null) {
          this.rewDescList.push({ rew_desc: res.col1 });
        }
        if (res.col2 != "" && res.col2 != null) {
          this.rewDescList.push({ rew_desc: res.col2 });
        }
        if (res.col3 != "" && res.col3 != null) {
          this.rewDescList.push({ rew_desc: res.col3 });
        }
        console.log(this.rewDescList);
      } else {
        NativeUI.toast(res.msg);
      }
    });
  }
  mounted() {
    this.selectFXYJXQCX();
  }
}
</script>

<style scoped>
.text-content {
  width: 95%;
  height: calc(100vh - 60px);
  margin: 0 auto;
  margin-top: 2%;
}
.text-content-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2%;
}
::v-deep .van-index-bar__sidebar {
  top: 130px !important;
  right: 5px !important;
  transform: unset;
}
/* .level-box {
  margin-left: 5%;
  width: 80%;
} */
</style>
