data.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div style="padding: 20px">
  3. <div style="padding-bottom: 20px">
  4. <el-tag @click="getData_(0,'全部数据')">全部数据</el-tag>
  5. <el-tag @click="getData_(1,'实名认证')" type="info">实名认证</el-tag>
  6. <el-tag @click="getData_(2,'技术认证')" type="info">技术认证</el-tag>
  7. <el-tag @click="getData_(3,'注册用户')" type="info">注册用户</el-tag>
  8. <el-tag @click="getData_(4,'签约数量')" type="info">签约数量</el-tag>
  9. <el-tag @click="getData_(5,'云端数量')" type="info">云端数量</el-tag>
  10. <el-tag @click="getData_(7,'雇佣数量')" type="info">雇佣数量</el-tag>
  11. <el-tag @click="getData_(6,'整包数量')" type="info">整包数量</el-tag>
  12. </div>
  13. <div style="padding-bottom: 20px">
  14. <el-select v-model="time_type" placeholder="请选择">
  15. <el-option
  16. v-for="item in time_type_data"
  17. :key="item.value"
  18. :label="item.label"
  19. :value="item.value">
  20. </el-option>
  21. </el-select>
  22. <el-date-picker
  23. v-if="time_type==1"
  24. v-model="date"
  25. type="daterange"
  26. style="width: 400px"
  27. range-separator="至"
  28. start-placeholder="开始日期"
  29. end-placeholder="结束日期">
  30. </el-date-picker>
  31. <el-date-picker
  32. v-if="time_type==2"
  33. v-model="month"
  34. style="width: 400px"
  35. type="monthrange"
  36. range-separator="至"
  37. start-placeholder="开始月份"
  38. end-placeholder="结束月份">
  39. </el-date-picker>
  40. <el-button @click="search" type="primary">查询</el-button>
  41. </div>
  42. <el-row>
  43. <el-col :span="24">
  44. <div class="grid-content bg-purple">
  45. <Line-Chart :source="source" :title="title" :width="1200" :height="400"></Line-Chart>
  46. </div>
  47. </el-col>
  48. </el-row>
  49. <el-table
  50. :data="source.rows"
  51. :default-sort = "{prop: 'date', order: 'descending'}"
  52. style="width: 100%">
  53. <el-table-column
  54. prop="date"
  55. label="日期">
  56. <template slot-scope="scope">
  57. {{scope.row}}
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. v-for="(value, index) in source.data"
  62. :label="value.title">
  63. <template slot-scope="scope">
  64. {{source.data[index].data[source.rows.length-scope.$index-1]}}
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. </div>
  69. </template>
  70. <script>
  71. import LineChart from "@/components/Echart/line"
  72. let firstDayOfThisMonth = new Date();
  73. firstDayOfThisMonth.setDate(1);
  74. firstDayOfThisMonth.setHours(0);
  75. firstDayOfThisMonth.setMinutes(0);
  76. firstDayOfThisMonth.setSeconds(0);
  77. const startMonth = new Date();
  78. startMonth.setMonth(startMonth.getMonth() - 12);
  79. export default {
  80. inheritAttrs: false,
  81. components: {
  82. LineChart
  83. },
  84. props: [],
  85. data() {
  86. return {
  87. title: "实名认证数据面板",
  88. source: {
  89. rows: [],
  90. data: []
  91. },
  92. time_type_data: [{
  93. value: '1',
  94. label: '按日'
  95. }, {
  96. value: '2',
  97. label: '按月'
  98. }],
  99. time_type: '1',
  100. date:[firstDayOfThisMonth, new Date()],
  101. month:[startMonth,firstDayOfThisMonth],
  102. type:"0",
  103. };
  104. },
  105. computed: {},
  106. watch: {},
  107. created() {},
  108. mounted() {
  109. this.getData_(0,"全部数据");
  110. },
  111. methods: {
  112. async search()
  113. {
  114. this.getData_(this.type,this.title)
  115. },
  116. async getData_(type,title) {
  117. this.title=title;
  118. let url="";
  119. if(type==1)
  120. {
  121. url="/uapi/data/day/real_card";
  122. }
  123. else if(type==0)
  124. {
  125. url="/uapi/data/day/all";
  126. }
  127. else if(type==2)
  128. {
  129. url="/uapi/data/day/freework_level";
  130. }
  131. else if(type==3)
  132. {
  133. url="/uapi/data/day/user_register";
  134. }
  135. else if(type==4)
  136. {
  137. url="/uapi/data/day/user_sign";
  138. }
  139. else if(type==5)
  140. {
  141. url="/uapi/data/day/job?job_form_type=2";
  142. }
  143. else if(type==7)
  144. {
  145. url="/uapi/data/day/job?job_form_type=1";
  146. }
  147. else if(type==6)
  148. {
  149. url="/uapi/data/day/project";
  150. }
  151. let stime="";
  152. let etime="";
  153. if(this.time_type==1)
  154. {
  155. stime=this.formatDate(this.date[0]/1000);
  156. etime=this.formatDate(this.date[1]/1000);
  157. }
  158. else
  159. {
  160. stime=this.formatDate(this.month[0]/1000);
  161. etime=this.formatDate(this.month[1]/1000);
  162. }
  163. let res = await this.$post(url,{time_type:this.time_type,stime:stime,etime:etime});
  164. if(res.status==1)
  165. {
  166. this.source = {
  167. rows: res.data.day,
  168. data: res.data.data,
  169. }
  170. }
  171. },
  172. formatDate(time) {
  173. if (time === "0") {
  174. return "--";
  175. }
  176. let now = new Date(time * 1000);
  177. let year = now.getFullYear();
  178. let month = now.getMonth() + 1;
  179. let date = now.getDate();
  180. let hour = now.getHours();
  181. let minute = now.getMinutes();
  182. let second = now.getSeconds();
  183. if (date < 10) {
  184. date = "0" + date;
  185. }
  186. if (month < 10) {
  187. month = "0" + month;
  188. }
  189. if (hour < 10) {
  190. hour = "0" + hour;
  191. }
  192. if (minute < 10) {
  193. minute = "0" + minute;
  194. }
  195. if (second < 10) {
  196. second = "0" + second;
  197. }
  198. return (
  199. year +
  200. "-" +
  201. month +
  202. "-" +
  203. date +
  204. " " +
  205. hour +
  206. ":" +
  207. minute +
  208. ":" +
  209. second
  210. );
  211. },
  212. }
  213. };
  214. </script>
  215. <style scoped>
  216. .el-tag{cursor: pointer}
  217. </style>