100 lines
3.1 KiB
Vue
100 lines
3.1 KiB
Vue
<template>
|
|
<el-dialog v-model="props.modelValue" title="测试详情" width="900px" @closed="closeDialog" @open="openDialog">
|
|
<el-form ref="formRef" :model="formData" :disabled="true">
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="12">
|
|
<el-form-item :label-width="labelWidth" label="名称" prop="test_name">
|
|
<el-input v-model='formData.test_name' type="text" placeholder='请输入名称'></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span='12'>
|
|
<el-form-item :label-width='labelWidth' label='首页是否展示' prop='test_show_status'>
|
|
<el-switch
|
|
v-model='formData.test_show_status'
|
|
class='mt-2'
|
|
inline-prompt
|
|
:inactive-value=1
|
|
:active-value=2
|
|
style='--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949'
|
|
/>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :span='12'>
|
|
<el-form-item :label-width='labelWidth' label='评分' prop='test_score'>
|
|
<el-rate style='padding-top: 6px!important;' v-model='formData.test_score' allow-half />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
<el-form-item :label-width="labelWidth" label="排序" prop="test_sort">
|
|
<el-input-number v-model='formData.test_sort' controls-position='right' :min='1'></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
</el-form>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { reactive, ref, watch } from "vue";
|
|
import { isEmptyObject } from "~/utils/index";
|
|
import { getDictionary } from '~/service/test';
|
|
|
|
// --业务参数
|
|
|
|
|
|
|
|
// --业务方法
|
|
|
|
// 字典获取
|
|
const show_status = ref([]);
|
|
async function get_show_status() {
|
|
await getDictionary({ dictionary_value: 'show_status'}).then((res) => {
|
|
show_status.value = res
|
|
})
|
|
}
|
|
|
|
|
|
|
|
// --基础参数
|
|
const formRef = ref();
|
|
const labelWidth = 100;
|
|
|
|
const props = defineProps({
|
|
modelValue: Boolean,
|
|
data: Object,
|
|
done: Function,
|
|
});
|
|
const emits = defineEmits(["update:modelValue"]);
|
|
const formData = ref({
|
|
...props.data,
|
|
});
|
|
|
|
|
|
// --基础方法
|
|
watch(props, (v) => {
|
|
formData.value = v.data;
|
|
|
|
|
|
});
|
|
|
|
// 打开弹窗时执行
|
|
const openDialog = () => {
|
|
|
|
get_show_status()
|
|
|
|
};
|
|
|
|
const closeDialog = () => {
|
|
emits("update:modelValue", false);
|
|
};
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
|
|
</style>
|