791 lines
34 KiB
Vue
791 lines
34 KiB
Vue
<template>
|
||
<el-form ref="tableQsForm" v-loading="loading" :model="form" size="small" :disabled="type === 'look'" :rules="rules"
|
||
label-width="130px">
|
||
<div class="base-dialog-body" style="height: 550px; display:flex;flex-direction: column;">
|
||
<div style="height: 150px;">
|
||
<!-- 类型 -->
|
||
<el-form-item :label="$t('trials:readingUnit:qsList:title:type')" prop="Type">
|
||
<el-select v-model="form.Type" @change="((val) => { qsTypeChange(val, form) })">
|
||
<el-option v-for="item of $d.Criterion_Question_Type"
|
||
v-show="item.value !== 'class' && item.value !== 'group' && item.value !== 'table' && item.value !== 'basicTable'"
|
||
:key="item.value" :value="item.value" :label="item.label" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 问题名称 -->
|
||
<el-form-item v-if="form.Type !== 'group'" :label="$t('trials:readingUnit:qsList:title:qsNameEn')"
|
||
prop="QuestionName" :rules="[
|
||
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
|
||
{ max: form.Type === 'summary' ? 300 : 100, message: `${this.$t('common:ruleMessage:maxLength')} ${form.Type === 'summary' ? 300 : 100}` }
|
||
]">
|
||
<el-input v-model="form.QuestionName" />
|
||
</el-form-item>
|
||
<!-- 问题名称(EN) -->
|
||
<el-form-item v-if="form.Type !== 'group'" :label="$t('trials:readingUnit:qsList:title:qsNameEn')"
|
||
prop="QuestionEnName" :rules="[
|
||
{ max: form.Type === 'summary' ? 300 : 100, message: `${this.$t('common:ruleMessage:maxLength')} ${form.Type === 'summary' ? 300 : 100}` }
|
||
]">
|
||
<el-input v-model="form.QuestionEnName" />
|
||
</el-form-item>
|
||
</div>
|
||
<div style="flex: 1;overflow-y:auto;">
|
||
<!-- 公有属性 -->
|
||
<el-divider content-position="left">{{ $t('trials:readingUnit:title:publicProperties') }}</el-divider>
|
||
<!-- 是否显示 -->
|
||
<el-form-item v-if="form.Type !== 'group'" :label="$t('trials:readingUnit:qsList:title:isShow')"
|
||
prop="ShowQuestion">
|
||
<el-radio-group v-model="form.ShowQuestion" @change="((val) => { isShowQuestionChange(val, form) })">
|
||
<el-radio v-for="item of $d.ShowQuestion" :key="`ShowQuestion${item.value}`" :label="item.value">
|
||
{{ item.label }}
|
||
</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
|
||
<!-- 显示时依赖父问题 -->
|
||
<el-form-item v-if="form.Type !== 'group' && form.ShowQuestion === 1"
|
||
:label="$t('trials:readingUnit:qsList:title:parentId')" prop="ParentId">
|
||
<el-select v-model="form.ParentId" clearable @change="((val) => { parentQuestionChange(val, form) })">
|
||
<el-option v-for="item of parentOptions" :key="`ParentId${item.QuestionId}`" :label="item.QuestionName"
|
||
:value="item.QuestionId" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 显示时依赖父问题触发值 -->
|
||
<el-form-item v-if="form.ParentId && form.ShowQuestion === 1"
|
||
:label="$t('trials:readingUnit:qsList:title:parentTriggerValueList')" prop="ParentTriggerValueList">
|
||
<el-select v-model="form.ParentTriggerValueList" clearable multiple>
|
||
<el-option v-for="item of parentTriggerValOptions" :key="item.id" :label="item.label"
|
||
:value="String(item.value)" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 是否必填 -->
|
||
<el-form-item
|
||
v-if="form.Type !== 'group' && form.Type !== 'table' && form.Type !== 'basicTable' && form.Type !== 'summary'"
|
||
:label="$t('trials:readingUnit:qsList:title:isRequired')" prop="IsRequired">
|
||
<el-radio-group v-model="form.IsRequired" :disabled="form.IsJudgeQuestion === true || form.ShowQuestion === 2"
|
||
@change="((val) => { isRequiredChange(val, form) })">
|
||
<el-radio v-for="item of $d.QuestionRequired" :key="`QuestionRequired${item.value}`" :label="item.value">
|
||
{{ item.label }}
|
||
</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<!-- 必填依赖父问题 -->
|
||
<el-form-item v-if="form.Type !== 'group' && form.IsRequired === 1"
|
||
:label="$t('trials:readingUnit:qsList:title:relevanceId')" prop="RelevanceId">
|
||
<el-select v-model="form.RelevanceId" clearable @change="((val) => { relevanceQuestionChange(val, form) })">
|
||
<el-option v-for="item of parentOptions" :key="`RelevanceId${item.QuestionId}`" :label="item.QuestionName"
|
||
:value="item.QuestionId" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 必填触发值 -->
|
||
<el-form-item v-if="form.RelevanceId && form.IsRequired === 1"
|
||
:label="$t('trials:readingUnit:qsList:title:relevanceValueList')" prop="RelevanceValueList">
|
||
<el-select v-model="form.RelevanceValueList" clearable multiple>
|
||
<el-option v-for="item of reParentTriggerValOptions" :key="item.id" :label="item.label"
|
||
:value="String(item.value)" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 导出标识 -->
|
||
<!-- <el-form-item
|
||
:label="$t('trials:readingUnit:qsList:title:ExportIdentification')" prop="ExportIdentification"
|
||
v-if="form.Type === 'radio' || form.Type === 'select' || form.Type === 'input' || form.Type === 'textarea' || form.Type === 'number' || form.Type === 'class' || form.Type === 'calculation'"
|
||
>
|
||
<el-radio-group
|
||
v-model="form.ExportIdentification"
|
||
@change="
|
||
(val) => {
|
||
form.ExportResult = []
|
||
}
|
||
"
|
||
>
|
||
<el-radio
|
||
v-for="item of $d.ExportIdentification"
|
||
:key="`ExportIdentification${item.value}`"
|
||
:label="item.value"
|
||
>{{ item.label }}
|
||
</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item> -->
|
||
<!-- 导出结果 -->
|
||
<el-form-item :label="$t('trials:readingUnit:qsList:title:ExportResult')"
|
||
v-if="form.Type === 'radio' || form.Type === 'select' || form.Type === 'input' || form.Type === 'textarea' || form.Type === 'number' || form.Type === 'class' || form.Type === 'calculation'">
|
||
<el-select v-model="form.ExportResult" multiple>
|
||
<el-option v-for="item in CriterionDictionaryList.ExportResult" :key="`ExportResult${item.value}`"
|
||
:value="parseInt(item.Code)" :label="$i18n.locale === 'zh' ? item.ValueCN : item.Value">
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 限制编辑 -->
|
||
<el-form-item :label="$t('trials:readingUnit:qsList:title:limitEdit')" v-if="form.Type !== 'summary'"
|
||
prop="LimitEdit" :rules="[
|
||
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
|
||
]">
|
||
<el-radio-group v-model="form.LimitEdit">
|
||
<el-radio v-for="item of $d.LimitEdit" :key="item.value" :label="item.value">{{ item.label }}</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<!-- 问题标识 -->
|
||
<el-form-item v-if="form.Type !== 'group' && form.Type !== 'summary'"
|
||
:label="$t('dictionary:template:criterionConfig:table:questionMark')" prop="QuestionMark">
|
||
<el-select v-model="form.QuestionMark" clearable>
|
||
<el-option v-for="item of CriterionDictionaryList.QuestionMark" :key="item.Id" :value="parseInt(item.Code)"
|
||
:label="$i18n.locale === 'zh' ? item.ValueCN : item.Value" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 注释 -->
|
||
<el-form-item :label="$t('trials:readingUnit:qsList:title:Remark')" prop="Remark">
|
||
<el-input v-model="form.Remark" />
|
||
</el-form-item>
|
||
<!-- 序号 -->
|
||
<el-form-item :label="$t('trials:readingUnit:qsList:title:order')" prop="ShowOrder" :rules="[
|
||
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
|
||
]">
|
||
<el-input-number v-model="form.ShowOrder" controls-position="right" :min="0" />
|
||
</el-form-item>
|
||
<!-- 重复出现最大次数 -->
|
||
<el-form-item :label="$t('dictionary:template:criterionConfig:table:maxRowCount')"
|
||
v-if="form.Type !== 'summary' && form.Type !== 'screenshot' && form.Type !== 'upload'">
|
||
<el-input-number v-model="form.MaxRowCount" controls-position="right" :min="0" :max="10" />
|
||
</el-form-item>
|
||
<!-- 问题分类 -->
|
||
<el-form-item :label="$t('dictionary:template:criterionConfig:table:questionClassify')"
|
||
v-if="criterionType === 2">
|
||
<el-select v-model="form.QuestionClassify" clearable>
|
||
<el-option v-for="item of $d.QuestionClassify" :key="item.id" :label="item.label" :value="item.value" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 私有属性 -->
|
||
<el-divider content-position="left">{{ $t('trials:readingUnit:title:privateProperties') }}</el-divider>
|
||
<!-- 下拉框单选或多选 -->
|
||
<el-form-item v-if="form.Type === 'select'" :label="$t('trials:readingUnit:qsList:title:MultipleSelect')"
|
||
prop="OptionTypeEnum" :rules="[
|
||
{ required: true, message: this.$t('common:ruleMessage:specify') }
|
||
]">
|
||
<el-radio-group v-model="form.OptionTypeEnum">
|
||
<el-radio v-for="item of $d.OptionType" :key="item.id" :label="item.value">
|
||
{{ item.label }}
|
||
</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<!-- 选项类型 -->
|
||
<el-form-item v-if="form.Type === 'select' || form.Type === 'radio' || form.Type === 'input'"
|
||
:label="$t('trials:readingUnit:label:QuestionGenre')" prop="TableQuestionType" :rules="[
|
||
{ required: form.Type !== 'input', message: this.$t('common:ruleMessage:select') }
|
||
]">
|
||
<el-radio-group v-model="form.TableQuestionType" @change="((val) => { tableQuestionTypeChange(val, form) })">
|
||
<el-radio v-for="item of $d.TableQuestionType" :key="item.id" :label="item.value"
|
||
:disabled="(form.Type === 'radio' && (item.value === 1 || item.value === 2)) || (form.Type === 'input' && (item.value === 0 || item.value === 3))">
|
||
{{ item.label }}
|
||
</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<!-- 选项 -->
|
||
<el-form-item v-if="form.TableQuestionType === 0 || form.Type === 'class'"
|
||
:label="$t('trials:qcCfg:table:typeValue')" prop="TypeValue">
|
||
<el-input v-model="form.TypeValue" :placeholder="$t('trials:qcCfg:message:typeValue')"
|
||
@change="typeValueChange" />
|
||
</el-form-item>
|
||
<!-- 关联问题 -->
|
||
<el-form-item v-if="form.TableQuestionType === 2"
|
||
:label="$t('dictionary:template:criterionConfig:table:dependParentId')" prop="DependParentId">
|
||
<el-select v-model="form.DependParentId">
|
||
<el-option v-for="item of parentOptions" :key="`DependParentId${item.QuestionId}`"
|
||
:label="item.QuestionName" :value="item.QuestionId" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 关联字段 -->
|
||
<el-form-item v-if="form.TableQuestionType === 1 || !!form.DependParentId"
|
||
:label="$t('dictionary:template:criterionConfig:table:dataTableColumn')" prop="DataTableColumn">
|
||
<el-select v-model="form.DataTableColumn">
|
||
<el-option v-for="item of CriterionDictionaryList.OrganColumn" :key="item.Id"
|
||
:label="$i18n.locale === 'zh' ? item.ValueCN : item.Value" :value="item.Code" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 关联字典 -->
|
||
<el-form-item v-if="form.TableQuestionType === 3 || form.TableQuestionType === 2"
|
||
:label="$t('dictionary:template:criterionConfig:table:relatedDictionaryCode')" prop="DictionaryCode"
|
||
:rules="[{ required: form.TableQuestionType === 3, message: '请选择', trigger: 'blur' }]">
|
||
<el-select v-model="form.DictionaryCode">
|
||
<el-option v-for="item of dicList" :key="item.Id" :label="item.Code" :value="item.Code" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 默认值 -->
|
||
<el-form-item v-if="form.TableQuestionType === 3" :label="$t('trials:readingUnit:qsList:title:defaultValue')">
|
||
<el-select v-model="form.DefaultValue" clearable>
|
||
<!-- <el-option
|
||
v-for="item of form.DictionaryCode ? $d[form.DictionaryCode] : []"
|
||
:key="item.id"
|
||
:label="item.label"
|
||
:value="item.value.toString()"
|
||
/> -->
|
||
<el-option v-for="item of highlightAnswers" :key="item.Id"
|
||
:label="$i18n.locale === 'zh' ? item.ValueCN : item.Value" :value="item.Code" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 默认值 -->
|
||
<el-form-item v-if="form.TableQuestionType === 0" :label="$t('trials:readingUnit:qsList:title:defaultValue')">
|
||
<el-select v-model="form.DefaultValue" clearable>
|
||
<el-option v-for="item of form.TypeValue ? form.TypeValue.split('|') : []" :key="item" :label="item"
|
||
:value="item" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 高亮标记值 -->
|
||
<el-form-item v-if="form.Type === 'select' || form.Type === 'radio' || form.Type === 'calculation'"
|
||
:label="$t('trials:readingUnit:qsList:title:highlightAnswers')" prop="HighlightAnswerList">
|
||
<el-select v-model="form.HighlightAnswerList" clearable multiple>
|
||
<template v-if="form.TypeValue">
|
||
<el-option v-for="item of form.TypeValue.split('|')" :key="item" :label="item" :value="item" />
|
||
</template>
|
||
<template v-else-if="form.DictionaryCode">
|
||
<!-- <el-option
|
||
v-for="item of $d[form.DictionaryCode]"
|
||
:key="item.id"
|
||
:label="item.label"
|
||
:value="item.value.toString()"
|
||
/> -->
|
||
<el-option v-for="item of highlightAnswers" :key="item.Id"
|
||
:label="$i18n.locale === 'zh' ? item.ValueCN : item.Value" :value="item.Code" />
|
||
</template>
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 最大长度 -->
|
||
<el-form-item v-if="form.Type === 'input' || form.Type === 'textarea'"
|
||
:label="$t('trials:readingUnit:qsList:title:MaxAnswerLength')" prop="MaxAnswerLength" :rules="[
|
||
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
|
||
]">
|
||
<el-input-number v-model="form.MaxAnswerLength" :min="0"></el-input-number>
|
||
</el-form-item>
|
||
<!-- 是否复制前值 -->
|
||
<!-- <el-form-item
|
||
label="是否复制前值"
|
||
v-if="form.Type !== 'summary'"
|
||
prop="IsCopy"
|
||
:rules="[
|
||
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
|
||
]"
|
||
>
|
||
<el-switch
|
||
v-model="form.IsCopy"
|
||
/>
|
||
</el-form-item> -->
|
||
<!-- 数值类型 -->
|
||
<el-form-item v-if="form.Type === 'number' || form.Type === 'calculation'"
|
||
:label="$t('trials:readingUnit:qsList:title:valueType')" prop="ValueType" :rules="[
|
||
{ required: true, message: this.$t('common:ruleMessage:select') }
|
||
]">
|
||
<el-radio-group v-model="form.ValueType">
|
||
<el-radio v-for="item of $d.ValueType" :key="item.id" :label="item.value">
|
||
{{ item.label }}
|
||
</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
|
||
<!-- 单位 -->
|
||
<el-form-item v-if="form.Type === 'number' || form.Type === 'calculation'"
|
||
:label="$t('trials:readingUnit:qsList:title:unit')" prop="Unit" :rules="[
|
||
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
|
||
]">
|
||
<el-radio-group v-model="form.Unit">
|
||
<el-radio v-for="item of $d.ValueUnit" :key="item.id" :label="item.value">
|
||
{{ item.label }}
|
||
</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<!-- 图表展示-->
|
||
<el-form-item v-if="form.Type === 'number' || form.Type === 'calculation'"
|
||
:label="$t('trials:readingUnit:qsList:title:ShowChartTypeEnum')" prop="ShowChartTypeEnum">
|
||
<el-radio-group v-model="form.ShowChartTypeEnum">
|
||
<el-radio v-for="item of $d.ShowChartType" :key="item.id" :label="item.value">{{ item.label }}</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<!-- 最大上传个数 -->
|
||
<el-form-item v-if="form.Type === 'upload'" :label="$t('trials:readingUnit:qsList:title:imageCount')"
|
||
prop="ImageCount">
|
||
<el-input-number v-model="form.ImageCount" controls-position="right" :min="0" :max="10" />
|
||
</el-form-item>
|
||
<!-- 文件类型 -->
|
||
<el-form-item v-if="form.Type === 'upload'" :label="$t('trials:readingUnit:qsList:title:FileType')"
|
||
prop="FileType"
|
||
:rules="[{ type: 'array', required: true, message: this.$t('common:ruleMessage:specify'), trigger: ['change'] }]">
|
||
<el-checkbox-group v-model="form.FileType" @change="(v) => {
|
||
if (v && v.includes('-1')) {
|
||
form.FileType = ['-1']
|
||
}
|
||
}">
|
||
<el-checkbox v-for="item of $d.fileType" :key="`fileType${item.value}`" :value="item.value + ''"
|
||
:label="item.value" :disabled="form.FileType && form.FileType.includes('-1') && item.value !== '-1'">
|
||
{{ item.label }}
|
||
</el-checkbox>
|
||
</el-checkbox-group>
|
||
</el-form-item>
|
||
<!-- 分类 -->
|
||
<!-- 分类数据来源 -->
|
||
<el-form-item v-if="form.Type === 'class'"
|
||
:label="$t('dictionary:template:criterionConfig:table:classifyQuestion')" prop="ClassifyTableQuestionId">
|
||
<el-select v-model="form.ClassifyTableQuestionId" clearable>
|
||
<el-option v-for="item of Questions" :key="item.Id" :label="item.QuestionName" :value="item.Id" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 分类算法 -->
|
||
<el-form-item v-if="form.Type === 'class'"
|
||
:label="$t('dictionary:template:criterionConfig:table:classifyAlgorithms')" prop="ClassifyAlgorithms">
|
||
<div>
|
||
<el-table ref="CalculateTable" :data="ClassifyAlgorithmsList" style="margin: 10px;width: 100%" size="small">
|
||
<!-- 运算类型 -->
|
||
<el-table-column :label="$t('trials:readingUnit:label:label')" show-overflow-tooltip min-width="70">
|
||
<template slot-scope="scope">
|
||
{{ scope.row.label }}
|
||
</template>
|
||
</el-table-column>
|
||
<!-- 运算类型 -->
|
||
<el-table-column :label="$t('trials:readingUnit:label:gt')" show-overflow-tooltip min-width="128">
|
||
<template slot-scope="scope">
|
||
<el-input-number v-model="scope.row.gt"></el-input-number>
|
||
</template>
|
||
</el-table-column>
|
||
<!-- 运算类型 -->
|
||
<el-table-column :label="$t('trials:readingUnit:label:lt')" show-overflow-tooltip min-width="128">
|
||
<template slot-scope="scope">
|
||
<el-input-number v-model="scope.row.lt"></el-input-number>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</div>
|
||
</el-form-item>
|
||
</div>
|
||
</div>
|
||
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
|
||
<el-form-item>
|
||
<!-- 取消 -->
|
||
<el-button size="small" type="primary" @click="close">
|
||
{{ $t('common:button:cancel') }}
|
||
</el-button>
|
||
<!-- 保存 -->
|
||
<el-button size="small" type="primary" :disabled="type === 'look'" @click="save">
|
||
{{ $t('common:button:save') }}
|
||
</el-button>
|
||
</el-form-item>
|
||
</div>
|
||
</el-form>
|
||
</template>
|
||
<script>
|
||
import { addOrUpdateReadingTableQuestionSystem, getReadingTableOtherQuestionSystem } from '@/api/trials'
|
||
import { getBasicConfigSelect, getCriterionDictionaryList, getCriterionDictionary, getSystemCalculateTableQuestions } from '@/api/dictionary'
|
||
|
||
export default {
|
||
name: 'AddOrUpdateTableQs',
|
||
props: {
|
||
data: {
|
||
type: Object,
|
||
default() { return {} }
|
||
},
|
||
readingQuestionId: {
|
||
type: String,
|
||
required: true
|
||
},
|
||
criterionId: {
|
||
type: String,
|
||
required: true
|
||
},
|
||
criterionType: {
|
||
type: Number,
|
||
required: true
|
||
},
|
||
type: {
|
||
type: String,
|
||
required: true
|
||
}
|
||
},
|
||
|
||
data() {
|
||
var validateTypeVal = (rule, value, callback) => {
|
||
if (value === '') {
|
||
callback(new Error(this.$t('common:ruleMessage:specify')))
|
||
} else {
|
||
var arr = value.split('|')
|
||
if (new Set(arr).size !== arr.length) {
|
||
callback(new Error(this.$t('trials:readingUnit:qsList:message:msg0')))
|
||
} else {
|
||
callback()
|
||
}
|
||
}
|
||
}
|
||
return {
|
||
ClassifyAlgorithmsList: [],
|
||
form: {
|
||
Id: '',
|
||
ReadingQuestionId: '',
|
||
QuestionName: '',
|
||
QuestionEnName: '',
|
||
Type: 'select',
|
||
TypeValue: '',
|
||
ValueType: '',
|
||
Unit: '',
|
||
ParentId: '',
|
||
ParentTriggerValue: '',
|
||
ShowOrder: 0,
|
||
ShowQuestion: 0,
|
||
IsRequired: 2,
|
||
Remark: '',
|
||
RelevanceId: '',
|
||
RelevanceValue: '',
|
||
RelevanceValueList: [],
|
||
ParentTriggerValueList: [],
|
||
DataTableName: '',
|
||
DataTableColumn: '',
|
||
DictionaryCode: '',
|
||
TableQuestionType: null,
|
||
MaxRowCount: null,
|
||
DependParentId: '',
|
||
QuestionMark: null,
|
||
LimitEdit: 0,
|
||
// GlobalReadingShowType: null,
|
||
QuestionClassify: null,
|
||
HighlightAnswerList: [],
|
||
MaxAnswerLength: null,
|
||
IsCopy: false,
|
||
FileType: [],
|
||
ImageCount: 0,
|
||
ClassifyTableQuestionId: null,
|
||
ClassifyAlgorithms: null,
|
||
// ExportIdentification: 0,
|
||
ExportResult: [],
|
||
DefaultValue: null,
|
||
ShowChartTypeEnum: 0,
|
||
OptionTypeEnum: 0
|
||
// IsEnable: true
|
||
},
|
||
rules: {
|
||
Type: [
|
||
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
|
||
],
|
||
// QuestionName: [{ required: true, message: '请注明', trigger: 'blur' },
|
||
// { max: 300, message: '最大长度为 300' }],
|
||
|
||
TypeValue: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
|
||
{ validator: validateTypeVal, trigger: 'blur' },
|
||
{ max: 200, message: `${this.$t('common:ruleMessage:maxLength')} 200` }],
|
||
ShowQuestion: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }],
|
||
IsRequired: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }],
|
||
ParentId: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }],
|
||
ParentTriggerValueList: [
|
||
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
|
||
],
|
||
RelevanceId: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }],
|
||
RelevanceValueList: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }],
|
||
DataTableName: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }],
|
||
DataTableColumn: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }],
|
||
// DictionaryCode: [{ required: true, message: '请选择', trigger: 'blur' }],
|
||
DependParentId: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }],
|
||
// ExportIdentification: [
|
||
// { required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' },
|
||
// ],
|
||
// ExportResult: [
|
||
// { required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' },
|
||
// ]
|
||
},
|
||
loading: false,
|
||
parentOptions: [],
|
||
parentTriggerValOptions: [],
|
||
reParentTriggerValOptions: [],
|
||
tblOptions: [],
|
||
colOptions: [],
|
||
dicList: [],
|
||
CriterionDictionaryList: [],
|
||
Questions: [],
|
||
highlightAnswers: []
|
||
}
|
||
},
|
||
watch: {
|
||
'form.DictionaryCode': {
|
||
deep: true,
|
||
immediate: true,
|
||
async handler(v, oldv) {
|
||
try {
|
||
if (!v) {
|
||
this.highlightAnswers = []
|
||
return
|
||
}
|
||
let res = await getCriterionDictionary({
|
||
ReadingCriterionId: this.criterionId,
|
||
DictionaryCode: this.form.DictionaryCode,
|
||
})
|
||
this.highlightAnswers = res.Result[this.form.DictionaryCode]
|
||
} catch (e) {
|
||
console.log(e)
|
||
}
|
||
},
|
||
},
|
||
},
|
||
mounted() {
|
||
this.initForm()
|
||
this.getCriterionDictionary()
|
||
this.getCalculateQuestions('number')
|
||
},
|
||
methods: {
|
||
typeValueChange(v) {
|
||
this.form.DefaultValue = null
|
||
var list = v.split('|')
|
||
this.form.ClassifyAlgorithms = null
|
||
var arr = Object.assign([], this.ClassifyAlgorithmsList)
|
||
this.ClassifyAlgorithmsList = list.map((res, i) => {
|
||
return {
|
||
label: res,
|
||
lt: arr[i] ? arr[i].lt : 0,
|
||
gt: arr[i] ? arr[i].gt : 0
|
||
}
|
||
})
|
||
},
|
||
getCalculateQuestions(type) {
|
||
getSystemCalculateTableQuestions({
|
||
questionId: this.readingQuestionId,
|
||
type: type
|
||
}).then(res => {
|
||
if (type === 'number') {
|
||
this.Questions = res.Result
|
||
}
|
||
})
|
||
},
|
||
getCriterionDictionary() {
|
||
getCriterionDictionary({
|
||
ReadingCriterionId: this.criterionId,
|
||
DictionaryCodeList: ['QuestionMark', 'OrganColumn', 'ExportResult']
|
||
}).then(res => {
|
||
this.CriterionDictionaryList = res.Result
|
||
})
|
||
},
|
||
async initForm() {
|
||
await this.getBasicConfigSelect()
|
||
await this.getParentQuestions()
|
||
if (Object.keys(this.data).length > 0) {
|
||
for (const k in this.form) {
|
||
if (this.data.hasOwnProperty(k)) {
|
||
if (k === 'ClassifyAlgorithms' && this.data[k] !== undefined && this.data[k] !== '') {
|
||
this.ClassifyAlgorithmsList = JSON.parse(this.data[k])
|
||
} else if (k === 'FileType') {
|
||
this.form[k] = this.data[k].split(',')
|
||
} else {
|
||
this.form[k] = this.data[k]
|
||
}
|
||
}
|
||
}
|
||
|
||
if (this.form.ParentId) {
|
||
var index = this.parentOptions.findIndex(item => {
|
||
return item.QuestionId === this.form.ParentId
|
||
})
|
||
if (index !== -1) {
|
||
if (this.parentOptions[index].QuestionGenre === 3) {
|
||
// this.parentTriggerValOptions = this.$d[this.parentOptions[index].DictionaryCode]
|
||
let dicCode = this.parentOptions[index].DictionaryCode
|
||
let res = await getCriterionDictionary({ ReadingCriterionId: this.criterionId, DictionaryCode: dicCode })
|
||
|
||
this.parentTriggerValOptions = res.Result[dicCode].map(i => {
|
||
return { id: i.Id, label: this.$i18n.locale === 'zh' ? i.ValueCN : i.Value, value: i.Code }
|
||
})
|
||
} else {
|
||
const options = []
|
||
this.parentOptions[index].TypeValue.split('|').forEach((item, index) => {
|
||
options.push({ id: index, label: item, value: item })
|
||
})
|
||
this.parentTriggerValOptions = options
|
||
}
|
||
}
|
||
}
|
||
if (this.form.RelevanceId) {
|
||
var i = this.parentOptions.findIndex(item => {
|
||
return item.QuestionId === this.form.RelevanceId
|
||
})
|
||
if (i !== -1) {
|
||
if (this.parentOptions[i].QuestionGenre === 3) {
|
||
// this.reParentTriggerValOptions = this.$d[this.parentOptions[i].DictionaryCode]
|
||
let dicCode = this.parentOptions[i].DictionaryCode
|
||
let res = await getCriterionDictionary({ ReadingCriterionId: this.criterionId, DictionaryCode: dicCode })
|
||
this.reParentTriggerValOptions = res.Result[dicCode].map(i => {
|
||
return { id: i.Id, label: this.$i18n.locale === 'zh' ? i.ValueCN : i.Value, value: i.Code }
|
||
})
|
||
} else {
|
||
const options = []
|
||
this.parentOptions[i].TypeValue.split('|').forEach((item, index) => {
|
||
options.push({ id: i, label: item, value: item })
|
||
})
|
||
this.reParentTriggerValOptions = options
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
save() {
|
||
this.$refs.tableQsForm.validate(valid => {
|
||
if (!valid) return
|
||
this.loading = true
|
||
this.form.ClassifyAlgorithms = JSON.stringify(this.ClassifyAlgorithmsList)
|
||
this.form.SystemCriterionId = this.criterionId
|
||
this.form.ReadingQuestionId = this.readingQuestionId
|
||
var params = Object.assign({}, this.form)
|
||
if (this.form.Type !== 'upload') {
|
||
this.form.ImageCount = 0
|
||
}
|
||
params.FileType = this.form.FileType.join(',')
|
||
addOrUpdateReadingTableQuestionSystem(params).then(res => {
|
||
this.$emit('getList')
|
||
this.loading = false
|
||
this.$emit('close')
|
||
this.$emit('reloadArbitrationRules')
|
||
|
||
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||
})
|
||
.catch(() => {
|
||
this.loading = false
|
||
})
|
||
})
|
||
},
|
||
getParentQuestions() {
|
||
return new Promise((resolve, reject) => {
|
||
this.loading = true
|
||
var param = {
|
||
readingQuestionId: this.readingQuestionId,
|
||
id: this.data.Id
|
||
}
|
||
getReadingTableOtherQuestionSystem(param).then(res => {
|
||
this.parentOptions = res.Result
|
||
this.loading = false
|
||
resolve()
|
||
}).catch(() => {
|
||
this.loading = false
|
||
reject()
|
||
})
|
||
})
|
||
},
|
||
getBasicConfigSelect() {
|
||
getCriterionDictionaryList({
|
||
CriterionId: this.criterionId,
|
||
SystemCriterionId: this.criterionId
|
||
}).then(res => {
|
||
this.dicList = res.Result
|
||
})
|
||
},
|
||
isShowQuestionChange(val, form) {
|
||
if (val === 2) {
|
||
form.IsRequired = 2
|
||
form.ParentId = ''
|
||
form.ParentTriggerValue = ''
|
||
} else {
|
||
form.ParentId = ''
|
||
form.ParentTriggerValue = ''
|
||
}
|
||
},
|
||
isRequiredChange(val, form) {
|
||
if (val !== 1) {
|
||
form.RelevanceId = ''
|
||
form.RelevanceValue = ''
|
||
}
|
||
},
|
||
async parentQuestionChange(val, form) {
|
||
if (val) {
|
||
var index = this.parentOptions.findIndex(item => {
|
||
return item.QuestionId === val
|
||
})
|
||
if (index !== -1) {
|
||
if (this.parentOptions[index].QuestionGenre === 3) {
|
||
// this.parentTriggerValOptions = this.$d[this.parentOptions[index].DictionaryCode]
|
||
let dicCode = this.parentOptions[index].DictionaryCode
|
||
let res = await getCriterionDictionary({ ReadingCriterionId: this.criterionId, DictionaryCode: dicCode })
|
||
|
||
this.parentTriggerValOptions = res.Result[dicCode].map(i => {
|
||
return { id: i.Id, label: this.$i18n.locale === 'zh' ? i.ValueCN : i.Value, value: i.Code }
|
||
})
|
||
} else {
|
||
const options = []
|
||
this.parentOptions[index].TypeValue.split('|').forEach((item, index) => {
|
||
options.push({ id: index, label: item, value: item })
|
||
})
|
||
this.parentTriggerValOptions = options
|
||
}
|
||
}
|
||
}
|
||
form.ParentTriggerValue = ''
|
||
},
|
||
async relevanceQuestionChange(val, form) {
|
||
if (val) {
|
||
var index = this.parentOptions.findIndex(item => {
|
||
return item.QuestionId === val
|
||
})
|
||
if (index !== -1) {
|
||
if (this.parentOptions[index].QuestionGenre === 3) {
|
||
// this.reParentTriggerValOptions = this.$d[this.parentOptions[index].DictionaryCode]
|
||
let dicCode = this.parentOptions[index].DictionaryCode
|
||
let res = await getCriterionDictionary({ ReadingCriterionId: this.criterionId, DictionaryCode: dicCode })
|
||
|
||
this.reParentTriggerValOptions = res.Result[dicCode].map(i => {
|
||
return { id: i.Id, label: this.$i18n.locale === 'zh' ? i.ValueCN : i.Value, value: i.Code }
|
||
})
|
||
} else {
|
||
const options = []
|
||
this.parentOptions[index].TypeValue.split('|').forEach((item, index) => {
|
||
options.push({ id: index, label: item, value: item })
|
||
})
|
||
this.reParentTriggerValOptions = options
|
||
}
|
||
}
|
||
}
|
||
form.RelevanceValue = ''
|
||
},
|
||
tableQuestionTypeChange(val, form) {
|
||
form.DictionaryCode = ''
|
||
form.DataTableColumn = ''
|
||
form.DataTableName = ''
|
||
form.DependParentId = ''
|
||
form.TypeValue = ''
|
||
},
|
||
dataTableNameChange(val, form) {
|
||
if (val) {
|
||
var index = this.tblOptions.findIndex(item => {
|
||
return item.Id === val
|
||
})
|
||
if (index !== -1) {
|
||
this.colOptions = this.tblOptions[index].Columns
|
||
}
|
||
}
|
||
form.DataTableColumn = ''
|
||
},
|
||
qsTypeChange(val, form) {
|
||
if (val === 'number' || val === 'calculation') {
|
||
form.Unit = 0
|
||
} else {
|
||
form.Unit = null
|
||
}
|
||
if (val === 'input' || val === 'textarea') {
|
||
form.MaxAnswerLength = 500
|
||
} else {
|
||
form.MaxAnswerLength = null
|
||
}
|
||
form.TypeValue = ''
|
||
form.ValueType = ''
|
||
form.IsRequired = 2
|
||
form.TableQuestionType = null
|
||
form.DependParentId = ''
|
||
form.DataTableColumn = ''
|
||
form.DataTableName = ''
|
||
form.DictionaryCode = ''
|
||
form.MaxRowCount = null
|
||
form.QuestionClassify = null
|
||
form.HighlightAnswerList = []
|
||
form.IsCopy = false
|
||
form.FileType = []
|
||
form.ImageCount = null
|
||
form.ClassifyTableQuestionId = null
|
||
form.ClassifyAlgorithms = null
|
||
// form.ExportIdentification = 0
|
||
form.ExportResult = []
|
||
form.DefaultValue = null
|
||
form.ShowChartTypeEnum = 0
|
||
form.OptionTypeEnum = 0
|
||
},
|
||
close() {
|
||
this.$emit('close')
|
||
}
|
||
|
||
}
|
||
}
|
||
</script>
|
||
<style lang="scss" scoped></style>
|