上传
This commit is contained in:
@@ -11,8 +11,10 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-date-picker
|
||||
v-model="searchForm.yearmonth"
|
||||
v-model="searchForm.period"
|
||||
type="month"
|
||||
format="YYYY-MM"
|
||||
value-format="YYYY-MM"
|
||||
placeholder="年月"
|
||||
style="width: 100%"
|
||||
@change="handleSearch"
|
||||
@@ -36,20 +38,22 @@
|
||||
stripe
|
||||
:default-expand-all="false"
|
||||
row-key="id"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
:tree-props="{ children: 'userSalaryGrantRespVOList', hasChildren: 'hasChildren' }"
|
||||
:span-method="spanMethod"
|
||||
>
|
||||
<el-table-column label="姓名" min-width="90px">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.children && row.children.length">
|
||||
<span>{{ row.yearmonth }}</span>
|
||||
<span class="ml-20px">应发工资人数:30人</span>
|
||||
<span v-if="row.userSalaryGrantRespVOList && row.userSalaryGrantRespVOList.length">
|
||||
<span>{{ row.period }}</span>
|
||||
<span class="ml-20px">应发工资人数:{{ row.grantNum }}人</span>
|
||||
<span class="ml-20px">应发工资:¥{{ row.allGrantSalaryTotal }}</span>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ row.name }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="period" label="年月" min-width="90px" />
|
||||
<el-table-column prop="dept" label="部门" min-width="90px" />
|
||||
<el-table-column prop="post" label="职位" min-width="90px" />
|
||||
<el-table-column label="应发工资" align="center">
|
||||
@@ -262,7 +266,7 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
style="padding: 0"
|
||||
v-if="!row.edit && row.yearmonth"
|
||||
v-if="row.edit === '0'"
|
||||
text
|
||||
v-hasPermi="['home:salary:update']"
|
||||
@click="handleEdit(row)"
|
||||
@@ -271,7 +275,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
v-else-if="row.edit && row.yearmonth"
|
||||
v-else-if="row.edit === '1'"
|
||||
text
|
||||
style="padding: 0"
|
||||
v-hasPermi="['home:salary:update']"
|
||||
@@ -281,7 +285,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
v-if="row.yearmonth"
|
||||
v-if="row.id"
|
||||
style="padding: 0"
|
||||
text
|
||||
v-hasPermi="['home:salary:sealup']"
|
||||
@@ -314,9 +318,9 @@ import * as SalaryApi from '@/api/home/salary.js'
|
||||
|
||||
const searchForm = ref({
|
||||
name: undefined,
|
||||
yearmonth: undefined,
|
||||
period: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 50
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
@@ -337,15 +341,25 @@ async function getList() {
|
||||
let params = {
|
||||
...searchForm.value
|
||||
}
|
||||
if (params.yearmonth) {
|
||||
if (params.period) {
|
||||
params = {
|
||||
...params,
|
||||
year: new Date(params.yearmonth).getFullYear(),
|
||||
month: new Date(params.yearmonth).getMonth() + 1
|
||||
year: new Date(params.period).getFullYear(),
|
||||
month: new Date(params.period).getMonth() + 1
|
||||
}
|
||||
}
|
||||
const data = await SalaryApi.getSalaryPage(removeNullField(params))
|
||||
tableList.value = data.list
|
||||
if (searchForm.value.name) {
|
||||
tableList.value = data.list.reduce((pre, cur) => {
|
||||
return pre.concat(cur.userSalaryGrantRespVOList)
|
||||
}, [])
|
||||
} else {
|
||||
tableList.value = data.list.map((it, index) => ({
|
||||
...it,
|
||||
id: index + 1,
|
||||
edit: '0'
|
||||
}))
|
||||
}
|
||||
total.value = data.total
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@@ -365,10 +379,10 @@ function importHistorySalary() {
|
||||
}
|
||||
|
||||
function spanMethod({ row, columnIndex }) {
|
||||
if (row.children && row.children.length > 0) {
|
||||
if (row.userSalaryGrantRespVOList && row.userSalaryGrantRespVOList.length > 0) {
|
||||
if (columnIndex === 0) {
|
||||
return [1, 21]
|
||||
} else if (columnIndex == 21) {
|
||||
return [1, 22]
|
||||
} else if (columnIndex == 22 && row.id) {
|
||||
return [1, 1]
|
||||
} else {
|
||||
return [0, 0]
|
||||
@@ -377,13 +391,13 @@ function spanMethod({ row, columnIndex }) {
|
||||
}
|
||||
|
||||
function handleEdit(row) {
|
||||
row.edit = true
|
||||
row.children.forEach((it) => (it.edit = true))
|
||||
row.edit = '1'
|
||||
row.userSalaryGrantRespVOList.forEach((it) => (it.edit = true))
|
||||
}
|
||||
|
||||
function handleSave(row) {
|
||||
row.edit = false
|
||||
row.children.forEach((it) => (it.edit = false))
|
||||
row.edit = '0'
|
||||
row.userSalaryGrantRespVOList.forEach((it) => (it.edit = false))
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user