Commit e309d18b by wangweidong

土工试验Lims

parent addfc842
......@@ -15,8 +15,12 @@ export default {
http.post('soil/v1/entrust/page_review', data).then(res => res),
pageSampleReceive: data =>
http.post('soil/v1/entrust/page_sample_receive', data).then(res => res),
pageSampleReceiveHis: data =>
http.post('soil/v1/entrust/page_sample_receive_his', data).then(res => res),
pageSamplePrepare: data =>
http.post('soil/v1/entrust/page_sample_prepare', data).then(res => res),
pageSamplePrepareHis: data =>
http.post('soil/v1/entrust/page_sample_prepare_his', data).then(res => res),
getById: data => http.get('soil/v1/entrust/' + data).then(res => res),
getVOById: data => http.get('soil/v1/entrust/vo/' + data).then(res => res),
deleteById: data =>
......@@ -48,14 +52,20 @@ export default {
samplePage: data => http.post('soil/v1/sample/page', data).then(res => res),
pageReceive: data =>
http.post('soil/v1/sample/page_receive', data).then(res => res),
pageReceiveHis: data =>
http.post('soil/v1/sample/page_receive_his', data).then(res => res),
pageSend: data =>
http.post('soil/v1/sample/page_send', data).then(res => res),
pageSendHis: data =>
http.post('soil/v1/sample/page_send_his', data).then(res => res),
receiveSample: data =>
http.post('soil/v1/sample/receive_sample', data).then(res => res),
sendSample: data =>
http.post('soil/v1/sample/send_sample', data).then(res => res),
pagePrepare: data =>
http.post('soil/v1/sample/page_prepare', data).then(res => res),
pagePrepareHis: data =>
http.post('soil/v1/sample/page_prepare_his', data).then(res => res),
sampleEdit: data =>
http.put(
'soil/v1/sample/' + data.id + '?describeDetail=' + data.describeDetail
......
......@@ -9,28 +9,13 @@
<Row>
<!--查询-->
<Col span="24">
<Form id="search-sample-company" v-show="searchOpen" :label-width="80" inline onsubmit="return false">
<Form v-show="searchOpen" id="search-sample-company" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入样品名称" clearable />
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.sampleCode" @on-enter="_formSearch" placeholder="请输入样品编号" clearable />
<Input v-model="formObj.sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch" />
</Form-item>
<!-- <Form-item label="制单日期:" style="width: 25%">-->
<!-- <Date-picker-->
<!-- v-model="dateList"-->
<!-- type="daterange"-->
<!-- placeholder="制单日期"-->
<!-- format="yyyy-MM-dd"-->
<!-- :editable="false"-->
<!-- style="width:100%"-->
<!-- placement="bottom-end"-->
<!-- @on-change="_dateChange"-->
<!-- ></Date-picker>-->
<!-- </Form-item>-->
<Form-item class="search-btn">
<Button @click="_page" type="primary">
<Button type="primary" @click="_page">
搜索
</Button>
</Form-item>
......@@ -38,12 +23,12 @@
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list>
<btn-list :msg="btn" :open="searchOpen" class="contHide" show-search-btn="true" @on-result-change="_btnClick"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
:get-page="getPage" :icon-msg="iconMsg" select-data @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
......@@ -61,9 +46,6 @@
<div v-else-if="item.date">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):'' }}
</div>
<div v-else-if="item.key==='describeDetail'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.describeDetail" @change="_inputChange(scope.row)"></el-input>
</div>
<div v-else>
{{ scope.row[item.key] }}
</div>
......@@ -97,21 +79,11 @@ export default {
formId: 'soilSampleManage',
currentComponent: '',
btn: [
// {
// type: 'success',
// id: '',
// name: '试样制备'
// },
{
type: 'success',
id: 'ZBC',
name: '打印标签'
}
// {
// type: 'success',
// id: '',
// name: '批量填写土质描述详情'
// }
],
itemList: [],
indexList: [],
......@@ -127,7 +99,7 @@ export default {
}
// { type: 'md-trash', id: '', name: '删除' }
],
contractId: '', // 委托id
entrustId: '', // 委托id
showModal: false,
recordHis: false,
searchOpen: true,
......@@ -146,7 +118,7 @@ export default {
sampleId: '',
dateList: [],
formObj: {
name: undefined,
entrustId: undefined,
sampleCode: undefined
}
}
......@@ -302,7 +274,7 @@ export default {
}
},
_copyHisSample() {
this.$refs.refModal._open(this.contractId)
this.$refs.refModal._open(this.entrustId)
},
_iconClick(res, data, componentName, index) {
......@@ -369,8 +341,8 @@ export default {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.contractId = id // 委托id
console.log(this.contractId)
this.formObj.entrustId = id // 委托id
console.log(this.entrustId)
this.$refs.pageTable._hideLoading()
this._page()
},
......@@ -378,8 +350,8 @@ export default {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.contractId = id // 委托id
console.log(this.contractId)
this.formObj.entrustId = id // 委托id
console.log(this.entrustId)
this.$refs.pageTable._hideLoading()
this.recordHis = true
this._page()
......@@ -388,11 +360,7 @@ export default {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.contractId
const result = await soilEntrust.pagePrepare(
this.$serializeForm(this.formObj)
)
const result = await soilEntrust.pagePrepareHis(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
......@@ -438,7 +406,7 @@ export default {
this.$refs.sampleManageEdit._open(data)
} else {
// 添加
this.$refs.refModal._open('', this.contractId)
this.$refs.refModal._open('', this.entrustId)
}
},
// 添加编辑模拟样品
......@@ -446,10 +414,10 @@ export default {
if (edit) {
// 模拟样品的编辑
const tempData = JSON.parse(JSON.stringify(data)) // 深拷贝
this.$refs.imitateModal._open(tempData, this.contractId)
this.$refs.imitateModal._open(tempData, this.entrustId)
} else {
// 模拟样品的添加
this.$refs.imitateModal._open('', this.contractId)
this.$refs.imitateModal._open('', this.entrustId)
}
},
_search() {
......@@ -497,15 +465,6 @@ export default {
}
})
},
// 导入样品
_importSample() {
const data = {
importUrl: '/food/v1/sample/company/import_' + this.contractId,
downloadUrl: '/food/v1/excel/template/FoodSampleCompany',
title: '导入'
}
this.$refs.refModal._open(data)
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
......
......@@ -38,6 +38,9 @@
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<div v-else-if="item.status">
{{ scope.row[item.key].display }}
</div>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
......@@ -193,7 +196,7 @@ export default {
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.pageSamplePrepare(this.formObj)
const result = await soilEntrust.pageSamplePrepareHis(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
......
......@@ -6,49 +6,50 @@
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form-rel-sample" :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<Form v-show="searchOpen" id="search-form" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="样品编号:">
<Input @on-enter="_formSearch" v-model="formObj.num" name="num" placeholder="请输入样品编号" clearable></Input>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" placeholder="请输入委托编号" clearable @on-enter="_formSearch"></Input>
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable></Input>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" placeholder="请输入委托单位" clearable @on-enter="_formSearch"></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
<Button type="primary" @click="_formSearch">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
select-data>
:table-height="tableHeight"
: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"
: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.contractId,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<div v-else-if="item.sampleDetail"><a @click.stop="_sampleDetailModal(scope.row.id,scope.row.type)">{{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-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>
......@@ -59,30 +60,44 @@
</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>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
import http from '../../../api/http'
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilEntrust } from '../../../api'
import Operation from '../../../components/operation/Operation'
import SampleManage from './entrust-sample-manage/SampleManageHis'
import ItemManage from './ItemManage'
export default {
components: {
UserInfo
UserInfo,
SampleManage,
ItemManage,
Operation
},
data() {
return {
formObj: { num: undefined, name: undefined },
iconMsgDis: [],
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
// {
// type: 'md-create',
// id: '',
// name: '编辑'
// name: '编辑协议'
// },
{ type: 'md-cloud', id: '', name: '附件' },
// { type: 'md-trash', id: '', name: '删除' },
......@@ -92,82 +107,50 @@ export default {
name: '操作日志'
}
],
// 操作列
sampleFile: {
type: 'cloud',
id: '',
name: '样品附件',
componentName: 'FileManage'
},
sampleFileDis: {
type: 'cloud',
id: '',
name: '样品附件',
disabled: true
},
edit: {
type: 'compose',
id: 'rel-sample-receive-edit-sample',
name: '编辑'
},
del: {
type: 'trash-a',
id: 'rel-sample-receive-del-sample',
name: '删除'
},
copy: {
type: 'ios-copy',
id: 'rel-sample-receive-copy-sample',
name: '复制'
},
record: {
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'FoodSampleRecord'
},
sampleDownloadContract: {
type: 'share',
id: 'food-sample-receive-sample-download-contract',
name: '导出委托协议'
},
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '样品包装类型', key: 'samplePack', width: 160 },
{ title: '现场编号', key: 'siteNo', width: 130 }
{ 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: '接收并发放', componentName: '' }
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
selectData: [],
currentComponent: '',
printerVal: '', // 选择的打印机
standard: '',
stdList: [],
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 340)
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
// // 获取当前的执行标准下拉项
// this._getStdList()
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
},
methods: {
// 接收的返回保存
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
......@@ -177,453 +160,243 @@ export default {
sendData.personId = data.userId
}
switch (msg) {
case 'relReceiveSendMan':
case 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodSample/sampleReceiveSend', sendData)
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultSampleChange('接收并发放成功')
this._resultChange('一键接收并发放成功')
})
break
case 'relReceiveSendScanMan':
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 抽样日期
_makeDateChange(data) {
$('input[name=samplingDateBegin]').val(data[0])
$('input[name=samplingDateEnd]').val(data[1])
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
default:
this._page()
}
},
_btnClick(msg, currentComponent, formTypeObj) {
this.currentComponent = currentComponent
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg, formTypeObj)
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg, formTypeObj) {
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '扫码接收并发放':
// 根据字典判断是否选择人员
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open('relReceiveSendScanMan', '请选择领样人')
} else {
this.$refs.refModal._open('扫码接收发放')
}
break
case '接收并发放':
this._submitSend()
case '一键接收':
this._oneKeyReceive()
break
case '添加':
if (formTypeObj.uri === 'DLTB-contract-reg') {
this.currentComponent = 'FoodContractCompanyEditByDLTB'
} else if (formTypeObj.uri === 'HES-company-contract-reg') {
this.currentComponent = 'FoodContractCompanyEditByHES'
} else {
this.currentComponent = 'FoodContractCompanyEdit'
}
this.$nextTick(() => {
this.$refs.refModal._openReceive()
})
case '一键发放':
this._oneKeySend()
break
case '导入检测项目':
this._importItem()
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '导入检测项目包':
this._importItemPackage()
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '复制历史样品检测项目':
this._copyHisItem()
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '删除':
this._deleteSelected()
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '打印标签':
this._selectPrinter('print-label')
case '信息维护':
this._maintainInfo()
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条样品信息')
} else {
this._cusTomePrint()
}
case '登记协议':
this._editModals(msg)
break
}
},
// 1.自定义打印,除检样、备样、留样 增加制备标签,需要单独的查询制备标签的数据,
// 2.样品接收位置的制备用制备的的接口,将当前的保存方式置空,打印出来手动填写
_cusTomePrint() {
this.$store
.dispatch('FoodSample/preparationButton', {
sampleIds: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodSample.list
for (let i = 0; i < result.length; i++) {
// 样品制备保存方式
result[i].saveWay = ''
// 扫码接收并发放
_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, '请选择领样人')
}
// 样品的数据和制备样品的数据
this.$refs.refModal._open(this.selectData, result)
})
},
// 接收并发放
_submitSend() {
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
const data = {
ids: this.selectIds.join(',')
}
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 根据字典接收并发放
// 选择人员接收并发放
this.$store
.dispatch('FoodSample/submitReceiveSendCheck', data)
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodSample.success
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open('relReceiveSendMan', '请选择领样人')
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodSample/sampleReceiveSend', data)
.then(() => {
this._resultSampleChange('接收并发放成功')
})
}
}
},
_exportReceiveRecord() {
// 导出交接记录
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
/* this.$Modal.confirm({
title: '提示',
content: '确定导出所有记录?',
onOk: () => {
http.open('/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids);
}
}); */
} else {
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
// 单个删除
_deleteById(id) {
this._deleteByIds([id], '确定删除该条记录?')
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', ids).then(() => {
this._resultSampleChange('删除成功!')
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
}
.then(() => {
this._resultChange('一键接收并发放成功')
})
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
// 导入检测项目
_importItem() {
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_iconClick(res, data, currentComponent, rowIndex, obj) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
if (data.type === 0) {
// 企业--编辑的是委托和样品信息
this.$store
.dispatch('SysForm/getByBtnCode', obj.btnId)
.then(() => {
const result = this.$store.state.SysForm.list
if (result.length === 0) {
this.$store
.dispatch('FoodSample/companyPage', {
contractId: data.contractId
})
.then(() => {
const num = this.$store.state.FoodSample.companyPage
.total
if (num <= 1) {
// 无配置表单 委托的编辑界面
this.currentComponent = 'FoodContractCompanyEdit'
this.$nextTick(() => {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
} else {
// 样品的编辑界面
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
data.contractId,
'receive-his-wait'
)
})
})
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else if (
result.length === 1 &&
result[0].uri === 'DLTB-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByDLTB'
this.$nextTick(() => {
} else {
// 一键发放
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
} else if (
result.length === 1 &&
result[0].uri === 'HES-company-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByHES'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
this._resultChange('发放成功')
})
}
})
} else if (data.type === 1) {
// 政府--只是编辑样品信息
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
data.contractId,
'receive-his-wait'
)
})
})
} else {
// 粮油--只是编辑样品信息
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
data.contractId,
'receive-his-wait'
)
})
})
}
break
case '删除':
this._deleteById(data.id)
break
case '复制':
if (data.type === 0) {
// 企业--复制的是委托和样品信息
this.$store
.dispatch('SysForm/getByBtnCode', obj.btnId)
.then(() => {
const result = this.$store.state.SysForm.list
if (result.length === 0) {
// 无配置表单
this.currentComponent = 'FoodContractCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
})
} else if (
result.length === 1 &&
result[0].uri === 'DLTB-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByDLTB'
this.$nextTick(() => {
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
} else if (
result.length === 1 &&
result[0].uri === 'HES-company-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByHES'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
this._resultChange('接收成功')
})
}
})
} else if (data.type === 1) {
// 政府--只是复制样品信息
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
// 粮油--只是复制样品信息
this.currentComponent = 'FoodSampleGovernLYEdit'
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
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._operationRecord(data.id)
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '导出委托协议':
// this.$Modal.confirm({
// title: '提示',
// content: '确认要下载委托单?',
// onOk: () => {
// http.open('/food/v1/sample/export_sample_form?id=' + data.id);
// }
// });
this._downContractForm(data.id)
case '编辑协议':
this._editModals(res, data)
break
case '样品附件':
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_downContractForm(id) {
_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(
'ReportExport/getById',
'food-sample-receive-sample-download-contract'
)
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.ReportExport.model) {
if (this.$store.state.ReportExport.model.indexOf('?') !== -1) {
window.open(
this.$store.state.ReportExport.model + '&sampleId=' + id,
'_blank'
)
} else {
window.open(
this.$store.state.ReportExport.model + '?sampleId=' + id,
'_blank'
)
}
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.FoodSample.page
this.getPage = this.$store.state.FoodContract.page
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
......@@ -635,9 +408,8 @@ export default {
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log(this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.pageReceive(
const result = await soilEntrust.pageSampleReceiveHis(
this.$serializeForm(this.formObj)
)
if (result) {
......@@ -645,9 +417,9 @@ export default {
this.getPage = result
}
},
// 查看委托
_detailModal(contractId, type) {
this.$store.dispatch('FoodContract/getById', contractId).then(() => {
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
......@@ -660,34 +432,12 @@ export default {
})
})
},
// 查看样品
_sampleDetailModal(id, type) {
if (type === 0) {
// 政府
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store.dispatch('FoodSample/getByCompanyId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.companyModel)
})
})
} else {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
}
},
_editModal(id, type) {
this.$refs.refModal._open(id, type)
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.refModal._open(id)
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
......@@ -696,58 +446,9 @@ export default {
this.selectIds = []
}
},
_resultSampleChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'sampleId')
},
// 选择完打印机之后
_printerResult(data) {
// printModal 不能使用动态组件,否则第二次打不开,原因未知
switch (data.type) {
// 打印标签--直接打印
case 'print-label':
this.$refs.printModal._printOpen(this.selectData, data.printerVal)
break
}
},
// 选择打印机
_selectPrinter(msg) {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(msg)
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.standard = data
break
case 'query':
this.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
},
// 查询执行标准
_getStdList(data) {
const obj = Object.assign({}, this.$serialize('search-form-rel-sample'))
if (data) {
obj.standard = data
}
this.$store.dispatch('FoodSample/listReceiveStandard', obj).then(() => {
this.stdList = this.$store.state.FoodSample.list
})
this.$refs.FileManage._open(id, 'entrustId')
}
}
}
......
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="padding-bottom: 5px">
<Form v-show="searchOpen" id="search-wait-scan" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.sampleCode" name="sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch"></Input>
<input name="entrustId" type="hidden">
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide" @on-result-change="_btnClick">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:table-height="tableHeight"
:get-page="getPage"
select-data
@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">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.key ==='shape'">{{scope.row['shape']}} {{scope.row['shapeRemark']}}</div>
<div v-else-if="item.date">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
<!--选择领样人-->
</div>
</template>
<script>
import { soilEntrust } from '../../../../api'
export default {
components: {},
data() {
return {
btn: [],
selectIds: [],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '样品包装类型', key: 'samplePack', width: 160 },
{ title: '现场编号', key: 'siteNo', width: 130 }
],
iconMsg: [
{ type: 'md-create', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'SampleRecord'
},
{ type: 'cloud', id: '', name: '附件', componentName: 'FileManage' }
],
type: '',
entrustId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
sampleCode: undefined,
entrustId: undefined
},
searchOpen: true
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
} else {
}
return this.$tableHeight('tableModal')
}
},
mounted() {
// this._getStdList()
// 样品接收是否选择人员
// 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 'sampleSendMan':
// 发放
this.$store.dispatch('FoodSample/submitSend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'sampleScanSend':
// 扫码接收并发放
this.$refs.refModal._open('扫码发放', data)
break
}
},
_selectSampleLink(data) {
console.log(data)
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
case 'ReceiveScan':
// 扫码接收
this._searchTop()
break
default:
this._search()
}
},
_open(entrustId, type) {
this.formObj = this.$resetFields(this.formObj)
$('input[name=entrustId]').val(entrustId)
this.formObj.entrustId = entrustId
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
const result = await soilEntrust.pageSendHis(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '操作日志':
this.$refs.refModal._open(data.id)
break
case '删除':
this._deleteById(data.id)
break
}
})
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '打印标签':
this._selectPrinter('print-label')
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
this.selectIds = []
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.standard = data
break
case 'query':
this.formObj.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
}
}
}
</script>
......@@ -11,9 +11,6 @@
<el-tab-pane label="待发放样品" name="waitScan">
<WaitScan ref="waitScanModal" @-result-change="_search"></WaitScan>
</el-tab-pane>
<el-tab-pane label="已接样样品" name="alreadyIssued">
<AlreadyIssued ref="alreadyIssuedModal"></AlreadyIssued>
</el-tab-pane>
</el-tabs>
</div>
</Modal>
......@@ -21,13 +18,11 @@
</template>
<script>
import WaitReceive from './WaitReceive'
import AlreadyIssued from './AlreadyIssued'
import WaitScan from './WaitScan'
export default {
components: {
WaitReceive,
AlreadyIssued,
WaitScan
},
data() {
......
<template>
<div>
<Modal v-model="showSampleModal" @on-visible-change="_visibleChange" width="1200"
class="zIndex-900 modal-footer-none">
<p slot="header"> {{name}}--管理样品</p>
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="接收历史" name="waitReceive">
<WaitReceive ref="waitReceiveModal" @on-result-change="_search"></WaitReceive>
</el-tab-pane>
<el-tab-pane label="发放历史" name="waitScan">
<WaitScan ref="waitScanModal" @-result-change="_search"></WaitScan>
</el-tab-pane>
</el-tabs>
</div>
</Modal>
</div>
</template>
<script>
import WaitReceive from './WaitReceiveHis'
import WaitScan from './AlreadyIssuedHis'
export default {
components: {
WaitReceive,
WaitScan
},
data() {
return {
type: '',
entrustId: '', // 合同id
showSampleModal: false,
modalTitle: '',
selectIds: [],
activeName: 'waitReceive',
name: ''
}
},
methods: {
_initTab() {
if (this.$showBtn('food-wait-Issue-sample')) {
this.activeName = 'waitScan'
this._waitSend()
}
},
_open(entrustId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
this.showSampleModal = true
this.entrustId = entrustId // 合同id
this.activeName = 'waitReceive'
this.selectIds = []
this._waitPage()
},
// 待接收
_waitPage() {
this.$refs.waitReceiveModal._open(this.entrustId, this.type)
},
// 待发放
_waitSend() {
this.$refs.waitScanModal._open(this.entrustId, this.type)
},
// 已接收
_issuedPage() {
this.$refs.alreadyIssuedModal._open(this.entrustId, this.type)
},
_changeTabs(tab, event) {
if (tab.name === 'alreadyIssued') {
this._issuedPage()
} else if (tab.name === 'waitReceive') {
this._waitPage()
} else if (tab.name === 'waitScan') {
this._waitSend()
}
},
_search() {
this.$emit('on-result-change')
},
// 关闭弹框的时候刷新上个界面
_visibleChange(data) {
if (data === false) {
this._search()
}
}
}
}
</script>
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="padding-bottom: 5px">
<Form v-show="searchOpen" id="search-wait" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable @on-enter="_formSearch"></Input>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.sampleCode" name="sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch"></Input>
<input name="entrustId" type="hidden">
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide" @on-result-change="_btnClick">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:table-height="tableHeight"
:get-page="getPage"
:icon-msg="iconMsg"
select-data
@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">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.key ==='shape'">{{scope.row['shape']}} {{scope.row['shapeRemark']}}</div>
<div v-else-if="item.date">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
<!--选择领样人-->
<SampleReceiveModal ref="locationModal" @on-result-change="_page()"></SampleReceiveModal>
<SoilSampleItemManage ref="sampleItemManage" @on-result-change="_page"></SoilSampleItemManage>
</div>
</template>
<script>
import { soilEntrust } from '../../../../api'
import SampleReceiveModal from '../SampleReceiveModal'
import SoilSampleItemManage from './SoilSampleItemManage'
export default {
components: { SampleReceiveModal, SoilSampleItemManage },
data() {
return {
btn: [
// { type: 'primary', id: '', name: '收样室收样' }
],
selectIds: [],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '样品包装类型', key: 'samplePack', width: 160 },
{ title: '现场编号', key: 'siteNo', width: 130 }
],
iconMsg: [{ type: 'ios-list', id: '', name: '试验项目' }],
type: '',
contractId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
sampleCode: undefined,
name: undefined,
entrustId: ''
},
searchOpen: true,
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
} else {
}
return this.$tableHeight('tableModal')
}
},
mounted() {
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
// this._getStdList()
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(','),
contractId: this.contractId
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'sampleMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
_selectSampleLink(data) {
console.log(data)
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
case 'ReceiveScan':
// 扫码接收
this._searchTop()
break
default:
this._search()
}
},
_open(entrustId, type) {
console.log('待接收样品')
this.formObj = this.$resetFields(this.formObj)
$('input[name=entrustId]').val(entrustId)
this.formObj.entrustId = entrustId
this.selectIds = []
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
const result = await soilEntrust.pageReceiveHis(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '试验项目':
this._itemManage(data.id)
break
case '复制':
this._copySample(data)
break
case '操作日志':
this.$refs.refModal._open(data.id)
break
case '删除':
this._deleteById(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_itemManage(data) {
// 管理检测项目
if (this.recordHis) {
this.$refs.sampleItemManage._openRecord(data)
} else {
this.$refs.sampleItemManage._open(data)
}
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '添加':
this._editModal(false)
break
case '接收并发放':
this._submitSend()
break
case '扫码接收':
this.$refs.refModal._open()
break
case '扫码接收并发放':
if (this.acceptSelectUserValue === '是') {
// 扫码接收并发放根据字典是否选人
this.$refs.userModal._open('sampleMan', '请选择领样人')
} else {
this.$refs.refModal._open('扫码接收发放')
}
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '收样室收样':
this._sampleReceive(this.selectIds)
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this._cusTomePrint()
}
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
// 1.自定义打印,除检样、备样、留样 增加制备标签,需要单独的查询制备标签的数据,
// 2.样品接收位置的制备用制备的的接口,将当前的保存方式置空,打印出来手动填写
_cusTomePrint() {
this.$store
.dispatch('FoodSample/preparationButton', {
sampleIds: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodSample.list
for (let i = 0; i < result.length; i++) {
// 样品制备保存方式
result[i].saveWay = ''
}
// 样品的数据和制备样品的数据
this.$refs.refModal._open(this.selectData, result)
})
},
// 接收并发放
_submitSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
const data = {
ids: this.selectIds.join(',')
}
// 判断接收发放是否选人
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodSample/submitReceiveSendCheck', data)
.then(() => {
const result = this.$store.state.FoodSample.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'sampleReceiveSendMan',
'请选择领样人'
)
}
})
} else {
this.$store
.dispatch('FoodSample/sampleReceiveSend', data)
.then(() => {
this._resultChange('接收发放成功')
})
}
}
},
_resultChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_exportReceiveRecord() {
// 导出交接记录
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择数据进行导出')
} else {
// eslint-disable-next-line no-undef
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
_deleteById(id) {
// 删除一条记录
this.$Modal.confirm({
title: '提示',
content: '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', id).then(() => {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success('删除成功!')
}
})
}
})
},
// 添加与编辑
_editModal(edit, data) {
if (edit) {
// 编辑
if (data.type === 1) {
// 政府
this.currentComponent = 'SampleGovernEdit'
this.$store.dispatch('FoodSample/getByGovernId', data.id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-his-wait'
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(function() {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-his-wait'
)
})
})
} else {
this.currentComponent = 'CompanySampleEdit'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
this.contractId,
'receive-his-wait'
)
})
})
}
} else {
// 添加
if (this.type === 0) {
// 企业
this.currentComponent = 'CompanySampleEdit'
} else {
// 政府和粮油
this.currentComponent = 'SampleGovernEdit'
}
this.$nextTick(() => {
// receive 标识,表示是样品接收的添加页面与其他普通样品的添加页面不同
this.$refs.refModal._open('', this.contractId, 'receive-his-wait')
})
}
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.standard = data
break
case 'query':
this.formObj.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
}
}
}
</script>
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