checkBill.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <div class="checkBill">
  3. <div class="optionLine">
  4. <div class="xiangmuxuanze">
  5. <span>项目选择:</span>
  6. <a-tree-select
  7. v-model="treeValue"
  8. style="width: 50%"
  9. :tree-data="treeData"
  10. tree-checkable
  11. :show-checked-strategy="SHOW_PARENT"
  12. searchPlaceholder="请选择项目和账户"
  13. :allowClear=true
  14. @change="treeChange"
  15. />
  16. </div>
  17. <span>应用选择:</span>
  18. <a-select default-value="0" style="width: 150px" @change="APPChange">
  19. <a-select-option value="0">全部</a-select-option>
  20. <a-select-option v-for="(item,index) in optionArr" :key='index' :value='item.id'>{{item.name}}</a-select-option>
  21. </a-select>
  22. <span class="timedate">日期选择:</span>
  23. <a-range-picker
  24. :placeholder="['开始月份', '结束月份']"
  25. format="YYYY-MM"
  26. :value="monthRange"
  27. :mode="mode2"
  28. @change="monthChange"
  29. @panelChange="monthPanelChange"
  30. style="width: 250px;"
  31. :loading="loading"
  32. />
  33. <span class="caozuoxitong">操作系统:</span>
  34. <a-select default-value="all" style="width: 150px" @change="handleChange">
  35. <a-select-option value="all">全部</a-select-option>
  36. <a-select-option value="android">Android</a-select-option>
  37. <a-select-option value="ios">IOS</a-select-option>
  38. </a-select>
  39. <div class="btn">
  40. <a-button type='primary' @click="getData">查询</a-button>
  41. </div>
  42. </div>
  43. <a-table :columns="columns" :data-source="dataSource" tableLayout='auto' bordered :pagination='false'>
  44. </a-table>
  45. <div class="fenye">
  46. <a-pagination v-model="currentPage" :total="totalItem" show-less-items style="float:right" />
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import moment from 'moment'
  52. import { getAction, postAction, downFile, downFilePost } from '@/api/manage'
  53. import { TreeSelect } from 'ant-design-vue';
  54. const SHOW_PARENT = TreeSelect.SHOW_PARENT;
  55. let columns=[
  56. {
  57. title: '时间',
  58. dataIndex: 'date',
  59. key: 'date',
  60. scopedSlots: { customRender: 'date' },
  61. align: 'center',
  62. },
  63. {
  64. title: '应用',
  65. dataIndex: 'appName',
  66. key: 'appName',
  67. align: 'center',
  68. },
  69. {
  70. title: '操作系统',
  71. dataIndex: 'operateSystem',
  72. key: 'operateSystem',
  73. align: 'center',
  74. },
  75. {
  76. title: '有效激活数',
  77. dataIndex: 'sumInternalActivations',
  78. key: 'sumInternalActivations',
  79. align: 'center',
  80. },
  81. {
  82. title: '预估结算金额(元)',
  83. dataIndex: 'estimatedTotalPrice',
  84. key: 'estimatedTotalPrice',
  85. align: 'center',
  86. },
  87. {
  88. title: '账户质量分',
  89. dataIndex: 'accountQualityScore',
  90. key: 'accountQualityScore',
  91. align: 'center',
  92. },
  93. {
  94. title: '实际结算金额(元)',
  95. dataIndex: 'actualTotalPrice',
  96. key: 'actualTotalPrice',
  97. align: 'center',
  98. },
  99. ]
  100. export default {
  101. data() {
  102. return {
  103. //应用下拉选择框的
  104. optionArr:[],
  105. APPID:'',
  106. //table的值
  107. columns,
  108. dataSource:[],
  109. loading:false,
  110. //选择的值
  111. selectValue:'all',
  112. //日期的值
  113. monthRange:[],
  114. monthStr:[],//时间-字符串的类型
  115. mode2: ['month', 'month'],
  116. monthOpen:false,
  117. //分页器的参数
  118. currentPage:1,
  119. totalItem:10,
  120. //treeselect的参数
  121. treeValue:[],
  122. treeData:[],
  123. SHOW_PARENT,
  124. projectId:[],
  125. accountName:[],
  126. }
  127. },
  128. methods: {
  129. moment,
  130. //项目改变后的事件
  131. treeChange(val){
  132. this.projectId=[];
  133. this.accountName=[];
  134. console.log(val,this.treeValue);
  135. this.treeValue.forEach((item,index)=>{
  136. if(parseInt(item)){
  137. this.projectId.push(item)
  138. }else{
  139. this.accountName.push(item)
  140. }
  141. });
  142. postAction('/pangolin/api/app/list',{
  143. projectId:this.projectId,
  144. accountName:this.accountName
  145. }).then(res=>{
  146. console.log(res)
  147. if(res.success){
  148. this.optionArr=res.data
  149. }
  150. })
  151. },
  152. //应用选择
  153. APPChange(value){
  154. this.APPID=value;
  155. },
  156. handleChange(value) {
  157. this.selectValue=value
  158. },
  159. //月份选择器value
  160. monthChange(value){
  161. console.log(value)
  162. this.monthRange=value
  163. },
  164. monthPanelChange(value, mode){
  165. this.monthRange=value
  166. // console.log(value,mode)
  167. this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
  168. this.monthStr=[moment(this.monthRange[0]).format('YYYY-MM'),moment(this.monthRange[1]).format('YYYY-MM')]
  169. },
  170. //确定按钮的事件
  171. getData(){
  172. console.log(this.monthStr,this.selectValue);
  173. this.loading=true;
  174. this.HttpPost()
  175. },
  176. //请求事件
  177. HttpPost(){
  178. postAction('/pangolin/api/checkApps/list',{
  179. pageSize:10,
  180. pageNo:this.currentPage,
  181. startDate:this.monthStr[0],
  182. endDate:this.monthStr[1],
  183. operateSystem:this.selectValue,
  184. appId:this.APPID,
  185. projectId:this.projectId,
  186. accountName:this.accountName
  187. }).then(res => {
  188. console.log(res)
  189. if (res.success) {
  190. this.loading=false;
  191. res.data.list.map((item, index) => {
  192. item.key = index
  193. })
  194. this.dataSource=res.data.list;
  195. this.totalItem=res.data.total
  196. }
  197. })
  198. },
  199. //项目请求
  200. accountHttp(){
  201. postAction('/pangolin/api/memberList',{
  202. projectId:this.projectId,
  203. accountName:this.accountName
  204. }).then(res => {
  205. console.log(res)
  206. if(res.success){
  207. res.data.forEach((element,index) => {
  208. this.treeData.push({});
  209. this.treeData[index].title=element.projectName;
  210. this.treeData[index].value=element.projectId;
  211. this.treeData[index].key=element.projectId;
  212. this.treeData[index].children=[];
  213. element.accountList.forEach((ele,i)=>{
  214. this.treeData[index].children.push({});
  215. this.treeData[index].children[i].title=ele.accountName;
  216. this.treeData[index].children[i].value=ele.accountName;
  217. this.treeData[index].children[i].key=ele.accountName;
  218. })
  219. });
  220. }
  221. console.log(this.treeData)
  222. })
  223. }
  224. },
  225. mounted() {
  226. this.monthStr=[moment().format('YYYY-MM'),moment().format('YYYY-MM')];
  227. this.monthRange=[moment(),moment()]
  228. postAction('/pangolin/api/app/list',{
  229. projectId:this.projectId,
  230. accountName:this.accountName
  231. }).then(res=>{
  232. console.log(res)
  233. if(res.success){
  234. this.optionArr=res.data
  235. }
  236. })
  237. this.accountHttp()
  238. this.HttpPost()
  239. },
  240. }
  241. </script>
  242. <style lang="scss" scoped>
  243. .checkBill{
  244. width: 100%;
  245. height: 100%;
  246. background: #fff;
  247. padding: 10px 15px;
  248. }
  249. .optionLine{
  250. padding: 15px 5px;
  251. position: relative;
  252. margin-bottom: 15px;
  253. margin-top: 20px;
  254. span{
  255. display: inline-block;
  256. padding: 0 3px;
  257. }
  258. .timedate,.caozuoxitong{
  259. margin-left: 30px;;
  260. }
  261. .btn{
  262. position: absolute;
  263. right: 10px;
  264. top: 15px;
  265. }
  266. }
  267. .fenye{
  268. margin: 30px 15px 10px;
  269. overflow: hidden;
  270. }
  271. .xiangmuxuanze{
  272. margin-bottom: 20px;;
  273. }
  274. </style>