Commit 5edd0b93 by lichengming

修改了报告编制

parent 9b664f66
<template>
<div>
<!--<Modal v-model="showModal" title="原始记录" :mask-closable="false" width="1300" class="modal-footer-none">-->
<!--<div style="text-align:center;align-content:center;width: 100%;height: 790px" v-html="htmlContent">-->
<!--</div>-->
<!--</Modal>-->
</div>
</template>
<script>
import Global from '../../../api/config'
import { soilTest } from '../../../api'
/**
* 编辑原始记录详情
*/
export default {
data() {
return {
// showModal: false,
again: false,
formId: '',
htmlContent: '',
formIdTemp: ''
}
},
created() {
// 监听原始记录消息
// eslint-disable-next-line nuxt/no-globals-in-created
window.addEventListener('message', this._saveOriginal)
},
// 销毁监听事件
beforeDestroy() {
this.again = false
window.removeEventListener('message', this._saveOriginal)
},
methods: {
_open(formId) {
this.formId = formId
this.formIdTemp = formId + this.$randomCode()
this.again = true
// this.showModal = true;
// 编辑的时候传此bindUri 是为了 绑定spreadJs自定义的公式
const bindUri =
Global.baseURL + '/env/v1/env_item/original_record_data_bind?source='
const url =
Global.recordURL +
'/print/v1/eln/form_YT_' +
formId +
'?bindUri=' +
encodeURIComponent(bindUri)
// this.htmlContent = '<iframe style="padding: 0px;width:100%;height:100%" frameborder="0" src=' + encodeURI(url) + '></iframe>';
this.$layx(this.formIdTemp, '编辑原始记录', url)
},
_openWithType(formId, fromType) {
this.formId = formId
this.formIdTemp = formId + this.$randomCode()
this.again = true
// this.showModal = true;
// 编辑的时候传此bindUri 是为了 绑定spreadJs自定义的公式
const bindUri =
Global.baseURL + '/env/v1/env_item/original_record_data_bind?source='
const url =
Global.recordURL +
'/print/v1/eln/form_YT_' +
formId +
'?bindUri=' +
encodeURIComponent(bindUri) +
'&type=' +
fromType
// this.htmlContent = '<iframe style="padding: 0px;width:100%;height:100%" frameborder="0" src=' + encodeURI(url) + '></iframe>';
this.$layx(this.formIdTemp, '编辑原始记录', url)
},
_saveOriginal(data) {
console.log('修改的数据', data)
if (this.again) {
if (data.data.msg === true) {
this._editSaveRecord(data)
} else {
this._cancel()
}
this.again = false
}
},
_cancel() {
// this.showModal = false;
// 关闭所有layx弹框
// eslint-disable-next-line no-undef
layx.destroyAll(this.formIdTemp)
},
_updateRecord: async function(param) {
const result = await soilTest.updateItem(param)
console.log(result)
if (result) {
this.$Message.success('保存成功')
this._cancel()
this.$emit('on-result-change')
}
},
// 保存后解析项目的检测值
_editSaveRecord(data) {
const param = {
formId: this.formId
}
console.log('data', data)
const copyMapTemp = {}
if (data.data.copySheet && data.data.copyedSheet) {
param.copyMap = {}
const copyedKey = String(data.data.copyedSheet)
copyMapTemp[copyedKey] = ''
copyMapTemp[copyedKey] = String(data.data.copySheet)
// 存在复制sheet的情况
param.copyMap = JSON.stringify(copyMapTemp)
} else if (typeof data.data.testValueArry !== 'undefined') {
const testValue = data.data.testValueArry
param.copyMap = {}
testValue.forEach(item => {
const copyedKey = String(item.copyedSheet)
copyMapTemp[copyedKey] = ''
copyMapTemp[copyedKey] = String(item.copySheet)
param.copyMap = JSON.stringify(copyMapTemp)
})
}
this._updateRecord(param)
// this.$store.dispatch('EnvItem/updateFormForItem', param).then(() => {
// if (this.$store.state.EnvItem.success) {
// this.$Message.success('保存成功')
// // this.showModal = false;
// this.$emit('on-result-change')
// this._cancel()
// }
// })
}
}
}
</script>
...@@ -81,14 +81,16 @@ ...@@ -81,14 +81,16 @@
<SampleByMakeModal ref="sampleByMakeModal"></SampleByMakeModal> <SampleByMakeModal ref="sampleByMakeModal"></SampleByMakeModal>
<Operation ref="operation"></Operation> <Operation ref="operation"></Operation>
<FileManage ref="FileManage"></FileManage> <FileManage ref="FileManage"></FileManage>
<OriginalRecordView ref="originalRecordView"></OriginalRecordView>
</div> </div>
</template> </template>
<script> <script>
import { soilStatistics } from '../../../../api' import { soilStatistics } from '../../../../api'
import SampleByMakeModal from '../SampleByMakeModal' import SampleByMakeModal from '../SampleByMakeModal'
import Operation from '../../../../components/operation/Operation' import Operation from '../../../../components/operation/Operation'
import OriginalRecordView from '../OriginalRecordView'
export default { export default {
components: { SampleByMakeModal, Operation }, components: { SampleByMakeModal, Operation, OriginalRecordView },
data() { data() {
return { return {
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }], typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
...@@ -217,6 +219,9 @@ export default { ...@@ -217,6 +219,9 @@ export default {
this.personal this.personal
) )
break break
case '查看原始记录':
this.$refs.originalRecordView._open(data.id)
break
case '检测项目': case '检测项目':
this.$refs.refModal._open(data) this.$refs.refModal._open(data)
break break
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment