Selaa lähdekoodia

工单处理移动端代码

user5 8 kuukautta sitten
vanhempi
commit
d45e11d407

+ 3 - 2
api/garbageClearance/disposeRubbishService.js

@@ -43,11 +43,12 @@ export default {
 			method: "get",
 		});
 	},
-	getByProcInsId: function (procInsId) {
+	getByProcInsId: function (procInsIdList) {
 		return request({
 			url: "/dispose/rubbish/getByProcInsId",
 			method: "get",
-			params: {procInsId: procInsId}
+			params: {procInsIds: procInsIdList.join(",")},
+
 		});
 	},
 };

+ 6 - 0
api/garbageClearance/overService.js

@@ -35,6 +35,12 @@ export default {
 			params: {officeId: officeId}
 		});
 	},
+	getOfficeOnHamlet: function () {
+		return request({
+			url: "/look/over/getOfficeOnHamlet",
+			method: "get"
+		});
+	},
 	queryById: function (id) {
 		return request({
 			url: "/look/over/queryById",

+ 22 - 4
pages/edt/PatrolWorkOrderForm.vue

@@ -13,7 +13,7 @@
                 </u-form-item>
 
                 <u-form-item label="处理单位" borderBottom prop="processingUnit" :required="true" v-if="!disFlag">
-                    <jp-picker v-model="inputForm.processingUnit" rangeKey="label" rangeValue="value" :range="processingUnits" @input="getUserInfoByOffId"></jp-picker>
+                    <jp-picker v-model="inputForm.processingUnit" rangeKey="label" rangeValue="value" :range="processingUnits" @input="getOfficeOnHamlet"></jp-picker>
                 </u-form-item>
 
                 <u-form-item label="处理单位" borderBottom prop="processingUnitName" :required="true" v-else-if="disFlag">
@@ -36,7 +36,7 @@
                 </u-form-item>
 
                 <u-form-item label="处理单位" borderBottom prop="processingUnit" :required="true" v-if="!disFlag">
-                    <jp-picker v-model="inputForm.processingUnit" rangeKey="label" rangeValue="value" :range="processingUnits" @input="getUserInfoByOffId"></jp-picker>
+                    <jp-picker v-model="inputForm.processingUnit" rangeKey="label" rangeValue="value" :range="processingUnits" @input="getOfficeOnHamlet"></jp-picker>
                 </u-form-item>
 
                 <u-form-item label="处理单位" borderBottom prop="processingUnitName" :required="true" v-else-if="disFlag">
@@ -210,6 +210,23 @@
         },
         // 页面加载时执行
         async created() {
+            if('乡镇巡查员' === this.userInfo.roleNames){
+                this.disFlag = false
+                // 不动态获取  根据当前登录人去查
+                await overService.getOfficeOnHamlet()
+                    .then(data => {
+                        this.processingUnits = []
+                        for (const value of data) {
+                            this.processingUnits.push({
+                                label: value.officeName,
+                                value: value.officeId
+                            });
+                        }
+                    })
+                    .catch(e => {
+                        throw e;
+                    });
+            }
             if(!this.nodeFlag){
                 let data = await overService.getMaxNo();
                 if (data) {
@@ -561,9 +578,10 @@
                     });
                 })
             },
