Bladeren bron

工单详情

renmy 1 jaar geleden
bovenliggende
commit
f067a980ce
4 gewijzigde bestanden met toevoegingen van 287 en 168 verwijderingen
  1. 10 67
      common/http.js
  2. 209 62
      pages/index/orderDetail.vue
  3. 67 38
      pages/index/orderUp.vue
  4. 1 1
      pages/userAgreement/index.vue

+ 10 - 67
common/http.js

@@ -23,7 +23,7 @@ export function wxLogin(params) {
 }
 //登录用户协议
 export function getAgreement(){
-	return request.post("/system/config/configKey/sys.login.userAgreement")
+	return request.get("/system/config/configKey/sys.login.userAgreement")
 }
 //用户信息
 export function getInfoData(){
@@ -61,72 +61,15 @@ export function getOrderLogList(params){
 export function getOrderList(params){
 	return request.post("/mini/order/table/list",params)
 }
-
-
-
-
-//个人中心首页
-export function ucenterData(){
-	return request.post("/inquire/myData")
-}
-//个人中心联系客服
-export function getService(){
-	return request.post("/inquire/contact/service")
-}
-//个人中心换电记录
-export function exchangeRecord(params){
-	return request.post("/inquire/exchangeRecord",params)
-}
-//个人中心获取天数
-export function getDays(){
-	return request.post("/user/days")
-}
-//换电记录详情
-export function exchangeRecordShow(id){
-	return request.post(`/inquire/exchangeDetail/${id}`)
-}
-//个人中心我的车辆
-export function exchangeHistoryCar(data){
-	return request.post("/inquire/exchangeHistorical",data)
-}
-//个人中心获取所有车辆列表
-export function userCarList(data){
-	return request.post("/inquire/vehInfo",data)
-}
-//个人中心我的车辆详情
-export function exchangeCarDetail(plate){
-	return request.post(`/inquire/vehDetail?plate=${plate}`)
-}
-//用stationCode获取换电编号
-export function getStationExchange(params){
-	return request.post("/swap/getStationExchange",params)
-}
-//首页车辆信息
-export function homeCar(params){
-	return request.post("/inquire/homeCar",params)
-}
-//首页换电站信息
-export function homeStation(params){
-	return request.post("/inquire/homeStation",params)
-}
-//换电流程累计换电次数
-export function getExchangeTimes(params){
-	return request.post("/exchange/record/getExchangeNum",params)
-}
-
-//充电方式费率
-export function chargeMethod(){
-	return request.get("/inquire/chargeMethod")
-}
-//充电扫码验证
-export function verifyCharge(params){
-	return request.post("/charge/verify",params)
+//工单详情
+export function getOrderDetail(id){
+	return request.get("/mini/order/detail/getInfo/" + id)
 }
-//个人中心充电记录
-export function chargeRecord(params){
-	return request.post("/inquire/chargeRecord",params)
+//工单处理
+export function orderDeal(params){
+	return request.post("/mini/workOrderLog/add", params)
 }
-//获取指南
-export function getexchangeGuide(stationCode){
-	return request.post(`/inquire/exchangeGuide?stationCode=${stationCode}`,)
+//获取工单处理过程列表
+export function getOrderDealList(params){
+	return request.post("/mini/workOrderLog/getList", params)
 }

+ 209 - 62
pages/index/orderDetail.vue

@@ -12,21 +12,21 @@
 			<view class="order-detail-info">
 				<view class="order-detail-title">
 					<view class="order-detail-level">
-						{{level == 1 ? '一级故障' : (level == 2 ? '二级故障' : '三级故障')}}
+						{{detailInfo.level == 1 ? '一级故障' : (detailInfo.level == 2 ? '二级故障' : '三级故障')}}
 					</view>
 					<view class="order-detail-name">
-						故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称故障名称
+						{{detailInfo.problemTitle || '-'}}
 					</view>
 				</view>
 				<view class="order-detail-time">
-					{{'发生时间: ' + '2023-10-22 12:21:21'}}
+					{{'发生时间: ' + detailInfo.occurrenceTime || '-'}}
 				</view>
 				<view class="order-detail-site">
 					<view class="order-detail-status">
-						分析中...
+						{{detailInfo.status == 0 ? '待处理...' : (detailInfo.status == 1 ? '分析中...' : '已完结')}}
 					</view>
 					<view class="order-detail-site-text">
-						三江换电站
+						{{detailInfo.stationName || '-'}}
 					</view>
 				</view>
 			</view>
@@ -35,12 +35,15 @@
 					<view class="fault-describe-title">
 						问题记录
 					</view>
-					<view class="fault-describe-remark">
+					<view class="fault-describe-remark" v-if="detailInfo.attachment">
 						点击图片可查看保存大图
 					</view>
 				</view>
-				<view class="order-detail-swiper">
-					<u-swiper :list="imgList" @click="imageHandle"></u-swiper>
+				<view class="order-detail-swiper" v-if="detailInfo.attachment">
+					<u-swiper :list="detailInfo.imgList" @click="imageHandle"></u-swiper>
+				</view>
+				<view class="order-detail-swiper" v-if="detailInfo.video">
+					<video :src='detailInfo.video'></video>
 				</view>
 				<view class="order-problem-container">
 					<view class="problem-title">
@@ -50,7 +53,7 @@
 						</view>
 					</view>
 					<view class="problem-text">
-						充电机无法充电,由于温度过高当前已断电请及时处理情况很严重,目前无法自自行解决。
+						{{detailInfo.deviceProblem || '-'}}
 					</view>
 				</view>
 			</view>
@@ -74,7 +77,7 @@
 							设备名称
 						</view>
 						<view class="basic-item-text">
-							PLC
+							{{detailInfo.deviceName || '-'}}
 						</view>
 					</view>
 					<view class="basic-item">
@@ -82,7 +85,7 @@
 							设备编号
 						</view>
 						<view class="basic-item-text">
-							PLC
+							{{detailInfo.sn || '-'}}
 						</view>
 					</view>
 					<view class="basic-item">
@@ -90,7 +93,7 @@
 							上报人
 						</view>
 						<view class="basic-item-text">
-							PLC
+							{{detailInfo.createBy || '-'}}
 						</view>
 					</view>
 					<view class="basic-item">
@@ -98,13 +101,32 @@
 							联系方式
 						</view>
 						<view class="basic-item-text">
-							PLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLCPLC
+							{{detailInfo.contactPhone || '-'}}
 						</view>
 					</view>
 				</view>
 			</view>
-			<view class="">
-				
+			<view class="order-detail-deal" v-if="detailInfo.status == 0 || (detailInfo.status == 1 && detailInfo.currentPerson == userinfo.userId)">
+				<view class="order-detail-deal-title">
+					处理信息
+				</view>
+				<u-form :model="form" ref="uform" :rules="rules" label-align='left' label-width="150">
+					<u-form-item label="处理方式" prop="statusText">
+						<u-input type="select" :select-open="dealSelectShow" placeholder="请选择换电站" v-model="form.statusText" @click="dealSelectShow = true"/>
+					</u-form-item>
+					<u-form-item label="处理人员" prop="nextPerson">
+						<u-input type="select" :select-open="showPerson" placeholder="请选择处理人员" v-model="form.nextPerson" @click="showPerson = true"/>
+					</u-form-item>
+					<u-form-item label="处理记录" prop="info" :label-position="'top'">
+						<u-input type="textarea" placeholder="请输入问题记录 不超过200个字" :maxlength="200" v-model="form.info" />
+					</u-form-item>
+					<u-form-item label="问题图片(不超过5张,5M以内)" prop="intro" :label-position="'top'">
+						<u-upload action="http://localhost:8087/zl/business/file/upload" multiple :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="1" :maxCount="5"></u-upload>
+					</u-form-item>
+				</u-form>
+				<view class="">
+					处理
+				</view>
 			</view>
 		</view>
 		<view class="order-detail-timeLine" v-if="currIndex == 2">
@@ -112,28 +134,35 @@
 				<u-time-line-item nodeTop="2" v-for="(item, index) in timeDatas" :key="index">
 					<template v-slot:node>
 						<view class="time-line-node">
-							流转
+							{{item.status == 1 ? '处理' : (item.status == 2 ? '完结' : '流转')}}
 						</view>
 					</template>
 					<template v-slot:content>
 						<view>
 							<view class="u-order-title">
-								<span class="u-order-time">2023-09-23 23:22</span>
-								<span class="u-order-name">艾强>蒋科</span>
+								<span class="u-order-time">{{item.handleTime || '-'}}</span>
+								<span class="u-order-name" v-if="item.previousName && item.nextPerson">{{item.previousName + '>' + item.nextPerson}}</span>
+								<span class="u-order-name" v-else-if="!item.previousName && item.nextPerson">{{item.nextPerson}}</span>
+								<span class="u-order-name" v-else>{{item.processorName}}</span>
 							</view>
-							<view class="u-order-desc">分析处理中</view>
-							<view class="u-order-images">
-								<image :src="img.image" v-for="(img, i) in imgList" :key="i" class="u-order-img"></image>
+							<view class="u-order-desc">{{item.status == 2 ? '处理完成' : '分析处理中'}}</view>
+							<view class="u-order-images" v-if="item.attachment">
+								<image :src="img" v-for="(img, i) in item.imgList" :key="i" class="u-order-img"></image>
 							</view>
-							<view class="u-order-images">
-								<video :src="video" v-for="(video, i) in videos" :key="i" class="u-order-img"></video>
+							<view class="u-order-images"  v-if="item.video">
+								<video :src="item.video" class="u-order-img"></video>
 							</view>
 							
 						</view>
 					</template>
 				</u-time-line-item>
 			</u-time-line>
+			<view class="no-data" v-if="timeDatas.length == 0">
+				该工单暂无处理记录
+			</view>
 		</view>
+		<u-select :list="dealSelectList" v-model="dealSelectShow" @confirm="dealSelectCallback"> </u-select>
+		<u-select :list="personSelectList" v-model="showPerson" value-name="userId" label-name="nickName" @confirm="personSelectCallback"> </u-select>
 	</view>
 </template>
 
@@ -146,64 +175,157 @@
 				level: 1,
 				//是否收起详细信息
 				isShowMore: true,
-				imgList: [
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
-						title: '昨夜星辰昨夜风,画楼西畔桂堂东'
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
-						title: '身无彩凤双飞翼,心有灵犀一点通'
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
-						title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
-						title: '昨夜星辰昨夜风,画楼西畔桂堂东'
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
-						title: '昨夜星辰昨夜风,画楼西畔桂堂东'
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
-						title: '身无彩凤双飞翼,心有灵犀一点通'
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
-						title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
-						title: '昨夜星辰昨夜风,画楼西畔桂堂东'
-					}
-				],
-				timeDatas: [[],[],[],[],[],[],[],[],[],[],[],[],[]],
-				videos: ['https://media.w3.org/2010/05/sintel/trailer.mp4']
+				//详情数据
+				detailInfo: {},
+				//用户信息
+				userinfo: {},
+				//提交表单
+				form: {
+					status: null,
+					statusText: null,
+					info: null,
+					nextPerson: null,
+					nextId: null,
+				},
+				//是否显示处理方式
+				dealSelectShow: false,
+				//是否显示人员
+				showPerson: false,
+				//人员列表
+				personSelectList: [],
+				//处理列表
+				dealSelectList: [{label: '处理中', value: 1}, {label: '转发', value: 3}, {label: '已处理', value: 2}],
+				//验证规则对象
+				rules: {
+					statusText: [
+						{ 
+							required: true, 
+							message: '请选择处理', 
+							// 可以单个或者同时写两个触发验证方式 
+							trigger: ['change','blur'],
+						}
+					],
+					info: [
+						{
+							max: 200, 
+							message: '记录不能大于200个字', 
+							trigger: ['change','blur'],
+							message: '请输入问题记录',
+							required: true, 
+						}
+					],
+					
+				},
+				timeDatas: [],
 			} 
 		},
+		//第一次加载
+		onLoad(e) {
+			  this.id = e.id;
+			  let userinfo = uni.getStorageSync('user')
+			  this.userinfo = JSON.parse(userinfo)
+		},
+		onReady() {
+		  // this.$refs.uform.setRules(this.rules);
+		},
+		mounted() {
+			this.getDetailData();
+		},
 		methods: {
 			//tab选择
 			tabHandle(type) {
 				this.currIndex = type;
+				if(type == 2) {
+					this.getDealList();
+				} else {
+					this.getDetailData();
+				}
+			},
+			//处理返回
+			dealSelectCallback(e) {
+				uni.hideKeyboard();
+				this.form.statusText = e[0].label;
+				this.form.status = e[0].value;
+			},
+			//人员选择
+			personSelectCallback(e) {
+				uni.hideKeyboard();
+				this.form.nextId = e[0].value;
+				this.form.nextPerson = e[0].label;
 			},
 			//点击图片
 			imageHandle(data) {
 				let list = [];
-				this.imgList.forEach(item => {
-					list.push(item.image)
+				this.detailInfo.imgList.forEach(item => {
+					list.push(item)
 				})
 				uni.previewImage({
 					urls: list,
-					current: this.imgList[data].image
+					current: this.detailInfo.imgList[data]
 				})
 			},
 			//是否收起/展开详细信息
 			showHandle() {
 				this.isShowMore = !this.isShowMore
 			},
+			//获取详情数据
+			getDetailData() {
+				let _that = this
+				uni.showLoading({
+					title: '搜索中...',
+				})
+				_that.detailInfo = {};
+				_that.$http.getOrderDetail(_that.id).then(res => {
+					if(res.code == 200) {
+						 let detailInfo = {...res.data};
+						 if(detailInfo.attachment) {
+							 detailInfo.imgList = detailInfo.attachment.split(',')
+						 }
+						 _that.detailInfo = detailInfo;
+						 this.getPersons(detailInfo.stationCode);
+					} else {
+						_that.$utils.msg(res.msg);
+					}
+					uni.hideLoading();
+				})
+			},
+			//获取处理列表
+			getDealList() {
+				let _that = this
+				uni.showLoading({
+					title: '搜索中...',
+				})
+				_that.timeDatas = [];
+				_that.$http.getOrderDealList({parentId: _that.id}).then(res => {
+					if(res.code == 200) {
+						 let timeDatas = res.data || [];
+						 if(timeDatas.length > 0) {
+							 timeDatas.forEach(item => {
+								 if(item.attachment) {
+									 item.imgList = item.attachment.split(',')
+								 }
+								 _that.timeDatas.push(item);
+							 })
+						 }
+					} else {
+						_that.$utils.msg(res.msg);
+					}
+					uni.hideLoading();
+				})
+			},
+			//获取站点下的人员列表
+			getPersons(code) {
+				let _that = this;
+				_that.personSelectList = [];
+				_that.$http.getUserListByStationCode(code).then(res => {
+					uni.hideLoading();
+					if(res.code == 200) {
+						_that.personSelectList = res.data || [];
+					} else {
+						_that.$utils.msg(res.msg);
+					}
+				})
+			},
 		}
 	}
 </script>
@@ -427,6 +549,19 @@
 					}
 				}
 			}
