Quellcode durchsuchen

工单处理移动端代码

user5 vor 7 Monaten
Ursprung
Commit
09e49ed47b

+ 21 - 0
api/flowable/taskService.js

@@ -142,5 +142,26 @@ export default {
 			method: 'get',
 			params: {procInsId: procInsId}
 		})
+	},
+	getProcessDefinitionIdByInstanceId (procInsId) {
+		return request({
+			url: `/flowable/task/getProcessDefinitionIdByInstanceId`,
+			method: 'get',
+			params: {procInsId: procInsId}
+		})
+	},
+	getHistoryProcessDefinitionIdByInstanceId (procInsId) {
+		return request({
+			url: `/flowable/task/getHistoryProcessDefinitionIdByInstanceId`,
+			method: 'get',
+			params: {procInsId: procInsId}
+		})
+	},
+	getProcessNameByInstanceId (procInsId) {
+		return request({
+			url: `/flowable/task/getProcessNameByInstanceId`,
+			method: 'get',
+			params: {procInsId: procInsId}
+		})
 	}
 };

+ 21 - 0
api/garbageClearance/disposeRubbishService.js

@@ -59,4 +59,25 @@ export default {
 
 		});
 	},
+	getDetailCollectByOfficeId: function (officeId) {
+		return request({
+			url: "/dispose/rubbish/getDetailCollectByOfficeId",
+			method: "get",
+			params: {officeId: officeId}
+		});
+	},
+	getDetailCollectByOfficeIdAndMonth: function (officeId,yearMonth) {
+		return request({
+			url: "/dispose/rubbish/getDetailCollectByOfficeIdAndMonth",
+			method: "get",
+			params: {officeId: officeId,yearMonth:yearMonth}
+		});
+	},
+	getByNo: function (no) {
+		return request({
+			url: "/dispose/rubbish/getByNo",
+			method: "get",
+			params: {no: no}
+		});
+	},
 };

+ 6 - 0
api/sys/officeService.js

@@ -40,4 +40,10 @@ export default {
 			params: params,
 		});
 	},
+	villageLevelList: function () {
+		return request({
+			url: "/sys/office/villageLevelList",
+			method: "get"
+		});
+	},
 };

+ 18 - 0
pages.json

@@ -176,6 +176,24 @@
 			"style" : {
 				"navigationBarTitleText": "建筑垃圾清运处理"
 			}
+		},
+		{
+			"path" : "pages/edt/TabulateStatisticsList",
+			"style" : {
+				"navigationBarTitleText": "垃圾清运数据汇总"
+			}
+		},
+		{
+			"path" : "pages/edt/TabulateStatisticsDetail",
+			"style" : {
+				"navigationBarTitleText": "垃圾清运数据详情"
+			}
+		},
+		{
+			"path" : "pages/edt/DisposeRubbishListDetail",
+			"style" : {
+				"navigationBarTitleText": "垃圾清运列表详情"
+			}
 		}
 	],
 	"subPackages": [{

+ 26 - 1
pages/edt/DisposeRubbishFormDetail.vue

@@ -1,6 +1,6 @@
 <template>
     <view>
-        <cu-custom :backUrl="'/pages/index/index?id=apps'" :isBack="true" bgColor="bg-gradual-blue">
+        <cu-custom @click="goBack" :isBack="true" bgColor="bg-gradual-blue">
             <block slot="content">建筑垃圾清运处理</block>
         </cu-custom>
 
@@ -232,6 +232,18 @@
             status: {
                 type: String,
                 default: ''
+            },
+            backUrl: {
+                type: String,
+                default: ''
+            },
+            isBack: {
+                type: Boolean,
+                default: false
+            },
+            bgColor: {
+                type: String,
+                default: ''
             }
         },
         watch: {
@@ -310,6 +322,19 @@
                 })
 
             },
+            goBack() {
+                if (this.backUrl) {
+                    // 如果提供了 backUrl,则使用 navigateTo 跳转到指定 URL
+                    uni.navigateTo({
+                        url: this.backUrl
+                    });
+                } else {
+                    // 否则,返回到上一层页面
+                    uni.navigateBack({
+                        delta: 1 // delta 默认为 1,表示返回到上一层
+                    });
+                }
+            }
         }
     }
 </script>

+ 178 - 0
pages/edt/DisposeRubbishListDetail.vue

