|
@@ -109,7 +109,7 @@
|
|
|
<el-button type="primary" size="small" @click="handleImportData">
|
|
<el-button type="primary" size="small" @click="handleImportData">
|
|
|
导入数据
|
|
导入数据
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-button type="primary" size="small" @click="handleSaveTemplate">
|
|
|
|
|
|
|
+ <el-button type="primary" size="small" @click="handleSaveData">
|
|
|
保存核定数据
|
|
保存核定数据
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</div>
|
|
</div>
|
|
@@ -178,7 +178,8 @@
|
|
|
} from '@/api/costVerifyManage'
|
|
} from '@/api/costVerifyManage'
|
|
|
import { getDetail } from '@/api/auditInitiation'
|
|
import { getDetail } from '@/api/auditInitiation'
|
|
|
import { catalogMixin } from '@/mixins/useDict'
|
|
import { catalogMixin } from '@/mixins/useDict'
|
|
|
- import { saveAs } from 'file-saver'
|
|
|
|
|
|
|
+ import { saveSingleRecordSurvey } from '@/api/audit/survey'
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
name: 'CostAudit',
|
|
name: 'CostAudit',
|
|
|
mixins: [catalogMixin],
|
|
mixins: [catalogMixin],
|
|
@@ -201,6 +202,7 @@
|
|
|
type: String,
|
|
type: String,
|
|
|
default: '',
|
|
default: '',
|
|
|
},
|
|
},
|
|
|
|
|
+ auditedUnitId: { type: String, default: '' },
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -705,7 +707,52 @@
|
|
|
this.$loading().close()
|
|
this.$loading().close()
|
|
|
console.log(err)
|
|
console.log(err)
|
|
|
})
|
|
})
|
|
|
- // this.$message({ type: 'success', message: '保存成功' })
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ async handleSaveData() {
|
|
|
|
|
+ const loading = this.$loading({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: '保存数据中...',
|
|
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)',
|
|
|
|
|
+ })
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 1) 基于当前表格数据生成保存明细
|
|
|
|
|
+ const rawItems =
|
|
|
|
|
+ this.splitFixedTableDataForSave(this.costAuditData) || []
|
|
|
|
|
+ const auditedUnitId =
|
|
|
|
|
+ this.auditedUnitId || this.auditForm.auditedUnitId || ''
|
|
|
|
|
+ const surveyTemplateId =
|
|
|
|
|
+ this.auditForm.surveyTemplateId || this.auditForm.dataTable || ''
|
|
|
|
|
+ const catalogId = this.auditForm.catalogId || ''
|
|
|
|
|
+ const hasData = !!(this.auditForm && this.auditForm.uploadId)
|
|
|
|
|
+
|
|
|
|
|
+ const finalSaveData = rawItems.map((it) => {
|
|
|
|
|
+ const base = {
|
|
|
|
|
+ rowid: it.rowid,
|
|
|
|
|
+ rkey: it.rkey,
|
|
|
|
|
+ rvalue: it.rvalue != null ? String(it.rvalue) : '',
|
|
|
|
|
+ auditedUnitId,
|
|
|
|
|
+ surveyTemplateId,
|
|
|
|
|
+ catalogId,
|
|
|
|
|
+ }
|
|
|
|
|
+ if (hasData) base.uploadId = this.auditForm.uploadId
|
|
|
|
|
+ return base
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // 2) 调用保存接口
|
|
|
|
|
+ const res = await saveSingleRecordSurvey(finalSaveData)
|
|
|
|
|
+ if (res && res.code === 200) {
|
|
|
|
|
+ this.$message.success('保存成功')
|
|
|
|
|
+ this.loadTemplateData && this.loadTemplateData()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.error((res && res.message) || '保存失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ console.error(err)
|
|
|
|
|
+ // this.$message.error('保存失败')
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ loading.close()
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
//分割字符串
|
|
//分割字符串
|
|
|
stringToObjects(str) {
|
|
stringToObjects(str) {
|
|
@@ -982,9 +1029,9 @@
|
|
|
this.$message({ type: 'info', message: '导出数据' })
|
|
this.$message({ type: 'info', message: '导出数据' })
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- handleSaveData() {
|
|
|
|
|
- this.$message({ type: 'success', message: '成本审核数据已保存' })
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // handleSaveData() {
|
|
|
|
|
+ // this.$message({ type: 'success', message: '成本审核数据已保存' })
|
|
|
|
|
+ // },
|
|
|
|
|
|
|
|
handleRemark(row, field) {
|
|
handleRemark(row, field) {
|
|
|
this.$prompt('请输入说明', '提示', {
|
|
this.$prompt('请输入说明', '提示', {
|