user5 8 месяцев назад
Родитель
Сommit
c401ff60d4

+ 15 - 2
pages/apps/notification/notificationDetail.vue

@@ -114,13 +114,26 @@
 				// 获取巡视工单信息
 				await overService.queryById(data.lookOverId).then((data) => {
 					data.no = 'XS-J' + data.no;
-					console.log('data', data)
 					this.fileList1 = data.fileList1
-					console.log('this.fileList1', this.fileList1)
 					this.inputForm = this.recover(this.inputForm, data)
 				})
 				this.notication = data
 			});
+		},
+		onBackPress(option) {
+			const pages = getCurrentPages();
+			if (pages.length > 1) {
+				const previousPage = pages[pages.length - 2]; // 获取上一个页面
+
+				// 检查上一个页面的实例或路由
+				if (previousPage.route === 'pages/index/index') {
+					// 如果上一个页面的路由是 'pages/a/a',调用它的方法
+					if (typeof previousPage.NavChange === 'function') {
+						const customParam = { currentTarget: { dataset: { cur: 'message' } } }; // 模拟事件对象 刷新消息通知页面
+						previousPage.NavChange(customParam); // 调用上一个页面的 findList 方法
+					}
+				}
+			}
 		}
 	}
 </script>

+ 32 - 26
pages/edt/DisposeRubbishForm.vue

