|
@@ -529,31 +529,34 @@ export default {
|
|
// 提交
|
|
// 提交
|
|
getSubmit() {
|
|
getSubmit() {
|
|
let isValid = true
|
|
let isValid = true
|
|
-
|
|
|
|
- this.$refs.list.map(i => i.validate((valid) => {
|
|
|
|
- if (!valid) {
|
|
|
|
- isValid = false
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- }))
|
|
|
|
|
|
+ if (this.$refs.list) {
|
|
|
|
+ this.$refs.list.map(i => i.validate((valid) => {
|
|
|
|
+ if (!valid) {
|
|
|
|
+ isValid = false
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ }))
|
|
|
|
|
|
- if (isValid) {
|
|
|
|
- // 区分2级新增 还是 3级编辑
|
|
|
|
- this.$route.query.secondId ? this.form.secondId = this.$route.query.secondId : this.form.threeId = this.$route.query.threeId
|
|
|
|
- // 删除仅作展示的缓存数据
|
|
|
|
- for (const index in this.form.list) {
|
|
|
|
- delete this.form.list[index].contentId
|
|
|
|
- if ('description' in this.form.list[index]) {
|
|
|
|
- this.form.list[index].module.description = this.form.list[index].description
|
|
|
|
- delete this.form.list[index].description
|
|
|
|
|
|
+ if (isValid) {
|
|
|
|
+ // 区分2级新增 还是 3级编辑
|
|
|
|
+ this.$route.query.secondId ? this.form.secondId = this.$route.query.secondId : this.form.threeId = this.$route.query.threeId
|
|
|
|
+ // 删除仅作展示的缓存数据
|
|
|
|
+ for (const index in this.form.list) {
|
|
|
|
+ delete this.form.list[index].contentId
|
|
|
|
+ if ('description' in this.form.list[index]) {
|
|
|
|
+ this.form.list[index].module.description = this.form.list[index].description
|
|
|
|
+ delete this.form.list[index].description
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ submitThree(this.form).then(res => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.$message.success('提交成功!')
|
|
|
|
+ this.cancel()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- submitThree(this.form).then(res => {
|
|
|
|
- if (res.code === 0) {
|
|
|
|
- this.$message.success('提交成功!')
|
|
|
|
- this.cancel()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ }else{
|
|
|
|
+ this.$message.error('请添加新增内容')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|