فهرست منبع

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

ysy 1 سال پیش
والد
کامیت
8dcc327186
3فایلهای تغییر یافته به همراه117 افزوده شده و 46 حذف شده
  1. 0 3
      components/Assign.vue
  2. 13 2
      pages/maintenanceWorkorder/components/pickCard.vue
  3. 104 41
      pages/maintenanceWorkorder/sparepart/sparepart.vue

+ 0 - 3
components/Assign.vue

@@ -68,10 +68,7 @@
 				this.popShow = true
 			},
 			openPicker() {
-				console.log('---------openPicker--------')
 				this.$refs.treePicker._show()
-				// this.deptPickerShow = true
-				// console.log(1111);
 			},
 
 			deWeight(arr4) {

+ 13 - 2
pages/maintenanceWorkorder/components/pickCard.vue

@@ -50,17 +50,28 @@
 			<view class="item_box rx-bc">
 				<view class="item_one perce50 rx-sc">
 					<view>领用部门:</view>
-					<view>{{item.useDeptName}}</view>
+					<view>{{item.receivingDeptName}}</view>
 				</view>
 				<view class="item_one perce50 rx-sc">
 					<view class="lable">领用人:</view>
+					<view>{{item.recipientName}}</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>使用时间:</view>
 					<view>{{item.usageTime}}</view>
 				</view>
 				<view class="item_one perce50 rx-sc">

+ 104 - 41
pages/maintenanceWorkorder/sparepart/sparepart.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="main">
-		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" right-icon="scan" title="申请备品备件" @clickLeft="goHome"
-			></uni-nav-bar>
+		<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="编号">
@@ -21,7 +21,7 @@
 					{{ addForm.repairName  }}
 				</view>
 			</Cell>
-	<!-- 		<Cell cellType="more" title="设备编号">
+			<!-- 		<Cell cellType="more" title="设备编号">
 				<view class="cell-tip-right" slot="more">
 		
 					{{ addForm.deviceCode }}
@@ -45,12 +45,25 @@
 
 			<Cell cellType="more" title="领用部门">
 				<view class="cell-tip-right" slot="more">
-					{{ addForm.useDeptName }}
+					{{ addForm.receivingDeptName }}
 				</view>
 			</Cell>
 			<Cell cellType="more" title="领用人">
 				<view class="cell-tip-right" slot="more">
-					{{ addForm.userName }}
+					{{ addForm.recipientName }}
+				</view>
+			</Cell>
+			<Cell cellType="more" title="使用部门">
+				<view class="cell-tip-right" slot="more">
+					<text class="input_text"
+						@click="openPicker">{{ addForm.useDeptName ? addForm.useDeptName : '请选择' }}</text>
+				</view>
+			</Cell>
+			<Cell cellType="more" title="使用人">
+				<view class="cell-tip-right" slot="more" >
+					<zxz-uni-data-select v-if="type=='add'" style="width: 300rpx;" :localdata="userList" v-model="addForm.userId"
+						@change="handleUserChange"></zxz-uni-data-select>
+						<text v-else>{{addForm.userName}}</text>
 				</view>
 			</Cell>
 
@@ -70,19 +83,19 @@
 
 			</Cell>
 		</view>
-	<view v-show="active==1" class="kd-equipment">
+		<view v-show="active==1" class="kd-equipment">
 
-	<!-- 		<u-button v-if="type=='add'" type="success" size="small" class="u-reset-button" @click="addDevice()"
+			<!-- 		<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>
 					<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>
+									type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
 								<view class="kd-cell">
-								
+
 									<text class="kd-label">设备编码</text>
 									{{ item.code }}
 								</view>
@@ -92,15 +105,15 @@
 								</view>
 								<view class="kd-cell">
 									<text class="kd-label">设备型号</text>
-									{{  item.category&&item.category.modelType||item.model }}
+									{{ item.category&&item.category.modelType||item.model }}
 								</view>
-							<!-- 	<view class="kd-cell">
+								<!-- 	<view class="kd-cell">
 									<text class="kd-label">设备位置</text>
 									{{ item.deviceLocationName.pathName }}
 								</view> -->
-						
+
 							</view>
-				
+
 						</view>
 					</u-list-item>
 				</u-list>
@@ -111,7 +124,7 @@
 			<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 >
+				<u-list>
 					<view v-for="(item, index) in tableList" :key="index" @change="e => selectVal(e, item, index)">
 
 						<view class="listBox-con">
@@ -173,12 +186,19 @@
 		<view class="footer" v-if="type=='add'">
 			<text @click="submitAdd">提交</text>
 		</view>
+		<ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" title="选择部门" :localdata="listData"
+			valueKey="id" textKey="name" childrenKey="children" />
 
 	</view>
 </template>
 
 <script>
 	import KdTabs from '@/components/KdTabs.vue'
+	import {
+		listOrganizations,
+		getUserPage
+	} from '@/api/myTicket/index.js'
+	import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
 
 	import {
 		applySpareParts,
@@ -194,7 +214,8 @@
 	export default {
 		components: {
 			Cell,
-			KdTabs
+			KdTabs,
+			baTreePicker
 		},
 		data() {
 			return {
@@ -218,14 +239,16 @@
 					warehouseId: '',
 					usageTime: '', //使用时间 //详情信息
 					detailList: [],
-					deviceId:''
+					deviceId: '',
+					executorDeptName: ''
 				},
 				tableList: [],
-				deviceList:[],
+				deviceList: [],
 				// sparePartsApplyList: [],
 				type: 'add',
 				showTime: '请选择时间',
-
+				userList: [],
+				listData: []
 			}
 		},
 		onShow() {
@@ -238,12 +261,13 @@
 		async onLoad(data) {
 			const obj = JSON.parse(data.data)
 			this.type = obj.pageType
+			this.getDept()
 			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;
@@ -257,14 +281,21 @@
 				this.tableList = form.detailList
 				this.deviceList = form.deviceList
 				this.addForm = form
+
+				if (this.addForm.useDeptId) {
+					this.getUser(this.addForm.useDeptId)
+				}
 			}
 		},
 		methods: {
-			del(id,type) {
-				if(this.type!='add'){
-				return
+			openPicker() {
+				this.$refs.treePicker._show()
+			},
+			del(id, type) {
+				if (this.type != 'add') {
+					return
 				}
-				if(type==1){
+				if (type == 1) {
 					this.deviceList = this.deviceList.filter((item) => item.id != id);
 					return
 				}
@@ -297,7 +328,7 @@
 			},
 			// 提交新增
 			submitAdd() {
-				if (this.deviceList.length==0) {
+				if (this.deviceList.length == 0) {
 					uni.showToast({
 						title: '请选择设备!',
 						icon: 'none'
@@ -340,7 +371,36 @@
 						this.loading = false
 					})
 			},
+			confirm(data, name) {
+
+				this.addForm.useDeptName = name
+				this.addForm.useDeptId = data[0]
+				this.addForm.userName = ''
+				this.addForm.userId = ''
+				this.getUser(data[0])
+			},
+			getDept() {
+				listOrganizations(1).then(data => {
+					this.listData = data
+				})
+			},
+			getUser(deptCode) {
+				getUserPage({
+					pageNum: 1,
+					size: -1,
+					groupId: deptCode
+				}).then(data => {
+					this.userList = data.list.map(item => {
+						item.text = item.name
+						item.value = item.id
+						return item
+					})
+				})
 
+			},
+			handleUserChange(obj) {
+				this.addForm.userName = obj.text
+			},
 		}
 	}
 </script>
@@ -450,16 +510,17 @@
 			}
 		}
 	}
+
 	.kd-equipment {
 		flex: 1;
 		display: flex;
 		flex-direction: column;
 		overflow: hidden;
-	
+
 		.kd-type-box {
 			text-align: center;
 			padding: 26rpx 0;
-	
+
 			view {
 				position: relative;
 				display: inline-block;
@@ -468,12 +529,12 @@
 				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;
@@ -487,7 +548,7 @@
 				}
 			}
 		}
-	
+
 		.kd-list-container {
 			flex: 1;
 			display: flex;
@@ -495,43 +556,44 @@
 			overflow: hidden;
 			padding: 12rpx 18rpx;
 			background-color: $page-bg;
-	
+
 			.u-list {
 				flex: 1;
 				height: 100% !important;
 			}
 		}
 	}
+
 	.kd-card {
 		background-color: #fff;
 		margin-bottom: 20rpx;
 		padding: 8rpx 0;
 		font-size: 28rpx;
 		word-break: break-all;
-	
+
 		.kd-card-wrapper {
 			padding: 0 30rpx;
 			border-bottom: 1px solid #dadada;
 		}
-	
+
 		.kd-cell {
 			line-height: 60rpx;
 		}
-	
+
 		.kd-cell:last-of-type {
 			border-bottom: none;
 		}
-	
+
 		.status-box {
 			margin-right: 16rpx;
 		}
-	
+
 		.card-footer {
 			display: flex;
 			justify-content: flex-end;
 			align-items: center;
 			padding: 8rpx 0 20rpx;
-	
+
 			button {
 				width: 180rpx;
 				height: 56rpx;
@@ -539,30 +601,31 @@
 				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;