kuaifan 5 vuotta sitten
vanhempi
commit
3740684d30

+ 2 - 2
app/Http/Controllers/Api/SystemController.php

@@ -40,8 +40,8 @@ class SystemController extends Controller
             } else {
                 $user = $user['data'];
             }
-            if ($user['id'] != 1) {
-                return Base::retError('权限不足!');
+            if (Base::isError(Users::identity('admin'))) {
+                return Base::retError('权限不足!', [], -1);
             }
             $all = Request::input();
             foreach ($all AS $key => $value) {

+ 80 - 11
app/Http/Controllers/Api/UsersController.php

@@ -59,6 +59,17 @@ class UsersController extends Controller
             if ($user['userpass'] != Base::md52($userpass, $user['encrypt'])) {
                 return Base::retError('账号或密码错误!');
             }
+            if (in_array($user['id'], [1, 2])) {
+                $user['setting'] = Base::string2array($user['setting']);
+                if (intval($user['setting']['version']) < 1) {
+                    $user['setting']['version'] = intval($user['setting']['version']) + 1;
+                    $user['identity'] = ',admin,';
+                    DB::table('users')->where('username', $username)->update([
+                        'setting' => Base::array2string($user['setting']),
+                        'identity' => $user['identity'],
+                    ]);
+                }
+            }
         }
         //
         $array = [
@@ -310,12 +321,13 @@ class UsersController extends Controller
             }
         }
         //
-        $lists = DB::table('users')->select(['id', 'username', 'nickname', 'userimg', 'profession', 'regdate'])->orderByRaw($orderBy)->paginate(Min(Max(Base::nullShow(Request::input('pagesize'), 10), 1), 100));
+        $lists = DB::table('users')->select(['id', 'identity', 'username', 'nickname', 'userimg', 'profession', 'regdate'])->orderByRaw($orderBy)->paginate(Min(Max(Base::nullShow(Request::input('pagesize'), 10), 1), 100));
         $lists = Base::getPageList($lists);
         if ($lists['total'] == 0) {
             return Base::retError('未找到任何相关的团队成员');
         }
         foreach ($lists['lists'] AS $key => $item) {
+            $lists['lists'][$key]['identity'] = is_array($item['identity']) ? $item['identity'] : explode(",", trim($item['identity'], ","));
             $lists['lists'][$key]['userimg'] = Users::userimg($item['userimg']);
             $lists['lists'][$key]['firstchart'] = Base::getFirstCharter($item['username']);
         }
@@ -367,16 +379,20 @@ class UsersController extends Controller
             }
         }
         //开始注册
-        $user = Users::reg(trim(Request::input('username')), trim(Request::input('userpass')), [
-            'userimg' => $userimg ?: '',
-            'nickname' => $nickname ?: '',
-            'profession' => $profession ?: '',
-        ]);
-        if (Base::isError($user)) {
-            return $user;
-        } else {
-            return Base::retSuccess('添加成功!');
+        $username = trim(Request::input('username'));
+        foreach (explode(",", $username) AS $item) {
+            if ($item) {
+                $user = Users::reg(trim($item), trim(Request::input('userpass')), [
+                    'userimg' => $userimg ?: '',
+                    'nickname' => $nickname ?: '',
+                    'profession' => $profession ?: '',
+                ]);
+                if (Base::isError($user)) {
+                    return $user;
+                }
+            }
         }
+        return Base::retSuccess('添加成功!');
     }
 
     /**
@@ -396,7 +412,7 @@ class UsersController extends Controller
         if (Base::isError(Users::identity('admin'))) {
             return Base::retError('权限不足!', [], -1);
         }
-        $username = intval(Request::input('username'));
+        $username = trim(Request::input('username'));
         if ($user['username'] == $username) {
             return Base::retError('不能删除自己!');
         }
@@ -407,4 +423,57 @@ class UsersController extends Controller
             return Base::retError('删除失败!');
         }
     }
+
+    /**
+     * 设置、删除管理员
+     *
+     * @apiParam {String} act           操作
+     * - set: 设置管理员
+     * - del: 删除管理员
+     * @apiParam {String} username      用户名
+     */
+    public function team__admin()
+    {
+        $user = Users::authE();
+        if (Base::isError($user)) {
+            return $user;
+        } else {
+            $user = $user['data'];
+        }
+        //
+        if (Base::isError(Users::identity('admin'))) {
+            return Base::retError('权限不足!', [], -1);
+        }
+        //
+        $username = trim(Request::input('username'));
+        if ($user['username'] == $username) {
+            return Base::retError('不能操作自己!');
+        }
+        $userInfo = Base::DBC2A(DB::table('users')->where('username', $username)->first());
+        if (empty($userInfo)) {
+            return Base::retError('成员不存在!');
+        }
+        $identity = is_array($userInfo['identity']) ? $userInfo['identity'] : explode(",", trim($userInfo['identity'], ","));
+        $isUp = false;
+        if (trim(Request::input('act')) == 'del') {
+            if (Users::identityRaw('admin', $identity)) {
+                $identity = array_diff($identity, ['admin']);
+                $isUp = true;
+            }
+        } else {
+            if (!Users::identityRaw('admin', $identity)) {
+                $identity[] = 'admin';
+                $isUp = true;
+            }
+        }
+        if ($isUp) {
+            DB::table('users')->where('username', $username)->update([
+                'identity' => $identity ? (',' . implode(",", $identity) . ',') : ''
+            ]);
+        }
+        return Base::retSuccess('操作成功!', [
+            'up' => $isUp ? 1 : 0,
+            'identity' => $identity
+        ]);
+    }
 }

