feat: 暂存

This commit is contained in:
zhangyu
2021-12-02 15:36:01 +08:00
parent 8cca94f74f
commit 0ce1797524
4 changed files with 504 additions and 35 deletions

View File

@@ -174,38 +174,28 @@ export default {
const arr = [this.$refs.chartForm.validate()]
arr.push(this.$refs['childrenFrom' + this.editChart.datasource].$refs.chartForm.validate())
Promise.all(arr).then(res => {
console.log(res)
if (this.editChart.id) { // 修改
this.$put('visual/panel/chart', this.editChart).then(response => {
if (response.code === 200) {
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true)
} else {
this.$message.error(response.msg)
}
})
} else { // 新增
this.$post('visual/panel/chart', this.editChart).then(response => {
if (response.code === 200) {
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true)
} else {
this.$message.error(response.msg)
}
})
}
}).catch(res => {
console.log(res)
})
// this.$refs.chartForm.validate((valid) => {
// if (valid) {
// if (this.editChart.id) { // 修改
// this.editChart.param.collapse = this.chartSwitch
// this.$put('visual/panel/chart', this.editChart).then(response => {
// if (response.code === 200) {
// this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
// this.esc(true)
// } else {
// this.$message.error(response.msg)
// }
// })
// } else { // 新增
// this.$post('visual/panel/chart', this.editChart).then(response => {
// if (response.code === 200) {
// this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
// this.esc(true)
// } else {
// this.$message.error(response.msg)
// }
// })
// }
// } else {
// console.error('error submit!!')
// return false
// }
// })
},
selectPanel (panel) {
this.panelName = panel.name
@@ -271,7 +261,6 @@ export default {
}
}
}
console.log(this.editChart.datasource)
if (this.editChart.datasource == 4) {
this.editChart = {
...this.editChart,