Browse Source

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

liuhj 2 years ago
parent
commit
bfb0e36a5a

+ 122 - 109
src/components/system/Company.vue

@@ -152,14 +152,12 @@ export default {
     data() {
         var isnumber = (rule, value, callback) => {
             debugger
-            var reg = "^[1]+[2,3,4,5,6,7,8,9]+\d{9}";//小数点左边最高16位,小数点右边最多4位
+            var reg = /^1[3456789]\d{9}$/;//小数点左边最高16位,小数点右边最多4位
             if (reg.test(value)) {
                 callback();
-            } else if (value == "" && value == null && value == undefined) {
-                callback(new Error("请输入加价百分比"));
-            } else {
-                callback(new Error("输入正确的数字,小数点后可1到2位"));
-            }
+            } else
+                callback(new Error("请输入正确的手机号"));
+
 
         };
         return {
@@ -216,7 +214,7 @@ export default {
                     { required: true, message: '公司地址不能为空', trigger: 'change' }
                 ],
                 ContactUserId: [
-                    { required: true, message: '公司地址不能为空', trigger: 'change' }
+                    { required: true, message: '负责人不能为空', trigger: 'change' }
                 ],
                 Tel: [
                     { validator: isnumber, message: '请输入正确的手机号', trigger: 'change' }
@@ -295,50 +293,57 @@ export default {
         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
-                }
+            that.$refs.updata.validate((valid) => {
+                if (valid) {
 
-                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
-                        that.company();
-                    } else {
-                        that.$message.error('保修改失败!');
-                    }
-                })
-            }
+                    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
+                                that.company();
+                            } else {
+                                that.$message.error('保修改失败!');
+                            }
+                        })
+                    }
+                } else {
+                    this.$message.error('请完善信息在保存!');
+                    return false;
+                }
+            })
         },
         //关闭修改框
         handleClose(done) {
@@ -390,71 +395,79 @@ export default {
             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
-                }
-            }
+            this.$refs.adddata.validate((valid) => {
+                if (valid) {
+                    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"
+                    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'
-                    });
-                    debugger
-                    that.addDataVisible = false;
-                    that.adddata.CreateUserId = 0
-                    that.adddata.CompanyCode = ""
-                    that.adddata.CompanyName = ""
-                    that.adddata.Address = ""
-                    that.adddata.ContactUserId = 0
-                    that.adddata.Tel = ""
-                    that.adddata.ParentCompanyId = 0
-                    that.adddata.Remark = ""
-                    that.valueUserValue = 0
-                    that.valueCompanyValue = 0
-                    that.company();
+                    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'
+                            });
+                            debugger
+                            that.addDataVisible = false;
+                            that.adddata.CreateUserId = 0
+                            that.adddata.CompanyCode = ""
+                            that.adddata.CompanyName = ""
+                            that.adddata.Address = ""
+                            that.adddata.ContactUserId = 0
+                            that.adddata.Tel = ""
+                            that.adddata.ParentCompanyId = 0
+                            that.adddata.Remark = ""
+                            that.valueUserValue = 0
+                            that.valueCompanyValue = 0
+                            that.company();
+                        } else {
+                            that.$message.error('添加失败!');
+                        }
+                    })
                 } else {
-                    that.$message.error('添加失败!');
+                    this.$message.error('请完善信息在保存!');
+                    return false;
                 }
             })
         },

+ 93 - 86
src/components/system/Department.vue

@@ -82,7 +82,7 @@
         </el-dialog>
         <el-dialog title="修改部门" :visible.sync="upDepVisible" width="30%" :before-close="handleClose">
             <div>
-                <el-form :model="upData" :rules="rules" ref="addData" label-width="100px" class="demo-ruleForm">
+                <el-form :model="upData" :rules="rules" ref="upData" label-width="100px" class="demo-ruleForm">
                     <el-form-item label="部门code" prop="DepCode">
                         <el-input placeholder="请输入内容" v-model="upData.DepCode">
                         </el-input>