@@ -0,0 +1,178 @@
+<template>
+	<view class="u-content">
+		<section style="margin-top: 1.5em; overflow-x: auto;">
+			<table style="min-width: 400px;" cellspacing="0" cellpadding="5">
+				<thead>
+				<tr>
+					<th colspan="4" style="text-align: center; font-size: 20px; font-weight: bold;">
+						清运列表
+					</th>
+				</tr>
+				<tr>
+					<th v-for="(header, index) in tableHeaders" :key="index">{{ header }}</th>
+				</tr>
+				</thead>
+				<tbody>
+				<tr v-for="(row, rowIndex) in tableData" :key="rowIndex" :style="rowIndex % 2 === 1 ? 'background-color: #f6f8fa;' : ''">
+					<td
+							v-for="(cell, cellIndex) in row"
+							:key="cellIndex"
+							align="center"
+							:style="cellIndex === 1 ? '' : ''"
+					>
+						<!-- 根据 cellIndex 来判断显示内容 -->
+						<template v-if="cellIndex === 0">
+							<a href="#" @click.prevent="handleLinkClick(cell)">{{ cell }}</a>
+						</template>
+						<template v-else>
+							{{ cell }}
+						</template>
+					</td>
+				</tr>
+				</tbody>
+			</table>
+		</section>
+	</view>
+</template>
+
+<script>
+	import disposeRubbishService from '@/api/garbageClearance/disposeRubbishService'
+	import taskService from "@/api/flowable/taskService"
+	import pick from "lodash.pick";
+
+	export default {
+		data() {
+			return {
+				id:'',
+				yearMonth:'',
+				// 表格的头部
+				tableHeaders: ["清运编号", "完成状态", "完成时间", "处理方式"],
+				// 表格的数据,二维数组表示每一行
+				tableData: []
+			};
+		},
+
+		onLoad(val) {
+			this.id = val.id;
+			this.yearMonth = val.yearMonth;
+			this.load();
+		},
+
+		methods: {
+			load() {
+				// 根据所属村落id将所有清运数据进行统计展示
+				disposeRubbishService.getDetailCollectByOfficeIdAndMonth(this.id,this.yearMonth).then((data) => {
+					this.tableData = data.map(item => [
+						item.no,
+						item.status,
+						item.auditPassDateStr,
+						item.disposeType
+					]);
+				}).catch(error => {
+					console.error('数据加载失败:', error);
+				});
+			},
+
+			async handleLinkClick(cell) {
+				try {
+
+					// 先根据编号查询具体信息
+					const dispose = await disposeRubbishService.getByNo(cell);
+
+					// 获取流程名称
+					let rowName = await taskService.getProcessNameByInstanceId(dispose.procInsId);
+
+					if (dispose.status === '5') {
+						// 如果流程状态为 '5',获取历史流程定义ID
+						const row = await taskService.getHistoryProcessDefinitionIdByInstanceId(dispose.procInsId);
+
+						const data = await taskService.getTaskDef({
+							taskDefKey: row.taskDefinitionKey,
+							procInsId: dispose.procInsId,
+							procDefId: row.processDefinitionId
+						});
+
+						// 构建导航所需的查询参数
+						let query = {
+							readOnly: true,
+							taskId: row.executionId,
+							title: `${rowName}【${rowName}】`,
+							formTitle: `${rowName}`,
+							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')
+						};
+
+						// 执行导航
+						uni.navigateTo({
+							url: '/pages/workbench/task/TaskFormDetail?flow=' + JSON.stringify(query)
+						});
+
+					} else {
+						// 如果流程状态不是 '5',获取当前的流程定义ID
+						const row = await taskService.getProcessDefinitionIdByInstanceId(dispose.procInsId);
+
+						const data = await taskService.getTaskDef({
+							taskDefKey: row.taskDefinitionKey,
+							procInsId: row.processInstanceId,
+							procDefId: row.processDefinitionId
+						});
+
+						// 构建导航所需的查询参数
+						let query = {
+							readOnly: true,
+							taskId: row.executionId,
+							title: `${rowName}【${rowName}】`,
+							formTitle: `${rowName}`,
+							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')
+						};
+
+						// 执行导航
+						uni.navigateTo({
+							url: '/pages/workbench/task/TaskFormDetail?flow=' + JSON.stringify(query)
+						});
+					}
+				} catch (error) {
+					console.error('数据加载失败:', error);
+				}
+			}
+		}
+	};
+</script>
+
+<style lang="scss">
+	.u-content {
+		padding: 24rpx;
+		font-size: 32rpx;
+		color: #333;
+		line-height: 1.6;
+	}
+	table {
+		box-sizing: border-box;
+		border-top: 1px solid #dfe2e5;
+		border-left: 1px solid #dfe2e5;
+	}
+	th {
+		border-right: 1px solid #dfe2e5;
+		border-bottom: 1px solid #dfe2e5;
+	}
+	td {
+		border-right: 1px solid #dfe2e5;
+		border-bottom: 1px solid #dfe2e5;
+	}
+	a {
+		color: rgb(41, 121, 255); /* 设置默认链接颜色 */
+		text-decoration: none; /* 可选: 去掉下划线 */
+		font-size: 16px; /* 设置所有链接的字体大小 */
+	}
+
+	a:hover {
+		color: rgb(41, 121, 255); /* 鼠标悬停时的颜色,与默认颜色一致 */
+	}
+
+	a:visited {
+		color: rgb(41, 121, 255); /* 已访问链接的颜色,与默认颜色一致 */
+	}
+
+	a:active {
+		color: rgb(41, 121, 255); /* 点击链接时的颜色,与默认颜色一致 */
+	}
+</style>

