index.vue 26 KB

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