index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="container">
  3. <el-row :gutter="20" class="normal-margin">
  4. <el-col :span="6">
  5. <user :data="dataOverview.user"></user>
  6. </el-col>
  7. <el-col :span="6">
  8. <flow ref="flow" :data="dataOverview.flow"></flow>
  9. </el-col>
  10. <el-col :span="6">
  11. <sms ref="sms" :data="dataOverview.sms"></sms>
  12. </el-col>
  13. <el-col :span="6">
  14. <storage ref="storage" :data="dataOverview.storage"></storage>
  15. </el-col>
  16. </el-row>
  17. <div class="normal-card normal-margin " shadow="none" v-for="item in modulesList" :key="item.systemid">
  18. <p class="title">{{item.systemname}}</p>
  19. <el-row :gutter="20">
  20. <el-col style="margin-top:16px" :span="4" v-for="modules in item.modules" :key="modules.systemmoduleid" @click.native="redictToModules(modules)">
  21. <div class="modules-item flex-align-center">
  22. <div class="setting-panel">
  23. <el-dropdown placement="top">
  24. <span class="el-dropdown-link">
  25. <i class="el-icon-setting"></i>
  26. </span>
  27. <el-dropdown-menu slot="dropdown">
  28. <el-dropdown-item @click.native="addToshortBar(modules)">添加到快捷操作</el-dropdown-item>
  29. </el-dropdown-menu>
  30. </el-dropdown>
  31. </div>
  32. <img width="50" height="50" :src="modules.iconurl" alt="">
  33. <p>{{modules.systemmodulename}}<br><small class="info">{{(modules.systemmodule).toUpperCase()}}</small></p>
  34. </div>
  35. </el-col>
  36. </el-row>
  37. </div>
  38. <el-dialog
  39. title="提醒"
  40. :visible.sync="dialogVisible"
  41. width="600px"
  42. >
  43. <span>{{contentMsg}}</span>
  44. <span slot="footer" class="dialog-footer">
  45. <el-button @click="dialogVisible = false" size="small">下次再说</el-button>
  46. <el-button v-if="type[0].usertype == '22'" @click="onReminder" size="small">提醒主账号付费</el-button>
  47. <el-button type="primary" @click="onPay" size="small">去付费</el-button>
  48. </span>
  49. </el-dialog>
  50. </div>
  51. </template>
  52. <script>
  53. import user from './modules/user.vue'
  54. import flow from './modules/flow.vue'
  55. import sms from './modules/sms.vue'
  56. import storage from './modules/storage.vue'
  57. export default {
  58. components:{
  59. user,
  60. flow,
  61. sms,
  62. storage
  63. },
  64. data () {
  65. return {
  66. modulesList:[],
  67. dataOverview:{},
  68. dialogVisible:false,
  69. contentMsg:'',
  70. type:"",
  71. nowAccount:'',
  72. userids:[],
  73. flag:''
  74. }
  75. },
  76. methods:{
  77. redictToModules (item) {
  78. this.$router.push({path:item.apps[0].path})
  79. sessionStorage.setItem('active_modules',JSON.stringify(item))
  80. window.sessionStorage.setItem('currentPath',item.apps[0].path)
  81. },
  82. async addToshortBar (item) {
  83. const res = await this.$api.requested({
  84. "classname": "sysmanage.develop.userauth.userauth",
  85. "method": "create_usershortcuts",
  86. "content": {
  87. "systemmoduleid":item.systemmoduleid
  88. }
  89. })
  90. this.$store.dispatch('setUsershortcuts')
  91. },
  92. async getDataOverview () {
  93. const res = await this.$api.requested({
  94. "classname": "webmanage.dataanalysis.data",
  95. "method": "getDataOverview",
  96. "content": {}
  97. })
  98. this.dataOverview = res.data
  99. this.$refs.flow.piePlot.changeData([{num:res.data.flow.unUsed,type:'未使用'},{num:res.data.flow.used,type:'已使用'}])
  100. this.$refs.sms.piePlot.changeData([{num:res.data.sms.total - res.data.sms.used,type:'未使用'},{num:res.data.sms.used,type:'已使用'}])
  101. this.$refs.storage.piePlot.changeData([{num:res.data.storage.unUsed,type:'未使用'},{num:res.data.storage.used,type:'已使用'}])
  102. },
  103. async queryAccount(){
  104. sessionStorage.setItem('flag','1')
  105. this.nowAccount = []
  106. const res = await this.$api.requested({
  107. "classname": "webmanage.site.paymentrules",
  108. "method": "queryRemind",
  109. "content": {},
  110. })
  111. this.nowAccount = res.data[0]
  112. if (res.data.length > 1){
  113. this.dialogVisible = true
  114. this.contentMsg = '【'+res.data[0].partitionname+'】将在'+res.data[0].days+'天后到期,请尽快续费!'
  115. }else {
  116. this.queryReminder()
  117. }
  118. },
  119. async queryReminder(){
  120. this.nowAccount = []
  121. const res = await this.$api.requested({
  122. "classname": "webmanage.site.paymentrules",
  123. "method": "queryRemindUser",
  124. "content": {},
  125. })
  126. if (res.data.length > 0){
  127. this.dialogVisible = true
  128. let name = ''
  129. this.userids = []
  130. this.nowAccount = res.data[0]
  131. res.data.forEach((item,index)=>{
  132. name = name + item.name
  133. this.userids[index] = item.userid
  134. })
  135. this.contentMsg = name + '申请账号付费,请前往处理!'
  136. }
  137. },
  138. onPay(){
  139. let module = JSON.parse(sessionStorage.getItem('module_info'))
  140. let moduleList = []
  141. module.forEach(item=>{
  142. if (item.systemname === '通用'){
  143. moduleList = item
  144. }
  145. })
  146. let apps = []
  147. moduleList.modules.forEach(item=>{
  148. if (item.systemmodulename === '个人中心'){
  149. apps = item
  150. }
  151. })
  152. sessionStorage.setItem('active_modules',JSON.stringify(apps))
  153. this.activePath = '/pay_orders'
  154. this.$router.replace({path:'/pay_orders',query:{isPay:'2',id:this.nowAccount.sys_site_systempartitionid,userid:this.userids}})
  155. sessionStorage.setItem('currentPath','/pay_orders')
  156. let active_modules = JSON.parse(sessionStorage.getItem('active_modules'))
  157. this.auth_data = active_modules.apps
  158. },
  159. async onReminder(){
  160. const res = await this.$api.requested({
  161. "classname": "system.payorder.payorder",
  162. "method": "sendMessage",
  163. "content": {
  164. "sys_payorderid": 0
  165. },
  166. })
  167. this.dialogVisible = false
  168. }
  169. },
  170. mounted () {
  171. this.modulesList = JSON.parse(sessionStorage.getItem('module_info'))
  172. this.type = JSON.parse(sessionStorage.getItem('account_list'))
  173. this.flag = JSON.parse(sessionStorage.getItem('flag'))
  174. this.userids[0] = this.type[0].userid
  175. this.getDataOverview()
  176. if (this.flag != '1'){
  177. this.queryAccount()
  178. }
  179. },
  180. created() {
  181. }
  182. }
  183. </script>
  184. <style>
  185. </style>
  186. <style scoped>
  187. .title{
  188. font-size: 16px;
  189. font-weight: bold;
  190. }
  191. .modules-item{
  192. position: relative;
  193. padding: 20px;
  194. border-radius: 8px;
  195. cursor: pointer;
  196. }
  197. .modules-item > p{
  198. margin-left: 15px;
  199. }
  200. .modules-item:hover{
  201. background: #EAF1FE;
  202. }
  203. .setting-panel{
  204. position: absolute;
  205. display: none;
  206. right:10px;
  207. top:10px;
  208. }
  209. .modules-item:hover .setting-panel{
  210. display: block;
  211. }
  212. </style>