+ 133 - 0
pages/edt/TabulateStatisticsDetail.vue

@@ -0,0 +1,133 @@
+<template>
+	<view class="u-content">
+		<section style="margin-top: 1.5em; overflow-x: auto;">
+			<table style="min-width: 400px;" cellspacing="0" cellpadding="5">
+				<thead>
+				<tr>
+					<th colspan="4" style="text-align: center; font-size: 20px; font-weight: bold;">
+						清运汇总表
+					</th>
+				</tr>
+				<tr>
+					<th v-for="(header, index) in tableHeaders" :key="index">{{ header }}</th>
+				</tr>
+				</thead>
+				<tbody>
+				<tr v-for="(row, rowIndex) in tableData" :key="rowIndex" :style="rowIndex % 2 === 1 ? 'background-color: #f6f8fa;' : ''">
+					<td
+							v-for="(cell, cellIndex) in row"
+							:key="cellIndex"
+							align="center"
+							:style="cellIndex === 1 ? '' : ''"
+					>
+						<!-- 根据 cellIndex 来判断显示内容 -->
+						<template v-if="cellIndex === 0 && cell !== '汇总'">
+							<!--<u-link href="#" :text="cell" @click="handleLinkClick(cell)"></u-link>-->
+							<a href="#" @click.prevent="handleLinkClick(cell)">{{ cell }}</a>
+						</template>
+						<template v-else>
+							{{ cell }}
+						</template>
+					</td>
+				</tr>
+				</tbody>
+			</table>
+		</section>
+	</view>
+</template>
+
+<script>
+	import disposeRubbishService from '@/api/garbageClearance/disposeRubbishService'
+
+	export default {
+		data() {
+			return {
+				id:'',
+				// 表格的头部
+				tableHeaders: ["月份", "清运次数", "清运量(t)", "补贴(元)"],
+				// 表格的数据,二维数组表示每一行
+				tableData: []
+			};
+		},
+
+		onLoad(val) {
+			this.id = val.id;
+			this.load();
+		},
+
+		methods: {
+			load() {
+				// 根据所属村落id将所有清运数据进行统计展示
+				disposeRubbishService.getDetailCollectByOfficeId(this.id).then((data) => {
+					console.log(data);
+					this.tableData = data.map(item => [
+						item.createDateStr,
+						item.count,
+						item.weight,
+						item.subsidy
+					]);
+				}).catch(error => {
+					console.error('数据加载失败:', error);
+				});
+			},
+
+			handleLinkClick(cell) {
+				console.log('查看详情',cell)
+				uni.navigateTo({
+					url: `/pages/edt/DisposeRubbishListDetail?id=`+this.id + `&yearMonth=`+cell,
+					success: function(res) {
+						// 跳转成功后的处理
+						console.log('跳转成功');
+					},
+					fail: function(err) {
+						// 跳转失败后的处理
+						console.log('跳转失败', err);
+					},
+					complete: function() {
+						// 无论跳转成功还是失败都会执行
+						console.log('跳转完成');
+					}
+				})
+			}
+		}
+	};
+</script>
+
+<style lang="scss">
+	.u-content {
+		padding: 24rpx;
+		font-size: 32rpx;
+		color: #333;
+		line-height: 1.6;
+	}
+	table {
+		box-sizing: border-box;
+		border-top: 1px solid #dfe2e5;
+		border-left: 1px solid #dfe2e5;
+	}
+	th {
+		border-right: 1px solid #dfe2e5;
+		border-bottom: 1px solid #dfe2e5;
+	}
+	td {
+		border-right: 1px solid #dfe2e5;
+		border-bottom: 1px solid #dfe2e5;
+	}
+	a {
+		color: rgb(41, 121, 255); /* 设置默认链接颜色 */
+		text-decoration: none; /* 可选: 去掉下划线 */
+		font-size: 16px; /* 设置所有链接的字体大小 */
+	}
+
+	a:hover {
+		color: rgb(41, 121, 255); /* 鼠标悬停时的颜色,与默认颜色一致 */
+	}
+
+	a:visited {
+		color: rgb(41, 121, 255); /* 已访问链接的颜色,与默认颜色一致 */
+	}
+
+	a:active {
+		color: rgb(41, 121, 255); /* 点击链接时的颜色,与默认颜色一致 */
+	}
+</style>

