1
lzhe
2024-04-11 16edb612abbfeafe6e4d2f3f8089b689e3c14456
1
已添加1个文件
已修改5个文件
345 ■■■■ 文件已修改
src/layout/components/importTable.vue 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/master/person/main/department.vue 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/master/person/main/personDepartment.vue 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/master/person/main/personPerson.vue 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/master/person/main/personPost.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/master/person/main/save.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/importTable.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,55 @@
<template>
    <div>
        <el-steps direction="vertical" :active="1">
            <el-step title="准备数据">
                <span class="desc">导入的数据个数需小于200,所有允许导入的字段请参考模板;
                    <span class="bolder">字段不符合规则,整条数据不予以导入</span>
                </span>
                <button type="button" class="el-button more-btn el-button--text el-button--mini"><span>更多字段导入规则 <i class="el-icon-arrow-down no-open"></i></span></button>
                <div class="desc">
                    <ul class="tip" style="">
                        <li>1、员工工号:必填;工号不可重复;支持大小写字母、数字组合;</li>
                        <li>2、员工姓名:必填;如果重名,建议加数字区分,如“张三1”;</li>
                        <li>3、状态:必填;选择在职/离职;</li>
                        <li>4、电话:必填;在本企业内不可重复;</li>
                        <li>5、PIN码:必填;支持4-6位数字;</li>
                        <li>6、岗位:非必填;可以填入多个岗位,以英文逗号‘,’间隔;不可重名;</li>
                        <li>7、邮箱:非必填;邮箱格式校验,比如“***@126.com”;</li>
                        <li>8、部门:非必填;请填写部门完整层级;中间间隔,请用英文符号”-“间隔。如”xx公司-xx部门-xx“</li>
                        <li>9、入职日期:非必填;日期格式“YY-MM-DD”</li>
                    </ul>
                    <a class="download el-link el-link--primary is-underline"><i class="el-icon-download"></i><span class="el-link--inner">下载模板</span></a>
                </div>
            </el-step>
            <el-step title="上传数据文件"></el-step>
          </el-steps>
    </div>
</template>
<script>
    export default {
        data() {
            return {
            }
        },
        mounted() {
        },
        methods: {
        }
    }
</script>
<style scoped>
.desc {
    color: #333;
}
.desc .bolder {
    font-weight: bolder;
}
.tip {
    font-size: 12px;
    padding-left: 16px
}
</style>
src/views/master/person/main/department.vue
@@ -1,27 +1,27 @@
<template>
    <el-dialog :title="titleMap[mode]" v-model="visible" :width="800" destroy-on-close @closed="$emit('closed')">
        <el-form :model="form" :rules="rules" :disabled="mode=='show'" ref="dialogForm" label-width="120px" label-position="center">
        <el-form :model="depatmentForm" :rules="depatmentRules" :disabled="mode=='show'" ref="dialogForm" label-width="120px" label-position="center">
            <el-row>
                <el-col :span="12">
                    <el-form-item label="部门名称" prop="userName">
                        <el-input v-model="form.userName" placeholder="部门名称" clearable></el-input>
                    <el-form-item label="部门名称" prop="name">
                        <el-input v-model="depatmentForm.name" placeholder="部门名称" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="上级部门" prop="name">
                        <el-input v-model="form.name" placeholder="上级部门" clearable></el-input>
                    <el-form-item label="上级部门" prop="parentId">
                        <el-tree-select @change= "parentIdChange" v-model="depatmentForm.parentId" clearable placeholder="上级部门" default-expand-all check-on-click-nod :data="departmentList" check-strictly :props="{ label: 'name' }" node-key="id" ref="parentTree" style="width: 240px" />
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="使用状态" prop="name">
                        <el-switch v-model="value1" />
                        <el-switch v-model="depatmentForm.status" />
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <template #footer>
            <el-button @click="visible=false" >取 æ¶ˆ</el-button>
            <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="submit()">保 å­˜</el-button>
            <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="departmentSubmit()">保 å­˜</el-button>
        </template>
    </el-dialog>
