|
|
@ -5,8 +5,13 @@ |
|
|
|
|
|
|
|
</div> |
|
|
|
<template #footer> |
|
|
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button> |
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button> |
|
|
|
<!-- <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button> |
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button> --> |
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="Butttondata" |
|
|
|
@buttonBaseClick="buttonBaseClick" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
</Dialog> |
|
|
@ -15,6 +20,7 @@ |
|
|
|
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' |
|
|
|
import * as ItembasicApi from '@/api/wms/itembasic' |
|
|
|
import { ItemBasic, ItemBasicRules } from '@/utils/disposition/tableColumns.ts' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
|
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
@ -23,49 +29,6 @@ const dialogVisible = ref(false) // 弹窗的是否展示 |
|
|
|
const dialogTitle = ref('') // 弹窗的标题 |
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|
|
|
const formData = ref({ |
|
|
|
code: undefined, |
|
|
|
name: undefined, |
|
|
|
desc1: undefined, |
|
|
|
desc2: undefined, |
|
|
|
status: undefined, |
|
|
|
uom: undefined, |
|
|
|
altUom: undefined, |
|
|
|
isStdPack: undefined, |
|
|
|
enableBuy: undefined, |
|
|
|
enableMake: undefined, |
|
|
|
enableOutsourcing: undefined, |
|
|
|
isRecycled: undefined, |
|
|
|
isPhantom: undefined, |
|
|
|
abcClass: undefined, |
|
|
|
type: undefined, |
|
|
|
category: undefined, |
|
|
|
itemGroup: undefined, |
|
|
|
color: undefined, |
|
|
|
configuration: undefined, |
|
|
|
project: undefined, |
|
|
|
eqLevel: undefined, |
|
|
|
validityDays: undefined, |
|
|
|
available: undefined, |
|
|
|
activeTime: undefined, |
|
|
|
expireTime: undefined, |
|
|
|
remark: undefined |
|
|
|
}) |
|
|
|
const formRules = reactive({ |
|
|
|
code: [{ required: true, message: '代码不能为空', trigger: 'blur' }], |
|
|
|
status: [{ required: true, message: '状态不能为空', trigger: 'change' }], |
|
|
|
uom: [{ required: true, message: '计量单位不能为空', trigger: 'change' }], |
|
|
|
isStdPack: [{ required: true, message: '是否标包不能为空', trigger: 'change' }], |
|
|
|
enableBuy: [{ required: true, message: '可采购不能为空', trigger: 'change' }], |
|
|
|
enableMake: [{ required: true, message: '可制造不能为空', trigger: 'change' }], |
|
|
|
enableOutsourcing: [{ required: true, message: '可委外加工不能为空', trigger: 'change' }], |
|
|
|
isRecycled: [{ required: true, message: '回收件不能为空', trigger: 'change' }], |
|
|
|
isPhantom: [{ required: true, message: '虚零件不能为空', trigger: 'change' }], |
|
|
|
abcClass: [{ required: true, message: 'ABC类不能为空', trigger: 'change' }], |
|
|
|
type: [{ required: true, message: '类型不能为空', trigger: 'change' }], |
|
|
|
validityDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }], |
|
|
|
available: [{ required: true, message: '是否可用不能为空', trigger: 'blur' }] |
|
|
|
}) |
|
|
|
const formRef = ref() // 表单 Ref |
|
|
|
|
|
|
|
/** 打开弹窗 */ |
|
|
@ -75,14 +38,14 @@ const open = async (type: string, id?: number) => { |
|
|
|
formType.value = type |
|
|
|
resetForm() |
|
|
|
// 修改时,设置数据 |
|
|
|
if (id) { |
|
|
|
formLoading.value = true |
|
|
|
try { |
|
|
|
formData.value = await ItembasicApi.getItembasic(id) |
|
|
|
} finally { |
|
|
|
formLoading.value = false |
|
|
|
} |
|
|
|
} |
|
|
|
// if (id) { |
|
|
|
// formLoading.value = true |
|
|
|
// try { |
|
|
|
// formData.value = await ItembasicApi.getItembasic(id) |
|
|
|
// } finally { |
|
|
|
// formLoading.value = false |
|
|
|
// } |
|
|
|
// } |
|
|
|
} |
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|
|
|
|
|
|
@ -144,6 +107,24 @@ const resetForm = () => { |
|
|
|
} |
|
|
|
formRef.value?.resetFields() |
|
|
|
} |
|
|
|
|
|
|
|
// 弹窗按钮 |
|
|
|
const Butttondata = [ |
|
|
|
defaultButtons.formSaveBtn(null), // 保存 |
|
|
|
defaultButtons.formCloseBtn(null), // 关闭 |
|
|
|
] |
|
|
|
// 按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
// 保存 |
|
|
|
if (val == 'save') { |
|
|
|
console.log(417, item) |
|
|
|
} |
|
|
|
// 关闭 |
|
|
|
else if (val == 'close') { |
|
|
|
dialogVisible.value = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
<style scoped> |
|
|
|
|
|
|
|