addAdpackingDrawer.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. <template>
  2. <!-- 新增 预装箱单-成衣-->
  3. <div id="addAdvancePacking">
  4. <a-drawer
  5. title="新增预装箱单-成衣"
  6. width="89%"
  7. placement="right"
  8. :closable="true"
  9. :visible="visible"
  10. @close="handleCancel"
  11. >
  12. <!-- 主表信息 填写 -->
  13. <a-card :bordered="false">
  14. <div class="table-page-search-wrapper">
  15. <!-- :rules="validatorRules" -->
  16. <a-form-model layout="inline" ref="form" :model="addAdpacking">
  17. <a-row :gutter="24">
  18. <a-col :md="6" :sm="8">
  19. <a-form-model-item label="单据号" prop="orderNumber">
  20. <a-input placeholder="自动生成" v-model="addAdpacking.orderNumber" readOnly></a-input>
  21. </a-form-model-item>
  22. </a-col>
  23. <a-col :md="6" :sm="8">
  24. <a-form-model-item label="集装箱代号" prop="containerCode">
  25. <a-input placeholder="请输入集装箱代号" v-model="addAdpacking.containerCode"></a-input>
  26. </a-form-model-item>
  27. </a-col>
  28. <a-col :md="6" :sm="8">
  29. <a-form-model-item label="集装箱号" prop="containerNumber">
  30. <a-input placeholder="请输入集装箱号" v-model="addAdpacking.containerNumber"></a-input>
  31. </a-form-model-item>
  32. </a-col>
  33. <a-col :md="6" :sm="8">
  34. <a-form-model-item label="预发货日期" prop="u8Remarks">
  35. <j-date placeholder="请选择预发货日期" v-model="addAdpacking.preDeliveryDate" style="width:100%"></j-date>
  36. </a-form-model-item>
  37. </a-col>
  38. <a-col :md="6" :sm="8">
  39. <a-form-model-item label="u8备注" prop="u8Remarks">
  40. <a-input placeholder="请输入u8备注" v-model="addAdpacking.u8Remarks"></a-input>
  41. </a-form-model-item>
  42. </a-col>
  43. <a-col :md="6" :sm="8">
  44. <a-form-model-item label="款号" prop="itemNumber">
  45. <a-input placeholder="选择子表自动生成" v-model="addAdpacking.itemNumber"></a-input>
  46. </a-form-model-item>
  47. </a-col>
  48. <a-col :md="6" :sm="8">
  49. <a-form-model-item label="品名" prop="productName">
  50. <a-input placeholder="选择子表自动生成" v-model="addAdpacking.productName"></a-input>
  51. </a-form-model-item>
  52. </a-col>
  53. <a-col :md="6" :sm="8">
  54. <a-form-model-item label="尺码范围" prop="sizeRange">
  55. <a-input placeholder="选择子表自动生成" v-model="addAdpacking.sizeRange"></a-input>
  56. </a-form-model-item>
  57. </a-col>
  58. <a-col :md="6" :sm="8">
  59. <a-form-model-item label="客户" prop="customer">
  60. <a-input placeholder="选择子表自动生成" v-model="addAdpacking.customer"></a-input>
  61. </a-form-model-item>
  62. </a-col>
  63. <a-col :md="6" :sm="8">
  64. <a-form-model-item label="成衣工厂" prop="garmentFactory">
  65. <a-input placeholder="选择子表自动生成" v-model="addAdpacking.garmentFactory"></a-input>
  66. </a-form-model-item>
  67. </a-col>
  68. <a-col :md="6" :sm="8">
  69. <a-form-model-item label="总箱数" prop="totalBoxes">
  70. <a-input placeholder="自动生成" v-model="addAdpacking.totalBoxes" readOnly></a-input>
  71. </a-form-model-item>
  72. </a-col>
  73. <a-col :md="6" :sm="8">
  74. <a-form-model-item label="总净重" prop="totalNetWeight">
  75. <a-input placeholder="自动生成" v-model="addAdpacking.totalNetWeight" readOnly></a-input>
  76. </a-form-model-item>
  77. </a-col>
  78. <a-col :md="6" :sm="8">
  79. <a-form-model-item label="总毛重" prop="totalGrossWeight">
  80. <a-input placeholder="自动生成" v-model="addAdpacking.totalGrossWeight" readOnly></a-input>
  81. </a-form-model-item>
  82. </a-col>
  83. <a-col :md="6" :sm="8">
  84. <a-form-model-item label="总体积" prop="totalVolume">
  85. <a-input placeholder="自动生成" v-model="addAdpacking.totalVolume" readOnly></a-input>
  86. </a-form-model-item>
  87. </a-col>
  88. <a-col :md="6" :sm="8">
  89. <a-form-model-item label="总价" prop="totalPrice">
  90. <a-input placeholder="自动生成" v-model="addAdpacking.totalPrice" readOnly></a-input>
  91. </a-form-model-item>
  92. </a-col>
  93. </a-row>
  94. </a-form-model>
  95. </div>
  96. </a-card>
  97. <!-- 参照发运明细 増行-->
  98. <a-card :bordered="false" style="margin:10px 0 60px 0;">
  99. <!-- 子表 ipagination :rules="validatorRules"-->
  100. <a-spin :spinning="confirmLoading">
  101. <a-form-model ref="formRef">
  102. <j-vxe-table
  103. ref="vTable"
  104. toolbar
  105. row-number
  106. row-selection
  107. drag-sort
  108. keep-source
  109. :height="300"
  110. :loading="loading"
  111. :dataSource="addAdpacking.syPreAssembledPackingListItemList"
  112. :columns="columns"
  113. :alwaysEdit=true
  114. :bordered=true
  115. :scroll="{ x: 1500 }"
  116. style="margin-top: 5px;"
  117. :toolbarConfig="toolbarConfig"
  118. @valueChange="handleValueChange"
  119. >
  120. <template v-slot:action="props">
  121. <a @click="copy(props)">复制</a>
  122. <a-divider type="vertical"/>
  123. <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props)">
  124. <a>删除</a>
  125. </a-popconfirm>
  126. </template>
  127. <template v-slot:toolbarSuffix>
  128. <a-button type="primary" @click="referShipmentDetails" icon="ordered-list">参照发运明细</a-button>
  129. </template>
  130. </j-vxe-table>
  131. </a-form-model>
  132. </a-spin>
  133. </a-card>
  134. <!-- 页面底部提交取消 -->
  135. <div
  136. :style="{
  137. position: 'absolute',
  138. right: 0,
  139. bottom: 0,
  140. width: '100%',
  141. borderTop: '1px solid #e9e9e9',
  142. padding: '10px 16px',
  143. background: '#fff',
  144. textAlign: 'right',
  145. zIndex: 1
  146. }"
  147. >
  148. <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
  149. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  150. </a-popconfirm>
  151. <a-button type="primary" @click="saveAdd">
  152. 保存
  153. </a-button>
  154. </div>
  155. </a-drawer>
  156. <!-- 参照发运明细弹框 -->
  157. <referShipmentDetails-modal
  158. ref="referShipmentDetailsModal"
  159. @bao="getSon"
  160. @ok="modalFormOk"
  161. ></referShipmentDetails-modal>
  162. </div>
  163. </template>
  164. <script>
  165. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  166. import JEllipsis from '@/components/jeecg/JEllipsis'
  167. import moment from 'moment'
  168. import ReferShipmentDetailsModal from '@views/advance-packingList/referShipmentDetailsModal.vue'
  169. import { addAdvPac } from '@api/document/advance-packingList.js'
  170. import { queryShippingDetails } from '@api/document/advance-packingList.js'
  171. import { JVXETypes } from '@/components/jeecg/JVxeTable'
  172. import { pushIfNotExist, randomNumber, randomUUID } from '@/utils/util'
  173. import { getDotConfig, getDotValidExpress } from '@/utils/myutil'
  174. export default {
  175. name: 'AddAdvancePacking', // 新增预装箱单
  176. mixins: [JeecgListMixin],
  177. components: { JEllipsis, moment, ReferShipmentDetailsModal }, // 参照发运明细弹框
  178. data() {
  179. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  180. return {
  181. toolbarConfig: {
  182. // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
  183. btn: []
  184. },
  185. // 表头
  186. columns: [
  187. {
  188. title: '账套',
  189. key: 'acSetNo',
  190. width: 120,
  191. fixed: 'left',
  192. type: JVXETypes.normal,
  193. },
  194. {
  195. title: '成衣工厂',
  196. key: 'garmentFactory',
  197. width: 120,
  198. fixed: 'left',
  199. type: JVXETypes.normal,
  200. },
  201. {
  202. title: 'HOD',
  203. key: 'hod',
  204. width: 120,
  205. fixed: 'left',
  206. type: JVXETypes.normal,
  207. },
  208. {
  209. title: 'STYLE NO.',
  210. key: 'styleNo',
  211. width: 120,
  212. type: JVXETypes.normal,
  213. },
  214. {
  215. title: 'PO NO.',
  216. key: 'poNo',
  217. width: 120,
  218. type: JVXETypes.normal,
  219. },
  220. {
  221. title: 'ITEM NO./SKU NO./UPC NO./PACKS CODE',
  222. key: 'itemCode',
  223. width: 340,
  224. type: JVXETypes.normal,
  225. },
  226. {
  227. title: '分销点/DC/LABEL',
  228. key: 'distributionPoint',
  229. width: 180,
  230. type: JVXETypes.normal,
  231. },
  232. {
  233. title: 'PREPACK SKU',
  234. key: 'prepackSku',
  235. width: 140,
  236. type: JVXETypes.normal,
  237. insertAfter:true,
  238. },
  239. {
  240. title: '起始箱号',
  241. key: 'startingBoxNumber',
  242. width: 120,
  243. type: JVXETypes.input ,
  244. validateRules:[{ required: true, message: '${title}不能为空' }],
  245. },
  246. {
  247. title: '结束箱号',
  248. key: 'endCaseNumber',
  249. width: 140,
  250. type: JVXETypes.input ,
  251. validateRules:[{ required: true, message: '${title}不能为空' }],
  252. },
  253. {
  254. title: '颜色(中英文)',
  255. key: 'colour',
  256. width: 140,
  257. type: JVXETypes.input ,
  258. },
  259. {
  260. title: '配码--根据U8订单来显示',
  261. key: 'withCode',
  262. width: 240,
  263. type: JVXETypes.input ,
  264. },
  265. {
  266. title: '件数/箱',
  267. key: 'piecesBox',
  268. width: 90,
  269. type: JVXETypes.normal ,
  270. },
  271. {
  272. title: '箱数',
  273. key: 'boxNumber',
  274. width: 140,
  275. type: JVXETypes.inputNumber ,
  276. validateRules:[{ required: true, message: '${title}不能为空' },
  277. {pattern: /^[1-9]\d*$/, message: '请输入零以上的正整数' }],
  278. },
  279. {
  280. title: '总件数',
  281. key: 'total',
  282. width: 140,
  283. type: JVXETypes.normal,
  284. },
  285. {
  286. title: '净重/箱',
  287. key: 'netWeight',
  288. width: 90,
  289. type: JVXETypes.inputNumber,
  290. validateRules: [{ required: true, message: '${title}不能为空' },
  291. {pattern: /^\d+(\.\d{1,2})?$/, message: '小数点位数不能超过2位' }]
  292. },
  293. {
  294. title: '总净重',
  295. key: 'totalNetWeight',
  296. width: 140,
  297. type: JVXETypes.normal,
  298. },
  299. {
  300. title: '毛重/箱',
  301. key: 'grossWeight',
  302. width: 120,
  303. type: JVXETypes.inputNumber,
  304. validateRules: [{ required: true, message: '${title}不能为空' },
  305. {pattern: /^\d+(\.\d{1,2})?$/, message: '小数点位数不能超过2位' }]
  306. },
  307. {
  308. title: '总毛重',
  309. key: 'totalGrossWeight',
  310. width: 140,
  311. type: JVXETypes.normal,
  312. },
  313. {
  314. title: '外箱长度',
  315. key: 'outerBoxLength',
  316. width: 120,
  317. type: JVXETypes.inputNumber,
  318. validateRules: [{ required: true, message: '${title}不能为空' },
  319. {pattern: /^\d+(\.\d{1})?$/, message: '小数点位数不能超过1位' }]
  320. },
  321. {
  322. title: '外箱宽度',
  323. key: 'outerBoxWidth',
  324. width: 140,
  325. type: JVXETypes.inputNumber,
  326. validateRules: [{ required: true, message: '${title}不能为空' },
  327. {pattern: /^\d+(\.\d{1})?$/, message: '小数点位数不能超过1位' }]
  328. },
  329. {
  330. title: '外箱高度',
  331. key: 'outerBoxHeight',
  332. type: JVXETypes.inputNumber ,
  333. validateRules: [{ required: true, message: '${title}不能为空' },
  334. {pattern: /^\d+(\.\d{1})?$/, message: '小数点位数不能超过1位' }],
  335. width: 140,
  336. },
  337. {
  338. title: '总体积',
  339. key: 'totalVolume',
  340. type: JVXETypes.normal ,
  341. width: 140,
  342. },
  343. {
  344. title: '净净重',
  345. key: 'netWeightToo',
  346. width: 120,
  347. type: JVXETypes.inputNumber,
  348. validateRules: [{ required: true, message: '${title}不能为空' },
  349. {pattern: /^\d+(\.\d{1,2})?$/, message: '小数点位数不能超过2位' }],
  350. },
  351. {
  352. title: '单价',
  353. key: 'unitPrice',
  354. width: 120,
  355. type: JVXETypes.normal,
  356. },
  357. {
  358. title: '总价',
  359. key: 'totalPrice',
  360. width: 120,
  361. type: JVXETypes.normal,
  362. },
  363. {
  364. title: '操作',
  365. key: 'action',
  366. type: JVXETypes.slot,
  367. fixed: 'right',
  368. width: 160,
  369. align: 'center',
  370. slotName: 'action',
  371. }
  372. ],
  373. loading: false, // 表格加载
  374. visible: false,
  375. dateFormat: 'YYYY-MM-DD',
  376. addAdpacking: {
  377. syPreAssembledPackingListItemList:[]
  378. }, //主表信息
  379. confirmLoading: false,
  380. msgFormSon: 'test', // 子组件传来数据的变量
  381. // state: '0', // 单据状态初始未【仅保存】
  382. // pushState: '0' // 推送状态初始未【仅保存】
  383. // 待确定还有哪些必填信息 ----------------------------
  384. // validatorRules: {
  385. // orderNumber: [{ required: true, message: '订单号不能为空', trigger: 'blur' }],
  386. // styleNum: [{ required: true, message: '款号不能为空', trigger: 'blur' }],
  387. // name: [{ required: true, message: '品名不能为空', trigger: 'blur' }]
  388. // },
  389. sizeFields:[], // 尺码字段
  390. dotConfig:{}, // 小数点配置
  391. }
  392. },
  393. // 接收父组件查询方法
  394. props: {
  395. fatherList: {
  396. type: Function,
  397. default: null
  398. }
  399. },
  400. methods: {
  401. getSon(val) {
  402. // console.log('勾选发运明细数据', val)
  403. // for (var i in val) {
  404. // val[i]['orderQuantity'] = val[i].quantity
  405. // val[i]['orderRemainingQuantity'] = val[i].surplusNum
  406. // val[i]['salesUnitPrice'] = val[i].unitPriceIncludingTax
  407. // val[i]['customerOrder'] = val[i].customerOrderNumber
  408. // val[i]['shipmentQuantity'] = val[i].surplusNum //订单剩余数量 赋值给发货数量
  409. // }
  410. this.addAdpacking.syPreAssembledPackingListItemList = [];
  411. this.setHeadCalField();
  412. var selectData = val[0];
  413. queryShippingDetails({id:selectData.id}).then(res => {
  414. if (res.success) {
  415. var newColums = this.columns.filter(item=>{
  416. return item.isSize != true;
  417. });
  418. // 放在前面,有小数位数设置
  419. this.setHeadData(val[0], res.result);
  420. this.sizeFields = [];
  421. var sizeTable = res.result.sizeTables;
  422. if (sizeTable != null){
  423. var i=0;
  424. // 找到插入位置点
  425. for (; i<newColums.length;i++){
  426. if (newColums[i].insertAfter){
  427. break;
  428. }
  429. }
  430. // 插入数据
  431. for (var j=0;j<sizeTable.length;j++){
  432. this.sizeFields.push('size-'+sizeTable[j].size);
  433. var validExpress = getDotValidExpress(this.dotConfig.quantity);
  434. var field = {
  435. title: sizeTable[j].size,
  436. key: 'size-'+sizeTable[j].size,
  437. type: JVXETypes.inputNumber ,
  438. width: 80,
  439. isSize:true,
  440. validateRules: [validExpress]
  441. };
  442. newColums.splice(i+1+j,0,field);
  443. }
  444. }
  445. this.columns = newColums;
  446. var changedData = this.changeData(val[0], res.result);
  447. this.addAdpacking.syPreAssembledPackingListItemList.push(changedData);
  448. }else{
  449. this.$message.success("请求发运明细详情失败");
  450. }
  451. })
  452. },
  453. // 参照发运明细
  454. referShipmentDetails() {
  455. // console.log('打开参照发运明细')
  456. this.$refs.referShipmentDetailsModal.referShipDetModVis = true
  457. },
  458. // 保存
  459. saveAdd() {
  460. var newObj = this.addAdpacking;
  461. if (this.sizeFields.length == 0){
  462. this.$message.error('当前记录没有尺码字段,无法保存');
  463. return;
  464. }
  465. if (newObj.totalBoxes == 0){
  466. this.$message.error('总箱数为0,无法保存');
  467. return;
  468. }
  469. var sort = 0;
  470. for (var i=0; i<newObj.syPreAssembledPackingListItemList.length;i++){
  471. var tableRow = newObj.syPreAssembledPackingListItemList[i];
  472. var allSizeSum = this.getAllSizeSum(tableRow);
  473. if (allSizeSum == 0){
  474. this.$message.error('第'+(i+1)+'行所有尺码数量为0,无法保存');
  475. return;
  476. }
  477. if (tableRow.startingBoxNumber == ""){
  478. this.$message.error('第'+(i+1)+'行起始箱号未填,无法保存');
  479. return;
  480. }
  481. if (tableRow.endCaseNumber == ""){
  482. this.$message.error('第'+(i+1)+'行结束箱号未填,无法保存');
  483. return;
  484. }
  485. if (tableRow.boxNumber == "" || tableRow.boxNumber == 0){
  486. this.$message.error('第'+(i+1)+'行箱数,无法保存');
  487. return;
  488. }
  489. if (tableRow.netWeight == null || tableRow.netWeight == "" || tableRow.netWeight == undefined){
  490. this.$message.error('第'+(i+1)+'行净重/箱未填,无法保存');
  491. return;
  492. }
  493. if (tableRow.piecesBox == null || tableRow.piecesBox == "" || tableRow.piecesBox == undefined){
  494. this.$message.error('第'+(i+1)+'行件数/箱未填,无法保存');
  495. return;
  496. }
  497. if (tableRow.grossWeight == null || tableRow.grossWeight == "" || tableRow.grossWeight == undefined){
  498. this.$message.error('第'+(i+1)+'行毛重/箱未填,无法保存');
  499. return;
  500. }
  501. if (tableRow.outerBoxLength == null || tableRow.outerBoxLength == "" || tableRow.outerBoxLength == undefined){
  502. this.$message.error('第'+(i+1)+'行外箱长度未填,无法保存');
  503. return;
  504. }
  505. if (tableRow.outerBoxWidth == null || tableRow.outerBoxWidth == "" || tableRow.outerBoxWidth == undefined){
  506. this.$message.error('第'+(i+1)+'行外箱宽度未填,无法保存');
  507. return;
  508. }
  509. if (tableRow.outerBoxHeight == null || tableRow.outerBoxHeight == "" || tableRow.outerBoxHeight == undefined){
  510. this.$message.error('第'+(i+1)+'行外箱高度未填,无法保存');
  511. return;
  512. }
  513. if (tableRow.netWeightToo == null || tableRow.netWeightToo == "" || tableRow.netWeightToo == undefined){
  514. this.$message.error('第'+(i+1)+'行净净重未填,无法保存');
  515. return;
  516. }
  517. for (var j=0; j<tableRow.sizeTables.length; j++){
  518. var sizeTable = tableRow.sizeTables[j];
  519. var field = 'size-'+sizeTable.size;
  520. tableRow.sizeTables[j].quantity = tableRow[field];
  521. }
  522. tableRow.sort = ++sort;
  523. }
  524. addAdvPac(newObj).then(res => {
  525. if (res.success) {
  526. this.$message.success('新增成功')
  527. this.close()
  528. //清空信息
  529. newObj = {syPreAssembledPackingListItemList:[]};
  530. this.fatherList() // 调用父组件 查询方法
  531. // this.msgFormSon = {} 清空子表信息
  532. }else{
  533. this.$message.error(res.message)
  534. }
  535. })
  536. // const that = this
  537. // // 触发表单验证
  538. // this.$refs.form.validate(valid => {
  539. // if (valid) {
  540. // that.confirmLoading = true
  541. // }
  542. // })
  543. },
  544. // 设置表头信息
  545. setHeadData(referData, mData){
  546. var itemData = {};
  547. if (mData.syPreAssembledPackingListItemList != null && mData.syPreAssembledPackingListItemList.size>0){
  548. itemData = mData.syPreAssembledPackingListItemList[0];
  549. }
  550. // 设置件数小数位数
  551. this.dotConfig = getDotConfig(itemData.masterMetering);
  552. this.addAdpacking.syDeclarationElementsId = mData.syDeclarationElementsId;
  553. this.addAdpacking.itemNumber = referData.itemNumber;
  554. this.addAdpacking.productName = referData.chineseName;
  555. this.addAdpacking.sizeRange = "";
  556. if (mData.sizeTables != null){
  557. if (mData.sizeTables.length == 1){
  558. this.addAdpacking.sizeRange = mData.sizeTables[0].size;
  559. }else if (mData.sizeTables.length>1){
  560. this.addAdpacking.sizeRange = mData.sizeTables[0].size + " ~ " + mData.sizeTables[mData.sizeTables.length-1].size;
  561. }
  562. }
  563. this.addAdpacking.customer = mData.customer;
  564. this.addAdpacking.garmentFactory = mData.garmentFactory;
  565. },
  566. // 发运明细详情成预装箱记录:mData-主表记录,itemData-子表记录
  567. changeData(referData, mData) {
  568. var itemData = {};
  569. if (mData.syPreAssembledPackingListItemList != null && mData.syPreAssembledPackingListItemList.length>0){
  570. itemData = mData.syPreAssembledPackingListItemList[0];
  571. }
  572. var addrow = {
  573. syDeclarationElementsId:itemData.syDeclarationElementsId,
  574. syDeclarationElementsItemId:itemData.syDeclarationElementsItemId,
  575. acSetNo: itemData.acSetNo,
  576. garmentFactory: mData.garmentFactory,
  577. hod: itemData.hod,
  578. styleNo:itemData.styleNo,
  579. poNo:itemData.smallPo,
  580. itemCode:referData.packId,
  581. distributionPoint:referData.distributionPoint,
  582. prepackSku: '',
  583. size:"",
  584. startingBoxNumber: '',
  585. endCaseNumber: '',
  586. colour: itemData.colour,
  587. withCode: itemData.withCode,
  588. piecesBox: 0,
  589. boxNumber: '',
  590. total: '',
  591. netWeight: '',
  592. totalNetWeight: '',
  593. grossWeight: '',
  594. totalGrossWeight: '',
  595. outerBoxLength: '',
  596. outerBoxWidth: '',
  597. outerBoxHeight: '',
  598. totalVolume: '',
  599. netWeightToo: '',
  600. unitPrice: itemData.unitPrice,
  601. totalPrice: '',
  602. smallPo: referData.smallPo,
  603. inventoryName:referData.inventoryName,
  604. spurOrSubOrder:referData.purOrSubOrder,
  605. factoryUnitPrice:referData.factoryUnitPrice,
  606. customerAbbreviation:referData.customerAbbreviation,
  607. sizeTables : itemData.sizeTables,
  608. }
  609. return addrow;
  610. },
  611. // 操作按钮 删除
  612. handleDelete(index) {
  613. var ret = this.addAdpacking.syPreAssembledPackingListItemList.splice(index, 1);
  614. this.setHeadCalField();
  615. return ret;
  616. },
  617. // 复制
  618. copy(record) {
  619. var newRow = JSON.parse(JSON.stringify(record.row));
  620. this.addAdpacking.syPreAssembledPackingListItemList.push(newRow);
  621. this.setHeadCalField();
  622. },
  623. // 抽屉 取消
  624. handleCancel() {
  625. this.close()
  626. },
  627. close() {
  628. this.$emit('close')
  629. this.visible = false;
  630. this.addAdpacking = {syPreAssembledPackingListItemList:[]};
  631. },
  632. aa() {},
  633. modalFormOk() {
  634. this.$refs.referShipmentDetailsModal.referShipmentDetailsModVis = true
  635. },
  636. // 表格字段值变动时触发
  637. handleValueChange(event) {
  638. var allSizeSum = this.getAllSizeSum(event.row);
  639. event.row.piecesBox = allSizeSum.toFixed(this.dotConfig.quantity);
  640. event.row.total = (event.row.piecesBox*event.row.boxNumber).toFixed(this.dotConfig.quantity);
  641. if (event.row.unitPrice != undefined && event.row.unitPrice != ""){
  642. event.row.totalPrice = (event.row.unitPrice*event.row.total).toFixed(this.dotConfig.money);
  643. }
  644. if (event.row.netWeight != "" && event.row.netWeight != undefined){
  645. event.row.totalNetWeight = event.row.netWeight * event.row.boxNumber;
  646. }
  647. if (event.row.grossWeight != "" && event.row.grossWeight != undefined){
  648. event.row.totalGrossWeight = event.row.grossWeight * event.row.boxNumber;
  649. }
  650. if (event.row.outerBoxLength != "" && event.row.outerBoxLength != undefined &&
  651. event.row.outerBoxWidth != "" && event.row.outerBoxWidth != undefined &&
  652. event.row.outerBoxHeight != "" && event.row.outerBoxHeight != undefined){
  653. event.row.totalVolume = (event.row.outerBoxLength * event.row.outerBoxWidth * event.row.outerBoxHeight * event.row.boxNumber).toFixed(this.dotConfig.volume);
  654. }
  655. this.setHeadCalField();
  656. },
  657. // 获取不同尺码数量之和
  658. getAllSizeSum(record){
  659. var ret = 0;
  660. for (var i=0; i<this.sizeFields.length; i++){
  661. if (record[this.sizeFields[i]] != undefined && record[this.sizeFields[i]] != ""){
  662. ret += record[this.sizeFields[i]]*1;
  663. }
  664. }
  665. return ret;
  666. },
  667. // 设置表头计算值,直接设置表头值对象不能刷新,把表头对象换了就可以了
  668. setHeadCalField(){
  669. var headData = JSON.parse(JSON.stringify(this.addAdpacking));
  670. var totalBoxes = 0;
  671. var totalNetWeight = 0;
  672. var totalGrossWeight = 0;
  673. var totalVolume = 0;
  674. var totalPrice = 0;
  675. for (var i=0; i<headData.syPreAssembledPackingListItemList.length; i++){
  676. var rowData = headData.syPreAssembledPackingListItemList[i];
  677. totalBoxes += rowData.boxNumber;
  678. if (rowData.totalNetWeight != undefined && rowData.totalNetWeight != ""){
  679. totalNetWeight += rowData.totalNetWeight*1;
  680. }
  681. if (rowData.totalGrossWeight != undefined && rowData.totalGrossWeight != ""){
  682. totalGrossWeight += rowData.totalGrossWeight*1;
  683. }
  684. if (rowData.totalVolume != undefined && rowData.totalVolume != ""){
  685. totalVolume += rowData.totalVolume*1;
  686. }
  687. if (rowData.totalPrice != undefined && rowData.totalPrice != ""){
  688. totalPrice += rowData.totalPrice*1;
  689. }
  690. }
  691. headData.totalBoxes = totalBoxes;
  692. headData.totalNetWeight = totalNetWeight;
  693. headData.totalGrossWeight = totalGrossWeight;
  694. headData.totalVolume = totalVolume;
  695. headData.totalPrice = totalPrice;
  696. this.addAdpacking = headData;
  697. },
  698. },
  699. computed: {},
  700. mounted() {}
  701. }
  702. </script>
  703. <style lang="less" scoped>
  704. @import '~@assets/less/common.less';
  705. /deep/ .ant-table-thead > tr > th {
  706. text-align: center;
  707. // font-weight: 700;
  708. }
  709. /deep/ .ant-table-tbody {
  710. text-align: center;
  711. }
  712. // /deep/ th.replacecolor {
  713. // background-color: #ccc;
  714. // }
  715. // 抽屉里的card样式
  716. /deep/ .ant-drawer-content {
  717. background-color: #f0f2f5;
  718. }
  719. /deep/ .ant-drawer-body {
  720. padding: 10px;
  721. }
  722. </style>