index.vue 18 KB

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