index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :search.sync="query"
  4. v-model="form" ref="crud" id="out-table" :header-cell-class-name="headerClassName" @row-del="rowDel"
  5. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  6. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 411)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 411)" @on-load="onLoad">
  9. <template slot="menuLeft">
  10. <el-button type="success" size="small" plain @click="Export">导出</el-button>
  11. </template>
  12. <template slot="header">
  13. <avue-crud :data="commodityData" :table-loading="itemLoading" :option="itemOption"></avue-crud>
  14. </template>
  15. <template slot="billNo" slot-scope="{row}">
  16. <span
  17. style="color: #1e9fff;cursor: pointer;width: 100%;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;"
  18. @click.stop="rowCell(row)">
  19. {{ row.billNo }}
  20. </span>
  21. </template>
  22. <template slot="mblno" slot-scope="{row}">
  23. <span
  24. style="color: #1e9fff;cursor: pointer;width: 100%;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;"
  25. @click.stop="rowCell(row)">
  26. {{ row.mblno }}
  27. </span>
  28. </template>
  29. <template slot="srcNo" slot-scope="{row}">
  30. <span
  31. style="color: #1e9fff;cursor: pointer;width: 100%;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;"
  32. @click.stop="rowCell(row)">
  33. {{ row.srcNo }}
  34. </span>
  35. </template>
  36. </avue-crud>
  37. </basic-container>
  38. </template>
  39. <script>
  40. import { getList, boxNumberProfitStatisticsSum } from "@/api/iosBasicData/costStatistics";
  41. import { getToken } from "@/util/auth";
  42. export default {
  43. data() {
  44. return {
  45. form: {},
  46. query: {},
  47. loading: false,
  48. itemLoading: false,
  49. page: {
  50. pageSize: 20,
  51. currentPage: 1,
  52. total: 0
  53. },
  54. selectionList: [],
  55. option: {},
  56. optionBack: {
  57. height: '600px',
  58. calcHeight: 30,
  59. searchShow: true,
  60. searchMenuSpan: 18,
  61. border: true,
  62. index: true,
  63. addBtn: false,
  64. menu: false,
  65. searchIcon: true,
  66. searchIndex: 3,
  67. dialogClickModal: false,
  68. emptyBtnText: '清空所有条件',
  69. column: [
  70. {
  71. label: "是否结算",
  72. prop: "whetherSettlement",
  73. width: '100',
  74. search: true,
  75. type: 'select',
  76. dicData: [{
  77. label: '已结算',
  78. value: 1
  79. }, {
  80. label: '未结算',
  81. value: 0
  82. }],
  83. overHidden: true,
  84. },
  85. {
  86. label: "费用类型",
  87. prop: "dc",
  88. width: '100',
  89. type: 'select',
  90. search: true,
  91. dicData: [{
  92. label: '应收',
  93. value: "D"
  94. }, {
  95. label: '应付',
  96. value: "C"
  97. }],
  98. overHidden: true,
  99. },
  100. {
  101. label: "费用名称",
  102. prop: "feeName",
  103. search: true,
  104. type: 'select',
  105. filterable: true,
  106. dicUrl: '/api/blade-los/bfees/listAll',
  107. overHidden: true,
  108. props: {
  109. label: "cnName",
  110. value: "id"
  111. },
  112. },
  113. {
  114. label: "往来单位",
  115. prop: "corpName",
  116. type: 'select',
  117. search: true,
  118. filterable: true,
  119. remote: true,
  120. dicUrl: "/api/blade-los/bcorps/listByType?cnName={{key}}",
  121. props: {
  122. label: 'cnName',
  123. value: 'id',
  124. res: 'data.records'
  125. },
  126. overHidden: true,
  127. },
  128. {
  129. label: "业务类型",
  130. prop: "type",
  131. type: 'select',
  132. search: true,
  133. multiple: true,
  134. tags: true,
  135. dataType: 'string',
  136. dicData: [
  137. {
  138. label: '贸易代理',
  139. value: "MYDL"
  140. },
  141. {
  142. label: '海运出口',
  143. value: "SE"
  144. },
  145. {
  146. label: '海运进口',
  147. value: "SI"
  148. },
  149. {
  150. label: '海运出口amend',
  151. value: "ASE"
  152. },
  153. {
  154. label: '海运进口amend',
  155. value: "ASI"
  156. }
  157. ],
  158. overHidden: true,
  159. },
  160. {
  161. label: "业务编号",
  162. prop: "billNo",
  163. search: true,
  164. overHidden: true,
  165. },
  166. {
  167. label: "提单号",
  168. prop: "mblno",
  169. search: true,
  170. overHidden: true,
  171. },
  172. {
  173. label: "来源编号",
  174. prop: "srcNo",
  175. search: true,
  176. overHidden: true,
  177. },
  178. {
  179. label: "统计期间",
  180. prop: "billDate",
  181. search: true,
  182. overHidden: true,
  183. searchProp: "etdList",
  184. type: "date",
  185. unlinkPanels: true,
  186. searchRange: true,
  187. format: "yyyy-MM-dd",
  188. valueFormat: "yyyy-MM-dd HH:mm:ss",
  189. searchDefaultTime: ["00:00:00", "23:59:59"],
  190. },
  191. {
  192. label: "金额(CNY)",
  193. prop: "amount",
  194. overHidden: true,
  195. },
  196. {
  197. label: "金额(USD)",
  198. prop: "amountUsd",
  199. overHidden: true,
  200. },
  201. {
  202. label: "结算金额(CNY)",
  203. prop: "settlementAmount",
  204. overHidden: true,
  205. },
  206. {
  207. label: "结算金额(USD)",
  208. prop: "settlementAmountUsd",
  209. overHidden: true,
  210. },
  211. {
  212. label: "余额(CNY)",
  213. prop: "balanceAmount",
  214. overHidden: true,
  215. },
  216. {
  217. label: "余额(USD)",
  218. prop: "balanceAmountUsd",
  219. overHidden: true,
  220. }
  221. ]
  222. },
  223. data: [],
  224. commodityData: [],
  225. itemOption: {
  226. border: true,
  227. align: 'center',
  228. header: false,
  229. menu: false,
  230. height: '90',
  231. column: [
  232. {
  233. label: "金额(CNY)",
  234. prop: "amount",
  235. overHidden: true,
  236. },
  237. {
  238. label: "金额(USD)",
  239. prop: "amountUsd",
  240. overHidden: true,
  241. },
  242. {
  243. label: "结算金额(CNY)",
  244. prop: "settlementAmount",
  245. overHidden: true,
  246. },
  247. {
  248. label: "结算金额(USD)",
  249. prop: "settlementAmountUsd",
  250. overHidden: true,
  251. },
  252. {
  253. label: "余额(CNY)",
  254. prop: "balanceAmount",
  255. overHidden: true,
  256. },
  257. {
  258. label: "余额(USD)",
  259. prop: "balanceAmountUsd",
  260. overHidden: true,
  261. }
  262. ]
  263. },
  264. };
  265. },
  266. async created() {
  267. this.option = await this.getColumnData(this.getColumnName(411), this.optionBack)
  268. },
  269. methods: {
  270. rowCell(row) {
  271. if (row.type == 'MYDL') {
  272. this.$router.push({
  273. path: `/tradeAgency/tradeAgency/index`,
  274. query: {
  275. params: row.srcId
  276. }
  277. })
  278. }
  279. if (row.type == 'SE') {
  280. if (this.$store.getters.seaFEStatus) {
  281. this.$alert("海运出口页面已存在,请关闭海运出口再进行操作", "温馨提示", {
  282. confirmButtonText: "确定",
  283. type: 'warning',
  284. callback: action => {
  285. }
  286. });
  287. } else {
  288. this.$router.push({
  289. path: `/iosBasicData/SeafreightExportF/bills/index`,
  290. query: {
  291. id: row.srcId
  292. }
  293. })
  294. }
  295. }
  296. if (row.type == 'ASE') {
  297. if (this.$store.getters.SFEStatus) {
  298. this.$alert("SEAMEND页面已存在,请关闭SEAMEND再进行操作", "温馨提示", {
  299. confirmButtonText: "确定",
  300. type: 'warning',
  301. callback: action => {
  302. }
  303. });
  304. } else {
  305. this.$router.push({
  306. path: `/iosBasicData/seamends/index`,
  307. query: {
  308. id: row.srcId
  309. }
  310. })
  311. }
  312. }
  313. if (row.type == 'SI') {
  314. if (this.$store.getters.OceanFIStatus) {
  315. this.$alert("海运进口页面已存在,请关闭海运进口再进行操作", "温馨提示", {
  316. confirmButtonText: "确定",
  317. type: 'warning',
  318. callback: action => {
  319. }
  320. });
  321. } else {
  322. this.$router.push({
  323. path: `/iosBasicData/OceanFreightImport/bills/index`,
  324. query: {
  325. id: row.srcId
  326. }
  327. })
  328. }
  329. }
  330. if (row.type == 'ASI') {
  331. if (this.$store.getters.OFIStatus) {
  332. this.$alert("SIAMEND页面已存在,请关闭SIAMEND再进行操作", "温馨提示", {
  333. confirmButtonText: "确定",
  334. type: 'warning',
  335. callback: action => {
  336. }
  337. });
  338. } else {
  339. this.$router.push({
  340. path: `/iosBasicData/siamends/index`,
  341. query: {
  342. id: row.srcId
  343. }
  344. })
  345. }
  346. }
  347. },
  348. searchReset() {
  349. this.query = {};
  350. this.onLoad(this.page);
  351. },
  352. // 搜索点击回调
  353. searchChange(params, done) {
  354. this.page.currentPage = 1;
  355. if (params.etdList) {
  356. params = {
  357. ...params,
  358. startDate: params.etdList[0],
  359. endDate: params.etdList[1],
  360. }
  361. }
  362. this.query = params
  363. this.onLoad(this.page, params);
  364. done();
  365. },
  366. selectionChange(list) {
  367. this.selectionList = list;
  368. },
  369. currentChange(currentPage) {
  370. this.page.currentPage = currentPage;
  371. },
  372. sizeChange(pageSize) {
  373. this.page.pageSize = pageSize;
  374. },
  375. refreshChange() {
  376. this.onLoad(this.page, this.query);
  377. },
  378. onLoad(page, params = {}) {
  379. if (params.etdList) {
  380. params = {
  381. ...params,
  382. startDate: params.etdList[0],
  383. endDate: params.etdList[1],
  384. }
  385. }
  386. this.loading = true;
  387. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  388. this.page.total = res.data.data.total;
  389. this.data = res.data.data.records
  390. this.getStatisticsSum(Object.assign(params, this.query))
  391. this.$nextTick(() => {
  392. this.$refs.crud.refreshTable()
  393. this.$refs.crud.dicInit()
  394. })
  395. }).finally(() => {
  396. this.loading = false;
  397. })
  398. },
  399. getStatisticsSum(params) {
  400. this.itemLoading = true
  401. boxNumberProfitStatisticsSum(params).then(res => {
  402. this.commodityData = [res.data.data]
  403. }).finally(() => {
  404. this.itemLoading = false;
  405. })
  406. },
  407. Export() {
  408. const routeData = this.$router.resolve({
  409. path: '/api/blade-los/financeStatistics/feeSettlementExport',//跳转目标窗口的地址
  410. query: {
  411. 'Blade-Auth': getToken(),
  412. ...this.query
  413. }
  414. })
  415. window.open(routeData.href.slice(1, routeData.href.length));
  416. },
  417. //自定义列保存
  418. async saveColumnTwo(ref, option, optionBack, code) {
  419. /**
  420. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  421. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  422. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  423. */
  424. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  425. if (inSave) {
  426. this.$message.success("保存成功");
  427. //关闭窗口
  428. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  429. }
  430. },
  431. //自定义列重置
  432. async resetColumnTwo(ref, option, optionBack, code) {
  433. this[option] = this[optionBack];
  434. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  435. if (inSave) {
  436. this.$message.success("重置成功");
  437. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  438. }
  439. },
  440. // 更改表格颜色
  441. headerClassName(tab) {
  442. //颜色间隔
  443. let back = ""
  444. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  445. if (tab.columnIndex % 2 === 0) {
  446. back = "back-one"
  447. } else if (tab.columnIndex % 2 === 1) {
  448. back = "back-two"
  449. }
  450. }
  451. return back;
  452. },
  453. }
  454. };
  455. </script>
  456. <style scoped>
  457. ::v-deep#out-table .back-one {
  458. background: #ecf5ff !important;
  459. text-align: center;
  460. }
  461. ::v-deep#out-table .back-two {
  462. background: #ecf5ff !important;
  463. text-align: center;
  464. }
  465. ::v-deep .el-col-md-8 {
  466. width: 24.33333%;
  467. }
  468. ::v-deep.el-form-item {
  469. margin-bottom: 0;
  470. }
  471. </style>