Commit 1850d162 by cwq0219

验证+scroll

1 parent 15f1e2c4
......@@ -21,6 +21,7 @@
<el-form-item
:prop="item.name"
:label="item.label"
:id="item.name"
label-width="130px"
class="dis-in-block"
:style="{'margin-bottom': !item.type ? '0px' : '22px'}"
......@@ -412,7 +413,13 @@ export default {
},
handleAddPro(targetItem) {
if (!this.formData[targetItem.relateAttr]) {
this.notice.warningTips('请选择基础商品')
// this.notice.warningTips('请选择基础商品')
this.$message({
message: '请选择基础商品',
type: 'warning',
showClose: true
})
this.jumpScroll(targetItem.relateAttr)
return true
}
this.markTarget = targetItem
......@@ -468,7 +475,8 @@ export default {
if (!selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning'
type: 'warning',
showClose: true
})
return true
}
......@@ -491,8 +499,8 @@ export default {
var formDataName = formItem.name
var filterArr = this.formData[formDataName].filter(i => i[formItem.optionValue] !== item[formItem.optionValue])
this.formData[formDataName] = filterArr
console.log(this.formData)
console.log(formDataName)
// console.log(this.formData)
// console.log(formDataName)
this.judgeIsDisable()
},
// 图片
......@@ -511,7 +519,7 @@ export default {
const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
// console.log(base64)
uploadImg({ file: base64 }).then(res => {
console.log(res)
// console.log(res)
this.$refs[this.formRef + 'd2FormRuleForm'].clearValidate(targetItem.name)
if (targetItem.maxPhotoNum === 1) {
this.formData[targetItem.name] = [{
......@@ -524,7 +532,7 @@ export default {
} else {
this.formData[targetItem.name][subIndex].content = res
}
console.log(this.formData[targetItem.name])
// console.log(this.formData[targetItem.name])
})
}
},
......@@ -545,6 +553,9 @@ export default {
handleClose() {
this.$emit('handleClose')
},
jumpScroll(idName) {
document.getElementById(idName).scrollIntoView()
},
handleUp() {
// console.log(this.formData)
// const flag = true
......@@ -575,6 +586,25 @@ export default {
}
}
this.$emit('handleAddConfirm', this.formData)
} else {
var needRuleList = Object.keys(this.rules)
// console.log(needRuleList)
for (var i in needRuleList) {
// needRuleList.forEach(item => {
const item = needRuleList[i]
if (Array.isArray(this.formData[item])) {
if (!this.formData[item].length) {
this.jumpScroll(item)
return true
}
} else {
if (!this.formData[item]) {
this.jumpScroll(item)
return true
}
}
}
// })
}
})
// }
......
......@@ -128,7 +128,7 @@ export default {
// console.log(this.editData)
// add - 新增;edit - 编辑
this.addOrEdit = this.$route.params.addOrEdit
this.getGoodsListNoBase()
this.getGoodsList()
if (this.addOrEdit === 'edit') {
getGoodsInfoById({ id: this.$route.params.row.id }).then(res => {
// console.log(res)
......@@ -166,9 +166,9 @@ export default {
methods: {
...mapActions({ close: 'd2admin/page/close' }),
// ...mapActions('d2admin/page', ['close']),
getGoodsListNoBase() {
var params = this.addOrEdit === 'edit' ? {} : { exceptBase: true }
getGoodsList(params).then(res => {
getGoodsList() {
// var params = this.addOrEdit === 'edit' ? {} : { exceptBase: true }
getGoodsList({}).then(res => {
// console.log(res)
this.editForm[0].formBlock[0].optionList = res
})
......
......@@ -192,7 +192,8 @@ export default {
// this.notice.warningTips('请选择关联门店')
this.$message({
message: '请选择关联门店',
type: 'warning'
type: 'warning',
showClose: true
})
return true
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!