@@ -256,6 +256,7 @@
             return {
                 disFlag: true,  // 启用动态获取处理单位则设置为false
                 isProcessing: false,  // 遮罩层
+                uploadFlag: true,  // 上传判定值
                 processingUnits: [],
                 taskName: '',   //当前节点处理人节点名称
                 fileList1: [],
@@ -367,7 +368,6 @@
 
                 // Format the value based on regex
                 const match = value.match(regex);
-                console.log(match)
                 let formattedValue = (match && match[0]) || '';
 
                 // Ensure the value is positive
@@ -385,12 +385,10 @@
                 if (id) {
                     // 使用 await 等待查询结果
                     const data = await disposeRubbishService.queryById(id);
-                    console.log('查询当前信息', data);
 
                     // 获取当前节点流程信息,并等待其执行完成
                     const taskName = await taskService.getTaskNameByProcInsId(data.procInsId);
                     this.taskName = taskName
-                    console.log('查询当前节点流程信息', taskName);
 
                     // 根据任务名称处理逻辑
                     if (this.isNotEmpty(taskName)) {
@@ -504,7 +502,6 @@
 
             // 显示  项目选择器
             disposeWorkOver(id) {
-                console.log(this.inputForm.status)
                 if(this.inputForm.status === '2'){
                     uni.navigateTo({
                         url: '/pages/edt/PatrolWorkOrderForm?id='+id
@@ -516,7 +513,6 @@
             },
             //刷信photo获取对应的id
             refreshPhoto() {
-                console.log('刷信photo获取对应的id',this.inputForm.id)
                 disposeRubbishService.queryById(this.inputForm.id).then((data) => {
 
                     if (data.fileList1) {
@@ -565,7 +561,6 @@
             },
 
             removeRow(index) {
-               console.log('index',index)
                 // 点击删除按钮时,从表格中移除指定行
                 this.inputForm.workOverNoList.splice(index, 1);
             },
@@ -634,6 +629,10 @@
 
                     let errors = [];
 
+                    if(!this.uploadFlag){
+                        errors.push("图片未上传完成,请等待上传完后在提交")
+                    }
+
                     if(!this.inputForm.disposeType){
                         errors.push("请选择处理方式")
                     }
@@ -671,6 +670,7 @@
                                 duration: 2000
                             });
                         });
+                        this.isProcessing = false;
                         reject('Form validation failed');
                     } else {
                         // 所有验证通过,执行保存操作
@@ -693,7 +693,6 @@
                             }
                             this.inputForm.fileList4 = this.fileList4
                             disposeRubbishService.save(this.inputForm).then(data => {
-                                console.log('提交成功拉')
                                 uni.showToast({
                                     title: "提交成功",
                                     icon: "success",
@@ -725,29 +724,36 @@
             },
             // 新增图片
             async afterRead(event) {
-                // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
-                let lists = [].concat(event.file)
-                let fileListLen = this[`fileList${event.name}`].length
-                lists.map((item) => {
-                    this[`fileList${event.name}`].push({
-                        ...item,
-                        status: 'uploading',
-                        message: '上传中'
+                try {
+                    this.uploadFlag = false
+                    // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
+                    let lists = [].concat(event.file)
+                    let fileListLen = this[`fileList${event.name}`].length
+                    lists.map((item) => {
+                        this[`fileList${event.name}`].push({
+                            ...item,
+                            status: 'uploading',
+                            message: '上传中'
+                        })
                     })
-                })
-                for (let i = 0; i < lists.length; i++) {
-                    const result = await this.uploadFilePromise(lists[i].url, fileListLen)
-                    let item = this[`fileList${event.name}`][fileListLen]
-                    this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
-                        status: 'success',
-                        message: '',
-                        url: result
-                    }))
-                    fileListLen++
+                    for (let i = 0; i < lists.length; i++) {
+                        const result = await this.uploadFilePromise(lists[i].url, fileListLen)
+                        let item = this[`fileList${event.name}`][fileListLen]
+                        this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
+                            status: 'success',
+                            message: '',
+                            url: result
+                        }))
+                        fileListLen++
+                    }
+                    this.uploadFlag = true
+                } catch (error) {
+                    console.error('上传失败:', error);
+                } finally {
+                    this.uploadFlag = true
                 }
             },
             uploadFilePromise(url, index) {
-                console.log($auth.getUserToken())
                 return new Promise((resolve, reject) => {
                     let a = uni.uploadFile({
                         url: 'http://localhost:8000/app/file/webUpload/fileUpload', // 仅为示例,非真实的接口地址

+ 0 - 1
pages/edt/DisposeRubbishFormDetail.vue

@@ -257,7 +257,6 @@
                 if (id) {
                     // 使用 await 等待查询结果
                     const data = await disposeRubbishService.queryById(id);
-                    console.log('查询当前信息', data);
 
                     // 获取当前节点流程信息,并等待其执行完成
                     const taskName = await taskService.getTaskNameByProcInsId(data.procInsId);

+ 0 - 1
pages/edt/PatrolWorkOrderDisposeForm.vue

@@ -366,7 +366,6 @@
                 }
             },
             uploadFilePromise(url, index) {
-                console.log($auth.getUserToken())
                 return new Promise((resolve, reject) => {
                     let a = uni.uploadFile({
                         url: 'http://localhost:8000/app/file/webUpload/fileUpload', // 仅为示例,非真实的接口地址

+ 73 - 41
pages/edt/PatrolWorkOrderForm.vue

@@ -182,6 +182,7 @@
                 disFlag: true,  // 启用动态获取处理单位则设置为false
                 showFlag: false,
                 isProcessing: false,  // 遮罩层
+                uploadFlag: true,  // 上传判定值
                 processingUnits: [],
                 fileList1: [],
                 fileList2: [],
@@ -281,7 +282,6 @@
         watch: {
         },
         onLoad(options) {
-            console.log('options',options)
             // 从 options 中获取 id 参数
             this.showFlag = options.showFlag;
             this.id = options.id;
@@ -411,6 +411,10 @@
 
                     let errors = [];
 
+                    if(!this.uploadFlag){
+                        errors.push("图片未上传完成,请等待上传完后在提交")
+                    }
+
                     if (this.fileList1 && this.fileList1.length > 0) {
                         // 将 fileList1 中的每个文件对象的属性名调整为新的属性名
                         this.inputForm.fileList1 = this.fileList1.map(file => {
@@ -433,6 +437,7 @@
                                 duration: 2000
                             });
                         });
+                        this.isProcessing = false;
                         reject('Form validation failed');
                     } else {
                         // 所有验证通过,执行保存操作
@@ -468,6 +473,13 @@
 
                 return new Promise((resolve, reject) => {
 
+                    let errors = [];
+
+                    if(!this.uploadFlag){
+                        errors.push("图片未上传完成,请等待上传完后在提交")
+                    }
+
+
                     if (this.fileList2 && this.fileList2.length > 0) {
                         // 将 fileList1 中的每个文件对象的属性名调整为新的属性名
                         this.inputForm.fileList2 = this.fileList2.map(file => {
@@ -493,32 +505,46 @@
                             };
                         });
                     }
-                    //数据保存
-                    this.$refs.inputForm.validate().then(() => {
-                        uni.showLoading();
 
-                        overService.savePhoto(this.inputForm).then(data => {
-                            EventBus.$emit('refreshPhoto');
+                    if (errors.length > 0) {
+                        // 存在错误,显示提示信息
+                        errors.forEach(error => {
                             uni.showToast({
-                                title: "提交成功",
-                                icon: "success",
-                                duration: 1000  // 提示持续时间为1秒(1000毫秒)
+                                title: error,
+                                icon: 'none',
+                                duration: 2000
                             });
+                        });
+                        this.isProcessing = false;
+                        reject('Form validation failed');
+                    } else {
+                        //数据保存
+                        this.$refs.inputForm.validate().then(() => {
+                            uni.showLoading();
 
-                            // 延迟1秒后再跳转到上一页
-                            setTimeout(() => {
-                                this.isProcessing = false; // 显示遮罩层
-                                resolve('Form saved successfully');
-                                uni.navigateBack({
-                                    delta: 1
+                            overService.savePhoto(this.inputForm).then(data => {
+                                EventBus.$emit('refreshPhoto');
+                                uni.showToast({
+                                    title: "提交成功",
+                                    icon: "success",
+                                    duration: 1000  // 提示持续时间为1秒(1000毫秒)
                                 });
-                            }, 1000);
-                        }).catch(error => {
-                            reject('Save operation failed');
+
+                                // 延迟1秒后再跳转到上一页
+                                setTimeout(() => {
+                                    this.isProcessing = false; // 显示遮罩层
+                                    resolve('Form saved successfully');
+                                    uni.navigateBack({
+                                        delta: 1
+                                    });
+                                }, 1000);
+                            }).catch(error => {
+                                reject('Save operation failed');
+                            });
+                        }).catch(() => {
+                            reject('Form validation failed');
                         });
-                    }).catch(() => {
-                        reject('Form validation failed');
-                    });
+                    }
                 });
             },
 
@@ -528,29 +554,36 @@
             },
             // 新增图片
             async afterRead(event) {
-                // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
-                let lists = [].concat(event.file)
-                let fileListLen = this[`fileList${event.name}`].length
-                lists.map((item) => {
-                    this[`fileList${event.name}`].push({
-                        ...item,
-                        status: 'uploading',
-                        message: '上传中'
+                try {
+                    this.uploadFlag = false
+                    // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
+                    let lists = [].concat(event.file)
+                    let fileListLen = this[`fileList${event.name}`].length
+                    lists.map((item) => {
+                        this[`fileList${event.name}`].push({
+                            ...item,
+                            status: 'uploading',
+                            message: '上传中'
+                        })
                     })
-                })
-                for (let i = 0; i < lists.length; i++) {
-                    const result = await this.uploadFilePromise(lists[i].url, fileListLen)
-                    let item = this[`fileList${event.name}`][fileListLen]
-                    this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
-                        status: 'success',
-                        message: '',
-                        url: result
-                    }))
-                    fileListLen++
+                    for (let i = 0; i < lists.length; i++) {
+                        const result = await this.uploadFilePromise(lists[i].url, fileListLen)
+                        let item = this[`fileList${event.name}`][fileListLen]
+                        this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
+                            status: 'success',
+                            message: '',
+                            url: result
+                        }))
+                        fileListLen++
+                    }
+                    this.uploadFlag = true
+                } catch (error) {
+                    console.error('上传失败:', error);
+                } finally {
+                    this.uploadFlag = true
                 }
             },
             uploadFilePromise(url, index) {
-                console.log($auth.getUserToken())
                 return new Promise((resolve, reject) => {
                     let a = uni.uploadFile({
                         url: 'http://localhost:8000/app/file/webUpload/fileUpload', // 仅为示例,非真实的接口地址
@@ -579,7 +612,6 @@
                 })
             },
             getOfficeOnHamlet(value){
-                console.log('getOfficeOnHamlet:',value)
                 // 根据组织ID 获取 该村的 村支书
                 overService.getUserInfoByOffId(value)
                     .then(data => {

+ 10 - 3
pages/index/index.vue

@@ -25,12 +25,12 @@
 				工作台
 			</view>
 			
-			<view class="action" @click="NavChange" data-cur="apps">
+			<!--<view class="action" @click="NavChange" data-cur="apps">
 				<view :class="PageCur=='apps'?'text-blue':'text-gray'">
 					<text class="lg" :class="PageCur=='apps'?'cuIcon-circlefill':'cuIcon-circle'"></text>
 					<text>应用</text>
 				</view>
-			</view>
+			</view>-->
 			
 			<view class="action" @click="NavChange" data-cur="my">
 				<view :class="PageCur=='my'?'text-blue':'text-gray'">
@@ -78,7 +78,14 @@
 		},
 		methods: {
 			NavChange: function(e) {
-				this.PageCur = e.currentTarget.dataset.cur
+				let newPageCur = e.currentTarget.dataset.cur;
+				// 清空当前导航项
+				this.PageCur = '';
+
+				// 使用 setTimeout 确保下一帧将新值设回去,强制页面更新
+				setTimeout(() => {
+					this.PageCur = newPageCur;
+				}, 0);
 			},
 			handleMessageData(data) {
 				// 处理 message.vue 传递过来的参数

+ 2 - 0
pages/message/message.vue

@@ -83,6 +83,8 @@
 					uni.navigateTo({
 					  url: '/pages/apps/notification/notificationDetail?id='+notify.id
 					})
+
+					this.loadmore()
 				}else{
 					this.toEdit(notify)
 				}

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

@@ -77,7 +77,6 @@
 		}),
 	  created() {
 		  this.getUnreadCountByIsSelf()
-		  console.log(this.userInfo)
 	  },
     methods: {
 	  ...mapActions(['refreshUserInfo']),

+ 0 - 2
pages/workbench/task/TaskForm.vue

@@ -345,7 +345,6 @@
 			start (vars) {
 			  if (this.formType === '2') { // 外置表单启动
 				this.$refs.form.saveForm((businessTable, businessId,disposeType) => {
-					console.log('start方法disposeType',disposeType)
 				  taskService.start({
 					procDefKey: this.procDefKey,
 					businessTable: businessTable,
@@ -485,7 +484,6 @@
 				    success: (res) => {
 				        if (res.confirm) {
 							processService.stop(this.procInsId, this.auditForm.message).then((data) => {
-								console.log(data)
 				              uni.showToast({ title: data, icon: "success" });
 				              uni.reLaunch({
 								  //url: '/pages/workbench/task/TodoList'

+ 0 - 1
pages/workbench/task/TodoList.vue

@@ -70,7 +70,6 @@
 			}
 		},
 		onLoad() {
-			console.log('onLoad')
 			this.loadmore()
 		},
 		methods: {

+ 0 - 5
pages/workbench/workbench.vue

@@ -423,7 +423,6 @@
 			},
 			// 跳转到详细页面
 			toDetail (row) {
-				console.log(row)
 				taskService.getTaskDef({
 					taskDefKey: row.taskDefinitionKey,
 					procInsId: row.processInstanceId,
@@ -473,8 +472,6 @@
 					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)
@@ -591,14 +588,12 @@
 						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) {

+ 16 - 1
store/index.js

@@ -4,14 +4,17 @@ import Vue from 'vue';
 import Vuex from 'vuex';
 import user from './modules/user';
 import notifyService from "@/api/notify/notifyService";
+import userService from "@/api/sys/userService";
 
 Vue.use(Vuex);
 
+// store.js
 export default new Vuex.Store({
 	modules: {
 		user
 	},
 	state: {
+		userInfo: null, // 新增:存储用户信息
 		messageDataList: [],
 		triggerShowOpen: false // 新增状态
 	},
@@ -21,6 +24,9 @@ export default new Vuex.Store({
 		},
 		setTriggerShowOpen(state, value) {
 			state.triggerShowOpen = value;
+		},
+		setUserInfo(state, userInfo) {
+			state.userInfo = userInfo;  // 新增:用于存储用户信息
 		}
 	},
 	actions: {
@@ -35,6 +41,15 @@ export default new Vuex.Store({
 		},
 		resetTriggerShowOpen({ commit }) {
 			commit('setTriggerShowOpen', false); // 重置状态
+		},
+		async fetchUserInfo({ commit }) {
+			try {
+				const userInfo = await userService.info();  // 调用你的 API 获取用户信息
+				commit('setUserInfo', userInfo);  // 提交 mutation 保存用户信息
+			} catch (error) {
+				console.error('获取用户信息失败:', error);
+			}
 		}
-	}
+	},
 });
+