+ 1 - 1
app/Module/Chat.php

@@ -186,7 +186,7 @@ class Chat
         if (!is_array($array)) {
             $array = [];
         }
-        //messageType来自客户端(前端->后端):refresh/unread/read/roger/user/team
+        //messageType来自客户端(前端->后端):refresh/unread/read/roger/user/info/team
         //messageType来自服务端(后端->前端):error/open/kick/user/back/unread
         if (!isset($array['messageType'])) $array['messageType'] = '';  //消息类型
         if (!isset($array['messageId'])) $array['messageId'] = '';      //消息ID(用于back给客户端)

+ 12 - 0
app/Module/Users.php

@@ -216,6 +216,18 @@ class Users
     }
 
     /**
+     * 判断用户权限(身份)
+     * @param $identity
+     * @param $userIdentity
+     * @return bool
+     */
+    public static function identityRaw($identity, $userIdentity)
+    {
+        $userIdentity = is_array($userIdentity) ? $userIdentity : explode(",", trim($userIdentity, ","));
+        return $identity && in_array($identity, $userIdentity);
+    }
+
+    /**
      * 筛选用户信息
      * @param $userinfo
      * @return mixed

+ 15 - 0
app/Services/WebSocketService.php

@@ -253,6 +253,21 @@ class WebSocketService implements WebSocketHandlerInterface
                 break;
 
             /**
+             * 发给用户(不保存记录)
+             */
+            case 'info':
+                $pushLists = [];
+                foreach ($this->getUserOfName($data['target']) AS $item) {
+                    $pushLists[] = [
+                        'fd' => $item['fd'],
+                        'msg' => $data
+                    ];
+                }
+                $pushTask = new PushTask($pushLists);
+                Task::deliver($pushTask);
+                break;
+
+            /**
              * 发给整个团队
              */
             case 'team':

+ 4 - 4
database/seeds/UsersTableSeeder.php

@@ -20,7 +20,7 @@ class UsersTableSeeder extends Seeder
             0 =>
             array (
                 'id' => 1,
-                'identity' => '',
+                'identity' => ',admin,',
                 'token' => 'MUBhZG1pbkBPSHNKODhAMTU5MTM0Mzg1NUBzdkJ6UnU=',
                 'username' => 'admin',
                 'nickname' => '大乔',
@@ -36,12 +36,12 @@ class UsersTableSeeder extends Seeder
                 'linedate' => 1591343909,
                 'regip' => '127.0.0.1',
                 'regdate' => 1589072625,
-                'setting' => NULL,
+                'setting' => '{\\"version\\":1}',
             ),
             1 =>
             array (
                 'id' => 2,
-                'identity' => '',
+                'identity' => ',admin,',
                 'token' => 'MkBzeXN0ZW1AQUExbHN2QDE1OTEzNDI2OTBAQlZ5Z005',
                 'username' => 'system',
                 'nickname' => '小乔',
@@ -57,7 +57,7 @@ class UsersTableSeeder extends Seeder
                 'linedate' => 1591343157,
                 'regip' => '127.0.0.1',
                 'regdate' => 1589072625,
-                'setting' => NULL,
+                'setting' => '{\\"version\\":1}',
             ),
         ));
 

