|
@@ -11,6 +11,9 @@
|
|
|
:rules="rules"
|
|
|
:disabled="adding || editing"
|
|
|
>
|
|
|
+ <template #form-item-setLevelRange>
|
|
|
+ <el-button class="m-l-base" type="primary" @click="setLevelRangeVisible = true">设置</el-button>
|
|
|
+ </template>
|
|
|
<template #form-item-expand>
|
|
|
<el-button type="primary" link @click="expand = !expand">高级设置</el-button>
|
|
|
</template>
|
|
@@ -20,15 +23,37 @@
|
|
|
</base-form>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
+ <base-dialog v-model="setLevelRangeVisible" title="档次设置">
|
|
|
+ <div class="level-list">
|
|
|
+ <div v-for="([start, end], index) in levelRanges" :key="index" class="flex items-center level-row">
|
|
|
+ <div class="m-r-base level-label">档次一({{ start }}~{{ end }})</div>
|
|
|
+ <div class="flex items-center level-input">
|
|
|
+ <el-input-number
|
|
|
+ v-model="levelRangeValues[index]"
|
|
|
+ class="m-r-mini"
|
|
|
+ size="small"
|
|
|
+ :controls="false"
|
|
|
+ ></el-input-number>
|
|
|
+ %
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <div class="flex justify-center">
|
|
|
+ <confirm-button @confirm="onSetLevelRangeSubmit" @cancel="setLevelRangeVisible = false"></confirm-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </base-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="SubjectAddQuestion">
|
|
|
/** 添加大题 */
|
|
|
import { computed, reactive, ref } from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
-import { ElCard, ElButton, ElMessage } from 'element-plus'
|
|
|
+import { ElCard, ElButton, ElMessage, ElInputNumber } from 'element-plus'
|
|
|
import { omit } from 'lodash-es'
|
|
|
import ConfirmButton from '@/components/common/ConfirmButton.vue'
|
|
|
+import BaseDialog from '@/components/element/BaseDialog.vue'
|
|
|
import BaseForm from '@/components/element/BaseForm.vue'
|
|
|
import useFetch from '@/hooks/useFetch'
|
|
|
import useForm from '@/hooks/useForm'
|
|
@@ -43,6 +68,18 @@ const props = defineProps<{ subjectCode: string; mainNumber?: number | string }>
|
|
|
|
|
|
const isEdit = !!props.mainNumber
|
|
|
|
|
|
+const levelRanges = [
|
|
|
+ [0, 2],
|
|
|
+ [3, 5],
|
|
|
+ [6, 8],
|
|
|
+ [9, 11],
|
|
|
+ [12, 14],
|
|
|
+]
|
|
|
+
|
|
|
+const levelRangeValues = ref<number[]>(Array.from({ length: 5 }))
|
|
|
+
|
|
|
+const setLevelRangeVisible = ref<boolean>(false)
|
|
|
+
|
|
|
const { fetch: getMainQuestionInfo, result: MainQuestionInfo } = useFetch('getMainQuestionInfo')
|
|
|
|
|
|
const { fetch: addMainQuestion, loading: adding } = useFetch('addMainQuestion')
|
|
@@ -194,9 +231,15 @@ const items = computed<EpFormItem[]>(() => [
|
|
|
'row-12'
|
|
|
),
|
|
|
Span6(
|
|
|
- { label: '档次抽查比例', slotType: 'input', prop: 'levelRange', slot: { placeholder: '档次抽查比例' } },
|
|
|
+ {
|
|
|
+ label: '档次抽查比例',
|
|
|
+ slotType: 'input',
|
|
|
+ prop: 'levelRange',
|
|
|
+ slot: { placeholder: '档次抽查比例', disabled: true },
|
|
|
+ },
|
|
|
'row-12'
|
|
|
),
|
|
|
+ Span6({ slotName: 'setLevelRange', labelWidth: '0px' }, 'row-12'),
|
|
|
Span6({ slotName: 'expand' }, 'expand'),
|
|
|
Span6({ slotName: 'operation' }, 'operation'),
|
|
|
])
|
|
@@ -207,6 +250,10 @@ if (isEdit) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const onSetLevelRangeSubmit = () => {
|
|
|
+ console.log('onSetLevelRangeSubmit')
|
|
|
+}
|
|
|
+
|
|
|
const onSubmit = async () => {
|
|
|
try {
|
|
|
const valid = await elFormRef?.value?.validate().catch((error: object) => {
|
|
@@ -231,4 +278,14 @@ const onCancel = () => {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped lang="scss"></style>
|
|
|
+<style scoped lang="scss">
|
|
|
+.level-list {
|
|
|
+ .level-row {
|
|
|
+ margin-bottom: 8px;
|
|
|
+ .level-label {
|
|
|
+ width: 100px;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|