自定义标准运算类型补充

uat_us
caiyiling 2024-11-11 14:40:21 +08:00
parent bc6f15388d
commit 5619412556
5 changed files with 66 additions and 68 deletions

View File

@ -67,7 +67,7 @@
:label="`${question.QuestionName}`" :label="`${question.QuestionName}`"
:prop="question.Id" :prop="question.Id"
:rules="[ :rules="[
{ required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && (question.RelevanceValueList.includes(questionForm[question.RelevanceId])))) && question.Type!=='group' && question.Type!=='summary', { required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && (question.RelevanceValueList.includes(isNaN(parseFloat(questionForm[question.RelevanceId])) ? questionForm[question.RelevanceId] : questionForm[question.RelevanceId].toString())))) && question.Type!=='group' && question.Type!=='summary',
message: $t('common:ruleMessage:specify'), trigger: ['blur', 'change']}, message: $t('common:ruleMessage:specify'), trigger: ['blur', 'change']},
]" ]"
:class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']" :class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']"
@ -202,11 +202,23 @@
/> />
<!-- 数值 --> <!-- 数值 -->
<!-- :precision="2" :step="0.1" :max="10" --> <!-- :precision="2" :step="0.1" :max="10" -->
<el-select
v-if="question.Type === 'number' && question.TypeValue"
v-model="questionForm[question.Id]"
clearable
@change="(val) => { formItemNumberChange(val, question) }"
>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val.trim()"
:value="val.trim()"
/>
</el-select>
<el-input <el-input
type="number" type="number"
v-if="question.Type === 'number' && question.DataSource !== 1" v-if="question.Type === 'number' && question.DataSource !== 1"
@change="((val)=>{formItemNumberChange(val, question)})" @change="(val) => { formItemNumberChange(val, question) }"
onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));console.log(localStorage.getItem('digitPlaces'))" onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));console.log(localStorage.getItem('digitPlaces'))"
@input="limitInput($event, questionForm, question.Id)" @input="limitInput($event, questionForm, question.Id)"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
@ -241,43 +253,7 @@
<el-button slot="default" class="el-icon-plus"> <el-button slot="default" class="el-icon-plus">
{{this.$t('common:button:upload')}} {{this.$t('common:button:upload')}}
</el-button> </el-button>
<!-- <div slot="file" slot-scope="{file}">-->
<!-- <div class="el-upload-list__item-name"></div>-->
<!--&lt;!&ndash; <img&ndash;&gt;-->
<!--&lt;!&ndash; class="el-upload-list__item-thumbnail"&ndash;&gt;-->
<!--&lt;!&ndash; :src="OSSclientConfig.basePath + file.url"&ndash;&gt;-->
<!--&lt;!&ndash; alt=""&ndash;&gt;-->
<!--&lt;!&ndash; >&ndash;&gt;-->
<!-- <span class="el-upload-list__item-actions">-->
<!-- <span-->
<!-- class="el-upload-list__item-preview"-->
<!-- @click="handlePictureCardPreview(file)"-->
<!-- >-->
<!-- <i class="el-icon-zoom-in" />-->
<!-- </span>-->
<!-- <span-->
<!-- v-if="readingTaskState < 2"-->
<!-- class="el-upload-list__item-delete"-->
<!-- @click="handleRemove(file)"-->
<!-- >-->
<!-- <i class="el-icon-delete" />-->
<!-- </span>-->
<!-- </span>-->
<!-- </div>-->
</el-upload> </el-upload>
<!-- <el-dialog
v-if="question.Type==='upload'"
append-to-body
:visible.sync="imgVisible"
width="600px"
>
<el-image :src="imageUrl" width="100%">
<div slot="placeholder" class="image-slot">
加载中<span class="dot">...</span>
</div>
</el-image>
</el-dialog> -->
<viewer <viewer
v-if="question.Type==='upload' && imgVisible" v-if="question.Type==='upload' && imgVisible"
:ref="imageUrl" :ref="imageUrl"
@ -426,7 +402,13 @@ export default {
// if (!v[this.question.Id] || !oldv[this.question.Id]) return // if (!v[this.question.Id] || !oldv[this.question.Id]) return
// } catch (e) { // } catch (e) {
// } // }
// this.formItemNumberChange(this.question.Id, false) try {
if (!v || !v[this.question.Id] || !oldv || !oldv[this.question.Id])
return
} catch (e) {
console.log(e, v)
}
this.formItemNumberChange(this.question.Id, false)
} }
}, },
}, },
@ -521,10 +503,8 @@ export default {
}) })
answer = o ? o.label : null answer = o ? o.label : null
} }
if (answer !== null) {
this.$set(this.QuestionsForm, i.classId, answer) this.$set(this.QuestionsForm, i.classId, answer)
} }
}
}) })
// if (this.classArr.length > 0) { // if (this.classArr.length > 0) {
// let qs = this.classArr.find(i=>i.triggerId === obj.key) // let qs = this.classArr.find(i=>i.triggerId === obj.key)
@ -554,7 +534,6 @@ export default {
this.$set(this.QuestionsForm, obj.key, null) this.$set(this.QuestionsForm, obj.key, null)
}, },
handleSave() { handleSave() {
console.log(this.QuestionsForm)
this.$refs.tableQsForm.validate(valid => { this.$refs.tableQsForm.validate(valid => {
if (!valid) return if (!valid) return
const loading = this.$loading({ fullscreen: true }) const loading = this.$loading({ fullscreen: true })
@ -613,9 +592,7 @@ export default {
}) })
}, },
save() { save() {
console.log(this.$refs.tableQsForm, this.QuestionsForm)
this.$refs['tableQsForm'].validate((valid) => { this.$refs['tableQsForm'].validate((valid) => {
console.log(valid)
if (!valid) return if (!valid) return
if (this.addOrEdit.type === 'add') { if (this.addOrEdit.type === 'add') {
this.AnswersList.push(this.QuestionsForm) this.AnswersList.push(this.QuestionsForm)
@ -723,6 +700,18 @@ export default {
} }
num = Math.min(...dataArr); num = Math.min(...dataArr);
break; break;
case 13:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => acc && curr, 0) ? 1 : 0;
break;
case 14:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => acc || curr, 0) > 0 ? 1 : 0;
break;
} }
} }
}) })
@ -733,7 +722,12 @@ export default {
if (rules.ValueType === 2) { if (rules.ValueType === 2) {
num = num * 100 num = num * 100
} }
if (rules.CustomCalculateMark === 13 || rules.CustomCalculateMark === 14) {
return num
} else {
return num.toFixed(digitPlaces) return num.toFixed(digitPlaces)
}
}, },
formItemNumberChange(questionId, isTable) { formItemNumberChange(questionId, isTable) {
if (isTable) { if (isTable) {

View File

@ -248,10 +248,8 @@ export default {
}) })
answer = o ? o.label.trim() : null answer = o ? o.label.trim() : null
} }
if (answer !== null) {
this.$set(this.questionForm, i.classId, answer) this.$set(this.questionForm, i.classId, answer)
} }
}
}) })
// if (this.classArr.length > 0) { // if (this.classArr.length > 0) {
// let qs = this.classArr.find(i=>i.triggerId === obj.key) // let qs = this.classArr.find(i=>i.triggerId === obj.key)

