代码更新
This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
package org.nl.wms.basedata.st.rest;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.modules.logging.annotation.Log;
|
||||||
|
import org.nl.wms.basedata.st.service.UserStorService;
|
||||||
|
import org.nl.wms.st.instor.service.ChangeService;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "用户仓库关联")
|
||||||
|
@RequestMapping("/api/userStor")
|
||||||
|
@Slf4j
|
||||||
|
public class UserStorController {
|
||||||
|
private final UserStorService userStorService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询用户信息")
|
||||||
|
@ApiOperation("查询用户信息")
|
||||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||||
|
return new ResponseEntity<>(userStorService.pageQuery(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/queryStor")
|
||||||
|
@Log("查询所有仓库")
|
||||||
|
@ApiOperation("查询所有仓库")
|
||||||
|
public ResponseEntity<Object> queryStor(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(userStorService.queryStor(whereJson),HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/queryUserStor")
|
||||||
|
@Log("查询用户对应仓库")
|
||||||
|
@ApiOperation("查询用户对应仓库")
|
||||||
|
public ResponseEntity<Object> queryUserStor(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(userStorService.queryUserStor(whereJson),HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/save")
|
||||||
|
@Log("保存用户仓库信息")
|
||||||
|
@ApiOperation("保存用户仓库信息")
|
||||||
|
public ResponseEntity<Object> save(@RequestBody JSONObject whereJson) {
|
||||||
|
userStorService.save(whereJson);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package org.nl.wms.basedata.st.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface UserStorService {
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> pageQuery(Map whereJson, Pageable page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有仓库
|
||||||
|
* @param whereJson /
|
||||||
|
*/
|
||||||
|
JSONArray queryStor(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户对应仓库
|
||||||
|
* @param whereJson /
|
||||||
|
*/
|
||||||
|
JSONArray queryUserStor(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
* @param whereJson /
|
||||||
|
*/
|
||||||
|
JSONArray save(JSONObject whereJson);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package org.nl.wms.basedata.st.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
|
import org.nl.modules.wql.WQL;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.modules.wql.util.WqlUtil;
|
||||||
|
import org.nl.wms.basedata.st.service.UserStorService;
|
||||||
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.nl.wms.st.inbill.service.StorPublicService;
|
||||||
|
import org.nl.wms.st.instor.service.ChangeService;
|
||||||
|
import org.nl.wms.st.instor.task.HandMoveStorAcsTask;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PC端出入库新增
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class UserStorServiceImpl implements UserStorService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||||
|
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||||
|
map.put("flag", "3");
|
||||||
|
if (StrUtil.isNotEmpty(map.get("blurry"))) {
|
||||||
|
map.put("blurry", "%" + map.get("blurry") + "%");
|
||||||
|
}
|
||||||
|
JSONObject jo = WQL.getWO("QST_STOR_ATTR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "username desc");
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray queryStor(JSONObject whereJson) {
|
||||||
|
JSONArray rows = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_used = '1' AND is_delete = '0'").getResultJSONArray(0);
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray queryUserStor(JSONObject whereJson) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray save(JSONObject whereJson) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
输入.is_productstore TYPEAS s_string
|
输入.is_productstore TYPEAS s_string
|
||||||
输入.is_attachment TYPEAS s_string
|
输入.is_attachment TYPEAS s_string
|
||||||
输入.is_reversed TYPEAS s_string
|
输入.is_reversed TYPEAS s_string
|
||||||
|
输入.blurry TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
[临时表]
|
[临时表]
|
||||||
@@ -100,5 +101,24 @@
|
|||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "3"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
sys_user
|
||||||
|
WHERE
|
||||||
|
enabled = '1'
|
||||||
|
OPTION 输入.blurry <> ""
|
||||||
|
(
|
||||||
|
username like 输入.blurry
|
||||||
|
OR
|
||||||
|
nick_name like 输入.blurry
|
||||||
|
)
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
434
lms/nladmin-ui/src/views/wms/basedata/st/userStor/index.vue
Normal file
434
lms/nladmin-ui/src/views/wms/basedata/st/userStor/index.vue
Normal file
@@ -0,0 +1,434 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<div v-if="crud.props.searchToggle">
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-input
|
||||||
|
v-model="query.blurry"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="输入名称或者描述搜索"
|
||||||
|
style="width: 200px;"
|
||||||
|
class="filter-item"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
<rrOperation />
|
||||||
|
</div>
|
||||||
|
<crudOperation :permission="permission" />
|
||||||
|
</div>
|
||||||
|
<!-- 表单渲染 -->
|
||||||
|
<el-dialog
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:before-close="crud.cancelCU"
|
||||||
|
:visible.sync="crud.status.cu > 0"
|
||||||
|
:title="crud.status.title"
|
||||||
|
width="520px"
|
||||||
|
>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||||
|
<el-form-item label="角色名称" prop="name">
|
||||||
|
<el-input v-model="form.name" style="width: 380px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="角色级别" prop="level">
|
||||||
|
<el-input-number v-model.number="form.level" :min="1" controls-position="right" style="width: 145px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据范围" prop="dataScope">
|
||||||
|
<el-select v-model="form.dataScope" style="width: 140px" placeholder="请选择数据范围" @change="changeScope">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dateScopes"
|
||||||
|
:key="item"
|
||||||
|
:label="item"
|
||||||
|
:value="item"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="form.dataScope === '自定义'" label="数据权限" prop="depts">
|
||||||
|
<treeselect
|
||||||
|
v-model="deptDatas"
|
||||||
|
:load-options="loadDepts"
|
||||||
|
:options="depts"
|
||||||
|
multiple
|
||||||
|
style="width: 380px"
|
||||||
|
placeholder="请选择"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述信息" prop="description">
|
||||||
|
<el-input v-model="form.description" style="width: 380px;" rows="5" type="textarea" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
|
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<!--角色管理-->
|
||||||
|
<el-col :xs="24" :sm="24" :md="16" :lg="16" :xl="17" style="margin-bottom: 10px">
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">角色列表</span>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
highlight-current-row
|
||||||
|
style="width: 100%;"
|
||||||
|
:data="crud.data"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
>
|
||||||
|
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
||||||
|
<el-table-column prop="name" label="名称" min-width="100" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="dataScope" label="数据权限" />
|
||||||
|
<el-table-column prop="level" label="角色级别" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="description" label="描述" />
|
||||||
|
<el-table-column show-overflow-tooltip width="135px" prop="createTime" label="创建日期">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
v-permission="['admin','roles:edit','roles:del']"
|
||||||
|
label="操作"
|
||||||
|
width="130px"
|
||||||
|
align="center"
|
||||||
|
fixed="right"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
v-if="scope.row.level >= level"
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<!-- 菜单授权 -->
|
||||||
|
<el-col :xs="24" :sm="24" :md="8" :lg="8" :xl="7">
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<el-tooltip class="item" effect="dark" content="选择指定角色分配菜单" placement="top">
|
||||||
|
<span class="role-span">菜单分配</span>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-button
|
||||||
|
v-permission="['admin','roles:edit']"
|
||||||
|
:disabled="!showButton"
|
||||||
|
:loading="menuLoading"
|
||||||
|
icon="el-icon-check"
|
||||||
|
size="mini"
|
||||||
|
style="float: right; padding: 6px 9px"
|
||||||
|
type="primary"
|
||||||
|
@click="saveMenu"
|
||||||
|
>保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
ref="multipleTable"
|
||||||
|
:data="tableData"
|
||||||
|
tooltip-effect="dark"
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange">
|
||||||
|
<el-table-column
|
||||||
|
type="selection"
|
||||||
|
width="55">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="日期"
|
||||||
|
width="120">
|
||||||
|
<template slot-scope="scope">{{ scope.row.date }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="name"
|
||||||
|
label="姓名"
|
||||||
|
width="120">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="address"
|
||||||
|
label="地址"
|
||||||
|
show-overflow-tooltip>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
|
||||||
|
import { getDepts, getDeptSuperior } from '@/api/system/dept'
|
||||||
|
import { getChild, getMenusTree } from '@/api/system/menu'
|
||||||
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||||
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
import DateRangePicker from '@/components/DateRangePicker/index'
|
||||||
|
|
||||||
|
const defaultForm = { id: null, name: null, depts: [], description: null, dataScope: '全部', level: 3 }
|
||||||
|
export default {
|
||||||
|
name: 'UserStor',
|
||||||
|
components: { Treeselect, pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
|
||||||
|
cruds() {
|
||||||
|
return CRUD({ title: '角色', url: 'api/userStor', crudMethod: { ...crudUserStor }})
|
||||||
|
},
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
defaultProps: { children: 'children', label: 'label', isLeaf: 'leaf' },
|
||||||
|
dateScopes: ['全部', '本级', '自定义'], level: 3,
|
||||||
|
currentId: 0, menuLoading: false, showButton: false,
|
||||||
|
menus: [], menuIds: [], depts: [], deptDatas: [], // 多选时使用
|
||||||
|
tableData: [{
|
||||||
|
date: '2016-05-03',
|
||||||
|
name: '王小虎',
|
||||||
|
address: '上海市普陀区金沙江路 1518 弄'
|
||||||
|
}, {
|
||||||
|
date: '2016-05-02',
|
||||||
|
name: '王小虎',
|
||||||
|
address: '上海市普陀区金沙江路 1518 弄'
|
||||||
|
}, {
|
||||||
|
date: '2016-05-04',
|
||||||
|
name: '王小虎',
|
||||||
|
address: '上海市普陀区金沙江路 1518 弄'
|
||||||
|
}, {
|
||||||
|
date: '2016-05-01',
|
||||||
|
name: '王小虎',
|
||||||
|
address: '上海市普陀区金沙江路 1518 弄'
|
||||||
|
}, {
|
||||||
|
date: '2016-05-08',
|
||||||
|
name: '王小虎',
|
||||||
|
address: '上海市普陀区金沙江路 1518 弄'
|
||||||
|
}, {
|
||||||
|
date: '2016-05-06',
|
||||||
|
name: '王小虎',
|
||||||
|
address: '上海市普陀区金沙江路 1518 弄'
|
||||||
|
}, {
|
||||||
|
date: '2016-05-07',
|
||||||
|
name: '王小虎',
|
||||||
|
address: '上海市普陀区金沙江路 1518 弄'
|
||||||
|
}],
|
||||||
|
permission: {
|
||||||
|
add: ['admin', 'roles:add'],
|
||||||
|
edit: ['admin', 'roles:edit'],
|
||||||
|
del: ['admin', 'roles:del']
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入名称', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
permission: [
|
||||||
|
{ required: true, message: '请输入权限', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
crudRoles.getLevel().then(data => {
|
||||||
|
this.level = data.level
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getMenuDatas(node, resolve) {
|
||||||
|
setTimeout(() => {
|
||||||
|
getMenusTree(node.data.id ? node.data.id : 0).then(res => {
|
||||||
|
resolve(res)
|
||||||
|
})
|
||||||
|
}, 100)
|
||||||
|
},
|
||||||
|
[CRUD.HOOK.afterRefresh]() {
|
||||||
|
this.$refs.menu.setCheckedKeys([])
|
||||||
|
},
|
||||||
|
// 新增前初始化部门信息
|
||||||
|
[CRUD.HOOK.beforeToAdd]() {
|
||||||
|
this.deptDatas = []
|
||||||
|
},
|
||||||
|
// 编辑前初始化自定义数据权限的部门信息
|
||||||
|
[CRUD.HOOK.beforeToEdit](crud, form) {
|
||||||
|
this.deptDatas = []
|
||||||
|
if (form.dataScope === '自定义') {
|
||||||
|
this.getSupDepts(form.depts)
|
||||||
|
}
|
||||||
|
const _this = this
|
||||||
|
form.depts.forEach(function(dept) {
|
||||||
|
_this.deptDatas.push(dept.id)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 提交前做的操作
|
||||||
|
[CRUD.HOOK.afterValidateCU](crud) {
|
||||||
|
if (crud.form.dataScope === '自定义' && this.deptDatas.length === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '自定义数据权限不能为空',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
} else if (crud.form.dataScope === '自定义') {
|
||||||
|
const depts = []
|
||||||
|
this.deptDatas.forEach(function(data) {
|
||||||
|
const dept = { id: data }
|
||||||
|
depts.push(dept)
|
||||||
|
})
|
||||||
|
crud.form.depts = depts
|
||||||
|
} else {
|
||||||
|
crud.form.depts = []
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
// 触发单选
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
if (val) {
|
||||||
|
const _this = this
|
||||||
|
// 清空菜单的选中
|
||||||
|
this.$refs.menu.setCheckedKeys([])
|
||||||
|
// 保存当前的角色id
|
||||||
|
this.currentId = val.id
|
||||||
|
// 初始化默认选中的key
|
||||||
|
this.menuIds = []
|
||||||
|
val.menus.forEach(function(data) {
|
||||||
|
_this.menuIds.push(data.id)
|
||||||
|
})
|
||||||
|
this.showButton = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
menuChange(menu) {
|
||||||
|
// 获取该节点的所有子节点,id 包含自身
|
||||||
|
getChild(menu.id).then(childIds => {
|
||||||
|
// 判断是否在 menuIds 中,如果存在则删除,否则添加
|
||||||
|
if (this.menuIds.indexOf(menu.id) !== -1) {
|
||||||
|
for (let i = 0; i < childIds.length; i++) {
|
||||||
|
const index = this.menuIds.indexOf(childIds[i])
|
||||||
|
if (index !== -1) {
|
||||||
|
this.menuIds.splice(index, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < childIds.length; i++) {
|
||||||
|
const index = this.menuIds.indexOf(childIds[i])
|
||||||
|
if (index === -1) {
|
||||||
|
this.menuIds.push(childIds[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$refs.menu.setCheckedKeys(this.menuIds)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 保存菜单
|
||||||
|
saveMenu() {
|
||||||
|
this.menuLoading = true
|
||||||
|
const role = { id: this.currentId, menus: [] }
|
||||||
|
// 得到已选中的 key 值
|
||||||
|
this.menuIds.forEach(function(id) {
|
||||||
|
const menu = { id: id }
|
||||||
|
role.menus.push(menu)
|
||||||
|
})
|
||||||
|
crudRoles.editMenu(role).then(() => {
|
||||||
|
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.menuLoading = false
|
||||||
|
this.update()
|
||||||
|
}).catch(err => {
|
||||||
|
this.menuLoading = false
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 改变数据
|
||||||
|
update() {
|
||||||
|
// 无刷新更新 表格数据
|
||||||
|
crudRoles.get(this.currentId).then(res => {
|
||||||
|
for (let i = 0; i < this.crud.data.length; i++) {
|
||||||
|
if (res.id === this.crud.data[i].id) {
|
||||||
|
this.crud.data[i] = res
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取部门数据
|
||||||
|
getDepts() {
|
||||||
|
getDepts({ enabled: true }).then(res => {
|
||||||
|
this.depts = res.content.map(function(obj) {
|
||||||
|
if (obj.hasChildren) {
|
||||||
|
obj.children = null
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getSupDepts(depts) {
|
||||||
|
const ids = []
|
||||||
|
depts.forEach(dept => {
|
||||||
|
ids.push(dept.id)
|
||||||
|
})
|
||||||
|
getDeptSuperior(ids).then(res => {
|
||||||
|
const date = res.content
|
||||||
|
this.buildDepts(date)
|
||||||
|
this.depts = date
|
||||||
|
})
|
||||||
|
},
|
||||||
|
buildDepts(depts) {
|
||||||
|
depts.forEach(data => {
|
||||||
|
if (data.children) {
|
||||||
|
this.buildDepts(data.children)
|
||||||
|
}
|
||||||
|
if (data.hasChildren && !data.children) {
|
||||||
|
data.children = null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取弹窗内部门数据
|
||||||
|
loadDepts({ action, parentNode, callback }) {
|
||||||
|
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||||
|
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
|
||||||
|
parentNode.children = res.content.map(function(obj) {
|
||||||
|
if (obj.hasChildren) {
|
||||||
|
obj.children = null
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
callback()
|
||||||
|
}, 200)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 如果数据权限为自定义则获取部门数据
|
||||||
|
changeScope() {
|
||||||
|
if (this.form.dataScope === '自定义') {
|
||||||
|
this.getDepts()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
checkboxT(row) {
|
||||||
|
return row.level >= this.level
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style rel="stylesheet/scss" lang="scss">
|
||||||
|
.role-span {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #303133;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
::v-deep .el-input-number .el-input__inner {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .vue-treeselect__multi-value {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .vue-treeselect__multi-value-item {
|
||||||
|
border: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function queryStor(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/userStor/queryStor',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function queryUserStor(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/userStor/queryUserStor',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function save(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/userStor/save',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { queryUserStor, queryStor, save }
|
||||||
Reference in New Issue
Block a user