后台账号日志等修复

dev_2022-03-03
yujialong 3 years ago
parent 4822994d2d
commit b0d076fadc
  1. 4
      src/setting.js
  2. 26
      src/utils/api.js
  3. 2
      src/views/data/Framework.vue
  4. 29
      src/views/order/AddOrder.vue
  5. 60
      src/views/serve/projectAdd.vue
  6. 19
      src/views/system/log.vue
  7. 4
      src/views/system/manageLog.vue
  8. 537
      src/views/system/staff.vue

@ -13,8 +13,8 @@ if (isDev) {
// jumpPath = "http://39.108.250.202/judgmentPoint/";
jumpPath = "http://192.168.31.125:8087/"; // 本地调试-需要启动本地判分点系统
// host = "http://www.huorantech.cn:9000";//线上
// host = "http://39.108.250.202:9000/";//测试
host = 'http://192.168.31.151:9000/'// 榕
host = "http://39.108.250.202:9000/";//测试
// host = 'http://192.168.31.151:9000/'// 榕
// host = 'http://192.168.31.137:9000'// 赓
} else if (isTest) {
// jumpPath = "http://124.71.12.62/judgmentPoint/";

@ -1,7 +1,7 @@
import Setting from "@/setting";
const uploadURL = Setting.uploadURL
const host1 = 'http://192.168.31.137:9000'
const host1 = 'http://192.168.31.137:9000/'
export default {
@ -10,6 +10,8 @@ export default {
bindPhoneOrEmail: `users/users/userAccount/bindPhoneOrEmail`,// 绑定手机
sendPhoneOrEmailCode: `users/users/userAccount/sendPhoneOrEmailCode`,// 手机验证码
staffTemplate: `http://www.huorantech.cn/template/%E6%89%B9%E9%87%8F%E5%AF%BC%E5%85%A5%E5%91%98%E5%B7%A5%E6%A8%A1%E6%9D%BF.xlsx`, // 后台账号模板
checkEmailOrPhone: `occupationlab/architecture/checkEmailOrPhone`, // 新增学生前:校验手机号或者邮箱
checkWorkNumOrAccount: `occupationlab/architecture/checkWorkNumOrAccount`, // 新增/编辑学生前:校验学号或者学生账号
@ -214,15 +216,17 @@ export default {
getKeywordByCategoryId: `data/keyword/getKeywordByCategoryId`,
// 后台账号
deleteArch: `${host1}/nakadai/staffAccountArchitecture/delete`,
saveArch: `${host1}/nakadai/staffAccountArchitecture/save`,
treeListArch: `${host1}/nakadai/staffAccountArchitecture/treeList`,
updateArch: `${host1}/nakadai/staffAccountArchitecture/update`,
delStaff: `${host1}/nakadai/backstageStaff/delStaff`,
modifyStaff: `${host1}/nakadai/backstageStaff/modifyStaff`,
saveStaff: `${host1}/nakadai/backstageStaff/saveStaff`,
staffDetail: `${host1}/nakadai/backstageStaff/staffDetail`,
staffList: `${host1}/nakadai/backstageStaff/staffList`,
deleteArch: `${host1}nakadai/staffAccountArchitecture/delete`,
saveArch: `${host1}nakadai/staffAccountArchitecture/save`,
treeListArch: `${host1}nakadai/staffAccountArchitecture/treeList`,
updateArch: `${host1}nakadai/staffAccountArchitecture/update`,
delStaff: `${host1}nakadai/backstageStaff/delStaff`,
modifyStaff: `${host1}nakadai/backstageStaff/modifyStaff`,
saveStaff: `${host1}nakadai/backstageStaff/saveStaff`,
staffDetail: `${host1}nakadai/backstageStaff/staffDetail`,
staffList: `${host1}nakadai/backstageStaff/staffList`,
importStaff: `${host1}nakadai/backstageStaff/importStaff`,
exportFailure: `${host1}nakadai/backstageStaff/exportFailure`,
// 角色管理
batchRemove: `users/role/batchRemove`, //批量删除角色
@ -241,5 +245,5 @@ export default {
logManagementList: `nakadai/log/logManagementList`,
platformLogList: `nakadai/log/platformLogList`,
listUpdate: `nakadai/log/update`,
checkRepeat: `${host1}/nakadai/log/checkRepeat`,
checkRepeat: `nakadai/log/checkRepeat`,
};

@ -1,6 +1,6 @@
<template>
<div class="wrap">
<!-- 左边的分类 -->
<!-- 左边的分类 -->
<div class="side">
<div class="plus">
<i class="el-icon-circle-plus-outline" @click.stop="addType(0)"></i>

@ -119,20 +119,18 @@
<template slot-scope="scope">
<div class="small">
<el-input
style='width: 80px'
class="time-input"
onkeyup="value=this.value.replace(/\D+/g,'')"
:class="!scope.row.periodOfUse&&whetherSubmit?'red':''"
:disabled="viewDisabled||editDisabled" maxlength="4"
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)"
oninput="value=value.replace(/[^0-9.]/g,'')"
v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input>
<span style="margin-left:5px">
<el-select v-model="scope.row.options" :disabled="viewDisabled||editDisabled" placeholder="请选择" @change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)">
<el-select class="time-select" v-model="scope.row.options" :disabled="viewDisabled||editDisabled" placeholder="请选择" @change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)">
<el-option label="日" :value="0"></el-option>
<el-option label="月" :value="1"></el-option>
<el-option label="年" :value="2"></el-option>
</el-select>
</span>
</div>
</template>
</el-table-column>
@ -259,13 +257,14 @@
<template slot-scope="scope">
<div class="small">
<el-input onkeyup="value=this.value.replace(/\D+/g,'')"
:class="!scope.row.periodOfUse&&whetherSubmit?'red':''"
:disabled="viewDisabled||editDisabled" maxlength="4"
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)"
oninput="value=value.replace(/[^0-9.]/g,'')"
v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input>
class="time-input"
:class="!scope.row.periodOfUse&&whetherSubmit?'red':''"
:disabled="viewDisabled||editDisabled" maxlength="4"
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)"
oninput="value=value.replace(/[^0-9.]/g,'')"
v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input>
<span style="margin-left:5px">
<el-select v-model="scope.row.options" :disabled="viewDisabled||editDisabled" placeholder="请选择" @change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)">
<el-select class="time-select" v-model="scope.row.options" :disabled="viewDisabled||editDisabled" placeholder="请选择" @change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)">
<el-option label="日" :value="0"></el-option>
<el-option label="月" :value="1"></el-option>
<el-option label="年" :value="2"></el-option>
@ -1518,8 +1517,14 @@ export default {
/deep/ .course-input .el-input__inner {
width: 100px;
}
/deep/.orderTable .el-select>.el-input{
width: 30%;
.time-input{
width: 90px !important;
}
/deep/.time-select{
margin-left: 5px;
.el-input {
width: 70px !important;
}
}
/deep/.orderTables .el-select>.el-input{
width: 35%;

@ -392,7 +392,7 @@ export default {
});
}
},
judgmentRelease() { //
judgmentRelease(state) { //
let {
projectName,
experimentTarget,
@ -408,39 +408,41 @@ export default {
this.$message.warning("该项目名称已存在");
return false;
}
let reg = /<\/?.+?\/?>/g
let experimentTargets = experimentTarget.replace(reg, '')
if (!experimentTargets) {
this.$message.warning("请输入实验目标");
return false;
}
let experimentDescriptions = experimentDescription.replace(reg, '')
if (!experimentDescriptions) {
this.$message.warning("请输入案例描述");
return false;
}
if (this.projectJudgmentData.length == 0) {
this.$message.warning("请添加判分点");
return false;
}
if (this.handDistributionScore < 100) {
this.$message.warning("判分点分数未满100");
return false;
}
if (this.handDistributionScore > 100) {
this.$message.warning("判分点分数已超过100");
return false;
}
let experimentHints = experimentHint.replace(reg, '')
if (!experimentHints && hintOpen == 0) {
this.$message.warning("请输入实验提示");
return false;
if (state) {
let reg = /<\/?.+?\/?>/g
let experimentTargets = experimentTarget.replace(reg, '')
if (!experimentTargets) {
this.$message.warning("请输入实验目标");
return false;
}
let experimentDescriptions = experimentDescription.replace(reg, '')
if (!experimentDescriptions) {
this.$message.warning("请输入案例描述");
return false;
}
if (this.projectJudgmentData.length == 0) {
this.$message.warning("请添加判分点");
return false;
}
if (this.handDistributionScore < 100) {
this.$message.warning("判分点分数未满100");
return false;
}
if (this.handDistributionScore > 100) {
this.$message.warning("判分点分数已超过100");
return false;
}
let experimentHints = experimentHint.replace(reg, '')
if (!experimentHints && hintOpen == 0) {
this.$message.warning("请输入实验提示");
return false;
}
}
return true;
},
handleSubmit(state) { //
if (this.submiting) return false
if (!this.judgmentRelease()) { //
if (!this.judgmentRelease(state)) { //
return;
}
this.submiting = true

@ -11,11 +11,7 @@
<el-table :data="listData" class="table" ref="table" stripe header-align="center" row-key="id">
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column prop="roleName" label="平台名称" align="center" min-width="250" show-overflow-tooltip>
<template slot-scope="scope">
{{ platformList.find(e => e.id === scope.row.platformId) && platformList.find(e => e.id === scope.row.platformId).name }}
</template>
</el-table-column>
<el-table-column prop="name" label="平台名称" align="center" min-width="250" show-overflow-tooltip></el-table-column>
<el-table-column prop="versionName" label="最新版本名称" align="center"></el-table-column>
<el-table-column prop="roleName" label="最新版本状态" align="center">
<template slot-scope="scope">
@ -49,6 +45,7 @@ export default {
roleName: "",
remark: ""
},
listDataAll: [],
listData: [],
page: 1,
pageSize: 10,
@ -59,7 +56,8 @@ export default {
keyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.getData();
const list = this.listData
this.listData = val ? list.filter(e => e.name.includes(val)) : this.listDataAll
}, 500);
}
},
@ -69,7 +67,14 @@ export default {
methods: {
getData() {
this.$get(`${this.api.logManagementList}?search=${this.keyword}`).then(res => {
this.listData = res.logManagementListVo
const list = res.logManagementListVo
const platformList = this.platformList
list.map(e => {
const item = platformList.find(n => n.id === e.platformId)
if (item) e.name = item.name
})
this.listDataAll = res.logManagementListVo
this.listData = res.logManagementListVo
}).catch(res => {})
},
currentChange(val) {

@ -206,6 +206,10 @@ export default {
top: 15px;
padding-left: 40px;
}
.el-timeline-item__tail {
height: 250%;
border-left-width: 1px;
}
.sign {
position: relative;
display: inline-block;

@ -1,199 +1,198 @@
<template>
<div>
<el-row :gutter="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="initData">
<div class="m-b-20">
<el-radio :label="1">所有员工</el-radio>
</div>
<div>
<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>
<el-button type="text" @click="addOrg">添加</el-button>
</div>
<div class="wrap">
<!-- 左边的组织 -->
<div class="side">
<div class="m-b-20">
<h6 class="p-title">后台员工账号</h6>
<el-radio-group v-model="studentType" @change="changeType">
<div class="m-b-20">
<el-radio :label="1">所有员工</el-radio>
</div>
<div>
<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>
<el-button type="text" @click="addOrg">添加</el-button>
</div>
<div style="height: 504px; max-height: 504px; overflow: auto">
<el-tree
:data="orgList"
default-expand-all
ref="orgTree"
node-key="id"
highlight-current
:expand-on-click-node="false"
@node-click="handleNodeClick"
:props="{children: 'children', label: 'organizationName', isLeaf: 'leaf'}"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span class="org-name">{{ node.label }}</span>
<span>
<el-button
type="text"
icon="el-icon-edit-outline"
@click="() => editOrg(node, data)">
</el-button>
<el-button
type="text"
icon="el-icon-circle-plus-outline"
@click="() => addOrg(node, data)">
</el-button>
</span>
</span>
</el-tree>
</div>
</div>
<div style="height: 504px; max-height: 504px; overflow: auto">
<el-tree
:data="orgList"
default-expand-all
ref="orgTree"
node-key="id"
highlight-current
:expand-on-click-node="false"
@node-click="handleNodeClick"
:props="{children: 'children', label: 'organizationName', isLeaf: 'leaf'}"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span class="org-name">{{ node.label }}</span>
<span>
<el-button
type="text"
icon="el-icon-circle-plus-outline"
@click="() => addOrg(node, data)">
</el-button>
<el-button
type="text"
icon="el-icon-edit-outline"
@click="() => editOrg(node, data)">
</el-button>
<el-button
type="text"
icon="el-icon-delete"
@click="() => delOrg(node, data)">
</el-button>
</span>
</span>
</el-tree>
</div>
</div>
<el-dialog
:title="orgForm.id ? '编辑' : '新增' + '部门'"
:visible.sync="orgVisible"
:close-on-click-modal="false"
width="50%"
<el-dialog
:title="orgForm.id ? '编辑' : '新增' + '部门'"
:visible.sync="orgVisible"
:close-on-click-modal="false"
width="50%"
>
<el-form v-if="orgVisible" ref="orgForm" :model="orgForm" :rules="orgRules" label-width="100px">
<el-form-item label="部门名称" prop="organizationName">
<el-input v-model.trim="orgForm.organizationName" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="上级部门">
<span v-if="orgForm.parentName">{{ orgForm.parentName }}</span>
<el-cascader
v-else
:options="orgListDia"
v-model="cascaderValue"
:props="cascaderProps"
clearable
style="width: 100%"
>
<el-form v-if="orgVisible" ref="orgForm" :model="orgForm" :rules="rules" label-width="100px">
<el-form-item label="部门名称" prop="organizationName">
<el-input v-model.trim="orgForm.organizationName" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="上级部门">
<span v-if="orgForm.parentName">{{ orgForm.parentName }}</span>
<el-cascader
v-else
:options="orgListDia"
v-model="cascaderValue"
:props="cascaderProps"
clearable
style="width: 100%"
>
</el-cascader>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button v-if="!orgForm.id" @click="closeOrg"> </el-button>
<el-button v-else type="danger" plain @click="delOrg">删除</el-button>
<el-button type="primary" @click="orgSubmit"> </el-button>
</span>
</el-dialog>
</el-cascader>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeOrg"> </el-button>
<el-button type="primary" @click="orgSubmit"> </el-button>
</span>
</el-dialog>
</div>
<!-- 右边的员工 -->
<div class="right">
<h6 class="p-title">筛选</h6>
<div class="tool">
<ul class="filter">
<li>
<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="addStaff">新增员工</el-button>
<el-button type="primary" @click="batchImport">批量导入</el-button>
</div>
</div>
</div>
</el-col>
<el-col :span="20">
<div class="page">
<h6 class="p-title">筛选</h6>
<div class="tool">
<ul class="filter">
<li>
<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="addStaff">新增员工</el-button>
<el-button type="primary" @click="batchImport">批量导入</el-button>
</div>
</div>
<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="account" label="账号" align="center" min-width="100"></el-table-column>
<el-table-column prop="phone" label="手机号" align="center" width="120"></el-table-column>
<el-table-column prop="staffArchitectureName" label="所在部门" align="center" min-width="100"></el-table-column>
<el-table-column prop="roleName" label="授权角色" align="center" width="100"></el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button type="text" @click="queryStaff(scope.row,true)">查看</el-button>
<el-button type="text" @click="queryStaff(scope.row,false)">编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-button type="text" @click="delStaff(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination>
</div>
<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="account" label="账号" align="center" min-width="100"></el-table-column>
<el-table-column prop="phone" label="手机号" align="center" width="120"></el-table-column>
<el-table-column prop="staffArchitectureName" label="所在部门" align="center" min-width="100"></el-table-column>
<el-table-column prop="roleName" label="授权角色" align="center" width="100"></el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button type="text" @click="queryStaff(scope.row,true)">查看</el-button>
<el-button type="text" @click="queryStaff(scope.row,false)">编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-button type="text" @click="delStaff(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination>
</div>
<el-dialog :title="isDetail ? '查看' : (form.accountId ? '编辑' : '新增') + '员工'" :visible.sync="staffVisible" width="580px" class="dialog" :close-on-click-modal="false" @close="closeStaff">
<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="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.trim="form.account" placeholder="请输入账号"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11"></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model.trim="form.email" placeholder="请输入邮箱"></el-input>
</el-form-item>
<el-form-item prop="roleList" label="授权角色">
<el-select class="w-100" v-model="form.roleList" multiple>
<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-form-item label="所在部门">
<el-cascader
class="w-100"
v-model="form.staffArchitectureId"
:options="orgList"
:props="casProps"
></el-cascader>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button @click="staffVisible = false">取消</el-button>
<el-button type="primary" @click="submitStaff">确定</el-button>
</span>
</el-dialog>
<el-dialog :title="isDetail ? '查看' : (form.accountId ? '编辑' : '新增') + '员工'" :visible.sync="staffVisible" width="580px" class="dialog" :close-on-click-modal="false" @close="closeStaff">
<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="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.trim="form.account" placeholder="请输入账号"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11"></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model.trim="form.email" placeholder="请输入邮箱"></el-input>
</el-form-item>
<el-form-item prop="roleList" label="授权角色">
<el-select class="w-100" v-model="form.roleList" multiple>
<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-form-item label="所在部门">
<el-cascader
class="w-100"
v-model="form.staffArchitectureId"
:options="orgList"
:props="casProps"
></el-cascader>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button @click="staffVisible = false">取消</el-button>
<el-button type="primary" @click="submitStaff">确定</el-button>
</span>
</el-dialog>
<el-dialog title="批量导入" :visible.sync="importVisible" width="24%" :close-on-click-modal="false">
<div style="text-align: center">
<div style="margin-bottom: 10px;">
<el-button type="primary" @click="downLoad">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
</div>
<el-upload
name="file"
accept=".xls,.xlsx"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.importStudent"
:file-list="uploadList"
:headers="headers"
>
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button>
</el-upload>
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败查看失败原因</el-link>
</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>
</span>
</el-dialog>
</div>
</el-col>
</el-row>
<el-dialog title="批量导入" :visible.sync="importVisible" width="24%" :close-on-click-modal="false">
<div style="text-align: center">
<div style="margin-bottom: 10px;">
<el-button type="primary" @click="downLoad">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
</div>
<el-upload
name="file"
accept=".xls,.xlsx"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.importStaff"
:file-list="uploadList"
:headers="headers"
>
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button>
</el-upload>
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败查看失败原因</el-link>
</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>
</span>
</el-dialog>
</div>
</div>
</template>
@ -288,6 +287,11 @@ export default {
account: '',
staffArchitectureId: []
},
orgRules: {
organizationName: [
{ required: true, message: "请输入部门名称", trigger: "blur" }
]
},
rules: {
account: [
{ required: true,validator: accountPass, trigger: 'blur' }
@ -325,7 +329,8 @@ export default {
multiple: true,
checkStrictly: true,
label: 'organizationName',
value: 'id'
value: 'id',
isLeaf: 'leaf'
},
importVisible: false,
@ -354,6 +359,17 @@ export default {
async getOrg() {
const res = await this.$post(this.api.treeListArch)
const list = res.treeList
// children
const handleLeaf = list => {
list.map(e => {
if (e.children.length) {
handleLeaf(e.children)
} else {
delete e.children
}
})
}
handleLeaf(list)
this.orgList = list
this.handleOrgId(list)
this.getStaff()
@ -362,9 +378,13 @@ export default {
handleOrgId(list, ids) {
list.forEach(e => {
e.ids = ids ? [...ids, e.id] : [e.id]
this.handleOrgId(e.children, e.ids)
e.children && this.handleOrgId(e.children, e.ids)
})
},
//
changeType() {
this.initData(true)
},
//
addOrg(node, data) {
this.orgForm = {
@ -397,25 +417,25 @@ export default {
// disabled
if (disabled) {
e.disabled = true
this.handleOrg(e.children, id, 1)
e.children && this.handleOrg(e.children, id, 1)
} else {
if (e.id === id) {
e.disabled = true
this.handleOrg(e.children, id, 1)
e.children && this.handleOrg(e.children, id, 1)
} else {
this.handleOrg(e.children, id, 0)
e.children && this.handleOrg(e.children, id, 0)
}
}
})
},
//
delOrg() {
delOrg(node, data) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.deleteArch}?id=${this.orgForm.id}`).then(res => {
this.$post(`${this.api.deleteArch}?id=${data.id}`).then(res => {
util.successMsg("删除成功")
this.closeOrg()
this.getOrg()
}).catch(res => {})
}).catch(() => {})
},
@ -459,10 +479,11 @@ export default {
this.getOrg()
},
//
getStaff() {
getStaff(fromType) {
const orgId = this.$refs.orgTree.getCurrentKey() || ''
this.$post(this.api.staffList, {
type: this.studentType || 1,
staffArchitectureId: this.$refs.orgTree.getCurrentKey() || '',
staffArchitectureId: fromType ? '' : orgId,
keyWord: this.keyWord,
pageNum: this.page,
pageSize: this.pageSize
@ -479,10 +500,10 @@ export default {
handleSelectionChange(val) { //
this.multipleSelection = val
},
initData() {
initData(fromType) {
this.$refs.table.clearSelection()
this.page = 1
this.getStaff()
this.getStaff(fromType)
},
//
delStaff(row) {
@ -506,14 +527,34 @@ export default {
//
addStaff() {
this.staffVisible = true
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
},
// /
queryStaff(row, isDetail) {
const archId = []
// id
const handleArchId = (list, ids, parentId = []) => {
list.map(e => {
// id[[1, 2], [3, 4]]idid
if (ids.includes(e.id)) {
archId.push([...parentId, e.id])
} else {
e.children && handleArchId(e.children, ids, [...parentId, e.id])
}
})
}
this.isDetail = isDetail
this.staffVisible = true
this.$get(`${this.api.staffDetail}?accountId=${row.accountId}`).then(res => {
const { data } = res
data.staffArchitectureId = data.staffArchitectureId.split(',')
const { staffArchitectureId, roleId } = data
if (roleId) data.roleList = roleId.split(',').map(e => Number(e))
if (staffArchitectureId) {
handleArchId(this.orgList, staffArchitectureId.split(',').map(e => Number(e)))
data.staffArchitectureId = archId
}
this.form = data
this.originAccount = data.account
this.originWorkNumber = data.workNumber
@ -521,7 +562,6 @@ export default {
},
//
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 => {})
@ -585,44 +625,44 @@ export default {
// /
submitStaff() {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.submiting) return false
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
const form = this.form
const ids = form.staffArchitectureId
form.staffArchitectureId = ids.map(e => e[e.length - 1])
console.log("🚀 ~ file: staff.vue ~ line 622 ~ this.$refs.form.validate ~ form", form)
if (form.accountId) {
this.$post(this.api.modifyStaff, form).then(res => {
util.successMsg("编辑成功!")
this.staffVisible = false
setTimeout(() => {
this.submiting = false
}, 2000)
}).catch(res => {
setTimeout(() => {
this.submiting = false
}, 2000)
})
} else {
form.uniqueIdentification = new Date().getTime()
this.$post(this.api.saveStaff, form).then(res => {
util.successMsg("新增成功!")
this.staffVisible = false
setTimeout(() => {
this.submiting = false
}, 2000)
}).catch(res => {
setTimeout(() => {
this.submiting = false
}, 2000)
})
}
if (valid) {
debugger
if (this.submiting) return false
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
const form = JSON.parse(JSON.stringify(this.form))
const ids = form.staffArchitectureId
form.staffArchitectureId = ids.map(e => e[e.length - 1])
if (form.accountId) {
this.$post(this.api.modifyStaff, form).then(res => {
util.successMsg("编辑成功!")
this.staffVisible = false
setTimeout(() => {
this.submiting = false
}, 2000)
}).catch(res => {
setTimeout(() => {
this.submiting = false
}, 2000)
})
} else {
form.uniqueIdentification = new Date().getTime()
this.$post(this.api.saveStaff, form).then(res => {
util.successMsg("新增成功!")
this.staffVisible = false
setTimeout(() => {
this.submiting = false
}, 2000)
}).catch(res => {
setTimeout(() => {
this.submiting = false
}, 2000)
})
}
}
})
},
//
@ -651,7 +691,7 @@ export default {
},
//
downLoad() {
location.href = this.api.studentTemplate
location.href = this.api.staffTemplate
},
//
handleExceed(files, fileList) {
@ -710,4 +750,19 @@ export default {
.w-100 {
width: 100%;
}
.wrap {
display: flex;
height: calc(100vh - 223px);
padding: 0 24px;
.side {
width: 300px;
padding: 24px 10px 24px 0;
margin-right: 24px;
border-right: 1px solid rgba(0, 0, 0, 0.06);
}
.right {
width: calc(100% - 374px);
padding: 24px 0;
}
}
</style>
Loading…
Cancel
Save