Commit 4be57a60 by lichengming

修改了试样检测页面

parent e1f58483
<template>
<div>
<Modal v-model="showBackModal" :mask-closable="false" class="zIndex-1100">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<Form id="contract-back-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90">
<Form-item label="判定结果:" prop="singleJudge">
<RadioGroup v-model="formObj.singleJudge">
<Radio :label="'PASS'">
合格
</Radio>
<Radio :label="'FAIL'">
不合格
</Radio>
<Radio :label="'NO_TEST'">
不检测
</Radio>
<Radio :label="'NO_JUDGE'">
不判定
</Radio>
</RadioGroup>
</Form-item>
</Form>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
/**
* 判定
*/
import { soilTest } from '../../../api'
export default {
components: {},
data() {
return {
ids: [], // 合同ids
modalTitle: '判定',
showBackModal: false,
formObj: {
singleJudge: 'PASS'
},
path: '',
ruleValidate: {
singleJudge: [
{ required: true, message: '判定结果不能为空', trigger: 'blur' }
]
},
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
]
}
},
methods: {
_open(ids) {
this.ids = ids // 合同id
this.showBackModal = true
this.formObj.singleJudge = 'PASS'
this._hideLoading()
},
_cancel() {
this.showBackModal = false
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_resultChange(result, msg) {
if (result) {
this.showBackModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
}
this._hideLoading()
},
_save: async function(data) {
const result = await soilTest.handJudge(data)
this._resultChange(result, '操作成功')
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
data.singleJudge = this.formObj.singleJudge
data.itemIds = this.ids.join(',')
this._save(data)
} else {
this.$Message.error('表单验证失败')
this._hideLoading()
}
})
}
}
}
</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
*/
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) {
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() {
const data = {}
data.businessTypeList = this.businessTypeList
if (this.key) {
data.name = this.key
}
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>
......@@ -80,6 +80,8 @@ export default {
}
},
_search() {
this.$refs.waitReceiveModal._clearTable()
this.$refs.waitScanModal._clearTable()
this.$emit('on-result-change')
},
// 关闭弹框的时候刷新上个界面
......
<template>
<div>
<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">
<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 OriginalRecordClassTree from './OriginalRecordClassTree'
let count = 0
export default {
components: {
OriginalRecordClassTree,
TwoCard
},
data() {
return {
showModal: false,
getPage: {},
pageColumns: [{ title: '名称', key: 'title' }],
formObj: {
id: '',
title: '',
businessTypeList: 0
},
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('', 345)
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) {
this.formObj = this.$resetFields(this.formObj)
this._classTree()
this.showModal = true
this.itemIds = ids
this.formObj.businessTypeList = 0
this._page()
this.selectData = []
this._hideLoading()
count = 0
},
_page() {
// 只查实验室的
console.log('page')
// this.$refs.pageTable._page(
// '',
// 'ElnTemplate/page',
// this.$serializeFormSearch(this.formObj)
// )
},
_search() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectData = []
this.getPage = this.$store.state.ElnTemplate.page
break
case 'radioSelect':
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 {
// 校验多样品多项目原始记录模板
const param = {
ids: this.itemIds.join(','),
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()
}
})
}
},
// 生成原始记录
_bindOriginalRecord() {
this.$store
.dispatch('EnvItem/allCommonSampleCount', {
ids: this.itemIds.join(',')
})
.then(() => {
const result = this.$store.state.EnvItem.list
let allSampleCount = ''
let normalSampleCount = ''
let itemCount = ''
let parallel = ''
let labelSample = ''
result.forEach(item => {
if (item.sampleCountType === 'all') {
allSampleCount = item.sampleCountInteger
} else if (item.sampleCountType === 'normal') {
normalSampleCount = item.sampleCountInteger
} else if (item.sampleCountType === 'item') {
itemCount = item.sampleCountInteger
} else if (item.sampleCountType === 'parallel') {
parallel = item.sampleCountInteger
} else if (item.sampleCountType === 'mark') {
labelSample = item.sampleCountInteger
}
})
this.showModal = false
const url =
Global.recordURL +
'/print/v1/eln/template_YT_' +
this.selectData[0].id
const params = {
ids: this.itemIds.join(','),
allSampleCount: allSampleCount,
normalSampleCount: normalSampleCount,
itemCount: itemCount,
parallelCount: parallel,
labelSample: labelSample
}
this.$refs.iframeModal._createIframe(url, params)
localStorage.setItem('recordStatus', 'addLabRecord')
// this.$layx('recordAddTemplate', '原始记录添加', Global.recordURL + '/print/v1/eln/template_YT_'
// + this.selectData[0].id
// + '?bindUri=' + encodeURIComponent(bindUri))
})
},
_recordChange() {
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
}
}
}
}
</script>
......@@ -70,14 +70,12 @@
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
import dataEntry from './dataEntry'
import SampleManage from './SampleManage'
export default {
components: {
UserInfo,
Operation,
// eslint-disable-next-line vue/no-unused-components
dataEntry,
SampleManage
},
data() {
......
<template>
<div>
<Modal v-model="showModal" width="1000">
<p slot="header">
{{ modalTitle }}
</p>
<Row>
<!--查询-->
<Col span="24">
<Form
v-show="searchOpen"
:label-width="70"
inline
onsubmit="return false"
class="search-form"
>
<label class="label-sign" />
<Form-item class="search-item" label="样本号:">
<Input v-model="formObj.sampleCode" @on-enter="_formSearch" placeholder="请输入样本号" clearable />
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入样品名称" clearable />
</Form-item>
<!-- <Form-item label="检测类型:" class="search-item" prop="category">-->
<!-- <Input v-model="formObj.category" placeholder="请输入检测类型" clearable @on-enter="_formSearch" />-->
<!-- </Form-item>-->
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" show-search-btn="true" style="height: 30px;" />
</Col>
<!--table-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<!-- <template v-if="item.dateTime">-->
<!-- {{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):'' }}-->
<!-- </template>-->
<template v-if="item.status">
{{ scope.row[item.key] === undefined ? '': scope.row[item.key].display }}
</template>
<template v-else-if="item.key==='sampleType'">
<span v-if="scope.row[item.key]==='HY'">
化学药品
</span>
<span v-else-if="scope.row[item.key]==='HG'">
有机化工品
</span>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
<template v-else-if="item.key === 'allInput'">
{{ scope.row[item.key]?scope.row[item.key] === "f" ? '未全部录入': '已全部录入':'' }}
</template>
<template v-else-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</template>
<template v-else>
{{ scope.row[item.key] }}
</template>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<fillResult ref="resultModal" @on-result-change="_formSearch" />
</Modal>
</div>
</template>
<script>
import { soilTest } from '../../../api'
import fillResult from './fillResult'
export default {
components: { fillResult },
data() {
return {
formId: 'dataEntry',
modalTitle: '管理样品',
searchOpen: true,
showModal: false,
formObj: {
sampleCode: '',
name: '',
category: ''
},
btn: [
// { type: 'primary', id: '', name: '提交至复核' }
],
selectIds: [],
pageColumns: [
{ title: '试样编号', key: 'sampleCode', fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth' },
{ title: '土质描述', key: 'sampleDescribe' },
{ title: '样品包装类型', key: 'samplePack' },
{ title: '现场编号', key: 'siteNo' }
// { title: '录入时间', key: '', dateTime: true }
],
getPage: {},
iconMsg: [
{ type: 'md-create', id: '', name: '填写结果' },
{ type: 'md-clock', id: '', name: '操作日志' }
],
typeList: [
{ value: 'ORIGINAL', label: '进场原料' },
{ value: 'OTHER', label: '其他原料' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 305)
} else {
return this.$tableHeight('', 261)
}
}
},
methods: {
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_open(id) {
this.showModal = true
this._page(id)
},
_page: async function(id) {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = id
const result = await soilTest.pageExpTestSample(
this.$serializeForm(this.formObj)
)
if (result) {
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_searchParams(formId) {
return this.$refs.pageTable._searchParams(formId)
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'page':
this._page()
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
// case 'selectIds':
// this.selectIds = data
// break
}
},
_btnClick(msg) {
switch (msg) {
case '提交至复核':
this._submitToCheck()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_submitToCheck() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定提交至复核?',
onOk: async () => {
const result = await soilTest.submitForReview(this.selectIds)
if (result) {
this.$Message.success('提交成功')
this._page()
}
}
})
}
},
_iconClick(res, data) {
switch (res) {
case '操作日志':
this._record(data.id)
break
case '填写结果':
this._fillResult(data.id)
break
}
},
_fillResult(id) {
this.$refs.resultModal._open(id)
},
// 操作日志
_record(id) {
this.$refs.recordModal._open(id)
}
}
}
</script>
<template>
<div>
<Modal v-model="fillSampleModal" :mask-closable="false" :styles="{marginTop:'-90px'}" @on-cancel="_cancel" width="1250">
<p slot="header">
填写结果
</p>
<Row>
<!--查询-->
<Col span="24">
<Form v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign" />
<Form-item class="search-item" label="检测项目:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入检测项目" clearable />
<input v-model="formObj.sampleId" type="hidden">
</Form-item>
<Form-item label="检测类型:" class="search-item" prop="type">
<Input v-model="formObj.type" @on-enter="_formSearch" placeholder="请输入检测类型" clearable />
<!--<el-select v-model="formObj.type" placeholder="请输入检测类型" size="small" style="width:100%">-->
<!--<el-option-->
<!--v-for="item in typeList"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"-->
<!--/>-->
<!--</el-select>-->
</Form-item>
<Form-item class="search-item" label="检测人:">
<Input v-model="formObj.mobile" @on-enter="_formSearch" placeholder="请输入检测人" clearable />
</Form-item>
<Form-item class="search-item" label="分配时间:">
<Date-picker
:editable="false"
@on-change="_assignDateChange"
type="daterange"
split-panels
style="width:100%;"
placeholder="请选择分配时间"
/>
<input v-model="formObj.assignDateBegin" type="hidden" name="assignDateBegin">
<input v-model="formObj.assignDateEnd" type="hidden" name="assignDateEnd">
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<Button @click="_submit" style="margin-bottom: 5px" type="primary">
确认
</Button>
<Button @click="_judge" style="margin-bottom: 5px" type="primary">
判定
</Button>
<Button @click="_detectionValue" style="margin-bottom: 5px" type="primary">
填写检测值
</Button>
<!-- <Button @click="_selectEquipmentByIds" style="margin-bottom: 5px" type="primary">-->
<!-- 选择仪器设备-->
<!-- </Button>-->
</Col>
<!-- 表格 -->
<Col span="24">
<element-table
ref="pageTable"
:get-page="getPage"
:table-height="tableHeight"
@on-result-change="_tableResultChange"
warn-key="manualJudge"
is-data-input
select-data
show-check-box
>
<el-table-column
v-for="item in pageColumns"
:key="item.id"
:prop="item.key"
:label="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
show-overflow-tooltip
>
<template slot-scope="scope">
<span
v-if="item.key==='testValue'"
@click.stop="_handleRow(scope)"
>
<el-input
v-model="scope.row.testValue"
@blur="_handleTestValueEdit(scope.row.id,scope.row.testValue)"
size="medium"
placeholder="请输入检测结果"
/>
</span>
<span v-else-if="item.date">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):'' }}
</span>
<span v-else-if="item.key==='status'">
{{ scope.row[item.key]===undefined?'':scope.row[item.key].display }}
</span>
<span v-else-if="item.key==='singleJudge'">
{{ scope.row[item.key]===undefined?'':scope.row[item.key].display }}
</span>
<span v-else-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</span>
<span v-else-if="item.key==='recordWriiten'">
{{ scope.row[item.key]==='t'?'是':'否' }}
</span>
<span v-else>{{ scope.row[item.key] }}</span>
</template>
</el-table-column>
<el-table-column
:width="120"
label="操作"
align="center"
fixed="right"
>
<icon-list :msg="iconMsgDised" @on-result-change="_iconClick"></icon-list>
</el-table-column>
</element-table>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
<!--判定-->
<Judge ref="judgeModal" @on-result-change="_page" />
<!--填写检测值-->
<fillTestValue ref="valueModal" @on-result-change="_page"></fillTestValue>
</div>
</template>
<script>
import { soilTest } from '../../../api'
import fillTestValue from './fillTestValue'
import Judge from './Judge'
export default {
components: { fillTestValue, Judge },
data() {
return {
formObj: {
name: '',
type: '',
sampleId: '',
assignDateBegin: '',
assignDateEnd: ''
},
typeList: [
{ label: '进场原料', value: 'ORIGINAL' },
{ label: '其他报检', value: 'OTHER' }
],
searchOpen: false,
btn: [
{ type: 'primary', id: '', name: '确认' },
{ type: 'primary', id: '', name: '判定' },
{ type: 'primary', id: '', name: '填写检测值' }
],
footerList: [
{ id: '', type: '', name: '取消' },
{ id: '', type: 'primary', name: '确定' }
],
currentRow: {},
fillSampleModal: false,
getPage: {},
pageColumns: [
{ title: '试验名称', key: 'name', width: 160 },
{ title: '试验项目英文简写', key: 'shortName', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType' },
{ title: '检测结果', key: 'testValue', width: 160 },
{ title: '限值', key: 'limitValue', width: 130 },
{ title: '比较符', key: 'compareSymbol', width: 160 },
{ title: '单位', key: 'unit', width: 100 },
{
title: '判定结果',
key: 'singleJudge',
width: 140,
singleJudge: true
},
{ title: '检测依据', key: 'testBasis', width: 180 },
{ title: '试验方法', key: 'testMethod', width: 180 },
{ title: '状态', key: 'status', width: 180 }
],
iconMsg: [
{
type: 'pt-a-original',
id: '',
name: '查看原始记录',
disabled: true
},
{ type: 'pt-a-submit', id: '', name: '确认' }
],
iconMsged: [
{
type: 'pt-a-original',
id: '',
name: '查看原始记录'
},
{ type: 'pt-a-submit', id: '', name: '确认' }
],
iconMsgOtherT: [{ type: 'pt-a-submit', id: '', name: '确认' }],
iconMsgOtherF: [{ type: 'pt-a-submit', id: '', name: '确认' }],
iconMsgDis: [{ type: 'pt-a-submit', id: '', name: '确认' }],
iconMsgDised: [
{ type: 'pt-a-cloud', id: '', name: '上传附件' },
{ type: 'pt-a-submit', id: '', name: '确认' }
],
selectIds: [],
selectData: [],
status: true,
singleStatus: false,
proStatus: false,
original: false
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 294)
} else {
return this.$tableHeight('search')
}
}
},
methods: {
_fileResult(msg, data) {
switch (msg) {
case 'file-page':
this.$refs.FileManage._openFile(data)
break
case 'delete-page':
this.$refs.FileManage._delItemPage('', data)
break
case 'success':
this.$Message.success('删除成功!')
this.$refs.FileManage._pageItem()
break
default:
this.$refs.FileManage._pageItem()
}
},
// 分配时间
_assignDateChange(data) {
this.formObj.assignDateBegin = data[0]
this.formObj.assignDateEnd = data[1]
},
_footerResult(msg, data) {
switch (msg) {
case '取消':
this._cancel()
break
case '确定':
this._cancel()
break
}
},
_cancel() {
this.$emit('on-result-change')
this.fillSampleModal = false
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open(id) {
this.formObj.sampleId = id
this._page()
this.fillSampleModal = true
this._hideLoading()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilTest.pageItem(this.$serializeForm(this.formObj))
if (result) {
this.getPage = result
this.$refs.pageTable._initTable()
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'selectData':
this._selectData(data)
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
}
},
_selectData(data) {
this.status = true
this.original = false
const selectIds = []
this.selectData = data
data.forEach(v => {
if (
v.status.display === '已录入' ||
v.status.display === '取制样录入' ||
v.status.display === '取制样偏离申请中' ||
v.status.display === '取制样偏离驳回' ||
v.status.display === '偏离驳回' ||
v.status.display === '偏离申请中'
) {
this.status = false
}
if (v.recordWriiten === 't') {
this.original = true
}
selectIds.push(v.id)
})
this.selectIds = selectIds
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 追填原始记录 回调
_resultRecord() {
this._formSearch()
this.$emit('on-result-change')
},
_btnClick(msg) {
switch (msg) {
case '判定':
this._judge()
break
case '填写检测值':
this._detectionValue()
break
case '确认':
this._submit()
break
case '选择原始记录模板':
this._changeOriginalRecord()
break
case '追填原始记录':
this._appendOriginalRecord()
break
case '选择仪器设备':
this._selectEquipmentByIds()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
// 选择原始记录模板
_changeOriginalRecord() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else if (this.original && this.status) {
this.$Message.warning('已有原始记录模板,不可以再次选择!')
} else if (this.status) {
this.$refs.originalModal._open(ids, this.selectData)
} else {
this.$Message.warning('选择的数据已经提交,请发起偏离申请后再修改!')
}
},
_originalRecordModelResult(data) {
if (data) {
this.$refs.itemOriginalRecordModal._open(
this.selectIds,
data.modelId.id,
data.dataSource
)
} else {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this._appendOriginalRecord()
}
}
},
// 追填原始记录
_appendOriginalRecord() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else if (!this.original && this.status) {
this.$Message.warning('未填写过原始记录,请先选择模板!')
} else if (this.status) {
this.$refs.appendOriginalRecordModal._open(ids)
} else {
this.$Message.warning('选择的数据已经提交,请发起偏离申请后再修改!')
}
},
// 选择追填原始记录
_appendOriginalRecordModalResult(data) {
this.$refs.itemAppendOriginalRecordModal._open(
this.selectIds,
data.recordId
)
},
// 批量确认
_submit() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定该操作?',
onOk: async () => {
this.selectIds = []
for (let i = 0; i < this.selectData.length; i++) {
this.selectIds.push(this.selectData[i].id)
}
const result = await soilTest.bathConfirmItem(this.selectIds)
if (result) {
this.$Message.success('提交成功')
this.selectIds = []
this._page()
}
}
})
}
},
_submitById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定该操作?',
onOk: async () => {
const result = await soilTest.bathConfirmItem(id)
if (result) {
this.$Message.success('提交成功')
this._page()
}
}
})
},
// 批量判定
_judge() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.selectIds = []
for (let i = 0; i < this.selectData.length; i++) {
this.selectIds.push(this.selectData[i].id)
}
this.$refs.judgeModal._open(this.selectIds)
}
},
// 批量填写检测值
_detectionValue() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else if (this.status) {
this.selectIds = []
for (let i = 0; i < this.selectData.length; i++) {
this.selectIds.push(this.selectData[i].id)
}
this.$refs.valueModal._open(this.selectIds)
} else {
this.$Message.warning('您选择状态不可填写检测结果,请重新选择!')
}
},
// 批量选择仪器设备
_selectEquipmentByIds() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this._selectEquipment(ids)
}
},
_iconClick(res, data) {
switch (res) {
case '查看原始记录':
this._itemOriginalRecordLook(data, 'only')
break
case '编辑原始记录':
this._itemOriginalRecordLook(data, 'write')
break
case '上传附件':
this._upload(data.id)
break
case '确认':
this._submitById(data.id)
break
case '偏离申请':
this._skewingApply(data)
break
case '查看仪器设备':
this._checkEquipment(data.id)
break
}
},
_upload(id) {
console.log(id)
// 上传文件
const tempData = {
id: id,
uploadFileUrl: '/v1/item_annex/upload/',
downloadFileUrl: '/v1/item_annex/download/'
}
this.$refs.FileManage._open(tempData, 'itemId')
// this.$refs.FileManage._open(id, 'contractId')
},
// 查看仪器
_checkEquipment(id) {
this.$refs.detailModal._open(id)
},
// 查看原始记录
_itemOriginalRecordLook(data, name) {
if (
data.recordId === null ||
undefined === data.recordId ||
data.recordId === ''
) {
this.$Message.warning('该检测项目暂无原始记录!')
} else {
this.$refs.itemOriginalRecordLookModal._open(
data.recordId,
name,
data.id
)
}
},
// 选择仪器设备
_selectEquipment(ids) {
this.$refs.selectEquipItemModal._open(ids)
},
_skewingApply(data) {
this.$refs.applyModal._open(data)
},
// 操作的序号
_handleRow(data) {
this.currentRow = data.row
},
// 单个填写检测值
_handleTestValueEdit: async function(id, testValue) {
if (testValue !== '' && undefined !== testValue) {
const data = {}
data.itemIds = id
data.testValue = testValue
const result = await soilTest.testValue(data)
if (result) {
this.$Message.success('保存成功')
this._page()
} else {
this.$Message.error('保存失败')
}
}
},
_handleOrderByValueEdit: async function(id, orderBy) {
if (orderBy !== '' && undefined !== orderBy) {
const data = {}
data.itemIds = id
data.orderBy = orderBy
const result = await soilTest.orderByChange(data)
if (result) {
this._page()
} else {
this.$Message.error('保存失败')
}
}
}
}
}
</script>
<template>
<Modal v-model="detectionModal" :mask-closable="false" width="400">
<p slot="header">
填写检测值
</p>
<Form
id="edit-form"
ref="formObj"
:model="formObj"
:rules="ruleValidate"
:label-width="80"
onsubmit="return false"
inline
>
<Form-item label="检测结果" prop="testValue" style="width: 100%;">
<Input v-model="formObj.testValue" name="testValue" placeholder="请填写检测结果值" />
</Form-item>
</Form>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</template>
<script>
import { soilTest } from '../../../api'
const defVal = {
testValue: ''
}
export default {
name: 'DetectionValue',
data() {
return {
detectionModal: false,
formObj: defVal,
ruleValidate: {
testValue: [
{ required: true, message: '检测结果值不能为空!', trigger: 'blur' }
]
},
footerList: [
{ id: '', type: '', name: '取消' },
{ id: '', type: 'primary', name: '保存' }
],
selectIds: []
}
},
methods: {
_open(ids) {
this.detectionModal = true
this.$refs.formObj.resetFields()
this.formObj = Object.assign({}, {}, defVal)
this._hideLoading()
this.selectIds = ids
},
_footerResult(msg) {
switch (msg) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_ok(msg) {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
data.itemIds = this.selectIds.join(',')
data.testValue = this.formObj.testValue
this._save(data)
} else {
this.$Message.error('表单验证失败')
this._hideLoading()
}
})
},
_cancel() {
this.detectionModal = false
},
_resultChange(result, msg) {
if (result) {
this.detectionModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
}
this._hideLoading()
},
_save: async function(data) {
const result = await soilTest.testValue(data)
this._resultChange(result, '提交成功')
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
}
}
}
</script>
<style scoped>
</style>
......@@ -47,14 +47,16 @@
</Col>
</Row>
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
<SelectOriTempRecord ref="recordModal" @on-result-change="_page"></SelectOriTempRecord>
</div>
</template>
<script>
import Global from '../../../../api/config'
import { soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/AssignPerson'
import SelectOriTempRecord from '../SelectOriTempRecord'
export default {
components: { AssignPerson },
components: { AssignPerson, SelectOriTempRecord },
data() {
return {
// 定义表格名称----英文
......@@ -270,6 +272,9 @@ export default {
case '试验项目分配':
this._userAssign()
break
case '填写原始记录':
this._addRecord()
break
case '按组分配':
await this._reportDueDate()
await this._groupAssign()
......@@ -295,6 +300,14 @@ export default {
break
}
},
_addRecord() {
if (this.selectIds.length === 0) {
this.$message.warning('请至少选择一条数据')
} else {
console.log('打开填写原始记录界面')
this.$refs.recordModal._open(this.selectIds)
}
},
_allotByPerson() {
const user = Global.getUserInfo('userInfo')
this.$refs.personModal._openGoupByUserId('分配人员', user.id, 'itemTree')
......@@ -554,6 +567,10 @@ export default {
}
this.$refs.refModal._open(data.sampleId)
})
},
_clearAll() {
this.getPage.records = []
this.selectIds = []
}
}
}
......
......@@ -39,6 +39,9 @@ export default {
console.log(id)
this.$refs.leftModal._open(this.id)
// this.$refs.rightModal._getColumn()
},
_clearTable() {
this.$refs.rightModal._clearAll()
}
}
}
......
......@@ -530,6 +530,10 @@ export default {
}
this.$refs.refModal._open(data.sampleId)
})
},
_clearAll() {
this.getPage.records = []
this.selectIds = []
}
}
}
......
......@@ -35,6 +35,9 @@ export default {
_open(id) {
this.$refs.SampleleftModal._open(id)
// this.$refs.rightModal._getColumn()
},
_clearTable() {
this.$refs.SamplerightModal._clearAll()
}
}
}
......
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