Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

1258 rader
35 KiB

  1. <template>
  2. <div class="box-center">
  3. <!-- 头 -->
  4. <div class="app-top">
  5. <div class="app-titel" v-if="role!=3" style="margin-bottom:10px;">
  6. <div class="titel-text">楼盘选择:</div>
  7. <div style="margin-left: 26px">
  8. <el-select v-model="houseId" placeholder="请选择" @change="houseChange">
  9. <el-option
  10. v-for="item in houseList"
  11. :key="item.id"
  12. :label="item.propertyName"
  13. :value="item.id">
  14. </el-option>
  15. </el-select>
  16. </div>
  17. </div>
  18. <div class="app-titel">
  19. <div style="text-indent: 30px;">接待时间:</div>
  20. <div class="toptimeqhuan">
  21. <div :class="{ tophove: timeType == 4 }" @click="tabtimetap(4)">
  22. 近7天
  23. </div>
  24. <div :class="{ tophove: timeType == 5 }" @click="tabtimetap(5)">
  25. 近15天
  26. </div>
  27. <div :class="{ tophove: timeType == 6 }" @click="tabtimetap(6)">
  28. 近30天
  29. </div>
  30. </div>
  31. <div style="margin-left: 20px">
  32. <el-date-picker
  33. @change="confirmtime"
  34. v-model="customtime"
  35. :clearable='false'
  36. type="daterange"
  37. range-separator="-"
  38. format="yyyy-MM-dd"
  39. value-format="yyyy-MM-dd"
  40. start-placeholder="开始日期"
  41. end-placeholder="结束日期"
  42. :picker-options="pickerOptions"
  43. >
  44. </el-date-picker>
  45. </div>
  46. <div style="margin-left: 20px">
  47. <el-checkbox v-model="checked" @change="radioChange"
  48. >对比时间段</el-checkbox
  49. >
  50. </div>
  51. <div v-if="checked" style="margin-left: 20px;border:1px solid #DCDFE6;min-width: 220px;height: 30px;border-radius: 4px;max-width:250px;
  52. font-size: 13px; line-height: 30px; text-indent: 8px;" @click="show">
  53. {{ selectTime1 ? "时段二: " : "请选择: "}}
  54. <span v-if="selectTime1">{{ selectTime + "-" + selectTime1}}</span>
  55. <el-date-picker
  56. style="opacity: 0"
  57. v-model="time"
  58. @change="timeChange"
  59. ref="time"
  60. type="date"
  61. :clearable='false'
  62. placeholder="选择日期"
  63. format="yyyy-MM-dd"
  64. value-format="yyyy-MM-dd"
  65. :picker-options="pickerOptions"
  66. >
  67. </el-date-picker>
  68. </div>
  69. </div>
  70. </div>
  71. <!-- //卡片 -->
  72. <div class="kapian-box">
  73. <div class="kayi">
  74. <div class="shang">
  75. <div class="zuo">
  76. <div class="text1">有效接待</div>
  77. <div class="text2">{{cardobj.startSumCustomer||0}}个</div>
  78. </div>
  79. <div class="you">
  80. <img class="youimg" src="/img/waves1.png" alt="" />
  81. </div>
  82. </div>
  83. <div v-if="Confirmthecontrast" class="xia">
  84. <span class="span1">对比:{{cardobj.endSumCustomer ||0}}次</span>
  85. <span class="span2">{{cardobj.contrastSumCustomer ||0}}%</span>
  86. </div>
  87. </div>
  88. <div class="kayi">
  89. <div class="shang">
  90. <div class="zuo">
  91. <div class="text1">平均执行率</div>
  92. <div class="text2">{{cardobj.startFraction||0}}%</div>
  93. </div>
  94. <div class="you">
  95. <img class="youimg" src="/img/waves2.png" alt="" />
  96. </div>
  97. </div>
  98. <div v-if="Confirmthecontrast" class="xia">
  99. <span class="span1">对比:{{cardobj.endFraction ||0}}%</span>
  100. <span class="span2">{{cardobj.contrastFraction ||0}}%</span>
  101. </div>
  102. </div>
  103. <div class="kayi" style="margin: 0px">
  104. <div class="shang">
  105. <div class="zuo">
  106. <div class="text1">平均接待时长/min</div>
  107. <div class="text2">{{Math.floor(cardobj.startSumDuration/60)||0}}</div>
  108. </div>
  109. <div class="you">
  110. <img class="youimg" src="/img/waves3.png" alt="" />
  111. </div>
  112. </div>
  113. <div v-if="Confirmthecontrast" class="xia">
  114. <span class="span1">对比:{{Math.floor(cardobj.endSumDuration/60) ||0}}</span>
  115. <span class="span2">{{cardobj.contrastSumDuration ||0}}%</span>
  116. </div>
  117. </div>
  118. </div>
  119. <!-- 图表 -->
  120. <div class="app-box-er">
  121. <div class="titletab" style="cursor: pointer;">
  122. <div :class="{ claindex: aliasclass == 1 }" @click="tapChange(1)">平均执行率</div>
  123. <div :class="{ claindex: aliasclass == 2 }" @click="tapChange(2)">团队执行率</div>
  124. <div :class="{ claindex: aliasclass == 3 }" @click="tapChange(3)">顾问销讲能力</div>
  125. <div :class="{ claindex: aliasclass == 4 }" @click="tapChange(4)">销讲一级执行</div>
  126. <div :class="{ claindex: aliasclass == 5 }" @click="tapChange(5)">销讲二级执行</div>
  127. </div>
  128. <!-- 团队选部门 -->
  129. <div v-if="aliasclass==2" style="display: flex;align-items: center;margin-top: 26px;">
  130. 部门:
  131. <el-select @change="departmenttap()" v-model="departmentid" placeholder="请选择">
  132. <el-option
  133. v-for="item in departmentlist"
  134. :key="item.deptId"
  135. :label="item.name"
  136. :value="item.deptId"
  137. >
  138. </el-option>
  139. </el-select>
  140. </div>
  141. <!-- 选择顾问 -->
  142. <div v-if="aliasclass==3" style="display: flex;align-items: center;margin-top: 26px;">
  143. 顾问:
  144. <el-select @change="consultanttap()" v-model="consultantid" placeholder="请选择">
  145. <el-option
  146. v-for="item in consultantlist"
  147. :key="item.accountId"
  148. :label="item.accountName"
  149. :value="item.accountId"
  150. >
  151. </el-option>
  152. </el-select>
  153. </div>
  154. <!-- 一二级 -->
  155. <div v-if="aliasclass==5" style="display: flex;align-items: center;margin-top: 26px;">
  156. 一级:
  157. <el-select @change="Level1tap()" v-model="Level1id" placeholder="请选择">
  158. <el-option
  159. v-for="item in Level1"
  160. :key="item.marketingId"
  161. :label="item.name"
  162. :value="item.marketingId"
  163. >
  164. </el-option>
  165. </el-select>
  166. &nbsp; &nbsp; 二级:
  167. <el-select @change="Level2tap()" v-model="Level2id" placeholder="请选择">
  168. <el-option
  169. v-for="item in Level2"
  170. :key="item.marketingId"
  171. :label="item.name"
  172. :value="item.marketingId"
  173. >
  174. </el-option>
  175. </el-select>
  176. </div>
  177. <div v-if="echartsisshow" id="main"></div>
  178. <div v-else style="display:flex;justify-content: center; align-items: center;height: 350px;">
  179. <div>暂无数据</div>
  180. </div>
  181. </div>
  182. <!-- 表格 -->
  183. <div class="app-box-san" v-if="Confirmthecontrast && aliasclass!=3 && aliasclass!=4">
  184. <div class="santitle">对比报表</div>
  185. <div class="santab">
  186. <el-table :data="tableData" height="400" border style="width: 100%">
  187. <el-table-column prop="name" label="时间" align="center">
  188. </el-table-column>
  189. <el-table-column prop="shiduan1" label="时段1" align="center">
  190. <template slot-scope="scope">
  191. <span>{{scope.row.shiduan1}}%</span>
  192. </template>
  193. </el-table-column>
  194. <el-table-column prop="shiduan2" label="时段2" align="center">
  195. <template slot-scope="scope">
  196. <span>{{scope.row.shiduan2}}%</span>
  197. </template>
  198. </el-table-column>
  199. <el-table-column prop="heji" label="变化" align="center">
  200. <template slot-scope="scope">
  201. <span v-if="scope.row.heji>0"> <i class="el-icon-top" style="color: red;"></i>{{scope.row.heji}}%</span>
  202. <span v-if="scope.row.heji==0">{{scope.row.heji}}%</span>
  203. <span v-if="scope.row.heji<0"> <i class="el-icon-bottom" style="color: #25CEBA;"></i>{{scope.row.heji}}%</span>
  204. </template>
  205. </el-table-column>
  206. </el-table>
  207. </div>
  208. </div>
  209. <div v-if="aliasclass==3 || aliasclass==4" class="app-box-san" style="padding:12px;" >
  210. <div style="overflow: auto;">
  211. <table class="table">
  212. <tbody class="tbody">
  213. <tr v-if="tablelist1.length!=0">
  214. <td class="theadtd" v-for="(item,index) in tablelist1" :key='index'>{{item.name}}</td>
  215. </tr>
  216. <tr v-if="tablelist2.length!=0">
  217. <td class="theadtd" v-for="(item,index) in tablelist2" :key='index'>{{item.name}}</td>
  218. </tr>
  219. <tr v-if="tablelist3.length!=0">
  220. <td class="theadtd" v-for="(item,index) in tablelist3" :key='index'>{{item.name}}</td>
  221. </tr>
  222. <tr v-if="tablelist4.length!=0">
  223. <td class="theadtd" v-for="(item,index) in tablelist4" :key='index'>
  224. <span v-if="item.name=='变化'">{{item.name}}</span>
  225. <span v-else-if="item.name==0">{{item.name}}%</span>
  226. <span v-else-if="item.name>0" style="color: red;">{{item.name}}%</span>
  227. <span v-else-if="item.name<0" style="color: #25CEBA;">{{item.name}}%</span>
  228. </td>
  229. </tr>
  230. </tbody>
  231. </table>
  232. </div>
  233. </div>
  234. </div>
  235. </template>
  236. <script>
  237. import * as echarts from "echarts";
  238. export default {
  239. data() {
  240. return {
  241. timeType: 4,
  242. pickerOptions: {
  243. disabledDate(time) {
  244. // return time.getTime() > Date.now();
  245. },
  246. },
  247. time: "",//对比时间的数组
  248. page: {
  249. openTime: "",
  250. closeTime: "",
  251. },
  252. customtime: [],//自定义时间
  253. selectTime1: "",//对比时间
  254. selectTime: "",//对比时间
  255. aliasclass: 1,//tab下标
  256. houseId: "",//楼盘id
  257. options: [],
  258. value: "",
  259. checked: false,//是否对比
  260. Confirmthecontrast:false,
  261. tableData: [],//表格数据
  262. cardobj:{},
  263. departmentlist:[],
  264. departmentid:'',
  265. echartsisshow:true,
  266. consultantlist:[],
  267. consultantid:'',
  268. tablelist1:[],
  269. tablelist2:[],
  270. tablelist3:[],
  271. tablelist4:[],
  272. Level1:[],
  273. Level2:[],
  274. Level1id:'',
  275. Level2id:'',
  276. houseList:[],
  277. role:''
  278. };
  279. },
  280. mounted() {
  281. this.role=localStorage.getItem("orgType");
  282. if(this.role==3){
  283. this.houseId = localStorage.getItem("houseId");
  284. this.tabtimetap(4);
  285. this.overviewfindList()
  286. }else{
  287. this.zkhousePage()
  288. }
  289. },
  290. methods: {
  291. houseChange(){
  292. this.customtime=[];
  293. this.TimetoAhoose=4;
  294. this.selectTime1= "";//对比时间
  295. this.selectTime= "";//对比时间
  296. this.aliasclass= 1;//tab下标
  297. this.page.openTime='';
  298. this.page.closeTime='';
  299. this.checked=false;
  300. this.tabtimetap(4);
  301. this.overviewfindList()
  302. },
  303. zkhousePage() {
  304. this.$api.api
  305. .findHouseByUser({
  306. orgType: localStorage.getItem("orgType"),
  307. })
  308. .then((res) => {
  309. this.houseList = res.data;
  310. this.houseId = res.data[0].id;
  311. this.tabtimetap(4);
  312. this.overviewfindList()
  313. });
  314. },
  315. //销讲二级
  316. trendAnalysisLevel2(){
  317. let pamaet={
  318. showStatus:'',
  319. houseId:this.houseId,
  320. timeType:0,
  321. firstStartDate:this.page.openTime,
  322. firstEndDate:this.page.closeTime,
  323. lastStartDate:this.selectTime,
  324. lastEndDate:this.selectTime1,
  325. marketingId:this.Level2id
  326. }
  327. if(this.timeType==-1){
  328. pamaet.timeType=null
  329. }else{
  330. pamaet.timeType=this.timeType
  331. }
  332. if(this.checked==true){
  333. pamaet.showStatus=1;
  334. pamaet.timeType=null
  335. }else{
  336. pamaet.showStatus=0
  337. }
  338. this.$api.http.trendAnalysisLevel2(pamaet).then((res) => {
  339. if(this.Confirmthecontrast==false){
  340. let newlist=res.data.startList || [];
  341. var newline=[];
  342. var newline2=[];
  343. newlist.map(item=>{
  344. newline.push(item.zxl)
  345. newline2.push(item.statDate.slice(5,10))
  346. })
  347. this.SwitchCARDS(newline,newline2)
  348. }else{
  349. let newlist=res.data.startList || [];
  350. let newlist2=res.data.endList || [];
  351. let hejilist=res.data.comparedList || [];
  352. var newline=[];//起始数据
  353. var newline2=[];//对比数据
  354. var newline1=[];//时间
  355. let arr=[];
  356. newlist.map(item=>{
  357. newline.push(item.zxl)
  358. })
  359. newlist2.map(item=>{
  360. newline1.push(item.zxl)
  361. })
  362. newlist.forEach((item, sdf) => {
  363. newlist2.forEach((child, zxc) => {
  364. if (sdf == zxc) {
  365. newline2.push(item.statDate.substring(5,10) + 'vs' + child.statDate.substring(5, 10))
  366. arr.push({
  367. name:item.statDate.substring(5,10) + 'vs' + child.statDate.substring(5, 10),
  368. shiduan1:item.zxl,
  369. shiduan2:child.zxl,
  370. });
  371. }
  372. })
  373. })
  374. hejilist.forEach((acd,xdx)=>{
  375. arr.forEach((che,ind)=>{
  376. if(xdx==ind){
  377. che.heji=acd.zxl;
  378. }
  379. })
  380. })
  381. arr.unshift({
  382. name:'项目合计',
  383. shiduan1:res.data.startSum,
  384. shiduan2:res.data.endSum,
  385. heji:res.data.comparedSum,
  386. })
  387. this.SwitchCARDS2(newline,newline1,newline2)
  388. this.tableData=arr;
  389. console.log( this.tableData)
  390. }
  391. })
  392. },
  393. //切换一级
  394. Level1tap(){
  395. this.Level1.forEach((item,index)=>{
  396. if(this.Level1id==item.marketingId){
  397. this.Level2=item.children || [];
  398. this.Level2id=item.children[0].marketingId || '';
  399. }
  400. })
  401. this.trendAnalysisLevel2()
  402. },
  403. //切换er级
  404. Level2tap(){
  405. this.trendAnalysisLevel2()
  406. },
  407. //一二级
  408. trendAnalysisAllLevel(){
  409. let pamaet={
  410. showStatus:'',
  411. houseId:this.houseId,
  412. timeType:0,
  413. firstStartDate:this.page.openTime,
  414. firstEndDate:this.page.closeTime,
  415. lastStartDate:this.selectTime,
  416. lastEndDate:this.selectTime1,
  417. }
  418. if(this.timeType==-1){
  419. pamaet.timeType=null
  420. }else{
  421. pamaet.timeType=this.timeType
  422. }
  423. if(this.checked==true){
  424. pamaet.showStatus=1;
  425. pamaet.timeType=null
  426. }else{
  427. pamaet.showStatus=0
  428. }
  429. this.$api.http.trendAnalysisAllLevel(pamaet).then((res) => {
  430. this.Level1=res.data || [];
  431. this.Level1id=res.data[0].marketingId || '';
  432. this.Level2=res.data[0].children || [];
  433. this.Level2id=res.data[0].children[0].marketingId || '';
  434. this.trendAnalysisLevel2()
  435. })
  436. },
  437. //切换顾问
  438. consultanttap(){
  439. this.trendAnalysisAccount()
  440. },
  441. // 获取顾问
  442. trendAnalysisAllAccount(pamaet){
  443. this.$api.http.trendAnalysisAllAccount(pamaet).then((res) => {
  444. this.consultantlist=res.data || [];
  445. if( this.consultantlist.length!=0){
  446. this.consultantid=res.data[0].accountId;
  447. this.trendAnalysisAccount()
  448. }else{
  449. echarts.init(document.getElementById("main")).dispose();
  450. this.echartsisshow=false;
  451. this.tableData=[];
  452. }
  453. })
  454. },
  455. trendAnalysisAccount(){
  456. var that=this;
  457. let pamaet={
  458. showStatus:'',
  459. houseId:this.houseId,
  460. timeType:0,
  461. firstStartDate:this.page.openTime,
  462. firstEndDate:this.page.closeTime,
  463. lastStartDate:this.selectTime,
  464. lastEndDate:this.selectTime1,
  465. }
  466. if(this.aliasclass==3){
  467. pamaet.accountId=this.consultantid
  468. }
  469. if(this.timeType==-1){
  470. pamaet.timeType=null
  471. }else{
  472. pamaet.timeType=this.timeType
  473. }
  474. if(this.checked==true){
  475. pamaet.showStatus=1;
  476. pamaet.timeType=null
  477. }else{
  478. pamaet.showStatus=0
  479. }
  480. this.$api.http.trendAnalysisAccount(pamaet).then((res) => {
  481. if(this.Confirmthecontrast==false){
  482. let newlist=res.data.firstList || [];
  483. var newline=[];//起始数据
  484. var newlinename=[];
  485. let tablist=[
  486. {name:'时间',}
  487. ]
  488. let tablist2=[
  489. {name:that.customtime[0].substring(5,10)+'/'+that.customtime[1].substring(5,10),}
  490. ]
  491. newlist.map(item=>{
  492. newline.push(item.zxl)
  493. newlinename.push({name:item.name,max:100})
  494. tablist.push({name:item.name})
  495. tablist2.push({name:item.zxl+'%',})
  496. })
  497. this.tablelist1=tablist;
  498. this.tablelist2=tablist2;
  499. this.tablelist3=[];
  500. this.tablelist4=[];
  501. this.piechart(newline,newlinename)
  502. }else{
  503. let newlist=res.data.firstList || [];
  504. let newlist2=res.data.secondList|| [];
  505. let newlist4=res.data.thirdList|| [];
  506. var newline=[];//起始数据
  507. let newline2=[];//对比数据
  508. var newlinename=[];
  509. let tablist1=[
  510. {name:'时间',}
  511. ]
  512. let tablist2=[
  513. {name:that.customtime[0].substring(5,10)+'/'+that.customtime[1].substring(5,10),}
  514. ]
  515. let tablist3=[
  516. {name:that.selectTime.substring(5,10)+'/'+that.selectTime1.substring(5,10),}
  517. ]
  518. let tablist4=[
  519. {name:'变化',}
  520. ]
  521. newlist.map(item=>{
  522. newline.push(item.zxl)
  523. newlinename.push({name:item.name,max:100})
  524. tablist1.push({name:item.name})
  525. tablist2.push({name:item.zxl+'%',})
  526. })
  527. newlist2.map(item=>{
  528. newline2.push(item.zxl)
  529. tablist3.push({name:item.zxl+'%',})
  530. })
  531. newlist4.map(item=>{
  532. tablist4.push({name:item.zxl,})
  533. })
  534. this.tablelist1=tablist1;
  535. this.tablelist2=tablist2;
  536. this.tablelist3=tablist3;
  537. this.tablelist4=tablist4;
  538. this.piechart2(newline,newlinename,newline2)
  539. }
  540. })
  541. },
  542. //获取卡片
  543. trendtrendAnalysis(){
  544. let pamaet={
  545. showStatus:'',
  546. houseId:this.houseId,
  547. timeType:0,
  548. firstStartDate:this.page.openTime,
  549. firstEndDate:this.page.closeTime,
  550. lastStartDate:this.selectTime,
  551. lastEndDate:this.selectTime1
  552. }
  553. if(this.timeType==-1){
  554. pamaet.timeType=null
  555. }else{
  556. pamaet.timeType=this.timeType
  557. }
  558. if(this.checked==true){
  559. pamaet.showStatus=1;
  560. pamaet.timeType=null
  561. }else{
  562. pamaet.showStatus=0
  563. }
  564. this.$api.http.trendtrendAnalysis(pamaet).then((res) => {
  565. this.cardobj=res.data;
  566. if(this.aliasclass==1){
  567. this.echartsisshow=true;
  568. this.trendtrendAnalysisProject(pamaet)
  569. }else if(this.aliasclass==2){
  570. if(this.departmentid!=''){
  571. pamaet.deptId=this.departmentid
  572. this.trendtrendAnalysisProject(pamaet)
  573. }else{
  574. echarts.init(document.getElementById("main")).dispose();
  575. this.echartsisshow=false;
  576. this.tableData=[];
  577. }
  578. }else if(this.aliasclass==3){
  579. if(this.consultantid.length==0){
  580. this.trendAnalysisAllAccount(pamaet)
  581. }else{
  582. this.trendAnalysisAccount()
  583. }
  584. }else if(this.aliasclass==4){
  585. this.trendAnalysisAccount()
  586. }else{
  587. this.trendAnalysisAllLevel()
  588. }
  589. })
  590. },
  591. //项目
  592. trendtrendAnalysisProject(pamaet){
  593. this.$api.http.trendtrendAnalysisProject(pamaet).then((res) => {
  594. if(this.Confirmthecontrast==false){
  595. let newlist=res.data.startList || [];
  596. var newline=[];
  597. var newline2=[];
  598. newlist.map(item=>{
  599. newline.push(item.fraction)
  600. newline2.push(item.statDate.slice(5,10))
  601. })
  602. this.SwitchCARDS(newline,newline2)
  603. }else{
  604. let newlist=res.data.startList || [];
  605. let newlist2=res.data.endList || [];
  606. let hejilist=res.data.comparedList || [];
  607. var newline=[];//起始数据
  608. var newline2=[];//对比数据
  609. var newline1=[];//时间
  610. let arr=[];
  611. newlist.map(item=>{
  612. newline.push(item.fraction)
  613. })
  614. newlist2.map(item=>{
  615. newline1.push(item.fraction)
  616. })
  617. newlist.forEach((item, sdf) => {
  618. newlist2.forEach((child, zxc) => {
  619. if (sdf == zxc) {
  620. newline2.push(item.statDate.substring(5,10) + 'vs' + child.statDate.substring(5, 10))
  621. arr.push({
  622. name:item.statDate.substring(5,10) + 'vs' + child.statDate.substring(5, 10),
  623. shiduan1:item.fraction,
  624. shiduan2:child.fraction,
  625. });
  626. }
  627. })
  628. })
  629. hejilist.forEach((acd,xdx)=>{
  630. arr.forEach((che,ind)=>{
  631. if(xdx==ind){
  632. che.heji=acd.fraction;
  633. }
  634. })
  635. })
  636. arr.unshift({
  637. name:'项目合计',
  638. shiduan1:res.data.startSum,
  639. shiduan2:res.data.endSum,
  640. heji:res.data.comparedSum,
  641. })
  642. this.SwitchCARDS2(newline,newline1,newline2)
  643. this.tableData=arr;
  644. console.log( this.tableData)
  645. }
  646. })
  647. },
  648. //获取部门下拉菜单
  649. overviewfindList(){
  650. this.$api.http.overviewfindList({
  651. houseId:this.houseId,
  652. }).then((res) => {
  653. this.departmentlist=res.data || [];
  654. if(this.departmentlist.length!=0){
  655. this.departmentid=res.data[0].deptId
  656. }else{
  657. this.departmentid=''
  658. }
  659. })
  660. },
  661. //切换部门
  662. departmenttap(){
  663. this.trendtrendAnalysis()
  664. },
  665. //选项卡切换
  666. tapChange(idx){
  667. this.aliasclass=idx;
  668. this.trendtrendAnalysis()
  669. },
  670. //时间tab切换
  671. tabtimetap(i) {
  672. this.timeType = i;
  673. this.checked = false;
  674. this.selectTime = "";
  675. this.selectTime1 = "";
  676. //给时间选择器赋值
  677. let num = 24 * 3600 * 1000;
  678. // 获取当前时间戳转换为日期格式
  679. if (this.timeType == 4) {
  680. num = 24 * 3600 * 1000 * 6;
  681. }
  682. if (this.timeType == 5) {
  683. num = 24 * 3600 * 1000 * 14;
  684. }
  685. if (this.timeType == 6) {
  686. num = 24 * 3600 * 1000 * 29;
  687. }
  688. this.customtime = [
  689. this.timestampToTime(new Date().getTime() - num),
  690. this.timestampToTime(new Date().getTime()),
  691. ];
  692. this.$set(this, "time", null);
  693. this.Confirmthecontrast=false;
  694. this.trendtrendAnalysis()
  695. },
  696. // 对比时间选择弹框显示
  697. show() {
  698. this.$refs.time.pickerVisible = true;
  699. },
  700. //选择对比时间
  701. timeChange(e) {
  702. // 对数据进行处理
  703. // 当当前选择的为自定义时间时
  704. this.selectTime = "";
  705. this.selectTime1 = "";
  706. this.timeSelect(e);
  707. },
  708. timeSelect(e) {
  709. if (this.timeType == -1) {
  710. this.selectTime = e;
  711. this.selectTime1 = this.timestampToTime(new Date(e).getTime()+new Date(this.page.closeTime).getTime()-new Date(this.page.openTime).getTime());
  712. } else {
  713. // 获取今天昨天近一周
  714. // 获取一天的时间戳
  715. let num = 24 * 3600 * 1000;
  716. // 获取当前时间戳转换为日期格式
  717. if (this.timeType == 4) {
  718. num = 24 * 3600 * 1000 * 6;
  719. }
  720. if (this.timeType == 5) {
  721. num = 24 * 3600 * 1000 * 14;
  722. }
  723. if (this.timeType == 6) {
  724. num = 24 * 3600 * 1000 * 29;
  725. }
  726. this.selectTime = e;
  727. this.selectTime1 = this.timestampToTime(new Date(e).getTime() + num);
  728. }
  729. this.Confirmthecontrast=true;
  730. this.page.openTime=this.customtime[0]
  731. this.page.closeTime=this.customtime[1]
  732. this.trendtrendAnalysis()
  733. },
  734. radioChange() {
  735. this.selectTime = "";
  736. this.selectTime1 = "";
  737. this.$set(this, "time", null);
  738. },
  739. //选择自定义时间
  740. confirmtime(e) {
  741. this.timeType = "-1";
  742. this.checked = false;
  743. this.selectTime = "";
  744. this.selectTime1 = "";
  745. this.$set(this, "time", null);
  746. if (!e) return;
  747. this.page.openTime = this.customtime[0];
  748. this.page.closeTime = this.customtime[1];
  749. this.Confirmthecontrast=false;
  750. this.trendtrendAnalysis()
  751. },
  752. timestampToTime(timestamp) {
  753. var date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  754. var yyyy = date.getFullYear() + "-";
  755. var MM =(date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1): date.getMonth() + 1) + "-";
  756. var dd =(date.getDate() < 10 ? "0" + date.getDate() : date.getDate());
  757. return yyyy + MM + dd;
  758. },
  759. SwitchCARDS(newline,newline2) {
  760. echarts.init(document.getElementById("main")).dispose();
  761. var chartDom = document.getElementById("main");
  762. var myChart = echarts.init(chartDom);
  763. var option;
  764. option = {
  765. tooltip: {
  766. trigger: "axis",
  767. formatter: '{b0}: {c0}'+'%'
  768. },
  769. legend: {
  770. data: ["起始时间"],
  771. bottom: "10",
  772. },
  773. grid: {
  774. left: 10,
  775. right: 10,
  776. containLabel: true,
  777. },
  778. xAxis: {
  779. type: "category",
  780. data: newline2,
  781. axisLabel: {
  782. //重点在这一块,其余可以忽略
  783. textStyle: {
  784. color: "#212121", //更改坐标轴文字颜色
  785. },
  786. },
  787. axisLine: {
  788. lineStyle: {
  789. type: "solid",
  790. color: "#DDE1EE", //x线的颜色
  791. width: "1", //坐标线的宽度
  792. },
  793. },
  794. },
  795. yAxis: {
  796. type: "value",
  797. splitNumber:5,
  798. max:100,
  799. min:0,
  800. axisLabel: {
  801. //重点在这一块,其余可以忽略
  802. textStyle: {
  803. color: "#212121", //更改坐标轴文字颜色
  804. },
  805. },
  806. axisLine: {
  807. lineStyle: {
  808. ype: "solid",
  809. color: "#DDE1EE", //x线的颜色
  810. width: "1", //坐标线的宽度
  811. },
  812. },
  813. splitLine: {
  814. lineStyle: {
  815. type: "dashed", // y轴分割线类型
  816. },
  817. },
  818. axisTick: {
  819. //y轴刻度线
  820. show: false,
  821. },
  822. },
  823. series: [
  824. {
  825. name: "起始时间",
  826. data:newline,
  827. type: "line",
  828. smooth: true,
  829. },
  830. ],
  831. };
  832. option && myChart.setOption(option);
  833. window.addEventListener("resize", () => {
  834. myChart.resize();
  835. });
  836. },
  837. SwitchCARDS2(newline,newline1,newline2) {
  838. echarts.init(document.getElementById("main")).dispose();
  839. var chartDom = document.getElementById("main");
  840. var myChart = echarts.init(chartDom);
  841. var option;
  842. option = {
  843. tooltip: {
  844. trigger: "axis",
  845. formatter: function (params) {
  846. let src= '<p>'+params[0].seriesName+':'+params[0].data+'%'+'</p>'+'<p>'+params[1].seriesName+':'+ params[1].data+'%'+'</p>';
  847. return src
  848. }
  849. },
  850. legend: {
  851. data: ["起始时间","对比时间"],
  852. bottom: "10",
  853. },
  854. grid: {
  855. left: 10,
  856. right: 10,
  857. containLabel: true,
  858. },
  859. xAxis: {
  860. type: "category",
  861. data: newline2,
  862. axisLabel: {
  863. //重点在这一块,其余可以忽略
  864. textStyle: {
  865. color: "#212121", //更改坐标轴文字颜色
  866. },
  867. },
  868. axisLine: {
  869. lineStyle: {
  870. type: "solid",
  871. color: "#DDE1EE", //x线的颜色
  872. width: "1", //坐标线的宽度
  873. },
  874. },
  875. },
  876. yAxis: {
  877. type: "value",
  878. splitNumber:5,
  879. max:100,
  880. min:0,
  881. axisLabel: {
  882. //重点在这一块,其余可以忽略
  883. textStyle: {
  884. color: "#212121", //更改坐标轴文字颜色
  885. },
  886. },
  887. axisLine: {
  888. lineStyle: {
  889. ype: "solid",
  890. color: "#DDE1EE", //x线的颜色
  891. width: "1", //坐标线的宽度
  892. },
  893. },
  894. splitLine: {
  895. lineStyle: {
  896. type: "dashed", // y轴分割线类型
  897. },
  898. },
  899. axisTick: {
  900. //y轴刻度线
  901. show: false,
  902. },
  903. },
  904. series: [
  905. {
  906. name: "起始时间",
  907. data:newline,
  908. type: "line",
  909. smooth: true,
  910. },
  911. {
  912. name: "对比时间",
  913. data:newline1,
  914. type: "line",
  915. smooth: true,
  916. }
  917. ],
  918. };
  919. option && myChart.setOption(option);
  920. window.addEventListener("resize", () => {
  921. myChart.resize();
  922. });
  923. },
  924. piechart2(newline,newlinename,newline2){
  925. echarts.init(document.getElementById("main")).dispose();
  926. var chartDom = document.getElementById("main");
  927. var myChart = echarts.init(chartDom);
  928. var option;
  929. option = {
  930. tooltip: {
  931. trigger: 'axis'
  932. },
  933. legend: {
  934. data: ['起始时间','对比时间'],
  935. right: "10",
  936. top:'10'
  937. },
  938. color:[
  939. '#2671E2',
  940. '#F3787B',
  941. ],
  942. radar: {
  943. // shape: 'circle',
  944. indicator: newlinename
  945. },
  946. series: [
  947. {
  948. type: 'radar',
  949. tooltip: {
  950. trigger: 'item'
  951. },
  952. data: [
  953. {
  954. value:newline,
  955. name: '起始时间'
  956. },
  957. {
  958. value:newline2,
  959. name: '对比时间'
  960. },
  961. ]
  962. }
  963. ]
  964. };
  965. option && myChart.setOption(option);
  966. window.addEventListener("resize", () => {
  967. myChart.resize();
  968. });
  969. },
  970. piechart(newline,newlinename){
  971. echarts.init(document.getElementById("main")).dispose();
  972. var chartDom = document.getElementById("main");
  973. var myChart = echarts.init(chartDom);
  974. var option;
  975. option = {
  976. tooltip: {
  977. trigger: 'axis'
  978. },
  979. legend: {
  980. data: ['起始时间'],
  981. right: "10",
  982. top:'10'
  983. },
  984. color:[
  985. '#2671E2',
  986. '#F3787B',
  987. ],
  988. radar: {
  989. // shape: 'circle',
  990. indicator: newlinename
  991. },
  992. series: [
  993. {
  994. type: 'radar',
  995. tooltip: {
  996. trigger: 'item'
  997. },
  998. data: [
  999. {
  1000. value:newline,
  1001. name: '起始时间'
  1002. },
  1003. ]
  1004. }
  1005. ]
  1006. };
  1007. option && myChart.setOption(option);
  1008. window.addEventListener("resize", () => {
  1009. myChart.resize();
  1010. });
  1011. }
  1012. },
  1013. };
  1014. </script>
  1015. <style scoped="scoped" lang="scss" >
  1016. .box-center {
  1017. width: 100%;
  1018. padding: 15px;
  1019. min-width: 1200px;
  1020. padding-bottom: 100px;
  1021. }
  1022. .table {
  1023. border-collapse: collapse;
  1024. width: 100%;
  1025. }
  1026. .tbody {
  1027. display: block;
  1028. // width: 100%;
  1029. // overflow-x: auto;
  1030. // overflow-y: auto;
  1031. height: 220px;
  1032. }
  1033. .tbody tr {
  1034. display: table;
  1035. width: 100%;
  1036. table-layout: fixed;
  1037. // word-break: break-all;
  1038. }
  1039. #main {
  1040. width: 100%;
  1041. height: 380px;
  1042. }
  1043. .app-box-san {
  1044. width: 100%;
  1045. background: #ffffff;
  1046. box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.04);
  1047. border-radius: 4px;
  1048. margin-top: 15px;
  1049. padding-bottom: 15px;
  1050. .santitle {
  1051. width: 100%;
  1052. height: 50px;
  1053. line-height: 50px;
  1054. border-bottom: 1px solid #e0e0e0;
  1055. font-size: 16px;
  1056. color: #333333;
  1057. font-weight: 500;
  1058. text-indent: 15px;
  1059. }
  1060. .santab {
  1061. width: 100%;
  1062. height: 400px;
  1063. padding: 15px;
  1064. }
  1065. }
  1066. .app-box-er {
  1067. width: 100%;
  1068. background: #ffffff;
  1069. box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.04);
  1070. border-radius: 4px;
  1071. margin-top: 15px;
  1072. padding: 15px;
  1073. .titletab {
  1074. width: 100%;
  1075. height: 42px;
  1076. display: flex;
  1077. // border: 1px solid red;
  1078. }
  1079. .titletab div {
  1080. width: 130px;
  1081. height: 42px;
  1082. line-height: 42px;
  1083. text-align: center;
  1084. border: 1px solid #e0e0e0;
  1085. font-size: 14px;
  1086. }
  1087. .claindex {
  1088. background: #2671e2;
  1089. color: #ffffff;
  1090. border: none;
  1091. }
  1092. }
  1093. .kapian-box {
  1094. width: 100%;
  1095. height: 144px;
  1096. margin-top: 15px;
  1097. display: flex;
  1098. .kayi {
  1099. flex: 1;
  1100. margin-right: 15px;
  1101. height: 144px;
  1102. background: #ffffff;
  1103. border-radius: 4px;
  1104. .shang {
  1105. width: 100%;
  1106. display: flex;
  1107. .zuo {
  1108. width: 50%;
  1109. .text1 {
  1110. font-size: 16px;
  1111. font-weight: 400;
  1112. color: #666666;
  1113. margin-left: 30px;
  1114. margin-top: 24px;
  1115. }
  1116. .text2 {
  1117. font-size: 32px;
  1118. font-weight: normal;
  1119. color: #32363d;
  1120. margin-left: 30px;
  1121. margin-top: 18px;
  1122. }
  1123. }
  1124. .you {
  1125. width:50%;
  1126. display: flex;
  1127. align-items: center;
  1128. .youimg {
  1129. width: 90%;
  1130. height: 60px;
  1131. }
  1132. }
  1133. }
  1134. .xia {
  1135. width: 100%;
  1136. font-size: 14px;
  1137. text-indent: 30px;
  1138. margin-top: 10px;
  1139. .span1 {
  1140. color: #333333;
  1141. font-weight: 400;
  1142. }
  1143. .span2 {
  1144. color: #e6273a;
  1145. font-weight: 400;
  1146. margin-left: 16px;
  1147. }
  1148. }
  1149. }
  1150. }
  1151. .tophove {
  1152. color: #ffffff;
  1153. background: #2671e2;
  1154. }
  1155. .app-top {
  1156. width: 100%;
  1157. background: #ffffff;
  1158. box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.04);
  1159. border-radius: 4px;
  1160. padding-top: 15px;
  1161. padding-bottom: 15px;
  1162. }
  1163. .app-titel {
  1164. width: 100%;
  1165. display: flex;
  1166. align-items: center;
  1167. .titel-text {
  1168. height: 100%;
  1169. font-size: 16px;
  1170. font-weight: 600;
  1171. color: #32363d;
  1172. text-indent: 30px;
  1173. }
  1174. .toptimeqhuan {
  1175. width: 190px;
  1176. height: 32px;
  1177. background: #ffffff;
  1178. border-radius: 4px;
  1179. border: 1px solid #e0e0e0;
  1180. display: flex;
  1181. align-items: center;
  1182. overflow: hidden;
  1183. margin-left: 20px;
  1184. cursor: pointer;
  1185. }
  1186. .toptimeqhuan div {
  1187. flex: 1;
  1188. text-align: center;
  1189. line-height: 32px;
  1190. font-size: 14px;
  1191. }
  1192. }
  1193. .timeSel {
  1194. margin-top: 8px;
  1195. margin-left: 20px;
  1196. border: 1px solid #ccc;
  1197. padding: 0 5px;
  1198. cursor: pointer;
  1199. color: #606266;
  1200. }
  1201. .theadtd{
  1202. width: 140px;
  1203. height: 48px;
  1204. border: 1px solid #E0E0E0;
  1205. text-align: center;
  1206. line-height: 48px;
  1207. font-size: 16px;
  1208. color: #32363D;
  1209. }
  1210. </style>