From 0f823d771d6a876c8990ad5b7dd80c835c38c53f Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 06 六月 2024 15:52:46 +0800 Subject: [PATCH] 班级学员新增、修改 --- src/views/Manage/ClassManagement/Class.vue | 398 +++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 246 insertions(+), 152 deletions(-) diff --git a/src/views/Manage/ClassManagement/Class.vue b/src/views/Manage/ClassManagement/Class.vue index a4c8e74..db5b41d 100644 --- a/src/views/Manage/ClassManagement/Class.vue +++ b/src/views/Manage/ClassManagement/Class.vue @@ -3,36 +3,37 @@ <div class="c"> <div class="bg"> <div class="main"> - <TitleIndex title='鐝骇绠$悊' /> <div class="main-1"> <div class="main-btn flex" style="justify-content:space-between" > <div> - <s-button - colorType="deepBlue" + <el-button + type="primary" style="margin-right:20px;" - @click="$router.push('/manage/class-management/Class-staff')" - >鏂板鐝骇</s-button> + @click="handlerAdd" + >鏂板鐝骇</el-button> </div> - <div - class="flex" - style="align-items:center" - > - <p style="padding-right:10px">鎺掑簭鏂瑰紡</p> - <el-select> - <el-option></el-option> - </el-select> - <p style="margin-left:20px;margin-right: 10px;">鎵�鍦ㄥ崟浣�</p> - <el-select> - <el-option></el-option> - </el-select> - </div> + <el-form :inline="true" :model="searchForm" class="demo-form-inline"> + <el-form-item label="鐝骇鍚嶇О"> + <el-input v-model="searchForm.className" clearable @clear="page" placeholder="鐝骇鍚嶇О"></el-input> + </el-form-item> + <el-form-item label="鐝骇鐘舵��"> + <el-select v-model="searchForm.status" clearable @change="page" placeholder="鐝骇鐘舵��"> + <el-option label="姝e父" value="normal"></el-option> + <el-option label="瑙f暎" value="dissolution"></el-option> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="page">鏌ヨ</el-button> + </el-form-item> + </el-form> </div> <div> <div> <el-table + v-loading="loading" :data="tableData" border :row-style="{height:'42px'}" @@ -41,15 +42,20 @@ <el-table-column align="center" label="鐝骇" - prop="class" - width="80px" + prop="className" + width="180px" ></el-table-column> <el-table-column - label="骞寸骇" + label="鐘舵��" align="center" width="80px" - prop="grade" - ></el-table-column> + prop="status" + > + <template slot-scope="scope"> + <el-tag v-if="scope.row.status === '姝e父'" type="success">{{scope.row.status}}</el-tag> + <el-tag v-if="scope.row.status === '瑙f暎'" type="danger">{{scope.row.status}}</el-tag> + </template> + </el-table-column> <el-table-column width="100px" align="center" @@ -60,48 +66,37 @@ align="center" width="100px" label="鏁欏笀" - prop="teacher" + prop="createUserName" ></el-table-column> <el-table-column align="center" width="120px" label="鑱旂郴鐢佃瘽" - prop="phone" + prop="teacherPhone" ></el-table-column> <el-table-column width="140px" - label="鐢靛瓙閭欢" - align="center" - prop="email" - ></el-table-column> - <el-table-column - width="90px" label="寮�鐝椂闂�" align="center" - prop="openingTime" + prop="startTime" + ></el-table-column> + <el-table-column + width="140px" + label="缁撴潫鏃堕棿" + align="center" + prop="endTime" ></el-table-column> <el-table-column label="鎿嶄綔" align="center" + fixed="right" > <template slot-scope="scope"> - <el-button>鐝骇楠岃瘉</el-button> - <el-button>閫氱煡</el-button> - <el-button @click="routersTo()">鎴愬憳绠$悊</el-button> - <el-button>娣诲姞鎴愬憳</el-button> - <el-select - v-model="value" - style="width:74px;margin-left: 10px;" - placeholder="閫夋嫨" - > - <el-option - v-for="item in options" - :key="item.value" - :label="item.label" - :value="item.value" - > - </el-option> - </el-select> + <el-button size="small" @click="handlerEdit(scope.row)" type="primary">淇敼</el-button> + <el-button size="small" type="warning">鐝骇楠岃瘉</el-button> + <el-button size="small" @click="handlerOpenNotify(scope.row)" type="info">閫氱煡</el-button> + <el-button @click="studentManager(scope.row.id)" size="small" type="success">鎴愬憳绠$悊</el-button> + <el-button v-if="scope.row.status !== '瑙f暎'" @click="dissolution(scope.row.id)" type="danger" size="small">瑙f暎</el-button> </template> </el-table-column> </el-table> @@ -110,135 +105,234 @@ class="flex" style="justify-content:center;margin-top:20px;" > - <el-pagination - background - layout="prev, pager, next" - :total="1000" - > - </el-pagination> + <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageIndex" :limit.sync="searchForm.pageSize" + @pagination="page"/> </div> </div> </div> </div> </div> + + <el-dialog + title="鐝骇閫氱煡" + :visible.sync="notifyOpen" + width="600px" + :before-close="handleClose"> + <el-form :model="notifyForm" :rules="notifyRules" ref="notifyForm" label-width="100px" class="demo-ruleForm"> + <el-form-item label="閫氱煡鐝骇锛�" prop="className"> + <span>{{notifyForm.className}}</span> + </el-form-item> + <el-form-item label="閫氱煡鍐呭锛�" prop="notifyContent"> + <el-input type="textarea" v-model="notifyForm.notifyContent" size="small"></el-input> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="handleNotifyClose">鍙� 娑�</el-button> + <el-button type="primary" @click="submitNotifyForm">纭� 瀹�</el-button> + </span> + </el-dialog> + + <el-dialog + :title="title" + :visible.sync="open" + width="700px" + :before-close="handleClose"> + <el-form :model="form" :rules="rules" ref="form" label-width="100px" class="demo-ruleForm"> + <el-form-item label="鐝骇鍚嶇О" prop="className"> + <el-input v-model="form.className" size="small"></el-input> + </el-form-item> + <el-form-item label="鐝骇鏃堕棿" required> + <el-col :span="11"> + <el-form-item prop="startTime"> + <el-date-picker + v-model="form.startTime" + type="date" + value-format="yyyy-MM-dd" + placeholder="寮�濮嬫棩鏈�"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col class="line" :span="2">-</el-col> + <el-col :span="11"> + <el-form-item prop="endTime"> + <el-date-picker + v-model="form.endTime" + type="date" + value-format="yyyy-MM-dd" + placeholder="缁撴潫鏃ユ湡"> + </el-date-picker> + </el-form-item> + </el-col> + </el-form-item> + + <el-form-item label="澶囨敞淇℃伅" prop="remark"> + <el-input type="textarea" v-model="form.remark" size="small"></el-input> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="handleClose">鍙� 娑�</el-button> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + </span> + </el-dialog> + </div> </template> <script> +import { addClasses, editClasses, getClassess, dissolution } from "@/api/classes"; +import { addClassesNotify } from "@/api/classesNotify"; +import Pagination from "@/components/Pagination" export default { + components: {Pagination}, data() { return { + notifyOpen: false, + notifyForm: { + className: '', + notifyContent: '', + classesId: null + }, + loading: true, + total: 0, + open: false, + title: "", value: "", - searchData: { + searchForm: { + className:'', + status: '', subject: null, + pageSize: 10, + pageNum: 1 + }, + form: { + id: null, + className: "", + status: "", + verifyStatus: "", + startTime: null, + endTime: null, + remark: "" + }, + notifyRules: { + notifyContent: [ + { required: true, message: '璇疯緭鍏ラ�氱煡鍐呭', trigger: 'blur' }, + { min: 1, max: 500, message: '闀垮害鍦� 1 鍒� 500 涓瓧绗�', trigger: 'blur' } + ], + }, + rules: { + className: [ + { required: true, message: '璇疯緭鍏ョ彮绾у悕绉�', trigger: 'blur' }, + { min: 1, max: 30, message: '闀垮害鍦� 1 鍒� 30 涓瓧绗�', trigger: 'blur' } + ], + startTime: [ + { required: true, message: '璇烽�夋嫨鐝骇寮�濮嬫椂闂�', trigger: 'change' }, + ], + endTime: [ + { required: true, message: '璇烽�夋嫨鐝骇缁撴潫鏃堕棿', trigger: 'change' }, + ], }, tableData: [ - { - class: "杞欢宸ョ▼", - grade: "2019绾�", - unit: "铻轰笣閮�", - teacher: "绉嬫ⅷ鑶�", - phone: "182-9384-9302", - email: "info@exaple.com", - openingTime: "2022/3/29", - }, - { - class: "杞欢宸ョ▼", - grade: "2019绾�", - unit: "铻轰笣閮�", - teacher: "绉嬫ⅷ鑶�", - phone: "182-9384-9302", - email: "info@exaple.com", - openingTime: "2022/3/29", - }, - { - class: "杞欢宸ョ▼", - grade: "2019绾�", - unit: "铻轰笣閮�", - teacher: "绉嬫ⅷ鑶�", - phone: "182-9384-9302", - email: "info@exaple.com", - openingTime: "2022/3/29", - }, - { - class: "杞欢宸ョ▼", - grade: "2019绾�", - unit: "铻轰笣閮�", - teacher: "绉嬫ⅷ鑶�", - phone: "182-9384-9302", - email: "info@exaple.com", - openingTime: "2022/3/29", - }, - { - class: "杞欢宸ョ▼", - grade: "2019绾�", - unit: "铻轰笣閮�", - teacher: "绉嬫ⅷ鑶�", - phone: "182-9384-9302", - email: "info@exaple.com", - openingTime: "2022/3/29", - }, - { - class: "杞欢宸ョ▼", - grade: "2019绾�", - unit: "铻轰笣閮�", - teacher: "绉嬫ⅷ鑶�", - phone: "182-9384-9302", - email: "info@exaple.com", - openingTime: "2022/3/29", - }, - { - class: "杞欢宸ョ▼", - grade: "2019绾�", - unit: "铻轰笣閮�", - teacher: "绉嬫ⅷ鑶�", - phone: "182-9384-9302", - email: "info@exaple.com", - openingTime: "2022/3/29", - }, - { - class: "杞欢宸ョ▼", - grade: "2019绾�", - unit: "铻轰笣閮�", - teacher: "绉嬫ⅷ鑶�", - phone: "182-9384-9302", - email: "info@exaple.com", - openingTime: "2022/3/29", - }, - { - class: "杞欢宸ョ▼", - grade: "2019绾�", - unit: "铻轰笣閮�", - teacher: "绉嬫ⅷ鑶�", - phone: "182-9384-9302", - email: "info@exaple.com", - openingTime: "2022/3/29", - }, + ], - pageData: { - size: 7, - page: 1, - }, }; }, methods: { - // // 鏌ョ湅璇︽儏 - // detailsTo() { - // this.$router.push({ - // name: "teacherDetail", - // }); - // }, - // 璺宠浆(鏌ョ湅鐝骇浜哄憳鎯呭喌) - routersTo() { - this.$router.push({ - name: "ClassStaff", + handlerOpenNotify(row) { + this.notifyOpen = true + this.notifyForm.className = row.className + this.notifyForm.classesId = row.id + }, + submitNotifyForm() { + this.$refs['notifyForm'].validate((valid) => { + if (valid) { + let _this = this + addClassesNotify(_this.notifyForm).then(res => { + this.$message.success(res.data.message) + this.notifyOpen = false + this.clearNotifyForm() + }) + } + }) + }, + clearNotifyForm() { + this.notifyForm = { + className: '', + notifyContent: '' + } + }, + handleNotifyClose() { + this.notifyOpen = false + this.clearNotifyForm() + }, + page() { + getClassess(this.searchForm).then(res => { + this.tableData = res.data.data + this.total = res.data.total + this.loading = false + }) + }, + resetForm() { + this.form = { + id: null, + className: "", + status: "", + verifyStatus: "", + startTime: null, + endTime: null, + remark: "" + } + }, + submitForm() { + this.$refs['form'].validate((valid) => { + if (valid) { + if (this.form.id) { + editClasses(this.form).then(res => { + this.$message.success("淇敼鎴愬姛") + this.resetForm() + this.open = false + }) + } else { + addClasses(this.form).then(res => { + this.$message.success("娣诲姞鐝骇鎴愬姛") + this.resetForm() + this.open = false + }) + } + } else { + return false; + } }); + }, + dissolution(id) { + dissolution(id).then(res => { + this.$message.success(res.data.message) + this.page() + }) + }, + handlerEdit(row) { + this.form = row; + this.open = true + }, + handleClose() { + this.open = false + this.resetForm() + }, + handlerAdd() { + this.open = true + this.title = "鏂板鐝骇" + }, + // 璺宠浆(鏌ョ湅鐝骇浜哄憳鎯呭喌) + studentManager(classesId) { + this.$router.push({ path: "class-management/Class-staff", query: { classesId: classesId } }); }, // 杩斿洖涓婁竴涓〉闈� goBack() { this.$router.back(); }, + }, + created() { + this.page() }, }; </script> @@ -287,4 +381,4 @@ background-color: rgb(45, 92, 248); } } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0