xjc 2 vuotta sitten
vanhempi
commit
be565a891a

+ 3 - 2
src/views/menu2/menu2-1/index.vue

@@ -24,7 +24,7 @@
             v-model="qArea"
           ></el-cascader>
         </div>
-        <div class="cloudSearch-item">
+        <!-- <div class="cloudSearch-item">
           <div class="form-label">创建时间:</div>
           <el-date-picker
             v-model="ctime"
@@ -34,7 +34,7 @@
             end-placeholder="结束日期"
           >
           </el-date-picker>
-        </div>
+        </div> -->
       </template>
     </cloudSearch>
     <cloudTable
@@ -455,6 +455,7 @@ export default {
         this.$refs["form"].validate((valid) => {
           if (valid) {
             if (type == "edit") {
+              this.form.area = this.area;
               SchoolApi.edit(this.form).then((res) => {
                 if (res.mess == "success") {
                   this.getList();

+ 6 - 3
src/views/menu2/menu2-2/index.vue

@@ -34,7 +34,7 @@
             </el-option>
           </el-select>
         </div>
-        <div class="cloudSearch-item">
+        <!-- <div class="cloudSearch-item">
           <div class="form-label">创建时间:</div>
           <el-date-picker
             v-model="ctime"
@@ -44,7 +44,7 @@
             end-placeholder="结束日期"
           >
           </el-date-picker>
-        </div>
+        </div> -->
       </template>
     </cloudSearch>
     <cloudTable
@@ -72,6 +72,7 @@
             v-model="dialogForm.sid"
             placeholder="请选择所属学校"
             @change="schoolChange"
+            :disabled="dialogType=='edit'"
           >
             <el-option
               v-for="item in metaData['schools']"
@@ -84,7 +85,9 @@
         </el-form-item>
         <el-form-item label="所属年级">
           <el-col :span="12">
-            <el-select v-model="dialogForm.gid" placeholder="所属年级">
+            <el-select v-model="dialogForm.gid" placeholder="所属年级"
+              :disabled="dialogType=='edit'"
+            >
               <el-option
                 v-for="item in gradesBySchool"
                 :key="item.value"

+ 80 - 13
src/views/menu3/menu3-1/index.vue

@@ -107,11 +107,11 @@
       </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="性别">
@@ -126,13 +126,14 @@
             placeholder="请输入年龄"
           ></el-input>
         </el-form-item>
-        <el-form-item label="手机号">
+        <el-form-item label="手机号" prop="phone">
           <el-input
             v-model="dialogForm.phone"
+            maxlength="11"
             placeholder="请输入手机号"
           ></el-input>
         </el-form-item>
-        <el-form-item label="学校">
+        <el-form-item label="学校" prop="sid">
           <el-select
             v-model="dialogForm.sid"
             placeholder="请选择学校"
@@ -147,7 +148,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="请选择年级"
@@ -163,7 +164,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="请选择班级"
@@ -178,7 +179,7 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="职务">
+        <el-form-item label="职务" prop="rid">
           <el-select v-model="dialogForm.rid" placeholder="请选择职务">
             <el-option
               v-for="item in metaData['roles']"
@@ -189,7 +190,7 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="任教科目">
+        <el-form-item label="任教科目" prop="subject">
           <el-select v-model="dialogForm.subject" placeholder="请选择科目">
             <el-option
               v-for="item in metaData['subjects']"
@@ -373,6 +374,57 @@ export default {
         btnTxt: ["取消", "上传"],
       },
       selRows: "",
+      rules: {
+        name: [
+          {
+            required: true,
+            message: "请输入教师姓名",
+            trigger: "blur",
+          },
+        ],
+        sid: [
+          {
+            required: true,
+            message: "请选择学校",
+            trigger: "change",
+          },
+        ],
+        gid: [
+          {
+            required: true,
+            message: "请选择年级",
+            trigger: "change",
+          },
+        ],
+        cid: [
+          {
+            required: true,
+            message: "请选择班级",
+            trigger: "change",
+          },
+        ],
+        rid: [
+          {
+            required: true,
+            message: "请选择教师职务",
+            trigger: "change",
+          },
+        ],
+        phone: [
+          {
+            required: true,
+            message: "请输入手机号",
+            trigger: "blur",
+          },
+        ],
+        subject: [
+          {
+            required: true,
+            message: "请选择任教科目",
+            trigger: "blur",
+          },
+        ],
+      },
     };
   },
   created() {
@@ -428,10 +480,25 @@ export default {
             };
             this.dialogForm = form;
             this.$refs.dialog.open((cancel) => {
-              TeacherApi.edit(this.dialogForm).then((res) => {
-                this.getList();
-                cancel();
-              });
+              this.$refs["form"].validate((valid)=>{
+                if(valid){
+                  TeacherApi.edit(this.dialogForm).then((res) => {
+                    if(res.mess="success"){
+                      this.$message({
+                        type:"success",
+                        message:"修改成功!"
+                      })
+                      this.getList();
+                      cancel();
+                    }else{
+                      Message({
+                        type:"error",
+                        message:res.message
+                      })
+                    }
+                  });
+                }
+              })
             });
           });
           break;

+ 89 - 14
src/views/menu3/menu3-2/index.vue

@@ -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",
+                });
+              }
+            });
+          }
         });
       });
     },

+ 23 - 12
src/views/menu5/menu5-1/index.vue

@@ -77,7 +77,7 @@
         <template slot="tableBtn">
           <el-button size="small" @click="open2()">批量导入</el-button>
           <el-button class="add" size="small" @click="addItems()"
-            >上传试卷</el-button
+            >新增试卷</el-button
           >
           <el-button class="add" size="small" @click="paperTemp()"
             >下载试卷模板</el-button
@@ -409,7 +409,7 @@ export default {
       dialogConfig1: {
         top: "8vh",
         width: "600px",
-        title: "上传试卷",
+        title: "新增试卷",
         center: true,
         btnTxt: ["取消", "保存"],
       },
@@ -424,7 +424,7 @@ export default {
       dialogConfig: {
         top: "8vh",
         width: "600px",
-        title: "上传试卷信息",
+        title: "新增试卷信息",
         center: true,
         btnTxt: ["取消", "保存"],
       },
@@ -697,7 +697,7 @@ export default {
         });
         return;
       }
-      this.$refs.dialog.config.title = "上传试卷信息";
+      this.$refs.dialog.config.title = "新增试卷信息";
       this.resetForm();
       let that = this;
       let params = {
@@ -745,21 +745,32 @@ export default {
                 url: item,
               };
             });
-            // console.log(this.dialogForm);
             this.dialogForm.pages = res.data.pages;
             this.$refs.dialog.open((cancel) => {
               this.dialogForm.ctype = "work";
               this.dialogForm.ctgid = res.data.category_id;
-              console.log(this.dialogForm);
               this.dialogForm.imgs = this.dialogForm.imgs.map((item) =>
                 item.url ? item.url : item
               );
-              console.log(this.dialogForm);
-              paperApi.edit(this.dialogForm).then((res) => {
-                // this.dataTable.data = res.data;
-                this.getItems(this.curTree);
-                cancel();
-              });
+              this.$refs["dialogForm"].validate((valid)=>{
+                if(valid){
+                  paperApi.edit(this.dialogForm).then((res) => {
+                    if(res.mess=="success"){
+                      this.$message({
+                        type:"success",
+                        message:"修改成功"
+                      })
+                      this.getItems(this.curTree);
+                      cancel();
+                    }else{
+                      Message({
+                        type:"error",
+                        message:res.message
+                      })
+                    }
+                  });
+                }
+              })
             });
           });
           break;