financialCollectionAnalysis.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <div class="div-box-new-margin" style="margin-bottom: 16px" >
  3. <div class="div-border-box" id="financialCollectionFull">
  4. <div class="out">
  5. <div>
  6. <div class="div-line div-line-right"></div>
  7. <div class="title" style="min-width: 220px;">{{$t(`财务回款分析`)}}</div>
  8. </div>
  9. <div class="in">
  10. <div class="inline-16 mt-10">
  11. <departmentSalesperson ref="departmentSalesperson" placement="left-start" @depSelect="depSelect" @personSelect="personSelect" :isFull="isFull" :is-new-dep="true"></departmentSalesperson>
  12. </div>
  13. <div class="mt-10 inline-16">
  14. <p class="search__label">{{$t('状态')}}:</p>
  15. <el-select v-model="param.content.where.isleave" clearable style="margin-right:10px" size="small" :placeholder="$t('请选择状态')" @change="tableData(param.content.dataid,param.content.where.isleave,'状态');queryModel(param.content.dataid,param.content.where.isleave,'状态')" >
  16. <el-option :label="$t('在职')" value="1"></el-option>
  17. <el-option :label="$t('离职')" value="2"></el-option>
  18. </el-select>
  19. </div>
  20. <div class="inline-15 mt-10">
  21. <exportFileInfo :param="exportParam" :oldParam="tableParam" :columns="tool.tabelCol(this.$route.name).financialCollectioDetailTable.tablecols" fileName="财务回款分析明细" btnTitle="导出明细"></exportFileInfo>
  22. </div>
  23. <div class="inline-15 mt-10">
  24. <exportFile :param="tableParam" :columns="tablecols" fileName="财务回款分析" :dataid="tableParam.content.dataid"></exportFile>
  25. </div>
  26. <fullScreen domId="financialCollectionFull" @onFull="onFull" @backFull="backFull" :scrollHeight="scrollHeight"></fullScreen>
  27. </div>
  28. </div>
  29. <div class="chart">
  30. <div id="financialCollectionAnalysisChart" :style="{height:heightChart}" ref="chartRef"></div>
  31. </div>
  32. <div style="font-size: 16px;margin: 10px 0 10px 0">{{$t(tableParam.content.unwriteoffamounttype?tableParam.content.unwriteoffamounttype:'')}}</div>
  33. <div :style="{height: heightTable}" >
  34. <tableTemplate ref="table" :layout="tablecols" :data="list" :opwidth="200" :custom="true" height="356px" fixedName="operation" :height="height">
  35. <template v-slot:customcol="scope">
  36. <p v-if="scope.column.columnname === 'total'">
  37. ¥{{tool.formatAmount(scope.column.data[scope.column.columnname],2)}}
  38. </p>
  39. <p v-else-if="scope.column.columnname === 'zerotothree'">
  40. ¥{{tool.formatAmount(scope.column.data[scope.column.columnname],2)}}
  41. </p>
  42. <p v-else-if="scope.column.columnname === 'threetosix'">
  43. ¥{{tool.formatAmount(scope.column.data[scope.column.columnname],2)}}
  44. </p>
  45. <p v-else-if="scope.column.columnname === 'sixtotwelve'">
  46. ¥{{tool.formatAmount(scope.column.data[scope.column.columnname],2)}}
  47. </p>
  48. <p v-else-if="scope.column.columnname === 'twelveup'">
  49. ¥{{tool.formatAmount(scope.column.data[scope.column.columnname],2)}}
  50. </p>
  51. <p v-else-if="scope.column.columnname === 'operation'"></p>
  52. <p v-else>{{scope.column.data[scope.column.columnname]?$t(scope.column.data[scope.column.columnname]):'--'}}</p>
  53. </template>
  54. <template v-slot:opreation="scope">
  55. <financialCollectionDetail :dataid="param.content.dataid" :type="param.content.type" :isFull="isFull" :sys_enterpriseid="scope.data.sys_enterpriseid" :data="scope.data" :unwriteoffamounttype="tableParam.content.unwriteoffamounttype"></financialCollectionDetail>
  56. </template>
  57. </tableTemplate>
  58. <div class="container normal-panel" style="text-align:right;float: right;">
  59. <el-pagination
  60. background
  61. @size-change="handleSizeChange"
  62. @current-change="handleCurrentChange"
  63. :current-page="currentPage"
  64. :pager-count="7"
  65. :page-sizes="[20, 50,100, 200]"
  66. :page-size="20"
  67. layout="total,sizes, prev, pager, next, jumper"
  68. :total="total">
  69. </el-pagination>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. import departmentSalesperson from "@/views/salesData/components/departmentSalesperson";
  77. import financialCollectionDetail from "@/views/salesData/components/financialCollectionDetail";
  78. import fullScreen from "@/views/salesData/components/fullScreen";
  79. import tableTemplate from '@/views/salesData/components/table';
  80. import exportFile from '@/components/export_file/index'
  81. import exportFileInfo from '@/components/export_file/index7'
  82. import {Bar, G2} from "@antv/g2plot";
  83. const G = G2.getEngine('canvas');
  84. export default {
  85. name: "financialCollectionAnalysis",
  86. props:['scrollHeight','windowWidth'],
  87. components:{
  88. departmentSalesperson,
  89. tableTemplate,
  90. financialCollectionDetail,
  91. fullScreen,
  92. exportFile,
  93. exportFileInfo
  94. },
  95. data(){
  96. return {
  97. chartBar:null,
  98. param:{
  99. "id": 20231016211904,
  100. "content": {
  101. "type": 0,
  102. "dataid": 54,
  103. "where":{
  104. "isleave":"1"
  105. }
  106. }
  107. },
  108. tableParam:{
  109. "id": 20231017084504,
  110. "content": {
  111. "type": 0,
  112. "dataid": '',
  113. "unwriteoffamounttype": "订单",
  114. "pageNumber": 1,
  115. "pageSize": 20,
  116. "where":{
  117. "isleave":""
  118. }
  119. }
  120. },
  121. chartData:[],
  122. list:[],
  123. currentPage:0,
  124. total:0,
  125. tablecols:[],
  126. hoverData:[],
  127. heightChart:'98%',
  128. heightTable:'403px',
  129. height:'356px',
  130. isFull:false,
  131. exportParam:{
  132. "id": 2025033114042802,
  133. "content": {
  134. "type": 1,
  135. "dataid": 58,
  136. "unwriteoffamounttype": "订单",
  137. "pageNumber": 1,
  138. "pageSize": 20,
  139. "where": {
  140. "isleave": "1"
  141. }
  142. },
  143. }
  144. }
  145. },
  146. methods:{
  147. async listData(val){
  148. this.renderPie(val)
  149. this.tableData(val,this.param.content.where.isleave)
  150. },
  151. async queryModel(val,isleave,state){
  152. if (state == '状态'){
  153. this.$refs.departmentSalesperson.person = ''
  154. this.param.content.type = 1
  155. this.param.content.dataid = this.$refs.departmentSalesperson.depment ? this.$refs.departmentSalesperson.depment : -1
  156. }else {
  157. this.param.content.dataid = val?val : this.dataid
  158. }
  159. this.param.content.where.isleave = isleave
  160. const res = await this.$api.requested(this.param)
  161. this.chartData = res.data.map(item=>{
  162. let value = this.tool.unitConversion(item.value,10000)
  163. return {
  164. key: this.$t(item.key) + '(' + this.$t('万元') + ')',
  165. type: this.$t(item.type),
  166. value: value
  167. }
  168. })
  169. this.chartBar.changeData(this.chartData)
  170. state == '状态' ? this.personData(this.$refs.departmentSalesperson.depment) : ''
  171. },
  172. renderPie(val){
  173. this.chartBar = new Bar('financialCollectionAnalysisChart',{
  174. data:this.chartData,
  175. isStack: true,
  176. xField: 'value',
  177. yField: 'type',
  178. seriesField: 'key',
  179. label:{
  180. formatter: (datum) =>{
  181. return '¥'+this.tool.formatAmount(datum.value,2)
  182. }
  183. },
  184. tooltip: {
  185. formatter: (datum) => {
  186. return {
  187. name:datum.key,
  188. value:'¥'+this.tool.formatAmount(datum.value,2)
  189. }
  190. }
  191. }
  192. })
  193. this.chartBar.render()
  194. this.chartBar.on('tooltip:change',ev=>{
  195. this.hoverData = ev.data.items[0]
  196. })
  197. this.chartBar.on('plot:click',ev=>{
  198. this.tableParam.content.unwriteoffamounttype = this.hoverData.data.type
  199. this.tableParam.content.pageNumber = 1
  200. this.tableData(this.param.content.dataid,this.param.content.where.isleave)
  201. })
  202. this.queryModel(val,this.param.content.where.isleave)
  203. },
  204. async tableData(val,isleave,state){
  205. if (state == '状态'){
  206. this.tableParam.content.type = 1
  207. this.tableParam.content.dataid = this.$refs.departmentSalesperson.depment ? this.$refs.departmentSalesperson.depment : -1
  208. }else {
  209. this.tableParam.content.dataid = val?val : this.dataid
  210. }
  211. this.tableParam.content.where.isleave = isleave
  212. const res = await this.$api.requested(this.tableParam)
  213. this.list = res.data
  214. this.total = res.total
  215. this.currentPage = res.pageNumber
  216. },
  217. /*选择部门*/
  218. depSelect(val){
  219. this.param.content.type = 1
  220. this.param.content.dataid = val?val:-1
  221. this.tableParam.content.type = 1
  222. this.personData(this.param.content.dataid)
  223. this.queryModel(this.param.content.dataid,this.param.content.where.isleave)
  224. this.tableData(this.param.content.dataid,this.param.content.where.isleave)
  225. },
  226. /*选择业务员*/
  227. personSelect(val){
  228. if (val || this.$refs.departmentSalesperson.depment){
  229. this.param.content.type = val?0:1
  230. this.param.content.dataid = val?val:this.$refs.departmentSalesperson.depment
  231. this.tableParam.content.type = val?0:1
  232. }else {
  233. this.param.content.type = 1
  234. this.param.content.dataid = -1
  235. this.tableParam.content.type = 1
  236. }
  237. this.queryModel(this.param.content.dataid,this.param.content.where.isleave)
  238. this.tableData(this.param.content.dataid,this.param.content.where.isleave)
  239. },
  240. /*获取新的业务员列表*/
  241. async personData(depid){
  242. let param = {
  243. id: 20230620102004,
  244. content: {
  245. isleave:this.param.content.where.isleave,
  246. depid:depid
  247. },
  248. }
  249. const res = await this.$api.requested(param)
  250. this.$refs.departmentSalesperson.personnelList = res.data.hr
  251. },
  252. handleSizeChange(val) {
  253. // console.log(`每页 ${val} 条`);
  254. this.tableParam.content.pageSize = val
  255. this.tableData(this.param.content.dataid,this.param.content.where.isleave)
  256. },
  257. handleCurrentChange(val) {
  258. // console.log(`当前页: ${val}`);
  259. this.tableParam.content.pageNumber = val
  260. this.tableData(this.param.content.dataid,this.param.content.where.isleave)
  261. },
  262. /*全屏*/
  263. onFull(){
  264. this.heightChart = '98%'
  265. /*this.heightTable = '883px'
  266. this.height = '886px'*/
  267. this.heightTable = 'calc(100vh - 800px)'
  268. this.height = 'calc(100vh - 555px)'
  269. this.isFull = true
  270. },
  271. /*退出全屏*/
  272. backFull(val){
  273. this.heightChart = '98%'
  274. this.heightTable = '403px'
  275. this.height = '356px'
  276. this.isFull = false
  277. this.$emit('backFull',val)
  278. }
  279. },
  280. created() {
  281. this.tablecols = this.tool.tabelCol(this.$route.name).financialCollectioTable.tablecols
  282. }
  283. }
  284. </script>
  285. <style scoped>
  286. </style>