You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udiwms-vue-frame/src/views/collect/DealOrder.vue

1825 lines
56 KiB
Vue

<template>
<div>
11 months ago
<el-form :model="formData" class="order-el-form" ref="formData" label-width="120px" @submit.native.prevent>
12 months ago
<el-card>
<el-row style="margin-top: 6px;margin-bottom: -6px;"
4 months ago
v-if="this.formDataVisible != null && this.formDataVisible.scanType == 1"
>
<el-col :span="6">
10 months ago
<el-form-item prop="locInvCode" label="发货方:">
10 months ago
<el-select v-model="formData.shipper" placeholder="请选择发货方" clearable
:disabled="formData.billNo"
style="width: 90%"
@change="changeShipper"
>
<el-option
v-for="item in invList"
:key="item.name"
:label="item.name"
4 months ago
:value="item.code"
>
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<!-- :label="this.formDataVisible.unitTittle + ':'"-->
8 months ago
<el-form-item class="query-form-item" label="收货方:">
11 months ago
<el-select v-model="formData.fromCorp"
filterable
10 months ago
:disabled="formData.billNo"
11 months ago
remote
reserve-keyword
@change="changeCorp"
4 months ago
placeholder="请选择收货方" clearable style="width: 90%"
>
11 months ago
<el-option
11 months ago
v-for="item in fromInvOptions"
:key="item.code"
11 months ago
:label="item.name"
:value="item.code"
11 months ago
>
<span style="float: left">{{ item.name }}</span>
11 months ago
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span>
11 months ago
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<div style="margin-top: 1px;padding: 5px">
11 months ago
<el-row :gutter="0" style="margin-top: 5px">
<el-col :span="16">
<!--:label="scanTip" -->
<el-form-item prop="code" :label="scanTip" label-width="80px">
11 months ago
<el-input
id="inputer"
@focus="getInputFocus($event)"
@keypress.enter.native="enterKey($event)"
11 months ago
ref="inputRef"
11 months ago
style="ime-mode: disabled"
type="tel"
:placeholder="this.placeholder"
11 months ago
v-model="scanCode"
size="50"
11 months ago
></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-button-group style="display: flex; margin-left: 15px;height: 36px">
4 months ago
<el-button type="primary" @click.native="deleteCode"
v-if="labelName == 1"
:disabled="formData.billNo == null"
>扫码剔除
</el-button>
<el-button size="mini" type="primary"
v-if="labelName == 2"
@click.native="overdeleteCode"
>结束剔除
</el-button>
<el-button
type="primary"
:disabled="formData.billNo ||(this.formDataVisible != null && this.formDataVisible.scanType == 1)"
@click.native="selectPrescribe()"
>选单
</el-button>
<el-button
type="primary"
:disabled="!formData.billNo"
@click.native="saveDraftOrder()"
>挂起
</el-button>
<el-button
type="primary"
:disabled="!formData.billNo"
@click.native="cancelOrder()"
>放弃
</el-button>
<el-button
type="primary"
:disabled="!formData.billNo"
@click.native="confirmFinishOrder()"
>完成
</el-button>
11 months ago
</el-button-group>
11 months ago
</el-col>
</el-row>
<el-row :gutter="0">
<el-col :span="20" style="margin-top: 0px;margin-bottom: 10px;margin-left: 80px">
<el-checkbox v-model="checked" v-if="!this.formData.billNo && this.formDataVisible.scanType != 1">
</el-checkbox>
10 months ago
</el-col>
</el-row>
10 months ago
11 months ago
</div>
4 months ago
<el-descriptions :column="7" border style="margin-top: 5px; font-size: 16px">
<el-descriptions-item label="业务单号">
<div style="font-size: 15px">{{ formData.billNo }}</div>
</el-descriptions-item>
<el-descriptions-item label="发货方">
<div style="font-size: 15px">{{ formData.shipperName }}</div>
</el-descriptions-item>
<el-descriptions-item label="收货方">
<div style="font-size: 15px">{{ formData.fromCorpName }}</div>
</el-descriptions-item>
<el-descriptions-item label="单据时间">
<div style="font-size: 15px">{{ formData.billTime }}</div>
</el-descriptions-item>
</el-descriptions>
12 months ago
</el-card>
4 months ago
<el-tabs type="border-card" style="margin: 15px" v-model="editableTabsValue">
<!--<el-tab-pane label="扫码详情" name="prescribeOriginPanel">-->
4 months ago
<prescribeOriginPanel
v-if="panelALive"
:prescribeData="curRow"
:bizIds="bizIds"
:summaryNoFlag=true
4 months ago
></prescribeOriginPanel>
</el-tabs>
12 months ago
<el-dialog
11 months ago
title="选入业务单据"
12 months ago
:visible.sync="selectPrescriptionVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
v-if="selectPrescriptionVisible"
width="65%"
append-to-body
>
<selectPrescribeDialog
ref="childRef"
6 months ago
:workPlaceCode="this.workplaceId"
:busType="this.formData.busType"
:fromCorp="this.formData.fromCorp"
12 months ago
:confirmSelect="this.confirmSelect"
:closeDialog="this.closeDialog"
11 months ago
:viewType="viewType"
12 months ago
></selectPrescribeDialog>
</el-dialog>
<el-dialog
title="提示"
:visible.sync="confirmDialogVisible"
width="25%"
:close-on-click-modal="false"
:close-on-press-escape="false"
:custom-class="'compact-dialog'"
center
>
<div style="display: flex; align-items: center; justify-content: center; text-align: center;">
<i class="el-icon-warning" style="font-size: 36px; color: #E6A23C; margin-right: 12px;"></i>
<p style="font-size: 14px; margin: 0;">{{ confirmMessage }}</p>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" plain @click="confirmDialogVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="handleConfirm"></el-button>
</span>
</el-dialog>
<el-dialog
title="选择业务类型"
:visible.sync="selectBusTypeDisabled"
:close-on-click-modal="false"
:close-on-press-escape="false"
:show-close="false"
v-if="selectBusTypeDisabled"
width="65%"
append-to-body
>
11 months ago
<el-row>
<!-- <el-button v-for="(item, index) in busTypeList" :key="index" type="primary" plain @click="selectBusType(item.code)">{{ item.name }}</el-button>-->
11 months ago
<el-col v-for="(info, index) in busTypeList" :key="index" :xs="12" :sm="8" :md="8" :lg="6">
<el-card :body-style="{margin:'20px'}"
style="margin:20px 20px 20px 20px;height: 200px;background-color: #e1f3fb;border-radius: 12px; position: relative;"
>
11 months ago
<div
style="display: flex; justify-content: space-between; align-items: center; height: 46px; /* 约为 200px 的 1/3 */"
4 months ago
@click="selectBusType(info.documentTypeCode)"
>
<p style="font-size: 20px;background-color: #e1f3fb;font-weight: bold;">{{ info.busName }}</p>
</div>
11 months ago
<div style="flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding-top: 10px;"
>
<!-- 假设这里有一些信息内容 -->
<p style="font-size: 14px;background-color: #e1f3fb" @click="selectBusType(info.documentTypeCode)">
{{ info.remark }}</p>
11 months ago
<el-button type="primary" style="position: absolute; bottom: 20px; right: 20px;" icon="el-icon-thumb"
4 months ago
@click="selectBusType(info.documentTypeCode)"
>开始作业
11 months ago
</el-button>
</div>
</el-card>
</el-col>
</el-row>
</el-dialog>
12 months ago
</el-form>
</div>
10 months ago
</template>
<script>
4 months ago
import addOrder from '@/views/inout/DialogCreateOrder'
import errOrder from '@/views/inout/IoCreateErrorOrder'
import {executeFuc, getHead} from '@/utils/customConfig'
import {convertDate} from '@/utils/date'
4 months ago
import selectPrescribeDialog from '@/views/collect/selectCollectOrderDialog'
import PanelOrderManuTagCode from './PanelOrderManuTagCode'
import prescribeOriginPanel from './PannelOrderBiz'
import prescribeCodePanel from './PanelOrderTagCode'
import {listPage} from '@/api/basic/workPlace/sysWorkplaceManage'
import {enterCodeWeb, batchVailCode, enterCodeBillNo, saveOrderWeb, batchUpdateCode} from '@/api/inout/order'
10 months ago
import {
cancelOrder,
draftOrder,
finishOrder,
startSplit,
tagCode,
updateOrder,
vailOrderFinish
4 months ago
} from '@/api/collect/splitCreateOrder'
import {selectCorpList} from '@/api/basic/basicUnitMaintain'
9 months ago
import {
getCurOrder,
getNextOrder,
findByBill,
findFromCorp,
orderDetail,
removeByScanCode
4 months ago
} from '@/api/collect/collectOrder'
import PanelOrderAllDetail from '@/views/collect/PanelOrderAllDetail'
import {getWorkBindBusTypes, removeBusTypeById} from '@/api/basic/workPlace/sysWorkplaceDocuments'
import {getInvListByUser} from '@/api/system/invWarehouse'
import {orderbatchAddCode} from '@/api/inout/splitCode'
import {isBlank} from '@/utils/strUtil'
4 months ago
import JsBarcode from 'jsbarcode'
import {getSet} from '@/api/collect/collectSet'
import {MessageBox} from 'element-ui'
import {addCode} from "@/api/inventory/invCountCodes";
4 months ago
export default {
/**
* 处理处方
*/
4 months ago
name: 'prescribeTagCodeDeal',
11 months ago
props: {
resetKey: {
type: Function,
required: true
4 months ago
}
11 months ago
},
data() {
return {
11 months ago
tabsName: [
11 months ago
'prescribeOriginPanel',
'prescribeCodePanel1',
'prescribeCodePanel2',
4 months ago
'PanelOrderAllDetail'
11 months ago
],
editableTabsValue: 'prescribeOriginPanel',
11 months ago
fromInvOptions: [],
confirmDialogVisible: false,
confirmMessage: '',
confirmCallback: null,
//界面配置相关
//患者处方
12 months ago
loading: false,
placeholder: '请点击输入框进行选择单据',
tableHeader: [],
queryList: [],
tableObj: [],
fromList: [],
convertDateFun: convertDate,
//界面配置-------------end
showSearch: true,
filterQuery: {
billNo: null,
page: 1,
4 months ago
limit: 10
},
list: [],
total: 0,
defaultSort: {prop: 'createTime', order: 'desc'},
11 months ago
formDataVisible: {
11 months ago
scanType: null,
4 months ago
unitTittle: '往来单位',
corpType: 3
11 months ago
},
11 months ago
curWorkPlaces: [],
erpList: [],
11 months ago
formData: {
11 months ago
billNo: null,
11 months ago
tagStatus: -1,
11 months ago
invCode: null,
busType: null,
11 months ago
workPlaceCode: null,
11 months ago
fromCorp: null,
4 months ago
confirmFinish: false
11 months ago
},
12 months ago
selectPrescriptionVisible: false,
11 months ago
corpOrderIdDisabled: false,
isLinkDisabled: false,
selectBusTypeDisabled: false,
11 months ago
userInfo: {
inv: this.$store.getters.locInvName,
deptName: this.$store.getters.locDeptName,
userName: this.$store.getters.name,
4 months ago
companyName: this.$store.getters.companyName
},
curRow: null,
11 months ago
panelALive: false,
autoFinishOrderFlag: false,//是否对完成的单据提示立即提交
//扫码相关
4 months ago
scanCode: '',
isSuccess: false,
10 months ago
checked: true,
4 months ago
scanTitle: '扫码结果:',
result: ' \n',
msgTip: '信息提醒:',
originCode: '',
checkSuccess: false,
4 months ago
scanResultType: 'success',
11 months ago
isSelectOrder: false,
isFinishOrder: true,
busQuery: {
busKey: '',
workplaceCode: null,
page: 1,
limit: 100
},
busTypeList: [],
busTypeTotal: 0,
invList: [],
10 months ago
viewType: 1,
scanDisabled: false,
10 months ago
valiCodes: [],
4 months ago
warnResult: '',
errResult: '',
10 months ago
warnVisible: false,
errVisible: false,
10 months ago
workplaceId: null,
ws: null,
4 months ago
scanTip: '扫码录入:',
scanSplit: false,
//
labels: {
1: '扫码录入:',
2: '扫码剔除:'
},
labelName: 1,
scanStatus: null, // 1:扫码剔除; null 处理单据
collectSet: {},
bizIds: [],
}
},
components: {
11 months ago
addOrder,
errOrder,
selectPrescribeDialog,
prescribeCodePanel,
11 months ago
PanelOrderManuTagCode, prescribeOriginPanel,
11 months ago
PanelOrderAllDetail
},
11 months ago
watch: {
resetKey(newVal, oldVal) {
this.$refs.inputRef.focus()
11 months ago
}
},
methods: {
showConfirmDialog(message, callback) {
this.confirmMessage = message
this.confirmCallback = callback
this.confirmDialogVisible = true
},
handleConfirm() {
if (this.confirmCallback) {
this.confirmCallback()
}
this.confirmDialogVisible = false
},
generateBarcode() {
4 months ago
const barcodeData = this.formData.billNo
// 获取条形码容器
4 months ago
const barcodeContainer = this.$refs.barcodeContainer
// 使用JsBarcode生成条形码
JsBarcode(barcodeContainer, barcodeData, {
format: 'CODE128',
displayValue: true,
fontSize: 8, // 减小字体大小
textColor: '#000',
lineColor: '#000',
width: 1.2, // 减小条形码宽度
height: 15, // 减小条形码高度
margin: 1 // 减小外边距
4 months ago
})
},
11 months ago
getBillNo(billNo) {
11 months ago
let post = {
billNo: billNo,
11 months ago
workPlaceCode: this.workplaceId,
11 months ago
page: 1,
4 months ago
limit: 10
11 months ago
}
findByBill(post).then(res => {
if (res.code == 20000) {
11 months ago
if (res.data.billNo != null) {
this.formData = res.data
4 months ago
this.scanCode = ''
10 months ago
this.formData.workPlaceCode = this.workplaceId
10 months ago
this.checked = false
}
} else {
10 months ago
this.checked = true
this.formData.billNo = null
10 months ago
this.$message.error(res.message)
}
})
},
11 months ago
selectBusType(val) {
this.formData.busType = val
this.selectBusTypeDisabled = false
if (this.formData.workPlaceCode != null) {
4 months ago
this.findCurOrder()
}
},
getWorkBindBusTypes(workplaceId) {
this.busQuery.workplaceCode = workplaceId
getWorkBindBusTypes(this.busQuery).then(res => {
if (res.code == 20000) {
this.busTypeList = res.data.list
this.busTypeTotal = res.data.total
11 months ago
if (this.formData.billNo != null) {
this.getBillNo(this.formData.billNo)
4 months ago
this.startDeal()
} else {
11 months ago
if (this.busTypeList.length == 1 && this.$route.query.busType == null) {
10 months ago
this.formDataVisible = this.busTypeList[0]
11 months ago
this.formData.busType = this.busTypeList[0].documentTypeCode
this.selectBusTypeDisabled = false
10 months ago
if (this.formDataVisible.scanType == 1) {
4 months ago
this.findFromInvList('')
this.getInvList()
this.placeholder = '请点击输入框进行扫码生成业务单据'
} else {
4 months ago
this.findCurOrder()
10 months ago
}
11 months ago
} else {
10 months ago
console.log(this.$route.query.busType)
if (this.$route.query.busType != null) {
this.formData.busType = this.$route.query.busType
4 months ago
this.$refs.inputRef.focus()
this.formDataVisible = this.busTypeList.find(item => item.documentTypeCode == this.formData.busType)
10 months ago
if (this.formDataVisible.scanType == 1) {
4 months ago
this.findFromInvList('')
this.getInvList()
this.placeholder = '请点击输入框进行扫码生成业务单据'
} else {
4 months ago
this.findCurOrder()
10 months ago
}
}
10 months ago
11 months ago
}
10 months ago
}
11 months ago
}
return
})
},
11 months ago
findFromInvList(val) {
let cQuery = {
corpType: this.formDataVisible.consignee,
invCode: this.formData.invCode
4 months ago
}
findFromCorp(cQuery)
11 months ago
.then((response) => {
if (!isBlank(this.$route.query.busType) && this.formDataVisible.consignee == 2) {
4 months ago
this.invList = response.data || []
} else {
4 months ago
this.fromInvOptions = response.data || []
}
11 months ago
})
.catch(() => {
4 months ago
})
11 months ago
},
11 months ago
workPlaceCodeChange(value) {
this.getWorkBindBusTypes(value)
11 months ago
return
},
busTypeChange(value) {
4 months ago
let busType = this.busTypeList.find(item => item.documentTypeCode === value)
11 months ago
this.formData.busType = busType.documentTypeCode
this.selectBusTypeDisabled = false
this.formDataVisible = busType
if (this.formDataVisible.scanType == 1) {
4 months ago
this.findFromInvList('')
11 months ago
}
4 months ago
this.findCurOrder()
11 months ago
},
11 months ago
11 months ago
handleClick(blankName) {
// let url = window.location.origin+`#/tagCodeBlank?workplaceId=`+ this.stationList[index].workplaceId
11 months ago
let url = window.location.origin + `#/` + blankName + `?workplaceId=` + this.workplaceId
11 months ago
// this.$router.push( workplaceId)
4 months ago
window.open(url, '_blank')
11 months ago
},
handleClickOut(blankName) {
// let url = window.location.origin+`#/tagCodeBlank?workplaceId=`+ this.stationList[index].workplaceId
11 months ago
let url = window.location.origin + `#/` + blankName + `?splitType=out&workplaceId=` + this.workplaceId
// this.$router.push( workplaceId)
4 months ago
window.open(url, '_blank')
},
handleClickReturn(blankName) {
// let url = window.location.origin+`#/tagCodeBlank?workplaceId=`+ this.stationList[index].workplaceId
11 months ago
let url = window.location.origin + `#/` + blankName + `?splitType=return&workplaceId=` + this.workplaceId
// this.$router.push( workplaceId)
4 months ago
window.open(url, '_blank')
},
11 months ago
//获取当前货位
findCurWorkPlaces(val) {
let query = {
key: val,
status: 1,
// invCode: this.formData.invCode,
11 months ago
page: 1,
4 months ago
limit: 100
11 months ago
}
listPage(query).then((res) => {
4 months ago
this.curWorkPlaces = res.data.list || []
11 months ago
if (this.curWorkPlaces.length == 1 && this.formData.workPlaceCode == null) {
4 months ago
this.formData.workPlaceCode = this.curWorkPlaces[0].workplaceId
this.workPlaceCodeChange(this.formData.workPlaceCode)
11 months ago
}
})
},
//界面配置相关------------
executeFuc(row, type, clickFuc, value) {
4 months ago
return executeFuc(this, row, type, clickFuc, value)
},
executeEval(row, expression, defaultRet) {
if (expression) {
4 months ago
return eval(expression)
}
4 months ago
return defaultRet
},
///界面配置相关------------end
hideSearch() {
4 months ago
this.showSearch = !this.showSearch
},
11 months ago
refreshCodesPanel(_this) {
4 months ago
_this.panelALive = false
11 months ago
_this.$nextTick(() => {
4 months ago
_this.panelALive = true
})
// _this.getBizDetailList()
4 months ago
_this.vailOrderFinish()
11 months ago
},
refreshCodesPanelBank(_this) {
4 months ago
_this.panelALive = false
_this.$nextTick(() => {
4 months ago
_this.panelALive = true
})
// _this.getBizDetailList();
4 months ago
_this.vailOrderFinish()
},
refreshCodesPanelP() {
let _this = this
4 months ago
_this.panelALive = false
_this.$nextTick(() => {
4 months ago
_this.panelALive = true
})
_this.vailOrderFinish()
},
12 months ago
getInputFocus(event) {
4 months ago
event.currentTarget.select()
12 months ago
},
getBizDetailList() {
let preQuery = {}
4 months ago
if (this.formData == null) {
return
4 months ago
}
if (this.formData != null) {
preQuery = {
orderIdFk: this.formData.billNo
4 months ago
}
}
orderDetail(preQuery).then(res => {
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.splitBizList = res.data.list
4 months ago
let tip = ''
this.splitBizList.forEach((item) => {
if (item.splitUnCheck) {
4 months ago
tip = tip + item.cpmctymc + ','
}
4 months ago
})
if (this.$isNotBlank(tip)) {
4 months ago
tip = '请扫码确认以下产品' + tip + '需拆零的追溯码!'
// this.$alert(tip, "提示", {
// confirmButtonText: "确定",
// type: "warning",
// closeOnClickModal: true,
// callback: (action) => {
// },
// });
4 months ago
this.warnVisible = true
this.warnResult = tip
this.scanTip = '拆零确认:'
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.scanSplit = true
4 months ago
return
} else {
//没有需要确认的
this.scanSplit = false
4 months ago
this.overdeleteCode()
}
10 months ago
}).catch(() => {
4 months ago
this.$message.error('数据加载失败')
})
},
enterKey() {
4 months ago
if (this.scanCode.includes('DMOENTER')) {
6 months ago
if (this.formData.billNo == null) {
this.$message.error('请先选择单据')
4 months ago
} else {
this.confirmFinishOrder()
}
this.scanCode = ''
return
4 months ago
} else if (this.scanCode.includes('DMOCANCEL')) {
6 months ago
if (this.formData.billNo == null) {
this.$message.error('请先选择单据')
4 months ago
} else {
this.cancelOrder()
}
this.scanCode = ''
return
4 months ago
} else if (this.scanCode.includes('DMODEL')) {
6 months ago
if (this.formData.billNo == null) {
this.$message.error('请先选择单据')
4 months ago
} else {
this.deleteCode()
}
this.scanCode = ''
return
}
if (this.formData.billNo == null && this.formDataVisible.scanType != 1) {
this.enterBillNoKey()
4 months ago
return
}
4 months ago
this.checkSuccess = true
this.filterQuery.code = this.scanCode.trim()
4 months ago
this.scanCode = '';
4 months ago
if (this.filterQuery.code.includes(';')) {
const codeArray = this.filterQuery.code.split(';')
const verify = this.verifyScanCount(codeArray)
4 months ago
if (verify) {
let params = {
4 months ago
codeList: codeArray
}
this.batchVailCode(params)
}
4 months ago
return
10 months ago
}
4 months ago
if (this.filterQuery.code) {
if (!this.parseString(this.filterQuery.code)) {
4 months ago
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.$message.error('无效追溯码')
return
}
4 months ago
}
let tQuery = {
4 months ago
viewType: 'tagCode',
workPlaceCode: this.workplaceId,
originCode: this.originCode,
11 months ago
busType: this.formData.busType,
4 months ago
code: this.filterQuery.code.trim()
}
if (this.scanStatus == 1) {
4 months ago
const codeArray = this.filterQuery.code.split(';')
let query = {
orderId: this.formData.billNo,
codeList: codeArray
}
//剔除码
this.removeCodesTemp(query)
} else if (this.scanSplit) {
//todo 拆零扫码确认
4 months ago
const codeArray = this.filterQuery.code.split(';')
let query = {
8 months ago
billNo: this.formData.billNo,
codeList: codeArray
}
//更新扫码确认
batchUpdateCode(query).then((response) => {
this.saveLoading = false
if (response.code === 20000) {
this.$message.success('确认成功')
this.result = ''
this.$refs.inputRef.focus()
8 months ago
this.$refs.inputRef.select()
4 months ago
this.getBizDetailList()
} else {
this.$message.error(response.message)
}
this.loading = false
this.saveLoading = false
})
} else {
enterCodeWeb(tQuery).then((response) => {
if (response.code === 20000) {
4 months ago
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.isSuccess = true
this.printCodeResult(response.data, response.message)
4 months ago
this.filterQuery.code = response.data.code
this.scanCode = ''
this.originCode = ''
this.addCode()
} else {
if (response.code == 502) {
4 months ago
this.checkSuccess = false
this.isSuccess = false
this.printCodeResult(response.data, response.message)
4 months ago
this.filterQuery.code = response.data.code
this.originCode = response.data.code
} else if (response.code == 501) {
4 months ago
this.checkSuccess = false
this.$message.error(response.message)
this.scanCode = ''
} else if (response.code == 503) {
4 months ago
this.checkSuccess = false
this.isSuccess = false
this.printCodeResult(response.data, response.message)
4 months ago
this.filterQuery.code = response.data.code
this.scanCode = ''
this.$confirm(response.message, '提示', {
type: 'warning'
})
.then(() => {
4 months ago
this.filterQuery.code = response.data.code
this.addCode()
})
.catch(() => {
4 months ago
this.filterQuery.code = response.data.code
})
} else if (response.code == 508) {
4 months ago
this.originCode = ''
this.filterQuery.code = '01' + response.data.nameCode
this.originCode = this.filterQuery.code
} else if (response.code == 601) {
this.formData.billNo = response.data.billNo
4 months ago
this.placeholder = '已选入单据请扫UDI码进行作业'
this.getBillNo(this.formData.billNo)
4 months ago
this.startDeal()
} else {
4 months ago
this.scanCode = ''
this.$message.error(response.message)
// this.$alert(response.message, '提示', {
// confirmButtonText: '确定',
// type: 'warning',
// closeOnClickModal: true,
// callback: (action) => {
// this.$refs.inputRef.focus()
// this.$refs.inputRef.select()
// }
// })
}
}
4 months ago
this.loading = false
})
}
},
enterBillNoKey(billNo) {
4 months ago
this.checkSuccess = true
this.filterQuery.code = this.scanCode
let tQuery = {
4 months ago
viewType: 'tagCode',
workPlaceCode: this.workplaceId,
originCode: this.originCode,
busType: this.formData.busType,
4 months ago
code: this.filterQuery.code.trim()
}
if (billNo != null) {
tQuery.code = billNo
}
enterCodeBillNo(tQuery).then((response) => {
if (response.code === 20000) {
4 months ago
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.isSuccess = true
this.filterQuery.code = response.data.code
this.scanCode = ''
this.originCode = ''
this.addCode()
} else {
if (response.code == 502) {
4 months ago
this.checkSuccess = false
this.isSuccess = false
11 months ago
this.printCodeResult(response.data, response.message)
4 months ago
this.filterQuery.code = response.data.code
this.originCode = response.data.code
this.scanCode = ''
} else if (response.code == 501) {
4 months ago
this.checkSuccess = false
this.$message.error(response.message)
this.scanCode = ''
} else if (response.code == 503) {
4 months ago
this.checkSuccess = false
this.isSuccess = false
11 months ago
this.printCodeResult(response.data, response.message)
4 months ago
this.filterQuery.code = response.data.code
this.scanCode = ''
this.$confirm(response.message, '提示', {
type: 'warning'
})
.then(() => {
4 months ago
this.filterQuery.code = response.data.code
this.addCode()
})
.catch(() => {
4 months ago
this.filterQuery.code = response.data.code
})
} else if (response.code == 508) {
4 months ago
this.originCode = ''
this.filterQuery.code = '01' + response.data.nameCode
this.originCode = this.filterQuery.code
11 months ago
} else if (response.code == 601) {
4 months ago
this.placeholder = '已选入单据请扫UDI码进行作业'
this.formData.billNo = response.data.billNo
this.getBillNo(this.formData.billNo)
4 months ago
this.startDeal()
11 months ago
} else {
4 months ago
this.scanCode = ''
this.$message.error(response.message)
// this.$alert(response.message, '提示', {
// confirmButtonText: '确定',
// type: 'warning',
// closeOnClickModal: true,
// callback: (action) => {
// this.$refs.inputRef.focus()
// this.$refs.inputRef.select()
// }
// })
}
}
4 months ago
this.loading = false
})
12 months ago
},
10 months ago
addCode(code) {
if (this.$isNotBlank(code)) {
4 months ago
this.filterQuery.code = code
10 months ago
}
11 months ago
if (this.$isBlank(this.filterQuery.code)) {
4 months ago
this.filterQuery.code = this.scanCode.trim()
11 months ago
}
if (this.$isBlank(this.filterQuery.code) && this.$isBlank(this.scanCode)) {
4 months ago
return
11 months ago
}
let tagQuery = {
11 months ago
workPlaceCode: this.formData.workPlaceCode,
fromCorp: this.formData.fromCorp,
10 months ago
fromCorpName: this.formData.fromCorpName,
shipper: this.formData.shipper,
shipperName: this.formData.shipperName,
11 months ago
billNo: this.formData.billNo,
code: this.filterQuery.code.trim(),
11 months ago
insert: this.formData.insert,
4 months ago
busType: this.formData.busType
}
tagCode(tagQuery).then(res => {
this.loading = false
11 months ago
if (res.code == 20000) {
4 months ago
this.formData.tagStatus = 2
this.formData.insert = false
this.formData = res.data
this.curRow = this.formData
this.$refs.inputRef.focus()
this.bizIds = res.data.bizIds
4 months ago
this.refreshCodesPanel(this)
11 months ago
} else {
11 months ago
if (res.code == 502) {
this.showConfirmDialog(res.message + '是否强制添加?', () => {
4 months ago
this.formData.insert = true
this.addCode()
})
} else if (res.message.includes('重复扫码')) {
this.$refs.inputRef.focus()
11 months ago
} else {
4 months ago
this.$refs.inputRef.focus()
11 months ago
this.$message.error(res.message)
11 months ago
}
11 months ago
}
}).catch(() => {
this.loading = false
})
12 months ago
},
11 months ago
saveDraftOrder() {
this.$confirm('此操作将挂起当前正在处理单据,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
draftOrder(this.formData).then(res => {
this.loading = false
if (res.code == 20000) {
if (this.scanStatus == 1) {
this.overdeleteCode()
}
this.reset()
11 months ago
}
}).catch(() => {
this.loading = false
})
}).catch(() => {
4 months ago
})
11 months ago
},
10 months ago
cancelOrder() {
this.$confirm('此操作将取消当前正在处理单据,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
cancelOrder(this.formData).then(res => {
this.loading = false
if (res.code == 20000) {
4 months ago
const audio = new Audio(require('@/assets/audioFiles/colser.mp3'))
audio.play()
this.overdeleteCode()
this.reset()
10 months ago
}
}).catch(() => {
this.loading = false
})
}).catch(() => {
4 months ago
})
10 months ago
},
11 months ago
confirmFinishOrder() {
11 months ago
this.$confirm('是否确定完成此单据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
11 months ago
this.finishOrder()
11 months ago
}).catch(() => {
4 months ago
})
11 months ago
},
11 months ago
11 months ago
finishOrder() {
// 显示加载状态
11 months ago
finishOrder(this.formData).then(res => {
const loading = this.$loading({
lock: true,
text: '单据完成中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
11 months ago
this.loading = false
if (res.code == 20000) {
4 months ago
const audio = new Audio(require('@/assets/audioFiles/order.mp3'))
audio.play()
this.reset()
loading.close();
4 months ago
if (this.formDataVisible.scanType != 1) {
loading.close();
this.findCurOrder()
4 months ago
}
11 months ago
} else if (res.code == 502) {
4 months ago
loading.close();
4 months ago
if (this.formDataVisible.coercionSubmit == 1){
this.confirmDialogVisible = false
return this.$message.error("单据已经开启强制提交")
}else {
this.$confirm(res.message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.formData.confirmFinish = true
this.finishOrder()
this.reset()
}).catch(() => {
})
}
} else if (res.code == 503) {
loading.close();
11 months ago
this.$alert('该单据未全部赋码无法完成,请检查后重试', '提示', {
11 months ago
confirmButtonText: '确定',
11 months ago
callback: action => {
}
4 months ago
})
11 months ago
} else {
loading.close();
4 months ago
return this.$message.error(res.message)
11 months ago
}
}).catch(() => {
loading.close();
11 months ago
this.loading = false
})
11 months ago
},
11 months ago
updateOrder() {
4 months ago
this.formData.workPlaceCode = this.workplaceId
11 months ago
updateOrder(this.formData).then(res => {
this.loading = false
}).catch(() => {
this.loading = false
})
},
11 months ago
//选择单据
12 months ago
selectPrescribe() {
// console.log(this.formData.workPlaceCode)
if (this.$route.query.busType != null) {
11 months ago
this.formData.busType = this.$route.query.busType
}
4 months ago
this.selectPrescriptionVisible = true
12 months ago
},
11 months ago
findCurOrder() {
let nextQuery = {
busType: this.formData.busType
11 months ago
}
getCurOrder(nextQuery).then(res => {
this.loading = false
if (res.code == 20000) {
4 months ago
let temp = res.data
11 months ago
if (temp.tagStatus === -1) {
this.$confirm('检测到当前工位存在挂起单据,是否继续上一次单据处理?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
4 months ago
this.formData = temp
// this.generateBarcode()
4 months ago
this.startDeal()
11 months ago
}).catch(() => {
4 months ago
})
} else if (temp.tagStatus === 2 || temp.tagStatus === 1) {
10 months ago
4 months ago
this.formData = temp
// this.generateBarcode()
this.panelALive = true
4 months ago
this.startDeal()
11 months ago
}
11 months ago
} else {
// this.$message.error(res.message)
4 months ago
this.$refs.inputRef.focus()
11 months ago
}
}).catch(() => {
this.loading = false
})
},
12 months ago
closeDialog() {
4 months ago
this.selectPrescriptionVisible = false
12 months ago
},
12 months ago
confirmSelect(row) {
4 months ago
this.formData = row
this.formData.workPlaceCode = this.workplaceId
this.bizIds = []
4 months ago
this.startDeal()
// this.generateBarcode()
11 months ago
},
startDeal() {
4 months ago
this.autoFinishOrderFlag = false
4 months ago
this.curRow = this.formData
11 months ago
this.dealSplitOrder()
11 months ago
//处理哪个活动的明细子组件
// this.selectTabsname(this.formData.busType);
4 months ago
this.formData.tagStatus = 2
this.updateOrder()
this.selectSysParam()
11 months ago
// this.refreshCodesPanel(this);
4 months ago
this.$refs.inputRef.focus()
},
10 months ago
11 months ago
selectTabsname(value) {
if (this.$isBlank(this.filterQuery.code) && this.busTypeList.length > 0) {
4 months ago
let busType = this.busTypeList.find(item => item.documentTypeCode === value)
let autoTag = busType.autoTag
11 months ago
if (autoTag == 1) {
11 months ago
this.editableTabsValue = this.tabsName[1]
}
}
},
11 months ago
//开始拆零
dealSplitOrder() {
4 months ago
this.formData.workPlaceCode = this.workplaceId
11 months ago
startSplit(this.formData).then(res => {
this.loading = false
if (res.code == 20000) {
4 months ago
this.selectPrescriptionVisible = false
this.refreshCodesPanel(this)
} else if (res.code == 501) {
4 months ago
this.$refs.childRef.getList()
this.$refs.childRef.getDraftList()
this.$refs.childRef.getOtherList()
this.$message.warning(res.message)
4 months ago
this.refreshCodesPanel(this)
11 months ago
}
}).catch(() => {
this.loading = false
})
},
11 months ago
printCodeResult(data, message) {
4 months ago
const resultParts = []
if (data.udi) {
4 months ago
resultParts.push('层级标识: ' + data.udi)
}
if (data.cpmctymc) {
4 months ago
resultParts.push(data.productType == 2 ? '药品通用名称' : '产品通用名称: ' + data.cpmctymc)
}
if (data.batchNo) {
4 months ago
resultParts.push('批次号: ' + data.batchNo)
}
if (data.produceDate) {
4 months ago
resultParts.push('生产日期: ' + data.produceDate)
}
if (data.expireDate) {
4 months ago
resultParts.push('失效日期: ' + data.expireDate)
}
if (data.serialNo) {
4 months ago
resultParts.push('序列号: ' + data.serialNo)
}
if (data.productType == 2) {
if (data.bzgg) {
4 months ago
resultParts.push('包装规格: ' + data.bzgg)
}
} else {
if (data.ggxh) {
4 months ago
resultParts.push('规格型号: ' + data.ggxh)
}
}
if (data.prepnSpec) {
4 months ago
resultParts.push('制剂规格: ' + data.prepnSpec)
}
if (data.prepnUnit) {
4 months ago
resultParts.push('剂型: ' + data.prepnUnit)
}
if (data.packUnit) {
4 months ago
resultParts.push('计量单位: ' + data.packUnit)
}
4 months ago
this.scanTitle = '扫码结果:' + data.code
this.result = resultParts.join(' , ')
11 months ago
if (message == 'success') {
4 months ago
this.scanResultType = 'success'
11 months ago
} else {
4 months ago
this.scanResultType = 'warning'
this.result = this.result + '\n' + message
11 months ago
}
11 months ago
},
10 months ago
popupTip(data) {
this.$confirm(data.errMsg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.formData.insert = true
4 months ago
this.addCode(data.code)
10 months ago
}).catch(() => {
4 months ago
})
10 months ago
},
10 months ago
vailOrderFinish() {
if (!this.autoFinishOrderFlag) {
return
}
4 months ago
if (this.formDataVisible.scanType == 1) {
return
}
10 months ago
vailOrderFinish(this.formData).then(res => {
this.loading = false
if (res.code == 20000) {
if (res.data) {
this.confirmMessage = '单据已赋码或可自动赋码,是否立即完成单据?'
this.confirmCallback = () => {
4 months ago
this.finishOrder()
}
this.confirmDialogVisible = true
this.$once('hook:beforeDestroy', () => {
this.autoFinishOrderFlag = false
4 months ago
})
10 months ago
}
} else {
this.autoFinishOrderFlag = false
10 months ago
}
}).catch(() => {
this.loading = false
})
},
10 months ago
async printMutiCodeResult(vailCodeResultResponses) {
4 months ago
this.warnResult = ''
this.errResult = ''
this.result = ''
this.warnVisible = false
this.errVisible = false
10 months ago
for (let i = 0; i < vailCodeResultResponses.length; i++) {
let data = vailCodeResultResponses[i]
4 months ago
if (data.status == 1) {
this.result = this.result + ';' + vailCodeResultResponses[i].code
} else if (data.status == 2) {
this.warnResult = this.warnResult + '\n' + vailCodeResultResponses[i].code + ':' + vailCodeResultResponses[i].errMsg
10 months ago
} else if (data.status == 3) {
4 months ago
this.result = this.result + '\n' + vailCodeResultResponses[i].code
10 months ago
// this.warnResult = this.warnResult + "\n" + vailCodeResultResponses[i].code + ":" + vailCodeResultResponses[i].errMsg;
await this.popupTip(data)
}
// else
// this.errResult = this.errResult + "\n" + vailCodeResultResponses[i].code + ":" + vailCodeResultResponses[i].errMsg;
}
4 months ago
if (!isBlank(this.warnResult)) {
this.warnVisible = true
}
if (!isBlank(this.errResult)) {
this.errVisible = true
}
10 months ago
},
11 months ago
handleCommand(command) {
11 months ago
// this.$message('click on item ' + command);
11 months ago
},
4 months ago
verifyScanCount(codeArray) {
//判断扫码数量是否超出或少于设置扫码数量
if (this.collectSet.scanMaxCount != null && this.collectSet.scanMaxCount != 0) {
if (this.collectSet.scanMaxCount > codeArray.length) {
this.scanCode = ''
4 months ago
this.$message.error('扫码数量少于设置扫码数量')
return false
} else if (this.collectSet.scanMaxCount < codeArray.length) {
this.scanCode = ''
4 months ago
this.$message.error('扫码数量超出')
return false
}
}
4 months ago
return true
},
11 months ago
clearCode() {
6 months ago
// this.originCode = "";
// this.formData.code = "";
// this.formData.billNo = null;
// this.formData.shipper = null;
// this.formData.fromCorp = null;
4 months ago
this.scanCode = ''
6 months ago
// this.scanTitle = "扫码结果:";
// this.result = "";
// this.warnResult = ""
// this.errResult = ""
// this.warnVisible = false
// this.errVisible = false
11 months ago
},
/**
* 重置
*/
resetWork() {
this.formData = {
tagStatus: -1,
workPlaceCode: this.formData.workPlaceCode,
busType: this.formData.busType
4 months ago
}
11 months ago
this.curRow = null
4 months ago
this.formData.confirmFinish = false
11 months ago
this.refreshCodesPanel(this)
this.clearCode()
4 months ago
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
11 months ago
},
9 months ago
reset() {
this.formData = {
billNo: null,
tagStatus: -1,
workPlaceCode: this.formData.workPlaceCode,
busType: this.formData.busType,
shipper: null,
4 months ago
fromCorp: null
}
this.selectSysParam()
this.curRow = null
4 months ago
this.formData.confirmFinish = false
this.refreshCodesPanelBank(this)
this.clearCode()
4 months ago
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.bizIds = []
},
toggleBusType() {
//隐藏下拉框内容
// this.$refs.selectHeadEmpId.blur();
this.selectBusTypeDisabled = true
},
getInvList() {
let query = {
4 months ago
advanceType: 1
}
getInvListByUser(query)
.then((response) => {
if (!isBlank(this.$route.query.busType) && this.formDataVisible.consignee == 2) {
4 months ago
this.fromInvOptions = response.data || []
} else {
this.invList = response.data || []
}
})
.catch(() => {
})
},
changeCorp() {
4 months ago
let corp = this.fromInvOptions.find(item => item.code === this.formData.fromCorp)
this.formData.fromCorpName = corp.name
},
8 months ago
changeShipper() {
4 months ago
let corp = this.invList.find(item => item.code === this.formData.shipper)
this.formData.shipperName = corp.name
this.formData.shipper = corp.code
},
10 months ago
//处理事件
handleRecCodesEvent(event) {
4 months ago
console.log('接收 recCodes event:', event.detail.recCodes)
10 months ago
let params = {
4 months ago
codeList: event.detail.recCodes
}
10 months ago
if (this.formData.billNo == null) {
4 months ago
this.$message.error('请先选入单据!')
10 months ago
return
}
const verify = this.verifyScanCount(event.detail.recCodes)
4 months ago
if (verify) {
this.batchVailCode(params)
}
},
batchVailCode(params) {
if (this.scanStatus == 1) {
//剔除
const codeArray = this.filterQuery.code.split(';')
// const codeArray = this.codeFormData.code.split(';')
let query = {
orderId: this.formData.billNo,
codeList: codeArray
}
//剔除码
this.removeCodesTemp(query)
} else {
batchVailCode(params).then((res) => {
if (res.code === 20000) {
4 months ago
this.valiCodes = []
let list = res.data
list.forEach(item => {
if (item.status === 1) {
4 months ago
this.valiCodes.push(item.code)
10 months ago
}
4 months ago
})
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.printMutiCodeResult(list)
if (this.valiCodes != null && this.valiCodes.length > 0) {
//批量添加
let params2 = {
workPlaceCode: this.formData.workPlaceCode,
codeList: this.valiCodes,
fromCorp: this.formData.fromCorp,
billNo: this.formData.billNo,
insert: this.formData.insert,
busType: this.formData.busType,
fromCorpName: this.formData.fromCorpName,
4 months ago
invCode: this.formData.invCode
}
orderbatchAddCode(params2).then((res) => {
if (res.code === 20000) {
4 months ago
this.formData.tagStatus = 2
this.formData.insert = false
this.curRow = this.formData
this.$refs.inputRef.focus()
this.bizIds = res.data.collectOrder.bizIdList
4 months ago
this.refreshCodesPanel(this)
this.printMutiCodeResult(res.data.vailCodeResultResponses)
} else {
this.$message.error(res.message)
}
4 months ago
})
// this.scanCode = this.valiCodes.join(";");
}
this.selectSysParam()
} else {
this.$message.error(res.message)
10 months ago
}
4 months ago
})
}
10 months ago
},
removeCodesTemp(query) {
9 months ago
removeByScanCode(query).then(res => {
if (res.code == 20000) {
this.$message.success('剔除成功')
this.scanCode = ''
this.panelALive = false
this.$nextTick(() => {
this.panelALive = true
})
this.result = ''
} else if (res.code == 501) {
9 months ago
} else {
this.result = ''
this.scanCode = ''
this.$message.error(res.message)
10 months ago
}
})
10 months ago
},
10 months ago
//扫码校验
addGs() {
4 months ago
const input = this.$refs.inputRef.$refs.input
const textToInsert = '\u001D'
const start = input.selectionStart
const end = input.selectionEnd
this.scanCode = this.scanCode.slice(0, start) + textToInsert + this.scanCode.slice(end)
10 months ago
this.$nextTick(() => {
4 months ago
this.focus = true
input.selectionStart = input.selectionEnd = start + textToInsert.length
this.$refs.inputRef.focus()
})
},
10 months ago
handleScanComplete(fullScanData) {
4 months ago
console.log('Scan complete:', fullScanData.join(';'))
if (this.formData.billNo == null && this.formDataVisible.scanType != 1) {
this.enterBillNoKey(fullScanData[0])
4 months ago
return
}
let params = {
4 months ago
codeList: fullScanData
}
if (this.formData.billNo == null) {
4 months ago
this.$message.error('请先选入单据!')
return
}
4 months ago
const verify = this.verifyScanCount(fullScanData)
if (verify) {
this.batchVailCode(params)
}
// 在这里处理完整的扫码数据,如提交到后台或显示
},
10 months ago
parseString(str) {
// 1. 判断是否以 "MA" 开头
4 months ago
if (str.startsWith('MA')) {
return true
10 months ago
}
10 months ago
// 2. 判断是否以 "01" 开头且长度大于等于 18
4 months ago
if (str.startsWith('01') && str.length >= 16) {
return true
10 months ago
}
10 months ago
// 3. 判断是否以 "#" 开头且 "#" 的个数大于等于 4
4 months ago
if (str.startsWith('#') && (str.match(/#/g) || []).length >= 4) {
return true
10 months ago
}
10 months ago
// 4. 判断是否以 "8" 开头且长度为 20 位
4 months ago
if (str.startsWith('8') && str.length === 20) {
return true
10 months ago
}
// 5. 判断是否以 "11", "17", "21", 或 "10" 开头
4 months ago
const prefixes = ['11', '17', '21', '10']
if (prefixes.some(prefix => str.startsWith(prefix))) {
4 months ago
return true
}
10 months ago
// 如果没有任何条件满足,返回 false
4 months ago
return false
},
socketListener() {
4 months ago
let lastScanTime = Date.now()
let scanBuffer = []
let scanTimeout = null
const SCAN_TIMEOUT = 1000 // 1秒间隔表示扫码结束的判定标准
const self = this
console.log('启用监听')
this.ws.onmessage = function (event) {
4 months ago
let scanData = event.data // 获取扫码数据
let currentTime = Date.now()
console.log(scanData)
// 如果时间间隔超过预设的阈值,表示这是一次新的扫码
if (currentTime - lastScanTime > SCAN_TIMEOUT) {
// 处理上一次完整的扫码数据
if (scanBuffer.length > 0) {
4 months ago
self.handleScanComplete(scanBuffer)
}
// 清空缓冲区,开始新的扫码
4 months ago
scanBuffer = []
}
// 重置上一次扫码的时间
4 months ago
lastScanTime = currentTime
// 将数据添加到缓冲区
4 months ago
scanBuffer.push(scanData)
// 如果已经有一个定时器在等待,可以清除它
if (scanTimeout) {
4 months ago
clearTimeout(scanTimeout)
}
// 设置新的定时器,等待指定的时间后执行扫码结束处理
scanTimeout = setTimeout(() => {
// 定时器到时,处理扫码结束
4 months ago
self.handleScanComplete(scanBuffer)
scanBuffer = []
}, SCAN_TIMEOUT)
}
},
handleVisibilityChange() {
if (document.visibilityState === 'visible') {
4 months ago
console.log('用户切回到了处理页面')
if (this.ws == null || this.ws.readyState === WebSocket.CLOSED) {
4 months ago
this.ws = new WebSocket('ws://127.0.0.1:9988')
const self = this
this.ws.onopen = function (evt) {
4 months ago
console.log('处理单据WebSocket 连接中 ...')
self.socketListener()
4 months ago
}
}
} else {
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
4 months ago
this.ws.close()
console.log('关闭处理单据websocket成功')
}
}
},
//扫码剔除操作
deleteCode() {
4 months ago
this.scanTip = '扫码剔除:'
this.labelName = 2
4 months ago
this.placeholder = '请点击输入框进行扫码剔除'
this.scanStatus = 1
this.scanCode = ''
9 months ago
if (!isBlank(this.warnResult)) {
4 months ago
this.warnResult = ''
}
// const myArray = [
// "84220990282456138381",
// "84220990282456138381",
// "84220990282456138381",
// "84220990282456138381",
// "84220990282456138381",
// "84220990282456138381",
// "84220990282456138381",
// "84220990282456138381",
// "84220990282456439935",
// "84220990282456282493",
// "83585071394030600368",
// "83585071394028644586",
// "81291510961213731914",
// "81291510961212834683"
// ];
//
//
// for (let i = 0; i < myArray.length; i++) {
// const code = myArray[i];
// this.scanCode = code;
// this.filterQuery.code = code;
// this.addCode(code);
// }
},
overdeleteCode() {
8 months ago
this.warnVisible = false
4 months ago
this.warnResult = ''
this.labelName = 1
this.scanStatus = null
4 months ago
this.scanTip = '扫码录入:'
this.placeholder = '请点击输入框进行选扫码'
},
selectSysParam() {
getSet().then((response) => {
if (response.code == 20000) {
this.collectSet = response.data
}
})
},
4 months ago
handleKeydown(event) {
if (this.formData.billNo != null) {
if (event.key === 'F9' || event.keyCode === 120) {
event.preventDefault() // 阻止默认行为
if (this.confirmDialogVisible) {
this.handleConfirm()
return
} else {
this.finishOrder()
4 months ago
MessageBox.close()
}
}
if (event.key === 'F10' || event.keyCode === 121) {
4 months ago
event.preventDefault() // 阻止默认行为(如果有的话)
// this.push();
cancelOrder(this.formData).then(res => {
this.loading = false
if (res.code == 20000) {
4 months ago
const audio = new Audio(require('@/assets/audioFiles/colser.mp3'))
audio.play()
this.overdeleteCode()
this.reset()
}
}).catch(() => {
this.loading = false
})
}
}
4 months ago
}
11 months ago
},
mounted() {
4 months ago
this.$refs.inputRef.focus()
document.addEventListener('keydown', this.handleKeydown)
10 months ago
//环境判断
4 months ago
if (window.navigator.userAgent.indexOf('GLXP_PC') != -1) {
this.scanDisabled = true
window.removeEventListener('djcl', this.handleRecCodesEvent)
window.addEventListener('djcl', this.handleRecCodesEvent)
10 months ago
}
4 months ago
document.addEventListener('visibilitychange', this.handleVisibilityChange)
// window.addEventListener('storage', (event) => {
// if (document.visibilityState == 'hidden') {
// console.log("关闭处理单据websocket")
// if (this.ws && this.ws.readyState === WebSocket.OPEN) {
// this.ws.close();
// console.log("关闭处理单据websocket成功")
// }
// } else {
// if (!this.ws) {
// this.ws = new WebSocket("ws://127.0.0.1:9988");
// this.ws.onopen = function (evt) {
// console.log("处理单据WebSocket 连接中 ...");
// };
// this.socketListener()
// }
// }
// });
10 months ago
},
10 months ago
beforeDestroy() {
4 months ago
document.removeEventListener('keydown', this.handleKeydown)
window.removeEventListener('djcl', this.handleRecCodesEvent)
document.removeEventListener('visibilitychange', this.handleVisibilityChange)
if (this.ws != null){
this.ws.close()
this.ws.onclose = function (evt) {
console.log('处理单据 Connection closed.')
}
4 months ago
}
},
created() {
4 months ago
getHead('prescribeTagCodeDeal', '1').then((re) => {
// 处理返回的数据
4 months ago
this.tableObj = re.data
this.tableHeader = re.data.tableList
this.queryList = re.data.queryList
this.fromList = re.data.fromList
})
this.findCurWorkPlaces()
this.selectSysParam()
this.formData.invCode = this.$store.getters.locInvCode
if (this.$route.query.billNo != null) {
this.formData.billNo = this.$route.query.billNo
}
11 months ago
if (this.$route.query.workplaceId != null) {
this.isLinkDisabled = true
11 months ago
if (this.$route.query.billNo == null) {
11 months ago
// this.selectBusTypeDisabled = true
11 months ago
}
11 months ago
this.corpOrderIdDisabled = true
4 months ago
this.workplaceId = Number(this.$route.query.workplaceId)
this.formData.workPlaceCode = Number(this.$route.query.workplaceId)
this.getWorkBindBusTypes(this.formData.workPlaceCode)
11 months ago
}
}
}
</script>
<style scoped>
12 months ago
.el-col {
margin-top: -5px;
margin-bottom: -5px;
}
11 months ago
.el-dropdown {
vertical-align: top;
}
11 months ago
.el-dropdown + .el-dropdown {
margin-left: 15px;
}
11 months ago
.el-icon-arrow-down {
font-size: 12px;
}
.custom-descriptions {
position: relative; /* 设置相对定位,为绝对定位的边框线提供参考 */
}
.custom-input-height {
height: 40px !important; /* 设置高度 */
}
.barcode-wrapper {
display: flex;
flex-direction: column;
align-items: center; /* 水平居中 */
justify-content: center; /* 垂直居中 */
}
4 months ago
.custom-descriptions .el-descriptions__cell svg {
vertical-align: middle;
margin-left: 20px;
margin-right: 10px;
}
.no-enter-dialog {
pointer-events: auto !important;
}
.no-enter-dialog .el-message-box__btns .el-button {
pointer-events: auto !important;
}
</style>