clothesAddDrawer.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  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. this.sizeFields = []
  462. var preId = idArr[0]
  463. orderSpltListId({id:preId}).then(res => {
  464. var data = res.result
  465. if (res.success) {
  466. this.clothesAdd = {
  467. orderNum: data.orderNumber,
  468. styleNum: data.itemNumber,
  469. name: data.productName,
  470. sizeRange: data.sizeRange,
  471. customer: data.customer,
  472. containerCode: data.containerCode,
  473. containerNo: data.containerNumber,
  474. note: data.u8Remarks,
  475. // clothesFactory: data.garmentFactory,
  476. exportInvoiceNo: data.exportInvoiceNo,
  477. bookNum: data.depositaryReceiptNo
  478. }
  479. this.dynamicColumns(data.sizeTables)
  480. this.clothesAddData = data.syPackingListTailoringItemList
  481. this.clothesAddData.map(item =>{
  482. var str =item.hod
  483. var n=str.split(" ");
  484. item.hod = n[0]
  485. var row = item;
  486. var sizeTables = row.sizeTables;
  487. for (var j=0; j<sizeTables.length;j++){
  488. row['size-'+sizeTables[j].size] = sizeTables[j].proportion;
  489. }
  490. })
  491. }else {
  492. this.$message.error(res.message);
  493. }
  494. })
  495. },
  496. dynamicColumns(sizeTables){
  497. this.initializationColumns()
  498. var newColumns = this.clothesAddColumns
  499. this.sizeFields = [];
  500. if (sizeTables != null){
  501. var i = 0
  502. for(;i < newColumns.length ; i++){
  503. if(newColumns[i].insertAfter){
  504. break;
  505. }
  506. }
  507. // 插入数据
  508. for (var j=0;j<sizeTables.length;j++){
  509. this.sizeFields.push('size-'+sizeTables[j].size);
  510. var field = {
  511. title: sizeTables[j].size,
  512. key: 'size-'+sizeTables[j].size,
  513. type: JVXETypes.inputNumber ,
  514. width: 80,
  515. isSize:true,
  516. };
  517. newColumns.splice(i+1+j,0,field);
  518. }
  519. this.clothesAddColumns = newColumns
  520. }
  521. },
  522. // 参照预装箱单
  523. referadvancePackingList() {
  524. console.log('打开参照订单数据')
  525. // 打开订单数据弹框
  526. this.$refs.ReferencePrePacklist.referencePrePacklist = true
  527. this.$refs.ReferencePrePacklist.queryParam = {}
  528. this.$refs.ReferencePrePacklist.searchQuery()
  529. },
  530. // 増行
  531. handleAddColumn() {
  532. console.log('増行')
  533. const addrow = {
  534. accountSet: '',
  535. garmentFactory: '',
  536. hod: '',
  537. styleNo: '',
  538. poNo: '',
  539. itemCode: '',
  540. distributionPoint: '',
  541. s: '',
  542. m: '',
  543. l: '',
  544. xl: '',
  545. xxl: '',
  546. xxxl: '',
  547. startingBoxNumber: '',
  548. endCaseNumber: '',
  549. colour: '',
  550. withCode: '',
  551. piecesBox: '',
  552. boxNumber: '',
  553. total: '',
  554. netWeight: '',
  555. totalNetWeight: '',
  556. grossWeight: '',
  557. totalGrossWeight: '',
  558. outerBoxLength: '',
  559. outerBoxWidth: '',
  560. outerBoxHeight: '',
  561. totalVolume: '',
  562. netWeightToo: '',
  563. unitPrice: '',
  564. totalPrices: '',
  565. remarks: '',
  566. operation: ''
  567. }
  568. this.clothesAddData.push(addrow)
  569. },
  570. // -------------------------------------
  571. // 操作 删除
  572. handleDelete(ind) {
  573. var delectId = ind.rowIndex
  574. this.clothesAddData.splice(delectId, 1);
  575. console.log(this.clothesAddData)
  576. },
  577. handleValueChange(event) {
  578. var dataRow = event.row
  579. console.log(dataRow)
  580. if (dataRow.startingBoxNumber != undefined && dataRow.startingBoxNumber != "" &&
  581. dataRow.endCaseNumber != undefined && dataRow.endCaseNumber != ""){
  582. dataRow.boxNumber = dataRow.endCaseNumber*1-dataRow.startingBoxNumber*1+1;
  583. }
  584. var allSizeSum = this.getAllSizeSum(dataRow);
  585. dataRow.piecesBox = allSizeSum
  586. dataRow.total = dataRow.piecesBox*dataRow.boxNumber
  587. if (dataRow.netWeight != "" && dataRow.netWeight != undefined){
  588. dataRow.totalNetWeight = dataRow.netWeight * dataRow.boxNumber;
  589. }
  590. if (dataRow.grossWeight != "" && dataRow.grossWeight != undefined){
  591. dataRow.totalGrossWeight = dataRow.grossWeight * dataRow.boxNumber;
  592. }
  593. if (dataRow.outerBoxLength != "" && dataRow.outerBoxLength != undefined &&
  594. dataRow.outerBoxWidth != "" && dataRow.outerBoxWidth != undefined &&
  595. dataRow.outerBoxHeight != "" && dataRow.outerBoxHeight != undefined){
  596. dataRow.totalVolume = (dataRow.outerBoxLength * dataRow.outerBoxWidth * dataRow.outerBoxHeight * dataRow.boxNumber).toFixed(3)
  597. console.log(dataRow)
  598. }
  599. if (dataRow.unitPrice != undefined && dataRow.unitPrice != ""){
  600. dataRow.totalPrice = (dataRow.unitPrice*dataRow.total).toFixed(2)
  601. }
  602. },
  603. // 操作按钮 复制
  604. copy(record) {
  605. var newRow = JSON.parse(JSON.stringify(record.row));
  606. newRow.isAdd = 1
  607. this.clothesAddData.push(newRow);
  608. },
  609. // -------------------------------------
  610. // 抽屉 取消
  611. handleCancel() {
  612. console.log('点击抽屉取消')
  613. this.close()
  614. },
  615. // 抽屉 提交
  616. submitAdd() {
  617. const that = this;
  618. // 触发表单验证
  619. that.$refs.formModel.validate(valid => {
  620. if (valid) {
  621. if (this.sizeFields.length == 0){
  622. this.$message.error('当前记录没有尺码字段,无法保存');
  623. return;
  624. }
  625. // that.confirmLoading = true
  626. var newObj = {}
  627. newObj.itemNumber = this.clothesAdd.styleNum
  628. newObj.orderNumber = this.clothesAdd.orderNum
  629. newObj.productName = this.clothesAdd.name
  630. newObj.sizeRange = this.clothesAdd.sizeRange
  631. newObj.customer = this.clothesAdd.customer
  632. newObj.containerCode = this.clothesAdd.containerCode
  633. newObj.containerNumber = this.clothesAdd.containerNo
  634. newObj.u8Remarks = this.clothesAdd.note
  635. // newObj.garmentFactory = this.clothesAdd.clothesFactory
  636. newObj.exportInvoiceNo = this.clothesAdd.exportInvoiceNo
  637. newObj.shippingOrderNumber = this.clothesAdd.bookNum
  638. newObj.id = this.clothesAdd.id
  639. newObj.syPackingListTailoringItemList = this.clothesAddData
  640. var sort = 0;
  641. for (var i=0; i<newObj.syPackingListTailoringItemList.length;i++){
  642. var tableRow = newObj.syPackingListTailoringItemList[i];
  643. var allSizeSum = this.getAllSizeSum(tableRow);
  644. if (allSizeSum == 0){
  645. this.$message.error('第'+(i+1)+'行所有尺码数量为0,无法保存');
  646. return;
  647. }
  648. if(tableRow.startingBoxNumber > tableRow.endCaseNumber) {
  649. this.$message.error('第'+(i+1)+'行起始箱号大于结束箱号,无法保存');
  650. return;
  651. }
  652. if (tableRow.startingBoxNumber == ""){
  653. this.$message.error('第'+(i+1)+'行起始箱号未填,无法保存');
  654. return;
  655. }
  656. if (tableRow.endCaseNumber == ""){
  657. this.$message.error('第'+(i+1)+'行结束箱号未填,无法保存');
  658. return;
  659. }
  660. if (tableRow.boxNumber == "" || tableRow.boxNumber == 0){
  661. this.$message.error('第'+(i+1)+'行箱数,无法保存');
  662. return;
  663. }
  664. if (tableRow.netWeight == null || tableRow.netWeight == "" || tableRow.netWeight == undefined){
  665. this.$message.error('第'+(i+1)+'行净重/箱未填,无法保存');
  666. return;
  667. }
  668. if (tableRow.piecesBox == null || tableRow.piecesBox == "" || tableRow.piecesBox == undefined){
  669. this.$message.error('第'+(i+1)+'行件数/箱未填,无法保存');
  670. return;
  671. }
  672. if (tableRow.grossWeight == null || tableRow.grossWeight == "" || tableRow.grossWeight == undefined){
  673. this.$message.error('第'+(i+1)+'行毛重/箱未填,无法保存');
  674. return;
  675. }
  676. if (tableRow.outerBoxLength == null || tableRow.outerBoxLength == "" || tableRow.outerBoxLength == undefined){
  677. this.$message.error('第'+(i+1)+'行外箱长度未填,无法保存');
  678. return;
  679. }
  680. if (tableRow.outerBoxWidth == null || tableRow.outerBoxWidth == "" || tableRow.outerBoxWidth == undefined){
  681. this.$message.error('第'+(i+1)+'行外箱宽度未填,无法保存');
  682. return;
  683. }
  684. if (tableRow.outerBoxHeight == null || tableRow.outerBoxHeight == "" || tableRow.outerBoxHeight == undefined){
  685. this.$message.error('第'+(i+1)+'行外箱高度未填,无法保存');
  686. return;
  687. }
  688. if (tableRow.netWeightToo == null || tableRow.netWeightToo == "" || tableRow.netWeightToo == undefined){
  689. this.$message.error('第'+(i+1)+'行净净重未填,无法保存');
  690. return;
  691. }
  692. for (var j=0; j<tableRow.sizeTables.length; j++){
  693. var sizeTable = tableRow.sizeTables[j];
  694. var field = 'size-'+sizeTable.size;
  695. tableRow.sizeTables[j].proportion = tableRow[field];
  696. }
  697. tableRow.sort = ++sort;
  698. }
  699. if(this.editDecide === 'edit'){
  700. editSpltList(newObj).then(res => {
  701. if (res.success) {
  702. this.$message.success('编辑成功')
  703. this.close()
  704. //清空信息
  705. newObj = {};
  706. that.fatherList() // 调用父组件 查询方法
  707. }else{
  708. this.$message.error(res.message)
  709. }
  710. })
  711. }else {
  712. addSpltList(newObj).then(res => {
  713. if (res.success) {
  714. this.$message.success('新增成功')
  715. this.close()
  716. //清空信息
  717. newObj = {};
  718. that.fatherList() // 调用父组件 查询方法
  719. }else{
  720. this.$message.error(res.message)
  721. }
  722. })
  723. }
  724. }
  725. })
  726. },
  727. // 获取不同尺码数量之和
  728. getAllSizeSum(record){
  729. var ret = 0;
  730. for (var i=0; i<this.sizeFields.length; i++){
  731. if (record[this.sizeFields[i]] != undefined && record[this.sizeFields[i]] != ""){
  732. ret += record[this.sizeFields[i]]*1;
  733. }
  734. }
  735. return ret;
  736. },
  737. // -------------------------------------
  738. close() {
  739. this.$emit('close')
  740. this.visible = false
  741. this.clothesAdd = {}
  742. this.clothesAddData = []
  743. this.sizeFields = []
  744. this.initializationColumns()
  745. this.editDecide = 'add'
  746. // this.$refs.form.resetFields()
  747. },
  748. //初始化表头
  749. initializationColumns(){
  750. this.clothesAddColumns= [
  751. {
  752. title: '账套',
  753. key: 'acSetNo',
  754. width: 160,
  755. fixed: 'left',
  756. type: JVXETypes.normal,
  757. },
  758. {
  759. title: '成衣工厂',
  760. key: 'garmentFactory',
  761. width: 120,
  762. fixed: 'left',
  763. type: JVXETypes.normal,
  764. },
  765. {
  766. title: 'HOD',
  767. key: 'hod',
  768. width: 120,
  769. type: JVXETypes.normal,
  770. },
  771. {
  772. title: 'STYLE NO.',
  773. key: 'styleNo',
  774. width: 120,
  775. type: JVXETypes.normal,
  776. },
  777. {
  778. title: 'PO NO.',
  779. key: 'poNo',
  780. width: 90,
  781. type: JVXETypes.normal,
  782. },
  783. {
  784. title: 'ITEM NO./SKU NO./UPC NO./PACKS CODE',
  785. key: 'itemCode',
  786. width: 340,
  787. type: JVXETypes.normal,
  788. },
  789. {
  790. title: '分销点/DC/LABEL',
  791. key: 'distributionPoint',
  792. width: 200,
  793. type: JVXETypes.normal,
  794. insertAfter:true,
  795. },
  796. {
  797. title: '启始箱号',
  798. key: 'startingBoxNumber',
  799. type: JVXETypes.inputNumber ,
  800. width: 120,
  801. },
  802. {
  803. title: '结束箱号',
  804. key: 'endCaseNumber',
  805. width: 120,
  806. type: JVXETypes.inputNumber
  807. },
  808. {
  809. title: '颜色(中英文)',
  810. key: 'colour',
  811. width: 140,
  812. type: JVXETypes.input,
  813. },
  814. {
  815. title: '配码',
  816. key: 'withCode',
  817. width: 120,
  818. type: JVXETypes.normal,
  819. },
  820. {
  821. title: '件数/箱',
  822. key: 'piecesBox',
  823. width: 120,
  824. type: JVXETypes.normal
  825. },
  826. {
  827. title: '箱数',
  828. key: 'boxNumber',
  829. width: 120,
  830. type: JVXETypes.normal
  831. },
  832. {
  833. title: '总件数',
  834. key: 'total',
  835. width: 90,
  836. type: JVXETypes.normal,
  837. },
  838. {
  839. title: '净重/箱',
  840. key: 'netWeight',
  841. width: 120,
  842. type: JVXETypes.inputNumber
  843. },
  844. {
  845. title: '总净重',
  846. key: 'totalNetWeight',
  847. width: 90,
  848. type: JVXETypes.normal,
  849. },
  850. {
  851. title: '毛重/箱',
  852. key: 'grossWeight',
  853. width: 120,
  854. type: JVXETypes.inputNumber
  855. },
  856. {
  857. title: '总毛重',
  858. key: 'totalGrossWeight',
  859. width: 90,
  860. type: JVXETypes.normal,
  861. },
  862. {
  863. title: '外箱长度',
  864. key: 'outerBoxLength',
  865. width: 120,
  866. type: JVXETypes.inputNumber
  867. },
  868. {
  869. title: '外箱宽度',
  870. key: 'outerBoxWidth',
  871. width: 120,
  872. type: JVXETypes.inputNumber
  873. },
  874. {
  875. title: '外箱高度',
  876. key: 'outerBoxHeight',
  877. width: 120,
  878. type: JVXETypes.inputNumber
  879. },
  880. {
  881. title: '总体积',
  882. key: 'totalVolume',
  883. width: 120,
  884. type: JVXETypes.normal,
  885. },
  886. {
  887. title: '净净重',
  888. key: 'netWeightToo',
  889. width: 120,
  890. type: JVXETypes.normal,
  891. },
  892. {
  893. title: '单价',
  894. key: 'unitPrice',
  895. width: 120,
  896. type: JVXETypes.normal,
  897. },
  898. {
  899. title: '总价',
  900. key: 'totalPrice',
  901. width: 120,
  902. type: JVXETypes.normal,
  903. },
  904. {
  905. title: '备注',
  906. key: 'remarks',
  907. width: 140,
  908. customRender: t => ellipsis(t),
  909. fixed: 'right',
  910. type: JVXETypes.normal,
  911. },
  912. {
  913. title: '操作',
  914. key: 'operation',
  915. type: JVXETypes.slot,
  916. width: 160,
  917. fixed: 'right',
  918. align: 'center',
  919. slotName: 'action',
  920. }
  921. ]
  922. },
  923. // - father------------------------------------
  924. aa() {},
  925. modalFormOk() {},
  926. // 分页、排序、筛选变化时触发
  927. handleTableChange(pagination, filters, sorter) {
  928. this.queryParam.pageNo = pagination.current
  929. this.getAnnList()
  930. }
  931. }
  932. }
  933. </script>
  934. <style lang="less" scoped>
  935. @import '~@assets/less/common.less';
  936. @import '~@assets/less/overwriter.less';
  937. /deep/ .ant-table-thead > tr > th {
  938. text-align: center;
  939. // font-weight: 700;
  940. }
  941. /deep/ .ant-table-tbody {
  942. text-align: center;
  943. }
  944. // /deep/ th.replacecolor {
  945. // background-color: #ccc;
  946. // }
  947. // 抽屉里的card样式
  948. /deep/ .ant-drawer-content {
  949. background-color: #f0f2f5;
  950. }
  951. /deep/ .ant-drawer-body {
  952. padding: 10px;
  953. }
  954. </style>