@@ -135,7 +135,7 @@ export default {
             upDepVisible: false,
             upData: {
                 Id: 0,
-                CompanyId: 0,
+                CompanyId: '',
                 DepCode: "",
                 DepName: "",
                 ParentDepId: 0,
@@ -143,7 +143,7 @@ export default {
             },
             //添加参数
             addData: {
-                CompanyId: 0,
+                CompanyId: '',
                 DepCode: "",
                 DepName: "",
                 ParentDepId: 0,
@@ -158,20 +158,14 @@ export default {
                 DepName: [
                     { required: true, message: '请输入部门名称', trigger: 'blur' },
                 ],
-                CompanyValue: [
+                CompanyId: [
                     { required: true, message: '请选择所属公司', trigger: 'change' }
                 ],
             },
-            optionsDepartment: [{
-                value: 0,
-                label: '请选择上级部门'
-            }],
-            ParentDepId: 0,
-            optionsCompanys: [{
-                value: 0,
-                label: '请选择所属公司'
-            }],
-            CompanyId: 0
+            optionsDepartment: [],
+            ParentDepId: '',
+            optionsCompanys: [],
+            CompanyId: ''
         }
     },
     methods: {
@@ -299,43 +293,49 @@ export default {
         upDateBtn() {
             debugger
             var that = this
-            that.upData.CreateUserId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
-            if (that.upData.DepName == "" || that.upData.DepName == undefined) {
-                that.$message.error("部门名称不能为空");
-                return
-            }
-            if (that.upData.DepCode == "") {
-                that.$message.error("部门code不能为空");
-                return
-            }
-            if (that.upData.CompanyId == 0) {
-                that.$message.error("请选择所属公司");
-                return
-            }
-            var url = "http://localhost:5256/api/System/EditDepartment"
+            this.$refs.upData.validate((valid) => {
+                if (valid) {
+                    that.upData.CreateUserId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
+                    if (that.upData.DepName == "" || that.upData.DepName == undefined) {
+                        that.$message.error("部门名称不能为空");
+                        return
+                    }
+                    if (that.upData.DepCode == "") {
+                        that.$message.error("部门code不能为空");
+                        return
+                    }
+                    if (that.upData.CompanyId == 0) {
+                        that.$message.error("请选择所属公司");
+                        return
+                    }
+                    var url = "http://localhost:5256/api/System/EditDepartment"
 
-            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.upDepVisible = false;
-                    that.Department();
+                    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.upDepVisible = false;
+                            that.Department();
+                        } else {
+                            that.$message.error('修改失败!');
+                        }
+                    })
                 } else {
-                    that.$message.error('修改失败!');
+                    this.$message.error('请完善信息在保存!');
+                    return false;
                 }
             })
-
         },
         //关闭修改框
         handleClose(done) {
@@ -389,47 +389,54 @@ export default {
         },
         Addbtn() {
             debugger
-            var that = this
-            that.addData.CreateUserId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
-            if (that.addData.DepName == "" || that.addData.DepName == undefined) {
-                that.$message.error("部门名称不能为空");
-                return
-            }
-            if (that.addData.DepCode == "") {
-                that.$message.error("部门code不能为空");
-                return
-            }
-            if (that.addData.CompanyId == 0) {
-                that.$message.error("请选择所属公司");
-                return
-            }
-            var url = "http://localhost:5256/api/System/AddDepartment"
+            this.$refs.addData.validate((valid) => {
+                if (valid) {
+                    var that = this
+                    that.addData.CreateUserId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
+                    if (that.addData.DepName == "" || that.addData.DepName == undefined) {
+                        that.$message.error("部门名称不能为空");
+                        return
+                    }
+                    if (that.addData.DepCode == "") {
+                        that.$message.error("部门code不能为空");
+                        return
+                    }
+                    if (that.addData.CompanyId == 0) {
+                        that.$message.error("请选择所属公司");
+                        return
+                    }
+                    var url = "http://localhost:5256/api/System/AddDepartment"
 
-            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.addDepVisible = false;
-                    that.Department();
-                    that.addData.CompanyId = 0;
-                    that.addData.DepCode = "";
-                    that.addData.DepName = "";
-                    that.addData.ParentDepId = 0;
-                    that.addData.CreateUserId = this.userId;
-                    that.addData.Remark = "";
+                    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.addDepVisible = false;
+                            that.Department();
+                            that.addData.CompanyId = 0;
+                            that.addData.DepCode = "";
+                            that.addData.DepName = "";
+                            that.addData.ParentDepId = 0;
+                            that.addData.CreateUserId = this.userId;
+                            that.addData.Remark = "";
+                        } else {
+                            that.$message.error('添加失败!');
+                        }
+                    })
                 } else {
-                    that.$message.error('添加失败!');
+                    this.$message.error('请完善信息在保存!');
+                    return false;
                 }
             })
         },

