| | |
| | | |
| | | const data = reactive({ |
| | | modelForm: { |
| | | productId: null, |
| | | productName: "", |
| | | model: "", |
| | | unit: "", |
| | |
| | | }, |
| | | }); |
| | | const { modelForm, modelRules } = toRefs(data); |
| | | |
| | | const createDefaultModelForm = () => ({ |
| | | productId: null, |
| | | productName: "", |
| | | model: "", |
| | | unit: "", |
| | | productType: null, |
| | | routeId: null, |
| | | drawingFile: "", |
| | | tempFileIds: [], |
| | | salesLedgerFiles: [], |
| | | }); |
| | | |
| | | const downloadImportErrorFile = (blob, filename = "import-error.xlsx") => { |
| | | const downloadElement = document.createElement("a"); |
| | |
| | | const openModelDia = (type, data) => { |
| | | modelOperationType.value = type; |
| | | modelDia.value = true; |
| | | modelForm.value.productName = ""; |
| | | modelForm.value.model = ""; |
| | | modelForm.value.id = ""; |
| | | modelForm.value.unit = ""; |
| | | modelForm.value.productType = null; |
| | | modelForm.value.routeId = null; |
| | | modelForm.value.drawingFile = ""; |
| | | modelForm.value.tempFileIds = []; |
| | | modelForm.value.salesLedgerFiles = []; |
| | | Object.assign(modelForm.value, createDefaultModelForm()); |
| | | drawingFileList.value = []; |
| | | if (type === "edit") { |
| | | modelForm.value = { ...data }; |
| | | Object.assign(modelForm.value, data); |
| | | modelForm.value.tempFileIds = data.tempFileIds || []; |
| | | modelForm.value.salesLedgerFiles = data.salesLedgerFiles || []; |
| | | // 处理图纸文件反显 |
| | |
| | | }; |
| | | |
| | | const closeModelDia = () => { |
| | | modelFormRef.value.resetFields(); |
| | | modelFormRef.value?.resetFields(); |
| | | Object.assign(modelForm.value, createDefaultModelForm()); |
| | | drawingFileList.value = []; |
| | | modelDia.value = false; |
| | | }; |
| | | |