Commit 4c9397a6 by lichengming

修改了报告编制查看试验项目报告

parent 77931095
<template>
<div>
<Modal v-model="showModal" v-drag width="1200">
<p slot="header">
查看试验项目报告
</p>
<Row>
<!--查询-->
<Col span="24">
<Form :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="项目名称:">
<Input v-model="formObj.expName" @on-enter="_formSearch" placeholder="请输入项目名称" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :open="searchOpen" :msg="btn" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :icon-msg="iconMsg" :getPage="getPage">
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.dateTime">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
<ItemOriginalRecordEdit ref="recordEditModal"></ItemOriginalRecordEdit>
<ItemView ref="itemViewModal" @on-result-change="_page"></ItemView>
</div>
</template>
<script>
/**
* 原始记录查看
*/
import Global from '../../../api/config'
import { soilReport, soilSample, soilTest } from '../../../api'
import ItemOriginalRecordEdit from './OriginalRecordEdit'
import ItemView from './ItemView'
export default {
components: {
ItemOriginalRecordEdit,
ItemView
},
data() {
return {
currentComponent: '',
getPage: {},
btn: [
{
type: 'primary',
id: '',
name: '生成报告'
}
],
selectIds: [],
showModal: false,
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '关闭', type: 'primary' }
],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{
type: 'ios-book',
id: '',
name: '查看项目报告'
},
{ type: 'md-trash', id: '', name: '删除' }
],
pageColumns: [
{ title: '项目名称', key: 'expName' },
{ title: '备注', key: 'remark' },
{ title: '创建人', key: 'uname' },
{ title: '创建时间', key: 'ctime', dateTime: true }
],
formObj: {
entrustId: '',
expName: undefined
},
searchOpen: false
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 340)
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
methods: {
_componentResult(data) {
switch (this.currentComponent) {
case 'EditDateModal':
this._updateDate(data)
break
default:
this._page()
}
},
_updateDate(date) {
this.$store
.dispatch('PrintForm/updateTimeBatch', {
ids: this.selectIds.join(','),
fillInTime: date
})
.then(() => {
if (this.$store.state.PrintForm.success) {
this._page()
this.$Message.success('更新成功!')
}
})
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '生成报告':
this._reportMake()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_reportMake(data) {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定这' + this.selectIds.length + '条数据生成报告',
onOk: () => {
this.openTooltip()
this.$refs.pageTable._showLoading()
this._reportMakeOk()
}
})
}
},
_reportMakeOk: async function() {
const result = await soilSample.reportMake({
entrustId: this.formObj.entrustId,
originalList: this.selectIds
})
if (result) {
this.$Message.success('报告成功生成')
this._page()
this.$emit('on-result-change')
}
this.$refs.pageTable._hideLoading()
},
openTooltip() {
this.$notify.info({
title: '提示',
message: '正在生成,请稍后',
duration: 3000
})
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '关闭':
this._cancel()
break
}
},
_cancel() {
this.$emit('on-result-change')
this.$refs.pageTable._hideLoading()
this.$refs.footerModal._hideLoading()
this.showModal = false
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
// this.$refs.recordEditModal._openWithType(
// data.originalRecordId,
// 'ENVTESTMAKEEDIT'
// )
this._reportMakeLook(data)
break
case '查看项目报告':
this._reportView(data)
// this._recordView(data.originalRecordId)
break
case '查看试验项目':
this._itemView(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
}
})
},
// 查看试验项目
_itemView(id) {
this.$refs.itemViewModal._open(id)
},
_reportView(data) {
if (data.objectKey) {
this._reportMakeLook(data)
} else {
this._recordView(data.originalRecordId)
}
},
_reportMakeLook: async function(data) {
console.log(data)
const result = await soilReport.expReportGetById(data.id)
// this._viewReport(data)
// const result = await soilReport.getExcelOriginalRecord(data.id)
if (result) {
console.log('result')
this._viewReport(result)
}
},
_viewReport(data) {
if (data) {
this.$openWindowModeless({
objectKey: data.objectKey,
idType: 11,
id: data.id,
isReport: 4
})
}
},
// 查看原始记录
_recordView(originalRecordId) {
let recordUrl = ''
if (process.env.NODE_ENV === 'production') {
recordUrl = 'http://record.patzn.com'
} else {
recordUrl = Global.recordURL
}
// eslint-disable-next-line no-undef
layx.iframe(
'labRecordWriteOriView',
'原始记录预览',
recordUrl + '/print/v1/form/' + originalRecordId + '?type=ENVTESTMAKE',
{
event: {
onload: {
after: function(layxWindow, winform) {
// eslint-disable-next-line no-undef
layx.max(winform.id)
}
}
}
}
)
},
_open(entrustId) {
this.formObj.entrustId = entrustId
this._page()
this.showModal = true
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.EnvItem.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilTest.expReportPage(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
// 删除原始记录
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._deleteOk(ids)
}
})
},
_deleteOk: async function(ids) {
const result = await soilTest.deleteReport(ids)
if (result) {
this.$Message.success('删除成功')
this._page()
}
}
}
}
</script>
...@@ -88,6 +88,7 @@ import SampleByMakeModal from '../SampleByMakeModal' ...@@ -88,6 +88,7 @@ import SampleByMakeModal from '../SampleByMakeModal'
import Operation from '../../../../components/operation/Operation' import Operation from '../../../../components/operation/Operation'
import OriginalRecordView from '../OriginalRecordView' import OriginalRecordView from '../OriginalRecordView'
import UploadByReport from '../UploadByReport' import UploadByReport from '../UploadByReport'
import ItemReportView from '../ItemReportView'
export default { export default {
components: { components: {
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
...@@ -97,7 +98,9 @@ export default { ...@@ -97,7 +98,9 @@ export default {
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
OriginalRecordView, OriginalRecordView,
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
UploadByReport UploadByReport,
// eslint-disable-next-line vue/no-unused-components
ItemReportView
}, },
data() { data() {
return { return {
...@@ -137,6 +140,11 @@ export default { ...@@ -137,6 +140,11 @@ export default {
currentComponent: OriginalRecordView currentComponent: OriginalRecordView
}, },
{ {
type: 'ios-list-box',
id: '',
name: '查看试验项目报告'
},
{
type: 'ios-cloud-upload', type: 'ios-cloud-upload',
id: '', id: '',
name: '上传报告' name: '上传报告'
...@@ -171,11 +179,6 @@ export default { ...@@ -171,11 +179,6 @@ export default {
type: 'primary', type: 'primary',
id: '', id: '',
name: '提交' name: '提交'
},
{
type: 'primary',
id: 'food-report-make-maintain-info',
name: '信息维护'
} }
], ],
selectIds: [], selectIds: [],
...@@ -286,6 +289,9 @@ export default { ...@@ -286,6 +289,9 @@ export default {
case '查看原始记录': case '查看原始记录':
this._viewRecord(data.id) this._viewRecord(data.id)
break break
case '查看试验项目报告':
this._viewItemRecord(data.id)
break
case '上传报告': case '上传报告':
this._uploadReport(data.id) this._uploadReport(data.id)
break break
...@@ -313,6 +319,12 @@ export default { ...@@ -313,6 +319,12 @@ export default {
this.$refs.refModal._open(id) this.$refs.refModal._open(id)
}) })
}, },
_viewItemRecord(id) {
this.currentComponent = 'ItemReportView'
this.$nextTick(() => {
this.$refs.refModal._open(id)
})
},
_sampleManage(id) { _sampleManage(id) {
this.currentComponent = 'SampleByMakeModal' this.currentComponent = 'SampleByMakeModal'
this.$nextTick(() => { this.$nextTick(() => {
......
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