file:新增教师和授课科目模块
This commit is contained in:
parent
22003d225b
commit
c70a7b4290
@ -0,0 +1,124 @@
|
|||||||
|
<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="subject_name">
|
||||||
|
<el-input v-model='formData.subject_name' type="text" placeholder='请输入科目名字'></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="排序" prop="subject_sort">
|
||||||
|
<el-input-number v-model='formData.subject_sort' controls-position='right'></el-input-number>
|
||||||
|
</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 { addSubject } from "~/service/subject";
|
||||||
|
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: "Subject"
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(props, (v) => {
|
||||||
|
dialogVisible.value = v.modelValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
subject_name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '科目名字不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
subject_sort: [
|
||||||
|
{
|
||||||
|
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 addSubject(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,72 @@
|
|||||||
|
<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="subject_name">
|
||||||
|
<el-input v-model='formData.subject_name' type="text" placeholder='请输入科目名字'></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="排序" prop="subject_sort">
|
||||||
|
<el-input-number v-model='formData.subject_sort' controls-position='right'></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref, watch } from "vue";
|
||||||
|
import { isEmptyObject } from "~/utils/index";
|
||||||
|
|
||||||
|
|
||||||
|
// --业务参数
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// --业务方法
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// --基础参数
|
||||||
|
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,122 @@
|
|||||||
|
<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="subject_name">
|
||||||
|
<el-input v-model='formData.subject_name' type="text" placeholder='请输入科目名字'></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="排序" prop="subject_sort">
|
||||||
|
<el-input-number v-model='formData.subject_sort' controls-position='right'></el-input-number>
|
||||||
|
</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 { editSubject } from "~/service/subject";
|
||||||
|
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: "Subject"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// --基础方法
|
||||||
|
watch(props, (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// 打开弹窗时执行
|
||||||
|
const openDialog = () => {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeDialog = () => {
|
||||||
|
props.done();
|
||||||
|
emits("update:modelValue", false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
subject_name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '科目名字不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
subject_sort: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '排序不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleEditClick = async (formEl) => {
|
||||||
|
console.log(formData.value);
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate(async (valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { code } = await editSubject(formData.value);
|
||||||
|
if (code == 0) {
|
||||||
|
closeDialog();
|
||||||
|
props.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const handleResetClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.resetFields();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
|
||||||
|
</style>
|
288
src/pages/index/teachers_strength/subject/index.vue
Normal file
288
src/pages/index/teachers_strength/subject/index.vue
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 面包屑 -->
|
||||||
|
<el-breadcrumb>
|
||||||
|
<el-breadcrumb-item>师资力量</el-breadcrumb-item>
|
||||||
|
<el-breadcrumb-item to="/subject/list">授课科目列表</el-breadcrumb-item>
|
||||||
|
</el-breadcrumb>
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-form inline :model="params">
|
||||||
|
<el-form-item label="科目名字">
|
||||||
|
<el-input
|
||||||
|
v-model="params.subject_name"
|
||||||
|
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="addSubjectDialogVisible = true">
|
||||||
|
添加
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<!-- 导入 -->
|
||||||
|
<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"
|
||||||
|
>
|
||||||
|
<el-button type="primary">导入</el-button>
|
||||||
|
</el-upload>
|
||||||
|
|
||||||
|
<!-- 下载导入模板 -->
|
||||||
|
<el-button icon="ElIconDownload" @click="downloadTemplate()"
|
||||||
|
>下载导入模板</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- 导出 -->
|
||||||
|
<el-button icon="ElIconDocument" @click="exportExcel(params)"
|
||||||
|
>导出</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- 下拉操作 -->
|
||||||
|
<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"
|
||||||
|
v-loading="loading"
|
||||||
|
:request="params => tableDataInit(params)"
|
||||||
|
>
|
||||||
|
<!-- 排序 -->
|
||||||
|
<template #subject_sort="scope">
|
||||||
|
<el-input-number :disabled="loading" v-model='scope.row.subject_sort' controls-position="right"
|
||||||
|
@change="handleEditOrder(scope.row)"></el-input-number>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<!-- 添加授课科目 -->
|
||||||
|
<AddSubjectDialog
|
||||||
|
v-model="addSubjectDialogVisible"
|
||||||
|
:done="() => tableRef.reload()"
|
||||||
|
></AddSubjectDialog>
|
||||||
|
<!-- 编辑授课科目 -->
|
||||||
|
<EditSubjectDialog
|
||||||
|
v-model="EditSubjectDialogVisible"
|
||||||
|
:data="EditSubjectDialogRow"
|
||||||
|
:done="() => tableRef.reload()"
|
||||||
|
></EditSubjectDialog>
|
||||||
|
<!-- 授课科目详情 -->
|
||||||
|
<DetailSubjectDialog
|
||||||
|
v-model="DetailSubjectDialogVisible"
|
||||||
|
:data="DetailSubjectDialogRow"
|
||||||
|
></DetailSubjectDialog>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ArrowDown } from '@element-plus/icons-vue';
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { useLoginStore } from '~/store';
|
||||||
|
import {
|
||||||
|
getSubjectList,
|
||||||
|
deleteSubject,
|
||||||
|
downloadTemplate,
|
||||||
|
importExcel,
|
||||||
|
exportExcel,
|
||||||
|
editSubject
|
||||||
|
} from '~/service/subject';
|
||||||
|
import AddSubjectDialog from './components/AddSubjectDialog.vue';
|
||||||
|
import EditSubjectDialog from './components/EditSubjectDialog.vue';
|
||||||
|
import DetailSubjectDialog from './components/DetailSubjectDialog.vue';
|
||||||
|
import createDraw from 'hyw-drag'
|
||||||
|
|
||||||
|
const tableRef = ref();
|
||||||
|
const selectionData = ref([]);
|
||||||
|
const store = useLoginStore();
|
||||||
|
|
||||||
|
const addSubjectDialogVisible = ref(false);
|
||||||
|
const EditSubjectDialogVisible = ref(false);
|
||||||
|
const EditSubjectDialogRow = ref({});
|
||||||
|
const DetailSubjectDialogVisible = ref(false);
|
||||||
|
const DetailSubjectDialogRow = ref({});
|
||||||
|
|
||||||
|
const headers = {
|
||||||
|
Accept: 'application/json',
|
||||||
|
...store.headers
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查询参数
|
||||||
|
const params = reactive({
|
||||||
|
subject_name: '',
|
||||||
|
subject_sort: ''
|
||||||
|
});
|
||||||
|
const column = [
|
||||||
|
{
|
||||||
|
fixed: true,
|
||||||
|
type: 'selection'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'subject_sort',
|
||||||
|
label: '排序',
|
||||||
|
width: '180'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'subject_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 deleteSubject({
|
||||||
|
subject_guid: data.map(v => v.subject_guid).join()
|
||||||
|
});
|
||||||
|
if (res) {
|
||||||
|
tableRef.value.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//表格数据获取及拖拽处理
|
||||||
|
let drag = ref(false)
|
||||||
|
let tableData = ref();
|
||||||
|
async function tableDataInit(params) {
|
||||||
|
await getSubjectList(params).then((res) => tableData.value = res)
|
||||||
|
setTimeout(() => {
|
||||||
|
[...document.getElementsByClassName('el-table__row')].map(item => { item.classList.add('row1') });
|
||||||
|
drag.value === false && (drag.value = createDraw(document.getElementsByClassName('el-table__row')[0].parentElement))
|
||||||
|
})
|
||||||
|
return tableData.value;
|
||||||
|
}
|
||||||
|
watch(drag, () => {
|
||||||
|
const orderField = 'subject_sort';
|
||||||
|
drag.value.drop((info) => {
|
||||||
|
let targetIdx = [...document.getElementsByClassName('row1')].indexOf(info.el)
|
||||||
|
let sourceIdx = [...document.getElementsByClassName('row1')].indexOf(info.info.source.el)
|
||||||
|
let orderIdx = tableData.value.data[sourceIdx][orderField]
|
||||||
|
tableData.value.data[targetIdx][orderField] = orderIdx
|
||||||
|
handleEditOrder(tableData.value.data[targetIdx])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
//排序
|
||||||
|
const loading = ref(false)
|
||||||
|
async function handleEditOrder(data) {
|
||||||
|
loading.value = true
|
||||||
|
const { code } = await editSubject(data);
|
||||||
|
if (code == 0) {
|
||||||
|
loading.value = false
|
||||||
|
tableRef.value.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
function handleUpdate(row) {
|
||||||
|
EditSubjectDialogVisible.value = true;
|
||||||
|
EditSubjectDialogRow.value = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情
|
||||||
|
function handleDetail(row) {
|
||||||
|
DetailSubjectDialogVisible.value = true;
|
||||||
|
DetailSubjectDialogRow.value = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导入方法
|
||||||
|
let loadingImoprt = null;
|
||||||
|
const uploadLoading = () => {
|
||||||
|
loadingImoprt = ElLoading.service({
|
||||||
|
lock: true,
|
||||||
|
text: '正在导入中...',
|
||||||
|
background: 'rgba(255, 255, 255, 0.7)'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const closeUploadLoading = () => loadingImoprt.close();
|
||||||
|
const handleExcelSuccess = value => {
|
||||||
|
if (value.code == 0) {
|
||||||
|
ElMessageBox.alert(value.msg, '导入信息', {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
confirmButtonText: '确定'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ElMessage.error(value.msg);
|
||||||
|
}
|
||||||
|
closeUploadLoading();
|
||||||
|
tableRef.value.reload();
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,254 @@
|
|||||||
|
<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="24">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师名称"
|
||||||
|
prop="teacher_name"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="formData.teacher_name"
|
||||||
|
type="text"
|
||||||
|
placeholder="请输入教师名称"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="教师职位" prop="teacher_position">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.teacher_position"
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in teacher_position"
|
||||||
|
: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="teacher_img"
|
||||||
|
>
|
||||||
|
<UploadImage
|
||||||
|
ref="uploadRef"
|
||||||
|
v-model="formData.teacher_img"
|
||||||
|
:data="uoloadData"
|
||||||
|
:limit="1"
|
||||||
|
:fileSize="5"
|
||||||
|
:drag="true"
|
||||||
|
:isShowTip="false"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="授课科目"
|
||||||
|
prop="subject_guid"
|
||||||
|
>
|
||||||
|
<el-cascader
|
||||||
|
class="w100"
|
||||||
|
filterable
|
||||||
|
:options="dataList"
|
||||||
|
:props="{
|
||||||
|
checkStrictly: true,
|
||||||
|
value: 'subject_guid',
|
||||||
|
label: 'subject_name',
|
||||||
|
emitPath: false
|
||||||
|
}"
|
||||||
|
placeholder="请选择授课科目"
|
||||||
|
clearable
|
||||||
|
v-model="formData.subject_guid"
|
||||||
|
>
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span>{{ data.subject_name }}</span>
|
||||||
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||||
|
</template>
|
||||||
|
</el-cascader>
|
||||||
|
<!-- <el-input v-model='formData.subject_guid' type="text" placeholder='请选择授课科目'></el-input> -->
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师简介"
|
||||||
|
prop="teacher_intro"
|
||||||
|
>
|
||||||
|
<RichText
|
||||||
|
v-model="formData.teacher_intro"
|
||||||
|
:min-height="196"
|
||||||
|
></RichText>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师排序"
|
||||||
|
prop="teacher_order"
|
||||||
|
>
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.teacher_order"
|
||||||
|
controls-position="right"
|
||||||
|
></el-input-number>
|
||||||
|
</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 { addTeacher, getDictionary } from '~/service/teacher';
|
||||||
|
import { getSubjectList } from '~/service/subject';
|
||||||
|
import { useLoginStore } from '~/store';
|
||||||
|
|
||||||
|
// --业务参数
|
||||||
|
const dataList = ref();
|
||||||
|
|
||||||
|
// --业务方法
|
||||||
|
|
||||||
|
// 字典获取
|
||||||
|
const teacher_position = ref([]);
|
||||||
|
async function get_teacher_position() {
|
||||||
|
await getDictionary({ dictionary_value: 'teacher_position' }).then(
|
||||||
|
res => {
|
||||||
|
teacher_position.value = res;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 授课科目分类
|
||||||
|
async function getSubjectListFun() {
|
||||||
|
getSubjectList().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: 'Teacher'
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(props, v => {
|
||||||
|
dialogVisible.value = v.modelValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
teacher_name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师名称不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
teacher_position: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师职位不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
teacher_img: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师图片不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
subject_guid: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '授课科目不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
teacher_intro: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师简介不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
teacher_order: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师排序不能为空'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// --基础方法
|
||||||
|
|
||||||
|
// 打开弹窗时执行
|
||||||
|
const openDialog = () => {
|
||||||
|
get_teacher_position();
|
||||||
|
getSubjectListFun();
|
||||||
|
};
|
||||||
|
|
||||||
|
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 addTeacher(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,173 @@
|
|||||||
|
<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="24">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师名称"
|
||||||
|
prop="teacher_name"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="formData.teacher_name"
|
||||||
|
type="text"
|
||||||
|
placeholder="请输入教师名称"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="教师职位" prop="teacher_position">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.teacher_position"
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in teacher_position"
|
||||||
|
: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="subject_guid"
|
||||||
|
>
|
||||||
|
<el-cascader
|
||||||
|
class="w100"
|
||||||
|
filterable
|
||||||
|
:options="dataList"
|
||||||
|
:props="{
|
||||||
|
checkStrictly: true,
|
||||||
|
value: 'subject_guid',
|
||||||
|
label: 'subject_name',
|
||||||
|
emitPath: false
|
||||||
|
}"
|
||||||
|
placeholder="请选择授课科目"
|
||||||
|
clearable
|
||||||
|
v-model="formData.subject_guid"
|
||||||
|
>
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span>{{ data.subject_name }}</span>
|
||||||
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||||
|
</template>
|
||||||
|
</el-cascader>
|
||||||
|
<!-- <el-input v-model='formData.subject_guid' type="text" placeholder='请输入授课科目'></el-input> -->
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师图片"
|
||||||
|
prop="teacher_img"
|
||||||
|
>
|
||||||
|
<UploadImage
|
||||||
|
ref="uploadRef"
|
||||||
|
v-model="formData.teacher_img"
|
||||||
|
:data="uoloadData"
|
||||||
|
:limit="1"
|
||||||
|
:fileSize="5"
|
||||||
|
:drag="true"
|
||||||
|
:isShowTip="false"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师简介"
|
||||||
|
prop="teacher_intro"
|
||||||
|
>
|
||||||
|
<RichText
|
||||||
|
v-model="formData.teacher_intro"
|
||||||
|
:min-height="196"
|
||||||
|
></RichText>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师排序"
|
||||||
|
prop="teacher_order"
|
||||||
|
>
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.teacher_order"
|
||||||
|
controls-position="right"
|
||||||
|
></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref, watch } from 'vue';
|
||||||
|
import { isEmptyObject } from '~/utils/index';
|
||||||
|
import { getDictionary } from '~/service/teacher';
|
||||||
|
import { getSubjectList } from '~/service/subject';
|
||||||
|
|
||||||
|
// --业务参数
|
||||||
|
const dataList = ref();
|
||||||
|
// --业务方法
|
||||||
|
|
||||||
|
// 授课科目分类
|
||||||
|
async function getSubjectListFun() {
|
||||||
|
getSubjectList().then(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
dataList.value = res.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 字典获取
|
||||||
|
const teacher_position = ref([]);
|
||||||
|
async function get_teacher_position() {
|
||||||
|
await getDictionary({ dictionary_value: 'teacher_position' }).then(res => {
|
||||||
|
teacher_position.value = res;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// --基础参数
|
||||||
|
const formRef = ref();
|
||||||
|
const labelWidth = 100;
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean,
|
||||||
|
data: Object,
|
||||||
|
done: Function
|
||||||
|
});
|
||||||
|
const emits = defineEmits(['update:modelValue']);
|
||||||
|
const formData = ref({
|
||||||
|
...props.data
|
||||||
|
});
|
||||||
|
|
||||||
|
// --基础方法
|
||||||
|
watch(props, v => {
|
||||||
|
formData.value = v.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 打开弹窗时执行
|
||||||
|
const openDialog = () => {
|
||||||
|
get_teacher_position();
|
||||||
|
getSubjectListFun();
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeDialog = () => {
|
||||||
|
emits('update:modelValue', false);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
@ -0,0 +1,247 @@
|
|||||||
|
<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="24">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师名称"
|
||||||
|
prop="teacher_name"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="formData.teacher_name"
|
||||||
|
type="text"
|
||||||
|
placeholder="请输入教师名称"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="教师职位" prop="teacher_position">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.teacher_position"
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in teacher_position"
|
||||||
|
: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="teacher_img"
|
||||||
|
>
|
||||||
|
<UploadImage
|
||||||
|
ref="uploadRef"
|
||||||
|
v-model="formData.teacher_img"
|
||||||
|
:data="uoloadData"
|
||||||
|
:limit="1"
|
||||||
|
:fileSize="5"
|
||||||
|
:drag="true"
|
||||||
|
:isShowTip="false"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="授课科目"
|
||||||
|
prop="subject_guid"
|
||||||
|
>
|
||||||
|
<el-cascader
|
||||||
|
class="w100"
|
||||||
|
filterable
|
||||||
|
:options="dataList"
|
||||||
|
:props="{
|
||||||
|
checkStrictly: true,
|
||||||
|
value: 'subject_guid',
|
||||||
|
label: 'subject_name',
|
||||||
|
emitPath: false
|
||||||
|
}"
|
||||||
|
placeholder="请选择授课科目"
|
||||||
|
clearable
|
||||||
|
v-model="formData.subject_guid"
|
||||||
|
>
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span>{{ data.subject_name }}</span>
|
||||||
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||||
|
</template>
|
||||||
|
</el-cascader>
|
||||||
|
<!-- <el-input v-model='formData.subject_guid' type="text" placeholder='请选择授课科目'></el-input> -->
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师简介"
|
||||||
|
prop="teacher_intro"
|
||||||
|
>
|
||||||
|
<RichText
|
||||||
|
v-model="formData.teacher_intro"
|
||||||
|
:min-height="196"
|
||||||
|
></RichText>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
:label-width="labelWidth"
|
||||||
|
label="教师排序"
|
||||||
|
prop="teacher_order"
|
||||||
|
>
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.teacher_order"
|
||||||
|
controls-position="right"
|
||||||
|
></el-input-number>
|
||||||
|
</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 { editTeacher, getDictionary } from '~/service/teacher';
|
||||||
|
import { useLoginStore } from '~/store';
|
||||||
|
import { getSubjectList } from '~/service/subject';
|
||||||
|
|
||||||
|
// --业务参数
|
||||||
|
const dataList = ref();
|
||||||
|
// 字典获取
|
||||||
|
const teacher_position = ref([]);
|
||||||
|
async function get_teacher_position() {
|
||||||
|
await getDictionary({ dictionary_value: 'teacher_position' }).then(
|
||||||
|
res => {
|
||||||
|
teacher_position.value = res;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 授课科目分类
|
||||||
|
async function getSubjectListFun() {
|
||||||
|
getSubjectList().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: 'Teacher'
|
||||||
|
});
|
||||||
|
|
||||||
|
// --基础方法
|
||||||
|
watch(props, v => {
|
||||||
|
formData.value = v.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 打开弹窗时执行
|
||||||
|
const openDialog = () => {
|
||||||
|
get_teacher_position();
|
||||||
|
get_teacher_position();
|
||||||
|
getSubjectListFun();
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeDialog = () => {
|
||||||
|
props.done();
|
||||||
|
emits('update:modelValue', false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
teacher_name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师名称不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
teacher_position: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师职位不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
teacher_img: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师图片不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
subject_guid: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '授课科目不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
teacher_intro: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师简介不能为空'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
teacher_order: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '教师排序不能为空'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleEditClick = async formEl => {
|
||||||
|
console.log(formData.value);
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate(async valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { code } = await editTeacher(formData.value);
|
||||||
|
if (code == 0) {
|
||||||
|
closeDialog();
|
||||||
|
props.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const handleResetClick = async formEl => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.resetFields();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
387
src/pages/index/teachers_strength/teacher/index.vue
Normal file
387
src/pages/index/teachers_strength/teacher/index.vue
Normal file
@ -0,0 +1,387 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 面包屑 -->
|
||||||
|
<el-breadcrumb>
|
||||||
|
<el-breadcrumb-item>教师管理</el-breadcrumb-item>
|
||||||
|
<el-breadcrumb-item to="/teacher/list">教师列表</el-breadcrumb-item>
|
||||||
|
</el-breadcrumb>
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-form inline :model="params">
|
||||||
|
<el-form-item label="教师名称">
|
||||||
|
<el-input
|
||||||
|
v-model="params.teacher_name"
|
||||||
|
placeholder="请输入教师名称"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="教师职位">
|
||||||
|
<el-select
|
||||||
|
v-model="params.teacher_position"
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in teacher_position"
|
||||||
|
:key="item.dictionary_guid"
|
||||||
|
:label="item.dictionary_name"
|
||||||
|
:value="item.dictionary_value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<!--
|
||||||
|
<el-form-item label="录取院校">
|
||||||
|
<el-cascader class="w100" filterable :options="dataList"
|
||||||
|
:props="{ checkStrictly: true, value: 'subject_guid', label: 'subject_name', emitPath: false }"
|
||||||
|
placeholder="请选择录取院校" clearable v-model="params.subject_guid">
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span>{{ data.subject_name }}</span>
|
||||||
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||||
|
</template>
|
||||||
|
</el-cascader>
|
||||||
|
|
||||||
|
</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="addTeacherDialogVisible = 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"
|
||||||
|
>
|
||||||
|
<el-button type="primary">导入</el-button>
|
||||||
|
</el-upload>
|
||||||
|
|
||||||
|
<!-- 下载导入模板 -->
|
||||||
|
<el-button icon="ElIconDownload" @click="downloadTemplate()"
|
||||||
|
>下载导入模板</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- 下拉操作 -->
|
||||||
|
<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"
|
||||||
|
v-loading="loading"
|
||||||
|
:request="params => tableDataInit(params)"
|
||||||
|
>
|
||||||
|
<!-- 排序 -->
|
||||||
|
<template #teacher_order="scope">
|
||||||
|
<el-input-number :disabled="loading" v-model='scope.row.teacher_order' controls-position="right"
|
||||||
|
@change="handleEditOrder(scope.row)"></el-input-number>
|
||||||
|
</template>
|
||||||
|
<template #teacher_img="scope">
|
||||||
|
<el-image
|
||||||
|
v-if="scope.row.teacher_img"
|
||||||
|
:src="scope.row.teacher_img.split(',')[0]"
|
||||||
|
lazy
|
||||||
|
:preview-src-list="scope.row.teacher_img.split(',')"
|
||||||
|
:preview-teleported="true"
|
||||||
|
:hide-on-click-modal="true"
|
||||||
|
fit="contain"
|
||||||
|
class="el-avatar"
|
||||||
|
></el-image>
|
||||||
|
<template v-else>暂无图片</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #teacher_position="scope">
|
||||||
|
<dict-tag
|
||||||
|
:options="teacher_position"
|
||||||
|
:value="scope.row.teacher_position"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #subject_guid="scope">
|
||||||
|
<dict-tag :options="teacher_position" :value="scope.row.subject_guid" />
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<!-- 添加教师 -->
|
||||||
|
<AddTeacherDialog
|
||||||
|
v-model="addTeacherDialogVisible"
|
||||||
|
:done="() => tableRef.reload()"
|
||||||
|
></AddTeacherDialog>
|
||||||
|
<!-- 编辑教师 -->
|
||||||
|
<EditTeacherDialog
|
||||||
|
v-model="EditTeacherDialogVisible"
|
||||||
|
:data="EditTeacherDialogRow"
|
||||||
|
:done="() => tableRef.reload()"
|
||||||
|
></EditTeacherDialog>
|
||||||
|
<!-- 教师详情 -->
|
||||||
|
<DetailTeacherDialog
|
||||||
|
v-model="DetailTeacherDialogVisible"
|
||||||
|
:data="DetailTeacherDialogRow"
|
||||||
|
></DetailTeacherDialog>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ArrowDown } from '@element-plus/icons-vue';
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { useLoginStore } from '~/store';
|
||||||
|
import { getSubjectList } from '~/service/subject'
|
||||||
|
import {
|
||||||
|
getTeacherList,
|
||||||
|
deleteTeacher,
|
||||||
|
getDictionary,
|
||||||
|
exportExcel,
|
||||||
|
downloadTemplate,
|
||||||
|
importExcel,
|
||||||
|
editTeacher
|
||||||
|
} from '~/service/teacher';
|
||||||
|
import AddTeacherDialog from './components/AddTeacherDialog.vue';
|
||||||
|
import EditTeacherDialog from './components/EditTeacherDialog.vue';
|
||||||
|
import DetailTeacherDialog from './components/DetailTeacherDialog.vue';
|
||||||
|
import createDraw from 'hyw-drag'
|
||||||
|
|
||||||
|
const tableRef = ref();
|
||||||
|
const selectionData = ref([]);
|
||||||
|
const store = useLoginStore();
|
||||||
|
|
||||||
|
const addTeacherDialogVisible = ref(false);
|
||||||
|
const EditTeacherDialogVisible = ref(false);
|
||||||
|
const EditTeacherDialogRow = ref({});
|
||||||
|
const DetailTeacherDialogVisible = ref(false);
|
||||||
|
const DetailTeacherDialogRow = ref({});
|
||||||
|
|
||||||
|
|
||||||
|
const headers = {
|
||||||
|
Accept: 'application/json',
|
||||||
|
...store.headers
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// getSchoolCategoryListFun();
|
||||||
|
|
||||||
|
// 查询参数
|
||||||
|
const params = reactive({
|
||||||
|
teacher_name: '',
|
||||||
|
teacher_position: '',
|
||||||
|
subject_guid: ''
|
||||||
|
|
||||||
|
});
|
||||||
|
const column = [
|
||||||
|
{
|
||||||
|
fixed: true,
|
||||||
|
type: 'selection'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'teacher_order',
|
||||||
|
label: '教师排序',
|
||||||
|
width: '180'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'teacher_name',
|
||||||
|
label: '教师名称',
|
||||||
|
width: '150'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'teacher_position',
|
||||||
|
label: '教师职位',
|
||||||
|
width: '150'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'subject_name',
|
||||||
|
label: '授课科目',
|
||||||
|
width: '160'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'teacher_img',
|
||||||
|
label: '教师图片',
|
||||||
|
width: '150'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
prop: 'teacher_intro',
|
||||||
|
label: '教师简介',
|
||||||
|
width: '150'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: '操作',
|
||||||
|
prop: 'chaoz',
|
||||||
|
width: '250',
|
||||||
|
fixed: 'right'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
//表格数据获取及拖拽处理
|
||||||
|
let drag = ref(false)
|
||||||
|
let tableData = ref();
|
||||||
|
|
||||||
|
async function tableDataInit(params) {
|
||||||
|
getSubjectList().then(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
dataList.value = res.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await getTeacherList(params).then((res) => tableData.value = res)
|
||||||
|
setTimeout(() => {
|
||||||
|
[...document.getElementsByClassName('el-table__row')].map(item => { item.classList.add('row1') });
|
||||||
|
drag.value === false && (drag.value = createDraw(document.getElementsByClassName('el-table__row')[0].parentElement))
|
||||||
|
})
|
||||||
|
return tableData.value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(drag, () => {
|
||||||
|
const orderField = 'teacher_order';
|
||||||
|
drag.value.drop((info) => {
|
||||||
|
let targetIdx = [...document.getElementsByClassName('row1')].indexOf(info.el)
|
||||||
|
let sourceIdx = [...document.getElementsByClassName('row1')].indexOf(info.info.source.el)
|
||||||
|
let orderIdx = tableData.value.data[sourceIdx][orderField]
|
||||||
|
tableData.value.data[targetIdx][orderField] = orderIdx
|
||||||
|
handleEditOrder(tableData.value.data[targetIdx])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
//排序
|
||||||
|
const loading = ref(false)
|
||||||
|
async function handleEditOrder(data) {
|
||||||
|
loading.value = true
|
||||||
|
const { code } = await editTeacher(data);
|
||||||
|
if (code == 0) {
|
||||||
|
loading.value = false
|
||||||
|
tableRef.value.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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 deleteTeacher({
|
||||||
|
teacher_guid: data.map(v => v.teacher_guid).join()
|
||||||
|
});
|
||||||
|
if (res) {
|
||||||
|
tableRef.value.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
function handleUpdate(row) {
|
||||||
|
EditTeacherDialogVisible.value = true;
|
||||||
|
EditTeacherDialogRow.value = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情
|
||||||
|
function handleDetail(row) {
|
||||||
|
DetailTeacherDialogVisible.value = true;
|
||||||
|
DetailTeacherDialogRow.value = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导入方法
|
||||||
|
let loadingImoprt = null;
|
||||||
|
const uploadLoading = () => {
|
||||||
|
loadingImoprt = ElLoading.service({
|
||||||
|
lock: true,
|
||||||
|
text: '正在导入中...',
|
||||||
|
background: 'rgba(255, 255, 255, 0.7)'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const closeUploadLoading = () => loadingImoprt.close();
|
||||||
|
const handleExcelSuccess = value => {
|
||||||
|
if (value.code == 0) {
|
||||||
|
ElMessageBox.alert(value.msg, '导入信息', {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
confirmButtonText: '确定'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ElMessage.error(value.msg);
|
||||||
|
}
|
||||||
|
closeUploadLoading();
|
||||||
|
tableRef.value.reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 字典获取
|
||||||
|
const teacher_position = ref([]);
|
||||||
|
async function get_teacher_position() {
|
||||||
|
await getDictionary({ dictionary_value: 'teacher_position' }).then(res => {
|
||||||
|
teacher_position.value = res;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
get_teacher_position();
|
||||||
|
// // 字典获取
|
||||||
|
// const teacher_position = ref([]);
|
||||||
|
// async function get_teacher_position() {
|
||||||
|
// await getDictionary({ dictionary_value: 'teacher_position' }).then(res => {
|
||||||
|
// teacher_position.value = res;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// get_teacher_position();
|
||||||
|
</script>
|
81
src/service/subject.js
Normal file
81
src/service/subject.js
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
import { api, downloadFile, createApiUrl } from '~/utils/axios';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载授课科目模板
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function downloadTemplate(data) {
|
||||||
|
downloadFile(createApiUrl('Teachers_strength.Subject/downloadTemplate'), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入授课科目
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export const importExcel = createApiUrl('Teachers_strength.Subject/importExcel');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出授课科目
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function exportExcel(data) {
|
||||||
|
downloadFile(createApiUrl('Teachers_strength.Subject/exportExcel'), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取授课科目列表
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function getSubjectList(data) {
|
||||||
|
return api.post('Teachers_strength.Subject/getSubjectList', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除授课科目
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function deleteSubject(data) {
|
||||||
|
return api.post('Teachers_strength.Subject/deleteSubject', data, {
|
||||||
|
isTransformResponse: true,
|
||||||
|
isShowSuccessMessage: true,
|
||||||
|
errorMessageText: '删除失败'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加授课科目
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function addSubject(data) {
|
||||||
|
return api.post('Teachers_strength.Subject/addSubject', data, {
|
||||||
|
isTransformResponse: true,
|
||||||
|
isShowSuccessMessage: true,
|
||||||
|
errorMessageText: '添加失败'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑授课科目
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function editSubject(data) {
|
||||||
|
return api.post('Teachers_strength.Subject/editSubject', data, {
|
||||||
|
isTransformResponse: true,
|
||||||
|
isShowSuccessMessage: true,
|
||||||
|
errorMessageText: '编辑失败'
|
||||||
|
});
|
||||||
|
}
|
87
src/service/teacher.js
Normal file
87
src/service/teacher.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
import { api, downloadFile, createApiUrl} from '~/utils/axios';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出教师
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function exportExcel(data) {
|
||||||
|
downloadFile(createApiUrl('Teachers_strength.Teacher/exportExcel'), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载教师模板
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function downloadTemplate(data) {
|
||||||
|
downloadFile(createApiUrl('Teachers_strength.Teacher/downloadTemplate'), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入教师
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export const importExcel = createApiUrl('Teachers_strength.Teacher/importExcel');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典值
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function getDictionary(data) {
|
||||||
|
return api.post('Dictionary.Dictionary/getDictionary', data, {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取教师列表
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function getTeacherList(data) {
|
||||||
|
return api.post('Teachers_strength.Teacher/getTeacherList', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除教师
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function deleteTeacher(data) {
|
||||||
|
return api.post('Teachers_strength.Teacher/deleteTeacher', data, {
|
||||||
|
isTransformResponse: true,
|
||||||
|
isShowSuccessMessage: true,
|
||||||
|
errorMessageText: '删除失败'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加教师
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function addTeacher(data) {
|
||||||
|
return api.post('Teachers_strength.Teacher/addTeacher', data, {
|
||||||
|
isTransformResponse: true,
|
||||||
|
isShowSuccessMessage: true,
|
||||||
|
errorMessageText: '添加失败'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑教师
|
||||||
|
* @param {Object} data
|
||||||
|
* @return {Promise} api
|
||||||
|
*/
|
||||||
|
export function editTeacher(data) {
|
||||||
|
return api.post('Teachers_strength.Teacher/editTeacher', data, {
|
||||||
|
isTransformResponse: true,
|
||||||
|
isShowSuccessMessage: true,
|
||||||
|
errorMessageText: '编辑失败'
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user