irc_web/.svn/pristine/50/50882fa53d27b0f9ebd37646e0f...

151 lines
3.6 KiB
Plaintext

<template>
<div>
<el-table
v-loading="loading"
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="Code"
label="字典表名"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="Description"
label="描述"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="Description"
label="操作"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-button size="small" type="primary" :loading="btnLoading" @click="openChildren(scope.row)">
配置
</el-button>
</template>
</el-table-column>
</el-table>
<el-drawer
:title="drawer_cfg.title"
:append-to-body="true"
:modal-append-to-body="false"
:visible.sync="drawer_cfg.drawerChild"
direction="rtl"
size="80%"
>
<CriterionDictionaryConfig :criterionId="criterionId" :parentCode="drawer_cfg.title"></CriterionDictionaryConfig>
</el-drawer>
</div>
</template>
<script>
import { getAssessType, setAssessType, getCriterionDictionaryList } from '@/api/dictionary'
import CriterionDictionaryConfig from './CriterionDictionaryConfig'
export default {
props: {
criterionId: {
type: String,
required: true
}
},
components: {
CriterionDictionaryConfig
},
data() {
return {
list: [],
total: 0,
loading: false,
rowData: {},
activeName: '0',
addOrEdit: { visible: false, title: '' },
preview: { visible: false, title: 'eCRF预览' },
config: { visible: false, title: '全局配置' },
drawer_cfg: { drawerChild: false, parentId: '', title: '' },
selectedList: []
}
},
mounted() {
this.getList()
},
methods: {
openChildren(row) {
this.drawer_cfg = { drawerChild: true, title: row.Code, parent: row }
},
toggleSelection(rows) {
console.log(this.$refs.multipleTable)
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row);
});
} else {
this.$refs.multipleTable.clearSelection();
}
},
handleSelectionChange(val) {
this.selectedList = val
},
getList() {
this.loading = true
getCriterionDictionaryList({
CriterionId: this.criterionId,
}).then(res => {
this.loading = false
this.list = res.Result
console.log(this.$d.GlobalAssessType)
})
},
handleAdd() {
this.config.visible = true
this.$nextTick(() => {
var a = this.$d.GlobalAssessType.filter(v => {
return !!this.list.find(v1 => {
return v1.DictionaryId === v.id
})
})
this.toggleSelection(a)
})
},
handleSave() {
this.loading = true
var params = {
CriterionId: this.criterionId,
DictionaryIds: this.selectedList.map(v => v.id),
isSystemCriterion: true
}
setAssessType(params).then(res => {
this.loading = false
this.$message.success('保存成功')
this.config.visible = false
this.selectedList = []
this.getList()
}).catch(() => {
})
},
handleDelete() {
}
}
}
</script>
<style scoped>
>>>.el-form-item__content{
width: calc(100% - 110px);
}
</style>