+ 5 - 0
resources/assets/js/main/App.vue

@@ -174,6 +174,11 @@
                             case 'close':
                                 window.localStorage.setItem("__::WookTeam:config", $A.jsonStringify({}));
                                 break;
+                            case 'info':
+                                if (msgDetail.body.type == 'update') {
+                                    $A.getUserInfo(true);
+                                }
+                                break;
                             case 'user':
                                 if (msgDetail.body.type == 'taskA') {
                                     $A.triggerTaskInfoListener(msgDetail.body.act, msgDetail.body.taskDetail, false);

+ 222 - 0
resources/assets/js/main/components/TagInput.vue

@@ -0,0 +1,222 @@
+<template>
+    <div class="tags-wrap" @paste="pasteText($event)" @click="clickWrap">
+        <div class="tags-item" v-for="(text, index) in disSource">
+            <span class="tags-content" @click.stop="">{{text}}</span><span class="tags-del" @click.stop="delTag(index)">&times;</span>
+        </div>
+        <textarea ref="myTextarea" class="tags-input" :style="{ minWidth: minWidth + 'px' }" :placeholder="tis || placeholder"
+                  v-model="content" @keydown.enter="downEnter($event)" @keyup="addTag($event, content)"
+                  @blur="addTag(false, content)" @keydown.delete="delTag(false)" :disabled="disabled" :readonly="readonly"></textarea>
+        <span ref="myPlaceholder" v-if="showPlaceholder || tis !== ''" class="tags-placeholder">{{tis || placeholder}}</span>
+    </div>
+</template>
+
+<style lang="scss">
+    .tags-wrap {
+        display: inline-block;
+        width: 100%;
+        min-height: 32px;
+        padding: 2px 7px;
+        border: 1px solid #dddee1;
+        border-radius: 4px;
+        color: #495060;
+        background: #fff;
+        position: relative;
+        cursor: text;
+        vertical-align: middle;
+        line-height: normal;
+        -webkit-transition: border .2s ease-in-out, background .2s ease-in-out, -webkit-box-shadow .2s ease-in-out;
+        transition: border .2s ease-in-out, background .2s ease-in-out, -webkit-box-shadow .2s ease-in-out;
+        .tags-item, .tags-input {
+            position: relative;
+            float: left;
+            color: #495060;
+            background-color: #f1f8ff;
+            border-radius: 3px;
+            line-height: 22px;
+            margin: 2px 6px 2px 0;
+            padding: 0 20px 0 6px;
+            .tags-content {
+                line-height: 22px;
+            }
+            .tags-del {
+                width: 20px;
+                height: 22px;
+                text-align: center;
+                cursor: pointer;
+                position: absolute;
+                top: -1px;
+                right: 0;
+            }
+        }
+        .tags-input {
+            max-width: 80%;
+            padding: 0;
+            background-color: inherit;
+            border: none;
+            color: inherit;
+            height: 22px;
+            line-height: 22px;
+            -webkit-appearance: none;
+            outline: none;
+            resize: none;
+            overflow: hidden;
+        }
+        .tags-input::placeholder {
+            color: #bbbbbb;
+        }
+        .tags-placeholder {
+            position: absolute;
+            left: 0;
+            top: 0;
+            z-index: -1;
+            color: #ffffff00;
+        }
+    }
+
+    .tags-wrap::after {
+        content: "";
+        display: block;
+        height: 0;
+        clear: both;
+    }
+</style>
+<script>
+    export default {
+        name: 'TagInput',
+        props: {
+            value: {
+                default: ''
+            },
+            cut: {
+                default: ','
+            },
+            disabled: {
+                type: Boolean,
+                default: false
+            },
+            readonly: {
+                type: Boolean,
+                default: false
+            },
+            placeholder: {
+                default: ''
+            },
+            max: {
+                default: 0
+            },
+        },
+        data() {
+            let disSource = [];
+            this.value.split(",").forEach((item) => {
+                if (item) {
+                    disSource.push(item)
+                }
+            });
+            return {
+                minWidth: 80,
+
+                tis: '',
+                tisTimeout: null,
+
+                showPlaceholder: true,
+
+                content: '',
+
+                disSource: disSource,
+            }
+        },
+        mounted() {
+            this.wayMinWidth();
+        },
+        watch: {
+            placeholder() {
+                this.wayMinWidth();
+            },
+            value (val) {
+                let disSource = [];
+                if ($A.count(val) > 0) {
+                    val.split(",").forEach((item) => {
+                        if (item) {
+                            disSource.push(item)
+                        }
+                    });
+                }
+                this.disSource = disSource;
+            },
+            disSource(val) {
+                let temp = '';
+                val.forEach((item) => {
+                    if (temp != '') {
+                        temp += this.cut;
+                    }
+                    temp += item;
+                });
+                this.$emit('input', temp);
+            }
+        },
+        methods: {
+            wayMinWidth() {
+                this.showPlaceholder = true;
+                this.$nextTick(() => {
+                    if (this.$refs.myPlaceholder) {
+                        this.minWidth = Math.max(this.minWidth, this.$refs.myPlaceholder.offsetWidth);
+                    }
+                    setTimeout(() => {
+                        try {
+                            this.minWidth = Math.max(this.minWidth, this.$refs.myPlaceholder.offsetWidth);
+                            this.showPlaceholder = false;
+                        }catch (e) { }
+                        if (!$A(this.$refs.myPlaceholder).is(":visible")) {
+                            this.wayMinWidth();
+                        }
+                    }, 500);
+                });
+            },
+            pasteText(e) {
+                e.preventDefault();
+                let content = (e.clipboardData || window.clipboardData).getData('text');
+                this.addTag(false, content)
+            },
+            clickWrap() {
+                this.$refs.myTextarea.focus();
+            },
+            downEnter(e) {
+                e.preventDefault();
+            },
+            addTag(e, content) {
+                if (e.keyCode === 13 || e === false) {
+                    if (content.trim() != '' && this.disSource.indexOf(content.trim()) === -1) {
+                        this.disSource.push(content.trim());
+                    }
+                    this.content = '';
+                } else {
+                    if (this.max > 0 && this.disSource.length >= this.max) {
+                        this.content = '';
+                        this.tis = '最多只能添加' + this.max + '个';
+                        clearInterval(this.tisTimeout);
+                        this.tisTimeout = setTimeout(() => { this.tis = ''; }, 2000);
+                        return;
+                    }
+                    let temp = content.trim();
+                    let cutPos = temp.length - this.cut.length;
+                    if (temp != '' && temp.substring(cutPos) === this.cut) {
+                        temp = temp.substring(0, cutPos);
+                        if (temp.trim() != '' && this.disSource.indexOf(temp.trim()) === -1) {
+                            this.disSource.push(temp.trim());
+                        }
+                        this.content = '';
+                    }
+                }
+            },
+            delTag(index) {
+                if (index === false) {
+                    if (this.content !== '') {
+                        return;
+                    }
+                    index = this.disSource.length - 1;
+                }
+                this.disSource.splice(index, 1)
+            }
+        }
+    }
+</script>

+ 4 - 1
resources/assets/js/main/components/WHeader.vue

@@ -21,7 +21,7 @@
                        <Icon type="md-arrow-dropdown"/>
                    </div>
                     <Dropdown-menu slot="list">
-                        <Dropdown-item v-if="userInfo.id==1" name="system">{{$L('系统设置')}}</Dropdown-item>
+                        <Dropdown-item v-if="isAdmin" name="system">{{$L('系统设置')}}</Dropdown-item>
                         <Dropdown-item name="user">{{$L('个人中心')}}</Dropdown-item>
                         <Dropdown-item name="out">{{$L('退出登录')}}</Dropdown-item>
                     </Dropdown-menu>
@@ -287,6 +287,7 @@
 
                 loadIng: 0,
                 userInfo: {},
+                isAdmin: false,
 
                 systemDrawerShow: false,
 
@@ -375,8 +376,10 @@
             };
             this.userInfo = $A.getUserInfo((res) => {
                 this.userInfo = res;
+                this.isAdmin = $A.identity('admin');
                 resCall();
             }, false);
