Commit c8f33e4e by lichengming

修改了试样检测填写原始记录页面

parent 4be57a60
......@@ -31,5 +31,17 @@ export default {
pageTestByExp: data =>
http.post('soil/v1/experiment/page_test_by_exp', data).then(res => res),
pageExperimentTest: data =>
http.post('soil/v1/experiment/page_exp_test', data).then(res => res)
http.post('soil/v1/experiment/page_exp_test', data).then(res => res),
zTree: data =>
http.post('/print/v1/template_category/ztree', data).then(res => res),
templatePage: data =>
http.post('/print/v1/template/page', data).then(res => res),
checkLimit: data =>
http.post('/env/v1/env_item/check_limit', data).then(res => res),
searchItem: data =>
http
.post('/env/v1/env_item/search_all_common_sample_count', data)
.then(res => res),
saveItem: data =>
http.post('/env/v1/env_item/save_form_for_item', data).then(res => res)
}
......@@ -3,4 +3,5 @@ WEB_URL=http://web.dev.patzn.com:8028
BASE_URL=http://api.dev.patzn.com:7000
SSO_URL=http://api.dev.patzn.com:7000
STATIC_URL=http://static.patzn.com
RECORD_URL=http://record.patzn.com:7000
NC_URL=http://123.133.38.68:8088
......@@ -24,6 +24,9 @@
/**
* 原始记录类别添加编辑Ztree
*/
import { soilTest } from '../../../api'
export default {
data() {
return {
......@@ -51,6 +54,8 @@ export default {
},
methods: {
_Ztree(tableHeight, businessTypeList) {
console.log('请求树')
console.log(tableHeight, businessTypeList)
this.key = ''
this.treeId = 'oriRecordClassTree' + this.$randomCode()
this.isloading = true
......@@ -61,7 +66,7 @@ export default {
} else {
// 采样实/实验室不同类型
this.businessTypeList = businessTypeList
// this._requestByBusinessTypeList()
this._requestByBusinessTypeList()
}
if (tableHeight) {
$('.tree_height').height(tableHeight)
......@@ -77,7 +82,7 @@ export default {
this.isTree = false
// 查询实验室、采样、所有类型的数据
if (this.businessTypeList !== undefined) {
// this._requestByBusinessTypeList()
this._requestByBusinessTypeList()
} else {
this._request()
}
......@@ -103,24 +108,37 @@ export default {
})
},
// 采样/实验室查env下,不同类型(采样/实验室)的树数据
_requestByBusinessTypeList() {
_requestByBusinessTypeList: async function() {
const data = {}
data.businessTypeList = this.businessTypeList
if (this.key) {
data.name = this.key
}
this.$store.dispatch('ElnTemplateCategory/listType', data).then(() => {
const result = await soilTest.zTree(data)
if (result) {
const treeObj = $.fn.zTree.init(
$('#' + this.treeId),
this.setting,
this.$store.state.ElnTemplateCategory.list
result
)
treeObj.expandAll(true)
setTimeout(() => {
this.isloading = false
this.isTree = true
}, 300)
})
}
// this.$store.dispatch('ElnTemplateCategory/listType', data).then(() => {
// const treeObj = $.fn.zTree.init(
// $('#' + this.treeId),
// this.setting,
// this.$store.state.ElnTemplateCategory.list
// )
// treeObj.expandAll(true)
// setTimeout(() => {
// this.isloading = false
// this.isTree = true
// }, 300)
// })
}
}
}
......
<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'
/**
* 编辑原始记录详情
*/
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) {
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)
},
// 保存后解析项目的检测值
_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.$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>
<template>
<div>
</div>
</template>
<script>
import { Iframe } from '../../../plugins/iframe'
/**
* 自定义打开 原始记录添加界面
*/
export default {
props: {
ifrAction: null
},
data() {
return {
iframeShow: false,
isLoading: false,
fullScreenHeight: document.documentElement.clientHeight - 82 + 'px',
iframeHeight: document.documentElement.clientHeight - 300 + 'px',
iframeHeader: '原始记录添加'
}
},
methods: {
/** 自定义iframe**/
_createIframe(bindUri, params) {
Iframe.iframe(bindUri, params)
},
/** 自定义iframe的使用**/
_closeIframe() {
Iframe.closeModalDiv()
}
}
}
</script>
<style>
.record-modal {
width: 800px;
height: 500px;
border: 1px solid #0079fd;
position: fixed;
box-shadow: 0 0 10px #505050;
top: 0;
left: 0;
display: block;
}
.record-modal-header {
width: 100%;
height: 30px;
background-color: #ffffff;
position: relative;
border-bottom: 1px solid #ffffff;
}
.record-modal-title {
width: 200px;
position: absolute;
left: 0;
top: 0;
height: 100%;
font-size: 14px;
font-weight: 400;
color: #000;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 30px;
margin-left: 10px;
}
.record-modal-btn {
position: absolute;
right: 0;
top: 0;
width: 120px;
height: 100%;
margin-top: 0;
/*margin-left: 680px;*/
}
.record-modal-btn > div {
float: left;
width: 40px;
height: 100%;
font-size: 14px;
line-height: 30px;
text-align: center;
cursor: default;
user-select: none;
}
.record-modal-max {
font-weight: bold;
}
.record-modal-min:hover,
.record-modal-max:hover {
background-color: #e5e5e5;
}
.record-modal-close {
font-size: 24px !important;
}
.record-modal-close:hover {
background-color: #e81123 !important;
}
.record-modal-content {
width: 100%;
height: 470px;
position: relative;
background-color: #ffffff;
}
.record-loading-content {
background-color: #ffffff;
width: 100%;
text-align: center;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
</style>
......@@ -73,8 +73,10 @@ export default {
// this._issuedPage()
} else if (tab.name === 'waitReceive') {
// this._waitPage()
this.$refs.waitScanModal._clearTable()
this.$refs.waitReceiveModal._open(this.entrustId)
} else if (tab.name === 'waitScan') {
this.$refs.waitReceiveModal._clearTable()
this.$refs.waitScanModal._open(this.entrustId)
// this._waitSend()
}
......
......@@ -3,7 +3,7 @@
<Modal v-model="showModal" v-drag width="1100">
<p slot="header">选择原始记录模板</p>
<div>
<TwoCard @on-result-change="_refresh" left-name="原始记录模板类别" right-name="实验室原始记录模板名称" gutter="16" left-span="8">
<TwoCard @on-result-change="_refresh" :gutter=16 left-name="原始记录模板类别" right-name="实验室原始记录模板名称" left-span="8">
<template slot="left">
<OriginalRecordClassTree ref="classTree" @on-result-change="_classData"></OriginalRecordClassTree>
</template>
......@@ -51,7 +51,7 @@
</div>
</Modal>
<!--自定义post请求iframe-->
<!-- <RecordIframe ref="iframeModal"></RecordIframe>-->
<RecordIframe ref="iframeModal"></RecordIframe>
</div>
</template>
<script>
......@@ -60,13 +60,15 @@
*/
import Global from '../../../api/config'
import TwoCard from '../../../components/base/TwoCard'
import { soilTest } from '../../../api'
import OriginalRecordClassTree from './OriginalRecordClassTree'
import RecordIframe from './RecordIframe'
let count = 0
export default {
components: {
OriginalRecordClassTree,
TwoCard
TwoCard,
RecordIframe
},
data() {
return {
......@@ -111,7 +113,7 @@ export default {
},
// 左侧数据请求
_classTree() {
const height = this.$tableHeight('', 345)
const height = this.$tableHeight('', 85)
this.$refs.classTree._Ztree(height, 0)
},
// 左边树的点击
......@@ -148,14 +150,25 @@ export default {
this._hideLoading()
count = 0
},
_page() {
// 只查实验室的
console.log('page')
// this.$refs.pageTable._page(
// '',
// 'ElnTemplate/page',
// this.$serializeFormSearch(this.formObj)
// )
// _page() {
// // 只查实验室的
// console.log('page')
// // this.$refs.pageTable._page(
// // '',
// // 'ElnTemplate/page',
// // this.$serializeFormSearch(this.formObj)
// // )
// },
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.id
const result = await soilTest.templatePage(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_search() {
this.$refs.pageTable._pageChange(1)
......@@ -166,7 +179,7 @@ export default {
this.selectData = []
this.getPage = this.$store.state.ElnTemplate.page
break
case 'radioSelect':
case 'singleSelect':
this.selectData = [data]
break
case 'dbSelect':
......@@ -185,21 +198,46 @@ export default {
} else {
// 校验多样品多项目原始记录模板
const param = {
ids: this.itemIds.join(','),
ids: '1289126946969550850',
tempId: this.selectData[0].id
}
this.$store.dispatch('EnvItem/checkLimit', param).then(() => {
const result = this.$store.state.EnvItem.success
if (result) {
// 不是多样品项目模板或者数量小于限值,填写原始记录
// (3)originalTemplateId不为0也不为undefined ---- 填写过或者绑定过
this._bindOriginalRecord()
} else {
this.$msgTip('warning', '所选数据超过,原始记录模板设置最大值!')
this._hideLoading()
}
})
console.log(param)
this._createOriginalRecord()
// this._check(param)
// this.$store.dispatch('EnvItem/checkLimit', param).then(() => {
// const result = this.$store.state.EnvItem.success
// if (result) {
// // 不是多样品项目模板或者数量小于限值,填写原始记录
// // (3)originalTemplateId不为0也不为undefined ---- 填写过或者绑定过
// this._bindOriginalRecord()
// } else {
// this.$msgTip('warning', '所选数据超过,原始记录模板设置最大值!')
// this._hideLoading()
// }
// })
}
},
_check: async function(param) {
const result = await soilTest.checkLimit(param)
console.log(result)
},
_createOriginalRecord: async function() {
const result = await soilTest.searchItem({ ids: this.itemIds.join(',') })
console.log(result)
this.showModal = false
const url =
Global.recordURL + '/print/v1/eln/template_YT_' + this.selectData[0].id
const params = {
ids: this.itemIds.join(',')
// allSampleCount: '',
// normalSampleCount: '',
// itemCount: '',
// parallelCount: '',
// labelSample: ''
}
this.$refs.iframeModal._createIframe(url, params)
localStorage.setItem('recordStatus', 'addLabRecord')
},
// 生成原始记录
_bindOriginalRecord() {
......@@ -253,6 +291,15 @@ export default {
_recordChange() {
this.$emit('on-result-change')
},
_save: async function(temp) {
const result = await soilTest.saveItem(temp)
console.log(result)
if (result) {
this.$Message.success('添加成功')
this._recordChange()
this.$refs.iframeModal._closeIframe()
}
},
// 保存原始记录信息
_saveOriginal(data) {
if (localStorage.getItem('recordStatus') === 'addLabRecord') {
......@@ -282,17 +329,21 @@ export default {
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');
}
})
console.log('保存的数据', tempData)
if (tempData.formId !== undefined) {
this._save(tempData)
}
// 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
......
......@@ -18,9 +18,9 @@
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :table-name="tableName"
<PTVXETable ref="pageTable" :isRadio="true" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :rows="100" select-data>
@on-result-change="_tableResultChange" :getPage="getPage" :hide-checkbox="true" :rows="100" select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
......@@ -111,6 +111,7 @@ export default {
}
},
_tableResultChange(msg, data) {
console.log(msg, data)
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodItem.page
......@@ -118,6 +119,9 @@ export default {
case 'selectData':
this.$emit('on-result-change', data)
break
case 'singleSelect':
this.$emit('on-result-change', data)
break
case 'changeSize':
this._page()
break
......
......@@ -20,7 +20,7 @@
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :table-name="tableName" :rows="100" is-task select-data>
@on-result-change="_tableResultChange" :icon-msg="iconMsg" :getPage="getPage" :table-name="tableName" :rows="100" is-task select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
......@@ -48,6 +48,7 @@
</Row>
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
<SelectOriTempRecord ref="recordModal" @on-result-change="_page"></SelectOriTempRecord>
<OriginalRecordEdit ref="editModal"></OriginalRecordEdit>
</div>
</template>
<script>
......@@ -55,8 +56,9 @@ import Global from '../../../../api/config'
import { soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/AssignPerson'
import SelectOriTempRecord from '../SelectOriTempRecord'
import OriginalRecordEdit from '../OriginalRecordEdit'
export default {
components: { AssignPerson, SelectOriTempRecord },
components: { AssignPerson, SelectOriTempRecord, OriginalRecordEdit },
data() {
return {
// 定义表格名称----英文
......@@ -102,6 +104,7 @@ export default {
},
{ type: '', id: 'food-task-assign-maintain-info', name: '信息维护' }
],
iconMsg: [{ type: 'md-create', id: '', name: '编辑原始记录' }],
getPage: {},
pageColumns: [
{ title: '检测项目', key: 'name', width: 120, fixed: 'left' },
......@@ -114,7 +117,7 @@ export default {
{ title: '检测依据', key: 'testBasis', width: 140 },
{ title: '检测科室', key: 'groupName', width: 150 }
],
leftSelectData: [],
leftSelectData: {},
selectIds: [], // 检测项目id
selectData: [], // 检测项目data
selectSampleIds: [], // 样品ids
......@@ -142,6 +145,22 @@ export default {
// this._dicSearch()
},
methods: {
_iconClick(res, data, currentComponent) {
this.$nextTick(() => {
switch (res) {
case '编辑原始记录':
this._recordEdit(data)
break
}
})
},
_recordEdit(data) {
console.log(data)
// this.$refs.editModal._openWithType(
// data.originalRecordId,
// 'ENVTESTAUDITEDIT'
// )
},
// 获取column
_getColumn() {
this.$refs.pageTable._getColByTableName()
......@@ -363,16 +382,16 @@ export default {
return obj
},
_page: async function() {
const saveName = []
const saveMethod = []
for (let i = 0; i < this.leftSelectData.length; i++) {
saveName.push(this.leftSelectData[i].name)
saveMethod.push(this.leftSelectData[i].testMethod)
}
// const saveName = []
// const saveMethod = []
// for (let i = 0; i < this.leftSelectData.length; i++) {
// saveName.push(this.leftSelectData[i].name)
// saveMethod.push(this.leftSelectData[i].testMethod)
// }
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId
this.formObj.name = saveName.join(',')
this.formObj.testMethod = saveMethod.join(',')
this.formObj.name = this.leftSelectData.name
this.formObj.testMethod = this.leftSelectData.testMethod
const result = await soilTest.pageExperimentTest(
this.$serializeForm(this.formObj)
)
......@@ -395,6 +414,9 @@ export default {
// this.$emit('on-result-change')
// }
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
......
......@@ -29,6 +29,7 @@ export default {
},
methods: {
_leftResult(data) {
console.log('ItemTabs', data)
this.$refs.rightModal._open(this.id, data)
},
_rightResult() {
......
......@@ -67,7 +67,7 @@ const Iframe = {
const modalTitleDiv = document.createElement('div')
modalTitleDiv.className = 'record-modal-title'
modalHeaderDiv.appendChild(modalTitleDiv)
modalTitleDiv.innerText = '检定(校准)证书编制'
modalTitleDiv.innerText = '原始记录模板'
// 标题栏中有按钮
const modalBtnDiv = document.createElement('div')
......@@ -210,7 +210,7 @@ const Iframe = {
'line-height': '30px',
'padding-left': '5px'
})
$(littleTitleDiv).text('检定(校准)证书编制')
$(littleTitleDiv).text('原始记录模板')
littleModal.appendChild(littleTitleDiv)
// 存放按钮的 div
......@@ -259,7 +259,7 @@ const Iframe = {
$(iframeElement).bind('load', function() {
$(loadingDiv).css('display', 'none')
$(modalDiv).css('display', 'block')
$(modalTitleDiv).text('检定(校准)证书编制')
$(modalTitleDiv).text('原始记录模板')
$(iframeElement).css('display', 'block')
})
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