uat_us
parent
8a10d5287d
commit
ddd7e4638c
|
@ -288,7 +288,7 @@
|
||||||
:visit-task-id="visitTaskId"
|
:visit-task-id="visitTaskId"
|
||||||
:criterion-id="criterionId"
|
:criterion-id="criterionId"
|
||||||
:type="addOrEdit.type"
|
:type="addOrEdit.type"
|
||||||
:CalculationList="CalculationList"
|
:CalculationList="CalculationTabelList"
|
||||||
@formItemTableNumberChange="formItemTableNumberChange"
|
@formItemTableNumberChange="formItemTableNumberChange"
|
||||||
@setFormItemData="setFormItemData"
|
@setFormItemData="setFormItemData"
|
||||||
@resetFormItemData="resetFormItemData"
|
@resetFormItemData="resetFormItemData"
|
||||||
|
@ -368,7 +368,8 @@ export default {
|
||||||
loading: false,
|
loading: false,
|
||||||
RowIndex: 0,
|
RowIndex: 0,
|
||||||
RowId: null,
|
RowId: null,
|
||||||
digitPlaces: 0
|
digitPlaces: 0,
|
||||||
|
CalculationTabelList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -411,7 +412,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.question.Type === 'table') {
|
if (this.question.Type === 'table') {
|
||||||
// this.getQuestionCalculateRelation()
|
this.getQuestionCalculateRelation()
|
||||||
if (this.questionForm[this.question.Id]) {
|
if (this.questionForm[this.question.Id]) {
|
||||||
this.QuestionsForm = {}
|
this.QuestionsForm = {}
|
||||||
this.question.TableQuestions.Questions.forEach(v => {
|
this.question.TableQuestions.Questions.forEach(v => {
|
||||||
|
@ -511,10 +512,9 @@ export default {
|
||||||
},
|
},
|
||||||
getQuestionCalculateRelation() {
|
getQuestionCalculateRelation() {
|
||||||
getQuestionCalculateRelation({
|
getQuestionCalculateRelation({
|
||||||
TrialReadingCriterionId: this.criterionId,
|
|
||||||
ReadingQuestionId: this.question.Id
|
ReadingQuestionId: this.question.Id
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.CalculationList = res.Result
|
this.CalculationTabelList = res.Result
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
|
|
|
@ -211,6 +211,12 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
CalculationList: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
readingTaskState: {
|
readingTaskState: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
|
@ -248,15 +254,28 @@ export default {
|
||||||
digitPlaces: 0
|
digitPlaces: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// watch: {
|
||||||
|
// questionForm: {
|
||||||
|
// deep: true,
|
||||||
|
// immediate: true,
|
||||||
|
// handler(v) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
watch: {
|
watch: {
|
||||||
questionForm: {
|
questionForm: {
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(v) {
|
handler(v, oldv) {
|
||||||
|
try {
|
||||||
|
if (!v[this.question.Id] || !oldv[this.question.Id]) return
|
||||||
|
} catch (e) {
|
||||||
}
|
}
|
||||||
|
this.formItemNumberChange(this.question.Id, false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.digitPlaces = localStorage.getItem('digitPlaces') ? parseInt(localStorage.getItem('digitPlaces')) : 0
|
this.digitPlaces = localStorage.getItem('digitPlaces') ? parseInt(localStorage.getItem('digitPlaces')) : 0
|
||||||
if (this.question.Type === 'upload') {
|
if (this.question.Type === 'upload') {
|
||||||
|
@ -323,8 +342,91 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
logic(rules, num = 0) {
|
||||||
|
try {
|
||||||
|
if (rules.CalculateQuestionList.length === 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
var count = 0
|
||||||
|
var maxList = [], minList = []
|
||||||
|
rules.CalculateQuestionList.forEach((o, i) => {
|
||||||
|
if (rules.CustomCalculateMark > 4) {
|
||||||
|
if (i !== 0) {
|
||||||
|
switch (rules.CustomCalculateMark) {
|
||||||
|
case 7:
|
||||||
|
count += parseFloat(this.questionForm[o.TableQuestionId])
|
||||||
|
if (i === rules.CalculateQuestionList.length - 1) {
|
||||||
|
num = count / rules.CalculateQuestionList.length
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
maxList.push(this.questionForm[o.TableQuestionId])
|
||||||
|
if (i === rules.CalculateQuestionList.length - 1) {
|
||||||
|
num = Math.max(...maxList)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
minList.push(this.questionForm[o.TableQuestionId])
|
||||||
|
if (i === rules.CalculateQuestionList.length - 1) {
|
||||||
|
num = Math.min(...minList)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
maxList.push(this.questionForm[o.TableQuestionId])
|
||||||
|
minList.push(this.questionForm[o.TableQuestionId])
|
||||||
|
count = parseFloat(this.questionForm[o.TableQuestionId])
|
||||||
|
num = parseFloat(this.questionForm[o.TableQuestionId])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (rules.CustomCalculateMark) {
|
||||||
|
case 1:
|
||||||
|
num += parseFloat(this.questionForm[o.TableQuestionId])
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
num -= parseFloat(this.questionForm[o.TableQuestionId])
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
num *= parseFloat(this.questionForm[o.TableQuestionId])
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (parseFloat(this.questionForm[o.TableQuestionId]) === 0) {
|
||||||
|
num = 0
|
||||||
|
} else {
|
||||||
|
num /= parseFloat(this.questionForm[o.TableQuestionId])
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
var digitPlaces = parseInt(localStorage.getItem('digitPlaces'))
|
||||||
|
if (rules.ValueType === 2) {
|
||||||
|
num = num * 100
|
||||||
|
}
|
||||||
|
return num.toFixed(digitPlaces)
|
||||||
|
},
|
||||||
formItemNumberChange(v, question) {
|
formItemNumberChange(v, question) {
|
||||||
this.$emit('formItemTableNumberChange', v, question)
|
console.log(this.CalculationList)
|
||||||
|
this.CalculationList.forEach((v, i) => {
|
||||||
|
console.log('v', v)
|
||||||
|
var find = v.CalculateQuestionList.filter(o => {
|
||||||
|
return o.QuestionId === question.Id
|
||||||
|
})
|
||||||
|
console.log('find', find)
|
||||||
|
// find的自动计算值number
|
||||||
|
if (find) {
|
||||||
|
var num = this.logic(v)
|
||||||
|
console.log(num)
|
||||||
|
if (num !== false) {
|
||||||
|
this.$set(this.questionForm, v.QuestionId, num)
|
||||||
|
// this.$emit('setFormItemData', { key: v.QuestionId, val: num })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// this.$emit('formItemTableNumberChange', v, question)
|
||||||
},
|
},
|
||||||
resetChild(obj) {
|
resetChild(obj) {
|
||||||
obj.forEach(i => {
|
obj.forEach(i => {
|
||||||
|
|
|
@ -447,8 +447,8 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="(form.QuestionGenre === 0 || form.QuestionGenre === null) && (form.Type === 'select' || form.Type === 'radio') && isFromSystem"
|
v-if="(form.Type === 'select' || form.Type === 'radio') && isFromSystem"
|
||||||
:label="$t('trials:qcCfg:table:typeValue')"
|
:label="$t('trials:readingUnit:qsList:title:defaultValue')"
|
||||||
>
|
>
|
||||||
<el-select v-model="form.DefaultValue" clearable>
|
<el-select v-model="form.DefaultValue" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -459,6 +459,15 @@
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="(form.Type === 'number') && !isFromSystem"
|
||||||
|
:label="$t('trials:readingUnit:qsList:title:defaultValue')"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
:disabled="form.DataSource === 1"
|
||||||
|
v-model="form.DefaultValue"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<!-- 分组 -->
|
<!-- 分组 -->
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="form.Type !== 'group'"
|
v-if="form.Type !== 'group'"
|
||||||
|
|
|
@ -69,6 +69,21 @@
|
||||||
v-model="form.IsCopy"
|
v-model="form.IsCopy"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<!-- 问题数据来源 -->
|
||||||
|
<el-form-item v-if="form.Type === 'number'" :label="$t('trials:readingUnit:qsList:title:dataSource')"
|
||||||
|
prop="DataSource">
|
||||||
|
<el-radio-group
|
||||||
|
v-model="form.DataSource"
|
||||||
|
>
|
||||||
|
<el-radio
|
||||||
|
v-for="item of $d.DataSource"
|
||||||
|
:key="`DataSource${item.value}`"
|
||||||
|
:label="item.value"
|
||||||
|
>
|
||||||
|
{{ item.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="form.Type === 'number'"
|
v-if="form.Type === 'number'"
|
||||||
:label="$t('trials:readingUnit:qsList:title:valueType')"
|
:label="$t('trials:readingUnit:qsList:title:valueType')"
|
||||||
|
@ -135,14 +150,26 @@
|
||||||
style="line-height: 40px;"
|
style="line-height: 40px;"
|
||||||
@change="(v) => CustomCalculateMarkChange(v)"
|
@change="(v) => CustomCalculateMarkChange(v)"
|
||||||
>
|
>
|
||||||
|
<div>
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="item of $d.CustomCalculateMark"
|
v-for="item of $d.CustomCalculateMark"
|
||||||
v-if="item.value <= 4"
|
v-show="item.value <= 4"
|
||||||
:key="`CustomCalculateMark${item.value}`"
|
:key="`CustomCalculateMark${item.value}`"
|
||||||
:label="item.value"
|
:label="item.value"
|
||||||
>
|
>
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</el-radio>
|
</el-radio>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-radio
|
||||||
|
v-for="item of $d.CustomCalculateMark"
|
||||||
|
v-show="item.value > 6"
|
||||||
|
:key="`CustomCalculateMark${item.value}`"
|
||||||
|
:label="item.value"
|
||||||
|
>
|
||||||
|
{{ item.label }}
|
||||||
|
</el-radio>
|
||||||
|
</div>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-table
|
<el-table
|
||||||
|
@ -174,16 +201,12 @@
|
||||||
min-width="180"
|
min-width="180"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-if="!scope.row.IsTable" v-model="scope.row.TableQuestionId" clearable>
|
<el-select v-model="scope.row.TableQuestionId" clearable>
|
||||||
<el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName" :value="item.QuestionId" />
|
<el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName" :value="item.QuestionId" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-select v-if="scope.row.IsTable" v-model="scope.row.TableQuestionId" clearable>
|
|
||||||
<el-option v-for="item of !scope.row.QuestionId ? [] : tableQuestions.find(v => v.QuestionId === scope.row.QuestionId).TableQuestions" :key="item.QuestionId" :label="item.QuestionName" :value="item.QuestionId" />
|
|
||||||
</el-select>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-if="form.CustomCalculateMark <= 4"
|
|
||||||
:label="$t('common:action:action')"
|
:label="$t('common:action:action')"
|
||||||
prop="TableQuestionId"
|
prop="TableQuestionId"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
|
@ -620,7 +643,20 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// for (const k in this.form) {
|
||||||
|
// if (k === 'CalculateQuestions' && this.data[k] !== undefined) {
|
||||||
|
// console.log(this.data[k])
|
||||||
|
// this.form[k] = JSON.parse(this.data[k])
|
||||||
|
// console.log('CalculateQuestions', this.form[k])
|
||||||
|
// } else if (k === 'ClassifyAlgorithms' && this.data[k] !== undefined && this.data[k] !== '') {
|
||||||
|
// this.ClassifyAlgorithmsList = JSON.parse(this.data[k])
|
||||||
|
// console.log(11111, this.form)
|
||||||
|
// } else {
|
||||||
|
// if (this.data.hasOwnProperty(k)) {
|
||||||
|
// this.form[k] = this.data[k]
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
if (this.form.ParentId) {
|
if (this.form.ParentId) {
|
||||||
var index = this.parentOptions.findIndex(item => {
|
var index = this.parentOptions.findIndex(item => {
|
||||||
return item.QuestionId === this.form.ParentId
|
return item.QuestionId === this.form.ParentId
|
||||||
|
|
Loading…
Reference in New Issue