Преглед изворни кода

Merge branch 'master' of http://132.232.92.186:3000/XinXiBu/oa-system

liuhj пре 2 година
родитељ
комит
5fb3793a7e

+ 25 - 2
src/components/child/AuthorityJob.vue

@@ -193,6 +193,11 @@ export default {
             this.valueposition = '';
             this.position = [];
             this.departmental = [];
+ 
+            if(this.valuecorporation == ''){
+                return;
+            }
+
             var that = this;
             //初始化界面数据
             this.$axios.post(this.PathUrl + '/api/System/QueryDepartmentList', {
@@ -213,8 +218,13 @@ export default {
         //部门下拉框
         depaChange(){
             var that = this;
-            this.position = [], //职位数据
-            this.valueposition = '',//职位val
+            this.position = []; //职位数据
+            this.valueposition = '';//职位val
+
+            if(this.valuecorporation == '' || this.valuedepartmental == ''){
+                return;
+            }
+
             //初始化界面数据
             this.$axios.post(this.PathUrl + '/api/System/QueryJobPost', {
                 "CompanyId": this.valuecorporation,
@@ -272,6 +282,19 @@ export default {
         JobChange(){
             let val = this.value == '' ? 13 :this.value;
             var that = this;
+
+            if(this.valueposition == ''){
+
+                var arr = this.authorityList;
+                arr.forEach(item=>{
+                    item.selList = [];
+                })
+                this.authorityList = arr;
+                this.authorityLists = this.authorityList;
+
+                return
+            }
+
             //初始化界面数据
             this.$axios.post(this.PathUrl + '/api/System/QueryJobAuth', {
                 "jobid": this.valueposition,

+ 394 - 0
src/components/child/AuthorityUser.vue

@@ -0,0 +1,394 @@
+<template>
+    <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
+        <div class="job-box">
+            <div class="job-head">
+                <div>
+                    <el-select @change="Inquirechange()" v-model="value" clearable placeholder="权限模块">
+                        <el-option v-for="item in authority" :key="item.value" :label="item.name" :value="item.id">
+                        </el-option>
+                    </el-select>
+                </div>
+                <div>
+                    <el-select @change="companyChange()" v-model="valuecorporation" clearable placeholder="公司">
+                        <el-option v-for="item in corporation" :key="item.value" :label="item.companyName" :value="item.id">
+                        </el-option>
+                    </el-select>
+                    <el-select @change="depaChange()" v-model="valuedepartmental" clearable placeholder="部门">
+                        <el-option v-for="item in departmental" :key="item.id" :label="item.depName" :value="item.id">
+                        </el-option>
+                    </el-select>
+                    <el-select @change="JobChange()" v-model="valueposition" clearable placeholder="职位">
+                        <el-option v-for="item in position" :key="item.id" :label="item.jobName" :value="item.id">
+                        </el-option>
+                    </el-select>
+                    <el-select @change="UserChange()" v-model="Valueuesr" clearable placeholder="员工">
+                        <el-option v-for="item in Users" :key="item.id" :label="item.cnName" :value="item.id">
+                        </el-option>
+                    </el-select>
+                    <el-button type="primary" @click="saveAuth()">保 存</el-button>
+                </div>
+            </div>
+            <div class="job-table">
+                <el-table :data="authorityLists.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
+                    @select="handleSelect" @select-all="allchange" style="width: 100%">
+                    <el-table-column type="selection" width="55">
+                    </el-table-column>
+                    <el-table-column prop="name" label="权限页面" width="180">
+                    </el-table-column>
+
+                    <el-table-column width="55" :label="op.functionName" :key="op.id" v-for="op in opList">
+                        <template slot-scope="scope">
+                            <div>
+                                <el-checkbox @change='checkchange(authorityLists[scope.$index].id, op.id)'
+                                    v-if="authorityLists[scope.$index].opList.indexOf(op.id) != -1"
+                                    :value="authorityLists[scope.$index].selList.indexOf(op.id) != -1">
+                                </el-checkbox>
+                                <el-checkbox v-else :disabled="true">
+                                </el-checkbox>
+                            </div>
+                        </template>
+                    </el-table-column>
+
+
+                    <el-table-column prop="address" label="备注">
+                    </el-table-column>
+                </el-table>
+                <div class="block">
+                    <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                        :current-page="currentPage" :page-sizes="[14, 20]" :page-size="pageSize"
+                        layout="total, sizes, prev, pager, next" :total="authorityList.length">
+                    </el-pagination>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+import { cw } from '@fullcalendar/core/internal-common';
+import { promised, reject, resolve } from 'q';
+
+export default {
+    data() {
+        return {
+            authority: [],
+            value: '',        //模块下拉框数据
+            corporation: [],
+            valuecorporation: '',//公司val
+
+            departmental: [], //部门数据
+            valuedepartmental: '', //部门val
+
+            position: [], //职位数据
+            valueposition: '',//职位val
+
+            authorityLists: [],
+            authorityList: [],
+            currentPage: 1, // 当前页码
+            pageSize: 14,// 每页的数据条数
+            stateArr: [],
+            selectedAccount: [],
+            PathUrl: 'http://localhost:5256',
+            opList: [],//操作方式
+            loading: true,
+            Users: [],
+            Valueuesr: '',//员工val
+        }
+    },
+    methods: {
+        //每页条数改变时触发 选择一页显示多少行
+        handleSizeChange(val) {
+            this.currentPage = 1;
+            this.pageSize = val;
+        },
+        //当前页改变时触发 跳转其他页
+        handleCurrentChange(val) {
+            this.currentPage = val;
+        },
+        //模块下拉框
+        Inquirechange() {
+            this.currentPage = 1;
+            this.pageload(this.value);
+        },
+        //多选框选中方法
+        handleSelect(selection, row) {
+            console.log(selection, row)
+            if (selection.length > 0) {
+                row.selList = this.opList.map(x => x.id);
+            } else {
+                row.selList = [];
+            }
+        },
+        selectRadiocheck(index, row) {
+            console.log(index)
+            console.log(row)
+        },
+        selectRadioerase(index, row) {
+            console.log(index, row)
+        },
+        selectRadioedit(index, row) {
+            console.log(index, row)
+        },
+        selectRadiodown(index, row) {
+            console.log(index, row)
+        },
+        selectRadioup(index, row) {
+            console.log(index, row)
+        },
+        pageload(moduleId) {
+            var that = this;
+            //初始化界面数据
+            this.$axios.post(this.PathUrl + '/api/System/GetAuth', {
+                "pageSize": this.pageSize,
+                "currentPage": this.currentPage,
+                "moduleId": moduleId,
+            }, {
+                headers: {
+                    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IkZ1dHVyZSIsImV4cCI6MTY3OTU0MjgwNSwiaXNzIjoiT0FTeXN0ZW0uY29tIiwiYXVkIjoiT0FTeXN0ZW0uY29tIn0.iy5SUInq1p3yjZultRPyzCa2ekLeepSdMLxvPwXY6MI',
+                }
+            }).then(resp => {
+                if (resp.data.code == 200) {
+                    that.authority = resp.data.data.setDataResult; //模块数据
+                    that.corporation = resp.data.data.companyDataResult; //公司数据
+                    that.authorityList = resp.data.data.systemMenuPermissionData; //页面数据(默认权限页面)
+                    that.authorityLists = that.authorityList;
+                    that.opList = resp.data.data.pageOperation; //操作方式
+                    that.loading = false;
+                }
+            }).then(suc => {
+                if (this.Valueuesr != '') {
+                    //链式调用加载
+                    this.UserChange();
+                }
+            })
+        },
+        //公司下拉框
+        companyChange() {
+
+            this.valuedepartmental = ''; //清空数据
+            this.valueposition = '';
+            this.position = [];
+            this.departmental = [];
+            this.Valueuesr = ''; //清空数据
+            this.Users = [];
+
+            if (this.valuecorporation == '') {
+                return;
+            }
+
+            var that = this;
+            //初始化界面数据
+            this.$axios.post(this.PathUrl + '/api/System/QueryDepartmentList', {
+                "CompanyId": this.valuecorporation,
+                "PortType": 1,
+            }, {
+                headers: {
+                    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IkZ1dHVyZSIsImV4cCI6MTY3OTU0MjgwNSwiaXNzIjoiT0FTeXN0ZW0uY29tIiwiYXVkIjoiT0FTeXN0ZW0uY29tIn0.iy5SUInq1p3yjZultRPyzCa2ekLeepSdMLxvPwXY6MI',
+                }
+            }).then(resp => {
+                console.log(resp);
+                if (resp.data.code == 200) {
+                    that.departmental = resp.data.data;
+                }
+            })
+
+        },
+        //部门下拉框
+        depaChange() {
+
+            this.position = []; //职位数据
+            this.valueposition = '';//职位val
+            this.Valueuesr = ''; //清空数据
+            this.Users = [];
+
+            if (this.valuecorporation == '' || this.valuedepartmental == '') {
+                return;
+            }
+
+            var that = this;
+            //初始化界面数据
+            this.$axios.post(this.PathUrl + '/api/System/QueryJobPost', {
+                "CompanyId": this.valuecorporation,
+                "DepId": this.valuedepartmental,
+                "PortType": 1,
+            }, {
+                headers: {
+                    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IkZ1dHVyZSIsImV4cCI6MTY3OTU0MjgwNSwiaXNzIjoiT0FTeXN0ZW0uY29tIiwiYXVkIjoiT0FTeXN0ZW0uY29tIn0.iy5SUInq1p3yjZultRPyzCa2ekLeepSdMLxvPwXY6MI',
+                }
+            }).then(resp => {
+                console.log(resp);
+                if (resp.data.code == 200) {
+                    that.position = resp.data.data;
+                }
+            })
+        },
+        //保存权限
+        saveAuth() {
+            var that = this;
+
+            if (this.Valueuesr == '') {
+                this.$message.error('请选择员工!');
+                return;
+            }
+
+            var savejob = [];
+            this.authorityLists.forEach(item => {
+                savejob.push({
+                    SmId: item.id,
+                    FIds: this.unique(item.selList),
+                });
+            })
+            console.log(savejob);
+            //初始化界面数据
+            this.$axios.post(this.PathUrl + '/api/System/SaveUserAuth', {
+                "uid": this.Valueuesr,
+                "Savejobs": savejob,
+            }, {
+                headers: {
+                    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IkZ1dHVyZSIsImV4cCI6MTY3OTU0MjgwNSwiaXNzIjoiT0FTeXN0ZW0uY29tIiwiYXVkIjoiT0FTeXN0ZW0uY29tIn0.iy5SUInq1p3yjZultRPyzCa2ekLeepSdMLxvPwXY6MI',
+                }
+            }).then(resp => {
+                console.log(resp);
+                if (resp.data.code == 200) {
+                    this.$message({
+                        message: '保存成功!',
+                        type: 'success'
+                    });
+                } else {
+                    this.$message.error('保存失败!' + resp.data.msg);
+                }
+            })
+        },
+        //职位下拉获取权限
+        JobChange() {
+
+            this.Valueuesr = ''; //清空数据
+            this.Users = [];
+
+            if (this.valuecorporation == '' || this.valuedepartmental == '' || this.valueposition == '') {
+                return;
+            }
+
+            var that = this;
+            //获取员工信息
+            this.$axios.post(this.PathUrl + '/api/System/QueryUserList', {
+                "CompanyId": this.valuecorporation,
+                "DepId": this.valuedepartmental,
+                "JobPostId": this.valueposition,
+                "PortType": 1
+
+            }, {
+                headers: {
+                    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IkZ1dHVyZSIsImV4cCI6MTY3OTU0MjgwNSwiaXNzIjoiT0FTeXN0ZW0uY29tIiwiYXVkIjoiT0FTeXN0ZW0uY29tIn0.iy5SUInq1p3yjZultRPyzCa2ekLeepSdMLxvPwXY6MI',
+                }
+            }).then(resp => {
+                console.log(resp);
+                if (resp.data.code == 200) {
+                    that.Users = resp.data.data;
+                }
+            })
+        },
+        //全选
+        allchange(selection) {
+            let that = this;
+
+            if (selection.length > 0) {
+                selection.forEach(item => {
+                    item.selList = that.opList.map(x => x.id);
+                });
+
+            } else {
+                this.authorityLists.forEach(item => {
+                    item.selList = [];
+                });
+            }
+        },
+        checkchange(rowid, linid) {
+            this.authorityLists.forEach(item => {
+                if (item.id == rowid) {
+                    if (item.selList.indexOf(linid) == -1) {
+                        item.selList.push(linid);
+                    } else {
+                        item.selList.splice(item.selList.indexOf(linid), 1)
+                    }
+                }
+            });
+            console.warn(this.authorityLists);
+        },
+        //员工下拉框
+        UserChange() {
+            console.log(this.Valueuesr);
+            debugger
+            var moduleId = this.value == "" ? 13 : this.value;
+            if (this.Valueuesr == '') {
+
+                var arr = this.authorityList;
+                arr.forEach(item => {
+                    item.selList = [];
+                })
+                this.authorityList = arr;
+                this.authorityLists = this.authorityList;
+                return;
+            }
+
+            var that = this;
+            //获取员工信息
+            this.$axios.post(this.PathUrl + '/api/System/QueryUserAuth', {
+                "Userid": this.Valueuesr,
+                "moduleId": moduleId
+
+            }, {
+                headers: {
+                    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IkZ1dHVyZSIsImV4cCI6MTY3OTU0MjgwNSwiaXNzIjoiT0FTeXN0ZW0uY29tIiwiYXVkIjoiT0FTeXN0ZW0uY29tIn0.iy5SUInq1p3yjZultRPyzCa2ekLeepSdMLxvPwXY6MI',
+                }
+            }).then(resp => {
+                console.log(resp);
+                if (resp.data.code == 200) {
+                    that.authorityList = resp.data.data; //页面数据(默认权限页面)
+                    that.authorityLists = that.authorityList;
+                }
+            })
+
+        },
+        unique(arr) {
+            return Array.from(new Set(arr));
+        }
+    },
+    mounted() {
+        this.pageload(13);
+    }
+}
+</script>
+<style>
+body {
+    margin: 0;
+    padding: 0;
+}
+
+.job-head {
+    display: flex;
+    justify-content: space-between;
+}
+
+.job-box {
+    background-color: #fff;
+    padding: 10px;
+    border-radius: 10px;
+}
+
+.job-table {
+    margin-top: 10px;
+}
+
+.job-table .block {
+    margin-top: 10px;
+}
+
+.job-table .el-table--enable-row-transition .el-table__body td.el-table__cell {
+    text-align: center;
+}
+
+.job-table .el-table--border .el-table__cell:first-child .cell {
+    text-align: center;
+}
+</style>

+ 495 - 1
src/components/system/Company.vue

@@ -1 +1,495 @@
-<template></template>
+<template>
+    <div>
+
+        <div class="communal-list">
+            <div class="communal-title">
+                <div>公司列表</div>
+                <div class="communal-box">
+                    <el-input @input="Inquireclick()" placeholder="请输入内容" v-model="input" clearable>
+                    </el-input>
+                    <el-button @click="Inquireclick()" type="primary"><i class="icon-sousuo"></i></el-button>
+                    <el-button @click="addcompany()" type="primary">新增</el-button>
+                </div>
+            </div>
+            <template>
+                <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
+                    style="width: 100%">
+                    <el-table-column prop="num" label="序 号" width="55">
+                        <template slot-scope="scope">
+                            {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="companyCode" label="公司code" width="100">
+                    </el-table-column>
+                    <el-table-column prop="companyName" label="公司名称" width="200">
+                    </el-table-column>
+                    <el-table-column prop="address" label="公司所在地" width="220">
+                    </el-table-column>
+                    <el-table-column prop="contactUserName" label="负责人" width="100">
+                    </el-table-column>
+                    <el-table-column prop="tel" label="联系方式" width="120">
+                    </el-table-column>
+                    <el-table-column prop="parentCompanyName" label="父级公司名称" width="200">
+                    </el-table-column>
+                    <!-- <el-table-column prop="remark" label="备注" width="200">
+                    </el-table-column> -->
+                    <el-table-column label="操作" width="200">
+                        <template slot-scope="scope">
+                            <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
+                            <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
+                        </template>
+                    </el-table-column>
+
+                </el-table>
+            </template>
+            <div class="block">
+                <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                    :current-page="currentPage" :page-sizes="[10, 15, 20]" :page-size="pageSize"
+                    layout="total, sizes, prev, pager, next" :total="tableDatas.length">
+                </el-pagination>
+            </div>
+            <el-dialog title="修改公司信息" :visible.sync="upDataVisible" width="50%" :before-close="handleClose">
+                <div>
+                    <div>
+                        <el-input placeholder="请输入内容" v-model="updata.CompanyName" style="width: 50%;">
+                            <template slot="prepend">公司名称:</template>
+                        </el-input>
+                        <el-input placeholder="请输入内容" v-model="updata.CompanyCode" style="width: 40%;">
+                            <template slot="prepend">公司Codel:</template>
+                        </el-input>
+                    </div>
+                    <div style="margin-top: 5px;">
+                        <el-input placeholder="请输入内容" v-model="updata.Address" style="width: 91%;">
+                            <template slot="prepend">公司地址:</template>
+                        </el-input>
+                    </div>
+                    <div style="margin-top: 5px;">
+                        <el-select v-model="valueUserValue" filterable placeholder="请选择负责人">
+                            <el-option v-for="item in optionsUsers" :key="item.value" :label="item.label"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
+                        <el-input placeholder="请输入内容" v-model="updata.Tel" style="width: 40%;">
+                            <template slot="prepend">负责人联系方式:</template>
+                        </el-input>
+                    </div>
+                    <div style="margin-top: 5px;">
+                        <el-select v-model="valueCompanyValue" filterable placeholder="请选择上级公司">
+                            <el-option v-for="item in optionsCompanys" :key="item.value" :label="item.label"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
+                    </div>
+                    <div style="margin-top: 5px;">
+                        <div>备注:</div>
+                        <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="updata.Remark"
+                            style="width: 80%;"></el-input>
+                    </div>
+
+                </div>
+                <span slot="footer" class="dialog-footer">
+                    <el-button @click="upDataVisible = false">取 消</el-button>
+                    <el-button type="primary" @click="upDateBtn">保 存</el-button>
+                </span>
+            </el-dialog>
+
+            <el-dialog title="添加公司" :visible.sync="addDataVisible" width="50%" :before-close="handleClose">
+                <div>
+                    <div>
+                        <el-input placeholder="请输入内容" v-model="adddata.CompanyName" style="width: 50%;">
+                            <template slot="prepend">公司名称:</template>
+                        </el-input>
+                        <el-input placeholder="请输入内容" v-model="adddata.CompanyCode" style="width: 40%;">
+                            <template slot="prepend">公司Codel:</template>
+                        </el-input>
+                    </div>
+                    <div style="margin-top: 5px;">
+                        <el-input placeholder="请输入内容" v-model="adddata.Address" style="width: 91%;">
+                            <template slot="prepend">公司地址:</template>
+                        </el-input>
+                    </div>
+                    <div style="margin-top: 5px;">
+                        <el-select v-model="valueUserValue" filterable placeholder="请选择负责人">
+                            <el-option v-for="item in optionsUsers" :key="item.value" :label="item.label"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
+                        <el-input placeholder="请输入内容" v-model="adddata.Tel" style="width: 40%;">
+                            <template slot="prepend">负责人联系方式:</template>
+                        </el-input>
+                    </div>
+                    <div style="margin-top: 5px;">
+                        <el-select v-model="valueCompanyValue" filterable placeholder="请选择上级公司">
+                            <el-option v-for="item in optionsCompanys" :key="item.value" :label="item.label"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
+                    </div>
+                    <div style="margin-top: 5px;">
+                        <div>备注:</div>
+                        <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="adddata.Remark"
+                            style="width: 80%;"></el-input>
+                    </div>
+
+                </div>
+                <span slot="footer" class="dialog-footer">
+                    <el-button @click="addDataVisible = false">取 消</el-button>
+                    <el-button type="primary" @click="addDateBtn">保 存</el-button>
+                </span>
+            </el-dialog>
+        </div>
+
+    </div>
+</template>
+<script>
+import { co, el } from '@fullcalendar/core/internal-common';
+import { del } from 'vue';
+export default {
+    data() {
+        return {
+
+            tableDatas: [],
+            tableData: [],
+            currentPage: 1, // 当前页码
+            pageSize: 15,// 每页的数据条数
+            input: '',
+            token: '',
+            userId: 0,
+            upDataVisible: false,
+            addDataVisible: false,
+            updata: {
+                Id: 0,
+                CompanyCode: "",
+                CompanyName: "",
+                Address: "",
+                ContactUserId: 0,
+                Tel: "",
+                ParentCompanyId: 0,
+                Remark: ""
+            },
+            adddata: {
+                CreateUserId: this.userId,
+                CompanyCode: "",
+                CompanyName: "",
+                Address: "",
+                ContactUserId: 0,
+                Tel: "",
+                ParentCompanyId: 0,
+                Remark: ""
+            },
+            optionsUsers: [{
+                value: 0,
+                label: '请选择公司负责人'
+            }],
+            valueUserValue: 0,
+            optionsCompanys: [{
+                value: 0,
+                label: '请选择上级公司'
+            }],
+            valueCompanyValue: 0
+        }
+    },
+    methods: {
+        //每页条数改变时触发 选择一页显示多少行
+        handleSizeChange(val) {
+            this.currentPage = 1;
+            this.pageSize = val;
+        },
+        //当前页改变时触发 跳转其他页
+        handleCurrentChange(val) {
+            this.currentPage = val;
+        },
+        company() {
+            var url = "http://localhost:5256/api/System/getCompanyList"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    portType: 1,
+                }
+            }).then(function (res) {
+                console.log(res)
+                debugger
+                if (res.data.code == 200) {
+                    debugger
+                    that.tableDatas = res.data.data;
+                    that.tableData = that.tableDatas
+                    that.tableDatas.forEach(function (item, index) {
+                        that.optionsCompanys.push({
+                            value: item.id,
+                            label: item.companyName
+                        });
+                    });
+                }
+            })
+        },
+        Inquireclick() {
+            var newarr = [];
+            if (this.input == "") {
+                newarr = this.tableData;
+            } else {
+                for (var i = 0; i < this.tableData.length; i++) {
+                    if (this.tableData[i].companyName.indexOf(this.input) != -1) {
+                        newarr.push(this.tableData[i]);
+                    }
+                }
+            }
+            this.tableDatas = newarr;
+        },
+        //#region  修改操作
+        upDate(index, row) {
+            debugger
+            this.upDataVisible = true;
+            this.updata.Id = row.id
+            this.updata.CompanyCode = row.companyCode
+            this.updata.CompanyName = row.companyName
+            this.updata.Address = row.address
+            this.updata.Tel = row.tel
+            this.updata.ContactUserId = row.contactUserId
+            this.updata.ParentCompanyId = row.parentCompanyId
+            this.updata.Remark = row.remark
+            this.valueUserValue = row.contactUserId
+            this.valueCompanyValue = row.parentCompanyId
+
+
+        },
+        upDateBtn() {
+            debugger
+            var that = this
+            if (that.updata.Id != 0) {
+                if (that.updata.CompanyName == "" || that.updata.CompanyName == undefined) {
+                    that.$message.error("公司名称不能为空");
+                    return
+                }
+                if (that.updata.CompanyCode == "") {
+                    that.$message.error("公司code不能为空");
+                    return
+                }
+                if (that.updata.Address == "") {
+                    that.$message.error("公司地址不能为空");
+                    return
+                }
+                if (that.updata.ContactUserId == 0) {
+                    that.$message.error("请选择公司负责人");
+                    return
+                }
+
+                debugger;
+                var url = "http://localhost:5256/api/System/EditCompany"
+                var that = this
+                that.$axios({
+                    method: 'post',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' + that.token
+                    },
+                    data: that.updata
+                }).then(function (res) {
+                    console.log(res)
+                    debugger
+                    if (res.data.code == 200) {
+                        that.$message({
+                            message: '修改成功!',
+                            type: 'success'
+                        });
+                        that.upDataVisible = false
+                    } else {
+                        that.$message.error('保修改失败!');
+                    }
+                })
+            }
+
+        },
+        //关闭修改框
+        handleClose(done) {
+            done();
+        },
+        //#endregion
+        del(index, row) {
+            debugger
+            this.$confirm('此操作将取消订单, 是否继续?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then(() => {
+                var url = "http://localhost:5256/api/System/DelCompany"
+                var that = this
+                this.$axios({
+                    method: 'post',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' + this.token
+                    },
+                    data: {
+                        Id: row.id,
+                    }
+                }).then(function (res) {
+                    console.log(res)
+                    debugger
+                    if (res.data.code == 200) {
+                        that.$message({
+                            type: 'success',
+                            message: '删除成功!'
+                        });
+                        that.company();
+                    } else {
+                        that.$message.error("删除失败,请稍后重试");
+                    }
+                })
+
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '操作已取消!'
+                });
+            });
+
+        },
+        //#region 添加
+        addcompany() {
+            this.addDataVisible = true
+
+        },
+        addDateBtn() {
+            debugger
+            var that = this
+            this.adddata.ContactUserId = this.valueUserValue
+            this.adddata.ParentCompanyId = this.valueCompanyValue
+            this.adddata.CreateUserId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
+            if (that.adddata.CompanyName == "" || that.updata.CompanyName == undefined) {
+                that.$message.error("公司名称不能为空");
+                return
+            }
+            if (that.adddata.CompanyCode == "") {
+                that.$message.error("公司code不能为空");
+                return
+            }
+            if (that.adddata.Address == "") {
+                that.$message.error("公司地址不能为空");
+                return
+            }
+            if (that.adddata.ContactUserId == 0) {
+                that.$message.error("请选择公司负责人");
+                return
+            }
+            if (that.adddata.Tel == "") {
+                that.$message.error("请输入手机号");
+                return
+            } else {
+                var reg = /^1[3456789]\d{9}$/;
+                if (!reg.test(that.adddata.Tel)) {
+                    that.$message.error("请输入有效的手机号");
+                    return
+                }
+            }
+
+            var url = "http://localhost:5256/api/System/AddCompany"
+
+            that.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: that.adddata
+            }).then(function (res) {
+                console.log(res)
+                debugger
+                if (res.data.code == 200) {
+                    that.$message({
+                        message: '添加成功!',
+                        type: 'success'
+                    });
+                    that.addDataVisible = false;
+                    this.adddata.CreateUserId = 0
+                    this.adddata.CompanyCode = ""
+                    this.adddata.CompanyName = ""
+                    this.adddata.Address = ""
+                    this.adddata.ContactUserId = 0
+                    this.adddata.Tel = ""
+                    this.adddata.ParentCompanyId = 0
+                    this.adddata.Remark = ""
+                    this.valueUserValue = 0
+                    this.valueCompanyValue = 0
+                    that.company();
+                } else {
+                    that.$message.error('添加失败!');
+                }
+            })
+        },
+        //#endregion
+        //绑定负责人下拉框
+        optionsUser() {
+            var url = "http://localhost:5256/api/System/QueryUserList"
+            var that = this
+            that.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    portType: 1,
+                    CompanyId: 0,
+                    DepId: 0,
+                    JobPostId: 0
+                }
+            }).then(function (res) {
+                console.log(res)
+                debugger
+                if (res.data.code == 200) {
+                    debugger
+                    const data = res.data.data;
+                    data.forEach(function (item, index) {
+                        that.optionsUsers.push({
+                            value: item.id,
+                            label: item.cnName
+                        });
+                    });
+                    that.optionUserValue = '4'
+                }
+            })
+        },
+    },
+    mounted() {
+        debugger
+        this.token = JSON.parse(localStorage.getItem('userinif')).token;
+        this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
+        console.log(this.token)
+        this.company();
+        this.optionsUser();
+    }
+}
+</script>
+<style>
+.communal-list {
+    background-color: #fff;
+    padding: 10px;
+    box-shadow: 0 0 5px #0005;
+    border-radius: 10px;
+}
+
+.communal-title {
+    display: flex;
+    font-size: 17px;
+    font-weight: 600;
+    color: #555;
+    margin-top: 8px;
+    margin-bottom: 2px;
+    justify-content: space-between;
+    align-items: center;
+}
+
+.communal-box {
+    display: flex;
+}
+
+.communal-box>button {
+    margin-left: 10px;
+    padding: 8px 20px;
+}
+</style>

