index.vue 24 KB

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