style:模具出库/模具入库-新增/编辑隐藏仓库下拉框

main
黄伟杰 3 weeks ago
parent edd219d95d
commit b337c8d654

@ -66,14 +66,15 @@
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="t('MoldManagement.MoldReturn.warehouse')" prop="warehouseId">
<el-col :span="8" v-if="disabled">
<el-form-item :label="t('MoldManagement.MoldReturn.warehouse')" prop="warehouseId">
<el-select
v-model="formData.warehouseId"
clearable
filterable
:placeholder="t('MoldManagement.MoldReturn.placeholderWarehouse')"
class="!w-240px"
disabled
>
<el-option
v-for="item in warehouseList"
@ -168,6 +169,12 @@ const options = [
const subTabsName = ref('item')
const itemFormRef = ref()
const ensureWarehouseId = () => {
if (formData.value.warehouseId !== undefined && formData.value.warehouseId !== null) return
const defaultWarehouse = (warehouseList.value ?? []).find((w: any) => w?.defaultStatus)
formData.value.warehouseId = defaultWarehouse?.id ?? (warehouseList.value?.[0] as any)?.id
}
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
@ -191,6 +198,7 @@ const open = async (type: string, id?: number) => {
//
customerList.value = await CustomerApi.getCustomerSimpleList()
warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
ensureWarehouseId()
}
defineExpose({ open }) // open
@ -259,7 +267,8 @@ const resetForm = () => {
remark: undefined,
fileUrl: undefined,
items: [],
outType: "模具出库"
outType: "模具出库",
warehouseId: undefined
}
formRef.value?.resetFields()
}

@ -48,14 +48,15 @@
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="t('MoldManagement.MoldReturn.warehouse')" prop="warehouseId">
<el-col :span="8" v-if="disabled">
<el-form-item :label="t('MoldManagement.MoldReturn.warehouse')" prop="warehouseId">
<el-select
v-model="formData.warehouseId"
clearable
filterable
:placeholder="t('MoldManagement.MoldReturn.placeholderWarehouse')"
class="!w-240px"
disabled
>
<el-option
v-for="item in warehouseList"
@ -149,6 +150,12 @@ const options = [
const subTabsName = ref('item')
const itemFormRef = ref()
const ensureWarehouseId = () => {
if (formData.value.warehouseId !== undefined && formData.value.warehouseId !== null) return
const defaultWarehouse = (warehouseList.value ?? []).find((w: any) => w?.defaultStatus)
formData.value.warehouseId = defaultWarehouse?.id ?? (warehouseList.value?.[0] as any)?.id
}
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
@ -172,6 +179,7 @@ const open = async (type: string, id?: number) => {
//
customerList.value = await CustomerApi.getCustomerSimpleList()
warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
ensureWarehouseId()
}
defineExpose({ open }) // open

Loading…
Cancel
Save