| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544 | 
							- <template>
 
- 	<view class="container">
 
- 		<!-- 顶部自定义导航栏 -->
 
- 		<cu-custom bgColor="bg-blue">
 
- 			<block slot="content"> 工作台</block>
 
- 		</cu-custom>
 
- 		<!-- 信息区域 -->
 
- 		<view class="col-1 no-border fixed" style="margin:5px 10px 5px 10px;">
 
- 			<view :style="dynamicStyle">
 
- 				<view class="col-1 no-border fixed" style="padding:20px 40px 20px 40px;">
 
- 					<!-- 个人信息 -->
 
- 					<view class="ellipsis-description" style="font-size: 16px">
 
- 							<span style="padding:5px;display: inline-block; width: 80px">
 
- 							  <span style="font-weight: bold">{{userInfo.roleNames}}</span>
 
- 							</span>
 
- 							<span style="padding-left: 30px;display: inline-block;">
 
- 							  <span class="cuIcon-locationfill" style="color: #FFFFFF;margin-right: 5px;"></span>
 
- 							  <span style="color: #FFFFFF;font-weight: bold">{{userInfo.officeDTO.name}}</span>
 
- 							</span>
 
- 					</view>
 
- 					<view class="ellipsis-description" style="font-size: 16px">
 
- 						<span style="padding:5px;display: inline-block; width: 80px">
 
- 						  	<span style="color: #FFFFFF;font-weight: bold">姓名</span>
 
- 						</span>
 
- 						<span style="padding-left: 30px;display: inline-block;">
 
- 						  	<span style="color: #FFFFFF;font-weight: bold">{{userInfo.name}}</span>
 
- 						</span>
 
- 					</view>
 
- 					<view class="ellipsis-description" style="font-size: 16px">
 
- 						<span style="padding:5px;display: inline-block; width: 80px">
 
- 						  	<span style="color: #FFFFFF;font-weight: bold">联系方式</span>
 
- 						</span>
 
- 						<span style="padding-left: 30px;display: inline-block;">
 
- 						  	<span style="color: #FFFFFF;font-weight: bold">{{userInfo.mobile}}</span>
 
- 						</span>
 
- 					</view>
 
- 				</view>
 
- 			</view>
 
- 		</view>
 
- 		<!-- 功能按钮区域 -->
 
- 		<view class="cu-list grid col-4 no-border fixed">
 
- 			<view @tap="toTodoList" class="circle-button-box">
 
- 				<view class="cuIcon-time text-blue circle-button font-size-35"></view>
 
- 				<text>待办事项</text>
 
- 			</view>
 
- 			<view @tap="toHistoryList" class="circle-button-box">
 
- 				<view class="cuIcon-roundcheck text-blue circle-button font-size-35"></view>
 
- 				<text>已办事项</text>
 
- 			</view>
 
- 			<view @tap="toApplyList" class="circle-button-box">
 
- 				<view class="cuIcon-peoplelist text-blue circle-button font-size-35"></view>
 
- 				<text>我发起的</text>
 
- 			</view>
 
- 			<view @tap="toFlowCopyList" class="circle-button-box">
 
- 				<view class="cuIcon-copy text-blue circle-button font-size-35"></view>
 
- 				<text>抄送给我</text>
 
- 			</view>
 
- 		</view>
 
- 		<!-- 标签切换区域 -->
 
- 		<view>
 
- 			<u-subsection
 
- 					:list="['待处理', '已处理']"
 
- 					mode="button"
 
- 					:fontSize="16"
 
- 					:current="tabIndex"
 
- 					@change="tabSelect"
 
- 			></u-subsection>
 
- 		</view>
 
- 		<!-- 过磅记录 -->
 
- 		<view style="margin: 11px 28px;">
 
- 			<view class="ellipsis-description" style="font-size: 20px">
 
-         <span style="margin-right: 10px;">
 
-           <span class="cuIcon-title" style="color: #f67e1f;margin-right: 5px;"></span>
 
-           <span v-if="userInfo.roleNames == '过磅专员' " style="font-weight: bold">过磅记录</span>
 
-           <span v-if="userInfo.roleNames == '村负责人' " style="font-weight: bold">清运记录</span>
 
-           <span v-if="userInfo.roleNames == '巡视员' " style="font-weight: bold">垃圾巡视</span>
 
-         </span>
 
- 			</view>
 
- 		</view>
 
- 		<!-- 可滚动内容区域 -->
 
- 		<scroll-view scroll-y class="page">
 
