数据、用户、角色等

ui1
yujialong 3 years ago
parent 75c2aefbf5
commit 8c0c2e4213
  1. 52
      src/api/index.js
  2. BIN
      src/assets/img/arrow.png
  3. 6
      src/libs/util.js
  4. 28
      src/pages/data/list/index.vue
  5. 2
      src/pages/index/list/index.vue
  6. 6
      src/pages/role/list/index.vue
  7. 10
      src/pages/setting/person/download.vue
  8. 141
      src/pages/stat/list/index.vue
  9. 490
      src/pages/user/list/index.vue
  10. 4
      src/plugins/requests/index.js
  11. 6
      src/setting.js

@ -1,7 +1,7 @@
import Setting from '@/setting'
let uploadURL = Setting.upload.apiURL
let host = 'http://www.liuwanr.cn'
let host1 = 'http://192.168.31.125:8888'
let host1 = 'http://192.168.31.125:9000'
export default {
// 登录注册
@ -36,9 +36,9 @@ export default {
queryCity: `cjEnterprise/city/queryCity`,
queryClient: `cjEnterprise/client/list`,
// 员工管理
addStaff: `evaluation/tms/system/addStaff`,
daleteBatchStaff: `evaluation/tms/system/daleteBatchStaff`,
// 用户管理
saveUser: `/data/user/save`,
getUserList: `/data/user/getUserList`,
queryStaff: `evaluation/tms/system/queryStaff`,
querystaffDetail: `evaluation/tms/system/querystaffDetail`,
updateStaff: `evaluation/tms/system/updateStaff`,
@ -49,26 +49,34 @@ export default {
resetPwd:`evaluation/tms/system/resetPwd`,
// 角色管理
batchRemove:`/data/data/role/batchRemove`,
getRole:`/data/data/role/get`,
getName:`/data/data/role/getName`,
listRole:`/data/data/role/list`,
removeRole:`/data/data/role/remove`,
saveOrUpdate:`/data/data/role/saveOrUpdate`,
batchRemove:`/data/role/batchRemove`,
getRole:`/data/role/get`,
getName:`/data/role/getName`,
listRole:`/data/role/list`,
removeRole:`/data/role/remove`,
saveOrUpdate:`/data/role/saveOrUpdate`,
getRoles:`/data/role/getRole`,
checkAccount:`/data/user/checkAccount`,
// 权限菜单管理
doAssign:`/data/data/permission/doAssign`,
queryPermissionMenu:`/data/data/permission/queryPermissionMenu`,
savePer:`/data/data/permission/save`,
toAssign:`/data/data/permission/toAssign`,
doAssign:`/data/permission/doAssign`,
queryPermissionMenu:`/data/permission/queryPermissionMenu`,
savePer:`/data/permission/save`,
toAssign:`/data/permission/toAssign`,
// 表展示
getIdQueryTable:`/data/huoran/data/table/getIdQueryTable`,
getTableByClassification:`/data/huoran/data/table/getTableByClassification`,
getTableByCondition:`/data/huoran/data/table/getTableByCondition`,
downloadData:`${host1}/data/data/download`,
previewData:`${host1}/data/data/preview`,
downloadRecord:`${host1}/data/huoran/data/myDownload/downloadRecord`,
getDownloadRecord:`${host1}/data/huoran/data/myDownload/getDownloadRecord`,
downloadAgain:`${host1}/data/data/downloadAgain`,
getIdQueryTable:`/data/table/getIdQueryTable`,
getTableByClassification:`/data/table/getTableByClassification`,
getTableByCondition:`/data/table/getTableByCondition`,
downloadData:`${host1}/data/download`,
previewData:`${host1}/data/preview`,
downloadRecord:`${host1}/data/myDownload/downloadRecord`,
getDownloadRecord:`data/myDownload/getDownloadRecord`,
downloadAgain:`${host1}/data/downloadAgain`,
// 数据操作记录
queryAccumulate:`${host1}/data/dataRecord/queryAccumulate`,
queryDatabaseInfo:`${host1}/data/dataRecord/queryDatabaseInfo`,
queryDatabaseInfoByMonth:`${host1}/data/dataRecord/queryDatabaseInfoByMonth`,
saveRecord:`${host1}/data/dataRecord/saveRecord`,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

@ -106,15 +106,15 @@ const util = {
},
// 成功提示
successMsg(message,duration = 3000) {
Message.success({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration})
return Message.success({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration})
},
// 警告提示
warningMsg(message,duration = 3000) {
Message.warning({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration})
return Message.warning({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration})
},
// 错误提示
errorMsg(message,duration = 3000) {
Message.error({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration})
return Message.error({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration})
},
}

@ -136,6 +136,7 @@ import util from '@/libs/util'
export default {
data() {
return {
schoolId: 1001,
typeList: [],
active: '',
introduce: '',
@ -180,6 +181,7 @@ export default {
this.getType()
if(this.$route.query.download){
this.download({
id: this.$route.query.id,
name: this.$route.query.name
})
}
@ -227,6 +229,12 @@ export default {
},
preview(row){
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => {
this.$post(this.api.saveRecord,{
platformUserId: 4,
tableId: row.id,
type: 2,
schoolId: this.schoolId,
}).then(res => {}).catch(res => {})
let comment = res.comment
let previewHead = []
comment.map(n => {
@ -311,18 +319,19 @@ export default {
let newFields = []
let fieldsList = this.fieldsList
fields.map(n => {
newFields.push(`fields=${fieldsList.find(e => e.comment == n).field}`)
newFields.push(fieldsList.find(e => e.comment == n).field)
})
util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000)
let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000)
this.downloadVisible = false
let startTime = this.startTime ? this.startTime : ''
let endTime = this.endTime ? this.endTime : ''
let frequency = this.frequency
axios.get(`${this.api.downloadData}?tableName=${this.curRow.name}&${newFields.join('&')}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`,{
axios.get(`${this.api.downloadData}?tableName=${this.curRow.name}&table_id=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`,{
responseType: 'blob'
}).then((res) => {
console.log(22,res.data)
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
@ -338,7 +347,16 @@ export default {
navigator.msSaveBlob(blob, fileName)
}
this.$get(`${this.api.downloadRecord}?platformUserId=4&tableId=${this.curRow.id}&${newFields.join('&')}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`).then(res => {}).catch(res => {})
this.$get(`${this.api.downloadRecord}?platformUserId=4&tableId=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`).then(res => {}).catch(res => {})
this.$post(this.api.saveRecord,{
platformUserId: 4,
tableId: this.curRow.id,
type: 1,
schoolId: this.schoolId,
}).then(res => {}).catch(res => {})
}).catch(res => {
msgObj.close()
})
}
}

@ -76,7 +76,7 @@ export default {
this.getData()
},
download(row){
this.$router.push(`/data?download=true&name=${row.name}`)
this.$router.push(`/data?download=true&id=${row.id}&name=${row.name}`)
}
}
};

@ -115,12 +115,6 @@ export default {
},
methods: {
getData() {
let data = {
clientId: this.clientId
}
if(this.keyword.length){
data.name = this.keyword
}
this.$get(`${this.api.listRole}/${this.page}/${this.pageSize}?name=${this.keyword}&clientId=`).then(res => {
this.listData = res.items
this.total = res.total

@ -80,9 +80,12 @@ export default {
this.getData()
},
download(row){
axios.get(`${this.api.downloadAgain}?table_id=${row.id}&fields=${row.fields}&startTime=${row.startTime ? row.startTime : ''}&endTime=${row.endTime ? row.endTime : ''}&frequency=${row.frequency ? row.frequency : ''}`,{
let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000)
axios.get(`${this.api.downloadData}?tableName=${row.tableNme}&table_id=${row.id}&fields=${row.fields}&startTime=${row.startTime ? row.startTime : ''}&endTime=${row.endTime ? row.endTime : ''}&frequency=${row.frequency ? row.frequency : ''}`,{
responseType: 'blob'
}).then(res => {
msgObj.close()
if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!')
const blob = new Blob([res.data])
const fileName = `${row.databaseName}.xls`
if ('download' in document.createElement('a')) { // IE
@ -97,7 +100,10 @@ export default {
} else { // IE10+
navigator.msSaveBlob(blob, fileName)
}
}).catch(res => {})
this.$post(`${this.api.saveRecord}?platformUserId=4&tableId=${row.id}&type=1&schoolId=1`).then(res => {}).catch(res => {})
}).catch(res => {
msgObj.close()
})
}
}
};

@ -2,6 +2,7 @@
<div class="wrap">
<div class="left">
<div class="inner">
<h6 class="school">广东工业大学</h6>
<div class="date">
<span class="name">使用期限</span>
<div class="val">
@ -9,6 +10,7 @@
</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>
</div>
</div>
<div class="right">
@ -23,13 +25,13 @@
</li>
<li>
<p class="people">
<span class="num">2</span>
<span class="num">{{dayCount}}</span>
</p>
<p class="text">平均日访客量</p>
</li>
<li>
<p class="people">
<span class="num">4</span>
<span class="num">{{schoolCount}}</span>
</p>
<p class="text">累计下载</p>
</li>
@ -49,6 +51,10 @@
<label>查询时间区域</label>
<el-date-picker v-model="date" align="right" unlink-panels type="daterange" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable size="small"></el-date-picker>
</li>
<li>
<label>搜索</label>
<el-input placeholder="请输入数据分类/数据库类别" v-model="keyword" suffix-icon="el-icon-search" clearable size="small"></el-input>
</li>
</ul>
</div>
<div class="flex j-between">
@ -62,17 +68,19 @@
<el-table :data="listData" class="table" stripe header-align="center" row-key="id" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="80" align="center"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="practiseName" label="数据分类" align="center"></el-table-column>
<el-table-column prop="paperName" label="数据库类别" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="下载量" align="center"></el-table-column>
<el-table-column prop="peopleNum" label="点击量" align="center"></el-table-column>
<el-table-column prop="categoryOne" label="数据分类" align="center"></el-table-column>
<el-table-column prop="categoryTwo" label="数据库类别" align="center"></el-table-column>
<el-table-column prop="download" label="下载量" align="center"></el-table-column>
<el-table-column prop="click" label="点击量" align="center"></el-table-column>
</el-table>
<div class="m-t-15 text-center">
<img src="../../../assets/img/arrow.png" class="arrow" :class="{active}" @click="toggleList" alt="">
</div>
</div>
<div class="block">
<div class="flex j-between">
<h6 class="title">按月份统计数据库使用概况</h6>
<div>
<el-button type="primary" size="small" v-auth="'/system/list:员工管理:批量导入'">导出数据</el-button>
</div>
@ -82,18 +90,18 @@
<el-table-column type="selection" width="80" align="center"></el-table-column>
<el-table-column prop="year" label="年份" align="center"></el-table-column>
<el-table-column prop="type" label="类别" align="center"></el-table-column>
<el-table-column prop="month1" label="1月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="2月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="3月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="4月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="5月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="6月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="7月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="8月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="9月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="10月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="11月" align="center"></el-table-column>
<el-table-column prop="questionsNum" label="12月" align="center"></el-table-column>
<el-table-column prop="1" label="1月" align="center"></el-table-column>
<el-table-column prop="2" label="2月" align="center"></el-table-column>
<el-table-column prop="3" label="3月" align="center"></el-table-column>
<el-table-column prop="4" label="4月" align="center"></el-table-column>
<el-table-column prop="5" label="5月" align="center"></el-table-column>
<el-table-column prop="6" label="6月" align="center"></el-table-column>
<el-table-column prop="7" label="7月" align="center"></el-table-column>
<el-table-column prop="8" label="8月" align="center"></el-table-column>
<el-table-column prop="9" label="9月" align="center"></el-table-column>
<el-table-column prop="10" label="10月" align="center"></el-table-column>
<el-table-column prop="11" label="11月" align="center"></el-table-column>
<el-table-column prop="12" label="12月" align="center"></el-table-column>
</el-table>
</div>
</div>
@ -104,10 +112,17 @@
export default {
data() {
return {
schoolId: 1001,
dayCount: 0,
schoolCount: 0,
keyword: '',
searchTimer: null,
date: [],
startTime: '',
endTime: '',
listData: [],
listDataKeyword: [],
listDataAll: [],
multipleSelection: [],
monthData: [
{
@ -125,9 +140,16 @@ export default {
},
],
multipleSelection1: [],
active: false
}
},
watch: {
keyword: function(val) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.searchData()
},500)
},
date: function(val){
if(val){
this.startTime = val[0]
@ -136,23 +158,66 @@ export default {
this.startTime = ''
this.endTime = ''
}
this.getData()
this.getDatabase()
}
},
mounted() {
this.getData()
},
methods: {
getData(){
this.$get(`${this.api.queryAccumulate}?schoolId=${this.schoolId}`).then(res => {
this.dayCount = res.dayCount
this.schoolCount = res.schoolCount
}).catch(res => {})
this.$get(`${this.api.queryDatabaseInfoByMonth}?schoolId=${this.schoolId}`).then(res => {
let list = res.message
let result = []
for(let i in list){
for(let n in list[i]){
let item = {
year: i,
type: n,
}
list[i][n].map((val,index) => {
item[index + 1] = val
})
result.push(item)
}
}
this.monthData = result
}).catch(res => {})
this.getDatabase()
},
getDatabase(){
this.$get(`${this.api.queryDatabaseInfo}?schoolId=${this.schoolId}&startTime=${this.startTime}&endTime=${this.endTime}`).then(res => {
let list = JSON.parse(res.databaseInfo)
this.listData = list.slice(0,10)
this.listDataAll = list
}).catch(res => {})
},
searchData(){
let list = this.listDataAll
let result = []
list.map(n => {
(n.categoryOne.includes(this.keyword) || n.categoryTwo.includes(this.keyword)) && result.push(n)
})
this.listData = this.active ? result : result.slice(0,10)
this.listDataKeyword = result
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
if (rowIndex % 2 === 0) {
if (!columnIndex || columnIndex == 1) {
if (rowIndex % 3 == 0) {
return {
rowspan: 3,
colspan: 1
};
}
}else {
return {
rowspan: 0,
colspan: 0
}
}
}
},
@ -162,6 +227,22 @@ export default {
handleSelectionChange1(val) {
this.multipleSelection1 = val
},
toggleList(){
if(this.keyword){
if(this.active){
this.listData = this.listDataKeyword.slice(0,10)
}else{
this.listData = this.listDataKeyword
}
}else{
if(this.active){
this.listData = this.listDataAll.slice(0,10)
}else{
this.listData = this.listDataAll
}
}
this.active = !this.active
}
}
};
</script>
@ -176,6 +257,12 @@ export default {
padding: 15px;
background-color: #fff;
border-radius: 8px;
.school{
margin-bottom: 15px;
font-size: 20px;
color: #568DF2;
text-align: center;
}
.date{
display: flex;
align-items: center;
@ -213,6 +300,12 @@ export default {
line-height: 1.8;
border-left: 6px solid;
}
.arrow{
cursor: pointer;
&.active{
transform: rotate(180deg)
}
}
.stat{
display: flex;
li{

@ -2,11 +2,34 @@
<div>
<div class="page">
<div class="page-content">
<div class="tool">
<div class="tool" style="margin-bottom: 0;">
<ul class="filter">
<li>
<label>创建时间</label>
<el-select v-model="month" placeholder="请选择创建时间" size="small" clearable class="w-150">
<el-option v-for="(item,index) in monthList" :key="index" :label="item.label" :value="item.id"></el-option>
</el-select>
</li>
<li>
<label>时间范围</label>
<el-date-picker v-model="date" align="right" unlink-panels type="daterange" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable size="small"></el-date-picker>
</li>
<li>
<label>角色</label>
<el-select v-model="role" placeholder="请选择角色" size="small" clearable class="w-150" @change="initData">
<el-option label="不限" value=""></el-option>
<el-option v-for="(item,index) in roleList" :key="index" :label="item.roleName" :value="item.id"></el-option>
</el-select>
</li>
<li>
<label>状态</label>
<el-select v-model="status" placeholder="请选择状态" size="small" clearable class="w-150" @change="initData">
<el-option v-for="(item,index) in statusList" :key="index" :label="item.label" :value="item.id"></el-option>
</el-select>
</li>
<li>
<label>搜索</label>
<el-input style="width: 250px" placeholder="请输入员工姓名/工号/角色名称" v-model="keyword" suffix-icon="el-icon-search" clearable size="small"></el-input>
<el-input style="width: 250px" placeholder="请输入员工账号/姓名/工号" v-model="keyword" suffix-icon="el-icon-search" clearable size="small"></el-input>
</li>
</ul>
<div>
@ -23,20 +46,29 @@
<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="roleName" label="账号角色" align="center"></el-table-column>
<el-table-column label="权限状态" align="center">
<template slot-scope="scope">
{{scope.row.disableAccount ? '禁用' : '启用'}}
</template>
</el-table-column>
<el-table-column label="账号角色" align="center">
<template slot-scope="scope">
{{roleList.find(n => n.id == scope.row.roleId) ? roleList.find(n => n.id == scope.row.roleId).roleName : ''}}
</template>
</el-table-column>
<el-table-column prop="loginNumber" label="登录次数" align="center">
<template slot-scope="scope">
{{scope.row.loginNumber ? scope.row.loginNumber : 0}}
</template>
</el-table-column>
<el-table-column prop="lastLoginTime" label="上次登录时间" width="160" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="200">
<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="resetPassword(scope.row)" v-auth="'/system/list:员工管理:重置密码'">重置密码</el-button>
<el-button type="text" @click="delTeacher(scope.row)" v-auth="'/system/list:员工管理:删除'">删除</el-button>
<el-switch v-model="scope.row.isDisable" :active-value="0" :inactive-value="1" style="margin: 0 10px 0 5px" :active-text="scope.row.isDisable ? '关' : '开'" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
<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>
</template>
</el-table-column>
</el-table>
@ -44,35 +76,35 @@
<el-pagination background layout="total,prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination>
</div>
<el-dialog :title="isDetail ? '查看员工' : (isAddteacher ? '新增员工' : '编辑员工')" :visible.sync="teacherVisible" width="500px" @close="closeTeacher" class="dialog" :close-on-click-modal="false">
<el-form ref="teacherForm" :model="teacherForm" :rules="rules" label-width="110px" label-suffix="" :disabled="isDetail">
<el-form-item prop="userAccount" label="账号">
<el-input v-model="teacherForm.userAccount" ref="account" placeholder="请输入职工账号" @change="accountChange"></el-input>
<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>
</el-form-item>
<el-form-item prop="userName" label="用户姓名">
<el-input v-model="teacherForm.userName" placeholder="请输入员工姓名"></el-input>
<el-input v-model="form.userName" placeholder="请输入员工姓名"></el-input>
</el-form-item>
<el-form-item prop="roleValue" label="账号角色">
<el-select v-model="teacherForm.roleValue" placeholder="请选择账号角色" :disabled="!isAddteacher">
<el-form-item prop="roleId" label="账号角色">
<el-select v-model="form.roleId" placeholder="请选择账号角色">
<el-option v-for="(item,index) in roleList" :key="index" :label="item.roleName" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="uniqueIdentificationAccount" label="唯一标识">
<el-input disabled v-model="teacherForm.uniqueIdentificationAccount" placeholder="请输入工号/学号获取唯一标识"></el-input>
<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="teacherForm.phone" placeholder="请输入手机号" maxlength="11"></el-input>
<el-input v-model="form.phone" placeholder="请输入手机号" maxlength="11"></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model="teacherForm.email" placeholder="请输入邮箱"></el-input>
<el-input v-model="form.email" placeholder="请输入邮箱"></el-input>
</el-form-item>
<el-form-item prop="workNumber" label="工号/学号">
<el-input v-model="teacherForm.workNumber" placeholder="请输入职工工号" @change="workNumberChange"></el-input>
<el-input v-model="form.workNumber" placeholder="请输入职工工号" @change="workNumberChange"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button size="small" @click="teacherVisible = false"> </el-button>
<el-button size="small" type="primary" @click="saveSure('teacherForm')"> </el-button>
<el-button size="small" @click="userVisible = false"> </el-button>
<el-button size="small" type="primary" @click="confirm"> </el-button>
</span>
</el-dialog>
@ -102,32 +134,60 @@ import util from '@/libs/util'
export default {
data() {
return {
pages: 10,
schoolId: 1001,
month: '',
monthList: [
{
id: '',
label: '不限'
},{
id: 3,
label: '近3个月'
},{
id: 6,
label: '近6个月'
},{
id: 12,
label: '近1年'
}
],
date: [],
startTime: '',
endTime: '',
role: '',
status: '',
statusList: [
{
id: '',
label: '不限'
},{
id: 0,
label: '启用'
},{
id: 1,
label: '禁用'
}
],
isDetail: false,
props: { multiple: true },
orgList: [],
isAddteacher: false,
teacherVisible: false,
staffShowVisible: false,
userVisible: false,
roleList: [],
teacherForm: {
teacherId: '',
form: {
platformId: Setting.platformId,
// type: 1, //
account: '',
userId: '',
userName: '',
roleValue: '',
roleId: '',
phone: '',
uniqueIdentificationAccount: '',
uniqueIdentification: '',
workNumber: '',
email: '',
major: '',
department: '',
userAccount: '',
major: '',
clientId: this.clientId,
clientName: this.clientName,
schoolId: this.schoolId,
password: ''
},
rules: {
userAccount: [
{ required: true, message: '请输入账号', trigger: 'blur' },
account: [
{ required: true, message: '请输入职工账号', trigger: 'blur' },
{
pattern: /^[A-Za-z0-9]+$/,
message: '请输入正确的账号',
@ -137,45 +197,31 @@ export default {
userName: [
{ required: true, message: '请输入用户姓名', trigger: 'blur' }
],
roleValue: [
roleId: [
{ required: true, message: '请选择账号角色', trigger: 'change' }
],
uniqueIdentificationAccount: [
// { required: true, message: '', trigger: 'blur' },
],
major: [
{ required: true, message: '请选择一级部门', trigger: 'change' }
],
workNumber: [
{ required: true, message: '请输入职工工号', trigger: 'blur' },
{ required: true, message: '请输入工号/学号', trigger: 'blur' },
{
pattern: /^[A-Za-z0-9]+$/,
message: '请输入正确的职工工号',
trigger: 'blur'
pattern: /^[A-Za-z0-9]+$/,
message: '请输入正确的工号/学号',
trigger: 'blur'
}
],
department: [
{ required: true, message: '请选择二级部门', trigger: 'change' }
],
phone: [
// { required: true, message: '', trigger: 'blur' },
{
pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的手机号',
trigger: 'blur'
pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的手机号',
trigger: 'blur'
}
],
email: [
// { required: true, message: '', trigger: 'blur' },
{
pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/,
message: '请输入正确的邮箱',
trigger: 'blur'
pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/,
message: '请输入正确的邮箱',
trigger: 'blur'
}
],
// schoolId: [
// { required: true, message: '', trigger: 'change' }
// ],
},
listData: [],
importVisible: false,
@ -183,32 +229,12 @@ export default {
page: 1,
pageSize: 10,
total: 0,
departmentList: [],
teacherDepartmentList: [],
staffstateProfessId: '',
staffGradeId: '',
multipleSelection: [],
uploadList: [],
provinceId: this.$store.state.provinceId,
cityId: this.$store.state.cityId,
userId: this.$store.state.userId,
oneDepartmentIds: '',
twoDepartmentIds: '',
ProfessionalClassList: [],
subjectList: [],
ProfessionalList: [],
NoAdd: '',
AccountNoAdd: '',
NumberNoAdd: '',
platformId: this.$store.state.platformId,
schoolList: [],
uploadFaild: false,
token: '',
accountRepeat: false,
workNumberRepeat: false,
originalAccount: '',
originalWorkNumber: '',
password: Setting.initialPassword
};
},
computed: {
@ -225,59 +251,45 @@ export default {
this.searchTimer = setTimeout(() => {
this.initData()
},500)
},
month: function(val){
if(val){
let unit = 24 * 60 * 60 * 1000
this.date = [util.formatDate('yyyy-MM-dd',new Date(new Date().getTime() - unit * 30 * val)),util.formatDate('yyyy-MM-dd',new Date(new Date().getTime() + unit))]
}else{
this.date = []
}
},
date: function(val){
if(val.length){
this.startTime = val[0]
this.endTime = val[1]
}else{
this.startTime = ''
this.endTime = ''
}
this.initData()
}
},
mounted(){
this.getOrg()
this.teacherForm.clientId = this.clientId
this.teacherForm.clientName = this.clientName
this.form.schoolId = this.schoolId
this.getData()
this.getRoles()
this.getRole()
},
methods: {
getOrg(){
let data = {
schoolId: this.clientId
}
this.$get(this.api.queryStaffPro,data).then(res => {
let firList = res.data.StaffProfessionalArchitectureList
if(firList){
firList.map(e => {
e.isParent = true
e.value = e.staffProfessionalArchitectureId
e.label = e.staffProfessionalArchitectureName
let data = {
staffProfessionalArchitectureId: e.staffProfessionalArchitectureId
}
this.$get(this.api.queryStaffGrade,data).then(res1 => {
res1.data.staffGradeList.map(e => {
e.value = e.staffGradeId
e.label = e.staffGradeName
})
e.children = res1.data.staffGradeList
}).catch(res => {})
})
setTimeout(() => {
this.orgList = firList
},500)
}
}).catch(res => {})
},
getData(){
let totalPage = Math.ceil((this.total - 1) / this.pageSize)
let currentPage = this.page > totalPage ? totalPage : this.page
this.page = currentPage < 1 ? 1 : currentPage
let data = {
staffProfessionalArchitectureIds: this.oneDepartmentIds,
staffGradeIds: this.twoDepartmentIds,
searchContent: this.keyword,
schoolId: this.clientId,
this.$post(this.api.getUserList,{
createTime: this.startTime,
disableAccount: this.status,
endTime: this.endTime,
keyWord: this.keyword,
pageNum: this.page,
pageSize: this.pageSize
}
this.$get(`${this.api.queryStaff}/${this.page}/${this.pageSize}`,data).then(res => {
this.listData = res.data.staffList.list
this.total = res.data.staffList.totalCount
pageSize: this.pageSize,
platformId: Setting.platformId,
roleId: this.role,
}).then(res => {
this.listData = res.pageList.records
this.total = res.pageList.total
if(!this.listData.length && this.total){
this.page--
this.getData()
@ -288,16 +300,9 @@ export default {
this.page = 1
this.getData()
},
orgChange(node){
this.twoDepartmentIds = node.map(n => n[1]).toString()
this.initData()
},
getRoles(){
let data = {
clientId: this.clientId
}
this.$get(`${this.api.queryRoles}/1/100`,data).then(res => {
this.roleList = res.data.items
getRole(){
this.$get(this.api.getRoles).then(res => {
this.roleList = res.list
}).catch(res => {})
},
resetPassword(row){
@ -319,173 +324,107 @@ export default {
}).catch(() => {})
},
accountChange(){
if(this.teacherForm.userAccount !== this.originalAccount){
this.$get(`${this.api.getAccount}?account=${this.teacherForm.userAccount}`).then(res => {
if(res.data.userInfo){
// if(this.form.account !== this.originalAccount){
this.$get(`${this.api.checkAccount}?account=${this.form.account}&type=1`).then(res => {
if(res.status == 200){
this.accountRepeat = false
}else{
this.accountRepeat = true
util.warningMsg('该账号已存在')
}else{
this.accountRepeat = false
}
}).catch(res => {})
}else{
this.accountRepeat = false
}
// }else{
// this.accountRepeat = false
// }
},
workNumberChange(){
if(this.teacherForm.workNumber !== this.originalWorkNumber){
this.$get(`${this.api.getWorkNumber}?workNumber=${this.teacherForm.workNumber}`).then(res => {
if(res.data.staff){
// if(this.form.workNumber !== this.originalWorkNumber){
this.$get(`${this.api.checkAccount}?workNumber=${this.form.workNumber}&type=2`).then(res => {
if(res.status == 200){
this.workNumberRepeat = false
}else{
this.workNumberRepeat = true
util.warningMsg('该工号已存在')
}else{
this.workNumberRepeat = false
}
}).catch(res => {})
}else{
this.workNumberRepeat = false
}
// }else{
// this.workNumberRepeat = false
// }
},
closeTeacher(){
this.$refs.teacherForm.resetFields()
this.teacherForm.clientId = this.clientId
this.teacherForm.clientName = this.clientName
this.teacherForm.department = ''
this.teacherForm.major = ''
this.teacherForm.workNumber = ''
this.teacherForm.userId = ''
this.teacherForm.staffId = ''
closeUser(){
this.$refs.form.resetFields()
console.log(11,this.form)
},
addTeacher(){
this.isDetail = false
this.teacherVisible = true
this.userVisible = true
this.isAddteacher = true
this.teacherForm.teacherId = ''
},
getStaffDetail(userId){
this.$get(`${this.api.getStaff}/${userId}`).then(res => {
let user = res.data.userInfo;
let or = res.data.staff;
this.teacherForm.uniqueIdentificationAccount = user.uniqueIdentificationAccount
this.teacherForm.clientId = user.clientId
this.teacherForm.clientName = user.clientName
this.teacherForm.userName = user.userName
this.teacherForm.phone = user.phone
this.teacherForm.email = user.email
this.teacherForm.userAccount = user.account
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.teacherForm.userId = user.userId
this.teacherForm.schoolId = user.schoolId
this.teacherForm.roleValue = user.roleId
this.form.userId = user.userId
this.form.schoolId = user.schoolId
this.teacherForm.major = or.staffProfessionalArchitectureId
this.teacherForm.department = or.staffGradeId
this.teacherForm.workNumber = or.workNumber
this.form.workNumber = or.workNumber
this.originalWorkNumber = or.workNumber
this.isManager = true
this.teacherForm.staffId = or.staffId
this.getDepartment()
}).catch(res => {});
}).catch(res => {})
},
editTeacher(row){
this.isDetail = false
this.teacherVisible = true
this.userVisible = true
this.isAddteacher = false
this.AccountNoAdd = false
this.teacherForm.teacherId = row.staffId
this.getStaffDetail(row.staffId)
this.form.userId = row.userId
this.getStaffDetail(row.userId)
},
showTeacher(row){
this.staffShowVisible = true
this.isDetail = true
this.isAddManage = false
this.AccountNoAdd = false
this.teacherForm.manageId = row.staffId
this.getStaffDetail(row.staffId)
this.getStaffDetail(row.userId)
},
getDepartment(){
let data = {
staffProfessionalArchitectureId: this.teacherForm.major
}
this.$get(this.api.queryStaffGrade,data).then(res => {
this.departmentList = res.data.staffGradeList
}).catch(res => {});
},
async saveSure(teacherForm){
this.$refs[teacherForm].validate((valid) => {
confirm(){
this.$refs.form.validate((valid) => {
if (valid) {
if(this.accountRepeat) return util.warningMsg('该账号已存在')
if(this.workNumberRepeat) return util.warningMsg('该工号已存在')
let isTeacher = false
let isManager = false
let data = {
userInfo: {
userId: this.teacherForm.userId,
userName: this.teacherForm.userName,
account: this.teacherForm.userAccount,
clientId: this.teacherForm.clientId,
clientName: this.teacherForm.clientName,
roleId: this.teacherForm.roleValue,
phone: this.teacherForm.phone,
email: this.teacherForm.email,
isPort: 2,
uniqueIdentificationAccount: this.teacherForm.uniqueIdentificationAccount ? this.teacherForm.uniqueIdentificationAccount : Date.parse(new Date()),
}
}
let oneDepartmentName = '';
for(let i in this.orgList){
if(this.orgList[i].staffProfessionalArchitectureId == this.teacherForm.major) {
oneDepartmentName = this.orgList[i].staffProfessionalArchitectureName
break;
}
}
let twoDepartmentName = this.departmentList.find((n) => {
return n.staffGradeId == this.teacherForm.department
}).staffGradeName;
data.staff = {
roleId: this.teacherForm.roleValue,
isPort: 2,
schoolId: this.teacherForm.clientId,
staffId: this.teacherForm.staffId,
userId: this.teacherForm.userId,
workNumber: this.teacherForm.workNumber,
staffProfessionalArchitectureId: this.teacherForm.major,
staffGradeId: this.teacherForm.department,
staffProfessionalArchitectureName: oneDepartmentName,
staffGradeName: twoDepartmentName,
};
if(this.teacherForm.teacherId){
let data = this.form
if(!data.uniqueIdentification) data.uniqueIdentification = new Date().getTime()
console.log(22,data)
if(this.form.userId){
this.$post(this.api.updateStaff,data).then(res => {
this.teacherVisible = false
util.successMsg('编辑成功');
this.userVisible = false
util.successMsg('编辑成功')
this.getData()
}).catch(res => {});
}).catch(res => {})
}else{
this.$post(this.api.addStaff,data).then(res => {
this.teacherVisible = false
util.successMsg('添加成功');
this.$post(this.api.saveUser,data).then(res => {
this.userVisible = false
util.successMsg('添加成功')
this.getData()
}).catch(res => {});
}).catch(res => {})
}
}else{
return false;
}
})
},
delTeacher(row){
handleDelete(row){
this.$confirm('此删除操作不可逆,是否确认删除选中项?', '提示', {
type: 'warning'
})
.then(() => {
}).then(() => {
let data = {
staffIds: row.staffId
}
this.$del(this.api.deleteStaffs,data).then(res => {
util.successMsg('删除成功')
this.getData()
}).catch(res => {});
})
.catch(() => {});
}).catch(res => {})
}).catch(() => {})
},
switchOff(val,row,index) {
let data = {
@ -493,24 +432,22 @@ export default {
isDisable: val
}
this.$post(this.api.updateClient,data).then((res) => {
val == 1 ? util.warningMsg('该院校系统使用权限已关闭') : util.successMsg('该院校系统使用权限已激活')
val == 1 ? util.warningMsg('该用权限已关闭') : util.successMsg('该用权限已激活')
}).catch((res) => {
})
},
handleSelectionChange(val) {
this.multipleSelection = val;
this.multipleSelection = val
},
delAllSelection() {
if(this.multipleSelection.length != ''){
let newArr = this.multipleSelection
let delList = newArr.map(item => {
return item.staffId
return item.userId
})
//
this.$confirm(`此批量删除操作不可逆,是否确认删除${util.ellipsisStr(newArr[0].userName)}${newArr.length}个选中项?`, '提示', {
type: 'warning'
})
.then(() => {
}).then(() => {
let data = {
staffIds: delList.join(',')
}
@ -518,8 +455,8 @@ export default {
this.$refs.table.clearSelection()
util.successMsg('删除成功')
this.getData()
}).catch(res => {});
}).catch(() => {});
}).catch(res => {})
}).catch(() => {})
}else{
util.errorMsg('请先选择数据 !')
}
@ -544,7 +481,6 @@ export default {
showFaild(){
location.href = `${this.api.exportFailureStaff}?token=${this.token}`
},
//
handleExceed(files, fileList) {
util.warningMsg(
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
@ -590,6 +526,13 @@ export default {
};
</script>
<style lang="scss" scoped>
.filter{
flex-wrap: wrap;
li{
width: 30%;
margin-bottom: 16px;
}
}
/deep/.dialog{
.el-form-item{
.el-form-item__label{
@ -605,23 +548,4 @@ export default {
width: 100%;
}
}
.list{
li{
display: flex;
justify-content: center;
align-items: center;
margin: 32px 0;
.name,.val{
font-size: 16px;
color: rgba(0, 0, 0, 0.65);
}
.name{
width: 45%;
text-align: right;
}
.val{
width: 55%;
}
}
}
</style>
</style>

@ -101,10 +101,10 @@ function get(url, params){
if(res){
resolve(res)
}else{
reject()
reject(res)
}
}).catch(err => {
reject(err.data)
reject(err)
})
})
}

@ -16,7 +16,7 @@ const Setting = {
showProgressBar: true,
// 接口请求地址
// apiBaseURL: env === 'development' ? 'http://192.168.31.125:8888' : 'http://39.108.250.202:8000',
apiBaseURL: env === 'development' ? 'http://192.168.31.151:10001' : 'http://www.liuwanr.cn',
apiBaseURL: env === 'development' ? 'http://192.168.31.151:9000' : 'http://www.liuwanr.cn',
// 接口请求返回错误时,弹窗的持续时间,单位:秒
modalDuration: 3,
// 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice
@ -39,6 +39,10 @@ const Setting = {
* 默认密码
*/
initialPassword: '111aaa',
/**
* 所属平台1->职站 2->数据平台
*/
platformId: 2,
/**
* 多语言配置
* */

Loading…
Cancel
Save