Explorar o código

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/aiot-app

ysy hai 1 ano
pai
achega
c76be70319

+ 10 - 0
api/myTicket/index.js

@@ -112,3 +112,13 @@ export async function devicestatistics(params) {
 	}
 	return Promise.reject(new Error(data.message))
 }
+
+// 扫码设备列表-巡点检,保养,量具送检
+export async function deviceListQrCode(params) {
+	const data = await get(Vue.prototype.apiUrl + `/eam/PdaWorkOrder/deviceListQrCode`, params)
+	console.log(data)
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}

+ 2 - 2
api/repair/index.js

@@ -130,8 +130,8 @@ export async function save(data) {
 }
 
 // 通过固资编码查询详情
-export async function getByFixCode(fixCode) {
-	const res = await get(Vue.prototype.apiUrl + `/main/asset/getByFixCode/${fixCode}`)
+export async function getByFixCode(data) {
+	const res = await get(Vue.prototype.apiUrl + `/main/asset/getByFixCode`, data)
 	if (res.code == 0) {
 		return res.data
 	}

+ 16 - 0
pages.json

@@ -41,6 +41,22 @@
 				"navigationBarTextStyle": "white"
 			}
 		},
+		{
+			"path": "pages/home/myTicket/detail",
+			"style": {
+				"navigationBarTitleText": "关联工单",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
+		},
+		{
+			"path": "pages/home/myTicket/index",
+			"style": {
+				"navigationBarTitleText": "详情",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
+		},
 		{
 			"path": "pages/home/msg/msg",
 			"style": {

+ 765 - 0
pages/home/myTicket/detail.vue

@@ -0,0 +1,765 @@
+<template>
+	<view class="tour-container">
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="待检设备列表" @clickLeft="back" @clickRight="HandlScanCode"></uni-nav-bar>
+		<view class="tour-wrapper">
+			<view class="tour_tally-content">
+				<view class="kd-equipment">
+					<view class="kd-list-container">
+						<u-list @scrolltolower="scrolltolower">
+							<u-list-item v-for="(item, index) in euqiList" :key="index">
+								<view class="kd-card">
+									<view class="kd-card-wrapper">
+										<view class="kd-cell">
+											<text class="kd-label">工单名称</text>
+											{{ item.code }}
+										</view>
+										<view class="kd-cell">
+											<text class="kd-label">设备名称</text>
+											{{ item.name }}
+										</view>
+										<view class="kd-cell">
+											<text class="kd-label">设备型号</text>
+											{{ item.model }}
+										</view>
+										<view class="kd-cell">
+											<text class="kd-label">固资编号</text>
+											{{ item.fixCode }}
+										</view>
+										<view class="kd-cell">
+											<text class="kd-label">内部编号</text>
+											{{ item.codeNumber }}
+										</view>
+										<view class="kd-cell">
+											<text class="kd-label">规则名称</text>
+											{{ item.planName }}
+										</view>
+										<view class="kd-cell">
+											<text class="kd-label">工单生成时间</text>
+											{{ item.createTime }}
+										</view>
+										<view class="kd-cell">
+											<text class="kd-label">执行结果</text>
+											<text class="status-box text-warning" v-if="item.executeStatus === 0">待检</text>
+											<text class="status-box text-primary" v-else-if="item.executeStatus === 1">已检</text>
+											<text class="status-box text-danger" v-else-if="item.executeStatus === 2">异常</text>
+											<text class="status-box text-primary" v-else-if="item.executeStatus === 3">已报修</text>
+										</view>
+									</view>
+									<view class="card-footer">
+										<button v-if="item.executeStatus == 0" type="primary" class="primary-btn" @click="handleCheck(item)">检查</button>
+										<template v-if="item.orderStatus && item.orderStatus === 3">
+											<button type="default" v-if="item.resultStatus === 3" @click="handLbxDetail(item)">报修详情</button>
+											<button type="default" v-else-if="item.resultStatus === 2" @click="handLbx(item)">报修</button>
+										</template>
+										<button type="default" v-if="[0, 2, 3].includes(item.orderStatus) && item.executeStatus != 0" @click="checkDetail(item)">检查详情</button>
+									</view>
+								</view>
+							</u-list-item>
+							<u-list-item v-if="euqiList.length === 0">
+								<view class="nodata">暂无数据</view>
+							</u-list-item>
+						</u-list>
+					</view>
+				</view>
+			</view>
+			<uni-popup ref="inputDialog" type="dialog">
+				<uni-popup-dialog
+					ref="inputClose"
+					mode="input"
+					title="您当前已超出计划完成时间,请填写原因"
+					placeholder="请输入内容"
+					:before-close="true"
+					@close="handleClose"
+					@confirm="timeoutCauseConfirm"></uni-popup-dialog>
+			</uni-popup>
+		</view>
+		<u-modal :show="modalShow" title="提示" @confirm="modalShow = false">
+			<view>
+				您还有
+				<text class="text-warning">{{ worksheetInfo.awaitInspectSum }}</text>
+				台设备待检,不可报工
+			</view>
+		</u-modal>
+		<Assign ref="assignRef" @success="assignSuccess" />
+
+		<!-- <ScanCode @scancodedate="scancodedate"></ScanCode> -->
+	</view>
+</template>
+
+<script>
+	import Step from '@/components/Step/Step.vue'
+	import StepItem from '@/components/Step/StepItem.vue'
+	import PopSparePart from '@/pages/maintenanceWorkorder/components/PopSparePart.vue'
+	import { getWorkOrderDetail, getDeviceList, startExecuting, signingWork, devicestatistics, deviceListQrCode } from '@/api/myTicket/index.js'
+	import { getSpareParts } from '@/api/repair'
+	import { get, post, postJ } from '@/utils/api.js'
+	import Assign from '@/components/Assign.vue'
+	import CellInfo from '@/components/CellInfo.vue'
+	import KdTabs from '@/components/KdTabs.vue'
+	import ScanCode from '@/components/ScanCode.vue'
+	export default {
+		components: {
+			CellInfo,
+			KdTabs,
+			Assign,
+			ScanCode,
+			Step,
+			StepItem,
+			PopSparePart
+		},
+		data() {
+			return {
+				type: '',
+				typeOptions: {
+					CREATE: '生成工单',
+					SPARE_PARTS_APPLY: '备品备件申请',
+					ACCEPTANCE_CHEK: '验收',
+					WORK_REPORT: '报工'
+				},
+				repairInfoLogList: [],
+				modalShow: false,
+				active: 0,
+				typeActive: 0,
+				statusList: {
+					0: '待接收',
+					1: '执行中',
+					3: '已完成'
+				},
+				pageId: '',
+				planId: '',
+				workOrderCode: '',
+				worksheetInfo: {
+					equiList: [],
+					workOrder: {}
+				},
+				logs: {},
+				equpStatus: [
+					// {
+					//   name: '全部',
+					//   value: []
+					// },
+					{
+						name: '全部',
+						value: -1
+					},
+					{
+						name: '待检',
+						value: 0
+					},
+					{
+						name: '已检',
+						value: 1
+					},
+					{
+						name: '异常',
+						value: 2
+					}
+				],
+				euqiList: [],
+				equipPage: 1,
+				isEnd: false,
+				cycleOptObj: {
+					1: '时/次',
+					2: '天/次',
+					3: '周/次',
+					4: '月/次',
+					5: '年/次',
+					11: '次/天',
+					12: '次/周',
+					13: '次/月',
+					14: '次/年'
+				},
+				barType: 0,
+				qrContent: null,
+				chooseTab: false
+			}
+		},
+		async onLoad(options) {
+			console.log('onLoad--------')
+			console.log('options------------', options)
+			// this.workOrderCode = options.workOrderCode
+			this.deviceId = options.deviceId
+			this.type = options.type
+			// this.chooseTab = options.chooseTab
+			this.getInfo()
+			// 设备台账跳转详情
+			// if (options.qrContent) {
+			// 	this.qrContent = options.qrContent
+			// 	await this.getInfo()
+			// 	this.cbScancodedate({
+			// 		code: this.qrContent
+			// 	})
+			// }
+		},
+		onShow() {
+			console.log('onShow--------')
+			this.getInfo()
+		},
+		onUnload() {
+			uni.$off('scancodedate')
+		},
+		onHide() {
+			uni.$off('scancodedate')
+		},
+		methods: {
+			// 备件使用明细
+			handlbjsymx(title, list) {
+				this.$refs.PopSparePart.open(title, list)
+			},
+			// 跳转备品备件
+			handlbpbj() {
+				uni.navigateTo({
+					url: `/pages/maintenanceWorkorder/sparepart/sparepartList?id=${this.pageId}`
+				})
+			},
+			getCount() {
+				devicestatistics({ planId: this.planId }).then(data => {
+					this.equpStatus = this.equpStatus.map(item => {
+						switch (item.name) {
+							case '全部':
+								return { ...item, count: data.total }
+							case '待检':
+								return { ...item, count: data.isInspectedNum }
+							case '已检':
+								return { ...item, count: data.checkedNum }
+							case '异常':
+								return { ...item, count: data.abnormalNum }
+						}
+					})
+				})
+			},
+			// 扫码枪扫码
+			cbScancodedate(data) {
+				this.Scancodedate(data.code)
+			},
+			// 相机扫码
+			HandlScanCode() {
+				let _this = this
+
+				uni.scanCode({
+					onlyFromCamera: true,
+					success: function (res) {
+						_this.Scancodedate(res.result)
+					}
+				})
+			},
+			Scancodedate(code) {
+				let _this = this
+				if (this.worksheetInfo.status.code === 0) {
+					uni.showModal({
+						title: '提示',
+						content: '工单未开启执行,不可进行巡点检操作,请先点击“开始执行”!',
+						confirmText: '开始执行', //这块是确定按钮的文字
+						cancelText: '取消', //这块是取消的文字
+						success: function (res) {
+							if (res.confirm) {
+								_this.handleExecute() // 执行确认后的操作
+							} else {
+								// 执行取消后的操作
+							}
+						}
+					})
+					return
+				}
+				this.qrContent = code.trim()
+				this.barType = this.setBarType(this.qrContent)
+				_this.getData()
+			},
+			// 设置barType
+			setBarType(val) {
+				let index = val.indexOf('@_@')
+				let result = 0
+				if (index !== -1) {
+					let item = val.substr(index + 3, 1)
+					if (item) {
+						result = Number(item)
+					}
+				}
+				return result
+			},
+			// 根据条码请求设备数据
+			getData() {
+				let par = {
+					barType: this.barType,
+					qrContent: this.qrContent
+				}
+				uni.showLoading({
+					title: '加载中',
+					mask: true
+				})
+				postJ(this.apiUrl + '/scan/getAssetInfo', par)
+					.then(res => {
+						let data = res.data
+						this.matchEquipment(data)
+					})
+					.finally(() => {
+						uni.hideLoading()
+					})
+			},
+
+			matchEquipment(data) {
+				let par = {
+					assetCode: data.assetCode,
+					workOrderId: this.worksheetInfo.id
+				}
+				console.log('par', par)
+				post(this.apiUrl + '/workOrder/scanMatching', par).then(res => {
+					let data = res.data
+					if (!data) {
+						uni.showModal({
+							title: '提示',
+							content: '本工单中,无此设备!',
+							confirmText: '好的', //这块是确定按钮的文字
+							showCancel: false,
+							success: function (res) {
+								if (res.confirm) {
+									// 执行确认后的操作
+								} else {
+									// 执行取消后的操作
+								}
+							}
+						})
+					} else {
+						// 未报工
+						if (this.worksheetInfo.status.code === 1) {
+							this.handleCheck(data)
+						}
+						// 已报工
+						if (this.worksheetInfo.status.code === 3) {
+							this.checkDetail(data)
+						}
+					}
+				})
+			},
+
+			handleAssign() {
+				console.log(this.worksheetInfo)
+				this.$refs.assignRef.open(this.worksheetInfo.id)
+			},
+			assignSuccess() {
+				this.back()
+			},
+			// 报工
+			handleReport() {
+				if (this.worksheetInfo.finishNum !== this.worksheetInfo.total) {
+					uni.showToast({
+						title: '请完成巡检设备检查',
+						icon: 'none'
+					})
+				} else {
+					if (new Date(this.worksheetInfo.acceptTime).getTime() + this.worksheetInfo.duration * 60 * 1000 < new Date().getTime()) {
+						this.$refs.inputDialog.open()
+						return
+					}
+					this._report()
+				}
+			},
+			handleClose() {
+				this.$refs.inputDialog.close()
+			},
+			timeoutCauseConfirm(value) {
+				if (!value) {
+					uni.showToast({
+						title: '请输入超时原因',
+						icon: 'none'
+					})
+					return
+				}
+				this.$refs.inputDialog.close()
+				this._report(value)
+			},
+			_report(timeoutCause = '') {
+				signingWork({ id: this.pageId, timeoutCause: timeoutCause }).then(() => {
+					uni.showToast({
+						icon: 'success',
+						title: '操作成功!',
+						duration: 2000
+					})
+					this.getInfo()
+				})
+
+				// post(
+				// 	this.apiUrl + '/workOrder/reportWork',
+				// 	{
+				// 		workOrderId: this.pageId,
+				// 		timeoutCause
+				// 	},
+				// 	true,
+				// 	false
+				// )
+				// 	.then(res => {
+				// 		let _this = this
+				// 		if (res?.success) {
+				// 			let data = res.data
+				// 			if (data.length) {
+				// 				uni.showModal({
+				// 					title: '提示',
+				// 					content: `有${data.length}台设备被标记为缺陷,是否要报修?`,
+				// 					cancelText: '取消', // 取消按钮的文字
+				// 					confirmText: '报修', // 确认按钮的文字
+				// 					showCancel: true, // 是否显示取消按钮,默认为 true
+				// 					success: res => {
+				// 						if (res.confirm) {
+				// 							if (data.length > 1) {
+				// 								uni.navigateTo({
+				// 									url: `/pages/tour_tally/detail/detail?workOrderCode=${this.workOrderCode}&id=${this.pageId}&chooseTab=true`
+				// 								})
+				// 							} else {
+				// 								uni.navigateTo({
+				// 									url: `/pages/repair/repair/index?source=5&workOrderCode=${this.workOrderCode}&equiCode=${data[0].equiCode}&equiId=${data[0].equiId}&workOrderId=${this.pageId}&equiName=${data[0].equiName}&equiModel=${data[0].equiModel}&equiLocation=${data[0].equiLocation}`
+				// 								})
+				// 							}
+				// 						} else {
+				// 							_this.getInfo()
+				// 						}
+				// 					}
+				// 				})
+				// 			} else {
+				// 				uni.showToast({
+				// 					icon: 'success',
+				// 					title: '操作成功!',
+				// 					duration: 2000
+				// 				})
+				// 				this.getInfo()
+				// 			}
+				// 		}
+
+				// 		/* if (res?.success) {
+				// 		  uni.showToast({
+				// 		    icon: "success",
+				// 		    title: "操作成功!",
+				// 		    duration: 2000,
+				// 		  });
+				// 		  this.getInfo();
+				// 		} */
+				// 	})
+				// 	.catch(res => {
+				// 		if (res.code === '4444') {
+				// 			this.$refs.inputDialog.open()
+				// 		} else if (res.code === '5555') {
+				// 			this.modalShow = true
+				// 			// uni.showModal({
+				// 			//   title: '提示',
+				// 			//   content: `您还有 ${this.worksheetInfo.awaitInspectSum} 台设备待检,不可报工`,
+				// 			//   success: function (res) {},
+				// 			//   showCancel: false
+				// 			// })
+				// 		}
+				// 	})
+			},
+			// 执行工单
+			handleExecute() {
+				startExecuting({ id: this.pageId }).then(() => {
+					uni.showToast({
+						icon: 'success',
+						title: '操作成功!',
+						duration: 2000
+					})
+					this.getInfo()
+				})
+				// post(this.apiUrl + '/workOrder/execute', {
+				// 	workOrderCode: this.workOrderCode
+				// }).then(res => {
+				// 	if (res?.success) {
+				// 		uni.showToast({
+				// 			icon: 'success',
+				// 			title: '操作成功!',
+				// 			duration: 2000
+				// 		})
+				// 		this.getInfo()
+				// 	}
+				// })
+			},
+			//巡点检设备加载更多
+			scrolltolower() {
+				// if (this.isEnd) return
+				// this.equipPage++
+				// this.getEquipList()
+			},
+			// 巡点检设备列表
+			getEquipList() {
+				const params = {
+					planId: this.planId,
+					status: this.equpStatus[this.typeActive].value,
+					pageNum: 1,
+					size: 9999
+				}
+				getDeviceList(params).then(data => {
+					if (this.equipPage === 1) {
+						this.euqiList = data.list
+					} else {
+						this.euqiList.push(...data.list)
+					}
+					this.isEnd = this.euqiList.length >= data.count
+				})
+				// post(this.apiUrl + `/workOrder/getEquipmentListApp?page=${this.equipPage}&size=10`, params, true).then(res => {
+				// 	if (res?.success) {
+				// 		if (this.equipPage === 1) {
+				// 			this.euqiList = res.data.records
+				// 		} else {
+				// 			this.euqiList.push(...res.data.records)
+				// 		}
+				// 		this.isEnd = this.euqiList.length >= res.data.total
+				// 	}
+				// })
+			},
+
+			handleTabChange(value) {
+				if (value === 1) {
+					this.typeChange(0)
+				}
+			},
+
+			finishTime(start, end) {
+				if (!end) return ''
+				let dur = new Date(end).getTime() - new Date(start).getTime()
+				return Math.ceil(dur / 1000 / 60) + '分钟'
+			},
+			// 设备状态切换
+			typeChange(type) {
+				this.typeActive = type
+				this.equipPage = 1
+				this.getEquipList()
+			},
+			handleCheck({ id }) {
+				// uni.navigateTo({
+				// 	url: `/pages/tour_tally/check/index?id=${id}&equiName=${equiName}&equiCode=${equiCode}&workOrderId=${this.pageId}&workOrderCode=${this.workOrderCode}`
+				// })
+				uni.navigateTo({
+					url: `/pages/tour_tally/check/index?id=${id}`
+				})
+			},
+			checkDetail({ id }) {
+				uni.navigateTo({
+					url: `/pages/tour_tally/check/detail?id=${id}`
+				})
+			},
+			getInfo() {
+				console.log('this.deviceId----')
+				console.log(this.deviceId)
+				console.log('this.type----')
+				console.log(this.type)
+				deviceListQrCode({ type: this.type, deviceId: this.deviceId }).then(data => {
+					console.log('data--------------123----')
+					console.log(data)
+					this.euqiList = data
+				})
+			},
+			// 报修
+			handLbx(item) {
+				console.log('item', item)
+				uni.navigateTo({
+					url: `/pages/repair/repair/index?source=5&workOrderCode=${this.workOrderCode}&equiCode=${item.equiCode}&equiId=${item.equiId}&workOrderId=${this.pageId}&equiName=${item.equiName}&equiModel=${item.equiModel}&equiLocation=${item.equiLocation}`
+				})
+			},
+			// 报修详情
+			handLbxDetail(item) {
+				uni.navigateTo({
+					url: `/pages/repair/detail/detail?id=${item.repairId}`
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import '@/components/submitted.scss';
+
+	.list-cell {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		color: $uni-text-color-grey;
+		padding: 5rpx 20rpx;
+	}
+
+	.font-sm {
+		font-size: $uni-font-size-sm;
+	}
+
+	.font-text {
+		color: $uni-text-color;
+	}
+
+	.btn-execute {
+		background-color: $j-primary-border-green;
+		width: 450rpx;
+		margin-top: 5vh;
+	}
+
+	.btn-reassignment {
+		color: $uni-color-primary;
+		background-color: transparent;
+		border: none;
+		box-shadow: none;
+
+		&::after {
+			display: none;
+		}
+	}
+
+	.tour-container {
+		position: fixed;
+		top: 0;
+		bottom: 0;
+		width: 100vw;
+		display: flex;
+		flex-direction: column;
+
+		/deep/.u-popup {
+			flex: none !important;
+		}
+	}
+
+	.tour-wrapper {
+		position: relative;
+		flex: 1;
+	}
+
+	.tour_tally-content {
+		padding-top: 40rpx;
+		box-sizing: border-box;
+		// height: calc(100vh - 88rpx);
+		position: absolute;
+		top: 0;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		display: flex;
+		flex-direction: column;
+	}
+
+	.kd-cell {
+		min-height: 90rpx;
+		border-bottom: 1px dashed #dadada;
+		display: flex;
+		align-items: center;
+
+		.kd-label {
+			display: inline-block;
+			width: 7em;
+			font-weight: bold;
+		}
+
+		.kd-content {
+			flex: 1;
+			word-break: break-all;
+		}
+	}
+
+	.kd-baseInfo {
+		padding: 0 32rpx;
+		font-size: 28rpx;
+	}
+
+	.kd-equipment {
+		flex: 1;
+		display: flex;
+		flex-direction: column;
+		overflow: hidden;
+
+		.kd-type-box {
+			text-align: center;
+			padding: 26rpx 0;
+
+			view {
+				position: relative;
+				display: inline-block;
+				width: 120rpx;
+				padding: 4rpx 0;
+				color: #747474;
+				margin: 0 20rpx;
+				background-color: rgba(215, 215, 215, 0.5);
+
+				&.type—active {
+					background-color: #1e7f35;
+					color: #fff;
+				}
+				.count {
+					position: absolute;
+					top: -9px;
+					right: -9px;
+					width: 18px;
+					height: 18px;
+					border-radius: 50%;
+					font-size: 12px;
+					background-color: red;
+					color: #fff;
+				}
+			}
+		}
+
+		.kd-list-container {
+			flex: 1;
+			display: flex;
+			flex-direction: column;
+			overflow: hidden;
+			padding: 12rpx 18rpx;
+			background-color: $page-bg;
+
+			.u-list {
+				flex: 1;
+				height: 100% !important;
+			}
+			.nodata {
+				font-size: 40rpx;
+				text-align: center;
+				padding-top: 30rpx;
+			}
+		}
+	}
+
+	.btn-sparepart {
+		width: 450rpx;
+		margin-top: 20rpx;
+	}
+
+	.spare-parts {
+		flex: 1;
+		overflow: hidden;
+	}
+
+	.kd-card {
+		background-color: #fff;
+		margin-bottom: 20rpx;
+		padding: 8rpx 0;
+		font-size: 28rpx;
+		word-break: break-all;
+
+		.kd-card-wrapper {
+			padding: 0 30rpx;
+			border-bottom: 1px solid #dadada;
+		}
+
+		.kd-cell {
+			line-height: 60rpx;
+		}
+
+		.kd-cell:last-of-type {
+			border-bottom: none;
+		}
+
+		.status-box {
+			margin-right: 16rpx;
+		}
+
+		.card-footer {
+			display: flex;
+			justify-content: flex-end;
+			align-items: center;
+			padding: 8rpx 0 20rpx;
+
+			button {
+				width: 180rpx;
+				height: 56rpx;
+				line-height: 56rpx;
+				font-size: 28rpx;
+				margin: 0 8rpx;
+			}
+
+			.primary-btn {
+				background-color: $j-primary-border-green;
+			}
+		}
+	}
+</style>

+ 273 - 0
pages/home/myTicket/index.vue

@@ -0,0 +1,273 @@
+<template>
+	<view>
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="检查中" @clickLeft="back"></uni-nav-bar>
+		<view class="check-content">
+			<view class="title">
+				{{ equiName }}
+				<text>{{ equiCode }}</text>
+			</view>
+			<view class="check-list">
+				<CheckCard v-for="(item, index) in equipList" :item="item" class="mb20" :index="index"></CheckCard>
+			</view>
+			<view class="footer">
+				<view class="btn" @click="back">返回</view>
+				<view class="btn primary" @click="handleSave">保存</view>
+			</view>
+		</view>
+
+		<uni-popup ref="inputDialog" type="dialog">
+			<uni-popup-dialog
+				ref="inputClose"
+				mode="input"
+				title="您当前已超出计划完成时间,请填写原因"
+				placeholder="请输入内容"
+				:before-close="true"
+				@close="handleClose"
+				@confirm="timeoutCauseConfirm"></uni-popup-dialog>
+		</uni-popup>
+	</view>
+</template>
+
+<script>
+	import { getDeviceInfo, mattersChecked } from '@/api/myTicket/index.js'
+	import { post, postJ } from '@/utils/api.js'
+	import CheckCard from '@/pages/tour_tally/check/components/CheckCard.vue'
+	export default {
+		components: { CheckCard },
+		data() {
+			return {
+				id: '',
+				pageId: '',
+				page: 1,
+				equipList: [],
+				isEnd: false,
+				equiName: '',
+				equiCode: '',
+				workOrderId: '',
+				workOrderCode: ''
+			}
+		},
+		onLoad(options) {
+			this.id = options.id
+			//   this.pageId = options.id
+			//   this.equiName = options.equiName
+			//   this.equiCode = options.equiCode
+			//   this.workOrderId = +options.workOrderId
+			// this.workOrderCode = options.workOrderCode
+			this.getList()
+		},
+		// onReachBottom() {
+		// 	if (this.isEnd) return
+		// 	this.page++
+		// 	this.getList()
+		// },
+		methods: {
+			back() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			handleSave() {
+				console.log(this.equipList)
+				let isAllPass = true
+				isAllPass = this.equipList.every(item => item.status > -1)
+				let params = {
+					id: this.equipList[0].id,
+					executeStatus: isAllPass ? 1 : 2,
+					workItems: this.equipList.map(item => {
+						return {
+							content: item.content,
+							name: item.name,
+							norm: item.norm,
+							operationGuide: item.operationGuide,
+							result: item.result,
+							serialNum: item.serialNum,
+							status: item.status
+						}
+					})
+				}
+				mattersChecked(params).then(data => {
+					uni.showToast({
+						duration: 2000,
+						title: '保存成功!'
+					})
+					this.back()
+				})
+				// let _this = this
+				// const params = {
+				// 	itemList: this.equipList,
+				// 	planEquiId: this.pageId,
+				// 	workOrderId: +this.workOrderId,
+				// 	workOrderType: 1
+				// }
+				// postJ(this.apiUrl + `/workOrder/itemsInspect`, params, true).then(res => {
+				// 	if (res?.success) {
+				// 		if (res.data) {
+				// 			uni.showModal({
+				// 				title: '提示',
+				// 				content: '所有设备已执行完,是否报工?',
+				// 				cancelText: '取消', // 取消按钮的文字
+				// 				confirmText: '报工', // 确认按钮的文字
+				// 				showCancel: true, // 是否显示取消按钮,默认为 true
+				// 				success: res => {
+				// 					if (res.confirm) {
+				// 						_this._report()
+				// 					} else {
+				// 						_this.back()
+				// 					}
+				// 				}
+				// 			})
+				// 		} else {
+				// 			uni.showToast({
+				// 				duration: 2000,
+				// 				title: '保存成功!'
+				// 			})
+				// 			this.back()
+				// 		}
+				// 	}
+				// })
+			},
+
+			handleClose() {
+				this.$refs.inputDialog.close()
+			},
+			timeoutCauseConfirm(value) {
+				if (!value) {
+					uni.showToast({
+						title: '请输入超时原因',
+						icon: 'none'
+					})
+					return
+				}
+				this.$refs.inputDialog.close()
+				this._report(value)
+			},
+			_report(timeoutCause = '') {
+				let _this = this
+				post(
+					this.apiUrl + '/workOrder/reportWork',
+					{
+						workOrderId: this.workOrderId,
+						timeoutCause
+					},
+					true,
+					false
+				)
+					.then(res => {
+						if (res?.success) {
+							let data = res.data
+							if (data.length) {
+								uni.showModal({
+									title: '提示',
+									content: `有${data.length}台设备被标记为缺陷,是否要报修?`,
+									cancelText: '取消', // 取消按钮的文字
+									confirmText: '报修', // 确认按钮的文字
+									showCancel: true, // 是否显示取消按钮,默认为 true
+									success: res => {
+										if (res.confirm) {
+											if (data.length > 1) {
+												uni.navigateTo({
+													url: `/pages/tour_tally/detail/detail?workOrderCode=${this.workOrderCode}&id=${this.workOrderId}&chooseTab=true`
+												})
+											} else {
+												uni.navigateTo({
+													url: `/pages/repair/repair/index?source=5&workOrderCode=${this.workOrderCode}&equiCode=${data[0].equiCode}&equiId=${data[0].equiId}&workOrderId=${this.pageId}&equiName=${data[0].equiName}&equiModel=${data[0].equiModel}&equiLocation=${data[0].equiLocation}`
+												})
+											}
+										} else {
+											_this.back()
+										}
+									}
+								})
+							} else {
+								uni.showToast({
+									icon: 'success',
+									title: '操作成功!',
+									duration: 2000
+								})
+								_this.back()
+							}
+						}
+					})
+					.catch(res => {
+						if (res.code === '4444') {
+							this.$refs.inputDialog.open()
+						}
+					})
+			},
+			getList() {
+				getDeviceInfo({ id: this.id }).then(data => {
+					this.equiName = data.name
+					this.equiCode = data.code
+					this.equipList = data.workItems.map(item => {
+						return {
+							...item,
+							id: data.id,
+							executeStatus: 1
+						}
+					})
+				})
+				// const { page } = this
+				// post(this.apiUrl + `/workOrder/getEquipmentItemsListApp?size=10&page=${page}`, { planEquiId: +this.pageId, workOrderId: this.workOrderId }, true).then(res => {
+				// 	if (res?.success) {
+				// 		res.data.records.forEach(item => {
+				// 			item.isNormal = item.isNormal === null || item.isNormal === undefined ? 1 : item.isNormal
+				// 		})
+				// 		if (page === 1) {
+				// 			this.equipList = res.data.records
+				// 		} else {
+				// 			this.equipList.push(...res.data.records)
+				// 		}
+
+				// 		this.isEnd = this.equipList.length >= res.data.total
+				// 	}
+				// })
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.check-content {
+		box-sizing: border-box;
+		// height: calc(100vh - 88rpx);
+		display: flex;
+		flex-direction: column;
+		padding-bottom: 100rpx;
+		.title {
+			line-height: 80rpx;
+			display: flex;
+			justify-content: space-between;
+			padding: 0 30rpx;
+		}
+		.check-list {
+			flex: 1;
+			overflow: auto;
+			padding: 0 30rpx 30rpx;
+		}
+		.footer {
+			height: 100rpx;
+			display: flex;
+			border: 1rpx solid $j-primary-border-green;
+			position: fixed;
+			bottom: 0;
+			width: 100vw;
+			background: #fff;
+			.btn {
+				display: flex;
+				flex: 1;
+				justify-content: center;
+				align-items: center;
+				border-radius: 0;
+				&.primary {
+					background-color: $j-primary-border-green;
+					color: #fff;
+				}
+			}
+		}
+
+		.mb20 {
+			margin-bottom: 20rpx;
+		}
+	}
+</style>

+ 39 - 1
pages/home/myTicket/myTicket.vue

@@ -1,6 +1,16 @@
 <template>
 	<view class="kd-work-container">
-		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="orderType == 1 ? '工单待办' : '工单已办'" @clickLeft="back"></uni-nav-bar>
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="orderType == 1 ? '工单待办' : '工单已办'" right-icon="scan" @clickLeft="back" @clickRight="HandlScanCode">
+			<view slot="right">
+				<u-icon
+					name="scan"
+					color="#fff"
+					size="60"
+					:custom-style="{
+						backgroundColor: '#157A2C'
+					}"></u-icon>
+			</view>
+		</uni-nav-bar>
 		<view class="top-wrapper">
 			<view class="top-tabs">
 				<u-tabs
@@ -63,6 +73,7 @@
 	import { getWorkOrderList, statistics } from '@/api/myTicket'
 	import KdCard from '../components/KdCard/index.vue'
 	import CardTime from '../components/CardTime.vue'
+	import { getByFixCode } from '@/api/repair'
 	import { nextTick } from 'vue'
 	// import { postJ } from '@/utils/api'
 	let [isEnd] = [false]
@@ -305,6 +316,33 @@
 			this.getCount()
 		},
 		methods: {
+			// 相机扫码
+			HandlScanCode() {
+				uni.scanCode({
+					success: res => {
+						console.log('res------------------------')
+						console.log(res.result)
+						let obj = {}
+						if (res.result.includes('/')) {
+							let dataArray = res.result.split('/')
+							obj = {
+								fixCode: dataArray[0],
+								code: ''
+							}
+						} else {
+							obj = {
+								fixCode: '',
+								code: res.result
+							}
+						}
+						getByFixCode(obj).then(res => {
+							uni.navigateTo({
+								url: `/pages/home/myTicket/detail?deviceId=${res.id}&type=${this.tabList[this.activeIndex].workOrderType}`
+							})
+						})
+					}
+				})
+			},
 			// 紧急度选择
 			doneChange(id) {},
 			doSearch() {

+ 9 - 2
pages/maintenanceWorkorder/detail/detail.vue

@@ -125,10 +125,13 @@
 						<text class="kd-label">来源编码</text>
 						{{ repairInfo.sourceType }}
 					</view>
-
 					<view class="kd-cell">
 						<text class="kd-label">固资编码</text>
-						{{ repairInfo.fixCode }}
+						{{ equipmentInfo.fixCode }}
+					</view>
+					<view class="kd-cell">
+						<text class="kd-label">内部编码</text>
+						{{ equipmentInfo.codeNumber }}
 					</view>
 					<view class="kd-cell">
 						<text class="kd-label">报修部门</text>
@@ -211,6 +214,10 @@
 					<text class="kd-label">固资编码</text>
 					{{ equipmentInfo.fixCode }}
 				</view>
+				<view class="kd-cell">
+					<text class="kd-label">内部编码</text>
+					{{ equipmentInfo.codeNumber }}
+				</view>
 				<view class="kd-cell">
 					<text class="kd-label">规格型号</text>
 					{{ equipmentInfo.category && equipmentInfo.category.category.specification }}|{{ equipmentInfo.category && equipmentInfo.category.category.modelType }}

+ 14 - 2
pages/repair/repair/index.vue

@@ -412,8 +412,20 @@
 					success: res => {
 						console.log('res------------------------')
 						console.log(res.result)
-						let dataArray = res.result.split('/')
-						getByFixCode(dataArray[0]).then(res => {
+						let obj = {}
+						if (res.result.includes('/')) {
+							let dataArray = res.result.split('/')
+							obj = {
+								fixCode: dataArray[0],
+								code: ''
+							}
+						} else {
+							obj = {
+								fixCode: '',
+								code: res.result
+							}
+						}
+						getByFixCode(obj).then(res => {
 							this.addForm = {
 								...res.category.category,
 								...res,

+ 1 - 1
pages/repair/repair/selectEquipment.vue

@@ -150,7 +150,7 @@
 					title: '加载中'
 				})
 				this.isEnd = false
-				getPageList({ pageNum: this.pageNum, size: 10, categoryLevelId: this.categoryLevelId, rootCategoryLevelId: this.rootCategoryLevelId, argument: this.keyWord }).then(data => {
+				getPageList({ pageNum: this.pageNum, size: 10, categoryLevelId: this.categoryLevelId, rootCategoryLevelId: this.rootCategoryLevelId, argument: this.keyWord, code: '' }).then(data => {
 					this.list = this.list.concat(data.list)
 					this.total = data.count
 					if (this.list.length >= this.total) {