index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. <template>
  2. <div>
  3. <basic-container v-if="isShow">
  4. <avue-crud
  5. :option="option"
  6. :table-loading="loading"
  7. :data="data"
  8. :page.sync="page"
  9. :search.sync="query"
  10. v-model="form"
  11. id="out-table"
  12. :header-cell-class-name="headerClassName"
  13. ref="crud"
  14. @row-del="rowDel"
  15. @search-change="searchChange"
  16. @search-reset="searchReset"
  17. @selection-change="selectionChange"
  18. @current-change="currentChange"
  19. @size-change="sizeChange"
  20. @refresh-change="refreshChange"
  21. @resetColumn="resetColumn('crud', 'option', 'optionBack', 459)"
  22. @saveColumn="saveColumn('crud', 'option', 'optionBack', 459)"
  23. @on-load="onLoad"
  24. >
  25. <template slot="menuLeft">
  26. <el-tabs v-model="query.whetherDisplay" type="card" @tab-click="handleClick">
  27. <el-tab-pane label="可用" name="1"></el-tab-pane>
  28. <el-tab-pane label="不可用" name="2"></el-tab-pane>
  29. <el-tab-pane label="失效" name="3"></el-tab-pane>
  30. <el-tab-pane label="全部" name="0"></el-tab-pane>
  31. </el-tabs>
  32. <el-button type="primary" size="small" icon="el-icon-plus" @click="addButton">新 增 </el-button>
  33. <!-- <el-button type="warning" size="small" @click="outExport">导 出
  34. </el-button> -->
  35. <el-button type="success" size="small" :disabled="selectionList.length != 1" @click="copyButton">复制单据 </el-button>
  36. </template>
  37. <template slot="menu" slot-scope="{ row, index }">
  38. <el-button size="small" icon="el-icon-edit" type="text" @click="rowEdit(row)">编辑</el-button>
  39. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)" :disabled="row.whetherManuallyCreate == 1"
  40. >删 除</el-button
  41. >
  42. </template>
  43. <template slot="sysNo" slot-scope="{ row }">
  44. <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.sysNo }}</span>
  45. </template>
  46. <template slot="boxEastName" slot-scope="{ row }">
  47. <span v-if="row.boxClass=='OW(拿)'" style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">WINFAST</span>
  48. <span v-if="row.boxClass!='OW(拿)'" style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.boxEastName }}</span>
  49. </template>
  50. <template slot="containerNumber" slot-scope="{ row }">
  51. <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.containerNumber }}</span>
  52. </template>
  53. </avue-crud>
  54. </basic-container>
  55. <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
  56. </div>
  57. </template>
  58. <script>
  59. import { getList, remove } from "@/api/boxManagement/containerNumber/index.js";
  60. import { getWorkDicts } from "@/api/system/dictbiz";
  61. import detailsPage from "./detailsPage";
  62. import { getToken } from "@/util/auth";
  63. import _ from "lodash";
  64. export default {
  65. name:'放箱号',
  66. data() {
  67. return {
  68. isShow: true,
  69. form: {},
  70. query: {
  71. whetherDisplay: "1"
  72. },
  73. loading: false,
  74. page: {
  75. pageSize: 10,
  76. currentPage: 1,
  77. total: 0
  78. },
  79. selectionList: [],
  80. option: {},
  81. optionBack: {
  82. height: "auto",
  83. calcHeight: 30,
  84. menuWidth: 140,
  85. tip: false,
  86. searchShow: true,
  87. searchMenuSpan: 6,
  88. border: true,
  89. index: true,
  90. addBtn: false,
  91. viewBtn: false,
  92. editBtn: false,
  93. delBtn: false,
  94. selection: true,
  95. searchIcon: true,
  96. align: "center",
  97. searchIndex: 3,
  98. column: [
  99. {
  100. label: "箱东",
  101. prop: "boxEastName",
  102. width: 150,
  103. overHidden: true,
  104. search: true,
  105. searchOrder: 2.2,
  106. type: "select",
  107. filterable: true,
  108. remote: true,
  109. dicUrl: "/api/blade-los/bcorps/selectList?status=0&corpTypeName=箱东&size=5&current=1&shortName={{key}}",
  110. props: {
  111. label: "shortName",
  112. value: "shortName",
  113. desc: "code",
  114. res: "data.records"
  115. }
  116. },
  117. {
  118. label: "系统号",
  119. prop: "sysNo",
  120. width: 100,
  121. overHidden: true
  122. },
  123. {
  124. label: "放箱号",
  125. prop: "containerNumber",
  126. width: 100,
  127. overHidden: true,
  128. search: true,
  129. searchOrder: 1
  130. },
  131. {
  132. label: "优先等级",
  133. prop: "priorityLevel",
  134. type: "select",
  135. dicUrl: "/api/blade-system/dict-biz/dictionary?code=priorityLevel",
  136. props: {
  137. label: "dictValue",
  138. value: "dictKey"
  139. },
  140. overHidden: true,
  141. width: 80
  142. },
  143. {
  144. label: "箱号",
  145. prop: "code",
  146. width: 100,
  147. overHidden: true,
  148. search: true,
  149. searchOrder: 2
  150. },
  151. {
  152. label: "内部放箱号",
  153. prop: "internalContainerNumber",
  154. width: 100,
  155. overHidden: true,
  156. search: true,
  157. searchOrder: 2.4
  158. },
  159. {
  160. label: "放箱号类型",
  161. prop: "boxClass",
  162. width: 100,
  163. overHidden: true,
  164. search: true,
  165. searchOrder: 9,
  166. type: "select",
  167. dicUrl: "/api/blade-system/dict-biz/dictionary?code=boxCategory",
  168. props: {
  169. label: "dictValue",
  170. value: "dictValue"
  171. }
  172. },
  173. {
  174. label: "来源类型",
  175. prop: "srcType",
  176. width: 100,
  177. search: true,
  178. overHidden: true,
  179. searchOrder: 12,
  180. type: "select",
  181. dicData: [
  182. {
  183. label: "OW(拿)",
  184. value: "OW(拿)"
  185. },
  186. {
  187. label: "OW(放)",
  188. value: "OW(放)"
  189. }
  190. ]
  191. },
  192. {
  193. label: "来源系统号",
  194. prop: "srcNo",
  195. width: 100,
  196. search: true,
  197. overHidden: true,
  198. searchOrder: 13
  199. },
  200. {
  201. label: "来源放箱号",
  202. prop: "srcContainerNumber",
  203. width: 100,
  204. search: true,
  205. overHidden: true,
  206. searchOrder: 14
  207. },
  208. {
  209. label: "箱属",
  210. prop: "boxBelongsTo",
  211. width: 80,
  212. overHidden: true,
  213. // hide: true,
  214. // showColumn: false,
  215. search: true,
  216. searchOrder: 10,
  217. type: "select",
  218. dicUrl: "/api/blade-system/dict-biz/dictionary?code=boxBelongsTo",
  219. props: {
  220. label: "dictValue",
  221. value: "dictValue"
  222. }
  223. },
  224. {
  225. label: "代理名称",
  226. prop: "agentName",
  227. width: 90,
  228. overHidden: true
  229. },
  230. {
  231. label: "预计起运港场站",
  232. prop: "estimatedPolStationCname",
  233. width: 140,
  234. overHidden: true
  235. },
  236. {
  237. label: "实际起运港场站",
  238. prop: "polStationCname",
  239. width: 140,
  240. overHidden: true,
  241. search: true,
  242. searchOrder: 5,
  243. searchLabelWidth: 120,
  244. type: "select",
  245. filterable: true,
  246. remote: true,
  247. dicUrl: "/api/blade-los/bcorps/selectList?status=0&corpTypeName=场站&size=5&current=1&cnName={{key}}",
  248. props: {
  249. label: "cnName",
  250. value: "cnName",
  251. desc: "code",
  252. res: "data.records"
  253. }
  254. },
  255. {
  256. label: "目的港提/还箱场站",
  257. prop: "podStationCname",
  258. width: 140,
  259. overHidden: true,
  260. search: true,
  261. searchOrder: 6,
  262. searchLabelWidth: 120,
  263. type: "select",
  264. filterable: true,
  265. remote: true,
  266. dicUrl: "/api/blade-los/bcorps/selectList?status=0&corpTypeName=场站&size=5&current=1&cnName={{key}}",
  267. props: {
  268. label: "cnName",
  269. value: "cnName",
  270. desc: "code",
  271. res: "data.records"
  272. }
  273. },
  274. {
  275. label: "起运港",
  276. prop: "polCname",
  277. width: 90,
  278. overHidden: true,
  279. search: true,
  280. searchOrder: 3,
  281. type: "select",
  282. filterable: true,
  283. remote: true,
  284. dicUrl: "/api/blade-los/bports/list?status=0&size=5&current=1&cnName={{key}}",
  285. props: {
  286. label: "cnName",
  287. value: "cnName",
  288. desc: "code",
  289. res: "data.records"
  290. }
  291. },
  292. {
  293. label: "目的港",
  294. prop: "podCname",
  295. width: 90,
  296. overHidden: true,
  297. search: true,
  298. searchOrder: 4,
  299. type: "select",
  300. filterable: true,
  301. remote: true,
  302. dicUrl: "/api/blade-los/bports/list?status=0&size=5&current=1&cnName={{key}}",
  303. props: {
  304. label: "cnName",
  305. value: "cnName",
  306. desc: "code",
  307. res: "data.records"
  308. }
  309. },
  310. {
  311. label: "箱型",
  312. prop: "boxType",
  313. width: 80,
  314. overHidden: true,
  315. search: true,
  316. searchOrder: 5,
  317. type: "select",
  318. filterable: true,
  319. remote: true,
  320. dicUrl: "/api/blade-los/bcntrtypes/list?status=0&size=20&current=1&cnName={{key}}",
  321. props: {
  322. label: "cnName",
  323. value: "cnName",
  324. res: "data.records"
  325. }
  326. },
  327. {
  328. label: "可用箱量",
  329. prop: "remainingNum",
  330. width: 100,
  331. overHidden: true
  332. },
  333. {
  334. label: "操作占用",
  335. prop: "occupyNum",
  336. width: 100,
  337. overHidden: true
  338. },
  339. {
  340. label: "场地盘存",
  341. prop: "storageNum",
  342. width: 100,
  343. overHidden: true
  344. },
  345. {
  346. label: "内部放箱号类型",
  347. prop: "internalBoxClass",
  348. width: 120,
  349. overHidden: true
  350. },
  351. {
  352. label: "箱况",
  353. prop: "boxCondition",
  354. width: 80,
  355. overHidden: true
  356. },
  357. {
  358. label: "有效日期起",
  359. prop: "effectiveStartDate",
  360. type: "date",
  361. format: "yyyy-MM-dd",
  362. valueFormat: "yyyy-MM-dd HH:mm:ss",
  363. width: 100,
  364. overHidden: true
  365. },
  366. {
  367. label: "有效日期止",
  368. prop: "effectiveEndDate",
  369. type: "date",
  370. format: "yyyy-MM-dd",
  371. valueFormat: "yyyy-MM-dd HH:mm:ss",
  372. width: 100,
  373. overHidden: true
  374. },
  375. {
  376. label: "有效日期",
  377. prop: "effectiveDate",
  378. width: 120,
  379. hide: true,
  380. showColumn: false,
  381. search: true,
  382. searchOrder: 10,
  383. searchProp: "effectiveDateList",
  384. overHidden: true,
  385. type: "date",
  386. searchRange: true,
  387. searchDefaultTime: ["00:00:00", "23:59:59"],
  388. format: "yyyy-MM-dd",
  389. valueFormat: "yyyy-MM-dd HH:mm:ss"
  390. },
  391. {
  392. label: "舱位类型",
  393. prop: "cabinType",
  394. width: 100,
  395. overHidden: true
  396. },
  397. {
  398. label: "舱位数",
  399. prop: "shippingSpaceNumber",
  400. width: 90,
  401. overHidden: true
  402. },
  403. {
  404. label: "航线",
  405. prop: "airlineCname",
  406. width: 100,
  407. overHidden: true
  408. },
  409. {
  410. label: "是否合营舱位",
  411. prop: "whetherJointVentureCabin",
  412. width: 100,
  413. overHidden: true
  414. },
  415. {
  416. label: "LOLO-POL",
  417. prop: "loloPol",
  418. width: 90,
  419. overHidden: true
  420. },
  421. {
  422. label: "LOLO-POD",
  423. prop: "loloPod",
  424. width: 90,
  425. overHidden: true
  426. },
  427. {
  428. label: "目的港场站地址",
  429. prop: "podCyAddress",
  430. width: 120,
  431. overHidden: true
  432. },
  433. {
  434. label: "目的港场站联系人",
  435. prop: "podCyContact",
  436. width: 120,
  437. overHidden: true
  438. },
  439. {
  440. label: "目的港场站邮箱",
  441. prop: "podCyEmail",
  442. width: 120,
  443. overHidden: true
  444. },
  445. {
  446. label: "目的港场站电话",
  447. prop: "podCyTel",
  448. width: 120,
  449. overHidden: true
  450. },
  451. {
  452. label: "制单人",
  453. prop: "createUserName",
  454. overHidden: true,
  455. width: 80
  456. },
  457. {
  458. label: "制单日期",
  459. prop: "createTime",
  460. type: "date",
  461. overHidden: true,
  462. width: 100,
  463. format: "yyyy-MM-dd",
  464. valueFormat: "yyyy-MM-dd HH:mm:ss"
  465. },
  466. {
  467. label: "修改人",
  468. prop: "updateUserName",
  469. overHidden: true,
  470. width: 80
  471. },
  472. {
  473. label: "修改日期",
  474. prop: "updateTime",
  475. type: "date",
  476. overHidden: true,
  477. width: 100,
  478. format: "yyyy-MM-dd",
  479. valueFormat: "yyyy-MM-dd HH:mm:ss"
  480. }
  481. ]
  482. },
  483. data: []
  484. };
  485. },
  486. components: {
  487. detailsPage
  488. },
  489. async created() {
  490. this.option = await this.getColumnData(this.getColumnName(459), this.optionBack);
  491. },
  492. activated() {
  493. setTimeout(() => {
  494. if (this.$route.query.id) {
  495. this.detailData = {
  496. id: this.$route.query.id
  497. };
  498. this.isShow = false;
  499. }
  500. if (this.$route.query.params) {
  501. this.detailData = {
  502. id: this.$route.query.params
  503. };
  504. this.isShow = false;
  505. }
  506. }, 100);
  507. },
  508. methods: {
  509. addButton() {
  510. this.isShow = false;
  511. },
  512. copyButton() {
  513. this.isShow = false;
  514. this.detailData = {
  515. copyId: this.selectionList[0].id
  516. };
  517. },
  518. rowEdit(row) {
  519. this.detailData = {
  520. id: row.id
  521. };
  522. this.isShow = false;
  523. },
  524. // 删除
  525. rowDel(row, index) {
  526. if (row.item == 1) {
  527. return this.$message.error("存在明细不允许删除");
  528. }
  529. this.$confirm("确定将选择数据删除?", {
  530. confirmButtonText: "确定",
  531. cancelButtonText: "取消",
  532. type: "warning"
  533. }).then(() => {
  534. remove({ ids: row.id }).then(res => {
  535. this.onLoad(this.page, this.query);
  536. this.$message.success("成功删除");
  537. });
  538. });
  539. },
  540. searchReset() {
  541. this.query = this.$options.data().query;
  542. this.onLoad(this.page);
  543. },
  544. // 搜索按钮点击
  545. searchChange(params, done) {
  546. this.page.currentPage = 1;
  547. this.onLoad(this.page, this.query);
  548. done();
  549. },
  550. selectionChange(list) {
  551. this.selectionList = list;
  552. },
  553. currentChange(currentPage) {
  554. this.page.currentPage = currentPage;
  555. },
  556. sizeChange(pageSize) {
  557. this.page.pageSize = pageSize;
  558. },
  559. refreshChange() {
  560. this.onLoad(this.page, this.query);
  561. },
  562. handleClick() {
  563. this.page.currentPage = 1;
  564. this.onLoad(this.page, this.query);
  565. },
  566. onLoad(page, params = {}) {
  567. let obj = {};
  568. obj = {
  569. ...Object.assign(params, this.query)
  570. };
  571. if (obj.effectiveDateList && obj.effectiveDateList.length > 0) {
  572. obj.effectiveStartDate = obj.effectiveDateList[0];
  573. obj.effectiveEndDate = obj.effectiveDateList[1];
  574. }
  575. this.loading = true;
  576. getList(page.currentPage, page.pageSize, obj)
  577. .then(res => {
  578. this.data = res.data.data.records;
  579. this.page.total = res.data.data.total;
  580. this.$nextTick(() => {
  581. this.$refs.crud.doLayout();
  582. this.$refs.crud.dicInit();
  583. });
  584. })
  585. .finally(() => {
  586. this.loading = false;
  587. });
  588. },
  589. // 详情的返回列表
  590. goBack() {
  591. // 初始化数据
  592. if (JSON.stringify(this.$route.query) != "{}") {
  593. this.$router.$avueRouter.closeTag();
  594. this.$router.push({
  595. path: "/boxManagement/containerNumber/index"
  596. });
  597. }
  598. this.detailData = {};
  599. this.isShow = true;
  600. this.onLoad(this.page, this.query);
  601. },
  602. outExport() {
  603. let config = { params: { ...this.query } };
  604. if (config.params) {
  605. for (const propName of Object.keys(config.params)) {
  606. const value = config.params[propName];
  607. if (value !== null && typeof value !== "undefined") {
  608. if (value instanceof Array) {
  609. for (const key of Object.keys(value)) {
  610. let params = propName + "[" + key + "]";
  611. config.params[params] = value[key];
  612. }
  613. delete config.params[propName];
  614. }
  615. }
  616. }
  617. }
  618. const routeData = this.$router.resolve({
  619. path: "/api/blade-los/routecost/exportRouteCost", //跳转目标窗口的地址
  620. query: {
  621. ...config.params, //括号内是要传递给新窗口的参数
  622. identification: this.url
  623. }
  624. });
  625. window.open(routeData.href.slice(1, routeData.href.length) + "&" + `${this.website.tokenHeader}=${getToken()}`);
  626. },
  627. //自定义列保存
  628. async saveColumn(ref, option, optionBack, code) {
  629. /**
  630. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  631. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  632. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  633. */
  634. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  635. if (inSave) {
  636. this.$message.success("保存成功");
  637. //关闭窗口
  638. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  639. this.searchReset();
  640. }
  641. },
  642. //自定义列重置
  643. async resetColumn(ref, option, optionBack, code) {
  644. this[option] = this[optionBack];
  645. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  646. if (inSave) {
  647. this.$message.success("重置成功");
  648. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  649. this.searchReset();
  650. }
  651. },
  652. // 更改表格颜色
  653. headerClassName(tab) {
  654. //颜色间隔
  655. let back = "";
  656. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  657. if (tab.columnIndex % 2 === 0) {
  658. back = "back-one";
  659. } else if (tab.columnIndex % 2 === 1) {
  660. back = "back-two";
  661. }
  662. }
  663. return back;
  664. }
  665. }
  666. };
  667. </script>
  668. <style lang="scss" scoped>
  669. ::v-deep #out-table .back-one {
  670. background: #ecf5ff !important;
  671. text-align: center;
  672. }
  673. ::v-deep #out-table .back-two {
  674. background: #ecf5ff !important;
  675. text-align: center;
  676. }
  677. .pointerClick {
  678. cursor: pointer;
  679. color: #1e9fff;
  680. }
  681. ::v-deep .el-col-md-8 {
  682. width: 24.33333%;
  683. }
  684. </style>