workbench.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <view class="container">
  3. <!-- 顶部自定义导航栏 -->
  4. <cu-custom bgColor="bg-blue">
  5. <block slot="content"> 工作台</block>
  6. </cu-custom>
  7. <!-- 信息区域 -->
  8. <view class="col-1 no-border fixed" style="margin:5px 10px 5px 10px;">
  9. <view style="height:130px;border-radius: 15px;background-image: linear-gradient(to right, #3cb54b 0%, #88c546 100%);">
  10. <view class="col-1 no-border fixed" style="padding:20px 40px 20px 40px;">
  11. <!-- 个人信息 -->
  12. <view class="ellipsis-description" style="font-size: 16px">
  13. <span style="padding:5px;display: inline-block; width: 80px">
  14. <span style="font-weight: bold">过磅专员</span>
  15. </span>
  16. <span style="padding-left: 30px;display: inline-block;">
  17. <span class="cuIcon-locationfill" style="color: #FFFFFF;margin-right: 5px;"></span>
  18. <span style="color: #FFFFFF;font-weight: bold">前进村建筑垃圾清理处</span>
  19. </span>
  20. </view>
  21. <view class="ellipsis-description" style="font-size: 16px">
  22. <span style="padding:5px;display: inline-block; width: 80px">
  23. <span style="color: #FFFFFF;font-weight: bold">姓名</span>
  24. </span>
  25. <span style="padding-left: 30px;display: inline-block;">
  26. <span style="color: #FFFFFF;font-weight: bold">张红旗</span>
  27. </span>
  28. </view>
  29. <view class="ellipsis-description" style="font-size: 16px">
  30. <span style="padding:5px;display: inline-block; width: 80px">
  31. <span style="color: #FFFFFF;font-weight: bold">联系方式</span>
  32. </span>
  33. <span style="padding-left: 30px;display: inline-block;">
  34. <span style="color: #FFFFFF;font-weight: bold">13900000001</span>
  35. </span>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 功能按钮区域 -->
  41. <view class="cu-list grid col-4 no-border fixed">
  42. <view @tap="toTodoList" class="circle-button-box">
  43. <view class="cuIcon-time text-blue circle-button font-size-35"></view>
  44. <text>待办事项</text>
  45. </view>
  46. <view @tap="toHistoryList" class="circle-button-box">
  47. <view class="cuIcon-roundcheck text-blue circle-button font-size-35"></view>
  48. <text>已办事项</text>
  49. </view>
  50. <view @tap="toApplyList" class="circle-button-box">
  51. <view class="cuIcon-peoplelist text-blue circle-button font-size-35"></view>
  52. <text>我发起的</text>
  53. </view>
  54. <view @tap="toFlowCopyList" class="circle-button-box">
  55. <view class="cuIcon-copy text-blue circle-button font-size-35"></view>
  56. <text>抄送给我</text>
  57. </view>
  58. </view>
  59. <!-- 标签切换区域 -->
  60. <view>
  61. <u-subsection
  62. :list="['待处理', '已处理']"
  63. mode="button"
  64. :fontSize="16"
  65. :current="tabIndex"
  66. @change="tabSelect"
  67. ></u-subsection>
  68. </view>
  69. <!-- 过磅记录 -->
  70. <view style="margin: 11px 28px;">
  71. <view class="ellipsis-description" style="font-size: 20px">
  72. <span style="margin-right: 10px;">
  73. <span class="cuIcon-title" style="color: #f67e1f;margin-right: 5px;"></span>
  74. <span style="font-weight: bold">过磅记录</span>
  75. </span>
  76. </view>
  77. </view>
  78. <!-- 可滚动内容区域 -->
  79. <scroll-view scroll-y class="page">
  80. <!-- 其他可滚动内容 -->
  81. <u-swipe-action>
  82. <view v-for="(row, index) in dataList" :key="index">
  83. <u-swipe-action-item @click="todo(row)" :key="row.id" :threshold="60" duration="500"
  84. :options="[{ text: '办理', style: { backgroundColor: '#3c9cff' } }]">
  85. <u-cell-group>
  86. <u-cell @click="todo(row)">
  87. <view slot="title" class="content" style="line-height: 1.5;">
  88. <view class="text-bold text-grey">
  89. <view class="ellipsis-description" style="font-size: 16px">
  90. <span style="margin-right: 10px;">
  91. <span class="cuIcon-timefill" style="color: #3c9cff;margin-right: 5px;"></span>
  92. <span>08-20</span>
  93. </span>
  94. <span style="margin-right: 10px;">
  95. <span class="cuIcon-locationfill" style="color: #f67e1f;margin-right: 5px;"></span>
  96. <span>前进村</span>
  97. </span>
  98. </view>
  99. </view>
  100. <view class="text-grey text-sm" style="font-size: 16px">
  101. <div style="margin-right: 20px; float: left">
  102. <u-tag-small text="进行中" plain shape="circle" type="error"></u-tag-small>
  103. </div>
  104. <div style="margin-right: 10px; float: left">
  105. <span class="cuIcon-deliver" style="color: #d95141;margin-right: 5px;"></span>
  106. <span>12.5km</span>
  107. </div>
  108. <div style="margin-right: 10px;">
  109. <span class="cuIcon-deletefill" style="color: #38b64b;margin-right: 5px;"></span>
  110. <span>2.2t</span>
  111. </div>
  112. </view>
  113. </view>
  114. <view slot="right-icon" class="action">
  115. <u-tag text="处理" plain bgColor="#38b64b" color="white" plainFill shape="circle" type="success" @click="todo(row)"></u-tag>
  116. </view>
  117. </u-cell>
  118. </u-cell-group>
  119. </u-swipe-action-item>
  120. </view>
  121. </u-swipe-action>
  122. <!-- 加载更多 -->
  123. <u-loadmore :status="status" @loadmore="loadmore" :line="true" />
  124. <u-back-top :scrollTop="0" mode="square"></u-back-top>
  125. </scroll-view>
  126. <!-- 页脚区域 -->
  127. <view class="footer-div">
  128. <u-button type="primary" text="创建工单" @click="openPatrolWorkOrderForm()"></u-button>
  129. </view>
  130. </view>
  131. </template>
  132. <style scoped>
  133. .container {
  134. display: flex;
  135. flex-direction: column;
  136. height: 100vh;
  137. position: relative; /* 为 footer-div 提供定位上下文 */
  138. }
  139. .page {
  140. flex: 1;
  141. padding-bottom: 130px; /* 留出空间给 footer-div 和额外的 20px 间距 */
  142. overflow-y: auto;
  143. }
  144. .footer-div {
  145. height: 50px; /* 页脚高度 */
  146. text-align: center;
  147. line-height: 50px; /* 垂直居中内容 */
  148. position: fixed; /* 固定在视口底部 */
  149. bottom: 70px; /* 距离底部 100px */
  150. left: 0;
  151. width: 100%;
  152. }
  153. </style>
  154. <script>
  155. import userSelect from '@/components/user-select/user-select.vue'
  156. import pick from 'lodash.pick'
  157. import moment from 'moment'
  158. import {mapState, mapMutations, mapActions} from 'vuex'
  159. import actCategoryService from "@/api/flowable/actCategoryService"
  160. import processService from "@/api/flowable/processService"
  161. import taskService from "@/api/flowable/taskService"
  162. import notifyService from "@/api/notify/notifyService";
  163. import userService from "@/api/sys/userService"
  164. import { EventBus } from '@/store/eventBus.js';
  165. export default {
  166. components:{
  167. userSelect
  168. },
  169. data() {
  170. return {
  171. tabIndex: 0,
  172. status: 'loadmore',
  173. searchForm: {
  174. title: ''
  175. },
  176. tablePage: {
  177. pages: 0,
  178. currentPage: 0,
  179. pageSize: 10,
  180. orders: [{ column: "a.create_time", asc: false }],
  181. },
  182. loading: false,
  183. cardCur: 0,
  184. dataList: [],
  185. categoryList: [],
  186. processMap: new Map(),
  187. swiperList: [/*{
  188. id: 0,
  189. type: 'image',
  190. url: '/static/swiper/1.svg'
  191. }, {
  192. id: 1,
  193. type: 'image',
  194. url: '/static/swiper/2.svg'
  195. }, {
  196. id: 2,
  197. type: 'image',
  198. url: '/static/swiper/3.svg'
  199. }, {
  200. id: 3,
  201. type: 'image',
  202. url: '/static/swiper/4.svg'
  203. }, {
  204. id: 4,
  205. type: 'image',
  206. url: '/static/swiper/5.svg'
  207. }, {
  208. id: 5,
  209. type: 'image',
  210. url: '/static/swiper/6.svg'
  211. }, {
  212. id: 6,
  213. type: 'image',
  214. url: '/static/swiper/7.svg'
  215. }*/],
  216. dotStyle: false,
  217. towerStart: 0,
  218. direction: ''
  219. };
  220. },
  221. onLoad() {
  222. console.log('onLoad')
  223. this.loadmore()
  224. },
  225. computed: mapState({
  226. username: (state) => state.user.username,
  227. userId: (state) => state.user.id
  228. }),
  229. async mounted() {
  230. this.loadmore()
  231. //获取当前人对应的负责流程的信息
  232. /*let res = await actCategoryService.treeData()
  233. let data = await processService.list({current: 1, size: -1})
  234. this.processMap = new Map()
  235. res.forEach((item)=>{
  236. this.processMap.set(item.name, [])
  237. })
  238. let list = data.records
  239. list.forEach((item)=>{
  240. if(this.processMap.has(item.category)){
  241. let list = this.processMap.get(item.category)
  242. list.push(item)
  243. }else{
  244. this.processMap.set(item.category, [item])
  245. }
  246. })
  247. for(let [key,value] of this.processMap){
  248. console.log(key,value);
  249. }*/
  250. },
  251. created() {
  252. if(!this.username) {
  253. this.refreshUserInfo()
  254. }
  255. },
  256. methods: {
  257. tabSelect(index) {
  258. this.tabIndex = index;
  259. },
  260. openPatrolWorkOrderForm () {
  261. uni.navigateTo({
  262. url: '/pages/edt/PatrolWorkOrderForm',
  263. //url: '/pages/test/mobile/TestMobileForm',
  264. success: function(res) {
  265. // 跳转成功后的处理
  266. console.log('跳转成功');
  267. },
  268. fail: function(err) {
  269. // 跳转失败后的处理
  270. console.log('跳转失败', err);
  271. },
  272. complete: function() {
  273. // 无论跳转成功还是失败都会执行
  274. console.log('跳转完成');
  275. }
  276. })
  277. },
  278. // 跳转到详细页面
  279. todo (row) {
  280. taskService.getTaskDef({
  281. taskId: row.task.id,
  282. taskName: row.task.name,
  283. taskDefKey: row.task.taskDefinitionKey,
  284. procInsId: row.task.processInstanceId,
  285. procDefId: row.task.processDefinitionId,
  286. procDefKey: row.task.processDefKey,
  287. status: row.status
  288. }).then((data) => {
  289. let query = {formTitle: `${row.vars.title}`, title: `审批【${row.task.name || ''}】`, ...pick(data, 'formType', 'formReadOnly', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')};
  290. uni.navigateTo({
  291. url: '/pages/workbench/task/TaskForm?flow='+JSON.stringify(query)
  292. })
  293. })
  294. },
  295. // 输入监听
  296. inputWord(e){
  297. this.searchTimer && clearTimeout(this.searchTimer)
  298. this.searchTimer = setTimeout(()=>{
  299. this.doSearch()
  300. },300)
  301. },
  302. // 搜索
  303. doSearch(){
  304. this.dataList = [];
  305. this.tablePage.currentPage = 0;
  306. this.tablePage.pageSize = 10;
  307. this.tablePage.pages = 0;
  308. this.loadmore()
  309. },
  310. onReachBottom() {
  311. this.loadmore()
  312. },
  313. loadmore() {
  314. if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
  315. this.status = 'nomore';
  316. return;
  317. }
  318. this.tablePage.currentPage = ++ this.tablePage.currentPage;
  319. //联网加载数据
  320. this.status = 'loading';
  321. taskService.todoList({
  322. current: this.tablePage.currentPage,
  323. size: this.tablePage.pageSize,
  324. orders: this.tablePage.orders,
  325. ...this.searchForm
  326. }).then((data)=>{
  327. //追加新数据
  328. this.dataList=this.dataList.concat(data.records);
  329. this.tablePage.pages = data.pages;
  330. if(this.tablePage.pages <= this.tablePage.currentPage){
  331. this.status = 'nomore'
  332. } else {
  333. this.status = 'loadmore'
  334. }
  335. })
  336. notifyService.getUnreadCountByIsSelf({
  337. isSelf: true,
  338. ...this.searchForm
  339. }).then((data)=>{
  340. EventBus.$emit('dataFromMessage', data); // 触发事件,传递参数
  341. })
  342. },
  343. ...mapActions(['refreshUserInfo']),
  344. toApplyList (mail) {
  345. uni.navigateTo({
  346. url: '/pages/workbench/task/ApplyList'
  347. })
  348. },
  349. toTodoList (mail) {
  350. uni.navigateTo({
  351. url: '/pages/workbench/task/TodoList'
  352. })
  353. },
  354. toHistoryList (mail) {
  355. uni.navigateTo({
  356. url: '/pages/workbench/task/HistoryList'
  357. })
  358. },
  359. toFlowCopyList (mail) {
  360. uni.navigateTo({
  361. url: '/pages/workbench/task/FlowCopyList'
  362. })
  363. },
  364. start (row) {
  365. // 读取流程表单
  366. taskService.getTaskDef({
  367. procDefId: row.id,
  368. status: 'start'
  369. }).then((data) => {
  370. let processTitle = `${this.username} 在 ${moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [${row.name}]`
  371. let query = {procDefId: row.id, procDefKey: row.key, status: 'start', title: `发起流程【${row.name}】`, formType: data.formType, formUrl: data.formUrl, formTitle: processTitle}
  372. uni.navigateTo({
  373. url: '/pages/workbench/task/TaskForm?flow='+JSON.stringify(query)
  374. })
  375. })
  376. }
  377. }
  378. }
  379. </script>
  380. <style>
  381. .cu-list.card-menu {
  382. overflow: hidden;
  383. margin-right: 5px;
  384. margin-left: 5px;
  385. border-radius: 7px;
  386. }
  387. .cu-list.card-menu.margin-top-20 {
  388. margin-top: -20px;
  389. }
  390. .cu-list.menu>.cu-item .content>uni-view:first-child {
  391. display: -webkit-box;
  392. display: -webkit-flex;
  393. display: flex;
  394. -webkit-box-align: center;
  395. /* -webkit-align-items: center; */
  396. /* align-items: center; */
  397. display: inline-block;
  398. margin-right: 5px;
  399. width: 1.6em;
  400. text-align: center;
  401. }
  402. .font-size-35{
  403. font-size: 35px!important;
  404. }
  405. .circle-button{
  406. width: 44px;
  407. height: 44px;
  408. border-radius: 18px;
  409. padding-top: 4px;
  410. }
  411. .circle-button-box{
  412. width: 25%;
  413. margin-top: 10px;
  414. display: -webkit-box;
  415. display: -webkit-flex;
  416. display: flex;
  417. -webkit-box-orient: vertical;
  418. -webkit-box-direction: normal;
  419. -webkit-flex-direction: column;
  420. flex-direction: column;
  421. -webkit-box-align: center;
  422. -webkit-align-items: center;
  423. align-items: center;
  424. -webkit-box-pack: center;
  425. -webkit-justify-content: center;
  426. justify-content: center;
  427. box-sizing: border-box;
  428. }
  429. .font-b {
  430. vertical-align: middle;
  431. font-size: 18px;
  432. font-weight: 500;
  433. color: #3a3a3a;
  434. }
  435. </style>