advancePackingListModal.vue 13 KB

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