123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <template>
- <div class="all-box">
- <!-- 头部提示 -->
- <!-- <div class="diy-tip" style="margin-bottom: 10px;">
- <div>
- 当前组织架构成员通过钉钉通讯录同步,员工开启积分管理后才能正式启用并进入“功道云积分制”,如果您的钉钉通讯录有变动,点击
- <span class="blue" style="margin-left: 10px;cursor: pointer;" @click="tb()" v-loading="tbLoading">
- <i class="el-icon-refresh"></i>
- 立即同步
- </span>
- </div>
- </div> -->
-
- <el-alert class="diy-tip" title="温馨提示:" @close="tips_close" v-show="tips_show" type="success" description show-icon>
- 当前组织架构成员通过微信通讯录同步,员工开启积分管理后才能正式启用并进入“功道云积分制”,如果您的微信通讯录有变动,点击立即同步
- <!-- <p>第一步:添加部门</p>
- <p>第二步:新增员工(员工可以批量导入,每次最多可以导入500个员工)</p>
- <p>备注:(导入员工的数量不能大于购买的员工数量)</p> -->
- </el-alert>
- <div class="all">
- <div class="flex-box">
- <div class="terr-left">
- <div class="rule_class_box" v-loading="ruleDeprt">
- <div class="company_name">
- <img src="static/images/two.png" />
- <span>组织架构</span>
- </div>
- <el-tree
- :data="bmList"
- class="cate-tree"
- :highlight-current="true"
- :props="{ children: '_child', label: 'name' }"
- @node-click="handleNodeClick"
- :accordion="true"
- empty-text="您暂无部门数据,请同步钉钉通讯录"
- >
- <div
- content="tree"
- v-show="treedata.length != 0"
- class="flex-box flex-v-ce"
- slot-scope="{ node, data }"
- style="font-size: 14px;color: #606266; width:100%; text-align: left;"
- >
- <img src="static/images/one.png" style="width: 20px;margin-right: 5px;" />
- <span class="name">{{ data.name }}</span>
- </div>
- </el-tree>
- </div>
- </div>
- <div class="terr-right border-right flex-1">
- <div class="margin-bottom">
- <el-button @click="participation()" :loading="enable_loading" size="medium" type="primary" style="margin-right: 10px;">批量启用积分管理</el-button>
- <el-input placeholder="输入同事姓名" size="medium" style="width: 230px;" v-model="keywords" clearable @input="searchUser()">
- <!-- <el-button slot="append" icon="el-icon-search" @click="getEmployee()"></el-button> -->
- </el-input>
- </div>
- <el-table :data="userList" @selection-change="handleSelectionChange" v-loading="tableToading">
- <el-table-column type="selection" width="50"></el-table-column>
- <el-table-column label="姓名">
- <template slot-scope="scope">
- <div class="flex-box flex-v-ce">
- <userImage :user_name="scope.row.name" :img_url="scope.row.img_url" width="44px" height="44px"></userImage>
- <div style="margin-left: 10px;">{{ scope.row.name }}</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="部门">
- <template slot-scope="scope">
- <div class="flex-box flex-v-ce bms">
- <div v-for="(item, index) in scope.row.employee_detail.dept_list" :key="index">{{ item.dept_name }}</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="accedence_time" label="入职时间"></el-table-column>
- <el-table-column prop="accedence_time" label="是否参与排名" align="center">
- <template slot-scope="scope">
- <span class="participateRank" :style="scope.row.is_ranking==1?'color:#409eff':'color:rgb(255 83 70)'" @click="rankingtakePartIn(scope.row.id,scope.row.is_ranking)">{{ scope.row.is_ranking==1?'参与':'不参与' }}</span>
- <!-- <span>不参与</span> -->
- </template>
- </el-table-column>
- <el-table-column label="启用积分管理">
- <template slot="header" slot-scope="scope">
- <el-popover
- placement="top-start"
- width="300"
- trigger="manual"
- v-model="visible">
- <div class="el-popover2">
- <div class="title">提示 <i class="el-icon-info" style="margin-left: 5px;"></i></div>
- <div style="margin-bottom: 10px;">在这里启用积分管理,即可进入系统</div>
- <div class="flex-box">
- <div class="flex-1"></div>
- <el-button size="small" @click="visible_close()">我知道了</el-button>
- </div>
- </div>
- <div slot="reference" class="popover" @click="visible=!visible">启用积分管理</div>
- </el-popover>
- </template>
- <template slot-scope="scope">
- <div :class="[scope.row.is_official==1? 'switch-box':'']" @click="changeIs(scope.row.is_official, scope.row.id)">
- <div class="switch"></div>
- </div>
- <!-- <el-switch @change="changeIs($event, scope.row.id)" v-model="scope.row.is_official" :active-value="is" :inactive-value="no"></el-switch> -->
- </template>
- </el-table-column>
- <template slot="empty">
- <noData></noData>
- </template>
- </el-table>
- <div class="pagination">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="page"
- :page-sizes="[10, 20, 50, 100]"
- :page-size="perPage"
- layout="total,sizes, prev, pager, next"
- :total="total"
- ></el-pagination>
- </div>
- </div>
- </div>
- </div>
- <el-dialog
- title="设置是否参与排名"
- :visible.sync="dialogVisible"
- :modal-append-to-body="false"
- top="30vh"
- width="520px"
- :before-close="handleClose">
- <div style="margin-left:20px;">
- <el-radio v-for="(item,index) in radioLi" :key="index" v-model="radio" :label="item.id">
- <span style="font-size:17px;">{{item.name}}</span>
- <p style="font-size:14px;margin:8px 0 0 24px;">{{item.kam}}</p>
- </el-radio>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="setRanking" :disabled="rangLoad">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import noData from '@/components/noData';
- export default {
- data() {
- return {
- is: 1,
- no: 0,
- page: 1,
- perPage: 10,
- total: 0,
- info: {}, //公司信息
- tips_show: true,
- bmList: [],
- userList: [],
- class_type: '',
- treedata: [1],
- tableData: [],
- keywords: '',
- dept_id: 0,
- tableToading: false,
- tbLoading: false,
- selectIds: [],
- enable_loading:false,
- visible:false,
-
- ruleDeprt:false,
- dialogVisible:false,
- rankingtakePartInId:'',
- radio: '1',
-
- rangLoad:false,
- radioLi:[
- {id:'1',name:'参与排名',kam:'在排名中展示此人'},
- {id:'0',name:'不参与排名',kam:'排名不展示此人(自定义排名除外)'},
- ],
- };
- },
- components: {
- noData
- },
- watch: {
- dept_id(val) {
- this.getEmployee();
- }
- },
- created() {
- this.getInfo();
- // this.getDepartment();
- this.getEmployee();
- },
- mounted() {
- this.$nextTick(function() {
- if (localStorage.getItem('rule')) {
- this.tips_show = false;
- } else {
- this.tips_show = true;
- }
- });
- },
- methods: {
- setRanking(){
- this.rangLoad = true
- let data = {
- employee_id:this.rankingtakePartInId,
- switch:Number(this.radio)
- }
- this.$http('post','/api/employee/ranking_switch',data).then((res)=>{
- if(res.data.code == 1){
- this.$message.success({ message: res.data.msg });
- this.getEmployee()
- }
- }).finally(()=>{
- this.dialogVisible = false
- setTimeout(()=>{
- this.rangLoad = false
- },200)
- })
- },
- rankingtakePartIn(id,is_ranking){
- this.radio = is_ranking.toString()
- this.rankingtakePartInId = id
- this.dialogVisible = true
- },
- handleClose(done){
- done()
- },
- //同步信息
- tb() {
- this.$confirm('下次同步时间需在10分钟之后,是否同步?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.tbLoading = true;
- this.$http('post','/api/ding/department_sync').then(res => {
- this.$message.success({ message: '同步成功' });
- this.dept_id=0;
- this.getInfo();
- this.getEmployee();
- }).finally(()=>{
- this.tbLoading = false;
- });
- });
- },
- //搜索
- searchUser(){
- this.page = 1;
- this.getEmployee();
- },
- //是否开通
- changeIs(e, id) {
- var url = e == 1 ? '/api/employee/disable' : '/api/employee/enable';
- this.$http('post',url, { employee_id: [id] }).then(res => {
- if (res) {
- if(e==0){
- this.$message.success({ message: '开启成功,可在"角色权限设置对应管理范围"' });
- }else{
- this.$message.success({ message: res.data.msg });
- }
- this.getEmployee();
- }
- });
- },
- //批量开通权限
- participation() {
- if(this.selectIds.length==0){
- this.$message.error({ message: '请选择参与的人员!' });
- return
- }
-
- this.enable_loading=true;
- this.$http('post','/api/employee/enable', { employee_id: this.selectIds }).then(res => {
- if (res) {
- this.$message.success({ message: '开启成功,可在"角色权限设置对应管理范围"' });
- this.getEmployee();
- }
- }).finally(err=>{
- this.enable_loading=false;
- });
- },
- //获取公司信息
- getInfo(is) {
- this.ruleDeprt = true
- // api/test?employee_id=155
- this.$http('get','/api/site/info').then(res => {
- this.info = res.data.data;
- this.getDepartment(is);
- });
- },
- //选择员工
- handleSelectionChange(e) {
- var arr = [];
- for (var item in e) {
- arr.push(e[item].id);
- }
- this.selectIds = arr;
- },
- //点击部门
- handleNodeClick(e) {
- this.page = 1;
- this.dept_id = e.id;
- },
- //获取部门
- getDepartment() {
- this.ruleDeprt = true
- this.$http('get','/api/department/tree').then(res => {
- var list=[{
- id:0,
- name:this.info.name,
- _child:res.data.data.list
- }]
- this.bmList = list;
- }).finally(()=>{
- this.ruleDeprt = false
- });
- },
- //获取员工
- getEmployee() {
- this.tableToading = true;
- this.$http('get','/api/employee/index', {dept_id: this.dept_id, keywords: this.keywords, page: this.page, page_size: this.perPage }).then(res => {
- this.total = res.data.data.pageInfo.count;
- this.userList = res.data.data.list;
- var visible=localStorage.getItem('visible');
- if(!visible){
- this.visible=true;
- }
- }).finally(err=>{
- this.tableToading=false;
- });
- },
- visible_close(){
- localStorage.setItem('visible', 'true');
- this.visible = false;
- },
- //关闭提示
- tips_close() {
- localStorage.setItem('rule', 'true');
- this.tips_show = false;
- },
- handleSizeChange: function(val) {
- this.perPage = val;
- this.page = 1;
- this.getEmployee();
- },
- //页码变更
- handleCurrentChange: function(val) {
- this.page = val;
- this.getEmployee();
- }
- }
- };
- </script>
- <style lang="scss" scoped="scoped">
- .title{
- font-size: 16px;
- color: #909399;
- margin-bottom: 10px;
- }
- .popover{
- border: none;
- // color: #909399;
- font-weight: 600;
- cursor: pointer;
- }
- .popover:hover{
- background-color: #fff;
- border-color: #fff;
- }
- .switch{
- margin: 0;
- display: inline-block;
- position: relative;
- width: 40px;
- height: 20px;
- border: 1px solid #dcdfe6;
- outline: none;
- border-radius: 10px;
- box-sizing: border-box;
- background: #dcdfe6;
- cursor: pointer;
- transition: border-color .3s,background-color .3s;
- vertical-align: middle;
- }
- .switch:after {
- content: "";
- position: absolute;
- top: 1px;
- left: 1px;
- border-radius: 100%;
- transition: all .3s;
- width: 16px;
- height: 16px;
- background-color: #fff;
- }
- .switch-box .switch {
- border-color: #409eff;
- background-color: #409eff;
- }
- .switch-box .switch:after {
- left: 100%;
- margin-left: -17px;
- }
- .name {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- width: 80%;
- }
- .bms div {
- margin-right: 10px;
- }
- .top-msg div:nth-child(1) {
- margin-bottom: 10px;
- }
- .company_name {
- position: relative;
- display: block;
- font-family: 'Microsoft YaHei';
- text-align: left;
- padding: 15px 25px;
- cursor: pointer;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- border-bottom: 1px #f8f8f8 solid;
- }
- .company_name img {
- position: relative;
- display: inline-block;
- top: 2px;
- width: 18px;
- height: 18px;
- margin-right: 4px;
- }
- .terr-right {
- .custom-tree-node {
- margin-left: -4px;
- }
- .custom-tree-node * {
- vertical-align: middle;
- }
- .custom-tree-node:hover {
- .treeIcon {
- display: inline-block;
- width: 55%;
- }
- }
- }
- .el-popover2{
- // background-color: #409eff !important;
- color: #409eff;
- }
- .rule_class_box {
- /deep/ .el-tree-node {
- border-bottom: 1px #f8f8f8 solid;
- }
- /deep/ .el-tree-node__content {
- padding: 10px 0;
- // border-bottom: 1px #f8f8f8 solid;
- }
- /deep/ .el-tree-node__content:hover {
- background: #ecf5ff;
- border-radius: 4px;
- }
- /deep/ .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .name{
- color: #409eff !important;
- font-weight: normal;
- transition: 0.35s ease-in-out;
- }
- // ::v-deep .is-current .el-tree-node__content .el-icon-caret-right {
- // color: #409eff !important;
- // }
- // ::v-deep .is-current .el-tree-node__content .el-tree-node__label {
- // color: #409eff !important;
- // }
- // ::v-deep .is-current .el-tree-node__children .el-icon-caret-right {
- // color: #c0c4cc !important;
- // }
- // ::v-deep .is-current .el-tree-node__children .el-tree-node__label {
- // color: #606266 !important;
- // }
- // ::v-deep .is-current .name {
- // color: #409eff !important;
- // font-weight: normal;
- // transition: 0.35s ease-in-out;
- // }
- }
- .participateRank{
- cursor:pointer;
- }
- .all{
- background-color: #fff;
- border-radius: 5px;
- min-height:calc(100vh - 184px);
- min-width: 800px;
- position: relative;
- }
- </style>
|