feat:完成环境列表模块
This commit is contained in:
parent
fa6d04528d
commit
61c5a36768
@ -0,0 +1,167 @@
|
|||||||
|
<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="teaching_envir_type_guid">
|
||||||
|
<el-cascader class="w100" filterable :options="dataList"
|
||||||
|
:props="{ checkStrictly: false, value: 'teaching_envir_type_guid', label: 'teaching_envir_type_name', emitPath: false }"
|
||||||
|
placeholder="请选择作品类型" clearable v-model="formData.teaching_envir_type_guid">
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span>{{ data.teaching_envir_type_name }}</span>
|
||||||
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||||
|
</template>
|
||||||
|
</el-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境图片" prop="teaching_envir_img">
|
||||||
|
<UploadImage ref="uploadRef" v-model="formData.teaching_envir_img" :data="uoloadData" :limit="1" :fileSize="5"
|
||||||
|
:drag="true" :isShowTip="false" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境标题" prop="teaching_envir">
|
||||||
|
<el-input v-model="formData.teaching_envir" type="text" placeholder="请输入教学环境标题"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境简介" prop="teaching_envir_intro">
|
||||||
|
<el-input rows="5" v-model="formData.teaching_envir_intro" type="textarea" placeholder="请输入教学环境简介"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境详情" prop="teaching_envir_details">
|
||||||
|
<RichText v-model="formData.teaching_envir_details" :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 { addTeachingEnvir } from "~/service/teaching_envir";
|
||||||
|
import { getTeachingEnvirTypeList } from "~/service/teaching_envir_type";
|
||||||
|
import { useLoginStore } from "~/store";
|
||||||
|
|
||||||
|
// --业务参数
|
||||||
|
|
||||||
|
// --业务方法
|
||||||
|
const dataList = ref();
|
||||||
|
async function getList() {
|
||||||
|
getTeachingEnvirTypeList().then((res) => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
dataList.value = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// --基础参数
|
||||||
|
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: "TeachingEnvir",
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(props, (v) => {
|
||||||
|
dialogVisible.value = v.modelValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
teaching_envir: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "教学环境标题不能为空",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
teaching_envir_type_guid: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "教学环境类型不能为空",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
teaching_envir_img: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "教学环境图片不能为空",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
teaching_envir_intro: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "教学环境简介不能为空",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
teaching_envir_details: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "教学环境详情不能为空",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// --基础方法
|
||||||
|
|
||||||
|
// 打开弹窗时执行
|
||||||
|
const openDialog = () => {
|
||||||
|
getList()
|
||||||
|
};
|
||||||
|
|
||||||
|
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 addTeachingEnvir(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,95 @@
|
|||||||
|
<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="teaching_envir_type_guid">
|
||||||
|
<el-cascader class="w100" filterable :options="dataList"
|
||||||
|
:props="{ checkStrictly: false, value: 'teaching_envir_type_guid', label: 'teaching_envir_type_name', emitPath: false }"
|
||||||
|
placeholder="请选择作品类型" clearable v-model="formData.teaching_envir_type_guid">
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span>{{ data.teaching_envir_type_name }}</span>
|
||||||
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||||
|
</template>
|
||||||
|
</el-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境图片" prop="teaching_envir_img">
|
||||||
|
<UploadImage ref="uploadRef" v-model="formData.teaching_envir_img" :data="uoloadData" :limit="1" :fileSize="5"
|
||||||
|
:drag="true" :isShowTip="false" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境标题" prop="teaching_envir">
|
||||||
|
<el-input v-model="formData.teaching_envir" type="text" placeholder="请输入教学环境标题"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境简介" prop="teaching_envir_intro">
|
||||||
|
<el-input rows="5" v-model="formData.teaching_envir_intro" type="textarea" placeholder="请输入教学环境简介"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境详情" prop="teaching_envir_details">
|
||||||
|
<RichText v-model="formData.teaching_envir_details" :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 { getTeachingEnvirTypeList } from "~/service/teaching_envir_type";
|
||||||
|
import { isEmptyObject } from "~/utils/index";
|
||||||
|
|
||||||
|
// --业务参数
|
||||||
|
|
||||||
|
// --业务方法
|
||||||
|
const dataList = ref();
|
||||||
|
async function getList() {
|
||||||
|
getTeachingEnvirTypeList().then((res) => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
dataList.value = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// --基础参数
|
||||||
|
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 = () => {
|
||||||
|
getList()
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeDialog = () => {
|
||||||
|
emits("update:modelValue", false);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
@ -0,0 +1,157 @@
|
|||||||
|
<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="teaching_envir_type_guid">
|
||||||
|
<el-cascader class="w100" filterable :options="dataList"
|
||||||
|
:props="{ checkStrictly: false, value: 'teaching_envir_type_guid', label: 'teaching_envir_type_name', emitPath: false }"
|
||||||
|
placeholder="请选择作品类型" clearable v-model="formData.teaching_envir_type_guid">
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span>{{ data.teaching_envir_type_name }}</span>
|
||||||
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||||
|
</template>
|
||||||
|
</el-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境图片" prop="teaching_envir_img">
|
||||||
|
<UploadImage ref="uploadRef" v-model="formData.teaching_envir_img" :data="uoloadData" :limit="1" :fileSize="5"
|
||||||
|
:drag="true" :isShowTip="false" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境标题" prop="teaching_envir">
|
||||||
|
<el-input v-model="formData.teaching_envir" type="text" placeholder="请输入教学环境标题"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境简介" prop="teaching_envir_intro">
|
||||||
|
<el-input rows="5" v-model="formData.teaching_envir_intro" type="textarea" placeholder="请输入教学环境简介"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境详情" prop="teaching_envir_details">
|
||||||
|
<RichText v-model="formData.teaching_envir_details" :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 { editTeachingEnvir } from "~/service/teaching_envir";
|
||||||
|
import { getTeachingEnvirTypeList } from "~/service/teaching_envir_type";
|
||||||
|
import { useLoginStore } from "~/store";
|
||||||
|
|
||||||
|
// --业务参数
|
||||||
|
|
||||||
|
// --业务方法
|
||||||
|
const dataList = ref();
|
||||||
|
async function getList() {
|
||||||
|
getTeachingEnvirTypeList().then((res) => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
dataList.value = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// --基础参数
|
||||||
|
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: "TeachingEnvir",
|
||||||
|
});
|
||||||
|
|
||||||
|
// --基础方法
|
||||||
|
watch(props, (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 打开弹窗时执行
|
||||||
|
const openDialog = () => {
|
||||||
|
getList()
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeDialog = () => {
|
||||||
|
props.done();
|
||||||
|
emits("update:modelValue", false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
teaching_envir: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "教学环境标题不能为空",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
teaching_envir_img: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "教学环境图片不能为空",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
teaching_envir_intro: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "教学环境简介不能为空",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
teaching_envir_details: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "教学环境详情不能为空",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleEditClick = async (formEl) => {
|
||||||
|
console.log(formData.value);
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate(async (valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { code } = await editTeachingEnvir(formData.value);
|
||||||
|
if (code == 0) {
|
||||||
|
closeDialog();
|
||||||
|
props.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const handleResetClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.resetFields();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
@ -0,0 +1,212 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 面包屑 -->
|
||||||
|
<el-breadcrumb>
|
||||||
|
<el-breadcrumb-item>教学环境管理</el-breadcrumb-item>
|
||||||
|
<el-breadcrumb-item to="/teaching_envir/list">教学环境列表</el-breadcrumb-item>
|
||||||
|
</el-breadcrumb>
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-form inline :model="params">
|
||||||
|
<el-form-item :label-width="labelWidth" label="环境类型" prop="teaching_envir_type_guid">
|
||||||
|
<el-cascader class="w100" filterable :options="dataList"
|
||||||
|
:props="{ checkStrictly: false, value: 'teaching_envir_type_guid', label: 'teaching_envir_type_name', emitPath: false }"
|
||||||
|
placeholder="请选择作品类型" clearable v-model="params.teaching_envir_type_guid">
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span>{{ data.teaching_envir_type_name }}</span>
|
||||||
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||||
|
</template>
|
||||||
|
</el-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="环境标题">
|
||||||
|
<el-input v-model="params.teaching_envir" placeholder="请输入教学环境标题"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="环境简介">
|
||||||
|
<el-input v-model="params.teaching_envir_intro" 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="addTeachingEnvirDialogVisible = 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) => getTeachingEnvirList(params)">
|
||||||
|
<template #teaching_envir_img="scope">
|
||||||
|
<el-image v-if="scope.row.teaching_envir_img" :src="scope.row.teaching_envir_img.split(',')[0]" lazy
|
||||||
|
:preview-src-list="scope.row.teaching_envir_img.split(',')" :preview-teleported="true" :hide-on-click-modal="true"
|
||||||
|
fit="contain" class="el-avatar"></el-image>
|
||||||
|
<template v-else>暂无图片</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 作品类型 -->
|
||||||
|
<template #teaching_envir_type_name="scope">
|
||||||
|
<el-tag type="danger"> {{ scope.row.teaching_envir_type_name }} </el-tag>
|
||||||
|
</template>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- 添加教学环境 -->
|
||||||
|
<AddTeachingEnvirDialog v-model="addTeachingEnvirDialogVisible" :done="() => tableRef.reload()">
|
||||||
|
</AddTeachingEnvirDialog>
|
||||||
|
<!-- 编辑教学环境 -->
|
||||||
|
<EditTeachingEnvirDialog v-model="EditTeachingEnvirDialogVisible" :data="EditTeachingEnvirDialogRow"
|
||||||
|
:done="() => tableRef.reload()"></EditTeachingEnvirDialog>
|
||||||
|
<!-- 教学环境详情 -->
|
||||||
|
<DetailTeachingEnvirDialog v-model="DetailTeachingEnvirDialogVisible" :data="DetailTeachingEnvirDialogRow">
|
||||||
|
</DetailTeachingEnvirDialog>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ArrowDown } from "@element-plus/icons-vue";
|
||||||
|
import { ref, reactive, watch } from "vue";
|
||||||
|
import { useLoginStore } from "~/store";
|
||||||
|
import {
|
||||||
|
getTeachingEnvirList,
|
||||||
|
deleteTeachingEnvir,
|
||||||
|
} from "~/service/teaching_envir";
|
||||||
|
import AddTeachingEnvirDialog from "./components/AddTeachingEnvirDialog.vue";
|
||||||
|
import EditTeachingEnvirDialog from "./components/EditTeachingEnvirDialog.vue";
|
||||||
|
import DetailTeachingEnvirDialog from "./components/DetailTeachingEnvirDialog.vue";
|
||||||
|
import { getTeachingEnvirTypeList } from "~/service/teaching_envir_type";
|
||||||
|
|
||||||
|
const tableRef = ref();
|
||||||
|
const selectionData = ref([]);
|
||||||
|
const store = useLoginStore();
|
||||||
|
|
||||||
|
const addTeachingEnvirDialogVisible = ref(false);
|
||||||
|
const EditTeachingEnvirDialogVisible = ref(false);
|
||||||
|
const EditTeachingEnvirDialogRow = ref({});
|
||||||
|
const DetailTeachingEnvirDialogVisible = ref(false);
|
||||||
|
const DetailTeachingEnvirDialogRow = ref({});
|
||||||
|
|
||||||
|
const headers = {
|
||||||
|
Accept: "application/json",
|
||||||
|
...store.headers,
|
||||||
|
};
|
||||||
|
|
||||||
|
const dataList = ref();
|
||||||
|
async function getList() {
|
||||||
|
getTeachingEnvirTypeList().then((res) => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
dataList.value = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getList()
|
||||||
|
|
||||||
|
// 查询参数
|
||||||
|
const params = reactive({
|
||||||
|
teaching_envir: "",
|
||||||
|
teaching_envir_intro: "",
|
||||||
|
teaching_envir_details: "",
|
||||||
|
teaching_envir_type_guid: "",
|
||||||
|
});
|
||||||
|
const column = [
|
||||||
|
{
|
||||||
|
fixed: true,
|
||||||
|
type: "selection",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "teaching_envir_img",
|
||||||
|
label: "教学环境图片",
|
||||||
|
width: "150",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "teaching_envir",
|
||||||
|
label: "教学环境标题",
|
||||||
|
width: "150",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "teaching_envir_intro",
|
||||||
|
label: "教学环境简介",
|
||||||
|
width: "150",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "teaching_envir_type_name",
|
||||||
|
label: "教学环境类型",
|
||||||
|
width: "150",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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 deleteTeachingEnvir({
|
||||||
|
teaching_envir_guid: data.map((v) => v.teaching_envir_guid).join(),
|
||||||
|
});
|
||||||
|
if (res) {
|
||||||
|
tableRef.value.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
function handleUpdate(row) {
|
||||||
|
EditTeachingEnvirDialogVisible.value = true;
|
||||||
|
EditTeachingEnvirDialogRow.value = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情
|
||||||
|
function handleDetail(row) {
|
||||||
|
DetailTeachingEnvirDialogVisible.value = true;
|
||||||
|
DetailTeachingEnvirDialogRow.value = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
52
src/service/teaching_envir.js
Normal file
52
src/service/teaching_envir.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import {
|
||||||
|
api,
|
||||||
|
downloadFile,
|
||||||
|
createApiUrl
|
||||||
|
} from '~/utils/axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取教学环境列表
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function getTeachingEnvirList(data) {
|
||||||
|
return api.post('AboutUs.TeachingEnvir.TeachingEnvir/getTeachingEnvirList', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除教学环境
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function deleteTeachingEnvir(data) {
|
||||||
|
return api.post('AboutUs.TeachingEnvir.TeachingEnvir/deleteTeachingEnvir', data, {
|
||||||
|
isTransformResponse: true,
|
||||||
|
isShowSuccessMessage: true,
|
||||||
|
errorMessageText: '删除失败'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加教学环境
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function addTeachingEnvir(data) {
|
||||||
|
return api.post('AboutUs.TeachingEnvir.TeachingEnvir/addTeachingEnvir', data, {
|
||||||
|
isTransformResponse: true,
|
||||||
|
isShowSuccessMessage: true,
|
||||||
|
errorMessageText: '添加失败'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑教学环境
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function editTeachingEnvir(data) {
|
||||||
|
return api.post('AboutUs.TeachingEnvir.TeachingEnvir/editTeachingEnvir', data, {
|
||||||
|
isTransformResponse: true,
|
||||||
|
isShowSuccessMessage: true,
|
||||||
|
errorMessageText: '编辑失败'
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user