irc_web/.svn/pristine/11/11f0781f82cd012ebcb64f59ced...

230 lines
6.2 KiB
Plaintext

<template>
<div class="criterion-config">
<div class="search-form" style="display:flex;justify-content: space-between;">
<el-form :inline="true" size="mini" class="base-search-form">
<el-form-item label="阅片问题">
<el-input v-model="searchData.QuestionName" clearable style="width:120px;" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleReset">重置</el-button>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<div>
<el-button size="mini" type="primary" @click="handleAdd">添加</el-button>
</div>
</div>
<el-table
v-loading="loading"
height="400"
:data="list"
stripe
@sort-change="handleSortByColumn"
>
<el-table-column type="index" width="40" />
<el-table-column
prop="GroupName"
label="分组名称"
show-overflow-tooltip
/>
<el-table-column
prop="QuestionName"
label="阅片问题"
show-overflow-tooltip
/>
<el-table-column
prop="Type"
label="类型"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('Criterion_Question_Type',scope.row.Type) }}
</template>
</el-table-column>
<el-table-column
prop="TypeValue"
label="选项"
show-overflow-tooltip
min-width="110"
/>
<el-table-column
prop="ShowOrder"
label="序号"
min-width="70"
/>
<el-table-column
prop="IsRequired"
label="是否必填"
min-width="90"
>
<template slot-scope="scope">
{{ scope.row.IsRequired?'是':'否' }}
</template>
</el-table-column>
<el-table-column
prop="IsJudgeQuestion"
label="是否裁判问题"
>
<template slot-scope="scope">
{{ scope.row.IsJudgeQuestion?'是':'否' }}
</template>
</el-table-column>
<el-table-column
prop="ParentQuestionName"
label="父问题"
/>
<el-table-column
prop="ParentTriggerValue"
label="父问题触发值"
/>
<!-- <el-table-column
prop="IsEnable"
label="启用状态"
min-width="120"
>
<template slot-scope="scope">
{{ scope.row.IsEnable?'启用':'停用' }}
</template>
</el-table-column> -->
<el-table-column
prop=""
label="操作"
width="180"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-button
type="primary"
size="mini"
@click="handleEdit(scope.row)"
>
编辑
</el-button>
<el-button
type="danger"
size="mini"
@click="handleDelete(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination style="text-align: right;margin-top: 10px;" class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize" @pagination="getList" />
<el-dialog
v-if="addOrEdit.visible"
:visible.sync="addOrEdit.visible"
:close-on-click-modal="false"
:title="addOrEdit.title"
width="500px"
append-to-body
custom-class="base-dialog-wrapper"
>
<CriterionQuestionForm
ref="addOrEdit"
:data="rowData"
@close="addOrEdit.visible = false"
@getList="getList"
/>
</el-dialog>
</div>
</template>
<script>
import { getReadingQuestionTrialList, deleteReadingQuestionTrial } from '@/api/trials'
import Pagination from '@/components/Pagination'
import CriterionQuestionForm from './criterionQuestionForm'
const searchDataDefault = () => {
return {
QuestionName: '',
PageIndex: 1,
PageSize: 20
}
}
export default {
name: 'QcQuestions',
components: { Pagination, CriterionQuestionForm },
props: {
data: {
type: Object,
default() { return {} }
}
},
data() {
return {
searchData: searchDataDefault(),
list: [],
total: 0,
loading: false,
rowData: {},
addOrEdit: { visible: false, title: '' }
}
},
mounted() {
this.getList()
},
methods: {
getList() {
this.loading = true
this.searchData.ReadingQuestionCriterionTrialId = this.data.Id
getReadingQuestionTrialList(this.searchData).then(res => {
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
}).catch(() => { this.loading = false })
},
handleAdd() {
this.rowData = { ReadingQuestionCriterionTrialId: this.data.Id, Id: '' }
this.addOrEdit.title = '添加'
this.addOrEdit.visible = true
},
handleEdit(row) {
this.rowData = { ...row }
this.addOrEdit.title = '编辑'
this.addOrEdit.visible = true
},
handleDelete(row) {
this.$confirm('是否确认删除?', {
type: 'warning',
distinguishCancelAndClose: true
})
.then(() => {
this.loading = true
deleteReadingQuestionTrial(row.Id)
.then(res => {
this.loading = false
if (res.IsSuccess) {
this.getList()
this.$message.success('删除成功!')
}
}).catch(() => { this.loading = false })
})
},
// 查询
handleSearch() {
this.getList()
},
// 重置
handleReset() {
this.searchData = searchDataDefault()
this.getList()
},
// 排序
handleSortByColumn(column) {
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false
}
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
}
}
}
</script>