packingListModal.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <template>
  2. <a-modal
  3. title="参照装箱单"
  4. v-model="packingListModVis"
  5. :confirmLoading="confirmLoading"
  6. @ok="onSubmit"
  7. @cancel="handleCancel"
  8. width="86%"
  9. style="top:330px;left:100px;"
  10. >
  11. <!-- tabel 加载 -->
  12. <a-spin :spinning="confirmLoading">
  13. <!-- 查询 -->
  14. <div class="table-page-search-wrapper">
  15. <a-form layout="inline" @keyup.enter.native="searchQuery">
  16. <a-row :gutter="24">
  17. <a-col :md="6" :sm="8">
  18. <a-form-item label="订单号">
  19. <a-input placeholder="请输入订单号" v-model="queryParam.orderNumber"></a-input>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :md="6" :sm="8">
  23. <a-form-item label="品名">
  24. <a-input placeholder="请输入品名" v-model="queryParam.name"></a-input>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :md="6" :sm="8">
  28. <a-form-item label="款号">
  29. <a-input placeholder="请输入款号" v-model="queryParam.itemNumber"></a-input>
  30. </a-form-item>
  31. </a-col>
  32. <template v-if="toggleSearchStatus">
  33. <a-col :md="6" :sm="8">
  34. <a-form-item label="分销点">
  35. <a-input placeholder="请输入分销点" v-model="queryParam.distributionPoint"></a-input>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="8">
  39. <a-form-item label="预发货日期">
  40. <a-date-picker placeholder="请输入预发货日期" style="width:100%;" v-model="queryParam.preDeliveryDate"/>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :md="6" :sm="8">
  44. <a-form-item label="小po">
  45. <a-input placeholder="请输入小po" v-model="queryParam.smallPo"></a-input>
  46. </a-form-item>
  47. </a-col>
  48. <a-col :md="6" :sm="8">
  49. <a-form-item label="供应商">
  50. <a-input placeholder="请输入供应商" v-model="queryParam.supplier"></a-input>
  51. </a-form-item>
  52. </a-col>
  53. <a-col :md="6" :sm="8">
  54. <a-form-item label="预托书号">
  55. <a-input placeholder="请输入预托书号" v-model="queryParam.depositaryReceiptNo"></a-input>
  56. </a-form-item>
  57. </a-col>
  58. </template>
  59. <a-col :md="6" :sm="8">
  60. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  61. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  62. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  63. <a @click="handleToggleSearch" style="margin-left: 8px">
  64. {{ toggleSearchStatus ? '收起' : '展开' }}
  65. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  66. </a>
  67. </span>
  68. </a-col>
  69. </a-row>
  70. </a-form>
  71. </div>
  72. <!-- table , y: 300 -->
  73. <div class="anotherTable">
  74. <a-table
  75. v-if="packingListData"
  76. :columns="packingListColumns"
  77. :data-source="packingListData"
  78. :loading="loading"
  79. :pagination="pagination"
  80. :row-key="record => record.itemId"
  81. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  82. @change="handleTableChange"
  83. bottom='kkk'
  84. bordered
  85. :scroll="{ x: 1500 }"
  86. size="small"
  87. >
  88. </a-table>
  89. <h3>共选择 {{selectedNumber}} 条</h3>
  90. </div>
  91. </a-spin>
  92. </a-modal>
  93. </template>
  94. <script>
  95. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  96. import JEllipsis from '@/components/jeecg/JEllipsis'
  97. import moment from 'moment'
  98. import {PackingList} from '@api/document/book.js'
  99. export default {
  100. name: 'PackingListModal', // 参照装箱单 弹框
  101. mixins: [JeecgListMixin],
  102. components: { JEllipsis, moment },
  103. data() {
  104. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  105. return {
  106. // 查询条件
  107. queryParam: {
  108. pageNo:''
  109. },
  110. selectedRowKeys: [], // 勾选航
  111. selectedNumber:0,//选中条数
  112. loading: false, // 表格加载
  113. // 表头
  114. packingListColumns: [
  115. {
  116. title: '预托书号',
  117. dataIndex: 'depositaryReceiptNo',
  118. width: 120,
  119. ellipsis: true,
  120. // fixed: 'left',
  121. className: 'replacecolor'
  122. },
  123. {
  124. title: '托书号',
  125. dataIndex: 'shippingOrderNumber',
  126. width: 120,
  127. ellipsis: true,
  128. // fixed: 'left',
  129. className: 'replacecolor'
  130. },
  131. {
  132. title: '集装箱代号',
  133. dataIndex: 'containerCode',
  134. ellipsis: true,
  135. width: 120,
  136. className: 'replacecolor'
  137. },
  138. {
  139. title: '集装箱号',
  140. dataIndex: 'containerNumber',
  141. ellipsis: true,
  142. width: 120,
  143. // fixed: 'right',
  144. className: 'replacecolor'
  145. },
  146. {
  147. title: '单据号',
  148. dataIndex: 'documentNo',
  149. ellipsis: true,
  150. width: 120,
  151. className: 'replacecolor'
  152. },
  153. {
  154. title: '订单号',
  155. dataIndex: 'orderNumber',
  156. ellipsis: true,
  157. width: 120,
  158. // fixed: 'left',
  159. className: 'replacecolor'
  160. },
  161. {
  162. title: '款号',
  163. dataIndex: 'itemNumber',
  164. ellipsis: true,
  165. width: 120,
  166. // fixed: 'left',
  167. className: 'replacecolor'
  168. },
  169. {
  170. title: '客户简称',
  171. dataIndex: 'customerAbbreviation',
  172. ellipsis: true,
  173. width: 120,
  174. // fixed: 'left',
  175. className: 'replacecolor'
  176. },
  177. // {
  178. // title: '创建时间',
  179. // dataIndex: 'createTime',
  180. // align: 'center',
  181. // sorter: true,
  182. // customRender: text => {
  183. // return moment(text).format('YYYY-MM-DD')
  184. // }
  185. // },
  186. {
  187. title: '预发货日期',
  188. dataIndex: 'preDeliveryDate',
  189. ellipsis: true,
  190. width: 120,
  191. className: 'replacecolor'
  192. },
  193. {
  194. title: '小PO',
  195. dataIndex: 'smallPo',
  196. ellipsis: true,
  197. width: 120,
  198. className: 'replacecolor'
  199. },
  200. {
  201. title: '分销点',
  202. dataIndex: 'distributionPoint',
  203. ellipsis: true,
  204. width: 120,
  205. className: 'replacecolor'
  206. },
  207. {
  208. title: '数量(按合并规则累计)',
  209. dataIndex: 'number',
  210. ellipsis: true,
  211. width: 180,
  212. className: 'replacecolor'
  213. },
  214. {
  215. title: '箱数',
  216. dataIndex: 'planQuantity',
  217. ellipsis: true,
  218. width: 90,
  219. className: 'replacecolor'
  220. },
  221. {
  222. title: '总净重',
  223. dataIndex: 'netWeight',
  224. ellipsis: true,
  225. width: 120,
  226. className: 'replacecolor'
  227. },
  228. {
  229. title: '总毛重',
  230. dataIndex: 'grossWeight',
  231. ellipsis: true,
  232. width: 120,
  233. className: 'replacecolor'
  234. },
  235. {
  236. title: '总体积',
  237. dataIndex: 'totalVolume',
  238. ellipsis: true,
  239. width: 120,
  240. className: 'replacecolor'
  241. },
  242. // {
  243. // title: '备注',
  244. // dataIndex: 'memo',
  245. // width: 120,
  246. // className: 'replacecolor'
  247. // },
  248. // {
  249. // title: '发货日期',
  250. // dataIndex: 'shipDate',
  251. // width: 120,
  252. // className: 'replacecolor'
  253. // },
  254. // {
  255. // title: '业务员',
  256. // dataIndex: 'salesman',
  257. // width: 120,
  258. // className: 'replacecolor'
  259. // },
  260. // {
  261. // title: '客户',
  262. // dataIndex: 'customer',
  263. // width: 120,
  264. // className: 'replacecolor'
  265. // },
  266. // {
  267. // title: '存货名称',
  268. // dataIndex: 'inventoryName',
  269. // width: 120,
  270. // className: 'replacecolor'
  271. // },
  272. // {
  273. // title: '颜色',
  274. // dataIndex: 'colour',
  275. // width: 120,
  276. // className: 'replacecolor'
  277. // },
  278. {
  279. title: '采购/委外订单号',
  280. dataIndex: 'purOrSubOrder',
  281. ellipsis: true,
  282. width: 140,
  283. className: 'replacecolor'
  284. },
  285. {
  286. title: '成衣工厂',
  287. dataIndex: 'garmentFactory',
  288. width: 140,
  289. ellipsis: true,
  290. className: 'replacecolor'
  291. },
  292. {
  293. title: '外销发票号',
  294. dataIndex: 'exportInvoiceNo',
  295. width: 130,
  296. ellipsis: true,
  297. className: 'replacecolor'
  298. },
  299. // {
  300. // title: '订单类型',
  301. // dataIndex: 'orderType',
  302. // width: 120,
  303. // className: 'replacecolor'
  304. // },
  305. // {
  306. // title: '工厂单价',
  307. // dataIndex: 'factoryUnitPrice',
  308. // width: 120,
  309. // className: 'replacecolor'
  310. // },
  311. // {
  312. // title: '总价',
  313. // dataIndex: 'totalPrices',
  314. // width: 120,
  315. // className: 'replacecolor'
  316. // },
  317. ],
  318. packingListData: [],
  319. selectedRows:[],
  320. error:[],//两条以上数据,不同字段名
  321. // orderDataform: this.$form.createForm(this),
  322. confirmLoading: false,
  323. packingListModVis: false,
  324. fatherList: [],
  325. errorFather:[],
  326. pagination:{}
  327. }
  328. },
  329. // 接收父组件 方法
  330. props: {
  331. father: {
  332. type: Function,
  333. default: null
  334. }
  335. },
  336. created() {},
  337. methods: {
  338. getPackingList(){
  339. this.$nextTick(() => {
  340. PackingList(this.queryParam).then(res => {
  341. if (res.success) {
  342. res.result.records.map(item =>{
  343. var str = item.preDeliveryDate
  344. var n=str.split(" ");
  345. item.preDeliveryDate = n[0]
  346. })
  347. this.packingListData = res.result.records
  348. this.pagination = {
  349. total: res.result.total,
  350. current: res.result.current,
  351. pageSize: res.result.size
  352. }
  353. }else {
  354. this.$message.error(res.message);
  355. }
  356. })
  357. })
  358. },
  359. // 弹框查询按钮
  360. searchQuery() {
  361. this.toggleSearchStatus = false
  362. this.getPackingList()
  363. },
  364. // 重置
  365. searchReset() {
  366. this.queryParam = {}
  367. this.queryParam.tailoringOrFabric = '0'
  368. this.getPackingList()
  369. },
  370. // 弹框确定
  371. onSubmit() {
  372. console.log(this.selectedRows)
  373. this.dataSet()
  374. var selectedRow = this.selectedRows[0]
  375. if(this.fatherList.length !== 0){
  376. this.fatherDataSet(this.fatherList,selectedRow)
  377. }
  378. if(this.selectedRows.length === 0){
  379. this.$message.error('请选择数据!');
  380. }else if(this.selectedRows.length !==1 && this.error.length !==0){
  381. var cc =this.error.toString()
  382. this.$message.error('所勾选数据'+cc+'必须相同!');
  383. this.error = []
  384. }else if(this.fatherList.length !== 0 && this.errorFather.length !==0){
  385. var fatherCc = this.errorFather.toString()
  386. this.$message.error('所勾选数据与已存在数据'+fatherCc+'必须相同!');
  387. this.errorFather = []
  388. }else{
  389. this.$emit('callback',this.selectedRows)
  390. this.close()
  391. }
  392. },
  393. //勾选两条以上数据进行校验
  394. dataSet(){
  395. var distributionPointTest = [],
  396. customerTest = []
  397. this.selectedRows.map(item=>{
  398. distributionPointTest.push(item.distributionPoint)
  399. customerTest.push(item.customer)
  400. })
  401. if([...new Set(distributionPointTest)].length !== 1){this.error.push('分销点')}
  402. if([...new Set(customerTest)].length !== 1){this.error.push('客户')}
  403. },
  404. //父组件列表有值时,进行判断
  405. fatherDataSet(fathers,sons){
  406. var father = fathers[0]
  407. if(father.distributionPoint !== sons.distributionPoint){this.errorFather.push('分销点')}
  408. if(father.customer !== sons.customer){this.errorFather.push('客户')}
  409. },
  410. close() {
  411. this.$emit('close')
  412. this.packingListModVis = false
  413. this.queryParam = {}
  414. this.packingListData =[]
  415. this.selectedRowKeys = []
  416. this.selectedRows = []
  417. },
  418. handleCancel() {
  419. this.close()
  420. },
  421. handleTableChange(pagination, filters, sorter) {
  422. this.queryParam.pageNo = pagination.current
  423. this.getPackingList()
  424. },
  425. // 选中行
  426. onSelectChange(keys, rows) {
  427. this.selectedRowKeys = keys
  428. this.selectedRows = rows
  429. this.selectedNumber = rows.length
  430. }
  431. },
  432. computed: {
  433. // 选中项
  434. rowSelection() {
  435. return {
  436. onChange: (selectedRowKeys, selectedRows) => {
  437. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  438. },
  439. getCheckboxProps: record => ({
  440. props: {
  441. disabled: record.title === 'Disabled User',
  442. // Column configuration not to be checked
  443. title: record.title
  444. }
  445. })
  446. }
  447. }
  448. }
  449. }
  450. </script>
  451. <style lang="less" scoped>
  452. @import '~@assets/less/common.less';
  453. @import '~@assets/less/overwriter.less';
  454. /deep/ .ant-table-thead > tr > th {
  455. text-align: center;
  456. // font-weight: 700;
  457. }
  458. /deep/ .ant-table-tbody {
  459. text-align: center;
  460. }
  461. // /deep/ th.replacecolor {
  462. // background-color: #ccc;
  463. // }
  464. </style>