+			.order-detail-deal {
+				background: #FFFFFF;
+				border-radius: 16rpx;
+				padding: 30rpx;
+				margin: 0rpx 30rpx 30rpx;
+				.order-detail-deal-title {
+					font-size: 30rpx;
+					font-family: PingFang SC-Medium, PingFang SC;
+					font-weight: 500;
+					color: #1E2128;
+					line-height: 36rpx;
+				}
+			}
 		}
 		.order-detail-timeLine {
 			background: #FFFFFF;
@@ -465,6 +600,18 @@
 					line-height: 32rpx;
 				}
 			}
+			.no-data {
+				text-align: center;
+				font-size: 22rpx;
+				font-family: PingFang SC-Regular, PingFang SC;
+				font-weight: 400;
+				color: #1D2129;
+				line-height: 32rpx;
+				position: fixed;
+				top: 200rpx;
+				left: 50%;
+				transform: translate(-50%);
+			}
 		}
 		.u-order-desc {
 			font-size: 24rpx;

+ 67 - 38
pages/index/orderUp.vue

@@ -30,7 +30,14 @@
 				<u-input type="textarea" placeholder="请输入问题记录 不超过200个字" :maxlength="200" v-model="form.deviceProblem" />
 			</u-form-item>
 			<u-form-item label="问题图片(不超过5张,5M以内)" prop="intro" :label-position="'top'">
-				<u-upload action="http://localhost:8087/zl/business/file/upload" multiple :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="1" :maxCount="5"></u-upload>
+				<u-upload action="#" multiple :fileList="fileList" @on-choose-complete="onChooseComplete" @delete="deletePic" name="1" :maxCount="5"></u-upload>
+				<!-- <u-upload @on-choose-complete="onChooseComplete" ref="uUpload" :custom-btn="true"
+					:show-upload-list="true" :auto-upload="false" :file-list="fileList" :show-progress="true"
+					:deletable="true" max-count="1" class="test2">
+					<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
+						<image src="../static/img/addDevice.jpg" mode="aspectFill"></image>
+					</view>
+				</u-upload> -->
 			</u-form-item>
 		</u-form>
 		<u-select :list="siteSelectList" v-model="siteSelectShow" value-name="stationCode" label-name="stationName" @confirm="siteSelectCallback"> </u-select>
@@ -61,6 +68,7 @@
 					source: 99,
 					problemTitle: null,
 					deviceProblem: null,
+					attachment: '',
 				},
 				//时间picker 默认值
 				params: {
@@ -234,6 +242,7 @@
 			submiHandle() {
 				let _that = this;
 				_that.isClick = true;
+				console.log(this.fileList, 'list')
 				_that.$refs.uform.validate(valid => {
 					if (!valid) {
 						_that.isClick = false;
@@ -262,45 +271,65 @@
 			},
 			// 新增图片
 			async afterRead(event) {
-				console.log(this.fileList, '3333')
-				// 当设置 multiple 为 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)
-					console.log(result, 'result')
-					let item = this[`fileList${event.name}`][fileListLen]
-					console.log(item, 'item')
-					this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
-						status: 'success',
-						message: '',
-						url: result
-					}))
-					fileListLen++
-				}
+				// console.log(this.fileList, '3333')
+				// // 当设置 multiple 为 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)
+				// 	console.log(result, 'result')
+				// 	let item = this[`fileList${event.name}`][fileListLen]
+				// 	console.log(item, 'item')
+				// 	this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
+				// 		status: 'success',
+				// 		message: '',
+				// 		url: result
+				// 	}))
+				// 	fileListLen++
+				// }
 			},
 			uploadFilePromise(url) {
-				return new Promise((resolve, reject) => {
-					let a = uni.uploadFile({
-						url: 'http://localhost:8087/zl/business/file/upload', // 仅为示例,非真实的接口地址
-						filePath: url,
-						name: 'file',
-						formData: {
-							user: 'test'
-						},
-						success: (res) => {
-							setTimeout(() => {
-								resolve(res.data.data)
-							}, 1000)
-						}
-					});
+				// return new Promise((resolve, reject) => {
+				// 	let a = uni.uploadFile({
+				// 		url: 'http://localhost:8087/zl/business/file/upload', // 仅为示例,非真实的接口地址
+				// 		filePath: url,
+				// 		name: 'file',
+				// 		formData: {
+				// 			user: 'test'
+				// 		},
+				// 		success: (res) => {
+				// 			setTimeout(() => {
+				// 				resolve(res.data.data)
+				// 			}, 1000)
+				// 		}
+				// 	});
+				// })
+			},
+			onChooseComplete(lists, name) {
+				const _that = this;
+				uni.uploadFile({
+					// 这里是你上传图片的地址
+					// url: 'https://xxx.xx.xx.xx/admin-api/infra/file/upload',
+					url: 'http://localhost:8087/zl/business/file/upload',
+					filePath: lists[0].url,
+					name: 'file',
+					header: {
+						"Authorization": `${uni.getStorageSync("token")}`
+					},
+						//	这个res是后端返回给你上传成功的数据里边一般会有上传之后图片的在线路径
+					success: (res) => {
+						// app.deviceInfo.photoUrl = JSON.parse(res.data).data;
+						let data = JSON.parse(res.data)
+						_that.form.attachment += data.msg + ','
+						console.log(data.msg, 'res')
+					},
 				})
 			},
 		}

+ 1 - 1
pages/userAgreement/index.vue

@@ -17,7 +17,7 @@
 		methods: {
 			getAgreement(){
 				this.$http.getAgreement().then(res=>{
-					this.content=res.data
+					this.content=res.msg
 				})
 			}
 		}