tanyanfei 1 year ago
parent
commit
0274910398

+ 17 - 6
src/views/Home.vue

@@ -5,27 +5,37 @@
 		font-size: 20px;
 		font-weight: 400;
 		position: relative;
+		width: 50%;
 		&::before{
-			content: '|';
+			// content: '|';
 			position: absolute;
 			left:-20px;
 			font-size: 14px;
 			color: #D2D2D2;
 		}
 	}
+	.logout{
+		span{
+			color: #333;
+			font-size: 16px;
+		}
+	}
 </style>
 
 <template>
 	<el-container>
 		<el-header>
 			<div class="header">
-				<span class="logout" @click="logout">退出登陆</span>
-				<el-dropdown class="logout" v-if='info.name' style="margin-right:10px;">
-					<span class="el-dropdown-link" style="color:#fff;font-size:16px;">
+				
+				<!-- <span class="logout" @click="logout">退出登陆</span> -->
+				<el-dropdown class="logout" style="margin-right:10px;">
+					<span class="el-dropdown-link">
 						{{info.name}}<i class="el-icon-arrow-down el-icon--right"></i>
 					</span>
 					<el-dropdown-menu slot="dropdown">
+						<el-dropdown-item>切换角色</el-dropdown-item>
 						<el-dropdown-item @click.native="changePsw">修改密码</el-dropdown-item>
+						<el-dropdown-item @click.native="logout">退出登陆</el-dropdown-item>
 					</el-dropdown-menu>
 				</el-dropdown>
 				<!-- <img width="128" src="../assets/logo.png" alt=""> -->
@@ -35,7 +45,7 @@
 		<el-container class="main">
 			<!-- 左侧菜单 -->
 			<el-aside class="left-aside" width="210px">
-				<el-menu  :unique-opened='false'
+				<el-menu  :unique-opened='true' :default-active="$route.path"
 					 router class="left-menue"
 					active-text-color="#FA0A2F">
 					<template v-for="(item, index) in $router.options.routes">
@@ -129,10 +139,11 @@
 				})
 			},
 			logout() {
+				console.log(2333)
 				this.$api.logout().then(res => {
 					// this.$router.push({path:'/login'})
 					this.$router.push({
-						path: '/admin'
+						path: '/'
 					})
 				})
 			},

+ 22 - 2
src/views/school/ClassList.vue

@@ -80,6 +80,11 @@
 			  size="mini"
 			  @click="handleAdd"
 			  >添加班级</el-button>
+			  <el-button
+			     type="primary"
+			     size="mini"
+			     @click="del(-1)"
+			  >批量删除</el-button>
           </el-form-item>
         </el-col>
       </el-row>
@@ -88,8 +93,9 @@
       v-loading="loading"
       :data="list"
       style="width: 100%; margin-top: 10px"
-      height="68vh"
-    >
+      height="55vh"
+    @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55"></el-table-column>
       <el-table-column align="center" prop="name" label="班级名称" />
       <el-table-column align="center" prop="grade_name" label="年级" />
       <el-table-column label="所属学校" prop="school_name"></el-table-column>
