clothesAddDrawer.vue 32 KB

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