referOrderDataModal.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <template>
  2. <a-modal
  3. title="参照订单数据"
  4. v-model="referOrderDataModVis"
  5. :confirmLoading="confirmLoading"
  6. @ok="onSubmit"
  7. @cancel="handleCancel"
  8. width="90%"
  9. >
  10. <!-- tabel 加载 -->
  11. <a-spin :spinning="confirmLoading">
  12. <!-- 查询 -->
  13. <div class="table-page-search-wrapper">
  14. <a-form layout="inline" @keyup.enter.native="searchQuery">
  15. <a-row :gutter="24">
  16. <a-col :md="6" :sm="8">
  17. <a-form-item label="订单号">
  18. <a-input placeholder="请输入订单号" v-model="queryParam.orderNumber"></a-input>
  19. </a-form-item>
  20. </a-col>
  21. <a-col :md="6" :sm="8">
  22. <a-form-item label="账套">
  23. <j-search-select-tag
  24. placeholder="请选择账套"
  25. v-model="queryParam.account"
  26. dict="view_account,account,account">
  27. </j-search-select-tag>
  28. </a-form-item>
  29. </a-col>
  30. <a-col :md="6" :sm="8">
  31. <a-form-item label="业务员">
  32. <a-input placeholder="请输入业务员" v-model="queryParam.salesman"></a-input>
  33. </a-form-item>
  34. </a-col>
  35. <template v-if="toggleSearchStatus">
  36. <a-col :md="6" :sm="8">
  37. <a-form-item label="客户">
  38. <j-search-select-tag
  39. placeholder="请选择客户"
  40. v-model="queryParam.customerName"
  41. dict="view_customer,customerfullname,customerfullname">
  42. </j-search-select-tag>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="6" :sm="8">
  46. <a-form-item label="订单日期">
  47. <a-range-picker
  48. style="width: 100%"
  49. :mode="dataRangeMode"
  50. :placeholder="['开始日期', '结束日期']"
  51. :value="dateRange"
  52. format = "YYYY-MM-DD"
  53. @change="dateRangeSelectChange"
  54. />
  55. </a-form-item>
  56. </a-col>
  57. <a-col :md="6" :sm="8">
  58. <a-form-model-item label="类型">
  59. <a-select v-model="queryParam.flourOrGarment">
  60. <a-select-option value="">请选择</a-select-option>
  61. <a-select-option value="1">成衣</a-select-option>
  62. <a-select-option value="0">面辅料</a-select-option>
  63. </a-select>
  64. </a-form-model-item>
  65. </a-col>
  66. <a-col :md="6" :sm="8">
  67. <a-form-item label="预发货日期">
  68. <a-range-picker
  69. style="width: 100%"
  70. :mode="rangeMode"
  71. :placeholder="['开始日期', '结束日期']"
  72. :value="range"
  73. format = "YYYY-MM-DD"
  74. @change="rangeSelectChange"
  75. />
  76. </a-form-item>
  77. </a-col>
  78. </template>
  79. <a-col :md="6" :sm="8">
  80. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  81. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  82. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  83. <a @click="handleToggleSearch" style="margin-left: 8px">
  84. {{ toggleSearchStatus ? '收起' : '展开' }}
  85. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  86. </a>
  87. </span>
  88. </a-col>
  89. </a-row>
  90. </a-form>
  91. </div>
  92. <!-- 勾选表 :row-key="record => record.id" { pageSize: 50 } , y: 800 -->
  93. <a-table
  94. bordered
  95. size="small"
  96. rowKey="id"
  97. v-if="orderListData"
  98. :columns="referOerderColumns"
  99. :data-source="orderListData"
  100. :loading="loading"
  101. :pagination="pagination"
  102. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  103. @change="handleTableChange"
  104. :scroll="{ x: 1500, y:450 }"
  105. >
  106. </a-table>
  107. </a-spin>
  108. </a-modal>
  109. </template>
  110. <script>
  111. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  112. import JEllipsis from '@/components/jeecg/JEllipsis'
  113. import moment from 'moment'
  114. import { randomUUID } from '@/utils/util'
  115. import { queryOrderData, confimOrderData } from '@api/document/shipmentList'
  116. export default {
  117. name: 'ReferOrderDataModal', // 参照订单数据弹框
  118. mixins: [JeecgListMixin],
  119. components: { JEllipsis, moment },
  120. data() {
  121. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  122. return {
  123. selectedRowKeys: [],
  124. selectedRows: {}, // 勾选项
  125. loading: false, // 表格加载
  126. fatherData:[],
  127. // 表头
  128. referOerderColumns: [
  129. {
  130. title: '订单号',
  131. dataIndex: 'orderNumber',
  132. width: 180,
  133. fixed: 'left',
  134. className: 'replacecolor'
  135. },
  136. {
  137. title: '款号',
  138. dataIndex: 'itemNumber',
  139. width: 150,
  140. fixed: 'left',
  141. className: 'replacecolor'
  142. },
  143. {
  144. title: '小po',
  145. dataIndex: 'smallPo',
  146. width: 100,
  147. className: 'replacecolor'
  148. },
  149. // 账套替换
  150. {
  151. title: '账套',
  152. dataIndex: 'account',
  153. width: 80,
  154. className: 'replacecolor'
  155. },
  156. {
  157. title: '预发货日期',
  158. dataIndex: 'preDeliveryDate',
  159. width: 120,
  160. className: 'replacecolor'
  161. },
  162. {
  163. title: '预完工日期',
  164. dataIndex: 'preCompletionDate',
  165. width: 120,
  166. className: 'replacecolor'
  167. },
  168. {
  169. title: 'packId',
  170. dataIndex: 'packId',
  171. width: 120,
  172. className: 'replacecolor'
  173. },
  174. {
  175. title: '分销点',
  176. dataIndex: 'distributionPoint',
  177. width: 120,
  178. className: 'replacecolor'
  179. },
  180. {
  181. title: '存货编码',
  182. dataIndex: 'inventoryCode',
  183. width: 120,
  184. className: 'replacecolor'
  185. },
  186. {
  187. title: '存货名称',
  188. dataIndex: 'inventoryName',
  189. customRender: t => ellipsis(t),
  190. width: 250,
  191. className: 'replacecolor'
  192. },
  193. {
  194. title: '颜色',
  195. dataIndex: 'colour',
  196. width: 160,
  197. customRender: t => ellipsis(t),
  198. className: 'replacecolor'
  199. },
  200. // {
  201. // title: '尺码',
  202. // dataIndex: 'size',
  203. // width: 100,
  204. // className: 'replacecolor'
  205. // },
  206. {
  207. title: '配码规格',
  208. dataIndex: 'codingRules',
  209. width: 180,
  210. className: 'replacecolor'
  211. },
  212. {
  213. title: '箱数',
  214. dataIndex: 'boxNumber',
  215. width: 100,
  216. className: 'replacecolor'
  217. },
  218. {
  219. title: '数量',
  220. dataIndex: 'quantity',
  221. width: 100,
  222. className: 'replacecolor'
  223. },
  224. {
  225. title: '订单剩余数量',
  226. dataIndex: 'surplusNum',
  227. width: 120,
  228. className: 'replacecolor'
  229. },
  230. {
  231. title: '含税单价',
  232. dataIndex: 'unitPriceIncludingTax',
  233. width: 100,
  234. className: 'replacecolor'
  235. },
  236. {
  237. title: '成衣工厂',
  238. dataIndex: 'garmentFactory',
  239. width: 100,
  240. className: 'replacecolor'
  241. },
  242. {
  243. title: '成衣件数',
  244. dataIndex: 'garmentNmb',
  245. width: 100,
  246. className: 'replacecolor'
  247. },
  248. {
  249. title: '业务类型',
  250. dataIndex: 'businessTypeText',
  251. width: 100,
  252. className: 'replacecolor'
  253. },
  254. {
  255. title: '客户订单',
  256. dataIndex: 'customerOrderNumber',
  257. width: 100,
  258. className: 'replacecolor'
  259. },
  260. {
  261. title: '销售类型',
  262. dataIndex: 'salesTypeText',
  263. width: 100,
  264. className: 'replacecolor'
  265. },
  266. {
  267. title: '客户简称',
  268. dataIndex: 'customerAbbreviation',
  269. width: 220,
  270. align: 'left',
  271. className: 'replacecolor'
  272. },
  273. {
  274. title: '客户名称',
  275. dataIndex: 'customerName',
  276. customRender: t => ellipsis(t),
  277. width: 220,
  278. className: 'replacecolor'
  279. },
  280. {
  281. title: '供应商编码',
  282. dataIndex: 'supplierCode',
  283. width: 100,
  284. className: 'replacecolor'
  285. },
  286. {
  287. title: '供应商',
  288. dataIndex: 'supplier',
  289. width: 120,
  290. className: 'replacecolor'
  291. },
  292. {
  293. title: '汇率',
  294. dataIndex: 'exchangeRate',
  295. width: 100,
  296. className: 'replacecolor'
  297. },
  298. // {
  299. // title: '整单合计',
  300. // dataIndex: 'wholeOrderTotal',
  301. // width: 100,
  302. // className: 'replacecolor'
  303. // },
  304. {
  305. title: '销售部门',
  306. dataIndex: 'salesDepartment',
  307. width: 120,
  308. className: 'replacecolor'
  309. },
  310. {
  311. title: '业务员',
  312. dataIndex: 'salesman',
  313. width: 120,
  314. className: 'replacecolor'
  315. },
  316. {
  317. title: '币种',
  318. dataIndex: 'currencyText',
  319. width: 100,
  320. className: 'replacecolor'
  321. },
  322. {
  323. title: '品牌方',
  324. dataIndex: 'brandSide',
  325. width: 120,
  326. className: 'replacecolor'
  327. },
  328. {
  329. title: '第三方',
  330. dataIndex: 'thirdParty',
  331. width: 220,
  332. align: 'left',
  333. className: 'replacecolor'
  334. },
  335. {
  336. title: '定金比例(%)',
  337. dataIndex: 'depositRatio',
  338. width: 100,
  339. className: 'replacecolor'
  340. },
  341. {
  342. title: '定金',
  343. dataIndex: 'deposit',
  344. width: 100,
  345. className: 'replacecolor'
  346. },
  347. {
  348. title: '协同路线',
  349. dataIndex: 'collaborativeRoute',
  350. width: 100,
  351. className: 'replacecolor'
  352. },
  353. {
  354. title: '付款条件',
  355. dataIndex: 'termOfPayment',
  356. width: 120,
  357. customRender: t => ellipsis(t),
  358. className: 'replacecolor'
  359. },
  360. {
  361. title: '最终客户',
  362. dataIndex: 'endCustomer',
  363. width: 120,
  364. className: 'replacecolor'
  365. },
  366. {
  367. title: '订单备注',
  368. dataIndex: 'orderRemarks',
  369. width: 280,
  370. customRender: t => ellipsis(t),
  371. className: 'replacecolor'
  372. },
  373. {
  374. title: '价格备注',
  375. dataIndex: 'priceRemarks',
  376. width: 280,
  377. customRender: t => ellipsis(t),
  378. className: 'replacecolor'
  379. },
  380. {
  381. title: '订单变更说明',
  382. dataIndex: 'orderChangeDescription',
  383. width: 220,
  384. customRender: t => ellipsis(t),
  385. className: 'replacecolor'
  386. },
  387. {
  388. title: '订单日期',
  389. dataIndex: 'orderDate',
  390. width: 120,
  391. className: 'replacecolor'
  392. },
  393. {
  394. title: '订单主表ID',
  395. dataIndex: 'syOrderDataId',
  396. width: 120,
  397. // fixed: 'right',
  398. className: 'replacecolor1'
  399. },
  400. {
  401. title: '订单子表ID',
  402. dataIndex: 'syOrderDataItemId',
  403. width: 450,
  404. // fixed: 'right',
  405. className: 'replacecolor'
  406. }
  407. ],
  408. orderListData: [], //订单数据
  409. confirmLoading: false,
  410. referOrderDataModVis: false,
  411. error:'', // 选中数据不符合的字段名
  412. errorFather: '', //选中数据与已有数据不同集合
  413. // 查询条件
  414. queryParam: {
  415. orderNumber: '', // 订单号
  416. account: '', //账套
  417. pageSize:100,
  418. preDeliveryDateS:'', //预发货开始日期
  419. preDeliveryDateE:'', //预发货结束日期
  420. flourOrGarment:'', //类型
  421. // pageNo: '', // 初始页
  422. // pageSize: '-1' // 每页显示条数
  423. },
  424. // 分页
  425. pagination: {},
  426. confimList: [], //勾选的订单数组
  427. propList: [], //需要给新增页的数据
  428. dateRange:[],
  429. range:[],//预发货日期数组
  430. dataRangeMode:['date','date'],
  431. rangeMode:['date','date'],
  432. }
  433. },
  434. // 接收父组件 方法
  435. // props: {},
  436. created() {
  437. // this.getOrderList()
  438. // this.defalutDate()
  439. },
  440. methods: {
  441. moment,
  442. // 参照订单数据 查询
  443. getOrderList() {
  444. this.confirmLoading = true;
  445. // if (this.queryParam.preDeliveryDate != ""){
  446. // this.queryParam.preDeliveryDate = this.queryParam.preDeliveryDate.format('YYYY-MM-DD');
  447. // }
  448. this.$nextTick(() => {
  449. queryOrderData(this.queryParam).then(res => {
  450. this.confirmLoading = false;
  451. if (res.success) {
  452. for (var i=0; i<res.result.records.length;i++){
  453. res.result.records[i].id = randomUUID();
  454. }
  455. this.orderListData = res.result.records
  456. this.pagination = {
  457. total: res.result.total,
  458. current: res.result.current,
  459. pageSize: res.result.size
  460. }
  461. }
  462. })
  463. })
  464. },
  465. // 弹框确定
  466. onSubmit() {
  467. this.dataSet( this.selectedRows)
  468. var vv = this.selectedRows[0]
  469. if(this.fatherData.length !== 0){
  470. this.fatherDataSet(this.fatherData,vv)
  471. }
  472. if (this.selectedRowKeys.length == 0) {
  473. this.$message.error('请勾选订单数据')
  474. } else if(this.selectedRows !== 1 && this.error !==''){
  475. this.$message.error(this.error+'至少一项不相同!');
  476. this.error = ''
  477. }else if(this.fatherData.length !== 0 && this.errorFather !== ''){
  478. this.$message.error(this.errorFather +'至少一项不相同!');
  479. this.errorFather = ''
  480. }else{
  481. confimOrderData(this.confimList).then(res => {
  482. if (res.success) {
  483. this.propList = res.result;
  484. this.$emit('bao', this.propList);
  485. }
  486. })
  487. this.referOrderDataModVis = false;
  488. this.selectedRowKeys = [];
  489. this.selectedRows = [];
  490. this.searchReset();
  491. }
  492. },
  493. //参照数据选择多条时
  494. dataSet(){
  495. this.confimList = []
  496. var orderTest = [],
  497. poTest = [],
  498. preDeliveryTest = [],
  499. preCompletionTest = [],
  500. itemNumberTest = [],
  501. inventoryCodeTest = [],
  502. inventoryNameTest = [],
  503. colourTest = [],
  504. sizeTest = []
  505. this.selectedRows.map(item=>{
  506. this.confimList.push(item.syOrderDataItemId);
  507. orderTest.push(item.orderNumber)
  508. poTest.push(item.smallPo)
  509. preDeliveryTest.push(item.preDeliveryDate)
  510. preCompletionTest.push(item.preCompletionDate)
  511. itemNumberTest.push(item.itemNumber)
  512. inventoryCodeTest.push(item.inventoryCode)
  513. inventoryNameTest.push(item.inventoryName)
  514. colourTest.push(item.colour)
  515. sizeTest.push(item.size)
  516. })
  517. if([...new Set(orderTest)].length == 1 && [...new Set(poTest)].length == 1 &&[...new Set(preDeliveryTest)].length == 1&&
  518. [...new Set(preCompletionTest)].length == 1 && [...new Set(itemNumberTest)].length == 1 &&[...new Set(inventoryCodeTest)].length !== 1&&
  519. [...new Set(inventoryNameTest)].length == 1 && [...new Set(colourTest)].length == 1 &&[...new Set(sizeTest)].length == 1){
  520. this.error = '订单号,小po,预发货日期,预完工日期,款号,存货编码,存货名称,颜色,尺码'
  521. }
  522. // if([...new Set(orderTest)].length !== 1){this.error.push('订单号')}
  523. // if([...new Set(poTest)].length !== 1){this.error.push('小po')}
  524. // if([...new Set(preDeliveryTest)].length !== 1){this.error.push('预发货日期')}
  525. // if([...new Set(preCompletionTest)].length !== 1){this.error.push('预完工日期')}
  526. // if([...new Set(itemNumberTest)].length !== 1){this.error.push('款号')}
  527. // if([...new Set(inventoryCodeTest)].length !== 1){this.error.push('存货编码')}
  528. // if([...new Set(inventoryNameTest)].length !== 1){this.error.push('存货名称')}
  529. // if([...new Set(colourTest)].length !== 1){this.error.push('颜色')}
  530. // if([...new Set(sizeTest)].length !== 1){this.error.push('尺码')}
  531. },
  532. //已有参考列表
  533. fatherDataSet(fathers,sons){
  534. var father = fathers[0]
  535. if(father.orderNumber === sons.orderNumber && father.smallPo === sons.smallPo && father.preDeliveryDate === sons.preDeliveryDate &&
  536. father.preCompletionDate === sons.preCompletionDate && father.itemNumber === sons.itemNumber && father.inventoryCode === sons.inventoryCode &&
  537. father.inventoryName === sons.inventoryName && father.colour === sons.colour && father.size === sons.size) {
  538. this.errorFather = '订单号,小po,预发货日期,预完工日期,款号,存货编码,存货名称,颜色,尺码'
  539. }
  540. // if(father.orderNumber !== sons.orderNumber){this.errorFather.push('订单号')}
  541. // if(father.smallPo !== sons.smallPo){this.errorFather.push('小po')}
  542. // if(father.preDeliveryDate !== sons.preDeliveryDate){this.errorFather.push('预发货日期')}
  543. // if(father.preCompletionDate !== sons.preCompletionDate){this.errorFather.push('预完工日期')}
  544. // if(father.itemNumber !== sons.itemNumber){this.errorFather.push('款号')}
  545. // if(father.inventoryCode !== sons.inventoryCode){this.errorFather.push('存货编码')}
  546. // if(father.inventoryName !== sons.inventoryName){this.errorFather.push('存货名称')}
  547. // if(father.colour !== sons.colour){this.errorFather.push('颜色')}
  548. // if(father.size !== sons.size){this.errorFather.push('尺码')}
  549. },
  550. handleTableChange(pagination, filters, sorter) {
  551. this.queryParam.pageNo = pagination.current;
  552. this.getOrderList();
  553. },
  554. searchQuery() {
  555. if(this.queryParam.flourOrGarment === ''){
  556. this.$message.error('请选择查询类型!');
  557. }else if(this.queryParam.account === ''){
  558. this.$message.error('请选择账套号!');
  559. }else {
  560. this.queryParam.pageNo = '';
  561. this.getOrderList();
  562. }
  563. },
  564. // 重置
  565. searchReset() {
  566. this.queryParam.orderNumber = '';
  567. this.queryParam.account = '';
  568. this.queryParam.salesman = '';
  569. this.queryParam.customerName = '';
  570. this.dateRange = [];
  571. this.range = [];
  572. this.queryParam.flourOrGarment = '';
  573. this.queryParam.preDeliveryDateS = '';
  574. this.queryParam.preDeliveryDateE = '';
  575. this.orderListData = []
  576. this.selectedRowKeys = [];
  577. this.selectedRows = [];
  578. this.$emit('default-reset')
  579. },
  580. // 选中行
  581. onSelectChange(keys, rows) {
  582. this.selectedRowKeys = keys;
  583. this.selectedRows = rows;
  584. },
  585. close() {
  586. this.$emit('close')
  587. this.referOrderDataModVis = false;
  588. this.selectedRowKeys = [];
  589. this.orderListData = [];
  590. this.queryParam = {}
  591. this.searchReset();
  592. },
  593. handleCancel() {
  594. this.close();
  595. },
  596. // 时间发生变化的回调,发生在用户选择时间时
  597. dateRangeSelectChange(value) {
  598. this.dateRange = value;
  599. if (value.length == 0){
  600. this.queryParam.startDeliveryDate = "";
  601. this.queryParam.endDeliveryDate = "";
  602. }else{
  603. this.queryParam.startDeliveryDate = value[0].format('YYYY-MM-DD');
  604. this.queryParam.endDeliveryDate = value[1].format('YYYY-MM-DD');
  605. }
  606. },
  607. rangeSelectChange(value) {
  608. this.range = value
  609. if (value.length == 0){
  610. this.queryParam.preDeliveryDateS = "";
  611. this.queryParam.preDeliveryDateE = "";
  612. }else{
  613. this.queryParam.preDeliveryDateS = value[0].format('YYYY-MM-DD');
  614. this.queryParam.preDeliveryDateE = value[1].format('YYYY-MM-DD');
  615. }
  616. }
  617. },
  618. computed: {
  619. // 选中项
  620. rowSelection() {
  621. return {
  622. onChange: (selectedRowKeys, selectedRows) => {
  623. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  624. },
  625. getCheckboxProps: record => ({
  626. props: {
  627. disabled: record.title === 'Disabled User',
  628. // Column configuration not to be checked
  629. title: record.title
  630. }
  631. })
  632. }
  633. }
  634. }
  635. }
  636. </script>
  637. <style lang="less" scoped>
  638. @import '~@assets/less/common.less';
  639. /deep/ .ant-table-thead > tr > th {
  640. text-align: center;
  641. // font-weight: 700;
  642. }
  643. /deep/ .ant-table-tbody {
  644. text-align: center;
  645. }
  646. // /deep/ th.replacecolor1 {
  647. // display: none;
  648. // }
  649. </style>