Files
irc_web/src/views/dictionary/template/components/TableQsList.vue
T
caiyiling 615580331b
continuous-integration/drone/push Build is passing
后台管理页面调整
2025-03-12 14:42:05 +08:00

359 lines
9.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div v-loading="loading">
<div
class="search-form"
style="text-align: right;"
>
<el-button
v-if="!isCompleteConfig"
size="mini"
type="primary"
@click="handleAdd"
>
{{$t('common:button:new')}}
</el-button>
</div>
<el-table
:data="list"
size="small"
height="500"
>
<!-- 序号 -->
<el-table-column
prop="ShowOrder"
:label="$t('trials:qcCfg:table:order')"
min-width="70"
/>
<!-- 问题名称 -->
<el-table-column
prop="QuestionName"
:label="$t('trials:readingUnit:qsList:title:qsName')"
show-overflow-tooltip
/>
<!-- 问题名称(EN) -->
<el-table-column
prop="QuestionEnName"
:label="$t('trials:readingUnit:qsList:title:qsNameEn')"
show-overflow-tooltip
/>
<!-- 类型 -->
<el-table-column
prop="Type"
:label="$t('trials:readingUnit:qsList:title:type')"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('Criterion_Question_Type',scope.row.Type) }}
</template>
</el-table-column>
<!-- <el-table-column
prop="TableQuestionType"
label="选项类型"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('TableQuestionType',scope.row.TableQuestionType) }}
</template>
</el-table-column>
<el-table-column
prop="TypeValue"
label="选项"
show-overflow-tooltip
min-width="110"
/>
-->
<!-- 是否显示 -->
<el-table-column
prop="ShowQuestion"
:label="$t('trials:readingUnit:qsList:title:isShow')"
min-width="90"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('ShowQuestion',scope.row.ShowQuestion) }}
</template>
</el-table-column>
<!-- 是否必填 -->
<el-table-column
prop="IsRequired"
:label="$t('trials:readingUnit:qsList:title:isRequired')"
min-width="90"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('QuestionRequired',scope.row.IsRequired) }}
</template>
</el-table-column>
<!-- <el-table-column
prop="IsJudgeQuestion"
label="是否裁判问题"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('YesOrNo',scope.row.IsJudgeQuestion) }}
</template>
</el-table-column> -->
<!-- <el-table-column
prop="ParentQuestionShowOrder"
label="显示依赖父问题"
min-width="90"
show-overflow-tooltip
/>
<el-table-column
prop="ParentTriggerValue"
label="显示触发值"
show-overflow-tooltip
/>
<el-table-column
prop="RelevanceShowOrder"
label="必填依赖父问题"
min-width="90"
show-overflow-tooltip
/>
<el-table-column
prop="RelevanceValue"
label="必填触发值"
show-overflow-tooltip
/> -->
<!-- 导出标识 -->
<!-- <el-table-column
prop="ExportIdentification"
:label="$t('trials:readingUnit:qsList:title:ExportIdentification')"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('ExportIdentification', scope.row.ExportIdentification) }}
</template>
</el-table-column> -->
<!-- 问题标识 -->
<el-table-column
prop="QuestionMark"
:label="$t('dictionary:template:criterionConfig:table:questionMark')"
width="140"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('QuestionMark', scope.row.QuestionMark) }}
</template>
</el-table-column>
<!-- 导出目标表格 -->
<el-table-column
prop="ExportResult"
:label="$t('trials:readingUnit:qsList:title:ExportResult')"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ getStringResult(scope.row.ExportResult, 'ExportResult') }}
</template>
</el-table-column>
<!-- 限制编辑 -->
<el-table-column
prop="LimitEdit"
:label="$t('trials:readingUnit:qsList:title:limitEdit')"
width="160"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('LimitEdit', scope.row.LimitEdit) }}
</template>
</el-table-column>
<!-- <el-table-column
prop="DependShowOrder"
label="关联问题"
show-overflow-tooltip
/>
<el-table-column
prop="DataTableColumn"
label="关联字段"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('OrganColumn',scope.row.DataTableColumn) }}
</template>
</el-table-column> -->
<!-- <el-table-column
prop="ImageCount"
label="最大上传个数"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ scope.row.Type === 'upload'?scope.row.ImageCount:'' }}
</template>
</el-table-column>
-->
<!-- 最大行数 -->
<el-table-column
prop="MaxRowCount"
:label="$t('trials:readingUnit:qsList:title:MaxRowCount')"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ scope.row.MaxRowCount?scope.row.MaxRowCount:'' }}
</template>
</el-table-column>
<el-table-column
prop=""
:label="$t('common:action:action')"
width="150"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-button
v-if="isCompleteConfig"
type="text"
@click="handleLook(scope.row)"
>
{{ $t('trials:readingPeriod:button:view') }}
</el-button>
<el-button
v-if="!isCompleteConfig"
type="text"
@click="handleEdit(scope.row)"
>
{{ $t('common:button:edit') }}
</el-button>
<el-button
v-if="!isCompleteConfig"
type="text"
@click="handleDelete(scope.row)"
>
{{ $t('common:button:delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
v-if="addOrEdit.visible"
:visible.sync="addOrEdit.visible"
:close-on-click-modal="false"
:title="addOrEdit.title"
width="650px"
append-to-body
custom-class="base-dialog-wrapper"
>
<TableQsForm
ref="addOrEdit"
:data="rowData"
:type="type"
:reading-question-id="readingQuestionId"
:criterion-id="criterionId"
:criterionType="criterionType"
@close="addOrEdit.visible = false"
@getList="getList"
/>
</el-dialog>
</div>
</template>
<script>
import { getReadingTableQuestionSystemList, deleteReadingTableQuestionSystem } from '@/api/trials'
import TableQsForm from './TableQsForm'
const searchDataDefault = () => {
return {
QuestionName: ''
}
}
export default {
name: 'TableQsList',
components: { TableQsForm },
props: {
readingQuestionId: {
type: String,
required: true
},
isCompleteConfig: {
type: Boolean,
required: true
},
criterionId: {
type: String,
required: true
},
criterionType: {
type: Number,
required: true
},
},
data() {
return {
searchData: searchDataDefault(),
list: [],
total: 0,
loading: false,
rowData: {},
addOrEdit: { visible: false, title: '' },
type: null
}
},
mounted() {
this.getList()
},
methods: {
handleLook(row) {
this.type = 'look'
this.rowData = { ...row }
this.addOrEdit.title = this.$t('common:button:edit')
this.addOrEdit.visible = true
},
getList() {
this.loading = true
getReadingTableQuestionSystemList({ readingQuestionId: this.readingQuestionId }).then(res => {
this.loading = false
this.list = res.Result
}).catch(() => { this.loading = false })
},
handleAdd() {
this.type = 'add'
this.rowData = {}
this.addOrEdit.title = this.$t('common:button:new')
this.addOrEdit.visible = true
},
handleEdit(row) {
this.type = 'edit'
this.rowData = { ...row }
this.addOrEdit.title = this.$t('common:button:edit')
this.addOrEdit.visible = true
},
handleDelete(row) {
this.$confirm(this.$t('trials:staffResearch:message:confirmDel'), {
type: 'warning',
distinguishCancelAndClose: true
})
.then(() => {
this.loading = true
deleteReadingTableQuestionSystem(row.Id)
.then(res => {
this.loading = false
if (res.IsSuccess) {
this.getList()
this.$message.success(this.$t('common:message:deletedSuccessfully'))
}
}).catch(() => { this.loading = false })
})
},
getStringResult(arr, dictionaryCode) {
let newArr = arr.map(i => this.$fd(dictionaryCode, i))
let delimiter = this.$i18n.locale === 'zh' ? '' : ', '
return newArr.join(delimiter)
},
// 查询
handleSearch() {
this.getList()
},
// 重置
handleReset() {
this.searchData = searchDataDefault()
this.getList()
}
}
}
</script>