增加分配按钮的功能
This commit is contained in:
@@ -143,6 +143,7 @@ const checkSystemConfig = (params)=>getAction("/systemConfig/checkIsNameExist",p
|
|||||||
const addUserBusiness = (params)=>postAction("/userBusiness/add",params);
|
const addUserBusiness = (params)=>postAction("/userBusiness/add",params);
|
||||||
const editUserBusiness = (params)=>putAction("/userBusiness/update",params);
|
const editUserBusiness = (params)=>putAction("/userBusiness/update",params);
|
||||||
const checkUserBusiness = (params)=>getAction("/userBusiness/checkIsValueExist",params);
|
const checkUserBusiness = (params)=>getAction("/userBusiness/checkIsValueExist",params);
|
||||||
|
const updateBtnStrByRoleId = (params)=>postAction("/userBusiness/updateBtnStr",params);
|
||||||
//计量单位
|
//计量单位
|
||||||
const addUnit = (params)=>postAction("/unit/add",params);
|
const addUnit = (params)=>postAction("/unit/add",params);
|
||||||
const editUnit = (params)=>putAction("/unit/update",params);
|
const editUnit = (params)=>putAction("/unit/update",params);
|
||||||
@@ -256,6 +257,7 @@ export {
|
|||||||
addUserBusiness,
|
addUserBusiness,
|
||||||
editUserBusiness,
|
editUserBusiness,
|
||||||
checkUserBusiness,
|
checkUserBusiness,
|
||||||
|
updateBtnStrByRoleId,
|
||||||
addUnit,
|
addUnit,
|
||||||
editUnit,
|
editUnit,
|
||||||
checkUnit,
|
checkUnit,
|
||||||
|
|||||||
@@ -530,4 +530,18 @@ export function getNowFormatDateTime() {
|
|||||||
+ " " + strHours + seperator2 + strMinutes
|
+ " " + strHours + seperator2 + strMinutes
|
||||||
+ seperator2 + strSeconds;
|
+ seperator2 + strSeconds;
|
||||||
return currentdate;
|
return currentdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JS中根据指定值删除数组中的元素
|
||||||
|
* @param arrylist
|
||||||
|
* @param val
|
||||||
|
*/
|
||||||
|
export function removeByVal(arrylist, val) {
|
||||||
|
for(var i = 0; i < arrylist .length; i++) {
|
||||||
|
if(arrylist [i] == val) {
|
||||||
|
arrylist .splice(i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<a @click="handleSetFunction(record)">分配功能</a>
|
<a @click="handleSetFunction(record)">分配功能</a>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
<a @click="handleSetPushBtn(record)">分配按钮</a>
|
<a @click="handleSetPushBtn(record.id)">分配按钮</a>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
<a @click="handleEdit(record)">编辑</a>
|
<a @click="handleEdit(record)">编辑</a>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
@@ -60,8 +60,11 @@
|
|||||||
<!-- table区域-end -->
|
<!-- table区域-end -->
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<role-modal ref="modalForm" @ok="modalFormOk"></role-modal>
|
<role-modal ref="modalForm" @ok="modalFormOk"></role-modal>
|
||||||
<role-function-modal ref="roleFunctionModal" @ok="modalFormOk"></role-function-modal>
|
<role-function-modal ref="roleFunctionModal" @ok="roleFunctionModalFormOk"></role-function-modal>
|
||||||
<role-push-btn-modal ref="rolePushBtnModal" @ok="modalFormOk"></role-push-btn-modal>
|
<role-push-btn-modal ref="rolePushBtnModal" @ok="modalFormOk"></role-push-btn-modal>
|
||||||
|
<a-modal v-model="roleFunctionModalVisible" title="操作提示" @ok="handleTipOk">
|
||||||
|
<p>分配功能已经操作成功!现在继续<b>分配按钮</b>吗?</p>
|
||||||
|
</a-modal>
|
||||||
</a-card>
|
</a-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -82,6 +85,8 @@
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
description: '角色管理页面',
|
description: '角色管理页面',
|
||||||
|
roleFunctionModalVisible: false,
|
||||||
|
currentRoleId: '',
|
||||||
// 查询条件
|
// 查询条件
|
||||||
queryParam: {name:'',},
|
queryParam: {name:'',},
|
||||||
// 表头
|
// 表头
|
||||||
@@ -133,13 +138,25 @@
|
|||||||
methods: {
|
methods: {
|
||||||
handleSetFunction(record) {
|
handleSetFunction(record) {
|
||||||
this.$refs.roleFunctionModal.edit(record);
|
this.$refs.roleFunctionModal.edit(record);
|
||||||
this.$refs.roleFunctionModal.title = "分配功能";
|
this.$refs.roleFunctionModal.title = "分配功能【分配之后请继续分配按钮】";
|
||||||
this.$refs.roleFunctionModal.disableSubmit = false;
|
this.$refs.roleFunctionModal.disableSubmit = false;
|
||||||
},
|
},
|
||||||
handleSetPushBtn(record) {
|
handleSetPushBtn(roleId) {
|
||||||
this.$refs.rolePushBtnModal.edit(record);
|
this.$refs.rolePushBtnModal.edit(roleId);
|
||||||
this.$refs.rolePushBtnModal.title = "分配按钮";
|
this.$refs.rolePushBtnModal.title = "分配按钮";
|
||||||
this.$refs.rolePushBtnModal.disableSubmit = false;
|
this.$refs.rolePushBtnModal.disableSubmit = false;
|
||||||
|
},
|
||||||
|
roleFunctionModalFormOk(id) {
|
||||||
|
//重载列表
|
||||||
|
this.loadData();
|
||||||
|
this.roleFunctionModalVisible = true;
|
||||||
|
this.currentRoleId = id
|
||||||
|
},
|
||||||
|
handleTipOk() {
|
||||||
|
if(this.currentRoleId) {
|
||||||
|
this.roleFunctionModalVisible = false;
|
||||||
|
this.handleSetPushBtn(this.currentRoleId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal
|
<a-modal
|
||||||
:title="title"
|
:title="title"
|
||||||
:width="800"
|
:width="width"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:confirmLoading="confirmLoading"
|
:confirmLoading="confirmLoading"
|
||||||
@ok="handleOk"
|
@ok="handleOk"
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
title:"操作",
|
title:"操作",
|
||||||
|
width: '800px',
|
||||||
visible: false,
|
visible: false,
|
||||||
model: {},
|
model: {},
|
||||||
roleId: 0,
|
roleId: 0,
|
||||||
@@ -111,7 +112,7 @@
|
|||||||
}
|
}
|
||||||
obj.then((res)=>{
|
obj.then((res)=>{
|
||||||
if(res.code === 200){
|
if(res.code === 200){
|
||||||
that.$emit('ok');
|
that.$emit('ok', this.roleId);
|
||||||
}else{
|
}else{
|
||||||
that.$message.warning(res.data.message);
|
that.$message.warning(res.data.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal
|
<a-modal
|
||||||
:title="title"
|
:title="title"
|
||||||
:width="800"
|
:width="width"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:confirmLoading="confirmLoading"
|
:confirmLoading="confirmLoading"
|
||||||
@ok="handleOk"
|
@ok="handleOk"
|
||||||
@@ -36,12 +36,12 @@
|
|||||||
:dataSource="dataSource"
|
:dataSource="dataSource"
|
||||||
:loading="loading">
|
:loading="loading">
|
||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<a-checkbox v-if="record.pushBtn.indexOf(1)>-1" value="1" :checked="checked" @change="onChange">编辑</a-checkbox>
|
<a-checkbox v-if="record.pushBtn.indexOf(1)>-1" value="1" :checked="record.btnStr?record.btnStr.indexOf(1)>-1:false" @change="onChange(record,'1')">编辑</a-checkbox>
|
||||||
<a-checkbox v-if="record.pushBtn.indexOf(2)>-1" value="2" :checked="checked" @change="onChange">审核反审核</a-checkbox>
|
<a-checkbox v-if="record.pushBtn.indexOf(2)>-1" value="2" :checked="record.btnStr?record.btnStr.indexOf(2)>-1:false" @change="onChange(record,'2')">审核反审核</a-checkbox>
|
||||||
<a-checkbox v-if="record.pushBtn.indexOf(3)>-1" value="3" :checked="checked" @change="onChange">导入导出</a-checkbox>
|
<a-checkbox v-if="record.pushBtn.indexOf(3)>-1" value="3" :checked="record.btnStr?record.btnStr.indexOf(3)>-1:false" @change="onChange(record,'3')">导入导出</a-checkbox>
|
||||||
<a-checkbox v-if="record.pushBtn.indexOf(4)>-1" value="4" :checked="checked" @change="onChange">启用禁用</a-checkbox>
|
<a-checkbox v-if="record.pushBtn.indexOf(4)>-1" value="4" :checked="record.btnStr?record.btnStr.indexOf(4)>-1:false" @change="onChange(record,'4')">启用禁用</a-checkbox>
|
||||||
<a-checkbox v-if="record.pushBtn.indexOf(5)>-1" value="5" :checked="checked" @change="onChange">打印</a-checkbox>
|
<a-checkbox v-if="record.pushBtn.indexOf(5)>-1" value="5" :checked="record.btnStr?record.btnStr.indexOf(5)>-1:false" @change="onChange(record,'5')">打印</a-checkbox>
|
||||||
<a-checkbox v-if="record.pushBtn.indexOf(6)>-1" value="6" :checked="checked" @change="onChange">作废</a-checkbox>
|
<a-checkbox v-if="record.pushBtn.indexOf(6)>-1" value="6" :checked="record.btnStr?record.btnStr.indexOf(6)>-1:false" @change="onChange(record,'6')">作废</a-checkbox>
|
||||||
</span>
|
</span>
|
||||||
</a-table>
|
</a-table>
|
||||||
</div>
|
</div>
|
||||||
@@ -52,13 +52,15 @@
|
|||||||
import pick from 'lodash.pick'
|
import pick from 'lodash.pick'
|
||||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||||
import { getAction } from '@/api/manage'
|
import { getAction } from '@/api/manage'
|
||||||
import {addRole,editRole,checkRole } from '@/api/api'
|
import { updateBtnStrByRoleId } from '@/api/api'
|
||||||
|
import { removeByVal } from "@/utils/util"
|
||||||
export default {
|
export default {
|
||||||
name: "RolePushBtnModal",
|
name: "RolePushBtnModal",
|
||||||
mixins:[JeecgListMixin],
|
mixins:[JeecgListMixin],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
title:"操作",
|
title:"操作",
|
||||||
|
width: '800px',
|
||||||
visible: false,
|
visible: false,
|
||||||
model: {},
|
model: {},
|
||||||
checked: false,
|
checked: false,
|
||||||
@@ -91,62 +93,67 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
url: {
|
url: {
|
||||||
list: "/function/findByIds",
|
list: "/function/findRoleFunctionsById"
|
||||||
getBasicData: "/userBusiness/getBasicData"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
edit (record) {
|
edit (roleId) {
|
||||||
this.form.resetFields();
|
this.form.resetFields();
|
||||||
this.model = Object.assign({}, record);
|
this.model.id = roleId
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
getAction(this.url.getBasicData, {Type: 'RoleFunctions', KeyId: record.id}).then((res) => {
|
if(roleId) {
|
||||||
if (res && res.code === 200) {
|
getAction(this.url.list, { roleId: roleId }).then((res) => {
|
||||||
let ubList = res.data.userBusinessList;
|
if (res.code === 200) {
|
||||||
let getValue = ubList[0].value;
|
this.dataSource = res.data.rows;
|
||||||
getValue = getValue.substring(1, getValue.length - 1);
|
this.ipagination.total = res.data.total;
|
||||||
if (getValue.indexOf("][")) {
|
|
||||||
let arr = getValue.split("][");
|
|
||||||
arr = arr.toString();
|
|
||||||
getAction(this.url.list, { functionsIds: arr }).then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.dataSource = res.data.rows;
|
|
||||||
this.ipagination.total = res.data.total;
|
|
||||||
}
|
|
||||||
if (res.code === 510) {
|
|
||||||
this.$message.warning(res.data)
|
|
||||||
}
|
|
||||||
this.loading = false;
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
else if (res.code === 400) {
|
||||||
})
|
this.dataSource = []
|
||||||
|
this.ipagination.total = 0
|
||||||
|
}
|
||||||
|
else if (res.code === 500) {
|
||||||
|
this.$message.warning(res.data)
|
||||||
|
}
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
close () {
|
close () {
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
},
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
handleOk () {
|
handleOk () {
|
||||||
const that = this;
|
const that = this;
|
||||||
// 触发表单验证
|
// 触发表单验证
|
||||||
this.form.validateFields((err, values) => {
|
this.form.validateFields((err, values) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
that.confirmLoading = true;
|
that.confirmLoading = true;
|
||||||
let formData = Object.assign(this.model, values);
|
let funArray = this.dataSource
|
||||||
let obj;
|
let bindArr = [];
|
||||||
if(!this.model.id){
|
let btnStr = ''
|
||||||
obj=addRole(formData);
|
for(let item of funArray){
|
||||||
}else{
|
if (item.btnStr !== undefined && item.btnStr !== "" && item.btnStr !== "null" && item.btnStr !== null) {
|
||||||
obj=editRole(formData);
|
let bindJSON = {};
|
||||||
|
bindJSON.funId = item.id;
|
||||||
|
bindJSON.btnStr = item.btnStr;
|
||||||
|
bindArr.push(bindJSON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (bindArr.length) {
|
||||||
|
btnStr = JSON.stringify(bindArr);
|
||||||
|
}
|
||||||
|
let obj=updateBtnStrByRoleId({roleId: this.model.id, btnStr: btnStr});
|
||||||
obj.then((res)=>{
|
obj.then((res)=>{
|
||||||
if(res.code === 200){
|
if(res.code === 200){
|
||||||
that.$emit('ok');
|
that.$emit('ok');
|
||||||
}else{
|
}else{
|
||||||
that.$message.warning(res.data.message);
|
that.$message.warning(res.data);
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
that.confirmLoading = false;
|
that.confirmLoading = false;
|
||||||
@@ -155,14 +162,43 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleCancel () {
|
|
||||||
this.close()
|
|
||||||
},
|
|
||||||
toggleChecked() {
|
toggleChecked() {
|
||||||
this.checked = !this.checked;
|
this.checked = !this.checked;
|
||||||
|
let funArray = this.dataSource
|
||||||
|
if(this.checked) {
|
||||||
|
for(let item of funArray){
|
||||||
|
item.btnStr = item.pushBtn
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(let item of funArray){
|
||||||
|
item.btnStr = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onChange(e) {
|
onChange(record,value) {
|
||||||
this.checked = e.target.checked;
|
let funArray = this.dataSource
|
||||||
|
for(let item of funArray){
|
||||||
|
if(item.id === record.id) {
|
||||||
|
let btnStr = record.btnStr
|
||||||
|
if(btnStr) {
|
||||||
|
let btnArr = btnStr.split(',')
|
||||||
|
if(btnStr.indexOf(value)>-1) {
|
||||||
|
//去掉勾选
|
||||||
|
removeByVal(btnArr, value)
|
||||||
|
item.btnStr = btnArr.join()
|
||||||
|
} else {
|
||||||
|
//勾选
|
||||||
|
btnArr.push(value)
|
||||||
|
item.btnStr = btnArr.join()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let btnArr = []
|
||||||
|
//勾选
|
||||||
|
btnArr.push(value)
|
||||||
|
item.btnStr = btnArr.join()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user