shuishen
2021-07-09 a5b7405539fcd89927273fa51f099fff6dd0777e
src/views/management/register.vue
@@ -2,7 +2,7 @@
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-07-06 19:10:17
 * @Last Modified time: 2021-07-08 20:31:10
 * menu-name 保安员注册查询
 */
<template>
@@ -38,7 +38,7 @@
                           @refresh-change="refreshChange"
                           @row-click="handleRowClick"
                           @on-load="onLoad">
                    <template slot-scope="{row}"
                    <!-- <template slot-scope="{row}"
                              slot="tenantName">
                        <el-tag>{{row.tenantName}}</el-tag>
                    </template>
@@ -53,6 +53,14 @@
                    <template slot-scope="{row}"
                              slot="userTypeName">
                        <el-tag>{{row.userTypeName}}</el-tag>
                    </template> -->
                    <template slot-scope="{type,size,row}"
                              slot="menu">
                        <el-button icon="icon-zhengjian"
                                   :size="size"
                                   :type="type"
                                   class="zhengJian-icon"
                                   @click.stop="handleCredentials(row)">证件吊销</el-button>
                    </template>
                </avue-crud>
                <el-dialog title="用户数据导入"
@@ -70,35 +78,7 @@
                        </template>
                    </avue-form>
                </el-dialog>
                <el-dialog title="用户平台配置"
                           append-to-body
                           :visible.sync="platformBox">
                    <avue-crud :option="platformOption"
                               :table-loading="platformLoading"
                               :data="platformData"
                               ref="platformCrud"
                               v-model="platformForm"
                               :before-open="platformBeforeOpen"
                               :page.sync="platformPage"
                               :permission="platformPermissionList"
                               @row-update="platformRowUpdate"
                               @search-change="platformSearchChange"
                               @search-reset="platformSearchReset"
                               @selection-change="platformSelectionChange"
                               @current-change="platformCurrentChange"
                               @size-change="platformSizeChange"
                               @refresh-change="platformRefreshChange"
                               @on-load="platformOnLoad">
                        <template slot-scope="{row}"
                                  slot="tenantName">
                            <el-tag>{{row.tenantName}}</el-tag>
                        </template>
                        <template slot-scope="{row}"
                                  slot="userTypeName">
                            <el-tag>{{row.userTypeName}}</el-tag>
                        </template>
                    </avue-crud>
                </el-dialog>
            </basic-container>
        </el-col>
    </el-row>
