advancePackingListModal.vue 12 KB

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