addAdpackingDrawer.vue 40 KB

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