预览计算问题修改

uat_us
wangxiaoshuang 2024-03-28 08:58:33 +08:00
parent 0343ba6043
commit 372213c7e5
1 changed files with 5 additions and 14 deletions

View File

@ -433,7 +433,6 @@ export default {
this.addOrEdit.visible = false this.addOrEdit.visible = false
}, },
logic(rules, num = 0) { logic(rules, num = 0) {
console.log(rules,'rules')
try { try {
if (rules.CalculateQuestionList.length === 0) { if (rules.CalculateQuestionList.length === 0) {
return false return false
@ -452,8 +451,6 @@ export default {
}) })
break break
case 6: case 6:
console.log(this.questionForm[o.QuestionId])
console.log(this.questionForm)
this.questionForm[o.QuestionId].forEach((q, qi) => { this.questionForm[o.QuestionId].forEach((q, qi) => {
if (qi === 0) { if (qi === 0) {
num = parseFloat(q[o.TableQuestionId]) num = parseFloat(q[o.TableQuestionId])
@ -516,14 +513,12 @@ export default {
formItemNumberChange(questionId, isTable) { formItemNumberChange(questionId, isTable) {
if (isTable) { if (isTable) {
this.calculationList.forEach((v, i) => { this.calculationList.forEach((v, i) => {
console.log(v, i)
var find = v.CalculateQuestionList.filter(o => { var find = v.CalculateQuestionList.filter(o => {
return o.QuestionId === questionId return o.QuestionId === questionId
}) })
// findnumber // findnumber
console.log('find', find) console.log('find', find)
if (find) { if (find) {
console.log(v,'111111')
var num = this.logic(v) var num = this.logic(v)
if (num !== false) { if (num !== false) {
this.$emit('setFormItemData', { key: v.QuestionId, val: num }) this.$emit('setFormItemData', { key: v.QuestionId, val: num })
@ -537,7 +532,6 @@ export default {
}) })
// findnumber // findnumber
if (find) { if (find) {
console.log(v,'222222')
var num = this.logic(v) var num = this.logic(v)
if (num !== false) { if (num !== false) {
this.$emit('setFormItemData', { key: v.QuestionId, val: num }) this.$emit('setFormItemData', { key: v.QuestionId, val: num })
@ -551,12 +545,10 @@ export default {
this.question.TableQuestions.Questions.forEach(v => { this.question.TableQuestions.Questions.forEach(v => {
if (v.Type === 'number' && v.DataSource === 1) { if (v.Type === 'number' && v.DataSource === 1) {
var CalculateQuestions = JSON.parse(v.CalculateQuestions) var CalculateQuestions = JSON.parse(v.CalculateQuestions)
var num, minArr=[],maxArr=[],arr=[] var num,arr=[]
CalculateQuestions.forEach((o, i) => { CalculateQuestions.forEach((o, i) => {
if (i === 0) { if (i === 0) {
num = parseFloat(this.QuestionsForm[o.TableQuestionId]) num = parseFloat(this.QuestionsForm[o.TableQuestionId])
minArr = [num];
maxArr = [num];
arr = [num]; arr = [num];
} else { } else {
switch (v.CustomCalculateMark) { switch (v.CustomCalculateMark) {
@ -578,12 +570,12 @@ export default {
num = arr.length === 0 ? 0 : num / arr.length num = arr.length === 0 ? 0 : num / arr.length
break break
case 8: case 8:
maxArr.push(parseFloat(this.QuestionsForm[o.TableQuestionId])) arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]))
num = maxArr.length === 0 ? 0 : Math.max(...maxArr) num = arr.length === 0 ? 0 : Math.max(...arr)
break break
case 9: case 9:
minArr.push(parseFloat(this.QuestionsForm[o.TableQuestionId])) arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]))
num = minArr.length === 0 ? 0 : Math.min(...minArr) num = arr.length === 0 ? 0 : Math.min(...arr)
// console.log('min', this.questionForm[o.QuestionId], arr, num) // console.log('min', this.questionForm[o.QuestionId], arr, num)
break break
} }
@ -646,7 +638,6 @@ export default {
this.$emit('setFormItemData', obj) this.$emit('setFormItemData', obj)
}, },
async uploadScreenshot(param) { async uploadScreenshot(param) {
console.log(this.visitTaskId)
if (!this.visitTaskId) { if (!this.visitTaskId) {
const loading = this.$loading({ const loading = this.$loading({
target: document.querySelector('.ecrf-wrapper'), target: document.querySelector('.ecrf-wrapper'),