addAdpackingDrawer.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  1. <template>
  2. <!-- 新增 预装箱单-成衣-->
  3. <div id="addAdvancePacking">
  4. <a-drawer
  5. :title="(editDecide == 'add')?'新增预装箱单-成衣':'编辑预装箱单-成衣'"
  6. width="89%"
  7. placement="right"
  8. :closable="true"
  9. :visible="visible"
  10. @close="handleCancel"
  11. >
  12. <!-- 主表信息 填写 -->
  13. <a-card :bordered="true">
  14. <div class="table-page-search-wrapper">
  15. <!-- :rules="validatorRules" -->
  16. <a-form-model layout="inline" ref="form" :model="addAdpacking">
  17. <a-row :gutter="24">
  18. <a-col :md="6" :sm="8">
  19. <a-form-model-item label="单据号" prop="documentNo">
  20. {{addAdpacking.documentNo | ellipsis}}
  21. <!-- <a-input placeholder="自动生成" v-model="addAdpacking.orderNumber" readOnly></a-input> -->
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :md="6" :sm="8">
  25. <a-form-model-item label="订单号" prop="orderNumber">
  26. {{addAdpacking.orderNumber | ellipsis}}
  27. <!-- <a-input placeholder="自动生成" v-model="addAdpacking.orderNumber" readOnly></a-input> -->
  28. </a-form-model-item>
  29. </a-col>
  30. <!-- <a-col :md="6" :sm="8">
  31. <a-form-model-item label="集装箱代号" prop="containerCode">
  32. {{addAdpacking.containerCode | ellipsis}}
  33. </a-form-model-item>
  34. </a-col> -->
  35. <a-col :md="6" :sm="8">
  36. <a-form-model-item label="集装箱号" prop="containerNumber">
  37. {{addAdpacking.containerNumber | ellipsis}}
  38. <!-- <a-input placeholder="请输入集装箱号" v-model="addAdpacking.containerNumber" readOnly></a-input> -->
  39. </a-form-model-item>
  40. </a-col>
  41. <!-- <a-col :md="6" :sm="8">
  42. <a-form-model-item label="预发货日期" prop="u8Remarks">
  43. <j-date placeholder="请选择预发货日期" v-model="addAdpacking.preDeliveryDate" style="width:100%"></j-date>
  44. </a-form-model-item>
  45. </a-col> -->
  46. <a-col :md="6" :sm="8">
  47. <a-form-model-item label="u8备注" prop="u8Remarks">
  48. <a-input placeholder="请输入u8备注" v-model="addAdpacking.u8Remarks"></a-input>
  49. </a-form-model-item>
  50. </a-col>
  51. <a-col :md="6" :sm="8">
  52. <a-form-model-item label="款号" prop="itemNumber">
  53. {{addAdpacking.itemNumber | ellipsis}}
  54. <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.itemNumber"></a-input> -->
  55. </a-form-model-item>
  56. </a-col>
  57. <a-col :md="6" :sm="8">
  58. <a-form-model-item label="中文品名" prop="productName">
  59. {{addAdpacking.productName | ellipsis}}
  60. <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.productName"></a-input> -->
  61. </a-form-model-item>
  62. </a-col>
  63. <a-col :md="6" :sm="8">
  64. <a-form-model-item label="英文品名" prop="productName">
  65. {{addAdpacking.englishProductName | ellipsis}}
  66. <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.englishProductName"></a-input> -->
  67. </a-form-model-item>
  68. </a-col>
  69. <a-col :md="6" :sm="8">
  70. <a-form-model-item label="尺码范围" prop="sizeRange">
  71. {{addAdpacking.sizeRange | ellipsis}}
  72. <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.sizeRange" readOnly></a-input> -->
  73. </a-form-model-item>
  74. </a-col>
  75. <a-col :md="6" :sm="8">
  76. <a-form-model-item label="客户" prop="customer">
  77. {{addAdpacking.customer | ellipsis }}
  78. <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.customer"></a-input> -->
  79. </a-form-model-item>
  80. </a-col>
  81. <!-- <a-col :md="6" :sm="8">
  82. <a-form-model-item label="成衣工厂" prop="garmentFactory">
  83. <a-input placeholder="选择子表自动生成" v-model="addAdpacking.garmentFactory"></a-input>
  84. </a-form-model-item>
  85. </a-col> -->
  86. <a-col :md="6" :sm="8">
  87. <a-form-model-item label="总箱数" prop="totalBoxes">
  88. {{addAdpacking.totalBoxes | ellipsis }}
  89. <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalBoxes" readOnly></a-input> -->
  90. </a-form-model-item>
  91. </a-col>
  92. <a-col :md="6" :sm="8">
  93. <a-form-model-item label="总净重" prop="totalNetWeight">
  94. {{addAdpacking.totalNetWeight | ellipsis}}
  95. <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalNetWeight" readOnly></a-input> -->
  96. </a-form-model-item>
  97. </a-col>
  98. <a-col :md="6" :sm="8">
  99. <a-form-model-item label="总毛重" prop="totalGrossWeight">
  100. {{addAdpacking.totalGrossWeight | ellipsis}}
  101. <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalGrossWeight" readOnly></a-input> -->
  102. </a-form-model-item>
  103. </a-col>
  104. <a-col :md="6" :sm="8">
  105. <a-form-model-item label="总体积" prop="totalVolume">
  106. {{addAdpacking.totalVolume | ellipsis}}
  107. <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalVolume" readOnly></a-input> -->
  108. </a-form-model-item>
  109. </a-col>
  110. <a-col :md="6" :sm="8">
  111. <a-form-model-item label="总价" prop="totalPrice">
  112. {{addAdpacking.totalPrice | ellipsis}}
  113. <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalPrice" readOnly></a-input> -->
  114. </a-form-model-item>
  115. </a-col>
  116. <a-col :md="6" :sm="8">
  117. <a-form-model-item label="总件数" prop="totalNumber">
  118. {{addAdpacking.total | ellipsis}}
  119. <!-- <a-input placeholder="自动生成" v-model="addAdpacking.total" readOnly></a-input> -->
  120. </a-form-model-item>
  121. </a-col>
  122. </a-row>
  123. </a-form-model>
  124. </div>
  125. </a-card>
  126. <!-- 参照发运明细 増行-->
  127. <a-card :bordered="false" style="margin:10px 0 60px 0;">
  128. <div class="table-operator">
  129. <a-button type="primary" @click="referShipmentDetails" icon="ordered-list">参照出运明细</a-button>
  130. </div>
  131. <a-spin :spinning="confirmLoading">
  132. <a-form-model ref="formRef" :rules="validatorRules">
  133. <a-table
  134. bordered
  135. :row-key="record => record.id"
  136. :columns="columns"
  137. :data-source="addAdpacking.syPreAssembledPackingListItemList"
  138. :loading="loading"
  139. :pagination="ipagination"
  140. :scroll="{ x: 1500,y: 350 }"
  141. @change="handleTableChange"
  142. >
  143. <!-- 自定义表头 -->
  144. <span slot="startingBoxNumberTitle" class="form-table-heard">
  145. 起始箱号
  146. </span>
  147. <span slot="endCaseNumberTitle" class="form-table-heard">
  148. 结束箱号
  149. </span>
  150. <span slot="netWeightTitle" class="form-table-heard">
  151. 净重/箱
  152. </span>
  153. <span slot="grossWeightTitle" class="form-table-heard">
  154. 毛重/箱
  155. </span>
  156. <span slot="outerBoxLengthTitle" class="form-table-heard">
  157. 外箱长度
  158. </span>
  159. <span slot="outerBoxWidthTitle" class="form-table-heard">
  160. 外箱宽度
  161. </span>
  162. <span slot="outerBoxHeightTitle" class="form-table-heard">
  163. 外箱高度
  164. </span>
  165. <!-- itemCode -->
  166. <template slot="itemCode" slot-scope="text, record, index">
  167. <a-form-model-item prop="itemCode" :rules="rules.itemCode">
  168. <a-input style="width:100%" type="text" v-model="record.itemCode" />
  169. </a-form-model-item>
  170. </template>
  171. <!-- prepackSku -->
  172. <template slot="prepackSku" slot-scope="text, record, index">
  173. <a-form-model-item prop="prepackSku" :rules="rules.prepackSku">
  174. <a-input style="width:100%" type="text" v-model="record.prepackSku" />
  175. </a-form-model-item>
  176. </template>
  177. <!-- 起始箱号 -->
  178. <template slot="startingBoxNumber" slot-scope="text, record, index">
  179. <a-form-model-item prop="startingBoxNumber" :rules="rules.startingBoxNumber">
  180. <a-input style="width:100%" type="text" v-model="record.startingBoxNumber" @change="handleValueChange(record)"/>
  181. </a-form-model-item>
  182. </template>
  183. <!-- 结束箱号 -->
  184. <template slot="endCaseNumber" slot-scope="text, record, index">
  185. <a-form-model-item prop="endCaseNumber" :rules="rules.endCaseNumber">
  186. <a-input style="width:100%" type="text" v-model="record.endCaseNumber" @change="handleValueChange(record)"/>
  187. </a-form-model-item>
  188. </template>
  189. <!-- 单价 -->
  190. <template slot="unitPrice" slot-scope="text, record, index">
  191. <a-form-model-item prop="unitPrice" :rules="rules.unitPrice">
  192. <a-input style="width:100%" type="text" v-model="record.unitPrice" @change="handleValueChange(record)"/>
  193. </a-form-model-item>
  194. </template>
  195. <!-- 颜色 -->
  196. <template slot="colour" slot-scope="text, record, index">
  197. <a-form-model-item prop="colour" :rules="rules.colour">
  198. <a-input style="width:100%" type="text" v-model="record.colour" />
  199. </a-form-model-item>
  200. </template>
  201. <!-- 净重 -->
  202. <template slot="netWeight" slot-scope="text, record, index">
  203. <a-form-model-item prop="netWeight" :rules="rules.netWeight">
  204. <a-input style="width:100%" type="text" v-model="record.netWeight" @change="handleValueChange(record)"/>
  205. </a-form-model-item>
  206. </template>
  207. <!-- 毛重 -->
  208. <template slot="grossWeight" slot-scope="text, record, index">
  209. <a-form-model-item prop="grossWeight" :rules="rules.grossWeight">
  210. <a-input style="width:100%" type="text" v-model="record.grossWeight" @change="handleValueChange(record)"/>
  211. </a-form-model-item>
  212. </template>
  213. <!-- 外箱长度 -->
  214. <template slot="outerBoxLength" slot-scope="text, record, index">
  215. <a-form-model-item prop="outerBoxLength" :rules="rules.outerBoxLength">
  216. <a-input style="width:100%" type="text" v-model="record.outerBoxLength" @change="handleValueChange(record)"/>
  217. </a-form-model-item>
  218. </template>
  219. <!-- 外箱宽度 -->
  220. <template slot="outerBoxWidth" slot-scope="text, record, index">
  221. <a-form-model-item prop="outerBoxWidth" :rules="rules.outerBoxWidth">
  222. <a-input style="width:100%" type="text" v-model="record.outerBoxWidth" @change="handleValueChange(record)" />
  223. </a-form-model-item>
  224. </template>
  225. <!-- 外箱高度 -->
  226. <template slot="outerBoxHeight" slot-scope="text, record, index">
  227. <a-form-model-item prop="outerBoxHeight" :rules="rules.outerBoxHeight">
  228. <a-input style="width:100%" type="text" v-model="record.outerBoxHeight" @change="handleValueChange(record)" />
  229. </a-form-model-item>
  230. </template>
  231. <!-- 净净重 -->
  232. <template slot="netWeightToo" slot-scope="text, record, index">
  233. <a-form-model-item prop="netWeightToo" :rules="rules.netWeightToo">
  234. <a-input style="width:100%" type="text" v-model="record.netWeightToo" @change="handleValueChange(record)"/>
  235. </a-form-model-item>
  236. </template>
  237. <!-- 尺码字段 -->
  238. <template v-for="i in inputName" :slot="i" slot-scope="text, record, index">
  239. <a-form-model-item prop="i" :rules="rules.i" :key="i">
  240. <a-input style="width:100%" type="text" v-model="record[i]" @change="handleValueChange(record)"/>
  241. </a-form-model-item>
  242. </template>
  243. <!-- 操作 -->
  244. <span slot="action" slot-scope="text, record,index">
  245. <a @click="copy(record)">复制</a>
  246. <a-divider type="vertical"/>
  247. <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props,index)">
  248. <a>删除</a>
  249. </a-popconfirm>
  250. </span>
  251. </a-table>
  252. <!--
  253. 子表 ipagination :rules="validatorRules"
  254. <a-spin :spinning="confirmLoading">
  255. <a-form-model ref="formRef">
  256. <j-vxe-table
  257. ref="vTable"
  258. toolbar
  259. row-number
  260. row-selection
  261. drag-sort
  262. keep-source
  263. :height="350"
  264. :loading="loading"
  265. :dataSource="addAdpacking.syPreAssembledPackingListItemList"
  266. :columns="columns"
  267. :alwaysEdit=true
  268. :bordered=true
  269. :scroll="{ x: 1500 }"
  270. style="margin-top: 5px;"
  271. :toolbarConfig="toolbarConfig"
  272. @valueChange="handleValueChange"
  273. > -->
  274. <!-- 起始箱号 -->
  275. <!-- <template v-slot:startingBoxNumber="record" >
  276. <a-input v-model="record.startingBoxNumber" style="border-color: red;"></a-input>
  277. </template> -->
  278. <!-- 结束箱号 -->
  279. <!-- <template v-slot:endCaseNumber="record" >
  280. <a-input v-model="record.endCaseNumber" style="border-color: red;"></a-input>
  281. </template> -->
  282. <!-- 净重/箱 -->
  283. <!-- <template v-slot:netWeight="record" >
  284. <a-input v-model="record.netWeight" style="border-color: red;"></a-input>
  285. </template> -->
  286. <!-- 毛重/箱 -->
  287. <!-- <template v-slot:grossWeight="record" >
  288. <a-input v-model="record.grossWeight" style="border-color: red;"></a-input>
  289. </template> -->
  290. <!-- 外箱长度 -->
  291. <!-- <template v-slot:outerBoxLength="record" >
  292. <a-input v-model="record.outerBoxLength" style="border-color: red;"></a-input>
  293. </template> -->
  294. <!-- 外箱高度 -->
  295. <!-- <template v-slot:outerBoxHeight="record" >
  296. <a-input v-model="record.outerBoxHeight" style="border-color: red;"></a-input>
  297. </template> -->
  298. <!-- 外箱宽度 -->
  299. <!-- <template v-slot:outerBoxWidth="record" >
  300. <a-input v-model="record.outerBoxWidth" style="border-color: red;"></a-input>
  301. </template>
  302. <template v-slot:action="props">
  303. <a @click="copy(props)">复制</a>
  304. <a-divider type="vertical"/>
  305. <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props)">
  306. <a>删除</a>
  307. </a-popconfirm>
  308. </template>
  309. <template v-slot:toolbarSuffix>
  310. <a-button type="primary" @click="referShipmentDetails" icon="ordered-list">参照出运明细</a-button>
  311. </template>
  312. </j-vxe-table> -->
  313. </a-form-model>
  314. </a-spin>
  315. </a-card>
  316. <!-- 页面底部提交取消 -->
  317. <div
  318. :style="{
  319. position: 'absolute',
  320. right: 0,
  321. bottom: 0,
  322. width: '100%',
  323. borderTop: '1px solid #e9e9e9',
  324. padding: '10px 16px',
  325. background: '#fff',
  326. textAlign: 'right',
  327. zIndex: 999
  328. }"
  329. >
  330. <a-popconfirm title="确定放弃编辑?" @confirm="handleCancel" okText="确定" cancelText="取消">
  331. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  332. </a-popconfirm>
  333. <a-button type="primary" @click="myHandSave" :disabled="btnLoading" >
  334. 保存
  335. </a-button>
  336. <!-- <a-button type="primary" :disabled="btnLoading" @click="myHandSubmit" style="margin-left: 8px">
  337. 保存并提交
  338. </a-button> -->
  339. </div>
  340. </a-drawer>
  341. <!-- 参照发运明细弹框 -->
  342. <referShipmentDetails-modal
  343. ref="referShipmentDetailsModal"
  344. @bao="getSon"
  345. @ok="modalFormOk"
  346. ></referShipmentDetails-modal>
  347. </div>
  348. </template>
  349. <script>
  350. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  351. import JEllipsis from '@/components/jeecg/JEllipsis'
  352. import moment from 'moment'
  353. import ReferShipmentDetailsModal from '@views/advance-packingList/referShipmentDetailsModal.vue'
  354. import { addAdvPac, editById } from '@api/document/advance-packingList.js'
  355. import { queryShippingDetails } from '@api/document/advance-packingList.js'
  356. import { JVXETypes } from '@/components/jeecg/JVxeTable'
  357. import { pushIfNotExist, randomNumber, randomUUID } from '@/utils/util'
  358. import { getDotConfig, getDotValidExpress } from '@/utils/myutil'
  359. export default {
  360. name: 'AddAdvancePacking', // 新增预装箱单
  361. mixins: [JeecgListMixin],
  362. components: { JEllipsis, moment, ReferShipmentDetailsModal }, // 参照发运明细弹框
  363. data() {
  364. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  365. return {
  366. toolbarConfig: {
  367. // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
  368. btn: []
  369. },
  370. btnLoading:false,//按钮等待状态
  371. inputName:[],
  372. // 表头
  373. columns: [
  374. {
  375. title: '账套',
  376. dataIndex: 'acSetNo',
  377. width: 80,
  378. // fixed: 'left',
  379. className: 'replacecolor',
  380. ellipsis: true,
  381. },
  382. {
  383. title: '成衣工厂',
  384. dataIndex: 'garmentFactory',
  385. width: 100,
  386. // fixed: 'left',
  387. className: 'replacecolor',
  388. ellipsis: true,
  389. },
  390. {
  391. title: 'HOD',
  392. dataIndex: 'hod',
  393. width: 110,
  394. // fixed: 'left',
  395. className: 'replacecolor',
  396. customRender: text => {
  397. return moment(text).format('YYYY-MM-DD')
  398. },
  399. ellipsis: true,
  400. },
  401. {
  402. title: 'STYLE NO.',
  403. dataIndex: 'styleNo',
  404. width: 110,
  405. className: 'replacecolor',
  406. ellipsis: true,
  407. },
  408. {
  409. title: 'PO NO.',
  410. dataIndex: 'poNo',
  411. width: 110,
  412. className: 'replacecolor',
  413. ellipsis: true,
  414. },
  415. {
  416. title: 'ITEM NO./SKU NO./UPC NO./PACKS CODE',
  417. dataIndex: 'itemCode',
  418. ellipsis: true,
  419. scopedSlots: { customRender: 'itemCode' },
  420. width: 340,
  421. className: 'replacecolor'
  422. },
  423. {
  424. title: '分销点/DC/LABEL',
  425. dataIndex: 'distributionPoint',
  426. width: 180,
  427. className: 'replacecolor',
  428. ellipsis: true,
  429. },
  430. {
  431. title: 'PREPACK SKU',
  432. dataIndex: 'prepackSku',
  433. width: 140,
  434. className: 'replacecolor',
  435. insertAfter:true,
  436. scopedSlots: { customRender: 'prepackSku' },
  437. },
  438. {
  439. // title: '起始箱号',
  440. dataIndex: 'startingBoxNumber',
  441. width: 120,
  442. className: 'replacecolor',
  443. scopedSlots: { customRender: 'startingBoxNumber' },
  444. slots:{title:'startingBoxNumberTitle'}
  445. },
  446. {
  447. // title: '结束箱号',
  448. dataIndex: 'endCaseNumber',
  449. width: 140,
  450. className: 'replacecolor',
  451. scopedSlots: { customRender: 'endCaseNumber' },
  452. slots:{title:'endCaseNumberTitle'}
  453. },
  454. {
  455. title: '颜色(中英文)',
  456. dataIndex: 'colour',
  457. width: 120,
  458. className: 'replacecolor',
  459. scopedSlots: { customRender: 'replacecolor' },
  460. },
  461. {
  462. title: '配码--根据U8订单来显示',
  463. dataIndex: 'withCode',
  464. width: 200,
  465. className: 'replacecolor',
  466. ellipsis: true,
  467. },
  468. {
  469. title: '计划尺码数量',
  470. dataIndex: 'planSize',
  471. width: 200,
  472. className: 'replacecolor',
  473. ellipsis: true,
  474. },
  475. {
  476. title: '计划装箱数量',
  477. dataIndex: 'planQuantity',
  478. width: 120,
  479. className: 'replacecolor',
  480. ellipsis: true,
  481. },
  482. {
  483. title: '件数/箱',
  484. dataIndex: 'piecesBox',
  485. width: 90,
  486. className: 'replacecolor',
  487. ellipsis: true,
  488. },
  489. {
  490. title: '箱数',
  491. dataIndex: 'boxNumber',
  492. width: 80,
  493. className: 'replacecolor',
  494. ellipsis: true,
  495. },
  496. {
  497. title: '总件数',
  498. dataIndex: 'total',
  499. width: 90,
  500. className: 'replacecolor',
  501. ellipsis: true,
  502. },
  503. {
  504. // title: '净重/箱',
  505. dataIndex: 'netWeight',
  506. width: 120,
  507. className: 'replacecolor',
  508. scopedSlots: { customRender: 'netWeight' },
  509. slots:{title:'netWeightTitle'}
  510. },
  511. {
  512. title: '总净重',
  513. dataIndex: 'totalNetWeight',
  514. width: 100,
  515. className: 'replacecolor',
  516. ellipsis: true,
  517. },
  518. {
  519. // title: '毛重/箱',
  520. dataIndex: 'grossWeight',
  521. width: 120,
  522. className: 'replacecolor',
  523. scopedSlots: { customRender: 'grossWeight' },
  524. slots:{title:'grossWeightTitle'}
  525. },
  526. {
  527. title: '总毛重',
  528. dataIndex: 'totalGrossWeight',
  529. width: 100,
  530. className: 'replacecolor',
  531. ellipsis: true,
  532. },
  533. {
  534. // title: '外箱长度',
  535. dataIndex: 'outerBoxLength',
  536. width: 120,
  537. className: 'replacecolor',
  538. scopedSlots: { customRender: 'outerBoxLength' },
  539. slots:{title:'outerBoxLengthTitle'}
  540. },
  541. {
  542. // title: '外箱宽度',
  543. dataIndex: 'outerBoxWidth',
  544. width: 140,
  545. className: 'replacecolor',
  546. scopedSlots: { customRender: 'outerBoxWidth' },
  547. slots:{title:'outerBoxWidthTitle'}
  548. },
  549. {
  550. // title: '外箱高度',
  551. dataIndex: 'outerBoxHeight',
  552. className: 'replacecolor',
  553. width: 140,
  554. scopedSlots: { customRender: 'outerBoxHeight' },
  555. slots:{title:'outerBoxHeightTitle'}
  556. },
  557. {
  558. title: '总体积',
  559. dataIndex: 'totalVolume',
  560. className: 'replacecolor',
  561. width: 90,
  562. ellipsis: true,
  563. },
  564. // {
  565. // title: '净净重',
  566. // dataIndex: 'netWeightToo',
  567. // width: 120,
  568. // className: 'replacecolor',
  569. // scopedSlots: { customRender: 'netWeightToo' },
  570. // },
  571. {
  572. title: '单价',
  573. dataIndex: 'unitPrice',
  574. width: 120,
  575. className: 'replacecolor',
  576. scopedSlots: { customRender: 'unitPrice' },
  577. ellipsis: true,
  578. },
  579. {
  580. title: '总价',
  581. dataIndex: 'totalPrice',
  582. width: 90,
  583. className: 'replacecolor',
  584. ellipsis: true,
  585. // validateRules: [{ required: true, message: '${title}不能为空' },
  586. // {pattern: /^\d+(\.\d{1,2})?$/, message: '小数点位数不能超过2位' }],
  587. },
  588. {
  589. title: '备注',
  590. dataIndex: 'memo',
  591. width: 120,
  592. className: 'replacecolor',
  593. ellipsis: true,
  594. // validateRules: [{ required: true, message: '${title}不能为空' },
  595. // {pattern: /^\d+(\.\d{1,2})?$/, message: '小数点位数不能超过2位' }],
  596. },
  597. {
  598. title: '操作',
  599. dataIndex: 'action',
  600. className: 'replacecolor',
  601. fixed: 'right',
  602. width: 140,
  603. align: 'center',
  604. scopedSlots: { customRender: 'action' },
  605. }
  606. ],
  607. row:{},
  608. loading: false, // 表格加载
  609. visible: false,
  610. editDecide: 'add',
  611. dateFormat: 'YYYY-MM-DD',
  612. addAdpacking: {
  613. syPreAssembledPackingListItemList:[]
  614. }, //主表信息
  615. confirmLoading: false,
  616. msgFormSon: 'test', // 子组件传来数据的变量
  617. // state: '0', // 单据状态初始未【仅保存】
  618. // pushState: '0' // 推送状态初始未【仅保存】
  619. // 待确定还有哪些必填信息 ----------------------------
  620. validatorRules: {
  621. // orderNumber: [{ required: true, message: '订单号不能为空', trigger: 'blur' }],
  622. // styleNum: [{ required: true, message: '款号不能为空', trigger: 'blur' }],
  623. // name: [{ required: true, message: '品名不能为空', trigger: 'blur' }]
  624. },
  625. sizeFields:[], // 尺码字段
  626. dotConfig:{}, // 小数点配置
  627. judge : 0 ,
  628. }
  629. },
  630. // 接收父组件查询方法
  631. props: {
  632. fatherList: {
  633. type: Function,
  634. default: null
  635. }
  636. },
  637. methods: {
  638. getSon(val) {
  639. // console.log('勾选发运明细数据', val)
  640. // for (var i in val) {
  641. // val[i]['orderQuantity'] = val[i].quantity
  642. // val[i]['orderRemainingQuantity'] = val[i].surplusNum
  643. // val[i]['salesUnitPrice'] = val[i].unitPriceIncludingTax
  644. // val[i]['customerOrder'] = val[i].customerOrderNumber
  645. // val[i]['shipmentQuantity'] = val[i].surplusNum //订单剩余数量 赋值给发货数量
  646. // }
  647. this.addAdpacking.syPreAssembledPackingListItemList = [];
  648. this.setHeadCalField();
  649. var selectData = val[0];
  650. queryShippingDetails({id:selectData.id,groupId:selectData.groupId}).then(res => {
  651. if (res.success) {
  652. // 放在前面,有小数位数设置
  653. this.setHeadData(val[0], res.result);
  654. this.loadSizeTables(res.result.sizeTables);
  655. var changedData = this.changeData(val[0], res.result);
  656. this.addAdpacking.syPreAssembledPackingListItemList.push(changedData);
  657. }else{
  658. this.$message.error("获取发运明细详情失败");
  659. }
  660. })
  661. },
  662. loadSizeTables(sizeTable){
  663. var newColums = this.columns.filter(item=>{
  664. return item.isSize != true;
  665. });
  666. this.sizeFields = [];
  667. this.inputName = []
  668. if (sizeTable != null){
  669. var i=0;
  670. // 找到插入位置点
  671. for (; i<newColums.length;i++){
  672. if (newColums[i].insertAfter){
  673. break;
  674. }
  675. }
  676. // 插入数据
  677. for (var j=0;j<sizeTable.length;j++){
  678. this.sizeFields.push('size-'+sizeTable[j].size);
  679. var validExpress = getDotValidExpress(this.dotConfig.quantity);
  680. var field = {
  681. title: sizeTable[j].size,
  682. dataIndex: 'size-'+sizeTable[j].size,
  683. width: 80,
  684. isSize:true,
  685. validateRules: [validExpress],
  686. scopedSlots: { customRender: 'size-'+sizeTable[j].size },
  687. };
  688. this.inputName.push('size-'+sizeTable[j].size)
  689. newColums.splice(i+1+j,0,field);
  690. }
  691. }
  692. this.columns = newColums;
  693. },
  694. // 参照发运明细
  695. referShipmentDetails() {
  696. // console.log('打开参照发运明细')
  697. this.$refs.referShipmentDetailsModal.referShipDetModVis = true
  698. this.$refs.referShipmentDetailsModal.getShipData()
  699. },
  700. myHandSave(){
  701. this.addAdpacking.status=0;
  702. this.saveAdd();
  703. },
  704. async myHandSubmit(){
  705. this.addAdpacking.status=1;
  706. this.saveAdd();
  707. },
  708. // 保存
  709. async saveAdd() {
  710. var newObj = this.addAdpacking;
  711. if (this.sizeFields.length == 0){
  712. this.$message.error('当前记录没有尺码字段,无法保存');
  713. return;
  714. }
  715. // if (newObj.totalBoxes == 0){
  716. // this.$message.error('总箱数为0,无法保存');
  717. // return;
  718. // }
  719. await this.JudgeVluabled()
  720. //尺码赋值
  721. for(var i =0;i<newObj.syPreAssembledPackingListItemList.length;i++){
  722. var dataTable = newObj.syPreAssembledPackingListItemList[i]
  723. for (var j=0; j<dataTable.sizeTables.length; j++){
  724. var sizeTable = dataTable.sizeTables[j];
  725. var field = 'size-'+sizeTable.size;
  726. dataTable.sizeTables[j].proportion = dataTable[field];
  727. }
  728. }
  729. // 日期格式转换
  730. if (newObj.preDeliveryDate != "" && newObj.preDeliveryDate != undefined){
  731. newObj.preDeliveryDate = newObj.preDeliveryDate+" 00:00:00";
  732. }
  733. // 推送状态、状态赋默认值。新增状态赋值
  734. if (newObj.id == undefined || newObj.id == ""){
  735. newObj.push_status = 0;
  736. }
  737. if(this.judge == 0){
  738. if(this.editDecide === 'edit'){
  739. this.btnLoading = true
  740. editById(newObj).then(res => {
  741. if (res.success) {
  742. if(newObj.status == '1'){
  743. this.$message.success('编辑并提交成功')
  744. }else {
  745. this.$message.success('编辑成功')
  746. }
  747. this.close()
  748. this.btnLoading = false
  749. //清空信息
  750. newObj = {syPreAssembledPackingListItemList:[]};
  751. this.row = res.result
  752. this.fatherList() // 调用父组件 查询方法
  753. // this.msgFormSon = {} 清空子表信息
  754. }else{
  755. this.$message.error(res.message)
  756. this.btnLoading = false
  757. }
  758. })
  759. }else {
  760. addAdvPac(newObj).then(res => {
  761. this.btnLoading = true
  762. if (res.success) {
  763. if(newObj.status == '1'){
  764. this.$message.success('新增并提交成功')
  765. }else {
  766. this.$message.success('新增成功')
  767. }
  768. this.close()
  769. this.btnLoading = false
  770. //清空信息
  771. newObj = {syPreAssembledPackingListItemList:[]};
  772. this.row = res.result
  773. this.fatherList() // 调用父组件 查询方法
  774. // this.msgFormSon = {} 清空子表信息
  775. }else{
  776. this.$message.error(res.message)
  777. this.btnLoading = false
  778. }
  779. })
  780. }
  781. }
  782. // const that = this
  783. // // 触发表单验证
  784. // this.$refs.form.validate(valid => {
  785. // if (valid) {
  786. // that.confirmLoading = true
  787. // }
  788. // })
  789. },
  790. JudgeVluabled(){
  791. this.judge = 0
  792. for (var i=0; i<this.addAdpacking.syPreAssembledPackingListItemList.length;i++){
  793. var tableRow = this.addAdpacking.syPreAssembledPackingListItemList[i];
  794. tableRow = JSON.parse(JSON.stringify(tableRow))
  795. var allSizeSum = this.getAllSizeSum(tableRow);
  796. if (allSizeSum == 0){
  797. this.$message.error('第'+(i+1)+'行所有尺码数量为0,无法保存');
  798. this.judge += 1
  799. return;
  800. }
  801. if(Number(tableRow.startingBoxNumber) > Number(tableRow.endCaseNumber)) {
  802. this.$message.error('第'+(i+1)+'行起始箱号大于结束箱号,无法保存');
  803. this.judge += 1
  804. return;
  805. }
  806. //是否未填
  807. var required = [
  808. {key:'startingBoxNumber',value:'起始箱号'},
  809. {key:'endCaseNumber',value:'结束箱号'},
  810. {key:'netWeight',value:'净重/箱'},
  811. {key:'grossWeight',value:'毛重/箱'},
  812. {key:'outerBoxLength',value:'外箱长度'},
  813. {key:'outerBoxHeight',value:'外箱高度'},
  814. {key:'outerBoxWidth',value:'外箱宽度'},
  815. // {key:'netWeightToo',value:'净净重'},
  816. ]
  817. for(var j=0 ; j<required.length;j++){
  818. if(tableRow[required[j].key] == null || tableRow[required[j].key] == "" || tableRow[required[j].key] == undefined){
  819. this.$message.error('第'+(i+1)+'行'+required[j].value+'无值,无法保存');
  820. this.judge+=1
  821. return
  822. }
  823. }
  824. //是否为整
  825. var integer = [
  826. {key:'startingBoxNumber',value:'起始箱号'},
  827. {key:'endCaseNumber',value:'结束箱号'},
  828. {key:'piecesBox',value:'件数/箱'},
  829. ]
  830. for(var v=0 ; v<integer.length;v++){
  831. if(!Number.isInteger(Number(tableRow[integer[v].key]))){
  832. this.$message.error('第'+(i+1)+'行'+integer[v].value+'不为整数,无法保存');
  833. this.judge+=1
  834. return
  835. }
  836. }
  837. //判断小数位数
  838. var Several = [
  839. {key:'netWeight',value:'净重/箱'},
  840. {key:'grossWeight',value:'毛重/箱'},
  841. // {key:'netWeightToo',value:'净净重'}
  842. ]
  843. for(var s=0 ; s<Several.length;s++){
  844. console.log(tableRow[Several[s].key])
  845. var position =(tableRow[Several[s].key]==0 || !tableRow[Several[s].key])?0:tableRow[Several[s].key].toString().indexOf('.') + 1; //小数点的位置
  846. var digit =(tableRow[Several[s].key]==0 || !tableRow[Several[s].key])?0: tableRow[Several[s].key].toString().length - position; //小数的位值
  847. if(digit > 2 && position!==0 ){
  848. this.$message.error('第'+(i+1)+'行'+Several[s].value+'小数超过两位,无法保存');
  849. this.judge+=1
  850. return
  851. }
  852. }
  853. }
  854. },
  855. // 设置表头信息
  856. setHeadData(referData, mData){
  857. var itemData = {};
  858. if (mData.syPreAssembledPackingListItemList != null && mData.syPreAssembledPackingListItemList.size>0){
  859. itemData = mData.syPreAssembledPackingListItemList[0];
  860. }
  861. // 设置件数小数位数
  862. this.dotConfig = getDotConfig(itemData.masterMetering);
  863. this.addAdpacking.syDeclarationElementsId = mData.syDeclarationElementsId;
  864. this.addAdpacking.elementsId = mData.elementsId
  865. this.addAdpacking.itemNumber = referData.itemNumber;
  866. // this.addAdpacking.productName = referData.chineseName;
  867. this.addAdpacking.productName = mData.productName;
  868. this.addAdpacking.englishProductName = mData.englishProductName;
  869. this.addAdpacking.u8Remarks = mData.u8Remarks;
  870. this.addAdpacking.sizeRange = "";
  871. if (mData.sizeTables != null){
  872. if (mData.sizeTables.length == 1){
  873. this.addAdpacking.sizeRange = mData.sizeTables[0].size;
  874. }else if (mData.sizeTables.length>1){
  875. this.addAdpacking.sizeRange = mData.sizeTables[0].size + " ~ " + mData.sizeTables[mData.sizeTables.length-1].size;
  876. }
  877. }
  878. this.addAdpacking.customer = mData.customer;
  879. this.addAdpacking.ompoId = mData.ompoId
  880. this.addAdpacking.salesman = mData.salesman
  881. this.addAdpacking.customerAbbreviation = mData.customerAbbreviation
  882. this.addAdpacking.spurOrSubOrder = mData.spurOrSubOrder
  883. this.addAdpacking.garmentFactory = mData.garmentFactory;
  884. this.addAdpacking.orderNumber = mData.orderNumber
  885. },
  886. // 发运明细详情成预装箱记录:mData-主表记录,itemData-子表记录
  887. changeData(referData, mData) {
  888. var itemData = {};
  889. if (mData.syPreAssembledPackingListItemList != null && mData.syPreAssembledPackingListItemList.length>0){
  890. itemData = mData.syPreAssembledPackingListItemList[0];
  891. }
  892. var addrow = {
  893. syDeclarationElementsId:itemData.syDeclarationElementsId,
  894. syDeclarationElementsItemId:itemData.syDeclarationElementsItemId,
  895. acSetNo: itemData.acSetNo,
  896. garmentFactory: itemData.garmentFactory,
  897. hod: itemData.hod,
  898. styleNo:itemData.styleNo,
  899. poNo:itemData.poNo,
  900. itemCode:'',
  901. distributionPoint:referData.distributionPoint,
  902. prepackSku: '',
  903. size:"",
  904. startingBoxNumber: '',
  905. endCaseNumber: '',
  906. colour: itemData.colour,
  907. withCode: itemData.withCode,
  908. piecesBox: 0,
  909. boxNumber: '',
  910. total: '',
  911. netWeight: '',
  912. totalNetWeight: '',
  913. grossWeight: '',
  914. totalGrossWeight: '',
  915. outerBoxLength: '',
  916. outerBoxWidth: '',
  917. outerBoxHeight: '',
  918. totalVolume: '',
  919. netWeightToo: '',
  920. unitPrice: itemData.unitPrice,
  921. totalPrice: '',
  922. smallPo: referData.smallPo,
  923. inventoryName:referData.inventoryName,
  924. spurOrSubOrder:referData.purOrSubOrder,
  925. factoryUnitPrice:referData.factoryUnitPrice,
  926. customerAbbreviation:referData.customerAbbreviation,
  927. sizeTables : itemData.sizeTables,
  928. planSize : itemData.planSize,
  929. planQuantity:itemData.planQuantity,
  930. supplierCode:itemData.supplierCode,
  931. supplier:itemData.supplier,
  932. ompoAccount:itemData.ompoAccount,
  933. ompoId:itemData.ompoId,
  934. ompoIdItem:itemData.ompoIdItem,
  935. ymoney:itemData.ymoney,
  936. customsDeclarationUnitPrice:itemData.customsDeclarationUnitPrice,
  937. factoryUnitPrice:itemData.factoryUnitPrice
  938. }
  939. return addrow;
  940. },
  941. // 操作按钮 删除
  942. handleDelete(record,index) {
  943. var ret = this.addAdpacking.syPreAssembledPackingListItemList.splice(index, 1);
  944. this.setHeadCalField();
  945. return ret;
  946. },
  947. // 复制
  948. copy(record) {
  949. var newRow = JSON.parse(JSON.stringify(record));
  950. newRow.isAdd = 1
  951. this.addAdpacking.syPreAssembledPackingListItemList.push(newRow);
  952. this.setHeadCalField();
  953. },
  954. // 抽屉 取消
  955. handleCancel() {
  956. this.close()
  957. },
  958. close() {
  959. this.$emit('close')
  960. this.visible = false;
  961. this.btnLoading = false
  962. this.editDecide = 'add'
  963. this.addAdpacking = {syPreAssembledPackingListItemList:[]};
  964. },
  965. aa() {},
  966. modalFormOk() {
  967. this.$refs.referShipmentDetailsModal.referShipmentDetailsModVis = true
  968. },
  969. // 表格字段值变动时触发
  970. handleValueChange(record) {
  971. if (record.startingBoxNumber != undefined && record.startingBoxNumber != "" &&
  972. record.endCaseNumber != undefined && record.endCaseNumber != ""){
  973. record.boxNumber = record.endCaseNumber*1-record.startingBoxNumber*1+1;
  974. }
  975. var allSizeSum = this.getAllSizeSum(record);
  976. record.piecesBox = allSizeSum;
  977. record.total = (record.piecesBox*record.boxNumber);
  978. if (record.unitPrice != undefined && record.unitPrice != ""){
  979. record.totalPrice = (record.unitPrice*record.total).toFixed(2);
  980. }
  981. if (record.netWeight != "" && record.netWeight != undefined){
  982. record.totalNetWeight = (record.netWeight * record.boxNumber).toFixed(2);
  983. }
  984. if (record.grossWeight != "" && record.grossWeight != undefined){
  985. record.totalGrossWeight = (record.grossWeight * record.boxNumber).toFixed(2);
  986. }
  987. if (record.outerBoxLength != "" && record.outerBoxLength != undefined &&
  988. record.outerBoxWidth != "" && record.outerBoxWidth != undefined &&
  989. record.outerBoxHeight != "" && record.outerBoxHeight != undefined){
  990. record.totalVolume = ((record.outerBoxLength * record.outerBoxWidth * record.outerBoxHeight * record.boxNumber)/1000000).toFixed(3);
  991. }
  992. this.$forceUpdate()
  993. this.setHeadCalField();
  994. },
  995. // 获取不同尺码数量之和
  996. getAllSizeSum(record){
  997. var ret = 0;
  998. for (var i=0; i<this.sizeFields.length; i++){
  999. if (record[this.sizeFields[i]] != undefined && record[this.sizeFields[i]] != ""){
  1000. ret += record[this.sizeFields[i]]*1;
  1001. }
  1002. }
  1003. return ret;
  1004. },
  1005. // 设置表头计算值,直接设置表头值对象不能刷新,把表头对象换了就可以了
  1006. setHeadCalField(){
  1007. var headData = JSON.parse(JSON.stringify(this.addAdpacking));
  1008. var totalBoxes = 0;
  1009. var totalNetWeight = 0;
  1010. var totalGrossWeight = 0;
  1011. var totalVolume = 0;
  1012. var totalPrice = 0;
  1013. var total = 0;
  1014. for (var i=0; i<headData.syPreAssembledPackingListItemList.length; i++){
  1015. var rowData = headData.syPreAssembledPackingListItemList[i];
  1016. totalBoxes += rowData.boxNumber;
  1017. if (rowData.totalNetWeight != undefined && rowData.totalNetWeight != ""){
  1018. totalNetWeight += rowData.totalNetWeight*1;
  1019. }
  1020. if (rowData.totalGrossWeight != undefined && rowData.totalGrossWeight != ""){
  1021. totalGrossWeight += rowData.totalGrossWeight*1;
  1022. }
  1023. if (rowData.totalVolume != undefined && rowData.totalVolume != ""){
  1024. totalVolume += rowData.totalVolume*1;
  1025. }
  1026. if (rowData.totalPrice != undefined && rowData.totalPrice != ""){
  1027. totalPrice += rowData.totalPrice*1;
  1028. }
  1029. if (rowData.total != undefined && rowData.total != ""){
  1030. total += rowData.total*1;
  1031. }
  1032. }
  1033. headData.totalBoxes =Number(totalBoxes).toFixed(0);
  1034. headData.totalNetWeight = Number(totalNetWeight).toFixed(2);
  1035. headData.totalGrossWeight = Number(totalGrossWeight).toFixed(2);
  1036. headData.totalVolume = totalVolume.toFixed(3);
  1037. headData.totalPrice = totalPrice.toFixed(2);
  1038. headData.total = total.toFixed(0)
  1039. this.addAdpacking = headData;
  1040. },
  1041. },
  1042. computed: {},
  1043. mounted() {}
  1044. }
  1045. </script>
  1046. <style lang="less" scoped>
  1047. @import '~@assets/less/common.less';
  1048. /deep/ .ant-table-thead > tr > th {
  1049. text-align: center;
  1050. // font-weight: 700;
  1051. }
  1052. /deep/ .ant-table-tbody {
  1053. text-align: center;
  1054. }
  1055. // /deep/ th.replacecolor {
  1056. // background-color: #ccc;
  1057. // }
  1058. // 抽屉里的card样式
  1059. /deep/ .ant-drawer-content {
  1060. background-color: #f0f2f5;
  1061. }
  1062. /deep/ .ant-drawer-body {
  1063. padding: 10px;
  1064. }
  1065. /deep/.ant-table-row-cell-break-word >.ant-form-item{
  1066. margin-bottom: 0px !important;
  1067. }
  1068. /deep/.ant-table-tbody .ant-table-row td{
  1069. padding-top: 8px !important;
  1070. padding-bottom: 8px !important;
  1071. }
  1072. </style>