irc_web/.svn/pristine/a5/a5c649ba1b3eba78c14a7d9938d...

176 lines
4.2 KiB
Plaintext

<template>
<div>
<el-table
v-loading="loading"
v-adaptive="{bottomOffset:0}"
height="100"
style="width: 100%"
:data="list"
stripe
>
<el-table-column
prop=""
label=""
width="50"
>
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
<!-- 中文值 -->
<el-table-column
prop="ValueCN"
:label="$t('trials:readingUnit:baseDataCfg:title:dictValCN')"
show-overflow-tooltip
/>
<!-- 英文值 -->
<el-table-column
prop="Value"
:label="$t('trials:readingUnit:baseDataCfg:title:dictValEN')"
show-overflow-tooltip
/>
<!-- 描述 -->
<el-table-column
prop="Description"
:label="$t('trials:readingUnit:baseDataCfg:title:dictValDesc')"
show-overflow-tooltip
/>
</el-table>
<el-dialog
v-if="config.visible"
:visible.sync="config.visible"
:close-on-click-modal="false"
:title="config.title"
width="90%"
append-to-body
>
<div>
<div style="text-align: right;">
<el-button
v-loading="loading"
size="mini"
type="primary"
@click="handleSave"
>
{{ $t('common:button:save') }}
</el-button>
</div>
<el-table
ref="multipleTable"
v-loading="loading"
v-adaptive="{bottomOffset:100}"
height="100"
:data="$d[parentCode]"
stripe
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
/>
<!-- 中文值 -->
<el-table-column
prop="raw.ValueCN"
:label="$t('trials:readingUnit:baseDataCfg:title:dictValCN')"
show-overflow-tooltip
/>
<!-- 英文值 -->
<el-table-column
prop="raw.Value"
:label="$t('trials:readingUnit:baseDataCfg:title:dictValEN')"
show-overflow-tooltip
/>
<!-- 描述 -->
<el-table-column
prop="raw.Description"
:label="$t('trials:readingUnit:baseDataCfg:title:dictValDesc')"
show-overflow-tooltip
/>
</el-table>
</div>
</el-dialog>
</div>
</template>
<script>
import { getAssessType, setCriterionDictionary, setDictionaryBaseLineUse, setDictionaryFollowVisitUse } from '@/api/dictionary'
export default {
props: {
criterionId: {
type: String,
required: true
},
parentCode: {
type: String,
required: true
}
},
data() {
return {
list: [],
total: 0,
loading: false,
rowData: {},
activeName: '0',
addOrEdit: { visible: false, title: '' },
config: { visible: false, title: this.$t('trials:readingUnit:baseDataCfg:title:dictVal') },
selectedList: []
}
},
mounted() {
this.getList()
},
methods: {
toggleSelection(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row)
})
} else {
this.$refs.multipleTable.clearSelection()
}
},
handleSelectionChange(val) {
this.selectedList = val
},
getList() {
this.loading = true
getAssessType({
TrialCriterionId: this.criterionId,
ParentCode: this.parentCode
}).then(res => {
this.loading = false
this.list = res.Result
})
},
handleSave() {
this.loading = true
var params = {
CriterionId: this.criterionId,
ParentCode: this.parentCode,
DictionaryIds: this.selectedList.map(v => v.id),
isSystemCriterion: true
}
setCriterionDictionary(params).then(res => {
this.loading = false
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.selectedList = []
this.getList()
this.$emit('getList')
}).catch(() => {
})
},
handleDelete() {
}
}
}
</script>
<style scoped>
>>>.el-form-item__content{
width: calc(100% - 110px);
}
</style>