index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  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: "remarks",
  327. width: "80",
  328. overHidden: true
  329. },
  330. {
  331. label: "多选",
  332. prop: "checkbox",
  333. overHidden: true,
  334. search: true,
  335. searchSpan: 18,
  336. searchOrder: 14,
  337. hide: true,
  338. showColumn: false,
  339. }
  340. ]
  341. },
  342. data: [],
  343. };
  344. },
  345. components: {
  346. detailsPage,
  347. },
  348. async created() {
  349. this.option = await this.getColumnData(this.getColumnName(387), this.optionBack);
  350. },
  351. activated() {
  352. setTimeout(() => {
  353. if (this.$route.query.billNo) {
  354. this.isShow = false
  355. this.$store.commit("IN_OCEANFS_DETAIL");
  356. }
  357. }, 100);
  358. },
  359. methods: {
  360. handleCheckedChange() {
  361. delete this.query.whetherSail
  362. delete this.query.whetherReachHarbor
  363. delete this.query.whetherClearance
  364. delete this.query.whetherDispatchCar
  365. delete this.query.whetherCancel
  366. if (this.query.checkbox) {
  367. this.query.checkbox.forEach(e => {
  368. this.query[e] = 1
  369. })
  370. }
  371. },
  372. addButton() {
  373. this.isShow = false
  374. this.$store.commit("IN_OCEANFS_DETAIL");
  375. },
  376. copyButton() {
  377. this.isShow = false
  378. this.detailData = {
  379. copyId: this.selectionList[0].id
  380. };
  381. this.$store.commit("IN_OCEANFS_DETAIL");
  382. },
  383. rowEdit(row) {
  384. this.detailData = {
  385. id: row.id
  386. };
  387. this.isShow = false
  388. this.$store.commit("IN_OCEANFS_DETAIL");
  389. },
  390. // 删除
  391. rowDel(row, index) {
  392. this.$confirm("确定将选择数据删除?", {
  393. confirmButtonText: "确定",
  394. cancelButtonText: "取消",
  395. type: "warning"
  396. }).then(() => {
  397. remove({ ids: row.id }).then(res => {
  398. this.onLoad(this.page, this.query);
  399. this.$message.success("成功删除");
  400. })
  401. })
  402. },
  403. searchReset() {
  404. this.query = this.$options.data().query;
  405. this.onLoad(this.page);
  406. },
  407. // 搜索按钮点击
  408. searchChange(params, done) {
  409. this.page.currentPage = 1;
  410. this.onLoad(this.page, this.query);
  411. done();
  412. },
  413. selectionChange(list) {
  414. this.selectionList = list;
  415. },
  416. currentChange(currentPage) {
  417. this.page.currentPage = currentPage;
  418. },
  419. sizeChange(pageSize) {
  420. this.page.pageSize = pageSize;
  421. },
  422. refreshChange() {
  423. this.onLoad(this.page, this.query);
  424. },
  425. onLoad(page, params = {}) {
  426. let obj = {}
  427. obj = {
  428. ...Object.assign(params, this.query),
  429. }
  430. console.log(obj)
  431. this.loading = true;
  432. getList(page.currentPage, page.pageSize, obj).then(res => {
  433. this.data = res.data.data.records;
  434. this.page.total = res.data.data.total;
  435. this.$nextTick(() => {
  436. this.$refs.crud.doLayout();
  437. this.$refs.crud.dicInit();
  438. });
  439. }).finally(() => {
  440. this.loading = false;
  441. })
  442. },
  443. // 详情的返回列表
  444. goBack() {
  445. // 初始化数据
  446. if (JSON.stringify(this.$route.query) != "{}") {
  447. this.$router.$avueRouter.closeTag();
  448. this.$router.push({
  449. path: "/tradeAgency/oceanFreightImport/index"
  450. });
  451. }
  452. this.$store.commit("OUT_OCEANFS_DETAIL");
  453. this.detailData = {}
  454. this.isShow = true;
  455. this.onLoad(this.page, this.query);
  456. },
  457. outExport() {
  458. let config = { params: { ...this.query } }
  459. if (config.params) {
  460. for (const propName of Object.keys(config.params)) {
  461. const value = config.params[propName];
  462. if (value !== null && typeof (value) !== "undefined") {
  463. if (value instanceof Array) {
  464. for (const key of Object.keys(value)) {
  465. let params = propName + '[' + key + ']';
  466. config.params[params] = value[key]
  467. }
  468. delete config.params[propName]
  469. }
  470. }
  471. }
  472. }
  473. const routeData = this.$router.resolve({
  474. path: '/api/blade-los/agentview/export', //跳转目标窗口的地址
  475. query: {
  476. ...config.params, //括号内是要传递给新窗口的参数
  477. identification: this.url
  478. }
  479. })
  480. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  481. },
  482. //自定义列保存
  483. async saveColumn(ref, option, optionBack, code) {
  484. /**
  485. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  486. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  487. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  488. */
  489. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  490. if (inSave) {
  491. this.$message.success("保存成功");
  492. //关闭窗口
  493. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  494. this.searchReset()
  495. }
  496. },
  497. //自定义列重置
  498. async resetColumn(ref, option, optionBack, code) {
  499. this[option] = this[optionBack];
  500. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  501. if (inSave) {
  502. this.$message.success("重置成功");
  503. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  504. this.searchReset()
  505. }
  506. },
  507. // 更改表格颜色
  508. headerClassName(tab) {
  509. //颜色间隔
  510. let back = ""
  511. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  512. if (tab.columnIndex % 2 === 0) {
  513. back = "back-one"
  514. } else if (tab.columnIndex % 2 === 1) {
  515. back = "back-two"
  516. }
  517. }
  518. return back;
  519. },
  520. }
  521. }
  522. </script>
  523. <style scoped>
  524. ::v-deep#out-table .back-one {
  525. background: #ecf5ff !important;
  526. text-align: center;
  527. }
  528. ::v-deep#out-table .back-two {
  529. background: #ecf5ff !important;
  530. text-align: center;
  531. }
  532. .pointerClick {
  533. cursor: pointer;
  534. color: #1e9fff;
  535. }
  536. ::v-deep .el-col-md-8 {
  537. width: 24.33333%;
  538. }
  539. </style>