containers.vue 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516
  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. type="danger"
  102. size="small"
  103. plain
  104. :disabled="detailData.seeDisabled || selectionList.length == 0 || disabled"
  105. @click.stop="allClick('拆单')"
  106. >拆单</el-button
  107. >
  108. <!-- <el-button type="success" size="small" plain @click.stop="$refs.splitOrder.openDialog(assemblyForm)">合票</el-button> -->
  109. <el-button type="success" size="small" plain @click.stop="$refs.print.openDialog()">
  110. {{ $t("btn118n.preview") }}
  111. </el-button>
  112. <el-button type="success" size="small" @click.stop="outExport">
  113. {{ $t("btn118n.exportData") }}
  114. </el-button>
  115. <!--<el-button type="warning" size="small"-->
  116. <!-- :disabled="numberfalsefun() || assemblyForm.id"-->
  117. <!-- @click="equalDistribution">平均分配</el-button>-->
  118. </div>
  119. <!--<div>-->
  120. <!-- <el-button size="small">Copy</el-button>-->
  121. <!-- <el-button size="small">查看箱信息</el-button>-->
  122. <!-- <el-button size="small">校验箱信息</el-button>-->
  123. <!--</div>-->
  124. </div>
  125. </template>
  126. <template slot-scope="scope" slot="menu">
  127. <!-- <el-button v-if="scope.row.edit" :type="scope.type" :size="scope.size" icon="el-icon-edit" @click.stop="rowSavefun(scope.row, scope.index)"
  128. >保存
  129. </el-button>
  130. <el-button
  131. v-else
  132. :type="scope.type"
  133. :size="scope.size"
  134. icon="el-icon-edit"
  135. :disabled="detailData.seeDisabled || pleasereviewType || showLock"
  136. @click.stop="rowCellfun(scope.row, scope.index)"
  137. >编辑
  138. </el-button> -->
  139. <el-button
  140. v-if="assemblyForm.billType != 'MM'"
  141. :type="scope.type"
  142. :size="scope.size"
  143. :disabled="detailData.seeDisabled || pleasereviewType || showLock || disabled"
  144. @click.stop="rowDel(scope.row, scope.index)"
  145. >{{ $t("btn118n.deleted") }}
  146. </el-button>
  147. <el-popover placement="left" width="500" trigger="click">
  148. <avue-crud :option="recordOption" :data="recordData"></avue-crud>
  149. <el-button slot="reference" size="small" type="text" @click="rowRecord(scope.row)" style="margin-left: 6px;">记录</el-button>
  150. </el-popover>
  151. </template>
  152. <template slot="cntrTypeCode" slot-scope="{ row, index }">
  153. <dic-select
  154. v-if="row.edit && row.whetherSystemGenerate != 1"
  155. v-model="row.cntrTypeCode"
  156. label="cntrTypeCode"
  157. :activateCreated="false"
  158. :filterable="true"
  159. :mockData="assemblyForm.preContainersList"
  160. ></dic-select>
  161. <span v-else>{{ row.cntrTypeCode }}</span>
  162. </template>
  163. <template slot="hblno" slot-scope="{ row, index }">
  164. <el-input
  165. v-if="row.edit && row.whetherSystemGenerate != 1"
  166. v-model="row.hblno"
  167. clearable
  168. size="small"
  169. placeholder="请输入HB/L NO"
  170. ></el-input>
  171. <span v-else>{{ row.hblno }}</span>
  172. </template>
  173. <template slot-scope="scope" slot="cntrNo">
  174. <el-input
  175. v-if="scope.row.edit"
  176. v-model="scope.row.cntrNo"
  177. maxlength="11"
  178. size="small"
  179. clearable
  180. placeholder="请输入箱号"
  181. @input="cntrNoInput(scope.row, 'cntrNo')"
  182. @change="verifyChange(scope.row, 'cntrNo')"
  183. ></el-input>
  184. <span v-else>{{ scope.row.cntrNo }}</span>
  185. </template>
  186. <template slot-scope="scope" slot="sealNo">
  187. <el-input
  188. v-if="scope.row.edit"
  189. v-model="scope.row.sealNo"
  190. maxlength="11"
  191. size="small"
  192. clearable
  193. placeholder="请输入封号"
  194. @input="cntrNoInput(scope.row, 'sealNo')"
  195. ></el-input>
  196. <span v-else>{{ scope.row.sealNo }}</span>
  197. </template>
  198. <template slot-scope="scope" slot="quantity">
  199. <el-input v-if="scope.row.edit" v-model="scope.row.quantity" size="small" clearable placeholder="请输入件数"></el-input>
  200. <span v-else>{{ Number(scope.row.quantity).toFixed(0) }}</span>
  201. </template>
  202. <template slot-scope="scope" slot="grossWeight">
  203. <el-input
  204. v-if="scope.row.edit"
  205. v-model="scope.row.grossWeight"
  206. size="small"
  207. clearable
  208. placeholder="请输入毛重"
  209. @change="computeChange(scope.row)"
  210. ></el-input>
  211. <span v-else>{{ scope.row.grossWeight }}</span>
  212. </template>
  213. <template slot-scope="scope" slot="netWeight">
  214. <el-input v-if="scope.row.edit" v-model="scope.row.netWeight" size="small" clearable placeholder="请输入净重"></el-input>
  215. <span v-else>{{ scope.row.netWeight }}</span>
  216. </template>
  217. <template slot-scope="scope" slot="measurement">
  218. <el-input v-if="scope.row.edit" v-model="scope.row.measurement" size="small" clearable placeholder="请输入尺码"></el-input>
  219. <span v-else>{{ scope.row.measurement }}</span>
  220. </template>
  221. <template slot-scope="scope" slot="remarks">
  222. <el-input v-if="scope.row.edit" v-model="scope.row.remarks" size="small" clearable placeholder="请输入备注"></el-input>
  223. <span v-else>{{ scope.row.remarks }}</span>
  224. </template>
  225. <template slot-scope="scope" slot="marks">
  226. <el-input v-if="scope.row.edit" v-model="scope.row.marks" size="small" clearable placeholder="请输入MARKS"></el-input>
  227. <span v-else>{{ scope.row.marks }}</span>
  228. </template>
  229. <template slot-scope="{ row }" slot="tare">
  230. <el-input v-if="row.edit" v-model="row.tare" size="small" clearable placeholder="请输入箱皮重" @change="computeChange(row)"></el-input>
  231. <span v-else>{{ row.tare }}</span>
  232. </template>
  233. <!-- <template slot-scope="{row}" slot="vgmWeight">
  234. <el-input v-if="row.edit" v-model="row.vgmWeight" size="small" clearable
  235. placeholder="请输入VGM总重(KGM)"></el-input>
  236. <span v-else>{{ row.vgmWeight }}</span>
  237. </template> -->
  238. <tempalte slot="podStationCname" slot-scope="{ row }">
  239. <dic-select
  240. v-if="row.edit"
  241. v-model="row.podStationCname"
  242. placeholder="场站"
  243. label="cnName"
  244. res="records"
  245. url="/blade-los/bcorps/selectList?current=1&size=5&corpTypeName=场站&status=0"
  246. :filterable="true"
  247. :remote="true"
  248. dataName="cnName"
  249. @selectChange="rowDicChange('podStationCname', $event, row)"
  250. ></dic-select>
  251. <span v-else>{{ row.podStationCname }}</span>
  252. </tempalte>
  253. <!-- <template slot-scope="{ row }" slot="polCyCname">
  254. <dic-select
  255. v-model="row.polCyCname"
  256. placeholder="场站"
  257. label="cnName"
  258. res="records"
  259. url="/blade-los/bcorps/selectList?current=1&size=5&corpTypeName=场站&status=0"
  260. :filterable="true"
  261. :remote="true"
  262. dataName="cnName"
  263. @selectChange="rowDicChange('polCyCname', $event, row)"
  264. ></dic-select>
  265. </template> -->
  266. <!-- <template slot-scope="{ row }" slot="podEmptyContainerReturnDate">
  267. <el-date-picker
  268. v-model="row.podEmptyContainerReturnDate"
  269. type="date"
  270. placeholder="选择日期"
  271. format="yyyy-MM-dd"
  272. value-format="yyyy-MM-dd 00:00:00"
  273. size="small"
  274. >
  275. </el-date-picker>
  276. </template> -->
  277. <tempalte slot-scope="{ row }" slot="podCyContact">
  278. <dic-select
  279. v-if="row.edit"
  280. :key="row.podStationId"
  281. v-model="row.podCyContact"
  282. placeholder="场站联系人"
  283. label="cname"
  284. res="records"
  285. :url="'/blade-los/bcorpsattn/list?pid=' + row.podStationId"
  286. :filterable="true"
  287. :disabled="!row.podStationId"
  288. @selectChange="rowDicChange('podCyContact', $event, row)"
  289. ></dic-select>
  290. <span v-else>{{ row.podCyContact }}</span>
  291. </tempalte>
  292. <template slot-scope="{ row }" slot="podCyAddress">
  293. <el-input v-if="row.edit" v-model="row.podCyAddress" size="small" clearable placeholder="请输入目的港场站地址"></el-input>
  294. <span v-else>{{ row.podCyAddress }}</span>
  295. </template>
  296. <template slot-scope="{ row }" slot="podCyEmail">
  297. <el-input v-if="row.edit" v-model="row.podCyEmail" size="small" clearable placeholder="请输入目的港场站邮箱"></el-input>
  298. <span v-else>{{ row.podCyEmail }}</span>
  299. </template>
  300. <template slot-scope="{ row }" slot="podCyTel">
  301. <el-input v-if="row.edit" v-model="row.podCyTel" size="small" clearable placeholder="请输入目的港场站电话"></el-input>
  302. <span v-else>{{ row.podCyTel }}</span>
  303. </template>
  304. </avue-crud>
  305. </basic-container>
  306. <el-dialog title="导入箱号,铅封号" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false" v-dialog-drag>
  307. <avue-form :option="excelOption" v-model="excelForm" :table-loading="excelLoading" :upload-before="uploadBefore" :upload-after="onSuccess">
  308. <template slot="excelTemplate">
  309. <el-button type="primary" @click="handleGet"> 点击下载<i class="el-icon-download el-icon--right"></i> </el-button>
  310. </template>
  311. </avue-form>
  312. <p style="text-align: center;color: #DC0505">
  313. 温馨提示 第一次导入时请先下载模板
  314. </p>
  315. </el-dialog>
  316. <!--提取的数据展示框-->
  317. <el-dialog
  318. append-to-body
  319. title="预览数据"
  320. class="el-dialogDeep"
  321. :visible.sync="extractDialogvisible"
  322. width="80%"
  323. :close-on-click-modal="false"
  324. :destroy-on-close="true"
  325. :close-on-press-escape="false"
  326. v-dialog-drag
  327. >
  328. <extract-box-information :luHaiTongData="luHaiTongData"></extract-box-information>
  329. <span slot="footer" class="dialog-footer">
  330. <el-button @click="extractDialogvisible = false">取 消</el-button>
  331. <el-button type="primary" @click="extractDialogfun">导 入</el-button>
  332. </span>
  333. </el-dialog>
  334. <business-reports
  335. :id="assemblyForm.id"
  336. :itemIds="itemIds"
  337. ref="print"
  338. businessValue="HYCK"
  339. classifyCode="业务"
  340. groupCode="配箱预览,ADVICE"
  341. :treeType="false"
  342. :type="1"
  343. ></business-reports>
  344. <split-order ref="splitOrder" @getUpdata="getUpdata"></split-order>
  345. </div>
  346. </template>
  347. <script>
  348. import {
  349. containersDetail,
  350. containersSubmit,
  351. containersRemove,
  352. containersCleanBoxNo,
  353. containersRevoke,
  354. containersEqualDistribution,
  355. distributionBox,
  356. containersSubmitList,
  357. containersExportContainers,
  358. containersImportBoxNo,
  359. containersList,
  360. luHaiTongApiDetail,
  361. removeById,
  362. getRecordlist
  363. } from "@/api/iosBasicData/containers";
  364. import { getAccurate } from "@/api/boxManagement/buyContainer/index.js";
  365. import { mapGetters } from "vuex";
  366. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  367. import bports from "@/views/iosBasicData/bports/index.vue";
  368. import { bportsList } from "@/api/iosBasicData/bports";
  369. import { getToken } from "@/util/auth";
  370. import { decryptLhtData } from "@/util/lhtDataDesc";
  371. import extractBoxInformation from "@/views/iosBasicData/SeafreightExportF/bills/assembly/DistributionBox/extractBoxInformation.vue";
  372. import { billsAdd } from "@/api/iosBasicData/bills";
  373. import dicSelect from "@/components/dicSelect/main";
  374. import businessReports from "@/components/tradeAgency/businessReportsJK.vue";
  375. import { isProcurement } from "@/api/basicData/configuration";
  376. import splitOrder from "../components/splitOrder.vue";
  377. import mergeOrder from "../components/mergeOrder.vue";
  378. export default {
  379. components: { SearchQuery, bports, extractBoxInformation, dicSelect, businessReports, splitOrder, mergeOrder },
  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 arr = this.assemblyForm.containersList.map(item => {
  1258. return item.id;
  1259. });
  1260. // 清除箱号接口
  1261. containersCleanBoxNo(arr.join(",")).then(res => {
  1262. this.$message({
  1263. type: "success",
  1264. message: "清除箱号成功!"
  1265. });
  1266. this.$emit("billsDetailfun");
  1267. });
  1268. });
  1269. },
  1270. // 全部撤销
  1271. wholeRevokefun() {
  1272. this.$confirm("是否清除所有数据的件重尺?", {
  1273. confirmButtonText: "确定",
  1274. cancelButtonText: "取消",
  1275. type: "warning"
  1276. }).then(() => {
  1277. let arr = this.assemblyForm.containersList.map(item => {
  1278. return item.id;
  1279. });
  1280. containersRevoke(arr.join(",")).then(res => {
  1281. this.$message({
  1282. type: "success",
  1283. message: "全部撤销成功!"
  1284. });
  1285. this.$emit("billsDetailfun");
  1286. });
  1287. });
  1288. },
  1289. // 撤销
  1290. revokefun() {
  1291. if (this.selectionList.length > 0) {
  1292. containersRevoke(this.selectionList[0].id).then(res => {
  1293. this.$message({
  1294. type: "success",
  1295. message: "撤销成功!"
  1296. });
  1297. this.$emit("billsDetailfun");
  1298. });
  1299. } else {
  1300. this.$message({
  1301. type: "warning",
  1302. message: "请选选择要撤销的数据!"
  1303. });
  1304. }
  1305. },
  1306. // 配箱批量保存
  1307. containersSubmitListfun() {
  1308. if (!this.assemblyForm.id) {
  1309. this.$message.warning("请先大保存");
  1310. return;
  1311. }
  1312. for (let item of this.assemblyForm.containersList) {
  1313. if (!item.cntrTypeCode) {
  1314. return this.$message.error("请选择箱型");
  1315. }
  1316. }
  1317. for (let item of this.assemblyForm.preContainersList) {
  1318. if (this.assemblyForm.containersList.filter(e => e.cntrTypeCode == item.cntrTypeCode).length > item.quantity) {
  1319. return this.$message.error(`${item.cntrTypeCode}箱量不能超过${item.quantity}条`);
  1320. }
  1321. // let qtySUM = 0;
  1322. // for (let row of this.assemblyForm.containersList) {
  1323. // if (item.cntrTypeCode == row.cntrTypeCode) {
  1324. // qtySUM += Number(row.quantity);
  1325. // }
  1326. // if (qtySUM > item.number) {
  1327. // return this.$message.error(`箱型:${item.cntrTypeCode}的总数量不能超过${item.number}`);
  1328. // }
  1329. // }
  1330. }
  1331. this.$confirm("确定全部保存配箱?", {
  1332. confirmButtonText: "确定",
  1333. cancelButtonText: "取消",
  1334. type: "warning"
  1335. }).then(() => {
  1336. containersSubmitList(this.assemblyForm.containersList).then(res => {
  1337. this.$message({
  1338. type: "success",
  1339. message: "操作成功!"
  1340. });
  1341. this.$emit("billsDetailfun");
  1342. });
  1343. });
  1344. },
  1345. rowSave(row, done, loading) {
  1346. containersSubmit(row).then(
  1347. () => {
  1348. // this.onLoad(this.page);
  1349. this.$message({
  1350. type: "success",
  1351. message: "操作成功!"
  1352. });
  1353. done();
  1354. },
  1355. error => {
  1356. loading();
  1357. window.console.log(error);
  1358. }
  1359. );
  1360. },
  1361. rowUpdate(row, index, done, loading) {
  1362. containersSubmit(row).then(
  1363. () => {
  1364. // this.onLoad(this.page);
  1365. this.$message({
  1366. type: "success",
  1367. message: "操作成功!"
  1368. });
  1369. done();
  1370. },
  1371. error => {
  1372. loading();
  1373. console.log(error);
  1374. }
  1375. );
  1376. },
  1377. rowRecord(row) {
  1378. this.recordData = [];
  1379. let obj = {
  1380. pid: row.id
  1381. };
  1382. getRecordlist(1, 50, obj).then(res => {
  1383. this.recordData = res.data.data.records;
  1384. });
  1385. },
  1386. // 删除
  1387. rowDel(row, index) {
  1388. if (row.id) {
  1389. this.$confirm("确定将选择数据删除?", {
  1390. confirmButtonText: "确定",
  1391. cancelButtonText: "取消",
  1392. type: "warning"
  1393. }).then(() => {
  1394. removeById(row.id).then(() => {
  1395. // this.onLoad(this.page);
  1396. this.$message({
  1397. type: "success",
  1398. message: "操作成功!"
  1399. });
  1400. this.$emit("billsDetailfun");
  1401. this.$refs.crud.toggleSelection();
  1402. });
  1403. });
  1404. } else {
  1405. this.assemblyForm.containersList.splice(index, 1);
  1406. }
  1407. },
  1408. // 一键删除
  1409. handleDelete() {
  1410. for (let item of this.assemblyForm.containersList) {
  1411. if (!item.id) return this.$message.error("明细存在未保存数据,请点击行删除");
  1412. if (item.quantity > 0) return this.$message.error("请先撤销,再删除配箱");
  1413. }
  1414. this.$confirm("确定将全部数据删除?", {
  1415. confirmButtonText: "确定",
  1416. cancelButtonText: "取消",
  1417. type: "warning"
  1418. }).then(() => {
  1419. let arrids = this.assemblyForm.containersList.map(item => {
  1420. return item.id;
  1421. });
  1422. containersRemove(arrids.join(",")).then(() => {
  1423. // this.onLoad(this.page);
  1424. this.$message({
  1425. type: "success",
  1426. message: "操作成功!"
  1427. });
  1428. this.$emit("billsDetailfun");
  1429. this.$refs.crud.toggleSelection();
  1430. });
  1431. });
  1432. },
  1433. getUpdata(){
  1434. this.$emit("billsDetailfun")
  1435. },
  1436. beforeOpen(done, type) {
  1437. if (["edit", "view"].includes(type)) {
  1438. containersDetail(this.form.id).then(res => {
  1439. this.form = res.data.data;
  1440. });
  1441. }
  1442. done();
  1443. },
  1444. // 当选择项发生变化时会触发该事件
  1445. selectionChange(list) {
  1446. // let arr = [];
  1447. // if (list.length > 1) {
  1448. // this.$refs.crud.toggleSelection(); // 先清空所以选择的数据
  1449. // arr = [list[list.length - 1]]; // 获取最新点击的数组
  1450. // this.$refs.crud.toggleSelection(arr, true); // 把刚点击的数组变成选择状态
  1451. // } else {
  1452. // arr = list;
  1453. // }
  1454. // this.selectionList = arr;
  1455. // this.$emit("selectionChange", this.selectionList);
  1456. this.selectionList = list;
  1457. },
  1458. inPitch() {
  1459. this.$refs.crud.toggleRowSelection(this.assemblyForm.containersList[0], true);
  1460. },
  1461. selectionClear() {
  1462. this.selectionList = [];
  1463. this.$refs.crud.toggleSelection();
  1464. },
  1465. refreshChange() {
  1466. console.log("刷新");
  1467. // this.onLoad(this.page, this.query);
  1468. },
  1469. // onLoad(page, params = {}) {
  1470. // this.loading = true;
  1471. // containersList(page.currentPage, page.pageSize, {...Object.assign(params, this.query),pid:this.pid}).then(res => {
  1472. // const data = res.data.data;
  1473. // this.page.total = data.total;
  1474. // this.data = data.records
  1475. // this.loading = false;
  1476. // this.selectionClear();
  1477. // });
  1478. // }
  1479. // 更改表格颜色
  1480. headerClassName(tab) {
  1481. //颜色间隔
  1482. let back = "";
  1483. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  1484. if (tab.columnIndex % 2 === 0) {
  1485. back = "back-one";
  1486. } else if (tab.columnIndex % 2 === 1) {
  1487. back = "back-two";
  1488. }
  1489. }
  1490. return back;
  1491. }
  1492. }
  1493. };
  1494. </script>
  1495. <style scoped>
  1496. ::v-deep#out-table .back-one {
  1497. background: #ecf5ff !important;
  1498. text-align: center;
  1499. padding: 4px 0;
  1500. }
  1501. ::v-deep#out-table .back-two {
  1502. background: #ecf5ff !important;
  1503. text-align: center;
  1504. padding: 4px 0;
  1505. }
  1506. </style>