+            this.isAdmin = $A.identity('admin');
             resCall();
             //
             this.tabActive = this.$route.meta.tabActive;

+ 11 - 2
resources/assets/js/main/main.js

@@ -201,7 +201,15 @@ import '../../sass/main.scss';
          */
         identity(role) {
             let userInfo = $A.getUserInfo();
-            let identity = userInfo.identity;
+            return $A.identityRaw(role, userInfo.identity);
+        },
+
+        /**
+         * 权限是否通过
+         * @param role
+         * @returns {boolean}
+         */
+        identityRaw(role, identity) {
             let isRole = false;
             $A.each(identity, (index, res) => {
                 if (res === role) {
@@ -586,6 +594,7 @@ import '../../sass/main.scss';
              * - read: 已读会员信息
              * - roger: 收到信息回执
              * - user: 指定target
+             * - update: 指定target
              * - team: 团队会员
              * @param target            发送目标
              * @param body              发送内容(对象或数组)
@@ -629,7 +638,7 @@ import '../../sass/main.scss';
                     }
                     return this;
                 }
-                if (['refresh', 'unread', 'read', 'roger', 'user', 'team'].indexOf(messageType) === -1) {
+                if (['refresh', 'unread', 'read', 'roger', 'user', 'info', 'team'].indexOf(messageType) === -1) {
                     this.__log("[WS] Wrong message messageType: " + messageType);
                     typeof callback === "function" && callback({status: 0, message: '错误的消息类型: ' + messageType});
                     return this;

+ 7 - 3
resources/assets/js/main/pages/project.vue

@@ -270,6 +270,10 @@
     }
 </style>
 <script>
+    import Vue from 'vue'
+    import TagInput from '../components/TagInput'
+    Vue.component('TagInput', TagInput)
+
     import WContent from "../components/WContent";
     import ProjectArchived from "../components/project/archived";
     import ProjectUsers from "../components/project/users";
@@ -432,11 +436,11 @@
                                     marginBottom: '20px',
                                 }
                             }, this.$L('添加流程')),
