/**
* @description 串号修改记录组件
*/
Vue.component('component-serial-modify-record', {
template: `
{{scope.$index + 1}}
主串号:{{scope.row.old_main_serial_number}}
辅助串号1:{{scope.row.old_auxiliary_serial_number_one || '---'}}
辅助串号2:{{scope.row.old_auxiliary_serial_number_two || '---'}}
主串号:{{scope.row.main_serial_number}}
辅助串号1:{{scope.row.auxiliary_serial_number_one || '---'}}
辅助串号2:{{scope.row.auxiliary_serial_number_two || '---'}}
`,
data() {
return {
page: 1, //页数
limit: 6, //每页行数
total: 0, //数据总数
tableData: [], //当前页数据
dialogVisible: false //窗口显示控制
}
},
methods: {
/**
* @description 弹出关闭
*/
dialogClose() {
this.page = 1
this.total = 0
this.tableData = []
},
/**
* @description 分页组件切换事件
* @param {Number} currentPage 当前分页数
*/
currentChange(currentPage) {
this.page = currentPage
this._getTableData()
},
/**
* @description 获取列表数据
* @private
*/
_getTableData() {
this.sendRequest('Retail/Customer/serialModifyRecord', {
data: {
id: this.id,
page: this.page,
limit: this.limit
},
success: (response) => {
if (response.status == 1) {
const data = response.data
this.tableData = data.list
this.total = data.count
} else {
this.$message.error(response.message)
}
}
})
}
},
watch: {
/**
* @description 监听父组件显示控制变量的变化
*/
visible() {
this.dialogVisible = this.visible
this._getTableData()
},
/**
* @description 监听当前组件的显示控制变量的变化
*/
dialogVisible() {
this.$emit('update:visible', this.dialogVisible)
}
},
props: [
'visible', //父组件的显示控制
'id' //修改记录ID
]
})