advancePackingListModal.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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="ipagination"
  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. }
  258. },
  259. // 接收父组件 方法
  260. props: {
  261. father: {
  262. type: Function,
  263. default: null
  264. }
  265. },
  266. created() {
  267. },
  268. methods: {
  269. // 弹框查询按钮
  270. searchQuery() {
  271. this.$nextTick(() => {
  272. //if (this.queryParam.preDeliveryDate != undefined && this.queryParam.preDeliveryDate != "")
  273. querySyPreAssembledPackingList(this.queryParam).then(res => {
  274. if (res.success) {
  275. this.advancePackingListData = res.result.records;
  276. this.pagination = {
  277. total: res.result.total,
  278. current: res.result.current,
  279. pageSize: res.result.size
  280. }
  281. }
  282. })
  283. })
  284. },
  285. // 重置
  286. searchReset() {
  287. this.queryParam = {
  288. itemNumber:'',
  289. customerAbbreviation:'',
  290. preDeliveryDate:'',
  291. smallPo:'',
  292. distributionPoint:''
  293. }
  294. this.searchQuery()
  295. // this.getShipmentList()
  296. },
  297. // 弹框确定
  298. onSubmit() {
  299. this.dataSet( this.selectedRows)
  300. var selectedRow = this.selectedRows[0]
  301. if(this.fatherData.length !== 0){
  302. this.fatherDataSet(this.fatherData,selectedRow)
  303. }
  304. if (this.selectedRowKeys.length == 0) {
  305. this.$message.error('请选择数据');
  306. } else if(this.selectedRows !== 1 && this.error.length !==0){
  307. var cc =this.error.toString()
  308. this.$message.error(cc+'必须相同!');
  309. } else if(this.fatherData.length !== 0 && this.errorFather.length !==0){
  310. var fatherCc = this.errorFather.toString()
  311. this.$message.error(fatherCc+'必须相同!');
  312. }else{
  313. var filterDataList = this.advancePackingListData.filter(item=>{
  314. return this.selectedRowKeys.filter(key=>{
  315. return item.itemId === key
  316. }).length>0
  317. });
  318. this.$emit('callback', filterDataList);
  319. this.filterDataList = []
  320. this.advancePackingListModVis = false;
  321. this.selectedRowKeys = [];
  322. }
  323. this.error = []
  324. },
  325. //勾选两条以上数据进行校验
  326. dataSet(){
  327. var distributionPointTest = [],
  328. customerTest = []
  329. this.selectedRows.map(item=>{
  330. distributionPointTest.push(item.distributionPoint)
  331. customerTest.push(item.customer)
  332. })
  333. if([...new Set(distributionPointTest)].length !== 1){this.error.push('分销点')}
  334. if([...new Set(customerTest)].length !== 1){this.error.push('客户')}
  335. },
  336. //已有参考列表
  337. fatherDataSet(fathers,sons){
  338. var father = fathers[0]
  339. if(father.distributionPoint !== sons.distributionPoint){this.errorFather.push('分销点')}
  340. if(father.custor !== sons.customer){this.errorFather.push('客户')}
  341. },
  342. close() {
  343. this.$emit('close')
  344. this.advancePackingListModVis = false
  345. },
  346. handleCancel() {
  347. this.selectedRowKeys = [];
  348. this.close()
  349. },
  350. handleTableChange() {},
  351. // 选中行
  352. onSelectChange(keys, rows) {
  353. this.selectedRowKeys = keys;
  354. this.selectedRows = rows
  355. },
  356. deliveryDateChange(value, dateString) {
  357. this.queryParam.preDeliveryDate = dateString
  358. },
  359. },
  360. computed: {
  361. }
  362. }
  363. </script>
  364. <style lang="less" scoped>
  365. @import '~@assets/less/common.less';
  366. @import '~@assets/less/overwriter.less';
  367. /deep/ .ant-table-thead > tr > th {
  368. text-align: center;
  369. // font-weight: 700;
  370. }
  371. /deep/ .ant-table-tbody {
  372. text-align: center;
  373. }
  374. // /deep/ th.replacecolor {
  375. // background-color: #ccc;
  376. // }
  377. </style>