Commit 8f88857e by wangweidong

Merge remote-tracking branch 'origin/dev' into dev

parents f4247ad5 b02f24b2
<template>
<div>
<Modal v-model="showBatchModal" v-drag width="900">
<p slot="header">
生成报告
</p>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--样品信息-->
<!--报告模板-->
<Col span="24">
<SummarySheetTemplate ref="reportTemplate" @on-result-change="_templateResultChange"></SummarySheetTemplate>
</Col>
</Row>
</div>
</div>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerBtn" @on-result-change="_footerResult"></modal-footer>
</div>
</Modal>
<!--生成报告的进度条-->
</div>
</template>
<script>
import SummarySheetTemplate from './SummarySheetTemplate'
/**
* 样品列表--生成报告或者选择模板生成报告
*/
export default {
components: {
SummarySheetTemplate
},
data() {
return {
selectIds: [],
getPage: {
records: []
},
showBatchModal: false,
isLoading: false,
footerBtn: [
{ type: '', id: '', name: '取消' },
{ type: 'primary', id: '', name: '确定' }
],
pageColumns: [
{ title: '样品名称', key: 'name', width: 160 },
{ title: '样品编号', key: 'code', width: 150 },
{ title: '证书编号', key: 'certificate', width: 150 }
],
reportModelId: '',
backData: {},
// 样品数据
tableData: [],
// 签发日期
issueDateTemp: '',
issueDate: '',
showIssueModal: false
}
},
methods: {
_open() {
this.getPage.records = []
this.backData = {}
this.showBatchModal = true
this._reportTemplate()
this.reportModelId = ''
this.isLoading = false
},
// 报告模板
_reportTemplate() {
this.$refs.reportTemplate._open()
},
_footerResult(name) {
switch (name) {
case '确定':
this._ok()
break
case '取消':
this.showBatchModal = false
break
}
},
_templateResultChange(selectData) {
this.backData = selectData[0]
},
_issueChange(data) {
if (data) {
this.issueDate = data
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_ok() {
this.$refs.footerModal._hideLoading()
if (!this.backData.name) {
this.$Message.warning('请选择一个原始记录模板!')
// this._hideLoading()
} else {
this.$emit('on-result-change', this.backData)
this.showBatchModal = false
}
},
_issueCancel() {
this.showIssueModal = false
},
// 选择时间ok
_issueOk() {
this.isLoading = true
this.showIssueModal = false
this._createOk()
},
// 生成报告
_createOk() {
const obj = []
for (let i = 0; i < this.tableData.length; i++) {
obj.push({
sampleId: this.tableData[i].id,
reportSn: this.tableData[i].reportSn,
issueDate: this.issueDate
})
}
this.$layxLoading(true, '数据验证中')
const validateObj = {
sampleReports: obj,
reportModelId: this.reportModelId
}
// 先进行验证
this.$store
.dispatch('FoodSampleReport/createReportValidate', validateObj)
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
// 验证成功之后再建立连接,然后进行生成报告操作
// 建立websocket连接
const currentTime = new Date().getTime()
this.$refs.progressModal._open(this.tableData.length, currentTime)
validateObj.seriesNo = currentTime
console.log('生成报告的当前序列号,', validateObj.seriesNo)
this.$store
.dispatch('FoodSampleReport/createReport', validateObj)
.then(() => {})
}
this._hideLoading()
this.isLoading = false
this.$layxLoading(false)
})
},
_closeResult() {
this.showBatchModal = false
this.$emit('on-result-change')
}
}
}
</script>
......@@ -49,6 +49,7 @@
</Modal>
<ItemOriginalRecordEdit ref="recordEditModal"></ItemOriginalRecordEdit>
<ItemView ref="itemViewModal" @on-result-change="_page"></ItemView>
<CreateSummarySheet ref="createModal" @on-result-change="_certificateSelectExcelBack"></CreateSummarySheet>
</div>
</template>
<script>
......@@ -59,11 +60,13 @@ import Global from '../../../api/config'
import { soilReport, soilSample, soilTest } from '../../../api'
import ItemOriginalRecordEdit from './OriginalRecordEdit'
import ItemView from './ItemView'
import CreateSummarySheet from './CreateSummarySheet'
export default {
components: {
ItemOriginalRecordEdit,
ItemView
ItemView,
CreateSummarySheet
},
data() {
return {
......@@ -158,15 +161,20 @@ export default {
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()
}
})
this._itemReportMake(data)
}
},
_itemReportMake(data) {
// this.itemName = data.name
// this.selectId = data.id
this.$refs.createModal._open()
},
_certificateSelectExcelBack(data) {
if (data) {
console.log(this.selectIds)
console.log(data)
} else {
this.$refs.pageTable._hideLoading()
}
},
_reportMakeOk: async function() {
......
<template>
<div>
<Row>
<Col span="24">
<Form id="formId" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="模板名称:" class="search-item">
<Input v-model="formObj.alias" @on-enter="_formSearch" placeholder="请输入模板名称" clearable/>
</Form-item>
<Form-item class="search-btn" style="margin-left: -10px">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<PTVXETableHeight
ref="pageTable"
:table-height="300"
:get-page="getPage"
:is-radio="true"
@on-result-change="_tableResultChange"
select-data="true"
hide-checkbox>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<span v-if="item.dateTime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):''}}</span>
<span v-else-if="item.judged">{{scope.row[item.key]===1?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETableHeight>
</Col>
</Row>
</div>
</template>
<script>
import { soilAptitude } from '../../../api'
export default {
components: {},
data() {
return {
tableHeight: '400',
pageColumns: [
{ title: '模板名称', key: 'alias', width: 220 },
{ title: '类别', key: 'classType', width: 140 },
{ title: '备注', key: 'remark' }
],
getPage: {},
modalTitle: '报告模板',
sampleId: '',
formObj: {
name: undefined
},
selectData: []
}
},
methods: {
_tableResultChange(msg, data) {
console.log(msg)
switch (msg) {
case 'page':
this._page()
break
case 'changeSize':
this._page()
break
case 'selectData':
this.selectData = data
break
case 'singleSelect':
this.selectData = [data]
this.$emit('on-result-change', this.selectData)
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
}
},
_open(sampleId) {
this.sampleId = sampleId || ''
this._page()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilAptitude.expReportTemplatePage(
this.$serializeForm(this.formObj)
)
if (result) {
this.getPage = result
this.$refs.pageTable._hideLoading()
}
}
}
}
</script>
......@@ -102,7 +102,7 @@ export default {
this.isDisable = false
this.action =
global.baseURL +
'/soil/v1/exp_report_template/upload_template/?name=' +
'/soil/v1/exp_report_template/upload_template_summary/?name=' +
this.formObj.name +
'&remark=' +
this.formObj.remark +
......
......@@ -180,7 +180,7 @@ export default {
_page: async function() {
console.log('page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilAptitude.expReportTemplatePage(
const result = await soilAptitude.pageSummaryTemplate(
this.$serializeForm(this.formObj)
)
if (result) {
......
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