fix: open sample product form inline

besure_bit
ck-chenkang 3 weeks ago
parent 86058e36d1
commit a4c2ccac74

@ -1,6 +1,7 @@
<template>
<ContentWrap>
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="auto">
<template v-if="!formVisible">
<ContentWrap>
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="auto">
<el-form-item label="样品码" prop="barCode">
<el-input v-model="queryParams.barCode" placeholder="请输入样品码" clearable class="!w-220px" @keyup.enter="handleQuery" />
</el-form-item>
@ -27,11 +28,11 @@
<Icon icon="ep:plus" class="mr-5px" />新增样品
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
</el-form>
</ContentWrap>
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id">
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id">
<el-table-column label="样品码" align="center" prop="barCode" min-width="160" />
<el-table-column label="样品名称" align="left" prop="name" min-width="180" />
<el-table-column label="样品类型" align="center" prop="categoryType" min-width="110">
@ -67,23 +68,28 @@
/>
</template>
</el-table-column>
</el-table>
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize" @pagination="getList" />
</ContentWrap>
</el-table>
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize" @pagination="getList" />
</ContentWrap>
</template>
<ProductForm v-else ref="formRef" @success="handleFormSuccess" @closed="handleFormClosed" />
</template>
<script setup lang="ts">
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import { BitWmsApi } from '@/api/erp/bitwms'
import BitWmsPrintButton from '../components/BitWmsPrintButton.vue'
import ProductForm from '@/views/erp/product/product/ProductForm.vue'
defineOptions({ name: 'ErpBitWmsSample' })
const router = useRouter()
const loading = ref(true)
const list = ref<any[]>([])
const total = ref(0)
const queryFormRef = ref()
const formRef = ref()
const formVisible = ref(false)
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
@ -119,9 +125,22 @@ const resetQuery = () => {
}
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 openProductDetail = (id: number) => router.push({ path: '/erp/product/product', query: { id, type: 'detail' } })
const openProductForm = async (type: 'create' | 'update' | 'detail', id?: number) => {
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)
</script>

Loading…
Cancel
Save