-                            h('Input', {
+                            h('TagInput', {
                                 props: {
                                     value: this.labelsValue,
                                     autofocus: true,
-                                    placeholder: this.$L('请输入流程名称,多个可用空格分隔。')
+                                    placeholder: this.$L('请输入流程名称,多个可用英文逗号分隔。')
                                 },
                                 on: {
                                     input: (val) => {
@@ -448,7 +452,7 @@
                     },
                     onOk: () => {
                         if (this.labelsValue) {
-                            let array = $A.trim(this.labelsValue).split(" ");
+                            let array = $A.trim(this.labelsValue).split(",");
                             array.forEach((name) => {
                                 if ($A.trim(name)) {
                                     this.formAdd.labels.push($A.trim(name));

+ 126 - 39
resources/assets/js/main/pages/team.vue

@@ -46,7 +46,7 @@
                     <Input v-model="formAdd.profession"></Input>
                 </FormItem>
                 <FormItem prop="username" :label="$L('用户名')">
-                    <Input type="text" v-model="formAdd.username" :placeholder="$L('添加后不可修改')"></Input>
+                    <TagInput v-model="formAdd.username" :placeholder="$L('添加后不可修改,使用英文逗号添加多个。')"/>
                 </FormItem>
                 <FormItem prop="userpass" :label="$L('登录密码')">
                     <Input type="password" v-model="formAdd.userpass" :placeholder="$L('最少6位数')"></Input>
@@ -88,13 +88,15 @@
 <script>
     import WContent from "../components/WContent";
     import ImgUpload from "../components/ImgUpload";
+    import TagInput from "../components/TagInput";
     export default {
-        components: {ImgUpload, WContent},
+        components: {TagInput, ImgUpload, WContent},
         data () {
             return {
                 loadIng: 0,
 
                 userInfo: {},
+                isAdmin: false,
 
                 columns: [],
 
@@ -115,7 +117,7 @@
             }
         },
         created() {
-            let isAdmin = $A.identity('admin');
+            this.isAdmin = $A.identity('admin');
             this.noDataText = this.$L("数据加载中.....");
             this.columns = [{
                 "title": this.$L("头像"),
@@ -150,6 +152,14 @@
                             }
                         }, '[自己]'))
                     }
+                    if ($A.identityRaw('admin', params.row.identity)) {
+                        arr.push(h('span', {
+                            style: {
+                                color: '#ff0000',
+                                paddingRight: '4px'
+                            }
+                        }, '[管理员]'))
+                    }
                     arr.push(h('span', params.row.username))
                     return h('span', arr);
                 }
@@ -176,7 +186,7 @@
             }, {
                 "title": this.$L("操作"),
                 "key": 'action',
-                "width": isAdmin ? 160 : 80,
+                "width": this.isAdmin ? 160 : 80,
                 "align": 'center',
                 render: (h, params) => {
                     let array = [];
@@ -197,46 +207,43 @@
                             }
                         }
                     }, this.$L('查看')));
-                    if (isAdmin) {
-                        array.push(h('Button', {
+                    if (this.isAdmin) {
+                        array.push(h('Dropdown', {
                             props: {
-                                type: 'warning',
-                                size: 'small'
-                            },
-                            style: {
-                                fontSize: '12px',
-                                marginLeft: '5px'
+                                trigger: 'click',
+                                transfer: true
                             },
                             on: {
-                                click: () => {
-                                    this.$Modal.confirm({
-                                        title: this.$L('删除团队成员'),
-                                        content: this.$L('你确定要删除此团队成员吗?'),
-                                        loading: true,
-                                        onOk: () => {
-                                            $A.aAjax({
-                                                url: 'users/team/delete?username=' + params.row.username,
-                                                error: () => {
-                                                    this.$Modal.remove();
-                                                    alert(this.$L('网络繁忙,请稍后再试!'));
-                                                },
-                                                success: (res) => {
-                                                    this.$Modal.remove();
-                                                    this.getLists();
-                                                    setTimeout(() => {
-                                                        if (res.ret === 1) {
-                                                            this.$Message.success(res.msg);
-                                                        }else{
-                                                            this.$Modal.error({title: this.$L('温馨提示'), content: res.msg });
-                                                        }
-                                                    }, 350);
-                                                }
-                                            });
-                                        }
-                                    });
+                                'on-click': (name) => {
+                                    this.handleUser(name, params.row.username)
                                 }
                             }
-                        }, this.$L('删除')));
+                        }, [
+                            h('Button', {
+                                props: {
+                                    type: 'warning',
+                                    size: 'small'
+                                },
+                                style: {
+                                    fontSize: '12px',
+                                    marginLeft: '5px'
+                                },
+                            }, this.$L('操作')),
+                            h('DropdownMenu', {
+                                slot: 'list',
+                            }, [
+                                h('DropdownItem', {
+                                    props: {
+                                        name: $A.identityRaw('admin', params.row.identity) ? 'deladmin' : 'setadmin',
+                                    },
+                                }, this.$L($A.identityRaw('admin', params.row.identity) ? '取消管理员' : '设为管理员')),
+                                h('DropdownItem', {
+                                    props: {
+                                        name: 'delete',
+                                    },
+                                }, this.$L('删除'))
+                            ])
+                        ]))
                     }
                     return h('div', array);
                 }
@@ -334,6 +341,86 @@
                         });
                     }
                 });
