index.vue 19 KB

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