index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-10-14 17:17:53
  4. * @LastEditTime: 2022-01-12 11:09:08
  5. * @LastEditors: Please set LastEditors
  6. * @Description: In User Settings Edit
  7. * @FilePath: \Foshan4A\src\views\dashboard\index.vue
  8. -->
  9. <template>
  10. <div class="dashboard">
  11. <!--分类信息-->
  12. <div class="flex-wrap tu-fl">
  13. <router-link v-for="(item,index) in flList" :key="index" class="flex fl-list" :to="item.appUrl ? item.appUrl:'/'">
  14. <div class="fl-list-img">
  15. <img :src="item.logo">
  16. </div>
  17. <div class="fl-list-title flex1">{{item.appName}}</div>
  18. </router-link>
  19. </div>
  20. <!--切换和搜索-->
  21. <div class="dashboard-tab flex">
  22. <div class="tab">
  23. <el-radio-group v-model="radio">
  24. <el-radio label="1">数据分析</el-radio>
  25. <el-radio label="2">个人日志</el-radio>
  26. </el-radio-group>
  27. </div>
  28. <div class="search flex-wrap">
  29. <div class="search-input flex-wrap r24">
  30. <el-select :style="inputFlag ? 'width:150px;':'width:200px;'" @change="handleChange" v-model="select" placeholder="功能菜单">
  31. <el-option v-for="(item,index) in selectArr" :key="index" :label="item.name" :value="item.value"></el-option>
  32. </el-select>
  33. <el-input v-show="inputFlag" :style="inputFlag ? 'width:330px;':'width:280px;'" placeholder="如需搜索,请输入" v-model="input" class="input-with-select">
  34. </el-input>
  35. <!-- <el-select v-model="select" slot="prepend" placeholder="功能菜单">
  36. <el-option v-for="(item,index) in selectArr" :key="index" :label="item.name" :value="item.value"></el-option>
  37. </el-select> -->
  38. </div>
  39. <div class="search-btn">
  40. <el-button @click="searchByLink" class="btn" type="primary">进入</el-button>
  41. </div>
  42. </div>
  43. </div>
  44. <!--数据分析-->
  45. <Analysis :roleFlag="roleFlag" v-show="radio == 1" />
  46. <!--个人日志-->
  47. <Journal v-show="radio == 2" />
  48. </div>
  49. </template>
  50. <script>
  51. import { mapGetters } from 'vuex'
  52. import Analysis from './components/analysis.vue'
  53. import Journal from './components/journal.vue'
  54. import { GetOthSystem } from '@/api/apiHome'
  55. export default {
  56. name: 'Dashboard',
  57. components: { Analysis, Journal },
  58. data () {
  59. return {
  60. roleFlag: true,
  61. inputFlag: false,
  62. //搜索信息
  63. selectArr: [
  64. {
  65. id: 1,
  66. name: "账号管理",
  67. value: 1,
  68. },
  69. {
  70. id: 2,
  71. name: "账号组管理",
  72. value: 2,
  73. },
  74. {
  75. id: 3,
  76. name: "权限项管理",
  77. value: 3,
  78. },
  79. {
  80. id: 4,
  81. name: "角色管理",
  82. value: 4,
  83. },
  84. {
  85. id: 5,
  86. name: "组织管理",
  87. value: 5,
  88. },
  89. {
  90. id: 6,
  91. name: "岗位管理",
  92. value: 6,
  93. },
  94. {
  95. id: 7,
  96. name: "职员管理",
  97. value: 7,
  98. },
  99. {
  100. id: 8,
  101. name: "登录策略",
  102. value: 8,
  103. },
  104. {
  105. id: 10,
  106. name: "系统设置",
  107. value: 10,
  108. },
  109. ],
  110. //分类信息
  111. flList: [],
  112. //切换
  113. radio: '1',
  114. flIndex: 0,
  115. input: '',
  116. select: ''
  117. }
  118. },
  119. computed: {
  120. ...mapGetters(['systemSet', 'UserType', 'UserId'])
  121. },
  122. created () {
  123. this.isPower()
  124. this.getOthSystem()
  125. },
  126. methods: {
  127. //搜索-跳转
  128. searchByLink () {
  129. const num = this.select
  130. switch (num) {
  131. case 1:
  132. this.$router.push({ path: '/account', query: { keyWords: this.input } });
  133. break;
  134. case 2:
  135. this.$router.push({ path: '/accountGroup', query: { keyWords: this.input } });
  136. break;
  137. case 3:
  138. this.$router.push({ path: '/authority', query: { keyWords: this.input } });
  139. break;
  140. case 4:
  141. this.$router.push({ path: '/role', query: { keyWords: this.input } });
  142. break;
  143. case 5:
  144. this.$router.push({ path: '/organization', query: { keyWords: this.input } });
  145. break;
  146. case 6:
  147. this.$router.push({ path: '/jobs', query: { keyWords: this.input } });
  148. break;
  149. case 7:
  150. this.$router.push({ path: '/staff', query: { keyWords: this.input } });
  151. break;
  152. case 8:
  153. this.$router.push({ path: '/LoginPolicy', query: { keyWords: this.input } });
  154. break;
  155. case 9:
  156. this.$router.push('/audit');
  157. break;
  158. case 10:
  159. this.$router.push('/systemManagement');
  160. break;
  161. default:
  162. this.$message.warning('请选择');
  163. break;
  164. }
  165. },
  166. //获取接入系统信息
  167. async getOthSystem () {
  168. try {
  169. const result = await GetOthSystem({
  170. userId: Number(this.UserId),
  171. userType: this.UserType
  172. })
  173. if (result.code === 0 && result.returnData.length) {
  174. this.flList = result.returnData
  175. } else {
  176. this.$message.error(result.message)
  177. }
  178. } catch (error) {
  179. console.log('网络错误:', error)
  180. }
  181. },
  182. //判断页面展示权限
  183. isPower () {
  184. const obj = typeof (this.systemSet) === 'string' ? JSON.parse(this.systemSet) : this.systemSet
  185. const { OpenGroup, OpenRole } = obj
  186. if (!OpenGroup) {
  187. this.selectArr.forEach((item, index) => {
  188. if (item.id === 2) {
  189. this.selectArr.splice(index, 1)
  190. }
  191. })
  192. }
  193. if (!OpenRole) {
  194. this.selectArr.forEach((item, index) => {
  195. if (item.id === 4) {
  196. this.roleFlag = false
  197. this.selectArr.splice(index, 1)
  198. }
  199. })
  200. }
  201. },
  202. handleChange (val) {
  203. if (val !== 10) {
  204. this.inputFlag = true
  205. } else {
  206. this.inputFlag = false
  207. }
  208. }
  209. }
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. .dashboard {
  214. position: relative;
  215. width: 100%;
  216. height: 100%;
  217. padding: 0 64px;
  218. padding-top: 32px;
  219. .tu-fl {
  220. .fl-list {
  221. padding: 24px;
  222. min-width: 240px;
  223. height: 88px;
  224. background: #fff;
  225. cursor: pointer;
  226. margin-right: 24px;
  227. box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
  228. border-radius: 16px;
  229. margin-bottom: 24px;
  230. .fl-list-img {
  231. width: 40px;
  232. height: 40px;
  233. overflow: hidden;
  234. img {
  235. max-width: 100%;
  236. }
  237. }
  238. .fl-list-title {
  239. font-size: 16px;
  240. font-family: Microsoft YaHei;
  241. font-weight: bold;
  242. color: #303133;
  243. line-height: 40px;
  244. margin-left: 16px;
  245. }
  246. &:last-child {
  247. margin-right: 0;
  248. }
  249. }
  250. .active {
  251. background: linear-gradient(0deg, #777dba, #6983be);
  252. .fl-list-title {
  253. color: #fff;
  254. }
  255. }
  256. }
  257. .dashboard-tab {
  258. margin: 24px 0 32px 0;
  259. line-height: 48px;
  260. ::v-deep .tab {
  261. .el-radio__label {
  262. font-size: 16px;
  263. font-family: Microsoft YaHei;
  264. font-weight: bold;
  265. color: #303133;
  266. }
  267. }
  268. ::v-deep .search {
  269. .search-input {
  270. height: 48px;
  271. background: #ffffff;
  272. box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
  273. border-radius: 6px;
  274. line-height: 48px;
  275. max-width: 480px;
  276. .el-input-group__prepend {
  277. border: none;
  278. background-color: #fff;
  279. width: 120px;
  280. }
  281. .el-input__inner {
  282. border: 1px solid #fff;
  283. font-size: 16px;
  284. }
  285. }
  286. .search-btn {
  287. .btn {
  288. height: 48px;
  289. background: linear-gradient(0deg, #6983be, #777dba);
  290. box-shadow: 0px 3px 4px 0px rgba(0, 0, 0, 0.18);
  291. border-radius: 6px;
  292. font-size: 16px;
  293. font-family: Microsoft YaHei;
  294. font-weight: bold;
  295. color: #ffffff;
  296. min-width: 96px;
  297. }
  298. }
  299. }
  300. }
  301. }
  302. </style>