packingListModal.vue 14 KB

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