<template>
  <view class="content">
    <view class="search card">
      <u--input
          prefixIcon="search"
          placeholder="请输入关键字"
          border="surround"
          v-model="form.keyjobnumber"
          clearable
          shape="circle"
      ></u--input>
      <view class="bth-mini ml-10">
        <u-button type="success" text="确定" @click="getList"></u-button>
      </view>

    </view>
    <u-list @scrolltolower="scrolltolower" v-if="list.length > 0">
      <u-list-item v-for="(item, index) in list" :key="index">
        <view>
          <view class="flex-between main-title">
            <text>作业证编号:{{ item.JOB_NUMBER }}</text>
            <text>动火等级:特级动火</text>
          </view>
          <view class="flex-between mt-10 subtitle">
            <text>申请人办理:{{ item.userName }}</text>
            <text>作业类型:{{ item.JOB_TYPE_INDEX == '0' ? '内部作业' : '相关方作业' }}</text>
          </view>
          <view class="flex-between mt-10 subtitle">
            <text>特级动火申请审核状态:(港股)安委会办公室审批</text>
          </view>
          <view class="flex-end mt-10 see_btn">
            <view class="wrap">
              <u-button type="primary" text="流程图" size="mini"
                        @click="fnNavigatorSteps(item.HOTWORKAPPLICATION_ID)"></u-button>
            </view>
            <view class="wrap ml-10">
              <u-button type="primary" text="审批" size="mini"
                        @click="fnNavigatorDetail(item.HOTWORKAPPLICATION_ID)"></u-button>
            </view>

          </view>
        </view>
      </u-list-item>
    </u-list>
    <empty v-else></empty>
  </view>
</template>

<script>
import {getHotWorkListByState} from '../../../api/index'

export default {
  data() {
    return {
      pageSize: 10,
      currentPage: 1,
      totalPage: 0,
      list: [],
      form: {
        STATE: '36',
        loginUserId: ''
      }
    }
  },
  computed: {
    userInfo() {
      return this.$store.getters.getUserInfo
    }
  },
  onShow() {
    this.getList()
  },
  methods: {
    async getList() {
      let resData = await getHotWorkListByState({
        ...this.form,
        'showCount': this.pageSize,
        'currentPage': this.currentPage,
        'loginUserId': this.userInfo.USER_ID
      });
      this.list = resData.varList
    },
    fnNavigatorDetail(HOTWORKAPPLICATION_ID) {
      uni.$u.route({
        url: '/pages/super-hot/security-committee/detail',
        params: {
          HOTWORKAPPLICATION_ID,
        }
      })
    },
    fnNavigatorSteps(HOTWORKAPPLICATION_ID) {
      uni.$u.route({
        url: '/pages/super-hot/steps/steps',
        params: {
          HOTWORKAPPLICATION_ID,
        }
      })
    },
    scrolltolower() {
      this.currentPage++;
      if (this.totalPage >= this.currentPage) this.getData();
    },
  }
}
</script>

<style scoped lang="scss">
.see_btn {
  display: flex;
  justify-content: flex-end;

  .wrap {
    //width: 200rpx;
    margin: 0 10rpx;
  }
}

</style>