methods: {
},
watch: {
'$route'(to, from) {
if (from.name === 'addPurchase') {
let saveData = {
tableData: this.tableData,
formInline: this.formInline,
btnType: this.btnType,
radioItem: this.radioItem,
radioItem1: this.radioItem1,
brandId: this.brandId,
vendorId: this.vendorId
}
sessionStorage.setItem(`addPurchase${from.query.id ? from.query.id :from.query.ida ? from.query.ida :from.query.idb ? from.query.idb :from.query.ids ? from.query.ids : ''}`, JSON.stringify(saveData))
}
if (to.name === 'addPurchase') {
this.$refs.formInline.resetFields()
this.formInline = {}
this.total= ''
this.total1= ''
this.tableData = []
this.brandId = ''
this.vendorId = ''
this.btnType = [false, true, true, true, true, true, true, true, true, true, true, true]
if (sessionStorage.getItem(`addPurchase${to.query.id ? to.query.id :to.query.ida ? to.query.ida :to.query.idb ? to.query.idb :to.query.ids ? to.query.ids : ''}`)) {
let saveData = JSON.parse(sessionStorage.getItem(`addPurchase${to.query.id ? to.query.id :to.query.ida ? to.query.ida :to.query.idb ? to.query.idb :to.query.ids ? to.query.ids : ''}`))
this.formInline = saveData.formInline
this.tableData = saveData.tableData
this.btnType = saveData.btnType
this.radioItem = saveData.radioItem
this.radioItem1 = saveData.radioItem1
this.brandId = saveData.brandId
this.vendorId = saveData.vendorId
setTimeout(() => {
this.$('.vendor-inp .ivu-select-input').val(this.$.trim(this.$('.vendor-inp .ivu-select-input').val()))
}, 10)
} else {
to.query.id ? this.queryFun() : ''
to.query.ids ? this.getDetailInfo() : ''
to.query.ida ? this.getDetail() : ''
to.query.idb ? this.getNewPlan() : ''
}
}
}
}