-            getUserInfoByOffId(){
+            getOfficeOnHamlet(value){
+                console.log('getOfficeOnHamlet:',value)
                 // 根据组织ID 获取 该村的 村支书
-                overService.getUserInfoByOffId(this.inputForm.processingUnit)
+                overService.getUserInfoByOffId(value)
                     .then(data => {
                         this.inputForm.clearUserId = data.id
                         this.inputForm.clearUserName = data.name

+ 10 - 2
pages/message/message.vue

@@ -28,12 +28,12 @@
 									
 										<view class="text-gray text-sm">
 											<view class="ellipsis-description">
-												发布者:{{notify.createBy.name}}, {{notify.createTime}}
+												发布者:{{notify.createBy.name}}, 所属行政村:{{notify.createBy.officeDTO.name}}
 											</view>
 										</view>
 										<view class="text-sm">
 											<view class="ellipsis-description">
-												内容:{{notify.content}}
+												发布时间:{{notify.createTime}}
 											</view>
 										</view>
 								  </view>
@@ -76,6 +76,14 @@
 		created() {
 			this.loadmore()
 		},
+		onLoad() {
+			console.log('进入onLoad方法')
+			this.loadmore()
+		},
+		onShow() {
+			console.log('进入onShow方法')
+			this.loadmore()
+		},
 		methods: {
 			// 跳转到详细页面
 			toDetail (notify) {

+ 6 - 3
pages/workbench/task/TaskForm.vue

@@ -478,16 +478,19 @@
 			},
 			// 终止
 			stop () {
-				uni.showLoading()
+				//uni.showLoading()
 				uni.showModal({
 				    title: '提示',
 				    content: '确定终止流程吗?',
 				    success: (res) => {
 				        if (res.confirm) {
 							processService.stop(this.procInsId, this.auditForm.message).then((data) => {
+								console.log(data)
 				              uni.showToast({ title: data, icon: "success" });
-				              uni.navigateTo({
-				              	url: '/pages/workbench/task/TodoList'
+				              uni.reLaunch({
+								  //url: '/pages/workbench/task/TodoList'
+								  //url: '/pages/workbench/workbench'
+								  url: '/pages/index/index'
 				              })
 				            })
 				        } else if (res.cancel) {

+ 111 - 14
pages/workbench/workbench.vue

@@ -77,7 +77,7 @@
           <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 v-if="userInfo.roleNames == '巡视员' || userInfo.roleNames == '乡镇巡查员' " style="font-weight: bold">垃圾巡视</span>
         </span>
 			</view>
 		</view>
@@ -148,14 +148,17 @@
 										</view>
 									</view>
 									<view class="text-grey text-sm" style="font-size: 16px">
-										<div style="margin-right: 20px; float: left">
+										<div style="margin-right: 20px; float: left" v-if="row.status === '2'">
 											<u-tag-small text="进行中" plain shape="circle" type="error"></u-tag-small>
 										</div>
-										<div style="margin-right: 10px; float: left">
+										<div style="margin-right: 20px; float: left" v-else>
+											<u-tag-small text="已处理" plain shape="circle" type="error"></u-tag-small>
+										</div>
+										<div style="margin-right: 10px; float: left" v-if="row.transportMileage">
 											<span class="cuIcon-deliver" style="color: #d95141;margin-right: 5px;"></span>
 											<span>{{row.transportMileage}}km</span>
 										</div>
-										<div style="margin-right: 10px;">
+										<div style="margin-right: 10px;" v-if="row.weight">
 											<span class="cuIcon-deletefill" style="color: #38b64b;margin-right: 5px;"></span>
 											<span>{{row.weight}}t</span>
 										</div>
@@ -177,7 +180,7 @@
 
 		<!-- 页脚区域 -->
 		<view class="footer-div">
-			<u-button v-if="userInfo.roleNames == '巡视员' " type="primary" text="巡视工单" @click="openPatrolWorkOrderForm()"></u-button>
+			<u-button v-if="userInfo.roleNames == '巡视员' || userInfo.roleNames == '乡镇巡查员' " type="primary" text="巡视工单" @click="openPatrolWorkOrderForm()"></u-button>
 			<u-button v-if="userInfo.roleNames == '村负责人' " type="primary" text="清运工单" @click="start()"></u-button>
 		</view>
 	</view>
@@ -226,6 +229,7 @@
 	import userService from "@/api/sys/userService"
 	import { EventBus } from '@/store/eventBus.js';
 	import disposeRubbishService from '@/api/garbageClearance/disposeRubbishService'
+	import flowCopyService from "@/api/flowable/flowCopyService"
 	export default {
 		components:{
 			userSelect
@@ -237,7 +241,8 @@
 				showType: 'task',
 				status: 'loadmore',
 				searchForm: {
-					title: ''
+					title: '',
+					procInsName: ''
 				},
 				sprocessForm: {
 					filterText: ''
@@ -328,7 +333,7 @@
 							backgroundImage: 'linear-gradient(to right, #0285f7 0%, #19b3bd 100%)'
 						};
 					case '巡视员':
-					case '镇巡视员':
+					case '乡镇巡查员':
 						return {
 							height: '130px',
 							borderRadius: '15px',
@@ -368,8 +373,15 @@
 			},
 			tabSelect(index) {
 				this.tabIndex = index;
+				this.tablePage.currentPage = 0
 				if(1 === index){
-					this.haveDone()
+					const roleNames = this.userInfo.roleNames;
+					// 根据从 Vuex 获取的状态来判断样式
+					if('村负责人' === roleNames){
+						this.flowCopyShow()
+					}else{
+						this.haveDone()
+					}
 				}else {
 					this.loadmore()
 				}
@@ -411,6 +423,7 @@
 			},
 			// 跳转到详细页面
 			toDetail (row) {
+				console.log(row)
 				taskService.getTaskDef({
 					taskDefKey: row.taskDefinitionKey,
 					procInsId: row.processInstanceId,
@@ -460,8 +473,18 @@
 					orders: this.tablePage.orders,
 					...this.searchForm
 				}).then((data)=>{
+					console.log(this.dataList)
+					console.log(data.records)
+					var idList = []
+					for (const value of this.dataList) {
+						idList.push(value.task.id)
+					}
+					for (const value of data.records) {
+						if(!idList.includes(value.task.id)){
+							this.dataList=this.dataList.concat(value);
+						}
+					}
 					//追加新数据
-					this.dataList=this.dataList.concat(data.records);
 					this.tablePage.pages = data.pages;
 					if(this.tablePage.pages <= this.tablePage.currentPage){
 						this.status = 'nomore'
@@ -505,13 +528,87 @@
 					});
 
 					// 使用 for...of 和 await 来处理异步操作
+					var procInsIdList = []
 					for (const value of data.records) {
 						if('垃圾处理流程' === value.processDefinitionName && '1' === value.vars.disposeType ){
-							if(!value.currentTask){
-								const rubbishStation = await disposeRubbishService.getByProcInsId(value.processInstanceId);
-								value.weight = rubbishStation.weight;
-								value.transportMileage = rubbishStation.transportMileage;
-								value.subsidy = rubbishStation.subsidy;
+							procInsIdList.push(value.processInstanceId)
+						}
+					}
+					if(procInsIdList){
+						const rubbishStationList = await disposeRubbishService.getByProcInsId(procInsIdList);
+						for (const rubbishStation of rubbishStationList) {
+							for (const value of data.records) {
+								if(value.processInstanceId === rubbishStation.procInsId){
+									value.weight = rubbishStation.weight;
+									value.transportMileage = rubbishStation.transportMileage;
+									value.subsidy = rubbishStation.subsidy;
+									value.status = rubbishStation.status;
+								}
+							}
+						}
+					}
+
+					this.dataList = this.dataList.concat(data.records);
+					this.tablePage.pages = data.pages;
+					this.status = this.tablePage.pages <= this.tablePage.currentPage ? 'nomore' : 'loadmore';
+
+					if(this.showType === 'task'){
+						this.dataList = []
+						this.tablePage.currentPage = 0;
+						this.loadmore()
+					}
+				} catch (error) {
+					console.error('Error loading data:', error);
+				}
+
+				try {
+					// 获取未读通知数量
+					const unreadCount = await notifyService.getUnreadCountByIsSelf({
+						isSelf: true,
+						...this.searchForm
+					});
+					EventBus.$emit('dataFromMessage', unreadCount);
+				} catch (error) {
+					console.error('Error getting unread count:', error);
+				}
+			},
+			//抄送数据
+			async flowCopyShow() {
+
+				if(this.showType === 'task'){
+					this.dataList = [];
+					this.showType = 'history';
+					this.tablePage.currentPage = 0;
+				}
+				this.tablePage.currentPage++;
+				this.status = 'loading';
+
+				try {
+					// 获取历史数据
+					const data = await flowCopyService.list({
+						current: this.tablePage.currentPage,
+						size: this.tablePage.pageSize,
+						orders: this.tablePage.orders,
+						...this.searchForm
+					});
+					console.log(data)
+
+					// 使用 for...of 和 await 来处理异步操作
+					var procInsIdList = []
+					for (const value of data.records) {
+						procInsIdList.push(value.processInstanceId)
+					}
+					console.log(procInsIdList)
+					if(procInsIdList){
+						const rubbishStationList = await disposeRubbishService.getByProcInsId(procInsIdList);
+						for (const rubbishStation of rubbishStationList) {
+							for (const value of data.records) {
+								if(value.processInstanceId === rubbishStation.procInsId){
+									value.weight = rubbishStation.weight;
+									value.transportMileage = rubbishStation.transportMileage;
+									value.subsidy = rubbishStation.subsidy;
+									value.status = rubbishStation.status;
+								}
 							}
 						}
 					}