<template>
  <van-sticky>
    <van-nav-bar>
      <!-- <template #left>
        <van-icon
          name="arrow-left"
          size="18"
          @click="onClickLeft"
          v-show="props.showtype == 'home' ? false : true"
        />
      </template> -->
      <template #title>
        <van-cell class="toptitle" :title="toptitle"></van-cell>
      </template>
      <template #right>
        <van-icon
          v-if="applyStatus == '7101' && showtype == 'list'"
          class-prefix="my-icon"
          name="zengjia"
          size="24"
          color="var(--van-nav-bar-icon-color)"
          @click="toXinzeng()"
        />
      </template>
    </van-nav-bar>
  </van-sticky>
</template>

<script>
export default {
  name: "yinhuantopbar",
};
</script>

<script setup>
import { computed, reactive } from "vue";
import { useRouter } from "vue-router";

const props = defineProps({
  applyStatus: String,
  showtype: String,
});
const emit = defineEmits(["commitSelect", "cancelSelect"]);

const router = useRouter();
let toptitle = computed(() => {
  if (props.applyStatus == "yinhuan") {
    return "隐患排查与治理";
  } else if (props.applyStatus == "7101") {
    return "隐患登记";
  } else if (props.applyStatus == "7102") {
    return "隐患分析";
  } else if (props.applyStatus == "7103") {
    return "隐患整改";
  } else if (props.applyStatus == "7104") {
    return "隐患验收";
  } else if (props.applyStatus == "7106") {
    return "隐患销号";
  } else if (props.applyStatus == "all") {
    return "隐患查询";
  } else {
    return "模块建设中";
  }
});
const onClickLeft = () => {
  history.back();
};
const toXinzeng = () => {
  router.push({
    path: "/yinhuan-detail",
    query: { id: "", flowId: "071", applyStatus: "7101" },
  });
};
</script>

<style scoped>
.van-nav-bar__title .van-cell {
  color: var(--van-gray-9); /* color: var(--van-primary-color); */
  font-size: var(--van-font-size-lg1);
}
.toptitle {
  font-size: 18px;
  color: #757575;
}
</style>
