You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

721 lines
24 KiB

6 months ago
6 months ago
6 months ago
6 months ago
4 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <div class="customer-css">
  3. <div style="display: flex; align-items: center; margin-top: 1px; margin-left: 0px;">
  4. <div>
  5. <el-button type="primary" @click="searchTable()">查询</el-button>
  6. <el-button v-if="searchData.orderStatus === '待包装'" type="primary" @click="newBox()">新增箱</el-button>
  7. <el-button type="primary" @click="printCartonLabels()" :disabled="selectedBoxes.length <= 0">打印</el-button>
  8. </div>
  9. <span style="margin-left: auto; font-size: 14px; display: flex; align-items: center;">
  10. <span style="margin-right: 20px;">
  11. <span style="color: #606266;">箱标签张数</span>
  12. <span style="color: rgb(38, 92, 147); font-weight: bold;">{{boxingStatistics.boxCount}}</span>
  13. </span>
  14. <span style="margin-right: 20px;">
  15. <span style="color: #606266;">卷标签张数</span>
  16. <span style="color: rgb(38, 92, 147); font-weight: bold;">{{boxingStatistics.rollCount}}</span>
  17. </span>
  18. <span>
  19. <span style="color: #606266;">物料总数</span>
  20. <span style="color: rgb(38, 92, 147); font-weight: bold;">{{boxingStatistics.rollsCount}}</span>
  21. </span>
  22. </span>
  23. </div>
  24. <el-table
  25. :data="dataList"
  26. :height=searchData.height
  27. border
  28. v-loading="dataListLoading"
  29. @selection-change="handleSelectionChange"
  30. style="width: 100%; ">
  31. <el-table-column
  32. type="selection"
  33. header-align="center"
  34. align="center"
  35. width="50">
  36. </el-table-column>
  37. <el-table-column
  38. v-for="(item,index) in columnList" :key="index"
  39. :sortable="item.columnSortable"
  40. :prop="item.columnProp"
  41. :header-align="item.headerAlign"
  42. :show-overflow-tooltip="item.showOverflowTooltip"
  43. :align="item.align"
  44. :fixed="item.fixed==''?false:item.fixed"
  45. :min-width="item.columnWidth"
  46. :label="item.columnLabel">
  47. <template slot-scope="scope">
  48. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  49. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column
  53. header-align="center"
  54. align="center"
  55. width="150"
  56. label="操作">
  57. <template slot-scope="scope">
  58. <el-link style="cursor: pointer" v-if="scope.row.status!=='未封箱'" @click="boxModelOpen(scope.row)">查看</el-link>
  59. <template v-if="searchData.orderStatus === '待包装'">
  60. <el-link style="cursor: pointer" v-if="scope.row.status!=='已封箱'"@click="boxModelOpen(scope.row)">装箱</el-link>
  61. <el-link style="cursor: pointer" v-if="scope.row.status==='未封箱'" @click="fengxiang(scope.row)">封箱</el-link>
  62. <el-link style="cursor: pointer" v-if="scope.row.status==='已封箱'" @click="chaixiang(scope.row)">拆箱</el-link>
  63. <el-link style="cursor: pointer" v-if="scope.row.status!=='已封箱'" @click="deleteBox(scope.row)">删除</el-link>
  64. </template>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <el-dialog title="卷清单" :visible.sync="boxModelFlag" width="700px" @close="searchTable" style="margin-top: 7px" v-drag :close-on-click-modal="false">
  69. <el-form class="sl" inline="inline" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  70. <el-row>
  71. <el-form-item label="销售发货单号">
  72. <el-input v-model="boxData.orderNo" disabled style="width: 130px"></el-input>
  73. </el-form-item>
  74. <el-form-item label="箱号">
  75. <el-input v-model="boxData.boxNo" disabled style="width: 130px"></el-input>
  76. </el-form-item>
  77. <el-form-item label="所在仓库">
  78. <el-input v-model="boxData.wareHouseID" disabled style="width: 130px"></el-input>
  79. </el-form-item>
  80. <el-form-item label="标准装箱数量">
  81. <el-input v-model="boxData.stdPackingQty" disabled style="width: 130px" class="std-packing-qty-input"></el-input>
  82. </el-form-item>
  83. </el-row>
  84. <el-row v-if="!scanDisabled" style="display: flex; align-items: flex-end;">
  85. <el-form-item label="扫描装箱">
  86. <el-input v-model="scanRollNo" ref="scanRollNo" :disabled="scanDisabled" @keyup.enter.native="handleBoxAction" style="width: 200px"></el-input>
  87. </el-form-item>
  88. <!-- <el-form-item label="操作类型">-->
  89. <!-- <el-radio-group v-model="boxActionType" size="small">-->
  90. <!-- <el-radio-button label="add">添加</el-radio-button>-->
  91. <!-- <el-radio-button label="delete">删除</el-radio-button>-->
  92. <!-- </el-radio-group>-->
  93. <!-- </el-form-item>-->
  94. <el-form-item label="操作类型" >
  95. <el-radio-group v-model="boxActionType" >
  96. <el-radio label="add" border>添加</el-radio>
  97. <el-radio label="delete" border>删除</el-radio>
  98. </el-radio-group>
  99. </el-form-item>
  100. <span style="margin-left: auto; font-size: 14px; display: inline-block; padding-bottom: 5px; white-space: nowrap;">
  101. <span style="margin-right: 20px;">
  102. <span style="color: #606266;">卷标签张数</span>
  103. <span style="color: rgb(38, 92, 147); font-weight: bold;">{{boxStatistics.rollCount}}</span>
  104. </span>
  105. <span>
  106. <span style="color: #606266;">物料总数</span>
  107. <span style="color: rgb(38, 92, 147); font-weight: bold;">{{boxStatistics.totalQty}}</span>
  108. </span>
  109. </span>
  110. </el-row>
  111. </el-form>
  112. <el-table
  113. :height="300"
  114. :data="modelList"
  115. stripe
  116. border
  117. style="width: 100%;">
  118. <el-table-column
  119. prop="orderId"
  120. header-align="center"
  121. align="center"
  122. min-width="60"
  123. label="序号">
  124. </el-table-column>
  125. <el-table-column
  126. prop="finalRollNo"
  127. header-align="center"
  128. align="center"
  129. min-width="100"
  130. label="卷号">
  131. </el-table-column>
  132. <el-table-column
  133. prop="partNo"
  134. header-align="center"
  135. align="left"
  136. min-width="100"
  137. label="物料编码">
  138. </el-table-column>
  139. <el-table-column
  140. prop="rollQty"
  141. header-align="center"
  142. align="right"
  143. min-width="100"
  144. label="数量">
  145. </el-table-column>
  146. <el-table-column
  147. prop="receivedDate"
  148. header-align="center"
  149. align="center"
  150. min-width="100"
  151. label="装箱日期">
  152. </el-table-column>
  153. <el-table-column
  154. prop="receivedBy"
  155. header-align="center"
  156. align="left"
  157. min-width="100"
  158. label="装箱人">
  159. </el-table-column>
  160. </el-table>
  161. <el-footer style="height:40px;margin-top: 25px;text-align:center">
  162. <el-button @click="boxModelFlag = false">关闭</el-button>
  163. </el-footer>
  164. </el-dialog>
  165. </div>
  166. </template>
  167. <script>
  168. import {
  169. deleteBoxRoll,
  170. deleteSoReceiveBoxesData,
  171. newSoReceiveBoxesData, scanBoxRoll,
  172. searchBoxDetail,
  173. searchSoReceiveBoxesData, updateBoxStatus
  174. } from '../../../api/boxManage/boxManage'
  175. import CartonLabelPrint from './CartonLabelPrint.vue'
  176. import Vue from 'vue'
  177. import getLodop from '@/utils/LodopFuncs.js'
  178. import QRCode from 'qrcode'
  179. export default {
  180. components: {
  181. },
  182. data() {
  183. return {
  184. dataList: [],
  185. searchData: {
  186. site: '',
  187. username: '',
  188. buNo: '',
  189. orderNo: '',
  190. boxType: '',
  191. orderStatus: '',
  192. height:'300',
  193. page: 1,
  194. limit: 1000
  195. },
  196. scanDisabled: false,
  197. dataListLoading: false,
  198. currentRow:'',
  199. columnList: [
  200. {
  201. userId: this.$store.state.user.name,
  202. functionId: this.functionId,
  203. serialNumber: '750001Table2BoxNo',
  204. tableId: "750001Table2",
  205. tableName: "装箱清单",
  206. columnProp: "boxNo",
  207. headerAlign: "center",
  208. align: "left",
  209. columnLabel: "外箱标签",
  210. columnWidth: '120',
  211. columnHidden: false,
  212. columnImage: false,
  213. columnSortable: false,
  214. sortLv: 0,
  215. status: true,
  216. fixed: false
  217. },
  218. {
  219. userId: this.$store.state.user.name,
  220. functionId: this.functionId,
  221. serialNumber: '750001Table2Status',
  222. tableId: "750001Table2",
  223. tableName: "装箱清单",
  224. columnProp: "status",
  225. headerAlign: "center",
  226. align: "center",
  227. columnLabel: "状态",
  228. columnWidth: '80',
  229. columnHidden: false,
  230. columnImage: false,
  231. columnSortable: false,
  232. sortLv: 0,
  233. status: true,
  234. fixed: false
  235. },
  236. {
  237. userId: this.$store.state.user.name,
  238. functionId: this.functionId,
  239. serialNumber: '750001Table2RollsQty',
  240. tableId: "750001Table2",
  241. tableName: "装箱清单",
  242. columnProp: "rollsQty",
  243. headerAlign: "center",
  244. align: "right",
  245. columnLabel: "装箱张数",
  246. columnWidth: '80',
  247. columnHidden: false,
  248. columnImage: false,
  249. columnSortable: false,
  250. sortLv: 0,
  251. status: true,
  252. fixed: false
  253. },
  254. {
  255. userId: this.$store.state.user.name,
  256. functionId: this.functionId,
  257. serialNumber: '750001Table2RollsCount',
  258. tableId: "750001Table2",
  259. tableName: "装箱清单",
  260. columnProp: "rollsCount",
  261. headerAlign: "center",
  262. align: "right",
  263. columnLabel: "装箱总数",
  264. columnWidth: '80',
  265. columnHidden: false,
  266. columnImage: false,
  267. columnSortable: false,
  268. sortLv: 0,
  269. status: true,
  270. fixed: false
  271. },
  272. {
  273. userId: this.$store.state.user.name,
  274. functionId: this.functionId,
  275. serialNumber: '750001Table2WareHouseID',
  276. tableId: "750001Table2",
  277. tableName: "装箱清单",
  278. columnProp: "wareHouseID",
  279. headerAlign: "center",
  280. align: "left",
  281. columnLabel: "所在仓库",
  282. columnWidth: '100',
  283. columnHidden: false,
  284. columnImage: false,
  285. columnSortable: false,
  286. sortLv: 0,
  287. status: true,
  288. fixed: false
  289. },
  290. {
  291. userId: this.$store.state.user.name,
  292. functionId: this.functionId,
  293. serialNumber: '750001Table2WareHouseName',
  294. tableId: "750001Table2",
  295. tableName: "装箱清单",
  296. columnProp: "wareHouseName",
  297. headerAlign: "center",
  298. align: "left",
  299. columnLabel: "所在仓库名称",
  300. columnWidth: '100',
  301. columnHidden: false,
  302. columnImage: false,
  303. columnSortable: false,
  304. sortLv: 0,
  305. status: true,
  306. fixed: false
  307. },
  308. {
  309. userId: this.$store.state.user.name,
  310. functionId: this.functionId,
  311. serialNumber: '750001Table2CreatedBy',
  312. tableId: "750001Table2",
  313. tableName: "装箱清单",
  314. columnProp: "createdBy",
  315. headerAlign: "center",
  316. align: "left",
  317. columnLabel: "创建人",
  318. columnWidth: '100',
  319. columnHidden: false,
  320. columnImage: false,
  321. columnSortable: false,
  322. sortLv: 0,
  323. status: true,
  324. fixed: false
  325. },
  326. {
  327. userId: this.$store.state.user.name,
  328. functionId: this.functionId,
  329. serialNumber: '750001Table2CreatedDate',
  330. tableId: "750001Table2",
  331. tableName: "装箱清单",
  332. columnProp: "createdDate",
  333. headerAlign: "center",
  334. align: "left",
  335. columnLabel: "创建时间",
  336. columnWidth: '100',
  337. columnHidden: false,
  338. columnImage: false,
  339. columnSortable: false,
  340. sortLv: 0,
  341. status: true,
  342. fixed: false
  343. },
  344. ],
  345. modelList:[],
  346. rollList:[],
  347. boxData:{
  348. site:'',
  349. orderNo:'',
  350. boxNo:'',
  351. buNo:'',
  352. wareHouseID:'',
  353. rollsQty: 0,
  354. stdPackingQty: 0, // 标准装箱数量
  355. },
  356. scanRollNo:'',
  357. boxModelFlag: false,
  358. boxActionType: 'add', // 新增:添加/删除模式
  359. selectedBoxes: [], // 选中的外箱列表
  360. boxingStatistics: {
  361. boxCount: 0, // 箱标签张数
  362. rollCount: 0, // 卷标签张数
  363. rollsCount: 0 // 物料总数
  364. }
  365. }
  366. },
  367. computed: {
  368. // 装箱统计
  369. boxStatistics() {
  370. return {
  371. rollCount: this.modelList.length, // 卷标签张数
  372. totalQty: this.modelList.reduce((sum, item) => sum + (parseFloat(item.rollQty) || 0), 0) // 物料总数
  373. };
  374. }
  375. },
  376. methods: {
  377. //初始化组件的参数
  378. init(inData) {
  379. //初始化参数
  380. this.searchData = JSON.parse(JSON.stringify(inData));
  381. //刷新表格
  382. this.searchTable();
  383. },
  384. searchTable(){
  385. searchSoReceiveBoxesData(this.searchData).then(({data}) => {
  386. //区分请求成功和失败的状况
  387. if (data && data.code == 0) {
  388. this.dataList = data.rows
  389. // 更新统计数据 - 从列表第一条记录中获取
  390. if (data.rows && data.rows.length > 0) {
  391. const firstRecord = data.rows[0]
  392. this.boxingStatistics.boxCount = firstRecord.boxCount || 0
  393. this.boxingStatistics.rollCount = firstRecord.rollCount || 0
  394. this.boxingStatistics.rollsCount = firstRecord.rollsCount || 0
  395. } else {
  396. this.boxingStatistics.boxCount = 0
  397. this.boxingStatistics.rollCount = 0
  398. this.boxingStatistics.rollsCount = 0
  399. }
  400. } else {
  401. this.dataList = [];
  402. // 清空统计数据
  403. this.boxingStatistics.boxCount = 0
  404. this.boxingStatistics.rollCount = 0
  405. this.boxingStatistics.rollsCount = 0
  406. }
  407. });
  408. },
  409. newBox(){
  410. this.$confirm(`确定为此销售发货单新建箱?`, '提示', {
  411. confirmButtonText: '确定',
  412. cancelButtonText: '取消',
  413. type: 'warning'
  414. }).then(() => {
  415. let inData={
  416. site: this.searchData.site,
  417. createdBy: this.$store.state. user.name,
  418. buNo: this.searchData.buNo,
  419. orderNo: this.searchData.orderNo,
  420. saleOrderNo: this.searchData.saleOrderNo || '', // 销售订单号,用于生成箱号
  421. boxType: this.searchData.boxType,
  422. status:'未封箱',
  423. rollsQty: 0,
  424. }
  425. newSoReceiveBoxesData(inData).then(({data}) => {
  426. if (data && data.code == 0) {
  427. this.$message.success( '操作成功')
  428. this.searchTable();
  429. let data2={
  430. site: this.searchData.site,
  431. boxNo: data.boxNo,
  432. buNo: this.searchData.buNo,
  433. }
  434. this.searchBox(data2)
  435. this.boxModelFlag = true
  436. this.boxActionType='add'
  437. this.$nextTick(() => {
  438. this.$refs.scanRollNo.focus();
  439. });
  440. } else {
  441. this.$alert(data.msg, '错误', {
  442. confirmButtonText: '确定'
  443. })
  444. }
  445. })
  446. })
  447. },
  448. boxModelOpen(row){
  449. let inData={
  450. site: row.site,
  451. boxNo: row.boxNo,
  452. buNo: row.buNo,
  453. }
  454. this.searchBox(inData)
  455. if(row.status==='未封箱'){
  456. this.scanDisabled=false
  457. }else {
  458. this.scanDisabled = true
  459. }
  460. this.scanRollNo=''
  461. this.boxModelFlag = true
  462. this.boxActionType='add'
  463. this.$nextTick(() => {
  464. this.$refs.scanRollNo.focus();
  465. });
  466. },
  467. searchBox(inData){
  468. searchBoxDetail(inData).then(({data}) => {
  469. if (data && data.code == 0) {
  470. this.modelList=data.rows
  471. this.boxData=data.row
  472. }
  473. })
  474. },
  475. deleteBox(row){
  476. this.$confirm(`确定删除此箱?`, '提示', {
  477. confirmButtonText: '确定',
  478. cancelButtonText: '取消',
  479. type: 'warning'
  480. }).then(() => {
  481. deleteSoReceiveBoxesData(row).then(({data}) => {
  482. if (data && data.code == 0) {
  483. this.$message.success( '操作成功')
  484. this.searchTable();
  485. } else {
  486. this.$message.error( data.msg)
  487. }
  488. })
  489. })
  490. },
  491. fengxiang(row){
  492. this.$confirm(`确定封箱?`, '提示', {
  493. confirmButtonText: '确定',
  494. cancelButtonText: '取消',
  495. type: 'warning'
  496. }).then(() => {
  497. let inData={
  498. site: row.site,
  499. boxNo: row.boxNo,
  500. buNo: row.buNo,
  501. id: row.id,
  502. flag:0,
  503. }
  504. updateBoxStatus(inData).then(({data}) => {
  505. if (data && data.code == 0) {
  506. this.$message.success( '操作成功')
  507. this.searchTable();
  508. }else {
  509. this.$message.error( data.msg)
  510. }
  511. })
  512. })
  513. },
  514. chaixiang(row){
  515. this.$confirm(`确定封箱?`, '提示', {
  516. confirmButtonText: '确定',
  517. cancelButtonText: '取消',
  518. type: 'warning'
  519. }).then(() => {
  520. let inData={
  521. site: row.site,
  522. boxNo: row.boxNo,
  523. buNo: row.buNo,
  524. id: row.id,
  525. flag:1,
  526. }
  527. updateBoxStatus(inData).then(({data}) => {
  528. if (data && data.code == 0) {
  529. this.$message.success( '操作成功')
  530. this.searchTable();
  531. }else {
  532. this.$message.error( data.msg)
  533. }
  534. })
  535. })
  536. },
  537. // 多选变化
  538. handleSelectionChange(val) {
  539. this.selectedBoxes = val
  540. },
  541. // 打印外箱标签 - 纸张尺寸:70mm x 20mm
  542. async printCartonLabels() {
  543. if (this.selectedBoxes.length === 0) {
  544. this.$message.warning('请选择要打印的外箱!')
  545. return
  546. }
  547. const LODOP = getLodop()
  548. if (!LODOP) {
  549. this.$message.error('未检测到打印控件,请安装CLodop打印控件!')
  550. return
  551. }
  552. try {
  553. // 初始化打印
  554. LODOP.PRINT_INIT('外箱标签打印')
  555. // 纸张尺寸设置:宽度=700(70mm), 高度=200(20mm)
  556. LODOP.SET_PRINT_PAGESIZE(0, 700, 200, '')
  557. // 循环打印每个选中的外箱
  558. for (let i = 0; i < this.selectedBoxes.length; i++) {
  559. const box = this.selectedBoxes[i]
  560. if (i > 0) {
  561. LODOP.NEWPAGE() // 新页
  562. }
  563. // ===== 绘制边框和分隔线 =====
  564. // 外边框: ADD_PRINT_RECT(上边距, 左边距, 宽度, 高度, 线宽, 线型)
  565. LODOP.ADD_PRINT_RECT('2mm', '2mm', '66mm', '16mm', 0, 1)
  566. // 中间竖线(左右分隔): ADD_PRINT_LINE(起点Y, 起点X, 终点Y, 终点X, 线宽, 线型)
  567. // 优化:竖线在54mm位置,左侧文字52mm,右侧二维码14mm
  568. LODOP.ADD_PRINT_LINE('2mm', '55mm', '18mm', '55mm', 0, 1)
  569. // 左侧横线(NO.和Carton No.之间): ADD_PRINT_LINE(起点Y, 起点X, 终点Y, 终点X, 线宽, 线型)
  570. LODOP.ADD_PRINT_LINE('10mm', '2mm', '10mm', '55mm', 0, 1)
  571. // ===== 左侧文字信息 =====
  572. // NO.文字: ADD_PRINT_TEXT(上边距, 左边距, 宽度, 高度, 内容)
  573. // 文字区域:从3mm到54mm,宽度50mm,字号5,Arial字体紧凑显示
  574. const text1 = LODOP.ADD_PRINT_TEXT('4.5mm', '3mm', '52mm', '5mm', 'NO:' + (this.searchData.orderNo || ''))
  575. LODOP.SET_PRINT_STYLEA(text1, "FontName", "Arial") // 使用Arial,紧凑字体
  576. LODOP.SET_PRINT_STYLEA(text1, "FontSize", 5) // 5号字体
  577. LODOP.SET_PRINT_STYLEA(text1, "Bold", 1) // 粗体
  578. // Carton No.文字: ADD_PRINT_TEXT(上边距, 左边距, 宽度, 高度, 内容)
  579. const text2 = LODOP.ADD_PRINT_TEXT('12.5mm', '3mm', '52mm', '5mm', 'Carton No:' + (box.boxNo || ''))
  580. LODOP.SET_PRINT_STYLEA(text2, "FontName", "Arial") // 使用Arial
  581. LODOP.SET_PRINT_STYLEA(text2, "FontSize", 5) // 5号字体
  582. LODOP.SET_PRINT_STYLEA(text2, "Bold", 1) // 粗体
  583. // ===== 右侧二维码 =====
  584. // 二维码: ADD_PRINT_BARCODE(上边距, 左边距, 宽度, 高度, 类型, 内容)
  585. // 右侧区域:从54mm到68mm(宽14mm),二维码12mm x 12mm,居中显示
  586. const qrIndex = LODOP.ADD_PRINT_BARCODE('4mm', '56mm', '12.6mm', '12.6mm', 'QRCode', box.boxNo)
  587. LODOP.SET_PRINT_STYLEA(qrIndex, "QRCodeVersion", 3) // 二维码版本3,适中大小
  588. LODOP.SET_PRINT_STYLEA(qrIndex, "QRCodeErrorLevel", "L") // M级纠错,平衡大小和容错
  589. }
  590. // 执行打印
  591. //LODOP.PREVIEW() // 取消注释可预览
  592. LODOP.PRINT();
  593. } catch (error) {
  594. console.error('打印失败:', error)
  595. this.$message.error('打印失败: ' + error.message)
  596. }
  597. },
  598. handleBoxAction() {
  599. // const arr = this.scanRollNo.split(';');
  600. // if (arr.length < 3) {
  601. // this.$message.error('扫描的标签格式不正确!');
  602. // return;
  603. // }
  604. if(this.scanRollNo==null||this.scanRollNo===''){
  605. this.$message.error('请扫描标签!');
  606. }
  607. const inData = {
  608. site: this.boxData.site,
  609. buNo: this.boxData.buNo,
  610. finalRollNo: this.scanRollNo,
  611. boxNo: this.boxData.boxNo,
  612. };
  613. if(this.boxActionType==='add'){
  614. scanBoxRoll(inData).then(({data}) => {
  615. if (data && data.code === 0) {
  616. this.$message.success('扫描成功');
  617. this.searchBox({
  618. site: this.boxData.site,
  619. boxNo: this.boxData.boxNo,
  620. buNo: this.boxData.buNo,
  621. });
  622. this.scanRollNo = '';
  623. this.$nextTick(() => {
  624. this.$refs.scanRollNo.focus();
  625. });
  626. } else {
  627. this.$message.error(data.msg || '扫描失败');
  628. this.scanRollNo = '';
  629. this.$nextTick(() => {
  630. this.$refs.scanRollNo.focus();
  631. });
  632. }
  633. }).catch(() => {
  634. this.$message.error('网络异常,扫描失败');
  635. this.scanRollNo = '';
  636. this.$nextTick(() => {
  637. this.$refs.scanRollNo.focus();
  638. });
  639. });
  640. }else {
  641. deleteBoxRoll(inData).then(({data}) => {
  642. if (data && data.code === 0) {
  643. this.$message.success('扫描成功');
  644. this.searchBox({
  645. site: this.boxData.site,
  646. boxNo: this.boxData.boxNo,
  647. buNo: this.boxData.buNo,
  648. });
  649. this.scanRollNo = '';
  650. this.$nextTick(() => {
  651. this.$refs.scanRollNo.focus();
  652. });
  653. } else {
  654. this.$message.error(data.msg || '扫描失败');
  655. this.scanRollNo = '';
  656. this.$nextTick(() => {
  657. this.$refs.scanRollNo.focus();
  658. });
  659. }
  660. }).catch(() => {
  661. this.$message.error('网络异常,扫描失败');
  662. this.scanRollNo = '';
  663. this.$nextTick(() => {
  664. this.$refs.scanRollNo.focus();
  665. });
  666. });
  667. }
  668. }
  669. },
  670. watch: {
  671. boxActionType() {
  672. this.$nextTick(() => {
  673. if (this.$refs.scanRollNo) {
  674. this.$refs.scanRollNo.focus();
  675. }
  676. });
  677. }
  678. },
  679. }
  680. </script>
  681. <style scoped lang="scss">
  682. .rq .auto /deep/ .el-form-item__content{
  683. height: auto;
  684. line-height: 1.5;
  685. }
  686. /deep/ .el-table__fixed-right-patch {
  687. display: none !important;
  688. }
  689. .sl .el-radio--medium.is-bordered {
  690. padding: 2px 5px 0px 5px;
  691. border-radius: 4px;
  692. height: 20px;
  693. }
  694. /* 标准装箱数量输入框右对齐 */
  695. .std-packing-qty-input /deep/ .el-input__inner {
  696. text-align: right;
  697. }
  698. </style>