index.vue 26 KB

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