|
@ -69,50 +69,50 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
init () { |
|
|
init () { |
|
|
this.visible = true |
|
|
this.visible = true |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
this.$refs['dataForm'].resetFields() |
|
|
this.$refs['dataForm'].resetFields() |
|
|
if (this.dataForm.id) { |
|
|
if (this.dataForm.id) { |
|
|
this.getInfo() |
|
|
this.getInfo() |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 获取信息 |
|
|
// 获取信息 |
|
|
getInfo () { |
|
|
getInfo () { |
|
|
this.$http.get(`/events/veterantopic/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
this.$http.get(`/events/veterantopic/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
if (res.code !== 0) { |
|
|
|
|
|
return this.$message.error(res.msg) |
|
|
|
|
|
} |
|
|
|
|
|
this.dataForm = { |
|
|
|
|
|
...this.dataForm, |
|
|
|
|
|
...res.data |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(() => {}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 表单提交 |
|
|
|
|
|
dataFormSubmitHandle: debounce(function () { |
|
|
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
|
|
if (!valid) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/events/veterantopic/', this.dataForm).then(({ data: res }) => { |
|
|
|
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
|
} |
|
|
} |
|
|
this.$message({ |
|
|
this.dataForm = { |
|
|
message: this.$t('prompt.success'), |
|
|
...this.dataForm, |
|
|
type: 'success', |
|
|
...res.data |
|
|
duration: 500, |
|
|
} |
|
|
onClose: () => { |
|
|
|
|
|
this.visible = false |
|
|
|
|
|
this.$emit('refreshDataList') |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(() => {}) |
|
|
}).catch(() => {}) |
|
|
}) |
|
|
}, |
|
|
}, 1000, { 'leading': true, 'trailing': false }) |
|
|
// 表单提交 |
|
|
} |
|
|
dataFormSubmitHandle: debounce(function () { |
|
|
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
|
|
if (!valid) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/events/veterantopic/', this.dataForm).then(({ data: res }) => { |
|
|
|
|
|
if (res.code !== 0) { |
|
|
|
|
|
return this.$message.error(res.msg) |
|
|
|
|
|
} |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
message: this.$t('prompt.success'), |
|
|
|
|
|
type: 'success', |
|
|
|
|
|
duration: 500, |
|
|
|
|
|
onClose: () => { |
|
|
|
|
|
this.visible = false |
|
|
|
|
|
this.$emit('refreshDataList') |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(() => {}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, 1000, { 'leading': true, 'trailing': false }) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|