修改
This commit is contained in:
122
src/views/infra/demo/demo03/erp/Demo03StudentForm.vue
Normal file
122
src/views/infra/demo/demo03/erp/Demo03StudentForm.vue
Normal file
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-form-item label="名字" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名字"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="sex">
|
||||
<el-radio-group v-model="formData.sex">
|
||||
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)"
|
||||
:key="dict.value" :label="parseInt(dict.value)"
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="出生日期" prop="birthday">
|
||||
<el-date-picker clearable v-model="formData.birthday" type="date" value-format="timestamp"
|
||||
placeholder="选择出生日期"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="简介">
|
||||
<Editor v-model="formData.description" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as Demo03StudentApi from '@/api/infra/demo03-erp';
|
||||
import Editor from '@/components/Editor';
|
||||
|
||||
export default {
|
||||
name: "Demo03StudentForm",
|
||||
components: {
|
||||
Editor,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
sex: undefined,
|
||||
birthday: undefined,
|
||||
description: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
name: [{ required: true, message: '名字不能为空', trigger: 'blur' }],
|
||||
sex: [{ required: true, message: '性别不能为空', trigger: 'blur' }],
|
||||
birthday: [{ required: true, message: '出生日期不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '简介不能为空', trigger: 'blur' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await Demo03StudentApi.getDemo03Student(id);
|
||||
this.formData = res.data;
|
||||
this.title = "修改学生";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增学生";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.id) {
|
||||
await Demo03StudentApi.updateDemo03Student(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await Demo03StudentApi.createDemo03Student(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
sex: undefined,
|
||||
birthday: undefined,
|
||||
description: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
104
src/views/infra/demo/demo03/erp/components/Demo03CourseForm.vue
Normal file
104
src/views/infra/demo/demo03/erp/components/Demo03CourseForm.vue
Normal file
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-form-item label="名字" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名字"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分数" prop="score">
|
||||
<el-input v-model="formData.score" placeholder="请输入分数"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as Demo03StudentApi from '@/api/infra/demo03-erp';
|
||||
|
||||
export default {
|
||||
name: "Demo03CourseForm",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
id: undefined,
|
||||
studentId: undefined,
|
||||
name: undefined,
|
||||
score: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
studentId: [{ required: true, message: "学生编号不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "名字不能为空", trigger: "blur" }],
|
||||
score: [{ required: true, message: "分数不能为空", trigger: "blur" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id, studentId) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
this.formData.studentId = studentId;
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await Demo03StudentApi.getDemo03Course(id);
|
||||
this.formData = res.data;
|
||||
this.dialogTitle = "修改学生课程";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.dialogTitle = "新增学生课程";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.id) {
|
||||
await Demo03StudentApi.updateDemo03Course(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await Demo03StudentApi.createDemo03Course(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
id: undefined,
|
||||
studentId: undefined,
|
||||
name: undefined,
|
||||
score: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
153
src/views/infra/demo/demo03/erp/components/Demo03CourseList.vue
Normal file
153
src/views/infra/demo/demo03/erp/components/Demo03CourseList.vue
Normal file
@@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['infra:demo03-student:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="isEmpty(checkedIds)"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['infra:demo03-student:delete']"
|
||||
>
|
||||
批量删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column label="编号" align="center" prop="id"/>
|
||||
<el-table-column label="名字" align="center" prop="name"/>
|
||||
<el-table-column label="分数" align="center" prop="score"/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['infra:demo03-student:update']">修改
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['infra:demo03-student:delete']">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<Demo03CourseForm ref="formRef" @success="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as Demo03StudentApi from '@/api/infra/demo03-erp';
|
||||
import Demo03CourseForm from './Demo03CourseForm.vue';
|
||||
|
||||
export default {
|
||||
name: "Demo03CourseList",
|
||||
components: {
|
||||
Demo03CourseForm
|
||||
},
|
||||
props: [
|
||||
'studentId'
|
||||
],// 学生编号(主表的关联字段)
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 列表的数据
|
||||
list: [],
|
||||
checkedIds: [],
|
||||
// 列表的总页数
|
||||
total: 0,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
studentId: undefined
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
||||
studentId: {
|
||||
handler(val) {
|
||||
this.queryParams.studentId = val;
|
||||
if (val) {
|
||||
this.handleQuery();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await Demo03StudentApi.getDemo03CoursePage(this.queryParams);
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 批量删除学生 */
|
||||
async handleDeleteBatch() {
|
||||
await this.$modal.confirm('是否确认删除?')
|
||||
try {
|
||||
await Demo03StudentApi.deleteDemo03CourseList(this.checkedIds);
|
||||
this.checkedIds = [];
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
handleRowCheckboxChange(records) {
|
||||
this.checkedIds = records.map((item) => item.id);
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
if (!this.studentId) {
|
||||
this.$modal.msgError('请选择一个学生');
|
||||
return;
|
||||
}
|
||||
this.$refs["formRef"].open(id, this.studentId);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
await this.$modal.confirm('是否确认删除学生编号为"' + id + '"的数据项?');
|
||||
try {
|
||||
await Demo03StudentApi.deleteDemo03Course(id);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
104
src/views/infra/demo/demo03/erp/components/Demo03GradeForm.vue
Normal file
104
src/views/infra/demo/demo03/erp/components/Demo03GradeForm.vue
Normal file
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-form-item label="名字" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名字"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="班主任" prop="teacher">
|
||||
<el-input v-model="formData.teacher" placeholder="请输入班主任"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as Demo03StudentApi from '@/api/infra/demo03-erp';
|
||||
|
||||
export default {
|
||||
name: "Demo03GradeForm",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
id: undefined,
|
||||
studentId: undefined,
|
||||
name: undefined,
|
||||
teacher: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
studentId: [{ required: true, message: "学生编号不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "名字不能为空", trigger: "blur" }],
|
||||
teacher: [{ required: true, message: "班主任不能为空", trigger: "blur" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id, studentId) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
this.formData.studentId = studentId;
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await Demo03StudentApi.getDemo03Grade(id);
|
||||
this.formData = res.data;
|
||||
this.dialogTitle = "修改学生班级";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.dialogTitle = "新增学生班级";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.id) {
|
||||
await Demo03StudentApi.updateDemo03Grade(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await Demo03StudentApi.createDemo03Grade(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
id: undefined,
|
||||
studentId: undefined,
|
||||
name: undefined,
|
||||
teacher: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
153
src/views/infra/demo/demo03/erp/components/Demo03GradeList.vue
Normal file
153
src/views/infra/demo/demo03/erp/components/Demo03GradeList.vue
Normal file
@@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['infra:demo03-student:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="isEmpty(checkedIds)"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['infra:demo03-student:delete']"
|
||||
>
|
||||
批量删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column label="编号" align="center" prop="id"/>
|
||||
<el-table-column label="名字" align="center" prop="name"/>
|
||||
<el-table-column label="班主任" align="center" prop="teacher"/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['infra:demo03-student:update']">修改
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['infra:demo03-student:delete']">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<Demo03GradeForm ref="formRef" @success="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as Demo03StudentApi from '@/api/infra/demo03-erp';
|
||||
import Demo03GradeForm from './Demo03GradeForm.vue';
|
||||
|
||||
export default {
|
||||
name: "Demo03GradeList",
|
||||
components: {
|
||||
Demo03GradeForm
|
||||
},
|
||||
props: [
|
||||
'studentId'
|
||||
],// 学生编号(主表的关联字段)
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 列表的数据
|
||||
list: [],
|
||||
checkedIds: [],
|
||||
// 列表的总页数
|
||||
total: 0,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
studentId: undefined
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
||||
studentId: {
|
||||
handler(val) {
|
||||
this.queryParams.studentId = val;
|
||||
if (val) {
|
||||
this.handleQuery();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await Demo03StudentApi.getDemo03GradePage(this.queryParams);
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 批量删除学生 */
|
||||
async handleDeleteBatch() {
|
||||
await this.$modal.confirm('是否确认删除?')
|
||||
try {
|
||||
await Demo03StudentApi.deleteDemo03GradeList(this.checkedIds);
|
||||
this.checkedIds = [];
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
handleRowCheckboxChange(records) {
|
||||
this.checkedIds = records.map((item) => item.id);
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
if (!this.studentId) {
|
||||
this.$modal.msgError('请选择一个学生');
|
||||
return;
|
||||
}
|
||||
this.$refs["formRef"].open(id, this.studentId);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
await this.$modal.confirm('是否确认删除学生编号为"' + id + '"的数据项?');
|
||||
try {
|
||||
await Demo03StudentApi.deleteDemo03Grade(id);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
231
src/views/infra/demo/demo03/erp/index.vue
Normal file
231
src/views/infra/demo/demo03/erp/index.vue
Normal file
@@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="名字" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入名字" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="sex">
|
||||
<el-select v-model="queryParams.sex" placeholder="请选择性别" clearable size="small">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['infra:demo03-student:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['infra:demo03-student:export']">导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="isEmpty(checkedIds)"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['infra:demo03-student:delete']"
|
||||
>
|
||||
批量删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
row-key="id"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:highlight-current-row="true"
|
||||
:show-overflow-tooltip="true"
|
||||
@current-change="handleCurrentChange"
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column label="编号" align="center" prop="id"/>
|
||||
<el-table-column label="名字" align="center" prop="name"/>
|
||||
<el-table-column label="性别" align="center" prop="sex">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.sex"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出生日期" align="center" prop="birthday" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.birthday) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="简介" align="center" prop="description"/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['infra:demo03-student:update']">修改
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['infra:demo03-student:delete']">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<Demo03StudentForm ref="formRef" @success="getList"/>
|
||||
<!-- 子表的列表 -->
|
||||
<el-tabs v-model="subTabsName">
|
||||
<el-tab-pane label="学生课程" name="demo03Course">
|
||||
<Demo03CourseList v-if="currentRow.id" :student-id="currentRow.id"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="学生班级" name="demo03Grade">
|
||||
<Demo03GradeList v-if="currentRow.id" :student-id="currentRow.id"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as Demo03StudentApi from '@/api/infra/demo03-erp';
|
||||
import Demo03StudentForm from './Demo03StudentForm.vue';
|
||||
import Demo03CourseList from './components/Demo03CourseList.vue';
|
||||
import Demo03GradeList from './components/Demo03GradeList.vue';
|
||||
|
||||
export default {
|
||||
name: "Demo03Student",
|
||||
components: {
|
||||
Demo03StudentForm,
|
||||
Demo03CourseList,
|
||||
Demo03GradeList,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 学生列表
|
||||
list: [],
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
checkedIds: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
sex: null,
|
||||
description: null,
|
||||
createTime: [],
|
||||
},
|
||||
/** 子表的列表 */
|
||||
subTabsName: 'demo03Course'
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await Demo03StudentApi.getDemo03StudentPage(this.queryParams);
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
await this.$modal.confirm('是否确认删除学生编号为"' + id + '"的数据项?')
|
||||
try {
|
||||
await Demo03StudentApi.deleteDemo03Student(id);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
/** 批量删除学生 */
|
||||
async handleDeleteBatch() {
|
||||
await this.$modal.confirm('是否确认删除?')
|
||||
try {
|
||||
await Demo03StudentApi.deleteDemo03StudentList(this.checkedIds);
|
||||
this.checkedIds = [];
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
handleRowCheckboxChange(records) {
|
||||
this.checkedIds = records.map((item) => item.id);
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.$modal.confirm('是否确认导出所有学生数据项?');
|
||||
try {
|
||||
this.exportLoading = true;
|
||||
const data = await Demo03StudentApi.exportDemo03StudentExcel(this.queryParams);
|
||||
this.$download.excel(data, '学生.xls');
|
||||
} catch {
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
/** 选中行操作 */
|
||||
handleCurrentChange(row) {
|
||||
this.currentRow = row;
|
||||
/** 子表的列表 */
|
||||
this.subTabsName = 'demo03Course';
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user