index.vue 21 KB

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