style: 修改仓储管理中入库单据的新增/编辑弹框样式

main
zhongwenkai 2 months ago
parent 157db7551d
commit 4f6bdec21d

@ -1,11 +1,17 @@
<template> <template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1080"> <div class="dv-repair-panel">
<div class="dv-repair-panel__header">
<div class="dv-repair-panel__title">{{ dialogTitle }}</div>
<el-button text @click="closeForm">
<Icon icon="ep:close" />
</el-button>
</div>
<div class="dv-repair-dialog" v-loading="formLoading">
<el-form <el-form
ref="formRef" ref="formRef"
:model="formData" :model="formData"
:rules="formRules" :rules="formRules"
label-width="auto" label-width="auto"
v-loading="formLoading"
:disabled="disabled" :disabled="disabled"
> >
<el-form-item prop="code"> <el-form-item prop="code">
@ -66,24 +72,6 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="8">
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="formData.supplierId"
clearable
filterable
placeholder="请选择供应商"
class="!w-1/1"
>
<el-option
v-for="item in supplierList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col> -->
<el-col :span="8"> <el-col :span="8">
<el-form-item :label="t('ErpStock.In.remark')" prop="remark"> <el-form-item :label="t('ErpStock.In.remark')" prop="remark">
<el-input <el-input
@ -109,13 +97,14 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</ContentWrap> </ContentWrap>
<template #footer> </div>
<div class="dv-repair-footer">
<el-button @click="closeForm">{{ t('common.cancel') }}</el-button>
<el-button @click="submitForm" type="primary" :disabled="formLoading" v-if="!disabled"> <el-button @click="submitForm" type="primary" :disabled="formLoading" v-if="!disabled">
{{ t('common.ok') }} {{ t('common.ok') }}
</el-button> </el-button>
<el-button @click="dialogVisible = false">{{ t('common.cancel') }}</el-button> </div>
</template> </div>
</Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { StockInApi, StockInVO } from '@/api/erp/stock/in' import { StockInApi, StockInVO } from '@/api/erp/stock/in'
@ -128,7 +117,6 @@ defineOptions({ name: 'StockInForm' })
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formType = ref('') // create - update - detail - const formType = ref('') // create - update - detail -
@ -159,28 +147,27 @@ const options = [
value: '备件入库', value: '备件入库',
label: t('ErpStock.In.tabPart') label: t('ErpStock.In.tabPart')
}, },
// {
// value: '',
// label: '',
// },
{ {
value: '产品入库', value: '产品入库',
label: t('ErpStock.In.tabProduct') label: t('ErpStock.In.tabProduct')
}, },
// {
// value: '',
// label: '',
// disabled: true,
// },
] ]
/** 子表的表单 */ /** 子表的表单 */
const subTabsName = ref('item') const subTabsName = ref('item')
const itemFormRef = ref() const itemFormRef = ref()
//
const openRequestId = ref(0)
/** 关闭表单 */
const closeForm = () => {
openRequestId.value++
emit('closed')
}
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number) => { const open = async (type: string, id?: number) => {
dialogVisible.value = true const currentRequestId = ++openRequestId.value
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
resetForm() resetForm()
@ -189,6 +176,7 @@ const open = async (type: string, id?: number) => {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await StockInApi.getStockIn(id) formData.value = await StockInApi.getStockIn(id)
if (currentRequestId !== openRequestId.value) return
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -199,7 +187,7 @@ const open = async (type: string, id?: number) => {
defineExpose({ open }) // open defineExpose({ open }) // open
/** 提交表单 */ /** 提交表单 */
const emit = defineEmits(['success']) // success const emit = defineEmits(['success', 'closed']) // success
const submitForm = async () => { const submitForm = async () => {
// //
await formRef.value.validate() await formRef.value.validate()
@ -215,9 +203,8 @@ const submitForm = async () => {
await StockInApi.updateStockIn(data) await StockInApi.updateStockIn(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
dialogVisible.value = false
//
emit('success') emit('success')
closeForm()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -237,4 +224,68 @@ const resetForm = () => {
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }
onBeforeUnmount(() => {
openRequestId.value++
})
</script> </script>
<style scoped lang="scss">
.dv-repair-panel {
background: #fff;
border-radius: 12px;
box-shadow: var(--el-box-shadow-light);
}
.dv-repair-panel__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid #ebeef5;
}
.dv-repair-panel__title {
color: #1f2937;
font-size: 18px;
font-weight: 600;
}
.dv-repair-dialog {
max-height: calc(100vh - 220px);
padding: 20px 20px 0;
padding-right: 16px;
overflow-y: auto;
}
.dv-repair-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
padding: 16px 20px 20px;
border-top: 1px solid #ebeef5;
}
@media (max-width: 1200px) {
.dv-repair-dialog :deep(.el-col) {
max-width: 100%;
flex: 0 100%;
}
}
@media (max-width: 768px) {
.dv-repair-panel__header {
padding: 14px 16px;
}
.dv-repair-dialog {
max-height: none;
padding: 16px 16px 0;
overflow-y: visible;
}
.dv-repair-footer {
padding: 16px;
}
}
</style>

@ -1,4 +1,6 @@
<template> <template>
<div class="dv-repair-page">
<template v-if="!formVisible">
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form
@ -44,22 +46,6 @@
class="!w-220px" class="!w-220px"
/> />
</el-form-item> </el-form-item>
<!-- <el-form-item label="供应商" prop="supplierId">
<el-select
v-model="queryParams.supplierId"
clearable
filterable
placeholder="请选择供应商"
class="!w-240px"
>
<el-option
v-for="item in supplierList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item> -->
<el-form-item :label="t('ErpStock.In.warehouse')" prop="warehouseId" v-show="showAllFilters"> <el-form-item :label="t('ErpStock.In.warehouse')" prop="warehouseId" v-show="showAllFilters">
<el-select <el-select
v-model="queryParams.warehouseId" v-model="queryParams.warehouseId"
@ -160,7 +146,6 @@
<ContentWrap> <ContentWrap>
<el-tabs v-model="activeName" @tab-click="handleTabClick"> <el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane :label="t('ErpStock.In.tabProduct')" name="产品入库" /> <el-tab-pane :label="t('ErpStock.In.tabProduct')" name="产品入库" />
<!-- <el-tab-pane :label="t('ErpStock.In.tabMaterial')" name="原料入库" /> -->
<el-tab-pane :label="t('ErpStock.In.tabPart')" name="备件入库" /> <el-tab-pane :label="t('ErpStock.In.tabPart')" name="备件入库" />
<el-tab-pane :label="t('ErpStock.In.tabOther')" name="其他入库" /> <el-tab-pane :label="t('ErpStock.In.tabOther')" name="其他入库" />
</el-tabs> </el-tabs>
@ -186,7 +171,6 @@
prop="productNames" prop="productNames"
min-width="200" min-width="200"
/> />
<!-- <el-table-column label="供应商" align="center" prop="supplierName" sortable /> -->
<el-table-column <el-table-column
:label="t('ErpStock.In.inTime')" :label="t('ErpStock.In.inTime')"
align="center" align="center"
@ -202,13 +186,6 @@
prop="totalCount" prop="totalCount"
:formatter="erpCountTableColumnFormatter" :formatter="erpCountTableColumnFormatter"
/> />
<!-- <el-table-column
label="金额"
align="right"
sortable
prop="totalPrice"
:formatter="erpPriceTableColumnFormatter"
/> -->
<el-table-column <el-table-column
:label="t('ErpStock.In.status')" :label="t('ErpStock.In.status')"
align="center" align="center"
@ -275,9 +252,11 @@
@pagination="getList" @pagination="getList"
/> />
</ContentWrap> </ContentWrap>
</template>
<!-- 表单弹窗添加/修改 --> <!-- 表单面板添加/修改 -->
<StockInForm ref="formRef" @success="getList" /> <StockInForm v-else ref="formRef" @success="getList" @closed="formVisible = false" />
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -325,6 +304,8 @@ const warehouseList = ref<WarehouseVO[]>([]) // 仓库列表
const supplierList = ref<SupplierVO[]>([]) // const supplierList = ref<SupplierVO[]>([]) //
const userList = ref<UserVO[]>([]) // const userList = ref<UserVO[]>([]) //
const formVisible = ref(false) //
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
@ -352,7 +333,10 @@ const resetQuery = () => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {
formVisible.value = true
nextTick(() => {
formRef.value.open(type, id) formRef.value.open(type, id)
})
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -420,8 +404,6 @@ onMounted(async () => {
supplierList.value = await SupplierApi.getSupplierSimpleList() supplierList.value = await SupplierApi.getSupplierSimpleList()
userList.value = await UserApi.getSimpleUserList() userList.value = await UserApi.getSimpleUserList()
}) })
// TODO
// TODO
let activeName = '产品入库' let activeName = '产品入库'
const handleTabClick = (tab: TabsPaneContext) => { const handleTabClick = (tab: TabsPaneContext) => {
queryParams.inType = tab.paneName queryParams.inType = tab.paneName

Loading…
Cancel
Save