advancePackingListModal.vue 12 KB

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