workbench.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  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="dynamicStyle">
  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">{{userInfo.roleNames}}</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">{{userInfo.officeDTO.name}}</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">{{userInfo.name}}</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">{{userInfo.mobile}}</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 v-if="userInfo.roleNames === '过磅专员' " style="font-weight: bold">过磅记录</span>
  75. <span v-if="userInfo.roleNames === '村负责人' " style="font-weight: bold">清运记录</span>
  76. <span v-if="userInfo.roleNames === '巡视员' || userInfo.roleNames === '乡镇巡查员' " style="font-weight: bold">垃圾巡视</span>
  77. <span v-if="userInfo.roleNames === '乡镇负责人' " style="font-weight: bold">清运记录</span>
  78. </span>
  79. </view>
  80. </view>
  81. <!-- 可滚动内容区域 -->
  82. <scroll-view scroll-y class="page">
  83. <!-- 其他可滚动内容 -->
  84. <u-swipe-action v-if="this.showType == 'task'">
  85. <view v-for="(row, index) in dataList" :key="index">
  86. <u-swipe-action-item @click="todo(row)" :key="row.id" :threshold="60" duration="500"
  87. :options="[{ text: '办理', style: { backgroundColor: '#3c9cff' } }]">
  88. <u-cell-group>
  89. <u-cell @click="todo(row)">
  90. <view slot="title" class="content" style="line-height: 1.5;">
  91. <view class="text-bold text-grey">
  92. <view class="ellipsis-description" style="font-size: 16px">
  93. <span style="margin-right: 10px;">
  94. <span class="cuIcon-timefill" style="color: #3c9cff;margin-right: 5px;"></span>
  95. <span>{{row.vars.startDate}}</span>
  96. </span>
  97. <span style="margin-right: 10px;">
  98. <span class="cuIcon-locationfill" style="color: #f67e1f;margin-right: 5px;"></span>
  99. <span>{{row.vars.title}}</span>
  100. </span>
  101. </view>
  102. </view>
  103. <view class="text-grey text-sm" style="font-size: 16px">
  104. <div style="margin-right: 20px; float: left">
  105. <u-tag-small text="进行中" plain shape="circle" type="error"></u-tag-small>
  106. </div>
  107. <div style="margin-right: 10px; float: left">
  108. <!--<span class="cuIcon-deliver" style="color: #d95141;margin-right: 5px;"></span>
  109. <span>12.5km</span>-->
  110. </div>
  111. <div style="margin-right: 10px;">
  112. <!--<span class="cuIcon-deletefill" style="color: #38b64b;margin-right: 5px;"></span>
  113. <span>2.2t</span>-->
  114. </div>
  115. </view>
  116. </view>
  117. <view slot="right-icon" class="action">
  118. <u-tag text="处理" plain bgColor="#38b64b" color="white" plainFill shape="circle" type="success" @click="todo(row)"></u-tag>
  119. </view>
  120. </u-cell>
  121. </u-cell-group>
  122. </u-swipe-action-item>
  123. </view>
  124. <!-- 加载更多 -->
  125. <u-loadmore :status="status" @loadmore="loadmore" :line="true" />
  126. </u-swipe-action>
  127. <u-swipe-action v-else>
  128. <view v-for="(row, index) in dataList" :key="index">
  129. <u-swipe-action-item @click="toDetail(row)" :key="row.id" :threshold="60" duration="500"
  130. :options="[{ text: '办理', style: { backgroundColor: '#3c9cff' } }]">
  131. <u-cell-group>
  132. <u-cell @click="toDetail(row)">
  133. <view slot="title" class="content" style="line-height: 1.5;">
  134. <view class="text-bold text-grey">
  135. <view class="ellipsis-description" style="font-size: 16px">
  136. <span style="margin-right: 10px;">
  137. <span class="cuIcon-timefill" style="color: #3c9cff;margin-right: 5px;"></span>
  138. <span>{{row.vars.startDate}}</span>
  139. </span>
  140. <span style="margin-right: 10px;">
  141. <span class="cuIcon-locationfill" style="color: #f67e1f;margin-right: 5px;"></span>
  142. <span>{{row.vars.title}}</span>
  143. </span>
  144. </view>
  145. </view>
  146. <view class="text-grey text-sm" style="font-size: 16px">
  147. <div style="margin-right: 20px; float: left" v-if="row.status === '2'">
  148. <u-tag-small text="进行中" plain shape="circle" type="error"></u-tag-small>
  149. </div>
  150. <div style="margin-right: 20px; float: left" v-else>
  151. <u-tag-small text="已处理" plain shape="circle" type="error"></u-tag-small>
  152. </div>
  153. <div style="margin-right: 10px; float: left" v-if="row.transportMileage">
  154. <span class="cuIcon-deliver" style="color: #d95141;margin-right: 5px;"></span>
  155. <span>{{row.transportMileage}}km</span>
  156. </div>
  157. <div style="margin-right: 10px;" v-if="row.weight">
  158. <span class="cuIcon-deletefill" style="color: #38b64b;margin-right: 5px;"></span>
  159. <span>{{row.weight}}t</span>
  160. </div>
  161. </view>
  162. </view>
  163. <view slot="right-icon" class="action">
  164. <u-tag text="详情" plain bgColor="#38b64b" color="white" plainFill shape="circle" type="success" @click="toDetail(row)"></u-tag>
  165. </view>
  166. </u-cell>
  167. </u-cell-group>
  168. </u-swipe-action-item>
  169. </view>
  170. <!-- 加载更多 -->
  171. <u-loadmore :status="status" @loadmore="haveDone" :line="true" />
  172. </u-swipe-action>
  173. <u-back-top :scrollTop="0" mode="square"></u-back-top>
  174. </scroll-view>
  175. <!-- 页脚区域 -->
  176. <view class="footer-div">
  177. <!--<u-button v-if="userInfo.roleNames == '巡视员' || userInfo.roleNames == '乡镇巡查员' " type="primary" text="巡视工单" @click="openPatrolWorkOrderForm()"></u-button>-->
  178. <u-button v-if="userInfo.roleNames == '巡视员' || userInfo.roleNames == '乡镇巡查员' " type="primary" text="巡视工单" @click="start()"></u-button>
  179. <u-button v-if="userInfo.roleNames == '村负责人' " type="primary" text="清运工单" @click="start()"></u-button>
  180. </view>
  181. </view>
  182. </template>
  183. <style scoped>
  184. .container {
  185. display: flex;
  186. flex-direction: column;
  187. height: 100vh;
  188. position: relative; /* 为 footer-div 提供定位上下文 */
  189. }
  190. .page {
  191. flex: 1;
  192. padding-bottom: 130px; /* 留出空间给 footer-div 和额外的 20px 间距 */
  193. overflow-y: auto;
  194. }
  195. .footer-div {
  196. height: 50px; /* 页脚高度 */
  197. text-align: center;
  198. line-height: 50px; /* 垂直居中内容 */
  199. position: fixed; /* 固定在视口底部 */
  200. bottom: 70px; /* 距离底部 100px */
  201. left: 0;
  202. width: 100%;
  203. }
  204. </style>
  205. <script>
  206. import userSelect from '@/components/user-select/user-select.vue'
  207. import pick from 'lodash.pick'
  208. import moment from 'moment'
  209. import {mapState, mapMutations, mapActions} from 'vuex'
  210. import actCategoryService from "@/api/flowable/actCategoryService"
  211. import processService from "@/api/flowable/processService"
  212. import taskService from "@/api/flowable/taskService"
  213. import notifyService from "@/api/notify/notifyService";
  214. import userService from "@/api/sys/userService"
  215. import { EventBus } from '@/store/eventBus.js';
  216. import disposeRubbishService from '@/api/garbageClearance/disposeRubbishService'
  217. import flowCopyService from "@/api/flowable/flowCopyService"
  218. export default {
  219. components:{
  220. userSelect
  221. },
  222. data() {
  223. return {
  224. tabIndex: 0,
  225. showType: 'task',
  226. status: 'loadmore',
  227. searchForm: {
  228. title: '',
  229. procInsName: ''
  230. },
  231. sprocessForm: {
  232. filterText: ''
  233. },
  234. tablePage: {
  235. pages: 0,
  236. currentPage: 0,
  237. pageSize: 10,
  238. orders: [{ column: "a.create_time", asc: false }],
  239. },
  240. loading: false,
  241. cardCur: 0,
  242. dataList: [],
  243. categoryList: [],
  244. processMap: new Map(),
  245. swiperList: [/*{
  246. id: 0,
  247. type: 'image',
  248. url: '/static/swiper/1.svg'
  249. }, {
  250. id: 1,
  251. type: 'image',
  252. url: '/static/swiper/2.svg'
  253. }, {
  254. id: 2,
  255. type: 'image',
  256. url: '/static/swiper/3.svg'
  257. }, {
  258. id: 3,
  259. type: 'image',
  260. url: '/static/swiper/4.svg'
  261. }, {
  262. id: 4,
  263. type: 'image',
  264. url: '/static/swiper/5.svg'
  265. }, {
  266. id: 5,
  267. type: 'image',
  268. url: '/static/swiper/6.svg'
  269. }, {
  270. id: 6,
  271. type: 'image',
  272. url: '/static/swiper/7.svg'
  273. }*/],
  274. dotStyle: false,
  275. towerStart: 0,
  276. direction: ''
  277. };
  278. },
  279. onLoad() {
  280. this.loadmore()
  281. },
  282. onShow() {
  283. this.loadmore()
  284. },
  285. computed:{
  286. ...mapState({
  287. username: (state) => state.user.username,
  288. userInfo: (state) => state.user.userInfo,
  289. userId: (state) => state.user.id
  290. }),
  291. dynamicStyle() {
  292. // 增加空值检查
  293. if (!this.userInfo || !this.userInfo.roleNames) {
  294. // 如果 userInfo 或 roleNames 不存在,返回一个默认样式
  295. return {
  296. height: '130px',
  297. borderRadius: '15px',
  298. backgroundImage: 'linear-gradient(to right, #3cb54b 0%, #88c546 100%)'
  299. };
  300. }
  301. // 直接通过 this.userInfo 访问 userInfo 中的属性
  302. // 如果 userInfo 存在,继续执行原来的逻辑
  303. let roleNames = this.userInfo.roleNames;
  304. if(this.userInfo && this.userInfo.roleNames){
  305. roleNames = this.userInfo.roleNames;
  306. }
  307. // 根据从 Vuex 获取的状态来判断样式
  308. switch (roleNames) {
  309. case '过磅专员':
  310. return {
  311. height: '130px',
  312. borderRadius: '15px',
  313. backgroundImage: 'linear-gradient(to right, #3cb54b 0%, #88c546 100%)'
  314. };
  315. case '村负责人':
  316. case '乡镇负责人':
  317. return {
  318. height: '130px',
  319. borderRadius: '15px',
  320. backgroundImage: 'linear-gradient(to right, #0285f7 0%, #19b3bd 100%)'
  321. };
  322. case '巡视员':
  323. case '乡镇巡查员':
  324. return {
  325. height: '130px',
  326. borderRadius: '15px',
  327. backgroundImage: 'linear-gradient(to right, #fd8e03 0%, #f02d1f 100%)'
  328. };
  329. default:
  330. return {
  331. height: '130px',
  332. borderRadius: '15px',
  333. backgroundImage: 'linear-gradient(to right, #3cb54b 0%, #88c546 100%)'
  334. };
  335. }
  336. },
  337. },
  338. async mounted() {
  339. this.loadmore()
  340. //获取当前人对应的负责流程的信息
  341. this.fetchUserInfo(); // 模拟获取用户信息
  342. },
  343. created() {
  344. if(!this.username) {
  345. this.refreshUserInfo()
  346. }
  347. },
  348. methods: {
  349. async fetchUserInfo() {
  350. try {
  351. // 这里调用获取数据的 API 或者 Vuex action
  352. await this.$store.dispatch('fetchUserInfo'); // 示例
  353. this.isLoading = false; // 数据加载完成,关闭加载状态
  354. } catch (error) {
  355. console.error('获取用户信息失败:', error);
  356. this.isLoading = false; // 即使加载失败也需要关闭加载状态
  357. }
  358. },
  359. tabSelect(index) {
  360. this.tabIndex = index;
  361. this.tablePage.currentPage = 0
  362. if(1 === index){
  363. const roleNames = this.userInfo.roleNames;
  364. // 根据从 Vuex 获取的状态来判断样式
  365. if('村负责人' === roleNames){
  366. this.flowCopyShow()
  367. }else{
  368. this.haveDone()
  369. }
  370. }else {
  371. this.loadmore()
  372. }
  373. },
  374. openPatrolWorkOrderForm () {
  375. uni.navigateTo({
  376. url: '/pages/edt/PatrolWorkOrderForm',
  377. //url: '/pages/test/mobile/TestMobileForm',
  378. success: function(res) {
  379. // 跳转成功后的处理
  380. console.log('跳转成功');
  381. },
  382. fail: function(err) {
  383. // 跳转失败后的处理
  384. console.log('跳转失败', err);
  385. },
  386. complete: function() {
  387. // 无论跳转成功还是失败都会执行
  388. console.log('跳转完成');
  389. }
  390. })
  391. },
  392. // 跳转到详细页面
  393. todo (row) {
  394. taskService.getTaskDef({
  395. taskId: row.task.id,
  396. taskName: row.task.name,
  397. taskDefKey: row.task.taskDefinitionKey,
  398. procInsId: row.task.processInstanceId,
  399. procDefId: row.task.processDefinitionId,
  400. procDefKey: row.task.processDefKey,
  401. status: row.status
  402. }).then((data) => {
  403. let query = {formTitle: `${row.vars.title}`, title: `审批【${row.task.name || ''}】`, ...pick(data, 'formType', 'formReadOnly', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')};
  404. uni.navigateTo({
  405. url: '/pages/workbench/task/TaskForm?flow='+JSON.stringify(query)
  406. })
  407. })
  408. },
  409. // 跳转到详细页面
  410. toDetail (row) {
  411. console.log('row',row)
  412. taskService.getTaskDef({
  413. taskDefKey: row.taskDefinitionKey,
  414. procInsId: row.processInstanceId,
  415. procDefId: row.processDefinitionId
  416. }).then((data) => {
  417. let query = {readOnly: true, taskId: row.executionId, title: `${row.name}【${row.name}】`, formTitle: `${row.name}`, ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')}
  418. uni.navigateTo({
  419. url: '/pages/workbench/task/TaskFormDetail?flow='+JSON.stringify(query)
  420. })
  421. })
  422. },
  423. // 输入监听
  424. inputWord(e){
  425. this.searchTimer && clearTimeout(this.searchTimer)
  426. this.searchTimer = setTimeout(()=>{
  427. this.doSearch()
  428. },300)
  429. },
  430. // 搜索
  431. doSearch(){
  432. this.dataList = [];
  433. this.tablePage.currentPage = 0;
  434. this.tablePage.pageSize = 10;
  435. this.tablePage.pages = 0;
  436. this.loadmore()
  437. },
  438. onReachBottom() {
  439. this.loadmore()
  440. },
  441. loadmore() {
  442. /*if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
  443. this.status = 'nomore';
  444. return;
  445. }*/
  446. if(this.showType === 'history'){
  447. this.dataList = []
  448. this.showType = 'task'
  449. this.tablePage.currentPage = 0
  450. }
  451. this.tablePage.currentPage = ++ this.tablePage.currentPage;
  452. //联网加载数据
  453. this.status = 'loading';
  454. taskService.todoList({
  455. current: this.tablePage.currentPage,
  456. size: this.tablePage.pageSize,
  457. orders: this.tablePage.orders,
  458. ...this.searchForm
  459. }).then((data)=>{
  460. var idList = []
  461. for (const value of this.dataList) {
  462. idList.push(value.task.id)
  463. }
  464. for (const value of data.records) {
  465. if(!idList.includes(value.task.id)){
  466. this.dataList=this.dataList.concat(value);
  467. }
  468. }
  469. //追加新数据
  470. this.tablePage.pages = data.pages;
  471. if(this.tablePage.pages <= this.tablePage.currentPage){
  472. this.status = 'nomore'
  473. } else {
  474. this.status = 'loadmore'
  475. }
  476. if(this.showType === 'history'){
  477. this.dataList = []
  478. this.tablePage.currentPage = 0;
  479. this.haveDone()
  480. }
  481. })
  482. notifyService.getUnreadCountByIsSelf({
  483. isSelf: true,
  484. ...this.searchForm
  485. }).then((data)=>{
  486. EventBus.$emit('dataFromMessage', data); // 触发事件,传递参数
  487. })
  488. },
  489. //已办数据
  490. async haveDone() {
  491. if (this.showType === 'task') {
  492. this.dataList = [];
  493. this.showType = 'history';
  494. this.tablePage.currentPage = 0;
  495. }
  496. this.tablePage.currentPage++;
  497. this.status = 'loading';
  498. try {
  499. // 获取历史数据
  500. const data = await taskService.historicList({
  501. current: this.tablePage.currentPage,
  502. size: this.tablePage.pageSize,
  503. orders: this.tablePage.orders,
  504. ...this.searchForm
  505. });
  506. var procInsIdList = [];
  507. for (const value of data.records) {
  508. if ('垃圾处理流程' === value.processDefinitionName && '1' === value.vars.disposeType) {
  509. procInsIdList.push(value.processInstanceId);
  510. }
  511. }
  512. if (procInsIdList.length > 0) {
  513. const rubbishStationList = await disposeRubbishService.getByProcInsId(procInsIdList);
  514. for (const rubbishStation of rubbishStationList) {
  515. for (const value of data.records) {
  516. if (value.processInstanceId === rubbishStation.procInsId) {
  517. value.weight = rubbishStation.weight;
  518. value.transportMileage = rubbishStation.transportMileage;
  519. value.subsidy = rubbishStation.subsidy;
  520. value.status = rubbishStation.status;
  521. }
  522. }
  523. }
  524. }
  525. // 过滤重复数据
  526. this.dataList = [
  527. ...this.dataList,
  528. ...data.records.filter(record => !this.dataList.some(existingRecord => existingRecord.processInstanceId === record.processInstanceId))
  529. ];
  530. this.tablePage.pages = data.pages;
  531. this.status = this.tablePage.pages <= this.tablePage.currentPage ? 'nomore' : 'loadmore';
  532. if (this.showType === 'task') {
  533. this.dataList = [];
  534. this.tablePage.currentPage = 0;
  535. this.loadmore();
  536. }
  537. } catch (error) {
  538. console.error('Error loading data:', error);
  539. }
  540. try {
  541. // 获取未读通知数量
  542. const unreadCount = await notifyService.getUnreadCountByIsSelf({
  543. isSelf: true,
  544. ...this.searchForm
  545. });
  546. EventBus.$emit('dataFromMessage', unreadCount);
  547. } catch (error) {
  548. console.error('Error getting unread count:', error);
  549. }
  550. },
  551. //抄送数据
  552. async flowCopyShow() {
  553. if (this.showType === 'task') {
  554. this.dataList = [];
  555. this.showType = 'history';
  556. this.tablePage.currentPage = 0;
  557. }
  558. this.tablePage.currentPage++;
  559. this.status = 'loading';
  560. try {
  561. // 获取历史数据
  562. const data = await flowCopyService.list({
  563. current: this.tablePage.currentPage,
  564. size: this.tablePage.pageSize,
  565. orders: this.tablePage.orders,
  566. ...this.searchForm
  567. });
  568. var procInsIdList = [];
  569. for (const value of data.records) {
  570. procInsIdList.push(value.processInstanceId);
  571. }
  572. if (procInsIdList.length > 0) {
  573. const rubbishStationList = await disposeRubbishService.getByProcInsId(procInsIdList);
  574. for (const rubbishStation of rubbishStationList) {
  575. for (const value of data.records) {
  576. if (value.processInstanceId === rubbishStation.procInsId) {
  577. value.weight = rubbishStation.weight;
  578. value.transportMileage = rubbishStation.transportMileage;
  579. value.subsidy = rubbishStation.subsidy;
  580. value.status = rubbishStation.status;
  581. }
  582. }
  583. }
  584. }
  585. // 过滤重复数据
  586. const existingIds = new Set(this.dataList.map(record => record.processInstanceId));
  587. const newRecords = data.records.filter(record => !existingIds.has(record.processInstanceId));
  588. this.dataList = [...this.dataList, ...newRecords];
  589. this.tablePage.pages = data.pages;
  590. this.status = this.tablePage.pages <= this.tablePage.currentPage ? 'nomore' : 'loadmore';
  591. if (this.showType === 'task') {
  592. this.dataList = [];
  593. this.tablePage.currentPage = 0;
  594. this.loadmore();
  595. }
  596. } catch (error) {
  597. console.error('Error loading data:', error);
  598. }
  599. try {
  600. // 获取未读通知数量
  601. const unreadCount = await notifyService.getUnreadCountByIsSelf({
  602. isSelf: true,
  603. ...this.searchForm
  604. });
  605. EventBus.$emit('dataFromMessage', unreadCount);
  606. } catch (error) {
  607. console.error('Error getting unread count:', error);
  608. }
  609. },
  610. ...mapActions(['refreshUserInfo']),
  611. toApplyList (mail) {
  612. uni.navigateTo({
  613. url: '/pages/workbench/task/ApplyList'
  614. })
  615. },
  616. toTodoList (mail) {
  617. uni.navigateTo({
  618. url: '/pages/workbench/task/TodoList'
  619. })
  620. },
  621. toHistoryList (mail) {
  622. uni.navigateTo({
  623. url: '/pages/workbench/task/HistoryList'
  624. })
  625. },
  626. toFlowCopyList (mail) {
  627. uni.navigateTo({
  628. url: '/pages/workbench/task/FlowCopyList'
  629. })
  630. },
  631. async start () {
  632. var row = null;
  633. //根据当前人的权限获取对应的流程信息
  634. const roleNames = this.userInfo.roleNames;
  635. // 根据从 Vuex 获取的状态来判断样式
  636. switch (roleNames) {
  637. case '村负责人':
  638. this.sprocessForm.filterText = '垃圾处理流程'
  639. //根据用户id查询流程id
  640. await taskService.getProcessDefIdByRoleName({
  641. filter: "processes",
  642. modelType: 0,
  643. ...this.sprocessForm,
  644. }).then((data) => {
  645. row = data.records[0].procDef
  646. });
  647. break;
  648. case '巡视员':
  649. case '乡镇巡查员':
  650. this.sprocessForm.filterText = '巡视工单流程'
  651. //根据用户id查询流程id
  652. await taskService.getProcessDefIdByRoleName({
  653. filter: "processes",
  654. modelType: 0,
  655. ...this.sprocessForm,
  656. }).then((data) => {
  657. row = data.records[0].procDef
  658. });
  659. break;
  660. }
  661. // 读取流程表单
  662. taskService.getTaskDef({
  663. procDefId: row.id,
  664. status: 'start'
  665. }).then((data) => {
  666. let processTitle = `${this.userInfo.officeDTO.name} 在 ${moment(new Date()).format('MM-DD')} 发起了 [${row.name}]`
  667. let query = {procDefId: row.id, procDefKey: row.key, status: 'start', title: `发起流程【${row.name}】`, formType: data.formType, formUrl: data.formUrl, formTitle: processTitle}
  668. uni.navigateTo({
  669. url: '/pages/workbench/task/TaskForm?flow='+JSON.stringify(query)
  670. })
  671. })
  672. }
  673. }
  674. }
  675. </script>
  676. <style>
  677. .cu-list.card-menu {
  678. overflow: hidden;
  679. margin-right: 5px;
  680. margin-left: 5px;
  681. border-radius: 7px;
  682. }
  683. .cu-list.card-menu.margin-top-20 {
  684. margin-top: -20px;
  685. }
  686. .cu-list.menu>.cu-item .content>uni-view:first-child {
  687. display: -webkit-box;
  688. display: -webkit-flex;
  689. display: flex;
  690. -webkit-box-align: center;
  691. /* -webkit-align-items: center; */
  692. /* align-items: center; */
  693. display: inline-block;
  694. margin-right: 5px;
  695. width: 1.6em;
  696. text-align: center;
  697. }
  698. .font-size-35{
  699. font-size: 35px!important;
  700. }
  701. .circle-button{
  702. width: 44px;
  703. height: 44px;
  704. border-radius: 18px;
  705. padding-top: 4px;
  706. }
  707. .circle-button-box{
  708. width: 25%;
  709. margin-top: 10px;
  710. display: -webkit-box;
  711. display: -webkit-flex;
  712. display: flex;
  713. -webkit-box-orient: vertical;
  714. -webkit-box-direction: normal;
  715. -webkit-flex-direction: column;
  716. flex-direction: column;
  717. -webkit-box-align: center;
  718. -webkit-align-items: center;
  719. align-items: center;
  720. -webkit-box-pack: center;
  721. -webkit-justify-content: center;
  722. justify-content: center;
  723. box-sizing: border-box;
  724. }
  725. .font-b {
  726. vertical-align: middle;
  727. font-size: 18px;
  728. font-weight: 500;
  729. color: #3a3a3a;
  730. }
  731. </style>