containers.vue 52 KB

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