my-modal-old.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  1. <!--未被引用-->
  2. <template>
  3. <modal v-model="modal" class-name="vertical-center-modal" width="1000px">
  4. <div class="content">
  5. <div class="title">出货管理</div>
  6. <div class="row">
  7. <div class="col">
  8. <div class="label">件号:</div>
  9. <div class="value">{{ data.materialCode }}</div>
  10. </div>
  11. <div class="col">
  12. <div class="label">物料名称:</div>
  13. <div class="value">{{ data.materialName }}</div>
  14. </div>
  15. <div class="col">
  16. <div class="label">规格:</div>
  17. <div class="value">{{ data.spec }}</div>
  18. </div>
  19. </div>
  20. <div class="row">
  21. <div class="col">
  22. <div class="label">采购数量:</div>
  23. <div class="value">{{ data.purchaseQty }}</div>
  24. </div>
  25. <div class="col">
  26. <div class="label">单价:</div>
  27. <div class="value">{{ data.price }}</div>
  28. </div>
  29. <div class="col">
  30. <div class="label">合同金额:</div>
  31. <div class="value">{{ data.totalAmount }}</div>
  32. </div>
  33. </div>
  34. <div class="row">
  35. <div class="col">
  36. <div class="label">二维码个数:</div>
  37. <div class="value">{{ tableData.tagCount }}</div>
  38. </div>
  39. <div class="col">
  40. <div class="label">生成总数量:</div>
  41. <div class="value">{{ tableData.totalQty }}</div>
  42. </div>
  43. <div class="col">
  44. <div class="label">已发货:</div>
  45. <div class="value">{{ tableData.hadShipQty }}</div>
  46. </div>
  47. </div>
  48. <div class="row">
  49. <div class="col">
  50. <div class="label">未发货:</div>
  51. <div class="value">{{ tableData.unShipQty }}</div>
  52. </div>
  53. <div class="col"></div>
  54. <div class="col"></div>
  55. </div>
  56. <div class="table">
  57. <my-table
  58. ref="table"
  59. :data="tableData.qrCodeItems"
  60. :columns="columns"
  61. :table-filter="tableFilter"
  62. selectKey="id"
  63. :table-page="params"
  64. height="300"
  65. @event-handle="eventHandle"
  66. @on-select="getSelect"
  67. @on-change="changePage"
  68. >
  69. </my-table>
  70. </div>
  71. </div>
  72. <div class="footer" slot="footer">
  73. <Button @click="cancel" class="btn" type="primary">关闭</Button>
  74. </div>
  75. <!-- 导入码单 -->
  76. <modal v-model="importShow" class-name="vertical-center-modal" width="500px">
  77. <div class="title" slot="header">导入码单</div>
  78. <div class="footer" slot="footer">
  79. <Button @click="importCfm" class="btn" type="primary" size="small">提交</Button>
  80. <Button @click="importCancel" class="btn">取消</Button>
  81. </div>
  82. <div class="sub-content">
  83. <div class="wrap">
  84. <div class="row">
  85. <div class="col" style="align-items: center">
  86. <div class="label">码单文件:</div>
  87. <Upload action="" ref="uploadFileFlag" :before-upload="beforeFile">
  88. <Button icon="ios-cloud-upload-outline">
  89. 上传文件
  90. </Button>
  91. </Upload>
  92. </div>
  93. </div>
  94. <div class="row" v-if="importFileName">
  95. <div class="col" style="position:relative;">
  96. {{ importFileName }}
  97. <Icon type="md-close" style="position:absolute;right: 0;" @click="removeFile" />
  98. </div>
  99. </div>
  100. <!-- <div class="row">-->
  101. <!-- <div class="col">-->
  102. <!-- <span style="color: red;margin-right: 10px">导入码单模板下载</span>-->
  103. <!-- <a href="https://fzjx.oss-cn-hangzhou.aliyuncs.com/order/20211014/211014041759903892.xlsx">点击下载</a>-->
  104. <!-- </div>-->
  105. <!-- </div>-->
  106. </div>
  107. </div>
  108. </modal>
  109. <!-- 添加二维码 -->
  110. <modal v-model="addShow" class-name="vertical-center-modal" width="500px">
  111. <div class="title" slot="header">添加二维码</div>
  112. <div class="footer" slot="footer">
  113. <Button @click="addQrCfm" class="btn" type="primary" size="small">提交</Button>
  114. <Button @click="addQrCancel" class="btn">取消</Button>
  115. </div>
  116. <div class="sub-content">
  117. <div class="wrap">
  118. <div class="row">
  119. <div class="col">
  120. <div class="label">合同编号:</div>
  121. <div class="value">{{ data.purchaseBillNo }}</div>
  122. </div>
  123. </div>
  124. <div class="row">
  125. <div class="col">
  126. <div class="label">物料编码:</div>
  127. <div class="value">{{ data.materialCode }}</div>
  128. </div>
  129. </div>
  130. <div class="row">
  131. <div class="col">
  132. <div class="label">物料名称:</div>
  133. <div class="value">{{ data.materialName }}</div>
  134. </div>
  135. </div>
  136. <div class="row">
  137. <div class="col">
  138. <div class="label">物料规格:</div>
  139. <div class="value">{{ data.spec }}</div>
  140. </div>
  141. </div>
  142. <div class="row">
  143. <div class="col">
  144. <div class="label">物料单位:</div>
  145. <div class="value">{{ data.unitName }}</div>
  146. </div>
  147. </div>
  148. <div class="row">
  149. <div class="col">
  150. <div class="label">物料长度:</div>
  151. <div class="value">
  152. <Input v-model="addQrInputWidth" size="small" @on-enter="addQrCfm"/>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. <div class="row" v-if="addQrType === 'dispatch'" style="padding: 10px 20px;">
  158. <div class="col">
  159. <div class="label">添加个数:</div>
  160. <div class="value">
  161. <Input v-model="addQrInputNum" size="small" @on-enter="addQrCfm"/>
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166. </modal>
  167. <!-- 出货 -->
  168. <modal v-model="shipmentShow" class-name="vertical-center-modal" width="500px">
  169. <div class="title" slot="header">请输入物流信息</div>
  170. <div class="sub-content" style="padding: 20px">
  171. <div class="row">
  172. <div class="col">
  173. <div class="label">出货方式:</div>
  174. <div class="value">
  175. <RadioGroup v-model="shipmentType">
  176. <Radio label="0">
  177. <span>物流公司</span>
  178. </Radio>
  179. <Radio label="1">
  180. <span>包车</span>
  181. </Radio>
  182. </RadioGroup>
  183. </div>
  184. </div>
  185. </div>
  186. <div class="row" v-if="shipmentType === '0'">
  187. <div class="col">
  188. <div class="label">物流名称:</div>
  189. <div class="value">
  190. <Select v-model="shipmentExpress" filterable size="small">
  191. <Option value="中通">中通</Option>
  192. <Option value="申通">申通</Option>
  193. <Option value="顺丰">顺丰</Option>
  194. <Option value="德邦">德邦</Option>
  195. </Select>
  196. </div>
  197. </div>
  198. <div class="col">
  199. <div class="label">物流单号:</div>
  200. <div class="value">
  201. <Input v-model="shipmentOrderNo" size="small"/>
  202. </div>
  203. </div>
  204. </div>
  205. <div class="row" v-if="shipmentType === '1'">
  206. <div class="col">
  207. <div class="label">司机姓名:</div>
  208. <div class="value">
  209. <Input v-model="shipmentName" size="small"/>
  210. </div>
  211. </div>
  212. <div class="col">
  213. <div class="label">联系电话:</div>
  214. <div class="value">
  215. <Input v-model="shipmentPhone" size="small"/>
  216. </div>
  217. </div>
  218. </div>
  219. <div class="row" v-if="shipmentType === '1'">
  220. <div class="col">
  221. <div class="label">车牌号码:</div>
  222. <div class="value">
  223. <Input v-model="shipmentCarNo" size="small"/>
  224. </div>
  225. </div>
  226. <div class="col"></div>
  227. </div>
  228. <div class="row">
  229. <div class="col" style="align-items: flex-start">
  230. <div class="label">备注:</div>
  231. <div class="value">
  232. <Input v-model="shipmentRemark" type="textarea"/>
  233. </div>
  234. </div>
  235. </div>
  236. </div>
  237. <div class="footer" slot="footer">
  238. <Button @click="shipmentCfm" class="btn" type="primary" size="small">提交</Button>
  239. <Button @click="shipmentCancel" class="btn">取消</Button>
  240. </div>
  241. </modal>
  242. <!-- 打印二维码标签内容 -->
  243. <div class="print-wrap">
  244. <div ref="print">
  245. <div
  246. v-for="(item, index) in printList"
  247. :key="index"
  248. class="print"
  249. style="box-sizing: border-box;height: calc(150mm - 21px);width: calc(100mm - 20px);
  250. margin: 10px;border: 1px solid #000;page-break-after: always;
  251. ">
  252. <div class="top"
  253. style="height: 200px;display: flex;align-items: center;
  254. border-bottom: 1px solid #000;box-sizing: border-box;overflow: hidden;"
  255. >
  256. <div class="left" style="padding: 10px;display: flex;align-items: center;justify-content: center;flex-direction: column">
  257. <vue-qr :text="item.qrCode" :size="120" :margin="0"></vue-qr>
  258. {{ item.number }}
  259. </div>
  260. <div class="right"
  261. style="height: 100%;
  262. padding: 10px;
  263. flex: 2;
  264. display: flex;
  265. justify-content: center;
  266. align-items: center;
  267. font-size: 12px;
  268. border-left: 1px solid #000;
  269. ">
  270. RFID标签粘贴区
  271. <!-- <div class="row" style="font-size: 18px;font-weight: bold;">物料编码:{{ item.materialCode }}</div>-->
  272. <!-- <div class="row" style="font-size: 18px;font-weight: bold;">物料名称:{{ item.materialName }}</div>-->
  273. <!-- <div class="row" style="font-size: 18px;font-weight: bold;">标签编码:{{ item.rfidCode }}</div>-->
  274. <!-- <div class="row" style="font-size: 18px;font-weight: bold;">门幅:{{ item.width }}</div>-->
  275. <!-- <div class="row" style="font-size: 18px;font-weight: bold;">克重:{{ item.unitWeight }}</div>-->
  276. <!-- <div class="row" style="font-size: 18px;font-weight: bold;">长度:{{ item.quantity }}米</div>-->
  277. </div>
  278. </div>
  279. <div class="bottom"
  280. style="
  281. height: calc(100% - 200px);
  282. "
  283. >
  284. <div
  285. style="border-bottom: 1px solid #000;
  286. padding: 0 10px;
  287. width: calc(100% - 20px);
  288. height: 35%;
  289. word-break:break-all;
  290. display: flex;
  291. flex-direction: column;
  292. align-items: flex-start;
  293. justify-content: space-around;
  294. "
  295. >
  296. <div class="row" style="font-size: 18px;font-weight: bold;">合同编号:{{ data.purchaseBillNo }}</div>
  297. <div class="row" style="font-size: 18px;font-weight: bold;">供应商:{{ data.supplierName }}</div>
  298. <div class="row" style="font-size: 18px;font-weight: bold;">出货日期:{{ item.createdTime }}</div>
  299. </div>
  300. <div style="border-bottom: 1px solid #000;padding: 0 10px;width: calc(100% - 20px);height: 25%;display: flex;align-items: center;justify-content: center;font-size: 24px;font-weight: bold;text-align: center;">
  301. {{ item.materialName }}
  302. </div>
  303. <div style="border-bottom: 1px solid #000;padding: 0 10px;width: calc(100% - 20px);height: 25%;display: flex;align-items: center;justify-content: center;font-size: 38px;font-weight: bold;text-align: center;">
  304. 数量:{{ item.quantity }}
  305. </div>
  306. <div style="width: 100%;
  307. height: 15%;
  308. display: flex;justify-content: space-between;align-items: center;;
  309. ">
  310. <div style="font-size: 24px;font-weight: bold;text-align: center;flex: 1;">门幅:{{ item.width }}</div>
  311. <div style="font-size: 24px;font-weight: bold;text-align: center;flex: 1;">克重:{{ item.unitWeight }}</div>
  312. </div>
  313. </div>
  314. </div>
  315. </div>
  316. </div>
  317. </modal>
  318. </template>
  319. <script>
  320. import {
  321. GetSupplierQRCode,
  322. AddSupplierQRCode,
  323. AddSupplierShipOut,
  324. DeleteSupplierQRCode,
  325. PrinterSupplierQRCode,
  326. CompletePurchase
  327. } from '@/api/supplierShip'
  328. import MyTable from '_c/my-table/my-table'
  329. import VueQr from 'vue-qr'
  330. import excel from '@/libs/excel'
  331. export default {
  332. name: 'my-modal',
  333. data () {
  334. return {
  335. tipShow: false,
  336. importFileName: '',
  337. importData: [],
  338. uploadFile: null,
  339. stockTagIds: [], // 表格勾选的id
  340. printList: [], // 打印数据
  341. tableData: [],
  342. shipmentCarNo: '',
  343. shipmentPhone: '',
  344. shipmentName: '',
  345. shipmentType: '0',
  346. shipmentExpress: '',
  347. shipmentOrderNo: '',
  348. shipmentRemark: '',
  349. addQrInputNum: '',
  350. addQrInputWidth: '',
  351. addQrType: '', // add单个添加 dispatch批量添加
  352. show: false, // 合同信息
  353. addShow: false, // 添加二维码
  354. importShow: false, // 导入码单
  355. shipmentShow: false, // 出货
  356. modal: false,
  357. columns: [
  358. {
  359. type: 'selection',
  360. width: 60,
  361. align: 'center'
  362. },
  363. {
  364. title: '二维码编码',
  365. key: 'number',
  366. width: 100,
  367. align: 'center'
  368. },
  369. {
  370. title: '物料编码',
  371. key: 'materialCode',
  372. minWidth: 150
  373. },
  374. {
  375. title: '物料名称',
  376. key: 'materialName',
  377. minWidth: 200
  378. },
  379. {
  380. title: '物料数量',
  381. key: 'quantity',
  382. minWidth: 150
  383. },
  384. {
  385. title: '生成时间',
  386. key: 'createdTime',
  387. minWidth: 150
  388. },
  389. {
  390. title: '打印状态',
  391. key: 'hadPrinter',
  392. minWidth: 120,
  393. align: 'center',
  394. fixed: 'right',
  395. render: (h, params) => {
  396. return h('span', params.row.hadPrinter ? '已打印' : '未打印')
  397. },
  398. renderHeader: (h, params) => {
  399. let _this = this
  400. return h('div', [
  401. h('span', '打印状态'),
  402. _this.$createElement('Poptip',
  403. {
  404. ref: 'filter-tip',
  405. props: {
  406. transfer: true
  407. }
  408. },
  409. [
  410. h('Icon', {
  411. props: {
  412. type: 'ios-funnel'
  413. },
  414. style: {
  415. padding: '0 2px'
  416. }
  417. }),
  418. _this.$createElement('div',
  419. {
  420. slot: 'content'
  421. },
  422. [
  423. h('div',
  424. {
  425. class: 'tip-item',
  426. style: {
  427. padding: '10px',
  428. textAlign: 'center',
  429. cursor: 'pointer',
  430. borderBottom: '1px solid #eee'
  431. },
  432. on: {
  433. click () {
  434. _this.$refs['filter-tip'].cancel()
  435. _this.params.hadPrinter = ''
  436. _this.getSupplierQRCode()
  437. }
  438. }
  439. },
  440. '全部'),
  441. h('div',
  442. {
  443. class: 'tip-item',
  444. style: {
  445. padding: '10px',
  446. textAlign: 'center',
  447. cursor: 'pointer',
  448. borderBottom: '1px solid #eee'
  449. },
  450. on: {
  451. click () {
  452. _this.$refs['filter-tip'].cancel()
  453. _this.params.hadPrinter = false
  454. _this.getSupplierQRCode()
  455. }
  456. }
  457. },
  458. '未打印'),
  459. h('div',
  460. {
  461. class: 'tip-item',
  462. style: {
  463. textAlign: 'center',
  464. cursor: 'pointer',
  465. padding: '10px'
  466. },
  467. on: {
  468. click () {
  469. _this.$refs['filter-tip'].cancel()
  470. _this.params.hadPrinter = true
  471. _this.getSupplierQRCode()
  472. }
  473. }
  474. },
  475. '已打印')
  476. ]
  477. )
  478. ]
  479. )
  480. ])
  481. }
  482. },
  483. {
  484. title: '出货状态',
  485. key: 'hadShipment',
  486. minWidth: 100,
  487. align: 'center',
  488. fixed: 'right',
  489. render: (h, params) => {
  490. return h('span', params.row.hadShipment ? '已出货' : '未出货')
  491. },
  492. renderHeader: (h, params) => {
  493. let _this = this
  494. return h('div', [
  495. h('span', '出货状态'),
  496. _this.$createElement('Poptip',
  497. {
  498. ref: 'filter-tip2',
  499. props: {
  500. transfer: true
  501. },
  502. attrs: {
  503. width: '150px'
  504. }
  505. },
  506. [
  507. h('Icon', {
  508. props: {
  509. type: 'ios-funnel'
  510. },
  511. style: {
  512. padding: '0 2px'
  513. }
  514. }),
  515. _this.$createElement('div',
  516. {
  517. slot: 'content'
  518. },
  519. [
  520. h('div',
  521. {
  522. class: 'tip-item',
  523. style: {
  524. padding: '10px',
  525. textAlign: 'center',
  526. cursor: 'pointer',
  527. borderBottom: '1px solid #eee'
  528. },
  529. on: {
  530. click () {
  531. _this.$refs['filter-tip2'].cancel()
  532. _this.params.hadShipment = ''
  533. _this.getSupplierQRCode()
  534. }
  535. }
  536. },
  537. '全部'),
  538. h('div',
  539. {
  540. class: 'tip-item',
  541. style: {
  542. padding: '10px',
  543. textAlign: 'center',
  544. cursor: 'pointer',
  545. borderBottom: '1px solid #eee'
  546. },
  547. on: {
  548. click () {
  549. _this.$refs['filter-tip2'].cancel()
  550. _this.params.hadShipment = false
  551. _this.getSupplierQRCode()
  552. }
  553. }
  554. },
  555. '未出货'),
  556. h('div',
  557. {
  558. class: 'tip-item',
  559. style: {
  560. textAlign: 'center',
  561. cursor: 'pointer',
  562. padding: '10px'
  563. },
  564. on: {
  565. click () {
  566. _this.$refs['filter-tip2'].cancel()
  567. _this.params.hadShipment = true
  568. _this.getSupplierQRCode()
  569. }
  570. }
  571. },
  572. '已出货')
  573. ]
  574. )
  575. ]
  576. )
  577. ])
  578. }
  579. }
  580. ],
  581. tableFilter: [
  582. {
  583. name: 'span',
  584. text: '物料详情',
  585. style: {
  586. fontSize: '14px',
  587. fontWeight: 'bold'
  588. }
  589. },
  590. {
  591. name: 'Button',
  592. type: 'error',
  593. text: '删除',
  594. e: 'del',
  595. align: 'right'
  596. },
  597. {
  598. name: 'Button',
  599. type: 'primary',
  600. text: '出货',
  601. e: 'shipment',
  602. align: 'right'
  603. },
  604. // {
  605. // name: 'Button',
  606. // type: 'primary',
  607. // text: '结束合同',
  608. // e: 'over',
  609. // align: 'right'
  610. // },
  611. {
  612. name: 'Button',
  613. type: 'primary',
  614. text: '打印二维码',
  615. width: '100px',
  616. e: 'print',
  617. align: 'right'
  618. },
  619. {
  620. name: 'Button',
  621. type: 'primary',
  622. text: '导入码单',
  623. width: '100px',
  624. e: 'importExcel',
  625. align: 'right'
  626. },
  627. {
  628. name: 'Button',
  629. type: 'primary',
  630. text: '批量添加',
  631. e: 'addDispath',
  632. align: 'right'
  633. },
  634. {
  635. name: 'Button',
  636. type: 'primary',
  637. text: '添加二维码',
  638. width: '100px',
  639. e: 'addQr',
  640. align: 'right'
  641. }
  642. ],
  643. params: {
  644. pageIndex: 1,
  645. pageSize: 20,
  646. total: 0
  647. }
  648. }
  649. },
  650. components: {
  651. MyTable,
  652. VueQr
  653. },
  654. props: {
  655. data: {
  656. type: Object,
  657. default () {
  658. return {}
  659. }
  660. },
  661. value: {
  662. type: Boolean,
  663. default: false,
  664. require: true
  665. }
  666. },
  667. watch: {
  668. value: {
  669. handler (n) {
  670. this.modal = n
  671. },
  672. immediate: true
  673. },
  674. modal (n) {
  675. this.$emit('input', n)
  676. if (n) {
  677. this.getSupplierQRCode()
  678. }
  679. }
  680. },
  681. methods: {
  682. test () {
  683. },
  684. /* 移出文件 */
  685. importCancel () {
  686. this.importFileName = ''
  687. this.importData = []
  688. this.importShow = false
  689. },
  690. /* 移出文件 */
  691. removeFile () {
  692. this.importFileName = ''
  693. this.importData = []
  694. },
  695. /* 获取上传文件 */
  696. beforeFile (file) {
  697. const fileExt = file.name.split('.').pop().toLocaleLowerCase()
  698. this.uploadFile = file
  699. if (fileExt === 'xlsx' || fileExt === 'xls') {
  700. this.readFile(file)
  701. this.file = file
  702. } else {
  703. this.$Notice.warning({
  704. title: '文件类型错误',
  705. desc: '文件:' + file.name + '不是EXCEL文件,请选择后缀为.xlsx或者.xls的EXCEL文件。'
  706. })
  707. }
  708. return false
  709. },
  710. readFile (file) {
  711. const reader = new FileReader()
  712. reader.readAsArrayBuffer(file)
  713. reader.onloadstart = e => {
  714. }
  715. reader.onprogress = e => {
  716. }
  717. reader.onerror = e => {
  718. this.$Message.error('文件读取出错')
  719. }
  720. reader.onload = e => {
  721. const data = e.target.result
  722. const { results } = excel.read(data, 'array') // 这里的tableData就是拿到的excel表格中的数据
  723. console.log('?????exceldata--------------')
  724. console.log(results)
  725. let array = []
  726. results.forEach((item, index) => {
  727. if (Object.values(item)[0] === '卷号') {
  728. let data = Object.values(results[index + 1])
  729. data.shift()
  730. array.push(...data)
  731. }
  732. })
  733. this.importData = array
  734. this.importFileName = file.name
  735. console.log(array)
  736. }
  737. },
  738. getSelect (data) {
  739. console.log('table----data')
  740. console.log(data)
  741. this.printList = []
  742. this.printList = [ ...data ]
  743. // this.stockTagIds = data.filter(item => !item.hadPrinter).map(item => item.id)
  744. // this.stockTagIds = data.map(item => item.id)
  745. },
  746. changePage (pageIndex) {
  747. this.params.pageIndex = pageIndex
  748. this.getSupplierQRCode()
  749. },
  750. // 获取物料列表
  751. getSupplierQRCode () {
  752. GetSupplierQRCode({
  753. ...this.params,
  754. purchaseBillNo: this.data.purchaseBillNo
  755. }).then(res => {
  756. if (res.code === 0) {
  757. this.printList = []
  758. this.tableData = []
  759. this.$refs.table.tempList = []
  760. this.tableData = res.result
  761. this.params.total = res.result.tagCount
  762. }
  763. })
  764. },
  765. // 检索条件事件处理
  766. eventHandle (option) {
  767. switch (option._evnet) {
  768. case 'addQr':
  769. this.addQrType = 'add'
  770. this.addShow = true
  771. break
  772. case 'addDispath':
  773. this.addQrType = 'dispatch'
  774. this.addShow = true
  775. break
  776. case 'shipment':
  777. this.shipmentShow = true
  778. break
  779. case 'del':
  780. if (this.printList.length === 0) {
  781. return this.$Message.error('请选择数据!')
  782. }
  783. this.$MyModal.show({ text: '是否删除?' }).$on('confirm', () => {
  784. DeleteSupplierQRCode({
  785. stockTagIds: this.printList.map(item => item.id)
  786. }).then(res => {
  787. if (res.code === 0) {
  788. this.$Message.info(res.msg)
  789. this.printList = []
  790. this.$refs.table.clearTempList()
  791. this.getSupplierQRCode()
  792. }
  793. })
  794. })
  795. break
  796. case 'print':
  797. this.print()
  798. break
  799. case 'importExcel':
  800. this.importShow = true
  801. break
  802. case 'over':
  803. if (this.printList.length === 0) {
  804. return this.$Message.error('请选择数据!')
  805. }
  806. CompletePurchase()
  807. break
  808. }
  809. },
  810. print () {
  811. let arr = this.printList.filter(item => !item.hadPrinter).map(item => item.id)
  812. console.log(this.printList)
  813. console.log(arr)
  814. if (arr.length > 0) {
  815. PrinterSupplierQRCode({
  816. stockTagIds: arr
  817. }).then(res => {
  818. if (res.code === 0) {
  819. this.$Message.info(res.msg || '打印成功!')
  820. this.printList = []
  821. this.getSupplierQRCode()
  822. }
  823. })
  824. }
  825. if (this.printList.length > 0) {
  826. // 未改成vue-easy-print
  827. this.$print(this.$refs.print)
  828. }
  829. },
  830. cancel () {
  831. this.stockTagIds = []
  832. this.printList = []
  833. this.modal = false
  834. },
  835. addQrCancel () {
  836. this.addQrInputWidth = ''
  837. this.addQrInputNum = ''
  838. this.addShow = false
  839. },
  840. shipmentCancel () {
  841. this.shipmentType = '0'
  842. this.shipmentExpress = ''
  843. this.shipmentOrderNo = ''
  844. this.shipmentRemark = ''
  845. this.shipmentName = ''
  846. this.shipmentPhone = ''
  847. this.shipmentCarNo = ''
  848. this.shipmentShow = false
  849. },
  850. shipmentCfm () {
  851. let arr = this.printList.filter(item => !item.hadShipment).map(item => item.id)
  852. if (arr.length === 0) {
  853. return this.$Message.error('暂无需要出货的物料!')
  854. }
  855. AddSupplierShipOut({
  856. purchaseBillNo: this.data.purchaseBillNo,
  857. shipOutWay: this.shipmentType,
  858. expressShipNo: this.shipmentOrderNo,
  859. expressName: this.shipmentExpress,
  860. driverName: this.shipmentName,
  861. contactTel: this.shipmentPhone,
  862. plateNumber: this.shipmentCarNo,
  863. remark: this.shipmentRemark,
  864. stockTagIds: arr
  865. }).then(res => {
  866. if (res.code === 0) {
  867. this.$Message.info(res.msg || '出货成功!')
  868. this.getSupplierQRCode()
  869. this.shipmentCancel()
  870. }
  871. })
  872. },
  873. // 二维码添加
  874. addQrCfm () {
  875. if (!this.addQrInputWidth) {
  876. return this.$Message.error('请输入物料长度')
  877. }
  878. AddSupplierQRCode({
  879. purchaseBillNo: this.data.purchaseBillNo,
  880. quantity: this.addQrInputWidth,
  881. addNum: this.addQrInputNum || 1
  882. }).then(res => {
  883. if (res.code === 0) {
  884. this.$Message.info(res.msg || '添加成功!')
  885. this.getSupplierQRCode()
  886. this.addQrInputWidth = ''
  887. this.addQrInputNum = ''
  888. }
  889. })
  890. },
  891. // 码单添加
  892. importCfm () {
  893. if (this.importData.length === 0) {
  894. return this.$Message.error('导入码单数据为空!')
  895. }
  896. AddSupplierQRCode({
  897. purchaseBillNo: this.data.purchaseBillNo,
  898. supAddQRCodeWay: 1, // 0手动添加 1excel导入,
  899. lengthItems: this.importData
  900. }).then(res => {
  901. if (res.code === 0) {
  902. this.$Message.info(res.msg || '添加成功!')
  903. this.getSupplierQRCode()
  904. this.importShow = false
  905. this.importFileName = ''
  906. this.importData = []
  907. }
  908. })
  909. }
  910. },
  911. beforeUpdate () {
  912. }
  913. }
  914. </script>
  915. <style lang="less" scoped>
  916. .content {
  917. overflow: hidden;
  918. padding: 20px 40px;
  919. font-size: 14px;
  920. .title {
  921. padding-bottom: 20px;
  922. font-size: 20px;
  923. font-weight: bold;
  924. text-align: center;
  925. }
  926. .row {
  927. padding-bottom: 10px;
  928. display: flex;
  929. justify-content: space-between;
  930. align-items: flex-start;
  931. .col {
  932. flex: 1;
  933. display: flex;
  934. align-items: flex-start;
  935. .label {
  936. }
  937. .value {
  938. flex: 1;
  939. }
  940. }
  941. }
  942. .text {
  943. padding: 10px 0;
  944. }
  945. .table {
  946. //height: ~"calc(100% - 100px)";
  947. overflow: auto;
  948. margin: 10px 0;
  949. padding: 10px;
  950. border: 1px solid #dcdee2;
  951. }
  952. }
  953. .sub-content {
  954. padding: 0 20px;
  955. .title {
  956. padding: 10px;
  957. text-align: center;
  958. font-size: 20px;
  959. font-weight: bold;
  960. }
  961. .wrap {
  962. margin: 10px;
  963. padding: 10px 20px;
  964. border: 1px solid #dcdee2;
  965. border-radius: 5px;
  966. }
  967. .row {
  968. margin-bottom: 10px;
  969. display: flex;
  970. justify-content: space-between;
  971. align-items: flex-start;
  972. &:last-child {
  973. margin-bottom: 0;
  974. }
  975. .col {
  976. margin-right: 5px;
  977. flex: 1;
  978. display: flex;
  979. align-items: flex-start;
  980. .label {
  981. width: 70px;
  982. }
  983. .value {
  984. width: ~"calc(100% - 70px)";
  985. }
  986. }
  987. }
  988. }
  989. .print-wrap {
  990. width: 100vw;
  991. height: 100vh;
  992. display: none;
  993. img {
  994. width: 50%;
  995. }
  996. }
  997. /deep/ .ivu-modal-body {
  998. padding: 0;
  999. max-height: 80vh;
  1000. overflow: auto;
  1001. border-radius: 20px 20px 0 0;
  1002. }
  1003. /deep/ .ivu-upload-list {
  1004. display: none;
  1005. }
  1006. /deep/ .tip-item {
  1007. &:hover {
  1008. background: #eeeeee;
  1009. }
  1010. }
  1011. </style>