- 			<!-- 其他可滚动内容 -->
 
- 			<u-swipe-action>
 
- 				<view v-for="(row, index) in dataList" :key="index">
 
- 					<u-swipe-action-item @click="todo(row)" :key="row.id" :threshold="60" duration="500"
 
- 										 :options="[{ text: '办理', style: { backgroundColor: '#3c9cff' } }]">
 
- 						<u-cell-group>
 
- 							<u-cell @click="todo(row)">
 
- 								<view slot="title" class="content" style="line-height: 1.5;">
 
- 									<view class="text-bold text-grey">
 
- 										<view class="ellipsis-description" style="font-size: 16px">
 
-                       <span style="margin-right: 10px;">
 
-                         <span class="cuIcon-timefill" style="color: #3c9cff;margin-right: 5px;"></span>
 
-                         <span>08-20</span>
 
-                       </span>
 
- 											<span style="margin-right: 10px;">
 
-                         <span class="cuIcon-locationfill" style="color: #f67e1f;margin-right: 5px;"></span>
 
-                         <span>前进村</span>
 
-                       </span>
 
- 										</view>
 
- 									</view>
 
- 									<view class="text-grey text-sm" style="font-size: 16px">
 
- 										<div style="margin-right: 20px; float: left">
 
- 											<u-tag-small text="进行中" plain shape="circle" type="error"></u-tag-small>
 
- 										</div>
 
- 										<div style="margin-right: 10px; float: left">
 
- 											<span class="cuIcon-deliver" style="color: #d95141;margin-right: 5px;"></span>
 
- 											<span>12.5km</span>
 
- 										</div>
 
- 										<div style="margin-right: 10px;">
 
- 											<span class="cuIcon-deletefill" style="color: #38b64b;margin-right: 5px;"></span>
 
- 											<span>2.2t</span>
 
- 										</div>
 
- 									</view>
 
- 								</view>
 
- 								<view slot="right-icon" class="action">
 
- 									<u-tag text="处理" plain bgColor="#38b64b" color="white" plainFill shape="circle" type="success" @click="todo(row)"></u-tag>
 
- 								</view>
 
- 							</u-cell>
 
- 						</u-cell-group>
 
- 					</u-swipe-action-item>
 
- 				</view>
 
- 			</u-swipe-action>
 
- 			<!-- 加载更多 -->
 
- 			<u-loadmore :status="status" @loadmore="loadmore" :line="true" />
 
- 			<u-back-top :scrollTop="0" mode="square"></u-back-top>
 
- 		</scroll-view>
 
- 		<!-- 页脚区域 -->
 
- 		<view class="footer-div">
 
- 			<u-button v-if="userInfo.roleNames == '巡视员' " type="primary" text="巡视工单" @click="openPatrolWorkOrderForm()"></u-button>
 
- 			<u-button v-if="userInfo.roleNames == '村负责人' " type="primary" text="清运工单" @click="start()"></u-button>
 
- 		</view>
 
- 	</view>
 
- </template>
 
- <style scoped>
 
- 	.container {
 
- 		display: flex;
 
- 		flex-direction: column;
 
- 		height: 100vh;
 
- 		position: relative; /* 为 footer-div 提供定位上下文 */
 
- 	}
 
- 	.page {
 
- 		flex: 1;
 
- 		padding-bottom: 130px; /* 留出空间给 footer-div 和额外的 20px 间距 */
 
- 		overflow-y: auto;
 
- 	}
 
- 	.footer-div {
 
- 		height: 50px; /* 页脚高度 */
 
- 		text-align: center;
 
- 		line-height: 50px; /* 垂直居中内容 */
 
- 		position: fixed; /* 固定在视口底部 */
 
- 		bottom: 70px; /* 距离底部 100px */
 
- 		left: 0;
 
- 		width: 100%;
 
- 	}
 
- </style>
 
- <script>
 
- 	import userSelect from '@/components/user-select/user-select.vue'
 
- 	import pick from 'lodash.pick'
 
- 	import moment from 'moment'
 
- 	import {mapState, mapMutations, mapActions} from 'vuex'
 
- 	import actCategoryService from "@/api/flowable/actCategoryService"
 
- 	import processService from "@/api/flowable/processService"
 
- 	import taskService from "@/api/flowable/taskService"
 
- 	import notifyService from "@/api/notify/notifyService";
 
- 	import userService from "@/api/sys/userService"
 
- 	import { EventBus } from '@/store/eventBus.js';
 
