Merge branch 'feature-yaojie' of https://git-fy.cn/WxxyDeveloper/Jsl-OA-Web-Re into feature-sht

This commit is contained in:
“XCYH” 2024-04-17 01:05:16 +08:00
commit d27d68d8d0
4 changed files with 961 additions and 60 deletions

15
src/api/message.js Normal file
View File

@ -0,0 +1,15 @@
function getCurrentTimestamp() {
return new Date().getTime();
}
export function login(data) {
return request({
url: '/message/get',
method: 'post',
data,
headers: {
'Timestamp':getCurrentTimestamp()
}
});
}

843
src/api/request.js Normal file
View File

@ -0,0 +1,843 @@
import axios from "axios";
import getCurrentTimestamp from "@/js/methods.js";
const api = 'http://nbxt.oa.x-lf.cn'
/**
* 登录
* @param data (user,password)
* @returns {*}
*/
const login = (data) => {
return axios({
url: api+"/auth/login",
method: "post",
data: data,
headers: {
'content-type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
},
})
}
/**
* 注册
* @param data (username,password,address,phone,email,sex,age)
* @returns {*}
*/
const register = (data) => {
return axios({
url: api + "/auth/register",
method: "post",
data: data,
headers: {
'content-type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 退出登录
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const logout = (token) => {
return axios({
url: api + "/auth/logout",
method: "get",
headers: {
'Authorization':'Bearer '+token,
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 修改密码
* @param data (oldPassword,newPassword,confirmPassword)
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const changePassword = (data, token) => {
return axios({
url: api + "/auth/password",
method: "put",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 忘记密码
* @param data (email,check邮箱验证码,newPassword)
* @returns {*}
*/
const forgetPassword = (data) => {
return axios({
url: api + "/auth/password/forget",
method: "put",
data: data,
headers: {
'content-type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 邮箱登录
* @param params 对象包含邮箱emailstring验证码codeinteger
* @returns {*}
*/
const authLoginWithEmail = (params) => {
return axios({
url: api + "/auth/login/email",
method: "get",
params: params,
headers: {
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 发送邮箱验证码
* @param email 邮箱string
* @returns {*}
*/
const authSendEmailCode = (email) => {
return axios({
url: api + "/auth/email/code",
method: "get",
params: email,
headers: {
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 获取全部用户信息
* @param data pagelimitsearchrole
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const userAllCurrent = (data, token) => {
return axios({
url: api + "/user/current/all",
method: "post",
data: data,
headers: {
'Authorization':'Bearer ' + token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 获取一个用户信息敏感
* @param params (id,username,email,phone)可以只传一个参数
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const userCurrent = (params, token) => {
return axios({
url: api + "/user/current",
method: "get",
params: params,
headers: {
'Authorization':'Bearer '+token,
// 'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 新增用户
* @param data (username,password,address,phone,email,sex,age)必须全部
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const userAdd = (data, token) => {
return axios({
url: api + "/user/add",
method: "post",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 编辑用户
* @param data (id,address,phone,email,age,signature,sex,avatar,nickname,description
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const userEdit = (data, token) => {
return axios({
url: api + "/user/edit",
method: "put",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 删除用户
* @param id
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const userDelete = (id, token) => {
return axios({
url: api + "/user/delete",
method: "delete",
params: {
id: id
},
headers: {
'Authorization':'Bearer '+token,
'content-type':'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 锁定用户
* @param data idisLock(1解锁)
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const userLock = (data, token) => {
return axios({
url: api + "/user/lock",
method: "put",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 获取用户信息非敏感
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const userGetProfile = (token) => {
return axios({
url: api + "/user/profile/get",
method: "get",
headers: {
'Authorization':'Bearer '+token,
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 修改用户信息普通用户
* @param data (id,username,address,phone,email,sex,age,signature,avatar,nickname,description)
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const userEditProfile = (data, token) => {
return axios({
url: api + "/user/profile/edit",
method: "put",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 查询角色
* @param id 可选不填则是查询所有
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const roleGet = (id, token) => {
return axios({
url: api + "/role/get",
method: "get",
params: id,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 新增角色
* @param data (name,displayName)示例(name:teacher, displayName:老师)必须
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const roleAdd = (data, token) => {
return axios({
url: api + "/role/add",
method: "post",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 编辑角色
* @param data (id,name,displayName中文)必须
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const roleEdit = (data, token) => {
return axios({
url: api + "/role/edit",
method: "put",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 删除角色
* @param id
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const roleDelete = (id, token) => {
return axios({
url: api + "/role/delete",
method: "delete",
params: id,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 给角色添加用户
* @param data riduid
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const roleAddUser = (data, token) => {
return axios({
url: api + "/role/user/add",
method: "post",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 修改用户的角色
* @param data uidrid
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const roleChangeUser = (data, token) => {
return axios({
url: api + "/role/user/change",
method: "put",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 移除用户的角色
* @param uid
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const roleRemoveUser = (uid, token) => {
return axios({
url: api + "/role/user/remove",
method: "delete",
data: uid,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 查询轮播图管理员
* @param id 可选
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const infoGetHeaderImage = (id, token) => {
return axios({
url: api + "/info/header-image/get",
method: "get",
params: id,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 编辑轮播图信息
* @param data (id,displayOrder排序顺序,image图片地址,title,description,isActive是否启用)
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const infoEditHeaderImage = ( data, token) => {
return axios({
url: api + "/info/header-image/edit",
method: "put",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 新增轮播图
* @param data (displayOrder,image,title,description,isActive)
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const infoAddHeaderImage = (data, token) => {
return axios({
url: api + "/info/header-image/add",
method: "post",
data: data,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 删除轮播图
* @param id
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const infoDeleteHeaderImage = (id, token) => {
return axios({
url: api + "/info/header-image/del",
method: "delete",
params: id,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 展示轮播图顺序或倒序
* @param showType 0倒序1顺序
* @param token
* @returns {Promise<AxiosResponse<any>> | *}
*/
const infoEditSettingHeaderImage = (showType, token) => {
return axios({
url: api + "/info/header-image/edit-setting",
method: "put",
data: showType,
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 展示我负责的项目
* @param data
* @param token
*/
const projectGet =(data, token) => {
const tags = data.tags
const isFinish = data.isFinish
// const principalUser = data.principalId
const encodedTags = tags.map(tag => encodeURIComponent(tag));
const encodedIsFinish = isFinish.map(is => encodeURIComponent(is))
const queryTags = `tags=${encodedTags.join('&tags=')}`;
const queryIsFinish = `isFinish=${encodedIsFinish.join('&isFinish=')}`;
return axios({
url:api+ `/project/get?${queryTags}&${queryIsFinish}`,
method: "get",
headers:{
'Authorization':'Bearer '+token,
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 新增项目
* @param token
* @param data
*/
const projectAdd =(token,data) => {
return axios({
url:api+ "/project/add",
method: "post",
data:data,
headers:{
'Authorization':'Bearer '+token,
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 展示游客查看的项目
*/
const projectGetCustom = (data) =>{
const tags = data.tags
const isFinish = data.isFinish
// const principalUser = data.principalId
const encodedTags = tags.map(tag => encodeURIComponent(tag));
const encodedIsFinish = isFinish.map(is => encodeURIComponent(is))
const queryTags = `tags=${encodedTags.join('&tags=')}`;
const queryIsFinish = `isFinish=${encodedIsFinish.join('&isFinish=')}`;
return axios({
url:`${api}/project/get/custom?id=${data.id}&${queryTags}&${queryIsFinish}`,
method: "get",
headers:{
'Timestamp': getCurrentTimestamp()
}
})
}
// projectGetCustom().interceptors.request.use(config => {
// let url = config.url
// if (config.params) {
// url += '?'
// const keys = Object.keys(config.params)
// for (const key of keys) {
// url += `${key}=${encodeURIComponent(config.params[key])}&`
// }
// url = url.substring(0, url.length-1)
// config.params = {}
// }
// config.url = url
// return config
// })
/**
* 展示全部消息
*
*/
const messageGet = (token) => {
return axios({
url:api + "/message/get",
method:"get",
headers:{
'Authorization':'Bearer '+token,
'content-type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 得到tag列表
* @param token
*/
const getTagsProjectList = () =>{
return axios({
url:api+ "/tags/project/list",
method: "get",
headers:{
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 得到tag列表
* @param data
* @param token
* 获取项目的所有子系统
*/
// const projectWorkGet = (data,token) => {
// return axios({
// url:api + "/project/work/get",
// method:"get",
// data:data,
// headers:{
// 'Authorization':'Bearer '+token,
// 'content-type': 'application/json;charset=utf-8',
// 'Timestamp': getCurrentTimestamp()
// }
// })
// }
const projectWorkGet = (data,token) =>{
const tags = data.tags
const isFinish = data.isFinish
const encodedTags = tags.map(tag => encodeURIComponent(tag));
const encodedIsFinish = isFinish.map(is => encodeURIComponent(is))
const queryTags = `tags=${encodedTags.join('&tags=')}`;
const queryIsFinish = `isFinish=${encodedIsFinish.join('&isFinish=')}`;
return axios({
url:`${api}/project/work/get?${queryTags}&${queryIsFinish}`,
method: "get",
headers:{
'content-type': 'application/json;charset=utf-8',
'Authorization':'Bearer '+token,
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 根据项目id获取项目信息
* @param id 项目id
* @param token 访问令牌
* @returns {Promise<AxiosResponse<any>> | *}
*/
const projectGetById = (id, token) => {
return axios({
url: api + "/project/get/id?id=" + id,
method: "get",
headers: {
'Authorization': 'Bearer ' + token,
'Timestamp': getCurrentTimestamp()
}
})
}
const projectWorkAdd = (data, token) => {
return axios({
url: api + "/project/work/add" ,
method: "post",
data:data,
headers: {
'Authorization': 'Bearer ' + token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
// data(id)
const projectDelete = (id, token) => {
return axios({
url: api + "/project/delete" ,
method: "delete",
params: {
id: id
},
headers: {
'Authorization': 'Bearer ' + token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 根据项目id获取子系统的所有信息
* @param projectId
* @param token
*/
const moduleGetByProjectId = (projectId, token) => {
return axios({
url: api + "/module/get?projectId=" + projectId,
method: "get",
// params: {
// projectId: projectId
// },
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 根据子系统id获取子模块信息
* @param sysId
* @param token
*/
const moduleGetBySysId = (sysId, token) => {
return axios({
url: api + "/module/get/min?sysId=" + sysId,
methods:"get",
headers: {
'Authorization':'Bearer '+token,
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
/*const moduleGetByProjectId = (projectId, token) => {
return axios ({
url:api + "/module/get",
methods:"get",
params:projectId,
headers:{
'Authorization':'Bearer '+token,
'content-type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}*/
const moduleDelete = (id, token) =>{
return axios({
url: api + "/module/delete/" + id,
method: "delete",
headers: {
'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp(),
'Authorization':'Bearer '+ token
}
})
}
/**
* 获取模块/子系统信息
* @param id
* @param token
* @returns {Promise<axios.AxiosResponse<any>> | *}
*/
const getModuleInfo = (id, token) => {
return axios({
url: api + "/project/getwork/id",
method: 'get',
params: {
id: id
},
headers: {
'Authorization':'Bearer '+token,
// 'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
const getPrincipalUser = (token) => {
return axios({
url: api + "/project/pri",
method: 'get',
headers: {
'Authorization':'Bearer '+token,
// 'Content-Type': 'application/json;charset=utf-8',
'Timestamp': getCurrentTimestamp()
}
})
}
export default {
login,
register,
logout,
changePassword,
forgetPassword,
authLoginWithEmail,
authSendEmailCode,
userAllCurrent,
userCurrent,
userAdd,
userEdit,
userDelete,
userLock,
userGetProfile,
userEditProfile,
roleGet,
roleEdit,
roleAdd,
roleDelete,
roleAddUser,
roleChangeUser,
roleRemoveUser,
infoGetHeaderImage,
infoEditHeaderImage,
infoAddHeaderImage,
infoDeleteHeaderImage,
infoEditSettingHeaderImage,
projectGet,
projectGetCustom,
projectAdd,
projectGetById,
projectWorkAdd,
getTagsProjectList,
projectWorkGet,
projectDelete,
moduleGetByProjectId,
moduleGetBySysId,
moduleDelete,
getModuleInfo,
messageGet,
getPrincipalUser
}

View File

@ -5,7 +5,7 @@
<template #header>
<span>消息</span>
</template>
<div style="display:flex;flex-direction:row;justify-content: space-around ">
<div style="display:flex;flex-direction:row;justify-content: space-between ">
<div>
时间
<el-date-picker
@ -20,23 +20,23 @@
style="margin-left:0.5vw"
/>
</div>
<div>
状态
<el-select
v-model="value"
clearable
placeholder="Status"
style="width: 240px;margin-left:0.5vw"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<!-- <div>-->
<!-- 状态-->
<!-- <el-select-->
<!-- v-model="value"-->
<!-- clearable-->
<!-- placeholder="Status"-->
<!-- style="width: 240px;margin-left:0.5vw"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="item in options"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- />-->
<!-- </el-select>-->
</div>
<!-- </div>-->
<div>
<el-button type="primary" style="width:80px">查询</el-button>
@ -58,14 +58,13 @@
<div class="table-cell">
<div class="date" style="display:flex;flex-direction: column">
<span style="color:skyblue">{{row.name}}</span>
<span>{{ row.date }}</span>
<span>{{ row.text }}</span>
</div>
</div>
<div class="table-cell">
<div>address: {{ row.address }}</div>
<div class="table-cell createdTime">
<div>{{ row.createdAt }}</div>
</div>
<div class="table-cell table-cell-right">
<el-button size="small" type="danger" @click="handleDelete(index, row)">Delete</el-button>
<el-button size="small" type="danger" @click="handleDelete(index, row);centerDialogVisible = true">Delete</el-button>
<el-dialog v-model="centerDialogVisible" title="删除" width="500" :modal="false">
<span>
@ -158,42 +157,43 @@ const options = [
];
//
interface User {
date: string
interface Message {
id: number
createdAt: string
name: string
address: string
text: string
}
const handleDelete = (index: number, row: User) => {
const handleDelete = (index: number, row: Message) => {
console.log(index, row);
};
const tableData: User[] = [
const tableData: Message[] = [
{
date: '2016-05-03',
id:1 ,
createdAt: '2016-05-03',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
text: 'No. 189, Grove St, Los Angeles'
},
{
date: '2016-05-02',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
},
{
date: '2016-05-04',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
},
{
date: '2016-05-01',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
},
{
date: '2016-05-01',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
}
{
id:1 ,
createdAt: '2016-05-03',
name: 'Tom',
text: 'No. 189, Grove St, Los Angeles'
},
{
id:1 ,
createdAt: '2016-05-03',
name: 'Tom',
text: 'No. 189, Grove St, Los Angeles'
},
{
id:1 ,
createdAt: '2016-05-03',
name: 'Tom',
text: 'No. 189, Grove St, Los Angeles'
},
];
</script>
<style>
@ -216,16 +216,19 @@ const tableData: User[] = [
.table-row {
display: flex;
align-items: center;
margin-bottom: 10px;
/*margin-bottom: 10px;*/
}
.table-cell {
flex: 1;
padding: 5px;
padding: 10px;
display: flex;
justify-content: space-between;
justify-content: center;
align-items: center;
}
.createdTime{
margin-left: 50px;
}
.table-cell-right {
justify-content: flex-end;
margin-right:5vw;

View File

@ -106,16 +106,56 @@
<el-table-column property="address" label="工作时间" />
<el-table-column property="address" label="操作" >
<el-button size="small" text style="color:deepskyblue" @click="EditDialogVisible = true">修改</el-button>
<el-dialog v-model="EditDialogVisible" title="删除" width="500" :modal="false">
<template #footer>
<div class="dialog-footer">
<el-button @click="EditDialogVisible = false">取消</el-button>
<el-button type="primary" @click="EditDialogVisible = false">
确认
</el-button>
<!-- <el-dialog v-model="EditDialogVisible" title="删除" width="500" :modal="false">-->
<el-dialog v-model="EditDialogVisible" width="500" center :modal="false" :show-close="false">
<template #header>
<div style="display:flex;flex-direction: row;justify-content: flex-start;color:#409eff;font-size:large" >编辑日报</div>
<el-divider content-position="left" style="background:red"><el-icon><CaretTop /></el-icon></el-divider>
</template>
<div>
<!-- <div style="margin-top:-4vh ">-->
<!-- <span style="color:red">项目名称</span>-->
<!-- <el-input-->
<!-- v-model="input"-->
<!-- style="width: 200px"-->
<!-- placeholder="请输入"-->
<!-- />-->
<!-- </div>-->
<div style="margin-top:-4vh ">
<span style="color:red"> 工作时间</span>
<el-date-picker
v-model="value1"
type="date"
placeholder="请选择日期"
style="width: 200px"
:default-value="new Date(2010, 9, 1)"
/>
</div>
<div style="margin-top:2vh ;display:flex;flex-direction:row;">
<span style="color: red">日报内容</span>
<el-input
v-model="textarea"
style="width: 300px;"
:rows="4"
type="textarea"
placeholder="请输入"
/>
</div>
</div>
</template>
</el-dialog>
<template #footer>
<div class="dialog-footer">
<el-button @click="EditDialogVisible = false">取消</el-button>
<el-button type="primary" @click="EditDialogVisible = false">
确认
</el-button>
</div>
</template>
</el-dialog>
</el-table-column>
</el-table>
<el-pagination