|
@@ -149,7 +149,7 @@
|
|
|
ref="materialImportDialog"
|
|
|
:visible.sync="importDialogVisible"
|
|
|
@confirm="handleImportConfirm"
|
|
|
- @cancel="handleImportCancel"
|
|
|
+ @cancel="handleImportCancel"
|
|
|
/>
|
|
|
|
|
|
|
|
@@ -169,6 +169,7 @@ import {
|
|
|
getMaterialDetailStatusTagType,
|
|
|
getMaterialDetailStatusColor
|
|
|
} from './constants'
|
|
|
+import { MATERIAL_DETAIL_EVENTS, DIALOG_EVENTS } from './events'
|
|
|
import MaterialImportDialog from './material-import-dialog.vue'
|
|
|
import {
|
|
|
formatAmount,
|
|
@@ -294,6 +295,11 @@ export default {
|
|
|
importDialogVisible: false,
|
|
|
|
|
|
/**
|
|
|
+ * 事件常量
|
|
|
+ */
|
|
|
+ DIALOG_EVENTS,
|
|
|
+
|
|
|
+ /**
|
|
|
* 正在编辑的行数据 - 用于记录编辑前的状态
|
|
|
* @type {MaterialDetailRecord|null}
|
|
|
*/
|
|
@@ -491,7 +497,7 @@ export default {
|
|
|
* @emits refresh
|
|
|
*/
|
|
|
handleRefresh() {
|
|
|
- this.$emit('refresh')
|
|
|
+ this.$emit(MATERIAL_DETAIL_EVENTS.REFRESH)
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -506,7 +512,7 @@ export default {
|
|
|
this.$message.warning('导入的物料数据格式不正确')
|
|
|
return
|
|
|
}
|
|
|
- this.$emit('material-import', importedMaterials)
|
|
|
+ this.$emit(MATERIAL_DETAIL_EVENTS.MATERIAL_IMPORT, importedMaterials)
|
|
|
this.importDialogVisible = false
|
|
|
},
|
|
|
|
|
@@ -621,7 +627,7 @@ export default {
|
|
|
)
|
|
|
|
|
|
// 触发删除事件,传递物料记录和索引
|
|
|
- this.$emit('material-delete', { row, index })
|
|
|
+ this.$emit(MATERIAL_DETAIL_EVENTS.MATERIAL_DELETE, { row, index })
|
|
|
this.$message.success('物料删除成功')
|
|
|
} catch (error) {
|
|
|
// 用户取消删除操作
|
|
@@ -657,7 +663,7 @@ export default {
|
|
|
const calculatedRow = this.calculateAmounts(row)
|
|
|
|
|
|
// 触发更新事件,传递计算后的数据
|
|
|
- this.$emit('material-update', { row: calculatedRow, index })
|
|
|
+ this.$emit(MATERIAL_DETAIL_EVENTS.MATERIAL_UPDATE, { row: calculatedRow, index })
|
|
|
|
|
|
// 完成编辑
|
|
|
done(calculatedRow)
|
|
@@ -692,7 +698,7 @@ export default {
|
|
|
handleQuantityChange(row, index) {
|
|
|
const calculatedRow = this.calculateAmounts(row)
|
|
|
Object.assign(row, calculatedRow)
|
|
|
- this.$emit('material-update', { row, index })
|
|
|
+ this.$emit(MATERIAL_DETAIL_EVENTS.MATERIAL_UPDATE, { row, index })
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -795,7 +801,7 @@ export default {
|
|
|
Object.assign(row, calculatedRow)
|
|
|
|
|
|
// 触发更新事件
|
|
|
- this.$emit('material-update', { row: calculatedRow, index: this.getCurrentRowIndex(row) })
|
|
|
+ this.$emit(MATERIAL_DETAIL_EVENTS.MATERIAL_UPDATE, { row: calculatedRow, index: this.getCurrentRowIndex(row) })
|
|
|
}
|
|
|
},
|
|
|
|