Просмотр исходного кода

feat(process/detail): 排除后台提交的空重复表

wangpx 1 год назад
Родитель
Сommit
fe3fbdf518
1 измененных файлов с 25 добавлено и 10 удалено
  1. 25 10
      pages/process/detail/index.vue

+ 25 - 10
pages/process/detail/index.vue

@@ -12,15 +12,11 @@
 				</uni-list-item>
 			</uni-list>
 		</uni-card>
-		<uni-card v-if="repeatingTable.elementItem.length > 0">
+		<!-- 重复表 -->
+		<uni-card v-if="repeatingTableNotEmpty">
 			<button @click="handleRepeatingTable" type="primary">查看重复表</button>
 		</uni-card >
-		<uni-card v-if="fileList.length > 0" v-for="(item, index) in fileList" :key="index">
-			<view>
-				<attachment-list :attachments="item.files" ></attachment-list>
-			</view>
-		</uni-card>
-		<uni-popup ref="repeatingTablePopup">
+		<uni-popup v-if="repeatingTableNotEmpty" ref="repeatingTablePopup">
 			<uni-card margin="0px" spacing="0px" padding="0px">
 				<view class="repeating_table_container">
 					<uni-table :border="true" stripe>
@@ -37,6 +33,12 @@
 				</view>
 			</uni-card>
 		</uni-popup>
+		<!-- 附件 -->
+		<view v-for="(item, index) in fileList" :key="index">
+			<uni-card  v-if="item.files.length > 0">
+				<attachment-list :attachments="item.files" ></attachment-list>
+			</uni-card>
+		</view>
 	</view>
 </template>
 
@@ -66,23 +68,36 @@
 		initProcessInfo()
 	})
 	
-	const formElements = ref([])
 	const repeatingTable = ref({
 		elements: [],
 		elementItem: [],
 	})
+	const repeatingTableNotEmpty = ref(false)
+	function repeatingTableHasValue() {
+		if (repeatingTable.value === undefined) return
+		if (repeatingTable.value.elementItem.length <= 0) return
+		repeatingTable.value.elements.forEach(({defaultValue}) => {
+			if (defaultValue != "") {
+				repeatingTableNotEmpty.value = true
+				return new Promise((resolve, reject) => {
+					resolve(repeatingTableNotEmpty)
+				})
+			}
+		})
+		
+	}
+	const formElements = ref([])
 	const fileList = ref([])
 	function initProcessInfo() {
 		getProcessInfo(userStore.user.useId, processInfo.insId).then(({ returnParams }) => {
 			formElements.value = returnParams.formElements
 			repeatingTable.value = returnParams.repeatingTable
 			fileList.value = returnParams.fileList
-			console.log('fileList', fileList.value);
+			repeatingTableHasValue()
 		})
 	}
 	const repeatingTablePopup = ref(null)
 	function handleRepeatingTable() {
-		console.log('handleRepeatingTable', repeatingTable);
 		repeatingTablePopup.value.open()
 	}
 </script>