Commit 7b7fc2e8 by lichengming

修改了试样检测

parent 5a105f4a
......@@ -19,5 +19,7 @@ export default {
pageAllot: data =>
http.post('soil/v1/experiment/page_allot', data).then(res => res),
pageExpTest: data =>
http.post('soil/v1/entrust/page_exp_test', data).then(res => res)
http.post('soil/v1/entrust/page_exp_test', data).then(res => res),
samplePage: data => http.post('soil/v1/sample/page', data).then(res => res),
pageItem: data => http.post('soil/v1/experiment/page', data).then(res => res)
}
......@@ -129,13 +129,6 @@ export default {
selectData: {},
getPage: {},
pageColumns: [
{
title: '样品编号',
key: 'num',
width: 180,
detail: true,
fixed: 'left'
},
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
......
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @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 :msg="btn" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<span v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<div v-else-if="item.type">{{scope.row[item.key] === 0 ? '企业':scope.row[item.key] ===
1?'政府':scope.row[item.key] === 2?'食品类抽样单': ''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<Operation ref="operation"></Operation>
<dataEntry ref="sampleManageModal" @on-result-change="_page"></dataEntry>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
import dataEntry from './tabs/dataEntry'
export default {
components: {
UserInfo,
Operation,
dataEntry
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 }
],
searchOpen: false,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
this._page()
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_editModal(id, type, name) {
this.$refs.sampleManageModal._open(id, type, name)
},
_editModals(res, data) {
if (res === '登记协议') {
this.$refs.editModal._open(res, data)
} else if (res === '编辑协议') {
this.$store
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'contractId')
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @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 :msg="btn" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<span v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<div v-else-if="item.type">{{scope.row[item.key] === 0 ? '企业':scope.row[item.key] ===
1?'政府':scope.row[item.key] === 2?'食品类抽样单': ''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<Operation ref="operation"></Operation>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
export default {
components: {
UserInfo,
Operation
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 }
],
searchOpen: false,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
this._page()
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_editModal(id, type, name) {
this.$refs.sampleManageModal._open(id, type, name)
},
_editModals(res, data) {
if (res === '登记协议') {
this.$refs.editModal._open(res, data)
} else if (res === '编辑协议') {
this.$store
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'contractId')
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @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 :msg="btn" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<span v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<div v-else-if="item.type">{{scope.row[item.key] === 0 ? '企业':scope.row[item.key] ===
1?'政府':scope.row[item.key] === 2?'食品类抽样单': ''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="数据录入" name="wait">
<SampleBackupsManage ref="waitTabs"></SampleBackupsManage>
</el-tab-pane>
<el-tab-pane label="录入历史" name="query">
<SampleBackupsQuery ref="queryTabs"></SampleBackupsQuery>
</el-tab-pane>
</el-tabs>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<SampleManage ref="sampleManageModal" @on-result-change="_page"></SampleManage>
<ItemManage ref="itemManageModal" @on-result-change="_page"></ItemManage>
<Operation ref="operation"></Operation>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
import SampleBackupsManage from './TestInput'
import SampleBackupsQuery from './TestInputHis'
export default {
components: {
UserInfo,
Operation
SampleBackupsManage,
SampleBackupsQuery
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 }
],
searchOpen: false,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
activeName: 'wait'
}
},
mounted() {
this._page()
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
this.activeName = 'wait'
this.$refs.waitTabs._page()
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
_changeTabs(tab, event) {
if (tab.name === 'wait') {
this.$refs.waitTabs._page()
} else if (tab.name === 'applyRecord') {
// this.$refs.applyRecordTabs._page()
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_editModal(id, type, name) {
this.$refs.sampleManageModal._open(id, type, name)
},
_editModals(res, data) {
if (res === '登记协议') {
this.$refs.editModal._open(res, data)
} else if (res === '编辑协议') {
this.$store
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
this.$refs.queryTabs._page()
}
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'contractId')
}
}
}
......
<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"
>
</el-table-column>
</element-table>
</Col>
</Row>
<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 {
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: '填写检测值' },
{ 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: '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>
<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 {
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.samplePage(
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>
......@@ -6,10 +6,10 @@
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按项目分配" name="waitReceive">
<WaitReceive ref="waitReceiveModal" @on-result-change="_search"></WaitReceive>
<WaitReceive ref="waitReceiveModal"></WaitReceive>
</el-tab-pane>
<el-tab-pane label="按样品分配" name="waitScan">
<WaitScan ref="waitScanModal" @-result-change="_search"></WaitScan>
<WaitScan ref="waitScanModal"></WaitScan>
</el-tab-pane>
</el-tabs>
</div>
......@@ -38,12 +38,6 @@ export default {
}
},
methods: {
_initTab() {
if (this.$showBtn('food-wait-Issue-sample')) {
this.activeName = 'waitScan'
this._waitSend()
}
},
_open(contractId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
......
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