dev-cl
qsh 4 months ago
parent c91a2b608f
commit fc71e47903
  1. 36
      src/api/pers/attendancePlan.js
  2. 31
      src/api/pers/employee.js
  3. 5
      src/api/system/app/index.js
  4. 26
      src/api/system/library/index.js
  5. 26
      src/api/system/library/resource.js
  6. 2
      src/utils/index.ts
  7. 14
      src/views/Home/Salary/index.vue
  8. 74
      src/views/Pers/Employee/Comp/DialogEmployee.vue
  9. 32
      src/views/Pers/Employee/index.vue
  10. 39
      src/views/Pers/Setting/Comp/AttendancePlan.vue
  11. 86
      src/views/Pers/Setting/Comp/DialogPlan.vue

@ -0,0 +1,36 @@
import request from '@/config/axios'
// 创建
export const createPlan = (data) => {
return request.post({ url: '/admin-api/oa/attendance-setting/create', data, isSubmitForm: true })
}
// 修改
export const updatePlan = (data) => {
return request.put({ url: '/admin-api/oa/attendance-setting/update', data })
}
// 修改状态
export const updatePlanStatus = (data) => {
return request.put({ url: '/admin-api/oa/attendance-setting/status/update', data })
}
// 分页
export const getPlanPage = (params) => {
return request.get({ url: '/admin-api/oa/attendance-setting/page', params })
}
// 列表
export const getPlanSimpleList = (params) => {
return request.get({ url: '/admin-api/oa/attendance-setting/simple-list', params })
}
// 详情
export const getPlanDetail = (id) => {
return request.get({ url: '/admin-api/oa/attendance-setting/get', params: { id } })
}
// 删除
export const deletePlan = (id) => {
return request.delete({ url: '/admin-api/oa/attendance-setting/delete', params: { id } })
}

@ -0,0 +1,31 @@
import request from '@/config/axios'
// 创建
export const createEmployee = (data) => {
return request.post({ url: '/admin-api/oa/employee/create', data, isSubmitForm: true })
}
// 修改
export const updateEmployee = (data) => {
return request.put({ url: '/admin-api/oa/employee/update', data })
}
// 修改状态
export const updateEmployeeStatus = (data) => {
return request.put({ url: '/admin-api/oa/employee/status/update', data })
}
// 分页
export const getEmployeePage = (params) => {
return request.get({ url: '/admin-api/oa/employee/page', params })
}
// 详情
export const getEmployeeDetail = (id) => {
return request.get({ url: '/admin-api/oa/employee/get', params: { id } })
}
// 删除
export const deleteEmployee = (id) => {
return request.delete({ url: '/admin-api/oa/employee/delete', params: { id } })
}

@ -0,0 +1,5 @@
import request from '@/config/axios'
export const getSimpleAppList = async () => {
return await request.get({ url: '/admin-api/system/serviceInstance/simple-list' })
}

@ -1,26 +0,0 @@
import request from '@/config/axios'
// 查询知识库列表
export const getLibraryPage = (params) => {
return request.get({ url: '/admin-api/crm/knowledge-lib/page', params })
}
// 查询知识库详情
export const getLibrary = (id) => {
return request.get({ url: '/admin-api/crm/knowledge-lib/get?id=' + id })
}
// 新增知识库
export const createLibrary = (data) => {
return request.post({ url: '/admin-api/crm/knowledge-lib/create', data })
}
// 修改知识库
export const updateLibrary = (data) => {
return request.put({ url: '/admin-api/crm/knowledge-lib/update', data })
}
// 删除知识库
export const deleteLibrary = (id) => {
return request.delete({ url: '/admin-api/crm/knowledge-lib/delete?id=' + id })
}

