Browse Source

用户和角色增删改查修改

dev
hosinokamui 6 years ago
parent
commit
955f3e0c7b
  1. 9
      epmet-oper-web/package-lock.json
  2. 2
      epmet-oper-web/public/index.html
  3. 60
      epmet-oper-web/src/views/modules/sys/role-add-or-update.vue
  4. 4
      epmet-oper-web/src/views/modules/sys/role.vue
  5. 12
      epmet-oper-web/src/views/modules/sys/user-add-or-update.vue

9
epmet-oper-web/package-lock.json

@ -5365,6 +5365,15 @@
"integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=",
"dev": true "dev": true
}, },
"dai-js": {
"version": "0.0.12",
"resolved": "https://registry.npm.taobao.org/dai-js/download/dai-js-0.0.12.tgz",
"integrity": "sha1-Yk4eqh6Q5p2bFrYcl3cUDIZoF70=",
"dev": true,
"requires": {
"babel-runtime": "^6.11.6"
}
},
"dashdash": { "dashdash": {
"version": "1.14.1", "version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",

2
epmet-oper-web/public/index.html

@ -29,7 +29,7 @@
<!-- 开发环境 --> <!-- 开发环境 -->
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %> <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script>window.SITE_CONFIG['apiURL'] = 'http://10.10.10.77:8080/api';</script> <script>window.SITE_CONFIG['apiURL'] = 'http://localhost:8080/api';</script>
<% } %> <% } %>
<!-- 集成测试环境 --> <!-- 集成测试环境 -->
<% if (process.env.VUE_APP_NODE_ENV === 'prod:sit') { %> <% if (process.env.VUE_APP_NODE_ENV === 'prod:sit') { %>

60
epmet-oper-web/src/views/modules/sys/role-add-or-update.vue

@ -20,18 +20,18 @@
</el-tree> </el-tree>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-form-item size="mini" :label="$t('role.deptList')"> <!-- <el-form-item size="mini" :label="$t('role.deptList')">-->
<el-tree <!-- <el-tree-->
:data="deptList" <!-- :data="deptList"-->
:props="{ label: 'name', children: 'children' }" <!-- :props="{ label: 'name', children: 'children' }"-->
node-key="id" <!-- node-key="id"-->
ref="deptListTree" <!-- ref="deptListTree"-->
accordion <!-- accordion-->
show-checkbox> <!-- show-checkbox>-->
</el-tree> <!-- </el-tree>-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
</el-row> </el-row>
</el-form> </el-form>
<template slot="footer"> <template slot="footer">
@ -48,12 +48,12 @@ export default {
return { return {
visible: false, visible: false,
menuList: [], menuList: [],
deptList: [], // deptList: [],
dataForm: { dataForm: {
id: '', id: '',
name: '', name: '',
menuIdList: [], menuIdList: [],
deptIdList: [], // deptIdList: [],
remark: '' remark: ''
} }
} }
@ -73,10 +73,10 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
this.$refs.menuListTree.setCheckedKeys([]) this.$refs.menuListTree.setCheckedKeys([])
this.$refs.deptListTree.setCheckedKeys([]) // this.$refs.deptListTree.setCheckedKeys([])
Promise.all([ Promise.all([
this.getMenuList(), this.getMenuList()
this.getDeptList() // this.getDeptList()
]).then(() => { ]).then(() => {
if (this.dataForm.id) { if (this.dataForm.id) {
this.getInfo() this.getInfo()
@ -86,7 +86,7 @@ export default {
}, },
// //
getMenuList () { getMenuList () {
return this.$http.get('/sys/menu/select').then(({ data: res }) => { return this.$http.get('/oper/access/menu/select').then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -94,17 +94,17 @@ export default {
}).catch(() => {}) }).catch(() => {})
}, },
// //
getDeptList () { // getDeptList () {
return this.$http.get('/sys/dept/list').then(({ data: res }) => { // return this.$http.get('/sys/dept/list').then(({ data: res }) => {
if (res.code !== 0) { // if (res.code !== 0) {
return this.$message.error(res.msg) // return this.$message.error(res.msg)
} // }
this.deptList = res.data // this.deptList = res.data
}).catch(() => {}) // }).catch(() => {})
}, // },
// //
getInfo () { getInfo () {
this.$http.get(`/sys/role/${this.dataForm.id}`).then(({ data: res }) => { this.$http.get(`/oper/access/operrole/${this.dataForm.id}`).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -113,7 +113,7 @@ export default {
...res.data ...res.data
} }
this.dataForm.menuIdList.forEach(item => this.$refs.menuListTree.setChecked(item, true)) this.dataForm.menuIdList.forEach(item => this.$refs.menuListTree.setChecked(item, true))
this.$refs.deptListTree.setCheckedKeys(this.dataForm.deptIdList) // this.$refs.deptListTree.setCheckedKeys(this.dataForm.deptIdList)
}).catch(() => {}) }).catch(() => {})
}, },
// //
@ -126,8 +126,8 @@ export default {
...this.$refs.menuListTree.getCheckedKeys(), ...this.$refs.menuListTree.getCheckedKeys(),
...this.$refs.menuListTree.getHalfCheckedKeys() ...this.$refs.menuListTree.getHalfCheckedKeys()
] ]
this.dataForm.deptIdList = this.$refs.deptListTree.getCheckedKeys() // this.dataForm.deptIdList = this.$refs.deptListTree.getCheckedKeys()
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/role', this.dataForm).then(({ data: res }) => { this.$http[!this.dataForm.id ? 'post' : 'put']('/oper/access/operrole', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

4
epmet-oper-web/src/views/modules/sys/role.vue

@ -56,9 +56,9 @@ export default {
data () { data () {
return { return {
mixinViewModuleOptions: { mixinViewModuleOptions: {
getDataListURL: '/sys/role/page', getDataListURL: '/oper/access/operrole/page',
getDataListIsPage: true, getDataListIsPage: true,
deleteURL: '/sys/role', deleteURL: '/oper/access/operrole',
deleteIsBatch: true deleteIsBatch: true
}, },
dataForm: { dataForm: {

12
epmet-oper-web/src/views/modules/sys/user-add-or-update.vue

@ -26,7 +26,7 @@
<el-form-item prop="email" :label="$t('user.email')"> <el-form-item prop="email" :label="$t('user.email')">
<el-input v-model="dataForm.email" :placeholder="$t('user.email')"></el-input> <el-input v-model="dataForm.email" :placeholder="$t('user.email')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="mobile" :label="$t('user.mobile')"> <el-form-item prop="phone" :label="$t('user.mobile')">
<el-input v-model="dataForm.phone" :placeholder="$t('user.mobile')"></el-input> <el-input v-model="dataForm.phone" :placeholder="$t('user.mobile')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="roleIdList" :label="$t('user.roleIdList')" class="role-list"> <el-form-item prop="roleIdList" :label="$t('user.roleIdList')" class="role-list">
@ -100,26 +100,20 @@ export default {
callback() callback()
} }
return { return {
username: [ realName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
], ],
deptName: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
],
password: [ password: [
{ validator: validatePassword, trigger: 'blur' } { validator: validatePassword, trigger: 'blur' }
], ],
confirmPassword: [ confirmPassword: [
{ validator: validateConfirmPassword, trigger: 'blur' } { validator: validateConfirmPassword, trigger: 'blur' }
], ],
realName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
email: [ email: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { required: true, message: this.$t('validate.required'), trigger: 'blur' },
{ validator: validateEmail, trigger: 'blur' } { validator: validateEmail, trigger: 'blur' }
], ],
mobile: [ phone: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { required: true, message: this.$t('validate.required'), trigger: 'blur' },
{ validator: validateMobile, trigger: 'blur' } { validator: validateMobile, trigger: 'blur' }
] ]

Loading…
Cancel
Save