Commit c44e2d0e by lichengming

修改了收样室收样

parent 67237c2f
<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.code" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托单位:">
<Input v-model="formObj.cname" @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>
<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>
<SampleManage ref="sampleManageModal" @on-result-change="_page"></SampleManage>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilEntrust } from '../../../api'
import SampleManage from './entrust-sample-manage/SampleManage'
export default {
components: {
UserInfo,
SampleManage
},
data() {
return {
formObj: {
code: undefined,
cname: undefined,
type: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{
type: 'ios-list',
id: '',
name: '项目管理'
},
{
type: 'md-create',
id: '',
name: '编辑协议'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托名称', key: 'name', width: 160 },
{ title: '委托编号', key: 'code', width: 180, detail: true },
{ title: '类型', key: 'type', width: 100, type: true },
{ title: '状态', key: 'progress', width: 110 },
{ title: '委托单位', key: 'cname' },
{ title: '主联系人', key: 'linkman', width: 100 },
{ title: '联系手机', key: 'tel', width: 120 },
{ title: '检测类型', key: 'detectType', width: 130 },
{ title: '服务类型', key: 'serviceType' }
],
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.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.refModal._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 soilEntrust.page(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.refModal._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-rel-sample" :label-width="80" v-show="searchOpen" 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>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" v-model="formObj.name" name="name" 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"
@on-result-change="_tableResultChange"
:getPage="getPage"
:icon-msg="iconMsg"
select-data>
<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.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>
<div v-else-if="item.sampleDetail"><a @click.stop="_sampleDetailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</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>
</div>
</template>
<script>
import http from '../../../api/http'
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilEntrust } from '../../../api'
export default {
components: {
UserInfo
},
data() {
return {
formObj: { num: undefined, name: undefined },
iconMsgDis: [],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
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: 'num',
width: 180,
sampleDetail: true,
fixed: 'left'
},
{ title: '样品名称', key: 'name', width: 160, fixed: 'left' },
{ title: '执行标准', key: 'standard', width: 160 },
{ title: '大类', key: 'firstClass', width: 130 },
{ title: '细类', key: 'detectType', width: 200 },
{ title: '抽样单编号', key: 'samplingNum', width: 200 },
{ title: '检测项目', key: 'itemName', width: 160 },
{ title: '规格型号', key: 'specification', width: 160 },
{ title: '质量等级', key: 'qualityGrade', width: 160 },
{ title: '样品数量', key: 'quantity', width: 160 },
{ title: '单位', key: 'unit', width: 100 },
{ title: '抽样环节', key: 'samplingLink', width: 160 },
{ title: '备样数量', key: 'backupQuanity', width: 100 },
{ title: '保存条件', key: 'keepCondition', width: 160 },
{ title: '抽样地点', key: 'samplingPlace', width: 160 },
{ title: '抽样地点(其他)', key: 'samplingPlaceRemark', width: 200 },
{ title: '抽样日期', key: 'samplingDate', width: 200, date: true },
{ title: '日期类型', key: 'dateType', width: 160 },
{ title: '日期', key: 'dateTimeString', width: 120 },
{ title: '委托单位', key: 'cname' },
{ title: '委托编号', key: 'code', width: 180, detail: true },
{ title: '检测类型', key: 'contractDetectType', width: 130 },
{ title: '签订日期', key: 'signDate', date: true, width: 120 },
{ title: '制单人', key: 'contractUname', width: 120 },
{ title: '制单日期', key: 'contractCtime', date: true, width: 120 },
{ title: '样品备注', key: 'remark' },
{ title: '委托备注', key: 'contractRemark' }
],
searchOpen: false,
btn: [
{ type: 'primary', id: 'ZBC', name: '接收并发放', componentName: '' }
],
selectIds: [],
selectData: [],
currentComponent: '',
printerVal: '', // 选择的打印机
standard: '',
stdList: [],
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 340)
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
// // 获取当前的执行标准下拉项
// this._getStdList()
},
methods: {
// 接收的返回保存
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'relReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodSample/sampleReceiveSend', sendData)
.then(() => {
this._resultSampleChange('接收并发放成功')
})
break
case 'relReceiveSendScanMan':
// 扫码接收并发放
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
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg, formTypeObj)
}
})
},
// btn操作
_btnOption(msg, formTypeObj) {
switch (msg) {
case '扫码接收并发放':
// 根据字典判断是否选择人员
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open('relReceiveSendScanMan', '请选择领样人')
} else {
this.$refs.refModal._open('扫码接收发放')
}
break
case '接收并发放':
this._submitSend()
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()
})
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条样品信息')
} else {
this._cusTomePrint()
}
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('relReceiveSendMan', '请选择领样人')
}
})
} 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('删除成功!')
})
}
})
},
_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() {
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('请至少选中一条样品数据!')
} 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(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
})
} 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'
)
})
})
}
})
} else if (
result.length === 1 &&
result[0].uri === 'DLTB-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByDLTB'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
})
} 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
)
})
})
}
})
} 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(() => {
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 === '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
)
})
})
}
})
} 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'
)
})
})
} else {
// 粮油--只是复制样品信息
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
}
break
case '操作日志':
this._operationRecord(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)
break
case '样品附件':
this._upload(data.id)
break
}
})
},
_downContractForm(id) {
this.$store
.dispatch(
'ReportExport/getById',
'food-sample-receive-sample-download-contract'
)
.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'
)
}
}
})
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSample.page
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
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.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.page(this.$serializeForm(this.formObj))
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
// 查看委托
_detailModal(contractId, type) {
this.$store.dispatch('FoodContract/getById', contractId).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
// 查看样品
_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)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
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
})
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按委托接收" name="entrust">
<ReceiveByEntrust ref="entrustTabs"></ReceiveByEntrust>
</el-tab-pane>
<el-tab-pane label="按样品接收" name="sample">
<ReceiveBySample ref="sampleTabs"></ReceiveBySample>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import ReceiveByEntrust from './ReceiveByEntrust'
import ReceiveBySample from './ReceiveBySample'
export default {
name: 'MeterSummaryEntrustIndex',
components: {
ReceiveByEntrust,
ReceiveBySample
},
data() {
return {
activeName: 'entrust'
}
},
mounted() {
this.activeName = 'entrust'
this._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'entrust') {
this._page()
} else {
this.$refs.sampleTabs._page()
}
},
_page() {
this.$refs.entrustTabs._page()
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="margin-bottom: 10px">
<Form id="search-send" :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable></Input>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.num" name="num" placeholder="请输入样品编号" clearable></Input>
<input name="contractId" type="hidden">
</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">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
:iconMsg="iconMsg"
select-data>
<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>{{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: [
{
id: 'ZBC',
type: 'primary',
name: '出库',
componentName: 'OutStorage'
}
],
selectIds: [],
getPage: {},
pageColumns: [
{
title: '样品编号',
key: 'num',
width: 180,
detail: true,
fixed: 'left'
},
{ title: '样品名称', key: 'name', width: 160, fixed: 'left' },
{ title: '执行标准', key: 'standard', width: 160 },
{ title: '大类', key: 'firstClass', width: 130 },
{ title: '细类', key: 'detectType', width: 200 },
{ title: '抽样单编号', key: 'samplingNum', width: 200 },
{ title: '状态', key: 'status', width: 120, status: true },
{ title: '检测项目', key: 'itemName', width: 160 },
{ title: '规格型号', key: 'specification', width: 160 },
{ title: '质量等级', key: 'qualityGrade', width: 160 },
{ title: '样品数量', key: 'quantity', width: 100 },
{ title: '单位', key: 'unit', width: 90 },
{ title: '抽样环节', key: 'samplingLink', width: 160 },
{ title: '备样数量', key: 'backupQuanity', width: 100 },
{ title: '保存条件', key: 'keepCondition', width: 160 },
{ title: '抽样地点', key: 'samplingPlace', width: 160 },
{ title: '抽样地点(其他)', key: 'samplingPlaceRemark', width: 200 },
{ title: '抽样日期', key: 'samplingDate', width: 200, date: true },
{ title: '日期类型', key: 'dateType', width: 160 },
{ title: '日期', key: 'dateTime', width: 120, date: true },
{ title: '样品形态', key: 'shape', width: 100 },
{ title: '接收日期', key: 'receiveDate', width: 120, date: true },
{ title: '备注', key: 'remark' }
],
iconMsg: [
{
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'SampleRecord'
},
{ type: 'md-cloud', id: '', name: '附件', componentName: 'FileManage' }
],
type: '',
contractId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
samplingNum: '',
name: '',
num: '',
receiveStartDate: '',
receiveEndDate: '',
detectType: ''
},
dateList: [],
searchOpen: false
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
// 接收日期
_receiveChange(data) {
this.formObj.receiveStartDate = data[0]
this.formObj.receiveEndDate = data[1]
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
default:
this._search()
}
},
_detailModal(id) {
// 查看
if (this.type === 1) {
// 政府
this.currentComponent = 'FoodSampleGovernDetail'
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store.dispatch('FoodSample/getByCompanyId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.companyModel)
})
})
}
},
_open(contractId, type) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
$('input[name=contractId]').val(contractId)
this.contractId = contractId
this.type = type
this.selectIds = []
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.page(this.$serializeForm(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.$refs.refModal._open(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '导出任务单':
this._exportTaskForm()
break
case '导出检测任务单':
this._exportTestTaskForm()
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条样品信息')
} else {
this._cusTomePrint()
}
break
case '出库':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条样品信息!')
} else {
this.$refs.refModal._open(this.selectIds, 'alreadyOutStorage')
}
break
case '扫码出库':
this.$refs.refModal._open('alreadyScanOutStorage')
break
case '追加检测项目':
this._importItem()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '追加检测项目包':
this._importItemPackage()
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)
})
},
_exportTestTaskForm() {
this.formObj.contractId = this.contractId
const objcity = {
param: 'ids',
ids: this.selectIds,
url: '',
queryObj: this.$serializeFormSearch(this.formObj),
msgContent: '数据量如果超过两万条,请分批次导出'
}
this.$store
.dispatch(
'ReportExport/getById',
'food-sample-manage-export-test-table'
)
.then(() => {
const result = this.$store.state.ReportExport.model
objcity.url = result
this.$exportByQuery(objcity)
})
},
_search() {
this._page()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSample.page
break
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
}
},
// 追加检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this._judge('package')
}
},
// 追加检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this._judge('item')
}
},
// 复制历史项目
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this._judge('copyHisItem')
}
},
_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 {
// eslint-disable-next-line no-undef
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
_judge(msg) {
this.$store
.dispatch('FoodSample/getSampleStatus', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodSample.list
if (result) {
// 选中的是同一个 状态的样品
// FLOW_RECEIVE--待接收
this.sampleStatus = result.status.value
if (this.sampleStatus === 'FLOW_RECEIVE') {
// 选择检测项目后--直接保存
this.$refs.refModal._open(this.selectIds, this.selectData[0])
} else {
// 弹出询问框
this.$refs.typeModal._open(
msg,
this.selectIds,
this.selectData[0]
)
}
}
})
},
/** ********************************导出任务单 -start********************************************/
_exportTaskForm() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$store
.dispatch(
'ReportExport/getById',
'food-sample-manage-export-task-form1'
)
.then(() => {
const result = this.$store.state.ReportExport.model
window.open(
this.$judgeUrlChar(result) + 'ids=' + this.selectIds,
'_blank'
)
})
}
},
/** ********************************导出任务单 -end********************************************/
// 选择完打印机之后
_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)
}
}
}
}
</script>
<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-tab-pane label="已接样样品" name="alreadyIssued">
<AlreadyIssued ref="alreadyIssuedModal"></AlreadyIssued>
</el-tab-pane>
</el-tabs>
</div>
</Modal>
</div>
</template>
<script>
import WaitReceive from './WaitReceive'
import AlreadyIssued from './AlreadyIssued'
import WaitScan from './WaitScan'
export default {
components: {
WaitReceive,
AlreadyIssued,
WaitScan
},
data() {
return {
type: '',
contractId: '', // 合同id
showSampleModal: false,
modalTitle: '',
selectIds: [],
activeName: 'waitReceive',
name: ''
}
},
methods: {
_initTab() {
if (this.$showBtn('food-wait-Issue-sample')) {
this.activeName = 'waitScan'
this._waitSend()
}
},
_open(contractId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
this.showSampleModal = true
this.entrustId = contractId // 合同id
this.activeName = 'waitReceive'
this.selectIds = []
this._waitPage()
},
// 待接收
_waitPage() {
this.$refs.waitReceiveModal._open(this.contractId, this.type)
},
// 待发放
_waitSend() {
this.$refs.waitScanModal._open(this.contractId, this.type)
},
// 已接收
_issuedPage() {
this.$refs.alreadyIssuedModal._open(this.contractId, 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 id="search-wait" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable></Input>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.num" name="num" placeholder="请输入样品编号" clearable></Input>
<input name="contractId" type="hidden">
</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" class="contHide">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
:iconMsg="iconMsg"
select-data>
<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: [{ type: 'primary', id: 'wait-receive-receive', name: '接收' }],
selectIds: [],
getPage: {},
pageColumns: [
{
title: '样品编号',
key: 'num',
width: 180,
detail: true,
fixed: 'left'
},
{ title: '样品名称', key: 'name', width: 160, fixed: 'left' },
{ title: '执行标准', key: 'standard', width: 160 },
{ title: '大类', key: 'firstClass', width: 130 },
{ title: '细类', key: 'detectType', width: 200 },
{ title: '抽样单编号', key: 'samplingNum', width: 200 },
{ title: '检测项目', key: 'itemName', width: 160 },
{ title: '规格型号', key: 'specification', width: 160 },
{ title: '质量等级', key: 'qualityGrade', width: 160 },
{ title: '样品数量', key: 'quantity', width: 100 },
{ title: '单位', key: 'unit', width: 90 },
{ title: '抽样环节', key: 'samplingLink', width: 160 },
{ title: '备样数量', key: 'backupQuanity', width: 100 },
{ title: '保存条件', key: 'keepCondition', width: 160 },
{ title: '抽样地点', key: 'samplingPlace', width: 160 },
{ title: '抽样地点(其他)', key: 'samplingPlaceRemark', width: 200 },
{ title: '抽样日期', key: 'samplingDate', width: 200, date: true },
{ title: '日期类型', key: 'dateType', width: 160 },
{ title: '日期', key: 'dateTime', width: 120, date: true },
{ title: '样品形态', key: 'shape', width: 100 },
{ title: '备注', key: 'remark' }
],
iconMsg: [
{ type: 'md-create', id: '', name: '编辑' },
{ type: 'ios-browsers', id: '', name: '复制' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'SampleRecord'
},
{ type: 'md-cloud', id: '', name: '附件', componentName: 'FileManage' }
],
type: '',
contractId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
samplingNum: '',
name: '',
num: '',
detectType: '',
standard: '',
samplingLinkList: []
},
stdList: [],
sampleLinkList: [
{ value: 0, name: '食品生产' },
{ value: 1, name: '食品流通' },
{ value: 2, name: '餐饮服务' },
{ value: 3, name: '食用农产品' },
{ value: 4, name: '生产' },
{ value: 5, name: '流通' },
{ value: 6, name: '餐饮' }
],
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 'sampleReceiveSendMan':
// 接收并发放
this.$store
.dispatch('FoodSample/sampleReceiveSend', sendData)
.then(() => {
this._resultChange('接收发放成功')
})
break
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()
}
},
_detailModal(id) {
// 查看
if (this.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)
})
})
}
},
_open(contractId, type) {
console.log('待接收样品')
this.formObj = this.$resetFields(this.formObj)
$('input[name=contractId]').val(contractId)
this.contractId = contractId
this.type = type
this.selectIds = []
this.saveWayList = []
this.saveWayString = ''
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.page(this.$serializeForm(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._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
}
})
},
_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()
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')
})
}
},
// 复制样品
_copySample(data) {
this.$Modal.confirm({
title: '提示',
content: '确定要复制该样品信息?',
onOk: () => {
if (data.type === 1) {
// 政府
this.currentComponent = 'SampleGovernEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else {
this.currentComponent = 'CompanySampleEdit'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.companyModel,
'receive-his-wait-copy'
)
})
})
}
}
})
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSample.page
break
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
}
},
// 样品接收
_sampleReceive() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.$Modal.confirm({
title: '提示',
content: '确定要接收这 ' + this.selectIds.length + ' 条数据?',
onOk: () => {
this.$store
.dispatch('FoodSample/batchSaveReceive', tempData)
.then(() => {
if (this.$store.state.FoodSample.success) {
this.$Message.success('提交成功!')
this.selectData = []
this._searchTop()
}
})
}
})
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds)
})
}
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
})
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds)
})
}
},
// 选择打印机
_selectPrinter(msg) {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(msg)
}
},
// 选择完打印机之后
_printerResult(data) {
// printModal 不能使用动态组件,否则第二次打不开,原因未知
switch (data.type) {
// 打印标签--直接打印
case 'print-label':
this.$refs.printModal._printOpen(this.selectData, data.printerVal)
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
}
},
// 查询执行标准
_getStdList(data) {
const obj = Object.assign({}, this.$serialize('search-wait'))
if (data) {
obj.standard = data
}
this.$store.dispatch('FoodSample/listReceiveStandard', obj).then(() => {
this.stdList = this.$store.state.FoodSample.list
})
}
}
}
</script>
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="padding-bottom: 5px">
<Form id="search-wait-scan" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable></Input>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.num" name="num" placeholder="请输入样品编号" clearable></Input>
<input name="contractId" type="hidden">
</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" class="contHide">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
:iconMsg="iconMsg"
select-data>
<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: [{ type: 'primary', id: 'ZBC', name: '发放' }],
selectIds: [],
getPage: {},
pageColumns: [
{
title: '样品编号',
key: 'num',
width: 180,
detail: true,
fixed: 'left'
},
{ title: '样品名称', key: 'name', width: 160, fixed: 'left' },
{ title: '执行标准', key: 'standard', width: 160 },
{ title: '大类', key: 'firstClass', width: 130 },
{ title: '细类', key: 'detectType', width: 200 },
{ title: '抽样单编号', key: 'samplingNum', width: 200 },
{ title: '检测项目', key: 'itemName', width: 160 },
{ title: '规格型号', key: 'specification', width: 160 },
{ title: '质量等级', key: 'qualityGrade', width: 160 },
{ title: '样品数量', key: 'quantity', width: 100 },
{ title: '单位', key: 'unit', width: 90 },
{ title: '抽样环节', key: 'samplingLink', width: 160 },
{ title: '备样数量', key: 'backupQuanity', width: 100 },
{ title: '保存条件', key: 'keepCondition', width: 160 },
{ title: '抽样地点', key: 'samplingPlace', width: 160 },
{ title: '抽样地点(其他)', key: 'samplingPlaceRemark', width: 200 },
{ title: '抽样日期', key: 'samplingDate', width: 200, date: true },
{ title: '日期类型', key: 'dateType', width: 160 },
{ title: '日期', key: 'dateTime', width: 120, date: true },
{ title: '样品形态', key: 'shape', width: 100 },
{ title: '备注', key: 'remark' }
],
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: '',
contractId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
samplingNum: '',
name: '',
num: '',
detectType: '',
standard: '',
samplingLinkList: []
},
stdList: [],
sampleLinkList: [
{ value: 0, name: '食品生产' },
{ value: 1, name: '食品流通' },
{ value: 2, name: '餐饮服务' },
{ value: 3, name: '食用农产品' },
{ value: 4, name: '生产' },
{ value: 5, name: '流通' },
{ value: 6, name: '餐饮' }
],
searchOpen: true,
acceptSelectUserValue: ''
}
},
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()
}
},
_detailModal(id) {
// 查看
if (this.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)
})
})
}
},
_open(contractId, type) {
this.formObj = this.$resetFields(this.formObj)
$('input[name=contractId]').val(contractId)
this.contractId = contractId
this.type = type
this.selectIds = []
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.page(this.$serializeForm(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._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
}
})
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '发放':
this._submitSend()
break
case '扫码发放':
this._oneKeySend()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '接收':
this._sampleReceive()
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
}
})
},
// 扫码发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 扫码发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open('sampleScanSend', '请选择领样人')
} else {
// 扫码发放
this.$refs.refModal._open('扫码发放')
}
}
},
// 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 {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
const data = {
ids: this.selectIds.join(',')
}
this.$store.dispatch('FoodSample/submitSendCheck', data).then(() => {
const result = this.$store.state.FoodSample.success
if (result) {
// 验证成功
this.$refs.userModal._open('sampleSendMan', '请选择领样人')
}
})
} else {
const data = {
ids: this.selectIds.join(',')
}
// 发放
this.$store.dispatch('FoodSample/submitSend', 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-wait-send'
)
})
})
} 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-wait-send'
)
})
})
}
} else {
// 添加
if (this.type === 0) {
// 企业
this.currentComponent = 'CompanySampleEdit'
} else {
// 政府和粮油
this.currentComponent = 'SampleGovernEdit'
}
this.$nextTick(() => {
// receive 标识,表示是样品接收的添加页面与其他普通样品的添加页面不同
this.$refs.refModal._open('', this.contractId, 'receive-wait-send')
})
}
},
// 复制样品
_copySample(data) {
this.$Modal.confirm({
title: '提示',
content: '确定要复制该样品信息?',
onOk: () => {
if (data.type === 1) {
// 政府
this.currentComponent = 'SampleGovernEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else {
this.currentComponent = 'CompanySampleEdit'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.companyModel,
'receive-his-wait-copy'
)
})
})
}
}
})
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSample.page
break
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
}
},
// 样品接收
_sampleReceive() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.$Modal.confirm({
title: '提示',
content: '确定要接收这 ' + this.selectIds.length + ' 条数据?',
onOk: () => {
this.$store
.dispatch('FoodSample/batchSaveReceive', tempData)
.then(() => {
if (this.$store.state.FoodSample.success) {
this.$Message.success('提交成功!')
this.selectData = []
this._searchTop()
}
})
}
})
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds)
})
}
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
})
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds)
})
}
},
// 选择打印机
_selectPrinter(msg) {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(msg)
}
},
// 选择完打印机之后
_printerResult(data) {
// printModal 不能使用动态组件,否则第二次打不开,原因未知
switch (data.type) {
// 打印标签--直接打印
case 'print-label':
this.$refs.printModal._printOpen(this.selectData, data.printerVal)
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
}
},
// 查询执行标准
_getStdList(data) {
const obj = Object.assign({}, this.$serialize('search-wait-scan'))
if (data) {
obj.standard = data
}
this.$store.dispatch('FoodSample/listReceiveStandard', obj).then(() => {
this.stdList = this.$store.state.FoodSample.list
})
}
}
}
</script>
......@@ -7,6 +7,7 @@ import StandardManage from '../pages/meter-aptitude/standard-manage/StandardMana
import ExperimentItemManage from '../pages/meter-aptitude/item-manage/ExperimentItemManage'
import EntrustIndex from '../pages/meter-entrust/entrust-register/EntrustIndex'
import ReviewEntrust from '../pages/meter-entrust/entrust-review/ReviewEntrust'
import SampleReceiveIndex from '../pages/soil-sample-manage/sample-receive/SampleReceiveIndex'
import Blank from '~/pages/blank'
export default [
{
......@@ -36,7 +37,7 @@ export default [
children: [
{
path: 'receive',
component: workbench,
component: SampleReceiveIndex,
meta: { title: '收样室收样' }
},
{
......
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