advancePackingListModal.vue 12 KB

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