初始化

This commit is contained in:
Teo
2025-08-28 20:15:59 +08:00
parent b000788785
commit 5cfebd652f
49 changed files with 5345 additions and 92 deletions

View File

@ -5,7 +5,7 @@ VITE_APP_TITLE = RuoYi-Vue-Plus多租户管理系统
VITE_APP_ENV = 'development' VITE_APP_ENV = 'development'
# 开发环境 # 开发环境
VITE_APP_BASE_API = '/dev-api' VITE_APP_BASE_API = 'http://192.168.110.209:8899'
# 应用访问路径 例如使用前缀 /admin/ # 应用访问路径 例如使用前缀 /admin/
VITE_APP_CONTEXT_PATH = '/' VITE_APP_CONTEXT_PATH = '/'

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios'; import { AxiosPromise } from 'axios';
import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types'; import { LoginData, LoginResult, TenantInfo, UserProject, VerifyCodeResult } from './types';
import { UserInfo } from '@/api/system/user/types'; import { UserInfo } from '@/api/system/user/types';
// pc端固定客户端授权id // pc端固定客户端授权id
@ -111,3 +111,11 @@ export function getTenantList(isToken: boolean): AxiosPromise<TenantInfo> {
method: 'get' method: 'get'
}); });
} }
//获取用户项目信息
export function getUserProject(): AxiosPromise<UserProject[]> {
return request({
url: '/project/projectRelevancy/login/list',
method: 'get'
});
}

View File

@ -3,9 +3,9 @@ import { AxiosPromise } from 'axios';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
// 获取路由 // 获取路由
export function getRouters(): AxiosPromise<RouteRecordRaw[]> { export function getRouters(id: string): AxiosPromise<RouteRecordRaw[]> {
return request({ return request({
url: '/system/menu/getRouters', url: '/system/menu/getRouters/' + id,
method: 'get' method: 'get'
}); });
} }

View File

@ -0,0 +1,63 @@
const grid = {
left: 100,
right: 100,
top: 30,
bottom: 50
};
const color = ['#4FD6A9', '#409EFF', '#ECF5FF', '#FFC069'];
const titleList = [
{ name: '全勤人数', color: '#fff' },
{ name: '半勤人数', color: '#fff' },
{ name: '缺勤人数', color: '#000' },
{ name: '请假人数', color: '#000' }
];
// export const echartsConfig = (ref: any, list?: any) => {
// const commandstatsIntance = echarts.init(ref, 'macarons');
// };
export const option = (list?: any) => {
const attendanceArray = list.map((item) => item.attendance);
const halfAttendanceArray = list.map((item) => item.halfAttendance);
const absenteeismArray = list.map((item) => item.absenteeism);
const leaveArray = list.map((item) => item.leave);
const rawData = [attendanceArray, halfAttendanceArray, absenteeismArray, leaveArray];
const series: any = titleList.map((item, sid) => {
return {
name: item.name,
type: 'bar',
stack: 'total',
barWidth: '25',
label: {
show: true,
color: item.color,
fontSize: 10,
formatter: function (params) {
return params.value > 0 ? params.value : '';
}
},
data: rawData[sid]
};
});
const data = list.map((item) => item.clockDate);
const option = {
legend: {
selectedMode: false,
right: 0
},
grid,
yAxis: {
type: 'value',
show: false
},
xAxis: {
type: 'category',
data
},
series,
color
};
return option;
};

View File

