Commit a0bf6575 authored by shifangwuji's avatar shifangwuji

Merge branch 'project9-8' of http://gitlab.91isoft.com:90/yangshuo/template_vue into project9-8

parents be98795d 11ad24d1
import request from '@/utils/request'
// TODO: 用来进行工序库的出入库记录的 分页+时间+普通字段的查询
export function getlist(queryParams) {
return request({
url: '/ysgxpn/queryYsGxpns',
method: 'get',
params: queryParams,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}
/* TODO: 用来查询单项出入库记录的废弃详情信息 */
export function findSingleLogDetail(singleLogIdAndPn) {
return request({
url: '/wbchemistrylog/detail',
method: 'post',
data: singleLogIdAndPn,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}
/* TODO: 用来导出表单信息 */
export function exportInventoryRecord(params) {
return request({
url: '/wbchemistrylog/export',
method: 'get',
params,
responseType: 'blob'
})
}
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true"> <el-form
ref="queryForm"
<el-form-item label="生产工艺"> style="padding: 0 0 0 10px"
<el-select v-model="form.region" placeholder="请选择活动区域"> :model="queryParams"
<el-option label="工艺一" value="shanghai" /> :inline="true"
<el-option label="工艺二" value="beijing" /> >
</el-select> <el-form-item label="" prop="ptype">
</el-form-item>
<el-form-item label="单号" prop="">
<el-input
v-model="queryParams.number"
placeholder="请输入单号"
clearable
:maxlength="30"
size="small"
style="width: 225px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="操作员" prop="roleName">
<el-input <el-input
v-model="queryParams.createby" v-model="queryParams.ptype"
placeholder="请输入操作员" placeholder="请输入"
clearable clearable
:maxlength="30" :maxlength="30"
size="small" size="small"
...@@ -33,41 +18,15 @@ ...@@ -33,41 +18,15 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="操作时间">
<el-date-picker
v-model="form.date2"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQuery">查询</el-button>
</el-form-item>
<div style="float: right">
<el-form-item> <el-form-item>
<!-- <el-button--> <el-button
<!-- v-hasPermi="['sys:role:add']"--> type="primary"
<!-- type="primary"--> size="small"
<!-- size="small"--> icon="el-icon-search"
<!-- @click="handleAdd"--> @click="handleQuery"
<!-- >新增</el-button>--> >查询</el-button
>
<!-- <coolbutton style="padding: 8px 7px;" :type="typePrimary" :name="addName" :size="smallSize" :icon="addIcon" :haspermi="addHaspermi" @btn-click="handleAdd" /> -->
<!-- <el-button-->
<!-- v-hasPermi="['sys:role:export']"-->
<!-- style="padding: 8px 7px;"-->
<!-- type="success"-->
<!-- size="small"-->
<!-- icon="el-icon-download"-->
<!-- @click="handleExport"-->
<!-- >导出</el-button>-->
</el-form-item> </el-form-item>
</div>
</el-form> </el-form>
<!-- 这里是列表了,注意,这是分割线 --> <!-- 这里是列表了,注意,这是分割线 -->
<!-- 这里是列表了,注意,这是分割线 --> <!-- 这里是列表了,注意,这是分割线 -->
...@@ -75,688 +34,87 @@ ...@@ -75,688 +34,87 @@
<!-- 这里是列表了,注意,这是分割线 --> <!-- 这里是列表了,注意,这是分割线 -->
<!-- 这里是列表了,注意,这是分割线 --> <!-- 这里是列表了,注意,这是分割线 -->
<div class="placeholder" /> <div class="placeholder" />
<div style="padding:5px 10px"> <div style="padding: 5px 10px">
<div class="mb12 font-small-bold">生产数据列表</div> <div class="mb12 font-small-bold">工序对照列表</div>
<el-table v-loading="loading" border :data="simulateProcessList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
border
ref="multipleTable"
:data="simulateProcessList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="50px" />
<el-table-column type="index" label="序号" width="50" /> <el-table-column type="index" label="序号" width="50" />
<el-table-column label="工艺名称" prop="2222" :show-overflow-tooltip="true"> <el-table-column
<template slot-scope="scope"> label="工序"
{{ scope.row.name || '-' }} prop="ptype"
</template> :show-overflow-tooltip="true"
</el-table-column> >
<el-table-column label="单号" prop="2222" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.number || '-' }}
</template>
</el-table-column>
<el-table-column label="编码一" prop="xxx" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.code1 || '-' }}
</template>
</el-table-column>
<el-table-column label="编码二" prop="xxx" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.code2 || '-' }}
</template>
</el-table-column>
<el-table-column label="编码三" prop="xxx" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.code3 || '-' }}
</template>
</el-table-column>
<el-table-column label="编码四" prop="xxx" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.code4 || '-' }}
</template>
</el-table-column>
<el-table-column label="操作员" prop="xxx" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.createby || '-' }}
</template>
</el-table-column>
<!-- <el-table-column label="创建时间" prop="xxx" :show-overflow-tooltip="true" width="222">
<template slot-scope="scope">
{{ scope.row.xxx || '-' }}
</template>
</el-table-column> -->
<!-- <el-table-column label="状态" align="center" width="380">
<template slot-scope="scope">
<el-switch
v-model="scope.row.flag"
active-value="1"
inactive-value="0"
@change="handleStatusChange(scope.row)"
/>
</template>
</el-table-column> -->
<el-table-column label="创建时间" :show-overflow-tooltip="true" align="center" prop="createTime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.createTime | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span> {{ scope.row.ptype || '-' }}
</template> </template>
</el-table-column> </el-table-column>
</el-table> <el-table-column
</div> label="工序代码"
<pagination prop="pgx"
v-show="total>0" :show-overflow-tooltip="true"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改角色配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="名称" prop="roleName">
<el-input v-model.trim="form.roleName" show-word-limit :maxlength="30" placeholder="请输入角色名称" />
</el-form-item>
<el-form-item label="权限字符" prop="roleKey">
<el-input v-model.trim="form.roleKey" show-word-limit :maxlength="30" placeholder="请输入权限字符" />
</el-form-item>
<el-form-item label="排序" prop="roleSort">
<el-input-number v-model="form.roleSort" style="width: 100%" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="状态">
<!-- <el-radio-group v-model="form.flag">-->
<!-- <el-radio :label="1">启用</el-radio>-->
<!-- <el-radio :label="0">停用</el-radio>-->
<!-- </el-radio-group>-->
<el-radio v-model="form.flag" label="1">启用</el-radio>
<el-radio v-model="form.flag" label="0">停用</el-radio>
</el-form-item>
<el-form-item label="菜单权限">
<!-- <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>-->
<!-- <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>-->
<!-- <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox>-->
<el-tree
ref="menu"
class="tree-border"
:data="menuOptions"
show-checkbox
node-key="id"
check-strictly
empty-text="加载中,请稍后"
:props="defaultProps"
@check-change="handleMenuCheckChange"
/>
</el-form-item>
<el-form-item label="备注">
<el-input v-model.trim="form.remark" maxlength="200" show-word-limit type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
<!-- 分配角色数据权限对话框 -->
<el-dialog class="roleDialog" title="数据权限信息" :visible.sync="openDataScope" width="900px" append-to-body>
<el-row>
<el-col style="width: 49%">
<el-form ref="form" :model="form" :rules="rules" label-width="70px">
<el-form-item label="角色名称">
<el-input v-model.trim="form.roleName" placeholder="请输入角色名称" show-word-limit :maxlength="30" :disabled="true" />
</el-form-item>
<el-table
v-loading="loading"
:data="menuList"
row-key="businessId"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
max-height="400px"
> >
<!-- <el-form-item label="权限字符">-->
<!-- <el-input v-model.trim="form.roleKey" placeholder="请输入角色名称" show-word-limit :maxlength="30" :disabled="true" />-->
<!-- </el-form-item>-->
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button {{ scope.row.pgx || '-' }}
size="mini"
type="text"
icon="el-icon-circle-check"
@click="handleDataScope(scope.row)"
>修改</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form>
</el-col>
<el-col style="width: 1%">
<div class="dividerStyle">
<el-divider direction="vertical" />
</div> </div>
</el-col> <el-button style="float: right" type="primary" @click="onSubmit"
<el-col style="width: 49%"> >提交</el-button
<el-form :model="form" label-width="80px"> >
<el-form-item label="菜单名称" prop="roleName">
<el-input v-model="form.menuName" placeholder="未选择菜单名称" disabled />
</el-form-item>
<el-form-item label="权限范围">
<el-select v-model="form.dataScope">
<el-option
v-for="item in dataScopeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item v-show="form.dataScope === 2" label="数据权限">
<!-- <el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">展开/折叠</el-checkbox>-->
<!-- <el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">全选/全不选</el-checkbox>-->
<!-- <el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">父子联动</el-checkbox>-->
<el-tree
ref="dept"
class="tree-border"
:data="deptOptions"
show-checkbox
default-expand-all
node-key="id"
:check-strictly="!form.deptCheckStrictly"
empty-text="加载中,请稍后"
:props="defaultProps"
/>
</el-form-item>
</el-form>
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelDataScope">取 消</el-button>
<el-button type="primary" @click="submitDataScope">确 定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { import { getlist } from '@/api/production/gxpn'
addRole,
changeRoleStatus,
dataScope,
delRole,
exportRole,
getRole,
listRole,
updateRole
} from '@/api/system/role'
import {roleMenuTreeselect, roleMenuTreeselectMC, treeselect as menuTreeselect} from '@/api/system/menu'
import {roleDeptTreeselect, treeselect as deptTreeselect} from '@/api/system/dept'
// import { getRolesByInsId } from '../../../api/businessManage/template'
export default { export default {
name: 'Role', name: 'Role',
data() { data() {
return { return {
// TODO: 模拟测试数据 // TODO: 模拟测试数据
simulateProcessList: [ simulateProcessList: [],
{ name: '归真', number: 'A01', code1: 42, code2: 11, code3: 35, code4: 1, createby: '柯泽宇', createTime: new Date() },
{ name: '揉捻', number: 'A02', code1: 54, code2: 18, code3: 34, code4: 9, createby: '刘宇杨', createTime: new Date() },
{ name: '发酵', number: 'A03', code1: 14, code2: 85, code3: 28, code4: 8, createby: '吴志坤', createTime: new Date() },
{ name: '干燥', number: 'A04', code1: 74, code2: 43, code3: 29, code4: 6, createby: '陈嘉佑', createTime: new Date() },
{ name: '掌天', number: 'A05', code1: 79, code2: 17, code3: 85, code4: 2, createby: '王鼎义', createTime: new Date() },
{ name: '虚极', number: 'A06', code1: 53, code2: 25, code3: 86, code4: 3, createby: '李万洋', createTime: new Date() },
{ name: '造化', number: 'A07', code1: 15, code2: 36, code3: 18, code4: 7, createby: '赵叶蕾', createTime: new Date() },
{ name: '超凡', number: 'A08', code1: 35, code2: 34, code3: 96, code4: 2, createby: '田安琪', createTime: new Date() },
{ name: '入圣', number: 'A09', code1: 45, code2: 39, code3: 69, code4: 5, createby: '岑歆奕', createTime: new Date() },
{ name: '登峰', number: 'A10', code1: 17, code2: 37, code3: 37, code4: 4, createby: '礼堂丁真', createTime: new Date() }
],
typeParent: 'text',
typePrimary: 'primary',
typeSuccess: 'success',
nameParent: '删除',
resetName: '重置',
addName: '新增',
exportName: '导出',
updataName: '修改',
size: 'mini',
smallSize: 'small',
delicon: 'el-icon-delete',
addIcon: 'el-icon-plus',
exportIcon: 'el-icon-download',
resetIcon: '',
haspermi: ['sys:user:delete'],
resetHaspermi: ['sys:user:resetPwd'],
updateHaspermi: ['sys:role:update'],
addHaspermi: ['sys:role:add'],
exportHaspermi: ['sys:role:export'],
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
ids: [], multipleSelection: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// 角色表格数据
roleList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 是否显示弹出层(数据权限)
openDataScope: false,
// 日期范围
// dateRange: [],
// 菜单表格数据
menuList: [],
menuExpand: false,
menuNodeAll: false,
deptExpand: true,
deptNodeAll: false,
// 状态数据字典
statusOptions: [
{
dictLabel: '启用',
dictValue: '1'
},
{
dictLabel: '停用',
dictValue: '0'
}
],
// 数据范围选项
dataScopeOptions: [
{
value: '1',
label: '全部数据权限'
},
{
value: '2',
label: '自定数据权限'
},
{
value: '3',
label: '本部门数据权限'
},
{
value: '4',
label: '本部门及以下数据权限'
},
{
value: '5',
label: '仅本人数据权限'
}
],
// 菜单列表
menuOptions: [],
// 部门列表
tOptions: [],
// 查询参数
queryParams: { queryParams: {
pageNum: 1, pgx: undefined,
pageSize: 10, ptype: undefined
roleName: undefined,
roleKey: undefined,
flag: undefined
},
// 表单参数
form: {
region: 'shanghai'
},
defaultProps: {
children: 'children',
label: 'label'
},
// 表单校验
rules: {
roleName: [
{ required: true, message: '请输入角色名称', trigger: 'blur' }
],
roleKey: [
{ required: true, message: '请输入权限字符', trigger: 'blur' }
],
roleSort: [
{ required: true, message: '请输入角色排序', trigger: 'blur' }
]
},
deptOptions: []
} }
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
} }
})
next()
}, },
created() { created() {
if (this.$store.getters.searchParams[this.$route.path]) { this.getListToGx()
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getList()
// this.getDicts(dictCons['NORMAL_DISABLE']).then(response => {
// this.statusOptions = response.data;
// });
}, },
methods: { methods: {
/** 查询角色列表 */ /** 查询列表 */
getList() { getListToGx() {
this.loading = true this.loading = true
listRole(this.queryParams).then( getlist(this.queryParams).then(res => {
response => { console.log(res.data)
this.roleList = response.rows this.simulateProcessList = res.data
this.total = response.total
this.loading = false
}
)
},
/** 查询菜单树结构 */
getMenuTreeselect() {
menuTreeselect().then(response => {
this.menuOptions = response.data
})
},
/** 查询菜单列表 */
getMenuList(roleId) {
roleMenuTreeselectMC(roleId).then(response => {
this.menuList = this.handleTree(response.data.menus, 'businessId')
this.loading = false this.loading = false
}) })
}, },
/** 查询部门树结构 */ //提交按钮
getDeptTreeselect() { onSubmit() {
deptTreeselect().then(response => {
this.deptOptions = response.data
})
},
// 树状图节点点击选中事件
handleMenuCheckChange(data, check, subCheck) { // data为选中节点信息,check选中状态
if (data.children !== undefined && data.children !== null) { // 是否包含子节点
this.checkNode(data.children, check) // 调用checkNode方法
}
// // 获取所有被选中的节点信息
// const nodes = this.$refs.menu.getCheckedNodes(false, false)
// // 将获取到的信息赋值(根据自己的需求)
// this.custGroupDesc = nodes.map(item => item.CN_NAME)
// this.searchForm.custGroup = nodes.map(item => item.code)
},
// 选中所有下级节点
checkNode(data, check) {
// 遍历所有下级节点信息
data.forEach(item => {
// 通过节点信息设置选中状态
this.$refs.menu.setChecked(item, check, false)
// 是否包含下级节点,包含下级节点则选中所有下级节点
if (item.children !== undefined) {
this.checkNode(item.children, check)
}
})
},
// 所有菜单节点数据
getMenuAllCheckedKeys() {
// 目前被选中的菜单节点
const checkedKeys = this.$refs.menu.getHalfCheckedKeys()
// 半选中的菜单节点
const halfCheckedKeys = this.$refs.menu.getCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return checkedKeys
},
// 所有部门节点数据
getDeptAllCheckedKeys() {
// 目前被选中的部门节点
const checkedKeys = this.$refs.dept.getHalfCheckedKeys()
// // 半选中的部门节点
const halfCheckedKeys = this.$refs.dept.getCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return this.$refs.dept.getCheckedKeys()
},
/** 根据角色ID查询菜单树结构 */
getRoleMenuTreeselect(roleId) {
return roleMenuTreeselect(roleId).then(response => {
this.menuOptions = response.data.menus
return response
})
},
/** 根据角色ID和菜单ID查询部门树结构 */
getRoleDeptTreeselect(roleId, menuId) {
return roleDeptTreeselect(roleId, menuId).then(response => {
this.form.deptCheckStrictly = response.data.deptCheckStrictly
this.deptOptions = response.data.depts
this.form.dataScope = this.dataScopeOptions[response.data.dataScope - 1].value
return response
})
},
// 角色状态修改
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return changeRoleStatus(row.businessId, row.flag)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
row.flag = row.flag === '0' ? '1' : '0'
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 取消按钮(数据权限)
cancelDataScope() {
this.openDataScope = false
this.reset()
},
// 表单重置
reset() {
if (this.$refs.menu !== undefined) {
this.$refs.menu.setCheckedKeys([])
}
this.menuExpand = false
this.menuNodeAll = false
this.deptExpand = true
this.deptNodeAll = false
this.form = {
roleId: undefined,
businessId: undefined,
roleName: undefined,
roleKey: undefined,
roleSort: 0,
flag: '1',
menuIds: [],
menuName: undefined,
deptIds: [],
menuCheckStrictly: false,
deptCheckStrictly: false,
remark: undefined
}
this.resetForm('form')
}, },
/** 查询按钮操作 */ //查询
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 this.getListToGx()
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
// this.dateRange = []
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.roleId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
// // 树权限(父子联动)
// handleCheckedTreeConnect(value, type) {
// if (type === 'menu') {
// this.form.menuCheckStrictly = !!value
// } else if (type === 'dept') {
// this.form.deptCheckStrictly = !!value
// }
// },
// 树权限(全选/全不选)
handleCheckedTreeNodeAll(value, type) {
if (type === 'menu') {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions : [])
} else if (type === 'dept') {
this.$refs.dept.setCheckedNodes(value ? this.deptOptions : [])
}
},
// 树权限(展开/折叠)
handleCheckedTreeExpand(value, type) {
if (type === 'menu') {
const treeList = this.menuOptions
for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value
}
} else if (type === 'dept') {
const treeList = this.deptOptions
for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value
}
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.getMenuTreeselect()
this.open = true
this.title = '添加角色'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const roleId = row.businessId || this.ids
const roleMenu = this.getRoleMenuTreeselect(roleId)
getRole(roleId).then(response => {
this.form = response.data
this.open = true
this.getMenuTreeselect(roleId)
this.$nextTick(() => {
roleMenu.then(res => {
this.$refs.menu.setCheckedKeys(res.data.checkedKeys)
})
})
this.title = '修改角色'
})
},
/** 分配数据权限操作 选择菜单 */
handleMenu(row) {
this.reset()
const roleId = row.businessId || this.ids
this.getMenuList(roleId) // 查询菜单列表树形显示
getRole(roleId).then(response => {
this.form = response.data
this.openDataScope = true
this.title = '分配数据权限'
})
},
/** 分配数据权限操作 */
handleDataScope(row) {
this.deptOptions = []
this.form.dataScope = undefined
const roleId = this.form.businessId
this.form.menuId = row.businessId
this.form.menuName = row.menuName
const roleDeptTreeselect = this.getRoleDeptTreeselect(roleId, this.form.menuId)
this.$nextTick(() => {
roleDeptTreeselect.then(res => {
this.$refs.dept.setCheckedKeys(res.data.checkedKeys)
})
})
this.title = '分配数据权限'
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
this.form.menuCheckStrictly = false
if (this.form.businessId !== undefined) {
this.form.menuIds = this.getMenuAllCheckedKeys()
updateRole(this.form).then(response => {
this.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
this.form.menuIds = this.getMenuAllCheckedKeys()
addRole(this.form).then(response => {
this.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 提交按钮(数据权限) */
submitDataScope: function() {
if (this.form.businessId !== undefined && this.form.menuId !== undefined) {
this.form.deptIds = this.getDeptAllCheckedKeys()
dataScope(this.form).then(response => {
this.msgSuccess('修改成功')
this.openDataScope = false
this.getList()
})
} }
}, },
/** 删除按钮操作 */ handleSelectionChange(val) {
handleDelete(row) { this.multipleSelection = val
const roleIds = row.businessId || this.ids
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return delRole(roleIds)
}).then(() => {
this.getList()
this.$message({
message: '删除成功',
type: 'success'
})
}).catch(function() {
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return exportRole(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '角色信息' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg);
})
})
}
} }
} }
</script> </script>
...@@ -767,21 +125,21 @@ export default { ...@@ -767,21 +125,21 @@ export default {
.placeholder { .placeholder {
height: 1.3vh; height: 1.3vh;
background-color: #F4F4F4; background-color: #f4f4f4;
margin-bottom: 10px margin-bottom: 10px;
} }
.table-drop { .table-drop {
vertical-align: 2px; vertical-align: 2px;
line-height: 20px; line-height: 20px;
margin-left: 15px margin-left: 15px;
} }
.el-switch { .el-switch {
margin-left: 15px; margin-left: 15px;
} }
} }
.el-divider--vertical{ .el-divider--vertical {
height: 12em; height: 12em;
width: 4px; width: 4px;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment