containers.vue 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  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.containersListfun();
  1038. loading = false;
  1039. done();
  1040. },
  1041. // 箱列表
  1042. containersListfun() {
  1043. containersList(1, 100, { pid: this.assemblyForm.id }).then(res => {
  1044. this.assemblyForm.containersList = res.data.data.records;
  1045. });
  1046. },
  1047. addRow() {
  1048. if (this.assemblyForm.preContainersList.length == 0) {
  1049. return this.$message.error("箱型箱量没数据,不允许新建");
  1050. }
  1051. if (this.assemblyForm.boxBelongsTo == "SOC" && this.assemblyForm.billType == "MH" && this.assemblyForm.billType == "MH" && this.isOccupyNum) {
  1052. if (this.assemblyForm.preContainersList.filter(item => item.containerNumberStatus == "录入").length) {
  1053. return this.$message.error("请先占用放箱号");
  1054. }
  1055. }
  1056. let boxNum = 0;
  1057. for (let item of this.assemblyForm.preContainersList) {
  1058. boxNum += Number(item.quantity);
  1059. }
  1060. if (this.assemblyForm.containersList.length >= boxNum) {
  1061. return this.$message.error("新增数量不允许超过委托信息的总箱量");
  1062. }
  1063. this.assemblyForm.containersList.unshift({
  1064. edit: true,
  1065. pid: this.assemblyForm.id,
  1066. quantity: 0,
  1067. grossWeight: 0,
  1068. measurement: 0,
  1069. mblno: this.assemblyForm.mblno
  1070. });
  1071. },
  1072. equalDistribution2() {
  1073. if (!this.assemblyForm.id) {
  1074. this.$message({
  1075. message: "请先点击右上角保存按钮,保存数据之后才能添加!",
  1076. type: "warning"
  1077. });
  1078. return;
  1079. }
  1080. if (this.assemblyForm.boxBelongsTo == "SOC" && this.assemblyForm.billType == "MH" && this.isOccupyNum) {
  1081. if (this.assemblyForm.preContainersList.filter(item => item.containerNumberStatus == "录入").length) {
  1082. return this.$message.error("请先占用放箱号");
  1083. }
  1084. }
  1085. this.$confirm("是否确认配箱?", {
  1086. confirmButtonText: "确定",
  1087. cancelButtonText: "取消",
  1088. type: "warning"
  1089. }).then(() => {
  1090. distributionBox({ billId: this.assemblyForm.id }).then(res => {
  1091. this.$message({
  1092. type: "success",
  1093. message: "操作成功!"
  1094. });
  1095. this.$emit("billsDetailfun");
  1096. });
  1097. });
  1098. },
  1099. // 平均箱量
  1100. equalDistribution(type) {
  1101. if (!this.assemblyForm.id) {
  1102. this.$message({
  1103. message: "请先点击右上角保存按钮,保存数据之后才能添加!",
  1104. type: "warning"
  1105. });
  1106. return;
  1107. }
  1108. if (this.assemblyForm.waitingBoxList.length <= 0) {
  1109. this.$message({
  1110. type: "warning",
  1111. message: "请先添加集装箱数据!"
  1112. });
  1113. return;
  1114. }
  1115. if (this.assemblyForm.preContainersList <= 0) {
  1116. this.$message({
  1117. type: "warning",
  1118. message: "请先添加箱型数据!"
  1119. });
  1120. return;
  1121. }
  1122. this.$confirm("确定平均分配?", {
  1123. confirmButtonText: "确定",
  1124. cancelButtonText: "取消",
  1125. type: "warning"
  1126. }).then(() => {
  1127. this.containersEqualDistributionfun(type);
  1128. });
  1129. },
  1130. // 平均分配接口
  1131. containersEqualDistributionfun(type) {
  1132. containersEqualDistribution({
  1133. pid: this.assemblyForm.id,
  1134. type: type,
  1135. waitingBox: this.assemblyForm.waitingBoxList[0]
  1136. }).then(res => {
  1137. if (res.data.data instanceof Array) {
  1138. this.$message({
  1139. type: "success",
  1140. message: "操作成功!"
  1141. });
  1142. this.$emit("billsDetailfun");
  1143. } else {
  1144. // 没有除开
  1145. this.$message({
  1146. type: "warning",
  1147. dangerouslyUseHTMLString: true,
  1148. message:
  1149. '<span style="color:red">注意!!!件数不能平均分 ,请手工配箱,或者修改件数.</span>\n' +
  1150. '<table border="1">\n' +
  1151. " <thead>\n" +
  1152. " <tr>\n" +
  1153. " <th></th>\n" +
  1154. " <th>件数</th>\n" +
  1155. " <th>毛重</th>\n" +
  1156. " <th>尺码</th>\n" +
  1157. " </tr>\n" +
  1158. " </thead>\n" +
  1159. " <tbody>\n" +
  1160. " <tr>\n" +
  1161. " <td>总数</td>\n" +
  1162. " <td>" +
  1163. res.data.data.total.quantity +
  1164. "</td>\n" +
  1165. " <td>" +
  1166. res.data.data.total.grossWeight +
  1167. "</td>\n" +
  1168. " <td>" +
  1169. res.data.data.total.grossWeight +
  1170. "</td>\n" +
  1171. " </tr>\n" +
  1172. " <tr>\n" +
  1173. " <td>入箱</td>\n" +
  1174. " <td>" +
  1175. res.data.data.average.quantity +
  1176. "</td>\n" +
  1177. " <td>" +
  1178. res.data.data.average.grossWeight +
  1179. "</td>\n" +
  1180. " <td>" +
  1181. res.data.data.average.grossWeight +
  1182. "</td>\n" +
  1183. " </tr>\n" +
  1184. " <tr>\n" +
  1185. " <td>差额</td>\n" +
  1186. " <td>" +
  1187. res.data.data.subtract.quantity +
  1188. "</td>\n" +
  1189. " <td>" +
  1190. res.data.data.subtract.grossWeight +
  1191. "</td>\n" +
  1192. " <td>" +
  1193. res.data.data.subtract.grossWeight +
  1194. "</td>\n" +
  1195. " </tr>\n" +
  1196. " </tbody>\n" +
  1197. "</table>",
  1198. duration: 5000
  1199. });
  1200. }
  1201. });
  1202. },
  1203. // 下载模板
  1204. handleGet() {
  1205. window.open(`/api/blade-los/containers/exportContainers?${this.website.tokenHeader}=${getToken()}&pid=${this.assemblyForm.id}`);
  1206. },
  1207. // 查询件数是否为零
  1208. numberfalsefun() {
  1209. if (!this.assemblyForm.containersList) {
  1210. return false;
  1211. }
  1212. for (let item of this.assemblyForm.containersList) {
  1213. if (Number(item.quantity) >= 0) {
  1214. return true;
  1215. } else {
  1216. return false;
  1217. }
  1218. }
  1219. },
  1220. // // 平均分配
  1221. // equalDistribution() {
  1222. // if (this.assemblyForm.waitingBoxList.length <= 0) {
  1223. // this.$message({
  1224. // type: "warning",
  1225. // message: "请先添加集装箱数据!"
  1226. // });
  1227. // return
  1228. // }
  1229. // this.$confirm("确定平均分配?", {
  1230. // confirmButtonText: "确定",
  1231. // cancelButtonText: "取消",
  1232. // type: "warning"
  1233. // }).then(() => {
  1234. // this.$emit('equalDistribution')
  1235. // })
  1236. // },
  1237. // 一键编辑
  1238. rootEditfun() {
  1239. for (let item of this.assemblyForm.containersList) {
  1240. this.$delete(item, "edit");
  1241. this.$set(item, "edit", true);
  1242. }
  1243. },
  1244. // 编辑
  1245. rowCellfun(row, index) {
  1246. this.$delete(row, "edit");
  1247. this.$set(row, "edit", true);
  1248. },
  1249. // 保存
  1250. rowSavefun(row) {
  1251. this.$delete(row, "edit");
  1252. this.$set(row, "edit", false);
  1253. this.$emit("rowSavefun", row);
  1254. },
  1255. // 清除箱号
  1256. cleanCntrNofun() {
  1257. let arrids = [];
  1258. if (this.selectionList.length == 0) {
  1259. return this.$message.error("请选择数据");
  1260. }
  1261. for (let item of this.selectionList) {
  1262. if (item.containerNumber && this.assemblyForm.billType != "MM") {
  1263. return this.$message.error("放箱号有值,不允许清空");
  1264. }
  1265. arrids.push(item.id);
  1266. }
  1267. this.$confirm("确定将数据清除箱号?", {
  1268. confirmButtonText: "确定",
  1269. cancelButtonText: "取消",
  1270. type: "warning"
  1271. }).then(() => {
  1272. // 清除箱号接口
  1273. if (arrids.length) {
  1274. containersCleanBoxNo(arrids.join(",")).then(res => {
  1275. this.$message({
  1276. type: "success",
  1277. message: "清除箱号成功!"
  1278. });
  1279. this.$emit("billsDetailfun");
  1280. });
  1281. }
  1282. });
  1283. },
  1284. // 全部撤销
  1285. wholeRevokefun() {
  1286. // if (this.assemblyForm.billType != "MM") {
  1287. // for (let item of this.assemblyForm.containersList) {
  1288. // if (item.containerNumber && this.assemblyForm.billType != "MM") {
  1289. // return this.$message.error("放箱号有值,不允许清空");
  1290. // }
  1291. // }
  1292. // }
  1293. this.$confirm("是否清除所有数据的件重尺?", {
  1294. confirmButtonText: "确定",
  1295. cancelButtonText: "取消",
  1296. type: "warning"
  1297. }).then(() => {
  1298. let arrids = [];
  1299. for (let item of this.assemblyForm.containersList) {
  1300. arrids.push(item.id);
  1301. }
  1302. if (arrids.length) {
  1303. containersRevoke(arrids.join(",")).then(res => {
  1304. this.$message({
  1305. type: "success",
  1306. message: "全部撤销成功!"
  1307. });
  1308. this.$emit("billsDetailfun");
  1309. });
  1310. }
  1311. });
  1312. },
  1313. // 撤销
  1314. revokefun() {
  1315. if (this.selectionList.length == 0) {
  1316. return this.$message.error("请选择数据");
  1317. }
  1318. if (this.selectionList.length > 0) {
  1319. let arrids = [];
  1320. for (let item of this.selectionList) {
  1321. // if (item.containerNumber && this.assemblyForm.billType != "MM") {
  1322. // return this.$message.error("放箱号有值,不允许清空");
  1323. // }
  1324. arrids.push(item.id);
  1325. }
  1326. if (arrids.length) {
  1327. containersRevoke(arrids.join(",")).then(res => {
  1328. this.$message({
  1329. type: "success",
  1330. message: "撤销成功!"
  1331. });
  1332. this.$emit("billsDetailfun");
  1333. });
  1334. }
  1335. }
  1336. },
  1337. // 配箱批量保存
  1338. containersSubmitListfun() {
  1339. if (!this.assemblyForm.id) {
  1340. this.$message.warning("请先大保存");
  1341. return;
  1342. }
  1343. for (let item of this.assemblyForm.containersList) {
  1344. if (!item.cntrTypeCode) {
  1345. return this.$message.error("请选择箱型");
  1346. }
  1347. }
  1348. for (let item of this.assemblyForm.preContainersList) {
  1349. if (this.assemblyForm.containersList.filter(e => e.cntrTypeCode == item.cntrTypeCode).length > item.quantity) {
  1350. return this.$message.error(`${item.cntrTypeCode}箱量不能超过${item.quantity}条`);
  1351. }
  1352. // let qtySUM = 0;
  1353. // for (let row of this.assemblyForm.containersList) {
  1354. // if (item.cntrTypeCode == row.cntrTypeCode) {
  1355. // qtySUM += Number(row.quantity);
  1356. // }
  1357. // if (qtySUM > item.number) {
  1358. // return this.$message.error(`箱型:${item.cntrTypeCode}的总数量不能超过${item.number}`);
  1359. // }
  1360. // }
  1361. }
  1362. this.$confirm("确定全部保存配箱?", {
  1363. confirmButtonText: "确定",
  1364. cancelButtonText: "取消",
  1365. type: "warning"
  1366. }).then(() => {
  1367. containersSubmitList(this.assemblyForm.containersList).then(res => {
  1368. this.$message({
  1369. type: "success",
  1370. message: "操作成功!"
  1371. });
  1372. this.$emit("billsDetailfun");
  1373. });
  1374. });
  1375. },
  1376. rowSave(row, done, loading) {
  1377. containersSubmit(row).then(
  1378. () => {
  1379. // this.onLoad(this.page);
  1380. this.$message({
  1381. type: "success",
  1382. message: "操作成功!"
  1383. });
  1384. done();
  1385. },
  1386. error => {
  1387. loading();
  1388. window.console.log(error);
  1389. }
  1390. );
  1391. },
  1392. rowUpdate(row, index, done, loading) {
  1393. containersSubmit(row).then(
  1394. () => {
  1395. // this.onLoad(this.page);
  1396. this.$message({
  1397. type: "success",
  1398. message: "操作成功!"
  1399. });
  1400. done();
  1401. },
  1402. error => {
  1403. loading();
  1404. console.log(error);
  1405. }
  1406. );
  1407. },
  1408. rowRecord(row) {
  1409. this.recordData = [];
  1410. let obj = {
  1411. pid: row.id
  1412. };
  1413. getRecordlist(1, 50, obj).then(res => {
  1414. this.recordData = res.data.data.records;
  1415. });
  1416. },
  1417. // 删除
  1418. rowDel(row, index) {
  1419. // if (row.containerNumber) {
  1420. // return this.$message.error("放箱号有值,不允许删除");
  1421. // }
  1422. if (row.id) {
  1423. this.$confirm("确定将选择数据删除?", {
  1424. confirmButtonText: "确定",
  1425. cancelButtonText: "取消",
  1426. type: "warning"
  1427. }).then(() => {
  1428. removeById(row.id).then(() => {
  1429. // this.onLoad(this.page);
  1430. this.$message({
  1431. type: "success",
  1432. message: "操作成功!"
  1433. });
  1434. this.$emit("billsDetailfun");
  1435. this.$refs.crud.toggleSelection();
  1436. });
  1437. });
  1438. } else {
  1439. this.assemblyForm.containersList.splice(index, 1);
  1440. }
  1441. },
  1442. // 一键删除
  1443. handleDelete() {
  1444. if (this.selectionList.length === 0) {
  1445. this.$message.warning("请选择至少一条数据");
  1446. return;
  1447. }
  1448. for (let item of this.selectionList) {
  1449. if (!item.id) return this.$message.error("明细存在未保存数据,请点击行删除");
  1450. if (item.quantity > 0) return this.$message.error("请先撤销,再删除配箱");
  1451. if (item.containerNumber && this.assemblyForm.billType != "MM") {
  1452. return this.$message.error("放箱号有值,不允许清空");
  1453. }
  1454. }
  1455. this.$confirm("确定将数据删除?", {
  1456. confirmButtonText: "确定",
  1457. cancelButtonText: "取消",
  1458. type: "warning"
  1459. }).then(() => {
  1460. let arrids = [];
  1461. if (this.ids) {
  1462. containersRemove(this.ids).then(() => {
  1463. // this.onLoad(this.page);
  1464. this.$message({
  1465. type: "success",
  1466. message: "操作成功!"
  1467. });
  1468. this.$emit("billsDetailfun");
  1469. this.$refs.crud.toggleSelection();
  1470. });
  1471. }
  1472. });
  1473. },
  1474. getUpdata() {
  1475. this.$emit("billsDetailfun");
  1476. },
  1477. beforeOpen(done, type) {
  1478. if (["edit", "view"].includes(type)) {
  1479. containersDetail(this.form.id).then(res => {
  1480. this.form = res.data.data;
  1481. });
  1482. }
  1483. done();
  1484. },
  1485. // 当选择项发生变化时会触发该事件
  1486. selectionChange(list) {
  1487. // let arr = [];
  1488. // if (list.length > 1) {
  1489. // this.$refs.crud.toggleSelection(); // 先清空所以选择的数据
  1490. // arr = [list[list.length - 1]]; // 获取最新点击的数组
  1491. // this.$refs.crud.toggleSelection(arr, true); // 把刚点击的数组变成选择状态
  1492. // } else {
  1493. // arr = list;
  1494. // }
  1495. // this.selectionList = arr;
  1496. // this.$emit("selectionChange", this.selectionList);
  1497. this.selectionList = list;
  1498. },
  1499. inPitch() {
  1500. this.$refs.crud.toggleRowSelection(this.assemblyForm.containersList[0], true);
  1501. },
  1502. selectionClear() {
  1503. this.selectionList = [];
  1504. this.$refs.crud.toggleSelection();
  1505. },
  1506. refreshChange() {
  1507. console.log("刷新");
  1508. // this.onLoad(this.page, this.query);
  1509. },
  1510. // onLoad(page, params = {}) {
  1511. // this.loading = true;
  1512. // containersList(page.currentPage, page.pageSize, {...Object.assign(params, this.query),pid:this.pid}).then(res => {
  1513. // const data = res.data.data;
  1514. // this.page.total = data.total;
  1515. // this.data = data.records
  1516. // this.loading = false;
  1517. // this.selectionClear();
  1518. // });
  1519. // }
  1520. // 更改表格颜色
  1521. headerClassName(tab) {
  1522. //颜色间隔
  1523. let back = "";
  1524. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  1525. if (tab.columnIndex % 2 === 0) {
  1526. back = "back-one";
  1527. } else if (tab.columnIndex % 2 === 1) {
  1528. back = "back-two";
  1529. }
  1530. }
  1531. return back;
  1532. }
  1533. }
  1534. };
  1535. </script>
  1536. <style scoped lang="scss">
  1537. ::v-deep#out-table .back-one {
  1538. background: #ecf5ff !important;
  1539. text-align: center;
  1540. padding: 4px 0;
  1541. }
  1542. ::v-deep#out-table .back-two {
  1543. background: #ecf5ff !important;
  1544. text-align: center;
  1545. padding: 4px 0;
  1546. }
  1547. ::v-deep .el-table .cell {
  1548. padding: 0 2px !important;
  1549. }
  1550. ::v-deep .el-input__inner {
  1551. padding-left: 5px !important;
  1552. }
  1553. </style>