| | |
| | | |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <ElButton @click="handleCancel">取消</ElButton> |
| | | <ElButton type="primary" @click="handleSubmit">确定</ElButton> |
| | | <ElButton @click="handleCancel">{{ t('common.cancel') }}</ElButton> |
| | | <ElButton type="primary" @click="handleSubmit">{{ t('common.confirm') }}</ElButton> |
| | | </span> |
| | | </template> |
| | | </ElDialog> |
| | |
| | | |
| | | <script setup> |
| | | import { computed, nextTick, reactive, ref, watch } from 'vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import ArtForm from '@/components/core/forms/art-form/index.vue' |
| | | import { |
| | | buildWarehouseAreasDialogModel, |
| | |
| | | const emit = defineEmits(['update:visible', 'submit']) |
| | | const formRef = ref() |
| | | const form = reactive(createWarehouseAreasFormState()) |
| | | const { t } = useI18n() |
| | | |
| | | const isEdit = computed(() => props.dialogType === 'edit') |
| | | const dialogTitle = computed(() => (isEdit.value ? '编辑库区' : '新增库区')) |
| | | const dialogTitle = computed(() => |
| | | isEdit.value |
| | | ? t('pages.basicInfo.warehouseAreas.dialog.titleEdit') |
| | | : t('pages.basicInfo.warehouseAreas.dialog.titleCreate') |
| | | ) |
| | | |
| | | const rules = computed(() => ({ |
| | | warehouseId: [{ required: true, message: '请选择仓库', trigger: 'change' }], |
| | | code: [{ required: true, message: '请输入库区编码', trigger: 'blur' }], |
| | | name: [{ required: true, message: '请输入库区名称', trigger: 'blur' }], |
| | | type: [{ required: true, message: '请选择业务类型', trigger: 'change' }], |
| | | flagMinus: [{ required: true, message: '请选择允许负库存', trigger: 'change' }], |
| | | flagMix: [{ required: true, message: '请选择支持混放', trigger: 'change' }] |
| | | warehouseId: [{ required: true, message: t('pages.basicInfo.warehouseAreas.validation.warehouse'), trigger: 'change' }], |
| | | code: [{ required: true, message: t('pages.basicInfo.warehouseAreas.validation.code'), trigger: 'blur' }], |
| | | name: [{ required: true, message: t('pages.basicInfo.warehouseAreas.validation.name'), trigger: 'blur' }], |
| | | type: [{ required: true, message: t('pages.basicInfo.warehouseAreas.validation.type'), trigger: 'change' }], |
| | | flagMinus: [{ required: true, message: t('pages.basicInfo.warehouseAreas.validation.flagMinus'), trigger: 'change' }], |
| | | flagMix: [{ required: true, message: t('pages.basicInfo.warehouseAreas.validation.flagMix'), trigger: 'change' }] |
| | | })) |
| | | |
| | | const formItems = computed(() => [ |
| | | { |
| | | label: '仓库', |
| | | label: t('pages.basicInfo.warehouseAreas.table.warehouseName'), |
| | | key: 'warehouseId', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择仓库', |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.warehouse'), |
| | | clearable: true, |
| | | filterable: true, |
| | | options: props.warehouseOptions |
| | | } |
| | | }, |
| | | { |
| | | label: '库区编码', |
| | | label: t('pages.basicInfo.warehouseAreas.table.code'), |
| | | key: 'code', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入库区编码', |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.code'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '库区名称', |
| | | label: t('pages.basicInfo.warehouseAreas.table.name'), |
| | | key: 'name', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入库区名称', |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.name'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '业务类型', |
| | | label: t('pages.basicInfo.warehouseAreas.table.type'), |
| | | key: 'type', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择业务类型', |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.type'), |
| | | clearable: true, |
| | | filterable: true, |
| | | options: props.typeOptions |
| | | } |
| | | }, |
| | | { |
| | | label: '货主', |
| | | label: t('pages.basicInfo.warehouseAreas.table.shipperName'), |
| | | key: 'shipperId', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择货主', |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.shipper'), |
| | | clearable: true, |
| | | filterable: true, |
| | | options: props.shipperOptions |
| | | } |
| | | }, |
| | | { |
| | | label: '供应商', |
| | | label: t('pages.basicInfo.warehouseAreas.table.supplierName'), |
| | | key: 'supplierId', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择供应商', |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.supplier'), |
| | | clearable: true, |
| | | filterable: true, |
| | | options: props.supplierOptions |
| | | } |
| | | }, |
| | | { |
| | | label: '允许负库存', |
| | | label: t('pages.basicInfo.warehouseAreas.table.flagMinus'), |
| | | key: 'flagMinus', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择', |
| | | options: getWarehouseAreasFlagOptions() |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.flagMinus'), |
| | | options: getWarehouseAreasFlagOptions(t) |
| | | } |
| | | }, |
| | | { |
| | | label: '标签管理', |
| | | label: t('pages.basicInfo.warehouseAreas.table.flagLabelManage'), |
| | | key: 'flagLabelMange', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择', |
| | | options: getWarehouseAreasFlagOptions() |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.flagLabelManage'), |
| | | options: getWarehouseAreasFlagOptions(t) |
| | | } |
| | | }, |
| | | { |
| | | label: '支持混放', |
| | | label: t('pages.basicInfo.warehouseAreas.table.flagMix'), |
| | | key: 'flagMix', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择', |
| | | options: getWarehouseAreasFlagOptions() |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.flagMix'), |
| | | options: getWarehouseAreasFlagOptions(t) |
| | | } |
| | | }, |
| | | { |
| | | label: '状态', |
| | | label: t('table.status'), |
| | | key: 'status', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择状态', |
| | | options: getWarehouseAreasStatusOptions() |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.status'), |
| | | options: getWarehouseAreasStatusOptions(t) |
| | | } |
| | | }, |
| | | { |
| | | label: '排序', |
| | | label: t('pages.basicInfo.warehouseAreas.table.sort'), |
| | | key: 'sort', |
| | | type: 'number', |
| | | props: { |
| | |
| | | } |
| | | }, |
| | | { |
| | | label: '备注', |
| | | label: t('table.remark'), |
| | | key: 'memo', |
| | | type: 'input', |
| | | span: 24, |
| | | props: { |
| | | type: 'textarea', |
| | | rows: 3, |
| | | placeholder: '请输入备注', |
| | | placeholder: t('pages.basicInfo.warehouseAreas.placeholders.memo'), |
| | | clearable: true |
| | | } |
| | | } |