clothesAddDrawer.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. <template>
  2. <!-- 新增成衣 -->
  3. <div id="clothesAddDrawer">
  4. <a-drawer
  5. title="新增成衣"
  6. width="89%"
  7. placement="right"
  8. :closable="true"
  9. :visible="visible"
  10. @close="handleCancel">
  11. <!-- 主表信息 填写-->
  12. <a-card :bordered="true">
  13. <div class="table-page-search-wrapper">
  14. <a-form-model layout="inline" ref="formModel" :model="clothesAdd" :rules="validatorRules">
  15. <a-row :gutter="24">
  16. <a-col :md="6" :sm="8">
  17. <a-form-model-item label="订单号" prop="orderNum">
  18. <a-input placeholder="请输入订单号" v-model="clothesAdd.orderNum"></a-input>
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :md="6" :sm="8">
  22. <a-form-model-item label="款号" prop="styleNum">
  23. <a-input placeholder="请输入款号" v-model="clothesAdd.styleNum"></a-input>
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :md="6" :sm="8">
  27. <a-form-model-item label="品名" prop="name">
  28. <a-input placeholder="请输入品名" v-model="clothesAdd.name"></a-input>
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :md="6" :sm="8">
  32. <a-form-model-item label="尺码范围" prop="sizeRange">
  33. <a-input placeholder="请输入尺码范围" v-model="clothesAdd.sizeRange"></a-input>
  34. <!-- <a-select placeholder="请选择尺码范围">
  35. <a-select-option value="">请选择</a-select-option>
  36. <a-select-option value="0">客户1</a-select-option>
  37. <a-select-option value="1">客户2</a-select-option>
  38. <a-select-option value="2">客户3</a-select-option>
  39. </a-select> -->
  40. </a-form-model-item>
  41. </a-col>
  42. <a-col :md="6" :sm="8">
  43. <a-form-model-item label="客户" prop="customer">
  44. <a-input placeholder="请输入客户" v-model="clothesAdd.customer"></a-input>
  45. </a-form-model-item>
  46. </a-col>
  47. <a-col :md="6" :sm="8">
  48. <a-form-model-item label="集装箱代号" prop="containerCode">
  49. <a-input placeholder="请输入集装箱代号" v-model="clothesAdd.containerCode"></a-input>
  50. </a-form-model-item>
  51. </a-col>
  52. <a-col :md="6" :sm="8">
  53. <a-form-model-item label="集装箱号" prop="containerNo">
  54. <a-input placeholder="请输入集装箱号" v-model="clothesAdd.containerNo"></a-input>
  55. </a-form-model-item>
  56. </a-col>
  57. <a-col :md="6" :sm="8">
  58. <a-form-model-item label="备注" prop="note">
  59. <a-input placeholder="请输入备注" v-model="clothesAdd.note"></a-input>
  60. </a-form-model-item>
  61. </a-col>
  62. <!-- <a-col :md="6" :sm="8">
  63. <a-form-model-item label="成衣工厂" prop="clothesFactory">
  64. <a-input placeholder="请输入成衣工厂" v-model="clothesAdd.clothesFactory"></a-input>
  65. </a-form-model-item>
  66. </a-col> -->
  67. <a-col :md="6" :sm="8">
  68. <a-form-model-item label="外销发票号" prop="exportInvoiceNo">
  69. <a-input placeholder="请输入外销发票号" v-model="clothesAdd.exportInvoiceNo"></a-input>
  70. </a-form-model-item>
  71. </a-col>
  72. <a-col :md="6" :sm="8">
  73. <a-form-model-item label="托书号" prop="bookNum">
  74. <a-input placeholder="请输入托书号" v-model="clothesAdd.bookNum"></a-input>
  75. </a-form-model-item>
  76. </a-col>
  77. </a-row>
  78. </a-form-model>
  79. </div>
  80. </a-card>
  81. <!--操作按钮区域 参照预装箱单 増行-->
  82. <a-card :bordered="true" style="margin:10px 0 60px 0;">
  83. <!-- <div class="table-operator">
  84. <a-button type="primary" @click="referadvancePackingList" icon="ordered-list">参照预装箱单</a-button>
  85. <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button>
  86. </div> -->
  87. <!-- 子表 :pagination="ipagination" -->
  88. <a-spin :spinning="confirmLoading">
  89. <a-form-model ref="formRef">
  90. <j-vxe-table
  91. ref="vTable"
  92. toolbar
  93. row-number
  94. row-selection
  95. drag-sort
  96. keep-source
  97. :height="300"
  98. :loading="loading"
  99. :dataSource="clothesAddData"
  100. :columns="clothesAddColumns"
  101. :alwaysEdit=true
  102. :bordered=true
  103. :scroll="{ x: 1500 }"
  104. style="margin-top: 5px;"
  105. :toolbarConfig="toolbarConfig"
  106. @valueChange="handleValueChange"
  107. >
  108. <template v-slot:action="props">
  109. <a @click="copy(props)">复制</a>
  110. <a-divider type="vertical"/>
  111. <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props)">
  112. <a>删除</a>
  113. </a-popconfirm>
  114. </template>
  115. <template v-slot:toolbarSuffix>
  116. <a-button type="primary" @click="referadvancePackingList" icon="ordered-list">参照预装箱单</a-button>
  117. </template>
  118. </j-vxe-table>
  119. </a-form-model>
  120. <!-- <a-form-model ref="formRef" :rules="validatorRules">
  121. <a-table
  122. bordered
  123. :row-key="record => record.id"
  124. :columns="clothesAddColumns"
  125. :data-source="clothesAddData"
  126. :loading="loading"
  127. :pagination="pagination"
  128. :scroll="{ x: 1500 }"
  129. @change="handleTableChange"
  130. > -->
  131. <!-- 启始箱号 输入框-->
  132. <!-- <template slot="inceptionBoxNo" slot-scope="text, record, index">
  133. <a-form-model-item prop="inceptionBoxNo" :rules="rules.styleNum" required>
  134. <a-input style="width:100%" type="text" v-model="record.startingBoxNumber" />
  135. </a-form-model-item>
  136. </template> -->
  137. <!-- 结束箱号 输入框-->
  138. <!-- <template slot="endBoxNo" slot-scope="text, record, index">
  139. <a-form-model-item prop="endBoxNo" :rules="rules.styleNum" required>
  140. <a-input style="width:100%" type="text" v-model="record.endCaseNumber" />
  141. </a-form-model-item>
  142. </template> -->
  143. <!-- 件数/箱 输入框-->
  144. <!-- <template slot="packagesBox" slot-scope="text, record, index">
  145. <a-form-model-item prop="packagesBox" :rules="rules.styleNum" required>
  146. <a-input style="width:100%" type="text" v-model="record.piecesBox" />
  147. </a-form-model-item>
  148. </template> -->
  149. <!--箱数 输入框-->
  150. <!-- <template slot="boxes" slot-scope="text, record, index">
  151. <a-form-model-item prop="boxes" :rules="rules.styleNum" required>
  152. <a-input style="width:100%" type="text" v-model="record.boxNumber" />
  153. </a-form-model-item>
  154. </template> -->
  155. <!--净重/箱 输入框-->
  156. <!-- <template slot="suttle" slot-scope="text, record, index">
  157. <a-form-model-item prop="suttle" :rules="rules.styleNum" required>
  158. <a-input style="width:100%" type="text" v-model="record.netWeight" />
  159. </a-form-model-item>
  160. </template> -->
  161. <!--毛重/箱 输入框-->
  162. <!-- <template slot="roughWeight" slot-scope="text, record, index">
  163. <a-form-model-item prop="roughWeight" :rules="rules.styleNum" required>
  164. <a-input style="width:100%" type="text" v-model="record.grossWeight" />
  165. </a-form-model-item>
  166. </template> -->
  167. <!--外箱长度 输入框-->
  168. <!-- <template slot="boxLength" slot-scope="text, record, index">
  169. <a-form-model-item prop="boxLength" :rules="rules.styleNum" required>
  170. <a-input style="width:100%" type="text" v-model="record.outerBoxLength" />
  171. </a-form-model-item>
  172. </template> -->
  173. <!--外箱宽度 输入框-->
  174. <!-- <template slot="boxWidth" slot-scope="text, record, index">
  175. <a-form-model-item prop="boxWidth" :rules="rules.styleNum" required>
  176. <a-input style="width:100%" type="text" v-model="record.outerBoxWidth" />
  177. </a-form-model-item>
  178. </template> -->
  179. <!--外箱高度 输入框-->
  180. <!-- <template slot="boxHeight" slot-scope="text, record, index">
  181. <a-form-model-item prop="boxHeight" :rules="rules.styleNum" required>
  182. <a-input style="width:100%" type="text" v-model="record.outerBoxHeight" />
  183. </a-form-model-item>
  184. </template> -->
  185. <!-- 操作 -->
  186. <!-- <span slot="operationSlot" slot-scope="text, record">
  187. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
  188. <a href="javascript:void(0);" style="color:red;">删除</a>
  189. </a-popconfirm>
  190. <a-divider type="vertical" />
  191. <a @click="copy(record)">复制</a>
  192. </span>
  193. </a-table>
  194. </a-form-model> -->
  195. </a-spin>
  196. </a-card>
  197. <!-- 页面底部提交取消 -->
  198. <div
  199. :style="{
  200. position: 'absolute',
  201. right: 0,
  202. bottom: 0,
  203. width: '100%',
  204. borderTop: '1px solid #e9e9e9',
  205. padding: '10px 16px',
  206. background: '#fff',
  207. textAlign: 'right',
  208. zIndex: 1
  209. }"
  210. >
  211. <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
  212. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  213. </a-popconfirm>
  214. <a-button type="primary" @click="submitAdd">
  215. 保存
  216. </a-button>
  217. </div>
  218. </a-drawer>
  219. <!-- 参照预装箱单 -->
  220. <reference-pre-packlist ref="ReferencePrePacklist" @callback='referCallback' :father="aa" @ok="modalFormOk"></reference-pre-packlist>
  221. </div>
  222. </template>
  223. <script>
  224. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  225. import { JVXETypes } from '@/components/jeecg/JVxeTable'
  226. import JEllipsis from '@/components/jeecg/JEllipsis'
  227. import ReferencePrePacklist from '@views/packing-list/packinglist-clothes/referencePrePacklist'
  228. import { orderSpltListId,addSpltList,editSpltList } from '@api/document/packing-list/packinglist-clothes.js'
  229. export default {
  230. name: 'ClothesAddDrawer', // 新增-装箱单 -成衣
  231. mixins: [JeecgListMixin],
  232. computed: {},
  233. components: { ReferencePrePacklist, JEllipsis }, // 参照预装箱单 弹框
  234. data() {
  235. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  236. return {
  237. toolbarConfig: {
  238. // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
  239. btn: []
  240. },
  241. // 表头
  242. clothesAddColumns: [
  243. {
  244. title: '账套',
  245. key: 'acSetNo',
  246. width: 160,
  247. fixed: 'left',
  248. type: JVXETypes.normal,
  249. },
  250. {
  251. title: '成衣工厂',
  252. key: 'garmentFactory',
  253. width: 120,
  254. fixed: 'left',
  255. type: JVXETypes.normal,
  256. },
  257. {
  258. title: 'HOD',
  259. key: 'hod',
  260. width: 120,
  261. type: JVXETypes.normal,
  262. },
  263. {
  264. title: 'STYLE NO.',
  265. key: 'styleNo',
  266. width: 120,
  267. type: JVXETypes.normal,
  268. },
  269. {
  270. title: 'PO NO.',
  271. key: 'poNo',
  272. width: 90,
  273. type: JVXETypes.normal,
  274. },
  275. {
  276. title: 'ITEM NO./SKU NO./UPC NO./PACKS CODE',
  277. key: 'itemCode',
  278. width: 340,
  279. type: JVXETypes.normal,
  280. },
  281. {
  282. title: '分销点/DC/LABEL',
  283. key: 'distributionPoint',
  284. width: 200,
  285. type: JVXETypes.normal,
  286. insertAfter:true,
  287. },
  288. {
  289. title: '启始箱号',
  290. key: 'startingBoxNumber',
  291. type: JVXETypes.inputNumber ,
  292. width: 120,
  293. },
  294. {
  295. title: '结束箱号',
  296. key: 'endCaseNumber',
  297. width: 120,
  298. type: JVXETypes.inputNumber
  299. },
  300. {
  301. title: '颜色(中英文)',
  302. key: 'colour',
  303. width: 140,
  304. type: JVXETypes.input,
  305. },
  306. {
  307. title: '配码',
  308. key: 'withCode',
  309. width: 120,
  310. type: JVXETypes.normal,
  311. },
  312. {
  313. title: '件数/箱',
  314. key: 'piecesBox',
  315. width: 120,
  316. type: JVXETypes.normal
  317. },
  318. {
  319. title: '箱数',
  320. key: 'boxNumber',
  321. width: 120,
  322. type: JVXETypes.normal
  323. },
  324. {
  325. title: '计划尺码数量',
  326. key: 'planSize',
  327. width: 240,
  328. type: JVXETypes.normal ,
  329. },
  330. {
  331. title: '计划装箱数量',
  332. key: 'planQuantity',
  333. width: 240,
  334. type: JVXETypes.normal ,
  335. },
  336. {
  337. title: '总件数',
  338. key: 'total',
  339. width: 90,
  340. type: JVXETypes.normal,
  341. },
  342. {
  343. title: '净重/箱',
  344. key: 'netWeight',
  345. width: 120,
  346. type: JVXETypes.inputNumber
  347. },
  348. {
  349. title: '总净重',
  350. key: 'totalNetWeight',
  351. width: 90,
  352. type: JVXETypes.normal,
  353. },
  354. {
  355. title: '毛重/箱',
  356. key: 'grossWeight',
  357. width: 120,
  358. type: JVXETypes.inputNumber
  359. },
  360. {
  361. title: '总毛重',
  362. key: 'totalGrossWeight',
  363. width: 90,
  364. type: JVXETypes.normal,
  365. },
  366. {
  367. title: '外箱长度',
  368. key: 'outerBoxLength',
  369. width: 120,
  370. type: JVXETypes.inputNumber
  371. },
  372. {
  373. title: '外箱宽度',
  374. key: 'outerBoxWidth',
  375. width: 120,
  376. type: JVXETypes.inputNumber
  377. },
  378. {
  379. title: '外箱高度',
  380. key: 'outerBoxHeight',
  381. width: 120,
  382. type: JVXETypes.inputNumber
  383. },
  384. {
  385. title: '总体积',
  386. key: 'totalVolume',
  387. width: 120,
  388. type: JVXETypes.normal,
  389. },
  390. {
  391. title: '净净重',
  392. key: 'netWeightToo',
  393. width: 120,
  394. type: JVXETypes.normal,
  395. },
  396. {
  397. title: '单价',
  398. key: 'unitPrice',
  399. width: 120,
  400. type: JVXETypes.normal,
  401. },
  402. {
  403. title: '总价',
  404. key: 'totalPrice',
  405. width: 120,
  406. type: JVXETypes.normal,
  407. },
  408. {
  409. title: '备注',
  410. key: 'remarks',
  411. width: 140,
  412. customRender: t => ellipsis(t),
  413. fixed: 'right',
  414. type: JVXETypes.normal,
  415. },
  416. {
  417. title: '操作',
  418. key: 'operation',
  419. type: JVXETypes.slot,
  420. width: 160,
  421. fixed: 'right',
  422. align: 'center',
  423. slotName: 'action',
  424. }
  425. ],
  426. clothesAddData: [],
  427. loading: false, // 表格加载
  428. clothesAdd: {},
  429. pagination: {
  430. // total: '',
  431. // current: 0,
  432. // pageSize: 0
  433. },
  434. editDecide:'add',
  435. visible: false,
  436. sizeFields:[], // 尺码字段
  437. confirmLoading: false,
  438. validatorRules: {
  439. orderNum: [{ required: true, message: '订单号不能为空', trigger: 'blur' }],
  440. styleNum: [{ required: true, message: '款号不能为空', trigger: 'blur' }],
  441. name: [{ required: true, message: '品名不能为空', trigger: 'blur' }]
  442. // 待确定还有哪些必填信息
  443. }
  444. // dateFormat: 'YYYY-MM-DD'
  445. }
  446. },
  447. // 接收父组件查询方法
  448. props: {
  449. fatherList: {
  450. type: Function,
  451. default: null
  452. }
  453. },
  454. created() {},
  455. mounted() {},
  456. methods: {
  457. // 参照回调
  458. referCallback(idArr){
  459. this.clothesAdd = {}
  460. this.clothesAddData = []
  461. var preId = idArr[0]
  462. orderSpltListId({id:preId}).then(res => {
  463. var data = res.result
  464. if (res.success) {
  465. this.clothesAdd = {
  466. orderNum: data.orderNumber,
  467. styleNum: data.itemNumber,
  468. name: data.productName,
  469. sizeRange: data.sizeRange,
  470. customer: data.customer,
  471. containerCode: data.containerCode,
  472. containerNo: data.containerNumber,
  473. note: data.u8Remarks,
  474. // clothesFactory: data.garmentFactory,
  475. exportInvoiceNo: data.exportInvoiceNo,
  476. bookNum: data.depositaryReceiptNo
  477. }
  478. this.dynamicColumns(data.sizeTables)
  479. this.clothesAddData = data.syPackingListTailoringItemList
  480. this.clothesAddData.map(item =>{
  481. var str =item.hod
  482. var n=str.split(" ");
  483. item.hod = n[0]
  484. var row = item;
  485. var sizeTables = row.sizeTables;
  486. for (var j=0; j<sizeTables.length;j++){
  487. row['size-'+sizeTables[j].size] = sizeTables[j].proportion;
  488. }
  489. })
  490. }else {
  491. this.$message.error(res.message);
  492. }
  493. })
  494. },
  495. dynamicColumns(sizeTables){
  496. var newColumns = this.clothesAddColumns
  497. this.sizeFields = [];
  498. if (sizeTables != null){
  499. var i = 0
  500. for(;i < newColumns.length ; i++){
  501. if(newColumns[i].insertAfter){
  502. break;
  503. }
  504. }
  505. // 插入数据
  506. for (var j=0;j<sizeTables.length;j++){
  507. this.sizeFields.push('size-'+sizeTables[j].size);
  508. var field = {
  509. title: sizeTables[j].size,
  510. key: 'size-'+sizeTables[j].size,
  511. type: JVXETypes.inputNumber ,
  512. width: 80,
  513. isSize:true,
  514. };
  515. newColumns.splice(i+1+j,0,field);
  516. }
  517. this.clothesAddColumns = newColumns
  518. }
  519. },
  520. // 参照预装箱单
  521. referadvancePackingList() {
  522. console.log('打开参照订单数据')
  523. // 打开订单数据弹框
  524. this.$refs.ReferencePrePacklist.referencePrePacklist = true
  525. this.$refs.ReferencePrePacklist.queryParam = {}
  526. this.$refs.ReferencePrePacklist.searchQuery()
  527. },
  528. // 増行
  529. handleAddColumn() {
  530. console.log('増行')
  531. const addrow = {
  532. accountSet: '',
  533. garmentFactory: '',
  534. hod: '',
  535. styleNo: '',
  536. poNo: '',
  537. itemCode: '',
  538. distributionPoint: '',
  539. s: '',
  540. m: '',
  541. l: '',
  542. xl: '',
  543. xxl: '',
  544. xxxl: '',
  545. startingBoxNumber: '',
  546. endCaseNumber: '',
  547. colour: '',
  548. withCode: '',
  549. piecesBox: '',
  550. boxNumber: '',
  551. total: '',
  552. netWeight: '',
  553. totalNetWeight: '',
  554. grossWeight: '',
  555. totalGrossWeight: '',
  556. outerBoxLength: '',
  557. outerBoxWidth: '',
  558. outerBoxHeight: '',
  559. totalVolume: '',
  560. netWeightToo: '',
  561. unitPrice: '',
  562. totalPrices: '',
  563. remarks: '',
  564. operation: ''
  565. }
  566. this.clothesAddData.push(addrow)
  567. },
  568. // -------------------------------------
  569. // 操作 删除
  570. handleDelete(ind) {
  571. var delectId = ind.rowIndex
  572. this.clothesAddData.splice(delectId, 1);
  573. console.log(this.clothesAddData)
  574. },
  575. handleValueChange(event) {
  576. var dataRow = event.row
  577. console.log(dataRow)
  578. if (dataRow.startingBoxNumber != undefined && dataRow.startingBoxNumber != "" &&
  579. dataRow.endCaseNumber != undefined && dataRow.endCaseNumber != ""){
  580. dataRow.boxNumber = dataRow.endCaseNumber*1-dataRow.startingBoxNumber*1+1;
  581. }
  582. var allSizeSum = this.getAllSizeSum(dataRow);
  583. dataRow.piecesBox = allSizeSum
  584. dataRow.total = dataRow.piecesBox*dataRow.boxNumber
  585. if (dataRow.netWeight != "" && dataRow.netWeight != undefined){
  586. dataRow.totalNetWeight = dataRow.netWeight * dataRow.boxNumber;
  587. }
  588. if (dataRow.grossWeight != "" && dataRow.grossWeight != undefined){
  589. dataRow.totalGrossWeight = dataRow.grossWeight * dataRow.boxNumber;
  590. }
  591. if (dataRow.outerBoxLength != "" && dataRow.outerBoxLength != undefined &&
  592. dataRow.outerBoxWidth != "" && dataRow.outerBoxWidth != undefined &&
  593. dataRow.outerBoxHeight != "" && dataRow.outerBoxHeight != undefined){
  594. dataRow.totalVolume = (dataRow.outerBoxLength * dataRow.outerBoxWidth * dataRow.outerBoxHeight * dataRow.boxNumber).toFixed(3)
  595. console.log(dataRow)
  596. }
  597. if (dataRow.unitPrice != undefined && dataRow.unitPrice != ""){
  598. dataRow.totalPrice = (dataRow.unitPrice*dataRow.total).toFixed(2)
  599. }
  600. },
  601. // 操作按钮 复制
  602. copy(record) {
  603. var newRow = JSON.parse(JSON.stringify(record.row));
  604. newRow.isAdd = 1
  605. this.clothesAddData.push(newRow);
  606. },
  607. // -------------------------------------
  608. // 抽屉 取消
  609. handleCancel() {
  610. console.log('点击抽屉取消')
  611. this.close()
  612. },
  613. // 抽屉 提交
  614. submitAdd() {
  615. const that = this;
  616. // 触发表单验证
  617. that.$refs.formModel.validate(valid => {
  618. if (valid) {
  619. if (this.sizeFields.length == 0){
  620. this.$message.error('当前记录没有尺码字段,无法保存');
  621. return;
  622. }
  623. // that.confirmLoading = true
  624. var newObj = {}
  625. newObj.itemNumber = this.clothesAdd.styleNum
  626. newObj.orderNumber = this.clothesAdd.orderNum
  627. newObj.productName = this.clothesAdd.name
  628. newObj.sizeRange = this.clothesAdd.sizeRange
  629. newObj.customer = this.clothesAdd.customer
  630. newObj.containerCode = this.clothesAdd.containerCode
  631. newObj.containerNumber = this.clothesAdd.containerNo
  632. newObj.u8Remarks = this.clothesAdd.note
  633. // newObj.garmentFactory = this.clothesAdd.clothesFactory
  634. newObj.exportInvoiceNo = this.clothesAdd.exportInvoiceNo
  635. newObj.shippingOrderNumber = this.clothesAdd.bookNum
  636. newObj.id = this.clothesAdd.id
  637. newObj.syPackingListTailoringItemList = this.clothesAddData
  638. var sort = 0;
  639. for (var i=0; i<newObj.syPackingListTailoringItemList.length;i++){
  640. var tableRow = newObj.syPackingListTailoringItemList[i];
  641. var allSizeSum = this.getAllSizeSum(tableRow);
  642. if (allSizeSum == 0){
  643. this.$message.error('第'+(i+1)+'行所有尺码数量为0,无法保存');
  644. return;
  645. }
  646. if(tableRow.startingBoxNumber > tableRow.endCaseNumber) {
  647. this.$message.error('第'+(i+1)+'行起始箱号大于结束箱号,无法保存');
  648. return;
  649. }
  650. if (tableRow.startingBoxNumber == ""){
  651. this.$message.error('第'+(i+1)+'行起始箱号未填,无法保存');
  652. return;
  653. }
  654. if (tableRow.endCaseNumber == ""){
  655. this.$message.error('第'+(i+1)+'行结束箱号未填,无法保存');
  656. return;
  657. }
  658. if (tableRow.boxNumber == "" || tableRow.boxNumber == 0){
  659. this.$message.error('第'+(i+1)+'行箱数,无法保存');
  660. return;
  661. }
  662. if (tableRow.netWeight == null || tableRow.netWeight == "" || tableRow.netWeight == undefined){
  663. this.$message.error('第'+(i+1)+'行净重/箱未填,无法保存');
  664. return;
  665. }
  666. if (tableRow.piecesBox == null || tableRow.piecesBox == "" || tableRow.piecesBox == undefined){
  667. this.$message.error('第'+(i+1)+'行件数/箱未填,无法保存');
  668. return;
  669. }
  670. if (tableRow.grossWeight == null || tableRow.grossWeight == "" || tableRow.grossWeight == undefined){
  671. this.$message.error('第'+(i+1)+'行毛重/箱未填,无法保存');
  672. return;
  673. }
  674. if (tableRow.outerBoxLength == null || tableRow.outerBoxLength == "" || tableRow.outerBoxLength == undefined){
  675. this.$message.error('第'+(i+1)+'行外箱长度未填,无法保存');
  676. return;
  677. }
  678. if (tableRow.outerBoxWidth == null || tableRow.outerBoxWidth == "" || tableRow.outerBoxWidth == undefined){
  679. this.$message.error('第'+(i+1)+'行外箱宽度未填,无法保存');
  680. return;
  681. }
  682. if (tableRow.outerBoxHeight == null || tableRow.outerBoxHeight == "" || tableRow.outerBoxHeight == undefined){
  683. this.$message.error('第'+(i+1)+'行外箱高度未填,无法保存');
  684. return;
  685. }
  686. if (tableRow.netWeightToo == null || tableRow.netWeightToo == "" || tableRow.netWeightToo == undefined){
  687. this.$message.error('第'+(i+1)+'行净净重未填,无法保存');
  688. return;
  689. }
  690. for (var j=0; j<tableRow.sizeTables.length; j++){
  691. var sizeTable = tableRow.sizeTables[j];
  692. var field = 'size-'+sizeTable.size;
  693. tableRow.sizeTables[j].proportion = tableRow[field];
  694. }
  695. tableRow.sort = ++sort;
  696. }
  697. if(this.editDecide === 'edit'){
  698. editSpltList(newObj).then(res => {
  699. if (res.success) {
  700. this.$message.success('编辑成功')
  701. this.close()
  702. //清空信息
  703. newObj = {};
  704. that.fatherList() // 调用父组件 查询方法
  705. }else{
  706. this.$message.error(res.message)
  707. }
  708. })
  709. }else {
  710. addSpltList(newObj).then(res => {
  711. if (res.success) {
  712. this.$message.success('新增成功')
  713. this.close()
  714. //清空信息
  715. newObj = {};
  716. that.fatherList() // 调用父组件 查询方法
  717. }else{
  718. this.$message.error(res.message)
  719. }
  720. })
  721. }
  722. }
  723. })
  724. },
  725. // 获取不同尺码数量之和
  726. getAllSizeSum(record){
  727. var ret = 0;
  728. for (var i=0; i<this.sizeFields.length; i++){
  729. if (record[this.sizeFields[i]] != undefined && record[this.sizeFields[i]] != ""){
  730. ret += record[this.sizeFields[i]]*1;
  731. }
  732. }
  733. return ret;
  734. },
  735. // -------------------------------------
  736. close() {
  737. this.$emit('close')
  738. this.visible = false
  739. this.clothesAdd = {}
  740. this.clothesAddData = []
  741. this.sizeFields = []
  742. this.initializationColumns()
  743. this.editDecide = 'add'
  744. // this.$refs.form.resetFields()
  745. },
  746. //初始化表头
  747. initializationColumns(){
  748. this.clothesAddColumns= [
  749. {
  750. title: '账套',
  751. key: 'acSetNo',
  752. width: 160,
  753. fixed: 'left',
  754. type: JVXETypes.normal,
  755. },
  756. {
  757. title: '成衣工厂',
  758. key: 'garmentFactory',
  759. width: 120,
  760. fixed: 'left',
  761. type: JVXETypes.normal,
  762. },
  763. {
  764. title: 'HOD',
  765. key: 'hod',
  766. width: 120,
  767. type: JVXETypes.normal,
  768. },
  769. {
  770. title: 'STYLE NO.',
  771. key: 'styleNo',
  772. width: 120,
  773. type: JVXETypes.normal,
  774. },
  775. {
  776. title: 'PO NO.',
  777. key: 'poNo',
  778. width: 90,
  779. type: JVXETypes.normal,
  780. },
  781. {
  782. title: 'ITEM NO./SKU NO./UPC NO./PACKS CODE',
  783. key: 'itemCode',
  784. width: 340,
  785. type: JVXETypes.normal,
  786. },
  787. {
  788. title: '分销点/DC/LABEL',
  789. key: 'distributionPoint',
  790. width: 200,
  791. type: JVXETypes.normal,
  792. insertAfter:true,
  793. },
  794. {
  795. title: '启始箱号',
  796. key: 'startingBoxNumber',
  797. type: JVXETypes.inputNumber ,
  798. width: 120,
  799. },
  800. {
  801. title: '结束箱号',
  802. key: 'endCaseNumber',
  803. width: 120,
  804. type: JVXETypes.inputNumber
  805. },
  806. {
  807. title: '颜色(中英文)',
  808. key: 'colour',
  809. width: 140,
  810. type: JVXETypes.input,
  811. },
  812. {
  813. title: '配码',
  814. key: 'withCode',
  815. width: 120,
  816. type: JVXETypes.normal,
  817. },
  818. {
  819. title: '件数/箱',
  820. key: 'piecesBox',
  821. width: 120,
  822. type: JVXETypes.normal
  823. },
  824. {
  825. title: '箱数',
  826. key: 'boxNumber',
  827. width: 120,
  828. type: JVXETypes.normal
  829. },
  830. {
  831. title: '总件数',
  832. key: 'total',
  833. width: 90,
  834. type: JVXETypes.normal,
  835. },
  836. {
  837. title: '净重/箱',
  838. key: 'netWeight',
  839. width: 120,
  840. type: JVXETypes.inputNumber
  841. },
  842. {
  843. title: '总净重',
  844. key: 'totalNetWeight',
  845. width: 90,
  846. type: JVXETypes.normal,
  847. },
  848. {
  849. title: '毛重/箱',
  850. key: 'grossWeight',
  851. width: 120,
  852. type: JVXETypes.inputNumber
  853. },
  854. {
  855. title: '总毛重',
  856. key: 'totalGrossWeight',
  857. width: 90,
  858. type: JVXETypes.normal,
  859. },
  860. {
  861. title: '外箱长度',
  862. key: 'outerBoxLength',
  863. width: 120,
  864. type: JVXETypes.inputNumber
  865. },
  866. {
  867. title: '外箱宽度',
  868. key: 'outerBoxWidth',
  869. width: 120,
  870. type: JVXETypes.inputNumber
  871. },
  872. {
  873. title: '外箱高度',
  874. key: 'outerBoxHeight',
  875. width: 120,
  876. type: JVXETypes.inputNumber
  877. },
  878. {
  879. title: '总体积',
  880. key: 'totalVolume',
  881. width: 120,
  882. type: JVXETypes.normal,
  883. },
  884. {
  885. title: '净净重',
  886. key: 'netWeightToo',
  887. width: 120,
  888. type: JVXETypes.normal,
  889. },
  890. {
  891. title: '单价',
  892. key: 'unitPrice',
  893. width: 120,
  894. type: JVXETypes.normal,
  895. },
  896. {
  897. title: '总价',
  898. key: 'totalPrice',
  899. width: 120,
  900. type: JVXETypes.normal,
  901. },
  902. {
  903. title: '备注',
  904. key: 'remarks',
  905. width: 140,
  906. customRender: t => ellipsis(t),
  907. fixed: 'right',
  908. type: JVXETypes.normal,
  909. },
  910. {
  911. title: '操作',
  912. key: 'operation',
  913. type: JVXETypes.slot,
  914. width: 160,
  915. fixed: 'right',
  916. align: 'center',
  917. slotName: 'action',
  918. }
  919. ]
  920. },
  921. // - father------------------------------------
  922. aa() {},
  923. modalFormOk() {},
  924. // 分页、排序、筛选变化时触发
  925. handleTableChange(pagination, filters, sorter) {
  926. this.queryParam.pageNo = pagination.current
  927. this.getAnnList()
  928. }
  929. }
  930. }
  931. </script>
  932. <style lang="less" scoped>
  933. @import '~@assets/less/common.less';
  934. @import '~@assets/less/overwriter.less';
  935. /deep/ .ant-table-thead > tr > th {
  936. text-align: center;
  937. // font-weight: 700;
  938. }
  939. /deep/ .ant-table-tbody {
  940. text-align: center;
  941. }
  942. // /deep/ th.replacecolor {
  943. // background-color: #ccc;
  944. // }
  945. // 抽屉里的card样式
  946. /deep/ .ant-drawer-content {
  947. background-color: #f0f2f5;
  948. }
  949. /deep/ .ant-drawer-body {
  950. padding: 10px;
  951. }
  952. </style>