Compare commits

..

No commits in common. "23069c7ef7dbeddf96c1a960dd2eb2b5961f0e8b" and "cb4d44ef74963cf4a6818fdec0b8b892447d250e" have entirely different histories.

3 changed files with 63 additions and 284 deletions

View File

@ -158,7 +158,6 @@
<el-input <el-input
v-if="question.Type === 'class' && question.ClassifyShowType === 1" v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType"
/> />
<el-select <el-select
v-if="question.Type === 'class' && question.ClassifyShowType === 2" v-if="question.Type === 'class' && question.ClassifyShowType === 2"
@ -192,7 +191,6 @@
type="number" type="number"
:disabled="!question.ClassifyEditType" :disabled="!question.ClassifyEditType"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
@change="(val) => { formItemNumberChange(val, question) }"
/> />
<!-- 自动计算 --> <!-- 自动计算 -->
<!-- :precision="2" :step="0.1" :max="10" --> <!-- :precision="2" :step="0.1" :max="10" -->
@ -227,7 +225,7 @@
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')));" 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]"
> >
@ -237,7 +235,7 @@
<el-input <el-input
type="number" type="number"
v-if="question.Type === 'number' && question.DataSource === 1" v-if="question.Type === 'number' && question.DataSource === 1"
onblur="value=parseFloat(value).toFixed(parseInt(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)"
:disabled="question.DataSource === 1" :disabled="question.DataSource === 1"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
@ -410,7 +408,7 @@ 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) {
// } // }
try { try {
if (!v || !v[this.question.Id] || !oldv || !oldv[this.question.Id]) if (!v || !v[this.question.Id] || !oldv || !oldv[this.question.Id])
return return
} catch (e) { } catch (e) {
@ -469,9 +467,11 @@ export default {
if (value.split('.')[1].length >= this.digitPlaces) { if (value.split('.')[1].length >= this.digitPlaces) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
} }
} else {
} }
}, },
deleteTableCol(row, index) { deleteTableCol(row, index) {
console.log(row)
this.$confirm(this.$t('trials:uploadNonDicoms:message:msg1')).then(() => { this.$confirm(this.$t('trials:uploadNonDicoms:message:msg1')).then(() => {
const loading = this.$loading({ fullscreen: true }) const loading = this.$loading({ fullscreen: true })
var param = { var param = {
@ -551,6 +551,7 @@ export default {
for (const k in this.QuestionsForm) { for (const k in this.QuestionsForm) {
if (reg.test(k)) { if (reg.test(k)) {
if (answers.findIndex(i => i.tableQuestionId === k) === -1) { if (answers.findIndex(i => i.tableQuestionId === k) === -1) {
console.log(this.QuestionsForm)
answers.push({ tableQuestionId: k, answer: this.QuestionsForm[k] }) answers.push({ tableQuestionId: k, answer: this.QuestionsForm[k] })
} }
} }
@ -863,6 +864,7 @@ export default {
this.QuestionsForm = {} this.QuestionsForm = {}
} else { } else {
this.addOrEdit.type = 'edit' this.addOrEdit.type = 'edit'
console.log(this.questionForm)
this.QuestionsForm = Object.assign({}, this.questionForm[row.Id][index]) this.QuestionsForm = Object.assign({}, this.questionForm[row.Id][index])
} }
}, },
@ -915,6 +917,7 @@ export default {
}, },
async uploadScreenshot(param) { async uploadScreenshot(param) {
console.log('uploadScreenshot')
if (!this.visitTaskId) return if (!this.visitTaskId) return
const loading = this.$loading({ const loading = this.$loading({
target: document.querySelector('.ecrf-wrapper'), target: document.querySelector('.ecrf-wrapper'),
@ -927,6 +930,7 @@ export default {
let file = await this.fileToBlob(param.file) let file = await this.fileToBlob(param.file)
let res = await this.OSSclient.put(`/${this.$route.query.trialId}/Customize/${this.visitTaskId}/${fileName}`, file) let res = await this.OSSclient.put(`/${this.$route.query.trialId}/Customize/${this.visitTaskId}/${fileName}`, file)
this.fileList.push({ name: `${this.$t('trials:emailManageCfg:title:fileName')}${this.fileList.length + 1}`, url: this.$getObjectName(res.url) }) this.fileList.push({ name: `${this.$t('trials:emailManageCfg:title:fileName')}${this.fileList.length + 1}`, url: this.$getObjectName(res.url) })
console.log('fileList', this.fileList)
this.urls.push(this.$getObjectName(res.url)) this.urls.push(this.$getObjectName(res.url))
this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question }) this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question })
loading.close() loading.close()
@ -943,6 +947,7 @@ export default {
}, },
handleBeforeUpload(file, accept) { handleBeforeUpload(file, accept) {
// //
console.log('handleBeforeUpload', file)
if (this.checkFileSuffix(file.name, accept) || accept === '-1') { if (this.checkFileSuffix(file.name, accept) || accept === '-1') {
return true return true
} else { } else {
@ -950,6 +955,7 @@ export default {
this.$alert(msg) this.$alert(msg)
return false return false
} }
console.log(file)
}, },
checkFileSuffix(fileName, accept) { checkFileSuffix(fileName, accept) {
var index = fileName.lastIndexOf('.') var index = fileName.lastIndexOf('.')
@ -976,6 +982,7 @@ export default {
}, },
// //
handleRemove(file, fileList) { handleRemove(file, fileList) {
console.log('handleRemove')
if (file && file.status === "success") { if (file && file.status === "success") {
this.imageUrl = '' this.imageUrl = ''
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1) this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)

View File

@ -55,7 +55,6 @@
:question-form="questionForm" :question-form="questionForm"
:reading-task-state="readingTaskState" :reading-task-state="readingTaskState"
:visit-task-id="visitTaskId" :visit-task-id="visitTaskId"
:calculation-list="calculationList"
@setFormItemData="setFormItemData" @setFormItemData="setFormItemData"
@resetFormItemData="resetFormItemData" @resetFormItemData="resetFormItemData"
/> />
@ -111,7 +110,7 @@
<script> <script>
import { getTrialReadingQuestion, saveVisitTaskQuestions, submitVisitTaskQuestionsInDto, getQuestionCalculateRelation } from '@/api/trials' import { getTrialReadingQuestion, saveVisitTaskQuestions, submitVisitTaskQuestionsInDto } from '@/api/trials'
import { setSkipReadingCache } from '@/api/reading' import { setSkipReadingCache } from '@/api/reading'
import const_ from '@/const/sign-code' import const_ from '@/const/sign-code'
import FormItem from './FormItem' import FormItem from './FormItem'
@ -159,12 +158,10 @@ export default {
readingTaskState: 0, readingTaskState: 0,
activeName: 0, activeName: 0,
formType: null, formType: null,
classArr: [], classArr: []
calculationList: []
} }
}, },
mounted() { mounted() {
this.getQuestionCalculateRelation()
this.getQuestions() this.getQuestions()
DicomEvent.$on('refreshQuestionAnswer', _ => { DicomEvent.$on('refreshQuestionAnswer', _ => {
this.getQuestions() this.getQuestions()
@ -215,6 +212,7 @@ export default {
this.publicQuestions = res.Result.PublicPage this.publicQuestions = res.Result.PublicPage
} }
} else { } else {
console.log(1111)
res.Result.SinglePage.map((v) => { res.Result.SinglePage.map((v) => {
if (v.Type === 'group' && v.Childrens.length === 0) return if (v.Type === 'group' && v.Childrens.length === 0) return
if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary') { if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary') {
@ -228,6 +226,7 @@ export default {
} }
}) })
this.questions = res.Result.SinglePage this.questions = res.Result.SinglePage
console.log(this.questions)
} }
this.isRender = true this.isRender = true
} }
@ -249,14 +248,6 @@ export default {
} }
}) })
}, },
async getQuestionCalculateRelation() {
try {
let res = await getQuestionCalculateRelation({TrialReadingCriterionId: this.criterionId})
this.calculationList = res.Result
} catch(e) {
console.log(e)
}
},
async handleSave() { async handleSave() {
const valid = await this.$refs['questions'].validate() const valid = await this.$refs['questions'].validate()
if (!valid) return if (!valid) return
@ -365,28 +356,28 @@ export default {
this.questionForm[v] = null this.questionForm[v] = null
}, },
setFormItemData(obj) { setFormItemData(obj) {
this.$set(this.questionForm, obj.key, JSON.parse(JSON.stringify(obj.val))) this.$set(this.questionForm, obj.key, obj.val)
this.classArr.map(i=>{ if (this.classArr.length > 0) {
if (i.triggerId === obj.key) { let qs = this.classArr.find(i=>i.triggerId === obj.key)
let answer = null if (!qs) return
let list = JSON.parse(i.classifyAlgorithms) let answer = null
if (i.classifyType === 0) { let list = JSON.parse(qs.classifyAlgorithms)
let o = list.find(v => { if (qs.classifyType === 0) {
return ( let o = list.find(v => {
parseFloat(obj.val) >= parseFloat(v.gt) && return (
parseFloat(obj.val) < parseFloat(v.lt) parseFloat(obj.val) >= parseFloat(v.gt) &&
) parseFloat(obj.val) < parseFloat(v.lt)
}) )
answer = o ? o.label : null })
} else if (i.classifyType === 1) { answer = o ? o.label : null
let o = list.find(v => { } else if (qs.classifyType === 1) {
return v.val.includes(obj.val) let o = list.find(v => {
}) return v.val.includes(obj.val)
answer = o ? o.label : null })
} answer = o ? o.label : null
this.$set(this.questionForm, i.classId, answer) }
} this.$set(this.questionForm, qs.classId, answer)
}) }
} }
} }
} }

