packingListModal.vue 10 KB

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