@ -1,26 +0,0 @@
import request from '@/config/axios'
// 查询资源列表
export const getResourcePage = (params) => {
return request.get({ url: '/admin-api/crm/knowledge-lib-info/page', params })
}
// 查询资源详情
export const getResource = (id) => {
return request.get({ url: '/admin-api/crm/knowledge-lib-info/get?id=' + id })
}
// 新增资源
export const createResource = (data) => {
return request.post({ url: '/admin-api/crm/knowledge-lib-info/create', data })
}
// 修改资源
export const updateResource = (data) => {
return request.put({ url: '/admin-api/crm/knowledge-lib-info/update', data })
}
// 删除资源
export const deleteResource = (id) => {
return request.delete({ url: '/admin-api/crm/knowledge-lib-info/delete?id=' + id })
}

@ -213,7 +213,7 @@ export const fenToYuan = (amount: string | number): number => {
export const removeNullField = (obj: Object) => {
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
if (obj[key] == '') {
if (obj[key] === '' || obj[key] === null || obj[key] === undefined) {
delete obj[key]
}
}

@ -84,6 +84,19 @@
<span v-else> {{ row.jbgz }}</span>
</template>
</el-table-column>
<el-table-column label="奖金" min-width="90px">
<template #default="{ row }">
<el-input-number
v-if="row.edit"
v-model="row.jiangjin"
:min="0"
:controls="false"
size="small"
style="width: 65px"
/>
<span v-else> {{ row.jiangjin }}</span>
</template>
</el-table-column>
<el-table-column label="满勤" min-width="90px">
<template #default="{ row }">
<el-input-number
@ -269,7 +282,6 @@
</el-table-column>
</el-table>
<DialogCreateSalary ref="createSalaryRef" @success="getList" />
<DialogImportSalary ref="importSalaryRef" @success="getList" />
</div>
</template>

@ -9,8 +9,8 @@
>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="员工姓名" prop="nickname">
<el-input v-model="formData.nickname" placeholder="请输入员工姓名" />
<el-form-item label="员工姓名" prop="name">
<el-input v-model="formData.name" placeholder="请输入员工姓名" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -35,8 +35,8 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="职位" prop="job">
<el-input v-model="formData.job" placeholder="请输入职位" />
<el-form-item label="职位" prop="post">
<el-input v-model="formData.post" placeholder="请输入职位" />
</el-form-item>
</el-col>
</el-row>
@ -54,36 +54,38 @@
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="考勤方案" prop="kaoqinfangan">
<el-form-item label="考勤方案" prop="attendanceSettingId">
<el-select
v-model="formData.kaoqinfangan"
v-model="formData.attendanceSettingId"
placeholder="选择考勤方案"
clearable
filterable
>
<el-option
v-for="item in kaoqinfanganOptions"
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in attendanceSettingIdOptions"
:key="item.attendanceSettingId"
:label="item.name"
:disabled="item.status == 1"
:value="item.attendanceSettingId"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="开通系统" prop="kaitongxitong">
<el-form-item label="开通系统" prop="instanceIds">
<el-select
v-model="formData.kaitongxitong"
v-model="formData.instanceIds"
placeholder="选择考勤方案"
multiple
clearable
filterable
>
<el-option
v-for="item in kaitongxitongOptions"
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in instanceIdsOptions"
:key="item.instanceId"
:label="item.instanceName"
:disabled="item.status == 1"
:value="item.instanceId"
/>
</el-select>
</el-form-item>
@ -123,8 +125,10 @@
<script name="DialogEmployee" setup>
import { CommonStatusEnum } from '@/utils/constants'
import { formatDate } from '@/utils/formatTime'
import { getPlanSimpleList } from '@/api/pers/attendancePlan'
import { getSimpleAppList } from '@/api/system/app'
import * as UserApi from '@/api/system/user'
import * as EmployeeApi from '@/api/pers/employee'
const { t } = useI18n() //
const message = useMessage() //
@ -134,8 +138,7 @@ const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
nickname: '',
deptId: '',
name: '',
mobile: '',
email: '',
id: undefined,
@ -145,12 +148,12 @@ const formData = ref({
remark: '',
status: CommonStatusEnum.ENABLE,
hireDate: '',
kaoqinfangan: undefined,
kaitongxitong: []
attendanceSettingId: undefined,
instanceIds: []
})
const formRules = ref({
nickname: [{ required: true, message: '员工姓名不能为空', trigger: 'blur' }],
job: { required: true, message: '职位不能为空', trigger: 'blur' },
name: [{ required: true, message: '员工姓名不能为空', trigger: 'blur' }],
post: { required: true, message: '职位不能为空', trigger: 'blur' },
email: [
{
type: 'email',
@ -161,8 +164,8 @@ const formRules = ref({
mobile: [{ required: true, message: '手机号不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
const kaoqinfanganOptions = ref([])
const kaitongxitongOptions = ref([])
const attendanceSettingIdOptions = ref([])
const instanceIdsOptions = ref([])
/** 打开弹窗 */
const open = async (type, id) => {
@ -174,7 +177,7 @@ const open = async (type, id) => {
if (id) {
formLoading.value = true
try {
formData.value = await UserApi.getUser(id)
formData.value = await EmployeeApi.getEmployeeDetail(id)
} finally {
formLoading.value = false
}
@ -184,8 +187,12 @@ const open = async (type, id) => {
defineExpose({ open }) // open
function getOptions() {
kaoqinfanganOptions.value = []
kaitongxitongOptions.value = []
getSimpleAppList().then((data) => {
instanceIdsOptions.value = data
})
getPlanSimpleList().then((data) => {
attendanceSettingIdOptions.value = data
})
}
/** 提交表单 */
@ -200,10 +207,10 @@ const submitForm = async () => {
try {
const data = formData.value
if (formType.value === 'create') {
await UserApi.createUser(data)
await EmployeeApi.createEmployee(data)
message.success(t('common.createSuccess'))
} else {
await UserApi.updateUser(data)
await EmployeeApi.updateEmployee(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
@ -217,8 +224,7 @@ const submitForm = async () => {
/** 重置表单 */
const resetForm = () => {
formData.value = {
nickname: '',
deptId: '',
name: '',
mobile: '',
email: '',
id: undefined,
@ -228,8 +234,8 @@ const resetForm = () => {
remark: '',
status: CommonStatusEnum.ENABLE,
hireDate: formatDate(new Date(), 'YYYY-MM-DD'),
kaoqinfangan: undefined,
kaitongxitong: []
attendanceSettingId: undefined,
instanceIds: []
}
formRef.value?.resetFields()
}

@ -2,7 +2,7 @@
<div>
<el-form :model="searchForm" inline>
<el-form-item>
<el-input v-model="searchForm.name" placeholder="请输入员工姓名" />
<el-input v-model="searchForm.name" placeholder="请输入员工姓名" clearable />
</el-form-item>
<el-form-item>
<el-radio-group v-model="searchForm.status">
@ -25,11 +25,11 @@
<el-table v-loading="loading" :data="tableList" border stripe>
<el-table-column type="index" width="50" />
<el-table-column label="用户姓名" prop="nickname" />
<el-table-column label="职位" prop="job" />
<el-table-column label="用户姓名" prop="name" />
<el-table-column label="职位" prop="post" />
<el-table-column label="手机号码" prop="mobile" width="120" />
<el-table-column label="考勤方案" />
<el-table-column label="已开通系统" />
<el-table-column label="考勤方案" prop="attendanceSettingName" />
<el-table-column label="已开通系统" prop="instanceName" />
<el-table-column label="在职状态" key="status" width="150">
<template #default="scope">
<el-switch
@ -74,6 +74,12 @@
<script name="OAEmployee" setup>
import DialogEmployee from './Comp/DialogEmployee.vue'
import { removeNullField } from '@/utils'
import * as EmployeeApi from '@/api/pers/employee'
const message = useMessage() //
const { t } = useI18n() //
const searchForm = ref({
name: undefined,
status: 0,
@ -98,10 +104,9 @@ const total = ref(0)
const getList = async () => {
loading.value = true
try {
tableList.value = [{ status: 0 }]
// const data = await UserApi.getUserPage(queryParams)
// tableList.value = data.list
// total.value = data.total
const data = await EmployeeApi.getEmployeePage(removeNullField(searchForm.value))
tableList.value = data.list
total.value = data.total
} finally {
loading.value = false
}
@ -118,12 +123,13 @@ const handleStatusChange = async (row) => {
try {
//
const text = row.status === 0 ? '启用' : '停用'
await message.confirm('确认要"' + text + '""' + row.nickname + '"用户吗?')
await message.confirm('确认要"' + text + '""' + row.name + '"用户吗?')
//
await UserApi.updateUserStatus(row.id, row.status)
await EmployeeApi.updateEmployeeStatus({ id: row.id, status: row.status })
//
await getList()
} catch {
} catch (err) {
console.log(err)
//
row.status = row.status === 0 ? 1 : 0
}
@ -135,7 +141,7 @@ const handleDelete = async (id) => {
//
await message.delConfirm()
//
await UserApi.deleteUser(id)
await EmployeeApi.deleteEmployee(id)
message.success(t('common.delSuccess'))
//
await getList()

@ -2,7 +2,7 @@
<div>
<el-form :model="searchForm" inline>
<el-form-item>
<el-input v-model="searchForm.name" placeholder="方案名称" />
<el-input v-model="searchForm.name" placeholder="方案名称" clearable />
</el-form-item>
<el-form-item>
<el-select v-model="searchForm.status" placeholder="启用状态" clearable filterable>
@ -31,7 +31,9 @@
<el-table-column label="操作" width="200">
<template #default="scope">
<el-button type="primary" link @click="openForm('update', scope.row)"> 修改 </el-button>
<el-button type="primary" link @click="handleDelete(scope.row.id)"> 删除 </el-button>
<el-button type="primary" link @click="handleDelete(scope.row.attendanceSettingId)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -48,6 +50,11 @@
<script name="PersSetting" setup>
import DialogPlan from './DialogPlan.vue'
import * as PlanApi from '@/api/pers/attendancePlan'
import { removeNullField } from '@/utils'
const message = useMessage() //
const { t } = useI18n() //
const searchForm = ref({
name: undefined,
status: undefined,
@ -72,10 +79,9 @@ const total = ref(0)
const getList = async () => {
loading.value = true
try {
tableList.value = [{ status: 0 }]
// const data = await UserApi.getUserPage(queryParams)
// tableList.value = data.list
// total.value = data.total
const data = await PlanApi.getPlanPage(removeNullField(searchForm.value))
tableList.value = data.list
total.value = data.total
} finally {
loading.value = false
}
@ -92,14 +98,31 @@ const handleStatusChange = async (row) => {
const text = row.status === 0 ? '启用' : '停用'
await message.confirm('确认要"' + text + '""' + row.name + '"方案吗?')
//
// await UserApi.updateUserStatus(row.id, row.status)
await PlanApi.updatePlanStatus({
attendanceSettingId: row.attendanceSettingId,
status: row.status
})
//
await getList()
} catch {
} catch (err) {
console.log(err)
//
row.status = row.status === 0 ? 1 : 0
}
}
/** 删除按钮操作 */
const handleDelete = async (id) => {
try {
//
await message.delConfirm()
//
await PlanApi.deletePlan(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
</script>
<style lang="scss" scoped></style>

@ -12,19 +12,18 @@
<el-table :data="form.planList" border stripe>
<el-table-column label="年份" width="150px">
<template #default="{ row }">
<el-date-picker
<el-input-number
v-model="row.year"
type="year"
placeholder="选择年份"
format="YYYY"
value-format="YYYY"
style="width: 120px"
size="small"
:min="1"
:controls="false"
style="width: 100px"
/>
</template>
</el-table-column>
<el-table-column
v-for="item in 12"
:prop="item"
:prop="item + ''"
:key="item"
:label="item + '月'"
width="140px"
@ -32,7 +31,7 @@
<el-table-column label="应出勤">
<template #default="{ row }">
<el-input-number
v-model="row[item].yingchuqin"
v-model="row[item + ''].shouldWorkDay"
size="small"
:min="1"
:max="31"
@ -44,7 +43,7 @@
<el-table-column label="带薪假">
<template #default="{ row }">
<el-input-number
v-model="row[item].daixinjia"
v-model="row[item].paidLeaveDay"
size="small"
:min="0"
:max="31"
@ -71,6 +70,8 @@
</template>
<script setup name="DialogAttendancePlan">
import * as PlanApi from '@/api/pers/attendancePlan'
const message = useMessage() //
const dialogVisible = ref(false) //
@ -84,11 +85,25 @@ const open = async (type, row) => {
dialogTitle.value = type == 'create' ? `新增方案` : '修改方案'
formType.value = type
resetForm()
if (row?.id) {
if (row?.attendanceSettingId) {
formLoading.value = true
try {
// comissionForm.value = await UserApi.getUser(id)
const data = await PlanApi.getPlanDetail(row.attendanceSettingId)
const list = data.attendancePeriodS.map((item) => {
item.monthSettings.map((it) => {
item[it.month + ''] = {
shouldWorkDay: it.shouldWorkDay,
paidLeaveDay: it.paidLeaveDay
}
})
item.year = item.year
delete item.monthSettings
return item
})
form.value = {
name: data.name,
planList: list
}
} finally {
formLoading.value = false
}
@ -110,18 +125,18 @@ function resetForm() {
function handleAddYearPlan() {
form.value.planList.push({
year: new Date().getFullYear(),
1: { yingchuqin: undefined, daixinjia: undefined },
2: { yingchuqin: undefined, daixinjia: undefined },
3: { yingchuqin: undefined, daixinjia: undefined },
4: { yingchuqin: undefined, daixinjia: undefined },
5: { yingchuqin: undefined, daixinjia: undefined },
6: { yingchuqin: undefined, daixinjia: undefined },
7: { yingchuqin: undefined, daixinjia: undefined },
8: { yingchuqin: undefined, daixinjia: undefined },
9: { yingchuqin: undefined, daixinjia: undefined },
10: { yingchuqin: undefined, daixinjia: undefined },
11: { yingchuqin: undefined, daixinjia: undefined },
12: { yingchuqin: undefined, daixinjia: undefined }
1: { shouldWorkDay: undefined, paidLeaveDay: undefined },
2: { shouldWorkDay: undefined, paidLeaveDay: undefined },
3: { shouldWorkDay: undefined, paidLeaveDay: undefined },
4: { shouldWorkDay: undefined, paidLeaveDay: undefined },
5: { shouldWorkDay: undefined, paidLeaveDay: undefined },
6: { shouldWorkDay: undefined, paidLeaveDay: undefined },
7: { shouldWorkDay: undefined, paidLeaveDay: undefined },
8: { shouldWorkDay: undefined, paidLeaveDay: undefined },
9: { shouldWorkDay: undefined, paidLeaveDay: undefined },
10: { shouldWorkDay: undefined, paidLeaveDay: undefined },
11: { shouldWorkDay: undefined, paidLeaveDay: undefined },
12: { shouldWorkDay: undefined, paidLeaveDay: undefined }
})
}
@ -135,16 +150,35 @@ const submitForm = async () => {
//
formLoading.value = true
try {
const arr = form.value.planList.map((item) => {
const list = []
for (let i = 1; i <= 12; i++) {
list.push({
month: i,
...item[i + '']
})
}
return {
year: item.year,
monthSettings: list
}
})
const data = {
name: form.value.name,
attendancePeriodS: arr
}
if (formType.value === 'create') {
// await ClassApi.createClassType(data)
await PlanApi.createPlan(data)
message.success(t('common.createSuccess'))
} else {
// await ClassApi.updateClassType(data)
await PlanApi.updatePlan(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} catch (err) {
console.log(err)
} finally {
formLoading.value = false
}

Loading…
Cancel
Save