index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  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', 387)"
  9. @saveColumn="saveColumn('crud', 'option', 'optionBack', 387)" @on-load="onLoad">
  10. <template slot="checkboxSearch">
  11. <el-checkbox-group v-model="query.checkbox" @change="handleCheckedChange">
  12. <el-checkbox v-for="item in statusList" :label="item.value" :key="item.value">{{ item.label
  13. }}</el-checkbox>
  14. </el-checkbox-group>
  15. <!-- <avue-form v-model="query.checkbox" :option="checkboxOption"></avue-form> -->
  16. </template>
  17. <template slot="status" slot-scope="{ row }">
  18. <div>
  19. <span v-if="row.status == item.dictKey" v-for="(item, index) in auditStatusList" :key="index"
  20. :style="{ 'background-color': item.colour }"
  21. style="color: #fff;border-radius: 30px;padding: 2px 15px;text-align: center;">
  22. {{ item.dictValue }}
  23. </span>
  24. </div>
  25. </template>
  26. <template slot="menuLeft">
  27. <el-button type="primary" size="small" icon="el-icon-plus" @click="addButton">新 增
  28. </el-button>
  29. <el-button type="success" size="small" :disabled="selectionList.length != 1" @click="copyButton">复制订单
  30. </el-button>
  31. <el-button type="warning" size="small" :disabled="selectionList.length == 0" @click="allClick('退押')">退押
  32. </el-button>
  33. <el-button type="info" size="small" :disabled="selectionList.length == 0" @click="allClick('撤销退押')">撤销退押
  34. </el-button>
  35. <!-- <el-button type="warning" size="small" @click="outExport">导 出
  36. </el-button> -->
  37. </template>
  38. <template slot="menu" slot-scope="{ row, index }">
  39. <el-button size="small" icon="el-icon-edit" type="text" @click="rowEdit(row)">编辑</el-button>
  40. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  41. :disabled="row.status != '0'">删 除</el-button>
  42. </template>
  43. <template slot="bookingNo" slot-scope="{ row }">
  44. <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.bookingNo }}</span>
  45. </template>
  46. </avue-crud>
  47. </basic-container>
  48. <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
  49. </div>
  50. </template>
  51. <script>
  52. import { getList, remove, retreatPledge } from "@/api/tradeAgency/oceanFreightImport";
  53. import detailsPage from "./detailsPage";
  54. import { getToken } from "@/util/auth";
  55. import { getWorkDicts } from "@/api/system/dictbiz";
  56. export default {
  57. data() {
  58. return {
  59. auditStatusList: [],
  60. detailData: {},
  61. isShow: true,
  62. form: {},
  63. query: {
  64. checkbox: [],
  65. },
  66. loading: false,
  67. page: {
  68. pageSize: 10,
  69. currentPage: 1,
  70. total: 0
  71. },
  72. selectionList: [],
  73. statusList: [
  74. {
  75. label: '已开船',
  76. value: 'whetherSail'
  77. },
  78. {
  79. label: '已到港',
  80. value: 'whetherReachHarbor'
  81. },
  82. {
  83. label: '已通关',
  84. value: 'whetherClearance'
  85. },
  86. {
  87. label: '已派车',
  88. value: 'whetherDispatchCar'
  89. },
  90. {
  91. label: '已入库',
  92. value: ''
  93. },
  94. {
  95. label: '已取消',
  96. value: 'whetherCancel'
  97. }
  98. ],
  99. option: {},
  100. optionBack: {
  101. height: 'auto',
  102. calcHeight: 30,
  103. menuWidth: 140,
  104. tip: false,
  105. searchShow: true,
  106. searchMenuSpan: 6,
  107. border: true,
  108. index: true,
  109. addBtn: false,
  110. viewBtn: false,
  111. editBtn: false,
  112. delBtn: false,
  113. selection: true,
  114. searchIcon: true,
  115. searchIndex: 3,
  116. column: [
  117. {
  118. label: "是否退押",
  119. prop: "billingStatus",
  120. width: "70",
  121. type: 'select',
  122. dicData: [{
  123. label: '是',
  124. value: 1
  125. }, {
  126. label: '否',
  127. value: 0
  128. }],
  129. searchOrder: 10,
  130. search: true,
  131. overHidden: true
  132. },
  133. {
  134. label: "客户名称",
  135. prop: "corpCnName",
  136. width: "120",
  137. overHidden: true,
  138. search: true,
  139. type: 'select',
  140. filterable: true,
  141. remote: true,
  142. dicUrl: "/api/blade-los/bcorps/listByType?corpTypeName=客户&cnName={{key}}",
  143. props: {
  144. label: 'cnName',
  145. value: 'cnName',
  146. res: 'data.records'
  147. },
  148. searchOrder: 1,
  149. },
  150. {
  151. label: "合同号",
  152. prop: "bookingNo",
  153. width: "140",
  154. overHidden: true,
  155. search: true,
  156. searchOrder: 2,
  157. },
  158. {
  159. label: "提单号",
  160. prop: "mblno",
  161. width: "120",
  162. overHidden: true,
  163. search: true,
  164. searchOrder: 3,
  165. },
  166. {
  167. label: "委托编号",
  168. prop: "billNo",
  169. width: "120",
  170. overHidden: true,
  171. search: true,
  172. searchOrder: 9,
  173. },
  174. {
  175. label: "放单方式",
  176. prop: "mconsigneeCntyCode",
  177. width: "90",
  178. overHidden: true,
  179. },
  180. {
  181. label: "应收结算状态",
  182. prop: "stlDrStatusDescr",
  183. width: "160",
  184. overHidden: true,
  185. },
  186. {
  187. label: "应付结算状态",
  188. prop: "stlCrStatusDescr",
  189. width: "160",
  190. overHidden: true,
  191. },
  192. {
  193. label: "审核状态",
  194. prop: "status",
  195. type: 'select',
  196. dicUrl: "/api/blade-system/dict-biz/dictionary?code=audit_status_los",
  197. width: '120',
  198. props: {
  199. label: "dictValue",
  200. value: "dictKey"
  201. },
  202. overHidden: true,
  203. },
  204. {
  205. label: "发货人",
  206. prop: "hshipperCnName",
  207. width: "80",
  208. overHidden: true,
  209. },
  210. {
  211. label: "收货人",
  212. prop: "hconsigneeCnName",
  213. width: "80",
  214. overHidden: true,
  215. },
  216. {
  217. label: "船名",
  218. prop: "vesselCnName",
  219. width: "80",
  220. overHidden: true,
  221. },
  222. {
  223. label: "航次",
  224. prop: "voyageNo",
  225. width: "80",
  226. overHidden: true,
  227. },
  228. {
  229. label: "起运港",
  230. prop: "polCnName",
  231. width: "80",
  232. overHidden: true
  233. },
  234. {
  235. label: "目的港",
  236. prop: "podCnName",
  237. width: "80",
  238. overHidden: true
  239. },
  240. {
  241. label: '原产地',
  242. prop: "mnotifyCntyCode",
  243. width: "80",
  244. overHidden: true
  245. },
  246. {
  247. label: '报关单号',
  248. prop: "mnotify2CntyName",
  249. width: "100",
  250. overHidden: true
  251. },
  252. {
  253. label: '报关日期',
  254. prop: "issueDate",
  255. width: "100",
  256. overHidden: true
  257. },
  258. {
  259. label: "开船日期",
  260. prop: "etd",
  261. width: "120",
  262. overHidden: true,
  263. search: true,
  264. searchOrder: 6,
  265. searchProp: "etdList",
  266. type: "date",
  267. unlinkPanels: true,
  268. searchRange: true,
  269. format: "yyyy-MM-dd",
  270. valueFormat: "yyyy-MM-dd HH:mm:ss",
  271. searchDefaultTime: ["00:00:00", "23:59:59"],
  272. },
  273. {
  274. label: "预计到港",
  275. prop: "bookingDate",
  276. width: "120",
  277. overHidden: true,
  278. search: true,
  279. searchOrder: 7,
  280. searchProp: "bookingDateList",
  281. type: "date",
  282. unlinkPanels: true,
  283. searchRange: true,
  284. format: "yyyy-MM-dd",
  285. valueFormat: "yyyy-MM-dd HH:mm:ss",
  286. searchDefaultTime: ["00:00:00", "23:59:59"],
  287. },
  288. {
  289. label: "实际到港",
  290. prop: "eta",
  291. width: "120",
  292. overHidden: true,
  293. search: true,
  294. searchOrder: 8,
  295. searchProp: "etaList",
  296. type: "date",
  297. unlinkPanels: true,
  298. searchRange: true,
  299. format: "yyyy-MM-dd",
  300. valueFormat: "yyyy-MM-dd HH:mm:ss",
  301. searchDefaultTime: ["00:00:00", "23:59:59"],
  302. },
  303. {
  304. label: "品名",
  305. prop: "commodityCnName",
  306. width: "120",
  307. overHidden: true
  308. },
  309. {
  310. label: "件数",
  311. prop: "quantity",
  312. width: "80",
  313. overHidden: true
  314. },
  315. {
  316. label: "重量",
  317. prop: "grossWeight",
  318. width: "80",
  319. overHidden: true
  320. },
  321. {
  322. label: "装箱方式",
  323. prop: "loadType",
  324. type: 'select',
  325. dicData: [{
  326. label: '整箱',
  327. value: 'FCL'
  328. }, {
  329. label: '拼箱',
  330. value: 'LCL'
  331. }],
  332. width: "120",
  333. overHidden: true,
  334. },
  335. {
  336. label: "箱型箱量",
  337. prop: "quantityCntrDescr",
  338. width: "100",
  339. overHidden: true
  340. },
  341. {
  342. label: "利润",
  343. prop: "amountProfitLoc",
  344. width: "100",
  345. overHidden: true
  346. },
  347. {
  348. label: "应付",
  349. prop: "amountCrLoc",
  350. width: "100",
  351. overHidden: true
  352. },
  353. {
  354. label: "应收",
  355. prop: "amountDrLoc",
  356. width: "100",
  357. overHidden: true
  358. },
  359. {
  360. label: '贸易方式',
  361. prop: "mshipperCntyName",
  362. width: "100",
  363. overHidden: true
  364. },
  365. {
  366. label: "创建人",
  367. prop: "createUserName",
  368. width: "80",
  369. overHidden: true
  370. },
  371. {
  372. label: "创建日期",
  373. prop: "createTime",
  374. width: "100",
  375. overHidden: true
  376. },
  377. {
  378. label: "修改人",
  379. prop: "updateUserName",
  380. width: "80",
  381. overHidden: true
  382. },
  383. {
  384. label: "修改日期",
  385. prop: "updateTime",
  386. width: "100",
  387. overHidden: true
  388. },
  389. {
  390. label: "备注",
  391. prop: "remarks",
  392. width: "80",
  393. overHidden: true
  394. },
  395. {
  396. label: "多选",
  397. prop: "checkbox",
  398. overHidden: true,
  399. search: true,
  400. searchSpan: 18,
  401. searchOrder: 14,
  402. hide: true,
  403. showColumn: false,
  404. }
  405. ]
  406. },
  407. data: [],
  408. };
  409. },
  410. components: {
  411. detailsPage,
  412. },
  413. async created() {
  414. this.option = await this.getColumnData(this.getColumnName(387), this.optionBack);
  415. // 获取业务审核状态
  416. getWorkDicts('audit_status_los').then(res => {
  417. this.auditStatusList = res.data.data;
  418. })
  419. },
  420. activated() {
  421. setTimeout(() => {
  422. if (this.$route.query.billNo) {
  423. this.isShow = false
  424. this.$store.commit("IN_OCEANFS_DETAIL");
  425. }
  426. if (this.$route.query.id) {
  427. this.isShow = false
  428. this.$store.commit("IN_OCEANFS_DETAIL");
  429. }
  430. if (this.$route.query.home) {
  431. this.isShow = false
  432. }
  433. }, 100);
  434. },
  435. methods: {
  436. allClick(name) {
  437. if (name == '退押') {
  438. let ids = []
  439. for (let item of this.selectionList) {
  440. ids.push(item.id)
  441. if (item.billingStatus == 1) return this.$message.error('第' + Number(item.$index + 1) + '行不能退押');
  442. }
  443. const loading = this.$loading({
  444. lock: true,
  445. text: '加载中',
  446. spinner: 'el-icon-loading',
  447. background: 'rgba(255,255,255,0.7)'
  448. });
  449. retreatPledge({ ids: ids.join(','), type: 1 }).then(res => {
  450. this.$message.success("操作成功");
  451. this.onLoad(this.page, this.query);
  452. }).finally(() => {
  453. loading.close()
  454. })
  455. }
  456. if (name == '撤销退押') {
  457. let ids = []
  458. for (let item of this.selectionList) {
  459. ids.push(item.id)
  460. if (item.billingStatus == 0) return this.$message.error('第' + Number(item.$index + 1) + '行不能撤销退押');
  461. }
  462. const loading = this.$loading({
  463. lock: true,
  464. text: '加载中',
  465. spinner: 'el-icon-loading',
  466. background: 'rgba(255,255,255,0.7)'
  467. });
  468. retreatPledge({ ids: ids.join(','), type: 2 }).then(res => {
  469. this.$message.success("操作成功");
  470. this.onLoad(this.page, this.query);
  471. }).finally(() => {
  472. loading.close()
  473. })
  474. }
  475. },
  476. handleCheckedChange() {
  477. delete this.query.whetherSail
  478. delete this.query.whetherReachHarbor
  479. delete this.query.whetherClearance
  480. delete this.query.whetherDispatchCar
  481. delete this.query.whetherCancel
  482. if (this.query.checkbox) {
  483. this.query.checkbox.forEach(e => {
  484. this.query[e] = 1
  485. })
  486. }
  487. },
  488. addButton() {
  489. this.isShow = false
  490. this.$store.commit("IN_OCEANFS_DETAIL");
  491. },
  492. copyButton() {
  493. this.isShow = false
  494. this.detailData = {
  495. copyId: this.selectionList[0].id
  496. };
  497. this.$store.commit("IN_OCEANFS_DETAIL");
  498. },
  499. rowEdit(row) {
  500. this.detailData = {
  501. id: row.id
  502. };
  503. this.isShow = false
  504. this.$store.commit("IN_OCEANFS_DETAIL");
  505. },
  506. // 删除
  507. rowDel(row, index) {
  508. this.$confirm("确定将选择数据删除?", {
  509. confirmButtonText: "确定",
  510. cancelButtonText: "取消",
  511. type: "warning"
  512. }).then(() => {
  513. remove({ ids: row.id }).then(res => {
  514. this.onLoad(this.page, this.query);
  515. this.$message.success("成功删除");
  516. })
  517. })
  518. },
  519. searchReset() {
  520. this.query = this.$options.data().query;
  521. this.onLoad(this.page);
  522. },
  523. // 搜索按钮点击
  524. searchChange(params, done) {
  525. this.page.currentPage = 1;
  526. this.onLoad(this.page, this.query);
  527. done();
  528. },
  529. selectionChange(list) {
  530. this.selectionList = list;
  531. },
  532. currentChange(currentPage) {
  533. this.page.currentPage = currentPage;
  534. },
  535. sizeChange(pageSize) {
  536. this.page.pageSize = pageSize;
  537. },
  538. refreshChange() {
  539. this.onLoad(this.page, this.query);
  540. },
  541. onLoad(page, params = {}) {
  542. let obj = {}
  543. obj = {
  544. ...Object.assign(params, this.query),
  545. }
  546. console.log(obj)
  547. this.loading = true;
  548. getList(page.currentPage, page.pageSize, obj).then(res => {
  549. this.data = res.data.data.records;
  550. this.page.total = res.data.data.total;
  551. this.$nextTick(() => {
  552. this.$refs.crud.doLayout();
  553. this.$refs.crud.dicInit();
  554. });
  555. }).finally(() => {
  556. this.loading = false;
  557. })
  558. },
  559. // 详情的返回列表
  560. goBack() {
  561. // 初始化数据
  562. if (JSON.stringify(this.$route.query) != "{}") {
  563. this.$router.$avueRouter.closeTag();
  564. this.$router.push({
  565. path: "/tradeAgency/oceanFreightImport/index"
  566. });
  567. }
  568. this.$store.commit("OUT_OCEANFS_DETAIL");
  569. this.detailData = {}
  570. this.isShow = true;
  571. this.onLoad(this.page, this.query);
  572. },
  573. outExport() {
  574. let config = { params: { ...this.query } }
  575. if (config.params) {
  576. for (const propName of Object.keys(config.params)) {
  577. const value = config.params[propName];
  578. if (value !== null && typeof (value) !== "undefined") {
  579. if (value instanceof Array) {
  580. for (const key of Object.keys(value)) {
  581. let params = propName + '[' + key + ']';
  582. config.params[params] = value[key]
  583. }
  584. delete config.params[propName]
  585. }
  586. }
  587. }
  588. }
  589. const routeData = this.$router.resolve({
  590. path: '/api/blade-los/agentview/export', //跳转目标窗口的地址
  591. query: {
  592. ...config.params, //括号内是要传递给新窗口的参数
  593. identification: this.url
  594. }
  595. })
  596. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  597. },
  598. //自定义列保存
  599. async saveColumn(ref, option, optionBack, code) {
  600. /**
  601. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  602. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  603. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  604. */
  605. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  606. if (inSave) {
  607. this.$message.success("保存成功");
  608. //关闭窗口
  609. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  610. this.searchReset()
  611. }
  612. },
  613. //自定义列重置
  614. async resetColumn(ref, option, optionBack, code) {
  615. this[option] = this[optionBack];
  616. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  617. if (inSave) {
  618. this.$message.success("重置成功");
  619. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  620. this.searchReset()
  621. }
  622. },
  623. // 更改表格颜色
  624. headerClassName(tab) {
  625. //颜色间隔
  626. let back = ""
  627. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  628. if (tab.columnIndex % 2 === 0) {
  629. back = "back-one"
  630. } else if (tab.columnIndex % 2 === 1) {
  631. back = "back-two"
  632. }
  633. }
  634. return back;
  635. },
  636. }
  637. }
  638. </script>
  639. <style scoped>
  640. ::v-deep#out-table .back-one {
  641. background: #ecf5ff !important;
  642. text-align: center;
  643. }
  644. ::v-deep#out-table .back-two {
  645. background: #ecf5ff !important;
  646. text-align: center;
  647. }
  648. .pointerClick {
  649. cursor: pointer;
  650. color: #1e9fff;
  651. }
  652. ::v-deep .el-col-md-8 {
  653. width: 24.33333%;
  654. }
  655. </style>