index.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504
  1. <template>
  2. <div>
  3. <by-bill ref="bill" :propConfig="config" @search="search" @onSmt="onSmt" @onDelete="onDelete" @onRefresh="resert"
  4. @resert="resert" @detail="openEdit" @onSave="onSave" @clickTab="clickTab" @onChangeRow="onChangeRow"
  5. @pagination="pagination" @onReturnSmt="onReturnSmt2" @getSupplierModal="getSupplierModal"
  6. @printBefore="printBefore" @onReturn="onReturn">
  7. </by-bill>
  8. <SettingConfig ref="setForm" type="setCForm" title="出库单" />
  9. </div>
  10. </template>
  11. <script lang="ts">
  12. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  13. import api from "@/api/order";
  14. import BusinessType from "./components/businessType.vue";
  15. import towInOne from "../warehousing/components/towInOne.vue";
  16. import stockLook from "./components/stockLook.vue";
  17. import SettingConfig from "../saleOrder/components/settingConfig.vue";
  18. import { add } from '@/benyun/utils/accuracy'
  19. @Component({ components: { SettingConfig } })
  20. export default class Outbound extends Vue {
  21. // 左边
  22. tabType : any = 'all';
  23. isAdd : any = false;
  24. baseInfo : any = {};
  25. isSubmit : any = false
  26. isChange : any = false
  27. dataId : any = ''
  28. // 右边
  29. supplierInfo : any = {} // 机构信息
  30. businessType : any = '' // 业务类型
  31. tableData : any = []
  32. timeNum = 0;
  33. calculateCount = 0;
  34. timer : any = null
  35. config : any = {
  36. attr: {
  37. activeName: 'all',
  38. calculateH: true
  39. },
  40. // 引单
  41. source: [
  42. {
  43. title: '销售订单',
  44. search: {
  45. attr: {
  46. size: 'mini',
  47. },
  48. columns: [
  49. [
  50. {
  51. span: 6,
  52. label: '单据编号',
  53. prop: 'orderNumber',
  54. component: 'by-input',
  55. compConfig: {
  56. attr: {
  57. placeholder: '请输入单据编号',
  58. clearable: true
  59. }
  60. }
  61. },
  62. ],
  63. ]
  64. },
  65. tool: {
  66. tools: {
  67. search: true,
  68. refresh: true
  69. },
  70. customTools: [
  71. {
  72. name: '引单出库', icon: 'el-icon-bottom', audit: [''], event: {
  73. click: () => {
  74. (this as any).citationOrder()
  75. }
  76. }
  77. },
  78. ]
  79. },
  80. table: {
  81. attr: {
  82. size: 'mini',
  83. seq: true,
  84. align: 'left',
  85. radio: true,
  86. triggerRowCheck: 'row',
  87. },
  88. columns: [
  89. {
  90. width: 144,
  91. title: '单据编号',
  92. field: 'orderNumber',
  93. },
  94. {
  95. width: 120,
  96. title: '收货人',
  97. field: 'consignee',
  98. },
  99. {
  100. width: 144,
  101. title: '财务编号',
  102. field: 'financeOrderId',
  103. },
  104. {
  105. width: 120,
  106. title: '联系方式',
  107. field: 'phone',
  108. },
  109. {
  110. width: 150,
  111. title: '计划交货时间',
  112. field: 'planDeliveryData',
  113. },
  114. {
  115. width: 150,
  116. title: '确定交货时间',
  117. field: 'affirmDeliveryData',
  118. },
  119. {
  120. width: 350,
  121. title: '交货地点',
  122. field: 'address',
  123. }
  124. ]
  125. }
  126. },
  127. ],
  128. // 单据
  129. bill: {
  130. tool: {
  131. tools: {
  132. save: true,
  133. return: true
  134. }
  135. },
  136. log: {
  137. request: {
  138. url: '/supply/supplyOutOrderOperateLog/page',
  139. method: 'GET'
  140. }
  141. },
  142. form: {
  143. attr: {
  144. size: 'medium',
  145. readonly: false,
  146. rules: {
  147. operator: [{
  148. required: true, message: '请输入经办人', trigger: 'blur'
  149. }],
  150. businessType: [{
  151. required: true, message: '请选择业务类型', trigger: 'change'
  152. }],
  153. }
  154. },
  155. columns: [
  156. [
  157. {
  158. span: 8,
  159. label: '单据编号',
  160. prop: 'outOrderNo',
  161. component: 'by-input',
  162. compConfig: {
  163. attr: {
  164. readonly: true
  165. },
  166. }
  167. },
  168. {
  169. span: 8,
  170. label: '经办人',
  171. prop: 'operator',
  172. component: 'by-input',
  173. },
  174. {
  175. span: 8,
  176. label: '收货人',
  177. prop: 'receive',
  178. component: 'by-input',
  179. },
  180. {
  181. span: 8,
  182. label: '收货地址',
  183. prop: 'receiveAddress',
  184. component: 'by-input',
  185. },
  186. {
  187. span: 8,
  188. label: '联系方式',
  189. prop: 'receivePhone',
  190. component: 'by-input',
  191. },
  192. {
  193. span: 8,
  194. label: '财务编号',
  195. prop: 'financeOrderId',
  196. component: 'by-input',
  197. compConfig: {
  198. attr: {
  199. readonly: true,
  200. },
  201. }
  202. },
  203. {
  204. span: 8,
  205. label: '业务类型',
  206. prop: 'businessType',
  207. component: BusinessType,
  208. },
  209. {
  210. span: 8,
  211. label: 'WMS编号',
  212. prop: 'wmsId',
  213. component: 'by-input',
  214. compConfig: {
  215. attr: {
  216. readonly: true,
  217. },
  218. }
  219. },
  220. ],
  221. [
  222. {
  223. span: 28,
  224. label: '备注',
  225. slot: true,
  226. prop: 'remark',
  227. component: 'by-input',
  228. compConfig: {
  229. attr: {
  230. placeholder: '请输入备注',
  231. type: 'textarea'
  232. },
  233. }
  234. },
  235. ]
  236. ]
  237. },
  238. tableConfig: [
  239. {
  240. table: {
  241. attr: {
  242. size: 'mini',
  243. align: 'left',
  244. readonly: true,
  245. },
  246. columns:
  247. [{
  248. width: 200,
  249. title: '物料名称',
  250. field: 'materialName',
  251. fixed: 'left'
  252. },
  253. {
  254. width: 70,
  255. title: '库存查看',
  256. component: stockLook,
  257. },
  258. {
  259. width: 80,
  260. title: '财务编号',
  261. field: 'financeSuborderId',
  262. },
  263. {
  264. width: 200,
  265. title: '仓库,仓位',
  266. field: 'towInOne',
  267. component: towInOne,
  268. compConfig: {
  269. isSelect: true
  270. }
  271. },
  272. {
  273. width: 70,
  274. title: '单位',
  275. field: 'unit',
  276. },
  277. {
  278. width: 70,
  279. title: '单位编码',
  280. field: 'unitCode',
  281. },
  282. {
  283. width: 80,
  284. title: '库存',
  285. field: 'inventory',
  286. },
  287. {
  288. width: 90,
  289. title: '数量',
  290. field: 'number',
  291. component: 'by-input',
  292. compConfig: {
  293. attr: {
  294. size: 'mini',
  295. type: 'number',
  296. defaultValue: 1,
  297. },
  298. }
  299. },
  300. {
  301. width: 80,
  302. title: '应出数量',
  303. field: 'deliveryNumber',
  304. },
  305. {
  306. width: 80,
  307. title: '出库数量',
  308. field: 'outNumber',
  309. },
  310. {
  311. width: 90,
  312. title: '单价',
  313. field: 'unitPrice',
  314. component: 'by-input',
  315. compConfig: {
  316. attr: {
  317. size: 'mini',
  318. type: 'number',
  319. },
  320. }
  321. },
  322. // {
  323. // width: 80,
  324. // title: '优惠金额',
  325. // field: 'prePrice',
  326. // },
  327. {
  328. width: 90,
  329. title: '合计金额',
  330. field: 'totalPrice',
  331. },
  332. {
  333. width: 70,
  334. title: '操作',
  335. action: true,
  336. plugins: [{
  337. icon: 'el-icon-delete',
  338. name: '删除',
  339. audit: '',
  340. event: {
  341. click: (item : any) => {
  342. (this as any).changeTable(item)
  343. }
  344. }
  345. }]
  346. },
  347. ]
  348. }
  349. }
  350. ]
  351. },
  352. // 已提交
  353. smt: {
  354. search: {
  355. attr: {
  356. size: 'mini',
  357. },
  358. columns: [
  359. [
  360. {
  361. span: 6,
  362. label: '单据编号',
  363. prop: 'outOrderNo',
  364. component: 'by-input',
  365. compConfig: {
  366. attr: {
  367. placeholder: '请输入单据编号',
  368. clearable: true
  369. }
  370. }
  371. },
  372. ],
  373. ]
  374. },
  375. tool: {
  376. tools: {
  377. search: true,
  378. refresh: true
  379. },
  380. customTools: [
  381. {
  382. name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
  383. click: () => {
  384. (this as any).syncSystem()
  385. }
  386. }
  387. },
  388. ]
  389. },
  390. table: {
  391. attr: {
  392. size: 'mini',
  393. seq: true,
  394. align: 'left',
  395. checkbox: true,
  396. triggerRowCheck: 'row'
  397. },
  398. columns: [
  399. {
  400. width: 150,
  401. title: '单据编号',
  402. field: 'outOrderNo',
  403. isDetail: true,
  404. fixed: 'left'
  405. },
  406. {
  407. width: 150,
  408. title: '财务编号',
  409. field: 'financeOrderId',
  410. },
  411. {
  412. width: 150,
  413. title: 'WMS编号',
  414. field: 'wmsId',
  415. },
  416. {
  417. width: 120,
  418. title: '经办人',
  419. field: 'operator',
  420. },
  421. {
  422. width: 120,
  423. title: '收货人',
  424. field: 'receive',
  425. },
  426. {
  427. width: 250,
  428. title: '收货地址',
  429. field: 'receiveAddress',
  430. },
  431. {
  432. width: 100,
  433. title: '联系方式',
  434. field: 'receivePhone',
  435. },
  436. {
  437. width: 70,
  438. title: '业务类型',
  439. field: 'businessType',
  440. },
  441. {
  442. width: 110,
  443. title: '操作',
  444. action: true,
  445. plugins: [{
  446. // icon: 'el-icon-edit',
  447. name: '查看',
  448. audit: '',
  449. event: {
  450. click: (e : any) => {
  451. (this as any).setReadonly(e)
  452. }
  453. }
  454. }, {
  455. name: '反提交',
  456. event: {
  457. click: (item : any) => (this as any).onReturnSmt(item)
  458. }
  459. }]
  460. }
  461. ]
  462. }
  463. },
  464. // 草稿箱
  465. draftsBox: {
  466. search: {
  467. attr: {
  468. size: 'mini',
  469. },
  470. columns: [
  471. [
  472. {
  473. span: 6,
  474. label: '单据编号',
  475. prop: 'outOrderNo',
  476. component: 'by-input',
  477. compConfig: {
  478. attr: {
  479. placeholder: '请输入单据编号',
  480. clearable: true
  481. }
  482. }
  483. },
  484. ],
  485. ]
  486. },
  487. tool: {
  488. tools: {
  489. smt: true,
  490. delete: true,
  491. search: true,
  492. refresh: true
  493. }
  494. },
  495. table: {
  496. attr: {
  497. size: 'mini',
  498. seq: true,
  499. align: 'left',
  500. checkbox: true,
  501. triggerRowCheck: 'row'
  502. },
  503. columns: [
  504. {
  505. width: 150,
  506. title: '单据编号',
  507. field: 'outOrderNo',
  508. isDetail: true,
  509. fixed: 'left'
  510. },
  511. {
  512. width: 150,
  513. title: '财务编号',
  514. field: 'financeOrderId',
  515. },
  516. {
  517. width: 150,
  518. title: 'WMS编号',
  519. field: 'wmsId',
  520. },
  521. {
  522. width: 120,
  523. title: '经办人',
  524. field: 'operator',
  525. },
  526. {
  527. width: 120,
  528. title: '收货人',
  529. field: 'receive',
  530. },
  531. {
  532. width: 250,
  533. title: '收货地址',
  534. field: 'receiveAddress',
  535. },
  536. {
  537. width: 100,
  538. title: '联系方式',
  539. field: 'receivePhone',
  540. },
  541. {
  542. width: 70,
  543. title: '业务类型',
  544. field: 'businessType',
  545. },
  546. {
  547. width: 110,
  548. title: '操作',
  549. action: true,
  550. plugins: [{
  551. icon: 'el-icon-edit',
  552. name: '编辑',
  553. audit: '',
  554. event: {
  555. click: (e : any) => {
  556. (this as any).openEdit(e)
  557. }
  558. }
  559. }, {
  560. name: '删除',
  561. event: {
  562. click: (item : any) => (this as any).doDelete2(item)
  563. }
  564. }]
  565. }
  566. ]
  567. }
  568. },
  569. // 综合
  570. all: {
  571. search: {
  572. attr: {
  573. size: 'mini',
  574. },
  575. columns: [
  576. [
  577. {
  578. span: 6,
  579. label: '单据编号',
  580. prop: 'outOrderNo',
  581. component: 'by-input',
  582. compConfig: {
  583. attr: {
  584. placeholder: '请输入单据编号',
  585. clearable: true
  586. }
  587. }
  588. },
  589. ],
  590. ]
  591. },
  592. tool: {
  593. tools: {
  594. search: true,
  595. refresh: true
  596. },
  597. customTools: [
  598. {
  599. name: '引单出库', icon: 'el-icon-bottom', audit: [''], event: {
  600. click: () => {
  601. (this as any).outbound()
  602. }
  603. }
  604. },
  605. {
  606. name: '删除', icon: 'el-icon-delete', audit: [''], event: {
  607. click: () => {
  608. (this as any).onDelete('all')
  609. }
  610. }
  611. },
  612. {
  613. name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
  614. click: () => {
  615. (this as any).syncSystem()
  616. }
  617. }
  618. },
  619. {
  620. name: '参数配置', icon: 'el-icon-setting', audit: [''], event: {
  621. click: () => {
  622. (this as any).configuration()
  623. }
  624. }
  625. },
  626. ]
  627. },
  628. table: {
  629. attr: {
  630. size: 'mini',
  631. seq: true,
  632. align: 'left',
  633. checkbox: true,
  634. triggerRowCheck: 'row',
  635. height: "620"
  636. },
  637. columns: [
  638. {
  639. width: 150,
  640. title: '单据编号',
  641. field: 'outOrderNo',
  642. isDetail: true,
  643. fixed: 'left'
  644. },
  645. {
  646. width: 150,
  647. title: '财务编号',
  648. field: 'financeOrderId',
  649. },
  650. {
  651. width: 150,
  652. title: 'WMS编号',
  653. field: 'wmsId',
  654. },
  655. {
  656. width: 120,
  657. title: '经办人',
  658. field: 'operator',
  659. },
  660. {
  661. width: 120,
  662. title: '收货人',
  663. field: 'receive',
  664. },
  665. {
  666. width: 250,
  667. title: '收货地址',
  668. field: 'receiveAddress',
  669. },
  670. {
  671. width: 100,
  672. title: '联系方式',
  673. field: 'receivePhone',
  674. },
  675. {
  676. width: 70,
  677. title: '业务类型',
  678. field: 'businessType',
  679. },
  680. {
  681. width: 90,
  682. title: '操作',
  683. action: true,
  684. plugins: [{
  685. name: '查看',
  686. audit: '',
  687. event: {
  688. click: (e : any) => {
  689. (this as any).openEdit(e)
  690. }
  691. }
  692. }, {
  693. name: '删除',
  694. event: {
  695. click: (item : any) => (this as any).doDelete2(item)
  696. }
  697. }]
  698. }
  699. ]
  700. }
  701. },
  702. // 回收站
  703. recycleBin: {
  704. search: {
  705. attr: {
  706. size: 'mini',
  707. },
  708. columns: [
  709. [
  710. {
  711. span: 6,
  712. label: '单据编号',
  713. prop: 'outOrderNo',
  714. component: 'by-input',
  715. compConfig: {
  716. attr: {
  717. placeholder: '请输入单据编号',
  718. clearable: true
  719. }
  720. }
  721. },
  722. ],
  723. ]
  724. },
  725. tool: {
  726. tools: {
  727. search: true,
  728. refresh: true
  729. }
  730. },
  731. table: {
  732. attr: {
  733. size: 'mini',
  734. align: 'left',
  735. },
  736. columns: [
  737. {
  738. width: 150,
  739. title: '单据编号',
  740. field: 'outOrderNo',
  741. isDetail: true,
  742. fixed: 'left'
  743. },
  744. {
  745. width: 150,
  746. title: '财务编号',
  747. field: 'financeOrderId',
  748. },
  749. {
  750. width: 150,
  751. title: 'WMS编号',
  752. field: 'wmsId',
  753. },
  754. {
  755. width: 120,
  756. title: '经办人',
  757. field: 'operator',
  758. },
  759. {
  760. width: 120,
  761. title: '收货人',
  762. field: 'receive',
  763. },
  764. {
  765. width: 250,
  766. title: '收货地址',
  767. field: 'receiveAddress',
  768. },
  769. {
  770. width: 100,
  771. title: '联系方式',
  772. field: 'receivePhone',
  773. },
  774. {
  775. width: 70,
  776. title: '业务类型',
  777. field: 'businessType',
  778. },
  779. {
  780. width: 90,
  781. title: '操作',
  782. action: true,
  783. plugins: [{
  784. name: '查看',
  785. audit: '',
  786. event: {
  787. click: (e : any) => {
  788. (this as any).openEdit(e)
  789. }
  790. }
  791. }]
  792. }
  793. ]
  794. }
  795. }
  796. }
  797. created() {
  798. this.timer = setInterval(() => {
  799. this.getDataList();
  800. this.initTable();
  801. }, 500)
  802. }
  803. // 计算高度
  804. initTable() {
  805. if (!this.$refs.bill) {
  806. this.calculateCount++;
  807. if (this.calculateCount > 5) return;
  808. setTimeout(() => {
  809. this.initTable()
  810. }, 500)
  811. return
  812. }
  813. this.config.smt.table.attr.height = window.innerHeight - 300;
  814. this.config.draftsBox.table.attr.height = window.innerHeight - 300;
  815. this.config.all.table.attr.height = window.innerHeight - 300;
  816. this.config.recycleBin.table.attr.height = window.innerHeight - 300;
  817. (this as any).$refs.bill.$refs.all.$refs.table.recalculate();
  818. }
  819. //打印前数据修改
  820. printBefore(params : any) {
  821. params.templateId = 12;
  822. let value = (this.$refs.bill as any).getBillFormValue();
  823. if (value) {
  824. let data : any = {};
  825. data.orderNumber = value.orderNumber;
  826. data.operator = value.operator;
  827. data.businessType = value.businessType;
  828. data.financeOrderId = value.financeOrderId;
  829. data.wmsId = value.wmsId;
  830. data.remark = value.remark;
  831. data.receivePhone = value.receivePhone;
  832. data.receiveAddress = value.receiveAddress;
  833. data.outOrderNo = value.outOrderNo;
  834. data.receive = value.receive;
  835. data.suborderList = [];
  836. if (value.suborderList) {
  837. data.totalNumber = 0;//总数量
  838. data.totalDeliveryNumber = 0; //总应出数量
  839. data.totalPri = 0;//总计金额
  840. data.totalOutNumber = 0; //总出库数量
  841. for (const item of value.suborderList) {
  842. let obj : any = {};
  843. obj.materialName = item.materialName;
  844. obj.financeSuborderId = item.financeSuborderId;
  845. obj.storehouseName = item.storehouseName;
  846. obj.storingLocationName = item.storingLocationName;
  847. obj.number = item.number;
  848. obj.deliveryNumber = item.deliveryNumber;
  849. obj.outNumber = item.outNumber;
  850. // obj.prePrice = item.prePrice;
  851. obj.unitPrice = item.unitPrice;
  852. obj.totalPrice = item.totalPrice;
  853. data.suborderList.push(obj);
  854. if (Number(item.number)) {
  855. data.totalNumber = add(data.totalNumber, Number(item.number))
  856. }
  857. if (Number(item.deliveryNumber)) {
  858. data.totalDeliveryNumber = add(data.totalDeliveryNumber, Number(item.deliveryNumber))
  859. }
  860. if (Number(item.totalPrice)) {
  861. data.totalPri = add(data.totalPri, Number(item.totalPrice));
  862. }
  863. if (Number(item.outNumber)) {
  864. data.totalOutNumber = add(data.totalOutNumber, Number(item.outNumber));
  865. }
  866. }
  867. }
  868. params.templateData = data;
  869. }
  870. }
  871. // 参数配置
  872. configuration() {
  873. (this as any).$refs.setForm.openSetting();
  874. }
  875. // 引单
  876. citationOrder() {
  877. let parentData : any = (this as any).$refs.bill.getSourceTableSelectData(0);
  878. if (parentData.length <= 0) return this.$message.warning('请选择引单数据');
  879. let loading = this.$loading({ target: '.main-container' });
  880. api.single({ id: parentData[0].id }, 'supplyPurchaseOrder').then((res : any) => {
  881. if (res.code === 200) {
  882. parentData = res.data ? [res.data] : parentData;
  883. parentData = parentData.map((item : any) => {
  884. item.receiveAddress = item.address
  885. item.receive = item.consignee
  886. item.receivePhone = item.phone
  887. const { financeOrderId, ...newData } = item
  888. return newData
  889. })
  890. let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
  891. parentData[0].suborderList = parentData[0].suborderList.filter((v : any) => (v.number - v.outNumber) > 0);
  892. parentData[0].suborderList.map((v : any) => {
  893. v.deliveryNumber = v.number - v.outNumber;
  894. if (v.deliveryNumber < v.number) v.number = v.deliveryNumber;
  895. });
  896. parentData[0].operator = (this as any).$store.getters.userInfo.userName;
  897. this.tableData = parentData[0].suborderList;
  898. billConfig.tool.tools = { save: true, smt: true };
  899. // console.log('this.tableData ==> ', this.tableData);
  900. this.isAdd = true;
  901. (this.$refs.bill as any).showTab = 'bill';
  902. loading.close();
  903. setTimeout(() => {
  904. (this.$refs.bill as any).setBillConfig(billConfig);
  905. (this.$refs.bill as any).setBillFormValue(parentData[0]); // 设置单据表单数据
  906. (this.$refs.bill as any).setBillTableValue(parentData[0].suborderList, 0);// 设置第1张单据表格数据
  907. }, 0)
  908. } else loading.close();
  909. }).catch(() => loading.close());
  910. }
  911. // 获取机构数据
  912. getSupplierModal(e : any) {
  913. this.supplierInfo = e;
  914. }
  915. // 监听表格数据变化
  916. onChangeRow(e : any) {
  917. this.isChange = true;
  918. this.isSubmit = false;
  919. // e.prePrice = e.prePrice ? e.prePrice : 0;
  920. e.realityPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
  921. e.totalPrice = e.realityPrice;
  922. // e.totalPrice = e.realityPrice - e.prePrice;
  923. }
  924. // 获取当前时间
  925. getNowDate() {
  926. let date = new Date();
  927. let years : any = date.getFullYear();
  928. let months : any = date.getMonth() + 1;
  929. let days : any = date.getDate();
  930. let hours : any = date.getHours();
  931. let minutes : any = date.getMinutes();
  932. let seconds : any = date.getSeconds();
  933. months = months < 10 ? '0' + months : months;
  934. days = days < 10 ? '0' + days : days;
  935. hours = hours < 10 ? '0' + hours : hours;
  936. minutes = minutes < 10 ? '0' + minutes : minutes;
  937. seconds = seconds < 10 ? '0' + seconds : seconds;
  938. return `${years}-${months}-${days} ${hours}:${minutes}:${seconds}`;
  939. }
  940. // 同步出库单到财务系统
  941. syncSystem() {
  942. let selectData = (this as any).$refs.bill.getTableSelectData(this.tabType);
  943. if (selectData.length > 0) {
  944. if (selectData.length > 1) return this.$message.warning('只能同步一条数据');
  945. if (selectData[0].financeOrderId) return this.$message.warning('此数据已同步财务编号');
  946. // if (selectData[0].submitState != 1) return this.$message.warning('只能同步已提交数据');
  947. let planData = selectData[0].planDeliveryData.replaceAll(/[-:\s]/g, '');
  948. let nowDate = this.getNowDate().replaceAll(/[-:\s]/g, '');
  949. if (planData < nowDate) return this.$message.warning('计划交货时间小于当前时间,不能同步财务编号');
  950. this.$confirm('确定同步订单吗', '注意', {
  951. confirmButtonText: '确定',
  952. cancelButtonText: '取消',
  953. type: 'warning',
  954. center: true
  955. }).then(() => {
  956. let loading = this.$loading({ target: '.main-container' });
  957. api.addOutStock({ ids: selectData[0].id }).then((res : any) => {
  958. loading.close();
  959. if (res.code === 200) {
  960. this.$message.success('同步订单成功');
  961. this.clickTab(this.tabType);
  962. } else this.$message.error(res.msg)
  963. }).catch(() => loading.close());
  964. }).catch(() => this.$message.info('已取消同步订单'));
  965. } else this.$message.warning('请选择同步数据');
  966. }
  967. // 保存
  968. onSave() {
  969. console.log('保存 ==>', this.tabType);
  970. (this as any).$refs.bill.$refs.billForm.validate().then(() => {
  971. let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
  972. // 子表数据
  973. console.log(query);
  974. query.purchaseOrderId = query.id;
  975. query.suborderList = (this.$refs.bill as any).getBillTableData(0);
  976. if (query.suborderList.length > 0) {
  977. for (let v of query.suborderList) {
  978. if (!v.unitPrice || v.unitPrice <= 0) return this.$message.warning('请输入正确物料单价');
  979. if (v.deliveryNumber < v.number) return this.$message.warning('数量不能大于应出数量');
  980. if (v.number > v.inventory) return this.$message.warning('出库数量不能大于库存数量');
  981. if (v.totalPrice <= 0) return this.$message.warning('合计金额不能为负数');
  982. v.taskOrderId = query.id;
  983. v.purchaseSuborderId = v.id;
  984. }
  985. };
  986. // 表格删除
  987. query.suborderList.map((v : any, i : any) => {
  988. if (v.isDeleted === 1 && !v.id) {
  989. query.suborderList.splice(i, 1)
  990. }
  991. });
  992. query.financeOrderId = "";
  993. console.log('出库参数query ==> ', query);
  994. let loading = this.$loading({ target: '.main-container' });
  995. if (this.isAdd) {
  996. query.suborderList.map((v : any) => {
  997. delete v.id;
  998. });
  999. delete query.id;
  1000. api.outbound(query, 'supplyOutOrder').then((res : any) => {
  1001. loading.close();
  1002. if (res.code === 200) {
  1003. this.isAdd = false;
  1004. this.isChange = false;
  1005. this.isSubmit = true;
  1006. this.$message.success('保存成功');
  1007. this.dataId = res.data;
  1008. } else this.$message.error(res.msg);
  1009. }).catch(() => loading.close());
  1010. } else {
  1011. query.submitState = 0;
  1012. api.updateList(query, 'supplyOutOrder').then((res : any) => {
  1013. loading.close();
  1014. if (res.code === 200) {
  1015. this.$message.success('保存成功');
  1016. this.isChange = false;
  1017. this.isSubmit = true;
  1018. } else this.$message.error(res.msg);
  1019. }).catch(() => loading.close());
  1020. };
  1021. })
  1022. }
  1023. // 切换tab栏
  1024. clickTab(e : any) {
  1025. // console.log('切换tab ==> ', e);
  1026. this.tabType = e;
  1027. (this.$refs.bill as any).showTab = e;
  1028. // submitState: 提交状态
  1029. if (e === 'source') {
  1030. // this.config.source[0].table.attr.height = window.innerHeight - 200;
  1031. // (this as any).$refs.bill.$refs.source_0[0].$refs.table.recalculate();
  1032. this.getCitationList({})
  1033. }; // 引单出库
  1034. if (e === 'all') this.getPageList({}, 'all'); // 草稿箱数据
  1035. if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
  1036. if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
  1037. if (e === 'recycleBin') this.getSelectDeleteList({}); // 回收站数据
  1038. if (e === 'bill') {
  1039. let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
  1040. billConfig.tool.tools = {};
  1041. billConfig.tool.customTools = [];
  1042. (this.$refs.bill as any).setBillConfig(billConfig);
  1043. }
  1044. }
  1045. // 出库打开引单
  1046. outbound() {
  1047. this.clickTab('source');
  1048. }
  1049. // 打开编辑
  1050. openEdit(e : any) {
  1051. e = e.row ? e.row : e;
  1052. let loading = this.$loading({ target: '.main-container' });
  1053. api.single({ id: e.id }, 'supplyOutOrder').then((res : any) => {
  1054. if (res.code === 200) {
  1055. let parentData = res.data ? res.data : e;
  1056. this.baseInfo = parentData;
  1057. if (this.tabType === 'all' || this.tabType === 'draftsBox') {
  1058. if (parentData.submitState === 1) {
  1059. loading.close();
  1060. return this.setReadonly(parentData)
  1061. }
  1062. let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
  1063. if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
  1064. billConfig.tableConfig[0].table.columns.push({
  1065. width: 90,
  1066. title: '操作',
  1067. action: true,
  1068. plugins: [{
  1069. icon: 'el-icon-delete',
  1070. name: '删除',
  1071. audit: '',
  1072. event: {
  1073. click: (item : any) => {
  1074. (this as any).changeTable(item)
  1075. }
  1076. }
  1077. }]
  1078. })
  1079. };
  1080. billConfig.tool.tools = { return: true, save: true, smt: true };
  1081. // 查销售订单数据
  1082. api.single({ id: e.purchaseOrderId }, 'supplyPurchaseOrder').then((val : any) => {
  1083. if (val.code === 200) {
  1084. parentData.suborderList.map((v : any, i : any) => {
  1085. v.outNumber = val.data.suborderList[i].outNumber;
  1086. // v.prePrice = val.data.suborderList[i].prePrice;
  1087. });
  1088. let data : any = parentData.suborderList;
  1089. let array : any = [];
  1090. data.map((v : any) => {
  1091. v.deliveryNumber = v.number - v.outNumber;
  1092. if (v.deliveryNumber < v.number) v.number = v.deliveryNumber;
  1093. v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
  1094. array.push({
  1095. storidId: v.storingLocationId,
  1096. skuid: v.materialSku,
  1097. })
  1098. });
  1099. // 查库存
  1100. api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
  1101. if (res.code === 200) {
  1102. let newData : any = [];
  1103. res.data.map((v : any, i : any) => {
  1104. newData.push(Object.assign(data[i], v))
  1105. })
  1106. this.tableData = newData;
  1107. (this.$refs.bill as any).setBillConfig(billConfig);
  1108. (this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
  1109. (this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
  1110. this.isAdd = false;
  1111. this.dataId = '';
  1112. (this.$refs.bill as any).showTab = 'bill';
  1113. loading.close();
  1114. } else loading.close();
  1115. }).catch(() => loading.close());
  1116. } else loading.close();
  1117. }).catch(() => loading.close());
  1118. } else {
  1119. loading.close();
  1120. this.setReadonly(parentData);
  1121. };
  1122. }
  1123. }).catch(() => loading.close());
  1124. }
  1125. // 设置只读
  1126. setReadonly(e : any) {
  1127. let parentData : any = e;
  1128. let loading = this.$loading({ target: '.main-container' });
  1129. let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
  1130. readonly.form.attr.readonly = true; // 设置只读
  1131. readonly.tool.tools = { return: true, };
  1132. if (this.tabType != 'recycleBin') {
  1133. if (parentData.submitState === 1) readonly.tool.tools = { return: true, returnSmt: true, print: true };
  1134. }
  1135. readonly.tableConfig[0].table.columns = readonly.tableConfig[0].table.columns.filter((v : any) => v.title != '操作');
  1136. api.single({ id: e.purchaseOrderId }, 'supplyPurchaseOrder').then((val : any) => {
  1137. if (val.code === 200) {
  1138. // parentData.suborderList.map((v : any, i : any) => {
  1139. // v.prePrice = val.data.suborderList[i].prePrice;
  1140. // });
  1141. let data = parentData.suborderList;
  1142. let array : any = [];
  1143. data.map((v : any) => {
  1144. v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
  1145. array.push({
  1146. storidId: v.storingLocationId,
  1147. skuid: v.materialSku,
  1148. })
  1149. });
  1150. // 查库存
  1151. api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
  1152. if (res.code === 200) {
  1153. let newData : any = []
  1154. res.data.map((v : any, i : any) => {
  1155. newData.push(Object.assign(data[i], v))
  1156. })
  1157. this.tableData = newData;
  1158. (this.$refs.bill as any).setBillConfig(readonly);
  1159. (this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
  1160. (this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
  1161. this.isAdd = false;
  1162. loading.close();
  1163. (this.$refs.bill as any).showTab = 'bill';
  1164. } else loading.close();
  1165. }).catch(() => loading.close());
  1166. } else loading.close();
  1167. }).catch(() => loading.close());
  1168. }
  1169. // 工具栏提交
  1170. onSmt(e : any) {
  1171. if (e === 'draftsBox') {
  1172. let selectData = (this.$refs.bill as any).getTableSelectData('draftsBox'); // 获取表格选中数据
  1173. if (selectData.length <= 0) return this.$message.warning('请选择提交数据');
  1174. if (selectData.length > 1) return this.$message.warning('只能提交一条数据');
  1175. this.$confirm('确定提交吗!', '注意', {
  1176. confirmButtonText: '确定',
  1177. cancelButtonText: '取消',
  1178. type: 'warning',
  1179. center: true
  1180. }).then(() => {
  1181. let loading = this.$loading({ target: '.main-container' });
  1182. api.submitTo({ id: selectData[0].id }, 'supplyOutOrder').then((res : any) => {
  1183. loading.close();
  1184. if (res.code === 200) {
  1185. this.$message.success('提交成功');
  1186. this.clickTab('draftsBox');
  1187. } else this.$message.error(res.msg)
  1188. }).catch(() => loading.close());
  1189. }).catch(() => this.$message.info('已取消提交'));
  1190. } else {
  1191. if (this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
  1192. console.log('isChange ==> ', this.isChange);
  1193. console.log('isSubmit ==> ', this.isSubmit);
  1194. if (this.isSubmit) {
  1195. this.$confirm('确定提交吗!', '注意', {
  1196. confirmButtonText: '确定',
  1197. cancelButtonText: '取消',
  1198. type: 'warning',
  1199. center: true
  1200. }).then(() => {
  1201. let id = this.dataId ? this.dataId : this.baseInfo.id;
  1202. let loading = this.$loading({ target: '.main-container' });
  1203. api.submitTo({ id: id }, 'supplyOutOrder').then((res : any) => {
  1204. loading.close();
  1205. if (res.code === 200) {
  1206. this.$message.success('提交成功');
  1207. this.isSubmit = false;
  1208. this.clickTab(this.tabType);
  1209. } else this.$message.error(res.msg)
  1210. }).catch(() => loading.close());
  1211. }).catch(() => this.$message.info('已取消提交'));
  1212. } else {
  1213. // 表单旧数据
  1214. let oldbillForm : any = (this as any).$lodash.cloneDeep(this.baseInfo);
  1215. if (oldbillForm.suborderList) delete oldbillForm.suborderList;
  1216. oldbillForm = JSON.stringify(oldbillForm);
  1217. // 表单新数据
  1218. let newBillForm : any = (this as any).$refs.bill.getBillFormValue();
  1219. if (newBillForm.suborderList) delete newBillForm.suborderList;
  1220. newBillForm = JSON.stringify(newBillForm);
  1221. // 表格旧数据
  1222. this.baseInfo.suborderList.map((v : any) => {
  1223. if (v._X_ROW_KEY) delete v._X_ROW_KEY;
  1224. });
  1225. let oldData : any = JSON.stringify(this.baseInfo.suborderList);
  1226. // 表格新数据
  1227. let newData : any = JSON.stringify((this as any).$refs.bill.getBillTableData(0));
  1228. // 数据有变进保存
  1229. if (this.isChange || oldbillForm != newBillForm || oldData != newData) {
  1230. return this.$message.warning('数据变更必须先保存再提交');
  1231. } else {
  1232. this.$confirm('确定提交吗!', '注意', {
  1233. confirmButtonText: '确定',
  1234. cancelButtonText: '取消',
  1235. type: 'warning',
  1236. center: true
  1237. }).then(() => {
  1238. let loading = this.$loading({ target: '.main-container' });
  1239. api.submitTo({ id: this.baseInfo.id }, 'supplyOutOrder').then((res : any) => {
  1240. loading.close();
  1241. if (res.code === 200) {
  1242. this.$message.success('提交成功');
  1243. this.dataId = '';
  1244. this.clickTab(this.tabType);
  1245. } else this.$message.error(res.msg)
  1246. }).catch(() => loading.close());
  1247. }).catch(() => this.$message.info('已取消提交'));
  1248. }
  1249. }
  1250. }
  1251. }
  1252. // 操作反提交
  1253. onReturnSmt(e : any) {
  1254. console.log('反提交 ==>', e);
  1255. this.$confirm('确定反提交吗!', '注意', {
  1256. confirmButtonText: '确定',
  1257. cancelButtonText: '取消',
  1258. type: 'warning',
  1259. center: true
  1260. }).then(() => {
  1261. let loading = this.$loading({ target: '.main-container' });
  1262. api.cancelSubmission({ id: e.id }, 'supplyOutOrder').then((res : any) => {
  1263. loading.close();
  1264. if (res.code === 200) {
  1265. this.$message.success('反提交成功');
  1266. this.clickTab(this.tabType);
  1267. } else this.$message.error(res.msg)
  1268. }).catch(() => loading.close());
  1269. }).catch(() => this.$message.info('已取消反提交'));
  1270. }
  1271. // 工具栏反提交
  1272. onReturnSmt2() {
  1273. console.log('工具栏反提交 ==>', this.baseInfo);
  1274. this.$confirm('确定反提交吗!', '注意', {
  1275. confirmButtonText: '确定',
  1276. cancelButtonText: '取消',
  1277. type: 'warning',
  1278. center: true
  1279. }).then(() => {
  1280. let loading = this.$loading({ target: '.main-container' });
  1281. api.cancelSubmission({ id: this.baseInfo.id }, 'supplyOutOrder').then((res : any) => {
  1282. loading.close();
  1283. if (res.code === 200) {
  1284. this.$message.success('反提交成功');
  1285. this.clickTab(this.tabType);
  1286. } else this.$message.error(res.msg)
  1287. }).catch(() => loading.close());
  1288. }).catch(() => this.$message.info('已取消反提交'));
  1289. }
  1290. // 初始化
  1291. getDataList() {
  1292. if (!this.$refs.bill) {
  1293. if (this.timeNum > 5) {
  1294. clearInterval(this.timer)
  1295. }
  1296. this.timeNum++;
  1297. return
  1298. }
  1299. clearInterval(this.timer)
  1300. this.getPageList({}, 'all'); // 综合数据
  1301. }
  1302. // 获取引单分页数据
  1303. getCitationList(query : any) {
  1304. let loading = this.$loading({ target: '.main-container' });
  1305. api.pageList(query, 'supplyPurchaseOrder').then((res : any) => {
  1306. loading.close();
  1307. if (res.code === 200) {
  1308. (this.$refs.bill as any).setSourceTableData(0, res.data.records);
  1309. let page = {
  1310. pageNo: res.data.current, //当前页
  1311. pageSize: res.data.size, //每页条数
  1312. total: res.data.total //总条数
  1313. };
  1314. (this.$refs.bill as any).setSourcePage(0, page);
  1315. } else this.$message.error(res.msg)
  1316. }).catch(() => loading.close());
  1317. }
  1318. // 获取分页数据
  1319. getPageList(query : any, type : any) {
  1320. let data = (this.$refs.bill as any).getTablePage(this.tabType);
  1321. query.pageNo = data.pageNo;
  1322. query.pageSize = data.pageSize;
  1323. let loading = this.$loading({ target: '.main-container' });
  1324. api.pageList(query, 'supplyOutOrder').then((res : any) => {
  1325. loading.close();
  1326. if (res.code === 200) {
  1327. (this.$refs.bill as any).setTabTableValue(type, res.data.records);
  1328. let page = {
  1329. pageNo: res.data.current, //当前页
  1330. pageSize: res.data.size, //每页条数
  1331. total: res.data.total //总条数
  1332. };
  1333. (this.$refs.bill as any).setTablePage(type, page);
  1334. } else this.$message.error(res.msg)
  1335. }).catch(() => loading.close());
  1336. }
  1337. // 分页
  1338. pagination(e : any) {
  1339. console.log('分页 ==> ', e);
  1340. if (e.type === 'source_0') {
  1341. let query : any = (this as any).$refs.bill.$refs.source_0[0].getSearchValue();
  1342. query.pageNo = e.page.pageNum;
  1343. query.pageSize = e.page.pageSize;
  1344. this.getCitationList(query);
  1345. } else {
  1346. let query : any = (this as any).$refs.bill.getSearchValue(e.type);
  1347. query.pageNo = e.page.pageNum;
  1348. query.pageSize = e.page.pageSize;
  1349. let loading = this.$loading({ target: '.main-container' });
  1350. if (e.type === 'recycleBin') {
  1351. api.selectDeleteList(query, 'supplyOutOrder').then((res : any) => {
  1352. loading.close();
  1353. if (res.code === 200) {
  1354. (this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
  1355. } else this.$message.error(res.msg)
  1356. }).catch(() => loading.close());
  1357. } else {
  1358. api.pageList(query, 'supplyOutOrder').then((res : any) => {
  1359. loading.close();
  1360. if (res.code === 200) {
  1361. (this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
  1362. } else this.$message.error(res.msg)
  1363. }).catch(() => loading.close());
  1364. }
  1365. }
  1366. }
  1367. // 回收站数据
  1368. getSelectDeleteList(query : any) {
  1369. let data = (this.$refs.bill as any).getTablePage(this.tabType);
  1370. query.pageNo = data.pageNo;
  1371. query.pageSize = data.pageSize;
  1372. let loading = this.$loading({ target: '.main-container' });
  1373. api.selectDeleteList(query, 'supplyOutOrder').then((res : any) => {
  1374. loading.close();
  1375. if (res.code === 200) {
  1376. (this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
  1377. let page = {
  1378. pageNo: res.data.current, //当前页
  1379. pageSize: res.data.size, //每页条数
  1380. total: res.data.total //总条数
  1381. };
  1382. (this.$refs.bill as any).setTablePage('recycleBin', page)
  1383. } else this.$message.error(res.msg)
  1384. }).catch(() => loading.close());
  1385. }
  1386. // 返回
  1387. onReturn() {
  1388. this.clickTab(this.tabType);
  1389. }
  1390. // 搜索
  1391. search(parames : any) {
  1392. console.log('搜索 ==> ', parames);
  1393. let query = parames.value;
  1394. if (parames.type === 'source_0') {
  1395. this.getCitationList(query); // 引单数据
  1396. } else {
  1397. if (parames.type === 'recycleBin') {
  1398. this.getSelectDeleteList(query); // 回收站分页数据
  1399. } else {
  1400. if (parames.type === 'draftsBox') query.submitState = 0;// 草稿箱数据
  1401. if (parames.type === 'smt') query.submitState = 1; // 已提交数据
  1402. this.getPageList(query, parames.type) // 获取分页数据
  1403. }
  1404. }
  1405. }
  1406. // 刷新/重置
  1407. resert(e : any) {
  1408. let data : any = e.type ? e.type : e;
  1409. console.log('刷新/重置 ==> ', data);
  1410. if (data === 'source_0') {
  1411. (this as any).$refs.bill.$refs.source_0[0].clearSearch();
  1412. this.getCitationList({}); // 引单数据
  1413. } else {
  1414. (this as any).$refs.bill.$refs[data].clearSearch();
  1415. if (data === 'all') this.getPageList({}, 'all'); // 综合数据
  1416. if (data === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
  1417. if (data === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
  1418. if (data === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
  1419. }
  1420. }
  1421. // 单据表格删除
  1422. changeTable(item : any) {
  1423. this.$confirm('确定删除吗!', '注意', {
  1424. confirmButtonText: '确定',
  1425. cancelButtonText: '取消',
  1426. type: 'warning',
  1427. center: true
  1428. }).then(() => {
  1429. let data = (this.$refs.bill as any).getBillTableData(0);
  1430. let i = -1;
  1431. let j = -1;
  1432. for (const v of data) {
  1433. i++;
  1434. if (v.materialSku == item.materialSku) {
  1435. break
  1436. }
  1437. };
  1438. console.log(this.tableData);
  1439. for (const v of this.tableData) {
  1440. j++;
  1441. if (v.materialSku == item.materialSku && item.isDeleted === 0) {
  1442. break
  1443. }
  1444. };
  1445. this.tableData[j].isDeleted = 1;
  1446. data.splice(i, 1);
  1447. (this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
  1448. this.$message.success('删除成功');
  1449. }).catch(() => this.$message.info('已取消删除'));
  1450. }
  1451. // 工具栏删除
  1452. onDelete(e : any) {
  1453. let selectData = (this.$refs.bill as any).getTableSelectData(e)
  1454. let ids = '';
  1455. if (selectData.length > 0) {
  1456. selectData.map((v : any) => {
  1457. ids += v.id + ','
  1458. })
  1459. } else return this.$message({ type: 'warning', message: '请选择删除数据' })
  1460. ids = ids.slice(0, ids.length - 1);
  1461. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  1462. confirmButtonText: '确定',
  1463. cancelButtonText: '取消',
  1464. type: 'warning',
  1465. center: true
  1466. }).then(() => {
  1467. let loading = this.$loading({ target: '.main-container' });
  1468. api.deleteList({ ids: ids }, 'supplyOutOrder').then((res : any) => {
  1469. loading.close();
  1470. if (res.code === 200) {
  1471. this.$message.success('删除成功');
  1472. this.clickTab(this.tabType);
  1473. } else this.$message.error(res.msg)
  1474. }).catch(() => loading.close());
  1475. }).catch(() => this.$message.info('已取消删除'));
  1476. }
  1477. // 操作删除
  1478. doDelete2(item : any) {
  1479. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  1480. confirmButtonText: '确定',
  1481. cancelButtonText: '取消',
  1482. type: 'warning',
  1483. center: true
  1484. }).then(() => {
  1485. let loading = this.$loading({ target: '.main-container' });
  1486. api.deleteList({ ids: item.id }, 'supplyOutOrder').then((res : any) => {
  1487. loading.close();
  1488. if (res.code === 200) {
  1489. this.$message.success('删除成功');
  1490. this.clickTab(this.tabType);
  1491. } else this.$message.error(res.msg)
  1492. }).catch(() => loading.close());
  1493. }).catch(() => this.$message.info('已取消删除'));
  1494. }
  1495. }
  1496. </script>