index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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: "branchId",
  73. width: "120",
  74. overHidden: true,
  75. hide: true,
  76. showColumn: false,
  77. type: "select",
  78. filterable: true,
  79. dicUrl: "/api/blade-system/dept/lazy-list",
  80. props: {
  81. label: "deptName",
  82. value: "id",
  83. },
  84. search: false,
  85. },
  86. {
  87. label: "是否结算",
  88. prop: "whetherSettlement",
  89. width: '100',
  90. search: true,
  91. type: 'select',
  92. dicData: [{
  93. label: '已结算',
  94. value: 1
  95. }, {
  96. label: '未结算',
  97. value: 0
  98. }],
  99. overHidden: true,
  100. },
  101. {
  102. label: "费用类型",
  103. prop: "dc",
  104. width: '100',
  105. type: 'select',
  106. search: true,
  107. dicData: [{
  108. label: '应收',
  109. value: "D"
  110. }, {
  111. label: '应付',
  112. value: "C"
  113. }],
  114. overHidden: true,
  115. },
  116. {
  117. label: "费用名称",
  118. prop: "feeName",
  119. search: true,
  120. type: 'select',
  121. filterable: true,
  122. multiple: true,
  123. tags: true,
  124. dataType: 'string',
  125. dicUrl: '/api/blade-los/bfees/listAll',
  126. overHidden: true,
  127. props: {
  128. label: "cnName",
  129. value: "cnName"
  130. },
  131. },
  132. {
  133. label: "往来单位",
  134. prop: "corpName",
  135. type: 'select',
  136. search: true,
  137. filterable: true,
  138. remote: true,
  139. dicUrl: "/api/blade-los/bcorps/listByType?cnName={{key}}",
  140. props: {
  141. label: 'cnName',
  142. value: 'id',
  143. res: 'data.records'
  144. },
  145. overHidden: true,
  146. },
  147. {
  148. label: "业务类型",
  149. prop: "type",
  150. type: 'select',
  151. search: true,
  152. multiple: true,
  153. tags: true,
  154. dataType: 'string',
  155. dicData: [
  156. {
  157. label: '贸易代理',
  158. value: "MYDL"
  159. },
  160. {
  161. label: '海运出口',
  162. value: "SE"
  163. },
  164. {
  165. label: '海运进口',
  166. value: "SI"
  167. },
  168. {
  169. label: '海运出口amend',
  170. value: "ASE"
  171. },
  172. {
  173. label: '海运进口amend',
  174. value: "ASI"
  175. }
  176. ],
  177. overHidden: true,
  178. },
  179. {
  180. label: "业务编号",
  181. prop: "billNo",
  182. search: true,
  183. overHidden: true,
  184. },
  185. {
  186. label: "提单号",
  187. prop: "mblno",
  188. search: true,
  189. overHidden: true,
  190. },
  191. {
  192. label: "来源编号",
  193. prop: "srcNo",
  194. search: true,
  195. overHidden: true,
  196. },
  197. {
  198. label: "统计期间",
  199. prop: "billDate",
  200. search: true,
  201. overHidden: true,
  202. searchProp: "etdList",
  203. type: "date",
  204. unlinkPanels: true,
  205. searchRange: true,
  206. format: "yyyy-MM-dd",
  207. valueFormat: "yyyy-MM-dd HH:mm:ss",
  208. searchDefaultTime: ["00:00:00", "23:59:59"],
  209. },
  210. {
  211. label: "本币金额",
  212. prop: "amount",
  213. overHidden: true,
  214. },
  215. {
  216. label: "外币金额",
  217. prop: "amountUsd",
  218. overHidden: true,
  219. },
  220. {
  221. label: "本币结算金额",
  222. prop: "settlementAmount",
  223. overHidden: true,
  224. },
  225. {
  226. label: "外币结算金额",
  227. prop: "settlementAmountUsd",
  228. overHidden: true,
  229. },
  230. {
  231. label: "本币余额",
  232. prop: "balanceAmount",
  233. overHidden: true,
  234. },
  235. {
  236. label: "外币余额",
  237. prop: "balanceAmountUsd",
  238. overHidden: true,
  239. }
  240. ]
  241. },
  242. data: [],
  243. commodityData: [],
  244. itemOption: {
  245. border: true,
  246. align: 'center',
  247. header: false,
  248. menu: false,
  249. height: '90',
  250. column: [
  251. {
  252. label: "本币金额",
  253. prop: "amount",
  254. overHidden: true,
  255. },
  256. {
  257. label: "外币金额",
  258. prop: "amountUsd",
  259. overHidden: true,
  260. },
  261. {
  262. label: "本币结算金额",
  263. prop: "settlementAmount",
  264. overHidden: true,
  265. },
  266. {
  267. label: "外币结算金额",
  268. prop: "settlementAmountUsd",
  269. overHidden: true,
  270. },
  271. {
  272. label: "本币余额",
  273. prop: "balanceAmount",
  274. overHidden: true,
  275. },
  276. {
  277. label: "外币余额",
  278. prop: "balanceAmountUsd",
  279. overHidden: true,
  280. }
  281. ]
  282. },
  283. saberUserInfo: {}
  284. };
  285. },
  286. async created() {
  287. this.saberUserInfo = JSON.parse(
  288. localStorage.getItem("saber-userInfo")
  289. ).content;
  290. this.option = await this.getColumnData(this.getColumnName(411), this.optionBack)
  291. if (this.saberUserInfo.role_name.indexOf('admin') != -1 || this.saberUserInfo.role_name.indexOf('总部') != -1) {
  292. this.option.searchMenuSpan = 12
  293. this.option.column.forEach(item => {
  294. if (item.prop == 'branchId') {
  295. item.search = true
  296. }
  297. })
  298. }
  299. },
  300. activated() {
  301. this.$refs.crud.doLayout();
  302. },
  303. methods: {
  304. rowCell(row) {
  305. if (row.type == 'MYDL') {
  306. if (this.$store.getters.mydlTStatus) {
  307. this.$alert("贸易代理(T)页面已存在,请关闭贸易代理(T)再进行操作", "温馨提示", {
  308. confirmButtonText: "确定",
  309. type: 'warning',
  310. callback: action => {
  311. }
  312. });
  313. } else {
  314. this.$router.push({
  315. path: `/tradeAgency/tradeAgency/index`,
  316. query: {
  317. params: row.srcId
  318. }
  319. })
  320. }
  321. }
  322. if (row.type == 'SE') {
  323. if (this.$store.getters.seaFEStatus) {
  324. this.$alert("海运出口页面已存在,请关闭海运出口再进行操作", "温馨提示", {
  325. confirmButtonText: "确定",
  326. type: 'warning',
  327. callback: action => {
  328. }
  329. });
  330. } else {
  331. this.$router.push({
  332. path: `/iosBasicData/SeafreightExportF/bills/index`,
  333. query: {
  334. id: row.srcId
  335. }
  336. })
  337. }
  338. }
  339. if (row.type == 'ASE') {
  340. if (this.$store.getters.SFEStatus) {
  341. this.$alert("SEAMEND页面已存在,请关闭SEAMEND再进行操作", "温馨提示", {
  342. confirmButtonText: "确定",
  343. type: 'warning',
  344. callback: action => {
  345. }
  346. });
  347. } else {
  348. this.$router.push({
  349. path: `/iosBasicData/seamends/index`,
  350. query: {
  351. id: row.srcId
  352. }
  353. })
  354. }
  355. }
  356. if (row.type == 'SI') {
  357. if (this.$store.getters.OceanFIStatus) {
  358. this.$alert("海运进口页面已存在,请关闭海运进口再进行操作", "温馨提示", {
  359. confirmButtonText: "确定",
  360. type: 'warning',
  361. callback: action => {
  362. }
  363. });
  364. } else {
  365. this.$router.push({
  366. path: `/iosBasicData/OceanFreightImport/bills/index`,
  367. query: {
  368. id: row.srcId
  369. }
  370. })
  371. }
  372. }
  373. if (row.type == 'ASI') {
  374. if (this.$store.getters.OFIStatus) {
  375. this.$alert("SIAMEND页面已存在,请关闭SIAMEND再进行操作", "温馨提示", {
  376. confirmButtonText: "确定",
  377. type: 'warning',
  378. callback: action => {
  379. }
  380. });
  381. } else {
  382. this.$router.push({
  383. path: `/iosBasicData/siamends/index`,
  384. query: {
  385. id: row.srcId
  386. }
  387. })
  388. }
  389. }
  390. },
  391. searchReset() {
  392. this.query = {};
  393. this.onLoad(this.page);
  394. },
  395. // 搜索点击回调
  396. searchChange(params, done) {
  397. this.page.currentPage = 1;
  398. if (params.etdList) {
  399. params = {
  400. ...params,
  401. startDate: params.etdList[0],
  402. endDate: params.etdList[1],
  403. }
  404. }
  405. this.query = params
  406. this.onLoad(this.page, params);
  407. done();
  408. },
  409. selectionChange(list) {
  410. this.selectionList = list;
  411. },
  412. currentChange(currentPage) {
  413. this.page.currentPage = currentPage;
  414. },
  415. sizeChange(pageSize) {
  416. this.page.pageSize = pageSize;
  417. },
  418. refreshChange() {
  419. this.onLoad(this.page, this.query);
  420. },
  421. onLoad(page, params = {}) {
  422. if (params.etdList) {
  423. params = {
  424. ...params,
  425. startDate: params.etdList[0],
  426. endDate: params.etdList[1],
  427. }
  428. }
  429. this.loading = true;
  430. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  431. this.page.total = res.data.data.total;
  432. this.data = res.data.data.records
  433. this.getStatisticsSum(Object.assign(params, this.query))
  434. this.$nextTick(() => {
  435. this.$refs.crud.refreshTable()
  436. this.$refs.crud.dicInit()
  437. })
  438. }).finally(() => {
  439. this.loading = false;
  440. })
  441. },
  442. getStatisticsSum(params) {
  443. this.itemLoading = true
  444. boxNumberProfitStatisticsSum(params).then(res => {
  445. this.commodityData = [res.data.data]
  446. }).finally(() => {
  447. this.itemLoading = false;
  448. })
  449. },
  450. Export() {
  451. const routeData = this.$router.resolve({
  452. path: '/api/blade-los/financeStatistics/feeSettlementExport',//跳转目标窗口的地址
  453. query: {
  454. 'Blade-Auth': getToken(),
  455. ...this.query
  456. }
  457. })
  458. window.open(routeData.href.slice(1, routeData.href.length));
  459. },
  460. //自定义列保存
  461. async saveColumnTwo(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. }
  473. },
  474. //自定义列重置
  475. async resetColumnTwo(ref, option, optionBack, code) {
  476. this[option] = this[optionBack];
  477. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  478. if (this.saberUserInfo.role_name.indexOf('admin') != -1 || this.saberUserInfo.role_name.indexOf('总部') != -1) {
  479. this.option.searchMenuSpan = 12
  480. this.option.column.forEach(item => {
  481. if (item.prop == 'branchId') {
  482. item.search = true
  483. }
  484. })
  485. }
  486. if (inSave) {
  487. this.$message.success("重置成功");
  488. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  489. }
  490. },
  491. // 更改表格颜色
  492. headerClassName(tab) {
  493. //颜色间隔
  494. let back = ""
  495. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  496. if (tab.columnIndex % 2 === 0) {
  497. back = "back-one"
  498. } else if (tab.columnIndex % 2 === 1) {
  499. back = "back-two"
  500. }
  501. }
  502. return back;
  503. },
  504. }
  505. };
  506. </script>
  507. <style scoped>
  508. ::v-deep#out-table .back-one {
  509. background: #ecf5ff !important;
  510. text-align: center;
  511. }
  512. ::v-deep#out-table .back-two {
  513. background: #ecf5ff !important;
  514. text-align: center;
  515. }
  516. ::v-deep .el-col-md-8 {
  517. width: 24.33333%;
  518. }
  519. ::v-deep.el-form-item {
  520. margin-bottom: 0;
  521. }
  522. </style>