fix: open sample product form inline

besure_bit
ck-chenkang 1 month ago
parent 86058e36d1
commit a4c2ccac74

@ -1,4 +1,5 @@
<template> <template>
<template v-if="!formVisible">
<ContentWrap> <ContentWrap>
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="auto"> <el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="auto">
<el-form-item label="样品码" prop="barCode"> <el-form-item label="样品码" prop="barCode">
@ -72,18 +73,23 @@
</ContentWrap> </ContentWrap>
</template> </template>
<ProductForm v-else ref="formRef" @success="handleFormSuccess" @closed="handleFormClosed" />
</template>
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import { BitWmsApi } from '@/api/erp/bitwms' import { BitWmsApi } from '@/api/erp/bitwms'
import BitWmsPrintButton from '../components/BitWmsPrintButton.vue' import BitWmsPrintButton from '../components/BitWmsPrintButton.vue'
import ProductForm from '@/views/erp/product/product/ProductForm.vue'
defineOptions({ name: 'ErpBitWmsSample' }) defineOptions({ name: 'ErpBitWmsSample' })
const router = useRouter()
const loading = ref(true) const loading = ref(true)
const list = ref<any[]>([]) const list = ref<any[]>([])
const total = ref(0) const total = ref(0)
const queryFormRef = ref() const queryFormRef = ref()
const formRef = ref()
const formVisible = ref(false)
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
@ -119,9 +125,22 @@ const resetQuery = () => {
} }
const loadSampleLabel = async (id: number) => await BitWmsApi.getSampleLabel(id) const loadSampleLabel = async (id: number) => await BitWmsApi.getSampleLabel(id)
const openProductCreate = () => router.push({ path: '/erp/product/product' })
const openProductEdit = (id: number) => router.push({ path: '/erp/product/product', query: { id, type: 'update' } }) const openProductForm = async (type: 'create' | 'update' | 'detail', id?: number) => {
const openProductDetail = (id: number) => router.push({ path: '/erp/product/product', query: { id, type: 'detail' } }) formVisible.value = true
await nextTick()
formRef.value.open(type, id)
}
const openProductCreate = () => openProductForm('create')
const openProductEdit = (id: number) => openProductForm('update', id)
const openProductDetail = (id: number) => openProductForm('detail', id)
const handleFormSuccess = async () => {
formVisible.value = false
await getList()
}
const handleFormClosed = () => {
formVisible.value = false
}
onMounted(getList) onMounted(getList)
</script> </script>

Loading…
Cancel
Save