index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  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"
  5. @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange"
  6. @size-change="sizeChange" @refresh-change="refreshChange"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 334)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 334)" @on-load="onLoad">
  9. <template slot="menuLeft">
  10. <el-button type="success" size="small" plain @click="exportfun">导出</el-button>
  11. </template>
  12. <template slot="header">
  13. <el-table :data="commodityData" border size="small" @header-click="cellClick" style="width: 100%">
  14. <el-table-column v-for="(item, index) in commodityLabel" :key="index" :prop="item.prop"
  15. show-overflow-tooltip :label="item.label" />
  16. </el-table>
  17. </template>
  18. <template slot-scope="{disabled,size}" slot="dcSearch">
  19. <el-radio v-model="query.dc" label="D" @input="dcInput">应收</el-radio>
  20. <el-radio v-model="query.dc" label="C" @input="dcInput">应付</el-radio>
  21. </template>
  22. <template slot-scope="{disabled,size}" slot="businessTypeSearch">
  23. <search-query :datalist="businessTypeData" :selectValue="query.businessType" :clearable="true"
  24. :buttonIf="false" :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictKey' }"
  25. @corpFocus="businessTypeFocus" @corpChange="corpChange($event, 'businessType')">
  26. </search-query>
  27. </template>
  28. <template slot-scope="{disabled,size}" slot="clientIdSearch">
  29. <search-query :datalist="clientIdData" :selectValue="query.clientName" :filterable="true" :remote="true"
  30. :clearable="true" :buttonIf="false" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
  31. @remoteMethod="clientIdListfun" @corpFocus="clientIdListfun"
  32. @corpChange="corpChange($event, 'clientName')">
  33. </search-query>
  34. </template>
  35. <template slot-scope="{disabled,size}" slot="corpIdSearch">
  36. <search-query :datalist="corpIdData" :selectValue="query.corpName" :filterable="true" :remote="true"
  37. :clearable="true" :buttonIf="false" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
  38. @remoteMethod="getBcorpsListfun" @corpFocus="getBcorpsListfun"
  39. @corpChange="corpChange($event, 'corpName')">
  40. </search-query>
  41. </template>
  42. <template slot-scope="{disabled,size}" slot="srcIdSearch">
  43. <search-query :datalist="srcIdData" :selectValue="query.srcName" :filterable="true" :remote="true"
  44. :clearable="true" :buttonIf="false" :forParameter="{ key: 'id', label: 'name', value: 'name' }"
  45. @remoteMethod="srcCorpFocus" @corpFocus="srcCorpFocus" @corpChange="corpChange($event, 'srcName')">
  46. </search-query>
  47. </template>
  48. <template slot-scope="{disabled,size}" slot="isBusinessDateSearch">
  49. <el-checkbox v-model="query.isBusinessDate" :true-label="1" :false-label="0"
  50. @change="dateChange('isBusinessDate')">按业务日期</el-checkbox>
  51. <el-checkbox v-model="query.isToExamineDate" :true-label="1" :false-label="0"
  52. @change="dateChange('isToExamineDate')">按审核日期</el-checkbox>
  53. </template>
  54. </avue-crud>
  55. </basic-container>
  56. </template>
  57. <script>
  58. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  59. import { CurrentMonth, dateFormat, defaultDate3, defaultDate4 } from "@/util/date";
  60. import {
  61. financeStatisticsFeeSummaryDetailNot,
  62. financeStatisticsFeeSummaryDetailNotSum
  63. } from "@/api/iosBasicData/paymentSummary"
  64. import { getBcorpsList, getBcorpslistByType } from "@/api/iosBasicData/bcorps";
  65. import { getWorkDicts } from "@/api/system/dictbiz";
  66. import { getDeptLazyTree } from "@/api/system/dept";
  67. import { getList as userGetList } from '@/api/system/user'
  68. import { getToken } from "@/util/auth";
  69. export default {
  70. components: { SearchQuery },
  71. data() {
  72. return {
  73. form: {},
  74. loading: true,
  75. page: {
  76. pageSize: 10,
  77. currentPage: 1,
  78. total: 0
  79. },
  80. query: {
  81. dc: 'D',
  82. isBusinessDate: 1,
  83. isToExamineDate: 0,
  84. etdStart: defaultDate3()[0],
  85. etdEnd: defaultDate3()[1],
  86. },
  87. option: {},
  88. optionBack: {
  89. height: 'auto',
  90. calcHeight: 30,
  91. tip: false,
  92. searchShow: true,
  93. searchMenuSpan: 14,
  94. border: true,
  95. index: false,
  96. selection: true,
  97. dialogClickModal: false,
  98. menu: false,
  99. addBtn: false,
  100. viewBtn: false,
  101. delBtn: false,
  102. editBtn: false,
  103. searchIcon: true,
  104. searchIndex: 3,
  105. emptyBtnText: '清空所有条件',
  106. column: [
  107. {
  108. label: "所属公司",
  109. prop: "branchId",
  110. width: "120",
  111. overHidden: true,
  112. // hide: true,
  113. // showColumn: false,
  114. type: "select",
  115. filterable: true,
  116. dicUrl: "/api/blade-system/dept/lazy-list",
  117. props: {
  118. label: "deptName",
  119. value: "id",
  120. },
  121. search: false,
  122. },
  123. // {
  124. // label: "所属公司",
  125. // prop: "branchName",
  126. // width: "120",
  127. // overHidden: true,
  128. // },
  129. {
  130. label: "业务类型",
  131. prop: "businessType",
  132. type: 'select',
  133. dicUrl: "/api/blade-system/dict-biz/dictionary?code=audit_status_los",
  134. props: {
  135. label: 'dictValue',
  136. value: 'dictKey',
  137. },
  138. overHidden: true,
  139. },
  140. {
  141. label: "结算单位",
  142. prop: "corpName",
  143. overHidden: true,
  144. },
  145. {
  146. label: "业务编号",
  147. prop: "billNo",
  148. search: true,
  149. overHidden: true,
  150. },
  151. {
  152. label: "提单号",
  153. prop: "mblNo",
  154. search: true,
  155. overHidden: true,
  156. },
  157. {
  158. label: "船名",
  159. prop: "vesselName",
  160. overHidden: true,
  161. },
  162. {
  163. label: "航次",
  164. prop: "voyageNo",
  165. overHidden: true,
  166. },
  167. {
  168. label: "开船日期",
  169. prop: "etd",
  170. overHidden: true,
  171. },
  172. {
  173. label: "提单号",
  174. prop: "mblNo",
  175. overHidden: true,
  176. },
  177. {
  178. label: "起运港",
  179. prop: "pol",
  180. overHidden: true,
  181. },
  182. {
  183. label: "目的港",
  184. prop: "pod",
  185. overHidden: true,
  186. },
  187. {
  188. label: "箱型箱量",
  189. prop: "quantityCntrDescr",
  190. overHidden: true,
  191. },
  192. {
  193. label: "美元",
  194. prop: "amountUsdNot",
  195. overHidden: true,
  196. },
  197. {
  198. label: "人民币",
  199. prop: "amountNot",
  200. overHidden: true,
  201. },
  202. {
  203. label: "开票USD",
  204. prop: "amountInvoicingUsd",
  205. overHidden: true,
  206. },
  207. {
  208. label: "开票CNY",
  209. prop: "amountInvoicing",
  210. overHidden: true,
  211. },
  212. {
  213. label: "未开USD",
  214. prop: "amountInvoicingUsdNot",
  215. overHidden: true,
  216. },
  217. {
  218. label: "未开CNY",
  219. prop: "amountInvoicingNot",
  220. overHidden: true,
  221. },
  222. {
  223. label: "业务员",
  224. prop: "srcCnName",
  225. overHidden: true,
  226. },
  227. {
  228. label: "操作员",
  229. prop: "operatorName",
  230. overHidden: true,
  231. },
  232. {
  233. label: "业务类型",
  234. prop: "businessType",
  235. hide: true,
  236. search: true,
  237. searchslot: true,
  238. },
  239. {
  240. label: "委托人",
  241. prop: "clientId",
  242. hide: true,
  243. search: true,
  244. searchslot: true,
  245. },
  246. {
  247. label: "结算单位",
  248. prop: "corpId",
  249. hide: true,
  250. search: true,
  251. searchslot: true,
  252. },
  253. {
  254. label: "业务员",
  255. prop: "srcId",
  256. hide: true,
  257. search: true,
  258. searchslot: true,
  259. },
  260. {
  261. label: "统计开始",
  262. prop: "etdStart",
  263. search: true,
  264. overHidden: true,
  265. hide: true,
  266. type: "date",
  267. format: "yyyy-MM-dd",
  268. valueFormat: "yyyy-MM-dd",
  269. },
  270. {
  271. label: "统计结束",
  272. prop: "etdEnd",
  273. search: true,
  274. overHidden: true,
  275. hide: true,
  276. type: "date",
  277. format: "yyyy-MM-dd",
  278. valueFormat: "yyyy-MM-dd",
  279. },
  280. {
  281. label: "",
  282. prop: "dc",
  283. hide: true,
  284. search: true,
  285. searchslot: true,
  286. searchSpan: 4,
  287. searchLabelWidth: '0'
  288. },
  289. {
  290. label: "",
  291. prop: "isBusinessDate",
  292. hide: true,
  293. search: true,
  294. searchslot: true,
  295. searchLabelWidth: '0'
  296. },
  297. {
  298. label: "",
  299. prop: "isToExamineDate",
  300. hide: true,
  301. searchLabelWidth: '0',
  302. },
  303. ]
  304. },
  305. data: [],
  306. // 查询方式
  307. typeData: [
  308. {
  309. label: '结算单位',
  310. value: '1'
  311. }, {
  312. label: '委托人',
  313. value: '2'
  314. }, {
  315. label: '业务来源',
  316. value: '3'
  317. }
  318. ],
  319. // 业务类型
  320. businessTypeData: [],
  321. clientIdData: [], // 委托人
  322. corpIdData: [], // 结算单位
  323. srcIdData: [], // 业务员
  324. commodityData: [], // 合计数据
  325. // 合计的配置项
  326. commodityLabel: [
  327. {
  328. id: 1,
  329. label: "美元",
  330. prop: "amountUsdNot",
  331. },
  332. {
  333. id: 2,
  334. label: "人民币",
  335. prop: "amountNot",
  336. },
  337. {
  338. id: 3,
  339. label: "开票USD",
  340. prop: "amountInvoicingUsd",
  341. },
  342. {
  343. id: 4,
  344. label: "开票CNY",
  345. prop: "amountInvoicing",
  346. },
  347. {
  348. id: 5,
  349. label: "未开USD",
  350. prop: "amountInvoicingUsdNot",
  351. },
  352. {
  353. id: 6,
  354. label: "未开CNY",
  355. prop: "amountInvoicingNot",
  356. },
  357. ],
  358. saberUserInfo: {}
  359. }
  360. },
  361. async created() {
  362. this.saberUserInfo = JSON.parse(
  363. localStorage.getItem("saber-userInfo")
  364. ).content;
  365. this.option = await this.getColumnData(this.getColumnName(334), this.optionBack);
  366. if (this.saberUserInfo.role_name.indexOf('admin') != -1 || this.saberUserInfo.role_name.indexOf('总部') != -1) {
  367. this.option.searchMenuSpan = 24
  368. this.option.column.forEach(item => {
  369. if (item.prop == 'branchId') {
  370. item.search = true
  371. }
  372. })
  373. }
  374. this.query = {
  375. dc: 'D',
  376. isBusinessDate: 1,
  377. isToExamineDate: 0,
  378. etdStart: defaultDate3()[0],
  379. etdEnd: defaultDate3()[1],
  380. }
  381. },
  382. activated() {
  383. this.$refs.crud.doLayout();
  384. },
  385. methods: {
  386. // 导出
  387. exportfun() {
  388. const routeData = this.$router.resolve({
  389. path: '/api/blade-los/financeStatistics/feeSummaryDetailExportNot',//跳转目标窗口的地址
  390. query: {
  391. ...this.query
  392. }
  393. })
  394. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  395. },
  396. // 下拉监听
  397. corpChange(value, name) {
  398. if (name == 'corpName') {
  399. for (let item of this.corpIdData) {
  400. if (item.cnName == value) {
  401. this.$set(this.query, 'corpId', item.id)
  402. this.$set(this.query, 'corpName', item.cnName)
  403. }
  404. }
  405. } else if (name == 'clientName') {
  406. for (let item of this.clientIdData) {
  407. if (item.cnName == value) {
  408. this.$set(this.query, 'clientId', item.id)
  409. this.$set(this.query, 'clientName', item.cnName)
  410. }
  411. }
  412. } else if (name == 'srcName') {
  413. for (let item of this.srcIdData) {
  414. if (item.name == value) {
  415. // 业务员
  416. this.$set(this.query, 'srcId', item.id)
  417. this.$set(this.query, 'srcName', item.name)
  418. }
  419. }
  420. }
  421. this.$set(this.query, name, value)
  422. },
  423. // 业务员下拉
  424. srcCorpFocus(value, name) {
  425. this.salesUserGetListfun(value)
  426. },
  427. // 多选切换
  428. dateChange(name) {
  429. if (name == 'isBusinessDate') {
  430. this.$set(this.query, 'isToExamineDate', 0)
  431. this.$set(this.query, 'isBusinessDate', 1)
  432. }
  433. if (name == 'isToExamineDate') {
  434. this.$set(this.query, 'isBusinessDate', 0)
  435. this.$set(this.query, 'isToExamineDate', 1)
  436. }
  437. this.page.currentPage = 1;
  438. this.onLoad(this.page, this.query);
  439. },
  440. // 收付单选
  441. dcInput() {
  442. let dcName = ''
  443. if (this.query.dc == 'D') {
  444. dcName = '收'
  445. } else {
  446. dcName = '付'
  447. }
  448. this.findObject(this.option.column, "amountUsd").label = `应${dcName}美金`
  449. this.findObject(this.option.column, "amount").label = `应${dcName}人民币`
  450. this.findObject(this.option.column, "amountUsdAlready").label = `已${dcName}款美金`
  451. this.findObject(this.option.column, "amountAlready").label = `已${dcName}款人民币`
  452. this.findObject(this.option.column, "amountUsdNot").label = `未${dcName}款美金`
  453. this.findObject(this.option.column, "amountNot").label = `未${dcName}款人民币`
  454. this.page.currentPage = 1;
  455. this.onLoad(this.page, this.query);
  456. },
  457. // 接口获取数据
  458. // 结算单位
  459. getBcorpsListfun(cnName) {
  460. getBcorpsList(1, 10, { cnName, status: 0 }).then(res => {
  461. this.corpIdData = res.data.data.records
  462. })
  463. },
  464. // 业务类型
  465. businessTypeFocus() {
  466. getWorkDicts('profit_business_type_los').then(res => {
  467. this.businessTypeData = res.data.data
  468. })
  469. },
  470. // 委托人
  471. clientIdListfun(cnName) {
  472. getBcorpsList(1, 10, { cnName, status: 0 }).then(res => {
  473. this.clientIdData = res.data.data.records
  474. })
  475. },
  476. // 获取业务来源数据
  477. srcTypeWorkDictsfun() {
  478. getWorkDicts('src_type_los').then(res => {
  479. this.srcTypeData = res.data.data
  480. })
  481. },
  482. // 获取公司名称 用户管理左侧
  483. ownDeptLazyTreefun() {
  484. getDeptLazyTree(0).then(res => {
  485. this.srcIdData = res.data.data
  486. })
  487. },
  488. // 获取业务来源代理数据
  489. agentBcorpsListfun(cnName) {
  490. let corpTypeName = '国内直接客户,国内同行及代理,国外直接客户,国外同行及代理'
  491. getBcorpslistByType(1, 10, { cnName, status: 0, corpTypeName }).then(res => {
  492. this.srcIdData = res.data.data.records
  493. })
  494. },
  495. // 获取业务来源业务员数据
  496. salesUserGetListfun(account) {
  497. userGetList(1, 10, { account }).then(res => {
  498. this.srcIdData = res.data.data.records
  499. })
  500. },
  501. // 清空搜索回调方法
  502. searchReset() {
  503. this.query = {
  504. dc: 'D',
  505. isBusinessDate: 1,
  506. isToExamineDate: 0,
  507. etdStart: null,
  508. etdEnd: null,
  509. };
  510. this.onLoad(this.page);
  511. },
  512. // 搜索
  513. searchChange(params, done) {
  514. this.page.currentPage = 1;
  515. this.onLoad(this.page, this.query);
  516. done();
  517. },
  518. currentChange(currentPage) {
  519. this.page.currentPage = currentPage;
  520. },
  521. sizeChange(pageSize) {
  522. this.page.pageSize = pageSize;
  523. },
  524. refreshChange() {
  525. this.onLoad(this.page, this.query);
  526. },
  527. onLoad(page, params = {}) {
  528. this.loading = true;
  529. financeStatisticsFeeSummaryDetailNot(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  530. const data = res.data.data;
  531. this.page.total = data.total;
  532. this.data = data.records;
  533. this.loading = false;
  534. financeStatisticsFeeSummaryDetailNotSum(Object.assign(params, this.query)).then(re => {
  535. this.commodityData = [re.data.data]
  536. })
  537. this.$nextTick(() => {
  538. this.$refs.crud.doLayout();
  539. this.$refs.crud.dicInit();
  540. });
  541. this.selectionClear();
  542. });
  543. },
  544. selectionClear() {
  545. this.$refs.crud.toggleSelection();
  546. },
  547. //自定义列保存
  548. async saveColumnTwo(ref, option, optionBack, code) {
  549. /**
  550. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  551. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  552. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  553. */
  554. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  555. if (inSave) {
  556. this.$message.success("保存成功");
  557. //关闭窗口
  558. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  559. }
  560. },
  561. //自定义列重置
  562. async resetColumnTwo(ref, option, optionBack, code) {
  563. this[option] = this[optionBack];
  564. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  565. if (this.saberUserInfo.role_name.indexOf('admin') != -1 || this.saberUserInfo.role_name.indexOf('总部') != -1) {
  566. this.option.searchMenuSpan = 24
  567. this.option.column.forEach(item => {
  568. if (item.prop == 'branchId') {
  569. item.search = true
  570. }
  571. })
  572. }
  573. if (inSave) {
  574. this.$message.success("重置成功");
  575. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  576. this.query = {
  577. dc: 'D',
  578. isBusinessDate: 1,
  579. isToExamineDate: 0,
  580. etdStart: defaultDate3()[0],
  581. etdEnd: defaultDate3()[1],
  582. }
  583. }
  584. },
  585. // 更改表格颜色
  586. headerClassName(tab) {
  587. //颜色间隔
  588. let back = ""
  589. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  590. if (tab.columnIndex % 2 === 0) {
  591. back = "back-one"
  592. } else if (tab.columnIndex % 2 === 1) {
  593. back = "back-two"
  594. }
  595. }
  596. return back;
  597. },
  598. }
  599. }
  600. </script>
  601. <style scoped>
  602. ::v-deep#out-table .back-one {
  603. background: #ecf5ff !important;
  604. text-align: center;
  605. }
  606. ::v-deep#out-table .back-two {
  607. background: #ecf5ff !important;
  608. text-align: center;
  609. }
  610. ::v-deep .el-col-md-8 {
  611. width: 24.33333%;
  612. }
  613. </style>