Commit 978f7154 by lichengming

修改了送检管理证书编制

parent 3d4c003b
...@@ -6,24 +6,24 @@ ...@@ -6,24 +6,24 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24" style="margin-top: 10px"> <Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false"> <Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item class="search-item" label="样品名称:"> <Form-item class="search-item" label="样品名称:">
<Input v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable @on-enter="_formSearch"/> <Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入样品名称" clearable/>
</Form-item> </Form-item>
<Form-item class="search-item" label="样品编号:"> <Form-item class="search-item" label="样品编号:">
<Input v-model="formObj.code" name="aptitude" placeholder="请输入样品编号" clearable @on-enter="_formSearch"/> <Input v-model="formObj.code" @on-enter="_formSearch" name="aptitude" placeholder="请输入样品编号" clearable/>
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button> <Button @click="_formSearch" type="primary">搜索</Button>
</Form-item> </Form-item>
</Form> </Form>
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide" <btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
@on-result-change="_btnClick"></btn-list> class="contHide"></btn-list>
</Col> </Col>
<!--表格--> <!--表格-->
<Col span="24"> <Col span="24">
...@@ -63,10 +63,9 @@ ...@@ -63,10 +63,9 @@
<MeterPersonItemTaskManage ref="personModal"></MeterPersonItemTaskManage> <MeterPersonItemTaskManage ref="personModal"></MeterPersonItemTaskManage>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_page"></MeterSubcontractorEdit> <MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_page"></MeterSubcontractorEdit>
<SelectOriTempRecord ref="SelectOriTempRecord" @on-result-change="_certificateSelectBack"></SelectOriTempRecord> <SelectOriTempRecord ref="SelectOriTempRecord" @on-result-change="_certificateSelectBack"></SelectOriTempRecord>
<RecordIframe ref="iframeModal" @on-result-change="_resultRecord"></RecordIframe>
<!--自定义编制证书--> <!--自定义编制证书-->
<CertificateMake ref="itemOriginalRecordModal" @on-result-change="_resultRecord"></CertificateMake> <CertificateMake ref="itemOriginalRecordModal" @on-result-change="_resultRecord"></CertificateMake>
<!--编辑证书--> <!--编辑证书-->
<CertificateMakeLook ref="itemOriginalRecordLookModal" @on-result-change="_resultRecord"></CertificateMakeLook> <CertificateMakeLook ref="itemOriginalRecordLookModal" @on-result-change="_resultRecord"></CertificateMakeLook>
...@@ -82,8 +81,10 @@ import CarManage from './CarManage' ...@@ -82,8 +81,10 @@ import CarManage from './CarManage'
import MeterPersonItemTaskManage from './MeterPersonItemTaskManage' import MeterPersonItemTaskManage from './MeterPersonItemTaskManage'
import InstruMentEdit from './InstrumentEdit' import InstruMentEdit from './InstrumentEdit'
import SelectOriTempRecord from './SelectOriTempRecord' import SelectOriTempRecord from './SelectOriTempRecord'
import RecordIframe from './RecordIframe'
export default { export default {
components: { components: {
RecordIframe,
SelectOriTempRecord, SelectOriTempRecord,
MeterSubcontractorEdit, MeterSubcontractorEdit,
CertificateMake, CertificateMake,
...@@ -185,8 +186,33 @@ export default { ...@@ -185,8 +186,33 @@ export default {
}, },
mounted() { mounted() {
this._page() this._page()
window.addEventListener('message', this._saveOriginal)
}, },
methods: { methods: {
async _saveOriginal(data) {
console.log('data11111', data)
console.log('formId', this.formId)
console.log('sampleId: [],', this.sampleId)
console.log('data.data.msg,', data.data.msg)
if (this.again) {
this.again = false
if (
undefined !== this.formId &&
this.formId !== '' &&
this.sampleId !== undefined
) {
await meterSample.certificateEdit({
sampleId: this.sampleId,
formId: this.formId
})
}
if (data.data.msg === true) {
this.$refs.iframeModal._closeIframe()
} else {
this.$refs.iframeModal._closeIframe()
}
}
},
_btnClick(msg, componentName) { _btnClick(msg, componentName) {
this.currentComponent = componentName this.currentComponent = componentName
this.$nextTick(function() { this.$nextTick(function() {
...@@ -328,13 +354,28 @@ export default { ...@@ -328,13 +354,28 @@ export default {
) { ) {
this.$Message.warning('该检测项目暂无原始记录!') this.$Message.warning('该检测项目暂无原始记录!')
} else { } else {
this.$refs.itemOriginalRecordLookModal._open( // this.$refs.itemOriginalRecordLookModal._open(
data.recordId, // data.recordId,
name, // name,
data.id // data.id
) // )
this._iframeModal(data, name)
} }
}, },
_iframeModal(data, name) {
this.again = true
this.formId = data.recordId
this.showDiagramModalSampleLook = true
this.sampleId = data.id
this.name = name
let url = ''
url =
name !== 'only'
? 'http://record.patzn.com:7000/print/v1/eln/form_meter_' +
data.recordId
: 'http://record.patzn.com:7000/print/v1/form/' + data.recordId
this.$refs.iframeModal._createIframe(url)
},
_personModal(data) { _personModal(data) {
console.log(data) console.log(data)
this.$refs.personModal._open(data.id) this.$refs.personModal._open(data.id)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<Modal v-model="showModal" v-drag width="1100"> <Modal v-model="showModal" v-drag width="1100">
<p slot="header">选择原始记录模板</p> <p slot="header">选择原始记录模板</p>
<div> <div>
<TwoCard :gutter=16 left-name="原始记录模板类别" right-name="实验室原始记录模板名称" left-span="8" @on-result-change="_refresh"> <TwoCard :gutter=16 @on-result-change="_refresh" left-name="原始记录模板类别" right-name="实验室原始记录模板名称" left-span="8">
<template slot="left"> <template slot="left">
<OriginalRecordClassTree ref="classTree" @on-result-change="_classData"></OriginalRecordClassTree> <OriginalRecordClassTree ref="classTree" @on-result-change="_classData"></OriginalRecordClassTree>
</template> </template>
...@@ -14,18 +14,18 @@ ...@@ -14,18 +14,18 @@
<Form :label-width="50" inline onsubmit="return false"> <Form :label-width="50" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item label="名称:"> <Form-item label="名称:">
<Input v-model="formObj.title" placeholder="请输入名称" style="width: 200px" clearable <Input v-model="formObj.title" @on-enter="_search" placeholder="请输入名称" style="width: 200px"
@on-enter="_search"/> clearable/>
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button type="primary" @click="_search">搜索</Button> <Button @click="_search" type="primary">搜索</Button>
</Form-item> </Form-item>
</Form> </Form>
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
<PTVXETable ref="pageTable" :height="300" <PTVXETable ref="pageTable" :height="300"
:get-page="getPage" :is-radio="true" hide-checkbox @on-result-change="_tableResultChange"> :get-page="getPage" :is-radio="true" @on-result-change="_tableResultChange" hide-checkbox>
<vxe-table-column <vxe-table-column
v-for="(item,index) in pageColumns" v-for="(item,index) in pageColumns"
:key="index" :key="index"
...@@ -59,10 +59,10 @@ ...@@ -59,10 +59,10 @@
* 选择原始记录模板(实验室的) * 选择原始记录模板(实验室的)
*/ */
import TwoCard from '../../../components/base/TwoCard' import TwoCard from '../../../components/base/TwoCard'
import { meterPrint } from '../../../api' import { meterPrint, meterSample } from '../../../api'
import Global from '../../../api/config'
import RecordIframe from './RecordIframe' import RecordIframe from './RecordIframe'
import OriginalRecordClassTree from './OriginalRecordClassTree' import OriginalRecordClassTree from './OriginalRecordClassTree'
let count = 0
export default { export default {
components: { components: {
...@@ -72,6 +72,7 @@ export default { ...@@ -72,6 +72,7 @@ export default {
}, },
data() { data() {
return { return {
count: 0,
showModal: false, showModal: false,
getPage: {}, getPage: {},
pageColumns: [{ title: '名称', key: 'title' }], pageColumns: [{ title: '名称', key: 'title' }],
...@@ -80,6 +81,8 @@ export default { ...@@ -80,6 +81,8 @@ export default {
title: '' title: ''
// businessTypeList: 0 // businessTypeList: 0
}, },
templateId: '',
again: false,
selectData: [], selectData: [],
sampleId: '', sampleId: '',
sampleData: '', sampleData: '',
...@@ -99,11 +102,41 @@ export default { ...@@ -99,11 +102,41 @@ export default {
window.addEventListener('message', this._saveOriginal) window.addEventListener('message', this._saveOriginal)
}, },
// 销毁监听事件 // 销毁监听事件
beforeDestroy() { // beforeDestroy() {
count = 0 // this.count = 0
window.removeEventListener('message', this._saveOriginal) // window.removeEventListener('message', this._saveOriginal)
}, // },
methods: { methods: {
async _saveOriginal(data) {
console.log('data222', data)
if (this.again) {
this.again = false
if (undefined !== data.data.msg && data.data.msg === true) {
this._cancel()
} else if (
undefined === data.data.templateId &&
data.data.msg !== undefined
) {
const result = await meterSample.certificateOk({
sampleId: this.sampleId,
formId: data.data.msg
})
if (result) {
this.$refs.iframeModal._closeIframe()
}
} else {
console.log('保存失败了')
// this.$store
// .dispatch('FoodItem/saveModelForTestBasis', {
// ids: this.itemIds,
// templateId: data.data.templateId
// })
// .then(() => {
// this._cancel()
// })
}
}
},
// 刷新左右数据 // 刷新左右数据
_refresh() { _refresh() {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
...@@ -148,7 +181,7 @@ export default { ...@@ -148,7 +181,7 @@ export default {
this._page() this._page()
this.selectData = [] this.selectData = []
this._hideLoading() this._hideLoading()
count = 0 this.count = 0
}, },
_page: async function(data) { _page: async function(data) {
const result = await meterPrint.pageSampleTemplate(data) const result = await meterPrint.pageSampleTemplate(data)
...@@ -181,57 +214,117 @@ export default { ...@@ -181,57 +214,117 @@ export default {
tempId: this.selectData[0].id, tempId: this.selectData[0].id,
dataSource: this.sampleData dataSource: this.sampleData
} }
this.$emit('on-result-change', param) console.log(param)
// this.$emit('on-result-change', param)
this._iframeModal()
} }
}, },
_iframeModal() {
const client =
undefined === this.sampleData.client ? '' : this.sampleData.client
const name =
undefined === this.sampleData.name ? '' : this.sampleData.name
const spec =
undefined === this.sampleData.spec ? '' : this.sampleData.spec
const factoryNumber =
undefined === this.sampleData.factoryNumber
? ''
: this.sampleData.factoryNumber
const manufacturer =
undefined === this.sampleData.manufacturer
? ''
: this.sampleData.manufacturer
const verification =
undefined === this.sampleData.verification
? ''
: this.sampleData.verification
this.again = true
this.showDiagramModal = true
let baseUrl = Global.baseURL
baseUrl +=
'/meter/v1/sample/certificate_record_data_bind?sampleId=' +
this.sampleId +
'&modelId=' +
this.selectData[0].id
const url =
'http://record.patzn.com:7000/print/v1/eln/template_meter_' +
this.selectData[0].id +
'?client=' +
client +
'&spec=' +
spec +
'&factoryNumber=' +
factoryNumber +
'&manufacturer=' +
manufacturer +
'&verification=' +
verification +
'&name=' +
name +
'&bindUri=' +
encodeURIComponent(baseUrl)
const param = {
sampleId: this.sampleId,
tempId: this.selectData[0].id,
client: client,
spec: spec,
name: name,
factoryNumber: factoryNumber,
manufacturer: manufacturer,
verification: verification,
bindUri: encodeURIComponent(baseUrl)
// dataSource: this.sampleData
}
this.$refs.iframeModal._createIframe(url, param)
},
_recordChange() { _recordChange() {
this.$emit('on-result-change') this.$emit('on-result-change')
},
// 保存原始记录信息
_saveOriginal(data) {
if (localStorage.getItem('recordStatus') === 'addLabRecord') {
if (count === 0) {
if (data.data.msg !== true) {
// 添加
const tempData = {
formId: data.data.msg,
ids: this.itemIds.join(',')
}
console.log('saveData', data)
const copyMapTemp = {}
if (data.data.copySheet && data.data.copyedSheet) {
tempData.copyMap = {}
const copyedKey = String(data.data.copyedSheet)
copyMapTemp[copyedKey] = ''
copyMapTemp[copyedKey] = String(data.data.copySheet)
// 存在复制sheet的情况
tempData.copyMap = JSON.stringify(copyMapTemp)
} else if (typeof data.data.testValueArry !== 'undefined') {
const testValue = data.data.testValueArry
tempData.copyMap = {}
testValue.forEach(item => {
const copyedKey = String(item.copyedSheet)
copyMapTemp[copyedKey] = ''
copyMapTemp[copyedKey] = String(item.copySheet)
tempData.copyMap = JSON.stringify(copyMapTemp)
})
}
this.$store
.dispatch('EnvItem/saveFormForItem', tempData)
.then(() => {
if (this.$store.state.EnvItem.success) {
this.$Message.success('添加成功')
this._recordChange()
this.$refs.iframeModal._closeIframe()
// 关闭所有layx弹框
// layx.destroyAll('recordAddTemplate');
}
})
}
}
count = count + 1
}
} }
// 保存原始记录信息
// _saveOriginal(data) {
// if (localStorage.getItem('recordStatus') === 'addLabRecord') {
// if (count === 0) {
// if (data.data.msg !== true) {
// // 添加
// const tempData = {
// formId: data.data.msg,
// ids: this.itemIds.join(',')
// }
// console.log('saveData', data)
// const copyMapTemp = {}
// if (data.data.copySheet && data.data.copyedSheet) {
// tempData.copyMap = {}
// const copyedKey = String(data.data.copyedSheet)
// copyMapTemp[copyedKey] = ''
// copyMapTemp[copyedKey] = String(data.data.copySheet)
// // 存在复制sheet的情况
// tempData.copyMap = JSON.stringify(copyMapTemp)
// } else if (typeof data.data.testValueArry !== 'undefined') {
// const testValue = data.data.testValueArry
// tempData.copyMap = {}
// testValue.forEach(item => {
// const copyedKey = String(item.copyedSheet)
// copyMapTemp[copyedKey] = ''
// copyMapTemp[copyedKey] = String(item.copySheet)
// tempData.copyMap = JSON.stringify(copyMapTemp)
// })
// }
// this.$store
// .dispatch('EnvItem/saveFormForItem', tempData)
// .then(() => {
// if (this.$store.state.EnvItem.success) {
// this.$Message.success('添加成功')
// this._recordChange()
// this.$refs.iframeModal._closeIframe()
// // 关闭所有layx弹框
// // layx.destroyAll('recordAddTemplate');
// }
// })
// }
// }
// count = count + 1
// }
// }
} }
} }
</script> </script>
...@@ -24,7 +24,6 @@ const Iframe = { ...@@ -24,7 +24,6 @@ const Iframe = {
// document.body.appendChild(div); // document.body.appendChild(div);
const modalId = 'modal-' + new Date().getTime() const modalId = 'modal-' + new Date().getTime()
// 首先创建框架的 div 等视觉元素 // 首先创建框架的 div 等视觉元素
const modalDiv = document.createElement('div') const modalDiv = document.createElement('div')
// 创建loading div // 创建loading div
...@@ -58,7 +57,7 @@ const Iframe = { ...@@ -58,7 +57,7 @@ const Iframe = {
// 放入 document 中 // 放入 document 中
document.body.appendChild(modalDiv) document.body.appendChild(modalDiv)
$(modalDiv).draggable() // $(modalDiv).draggable()
// modalDiv 创建标题栏 // modalDiv 创建标题栏
const modalHeaderDiv = document.createElement('div') const modalHeaderDiv = document.createElement('div')
...@@ -68,7 +67,7 @@ const Iframe = { ...@@ -68,7 +67,7 @@ const Iframe = {
const modalTitleDiv = document.createElement('div') const modalTitleDiv = document.createElement('div')
modalTitleDiv.className = 'record-modal-title' modalTitleDiv.className = 'record-modal-title'
modalHeaderDiv.appendChild(modalTitleDiv) modalHeaderDiv.appendChild(modalTitleDiv)
modalTitleDiv.innerText = '原始记录添加' modalTitleDiv.innerText = '检定(校准)证书编制'
// 标题栏中有按钮 // 标题栏中有按钮
const modalBtnDiv = document.createElement('div') const modalBtnDiv = document.createElement('div')
...@@ -85,9 +84,9 @@ const Iframe = { ...@@ -85,9 +84,9 @@ const Iframe = {
// — □ x // — □ x
minBtn.className = 'record-modal-min' minBtn.className = 'record-modal-min'
minBtn.title = '最小化' minBtn.title = '最小化'
// minBtn.innerText = '—'; minBtn.innerText = '—'
modalBtnDiv.appendChild(minBtn) modalBtnDiv.appendChild(minBtn)
minIcon.className = 'ivu-icon ivu-icon-ios-minus-empty' // minIcon.className = 'ivu-icon ios-bookmarks'
minBtn.appendChild(minIcon) minBtn.appendChild(minIcon)
maxBtn.className = 'record-modal-max' maxBtn.className = 'record-modal-max'
...@@ -99,8 +98,8 @@ const Iframe = { ...@@ -99,8 +98,8 @@ const Iframe = {
closeBtn.className = 'record-modal-close' closeBtn.className = 'record-modal-close'
closeBtn.title = '关闭' closeBtn.title = '关闭'
// closeBtn.innerText = '×'; closeBtn.innerText = '×'
colseIcon.className = 'ivu-icon ivu-icon-ios-close-empty' // colseIcon.className = 'ivu-icon ivu-icon-ios-close-empty'
closeBtn.appendChild(colseIcon) closeBtn.appendChild(colseIcon)
closeBtn.addEventListener('click', function closeBtnClickFunc() { closeBtn.addEventListener('click', function closeBtnClickFunc() {
...@@ -139,7 +138,7 @@ const Iframe = { ...@@ -139,7 +138,7 @@ const Iframe = {
formElement.action = url formElement.action = url
formElement.target = name formElement.target = name
// 表单的方法提交 // 表单的方法提交
formElement.method = 'post' formElement.method = 'GET'
formElement.style.display = 'none' formElement.style.display = 'none'
contentDiv.appendChild(formElement) contentDiv.appendChild(formElement)
...@@ -211,7 +210,7 @@ const Iframe = { ...@@ -211,7 +210,7 @@ const Iframe = {
'line-height': '30px', 'line-height': '30px',
'padding-left': '5px' 'padding-left': '5px'
}) })
$(littleTitleDiv).text('原始记录添加') $(littleTitleDiv).text('检定(校准)证书编制')
littleModal.appendChild(littleTitleDiv) littleModal.appendChild(littleTitleDiv)
// 存放按钮的 div // 存放按钮的 div
...@@ -260,7 +259,7 @@ const Iframe = { ...@@ -260,7 +259,7 @@ const Iframe = {
$(iframeElement).bind('load', function() { $(iframeElement).bind('load', function() {
$(loadingDiv).css('display', 'none') $(loadingDiv).css('display', 'none')
$(modalDiv).css('display', 'block') $(modalDiv).css('display', 'block')
$(modalTitleDiv).text('原始记录添加') $(modalTitleDiv).text('检定(校准)证书编制')
$(iframeElement).css('display', 'block') $(iframeElement).css('display', 'block')
}) })
window.onresize = function() { window.onresize = function() {
......
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