Commit 05496160 by lichengming

修改了扫码接收

parent 5f47328f
<template>
<div>
<Modal v-model="showSubmitModal" :mask-closable="false" @on-visible-change="_visibleChange" width="700">
<p slot="header">{{modalTitle}}</p>
<div>
<Form :label-width="80" onsubmit="return false">
<Form-item label="样品编号" prop="num">
<Input ref="inputFocus" @submit.native.prevent @on-enter="_numBlur" v-model="num"
placeholder="请将鼠标聚焦在此,并保持英文输入状态" style="width:100%"></Input>
</Form-item>
<Form-item label="扫码信息">
<div class="scanInfo">
<ul>
<li v-for="item in scanInfo">{{item}}</li>
</ul>
</div>
</Form-item>
</Form>
</div>
</Modal>
</div>
</template>
<script>
/* 扫码接收、扫码发放 */
export default {
components: {},
data() {
return {
modalTitle: '',
showSubmitModal: false,
scanInfo: [],
num: '',
formObj: {
personId: '',
person: ''
}
}
},
methods: {
_open(title, data) {
if (title) {
this.modalTitle = title
} else {
this.modalTitle = '扫码接收'
}
if (data) {
this.formObj.person = data.realname
this.formObj.personId = data.userId
} else {
this.formObj = this.$serializeFormSearch(this.formObj)
}
this.showSubmitModal = true
this.num = ''
this.scanInfo = []
this._autoFocus()
},
_autoFocus() {
this.$nextTick(() => {
this.$refs.inputFocus.focus()
})
},
_cancel() {
this.showSubmitModal = false
},
_numBlur() {
if (this.modalTitle === '扫码接收') {
// 扫码接收
this.$store
.dispatch('FoodSample/scanReceive', {
num: this.num
})
.then(() => {
this._resultChange(' 接收')
})
} else {
// 扫码发放
const param = {}
Object.assign(param, this.formObj, { num: this.num })
if (this.modalTitle === '扫码发放') {
this.$store
.dispatch('FoodSample/scanSend', this.$serializeFormSearch(param))
.then(() => {
this._resultChange(' 发放')
})
} else if (this.modalTitle === '扫码接收发放') {
this.$store
.dispatch(
'FoodSample/scanReceiveSend',
this.$serializeFormSearch(param)
)
.then(() => {
this._resultChange(' 接收发放')
})
}
// 扫码接收发放
}
this._autoFocus()
},
_resultChange(msg) {
const returnNum = this.$store.state.FoodSample.success
if (returnNum) {
this.scanInfo.push('编号 ' + returnNum + msg + '成功!')
this.num = ''
} else {
this.num = ''
}
},
// 关闭弹框,刷新界面
_visibleChange(data) {
if (!data) {
this.$emit('on-result-change')
}
}
}
}
</script>
<style>
.scanInfo {
overflow: auto;
}
</style>
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
<!--打印(可填打印数量)--> <!--打印(可填打印数量)-->
<!--选择领样人--> <!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo> <UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<TakeByEwm ref="ewmModal"></TakeByEwm>
</div> </div>
</template> </template>
...@@ -66,10 +67,11 @@ ...@@ -66,10 +67,11 @@
import http from '../../../api/http' import http from '../../../api/http'
import UserInfo from '../../../components/user-info-single/assignPerson' import UserInfo from '../../../components/user-info-single/assignPerson'
import { soilEntrust, soilSample } from '../../../api' import { soilEntrust, soilSample } from '../../../api'
import TakeByEwm from './TakeByEwm'
export default { export default {
components: { components: {
UserInfo UserInfo,
TakeByEwm
}, },
data() { data() {
return { return {
...@@ -142,7 +144,10 @@ export default { ...@@ -142,7 +144,10 @@ export default {
{ title: '单位', key: 'unit', width: 130 } { title: '单位', key: 'unit', width: 130 }
], ],
searchOpen: false, searchOpen: false,
btn: [{ type: 'primary', id: '', name: '领样', componentName: '' }], btn: [
{ type: 'primary', id: '', name: '领样', componentName: '' },
{ type: 'primary', id: '', name: '扫码接收', componentName: '' }
],
selectIds: [], selectIds: [],
selectData: [], selectData: [],
currentComponent: '', currentComponent: '',
...@@ -207,11 +212,17 @@ export default { ...@@ -207,11 +212,17 @@ export default {
case '领样': case '领样':
this._sampleTake() this._sampleTake()
break break
case '扫码接收':
this._ewmTake()
break
default: default:
this._btnOption(msg, formTypeObj) this._btnOption(msg, formTypeObj)
} }
}) })
}, },
_ewmTake() {
this.$refs.ewmModal._open()
},
// btn操作 // btn操作
_btnOption(msg, formTypeObj) { _btnOption(msg, formTypeObj) {
switch (msg) { switch (msg) {
......
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