packingListModalFabrics.vue 9.4 KB

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