@@ -108,10 +88,9 @@
import {
    getList,
    getUser,
    getUserPlatform,
    updatePlatform,
    add,
} from "@/api/system/user";
    updateHold,
} from "@/api/management/user";
import { getDeptTree, getDeptLazyTree } from "@/api/system/dept";
import { getRoleTree } from "@/api/system/role";
import { getPostList } from "@/api/system/post";
@@ -141,22 +120,16 @@
            form: {},
            search: {},
            excelBox: false,
            platformBox: false,
            initFlag: true,
            selectionList: [],
            query: {},
            loading: true,
            platformLoading: false,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            platformPage: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            init: {
                roleTree: [],
                deptTree: [],
@@ -192,7 +165,7 @@
                // 操作栏多余按钮去除
                delBtn: false,
                editBtn: false,
                addBtn: false,
                selection: false,
                align: 'center',
@@ -201,13 +174,12 @@
                tip: false,
                searchShow: true,
                searchMenuSpan: 4,
                border: false,
                index: true,
                viewBtn: true,
                //dialogType: 'drawer',
                dialogClickModal: false,
                // 操作栏宽度
                menuWidth: 90,
                menuWidth: 156,
                column: [
                    {
@@ -216,7 +188,7 @@
                        search: true,
                        searchSpan: 5,
                        display: false,
                        width: 80
                        width: 78
                    },
                    {
                        label: "性别",
@@ -234,21 +206,21 @@
                        }],
                        slot: true,
                        display: false,
                        width: 50
                        width: 48
                    },
                    {
                        label: "身份证号",
                        prop: "cardid",
                        slot: true,
                        display: false,
                        width: 140
                        width: 138
                    },
                    {
                        label: "联系方式",
                        prop: "phone",
                        slot: true,
                        display: false,
                        width: 96
                        width: 92
                    },
                    {
                        label: "联系地址",
@@ -261,14 +233,14 @@
                        prop: "rtime",
                        slot: true,
                        display: false,
                        width: 90
                        width: 82
                    },
                    {
                        label: "所属角色",
                        prop: "roleName",
                        slot: true,
                        display: false,
                        width: 100
                        width: 78
                    },
                    {
                        label: "所属公司",
@@ -291,7 +263,27 @@
                        }],
                        slot: true,
                        display: false,
                        width: 90
                        width: 78
                    },
                    {
                        label: "是否持证",
                        prop: "hold",
                        type: "select",
                        search: true,
                        searchSpan: 4,
                        dicData: [{
                            label: '是',
                            value: '0'
                        }, {
                            label: '否',
                            value: '1',
                        }, {
                            label: '已吊销',
                            value: '2',
                        }],
                        slot: true,
                        display: false,
                        width: 78
                    },
                ],
                group: [
@@ -505,75 +497,7 @@
            data: [],
            platformQuery: {},
            platformSelectionList: [],
            platformData: [],
            platformForm: {},
            platformOption: {
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                viewBtn: true,
                dialogClickModal: false,
                menuWidth: 120,
                editBtnText: '配置',
                column: [
                    {
                        label: "登录账号",
                        prop: "account",
                        search: true,
                        display: false
                    },
                    {
                        label: "所属租户",
                        prop: "tenantName",
                        slot: true,
                        display: false
                    },
                    {
                        label: "用户姓名",
                        prop: "realName",
                        search: true,
                        display: false
                    },
                    {
                        label: "用户平台",
                        prop: "userTypeName",
                        slot: true,
                        display: false
                    },
                    {
                        label: "用户平台",
                        type: "select",
                        dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
                        props: {
                            label: "dictValue",
                            value: "dictKey"
                        },
                        dataType: "number",
                        search: true,
                        hide: true,
                        display: false,
                        prop: "userType",
                        rules: [{
                            required: true,
                            message: "请选择用户平台",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "用户拓展",
                        prop: "userExt",
                        type: "textarea",
                        minRows: 8,
                        span: 24,
                        overHidden: true,
                        row: true,
                        hide: true,
                    },
                ],
            },
            excelForm: {},
            excelOption: {
                submitBtn: false,
@@ -651,14 +575,7 @@
                editBtn: this.vaildData(this.permission.user_edit, false)
            };
        },
        platformPermissionList () {
            return {
                addBtn: false,
                viewBtn: false,
                delBtn: false,
                editBtn: this.vaildData(this.permission.user_edit, false)
            };
        },
        ids () {
            let ids = [];
            this.selectionList.forEach(ele => {
@@ -776,77 +693,69 @@
                this.selectionClear();
            });
        },
        platformRowUpdate (row, index, done, loading) {
            updatePlatform(row.id, row.userType, row.userExt).then(() => {
                this.platformOnLoad(this.platformPage);
                this.$message({
                    type: "success",
                    message: "操作成功!"
                });
                done();
            }, error => {
                window.console.log(error);
                loading();
            });
        },
        platformBeforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getUserPlatform(this.platformForm.id).then(res => {
                    this.platformForm = res.data.data;
                });
            }
            done();
        },
        platformSearchReset () {
            this.platformQuery = {};
            this.platformOnLoad(this.platformPage);
        },
        platformSearchChange (params, done) {
            this.platformQuery = params;
            this.platformPage.currentPage = 1;
            this.platformOnLoad(this.platformPage, params);
            done();
        },
        platformSelectionChange (list) {
            this.platformSelectionList = list;
        },
        platformSelectionClear () {
            this.platformSelectionList = [];
            this.$refs.platformCrud.toggleSelection();
        },
        platformCurrentChange (currentPage) {
            this.platformPage.currentPage = currentPage;
        },
        platformSizeChange (pageSize) {
            this.platformPage.pageSize = pageSize;
        },
        platformRefreshChange () {
            this.platformOnLoad(this.platformPage, this.platformQuery);
        },
        platformOnLoad (page, params = {}) {
            this.platformLoading = true;
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
                const data = res.data.data;
                this.platformPage.total = data.total;
                this.platformData = data.records;
                this.platformLoading = false;
                this.selectionClear();
            });
        },
        // 行单击
        handleRowClick (row) {
            // delete (row["name"]);
            var obj = row
            obj["name"] = "保安详细资料"
            this.$router.push({
                path: `/management/peopleDetails`,
                query: row,
                path: `/management/index`,
                query: obj,
            });
        },
        // 证件吊销事件
        handleCredentials (row) {
            if (row.hold == 1) {
                this.$message({
                  type: 'info',
                    message: '证件未拥有!'
                });
            } else if (row.hold == 2) {
                this.$message({
                   type: 'info',
                    message: '证件已吊销!'
                });
            } else {
                this.$confirm('此操作将吊销该人员的证件, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    updateHold(2, row.cardid).then(res => {
                        console.log(res)
                        this.$message({
                            type: 'success',
                            message: '删除成功!'
                        });
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            }
        }
    }
};
</script>
<style>
<style lang='scss' scoped>
.box {
    height: 800px;
}