<template>
  <div class="d-page d-flex flex-column">
    <title-bar :title="title" @clickLef="onClick">
      <van-icon slot="left" name="cross" size="30" />
    </title-bar>
    <anchor-nav ref="anchorNav" :navList="navList">
      <template slot="baseInfo">
        <div class="flow-y-dhc">
          <button class="verify-view-details" @click="HistoryClick">审批流程历史查询</button>
          <table-double-view :data="dataBasic" :keyValue="keyValueDouble"></table-double-view>
        </div>
      </template>
    </anchor-nav>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import BasicInformation from "@/components/customer-information/business-information/overview/BasicInformation.vue";
import TableDoubleView from "@/public/TableDoubleView.vue";
import TableSingleView from "@/public/TableSingleView.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 { toMillion } from "@/public/ts/money.util";
import { getText } from "@/stores";
import { forTime } from "@/public/ts/date.util";

/**
 * @Description 流程查询信息
 * @Author Kangzhirui
 * @Date 2022-3-3 下午 21.48
 */
@Component({
  name: "ProcessView",
  components: { BasicInformation, TableDoubleView, TableSingleView }
})
export default class ProcessView extends Vue {
  title = "流程查询信息"; // 页面标题

  indexList = ["流程信息"];
  custName = "";
  custType = "";
  custState = "";
  resetvalue = false;

  pageNo = 1;
  pullup = true;
  pulldown = true;
  nodata = true;
  IF: any;
  //流程查询
  pk_value = '';
  cus_id = '';
  list: any = [];

  navList = [{ key: "baseInfo", titleText: "流程信息" }];
  keyValueDouble = {
    appl_type:	'业务类型',
    appl_type_cnName: '业务类型名称',
    pk_value:	'业务申请号',
    cus_name:	'客户名称',
    cus_id:	'客户号',
    amt:	'金额',
    prenodename:	'上一节点',
    nodename:	'当前节点',
    currentnodeusers_displayname:	'流程当前办理人',
    wfi_apply_org_displayname:	'客户经理所属机构',
    instanceid: '流程实例编号',
    nodeid: '节点编号',
    wfsign: '流程标识',
    nodestarttime:	'当前任务开始时间'

  };
  dataBasic = {
    appl_type:	this.$store.getters.getCusInfo.appl_type,
    appl_type_cnName: this.$store.getters.getCusInfo.appl_type_cnName,
    pk_value:	this.$store.getters.getCusInfo.pk_value,
    cus_name:	this.$store.getters.getCusInfo.cus_name,
    cus_id:	this.$store.getters.getCusInfo.cus_id,
    amt: this.$store.getters.getCusInfo.amt,
    prenodename:	this.$store.getters.getCusInfo.prenodename,
    nodename:	this.$store.getters.getCusInfo.nodename,
    currentnodeusers_displayname:	this.$store.getters.getCusInfo.currentnodeusers_displayname,
    wfi_apply_org_displayname:	this.$store.getters.getCusInfo.wfi_apply_org_displayname,
    instanceid: this.$store.getters.getCusInfo.instanceid,
    nodeid: this.$store.getters.getCusInfo.nodeid,
    wfsign: this.$store.getters.getCusInfo.wfsign, //流程标识
    nodestarttime:	this.$store.getters.getCusInfo.nodestarttime
  };

  HistoryClick() {
    this.$router.push({
      path: "HistoryView"
    });
  }

  /**
   * @Description 流程信息查询
   * @Author Kangzhirui
   * @Date 2022-03-03 下午 21:48
   */
  /**
   * @Description 对公流程列表查询
   * @Author Kangzhirui
   * @Date 2022-3-3 下午 21.48
   */
  selectProcess(pageNo = 1) {
    this.nodata = true;
    const param = {
      // user_code: sessionStorage.getItem('user_code'),
      //流程查询
      pk_value: this.$store.getters.getCusInfo.pk_value, //业务申请号
      cus_id: this.cus_id,	//客户号
      maxLine: "10",//每页最大数据
      targetPage: pageNo,//目标页
      tc: nettyApi.TRADE_CODE.selectProcess
    };
    NativeUI.showWaiting("正在查询...");
    return IF.transferDataInter(nettyApi.commonRq, param).then((res: any) => {
      NativeUI.closeWaiting();
      if (res.rc == "1") {
        if (pageNo == 1) {
          this.list = res.iCollWL__resultset;
        } else {
          this.list = this.list.concat(res.iCollWL__resultset);
        }
      } else {
        NativeUI.toast(res.msg);
      }
      if (res.iCollWL__resultset && res.iCollWL__resultset.length < 10) {
        this.pullup = false;
      }
      if (this.list.length == 0) {
        this.nodata = false;
        this.pulldown = false;
      }
    });
  }

  onClick() {
    console.log(111111);
  }

  mounted() {
    this.selectProcess();
  }
}
</script>

<style scoped>
span {
  color: #999999;
  font-size: 16px;
}

.verify-view-details {
  float: right;
  margin-bottom: 10px;
  color: #fd5065;
  font-size: 12px;
  border: 1px solid #fd5065;
  border-radius: 4px;
  background-color: white;
  padding: 0.5% 0.8%;
  font-family: "苹方 粗体", "苹方 中等", "苹方";
}
/*右侧导航栏*/
::v-deep .van-index-bar__sidebar {
  top: 130px !important;
  right: 5px !important;
  transform: unset;
}
</style>
