containers.vue 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561
  1. <template>
  2. <div>
  3. <basic-container>
  4. <avue-crud
  5. :option="option"
  6. :table-loading="loading"
  7. :data="assemblyForm.containersList"
  8. :permission="permissionList"
  9. :before-open="beforeOpen"
  10. v-model="form"
  11. id="out-table"
  12. :header-cell-class-name="headerClassName"
  13. ref="crud"
  14. :row-style="{ height: '20px' }"
  15. :cell-style="{ padding: '0px' }"
  16. @row-update="rowUpdate"
  17. @row-save="rowSave"
  18. @row-del="rowDel"
  19. @selection-change="selectionChange"
  20. @current-row-change="handleCurrentRowChange"
  21. @refresh-change="refreshChange"
  22. >
  23. <template slot="menuLeft">
  24. <div style="display: flex;align-items: center;justify-content: space-between">
  25. <div>
  26. <!--<el-button type="primary" size="small" @click="DistributionBox">配箱</el-button>-->
  27. <el-button type="success" size="small" plain :disabled="seeDisabled || disabled" @click.stop="equalDistribution2()"
  28. >{{ $t("btn118n.generateCtnrList") }}
  29. </el-button>
  30. <el-button type="success" size="small" plain :disabled="seeDisabled || disabled" @click.stop="equalDistribution(1)"
  31. >{{ $t("btn118n.packCtnrTeu") }}
  32. </el-button>
  33. <el-button type="success" size="small" plain :disabled="seeDisabled || disabled" @click.stop="equalDistribution(2)"
  34. >{{ $t("btn118n.packCtnrQty") }}
  35. </el-button>
  36. <el-button
  37. v-if="assemblyForm.billType != 'MM'"
  38. type="primary"
  39. size="small"
  40. :disabled="seeDisabled || detailData.seeDisabled || pleasereviewType || showLock || disabled"
  41. @click.stop="addRow()"
  42. >
  43. {{ $t("btn118n.new") }}
  44. </el-button>
  45. <el-button
  46. type="primary"
  47. size="small"
  48. :disabled="detailData.seeDisabled || pleasereviewType || showLock || disabled"
  49. @click="rootEditfun"
  50. >
  51. {{ $t("btn118n.edit") }}
  52. </el-button>
  53. <el-button
  54. type="primary"
  55. size="small"
  56. @click="containersSubmitListfun"
  57. :disabled="detailData.seeDisabled || pleasereviewType || showLock || disabled"
  58. >
  59. {{ $t("btn118n.save") }}
  60. </el-button>
  61. <el-button
  62. type="success"
  63. size="small"
  64. :disabled="detailData.seeDisabled || !assemblyForm.id || pleasereviewType || showLock || disabled"
  65. @click="oepnexcelBox"
  66. >{{ $t("btn118n.importCtnr") }}
  67. </el-button>
  68. <el-button
  69. type="success"
  70. size="small"
  71. :loading="loadingButton"
  72. :disabled="detailData.seeDisabled || !assemblyForm.id || pleasereviewType || showLock || disabled"
  73. @click="extractBoxInformation"
  74. >{{ $t("btn118n.getCtnr") }}
  75. </el-button>
  76. <el-button
  77. type="warning"
  78. size="small"
  79. :disabled="detailData.seeDisabled || pleasereviewType || showLock || disabled"
  80. @click="cleanCntrNofun"
  81. >{{ $t("btn118n.clearCtnrNo") }}
  82. </el-button>
  83. <el-button type="danger" size="small" :disabled="detailData.seeDisabled || pleasereviewType || showLock || disabled" @click="revokefun"
  84. >{{ $t("btn118n.clearancePieceWeightScale") }}
  85. </el-button>
  86. <el-button
  87. type="danger"
  88. size="small"
  89. :disabled="detailData.seeDisabled || pleasereviewType || showLock || disabled"
  90. @click="wholeRevokefun"
  91. >{{ $t("btn118n.clearanceAllPieceWeightScale") }}
  92. </el-button>
  93. <el-button
  94. type="danger"
  95. size="small"
  96. :disabled="detailData.seeDisabled || pleasereviewType || showLock || disabled"
  97. @click="handleDelete"
  98. >{{ $t("btn118n.deleteCtnrList") }}
  99. </el-button>
  100. <el-button
  101. v-if="assemblyForm.billType == 'MH'"
  102. type="danger"
  103. size="small"
  104. plain
  105. :disabled="detailData.seeDisabled || selectionList.length == 0 || disabled"
  106. @click.stop="allClick('合拆票')"
  107. >合拆票</el-button
  108. >
  109. <!-- <el-button type="success" size="small" plain @click.stop="$refs.splitOrder.openDialog(assemblyForm)">合票</el-button> -->
  110. <el-button type="success" size="small" plain @click.stop="$refs.print.openDialog()">
  111. {{ $t("btn118n.preview") }}
  112. </el-button>
  113. <el-button type="success" size="small" @click.stop="outExport">
  114. {{ $t("btn118n.exportData") }}
  115. </el-button>
  116. <!--<el-button type="warning" size="small"-->
  117. <!-- :disabled="numberfalsefun() || assemblyForm.id"-->
  118. <!-- @click="equalDistribution">平均分配</el-button>-->
  119. </div>
  120. <!--<div>-->
  121. <!-- <el-button size="small">Copy</el-button>-->
  122. <!-- <el-button size="small">查看箱信息</el-button>-->
  123. <!-- <el-button size="small">校验箱信息</el-button>-->
  124. <!--</div>-->
  125. </div>
  126. </template>
  127. <template slot-scope="scope" slot="menu">
  128. <!-- <el-button v-if="scope.row.edit" :type="scope.type" :size="scope.size" icon="el-icon-edit" @click.stop="rowSavefun(scope.row, scope.index)"
  129. >保存
  130. </el-button>
  131. <el-button
  132. v-else
  133. :type="scope.type"
  134. :size="scope.size"
  135. icon="el-icon-edit"
  136. :disabled="detailData.seeDisabled || pleasereviewType || showLock"
  137. @click.stop="rowCellfun(scope.row, scope.index)"
  138. >编辑
  139. </el-button> -->
  140. <el-button
  141. v-if="assemblyForm.billType != 'MM'"
  142. :type="scope.type"
  143. :size="scope.size"
  144. :disabled="detailData.seeDisabled || pleasereviewType || showLock || disabled || scope.row.containerNumber"
  145. @click.stop="rowDel(scope.row, scope.index)"
  146. >{{ $t("btn118n.deleted") }}
  147. </el-button>
  148. <el-popover placement="left" width="500" trigger="click">
  149. <avue-crud :option="recordOption" :data="recordData"></avue-crud>
  150. <el-button slot="reference" size="small" type="text" @click="rowRecord(scope.row)" style="margin-left: 6px;">记录</el-button>
  151. </el-popover>
  152. </template>
  153. <template slot="cntrTypeCode" slot-scope="{ row, index }">
  154. <dic-select
  155. v-if="row.edit && row.whetherSystemGenerate != 1"
  156. v-model="row.cntrTypeCode"
  157. label="cntrTypeCode"
  158. :activateCreated="false"
  159. :filterable="true"
  160. :mockData="assemblyForm.preContainersList"
  161. ></dic-select>
  162. <span v-else>{{ row.cntrTypeCode }}</span>
  163. </template>
  164. <template slot="hblno" slot-scope="{ row, index }">
  165. <el-input
  166. v-if="row.edit && row.whetherSystemGenerate != 1"
  167. v-model="row.hblno"
  168. clearable
  169. size="small"
  170. placeholder="请输入HB/L NO"
  171. ></el-input>
  172. <span v-else>{{ row.hblno }}</span>
  173. </template>
  174. <template slot-scope="scope" slot="cntrNo">
  175. <el-input
  176. v-if="scope.row.edit"
  177. v-model="scope.row.cntrNo"
  178. maxlength="11"
  179. size="small"
  180. clearable
  181. placeholder="请输入箱号"
  182. @input="cntrNoInput(scope.row, 'cntrNo')"
  183. @change="verifyChange(scope.row, 'cntrNo')"
  184. ></el-input>
  185. <span v-else>{{ scope.row.cntrNo }}</span>
  186. </template>
  187. <template slot-scope="scope" slot="sealNo">
  188. <el-input
  189. v-if="scope.row.edit"
  190. v-model="scope.row.sealNo"
  191. maxlength="11"
  192. size="small"
  193. clearable
  194. placeholder="请输入封号"
  195. @input="cntrNoInput(scope.row, 'sealNo')"
  196. ></el-input>
  197. <span v-else>{{ scope.row.sealNo }}</span>
  198. </template>
  199. <template slot-scope="scope" slot="quantity">
  200. <el-input v-if="scope.row.edit" v-model="scope.row.quantity" size="small" clearable placeholder="请输入件数"></el-input>
  201. <span v-else>{{ Number(scope.row.quantity).toFixed(0) }}</span>
  202. </template>
  203. <template slot-scope="scope" slot="grossWeight">
  204. <el-input
  205. v-if="scope.row.edit"
  206. v-model="scope.row.grossWeight"
  207. size="small"
  208. clearable
  209. placeholder="请输入毛重"
  210. @change="computeChange(scope.row)"
  211. ></el-input>
  212. <span v-else>{{ scope.row.grossWeight }}</span>
  213. </template>
  214. <template slot-scope="scope" slot="netWeight">
  215. <el-input v-if="scope.row.edit" v-model="scope.row.netWeight" size="small" clearable placeholder="请输入净重"></el-input>
  216. <span v-else>{{ scope.row.netWeight }}</span>
  217. </template>
  218. <template slot-scope="scope" slot="measurement">
  219. <el-input v-if="scope.row.edit" v-model="scope.row.measurement" size="small" clearable placeholder="请输入尺码"></el-input>
  220. <span v-else>{{ scope.row.measurement }}</span>
  221. </template>
  222. <template slot-scope="scope" slot="remarks">
  223. <el-input v-if="scope.row.edit" v-model="scope.row.remarks" size="small" clearable placeholder="请输入备注"></el-input>
  224. <span v-else>{{ scope.row.remarks }}</span>
  225. </template>
  226. <template slot-scope="scope" slot="marks">
  227. <el-input v-if="scope.row.edit" v-model="scope.row.marks" size="small" clearable placeholder="请输入MARKS"></el-input>
  228. <span v-else>{{ scope.row.marks }}</span>
  229. </template>
  230. <template slot-scope="{ row }" slot="tare">
  231. <el-input v-if="row.edit" v-model="row.tare" size="small" clearable placeholder="请输入箱皮重" @change="computeChange(row)"></el-input>
  232. <span v-else>{{ row.tare }}</span>
  233. </template>
  234. <!-- <template slot-scope="{row}" slot="vgmWeight">
  235. <el-input v-if="row.edit" v-model="row.vgmWeight" size="small" clearable
  236. placeholder="请输入VGM总重(KGM)"></el-input>
  237. <span v-else>{{ row.vgmWeight }}</span>
  238. </template> -->
  239. <tempalte slot="podStationCname" slot-scope="{ row }">
  240. <dic-select
  241. v-if="row.edit"
  242. v-model="row.podStationCname"
  243. placeholder="场站"
  244. label="cnName"
  245. res="records"
  246. url="/blade-los/bcorps/selectList?current=1&size=5&corpTypeName=场站&status=0"
  247. :filterable="true"
  248. :remote="true"
  249. dataName="cnName"
  250. @selectChange="rowDicChange('podStationCname', $event, row)"
  251. ></dic-select>
  252. <span v-else>{{ row.podStationCname }}</span>
  253. </tempalte>
  254. <!-- <template slot-scope="{ row }" slot="polCyCname">
  255. <dic-select
  256. v-model="row.polCyCname"
  257. placeholder="场站"
  258. label="cnName"
  259. res="records"
  260. url="/blade-los/bcorps/selectList?current=1&size=5&corpTypeName=场站&status=0"
  261. :filterable="true"
  262. :remote="true"
  263. dataName="cnName"
  264. @selectChange="rowDicChange('polCyCname', $event, row)"
  265. ></dic-select>
  266. </template> -->
  267. <!-- <template slot-scope="{ row }" slot="podEmptyContainerReturnDate">
  268. <el-date-picker
  269. v-model="row.podEmptyContainerReturnDate"
  270. type="date"
  271. placeholder="选择日期"
  272. format="yyyy-MM-dd"
  273. value-format="yyyy-MM-dd 00:00:00"
  274. size="small"
  275. >
  276. </el-date-picker>
  277. </template> -->
  278. <tempalte slot-scope="{ row }" slot="podCyContact">
  279. <dic-select
  280. v-if="row.edit"
  281. :key="row.podStationId"
  282. v-model="row.podCyContact"
  283. placeholder="场站联系人"
  284. label="cname"
  285. res="records"
  286. :url="'/blade-los/bcorpsattn/list?pid=' + row.podStationId"
  287. :filterable="true"
  288. :disabled="!row.podStationId"
  289. @selectChange="rowDicChange('podCyContact', $event, row)"
  290. ></dic-select>
  291. <span v-else>{{ row.podCyContact }}</span>
  292. </tempalte>
  293. <template slot-scope="{ row }" slot="podCyAddress">
  294. <el-input v-if="row.edit" v-model="row.podCyAddress" size="small" clearable placeholder="请输入目的港场站地址"></el-input>
  295. <span v-else>{{ row.podCyAddress }}</span>
  296. </template>
  297. <template slot-scope="{ row }" slot="podCyEmail">
  298. <el-input v-if="row.edit" v-model="row.podCyEmail" size="small" clearable placeholder="请输入目的港场站邮箱"></el-input>
  299. <span v-else>{{ row.podCyEmail }}</span>
  300. </template>
  301. <template slot-scope="{ row }" slot="podCyTel">
  302. <el-input v-if="row.edit" v-model="row.podCyTel" size="small" clearable placeholder="请输入目的港场站电话"></el-input>
  303. <span v-else>{{ row.podCyTel }}</span>
  304. </template>
  305. </avue-crud>
  306. </basic-container>
  307. <el-dialog title="导入箱号,铅封号" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false" v-dialog-drag>
  308. <avue-form :option="excelOption" v-model="excelForm" :table-loading="excelLoading" :upload-before="uploadBefore" :upload-after="onSuccess">
  309. <template slot="excelTemplate">
  310. <el-button type="primary" @click="handleGet"> 点击下载<i class="el-icon-download el-icon--right"></i> </el-button>
  311. </template>
  312. </avue-form>
  313. <p style="text-align: center;color: #DC0505">
  314. 温馨提示 第一次导入时请先下载模板
  315. </p>
  316. </el-dialog>
  317. <!--提取的数据展示框-->
  318. <el-dialog
  319. append-to-body
  320. title="预览数据"
  321. class="el-dialogDeep"
  322. :visible.sync="extractDialogvisible"
  323. width="80%"
  324. :close-on-click-modal="false"
  325. :destroy-on-close="true"
  326. :close-on-press-escape="false"
  327. v-dialog-drag
  328. >
  329. <extract-box-information :luHaiTongData="luHaiTongData"></extract-box-information>
  330. <span slot="footer" class="dialog-footer">
  331. <el-button @click="extractDialogvisible = false">取 消</el-button>
  332. <el-button type="primary" @click="extractDialogfun">导 入</el-button>
  333. </span>
  334. </el-dialog>
  335. <business-reports
  336. :id="assemblyForm.id"
  337. :itemIds="itemIds"
  338. ref="print"
  339. businessValue="HYCK"
  340. classifyCode="业务"
  341. groupCode="配箱预览,ADVICE"
  342. :treeType="false"
  343. :type="1"
  344. ></business-reports>
  345. <split-order ref="splitOrder" @getUpdata="getUpdata"></split-order>
  346. </div>
  347. </template>
  348. <script>
  349. import {
  350. containersDetail,
  351. containersSubmit,
  352. containersRemove,
  353. containersCleanBoxNo,
  354. containersRevoke,
  355. containersEqualDistribution,
  356. distributionBox,
  357. containersSubmitList,
  358. containersExportContainers,
  359. containersImportBoxNo,
  360. containersList,
  361. luHaiTongApiDetail,
  362. removeById,
  363. getRecordlist
  364. } from "@/api/iosBasicData/containers";
  365. import { getAccurate } from "@/api/boxManagement/buyContainer/index.js";
  366. import { mapGetters } from "vuex";
  367. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  368. import bports from "@/views/iosBasicData/bports/index.vue";
  369. import { bportsList } from "@/api/iosBasicData/bports";
  370. import { getToken } from "@/util/auth";
  371. import { decryptLhtData } from "@/util/lhtDataDesc";
  372. import extractBoxInformation from "@/views/iosBasicData/SeafreightExportF/bills/assembly/DistributionBox/extractBoxInformation.vue";
  373. import { billsAdd } from "@/api/iosBasicData/bills";
  374. import dicSelect from "@/components/dicSelect/main";
  375. import businessReports from "@/components/tradeAgency/businessReportsJK.vue";
  376. import { isProcurement } from "@/api/basicData/configuration";
  377. import splitOrder from "../components/splitOrder.vue";
  378. export default {
  379. components: { SearchQuery, bports, extractBoxInformation, dicSelect, businessReports, splitOrder },
  380. props: {
  381. assemblyForm: {},
  382. detailData: {},
  383. // 请核禁用
  384. pleasereviewType: {
  385. type: Boolean,
  386. default: false
  387. },
  388. showLock: {
  389. type: Boolean,
  390. default: false
  391. },
  392. disabled: {
  393. type: Boolean,
  394. default: false
  395. }
  396. },
  397. data() {
  398. return {
  399. headers: { "Blade-Auth": "Bearer " + getToken() },
  400. // 是否禁用
  401. extendedDisabled: false,
  402. recordData: [],
  403. recordOption: {
  404. align: "center",
  405. menu: false,
  406. header: false,
  407. border: true,
  408. column: [
  409. {
  410. label: "操作类型",
  411. prop: "operatorType",
  412. overHidden: true
  413. },
  414. {
  415. label: "操作内容",
  416. prop: "operatorContent",
  417. overHidden: true
  418. },
  419. {
  420. label: "操作人",
  421. prop: "operatorName",
  422. overHidden: true
  423. },
  424. {
  425. label: "操作时间",
  426. prop: "operatorDate",
  427. overHidden: true
  428. }
  429. ]
  430. },
  431. // 装货港数据
  432. polData: [],
  433. // 附件配置
  434. excelOption: {
  435. submitBtn: false,
  436. emptyBtn: false,
  437. column: [
  438. {
  439. label: "模板下载",
  440. prop: "excelTemplate",
  441. formslot: true,
  442. span: 24
  443. },
  444. {
  445. label: "模板上传",
  446. prop: "excelFile",
  447. type: "upload",
  448. drag: true,
  449. loadText: "模板上传中,请稍等",
  450. span: 24,
  451. propsHttp: {
  452. res: "data"
  453. },
  454. tip: "请上传 .xls,.xlsx 标准格式文件",
  455. action: "/api/blade-los/containers/importBoxNo"
  456. }
  457. ]
  458. },
  459. excelForm: {},
  460. excelLoading: false,
  461. excelBox: false,
  462. form: {},
  463. query: {},
  464. loading: false,
  465. loadingButton: false,
  466. // page: {
  467. // pageSize: 10,
  468. // currentPage: 1,
  469. // total: 0
  470. // },
  471. selectionList: [],
  472. option: {
  473. stripe: true,
  474. height: "250",
  475. calcHeight: 30,
  476. tip: false,
  477. searchShow: true,
  478. searchMenuSpan: 6,
  479. border: true,
  480. index: true,
  481. viewBtn: true,
  482. selection: true,
  483. dialogClickModal: false,
  484. refreshBtn: false,
  485. columnBtn: false,
  486. menu: true,
  487. menuWidth: 90,
  488. summaryText: "合计",
  489. showSummary: true,
  490. highlightCurrentRow: true,
  491. sumColumnList: [
  492. {
  493. name: "quantity",
  494. type: "sum",
  495. decimals: 0
  496. },
  497. {
  498. name: "grossWeight",
  499. type: "sum",
  500. decimals: 3
  501. },
  502. {
  503. name: "measurement",
  504. type: "sum",
  505. decimals: 3
  506. },
  507. {
  508. name: "tare",
  509. type: "sum",
  510. decimals: 0
  511. },
  512. {
  513. name: "vgmWeight",
  514. type: "sum",
  515. decimals: 3
  516. }
  517. ],
  518. column: [
  519. {
  520. label: this.$t("sea118n.ctnrType"),
  521. prop: "cntrTypeCode",
  522. width: "100"
  523. },
  524. {
  525. label: this.$t("sea118n.ctnrNo"),
  526. prop: "cntrNo",
  527. width: "140",
  528. overHidden: true
  529. },
  530. {
  531. label: this.$t("sea118n.sealNo"),
  532. prop: "sealNo",
  533. width: "140",
  534. overHidden: true
  535. },
  536. {
  537. label: "HB/L NO",
  538. prop: "hblno",
  539. width: "140",
  540. overHidden: true
  541. },
  542. {
  543. label: this.$t("sea118n.quantity"),
  544. prop: "quantity",
  545. width: "80"
  546. },
  547. {
  548. label: this.$t("sea118n.GW"),
  549. prop: "grossWeight",
  550. width: "120"
  551. },
  552. // {
  553. // label: "净重(KGM)",
  554. // prop: "netWeight",
  555. // width: "120",
  556. // },
  557. {
  558. label: this.$t("sea118n.CBM"),
  559. prop: "measurement",
  560. width: "100"
  561. },
  562. {
  563. label: this.$t("sea118n.ctnrTare"),
  564. prop: "tare",
  565. width: "140",
  566. overHidden: true
  567. },
  568. {
  569. label: "VGM(KGM)",
  570. prop: "vgmWeight",
  571. width: "140",
  572. overHidden: true
  573. },
  574. {
  575. label: "remarks",
  576. prop: "remarks",
  577. type: "textarea",
  578. width: 180,
  579. slot: true,
  580. minRows: 3,
  581. span: 24
  582. },
  583. {
  584. label: "箱来源类型",
  585. prop: "boxSrcType",
  586. width: "140",
  587. overHidden: true
  588. },
  589. {
  590. label: "放箱号",
  591. prop: "containerNumber",
  592. width: 100,
  593. overHidden: true
  594. },
  595. {
  596. label: "PODCY",
  597. prop: "podStationCname",
  598. width: "140",
  599. overHidden: true
  600. },
  601. {
  602. label: "POLCY",
  603. prop: "polCyCname",
  604. width: "140",
  605. overHidden: true
  606. },
  607. {
  608. label: "podReturnDate",
  609. prop: "podEmptyContainerReturnDate",
  610. width: "160",
  611. overHidden: true
  612. },
  613. {
  614. label: "目的港场站联系人",
  615. prop: "podCyContact",
  616. width: 120,
  617. overHidden: true
  618. },
  619. {
  620. label: "目的港场站地址",
  621. prop: "podCyAddress",
  622. width: 120,
  623. overHidden: true
  624. },
  625. {
  626. label: "目的港场站邮箱",
  627. prop: "podCyEmail",
  628. width: 120,
  629. overHidden: true
  630. },
  631. {
  632. label: "目的港场站电话",
  633. prop: "podCyTel",
  634. width: 120,
  635. overHidden: true
  636. },
  637. {
  638. label: this.$t("sea118n.createTime"),
  639. prop: "createTime",
  640. width: 150,
  641. type: "date",
  642. format: "yyyy-MM-dd HH:mm:ss",
  643. valueFormat: "yyyy-MM-dd HH:mm:ss",
  644. overHidden: true
  645. },
  646. {
  647. label: this.$t("sea118n.updateTime"),
  648. prop: "updateTime",
  649. width: 150,
  650. type: "date",
  651. format: "yyyy-MM-dd HH:mm:ss",
  652. valueFormat: "yyyy-MM-dd HH:mm:ss",
  653. overHidden: true
  654. }
  655. // {
  656. // label: "MARKS",
  657. // prop: "marks",
  658. // },
  659. ]
  660. },
  661. data: [],
  662. luHaiTongData: [], // 提取请求到解析的数据
  663. extractDialogvisible: false, // 提取请求到的数据展示
  664. isOccupyNum: false
  665. };
  666. },
  667. computed: {
  668. ...mapGetters(["permission"]),
  669. permissionList() {
  670. return {
  671. addBtn: this.vaildData(this.permission.containers_add, false),
  672. viewBtn: this.vaildData(this.permission.containers_view, false),
  673. delBtn: this.vaildData(this.permission.containers_delete, false),
  674. editBtn: this.vaildData(this.permission.containers_edit, false)
  675. };
  676. },
  677. ids() {
  678. let ids = [];
  679. this.selectionList.forEach(ele => {
  680. ids.push(ele.id);
  681. });
  682. return ids.join(",");
  683. }
  684. },
  685. created() {
  686. isProcurement({ param: "is.occupyNum" }).then(res => {
  687. if (res.data.data == 1) {
  688. this.isOccupyNum = true;
  689. }
  690. });
  691. },
  692. methods: {
  693. handleCurrentRowChange(val) {
  694. console.log(val, 111);
  695. this.$emit("selectionChange", [val]);
  696. },
  697. allClick(name) {
  698. if (name == "合拆票") {
  699. for (let item of this.selectionList) {
  700. if (!item.cntrNo) {
  701. return this.$message.error("箱号不能为空");
  702. }
  703. if (!item.containerNumber) {
  704. return this.$message.error("放箱号不能为空");
  705. }
  706. }
  707. this.$refs.splitOrder.openDialog(this.assemblyForm, this.ids);
  708. }
  709. },
  710. outExport() {
  711. this.$confirm("是否导出当前所有数据?", "提示", {
  712. confirmButtonText: "确定",
  713. cancelButtonText: "取消",
  714. type: "warning"
  715. }).then(() => {
  716. let queryParams = {};
  717. queryParams = {
  718. pid: this.assemblyForm.id
  719. };
  720. const routeData = this.$router.resolve({
  721. path: "/api/blade-los/containers/exportContainersList", //跳转目标窗口的地址
  722. query: {
  723. "Blade-Auth": getToken(),
  724. ...queryParams //括号内是要传递给新窗口的参数
  725. }
  726. });
  727. window.open(routeData.href.slice(1, routeData.href.length));
  728. });
  729. },
  730. computeChange(row) {
  731. row.vgmWeight = Number(Number(row.grossWeight ? row.grossWeight : 0) + Number(row.tare ? row.tare : 0)).toFixed(3);
  732. },
  733. rowDicChange(name, row, el) {
  734. if (name == "podCyContact") {
  735. if (row) {
  736. el.podCyAddress = row.addr;
  737. el.podCyEmail = row.email;
  738. el.podCyTel = row.tel;
  739. } else {
  740. el.podCyContact = null;
  741. el.podCyAddress = null;
  742. el.podCyEmail = null;
  743. el.podCyTel = null;
  744. }
  745. }
  746. if (name == "podStationCname") {
  747. if (row) {
  748. el.podStationId = row.id;
  749. el.podStationCode = row.code;
  750. el.podStationEname = row.enName;
  751. } else {
  752. el.podStationId = null;
  753. el.podStationCode = null;
  754. el.podStationEname = null;
  755. el.podStationCname = null;
  756. }
  757. }
  758. if (name == "polCyCname") {
  759. if (row) {
  760. el.polCyId = row.id;
  761. el.polCyCode = row.code;
  762. el.polCyEname = row.enName;
  763. } else {
  764. el.polCyId = null;
  765. el.polCyCode = null;
  766. el.polCyCname = null;
  767. el.polCyEname = null;
  768. }
  769. }
  770. },
  771. // 提取箱信息
  772. extractBoxInformation() {
  773. if (!this.assemblyForm.id) {
  774. return this.$message.warning("请先保存数据");
  775. }
  776. if (!this.assemblyForm.mblno) {
  777. return this.$message.warning("请先填写MB/L NO");
  778. }
  779. if (!this.assemblyForm.cyCode) {
  780. return this.$message.warning("请先选择场站");
  781. }
  782. if (this.assemblyForm.containersList.length == 0) {
  783. return this.$message.warning("请先进行配箱");
  784. }
  785. this.loadingButton = true;
  786. luHaiTongApiDetail({
  787. billNo: this.assemblyForm.mblno,
  788. station: this.assemblyForm.cyCode
  789. }).then(res => {
  790. this.loadingButton = false;
  791. this.luHaiTongData = decryptLhtData(JSON.parse(res.data.data).data);
  792. console.log(this.luHaiTongData, 348);
  793. if (this.luHaiTongData.containerCargoInfos.length == 0) {
  794. return this.$message.warning("提取到的数据为空");
  795. }
  796. this.extractDialogvisible = true;
  797. });
  798. },
  799. // 提取箱信息弹窗里的导入
  800. extractDialogfun() {
  801. // if (this.assemblyForm.containersList.length != this.luHaiTongData.containerCargoInfos.length) {
  802. // this.$confirm(`箱量不相等,委托数量为${this.assemblyForm.containersList.length},场站数量为${this.luHaiTongData.containerCargoInfos.length}?是否继续`, '提示', {
  803. // confirmButtonText: '确定',
  804. // cancelButtonText: '取消',
  805. // type: 'warning'
  806. // }).then(()=>{
  807. // this.extractionProcessing()
  808. // }).catch(()=>{
  809. // return
  810. // })
  811. // }else {
  812. // this.extractionProcessing()
  813. // }
  814. this.extractionProcessing();
  815. },
  816. // 数据处理
  817. extractionProcessing() {
  818. let returnType = 0; // 判断是否需要合计
  819. // 把请求到的箱号和封号赋值
  820. this.luHaiTongData.containerCargoInfos.map((luHaiTongItem, luHaiTongIndex) => {
  821. if (!this.assemblyForm.containersList[luHaiTongIndex].cyCntrCode) {
  822. return this.$message.warning("请先去基础资料集装箱里维护数据");
  823. }
  824. if (luHaiTongItem.size + "" + luHaiTongItem.property == this.assemblyForm.containersList[luHaiTongIndex].cyCntrCode) {
  825. this.assemblyForm.containersList[luHaiTongIndex].cntrNo = luHaiTongItem.containerNo;
  826. this.assemblyForm.containersList[luHaiTongIndex].sealNo = luHaiTongItem.sealNo;
  827. // 判断没有没有返厂时间,如果没有不合计前面的
  828. if (!luHaiTongItem.returnDate) {
  829. returnType++;
  830. }
  831. }
  832. });
  833. // 统计提取同一箱号的好件重尺合计赋值
  834. let quantitySum = 0;
  835. let grossWeightSum = 0;
  836. let measurementSum = 0;
  837. this.assemblyForm.containersList.map((containersItem, containersIndex) => {
  838. let numberSum = 0;
  839. let weightSum = 0;
  840. let volSum = 0;
  841. for (let loadingItem of this.luHaiTongData.loadingInfos) {
  842. if (loadingItem.containerNo == containersItem.cntrNo) {
  843. numberSum += loadingItem.number;
  844. weightSum += loadingItem.weight;
  845. volSum += loadingItem.vol;
  846. }
  847. }
  848. containersItem.quantity = numberSum;
  849. containersItem.grossWeight = weightSum;
  850. containersItem.measurement = volSum;
  851. // 把件重尺进行合计判断主表件重尺是否相等
  852. quantitySum += containersItem.quantity;
  853. grossWeightSum += containersItem.grossWeight;
  854. measurementSum += containersItem.measurement;
  855. });
  856. console.log(quantitySum, grossWeightSum, measurementSum, 366);
  857. // 判断合计的件重尺是否等于朱标的件重尺
  858. if (
  859. this.assemblyForm.containersList.length == this.luHaiTongData.containerCargoInfos.length &&
  860. this.assemblyForm.quantity == quantitySum &&
  861. this.assemblyForm.grossWeight == grossWeightSum &&
  862. this.assemblyForm.measurement == measurementSum
  863. ) {
  864. this.extractDialogvisible = false;
  865. this.$emit("billsAddfun"); // 全都相等直接走大保存
  866. } else {
  867. this.$alert(
  868. "<div>委托:箱数,件重尺 场站:箱数,件重尺不相等</div>" +
  869. '<table border="1" width="100%">\n' +
  870. " <thead>\n" +
  871. " <tr>\n" +
  872. " <th></th>\n" +
  873. " <th>箱数</th>\n" +
  874. " <th>件数</th>\n" +
  875. " <th>毛重</th>\n" +
  876. " <th>尺码</th>\n" +
  877. " </tr>\n" +
  878. " </thead>\n" +
  879. " <tbody>\n" +
  880. " <tr>\n" +
  881. " <td>委托</td>\n" +
  882. " <td>" +
  883. this.assemblyForm.containersList.length +
  884. "</td>\n" +
  885. " <td>" +
  886. this.assemblyForm.quantity +
  887. "</td>\n" +
  888. " <td>" +
  889. this.assemblyForm.grossWeight +
  890. "</td>\n" +
  891. " <td>" +
  892. this.assemblyForm.measurement +
  893. "</td>\n" +
  894. " </tr>\n" +
  895. " <tr>\n" +
  896. " <td>场站</td>\n" +
  897. " <td>" +
  898. this.luHaiTongData.containerCargoInfos.length +
  899. "</td>\n" +
  900. " <td>" +
  901. quantitySum +
  902. "</td>\n" +
  903. " <td>" +
  904. grossWeightSum +
  905. "</td>\n" +
  906. " <td>" +
  907. measurementSum +
  908. "</td>\n" +
  909. " </tr>\n" +
  910. " </tbody>\n" +
  911. "</table>",
  912. "提示",
  913. {
  914. dangerouslyUseHTMLString: true,
  915. confirmButtonText: "确定",
  916. cancelButtonText: "关闭",
  917. // showCancelButton:true,
  918. type: "warning"
  919. }
  920. )
  921. .then(() => {
  922. console.log("确认");
  923. // 箱数不等 不更新前面的
  924. if (this.assemblyForm.containersList.length == this.luHaiTongData.containerCargoInfos.length) {
  925. for (let item of this.assemblyForm.preContainersList) {
  926. let pieceSum = 0;
  927. let weightSum = 0;
  928. let chiSum = 0;
  929. for (let ite of this.assemblyForm.containersList) {
  930. if (item.cntrTypeCode == ite.cyCntrCode) {
  931. pieceSum += ite.quantity;
  932. weightSum += ite.grossWeight;
  933. chiSum += ite.measurement;
  934. }
  935. }
  936. item.number = pieceSum;
  937. item.grossWeight = weightSum;
  938. item.measurement = chiSum;
  939. }
  940. this.assemblyForm.quantity = quantitySum;
  941. this.assemblyForm.grossWeight = grossWeightSum;
  942. this.assemblyForm.measurement = measurementSum;
  943. }
  944. this.extractDialogvisible = false;
  945. this.$emit("billsAddfun"); // 全都相等直接走大保存
  946. })
  947. .catch(() => {
  948. console.log("取消");
  949. });
  950. }
  951. },
  952. // 输入自动大写
  953. cntrNoInput(row, name) {
  954. this.$set(row, name, row[name].toLocaleUpperCase().replace(/[\W]/g, ""));
  955. },
  956. verifyChange(row, name) {
  957. if (row[name]) {
  958. getAccurate({ accurate: row[name] }).then(res => {
  959. if (res.data.data.records.length == 0) {
  960. const regex = /^([a-zA-Z]{4})([0-9]{7})$/;
  961. if (regex.test(row[name])) {
  962. if (this.calculateCheckDigit(row[name]) == row[name][10]) {
  963. // this.$message.success('集装箱校验正确!')
  964. } else {
  965. this.$confirm(`<strong><p style='color:#F56C6C'>箱号:${row[name]},格式不正确,是否强制加入系统?</p ></strong>`, "提示", {
  966. confirmButtonText: "确定",
  967. cancelButtonText: "取消",
  968. dangerouslyUseHTMLString: true,
  969. type: "warning"
  970. })
  971. .then(() => {
  972. // this.$message({
  973. // type: 'success',
  974. // message: '删除成功!'
  975. // });
  976. })
  977. .catch(() => {
  978. this.$set(row, [name], null);
  979. });
  980. }
  981. } else {
  982. this.$confirm(`<strong><p style='color:#F56C6C'>箱号:${row[name]},格式不正确,是否强制加入系统?</p ></strong>`, "提示", {
  983. confirmButtonText: "确定",
  984. cancelButtonText: "取消",
  985. dangerouslyUseHTMLString: true,
  986. type: "warning"
  987. })
  988. .then(() => {
  989. // this.$message({
  990. // type: 'success',
  991. // message: '删除成功!'
  992. // });
  993. })
  994. .catch(() => {
  995. this.$set(row, [name], null);
  996. });
  997. }
  998. }
  999. });
  1000. }
  1001. },
  1002. calculateCheckDigit(containerNo) {
  1003. let charCode = "0123456789A?BCDEFGHIJK?LMNOPQRSTU?VWXYZ";
  1004. let num = 0;
  1005. for (let i = 0; i < 10; i++) {
  1006. let idx = charCode.indexOf(containerNo[i]);
  1007. idx = idx * Math.pow(2, i);
  1008. num += idx;
  1009. }
  1010. return (num = (num % 11) % 10);
  1011. },
  1012. oepnexcelBox() {
  1013. if (!this.assemblyForm.id) {
  1014. this.$message({
  1015. message: "请先点击右上角保存按钮,保存数据之后才能添加!",
  1016. type: "warning"
  1017. });
  1018. return;
  1019. }
  1020. this.findObject(this.excelOption.column, "excelFile").action = "/api/blade-los/containers/importBoxNo?billId=" + this.assemblyForm.id;
  1021. this.excelBox = true;
  1022. },
  1023. uploadBefore(file, done, loading) {
  1024. 681169;
  1025. done();
  1026. loading = true;
  1027. },
  1028. // 上传成功
  1029. onSuccess(res, done, loading, column) {
  1030. this.excelBox = false;
  1031. // this.$message.success("导入成功!");
  1032. this.containersListfun();
  1033. loading = false;
  1034. done();
  1035. },
  1036. // 箱列表
  1037. containersListfun() {
  1038. containersList(1, 100, { pid: this.assemblyForm.id }).then(res => {
  1039. this.assemblyForm.containersList = res.data.data.records;
  1040. });
  1041. },
  1042. addRow() {
  1043. if (this.assemblyForm.preContainersList.length == 0) {
  1044. return this.$message.error("箱型箱量没数据,不允许新建");
  1045. }
  1046. if (this.assemblyForm.boxBelongsTo == "SOC" && this.assemblyForm.billType == "MH" && this.assemblyForm.billType == "MH" && this.isOccupyNum) {
  1047. if (this.assemblyForm.preContainersList.filter(item => item.containerNumberStatus == "录入").length) {
  1048. return this.$message.error("请先占用放箱号");
  1049. }
  1050. }
  1051. let boxNum = 0;
  1052. for (let item of this.assemblyForm.preContainersList) {
  1053. boxNum += Number(item.quantity);
  1054. }
  1055. if (this.assemblyForm.containersList.length >= boxNum) {
  1056. return this.$message.error("新增数量不允许超过委托信息的总箱量");
  1057. }
  1058. this.assemblyForm.containersList.unshift({
  1059. edit: true,
  1060. pid: this.assemblyForm.id,
  1061. quantity: 0,
  1062. grossWeight: 0,
  1063. measurement: 0,
  1064. mblno: this.assemblyForm.mblno
  1065. });
  1066. },
  1067. equalDistribution2() {
  1068. if (!this.assemblyForm.id) {
  1069. this.$message({
  1070. message: "请先点击右上角保存按钮,保存数据之后才能添加!",
  1071. type: "warning"
  1072. });
  1073. return;
  1074. }
  1075. if (this.assemblyForm.boxBelongsTo == "SOC" && this.assemblyForm.billType == "MH" && this.isOccupyNum) {
  1076. if (this.assemblyForm.preContainersList.filter(item => item.containerNumberStatus == "录入").length) {
  1077. return this.$message.error("请先占用放箱号");
  1078. }
  1079. }
  1080. this.$confirm("是否确认配箱?", {
  1081. confirmButtonText: "确定",
  1082. cancelButtonText: "取消",
  1083. type: "warning"
  1084. }).then(() => {
  1085. distributionBox({ billId: this.assemblyForm.id }).then(res => {
  1086. this.$message({
  1087. type: "success",
  1088. message: "操作成功!"
  1089. });
  1090. this.$emit("billsDetailfun");
  1091. });
  1092. });
  1093. },
  1094. // 平均箱量
  1095. equalDistribution(type) {
  1096. if (!this.assemblyForm.id) {
  1097. this.$message({
  1098. message: "请先点击右上角保存按钮,保存数据之后才能添加!",
  1099. type: "warning"
  1100. });
  1101. return;
  1102. }
  1103. if (this.assemblyForm.waitingBoxList.length <= 0) {
  1104. this.$message({
  1105. type: "warning",
  1106. message: "请先添加集装箱数据!"
  1107. });
  1108. return;
  1109. }
  1110. if (this.assemblyForm.preContainersList <= 0) {
  1111. this.$message({
  1112. type: "warning",
  1113. message: "请先添加箱型数据!"
  1114. });
  1115. return;
  1116. }
  1117. this.$confirm("确定平均分配?", {
  1118. confirmButtonText: "确定",
  1119. cancelButtonText: "取消",
  1120. type: "warning"
  1121. }).then(() => {
  1122. this.containersEqualDistributionfun(type);
  1123. });
  1124. },
  1125. // 平均分配接口
  1126. containersEqualDistributionfun(type) {
  1127. containersEqualDistribution({
  1128. pid: this.assemblyForm.id,
  1129. type: type,
  1130. waitingBox: this.assemblyForm.waitingBoxList[0]
  1131. }).then(res => {
  1132. if (res.data.data instanceof Array) {
  1133. this.$message({
  1134. type: "success",
  1135. message: "操作成功!"
  1136. });
  1137. this.$emit("billsDetailfun");
  1138. } else {
  1139. // 没有除开
  1140. this.$message({
  1141. type: "warning",
  1142. dangerouslyUseHTMLString: true,
  1143. message:
  1144. '<span style="color:red">注意!!!件数不能平均分 ,请手工配箱,或者修改件数.</span>\n' +
  1145. '<table border="1">\n' +
  1146. " <thead>\n" +
  1147. " <tr>\n" +
  1148. " <th></th>\n" +
  1149. " <th>件数</th>\n" +
  1150. " <th>毛重</th>\n" +
  1151. " <th>尺码</th>\n" +
  1152. " </tr>\n" +
  1153. " </thead>\n" +
  1154. " <tbody>\n" +
  1155. " <tr>\n" +
  1156. " <td>总数</td>\n" +
  1157. " <td>" +
  1158. res.data.data.total.quantity +
  1159. "</td>\n" +
  1160. " <td>" +
  1161. res.data.data.total.grossWeight +
  1162. "</td>\n" +
  1163. " <td>" +
  1164. res.data.data.total.grossWeight +
  1165. "</td>\n" +
  1166. " </tr>\n" +
  1167. " <tr>\n" +
  1168. " <td>入箱</td>\n" +
  1169. " <td>" +
  1170. res.data.data.average.quantity +
  1171. "</td>\n" +
  1172. " <td>" +
  1173. res.data.data.average.grossWeight +
  1174. "</td>\n" +
  1175. " <td>" +
  1176. res.data.data.average.grossWeight +
  1177. "</td>\n" +
  1178. " </tr>\n" +
  1179. " <tr>\n" +
  1180. " <td>差额</td>\n" +
  1181. " <td>" +
  1182. res.data.data.subtract.quantity +
  1183. "</td>\n" +
  1184. " <td>" +
  1185. res.data.data.subtract.grossWeight +
  1186. "</td>\n" +
  1187. " <td>" +
  1188. res.data.data.subtract.grossWeight +
  1189. "</td>\n" +
  1190. " </tr>\n" +
  1191. " </tbody>\n" +
  1192. "</table>",
  1193. duration: 5000
  1194. });
  1195. }
  1196. });
  1197. },
  1198. // 下载模板
  1199. handleGet() {
  1200. window.open(`/api/blade-los/containers/exportContainers?${this.website.tokenHeader}=${getToken()}&pid=${this.assemblyForm.id}`);
  1201. },
  1202. // 查询件数是否为零
  1203. numberfalsefun() {
  1204. if (!this.assemblyForm.containersList) {
  1205. return false;
  1206. }
  1207. for (let item of this.assemblyForm.containersList) {
  1208. if (Number(item.quantity) >= 0) {
  1209. return true;
  1210. } else {
  1211. return false;
  1212. }
  1213. }
  1214. },
  1215. // // 平均分配
  1216. // equalDistribution() {
  1217. // if (this.assemblyForm.waitingBoxList.length <= 0) {
  1218. // this.$message({
  1219. // type: "warning",
  1220. // message: "请先添加集装箱数据!"
  1221. // });
  1222. // return
  1223. // }
  1224. // this.$confirm("确定平均分配?", {
  1225. // confirmButtonText: "确定",
  1226. // cancelButtonText: "取消",
  1227. // type: "warning"
  1228. // }).then(() => {
  1229. // this.$emit('equalDistribution')
  1230. // })
  1231. // },
  1232. // 一键编辑
  1233. rootEditfun() {
  1234. for (let item of this.assemblyForm.containersList) {
  1235. this.$delete(item, "edit");
  1236. this.$set(item, "edit", true);
  1237. }
  1238. },
  1239. // 编辑
  1240. rowCellfun(row, index) {
  1241. this.$delete(row, "edit");
  1242. this.$set(row, "edit", true);
  1243. },
  1244. // 保存
  1245. rowSavefun(row) {
  1246. this.$delete(row, "edit");
  1247. this.$set(row, "edit", false);
  1248. this.$emit("rowSavefun", row);
  1249. },
  1250. // 清除箱号
  1251. cleanCntrNofun() {
  1252. this.$confirm("确定将数据清除全部箱号?", {
  1253. confirmButtonText: "确定",
  1254. cancelButtonText: "取消",
  1255. type: "warning"
  1256. }).then(() => {
  1257. let arrids = [];
  1258. if (this.assemblyForm.billType != "MM") {
  1259. for (let item of this.assemblyForm.containersList.filter(item => !item.containerNumber)) {
  1260. arrids.push(item.id);
  1261. }
  1262. } else {
  1263. for (let item of this.assemblyForm.containersList) {
  1264. arrids.push(item.id);
  1265. }
  1266. }
  1267. // 清除箱号接口
  1268. if (arrids.length) {
  1269. containersCleanBoxNo(arrids.join(",")).then(res => {
  1270. this.$message({
  1271. type: "success",
  1272. message: "清除箱号成功!"
  1273. });
  1274. this.$emit("billsDetailfun");
  1275. });
  1276. }
  1277. });
  1278. },
  1279. // 全部撤销
  1280. wholeRevokefun() {
  1281. this.$confirm("是否清除所有数据的件重尺?", {
  1282. confirmButtonText: "确定",
  1283. cancelButtonText: "取消",
  1284. type: "warning"
  1285. }).then(() => {
  1286. let arrids = [];
  1287. if (this.assemblyForm.billType != "MM") {
  1288. for (let item of this.assemblyForm.containersList.filter(item => !item.containerNumber)) {
  1289. arrids.push(item.id);
  1290. }
  1291. } else {
  1292. for (let item of this.assemblyForm.containersList) {
  1293. arrids.push(item.id);
  1294. }
  1295. }
  1296. if (arrids.length) {
  1297. containersRevoke(arrids.join(",")).then(res => {
  1298. this.$message({
  1299. type: "success",
  1300. message: "全部撤销成功!"
  1301. });
  1302. this.$emit("billsDetailfun");
  1303. });
  1304. }
  1305. });
  1306. },
  1307. // 撤销
  1308. revokefun() {
  1309. if (this.selectionList.length > 0) {
  1310. let arrids = [];
  1311. for (let item of this.selectionList) {
  1312. if (item.containerNumber && this.assemblyForm.billType != "MM") {
  1313. return this.$message.error("放箱号有值,不允许清空");
  1314. }
  1315. arrids.push(item.id);
  1316. }
  1317. if (arrids.length) {
  1318. containersRevoke(arrids.join(",")).then(res => {
  1319. this.$message({
  1320. type: "success",
  1321. message: "撤销成功!"
  1322. });
  1323. this.$emit("billsDetailfun");
  1324. });
  1325. }
  1326. } else {
  1327. this.$message({
  1328. type: "warning",
  1329. message: "请选选择要撤销的数据!"
  1330. });
  1331. }
  1332. },
  1333. // 配箱批量保存
  1334. containersSubmitListfun() {
  1335. if (!this.assemblyForm.id) {
  1336. this.$message.warning("请先大保存");
  1337. return;
  1338. }
  1339. for (let item of this.assemblyForm.containersList) {
  1340. if (!item.cntrTypeCode) {
  1341. return this.$message.error("请选择箱型");
  1342. }
  1343. }
  1344. for (let item of this.assemblyForm.preContainersList) {
  1345. if (this.assemblyForm.containersList.filter(e => e.cntrTypeCode == item.cntrTypeCode).length > item.quantity) {
  1346. return this.$message.error(`${item.cntrTypeCode}箱量不能超过${item.quantity}条`);
  1347. }
  1348. // let qtySUM = 0;
  1349. // for (let row of this.assemblyForm.containersList) {
  1350. // if (item.cntrTypeCode == row.cntrTypeCode) {
  1351. // qtySUM += Number(row.quantity);
  1352. // }
  1353. // if (qtySUM > item.number) {
  1354. // return this.$message.error(`箱型:${item.cntrTypeCode}的总数量不能超过${item.number}`);
  1355. // }
  1356. // }
  1357. }
  1358. this.$confirm("确定全部保存配箱?", {
  1359. confirmButtonText: "确定",
  1360. cancelButtonText: "取消",
  1361. type: "warning"
  1362. }).then(() => {
  1363. containersSubmitList(this.assemblyForm.containersList).then(res => {
  1364. this.$message({
  1365. type: "success",
  1366. message: "操作成功!"
  1367. });
  1368. this.$emit("billsDetailfun");
  1369. });
  1370. });
  1371. },
  1372. rowSave(row, done, loading) {
  1373. containersSubmit(row).then(
  1374. () => {
  1375. // this.onLoad(this.page);
  1376. this.$message({
  1377. type: "success",
  1378. message: "操作成功!"
  1379. });
  1380. done();
  1381. },
  1382. error => {
  1383. loading();
  1384. window.console.log(error);
  1385. }
  1386. );
  1387. },
  1388. rowUpdate(row, index, done, loading) {
  1389. containersSubmit(row).then(
  1390. () => {
  1391. // this.onLoad(this.page);
  1392. this.$message({
  1393. type: "success",
  1394. message: "操作成功!"
  1395. });
  1396. done();
  1397. },
  1398. error => {
  1399. loading();
  1400. console.log(error);
  1401. }
  1402. );
  1403. },
  1404. rowRecord(row) {
  1405. this.recordData = [];
  1406. let obj = {
  1407. pid: row.id
  1408. };
  1409. getRecordlist(1, 50, obj).then(res => {
  1410. this.recordData = res.data.data.records;
  1411. });
  1412. },
  1413. // 删除
  1414. rowDel(row, index) {
  1415. // if (row.containerNumber) {
  1416. // return this.$message.error("放箱号有值,不允许删除");
  1417. // }
  1418. if (row.id) {
  1419. this.$confirm("确定将选择数据删除?", {
  1420. confirmButtonText: "确定",
  1421. cancelButtonText: "取消",
  1422. type: "warning"
  1423. }).then(() => {
  1424. removeById(row.id).then(() => {
  1425. // this.onLoad(this.page);
  1426. this.$message({
  1427. type: "success",
  1428. message: "操作成功!"
  1429. });
  1430. this.$emit("billsDetailfun");
  1431. this.$refs.crud.toggleSelection();
  1432. });
  1433. });
  1434. } else {
  1435. this.assemblyForm.containersList.splice(index, 1);
  1436. }
  1437. },
  1438. // 一键删除
  1439. handleDelete() {
  1440. for (let item of this.assemblyForm.containersList) {
  1441. if (!item.id) return this.$message.error("明细存在未保存数据,请点击行删除");
  1442. if (item.quantity > 0) return this.$message.error("请先撤销,再删除配箱");
  1443. }
  1444. this.$confirm("确定将全部数据删除?", {
  1445. confirmButtonText: "确定",
  1446. cancelButtonText: "取消",
  1447. type: "warning"
  1448. }).then(() => {
  1449. let arrids = [];
  1450. if (this.assemblyForm.billType != "MM") {
  1451. for (let item of this.assemblyForm.containersList.filter(item => !item.containerNumber)) {
  1452. arrids.push(item.id);
  1453. }
  1454. } else {
  1455. for (let item of this.assemblyForm.containersList) {
  1456. arrids.push(item.id);
  1457. }
  1458. }
  1459. if (arrids.length) {
  1460. containersRemove(arrids.join(",")).then(() => {
  1461. // this.onLoad(this.page);
  1462. this.$message({
  1463. type: "success",
  1464. message: "操作成功!"
  1465. });
  1466. this.$emit("billsDetailfun");
  1467. this.$refs.crud.toggleSelection();
  1468. });
  1469. }
  1470. });
  1471. },
  1472. getUpdata() {
  1473. this.$emit("billsDetailfun");
  1474. },
  1475. beforeOpen(done, type) {
  1476. if (["edit", "view"].includes(type)) {
  1477. containersDetail(this.form.id).then(res => {
  1478. this.form = res.data.data;
  1479. });
  1480. }
  1481. done();
  1482. },
  1483. // 当选择项发生变化时会触发该事件
  1484. selectionChange(list) {
  1485. // let arr = [];
  1486. // if (list.length > 1) {
  1487. // this.$refs.crud.toggleSelection(); // 先清空所以选择的数据
  1488. // arr = [list[list.length - 1]]; // 获取最新点击的数组
  1489. // this.$refs.crud.toggleSelection(arr, true); // 把刚点击的数组变成选择状态
  1490. // } else {
  1491. // arr = list;
  1492. // }
  1493. // this.selectionList = arr;
  1494. // this.$emit("selectionChange", this.selectionList);
  1495. this.selectionList = list;
  1496. },
  1497. inPitch() {
  1498. this.$refs.crud.toggleRowSelection(this.assemblyForm.containersList[0], true);
  1499. },
  1500. selectionClear() {
  1501. this.selectionList = [];
  1502. this.$refs.crud.toggleSelection();
  1503. },
  1504. refreshChange() {
  1505. console.log("刷新");
  1506. // this.onLoad(this.page, this.query);
  1507. },
  1508. // onLoad(page, params = {}) {
  1509. // this.loading = true;
  1510. // containersList(page.currentPage, page.pageSize, {...Object.assign(params, this.query),pid:this.pid}).then(res => {
  1511. // const data = res.data.data;
  1512. // this.page.total = data.total;
  1513. // this.data = data.records
  1514. // this.loading = false;
  1515. // this.selectionClear();
  1516. // });
  1517. // }
  1518. // 更改表格颜色
  1519. headerClassName(tab) {
  1520. //颜色间隔
  1521. let back = "";
  1522. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  1523. if (tab.columnIndex % 2 === 0) {
  1524. back = "back-one";
  1525. } else if (tab.columnIndex % 2 === 1) {
  1526. back = "back-two";
  1527. }
  1528. }
  1529. return back;
  1530. }
  1531. }
  1532. };
  1533. </script>
  1534. <style scoped lang="scss">
  1535. ::v-deep#out-table .back-one {
  1536. background: #ecf5ff !important;
  1537. text-align: center;
  1538. padding: 4px 0;
  1539. }
  1540. ::v-deep#out-table .back-two {
  1541. background: #ecf5ff !important;
  1542. text-align: center;
  1543. padding: 4px 0;
  1544. }
  1545. ::v-deep .el-table .cell {
  1546. padding: 0 2px !important;
  1547. }
  1548. ::v-deep .el-input__inner {
  1549. padding-left: 5px !important;
  1550. }
  1551. </style>