+ 447 - 0
src/components/system/JobPost.vue

@@ -0,0 +1,447 @@
+<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="addDepartment()" 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="jobName" label="岗位名称" width="240">
+                    </el-table-column>
+                    <el-table-column prop="companyName" label="所属公司" width="200">
+                    </el-table-column>
+                    <el-table-column prop="depName" label="所属所属部门" width="220">
+                    </el-table-column>
+                    <el-table-column prop="remark" label="备注" width="300">
+                    </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>
+        </div>
+        <el-dialog title="添加岗位" :visible.sync="addJobVisible" width="30%" :before-close="handleClose">
+            <div>
+                <el-form :model="addData" :rules="rules" ref="addData" label-width="100px" class="demo-ruleForm">
+                    <el-form-item label="岗位名称" prop="JobName">
+                        <el-input placeholder="请输入内容" v-model="addData.JobName">
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="所属公司" prop="CompanyId">
+                        <el-select v-model="addData.CompanyId" filterable placeholder="请选择所属公司" @change="handleChange">
+                            <el-option v-for="item in companyData" :key="item.id" :label="item.companyName"
+                                :value="item.id">
+                            </el-option>
+                        </el-select>
+                    </el-form-item>
+                    <el-form-item label="上级部门" prop="ParentDepId">
+                        <el-select v-model="addData.DepId" placeholder="所属部门">
+                            <el-option v-for="item in depData" :key="item.id" :label="item.depName" :value="item.id">
+                            </el-option>
+                        </el-select>
+                    </el-form-item>
+
+                    <el-form-item label="备 注" prop="Remark">
+                        <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="addData.Remark"></el-input>
+                    </el-form-item>
+                </el-form>
+            </div>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="addJobVisible = false">取 消</el-button>
+                <el-button type="primary" @click="Addbtn">确 定</el-button>
+            </span>
+        </el-dialog>
+        <el-dialog title="修改部门" :visible.sync="upJobVisible" width="30%" :before-close="handleClose">
+            <div>
+                <el-form :model="upData" :rules="rules" ref="upData" label-width="100px" class="demo-ruleForm">
+                    <el-form-item label="岗位名称" prop="JobName">
+                        <el-input placeholder="请输入内容" v-model="upData.JobName">
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="所属公司" prop="CompanyId">
+                        <el-select v-model="upData.CompanyId" filterable placeholder="请选择所属公司" @change="handleChange">
+                            <el-option v-for="item in companyData" :key="item.id" :label="item.companyName"
+                                :value="item.id">
+                            </el-option>
+                        </el-select>
+                    </el-form-item>
+                    <el-form-item label="上级部门" prop="DepId">
+                        <el-select v-model="upData.DepId" placeholder="所属部门">
+                            <el-option v-for="item in depData" :key="item.id" :label="item.depName" :value="item.id">
+                            </el-option>
+                        </el-select>
+                    </el-form-item>
+
+                    <el-form-item label="备 注" prop="Remark">
+                        <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="upData.Remark"></el-input>
+                    </el-form-item>
+                </el-form>
+            </div>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="upJobVisible = false">取 消</el-button>
+                <el-button type="primary" @click="upDateBtn">确 定</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+<script>
+import { co, el } from '@fullcalendar/core/internal-common';
+import { del } from 'vue';
+export default {
+    data() {
+
+        return {
+
+            tableDatas: [],
+            tableData: [],
+            companyData: [],//公司数据
+            depData: [],//部门数据
+            currentPage: 1, // 当前页码
+            pageSize: 15,// 每页的数据条数
+            addJobVisible: false,
+            upJobVisible: false,
+            addData: {
+                CompanyId: '',
+                DepId: '',
+                JobName: '',
+                CreateUserId: 0,
+                Remark: ''
+            },
+            upData: {
+                Id: 0,
+                CompanyId: '',
+                DepId: '',
+                JobName: '',
+                Remark: ''
+            },
+            input: '',
+            token: '',
+            userId: 0,
+            rules: {
+                JobName: [
+                    { required: true, message: '请输入岗位名称', trigger: 'blur' },
+                ],
+                CompanyId: [
+                    { required: true, message: '请选择所属公司', trigger: 'blur' },
+                ],
+                DepId: [
+                    { required: true, message: '请选择所属部门', trigger: 'blur' },
+                ],
+            },
+        }
+    },
+    methods: {
+        //每页条数改变时触发 选择一页显示多少行
+        handleSizeChange(val) {
+            this.currentPage = 1;
+            this.pageSize = val;
+        },
+        //当前页改变时触发 跳转其他页
+        handleCurrentChange(val) {
+            this.currentPage = val;
+
+        },
+        Department(compId) {
+            var url = "http://localhost:5256/api/System/QueryDepartmentList"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    portType: 1,
+                    CompanyId: compId
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    debugger
+                    that.depData = res.data.data;
+                }
+            })
+        },
+        //公司下拉框绑定
+        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.companyData = res.data.data
+
+                }
+            })
+        },
+        jobPost() {
+            var url = "http://localhost:5256/api/System/QueryJobPost"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    portType: 1,
+                    CompanyId: 0,
+                    DepId: 0,
+                }
+            }).then(function (res) {
+                debugger
+                console.log(res)
+
+                if (res.data.code == 200) {
+                    debugger
+                    debugger
+                    that.tableDatas = res.data.data;
+                    that.tableData = that.tableDatas
+
+                }
+            })
+        },
+        handleChange(event) {
+            debugger
+            var comId = event;
+            const that = this;
+            that.upData.DepId = ''
+            that.Department(event);
+        },
+        Inquireclick() {
+            var newarr = [];
+            if (this.input == "") {
+                newarr = this.tableData;
+            } else {
+                for (var i = 0; i < this.tableData.length; i++) {
+                    if (this.tableData[i].depName.indexOf(this.input) != -1) {
+                        newarr.push(this.tableData[i]);
+                    }
+                    if (this.tableData[i].companyName.indexOf(this.input) != -1) {
+                        newarr.push(this.tableData[i]);
+                    }
+                }
+            }
+            this.tableDatas = newarr;
+        },
+        //#region  修改操作
+        upDate(index, row) {
+            debugger
+            this.upJobVisible = true;
+            this.upData.Id = row.id
+            this.upData.CompanyId = row.companyId
+            this.upData.DepId = row.depId
+            this.upData.JobName = row.jobName
+            this.upData.Remark = row.remark
+        },
+        upDateBtn() {
+            debugger
+            this.$refs.upData.validate((valid) => {
+                if (valid) {
+                    var that = this
+                    that.upData.CreateUserId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
+
+                    if (that.upData.JobName == "" || that.upData.JobName == undefined) {
+                        that.$message.error("部门名称不能为空");
+                        return
+                    }
+                    if (that.upData.Remark == null || that.upData.Remark == undefined) that.upData.Remark = ''
+
+                    var url = "http://localhost:5256/api/System/EditJobPost"
+
+                    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.upJobVisible = false;
+                            that.jobPost();
+                        } else {
+                            that.$message.error('修改失败!');
+                        }
+                    })
+                } else {
+                    this.$message.error('请完善信息在保存!');
+                    return false;
+                }
+            })
+        },
+        //关闭修改框
+        handleClose(done) {
+            done();
+        },
+        //#endregion
+        del(index, row) {
+            debugger
+            this.$confirm('此操作将取消订单, 是否继续?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then(() => {
+                var url = "http://localhost:5256/api/System/DelJobPost"
+                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.Department();
+                    } else {
+                        that.$message.error("删除失败,请稍后重试");
+                    }
+                })
+
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '操作已取消!'
+                });
+            });
+
+        },
+        //#region 添加
+        addDepartment() {
+            this.addJobVisible = true
+
+        },
+        Addbtn() {
+            debugger
+            this.$refs.addData.validate((valid) => {
+                if (valid) {
+                    var that = this
+                    that.addData.CreateUserId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
+                    if (that.addData.JobName == "" || that.addData.JobName == undefined) {
+                        that.$message.error("岗位名称不能为空");
+                        return
+                    }
+                    if (that.addData.Remark == null) that.addData.Remark = '';
+                    var url = "http://localhost:5256/api/System/AddJobPost"
+                    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.addJobVisible = false;
+                            that.Department();
+                            that.addData.CompanyId = '';
+                            that.addData.DepId = '';
+                            that.addData.JobName = ''
+                            that.addData.CreateUserId = this.userId;
+                            that.addData.Remark = "";
+                            that.jobPost();
+                        } else {
+                            that.$message.error('添加失败!');
+                        }
+                    })
+                } else {
+                    this.$message.error('请完善信息在保存!');
+                    return false;
+                }
+            })
+        },
+        //#endregion
+
+    },
+    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.jobPost();
+        this.Department('0');
+    }
+}
+</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>

