|
@@ -190,38 +190,42 @@ export default {
|
|
|
this.$message.error('请选择文件')
|
|
|
return false
|
|
|
}
|
|
|
- let formData = new FormData()
|
|
|
+ this.$refs.ruleForm.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let formData = new FormData()
|
|
|
|
|
|
- // formData.append('reportId', this.reportId)
|
|
|
- // formData.append('name', this.ruleForm.name)
|
|
|
- if (this.file) {
|
|
|
- formData.append('files', this.file)
|
|
|
- }
|
|
|
- this.ruleForm.reportID = this.reportId
|
|
|
- formData.append('jsons', JSON.stringify(this.ruleForm))
|
|
|
- // formData.append('type', this.ruleForm.type)
|
|
|
- this.btnLoading = true
|
|
|
- if (this.ruleForm.id) {
|
|
|
- // formData.append('id', this.ruleForm.id)
|
|
|
- // formData.append('url', this.ruleForm.url)
|
|
|
- this.$api.EditReportFileList(formData).then(response => {
|
|
|
- this.$message.success('编辑成功')
|
|
|
- this.btnLoading = false
|
|
|
- this.getList()
|
|
|
- this.cancel()
|
|
|
- }).catch(error => {
|
|
|
- this.btnLoading = false
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$api.AddReportFileList(formData).then(response => {
|
|
|
- this.$message.success('新增成功')
|
|
|
- this.btnLoading = false
|
|
|
- this.getList()
|
|
|
- this.cancel()
|
|
|
- }).catch(error => {
|
|
|
- this.btnLoading = false
|
|
|
- })
|
|
|
- }
|
|
|
+ // formData.append('reportId', this.reportId)
|
|
|
+ // formData.append('name', this.ruleForm.name)
|
|
|
+ if (this.file) {
|
|
|
+ formData.append('files', this.file)
|
|
|
+ }
|
|
|
+ this.ruleForm.reportID = this.reportId
|
|
|
+ formData.append('jsons', JSON.stringify(this.ruleForm))
|
|
|
+ // formData.append('type', this.ruleForm.type)
|
|
|
+ this.btnLoading = true
|
|
|
+ if (this.ruleForm.id) {
|
|
|
+ // formData.append('id', this.ruleForm.id)
|
|
|
+ // formData.append('url', this.ruleForm.url)
|
|
|
+ this.$api.EditReportFileList(formData).then(response => {
|
|
|
+ this.$message.success('编辑成功')
|
|
|
+ this.btnLoading = false
|
|
|
+ this.getList()
|
|
|
+ this.cancel()
|
|
|
+ }).catch(error => {
|
|
|
+ this.btnLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$api.AddReportFileList(formData).then(response => {
|
|
|
+ this.$message.success('新增成功')
|
|
|
+ this.btnLoading = false
|
|
|
+ this.getList()
|
|
|
+ this.cancel()
|
|
|
+ }).catch(error => {
|
|
|
+ this.btnLoading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
handleDelete(row) {
|
|
|
this.$confirm('确认删除本条数据吗?', '提示', {
|