MyToDo.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. <template>
  2. <div id="home">
  3. <!-- 第一行 -->
  4. <a-row :gutter="24" class="topCard">
  5. <a-col :xs="24" :sm="24" :md="24" :lg="24" :style="{ marginBottom: '10px' }">
  6. <a-row :gutter="20">
  7. <!-- 用户信息 -->
  8. <a-col :xs="24" :sm="12" :md="12" :lg="7" :style="{ marginBottom: '10px' }">
  9. <a-card title="我的" :bordered="false" class="clearfix topColItem">
  10. <div class="userImg fl" style="marginLeft:50px;">
  11. <img src="../../assets/user.jpg" alt="" width="50px" />
  12. </div>
  13. <div class="userInfo fl">
  14. <span class="department">{{ userInfo.realname }}</span>
  15. <span>账号:{{ userInfo.username }}</span>
  16. <span class="telphone">Tel:{{ userInfo.telphone }}</span>
  17. </div>
  18. </a-card>
  19. </a-col>
  20. <!-- 消息 -->
  21. <a-col :xs="24" :sm="12" :md="12" :lg="7" :style="{ marginBottom: '10px' }">
  22. <a-card title="消息" :bordered="false" class="msgBox clearfix topColItem">
  23. <div class="fl" style="marginLeft:50px;">
  24. <span> {{ todoList.length }}</span>
  25. <p>我的待办</p>
  26. </div>
  27. <div class="fl" style="marginLeft:50px;">
  28. <span>{{ msgTotal }}</span>
  29. <p>系统消息</p>
  30. </div>
  31. </a-card>
  32. </a-col>
  33. <!-- 日历 -->
  34. <a-col :xs="24" :sm="24" :md="24" :lg="10">
  35. <a-card title="日历" :bordered="false">
  36. <div>
  37. <a-calendar :fullscreen="false" />
  38. </div>
  39. </a-card>
  40. </a-col>
  41. </a-row>
  42. </a-col>
  43. </a-row>
  44. <!-- OA 工作台 -->
  45. <a-row :gutter="24">
  46. <a-col :sm="24" :md="24" :xl="24" :style="{ marginBottom: '20px' }">
  47. <a-card title="OA工作台" :bordered="false">
  48. <a-row :gutter="24">
  49. <!-- 按钮图标 -->
  50. <a-col :sm="24" :md="12" :xl="2" v-for="(item, index) in activeKeyAll" :key="index">
  51. <a-card size="small" :bordered="false">
  52. <a-row :gutter="24">
  53. <a-col :sm="24" :md="24" :xl="24" style="margin-bottom:24px;text-align:center">
  54. <a @click.prevent="aClick(item)">
  55. <a-avatar shape="square" :size="64" :src="item.iconAddress" />
  56. </a>
  57. </a-col>
  58. <!-- 按钮文字 -->
  59. <a-col :sm="24" :md="24" :xl="24" style="margin-bottom:24px;text-align:center">
  60. <h4>{{ item.name }}</h4>
  61. </a-col>
  62. </a-row>
  63. </a-card>
  64. </a-col>
  65. </a-row>
  66. </a-card>
  67. </a-col>
  68. </a-row>
  69. <!-- 公告类 -->
  70. <a-row :gutter="24" class="news">
  71. <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" :style="{ marginBottom: '10px' }">
  72. <a-row :gutter="20">
  73. <!-- 企业公告 -->
  74. <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="10" :style="{ marginBottom: '10px' }">
  75. <a-card title="企业公告" :bordered="false" class="notice newsColItem">
  76. <ul class="clearfix">
  77. <li>
  78. <a href="https://m.thepaper.cn/baijiahao_14855630" class="clearfix">
  79. <span class="department fl">[人事]</span>
  80. <span class="info fl">王健林称万达高管全部换乘红旗汽车</span>
  81. <span class="time fr">2021-10-11</span>
  82. <span class="person fr">王健林</span>
  83. </a>
  84. </li>
  85. <li>
  86. <a href="https://baijiahao.baidu.com/s?id=1713375072968520817&wfr=spider&for=pc" class="clearfix">
  87. <span class="department fl">[运动]</span>
  88. <span class="info fl">德国成为首支晋级卡塔尔世界杯球队</span>
  89. <span class="time fr">2021-10-12</span>
  90. <span class="person fr">卡塔尔</span>
  91. </a>
  92. </li>
  93. <li>
  94. <a href="https://news.sina.cn/kx/2021-10-12/detail-iktzscyx9169344.d.html" class="clearfix">
  95. <span class="department fl">[财务]</span>
  96. <span class="info fl">浙江女子围观宰鸭后确诊鹦鹉热</span>
  97. <span class="time fr">2021-10-11</span>
  98. <span class="person fr">鹦鹉</span>
  99. </a>
  100. </li>
  101. <li>
  102. <a href="https://baijiahao.baidu.com/s?id=1713366904170468936&wfr=spider&for=pc" class="clearfix">
  103. <span class="department fl">[人事]</span>
  104. <span class="info fl">李铁:有没有自己的球迷是巨大区别</span>
  105. <span class="time fr">2021-10-11</span>
  106. <span class="person fr">李铁</span>
  107. </a>
  108. </li>
  109. <li>
  110. <a href="https://haokan.baidu.com/v?pd=wisenatural&vid=15789314381003157969" class="clearfix">
  111. <span class="department fl">[人事]</span>
  112. <span class="info fl">今年为什么会出现南旱北涝</span>
  113. <span class="time fr">2021-10-11</span>
  114. <span class="person fr">某某</span>
  115. </a>
  116. </li>
  117. </ul>
  118. </a-card>
  119. </a-col>
  120. <!-- 我的计划 -->
  121. <a-col :xs="24" :sm="14" :md="12" :lg="12" :xl="7" :style="{ marginBottom: '10px' }">
  122. <a-card title="我的计划" :bordered="false" class="plan newsColItem">
  123. <!-- 数据统计 -->
  124. <div class="total clearfix">
  125. <div class="left fl">
  126. <span>上月我的计划:<strong>0</strong>份</span>
  127. <span>我的计划:<strong>1</strong>份</span>
  128. <span>已阅计划:<strong>1</strong>份</span>
  129. </div>
  130. <div class="right fr">
  131. <span>上月他人计划:<strong>0</strong>份</span>
  132. <span>他人计划:<strong>2</strong>份</span>
  133. <span>已回计划:<strong>0</strong>份</span>
  134. </div>
  135. </div>
  136. <!-- 小链接跳转 -->
  137. <div class="tabsLinks">
  138. <a href="">我的计划</a>
  139. <a-divider type="vertical" />
  140. <a href="">计划管理</a>
  141. <a-divider type="vertical" />
  142. <a href="">计划模块</a>
  143. </div>
  144. </a-card>
  145. </a-col>
  146. <!-- 友情链接 -->
  147. <a-col :xs="24" :sm="10" :md="12" :lg="12" :xl="7">
  148. <a-card title="友情链接" :bordered="false" class="link newsColItem">
  149. <div class="linkBtn">
  150. <button><a href="https://www.yonyou.com/">用友</a></button>
  151. <button><a href="https://hc.yonyou.com/product.php?id=5">U8</a></button>
  152. <button><a href="http://www.dakabg.com/">哒咔办公</a></button>
  153. <button>
  154. <a href="https://www.dingtalk.com/?lwfrom=2017120202091367000000111&source=1001">钉钉</a>
  155. </button>
  156. <button><a href="https://www.11467.com/qiye/38026153.htm">品医</a></button>
  157. <button><a href="https://www.antgroup.com/">蚂蚁集团</a></button>
  158. </div>
  159. </a-card>
  160. </a-col>
  161. </a-row>
  162. </a-col>
  163. </a-row>
  164. <!-- 我的待办-->
  165. <a-row :gutter="24">
  166. <a-col :sm="24" :md="24" :xl="24" :style="{ marginBottom: '20px' }">
  167. <a-card title="我的待办" :bordered="false">
  168. <a-row :gutter="24">
  169. <a-col :sm="24" :md="24" :xl="24" :style="{ marginBottom: '10px' }">
  170. <a-table
  171. :scroll="scroll"
  172. bordered
  173. :loading="loading"
  174. rowKey="id"
  175. :dataSource="todoList"
  176. :pagination="ipagination"
  177. @change="handleTableChange"
  178. ref="table"
  179. size="small"
  180. >
  181. <a-table-column title="序号" :width="50" align="center">
  182. <template slot-scope="t, r, i">
  183. <span>{{ i + 1 }}</span>
  184. </template>
  185. </a-table-column>
  186. <a-table-column title="任务名称" data-index="name" :width="150" align="center">
  187. <template slot-scope="t">
  188. <span>{{ t }}</span>
  189. </template>
  190. </a-table-column>
  191. <a-table-column title="所属流程" data-index="processName" :width="150" align="center">
  192. <template slot-scope="t">
  193. <span>{{ t }}</span>
  194. </template>
  195. </a-table-column>
  196. <a-table-column title="委托代办人" data-index="owner" align="center" :width="150">
  197. <template slot-scope="t">
  198. <span>{{ t }}</span>
  199. </template>
  200. </a-table-column>
  201. <a-table-column title="流程发起人" data-index="applyer" :width="150" align="center">
  202. <template slot-scope="t">
  203. <span>{{ t }}</span>
  204. </template>
  205. </a-table-column>
  206. <a-table-column
  207. title="优先级"
  208. data-index="priority"
  209. :width="110"
  210. align="center"
  211. key="so"
  212. :sorter="(a, b) => a.priority - b.priority"
  213. >
  214. <template slot-scope="t">
  215. <span v-if="t == 0" style="color: green;">普通</span>
  216. <span v-else-if="t == 1" style="color: orange;">重要</span>
  217. <span v-else-if="t == 2" style="color: red;">紧急</span>
  218. <span v-else style="color: #999;">无</span>
  219. </template>
  220. </a-table-column>
  221. <a-table-column
  222. title="状态"
  223. data-index="isSuspended"
  224. :width="100"
  225. align="center"
  226. key="z"
  227. :sorter="(a, b) => (Boolean(a.isSuspended) ? 0 : 1 - Boolean(b.isSuspended) ? 0 : 1)"
  228. >
  229. <template slot-scope="t">
  230. <span v-if="!Boolean(t)" style="color: green;">已激活</span>
  231. <span v-if="Boolean(t)" style="color: orange;">已挂起</span>
  232. </template>
  233. </a-table-column>
  234. <a-table-column title="创建时间" data-index="createTime" :width="200" align="center">
  235. <template slot-scope="t">
  236. <span>{{ t }}</span>
  237. </template>
  238. </a-table-column>
  239. <a-table-column title="操作" data-index align="center" :width="100">
  240. <template slot-scope="t, r, i">
  241. <a href="javascript:void(0);" @click="toDealWith()" style="color: blue">去处理</a>
  242. </template>
  243. </a-table-column>
  244. </a-table>
  245. </a-col>
  246. </a-row>
  247. </a-card>
  248. </a-col>
  249. </a-row>
  250. <!-- 按钮弹框 -->
  251. <a-modal v-model="lcModal.visible" :title="lcModal.Title" :footer="null" :maskClosable="false" width="90%">
  252. <component
  253. :disabled="lcModal.disabled"
  254. v-if="lcModal.visible"
  255. :is="lcModal.formComponent"
  256. :processData="lcModal.processData"
  257. :isNew="lcModal.isNew"
  258. @afterSubmit="afterSub"
  259. @close=";(lcModal.visible = false), (lcModal.disabled = false)"
  260. >
  261. </component>
  262. </a-modal>
  263. </div>
  264. </template>
  265. <script>
  266. import { mapGetters } from 'vuex'
  267. import { getAction } from '@/api/manage'
  268. export default {
  269. name: 'Home',
  270. data() {
  271. return {
  272. userInfo: this.$store.getters.userInfo,
  273. todoList: [],
  274. activeKeyAll: [],
  275. msg1Count: '0',
  276. msg2Count: '0',
  277. url: {
  278. listCementByUser: '/sys/annountCement/listByUser'
  279. },
  280. //按钮弹框
  281. lcModal: {
  282. title: '',
  283. visible: false,
  284. disabled: false,
  285. formComponent: null,
  286. isNew: false
  287. },
  288. //
  289. data: [], // 表单数据
  290. total: 0, // 表单数据总数
  291. ipagination: {
  292. current: 1,
  293. pageSize: 3,
  294. pageSizeOptions: ['10', '20', '30'],
  295. showTotal: (total, range) => {
  296. return range[0] + '-' + range[1] + ' 共' + total + '条'
  297. },
  298. showQuickJumper: true,
  299. showSizeChanger: true,
  300. total: 0
  301. }
  302. }
  303. },
  304. created() {
  305. this.getDataList()
  306. this.getActiveKeyAll()
  307. },
  308. computed: {
  309. // 系统消息计算
  310. msgTotal() {
  311. return parseInt(this.msg1Count) + parseInt(this.msg2Count)
  312. },
  313. scroll: function() {
  314. var width = window.innerWidth
  315. // ant-table
  316. let $antTable = window.document.getElementsByClassName('ant-table')
  317. if ($antTable[0]) {
  318. width = $antTable[0].clientWidth
  319. }
  320. console.log('$antTable', $antTable)
  321. return {
  322. // x:'max-content',
  323. x: 1160,
  324. y: window.innerHeight / 2
  325. }
  326. },
  327. innerHeight: function() {
  328. var innerHeight = window.innerHeight
  329. return innerHeight
  330. }
  331. },
  332. mounted() {
  333. this.loadData()
  334. },
  335. methods: {
  336. loadData() {
  337. try {
  338. // 获取系统消息
  339. getAction(this.url.listCementByUser)
  340. .then(res => {
  341. if (res.success) {
  342. this.msg1Count = res.result.anntMsgTotal
  343. this.msg2Count = res.result.sysMsgTotal
  344. console.log(this.msg2Count)
  345. }
  346. })
  347. .catch(error => {
  348. console.log('系统消息通知异常', error) // 这行打印permissionName is undefined
  349. this.stopTimer = true
  350. console.log('清理timer')
  351. })
  352. } catch (err) {
  353. this.stopTimer = true
  354. console.log('通知异常', err)
  355. }
  356. },
  357. ...mapGetters(['nickname', 'avatar']),
  358. // 代办数据
  359. getDataList() {
  360. this.loading = true
  361. this.postFormAction('/actTask/todoList', {}).then(res => {
  362. this.loading = false
  363. if (res.success) {
  364. this.todoList = res.result || []
  365. console.log('首页 我的待办数字:', this.todoList.length)
  366. this.total = this.data.leading
  367. console.log(this.data)
  368. }
  369. })
  370. },
  371. // 获取 OA 按钮
  372. getActiveKeyAll() {
  373. this.postFormAction('/activiti_process/listData', { status: 1, roles: true }).then(res => {
  374. this.activeKeyAll = []
  375. if (res.success) {
  376. var result = res.result || []
  377. if (result.length > 0) {
  378. this.activeKeyAll = result
  379. // this.activeKeyAll.push.apply(this.activeKeyAll,result);
  380. // console.log(this.activeKeyAll)
  381. console.log('OA 4个按钮被渲染')
  382. }
  383. }
  384. })
  385. },
  386. //OA图标点击事件
  387. aClick(v) {
  388. //点击的该项按钮
  389. console.log(v)
  390. // this.$refs.modal.add("1")
  391. if (!v.routeName) {
  392. this.$message.warning('该流程信息未配置表单,请联系开发人员!')
  393. return
  394. }
  395. if (v.routeName.indexOf('外部表单') != -1) {
  396. alert('调用其他项目页面')
  397. } else if (v.routeName.indexOf('自定义') != -1) {
  398. this.lcModal.disabled = false
  399. let com = { component: () => import(`@/views/activiti/form/demoForm2`) }
  400. this.lcModal.formComponent = com.component
  401. this.lcModal.title = '发起流程:' + v.name
  402. this.lcModal.isNew = true
  403. this.lcModal.processData = v
  404. this.lcModal.visible = true
  405. } else {
  406. this.lcModal.disabled = false
  407. this.lcModal.formComponent = this.getFormComponent(v.routeName).component
  408. this.lcModal.title = '发起流程:' + v.name
  409. this.lcModal.isNew = true
  410. this.lcModal.processData = v
  411. this.lcModal.visible = true
  412. }
  413. console.log('发起', v)
  414. // this.getDataList()
  415. },
  416. //提交后
  417. afterSub(formData) {
  418. this.lcModal.visible = false
  419. },
  420. // 分页、排序、筛选变化时触发
  421. handleTableChange(pagination, filters, sorter) {
  422. if (Object.keys(sorter).length > 0) {
  423. this.isorter.column = sorter.field
  424. this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
  425. }
  426. this.ipagination = pagination
  427. // this.loadData();
  428. },
  429. // 去处理按钮
  430. toDealWith() {
  431. this.$router.push({ path: '/activiti/todoManage' })
  432. }
  433. }
  434. }
  435. </script>
  436. <style lang="less" scoped>
  437. ul li {
  438. list-style: none;
  439. }
  440. a {
  441. text-decoration: none;
  442. }
  443. .fl {
  444. float: left;
  445. }
  446. .fr {
  447. float: right;
  448. }
  449. /*清除浮动*/
  450. .clearfix:before,
  451. .clearfix:after {
  452. content: '';
  453. display: table;
  454. }
  455. .clearfix:after {
  456. clear: both;
  457. overflow: hidden;
  458. }
  459. .clearfix {
  460. *zoom: 1;
  461. }
  462. // 年月选择消失
  463. /deep/ .ant-fullcalendar-header {
  464. display: none;
  465. }
  466. // 线消息huode
  467. /deep/ .ant-fullcalendar {
  468. border-top: none;
  469. }
  470. /deep/ .ant-fullcalendar-calendar-body {
  471. padding: 0;
  472. }
  473. /deep/ .ant-card-head-title {
  474. text-shadow: 1px 1px 2px rgb(170, 169, 169);
  475. color: #1890ff;
  476. }
  477. #home {
  478. // 第一行
  479. .topCard {
  480. .topColItem {
  481. height: 360px;
  482. }
  483. .userImg {
  484. width: 80px;
  485. height: 80px;
  486. img {
  487. border-radius: 6px;
  488. width: 100%;
  489. }
  490. }
  491. .userInfo {
  492. span {
  493. margin-left: 60px;
  494. display: block;
  495. line-height: 26px;
  496. .department {
  497. font-size: 14px;
  498. color: rgb(71, 70, 70);
  499. }
  500. }
  501. }
  502. // 消息
  503. .msgBox {
  504. span {
  505. font-size: 38px;
  506. color: #fa6b5c;
  507. text-shadow: 2px 2px 1px rgb(94, 94, 94);
  508. }
  509. p {
  510. font-size: 16px;
  511. }
  512. }
  513. }
  514. // OA工作台
  515. .oaBtn {
  516. background-color: white;
  517. padding: 20px;
  518. margin-right: 1%;
  519. .oaButton {
  520. display: flex;
  521. flex-flow: row wrap;
  522. text-align: center;
  523. .oaItem {
  524. line-height: 0px;
  525. // width: 25%;
  526. width: calc((100% - 100px) / 3);
  527. justify-content: space-around;
  528. flex-direction: column;
  529. align-items: center;
  530. margin-bottom: 10px;
  531. margin-right: 1px;
  532. // 图
  533. span {
  534. margin: 0 aotu;
  535. border: transparent;
  536. display: flex;
  537. align-items: center;
  538. justify-content: center;
  539. position: relative;
  540. img {
  541. width: 34px;
  542. height: 34px;
  543. }
  544. }
  545. // 文字
  546. p {
  547. margin-top: 14px;
  548. font-size: 14px;
  549. color: rgb(128, 127, 127);
  550. font-weight: 400;
  551. letter-spacing: 1px;
  552. }
  553. }
  554. }
  555. }
  556. // 公告
  557. .news {
  558. .newsColItem {
  559. height: 300px;
  560. }
  561. .notice {
  562. ul {
  563. margin: 0;
  564. padding: 0;
  565. li {
  566. line-height: 30px;
  567. a {
  568. font-size: 14px;
  569. color: #444;
  570. .department {
  571. margin-right: 10px;
  572. }
  573. .person {
  574. color: #333;
  575. }
  576. .time {
  577. color: rgb(164, 164, 164);
  578. margin: 0 4px 0 10px;
  579. }
  580. }
  581. a:hover {
  582. color: #1890ff;
  583. }
  584. }
  585. }
  586. }
  587. // 我的计划
  588. .plan {
  589. .total {
  590. border-bottom: 1px dashed #ccc;
  591. span {
  592. display: block;
  593. line-height: 40px;
  594. strong {
  595. color: #fa6b5c;
  596. text-decoration: underline;
  597. margin-right: 4px;
  598. }
  599. }
  600. }
  601. .tabsLinks {
  602. margin-top: 20px;
  603. a {
  604. color: rgb(23, 119, 184);
  605. margin: 0 6px;
  606. }
  607. a:hover {
  608. color: #fa6b5c;
  609. }
  610. /deep/ .ant-divider,
  611. .ant-divider-vertical {
  612. width: 2px;
  613. background-color: rgb(200, 200, 200);
  614. }
  615. }
  616. }
  617. // 友情链接
  618. .link {
  619. .linkBtn {
  620. display: flex;
  621. flex-flow: row wrap;
  622. justify-content: space-between;
  623. button {
  624. border-radius: 2px;
  625. border: none;
  626. background-color: rgba(102, 155, 188, 0.7);
  627. width: calc((100% - 60px) / 2);
  628. display: flex;
  629. justify-content: center;
  630. align-items: center;
  631. margin-bottom: 10px;
  632. padding: 10px 0;
  633. letter-spacing: 1px;
  634. a {
  635. color: white;
  636. font-size: 12px;
  637. }
  638. }
  639. button:hover {
  640. background-color: #003049;
  641. color: white;
  642. box-shadow: 1px 1px 3px #333;
  643. }
  644. }
  645. }
  646. }
  647. }
  648. </style>