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

main
黄伟杰 3 weeks ago
parent edd219d95d
commit b337c8d654

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

@ -48,7 +48,7 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8" v-if="disabled">
<el-form-item :label="t('MoldManagement.MoldReturn.warehouse')" prop="warehouseId"> <el-form-item :label="t('MoldManagement.MoldReturn.warehouse')" prop="warehouseId">
<el-select <el-select
v-model="formData.warehouseId" v-model="formData.warehouseId"
@ -56,6 +56,7 @@
filterable filterable
:placeholder="t('MoldManagement.MoldReturn.placeholderWarehouse')" :placeholder="t('MoldManagement.MoldReturn.placeholderWarehouse')"
class="!w-240px" class="!w-240px"
disabled
> >
<el-option <el-option
v-for="item in warehouseList" v-for="item in warehouseList"
@ -149,6 +150,12 @@ const options = [
const subTabsName = ref('item') const subTabsName = ref('item')
const itemFormRef = ref() 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) => { const open = async (type: string, id?: number) => {
dialogVisible.value = true dialogVisible.value = true
@ -172,6 +179,7 @@ const open = async (type: string, id?: number) => {
// //
customerList.value = await CustomerApi.getCustomerSimpleList() customerList.value = await CustomerApi.getCustomerSimpleList()
warehouseList.value = await WarehouseApi.getWarehouseSimpleList() warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
ensureWarehouseId()
} }
defineExpose({ open }) // open defineExpose({ open }) // open

Loading…
Cancel
Save