Explorar o código

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

# Conflicts:
#	.idea/workspace.xml
sunyadv %!s(int64=5) %!d(string=hai) anos
pai
achega
98f58afbc6

+ 4 - 1
ys_vue/src/port.js

@@ -11,6 +11,9 @@ export default {
     base: {
         addRole: '/role/add',  // 新建或修改角色
         roleList: '/role/list', // 角色列表
-        delRole: '/role/delete' // 删除角色
+        delRole: '/role/delete', // 删除角色
+        addCompany: '/company/add',  // 新建或修改公司
+        companyList: '/company/list', // 公司列表
+        delCompany: '/company/delete', // 删除公司
     }
 }

+ 8 - 3
ys_vue/src/routes.js

@@ -11,13 +11,18 @@ import Page6 from './views/nav3/Page6.vue'
 import echarts from './views/charts/echarts.vue'
 //新页面
 import map from './views/map/map.vue'
+
 import detection from './views/detection/detection.vue'
+
 import project from './views/project/project.vue'
+import staff from './views/project/staff.vue'
+import competence from './views/project/competence.vue'
+
 import moldList from './views/mold/moldList.vue'
 import moldFile from './views/mold/moldFile.vue'
-import staff from './views/base/staff.vue'
+
 import role from './views/base/role.vue'
