后台账号联调及bug修复

dev_2022-03-03
yujialong 3 years ago
parent f4850af50f
commit e312e8e4ba
  1. 3
      src/assets/css/main.css
  2. 1
      src/utils/api.js
  3. 2
      src/views/course/contentSettings.vue
  4. 22
      src/views/data/Framework.vue
  5. 1
      src/views/data/Introduce.vue
  6. 11
      src/views/data/Product.vue
  7. 9
      src/views/serve/Configure.vue
  8. 39
      src/views/system/addLog.vue
  9. 20
      src/views/system/manageLog.vue
  10. 2
      src/views/system/role.vue
  11. 612
      src/views/system/staff.vue

@ -315,9 +315,6 @@ li {
font-size: 16px;
font-weight: normal;
}
#app .el-select{
display: unset;
}
/*flex*/
.flex-center{

@ -238,4 +238,5 @@ export default {
logManagementList: `nakadai/log/logManagementList`,
platformLogList: `nakadai/log/platformLogList`,
listUpdate: `nakadai/log/update`,
checkRepeat: `${host1}/nakadai/log/checkRepeat`,
};

@ -13,7 +13,7 @@
<div class="btns">
<template v-if="!sorting">
<el-button type="primary" round @click="addChapter" v-auth="'/curriculum:内容设置:添加章节'">添加章节</el-button>
<el-button type="primary" round @click="sort" v-auth="'/curriculum:内容设置:编辑序'">编辑顺序</el-button>
<el-button type="primary" round @click="sort" v-auth="'/curriculum:内容设置:编辑序'">编辑顺序</el-button>
</template>
<template v-else>
<el-button type="primary" round @click="cancelSort">取消</el-button>

@ -5,7 +5,7 @@
<div class="plus">
<i class="el-icon-circle-plus-outline" @click.stop="addType(0)"></i>
</div>
<el-tree ref="type" :data="typeList" node-key="id" accordion :default-expanded-keys="defaultActive" :current-node-key="categoryId" :props="defaultProps" :highlight-current="true" @current-change="typeClick">
<el-tree ref="type" :data="typeList" node-key="id" accordion :default-expanded-keys="defaultActive" :current-node-key="categoryId" :props="defaultProps" :highlight-current="true" v-loading="loadingType" @current-change="typeClick">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span :title="node.label">{{ node.label }}</span>
<span class="actions">
@ -65,7 +65,7 @@
<el-dialog title="导入" :visible.sync="importVisible" width="80%" center @close="closeImport" class="dialog" :close-on-click-modal="false">
<el-container style="padding: 20px 0 20px 20px;background-color: #f0f0f0;">
<div style="overflow:auto;height: 558px;width:330px;padding:15px;background:#fff" ref="typeTreeWrap" @scroll="loadType">
<el-tree
<el-tree v-loading="importLoading"
ref="typeTree"
:data="importTypeList"
node-key="id"
@ -155,6 +155,7 @@ import { Loading } from 'element-ui'
export default {
data() {
return {
loadingType: false,
typeList: [],
defaultProps: {
children: 'children',
@ -177,7 +178,7 @@ export default {
pageSize: 10,
total: 0,
multipleSelection: [],
importLoading: null,
importLoading: false,
tablePromises: [],
importTypeList: [],
fieldData: [],
@ -218,6 +219,7 @@ export default {
methods: {
//
getType(){
this.loadingType = true
this.$post(this.api.getTableByClassification).then(res => {
// ,
function handleId(data,level = 0){
@ -232,6 +234,7 @@ export default {
}
handleId(res)
this.typeList = res
this.loadingType = false
// addEd
if (!this.addEd) {
if(res[0].children.length){ //
@ -520,9 +523,8 @@ export default {
},
//
batchImport(){
this.importLoading = Loading.service({
background: 'rgba(255, 255, 255, .5)'
})
this.importLoading = true
this.importVisible = true
//
this.$post(this.api.originalList).then(res => {
// idlabelnamekeylabelnamekey
@ -567,14 +569,13 @@ export default {
Promise.all(this.tablePromises).then(_ => {
handleDisabled(res)
this.importTypeList = res
this.importLoading.close()
this.importVisible = true
this.importLoading = false
})
}).catch(res => {
this.importLoading.close()
this.importLoading = false
})
}).catch(res => {
this.importLoading.close()
this.importLoading = false
})
},
//
@ -738,6 +739,7 @@ export default {
<style lang="scss" scoped>
.wrap {
display: flex;
height: calc(100vh - 223px);
padding: 0 24px;
.side {
width: 300px;

@ -212,6 +212,7 @@ export default {
<style lang="scss" scoped>
.wrap {
display: flex;
height: calc(100vh - 223px);
padding: 0 24px;
.side {
width: 300px;

@ -52,7 +52,7 @@
</div>
<el-dialog :title="isDetail ? '查看产品' : (id ? '编辑产品' : '新增产品')" :visible.sync="productVisible" width="600px" center @close="closeProduct" class="dialog" :close-on-click-modal="false">
<el-form ref="form" label-width="98px" :disabled="isDetail">
<el-form ref="form" label-width="98px" :disabled="isDetail" v-loading="loading">
<el-form-item label="数据产品名称">
<el-input v-model="productName" placeholder="请输入数据产品名称"></el-input>
</el-form-item>
@ -166,6 +166,7 @@ export default {
productName: '',
market: '',
typeList: [],
loading: false,
defaultProps: {
children: 'children',
label: 'label'
@ -263,6 +264,7 @@ export default {
},
//
getType(queryDetail){
this.loading = true
this.productVisible = true
this.$post(this.api.getTableByClassification).then(res => {
const that = this
@ -297,7 +299,7 @@ export default {
setTimeout(() => {
this.typeList = res
queryDetail && this.getDetail()
queryDetail ? this.getDetail() : (this.loading = false)
},500)
this.importVisible = true
}).catch(res => {})
@ -371,7 +373,10 @@ export default {
this.market = data.market
this.checkedIds = data.tableId.split(',')
this.$refs.type.setCheckedKeys(this.checkedIds) //
}).catch(res => {})
this.loading = false
}).catch(res => {
this.loading = false
})
},
//
add(){

@ -66,7 +66,7 @@
</el-table-column>
<el-table-column prop="payamount" label="系统后台" align="center">
<template slot-scope="scope">
<el-button type="text" @click="toBackstage(scope.row)" v-auth="'/configure:系统后台进入'">进入</el-button>
<el-button type="text" @click="toBackstage(scope.row)" v-if="scope.row.systemId !== '11'" v-auth="'/configure:系统后台进入'">进入</el-button>
</template>
</el-table-column>
<el-table-column prop="payamount" label="项目系统" align="center">
@ -79,13 +79,6 @@
<el-button type="text" @click="getIntoJudgement(scope.row)" v-auth="'/configure:判分系统进入'">进入</el-button>
</template>
</el-table-column>
<!--
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
</template>
</el-table-column>
-->
</el-table>
<div class="pagination">
<el-pagination background @current-change="handleCurrentChange"

@ -16,8 +16,8 @@
<el-card class="page" shadow="hover">
<el-form class="form" ref="form" label-width="120px" center>
<el-form-item label="版本标题">
<el-input placeholder="请输入版本标题" v-model="form.versionName" maxlength="30" style="width: 400px"></el-input>
<el-form-item class="required" label="版本标题">
<el-input placeholder="请输入版本标题" v-model="form.versionName" maxlength="30" style="width: 400px" @change="nameChange"></el-input>
</el-form-item>
<el-form-item label="封面图片">
<el-upload
@ -40,7 +40,7 @@
</div>
</el-upload>
</el-form-item>
<el-form-item label="更新内容">
<el-form-item class="required" label="更新内容">
<ul class="contents">
<li v-for="(item, i) in form.logContents" :key="i">
<div class="action">
@ -72,6 +72,7 @@
</template>
<script>
import Setting from '@/setting'
export default {
data() {
return {
@ -95,6 +96,8 @@ export default {
name: '优化'
}
],
nameRepeat: false,
originName: '',
form: {
versionName: '',
coverUrl: '',
@ -115,11 +118,26 @@ export default {
getData() {
this.$get(`${this.api.logGet}?logId=${this.id}`).then(res => {
const { log } = res
this.form.versionName = log.versionName
this.form.coverUrl = log.coverUrl
this.form.logContents = log.logContents.length ? log.logContents : [JSON.parse(JSON.stringify(this.originContent))]
this.form = {
versionName: log.versionName,
coverUrl: log.coverUrl,
logContents: log.logContents.length ? log.logContents : [JSON.parse(JSON.stringify(this.originContent))]
}
this.originName = log.versionName
}).catch(res => {})
},
//
nameChange(val) {
if (this.originName === val) {
this.nameRepeat = false
} else {
this.$get(`${this.api.checkRepeat}?platformId=${this.platformId}&versionName=${val}`).then(res => {
this.nameRepeat = false
}).catch(res => {
this.nameRepeat = true
})
}
},
//
add() {
this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
@ -156,6 +174,7 @@ export default {
const { versionName, logContents } = this.form
const id = this.id
if (!versionName) return this.$message.error('请输入版本标题')
if (this.nameRepeat) return this.$message.error('版本名称已存在!')
if (!logContents.length || !logContents.find(e => e.type !== '' && e.content)) return this.$message.error('请输入更新内容')
this.submiting = true
const data = {
@ -192,6 +211,14 @@ export default {
display: flex;
justify-content: center;
min-height: calc(100vh - 310px);
/deep/.required {
label:before {
content: '*';
margin-right: 5px;
vertical-align: middle;
color: #f00;
}
}
}
$avatar-width: 104px;
/deep/ .avatar-uploader {

@ -186,6 +186,7 @@ export default {
}
.tool {
padding-bottom: 20px;
margin-bottom: 0;
border-bottom: 1px solid #f0f0f0;
}
.filters {
@ -198,13 +199,17 @@ export default {
}
/deep/.timeline {
margin-left: 20%;
.el-timeline-item__node--normal {
top: 30px;
}
.el-timeline-item__wrapper {
top: 15px;
padding-left: 40px;
}
.sign {
position: relative;
display: inline-block;
margin: -11px 0 0 -22%;
margin-left: -22%;
font-size: 14px;
color: #9076FF;
}
@ -217,10 +222,11 @@ export default {
display: flex;
justify-content: space-between;
align-items: center;
margin: -22px 0 20px;
padding-bottom: 10px;
margin: -19px 0 20px;
font-size: 18px;
color: #9076FF;
cursor: pointer;
border-bottom: 1px dashed #bfbfbf;
}
.action {
margin-left: 15px;
@ -242,25 +248,27 @@ export default {
display: flex;
align-items: center;
margin-bottom: 5px;
font-size: 14px;
color: #9984f1;
font-size: 15px;
font-weight: 600;
img {
width: 20px;
margin-right: 5px;
}
}
.val {
font-size: 15px;
font-size: 14px;
line-height: 1.8;
white-space: pre-wrap;
p {
position: relative;
color: #6a6a6a;
&:before {
content: '';
display: inline-block;
width: 5px;
height: 5px;
margin: 0 10px 0 5px;
vertical-align: middle;
border-radius: 20px;
background-color: #c5b8ff;
}

@ -246,7 +246,7 @@ export default {
let data = {
...this.form,
permissionId,
platformId:1,
platformId: Setting.platformId,
};
if (this.form.id) {
this.$post(this.api.saveOrUpdate, data).then(res => {

@ -4,20 +4,20 @@
<el-col :span="4">
<div class="page">
<div class="m-b-20">
<h6 class="p-title">学生</h6>
<el-radio-group v-model="studentType" @change="changeStudentType">
<h6 class="p-title">后台员工账号</h6>
<el-radio-group v-model="studentType" @change="initData">
<div class="m-b-20">
<el-radio :label="1">所有学生</el-radio>
<el-radio :label="1">所有员工</el-radio>
</div>
<div>
<el-radio :label="2">未加入班级的学生</el-radio>
<el-radio :label="2">未加入部门的员工</el-radio>
</div>
</el-radio-group>
</div>
<el-divider></el-divider>
<div>
<div class="flex-between">
<h6 class="p-title" style="margin-bottom: 0">学生组织架构</h6>
<h6 class="p-title" style="margin-bottom: 0">组织架构</h6>
<el-button type="text" @click="addOrg">添加</el-button>
</div>
@ -89,42 +89,31 @@
<div class="tool">
<ul class="filter">
<li>
<el-input style="width: 250px;" placeholder="请输入学生姓名/学号/账号" prefix-icon="el-icon-search" v-model="keyWord" clearable></el-input>
<el-input style="width: 250px;" placeholder="请输入员工姓名/手机号" prefix-icon="el-icon-search" v-model="keyWord" clearable></el-input>
</li>
</ul>
<div>
<el-button type="primary" @click="addStudent">新增学生</el-button>
<el-button type="primary" @click="addStaff">新增员工</el-button>
<el-button type="primary" @click="batchImport">批量导入</el-button>
<el-button type="primary" @click="delAllSelection">批量删除</el-button>
</div>
</div>
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys">
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="accountId">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column prop="userName" label="学生姓名" align="center" min-width="100"></el-table-column>
<el-table-column prop="workNumber" label="学生学号" align="center" min-width="100"></el-table-column>
<el-table-column prop="className" label="班级" align="center" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column prop="userName" label="员工姓名" align="center" min-width="100"></el-table-column>
<el-table-column prop="account" label="账号" align="center" min-width="100"></el-table-column>
<el-table-column prop="countries" label="账号角色" align="center" width="100">
<template slot-scope="scope">学生</template>
<el-table-column prop="className" label="手机号" align="center" width="120"></el-table-column>
<el-table-column prop="loginNumber" label="所在部门" align="center" min-width="100"></el-table-column>
<el-table-column prop="countries" label="授权角色" align="center" width="100">
<template slot-scope="scope">员工</template>
</el-table-column>
<el-table-column prop="loginNumber" label="登录次数" align="center" width="100"></el-table-column>
<el-table-column prop="lastLoginTime" label="上次登录时间" align="center" width="120"></el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button v-if="isRemove" type="text" @click="removeStudent(scope.row)">移除</el-button>
<el-button type="text" @click="editStudent(scope.row,true)">查看</el-button>
<el-button type="text" @click="editStudent(scope.row,false)">编辑</el-button>
<el-button type="text" @click="editStaff(scope.row,true)">查看</el-button>
<el-button type="text" @click="editStaff(scope.row,false)">编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-switch
v-model="scope.row.isEnable"
:active-value="1"
:inactive-value="0"
style="margin: 0 5px"
@change="switchOff(scope.row)"
></el-switch>
<el-button type="text" @click="delStaff(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -132,84 +121,48 @@
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination>
</div>
<el-dialog
class="dialog"
width="60%"
:title="isDetail ? '查看学生' : (isAdd ? '新增学生' : '编辑学生')"
:visible.sync="studentVisible"
:close-on-click-modal="false"
@close="closeStudent"
>
<el-form ref="form" :model="form" :rules="rules" :disabled="isDetail" label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item prop="workNumber" label="学生学号">
<el-input v-model="form.workNumber" placeholder="学生学号"></el-input>
</el-form-item>
<el-form-item prop="userName" label="学生姓名">
<el-input v-model="form.userName" placeholder="请输入学生姓名"></el-input>
<el-dialog :title="isDetail ? '查看' : (form.accountId ? '编辑' : '新增') + '员工'" :visible.sync="staffVisible" width="580px" class="dialog" :close-on-click-modal="false">
<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="请输入工号"></el-input>
</el-form-item>
<el-form-item prop="roleId" label="账号角色">
学生
<el-form-item prop="userName" label="姓名">
<el-input v-model.trim="form.userName" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item prop="account" label="学生账号">
<el-input v-model="form.account" placeholder="请输入学生账号"></el-input>
<el-form-item prop="account" label="账号">
<el-input v-model.trim="form.account" placeholder="请输入账号"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input v-model="form.phone" placeholder="可用于登录平台,以及找回密码" maxlength="11" @blur="phoneChange"></el-input>
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11" @blur="phoneChange"></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model="form.email" placeholder="可用于登录平台,以及找回密码" @blur="emailChange"></el-input>
<el-input v-model.trim="form.email" placeholder="请输入邮箱" @blur="emailChange"></el-input>
</el-form-item>
<el-form-item prop="uniqueIdentification" label="唯一标识">
<el-input disabled v-model="form.uniqueIdentification"></el-input>
<el-form-item prop="roleValue" label="授权角色">
<el-select v-model="form.roleValue" @change="roleChange" @remove-tag="roleRemove" multiple style="width: 100%;">
<template v-for="item in roleList">
<!-- 不显示超管 -->
<el-option
v-if="item.roleName !== '超级管理员'"
:key="item.id"
:label="item.roleName"
:value="item.id">
</el-option>
</template>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item prop="classId" label="所在班级">
<el-input
placeholder="输入关键字进行过滤"
v-model="filterText"
style="margin-bottom: 10px"
>
</el-input>
<div style="height: 300px; max-height: 300px; border: 1px solid #DCDFE6; border-radius: 4px; padding: 10px 10px 10px 0px; overflow: auto">
<org-tree
v-if="showTree && treeVisible"
ref="classTree"
show-checkbox
node-key="id"
highlight-current
default-expand-all
lazy
:load="loadClassTree"
:default-checked-keys="defaultCheckedKeys"
:filter-node-method="filterNode"
:props="{children: 'children', label: 'organizationName', isLeaf: 'leaf'}"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span style="display: inline-block; margin-right: 20px">{{ node.label }}</span>
<span>
<el-button
v-if="node.level < 3"
type="text"
icon="el-icon-circle-plus-outline"
@click="() => addOrg(node, data)">
</el-button>
</span>
</span>
</org-tree>
</div>
<p style="color: #C0C4CC;">提示需创建班级后才可以勾选</p>
<el-form-item v-for="(item, i) in form.roleAndDeptList" :key="i" :label="`${item.roleName}所在部门`">
<el-cascader
v-model="item.cascaderValue"
:options="orgList"
:props="casProps"
style="width: 100%"
></el-cascader>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button type="primary" :disabled="disableds" @click="saveData(0)">保存</el-button>
<el-button v-if="isAdd" type="primary" :disabled="disableds" @click="saveData(1)">保存并继续添加</el-button>
<el-button size="small" @click="closeStudent">取消</el-button>
<el-button @click="closeStudent">取消</el-button>
<el-button type="primary" @click="submitStaff">确定</el-button>
</span>
</el-dialog>
@ -268,14 +221,14 @@ export default {
};
var workNumberPass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入学生学号'));
callback(new Error('请输入员工学号'));
} else {
var pattern = /^[A-Za-z0-9]*$/;
if(pattern.test(value)){
this.worknumberChange();
callback();
}else{
callback(new Error('请输入正确学生学号格式'));
callback(new Error('请输入正确员工学号格式'));
}
}
};
@ -283,13 +236,8 @@ export default {
return {
orgList: [],
orgListDia: [],
isRemove: false, //
currentClassId: '', // id
studentType: 1, //:(1. 2.)
architectureId: '', // id
orgLevel: '', // (1. 2. 3.)
orgVisible: false, //
labelName: "部门名称", //
studentType: 1, //:(1. 2.)
orgVisible: false, //
orgForm: {
id: '',
organizationName: ''
@ -299,20 +247,22 @@ export default {
checkStrictly: true,
label: "organizationName",
value: "id"
}, //
},
treeVisible: true,
treeNode: {},
treeResolve: [],
isDetail: false,
keyWord: '',
roleList: [],
form: {
accountId: '',
userName: '',
phone: '',
roleList: [],
uniqueIdentification: '',
workNumber: '',
email: '',
account: '',
classId: ""
account: ''
},
rules: {
organizationName: [
@ -320,27 +270,14 @@ export default {
],
account: [
{ required: true,validator: accountPass, trigger: 'blur' }
// { required: true, message: "", trigger: "blur" },
// {
// pattern: /^[A-Za-z0-9]*$/,
// message: "",
// trigger: "blur"
// }
],
userName: [
{ required: true, message: "请输入学生姓名", trigger: "blur" }
{ required: true, message: "请输入姓名", trigger: "blur" }
],
workNumber: [
{ required: true,validator: workNumberPass, trigger: 'blur' }
// { required: true, message: "", trigger: "blur" },
// {
// pattern: /^[A-Za-z0-9]*$/,
// message: "",
// trigger: "blur"
// }
],
phone: [
// { required: true, message: '', trigger: 'blur' },
{
pattern: /^1[3456789]\d{9}$/,
message: "请输入正确的手机号",
@ -348,7 +285,6 @@ export default {
}
],
email: [
// { required: true, message: '', trigger: 'blur' },
{
pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/,
message: "请输入正确的邮箱",
@ -362,15 +298,20 @@ export default {
total: 0,
multipleSelection: [],
isAdd: true,
studentVisible: false,
staffVisible: false,
accountReapeat: false,
originAccount: '',
workNumberReapeat: false,
originWorkNumber: '',
phoneRepeat: false,
emailRepeat: false,
showTree: true, //
defaultCheckedKeys: [],
filterText: '', //
casProps: {
multiple: true,
checkStrictly: true,
label: 'organizationName',
value: 'id'
},
importVisible: false,
uploadList: [],
@ -386,21 +327,12 @@ export default {
watch: {
keyWord: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
if (this.studentType) {
this.initData();
} else {
this.getOrgStudentData();
}
}, 500);
},
filterText(val) {
this.$refs.classTree.filter(val);
this.searchTimer = setTimeout(this.getStaff, 500);
}
},
mounted() {
this.getOrg()
this.getRole()
},
methods: {
//
@ -409,6 +341,7 @@ export default {
const list = res.treeList
this.orgList = list
this.handleOrgId(list)
this.getStaff()
},
// id
handleOrgId(list, ids) {
@ -482,7 +415,6 @@ export default {
this.orgForm.parentId = cas[len - 1]
this.orgForm.level = len + 1
}
debugger
if (!form.id) {
//
this.$post(this.api.saveArch, form).then(res => {
@ -490,7 +422,6 @@ export default {
this.closeOrg()
}).catch(err => {})
} else {
if (cas.length === 1 && this.labelName === '班级名称') return util.errorMsg('请选择年级!')
//
this.$post(this.api.updateArch, form).then(res => {
util.successMsg("编辑成功!")
@ -502,18 +433,9 @@ export default {
},
//
handleNodeClick(data) {
if (data.level === 3) {
this.isRemove = true;
this.currentClassId = data.id;
} else {
this.isRemove = false;
this.currentClassId = "";
}
this.$refs.table.clearSelection();
this.studentType = null;
this.architectureId = data.id;
this.orgLevel = data.level;
util.debounce(this.getOrgStudentData(), 1000);
this.$refs.table.clearSelection()
this.studentType = null
this.getStaff()
},
//
closeOrg() {
@ -521,136 +443,44 @@ export default {
this.cascaderValue = []
this.getOrg()
},
getOrgTreeData(resolve, level, parentId, ids) { //
this.$post(`${this.api.treeListArch}?level=${level}&parentId=${parentId}`).then(res => {
let { status, treeList } = res;
if (status === 200 && treeList.length) {
let result = [];
treeList.forEach(i => {
if (i.level === 3) {
i.leaf = true;
} else {
i.leaf = false;
}
i.ids = ids ? `${ids},${i.id}` : `${i.id}`; //
result.push(i);
});
return resolve(result);
} else {
return resolve([]);
}
}).catch(err => {
});
},
getOrgStudentData() { //
let params = {
architectureId: this.architectureId,
level: this.orgLevel,
keyWord: this.keyWord,
pageNum: 1,
pageSize: this.pageSize
};
this.$post(this.api.treeListArch, params).then(res => {
this.listData = res.page;
this.total = res.total;
}).catch(err => {
});
},
getData() { //
//
getStaff() {
let data = {
type: this.studentType,
type: this.studentType || '',
staffArchitectureId: this.$refs.orgTree.getCurrentKey() || '',
keyWord: this.keyWord,
pageNum: this.page,
pageSize: this.pageSize
};
this.$post(this.api.studentList, data).then(res => {
this.listData = res.page;
this.total = res.total;
}).catch(err => {
});
},
currentChange(val) { //
this.page = val;
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
}
this.$post(this.api.staffList, data).then(res => {
this.listData = res.records
this.total = res.total
}).catch(err => {})
},
getRowKeys(row) { // key
return row.accountId;
//
currentChange(val) {
this.page = val
this.getStaff()
},
handleSelectionChange(val) { //
this.multipleSelection = val;
},
changeStudentType() {
this.isRemove = false;
this.initData();
this.multipleSelection = val
},
initData() {
this.$refs.table.clearSelection();
this.page = 1;
this.getData();
this.$refs.table.clearSelection()
this.page = 1
this.getStaff()
},
delAllSelection() { //
if (this.multipleSelection.length) {
this.$confirm("确定要删除选中用户吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(item => {
return item.accountId;
});
this.$post(`${this.api.delStudent}?accountIds=${ids.toString()}`).then(res => {
this.multipleSelection = [];
this.$refs.table.clearSelection();
util.successMsg("删除成功");
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
}
}).catch(res => {
});
if(this.multipleSelection.length === this.listData.length && this.page>1) {
this.handleCurrentChange(this.page - 1)
}
}).catch(() => {
});
} else {
util.errorMsg("请先选择数据 !");
}
},
handleDelete(row) { //
//
delStaff(row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.delStudent}?accountIds=${row.accountId}`).then(res => {
util.successMsg("删除成功");
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
}
}).catch(res => {
});
}).catch(() => {
});
},
removeStudent(row) { //
this.$confirm("确定要移除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.removeStudent}?classId=${this.currentClassId}&stuAccountId=${row.accountId}`).then(res => {
util.successMsg("移除成功");
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
}
this.$post(`${this.api.delStaff}?accountIds=${row.accountId}`).then(res => {
util.successMsg("删除成功")
this.getStaff()
}).catch(res => {
});
}).catch(() => {
});
}).catch(() => {})
},
resetPassword(row) { //
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => {
@ -661,44 +491,71 @@ export default {
}).catch(() => {
});
},
switchOff(row) { //
let isEnable = row.isEnable === 0 ? 0 : 1;
this.$get(`${this.api.updateAccountEnable}?id=${row.accountId}&isEnable=${isEnable}`).then(res => {
util.successMsg("更新状态成功");
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
//
addStaff() {
this.staffVisible = true
},
// /
editStaff(row, isDetail) {
this.isDetail = isDetail
this.staffVisible = true
this.$post(`${this.api.staffDetail}?accountId=${row.accountId}`).then(res => {
const { data } = res
this.form = data
this.originAccount = data.account
this.originWorkNumber = data.workNumber
}).catch(res => {})
},
//
getRole() {
this.roleList =[]
this.$get(`${this.api.roleList}?page=1&size=1000&name=&platformId=${Setting.platformId}`).then(res => {
this.roleList = res.rolePage.records
}).catch(res => {})
},
//
roleChange(value) {
if (value.length) {
let ids = this.form.roleAndDeptList.map(e => e.roleId);
this.roleList.forEach(i => {
let obj = {
roleId: "",
roleName: "",
cascaderValue: []
};
if (value.includes(i.id) && !ids.includes(i.id)) {
console.log(i)
obj.roleId = i.id;
obj.roleName = i.roleName;
this.form.roleAndDeptList.push(obj);
}
}).catch(res => {
});
} else {
this.form.roleAndDeptList.splice(0);
}
},
addStudent() { //
this.isAdd = true;
this.showTree = true;
this.studentVisible = true;
},
editStudent(row, isDetail) { // /
this.isAdd = false;
this.isDetail = isDetail;
this.showTree = false;
this.studentVisible = true;
this.$post(`${this.api.getStudentInfoByAccountId}?stuAccountId=${row.accountId}`).then(res => {
this.form = res.data;
this.showTree = true;
}).catch(res => {});
roleRemove(value) { //
let list = [];
for(var i=0;i<this.form.roleAndDeptList.length;i++){
if (this.form.roleAndDeptList[i].roleId == value){
}else{
list.push(this.form.roleAndDeptList[i])
}
}
this.form.roleAndDeptList = list
},
accountChange() { //
if (this.form.account) {
let url = "";
if (this.isAdd) {
if (this.form.accountId) {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&account=${this.form.account}&workNumber=`;
} else {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`;
}
this.$post(url).then(res => {
this.disableds = false
if (this.isAdd && this.form.accountId) {
if (this.form.accountId) {
this.$refs.form.clearValidate();
this.form = {
account: this.form.account,
@ -716,8 +573,7 @@ export default {
this.accountReapeat = false;
}).catch(err => {
if (this.isAdd) {
this.showTree = false;
if (this.form.accountId) {
} else {
this.accountReapeat = true;
}
@ -727,7 +583,7 @@ export default {
worknumberChange() {
if (this.form.workNumber) {
let url = "";
if (this.isAdd && !this.form.accountId) {
if (!this.form.accountId) {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&workNumber=${this.form.workNumber}&account=`;
} else {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`;
@ -738,11 +594,9 @@ export default {
}
}).catch(err => {
this.$post(`${this.api.getDetailByAccount}?workNumber=${this.form.workNumber}&platformId=${Setting.platformId}&type=1`).then(res => {
this.showTree = true;
let classId = res.data.classList.map(e => e.id);
this.form.classId = classId.toString();
delete this.form.classList;
// this.showTree = true;
this.accountReapeat = false;
this.$refs.form.clearValidate();
}).catch(res => {});
@ -754,7 +608,7 @@ export default {
let regex = /^1[3456789]\d{9}$/;
if (regex.test(this.form.phone)) {
let url = "";
if (this.isAdd && !this.form.accountId) {
if (!this.form.accountId) {
url = `${this.api.checkEmailOrPhone}?phone=${this.form.phone}&email=`;
} else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&phone=${this.form.phone}&email=`;
@ -772,7 +626,7 @@ export default {
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
if (regex.test(this.form.email)) {
let url = "";
if (this.isAdd && !this.form.accountId) {
if (!this.form.accountId) {
url = `${this.api.checkEmailOrPhone}?email=${this.form.email}&phone=`;
} else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&email=${this.form.email}&phone=`;
@ -786,81 +640,35 @@ export default {
});
}
},
filterNode(value, data) {
if (!value) return true;
return data.organizationName.indexOf(value) !== -1;
},
loadClassTree(node, resolve) { //
let level = 1;
let parentId = "";
if (node.level === 0) {
this.treeNode = node;
this.treeResolve = resolve;
this.getClassTreeData(resolve, level, parentId);
} else if (node.level > 2) {
return resolve([]);
} else {
if (node.data && node.data.level && node.data.id) {
this.getClassTreeData(resolve, node.data.level + 1, node.data.id);
}
}
},
getClassTreeData(resolve, level, parentId) { //
this.$post(`${this.api.treeListArch}?level=${level}&parentId=${parentId}`).then(res => {
let { status, treeList } = res;
if (status === 200 && treeList.length) {
let result = [];
treeList.forEach(i => {
i.disabled = i.level < 3;
if (i.level === 3) {
i.leaf = true;
// propschecked
// i.checked = this.form.classId.includes(i.id.toString());
if (this.form.classId) {
this.defaultCheckedKeys = this.form.classId.split(",").map(i => Number(i));
}
i.showCheckbox = true;
} else {
i.leaf = false;
i.showCheckbox = false;
}
result.push(i);
});
return resolve(result);
} else {
return resolve([]);
}
}).catch(err => {
});
},
saveData(type) { // /
// /
submitStaff() {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.submiting) return false
let nodes = this.$refs.classTree.getCheckedNodes();
if (nodes.length) {
let tempArr = [];
nodes.forEach(i => {
if (i.level === 3) {
tempArr.push(i.id);
}
});
this.form.classId = tempArr.toString();
if (this.accountReapeat) return util.warningMsg("该账号已存在")
if (this.workNumberReapeat) return util.warningMsg("该员工学号已存在")
if (this.phoneRepeat) return util.warningMsg("该手机号已存在")
if (this.emailRepeat) return util.warningMsg("该邮箱已存在")
const form = this.form
if (this.teacherForm.roleAndDeptList.length){
for (let i = 0; i < this.teacherForm.roleAndDeptList.length; i++) {
if (this.teacherForm.roleAndDeptList[i].cascaderValue.length < 2) {
util.warningMsg(`请选择${this.teacherForm.roleAndDeptList[i].roleName}所属部门`)
return;
} else {
data.roleAndDeptList.push({
roleId: this.teacherForm.roleAndDeptList[i].roleId,
staffArchitectureId: this.teacherForm.roleAndDeptList[i].cascaderValue[0],
gradeId: this.teacherForm.roleAndDeptList[i].cascaderValue[1]
})
}
if (this.form.accountId) {
this.submiting = true
this.$post(this.api.modifyStudent, this.form).then(res => {
util.successMsg("编辑成功!");
if (type) {
this.resetStudent();
} else {
this.closeStudent();
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
}
}
this.submiting = true
if (form.accountId) {
this.$post(this.api.modifyStaff, form).then(res => {
util.successMsg("编辑成功!")
this.closeStudent()
setTimeout(() => {
this.submiting = false
}, 2000)
@ -870,24 +678,10 @@ export default {
}, 2000)
})
} else {
if (this.accountReapeat) return util.warningMsg("该账号已存在");
if (this.workNumberReapeat) return util.warningMsg("该学生学号已存在");
if (this.phoneRepeat) return util.warningMsg("该手机号已存在");
if (this.emailRepeat) return util.warningMsg("该邮箱已存在");
this.submiting = true
this.form.uniqueIdentification = new Date().getTime();
this.$post(this.api.addStudent, this.form).then(res => {
util.successMsg("新增成功!");
if (type) {
this.resetStudent();
} else {
this.closeStudent();
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
}
}
form.uniqueIdentification = new Date().getTime()
this.$post(this.api.saveStaff, form).then(res => {
util.successMsg("新增成功!")
this.closeStudent()
setTimeout(() => {
this.submiting = false
}, 2000)
@ -897,59 +691,45 @@ export default {
}, 2000)
})
}
} else {
return false;
}
});
},
resetStudent() { //
this.$refs.form.clearValidate();
this.form = {
userName: '',
account: '',
phone: '',
uniqueIdentification: '',
workNumber: '',
email: '',
classId: ""
};
this.$refs.classTree.setCheckedKeys([]);
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
}
})
},
closeStudent() { //
this.$refs.form.clearValidate();
//
closeStudent() {
this.$refs.form.clearValidate()
this.form = {
accountId: '',
userName: '',
account: '',
phone: '',
uniqueIdentification: '',
workNumber: '',
email: '',
classId: ""
classId: ''
};
this.defaultCheckedKeys = [];
this.isDetail = false;
this.showTree = false;
this.studentVisible = false;
this.defaultCheckedKeys = []
this.isDetail = false
this.staffVisible = false
this.getStaff()
},
batchImport() { //
//
batchImport() {
this.importVisible = true;
this.uploadList = [];
this.uploadFaild = false;
},
downLoad() { //
//
downLoad() {
location.href = this.api.studentTemplate;
},
handleExceed(files, fileList) { //
//
handleExceed(files, fileList) {
util.warningMsg(
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
);
},
showFaild() { //
//
showFaild() {
location.href = `${this.api.exportFailure}?exportCode=${this.exportCode}`;
},
uploadSuccess(res, file, fileList) {
@ -961,8 +741,6 @@ export default {
}
util.successMsg(`上传成功${res.data.successNum},上传失败${res.data.failureNum}`);
util.successMsg(`本次上传有${res.data.failureNum}个错误信息录入`);
this.getClassTreeData('','1','')
} else {
res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据");
}

Loading…
Cancel
Save