|
@@ -84,14 +84,14 @@
|
|
|
</template>
|
|
|
</cloudTable>
|
|
|
<cloudDialog ref="dialog" :config="dialogConfig" :beforeClose="beforeClose">
|
|
|
- <el-form ref="form" :model="dialogForm" label-width="80px">
|
|
|
- <el-form-item label="学生名称">
|
|
|
+ <el-form ref="form" :model="dialogForm" label-width="80px" :rules="rules">
|
|
|
+ <el-form-item label="学生姓名" prop="name">
|
|
|
<el-input
|
|
|
v-model="dialogForm.name"
|
|
|
- placeholder="请输入学生名称"
|
|
|
+ placeholder="请输入学生姓名"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="学号">
|
|
|
+ <el-form-item label="学号" prop="sno">
|
|
|
<el-input
|
|
|
v-model="dialogForm.sno"
|
|
|
placeholder="请输入学号"
|
|
@@ -109,7 +109,7 @@
|
|
|
placeholder="请输入年龄"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="学校">
|
|
|
+ <el-form-item label="学校" prop="sid">
|
|
|
<el-select
|
|
|
v-model="dialogForm.sid"
|
|
|
placeholder="请选择学校"
|
|
@@ -124,7 +124,7 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="年级">
|
|
|
+ <el-form-item label="年级" prop="gid">
|
|
|
<el-select
|
|
|
v-model="dialogForm.gid"
|
|
|
placeholder="请选择年级"
|
|
@@ -140,7 +140,7 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="班级">
|
|
|
+ <el-form-item label="班级" prop="cid">
|
|
|
<el-select
|
|
|
v-model="dialogForm.cid"
|
|
|
placeholder="请选择班级"
|
|
@@ -155,7 +155,7 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="电话">
|
|
|
+ <el-form-item label="电话" prop="phone">
|
|
|
<el-input
|
|
|
v-model="dialogForm.phone"
|
|
|
placeholder="请输入电话"
|
|
@@ -320,6 +320,50 @@ export default {
|
|
|
btnTxt: ["取消", "上传"],
|
|
|
},
|
|
|
selRows: "",
|
|
|
+ rules: {
|
|
|
+ name: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入学生姓名",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ sno: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入学生学号",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ sid: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择学校",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ gid: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择年级",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ cid: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择班级",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ phone: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入手机号",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
watch: {},
|
|
@@ -370,9 +414,25 @@ export default {
|
|
|
};
|
|
|
this.dialogForm = form;
|
|
|
this.$refs.dialog.open((cancel) => {
|
|
|
- StudentApi.edit(this.dialogForm).then((res) => {
|
|
|
- this.getList();
|
|
|
- });
|
|
|
+ this.$refs["form"].validate((valid)=>{
|
|
|
+ if(valid){
|
|
|
+ StudentApi.edit(this.dialogForm).then((res) => {
|
|
|
+ if(res.mess="success"){
|
|
|
+ this.$message({
|
|
|
+ type:"success",
|
|
|
+ message:"修改成功!"
|
|
|
+ })
|
|
|
+ this.getList()
|
|
|
+ cancel()
|
|
|
+ }else{
|
|
|
+ Message({
|
|
|
+ message: res.message,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
});
|
|
|
});
|
|
|
break;
|
|
@@ -439,9 +499,24 @@ export default {
|
|
|
}
|
|
|
this.$refs.dialog.config.title = "新增学生信息";
|
|
|
this.$refs.dialog.open((cancel) => {
|
|
|
- StudentApi.add(this.dialogForm).then((res) => {
|
|
|
- this.getList();
|
|
|
- cancel();
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ StudentApi.add(this.dialogForm).then((res) => {
|
|
|
+ if (res.mess == "success") {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "成功!",
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ cancel()
|
|
|
+ } else {
|
|
|
+ Message({
|
|
|
+ message: res.message,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
});
|
|
|
},
|