add游戏数学学期计划详细功能

This commit is contained in:
sk1551
2020-10-30 15:27:40 +08:00
parent 09ca6827c4
commit def67e67c0
10 changed files with 1049 additions and 10 deletions

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询游戏数学学期计划明细列表
export function listMathtermplanitem(query) {
return request({
url: '/benyi/mathtermplanitem/list',
method: 'get',
params: query
})
}
// 查询游戏数学学期计划明细详细
export function getMathtermplanitem(id) {
return request({
url: '/benyi/mathtermplanitem/' + id,
method: 'get'
})
}
// 新增游戏数学学期计划明细
export function addMathtermplanitem(data) {
return request({
url: '/benyi/mathtermplanitem',
method: 'post',
data: data
})
}
// 修改游戏数学学期计划明细
export function updateMathtermplanitem(data) {
return request({
url: '/benyi/mathtermplanitem',
method: 'put',
data: data
})
}
// 删除游戏数学学期计划明细
export function delMathtermplanitem(id) {
return request({
url: '/benyi/mathtermplanitem/' + id,
method: 'delete'
})
}
// 导出游戏数学学期计划明细
export function exportMathtermplanitem(query) {
return request({
url: '/benyi/mathtermplanitem/export',
method: 'get',
params: query
})
}

View File

@ -274,6 +274,21 @@ export const constantRoutes = [{
}
}]
},
{
path: '/benyi_course/mathtermplan',
component: Layout,
hidden: true,
children: [{
path: 'data/:id',
component: () =>
import ('@/views/benyi/mathtermplan/data'),
name: 'Mathtermplan1',
meta: {
title: '游戏数学学期计划(明细)',
icon: ''
}
}]
},
{
path: '/benyi_course/themetermplan',
component: Layout,

View File

@ -0,0 +1,406 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="102px"
>
<el-form-item label="学期计划" prop="tpid">
<el-select v-model="queryParams.tpid" size="small">
<el-option
v-for="item in mathPlanOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="游戏数学内容" prop="mathconent">
<el-input
v-model="queryParams.mathconent"
placeholder="请输入游戏数学内容"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['benyi:mathtermplan:add']"
v-show="isShow"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['benyi:mathtermplan:edit']"
v-show="isShow"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['benyi:mathtermplan:remove']"
v-show="isShow"
>删除</el-button
>
</el-col>
</el-row>
<el-table
v-loading="loading"
:data="mathtermplanitemList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="所属计划" align="center" prop="tpid" :formatter="mathPlanFormat" />
<el-table-column label="月份" align="center" prop="month" />
<el-table-column label="游戏数学内容" align="center" prop="mathconent" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['benyi:mathtermplan:edit']"
v-show="isShow"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['benyi:mathtermplan:remove']"
v-show="isShow"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改游戏数学学期计划明细对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="所属计划" prop="tpid">
<el-select v-model="form.tpid" size="small" :disabled="true">
<el-option
v-for="item in mathPlanOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="月份" prop="month">
<el-date-picker
v-model="form.month"
type="month"
value-format="yyyy-MM"
placeholder="选择月份"
>
</el-date-picker>
</el-form-item>
<el-form-item label="选择内容" prop="mathconent">
<el-select v-model="form.mathconent" size="small" >
<el-option
v-for="item in mathOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listMathtermplanitem,
getMathtermplanitem,
delMathtermplanitem,
addMathtermplanitem,
updateMathtermplanitem,
} from "@/api/benyi/mathtermplanitem";
// 获取游戏数学内容接口
import {
listMath,
getMath,
} from "@/api/benyi/math";
// 获取班级接口
import { listClass } from "@/api/system/class";
// 获取游戏数学计划接口
import {
listMathtermplan,
getMathtermplan,
} from "@/api/benyi/mathtermplan";
export default {
name: "Mathtermplanitem",
data() {
return {
// 是否显示按钮
isShow: true,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// 游戏数学学期计划明细表格数据
mathtermplanitemList: [],
// 计划列表
mathPlanOptions: [],
// 游戏数学内容选项
mathOptions: [],
// 默认游戏数学类型
defaultMathType: "",
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
tpid: undefined,
month: undefined,
mathconent: undefined,
createuserid: undefined,
updateuserid: undefined,
},
queryParams_class: {
bjbh: undefined
},
queryParams_classtype: {
classtypeId: undefined
},
// 表单参数
form: {},
// 表单校验
rules: {},
};
},
created() {
const mathplanid = this.$route.params && this.$route.params.id;
this.getMathPlan(mathplanid);
this.getMathPlanList();
this.getClassType();
},
methods: {
/** 查询游戏数学学期计划明细列表 */
getList() {
this.loading = true;
listMathtermplanitem(this.queryParams).then((response) => {
this.mathtermplanitemList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//计划详情
getMathPlan(mathplanid) {
getMathtermplan(mathplanid).then((response) => {
this.queryParams_class.bjbh = response.data.classid;
this.queryParams.tpid = response.data.id;
this.defaultMathType = response.data.id;
if (response.data.status == "0") {
this.isShow = true;
} else {
this.isShow = false;
}
this.getList();
});
},
// 获取班级类型
getClassType() {
listClass(this.queryParams_class).then((response) => {
this.queryParams_classtype.classtypeId = response.rows[0].bjtype;
this.getMathList();
});
},
// 获取游戏数学内容列表
getMathList() {
listMath(this.queryParams_classtype).then((response) => {
this.mathOptions = response.rows;
});
},
// 获取游戏数学学期计划列表
getMathPlanList() {
listMathtermplan().then((response) => {
this.mathPlanOptions = response.rows;
});
},
// 字典翻译
mathPlanFormat(row, column) {
// return this.selectDictLabel(this.classOptions, row.classid);
var actions = [];
var datas = this.mathPlanOptions;
Object.keys(datas).map((key) => {
if (datas[key].id == "" + row.tpid) {
actions.push(datas[key].name);
return false;
}
});
return actions.join("");
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: undefined,
tpid: undefined,
month: undefined,
mathconent: undefined,
remark: undefined,
createuserid: undefined,
createTime: undefined,
updateuserid: undefined,
updateTime: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.tpid = this.defaultMathType;
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加游戏数学学期计划明细";
this.form.tpid = this.queryParams.tpid;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getMathtermplanitem(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改游戏数学学期计划明细";
});
},
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != undefined) {
updateMathtermplanitem(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addMathtermplanitem(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm(
'是否确认删除游戏数学学期计划明细编号为"' + ids + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () {
return delMathtermplanitem(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
},
},
};
</script>