Login.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <div class="content">
  3. <div class="main">
  4. <!-- 待办 头部 -->
  5. <a-layout-header class="todoBox">
  6. <div class="left fl clearfix">
  7. <!-- 待办 -->
  8. <span v-if="isshow == '1'">
  9. <img src="@assets/todo.png" alt="?????" />
  10. <div class="info" style="color:white; top:3%; left:26%;">
  11. <span>我的待办</span>
  12. <a-badge class="numTips" style="backgroundColor:#f94f46;">
  13. {{ todoList.length }}
  14. </a-badge>
  15. </div>
  16. </span>
  17. <!-- 无 待办 -->
  18. <span v-if="isshow == '2'">
  19. <img src="@assets/nothing.png" alt="?????" />
  20. <div class="info" style="top:2%; left:33%;">
  21. <span style="color:white;">暂无待办</span>
  22. <a-badge class="numTips" style="color:#ffcf2d;backgroundColor:#ffcf2d;">
  23. {{ todoList.length }}
  24. </a-badge>
  25. </div>
  26. </span>
  27. </div>
  28. <!-- 右边 -->
  29. <a href="#" @click.stop.prevent="todo()" class="more right fr clearfix">
  30. <a-icon type="more" class="moreIcon" />
  31. <a-divider type="vertical" />
  32. <span>更多</span>
  33. </a>
  34. </a-layout-header>
  35. <!-- OA工作台 -->
  36. <a-card title="OA工作台" :bordered="false" style="width: 100%; background:#F7E0D4;">
  37. <div class="oa">
  38. <a
  39. href="#"
  40. class="oaItem"
  41. v-for="(item, index) in activeKeyAll"
  42. :key="index.id"
  43. @click.prevent="aClick(item)"
  44. >
  45. <span>
  46. <img :src="item.iconAddress" />
  47. </span>
  48. <p>{{ item.name }}</p>
  49. </a>
  50. </div>
  51. </a-card>
  52. <!-- 数据渲染 表单 -->
  53. <a-modal v-model="lcModal.visible" :title="lcModal.Title" :footer="null" :maskClosable="false">
  54. <component
  55. :disabled="lcModal.disabled"
  56. v-if="lcModal.visible"
  57. :is="lcModal.formComponent"
  58. :processData="lcModal.processData"
  59. :isNew="lcModal.isNew"
  60. @afterSubmit="afterSub"
  61. @close="(lcModal.visible = false), (lcModal.disabled = false)"
  62. >
  63. </component>
  64. </a-modal>
  65. </div>
  66. <!-- 底部 -->
  67. <a-layout-footer class="footer">
  68. 上海萃颠信息科技有限公司出品
  69. </a-layout-footer>
  70. </div>
  71. </template>
  72. <script>
  73. // 组件中使用映射,所以需要导入
  74. import { mapActions } from 'vuex'
  75. import Vue from 'vue'
  76. import { ACCESS_TOKEN, ENCRYPTED_STRING, USER_INFO } from '@/store/mutation-types'
  77. import api from '@/api'
  78. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  79. import { activitiMixin } from '@/views/activiti/mixins/activitiMixin'
  80. import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
  81. export default {
  82. name: 'Login',
  83. components: {},
  84. data() {
  85. return {
  86. todoList: [],
  87. activeKeyAll: [],
  88. url: {
  89. todoList: '/actTask/todoList',
  90. doneList: '/actTask/doneList'
  91. },
  92. //按钮弹框
  93. lcModal: {
  94. title: '',
  95. visible: false,
  96. disabled: false,
  97. formComponent: null,
  98. isNew: false
  99. },
  100. isshow: '0'
  101. }
  102. },
  103. // 页面打开时,默认已登录
  104. created() {
  105. Vue.ls.remove(ACCESS_TOKEN)
  106. // 进入页面自动登录
  107. this.autoLogin()
  108. .then(res => {
  109. this.getDataList() // 待办、已办 列表
  110. })
  111. .then(res => {
  112. this.getActiveKeyAll() // OA 4个按钮
  113. })
  114. },
  115. methods: {
  116. // init() {
  117. // this.getDataList()
  118. // },
  119. // 映射store/user.js 中 actions的方法
  120. ...mapActions(['Login']),
  121. // 自动登录
  122. async autoLogin() {
  123. var that = this
  124. let loginParams = {}
  125. loginParams.username = 'fenghf'
  126. loginParams.password = 'fenghf`123456'
  127. loginParams.slidered = true // 默认滑块
  128. // console.log('打印出登录参数', loginParams)
  129. // 异步操作
  130. await that
  131. .Login(loginParams)
  132. .then(res => {
  133. console.log('Login拿到token | 登录上啦!')
  134. })
  135. .catch(err => {
  136. console.log(err)
  137. })
  138. },
  139. // 点击全部 跳转页面
  140. todo() {
  141. this.$router.push({ path: '/user/todo' })
  142. console.log(this.$router)
  143. },
  144. // 待办 num
  145. getDataList() {
  146. this.postFormAction(this.url.todoList, {}).then(res => {
  147. if (res.success) {
  148. this.todoList = res.result || []
  149. console.log('login 待办num:', this.todoList.length)
  150. if (this.todoList && this.todoList.length > 0) {
  151. this.isshow = '1'
  152. } else {
  153. this.isshow = '2'
  154. }
  155. }
  156. })
  157. // 已办列表
  158. // this.postFormAction(this.url.doneList, this.searchForm).then(res => {
  159. // this.loading = false
  160. // if (res.success) {
  161. // this.doneList = res.result || []
  162. // console.log('已渲染到已办数目', this.doneList.length)
  163. // } else {
  164. // this.$message.error(res.message)
  165. // }
  166. // })
  167. },
  168. // 获取 OA 按钮
  169. getActiveKeyAll() {
  170. this.postFormAction('/activiti_process/listData', { status: 1, roles: true }).then(res => {
  171. this.activeKeyAll = []
  172. if (res.success) {
  173. var result = res.result || []
  174. if (result.length > 0) {
  175. this.activeKeyAll = result
  176. // this.activeKeyAll.push.apply(this.activeKeyAll,result);
  177. // console.log(this.activeKeyAll)
  178. console.log('OA 4个按钮被渲染')
  179. }
  180. }
  181. })
  182. },
  183. //OA图标点击事件
  184. aClick(v) {
  185. //点击的该项按钮
  186. console.log(v)
  187. // this.$refs.modal.add("1")
  188. if (!v.routeName) {
  189. this.$message.warning('该流程信息未配置表单,请联系开发人员!')
  190. return
  191. }
  192. if (v.routeName.indexOf('外部表单') != -1) {
  193. alert('调用其他项目页面')
  194. } else if (v.routeName.indexOf('自定义') != -1) {
  195. this.lcModal.disabled = false
  196. let com = { component: () => import(`@/views/activiti/form/demoForm2`) }
  197. this.lcModal.formComponent = com.component
  198. this.lcModal.title = '发起流程:' + v.name
  199. this.lcModal.isNew = true
  200. this.lcModal.processData = v
  201. this.lcModal.visible = true
  202. } else {
  203. this.lcModal.disabled = false
  204. this.lcModal.formComponent = this.getFormComponent(v.routeName).component
  205. this.lcModal.title = '发起流程:' + v.name
  206. this.lcModal.isNew = true
  207. this.lcModal.processData = v
  208. this.lcModal.visible = true
  209. }
  210. console.log('发起', v)
  211. // this.getDataList()
  212. },
  213. //提交后
  214. afterSub(formData) {
  215. this.lcModal.visible = false
  216. }
  217. }
  218. }
  219. </script>
  220. <style src="@assets/less/overwrite.less" lang="less" scoped></style>
  221. <style lang="less" scoped>
  222. /deep/.ant-card-head-title {
  223. padding: 0;
  224. }
  225. /deep/.ant-card-body {
  226. padding: 0 24px;
  227. }
  228. /deep/.ant-layout-header {
  229. line-height: 0;
  230. }
  231. /deep/.ant-card-head-title {
  232. font-size: 18px;
  233. }
  234. .content {
  235. width: 100%;
  236. height: 100%;
  237. background-color: rgba(#f7e0d4);
  238. .main {
  239. //头部 蓝盒子
  240. .todoBox {
  241. padding: 18px;
  242. height: 180px;
  243. width: 100%;
  244. background-color: #347b98;
  245. box-shadow: 0 4px 8px 1px rgba(0, 0, 0, 0.1), 0 6px 20px 1px rgba(0, 0, 0, 0.19);
  246. margin-bottom: 30px;
  247. border-bottom-right-radius: 18px;
  248. border-bottom-left-radius: 18px;
  249. // 待办小黑板
  250. .left {
  251. height: 100%;
  252. width: 190px;
  253. //黑板内信息
  254. .info {
  255. position: absolute;
  256. span {
  257. font-weight: 700;
  258. position: relative;
  259. letter-spacing: 1px;
  260. font-size: 16px;
  261. }
  262. }
  263. // 待办 数量
  264. .numTips {
  265. position: absolute;
  266. top: -10px;
  267. left: 0px;
  268. padding: 3px 8px;
  269. text-align: center;
  270. line-height: 20px;
  271. border-radius: 50%;
  272. color: white !important;
  273. font-size: 16px;
  274. }
  275. }
  276. // 按钮
  277. .right {
  278. line-height: 30px;
  279. margin: 30px 8px 0 0;
  280. padding: 12px 24px;
  281. background-color: #f7e0d4;
  282. border-radius: 10px;
  283. letter-spacing: 1px;
  284. box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2);
  285. .moreIcon {
  286. margin: 0;
  287. padding: 0;
  288. font-size: 16px;
  289. color: #1489b8;
  290. margin-top: 10%;
  291. }
  292. // 文字
  293. span {
  294. font-size: 16px;
  295. color: #092834;
  296. font-weight: 700;
  297. }
  298. }
  299. }
  300. // OA 工作台
  301. .oa {
  302. display: flex;
  303. flex-flow: row wrap;
  304. justify-content: space-between;
  305. text-align: center;
  306. padding: 40px;
  307. //四个按钮
  308. .oaItem {
  309. width: calc((100% - 70px) / 2);
  310. color: #092834;
  311. border-radius: 10px;
  312. margin-bottom: 70px;
  313. box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.1), 0 6px 20px 0 rgba(0, 0, 0, 0.1);
  314. // 图
  315. span {
  316. display: block;
  317. width: 60px;
  318. height: 60px;
  319. margin: auto;
  320. margin-top: 20px;
  321. }
  322. // 文字
  323. p {
  324. margin-top: 10px;
  325. color: #092834;
  326. }
  327. }
  328. }
  329. }
  330. }
  331. </style>