packingListModalFabrics.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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 ,y:500}"
  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: 'supplier',
  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: 'number',
  170. width: 120,
  171. ellipsis: true,
  172. className: 'replacecolor',
  173. customRender: text => {
  174. return text.toFixed(2)
  175. }
  176. },
  177. ],
  178. packingListData: [],
  179. error:[],
  180. fatherList:[],
  181. errorFather:[],
  182. // orderDataform: this.$form.createForm(this),
  183. confirmLoading: false,
  184. packingListModalFabrics: false,
  185. pagination:{}
  186. }
  187. },
  188. // 接收父组件 方法
  189. props: {
  190. father: {
  191. type: Function,
  192. default: null
  193. }
  194. },
  195. created() {},
  196. methods: {
  197. getPackingList(){
  198. this.$nextTick(() => {
  199. PackingList(this.queryParam).then(res => {
  200. if (res.success) {
  201. this.packingListData = res.result.records
  202. if(res.result.size==-1){
  203. this.pagination = false
  204. } else{
  205. this.pagination = {
  206. total: res.result.total,
  207. current: res.result.current,
  208. pageSize:res.result.size
  209. }
  210. }
  211. }else {
  212. this.$message.error(res.message);
  213. }
  214. })
  215. })
  216. },
  217. // 弹框查询按钮
  218. searchQuery() {
  219. this.toggleSearchStatus = false
  220. this.getPackingList()
  221. this.defulatSelect()
  222. },
  223. // 重置
  224. searchReset() {
  225. this.queryParam = {}
  226. this.queryParam.tailoringOrFabric = '1'
  227. this.getPackingList()
  228. this.defulatSelect()
  229. // this.getShipmentList()
  230. },
  231. // 弹框确定
  232. onSubmit() {
  233. console.log(this.selectedRows)
  234. this.dataSet()
  235. var selectedRow = this.selectedRows[0]
  236. if(this.fatherList.length !== 0){
  237. this.fatherDataSet(this.fatherList,selectedRow)
  238. }
  239. if(this.selectedRows.length === 0){
  240. this.$message.error('请选择数据!');
  241. }
  242. // else if(this.selectedRows.length !==1 && this.error.length !==0){
  243. // this.$message.error('所勾选数据的成衣工厂必须相同!');
  244. // this.error = []
  245. // }else if(this.fatherList.length !== 0 && this.errorFather.length !==0){
  246. // var fatherCc = this.errorFather.toString()
  247. // this.$message.error('所勾选的数据必须与已存在数据成衣工厂必须相同!');
  248. // this.errorFather = []
  249. // }
  250. else{
  251. this.$emit('callback',this.selectedRows,'面辅料')
  252. this.close()
  253. }
  254. },
  255. //勾选两条以上数据进行校验
  256. dataSet(){
  257. var garmentFactoryTest = []
  258. this.selectedRows.map(item=>{
  259. garmentFactoryTest.push(item.garmentFactory)
  260. })
  261. if([...new Set(garmentFactoryTest)].length !== 1){this.error.push('成衣')}
  262. },
  263. //父组件列表有值时,进行判断
  264. fatherDataSet(fathers,sons){
  265. var father = fathers[0]
  266. if(father.garmentFactory !== sons.garmentFactory){this.errorFather.push('成衣工厂')}
  267. },
  268. close() {
  269. this.$emit('close')
  270. this.packingListModalFabrics = false
  271. this.queryParam = {}
  272. this.packingListData =[]
  273. this.defulatSelect()
  274. },
  275. handleCancel() {
  276. this.close()
  277. },
  278. handleTableChange(pagination, filters, sorter) {
  279. this.queryParam.pageNo = pagination.current
  280. this.getPackingList()
  281. },
  282. // 选中行
  283. onSelectChange(keys, rows) {
  284. this.selectedRowKeys = keys
  285. this.selectedRows = rows
  286. this.selectedNumber = rows.length
  287. },
  288. //选中行恢复默认
  289. defulatSelect(){
  290. this.selectedRowKeys = [];
  291. this.selectedRows = [];
  292. this.selectedNumber = 0
  293. },
  294. },
  295. computed: {
  296. // 选中项
  297. rowSelection() {
  298. return {
  299. onChange: (selectedRowKeys, selectedRows) => {
  300. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  301. },
  302. getCheckboxProps: record => ({
  303. props: {
  304. disabled: record.title === 'Disabled User',
  305. // Column configuration not to be checked
  306. title: record.title
  307. }
  308. })
  309. }
  310. }
  311. }
  312. }
  313. </script>
  314. <style lang="less" scoped>
  315. @import '~@assets/less/common.less';
  316. @import '~@assets/less/overwriter.less';
  317. /deep/ .ant-table-thead > tr > th {
  318. text-align: center;
  319. // font-weight: 700;
  320. }
  321. /deep/ .ant-table-tbody {
  322. text-align: center;
  323. }
  324. // /deep/ th.replacecolor {
  325. // background-color: #ccc;
  326. // }
  327. </style>