+ 6 - 28
src/router/index.js

@@ -13,11 +13,6 @@ import Globalindex from '@/components/child/Globalindex'
 import Generalindex from '@/components/child/Generalindex'
 import AuthorityJob from '@/components/child/AuthorityJob'
 import Controltree from '@/components/child/Controltree'
-import OPgroup from '@/components/OP/OPgroup'
-import Carguide from '@/components/OP/Carguide'
-import Tourguide from '@/components/OP/Tourguide'
-import Groupedit from '@/components/OP/Groupedit'
-
 
 Vue.use(Router)
 
@@ -32,7 +27,7 @@ export default new Router({
       path: '/home',
       name: 'home',
       component: home,
-      children:[
+      children: [
         {
           path: '/home/index',
           name: 'index',
@@ -73,32 +68,15 @@ export default new Router({
           name: 'AuthorityJob',
           component: AuthorityJob
         },
+        {
+          path: '/home/AuthorityUser',
+          name: 'AuthorityUser',
+          component: AuthorityUser
+        },
         {
           path: '/home/Controltree',
           name: 'Controltree',
           component: Controltree
-        },
-        {
-          path: '/home/OPgroup',
-          name: 'OPgroup',
-          component: OPgroup,
-          children:[
-            {
-              path: '/home/OPgroup/Groupedit',
-              name: 'Groupedit',
-              component: Groupedit
-            }
-          ]
-        },
-        {
-          path: '/home/Carguide',
-          name: 'Carguide',
-          component: Carguide
-        },
-        {
-          path: '/home/Tourguide',
-          name: 'Tourguide',
-          component: Tourguide
         }
       ]
     },