index.vue 24 KB

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