irc_web/.svn/pristine/03/0320a2b93d8bb2c99f6177ff8a6...

253 lines
6.9 KiB
Plaintext

<template>
<el-form
ref="globalReadingForm"
v-loading="loading"
:model="form"
size="small"
:rules="rules"
label-width="110px"
>
<el-form-item label="评估结果" prop="GlobalAssessTypes">
<div style="width: 700px;display: flex">
<el-table
min-height="100"
style="width: 600px;"
ref="multipleTable"
:data="form.GlobalAssessTypes"
stripe
>
<el-table-column
prop="ValueCN"
label="中文值"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="Value"
label="英文值"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="IsBaseLineUse"
label="是否基线评估"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.IsBaseLineUse"
>
</el-switch>
<span>{{$fd('YesOrNo', scope.row.IsBaseLineUse)}}</span>
</template>
</el-table-column>
<el-table-column
prop="IsFollowVisitUse"
label="是否随访评估"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.IsFollowVisitUse"
>
</el-switch>
<span>{{$fd('YesOrNo', scope.row.IsFollowVisitUse)}}</span>
</template>
</el-table-column>
</el-table>
<div style="display: flex;align-items: center;padding-left: 10px">
<el-button
:disabled="form.IsSystemCriterion || isSign || !hasPermi(['trials:trials-panel:setting:reading-unit:edit'])"
icon="el-icon-plus"
circle
@click="handleSetCriterion"
/>
</div>
</div>
</el-form-item>
<el-form-item v-if="!isSign && hasPermi(['trials:trials-panel:setting:reading-unit:edit'])">
<!-- 保存 -->
<el-button
size="small"
type="primary"
@click="handleSave(true)"
>
{{ $t('common:button:save') }}
</el-button>
</el-form-item>
<el-dialog
v-if="config.visible"
:visible.sync="config.visible"
:close-on-click-modal="false"
:title="config.title"
width="90%"
append-to-body
>
<div style="text-align: right">
<el-button
size="mini"
type="primary"
@click="handleTypeSave"
v-loading="loading"
>
保存
</el-button>
</div>
<el-table
v-loading="loading"
v-adaptive="{bottomOffset:80}"
height="100"
ref="multipleTable"
:data="$d.GlobalAssessType"
stripe
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
prop="raw.ValueCN"
label="中文值"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="raw.Value"
label="英文值"
show-overflow-tooltip
>
</el-table-column>
</el-table>
</el-dialog>
</el-form>
</template>
<script>
import { getTrialConfigGlobalReadingInfo, setGlobalReadingInfo } from '@/api/trials'
import { getAssessType } from '@/api/dictionary'
export default {
name: "GlobalReading",
props: {
TrialReadingCriterionId: {
type: String,
default() {
return ''
}
}
},
data() {
return {
form: {
TrialId: '',
GlobalAssessTypes: [],
IsSystemCriterion: true
},
rules: {
GlobalAssessTypes: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: ['blur'] }]
},
loading: false,
config: { visible: false, title: '全局阅片' },
isSign: true,
selectedList: []
}
},
mounted() {
this.initForm()
},
methods: {
handleSelectionChange(val) {
this.selectedList = val
},
toggleSelection(rows) {
console.log(this.$refs.multipleTable)
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row);
});
} else {
this.$refs.multipleTable.clearSelection();
}
},
handleSetCriterion() {
this.config.visible = true
this.$nextTick(() => {
var a = this.$d.GlobalAssessType.filter(v => {
return !!this.form.GlobalAssessTypes.find(v1 => {
return v1.DictionaryId === v.id
})
})
this.toggleSelection(a)
})
},
handleTypeSave() {
this.form.GlobalAssessTypes = this.selectedList.map(v => {
var o = this.form.GlobalAssessTypes.find(v1 => v1.DictionaryId === v.id)
if (o) {
return o
} else {
return {
DictionaryId: v.id,
ValueCN: v.raw.ValueCN,
Value: v.raw.Value,
IsBaseLineUse: false,
IsFollowVisitUse: false
}
}
})
this.config.visible = false
},
initForm() {
this.loading = true
getTrialConfigGlobalReadingInfo({ trialId: this.$route.query.trialId, TrialReadingCriterionId: this.TrialReadingCriterionId }).then(res => {
if (Object.keys(res.Result).length > 0) {
for (const k in res.Result) {
if (this.form.hasOwnProperty(k)) {
this.form[k] = res.Result[k]
}
}
this.isSign = res.Result.IsSign
}
this.form.GlobalAssessTypeIdsStr = this.form.GlobalAssessTypeIds.map(v => this.$fd('GlobalAssessType', v, 'id')).toString()
this.loading = false
}).catch(() => {
this.loading = false
})
},
handleSave(isPrompt) {
return new Promise((resolve, reject) => {
this.$refs['globalReadingForm'].validate((valid) => {
if (!valid) {
reject(false)
} else {
this.loading = true
// 保存配置信息
this.form.TrialId = this.$route.query.trialId
this.form.TrialReadingCriterionId = this.TrialReadingCriterionId
var params = {
GlobalAssessList: this.form.GlobalAssessTypes,
TrialReadingCriterionId: this.TrialReadingCriterionId,
TrialId: this.$route.query.trialId
}
setGlobalReadingInfo(params).then(res => {
this.loading = false
if (res.IsSuccess && isPrompt) {
this.$message.success(this.$t('common:message:savedSuccessfully'))
}
resolve(true)
}).catch(_ => {
this.loading = false
reject(false)
})
}
})
})
}
}
}
</script>
<style scoped>
</style>