</template>
@@ -31,6 +31,7 @@
        emits: ['success', 'closed'],
        data() {
            return {
                departmentList: [],
                value1: true,
                mode: "add",
                titleMap: {
@@ -41,50 +42,17 @@
                visible: false,
                isSaveing: false,
                //表单数据
                form: {
                    id:"",
                    userName: "",
                    avatar: "",
                depatmentForm: {
                    name: "",
                    dept: "",
                    group: []
                    parentId: "",
                    groupCategory: 1,
                    groupType: "group_organization",
                    status: true
                },
                //验证规则
                rules: {
                    avatar:[
                        {required: true, message: '请上传头像'}
                    ],
                    userName: [
                        {required: true, message: '请输入登录账号'}
                    ],
                    name: [
                        {required: true, message: '请输入真实姓名'}
                    ],
                    password: [
                        {required: true, message: '请输入登录密码'},
                        {validator: (rule, value, callback) => {
                            if (this.form.password2 !== '') {
                                this.$refs.dialogForm.validateField('password2');
                            }
                            callback();
                        }}
                    ],
                    password2: [
                        {required: true, message: '请再次输入密码'},
                        {validator: (rule, value, callback) => {
                            if (value !== this.form.password) {
                                callback(new Error('两次输入密码不一致!'));
                            }else{
                                callback();
                            }
                        }}
                    ],
                    dept: [
                        {required: true, message: '请选择所属部门'}
                    ],
                    group: [
                        {required: true, message: '请选择所属角色', trigger: 'change'}
                    ]
                depatmentRules: {
                    name: [{required: true, message: '请输入部门名称'}],
                    parentId: [{required: true, message: '请选择上级部门'}]
                },
                //所需数据选项
                groups: [],
@@ -101,10 +69,20 @@
            }
        },
        mounted() {
            // this.getGroup()
            // this.getDept()
            this.getOrganizationList();
        },
        methods: {
            getOrganizationList() {
                this.$HTTP.get(`/api/blade-cps/organization/tree?groupType=group_organization&groupCategory=1`).then(res=> {
                    if(res.code == 200) {
                        this.departmentList = res.data;
                    }
                })
            },
            parentIdChange(val) {
                // var $parentId = this.$refs.parentTree.getCurrentNode().title;
                // this.depatmentForm.$parentId = $parentId;
            },
            //显示
            open(mode='add'){
                this.mode = mode;
@@ -121,19 +99,20 @@
                this.depts = res.data;
            },
            //表单提交方法
            submit(){
            departmentSubmit(){
                var obj = Object.assign({},this.depatmentForm);
                obj.status = obj.status ? 1 : 0;
                this.$refs.dialogForm.validate(async (valid) => {
                    if (valid) {
                        this.isSaveing = true;
                        var res = await this.$API.demo.post.post(this.form);
                        this.isSaveing = false;
                        if(res.code == 200){
                            this.$emit('success', this.form, this.mode)
                            this.visible = false;
                            this.$message.success("操作成功")
                        }else{
                            this.$alert(res.message, "提示", {type: 'error'})
                        }
                        this.$HTTP.post("/api/blade-cps/group",obj).then(res=> {
                            if(res.code == 200) {
                                this.$emit('success', this.depatmentForm, this.mode);
                                this.visible = false;
                                this.$message.success("操作成功");
                            }else {
                                this.$alert(res.message, "提示", {type: 'error'});
                            }
                        })
                    }else{
                        return false;
                    }
@@ -141,15 +120,9 @@
            },
            //表单注入数据
            setData(data){
                this.form.id = data.id
                this.form.userName = data.userName
                this.form.avatar = data.avatar
                this.form.name = data.name
                this.form.group = data.group
                this.form.dept = data.dept
                data.status = data.status=="1"? true:false;
                //可以和上面一样单个注入,也可以像下面一样直接合并进去
                //Object.assign(this.form, data)
                Object.assign(this.depatmentForm, data)
            }
        }
    }
src/views/master/person/main/personDepartment.vue
@@ -16,17 +16,19 @@
                </div>
                <div>
                    <el-select v-model="searchData.status" placeholder="状态" class="searchStatus">
                        <el-option v-for="item in statusList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" size="small"/>
                        <el-option key="1" label="启用" value="1" size="small"/>
                        <el-option key="0" label="停用" value="0" size="small"/>
                    </el-select>
                    <el-input v-model="searchData.name" style="width: 200px" size="small" placeholder="请输入关键字进行过滤">
                    <el-input v-model="searchData.keywords" style="width: 200px" size="small" placeholder="请输入关键字进行过滤">
                        <template #append>
                            <el-button :icon="searchIcon" @click="getOrganizationList" />
                            <el-button @click="getOrganizationList">
                                <i class="el-icon"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704z"></path></svg></i>
                            </el-button>
                        </template>
                    </el-input>
                </div>
            </div>
            <div class="right-table">
                <!-- lazy :load="tableLoad" -->
                <el-table :data="departmentList" style="width: 100%;margin-bottom: 20px;"  row-key="id" border default-expand-all ref="treeRef" @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="55" />
                    <el-table-column prop="name" label="岗位名称"></el-table-column>
@@ -50,8 +52,20 @@
            </div>
        </div>
    </div>
    <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save=false"></save-dialog>
    <!-- åˆ é™¤ -->
    <el-dialog title="" v-model="delPersonModel" :width="300" destroy-on-close>
        <div>
            <div style="margin-bottom: 6px;"><span class="delIcon">!</span>请你谨慎选择!</div>
            <div style="text-indent: 24px;">删除数据会影响已关联的业务 ,若您想在已关联的业务中依然显示这些数据, æ‚¨å¯ä»¥é€‰æ‹© åœç”¨ æ“ä½œã€‚停用后此数据将不能再被新业务使用。</div>
        </div>
        <template #footer>
            <div class="footerDiv">
                <div class="delBtn" @click="delData(0)">删除</div>
                <div class="delBtn" @click="delData(1)">停用</div>
            </div>
        </template>
    </el-dialog>
    <save-dialog v-if="dialog.save" ref="saveDialog" @success="addHandleSuccess" @closed="dialog.save=false"></save-dialog>
</template>
<script>
    import saveDialog from './department'
@@ -59,6 +73,7 @@
        name: "bakalaka",
        data(){
            return {
                selectId: "",
                selection: [],
                total: 0,
                searchData: {
@@ -72,7 +87,8 @@
                dialog: {
                    save: false
                },
                departmentList: []
                departmentList: [],
                delPersonModel: false
            }
        },
        created(){
@@ -86,6 +102,19 @@
            saveDialog
        },
        methods: {
            addHandleSuccess() {
                this.getOrganizationList();
            },
            delData(type) {
                this.$HTTP.delete(`/api/blade-cps/organization?ids=${this.selectId}&type=${type}`).then(res=> {
                    if(res.code == 200) {
                        this.$message.success("操作成功");
                        this.delPersonModel = false;
                        this.selectId = "";
                        this.getOrganizationList();
                    }
                })
            },
            removeHasChildren(arr) {  
                return arr.map(item => {  
                    // åˆ›å»ºä¸€ä¸ªä¸åŒ…含hasChildren的新对象  
@@ -129,7 +158,21 @@
            handleSelectionChange (selection) {
                this.selection = selection;
            },
            delPerson() {},
            delPerson() {
                if(this.selection.length == 0) {
                    this.$message({
                      message: '请选择至少一条数据',
                      type: 'warning'
                    });
                    return;
                }
                var selStr = "";
                this.selection.map(item=> {
                    selStr += item.id + ","
                })
                this.selectId = selStr.replace(/,$/, '');
                this.delPersonModel = true;
            },
            handleSizeChange(val) {
                console.log(`每页 ${val} æ¡`);
            },
@@ -236,4 +279,39 @@
    .multipleTableRef {
        margin-bottom: 8px;
    }
    .footerDiv {
        text-align: center;
    }
    .delBtn {
        color: #fff;
        width: 112px;
        height: 32px;
        display: inline-block;
        color: #fa554c;
        background-color: #fff;
        border: 1px solid #fdbbb7;
        text-align: center;
        line-height: 32px;
        cursor: pointer;
    }
    .delBtn:nth-child(1) {
        margin-right:4px;
    }
    .delBtn:hover {
        background-color: #f34d5b;
        border-color: #f34d5b;
        color: #fff;
    }
    .delIcon {
        color: #fff;
        background: red;
        border-radius: 50%;
        display: inline-block;
        width: 20px;
        height: 20px;
        font-size: 14px;
        text-align: center;
        line-height: 20px;
        margin-right: 6px;
    }
</style>
src/views/master/person/main/personPerson.vue
@@ -18,7 +18,6 @@
            </div>
            <div class="person-tree">
                <!-- éƒ¨é—¨ -->
                <!-- <div v-for="(item,index) in titleList" :data-id="item.id" v-if="leftActive" :class="{treeActive: item.active}" @click="selectbtn(index)">{{item.name}}({{item.peopleNum}})</div> -->
                <el-tree style="max-width: 600px" :data="titleList" :expand-on-click-node="false" default-expand-all :props="{label: 'name', children: 'children'}" class="treeActive" @node-click="titleListNode" />
                <!-- å²—位 -->
                <div v-for="(item,index) in titleList" :data-id="item.id" v-if="!leftActive" :class="{treeActive: item.active}" @click="selectbtn(index)">{{item.postName}}</div>
@@ -98,10 +97,8 @@
        <el-form :model="departmentFrom" :rules="departmentVisibleRules" :disabled="mode=='show'" ref="dialogForm" label-width="80px" label-position="center">
            <el-row>
                <el-col :span="24">
                    <el-form-item label="部门" prop="department">
                        <el-select v-model="departmentFrom.department" style="width: 100%">
                            <el-option v-for="item in groups" :key="item.id" :label="item.label" :value="item.id"/>
                        </el-select>
                    <el-form-item label="部门" prop="parentId">
                        <el-tree-select @change= "parentIdChange" v-model="departmentFrom.parentId" clearable placeholder="部门" default-expand-all check-on-click-nod :data="titleList" check-strictly :props="{ label: 'name' }" node-key="id" ref="parentTree" />
                    </el-form-item>
                </el-col>
            </el-row>
@@ -140,7 +137,7 @@
                    current: 1,
                    size: 15,
                    status: "1",
                    total: "0",
                    total: "1",
                    keywords: "",
                    postId: "",  //postId
                    organizationCode: ""  //组织code
@@ -152,9 +149,7 @@
                    department: ""
                },
                departmentVisibleRules: {
                    department:[
                        {required: true, message: '请选择部门'}
                    ]
                    parentId:[{required: true, message: '请选择部门'}]
                },
                departmentVisible: false,
                dialog: {
@@ -165,7 +160,10 @@
                statusList: [],
                input3: '',
                tableData: [],
                selection: []
                selection: [],
                departmentFrom: {
                    parentId: ""
                }
            }
        },
        created(){
@@ -179,6 +177,10 @@
            saveDialog
        },
        methods: {
            parentIdChange(val) {
                // var $parentId = this.$refs.parentTree.getCurrentNode().title;
                // this.depatmentForm.$parentId = $parentId;
            },
            titleListNode(data) {
                this.searchData.organizationCode = data.code;
                this.searchPerson();
@@ -260,7 +262,26 @@
                })
            },
            departmentSubmit() {
                this.departmentVisible=false;  //部门调整
                var employeeIds = [];
                this.selection.forEach(item=> {
                    employeeIds.push(item.id);
                })
                this.$refs.dialogForm.validate(async (valid) => {
                    if (valid) {
                        this.$HTTP.put(`/api/blade-cps/employee/change-organization?organizationId=${this.departmentFrom.parentId}&employeeIds=${employeeIds.join(",")}`).then(res=> {
                            if(res.code == 200) {
                                this.searchPerson();
                                this.departmentVisible=false;  //部门调整
                                this.departmentFrom.parentId = "";
                                this.$message.success("操作成功");
                            }else {
                                this.$alert(res.message, "提示", {type: 'error'});
                            }
                        })
                    }else{
                        return false;
                    }
                })
            },
            //添加
            addPerson(){
@@ -299,6 +320,18 @@
                this.delPersonModel = true;
            },
            changeDepartment() {
                if(this.selection.length == 0) {
                    this.$message({
                      message: '请选择至少一条数据',
                      type: 'warning'
                    });
                    return;
                }
                var selStr = "";
                this.selection.map(item=> {
                    selStr += item.id + ","
                })
                this.selectId = selStr.replace(/,$/, '');
                this.departmentVisible = true;
            },
            changeTab(name) {
src/views/master/person/main/personPost.vue
@@ -16,11 +16,14 @@
                </div>
                <div>
                    <el-select v-model="postSearchData.status" placeholder="状态" class="searchStatus">
                        <el-option v-for="item in statusList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" size="small"/>
                        <el-option key="1" label="启用" value="1" size="small"/>
                        <el-option key="0" label="停用" value="0" size="small"/>
                    </el-select>
                    <el-input v-model="postSearchData.keywords" style="width: 200px" size="small" placeholder="请输入关键字进行过滤">
                        <template #append>
                            <el-button :icon="searchIcon" @click="searchPerson" />
                            <el-button @click="getPost">
                                <i class="el-icon"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704z"></path></svg></i>
                            </el-button>
                        </template>
                    </el-input>
                </div>
@@ -71,7 +74,6 @@
        data(){
            return {
                totle: "0",
                statusList: [],
                postSearchData: {
                    current: 1,
                    size: 15,
@@ -92,7 +94,6 @@
            
        },
        mounted(){
            this.getStatus();
            this.getPost();
        },
        components: {
@@ -111,13 +112,6 @@
            },
            postHandleSuccess() {
                this.getPost();
            },
            getStatus() {  //获取全部账号
                this.$HTTP.get(`/api/blade-system/dict/dictionary?code=employee_status`).then(res=> {
                    if(res.code == 200) {
                        this.statusList = res.data;
                    }
                })
            },
            getPost() {  //岗位
                this.$HTTP.get(`/api/blade-system/post/page?`+this.$TOOL.qsStringify(this.postSearchData)).then(res=> {
src/views/master/person/main/save.vue
@@ -219,10 +219,18 @@
            setData(data){
                this.$HTTP.get(`/api/blade-cps/employee/detail/${data.id}`).then(res=> {
                    if(res.code == 200) {
                        res.data.postId = res.data.postId.split(",");
                        res.data.deptId = res.data.deptId.split(",");
                        if(res.data.postId) {
                            res.data.postId = res.data.postId.split(",");
                        }else {
                            res.data.postId = [];
                        }
                        if(res.data.deptId) {
                            res.data.deptId = res.data.deptId.split(",");
                        }else {
                            res.data.deptId = [];
                        }
                        //可以和上面一样单个注入,也可以像下面一样直接合并进去
                        Object.assign(this.addPersonForm, res.data)
                        Object.assign(this.addPersonForm, res.data);
                    }
                })
            }