View File

@ -39,7 +39,7 @@
v-if=" v-if="
(question.ShowQuestion === 1 && (question.ShowQuestion === 1 &&
!!~question.ParentTriggerValueList.indexOf( !!~question.ParentTriggerValueList.indexOf(
questionForm[question.ParentId].toString() questionForm[question.ParentId]
)) || )) ||
question.ShowQuestion === 0 question.ShowQuestion === 0
" "
@ -52,8 +52,8 @@
(question.IsRequired === 1 && (question.IsRequired === 1 &&
question.RelevanceId && question.RelevanceId &&
!!~question.RelevanceValueList.indexOf( !!~question.RelevanceValueList.indexOf(
questionForm[question.RelevanceId].toString() isNaN(parseFloat(questionForm[question.RelevanceId])) ? questionForm[question.RelevanceId] :
))) && questionForm[question.RelevanceId].toString()))) &&
question.Type !== 'group' && question.Type !== 'group' &&
question.Type !== 'summary', question.Type !== 'summary',
message: this.$t('common:ruleMessage:specify'), message: this.$t('common:ruleMessage:specify'),
@ -625,6 +625,18 @@ export default {
} }
num = Math.min(...dataArr); num = Math.min(...dataArr);
break; break;
case 13:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => acc && curr, 0) ? 1 : 0;
break;
case 14:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => acc || curr, 0) > 0 ? 1 : 0;
break;
} }
} }
}); });
@ -651,6 +663,7 @@ export default {
var find = v.CalculateQuestionList.filter((o) => { var find = v.CalculateQuestionList.filter((o) => {
return o.TableQuestionId === questionId; return o.TableQuestionId === questionId;
}); });
// findnumber // findnumber
if (find) { if (find) {
var num = this.logic(v); var num = this.logic(v);
@ -782,7 +795,6 @@ export default {
this.$emit("setFormItemData", obj); this.$emit("setFormItemData", obj);
}, },
setTblFormItemData(obj) { setTblFormItemData(obj) {
console.log('setTblFormItemData', this.classArr)
this.$set(this.QuestionsForm, obj.key, obj.val) this.$set(this.QuestionsForm, obj.key, obj.val)
this.classArr.map(i=>{ this.classArr.map(i=>{
if (i.triggerId === obj.key) { if (i.triggerId === obj.key) {
@ -802,10 +814,8 @@ export default {
}) })
answer = o ? o.label : null answer = o ? o.label : null
} }
if (answer !== null) {
this.$set(this.QuestionsForm, i.classId, answer) this.$set(this.QuestionsForm, i.classId, answer)
} }
}
}) })
// if (this.classArr.length > 0) { // if (this.classArr.length > 0) {
// let qs = this.classArr.find(i=>i.triggerId === obj.key) // let qs = this.classArr.find(i=>i.triggerId === obj.key)

