|
@@ -138,6 +138,11 @@
|
|
|
mounted() {
|
|
|
let listener = document.querySelector('.saga-brand-box')
|
|
|
listener.addEventListener('scroll', this.onScroll)
|
|
|
+ window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
|
|
|
+
|
|
|
+ },
|
|
|
+ destroyed() {
|
|
|
+ window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
|
|
|
},
|
|
|
data() {
|
|
|
let checkBrand = (rule, value, callback) => {
|
|
@@ -181,6 +186,19 @@
|
|
|
...mapGetters('layout', ['dictionary']),
|
|
|
},
|
|
|
methods: {
|
|
|
+ beforeunloadHandler(e) {
|
|
|
+ let {BrandID, ProdCode, Model, ProdFile, ProdParam} = this.ruleForm
|
|
|
+ // if (BrandID || ProdCode || ruleForm || Object.keys(ProdFile).length > 0 || Object.keys(ProdParam).length > 0) {
|
|
|
+ if (BrandID || ProdCode || Model) {
|
|
|
+ e.preventDefault();
|
|
|
+ // 兼容IE8和Firefox之前的版本
|
|
|
+ if (e) {
|
|
|
+ e.returnValue = '关闭aaa'
|
|
|
+ }
|
|
|
+ return '关闭111'
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
getProdType() {// 获取产品类型
|
|
|
let params = {
|
|
|
Type: this.dictionary.dictionaryType,
|
|
@@ -196,13 +214,18 @@
|
|
|
}
|
|
|
})
|
|
|
this.productList = res.Content
|
|
|
- if (this.$route.params.ProdID) {//如果是修改,加载信息点
|
|
|
+ if (this.$route.params.ProdCode) {//如果是修改,加载信息点
|
|
|
this.handleChangeProduct(this.$route.params.ProdCode)
|
|
|
}
|
|
|
+ if (this.$route.params.BrandID) {
|
|
|
+ this.ruleForm.BrandID = this.$route.params.Brand.BrandID
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
getBrandNum5() {// 获取最新创建过产品型号的5个品牌(如果是修改的话只显示修改产品的品牌)
|
|
|
- if (this.$route.params.ProdID) {
|
|
|
+ // if (this.$route.params.Brand) {
|
|
|
+ if (this.$route.params.Brand && Object.keys(this.$route.params.Brand).length > 0) {
|
|
|
+
|
|
|
this.defaultBrandList = [this.$route.params.Brand]
|
|
|
this.brandList = [this.$route.params.Brand]
|
|
|
} else {
|
|
@@ -239,9 +262,11 @@
|
|
|
}
|
|
|
})
|
|
|
this.AttachmentInfo = res.Content.AttachmentInfo
|
|
|
- if (this.$route.params.ProdID) {//判断是否是修改,回显修改内容
|
|
|
- let {Brand, ProdID, prodCname, ...ruleForm} = this.$route.params
|
|
|
- this.ruleForm = Object.assign(this.ruleForm, ruleForm)
|
|
|
+ if (this.$route.params.ProdCode) {//判断是否是修改,回显修改内容
|
|
|
+ if (!this.ruleForm.ProdCode) {
|
|
|
+ let {Brand, ProdID, prodCname, ...ruleForm} = this.$route.params
|
|
|
+ this.ruleForm = Object.assign(this.ruleForm, ruleForm)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|