+ 74 - 0
pages/edt/TabulateStatisticsList.vue

@@ -0,0 +1,74 @@
+<template>
+	<view>
+		<text class="u-demo-block__title" style="display: flex; align-items: center; justify-content: center; font-size: 20px; margin-top: 10px; font-weight: bold;">
+			各村垃圾清运汇总统计表
+		</text>
+		<u-divider
+				text=""
+				textColor="#2979ff"
+				lineColor="#2979ff"
+		></u-divider>
+
+		<u-list
+				@scrolltolower="loadmore"
+		>
+			<u-list-item
+					v-for="(item, index) in dataList"
+					:key="index"
+			>
+				<u-cell  @click="detail(item.id)"
+						:title="`${item.name}`"
+						:value="`详情>`"
+				>
+				</u-cell>
+			</u-list-item>
+		</u-list>
+	</view>
+</template>
+
+<script>
+	import officeService from "@/api/sys/officeService";
+	export default {
+		data() {
+			return {
+				status: 'loadmore',
+				searchForm: {
+					title: ''
+				},
+				dataList: [],
+				loading: false,
+			}
+		},created() {
+			this.loadmore()
+		},
+		methods: {
+			loadmore() {
+				//联网加载数据
+				this.status = 'loading';
+				officeService.villageLevelList().then((data)=>{
+					console.log('获取村级数据信息:',data)
+					//追加新数据
+					this.dataList=this.dataList.concat(data);
+				})
+			},
+			detail(id){
+				console.log('查看详情',id)
+				uni.navigateTo({
+					url: `/pages/edt/TabulateStatisticsDetail?id=${id}`,
+					success: function(res) {
+						// 跳转成功后的处理
+						console.log('跳转成功');
+					},
+					fail: function(err) {
+						// 跳转失败后的处理
+						console.log('跳转失败', err);
+					},
+					complete: function() {
+						// 无论跳转成功还是失败都会执行
+						console.log('跳转完成');
+					}
+				})
+			}
+		}
+	}
+</script>

+ 2 - 2
pages/login/login.vue

@@ -13,10 +13,10 @@
 						style="width: 50%;height: 90%;"
 				></image>
 			</view>
-			<view class="title">
+			<!--<view class="title">
 				<view style="background: linear-gradient(to bottom, #33bae3  0%, #1d6fb5  100%); -webkit-background-clip: text;color: transparent;"
 				>垃圾清运管理系统</view>
-			</view>
+			</view>-->
 			<view class="login-form">
 				<u--form :model="inputForm" labelWidth="100px"  labelPosition="left" :rules="rules" ref="uForm">
 						<u-form-item label="手机号" borderBottom prop="username">

+ 8 - 0
pages/user/person/person.vue

@@ -51,6 +51,14 @@
 			:iconStyle="{color: '#e54d42'}"
 		    url="/pages/user/setting/password/password"
 		></u-cell>-->
+		<u-cell
+				v-if="userInfo.roleNames === '乡镇负责人' "
+				title="数据汇总"
+				icon="file-text"
+				isLink
+				:iconStyle="{color: '#0081ff'}"
+				url="/pages/edt/TabulateStatisticsList"
+		></u-cell>
 	</u-cell-group>
 
 	<view class="padding-xl">

+ 35 - 25
pages/workbench/workbench.vue

@@ -75,9 +75,10 @@
 			<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 == '巡视员' || 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 v-if="userInfo.roleNames === '巡视员' || userInfo.roleNames === '乡镇巡查员' " style="font-weight: bold">垃圾巡视</span>
+          <span v-if="userInfo.roleNames === '乡镇负责人' " style="font-weight: bold">清运记录</span>
         </span>
 			</view>
 		</view>
@@ -331,6 +332,7 @@
 							backgroundImage: 'linear-gradient(to right, #3cb54b 0%, #88c546 100%)'
 						};
 					case '村负责人':