-import competence from './views/base/competence.vue'
+import comp from './views/base/comp.vue'
 
 let routes = [
     {
@@ -121,7 +126,7 @@ let routes = [
         iconCls: 'iconfont icon-setting-fill',
         children: [
             { path: '/role', component: role, name: '角色管理' },
-            //{ path: '/role', component: role, name: '公司管理' },
+            { path: '/comp', component: comp, name: '公司管理' },
         ]
     },
     {

+ 283 - 0
ys_vue/src/views/base/comp.vue

@@ -0,0 +1,283 @@
+<template>
+	<section>
+		<!--工具条-->
+		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
+			<el-form :inline="true" :model="filters">
+                <el-form-item>
+                    <el-input v-model="filters.keyName" placeholder="请输入公司名称进行搜索" clearable></el-input>
+                </el-form-item>
+				<el-form-item>
+					<el-button type="primary" @click.native="getRoles">查询</el-button>
+				</el-form-item>
+				<el-form-item style="float:right;">
+					<el-button type="primary" @click.native="handleAdd">新增</el-button>
+				</el-form-item>
+			</el-form>
+		</el-col>
+
+		<!--列表-->
+		<el-table :data="list" highlight-current-row :height="tableHeight" v-loading="listLoading" style="width: 100%;">
+			<el-table-column prop="roleName" label="公司名称" sortable></el-table-column>
+			<el-table-column label="操作" width="150">
+				<template slot-scope="scope">
+					<el-button size="small" @click.native="handleEdit(scope.$index, scope.row)">编辑</el-button>
+					<el-button type="danger" size="small" @click.native.native="handleDel(scope.$index, scope.row)">删除</el-button>
+				</template>
+			</el-table-column>
+		</el-table>
+
+		<!--工具条-->
+		<el-col :span="24" class="toolbar">
+            <el-pagination
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :page-sizes="[20 , 50 , 80 , 100 , 200]"
+                :page-size="20"
+                layout="total, sizes, prev, pager, next"
+                :total="total"
+                style="float:right;">
+            </el-pagination>
+		</el-col>
+
+        <!--新增界面-->
+		<el-dialog title="新增角色" :inline="true" :visible.sync="addFormVisible" :close-on-click-modal="false">
+			<el-form :model="addForm" label-width="80px" :rules="formRules" ref="addForm">
+				<el-form-item label="角色名称" prop="roleName">
+					<el-input v-model="addForm.roleName" auto-complete="off"></el-input>
+				</el-form-item>
+                <el-form-item label="角色名称" prop="roleName">
+					<el-input v-model="addForm.roleName" auto-complete="off"></el-input>
+				</el-form-item>
+			</el-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button @click.native="addFormVisible = false">取消</el-button>
+				<el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
+			</div>
+		</el-dialog>
+
+		<!--编辑界面-->
+		<el-dialog title="编辑人员" :inline="true" :visible.sync="editFormVisible" :close-on-click-modal="false">
+			<el-form :model="editForm" label-width="80px" :rules="formRules" ref="editForm">
+				<el-form-item label="角色名称" prop="roleName">
+					<el-input v-model="editForm.roleName" auto-complete="off"></el-input>
+				</el-form-item>
+                <el-form-item label="角色名称" prop="roleName">
+					<el-input v-model="addForm.roleName" auto-complete="off"></el-input>
+				</el-form-item>
+			</el-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button @click.native="editFormVisible = false">取消</el-button>
+				<el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
+			</div>
+		</el-dialog>
+	</section>
+</template>
+
+<script>
+	import util from '../../common/js/util'
+
+	export default {
+		data() {
+			return {
+				filters: {
+                    keyName: ''
+                },
+				list: [],
+				total: 0,
+                page: 1,
+                size: 20,
+                listLoading: false,
+                tableHeight: 0,
+                
+                formRules: {
+					roleName: [
+						{ required: true, message: '请输入公司名称', trigger: 'blur' }
+					]
+                },
+
+                // 新增界面
+				addFormVisible: false,
+				addLoading: false,
+				addForm: {
+                    roleName: ''
+				},
+                
+                // 编辑界面
+				editFormVisible: false,
+				editLoading: false,
+				editForm: {
+					id: 0,
+					roleName: ''
+				}
+			}
+		},
+		methods: {
+            //  分页
+			handleCurrentChange(val) {
+				this.page = val;
+				this.getRoles();
+            },
+
+            handleSizeChange(val) {
+                this.size = val;
+				this.getRoles();
+            },
+
+			//获取用户列表
+			getRoles() {
+				this.listLoading = true;
+                this.http.post(this.port.base.companyList, {
+                    keyName: this.filters.keyName
+                }, res => {
+                    this.listLoading = false;
+                    if (res.code == "ok") {
+                        this.list = res.data;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        });
+                    }
+                }, error => {
+                    this.listLoading = false;
+                    this.$message({
+                        message: error,
+                        type: 'error'
+                    });
+                })
+            },
+
+            //显示新增界面
+			handleAdd: function () {
+                this.addFormVisible = true;
+				this.addForm = {
+					roleName: ''
+				};
+            },
+            
+            //新增
+			addSubmit: function () {
+				this.$refs.addForm.validate((valid) => {
+					if (valid) {
+                        this.addLoading = true;
+                        this.http.post(this.port.base.addCompany, {
+                            roleName: this.addForm.roleName,
+                            flag: 0
+                        }, res => {
+                            this.addLoading = false;
+                            this.addFormVisible = false;
+                            if (res.code == "ok") {
+                                this.$message({
+                                    message: '创建成功',
+                                    type: 'success'
+                                });
+                                this.getRoles();
+                            } else {
+                                this.$message({
+                                    message: res.msg,
+                                    type: 'error'
+                                });
+                            }
+                        }, error => {
+                            this.addLoading = false;
+                            this.addFormVisible = false;
+                            this.$message({
+                                message: error,
+                                type: 'error'
+                            });
+                        })
+					}
+				});
+            },
+            
+			//删除
+			handleDel: function (index, row) {
+				this.$confirm('确认删除该公司吗?', '提示', {
+					type: 'warning'
+				}).then(() => {
+					var _this = this;
+                    this.addLoading = true;
+                    this.http.post(this.port.base.delCompany, {
+                        id: row.id
+                    }, res => {
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: '删除成功',
+                                type: 'success'
+                            });
+                            this.getRoles();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: 'error'
+                            });
+                        }
+                    }, error => {
+                        this.$message({
+                            message: error,
+                            type: 'error'
+                        });
+                    })
+				});
+            },
+            
+			//显示编辑界面
+			handleEdit: function (index, row) {
+                this.editFormVisible = true;
+                this.editForm = {
+                    id: row.id,
+					roleName: row.roleName
+				};
+            },
+            
+			//编辑
+			editSubmit: function () {
+				this.$refs.editForm.validate((valid) => {
+					if (valid) {
+						this.editLoading = true;
+                        this.http.post(this.port.base.addCompany, {
+                            id: this.editForm.id,
+                            roleName: this.editForm.roleName,
+                            flag: 1
+                        }, res => {
+                            this.editLoading = false;
+                            this.editFormVisible = false;
+                            if (res.code == "ok") {
+                                this.$message({
+                                    message: '修改成功',
+                                    type: 'success'
+                                });
+                                this.getRoles();
+                            } else {
+                                this.$message({
+                                    message: res.msg,
+                                    type: 'error'
+                                });
+                            }
+                        }, error => {
+                            this.editLoading = false;
+                            this.editFormVisible = false;
+                            this.$message({
+                                message: error,
+                                type: 'error'
+                            });
+                        })
+					}
+				});
+            }
+        },
+
+        created() {
+            let height = window.innerHeight;
+            this.tableHeight = height - 240;
+        },
+
+		mounted() {
+			this.getRoles();
+        }
+	}
+</script>
+
+<style scoped>
+    
+</style>

ys_vue/src/views/base/competence.vue → ys_vue/src/views/project/competence.vue


ys_vue/src/views/base/staff.vue → ys_vue/src/views/project/staff.vue