-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(salary): complete salary functional
- Loading branch information
Showing
10 changed files
with
265 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
@import './var.css'; | ||
@import './transition.css'; | ||
@import './element-plus.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<template> | ||
<div :class="prefixCls"> | ||
<div class="search"> | ||
<el-input | ||
v-model="searchName" | ||
placeholder="输入职工姓名进行检索" | ||
class="input-with-select" | ||
clearable | ||
@clear="getInitData" | ||
> | ||
<template #append> | ||
<button-src-button | ||
icon="search" | ||
icon-type="iconify" | ||
@click="getInitData" | ||
/> | ||
</template> | ||
</el-input> | ||
</div> | ||
<div :class="['salary-form mt-2']"> | ||
<el-card shadow="hover"> | ||
<el-form | ||
v-if="queried" | ||
ref="salaryFormRef" | ||
:model="salaryForm" | ||
label-width="80px" | ||
> | ||
<el-form-item label="工资编号"> | ||
<el-input v-model="salaryForm.id" disabled></el-input> | ||
</el-form-item> | ||
<el-form-item label="职工姓名"> | ||
<el-input v-model="salaryForm.workerName" disabled></el-input> | ||
</el-form-item> | ||
<el-form-item label="职工编号"> | ||
<el-input v-model="salaryForm.serialNumber" disabled></el-input> | ||
</el-form-item> | ||
<el-form-item label="基本工资"> | ||
<el-input-number | ||
v-model="salaryForm.base_pay" | ||
type="number" | ||
:step="step" | ||
></el-input-number> | ||
</el-form-item> | ||
<el-form-item label="绩效工资"> | ||
<el-input-number | ||
v-model="salaryForm.performance_pay" | ||
type="number" | ||
:step="step" | ||
></el-input-number> | ||
</el-form-item> | ||
<el-form-item label="工资补贴"> | ||
<el-input-number | ||
v-model="salaryForm.performance_pay" | ||
type="number" | ||
:step="step" | ||
></el-input-number> | ||
</el-form-item> | ||
<el-form-item label="所交税额"> | ||
<el-input-number | ||
v-model="salaryForm.tax" | ||
type="number" | ||
:step="step" | ||
></el-input-number> | ||
</el-form-item> | ||
<el-form-item label="应发工资"> | ||
<span>{{ real_pay }}元</span> | ||
</el-form-item> | ||
<el-form-item> | ||
<el-button type="success" @click="submit">更新工资信息</el-button> | ||
<el-button>取消</el-button> | ||
</el-form-item> | ||
</el-form> | ||
</el-card> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { useDesign } from '@/hooks' | ||
import { | ||
searchName, | ||
getInitData, | ||
queried, | ||
salaryForm, | ||
salaryFormRef, | ||
submit, | ||
real_pay, | ||
step | ||
} from '../hooks' | ||
const prefixCls = useDesign('prefix', 'salary-panel') | ||
</script> | ||
<style lang="less" scoped> | ||
@prefix-cls: ~'@{namespace}-salary-panel'; | ||
.@{prefix-cls} { | ||
.search { | ||
width: 20%; | ||
} | ||
.salary-form { | ||
width: 40%; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* @Version: 1.0 | ||
* @Autor: YDKD | ||
* @Date: 2022-04-12 10:26:56 | ||
* @LastEditors: YDKD | ||
* @LastEditTime: 2022-04-12 15:29:53 | ||
*/ | ||
import { | ||
searchName, | ||
getInitData, | ||
queried, | ||
salaryForm, | ||
salaryFormRef, | ||
submit, | ||
real_pay, | ||
step | ||
} from './useForm' | ||
|
||
export { | ||
searchName, | ||
getInitData, | ||
queried, | ||
salaryForm, | ||
salaryFormRef, | ||
submit, | ||
real_pay, | ||
step | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* @Version: 1.0 | ||
* @Autor: YDKD | ||
* @Date: 2022-04-12 10:27:55 | ||
* @LastEditors: YDKD | ||
* @LastEditTime: 2022-04-12 15:42:33 | ||
*/ | ||
import { getWorkerSalary } from '@/api/getApi' | ||
import { updateWorkerSalary } from '@/api/postApi' | ||
import { useMessage } from '@/hooks' | ||
import { FormInstance } from 'element-plus' | ||
import { computed, ref } from 'vue' | ||
|
||
import type { SalaryForm } from '../types' | ||
|
||
const searchName = ref('小王') | ||
|
||
const queried = ref(false) | ||
|
||
const salaryFormRef = ref<FormInstance>() | ||
|
||
const step = 20 | ||
|
||
const salaryForm = ref<SalaryForm>({ | ||
id: '', | ||
serialNumber: '', | ||
base_pay: 0, | ||
allowance: 0, | ||
performance_pay: 0, | ||
tax: 0, | ||
workerName: '' | ||
}) | ||
|
||
const real_pay = computed(() => { | ||
const { base_pay, allowance, performance_pay, tax } = salaryForm.value | ||
return base_pay + performance_pay + allowance - tax | ||
}) | ||
|
||
const getInitData = async () => { | ||
if (searchName.value == '') return | ||
const params = { | ||
username: searchName.value | ||
} | ||
const { data, code } = await getWorkerSalary(params) | ||
if (code == 200) { | ||
const result: Array<SalaryForm> | undefined = await data.result | ||
if (result && result.length > 0) { | ||
salaryForm.value = result[0] | ||
queried.value = true | ||
} else { | ||
useMessage({ msg: '未查询到该职工信息', type: 'error' }) | ||
queried.value = false | ||
} | ||
} | ||
} | ||
|
||
const submit = async () => { | ||
const { code, msg } = await updateWorkerSalary(salaryForm.value) | ||
useMessage({ msg: msg, type: code == 200 ? 'success' : 'error' }) | ||
} | ||
|
||
export { | ||
searchName, | ||
getInitData, | ||
queried, | ||
salaryForm, | ||
salaryFormRef, | ||
submit, | ||
real_pay, | ||
step | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!-- | ||
* @Version: 1.0 | ||
* @Autor: YDKD | ||
* @Date: 2022-04-12 10:18:53 | ||
* @LastEditors: YDKD | ||
* @LastEditTime: 2022-04-12 10:23:50 | ||
--> | ||
<template> | ||
<div :class="prefixCls"> | ||
<salary-panel /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import salaryPanel from './components/salary-panel.vue' | ||
import { useDesign } from '@/hooks' | ||
|
||
const prefixCls = useDesign('prefix', 'person-salary') | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
@prefix-cls: ~'@{namespace}-person-salary'; | ||
|
||
.@{prefix-cls} { | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* @Version: 1.0 | ||
* @Autor: YDKD | ||
* @Date: 2022-04-12 11:08:28 | ||
* @LastEditors: YDKD | ||
* @LastEditTime: 2022-04-12 15:28:58 | ||
*/ | ||
export type SalaryForm = { | ||
id: number | string | ||
allowance: number | ||
base_pay: number | ||
performance_pay: number | ||
serialNumber: number | string | ||
tax: number | ||
workerName: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters