Преглед на файлове

feat(report): merge report view actions

Developer преди 1 месец
родител
ревизия
a0788a1cfd
променени са 2 файла, в които са добавени 48 реда и са изтрити 27 реда
  1. 42 7
      pagesHome/components/report/generateList.vue
  2. 6 20
      tests/reportButtonAvailability.test.js

+ 42 - 7
pagesHome/components/report/generateList.vue

@@ -23,19 +23,15 @@
 						<!-- <image class="gbox-item-ask" :src="imgBase+'report_ask.png'" @click="askReport(item)" v-if="item.state==1&&item.fileUrl"></image> -->
 						<image class="gbox-item-ask" :src="imgBase+'report_ask.png'" @click="testShow=true" v-if="item.state==1&&item.fileUrl"></image>
 					</view>
-					<view class="gbox-item-bottom adfacjb">
+					<view class="gbox-item-bottom adfacjb">
 						<view class="gbox-item-bottom-rightbox adfac" v-if="item.type==1">
 							<view class="gbox-item-bottom-right" @click="openEvaluation(item)" v-if="canEditEvaluation(item)">评估修改</view>
-							<view class="gbox-item-bottom-right report-button-disabled" @click="showReportUnavailable('background')" v-if="item.state==1">背景报告</view>
-							<view class="gbox-item-bottom-right report-button-disabled" @click="showReportUnavailable('professional')" v-if="item.state==1">教练报告</view>
-							<view class="gbox-item-bottom-right" @click="reviewArtifact(item, 'public')" v-if="item.state==1">团队报告</view>
+							<view class="gbox-item-bottom-right" @click="showReportSelector(item)" v-if="item.state==1">查看报告</view>
 							<view class="gbox-item-bottom-right" @click="reSendReport(item)" v-if="item.state==-1">重新生成</view>
 						</view>
 						<view class="gbox-item-bottom-rightbox adfac" v-else-if="item.type==2">
 							<view class="gbox-item-bottom-right" @click="openEvaluation(item)" v-if="canEditEvaluation(item)">评估修改</view>
-							<view class="gbox-item-bottom-right" @click="reviewArtifact(item, 'background')" v-if="item.state==1">背景报告</view>
-							<view class="gbox-item-bottom-right" @click="reviewArtifact(item, 'professional')" v-if="item.state==1">教练报告</view>
-							<view class="gbox-item-bottom-right" @click="reviewArtifact(item, 'public')" v-if="item.state==1">团队报告</view>
+							<view class="gbox-item-bottom-right" @click="showReportSelector(item)" v-if="item.state==1">查看报告</view>
 							<view class="gbox-item-bottom-right" @click="forwardReport(item)" v-if="item.state==1&&item.fileUrl">发送邮件</view>
 							<view class="gbox-item-bottom-right" @click="sendReport(item)" v-if="item.state!=-1">发送报告</view>
 							<view class="gbox-item-bottom-right" @click="reSendReport(item)" v-if="item.state==-1">重新生成</view>
@@ -52,6 +48,16 @@
 				<view class="kr-btn" @click="testShow=false">确定</view>
 			</view>
 		</view>
+		<view class="kind-reminder adffcacjc" v-if="reportSelectorShow">
+			<view class="kr-box adffcac report-selector-box">
+				<view class="kr-title">查看报告</view>
+				<view class="report-selector-tip">请选择要查看的报告</view>
+				<view class="report-selector-btn" :class="{disabled: reportSelectorUnavailable('background')}" @click="selectReportArtifact('background')">背景报告</view>
+				<view class="report-selector-btn" :class="{disabled: reportSelectorUnavailable('professional')}" @click="selectReportArtifact('professional')">教练报告</view>
+				<view class="report-selector-btn" @click="selectReportArtifact('public')">团队报告</view>
+				<view class="report-selector-cancel" @click="closeReportSelector">取消</view>
+			</view>
+		</view>
 		<view class="kind-reminder adffcacjc" v-if="reportReminderShow">
 			<view class="kr-box adffcac">
 				<view class="kr-title">温馨提示</view>
@@ -122,6 +128,8 @@
 				testShow:false,
 				reportReminderShow:false,
 				reportReminderMsg:'',
+				reportSelectorShow:false,
+				reportSelectorItem:null,
 				evaluationVisible:false,
 				evaluationSubmitting:false,
 				evaluationReportId:'',
