Browse Source

包装信息完善

master
陈薪名 1 year ago
parent
commit
a364b618a6
  1. 103
      src/views/wms/itempackaging/ItempackagingForm.vue
  2. 39
      src/views/wms/itempackaging/index.vue

103
src/views/wms/itempackaging/ItempackagingForm.vue

@ -1,103 +0,0 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<Form ref="formRef" v-loading="formLoading" :rules="ItempackagingRules" :schema="Itempackaging.allSchemas.formSchema" :is-col="true" />
<template #footer>
<ButtonBase :Butttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
</template>
</Dialog>
<SearchTable ref="searchTableRef" dialogTitle="物料基础信息" />
</template>
<script setup lang="ts">
import { Itempackaging, ItempackagingRules, ItemBasic } from '@/utils/disposition/tableColumns'
import * as ItempackagingApi from '@/api/wms/itempackaging'
import { SearchTable } from '@/components/SearchTable';
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ButtonBase from '@/components/XButton/src/ButtonBase.vue'
import * as ItembasicApi from '@/api/wms/itembasic'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formRef = ref() // Ref
/** 弹层操作 */
const searchTableRef = ref()
const opensearchTable = () => {
searchTableRef.value.open('物品基础信息', ItemBasic.allSchemas, ItembasicApi.getItembasicPage)
}
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
const res = await ItempackagingApi.getItempackaging(id)
unref(formRef)?.setValues(res)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 弹窗按钮 */
const Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null), //
]
/** 按钮事件 */
const buttonBaseClick = (val) => {
//
if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
const elForm = unref(formRef)?.getElFormRef()
//
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
formLoading.value = true
try {
const data = unref(formRef)?.formModel as ItempackagingApi.ItempackagingVO
if (formType.value === 'create') {
await ItempackagingApi.createItempackaging(data)
message.success(t('common.createSuccess'))
} else {
await ItempackagingApi.updateItempackaging(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
unref(formRef)?.resetFields()
}
</script>

39
src/views/wms/itempackaging/index.vue

@ -5,10 +5,7 @@
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" />
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -29,16 +26,23 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase <ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
:Butttondata="butttondata"
@button-base-click="buttonTableClick($event,row)"
/>
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<ItempackagingForm ref="formRef" @success="getList" /> <BasicForm
ref="basicFormRef"
@success="getList"
:rules="ItempackagingRules"
:formAllSchemas="Itempackaging.allSchemas"
searchTableTitle="物料基础信息"
:searchTableAllSchemas="ItemBasic.allSchemas"
:searchTablePage="ItembasicApi.getItembasicPage"
:apiUpdate="ItempackagingApi.updateItempackaging"
:apiCreate="ItempackagingApi.createItempackaging"
/>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Itempackaging.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="Itempackaging.allSchemas" />
@ -50,14 +54,14 @@
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import * as ItempackagingApi from '@/api/wms/itempackaging' import * as ItempackagingApi from '@/api/wms/itempackaging'
import ItempackagingForm from './ItempackagingForm.vue' import * as ItembasicApi from '@/api/wms/itembasic'
import { Itempackaging } from '@/utils/disposition/tableColumns' import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import { Itempackaging, ItempackagingRules, ItemBasic } from '@/utils/disposition/tableColumns'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'Itempackaging' }) defineOptions({ name: 'Itempackaging' })
const message = useMessage() // const message = useMessage() //
@ -110,18 +114,19 @@ const butttondata = [
] ]
// - // -
const buttonTableClick = (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
openForm('update', row.id) // const res = await ItempackagingApi.getItempackaging(row.id)
openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) handleDelete(row.id)
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const basicFormRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, row?: any) => {
formRef.value.open(type, id) basicFormRef.value.open(type, row)
} }
/** 详情操作 */ /** 详情操作 */

Loading…
Cancel
Save