+					case '乡镇负责人':
 						return {
 							height: '130px',
 							borderRadius: '15px',
@@ -427,6 +429,7 @@
 			},
 			// 跳转到详细页面
 			toDetail (row) {
+				console.log('row',row)
 				taskService.getTaskDef({
 					taskDefKey: row.taskDefinitionKey,
 					procInsId: row.processInstanceId,
@@ -510,8 +513,7 @@
 			},
 			//已办数据
 			async haveDone() {
-
-				if(this.showType === 'task'){
+				if (this.showType === 'task') {
 					this.dataList = [];
 					this.showType = 'history';
 					this.tablePage.currentPage = 0;
@@ -528,18 +530,18 @@
 						...this.searchForm
 					});
 
-					// 使用 for...of 和 await 来处理异步操作
-					var procInsIdList = []
+					var procInsIdList = [];
 					for (const value of data.records) {
-						if('垃圾处理流程' === value.processDefinitionName && '1' === value.vars.disposeType ){
-							procInsIdList.push(value.processInstanceId)
+						if ('垃圾处理流程' === value.processDefinitionName && '1' === value.vars.disposeType) {
+							procInsIdList.push(value.processInstanceId);
 						}
 					}
-					if(procInsIdList){
+
+					if (procInsIdList.length > 0) {
 						const rubbishStationList = await disposeRubbishService.getByProcInsId(procInsIdList);
 						for (const rubbishStation of rubbishStationList) {
 							for (const value of data.records) {
-								if(value.processInstanceId === rubbishStation.procInsId){
+								if (value.processInstanceId === rubbishStation.procInsId) {
 									value.weight = rubbishStation.weight;
 									value.transportMileage = rubbishStation.transportMileage;
 									value.subsidy = rubbishStation.subsidy;
@@ -549,14 +551,18 @@
 						}
 					}
 
-					this.dataList = this.dataList.concat(data.records);
+					// 过滤重复数据
+					this.dataList = [
+						...this.dataList,
+						...data.records.filter(record => !this.dataList.some(existingRecord => existingRecord.processInstanceId === record.processInstanceId))
+					];
 					this.tablePage.pages = data.pages;
 					this.status = this.tablePage.pages <= this.tablePage.currentPage ? 'nomore' : 'loadmore';
 
-					if(this.showType === 'task'){
-						this.dataList = []
+					if (this.showType === 'task') {
+						this.dataList = [];
 						this.tablePage.currentPage = 0;
-						this.loadmore()
+						this.loadmore();
 					}
 				} catch (error) {
 					console.error('Error loading data:', error);
@@ -576,7 +582,7 @@
 			//抄送数据
 			async flowCopyShow() {
 
-				if(this.showType === 'task'){
+				if (this.showType === 'task') {
 					this.dataList = [];
 					this.showType = 'history';
 					this.tablePage.currentPage = 0;
@@ -593,16 +599,16 @@
 						...this.searchForm
 					});
 
-					// 使用 for...of 和 await 来处理异步操作
-					var procInsIdList = []
+					var procInsIdList = [];
 					for (const value of data.records) {
-						procInsIdList.push(value.processInstanceId)
+						procInsIdList.push(value.processInstanceId);
 					}
-					if(procInsIdList){
+
+					if (procInsIdList.length > 0) {
 						const rubbishStationList = await disposeRubbishService.getByProcInsId(procInsIdList);
 						for (const rubbishStation of rubbishStationList) {
 							for (const value of data.records) {
-								if(value.processInstanceId === rubbishStation.procInsId){
+								if (value.processInstanceId === rubbishStation.procInsId) {
 									value.weight = rubbishStation.weight;
 									value.transportMileage = rubbishStation.transportMileage;
 									value.subsidy = rubbishStation.subsidy;
@@ -612,14 +618,18 @@
 						}
 					}
 
-					this.dataList = this.dataList.concat(data.records);
+					// 过滤重复数据
+					const existingIds = new Set(this.dataList.map(record => record.processInstanceId));
+					const newRecords = data.records.filter(record => !existingIds.has(record.processInstanceId));
+					this.dataList = [...this.dataList, ...newRecords];
+
 					this.tablePage.pages = data.pages;
 					this.status = this.tablePage.pages <= this.tablePage.currentPage ? 'nomore' : 'loadmore';
 
-					if(this.showType === 'task'){
-						this.dataList = []
+					if (this.showType === 'task') {
+						this.dataList = [];
 						this.tablePage.currentPage = 0;
-						this.loadmore()
+						this.loadmore();
 					}
 				} catch (error) {
 					console.error('Error loading data:', error);

BIN
static/logintitle.png