index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  1. <template>
  2. <div>
  3. <by-bill :propConfig="config" @search="search" ref="bill" @resert="resert" @detail="openEdit"
  4. @onRefresh="resert" @pagination="pagination" @clickTab="clickTab">
  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. form: {
  228. attr: {
  229. size: 'medium',
  230. readonly: true,
  231. },
  232. columns: [
  233. [
  234. {
  235. span: 8,
  236. label: '单据编号',
  237. prop: 'orderNumber',
  238. component: 'by-input',
  239. },
  240. {
  241. span: 8,
  242. label: '机构名称',
  243. prop: 'organizationName',
  244. component: 'by-input',
  245. },
  246. {
  247. span: 8,
  248. label: '联系方式',
  249. prop: 'phone',
  250. component: 'by-input',
  251. },
  252. {
  253. span: 8,
  254. label: '收货人',
  255. prop: 'consignee',
  256. component: 'by-input',
  257. },
  258. {
  259. span: 8,
  260. label: '计划交货时间',
  261. prop: 'planDeliveryData',
  262. component: 'by-input',
  263. },
  264. {
  265. span: 8,
  266. label: '确定交货时间',
  267. prop: 'affirmDeliveryData',
  268. component: 'by-input',
  269. },
  270. {
  271. span: 8,
  272. label: '交货地点',
  273. prop: 'address',
  274. component: 'by-input',
  275. },
  276. ],
  277. [
  278. {
  279. span: 28,
  280. label: '备注',
  281. slot: true,
  282. prop: 'remark',
  283. component: 'by-input',
  284. compConfig: {
  285. attr: {
  286. size: 'mini',
  287. placeholder: '请输入备注',
  288. type: 'textarea'
  289. },
  290. }
  291. },
  292. ]
  293. ]
  294. },
  295. tableConfig: [
  296. {
  297. table: {
  298. attr: {
  299. size: 'mini',
  300. height: 500,
  301. align: 'center',
  302. readonly: true
  303. },
  304. columns:
  305. [{
  306. width: 300,
  307. title: '物料名称',
  308. field: 'materialName',
  309. },
  310. {
  311. width: 150,
  312. title: '单位',
  313. field: 'unit',
  314. },
  315. {
  316. width: 150,
  317. title: '数量',
  318. field: 'number',
  319. },
  320. {
  321. width: 150,
  322. title: '已交付数量',
  323. field: 'deliveryNumber',
  324. },
  325. {
  326. width: 150,
  327. title: '单价',
  328. field: 'unitPrice',
  329. },
  330. {
  331. width: 150,
  332. title: '实际金额',
  333. field: 'realityPrice',
  334. },
  335. {
  336. width: 150,
  337. title: '优惠金额',
  338. field: 'prePrice',
  339. },
  340. {
  341. width: 150,
  342. title: '合计金额',
  343. field: 'totalPrice',
  344. },
  345. ]
  346. }
  347. }
  348. ]
  349. },
  350. // 综合
  351. all: {
  352. search: {
  353. attr: {
  354. size: 'mini',
  355. },
  356. columns: [
  357. [
  358. {
  359. span: 6,
  360. label: '单据编号',
  361. prop: 'orderNumber',
  362. component: 'by-input',
  363. compConfig: {
  364. attr: {
  365. placeholder: '请输入单据编号',
  366. clearable: true
  367. }
  368. }
  369. },
  370. {
  371. span: 6,
  372. label: '机构名称',
  373. prop: 'organizationName',
  374. component: 'by-input',
  375. compConfig: {
  376. attr: {
  377. placeholder: '请输入机构名称',
  378. clearable: true
  379. },
  380. },
  381. },
  382. ],
  383. ]
  384. },
  385. tool: {
  386. tools: {
  387. search: true,
  388. refresh: true
  389. },
  390. customTools: [
  391. {
  392. name: '终止订单', icon: 'el-icon-top', audit: [''], event: {
  393. click: () => {
  394. (this as any).doBackOrder()
  395. }
  396. }
  397. }
  398. ]
  399. },
  400. table: {
  401. attr: {
  402. height: 600,
  403. size: 'mini',
  404. seq: true,
  405. align: 'left',
  406. checkbox: true
  407. },
  408. columns: [
  409. {
  410. width: 144,
  411. title: '单据编号',
  412. field: 'orderNumber',
  413. isDetail: true,
  414. },
  415. {
  416. width: 50,
  417. component: OrderType,
  418. },
  419. {
  420. width: 180,
  421. title: '机构名称',
  422. field: 'organizationName',
  423. },
  424. {
  425. width: 90,
  426. title: '收货人',
  427. field: 'consignee',
  428. },
  429. {
  430. width: 120,
  431. title: '联系方式',
  432. field: 'phone',
  433. },
  434. {
  435. width: 150,
  436. title: '计划交货时间',
  437. field: 'planDeliveryData',
  438. },
  439. {
  440. width: 150,
  441. title: '确定交货时间',
  442. field: 'affirmDeliveryData',
  443. },
  444. {
  445. width: 150,
  446. title: '交货地点',
  447. field: 'address',
  448. },
  449. {
  450. width: 150,
  451. title: '状态',
  452. field: 'status',
  453. component: Assembly,
  454. },
  455. {
  456. width: 110,
  457. title: '操作',
  458. action: true,
  459. plugins: [
  460. {
  461. icon: 'el-icon-edit',
  462. name: '查看',
  463. audit: '',
  464. event: {
  465. click: (item : any) => {
  466. (this as any).openEdit(item)
  467. }
  468. }
  469. },
  470. {
  471. name: '拆单',
  472. event: {
  473. show: (item : any) => {
  474. return item.isMaster === 1
  475. },
  476. click: (item : any) => (this as any).orderTaking(item)
  477. }
  478. },
  479. ]
  480. }
  481. ]
  482. }
  483. },
  484. // 终止订单
  485. returnOrder: {
  486. search: {
  487. attr: {
  488. size: 'mini',
  489. },
  490. columns: [
  491. [
  492. {
  493. span: 6,
  494. label: '单据编号',
  495. prop: 'orderNumber',
  496. component: 'by-input',
  497. compConfig: {
  498. attr: {
  499. placeholder: '请输入单据编号',
  500. clearable: true
  501. }
  502. }
  503. },
  504. {
  505. span: 6,
  506. label: '机构名称',
  507. prop: 'organizationName',
  508. component: 'by-input',
  509. compConfig: {
  510. attr: {
  511. placeholder: '请输入机构名称',
  512. clearable: true
  513. },
  514. },
  515. },
  516. ],
  517. ]
  518. },
  519. tool: {
  520. tools: {
  521. search: true,
  522. refresh: true
  523. },
  524. },
  525. table: {
  526. attr: {
  527. height: 620,
  528. size: 'mini',
  529. seq: true,
  530. align: 'left',
  531. checkbox: true
  532. },
  533. columns: [
  534. {
  535. width: 168,
  536. title: '单据编号',
  537. field: 'orderNumber',
  538. isDetail: true,
  539. fixed: 'left'
  540. },
  541. {
  542. width: 180,
  543. title: '机构名称',
  544. field: 'organizationName',
  545. },
  546. {
  547. width: 90,
  548. title: '收货人',
  549. field: 'consignee',
  550. },
  551. {
  552. width: 120,
  553. title: '联系方式',
  554. field: 'phone',
  555. },
  556. {
  557. width: 150,
  558. title: '计划交货时间',
  559. field: 'planDeliveryData',
  560. },
  561. {
  562. width: 150,
  563. title: '确定交货时间',
  564. field: 'affirmDeliveryData',
  565. },
  566. {
  567. width: 150,
  568. title: '交货地点',
  569. field: 'address',
  570. },
  571. {
  572. width: 150,
  573. title: '状态',
  574. field: 'status',
  575. component: Assembly,
  576. },
  577. {
  578. width: 110,
  579. title: '操作',
  580. action: true,
  581. plugins: [{
  582. icon: 'el-icon-edit',
  583. name: '查看',
  584. audit: '',
  585. event: {
  586. click: (item : any) => {
  587. (this as any).openEdit(item)
  588. }
  589. }
  590. },
  591. ]
  592. }
  593. ]
  594. }
  595. },
  596. }
  597. created() {
  598. this.timer = setInterval(() => {
  599. this.getDataList()
  600. }, 500)
  601. }
  602. // 引单
  603. citationOrder() {
  604. let data : any = (this as any).$refs.bill.getSourceTableSelectData(0);
  605. console.log(data);
  606. if (data.length <= 0) return this.$message.warning('请选择引单数据');
  607. data = data.map((item : any) => {
  608. item.address = item.deliveryAddress
  609. item.consignee = item.delivery
  610. item.phone = item.deliveryPhone
  611. item.planDeliveryData = item.deliveryData
  612. const { ...newData } = item
  613. return newData
  614. })
  615. let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
  616. billConfig.tool.tools = { save: true };
  617. billConfig.tool.customTools = [];
  618. this.isCitation = true;
  619. (this.$refs.bill as any).showTab = 'bill';
  620. setTimeout(() => {
  621. (this.$refs.bill as any).setBillConfig(billConfig);
  622. (this.$refs.bill as any).setBillFormValue(data[0]); // 设置单据表单数据
  623. (this.$refs.bill as any).setBillTableValue(data[0].suborderList, 0);// 设置第1张单据表格数据
  624. }, 0)
  625. };
  626. // 右拆单数据变化
  627. rightChange(e : any) {
  628. console.log(e.number);
  629. if (0 <= e.number && e.number <= this.regularData[e.dataIndex].splitNumber) {
  630. let leftTableData = (this.$refs.leftTable as any).getValue();
  631. leftTableData[e.dataIndex].splitNumber = leftTableData[e.dataIndex].number - e.number;
  632. (this.$refs.leftTable as any).setValue(leftTableData);
  633. } else {
  634. let leftTableData = (this.$refs.leftTable as any).getValue();
  635. let rifhtTableData = (this.$refs.rightTable as any).getValue();
  636. rifhtTableData[e.dataIndex].number = '0';
  637. leftTableData[e.dataIndex].splitNumber = leftTableData[e.dataIndex].number - leftTableData[e.dataIndex].splitOrderNumber;
  638. (this.$refs.leftTable as any).setValue(leftTableData);
  639. (this.$refs.rightTable as any).setValue(rifhtTableData);
  640. this.$message.warning('输入值只能是自然数且不能大于可拆单数量');
  641. }
  642. }
  643. // 打开拆单
  644. orderTaking(item : any) {
  645. this.vxeValue = true;
  646. this.baseInfo = item;
  647. this.regularData = (this as any).$lodash.cloneDeep(item.suborderList);
  648. let rightData = (this as any).$lodash.cloneDeep(item.suborderList);
  649. this.regularData.map((v : any) => {
  650. v.splitNumber = v.number - v.splitOrderNumber;
  651. })
  652. rightData.map((v : any, i : any) => {
  653. v.number = '0';
  654. v.dataIndex = i;
  655. v.splitNumber = v.number - v.splitOrderNumber;
  656. });
  657. setTimeout(() => {
  658. (this.$refs.leftTable as any).setValue(this.regularData);
  659. (this.$refs.rightTable as any).setValue(rightData);
  660. }, 0)
  661. }
  662. // 确认拆单
  663. doConfirm() {
  664. let rifhtNewData : any = [];
  665. let rifhtTableData = (this.$refs.rightTable as any).getValue();
  666. rifhtTableData.map((v : any) => {
  667. rifhtNewData.push({
  668. id: v.id,
  669. inSplitOrderNumber: v.number
  670. })
  671. });
  672. let isTrue = rifhtNewData.filter((v : any) => v.inSplitOrderNumber != 0);
  673. let obj : any = {
  674. id: this.baseInfo.id,
  675. splitList: rifhtNewData,
  676. };
  677. if (isTrue.length > 0) {
  678. this.$confirm('确定拆单吗!', '注意', {
  679. confirmButtonText: '确定',
  680. cancelButtonText: '取消',
  681. type: 'warning',
  682. center: true
  683. }).then(() => {
  684. api.splitOrder(obj, 'supplyPurchaseOrder').then((res : any) => {
  685. if (res.code === 200) {
  686. this.$message.success('拆单成功!');
  687. this.getPageList({}, 'all'); // 综合数据
  688. this.vxeValue = false;
  689. } else this.$message.error(res.msg);
  690. })
  691. }).catch(() => this.$message.info('已取消拆单'));
  692. } else this.$message.warning('请输入拆单销售数据');
  693. }
  694. getDataList() {
  695. if (!this.$refs.bill) {
  696. if (this.timeNum > 5) {
  697. clearInterval(this.timer)
  698. }
  699. this.timeNum++;
  700. return
  701. }
  702. clearInterval(this.timer);
  703. this.getPageList({}, 'all'); // 综合数据
  704. }
  705. // 获取分页数据
  706. getPageList(query : any, type : any) {
  707. api.pageList(query, 'supplyPurchaseOrder').then((res : any) => {
  708. if (res.code === 200) {
  709. (this.$refs.bill as any).setTabTableValue(type, res.data.records);
  710. let page = {
  711. pageNo: res.data.current, //当前页
  712. pageSize: res.data.size, //每页条数
  713. total: res.data.total //总条数
  714. };
  715. (this.$refs.bill as any).setTablePage(type, page)
  716. } else this.$message.error(res.msg);
  717. })
  718. }
  719. // 获取引单分页数据
  720. getCitationList(query : any) {
  721. let loading = this.$loading({ target: '.main-container' });
  722. query.submitState = 1; // 已提交
  723. query.status = 0; // 未接单
  724. api.pageList(query, 'supplyTaskOrder').then((res : any) => {
  725. if (res.code === 200) {
  726. (this.$refs.bill as any).setSourceTableData(0, res.data.records);
  727. let page = {
  728. pageNo: res.data.current, //当前页
  729. pageSize: res.data.size, //每页条数
  730. total: res.data.total //总条数
  731. };
  732. loading.close();
  733. (this.$refs.bill as any).setSourcePage(0, page);
  734. } else this.$message.error(res.msg)
  735. })
  736. }
  737. // 打开编辑
  738. openEdit(e : any) {
  739. e = e.row ? e.row : e;
  740. let loading = this.$loading({ target: '.main-container' });
  741. api.single({ id: e.id }, 'supplyPurchaseOrder').then((res : any) => {
  742. if (res.code === 200) {
  743. let parentData = res.data ? res.data : e;
  744. let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
  745. if (parentData.isMaster === 1) {
  746. billConfig.tool.customTools = [
  747. {
  748. name: '拆单', icon: 'el-icon-minus', audit: [''], event: {
  749. click: () => {
  750. (this as any).orderTaking(parentData)
  751. }
  752. }
  753. },
  754. ];
  755. } else if (parentData.status != 2) {
  756. billConfig.tool.customTools = [
  757. {
  758. name: '终止订单', icon: 'el-icon-bottom', audit: [''], event: {
  759. click: () => {
  760. (this as any).doBackOrder2(parentData)
  761. }
  762. }
  763. }
  764. ];
  765. };
  766. (this.$refs.bill as any).setBillConfig(billConfig);
  767. (this.$refs.bill as any).setBillFormValue(parentData); // 设置单据表单数据
  768. (this.$refs.bill as any).setBillTableValue(parentData.suborderList, 0);// 设置第1张单据表格数据
  769. (this.$refs.bill as any).showTab = 'bill';
  770. loading.close();
  771. } else loading.close();
  772. });
  773. }
  774. // 工具栏终止订单
  775. doBackOrder() {
  776. let selectData = (this as any).$refs.bill.getTableSelectData('all');
  777. if (selectData.length > 1) return this.$message.warning('只能选择一条终止订单数据')
  778. let ids : any = [];
  779. if (selectData.length > 0) {
  780. selectData.map((v : any) => {
  781. ids.push(v.id);
  782. })
  783. } else return this.$message({ type: 'warning', message: '请选择终止订单数据' })
  784. selectData[0].suborderList.map((v : any) => {
  785. delete v.id;
  786. })
  787. this.$confirm('确定终止订单吗!', '注意', {
  788. confirmButtonText: '确定',
  789. cancelButtonText: '取消',
  790. type: 'warning',
  791. center: true
  792. }).then(() => {
  793. api.stoporder({ ids: ids }, 'supplyPurchaseOrder').then((res : any) => {
  794. if (res.code === 200) {
  795. this.$message.success('终止订单成功!');
  796. this.getDataList();
  797. (this.$refs.bill as any).showTab = 'all';
  798. } else this.$message.error(res.msg)
  799. })
  800. }).catch(() => this.$message.info('已取消终止订单'));
  801. }
  802. // 导航切换
  803. clickTab(e : any) {
  804. console.log('导航切换 ==> ', e);
  805. // submitState: 提交状态
  806. if (e === 'source') {
  807. this.getCitationList({});
  808. }
  809. if (e === 'all') this.getDataList();
  810. if (e === 'bill') {
  811. let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
  812. billConfig.tool.customTools = [];
  813. (this.$refs.bill as any).setBillConfig(billConfig);
  814. }
  815. if (e === 'returnOrder') this.getPageList({ status: 2 }, 'returnOrder')
  816. }
  817. // 单据操作终止订单
  818. doBackOrder2(e : any) {
  819. console.log(e);
  820. e.suborderList.map((v : any) => {
  821. delete v.id;
  822. })
  823. this.$confirm('确定终止订单吗!', '注意', {
  824. confirmButtonText: '确定',
  825. cancelButtonText: '取消',
  826. type: 'warning',
  827. center: true
  828. }).then(() => {
  829. api.stoporder([e.id], 'supplyPurchaseOrder').then((res : any) => {
  830. if (res.code === 200) {
  831. this.$message.success('终止订单成功!');
  832. this.getDataList();
  833. (this.$refs.bill as any).showTab = 'all';
  834. } else this.$message.error(res.msg)
  835. })
  836. }).catch(() => this.$message.info('已取消终止订单'));
  837. }
  838. // 分页
  839. pagination(e : any) {
  840. let query : any = (this as any).$refs.bill.getSearchValue(e.type);
  841. query.pageNo = e.page.pageNum;
  842. query.pageSize = e.page.pageSize;
  843. let loading = this.$loading({ target: '.main-container' })
  844. api.pageList(query, 'supplyPurchaseOrder').then((res : any) => {
  845. if (res.code === 200) {
  846. (this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
  847. loading.close()
  848. } else this.$message.error(res.msg);
  849. })
  850. }
  851. // 搜索
  852. search(parames : any) {
  853. let query = parames.value
  854. if (parames.type === 'source_0') {
  855. this.getCitationList(query);
  856. } else {
  857. if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
  858. if (parames.type === 'smt') query.submitState = 1 // 已提交数据
  859. this.getPageList(query, parames.type) // 获取综合分页数据
  860. }
  861. }
  862. // 刷新/重置
  863. resert(e : any) {
  864. let data : any = e.type ? e.type : e;
  865. if (data === 'source_0') {
  866. (this as any).$refs.bill.$refs.source_0[0].clearSearch();
  867. this.getCitationList({});
  868. } else {
  869. (this as any).$refs.bill.$refs[data].clearSearch();
  870. if (data === 'all') this.getPageList({}, 'all'); // 综合数据
  871. }
  872. }
  873. }
  874. </script>