+            },
+
+            handleUser(act, username) {
+                switch (act) {
+                    case "delete": {
+                        this.$Modal.confirm({
+                            title: this.$L('删除团队成员'),
+                            content: this.$L('你确定要删除此团队成员吗?'),
+                            loading: true,
+                            onOk: () => {
+                                $A.aAjax({
+                                    url: 'users/team/delete?username=' + username,
+                                    error: () => {
+                                        this.$Modal.remove();
+                                        alert(this.$L('网络繁忙,请稍后再试!'));
+                                    },
+                                    success: (res) => {
+                                        this.$Modal.remove();
+                                        this.getLists();
+                                        setTimeout(() => {
+                                            if (res.ret === 1) {
+                                                this.$Message.success(res.msg);
+                                            }else{
+                                                this.$Modal.error({title: this.$L('温馨提示'), content: res.msg });
+                                            }
+                                        }, 350);
+                                    }
+                                });
+                            }
+                        });
+                        break;
+                    }
+                    case "setadmin":
+                    case "deladmin": {
+                        this.$Modal.confirm({
+                            title: this.$L('确定操作'),
+                            content: this.$L(act=='deladmin' ? '你确定取消管理员身份的操作吗?' : '你确定设置管理员的操作吗?'),
+                            loading: true,
+                            onOk: () => {
+                                $A.aAjax({
+                                    url: 'users/team/admin?act=' + (act=='deladmin'?'del':'set') + '&username=' + username,
+                                    error: () => {
+                                        this.$Modal.remove();
+                                        alert(this.$L('网络繁忙,请稍后再试!'));
+                                    },
+                                    success: (res) => {
+                                        this.$Modal.remove();
+                                        if (res.ret === 1) {
+                                            this.lists.some((item) => {
+                                                if (item.username == username) {
+                                                    this.$set(item, 'identity', res.data.identity);
+                                                    return true;
+                                                }
+                                            });
+                                            if (res.data.up === 1) {
+                                                let data = {
+                                                    type: 'text',
+                                                    username: this.userInfo.username,
+                                                    userimg: this.userInfo.userimg,
+                                                    indate: Math.round(new Date().getTime() / 1000),
+                                                    text: this.$L(act=='deladmin' ? '您的管理员身份已被撤销。' : '恭喜您成为管理员。')
+                                                };
+                                                $A.WSOB.sendTo('user', username, data, 'special');
+                                                $A.WSOB.sendTo('info', username, { 'type': 'update'});
+                                            }
+                                        }
+                                        setTimeout(() => {
+                                            if (res.ret === 1) {
+                                                this.$Message.success(res.msg);
+                                            } else {
+                                                this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
+                                            }
+                                        }, 350);
+                                    }
+                                });
+                            }
+                        });
+                        break;
+                    }
+                }
             }
         },
     }

