clothesAddDrawer.vue 36 KB

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