View File

@ -18,7 +18,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(isNaN(parseFloat(questionForm[question.RelevanceId])) ? questionForm[question.RelevanceId] : questionForm[question.RelevanceId].toString())))) && question.Type!=='group' && question.Type!=='summary', { required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && (questionForm[question.RelevanceId] === question.RelevanceValue))) && 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':'']"
@ -121,67 +121,34 @@
<!-- 数值 --> <!-- 数值 -->
<!-- :precision="2" :step="0.1" :max="10" --> <!-- :precision="2" :step="0.1" :max="10" -->
<template v-if="question.Type==='number'"> <template v-if="question.Type==='number'">
<!-- 数值 --> <el-input-number
<el-select v-if="question.ValueType === 0"
v-if="question.TypeValue"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
clearable :precision="0"
@change="(val) => { formItemNumberChange(val, question) }" :disabled="readingTaskState >= 2"
> />
<el-option <el-input-number
v-for="val in question.TypeValue.split('|')" v-else-if="question.ValueType === 3"
:key="val"
:label="val.trim()"
:value="val.trim()"
/>
</el-select>
<el-input
type="number"
v-if="question.DataSource !== 1"
@change="(val) => { formItemNumberChange(val, question) }"
onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));"
@input="limitInput($event, questionForm, question.Id)"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
> :disabled="readingTaskState >= 2"
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template> />
<template slot="append" v-else-if="question.ValueType === 2">%</template> <el-input-number
</el-input> v-else-if="question.ValueType === 1 || question.ValueType === 2"
<el-input
type="number"
v-if="question.DataSource === 1"
onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));"
@input="limitInput($event, questionForm, question.Id)"
:disabled="question.DataSource === 1"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
> :precision="digitPlaces"
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template> :disabled="readingTaskState >= 2"
<template slot="append" v-else-if="question.ValueType === 2">%</template> />
</el-input>
</template> </template>
<!-- 自动分类 --> <!-- 自动分类 -->
<el-input <el-input
v-if="question.Type === 'class' && question.ClassifyShowType === 1" v-if="question.Type === 'class' && !question.TypeValue"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType" disabled
/> />
<el-select
v-if="question.Type === 'class' && question.ClassifyShowType === 2"
v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType"
@change="(val) => { formItemChange(val, question) }"
>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val.trim()"
:value="val.trim()"
/>
</el-select>
<el-radio-group <el-radio-group
v-if="question.Type === 'class' && question.ClassifyShowType === 3" v-if="question.Type === 'class' && question.TypeValue"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType" disabled
@change="(val) => { formItemChange(val, question) }"
> >
<el-radio <el-radio
v-for="item of question.TypeValue.split('|')" v-for="item of question.TypeValue.split('|')"
@ -191,13 +158,6 @@
{{ item.trim() }} {{ item.trim() }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
<el-input
v-if="question.Type === 'class' && question.ClassifyShowType === 4"
type="number"
:disabled="!question.ClassifyEditType"
v-model="questionForm[question.Id]"
@change="(val) => { formItemNumberChange(val, question) }"
/>
<!-- 上传图像 --> <!-- 上传图像 -->
<el-upload <el-upload
v-if="question.Type==='upload'" v-if="question.Type==='upload'"
@ -259,10 +219,8 @@
:reading-task-state="readingTaskState" :reading-task-state="readingTaskState"
:question-form="questionForm" :question-form="questionForm"
:visit-task-id="visitTaskId" :visit-task-id="visitTaskId"
:calculationList="calculationList"
@setFormItemData="setFormItemData" @setFormItemData="setFormItemData"
@resetFormItemData="resetFormItemData" @resetFormItemData="resetFormItemData"
@formItemNumberChange="formItemNumberChange"
/> />
</div> </div>
</template> </template>
@ -290,12 +248,6 @@ export default {
visitTaskId: { visitTaskId: {
type: String, type: String,
default: '' default: ''
},
calculationList: {
type: Array,
default() {
return []
}
} }
}, },
data() { data() {
@ -305,24 +257,15 @@ export default {
imgVisible: false, imgVisible: false,
imageUrl: '', imageUrl: '',
urls: [], urls: [],
digitPlaces: null, digitPlaces: null
} }
}, },
watch: { watch: {
questionForm: { questionForm: {
deep: true, deep: true,
immediate: true, immediate: true,
handler(v, oldv) { handler(v) {
try { // console.log(v)
if (!v || !v[this.question.Id] || !oldv || !oldv[this.question.Id])
return
} catch (e) {
console.log(e, v)
}
if (this.question.Type === 'class') {
this.$emit("setFormItemData", { key: this.question.Id, val: v[this.question.Id], question: v })
}
this.formItemNumberChange(this.question.Id, false)
} }
} }
}, },
@ -333,180 +276,18 @@ export default {
this.fileList = [] this.fileList = []
this.urls.map(url => { this.urls.map(url => {
this.fileList.push({ name: '', url: `${url}` }) this.fileList.push({ name: '', url: `/api/${url}` })
}) })
} }
} }
this.digitPlaces = localStorage.getItem('digitPlaces') ? parseInt(localStorage.getItem('digitPlaces')) : 0 this.digitPlaces = parseInt(localStorage.getItem('digitPlaces'))
}, },
methods: { methods: {
limitInput(value, a, b) {
if (value.indexOf('.') > -1) {
if (value.split('.')[1].length >= this.digitPlaces) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
}
}
},
logic(rules, num = 0) {
try {
if (rules.CalculateQuestionList.length === 0) {
return false
}
let dataArr = []
rules.CalculateQuestionList.forEach((o, i) => {
if (i === 0) {
if (rules.CustomCalculateMark > 4 && rules.CustomCalculateMark < 10) {
switch (rules.CustomCalculateMark) {
case 5:
this.questionForm[o.QuestionId].forEach((q, qi) => {
if (qi === 0) {
num = parseFloat(q[o.TableQuestionId])
} else {
num *= parseFloat(q[o.TableQuestionId])
}
})
break;
case 6:
this.questionForm[o.QuestionId].forEach((q, qi) => {
if (qi === 0) {
num = parseFloat(q[o.TableQuestionId])
} else {
num += parseFloat(q[o.TableQuestionId])
}
})
break;
case 7:
this.questionForm[o.QuestionId].forEach((q, qi) => {
if (qi === 0) {
num = parseFloat(q[o.TableQuestionId])
} else {
num += parseFloat(q[o.TableQuestionId])
}
})
num = this.questionForm[o.QuestionId].length === 0 ? 0 : num / this.questionForm[o.QuestionId].length
break;
case 8:
var arr = []
this.questionForm[o.QuestionId].forEach(q => {
arr.push(q[o.TableQuestionId])
})
num = arr.length === 0 ? 0 : Math.max(...arr)
break;
case 9:
var arr = []
this.questionForm[o.QuestionId].forEach(q => {
arr.push(q[o.TableQuestionId])
})
num = arr.length === 0 ? 0 : Math.min(...arr)
break;
}
} else {
num = parseFloat(this.questionForm[o.TableQuestionId])
if (!isNaN(num)) {
dataArr.push(num)
}
}
} 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;
case 10:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => {
return acc + (typeof curr === "number" ? curr : 0);
}, 0) / dataArr.length;
break;
case 11:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = Math.max(...dataArr);
break;
case 12:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = Math.min(...dataArr);
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) ? 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) ? 1 : 0;
break;
}
}
})
} catch (e) {
console.log(e)
}
var digitPlaces = parseInt(localStorage.getItem('digitPlaces'))
if (rules.ValueType === 2) {
num = num * 100
}
if (rules.CustomCalculateMark === 13 || rules.CustomCalculateMark === 14) {
return num
} else {
return num.toFixed(digitPlaces)
}
},
formItemNumberChange(questionId, isTable) {
if (isTable) {
this.calculationList.forEach((v, i) => {
var find = v.CalculateQuestionList.filter(o => {
return o.QuestionId === questionId
})
// findnumber
if (find) {
var num = this.logic(v)
if (num !== false) {
this.$emit('setFormItemData', { key: v.QuestionId, val: num, question: v })
}
}
})
} else {
this.calculationList.forEach(v => {
var find = v.CalculateQuestionList.filter(o => {
return o.TableQuestionId === questionId
})
// findnumber
if (find) {
var num = this.logic(v)
if (num !== false) {
this.$emit('setFormItemData', { key: v.QuestionId, val: num, question: v })
}
}
})
}
},
formItemChange(v, question) { formItemChange(v, question) {
if (question.Childrens.length > 0) { if (question.Childrens.length > 0) {
this.resetChild(question.Childrens) this.resetChild(question.Childrens)
} else { } else {
this.$emit('setFormItemData', { key: question.Id, val: v, question: question}) this.$emit('setFormItemData', { key: question.Id, val: v})
} }
}, },
resetChild(obj) { resetChild(obj) {