<template>
  <view class="leave-page">
    <JsQjEdit :data="qjData" v-if="qjData.id" />
  </view>
</template>

<script setup lang="ts">
import JsQjEdit from "./components/jsQjEdit.vue"
import { findQjById } from '@/api/base/jsQjApi';
import { onLoad } from '@dcloudio/uni-app';
import { useDataStore } from "@/store/modules/data";
const { setData, getData } = useDataStore();

const dbFlag = ref(false);

const qjData = computed(() => getData);

onLoad(async (data: any) => {
  // 从待办过来的，需要从后端获取数据
  if (data && data.from && data.from == "db") {
    dbFlag.value = true;
    const res = await findQjById({ id: data.id });
    nextTick(() => {
      setData(res.result);
    });
  } else {
    dbFlag.value = false;
  }
});
</script>

<style lang="scss" scoped>
.leave-page {
  height: 100vh;
}
</style> 