fix: 修改招生问答
This commit is contained in:
parent
9183d26efa
commit
51e28181e4
@ -2,45 +2,39 @@
|
||||
<el-dialog v-model="props.modelValue" title="编辑招生问答" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row>
|
||||
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item :label-width="labelWidth" label="问题" prop="enrol_aq_question">
|
||||
<el-input v-model='formData.enrol_aq_question' type="textarea" :rows="5" placeholder='请输入问题'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item :label-width="labelWidth" label="答案" prop="enrol_aq_answer">
|
||||
<el-input v-model='formData.enrol_aq_answer' type="textarea" :rows="5" placeholder='请输入答案'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="排序" prop="enrol_aq_sort">
|
||||
<el-input-number v-model='formData.enrol_aq_sort' controls-position='right'></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否展示" prop="enrol_aq_status">
|
||||
<el-select v-model="formData.enrol_aq_status" clearable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in show_status"
|
||||
:key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="回答状态" prop="enrol_aq_answer_status">
|
||||
<el-select v-model="formData.enrol_aq_answer_status" clearable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in answer_status"
|
||||
:key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item :label-width="labelWidth" label="问题" prop="enrol_aq_question">
|
||||
<el-input disabled v-model='formData.enrol_aq_question' type="textarea" :rows="5"
|
||||
placeholder='请输入问题'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item :label-width="labelWidth" label="答案" prop="enrol_aq_answer">
|
||||
<el-input v-model='formData.enrol_aq_answer' type="textarea" :rows="5" placeholder='请输入答案'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item :label-width="labelWidth" label="排序" prop="enrol_aq_sort">
|
||||
<el-input-number v-model='formData.enrol_aq_sort' controls-position='right'></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否展示" prop="enrol_aq_status">
|
||||
<el-switch
|
||||
v-model="formData.enrol_aq_status"
|
||||
class="mt-2"
|
||||
inline-prompt
|
||||
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="回答状态" prop="enrol_aq_answer_status">
|
||||
<dict-tag :options='answer_status' :value='formData.enrol_aq_answer_status' />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
@ -55,7 +49,7 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { editEnrolAq , getDictionary } from "~/service/enrol_aq";
|
||||
import { editEnrolAq, getDictionary } from "~/service/enrol_aq";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务参数
|
||||
@ -64,20 +58,20 @@ import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const show_status = ref([]);
|
||||
async function get_show_status() {
|
||||
await getDictionary({ dictionary_value: 'show_status'}).then((res) => {
|
||||
show_status.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const answer_status = ref([]);
|
||||
async function get_answer_status() {
|
||||
await getDictionary({ dictionary_value: 'answer_status'}).then((res) => {
|
||||
answer_status.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const show_status = ref([]);
|
||||
async function get_show_status() {
|
||||
await getDictionary({ dictionary_value: 'show_status' }).then((res) => {
|
||||
show_status.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const answer_status = ref([]);
|
||||
async function get_answer_status() {
|
||||
await getDictionary({ dictionary_value: 'answer_status' }).then((res) => {
|
||||
answer_status.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,15 +101,15 @@ const uoloadData = ref({
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_show_status()
|
||||
get_answer_status()
|
||||
|
||||
get_answer_status()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
@ -125,24 +119,24 @@ const closeDialog = () => {
|
||||
|
||||
const rules = reactive({
|
||||
enrol_aq_question: [
|
||||
{
|
||||
required: true,
|
||||
message: '问题不能为空'
|
||||
}
|
||||
],
|
||||
enrol_aq_answer: [
|
||||
{
|
||||
required: true,
|
||||
message: '答案不能为空'
|
||||
}
|
||||
],
|
||||
enrol_aq_sort: [
|
||||
{
|
||||
required: true,
|
||||
message: '排序不能为空'
|
||||
}
|
||||
],
|
||||
|
||||
{
|
||||
required: true,
|
||||
message: '问题不能为空'
|
||||
}
|
||||
],
|
||||
enrol_aq_answer: [
|
||||
{
|
||||
required: true,
|
||||
message: '答案不能为空'
|
||||
}
|
||||
],
|
||||
enrol_aq_sort: [
|
||||
{
|
||||
required: true,
|
||||
message: '排序不能为空'
|
||||
}
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
const handleEditClick = async (formEl) => {
|
||||
@ -152,7 +146,7 @@ const handleEditClick = async (formEl) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const { code } = await editEnrolAq(formData.value);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
@ -166,6 +160,4 @@ const handleResetClick = async (formEl) => {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
@ -57,9 +57,20 @@
|
||||
<DataTable ref="tableRef" style="width: 100%" :onSelectionChange="data => (selectionData = data)" :column="column"
|
||||
:params="params" :request="params => getEnrolAqList(params)">
|
||||
|
||||
<template #enrol_aq_sort="scope">
|
||||
<el-input-number :disabled="loading" v-model='scope.row.enrol_aq_sort' controls-position="right"
|
||||
@change="handleEditOrder(scope.row)"></el-input-number>
|
||||
</template>
|
||||
|
||||
<template #enrol_aq_status='scope'>
|
||||
<dict-tag :options='show_status' :value='scope.row.enrol_aq_status' />
|
||||
<el-switch
|
||||
v-model="scope.row.enrol_aq_status"
|
||||
class="mt-2"
|
||||
inline-prompt
|
||||
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
||||
@change="handleEditShow(scope.row)"
|
||||
/>
|
||||
<!-- <dict-tag :options='show_status' :value='scope.row.enrol_aq_status' /> -->
|
||||
</template>
|
||||
|
||||
<template #enrol_aq_answer_status='scope'>
|
||||
@ -102,7 +113,7 @@
|
||||
import { ArrowDown } from '@element-plus/icons-vue';
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { useLoginStore } from "~/store";
|
||||
import { getEnrolAqList, deleteEnrolAq, getDictionary, exportExcel } from '~/service/enrol_aq';
|
||||
import { getEnrolAqList, editEnrolAq,deleteEnrolAq, getDictionary, exportExcel } from '~/service/enrol_aq';
|
||||
import AddEnrolAqDialog from './components/AddEnrolAqDialog.vue';
|
||||
import EditEnrolAqDialog from './components/EditEnrolAqDialog.vue';
|
||||
import DetailEnrolAqDialog from './components/DetailEnrolAqDialog.vue';
|
||||
@ -150,20 +161,18 @@ const column = [
|
||||
{
|
||||
prop: "enrol_aq_sort",
|
||||
label: '排序',
|
||||
width: '150',
|
||||
width: '200',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
prop: "enrol_aq_status",
|
||||
label: '是否展示',
|
||||
width: '150',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
prop: "enrol_aq_answer_status",
|
||||
label: '回答状态',
|
||||
width: '150',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: '操作',
|
||||
@ -209,7 +218,25 @@ function handleDetail(row) {
|
||||
DetailEnrolAqDialogRow.value = row
|
||||
}
|
||||
|
||||
//排序
|
||||
const loading = ref(false)
|
||||
async function handleEditOrder(data) {
|
||||
loading.value = true
|
||||
const { code } = await editEnrolAq(data);
|
||||
if (code == 0) {
|
||||
loading.value = false
|
||||
tableRef.value.reload()
|
||||
}
|
||||
}
|
||||
|
||||
async function handleEditShow(data) {
|
||||
loading.value = true
|
||||
const { code } = await editEnrolAq(data);
|
||||
if (code == 0) {
|
||||
loading.value = false
|
||||
tableRef.value.reload()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 字典获取
|
||||
|
Loading…
Reference in New Issue
Block a user