+ 55 - 45
src/components/system/User.vue

@@ -112,14 +112,17 @@ export default {
     data() {
         return {
             rules: {
-                DepCode: [
-                    { required: true, message: '请输入部门Code', trigger: 'blur' },
+                Number: [
+                    { required: true, message: '请输入工号', trigger: 'blur' },
                 ],
-                DepName: [
-                    { required: true, message: '请输入部门名称', trigger: 'blur' },
+                CompanyId: [
+                    { required: true, message: '请选择所属公司', trigger: 'blur' },
                 ],
-                CompanyValue: [
-                    { required: true, message: '请选择所属公司', trigger: 'change' }
+                DepId: [
+                    { required: true, message: '请选择所属部门', trigger: 'change' }
+                ],
+                JobPostId: [
+                    { required: true, message: '请选择所属职位', trigger: 'change' }
                 ],
             },
             tableDatas: [],
@@ -308,47 +311,54 @@ export default {
         },
         upBtn() {
             debugger
-            var that = this
-            if (that.upData.DepId == "" || that.upData.DepId == undefined) {
-                that.$message.error("部门不能为空");
-                return
-            }
-            if (that.upData.CompanyId == "") {
-                that.$message.error("公司不能为空");
-                return
-            }
-            if (that.upData.JobPostId == "") {
-                that.$message.error("岗位不能为空");
-                return
-            }
-            if (that.upData.Number == "") {
-                that.$message.error("工号不能为空");
-                return
-            }
-            console.log(that.upData.Ext)
-            if (that.upData.Ext == null || that.upData.Ext == undefined) that.upData.Ext = ""
-            if (that.upData.UsePeriod == null || that.upData.UsePeriod == undefined) that.upData.UsePeriod = ""
-            var url = "http://localhost:5256/api/System/EditUser"
+            this.$refs.upData.validate((valid) => {
+                if (valid) {
+                    var that = this
+                    if (that.upData.DepId == "" || that.upData.DepId == undefined) {
+                        that.$message.error("部门不能为空");
+                        return
+                    }
+                    if (that.upData.CompanyId == "") {
+                        that.$message.error("公司不能为空");
+                        return
+                    }
+                    if (that.upData.JobPostId == "") {
+                        that.$message.error("岗位不能为空");
+                        return
+                    }
+                    if (that.upData.Number == "") {
+                        that.$message.error("工号不能为空");
+                        return
+                    }
+                    console.log(that.upData.Ext)
+                    if (that.upData.Ext == null || that.upData.Ext == undefined) that.upData.Ext = ""
+                    if (that.upData.UsePeriod == null || that.upData.UsePeriod == undefined) that.upData.UsePeriod = ""
+                    var url = "http://localhost:5256/api/System/EditUser"
 
-            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.upUserVisible = false;
-                    that.user();
+                    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.upUserVisible = false;
+                            that.user();
+                        } else {
+                            that.$message.error('修改失败!');
+                        }
+                    })
                 } else {
-                    that.$message.error('修改失败!');
+                    this.$message.error('请完善信息在保存!');
+                    return false;
                 }
             })
         },

+ 5 - 0
src/router/index.js

@@ -21,6 +21,7 @@ import OPgroup from '@/components/OP/OPgroup'
 import Tourguide from '@/components/OP/Tourguide'
 import Department from '@/components/system/Department'
 import User from '@/components/system/User'
+import JobPost from '@/components/system/JobPost'
 Vue.use(Router)
 
 export default new Router({
@@ -115,6 +116,10 @@ export default new Router({
           path: '/home/User',
           name: 'User',
           component: User
+        }, {
+          path: '/home/JobPost',
+          name: 'JobPost',
+          component: JobPost
         },
 
       ]