Commit adf8ec91 authored by 张毅辰's avatar 张毅辰

编译通过修改

parent cfb43248
import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { DeptForm, DeptQuery, DeptVO } from "./types";
import Qs from "qs";
/**
* 部门树形表格
*
* @param queryParams
* 部门下拉列表
*/
export function listDepts(queryParams?: DeptQuery): AxiosPromise<DeptVO[]> {
export function getDeptOptions(): AxiosPromise<OptionType[]> {
return request({
url: "/api/v1/dept",
url: "/system/dept/treeSelect",
method: "get",
params: queryParams,
});
}
/**
* 部门下拉列表
*/
export function getDeptOptions(): AxiosPromise<OptionType[]> {
* 1.新增部门
* 2.删除部门
* 3.修改部门
* 4.修改部门状态
* 5.查询部门列表
* 6.查询部门列表(排除节点)
* 7.查询部门详细
* -----------------
* 10.查询部门下拉树结构
* 11.查询子部门
* 12.根据角色ID查询部门树结构
* 13.查询无部门人员
* 14.根据查询内容查询用户
* 15.查询该部门下的所有用户
* 16.转部门
* */
// 1.新增部门
export function addDept(data: any) {
data = Qs.stringify(data);
return request({
url: '/system/dept/treeSelect',
url: "/system/dept/add",
method: "post",
data,
headers: {},
});
}
// 2.删除部门
export function delDept(deptId: any) {
return request({
url: "/system/dept/deleteLogical/" + deptId,
method: "delete",
});
}
// 3.修改部门
export function updateDept(data: any) {
const businessId = data.businessId;
data = Qs.stringify(data);
return request({
url: "/system/dept/update/" + businessId,
method: "put",
data,
headers: {},
});
}
// 4.修改部门状态
export function statusChange(data: any) {
const businessId = data.businessId;
data = Qs.stringify(data);
return request({
url: "/system/dept/statusChange/" + businessId,
method: "put",
data,
headers: {},
});
}
// 5.查询部门列表
export function listDept(query: any) {
return request({
url: "/system/dept/list",
method: "get",
params: query,
});
}
/**
* 获取部门详情
*
* @param id
*/
export function getDeptForm(id: number): AxiosPromise<DeptForm> {
// 6.查询部门列表(排除节点)
export function listDeptExcludeChild(deptId: any) {
return request({
url: "/api/v1/dept/" + id + "/form",
url: "/system/dept/list/exclude/" + deptId,
method: "get",
});
}
/**
* 新增部门
*
* @param data
*/
export function addDept(data: DeptForm) {
// 7.查询部门详细
export function getDept(deptId: any) {
return request({
url: "/api/v1/dept",
method: "post",
data: data,
url: "/system/dept/detail/" + deptId,
method: "get",
});
}
/**
* 修改部门
*
* @param id
* @param data
*/
export function updateDept(id: number, data: DeptForm) {
// 10.查询部门下拉树结构
export function treeSelect() {
return request({
url: "/api/v1/dept/" + id,
method: "put",
data: data,
url: "/system/dept/treeSelect",
method: "get",
});
}
/**
* 删除部门
*
* @param ids
*/
export function deleteDept(ids: string) {
// 11.查询子部门
export function getChildrenDept(userId: any) {
return request({
url: "/api/v1/dept/" + ids,
method: "delete",
url: "/system/dept/getChildren/" + userId,
method: "get",
});
}
// 12.根据角色ID查询部门树结构
export function roleDeptTreeSelect(roleId: any, menuId: any) {
return request({
url: "/system/dept/roleDeptTreeSelect/" + roleId + "/" + menuId,
method: "get",
});
}
// 13.查询无部门人员
export function queryUserWithoutDept(params: any) {
return request({
url: "/system/dept/getAllUserWithoutDept",
method: "get",
params,
});
}
// 14.根据查询内容查询用户
export function queryUserByName(params: any) {
return request({
url: "/system/user/getListWithDept",
method: "get",
params,
});
}
// 15.查询该部门下的所有用户
export function queryUserByDeptId(id: any, params: any) {
return request({
url: "/system/dept/getAllUserByDeptId/" + id,
method: "get",
params,
});
}
// 16.转部门
export function transformDept(data: any) {
return request({
url: "/system/dept/update/{businessId}",
method: "put",
data,
});
}
......@@ -2,8 +2,8 @@
* 部门查询参数
*/
export interface DeptQuery {
keywords?: string;
status?: number;
deptName?: string;
flag?: string;
}
/**
......@@ -51,21 +51,33 @@ export interface DeptForm {
/**
* 部门ID(新增不填)
*/
id?: number;
businessId?: number | undefined;
/**
* 部门名称
*/
name?: string;
deptName?: string;
/**
* 父部门ID
*/
parentId: number;
parentId: number | undefined;
/**
* 排序
*/
sort?: number;
orderNum?: number;
/**
* 负责人
*/
leader?: string;
/**
* 手机号
*/
phone?: string;
/**
* 邮箱
*/
email?: string;
/**
* 状态(1:启用;0:禁用)
*/
status?: number;
flag?: string;
}
......@@ -32,7 +32,7 @@ export function getRoleOptions(
}
/** 角色数据权限*/
export function dataScope(data) {
export function dataScope(data: any) {
return request({
url: "/system/role/dataScope",
method: "put",
......
// export default {
import { useSearchParamsStore } from "@/store/modules/searchParams";
const searchParamsObj = useSearchParamsStore();
// 路由离开前存储筛选条件
export function setDataCache(path, param) {
// store.dispatch('searchSave/searchParamsSet', {
// path: path,
// param: {
// ...param
// }
// }).then(r => {} )
// console.log('store.getters.searchParams', store.getters.searchParams)
}
// 获取缓存的筛选条件 分页参数需统一,如需自定义分页参数,在列表页自行修改
export function getDataCache(routerPath) {
if (searchParamsObj.searchParams[routerPath]) {
const { searchParams } = searchParamsObj;
const path = routerPath;
const param = searchParams[path]; // 保留着的查询条件
if (param) {
return param;
}
else {
const paramNew = '{"page":1,"rows":10}';
return paramNew;
}
}
else {
const paramNew = '{"page":1,"rows":10}';
return paramNew;
}
}
// }
//# sourceMappingURL=filterData.js.map
\ No newline at end of file
// export default {
import { useSearchParamsStore } from "@/store/modules/searchParams";
const searchParamsObj = useSearchParamsStore()
// 路由离开前存储筛选条件
export function setDataCache(path: any, param: any) {
// store.dispatch('searchSave/searchParamsSet', {
// path: path,
// param: {
// ...param
// }
// }).then(r => {} )
// console.log('store.getters.searchParams', store.getters.searchParams)
}
// 获取缓存的筛选条件 分页参数需统一,如需自定义分页参数,在列表页自行修改
export function getDataCache(routerPath: any) {
if (searchParamsObj.searchParams[routerPath]) {
const { searchParams } = searchParamsObj;
const path = routerPath
const param = searchParams[path] // 保留着的查询条件
if (param){
return param
} else {
const paramNew = '{"page":1,"rows":10}'
return paramNew
}
} else {
const paramNew = '{"page":1,"rows":10}'
return paramNew
}
}
// }
<template>
<el-button
v-if="isShow"
:size="size"
:type="type"
:class="className"
:icon="icon"
:disabled="disabled"
@click="defaultClick"
>{{ name }}</el-button>
<el-button
v-else
v-hasPermi="hasper"
:size="size"
:type="type"
:class="className"
:icon="icon"
:disabled="disabled"
@click="defaultClick"
>{{ name }}</el-button>
</template>
<script>
// import { getInfo } from '@/api/login'
import store from '../../store/index'
export default {
name: 'CoolButton',
props: {// 调用该组件时需要传递过来的属性
name: {
type: String
},
className: {
type: String
},
type: {
type: String
},
haspermi: {
type: Array
},
size: {
type: String
},
icon: {
type: String
},
disabled: {
type: Boolean
}
},
data() {
return {
isShow: true,
hasper: '',
butname: this.name
}
},
computed: {},
created() {
this.getInfoMessage()
},
methods: {
defaultClick() {
this.$emit('btn-click')
},
getInfoMessage() {
const data = this.haspermi
// getInfo().then(res => {
// if (res.data.permissions[0] === '*:*:*') {
// this.isShow = true
// this.hasper = []
// } else {
// this.isShow = false
// this.hasper = data
// }
// })
if (store.getters.permissions[0] === '*:*:*') {
this.isShow = true
this.hasper = []
} else {
this.isShow = false
this.hasper = data
}
}
}
}
</script>
<style scoped>
/*按钮样式*/
input{
border: none;
padding: 2px 10px;
border-radius: 6px;
margin: 2px 6px;
color:#fff
}
/*不同属性按钮颜色不同*/
.primary{background-color: #409eff}
.danger{background-color: #f56c6c}
.success{background-color: #67c23a}
.warning{background-color: #e6a23c}
</style>
......@@ -3,7 +3,7 @@ import App from "./App.vue";
import router from "@/router";
import { setupStore } from "@/store";
import { setupDirective } from "@/directive";
import moment from "moment";
import "@/permission";
// 本地SVG图标
......@@ -23,3 +23,13 @@ setupDirective(app);
setupStore(app);
app.use(router).use(i18n).mount("#app");
app.config.globalProperties.transformDateByFormat = function (
value: any,
format: any
) {
if (!value || value === "") {
return "-";
}
return moment(value).format(format || "YYYY-MM-DD HH:mm:ss");
};
import { defineStore } from "pinia";
export const useSearchParamsStore = defineStore("searchParams", () => {
const searchParams = ref<object>({});
return {
searchParams,
};
});
......@@ -3,15 +3,21 @@
* @param {*} data 数据源
* @param {*} id id字段 默认 'id'
*/
export function handleTree(data, id, parentId, children, rootId) {
export function handleTree(
data: any,
id: any,
parentId: any,
children: any,
rootId: any
) {
id = id || "id";
parentId = parentId || "parentId";
children = children || "children";
const number = Math.random();
rootId =
rootId ||
Math.min(
Math,
...data.map((item) => {
number,
...data.map((item: any) => {
return item[parentId];
})
) ||
......
This diff is collapsed.
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