+ 10 - 2
resources/lang/en/general.js

@@ -328,12 +328,12 @@ export default {
     "发布成功": "Successfully posted",
     "请填写项目名称!": "Please fill in item name!",
     "项目名称至少2个字!": "Project Name at least two words!",
-    "请输入流程名称,多个可用空格分隔。": "Please enter the name of the process, a number of available spaces.",
+    "请输入流程名称,多个可用英文逗号分隔。": "Use [,] to add multiple.",
     "重命名项目": "Rename the project",
     "请输入新的项目名称": "Please enter a new project name",
     "团队成员": "Team member",
     "添加团队成员": "Add team members",
-    "添加后不可修改": "After the addition can not be modified",
+    "添加后不可修改,使用英文逗号添加多个。": "Do not modify after adding, use [,] to add multiple.",
     "登录密码": "Login password",
     "最少6位数": "At least 6 digits",
     "会员信息": "Member information",
@@ -390,4 +390,12 @@ export default {
     "注册账号": "Register",
     "系统提示": "System prompt",
     "您的帐号在其他地方(%)登录,您被迫退出,如果这不是您本人的操作,请注意帐号安全!": "Your account is logged in elsewhere (%), you are forced to log out, if this is not your own operation, please pay attention to account security!",
+    "[管理员]": "[Administrator]",
+    "取消管理员": "Cancel administrator",
+    "设为管理员": "Set as administrator",
+    "确定操作": "Determine the operating",
+    "你确定取消管理员身份的操作吗?": "Are you sure you want to cancel the administrator?",
+    "你确定设置管理员的操作吗?": "Are you sure to set the administrator's action?",
+    "您的管理员身份已被撤销。": "Your administrator status has been revoked.",
+    "恭喜您成为管理员。": "Congratulations on becoming an administrator.",
 }

+ 3 - 0
resources/lang/en/general.php

@@ -110,4 +110,7 @@ return [
     "注册成功!" => "Registered!",
     "注册失败,请稍后再试。" => "Registration failed. Please try again later.",
     "当前环境禁止修改密码!" => "Password changes are not allowed here!",
+    "不能操作自己!" => "Can't operate oneself!",
+    "成员不存在!" => "Member does not exist!",
+    "操作成功!" => "Operation successful!",
 ];