- 	export default {
 
- 		components:{
 
- 			userSelect
 
- 		},
 
- 		data() {
 
- 			return {
 
- 				tabIndex: 0,
 
- 				status: 'loadmore',
 
- 				searchForm: {
 
- 					title: ''
 
- 				},
 
- 				sprocessForm: {
 
- 					filterText: ''
 
- 				},
 
- 				tablePage: {
 
- 					pages: 0,
 
- 					currentPage: 0,
 
- 					pageSize: 10,
 
- 					orders: [{ column: "a.create_time", asc: false }],
 
- 				},
 
- 				loading: false,
 
- 				cardCur: 0,
 
- 				dataList: [],
 
- 				categoryList: [],
 
- 				processMap: new Map(),
 
- 				swiperList: [/*{
 
- 					id: 0,
 
- 					type: 'image',
 
- 					url: '/static/swiper/1.svg'
 
- 				}, {
 
- 					id: 1,
 
- 					type: 'image',
 
- 					url: '/static/swiper/2.svg'
 
- 				}, {
 
- 					id: 2,
 
- 					type: 'image',
 
- 					url: '/static/swiper/3.svg'
 
- 				}, {
 
- 					id: 3,
 
- 					type: 'image',
 
- 					url: '/static/swiper/4.svg'
 
- 				}, {
 
- 					id: 4,
 
- 					type: 'image',
 
- 					url: '/static/swiper/5.svg'
 
- 				}, {
 
- 					id: 5,
 
- 					type: 'image',
 
- 					url: '/static/swiper/6.svg'
 
- 				}, {
 
- 					id: 6,
 
- 					type: 'image',
 
- 					url: '/static/swiper/7.svg'
 
- 				}*/],
 
- 				dotStyle: false,
 
- 				towerStart: 0,
 
- 				direction: ''
 
- 			};
 
- 		},
 
- 		onLoad() {
 
- 			console.log('onLoad')
 
- 			this.loadmore()
 
- 		},
 
- 		computed:{
 
- 			...mapState({
 
- 				username: (state) => state.user.username,
 
- 				userInfo: (state) => state.user.userInfo,
 
- 				userId: (state) => state.user.id
 
- 			}),
 
- 			dynamicStyle() {
 
- 				// 增加空值检查
 
- 				if (!this.userInfo || !this.userInfo.roleNames) {
 
- 					// 如果 userInfo 或 roleNames 不存在,返回一个默认样式
 
- 					return {
 
- 						height: '130px',
 
- 						borderRadius: '15px',
 
- 						backgroundImage: 'linear-gradient(to right, #3cb54b 0%, #88c546 100%)'
 
- 					};
 
- 				}
 
- 				// 直接通过 this.userInfo 访问 userInfo 中的属性
 
- 				// 如果 userInfo 存在,继续执行原来的逻辑
 
- 				const roleNames = this.userInfo.roleNames;
 
- 				// 根据从 Vuex 获取的状态来判断样式
 
- 				switch (roleNames) {
 
- 					case '过磅专员':
 
- 						return {
 
- 							height: '130px',
 
- 							borderRadius: '15px',
 
- 							backgroundImage: 'linear-gradient(to right, #3cb54b 0%, #88c546 100%)'
 
- 						};
 
- 					case '村负责人':
 
- 						return {
 
- 							height: '130px',
 
- 							borderRadius: '15px',
 
- 							backgroundImage: 'linear-gradient(to right, #0285f7 0%, #19b3bd 100%)'
 
- 						};
 
- 					case '巡视员':
 
- 					case '镇巡视员':
 
- 						return {
 
- 							height: '130px',
 
- 							borderRadius: '15px',
 
- 							backgroundImage: 'linear-gradient(to right, #fd8e03 0%, #f02d1f 100%)'
 
- 						};
 
- 					default:
 
- 						return {
 
- 							height: '130px',
 
- 							borderRadius: '15px',
 
- 							backgroundImage: 'linear-gradient(to right, #3cb54b 0%, #88c546 100%)'
 
- 						};
 
- 				}
 
- 			},
 
- 		},
 
- 		async mounted() {
 
- 			this.loadmore()
 
- 			//获取当前人对应的负责流程的信息
 
- 			this.fetchUserInfo(); // 模拟获取用户信息
 
- 			/*let res = await actCategoryService.treeData()
 
- 			let data = await processService.list({current: 1, size: -1})
 
- 			this.processMap = new Map()
 
- 			res.forEach((item)=>{
 
- 				this.processMap.set(item.name, [])
 
- 			})
 
- 			let list = data.records
 
- 			list.forEach((item)=>{
 
- 				if(this.processMap.has(item.category)){
 
- 					let list = this.processMap.get(item.category)
 
- 					list.push(item)
 
- 				}else{
 
- 					this.processMap.set(item.category, [item])
 
- 				}
 
- 			})
 
- 			for(let [key,value] of this.processMap){
 
- 			    console.log(key,value);
 
- 			}*/
 
- 		},
 
- 		created() {
 
- 			if(!this.username) {
 
- 				this.refreshUserInfo()
 
- 			}
 
- 		},
 
- 		methods: {
 
- 			async fetchUserInfo() {
 
- 				try {
 
- 					// 这里调用获取数据的 API 或者 Vuex action
 
- 					await this.$store.dispatch('fetchUserInfo');  // 示例
 
- 					this.isLoading = false;  // 数据加载完成,关闭加载状态
 
- 				} catch (error) {
 
- 					console.error('获取用户信息失败:', error);
 
- 					this.isLoading = false;  // 即使加载失败也需要关闭加载状态
 
- 				}
 
- 			},
 
- 			tabSelect(index) {
 
- 				this.tabIndex = index;
 
- 			},
 
- 			openPatrolWorkOrderForm () {
 
- 				uni.navigateTo({
 
- 					url: '/pages/edt/PatrolWorkOrderForm',
 
- 					//url: '/pages/test/mobile/TestMobileForm',
 
- 					success: function(res) {
 
- 						// 跳转成功后的处理
 
- 						console.log('跳转成功');
 
- 					},
 
- 					fail: function(err) {
 
- 						// 跳转失败后的处理
 
- 						console.log('跳转失败', err);
 
- 					},
 
- 					complete: function() {
 
- 						// 无论跳转成功还是失败都会执行
 
- 						console.log('跳转完成');
 
- 					}
 
- 				})
 
- 			},
 
- 			// 跳转到详细页面
 
- 			todo (row) {
 
- 				taskService.getTaskDef({
 
- 					taskId: row.task.id,
 
- 					taskName: row.task.name,
 
- 					taskDefKey: row.task.taskDefinitionKey,
 
- 					procInsId: row.task.processInstanceId,
 
- 					procDefId: row.task.processDefinitionId,
 
- 					procDefKey: row.task.processDefKey,
 
- 					status: row.status
 
- 				}).then((data) => {
 
- 					let query = {formTitle: `${row.vars.title}`, title: `审批【${row.task.name || ''}】`, ...pick(data, 'formType', 'formReadOnly', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')};
 
- 					uni.navigateTo({
 
- 						url: '/pages/workbench/task/TaskForm?flow='+JSON.stringify(query)
 
- 					})
 
- 				})
 
- 			},
 
- 			// 输入监听
 
- 			inputWord(e){
 
- 				this.searchTimer && clearTimeout(this.searchTimer)
 
- 				this.searchTimer = setTimeout(()=>{
 
- 					this.doSearch()
 
- 				},300)
 
- 			},
 
- 			// 搜索
 
- 			doSearch(){
 
- 				this.dataList = [];
 
- 				this.tablePage.currentPage = 0;
 
- 				this.tablePage.pageSize = 10;
 
- 				this.tablePage.pages = 0;
 
- 				this.loadmore()
 
- 			},
 
- 			onReachBottom() {
 
- 				this.loadmore()
 
- 			},
 
- 			loadmore() {
 
- 				if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
 
- 					this.status = 'nomore';
 
- 					return;
 
- 				}
 
- 				this.tablePage.currentPage = ++ this.tablePage.currentPage;
 
- 				//联网加载数据
 
- 				this.status = 'loading';
 
- 				taskService.todoList({
 
- 					current: this.tablePage.currentPage,
 
- 					size: this.tablePage.pageSize,
 
- 					orders: this.tablePage.orders,
 
- 					...this.searchForm
 
- 				}).then((data)=>{
 
- 					//追加新数据
 
- 					this.dataList=this.dataList.concat(data.records);
 
- 					this.tablePage.pages = data.pages;
 
- 					if(this.tablePage.pages <= this.tablePage.currentPage){
 
- 						this.status = 'nomore'
 
- 					} else {
 
- 						this.status = 'loadmore'
 
- 					}
 
- 				})
 
- 				notifyService.getUnreadCountByIsSelf({
 
- 					isSelf: true,
 
- 					...this.searchForm
 
- 				}).then((data)=>{
 
- 					EventBus.$emit('dataFromMessage', data); // 触发事件,传递参数
 
- 				})
 
- 			},
 
- 			...mapActions(['refreshUserInfo']),
 
- 			toApplyList (mail) {
 
- 				uni.navigateTo({
 
- 					url: '/pages/workbench/task/ApplyList'
 
- 				})
 
- 			},
 
- 			toTodoList (mail) {
 
- 				uni.navigateTo({
 
- 					url: '/pages/workbench/task/TodoList'
 
- 				})
 
- 			},
 
- 			toHistoryList (mail) {
 
- 				uni.navigateTo({
 
- 					url: '/pages/workbench/task/HistoryList'
 
- 				})
 
- 			},
 
- 			toFlowCopyList (mail) {
 
- 				uni.navigateTo({
 
- 					url: '/pages/workbench/task/FlowCopyList'
 
- 				})
 
- 			},
 
- 			async start () {
 
- 				var row = null;
 
- 				//根据当前人的权限获取对应的流程信息
 
- 				const roleNames = this.userInfo.roleNames;
 
- 				// 根据从 Vuex 获取的状态来判断样式
 
- 				switch (roleNames) {
 
- 					case '村负责人':
 
- 						this.sprocessForm.filterText = '垃圾处理流程'
 
- 						//根据用户id查询流程id
 
- 						await taskService.getProcessDefIdByRoleName({
 
- 							filter: "processes",
 
- 							modelType: 0,
 
- 							...this.sprocessForm,
 
- 						}).then((data) => {
 
- 							row = data.records[0].procDef
 
- 						});
 
- 						break;
 
- 				}
 
- 				// 读取流程表单
 
- 				taskService.getTaskDef({
 
- 					procDefId: row.id,
 
- 					status: 'start'
 
- 				}).then((data) => {
 
- 					console.log(data)
 
- 					let processTitle = `${this.username} 在 ${moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [${row.name}]`
 
- 					let query = {procDefId: row.id, procDefKey: row.key, status: 'start', title: `发起流程【${row.name}】`, formType: data.formType, formUrl: data.formUrl, formTitle: processTitle}
 
- 					uni.navigateTo({
 
- 						url: '/pages/workbench/task/TaskForm?flow='+JSON.stringify(query)
 
- 					})
 
- 				})
 
- 			}
 
- 		}
 
- 	}
 
- </script>
 
- <style>
 
- 	.cu-list.card-menu {
 
- 		overflow: hidden;
 
- 		margin-right: 5px;
 
- 		margin-left: 5px;
 
- 		border-radius: 7px;
 
- 	}
 
- 	.cu-list.card-menu.margin-top-20 {
 
- 		margin-top: -20px;
 
- 	}
 
- 	.cu-list.menu>.cu-item .content>uni-view:first-child {
 
- 		display: -webkit-box;
 
- 		display: -webkit-flex;
 
- 		display: flex;
 
- 		-webkit-box-align: center;
 
- 		/* -webkit-align-items: center; */
 
- 		/* align-items: center; */
 
- 		display: inline-block;
 
- 		margin-right: 5px;
 
- 		width: 1.6em;
 
- 		text-align: center;
 
- 	}
 
- 	.font-size-35{
 
- 		font-size: 35px!important;
 
- 	}
 
- 	.circle-button{
 
- 		width: 44px;
 
- 		height: 44px;
 
- 		border-radius: 18px;
 
- 		padding-top: 4px;
 
- 	}
 
- 	.circle-button-box{
 
- 		width: 25%;
 
- 		margin-top: 10px;
 
- 		display: -webkit-box;
 
- 		display: -webkit-flex;
 
- 		display: flex;
 
- 		-webkit-box-orient: vertical;
 
- 		-webkit-box-direction: normal;
 
- 		-webkit-flex-direction: column;
 
- 		flex-direction: column;
 
- 		-webkit-box-align: center;
 
- 		-webkit-align-items: center;
 
- 		align-items: center;
 
- 		-webkit-box-pack: center;
 
- 		-webkit-justify-content: center;
 
- 		justify-content: center;
 
- 		box-sizing: border-box;
 
- 	}
 
- 	.font-b {
 
- 		vertical-align: middle;
 
- 		font-size: 18px;
 
- 		font-weight: 500;
 
- 		color: #3a3a3a;
 
- 	}
 
- </style>
 
 
  |