feat: 添加招生简介模块
This commit is contained in:
parent
77b76a2642
commit
74d86fdcd1
@ -67,7 +67,9 @@ const props = defineProps({
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const dialogVisible = ref(props.modelValue);
|
||||
const formData = reactive({});
|
||||
const formData = reactive({
|
||||
classes_sort: 1
|
||||
});
|
||||
|
||||
const uoloadData = ref({
|
||||
dirName: "Classes"
|
||||
|
@ -23,10 +23,6 @@
|
||||
<el-button type="primary" @click="addClassesDialogVisible = true"> 添加 </el-button>
|
||||
</el-col>
|
||||
|
||||
|
||||
<!-- 导出 -->
|
||||
<el-button icon="ElIconDocument" @click="exportExcel(params)">导出</el-button>
|
||||
|
||||
<!-- 导入 -->
|
||||
<el-upload class="upload-demo" :action="importExcel" :headers="headers" :on-success="handleExcelSuccess"
|
||||
:on-progress="uploadLoading" :on-error="closeUploadLoading" style="margin-left: 10px" :show-file-list="false">
|
||||
@ -36,6 +32,8 @@
|
||||
<!-- 下载导入模板 -->
|
||||
<el-button icon="ElIconDownload" @click="downloadTemplate()">下载导入模板</el-button>
|
||||
|
||||
<!-- 导出 -->
|
||||
<el-button icon="ElIconDocument" @click="exportExcel(params)">导出</el-button>
|
||||
|
||||
<!-- 下拉操作 -->
|
||||
<el-dropdown v-if="selectionData.length">
|
||||
@ -53,7 +51,7 @@
|
||||
</el-space>
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-loading="loading" :data="dataList" ref="tableRef" border highlight-current-row
|
||||
:onSelectionChange="data => (selectionData = data)" >
|
||||
:onSelectionChange="data => (selectionData = data)">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column prop="classes_name" width="200" label="班型名称" :show-overflow-tooltip="true"> </el-table-column>
|
||||
<el-table-column prop="classes_desc" width="300" label="班型简介" :show-overflow-tooltip="true"> </el-table-column>
|
||||
@ -72,6 +70,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination :total="total" v-model:page="params.page" v-model:limit="params.limit" @pagination="getList" />
|
||||
|
||||
<!-- 添加班型 -->
|
||||
<AddClassesDialog v-model="addClassesDialogVisible" :done="() => getList()"></AddClassesDialog>
|
||||
@ -83,7 +82,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { ArrowDown } from '@element-plus/icons-vue';
|
||||
import { ref, reactive,watch } from 'vue';
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { useLoginStore } from "~/store";
|
||||
import { getClassesList, editClasses, deleteClasses, exportExcel, downloadTemplate, importExcel } from '~/service/classes';
|
||||
import AddClassesDialog from './components/AddClassesDialog.vue';
|
||||
@ -111,8 +110,12 @@ const headers = {
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
|
||||
// 查询参数
|
||||
let total = ref()
|
||||
const params = reactive({
|
||||
page: 1,
|
||||
limit: 10,
|
||||
classes_name: "",
|
||||
|
||||
});
|
||||
@ -140,6 +143,7 @@ function getList() {
|
||||
[...document.getElementsByClassName('el-table__row--level-1')].map(item => { item.classList.remove('row1') })
|
||||
drag.value === false && (drag.value = createDraw(document.getElementsByClassName('el-table__row')[0].parentElement))
|
||||
})
|
||||
total.value = res.count
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
|
@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="添加招生简介" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row>
|
||||
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="标题" prop="enrol_intro_title">
|
||||
<el-input v-model='formData.enrol_intro_title' type="text" placeholder='请输入标题'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item :label-width="labelWidth" label="内容" prop="enrol_intro_content">
|
||||
<RichText v-model='formData.enrol_intro_content' :min-height='196'></RichText>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="handleAddClick(formRef)">添加</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { addEnrolIntro } from "~/service/enrol_intro";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
const store = useLoginStore();
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
const formRef = ref();
|
||||
const labelWidth = 90;
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const dialogVisible = ref(props.modelValue);
|
||||
const formData = reactive({});
|
||||
|
||||
const uoloadData = ref({
|
||||
dirName: "EnrolIntro"
|
||||
})
|
||||
|
||||
watch(props, (v) => {
|
||||
dialogVisible.value = v.modelValue;
|
||||
});
|
||||
|
||||
const rules = reactive({
|
||||
enrol_intro_title: [
|
||||
{
|
||||
required: true,
|
||||
message: '标题不能为空'
|
||||
}
|
||||
],
|
||||
enrol_intro_content: [
|
||||
{
|
||||
required: true,
|
||||
message: '内容不能为空'
|
||||
}
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
|
||||
// --基础方法
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
handleResetClick(formRef.value);
|
||||
dialogVisible.value = false;
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
const handleAddClick = async (formEl) => {
|
||||
console.log(formData);
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { code } = await addEnrolIntro(formData);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
@ -0,0 +1,70 @@
|
||||
<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="enrol_intro_title">
|
||||
<el-input v-model='formData.enrol_intro_title' type="text" placeholder='请输入标题'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item :label-width="labelWidth" label="内容" prop="enrol_intro_content">
|
||||
<RichText v-model='formData.enrol_intro_content' :min-height='196'></RichText>
|
||||
</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";
|
||||
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
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 = () => {
|
||||
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<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="12">
|
||||
<el-form-item :label-width="labelWidth" label="标题" prop="enrol_intro_title">
|
||||
<el-input v-model='formData.enrol_intro_title' type="text" placeholder='请输入标题'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item :label-width="labelWidth" label="内容" prop="enrol_intro_content">
|
||||
<RichText v-model='formData.enrol_intro_content' :min-height='196'></RichText>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="handleEditClick(formRef)">编辑</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { editEnrolIntro } from "~/service/enrol_intro";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
const store = useLoginStore();
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
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,
|
||||
});
|
||||
const uoloadData = ref({
|
||||
dirName: "EnrolIntro"
|
||||
})
|
||||
|
||||
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
const rules = reactive({
|
||||
enrol_intro_title: [
|
||||
{
|
||||
required: true,
|
||||
message: '标题不能为空'
|
||||
}
|
||||
],
|
||||
enrol_intro_content: [
|
||||
{
|
||||
required: true,
|
||||
message: '内容不能为空'
|
||||
}
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
const handleEditClick = async (formEl) => {
|
||||
console.log(formData.value);
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { code } = await editEnrolIntro(formData.value);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
167
src/pages/index/enrol/enrol_intro/index.vue
Normal file
167
src/pages/index/enrol/enrol_intro/index.vue
Normal file
@ -0,0 +1,167 @@
|
||||
<template>
|
||||
<!-- 面包屑 -->
|
||||
<el-breadcrumb>
|
||||
<el-breadcrumb-item>招生简介管理</el-breadcrumb-item>
|
||||
<el-breadcrumb-item to="/enrol_intro/list">招生简介列表</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索 -->
|
||||
<el-form inline :model="params">
|
||||
|
||||
|
||||
<el-form-item label="标题">
|
||||
<el-input v-model='params.enrol_intro_title' placeholder='请输入标题'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="tableRef.reload()" icon="ElIconSearch">
|
||||
搜索
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-space style="margin-bottom: 10px;">
|
||||
<!-- 添加招生简介 -->
|
||||
<el-col :span="1">
|
||||
<el-button type="primary" @click="addEnrolIntroDialogVisible = true"> 添加 </el-button>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
<!-- 下拉操作 -->
|
||||
<el-dropdown v-if="selectionData.length">
|
||||
<el-button type="primary">
|
||||
批量操作<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="handleDelete(selectionData)">
|
||||
批量删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
<!-- 数据表格 -->
|
||||
<DataTable ref="tableRef" style="width: 100%" :onSelectionChange="data => (selectionData = data)" :column="column"
|
||||
:params="params" :request="params => getEnrolIntroList(params)">
|
||||
|
||||
|
||||
<template #chaoz="scope">
|
||||
<el-space>
|
||||
<el-button size="small" @click="handleUpdate(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-dropdown @command="handleCommand">
|
||||
<el-button type="primary" size="small">
|
||||
更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item :command="{ type: 'detail', row: scope.row }">
|
||||
详情
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{ type: 'delete', row: scope.row }">
|
||||
删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
</template>
|
||||
</DataTable>
|
||||
|
||||
<!-- 添加招生简介 -->
|
||||
<AddEnrolIntroDialog v-model="addEnrolIntroDialogVisible" :done="() => tableRef.reload()"></AddEnrolIntroDialog>
|
||||
<!-- 编辑招生简介 -->
|
||||
<EditEnrolIntroDialog v-model="EditEnrolIntroDialogVisible" :data="EditEnrolIntroDialogRow"
|
||||
:done="() => tableRef.reload()"></EditEnrolIntroDialog>
|
||||
<!-- 招生简介详情 -->
|
||||
<DetailEnrolIntroDialog v-model="DetailEnrolIntroDialogVisible" :data="DetailEnrolIntroDialogRow">
|
||||
</DetailEnrolIntroDialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ArrowDown } from '@element-plus/icons-vue';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { useLoginStore } from "~/store";
|
||||
import { getEnrolIntroList, deleteEnrolIntro } from '~/service/enrol_intro';
|
||||
import AddEnrolIntroDialog from './components/AddEnrolIntroDialog.vue';
|
||||
import EditEnrolIntroDialog from './components/EditEnrolIntroDialog.vue';
|
||||
import DetailEnrolIntroDialog from './components/DetailEnrolIntroDialog.vue';
|
||||
|
||||
const tableRef = ref();
|
||||
const selectionData = ref([]);
|
||||
const store = useLoginStore();
|
||||
|
||||
const addEnrolIntroDialogVisible = ref(false);
|
||||
const EditEnrolIntroDialogVisible = ref(false);
|
||||
const EditEnrolIntroDialogRow = ref({});
|
||||
const DetailEnrolIntroDialogVisible = ref(false);
|
||||
const DetailEnrolIntroDialogRow = ref({});
|
||||
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
// 查询参数
|
||||
const params = reactive({
|
||||
enrol_intro_title: "",
|
||||
|
||||
});
|
||||
const column = [
|
||||
|
||||
{
|
||||
fixed: true,
|
||||
type: 'selection'
|
||||
},
|
||||
{
|
||||
prop: "enrol_intro_title",
|
||||
label: '标题',
|
||||
width: '350'
|
||||
},
|
||||
{
|
||||
label: '操作',
|
||||
prop: 'chaoz',
|
||||
width: '250',
|
||||
fixed: 'right',
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
const handleCommand = ({ type, row }) => {
|
||||
switch (type) {
|
||||
case "detail":
|
||||
handleDetail(row);
|
||||
break;
|
||||
case 'delete':
|
||||
handleDelete([row]);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// 删除数据
|
||||
const handleDelete = data => {
|
||||
ElMessageBox.confirm(`您确定要删除该招生简介吗?`).then(async () => {
|
||||
const res = await deleteEnrolIntro({
|
||||
enrol_intro_guid: data.map(v => v.enrol_intro_guid).join()
|
||||
});
|
||||
if (res) {
|
||||
tableRef.value.reload();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 修改
|
||||
function handleUpdate(row) {
|
||||
EditEnrolIntroDialogVisible.value = true
|
||||
EditEnrolIntroDialogRow.value = row
|
||||
}
|
||||
|
||||
// 详情
|
||||
function handleDetail(row) {
|
||||
DetailEnrolIntroDialogVisible.value = true
|
||||
DetailEnrolIntroDialogRow.value = row
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
56
src/service/enrol_intro.js
Normal file
56
src/service/enrol_intro.js
Normal file
@ -0,0 +1,56 @@
|
||||
import { api, downloadFile, createApiUrl} from '~/utils/axios';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取招生简介列表
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getEnrolIntroList(data) {
|
||||
return api.post('Enrol.EnrolIntro/getEnrolIntroList', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除招生简介
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function deleteEnrolIntro(data) {
|
||||
return api.post('Enrol.EnrolIntro/deleteEnrolIntro', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '删除失败'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加招生简介
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function addEnrolIntro(data) {
|
||||
return api.post('Enrol.EnrolIntro/addEnrolIntro', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '添加失败'
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑招生简介
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function editEnrolIntro(data) {
|
||||
return api.post('Enrol.EnrolIntro/editEnrolIntro', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '编辑失败'
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user