index.vue 22 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. <template>
  2. <div>
  3. <by-bill ref="bill" :propConfig="config" @search="search" @onSmt="onSmt" @onAdd="onAdd" @onDelete="onDelete"
  4. @onDispatch="onDispatch" @onRefresh="onRefresh" @detail="openEdit" @onSave="onSave" @clickTab="clickTab">
  5. </by-bill>
  6. </div>
  7. </template>
  8. <script lang="ts">
  9. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  10. import api from "@/api/order";
  11. import Assembly from "@/components/Assembly/order.vue";
  12. @Component
  13. export default class OrderTask extends Vue {
  14. // 右边
  15. baseURL : any = process.env.VUE_APP_BASE_API
  16. setStatusData : any = ''
  17. timeNum = 0;
  18. timer : any = null
  19. config : any = {
  20. attr: {
  21. activeName: 'all'
  22. },
  23. // 单据
  24. bill: {
  25. tool: {
  26. tools: {
  27. save: true,
  28. }
  29. },
  30. form: {
  31. attr: {
  32. size: 'small',
  33. readonly: false,
  34. rules: {
  35. organizationName: [{
  36. required: true, message: '请输入机构名称', trigger: 'blur'
  37. }],
  38. orderNumber: [{
  39. required: true, message: '请输入单据编号', trigger: 'blur'
  40. }]
  41. }
  42. },
  43. columns: [
  44. [
  45. {
  46. span: 8,
  47. label: '机构名称',
  48. prop: 'organizationName',
  49. component: 'by-input',
  50. },
  51. {
  52. span: 8,
  53. label: '单据编号',
  54. prop: 'orderNumber',
  55. component: 'by-input',
  56. },
  57. {
  58. span: 8,
  59. label: '交货地点',
  60. prop: 'deliveryAddress',
  61. component: 'by-input',
  62. },
  63. {
  64. span: 8,
  65. label: '交货时间',
  66. prop: 'deliveryData',
  67. component: 'by-date-picker',
  68. compConfig: {
  69. format: 'yyyy-MM-dd hh:ss:mm',
  70. type: 'datetime'
  71. }
  72. },
  73. {
  74. span: 8,
  75. label: '交货人',
  76. prop: 'delivery',
  77. component: 'by-input',
  78. },
  79. {
  80. span: 8,
  81. label: '联系方式',
  82. prop: 'deliveryPhone',
  83. component: 'by-input',
  84. },
  85. {
  86. span: 8,
  87. label: '交货方式',
  88. prop: 'deliveryWay',
  89. component: 'by-input',
  90. },
  91. {
  92. span: 8,
  93. label: '备注',
  94. slot: true,
  95. prop: 'remark',
  96. component: 'by-input',
  97. },
  98. ],
  99. ]
  100. },
  101. tableConfig: [
  102. {
  103. tool: {
  104. tools: {
  105. add: true
  106. }
  107. },
  108. table: {
  109. attr: {
  110. size: 'mini',
  111. height: 580,
  112. align: 'center',
  113. // seq: true,
  114. // checkbox: true
  115. },
  116. columns:
  117. [{
  118. width: 300,
  119. title: '物料名称',
  120. field: 'materialName',
  121. component: 'by-input'
  122. },
  123. {
  124. title: '单位',
  125. field: 'unit',
  126. component: 'by-input'
  127. },
  128. {
  129. title: '数量',
  130. field: 'number',
  131. component: 'by-input'
  132. },
  133. {
  134. title: '已交付数量',
  135. field: 'deliveryNumber',
  136. component: 'by-input'
  137. },
  138. {
  139. title: '规格',
  140. field: 'specs',
  141. component: 'by-input'
  142. },
  143. {
  144. title: '单价',
  145. field: 'unitPrice',
  146. component: 'by-input'
  147. },
  148. {
  149. title: '实际金额',
  150. field: 'realityPrice',
  151. component: 'by-input'
  152. },
  153. {
  154. title: '优惠金额',
  155. field: 'prePrice',
  156. component: 'by-input'
  157. },
  158. {
  159. title: '合计金额',
  160. field: 'totalPrice',
  161. component: 'by-input'
  162. },
  163. {
  164. width: 80,
  165. title: '操作',
  166. action: true,
  167. plugins: [{
  168. icon: 'el-icon-delete',
  169. name: '删除',
  170. audit: '',
  171. event: {
  172. click: (item : any) => {
  173. console.log('该行数据:', item)
  174. item.isDeleted = 1;
  175. this.$confirm('确定删除吗', '注意', {
  176. confirmButtonText: '确定',
  177. cancelButtonText: '取消',
  178. type: 'warning',
  179. center: true
  180. }).then(() => {
  181. // api.deleteList({ ids: item.id }, 'supplyTaskOrder').then((res : any) => {
  182. // if (res.code === 200) {
  183. // this.getDataList();
  184. // this.$message({
  185. // type: 'success',
  186. // message: '删除成功!'
  187. // });
  188. // } else this.failHandle(res)
  189. // })
  190. }).catch(() => {
  191. this.$message({
  192. type: 'info',
  193. message: '已取消删除'
  194. });
  195. });
  196. }
  197. }
  198. }]
  199. },
  200. ]
  201. }
  202. }
  203. ]
  204. },
  205. // 已提交
  206. smt: {
  207. search: {
  208. attr: {
  209. size: 'mini',
  210. },
  211. columns: [
  212. [
  213. {
  214. span: 6,
  215. label: '机构名称',
  216. prop: 'organizationName',
  217. component: 'by-input',
  218. compConfig: {
  219. attr: {
  220. placeholder: '请输入机构名称',
  221. clearable: true
  222. },
  223. },
  224. },
  225. {
  226. span: 6,
  227. label: '单据编号',
  228. prop: 'orderNumber',
  229. component: 'by-input',
  230. compConfig: {
  231. attr: {
  232. placeholder: '请输入单据编号',
  233. clearable: true
  234. }
  235. }
  236. },
  237. {
  238. span: 6,
  239. label: '交货人',
  240. prop: 'delivery',
  241. component: 'by-input',
  242. compConfig: {
  243. attr: {
  244. placeholder: '请输入交货人',
  245. clearable: true
  246. }
  247. }
  248. },
  249. {
  250. span: 6,
  251. label: '状态',
  252. prop: 'status',
  253. component: 'by-select',
  254. compConfig: {
  255. attr: {
  256. placeholder: '请选择状态',
  257. clearable: true,
  258. data: [{
  259. value: 0,
  260. label: '未接单'
  261. }, {
  262. value: 1,
  263. label: '已接单'
  264. }]
  265. }
  266. }
  267. },
  268. ],
  269. [
  270. {
  271. span: 6,
  272. label: '交货时间',
  273. prop: 'deliveryData',
  274. component: 'by-date-picker',
  275. compConfig: {
  276. format: 'yyyy-MM-dd hh:ss:mm',
  277. type: 'datetime'
  278. }
  279. },
  280. ]
  281. ]
  282. },
  283. tool: {
  284. tools: {
  285. delete: true,
  286. search: true,
  287. refresh: true
  288. }
  289. },
  290. table: {
  291. attr: {
  292. height: 600,
  293. size: 'mini',
  294. seq: true,
  295. align: 'center',
  296. checkbox: true
  297. },
  298. columns: [
  299. {
  300. width: 70,
  301. title: '单据编号',
  302. field: 'orderNumber',
  303. },
  304. {
  305. width: 200,
  306. title: '机构名称',
  307. field: 'organizationName',
  308. isDetail: true,
  309. },
  310. {
  311. width: 80,
  312. title: '状态',
  313. field: 'status',
  314. component: Assembly,
  315. },
  316. {
  317. width: 200,
  318. title: '交货地点',
  319. field: 'deliveryAddress',
  320. },
  321. {
  322. width: 150,
  323. title: '交货时间',
  324. field: 'deliveryData',
  325. },
  326. {
  327. title: '交货人',
  328. field: 'delivery',
  329. },
  330. {
  331. title: '交货人联系方式',
  332. field: 'deliveryPhone',
  333. },
  334. {
  335. title: '交货方式',
  336. field: 'deliveryWay',
  337. },
  338. {
  339. title: '备注',
  340. field: 'remark',
  341. },
  342. {
  343. width: 110,
  344. title: '操作',
  345. action: true,
  346. plugins: [{
  347. icon: 'el-icon-edit',
  348. name: '编辑',
  349. audit: '',
  350. event: {
  351. click: (item : any) => {
  352. (this as any).openEdit(item)
  353. }
  354. }
  355. }, {
  356. name: '删除',
  357. event: {
  358. click: (item : any) => (this as any).doDelete2(item)
  359. }
  360. }]
  361. }
  362. ]
  363. }
  364. },
  365. // 草稿箱
  366. draftsBox: {
  367. search: {
  368. attr: {
  369. size: 'mini',
  370. },
  371. columns: [
  372. [
  373. {
  374. span: 6,
  375. label: '机构名称',
  376. prop: 'organizationName',
  377. component: 'by-input',
  378. compConfig: {
  379. attr: {
  380. placeholder: '请输入机构名称',
  381. clearable: true
  382. },
  383. },
  384. },
  385. {
  386. span: 6,
  387. label: '单据编号',
  388. prop: 'orderNumber',
  389. component: 'by-input',
  390. compConfig: {
  391. attr: {
  392. placeholder: '请输入单据编号',
  393. clearable: true
  394. }
  395. }
  396. },
  397. {
  398. span: 6,
  399. label: '交货人',
  400. prop: 'delivery',
  401. component: 'by-input',
  402. compConfig: {
  403. attr: {
  404. placeholder: '请输入交货人',
  405. clearable: true
  406. }
  407. }
  408. },
  409. {
  410. span: 6,
  411. label: '交货时间',
  412. prop: 'deliveryData',
  413. component: 'by-date-picker',
  414. compConfig: {
  415. format: 'yyyy-MM-dd hh:ss:mm',
  416. type: 'datetime'
  417. }
  418. },
  419. ],
  420. ]
  421. },
  422. tool: {
  423. tools: {
  424. smt: true,
  425. delete: true,
  426. search: true,
  427. refresh: true
  428. }
  429. },
  430. table: {
  431. attr: {
  432. height: 600,
  433. size: 'mini',
  434. seq: true,
  435. align: 'center',
  436. checkbox: true
  437. },
  438. columns: [
  439. {
  440. width: 70,
  441. title: '单据编号',
  442. field: 'orderNumber',
  443. },
  444. {
  445. width: 200,
  446. title: '机构名称',
  447. field: 'organizationName',
  448. isDetail: true,
  449. },
  450. {
  451. width: 200,
  452. title: '交货地点',
  453. field: 'deliveryAddress',
  454. },
  455. {
  456. width: 150,
  457. title: '交货时间',
  458. field: 'deliveryData',
  459. },
  460. {
  461. title: '交货人',
  462. field: 'delivery',
  463. },
  464. {
  465. title: '交货人联系方式',
  466. field: 'deliveryPhone',
  467. },
  468. {
  469. title: '交货方式',
  470. field: 'deliveryWay',
  471. },
  472. {
  473. title: '备注',
  474. field: 'remark',
  475. },
  476. {
  477. width: 110,
  478. title: '操作',
  479. action: true,
  480. plugins: [{
  481. icon: 'el-icon-edit',
  482. name: '编辑',
  483. audit: '',
  484. event: {
  485. click: (item : any) => {
  486. (this as any).openEdit(item)
  487. }
  488. }
  489. }, {
  490. name: '删除',
  491. event: {
  492. click: (item : any) => (this as any).doDelete2(item)
  493. }
  494. }]
  495. }
  496. ]
  497. }
  498. },
  499. // 综合
  500. all: {
  501. search: {
  502. attr: {
  503. size: 'mini',
  504. },
  505. columns: [
  506. [
  507. {
  508. span: 6,
  509. label: '机构名称',
  510. prop: 'organizationName',
  511. component: 'by-input',
  512. compConfig: {
  513. attr: {
  514. placeholder: '请输入机构名称',
  515. clearable: true
  516. },
  517. },
  518. },
  519. {
  520. span: 6,
  521. label: '单据编号',
  522. prop: 'orderNumber',
  523. component: 'by-input',
  524. compConfig: {
  525. attr: {
  526. placeholder: '请输入单据编号',
  527. clearable: true
  528. }
  529. }
  530. },
  531. {
  532. span: 6,
  533. label: '交货人',
  534. prop: 'delivery',
  535. component: 'by-input',
  536. compConfig: {
  537. attr: {
  538. placeholder: '请输入交货人',
  539. clearable: true
  540. }
  541. }
  542. },
  543. {
  544. span: 6,
  545. label: '状态',
  546. prop: 'status',
  547. component: 'by-select',
  548. compConfig: {
  549. attr: {
  550. placeholder: '请选择状态',
  551. clearable: true,
  552. data: [{
  553. value: 0,
  554. label: '未接单'
  555. }, {
  556. value: 1,
  557. label: '已接单'
  558. }]
  559. }
  560. }
  561. },
  562. ],
  563. [
  564. {
  565. span: 6,
  566. label: '交货时间',
  567. prop: 'deliveryData',
  568. component: 'by-date-picker',
  569. compConfig: {
  570. format: 'yyyy-MM-dd hh:ss:mm',
  571. type: 'datetime'
  572. }
  573. },
  574. ]
  575. ]
  576. },
  577. tool: {
  578. tools: {
  579. add: true,
  580. dispatch: true,
  581. delete: true,
  582. search: true,
  583. refresh: true
  584. }
  585. },
  586. table: {
  587. attr: {
  588. height: 600,
  589. size: 'mini',
  590. seq: true,
  591. align: 'center',
  592. checkbox: true
  593. },
  594. columns: [
  595. {
  596. width: 200,
  597. title: '机构名称',
  598. field: 'organizationName',
  599. isDetail: true,
  600. },
  601. {
  602. width: 120,
  603. title: '单据编号',
  604. field: 'orderNumber',
  605. },
  606. {
  607. width: 80,
  608. title: '状态',
  609. field: 'status',
  610. component: Assembly,
  611. },
  612. {
  613. width: 200,
  614. title: '交货地点',
  615. field: 'deliveryAddress',
  616. },
  617. {
  618. width: 150,
  619. title: '交货时间',
  620. field: 'deliveryData',
  621. },
  622. {
  623. title: '交货人',
  624. field: 'delivery',
  625. },
  626. {
  627. title: '交货人联系方式',
  628. field: 'deliveryPhone',
  629. },
  630. {
  631. title: '交货方式',
  632. field: 'deliveryWay',
  633. },
  634. {
  635. title: '备注',
  636. field: 'remark',
  637. },
  638. {
  639. width: 110,
  640. title: '操作',
  641. action: true,
  642. plugins: [{
  643. icon: 'el-icon-edit',
  644. name: '编辑',
  645. audit: '',
  646. event: {
  647. click: (item : any) => {
  648. (this as any).openEdit(item)
  649. }
  650. }
  651. }, {
  652. name: '删除',
  653. event: {
  654. click: (item : any) => (this as any).doDelete2(item)
  655. }
  656. }]
  657. }
  658. ]
  659. }
  660. },
  661. // 回收站
  662. recycleBin: {
  663. search: {
  664. attr: {
  665. size: 'mini',
  666. },
  667. columns: [
  668. [
  669. {
  670. span: 6,
  671. label: '机构名称',
  672. prop: 'organizationName',
  673. component: 'by-input',
  674. compConfig: {
  675. attr: {
  676. placeholder: '请输入机构名称',
  677. clearable: true
  678. },
  679. },
  680. },
  681. {
  682. span: 6,
  683. label: '单据编号',
  684. prop: 'orderNumber',
  685. component: 'by-input',
  686. compConfig: {
  687. attr: {
  688. placeholder: '请输入单据编号',
  689. clearable: true
  690. }
  691. }
  692. },
  693. {
  694. span: 6,
  695. label: '交货人',
  696. prop: 'delivery',
  697. component: 'by-input',
  698. compConfig: {
  699. attr: {
  700. placeholder: '请输入交货人',
  701. clearable: true
  702. }
  703. }
  704. },
  705. {
  706. span: 6,
  707. label: '状态',
  708. prop: 'status',
  709. component: 'by-select',
  710. compConfig: {
  711. attr: {
  712. placeholder: '请选择状态',
  713. clearable: true,
  714. data: [{
  715. value: 0,
  716. label: '未接单'
  717. }, {
  718. value: 1,
  719. label: '已接单'
  720. }]
  721. }
  722. }
  723. },
  724. ],
  725. [
  726. {
  727. span: 6,
  728. label: '交货时间',
  729. prop: 'deliveryData',
  730. component: 'by-date-picker',
  731. compConfig: {
  732. format: 'yyyy-MM-dd hh:ss:mm',
  733. type: 'datetime'
  734. }
  735. },
  736. ]
  737. ]
  738. },
  739. tool: {
  740. tools: {
  741. search: true,
  742. refresh: true
  743. }
  744. },
  745. table: {
  746. attr: {
  747. height: 600,
  748. size: 'mini',
  749. seq: true,
  750. align: 'center',
  751. checkbox: true
  752. },
  753. columns: [
  754. {
  755. width: 70,
  756. title: '单据编号',
  757. field: 'orderNumber',
  758. },
  759. {
  760. width: 200,
  761. title: '机构名称',
  762. field: 'organizationName',
  763. isDetail: true,
  764. },
  765. {
  766. width: 80,
  767. title: '状态',
  768. field: 'status',
  769. component: Assembly,
  770. },
  771. {
  772. width: 200,
  773. title: '交货地点',
  774. field: 'deliveryAddress',
  775. },
  776. {
  777. width: 150,
  778. title: '交货时间',
  779. field: 'deliveryData',
  780. },
  781. {
  782. title: '交货人',
  783. field: 'delivery',
  784. },
  785. {
  786. title: '交货人联系方式',
  787. field: 'deliveryPhone',
  788. },
  789. {
  790. title: '交货方式',
  791. field: 'deliveryWay',
  792. },
  793. {
  794. title: '备注',
  795. field: 'remark',
  796. },
  797. {
  798. width: 110,
  799. title: '操作',
  800. action: true,
  801. plugins: [{
  802. // icon: 'el-icon-edit',
  803. name: '查看',
  804. audit: '',
  805. event: {
  806. click: (item : any) => {
  807. (this as any).openEdit(item)
  808. }
  809. }
  810. }]
  811. }
  812. ]
  813. }
  814. }
  815. }
  816. created() {
  817. this.timer = setInterval(() => {
  818. this.getDataList()
  819. }, 500)
  820. }
  821. // 保存
  822. onSave(e : any) {
  823. console.log('保存 ==>', e);
  824. if(e==='bill'){
  825. (this as any).$refs.bill.$refs.billForm.validate().then(() => {
  826. let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
  827. query.suborderList.unshift({materialName:'test'})
  828. console.log(query);
  829. api.updateList(query, 'supplyTaskOrder').then((res : any) => {
  830. if (res.code === 200) {
  831. this.$message.success(res.msg);
  832. this.getDataList();
  833. (this.$refs.bill as any).showTab = 'all';
  834. (this.$refs.bill as any).setBillFormValue({});
  835. } else this.failHandle(res)
  836. })
  837. })
  838. }
  839. }
  840. // 打开新增
  841. onAdd(e : any) {
  842. console.log('新增 ==>', e);
  843. if(e==='billTable_0'){
  844. let data = (this.$refs.bill as any).getBillFormValue();
  845. data.suborderList.unshift({isDeleted:0,taskOrderId:data.id})
  846. console.log(data);
  847. (this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
  848. }
  849. // (this.$refs.bill as any).setBillFormValue({}); // 设置单据表单数据
  850. // (this.$refs.bill as any).showTab = 'bill';
  851. }
  852. // 打开编辑
  853. openEdit(e : any) {
  854. console.log('编辑 ==>', e);
  855. e = e.row ? e.row : e;
  856. (this.$refs.bill as any).setBillFormValue(e); // 设置单据表单数据
  857. (this.$refs.bill as any).setBillTableValue(e.suborderList, 0);// 设置第1张单据表格数据
  858. (this.$refs.bill as any).showTab = 'bill';
  859. }
  860. // 派单
  861. onDispatch(e : any) {
  862. console.log('派单 ==>', e);
  863. }
  864. // 提交
  865. onSmt(e : any) {
  866. console.log('提交 ==>', e);
  867. // (this as any).$refs.bill.$refs.billForm.validate().then(() => {
  868. // let query = (this as any).$refs.bill.$refs.billForm.getValue();
  869. // api.saveList(query, 'supplyTaskOrder').then((res : any) => {
  870. // if (res.code === 200) {
  871. // this.$message({
  872. // type: 'success',
  873. // message: '提交成功!'
  874. // });
  875. // this.getDataList();
  876. // (this.$refs.bill as any).showTab = 'all';
  877. // (this.$refs.bill as any).setBillFormValue({});
  878. // } else this.failHandle(res)
  879. // })
  880. // })
  881. }
  882. // 切换tab栏
  883. clickTab(e : any) {
  884. // console.log(e);
  885. // submitState: 提交状态
  886. if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
  887. if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
  888. if (e === 'recycleBin') { // 回收站数据
  889. // let data = (this as any).$lodash.cloneDeep(this.config.bill);
  890. // data.form.attr.readonly = true;
  891. // for (const item of data.tableConfig) {
  892. // delete item.tool
  893. // }
  894. // (this.$refs.bill as any).setBillConfig(data)
  895. this.getSelectDeleteList('supplyTaskOrder')
  896. }
  897. }
  898. // 初始化
  899. getDataList() {
  900. if (!this.$refs.bill) {
  901. if (this.timeNum > 5) {
  902. clearInterval(this.timer)
  903. }
  904. this.timeNum++;
  905. return
  906. }
  907. clearInterval(this.timer)
  908. this.getPageList({}, 'all'); // 综合数据
  909. }
  910. // 获取分页数据
  911. getPageList(query : any, type : any) {
  912. api.pageList(query, 'supplyTaskOrder').then((res : any) => {
  913. if (res.code === 200) {
  914. (this.$refs.bill as any).setTabTableValue(type, res.data.records);
  915. let page = {
  916. pageNo: res.data.current, //当前页
  917. pageSize: res.data.size, //每页条数
  918. total: res.data.total //总条数
  919. };
  920. (this.$refs.bill as any).setTablePage(type, page)
  921. } else this.failHandle(res)
  922. })
  923. }
  924. // 回收站数据
  925. getSelectDeleteList(url : any) {
  926. api.selectDeleteList(url).then((res : any) => {
  927. if (res.code === 200) {
  928. (this.$refs.bill as any).setTabTableValue('recycleBin', res.data);
  929. let page = {
  930. pageNo: res.data.current, //当前页
  931. pageSize: res.data.size, //每页条数
  932. total: res.data.total //总条数
  933. };
  934. (this.$refs.bill as any).setTablePage('recycleBin', page)
  935. } else this.failHandle(res)
  936. });
  937. }
  938. // 搜索
  939. search(parames : any) {
  940. console.log('搜索 ==> ', parames);
  941. let query = parames.value
  942. if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
  943. if (parames.type === 'smt') query.submitState = 1 // 草稿箱数据
  944. // if (parames.type === 'recycleBin') // 回收站
  945. this.getPageList(query, parames.type) // 获取分页数据
  946. }
  947. // 刷新
  948. onRefresh(e : any) {
  949. console.log('刷新 ==>', e);
  950. (this as any).$refs.bill.$refs[e].resert();
  951. if (e === 'all') this.getPageList({}, 'all'); // 草稿箱数据
  952. if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
  953. if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
  954. if (e === 'recycleBin') this.getSelectDeleteList('supplyTaskOrder') // 回收站数据
  955. }
  956. // 工具栏删除
  957. onDelete(e:any) {
  958. console.log('工具栏删除 ==> ',e);
  959. let selectData = (this.$refs.bill as any).getTableSelectData(e)
  960. let ids = '';
  961. if (selectData.length > 0) {
  962. selectData.map((v : any) => {
  963. ids += v.id + ','
  964. })
  965. } else return this.$message({ type: 'warning', message: '请选择删除数据' })
  966. ids = ids.slice(0, ids.length - 1);
  967. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  968. confirmButtonText: '确定',
  969. cancelButtonText: '取消',
  970. type: 'warning',
  971. center: true
  972. }).then(() => {
  973. api.deleteList({ ids: ids }, 'supplyTaskOrder').then((res : any) => {
  974. if (res.code === 200) {
  975. this.getDataList();
  976. this.$message({
  977. type: 'success',
  978. message: '删除成功!'
  979. });
  980. } else this.failHandle(res)
  981. })
  982. }).catch(() => {
  983. this.$message({
  984. type: 'info',
  985. message: '已取消删除'
  986. });
  987. });
  988. }
  989. // 操作删除
  990. doDelete2(item : any) {
  991. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  992. confirmButtonText: '确定',
  993. cancelButtonText: '取消',
  994. type: 'warning',
  995. center: true
  996. }).then(() => {
  997. api.deleteList({ ids: item.id }, 'supplyTaskOrder').then((res : any) => {
  998. if (res.code === 200) {
  999. this.getDataList();
  1000. this.$message({
  1001. type: 'success',
  1002. message: '删除成功!'
  1003. });
  1004. } else this.failHandle(res)
  1005. })
  1006. }).catch(() => {
  1007. this.$message({
  1008. type: 'info',
  1009. message: '已取消删除'
  1010. });
  1011. });
  1012. }
  1013. // 运行错误
  1014. failHandle(err : any) {
  1015. let msg = err.msg ? err.msg : '运行错误!';
  1016. this.$message.error(msg)
  1017. }
  1018. }
  1019. </script>