Commit d100c4ac by lichengming

修改了开土制备试样列表

parent de916a3b
......@@ -53,8 +53,12 @@ export default {
http.post('soil/v1/experiment/page_exp_allot_his', data).then(res => res),
pageTestByExp: data =>
http.post('soil/v1/experiment/page_test_by_exp', data).then(res => res),
pagePrepareByExp: data =>
http.post('soil/v1/experiment/page_prepare_by_exp', data).then(res => res),
pageExperimentTest: data =>
http.post('soil/v1/experiment/page_exp_test', data).then(res => res),
pageExpPrepare: data =>
http.post('soil/v1/experiment/page_exp_prepare', data).then(res => res),
zTree: data =>
http.post('/print/v1/template_category/ztree', data).then(res => res),
templatePage: data =>
......
<template>
<div>
<Modal v-model="showModal" width="800" class="modal-footer-none full-screen">
<div slot="header">{{modalTitle}}</div>
<div>
<Form id="index-right-form" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="仪器名称:">
<Input v-model="formObj.equipName" @on-enter="_formSearch" placeholder="请输入仪器名称" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 10px;"/>
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :icon-msg="iconMsg">
<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">
<template slot-scope="scope">
<span v-if="item.key==='defaulted'">{{scope.row[item.key]?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
<div class="viewFileImg">
<vue-gallery-slideshow :images="imgViewList" :index="imgViewIndex"
@close="imgViewIndex = null"></vue-gallery-slideshow>
</div>
</Modal>
<IndexManageEdit ref="indexEdit" @on-result-change="_page"></IndexManageEdit>
</div>
</template>
<script>
import { soilAptitude, soilTest } from '../../../api'
import global from '../../../api/config'
import IndexManageEdit from './IndexManageEdit'
export default {
components: { IndexManageEdit },
data() {
return {
id: '',
modalTitle: '',
showModal: false,
btn: [{ type: 'success', id: 'ZBC', name: '添加指标' }],
tableHeight: document.documentElement.clientHeight - 180,
imgViewList: [],
imgViewIndex: null,
viewUri: '/soil/v1/sample_photo/view',
pageColumns: [
{ title: '仪器名称', key: 'equipName', width: 120 },
{ title: '仪器编号', key: 'equipNum', width: 120 },
{ title: '规格型号', key: 'spec', width: 120 },
{ title: '仪器品牌', key: 'brand', width: 120 },
{ title: '实验室编号', key: 'labNum', width: 120 }
],
getPage: {},
iconMsg: [{ type: 'md-eye', id: '', name: '预览' }],
selectIds: [],
formObj: {
name: ''
},
// 资质信息
aptitudeItemInfo: {}
}
},
methods: {
_open(data) {
console.log(data)
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.id = data.id
this.modalTitle = data.name + ' 查看采集数据'
this.showModal = true
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.expId = this.id
const result = await soilTest.collectFilePage(
this.$serializeForm(this.formObj)
)
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '预览':
this._viewFile(data)
break
}
},
_viewFile(data) {
// this.$pdfView(data.objectKey)
const imgViewList = []
// imgViewList.push(global.baseURL + this.downloadFileUrlFile + data.id)
this.imgViewList = imgViewList
imgViewList.push(
global.baseURL +
this.viewUri +
'?id=' +
data.id +
'&objectKey=' +
data.objectKey
)
console.log(
global.baseURL +
this.viewUri +
'?id=' +
data.id +
'&objectKey=' +
data.objectKey
)
this.imgViewIndex = 0
},
_editModal(edit, data) {
if (edit) {
this._getById(data)
} else {
this.$refs.indexEdit._open(this.id, '')
}
},
_getById: async function(data) {
const result = await soilTest.itemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open('', result)
}
},
_btnClick(msg) {
switch (msg) {
case '添加指标':
this._editModal(false)
break
case '删除':
this._deleteByIds()
break
}
},
_deleteByIds() {
if (this.selectIds.length === 0) {
// this.$msgTip('warning')
this.$message.warning('请至少选择一条记录')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => {
this._delOk(this.selectIds)
}
})
}
},
_delOk: async function(ids) {
const result = await soilAptitude.expItemDeleteByIds(ids)
if (result) {
this.$message.success('删除成功')
this._page()
}
}
}
}
</script>
<style scoped>
.viewFileImg >>> .vgs__container {
height: 100% !important;
}
</style>
<template>
<div>
<Modal v-model="showModal" width="100" class="modal-footer-none full-screen">
<div slot="header">{{modalTitle}}</div>
<div>
<Form id="index-right-form" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="采集内容:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入采集内容" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 10px;"/>
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :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">
<template slot-scope="scope">
<span v-if="item.key==='defaulted'">{{scope.row[item.key]?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</Modal>
<IndexManageEdit ref="indexEdit" @on-result-change="_page"></IndexManageEdit>
</div>
</template>
<script>
import { soilAptitude, soilTest } from '../../../api'
import IndexManageEdit from './IndexManageEdit'
export default {
components: { IndexManageEdit },
data() {
return {
id: '',
modalTitle: '',
showModal: false,
btn: [{ type: 'success', id: 'ZBC', name: '添加指标' }],
tableHeight: document.documentElement.clientHeight - 180,
pageColumns: [
{ title: '采集内容', key: 'name' },
{ title: '检测值', key: 'testValue', width: 120 },
{ title: '实验室编号', key: 'labNum', width: 120 },
{ title: '仪器名称', key: 'equipName', width: 120 },
{ title: '仪器编号', key: 'equipNum', width: 120 },
{ title: '规格型号', key: 'spec', width: 120 }
],
getPage: {},
iconMsg: [{ type: 'md-create', id: '', name: '编辑' }],
selectIds: [],
formObj: {
name: ''
},
// 资质信息
aptitudeItemInfo: {}
}
},
methods: {
_open(data) {
console.log(data)
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.id = data.id
this.modalTitle = data.name + ' 查看采集数据'
this.showModal = true
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.expId = this.id
const result = await soilTest.collectDataPage(
this.$serializeForm(this.formObj)
)
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data)
break
}
},
_editModal(edit, data) {
if (edit) {
this._getById(data)
} else {
this.$refs.indexEdit._open(this.id, '')
}
},
_getById: async function(data) {
const result = await soilTest.itemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open('', result)
}
},
_btnClick(msg) {
switch (msg) {
case '添加指标':
this._editModal(false)
break
case '删除':
this._deleteByIds()
break
}
},
_deleteByIds() {
if (this.selectIds.length === 0) {
// this.$msgTip('warning')
this.$message.warning('请至少选择一条记录')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => {
this._delOk(this.selectIds)
}
})
}
},
_delOk: async function(ids) {
const result = await soilAptitude.expItemDeleteByIds(ids)
if (result) {
this.$message.success('删除成功')
this._page()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="800" class="modal-footer-none full-screen">
<div slot="header">{{modalTitle}}</div>
<div>
<Form id="index-right-form" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="仪器名称:">
<Input v-model="formObj.equipName" @on-enter="_formSearch" placeholder="请输入仪器名称" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 10px;"/>
<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">
<template slot-scope="scope">
<span v-if="item.key==='defaulted'">{{scope.row[item.key]?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</Modal>
<IndexManageEdit ref="indexEdit" @on-result-change="_page"></IndexManageEdit>
</div>
</template>
<script>
import { soilTest } from '../../../api'
import IndexManageEdit from './IndexManageEdit'
export default {
components: { IndexManageEdit },
data() {
return {
id: '',
modalTitle: '',
showModal: false,
btn: [],
tableHeight: document.documentElement.clientHeight - 180,
pageColumns: [
{ title: '仪器名称', key: 'equipName', width: 120 },
{ title: '仪器编号', key: 'equipNum', width: 120 },
{ title: '仪器品牌', key: 'brand', width: 120 },
{ title: '采集类型', key: 'collectionType', width: 120 },
{ title: '采集地址', key: 'collectionAddress', width: 120 },
{ title: '采集命令', key: 'acquisitionCommand', width: 120 }
],
getPage: {},
iconMsg: [{ type: 'md-trash', id: '', name: '删除' }],
selectIds: [],
formObj: {
name: ''
},
// 资质信息
aptitudeItemInfo: {}
}
},
methods: {
_open(data) {
console.log(data)
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.id = data.id
this.modalTitle = data.name + ' 设备管理'
this.showModal = true
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.expId = this.id
const result = await soilTest.equipPage(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '删除':
this._deleteByIds(data.id)
break
}
},
_editModal(edit, data) {
if (edit) {
this._getById(data)
} else {
this.$refs.indexEdit._open(this.id, '')
}
},
_getById: async function(data) {
const result = await soilTest.itemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open('', result)
}
},
_btnClick(msg) {
switch (msg) {
case '添加指标':
this._editModal(false)
break
case '删除':
this._deleteByIds()
break
}
},
_deleteByIds(id) {
this.$Modal.confirm({
title: '提示',
content: '确定删除这条记录?',
onOk: () => {
this._delOk(id)
}
})
},
_delOk: async function(id) {
const result = await soilTest.deleteEquip(id)
if (result) {
this.$Message.success('删除成功')
this._page()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="100" class="modal-footer-none full-screen">
<div slot="header">{{modalTitle}}</div>
<div>
<Form id="index-right-form" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="指标名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入类别" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 10px;"/>
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg">
<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">
<template slot-scope="scope">
<span v-if="item.key==='defaulted'">{{scope.row[item.key]?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</Modal>
<IndexManageEdit ref="indexEdit" @on-result-change="_page"></IndexManageEdit>
</div>
</template>
<script>
import { soilAptitude, soilTest } from '../../../api'
import IndexManageEdit from './IndexManageEdit'
export default {
components: { IndexManageEdit },
data() {
return {
id: '',
modalTitle: '',
showModal: false,
btn: [
{ type: 'success', id: '', name: '添加指标' },
{ type: 'error', id: '', name: '删除' }
],
tableHeight: document.documentElement.clientHeight - 180,
pageColumns: [
{ title: '试验指标名称', key: 'name' },
{ title: '试验指标大类', key: 'mainType', width: 120 },
{ title: '试验指标小类', key: 'smallType', width: 120 },
{ title: '状态', key: 'status', width: 120 },
{ title: '检测值', key: 'testValue', width: 120 },
{ title: '单位', key: 'unit', width: 120 }
],
getPage: {},
iconMsg: [{ type: 'md-create', id: '', name: '编辑' }],
selectIds: [],
formObj: {
name: ''
},
// 资质信息
aptitudeItemInfo: {}
}
},
methods: {
_open(data) {
console.log(data)
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.id = data.id
this.modalTitle = data.name + ' 指标管理'
this.showModal = true
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.experimentId = this.id
const result = await soilTest.itemPage(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data)
break
}
},
_editModal(edit, data) {
if (edit) {
this._getById(data)
} else {
this.$refs.indexEdit._open(this.id, '')
}
},
_getById: async function(data) {
const result = await soilTest.itemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open('', result)
}
},
_btnClick(msg) {
switch (msg) {
case '添加指标':
this._editModal(false)
break
case '删除':
this._deleteByIds()
break
}
},
_deleteByIds() {
if (this.selectIds.length === 0) {
// this.$msgTip('warning')
this.$message.warning('请至少选择一条记录')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => {
this._delOk(this.selectIds)
}
})
}
},
_delOk: async function(ids) {
const result = await soilAptitude.expItemDeleteByIds(ids)
if (result) {
this.$message.success('删除成功')
this._page()
}
}
}
}
</script>
<template>
<div>
<div>
<Form onsubmit="return false">
<Form-item>
<Input v-model="key" @on-enter="_search" placeholder="请输入关键字,回车查询" style="width:100%"
icon="ios-search-strong"/>
</Form-item>
</Form>
</div>
<!--加载中-->
<div v-show="isloading" class="demo-spin-container spin-bg tree_height">
<Spin fix size="large"></Spin>
</div>
<ul :id="treeId" v-show="isTree"
class="ztree ztreePro tree_height" style="overflow-x: auto;"></ul>
</div>
</template>
<style>
</style>
<script>
/**
* 原始记录类别添加编辑Ztree
*/
import { soilTest } from '../../../api'
export default {
data() {
return {
treeId: '',
key: '',
isloading: true,
isTree: false,
setting: {
data: {
simpleData: {
enable: true,
idKey: 'id',
pIdKey: 'pid'
}
},
callback: {
onClick: this.zTreeOnClick
}
},
businessTypeList: ''
}
},
created() {
// this._Ztree()
},
methods: {
_Ztree(tableHeight, businessTypeList) {
console.log('请求树')
console.log(tableHeight, businessTypeList)
this.key = ''
this.treeId = 'oriRecordClassTree' + this.$randomCode()
this.isloading = true
this.isTree = false
if (businessTypeList === undefined) {
// 查询所有类别
this._request()
} else {
// 采样实/实验室不同类型
this.businessTypeList = businessTypeList
this._requestByBusinessTypeList()
}
if (tableHeight) {
$('.tree_height').height(tableHeight)
} else {
$('.tree_height').height(document.documentElement.clientHeight - 230)
}
},
zTreeOnClick(event, treeId, treeNode) {
this.$emit('on-result-change', treeNode)
},
_search() {
this.isloading = true
this.isTree = false
// 查询实验室、采样、所有类型的数据
if (this.businessTypeList !== undefined) {
this._requestByBusinessTypeList()
} else {
this._request()
}
this.$emit('on-result-change')
},
// 原始记录模板管理查env所有的类别
_request() {
const data = {}
if (this.key) {
data.name = this.key
}
this.$store.dispatch('ElnTemplateCategory/list', 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)
})
},
// 采样/实验室查env下,不同类型(采样/实验室)的树数据
_requestByBusinessTypeList: async function() {
const data = {}
data.businessTypeList = this.businessTypeList
if (this.key) {
data.name = this.key
}
const result = await soilTest.zTree(data)
if (result) {
const treeObj = $.fn.zTree.init(
$('#' + this.treeId),
this.setting,
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)
// })
}
}
}
</script>
<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'
import { soilTest } from '../../../api'
/**
* 编辑原始记录详情
*/
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;
let recordUrl = ''
if (process.env.NODE_ENV === 'production') {
recordUrl = 'http://record.patzn.com'
} else {
recordUrl = Global.recordURL
}
// 编辑的时候传此bindUri 是为了 绑定spreadJs自定义的公式
const bindUri =
Global.baseURL + '/env/v1/env_item/original_record_data_bind?source='
const url =
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;
let recordUrl = ''
if (process.env.NODE_ENV === 'production') {
recordUrl = 'http://record.patzn.com'
} else {
recordUrl = Global.recordURL
}
// 编辑的时候传此bindUri 是为了 绑定spreadJs自定义的公式
const bindUri =
Global.baseURL + '/env/v1/env_item/original_record_data_bind?source='
const url =
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) {
console.log('修改的数据', 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)
},
_updateRecord: async function(param) {
const result = await soilTest.updateItem(param)
console.log(result)
if (result) {
this.$Message.success('保存成功')
this._cancel()
this.$emit('on-result-change')
}
},
// 保存后解析项目的检测值
_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._updateRecord(param)
// 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>
<template>
<div>
<Modal v-model="showSampleModal" @on-visible-change="_visibleChange" width="1200"
class="zIndex-900 modal-footer-none">
<p slot="header">管理样品</p>
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="制备管理" name="prepareManage">
<SoilSampleManage ref="prepareManage"></SoilSampleManage>
</el-tab-pane>
<el-tab-pane label="原始记录填写" name="recordModal">
<RecordWrite ref="recordModal"></RecordWrite>
</el-tab-pane>
</el-tabs>
<!-- <keep-alive>-->
<!-- &lt;!&ndash; eslint-disable-next-line vue/require-component-is &ndash;&gt;-->
<!-- <component ref="refModal" :is="currentComponent"></component>-->
<!-- </keep-alive>-->
</div>
</Modal>
</div>
</template>
<script>
import SoilSampleManage from '../SoilSampleManageTab'
import RecordWrite from './sample-preparation-record/RecordIndex'
export default {
components: {
SoilSampleManage,
RecordWrite
},
data() {
return {
type: '',
contractId: '', // 合同id
entrustId: '',
showSampleModal: false,
modalTitle: '',
selectIds: [],
activeName: 'prepareManage',
name: '',
currentComponent: ''
}
},
mounted() {},
methods: {
_open(entrustId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
this.showSampleModal = true
this.entrustId = entrustId // 委托id
this.activeName = 'prepareManage'
this.selectIds = []
this._preparePage()
},
// 制备管理
_preparePage() {
this.$refs.prepareManage._open(this.entrustId)
},
// 原始记录填写
_recordPage() {
this.$refs.recordModal._open(this.entrustId)
},
_changeTabs(tab, event) {
if (tab.name === 'prepareManage') {
// this._issuedPage()
this.$refs.prepareManage._open(this.entrustId)
this.$refs.recordModal._clearTable()
} else {
this.$refs.recordModal._open(this.entrustId)
}
},
// 关闭弹框的时候刷新上个界面
_visibleChange(data) {
if (data === false) {
}
}
}
}
</script>
......@@ -57,8 +57,8 @@
import { soilEntrust } from '../../../api'
import http from '../../../api/http'
import Operation from '../../../components/operation/Operation'
import SoilSampleManage from '../SoilSampleManage'
import global from '../../../api/config'
import SampleManage from './SampleManage'
import SamplePreparationEdit from './SamplePreparationEdit'
import SoilSampleItemManageEdit from './SoilSampleItemManageEdit'
import SoilEntrustItemNum from './SoilItemNum'
......@@ -69,7 +69,7 @@ export default {
// eslint-disable-next-line vue/no-unused-components
SamplePreparationEdit,
// eslint-disable-next-line vue/no-unused-components
SoilSampleManage,
SampleManage,
// eslint-disable-next-line vue/no-unused-components
SoilSampleItemManageEdit,
// eslint-disable-next-line vue/no-unused-components
......@@ -234,7 +234,7 @@ export default {
},
_sampleManage(data) {
// 管理样品
this.currentComponent = 'SoilSampleManage'
this.currentComponent = 'SampleManage'
this.$nextTick(() => {
this.$refs.refModal._open(data)
})
......
<template>
<div>
<Modal v-model="showModal" v-drag width="1100">
<p slot="header">选择原始记录模板</p>
<div>
<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>
<template slot="right">
<Row>
<!--查询-->
<Col span="24">
<Form :label-width="50" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="名称:">
<Input v-model="formObj.title" @on-enter="_search" placeholder="请输入名称" style="width: 200px"
clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_search" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :isRadio="true" hide-checkbox>
<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.key==='ctime'">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</template>
</TwoCard>
</div>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
</Modal>
<!--自定义post请求iframe-->
<RecordIframe ref="iframeModal"></RecordIframe>
</div>
</template>
<script>
/**
* 选择原始记录模板(实验室的)
*/
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,
RecordIframe
},
data() {
return {
showModal: false,
getPage: {},
pageColumns: [{ title: '名称', key: 'title' }],
formObj: {
id: '',
title: '',
businessTypeList: 0
},
entrustId: '',
clientList: [],
selectData: [],
itemIds: [],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('', 380)
}
},
created() {
// 监听原始记录消息
// eslint-disable-next-line nuxt/no-globals-in-created
window.addEventListener('message', this._saveOriginal)
},
// 销毁监听事件
beforeDestroy() {
count = 0
window.removeEventListener('message', this._saveOriginal)
},
methods: {
// 刷新左右数据
_refresh() {
this.formObj = this.$resetFields(this.formObj)
this.formObj.businessTypeList = 0
this.$refs.classTree._requestByBusinessTypeList()
this._search()
},
// 左侧数据请求
_classTree() {
const height = this.$tableHeight('', 85)
this.$refs.classTree._Ztree(height, 0)
},
// 左边树的点击
_classData(result) {
if (result !== undefined) {
this.formObj.id = result.id
} else {
this.formObj.id = ''
}
this._search()
},
/** *modal-footer */
_footerResult(name) {
switch (name) {
case '取消':
this.showModal = false
break
case '确定':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open(ids, entrustId, clientInfo) {
console.log(Global.recordURL)
this.formObj = this.$resetFields(this.formObj)
this.entrustId = entrustId
this.clientList = clientInfo
this._classTree()
this.showModal = true
this.itemIds = ids
this.formObj.businessTypeList = 0
this._page()
this.selectData = []
this._hideLoading()
count = 0
},
_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)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'singleSelect':
this.selectData = [data]
break
case 'dbSelect':
this.selectData = [data]
this._ok()
break
case 'changeSize':
this._page()
break
}
},
_ok() {
if (this.selectData.length === 0) {
this.$Message.warning('请选择一个原始记录模板!')
this._hideLoading()
} else {
console.log(this.selectData)
// 校验多样品多项目原始记录模板
this._createOriginalRecord()
}
},
_check: async function(param) {
const result = await soilTest.checkLimit(param)
console.log(result)
},
_createOriginalRecord() {
this.showModal = false
console.log('环境', process.env.NODE_ENV)
let recordUrl = ''
if (process.env.NODE_ENV === 'production') {
recordUrl = 'http://record.patzn.com'
} else {
recordUrl = Global.recordURL
}
const url =
recordUrl + '/print/v1/eln/template_meter_' + this.selectData[0].id
const params = {
ids: this.itemIds.join(','),
client: this.clientList[0]
}
this.$refs.iframeModal._createIframe(url, params)
console.log('原始记录', url, params)
localStorage.setItem('recordStatus', 'addLabRecord')
},
_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') {
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)
})
}
console.log('保存的数据', tempData)
if (tempData.formId !== undefined) {
tempData.entrustId = this.entrustId
this._save(tempData)
}
}
}
count = count + 1
}
}
}
}
</script>
<template>
<div>
<TwoColumnPage>
<template slot="left">
<ItemLeftList ref="leftModal" @on-result-change="_leftResult"></ItemLeftList>
</template>
<template slot="right">
<ItemRightList ref="rightModal" @on-result-change="_rightResult"></ItemRightList>
</template>
</TwoColumnPage>
</div>
</template>
<script>
import TwoColumnPage from '../../../../components/base/TwoColumnPage'
import ItemLeftList from './RecordLeftList'
import ItemRightList from './RecordRightList'
export default {
components: {
TwoColumnPage,
ItemLeftList,
ItemRightList
},
data() {
return {
id: ''
}
},
methods: {
_leftResult(data) {
console.log('ItemTabs', data)
this.$refs.rightModal._open(this.id, data)
},
_rightResult() {
this.$refs.leftModal._page()
},
_open(id) {
this.id = id
console.log(id)
this.$refs.leftModal._open(this.id)
},
_clearTable() {
this.$refs.rightModal._clearAll()
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-item-left" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="检测项目:">
<Input v-model="formObj.name" @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 @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :isRadio="true" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :hide-checkbox="true" select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<span v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
formObj: {
name: undefined
},
tableName: 'food-task-assign-item-left',
// 用户自己选中的列
userColumns: [],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
],
getPage: {},
id: '',
pageColumns: [
{ title: '检测项目', key: 'name', width: 120 },
{ title: '检测方法', key: 'testMethod', width: 140 },
{ title: '检测依据名称', key: 'testBasisName', width: 200 }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
_modalResult() {
if (this.currentComponent === 'AutoAssignModal') {
this._formSearch()
}
},
_selInputResult1(msg, data) {
switch (msg) {
case 'search':
this._formSearch()
break
}
},
_open(id) {
this.id = id
this._page()
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.id
const result = await soilTest.pagePrepareByExp(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
console.log(msg, data)
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodItem.page
break
case 'selectData':
this.$emit('on-result-change', data)
break
case 'singleSelect':
this.$emit('on-result-change', data)
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_btnClick(msg) {
switch (msg) {
case '自动分配':
this._autoAssign()
break
}
},
_autoAssign() {
console.log('自动分配')
}
}
}
</script>
......@@ -371,7 +371,9 @@ export default {
this.$message.warning('请至少选择一条数据')
} else {
const errorInfo = []
const clientInfo = []
for (let i = 0; i < this.selectData.length; i++) {
clientInfo.push(this.selectData[i].client)
console.log(this.selectData[i].recorded)
if (this.selectData[i].recorded === '是') {
errorInfo.push(this.selectData[i].index + 1)
......@@ -381,7 +383,11 @@ export default {
this.$Message.warning('所选数据中有已填写原始记录的')
} else {
console.log('打开填写原始记录界面')
this.$refs.recordModal._open(this.selectIds, this.entrustId)
this.$refs.recordModal._open(
this.selectIds,
this.entrustId,
clientInfo
)
}
}
},
......
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