Răsfoiți Sursa

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

ysy 1 an în urmă
părinte
comite
cf0c2f51ca

+ 80 - 13
api/repair/index.js

@@ -1,4 +1,8 @@
-import { postJ, post, get } from '@/utils/request'
+import {
+	postJ,
+	post,
+	get
+} from '@/utils/request'
 import Vue from 'vue'
 
 // 通过工单查询详情
@@ -39,14 +43,6 @@ export async function getDetailById(data) {
 	return Promise.reject(new Error(res.message))
 }
 
-// 批次明细
-export async function getBatchDetails(data) {
-	const res = await get(Vue.prototype.apiUrl + `/wms/outin/getBatchDetails`, data)
-	if (res.code == 0) {
-		return res.data
-	}
-	return Promise.reject(new Error(res.data.message))
-}
 
 // 出库
 export async function saveNew(data) {
@@ -59,7 +55,7 @@ export async function saveNew(data) {
 
 // 申请备品备件
 export async function applySpareParts(data) {
-	const res = await postJ(Vue.prototype.apiUrl + `/eam/workorder/applySpareParts`, data)
+	const res = await postJ(Vue.prototype.apiUrl + `/eam/spare_parts_apply/add`, data)
 	if (res.code == 0) {
 		return res.data
 	}
@@ -68,7 +64,7 @@ export async function applySpareParts(data) {
 
 //库存台账-库存明细-物料维度
 export async function getMaterielDetails(data) {
-	const res = await get(Vue.prototype.apiUrl + `/wms/outin/getMaterielDetails`, data)
+	const res = await get(Vue.prototype.apiUrl + `/wms/materialDetail/page`, data)
 	if (res.code == 0) {
 		return res.data
 	}
@@ -77,13 +73,45 @@ export async function getMaterielDetails(data) {
 
 //库存台账-库存明细
 export async function getInventoryDetails(data) {
-	const res = await get(Vue.prototype.apiUrl + `/wms/outin/getInventoryDetails`, data)
+	const res = await get(Vue.prototype.apiUrl + `/wms/outInDetailRecordTwo/page`, data)
 	if (res.code == 0) {
 		return res.data
 	}
 	return Promise.reject(new Error(res.data.message))
 }
-
+// 批次明细
+export async function getBatchDetails(data) {
+	const res = await get(Vue.prototype.apiUrl + `/wms/outindetailtwo/batchPage`, data)
+	if (res.code == 0) {
+		return res.data
+	}
+	return Promise.reject(new Error(res.data.message))
+}
+// 物品维度
+export async function getProductList(data) {
+	const res = await get(Vue.prototype.apiUrl + `/wms/outindetailtwo/page`, data)
+	if (res.code == 0) {
+		return res.data
+	}
+	return Promise.reject(new Error(res.data.message))
+}
+// 通过台账id获取出库物品详情
+export async function getHierarchyList(params) {
+	const res = await get(Vue.prototype.apiUrl +`/wms/outintwo/getHierarchyList`, {
+		params
+	});
+	if (res.data.code == 0) {
+		return res.data.data;
+	}
+	return Promise.reject(new Error(res.data.message));
+}
+export async function getHierarchyFifo(data) {
+	const res = await postJ(Vue.prototype.apiUrl +'/wms/outintwo/getHierarchyFifo', data);
+	if (res.data.code == 0) {
+		return res.data.data;
+	}
+	return Promise.reject(new Error(res.data.message));
+}
 //历史维修列表
 export async function historyRepairList(data) {
 	const res = await get(Vue.prototype.apiUrl + `/eam/PdaWorkOrder/historyRepairList`, data)
@@ -137,3 +165,42 @@ export async function getByFixCode(data) {
 	}
 	return Promise.reject(new Error(res.message))
 }
+
+// // 详情列表
+export async function getSparePartsApply (id) {
+  const res = await get(Vue.prototype.apiUrl +`/eam/spare_parts_apply/details/${id}`);
+  if (res.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.message));
+}
+
+// // 详情
+export async function detailsId (id) {
+  const res = await get(Vue.prototype.apiUrl +`/eam/spare_parts_apply/detailsId/${id}`);
+  if (res.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.message));
+}
+/**
+ * 列表
+ */
+export async function getList (data) {
+  const res = await postJ(Vue.prototype.apiUrl +'/eam/spare_parts_apply/page', data);
+  if (res.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.message));
+}
+
+// 详情
+export async function getWordOrderDetail(workOrderId) {
+  const res = await get(
+    Vue.prototype.apiUrl +`/eam/workordermaintenance/maintenanceDetail/${workOrderId}`
+  );
+  if (res.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.message));
+}

+ 36 - 19
pages.json

@@ -41,22 +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/myTicket/detail",
+			"style": {
+				"navigationBarTitleText": "关联工单",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
+		},
+		{
+			"path": "pages/home/myTicket/index",
+			"style": {
+				"navigationBarTitleText": "详情",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
+		},
 		{
 			"path": "pages/home/wt/message/message",
 			"style": {
@@ -525,6 +525,24 @@
 				"navigationBarTextStyle": "white"
 			}
 		},
+		{
+
+			"path": "pages/maintenanceWorkorder/sparepart/index",
+			"style": {
+				"navigationBarTitleText": "备品备件申请单",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
+		},
+		{
+			"path": "pages/maintenanceWorkorder/sparepart/sparepart",
+			"style": {
+				"navigationBarTitleText": "申请备品备件",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
+		},
+
 		{
 			"path": "pages/maintenanceWorkorder/detail/detail",
 			"style": {
@@ -1789,8 +1807,7 @@
 		"borderStyle": "black",
 		"backgroundColor": "#ffffff",
 		"fontSize": "14px",
-		"list": [
-			{
+		"list": [{
 				"pagePath": "pages/home/home",
 				"iconPath": "static/tab/home.png",
 				"selectedIconPath": "static/tab/home_.png",
@@ -1819,4 +1836,4 @@
 	"app-plus": {
 		"softinputMode": "adjustPan"
 	}
-}
+}

+ 8 - 0
pages/index/index.vue

@@ -299,6 +299,14 @@
 						url: `/pages/repair/repair/index`,
 						icon: 'icon-gongdanguanli',
 						badge: 0
+					},
+					{
+						name: '备品备件申请单',
+						type: 'sparepart',
+						workOrderType: 4,
+						url: `/pages/maintenanceWorkorder/sparepart/index`,
+						icon: 'icon-gongdanguanli',
+						badge: 0
 					}
 					/*	{
 							class: "iconfont icon-xundianjian",

+ 137 - 57
pages/maintenance/detail/detail.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="maintenance-container">
-		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="保养工单详情" @clickLeft="back" @clickRight="HandlScanCode"></uni-nav-bar>
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="保养工单详情" @clickLeft="back"
+			@clickRight="HandlScanCode"></uni-nav-bar>
 		<view class="maintenance-wrapper">
 			<view class="maintenance-content">
 				<KdTabs v-model="active" @change="handleTabChange" :list="['基本信息', '保养设备', '备品备件']" />
@@ -19,7 +20,8 @@
 					</view>
 					<view class="kd-cell">
 						<text class="kd-label">保养设备总数</text>
-						<text class="kd-content text-warning">{{ worksheetInfo.finishNum }}/{{ worksheetInfo.total }}</text>
+						<text
+							class="kd-content text-warning">{{ worksheetInfo.finishNum }}/{{ worksheetInfo.total }}</text>
 					</view>
 					<view class="kd-cell">
 						<text class="kd-label">计划完成时长</text>
@@ -27,7 +29,8 @@
 					</view>
 					<view class="kd-cell">
 						<text class="kd-label">实际完成时长</text>
-						<text class="kd-content">{{ finishTime(worksheetInfo.acceptTime, worksheetInfo.finishTime) }}</text>
+						<text
+							class="kd-content">{{ finishTime(worksheetInfo.acceptTime, worksheetInfo.finishTime) }}</text>
 					</view>
 					<view class="kd-cell">
 						<text class="kd-label">实际开始时间</text>
@@ -58,7 +61,8 @@
 							<button class="btn-execute" type="primary" @click="handleReport">报工</button>
 							<button class="btn-sparepart" type="warning" @click="handlbpbj">申请备品备件</button>
 						</template>
-						<button v-else-if="worksheetInfo.orderStatus === 3" :disabled="true" class="btn-execute" type="primary">已报工</button>
+						<button v-else-if="worksheetInfo.orderStatus === 3" :disabled="true" class="btn-execute"
+							type="primary">已报工</button>
 						<!-- <div class="apply-box">
               <button
                 v-if="worksheetInfo.status.code !== 3"
@@ -81,7 +85,8 @@
 				</view>
 				<view class="kd-equipment" v-show="active === 1">
 					<view class="kd-type-box">
-						<view :class="{ 'type—active': typeActive === index }" v-for="(item, index) in equpStatus" :key="index" @click="typeChange(index)">
+						<view :class="{ 'type—active': typeActive === index }" v-for="(item, index) in equpStatus"
+							:key="index" @click="typeChange(index)">
 							{{ item.name }}
 							<text v-if="item.count > 0" class="count">{{ item.count }}</text>
 						</view>
@@ -110,28 +115,40 @@
 										<view class="kd-cell">
 											<text class="kd-label">执行结果</text>
 											<text class="kd-content">
-												<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>
+												<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>
 											</text>
 										</view>
 									</view>
 									<view class="card-footer">
-										<button v-if="item.orderStatus == 2 && item.executeStatus == 0" type="primary" class="primary-btn" @click="handleCheck(item)">检查</button>
+										<button v-if="item.orderStatus == 2 && item.executeStatus == 0" type="primary"
+											class="primary-btn" @click="handleCheck(item)">检查</button>
 										<!-- <button type="primary" class="primary-btn" @click="handleExecute" v-if="item.orderStatus == 2 && item.executeStatus == 0">开始执行</button> -->
 										<template v-if="item.orderStatus && item.orderStatus === 3">
-											<button type="default" v-if="item.resultStatus === 2" @click="handLbx(item)">报修</button>
-											<button type="default" v-else-if="item.resultStatus === 3" @click="handLbxDetail(item)">报修详情</button>
+											<button type="default" v-if="item.resultStatus === 2"
+												@click="handLbx(item)">报修</button>
+											<button type="default" v-else-if="item.resultStatus === 3"
+												@click="handLbxDetail(item)">报修详情</button>
 										</template>
-										<button type="default" v-if="[0, 2, 3].includes(item.orderStatus) && item.executeStatus != 0" @click="checkDetail(item)">保养详情</button>
+										<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>
 					</view>
 				</view>
-				<view class="spare-parts" v-show="active === 2">
+				<view class="spare-parts" v-if="active == 2">
+					<pickCard :list="sparePartsApply" />
+				</view>
+				<!-- 	<view class="spare-parts" v-show="active === 2">
 					<Step>
 						<StepItem v-for="(item, index) in repairInfoLogList" :key="index" :active="index == 0" :hideContent="Boolean(item.content)">
 							<template v-slot:header>
@@ -189,18 +206,12 @@
 						</StepItem>
 					</Step>
 					<PopSparePart ref="PopSparePart" :workOrderCode="workOrderCode" :noRequest="true"></PopSparePart>
-				</view>
+				</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-dialog ref="inputClose" mode="input" title="您当前已超出计划完成时间,请填写原因" placeholder="请输入内容"
+				:before-close="true" @close="handleClose" @confirm="timeoutCauseConfirm"></uni-popup-dialog>
 		</uni-popup>
 		<u-modal :show="modalShow" title="提示" @confirm="modalShow = false">
 			<view>
@@ -219,14 +230,29 @@
 	import Step from '@/components/Step/Step.vue'
 	import StepItem from '@/components/Step/StepItem.vue'
 	import PopSparePart from '../../maintenanceWorkorder/components/PopSparePart.vue'
-	import { getWorkOrderDetail, getDeviceList, startExecuting, signingWork, devicestatistics } from '@/api/myTicket/index.js'
-	import { getSpareParts } from '@/api/repair'
-	import { get, post, postJ } from '@/utils/api.js'
+	import {
+		getWorkOrderDetail,
+		getDeviceList,
+		startExecuting,
+		signingWork,
+		devicestatistics
+	} from '@/api/myTicket/index.js'
+	import {
+		getSpareParts,
+		getSparePartsApply,
+		getWordOrderDetail
+	} 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 dayjs from 'dayjs'
 	import ScanCode from '@/components/ScanCode.vue'
+	import pickCard from '@/pages/maintenanceWorkorder/components/pickCard.vue'
 	export default {
 		components: {
 			CellInfo,
@@ -235,7 +261,8 @@
 			ScanCode,
 			Step,
 			StepItem,
-			PopSparePart
+			PopSparePart,
+			pickCard
 		},
 		data() {
 			return {
@@ -261,6 +288,7 @@
 					workOrder: {}
 				},
 				repairInfoLogList: [],
+				sparePartsApply: [],
 				equpStatus: [
 					// {
 					//   name: '全部',
@@ -313,28 +341,46 @@
 			uni.$off('scancodedate')
 		},
 		methods: {
-			// 备件使用明细
-			handlbjsymx(title, list) {
-				this.$refs.PopSparePart.open(title, list)
-			},
+
 			// 跳转备品备件
-			handlbpbj() {
+		async handlbpbj() {
+				let data = await getWordOrderDetail(this.worksheetInfo.id);
+				data.deviceList = data.deviceList.map((item) => {
+					return item.substance;
+				});
+				data['pageType'] = 'add'
 				uni.navigateTo({
-					url: `/pages/maintenanceWorkorder/sparepart/sparepartList?id=${this.pageId}`
+					url: `/pages/maintenanceWorkorder/sparepart/sparepart?data=${JSON.stringify(data)}`
 				})
+
+			},
+			//获取备品备件
+			async getSparePartsApply(id) {
+				const list = await getSparePartsApply(id)
+				this.sparePartsApply = list
 			},
 			getCount() {
-				devicestatistics({ planId: this.planId }).then(data => {
+				devicestatistics({
+					planId: this.planId
+				}).then(data => {
 					this.equpStatus = this.equpStatus.map(item => {
 						switch (item.name) {
 							case '全部':
-								return { ...item, count: data.total }
+								return {
+									...item, count: data.total
+								}
 							case '待检':
-								return { ...item, count: data.isInspectedNum }
+								return {
+									...item, count: data.isInspectedNum
+								}
 							case '已检':
-								return { ...item, count: data.checkedNum }
+								return {
+									...item, count: data.checkedNum
+								}
 							case '异常':
-								return { ...item, count: data.abnormalNum }
+								return {
+									...item, count: data.abnormalNum
+								}
 						}
 					})
 				})
@@ -348,7 +394,7 @@
 				let _this = this
 				uni.scanCode({
 					onlyFromCamera: true,
-					success: function (res) {
+					success: function(res) {
 						_this.Scancodedate(res.result)
 					}
 				})
@@ -361,7 +407,7 @@
 						content: '工单未开启执行,不可进行保养操作,请先点击“开始执行”!',
 						confirmText: '开始执行', //这块是确定按钮的文字
 						cancelText: '取消', //这块是取消的文字
-						success: function (res) {
+						success: function(res) {
 							if (res.confirm) {
 								_this.handleExecute() // 执行确认后的操作
 							} else {
@@ -422,7 +468,7 @@
 							content: '本工单中,无此设备!',
 							confirmText: '好的', //这块是确定按钮的文字
 							showCancel: false,
-							success: function (res) {
+							success: function(res) {
 								if (res.confirm) {
 									// 执行确认后的操作
 								} else {
@@ -479,7 +525,8 @@
 						icon: 'none'
 					})
 				} else {
-					if (new Date(this.worksheetInfo.acceptTime).getTime() + this.worksheetInfo.duration * 60 * 1000 < new Date().getTime()) {
+					if (new Date(this.worksheetInfo.acceptTime).getTime() + this.worksheetInfo.duration * 60 * 1000 <
+						new Date().getTime()) {
 						this.$refs.inputDialog.open()
 						return
 					}
@@ -501,7 +548,10 @@
 				this._report(value)
 			},
 			_report(timeoutCause = '') {
-				signingWork({ id: this.pageId, timeoutCause: timeoutCause }).then(() => {
+				signingWork({
+					id: this.pageId,
+					timeoutCause: timeoutCause
+				}).then(() => {
 					uni.showToast({
 						icon: 'success',
 						title: '操作成功!',
@@ -512,7 +562,9 @@
 			},
 			// 执行工单
 			handleExecute() {
-				startExecuting({ id: this.pageId }).then(() => {
+				startExecuting({
+					id: this.pageId
+				}).then(() => {
 					uni.showToast({
 						icon: 'success',
 						title: '操作成功!',
@@ -568,21 +620,30 @@
 			// 		url: `/pages/maintenance/check/detail?workOrderId=${this.pageId}&id=${id}&equiName=${equiName}&equiCode=${equiCode}&applyOrder=${this.worksheetInfo.applyOrder}&workOrderCode=${this.worksheetInfo.workOrderCode}`
 			// 	})
 			// },
-			handleCheck({ id }) {
+			handleCheck({
+				id
+			}) {
 				uni.navigateTo({
 					url: `/pages/maintenance/check/index?id=${id}`
 				})
 			},
-			checkDetail({ id }) {
+			checkDetail({
+				id
+			}) {
 				uni.navigateTo({
 					url: `/pages/maintenance/check/detail?id=${id}`
 				})
 			},
 			getInfo() {
-				getWorkOrderDetail({ workId: this.pageId }).then(data => {
+				getWorkOrderDetail({
+					workId: this.pageId
+				}).then(data => {
 					this.worksheetInfo = data
+					this.getSparePartsApply(data.id)
 				})
-				getSpareParts({ workOrderId: this.pageId }).then(data => {
+				getSpareParts({
+					workOrderId: this.pageId
+				}).then(data => {
 					let list = JSON.parse(JSON.stringify(data))
 					this.repairInfoLogList = list.reverse()
 					this.repairInfoLogList.forEach(item => {
@@ -596,14 +657,14 @@
 						}
 						if (item.type === 'SPARE_PARTS_APPLY') {
 							this.logs[item.id].content.infoList =
-								this.logs[item.id].content && this.logs[item.id].content.infoList && this.logs[item.id].content.infoList.length > 0
-									? this.logs[item.id].content.infoList.map(item => {
-											return {
-												...JSON.parse(item.sparePartsList),
-												sparePartsId: item.sparePartsId
-											}
-									  })
-									: []
+								this.logs[item.id].content && this.logs[item.id].content.infoList && this
+								.logs[item.id].content.infoList.length > 0 ?
+								this.logs[item.id].content.infoList.map(item => {
+									return {
+										...JSON.parse(item.sparePartsList),
+										sparePartsId: item.sparePartsId
+									}
+								}) : []
 						}
 						console.log('this.logs---------------')
 						console.log(this.logs)
@@ -674,14 +735,17 @@
 		width: 100vw;
 		display: flex;
 		flex-direction: column;
+
 		/deep/.u-popup {
 			flex: none !important;
 		}
 	}
+
 	.maintenance-wrapper {
 		position: relative;
 		flex: 1;
 	}
+
 	.maintenance-content {
 		padding-top: 40rpx;
 		box-sizing: border-box;
@@ -700,26 +764,31 @@
 		border-bottom: 1px dashed #dadada;
 		display: flex;
 		justify-content: space-between;
+
 		.kd-label {
 			display: inline-block;
 			width: 7em;
 			font-weight: bold;
 		}
+
 		.kd-content {
 			flex: 1;
 			text-align: left;
 			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;
@@ -737,6 +806,7 @@
 					background-color: #1e7f35;
 					color: #fff;
 				}
+
 				.count {
 					position: absolute;
 					top: -9px;
@@ -750,6 +820,7 @@
 				}
 			}
 		}
+
 		.kd-list-container {
 			flex: 1;
 			display: flex;
@@ -764,6 +835,7 @@
 			}
 		}
 	}
+
 	.spare-parts {
 		flex: 1;
 		overflow: hidden;
@@ -775,24 +847,30 @@
 		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;
@@ -800,11 +878,13 @@
 				font-size: 28rpx;
 				margin: 0 8rpx;
 			}
+
 			.primary-btn {
 				background-color: $j-primary-border-green;
 			}
 		}
 	}
+
 	.apply-box {
 		width: 70%;
 		margin: 0 auto;
@@ -812,4 +892,4 @@
 		align-items: center;
 		justify-content: space-around;
 	}
-</style>
+</style>

+ 216 - 0
pages/maintenanceWorkorder/components/pickCard.vue

@@ -0,0 +1,216 @@
+<template>
+	<view>
+
+		<view class="card_box" v-for="(item, index) in list" :key="index" @click="openDetails(item,'detail')">
+			<view class="item_box rx-bc">
+				<view class="orderId">{{item.code}} </view>
+			</view>
+
+			<view class="item_box rx-bc">
+				<view class="item_one rx-sc">
+					<view class="lable">工单编码:</view>
+					<view>{{item.repairCode}}</view>
+				</view>
+
+			</view>
+
+			<view class="item_box rx-bc">
+
+				<view class="item_one  rx-sc">
+					<view>工单名称:</view>
+					<view>{{item.repairName}}</view>
+				</view>
+			</view>
+			<view class="item_box rx-bc">
+				<view class="item_one  rx-sc">
+					<view class="lable">设备名称:</view>
+					<view>{{item.deviceList.filter((val) => val.name).map((val) => val.name).toString()}}</view>
+				</view>
+
+			</view>
+			<view class="item_box rx-bc">
+
+				<view class="item_one rx-sc">
+					<view>固资编码:</view>
+					<view>{{item.deviceList.filter((val) => val.fixCode).map((val) => val.fixCode).toString()}}
+					</view>
+				</view>
+			</view>
+
+
+			<view class="item_box rx-bc">
+				<view class="item_one  rx-sc">
+					<view class="lable">设备编码:</view>
+					<view>{{item.deviceList.filter((val) => val.deviceCode).map((val) => val.deviceCode).toString()}}
+					</view>
+				</view>
+
+			</view>
+
+			<view class="item_box rx-bc">
+				<view class="item_one perce50 rx-sc">
+					<view>领用部门:</view>
+					<view>{{item.useDeptName}}</view>
+				</view>
+				<view class="item_one perce50 rx-sc">
+					<view class="lable">领用人:</view>
+					<view>{{item.userName}}</view>
+				</view>
+
+			</view>
+			<view class="item_box rx-bc">
+				<view class="item_one perce50 rx-sc">
+					<view>领用时间:</view>
+					<view>{{item.usageTime}}</view>
+				</view>
+				<view class="item_one perce50 rx-sc">
+					<view class="lable">状态:</view>
+					<view>{{statusOpt[item.status]}}</view>
+				</view>
+
+			</view>
+
+
+
+
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			list: {
+				type: Array,
+				default: () => []
+			},
+		},
+
+		data() {
+			return {
+				outputSceneState: [{
+						code: 1,
+						label: '退供出库'
+					},
+					{
+						code: 2,
+						label: '调拨出库'
+					},
+					{
+						code: 3,
+						label: '销售出库'
+					},
+					{
+						code: 4,
+						label: '领用出库'
+					},
+					{
+						code: 5,
+						label: '报废出库'
+					},
+					{
+						code: 6,
+						label: '外协出库'
+					},
+					{
+						code: 7,
+						label: '委外出库'
+					},
+					{
+						code: 8,
+						label: '受托退货出库'
+					},
+					{
+						code: 9,
+						label: '仓库委外出库'
+					},
+					{
+						code: 10,
+						label: '采购退货出库'
+					},
+					{
+						code: 11,
+						label: '自选领用出库'
+					},
+					{
+						code: 12,
+						label: '配料出库'
+					}
+				],
+				statusOpt: {
+					0: '审核中',
+					1: '审核通过',
+
+				}
+			}
+		},
+		methods: {
+
+
+			openDetails(data, id) {
+				data['pageType'] = 'detail'
+				uni.navigateTo({
+					url: `/pages/maintenanceWorkorder/sparepart/sparepart?data=${JSON.stringify(data)}`
+				})
+			}
+		}
+
+	}
+</script>
+
+
+<style lang="scss" scoped>
+	.card_box {
+		width: 750rpx;
+		padding: 16rpx 24rpx;
+		box-sizing: border-box;
+		border-bottom: 2rpx solid #E1E1E1;
+
+
+		.item_box {
+			margin-top: 10rpx;
+
+
+
+			.orderId {
+				color: #000;
+				font-family: PingFang HK;
+				font-size: 28rpx;
+				font-style: normal;
+				font-weight: 600;
+				margin-top: 8rpx;
+			}
+
+			.item_one {
+				width: 100%;
+				font-size: 26rpx;
+				font-style: normal;
+				font-weight: 400;
+				line-height: 38rpx;
+				word-wrap: break-word;
+			}
+
+			.gylx {
+				color: $theme-color;
+			}
+
+			.perce50 {
+				width: 50%;
+			}
+
+			.status {
+				font-size: 26rpx;
+
+				&.FAA {
+					color: #FFA929;
+				}
+			}
+
+
+			/deep/ .uni-checkbox-input-checked {
+				background-color: $theme-color !important;
+				border-color: $theme-color !important;
+			}
+		}
+	}
+</style>

+ 108 - 34
pages/maintenanceWorkorder/detail/detail.vue

@@ -2,8 +2,17 @@
 	<view :class="{ popupShow: popupShow }">
 		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="维修工单详情" @clickLeft="back"></uni-nav-bar>
 		<view class="tab-title">
-			<view v-for="(item, index) in tabList" :key="index" class="tab-item" v-text="item.label" :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)"></view>
+			<view>
+				<text v-for="(item, index) in tabList" :key="index" class="tab-item" v-text="item.label"
+					:class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)">
+				</text>
+			</view>
+
 		</view>
+		<!-- 		<uni-list direction="row" >
+			
+			<uni-list-item v-for="(item, index) in tabList" :key="index"  :title="item.label" ></uni-list-item>
+		</uni-list> -->
 		<view class="main">
 			<!-- 工单信息 -->
 			<view class="kd-baseInfo" v-if="pickTabIndex == 0">
@@ -86,14 +95,16 @@
 						<view class="zp-btn btns" @click="handlZp" v-if="worksheetInfo.status.code === 8">转派</view>
 					</div> -->
 				</view>
-				<view class="zxpg-wrap" v-if="orderType == 1 && repairInfo.orderStatus == 3 && repairInfo.requestUserId == userId">
+				<view class="zxpg-wrap"
+					v-if="orderType == 1 && repairInfo.orderStatus == 3 && repairInfo.requestUserId == userId">
 					<view class="zx-btn btns" @click="searchShow = true">验收</view>
 				</view>
 
 				<Assign ref="Assign" @success="handleAssign"></Assign>
 				<SearchPopup mode="center" v-if="searchShow">
 					<template v-slot:list>
-						<maintain_course :repairInfoLogList="repairInfoLogs" :workOrderCode="workOrderCode"></maintain_course>
+						<maintain_course :repairInfoLogList="repairInfoLogs" :workOrderCode="workOrderCode">
+						</maintain_course>
 					</template>
 
 					<template v-slot:operate>
@@ -103,8 +114,10 @@
 						<!-- <u-input v-model="remark" type="textarea" border="true" placeholder="请输入内容" /> -->
 						<!-- <u--textarea v-model="remark" placeholder="请输入内容"></u--textarea> -->
 						<view class="operate_box">
-							<u-button :loading="btnLoading" type="success" size="small" class="u-reset-button" @click="surereject(4)">验收</u-button>
-							<u-button :loading="btnLoading" size="small" class="u-reset-button" @click="surereject(5)">驳回</u-button>
+							<u-button :loading="btnLoading" type="success" size="small" class="u-reset-button"
+								@click="surereject(4)">验收</u-button>
+							<u-button :loading="btnLoading" size="small" class="u-reset-button"
+								@click="surereject(5)">驳回</u-button>
 							<u-button size="small" class="u-reset-button" @click="searchShow = false">取消</u-button>
 						</view>
 					</template>
@@ -272,7 +285,10 @@
 										{{ item.remark }}
 									</view>
 									<view class="img-wrap" v-if="item.repairsImg">
-										<image class="img" @click="clickImg(item.repairsImg.split(','), item_s)" :src="apiUrl + item_s" v-for="(item_s, index_s) in item.repairsImg.split(',')" :key="index_s"></image>
+										<image class="img" @click="clickImg(item.repairsImg.split(','), item_s)"
+											:src="apiUrl + item_s"
+											v-for="(item_s, index_s) in item.repairsImg.split(',')" :key="index_s">
+										</image>
 									</view>
 								</view>
 							</view>
@@ -283,7 +299,10 @@
 										{{ item.repairReportExplain }}
 									</view>
 									<view class="img-wrap" v-if="item.workOrderImg">
-										<image class="img" @click="clickImg(item.workOrderImg.split(','), item_s)" :src="apiUrl + item_s" v-for="(item_s, index_s) in item.workOrderImg.split(',')" :key="index_s"></image>
+										<image class="img" @click="clickImg(item.workOrderImg.split(','), item_s)"
+											:src="apiUrl + item_s"
+											v-for="(item_s, index_s) in item.workOrderImg.split(',')" :key="index_s">
+										</image>
 									</view>
 								</view>
 							</view>
@@ -293,6 +312,10 @@
 					</view>
 				</view>
 			</view>
+			<!-- 备品备件 sparePartsApply-->
+			<view class="wx-main" v-if="pickTabIndex == 5">
+				<pickCard :list="sparePartsApply" />
+			</view>
 		</view>
 		<PopSparePart ref="PopSparePart" :workOrderCode="sparePartWorkOrderCode" :noRequest="true"></PopSparePart>
 		<!-- <Approval v-if="isApproval && worksheetInfo.status && worksheetInfo.status.code == 5" :devOpsType="1" :planType="3" :myHandleId="myHandleId" :id="worksheetInfo.workOrderId" /> -->
@@ -302,18 +325,31 @@
 </template>
 
 <script>
-	import { startExecuting } from '@/api/myTicket/index.js'
+	import {
+		startExecuting
+	} from '@/api/myTicket/index.js'
 	import Step from '@/components/Step/Step.vue'
 	import StepItem from '@/components/Step/StepItem.vue'
 	import Assign from '@/components/Assign.vue'
 	import fold from '../components/fold.vue'
 	import HistoryRepairDetail from '../components/historyRepairDetail.vue'
 	import PopSparePart from '../components/PopSparePart.vue'
+	import pickCard from '../components/pickCard.vue'
 	// import Approval from '@/components/Approval.vue' // 审批组件
 	import maintain_course from '../components/maintain_course.vue'
 	import Notice from '../components/notice.vue'
-	import { get, postJ, post } from '@/utils/api.js'
-	import { getWorkOrderDetail, getAssetInfo, historyRepairList, acceptance } from '@/api/repair'
+	import {
+		get,
+		postJ,
+		post
+	} from '@/utils/api.js'
+	import {
+		getWorkOrderDetail,
+		getAssetInfo,
+		historyRepairList,
+		acceptance,
+		getSparePartsApply
+	} from '@/api/repair'
 	import SearchPopup from '@/pages/pda/components/searchPopup.vue'
 	export default {
 		components: {
@@ -326,7 +362,8 @@
 			maintain_course,
 			Notice,
 			HistoryRepairDetail,
-			SearchPopup
+			SearchPopup,
+			pickCard
 		},
 		computed: {
 			// 是否为自己的工单
@@ -353,11 +390,11 @@
 				popupShow: false,
 				repairHistoryList: [],
 				repairInfoLogs: [],
+				sparePartsApply: [],
 				id: '',
 				type: 1,
 				sparePartWorkOrderCode: '',
-				tabList: [
-					{
+				tabList: [{
 						label: '工单信息',
 						value: '0'
 					},
@@ -376,6 +413,10 @@
 					{
 						label: '维修记录',
 						value: '4'
+					},
+					{
+						label: '备品备件申请单',
+						value: '5'
 					}
 				],
 				pickTabIndex: 0,
@@ -452,7 +493,11 @@
 			// 获取历史维修记录
 			getHistoryRepairList(deviceId) {
 				console.log('historyRepairList----------------')
-				historyRepairList({ id: deviceId, pageNum: 1, size: 999 }).then(data => {
+				historyRepairList({
+					id: deviceId,
+					pageNum: 1,
+					size: 999
+				}).then(data => {
 					this.repairHistoryList = data.list
 				})
 			},
@@ -461,26 +506,32 @@
 				getAssetInfo(deviceId).then(res => {
 					if (res) {
 						this.equipmentInfo = res
-						this.$set(this.equipmentInfo, 'position', res.positionList?.length > 0 && res.positionList[0].pathName ? res.positionList[0].pathName : '')
+						this.$set(this.equipmentInfo, 'position', res.positionList?.length > 0 && res.positionList[
+							0].pathName ? res.positionList[0].pathName : '')
 					}
 				})
 			},
+			//获取备品备件
+			async getSparePartsApply(id) {
+				const list = await getSparePartsApply(id)
+				this.sparePartsApply = list
+			},
 			getInfo() {
 				getWorkOrderDetail(this.workOrderCode).then(data => {
 					this.worksheetInfo = data.ticketsInfoResponse
 					this.repairInfo = data.repairRequestResponse
 					this.getDeviceInfo(this.worksheetInfo.deviceId)
 					this.getHistoryRepairList(this.worksheetInfo.deviceId)
+					this.getSparePartsApply(this.worksheetInfo.id)
 					let repairInfoLogs =
-						data.ticketsInfoResponse.repairLogVOS?.length > 0
-							? data.ticketsInfoResponse.repairLogVOS.map(item => {
-									return {
-										...item,
-										requestUserName: data.repairRequestResponse.requestUserName,
-										remark: data.repairRequestResponse.remark
-									}
-							  })
-							: []
+						data.ticketsInfoResponse.repairLogVOS?.length > 0 ?
+						data.ticketsInfoResponse.repairLogVOS.map(item => {
+							return {
+								...item,
+								requestUserName: data.repairRequestResponse.requestUserName,
+								remark: data.repairRequestResponse.remark
+							}
+						}) : []
 					this.repairInfoLogs = repairInfoLogs.reverse()
 					console.log('repairInfoLogs----------------------')
 					console.log(repairInfoLogs)
@@ -515,8 +566,13 @@
 			},
 			// 跳转备品备件
 			handlbpbj() {
+				this.equipmentInfo['category']['modelType'] = this.equipmentInfo.category && this.equipmentInfo.category
+					.category.modelType
+				let data = JSON.parse(JSON.stringify(this.worksheetInfo));
+				data['deviceList'] = [this.equipmentInfo];
+				data['pageType']='add'
 				uni.navigateTo({
-					url: `/pages/maintenanceWorkorder/sparepart/sparepartList?id=${this.id}`
+					url: `/pages/maintenanceWorkorder/sparepart/sparepart?data=${JSON.stringify(data)}`
 				})
 			},
 			// 查看备品备件 详情
@@ -544,7 +600,9 @@
 
 			// 执行工单
 			handleExecute() {
-				startExecuting({ id: this.id }).then(() => {
+				startExecuting({
+					id: this.id
+				}).then(() => {
 					uni.showToast({
 						icon: 'success',
 						title: '操作成功!',
@@ -591,9 +649,9 @@
 				wx.previewImage({
 					urls: urls, //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
 					current: this.apiUrl + indexUrl, // 当前显示图片的http链接,默认是第一个
-					success: function (res) {},
-					fail: function (res) {},
-					complete: function (res) {}
+					success: function(res) {},
+					fail: function(res) {},
+					complete: function(res) {}
 				})
 			},
 
@@ -629,19 +687,23 @@
 	.operate_box {
 		margin: 20rpx;
 		display: flex;
+
 		.u-reset-button {
 			flex: 1;
 			margin-right: 10rpx;
 		}
+
 		.u-textarea {
 			border: 1px solid #ddd;
 		}
 	}
+
 	.popupShow {
 		overflow: hidden;
 		position: fixed;
 		width: 100%;
 	}
+
 	.img-wrap {
 		flex: 1;
 		display: flex;
@@ -653,11 +715,13 @@
 			margin: 5px;
 		}
 	}
+
 	.tab-title {
 		position: fixed;
 		width: 100%;
-		display: flex;
-		justify-content: space-between;
+		// display: flex;
+		// justify-content: space-between;
+		overflow-x: auto;
 		height: 82rpx;
 		line-height: 82rpx;
 		background-color: #ffffff;
@@ -665,11 +729,18 @@
 		z-index: 99;
 		box-sizing: border-box;
 
+		>view {
+			width: 1050rpx;
+		}
+
 		.tab-item {
-			width: 50%;
+			// width: 50%;
+			min-width: 65rpx;
 			text-align: center;
 			font-size: 32rpx;
 			color: $uni-text-color-grey;
+			margin-left: 15px;
+			display: inline-block;
 		}
 
 		.tab-item.active {
@@ -727,11 +798,13 @@
 			line-height: 90rpx;
 			border-bottom: 1px dashed #dadada;
 			word-break: break-all;
+
 			.kd-label {
 				display: inline-block;
 				width: 8em;
 				font-weight: bold;
 			}
+
 			.kd-label2 {
 				display: inline-block;
 				width: 11em;
@@ -787,7 +860,7 @@
 							width: 140rpx;
 							height: 140rpx;
 
-							& + .img {
+							&+.img {
 								margin-left: 10rpx;
 							}
 						}
@@ -833,6 +906,7 @@
 		color: #4f7f00;
 		padding: 20rpx 0;
 	}
+
 	.apply-box {
 		width: 70%;
 		margin: 10rpx auto;
@@ -840,4 +914,4 @@
 		align-items: center;
 		justify-content: space-around;
 	}
-</style>
+</style>

+ 84 - 0
pages/maintenanceWorkorder/sparepart/index.vue

@@ -0,0 +1,84 @@
+<template>
+	<view>
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="备品备件申请单" @clickLeft="back"></uni-nav-bar>
+		<pickCard :list="list" />
+		<view v-show="list.length === 0" class="no_data">
+			<u-empty mode="data"></u-empty>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	import pickCard from '@/pages/maintenanceWorkorder/components/pickCard.vue'
+	import {
+		getList
+	} from '@/api/repair'
+	let [page, size, isEnd] = [1, 10, true]
+	export default {
+		components: {
+			pickCard
+		},
+		data() {
+			return {
+				list: [],
+			}
+		},
+		onShow() {
+			this.getFirstList()
+		},
+		onReachBottom: function() {
+			console.log(11, 'a')
+			if (isEnd) {
+				return
+			}
+			// 显示加载图标
+			uni.showLoading({
+				title: '数据加载中'
+			})
+			this.getMoreLists()
+		},
+		methods: {
+			getFirstList: function() {
+				page = 1
+				isEnd = true
+				this.getList()
+			},
+			getMoreLists: function() {
+				//获取更多数据
+				page++
+				this.getList()
+			},
+			getList() {
+				uni.showLoading({
+					title: '数据加载中'
+				})
+				let params = {
+					pageNum: page,
+					size
+				}
+				getList(params)
+					.then(res => {
+
+						if (page == 1) {
+							this.list = res.list
+						} else {
+							res.list.forEach(element => {
+								this.list.push(element)
+							})
+						}
+						isEnd = this.list.length >= res.count
+						uni.hideLoading()
+					})
+					.catch(() => {
+						uni.hideLoading()
+					})
+			},
+
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 456 - 957
pages/maintenanceWorkorder/sparepart/sparepart.vue

@@ -1,1071 +1,570 @@
 <template>
-	<view>
-		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="申请备品备件" @clickLeft="back"></uni-nav-bar>
-		<view class="sparepart-container">
-			<view class="infos">
-				<!-- <view class="col">
-          <text class="label">申领单号</text>
-          <text class="content">{{ formData.applyOrder }}</text>
-        </view>
-        <view class="col">
-          <text class="label">期望完成时间</text>
-          <text class="content" @click="timeShow = true">{{
-            formData.expectedPerformanceTime | timeFilter
-          }}</text>
-        </view> -->
-				<u-form labelPosition="left" :model="formData" ref="formRef" labelWidth="250" labelAlign="left" class="baseForm">
-					<!-- <u-form-item label="审核人部门" prop="verifyDeptName" borderBottom>
-            <u-input
-              :value="formData.verifyDeptName"
-              disableColor="#ffffff"
-              placeholder="请选择"
-              disabled
-              type="select"
-              clearable
-              @click.native="$refs.verifyTreePicker._show()"
-            />
-            <view slot="right" style="display: flex; align-item: center">
-              <u-icon
-                v-show="formData.verifyDeptName"
-                name="close-circle-fill"
-                @click="verifyDeptConfirm([], '')"
-              ></u-icon>
-              <u-icon name="arrow-right"></u-icon>
-            </view>
-          </u-form-item>
-          <u-form-item label="审核人" prop="approvalUserId" borderBottom>
-            <picker
-              @change="
-                e =>
-                  handlePicker(
-                    e,
-                    userList,
-                    'approvalUserId',
-                    'approvalUserName'
-                  )
-              "
-              :value="pickerIndex"
-              :range="userList"
-              range-key="name"
-            >
-              <u-input
-                :value="formData.approvalUserName"
-                disableColor="#ffffff"
-                placeholder="请选择"
-                disabled
-                type="select"
-              />
-            </picker>
-            <view slot="right" style="display: flex; align-item: center">
-              <u-icon
-                v-show="formData.approvalUserName"
-                name="close-circle-fill"
-                @click="
-                  handlePicker(null, [], 'approvalUserId', 'approvalUserName')
-                "
-              ></u-icon>
-              <u-icon name="arrow-right"></u-icon>
-            </view>
-          </u-form-item> -->
-					<u-form-item label="仓库:" prop="warehouseId" style="height: 120rpx" required>
-						<!-- <uni-datetime-picker type="datetime" v-model="formData.datetime" @change="changeLog" /> -->
-						<picker @change="bindPickerChange" :value="warehosueVal" :range="warehouseList" range-key="name">
-							<input disabled class="uni-input" v-model="warehosueName" placeholder="请选择" />
-						</picker>
-					</u-form-item>
-					<!-- <u-form-item
-            label="期望完成时间:"
-            prop="approvalUserId"
-            style="height: 120rpx"
-          >
-            <text class="content" @click="timeShow = true">{{
-              formData.expectedPerformanceTime | timeFilter
-            }}</text>
-          </u-form-item> -->
-				</u-form>
-			</view>
-			<view class="detail-title">
-				申请明细
-				<u-button @click="addGoods" type="success" size="small">添加物品</u-button>
-			</view>
-			<view class="detail-content">
-				<uni-collapse :key="forceUpdate" ref="collapseRef" v-model="collapseVal" accordion>
-					<uni-collapse-item :typeOpen="1" :name="item.informationCode" :show-animation="true" v-for="(item, index) in registerlist" :key="item.informationCode">
-						<template slot="title">
-							<view class="row">
-								<view class="col">
-									<view class="col-item">{{ item.informationName }}({{ item.informationCode }})</view>
+	<view class="main">
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" right-icon="scan" title="申请备品备件" @clickLeft="goHome"
+			></uni-nav-bar>
+		<KdTabs v-model="active" :list="['基本信息','设备信息','备品备件信息']" />
+		<view v-show="active==0">
+			<Cell cellType="more" title="编号">
+				<view class="cell-tip-right" slot="more">
+					{{ addForm.code  }}
+				</view>
+			</Cell>
+			<Cell cellType="more" title="工单编码">
+				<view class="cell-tip-right" slot="more">
+
+					{{ addForm.repairCode  }}
+				</view>
+			</Cell>
+			<Cell cellType="more" title="工单名称">
+				<view class="cell-tip-right" slot="more">
+
+					{{ addForm.repairName  }}
+				</view>
+			</Cell>
+	<!-- 		<Cell cellType="more" title="设备编号">
+				<view class="cell-tip-right" slot="more">
+		
+					{{ addForm.deviceCode }}
+				</view>
+			</Cell>
+			<Cell cellType="more" title="设备名称">
+				<view class="cell-tip-right" slot="more" v-if="sparePartsApplyList.length==0">
+					{{ addForm.deviceName }}
+				</view>
+				<view class="cell-tip-right" slot="more" v-else>
+					<uni-data-select style="width: 500rpx;" v-model="addForm.deviceId"
+						:localdata="sparePartsApplyList" @change="sparePartsApplyChange"
+						:clear="true"></uni-data-select>
+				</view>
+			</Cell>
+			<Cell cellType="more" title="固资编码">
+				<view class="cell-tip-right" slot="more">
+					{{ addForm.fixCode }}
+				</view>
+			</Cell> -->
+
+			<Cell cellType="more" title="领用部门">
+				<view class="cell-tip-right" slot="more">
+					{{ addForm.useDeptName }}
+				</view>
+			</Cell>
+			<Cell cellType="more" title="领用人">
+				<view class="cell-tip-right" slot="more">
+					{{ addForm.userName }}
+				</view>
+			</Cell>
+
+			<Cell cellType="more" title="使用时间">
+				<view class="cell-tip-right" slot="more">
+
+					<uni-datetime-picker v-if="type=='add'" type="date" class="picker" v-model="addForm.usageTime">
+
+					</uni-datetime-picker>
+					<text v-else>{{addForm.usageTime}}</text>
+				</view>
+
+			</Cell>
+			<Cell cellType="more" title="用途">
+				<u--textarea :disabled="type=='detail'" v-model="addForm.purpose" class="border" maxlength="500"
+					placeholder="请输入内容" count></u--textarea>
+
+			</Cell>
+		</view>
+	<view v-show="active==1" class="kd-equipment">
+
+	<!-- 		<u-button v-if="type=='add'" type="success" size="small" class="u-reset-button" @click="addDevice()"
+				text="添加物品"></u-button> -->
+			<view class="kd-list-container">
+				<u-list >
+					<u-list-item v-for="(item, index) in deviceList" :key="index">
+						<view class="kd-card">
+							<view class="kd-card-wrapper">
+								<uni-icons @click="del(item.id,1)" v-if="type=='add'" custom-prefix="iconfont"
+										type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
+								<view class="kd-cell">
+								
+									<text class="kd-label">设备编码</text>
+									{{ item.code }}
 								</view>
-								<view class="col">
-									<view class="col-item">规格/型号:{{ item.specification }}/{{ item.modelType }}</view>
-									<view class="col-item">{{ item.isUnpack ? '包装单位' : '计量单位' }}:{{ item.isUnpack ? `${item.measuringUnit}/${item.minPackUnit}` : item.measuringUnit }}</view>
+								<view class="kd-cell">
+									<text class="kd-label">设备名称</text>
+									{{ item.name }}
 								</view>
-								<view class="col">
-									<view class="col-item">所需数量:{{ item.selectNum || 0 }}{{ item.measuringUnit }}</view>
-									<view class="col-item text-primary" @click.stop="openPlus(item)">添加备品备件</view>
+								<view class="kd-cell">
+									<text class="kd-label">设备型号</text>
+									{{  item.category&&item.category.modelType||item.model }}
 								</view>
+							<!-- 	<view class="kd-cell">
+									<text class="kd-label">设备位置</text>
+									{{ item.deviceLocationName.pathName }}
+								</view> -->
+						
 							</view>
-						</template>
+				
+						</view>
+					</u-list-item>
+				</u-list>
+			</view>
+		</view>
+		<view v-show="active==2">
+
+			<u-button v-if="type=='add'" type="success" size="small" class="u-reset-button" @click="addPicking()"
+				text="添加物品"></u-button>
+			<view class="list_box">
+				<u-list >
+					<view v-for="(item, index) in tableList" :key="index" @change="e => selectVal(e, item, index)">
+
+						<view class="listBox-con">
+							<view class="listBox-top rx-bc">
 
-						<view class="instance-list">
-							<view class="" v-for="(itm, index) in item.tableData">
-								<view class="row">
-									<uni-icons type="trash" size="27" color="red" @click="handleDelete(item, itm, index)"></uni-icons>
-									<view class="col">
-										<view class="col-item">
-											{{ itm.onlyCode }}
-										</view>
-									</view>
-									<view class="col">
-										<view class="col-item">批次号:{{ itm.batchNum }}</view>
-										<view class="col-item">包装编码:{{ itm.num }}</view>
-									</view>
-									<view class="col">
-										<view class="col-item">{{ itm.manufactureTime ? '生产日期' : '采购日期' }}:{{ itm.manufactureTime || itm.procurementTime }}</view>
-									</view>
-									<view class="col" v-if="!itm.isUnpack">
-										<view class="col-item">最小包装单元:{{ itm.measurementUnit }}{{ itm.unit }}/{{ itm.minPackUnit }}</view>
-									</view>
-									<view class="col">
-										<view class="col-item">货位:{{ itm.warehouseName }}-{{ itm.areaName }}-{{ itm.shelfCode }}-{{ itm.cargoSpaceCode }}</view>
-									</view>
+								<view @click="del(item.id)"> <uni-icons v-if="type=='add'" custom-prefix="iconfont"
+										type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
+									{{ item.categoryName }}
 								</view>
 							</view>
-						</view>
-					</uni-collapse-item>
-				</uni-collapse>
 
-				<!-- <view class="col" v-for="(item, index) in registerlist" :key="item.id">
-          <view>
-            <view>{{ item.informationName }}</view>
-            <view style="color: #aaaaaa"
-              >({{ item.informationCode }}/{{ item.modelType }})</view
-            >
-          </view>
-          <u-number-box
-            v-model="item.num"
-            :step="1"
-            :min="0"
-            :name="index"
-            :disabledInput="true"
-            @change="numChange"
-          ></u-number-box>
-        </view>
-        <view class="plus" @click="openPlus">+</view> -->
-			</view>
-		</view>
-		<view class="sparepart-footer">
-			<button class="primary" @click="toSubmit">提交</button>
-			<button class="defualt" @click="back">返回</button>
-		</view>
-		<u-datetime-picker @confirm="timeConfirm" @cancel="timeCancel" :show="timeShow" v-model="formData.expectedPerformanceTime" mode="datetime"></u-datetime-picker>
+							<view class="listBox-bottom rx">
+								<view class="items">
+									<text>编码</text>
+									{{ item.categoryCode }}
+								</view>
+								<view class="items">
+									<text>牌号</text>
+									{{ item.brandNum }}
+								</view>
+								<view class="items">
+									<text>型号</text>
+									{{ item.categoryModel }}
+								</view>
+
+								<view class="items">
+									<text>规格</text>
+									{{ item.specification }}
+								</view>
+								<view class="items">
+									<text>级别</text>
+									{{ item.level }}
+								</view>
+								<view class="items" style="display: flex;">
+									<text>出库数量</text>
+									<input v-if="type=='add'" style="width: 80px;" v-model="item.totalCount"
+										type="number" @blur="handleInput(item,index)" placeholder="请输入出库数量" />
+									<text v-else>{{item.totalCount}}</text>
+								</view>
+								<view class="items">
+									<text>计量数量</text>
+									{{ item.measureQuantity }}
+								</view>
+								<view class="items">
+									<text>计量单位</text>
+									{{ item.measureUnit }}
+								</view>
+							</view>
+						</view>
 
-		<u-popup :show="popShow" @close="close" @open="open">
-			<view class="select-container" v-if="popShow">
-				<view class="title">
-					添加备件
-					<view class="btn-box">
-						<text class="btn cancel" @click="close">取消</text>
-						<text class="btn confirm" @click="popConfirm">确定</text>
 					</view>
-				</view>
-				<!-- <input
-          type="text"
-          :value="curClassification.name"
-          placeholder="选择分类"
-          @click="openPicker"
-        /> -->
-				<input type="text" @input="nameFilter" v-model="searchKey" placeholder="搜索编号" />
-				<view class="self-table-header">
-					<view class="table-code">备品备件编码</view>
-					<view class="table-batch">批次号</view>
-				</view>
-				<view class="table-wrapper">
-					<view class="listContent">
-						<checkbox-group @change="selectionChange">
-							<view class="listBox" v-for="(item, index) in tableData" :key="index">
-								<label>
-									<view class="self-table-tr">
-										<view class="table-code">{{ item.onlyCode }}</view>
-										<view class="table-batch">{{ item.batchNum }}</view>
-										<view class="table-date"></view>
-										<view class="other-info">
-											<view>包装编码:{{ item.num }}</view>
-											<view v-if="!currentRow.isUnpack">最小包装单元:{{ item.measurementUnit }}{{ item.unit }}/{{ item.minPackUnit }}</view>
-											<view v-if="item.manufactureTime || item.procurementTime">{{ item.procurementTime ? '采购日期' : '生产日期' }}:{{ item.manufactureTime || item.procurementTime }}</view>
 
-											<view style="width: 100%">货位:{{ item.warehouseName }}-{{ item.areaName }}-{{ item.shelfCode }}-{{ item.cargoSpaceCode }}</view>
-										</view>
-										<view class="checked">
-											<checkbox :value="item.onlyCode" :checked="selectList.includes(item.onlyCode)"></checkbox>
-										</view>
-									</view>
-								</label>
-							</view>
-						</checkbox-group>
-						<u-empty style="margin-top: 20vh" v-if="!tableData.length" />
+					<view v-if="tableList.length == 0" style="margin-top: 20vh">
+						<u-empty iconSize="150" textSize="32" text="暂无数据"></u-empty>
 					</view>
-				</view>
+				</u-list>
 			</view>
-		</u-popup>
-		<!-- <ba-tree-picker
-      ref="treePicker"
-      :multiple="false"
-      @select-change="confirm"
-      title="选择分类"
-      :localdata="listData"
-      valueKey="id"
-      textKey="name"
-      childrenKey="children"
-    /> -->
+		</view>
+		<view class="footer" v-if="type=='add'">
+			<text @click="submitAdd">提交</text>
+		</view>
 
-		<ba-tree-picker
-			ref="verifyTreePicker"
-			key="verify"
-			:multiple="false"
-			@select-change="verifyDeptConfirm"
-			title="选择部门"
-			:localdata="deptList"
-			valueKey="code"
-			textKey="name"
-			childrenKey="children" />
-		<u-modal
-			:show="showConfirm"
-			title="提示"
-			@confirm="warehosueConfirm"
-			@cancel="warehosueCancel"
-			:showCancelButton="true"
-			content="仓库修改后,已添加的备品备件信息将会被清空,是否要继续修改仓库?"></u-modal>
 	</view>
 </template>
 
 <script>
-	import { get, postJ, post } from '@/utils/api.js'
+	import KdTabs from '@/components/KdTabs.vue'
+
+	import {
+		applySpareParts,
+		detailsId
+	} from '@/api/repair'
+	import Cell from '@/components/Cell.vue'
+	import {
+		postJ,
+		get
+	} from '@/utils/api.js'
+
 	import dayjs from 'dayjs'
-	import { debounce } from 'lodash'
-	let [page, size, isEnd] = [1, 10, true]
 	export default {
-		components: {},
-		filters: {
-			timeFilter(inp) {
-				return inp && dayjs(inp).format('YYYY-MM-DD HH:mm')
-			}
+		components: {
+			Cell,
+			KdTabs
 		},
-
 		data() {
 			return {
-				workOrderId: '',
-				planFinishTime: '',
-				workOrderCode: '',
-				showConfirm: false,
-				popShow: false,
-				timeShow: false,
-				time: '',
-
-				pageId: '',
-				pickerDeptShow: false,
-				list: [],
-				treeList: [],
-				classificationId: '',
-				// formData: {
-				//   applyOrder: getRuleNo('BJ'),
-				//   expectedPerformanceTime: new Date().getTime()
-				// },
-				registerlist: [],
-				listData: [],
-				curClassification: {
-					id: '',
-					name: ''
+				active: 0,
+				addForm: {
+					name: '',
+					repairId: '', //维修工单id
+					repairCode: '',
+					code: '',
+					repairName: '',
+					deviceName: '',
+					fixCode: '',
+					deviceCode: '',
+					type: '4', //类型
+					status: '1', //状态
+					purpose: '',
+					userId: '', //使用人id
+					userName: '',
+					useDeptId: '', //使用部门
+					useDeptName: '',
+					warehouseId: '',
+					usageTime: '', //使用时间 //详情信息
+					detailList: [],
+					deviceId:''
 				},
+				tableList: [],
+				deviceList:[],
+				// sparePartsApplyList: [],
+				type: 'add',
+				showTime: '请选择时间',
 
-				planCode: '',
-				formData: {
-					approvalUserId: '',
-					approvalUserName: '',
-					verifyDeptCode: '',
-					verifyDeptName: ''
-					// expectedPerformanceTime: new Date().getTime()
-				},
-				pickerIndex: 0,
-				userList: [],
-				deptList: [], //部门
-				searchKey: '',
-				tableData: [],
-				selectIndex: [],
-				chooseItem: {},
-				sourceCode: null,
-				sourceId: null,
-				// 关键词搜索
-				nameFilter: debounce(this.getTableData, 500),
-				chooseIndex: null,
-				warehouseId: '',
-				warehosueName: '',
-				warehouseList: [],
-				warehosueVal: 0,
-				memo: [],
-				selectList: [],
-				currentRow: {},
-				forceUpdate: false,
-				collapseVal: ''
-			}
-		},
-		onLoad(options) {
-			this.planCode = options.planCode
-			this.sourceCode = options.sourceCode
-			this.sourceId = options.sourceId
-			// this.getDept()
-			// this._getPlanInfo()
-			// this.getwarehouseList()
-			// this.workOrderId = workOrderId
-			// this.workOrderCode = workOrderCode
-			// this.planFinishTime = planFinishTime
-			// this._getClassification()
-		},
-		computed: {
-			selectAll: {
-				set(val) {
-					if (val) {
-						this.selectList = this.tableData.map(i => i.onlyCode)
-					} else {
-						this.selectList = []
-					}
-				},
-				get() {
-					return this.selectList.length && this.selectList.length == this.tableData.length
-				}
 			}
 		},
 		onShow() {
-			uni.$off('setSelectList')
-			uni.$on('setSelectList', selectList => {
-				if (selectList?.length) {
-					this.registerlist = this.registerlist.filter(item => {
-						const index = selectList.findIndex(i => i.curId === item.curId)
-
-						if (index > -1) {
-							selectList.splice(index, 1)
-						}
-
-						return index > -1
-					})
-
-					this.registerlist.push(
-						...selectList.map(item => {
-							return {
-								curId: item.curId,
-								isUnpack: item.isUnpack,
-								informationCode: item.assetCode || item.informationCode,
-								informationName: item.assetName || item.informationName,
-								specification: item.specification,
-								minPackUnit: item.minPackUnit,
-								modelType: item.modelType,
-								measuringUnit: item.unit || item.measuringUnit,
-								tableData: item.tableData || [],
-								num: 0,
-								selectNum: 0
-							}
-						})
-					)
-				}
+			uni.$off('sparePartsApply')
+			uni.$on('sparePartsApply', (data) => {
+				this.tableList = data
+				// console.log(data,'data')
 			})
 		},
-		onReachBottom: function () {
-			if (isEnd) {
-				return
+		async onLoad(data) {
+			const obj = JSON.parse(data.data)
+			this.type = obj.pageType
+			if (this.type == 'add') {
+				this.addForm.repairCode = obj.code;
+				this.addForm.repairName = obj.planName;
+				this.addForm.repairId = obj.id;
+				this.deviceList = obj.deviceList;
+	
+				// if (!obj.sparePartsApplyList) {
+				// 	this.addForm.deviceName = obj.deviceName;
+				// 	this.addForm.fixCode = obj.fixCode;
+				// 	this.addForm.deviceCode = obj.deviceCode;
+				// } else {
+				// 	this.sparePartsApplyList = obj.sparePartsApplyList;
+				// }
+
+			} else {
+				const form = await detailsId(obj.id)
+				this.tableList = form.detailList
+				this.deviceList = form.deviceList
+				this.addForm = form
 			}
-			// 显示加载图标
-			uni.showLoading({
-				title: '数据加载中'
-			})
-			this.getMoreLists()
 		},
 		methods: {
-			showPopu() {
-				this.popShow = true
-			},
-			changeLog(e) {
-				console.log('change事件:', e)
-			},
-			// 选择审核人确定
-			handlePicker(e, list, idKey, nameKey) {
-				if (idKey) {
-					this.formData[idKey] = list[e?.detail.value]?.id
+			del(id,type) {
+				if(this.type!='add'){
+				return
 				}
-				if (nameKey) {
-					this.formData[nameKey] = list[e?.detail.value]?.name
+				if(type==1){
+					this.deviceList = this.deviceList.filter((item) => item.id != id);
+					return
 				}
-				this.$nextTick(() => {
-					if (idKey === 'assetType' || idKey === 'bizScene') {
-						this.$refs.formRef.validateField(idKey)
-					}
-				})
+				this.tableList = this.tableList.filter((item) => item.id != id);
 			},
-			// 部门确认
-			verifyDeptConfirm(data, name) {
-				this.formData.verifyDeptCode = data[0]
-				this.formData.verifyDeptName = name
-				this.formData.approvalUserId = ''
-				this.formData.approvalUserName = ''
+			sparePartsApplyChange(value) {
+				const data = this.sparePartsApplyList.find(item => item.value == value)
+				this.addForm.deviceName = data.text;
+				this.addForm.fixCode = data.fixCode;
+				this.addForm.deviceCode = data.deviceCode;
 
-				this.getUser(data[0])
 			},
-			// 获取部门
-			getDept() {
-				get(this.apiUrl + '/main/org/dept/effectiveTree').then(res => {
-					if (res?.success) {
-						this.deptList = res.data
-					}
-				})
+			// 出库数量限制
+			handleInput(row, index) {
+				if (row.totalCount > row.measureQuantity) {
+					this.$set(this.tableList[index], 'totalCount', row.measureQuantity)
+				}
 			},
-
-			// 获取人员
-			getUser(deptCode) {
-				post(this.apiUrl + '/main/user/list', {
-					deptCode,
-					page: 1,
-					size: 9999
-				}).then(res => {
-					if (res?.success) {
-						this.userList = res.data.items.map(item => {
-							item.name = item.trueName
-							item.id = item.userId
-							return item
-						})
-					}
+			addPicking() {
+				uni.navigateTo({
+					url: `/pages/maintenanceWorkorder/sparepart/sparepartList?codeS=` + JSON.stringify(this
+						.tableList.map(item => item.categoryCode))
 				})
-			},
 
-			numChange(val) {
-				if (val?.value === 0) {
-					this.registerlist.splice(val.name, 1)
-				}
 			},
-			back() {
+			goHome() {
 				uni.navigateBack({
 					delta: 1
 				})
 			},
-			selectionChange({ detail }) {
-				this.selectList = detail.value
-			},
-			// 点击提交
-			toSubmit() {
-				// if (!this.formData.expectedPerformanceTime) {
-				//   uni.showToast({
-				//     icon: 'error',
-				//     title: '请选择期望完成时间'
-				//   })
-				//   return
-				// }
-				// if (!this.formData.approvalUserName) {
-				//   uni.showToast({
-				//     icon: 'error',
-				//     title: '请选择审核人'
-				//   })
-				//   return
-				// }
-				const stockOutApplyDetailList = this.registerlist.filter(i => i.tableData.length)
-				if (!stockOutApplyDetailList.length) {
+			// 提交新增
+			submitAdd() {
+				if (this.deviceList.length==0) {
 					uni.showToast({
-						icon: 'error',
-						title: '请添加申请备件'
-					})
-					return
-				}
-				const params = {
-					...this.formData,
-					sparePartsApplyDetailList: this.registerlist
-						.filter(i => i.tableData.length)
-						.map(i => i.tableData)
-						.flat()
-						.map(i => {
-							delete i.id
-							return {
-								informationCode: i.assetCode,
-								informationName: i.assetName,
-								assetCode: i.onlyCode
-							}
-						}),
-					sourceCode: this.sourceCode,
-					sourceId: this.sourceId,
-					sourceType: 2
-				}
-				params.expectedPerformanceTime = dayjs(params.expectedPerformanceTime).format('YYYY-MM-DD HH:mm:ss')
-
-				postJ(this.apiUrl + '/sparePartsApply/save', params).then(res => {
-					if (res?.success) {
-						this.back()
-					}
-				})
-			},
-			addGoods() {
-				if (!this.warehouseId) {
-					uni.showToast({
-						title: '请选择仓库!',
+						title: '请选择设备!',
 						icon: 'none'
 					})
 					return
 				}
-				const storageKey = Date.now() + ''
-				uni.setStorageSync(storageKey, this.registerlist)
-				uni.navigateTo({
-					url: '/pages/warehouse/outHouse/selectOutType?warehousingType=7&warehousingName=备品备件' + '&storageKey=' + storageKey + '&warehouseId=' + this.warehouseId
-				})
-			},
-			handleDelete(item, row, index) {
-				uni.showModal({
-					title: `确定删除${row.onlyCode}?`,
-					content: '',
-					confirmText: '确认',
-					success: function (res) {
-						if (res.confirm) {
-							item.tableData.splice(index, 1)
-
-							item.selectNum = item.tableData.reduce((next, pre) => {
-								next += pre.isUnpack ? 1 : pre.measurementUnit || 0
-
-								return next
-							}, 0)
-						}
-					}
-				})
-			},
-
-			// 选择备品备件
-			openPicker() {
-				this.$refs.treePicker._show()
-			},
-
-			handleSelectionChange(val) {
-				console.log('handleSelectionChangeval', val)
-				this.selectIndex = val.detail.index
-			},
-			//获取备品备件分类
-			_getClassification() {
-				postJ(this.apiUrl + '/classificationTree/list', [4]).then(res => {
-					if (res?.success) {
-						this.listData = res.data
-					}
-				})
-			},
-			// 查询计划备件明细
-			_getPlanInfo() {
-				postJ(this.apiUrl + '/sparePartsApply/getSparePartsApplyDetail', {
-					planCode: this.planCode
-				}).then(res => {
-					if (res?.success) {
-						this.registerlist = res.data.map(item => {
-							item.tableData = []
-							item.curId = item.informationCode
-							delete item.equipmentCode
-							return item
-						})
-					}
-				})
-			},
-			close() {
-				this.selectIndex = []
-				// this.$refs.tableRef.clearSelection()
-				this.popShow = false
-				this.chooseItem = {}
-				this.currentRow = {}
-			},
-			// 确定选择的备品备件
-			popConfirm() {
-				const selectList = [...this.memo, ...this.tableData.filter(item => this.selectList.includes(item.onlyCode))]
-				if (!selectList.length) {
+				if (this.tableList.length == 0) {
 					uni.showToast({
-						icon: 'none',
-						title: '请选择需添加的备品备件'
+						title: '请选择备品备件!',
+						icon: 'none'
 					})
 					return
 				}
-				// this.registerlist.push(this.chooseItem)
-				this.currentRow.tableData = selectList
-
-				let selectNum = 0
-
-				this.currentRow.tableData.forEach(item => {
-					selectNum += item.isUnpack ? 1 : item.measurementUnit || 0
-				})
-
-				this.currentRow.selectNum = selectNum
-				this.collapseVal = this.currentRow.informationCode
-
-				console.log(this.collapseVal)
-				this.close()
-			},
-			open(...args) {
-				// this.getTableData()
-			},
-			//获取仓库
-			getwarehouseList() {
-				post(this.apiUrl + '/warehouseGoodsshelves/select/warehouseList').then(res => {
-					if (res.success) {
-						this.warehouseList = res.data
-							.filter(i => !i.isDelete && !!i.status)
-							.map(n => {
-								return {
-									name: n.name,
-									id: n.id
-								}
-							})
-					}
-				})
-			},
-			warehosueConfirm() {
-				const obj = this.warehouseList[this.warehouseInfo?.detail?.value] || {}
-				this.warehosueName = obj.name
-				this.warehouseId = obj.id
-				this.registerlist = []
-
-				this.showConfirm = false
-			},
-			warehosueCancel() {
-				this.warehosueVal = this.warehouseList.findIndex(i => i.id === this.warehouseId)
-
-				this.showConfirm = false
-			},
-			bindPickerChange(val) {
-				this.warehosueVal = val?.detail?.value
-				if (this.warehouseId && (this.registerlist.length > 0 || this.registerlist.some(i => i.tableData.length))) {
-					this.warehouseInfo = val
-					this.showConfirm = true
-				} else {
-					const obj = this.warehouseList[val?.detail?.value] || {}
-					this.warehosueName = obj.name
-					this.warehouseId = obj.id
-					this.registerlist = []
-				}
-			},
-			getTableData() {
-				const params = {
-					assetCode: this.currentRow.informationCode,
-					searchKey: this.searchKey,
-					warehouseId: this.warehouseId
-				}
-				this.memo.push(...this.tableData.filter(item => this.selectList.includes(item.onlyCode)))
-				this.selectList = []
-				get(this.apiUrl + '/outInWarehouse/getWarehouseActualDetail', params).then(res => {
-					if (res?.success) {
-						this.tableData = res.data
-						this.$nextTick(() => {
-							this.tableData.map((i, idx) => {
-								const index = this.memo.findIndex(itm => i.onlyCode === itm.onlyCode)
-								if (index > -1) {
-									this.selectList.push(i.onlyCode)
-									this.memo.splice(index, 1)
-								}
-							})
-						})
-					}
-				})
-			},
-			// 备品备件行选中事件
-			rowclick(item, index) {
-				this.chooseIndex = index
-				this.selectIndex = [index]
-				this.chooseItem = item
-			},
-			openPlus(item) {
-				if (!this.warehouseId) {
+				let boolen = this.tableList.every((item) => item.totalCount > 0);
+				if (!boolen) {
 					uni.showToast({
-						title: '请选择仓库!',
+						title: '请输入出库数量!',
 						icon: 'none'
 					})
 					return
 				}
-				this.selectList = []
-				this.memo = uni.$u.deepClone(item.tableData)
-				this.currentRow = item
-				this.popShow = true
-				this.getTableData()
-			},
-			timeConfirm() {
-				this.timeShow = false
-			},
-			timeCancel() {
-				this.timeShow = false
-			},
-			resetEqui() {
-				this.pickerDeptShow = true
-				this.$refs.pickerDeptName.show()
-			},
-			handleChange(e) {
-				let data = e.detail.value[e.detail.value.length - 1]
-				this.classificationId = data.value
-				page = 1
-				isEnd = true
 				uni.showLoading({
-					title: '数据加载中'
-				})
-				this.getList()
-			},
-			getTreeList() {
-				postJ(this.apiUrl + '/classificationTree/list', [4]).then(res => {
-					// console.log(res)
-					if (res.success) {
-						this.treeList = res.data
-						this.pickerDeptShow = true
-						this.$refs.pickerDeptName.show()
-					}
-				})
-			},
-			getFirstList: function () {
-				page = 1
-				isEnd = true
-				uni.showLoading({
-					title: '数据加载中'
-				})
-				this.getList()
-			},
-			getMoreLists: function () {
-				//获取更多数据
-				page++
-				this.getList()
-			},
-			//获取列表数据
-			getList() {
-				post(this.apiUrl + '/classificationSpareParts/classificationSpare/list', {
-					page,
-					size,
-					code: '',
-					classificationId: this.classificationId
+					title: '加载中'
 				})
+
+				this.addForm.detailList = this.tableList
+				this.addForm.deviceList = this.deviceList
+				applySpareParts(this.addForm)
 					.then(res => {
-						// console.log(res)
-						let data = res.data.records
-						let pageTotal = res.data.pages
-						if (page === 1) {
-							data.forEach(el => {
-								el.num = 0
-							})
-							this.list = data
-						} else {
-							data.forEach(element => {
-								element.num = 0
-								this.list.push(element)
-							})
-						}
-						page < pageTotal ? (isEnd = false) : (isEnd = true)
+						uni.showToast({
+							title: '申请成功',
+							icon: 'success',
+							duration: 2000
+						})
+						setTimeout(() => {
+							this.goHome()
+						}, 2000)
 					})
-					.then(() => {
-						uni.hideLoading()
+					.catch(e => {
+						this.loading = false
 					})
 			},
-			submit(data) {
-				let list = data
-				let pickData = list.filter(item => {
-					return item.checked && !item.disabled && item.num > 0
-				})
 
-				if (pickData.length == 0) {
-					uni.showToast({
-						title: '请选择备品备件数量',
-						icon: 'none',
-						duration: 2000
-					})
-					return
-				}
-				this.$store.dispatch('maintenance/setSparepartIndex', this.index)
-				this.$store.dispatch('maintenance/setSparepart', pickData)
-				this.$store.dispatch('maintenance/setEquiIndex', this.equiIndex)
-				this.back()
-			}
 		}
 	}
 </script>
 
-<style lang="scss" scoped>
-	.instance-list {
-		background-color: #fff;
-		font-size: 28rpx;
-		.row {
-			position: relative;
-			padding: 10rpx 20rpx;
-
-			& + .row {
-				margin-top: 10rpx;
-			}
-			.uni-icons {
-				position: absolute;
-				top: 10rpx;
-				right: 20rpx;
-			}
-		}
-	}
-	/deep/.uni-data-tree-input {
-		display: none;
-	}
-	.no_data {
-		position: fixed;
-		top: 50%;
-		left: 50%;
-		transform: translate(-50%, -50%);
-
-		.center {
-			text-align: center;
-			color: #555;
-			font-size: $uni-font-size-base;
-		}
-	}
+<style scoped lang="scss">
+	//底部按钮
 	.footer {
-		position: fixed;
 		display: flex;
-		justify-content: space-between;
+		flex-direction: row;
+		justify-content: center;
 		align-items: center;
 		bottom: 0;
 		width: 100%;
-		height: 90rpx;
+		height: 100rpx;
 		text-align: center;
-		border-top: 1rpx solid #eeecec;
-		background-color: #ffffff;
-
-		.bottom {
-			font-size: $uni-font-size-lg;
-			margin-left: 20rpx;
+		position: fixed;
 
-			.select-all {
-				color: $j-primary-green;
-			}
-		}
+		// text {
+		// 	width: 100%;
+		// 	background-color: $j-primary-green;
+		// 	font-size: 34rpx;
+		// 	color: #FFFFFF;
+		// 	line-height: 100rpx;
+		// }
 
-		.footer-span-btn {
-			height: 30rpx;
-			line-height: 30rpx;
-			font-size: $uni-font-size-lg;
-			color: #ffffff;
-			margin-right: 20rpx;
-			padding: 10rpx 20rpx;
-			text-align: center;
+		text {
+			width: 100%;
 			background-color: $j-primary-green;
-			border-radius: 40rpx;
+			font-size: 34rpx;
+			color: #ffffff;
+			line-height: 100rpx;
 		}
 	}
 
-	.footer-right {
-		justify-content: flex-end;
+
+
+
+	.main {
+		padding-bottom: 130rpx;
 	}
-	.sparepart-container {
-		padding: 40rpx 20rpx;
-		margin-bottom: 120rpx;
-		.infos {
-			border: 1rpx solid rgba(242, 242, 242, 1);
-			padding: 0 20rpx;
-			.col {
-				height: 60rpx;
-				line-height: 60rpx;
-				display: flex;
-				align-items: stretch;
-				font-size: 28rpx;
-				& + .col {
-					margin-top: 4rpx;
-				}
-				.label {
-					display: inline-block;
-					width: 200rpx;
-					padding-right: 20rpx;
-					text-align: right;
-					background-color: rgba(215, 215, 215, 1);
-				}
-				.content {
-					flex: 1;
-					background-color: rgba(242, 242, 242, 1);
-					padding-left: 8rpx;
-					border: 1rpx solid rgba(215, 215, 215, 1);
-				}
-			}
-		}
-		.detail-title {
-			font-size: 34rpx;
-			padding: 20rpx 0;
-			margin-top: 10rpx;
-			display: flex;
-			justify-content: space-between;
 
-			.u-button {
-				width: 180rpx;
-				margin: 0;
-			}
-		}
-		.detail-content {
-			border: 1rpx solid rgba(242, 242, 242, 1);
-			min-height: 50vh;
-			padding-bottom: 100rpx;
-			.col {
-				font-size: 30rpx;
-				border-bottom: 1rpx solid rgba(242, 242, 242, 1);
-				display: flex;
-				padding: 10rpx;
-				align-items: center;
-				justify-content: space-between;
-				background-color: rgba(242, 242, 242, 0.372549019607843);
-			}
+	.border {
+		border: 1px solid #eee;
+	}
 
-			.plus {
-				width: 40rpx;
-				height: 40rpx;
-				line-height: 38rpx;
-				text-align: center;
-				background-color: $j-primary-border-green;
-				color: #fff;
-				margin: 16rpx 0 0 16rpx;
-			}
-		}
 
-		/deep/.u-number-box {
-			.u-number-box__minus,
-			.u-number-box__plus,
-			.u-number-box__input {
-				font-size: 30rpx;
-				height: 1.6em !important;
-			}
-			.u-number-box__input {
-				width: 2em !important;
-			}
-			.u-number-box__minus,
-			.u-number-box__plus {
-				background-color: $j-primary-border-green !important;
 
-				.u-icon__icon {
-					color: #fff !important;
-				}
-			}
+	.list_box {
+		flex: 1;
+		overflow: hidden;
+		padding: 6rpx 0;
+
+		.u-list {
+			height: 100% !important;
 		}
 	}
 
-	.select-container {
-		// height:60vh;
+	.list_box {
+		margin-top: 8rpx;
+		padding: 8rpx 24rpx;
+		background: #fff;
 
-		.title {
-			height: 70rpx;
-			line-height: 70rpx;
-			text-align: center;
-			background-color: $j-primary-border-green;
-			font-weight: bold;
-			position: relative;
-			font-size: 28rpx;
-			color: #fff;
-			.btn-box {
-				position: absolute;
-				top: 50%;
-				right: 10rpx;
-				transform: translateY(-50%);
-			}
-			.btn {
-				width: 60rpx;
-				height: 32rpx;
-				display: inline-block;
-				font-size: 28rpx;
-				border: 1px solid #fff;
-				text-align: center;
-				line-height: 30rpx;
-			}
-		}
-		input {
-			display: block;
-			margin: 8rpx auto;
-			width: 720rpx;
-			height: 72rpx;
-			border: 1rpx solid rgb(153, 153, 153);
-			padding-left: 8rpx;
+		/deep/ .uni-checkbox-input-checked {
+			background-color: $theme-color !important;
+			border-color: $theme-color !important;
 		}
-		/deep/.uni-table {
-			margin-top: 10rpx;
-			// min-width: 100% !important;
-			// max-width: 100%;
-		}
-		.uni-table-th-row {
-			padding: 24rpx 0 !important;
+
+		.listBox-con {
+			// width: 650rpx;
+			font-weight: 400;
 		}
-		.uni-table-td,
-		.uni-table-th {
+
+		.listBox-top {
+			margin-top: 6rpx;
+			color: #090a0a;
 			font-size: 28rpx;
-		}
-		.uni-table-th {
-			background-color: rgba(242, 242, 242, 1);
-			padding: 24rpx 0 !important;
+			font-style: normal;
+			font-weight: 800;
 		}
 
-		.table-wrapper {
-			height: 75vh;
-			overflow: auto;
-			padding: 20rpx;
+		.listBox-bottom {
+			color: #090a0a;
+			font-size: 24rpx;
+			font-style: normal;
+			flex-wrap: wrap;
+
+			.items {
+				width: calc(50% - 1px);
+				border-left: 1rpx solid #e3e5e5;
+				border-right: 1rpx solid #e3e5e5;
+				border-bottom: 1rpx solid #e3e5e5;
+				box-sizing: border-box;
+				word-break: break-all;
+
+				text {
+					display: inline-block;
+					background: #f7f9fa;
+					padding: 8rpx 10rpx;
+					color: #157a2c;
+				}
+
+				&:nth-child(1),
+				&:nth-child(2) {
+					border-top: 1rpx solid #e3e5e5;
+					margin-top: 8rpx;
+				}
+			}
 		}
 	}
-	.sparepart-footer {
-		width: 100%;
-		height: 80px;
+	.kd-equipment {
+		flex: 1;
 		display: flex;
-		align-items: center;
-		justify-content: space-around;
-		position: fixed;
-		bottom: 0;
-		background: #fff;
-		button {
-			width: 300rpx;
-			height: 80rpx;
-			line-height: 80rpx;
-			&.primary {
-				background-color: $j-primary-border-green;
-				color: #fff;
+		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;
+				}
 			}
 		}
-	}
-
-	.listContent {
-		flex: 1;
-		overflow: auto;
-		padding-bottom: 125rpx;
-
-		.self-table-tr {
-			padding: 5rpx 0;
-			border-bottom: 1rpx solid #ccc;
+	
+		.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;
+			}
 		}
 	}
-	.self-table-header {
-		padding: 20rpx;
-		border-bottom: 1rpx solid #ccc;
-	}
-	.self-table-tr,
-	.self-table-header {
+	.kd-card {
+		background-color: #fff;
+		margin-bottom: 20rpx;
+		padding: 8rpx 0;
 		font-size: 28rpx;
-		display: flex;
-		justify-content: space-between;
-		flex-wrap: wrap;
-
-		.table-date,
-		.table-batch,
-		.table-code {
-			box-sizing: border-box;
-			width: 27%;
-			padding: 0 5rpx;
-			word-break: break-all;
+		word-break: break-all;
+	
+		.kd-card-wrapper {
+			padding: 0 30rpx;
+			border-bottom: 1px solid #dadada;
 		}
-		.table-code {
-			width: 50%;
+	
+		.kd-cell {
+			line-height: 60rpx;
 		}
-		.table-date {
-			width: 37%;
+	
+		.kd-cell:last-of-type {
+			border-bottom: none;
 		}
-
-		.other-info {
-			color: #aaa;
-			width: 100%;
-			display: flex;
-			justify-content: space-between;
-			font-size: 28rpx;
-			flex-wrap: wrap;
-
-			> view {
-				margin-bottom: 10rpx;
-			}
+	
+		.status-box {
+			margin-right: 16rpx;
 		}
-
-		.checked {
-			width: 100%;
+	
+		.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;
+			}
+		}
+	}
+	.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;
 	}
-</style>
+</style>

+ 101 - 364
pages/maintenanceWorkorder/sparepart/sparepartList.vue

@@ -3,7 +3,8 @@
 		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="搜索" @clickLeft="back">
 			<!--右菜单-->
 			<template slot="right">
-				<u-button type="success" size="small" class="u-reset-button" @click="openTreePicker" text="选择分类"></u-button>
+				<u-button type="success" size="small" class="u-reset-button" @click="openTreePicker"
+					text="选择分类"></u-button>
 			</template>
 		</uni-nav-bar>
 		<view class="top-wrapper">
@@ -18,46 +19,53 @@
 		</view>
 		<view class="list_box">
 			<u-list @scrolltolower="scrolltolower">
-				<checkbox-group v-for="(item, index) in tableData" :key="index" @change="e => selectVal(e, item, index)">
+				<checkbox-group v-for="(item, index) in tableData" :key="index"
+					@change="e => selectVal(e, item, index)">
 					<label class="listBox rx-bs">
 						<view class="listBox-sel">
-							<checkbox :value="item.code" color="#fff" :disabled="item.disabled" :checked="item.checked" />
+							<checkbox :value="item.categoryCode" color="#fff" :disabled="item.disabled"
+								:checked="item.checked" />
 						</view>
 
 						<view class="listBox-con">
 							<view class="listBox-top rx-bc">
-								<view>{{ item.name }}</view>
+								<view>{{ item.categoryName }}</view>
 							</view>
 
 							<view class="listBox-bottom rx">
 								<view class="items">
 									<text>编码</text>
-									{{ item.code }}
+									{{ item.categoryCode }}
 								</view>
-
 								<view class="items">
-									<text>物料代号</text>
-									{{ item.materielCode }}
+									<text>牌号</text>
+									{{ item.brandNum }}
 								</view>
-
 								<view class="items">
-									<text>客户代号</text>
-									{{ item.clientCode }}
+									<text>型号</text>
+									{{ item.categoryModel }}
 								</view>
 
 								<view class="items">
-									<text>质检状态</text>
-									{{ stateList[Number(item.runStatus)] }}
+									<text>规格</text>
+									{{ item.specification }}
 								</view>
-
 								<view class="items">
-									<text>包装库存</text>
-									{{ item.packingCountBase }} {{ item.minUnit }}
+									<text>级别</text>
+									{{ item.level }}
 								</view>
-
+								<!-- 			<view class="items" style="display: flex;">
+									<text>出库数量</text>
+									<input style="width: 80px;" v-model="item.outboundNum" type="number"
+										@blur="handleInput(item,index)" placeholder="请输入出库数量" />
+								</view> -->
 								<view class="items">
-									<text>计量库存数量</text>
-									{{ item.availableCountBase }} {{ item.measuringUnit }}
+									<text>计量数量</text>
+									{{ item.measureQuantity }}
+								</view>
+								<view class="items">
+									<text>计量单位</text>
+									{{ item.measureUnit }}
 								</view>
 							</view>
 						</view>
@@ -73,7 +81,8 @@
 		<view class="bottom-wrapper rx-bc">
 			<view>
 				<checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
-				<checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选</checkbox>
+				<checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
+				</checkbox>
 			</view>
 			<view>
 				<u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="config">
@@ -81,23 +90,16 @@
 				</u-button>
 			</view>
 		</view>
-		<ba-tree-picker
-			ref="treePicker"
-			key="verify"
-			:multiple="false"
-			@select-change="confirm"
-			title="选择分类"
-			:selectedData="selectedData"
-			:localdata="classificationList"
-			valueKey="id"
-			textKey="name"
+		<ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
+			:selectedData="selectedData" :localdata="classificationList" valueKey="id" textKey="name"
 			childrenKey="children" />
 		<SearchPopup mode="top" v-if="searchShow">
 			<template v-slot:list>
 				<view class="search_list">
 					<u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
 						<u-form-item label="维度:" class="required-form" borderBottom prop="warehouseId">
-							<zxz-uni-data-select :localdata="dimensionList" v-model="dimension" dataValue="id" format="{name}" dataKey="name" filterable></zxz-uni-data-select>
+							<zxz-uni-data-select :localdata="dimensionList" v-model="dimension" dataValue="id"
+								format="{name}" dataKey="name" filterable></zxz-uni-data-select>
 						</u-form-item>
 					</u-form>
 				</view>
@@ -110,40 +112,26 @@
 				</view>
 			</template>
 		</SearchPopup>
-		<!-- <view class="sparepartList">
-			<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="申请备品备件" @clickLeft="back">
-				<view slot="right" @click="confirm">
-					<u-button class="confingBtn" size="normal" type="primary">确定{{ checkboxList.length }}</u-button>
-				</view>
-			</uni-nav-bar>
-			<view class="searchBar">
-				<u-icon class="icon" :size="50" name="list" @click="show = true"></u-icon>
-				<u-search v-model="searchForm.assetName" shape="round" searchIconSize="50" :clearabled="true" :actionStyle="searchStyle" @search="search" @custom="search" @clear="search"></u-search>
-			</view>
-			<view class="listBox">
-				<u-list v-if="tableData.length > 0" class="list" @scrolltolower="scrolltolower">
-					<u-list-item v-for="(item, index) in tableData" :key="index">
-						<u-cell value="内容">
-							<view slot="title" class="u-slot-title">{{ item.name }}</view>
-							<view slot="value" class="u-cell-value">
-								<u-checkbox-group size="30" iconPlacement="right" placement="column" @change="selectItem($event, index)">
-									<u-checkbox size="30" :iconSize="30" :labelSize="30" :customStyle="{ marginBottom: '8px' }" :key="index" :label="item.availableCountBase" :name="item"></u-checkbox>
-								</u-checkbox-group>
-							</view>
-						</u-cell>
-					</u-list-item>
-				</u-list>
-				<view v-else class="no-data">暂无数据</view>
-			</view>
-			<u-picker v-if="show" :show="show" :columns="columns" keyName="label" @cancel="close" @confirm="config" :defaultIndex="dimensionIndex"></u-picker>
-		</view> -->
+
 	</view>
 </template>
 <script>
-	import { treeByPid } from '@/api/pda/workOrder.js'
+	import {
+		treeByPid
+	} from '@/api/pda/workOrder.js'
 	import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
 	import SearchPopup from '@/pages/pda/components/searchPopup.vue'
-	import { getDetailById, getBatchDetails, applySpareParts, saveNew, getInventoryDetails, getMaterielDetails } from '@/api/repair'
+	import {
+		getDetailById,
+		getBatchDetails,
+		applySpareParts,
+		saveNew,
+		getInventoryDetails,
+		getMaterielDetails,
+		getProductList,
+		getHierarchyList,
+		getHierarchyFifo
+	} from '@/api/repair'
 	export default {
 		components: {
 			baTreePicker,
@@ -156,7 +144,7 @@
 				formData: {},
 				checkboxList: [],
 				tableData: [],
-				dimension: 4,
+				dimension: 1,
 				show: false,
 				categoryLevelId: 6,
 				rootCategoryLevelId: '',
@@ -166,8 +154,7 @@
 					0: '未质检',
 					1: '已质检'
 				},
-				dimensionList: [
-					{
+				dimensionList: [{
 						name: '物料维度',
 						id: 4
 					},
@@ -178,6 +165,10 @@
 					{
 						name: '批次维度',
 						id: 2
+					},
+					{
+						name: '物品维度',
+						id: 1
 					}
 				],
 				searchForm: {
@@ -201,14 +192,19 @@
 				wlParams: {},
 				materialObj: {},
 				total: 0,
-				seletedAll: false
+				seletedAll: false,
+				codeS:[]
 			}
 		},
 		onLoad(options) {
 			this.id = options.id
+			if(options.codeS){
+				this.codeS=JSON.parse(options.codeS)
+				
+			}
 		},
 		onShow() {
-			// this.getList()
+
 			this.getTreeList()
 		},
 		//选择的列表长度
@@ -218,6 +214,7 @@
 			}
 		},
 		methods: {
+		
 			doSearch() {
 				this.searchShow = false
 				this.search()
@@ -226,7 +223,9 @@
 				this.searchShow = true
 			},
 			getTreeList() {
-				treeByPid({ ids: [6, 14] }).then(res => {
+				treeByPid({
+					ids: [6]
+				}).then(res => {
 					this.classificationList = res
 					this.confirm(res[0].id, res[0].name, res[0].rootCategoryLevelId)
 				})
@@ -268,6 +267,18 @@
 					}
 				}
 			},
+			//回显
+			selectValInit(codeS, list) {
+				this.checkboxList = []
+				list.forEach((item, index) => {
+					if (codeS.includes(item.categoryCode)) {
+						item['checked'] = true
+						this.checkboxList.push(item)
+					}
+				})
+				return list
+
+			},
 			openTreePicker() {
 				this.$refs.treePicker._show()
 			},
@@ -287,51 +298,20 @@
 				})
 				return new Promise(async (resolve, reject) => {
 					try {
-						let params = { assetName: this.assetName, dimension: this.dimension, pageNum: this.pageNum, size: 30, categoryLevelId: this.categoryLevelId }
-						if (this.dimension == 2) {
-							let res = await getBatchDetails(params)
-							this.total = res.count
-							this.tableData = this.tableData.concat(
-								res.list.map(item => {
-									return {
-										...item,
-										minUnit: item.packingUnit,
-										oid: item.stockBatchId,
-										assetCode: item.code
-									}
-								})
-							)
-						} else if (this.dimension == 3) {
-							let res = await getInventoryDetails(params)
-							this.total = res.count
-							this.tableData = this.tableData.concat(
-								res.list.map(item => {
-									return {
-										...item,
-										batchNo: item.batchNum,
-										minUnit: item.packingUnit,
-										packingCountBase: 1,
-										oid: item.id,
-										assetCode: item.code
-									}
-								})
-							)
-						} else if (this.dimension == 4) {
-							let res = await getMaterielDetails(params)
-							this.total = res.count
-							this.tableData = this.tableData.concat(
-								res.list.map((item, index) => {
-									return {
-										...item,
-										availableCountBase: 1,
-										packingCountBase: 1,
-										minUnit: item.packingUnit,
-										oid: item.id + this.pageNum + (index + 1)
-									}
-								})
-							)
-							console.log(this.tableData)
+						let params = {
+							assetName: this.assetName,
+							dimension: this.dimension,
+							pageNum: this.pageNum,
+							size: 30,
+							categoryLevelId: this.categoryLevelId
 						}
+						const api = this.dimension == 1 ? getProductList : this.dimension == 2 ?
+							getBatchDetails : this.dimension == 3 ? getInventoryDetails : getMaterielDetails
+						let res = await api(params)
+						this.total = res.count
+				
+						this.tableData = this.selectValInit(this.codeS, res.list)
+						console.log(this.tableData, 'this.selectValInit(codeS, res.list)')
 						this.isEnd = this.tableData.length >= this.total
 						uni.hideLoading()
 						resolve()
@@ -353,267 +333,23 @@
 					delta: 1
 				})
 			},
-			async handleExit(arr) {
-				console.log(arr)
-				let ids = null
-				let batchIds = null
-				let materielIds = null
-				if (this.dimension == 3) {
-					ids = arr.map(item => {
-						return item.id
-					})
-				} else if (this.dimension == 2) {
-					ids = arr.map(item => {
-						return item.recordId
-					})
-					batchIds = arr.map(item => {
-						return item.stockBatchId
-					})
-				} else if (this.dimension == 4) {
-					materielIds = arr.map(item => {
-						return item.materielId
-					})
-					ids = arr.map(item => {
-						return item.recordId
-					})
-				} else {
-					ids = arr.map(item => {
-						return item.recordId
-					})
-				}
-				let categoryIds = arr.map(item => {
-					return item.id
-				})
-				let batchNos = arr.map(item => {
-					return item.batchNo
-				})
-				let outInDetailIds = arr.map(item => {
-					return item.outInDetailId
-				})
-				const parmas = {
-					categoryLevelId: this.categoryLevelId,
-					type: this.dimension,
-					categoryIds,
-					batchNos,
-					batchIds,
-					ids,
-					outInDetailIds,
-					materielIds
-				}
-				const data = await getDetailById(parmas)
-				return data
-			},
 			async config() {
-				let checkboxList = this.checkboxList.filter(item => !!item)
-				console.log(checkboxList)
-				if (!checkboxList.length) {
-					uni.showToast({
-						icon: 'error',
-						title: '请选择备品备件!',
-						duration: 2000
-					})
-					return
-				}
-				const data = await this.handleExit(checkboxList)
-				let arr = []
-				if (this.dimension == 4) {
-					arr = checkboxList.map(item => {
-						return { ...item, assetName: item.name }
-					})
-				}
-				console.log(data)
-				this.detailData({ ...data, wlList: arr }, this.dimension)
-			},
 
-			detailData(data, dimension) {
-				this.dimension = dimension
-				console.log('总数居', data)
-				console.log(dimension)
-				// this.onSelectTableDataVal = data.realTimeInventoryVOList;
-				this.warehousingMaterialList = data.realTimeInventoryVOList.map(next => {
-					delete next.updateTime
-					delete next.createTime
-					return {
-						...next,
-						realInventoryAmount: 0,
-						assetType: 6,
-						outInNum: '',
-						assetCode: next.code,
-						assetName: next.name,
-						bizStatus: 2,
-						contactCode: next.contactCode
+				this.checkboxList.forEach((item) => {
+					if (item.warehouseList.length > 0) {
+						item['warehouseId'] = item.warehouseList[0].warehouse_id
+						item['warehouseName'] = item.warehouseList[0].warehouse_name
 					}
-				})
-				// this.batchDetailsVOList = data.batchDetailsVOList;
 
-				if (dimension == 4) {
-					this.materialCodeReqList = data.wlList
-					this.selectionList = data.wlList
+				});
+				uni.$emit('sparePartsApply', this.checkboxList)
+				this.back()
+				// console.log(this.checkboxList, 'data')
+			},
 
-					let params = {
-						realTimeInventoryNewPOList: data.realTimeInventoryVOList
-					}
 
-					for (const item of params.realTimeInventoryNewPOList) {
-						item.inventoryDetailsNewPOList = item.inventoryDetailsVOList
 
-						for (const detail of item.inventoryDetailsNewPOList) {
-							detail.outInMaterialDetailsAddPOList = []
 
-							for (const wlItem of data.wlList) {
-								if (detail.id === wlItem.recordId) {
-									detail.outInMaterialDetailsAddPOList.push({
-										...wlItem
-									})
-								}
-							}
-						}
-					}
-					this.wlParams = params
-					this.materialObj = data
-				} else if (dimension == 3) {
-					//包装维度出库
-					const list = data.realTimeInventoryVOList
-					//获取包装维度
-					let packArr = []
-					for (const item of list) {
-						if (item.inventoryDetailsVOList.length != 0) {
-							for (const iterator of item.inventoryDetailsVOList) {
-								packArr.push({ ...iterator, batchNo: iterator.batchNum })
-							}
-						}
-					}
-					this.batchDetailsVOList = packArr.map(item => {
-						return {
-							...item,
-							packingCountBase: dimension == 4 || dimension == 3 ? 1 : item.packingCountBase
-							// weight: 0
-						}
-					})
-					//物料维度数据
-					let meteArr = []
-					for (const item of packArr) {
-						if (item.materialDetailsVOList.length != 0) {
-							for (const iterator of item.materialDetailsVOList) {
-								meteArr.push({
-									...iterator
-								})
-							}
-						}
-					}
-					this.materialCodeReqList = meteArr
-					//再次打开选择上
-					this.selectionList = list
-					//send数据
-					this.wlParams = { realTimeInventoryNewPOList: list }
-					this.wlParams.realTimeInventoryNewPOList.forEach(item => {
-						item.inventoryDetailsNewPOList = item.inventoryDetailsVOList
-						item.inventoryDetailsNewPOList.forEach(ite => {
-							// ite.weight = 0;
-							ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList
-						})
-					})
-				} else {
-					//   else if (dimension == 2) {
-					//   this.batchDetailsVOList = data.wlList;
-					//   this.selectionList = data.wlList;
-					// }
-					//物品维度出库
-					const list = data.realTimeInventoryVOList
-					//获取包装维度
-					let packArr = []
-					for (const item of list) {
-						if (item.inventoryDetailsVOList.length != 0) {
-							for (const iterator of item.inventoryDetailsVOList) {
-								packArr.push({ ...iterator, batchNo: iterator.batchNum })
-							}
-						}
-					}
-					this.batchDetailsVOList = packArr.map(item => {
-						return {
-							...item,
-							packingCountBase: dimension == 3 ? 1 : item.packingCountBase
-							// weight: 0
-						}
-					})
-					//物料维度数据
-					let meteArr = []
-					for (const item of packArr) {
-						if (item.materialDetailsVOList.length != 0) {
-							for (const iterator of item.materialDetailsVOList) {
-								meteArr.push({
-									...iterator
-								})
-							}
-						}
-					}
-					this.materialCodeReqList = meteArr
-					//再次打开选择上
-					this.selectionList = list
-					//send数据
-					this.wlParams = { realTimeInventoryNewPOList: list }
-					this.wlParams.realTimeInventoryNewPOList.forEach(item => {
-						item.inventoryDetailsNewPOList = item.inventoryDetailsVOList
-						item.inventoryDetailsNewPOList.forEach(ite => {
-							// ite.weight = 0;
-							ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList
-						})
-					})
-				}
-				this.handleNewSave()
-			},
-			async handleNewSave() {
-				let userInfo = wx.getStorageSync('userInfo')
-				let obj = {
-					fromUser: userInfo.userId,
-					bizType: '4', // 领用出库
-					extInfo: {
-						assetType: 6,
-						verifyDeptCode: userInfo.deptId[0],
-						verifyDeptName: userInfo.deptName
-					},
-					type: 2,
-					fromType: 2
-				}
-				obj = { ...obj, ...this.wlParams }
-				if (this.dimension == 4) {
-					obj.num = this.materialObj.wlList.length
-				} else {
-					obj.num = this.materialCodeReqList.length
-				}
-				obj.storageSource = 1
-				try {
-					const res = await saveNew(obj)
-					if (res.code == 0) {
-						let arr = obj.realTimeInventoryNewPOList.map(item => {
-							return {
-								sparePartsId: item.id,
-								sparePartsList: JSON.stringify({
-									...item,
-									inventoryDetailsNewPOList: [],
-									inventoryDetailsVOList: [],
-									outInIds: res.data
-								})
-							}
-						})
-						applySpareParts({
-							workOrderId: this.id,
-							infoList: arr
-						}).then(res => {
-							uni.showToast({
-								icon: 'success',
-								title: '申请成功!',
-								duration: 2000
-							})
-							setTimeout(() => {
-								this.back()
-							}, 1000)
-						})
-					}
-				} catch (error) {
-					console.log(error)
-				}
-			}
 		}
 	}
 </script>
@@ -703,6 +439,7 @@
 				border-bottom: 1rpx solid #e3e5e5;
 				box-sizing: border-box;
 				word-break: break-all;
+
 				text {
 					display: inline-block;
 					background: #f7f9fa;
@@ -726,4 +463,4 @@
 			padding: 0 20rpx;
 		}
 	}
-</style>
+</style>

+ 118 - 52
pages/tour_tally/detail/detail.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="tour-container">
-		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="巡点检工单详情" @clickLeft="back" @clickRight="HandlScanCode"></uni-nav-bar>
+		<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">
 				<KdTabs v-model="active" @change="handleTabChange" :list="['基本信息', '巡点检设备', '备品备件']" />
@@ -26,7 +27,8 @@
 					</view>
 					<view class="kd-cell">
 						<text class="kd-label">巡检设备总数</text>
-						<text class="kd-content text-warning">{{ worksheetInfo.finishNum }}/{{ worksheetInfo.total }}</text>
+						<text
+							class="kd-content text-warning">{{ worksheetInfo.finishNum }}/{{ worksheetInfo.total }}</text>
 					</view>
 					<view class="kd-cell">
 						<text class="kd-label">计划完成时长</text>
@@ -56,12 +58,14 @@
 							<button class="btn-execute" type="primary" @click="handleReport">报工</button>
 							<button class="btn-sparepart" type="warning" @click="handlbpbj">申请备品备件</button>
 						</template>
-						<button v-else-if="worksheetInfo.orderStatus === 3" :disabled="true" class="btn-execute" type="primary">已报工</button>
+						<button v-else-if="worksheetInfo.orderStatus === 3" :disabled="true" class="btn-execute"
+							type="primary">已报工</button>
 					</template>
 				</view>
 				<view class="kd-equipment" v-show="active === 1">
 					<view class="kd-type-box">
-						<view :class="{ 'type—active': typeActive === index }" v-for="(item, index) in equpStatus" :key="index" @click="typeChange(index)">
+						<view :class="{ 'type—active': typeActive === index }" v-for="(item, index) in equpStatus"
+							:key="index" @click="typeChange(index)">
 							{{ item.name }}
 							<text v-if="item.count > 0" class="count">{{ item.count }}</text>
 						</view>
@@ -89,26 +93,35 @@
 										</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>
+											<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.orderStatus == 2 && item.executeStatus == 0" type="primary" class="primary-btn" @click="handleCheck(item)">检查</button>
+										<button v-if="item.orderStatus == 2 && 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>
+											<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>
+										<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>
 					</view>
 				</view>
-				<view class="spare-parts" v-show="active === 2">
+				<!-- <view class="spare-parts" v-show="active === 2">
 					<Step>
 						<StepItem v-for="(item, index) in repairInfoLogList" :key="index" :active="index == 0" :hideContent="Boolean(item.content)">
 							<template v-slot:header>
@@ -166,17 +179,15 @@
 						</StepItem>
 					</Step>
 					<PopSparePart ref="PopSparePart" :workOrderCode="workOrderCode" :noRequest="true"></PopSparePart>
+				</view> -->
+				<!-- 备品备件 sparePartsApply-->
+				<view class="spare-parts" v-if="active == 2">
+					<pickCard :list="sparePartsApply" />
 				</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-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">
@@ -196,13 +207,29 @@
 	import Step from '@/components/Step/Step.vue'
 	import StepItem from '@/components/Step/StepItem.vue'
 	import PopSparePart from '../../maintenanceWorkorder/components/PopSparePart.vue'
-	import { getWorkOrderDetail, getDeviceList, startExecuting, signingWork, devicestatistics } from '@/api/myTicket/index.js'
-	import { getSpareParts } from '@/api/repair'
-	import { get, post, postJ } from '@/utils/api.js'
+	import {
+		getWorkOrderDetail,
+		getDeviceList,
+		startExecuting,
+		signingWork,
+		devicestatistics
+	} from '@/api/myTicket/index.js'
+	import {
+		getSpareParts,
+		getSparePartsApply,
+		getWordOrderDetail
+	} 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'
+	import pickCard from '@/pages/maintenanceWorkorder/components/pickCard.vue'
+
 	export default {
 		components: {
 			CellInfo,
@@ -211,7 +238,8 @@
 			ScanCode,
 			Step,
 			StepItem,
-			PopSparePart
+			PopSparePart,
+			pickCard
 		},
 		data() {
 			return {
@@ -222,6 +250,7 @@
 					WORK_REPORT: '报工'
 				},
 				repairInfoLogList: [],
+				sparePartsApply: [],
 				modalShow: false,
 				active: 0,
 				typeActive: 0,
@@ -324,23 +353,44 @@
 				this.$refs.PopSparePart.open(title, list)
 			},
 			// 跳转备品备件
-			handlbpbj() {
+			async handlbpbj() {
+				let data = await getWordOrderDetail(this.worksheetInfo.id);
+				data.deviceList = data.deviceList.map((item) => {
+					return item.substance;
+				});
+				data['pageType']='add'
 				uni.navigateTo({
-					url: `/pages/maintenanceWorkorder/sparepart/sparepartList?id=${this.pageId}`
+					url: `/pages/maintenanceWorkorder/sparepart/sparepart?data=${JSON.stringify(data)}`
 				})
+
+			},
+			//获取备品备件
+			async getSparePartsApply(id) {
+				const list = await getSparePartsApply(id)
+				this.sparePartsApply = list
 			},
 			getCount() {
-				devicestatistics({ planId: this.planId }).then(data => {
+				devicestatistics({
+					planId: this.planId
+				}).then(data => {
 					this.equpStatus = this.equpStatus.map(item => {
 						switch (item.name) {
 							case '全部':
-								return { ...item, count: data.total }
+								return {
+									...item, count: data.total
+								}
 							case '待检':
-								return { ...item, count: data.isInspectedNum }
+								return {
+									...item, count: data.isInspectedNum
+								}
 							case '已检':
-								return { ...item, count: data.checkedNum }
+								return {
+									...item, count: data.checkedNum
+								}
 							case '异常':
-								return { ...item, count: data.abnormalNum }
+								return {
+									...item, count: data.abnormalNum
+								}
 						}
 					})
 				})
@@ -355,7 +405,7 @@
 
 				uni.scanCode({
 					onlyFromCamera: true,
-					success: function (res) {
+					success: function(res) {
 						_this.Scancodedate(res.result)
 					}
 				})
@@ -368,7 +418,7 @@
 						content: '工单未开启执行,不可进行巡点检操作,请先点击“开始执行”!',
 						confirmText: '开始执行', //这块是确定按钮的文字
 						cancelText: '取消', //这块是取消的文字
-						success: function (res) {
+						success: function(res) {
 							if (res.confirm) {
 								_this.handleExecute() // 执行确认后的操作
 							} else {
@@ -428,7 +478,7 @@
 							content: '本工单中,无此设备!',
 							confirmText: '好的', //这块是确定按钮的文字
 							showCancel: false,
-							success: function (res) {
+							success: function(res) {
 								if (res.confirm) {
 									// 执行确认后的操作
 								} else {
@@ -464,7 +514,8 @@
 						icon: 'none'
 					})
 				} else {
-					if (new Date(this.worksheetInfo.acceptTime).getTime() + this.worksheetInfo.duration * 60 * 1000 < new Date().getTime()) {
+					if (new Date(this.worksheetInfo.acceptTime).getTime() + this.worksheetInfo.duration * 60 * 1000 <
+						new Date().getTime()) {
 						this.$refs.inputDialog.open()
 						return
 					}
@@ -486,7 +537,10 @@
 				this._report(value)
 			},
 			_report(timeoutCause = '') {
-				signingWork({ id: this.pageId, timeoutCause: timeoutCause }).then(() => {
+				signingWork({
+					id: this.pageId,
+					timeoutCause: timeoutCause
+				}).then(() => {
 					uni.showToast({
 						icon: 'success',
 						title: '操作成功!',
@@ -566,7 +620,9 @@
 			},
 			// 执行工单
 			handleExecute() {
-				startExecuting({ id: this.pageId }).then(() => {
+				startExecuting({
+					id: this.pageId
+				}).then(() => {
 					uni.showToast({
 						icon: 'success',
 						title: '操作成功!',
@@ -638,7 +694,9 @@
 				this.equipPage = 1
 				this.getEquipList()
 			},
-			handleCheck({ id }) {
+			handleCheck({
+				id
+			}) {
 				// uni.navigateTo({
 				// 	url: `/pages/tour_tally/check/index?id=${id}&equiName=${equiName}&equiCode=${equiCode}&workOrderId=${this.pageId}&workOrderCode=${this.workOrderCode}`
 				// })
@@ -646,16 +704,23 @@
 					url: `/pages/tour_tally/check/index?id=${id}`
 				})
 			},
-			checkDetail({ id }) {
+			checkDetail({
+				id
+			}) {
 				uni.navigateTo({
 					url: `/pages/tour_tally/check/detail?id=${id}`
 				})
 			},
 			getInfo() {
-				getWorkOrderDetail({ workId: this.pageId }).then(data => {
+				getWorkOrderDetail({
+					workId: this.pageId
+				}).then(data => {
 					this.worksheetInfo = data
+					this.getSparePartsApply(data.id)
 				})
-				getSpareParts({ workOrderId: this.pageId }).then(data => {
+				getSpareParts({
+					workOrderId: this.pageId
+				}).then(data => {
 					console.log('data-----------------------')
 					console.log(data)
 					let list = JSON.parse(JSON.stringify(data))
@@ -674,14 +739,14 @@
 						}
 						if (item.type === 'SPARE_PARTS_APPLY') {
 							this.logs[item.id].content.infoList =
-								this.logs[item.id].content && this.logs[item.id].content.infoList && this.logs[item.id].content.infoList.length > 0
-									? this.logs[item.id].content.infoList.map(item => {
-											return {
-												...JSON.parse(item.sparePartsList),
-												sparePartsId: item.sparePartsId
-											}
-									  })
-									: []
+								this.logs[item.id].content && this.logs[item.id].content.infoList && this
+								.logs[item.id].content.infoList.length > 0 ?
+								this.logs[item.id].content.infoList.map(item => {
+									return {
+										...JSON.parse(item.sparePartsList),
+										sparePartsId: item.sparePartsId
+									}
+								}) : []
 						}
 					})
 				})
@@ -700,7 +765,6 @@
 					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}`
@@ -823,6 +887,7 @@
 					background-color: #1e7f35;
 					color: #fff;
 				}
+
 				.count {
 					position: absolute;
 					top: -9px;
@@ -860,6 +925,7 @@
 	.spare-parts {
 		flex: 1;
 		overflow: hidden;
+		overflow-y: auto;
 	}
 
 	.kd-card {
@@ -905,4 +971,4 @@
 			}
 		}
 	}
-</style>
+</style>