diff --git a/src/api/collect/collectOrder.js b/src/api/collect/collectOrder.js index 1a289cf6..eac140ca 100644 --- a/src/api/collect/collectOrder.js +++ b/src/api/collect/collectOrder.js @@ -326,3 +326,13 @@ export function returnOrderSubmit(query) { data: query }); } + + + +export function finishReturnOrder(query) { + return axios({ + url: "/udiwms/basic/collect/order/finishReturnOrder", + method: "post", + data: query + }); +} diff --git a/src/views/collect/CollectOrderTabs.vue b/src/views/collect/CollectOrderTabs.vue index 97fcb577..e44fc298 100644 --- a/src/views/collect/CollectOrderTabs.vue +++ b/src/views/collect/CollectOrderTabs.vue @@ -88,11 +88,19 @@ <span slot="title">单据上传</span> </el-menu-item> + <el-menu-item :index=18 @click="clickMenuItem(18)" v-if="workPlaceClass == 1"> + <span slot="title">处方退货</span> + </el-menu-item> + <el-menu-item :index=1 @click="clickMenuItem(1)" v-if="workPlaceClass == 2 && jobMode == 0"> <span slot="title">工位上货</span> </el-menu-item> + + + + <el-menu-item :index=15 @click="clickMenuItem(15)" v-if="workPlaceClass == 2 && jobMode == 1"> <span slot="title">拆零上货</span> @@ -343,6 +351,8 @@ import IoSplitFifoRemove from '@/views/collect/IoSplitFifoRemove.vue' import IoSplitCreateOrder from '@/views/collect/IoCreateOrder.vue' import IoFullCreateOrder from '@/views/collect/IoCreateOrder.vue' import IosplitFifoStock from '@/views/collect/IosplitFifoStock.vue' +import IoReturncllectOrder from '@/views/collect/IoReturncllectOrder.vue' + // 导入器械相关工位上货页面 @@ -385,6 +395,7 @@ export default { IoSplitFifoRemove, IoSplitCreateOrder, IosplitFifoStock, + IoReturncllectOrder, //器械页面 DevicesDealOrder, @@ -601,6 +612,15 @@ export default { componentProps: { } }, + { + number: 18, + title: '单据退货', + name: 'IoReturncllectOrder', + component: IoReturncllectOrder, + // 假设你需要传递的参数 + componentProps: { + } + }, //器械页面 { diff --git a/src/views/collect/IoReturnOrderBiz.vue b/src/views/collect/IoReturnOrderBiz.vue new file mode 100644 index 00000000..4fe205d2 --- /dev/null +++ b/src/views/collect/IoReturnOrderBiz.vue @@ -0,0 +1,329 @@ +<template> + <div> + <el-table :data="preDetailList" highlight-current-row="true" border ref="multipleTable" size="100" + :row-style="{ height: '60px' }" + :cell-style="{ padding: '0' }" + > + <el-table-column label="赋码状态" prop="cpmctymc"> + <template v-slot="scope"> + <div style="text-align: center;"> + <el-tag :type="getTagColor(scope.row)" size="26"> + {{ codingStatus }} + </el-tag> + </div> + </template> + </el-table-column> + <el-table-column label="产品通用名" prop="cpmctymc"> + <template v-slot="scope"> + <div :style="{ fontSize: '16px' }">{{ scope.row.cpmctymc }}</div> + </template> + </el-table-column> + <el-table-column label="退药数量" prop="count"> + <template v-slot="scope"> + <div :style="{ fontSize: '26px' }">{{ scope.row.count }}</div> + </template> + </el-table-column> + <el-table-column label="应扫码数量" prop="scanActCount"> + <template v-slot="scope"> + <div :style="getCellStyle(scope.row)" style="display: flex; align-items: center; height: 100%; min-height: 40px;"> + {{ + scope.row.shouldCount === 0 + ? '无需扫码' + : `${scope.row.scanCount}/${scope.row.shouldCount}` + }} + </div> + </template> + </el-table-column> + <el-table-column label="制剂规格" prop="prepnSpec"> + <template v-slot="scope"> + <div :style="{ fontSize: '16px' }">{{ scope.row.prepnSpec }}</div> + </template> + </el-table-column> + <el-table-column label="包装规格" prop="spec"> + <template v-slot="scope"> + <div :style="{ fontSize: '16px' }">{{ scope.row.spec }}</div> + </template> + </el-table-column> + + <!--<el-table-column label="产品标识" prop="nameCode" width="120"></el-table-column> fixed="right"--> + <el-table-column label="医保编码" prop="ybbm" width="240"> + <template v-slot="scope"> + <div :style="{ fontSize: '16px' }">{{ scope.row.ybbm }}</div> + </template> + </el-table-column> + <el-table-column label="批次号" prop="batchNo"> + <template v-slot="scope"> + <div :style="{ fontSize: '16px' }">{{ scope.row.batchNo }}</div> + </template> + </el-table-column> + + > + <el-table-column + fixed="right" + label="操作" + width="120" + > + <template slot-scope="scope"> + <el-button type="primary" @click="scanDetail(scope.row)" style="font-size: 14px" + :disabled="scope.row.scanCount == null || scope.row.scanCount == 0 " + > + 扫码明细({{ scope.row.scanCount == null ? 0 : scope.row.scanCount }}) + </el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="preTotal>0" + :total="preTotal" + :limit.sync="preQuery.limit" + :page.sync="preQuery.page" + @pagination="preHandleCurrentChange" + ></pagination> + + + <el-dialog + title="扫码明细" + :visible.sync="scanDetailVisible" + :close-on-click-modal="false" + :close-on-press-escape="false" + v-if="scanDetailVisible" + width="65%" + append-to-body + > + <PanelOrderManuTagCode + :fifoSplit="3" + :prescribeData="prescribeData" + :bizId="bizId" + :closeScanDialog="closeScanDialog" + ></PanelOrderManuTagCode> + </el-dialog> + + </div> +</template> + +<script> +import { convertDate } from '@/utils/date' +import { detail } from '@/api/basic/sicker/prescribeApi' +import { executeFuc, getHead } from '@/utils/customConfig' +import { orderDetail, codeRemove } from '@/api/collect/collectOrder' +import PanelOrderManuTagCode from '@/views/collect/PanelOrderManuTagCode' + +/** + * 处方退药码明细 + */ +export default { + name: 'IoReturnOrderBiz', + props: { + prescribeData: { + type: Object, + default: null, + required: true + }, + dealStatus: { + type: Number, + default: 1, + required: true + }, + }, + data() { + return { + //界面配置相关 + //原始处方明细 + tableHeader1: [], + queryList1: [], + tableObj1: [], + fromList1: [], + convertDateFun: convertDate, + + preLoading: false, + preDetailList: [], + preTotal: 0, + preQuery: { + orderIdFk: null, + page: 1, + limit: 10 + }, + + countVisible: false, + scanDetailVisible: false, + bizId: null, + codingStatus: '已赋码' + } + }, + methods: { + deleteMan(_this, row) { + _this.$confirm('是否确定删除该条扫码?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + _this.loading = true + _this.codeRemoveMan(row.id, 2) + }) + }, + deleteCode(_this, row) { + _this.$confirm('是否确定移除一个条码?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + _this.loading = true + _this.codeRemoveMan(row.id, 1) + }) + }, + codeRemoveMan(codeManId, delType) { + let post = { + codeManId: codeManId, + delType: delType + } + codeRemove(post).then((response) => { + if (response.code === 20000) { + this.$message.success('操作成功!') + this.getList(this) + } else { + this.$message.error(response.message) + } + this.loading = false + }).catch(() => { + this.loading = false + }) + }, + //界面配置-------------end + executeFuc(row, type, clickFuc, value) { + return executeFuc(this, row, type, clickFuc, value) + }, + executeEval(row, expression, defaultRet) { + if (expression) { + return eval(expression) + } + return defaultRet + }, + handleSortChange(column, prop, order) { + if (column.order === 'descending') { + this.query.sort = 'desc' + } else { + this.query.sort = 'asc' + } + this.query.orderBy = column.prop + this.getList() + }, + ///界面配置相关------------end + + preHandleCurrentChange(val) { + this.filterQuery.page = val.page + this.getPrescribeDetail(this, null) + }, + getPrescribeDetail(_this) { + + if (_this.prescribeData == null) { + return + } + if (_this.prescribeData != null) { + _this.preQuery.page = 1 + _this.preQuery.orderIdFk = this.prescribeData.billNo + } + _this.preLoading = true + orderDetail(_this.preQuery).then(res => { + _this.preLoading = false + if (res.code != 20000) { + _this.$message.error(res.message) + return + } + _this.preDetailList = res.data.list + _this.preLoading = false + }).catch(() => { + _this.preLoading = false + _this.$message.error('数据加载失败') + }) + }, + + scanDetail(row) { + this.bizId = row.id + this.scanDetailVisible = true + }, + + closeScanDialog() { + this.getPrescribeDetail(this) + this.refreshPanel(this) + }, + + rowStyle({ row, rowIndex }) { + let rowBackground = {} + rowBackground.fontSize = '16px' + rowBackground.height = '50px' + if (row.scanActCount < row.count) { + rowBackground.color = '#F56C6C' + } + if (row.autoTagStatus == 2) { + rowBackground.color = '#E6A23C' + } + if (row.scanActCount >= row.count) { + rowBackground.color = '#56a717' + } + return rowBackground + }, + + getCellStyle(row) { + let cellStyle = { + fontSize: '50px' + } + if (row.shouldCount == 0) { + cellStyle.fontSize = '30px' + cellStyle.color = '#F56C6C' + return cellStyle + } + if (row.scanCount < row.shouldCount) { + cellStyle.color = '#F56C6C' + } else if (row.scanCount === row.shouldCount) { + cellStyle.color = '#56a717' + } + return cellStyle + }, + // cellStyle({ row, column, rowIndex, columnIndex }) { + // return { height: '60px' }; + // }, + getTagColor(row) { + if (row.scanActCount < row.count) { + this.codingStatus = '未赋码' + return 'danger' // 红色 + } else if (row.autoTagStatus == 2) { + this.codingStatus = '预赋码' + return 'warning' // 黄色 + } else if (row.scanActCount >= row.count) { + this.codingStatus = '已赋码' + return 'success' // 绿色 + } + } + + }, + + components: { + PanelOrderManuTagCode + }, + created() { + if (this.tableHeader1 == null || this.tableHeader1.length == 0) { + getHead('prescribeOriginPanel', '1').then((re) => { + // 处理返回的数据 + this.tableObj1 = re.data + this.tableHeader1 = re.data.tableList + this.queryList1 = re.data.queryList + this.fromList1 = re.data.fromList + this.getPrescribeDetail(this) + }) + } + this.getPrescribeDetail(this) + if (this.dealStatus == 1) { + this.countVisible = false + } else { + this.countVisible = true + } + } + +} +</script> + +<style scoped> + + +</style> diff --git a/src/views/collect/IoReturncllectOrder.vue b/src/views/collect/IoReturncllectOrder.vue new file mode 100644 index 00000000..f1ca6455 --- /dev/null +++ b/src/views/collect/IoReturncllectOrder.vue @@ -0,0 +1,1754 @@ +<template> + <div> + <el-form :model="formData" class="order-el-form" ref="formData" label-width="120px" @submit.native.prevent> + <el-card> + + + <el-row style="margin-top: 6px;margin-bottom: -6px;" + v-if="this.formDataVisible != null && this.formDataVisible.scanType == 1" + > + <!-- <el-col :span="6">--> + <!-- <el-form-item prop="workPlaceCode" class="query-form-item" label="当前工位:">--> + <!-- <el-select--> + <!-- v-model="formData.workPlaceCode"--> + <!-- placeholder="当前工位"--> + <!-- style="width: 90%"--> + <!-- :disabled="corpOrderIdDisabled"--> + <!-- filterable--> + <!-- @change="workPlaceCodeChange"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in curWorkPlaces"--> + <!-- :key="item.workplaceId"--> + <!-- :label="item.workplaceName"--> + <!-- :value="item.workplaceId"--> + <!-- >--> + <!-- <span style="float: left">{{ item.workplaceName }}</span>--> + <!-- <span style="float: right; color: #8492a6; font-size: 13px">{{--> + <!-- item.workplaceId--> + <!-- }}</span>--> + <!-- </el-option>--> + <!-- </el-select>--> + <!-- </el-form-item>--> + <!-- </el-col>--> + + <!-- <el-col :span="6">--> + <!-- <el-form-item prop="busType" class="query-form-item" label="当前业务类型:">--> + <!-- <el-select v-model="formData.busType"--> + <!-- filterable--> + <!-- remote--> + <!-- @change="busTypeChange"--> + <!-- reserve-keyword--> + <!-- disabled--> + <!-- placeholder="请选择业务类型" clearable style="width: 55%">--> + <!-- <el-option--> + <!-- v-for="item in busTypeList"--> + <!-- :key="item.documentTypeCode"--> + <!-- :label="item.busName"--> + <!-- :value="item.documentTypeCode"--> + <!-- >--> + <!-- <span style="float: left">{{ item.busName }}</span>--> + <!-- <span style="float: right; color: #8492a6; font-size: 13px">{{ item.documentTypeCode }}</span>--> + <!-- </el-option>--> + <!-- </el-select>--> + <!-- <el-button type="primary" @click="toggleBusType" style="margin-left: 5px">切换业务</el-button>--> + <!-- </el-form-item>--> + <!-- </el-col>--> + <el-col :span="6"> + <el-form-item prop="locInvCode" label="发货方:"> + <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" + :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 + ':'"--> + <el-form-item class="query-form-item" label="收货方:"> + <el-select v-model="formData.fromCorp" + filterable + :disabled="formData.billNo" + remote + reserve-keyword + @change="changeCorp" + placeholder="请选择收货方" clearable style="width: 90%" + > + <el-option + v-for="item in fromInvOptions" + :key="item.code" + :label="item.name" + :value="item.code" + > + <span style="float: left">{{ item.name }}</span> + <span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span> + </el-option> + </el-select> + </el-form-item> + </el-col> + + </el-row> + + + <div style="margin-top: 1px;padding: 5px"> + <el-row :gutter="0" style="margin-top: 5px"> + + <el-col :span="16"> + <!--:label="scanTip" --> + <el-form-item prop="code" :label="scanTip" label-width="80px"> + + <el-input + id="inputer" + @focus="getInputFocus($event)" + @keypress.enter.native="enterKey($event)" + ref="inputRef" + style="ime-mode: disabled" + type="tel" + :placeholder="this.placeholder" + v-model="scanCode" + size="50" + ></el-input> + </el-form-item> + </el-col> + + <el-col :span="8"> + <el-button-group style="display: flex; margin-left: 15px;height: 36px"> + <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="cancelOrder()" + >放弃 + </el-button> + <el-button + type="primary" + :disabled="!formData.billNo" + @click.native="saveDraftOrder()" + >挂起 + </el-button> + <el-button + type="primary" + :disabled="!formData.billNo" + @click.native="confirmFinishOrder()" + >退货完成 + </el-button> + </el-button-group> + </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> + </el-col> + </el-row> + <!--<el-alert--> + <!-- :title="scanTitle"--> + <!-- :type="scanResultType"--> + <!-- :closable="false"--> + <!-- :dangerouslyUseHTMLString="true"--> + <!-- :description="result">--> + <!--</el-alert>--> + <!--<el-alert--> + <!-- v-if="warnVisible"--> + <!-- title="警告信息:"--> + <!-- type="warning"--> + <!-- :closable="true"--> + <!-- :dangerouslyUseHTMLString="true"--> + <!-- :description="warnResult">--> + <!--</el-alert>--> + <!--<el-alert--> + <!-- v-if="errVisible"--> + <!-- title="错误信息:"--> + <!-- type="warning"--> + <!-- :closable="true"--> + <!-- :dangerouslyUseHTMLString="true"--> + <!-- :description="errResult">--> + <!--</el-alert>--> + + + </div> + <!--<el-descriptions title="单据信息" :column="4" border style="margin-top: 15px" class="custom-descriptions">--> + <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> + <!--<div id="qrcode-container" ref="barcodeContainer" style="margin-right: 38px;padding-bottom: 30px"></div>--> + <!--<svg ref="barcodeContainer"></svg>--> + </el-card> + + <el-tabs type="border-card" style="margin: 15px" v-model="editableTabsValue"> + <!--<el-tab-pane label="扫码详情" name="prescribeOriginPanel">--> + <IoReturnOrderBiz + v-if="panelALive" + :prescribeData="curRow" + ></IoReturnOrderBiz> + </el-tabs> + + <el-dialog + title="选入业务单据" + :visible.sync="selectPrescriptionVisible" + :close-on-click-modal="false" + :close-on-press-escape="false" + v-if="selectPrescriptionVisible" + width="65%" + append-to-body + > + <selectPrescribeDialog + ref="childRef" + :workPlaceCode="this.workplaceId" + :busType="this.formData.busType" + :fromCorp="this.formData.fromCorp" + :confirmSelect="this.confirmSelect" + :closeDialog="this.closeDialog" + :viewType="viewType" + ></selectPrescribeDialog> + </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 + > + <el-row> + <!-- <el-button v-for="(item, index) in busTypeList" :key="index" type="primary" plain @click="selectBusType(item.code)">{{ item.name }}</el-button>--> + + <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;" + + > + + <div + style="display: flex; justify-content: space-between; align-items: center; height: 46px; /* 约为 200px 的 1/3 */" + @click="selectBusType(info.documentTypeCode)" + > + <p style="font-size: 20px;background-color: #e1f3fb;font-weight: bold;">{{ info.busName }}</p> + <!-- 假设你的信息对象中包含一个title属性 --> + <!-- <div style="width: 60px; height: 60px; display: flex; justify-content: center; align-items: center;">--> + <!-- <!– 二维码占位,这里用灰色方块代替 –>--> + <!--<!– <span>QR</span>–>--> + <!-- <div ref="qrcode" :id="'qrcode-'+index" style="width: 60px;height: 60px;"></div>--> + + <!-- </div>--> + </div> + <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> + <el-button type="primary" style="position: absolute; bottom: 20px; right: 20px;" icon="el-icon-thumb" + @click="selectBusType(info.documentTypeCode)" + >开始作业 + </el-button> + + </div> + + + </el-card> + </el-col> + </el-row> + </el-dialog> + + + </el-form> + </div> + +</template> + +<script> +import addOrder from '@/views/inout/DialogCreateOrder' +import errOrder from '@/views/inout/IoCreateErrorOrder' +import { executeFuc, getHead } from '@/utils/customConfig' +import { convertDate } from '@/utils/date' +import selectPrescribeDialog from '@/views/collect/selectCollectOrderDialog' +import PanelOrderManuTagCode from './PanelOrderManuTagCode' +import IoReturnOrderBiz from './IoReturnOrderBiz' +import prescribeCodePanel from './PanelOrderTagCode' +import PannelOrderBiz from './PannelOrderBiz' +import { listPage } from '@/api/basic/workPlace/sysWorkplaceManage' +import { enterCodeWeb, batchVailCode, enterCodeBillNo, saveOrderWeb, batchUpdateCode } from '@/api/inout/order' +import { + cancelOrder, + draftOrder, + finishOrder, + startSplit, + tagCode, + updateOrder, + vailOrderFinish +} from '@/api/collect/splitCreateOrder' +import { selectCorpList } from '@/api/basic/basicUnitMaintain' +import { + getCurOrder, + getNextOrder, + findByBill, + findFromCorp, + orderDetail, + removeByScanCode, finishReturnOrder +} 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' + +import JsBarcode from 'jsbarcode' +import { getSet } from '@/api/collect/collectSet' + +import { MessageBox } from 'element-ui' + +export default { + /** + * 处方退货 + */ + name: 'IoReturncllectOrder', + props: { + resetKey: { + type: Function, + required: true + } + }, + data() { + return { + tabsName: [ + 'IoReturnOrderBiz', + 'prescribeCodePanel1', + 'prescribeCodePanel2', + 'PanelOrderAllDetail' + ], + editableTabsValue: 'IoReturnOrderBiz', + fromInvOptions: [], + //界面配置相关 + //患者处方 + loading: false, + placeholder: '请点击输入框扫描单据', + tableHeader: [], + queryList: [], + tableObj: [], + fromList: [], + convertDateFun: convertDate, + //界面配置-------------end + + showSearch: true, + filterQuery: { + billNo: null, + page: 1, + limit: 10 + }, + list: [], + total: 0, + defaultSort: { prop: 'createTime', order: 'desc' }, + formDataVisible: { + scanType: null, + unitTittle: '往来单位', + corpType: 3 + }, + curWorkPlaces: [], + erpList: [], + formData: { + billNo: null, + tagStatus: -1, + invCode: null, + busType: null, + workPlaceCode: null, + fromCorp: null, + confirmFinish: false + }, + selectPrescriptionVisible: false, + corpOrderIdDisabled: false, + isLinkDisabled: false, + selectBusTypeDisabled: false, + userInfo: { + inv: this.$store.getters.locInvName, + deptName: this.$store.getters.locDeptName, + userName: this.$store.getters.name, + companyName: this.$store.getters.companyName + }, + curRow: null, + panelALive: false, + autoFinishOrderFlag: true,//是否对完成的单据提示立即提交 + + //扫码相关 + scanCode: '', + isSuccess: false, + checked: true, + scanTitle: '扫码结果:', + result: ' \n', + msgTip: '信息提醒:', + originCode: '', + checkSuccess: false, + scanResultType: 'success', + isSelectOrder: false, + isFinishOrder: true, + busQuery: { + busKey: '', + workplaceCode: null, + page: 1, + limit: 100 + }, + busTypeList: [], + busTypeTotal: 0, + + invList: [], + viewType: 1, + scanDisabled: false, + valiCodes: [], + warnResult: '', + errResult: '', + warnVisible: false, + errVisible: false, + workplaceId: null, + ws: null, + scanTip: '扫码录入:', + scanSplit: false, + // + labels: { + 1: '扫码录入:', + 2: '扫码剔除:' + }, + labelName: 1, + scanStatus: null, // 1:扫码剔除; null 处理单据 + collectSet: {} + } + }, + + components: { + addOrder, + errOrder, + selectPrescribeDialog, + prescribeCodePanel, + PanelOrderManuTagCode, IoReturnOrderBiz, + PannelOrderBiz, + PanelOrderAllDetail + }, + watch: { + resetKey(newVal, oldVal) { + this.$refs.inputRef.focus() + } + }, + methods: { + generateBarcode() { + const barcodeData = this.formData.billNo + // 获取条形码容器 + 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 // 减小外边距 + }) + + }, + getBillNo(billNo) { + let post = { + billNo: billNo, + workPlaceCode: this.workplaceId, + page: 1, + limit: 10 + } + findByBill(post).then(res => { + if (res.code == 20000) { + if (res.data.billNo != null) { + this.formData = res.data + this.scanCode = '' + this.formData.workPlaceCode = this.workplaceId + this.checked = false + } + } else { + this.checked = true + this.formData.billNo = null + this.$message.error(res.message) + } + }) + }, + selectBusType(val) { + this.formData.busType = val + this.selectBusTypeDisabled = false + if (this.formData.workPlaceCode != null) { + 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 + if (this.formData.billNo != null) { + this.getBillNo(this.formData.billNo) + this.startDeal() + } else { + if (this.busTypeList.length == 1 && this.$route.query.busType == null) { + this.formDataVisible = this.busTypeList[0] + this.formData.busType = this.busTypeList[0].documentTypeCode + this.selectBusTypeDisabled = false + if (this.formDataVisible.scanType == 1) { + this.findFromInvList('') + this.getInvList() + this.placeholder = '请点击输入框进行扫码生成业务单据' + } else { + this.findCurOrder() + } + + } else { + //这里不能获取路由上面的订单代码 + if (this.$route.query.workplaceId != null) { + this.$refs.inputRef.focus() + this.formDataVisible = this.busTypeList.find( + item => /^YPCFTF/.test(item.documentTypeCode || "") // 正则匹配前缀 + ); + this.formData.busType = this.formDataVisible.documentTypeCode + console.log("djdjjdj",this.formData.busType) + //scanType + // 1.扫码生成业务单 + // 2.按单校验三期 + // 3.按单不校验三期 + if (this.formDataVisible.scanType == 1) { + this.findFromInvList('') + this.getInvList() + this.placeholder = '请点击输入框进行扫码生成业务单据' + } else { + //获取正在处理的单据 + this.findCurOrder() + } + } + + } + + } + + } + return + }) + }, + findFromInvList(val) { + let cQuery = { + corpType: this.formDataVisible.consignee, + invCode: this.formData.invCode + } + findFromCorp(cQuery) + .then((response) => { + if (!isBlank(this.$route.query.busType) && this.formDataVisible.consignee == 2) { + this.invList = response.data || [] + } else { + this.fromInvOptions = response.data || [] + } + }) + .catch(() => { + }) + }, + workPlaceCodeChange(value) { + this.getWorkBindBusTypes(value) + return + }, + + busTypeChange(value) { + let busType = this.busTypeList.find(item => item.documentTypeCode === value) + this.formData.busType = busType.documentTypeCode + this.selectBusTypeDisabled = false + this.formDataVisible = busType + if (this.formDataVisible.scanType == 1) { + this.findFromInvList('') + } + this.findCurOrder() + }, + + handleClick(blankName) { + // let url = window.location.origin+`#/tagCodeBlank?workplaceId=`+ this.stationList[index].workplaceId + let url = window.location.origin + `#/` + blankName + `?workplaceId=` + this.workplaceId + // this.$router.push( workplaceId) + window.open(url, '_blank') + }, + handleClickOut(blankName) { + // let url = window.location.origin+`#/tagCodeBlank?workplaceId=`+ this.stationList[index].workplaceId + let url = window.location.origin + `#/` + blankName + `?splitType=out&workplaceId=` + this.workplaceId + // this.$router.push( workplaceId) + window.open(url, '_blank') + }, + handleClickReturn(blankName) { + // let url = window.location.origin+`#/tagCodeBlank?workplaceId=`+ this.stationList[index].workplaceId + let url = window.location.origin + `#/` + blankName + `?splitType=return&workplaceId=` + this.workplaceId + // this.$router.push( workplaceId) + window.open(url, '_blank') + }, + //获取当前货位 + findCurWorkPlaces(val) { + let query = { + key: val, + status: 1, + // invCode: this.formData.invCode, + page: 1, + limit: 100 + } + listPage(query).then((res) => { + this.curWorkPlaces = res.data.list || [] + if (this.curWorkPlaces.length == 1 && this.formData.workPlaceCode == null) { + this.formData.workPlaceCode = this.curWorkPlaces[0].workplaceId + this.workPlaceCodeChange(this.formData.workPlaceCode) + } + }) + }, + //界面配置相关------------ + executeFuc(row, type, clickFuc, value) { + return executeFuc(this, row, type, clickFuc, value) + }, + executeEval(row, expression, defaultRet) { + if (expression) { + return eval(expression) + } + return defaultRet + }, + ///界面配置相关------------end + + hideSearch() { + this.showSearch = !this.showSearch + }, + + refreshCodesPanel(_this) { + _this.panelALive = false + _this.$nextTick(() => { + _this.panelALive = true + }) + _this.getBizDetailList() + _this.vailOrderFinish() + }, + refreshCodesPanelBank(_this) { + _this.panelALive = false + _this.$nextTick(() => { + _this.panelALive = true + }) + // _this.getBizDetailList(); + _this.vailOrderFinish() + }, + refreshCodesPanelP() { + let _this = this + _this.panelALive = false + _this.$nextTick(() => { + _this.panelALive = true + }) + _this.vailOrderFinish() + }, + + getInputFocus(event) { + event.currentTarget.select() + }, + getBizDetailList() { + let preQuery = {} + if (this.formData == null) { + return + } + if (this.formData != null) { + preQuery = { + orderIdFk: this.formData.billNo + } + } + orderDetail(preQuery).then(res => { + if (res.code != 20000) { + this.$message.error(res.message) + return + } + this.overdeleteCode() + }).catch(() => { + this.$message.error('数据加载失败') + }) + }, + + enterKey() { + + if (this.scanCode.includes('DMOENTER')) { + if (this.formData.billNo == null) { + this.$message.error('请先选择单据') + } else { + this.confirmFinishOrder() + } + this.scanCode = '' + return + } else if (this.scanCode.includes('DMOCANCEL')) { + if (this.formData.billNo == null) { + this.$message.error('请先选择单据') + } else { + this.cancelOrder() + } + this.scanCode = '' + return + } else if (this.scanCode.includes('DMODEL')) { + if (this.formData.billNo == null) { + this.$message.error('请先选择单据') + } else { + this.deleteCode() + } + this.scanCode = '' + return + } + + if (this.formData.billNo == null && this.formDataVisible.scanType != 1) { + this.enterBillNoKey() + return + } + + this.checkSuccess = true + this.filterQuery.code = this.scanCode.trim() + if (this.filterQuery.code.includes(';')) { + const codeArray = this.filterQuery.code.split(';') + const verify = this.verifyScanCount(codeArray) + if (verify) { + let params = { + codeList: codeArray + } + this.batchVailCode(params) + } + return + } + if (this.filterQuery.code) { + if (!this.parseString(this.filterQuery.code)) { + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + this.$message.error('无效追溯码') + return + } + } + let tQuery = { + viewType: 'tagCode', + workPlaceCode: this.workplaceId, + originCode: this.originCode, + busType: this.formData.busType, + code: this.filterQuery.code.trim() + } + if (this.scanStatus == 1) { + const codeArray = this.filterQuery.code.split(';') + let query = { + orderId: this.formData.billNo, + codeList: codeArray + } + //剔除码 + this.removeCodesTemp(query) + } else { + enterCodeWeb(tQuery).then((response) => { + if (response.code === 20000) { + 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) { + this.checkSuccess = false + this.isSuccess = false + this.printCodeResult(response.data, response.message) + this.filterQuery.code = response.data.code + this.originCode = response.data.code + } else if (response.code == 501) { + this.checkSuccess = false + this.$message.error(response.message) + this.scanCode = '' + } else if (response.code == 503) { + this.checkSuccess = false + this.isSuccess = false + this.printCodeResult(response.data, response.message) + this.filterQuery.code = response.data.code + this.scanCode = '' + this.$confirm(response.message, '提示', { + type: 'warning' + }) + .then(() => { + this.filterQuery.code = response.data.code + this.addCode() + }) + .catch(() => { + this.filterQuery.code = response.data.code + }) + } else if (response.code == 508) { + 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 + this.placeholder = '已选入单据,请扫UDI码进行作业' + this.getBillNo(this.formData.billNo) + this.startDeal() + + } else { + this.scanCode = '' + this.$alert(response.message, '提示', { + confirmButtonText: '确定', + type: 'warning', + closeOnClickModal: true, + callback: (action) => { + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + } + }) + } + } + this.loading = false + }) + } + + }, + + enterBillNoKey(billNo) { + this.checkSuccess = true + this.filterQuery.code = this.scanCode + let tQuery = { + viewType: 'tagCode', + workPlaceCode: this.workplaceId, + originCode: this.originCode, + busType: this.formData.busType, + code: this.filterQuery.code.trim() + } + if (billNo != null) { + tQuery.code = billNo + } + enterCodeBillNo(tQuery).then((response) => { + if (response.code === 20000) { + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + this.isSuccess = true + this.printCodeResult(response.data, response.message) + this.filterQuery.code = response.data.code + this.scanCode = '' + this.originCode = '' + this.addCode() + this.updateOrder() + } else { + if (response.code == 502) { + this.checkSuccess = false + this.isSuccess = false + this.printCodeResult(response.data, response.message) + this.filterQuery.code = response.data.code + this.originCode = response.data.code + this.scanCode = '' + } else if (response.code == 501) { + this.checkSuccess = false + this.$message.error(response.message) + this.scanCode = '' + } else if (response.code == 503) { + this.checkSuccess = false + this.isSuccess = false + this.printCodeResult(response.data, response.message) + this.filterQuery.code = response.data.code + this.scanCode = '' + this.$confirm(response.message, '提示', { + type: 'warning' + }) + .then(() => { + this.filterQuery.code = response.data.code + this.addCode() + }) + .catch(() => { + this.filterQuery.code = response.data.code + }) + } else if (response.code == 508) { + this.originCode = '' + this.filterQuery.code = '01' + response.data.nameCode + this.originCode = this.filterQuery.code + } else if (response.code == 601) { + this.placeholder = '已选入单据,请扫UDI码进行作业' + this.formData.billNo = response.data.billNo + this.getBillNo(this.formData.billNo) + this.startDeal() + + } else { + this.scanCode = '' + this.$alert(response.message, '提示', { + confirmButtonText: '确定', + type: 'warning', + closeOnClickModal: true, + callback: (action) => { + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + } + }) + } + } + this.loading = false + }) + }, + + addCode(code) { + if (this.$isNotBlank(code)) { + this.filterQuery.code = code + } + if (this.$isBlank(this.filterQuery.code)) { + this.filterQuery.code = this.scanCode.trim() + } + if (this.$isBlank(this.filterQuery.code) && this.$isBlank(this.scanCode)) { + return + } + let tagQuery = { + workPlaceCode: this.formData.workPlaceCode, + fromCorp: this.formData.fromCorp, + fromCorpName: this.formData.fromCorpName, + shipper: this.formData.shipper, + shipperName: this.formData.shipperName, + billNo: this.formData.billNo, + code: this.filterQuery.code.trim(), + insert: this.formData.insert, + busType: this.formData.busType + } + tagCode(tagQuery).then(res => { + this.loading = false + if (res.code == 20000) { + this.formData.tagStatus = 2 + this.formData.insert = false + this.formData = res.data + this.curRow = this.formData + this.$refs.inputRef.focus() + this.refreshCodesPanel(this) + }else { + return this.$message.error(res.message) + } + }).catch(() => { + this.loading = false + }) + }, + + 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() + } + }).catch(() => { + this.loading = false + }) + }).catch(() => { + }) + }, + + cancelOrder() { + this.$confirm('此操作将取消当前正在处理单据,是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + cancelOrder(this.formData).then(res => { + this.loading = false + if (res.code == 20000) { + const audio = new Audio(require('@/assets/audioFiles/colser.mp3')) + audio.play() + this.overdeleteCode() + this.reset() + } + }).catch(() => { + this.loading = false + }) + }).catch(() => { + }) + }, + + confirmFinishOrder() { + this.$confirm('是否确定完成此单退货?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.finishOrder() + }).catch(() => { + }) + }, + + finishOrder() { + finishReturnOrder(this.formData).then(res => { + this.loading = false + if (res.code == 20000) { + const audio = new Audio(require('@/assets/audioFiles/order.mp3')) + audio.play() + this.reset() + if (this.formDataVisible.scanType != 1) { + this.findCurOrder() + } + } else if (res.code == 502) { + this.$confirm(res.message, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.formData.confirmFinish = true + this.finishOrder() + }).catch(() => { + }) + } else { + this.$message.error(res.message) + } + }).catch(() => { + this.loading = false + }) + }, + + updateOrder() { + this.formData.workPlaceCode = this.workplaceId + updateOrder(this.formData).then(res => { + this.loading = false + }).catch(() => { + this.loading = false + }) + + }, + + //选择单据 + selectPrescribe() { + // console.log(this.formData.workPlaceCode) + if (this.$route.query.busType != null) { + this.formData.busType = this.formDataVisible.documentTypeCode + } + this.selectPrescriptionVisible = true + }, + + //获取下一单据 + nextCollectOrder() { + let nextQuery = { + busType: this.formData.busType + } + getNextOrder(nextQuery).then(res => { + this.loading = false + if (res.code == 20000) { + this.formData = res.data + + this.startDeal() + } else { + this.$message.error(res.message) + } + }).catch(() => { + this.loading = false + }) + }, + + findCurOrder() { + let nextQuery = { + // workPlaceCode: this.formData.workPlaceCode, + busType: this.formData.busType + } + getCurOrder(nextQuery).then(res => { + this.loading = false + if (res.code == 20000) { + let temp = res.data + if (temp.tagStatus === -1) { + this.$confirm('检测到当前工位存在挂起退货单据,是否继续上一次退货单据处理?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.formData = temp + // this.generateBarcode() + this.startDeal() + }).catch(() => { + }) + } else if (temp.tagStatus === 2 || temp.tagStatus === 1) { + + this.formData = temp + // this.generateBarcode() + this.panelALive = true + this.startDeal() + // this.$confirm('检测到当前工位存在正在处理单据,是否继续上一次单据处理?', '提示', { + // confirmButtonText: '确定', + // cancelButtonText: '取消', + // type: 'warning' + // }).then(() => { + // + // }).catch(() => { + // }); + } + + } else { + // this.$message.error(res.message) + this.$refs.inputRef.focus() + } + }).catch(() => { + this.loading = false + }) + }, + + closeDialog() { + this.selectPrescriptionVisible = false + }, + + confirmSelect(row) { + this.formData = row + this.formData.workPlaceCode = this.workplaceId + this.startDeal() + // this.generateBarcode() + }, + + startDeal() { + this.autoFinishOrderFlag = true + this.curRow = this.formData + //todo 拆零方法要去掉 + // this.dealSplitOrder() + //处理哪个活动的明细子组件 + // this.selectTabsname(this.formData.busType); + //激活子组件 + this.refreshCodesPanel(this) + this.formData.tagStatus = 2 + this.updateOrder() + this.selectSysParam() + // this.refreshCodesPanel(this); + this.$refs.inputRef.focus() + }, + + selectTabsname(value) { + if (this.$isBlank(this.filterQuery.code) && this.busTypeList.length > 0) { + let busType = this.busTypeList.find(item => item.documentTypeCode === value) + let autoTag = busType.autoTag + if (autoTag == 1) { + this.editableTabsValue = this.tabsName[1] + } + } + }, + //开始拆零 + dealSplitOrder() { + this.formData.workPlaceCode = this.workplaceId + startSplit(this.formData).then(res => { + this.loading = false + if (res.code == 20000) { + this.selectPrescriptionVisible = false + this.refreshCodesPanel(this) + } else if (res.code == 501) { + + this.$refs.childRef.getList() + this.$refs.childRef.getDraftList() + this.$refs.childRef.getOtherList() + this.$message.warning(res.message) + this.refreshCodesPanel(this) + } + }).catch(() => { + this.loading = false + }) + }, + + printCodeResult(data, message) { + const resultParts = [] + if (data.udi) { + resultParts.push('层级标识: ' + data.udi) + } + if (data.cpmctymc) { + resultParts.push(data.productType == 2 ? '药品通用名称' : '产品通用名称: ' + data.cpmctymc) + } + if (data.batchNo) { + resultParts.push('批次号: ' + data.batchNo) + } + if (data.produceDate) { + resultParts.push('生产日期: ' + data.produceDate) + } + if (data.expireDate) { + resultParts.push('失效日期: ' + data.expireDate) + } + if (data.serialNo) { + resultParts.push('序列号: ' + data.serialNo) + } + if (data.productType == 2) { + if (data.bzgg) { + resultParts.push('包装规格: ' + data.bzgg) + } + } else { + if (data.ggxh) { + resultParts.push('规格型号: ' + data.ggxh) + } + } + if (data.prepnSpec) { + resultParts.push('制剂规格: ' + data.prepnSpec) + } + if (data.prepnUnit) { + resultParts.push('剂型: ' + data.prepnUnit) + } + if (data.packUnit) { + resultParts.push('计量单位: ' + data.packUnit) + } + + this.scanTitle = '扫码结果:' + data.code + this.result = resultParts.join(' , ') + if (message == 'success') { + this.scanResultType = 'success' + } else { + this.scanResultType = 'warning' + this.result = this.result + '\n' + message + } + }, + + popupTip(data) { + this.$confirm(data.errMsg, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.formData.insert = true + this.addCode(data.code) + }).catch(() => { + }) + }, + + vailOrderFinish() { + if (!this.autoFinishOrderFlag) { + return + } + + if (this.formDataVisible.scanType == 1) { + return + } + + vailOrderFinish(this.formData).then(res => { + this.loading = false + if (res.code == 20000) { + if (res.data) { + this.$confirm('单据已赋码或可自动赋码,是否立即完成单据?', '提示', { + confirmButtonText: '立即提交', + cancelButtonText: '手动扫码', + type: 'warning' + }).then(() => { + this.finishOrder() + }).catch(() => { + this.autoFinishOrderFlag = false + }) + } + } else { + + } + }).catch(() => { + this.loading = false + }) + }, + + async printMutiCodeResult(vailCodeResultResponses) { + this.warnResult = '' + this.errResult = '' + this.result = '' + this.warnVisible = false + this.errVisible = false + for (let i = 0; i < vailCodeResultResponses.length; i++) { + let data = vailCodeResultResponses[i] + 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 + } else if (data.status == 3) { + this.result = this.result + '\n' + vailCodeResultResponses[i].code + // 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; + } + if (!isBlank(this.warnResult)) { + this.warnVisible = true + } + if (!isBlank(this.errResult)) { + this.errVisible = true + } + }, + handleCommand(command) { + // this.$message('click on item ' + command); + }, + verifyScanCount(codeArray) { + //判断扫码数量是否超出或少于设置扫码数量 + if (this.collectSet.scanMaxCount != null && this.collectSet.scanMaxCount != 0) { + if (this.collectSet.scanMaxCount > codeArray.length) { + this.scanCode = '' + this.$message.error('扫码数量少于设置扫码数量') + return false + } else if (this.collectSet.scanMaxCount < codeArray.length) { + this.scanCode = '' + this.$message.error('扫码数量超出') + return false + } + } + return true + }, + clearCode() { + // this.originCode = ""; + // this.formData.code = ""; + // this.formData.billNo = null; + // this.formData.shipper = null; + // this.formData.fromCorp = null; + this.scanCode = '' + // this.scanTitle = "扫码结果:"; + // this.result = ""; + // this.warnResult = "" + // this.errResult = "" + // this.warnVisible = false + // this.errVisible = false + }, + + /** + * 重置 + */ + resetWork() { + this.formData = { + tagStatus: -1, + workPlaceCode: this.formData.workPlaceCode, + busType: this.formData.busType + } + this.curRow = null + this.formData.confirmFinish = false + this.refreshCodesPanel(this) + this.clearCode() + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + }, + reset() { + this.formData = { + billNo: null, + tagStatus: -1, + workPlaceCode: this.formData.workPlaceCode, + busType: this.formData.busType, + shipper: null, + fromCorp: null + } + this.selectSysParam() + this.curRow = null + this.formData.confirmFinish = false + this.refreshCodesPanelBank(this) + this.clearCode() + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + }, + toggleBusType() { + //隐藏下拉框内容 + // this.$refs.selectHeadEmpId.blur(); + this.selectBusTypeDisabled = true + }, + + getInvList() { + let query = { + advanceType: 1 + } + getInvListByUser(query) + .then((response) => { + if (!isBlank(this.$route.query.busType) && this.formDataVisible.consignee == 2) { + this.fromInvOptions = response.data || [] + } else { + this.invList = response.data || [] + } + }) + .catch(() => { + }) + }, + changeCorp() { + let corp = this.fromInvOptions.find(item => item.code === this.formData.fromCorp) + this.formData.fromCorpName = corp.name + }, + changeShipper() { + let corp = this.invList.find(item => item.code === this.formData.shipper) + this.formData.shipperName = corp.name + this.formData.shipper = corp.code + }, + //处理事件 + handleRecCodesEvent(event) { + console.log('接收 recCodes event:', event.detail.recCodes) + + let params = { + codeList: event.detail.recCodes + } + if (this.formData.billNo == null) { + this.$message.error('请先选入单据!') + return + } + + const verify = this.verifyScanCount(event.detail.recCodes) + 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) { + this.valiCodes = [] + let list = res.data + list.forEach(item => { + if (item.status === 1) { + this.valiCodes.push(item.code) + } + }) + 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, + invCode: this.formData.invCode + } + orderbatchAddCode(params2).then((res) => { + if (res.code === 20000) { + this.formData.tagStatus = 2 + this.formData.insert = false + this.curRow = this.formData + this.$refs.inputRef.focus() + this.refreshCodesPanel(this) + this.printMutiCodeResult(res.data.vailCodeResultResponses) + } else { + this.$message.error(res.message) + } + }) + // this.scanCode = this.valiCodes.join(";"); + } + this.selectSysParam() + + } else { + this.$message.error(res.message) + } + }) + } + + }, + removeCodesTemp(query) { + 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) { + + } else { + this.result = '' + this.scanCode = '' + this.$message.error(res.message) + } + }) + }, + //扫码校验 + addGs() { + 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) + this.$nextTick(() => { + this.focus = true + input.selectionStart = input.selectionEnd = start + textToInsert.length + this.$refs.inputRef.focus() + }) + }, + + handleScanComplete(fullScanData) { + console.log('Scan complete:', fullScanData.join(';')) + if (this.formData.billNo == null && this.formDataVisible.scanType != 1) { + this.enterBillNoKey(fullScanData[0]) + return + } + + let params = { + codeList: fullScanData + } + if (this.formData.billNo == null) { + this.$message.error('请先选入单据!') + return + } + const verify = this.verifyScanCount(fullScanData) + if (verify) { + this.batchVailCode(params) + } + // 在这里处理完整的扫码数据,如提交到后台或显示 + }, + + parseString(str) { + // 1. 判断是否以 "MA" 开头 + if (str.startsWith('MA')) { + return true + } + + // 2. 判断是否以 "01" 开头且长度大于等于 18 + if (str.startsWith('01') && str.length >= 16) { + return true + } + + // 3. 判断是否以 "#" 开头且 "#" 的个数大于等于 4 + if (str.startsWith('#') && (str.match(/#/g) || []).length >= 4) { + return true + } + + // 4. 判断是否以 "8" 开头且长度为 20 位 + if (str.startsWith('8') && str.length === 20) { + return true + } + + // 5. 判断是否以 "11", "17", "21", 或 "10" 开头 + const prefixes = ['11', '17', '21', '10'] + if (prefixes.some(prefix => str.startsWith(prefix))) { + return true + } + // 如果没有任何条件满足,返回 false + return false + }, + socketListener() { + let lastScanTime = Date.now() + let scanBuffer = [] + let scanTimeout = null + const SCAN_TIMEOUT = 1000 // 1秒间隔,表示扫码结束的判定标准 + const self = this + console.log('启用监听') + this.ws.onmessage = function(event) { + let scanData = event.data // 获取扫码数据 + let currentTime = Date.now() + console.log(scanData) + // 如果时间间隔超过预设的阈值,表示这是一次新的扫码 + if (currentTime - lastScanTime > SCAN_TIMEOUT) { + // 处理上一次完整的扫码数据 + if (scanBuffer.length > 0) { + self.handleScanComplete(scanBuffer) + } + // 清空缓冲区,开始新的扫码 + scanBuffer = [] + } + // 重置上一次扫码的时间 + lastScanTime = currentTime + // 将数据添加到缓冲区 + scanBuffer.push(scanData) + + // 如果已经有一个定时器在等待,可以清除它 + if (scanTimeout) { + clearTimeout(scanTimeout) + } + // 设置新的定时器,等待指定的时间后执行扫码结束处理 + scanTimeout = setTimeout(() => { + // 定时器到时,处理扫码结束 + self.handleScanComplete(scanBuffer) + scanBuffer = [] + }, SCAN_TIMEOUT) + } + }, + handleVisibilityChange() { + if (document.visibilityState === 'visible') { + console.log('用户切回到了处方退药页面') + if (this.ws == null || this.ws.readyState === WebSocket.CLOSED) { + this.ws = new WebSocket('ws://127.0.0.1:9988') + const self = this + this.ws.onopen = function(evt) { + console.log('处理单据WebSocket 连接中 ...') + self.socketListener() + } + + } + } else { + if (this.ws && this.ws.readyState === WebSocket.OPEN) { + this.ws.close() + console.log('关闭处理单据websocket成功') + } + } + }, + + //扫码剔除操作 + deleteCode() { + this.scanTip = '扫码剔除:' + this.labelName = 2 + this.placeholder = '请点击输入框进行扫码剔除' + this.scanStatus = 1 + this.scanCode = '' + if (!isBlank(this.warnResult)) { + this.warnResult = '' + } + }, + overdeleteCode() { + this.warnVisible = false + this.warnResult = '' + this.labelName = 1 + this.scanStatus = null + this.scanTip = '扫码录入:' + this.placeholder = '请点击输入框进行选扫码' + }, + selectSysParam() { + getSet().then((response) => { + if (response.code == 20000) { + this.collectSet = response.data + } + }) + }, + + handleKeydown(event) { + if (this.formData.billNo != null) { + if (event.key === 'F9' || event.keyCode === 120) { + event.preventDefault() // 阻止默认行为 + this.finishOrder() + MessageBox.close() + + } + if (event.key === 'F10' || event.keyCode === 121) { + event.preventDefault() // 阻止默认行为(如果有的话) + // this.push(); + cancelOrder(this.formData).then(res => { + this.loading = false + if (res.code == 20000) { + const audio = new Audio(require('@/assets/audioFiles/colser.mp3')) + audio.play() + this.overdeleteCode() + this.reset() + } + }).catch(() => { + this.loading = false + }) + } + } + + } + }, + mounted() { + this.$refs.inputRef.focus() + document.addEventListener('returnOrder', this.handleKeydown) + //环境判断 + if (window.navigator.userAgent.indexOf('GLXP_PC') != -1) { + this.scanDisabled = true + window.removeEventListener('djcl', this.handleRecCodesEvent) + window.addEventListener('djcl', this.handleRecCodesEvent) + } + 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() + // } + // } + // }); + + }, + + beforeDestroy() { + document.removeEventListener('returnOrder', this.handleKeydown) + window.removeEventListener('djcl', this.handleRecCodesEvent) + document.removeEventListener('visibilitychange', this.handleVisibilityChange) + + this.ws.close() + this.ws.onclose = function(evt) { + console.log('处理退货单据 Connection closed.') + } + + }, + created() { + this.findCurWorkPlaces() + this.selectSysParam() + + this.formData.invCode = this.$store.getters.locInvCode + if (this.$route.query.billNo != null) { + this.formData.billNo = this.$route.query.billNo + } + if (this.$route.query.workplaceId != null) { + this.isLinkDisabled = true + if (this.$route.query.billNo == null) { + // this.selectBusTypeDisabled = true + } + this.corpOrderIdDisabled = true + this.workplaceId = Number(this.$route.query.workplaceId) + this.formData.workPlaceCode = Number(this.$route.query.workplaceId) + this.getWorkBindBusTypes(this.formData.workPlaceCode) + } + } + +} +</script> + +<style scoped> +.el-col { + margin-top: -5px; + margin-bottom: -5px; +} + +.el-dropdown { + vertical-align: top; +} + +.el-dropdown + .el-dropdown { + margin-left: 15px; +} + +.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; /* 垂直居中 */ +} + +.custom-descriptions .el-descriptions__cell svg { + vertical-align: middle; + margin-left: 20px; + margin-right: 10px; +} +</style> diff --git a/src/views/collect/PannelOrderBiz.vue b/src/views/collect/PannelOrderBiz.vue index 0ff14896..bc3e3d8d 100644 --- a/src/views/collect/PannelOrderBiz.vue +++ b/src/views/collect/PannelOrderBiz.vue @@ -137,7 +137,13 @@ </el-table-column> <el-table-column label="应扫码数量" prop="scanActCount"> <template v-slot="scope"> - <div :style="getCellStyle(scope.row)">{{ scope.row.scanCount }}/{{ scope.row.shouldCount }}</div> + <div :style="getCellStyle(scope.row)" style="display: flex; align-items: center; height: 100%; min-height: 40px;"> + {{ + scope.row.shouldCount === 0 + ? '无需扫码' + : `${scope.row.scanCount}/${scope.row.shouldCount}` + }} + </div> </template> </el-table-column> <el-table-column label="制剂规格" prop="prepnSpec"> @@ -380,7 +386,7 @@ export default { getCellStyle(row) { let cellStyle = { - fontSize: '32px' + fontSize: '50px' } if (row.shouldCount == 0) { cellStyle.fontSize = '30px'