<template>
  <view>
    <cu-custom bgColor="bg-gradual-blueness" :isBack="true">
      <block slot="backText">返回</block>
      <block slot="content">安全环保检查流程图</block>
    </cu-custom>
    <view class="form">
      <uni-steps :options="varList" direction="column" :active="active"></uni-steps>
    </view>
    <view class="cu-bar btn-group" style="margin-top: 30upx;">
      <button class="cu-btn bg-green margin-tb-sm lg" @click="goback()">返回
      </button>
    </view>
  </view>
</template>

<script>
import {
  basePath
} from '@/common/tool.js';
import uniSteps from '@dcloudio/uni-ui/lib/uni-steps/uni-steps'
// import {setSafetyenvironmentalFlow} from "../../../../../qa-regulatory-gwj-app/api";

export default {
  components: {
    'uni-steps': uniSteps
  },
  data() {
    return {
      basePath:basePath,
      msg: 'add',
      noClick: true,
      ID: '',
      varList: [],
      active: 0
    }
  },
  onLoad(event) {
    this.ID = event.id
    this.getData();
  },
  methods: {
    async getData() {
      var _this = this;
      uni.showLoading({
        title: '请稍候'
      })
      uni.request({
        url: basePath + '/app/safetyenvironmental/showFlowChart',
        method: 'POST',
        header: {
          'Content-type': 'application/x-www-form-urlencoded'
        },
        data: {
          ID: _this.ID,
        },
        success: (res) => {
          if ("success" == res.data.result) {
            this.active = Number(res.data.active)
            this.varList = res.data.varList
            console.log("打印数据："+JSON.stringify(this.active, null, 2));
            console.log(JSON.stringify(this.varList, null, 2));
            uni.hideLoading();
          } else if ("exception" == res.data.result) {
            uni.showToast({
              title: '错误',
              duration: 2000
            });
          }
        }
      });
    },

    goback() {
      uni.navigateBack({
        delta: 1
      });
      uni.hideLoading();
    },
  }
}
</script>

<style lang="scss">
.status-btn {
  /* #ifndef APP-NVUE */
  display: flex;
  /* #endif */
  flex-direction: row;
  align-items: center;
  justify-content: center;
  height: 92 rpx;
  margin: 30 rpx;
  background-color: #007AFF;
}

.example-body {
  /* #ifndef APP-NVUE */
  display: block;
  /* #endif */
  padding: 15px;
  flex-direction: row;
}
</style>
