feature: 工资管理

This commit is contained in:
zhuyu 2025-05-29 15:42:23 +08:00
parent 448e878813
commit 7cbf0c5a01
5 changed files with 35 additions and 11 deletions

View File

@ -164,8 +164,21 @@ class Detail extends Backend
if (false === $this->request->isPost()) {
$items = Db::name('salary_item')->field('id,name')->select();
$items = Db::name('salary_item')->field('id,type,name')->select();
$typeMap = [
1 => '应发工资',
2 => '应扣款项',
3 => '其他'
];
$groupedItems = [];
foreach ($items as $item) {
$type = $item['type'];
$label = $typeMap[$type];
$groupedItems[$label][] = $item;
}
$this->view->assign('groupedItems', $groupedItems);
$this->view->assign('items', $items);
return $this->view->fetch();
}

View File

@ -12,13 +12,19 @@
<input id="c-salary_month" class="form-control datetimepicker" data-date-format="YYYY-MM" data-use-current="true" name="row[salary_month]" type="text" value="{:date('Y-m-d')}">
</div>
</div>
{foreach $items as $item}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{$item['name']}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-item_value" class="form-control" step="0.01" name="row[item_{$item['id']}]" type="number" value="10">
</div>
{foreach $groupedItems as $groupName => $group}
<div class="form-group" style="border-top: 1px solid #ddd; padding-top: 10px; margin-top: 20px;">
<label class="control-label col-xs-12 col-sm-2 text-left" style="font-weight: bold;">{$groupName}</label>
</div>
{foreach $group as $index => $item}
{if $index % 2 == 0}<div class="form-group">{/if}
<label class="control-label col-xs-12 col-sm-1">{$item.name}:</label>
<div class="col-xs-12 col-sm-4">
<input class="form-control" step="0.01" name="row[item_{$item.id}]" type="number" value="">
</div>
{if $index % 2 == 1 || $index == count($group) - 1}</div>{/if}
{/foreach}
{/foreach}
<div class="form-group layer-footer">

View File

@ -19,8 +19,8 @@
{foreach $group as $index => $item}
{if $index % 2 == 0}<div class="form-group">{/if}
<label class="control-label col-xs-12 col-sm-2">{$item.name}:</label>
<div class="col-xs-12 col-sm-5">
<label class="control-label col-xs-12 col-sm-1">{$item.name}:</label>
<div class="col-xs-12 col-sm-4">
<input class="form-control" step="0.01" name="row[item_{$item.id}]" type="number" value="{$row['item_' . $item.id]|htmlentities}">
</div>
{if $index % 2 == 1 || $index == count($group) - 1}</div>{/if}

View File

@ -10,6 +10,12 @@
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('salary/detail/custom_add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"

View File

@ -46,8 +46,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'salary/detail/custom_index' + location.search,
// add_url: 'oa/schedule/add',
// editable: 'oa/schedule/editable',
add_url: 'salary/detail/custom_add',
// del_url: 'oa/schedule/del',
// multi_url: 'oa/schedule/multi',
// import_url: 'oa/schedule/import',