Login.vue 8.9 KB

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