packingListModalFabrics.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <a-modal
  3. title="参照装箱单"
  4. v-model="packingListModalFabrics"
  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.orderNumber"></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.exportInvoiceNo"></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.containerNumber"></a-input>
  30. </a-form-item>
  31. </a-col>
  32. <template v-if="toggleSearchStatus">
  33. <a-col :md="6" :sm="8">
  34. <a-form-model-item label="类型">
  35. <a-select v-model="queryParam.type">
  36. <a-select-option value="">请选择</a-select-option>
  37. <a-select-option value="面料">辅料</a-select-option>
  38. <a-select-option value="面料">面料</a-select-option>
  39. </a-select>
  40. </a-form-model-item>
  41. </a-col>
  42. </template>
  43. <a-col :md="6" :sm="8">
  44. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  45. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  46. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  47. <a @click="handleToggleSearch" style="margin-left: 8px">
  48. {{ toggleSearchStatus ? '收起' : '展开' }}
  49. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  50. </a>
  51. </span>
  52. </a-col>
  53. </a-row>
  54. </a-form>
  55. </div>
  56. <!-- table , y: 300 -->
  57. <div class="anotherTable">
  58. <a-table
  59. v-if="packingListData"
  60. :columns="packingListColumns"
  61. :data-source="packingListData"
  62. :loading="loading"
  63. :pagination="pagination"
  64. :row-key="record => record.id"
  65. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  66. @change="handleTableChange"
  67. bordered
  68. :scroll="{ x: 1500 }"
  69. size="small"
  70. >
  71. </a-table>
  72. </div>
  73. </a-spin>
  74. </a-modal>
  75. </template>
  76. <script>
  77. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  78. import JEllipsis from '@/components/jeecg/JEllipsis'
  79. import moment from 'moment'
  80. import {PackingList} from '@api/document/book.js'
  81. export default {
  82. name: 'PackingListModal', // 参照装箱单 弹框
  83. mixins: [JeecgListMixin],
  84. components: { JEllipsis, moment },
  85. data() {
  86. return {
  87. // 查询条件
  88. queryParam: {
  89. pageNo:''
  90. },
  91. packingListModalFabrics:false,
  92. selectedRowKeys: [], // 勾选航
  93. selectedRows:[],
  94. loading: false, // 表格加载
  95. fatherList:[],
  96. // 表头
  97. packingListColumns: [
  98. {
  99. title: '装箱单单据号',
  100. dataIndex: 'itemNdocumentNo;umber',
  101. width: 120,
  102. ellipsis: true,
  103. // fixed: 'left',
  104. className: 'replacecolor'
  105. },
  106. {
  107. title: '装箱单制单人',
  108. dataIndex: 'createBy;',
  109. width: 120,
  110. ellipsis: true,
  111. // fixed: 'left',
  112. className: 'replacecolor'
  113. },
  114. // {
  115. // title: '创建时间',
  116. // dataIndex: 'createTime',
  117. // align: 'center',
  118. // sorter: true,
  119. // customRender: text => {
  120. // return moment(text).format('YYYY-MM-DD')
  121. // }
  122. // },
  123. {
  124. title: '外销发票号',
  125. dataIndex: 'exportInvoiceNo;',
  126. width: 120,
  127. ellipsis: true,
  128. className: 'replacecolor'
  129. },
  130. {
  131. title: '集装箱号',
  132. dataIndex: 'containerNumber;',
  133. width: 120,
  134. ellipsis: true,
  135. className: 'replacecolor'
  136. },
  137. {
  138. title: '成衣工厂',
  139. dataIndex: 'garmentFactory;',
  140. width: 120,
  141. ellipsis: true,
  142. className: 'replacecolor'
  143. },
  144. {
  145. title: '供应商',
  146. dataIndex: 'supplierPrintingPlant;',
  147. width: 120,
  148. ellipsis: true,
  149. className: 'replacecolor'
  150. },
  151. {
  152. title: '铅分号',
  153. dataIndex: 'plumbumNo;',
  154. width: 120,
  155. ellipsis: true,
  156. className: 'replacecolor'
  157. },
  158. {
  159. title: '总毛重',
  160. dataIndex: 'grossWeight',
  161. width: 120,
  162. ellipsis: true,
  163. className: 'replacecolor'
  164. },
  165. {
  166. title: '总件数',
  167. dataIndex: 'total;',
  168. width: 120,
  169. ellipsis: true,
  170. className: 'replacecolor'
  171. },
  172. ],
  173. packingListData: [],
  174. error:[],
  175. fatherList:[],
  176. errorFather:[],
  177. // orderDataform: this.$form.createForm(this),
  178. confirmLoading: false,
  179. packingListModalFabrics: false,
  180. pagination:{}
  181. }
  182. },
  183. // 接收父组件 方法
  184. props: {
  185. father: {
  186. type: Function,
  187. default: null
  188. }
  189. },
  190. created() {},
  191. methods: {
  192. getPackingList(){
  193. this.$nextTick(() => {
  194. PackingList(this.queryParam).then(res => {
  195. if (res.success) {
  196. this.packingListData = res.result.records
  197. this.pagination = {
  198. total: res.result.total,
  199. current: res.result.current,
  200. pageSize: res.result.size
  201. }
  202. }else {
  203. this.$message.error(res.message);
  204. }
  205. })
  206. })
  207. },
  208. // 弹框查询按钮
  209. searchQuery() {
  210. this.getPackingList
  211. },
  212. // 重置
  213. searchReset() {
  214. this.queryParam = {}
  215. this.queryParam.tailoringOrFabric = '0'
  216. this.getPackingList()
  217. // this.getShipmentList()
  218. },
  219. // 弹框确定
  220. onSubmit() {
  221. console.log(this.selectedRows)
  222. this.dataSet()
  223. var selectedRow = this.selectedRows[0]
  224. if(this.fatherList.length !== 0){
  225. this.fatherDataSet(this.fatherList,selectedRow)
  226. }
  227. if(this.selectedRows.length === 0){
  228. this.$message.error('请选择数据!');
  229. }else if(this.selectedRows.length !==1 && this.error.length !==0){
  230. this.$message.error('所勾选数据的成衣工厂必须相同!');
  231. this.error = []
  232. }else if(this.fatherList.length !== 0 && this.errorFather.length !==0){
  233. var fatherCc = this.errorFather.toString()
  234. this.$message.error('所勾选的数据必须与已存在数据成衣工厂必须相同!');
  235. this.errorFather = []
  236. }else{
  237. this.$emit('callback',this.selectedRows)
  238. this.close()
  239. }
  240. },
  241. //勾选两条以上数据进行校验
  242. dataSet(){
  243. var garmentFactoryTest = []
  244. this.selectedRows.map(item=>{
  245. garmentFactoryTest.push(item.garmentFactory)
  246. })
  247. if([...new Set(distributionPointTest)].length !== 1){this.error.push('成衣')}
  248. },
  249. //父组件列表有值时,进行判断
  250. fatherDataSet(fathers,sons){
  251. var father = fathers[0]
  252. if(father.garmentFactory !== sons.garmentFactory){this.errorFather.push('成衣工厂')}
  253. },
  254. close() {
  255. this.$emit('close')
  256. this.packingListModalFabrics = false
  257. this.queryParam = {}
  258. this.packingListData =[]
  259. this.selectedRowKeys = []
  260. this.selectedRows = []
  261. },
  262. handleCancel() {
  263. this.close()
  264. },
  265. handleTableChange(pagination, filters, sorter) {
  266. this.queryParam.pageNo = pagination.current
  267. this.getPackingList()
  268. },
  269. // 选中行
  270. onSelectChange(keys, rows) {
  271. this.selectedRowKeys = keys
  272. this.selectedRows = rows
  273. }
  274. },
  275. computed: {
  276. // 选中项
  277. rowSelection() {
  278. return {
  279. onChange: (selectedRowKeys, selectedRows) => {
  280. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  281. },
  282. getCheckboxProps: record => ({
  283. props: {
  284. disabled: record.title === 'Disabled User',
  285. // Column configuration not to be checked
  286. title: record.title
  287. }
  288. })
  289. }
  290. }
  291. }
  292. }
  293. </script>
  294. <style lang="less" scoped>
  295. @import '~@assets/less/common.less';
  296. @import '~@assets/less/overwriter.less';
  297. /deep/ .ant-table-thead > tr > th {
  298. text-align: center;
  299. // font-weight: 700;
  300. }
  301. /deep/ .ant-table-tbody {
  302. text-align: center;
  303. }
  304. // /deep/ th.replacecolor {
  305. // background-color: #ccc;
  306. // }
  307. </style>