index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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', 498)"
  9. @saveColumn="saveColumn('crud', 'option', 'optionBack', 498)" @on-load="onLoad">
  10. <template slot="menuLeft">
  11. <el-button type="primary" size="small" icon="el-icon-plus" @click="addButton">创建单据
  12. </el-button>
  13. <el-button type="success" size="small" :disabled="selectionList.length != 1"
  14. @click="copyButton">复制单据
  15. </el-button>
  16. <el-button type="warning" size="small" @click="outExport">导 出</el-button>
  17. </template>
  18. <template slot="menu" slot-scope="{ row, index }">
  19. <el-button size="small" icon="el-icon-edit" type="text" @click="rowEdit(row)">编辑</el-button>
  20. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  21. :disabled="row.issueStatus != 0">删 除</el-button>
  22. </template>
  23. <template slot="actualShippingCompanyCname" slot-scope="{ row }">
  24. <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{
  25. row.actualShippingCompanyCname }}</span>
  26. </template>
  27. <template slot="status" slot-scope="{ row }">
  28. <span v-if="row.issueStatus == 0"
  29. style="color: #fff;border-radius: 30px;padding: 2px 15px;background-color: #409EFF;">{{
  30. row.status }}</span>
  31. <span v-if="row.issueStatus != 0"
  32. style="color: #fff;border-radius: 30px;padding: 2px 15px;background-color: #67C23A;">{{
  33. row.status }}</span>
  34. </template>
  35. </avue-crud>
  36. </basic-container>
  37. <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
  38. </div>
  39. </template>
  40. <script>
  41. import { getList, remove } from "@/api/iosBasicData/businessCenter/bookingCabin.js";
  42. import { getWorkDicts } from "@/api/system/dictbiz";
  43. import detailsPage from "./detailsPage";
  44. import { getToken } from "@/util/auth";
  45. import { dateFormat } from "@/util/date";
  46. import _ from "lodash";
  47. export default {
  48. data() {
  49. return {
  50. isShow: true,
  51. form: {},
  52. query: {
  53. businessType: 'YDC'
  54. },
  55. loading: false,
  56. page: {
  57. pageSize: 10,
  58. currentPage: 1,
  59. total: 0
  60. },
  61. selectionList: [],
  62. option: {},
  63. optionBack: {
  64. height: 'auto',
  65. calcHeight: 30,
  66. menuWidth: 140,
  67. tip: false,
  68. searchShow: true,
  69. searchMenuSpan: 18,
  70. border: true,
  71. index: true,
  72. addBtn: false,
  73. viewBtn: false,
  74. editBtn: false,
  75. delBtn: false,
  76. selection: true,
  77. searchIcon: true,
  78. align: 'center',
  79. searchIndex: 3,
  80. column: [
  81. // {
  82. // label: "系统号",
  83. // prop: "businessNo",
  84. // width: "120",
  85. // overHidden: true,
  86. // },
  87. {
  88. label: '所属公司',
  89. prop: "branchName",
  90. width: "120",
  91. overHidden: true,
  92. },
  93. {
  94. label: '预定舱单号',
  95. prop: "temporaryNo",
  96. width: "100",
  97. search: true,
  98. overHidden: true,
  99. },
  100. {
  101. label: 'OP',
  102. prop: "operatorName",
  103. width: "100",
  104. overHidden: true,
  105. },
  106. {
  107. label: '客服',
  108. prop: "customerServiceName",
  109. width: "100",
  110. overHidden: true,
  111. },
  112. {
  113. label: '承运人',
  114. prop: "actualShippingCompanyCname",
  115. width: "100",
  116. overHidden: true,
  117. },
  118. {
  119. label: "船公司",
  120. prop: "carrierCnName",
  121. width: "80",
  122. overHidden: true,
  123. search: true,
  124. type: 'select',
  125. filterable: true,
  126. remote: true,
  127. dicUrl: "/api/blade-los/bcorps/list?current=1&size=5&corpTypeName=船公司&cnName={{key}}",
  128. props: {
  129. label: 'shortName',
  130. value: 'shortName',
  131. desc: 'code',
  132. res: 'data.records'
  133. },
  134. },
  135. {
  136. label: "航线",
  137. prop: "lineCnName",
  138. width: "80",
  139. overHidden: true,
  140. search: true,
  141. type: 'select',
  142. filterable: true,
  143. remote: true,
  144. dicUrl: "/api/blade-los/blines/list?cnName={{key}}",
  145. props: {
  146. label: 'cnName',
  147. value: 'cnName',
  148. res: 'data.records'
  149. },
  150. },
  151. {
  152. label: "起运港",
  153. prop: "polCnName",
  154. width: "80",
  155. overHidden: true,
  156. search: true,
  157. type: 'select',
  158. filterable: true,
  159. remote: true,
  160. dicUrl: "/api/blade-los/bports/list?current=1&size=5&cnName={{key}}",
  161. props: {
  162. label: 'cnName',
  163. value: 'cnName',
  164. desc: 'code',
  165. res: 'data.records'
  166. },
  167. },
  168. {
  169. label: "卸货港",
  170. prop: "podCnName",
  171. width: "80",
  172. overHidden: true,
  173. search: true,
  174. type: 'select',
  175. filterable: true,
  176. remote: true,
  177. dicUrl: "/api/blade-los/bports/list?current=1&size=5&cnName={{key}}",
  178. props: {
  179. label: 'cnName',
  180. value: 'cnName',
  181. desc: 'code',
  182. res: 'data.records'
  183. },
  184. },
  185. {
  186. label: '船司约号',
  187. prop: "carrierArgreementNo",
  188. width: "100",
  189. overHidden: true,
  190. },
  191. {
  192. label: 'ETD',
  193. prop: "etd",
  194. width: "100",
  195. overHidden: true,
  196. type: "date",
  197. format: "yyyy-MM-dd",
  198. valueFormat: "yyyy-MM-dd 00:00:00",
  199. },
  200. {
  201. label: '付费方式',
  202. prop: "mpaymode",
  203. width: "100",
  204. overHidden: true,
  205. },
  206. {
  207. label: '箱属',
  208. prop: "boxBelongsTo",
  209. width: "100",
  210. overHidden: true,
  211. },
  212. {
  213. label: "运输条款",
  214. prop: "serviceTerms",
  215. width: "80",
  216. overHidden: true,
  217. },
  218. {
  219. label: '总TEU',
  220. prop: "teu",
  221. width: "100",
  222. overHidden: true,
  223. },
  224. {
  225. label: '件数',
  226. prop: "quantity",
  227. width: "100",
  228. overHidden: true,
  229. },
  230. {
  231. label: '包装',
  232. prop: "packingUnit",
  233. width: "100",
  234. overHidden: true,
  235. },
  236. {
  237. label: '毛重(KGS)',
  238. prop: "grossWeight",
  239. width: "100",
  240. overHidden: true,
  241. },
  242. {
  243. label: '尺码(CBM)',
  244. prop: "measurement",
  245. width: "100",
  246. overHidden: true,
  247. },
  248. {
  249. label: '订舱代理',
  250. prop: "bookingAgentCnName",
  251. width: "100",
  252. overHidden: true,
  253. },
  254. {
  255. label: '订舱备注',
  256. prop: "cyRemarks",
  257. width: "100",
  258. overHidden: true,
  259. },
  260. {
  261. label: 'MB/L NO',
  262. prop: "mblno",
  263. width: "100",
  264. overHidden: true,
  265. },
  266. {
  267. label: '船名',
  268. prop: "vesselCnName",
  269. width: "100",
  270. overHidden: true,
  271. },
  272. {
  273. label: '航次',
  274. prop: "voyageNo",
  275. width: "100",
  276. overHidden: true,
  277. type: "date",
  278. format: "yyyy-MM-dd",
  279. valueFormat: "yyyy-MM-dd HH:mm:ss",
  280. },
  281. {
  282. label: '截单日期',
  283. prop: "cyTrailerTime",
  284. width: "100",
  285. overHidden: true,
  286. type: "date",
  287. format: "yyyy-MM-dd",
  288. valueFormat: "yyyy-MM-dd HH:mm:ss",
  289. },
  290. {
  291. label: '截港日期',
  292. prop: "cyReturnTime",
  293. width: "100",
  294. overHidden: true,
  295. type: "date",
  296. format: "yyyy-MM-dd",
  297. valueFormat: "yyyy-MM-dd HH:mm:ss",
  298. },
  299. {
  300. label: "制单人",
  301. prop: "createUserName",
  302. width: "100",
  303. overHidden: true,
  304. },
  305. {
  306. label: "制单日期",
  307. prop: "createTime",
  308. width: "120",
  309. overHidden: true,
  310. },
  311. {
  312. label: "修改人",
  313. prop: "updateUserName",
  314. width: "100",
  315. overHidden: true
  316. },
  317. {
  318. label: "修改日期",
  319. prop: "updateTime",
  320. width: "120",
  321. overHidden: true,
  322. },
  323. {
  324. label: "备注",
  325. prop: "remarks",
  326. width: "100",
  327. overHidden: true
  328. },
  329. ]
  330. },
  331. data: [],
  332. };
  333. },
  334. components: {
  335. detailsPage
  336. },
  337. async created() {
  338. this.option = await this.getColumnData(this.getColumnName(498), this.optionBack);
  339. },
  340. activated() {
  341. setTimeout(() => {
  342. if (this.$route.query.home) {
  343. this.addButton();
  344. }
  345. this.$refs.crud.doLayout();
  346. }, 100);
  347. },
  348. methods: {
  349. addButton() {
  350. this.isShow = false
  351. this.detailData = {
  352. type: 'new'
  353. }
  354. },
  355. copyButton() {
  356. this.isShow = false
  357. this.detailData = {
  358. copyId: this.selectionList[0].id
  359. };
  360. },
  361. rowEdit(row) {
  362. this.detailData = {
  363. id: row.id
  364. };
  365. this.isShow = false
  366. },
  367. // 删除
  368. rowDel(row, index) {
  369. if (row.item == 1) {
  370. return this.$message.error("存在明细不允许删除");
  371. }
  372. this.$confirm("确定将选择数据删除?", {
  373. confirmButtonText: "确定",
  374. cancelButtonText: "取消",
  375. type: "warning"
  376. }).then(() => {
  377. remove({ ids: row.id }).then(res => {
  378. this.onLoad(this.page, this.query);
  379. this.$message.success("成功删除");
  380. })
  381. })
  382. },
  383. searchReset() {
  384. this.query = this.$options.data().query;
  385. this.onLoad(this.page);
  386. },
  387. // 搜索按钮点击
  388. searchChange(params, done) {
  389. this.page.currentPage = 1;
  390. this.onLoad(this.page, this.query);
  391. done();
  392. },
  393. selectionChange(list) {
  394. this.selectionList = list;
  395. },
  396. currentChange(currentPage) {
  397. this.page.currentPage = currentPage;
  398. },
  399. sizeChange(pageSize) {
  400. this.page.pageSize = pageSize;
  401. },
  402. refreshChange() {
  403. this.onLoad(this.page, this.query);
  404. },
  405. onLoad(page, params = {}) {
  406. let obj = {}
  407. obj = {
  408. ...Object.assign(params, this.query),
  409. }
  410. this.loading = true;
  411. getList(page.currentPage, page.pageSize, obj).then(res => {
  412. this.data = res.data.data.records;
  413. this.page.total = res.data.data.total;
  414. this.$nextTick(() => {
  415. this.$refs.crud.doLayout();
  416. this.$refs.crud.dicInit();
  417. });
  418. }).finally(() => {
  419. this.loading = false;
  420. })
  421. },
  422. // 详情的返回列表
  423. goBack() {
  424. // 初始化数据
  425. if (JSON.stringify(this.$route.query) != "{}") {
  426. this.$router.$avueRouter.closeTag();
  427. this.$router.push({
  428. path: "/iosBasicData/businessCenter/bookingCabin/index"
  429. });
  430. }
  431. this.detailData = {}
  432. this.isShow = true;
  433. this.onLoad(this.page, this.query);
  434. },
  435. outExport() {
  436. let config = { params: { ...this.query } }
  437. if (config.params) {
  438. for (const propName of Object.keys(config.params)) {
  439. const value = config.params[propName];
  440. if (value !== null && typeof (value) !== "undefined") {
  441. if (value instanceof Array) {
  442. for (const key of Object.keys(value)) {
  443. let params = propName + '[' + key + ']';
  444. config.params[params] = value[key]
  445. }
  446. delete config.params[propName]
  447. }
  448. }
  449. }
  450. }
  451. const routeData = this.$router.resolve({
  452. path: '/api/blade-los/routecost/exportRouteCost', //跳转目标窗口的地址
  453. query: {
  454. ...config.params, //括号内是要传递给新窗口的参数
  455. identification: this.url
  456. }
  457. })
  458. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  459. },
  460. //自定义列保存
  461. async saveColumn(ref, option, optionBack, code) {
  462. /**
  463. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  464. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  465. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  466. */
  467. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  468. if (inSave) {
  469. this.$message.success("保存成功");
  470. //关闭窗口
  471. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  472. this.selectionList = []
  473. this.searchReset()
  474. this.$nextTick(() => {
  475. this.$refs.crud.refreshTable();
  476. this.$refs.crud.dicInit();
  477. });
  478. }
  479. },
  480. //自定义列重置
  481. async resetColumn(ref, option, optionBack, code) {
  482. this[option] = this[optionBack];
  483. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  484. if (inSave) {
  485. this.$message.success("重置成功");
  486. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  487. this.selectionList = []
  488. this.searchReset()
  489. this.$nextTick(() => {
  490. this.$refs.crud.refreshTable();
  491. this.$refs.crud.dicInit();
  492. });
  493. }
  494. },
  495. // 更改表格颜色
  496. headerClassName(tab) {
  497. //颜色间隔
  498. let back = ""
  499. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  500. if (tab.columnIndex % 2 === 0) {
  501. back = "back-one"
  502. } else if (tab.columnIndex % 2 === 1) {
  503. back = "back-two"
  504. }
  505. }
  506. return back;
  507. },
  508. }
  509. }
  510. </script>
  511. <style lang="scss" scoped>
  512. ::v-deep #out-table .back-one {
  513. background: #ecf5ff !important;
  514. text-align: center;
  515. }
  516. ::v-deep #out-table .back-two {
  517. background: #ecf5ff !important;
  518. text-align: center;
  519. }
  520. .pointerClick {
  521. cursor: pointer;
  522. color: #1e9fff;
  523. }
  524. ::v-deep .el-col-md-8 {
  525. width: 24.33333%;
  526. }
  527. </style>