增加设备保养
This commit is contained in:
		
							
								
								
									
										85
									
								
								App.vue
									
									
									
									
									
								
							
							
						
						
									
										85
									
								
								App.vue
									
									
									
									
									
								
							| @@ -95,39 +95,39 @@ | ||||
| 		} | ||||
| 		.list_content{padding:12px;position: relative;} | ||||
| 		.list_content .card_right{position: absolute;top: 12px;right: 12px;} | ||||
| 		 | ||||
| 		.card_right{ | ||||
| 			display: flex; | ||||
| 			flex-direction: column; | ||||
| 			.status{ | ||||
| 				background: $uni-bg-color-success-dark; | ||||
| 				color: $uni-text-color-success; | ||||
| 				padding: 3px 10px; | ||||
| 				border-radius: 4px; | ||||
| 				font-size: 12px; | ||||
| 			} | ||||
| 			.success{ | ||||
| 				background: $uni-bg-color-success-dark; | ||||
| 				color: $uni-text-color-success; | ||||
| 				padding: 3px 10px; | ||||
| 				border-radius: 4px; | ||||
| 				font-size: 12px; | ||||
| 			} | ||||
| 			.warning{ | ||||
| 				background: $uni-bg-color-warning-dark; | ||||
| 				color: $uni-text-color-warning; | ||||
| 				padding: 3px 10px; | ||||
| 				border-radius: 4px; | ||||
| 				font-size: 12px; | ||||
| 			} | ||||
| 			.error{ | ||||
| 				background: $uni-bg-color-error-dark; | ||||
| 				color: $uni-text-color-danger; | ||||
| 				padding: 3px 10px; | ||||
| 				border-radius: 4px; | ||||
| 				font-size: 12px; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	.page_list .card_right, .detail_list .card_right{ | ||||
| 		display: flex; | ||||
| 		flex-direction: column; | ||||
| 		.status{ | ||||
| 			background: $uni-bg-color-success-dark; | ||||
| 			color: $uni-text-color-success; | ||||
| 			padding: 3px 10px; | ||||
| 			border-radius: 4px; | ||||
| 			font-size: 12px; | ||||
| 		} | ||||
| 		.success{ | ||||
| 			background: $uni-bg-color-success-dark; | ||||
| 			color: $uni-text-color-success; | ||||
| 			padding: 3px 10px; | ||||
| 			border-radius: 4px; | ||||
| 			font-size: 12px; | ||||
| 		} | ||||
| 		.warning{ | ||||
| 			background: $uni-bg-color-warning-dark; | ||||
| 			color: $uni-text-color-warning; | ||||
| 			padding: 3px 10px; | ||||
| 			border-radius: 4px; | ||||
| 			font-size: 12px; | ||||
| 		} | ||||
| 		.error{ | ||||
| 			background: $uni-bg-color-error-dark; | ||||
| 			color: $uni-text-color-danger; | ||||
| 			padding: 3px 10px; | ||||
| 			border-radius: 4px; | ||||
| 			font-size: 12px; | ||||
| 		} | ||||
| 	} | ||||
| 	.flexBox .detail_list:first-child{ | ||||
| 		margin-top: 2px; | ||||
| @@ -140,7 +140,8 @@ | ||||
| 	.bottom_but{ | ||||
| 		width: 100%; | ||||
| 		position: fixed; | ||||
| 		bottom: 0px; | ||||
| 		bottom: 0px; | ||||
| 		z-index: 90; | ||||
| 		background-color: #060B26; | ||||
| 		border-top: 1px solid #2E3249; | ||||
| 		height: 80px; | ||||
| @@ -205,4 +206,20 @@ | ||||
| 	  border-radius: 50%; | ||||
| 	  background-image: conic-gradient($uni-color-primary 0%, $uni-color-primary var(--progress), transparent 0); | ||||
| 	} | ||||
| 	 | ||||
| 	// 选择日期时间颜色的配置 | ||||
| 	.input_date .uni-date-x .uni-date__x-input{ | ||||
| 		color: $uni-text-color-tip; | ||||
| 	} | ||||
| 	.haveTime .uni-date-x .uni-date__x-input{ | ||||
| 		color: $uni-text-color-inverse; | ||||
| 	} | ||||
| 	 | ||||
| 	// 修改 日期时间选择组件 | ||||
| 	.input_date ::v-deep .uni-date-changed .uni-datetime-picker--btn{ | ||||
| 		background: $uni-color-primary !important; | ||||
| 	} | ||||
| 	.input_date ::v-deep .uni-calendar-item--checked{ | ||||
| 		background: $uni-color-primary !important; | ||||
| 	} | ||||
| </style> | ||||
|   | ||||
| @@ -8,9 +8,10 @@ | ||||
| 				<view class="center-cut-menu"> | ||||
| 					<scroll-view scroll-x="true" show-scrollbar="false" scroll-with-animation="true" :scroll-left="scrollLeft" class="scroll-view horizontalScrollView" :class="{'monthScroll':params.date!=='day'}" > | ||||
| 					  <view class="scroll-item" :style="'width:'+itemWidth+'px'" v-for="(item, index) in titleList" :key="index" @click="changeMenu(index)"> | ||||
| 						<view class="viewItem" :class="{'active':curIndex == index,'monthViewItem':params.date !=='day'}"> | ||||
| 						<view class="viewItem" :class="{'active':curIndex == index,'monthViewItem':params.date !=='day','todoayView':item.todoay}"> | ||||
| 							<text class="item-text">{{item.name}}</text> | ||||
| 							<text class="item-date" v-if="params.date == 'day'">{{item.text}}</text> | ||||
| 							<text class="todoay" v-if="item.todoay">今</text> | ||||
| 						</view> | ||||
| 					  </view> | ||||
| 					</scroll-view> | ||||
| @@ -25,8 +26,11 @@ | ||||
| 				<view :style="'height:'+swiperHeight+'px'" v-if="curIndex == index"> | ||||
| 					<view class="swiper-item padd_top12 font14"> | ||||
| 						<view class="device_row" v-for="(em,inde) in item.data" :key="inde"> | ||||
| 							<text class="name font_bold">{{em.text}}</text> | ||||
| 							<text class="text">{{em.name}}</text> | ||||
| 							<view class="rowView" :class="{'active':inde==0,'todoayView':em.todoay}"> | ||||
| 								<text class="name font_bold">{{em.text}}</text> | ||||
| 								<text class="text">{{em.name}}</text> | ||||
| 								<text v-if="em.todoay" class="todoay">今</text> | ||||
| 							</view> | ||||
| 						</view> | ||||
| 					</view> | ||||
| 				</view> | ||||
| @@ -113,9 +117,16 @@ | ||||
| 			setTitle(){ | ||||
| 				if(this.params.date == 'day'){ | ||||
| 					let list = this.$wf.getDatesOfWeek(); | ||||
| 					let todoay = this.$wf.getToday(); | ||||
| 					list.forEach(item=>{ | ||||
| 						if(item.date == todoay){ | ||||
| 							item.todoay = true; | ||||
| 						} | ||||
| 						item.text = item.date.split('-')[2]; | ||||
| 					}) | ||||
| 					if(this.curIndex >= list.length){ | ||||
| 						this.curIndex = list.length - 1; | ||||
| 					} | ||||
| 					this.titleList = list; | ||||
| 				} | ||||
| 				if(this.params.date == 'week'){ | ||||
| @@ -124,8 +135,12 @@ | ||||
| 					 | ||||
| 					arr.forEach((item,index)=>{ | ||||
| 						let date = item.find(em=> em!==null && em!==undefined); | ||||
| 						let todoay = this.$wf.getToday(); | ||||
| 						item.forEach(em=>{ | ||||
| 							if(em){ | ||||
| 								if(em.date == todoay){ | ||||
| 									em.todoay = true; | ||||
| 								} | ||||
| 								em.text = em.date.split('-')[2]; | ||||
| 								em.name = '星期'+em.name; | ||||
| 							} | ||||
| @@ -136,11 +151,32 @@ | ||||
| 							data:item.filter(em=> em!==null), | ||||
| 						}) | ||||
| 					}) | ||||
| 					console.log(list,233) | ||||
| 					if(this.curIndex >= list.length){ | ||||
| 						this.curIndex = list.length - 1; | ||||
| 					} | ||||
| 					this.titleList = list; | ||||
| 				} | ||||
| 				if(this.params.date == 'month'){ | ||||
| 					 | ||||
| 					let list = []; | ||||
| 					let arr = this.$wf.getCurrentYearData(); | ||||
| 					arr.forEach((item,index)=>{ | ||||
| 						let weeks = []; | ||||
| 						item.weeks.forEach((em,ind)=>{ | ||||
| 							let dateList = em.filter(em=> em!==null); | ||||
| 							weeks.push({ | ||||
| 								data:dateList, | ||||
| 								text:dateList[0].date.split('-')[2], | ||||
| 								name:'第'+Number(ind+1)+'周', | ||||
| 								date:dateList[0].date, | ||||
| 							}) | ||||
| 						}) | ||||
| 						list.push({ | ||||
| 							name:this.$wf.numberToChineseLower(Number(item.month))+'月', | ||||
| 							date:weeks[0].date, | ||||
| 							data:weeks, | ||||
| 						}) | ||||
| 					}) | ||||
| 					this.titleList = list; | ||||
| 				} | ||||
| 				 | ||||
| 				this.getScrollW(); | ||||
| @@ -198,6 +234,30 @@ | ||||
| 					}) | ||||
| 					this.titleList = list; | ||||
| 				} | ||||
| 				if(this.params.date == 'month'){ | ||||
| 					// 获取本年的选中周日期 | ||||
| 					let date = this.titleList[this.curIndex]; | ||||
| 					let list = []; | ||||
| 					let arr = this.$wf.getPreviousYearData(String(date.date)); | ||||
| 					arr.forEach((item,index)=>{ | ||||
| 						let weeks = []; | ||||
| 						item.weeks.forEach((em,ind)=>{ | ||||
| 							let dateList = em.filter(em=> em!==null); | ||||
| 							weeks.push({ | ||||
| 								data:dateList, | ||||
| 								text:dateList[0].date.split('-')[2], | ||||
| 								name:'第'+Number(ind+1)+'周', | ||||
| 								date:dateList[0].date, | ||||
| 							}) | ||||
| 						}) | ||||
| 						list.push({ | ||||
| 							name:this.$wf.numberToChineseLower(Number(item.month))+'月', | ||||
| 							date:weeks[0].date, | ||||
| 							data:weeks, | ||||
| 						}) | ||||
| 					}) | ||||
| 					this.titleList = list; | ||||
| 				} | ||||
| 				 | ||||
| 				this.getScrollW(); | ||||
| 				this.changeDate(); | ||||
| @@ -241,6 +301,30 @@ | ||||
| 					}) | ||||
| 					this.titleList = list; | ||||
| 				} | ||||
| 				// 获取下一年的日期 | ||||
| 				if(this.params.date == 'month'){ | ||||
| 					let date = this.titleList[this.curIndex]; | ||||
| 					let list = []; | ||||
| 					let arr = this.$wf.getNextYearData(String(date.date)); | ||||
| 					arr.forEach((item,index)=>{ | ||||
| 						let weeks = []; | ||||
| 						item.weeks.forEach((em,ind)=>{ | ||||
| 							let dateList = em.filter(em=> em!==null); | ||||
| 							weeks.push({ | ||||
| 								data:dateList, | ||||
| 								text:dateList[0].date.split('-')[2], | ||||
| 								name:'第'+Number(ind+1)+'周', | ||||
| 								date:dateList[0].date, | ||||
| 							}) | ||||
| 						}) | ||||
| 						list.push({ | ||||
| 							name:this.$wf.numberToChineseLower(Number(item.month))+'月', | ||||
| 							date:weeks[0].date, | ||||
| 							data:weeks, | ||||
| 						}) | ||||
| 					}) | ||||
| 					this.titleList = list; | ||||
| 				} | ||||
| 				 | ||||
| 				this.getScrollW(); | ||||
| 				this.changeDate(); | ||||
| @@ -281,6 +365,7 @@ | ||||
| 			.scroll-view {height: 50px;white-space: nowrap; | ||||
| 				.scroll-item {height: 100%;padding: 0 5px;display: inline-block;text-align: center;box-sizing: border-box; | ||||
| 				.viewItem{ | ||||
| 					position: relative; | ||||
| 					font-size: 14px;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center; | ||||
| 					border: 1px solid $uni-color-primary;box-sizing: border-box;border-radius: 8px; | ||||
| 				} | ||||
| @@ -291,16 +376,25 @@ | ||||
| 				.active { | ||||
| 					background: $uni-color-primary; | ||||
| 				} | ||||
| 				.todoay{ | ||||
| 					display: flex;align-items: center;justify-content: center;background: $uni-bg-color-success; | ||||
| 					position: absolute;top: 2px;right: 2px;z-index: 20; | ||||
| 					border-radius: 2px;width: 12px;height: 12px;font-size: 8px; | ||||
| 				} | ||||
| 			  } | ||||
| 			} | ||||
| 			.monthScroll{height: 28px;} | ||||
| 			.monthScroll{height: 27px;} | ||||
| 		} | ||||
| 		.content-right{flex-basis: 30px;text-align: center;} | ||||
| 	} | ||||
| 	.swiper-box-list{height: 240px;padding:0 12px; | ||||
| 		.swiper-item{display: flex;flex-direction: row;flex-wrap: wrap;} | ||||
| 		.device_row{display: flex;flex-direction: column;width: 33%;justify-content: center;align-items: center;margin-bottom: 12px;padding: 12px 0;height: 70px;box-sizing: border-box; | ||||
| 		.device_row{display: flex;flex-direction: column;width: 33%;justify-content: center;align-items: center;margin-bottom: 12px;height: 70px;box-sizing: border-box;padding: 0 8px;position: relative; | ||||
| 			.name{margin-bottom: 6px;} | ||||
| 			.rowView{display: flex;flex-direction: column;justify-content: center;align-items: center;height: 100%;width: 100%;padding: 12px 0;box-sizing: border-box;position: relative;} | ||||
| 			.todoayView{padding: 0 8px; background: $uni-bg-color-default-dark; box-sizing: border-box;border-radius: 8px;} | ||||
| 			.active{background: $uni-bg-color-info;border-radius: 8px;} | ||||
| 			.todoay{position: absolute;top: -5px;right: -5px;z-index: 20;display: flex;align-items: center;justify-content: center;background: $uni-bg-color-success;width: 16px;height: 16px;border-radius: 3px;font-size: 10px;} | ||||
| 		} | ||||
| 	} | ||||
| </style> | ||||
| @@ -2,7 +2,7 @@ | ||||
| 	<view class="selectView"> | ||||
| 		<picker mode="selector" @change="bindPickerChange" @cancel="pickerHide" :value="value" range-key="name" :range="list" > | ||||
| 			<view class="pickerBom" @click="pickerClick"> | ||||
| 				<input type="text" :value="text" :placeholder="placeholder" disabled /> | ||||
| 				<input class="input" type="text" :value="text" :placeholder="placeholder" disabled /> | ||||
| 				<text class="iconfont icon-gengduo" :class="selectShow?'selectOpen':'selectHide'"></text> | ||||
| 			</view> | ||||
| 		</picker> | ||||
| @@ -37,13 +37,19 @@ | ||||
| 		watch:{ | ||||
| 			id:{ | ||||
| 				handler(val){ | ||||
| 					this.array.forEach((item,index)=>{ | ||||
| 						if(item.value == val){ | ||||
| 							this.value = index; | ||||
| 							this.text = item.name; | ||||
| 							this.id = val; | ||||
| 						} | ||||
| 					}) | ||||
| 					if(val){ | ||||
| 						this.array.forEach((item,index)=>{ | ||||
| 							if(item.value == val){ | ||||
| 								this.value = index; | ||||
| 								this.text = item.name; | ||||
| 								this.id = val; | ||||
| 							} | ||||
| 						}) | ||||
| 					}else{ | ||||
| 						this.value = ''; | ||||
| 						this.text = ''; | ||||
| 						this.id = ''; | ||||
| 					} | ||||
| 				}, | ||||
| 				immediate:true, | ||||
| 				deep:true | ||||
| @@ -91,6 +97,9 @@ | ||||
| 	} | ||||
| 	.pickerBom{ | ||||
| 		width: 100%; | ||||
| 		.input{ | ||||
| 			width: 100%; | ||||
| 		} | ||||
| 	} | ||||
| 	.selectOpen{ | ||||
| 		animation: rotate 0.6s; | ||||
|   | ||||
							
								
								
									
										245
									
								
								components/upload/uploadImg.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										245
									
								
								components/upload/uploadImg.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,245 @@ | ||||
| <template> | ||||
| 	<view class="uploadImgView"> | ||||
| 		<view class="uploadTitle" v-if="name && name!=''"> | ||||
| 			<view class="name font_bold">{{name}}</view> | ||||
| 			<view class="limit">{{newList.length}}/{{limit}}</view> | ||||
| 		</view> | ||||
| 		<view class="imgList"> | ||||
| 			<view class="uploadFlex itemBox" v-for="(item,index) in newList" :key="index"> | ||||
| 				<view class="imgItem"> | ||||
| 					<view class="itemImg"> | ||||
| 						<image class="img" :src="item" mode="scaleToFill"></image> | ||||
| 					</view> | ||||
| 					<view class="deleteBox" @click="deleteImg(index)"> | ||||
| 						<text class="icon iconfont icon-a-shanchu21"></text> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 			<view class="uploadFlex itemBox" v-for="(item,index) in uploadList" :key="index"> | ||||
| 				<view class="imgItem"> | ||||
| 					<view class="itemImg"> | ||||
| 						<image class="img" :src="item.path" mode="scaleToFill"></image> | ||||
| 					</view> | ||||
| 					<view class="progressView"> | ||||
| 						<view class="progressWidth" :style="'width:'+item.progress+'%'"></view> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 			<view class="uploadBut itemBox" @click="upload()" v-if="newList.length<limit"> | ||||
| 				<view class="img_but"> | ||||
| 					<view class="icon iconfont icon-a-shangchuanzhaopian2 font35"></view> | ||||
| 					<view class="text font12"> | ||||
| 						上传图片 | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 		</view> | ||||
| 	</view> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| 	export default{ | ||||
| 		data(){ | ||||
| 			return{ | ||||
| 				newList:this.list, | ||||
| 				uploadList:[], | ||||
| 				 | ||||
| 				oss:{}, | ||||
| 			} | ||||
| 		}, | ||||
| 		props:{ | ||||
| 			name:{ | ||||
| 				type:[String], | ||||
| 				default:'' | ||||
| 			}, | ||||
| 			limit:{ | ||||
| 				type:[Number,String], | ||||
| 				default:1 | ||||
| 			}, | ||||
| 			list:{ | ||||
| 				type:[Array,Object], | ||||
| 				default: () => [] | ||||
| 			}, | ||||
| 		}, | ||||
| 		watch:{ | ||||
| 			list:{ | ||||
| 				handler(val){ | ||||
| 					this.newList = val; | ||||
| 				}, | ||||
| 				immediate:true, | ||||
| 				deep:true | ||||
| 			} | ||||
| 		}, | ||||
| 		mounted() { | ||||
| 			this.getOss(); | ||||
| 		}, | ||||
| 		onShow() { | ||||
| 			 | ||||
| 		}, | ||||
| 		methods:{ | ||||
| 			// 获取图片oss 服务地址 | ||||
| 			getOss(){ | ||||
| 				this.$api.getOss('/oss.sign',{dir:'mes'}).then(res=>{ | ||||
| 					this.oss = res.data; | ||||
| 				}).catch(err=>{}) | ||||
| 			}, | ||||
| 			deleteImg(num){ | ||||
| 				this.newList.forEach((item,index)=>{ | ||||
| 					if(num == index){ | ||||
| 						this.newList.splice(index,1); | ||||
| 					} | ||||
| 				}) | ||||
| 				this.$emit('input',this.newList); | ||||
| 			}, | ||||
| 			upload(){ | ||||
| 				uni.chooseImage({ | ||||
| 					count:9, | ||||
| 				    success: (chooseImageRes) => { | ||||
| 				        const tempFilePaths = chooseImageRes.tempFilePaths; | ||||
| 						tempFilePaths.forEach((item,index)=>{ | ||||
| 							let num = item.length; | ||||
| 							let nameStr = item.toString(); | ||||
| 							let name = Date.parse(new Date())+'/'+nameStr.substring(nameStr-8); | ||||
| 							let fileName = this.oss.dir+'/'+ name; | ||||
| 							let text = Date.parse(new Date())+'_'+index; | ||||
| 							 | ||||
| 							let obj = { | ||||
| 								path:nameStr, | ||||
| 								text:text, | ||||
| 								progress:0, | ||||
| 							} | ||||
| 							this.uploadList.push(obj) | ||||
| 							 | ||||
| 							this.uploadOss(item,name,fileName,text); | ||||
| 						}) | ||||
| 				    }, | ||||
| 					fail:(errUpload)=> { | ||||
| 						 | ||||
| 					} | ||||
| 				}); | ||||
| 			}, | ||||
| 			uploadOss(url,name,fileName,text){ | ||||
| 				const uploadTask = uni.uploadFile({ | ||||
| 					url:this.oss.host, | ||||
| 					header:{ | ||||
| 						'Content-Type':'application/x-www-form-urlencoded', | ||||
| 					}, | ||||
| 				    filePath: url, | ||||
| 				    name: 'file', | ||||
| 				    formData: { | ||||
| 						'name':name, | ||||
| 				        'key': fileName,    | ||||
| 						'policy': this.oss.policy, | ||||
| 						'OSSAccessKeyId': this.oss.accessid, | ||||
| 						'success_action_status':200, | ||||
| 						'Signature': this.oss.signature, | ||||
| 				    }, | ||||
| 				    success: (uploadFileRes)=>{ | ||||
| 						this.newList.push(this.oss.host+fileName); | ||||
| 						this.uploadList = []; | ||||
| 						this.$emit('input',this.newList); | ||||
| 				    }, | ||||
| 					fail:(err)=>{ | ||||
| 						uni.showModal({ | ||||
| 							content: err.errMsg, | ||||
| 							showCancel: false | ||||
| 						}); | ||||
| 					} | ||||
| 				}); | ||||
| 				uploadTask.onProgressUpdate((res) => { | ||||
| 					this.uploadList.forEach((item,index)=>{ | ||||
| 						if(item.text == text){ | ||||
| 							item.progress = res.progress; | ||||
| 						} | ||||
| 					}) | ||||
| 				}); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
| 	.uploadTitle{ | ||||
| 		display: flex; | ||||
| 		align-items: center; | ||||
| 		justify-content: space-between; | ||||
| 		margin-bottom: 6px; | ||||
| 		.limit{ | ||||
| 			color: $uni-text-color-info; | ||||
| 		} | ||||
| 	} | ||||
| 	.imgList{ | ||||
| 		height: 100%; | ||||
| 		width: 100%; | ||||
| 		display: flex; | ||||
| 		flex-wrap: wrap; | ||||
| 		.uploadFlex{ | ||||
| 			display: flex; | ||||
| 		} | ||||
| 		.itemBox{ | ||||
| 			width: 32%; | ||||
| 			height: 100px; | ||||
| 			margin-right: 2%; | ||||
| 			padding: 7px 0 0 0; | ||||
| 			box-sizing: border-box; | ||||
| 			.imgItem{ | ||||
| 				width: 100%; | ||||
| 				height: 100%; | ||||
| 				position: relative; | ||||
| 				.itemImg{ | ||||
| 					width: 100%; | ||||
| 					height: 100%; | ||||
| 				} | ||||
| 				.img{ | ||||
| 					width: 100%; | ||||
| 					height: 100%; | ||||
| 					border-radius: 4px; | ||||
| 				} | ||||
| 				.deleteBox{ | ||||
| 					position: absolute; | ||||
| 					top: 3px; | ||||
| 					right: 3px; | ||||
| 					z-index: 20; | ||||
| 					width: 26px; | ||||
| 					height: 26px; | ||||
| 					border-radius: 50%; | ||||
| 					display: flex; | ||||
| 					align-items: center; | ||||
| 					justify-content: center; | ||||
| 					background: $uni-bg-color-delete; | ||||
| 					.icon{font-size: 14px;} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		.itemBox:nth-child(3n){ | ||||
| 			margin-right: 0; | ||||
| 		} | ||||
| 		.uploadBut{ | ||||
| 			height: 93px; | ||||
| 			display: flex; | ||||
| 			flex-direction: column; | ||||
| 			justify-content: center; | ||||
| 			align-items: center; | ||||
| 			background: $uni-bg-color-placeholder; | ||||
| 			border-radius: 4px; | ||||
| 			margin: 7px 0 0 0; | ||||
| 			padding: 0; | ||||
| 			box-sizing: border-box; | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	.img_but{ | ||||
| 		display: flex;flex-direction: column;align-items: center; | ||||
| 		.icon{color: $uni-text-color-inverse;} | ||||
| 		.text{margin-top: 5px;} | ||||
| 	} | ||||
| 	 | ||||
| 	.progressView{ | ||||
| 		position: absolute;bottom: 0;left: 0;z-index: 2; | ||||
| 		width: 100%;height: 6px;background: $uni-bg-color-placeholder;border-radius: 8px; | ||||
| 		.progressWidth{ | ||||
| 			height: 6px;background: $uni-color-primary; | ||||
| 			border-radius: 8px; | ||||
| 		} | ||||
| 	} | ||||
| </style> | ||||
							
								
								
									
										18
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								main.js
									
									
									
									
									
								
							| @@ -8,18 +8,19 @@ import searchView from './components/searchView/index' | ||||
| import loadMore from './components/loadMore/index' | ||||
| import progressBar from './components/progressBar' | ||||
| import pickerSelect from './components/pickerSelect/index' | ||||
| import calendar from './components/calendar/index' | ||||
|  | ||||
| import calendar from './components/calendar/index' | ||||
| import uploadImg from './components/upload/uploadImg' | ||||
| // #ifndef VUE3 | ||||
| import Vue from 'vue' | ||||
| import App from './App' | ||||
| import svg from './static/iconfont/svg.js' | ||||
|  | ||||
| Vue.component('search-view',searchView); | ||||
| Vue.component('load-more',loadMore); | ||||
| Vue.component('progress-bar',progressBar); | ||||
| Vue.component('picker-select',pickerSelect); | ||||
| Vue.component('calendar',calendar); | ||||
| Vue.component('search-view', searchView); | ||||
| Vue.component('load-more', loadMore); | ||||
| Vue.component('progress-bar', progressBar); | ||||
| Vue.component('picker-select', pickerSelect); | ||||
| Vue.component('calendar', calendar); | ||||
| Vue.component('upload-img', uploadImg); | ||||
|  | ||||
|  | ||||
| Vue.use(svg); | ||||
| @@ -47,7 +48,8 @@ export function createApp() { | ||||
|   app.component('loadMore', loadMore); | ||||
|   app.component('progressBar', progressBar); | ||||
|   app.component('pickerSelect', pickerSelect); | ||||
|   app.component('calendar',calendar); | ||||
|   app.component('calendar', calendar); | ||||
|   app.component('uploadImg', uploadImg); | ||||
|    | ||||
|   app.config.globalProperties.$api = request; | ||||
|   app.config.globalProperties.$wf = publicMethods; | ||||
|   | ||||
							
								
								
									
										11
									
								
								pages.json
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								pages.json
									
									
									
									
									
								
							| @@ -111,16 +111,23 @@ | ||||
| 		"style" :  | ||||
| 		{ | ||||
| 			"navigationBarTitleText" : "硬件设备报修", | ||||
| 			"enablePullDownRefresh" : false | ||||
| 			"enablePullDownRefresh" : true | ||||
| 		} | ||||
| 	}, | ||||
| 	{ | ||||
| 		"path" : "pages/deviceRepair/RepairReport", | ||||
| 		"path" : "pages/deviceRepair/repairReport", | ||||
| 		"style" :  | ||||
| 		{ | ||||
| 			"navigationBarTitleText" : "设备报修", | ||||
| 			"enablePullDownRefresh" : false | ||||
| 		} | ||||
| 	}, | ||||
| 	{ | ||||
| 		"path":"pages/deviceRepair/deviceDetail", | ||||
| 		"style" :{ | ||||
| 			"navigationBarTitleText" : "设备报修详情", | ||||
| 			"enablePullDownRefresh" : false | ||||
| 		} | ||||
| 	}, | ||||
| 	{ | ||||
| 		"path" : "pages/deviceStatus/deviceStatus", | ||||
|   | ||||
| @@ -3,72 +3,51 @@ | ||||
| 	<view class="page_padding"> | ||||
| 		<view class="page_content contentboxsty font14"> | ||||
| 			<view class="content_row"> | ||||
| 				<view class="name">值班工程师</view> | ||||
| 				<view class="name font_bold">值班工程师</view> | ||||
| 				<view class="flex1"> | ||||
| 					<picker placeholder="请选择设备" @change="bindPickerChange" :value="index" :range="array" > | ||||
| 						 <input type="text" :value="array[index]"  placeholder="请选择设备" disabled /> | ||||
| 					</picker> | ||||
| 					<pickerSelect class="comView" @change="bindOperatorChange" :list="setMap.operatorList" :id="form.operator_id" placeholder="请选择工程师" /> | ||||
| 				</view> | ||||
| 				<view class="iconfont icon-xiala"></view> | ||||
| 			</view> | ||||
| 			<view class="content_row"> | ||||
| 				<view class="name">故障时间</view> | ||||
| 				<view class="name font_bold">故障时间</view> | ||||
| 				<view class="flex1"> | ||||
| 					<view :class="[downtime ? 'haveTime' : 'noTime']"> | ||||
| 						<uni-datetime-picker placeholder="清选择时间" type="datetime" v-model="downtime" @change="changeLog" /> | ||||
| 					<view class='input_date' :class="[form.failure_at && form.failure_at!=''? 'haveTime' : '']"> | ||||
| 						<uni-datetime-picker placeholder="请选择时间" type="datetime" v-model="form.failure_at" /> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 				<!-- <view class=""></view> --> | ||||
| 			</view> | ||||
| 			<view class="content_row"> | ||||
| 				<view class="name">报修时间</view> | ||||
| 				<view class=""> | ||||
| 					<view :class="[repairtime ? 'haveTime' : 'noTime']"> | ||||
| 						<uni-datetime-picker placeholder="清选择时间" type="datetime" v-model="repairtime" @change="changeLog" /> | ||||
| 				<view class="name font_bold">报修时间</view> | ||||
| 				<view class="flex1"> | ||||
| 					<view class='input_date' :class="[form.report_at && form.report_at!=''? 'haveTime' : '']"> | ||||
| 						<uni-datetime-picker placeholder="请选择时间" type="datetime" v-model="form.report_at" /> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 				<view class=""></view> | ||||
| 			</view> | ||||
| 			<view class="content_row"> | ||||
| 				<view class="name">报修人</view> | ||||
| 				<view class=""> | ||||
| 					<picker placeholder="请选择" @change="bindPickerChange" :value="index" :range="array" > | ||||
| 						 <input type="text" :value="array[index]"  placeholder="请选择" disabled /> | ||||
| 					</picker> | ||||
| 				<view class="name font_bold">报修人</view> | ||||
| 				<view class="flex1"> | ||||
| 					<pickerSelect class="comView" @change="bindRepairChange" :list="setMap.operatorList" :id="form.report_id" placeholder="请选择报修人" /> | ||||
| 				</view> | ||||
| 				<view class=""></view> | ||||
| 			</view> | ||||
| 			<view class="content_row"> | ||||
| 				<view class="name">报修设备</view> | ||||
| 				<view class=""> | ||||
| 					<picker placeholder="请选择" @change="bindPickerChange" :value="index" :range="array" > | ||||
| 						 <input type="text" :value="array[index]"  placeholder="请选择" disabled /> | ||||
| 					</picker> | ||||
| 				<view class="name font_bold">报修设备</view> | ||||
| 				<view class="flex1"> | ||||
| 					<pickerSelect class="comView" @change="bindeQuipmentChange" :list="setMap.equipmentList" :id="form.equipment_id" placeholder="请选择报修设备" /> | ||||
| 				</view> | ||||
| 				<view class=""></view> | ||||
| 			</view> | ||||
| 			<view class="textarea_row"> | ||||
| 				<view class="name">故障描述</view> | ||||
| 					<textarea placeholder="请输入维修描述..."/> | ||||
| 					<!-- <uni-easyinput type="textarea" v-model="value" placeholder="请输入维修描述..."></uni-easyinput> --> | ||||
| 					 | ||||
| 				<view class="name font_bold">故障描述</view> | ||||
| 				<textarea class="textarea" placeholder="请输入故障描述..." v-model="form.remark" cursor-spacing="180px" :auto-blur="true" placeholder-class="placeholderStyle"/> | ||||
| 			</view> | ||||
| 			<view class="img_row"> | ||||
| 				<view class="name">故障照片</view> | ||||
| 				<uni-file-picker limit="3" v-model="imageValue"  title=""> | ||||
| 					<view class="img_but"> | ||||
| 						<view class="iconfont icon-a-shangchuanzhaopian2 font35"></view> | ||||
| 						<view class="font12"> | ||||
| 							上传图片 | ||||
| 						</view> | ||||
| 					</view> | ||||
| 				</uni-file-picker> | ||||
| 			<view class="img_row"> | ||||
| 				<uploadImg limit="3" name="故障图片" :list="form.failure_photo" /> | ||||
| 			</view> | ||||
| 		</view> | ||||
| 	</view> | ||||
| 	<view class="bottom_but flex_layout"> | ||||
| 		<view class="font13">保存</view> | ||||
| 		<view class="font13">取消</view> | ||||
| 		<view class="bottom_but flex_layout"> | ||||
| 			<view class="font13 but_color" @click="save">保存</view> | ||||
| 			<view class="font13" @click="cancel">取消</view> | ||||
| 		</view> | ||||
| 	</view> | ||||
| </template> | ||||
|  | ||||
| @@ -76,22 +55,113 @@ | ||||
| 	export default { | ||||
| 		data() { | ||||
| 			return { | ||||
| 				array: ['中国', '美国', '巴西', '日本'], | ||||
| 				downtime:'', | ||||
| 				setMap:{ | ||||
| 					operatorList:[], | ||||
| 					equipmentList:[], | ||||
| 				}, | ||||
| 				form:{ | ||||
| 					id:'', | ||||
| 					operator_id:'', | ||||
| 					failure_at:'', | ||||
| 					report_at:'', | ||||
| 					report_id:'', | ||||
| 					equipment_id:'', | ||||
| 					remark:'', | ||||
| 					failure_photo:[], | ||||
| 				}, | ||||
| 				id:0, | ||||
| 				 | ||||
| 				oss:{}, | ||||
| 			} | ||||
| 		}, | ||||
| 		methods: { | ||||
| 			changeLog(){ | ||||
| 				console.log(this.downtime) | ||||
| 		}, | ||||
| 		onLoad(option) { | ||||
| 			if(option.id != undefined){ | ||||
| 				this.getInfo(Number(option.id)); | ||||
| 			} | ||||
| 		}, | ||||
| 		mounted() { | ||||
| 			this.userList(); | ||||
| 			this.equipment(); | ||||
| 		}, | ||||
| 		methods: { | ||||
| 			getInfo(id){ | ||||
| 				this.$api.request('/equipment.repair.info',{id:id}).then(res=>{ | ||||
| 					this.form = { | ||||
| 						id:id, | ||||
| 						operator_id:res.data.operator_id, | ||||
| 						failure_at:res.data.failure_at, | ||||
| 						report_at:res.data.report_at, | ||||
| 						report_id:res.data.report_id, | ||||
| 						equipment_id:res.data.equipment_id, | ||||
| 						remark:res.data.remark, | ||||
| 						failure_photo:res.data.failure_photo, | ||||
| 					} | ||||
| 				}).catch(err=>{}) | ||||
| 			}, | ||||
| 			userList(){ | ||||
| 				this.$api.request('/user.options','').then(res=>{ | ||||
| 					res.data.forEach(item=>{ | ||||
| 						item.value = item.id; | ||||
| 					}) | ||||
| 					this.setMap['operatorList'] = res.data; | ||||
| 				}).catch(err=>{}) | ||||
| 			}, | ||||
| 			equipment(){ | ||||
| 				this.$api.request('/device.options','').then(res=>{ | ||||
| 					res.data.forEach(item=>{ | ||||
| 						item.name = item.name; | ||||
| 						item.value = item.id; | ||||
| 					}) | ||||
| 					this.setMap['equipmentList'] = res.data; | ||||
| 				}).catch(err=>{}) | ||||
| 			}, | ||||
| 			bindOperatorChange(e){ | ||||
| 				this.form.operator_id = e.value; | ||||
| 			}, | ||||
| 			bindRepairChange(e){ | ||||
| 				this.form.report_id = e.value; | ||||
| 			}, | ||||
| 			bindeQuipmentChange(e){ | ||||
| 				this.form.equipment_id = e.value; | ||||
| 			}, | ||||
| 			save(){ | ||||
| 				this.$api.postFuncLoading('/create.repair.notice',this.form).then(res=>{ | ||||
| 					this.parentClick(); | ||||
| 					this.reset(); | ||||
| 					this.$wf.toast({type:'success',text:'保存成功'}); | ||||
| 				}).catch(err=>{}) | ||||
| 			}, | ||||
| 			cancel(){ | ||||
| 				this.reset(); | ||||
| 			}, | ||||
| 			reset(){ | ||||
| 				this.form = { | ||||
| 					id:'', | ||||
| 					operator_id:'', | ||||
| 					failure_at:'', | ||||
| 					report_at:'', | ||||
| 					report_id:'', | ||||
| 					equipment_id:'', | ||||
| 					remark:'', | ||||
| 					failure_photo:[], | ||||
| 				} | ||||
| 			}, | ||||
| 			parentClick(){ | ||||
| 				const pages = getCurrentPages(); | ||||
| 				if (pages.length >= 2) { | ||||
| 					const prevPage = pages[pages.length - 2]; | ||||
| 					prevPage.$vm.getList(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
| <style scoped lang="scss"> | ||||
| 	.page_padding{padding-bottom: 100px;} | ||||
| 	.page_content{padding: 0 12px 10px;} | ||||
| 	.content_row{display: flex;border-bottom: 1px solid #2D3A6F;height: 44px;align-items: center; | ||||
| 		.name{width: 30%;} | ||||
| 		.name{flex-basis: 96px;} | ||||
| 		.flex_layout{ | ||||
| 			.contenticon{width: 20px;height: 20px;} | ||||
| 			.text{padding: 0 20px 0 5px;} | ||||
| @@ -99,21 +169,10 @@ | ||||
| 	} | ||||
| 	.textarea_row{ | ||||
| 		.name{padding: 12px 0;} | ||||
| 		textarea{border-radius: 4px;background: rgba(255, 255, 255, 0.50);padding: 10px;height: 100px;} | ||||
| 		.textarea{border-radius: 4px;background: $uni-bg-color-placeholder;padding: 10px;width: 100%;box-sizing: border-box;} | ||||
| 	} | ||||
| 	.img_row{ | ||||
| 		.name{padding: 12px 0;} | ||||
| 		.file-title {color: #fff;} | ||||
| 		.is-add{background: rgba(255, 255, 255, 0.5);} | ||||
| 		.img_but{    position: relative;display: flex;align-items: center;justify-content: center;flex-direction: column;} | ||||
| 	.img_row{ | ||||
| 		padding: 12px 0 6px 0; | ||||
| 		height: 100%; | ||||
| 	} | ||||
| 	 | ||||
| 	.uni-date-x{ | ||||
| 		    background-color: #1C2755 !important;color: #fff!important; | ||||
| 	} | ||||
| 	.uni-date-x--border{border:none !important} | ||||
| 	.haveTime{ | ||||
| 		.uni-date__x-input{color: #fff;} | ||||
| 	} | ||||
| 	.noTime{.uni-date__x-input{color: #666;}} | ||||
| </style> | ||||
|   | ||||
							
								
								
									
										117
									
								
								pages/deviceRepair/deviceDetail.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										117
									
								
								pages/deviceRepair/deviceDetail.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,117 @@ | ||||
| <template> | ||||
| 	<view class="page_padding"> | ||||
| 		<view class="padd_bot12 font14 flex_layout"> | ||||
| 			<text>{{type==1?'硬件设备报修详情':'硬件设备维修详情'}}</text> | ||||
| 		</view> | ||||
| 		<view class="detail_list padd_top12 contentboxsty page_content font13"> | ||||
| 			<template v-if="type==2"> | ||||
| 				<view class="row flex_layout"> | ||||
| 					<view class="name font_bold">维修工程师</view> | ||||
| 					<view class="text">{{info.repair_name}}</view> | ||||
| 				</view> | ||||
| 				<view class="row flex_layout"> | ||||
| 					<view class="name font_bold">故障解除时间</view> | ||||
| 					<view class="text">{{info.repair_at_label}}</view> | ||||
| 				</view> | ||||
| 				<view class="row"> | ||||
| 					<view class="name font_bold">维修描述</view> | ||||
| 					<view class="text remarkText padd_top12">{{info.repair_remark}}</view> | ||||
| 				</view> | ||||
| 				<view class="row"> | ||||
| 					<view class="name font_bold">维修照片</view> | ||||
| 					<view class="text imgList"> | ||||
| 						<view class="imgView" v-for="(em,ind) in info.repair_photo" :key="ind"> | ||||
| 							<image class="img" :src="em" mode="aspectFill" @click="imgPreview(info.repair_photo,em)"></image> | ||||
| 						</view> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</template> | ||||
| 			 | ||||
| 			<template v-if="type ==1"> | ||||
| 				<view class="row flex_layout"> | ||||
| 					<view class="name font_bold">值班工程师</view> | ||||
| 					<view class="text">{{info.operator_name}}</view> | ||||
| 				</view> | ||||
| 				<view class="row flex_layout"> | ||||
| 					<view class="name font_bold">故障时间</view> | ||||
| 					<view class="text">{{info.failure_at}}</view> | ||||
| 				</view> | ||||
| 				<view class="row flex_layout"> | ||||
| 					<view class="name font_bold">报修时间</view> | ||||
| 					<view class="text">{{info.report_at}}</view> | ||||
| 				</view> | ||||
| 				<view class="row flex_layout"> | ||||
| 					<view class="name font_bold">报修人</view> | ||||
| 					<view class="text">{{info.repair_name}}</view> | ||||
| 				</view> | ||||
| 				<view class="row flex_layout"> | ||||
| 					<view class="name font_bold">报修设备</view> | ||||
| 					<view class="text">{{info.eq_name}}</view> | ||||
| 				</view> | ||||
| 				<view class="row"> | ||||
| 					<view class="name font_bold">故障描述</view> | ||||
| 					<view class="text remarkText padd_top12">{{info.remark}}</view> | ||||
| 				</view> | ||||
| 				<view class="row"> | ||||
| 					<view class="name font_bold">故障照片</view> | ||||
| 					<view class="text imgList"> | ||||
| 						<view class="imgView" v-for="(em,ind) in info.failure_photo" :key="ind"> | ||||
| 							<image class="img" :src="em" mode="aspectFill" @click="imgPreview(info.failure_photo,em)"></image> | ||||
| 						</view> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</template> | ||||
| 		</view> | ||||
| 	</view> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| 	export default{ | ||||
| 		data(){ | ||||
| 			return{ | ||||
| 				type:1, | ||||
| 				id:0, | ||||
| 				info:{} | ||||
| 			} | ||||
| 		}, | ||||
| 		onLoad(option) { | ||||
| 			this.type = option.type; | ||||
| 			this.id = option.id; | ||||
| 		}, | ||||
| 		mounted() { | ||||
| 			this.getData(); | ||||
| 		}, | ||||
| 		methods:{ | ||||
| 			getData(){ | ||||
| 				this.$api.postFuncLoading('/equipment.repair.info',{id:this.id}).then(res=>{ | ||||
| 					this.info = res.data; | ||||
| 				}).catch(err=>{}) | ||||
| 			}, | ||||
| 			imgPreview(list,url){ | ||||
| 				uni.previewImage({ | ||||
| 					urls: list, | ||||
| 					current:url, | ||||
| 				}); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
| 	.row{ | ||||
| 		padding-bottom: 12px; | ||||
| 		.name{flex-basis: 90px;} | ||||
| 		.text{flex: 1;} | ||||
| 	} | ||||
| 	.row:last-child{ | ||||
| 		padding-bottom: 0; | ||||
| 	} | ||||
| 	.imgList{ | ||||
| 		display: flex;flex-direction: row;flex-wrap: wrap;padding: 6px 0; | ||||
| 		.imgView{width: 32%;height: 100px;margin-right: 2%;box-sizing: border-box;padding: 6px 0 0 0;} | ||||
| 		.imgView:nth-child(3n){ | ||||
| 			margin-right: 0; | ||||
| 		} | ||||
| 		.img{width: 100%;height: 100%;border-radius:4px;} | ||||
| 	} | ||||
| </style> | ||||
| @@ -2,45 +2,50 @@ | ||||
| 	<!-- 设备报修 --> | ||||
| 	<view class="page_padding bot_padding"> | ||||
| 		<view v-for="(item,index) in list" :key="index">	 | ||||
| 			<view class="page_list contentboxsty font13"> | ||||
| 			<view class="page_list contentboxsty font13" @click="toDetail(item)"> | ||||
| 				<view class="list_top flex_layout"> | ||||
| 					<view class="top_left flex_layout"> | ||||
| 						<view class="iconfont icon-gengduo-1"></view> | ||||
| 						<view class="">双头带锯</view> | ||||
| 						<view class="icon iconfont icon-daiju"></view> | ||||
| 						<view class="font_bold">{{item.eq_name}}</view> | ||||
| 					</view> | ||||
| 					<view class="card_right top_right"> | ||||
| 						<text class="status error">故障中</text> | ||||
| 					</view> | ||||
| 					<view class="top_right">故障中</view> | ||||
| 				</view> | ||||
| 				<view class="list_centre"> | ||||
| 				<view class="list_centre padd_bot12"> | ||||
| 					<view class="row_data"> | ||||
| 						<view class="row_name">值班工程师</view> | ||||
| 						<view class="row_content">章三</view> | ||||
| 						<view class="name font_bold">值班工程师</view> | ||||
| 						<view class="text">{{item.operator_name}}</view> | ||||
| 					</view> | ||||
| 					<view class="row_data"> | ||||
| 						<view class="name font_bold">故障时间</view> | ||||
| 						<view class="text">{{item.failure_at}}</view> | ||||
| 					</view> | ||||
| 					 | ||||
| 					<view class="row_data"> | ||||
| 						<view class="name font_bold">报修人</view> | ||||
| 						<view class="text">{{item.repair_name}}</view> | ||||
| 					</view> | ||||
| 					<view class="row_data"> | ||||
| 						<view class="row_name">故障时间</view> | ||||
| 						<view class="row_content">2024-01-11 13:09:11</view> | ||||
| 						<view class="name font_bold">报修时间</view> | ||||
| 						<view class="text">{{item.report_at}}</view> | ||||
| 					</view> | ||||
| 					<view class="row_data"> | ||||
| 						<view class="row_name">报修人</view> | ||||
| 						<view class="row_content">李四</view> | ||||
| 						<view class="name font_bold">处理状态</view> | ||||
| 						<view class="text">{{item.status_label}}</view> | ||||
| 					</view> | ||||
| 					<view class="row_data"> | ||||
| 						<view class="row_name">故障时间</view> | ||||
| 						<view class="row_content">3.5H</view> | ||||
| 					</view> | ||||
| 					<view class="row_data"> | ||||
| 						<view class="row_name">处理状态</view> | ||||
| 						<view class="row_content">故障处理中</view> | ||||
| 					</view> | ||||
| 					<view class="row_data"> | ||||
| 						<view class="row_name">故障解除时间</view> | ||||
| 						<view class="row_content">2024-01-11 14:09:07</view> | ||||
| 						<view class="name font_bold">故障解除时间</view> | ||||
| 						<view class="text">{{item.repair_at_label}}</view> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 				<view class="list_below flex_layout"> | ||||
| 					<view class="below_left" @click="toRepairOrder()"> | ||||
| 					<view class="below_left btn" @click.stop="toRepairOrder(item)"> | ||||
| 						<text class="icon iconfont icon-bianji font16"></text> | ||||
| 						维修单 | ||||
| 					</view> | ||||
| 					<view class="below_right"> | ||||
| 					<view class="below_right btn" @click.stop="editRepairOrder(item)"> | ||||
| 						<text class="icon iconfont icon-bianji font16"></text> | ||||
| 						修改 | ||||
| 					</view> | ||||
| 				</view> | ||||
| @@ -49,13 +54,9 @@ | ||||
| 	</view> | ||||
| 	<view class="page_bottom_button"> | ||||
| 		<view class="page_add"  @click="toAddRepairReport()"> | ||||
| 		<!-- 	<view class="name_left font14"> | ||||
| 				系统设备管理 | ||||
| 			</view> --> | ||||
| 			<view class="iconfont icon-tianjia font24"></view> | ||||
| 			<text>添加</text> | ||||
| 			<view class="icon iconfont icon-tianjia font20"></view> | ||||
| 			<text class="font14">添加</text> | ||||
| 		</view> | ||||
| 		 | ||||
| 	</view> | ||||
| </template> | ||||
|  | ||||
| @@ -63,49 +64,128 @@ | ||||
| 	export default { | ||||
| 		data() { | ||||
| 			return { | ||||
| 				list:[{name:"双头立锯"}, | ||||
| 				{name:"双头立锯"}, | ||||
| 				{name:"双头立锯"}, | ||||
| 				{name:"双头立锯"}, | ||||
| 				{name:"双头立锯"}, | ||||
| 				{name:"双头立锯"}, | ||||
| 				{name:"双头立锯"}, | ||||
| 				{name:"双头立锯"}, | ||||
| 				{name:"双头立锯"}, | ||||
| 				] | ||||
| 				params:{ | ||||
| 					page:1, | ||||
| 					pageSize:10, | ||||
| 				}, | ||||
| 				loadParams:{ | ||||
| 					noData:false, | ||||
| 					loading:false, | ||||
| 					loadEnd:false | ||||
| 				}, | ||||
| 				list:[], | ||||
| 			} | ||||
| 		}, | ||||
| 		mounted() { | ||||
| 			this.getList(); | ||||
| 		}, | ||||
| 		// 上拉刷新 | ||||
| 		onPullDownRefresh(){ | ||||
| 			this.params.page = 1; | ||||
| 			this.loadParams = { | ||||
| 				noData:false, | ||||
| 				loading:false, | ||||
| 				loadEnd:false | ||||
| 			}; | ||||
| 			this.getList(2); | ||||
| 		}, | ||||
| 		// 加载下一页 | ||||
| 		onReachBottom(){ | ||||
| 			if(!(this.loadParams.loadEnd || this.loadParams.noData)){ | ||||
| 				this.loadParams.loading = true; | ||||
| 				this.params.page ++; | ||||
| 				this.getList(); | ||||
| 			} | ||||
| 		}, | ||||
| 		methods: { | ||||
| 		methods: { | ||||
| 			getList(type=1){ | ||||
| 				if(this.params.page == 1){ | ||||
| 					uni.showLoading({ | ||||
| 						title: '加载中', | ||||
| 						mask: true | ||||
| 					}) | ||||
| 				} | ||||
| 				this.$api.request('/equipment.repair.list',this.params).then(res=>{ | ||||
| 					if(type ==2){ | ||||
| 						uni.stopPullDownRefresh(); | ||||
| 					} | ||||
| 					setTimeout( ()=> { | ||||
| 						uni.hideLoading(); | ||||
| 					}, 200); | ||||
| 					 | ||||
| 					this.loadParams.loading = false; | ||||
| 					if(res.data.rows.length ==0 && this.params.page == 1){ | ||||
| 						this.loadParams.noData = true; | ||||
| 					} | ||||
| 					if(res.data.rows.length>0 && res.data.rows.length < this.params.pageSize){ | ||||
| 						this.loadParams.loadEnd = true; | ||||
| 					} | ||||
| 					if(this.params.page == 1){ | ||||
| 						this.list = res.data.rows; | ||||
| 					}else{ | ||||
| 						this.list = this.list.concat(res.data.rows); | ||||
| 					} | ||||
| 				}).catch(err=>{ | ||||
| 					setTimeout(()=> { | ||||
| 					 	uni.hideLoading(); | ||||
| 					}, 200); | ||||
| 				}) | ||||
| 			}, | ||||
| 			 | ||||
| 			//新增报修页面 | ||||
| 			toAddRepairReport(){ | ||||
| 					uni.navigateTo({ | ||||
| 						url:'/pages/deviceRepair/RepairReport' | ||||
| 					}) | ||||
| 				uni.navigateTo({ | ||||
| 					url:'/pages/deviceRepair/repairReport' | ||||
| 				}) | ||||
| 			}, | ||||
| 			//维修页面 | ||||
| 			toRepairOrder(){ | ||||
| 				uni.navigateTo({ | ||||
| 					url:'/pages/deviceRepair/repairOrder' | ||||
| 			toRepairOrder(item){ | ||||
| 				// if(item.repair_id && item.repair_id>0){ | ||||
| 				// 	uni.navigateTo({ | ||||
| 				// 		url:'./deviceDetail?id='+item.id+'&type='+2 | ||||
| 				// 	}) | ||||
| 				// }else{ | ||||
| 				// 	uni.navigateTo({ | ||||
| 				// 		url:'/pages/deviceRepair/repairOrder?id='+item.id | ||||
| 				// 	}) | ||||
| 				// } | ||||
| 				uni.navigateTo({ | ||||
| 					url:'/pages/deviceRepair/repairOrder?id='+item.id | ||||
| 				}) | ||||
| 			}, | ||||
| 			editRepairOrder(item){ | ||||
| 				uni.navigateTo({ | ||||
| 					url:'/pages/deviceRepair/repairReport?id='+item.id | ||||
| 				}) | ||||
| 			}, | ||||
| 			toDetail(item){ | ||||
| 				uni.navigateTo({ | ||||
| 					url:'./deviceDetail?id='+item.id+'&type='+1 | ||||
| 				}) | ||||
| 			} | ||||
| 			 | ||||
| 		} | ||||
| 	} | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
| <style scoped lang="scss"> | ||||
| 	.page_list{ | ||||
| 		.list_top{line-height: 44px;align-items: center;border-bottom: 1px solid #2D3A6F; | ||||
| 			.top_left{flex: 1;} | ||||
| 		.list_top{height: 44px;align-items: center;border-bottom: 1px solid $uni-border-color-primary; | ||||
| 			.top_left{flex: 1;display: flex;align-items: center; | ||||
| 				.icon{margin-right: 5px;color: $uni-text-color-primary;} | ||||
| 			} | ||||
| 		} | ||||
| 		.list_centre{ | ||||
| 			.row_name{width: 30%;} | ||||
| 			.row_data{display: flex;display: flex;padding: 6px 0;} | ||||
| 		.list_centre{ | ||||
| 			.row_data{ | ||||
| 				display: flex;align-items: center;padding-top: 12px; | ||||
| 				.name{flex-basis: 95px;} | ||||
| 				.text{display: flex;display: flex;} | ||||
| 			} | ||||
| 		} | ||||
| 		.list_below{line-height: 49px;align-items: center;border-top: 1px solid #2D3A6F; | ||||
| 			view{width: 50%;    text-align: center;} | ||||
| 			.below_left{border-right: 1px solid #2D3A6F;} | ||||
| 		.list_below{height: 49px;align-items: center;border-top: 1px solid $uni-border-color-primary; | ||||
| 			.btn{width: 50%;display: flex;align-items: center;justify-content: center;height: 100%; | ||||
| 				.icon{margin-right: 5px;} | ||||
| 			} | ||||
| 			.below_left{border-right: 1px solid $uni-border-color-primary;} | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
| </style> | ||||
|   | ||||
| @@ -3,67 +3,118 @@ | ||||
| 	<view class="page_padding"> | ||||
| 		<view class="page_content contentboxsty font14"> | ||||
| 			<view class="content_row"> | ||||
| 				<view class="name">维修工程师</view> | ||||
| 				<view class="name font_bold">维修工程师</view> | ||||
| 				<view class="flex1"> | ||||
| 					<picker placeholder="请选择" @change="bindPickerChange" :value="index" :range="array" > | ||||
| 						 <input type="text" :value="array[index]"  placeholder="请选择" disabled /> | ||||
| 					</picker> | ||||
| 					<pickerSelect class="comView" @change="bindPickerChange" :list="setMap.operatorList" :id="form.repair_id" placeholder="请选择工程师" /> | ||||
| 				</view> | ||||
| 				<view class="iconfont icon-xiala"></view> | ||||
| 			</view> | ||||
| 			<view class="content_row"> | ||||
| 				<view class="name">故障解除时间</view> | ||||
| 				<view class="flex1"> | ||||
| 					<view :class="[downtime ? 'haveTime' : 'noTime']"> | ||||
| 						<uni-datetime-picker placeholder="清选择时间" type="datetime" v-model="downtime" @change="changeLog" /> | ||||
| 				<view class="name font_bold">故障解除时间</view> | ||||
| 				<view class="flex1"> | ||||
| 					<view class='input_date' :class="[form.repair_at && form.repair_at!=''? 'haveTime' : '']"> | ||||
| 						<uni-datetime-picker placeholder="请选择时间" type="datetime" v-model="form.repair_at" /> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 			<view class="textarea_row"> | ||||
| 				<view class="name">维修描述</view> | ||||
| 					<textarea placeholder="请输入维修描述..."/> | ||||
| 					<!-- <uni-easyinput type="textarea" v-model="value" placeholder="请输入维修描述..."></uni-easyinput> --> | ||||
| 					 | ||||
| 				<view class="name font_bold">维修描述</view> | ||||
| 				<textarea class="textarea" v-model="form.repair_remark" placeholder="请输入维修描述..." cursor-spacing="180px" :auto-blur="true" placeholder-class="placeholderStyle" /> | ||||
| 			</view> | ||||
| 			<view class="img_row"> | ||||
| 				<view class="name">维修照片</view> | ||||
| 				<uni-file-picker limit="3" v-model="imageValue"  title=""> | ||||
| 					<view class="img_but"> | ||||
| 						<view class="iconfont icon-a-shangchuanzhaopian2 font35"></view> | ||||
| 						<view class="font12"> | ||||
| 							上传图片 | ||||
| 						</view> | ||||
| 					</view> | ||||
| 				</uni-file-picker> | ||||
| 			<view class="img_row"> | ||||
| 				<uploadImg limit="3" name="维修照片" :list="form.repair_photo" /> | ||||
| 			</view> | ||||
| 		</view> | ||||
| 	</view> | ||||
| 	<view class="bottom_but flex_layout"> | ||||
| 		<view class="font13">保存</view> | ||||
| 		<view class="font13">取消</view> | ||||
| 		<view class="bottom_but flex_layout"> | ||||
| 			<view class="font13 but_color" @click="save">保存</view> | ||||
| 			<view class="font13" @click="cancel">取消</view> | ||||
| 		</view> | ||||
| 	</view> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| 	export default { | ||||
| 		data() { | ||||
| 			return { | ||||
| 			return { | ||||
| 				setMap:{ | ||||
| 					operatorList:[], | ||||
| 				}, | ||||
| 				form:{ | ||||
| 					id:'', | ||||
| 					repair_id:'', | ||||
| 					repair_at:'', | ||||
| 					repair_remark:'', | ||||
| 					repair_photo:[] | ||||
| 				}, | ||||
| 				 | ||||
| 				array: ['中国', '美国', '巴西', '日本'], | ||||
| 				downtime:'', | ||||
| 			} | ||||
| 		}, | ||||
| 		onLoad(option) { | ||||
| 			if(option.id !=undefined){ | ||||
| 				// this.form.id = Number(option.id); | ||||
| 				this.getInfo(Number(option.id)); | ||||
| 			} | ||||
| 		}, | ||||
| 		mounted() { | ||||
| 			this.userList(); | ||||
| 		}, | ||||
| 		methods: { | ||||
| 			changeLog(){ | ||||
| 				console.log(this.downtime) | ||||
| 		methods: { | ||||
| 			getInfo(id){ | ||||
| 				this.$api.request('/equipment.repair.info',{id:id}).then(res=>{ | ||||
| 					this.form = { | ||||
| 						id:id, | ||||
| 						repair_id:res.data.repair_id, | ||||
| 						repair_at:res.data.repair_at, | ||||
| 						repair_remark:res.data.repair_remark, | ||||
| 						repair_photo:res.data.repair_photo, | ||||
| 					} | ||||
| 				}).catch(err=>{}) | ||||
| 			}, | ||||
| 			userList(){ | ||||
| 				this.$api.request('/user.options','').then(res=>{ | ||||
| 					res.data.forEach(item=>{ | ||||
| 						item.value = item.id; | ||||
| 					}) | ||||
| 					this.setMap['operatorList'] = res.data; | ||||
| 				}).catch(err=>{}) | ||||
| 			}, | ||||
| 			bindPickerChange(e){ | ||||
| 				this.form.repair_id = e.value; | ||||
| 			}, | ||||
| 			save(){ | ||||
| 				this.$api.postFuncLoading('/create.equipment.repair',this.form).then(res=>{ | ||||
| 					this.parentClick(); | ||||
| 					this.$wf.toast({type:'success',text:'保存成功'}); | ||||
| 				}).catch(err=>{}) | ||||
| 			}, | ||||
| 			cancel(){ | ||||
| 				this.reset(); | ||||
| 			}, | ||||
| 			reset(){ | ||||
| 				this.form = { | ||||
| 					id:'', | ||||
| 					repair_id:'', | ||||
| 					repair_at:'', | ||||
| 					repair_remark:'', | ||||
| 					repair_photo:[] | ||||
| 				} | ||||
| 			}, | ||||
| 			parentClick(){ | ||||
| 				const pages = getCurrentPages(); | ||||
| 				if (pages.length >= 2) { | ||||
| 					const prevPage = pages[pages.length - 2]; | ||||
| 					prevPage.$vm.getList(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
| <style scoped lang="scss"> | ||||
| 	.page_content{padding: 0 12px 10px;} | ||||
| 	.content_row{display: flex;border-bottom: 1px solid #2D3A6F;height: 44px;align-items: center; | ||||
| 		.name{width: 30%;} | ||||
| 		.name{flex-basis: 100px;} | ||||
| 		.flex_layout{ | ||||
| 			.contenticon{width: 20px;height: 20px;} | ||||
| 			.text{padding: 0 20px 0 5px;} | ||||
| @@ -71,21 +122,14 @@ | ||||
| 	} | ||||
| 	.textarea_row{ | ||||
| 		.name{padding: 12px 0;} | ||||
| 		textarea{border-radius: 4px;background: rgba(255, 255, 255, 0.50);padding: 10px;height: 100px;} | ||||
| 		.textarea{border-radius: 4px;background: $uni-bg-color-placeholder;padding: 10px;width: 100%;box-sizing: border-box;} | ||||
| 	} | ||||
| 	.img_row{ | ||||
| 		.name{padding: 12px 0;} | ||||
| 		.file-title {color: #fff;} | ||||
| 		.is-add{background: rgba(255, 255, 255, 0.5);} | ||||
| 		.img_but{    position: relative;display: flex;align-items: center;justify-content: center;flex-direction: column;} | ||||
| 	.img_row{ | ||||
| 		padding: 12px 0 6px 0; | ||||
| 		.img_but{ | ||||
| 			display: flex;flex-direction: column;align-items: center; | ||||
| 			.icon{color: $uni-text-color-inverse;} | ||||
| 			.text{margin-top: 5px;} | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	.uni-date-x{ | ||||
| 		    background-color: #1C2755 !important;color: #fff!important; | ||||
| 	} | ||||
| 	.uni-date-x--border{border:none !important} | ||||
| 	.haveTime{ | ||||
| 		.uni-date__x-input{color: #fff;} | ||||
| 	} | ||||
| 	.noTime{.uni-date__x-input{color: #666;}} | ||||
| </style> | ||||
|   | ||||
| @@ -8,7 +8,6 @@ | ||||
| 						<view class="name font_bold">设备名称</view> | ||||
| 						<view class="text"> | ||||
| 							{{item.name}} | ||||
| 							<view class="iconfont icon-bianji font20" @click.stop="toAddDevice(item.id)"></view> | ||||
| 						</view> | ||||
| 					</view> | ||||
| 					<view class="list_row padd_top12"> | ||||
| @@ -19,8 +18,11 @@ | ||||
| 						<view class="name font_bold">已绑定设备</view> | ||||
| 						<view class="text"> | ||||
| 							{{item.equipment_monitor_config && item.equipment_monitor_config.eq_name?item.equipment_monitor_config.eq_name:'-'}} | ||||
| 							<view class="iconfont icon-bangding font20" @click="toBindingDevice(item.id)"></view> | ||||
| 						</view> | ||||
| 					</view> | ||||
| 					<view class="rightBtnView"> | ||||
| 						<view class="iconfont icon-bianji font18" @click.stop="toAddDevice(item.id)"></view> | ||||
| 						<view class="iconfont icon-bangding font18" @click.stop="toBindingDevice(item.id)"></view> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
| @@ -128,8 +130,9 @@ | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
| 	.page_list{padding: 12px;} | ||||
| 	.page_list{padding: 12px;position: relative;} | ||||
| 	.list_row{display: flex;align-items: center;} | ||||
| 	.list_row .name{flex-basis: 84px;text-align: right;padding-right: 12px;box-sizing: border-box;} | ||||
| 	.list_row .text{flex: 1;display: flex;justify-content: space-between;align-items: center;} | ||||
| 	.list_row .text{flex: 1;display: flex;justify-content: space-between;align-items: center;} | ||||
| 	.rightBtnView{position: absolute;right: 12px;top: 12px;height: calc(100% - 24px);display: flex;flex-direction: column;justify-content: space-between;} | ||||
| </style> | ||||
|   | ||||
| @@ -86,9 +86,6 @@ | ||||
| 						{name:'',sn:"SO20240426000001",num:90,status:'待生产',type:1,time:'03:00'}, | ||||
| 						{name:'',sn:"SO20240426000001",num:90,status:'待生产',type:1}, | ||||
| 					], | ||||
| 					dateList:[ | ||||
| 						{time:'00:00'},{time:'00:30'},{time:'01:00'},{time:'03:30'},{time:'04:00'},{time:'05:30'} | ||||
| 					], | ||||
| 					dateList:[ | ||||
| 						{name:'日',id:'',value:'day'}, | ||||
| 						{name:'周',id:'',value:'week'}, | ||||
|   | ||||
| @@ -50,7 +50,6 @@ | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /* 加载更多部分 */ | ||||
| .noData{ | ||||
| 	margin: 50% auto; | ||||
| @@ -85,9 +84,34 @@ | ||||
| } | ||||
|  | ||||
|  | ||||
| /* picker 下啦选择 */ | ||||
| /* picker 下拉选择 */ | ||||
| .pickerBom{ | ||||
| 	display: flex; | ||||
| 	align-items: center; | ||||
| 	justify-content: space-between; | ||||
| } | ||||
|  | ||||
| /* 上传组件的自定义优化 */ | ||||
| .img_row .file-picker__box-content{ | ||||
| 	border: none !important; | ||||
| 	background: rgba(255, 255, 255, 0.5); | ||||
| 	border-radius: 4px !important; | ||||
| } | ||||
| .img_row .uni-file-picker__header .file-title{ | ||||
| 	color: #fff; | ||||
| 	font-weight: bold; | ||||
| } | ||||
|  | ||||
| /* 选择日期时间组件自定义优化 */ | ||||
| .input_date .uni-date-x--border{ | ||||
| 	border: 0; | ||||
| } | ||||
| .input_date .uni-date-x{ | ||||
| 	background: none; | ||||
| } | ||||
| .input_date .uni-date-x .icon-calendar{ | ||||
| 	padding: 0; | ||||
| } | ||||
| .input_date .uni-date-x .uni-icons{ | ||||
| 	display: none; | ||||
| } | ||||
| @@ -1,8 +1,8 @@ | ||||
| @font-face { | ||||
|   font-family: "iconfont"; /* Project id 4403683 */ | ||||
|   src: url('//at.alicdn.com/t/c/font_4403683_noneyo0uteq.woff2?t=1714293192496') format('woff2'), | ||||
|        url('//at.alicdn.com/t/c/font_4403683_noneyo0uteq.woff?t=1714293192496') format('woff'), | ||||
|        url('//at.alicdn.com/t/c/font_4403683_noneyo0uteq.ttf?t=1714293192496') format('truetype'); | ||||
|   src: url('//at.alicdn.com/t/c/font_4403683_vv40jcno6w9.woff2?t=1714724942805') format('woff2'), | ||||
|        url('//at.alicdn.com/t/c/font_4403683_vv40jcno6w9.woff?t=1714724942805') format('woff'), | ||||
|        url('//at.alicdn.com/t/c/font_4403683_vv40jcno6w9.ttf?t=1714724942805') format('truetype'); | ||||
| } | ||||
|  | ||||
| .iconfont { | ||||
| @@ -13,6 +13,10 @@ | ||||
|   -moz-osx-font-smoothing: grayscale; | ||||
| } | ||||
|  | ||||
| .icon-daiju:before { | ||||
|   content: "\e63a"; | ||||
| } | ||||
|  | ||||
| .icon-a-shexiangtou_shiti1:before { | ||||
|   content: "\e639"; | ||||
| } | ||||
|   | ||||
							
								
								
									
										3
									
								
								uni.scss
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								uni.scss
									
									
									
									
									
								
							| @@ -1,5 +1,3 @@ | ||||
| @import '@/uni_modules/uni-scss/variables.scss'; | ||||
|  | ||||
| /* 行为基本色 */ | ||||
| $uni-color-primary: #009688; | ||||
| $uni-color-success: #67C23A; | ||||
| @@ -42,6 +40,7 @@ $uni-bg-color-success-dark:rgba(103, 194, 58, 0.25); | ||||
| $uni-bg-color-warning-dark:rgba(230, 162, 60, 0.25); | ||||
| $uni-bg-color-error-dark:rgba(248, 69, 69, 0.25); | ||||
| $uni-bg-color-placeholder:rgba(255, 255, 255, 0.5); | ||||
| $uni-bg-color-delete:rgba(0, 0, 0, 0.5); | ||||
|  | ||||
|  | ||||
| /* 边框的颜色 */ | ||||
|   | ||||
							
								
								
									
										39
									
								
								utils/api.js
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								utils/api.js
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| import config from './envConfig.js'; | ||||
| import wf from './public.js' | ||||
| import wf from './public.js'; | ||||
|   | ||||
| const request = (url = '', data = {}, header = { | ||||
| 	'Authorization': 'Bearer '+uni.getStorageSync('mes_token') ? 'Bearer '+uni.getStorageSync('mes_token') : '', | ||||
| @@ -61,13 +61,13 @@ const request = (url = '', data = {}, header = { | ||||
| 		}) | ||||
| 	}) | ||||
| } | ||||
|  const postFuncLoading = (url = '', data = {}, header = { | ||||
| const postFuncLoading = (url = '', data = {}, header = { | ||||
|  	'Authorization': 'Bearer '+uni.getStorageSync('mes_token') ? 'Bearer '+uni.getStorageSync('mes_token') : '', | ||||
|  }) => { | ||||
| 	 uni.showLoading({ | ||||
| }) => { | ||||
| 	uni.showLoading({ | ||||
| 	 	title: '加载中', | ||||
| 	 	mask: true | ||||
| 	 }) | ||||
| 	}) | ||||
|  	return new Promise((resolve, reject) => { | ||||
|  		uni.request({ | ||||
|  			url: config.dev.VITE_BASE_API + url, //接口地址:前缀+方法中传入的地址 | ||||
| @@ -123,9 +123,34 @@ const request = (url = '', data = {}, header = { | ||||
|  			} | ||||
|  		}) | ||||
|  	}) | ||||
|  } | ||||
| } | ||||
|  | ||||
| const getOss = (url = '', data = {}, header = { | ||||
| 	'content-type':'application/json; charset=UTF-8', | ||||
| 	'Authorization':'' | ||||
| })=>{ | ||||
| 	return new Promise((resolve, reject) => { | ||||
| 		uni.request({ | ||||
| 			url: config.dev.VITE_OSS_URL + url, //接口地址:前缀+方法中传入的地址 | ||||
| 			method: "POST", | ||||
| 			dataType: "json", | ||||
| 			data: data, | ||||
| 			header: header, | ||||
| 			success:(res)=>{ | ||||
| 				if(res.data.code == 200){ | ||||
| 					resolve(res.data); | ||||
| 				} | ||||
| 			}, | ||||
| 			fail:(err)=>{ | ||||
| 				reject(err); | ||||
| 			} | ||||
| 		}) | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| export default { | ||||
| 	request, | ||||
| 	postFuncLoading | ||||
| 	postFuncLoading, | ||||
| 	getOss | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -2,11 +2,13 @@ | ||||
| const dev = { | ||||
|   ENV: "dev", | ||||
|   VITE_BASE_API: "https://api.dev.dwoodauto.com/mobile/v1", | ||||
|   VITE_OSS_URL: "https://cloud-wh-dev.dwood365.com/mobile/v1", | ||||
| }; | ||||
| //正式环境 | ||||
| const pro = { | ||||
|   ENV: "pro", | ||||
|   VITE_BASE_API: "https://api.dev.dwoodauto.com", | ||||
|   VITE_OSS_URL: "https://wf-api.dwood168.com/wh-mobile/v1", | ||||
| }; | ||||
| export default { | ||||
|   dev, | ||||
|   | ||||
							
								
								
									
										141
									
								
								utils/public.js
									
									
									
									
									
								
							
							
						
						
									
										141
									
								
								utils/public.js
									
									
									
									
									
								
							| @@ -19,10 +19,34 @@ const toast = function(params){ | ||||
|  | ||||
| // 0~9 对应小数转换 | ||||
| const numberToChineseLower = function(num) { | ||||
|     var chineseNums = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']; | ||||
|     return num.toString().split('').map(function(digit) { | ||||
|         return chineseNums[parseInt(digit)]; | ||||
|     }).join(''); | ||||
|     const chineseMonths = { | ||||
| 		'1': '一', | ||||
| 		'2': '二', | ||||
| 		'3': '三', | ||||
| 		'4': '四', | ||||
| 		'5': '五', | ||||
| 		'6': '六', | ||||
| 		'7': '七', | ||||
| 		'8': '八', | ||||
| 		'9': '九', | ||||
| 		'10': '十', | ||||
| 		'11': '十一', | ||||
| 		'12': '十二' | ||||
| 	}; | ||||
| 	return chineseMonths[num] || ''; | ||||
| } | ||||
|  | ||||
| const getToday = function() { | ||||
|     let today = new Date(); | ||||
|     let year = today.getFullYear(); | ||||
|     let month = today.getMonth() + 1; | ||||
|     let day = today.getDate(); | ||||
|  | ||||
|     let formattedMonth = month < 10 ? '0' + month : month; | ||||
|     let formattedDay = day < 10 ? '0' + day : day; | ||||
|  | ||||
|     // 返回格式化后的日期字符串,格式为 yyyy-mm-dd | ||||
|     return year + '-' + formattedMonth + '-' + formattedDay; | ||||
| } | ||||
|  | ||||
| const getDatesOfWeek = function() { | ||||
| @@ -273,12 +297,116 @@ const getNextMonthWeekCount = function(date = null) { | ||||
|     return totalWeeks; | ||||
| } | ||||
|  | ||||
| // 获取当前的日期 | ||||
| const getCurrentYearData = function() { | ||||
|     let today = new Date(); 		// 获取当前日期 | ||||
|     let year = today.getFullYear(); 	// 获取年份 | ||||
|     let yearData = []; 					// 存储当前年份的数据 | ||||
| 	 | ||||
|     // 循环遍历每个月份 | ||||
|     for (let month = 0; month < 12; month++) { | ||||
| 		let list = getCurrentMonthData(year,month+1); | ||||
|         let monthData = { | ||||
|             month: month + 1, 	// 月份从 1 开始 | ||||
|             weeks: list, 		// 存储该月份的所有周数据 | ||||
|         }; | ||||
|  | ||||
|         // 将该月份的数据添加到当前年份的数据中 | ||||
|         yearData.push(monthData); | ||||
|     } | ||||
|  | ||||
|     return yearData; | ||||
| } | ||||
|  | ||||
| // 获取上一年的日期 | ||||
| const getPreviousYearData = function(date = null) { | ||||
|     let currentDate = new Date(date); 						// 获取指定日期或者当前日期 | ||||
|     currentDate.setFullYear(currentDate.getFullYear() - 1); // 获取指定日期的上一年日期 | ||||
|     let year = currentDate.getFullYear(); 					// 获取年份 | ||||
|     let yearData = []; 										// 存储指定日期的上一年的数据 | ||||
|      | ||||
|     for (let month = 0; month < 12; month++) { | ||||
|         let list = getCurrentMonthData(year, month + 1); | ||||
|         let monthData = { | ||||
|             month: month + 1, | ||||
|             weeks: list, | ||||
|         }; | ||||
|  | ||||
|         yearData.push(monthData); | ||||
|     } | ||||
|  | ||||
|     return yearData; | ||||
| } | ||||
|  | ||||
| // 获取下一年的日期 | ||||
| const getNextYearData = function(date = null) { | ||||
|     let currentDate = new Date(date); 						// 获取指定日期或者当前日期 | ||||
|     currentDate.setFullYear(currentDate.getFullYear() + 1); // 获取指定日期的上一年日期 | ||||
|     let year = currentDate.getFullYear(); 					// 获取年份 | ||||
|     let yearData = []; 										// 存储指定日期的上一年的数据 | ||||
|      | ||||
|     for (let month = 0; month < 12; month++) { | ||||
|         let list = getCurrentMonthData(year, month + 1); | ||||
|         let monthData = { | ||||
|             month: month + 1, | ||||
|             weeks: list, | ||||
|         }; | ||||
|  | ||||
|         yearData.push(monthData); | ||||
|     } | ||||
|  | ||||
|     return yearData; | ||||
| } | ||||
|  | ||||
|  | ||||
| // 获取当前月的所有周 | ||||
| const getCurrentMonthData = function(year,month) { | ||||
| 	const startDate = new Date(year, month - 1, 1); | ||||
| 	const endDate = new Date(year, month, 0); | ||||
| 	const startDateDayOfWeek = startDate.getDay();  // 获取本月第一天是周几 | ||||
| 	const totalDays = endDate.getDate(); 			// 获取本月总天数 | ||||
|  | ||||
| 	let weeks = []; | ||||
| 	let currentWeek = []; | ||||
| 	let currentDate = new Date(startDate); | ||||
|  | ||||
| 	// 填充到本周开始 | ||||
| 	for (let i = 0; i < startDateDayOfWeek; i++) { | ||||
| 		currentWeek.push(null); | ||||
| 	} | ||||
| 	while (currentDate <= endDate) { | ||||
| 		let textMonth = month<10?'0'+month:month; | ||||
| 		let textDate = currentDate.getDate()<10?'0'+currentDate.getDate():currentDate.getDate(); | ||||
| 		currentWeek.push({ | ||||
| 			date: year +'-'+ textMonth +'-'+ textDate, | ||||
| 			name: ['一', '二', '三', '四', '五', '六','日'][currentDate.getDay()] | ||||
| 		}); | ||||
| 		currentDate.setDate(currentDate.getDate() + 1); | ||||
|  | ||||
| 		// 当前周已满,开始新周 | ||||
| 		if (currentWeek.length === 7) { | ||||
| 		  weeks.push(currentWeek); | ||||
| 		  currentWeek = []; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// 处理最后不满一周的情况 | ||||
| 	if (currentWeek.length > 0) { | ||||
| 		while (currentWeek.length < 7) { | ||||
| 		  currentWeek.push(null); | ||||
| 		} | ||||
| 		weeks.push(currentWeek); | ||||
| 	} | ||||
| 	return weeks; | ||||
| } | ||||
|  | ||||
|  | ||||
| export default { | ||||
| 	setLoginData, | ||||
| 	removeLoginData, | ||||
| 	toast, | ||||
| 	numberToChineseLower, | ||||
| 	getToday, | ||||
| 	getDatesOfWeek, | ||||
| 	getPreviousWeekDatesWithDays, | ||||
| 	getNextWeekDatesWithDays, | ||||
| @@ -286,5 +414,8 @@ export default { | ||||
| 	getPreviousMonthGroupedByWeek, | ||||
| 	getNextMonthGroupedByWeek, | ||||
| 	getPreviousMonthWeekCount, | ||||
| 	getNextMonthWeekCount, | ||||
| 	getNextMonthWeekCount, | ||||
| 	getCurrentYearData, | ||||
| 	getPreviousYearData, | ||||
| 	getNextYearData, | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user