index.vue 22 KB

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