workbench.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-blue">
  4. <block slot="content"> 工作台</block>
  5. </cu-custom>
  6. <swiper class="screen-swiper square-dot bg-blue" :indicator-dots="true" :circular="true" :autoplay="true"
  7. interval="2000" duration="500">
  8. <swiper-item v-for="(item, index) in swiperList" :key="index">
  9. <image :src="item.url" mode="aspectFill" v-if="item.type == 'image'"></image>
  10. <video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover"
  11. v-if="item.type == 'video'"></video>
  12. </swiper-item>
  13. </swiper>
  14. <view class="cu-list grid col-4 no-border fixed">
  15. <view @tap="toTodoList" class="circle-button-box">
  16. <view class="cuIcon-time text-blue circle-button font-size-35"></view>
  17. <text>待办事项</text>
  18. </view>
  19. <view @tap="toHistoryList" class="circle-button-box">
  20. <view class="cuIcon-roundcheck text-blue circle-button font-size-35"></view>
  21. <text>已办事项</text>
  22. </view>
  23. <view @tap="toApplyList" class="circle-button-box">
  24. <view class="cuIcon-peoplelist text-blue circle-button font-size-35"></view>
  25. <text>我发起的</text>
  26. </view>
  27. <view @tap="toFlowCopyList" class="circle-button-box">
  28. <view class="cuIcon-copy text-blue circle-button font-size-35"></view>
  29. <text>抄送给我</text>
  30. </view>
  31. </view>
  32. <scroll-view scroll-y class="page" v-if="isAdmin">
  33. <template v-for="key in processMap.keys()">
  34. <view class="cu-bar bg-white solid-bottom margin-top">
  35. <view class="action">
  36. <text class=" text-orange font-b">{{ key }}</text>
  37. </view>
  38. </view>
  39. <view class="cu-list grid col-4 no-border">
  40. <view class="circle-button-box" @click="start(act)" v-for="(act, index) in processMap.get(key)"
  41. :key="index">
  42. <view class="cuIcon-calendar bg-blue text-white circle-button font-size-35"></view>
  43. <text class="ellipsis-description">{{ act.name }}</text>
  44. </view>
  45. </view>
  46. </template>
  47. <u-gap height="80" bgColor="#fff"></u-gap>
  48. </scroll-view>
  49. <scroll-view scroll-y class="page" v-else>
  50. <template v-for="key in processMap.keys()">
  51. <view class="cu-bar bg-white solid-bottom margin-top">
  52. <view class="action">
  53. <text class=" text-orange font-b">{{ key }}</text>
  54. </view>
  55. </view>
  56. <view class="cu-list grid col-4 no-border">
  57. <view class="circle-button-box" @click="start(act)" v-for="(act, index) in processMap.get(key)"
  58. :key="index">
  59. <view class="cuIcon-calendar bg-blue text-white circle-button font-size-35"></view>
  60. <text class="ellipsis-description">{{ act.name }}</text>
  61. </view>
  62. </view>
  63. </template>
  64. <u-gap height="80" bgColor="#fff"></u-gap>
  65. </scroll-view>
  66. </view>
  67. </template>
  68. <script>
  69. import userService from "@/api/sys/userService"
  70. import moment from 'moment'
  71. import { mapState, mapMutations, mapActions } from 'vuex'
  72. import actCategoryService from "@/api/flowable/actCategoryService"
  73. import processService from "@/api/flowable/processService"
  74. import taskService from "@/api/flowable/taskService"
  75. export default {
  76. data() {
  77. return {
  78. isAdmin: false,
  79. cardCur: 0,
  80. dataList: [],
  81. categoryList: [],
  82. processMap: new Map(),
  83. swiperList: [{
  84. id: 0,
  85. type: 'image',
  86. url: '/static/swiper/1.svg'
  87. }, {
  88. id: 1,
  89. type: 'image',
  90. url: '/static/swiper/2.svg'
  91. }, {
  92. id: 2,
  93. type: 'image',
  94. url: '/static/swiper/3.svg'
  95. }, {
  96. id: 3,
  97. type: 'image',
  98. url: '/static/swiper/4.svg'
  99. }, {
  100. id: 4,
  101. type: 'image',
  102. url: '/static/swiper/5.svg'
  103. }, {
  104. id: 5,
  105. type: 'image',
  106. url: '/static/swiper/6.svg'
  107. }, {
  108. id: 6,
  109. type: 'image',
  110. url: '/static/swiper/7.svg'
  111. }],
  112. dotStyle: false,
  113. towerStart: 0,
  114. direction: ''
  115. };
  116. },
  117. computed: mapState({
  118. username: (state) => state.user.username,
  119. userInfo: (state) => state.user.userInfo,
  120. }),
  121. async mounted() {
  122. let res = await actCategoryService.treeData()
  123. let data = await processService.list({ current: 1, size: -1, type: 'ydd' })
  124. this.processMap = new Map()
  125. let list = data.records
  126. let test = []
  127. let leaveTest = []
  128. let jjtTest = []
  129. let resignation = []
  130. let accounting = []
  131. console.log('list', list)
  132. list.forEach((item) => {
  133. if (item.category === '未设置') {
  134. if (item.name === '进销存-领用申请') {
  135. jjtTest.push(item)
  136. jjtTest.push({
  137. name: "入库",
  138. notFlowable: true
  139. })
  140. jjtTest.push({
  141. name: "库存",
  142. notFlowable: true
  143. })
  144. jjtTest.push({
  145. name: "入库记录",
  146. notFlowable: true
  147. })
  148. // this.processMap.set('物资管理', [item])
  149. }
  150. if (item.name === '物资管理-领用申请') {
  151. test.push(item)
  152. // this.processMap.set('物资管理', [item])
  153. }
  154. if (item.name === '物资管理-采购申请') {
  155. // console.log('item', item)
  156. // this.processMap.set('物资管理', [item])
  157. test.push(item)
  158. }
  159. if (item.name === '日常办公-请假申请') {
  160. // console.log('item', item)
  161. // this.processMap.set('物资管理', [item])
  162. leaveTest.push(item)
  163. }
  164. if (item.name === '会议室预约') {
  165. // console.log('item', item)
  166. // this.processMap.set('物资管理', [item])
  167. leaveTest.push(item)
  168. }
  169. /*if (item.name === '离职申请') {
  170. // console.log('item', item)
  171. // this.processMap.set('物资管理', [item])
  172. resignation.push(item)
  173. }
  174. if (item.name === '离职交接申请') {
  175. // console.log('item', item)
  176. // this.processMap.set('物资管理', [item])
  177. resignation.push(item)
  178. }*/
  179. if (item.name === '会计-报销审批') {
  180. // console.log('item', item)
  181. // this.processMap.set('物资管理', [item])
  182. accounting.push(item)
  183. }
  184. if (item.name === '会计-发票申请') {
  185. accounting.push(item)
  186. }
  187. }
  188. })
  189. if (this.userInfo.tenantDTO.id == "10009") {
  190. this.processMap.set('景聚庭', jjtTest)
  191. } else {
  192. this.processMap.set('物资管理', test)
  193. /*this.processMap.set('日常办公', leaveTest)
  194. this.processMap.set('人力资源管理', resignation)*/
  195. this.processMap.set('会计', accounting)
  196. }
  197. // if (this.isAdmin) {
  198. // //如果是管理员 查看所有的流程图信息
  199. // res.forEach((item)=>{
  200. // this.processMap.set(item.name, [])
  201. // })
  202. // let list = data.records
  203. // list.forEach((item)=>{
  204. // if(this.processMap.has(item.category)){
  205. // let list = this.processMap.get(item.category)
  206. // list.push(item)
  207. // }else{
  208. // this.processMap.set(item.category, [item])
  209. // }
  210. // })
  211. //
  212. // for(let [key,value] of this.processMap){
  213. // console.log(key,value);
  214. // }
  215. // } else {
  216. // //非管理员用户 只能查看物资领用 与 请假流程信息
  217. // let list = data.records
  218. // let test = []
  219. // console.log('list', list)
  220. // list.forEach((item)=>{
  221. // if (item.category === '未设置') {
  222. // if (item.name === '物资管理-领用申请') {
  223. // test.push(item)
  224. // // this.processMap.set('物资管理', [item])
  225. // }
  226. // if (item.name === '物资管理-采购申请') {
  227. // // console.log('item', item)
  228. // // this.processMap.set('物资管理', [item])
  229. // test.push(item)
  230. // }
  231. // }
  232. //
  233. // })
  234. // this.processMap.set('物资管理', test)
  235. // console.log('this.processMap', this.processMap)
  236. // }
  237. },
  238. created() {
  239. if (!this.username) {
  240. this.refreshUserInfo()
  241. }
  242. this.checkIsAdmin()
  243. },
  244. methods: {
  245. ...mapActions(['refreshUserInfo']),
  246. toApplyList(mail) {
  247. uni.navigateTo({
  248. url: '/pages/workbench/task/ApplyList'
  249. })
  250. },
  251. toTodoList(mail) {
  252. uni.navigateTo({
  253. url: '/pages/workbench/task/TodoList'
  254. })
  255. },
  256. toHistoryList(mail) {
  257. uni.navigateTo({
  258. url: '/pages/workbench/task/HistoryList'
  259. })
  260. },
  261. toFlowCopyList(mail) {
  262. uni.navigateTo({
  263. url: '/pages/workbench/task/FlowCopyList'
  264. })
  265. },
  266. start(row) {
  267. if (row.notFlowable) {
  268. switch (row.name) {
  269. case "入库":
  270. uni.navigateTo({
  271. url: '/pages/psiManagement/wareHouse/WareHouseAddForm'
  272. })
  273. break;
  274. case "库存":
  275. uni.navigateTo({
  276. url: '/pages/psiManagement/wareHouseSummary/WareHouseSummaryList'
  277. })
  278. break;
  279. case "入库记录":
  280. uni.navigateTo({
  281. url: '/pages/psiManagement/wareHouse/WareHouseList'
  282. })
  283. break;
  284. }
  285. } else {
  286. // 读取流程表单
  287. taskService.getTaskDef({
  288. procDefId: row.id,
  289. status: 'start'
  290. }).then((data) => {
  291. console.log('data', data)
  292. let processTitle = `${this.username} 在 ${moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [${row.name}]`
  293. let query = { procDefId: row.id, procDefKey: row.key, status: 'start', title: `发起流程【${row.name}】`, formType: data.formType, formUrl: data.formUrl, formTitle: processTitle }
  294. uni.navigateTo({
  295. url: '/pages/workbench/task/TaskForm?flow=' + JSON.stringify(query)
  296. })
  297. })
  298. }
  299. },
  300. // 查询当前用户是否是管理员用户
  301. checkIsAdmin() {
  302. userService.is().then((data) => {
  303. this.isAdmin = data
  304. })
  305. },
  306. }
  307. }
  308. </script>
  309. <style>
  310. .cu-list.card-menu {
  311. overflow: hidden;
  312. margin-right: 5px;
  313. margin-left: 5px;
  314. border-radius: 7px;
  315. }
  316. .cu-list.card-menu.margin-top-20 {
  317. margin-top: -20px;
  318. }
  319. .cu-list.menu>.cu-item .content>uni-view:first-child {
  320. display: -webkit-box;
  321. display: -webkit-flex;
  322. display: flex;
  323. -webkit-box-align: center;
  324. /* -webkit-align-items: center; */
  325. /* align-items: center; */
  326. display: inline-block;
  327. margin-right: 5px;
  328. width: 1.6em;
  329. text-align: center;
  330. }
  331. .font-size-35 {
  332. font-size: 35px !important;
  333. }
  334. .circle-button {
  335. width: 44px;
  336. height: 44px;
  337. border-radius: 18px;
  338. padding-top: 4px;
  339. }
  340. .circle-button-box {
  341. width: 25%;
  342. margin-top: 10px;
  343. display: -webkit-box;
  344. display: -webkit-flex;
  345. display: flex;
  346. -webkit-box-orient: vertical;
  347. -webkit-box-direction: normal;
  348. -webkit-flex-direction: column;
  349. flex-direction: column;
  350. -webkit-box-align: center;
  351. -webkit-align-items: center;
  352. align-items: center;
  353. -webkit-box-pack: center;
  354. -webkit-justify-content: center;
  355. justify-content: center;
  356. box-sizing: border-box;
  357. }
  358. .font-b {
  359. vertical-align: middle;
  360. font-size: 18px;
  361. font-weight: 500;
  362. color: #3a3a3a;
  363. }
  364. </style>