| | |
| | | |
| | | <script setup> |
| | | import { ref, computed, onMounted, nextTick } from "vue"; |
| | | import { onShow } from "@dcloudio/uni-app"; |
| | | import { onShow, onLoad } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import dayjs from "dayjs"; |
| | | import { getOptions } from "@/api/procurementManagement/procurementLedger.js"; |
| | |
| | | |
| | | // 是否为编辑模式 |
| | | const isEdit = computed(() => { |
| | | const id = getPageId(); |
| | | const id = optionsId.value; |
| | | return !!id; |
| | | }); |
| | | |
| | |
| | | const v = form.value || {}; |
| | | return !!(v.productMainId != null || v.purchaseLedgerId != null); |
| | | }); |
| | | |
| | | // 获取页面ID |
| | | const getPageId = () => { |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | return currentPage.options.id; |
| | | }; |
| | | |
| | | // 返回上一页 |
| | | const goBack = () => { |
| | |
| | | |
| | | // 初始化表单 |
| | | const initForm = async () => { |
| | | const id = getPageId(); |
| | | const id = optionsId.value; |
| | | if (id) { |
| | | // 编辑模式,加载数据 |
| | | // 先重置表单数据 |
| | |
| | | onShow(() => { |
| | | initForm(); |
| | | }); |
| | | |
| | | const optionsId = ref(""); |
| | | onLoad(options => { |
| | | optionsId.value = options.id || ""; |
| | | getDetail(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |