Commit c4a4a719 by lichengming

修改了填写原始记录

parent 53ea9ce4
<template>
<div>
<Modal v-model="showBatchModal" :mask-closable="false" width="900">
<p slot="header">
生成报告
</p>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--样品信息-->
<!--报告模板-->
<Col span="24">
<ReportTemplate ref="reportTemplate" @on-result-change="_templateResultChange"></ReportTemplate>
</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 ReportTemplate from './ReportTemplate'
/**
* 样品列表--生成报告或者选择模板生成报告
*/
export default {
components: {
ReportTemplate
},
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(data) {
this.getPage.records = []
this.backData = {}
this.tableData = data
this.showBatchModal = true
const tableData = {}
tableData.name = data.name
tableData.code = data.code
if (data.reportCode) {
tableData.certificate = data.reportCode
} else {
tableData.certificate = ''
}
console.log(tableData)
this.getPage.records.push(tableData)
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.backData.sampleId = this.tableData.id
this.$emit('on-result-change', this.backData)
this.showBatchModal = false
console.log('this.backData', this.backData)
}
},
_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>
...@@ -55,11 +55,12 @@ ...@@ -55,11 +55,12 @@
<CollectManage ref="collectModal" @on-result-change="_page"></CollectManage> <CollectManage ref="collectModal" @on-result-change="_page"></CollectManage>
<CollectFileManage ref="collectFileModal" @on-result-change="_page"></CollectFileManage> <CollectFileManage ref="collectFileModal" @on-result-change="_page"></CollectFileManage>
<SelEquip ref="selEquip" @on-result-change="_equipResult"></SelEquip> <SelEquip ref="selEquip" @on-result-change="_equipResult"></SelEquip>
<CreateReport ref="createModal" @on-result-change="_certificateSelectExcelBack"></CreateReport>
</div> </div>
</template> </template>
<script> <script>
import Global from '../../../../api/config' import Global from '../../../../api/config'
import { soilTest } from '../../../../api' import { soilSample, soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/assignPerson' import AssignPerson from '../../../../components/user-info-single/assignPerson'
import SelectOriTempRecord from '../SelectOriTempRecord' import SelectOriTempRecord from '../SelectOriTempRecord'
import OriginalRecordEdit from '../OriginalRecordEdit' import OriginalRecordEdit from '../OriginalRecordEdit'
...@@ -68,6 +69,7 @@ import SelEquip from '../../../../components/select-equip/SelEquip' ...@@ -68,6 +69,7 @@ import SelEquip from '../../../../components/select-equip/SelEquip'
import EquipManage from '../EquipManage' import EquipManage from '../EquipManage'
import CollectManage from '../CollectManage' import CollectManage from '../CollectManage'
import CollectFileManage from '../CollectFileManage' import CollectFileManage from '../CollectFileManage'
import CreateReport from './CreateReport'
export default { export default {
components: { components: {
AssignPerson, AssignPerson,
...@@ -77,7 +79,8 @@ export default { ...@@ -77,7 +79,8 @@ export default {
SelEquip, SelEquip,
EquipManage, EquipManage,
CollectManage, CollectManage,
CollectFileManage CollectFileManage,
CreateReport
}, },
data() { data() {
return { return {
...@@ -127,6 +130,7 @@ export default { ...@@ -127,6 +130,7 @@ export default {
], ],
iconMsg: [ iconMsg: [
{ type: 'ios-book', id: '', name: '查看原始记录' }, { type: 'ios-book', id: '', name: '查看原始记录' },
{ type: 'ios-book', id: '', name: '填写原始记录' },
{ type: 'md-apps', id: '', name: '查看指标' }, { type: 'md-apps', id: '', name: '查看指标' },
{ type: 'ios-bookmarks', id: '', name: '查看采集数据' }, { type: 'ios-bookmarks', id: '', name: '查看采集数据' },
{ type: 'ios-browsers', id: '', name: '查看采集文件' }, { type: 'ios-browsers', id: '', name: '查看采集文件' },
...@@ -194,6 +198,9 @@ export default { ...@@ -194,6 +198,9 @@ export default {
case '查看指标': case '查看指标':
this._indexManage(data) this._indexManage(data)
break break
case '填写原始记录':
this._makeCertificateExcelByTemp(data)
break
case '查看采集数据': case '查看采集数据':
this._collectManage(data) this._collectManage(data)
break break
...@@ -206,6 +213,49 @@ export default { ...@@ -206,6 +213,49 @@ export default {
} }
}) })
}, },
_certificateSelectExcelBack(data) {
if (data) {
this.$refs.pageTable._showLoading()
this._makeCodeExcel(data)
} else {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
// this._appendOriginalRecord()
}
}
},
_makeCertificateExcelByTemp(data) {
// this.$refs.SelectOriTempRecordExcel._open(data.id, data)
this.$refs.createModal._open(data)
},
_makeCodeExcel: async function(data) {
console.log('----dddd---', data)
this.$refs.pageTable._hideLoading()
const result = await soilSample.generateExcelReport(data)
if (result) {
await this._page()
if (result === null || result === undefined) {
this.$Message.warning('证书编制失败,请联系管理员!')
this.$refs.pageTable._hideLoading()
return false
} else {
this.$emit('on-result-change')
this._viewReport(result)
}
}
},
_viewReport(data) {
if (data) {
this.$openWindowModeless({
objectKey: data.objectKey,
idType: 10,
id: data.id,
isReport: 4
})
}
},
_collectManage(data) { _collectManage(data) {
this.$refs.collectModal._open(data) this.$refs.collectModal._open(data)
}, },
......
<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.name" @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: 'name', 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.originalTemplatePage(
this.$serializeForm(this.formObj)
)
if (result) {
this.getPage = result
this.$refs.pageTable._hideLoading()
}
}
}
}
</script>
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