irc_web/.svn/pristine/02/022be644b9457c9e927999fc97e...

223 lines
6.6 KiB
Plaintext

<template>
<box-content v-loading="loading">
<!-- 搜索框 -->
<div class="search">
<el-form :inline="true" size="mini" class="base-search-form">
<!-- 审核问题 -->
<el-form-item :label="$t('trials:qcCfg:table:questionName')">
<el-input v-model="searchData.QuestionName" clearable style="width:120px;" />
</el-form-item>
<!-- 语言类型 -->
<el-form-item
:label="$t('common:title:languageType')"
>
<el-select
v-model="searchData.LanguageType"
style="width:120px;"
clearable
>
<el-option
v-for="item of $d.LanguageType"
:key="item.value"
:value="item.value"
:label="item.label"
/>
</el-select>
</el-form-item>
<!-- 类型 -->
<el-form-item :label="$t('trials:qcCfg:table:type')">
<el-select v-model="searchData.Type" clearable style="width:120px;">
<el-option v-for="item of $d.QcType" :key="item.label" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<!-- 级别: -->
<el-form-item :label="$t('trials:qcCfg:table:level')">
<el-select v-model="searchData.IsDefeaultViewParent" clearable style="width:120px;">
<el-option v-for="item of $d.IsDefeaultViewParentLevel" :key="item.id" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">{{ $t('common:button:search') }}</el-button>
<el-button type="primary" @click="handleReset">{{ $t('common:button:reset') }}</el-button>
</el-form-item>
</el-form>
<span style="margin-left:auto">
<el-button type="primary" size="mini" :disabled="selectArr.length<=0" @click="handleSubmit">
{{ $t('common:button:submit') }}
</el-button>
</span>
</div>
<el-table
ref="qsList"
:data="list"
stripe
size="small"
height="400"
@selection-change="handleSelectChange"
@select="handleselect"
>
<el-table-column type="selection" align="left" width="45" :selectable="handleSelectTable" />
<!-- 序号 -->
<el-table-column
prop="ShowOrder"
:label="$t('trials:qcCfg:table:order')"
width="60"
/>
<!-- 审核问题 -->
<el-table-column
prop="QuestionName"
:label="$t('trials:qcCfg:table:questionName')"
show-overflow-tooltip
/>
<!-- 审核问题 -->
<el-table-column
prop="LanguageType"
:label="$t('common:title:languageType')"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('LanguageType', scope.row.LanguageType) }}
</template>
</el-table-column>
<!-- 类型 -->
<el-table-column
prop="Type"
:label="$t('trials:qcCfg:table:type')"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('QcType', scope.row.Type) }}
</template>
</el-table-column>
<!-- 选项 -->
<el-table-column
prop="TypeValue"
:label="$t('trials:qcCfg:table:typeValue')"
show-overflow-tooltip
min-width="110"
/>
<!-- 父问题 -->
<el-table-column
prop="ParentShowOrder"
:label="$t('trials:qcCfg:table:parentQs')"
show-overflow-tooltip
width="120"
/>
<!-- 父问题触发值 -->
<el-table-column
prop="ParentTriggerValue"
:label="$t('trials:qcCfg:table:parentTriggerValue')"
show-overflow-tooltip
/>
<!-- 是否必填 -->
<el-table-column
prop="IsRequired"
:label="$t('trials:qcCfg:table:isRequired')"
min-width="90"
>
<template slot-scope="scope">
{{ $fd('YesOrNo', scope.row.IsRequired) }}
</template>
</el-table-column>
<!-- 启用状态 -->
<el-table-column
prop="IsEnable"
:label="$t('trials:qcCfg:table:isEnable')"
min-width="120"
>
<template slot-scope="scope">
{{ $fd('YesOrNo', scope.row.IsEnable) }}
</template>
</el-table-column>
</el-table>
<Pagination style="margin-top: 10px" class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize" @pagination="getList" />
</box-content>
</template>
<script>
import { getQCQuestionConfigureList } from '@/api/dictionary'
import { batchAddTrialQCQuestionConfigure } from '@/api/trials'
import BoxContent from '@/components/BoxContent'
import Pagination from '@/components/Pagination'
const searchDataDefault = () => {
return {
Asc: true,
SortField: 'ShowOrder',
QuestionName: '',
LanguageType: null,
Type: '',
IsEnable: true,
IsDefeaultViewParent: false,
PageIndex: 1,
PageSize: 20
}
}
export default {
name: 'QcQuestions',
components: { BoxContent, Pagination },
data() {
return {
trialId: '',
searchData: searchDataDefault(),
list: [],
total: 0,
loading: false,
selectArr: []
}
},
mounted() {
this.trialId = this.$route.query.trialId
this.getList()
},
methods: {
// 获取受试者列表信息
getList() {
this.loading = true
this.searchData.TrialId = this.trialId
getQCQuestionConfigureList(this.searchData).then(res => {
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
}).catch(() => { this.loading = false })
},
handleSelectChange(val) {
this.selectArr = val
},
handleselect(selection, row) {
const selected = selection.length && selection.indexOf(row) !== -1
console.log(selection)
var arr = this.list.filter(i => i.ParentId === row.Id)
arr.map(item => {
this.$refs.qsList.toggleRowSelection(item, selected)
})
},
handleSubmit() {
this.loading = true
batchAddTrialQCQuestionConfigure(this.trialId, this.selectArr).then(res => {
this.loading = false
if (res.IsSuccess) {
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.$emit('getList')
this.$emit('close')
}
}).catch(() => { this.loading = false })
},
handleSelectTable(row) {
return !row.ParentId
},
// 查询
handleSearch() {
this.getList()
},
// 重置
handleReset() {
this.searchData = searchDataDefault()
this.getList()
}
}
}
</script>