From 8d7aceaf708cf98c02245758e9ea6516ea9afc72 Mon Sep 17 00:00:00 2001 From: zhuyu Date: Fri, 27 Jun 2025 10:03:01 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E6=8E=92=E7=8F=AD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/oa/CustomSchedule.php | 17 +++++--------- .../admin/view/oa/custom_schedule/index.html | 2 +- .../assets/js/backend/oa/custom_schedule.js | 22 ++++++++++--------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/application/admin/controller/oa/CustomSchedule.php b/application/admin/controller/oa/CustomSchedule.php index 556896c..2965bee 100644 --- a/application/admin/controller/oa/CustomSchedule.php +++ b/application/admin/controller/oa/CustomSchedule.php @@ -83,7 +83,7 @@ class CustomSchedule extends Backend } foreach ($adminIds as $adminId) { - $res[$adminId][$tmpDate] = '无'; + $res[$adminId][$tmpDate] = ''; $res[$adminId]['admin_id'] = $adminId; $res[$adminId]['name'] = $adminNames[$adminId]; $res[$adminId]['editable'] = $this->auth->check('oa/custom_schedule/edit') ? 1 : 0; @@ -117,7 +117,7 @@ class CustomSchedule extends Backend $type = $queryDatum['type']; if (isset($res[$adminId][$date])) { - $res[$adminId][$date] = $this->model->getTypeList()[$type]; + $res[$adminId][$date] = $type; } } @@ -271,21 +271,14 @@ class CustomSchedule extends Backend $date = $params['field']; $adminId = $params['admin_id']; - $value = $params[$date] ?? '无'; - $valueMap = [ - '无' => 0, - '早班' => 1, - '中班' => 2, - '晚班' => 3, - '行政班' => 4, - ]; + $value = $params[$date] ?? ''; - if ($value == '无') { + if (empty($value)) { $this->model->where('exec_admin_id', $adminId)->delete(); $this->success(); } - $dbValue = $valueMap[$value]; + $dbValue = $value; $data = $this->model ->where('date', '=', $date) diff --git a/application/admin/view/oa/custom_schedule/index.html b/application/admin/view/oa/custom_schedule/index.html index ded855f..f002e77 100644 --- a/application/admin/view/oa/custom_schedule/index.html +++ b/application/admin/view/oa/custom_schedule/index.html @@ -7,7 +7,7 @@
- {:__('Add')} + 批量排班 diff --git a/public/assets/js/backend/oa/custom_schedule.js b/public/assets/js/backend/oa/custom_schedule.js index d5cf639..28ad88d 100644 --- a/public/assets/js/backend/oa/custom_schedule.js +++ b/public/assets/js/backend/oa/custom_schedule.js @@ -44,13 +44,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function "field": tmpDate, "editable" :{ type: 'select', + emptytext: '_', pk: 1, source: [ - {value: '无', text: '无'}, - {value: '早班', text: '早班'}, - {value: '中班', text: '中班'}, - {value: '晚班', text: '晚班'}, - {value: '行政班', text: '行政班'}, + {value: '0', text: ''}, + {value: '1', text: '早班'}, + {value: '2', text: '中班'}, + {value: '3', text: '晚班'}, + {value: '4', text: '行政班'}, ], noeditFormatter: function (value, row, index) { if (row.editable === 1) { @@ -102,13 +103,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function "field": tmpDate, "editable" :{ type: 'select', + emptytext: '_', pk: 1, source: [ - {value: '无', text: '无'}, - {value: '早班', text: '早班'}, - {value: '中班', text: '中班'}, - {value: '晚班', text: '晚班'}, - {value: '行政班', text: '行政班'}, + {value: '0', text: ''}, + {value: '1', text: '早班'}, + {value: '2', text: '中班'}, + {value: '3', text: '晚班'}, + {value: '4', text: '行政班'}, ] } });