浏览代码

检验任务拍照点上传之后无法在进行删除或者重新拍摄

zhangxike 5 天之前
父节点
当前提交
96f1ad758f
共有 1 个文件被更改,包括 14 次插入3 次删除
  1. 14 3
      pages/work/download/PhotoRecord.uvue

+ 14 - 3
pages/work/download/PhotoRecord.uvue

@@ -42,7 +42,7 @@
 				<text class="value">{{ item.photographdescription }}</text>
 			</view>
 
-			<button class="cancel-btn" @click="cancel(item.sxid)">
+			<button class="cancel-btn" @click="cancel(item.sxid)" v-if="canEdit">
 				拍照
 			</button>
 
@@ -112,7 +112,6 @@
 	} as OnBackPressOptions)
 
 	onBackPress((options : OnBackPressOptions) : boolean | null => {
-		console.log('onBackPress', options)
 		uni.navigateTo({
 			url: `/pages/work/download/DownloadDetail?id=${pid}`,
 			// 修改动画方向为从左到右退回
@@ -129,6 +128,7 @@
 	var records = ref<TaskPhoto[]>([]);
 	const closeTags = ref<boolean[]>([]);
 	var initRecords = [] as TaskPhoto[]
+	let canEdit = ref<boolean>(true);
 
 	// 定义数据刷新函数
 	const refreshRecords = (index : number) => {
@@ -145,6 +145,11 @@
 						const imgnameStr = item?.['imgname'] as string ?? ''
 						const photourlStr = item?.['photourl'] as string ?? ''
 						const exampleurlStr = item?.['exampleurl'] as string ?? ''
+						const uploadFlag = parseInt(item?.['uploadFlag'] as string ?? '0')
+						if(uploadFlag == 1) {
+							//已经上传过不允许编辑
+							canEdit.value = false;
+						}
 						const imgnameArr = imgnameStr.indexOf(",") > -1 ? imgnameStr.split(",") : (imgnameStr != '' ? [imgnameStr] : [])
 						const photourlArr = photourlStr.indexOf(",") > -1 ? photourlStr.split(",") : (photourlStr != '' ? [photourlStr] : [])
 						const exampleurlArr = exampleurlStr.indexOf(",") > -1 ? exampleurlStr.split(",") : (exampleurlStr != '' ? [exampleurlStr] : [])
@@ -197,8 +202,14 @@
 	}
 	
 	const closeTag = (index : number) => {
+		if (!canEdit.value) {
+			uni.showToast({
+				title: "已上传的图片无法删除",
+				icon: "error"
+			})
+			return
+		}
 		let record = records.value[0]
-
 		uni.showModal({
 			title: '系统提示',
 			content: '确认是否删除图片',