Quellcode durchsuchen

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

liujt vor 1 Tag
Ursprung
Commit
d71c8031e5

+ 1 - 0
components/ba-tree-picker/ba-tree-picker.vue

@@ -12,6 +12,7 @@
 					{{ multiple ? '确定' : '' }}
 				</view>
 			</view>
+			<slot name="toolbar"></slot>
 			<view class="tree-view">
 				<scroll-view class="tree-list" :scroll-y="true">
 					<block v-for="(item, index) in treeList" :key="index">

+ 5 - 3
manifest.json

@@ -1,8 +1,8 @@
 {
-    "name" : "AiMil工业互联网平台",
+    "name" : "AiMill工业互联网平台",
     "appid" : "__UNI__45B3907",
     "description" : "",
-    "versionName" : "V1.0.4.40",
+    "versionName" : "V1.0.4.41",
     "versionCode" : "100",
     "transformPx" : false,
     "h5" : {
@@ -13,7 +13,9 @@
                     // "target" : "http://123.249.79.125/api/",
                     // "target" : "http://114.116.248.196:86/api/",
                     // "target": "http://116.63.185.248:80/api",
-                    "target" : "http://192.168.1.251:18086/",
+                    // "target" : "http://192.168.1.251:18086/",sss
+					  "target" : "http://192.168.1.251:18086/",
+                    // "target" : "http://192.168.1.251:18086/",
                     // "target" : "http://192.168.1.102:18086/",
                     // "target" : "http://aiot.zoomwin.com.cn:51001/api",
                     "changeOrigin" : true,

+ 56 - 12
pages/doc/file-edit.vue

@@ -67,7 +67,14 @@
 		</view>
 		<u-toast ref="uToast"></u-toast>
 		<ba-tree-picker ref="directoryIdRef" :multiple="false" title="选择文档位置" :localdata="folderList" valueKey="id"
-			textKey="name" childrenKey='sonDirectoryList' @select-row="directoryIdBack" />
+			textKey="name" childrenKey='sonDirectoryList' @select-row="directoryIdBack">
+			<template #toolbar>
+				<view class="toolbar">
+
+					<u-subsection :list="currentList" :current="current" @change="sectionChange"></u-subsection>
+				</view>
+			</template>
+		</ba-tree-picker>
 
 		<ba-tree-picker ref="codeTypeRef" key="verify" :multiple="false" @select-row="codeTypeBack" title="选择编码分类"
 			:localdata="list" valueKey="id" textKey="name" childrenKey='sonDirectoryList' />
@@ -95,6 +102,7 @@
 			fileSelector
 		},
 		data() {
+
 			const defaultForm = {
 				name: '', //名称
 				type: '', //类型
@@ -114,7 +122,11 @@
 
 			};
 			return {
+				currentList: ['文档工作区', '个人文档区'],
+				current: 0,
 				folderList: [],
+				allFolderList: [],
+				myFolderList: [],
 				files: [],
 				// 表单数据
 				form: {
@@ -122,6 +134,7 @@
 				},
 				list: [],
 				options: [],
+
 				show: false,
 				doc_type: [],
 				rules: {
@@ -145,11 +158,18 @@
 
 		async created() {
 			this.userInfo = uni.getStorageSync('userInfo')
-			let query = {
+
+
+			this.allFolderList = await getDocTreeListAPI({
 				type: 0,
 				currentUserId: this.userInfo.userId
-			};
-			this.folderList = await getDocTreeListAPI(query);
+			});
+			this.myFolderList = await getDocTreeListAPI({
+				type: 1,
+				currentUserId: this.userInfo.userId
+			});
+			this.folderList = JSON.parse(JSON.stringify(this.allFolderList));
+
 			const doc_type = await getByCode('doc_type');
 			this.doc_type = doc_type.map(item => {
 				const key = Object.keys(item)[0]
@@ -163,6 +183,7 @@
 			async open() {
 
 				this.show = true;
+				// this.current = 0
 				this.list = await selectTreeList();
 				this.options = await listCode();
 				if (this.options.length > 0) {
@@ -186,17 +207,20 @@
 			},
 			async directoryIdBack(data) {
 				console.log(data);
-				this.nodeData.id = data?.id
-				this.nodeData.parentId = data.parentId == -1 ? '' : data.parentId
 
 				this.form.directoryName = data.name
 				this.form.directoryId = data.id
+				if (this.current != 1) {
+					this.nodeData.id = data?.id
+					this.nodeData.parentId = data.parentId == -1 ? '' : data.parentId
 
+				}
 				this.options = this.nodeData.id ? await listCode(this.nodeData) : [];
 
 				if (this.options.length > 0) {
 					this.form.businessCodeId = this.options[0].id;
 					this.form.codeType = this.options[0].parentId;
+
 				} else {
 					this.form.businessCodeId = '';
 				}
@@ -258,6 +282,18 @@
 
 				// console.log('文件列表:', fileList)
 			},
+
+			sectionChange(index) {
+				this.form.directoryId = '';
+				this.form.businessCodeId = '';
+				this.form.codeType = '';
+				this.current = index;
+				if (index == 1) {
+					this.folderList = JSON.parse(JSON.stringify(this.myFolderList));
+				} else {
+					this.folderList = JSON.parse(JSON.stringify(this.allFolderList));
+				}
+			},
 			/* 保存编辑 */
 			async save() {
 
@@ -281,13 +317,17 @@
 				})
 
 				this.form.storagePath = await this.uploadFile(this.files)
-				let params = {
-					...this.form
-				}
-				delete params.codeTypeName
-				delete params.directoryName
+				// let params = {
+				// 	...this.form
+				// }
+				// delete params.codeTypeName
+				// delete params.directoryName
+
 
-				fileSaveAPI(this.form)
+				fileSaveAPI({
+						...this.form,
+						fileType: this.current == 1 ? 1 : 0
+					})
 					.then((msg) => {
 						uni.hideLoading()
 						console.log(msg, 'msg')
@@ -376,4 +416,8 @@
 	/deep/ .u-form {
 		padding: 30rpx;
 	}
+
+	/deep/.u-subsection__item__text {
+		font-size: 26rpx !important;
+	}
 </style>

+ 7 - 42
pages/maintenanceWorkorder/order/order.vue

@@ -148,18 +148,16 @@
 		},
 		methods: {
 			getStatus() {
-				getWorkOrderList({
-					orderStatus: [0],
+				getRepairWorkOrderList({
+					status: [0],
 					type: 3,
 					pageNum: 1,
 					size: 1
 				}).then(res => {
-					console.log(res);
-					this.tabList
 					this.tabList[0].number = res.count
 				})
-				getWorkOrderList({
-					orderStatus: [2],
+				getRepairWorkOrderList({
+					status: [2],
 					type: 3,
 					pageNum: 1,
 					size: 1
@@ -168,40 +166,7 @@
 				})
 
 			},
-			getCount() {
-				statistics().then(data => {
-					console.log('onsole.log(data)-----------')
-					console.log(data)
-					this.tabList = this.tabList.map(item => {
-						switch (item.value) {
-							case '0':
-								return {
-									...item, badge: {
-										value: data.maintenanceNum
-									}
-								}
-							case '2':
-								return {
-									...item, badge: {
-										value: data.patrolInspection
-									}
-								}
-							case '3':
-								return {
-									...item, badge: {
-										value: data.quantityNum
-									}
-								}
-							case '4':
-								return {
-									...item, badge: {
-										value: data.repairsNum
-									}
-								}
-						}
-					})
-				})
-			},
+
 			getFirstList: function() {
 				this.page = 1
 				this.isEnd = false
@@ -221,7 +186,7 @@
 				})
 
 				let params = {
-					orderStatus: [this.tabList[this.pickTabIndex].value],
+					status: [this.tabList[this.pickTabIndex].value],
 					type: 3,
 					pageNum: this.page,
 					size: this.size,
@@ -229,7 +194,7 @@
 				}
 
 				if (!this.showTab || this.pickTabIndex == 5) {
-					delete params.orderStatus
+					delete params.status
 				}
 				let api = this.pickTabIndex == 5 ? getRepairWorkOrderList : getWorkOrderList
 				getRepairWorkOrderList(params)

+ 29 - 23
pages/pda/feeding/components/deviceBom.vue

@@ -179,6 +179,9 @@
 							</u-list>
 
 						</view>
+						<view class="feeding-total">
+							投料合计:<text>{{ getFeedingSum(idItem.positionList) }}</text>
+						</view>
 
 
 					</view>
@@ -263,10 +266,6 @@
 			</template>
 
 			<template v-slot:operate>
-				<view style="margin-bottom: 10px;">
-					和:{{ feedingSumNum }}
-				</view>
-
 				<view class="operate_box rx-bc">
 					<u-button size="small" class="u-reset-button" @click="handleClose" v-if="ishuoWei">
 						清空/取消
@@ -348,7 +347,6 @@ export default {
 			}],
 
 			unloadTurnover: [],
-			feedingSumNum: 0,
 
 
 			tabAct: 0
@@ -358,11 +356,20 @@ export default {
 
 		}
 	},
-	created() {
+	methods: {
+		getFeedingSum(positionList) {
+			if (!Array.isArray(positionList)) {
+				return 0
+			}
 
+			return positionList.reduce((total, position) => {
+				const isCurrentProduct = position.workOrderCode === this.wordItem.code &&
+					position.categoryCode === this.wordItem.productCode
+				const feedNum = Number(position.feedNum)
 
-	},
-	methods: {
+				return isCurrentProduct && Number.isFinite(feedNum) ? total + feedNum : total
+			}, 0)
+		},
 		handleScan(id) {
 			this.$emit('scanIt', id,)
 		},
@@ -373,7 +380,6 @@ export default {
 
 		handleStorage(idx) {
 			this.listIndex = idx || 0
-			this.feedingSumNum = 0;
 			if (Object.prototype.hasOwnProperty.call(this.list[0].extInfo, 'turnoverList')) {
 				this.unloadTurnover = this.turnover
 
@@ -382,19 +388,6 @@ export default {
 
 			console.log(this.turnoverList, 'this.turnoverList');
 
-			this.turnoverList.forEach(v => {
-				v.positionList.forEach(d => {
-					if (d.feedNum) {
-						this.feedingSumNum += Number(d.feedNum)
-					}
-				})
-
-			})
-
-
-
-
-
 			this.popupShow = true
 
 
@@ -783,6 +776,19 @@ export default {
 
 }
 
+.feeding-total {
+	margin-bottom: 10px;
+	padding-right: 12rpx;
+	text-align: right;
+	font-size: 28rpx;
+	color: #404446;
+
+	text {
+		color: $theme-color;
+		font-weight: 600;
+	}
+}
+
 
 .tab_box {
 	margin-top: 14rpx;
@@ -811,4 +817,4 @@ export default {
 		font-size: 34rpx;
 	}
 }
-</style>
+</style>

+ 1 - 1
pages/pda/feeding/components/turnoverBom.vue

@@ -423,4 +423,4 @@
 	.z_list {
 		max-height: 500rpx;
 	}
-</style>
+</style>

+ 90 - 21
pages/pda/jobBooking/components/turnoverBom.vue

@@ -4,12 +4,12 @@
 			<view class="name">周转车</view>
 		</view>
 
-		<view v-for="(item, index) in newList" :key='index'>
+		<view class="turnover-item" v-for="(item, index) in newList" :key="item.id || item.instanceId || item.code || index">
 			<view class="title_box rx-bc" v-if='!isDetails'>
 				<view class="left rx-ss" >
 					<uni-icons @click="getDelete(index)" custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
 					
-					<view class="des" @click="handContract()">{{ isContract ? '收缩'  :  '展开'}}</view>
+					<view class="des" @click="handContract(index)">{{ isExpanded(index) ? '收缩'  :  '展开'}}</view>
 				</view>
 			
 				
@@ -62,24 +62,24 @@
 				</view>
 
 				<view class="table">
-					<u-list @scrolltolower="scrolltolower" class="z_list">
+					<view class="z_list">
 				      <view  v-for="(it, idx) in item.extInfo.positionList" :key='idx'>
-						  <view class="tr row rx-sc"  v-if=" isContract || ( it.workOrderCode != '' &&  it.workOrderCode != null)">
+						  <view class="tr row rx-sc" v-if="shouldShowPosition(item, it, idx, index)">
 						  	<view class="item ww10">{{it.code}}</view>
-						  	<view class="item ww35" :class="{'color157': it.workOrderCode === wordItem.code}">
-						  		{{ it.workOrderCode }}
+							<view class="item ww35" :class="{'color157': getWorkOrderCode(item, it, idx) === wordItem.code}">
+								{{ getWorkOrderCode(item, it, idx) }}
 						  	</view>
-						  	<view class="item ww35" :class="{'color157': it.categoryCode === wordItem.productCode}">
-						  		{{it.categoryCode}}
+							<view class="item ww35" :class="{'color157': getCategoryCode(item, it, idx) === wordItem.productCode}">
+								{{ getCategoryCode(item, it, idx) }}
 						  	</view>
 						  
 						  	<view class="item ww20  " :class="{'content_num' : (pattern == 'job') }" v-if='!isDetails'>
 								<!-- // it.workOrderCode!==itemValue.code 就是工单编号和 周转车编号相同就可以修改  it.isOccupy===0 是-->
 							
-						  		<input class="uni-input" v-if='it.isFull == 0' @input="quantInt(index, idx, it)" 
-								  :class="{'content_num_box': it.categoryCode !== wordItem.productCode}"
+								<input class="uni-input" v-if="canEditQuantity(item, it, idx)" @input="quantInt(index, idx, it)"
+								  :class="{'content_num_box': getCategoryCode(item, it, idx) !== wordItem.productCode}"
 						  			v-model="it.quantity" type="digit"
-						  			:disabled="(!Object.prototype.hasOwnProperty.call(it, 'isOccupy') && it.isOccupy) || pattern != 'job' || isDisabled(it)"></input>
+									:disabled="pattern != 'job' || isDisabled(it)"></input>
 						  		<text v-else>{{it.quantity}}</text>
 
 						  	</view>
@@ -90,7 +90,7 @@
 						  	</view>
 						  </view>
 					  </view>
-					</u-list>
+					</view>
 
 				</view>
 
@@ -152,20 +152,61 @@
 
 				totalCount: 0,
 				
-				isContract: false
+				expandedIndexes: []
 
 
 			}
 		},
 
 		methods: {
+			isExpanded(index) {
+				return this.expandedIndexes.includes(index)
+			},
+
+			isAvailablePosition(it) {
+				return !it.workOrderCode && Number(it.isOccupy || 0) === 0 && Number(it.isFull || 0) !== 1
+			},
+
+			getDefaultPositionIndex(item) {
+				const positionList = item && item.extInfo && Array.isArray(item.extInfo.positionList)
+					? item.extInfo.positionList
+					: []
+				return positionList.findIndex(it => this.isAvailablePosition(it))
+			},
+
+			hasCurrentWorkOrder(item) {
+				const positionList = item && item.extInfo && Array.isArray(item.extInfo.positionList)
+					? item.extInfo.positionList
+					: []
+				return positionList.some(it => it.workOrderCode === this.wordItem.code)
+			},
+
+			isDefaultPosition(item, it, idx) {
+				return !this.hasCurrentWorkOrder(item) && this.isAvailablePosition(it) && this.getDefaultPositionIndex(item) === idx
+			},
+
+			shouldShowPosition(item, it, idx, turnoverIndex) {
+				return this.isExpanded(turnoverIndex) || !!it.workOrderCode || this.isDefaultPosition(item, it, idx)
+			},
+
+			getWorkOrderCode(item, it, idx) {
+				return it.workOrderCode || (this.isDefaultPosition(item, it, idx) ? this.wordItem.code : '')
+			},
+
+			getCategoryCode(item, it, idx) {
+				return it.categoryCode || (this.isDefaultPosition(item, it, idx) ? this.wordItem.productCode : '')
+			},
+
+			canEditQuantity(item, it, idx) {
+				return it.isFull == 0 || it.workOrderCode === this.wordItem.code || this.isDefaultPosition(item, it, idx)
+			},
 
 			//条件判断
 			isDisabled(it) {
 				if(it.workOrderCode === this.itemValue.code){
 					return false
 				}else{
-					if(it.isOccupy){
+					if(Number(it.isOccupy || 0) !== 0){
 						return true
 					}else{
 						return false
@@ -179,8 +220,14 @@
 				if (it.quantity >= 1) {
 					this.$set(this.newList[index].extInfo.positionList[idx], 'workOrderCode', this.wordItem.code)
 					this.$set(this.newList[index].extInfo.positionList[idx], 'categoryCode', this.wordItem.productCode)
-					if(it.quantity > this.itemValue.product[0].feedQuantity) {
+					const maxQuantity = Number(this.itemValue.product && this.itemValue.product[0]
+						? this.itemValue.product[0].feedQuantity
+						: 0)
+					const currentTotal = this.getCurrentTotal(index, idx)
+					if(maxQuantity > 0 && currentTotal > maxQuantity) {
 						this.$set(this.newList[index].extInfo.positionList[idx], 'quantity', 0)
+						this.$set(this.newList[index].extInfo.positionList[idx], 'workOrderCode', '')
+						this.$set(this.newList[index].extInfo.positionList[idx], 'categoryCode', '')
 						return uni.showToast({
 							icon: 'none',
 							title: `超出投料数量`
@@ -218,6 +265,22 @@
 
 
 
+			},
+
+			getCurrentTotal(excludeTurnoverIndex, excludePositionIndex) {
+				return this.newList.reduce((total, turnover, turnoverIndex) => {
+					const positionList = turnover && turnover.extInfo && Array.isArray(turnover.extInfo.positionList)
+						? turnover.extInfo.positionList
+						: []
+					return positionList.reduce((positionTotal, position, positionIndex) => {
+						if (turnoverIndex === excludeTurnoverIndex && positionIndex === excludePositionIndex) {
+							return positionTotal + Number(position.quantity || 0)
+						}
+						return position.workOrderCode === this.wordItem.code
+							? positionTotal + Number(position.quantity || 0)
+							: positionTotal
+					}, total)
+				}, 0)
 			},
 
 			handleScan(index) {
@@ -226,13 +289,19 @@
 
 			getDelete(index) {
 				this.list.splice(index, 1)
-
-
+				this.expandedIndexes = this.expandedIndexes
+					.filter(itemIndex => itemIndex !== index)
+					.map(itemIndex => itemIndex > index ? itemIndex - 1 : itemIndex)
 			},
 			scrolltolower() {},
 			
-			handContract() {
-				this.isContract = !this.isContract
+			handContract(index) {
+				const expandedIndex = this.expandedIndexes.indexOf(index)
+				if (expandedIndex === -1) {
+					this.expandedIndexes.push(index)
+				} else {
+					this.expandedIndexes.splice(expandedIndex, 1)
+				}
 			}
 		}
 	}
@@ -450,6 +519,6 @@
 		}
 	}
 	.z_list {
-		max-height: 500rpx;
+		height: auto;
 	}
-</style>
+</style>