mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 06:51:23 +08:00
Add employee name suffixes to work item information. Add password modification function.
This commit is contained in:
@@ -16,6 +16,7 @@ import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -44,15 +45,17 @@ public class UserController {
|
||||
|
||||
@PutMapping("/passwd")
|
||||
@Operation(summary = "修改密码")
|
||||
public ResponseResult<?> modifyPasswd(String oldPasswd, String newPassword) {
|
||||
if (oldPasswd == null || newPassword == null) {
|
||||
public ResponseResult<?> modifyPasswd(@RequestBody Map<String, String> passwd) {
|
||||
String oldPasswd = passwd.get("oldPasswd");
|
||||
String newPasswd = passwd.get("newPasswd");
|
||||
if (oldPasswd == null || newPasswd == null) {
|
||||
throw new DataValidationFailedException();
|
||||
}
|
||||
newPassword = newPassword.trim();
|
||||
if (oldPasswd.isBlank() || oldPasswd.length() < 8 || oldPasswd.length() > 64 || newPassword.isBlank() || newPassword.length() < 8 || newPassword.length() > 64) {
|
||||
newPasswd = newPasswd.trim();
|
||||
if (oldPasswd.isBlank() || newPasswd.isBlank() || newPasswd.length() < 8 || newPasswd.length() > 64) {
|
||||
throw new DataValidationFailedException();
|
||||
}
|
||||
if (userService.modifyPasswd(oldPasswd, newPassword)) {
|
||||
if (userService.modifyPasswd(oldPasswd, newPasswd)) {
|
||||
return ResponseResult.databaseUpdateSuccess(null);
|
||||
} else {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "error", null);
|
||||
@@ -70,14 +73,14 @@ public class UserController {
|
||||
@PreAuthorize("hasAnyAuthority('work:manage:add', 'work:admin:add', 'attendance:manage:modify')")
|
||||
@Operation(summary = "获取同部门下所有用户")
|
||||
public ResponseResult<List<User>> getDepartmentUser() {
|
||||
return ResponseResult.databaseSaveSuccess(userService.getDepartmentUser());
|
||||
return ResponseResult.databaseSelectSuccess(userService.getDepartmentUser());
|
||||
}
|
||||
|
||||
@GetMapping("/notice")
|
||||
@PreAuthorize("hasAuthority('notice:manage:get')")
|
||||
@Operation(summary = "获取拥有发布公告权限的用户")
|
||||
public ResponseResult<List<User>> getNoticeUser() {
|
||||
return ResponseResult.databaseSaveSuccess(userService.getNoticeUser());
|
||||
return ResponseResult.databaseSelectSuccess(userService.getNoticeUser());
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
server:
|
||||
port: 8621
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
@@ -16,4 +15,10 @@ mybatis-plus:
|
||||
logic-not-delete-value: 0
|
||||
logic-delete-value: id
|
||||
id-type: assign_id
|
||||
type-aliases-package: com.cfive.pinnacle.entity
|
||||
type-aliases-package: com.cfive.pinnacle.entity
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: debug
|
||||
@@ -12,10 +12,15 @@
|
||||
<result property="status" column="status"/>
|
||||
<result property="completeTime" column="complete_time"/>
|
||||
</collection>
|
||||
<collection property="worker" ofType="user">
|
||||
<id property="id" column="worker_id"/>
|
||||
<result property="username" column="worker_name"/>
|
||||
</collection>
|
||||
<collection property="worker" resultMap="workerMap"/>
|
||||
</resultMap>
|
||||
<resultMap id="workerMap" type="user">
|
||||
<id property="id" column="worker_id"/>
|
||||
<result property="username" column="worker_name"/>
|
||||
<association property="staff" javaType="staff">
|
||||
<result property="firstName" column="first_name"/>
|
||||
<result property="lastName" column="last_name"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
<select id="getAll" resultMap="workMap">
|
||||
select w.id,
|
||||
@@ -27,12 +32,16 @@
|
||||
tuw.user_id worker_id,
|
||||
tu.username worker_name,
|
||||
tuw.status status,
|
||||
tuw.complete_time complete_time
|
||||
tuw.complete_time complete_time,
|
||||
first_name,
|
||||
last_name
|
||||
from t_work w
|
||||
left join (select * from t_user where deleted = 0) as u on w.publisher_id = u.id
|
||||
left join (select * from t_user_work where deleted = 0) as tuw on w.id = tuw.work_id
|
||||
left join (select * from t_user where deleted = 0) as tu on tuw.user_id = tu.id
|
||||
left join (select * from t_staff where deleted = 0) as ts on tuw.user_id = ts.user_id
|
||||
where w.deleted = 0
|
||||
and w.old = 0
|
||||
order by w.id desc;
|
||||
</select>
|
||||
<select id="getWork" parameterType="long" resultMap="workMap">
|
||||
@@ -45,13 +54,17 @@
|
||||
tuw.user_id worker_id,
|
||||
tu.username worker_name,
|
||||
tuw.status status,
|
||||
tuw.complete_time completeTime
|
||||
tuw.complete_time completeTime,
|
||||
first_name,
|
||||
last_name
|
||||
from t_work w
|
||||
left join (select * from t_user where deleted = 0) as u on w.publisher_id = u.id
|
||||
left join (select * from t_user_work where deleted = 0) as tuw on w.id = tuw.work_id
|
||||
left join (select * from t_user where deleted = 0) as tu on tuw.user_id = tu.id
|
||||
left join (select * from t_staff where deleted = 0) as ts on tuw.user_id = ts.user_id
|
||||
where w.id = #{id}
|
||||
and w.deleted = 0;
|
||||
and w.deleted = 0
|
||||
and w.old = 0;
|
||||
</select>
|
||||
<select id="getWorkByContent" parameterType="String" resultMap="workMap">
|
||||
select w.id,
|
||||
@@ -69,7 +82,8 @@
|
||||
left join (select * from t_user_work where deleted = 0) as tuw on w.id = tuw.work_id
|
||||
left join (select * from t_user where deleted = 0) as tu on tuw.user_id = tu.id
|
||||
where w.content like '%${content}%'
|
||||
and w.deleted = 0;
|
||||
and w.deleted = 0
|
||||
and w.old = 0;
|
||||
</select>
|
||||
<select id="getTodo" parameterType="long" resultMap="workMap">
|
||||
select w.id,
|
||||
@@ -89,6 +103,7 @@
|
||||
tuw.user_id = #{userId}
|
||||
and status = false
|
||||
and w.deleted = 0
|
||||
and w.old = 0
|
||||
order by w.deadline asc, w.id desc;
|
||||
</select>
|
||||
<select id="getCard" parameterType="long" resultMap="workMap">
|
||||
@@ -108,6 +123,7 @@
|
||||
where tuw.user_id = #{userId}
|
||||
and status = false
|
||||
and w.deleted = 0
|
||||
and w.old = 0
|
||||
order by w.deadline asc, w.id desc
|
||||
limit 5;
|
||||
|
||||
@@ -130,6 +146,7 @@
|
||||
where tuw.user_id = #{userId}
|
||||
and tuw.status = true
|
||||
and w.deleted = 0
|
||||
and w.old = 0
|
||||
order by w.id desc;
|
||||
</select>
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
</template>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
emits: ['updatePasswd', 'cancelPasswd'],
|
||||
data() {
|
||||
return {
|
||||
passwdForm: {
|
||||
@@ -41,6 +42,10 @@ export default {
|
||||
{
|
||||
required: true,
|
||||
message: '新密码不能为空'
|
||||
},
|
||||
{
|
||||
validator: this.validateSurePasswordLength,
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
selectPasswd: [
|
||||
@@ -52,6 +57,10 @@ export default {
|
||||
{
|
||||
validator: this.validateSurePassword,
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
validator: this.validateSurePasswordLength,
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -82,6 +91,14 @@ export default {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
},
|
||||
validateSurePasswordLength(rule, value, callback) {
|
||||
if (value.length < 8 || value.length > 64) {
|
||||
callback(new Error('新密码长度应为8到64位'))
|
||||
return false
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="负责员工">
|
||||
<el-tag v-for="item in taskData.worker" style="margin-right: 10px">{{
|
||||
item.username
|
||||
item.staff.lastName + item.staff.firstName + '(' + item.username + ')'
|
||||
}}</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
|
||||
<script lang='ts'>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
props: {
|
||||
taskData: {
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
<el-option
|
||||
v-for="item in workers"
|
||||
:key="item.id"
|
||||
:label="item.username"
|
||||
:label="
|
||||
item.staff
|
||||
? item.staff.lastName + item.staff.firstName + '(' + item.username + ')'
|
||||
: item.username
|
||||
"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -29,7 +33,7 @@
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="工作内容" prop="content">
|
||||
<el-input v-model="form.content" type="textarea" />
|
||||
<el-input v-model="form.content" type="textarea" maxlength="100" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit(form)">
|
||||
@@ -42,9 +46,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import request from '@/services'
|
||||
import _ from 'lodash'
|
||||
export default {
|
||||
emits: ['updateWork', 'addWork', 'setDialogVisible'],
|
||||
props: {
|
||||
editForm: {
|
||||
publisherId: '',
|
||||
@@ -52,7 +56,8 @@ export default {
|
||||
deadline: '',
|
||||
content: '',
|
||||
worker: []
|
||||
}
|
||||
},
|
||||
workers: null
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -64,12 +69,6 @@ export default {
|
||||
content: '',
|
||||
worker: []
|
||||
},
|
||||
workers: [
|
||||
{
|
||||
id: '',
|
||||
username: ''
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
worker: [
|
||||
{
|
||||
@@ -93,16 +92,10 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getFormData() {
|
||||
request.get('/user/department').then((response) => {
|
||||
this.workers = response.data.data
|
||||
})
|
||||
},
|
||||
onSubmit(form) {
|
||||
// 表单校验
|
||||
this.$refs.ruleForm.validate((value) => {
|
||||
if (value) {
|
||||
form.publisherId = _.toString(1)
|
||||
if (this.editForm) {
|
||||
this.$emit('updateWork', form)
|
||||
this.reset()
|
||||
@@ -116,7 +109,11 @@ export default {
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.$refs.ruleForm.resetFields()
|
||||
if (this.editForm) {
|
||||
this.form = _.cloneDeep(this.editForm)
|
||||
} else {
|
||||
this.$refs.ruleForm.resetFields()
|
||||
}
|
||||
},
|
||||
cancel() {
|
||||
this.reset()
|
||||
@@ -125,17 +122,15 @@ export default {
|
||||
},
|
||||
updated() {
|
||||
if (this.editForm) {
|
||||
this.form = this.editForm
|
||||
this.form = _.cloneDeep(this.editForm)
|
||||
this.commitButton = '保存'
|
||||
}
|
||||
this.getFormData()
|
||||
},
|
||||
created() {
|
||||
if (this.editForm) {
|
||||
this.form = this.editForm
|
||||
this.form = _.cloneDeep(this.editForm)
|
||||
this.commitButton = '保存'
|
||||
}
|
||||
this.getFormData()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="名字" prop="firstName">
|
||||
<el-input v-model="form.firstName" />
|
||||
<el-input v-model="form.firstName" maxlength="20" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="姓氏" prop="lastName">
|
||||
<el-input v-model="form.lastName" />
|
||||
<el-input v-model="form.lastName" maxlength="20" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -57,13 +57,13 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="form.email" />
|
||||
<el-input v-model="form.email" maxlength="50" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop="tel">
|
||||
<el-input v-model="form.tel" />
|
||||
<el-input v-model="form.tel" maxlength="20" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系地址" prop="address">
|
||||
<el-input v-model="form.address" />
|
||||
<el-input v-model="form.address" maxlength="100" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item style="float: right">
|
||||
<el-button type="info" @click="resetForm">重置</el-button>
|
||||
@@ -89,7 +89,11 @@ import _ from 'lodash'
|
||||
import request from '@/services'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { requestUser } from '@/utils/auth'
|
||||
import { DATABASE_SELECT_OK, DATABASE_UPDATE_OK } from '@/constants/Common.constants'
|
||||
import {
|
||||
DATABASE_SELECT_OK,
|
||||
DATABASE_UPDATE_OK,
|
||||
OLD_PASSWORD_NOT_MATCH
|
||||
} from '@/constants/Common.constants'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -148,7 +152,9 @@ export default {
|
||||
required: true,
|
||||
message: '请选择性别'
|
||||
}
|
||||
]
|
||||
],
|
||||
email: [{ validator: this.checkEmail }],
|
||||
tel: [{ validator: this.checkTel }]
|
||||
},
|
||||
visible: false
|
||||
}
|
||||
@@ -203,10 +209,51 @@ export default {
|
||||
this.form = _.cloneDeep(this.staff)
|
||||
},
|
||||
updatePasswd(passwdForm) {
|
||||
this.visible = false
|
||||
request
|
||||
.put('/user/passwd', {
|
||||
oldPasswd: passwdForm.oldPasswd,
|
||||
newPasswd: passwdForm.newPasswd
|
||||
})
|
||||
.then(async (res) => {
|
||||
const response = res.data
|
||||
if (response.code === DATABASE_UPDATE_OK) {
|
||||
ElMessage({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.visible = false
|
||||
} else if (response.code === OLD_PASSWORD_NOT_MATCH) {
|
||||
ElMessage({
|
||||
message: '旧密码错误,修改失败,请重试',
|
||||
type: 'error'
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
message: '系统错误,修改失败',
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cancelPasswd() {
|
||||
this.visible = false
|
||||
},
|
||||
checkEmail(rule, value, callback) {
|
||||
const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/
|
||||
if (mailReg.test(value)) {
|
||||
callback()
|
||||
} else {
|
||||
return callback(new Error('邮箱格式错误!'))
|
||||
}
|
||||
},
|
||||
checkTel(rule, value, callback) {
|
||||
const telReg =
|
||||
/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
|
||||
if (telReg.test(value)) {
|
||||
callback()
|
||||
} else {
|
||||
return callback(new Error('手机号格式错误!'))
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -37,7 +37,13 @@
|
||||
round
|
||||
style="margin-right: 10px"
|
||||
>
|
||||
{{ item.username }}
|
||||
{{
|
||||
item.staff.lastName +
|
||||
item.staff.firstName +
|
||||
'(' +
|
||||
item.username +
|
||||
')'
|
||||
}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -77,12 +83,27 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-dialog v-model="addVisible" width="60%">
|
||||
<edit-work @setDialogVisible="setDialogVisible" @addWork="addWork"></edit-work>
|
||||
<el-dialog
|
||||
v-model="addVisible"
|
||||
width="60%"
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<edit-work
|
||||
:workers="workers"
|
||||
@setDialogVisible="setDialogVisible"
|
||||
@addWork="addWork"
|
||||
></edit-work>
|
||||
</el-dialog>
|
||||
<el-dialog v-model="editVisible" width="60%">
|
||||
<el-dialog
|
||||
v-model="editVisible"
|
||||
width="60%"
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<edit-work
|
||||
:editForm="rowData"
|
||||
:workers="workers"
|
||||
@setDialogVisible="setDialogVisible"
|
||||
@updateWork="updateWork"
|
||||
></edit-work>
|
||||
@@ -110,7 +131,8 @@ export default {
|
||||
addVisible: false,
|
||||
editVisible: false,
|
||||
loading: true,
|
||||
searchContent: ''
|
||||
searchContent: '',
|
||||
workers: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -198,7 +220,7 @@ export default {
|
||||
return new Date(time).toLocaleString()
|
||||
},
|
||||
searchByContent() {
|
||||
request.get('/work', { content: this.searchContent }).then((res) => {
|
||||
request.get('/work', { content: this.searchContent.trim() }).then((res) => {
|
||||
const response = res.data
|
||||
if (response.code === DATABASE_SELECT_OK) {
|
||||
this.tableData = response.data
|
||||
@@ -212,10 +234,20 @@ export default {
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getWorkers() {
|
||||
request.get('/user/department').then((res) => {
|
||||
const response = res.data
|
||||
if (response.code === DATABASE_SELECT_OK) {
|
||||
this.workers = response.data
|
||||
console.log(this.workers)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
this.getWorkers()
|
||||
},
|
||||
components: {
|
||||
EditWork
|
||||
|
||||
Reference in New Issue
Block a user