View File

@ -169,7 +169,7 @@
<el-select v-model="form.ParentTriggerValueList" clearable multiple> <el-select v-model="form.ParentTriggerValueList" clearable multiple>
<el-option <el-option
v-for="item of parentTriggerValOptions" v-for="item of parentTriggerValOptions"
:key="item.value" :key="`ParentTriggerValueList${item.value}`"
:label="item.label" :label="item.label"
:value="item.value + ''" :value="item.value + ''"
/> />
@ -203,7 +203,7 @@
<el-select v-model="form.RelevanceValueList" clearable multiple> <el-select v-model="form.RelevanceValueList" clearable multiple>
<el-option <el-option
v-for="item of reParentTriggerValOptions" v-for="item of reParentTriggerValOptions"
:key="item.id" :key="`RelevanceValueList${item.value}`"
:label="item.label" :label="item.label"
:value="item.value + ''" :value="item.value + ''"
/> />
@ -311,7 +311,6 @@
<!-- 是否在影像页面显示 --> <!-- 是否在影像页面显示 -->
<el-form-item <el-form-item
:label="$t('trials:readingUnit:qsList:title:isShowInDicom')" :label="$t('trials:readingUnit:qsList:title:isShowInDicom')"
v-if="form.ShowQuestion !== 2"
prop="ShowQuestion" prop="ShowQuestion"
> >
<el-radio-group v-model="form.IsShowInDicom"> <el-radio-group v-model="form.IsShowInDicom">
@ -470,7 +469,7 @@
<template v-if="form.TypeValue"> <template v-if="form.TypeValue">
<el-option <el-option
v-for="item of form.TypeValue.split('|')" v-for="item of form.TypeValue.split('|')"
:key="item" :key="`HighlightAnswerList${item}`"
:label="item" :label="item"
:value="item" :value="item"
/> />
@ -606,7 +605,7 @@
<div> <div>
<el-radio <el-radio
v-for="item of $d.CustomCalculateMark" v-for="item of $d.CustomCalculateMark"
v-show="item.value <= 4 || item.value === 10 || item.value === 11 || item.value === 12" v-show="item.value <= 4 || item.value === 10 || item.value === 11 || item.value === 12 || item.value === 13 || item.value === 14"
:key="`CustomCalculateMark${item.value}`" :key="`CustomCalculateMark${item.value}`"
:label="item.value" :label="item.value"
> >
@ -1209,7 +1208,6 @@ export default {
CustomCalculateMarkChange() { CustomCalculateMarkChange() {
this.isShow = false this.isShow = false
if (this.form.CustomCalculateMark <= 4 || this.form.CustomCalculateMark >= 10) { if (this.form.CustomCalculateMark <= 4 || this.form.CustomCalculateMark >= 10) {
console.log('1111')
this.form.CalculateQuestions = [ this.form.CalculateQuestions = [
{ {
IsTable: false, IsTable: false,
@ -1244,7 +1242,7 @@ export default {
if (res.Result) { if (res.Result) {
this.tableQuestions = res.Result.filter(i=>i.Type === 'basicTable') this.tableQuestions = res.Result.filter(i=>i.Type === 'basicTable')
this.selectQuestions = res.Result.filter(i=>i.Type === 'select' || i.Type === 'radio' || i.Type === 'class') this.selectQuestions = res.Result.filter(i=>i.Type === 'select' || i.Type === 'radio' || i.Type === 'class')
this.numberQuestions = res.Result.filter(i=>i.Type === 'number') this.numberQuestions = res.Result.filter(i=>i.Type === 'number' || (i.Type === 'class' && i.ClassifyShowType === 4))
} }
} catch(e) { } catch(e) {
console.log(e) console.log(e)

View File

@ -203,10 +203,8 @@ export default {
}) })
answer = o ? o.label : null answer = o ? o.label : null
} }
if (answer !== null) {
this.$set(this.questionForm, i.classId, answer) this.$set(this.questionForm, i.classId, answer)
} }
}
}) })
// if (this.classArr.length > 0) { // if (this.classArr.length > 0) {
// let qs = this.classArr.find(i=>i.triggerId === obj.key) // let qs = this.classArr.find(i=>i.triggerId === obj.key)