@@ -208,6 +216,28 @@
 					: '教练报告需要配合团队版评估数据生成';
 				this.reportReminderShow = true;
 			},
+			showReportSelector(item){
+				if(!this.guardReportOperation(item) || String(item.state) !== '1') return;
+				this.reportSelectorItem = item;
+				this.reportSelectorShow = true;
+			},
+			closeReportSelector(){
+				this.reportSelectorShow = false;
+				this.reportSelectorItem = null;
+			},
+			reportSelectorUnavailable(kind){
+				return this.reportSelectorItem && String(this.reportSelectorItem.type) === '1'
+					&& ['background', 'professional'].indexOf(kind) !== -1;
+			},
+			selectReportArtifact(kind){
+				const item = this.reportSelectorItem;
+				this.closeReportSelector();
+				if(!item || !this.guardReportOperation(item)) return;
+				if(String(item.type) === '1' && ['background', 'professional'].indexOf(kind) !== -1) {
+					return this.showReportUnavailable(kind);
+				}
+				this.reviewArtifact(item, kind);
+			},
 			canEditEvaluation(item){
 				return canEditEvaluation(item);
 			},
@@ -569,6 +599,11 @@
 			}
 		}
 	}
+	.report-selector-box{padding-bottom: 36rpx;}
+	.report-selector-tip{margin-top: 20rpx;text-align:center;font-size:28rpx;color:#667E90;}
+	.report-selector-btn{width:calc(100% - 40rpx);height:76rpx;margin:22rpx 20rpx 0;border-radius:38rpx;background:linear-gradient(90deg,#33A7A7 0%,#64BBBB 100%);color:#fff;text-align:center;line-height:76rpx;font-size:30rpx;}
+	.report-selector-btn.disabled{background:#D5DDE2;}
+	.report-selector-cancel{margin-top:24rpx;text-align:center;font-size:28rpx;line-height:48rpx;color:#667E90;}
 	.evaluation-mask{position:fixed;left:0;right:0;top:0;bottom:0;z-index:30;background:rgba(0,0,0,.45);}
 	.evaluation-box{width:650rpx;background:#fff;border-radius:16rpx;padding:34rpx 28rpx 26rpx;box-sizing:border-box;}
 	.evaluation-label{font-size:28rpx;font-weight:bold;color:#333;margin:18rpx 0 12rpx;}

+ 6 - 20
tests/reportButtonAvailability.test.js

@@ -7,30 +7,16 @@ assert.match(source, /isReportGenerating\(item\)/);
 assert.match(source, /showGeneratingReminder/);
 assert.match(source, /guardReportOperation\(item\)/);
 
-assert.match(
-  source,
-  /class="gbox-item-bottom-right report-button-disabled"\s+@click="showReportUnavailable\('background'\)"/
-);
-assert.match(
-  source,
-  /class="gbox-item-bottom-right report-button-disabled"\s+@click="showReportUnavailable\('professional'\)"/
-);
+assert.match(source, /@click="showReportSelector\(item\)"/);
+assert.match(source, /v-if="reportSelectorShow"/);
 assert.match(source, /背景报告需配合团队版评估数据生成/);
 assert.match(source, /教练报告需要配合团队版评估数据生成/);
 assert.match(source, /v-if="reportReminderShow"/);
 assert.match(source, /<view class="kr-title">温馨提示<\/view>/);
 assert.match(source, /<view class="kr-btn" @click="reportReminderShow=false">确定<\/view>/);
-assert.match(
-  source,
-  /class="gbox-item-bottom-right"\s+@click="reviewArtifact\(item, 'public'\)"\s+v-if="item\.state==1">团队报告/
-);
-assert.match(
-  source,
-  /class="gbox-item-bottom-right"\s+@click="reviewArtifact\(item, 'background'\)"\s+v-if="item\.state==1">背景报告/
-);
-assert.match(
-  source,
-  /class="gbox-item-bottom-right"\s+@click="reviewArtifact\(item, 'professional'\)"\s+v-if="item\.state==1">教练报告/
-);
+assert.match(source, /selectReportArtifact\('background'\)/);
+assert.match(source, /selectReportArtifact\('professional'\)/);
+assert.match(source, /selectReportArtifact\('public'\)/);
+assert.match(source, />查看报告<\/view>/);
 
 console.log('reportButtonAvailability.test.js: all assertions passed');