@ -0,0 +1,99 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
AttendanceVO,
AttendanceForm,
AttendanceQuery,
AttendanceTwoWeekQuery,
AttendanceTwoWeekVO,
AttendanceMonthVO,
AttendanceMonthQuery
} from '@/api/project/attendance/types';
/**
* 查询考勤列表
* @param query
* @returns {*}
*/
export const listAttendance = (query?: AttendanceQuery): AxiosPromise<AttendanceVO[]> => {
return request({
url: '/contractor/constructionUser/list/attendance/total',
method: 'get',
params: query
});
};
/**
* 查询近两周考勤列表
* @param query
* @returns {*}
*/
export const listAttendanceTwoWeek = (query?: AttendanceTwoWeekQuery): AxiosPromise<AttendanceTwoWeekVO[]> => {
return request({
url: '/project/attendance/list/clockDate/twoWeek',
method: 'get',
params: query
});
};
/**
* 查询施工人员月份考勤列表
* @param query
* @returns {*}
*/
export const listAttendanceMonth = (query?: AttendanceMonthQuery): AxiosPromise<AttendanceMonthVO[]> => {
return request({
url: '/project/attendance/list/month/byUserId',
method: 'get',
params: query
});
};
/**
* 查询考勤详细
* @param id
*/
export const getAttendance = (id: string | number): AxiosPromise<AttendanceVO> => {
return request({
url: '/project/attendance/' + id,
method: 'get'
});
};
/**
* 新增考勤
* @param data
*/
export const addAttendance = (data: AttendanceForm) => {
return request({
url: '/project/attendance',
method: 'post',
data: data
});
};
/**
* 修改考勤
* @param data
*/
export const updateAttendance = (data: AttendanceForm) => {
return request({
url: '/project/attendance',
method: 'put',
data: data
});
};
/**
* 删除考勤
* @param id
*/
export const delAttendance = (id: string | number | Array<string | number>) => {
return request({
url: '/project/attendance/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,210 @@
export interface AttendanceVO {
/**
* 人员姓名
*/
userName: string;
id?: string | number;
/**
* 人员id
*/
/**
* 上班打卡时间
*/
onClockTime: string;
/**
* 下班打卡时间
*/
offClockTime: string;
/**
* 打卡日期
*/
clockDate: string;
/**
* 1正常,2迟到,3早退,4缺勤,5补卡
*/
clockStatus: string;
/**
* 上下班1上班,2下班
*/
commuter: string;
/**
* 备注
*/
remark: string;
}
export interface AttendanceTwoWeekQuery {
projectId?: string | number;
}
export interface AttendanceMonthQuery {
userId: string | number;
clockMonth?: string;
}
export interface AttendanceMonthVO {
id: string | number;
clockDate: string;
status: string;
attendanceList?: monthList[];
clockList?: clockObject;
}
interface clockObject {
downClockTime?: string;
downClockPic?: string;
upClockTime?: string;
upClockPic?: string;
}
interface monthList {
commuter: string;
clockTime: string;
clockStatus: string;
}
export interface AttendanceTwoWeekVO {
/**
* 出勤人数
*/
attendance: string;
/**
* 半勤人数
*/
halfAttendance: string;
/**
* 打卡日期
*/
clockDate: string;
/**
* 缺勤人数
*/
absenteeism: string;
}
export interface AttendanceForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 人员id
*/
userId?: string | number;
typeOfWork?: string;
teamId?: string;
clockDate?: string;
/**
* 人脸照
*/
facePic?: string;
/**
* 项目id
*/
projectId?: string | number;
/**
* 上班打卡时间
*/
onClockTime?: string;
/**
* 下班打卡时间
*/
offClockTime?: string;
/**
* 打卡日期
*/
clockDate?: string;
/**
* 1正常,2迟到,3早退,4缺勤,5补卡
*/
clockStatus?: string;
/**
* 代打人员id
*/
pinchUserId?: string | number;
/**
* 多次打卡时间记录
*/
clockRecord?: string;
/**
* 上下班1上班,2下班
*/
commuter?: string;
/**
* 日薪
*/
dailyWage?: number;
/**
* 经度
*/
lng?: string;
/**
* 纬度
*/
lat?: string;
/**
* 备注
*/
remark?: string;
}
export interface AttendanceQuery extends PageQuery {
/**
* 人员姓名
*/
userName?: string;
/**
* 项目id
*/
projectId?: string | number;
typeOfWork?: string | number;
teamId?: string | number;
/**
* 打卡日期
*/
clockDate?: string;
/**
* 1正常,2迟到,3早退,4缺勤,5补卡
*/
clockStatus?: string;
/**
* 上下班1上班,2下班
*/
commuter?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttendanceVO, AttendanceForm, AttendanceQuery } from '@/api/project/attendance/types';
/**
* 查询考勤列表
* @param query
* @returns {*}
*/
export const listAttendance = (query?: AttendanceQuery): AxiosPromise<AttendanceVO[]> => {
return request({
url: '/project/attendance/list',
method: 'get',
params: query
});
};
/**
* 查询考勤详细
* @param id
*/
export const getAttendance = (id: string | number): AxiosPromise<AttendanceVO> => {
return request({
url: '/project/attendance/' + id,
method: 'get'
});
};
/**
* 新增考勤
* @param data
*/
export const addAttendance = (data: AttendanceForm) => {
return request({
url: '/project/attendance',
method: 'post',
data: data
});
};
/**
* 修改考勤
* @param data
*/
export const updateAttendance = (data: AttendanceForm) => {
return request({
url: '/project/attendance',
method: 'put',
data: data
});
};
/**
* 删除考勤
* @param id
*/
export const delAttendance = (id: string | number | Array<string | number>) => {
return request({
url: '/project/attendance/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,146 @@
export interface AttendanceVO {
/**
* 人员姓名
*/
userName: string;
/**
* 上班打卡时间
*/
onClockTime: string;
/**
* 下班打卡时间
*/
offClockTime: string;
/**
* 打卡日期
*/
clockDate: string;
/**
* 1正常,2迟到,3早退,4缺勤,5补卡
*/
clockStatus: string;
/**
* 上下班1上班,2下班
*/
commuter: string;
/**
* 备注
*/
remark: string;
}
export interface AttendanceForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 人员id
*/
userId?: string | number;
/**
* 人脸照
*/
facePic?: string;
/**
* 项目id
*/
projectId?: string | number;
/**
* 上班打卡时间
*/
onClockTime?: string;
/**
* 下班打卡时间
*/
offClockTime?: string;
/**
* 打卡日期
*/
clockDate?: string;
/**
* 1正常,2迟到,3早退,4缺勤,5补卡
*/
clockStatus?: string;
/**
* 代打人员id
*/
pinchUserId?: string | number;
/**
* 多次打卡时间记录
*/
clockRecord?: string;
/**
* 上下班1上班,2下班
*/
commuter?: string;
/**
* 日薪
*/
dailyWage?: number;
/**
* 经度
*/
lng?: string;
/**
* 纬度
*/
lat?: string;
/**
* 备注
*/
remark?: string;
}
export interface AttendanceQuery extends PageQuery {
/**
* 人员姓名
*/
userName?: string;
teamId?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 打卡日期
*/
clockDate?: string;
/**
* 1正常,2迟到,3早退,4缺勤,5补卡
*/
clockStatus?: string;
/**
* 上下班1上班,2下班
*/
commuter?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ConstructionBlacklistVO, ConstructionBlacklistForm, ConstructionBlacklistQuery } from '@/api/project/constructionBlacklist/types';
/**
* 查询黑名单列表
* @param query
* @returns {*}
*/
export const listConstructionBlacklist = (query?: ConstructionBlacklistQuery): AxiosPromise<ConstructionBlacklistVO[]> => {
return request({
url: '/project/constructionBlacklist/list',
method: 'get',
params: query
});
};
/**
* 查询黑名单详细
* @param id
*/
export const getConstructionBlacklist = (id: string | number): AxiosPromise<ConstructionBlacklistVO> => {
return request({
url: '/project/constructionBlacklist/' + id,
method: 'get'
});
};
/**
* 新增黑名单
* @param data
*/
export const addConstructionBlacklist = (data: ConstructionBlacklistForm) => {
return request({
url: '/project/constructionBlacklist',
method: 'post',
data: data
});
};
/**
* 修改黑名单
* @param data
*/
export const updateConstructionBlacklist = (data: ConstructionBlacklistForm) => {
return request({
url: '/project/constructionBlacklist',
method: 'put',
data: data
});
};
/**
* 删除黑名单
* @param id
*/
export const delConstructionBlacklist = (id: string | number | Array<string | number>) => {
return request({
url: '/project/constructionBlacklist/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,69 @@
export interface ConstructionBlacklistVO {
/**
* id
*/
id: string | number;
/**
* 名字
*/
userName: string;
/**
* 身份证号码
*/
sfzNumber: string;
/**
* 备注
*/
remark: string;
}
export interface ConstructionBlacklistForm extends BaseEntity {
/**
* 项目id
*/
projectId?: string | number;
/**
* 用户id
*/
userId?: string | number;
/**
* 备注
*/
remark?: string;
}
export interface ConstructionBlacklistQuery extends PageQuery {
/**
* 主键id
*/
id?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 用户id
*/
userId?: string | number;
/**
* 名字
*/
userName?: string;
/**
* 身份证号码
*/
sfzNumber?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,205 @@
import request, { download } from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
ConstructionUserForm,
ConstructionUserQuery,
ConstructionUserVO,
skipType,
ConstructionUserStatusForm,
ConstructionUserPlayCardForm,
ConstructionUserSalaryForm,
ConstructionUserExitForm,
ConstructionUserTemplateForm,
ConstructionUserMembeForm,
ConstructionMonthQuery
} from '@/api/project/constructionUser/types';
import { AttendanceMonthVO } from '../attendance/types';
/**
* 查询施工人员月份考勤列表
* @param query
* @returns {*}
*/
export const listConstructionMonth = (query?: ConstructionMonthQuery): AxiosPromise<AttendanceMonthVO[]> => {
return request({
url: '/contractor/constructionUser/list/attendance/month',
method: 'get',
params: query
});
};
/**
* 查询施工人员列表
* @param query
* @returns {*}
*/
export const listConstructionUser = (query?: ConstructionUserQuery): AxiosPromise<ConstructionUserVO[]> => {
return request({
url: '/contractor/constructionUser/list',
method: 'get',
params: query
});
};
/**
* 查询施工人员详细
* @param id
*/
export const getConstructionUser = (id: string | number): AxiosPromise<ConstructionUserVO> => {
return request({
url: '/contractor/constructionUser/' + id,
method: 'get'
});
};
/**
* 人员迁移
* @param data
*/
export const transferConstructionUser = (data: skipType) => {
return request({
url: '/contractor/constructionUser/change/project',
method: 'put',
data: data
});
};
/**
* 查询项目以及项目下的分包公司列表
*/
export const getProjectContractorList = () => {
return request({
url: '/project/project/list/project/contractorList',
method: 'get'
});
};
/**
* 新增施工人员
* @param data
*/
export const addConstructionUser = (data: ConstructionUserForm): AxiosPromise<string | number> => {
return request({
url: '/contractor/constructionUser',
method: 'post',
data: data
});
};
/**
* 修改施工人员
* @param data
*/
export const updateConstructionUser = (data: ConstructionUserForm) => {
return request({
url: '/contractor/constructionUser',
method: 'put',
data: data
});
};
/**
* 删除施工人员
* @param id
*/
export const delConstructionUser = (id: string | number | Array<string | number>) => {
return request({
url: '/contractor/constructionUser/' + id,
method: 'delete'
});
};
/**
* 修改施工人员在职状态
* @param data
*/
export const updateConstructionUserStatus = (data: ConstructionUserStatusForm) => {
return request({
url: '/contractor/constructionUser/batch/status',
method: 'put',
data: data
});
};
/**
* 根据项目id批量修改施工人员打卡状态
* @param data
*/
export const updateConstructionUserPlayCardStatus = (data: ConstructionUserPlayCardForm) => {
return request({
url: '/contractor/constructionUser/batch/clock',
method: 'put',
data: data
});
};
/**
* 修改施工人员打卡状态
* @param data
*/
export const updateConstructionUserPlayCardOneStatus = (data: ConstructionUserPlayCardForm) => {
return request({
url: '/contractor/constructionUser/clock',
method: 'put',
data: data
});
};
/**
* 修改施工人员工资
* @param data
*/
export const updateConstructionUserSalary = (data: ConstructionUserSalaryForm) => {
return request({
url: '/contractor/constructionUser/salary',
method: 'put',
data: data
});
};
/**
* 查询施工人员入退场记录
* @param query
*/
export const getConstructionUserExit = (query: ConstructionUserExitForm) => {
return request({
url: '/contractor/constructionUserExit/list',
method: 'get',
params: query
});
};
/**
* 下载施工人员文件存储模板
* @param query
*/
export const dowloadConstructionUserTemplate = (query: ConstructionUserTemplateForm) => {
let { projectId } = query;
const fileName = projectId + '_project.zip';
return download('/contractor/constructionUserFile/exportFileTemplate', query, fileName);
};
/**
* 施工人员退场
* @param data
*/
export const delConstructionUserMember = (data: ConstructionUserMembeForm) => {
return request({
url: '/contractor/projectTeamMember/',
method: 'delete',
data
});
};
/**
* 上传施工人员文件压缩包,批量导入存储施工人员文件
* @param data
*/
export const importConstructionUserInfo = (file: string) => {
return request({
url: '/contractor/constructionUserFile/upload/zip',
method: 'post',
data: { file }
});
};

View File

@ -0,0 +1,605 @@
import { ContractorVO } from '@/api/project/contractor/types';
import { ProjectTeamVO } from '@/api/project/projectTeam/types';
import { S } from 'node_modules/vite/dist/node/types.d-aGj9QkWt';
export interface ConstructionUserVO {
/**
* 主键id
*/
id: string | number;
/**
* 微信id
*/
openid: string | number;
/**
* 微信名称
*/
nickName: string;
/**
* 人脸照
*/
facePic: string;
/**
* 人脸照url
*/
facePicUrl: string;
/**
* 人员姓名
*/
userName: string;
/**
* 项目id
*/
projectId: string | number;
/**
* 分包公司id
*/
contractorId: string | number;
/**
* 分包公司
*/
contractorVo: ContractorVO;
/**
* 班组id
*/
teamId: string | number;
/**
* 班组
*/
teamVo: ProjectTeamVO;
/**
* 状态0在职 1离职
*/
status: number;
/**
* 是否代打
*/
isPinch: number;
/**
* 联系电话
*/
phone: string;
/**
* 0:保密 1:男 2女
*/
sex: number;
/**
* 民族
*/
nation: string;
/**
* 身份证正面照片
*/
sfzFrontPic: string;
/**
* 身份证背面照片
*/
sfzBackPic: string;
/**
* 身份证号码
*/
sfzNumber: string;
/**
* 身份证有效开始期
*/
sfzStart: string;
/**
* 身份证有效结束期
*/
sfzEnd: string;
/**
* 身份证地址
*/
sfzSite: string;
/**
* 身份证出生日期
*/
sfzBirth: string;
/**
* 籍贯
*/
nativePlace: string;
/**
* 银行卡图片
*/
yhkPic: string;
/**
* 银行卡号
*/
yhkNumber: string;
/**
* 开户行
*/
yhkOpeningBank: string;
/**
* 持卡人
*/
yhkCardholder: string;
/**
* 工种(字典type_of_work)
*/
typeOfWork: number;
/**
* 特种工作证图片
*/
specialWorkPic: string;
/**
* 打卡(0启用打卡 1禁止打卡)
*/
clock: number;
/**
* 入场时间
*/
entryDate: string;
/**
* 离场时间
*/
leaveDate: string;
/**
* 薪水
*/
salary: number;
/**
* 备注
*/
remark: string;
/**
* 创建时间
*/
createTime: string;
}
export interface skipType {
/**
* 项目id
*/
projectId: string | number;
/**
* 分包id
*/
contractorId: string | number;
id: string | number;
}
export interface ConstructionMonthQuery {
/**
* id
*/
userId: string | number;
/**
* 打卡月份
*/
clockMonth?: string | number;
}
export interface ConstructionUserMembeForm {
/**
* 用户id
*/
id: string | number;
/**
* 用户姓名
*/
userName: string | number;
/**
* 文件路径
*/
filePath: string;
/**
* 备注
*/
remark: string | number;
}
export interface ConstructionUserTemplateForm {
/**
* 项目id
*/
projectId: string | number;
}
export interface ConstructionUserExitForm {
/**
* userId
*/
userId: number | string;
}
export interface ConstructionUserSalaryForm {
/**
* 列表
*/
id: number | string;
/**
* 工资
*/
salary?: number | string;
}
export interface ConstructionUserPlayCardForm {
/**
* 项目
*/
projectId?: string | number;
/**
* 用户id
*/
id?: string | number;
/**
* 打卡状态
*/
clock: number | string;
}
export interface skipOptionType {
/**
* 名称
*/
projectName: string | number;
/**
* id
*/
id: string | number;
/**
* 子项
*/
contractorList: Array<skipTeamType>;
}
export interface skipTeamType {
/**
* 名称
*/
name: string | number;
/**
* id
*/
id: string | number;
}
export interface ConstructionUserForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 微信id
*/
openid?: string | number;
/**
* 微信名称
*/
nickName?: string;
/**
* 人脸照
*/
facePic?: string;
/**
* 人员姓名
*/
userName?: string;
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包公司id
*/
contractorId?: string | number;
/**
* 结算方式
*/
wageMeasureUnit?: string | number;
/**
* 班组id
*/
teamId?: string | number;
/**
* 状态0在职 1离职
*/
status?: number;
/**
* 是否代打
*/
isPinch?: number;
/**
* 联系电话
*/
phone?: string;
/**
* 0:保密 1:男 2女
*/
sex?: number;
/**
* 民族
*/
nation?: string;
/**
* 身份证正面照片
*/
sfzFrontPic: string;
/**
* 身份证背面照片
*/
sfzBackPic: string;
/**
* 身份证号码
*/
sfzNumber?: string;
/**
* 身份证有效开始期
*/
sfzStart?: string;
/**
* 身份证有效结束期
*/
sfzEnd?: string;
/**
* 身份证地址
*/
sfzSite?: string;
/**
* 身份证出生日期
*/
sfzBirth?: string;
/**
* 籍贯
*/
nativePlace?: string;
/**
* 银行卡图片
*/
yhkPic: string;
/**
* 银行卡号
*/
yhkNumber?: string;
/**
* 开户行
*/
yhkOpeningBank?: string;
/**
* 持卡人
*/
yhkCardholder?: string;
/**
* 工种(字典type_of_work)
*/
typeOfWork?: number;
/**
* 特种工作证图片
*/
specialWorkPic: string;
/**
* 打卡(0启用打卡 1禁止打卡)
*/
clock?: number;
/**
* 入场时间
*/
entryDate?: string;
/**
* 离场时间
*/
leaveDate?: string;
/**
* 薪水
*/
salary?: number;
/**
* 备注
*/
remark?: string;
}
export interface ConstructionUserStatusForm {
status: number | string;
idList: Array<string | number>;
}
export interface ConstructionUserQuery extends PageQuery {
/**
* 微信id
*/
openid?: string | number;
/**
* 微信名称
*/
nickName?: string;
/**
* 人员姓名
*/
userName?: string;
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包公司id
*/
contractorId?: string | number;
/**
* 班组id
*/
teamId?: string | number;
/**
* 不在班组id
*/
notTeamId?: string | number;
/**
* 状态0在职 1离职
*/
status?: number;
/**
* 是否代打
*/
isPinch?: number;
/**
* 联系电话
*/
phone?: string;
/**
* 0:保密 1:男 2女
*/
sex?: number;
/**
* 民族
*/
nation?: string;
/**
* 身份证号码
*/
sfzNumber?: string;
/**
* 身份证有效开始期
*/
sfzStart?: string;
/**
* 身份证有效结束期
*/
sfzEnd?: string;
/**
* 身份证地址
*/
sfzSite?: string;
/**
* 身份证出生日期
*/
sfzBirth?: string;
/**
* 籍贯
*/
nativePlace?: string;
/**
* 银行卡号
*/
yhkNumber?: string;
/**
* 开户行
*/
yhkOpeningBank?: string;
/**
* 持卡人
*/
yhkCardholder?: string;
/**
* 工种(字典type_of_work)
*/
typeOfWork?: number;
/**
* 打卡(0启用打卡 1禁止打卡)
*/
clock?: number;
/**
* 入场时间
*/
entryDate?: string;
/**
* 离场时间
*/
leaveDate?: string;
/**
* 薪水
*/
salary?: number;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,40 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ConstructionUserFileVO, ConstructionUserFileForm, ConstructionUserFileQuery } from '@/api/project/constructionUserFile/types';
/**
* 查询施工人员文件存储列表
* @param query
* @returns {*}
*/
export const listConstructionUserFile = (query?: ConstructionUserFileQuery): AxiosPromise<ConstructionUserFileVO[]> => {
return request({
url: '/project/constructionUserFile/list',
method: 'get',
params: query
});
};
/**
* 查询施工人员文件存储详细
* @param data
*/
export const setConstructionUserFile = (data: ConstructionUserFileForm): AxiosPromise<string | number> => {
return request({
url: '/project/constructionUserFile/save',
method: 'post',
data
});
};
/**
* 删除施工人员文件存储
* @param id
*/
export const delConstructionUserFile = (id: string | number | Array<string | number>) => {
return request({
url: '/project/constructionUserFile/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,137 @@
export interface ConstructionUserFileVO {
/**
* 主键id
*/
id: string | number;
/**
* 用户id
*/
userId: string | number;
/**
* 文件类型
*/
fileType: string;
/**
* 文件名称
*/
fileName: string;
/**
* 文件路径
*/
path: string;
/**
* 备注
*/
remark: string;
}
export interface ConstructionUserExitVO {
/**
* 主键id
*/
id: string | number;
/**
* 用户id
*/
userId: string | number;
/**
* 文件路径地址
*/
pathUrl: Array<string>;
/**
* 身份证号码
*/
sfzNumber: string;
/**
* 项目id
*/
projectId: string;
/**
* 班组id
*/
teamId: string;
/**
* 入场时间
*/
entryDate: string;
/**
* 退场时间
*/
leaveDate: string;
/**
* 退场文件
*/
path: string;
/**
* 备注
*/
remark: string;
}
export interface ConstructionUserFileForm extends BaseEntity {
/**
* 用户id
*/
userId?: string | number;
/**
* 文件类型
*/
fileList?: Array<fileListType>;
}
interface fileListType {
fileId: string | number;
fileType: string | number;
}
export interface ConstructionUserFileQuery {
/**
* 主键id
*/
id?: string | number;
/**
* 用户id
*/
userId?: string | number;
/**
* 文件类型
*/
fileType?: string;
/**
* 文件名称
*/
fileName?: string;
/**
* 文件路径
*/
path?: string;
/**
* 备注
*/
remark?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractorForm, ContractorQuery, ContractorVO } from '@/api/project/contractor/types';
/**
* 查询分包单位列表
* @param query
* @returns {*}
*/
export const listContractor = (query?: ContractorQuery): AxiosPromise<ContractorVO[]> => {
return request({
url: '/contractor/contractor/list',
method: 'get',
params: query
});
};
/**
* 查询分包单位详细
* @param id
*/
export const getContractor = (id: string | number): AxiosPromise<ContractorVO> => {
return request({
url: '/contractor/contractor/' + id,
method: 'get'
});
};
/**
* 新增分包单位
* @param data
*/
export const addContractor = (data: ContractorForm): AxiosPromise<string | number> => {
return request({
url: '/contractor/contractor',
method: 'post',
data: data
});
};
/**
* 修改分包单位
* @param data
*/
export const updateContractor = (data: ContractorForm) => {
return request({
url: '/contractor/contractor',
method: 'put',
data: data
});
};
/**
* 删除分包单位
* @param id
*/
export const delContractor = (id: string | number | Array<string | number>) => {
return request({
url: '/contractor/contractor/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,147 @@
export interface ContractorVO {
/**
* 主键id
*/
id: string | number;
/**
* 公司名称
*/
name: string;
/**
* 负责人
*/
principal: string;
/**
* 负责人联系电话
*/
principalPhone: string;
/**
* 管理人
*/
custodian: string;
/**
* 管理人联系电话
*/
custodianPhone: string;
/**
* 分包类型
*/
contractorType?: string;
/**
* 公司相关文件
*/
fileMap: Record<string, string>;
/**
* 备注
*/
remark: string;
/**
* 创建时间
*/
createTime: string;
}
export interface ContractorForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 供应商id
*/
supplierId?: string | number;
/**
* 供应商
*/
supplier?: string;
/**
* 主键id
*/
projectId?: string | number;
/**
* 公司名称
*/
name?: string;
/**
* 负责人
*/
principal?: string;
/**
* 负责人联系电话
*/
principalPhone?: string;
/**
* 管理人
*/
custodian?: string;
/**
* 管理人联系电话
*/
custodianPhone?: string;
/**
* 分包类型
*/
contractorType?: string;
/**
* 公司相关文件
*/
fileMap: Record<string, string | number>;
/**
* 备注
*/
remark?: string;
}
export interface ContractorQuery extends PageQuery {
/**
* 公司名称
*/
name?: string;
/**
* 负责人
*/
principal?: string;
/**
* 项目id
*/
projectId: string | number;
/**
* 负责人联系电话
*/
principalPhone?: string;
/**
* 管理人
*/
custodian?: string;
/**
* 管理人联系电话
*/
custodianPhone?: string;
/**
* 分包类型
*/
contractorType?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractorMaterialRecordVO, ContractorMaterialRecordForm, ContractorMaterialRecordQuery } from '@/api/contractor/contractorMaterialRecord/types';
/**
* 查询分包方物料记录列表
* @param query
* @returns {*}
*/
export const listContractorMaterialRecord = (query?: ContractorMaterialRecordQuery): AxiosPromise<ContractorMaterialRecordVO[]> => {
return request({
url: '/contractor/contractorMaterialRecord/list',
method: 'get',
params: query
});
};
/**
* 查询分包方物料记录详细
* @param id
*/
export const getContractorMaterialRecord = (id: string | number): AxiosPromise<ContractorMaterialRecordVO> => {
return request({
url: '/contractor/contractorMaterialRecord/' + id,
method: 'get'
});
};
/**
* 新增分包方物料记录
* @param data
*/
export const addContractorMaterialRecord = (data: ContractorMaterialRecordForm) => {
return request({
url: '/contractor/contractorMaterialRecord',
method: 'post',
data: data
});
};
/**
* 修改分包方物料记录
* @param data
*/
export const updateContractorMaterialRecord = (data: ContractorMaterialRecordForm) => {
return request({
url: '/contractor/contractorMaterialRecord',
method: 'put',
data: data
});
};
/**
* 删除分包方物料记录
* @param id
*/
export const delContractorMaterialRecord = (id: string | number | Array<string | number>) => {
return request({
url: '/contractor/contractorMaterialRecord/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,141 @@
export interface ContractorMaterialRecordVO {
/**
* 主键id
*/
id: string | number;
/**
* 项目id
*/
projectId: string | number;
/**
* 分包方id
*/
contractorId: string | number;
/**
* 物料id
*/
contractorMaterialId: string | number;
/**
* 记录类型(1到货计划 2使用情况)
*/
recordType: string;
/**
* 记录时间
*/
recordTime: string;
/**
* 数量
*/
recordNumber: number;
/**
* 剩余数量(到货 使用)
*/
remainingNumber: number;
/**
* 使用位置或构件部位(使用情况)
*/
usedPosition: string;
/**
* 相关附件
*/
file: string;
/**
* 备注
*/
remark: string;
}
export interface ContractorMaterialRecordForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 物料id
*/
contractorMaterialId?: string | number;
/**
* 记录类型(1到货计划 2使用情况)
*/
recordType?: string;
/**
* 记录时间
*/
recordTime?: string;
/**
* 数量
*/
recordNumber?: number;
/**
* 剩余数量(到货 使用)
*/
remainingNumber?: number;
/**
* 使用位置或构件部位(使用情况)
*/
usedPosition?: string;
/**
* 相关附件
*/
file?: string;
/**
* 备注
*/
remark?: string;
}
export interface ContractorMaterialRecordQuery extends PageQuery {
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包方id
*/
contractorId?: string | number;
/**
* 物料id
*/
contractorMaterialId?: string | number;
/**
* 记录类型(1到货计划 2使用情况)
*/
recordType?: string;
/**
* 使用位置或构件部位(使用情况)
*/
usedPosition?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractorMaterialVO, ContractorMaterialForm, ContractorMaterialQuery } from '@/api/project/contractorMaterial/types';
/**
* 查询分包方物料列表
* @param query
* @returns {*}
*/
export const listContractorMaterial = (query?: ContractorMaterialQuery): AxiosPromise<ContractorMaterialVO[]> => {
return request({
url: '/contractor/contractorMaterial/list',
method: 'get',
params: query
});
};
/**
* 查询分包方物料详细
* @param id
*/
export const getContractorMaterial = (id: string | number): AxiosPromise<ContractorMaterialVO> => {
return request({
url: '/contractor/contractorMaterial/' + id,
method: 'get'
});
};
/**
* 新增分包方物料
* @param data
*/
export const addContractorMaterial = (data: ContractorMaterialForm) => {
return request({
url: '/contractor/contractorMaterial',
method: 'post',
data: data
});
};
/**
* 修改分包方物料
* @param data
*/
export const updateContractorMaterial = (data: ContractorMaterialForm) => {
return request({
url: '/contractor/contractorMaterial',
method: 'put',
data: data
});
};
/**
* 删除分包方物料
* @param id
*/
export const delContractorMaterial = (id: string | number | Array<string | number>) => {
return request({
url: '/contractor/contractorMaterial/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,126 @@
export interface ContractorMaterialVO {
/**
* 分包方id
*/
contractorId: string | number;
/**
* 物料名称
*/
materialName: string;
/**
* 物料类型
*/
materialType: string;
/**
* 物料型号
*/
materialModel: string;
/**
* 物料数量
*/
materialNumber: number;
/**
* 物料单位
*/
materialUnit: string;
/**
* 文件
*/
file: string;
/**
* 备注
*/
remark: string;
}
export interface ContractorMaterialForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包方id
*/
contractorId?: string | number;
/**
* 物料名称
*/
materialName?: string;
/**
* 物料类型
*/
materialType?: string;
/**
* 物料型号
*/
materialModel?: string;
/**
* 物料单位
*/
materialUnit?: string;
/**
* 文件
*/
file?: string;
/**
* 备注
*/
remark?: string;
}
export interface ContractorMaterialQuery extends PageQuery {
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包方id
*/
contractorId?: string | number;
/**
* 物料名称
*/
materialName?: string;
/**
* 物料类型
*/
materialType?: string;
/**
* 物料型号
*/
materialModel?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractorToolEntryVO, ContractorToolEntryForm, ContractorToolEntryQuery } from '@/api/contractor/contractorToolEntry/types';
/**
* 查询分包方工器具进场列表
* @param query
* @returns {*}
*/
export const listContractorToolEntry = (query?: ContractorToolEntryQuery): AxiosPromise<ContractorToolEntryVO[]> => {
return request({
url: '/contractor/contractorToolRecord/list',
method: 'get',
params: query
});
};
/**
* 查询分包方工器具进场详细
* @param id
*/
export const getContractorToolEntry = (id: string | number): AxiosPromise<ContractorToolEntryVO> => {
return request({
url: '/contractor/contractorToolRecord/' + id,
method: 'get'
});
};
/**
* 新增分包方工器具进场
* @param data
*/
export const addContractorToolEntry = (data: ContractorToolEntryForm) => {
return request({
url: '/contractor/contractorToolRecord',
method: 'post',
data: data
});
};
/**
* 修改分包方工器具进场
* @param data
*/
export const updateContractorToolEntry = (data: ContractorToolEntryForm) => {
return request({
url: '/contractor/contractorToolRecord',
method: 'put',
data: data
});
};
/**
* 删除分包方工器具进场
* @param id
*/
export const delContractorToolEntry = (id: string | number | Array<string | number>) => {
return request({
url: '/contractor/contractorToolRecord/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,156 @@
export interface ContractorToolEntryVO {
/**
* 主键id
*/
id: string | number;
/**
* 项目id
*/
projectId: string | number;
/**
* 分包方id
*/
contractorId: string | number;
/**
* 分包方工器具id
*/
contractorToolId: string | number;
/**
* 进场工器具数量
*/
toolNumber: string;
/**
* 检测编号
*/
checkNum: string;
/**
* 检测部门
*/
checkDept: string;
/**
* 检测时间
*/
checkTime: string;
/**
* 合格证
*/
certificate: string;
/**
* 备注
*/
remark: string;
/**
* 进场时间
*/
entryTime: string;
}
export interface ContractorToolEntryForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 分包方工器具id
*/
contractorToolId?: string | number;
/**
* 进场工器具数量
*/
toolNumber?: string;
/**
* 检测编号
*/
checkNum?: string;
/**
* 检测部门
*/
checkDept?: string;
/**
* 检测时间
*/
checkTime?: string;
/**
* 合格证
*/
certificate?: string;
/**
* 备注
*/
remark?: string;
/**
* 进场时间
*/
entryTime?: string;
/**
* 类型
*/
recordType?: string;
/**
* 工器具数量
*/
recordNumber?: number;
}
export interface ContractorToolEntryQuery extends PageQuery {
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包方id
*/
contractorId?: string | number;
/**
* 分包方工器具id
*/
contractorToolId?: string | number;
/**
* 进场工器具数量
*/
toolNumber?: string;
/**
* 检测编号
*/
checkNum?: string;
/**
* 类型
*/
recordType?: string;
/**
* 检测部门
*/
checkDept?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractorToolVO, ContractorToolForm, ContractorToolQuery } from '@/api/project/contractorTool/types';
/**
* 查询分包方工器具列表
* @param query
* @returns {*}
*/
export const listContractorTool = (query?: ContractorToolQuery): AxiosPromise<ContractorToolVO[]> => {
return request({
url: '/contractor/contractorTool/list',
method: 'get',
params: query
});
};
/**
* 查询分包方工器具详细
* @param id
*/
export const getContractorTool = (id: string | number): AxiosPromise<ContractorToolVO> => {
return request({
url: '/contractor/contractorTool/' + id,
method: 'get'
});
};
/**
* 新增分包方工器具
* @param data
*/
export const addContractorTool = (data: ContractorToolForm) => {
return request({
url: '/contractor/contractorTool',
method: 'post',
data: data
});
};
/**
* 修改分包方工器具
* @param data
*/
export const updateContractorTool = (data: ContractorToolForm) => {
return request({
url: '/contractor/contractorTool',
method: 'put',
data: data
});
};
/**
* 删除分包方工器具
* @param id
*/
export const delContractorTool = (id: string | number | Array<string | number>) => {
return request({
url: '/contractor/contractorTool/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,136 @@
export interface ContractorToolVO {
/**
* 主键id
*/
id: string | number;
/**
* 项目id
*/
projectId: string | number;
/**
* 分包方id
*/
contractorId: string | number;
/**
* 工具名称
*/
toolName: string;
/**
* 工具类型
*/
toolType: string;
/**
* 工具型号
*/
toolModel: string;
/**
* 工具数量
*/
toolNumber: string;
/**
* 备注
*/
remark: string;
/**
* 创建时间
*/
createTime: string;
}
export interface ContractorToolForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包方id
*/
contractorId?: string | number;
/**
* 工具名称
*/
toolName?: string;
/**
* 工具类型
*/
toolType?: string;
/**
* 工具型号
*/
toolModel?: string;
/**
* 工具数量
*/
toolNumber?: string;
/**
* 文件
*/
file?: string;
/**
* 备注
*/
remark?: string;
}
export interface ContractorToolQuery extends PageQuery {
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包方id
*/
contractorId?: string | number;
/**
* 工具名称
*/
toolName?: string;
/**
* 工具类型
*/
toolType?: string;
/**
* 工具型号
*/
toolModel?: string;
/**
* 工具数量
*/
toolNumber?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,76 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LeaveVO, LeaveForm, LeaveQuery } from '@/api/project/leave/types';
import { AuditReissueCardForm } from '../reissueCard/types';
/**
* 查询施工人员请假申请列表
* @param query
* @returns {*}
*/
export const listLeave = (query?: LeaveQuery): AxiosPromise<LeaveVO[]> => {
return request({
url: '/project/leave/list',
method: 'get',
params: query
});
};
/**
* 查询施工人员请假申请详细
* @param id
*/
export const getLeave = (id: string | number): AxiosPromise<LeaveVO> => {
return request({
url: '/project/leave/' + id,
method: 'get'
});
};
/**
* 新增施工人员请假申请
* @param data
*/
export const addLeave = (data: LeaveForm) => {
return request({
url: '/project/leave',
method: 'post',
data: data
});
};
/**
* 修改施工人员请假申请
* @param data
*/
export const updateLeave = (data: LeaveForm) => {
return request({
url: '/project/leave',
method: 'put',
data: data
});
};
/**
* 删除施工人员请假申请
* @param id
*/
export const delLeave = (id: string | number | Array<string | number>) => {
return request({
url: '/project/leave/' + id,
method: 'delete'
});
};
/**
* 管理员审核施工人员请假申请
* @param data
*/
export const AuditReissueCard = (data: AuditReissueCardForm) => {
return request({
url: '/project/leave/review/manager',
method: 'put',
data: data
});
};

View File

@ -0,0 +1,206 @@
export interface LeaveVO {
/**
* 申请人名字
*/
userName: string;
id?: string | number;
/**
* 申请请假说明
*/
userExplain: string;
status?: string;
/**
* 请假申请时间
*/
userTime: string;
/**
* 请假类型1事假 2病假
*/
leaveType: string;
/**
* 请假开始时间
*/
startTime: string;
/**
* 请假结束时间
*/
endTime: string;
/**
* 班组长名字
*/
gangerName: string;
/**
* 班组长意见1未读 2同意 3拒绝
*/
gangerOpinion: string;
/**
* 班组长说明
*/
gangerExplain: string;
/**
* 班组长操作时间
*/
gangerTime: string;
/**
* 管理员意见1未读 2同意 3拒绝
*/
managerOpinion: string;
/**
* 管理员说明
*/
managerExplain: string;
/**
* 管理员操作时间
*/
managerTime: string;
/**
* 备注
*/
remark: string;
managerName?: string;
}
export interface LeaveForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 申请人id
*/
userId?: string | number;
/**
* 申请人名字
*/
userName?: string;
/**
* 申请请假说明
*/
userExplain?: string;
/**
* 请假申请时间
*/
userTime?: string;
/**
* 请假类型1事假 2病假
*/
leaveType?: string;
/**
* 请假开始时间
*/
startTime?: string;
/**
* 请假结束时间
*/
endTime?: string;
/**
* 班组长
*/
gangerId?: string | number;
/**
* 班组长名字
*/
gangerName?: string;
/**
* 班组长意见1未读 2同意 3拒绝
*/
gangerOpinion?: string;
/**
* 班组长说明
*/
gangerExplain?: string;
/**
* 班组长操作时间
*/
gangerTime?: string;
/**
* 管理员意见1未读 2同意 3拒绝
*/
managerOpinion?: string;
/**
* 管理员说明
*/
managerExplain?: string;
/**
* 管理员操作时间
*/
managerTime?: string;
/**
* 项目id
*/
projectId?: string | number;
/**
* 班组id
*/
teamId?: string | number;
/**
* 备注
*/
remark?: string;
}
export interface LeaveQuery extends PageQuery {
/**
* 申请人名字
*/
userName?: string;
/**
* 请假类型1事假 2病假
*/
leaveType?: string;
/**
* 班组长意见1未读 2同意 3拒绝
*/
gangerOpinion?: string;
/**
* 管理员意见1未读 2同意 3拒绝
*/
managerOpinion?: string;
/**
* 项目id
*/
projectId?: string | number;
/**
* 班组id
*/
teamId?: string | number;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,199 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { childProjectQuery, ProjectForm, ProjectQuery, ProjectVO } from '@/api/project/project/types';
/**
* 查询项目列表
* @param query
* @returns {*}
*/
export const listProject = (query?: ProjectQuery): AxiosPromise<ProjectVO[]> => {
return request({
url: '/project/project/list',
method: 'get',
params: query
});
};
/**
* 查询项目dxf
* @param query
* @returns {*}
*/
export const listDXFProject = (id: string | number): AxiosPromise<any> => {
return request({
url: '/project/projectFile/json/' + id,
method: 'get'
});
};
/**
* 查询项目详细
* @param id
*/
export const getProject = (id: string | number): AxiosPromise<ProjectVO> => {
return request({
url: '/project/project/' + id,
method: 'get'
});
};
/**
* 新增项目
* @param data
*/
export const addProject = (data: ProjectForm): AxiosPromise<string | number> => {
return request({
url: '/project/project',
method: 'post',
data: data
});
};
/**
* 修改项目
* @param data
*/
export const updateProject = (data: ProjectForm) => {
return request({
url: '/project/project',
method: 'put',
data: data
});
};
/**
* 上传dxf文件
* @param data
*/
export const upLoadProjectDXF = (data: any) => {
return request({
url: '/project/projectFile/upload/dxf',
method: 'post',
data: data
});
};
/**
* 通过GeoJson新增设施-光伏板
* @param data
*/
export const addProjectFacilities = (data: any) => {
return request({
url: '/facility/photovoltaicPanel/geoJson',
method: 'post',
data: data,
headers: {
'X-No-Cache': 'true'
}
});
};
/**
* 通过GeoJson新增设施-光伏板桩点、立柱、支架
* @param data
*/
export const addProjectPilePoint = (data: any) => {
console.log('🚀 ~ addProjectPilePoint ~ data:', data);
return request({
url: '/facility/photovoltaicPanelPoint/parts/geoJson',
method: 'post',
data: data
});
};
/**
* 通过GeoJson新增设施-方阵
* @param data
*/
export const addProjectSquare = (data: any) => {
return request({
url: '/facility/matrix/geoJson',
method: 'post',
data: data
});
};
/**
* 通过GeoJson新增设施-箱变
* @param data
*/
export const addBoxTransformer = (data: any) => {
return request({
url: '/facility/boxTransformer/geoJson',
method: 'post',
data: data
});
};
/**
* 通过GeoJson新增设施-逆变器
* @param data
*/
export const addInverter = (data: any) => {
return request({
url: '/facility/inverter/geoJson',
method: 'post',
data: data
});
};
/**
* 删除项目
* @param id
*/
export const delProject = (id: string | number | Array<string | number>) => {
return request({
url: '/project/project/' + id,
method: 'delete'
});
};
/**
* 新增子项目
* @param data
*/
export const addChildProject = (data: childProjectQuery) => {
return request({
url: '/project/project/sub',
method: 'post',
data: data
});
};
/**
* 查询项目下的子项目列表
* @param id
*/
export const getChildProject = (id: string | number): AxiosPromise<childProjectQuery[]> => {
return request({
url: '/project/project/list/sub/' + id,
method: 'get'
});
};
/**
* 上传项目文件
* @param data
*/
export const uploadProjectFile = (data: any) => {
return request({
url: '/project/project/save/tender/file',
method: 'put',
data: data
});
};
/**
* 切换项目
* @param id
*/
export const changeProject = (id: string | number) => {
return request({
url: '/project/project/changeProject/' + id,
method: 'get'
});
};

View File

@ -0,0 +1,385 @@
export interface ProjectVO {
/**
* id
*/
id: string;
/**
* 项目名称
*/
projectName: string;
tenderFiles: string;
/**
* 项目简称
*/
shortName: string;
designId: string;
/**
* 父项目id
*/
pId: string | number;
/**
* 状态0正常 1停用
*/
status: number;
/**
* 项目图片
*/
picUrl: string;
/**
* 备注
*/
remark: string;
/**
* 项目类型
*/
projectType: string;
/**
* 项目类型1光伏 2风电
*/
projectCategory: number;
/**
* 删除时间
*/
deletedAt: string;
/**
* 项目地址
*/
projectSite: string;
/**
* 负责人
*/
principal: string;
/**
* 负责人电话
*/
principalPhone: string;
/**
* 实际容量
*/
actual: string;
/**
* 计划容量
*/
plan: string;
/**
* 开工时间
*/
onStreamTime: string;
/**
* 打卡范围09:00,18:00
*/
punchRange: string;
/**
* 设计总量
*/
designTotal: number;
/**
* 安全协议书
*/
securityAgreement: string;
/**
* 排序字段
*/
sort: number;
/**
* 显示隐藏1显示 2隐藏
*/
showHidden: string | number;
/**
* 是否删除0正常 1删除
*/
isDelete: number;
/**
* 创建时间
*/
createTime: string;
type?: string;
}
export interface locationType {
/**
* 经度
*/
lng: string;
// 纬度
lat: string;
// 逆地理编码地址
projectSite: string;
}
export interface childProjectQuery {
projectName: string;
pid: string;
id?: string;
}
export interface ProjectForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
* 项目名称
*/
projectName?: string;
/**
* 项目简称
*/
shortName?: string;
/**
* 父项目id
*/
pId?: string | number;
/**
* 状态0正常 1停用
*/
status?: number;
/**
* 项目图片
*/
picUrl?: string;
/**
* 经度
*/
lng?: string;
/**
* 纬度
*/
lat?: string;
/**
* 备注
*/
remark?: string;
/**
* 项目类型
*/
projectType?: string;
/**
* 项目类型1光伏 2风电
*/
projectCategory?: number;
/**
* 删除时间
*/
deletedAt?: string;
/**
* 项目地址
*/
projectSite?: string;
/**
* 负责人
*/
principal?: string;
/**
* 负责人电话
*/
principalPhone?: string;
/**
* 实际容量
*/
actual?: string;
/**
* 计划容量
*/
plan?: string;
/**
* 开工时间
*/
onStreamTime?: string;
/**
* 打卡开始时间09:00,18:00
*/
playCardStart?: string;
/**
* 打卡结束时间09:00,18:00
*/
playCardEnd?: string;
/**
* 设计总量
*/
designTotal?: number;
/**
* 安全协议书
*/
securityAgreement?: string;
/**
* 排序字段
*/
sort?: number;
/**
* 显示隐藏1显示 2隐藏
*/
showHidden?: string | number;
/**
* 是否删除0正常 1删除
*/
isDelete?: number;
}
export interface ProjectQuery extends PageQuery {
/**
* 项目名称
*/
projectName?: string;
/**
* 项目简称
*/
shortName?: string;
/**
* 父项目id
*/
pId?: string | number;
/**
* 状态0正常 1停用
*/
status?: number;
/**
* 项目图片
*/
picUrl?: string;
/**
* 项目类型
*/
projectType?: string;
/**
* 项目类型1光伏 2风电
*/
projectCategory?: number;
/**
* 删除时间
*/
deletedAt?: string;
/**
* 项目地址
*/
projectSite?: string;
/**
* 经度
*/
lng?: string;
/**
* 纬度
*/
lat?: string;
/**
* 负责人
*/
principal?: string;
/**
* 负责人电话
*/
principalPhone?: string;
/**
* 实际容量
*/
actual?: string;
/**
* 计划容量
*/
plan?: string;
/**
* 开工时间
*/
onStreamTime?: string;
/**
* 打卡开始时间09:00,18:00
*/
playCardStart?: string;
/**
* 打卡结束时间09:00,18:00
*/
playCardEnd?: string;
/**
* 设计总量
*/
designTotal?: number;
/**
* 安全协议书
*/
securityAgreement?: string;
/**
* 排序字段
*/
sort?: number;
/**
* 显示隐藏1显示 2隐藏
*/
showHidden?: string | number;
/**
* 是否删除0正常 1删除
*/
isDelete?: number;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,103 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProjectRelevancyForm, ProjectRelevancyQuery, ProjectRelevancyVO } from '@/api/project/projectRelevancy/types';
/**
* 查询系统用户与项目关联列表
* @param query
* @returns {*}
*/
export const listProjectRelevancy = (query?: ProjectRelevancyQuery): AxiosPromise<ProjectRelevancyVO[]> => {
return request({
url: '/project/projectRelevancy/login/page',
method: 'get',
params: query
});
};
/**
* 查询系统用户与项目关联详细
* @param id
*/
export const getProjectRelevancy = (id: string | number): AxiosPromise<ProjectRelevancyVO> => {
return request({
url: '/project/projectRelevancy/' + id,
method: 'get'
});
};
/**
* 新增系统用户与项目关联
* @param data
*/
export const addProjectRelevancy = (data: ProjectRelevancyForm): AxiosPromise<string | number> => {
return request({
url: '/project/projectRelevancy',
method: 'post',
data: data
});
};
/**
* 修改系统用户与项目关联
* @param data
*/
export const updateProjectRelevancy = (data: ProjectRelevancyForm) => {
return request({
url: '/project/projectRelevancy',
method: 'put',
data: data
});
};
/**
* 删除系统用户与项目关联
* @param id
*/
export const delProjectRelevancy = (id: string | number | Array<string | number>) => {
return request({
url: '/project/projectRelevancy/' + id,
method: 'delete'
});
};
/**
* 穿梭框接口
*/
/**
* 获取用户已关联的项目列表
* @param params { userId: number }
*/
export function listUserProjects(params: { userId: number | string }) {
return request({
url: '/project/projectRelevancy/list',
method: 'get',
params
});
}
/**
* 添加项目关联
* @param data { userId: number; projectIds: number[] }
*/
export function addNewProjectRelevancy(data: { userId: number | string; projectIdList: number[] }) {
return request({
url: '/project/projectRelevancy/add/project/list',
method: 'post',
data
});
}
/**
* 移除项目关联
* @param data { userId: number; projectIds: number[] }
*/
export function removeNewProjectRelevancy(data: { userId: number | string; projectIdList: number[] }) {
return request({
url: '/project/projectRelevancy/remove/project/list',
method: 'delete',
data
});
}

View File

@ -0,0 +1,72 @@
import { ProjectVO } from '@/api/project/project/types';
export interface ProjectRelevancyVO {
/**
* 主键ID
*/
id: string | number;
/**
* 用户ID
*/
userId: string | number;
/**
* 项目ID
*/
projectId: string | number;
/**
* 项目详情
*/
project: ProjectVO;
/**
* 创建时间
*/
createTime: string;
}
export interface ProjectRelevancyForm extends BaseEntity {
/**
* 主键ID
*/
id?: string | number;
/**
* 用户ID
*/
userId?: string | number;
/**
* 项目ID
*/
projectId?: string | number;
/**
* 删除时间
*/
deletedAt?: string;
}
export interface ProjectRelevancyQuery extends PageQuery {
/**
* 用户ID
*/
userId?: string | number;
/**
* 项目ID
*/
projectId?: string | number;
/**
* 删除时间
*/
deletedAt?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,74 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProjectTeamForemanResp, ProjectTeamForm, ProjectTeamQuery, ProjectTeamVO } from '@/api/project/projectTeam/types';
/**
* 查询项目班组列表
* @param query
* @returns {*}
*/
export const listProjectTeam = (query?: ProjectTeamQuery): AxiosPromise<ProjectTeamVO[]> => {
return request({
url: '/project/projectTeam/list',
method: 'get',
params: query
});
};
/**
* 根据项目id查询项目班组班组长信息列表
* @param projectId
*/
export const listProjectTeamForeman = (projectId: string | number): AxiosPromise<ProjectTeamForemanResp[]> => {
return request({
url: '/project/projectTeam/listForeman/' + projectId,
method: 'get'
});
};
/**
* 查询项目班组详细
* @param id
*/
export const getProjectTeam = (id: string | number): AxiosPromise<ProjectTeamVO> => {
return request({
url: '/project/projectTeam/' + id,
method: 'get'
});
};
/**
* 新增项目班组
* @param data
*/
export const addProjectTeam = (data: ProjectTeamForm): AxiosPromise<string | number> => {
return request({
url: '/project/projectTeam',
method: 'post',
data: data
});
};
/**
* 修改项目班组
* @param data
*/
export const updateProjectTeam = (data: ProjectTeamForm) => {
return request({
url: '/project/projectTeam',
method: 'put',
data: data
});
};
/**
* 删除项目班组
* @param id
*/
export const delProjectTeam = (id: string | number | Array<string | number>) => {
return request({
url: '/project/projectTeam/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,109 @@
export interface ProjectTeamVO {
/**
* 主键id
*/
id: string | number;
/**
* 项目id
*/
projectId: string | number;
/**
* 班组名称
*/
teamName: string;
/**
* 范围内打卡0范围内打卡 1任何地点打卡默认为1
*/
isClockIn: number;
/**
* 备注
*/
remark: string;
/**
* 创建时间
*/
createTime: string;
}
export interface ProjectTeamForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
peopleNumber?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 班组名称
*/
teamName?: string;
/**
* 范围内打卡0范围内打卡 1任何地点打卡默认为1
*/
isClockIn?: number;
/**
* 备注
*/
remark?: string;
}
export interface ProjectTeamQuery extends PageQuery {
/**
* 项目id
*/
projectId?: string | number;
peopleNumber?: string | number;
/**
* 班组名称
*/
teamName?: string;
/**
* 范围内打卡0范围内打卡 1任何地点打卡默认为1
*/
isClockIn?: number;
/**
* 日期范围参数
*/
params?: any;
}
export interface ProjectTeamForemanResp {
/**
* 班组id
*/
id: string | number;
foremanList: foremanQuery[];
/**
* 班组名称
*/
teamName: string;
/**
* 项目id
*/
projectId: string | number;
}
export interface foremanQuery {
/**
* 班组长id
*/
foremanId: string | number;
/**
* 班组长名字
*/
foremanName: string;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProjectTeamMemberForm, ProjectTeamMemberQuery, ProjectTeamMemberVO } from '@/api/project/projectTeamMember/types';
/**
* 查询项目班组下的成员列表
* @param query
* @returns {*}
*/
export const listProjectTeamMember = (query?: ProjectTeamMemberQuery): AxiosPromise<ProjectTeamMemberVO[]> => {
return request({
url: '/project/projectTeamMember/list',
method: 'get',
params: query
});
};
/**
* 查询项目班组下的成员详细
* @param id
*/
export const getProjectTeamMember = (id: string | number): AxiosPromise<ProjectTeamMemberVO> => {
return request({
url: '/project/projectTeamMember/' + id,
method: 'get'
});
};
/**
* 新增项目班组下的成员
* @param data
*/
export const addProjectTeamMember = (data: ProjectTeamMemberForm): AxiosPromise<string | number> => {
return request({
url: '/project/projectTeamMember',
method: 'post',
data: data
});
};
/**
* 修改项目班组下的成员
* @param data
*/
export const updateProjectTeamMember = (data: ProjectTeamMemberForm) => {
return request({
url: '/project/projectTeamMember',
method: 'put',
data: data
});
};
/**
* 删除项目班组下的成员
* @param id
*/
export const delProjectTeamMember = (id: string | number | Array<string | number>) => {
return request({
url: '/project/projectTeamMember/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,105 @@
export interface ProjectTeamMemberVO {
/**
* 主键id
*/
id: string | number;
/**
* 班组id
*/
teamId: string | number;
/**
* 项目id
*/
projectId: string | number;
/**
* 施工人员id
*/
memberId: string | number;
/**
* 岗位默认为0普通员工1组长
*/
postId: string | number;
/**
* 施工人员姓名
*/
memberName: string;
/**
* 备注
*/
remark: string;
/**
* 创建时间
*/
createTime: string;
}
export interface ProjectTeamMemberForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 班组id
*/
teamId?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 施工人员id
*/
memberId?: string | number;
/**
* 岗位默认为0普通员工1组长
*/
postId?: string | number;
/**
* 备注
*/
remark?: string;
}
export interface ProjectTeamMemberQuery extends PageQuery {
/**
* 班组id
*/
teamId?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 施工人员id
*/
memberId?: string | number;
/**
* 施工人员姓名
*/
memberName?: string;
/**
* 岗位默认为0普通员工1组长
*/
postId?: string | number;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,75 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ReissueCardVO, ReissueCardForm, ReissueCardQuery, AuditReissueCardForm } from '@/api/project/reissueCard/types';
/**
* 查询施工人员补卡申请列表
* @param query
* @returns {*}
*/
export const listReissueCard = (query?: ReissueCardQuery): AxiosPromise<ReissueCardVO[]> => {
return request({
url: '/project/reissueCard/list',
method: 'get',
params: query
});
};
/**
* 查询施工人员补卡申请详细
* @param id
*/
export const getReissueCard = (id: string | number): AxiosPromise<ReissueCardVO> => {
return request({
url: '/project/reissueCard/' + id,
method: 'get'
});
};
/**
* 新增施工人员补卡申请
* @param data
*/
export const addReissueCard = (data: ReissueCardForm) => {
return request({
url: '/project/reissueCard',
method: 'post',
data: data
});
};
/**
* 修改施工人员补卡申请
* @param data
*/
export const updateReissueCard = (data: ReissueCardForm) => {
return request({
url: '/project/reissueCard',
method: 'put',
data: data
});
};
/**
* 删除施工人员补卡申请
* @param id
*/
export const delReissueCard = (id: string | number | Array<string | number>) => {
return request({
url: '/project/reissueCard/' + id,
method: 'delete'
});
};
/**
* 管理员审核施工人员补卡申请
* @param data
*/
export const AuditReissueCard = (data: AuditReissueCardForm) => {
return request({
url: '/project/reissueCard/review/manager',
method: 'put',
data: data
});
};

View File

@ -0,0 +1,173 @@
export interface ReissueCardVO {
/**
* 申请人名字
*/
userName: string;
id?: string | number;
status?: string;
managerName?: string;
/**
* 申请补卡说明
*/
userExplain: string;
/**
* 补卡申请时间
*/
userTime: string;
/**
* 班组长名字
*/
gangerName: string;
/**
* 班组长意见1未读 2同意 3拒绝
*/
gangerOpinion: string;
/**
* 班组长说明
*/
gangerExplain: string;
/**
* 班组长操作时间
*/
gangerTime: string;
/**
* 管理员意见1未读 2同意 3拒绝
*/
managerOpinion: string;
/**
* 管理员说明
*/
managerExplain: string;
/**
* 管理员操作时间
*/
managerTime: string;
/**
* 备注
*/
remark: string;
}
export interface AuditReissueCardForm {
/**
* 主键id
*/
id?: string | number;
/**
* 管理员意见
*/
managerOpinion?: string;
/**
* 管理员说明
*/
managerExplain?: string;
/**
* 备注
*/
remark?: string;
}
export interface ReissueCardForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 申请人id
*/
userId?: string | number;
/**
* 申请补卡说明
*/
userExplain?: string;
/**
* 班组长
*/
gangerId?: string | number;
/**
* 班组长意见1未读 2同意 3拒绝
*/
gangerOpinion?: string;
/**
* 班组长说明
*/
gangerExplain?: string;
/**
* 管理员意见1未读 2同意 3拒绝
*/
managerOpinion?: string;
/**
* 管理员说明
*/
managerExplain?: string;
/**
* 项目id
*/
projectId?: string | number;
/**
* 考勤表主键id
*/
attendanceId?: string | number;
/**
* 备注
*/
remark?: string;
}
export interface ReissueCardQuery extends PageQuery {
/**
* 申请人名字
*/
userName?: string;
/**
* 班组长意见1未读 2同意 3拒绝
*/
gangerOpinion?: string;
/**
* 管理员意见1未读 2同意 3拒绝
*/
managerOpinion?: string;
/**
* 项目id
*/
projectId?: string | number;
/**
* 班组id
*/
teamId?: string | number;
/**
* 补卡类型1上班 2下班
*/
reissueCardType?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SubcontractVO, SubcontractForm, SubcontractQuery } from '@/api/project/subcontract/types';
/**
* 查询分包合同列表
* @param query
* @returns {*}
*/
export const listSubcontract = (query?: SubcontractQuery): AxiosPromise<SubcontractVO[]> => {
return request({
url: '/contractor/subcontract/list',
method: 'get',
params: query
});
};
/**
* 查询分包合同详细
* @param id
*/
export const getSubcontract = (id: string | number): AxiosPromise<SubcontractVO> => {
return request({
url: '/contractor/subcontract/' + id,
method: 'get'
});
};
/**
* 新增分包合同
* @param data
*/
export const addSubcontract = (data: SubcontractForm) => {
return request({
url: '/contractor/subcontract',
method: 'post',
data: data
});
};
/**
* 修改分包合同
* @param data
*/
export const updateSubcontract = (data: SubcontractForm) => {
return request({
url: '/contractor/subcontract',
method: 'put',
data: data
});
};
/**
* 删除分包合同
* @param id
*/
export const delSubcontract = (id: string | number | Array<string | number>) => {
return request({
url: '/contractor/subcontract/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,136 @@
export interface SubcontractVO {
/**
* 项目id
*/
projectId: string | number;
/**
* 分包方id
*/
contractorId: string | number;
/**
* 合同文件id
*/
contractFileId: string | number;
/**
* 合同编号
*/
contractNumber: string;
/**
* 合同名称
*/
contractName: string;
/**
* 合同类型
*/
contractType: string;
/**
* 合同金额
*/
contractAmount: number;
/**
* 合同时间
*/
contractTime: string;
/**
* 备注
*/
remark: string;
}
export interface SubcontractForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包方id
*/
contractorId?: string | number;
/**
* 合同文件id
*/
contractFileId?: string | number;
/**
* 合同编号
*/
contractNumber?: string;
/**
* 合同名称
*/
contractName?: string;
/**
* 合同类型
*/
contractType?: string;
/**
* 合同金额
*/
contractAmount?: number;
/**
* 合同时间
*/
contractTime?: string;
/**
* 备注
*/
remark?: string;
}
export interface SubcontractQuery extends PageQuery {
/**
* 项目id
*/
projectId?: string | number;
/**
* 分包方id
*/
contractorId?: string | number;
/**
* 合同编号
*/
contractNumber?: string;
/**
* 合同名称
*/
contractName?: string;
/**
* 合同类型
*/
contractType?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WorkWageVO, WorkWageForm, WorkWageQuery } from '@/api/project/workWage/types';
/**
* 查询工种薪水列表
* @param query
* @returns {*}
*/
export const listWorkWage = (query?: WorkWageQuery): AxiosPromise<WorkWageVO[]> => {
return request({
url: '/project/workWage/list',
method: 'get',
params: query
});
};
/**
* 查询工种薪水详细
* @param id
*/
export const getWorkWage = (id: string | number): AxiosPromise<WorkWageVO> => {
return request({
url: '/project/workWage/' + id,
method: 'get'
});
};
/**
* 新增工种薪水
* @param data
*/
export const addWorkWage = (data: WorkWageForm) => {
return request({
url: '/project/workWage',
method: 'post',
data: data
});
};
/**
* 修改工种薪水
* @param data
*/
export const updateWorkWage = (data: WorkWageForm) => {
return request({
url: '/project/workWage',
method: 'put',
data: data
});
};
/**
* 删除工种薪水
* @param id
*/
export const delWorkWage = (id: string | number | Array<string | number>) => {
return request({
url: '/project/workWage/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,131 @@
export interface WorkWageVO {
/**
* 主键id
*/
id: string | number;
/**
* 项目id
*/
projectId: string | number;
/**
* 工种
*/
workType: string;
/**
* 是否是特种兵1是 2否
*/
isSpecialType: string;
/**
* 工资计算方式1计时 2计件
*/
wageCalculationType: string;
/**
* 工资标准
*/
wage: number;
/**
* 工资计量单位
*/
wageMeasureUnit: string;
/**
* 备注
*/
remark: string;
}
export interface SpecialType{
label:string;//名称
value:number | string;//id
}
export interface WorkWageForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 工种
*/
workType?: string;
/**
* 是否是特种兵1是 2否
*/
isSpecialType?: string;
/**
* 工资计算方式1计时 2计件
*/
wageCalculationType?: string;
/**
* 工资标准
*/
wage?: number;
/**
* 工资计量单位
*/
wageMeasureUnit?: string;
/**
* 备注
*/
remark?: string;
}
export interface WorkWageQuery extends PageQuery {
/**
* 项目id
*/
projectId?: string | number;
/**
* 工种
*/
workType?: string;
/**
* 是否是特种兵1是 2否
*/
isSpecialType?: string;
/**
* 工资计算方式1计时 2计件
*/
wageCalculationType?: string;
/**
* 工资标准
*/
wage?: number;
/**
* 工资计量单位
*/
wageMeasureUnit?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WorkerDailyReportVO, WorkerDailyReportForm, WorkerDailyReportQuery } from '@/api/project/workerDailyReport/types';
/**
* 查询施工人员日报列表
* @param query
* @returns {*}
*/
export const listWorkerDailyReport = (query?: WorkerDailyReportQuery): AxiosPromise<WorkerDailyReportVO[]> => {
return request({
url: '/project/workerDailyReport/list',
method: 'get',
params: query
});
};
/**
* 查询施工人员日报详细
* @param id
*/
export const getWorkerDailyReport = (id: string | number): AxiosPromise<WorkerDailyReportVO> => {
return request({
url: '/project/workerDailyReport/' + id,
method: 'get'
});
};
/**
* 新增施工人员日报
* @param data
*/
export const addWorkerDailyReport = (data: WorkerDailyReportForm) => {
return request({
url: '/project/workerDailyReport',
method: 'post',
data: data
});
};
/**
* 修改施工人员日报
* @param data
*/
export const updateWorkerDailyReport = (data: WorkerDailyReportForm) => {
return request({
url: '/project/workerDailyReport',
method: 'put',
data: data
});
};
/**
* 删除施工人员日报
* @param id
*/
export const delWorkerDailyReport = (id: string | number | Array<string | number>) => {
return request({
url: '/project/workerDailyReport/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,132 @@
export interface WorkerDailyReportVO {
/**
* 申请人名字
*/
userName: string;
userId?: string;
id?: string;
/**
* 今日完成工作
*/
todayCompletedWork: string;
/**
* 未完成工作
*/
unfinishedWork: string;
/**
* 明日工作
*/
tomorrowWork: string;
/**
* 需协调与帮助
*/
coordinationHelp: string;
}
export interface WorkerDailyReportForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 项目id
*/
projectId?: string | number;
teamName?: string;
resubmitReason?: string;
reportDate?: string;
isResubmit: string;
/**
* 班组id
*/
teamId?: string | number;
/**
* 申请人id
*/
userId?: string | number;
/**
* 申请人名字
*/
userName?: string;
/**
* 今日完成工作
*/
todayCompletedWork?: string;
/**
* 未完成工作
*/
unfinishedWork?: string;
/**
* 明日工作
*/
tomorrowWork?: string;
/**
* 需协调与帮助
*/
coordinationHelp?: string;
/**
* 附件
*/
fileList?: Array<string>;
dailyPieceItemVoList?: dailyPieceItemVO[];
}
interface dailyPieceItemVO {
/**
* 主键id
*/
id?: string | number;
/**
* 计件类型
*/
pieceType?: string;
/**
* 数量
*/
pieceCount?: number;
pieceUnit?: string;
remark?: string;
}
export interface WorkerDailyReportQuery extends PageQuery {
/**
* 项目id
*/
projectId?: string | number;
/**
* 班组id
*/
teamId?: string | number;
/**
* 申请人id
*/
userId?: string | number;
/**
* 申请人名字
*/
userName?: string;
/**
* 日期范围参数
*/
params?: any;
isResubmit?: string;
}

View File

@ -57,3 +57,19 @@ export interface TenantInfo {
tenantEnabled: boolean; tenantEnabled: boolean;
voList: TenantVO[]; voList: TenantVO[];
} }
/**
* 根据用户获得工程列表
* */
export interface UserProject {
id: string;
userId: number;
projectId: string;
projectName: string;
shortName: string;
}
export interface IdAndNameVO {
id: string | number;
name: string;
}

View File

@ -0,0 +1,164 @@
<template>
<div class="select-container" v-loading.fullscreen.lock="fullscreenLoading">
<label for="projectSelect" class="select-label">项目列表:</label>
<el-select
id="projectSelect"
v-model="selectedProjectId"
placeholder="全部工程项目"
clearable
filterable
@change="handleSelect"
style="width: 150px; margin-right: 20px"
>
<el-option v-for="project in projects" :key="project.id" :label="project.name" :value="project.id" />
</el-select>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, watch } from 'vue';
import { useUserStore } from '@/store/modules/user';
import router from '@/router';
import usePermissionStore from '@/store/modules/permission';
import { changeProject } from '@/api/project/project';
const fullscreenLoading = ref(false);
const userStore = useUserStore();
const projects = computed(() => [
// { id: '', name: '全部工程项目' }, // 添加空选项
...userStore.projects
]);
const proxy = getCurrentInstance()?.proxy as any;
const selectedProjectId = ref(userStore.selectedProject?.id || '');
// 监听 userStore.selectedProject 变化,更新 selectedProjectId
watch(
() => userStore.selectedProject,
(newProject) => {
selectedProjectId.value = newProject?.id ?? ''; // 避免 undefined 导致 placeholder 显示
},
{ deep: true }
);
/** 切换项目逻辑 */
const handleSelect = async (projectId: string) => {
proxy.$cache.local.setJSON('isCheckRole', 'true');
const userStore = useUserStore();
const permissionStore = usePermissionStore();
const selectedProject = projects.value.find((p) => p.id === projectId);
if (!selectedProject) return;
const loadingInstance = ElLoading.service({
lock: true,
text: '项目切换中...',
background: 'rgba(0, 0, 0, 0.7)'
});
setTimeout(() => {
if (loadingInstance && loadingInstance.visible) {
loadingInstance.close();
}
}, 3000);
await changeProject(projectId);
console.log('切换项目', selectedProject);
// 更新项目 & 权限
userStore.setSelectedProject(selectedProject);
await userStore.setInfo();
await userStore.setRoles(); // 这里会刷新 permissions/roles
// 重新生成路由
permissionStore.generateRoutes().then((routeList) => {
const currentPath = router.currentRoute.value.fullPath;
const exist = currentPath == '/' || currentPath == '/index' ? true : routeExists(currentPath, routeList);
if (exist) return loadingInstance.close();
proxy?.$tab.closeAllPage();
router.push('/index');
loadingInstance.close();
// 刷新当前路由
});
};
function routeExists(fullPath: string, routes: any[], parentPath = ''): boolean {
for (const route of routes) {
// 拼接完整 path
let currentPath = route.path.startsWith('/') ? route.path : `${parentPath}/${route.path}`;
// 处理多余的 "//"
currentPath = currentPath.replace(/\/+/g, '/');
// 判断
if (currentPath === fullPath) {
return true;
}
// 递归子路由
if (route.children && route.children.length > 0) {
if (routeExists(fullPath, route.children, currentPath)) {
return true;
}
}
}
return false;
}
</script>
<style lang="scss" scoped>
.select-container {
display: flex;
align-items: center; // 上下居中对齐
gap: 10px; // label 和 select 之间的间距
}
.select-label {
font-weight: bold;
color: #333;
white-space: nowrap; // 防止 label 换行
font-size: 14px; // 设置字体大小
}
#projectSelect {
.el-select {
width: 400px; // 保持宽度
.el-input__inner {
height: 38px;
border-radius: 4px;
border: 1px solid #dcdfe6;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
&:hover {
border-color: #409eff;
}
&:focus {
border-color: #409eff;
box-shadow: 0 0 5px rgba(64, 158, 255, 0.3);
}
}
.el-input__icon {
line-height: 38px;
}
}
&.is-focus .el-input__inner {
border-color: #409eff;
}
}
// 响应式设计(可选)
@media (max-width: 768px) {
.select-container {
flex-direction: column; // 栈式布局
align-items: flex-start; // 左对齐
.select-label {
margin-bottom: 5px; // label 和 select 之间的垂直间距
}
#projectSelect .el-select {
width: 100%; // 在小屏幕上占满宽度
}
}
}
</style>

View File

@ -21,19 +21,23 @@
<template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template> <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
</el-select> </el-select>
<!-- <header-search id="header-search" class="right-menu-item" /> -->
<search-menu ref="searchMenuRef" /> <search-menu ref="searchMenuRef" />
<el-tooltip content="搜索" effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<ProjectSelector />
</el-tooltip>
<!-- <el-tooltip content="搜索" effect="dark" placement="bottom">
<div class="right-menu-item hover-effect" @click="openSearchMenu"> <div class="right-menu-item hover-effect" @click="openSearchMenu">
<svg-icon class-name="search-icon" icon-class="search" /> <svg-icon class-name="search-icon" icon-class="search" />
</div> </div>
</el-tooltip> </el-tooltip> -->
<!-- 消息 --> <!-- 消息 -->
<el-tooltip :content="proxy.$t('navbar.message')" effect="dark" placement="bottom"> <el-tooltip :content="proxy.$t('navbar.message')" effect="dark" placement="bottom">
<div> <div>
<el-popover placement="bottom" trigger="click" transition="el-zoom-in-top" :width="300" :persistent="false"> <el-popover placement="bottom" trigger="click" transition="el-zoom-in-top" :width="300" :persistent="false">
<template #reference> <template #reference>
<el-badge :value="newNotice > 0 ? newNotice : ''" :max="99"> <el-badge :value="newNotice > 0 ? newNotice : ''" :max="99">
<div class="right-menu-item hover-effect" style="display: block"><svg-icon icon-class="message" /></div> <svg-icon icon-class="message" />
</el-badge> </el-badge>
</template> </template>
<template #default> <template #default>
@ -42,22 +46,12 @@
</el-popover> </el-popover>
</div> </div>
</el-tooltip> </el-tooltip>
<el-tooltip content="Github" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip :content="proxy.$t('navbar.document')" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip :content="proxy.$t('navbar.full')" effect="dark" placement="bottom"> <el-tooltip :content="proxy.$t('navbar.full')" effect="dark" placement="bottom">
<screenfull id="screenfull" class="right-menu-item hover-effect" /> <screenfull id="screenfull" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
<el-tooltip :content="proxy.$t('navbar.language')" effect="dark" placement="bottom"> <el-tooltip :content="proxy.$t('navbar.language')" effect="dark" placement="bottom">
<lang-select id="lang-select" class="right-menu-item hover-effect" /> <lang-select id="lang-select" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
<el-tooltip :content="proxy.$t('navbar.layoutSize')" effect="dark" placement="bottom"> <el-tooltip :content="proxy.$t('navbar.layoutSize')" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" /> <size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
@ -90,7 +84,7 @@
<script setup lang="ts"> <script setup lang="ts">
import SearchMenu from './TopBar/search.vue'; import SearchMenu from './TopBar/search.vue';
import { useAppStore } from '@/store/modules/app'; import { useAppStore } from '@/store/modules/app';
import { useUserStore } from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import { useSettingsStore } from '@/store/modules/settings'; import { useSettingsStore } from '@/store/modules/settings';
import { useNoticeStore } from '@/store/modules/notice'; import { useNoticeStore } from '@/store/modules/notice';
import { getTenantList } from '@/api/login'; import { getTenantList } from '@/api/login';
@ -98,8 +92,7 @@ import { dynamicClear, dynamicTenant } from '@/api/system/tenant';
import { TenantVO } from '@/api/types'; import { TenantVO } from '@/api/types';
import notice from './notice/index.vue'; import notice from './notice/index.vue';
import router from '@/router'; import router from '@/router';
import { ElMessageBoxOptions } from 'element-plus/es/components/message-box/src/message-box.type'; import ProjectSelector from '@/components/ProjectSelector/index.vue';
const appStore = useAppStore(); const appStore = useAppStore();
const userStore = useUserStore(); const userStore = useUserStore();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
@ -128,8 +121,8 @@ const dynamicTenantEvent = async (tenantId: string) => {
await dynamicTenant(tenantId); await dynamicTenant(tenantId);
dynamic.value = true; dynamic.value = true;
await proxy?.$router.push('/'); await proxy?.$router.push('/');
await proxy?.$tab.closeAllPage(); await proxy?.proxy.$tab.closeAllPage();
await proxy?.$tab.refreshPage(); await proxy?.proxy.$tab.refreshPage();
} }
}; };
@ -137,8 +130,8 @@ const dynamicClearEvent = async () => {
await dynamicClear(); await dynamicClear();
dynamic.value = false; dynamic.value = false;
await proxy?.$router.push('/'); await proxy?.$router.push('/');
await proxy?.$tab.closeAllPage(); await proxy?.proxy.$tab.closeAllPage();
await proxy?.$tab.refreshPage(); await proxy?.proxy.$tab.refreshPage();
}; };
/** 租户列表 */ /** 租户列表 */
@ -163,7 +156,7 @@ const logout = async () => {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
} as ElMessageBoxOptions); });
userStore.logout().then(() => { userStore.logout().then(() => {
router.replace({ router.replace({
path: '/login', path: '/login',
@ -171,7 +164,6 @@ const logout = async () => {
redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/') redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/')
} }
}); });
proxy?.$tab.closeAllPage();
}); });
}; };

View File

@ -1,3 +1,4 @@
import $cache from '@/plugins/cache';
import { to as tos } from 'await-to-js'; import { to as tos } from 'await-to-js';
import router from './router'; import router from './router';
import NProgress from 'nprogress'; import NProgress from 'nprogress';
@ -5,10 +6,11 @@ import 'nprogress/nprogress.css';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { isHttp, isPathMatch } from '@/utils/validate'; import { isHttp, isPathMatch } from '@/utils/validate';
import { isRelogin } from '@/utils/request'; import { isRelogin } from '@/utils/request';
import { useUserStore } from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import { useSettingsStore } from '@/store/modules/settings'; import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission'; import usePermissionStore from '@/store/modules/permission';
import { ElMessage } from 'element-plus/es';
let isFirst = false;
NProgress.configure({ showSpinner: false }); NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*']; const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*'];
@ -17,52 +19,59 @@ const isWhiteList = (path: string) => {
return whiteList.some((pattern) => isPathMatch(pattern, path)); return whiteList.some((pattern) => isPathMatch(pattern, path));
}; };
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from) => {
NProgress.start(); NProgress.start();
// 已登录
if (getToken()) { if (getToken()) {
to.meta.title && useSettingsStore().setTitle(to.meta.title as string); if (to.meta.title) useSettingsStore().setTitle(to.meta.title);
/* has token*/
if (to.path === '/login') { if (to.path === '/login') {
next({ path: '/' });
NProgress.done(); NProgress.done();
} else if (isWhiteList(to.path)) { return { path: '/' };
next(); }
} else {
if (useUserStore().roles.length === 0) { if (isWhiteList(to.path)) {
return true;
}
if ((!isFirst && useUserStore().roles.length === 0) || $cache.local.getJSON('isCheckRole') === 'true') {
isFirst = true;
isRelogin.show = true; isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息
const [err] = await tos(useUserStore().getInfo()); const [err] = await tos(useUserStore().getInfo());
if (err) { if (err) {
await useUserStore().logout(); await useUserStore().logout();
ElMessage.error(err); ElMessage.error(err);
next({ path: '/' }); NProgress.done();
} else { return { path: '/' };
}
isRelogin.show = false; isRelogin.show = false;
const accessRoutes = await usePermissionStore().generateRoutes(); const accessRoutes = await usePermissionStore().generateRoutes();
// 根据roles权限生成可访问的路由表
accessRoutes.forEach((route) => { accessRoutes.forEach((route) => {
if (!isHttp(route.path)) { if (!isHttp(route.path)) router.addRoute(route);
router.addRoute(route); // 动态添加可访问路由表
}
}); });
// @ts-expect-error hack方法 确保addRoutes已完成
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成 $cache.local.remove('isCheckRole');
// 确保路由已添加后再跳转
return { ...to, replace: true };
} }
return true;
} else { } else {
next(); isFirst = false;
} }
}
} else { // 未登录
// 没有token
if (isWhiteList(to.path)) { if (isWhiteList(to.path)) {
// 在免登录白名单,直接进入 return true;
next(); }
} else {
const redirect = encodeURIComponent(to.fullPath || '/'); const redirect = encodeURIComponent(to.fullPath || '/');
next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页
NProgress.done(); NProgress.done();
} return { path: `/login?redirect=${redirect}` };
}
}); });
router.afterEach(() => { router.afterEach(() => {

View File

@ -4,11 +4,13 @@ import store from '@/store';
import { getRouters } from '@/api/menu'; import { getRouters } from '@/api/menu';
import auth from '@/plugins/auth'; import auth from '@/plugins/auth';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/index.vue'; import Layout from '@/layout/index.vue';
import ParentView from '@/components/ParentView/index.vue'; import ParentView from '@/components/ParentView/index.vue';
import InnerLink from '@/layout/components/InnerLink/index.vue'; import InnerLink from '@/layout/components/InnerLink/index.vue';
import { ref } from 'vue';
import { createCustomNameComponent } from '@/utils/createCustomNameComponent'; import { createCustomNameComponent } from '@/utils/createCustomNameComponent';
import { useUserStore } from './user';
// 匹配views里面所有的.vue文件 // 匹配views里面所有的.vue文件
const modules = import.meta.glob('./../../views/**/*.vue'); const modules = import.meta.glob('./../../views/**/*.vue');
@ -22,9 +24,6 @@ export const usePermissionStore = defineStore('permission', () => {
const getRoutes = (): RouteRecordRaw[] => { const getRoutes = (): RouteRecordRaw[] => {
return routes.value as RouteRecordRaw[]; return routes.value as RouteRecordRaw[];
}; };
const getDefaultRoutes = (): RouteRecordRaw[] => {
return defaultRoutes.value as RouteRecordRaw[];
};
const getSidebarRoutes = (): RouteRecordRaw[] => { const getSidebarRoutes = (): RouteRecordRaw[] => {
return sidebarRouters.value as RouteRecordRaw[]; return sidebarRouters.value as RouteRecordRaw[];
}; };
@ -46,7 +45,7 @@ export const usePermissionStore = defineStore('permission', () => {
sidebarRouters.value = routes; sidebarRouters.value = routes;
}; };
const generateRoutes = async (): Promise<RouteRecordRaw[]> => { const generateRoutes = async (): Promise<RouteRecordRaw[]> => {
const res = await getRouters(); const res = await getRouters(useUserStore().selectedProject?.id || '0');
const { data } = res; const { data } = res;
const sdata = JSON.parse(JSON.stringify(data)); const sdata = JSON.parse(JSON.stringify(data));
const rdata = JSON.parse(JSON.stringify(data)); const rdata = JSON.parse(JSON.stringify(data));
@ -100,12 +99,27 @@ export const usePermissionStore = defineStore('permission', () => {
const filterChildren = (childrenMap: RouteRecordRaw[], lastRouter?: RouteRecordRaw): RouteRecordRaw[] => { const filterChildren = (childrenMap: RouteRecordRaw[], lastRouter?: RouteRecordRaw): RouteRecordRaw[] => {
let children: RouteRecordRaw[] = []; let children: RouteRecordRaw[] = [];
childrenMap.forEach((el) => { childrenMap.forEach((el) => {
el.path = lastRouter ? lastRouter.path + '/' + el.path : el.path; if (el.children && el.children.length) {
if (el.children && el.children.length && el.component?.toString() === 'ParentView') { if (el.component?.toString() === 'ParentView' && !lastRouter) {
children = children.concat(filterChildren(el.children, el)); el.children.forEach((c) => {
} else { c.path = el.path + '/' + c.path;
children.push(el); if (c.children && c.children.length) {
children = children.concat(filterChildren(c.children, c));
return;
} }
children.push(c);
});
return;
}
}
if (lastRouter) {
el.path = lastRouter.path + '/' + el.path;
if (el.children && el.children.length) {
children = children.concat(filterChildren(el.children, el));
return;
}
}
children = children.concat(el);
}); });
return children; return children;
}; };
@ -116,7 +130,6 @@ export const usePermissionStore = defineStore('permission', () => {
defaultRoutes, defaultRoutes,
getRoutes, getRoutes,
getDefaultRoutes,
getSidebarRoutes, getSidebarRoutes,
getTopbarRoutes, getTopbarRoutes,
@ -205,3 +218,5 @@ function duplicateRouteChecker(localRoutes: Route[], routes: Route[]) {
nameList.push(route.name.toString()); nameList.push(route.name.toString());
}); });
} }
export default usePermissionStore;

View File

@ -1,10 +1,22 @@
import { to } from 'await-to-js'; import { to } from 'await-to-js';
import { getToken, removeToken, setToken } from '@/utils/auth'; import { getToken, removeToken, setToken } from '@/utils/auth';
import { login as loginApi, logout as logoutApi, getInfo as getUserInfo } from '@/api/login'; import { login as loginApi, logout as logoutApi, getInfo as getUserInfo, getUserProject } from '@/api/login';
import { LoginData } from '@/api/types'; import { LoginData, UserProject } from '@/api/types';
import defAva from '@/assets/images/profile.jpg'; import defAva from '@/assets/images/profile.jpg';
import store from '@/store';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { ref } from 'vue'; import $cache from '@/plugins/cache';
// 添加两个函数用于操作localStorage
const saveSelectedProjectToStorage = (project) => {
// localStorage.setItem('selectedProject', JSON.stringify(project));
$cache.local.setJSON('selectedProject', project);
};
const getSelectedProjectFromStorage = () => {
// localStorage.getItem('selectedProject');
const stored = $cache.local.getJSON('selectedProject');
return stored ? stored : null;
};
export const useUserStore = defineStore('user', () => { export const useUserStore = defineStore('user', () => {
const token = ref(getToken()); const token = ref(getToken());
@ -12,9 +24,16 @@ export const useUserStore = defineStore('user', () => {
const nickname = ref(''); const nickname = ref('');
const userId = ref<string | number>(''); const userId = ref<string | number>('');
const tenantId = ref<string>(''); const tenantId = ref<string>('');
const deptId = ref<string | number>('');
const avatar = ref(''); const avatar = ref('');
const roles = ref<Array<string>>([]); // 用户角色编码集合 → 判断路由权限 const roles = ref<Array<string>>([]); // 用户角色编码集合 → 判断路由权限
const permissions = ref<Array<string>>([]); // 用户权限编码集合 → 判断按钮权限 const permissions = ref<Array<any>>([]); // 用户权限编码集合 → 判断按钮权限
const permissionList = ref<Array<any>>([]); // 用户所有权限列表
const roleList = ref<Array<any>>([]); // 用户所有角色列表
const projects = ref<Array<{ id: string; name: string }>>([]);
// 从localStorage获取缓存的项目如果没有则默认为null
const selectedProject = ref<{ id: string; name: string } | null>(getSelectedProjectFromStorage());
/** /**
* 登录 * 登录
@ -34,16 +53,37 @@ export const useUserStore = defineStore('user', () => {
// 获取用户信息 // 获取用户信息
const getInfo = async (): Promise<void> => { const getInfo = async (): Promise<void> => {
// **新增项目数据获取**
const [projectErr, projectRes] = await to(getUserProject());
if (projectRes?.data) {
const projectList = projectRes.data.map((p) => ({
id: p.projectId,
name: p.projectName || '未知项目'
}));
setProjects(projectList);
// 如果有缓存的选中项目,且该项目在当前项目列表中存在,则使用缓存的项目
const storedProject = getSelectedProjectFromStorage();
if (storedProject && projectList.some((p) => p.id === storedProject.id)) {
setSelectedProject(storedProject);
} else if (projectList.length > 0) {
// 否则默认选择第一个项目
setSelectedProject(projectList[0]);
}
}
const [err, res] = await to(getUserInfo()); const [err, res] = await to(getUserInfo());
console.log(111111111111);
if (res) { if (res) {
const data = res.data; const data = res.data;
const user = data.user; const user = data.user;
const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar; const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar;
if (data.roles && data.roles.length > 0) { if (data.roles && data.roles.length > 0) {
// 验证返回的roles是否是一个非空数组 setRoles();
roles.value = data.roles; permissionList.value = data.permissions;
permissions.value = data.permissions; roleList.value = data.roles;
} else { } else {
roles.value = ['ROLE_DEFAULT']; roles.value = ['ROLE_DEFAULT'];
} }
@ -52,11 +92,44 @@ export const useUserStore = defineStore('user', () => {
avatar.value = profile; avatar.value = profile;
userId.value = user.userId; userId.value = user.userId;
tenantId.value = user.tenantId; tenantId.value = user.tenantId;
deptId.value = user.deptId;
return Promise.resolve(); return Promise.resolve();
} }
return Promise.reject(err); return Promise.reject(err);
}; };
const setInfo = async () => {
const [err, res] = await to(getUserInfo());
if (res) {
const data = res.data;
const user = data.user;
const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar;
if (data.roles && data.roles.length > 0) {
setRoles();
permissionList.value = data.permissions;
roleList.value = data.roles;
} else {
roles.value = ['ROLE_DEFAULT'];
}
name.value = user.userName;
nickname.value = user.nickName;
avatar.value = profile;
userId.value = user.userId;
tenantId.value = user.tenantId;
deptId.value = user.deptId;
}
};
const setRoles = () => {
const projectRole = roleList.value.find((item) => item.projectId == selectedProject.value?.id)?.projectRoles || [];
roles.value = projectRole;
const projectPermissions = permissionList.value.find((item) => item.projectId == selectedProject.value?.id)?.projectPermissions || [];
permissions.value = projectPermissions;
};
// 注销 // 注销
const logout = async (): Promise<void> => { const logout = async (): Promise<void> => {
await logoutApi(); await logoutApi();
@ -64,15 +137,28 @@ export const useUserStore = defineStore('user', () => {
roles.value = []; roles.value = [];
permissions.value = []; permissions.value = [];
removeToken(); removeToken();
// 清除项目缓存
$cache.local.remove('selectedProject');
$cache.local.remove('ProjectTeamList');
}; };
const setAvatar = (value: string) => { const setAvatar = (value: string) => {
avatar.value = value; avatar.value = value;
}; };
const setProjects = (projectList: Array<{ id: string; name: string }>) => {
projects.value = projectList;
};
const setSelectedProject = (project: { id: string; name: string }) => {
selectedProject.value = project;
saveSelectedProjectToStorage(project);
};
return { return {
userId, userId,
tenantId, tenantId,
deptId,
token, token,
nickname, nickname,
avatar, avatar,
@ -81,6 +167,19 @@ export const useUserStore = defineStore('user', () => {
login, login,
getInfo, getInfo,
logout, logout,
setAvatar setAvatar,
setProjects,
setSelectedProject,
projects,
selectedProject,
setInfo,
setRoles
}; };
}); });
export default useUserStore;
// 非 setup 方式
export function useUserStoreHook() {
return useUserStore(store);
}

View File

@ -2,7 +2,7 @@
<div class="login"> <div class="login">
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form"> <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
<div class="title-box"> <div class="title-box">
<h3 class="title">{{ title }}</h3> <h3 class="title">煤科建管平台</h3>
<lang-select /> <lang-select />
</div> </div>
<el-form-item v-if="tenantEnabled" prop="tenantId"> <el-form-item v-if="tenantEnabled" prop="tenantId">
@ -73,7 +73,7 @@
</el-form> </el-form>
<!-- 底部 --> <!-- 底部 -->
<div class="el-login-footer"> <div class="el-login-footer">
<span>Copyright © 2018-2025 疯狂的狮子Li All Rights Reserved.</span> <!-- <span></span> -->
</div> </div>
</div> </div>
</template> </template>
@ -89,15 +89,14 @@ import { useI18n } from 'vue-i18n';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const title = import.meta.env.VITE_APP_TITLE;
const userStore = useUserStore(); const userStore = useUserStore();
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const loginForm = ref<LoginData>({ const loginForm = ref<LoginData>({
tenantId: '000000', tenantId: '000000',
username: 'admin', username: '',
password: 'admin123', password: '',
rememberMe: false, rememberMe: false,
code: '', code: '',
uuid: '' uuid: ''
@ -154,6 +153,7 @@ const handleLogin = () => {
if (!err) { if (!err) {
const redirectUrl = redirect.value || '/'; const redirectUrl = redirect.value || '/';
await router.push(redirectUrl); await router.push(redirectUrl);
loading.value = false; loading.value = false;
} else { } else {
loading.value = false; loading.value = false;
@ -260,9 +260,10 @@ onMounted(() => {
background: #ffffff; background: #ffffff;
width: 400px; width: 400px;
padding: 25px 25px 5px 25px; padding: 25px 25px 5px 25px;
z-index: 1;
.el-input { .el-input {
height: 40px; height: 40px;
input { input {
height: 40px; height: 40px;
} }