@@ -192,10 +198,24 @@ export default {
       schoolList: [],
 	  gradeList:[],
       rules: {},
+	  ids:''
     };
   },
   methods: {
+	  handleSelectionChange(val) {
+	  	const ids=[]
+	  	val.forEach(item=>{
+	  		ids.push(item.id)
+	  	})
+	  	this.ids=ids.join(',')
+	  },
     del(id) {
+		if(id==-1 && this.ids){
+			id=this.ids
+		}else{
+			this.msgInfo('请选择删除的数据');
+			return
+		}
       this.$confirm("确认删除?", "提示", {
         type: "warning",
       }).then(() => {

+ 96 - 16
src/views/school/SchoolList.vue

@@ -6,6 +6,9 @@
 			margin-right: 6px;
 		}
 	}
+	.el-input-number .el-input__inner{
+		text-align: left;
+	}
 </style>
 <template>
   <section class="content">
@@ -43,12 +46,7 @@
             <el-button type="primary" @click="getData" size="mini"
               >搜索</el-button
             >
-        <!--    <el-button
-              type="info"
-              size="mini"
-              @click="handleAdd"
-              >重置</el-button
-            > -->
+           
 			<el-button
 			  type="primary"
 			  plain 
@@ -56,6 +54,11 @@
 			  size="mini"
 			  @click="handleAdd"
 			  >添加学校</el-button>
+			<el-button
+			   type="primary"
+			   size="mini"
+			   @click="del(-1)"
+			>批量删除</el-button>
           </el-form-item>
         </el-col>
       </el-row>
@@ -64,21 +67,39 @@
       v-loading="loading"
       :data="list"
       style="width: 100%; margin-top: 10px"
-      height="68vh"
-    >
-      <el-table-column align="center" prop="name" label="学校名称" />
+      height="55vh"
+	  @selection-change="handleSelectionChange">
+	  <el-table-column type="selection" width="55"></el-table-column>
+      <el-table-column prop="name" label="学校名称" />
       <!-- <el-table-column align="center" prop="phone" label="地区" /> -->
       <el-table-column label="联系人" prop='contacts'></el-table-column>
       <el-table-column label="联系人电话" prop='contacts_phone'></el-table-column>
-      <el-table-column align="center" prop="ctime" label="创建时间" />
+	  <el-table-column label="服务时长" prop='service_date'></el-table-column>
+	  <el-table-column label="教师上限" prop='teacher_limit'></el-table-column>
+	  <el-table-column label="学生上限" prop='students_limit'></el-table-column>
+	  <el-table-column label="状态" prop=''>
+		  <template slot-scope="scope">
+			  <span v-if='scope.row.service_status'>有效</span>
+			  <span v-else>失效</span>
+		  </template>
+	  </el-table-column>
+      <el-table-column align="center" prop="ctime" label="入驻时间" />
       <el-table-column align="center" prop="date" label="操作" width="320">
         <template slot-scope="scope">
 			<el-button @click="addClass(scope.row.id)" size="mini" type="primary" plain
 			  >添加班级</el-button
 			>
-          <el-button @click="edit(scope.row)" size="mini" type="info" plain
-            >编辑</el-button
-          >
+		  <el-dropdown @command="command=>handleCommand(command,scope.row)">
+		    <el-button type="primary" @click="edit(scope.row)" size="mini" style="margin: 0 5px;">
+		      编辑<i class="el-icon-arrow-down el-icon--right"></i>
+		    </el-button>
+		    <el-dropdown-menu slot="dropdown">
+		      <el-dropdown-item command="1">一键复制</el-dropdown-item>
+		      <el-dropdown-item command="2" v-if='scope.row.service_status'>停用</el-dropdown-item>
+			  <el-dropdown-item command="2" v-else>启用</el-dropdown-item>
+		      <!-- <el-dropdown-item command="3">续期</el-dropdown-item> -->
+		    </el-dropdown-menu>
+		  </el-dropdown>
           <el-button @click="del(scope.row.id)" size="mini" type="info" plain
             >删除</el-button
           >
@@ -162,6 +183,23 @@
             placeholder="请输入联系电话"
           ></el-input>
         </el-form-item>
+		<el-form-item label="服务时长" prop="service_date">	
+		 <el-date-picker style="width: 100%;"
+		        v-model="form.service_date"
+		        type="date"
+		        placeholder="选择日期"
+		        format="yyyy 年 MM 月 dd 日"
+		        value-format="yyyy-MM-dd">
+		      </el-date-picker>
+		</el-form-item>
+		<el-form-item label="学生上限" prop="students_limit">
+			<el-input-number style="width: 100%;" v-model="form.students_limit" controls-position="right"
+			 :min="1" :max="10000"></el-input-number>
+		</el-form-item>
+		<el-form-item label="教师上限" prop="teacher_limit">
+			<el-input-number style="width: 100%;" v-model="form.teacher_limit" controls-position="right"
+			 :min="1" :max="10000"></el-input-number>
+		</el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">保存</el-button>
@@ -222,6 +260,8 @@
 	    <el-button @click="open = false">取 消</el-button>
 	  </div>
 	</el-dialog>
+  
+	<textarea id='input' style="position: absolute;z-index: -1;"></textarea>
   </section>
 </template>
 <script>
@@ -245,11 +285,49 @@ export default {
       open: false,
 	  open2: false,
       gradeList: [],
-      rules: {}
+      rules: {},
+	  ids:''
     };
   },
   methods: {
-    del(id) {
+	  handleCommand(command,info){
+		if(command == 1){
+			this.copytext="ID:"+info.id+"\n学校名称:"+info.name
+			this.copy()
+		}else if(command == 2){
+			let form={...info}
+			form.service_status=Number(!form.service_status)
+			this.$api.editSchool(form).then((res) => {
+			  if (res.data.code == 0) {
+			    this.msgSuccess("修改成功!");
+			    this.getData();
+			  } else {
+			    this.msgError(res.data.message);
+			  }
+			});
+		}
+	  },
+	  copy(){
+		      var input = document.getElementById("input");
+		      input.value = this.copytext; // 要复制的文本框的内容
+		      input.select(); // 选中文本
+		      document.execCommand("copy"); 
+			  this.msgSuccess("复制成功");
+	  },
+	  handleSelectionChange(val) {
+			const ids=[]
+			val.forEach(item=>{
+				ids.push(item.id)
+			})
+			this.ids=ids.join(',')
+		},
+      del(id) {
+		if(id==-1 && this.ids){
+			id=this.ids
+		}else{
+			this.msgInfo('请选择删除的数据');
+			return
+		}
       this.$confirm("确认删除?", "提示", {
         type: "warning",
       }).then(() => {
@@ -291,7 +369,9 @@ export default {
     handleAdd() {
       this.open = true;
       this.title = "新增学校";
-      this.form = {};
+      this.form = {
+		  service_status:1
+	  };
     },
 	addClass(id){
 		this.open2 = true;

+ 18 - 2
src/views/school/StudentList.vue

@@ -105,6 +105,7 @@
 	 			  size="mini"
 	 			  @click="handleAdd"
 	 			  >添加学生</el-button>
+		<el-button type="primary" size="mini" @click="del(-1)">批量删除</el-button>
 	 </el-form-item>
 
     </el-form>
@@ -112,8 +113,9 @@
       v-loading="loading"
       :data="list"
       style="width: 100%; margin-top: 10px"
-      height="69vh"
-    >
+      height="55vh"
+    @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55"></el-table-column>
       <el-table-column align="center" prop="name" label="学生姓名" />
       <el-table-column align="center" prop="student_no" label="学号" />
 	  <el-table-column label="性别" prop="sex"></el-table-column>
@@ -263,9 +265,17 @@ export default {
 	  gradeList:[],
 	  classList:[],
 	  classList1:[],
+	  ids:''
     };
   },
   methods: {
+	  handleSelectionChange(val) {
+	  	const ids=[]
+	  	val.forEach(item=>{
+	  		ids.push(item.id)
+	  	})
+	  	this.ids=ids.join(',')
+	  },
 	download(){
 		window.open('http://test.scxjc.club/supermark_students.xlsx')  
 	},
@@ -274,6 +284,12 @@ export default {
 		this.getData();
 	},
     del(id) {
+		if(id==-1 && this.ids){
+			id=this.ids
+		}else{
+			this.msgInfo('请选择删除的数据');
+			return
+		}
       this.$confirm("确认删除?", "提示", {
         type: "warning",
       }).then(() => {

+ 21 - 5
src/views/school/TeacherList.vue

@@ -119,8 +119,9 @@
 	 			  plain 
 	 			  icon="el-icon-plus"
 	 			  size="mini"
-	 			  @click="handleAdd"
-	 			  >添加教师</el-button>
+	 			  @click="handleAdd">
+		添加教师</el-button>
+		<el-button type="primary" size="mini" @click="del(-1)">批量删除</el-button>
 	 </el-form-item>
 
     </el-form>
@@ -128,8 +129,9 @@
       v-loading="loading"
       :data="list"
       style="width: 100%; margin-top: 10px"
-      height="65vh"
-    >
+      height="55vh"
+    @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55"></el-table-column>
       <el-table-column align="center" prop="name" label="教师名称" />
       <el-table-column align="center" prop="sex" label="性别" />
       <el-table-column label="年龄" prop="age"></el-table-column>
@@ -288,10 +290,18 @@ export default {
 	  gradeList:[],
 	  classList:[],
 	  classList1:[],
-	  subjectList:['语文','数学','英语']
+	  subjectList:['语文','数学','英语'],
+	  ids:''
     };
   },
   methods: {
+	  handleSelectionChange(val) {
+	  	const ids=[]
+	  	val.forEach(item=>{
+	  		ids.push(item.id)
+	  	})
+	  	this.ids=ids.join(',')
+	  },
 	  download(){
 	  	window.open('http://test.scxjc.club/supermark_students.xlsx')  
 	  },
@@ -300,6 +310,12 @@ export default {
 	  	this.getData();
 	  },
     del(id) {
+		if(id==-1 && this.ids){
+			id=this.ids
+		}else{
+			this.msgInfo('请选择删除的数据');
+			return
+		}
       this.$confirm("确认删除?", "提示", {
         type: "warning",
       }).then(() => {