yujialong 5 hours ago
parent 10e03b909f
commit 04ecdd22d8
  1. 2
      src/api/index.js
  2. 49
      src/layouts/home/index.vue
  3. 28
      src/pages/student/list/index.vue
  4. 145
      src/pages/system/list/staff.vue

@ -14,6 +14,8 @@ export default {
heartbeatDetection: `nakadai/message/heartbeatDetection`,
encrypt: `nakadai/data/encrypt`,
logout: `users/users/user/logout`,
checkUserNameOrWorkNumber: `users/users/batchProcessing/checkUserNameOrWorkNumber`,
updateUserNameOrWorkNumber: `users/users/batchProcessing/updateUserNameOrWorkNumber`,
getPlayAuth: `nakadai/nakadai/oss/getPlayAuth`, // 获取播放凭证

@ -38,6 +38,21 @@
</div>
</div>
</div>
<el-dialog title="" :visible.sync="realNameVisible" :close-on-click-modal="false" :close-on-press-escape="false"
:show-close="false" width="300px" custom-class="name-dia">
<el-form ref="realNameForm" :model="realNameForm" :rules="realNameRules" label-width="80px">
<el-form-item label="姓名" prop="userName">
<el-input v-model.trim="realNameForm.userName" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item label="工号" prop="workNumber">
<el-input v-model.trim="realNameForm.workNumber" placeholder="请输入工号"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="realNameSubmit"> </el-button>
</span>
</el-dialog>
</div>
</template>
@ -71,7 +86,18 @@ export default {
name: '优化',
icon: 'optimize'
}
]
],
realNameVisible: false,
realNameForm: {
userName: '',
workNumber: '',
},
realNameRules: {
userName: [
{ required: true, message: '请输入真实姓名', trigger: 'blur' }
],
},
};
},
components: {
@ -87,6 +113,7 @@ export default {
mounted () {
this.autoLogout()
this.logView || this.getLogStatus() // logViewfalse
this.handleRealName()
},
methods: {
...mapMutations("user", [
@ -95,6 +122,14 @@ export default {
...mapActions("user", [
"logout"
]),
//
async handleRealName () {
const res = await this.$post(this.api.checkUserNameOrWorkNumber)
//
if (!res.hasName) {
this.realNameVisible = true
}
},
//
getLog () {
this.$get(`${this.api.platformLogList}?platformId=${Setting.platformId}&port=1&versionName=`).then(({ logList }) => {
@ -118,6 +153,18 @@ export default {
}
}).catch(res => { })
},
//
realNameSubmit () {
this.$refs.realNameForm.validate(async (valid) => {
if (valid) {
const form = this.realNameForm
await this.$post(`${this.api.updateUserNameOrWorkNumber}?userName=${form.userName}&workNumber=${form.workNumber}`)
this.realNameVisible = false
} else {
return false
}
})
},
// ,退
autoLogout () {
let lastTime = new Date().getTime();

@ -188,7 +188,8 @@
<el-dialog title="一键批量生成账号" :visible.sync="generateVisible" :close-on-click-modal="false" width="400px">
<el-form ref="generateForm" :model="generateForm" :rules="generateRules" label-width="100px">
<el-form-item label="所属班级" prop="classId">
<el-cascader v-model="generateForm.classId" :props="cascaderProps" clearable style="width: 100%">
<el-cascader v-model="generateForm.classId" :options="allClass" :props="classProps" clearable
style="width: 100%">
</el-cascader>
</el-form-item>
<el-form-item label="账号数" prop="numberOfUsers">
@ -205,8 +206,8 @@
</template>
<script>
import Util from "@/libs/util";
import Setting from "@/setting";
import Util from '@/libs/util'
import Setting from '@/setting'
import OrgTree from "@/components/org-tree/src/tree";
import { mapState } from "vuex";
import _ from 'lodash'
@ -335,14 +336,21 @@ export default {
submiting: false, //
generateVisible: false,
allClass: [],
classProps: {
checkStrictly: true,
label: "organizationName",
value: "id",
},
generateForm: {
classId: [],
numberOfUsers: '',
},
generateRules: {
classId: [
{ required: true, message: '请选择所属班级', trigger: 'change' }
],
// classId: [
// { required: true, message: '', trigger: 'change' }
// ],
numberOfUsers: [
{ required: true, message: '请输入账号数', trigger: 'blur' }
],
@ -356,7 +364,7 @@ export default {
},
mounted () {
this.originForm = JSON.parse(JSON.stringify(this.form))
this.getData();
this.getData()
},
watch: {
keyWord: function (val) {
@ -558,6 +566,11 @@ export default {
this.total = res.total;
}).catch(err => { });
},
//
async getClass () {
const res = await this.$post(this.api.treeList)
this.allClass = res.treeList
},
getData () { //
this.$post(this.api.studentList, {
type: this.studentType,
@ -688,6 +701,7 @@ export default {
},
//
batchGenerate () {
this.getClass()
this.generateForm = {
classId: [],
numberOfUsers: '',

@ -13,6 +13,7 @@
</li>
</ul>
<div>
<el-button type="info" @click="batchGenerate">一键批量生成账号</el-button>
<el-button v-auth="'教师管理:新增教师'" type="info" round @click="addTeacher">新增教师</el-button>
<el-button v-auth="'教师管理:批量导入'" type="primary" round @click="batchImport">批量导入</el-button>
<el-button v-auth="'教师管理:批量删除'" type="primary" round @click="delAllSelection">批量删除</el-button>
@ -23,12 +24,15 @@
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
<el-table-column prop="account" label="账号" align="center"></el-table-column>
<el-table-column prop="userName" label="教师姓名" align="center"></el-table-column>
<el-table-column prop="workNumber" label="教师工号" align="center"></el-table-column>
<el-table-column prop="dept" label="部门" align="center"></el-table-column>
<el-table-column prop="phone" label="手机号" align="center"></el-table-column>
<el-table-column prop="email" label="邮箱" align="center"></el-table-column>
<el-table-column prop="roleName" label="账号角色" align="center"></el-table-column>
<el-table-column prop="logInNumber" label="登录次数" align="center"></el-table-column>
<el-table-column prop="lastLoginTime" label="上次登录时间" align="center"></el-table-column>
<el-table-column prop="lastLoginTime" label="上次登录时间" width="160" align="center"></el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button v-auth="'教师管理:教师查看'" type="text" @click="showTeacher(scope.row)">查看</el-button>
@ -49,11 +53,14 @@
<el-form ref="form" :model="form" :rules="rules" label-width="150px" :disabled="isDetail"
style='margin-right: 80px;'>
<el-form-item prop="workNumber" label="工号">
<el-input v-model.trim="form.workNumber" placeholder="请输入教师工号" @blur="workNumberChange"></el-input>
<el-input v-model.trim="form.workNumber" placeholder="请输入教师工号"></el-input>
</el-form-item>
<el-form-item prop="userName" label="用户姓名">
<el-input v-model.trim="form.userName" placeholder="请输入教师姓名"></el-input>
</el-form-item>
<el-form-item v-if="form.accountId" label="账号">
{{ form.account }}
</el-form-item>
<el-form-item prop="roleValue" label="账号角色">
<el-select v-model="form.roleValue" @change="roleChange" @remove-tag="roleRemove" multiple
style="width: 100%;height: 32px">
@ -61,9 +68,6 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="uniqueIdentification" label="唯一标识">
<el-input disabled v-model.trim="form.uniqueIdentification" placeholder="请输入教师工号获取唯一标识"></el-input>
</el-form-item>
<el-form-item v-for="item in form.roleAndDeptList" :label="`${item.roleName}所属部门`" :rules="{
required: true, message: '请选择', trigger: 'change'
}">
@ -100,19 +104,42 @@
<el-button type="primary" @click="uploadSure"> </el-button>
</span>
</el-dialog>
<el-dialog title="一键批量生成账号" :visible.sync="generateVisible" :close-on-click-modal="false" width="400px">
<el-form ref="generateForm" :model="generateForm" :rules="generateRules" label-width="110px">
<el-form-item prop="roleId" label="账号角色">
<el-select v-model="generateForm.roleId" style="width: 100%;height: 32px">
<el-option v-for="item in roleList" :key="item.id" :label="item.roleName" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="老师所属部门" prop="dep">
<el-cascader v-model="generateForm.dep" :options="orgList" :props="casProps"
style="width: 100%"></el-cascader>
</el-form-item>
<el-form-item label="账号数" prop="numberOfUsers">
<el-input v-model.trim="generateForm.numberOfUsers" placeholder="请输入账号数"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="generateVisible = false"> </el-button>
<el-button type="primary" @click="generateSubmit"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import Setting from "@/setting";
import util from "@/libs/util";
import Util from '@/libs/util'
import Setting from '@/setting'
import org from "./staffSide"
import { mapState } from "vuex";
import _ from 'lodash'
export default {
data () {
return {
exportCode: "",
headers: {
token: util.local.get(Setting.tokenKey)
token: Util.local.get(Setting.tokenKey)
},
isDetail: false,
isAdd: false,
@ -147,7 +174,6 @@ export default {
{ required: true, message: "请选择账号角色", trigger: "change" }
],
workNumber: [
{ required: true, message: "请输入工号", trigger: 'blur' },
{
pattern: /^[A-Za-z0-9]*$/,
message: "教师工号必须为数字或英文",
@ -185,7 +211,25 @@ export default {
gradeId: "", // ID
staffArchitectureId: "", // ID
submiting: false //
submiting: false, //
generateVisible: false,
generateForm: {
roleId: '',
dep: [],
numberOfUsers: '',
},
generateRules: {
roleId: [
{ required: true, message: '请选择账号角色', trigger: 'change' }
],
dep: [
{ required: true, message: '请选择老师所属部门', trigger: 'change' }
],
numberOfUsers: [
{ required: true, message: '请输入账号数', trigger: 'blur' }
],
},
};
},
components: {
@ -271,6 +315,39 @@ export default {
this.$refs.form.clearValidate();
this.teacherVisible = false;
},
//
batchGenerate () {
this.generateForm = {
roleId: '',
dep: [],
numberOfUsers: '',
}
this.generateVisible = true
},
//
generateSubmit () {
this.$refs.generateForm.validate(async (valid) => {
if (valid) {
const form = _.cloneDeep(this.generateForm)
const { dep } = form
if (dep && dep.length) {
form.staffArchitectureId = dep[0]
if (dep.length > 1) form.gradeId = dep[dep.length - 1]
}
debugger
await this.$post(this.api.generate, {
...form,
platformId: Setting.platformId,
type: 2,
})
this.generateVisible = false
Util.successMsg('批量生成成功!')
this.initData()
} else {
return false;
}
})
},
addTeacher () { //
this.isDetail = false;
this.isAdd = true;
@ -292,7 +369,7 @@ export default {
resetPassword (row) { //
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => {
this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=1122aa`).then(res => {
util.successMsg("重置成功");
Util.successMsg("重置成功");
}).catch(res => {
});
}).catch(() => {
@ -312,28 +389,6 @@ export default {
this.orgList = this.$refs.org.orgList;
this.getStaffDetail(row.accountId);
},
//
renderAccount () {
const form = this.form
// id-id-schoolId-workNumber
form.account = `${Setting.platformId}-0-${this.schoolId}-${form.workNumber}`
},
workNumberChange () { //
const form = this.form
const { workNumber, accountId } = form
if (workNumber) {
this.$post(`${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}${accountId ? `&accountId=${form.accountId}` : ''}&workNumber=${workNumber}&account=`).then(res => {
if (res.status === 200) {
this.workNumberReapeat = false
this.renderAccount()
}
}).catch(err => {
this.workNumberReapeat = true
})
} else {
this.renderAccount()
}
},
phoneChange () { //
let regex = /^1[3456789]\d{9}$/;
if (regex.test(this.form.phone)) {
@ -406,9 +461,9 @@ export default {
this.$refs[form].validate((valid) => {
if (valid) {
if (this.submiting) return false
if (this.workNumberReapeat) return util.errorMsg('工号/学号已存在!');
if (this.phoneRepeat) return util.errorMsg("该手机号已存在");
if (this.emailRepeat) return util.errorMsg("该邮箱已存在");
if (this.workNumberReapeat) return Util.errorMsg('工号/学号已存在!');
if (this.phoneRepeat) return Util.errorMsg("该手机号已存在");
if (this.emailRepeat) return Util.errorMsg("该邮箱已存在");
let data = {
accountId: this.form.accountId,
account: this.form.account,
@ -422,7 +477,7 @@ export default {
if (this.form.roleAndDeptList.length) {
for (let i = 0; i < this.form.roleAndDeptList.length; i++) {
if (this.form.roleAndDeptList[i].cascaderValue.length < 2) {
util.warningMsg(`请选择${this.form.roleAndDeptList[i].roleName}所属部门`)
Util.warningMsg(`请选择${this.form.roleAndDeptList[i].roleName}所属部门`)
return;
} else {
let obj = {
@ -437,7 +492,7 @@ export default {
this.submiting = true
if (this.form.accountId) {
this.$post(this.api.modifyStaff, data).then(res => {
util.successMsg("编辑成功");
Util.successMsg("编辑成功");
this.closeTeacher();
this.getData();
this.submiting = false
@ -446,7 +501,7 @@ export default {
});
} else {
this.$post(this.api.saveStaff, data).then(res => {
util.successMsg("添加成功");
Util.successMsg("添加成功");
this.closeTeacher();
this.getData();
this.submiting = false
@ -464,7 +519,7 @@ export default {
type: "warning"
}).then(() => {
this.$post(`${this.api.delStaff}?accountIds=${row.accountId}`).then(res => {
util.successMsg("删除成功");
Util.successMsg("删除成功");
this.getData();
}).catch(res => { });
}).catch(() => { });
@ -484,14 +539,14 @@ export default {
this.$post(`${this.api.delStaff}?accountIds=${ids.toString()}`).then(res => {
this.multipleSelection = [];
this.$refs.table.clearSelection();
util.successMsg("删除成功");
Util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
}).catch(() => {
});
} else {
util.errorMsg("请先选择教师 !");
Util.errorMsg("请先选择教师 !");
}
},
batchImport () {
@ -515,7 +570,7 @@ export default {
},
//
handleExceed (files, fileList) {
util.warningMsg(
Util.warningMsg(
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
);
},
@ -527,9 +582,9 @@ export default {
this.exportCode = res.data.exportCode;
this.uploadFaild = true;
}
util.successMsg(`上传成功${res.data.successNum},上传失败${res.data.failureNum}`);
Util.successMsg(`上传成功${res.data.successNum},上传失败${res.data.failureNum}`);
} else {
res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据");
res.message ? Util.errorMsg(res.message) : Util.errorMsg("上传失败,请检查数据");
}
},
uploadError (err, file, fileList) {

Loading…
Cancel
Save