提交代码
This commit is contained in:
1 parent
9a9014b35b
commit
3d080104ac
5 files changed
+1434
-148
No files matched your search
@@ -0,0 +1,356 @@
|
||||
<template>
|
||||
<div class="p-2 page-container">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="sc_showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="sc_queryFormRef" :model="sc_queryParams" :inline="true">
|
||||
<!-- <el-form-item label="删除标志" prop="deleted">
|
||||
<el-select v-model="queryParams.deleted" placeholder="请选择删除标志" clearable>
|
||||
<el-option v-for="dict in sys_item_delete" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="分类编码" prop="categoryCode">
|
||||
<el-input v-model="sc_queryParams.categoryCode" placeholder="请输入分类编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="categoryName">
|
||||
<el-input v-model="sc_queryParams.categoryName" placeholder="请输入分类名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="分类描述" prop="categoryDesc">
|
||||
<el-input v-model="sc_queryParams.categoryDesc" placeholder="请输入分类描述" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="排序" prop="sortOrder">
|
||||
<el-input v-model="sc_queryParams.sortOrder" placeholder="请输入排序" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="sc_queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option v-for="dict in sys_item_enable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never" class="button-card table-card">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['hq:satCategory:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="Edit" :disabled="sc_single" @click="handleUpdate()" v-hasPermi="['hq:satCategory:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="Delete" :disabled="sc_multiple" @click="handleDelete()" v-hasPermi="['hq:satCategory:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="Download" @click="handleExport" v-hasPermi="['hq:satCategory:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="sc_showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<div class="table-container">
|
||||
<el-table v-loading="sc_loading" border :data="sc_satCategoryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="主键ID" align="center" prop="id" v-if="true" /> -->
|
||||
<!-- <el-table-column label="删除标志" align="center" prop="deleted">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_item_delete" :value="scope.row.deleted"/>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="分类编码" align="center" prop="categoryCode" />
|
||||
<el-table-column label="分类名称" align="center" prop="categoryName" />
|
||||
<el-table-column label="分类描述" align="center" prop="categoryDesc" />
|
||||
<!-- <el-table-column label="排序" align="center" prop="sortOrder" /> -->
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_item_enable" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['hq:satCategory:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['hq:satCategory:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<pagination
|
||||
v-show="sc_total > 0"
|
||||
:total="sc_total"
|
||||
v-model:page="sc_queryParams.pageNum"
|
||||
v-model:limit="sc_queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- 添加或修改题目分类对话框 -->
|
||||
<el-dialog :title="sc_dialog.title" v-model="sc_dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="sc_satCategoryFormRef" :model="sc_form" :rules="sc_rules" label-width="80px">
|
||||
<!-- <el-form-item label="删除标志" prop="deleted">
|
||||
<el-select v-model="form.deleted" placeholder="请选择删除标志">
|
||||
<el-option v-for="dict in sys_item_delete" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="分类编码" prop="categoryCode">
|
||||
<el-input v-model="sc_form.categoryCode" placeholder="请输入分类编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="categoryName">
|
||||
<el-input v-model="sc_form.categoryName" placeholder="请输入分类名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类描述" prop="categoryDesc">
|
||||
<el-input v-model="sc_form.categoryDesc" type="textarea" resize="none" :autosize="false" :rows="4" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="排序" prop="sortOrder">
|
||||
<el-input v-model="sc_form.sortOrder" placeholder="请输入排序" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="sc_form.status" placeholder="请选择状态">
|
||||
<el-option v-for="dict in sys_item_enable" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="sc_form.remark" type="textarea" resize="none" :autosize="false" :rows="4" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="sc_buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SatCategory" lang="ts">
|
||||
import { ref, reactive, toRefs, getCurrentInstance, onMounted } from 'vue';
|
||||
import type { ComponentInternalInstance, ElFormInstance } from 'vue';
|
||||
import { listSatCategory, getSatCategory, delSatCategory, addSatCategory, updateSatCategory } from '@/api/hq/satCategory';
|
||||
import { SatCategoryVO, SatCategoryQuery, SatCategoryForm } from '@/api/hq/satCategory/types';
|
||||
|
||||
// 类型定义
|
||||
interface DialogOption {
|
||||
visible: boolean;
|
||||
title: string;
|
||||
}
|
||||
|
||||
interface PageData<T, Q> {
|
||||
form: T;
|
||||
queryParams: Q;
|
||||
rules: Record<string, any>;
|
||||
}
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { sys_item_enable, sys_item_delete } = toRefs<any>(proxy?.useDict('sys_item_enable', 'sys_item_delete'));
|
||||
|
||||
const sc_satCategoryList = ref<SatCategoryVO[]>([]);
|
||||
const sc_buttonLoading = ref(false);
|
||||
const sc_loading = ref(true);
|
||||
const sc_showSearch = ref(true);
|
||||
const sc_ids = ref<Array<string | number>>([]);
|
||||
const sc_single = ref(true);
|
||||
const sc_multiple = ref(true);
|
||||
const sc_total = ref(0);
|
||||
|
||||
const sc_queryFormRef = ref<ElFormInstance>();
|
||||
const sc_satCategoryFormRef = ref<ElFormInstance>();
|
||||
|
||||
const sc_dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const sc_initFormData: SatCategoryForm = {
|
||||
id: undefined,
|
||||
deleted: undefined,
|
||||
categoryCode: undefined,
|
||||
categoryName: undefined,
|
||||
categoryDesc: undefined,
|
||||
sortOrder: undefined,
|
||||
status: '0',
|
||||
remark: undefined
|
||||
};
|
||||
const sc_data = reactive<PageData<SatCategoryForm, SatCategoryQuery>>({
|
||||
form: { ...sc_initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deleted: undefined,
|
||||
categoryCode: undefined,
|
||||
categoryName: undefined,
|
||||
categoryDesc: undefined,
|
||||
sortOrder: undefined,
|
||||
status: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
|
||||
categoryCode: [{ required: true, message: '分类编码不能为空', trigger: 'blur' }],
|
||||
categoryName: [{ required: true, message: '分类名称不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams: sc_queryParams, form: sc_form, rules: sc_rules } = toRefs(sc_data);
|
||||
|
||||
/** 查询题目分类列表 */
|
||||
const getList = async () => {
|
||||
sc_loading.value = true;
|
||||
const res = await listSatCategory(sc_queryParams.value);
|
||||
sc_satCategoryList.value = res.rows;
|
||||
sc_total.value = res.total;
|
||||
sc_loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
sc_dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
sc_form.value = { ...sc_initFormData };
|
||||
sc_satCategoryFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
sc_queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
sc_queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: SatCategoryVO[]) => {
|
||||
sc_ids.value = selection.map((item) => item.id);
|
||||
sc_single.value = selection.length != 1;
|
||||
sc_multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
sc_dialog.visible = true;
|
||||
sc_dialog.title = '添加题目分类';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: SatCategoryVO) => {
|
||||
reset();
|
||||
const _id = row?.id || sc_ids.value[0];
|
||||
const res = await getSatCategory(_id);
|
||||
Object.assign(sc_form.value, res.data);
|
||||
sc_dialog.visible = true;
|
||||
sc_dialog.title = '修改题目分类';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
sc_satCategoryFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
sc_buttonLoading.value = true;
|
||||
if (sc_form.value.id) {
|
||||
await updateSatCategory(sc_form.value).finally(() => (sc_buttonLoading.value = false));
|
||||
} else {
|
||||
await addSatCategory(sc_form.value).finally(() => (sc_buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
sc_dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: SatCategoryVO) => {
|
||||
const _ids = row?.id || sc_ids.value;
|
||||
let confirmMessage = '';
|
||||
|
||||
if (row) {
|
||||
// 单个删除
|
||||
confirmMessage = `是否确认删除题目分类\"${row.categoryName}(${row.categoryCode})\"的数据项?\n\n【提示】本操作为逻辑删除,数据不会被物理移除,可在后台恢复。`;
|
||||
} else {
|
||||
// 批量删除
|
||||
const selectedRows = sc_satCategoryList.value.filter((item) => sc_ids.value.includes(item.id));
|
||||
if (selectedRows.length === 1) {
|
||||
confirmMessage = `是否确认删除题目分类\"${selectedRows[0].categoryName}(${selectedRows[0].categoryCode})\"的数据项?\n\n【提示】本操作为逻辑删除,数据不会被物理移除,可在后台恢复。`;
|
||||
} else {
|
||||
const categoryNames = selectedRows.map((item) => `${item.categoryName}(${item.categoryCode})`).join('、');
|
||||
confirmMessage = `是否确认删除题目分类\"${categoryNames}\"的数据项?\n\n【提示】本操作为逻辑删除,数据不会被物理移除,可在后台恢复。`;
|
||||
}
|
||||
}
|
||||
|
||||
await proxy?.$modal.confirm(confirmMessage).finally(() => (sc_loading.value = false));
|
||||
await delSatCategory(_ids);
|
||||
proxy?.$modal.msgSuccess('已逻辑删除');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'hq/satCategory/export',
|
||||
{
|
||||
...sc_queryParams.value
|
||||
},
|
||||
`satCategory_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 表格主体 */
|
||||
.table-container {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
.button-card :deep(.el-card__header) {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,738 @@
|
||||
<template>
|
||||
<div class="p-2 page-container">
|
||||
<transition :enter-active-class="sq_proxy?.animate.searchAnimate.enter" :leave-active-class="sq_proxy?.animate.searchAnimate.leave">
|
||||
<div ref="sq_searchRef" v-show="sq_showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="sq_queryFormRef" :model="sq_queryParams" :inline="true">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="题目标题" prop="questionTitle">
|
||||
<el-input v-model="sq_queryParams.questionTitle" placeholder="请输入题目标题" clearable @keyup.enter="sq_handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="所属分类" prop="categoryId">
|
||||
<el-select v-model="sq_queryParams.categoryId" placeholder="请选择所属分类" clearable @change="sq_handleQuery">
|
||||
<el-option v-for="category in sq_satCategoryList" :key="category.id" :label="category.categoryName" :value="category.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="题目类型" prop="questionType">
|
||||
<el-select v-model="sq_queryParams.questionType" placeholder="请选择题目类型" clearable>
|
||||
<el-option v-for="dict in sq_sys_question_category" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="sq_queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option v-for="dict in sq_sys_item_enable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" class="search-btn-container">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="sq_handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="sq_resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never" class="button-card table-card">
|
||||
<template #header>
|
||||
<el-row ref="sq_toolbarRef" :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="sq_handleAdd" v-hasPermi="['hq:satQuestion:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="Edit" :disabled="sq_single" @click="sq_handleUpdate()" v-hasPermi="['hq:satQuestion:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="Delete" :disabled="sq_multiple" @click="sq_handleDelete()" v-hasPermi="['hq:satQuestion:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="Download" @click="sq_handleExport" v-hasPermi="['hq:satQuestion:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch="sq_showSearch" @queryTable="sq_getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<div class="table-container">
|
||||
<el-table v-loading="sq_loading" border :data="sq_satQuestionList" @selection-change="sq_handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="题目标题" align="center" prop="questionTitle" width="200">
|
||||
<template #default="scope">
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="scope.row.questionTitle"
|
||||
placement="top"
|
||||
:show-after="100"
|
||||
:hide-after="100"
|
||||
popper-style="max-width: 300px; max-height: 200px;"
|
||||
>
|
||||
<div class="text-ellipsis">
|
||||
{{ scope.row.questionTitle }}
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所属分类" align="center" prop="categoryId">
|
||||
<template #default="scope">
|
||||
{{ sq_satCategoryAllList.find((cat) => cat.id == scope.row.categoryId)?.categoryName || '--' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分值" align="center" prop="score">
|
||||
<template #default="scope">
|
||||
{{ scope.row.score }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="题目类型" align="center" prop="questionType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sq_sys_question_category" :value="scope.row.questionType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否必填" align="center" prop="isRequired">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sq_sys_item_required" :value="scope.row.isRequired" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sq_sys_item_enable" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" width="200">
|
||||
<template #default="scope">
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="scope.row.remark"
|
||||
placement="top"
|
||||
:show-after="100"
|
||||
:hide-after="100"
|
||||
popper-style="max-width: 300px; max-height: 200px;"
|
||||
>
|
||||
<div class="text-ellipsis">
|
||||
{{ scope.row.remark }}
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="设置选项" placement="top" v-if="scope.row.questionType === '1' || scope.row.questionType === '2'">
|
||||
<el-button link type="success" icon="List" @click="sq_handleOptionManage(scope.row)" v-hasPermi="['hq:satOption:list']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="sq_handleUpdate(scope.row)" v-hasPermi="['hq:satQuestion:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="danger" icon="Delete" @click="sq_handleDelete(scope.row)" v-hasPermi="['hq:satQuestion:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="pagination-container">
|
||||
<pagination
|
||||
v-show="sq_total > 0"
|
||||
:total="sq_total"
|
||||
:page="sq_queryParams.pageNum"
|
||||
:limit="sq_queryParams.pageSize"
|
||||
@pagination="sq_getList"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 添加或修改题库对话框 -->
|
||||
<el-dialog :title="sq_dialog.title" v-model="sq_dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="sq_satQuestionFormRef" :model="sq_form" :rules="sq_rules" label-width="80px">
|
||||
<el-form-item label="题目标题" prop="questionTitle">
|
||||
<el-input v-model="sq_form.questionTitle" type="textarea" resize="none" :autosize="false" :rows="4" placeholder="请输入题目标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属分类" prop="categoryId">
|
||||
<el-select v-model="sq_form.categoryId" placeholder="请选择所属分类">
|
||||
<el-option v-for="category in sq_satCategoryList" :key="category.id" :label="category.categoryName" :value="category.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目类型" prop="questionType">
|
||||
<el-select v-model="sq_form.questionType" placeholder="请选择题目类型">
|
||||
<el-option v-for="dict in sq_sys_question_category" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否必填" prop="isRequired">
|
||||
<el-select v-model="sq_form.isRequired" placeholder="请选择是否必填">
|
||||
<el-option v-for="dict in sq_sys_item_required" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="sq_form.status" placeholder="请选择状态">
|
||||
<el-option v-for="dict in sq_sys_item_enable" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="sq_form.remark" type="textarea" resize="none" :autosize="false" :rows="4" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="sq_buttonLoading" type="primary" @click="sq_submitForm">确 定</el-button>
|
||||
<el-button @click="sq_cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 选项管理对话框 -->
|
||||
<el-dialog :title="`管理题目【${sq_optionDialog.question?.questionTitle}】的选项`" v-model="sq_optionDialog.visible" width="850px" append-to-body>
|
||||
<div>
|
||||
<el-button type="primary" icon="Plus" @click="sq_addOption" size="small" class="mb-2">新增选项</el-button>
|
||||
<el-button type="success" icon="Menu" @click="sq_addDefaultOptions" size="small" class="mb-2 ml-2">默认选项</el-button>
|
||||
<el-table :data="sq_optionDialog.options" border size="small">
|
||||
<el-table-column label="内容" prop="optionContent" width="295">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.optionContent" placeholder="请输入选项内容" size="small" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分值" prop="optionScore" width="150">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.optionScore" :min="0" :max="100" size="small" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" prop="optionOrder" width="150">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.optionOrder" :min="0" :max="99" size="small" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="默认" prop="isDefault" width="90">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.isDefault" active-value="Y" inactive-value="N" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="scope">
|
||||
<el-button icon="Delete" type="danger" size="small" @click="sq_removeOption(scope.$index)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="sq_saveOptions" :loading="sq_optionDialog.saveLoading">保存</el-button>
|
||||
<el-button @click="sq_optionDialog.visible = false">关闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SqSatQuestion" lang="ts">
|
||||
import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue';
|
||||
import { listSatQuestion, getSatQuestion, delSatQuestion, addSatQuestion, updateSatQuestion } from '@/api/hq/satQuestion';
|
||||
import { SatQuestionVO, SatQuestionQuery, SatQuestionForm } from '@/api/hq/satQuestion/types';
|
||||
import { listSatCategory, listAllSatCategory } from '@/api/hq/satCategory';
|
||||
import { SatCategoryVO } from '@/api/hq/satCategory/types';
|
||||
import { nextTick } from 'vue';
|
||||
import { listSatOption, addSatOption, updateSatOption, delSatOption } from '@/api/hq/satOption';
|
||||
|
||||
// 定义类型接口
|
||||
interface DialogOption {
|
||||
visible: boolean;
|
||||
title: string;
|
||||
}
|
||||
|
||||
interface PageData<T, Q> {
|
||||
form: T;
|
||||
queryParams: Q;
|
||||
rules: any;
|
||||
}
|
||||
|
||||
const { proxy: sq_proxy } = getCurrentInstance() as any;
|
||||
const {
|
||||
sys_question_category: sq_sys_question_category,
|
||||
sys_item_enable: sq_sys_item_enable,
|
||||
sys_item_required: sq_sys_item_required,
|
||||
sys_item_delete: sq_sys_item_delete
|
||||
} = toRefs<any>(sq_proxy?.useDict('sys_question_category', 'sys_item_enable', 'sys_item_required', 'sys_item_delete'));
|
||||
|
||||
const sq_satQuestionList = ref<SatQuestionVO[]>([]);
|
||||
const sq_satCategoryList = ref<SatCategoryVO[]>([]);
|
||||
const sq_satCategoryAllList = ref<SatCategoryVO[]>([]);
|
||||
const sq_buttonLoading = ref(false);
|
||||
const sq_loading = ref(true);
|
||||
const sq_showSearch = ref(true);
|
||||
const sq_ids = ref<Array<string | number>>([]);
|
||||
const sq_single = ref(true);
|
||||
const sq_multiple = ref(true);
|
||||
const sq_total = ref(0);
|
||||
|
||||
const sq_queryFormRef = ref<any>();
|
||||
const sq_satQuestionFormRef = ref<any>();
|
||||
|
||||
const sq_dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const sq_optionDialog = reactive({
|
||||
visible: false,
|
||||
question: null as SatQuestionVO | null,
|
||||
options: [] as any[],
|
||||
saveLoading: false
|
||||
});
|
||||
|
||||
const sq_initFormData: SatQuestionForm = {
|
||||
id: undefined,
|
||||
deleted: undefined,
|
||||
questionTitle: undefined,
|
||||
questionContent: undefined,
|
||||
categoryId: undefined,
|
||||
questionType: '1',
|
||||
isRequired: 1,
|
||||
sortOrder: undefined,
|
||||
status: '0',
|
||||
remark: undefined
|
||||
};
|
||||
|
||||
const sq_data = reactive<PageData<SatQuestionForm, SatQuestionQuery>>({
|
||||
form: { ...sq_initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deleted: undefined,
|
||||
questionTitle: undefined,
|
||||
questionContent: undefined,
|
||||
categoryId: undefined,
|
||||
questionType: undefined,
|
||||
isRequired: undefined,
|
||||
sortOrder: undefined,
|
||||
status: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
|
||||
questionTitle: [{ required: true, message: '题目标题不能为空', trigger: 'blur' }],
|
||||
categoryId: [{ required: true, message: '所属分类不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams: sq_queryParams, form: sq_form, rules: sq_rules } = toRefs(sq_data);
|
||||
|
||||
/** 查询题库列表 */
|
||||
const sq_getList = async () => {
|
||||
sq_loading.value = true;
|
||||
const res = await listSatQuestion(sq_queryParams.value);
|
||||
sq_satQuestionList.value = res.rows;
|
||||
sq_total.value = res.total;
|
||||
sq_loading.value = false;
|
||||
};
|
||||
|
||||
/** 获取分类列表 */
|
||||
const sq_getCategoryList = async () => {
|
||||
const res = await listSatCategory({
|
||||
pageNum: 1,
|
||||
pageSize: 1000,
|
||||
status: '0'
|
||||
});
|
||||
sq_satCategoryList.value = res.rows.sort((a, b) => a.sortOrder - b.sortOrder);
|
||||
};
|
||||
|
||||
/** 获取全部分类列表(包括已删除的) */
|
||||
const sq_getAllCategoryList = async () => {
|
||||
const res = await listAllSatCategory({
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
});
|
||||
sq_satCategoryAllList.value = res.data.sort((a, b) => a.sortOrder - b.sortOrder);
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const sq_cancel = () => {
|
||||
sq_reset();
|
||||
sq_dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const sq_reset = () => {
|
||||
sq_form.value = { ...sq_initFormData };
|
||||
sq_satQuestionFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const sq_handleQuery = () => {
|
||||
sq_queryParams.value.pageNum = 1;
|
||||
sq_getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const sq_resetQuery = () => {
|
||||
sq_queryFormRef.value?.resetFields();
|
||||
sq_handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const sq_handleSelectionChange = (selection: SatQuestionVO[]) => {
|
||||
sq_ids.value = selection.map((item) => item.id);
|
||||
sq_single.value = selection.length != 1;
|
||||
sq_multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const sq_handleAdd = () => {
|
||||
sq_reset();
|
||||
sq_dialog.visible = true;
|
||||
sq_dialog.title = '添加题库';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const sq_handleUpdate = async (row?: SatQuestionVO) => {
|
||||
sq_reset();
|
||||
const _id = row?.id || sq_ids.value[0];
|
||||
const res = await getSatQuestion(_id);
|
||||
Object.assign(sq_form.value, res.data);
|
||||
sq_dialog.visible = true;
|
||||
sq_dialog.title = '修改题库';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const sq_submitForm = () => {
|
||||
sq_satQuestionFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
sq_buttonLoading.value = true;
|
||||
if (sq_form.value.id) {
|
||||
await updateSatQuestion(sq_form.value).finally(() => (sq_buttonLoading.value = false));
|
||||
} else {
|
||||
await addSatQuestion(sq_form.value).finally(() => (sq_buttonLoading.value = false));
|
||||
}
|
||||
sq_proxy?.$modal.msgSuccess('操作成功');
|
||||
sq_dialog.visible = false;
|
||||
await sq_getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const sq_handleDelete = async (row?: SatQuestionVO) => {
|
||||
const _ids = row?.id || sq_ids.value;
|
||||
|
||||
let confirmMessage = '';
|
||||
if (row) {
|
||||
confirmMessage = `是否确认删除题目"${row.questionTitle}"?`;
|
||||
} else {
|
||||
confirmMessage = `是否确认删除选中的${sq_ids.value.length}个题目?`;
|
||||
}
|
||||
|
||||
await sq_proxy?.$modal.confirm(confirmMessage).finally(() => (sq_loading.value = false));
|
||||
await delSatQuestion(_ids);
|
||||
sq_proxy?.$modal.msgSuccess('删除成功');
|
||||
await sq_getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const sq_handleExport = () => {
|
||||
sq_proxy?.download(
|
||||
'hq/satQuestion/export',
|
||||
{
|
||||
...sq_queryParams.value
|
||||
},
|
||||
`satQuestion_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
const sq_toolbarRef = ref<HTMLElement>();
|
||||
const sq_searchRef = ref<HTMLElement>();
|
||||
|
||||
const sq_handleOptionManage = async (row: SatQuestionVO) => {
|
||||
sq_optionDialog.visible = true;
|
||||
sq_optionDialog.question = row;
|
||||
|
||||
sq_proxy?.$modal.loading('正在加载选项数据...');
|
||||
|
||||
try {
|
||||
const res = await listSatOption({
|
||||
questionId: row.id,
|
||||
pageNum: 1,
|
||||
pageSize: 100
|
||||
});
|
||||
|
||||
sq_optionDialog.options = res.rows.map((item) => ({
|
||||
id: item.id,
|
||||
questionId: item.questionId,
|
||||
optionContent: item.optionContent,
|
||||
optionScore: item.optionScore,
|
||||
optionOrder: item.optionOrder,
|
||||
isDefault: item.isDefault || 'N',
|
||||
tenantId: item.tenantId,
|
||||
createBy: item.createBy,
|
||||
createTime: item.createTime,
|
||||
updateBy: item.updateBy,
|
||||
updateTime: item.updateTime,
|
||||
deleted: item.deleted
|
||||
}));
|
||||
|
||||
sq_optionDialog.options.sort((a, b) => a.optionOrder - b.optionOrder);
|
||||
} catch (error) {
|
||||
console.error('加载选项失败:', error);
|
||||
sq_optionDialog.options = [];
|
||||
sq_proxy?.$modal.msgError('选项数据加载失败,请重试');
|
||||
} finally {
|
||||
sq_proxy?.$modal.closeLoading();
|
||||
}
|
||||
};
|
||||
|
||||
const sq_addOption = () => {
|
||||
sq_optionDialog.options.push({
|
||||
id: undefined,
|
||||
questionId: sq_optionDialog.question?.id,
|
||||
optionContent: '',
|
||||
optionScore: 0,
|
||||
optionOrder: sq_optionDialog.options.length + 1,
|
||||
isDefault: 'N',
|
||||
tenantId: '',
|
||||
createBy: '',
|
||||
createTime: '',
|
||||
updateBy: '',
|
||||
updateTime: '',
|
||||
deleted: '0'
|
||||
});
|
||||
nextTick(() => {
|
||||
// 可选:自动聚焦新行
|
||||
});
|
||||
};
|
||||
|
||||
const sq_addDefaultOptions = () => {
|
||||
const defaultOptions = [
|
||||
{
|
||||
optionContent: '非常满意',
|
||||
optionScore: 5,
|
||||
optionOrder: 0,
|
||||
isDefault: 'Y'
|
||||
},
|
||||
{
|
||||
optionContent: '满意',
|
||||
optionScore: 3,
|
||||
optionOrder: 1,
|
||||
isDefault: 'N'
|
||||
},
|
||||
{
|
||||
optionContent: '一般满意',
|
||||
optionScore: 1,
|
||||
optionOrder: 2,
|
||||
isDefault: 'N'
|
||||
},
|
||||
{
|
||||
optionContent: '不满意',
|
||||
optionScore: 0,
|
||||
optionOrder: 3,
|
||||
isDefault: 'N'
|
||||
}
|
||||
];
|
||||
|
||||
defaultOptions.forEach((option) => {
|
||||
sq_optionDialog.options.push({
|
||||
id: undefined,
|
||||
questionId: sq_optionDialog.question?.id,
|
||||
optionContent: option.optionContent,
|
||||
optionScore: option.optionScore,
|
||||
optionOrder: option.optionOrder,
|
||||
isDefault: option.isDefault,
|
||||
tenantId: '',
|
||||
createBy: '',
|
||||
createTime: '',
|
||||
updateBy: '',
|
||||
updateTime: '',
|
||||
deleted: '0'
|
||||
});
|
||||
});
|
||||
|
||||
sq_proxy?.$modal.msgSuccess('已添加默认选项');
|
||||
};
|
||||
|
||||
const sq_removeOption = (index: number) => {
|
||||
sq_optionDialog.options.splice(index, 1);
|
||||
};
|
||||
|
||||
const sq_saveOptions = async () => {
|
||||
if (!sq_optionDialog.question?.id) {
|
||||
sq_proxy?.$modal.msgError('题目ID不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
if (sq_optionDialog.saveLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
sq_optionDialog.saveLoading = true;
|
||||
sq_proxy?.$modal.loading('正在保存选项数据...');
|
||||
|
||||
try {
|
||||
const res = await listSatOption({
|
||||
questionId: sq_optionDialog.question.id,
|
||||
pageNum: 1,
|
||||
pageSize: 100
|
||||
});
|
||||
const existingOptions = res.rows || [];
|
||||
|
||||
const promises = [];
|
||||
|
||||
for (const option of sq_optionDialog.options) {
|
||||
if (!option.optionContent || option.optionContent.trim() === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
const params = {
|
||||
id: option.id,
|
||||
questionId: sq_optionDialog.question.id,
|
||||
optionContent: option.optionContent,
|
||||
optionScore: option.optionScore || 0,
|
||||
optionOrder: option.optionOrder || 1,
|
||||
status: '0',
|
||||
isDefault: option.isDefault || 'N'
|
||||
};
|
||||
|
||||
if (option.id) {
|
||||
promises.push(updateSatOption(params));
|
||||
} else {
|
||||
promises.push(addSatOption(params));
|
||||
}
|
||||
}
|
||||
|
||||
const currentOptionIds = sq_optionDialog.options.filter((opt) => opt.id).map((opt) => opt.id);
|
||||
const optionsToDelete = existingOptions.filter((opt) => !currentOptionIds.includes(opt.id)).map((opt) => opt.id);
|
||||
|
||||
if (optionsToDelete.length > 0) {
|
||||
promises.push(delSatOption(optionsToDelete));
|
||||
}
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
const validOptions = sq_optionDialog.options.filter((opt) => opt.optionContent && opt.optionContent.trim() !== '');
|
||||
let score = 0;
|
||||
|
||||
if (sq_optionDialog.question.questionType === '1') {
|
||||
score = Math.max(...validOptions.map((opt) => Number(opt.optionScore) || 0));
|
||||
} else if (sq_optionDialog.question.questionType === '2') {
|
||||
score = validOptions.reduce((sum, opt) => sum + (Number(opt.optionScore) || 0), 0);
|
||||
}
|
||||
|
||||
if (score > 0) {
|
||||
await updateSatQuestion({
|
||||
id: sq_optionDialog.question.id,
|
||||
categoryId: sq_optionDialog.question.categoryId,
|
||||
questionType: sq_optionDialog.question.questionType,
|
||||
isRequired: sq_optionDialog.question.isRequired,
|
||||
sortOrder: sq_optionDialog.question.sortOrder,
|
||||
status: sq_optionDialog.question.status,
|
||||
remark: sq_optionDialog.question.remark,
|
||||
questionTitle: sq_optionDialog.question.questionTitle,
|
||||
questionContent: sq_optionDialog.question.questionContent,
|
||||
score: score
|
||||
});
|
||||
}
|
||||
|
||||
await sq_getList();
|
||||
sq_proxy?.$modal.msgSuccess('保存成功');
|
||||
|
||||
const currentQuestion = { ...sq_optionDialog.question };
|
||||
|
||||
const optRes = await listSatOption({
|
||||
questionId: currentQuestion.id,
|
||||
pageNum: 1,
|
||||
pageSize: 100
|
||||
});
|
||||
|
||||
sq_optionDialog.options = optRes.rows.map((item) => ({
|
||||
id: item.id,
|
||||
questionId: item.questionId,
|
||||
optionContent: item.optionContent,
|
||||
optionScore: item.optionScore,
|
||||
optionOrder: item.optionOrder,
|
||||
isDefault: item.isDefault || 'N',
|
||||
tenantId: item.tenantId,
|
||||
createBy: item.createBy,
|
||||
createTime: item.createTime,
|
||||
updateBy: item.updateBy,
|
||||
updateTime: item.updateTime,
|
||||
deleted: item.deleted
|
||||
}));
|
||||
|
||||
sq_optionDialog.options.sort((a, b) => a.optionOrder - b.optionOrder);
|
||||
} catch (error) {
|
||||
console.error('保存选项失败:', error);
|
||||
sq_proxy?.$modal.msgError('保存失败,请重试');
|
||||
} finally {
|
||||
sq_proxy?.$modal.closeLoading();
|
||||
sq_optionDialog.saveLoading = false;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
sq_getList();
|
||||
sq_getCategoryList();
|
||||
sq_getAllCategoryList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 表格容器 */
|
||||
.table-container {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
.button-card :deep(.el-card__header) {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
/* 文字省略样式 */
|
||||
.text-ellipsis {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 200px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* 搜索按钮容器样式 */
|
||||
.search-btn-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.search-btn-container .el-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
/* 左边距类 */
|
||||
.ml-2 {
|
||||
margin-left: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -212,46 +212,46 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<el-dialog :title="`管理题目【${optionDialog.question?.questionTitle}】的选项`" v-model="optionDialog.visible" width="850px" append-to-body>
|
||||
<div>
|
||||
<el-button type="primary" icon="Plus" @click="addOption" size="small" class="mb-2">新增选项</el-button>
|
||||
<el-button type="success" icon="Menu" @click="addDefaultOptions" size="small" class="mb-2 ml-2">默认选项</el-button>
|
||||
<el-table :data="optionDialog.options" border size="small">
|
||||
<el-table-column label="内容" prop="optionContent" width="295">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.optionContent" placeholder="请输入选项内容" size="small" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分值" prop="optionScore" width="150">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.optionScore" :min="0" :max="100" size="small" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" prop="optionOrder" width="150">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.optionOrder" :min="0" :max="99" size="small" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="默认" prop="isDefault" width="90">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.isDefault" active-value="Y" inactive-value="N" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="scope">
|
||||
<el-button icon="Delete" type="danger" size="small" @click="removeOption(scope.$index)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="saveOptions" :loading="optionDialog.saveLoading">保存</el-button>
|
||||
<el-button @click="optionDialog.visible = false">关闭</el-button>
|
||||
<el-dialog :title="`管理题目【${optionDialog.question?.questionTitle}】的选项`" v-model="optionDialog.visible" width="850px" append-to-body>
|
||||
<div>
|
||||
<el-button type="primary" icon="Plus" @click="addOption" size="small" class="mb-2">新增选项</el-button>
|
||||
<el-button type="success" icon="Menu" @click="addDefaultOptions" size="small" class="mb-2 ml-2">默认选项</el-button>
|
||||
<el-table :data="optionDialog.options" border size="small">
|
||||
<el-table-column label="内容" prop="optionContent" width="295">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.optionContent" placeholder="请输入选项内容" size="small" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分值" prop="optionScore" width="150">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.optionScore" :min="0" :max="100" size="small" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" prop="optionOrder" width="150">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.optionOrder" :min="0" :max="99" size="small" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="默认" prop="isDefault" width="90">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.isDefault" active-value="Y" inactive-value="N" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="scope">
|
||||
<el-button icon="Delete" type="danger" size="small" @click="removeOption(scope.$index)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="saveOptions" :loading="optionDialog.saveLoading">保存</el-button>
|
||||
<el-button @click="optionDialog.visible = false">关闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SatQuestion" lang="ts">
|
||||
|
||||
Reference in new issue
Block a user