dev-cl
parent
17208922ad
commit
514b602599
@ -0,0 +1,199 @@ |
||||
<template> |
||||
<div> |
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="searchForm" inline label-width="0"> |
||||
<el-form-item> |
||||
<el-date-picker |
||||
v-model="searchForm.period" |
||||
type="month" |
||||
format="YYYY-MM" |
||||
value-format="YYYY-MM" |
||||
placeholder="年月" |
||||
style="width: 100%" |
||||
@change="handleSearch" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-input |
||||
v-model.trim="searchForm.dept" |
||||
placeholder="组织名称" |
||||
clearable |
||||
@keyup.enter="handleSearch" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-input |
||||
v-model.trim="searchForm.name" |
||||
placeholder="员工姓名" |
||||
clearable |
||||
@keyup.enter="handleSearch" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button @click="getList" v-hasPermi="['kpi:score:search']"> 搜索</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
<el-table |
||||
v-loading="loading" |
||||
:data="tableList" |
||||
border |
||||
stripe |
||||
:default-expand-all="false" |
||||
row-key="id" |
||||
:tree-props="{ children: 'userDingAttendanceRespVOList', hasChildren: 'hasChildren' }" |
||||
:span-method="spanMethod" |
||||
> |
||||
<el-table-column label="姓名" min-width="90px"> |
||||
<template #default="{ row }"> |
||||
<span v-if="row.userDingAttendanceRespVOList && row.userDingAttendanceRespVOList.length"> |
||||
<span>{{ row.period }}</span> |
||||
<span class="ml-20px">考核人数:{{ row.attendanceUserCount }}人</span> |
||||
</span> |
||||
<span v-else> |
||||
{{ row.employeeName }} |
||||
</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 label="考核总分" prop="" align="center" /> |
||||
<el-table-column label="操作" fixed="right" width="200"> |
||||
<template #default="{ row }"> |
||||
<el-button |
||||
type="primary" |
||||
text |
||||
v-if="!row.id" |
||||
style="padding: 0" |
||||
v-hasPermi="['kpi:record:detail']" |
||||
@click="handleDetail(row)" |
||||
> |
||||
详情 |
||||
</el-button> |
||||
<el-button |
||||
type="danger" |
||||
v-if="row.id" |
||||
:disabled="row.status == 1" |
||||
style="padding: 0" |
||||
text |
||||
v-hasPermi="['home:false-dilegence:sealup']" |
||||
@click="handleSealup(row)" |
||||
> |
||||
<span v-if="row.status == 0">封存</span> |
||||
<span v-else-if="row.status == 1">已封存</span> |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<Pagination |
||||
:total="total" |
||||
v-model:page="searchForm.pageNo" |
||||
v-model:limit="searchForm.pageSize" |
||||
@pagination="getList" |
||||
/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="KpiRecord"> |
||||
import { removeNullField } from '@/utils' |
||||
import * as FalseDiligenceApi from '@/api/home/falseDiligence.js' |
||||
|
||||
const message = useMessage() // 消息弹窗 |
||||
|
||||
const searchForm = ref({ |
||||
name: undefined, |
||||
period: undefined, |
||||
dept: undefined, |
||||
pageNo: 1, |
||||
pageSize: 20 |
||||
}) |
||||
|
||||
onMounted(() => { |
||||
handleSearch() |
||||
}) |
||||
|
||||
function handleSearch() { |
||||
searchForm.value.pageNo = 1 |
||||
getList() |
||||
} |
||||
|
||||
const loading = ref(false) |
||||
const tableList = ref([]) |
||||
const total = ref(0) |
||||
async function getList() { |
||||
loading.value = true |
||||
try { |
||||
let params = { |
||||
...searchForm.value |
||||
} |
||||
if (params.period) { |
||||
params = { |
||||
...params, |
||||
year: new Date(params.period).getFullYear(), |
||||
month: new Date(params.period).getMonth() + 1 |
||||
} |
||||
} |
||||
const data = await FalseDiligenceApi.getPage(removeNullField(params)) |
||||
if (searchForm.value.name) { |
||||
tableList.value = data.list.reduce((pre, cur) => { |
||||
return pre.concat(cur.userDingAttendanceRespVOList) |
||||
}, []) |
||||
} else { |
||||
tableList.value = data.list.map((it, index) => ({ |
||||
...it, |
||||
userDingAttendanceRespVOList: it.userDingAttendanceRespVOList.sort((pre, cur) => |
||||
pre.employeeName.localeCompare(cur.employeeName) |
||||
), |
||||
id: index + 1 |
||||
})) |
||||
} |
||||
total.value = data.total |
||||
} catch (err) { |
||||
console.log(err) |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
function spanMethod({ row, columnIndex }) { |
||||
if (row.userDingAttendanceRespVOList && row.userDingAttendanceRespVOList.length > 0) { |
||||
if (columnIndex === 0) { |
||||
return [1, 4] |
||||
} else if (columnIndex == 4 && row.id) { |
||||
return [1, 1] |
||||
} else { |
||||
return [0, 0] |
||||
} |
||||
} |
||||
} |
||||
|
||||
function handleDetail(row) { |
||||
console.log(row) |
||||
} |
||||
|
||||
async function handleSealup(row) { |
||||
try { |
||||
// 二次确认 |
||||
await message.confirm('确认要封存"' + row.period + '"假勤吗?') |
||||
// 发起修改状态 |
||||
await FalseDiligenceApi.saveFalseDiligence({ |
||||
period: row.period |
||||
}) |
||||
message.success('封存成功!') |
||||
// 刷新列表 |
||||
await getList() |
||||
} catch (err) { |
||||
console.log(err) |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
:deep(.el-table__indent) { |
||||
display: none; |
||||
} |
||||
|
||||
:deep(.el-table__placeholder) { |
||||
display: none; |
||||
} |
||||
</style> |
Loading…
Reference in new issue