index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  1. <template>
  2. <div>
  3. <by-bill :propConfig="config" @search="search" ref="bill" @resert="resert" @detail="openEdit" @onRefresh="resert"
  4. @pagination="pagination" @clickTab="clickTab" @onOrder="onOrder">
  5. </by-bill>
  6. <vxe-modal v-model="vxeValue" width="70%" height="70%" min-width="800" min-height="600" show-zoom resize transfer
  7. show-footer>
  8. <template #title>
  9. <!-- <span>拆单</span> -->
  10. </template>
  11. <template #default>
  12. <div class="fl" style="width: 40%;">
  13. <div style="margin-bottom: 20px;">主单销售数据</div>
  14. <by-table ref="leftTable" :propConfig="leftTableConfig"></by-table>
  15. </div>
  16. <div class="fl" style="font-size: 80px;margin: 200px 6% 0 6%;transform: rotate(90deg);"><i
  17. class="el-icon-sort"></i></div>
  18. <div class="fl" style="width: 40%;">
  19. <div style="margin-bottom: 20px;">拆单销售数据</div>
  20. <by-table ref="rightTable" :propConfig="rightTableConfig" @onChangeRow="rightChange"></by-table>
  21. </div>
  22. </template>
  23. <template #footer>
  24. <div class="btn">
  25. <el-button type="primary" size="small" @click="doConfirm">确定</el-button>
  26. </div>
  27. </template>
  28. </vxe-modal>
  29. </div>
  30. </template>
  31. <script lang="ts">
  32. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  33. import api from "@/api/order";
  34. import OrderType from "./components/orderType.vue";
  35. import Assembly from "@/components/Assembly/saleOrder.vue";
  36. @Component
  37. export default class OrderTask extends Vue {
  38. vxeValue = false
  39. isCitation = false
  40. timeNum = 0;
  41. timer : any = null
  42. baseInfo : any = {} // 订单数据
  43. regularData : any = [] // 固定值
  44. leftTableConfig : any = {
  45. attr: {
  46. size: 'mini',
  47. height: 490,
  48. align: 'center',
  49. },
  50. columns:
  51. [
  52. {
  53. width: 128,
  54. title: '物料名称',
  55. field: 'materialName',
  56. },
  57. {
  58. width: 128,
  59. title: '数量',
  60. field: 'number',
  61. },
  62. {
  63. width: 128,
  64. title: '已拆单数量',
  65. field: 'splitOrderNumber',
  66. },
  67. {
  68. width: 128,
  69. title: '可拆单数量',
  70. field: 'splitNumber',
  71. }
  72. ]
  73. }
  74. rightTableConfig : any = {
  75. attr: {
  76. size: 'mini',
  77. height: 490,
  78. align: 'center',
  79. },
  80. columns:
  81. [
  82. {
  83. width: 258,
  84. title: '物料名称',
  85. field: 'materialName',
  86. },
  87. {
  88. width: 258,
  89. title: '数量',
  90. field: 'number',
  91. component: 'by-input',
  92. compConfig: {
  93. attr: {
  94. size: 'mini',
  95. type: 'integer',
  96. placeholder: '请输入数量'
  97. },
  98. }
  99. },
  100. ]
  101. }
  102. config : any = {
  103. attr: {
  104. activeName: 'all'
  105. },
  106. // 引单
  107. source: [
  108. {
  109. title: '订单任务',
  110. search: {
  111. attr: {
  112. size: 'mini',
  113. },
  114. columns: [
  115. [
  116. {
  117. span: 6,
  118. label: '单据编号',
  119. prop: 'orderNumber',
  120. component: 'by-input',
  121. compConfig: {
  122. attr: {
  123. placeholder: '请输入单据编号',
  124. clearable: true
  125. }
  126. }
  127. },
  128. {
  129. span: 6,
  130. label: '机构名称',
  131. prop: 'organizationName',
  132. component: 'by-input',
  133. compConfig: {
  134. attr: {
  135. placeholder: '请输入机构名称',
  136. clearable: true
  137. },
  138. },
  139. },
  140. {
  141. span: 6,
  142. label: '交货时间',
  143. prop: 'deliveryData',
  144. component: 'by-date-picker',
  145. compConfig: {
  146. format: 'yyyy-MM-dd hh:ss:mm',
  147. type: 'datetime'
  148. }
  149. },
  150. ],
  151. ]
  152. },
  153. tool: {
  154. tools: {
  155. search: true,
  156. refresh: true
  157. },
  158. customTools: [
  159. {
  160. name: '引单', icon: 'el-icon-bottom', audit: [''], event: {
  161. click: () => {
  162. (this as any).citationOrder()
  163. }
  164. }
  165. },
  166. ]
  167. },
  168. table: {
  169. attr: {
  170. height: 620,
  171. size: 'mini',
  172. seq: true,
  173. align: 'left',
  174. radio: true
  175. },
  176. columns: [
  177. {
  178. width: 160,
  179. title: '单据编号',
  180. field: 'orderNumber',
  181. fixed: 'left'
  182. },
  183. {
  184. width: 120,
  185. title: '机构名称',
  186. field: 'organizationName',
  187. },
  188. {
  189. width: 80,
  190. title: '来源类型',
  191. field: 'sourceType',
  192. },
  193. {
  194. width: 120,
  195. title: '交货人',
  196. field: 'delivery',
  197. },
  198. {
  199. width: 150,
  200. title: '交货时间',
  201. field: 'deliveryData',
  202. },
  203. {
  204. width: 200,
  205. title: '交货地点',
  206. field: 'deliveryAddress',
  207. },
  208. {
  209. width: 130,
  210. title: '联系方式',
  211. field: 'deliveryPhone',
  212. },
  213. {
  214. width: 130,
  215. title: '交货方式',
  216. field: 'deliveryWay',
  217. },
  218. ]
  219. }
  220. },
  221. ],
  222. // 单据
  223. bill: {
  224. tool: {
  225. customTools: []
  226. },
  227. log:{
  228. request:{
  229. url:'/supply/supplyPurchaseOrderOperateLog/page',
  230. method:'GET'
  231. }
  232. },
  233. form: {
  234. attr: {
  235. size: 'medium',
  236. readonly: true,
  237. },
  238. columns: [
  239. [
  240. {
  241. span: 8,
  242. label: '单据编号',
  243. prop: 'orderNumber',
  244. component: 'by-input',
  245. },
  246. {
  247. span: 8,
  248. label: '机构名称',
  249. prop: 'organizationName',
  250. component: 'by-input',
  251. },
  252. {
  253. span: 8,
  254. label: '联系方式',
  255. prop: 'phone',
  256. component: 'by-input',
  257. },
  258. {
  259. span: 8,
  260. label: '收货人',
  261. prop: 'consignee',
  262. component: 'by-input',
  263. },
  264. {
  265. span: 8,
  266. label: '计划交货时间',
  267. prop: 'planDeliveryData',
  268. component: 'by-input',
  269. },
  270. {
  271. span: 8,
  272. label: '确定交货时间',
  273. prop: 'affirmDeliveryData',
  274. component: 'by-input',
  275. },
  276. {
  277. span: 8,
  278. label: '交货地点',
  279. prop: 'address',
  280. component: 'by-input',
  281. },
  282. ],
  283. [
  284. {
  285. span: 28,
  286. label: '备注',
  287. slot: true,
  288. prop: 'remark',
  289. component: 'by-input',
  290. compConfig: {
  291. attr: {
  292. size: 'mini',
  293. placeholder: '请输入备注',
  294. type: 'textarea'
  295. },
  296. }
  297. },
  298. ]
  299. ]
  300. },
  301. tableConfig: [
  302. {
  303. table: {
  304. attr: {
  305. size: 'mini',
  306. height: 500,
  307. align: 'center',
  308. readonly: true
  309. },
  310. columns:
  311. [{
  312. width: 300,
  313. title: '物料名称',
  314. field: 'materialName',
  315. },
  316. {
  317. width: 150,
  318. title: '单位',
  319. field: 'unit',
  320. },
  321. {
  322. width: 150,
  323. title: '数量',
  324. field: 'number',
  325. },
  326. {
  327. width: 150,
  328. title: '已交付数量',
  329. field: 'deliveryNumber',
  330. },
  331. {
  332. width: 150,
  333. title: '单价',
  334. field: 'unitPrice',
  335. },
  336. {
  337. width: 150,
  338. title: '实际金额',
  339. field: 'realityPrice',
  340. },
  341. {
  342. width: 150,
  343. title: '优惠金额',
  344. field: 'prePrice',
  345. },
  346. {
  347. width: 150,
  348. title: '合计金额',
  349. field: 'totalPrice',
  350. },
  351. ]
  352. }
  353. }
  354. ]
  355. },
  356. // 综合
  357. all: {
  358. search: {
  359. attr: {
  360. size: 'mini',
  361. },
  362. columns: [
  363. [
  364. {
  365. span: 6,
  366. label: '单据编号',
  367. prop: 'orderNumber',
  368. component: 'by-input',
  369. compConfig: {
  370. attr: {
  371. placeholder: '请输入单据编号',
  372. clearable: true
  373. }
  374. }
  375. },
  376. {
  377. span: 6,
  378. label: '机构名称',
  379. prop: 'organizationName',
  380. component: 'by-input',
  381. compConfig: {
  382. attr: {
  383. placeholder: '请输入机构名称',
  384. clearable: true
  385. },
  386. },
  387. },
  388. ],
  389. ]
  390. },
  391. tool: {
  392. tools: {
  393. search: true,
  394. refresh: true
  395. },
  396. customTools: [
  397. {
  398. name: '终止订单', icon: 'el-icon-close', audit: [''], event: {
  399. click: () => {
  400. (this as any).doBackOrder()
  401. }
  402. }
  403. }
  404. ]
  405. },
  406. table: {
  407. attr: {
  408. height: 600,
  409. size: 'mini',
  410. seq: true,
  411. align: 'left',
  412. radio: true
  413. },
  414. columns: [
  415. {
  416. width: 144,
  417. title: '单据编号',
  418. field: 'orderNumber',
  419. isDetail: true,
  420. },
  421. {
  422. width: 50,
  423. component: OrderType,
  424. },
  425. {
  426. width: 180,
  427. title: '机构名称',
  428. field: 'organizationName',
  429. },
  430. {
  431. width: 90,
  432. title: '收货人',
  433. field: 'consignee',
  434. },
  435. {
  436. width: 120,
  437. title: '联系方式',
  438. field: 'phone',
  439. },
  440. {
  441. width: 150,
  442. title: '计划交货时间',
  443. field: 'planDeliveryData',
  444. },
  445. {
  446. width: 150,
  447. title: '确定交货时间',
  448. field: 'affirmDeliveryData',
  449. },
  450. {
  451. width: 150,
  452. title: '交货地点',
  453. field: 'address',
  454. },
  455. {
  456. width: 150,
  457. title: '状态',
  458. field: 'status',
  459. component: Assembly,
  460. },
  461. {
  462. width: 110,
  463. title: '操作',
  464. action: true,
  465. plugins: [
  466. {
  467. icon: 'el-icon-edit',
  468. name: '查看',
  469. audit: '',
  470. event: {
  471. click: (item : any) => {
  472. (this as any).openEdit(item)
  473. }
  474. }
  475. },
  476. {
  477. name: '拆单',
  478. event: {
  479. show: (item : any) => {
  480. return item.isMaster === 1
  481. },
  482. click: (item : any) => (this as any).orderTaking(item)
  483. }
  484. },
  485. ]
  486. }
  487. ]
  488. }
  489. },
  490. // 终止订单
  491. returnOrder: {
  492. search: {
  493. attr: {
  494. size: 'mini',
  495. },
  496. columns: [
  497. [
  498. {
  499. span: 6,
  500. label: '单据编号',
  501. prop: 'orderNumber',
  502. component: 'by-input',
  503. compConfig: {
  504. attr: {
  505. placeholder: '请输入单据编号',
  506. clearable: true
  507. }
  508. }
  509. },
  510. {
  511. span: 6,
  512. label: '机构名称',
  513. prop: 'organizationName',
  514. component: 'by-input',
  515. compConfig: {
  516. attr: {
  517. placeholder: '请输入机构名称',
  518. clearable: true
  519. },
  520. },
  521. },
  522. ],
  523. ]
  524. },
  525. tool: {
  526. tools: {
  527. search: true,
  528. refresh: true
  529. },
  530. },
  531. table: {
  532. attr: {
  533. height: 620,
  534. size: 'mini',
  535. seq: true,
  536. align: 'left',
  537. checkbox: true
  538. },
  539. columns: [
  540. {
  541. width: 168,
  542. title: '单据编号',
  543. field: 'orderNumber',
  544. isDetail: true,
  545. fixed: 'left'
  546. },
  547. {
  548. width: 180,
  549. title: '机构名称',
  550. field: 'organizationName',
  551. },
  552. {
  553. width: 90,
  554. title: '收货人',
  555. field: 'consignee',
  556. },
  557. {
  558. width: 120,
  559. title: '联系方式',
  560. field: 'phone',
  561. },
  562. {
  563. width: 150,
  564. title: '计划交货时间',
  565. field: 'planDeliveryData',
  566. },
  567. {
  568. width: 150,
  569. title: '确定交货时间',
  570. field: 'affirmDeliveryData',
  571. },
  572. {
  573. width: 150,
  574. title: '交货地点',
  575. field: 'address',
  576. },
  577. {
  578. width: 150,
  579. title: '状态',
  580. field: 'status',
  581. component: Assembly,
  582. },
  583. {
  584. width: 110,
  585. title: '操作',
  586. action: true,
  587. plugins: [{
  588. icon: 'el-icon-edit',
  589. name: '查看',
  590. audit: '',
  591. event: {
  592. click: (item : any) => {
  593. (this as any).openEdit(item)
  594. }
  595. }
  596. },
  597. ]
  598. }
  599. ]
  600. }
  601. },
  602. }
  603. created() {
  604. this.timer = setInterval(() => {
  605. this.getDataList()
  606. }, 500)
  607. }
  608. // 引单
  609. citationOrder() {
  610. let data : any = (this as any).$refs.bill.getSourceTableSelectData(0);
  611. if (data.length <= 0) return this.$message.warning('请选择引单数据');
  612. data = data.map((item : any) => {
  613. item.address = item.deliveryAddress
  614. item.consignee = item.delivery
  615. item.phone = item.deliveryPhone
  616. item.planDeliveryData = item.deliveryData
  617. const { ...newData } = item
  618. return newData
  619. })
  620. let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
  621. billConfig.tool.tools = { order: true };
  622. billConfig.tool.customTools = [];
  623. this.isCitation = true;
  624. (this.$refs.bill as any).showTab = 'bill';
  625. setTimeout(() => {
  626. (this.$refs.bill as any).setBillConfig(billConfig);
  627. (this.$refs.bill as any).setBillFormValue(data[0]); // 设置单据表单数据
  628. (this.$refs.bill as any).setBillTableValue(data[0].suborderList, 0);// 设置第1张单据表格数据
  629. }, 0)
  630. };
  631. // 接单
  632. onOrder() {
  633. this.$confirm('确定接单吗', '注意', {
  634. confirmButtonText: '确定',
  635. cancelButtonText: '取消',
  636. type: 'warning',
  637. center: true
  638. }).then(() => {
  639. let data = (this.$refs.bill as any).getBillFormValue();
  640. api.ordersaccepting({ ids: data.id }, 'supplyTaskOrder').then((res : any) => {
  641. if (res.code === 200) {
  642. this.getDataList();
  643. this.$message.success('接单成功!');
  644. (this.$refs.bill as any).showTab = 'all';
  645. } else this.$message.error(res.msg);
  646. })
  647. }).catch(() => this.$message.info('已取消接单'));
  648. }
  649. // 右拆单数据变化
  650. rightChange(e : any) {
  651. console.log(e.number);
  652. if (0 <= e.number && e.number <= this.regularData[e.dataIndex].splitNumber) {
  653. let leftTableData = (this.$refs.leftTable as any).getValue();
  654. leftTableData[e.dataIndex].splitNumber = leftTableData[e.dataIndex].number - e.number;
  655. (this.$refs.leftTable as any).setValue(leftTableData);
  656. } else {
  657. let leftTableData = (this.$refs.leftTable as any).getValue();
  658. let rifhtTableData = (this.$refs.rightTable as any).getValue();
  659. rifhtTableData[e.dataIndex].number = '0';
  660. leftTableData[e.dataIndex].splitNumber = leftTableData[e.dataIndex].number - leftTableData[e.dataIndex].splitOrderNumber;
  661. (this.$refs.leftTable as any).setValue(leftTableData);
  662. (this.$refs.rightTable as any).setValue(rifhtTableData);
  663. this.$message.warning('输入值只能是自然数且不能大于可拆单数量');
  664. }
  665. }
  666. // 打开拆单
  667. orderTaking(item : any) {
  668. this.vxeValue = true;
  669. this.baseInfo = item;
  670. this.regularData = (this as any).$lodash.cloneDeep(item.suborderList);
  671. let rightData = (this as any).$lodash.cloneDeep(item.suborderList);
  672. this.regularData.map((v : any) => {
  673. v.splitNumber = v.number - v.splitOrderNumber;
  674. })
  675. rightData.map((v : any, i : any) => {
  676. v.number = '0';
  677. v.dataIndex = i;
  678. v.splitNumber = v.number - v.splitOrderNumber;
  679. });
  680. setTimeout(() => {
  681. (this.$refs.leftTable as any).setValue(this.regularData);
  682. (this.$refs.rightTable as any).setValue(rightData);
  683. }, 0)
  684. }
  685. // 确认拆单
  686. doConfirm() {
  687. let rifhtNewData : any = [];
  688. let rifhtTableData = (this.$refs.rightTable as any).getValue();
  689. rifhtTableData.map((v : any) => {
  690. rifhtNewData.push({
  691. id: v.id,
  692. inSplitOrderNumber: v.number
  693. })
  694. });
  695. let isTrue = rifhtNewData.filter((v : any) => v.inSplitOrderNumber != 0);
  696. let obj : any = {
  697. id: this.baseInfo.id,
  698. splitList: rifhtNewData,
  699. };
  700. if (isTrue.length > 0) {
  701. this.$confirm('确定拆单吗!', '注意', {
  702. confirmButtonText: '确定',
  703. cancelButtonText: '取消',
  704. type: 'warning',
  705. center: true
  706. }).then(() => {
  707. api.splitOrder(obj, 'supplyPurchaseOrder').then((res : any) => {
  708. if (res.code === 200) {
  709. this.$message.success('拆单成功!');
  710. this.getPageList({}, 'all'); // 综合数据
  711. this.vxeValue = false;
  712. } else this.$message.error(res.msg);
  713. })
  714. }).catch(() => this.$message.info('已取消拆单'));
  715. } else this.$message.warning('请输入拆单销售数据');
  716. }
  717. getDataList() {
  718. if (!this.$refs.bill) {
  719. if (this.timeNum > 5) {
  720. clearInterval(this.timer)
  721. }
  722. this.timeNum++;
  723. return
  724. }
  725. clearInterval(this.timer);
  726. this.getPageList({}, 'all'); // 综合数据
  727. }
  728. // 获取分页数据
  729. getPageList(query : any, type : any) {
  730. api.pageList(query, 'supplyPurchaseOrder').then((res : any) => {
  731. if (res.code === 200) {
  732. (this.$refs.bill as any).setTabTableValue(type, res.data.records);
  733. let page = {
  734. pageNo: res.data.current, //当前页
  735. pageSize: res.data.size, //每页条数
  736. total: res.data.total //总条数
  737. };
  738. (this.$refs.bill as any).setTablePage(type, page)
  739. } else this.$message.error(res.msg);
  740. })
  741. }
  742. // 获取引单分页数据
  743. getCitationList(query : any) {
  744. let loading = this.$loading({ target: '.main-container' });
  745. query.submitState = 1; // 已提交
  746. query.status = 0; // 未接单
  747. api.pageList(query, 'supplyTaskOrder').then((res : any) => {
  748. if (res.code === 200) {
  749. (this.$refs.bill as any).setSourceTableData(0, res.data.records);
  750. let page = {
  751. pageNo: res.data.current, //当前页
  752. pageSize: res.data.size, //每页条数
  753. total: res.data.total //总条数
  754. };
  755. loading.close();
  756. (this.$refs.bill as any).setSourcePage(0, page);
  757. } else this.$message.error(res.msg)
  758. })
  759. }
  760. // 打开编辑
  761. openEdit(e : any) {
  762. e = e.row ? e.row : e;
  763. let loading = this.$loading({ target: '.main-container' });
  764. api.single({ id: e.id }, 'supplyPurchaseOrder').then((res : any) => {
  765. if (res.code === 200) {
  766. let parentData = res.data ? res.data : e;
  767. console.log(parentData);
  768. let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
  769. if (parentData.status === 2) {
  770. billConfig.tool.customTools = [];
  771. } else {
  772. billConfig.tool.customTools = [
  773. {
  774. name: '终止订单', icon: 'el-icon-close', audit: [''], event: {
  775. click: () => {
  776. (this as any).doBackOrder2(parentData)
  777. }
  778. }
  779. }
  780. ];
  781. // 主单
  782. if (parentData.isMaster === 1) {
  783. billConfig.tool.customTools = [
  784. {
  785. name: '拆单', icon: 'el-icon-minus', audit: [''], event: {
  786. click: () => {
  787. (this as any).orderTaking(parentData)
  788. }
  789. }
  790. },
  791. {
  792. name: '终止订单', icon: 'el-icon-close', audit: [''], event: {
  793. click: () => {
  794. (this as any).doBackOrder2(parentData)
  795. }
  796. }
  797. }
  798. ];
  799. }
  800. };
  801. billConfig.tool.tools = {};
  802. (this.$refs.bill as any).setBillConfig(billConfig);
  803. (this.$refs.bill as any).setBillFormValue(parentData); // 设置单据表单数据
  804. (this.$refs.bill as any).setBillTableValue(parentData.suborderList, 0);// 设置第1张单据表格数据
  805. (this.$refs.bill as any).showTab = 'bill';
  806. loading.close();
  807. } else loading.close();
  808. });
  809. }
  810. // 导航切换
  811. clickTab(e : any) {
  812. console.log('导航切换 ==> ', e);
  813. // submitState: 提交状态
  814. if (e === 'source') {
  815. this.getCitationList({});
  816. }
  817. if (e === 'all') this.getDataList();
  818. if (e === 'returnOrder') this.getPageList({ status: 2 }, 'returnOrder');
  819. if (e === 'bill') {
  820. let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
  821. billConfig.tool.tools = {};
  822. billConfig.tool.customTools = [];
  823. (this.$refs.bill as any).setBillConfig(billConfig);
  824. }
  825. }
  826. // 工具栏终止订单
  827. doBackOrder() {
  828. let selectData = (this as any).$refs.bill.getTableSelectData('all');
  829. // if (selectData.length > 1) return this.$message.warning('只能选择一条终止订单数据');
  830. let ids : any = [];
  831. if (selectData.length > 0) {
  832. selectData.map((v : any) => {
  833. ids.push(v.id);
  834. })
  835. } else return this.$message({ type: 'warning', message: '请选择终止订单数据' })
  836. this.$confirm('确定终止订单吗!', '注意', {
  837. confirmButtonText: '确定',
  838. cancelButtonText: '取消',
  839. type: 'warning',
  840. center: true
  841. }).then(() => {
  842. api.stoporder({ ids: ids }, 'supplyPurchaseOrder').then((res : any) => {
  843. if (res.code === 200) {
  844. this.$message.success('终止订单成功!');
  845. this.getDataList();
  846. (this.$refs.bill as any).showTab = 'all';
  847. } else this.$message.error(res.msg)
  848. })
  849. }).catch(() => this.$message.info('已取消终止订单'));
  850. }
  851. // 单据操作终止订单
  852. doBackOrder2(e : any) {
  853. this.$confirm('确定终止订单吗!', '注意', {
  854. confirmButtonText: '确定',
  855. cancelButtonText: '取消',
  856. type: 'warning',
  857. center: true
  858. }).then(() => {
  859. api.stoporder([e.id], 'supplyPurchaseOrder').then((res : any) => {
  860. if (res.code === 200) {
  861. this.$message.success('终止订单成功!');
  862. this.getDataList();
  863. (this.$refs.bill as any).showTab = 'all';
  864. } else this.$message.error(res.msg)
  865. })
  866. }).catch(() => this.$message.info('已取消终止订单'));
  867. }
  868. // 分页
  869. pagination(e : any) {
  870. console.log('分页 ==> ', e);
  871. let query : any = (this as any).$refs.bill.getSearchValue(e.type);
  872. query.pageNo = e.page.pageNum;
  873. query.pageSize = e.page.pageSize;
  874. if (e.type === 'returnOrder') query.status = 2; // 终止订单数据
  875. let loading = this.$loading({ target: '.main-container' });
  876. api.pageList(query, 'supplyPurchaseOrder').then((res : any) => {
  877. if (res.code === 200) {
  878. (this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
  879. loading.close()
  880. } else this.$message.error(res.msg);
  881. })
  882. }
  883. // 搜索
  884. search(parames : any) {
  885. let query = parames.value
  886. if (parames.type === 'source_0') {
  887. this.getCitationList(query);
  888. } else {
  889. if (query.type === 'returnOrder') query.status = 2; // 终止订单数据
  890. this.getPageList(query, parames.type) // 获取综合分页数据
  891. }
  892. }
  893. // 刷新/重置
  894. resert(e : any) {
  895. let data : any = e.type ? e.type : e;
  896. console.log('刷新/重置 ==> ', data);
  897. if (data === 'source_0') {
  898. (this as any).$refs.bill.$refs.source_0[0].clearSearch();
  899. this.getCitationList({});
  900. } else {
  901. (this as any).$refs.bill.$refs[data].clearSearch();
  902. if (data === 'all') this.getPageList({}, 'all'); // 综合数据
  903. if (data === 'returnOrder') this.getPageList({status:2}, 'returnOrder'); // 终止订单数据
  904. }
  905. }
  906. }
  907. </script>