接口联调

ui1
yujialong 3 years ago
parent 8c0c2e4213
commit 7f3fc93d8a
  1. 35
      src/api/index.js
  2. 186
      src/layouts/tags/index.vue
  3. 15
      src/libs/util.js
  4. 48
      src/pages/data/list/index.vue
  5. 46
      src/pages/index/list/index.vue
  6. 44
      src/pages/setting/person/info.vue
  7. 90
      src/pages/stat/list/index.vue
  8. 110
      src/pages/user/list/index.vue
  9. 8
      src/store/modules/user.js

@ -17,12 +17,12 @@ export default {
querySchool: `liuwanr/customer/querySchool`,
// 个人中心
userinfo:`evaluation/tms/userInfo/userinfo`,
userinfoUpdate:`evaluation/tms/userInfo/updateUser`,
sendEmailCode:`evaluation/tms/user/sendEmailCode`,//发送邮箱验证码
bingEmail:`evaluation/tms/user/bingEmail`,//邮箱验证并更新
sendPhoneCode:`evaluation/tms/user/sendPhoneCode`,//发送手机验证码
bindPhone:`evaluation/tms/user/bindPhone`,//校验手机验证码
userInfo:`${host1}/data/userInfo/userInfo`,
updateUser:`${host1}/data/userInfo/updateUser`,
findPasswordByEmail:`/data/userInfo/findPasswordByEmail`,
findPasswordByPhone:`/data/userInfo/findPasswordByPhone`,
bingEmail:`evaluation/tms/user/bingEmail`,
bindPhone:`evaluation/tms/user/bindPhone`,
// oss文件管理
fileDeletion: `${uploadURL}/oss/manage/fileDeletion`,
@ -37,16 +37,14 @@ export default {
queryClient: `cjEnterprise/client/list`,
// 用户管理
saveUser: `/data/user/save`,
getUserList: `/data/user/getUserList`,
queryStaff: `evaluation/tms/system/queryStaff`,
querystaffDetail: `evaluation/tms/system/querystaffDetail`,
updateStaff: `evaluation/tms/system/updateStaff`,
downloadStaff: `evaluation/tms/system/download`,
export_failureStaff: `evaluation/tms/system/export_failure`,
uploadFileStaff: `evaluation/tms/system/uploadFile`,
queryAccountStaff:`evaluation/tms/system/queryAccount`,
resetPwd:`evaluation/tms/system/resetPwd`,
saveUser: `/users/data/user/save`,
getUserList: `/users/data/user/getUserList`,
getUserTotalBySchoolId: `${host1}/users/data/user/getUserTotalBySchoolId`,
checkAccount:`/users/data/user/checkAccount`,
getDetail:`/users/data/user/getDetail`,
modifyUser:`/users/data/user/modify`,
export_failure:`${Setting.apiBaseURL}/users/data/user/export_failure`,
uploadFile:`${Setting.apiBaseURL}/users/data/user/uploadFile`,
// 角色管理
batchRemove:`/data/role/batchRemove`,
@ -56,7 +54,6 @@ export default {
removeRole:`/data/role/remove`,
saveOrUpdate:`/data/role/saveOrUpdate`,
getRoles:`/data/role/getRole`,
checkAccount:`/data/user/checkAccount`,
// 权限菜单管理
doAssign:`/data/permission/doAssign`,
@ -79,4 +76,8 @@ export default {
queryDatabaseInfo:`${host1}/data/dataRecord/queryDatabaseInfo`,
queryDatabaseInfoByMonth:`${host1}/data/dataRecord/queryDatabaseInfoByMonth`,
saveRecord:`${host1}/data/dataRecord/saveRecord`,
databaseInfoExport:`${host1}/data/dataRecord/databaseInfoExport`,
databaseInfoByMonthExport:`${host1}/data/dataRecord/databaseInfoByMonthExport`,
onlineNumber:`${host1}/data/dataRecord/onlineNumber`,
getProductInfoBySchoolId:`${host1}/data/product/getProductInfoBySchoolId`,
}

@ -1,186 +0,0 @@
<template>
<div class="tags" v-if="showTags">
<ul>
<li class="tags-li" v-for="(item,index) in tagsList" :class="{'active': isActive(item.path)}" :key="index">
<router-link :to="item.path" class="tags-li-title">
{{item.title}}
</router-link>
<span class="tags-li-icon" @click="closeTags(index)"><i class="el-icon-close"></i></span>
</li>
</ul>
<div class="tags-close-box">
<el-dropdown @command="handleTags">
<el-button size="mini" type="primary">
标签选项<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu size="small" slot="dropdown">
<el-dropdown-item command="other">关闭其他</el-dropdown-item>
<el-dropdown-item command="all">关闭所有</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</template>
<script>
import bus from '@/libs/bus';
export default {
data() {
return {
tagsList: []
}
},
methods: {
isActive(path) {
return path === this.$route.fullPath;
},
//
closeTags(index) {
const delItem = this.tagsList.splice(index, 1)[0];
const item = this.tagsList[index] ? this.tagsList[index] : this.tagsList[index - 1];
if (item) {
delItem.path === this.$route.fullPath && this.$router.push(item.path);
}else{
this.$router.push('/');
}
},
//
closeAll(){
this.tagsList = [];
this.$router.push('/');
},
//
closeOther(){
const curItem = this.tagsList.filter(item => {
return item.path === this.$route.fullPath;
})
this.tagsList = curItem;
},
//
setTags(route){
const isExist = this.tagsList.some(item => {
return item.path === route.fullPath;
})
if(!isExist){
if(this.tagsList.length >= 8){
this.tagsList.shift();
}
this.tagsList.push({
title: route.meta.title,
path: route.fullPath,
name: route.matched[1].components.default.name
})
}
bus.$emit('tags', this.tagsList);
},
handleTags(command){
command === 'other' ? this.closeOther() : this.closeAll();
}
},
computed: {
showTags() {
return this.tagsList.length > 0;
}
},
watch:{
$route(newValue, oldValue){
this.setTags(newValue);
}
},
created(){
this.setTags(this.$route);
//
bus.$on('close_current_tags', () => {
for (let i = 0, len = this.tagsList.length; i < len; i++) {
const item = this.tagsList[i];
if(item.path === this.$route.fullPath){
if(i < len - 1){
this.$router.push(this.tagsList[i+1].path);
}else if(i > 0){
this.$router.push(this.tagsList[i-1].path);
}else{
this.$router.push('/');
}
this.tagsList.splice(i, 1);
break;
}
}
})
}
}
</script>
<style>
.tags {
position: relative;
height: 30px;
overflow: hidden;
background: #fff;
padding-right: 120px;
box-shadow: 0 5px 10px #ddd;
}
.tags ul {
box-sizing: border-box;
width: 100%;
height: 100%;
}
.tags-li {
float: left;
margin: 3px 5px 2px 3px;
border-radius: 3px;
font-size: 12px;
overflow: hidden;
cursor: pointer;
height: 23px;
line-height: 23px;
border: 1px solid #e9eaec;
background: #fff;
padding: 0 5px 0 12px;
vertical-align: middle;
color: #666;
-webkit-transition: all .3s ease-in;
-moz-transition: all .3s ease-in;
transition: all .3s ease-in;
}
.tags-li:not(.active):hover {
background: #f8f8f8;
}
.tags-li.active {
color: #fff;
}
.tags-li-title {
float: left;
max-width: 80px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-right: 5px;
color: #666;
}
.tags-li.active .tags-li-title {
color: #fff;
}
.tags-close-box {
position: absolute;
right: 0;
top: 0;
box-sizing: border-box;
padding-top: 1px;
text-align: center;
width: 110px;
height: 30px;
background: #fff;
box-shadow: -3px 0 15px 3px rgba(0, 0, 0, .1);
z-index: 10;
}
</style>

@ -104,6 +104,21 @@ const util = {
}
x.send()
},
// 传入文件名和数据,下载文件
downloadFileDirect(fileName,data) {
if ('download' in document.createElement('a')) { // 非IE下载
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(data)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
} else { // IE10+下载
navigator.msSaveBlob(data, fileName)
}
},
// 成功提示
successMsg(message,duration = 3000) {
return Message.success({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration})

@ -1,7 +1,7 @@
<template>
<div class="wrap">
<div class="left">
<el-menu class="menu" @open="handleOpen" @close="handleClose" @select="selectType" unique-opened :default-active="active">
<el-menu class="menu" ref="type" @open="handleOpen" @close="handleClose" @select="selectType" unique-opened :default-active="defaultType" :default-openeds="defaultOpenType">
<template v-for="item in typeList">
<!-- 如果第一层有子菜单则继续循环 -->
<template v-if="item.children.length">
@ -136,9 +136,11 @@ import util from '@/libs/util'
export default {
data() {
return {
typeId: this.$route.query.typeId,
schoolId: 1001,
typeList: [],
active: '',
defaultType: '',
defaultOpenType: [],
introduce: '',
listData: [],
page: 1,
@ -189,27 +191,36 @@ export default {
methods: {
getType(){
this.$post(this.api.getTableByClassification).then(res => {
let typeId = this.typeId
res.map(n => {
n.id = String(n.id)
n.children.map(n => {
n.id = String(n.id)
n.children.map(n => {
n.children.map(e => {
e.id = String(e.id)
if(e.children.length && typeId == e.id){
this.defaultOpenType = [n.id,e.id]
}
e.children.map(n => {
n.id = String(n.id)
})
})
})
this.typeList = res
if(res[0].children.length){
this.active = res[0].children[0].id
if(this.typeId){
this.defaultType = this.typeId
}else{
if(res[0].children.length && res[0].children[0].children.length){
this.defaultType = res[0].children[0].children[0].id
}else if(res[0].children.length){
this.defaultType = res[0].children[0].id
}else{
this.active = res[0].id
this.defaultType = res[0].id
}
}
this.getData()
}).catch(res => {})
},
getData(){
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.active}&showName=&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=`).then(res => {
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.defaultType}&showName=&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=`).then(res => {
this.listData = res.list
this.total = res.totalCount
}).catch(res => {})
@ -220,7 +231,7 @@ export default {
this.getData()
},
selectType(index,indexPath){
this.active = index
this.defaultType = index
this.introduce = this.typeList.find(n => n.id == indexPath[0]).introduce
this.previewHead = []
this.previewData = []
@ -332,20 +343,7 @@ export default {
}).then((res) => {
msgObj.close()
if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!')
const blob = new Blob([res.data])
const fileName = `${this.curRow.showName}.xls`
if ('download' in document.createElement('a')) { // IE
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // URL
document.body.removeChild(elink)
} else { // IE10+
navigator.msSaveBlob(blob, fileName)
}
util.downloadFileDirect(`${this.curRow.showName}.xls`,new Blob([res.data]))
this.$get(`${this.api.downloadRecord}?platformUserId=4&tableId=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`).then(res => {}).catch(res => {})

@ -9,6 +9,12 @@
</div>
<img v-if="keyword" src="../../../assets/img/remove-gray.png" alt="" class="remove" @click="keyword = ''">
</div>
<div class="hot">
<span class="name">热门下载</span>
<ul class="list">
<li v-for="(item,index) in hotData" :key="index" @click="toData(item)">{{item.categoryTwo}}</li>
</ul>
</div>
<template v-if="keyword">
<div class="tips">
@ -40,12 +46,14 @@ export default {
name: 'index',
data() {
return {
schoolId: 1001,
keyword: '',
searchTimer: null,
listData:[],
page: 1,
pageSize: 10,
total: 0,
hotData: []
}
},
watch: {
@ -57,7 +65,7 @@ export default {
}
},
mounted() {
this.getHot()
},
methods: {
getData(){
@ -66,6 +74,18 @@ export default {
this.total = res.totalCount
}).catch(res => {})
},
getHot(){
this.$get(`${this.api.queryDatabaseInfo}?schoolId=${this.schoolId}&startTime=&endTime=`).then(res => {
let list = JSON.parse(res.databaseInfo)
list.map(n => {
n.download
})
list.sort((a,b) => {
return b.download - a.download
})
this.hotData = list.slice(0,3)
}).catch(res => {})
},
initData(){
this.page = 1
this.getData()
@ -77,6 +97,9 @@ export default {
},
download(row){
this.$router.push(`/data?download=true&id=${row.id}&name=${row.name}`)
},
toData(row){
this.$router.push(`/data?typeId=${row.categoryTwoId}`)
}
}
};
@ -150,5 +173,26 @@ export default {
}
}
}
.hot{
display: flex;
align-items: center;
width: 930px;
margin: 10px auto 0;
.name{
font-size: 14px;
color: #efefef;
}
.list{
flex: 1;
display: inline-flex;
margin-left: 20px;
li{
margin-right: 50px;
color: #568df2;
font-size: 16px;
cursor: pointer;
}
}
}
}
</style>

@ -349,7 +349,7 @@ export default {
getProvince(){
this.$get(this.api.queryProvince).then(res => {
this.provinceList = res.data.list
}).catch(res => {});
}).catch(res => {})
},
//
getCity(id,type){
@ -360,7 +360,7 @@ export default {
let provinceId = this.personalInformation.provinceId
this.$get(this.api.queryCity,{provinceId}).then(res => {
this.cityList = res.data.list
}).catch(res => {});
}).catch(res => {})
},
//
getSchoolData(){
@ -371,7 +371,7 @@ export default {
}
this.$get(`${this.api.queryClient}/1/1000`,data).then(res => {
this.schoolList = res.data.list
}).catch(res => {});
}).catch(res => {})
},
accountChange(){
this.$get(`${this.api.getAccount}?account=${this.form.account}`).then(res => {
@ -381,10 +381,10 @@ export default {
}else{
this.accountRepeat = false
}
}).catch(res => {});
}).catch(res => {})
},
getdata() {
this.$get(`${this.api.userinfo}?userId=${this.userId}`)
this.$get(`${this.api.userInfo}/${this.userId}`)
.then(res => {
this.personalInformation = res.data.userInfo
this.personalInformation.countries = '中国'
@ -396,7 +396,7 @@ export default {
})
})
.catch(err => {
console.log(err);
console.log(err)
});
},
save() {
@ -421,8 +421,11 @@ export default {
userId: personalInformation.userId,
userName: personalInformation.userName,
}
let data = userInfoEntity
this.$post(this.api.userinfoUpdate,data).then(res => {
let data = {
userInfoEntity,
personalFileEntities: this.archivesList
}
this.$post(this.api.updateUser,data).then(res => {
if(res.success){
this.setUserName(personalInformation.userName)
util.successMsg('提交成功')
@ -494,10 +497,9 @@ export default {
this.$message.success('更换成功')
this.passwordVisible = false
}
}).catch(err => {
console.log(err)
})
.catch(err => {
console.log(err);
});
},
closePassword() {
this.passwordForm = {
@ -562,12 +564,10 @@ export default {
email: this.email,
types: 1
}
this.$post(this.api.sendEmailCode,data).then(res => {
if(res.errmessage == 'success'){
this.$post(this.api.findPasswordByEmail,data).then(res => {
this.emailCountdown()
this.emailOpener = res.data
}
}).catch(res => {});
}).catch(res => {})
},
emailSubmit(){
if(!this.email) return this.$message.warning('请输入邮箱')
@ -581,12 +581,10 @@ export default {
opener: this.emailOpener
}
this.$put(this.api.bingEmail,data).then(res => {
if(res.errmessage == 'success'){
this.$message.success('绑定成功')
this.personalInformation.email = this.email
this.emailVisible = false
}
}).catch(res => {});
}).catch(res => {})
},
closePhone(){
if(!this.emailDisabled){
@ -602,11 +600,9 @@ export default {
types: 2
}
this.$post(this.api.sendPhoneCode,data).then(res => {
if(res.errmessage == 'success'){
this.phoneCountdown()
this.phoneOpener = res.data
}
}).catch(res => {});
}).catch(res => {})
},
phoneSubmit(){
if(!this.phone) return this.$message.warning('请输入手机号')
@ -619,13 +615,11 @@ export default {
code: this.phoneCode,
opener: this.phoneOpener
}
this.$put(this.api.bindPhone,data).then(res => {
if(res.errmessage == 'success'){
this.$put(this.api.findPasswordByPhone,data).then(res => {
this.$message.success('绑定成功')
this.personalInformation.phone = this.phone
this.phoneVisible = false
}
}).catch(res => {});
}).catch(res => {})
},
}
};

@ -1,16 +1,18 @@
<template>
<div class="wrap">
<div class="left">
<div class="inner">
<h6 class="school">广东工业大学</h6>
<h6 class="school">{{schoolName}}</h6>
<div class="product" v-for="(item,index) in productList" :key="index">
<p class="product-name">{{item.productName}}</p>
<div class="date">
<span class="name">使用期限</span>
<div class="val">
2021-05-01<br><br>2021-10-01
{{item.startTime}}<br><br>{{item.endTime}}
</div>
</div>
<p class="surplus"><span class="name">剩余期限</span><span class="num">300</span> </p>
<p class="surplus"><span class="name">账号数量</span><span class="num">10</span> </p>
<p class="surplus" v-if="item.deadline"><span class="name">剩余期限</span><span class="num">{{item.deadline}}</span> </p>
<p class="surplus"><span class="name">账号数量</span><span class="num">{{item.accountNum}}</span> </p>
<el-button class="renew" size="small" type="primary" v-if="!item.deadline">续费</el-button>
</div>
</div>
<div class="right">
@ -19,25 +21,25 @@
<ul class="stat">
<li>
<p class="people">
<span class="num">4</span>
<span class="num">{{userCount ? userCount : 0}}</span>
</p>
<p class="text">本校累计用户数量</p>
</li>
<li>
<p class="people">
<span class="num">{{dayCount}}</span>
<span class="num">{{dayCount ? dayCount : 0}}</span>
</p>
<p class="text">平均日访客量</p>
</li>
<li>
<p class="people">
<span class="num">{{schoolCount}}</span>
<span class="num">{{schoolCount ? schoolCount : 0}}</span>
</p>
<p class="text">累计下载</p>
</li>
<li>
<p class="people">
<span class="num">4</span>
<span class="num">{{onlineCunt ? onlineCunt : 0}}</span>
</p>
<p class="text">当前在线人数</p>
</li>
@ -61,7 +63,7 @@
<h6 class="title">按数据库统计使用概况</h6>
<div>
<el-button type="primary" size="small" v-auth="'/system/list:员工管理:批量导入'">导出数据</el-button>
<el-button type="primary" size="small" v-auth="'/system/list:员工管理:批量导入'" @click="exportDatabase">导出数据</el-button>
</div>
</div>
@ -82,7 +84,7 @@
<div class="flex j-between">
<h6 class="title">按月份统计数据库使用概况</h6>
<div>
<el-button type="primary" size="small" v-auth="'/system/list:员工管理:批量导入'">导出数据</el-button>
<el-button type="primary" size="small" v-auth="'/system/list:员工管理:批量导入'" @click="exportDatabaseByMonth">导出数据</el-button>
</div>
</div>
@ -109,12 +111,18 @@
</template>
<script>
import axios from 'axios'
import util from '@/libs/util'
export default {
data() {
return {
schoolId: 1001,
dayCount: 0,
schoolCount: 0,
schoolName: '',
productList: [],
userCount: '',
dayCount: '',
schoolCount: '',
onlineCunt: '',
keyword: '',
searchTimer: null,
date: [],
@ -166,6 +174,18 @@ export default {
},
methods: {
getData(){
this.$get(`${this.api.getProductInfoBySchoolId}?schoolId=31`).then(res => {
let list = res.list
list.map(n => {
n.startTime = util.formatDate('yyyy-MM-dd',new Date(n.startTime))
n.endTime = util.formatDate('yyyy-MM-dd',new Date(n.endTime))
})
this.productList = list
if(list.length){
this.schoolName = list[0].schoolName
}
}).catch(res => {})
this.$get(`${this.api.queryAccumulate}?schoolId=${this.schoolId}`).then(res => {
this.dayCount = res.dayCount
this.schoolCount = res.schoolCount
@ -188,6 +208,14 @@ export default {
}
this.monthData = result
}).catch(res => {})
this.$get(`${this.api.getUserTotalBySchoolId}?schoolId=${this.schoolId}`).then(res => {
this.userCount = res.totalCount
}).catch(res => {})
this.$get(this.api.onlineNumber).then(res => {
this.onlineCunt = res.message
}).catch(res => {})
this.getDatabase()
},
getDatabase(){
@ -242,6 +270,24 @@ export default {
}
}
this.active = !this.active
},
exportDatabase(){
let data = this.listDataAll
if(this.multipleSelection.length) data = this.multipleSelection
axios.post(this.api.databaseInfoExport,data,{
responseType: 'blob'
}).then((res) => {
util.downloadFileDirect(`按数据库统计使用概况导出.xls`,new Blob([res.data]))
}).catch(res => {})
},
exportDatabaseByMonth(){
let data = []
if(this.multipleSelection1.length){
data = this.multipleSelection1.map(n => `yearList=${n.year}`)
}else{
data = this.monthData.map(n => `yearList=${n.year}`)
}
location.href = `${this.api.databaseInfoByMonthExport}?schoolId=${this.schoolId}&${Array.from(new Set(data)).join('&')}`
}
}
};
@ -252,17 +298,22 @@ export default {
display: flex;
.left{
margin-right: 20px;
.inner{
width: 200px;
padding: 15px;
background-color: #fff;
border-radius: 8px;
.school{
margin-bottom: 15px;
font-size: 20px;
color: #568DF2;
text-align: center;
}
.product{
width: 200px;
padding: 15px;
margin-bottom: 15px;
background-color: #fff;
border-radius: 8px;
.product-name{
font-size: 16px;
color: #568DF2;
}
.date{
display: flex;
align-items: center;
@ -285,6 +336,9 @@ export default {
font-size: 14px;
color: #404040;
}
.renew{
margin-top: 10px;
}
}
}
.block{

@ -64,8 +64,8 @@
<el-table-column prop="lastLoginTime" label="上次登录时间" width="160" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="260">
<template slot-scope="scope">
<el-button type="text" @click="showTeacher(scope.row)" v-auth="'/system/list:员工管理:查看'">查看</el-button>
<el-button type="text" @click="editTeacher(scope.row)" v-auth="'/system/list:员工管理:编辑'">编辑</el-button>
<el-button type="text" @click="show(scope.row)" v-auth="'/system/list:员工管理:查看'">查看</el-button>
<el-button type="text" @click="edit(scope.row)" v-auth="'/system/list:员工管理:编辑'">编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)" v-auth="'/system/list:员工管理:重置密码'">重置密码</el-button>
<el-button type="text" @click="handleDelete(scope.row)" v-auth="'/system/list:员工管理:删除'">删除</el-button>
<el-switch v-model="scope.row.disableAccount" :active-value="0" :inactive-value="1" style="margin: 0 10px 0 5px" :active-text="scope.row.disableAccount ? '关' : '开'" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
@ -76,7 +76,7 @@
<el-pagination background layout="total,prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination>
</div>
<el-dialog :title="isDetail ? '查看员工' : (form.userId ? '新增员工' : '编辑员工')" :visible.sync="userVisible" width="500px" @close="closeUser" class="dialog" :close-on-click-modal="false">
<el-dialog :title="isDetail ? '查看员工' : (form.userId ? '编辑员工' : '新增员工')" :visible.sync="userVisible" width="500px" @close="closeUser" class="dialog" :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="110px" label-suffix="" :disabled="isDetail">
<el-form-item prop="account" label="账号">
<el-input v-model="form.account" ref="account" placeholder="请输入职工账号" @change="accountChange"></el-input>
@ -92,8 +92,8 @@
<el-form-item prop="uniqueIdentification" label="唯一标识">
<el-input disabled v-model="form.uniqueIdentification" placeholder="唯一标识"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input v-model="form.phone" placeholder="请输入手机号" maxlength="11"></el-input>
<el-form-item prop="phone" label="手机号" v-if="isDetail">
<el-input v-model="form.phone" placeholder="请输入手机号" maxlength="11" disabled></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model="form.email" placeholder="请输入邮箱"></el-input>
@ -111,7 +111,7 @@
<el-dialog title="批量导入" :visible.sync="importVisible" width="400px" @close="closeImport" :close-on-click-modal="false">
<div class="upload-wrap" :class="{lg: uploadFaild}">
<el-button class="download" size="small" @click="downLoad"><img src="../../../assets/img/download.png" alt=""> 模板下载</el-button>
<el-upload accept=".xls,.xlsx" :on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" :limit="1" :on-exceed="handleExceed" :action="this.api.uploadFileStaff" :file-list="uploadList" :data="{schoolId: this.clientId}" name="file">
<el-upload ref="import" accept=".xls,.xlsx" :on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" :limit="1" :on-exceed="handleExceed" :action="this.api.uploadFile" :file-list="uploadList" :data="{schoolId: this.schoolId}" name="file" :auto-upload="false">
<el-button size="small"><img src="../../../assets/img/upload.png" alt=""> 上传文件</el-button>
</el-upload>
<div class="link" v-if="uploadFaild">
@ -120,7 +120,7 @@
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="importVisible = false"> </el-button>
<el-button size="small" type="primary" @click="uploadSure"> </el-button>
<el-button size="small" type="primary" @click="confirmImport"> </el-button>
</span>
</el-dialog>
</div>
@ -324,8 +324,8 @@ export default {
}).catch(() => {})
},
accountChange(){
// if(this.form.account !== this.originalAccount){
this.$get(`${this.api.checkAccount}?account=${this.form.account}&type=1`).then(res => {
if(this.form.account !== this.originalAccount){
this.$get(`${this.api.checkAccount}?account=${this.form.account}&type=1&platformId=${Setting.platformId}`).then(res => {
if(res.status == 200){
this.accountRepeat = false
}else{
@ -333,13 +333,13 @@ export default {
util.warningMsg('该账号已存在')
}
}).catch(res => {})
// }else{
// this.accountRepeat = false
// }
}else{
this.accountRepeat = false
}
},
workNumberChange(){
// if(this.form.workNumber !== this.originalWorkNumber){
this.$get(`${this.api.checkAccount}?workNumber=${this.form.workNumber}&type=2`).then(res => {
if(this.form.workNumber !== this.originalWorkNumber){
this.$get(`${this.api.checkAccount}?workNumber=${this.form.workNumber}&type=2&platformId=${Setting.platformId}`).then(res => {
if(res.status == 200){
this.workNumberRepeat = false
}else{
@ -347,47 +347,48 @@ export default {
util.warningMsg('该工号已存在')
}
}).catch(res => {})
// }else{
// this.workNumberRepeat = false
// }
}else{
this.workNumberRepeat = false
}
},
closeUser(){
this.$refs.form.resetFields()
console.log(11,this.form)
this.form.userId = ''
},
addTeacher(){
this.isDetail = false
this.userVisible = true
this.isAddteacher = true
},
getStaffDetail(userId){
this.$get(`${this.api.getStaff}/${userId}`).then(res => {
let user = res.data.userInfo;
let or = res.data.staff;
this.form.uniqueIdentification = user.uniqueIdentification
this.form.userName = user.userName
this.form.phone = user.phone
this.form.email = user.email
this.form.account = user.account
this.originalAccount = user.account
this.form.userId = user.userId
this.form.schoolId = user.schoolId
this.form.workNumber = or.workNumber
this.originalWorkNumber = or.workNumber
getDetail(userId){
this.userVisible = true
this.$post(`${this.api.getDetail}?userId=${userId}`).then(res => {
let data = res.data
this.form = {
platformId: Setting.platformId,
account: data.account,
userId: data.userId,
userName: data.userName,
roleId: data.roleId,
phone: data.phone ? data.phone : '',
// uniqueIdentification: data.uniqueIdentification,
workNumber: data.workNumber,
email: data.email,
schoolId: data.schoolId,
password: ''
}
this.originalAccount = data.account
this.originalWorkNumber = data.workNumber
}).catch(res => {})
},
editTeacher(row){
edit(row){
this.isDetail = false
this.userVisible = true
this.isAddteacher = false
this.AccountNoAdd = false
this.form.userId = row.userId
this.getStaffDetail(row.userId)
this.getDetail(row.userId)
},
showTeacher(row){
show(row){
this.isDetail = true
this.getStaffDetail(row.userId)
this.getDetail(row.userId)
},
confirm(){
this.$refs.form.validate((valid) => {
@ -395,10 +396,9 @@ export default {
if(this.accountRepeat) return util.warningMsg('该账号已存在')
if(this.workNumberRepeat) return util.warningMsg('该工号已存在')
let data = this.form
if(!data.uniqueIdentification) data.uniqueIdentification = new Date().getTime()
console.log(22,data)
if(!data.userId) data.uniqueIdentification = new Date().getTime()
if(this.form.userId){
this.$post(this.api.updateStaff,data).then(res => {
this.$post(this.api.modifyUser,data).then(res => {
this.userVisible = false
util.successMsg('编辑成功')
this.getData()
@ -433,8 +433,7 @@ export default {
}
this.$post(this.api.updateClient,data).then((res) => {
val == 1 ? util.warningMsg('该用户权限已关闭') : util.successMsg('该用户权限已激活')
}).catch((res) => {
})
}).catch((res) => {})
},
handleSelectionChange(val) {
this.multipleSelection = val
@ -466,10 +465,6 @@ export default {
this.uploadList = []
this.uploadFaild = false
},
searchTeacher(){
this.page = 1
this.getData()
},
handleCurrentChange(val) {
this.page = val
this.$refs.table.clearSelection()
@ -479,7 +474,7 @@ export default {
location.href = this.api.downloadStaffTemp
},
showFaild(){
location.href = `${this.api.exportFailureStaff}?token=${this.token}`
location.href = `${this.api.export_failure}?token=${this.token}`
},
handleExceed(files, fileList) {
util.warningMsg(
@ -488,12 +483,14 @@ export default {
},
uploadSuccess(res, file, fileList) {
this.uploadFaild = false
if(res.success){
if(res.data.data.token){
this.token = res.data.data.token
if(res.status == 200){
if(res.data.token){
this.token = res.data.token
this.uploadFaild = true
}else{
util.successMsg('上传成功')
this.importVisible = false
this.initData()
}
}else{
res.data.message ? util.errorMsg(res.data.message) : util.errorMsg('上传失败,请检查数据')
@ -516,11 +513,8 @@ export default {
closeImport(){
this.uploadList = []
},
uploadSure(){
this.importVisible = false
this.page = 1
this.keyword = ''
this.getData()
confirmImport(){
this.$refs.import.submit()
}
}
};

@ -61,7 +61,7 @@ export default {
if(res.status == 200){
let user = res.message.retvalue
console.log(user)
if(user.roleId == 1){
// if(user.roleId == 1){
let routes = res.message.listValue
commit('SET_INFO',{
avatar: user.userAvatars,
@ -80,9 +80,9 @@ export default {
util.local.set(Setting.usernameKey, user.userName)
util.successMsg('登录成功')
resolve()
}else{
util.errorMsg('该用户没有权限')
}
// }else{
// util.errorMsg('该用户没有权限')
// }
}else{
util.errorMsg(res.message)
}

Loading…
Cancel
Save