|
@@ -0,0 +1,268 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <div style="padding-left: 30px;padding-top: 30px;padding-bottom: 30px; font-weight: 600;">
|
|
|
+ <span style="margin-left: 20px;">有效测试用例总数:{{taskAmount.totalEffectiveTestCaseCount}}</span>
|
|
|
+ <span style="margin-left: 20px;">缺陷总评分:{{taskAmount.totalDefectScore}}</span>
|
|
|
+ <span style="margin-left: 20px;">任务总金额:{{taskAmount.totalAmount}}</span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-form :inline="true" :model="taskAmount" :rules="rules" label-position="left" label-width="100px" style="width: 100%; margin-left:50px;">
|
|
|
+ <el-form-item label="有效测试用例奖励金额" prop="effectiveWorkloadAmount" label-width="auto">
|
|
|
+ <el-input v-model.number="taskAmount.effectiveWorkloadAmount"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="缺陷奖励金额" prop="defectExciationAmount" label-width="auto">
|
|
|
+ <el-input v-model.number="taskAmount.defectExciationAmount"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="额外奖励金额" prop="extraRewardAmount" label-width="auto">
|
|
|
+ <el-input v-model.number="taskAmount.extraRewardAmount"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="extraRewardAmount">
|
|
|
+ <el-button type="primary" @click="cal">计算</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-table
|
|
|
+ :data="taskAmount.testerAmounts"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ style="width: 100%; "
|
|
|
+ max-height="500"
|
|
|
+ >
|
|
|
+ <el-table-column type="expand" align="center" min-width="1%">
|
|
|
+ <template slot-scope="{row, $index}">
|
|
|
+ <el-table
|
|
|
+ :data="[row]"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ style="width: 100%; "
|
|
|
+ max-height="500"
|
|
|
+ >
|
|
|
+ <el-table-column label="独有的致命缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.onlyOneVeryHighDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.onlyOneVeryHighDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="独有的严重缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.onlyOneHighDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.onlyOneHighDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="独有的一般缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.onlyOneMidDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.onlyOneMidDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="独有的轻微缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.onlyOneLowDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.onlyOneLowDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="独有的建议缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.onlyOneVeryLowDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.onlyOneVeryLowDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="优质的致命缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.topVeryHighDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.topVeryHighDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="优质的严重缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.topHighDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.topHighDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="优质的一般缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.topMidDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.topMidDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="优质的轻微缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.topLowDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.topLowDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="优质的建议缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.topVeryLowDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.topVeryLowDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="补充的致命缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.notTopVeryHighDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.notTopVeryHighDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="补充的严重缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.notTopHighDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.notTopHighDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="补充的一般缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.notTopMidDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.notTopMidDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="补充的轻微缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.notTopLowDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.notTopLowDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="补充的建议缺陷" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div>数量:{{ row.notTopVeryLowDefectCount }}</div>
|
|
|
+ <div>得分:{{ row.notTopVeryLowDefectScore }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="姓名" prop="code" align="center" min-width="3%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.testerRealName }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="有效测试用例数" align="center" :show-overflow-tooltip="true" min-width="6%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.effectiveTestCaseCount }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="缺陷评分" align="center" :show-overflow-tooltip="true" min-width="6%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.defectScore }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="有效测试用例奖励金额" align="center" :show-overflow-tooltip="true" min-width="6%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.effectiveWorkloadAmount }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="缺陷激励金额" align="center" :show-overflow-tooltip="true" min-width="6%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.defectExciationAmount }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="额外奖励金额" align="center" :show-overflow-tooltip="true" min-width="6%">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model.number="row.extraRewardAmount"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div style="width: 100%; margin-top: 20px;">
|
|
|
+ <el-button :disabled="!canSubmit" style="display: block; margin-left: auto; margin-right: auto;" type="primary" @click="submit()">提交并结束任务</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import Http from '@/js/http'
|
|
|
+import Api from '@/js/api'
|
|
|
+import {notify} from '@/constants'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'TaskAmountCal',
|
|
|
+ data: function () {
|
|
|
+ return {
|
|
|
+ taskAmount: {
|
|
|
+ effectiveWorkloadAmount: 0.0,
|
|
|
+ defectExciationAmount: 0.0,
|
|
|
+ extraRewardAmount: 0.0
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ effectiveWorkloadAmount: [
|
|
|
+ {required: true, message: '有效测试用例奖励金额不能为空', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ defectExciationAmount: [
|
|
|
+ {required: true, message: '缺陷奖励金额不能为空', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ extraRewardAmount: [
|
|
|
+ {required: true, message: '额外奖励金额不能为空', trigger: 'blur'}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ canSubmit: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.cal()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ cal () {
|
|
|
+ if (isNaN(this.taskAmount.effectiveWorkloadAmount)) {
|
|
|
+ notify('error', '有效测试用例奖励金额必须为数字!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (isNaN(this.taskAmount.defectExciationAmount)) {
|
|
|
+ notify('error', '缺陷奖励金额必须为数字!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (isNaN(this.taskAmount.extraRewardAmount)) {
|
|
|
+ notify('error', '额外奖励金额必须为数字!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ Http.get(Api.TASKAMOUNT.CAL.replace('{taskCode}', this.$route.params.taskCode)
|
|
|
+ .replace('{effectiveWorkloadAmount}', this.taskAmount.effectiveWorkloadAmount)
|
|
|
+ .replace('{defectExciationAmount}', this.taskAmount.defectExciationAmount)
|
|
|
+ .replace('{extraRewardAmount}', this.taskAmount.extraRewardAmount)).then((res) => {
|
|
|
+ this.taskAmount = res.data
|
|
|
+ this.canSubmit = this.taskAmount.status === 3
|
|
|
+ }).catch((error) => {
|
|
|
+ console.error(error)
|
|
|
+ notify('error', '获取任务金额数据失败:系统异常')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ submit () {
|
|
|
+ let postData = {}
|
|
|
+ if ((this.taskAmount.effectiveWorkloadAmount + this.taskAmount.defectExciationAmount + this.taskAmount.extraRewardAmount) !== this.taskAmount.totalAmount) {
|
|
|
+ notify('error', '有效测试用例奖励金额+缺陷奖励金额+额外奖励金额需等于任务总金额!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ postData['taskCode'] = this.$route.params.taskCode
|
|
|
+ postData['effectiveWorkloadAmount'] = this.taskAmount.effectiveWorkloadAmount
|
|
|
+ postData['defectExciationAmount'] = this.taskAmount.defectExciationAmount
|
|
|
+ postData['extraRewardAmount'] = this.taskAmount.extraRewardAmount
|
|
|
+ let testerExtraRewardAmounts = []
|
|
|
+ let totalExtraRewardAmount = 0.0
|
|
|
+ this.taskAmount.testerAmounts.forEach(testerAmount => {
|
|
|
+ totalExtraRewardAmount += testerAmount.extraRewardAmount
|
|
|
+ testerExtraRewardAmounts.push({'userId': testerAmount.testerId, 'amount': testerAmount.extraRewardAmount})
|
|
|
+ })
|
|
|
+ if (totalExtraRewardAmount !== this.taskAmount.extraRewardAmount) {
|
|
|
+ notify('error', '所有测试人员的额外奖励金额加起来需等于总的额外奖励金额!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ postData['testerExtraRewardAmounts'] = testerExtraRewardAmounts
|
|
|
+ Http.post(Api.TASKAMOUNT.CAL_AND_END, postData).then((res) => {
|
|
|
+ if (res.code === 20000) {
|
|
|
+ notify('success', '提交成功')
|
|
|
+ } else {
|
|
|
+ notify('error', '提交失败')
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+ console.error(error)
|
|
|
+ notify('error', '提交异常:系统异常')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|