|
@@ -5,8 +5,8 @@
|
|
|
<el-form :inline="true" :model="filters">
|
|
|
<el-col :span="3">
|
|
|
<el-form-item>
|
|
|
- <el-select v-model="filters.companyId" clearable filterable placeholder="请选择项目">
|
|
|
- <el-option v-for="item in projects" :key="item.id" :label="item.companyName" :value="item.id">
|
|
|
+ <el-select v-model="filters.projectId" clearable filterable placeholder="请选择项目">
|
|
|
+ <el-option v-for="item in projects" :key="item.id" :label="item.projectName" :value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -22,22 +22,37 @@
|
|
|
|
|
|
<!--列表-->
|
|
|
<el-table :data="list" highlight-current-row v-loading="listLoading" style="width: 100%;">
|
|
|
- <el-table-column type="selection" width="55">
|
|
|
- </el-table-column>
|
|
|
<el-table-column type="index" width="60">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="姓名" width="120" sortable>
|
|
|
+ <el-table-column prop="username" label="姓名" width="150" sortable>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="companyName" label="所属公司" sortable>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="projectName" label="项目名称" width="220" sortable>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="age" label="年龄" width="100" sortable>
|
|
|
+ <el-table-column prop="addr" label="修改" align="center" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-checkbox :value="scope.row.update==1?true:false"></el-checkbox>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="birth" label="生日" width="120" sortable>
|
|
|
+ <el-table-column prop="addr" label="下载" align="center" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-checkbox :value="scope.row.download==1?true:false"></el-checkbox>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="addr" label="地址" min-width="180" sortable>
|
|
|
+ <el-table-column prop="addr" label="浏览" align="center" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-checkbox :value="scope.row.view==1?true:false"></el-checkbox>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="150">
|
|
|
+ <el-table-column prop="addr" label="审批" align="center" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-checkbox :value="scope.row.approve==1?true:false"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="150" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
|
|
- <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -56,26 +71,17 @@
|
|
|
</el-col>
|
|
|
|
|
|
<!--编辑界面-->
|
|
|
- <el-dialog title="编辑" v-model="editFormVisible" :close-on-click-modal="false">
|
|
|
- <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm">
|
|
|
- <el-form-item label="姓名" prop="name">
|
|
|
- <el-input v-model="editForm.name" autocomplete="off"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="性别">
|
|
|
- <el-radio-group v-model="editForm.sex">
|
|
|
- <el-radio class="radio" :label="1">男</el-radio>
|
|
|
- <el-radio class="radio" :label="0">女</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="年龄">
|
|
|
- <el-input-number v-model="editForm.age" :min="0" :max="200"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="生日">
|
|
|
- <el-date-picker type="date" placeholder="选择日期" v-model="editForm.birth"></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="地址">
|
|
|
- <el-input type="textarea" v-model="editForm.addr"></el-input>
|
|
|
- </el-form-item>
|
|
|
+ <el-dialog title="编辑权限" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
|
|
|
+ <el-form :model="editForm" label-width="80px" ref="editForm">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="权限配置">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="6" v-for="(item,index) in roleList" :key="item.val" style="text-align:center;">
|
|
|
+ <el-checkbox v-model="editForm[item.label]" :checked="editForm[item.label]">{{item.name}}</el-checkbox>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click.native="editFormVisible = false">取消</el-button>
|
|
@@ -91,9 +97,11 @@
|
|
|
data() {
|
|
|
return {
|
|
|
filters: {
|
|
|
- keyName: ''
|
|
|
+ keyName: '',
|
|
|
+ projectId: '',
|
|
|
},
|
|
|
-
|
|
|
+ user: JSON.parse(sessionStorage.getItem('user')),
|
|
|
+
|
|
|
projects: [],
|
|
|
|
|
|
list: [],
|
|
@@ -104,20 +112,21 @@
|
|
|
tableHeight: 0,
|
|
|
|
|
|
editFormVisible: false,//编辑界面是否显示
|
|
|
- editLoading: false,
|
|
|
- editFormRules: {
|
|
|
- name: [
|
|
|
- { required: true, message: '请输入姓名', trigger: 'blur' }
|
|
|
- ]
|
|
|
- },
|
|
|
+ editLoading: false,
|
|
|
+ roleList: [
|
|
|
+ {name:'修改',val:0,label:'uploadPower',uploadPower:false},
|
|
|
+ {name:'下载',val:1,label:'dowloadPower',dowloadPower:false},
|
|
|
+ {name:'浏览',val:2,label:'viewPower',viewPower:false},
|
|
|
+ {name:'审批',val:3,label:'approvalPower',approvalPower:false}
|
|
|
+ ],
|
|
|
//编辑界面数据
|
|
|
editForm: {
|
|
|
- id: 0,
|
|
|
- name: '',
|
|
|
- sex: -1,
|
|
|
- age: 0,
|
|
|
- birth: '',
|
|
|
- addr: ''
|
|
|
+ id: 0,
|
|
|
+ projectId: 0,
|
|
|
+ uploadPower: false,
|
|
|
+ dowloadPower:false,
|
|
|
+ viewPower:false,
|
|
|
+ approvalPower:false,
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -150,7 +159,8 @@
|
|
|
this.size = val;
|
|
|
this.getPowerList();
|
|
|
},
|
|
|
- //获取用户列表
|
|
|
+
|
|
|
+ //获取权限列表
|
|
|
getPowerList() {
|
|
|
this.listLoading = true;
|
|
|
this.http.post(this.port.project.powerList, {
|
|
@@ -160,7 +170,27 @@
|
|
|
}, res => {
|
|
|
this.listLoading = false;
|
|
|
if (res.code == "ok") {
|
|
|
- this.list = res.data.list;
|
|
|
+ var list = res.data.list;
|
|
|
+ for(var i in list){
|
|
|
+ list[i].update = 0;
|
|
|
+ list[i].download = 0;
|
|
|
+ list[i].view = 0;
|
|
|
+ list[i].approve = 0;
|
|
|
+
|
|
|
+ var powers = list[i].powers;
|
|
|
+ for(var j in powers){
|
|
|
+ if(powers[j].powerType == 0){
|
|
|
+ list[i].update = 1;
|
|
|
+ } else if(powers[j].powerType == 1){
|
|
|
+ list[i].download = 1;
|
|
|
+ } else if(powers[j].powerType == 2){
|
|
|
+ list[i].view = 1;
|
|
|
+ } else if(powers[j].powerType == 3){
|
|
|
+ list[i].approve = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.list = list;
|
|
|
this.total = res.data.total;
|
|
|
} else {
|
|
|
this.$message({
|
|
@@ -175,71 +205,68 @@
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
- },
|
|
|
+ },
|
|
|
+
|
|
|
//显示编辑界面
|
|
|
handleEdit: function (index, row) {
|
|
|
this.editFormVisible = true;
|
|
|
- this.editForm = Object.assign({}, row);
|
|
|
- },
|
|
|
- //显示新增界面
|
|
|
- handleAdd: function () {
|
|
|
- this.addFormVisible = true;
|
|
|
- this.addForm = {
|
|
|
- name: '',
|
|
|
- sex: -1,
|
|
|
- age: 0,
|
|
|
- birth: '',
|
|
|
- addr: ''
|
|
|
- };
|
|
|
+ this.editForm = {
|
|
|
+ id: row.userId,
|
|
|
+ projectId: row.projectId,
|
|
|
+ uploadPower: row.update==1?true:false,
|
|
|
+ dowloadPower: row.download==1?true:false,
|
|
|
+ viewPower: row.view==1?true:false,
|
|
|
+ approvalPower: row.approve==1?true:false
|
|
|
+ };
|
|
|
},
|
|
|
//编辑
|
|
|
editSubmit: function () {
|
|
|
- this.$refs.editForm.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.$confirm('确认提交吗?', '提示', {}).then(() => {
|
|
|
- this.editLoading = true;
|
|
|
- //NProgress.start();
|
|
|
- let para = Object.assign({}, this.editForm);
|
|
|
- para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd');
|
|
|
- editUser(para).then((res) => {
|
|
|
- this.editLoading = false;
|
|
|
- //NProgress.done();
|
|
|
- this.$message({
|
|
|
- message: '提交成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- this.$refs['editForm'].resetFields();
|
|
|
- this.editFormVisible = false;
|
|
|
- this.getUsers();
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- //新增
|
|
|
- addSubmit: function () {
|
|
|
- this.$refs.addForm.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.$confirm('确认提交吗?', '提示', {}).then(() => {
|
|
|
- this.addLoading = true;
|
|
|
- //NProgress.start();
|
|
|
- let para = Object.assign({}, this.addForm);
|
|
|
- para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd');
|
|
|
- addUser(para).then((res) => {
|
|
|
- this.addLoading = false;
|
|
|
- //NProgress.done();
|
|
|
- this.$message({
|
|
|
- message: '提交成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- this.$refs['addForm'].resetFields();
|
|
|
- this.addFormVisible = false;
|
|
|
- this.getUsers();
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
+ var str = "";
|
|
|
+
|
|
|
+ if(this.editForm.uploadPower) {
|
|
|
+ str += "0,"
|
|
|
+ }
|
|
|
+ if(this.editForm.dowloadPower) {
|
|
|
+ str += "1,"
|
|
|
+ }
|
|
|
+ if(this.editForm.viewPower) {
|
|
|
+ str += "2,"
|
|
|
+ }
|
|
|
+ if(this.editForm.approvalPower) {
|
|
|
+ str += "3,"
|
|
|
+ }
|
|
|
+
|
|
|
+ str = str.substring(0,str.length-1)
|
|
|
+
|
|
|
+ this.editLoading = true;
|
|
|
+ this.http.post(this.port.project.powerUpdate, {
|
|
|
+ id: this.editForm.id,
|
|
|
+ projectId: this.editForm.projectId,
|
|
|
+ powers: str
|
|
|
+ }, res => {
|
|
|
+ this.editLoading = false;
|
|
|
+ this.editFormVisible = false;
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.getPowerList();
|
|
|
+ } 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;
|