From 7a5c5250b66cc6faffbcac9e192073473c50f79f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 28 八月 2026 17:02:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0
---
src/views/hrm/shift/index.vue | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 162 insertions(+), 0 deletions(-)
diff --git a/src/views/hrm/shift/index.vue b/src/views/hrm/shift/index.vue
new file mode 100644
index 0000000..1e98746
--- /dev/null
+++ b/src/views/hrm/shift/index.vue
@@ -0,0 +1,162 @@
+<script lang="ts" setup>
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { HrmShiftApi } from '#/api/hrm/shift';
+
+import { Page, useVbenModal } from '#/packages/effects/common-ui/src';
+import { downloadFileFromBlobPart } from '#/packages/utils/src';
+
+import { message, Modal } from 'ant-design-vue';
+
+import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+import {
+ deleteShift,
+ exportShift,
+ getShiftPage,
+} from '#/api/hrm/shift';
+import { $t } from '#/locales';
+
+import { SHIFT_COLORS, useGridColumns, useGridFormSchema } from './data';
+import Form from './modules/form.vue';
+
+const [FormModal, formModalApi] = useVbenModal({
+ connectedComponent: Form,
+ destroyOnClose: true,
+});
+
+/** 鍒锋柊琛ㄦ牸 */
+function handleRefresh() {
+ gridApi.query();
+}
+
+/** 鏂板鐝 */
+function handleCreate() {
+ formModalApi.setData({ formType: 'create' }).open();
+}
+
+/** 缂栬緫鐝 */
+function handleUpdate(row: HrmShiftApi.Shift) {
+ formModalApi.setData({ id: row.id, formType: 'update' }).open();
+}
+
+/** 鏌ョ湅鐝 */
+function handleDetail(row: HrmShiftApi.Shift) {
+ formModalApi.setData({ id: row.id, formType: 'detail' }).open();
+}
+
+/** 鍒犻櫎鐝 */
+async function handleDelete(id: number) {
+ Modal.confirm({
+ title: '纭鍒犻櫎',
+ content: '纭畾瑕佸垹闄よ鐝鍚楋紵鍒犻櫎鍚庡凡鏈夋帓鐝皢澶卞幓鐝淇℃伅銆�',
+ okText: '纭畾',
+ cancelText: '鍙栨秷',
+ onOk: async () => {
+ await deleteShift(id);
+ message.success('鍒犻櫎鎴愬姛');
+ handleRefresh();
+ },
+ });
+}
+
+/** 瀵煎嚭鐝 */
+async function handleExport() {
+ const data = await exportShift(await gridApi.formApi.getValues());
+ downloadFileFromBlobPart({ fileName: '鐝.xls', source: data });
+}
+
+const [Grid, gridApi] = useVbenVxeGrid({
+ formOptions: {
+ schema: useGridFormSchema(),
+ },
+ gridOptions: {
+ columns: useGridColumns(),
+ height: 'auto',
+ keepSource: true,
+ proxyConfig: {
+ ajax: {
+ query: async ({ page }, formValues) =>
+ await getShiftPage({
+ pageNo: page.currentPage,
+ pageSize: page.pageSize,
+ ...formValues,
+ }),
+ },
+ },
+ rowConfig: {
+ keyField: 'id',
+ isHover: true,
+ },
+ toolbarConfig: {
+ refresh: true,
+ search: true,
+ },
+ } as VxeTableGridOptions<HrmShiftApi.Shift>,
+});
+</script>
+
+<template>
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
+ <Grid table-title="鐝鍒楄〃">
+ <template #toolbar-tools>
+ <TableAction
+ :actions="[
+ {
+ label: $t('ui.actionTitle.create', ['鐝']),
+ type: 'primary',
+ icon: ACTION_ICON.ADD,
+ auth: ['hrm:shift:create'],
+ onClick: handleCreate,
+ },
+ {
+ label: $t('ui.actionTitle.export'),
+ type: 'primary',
+ icon: ACTION_ICON.DOWNLOAD,
+ auth: ['hrm:shift:export'],
+ onClick: handleExport,
+ },
+ ]"
+ />
+ </template>
+ <template #color="{ row }">
+ <div class="flex items-center gap-2">
+ <span
+ class="inline-block h-4 w-4 rounded"
+ :style="{ backgroundColor: row.color || '#8c8c8c' }"
+ />
+ <span>
+ {{
+ SHIFT_COLORS.find((item) => item.value === row.color)?.label ||
+ row.color ||
+ '-'
+ }}
+ </span>
+ </div>
+ </template>
+ <template #actions="{ row }">
+ <TableAction
+ :actions="[
+ {
+ label: '鏌ョ湅',
+ type: 'link',
+ onClick: handleDetail.bind(null, row),
+ },
+ {
+ label: $t('ui.actionTitle.edit'),
+ type: 'link',
+ auth: ['hrm:shift:update'],
+ onClick: handleUpdate.bind(null, row),
+ },
+ {
+ label: $t('ui.actionTitle.delete'),
+ type: 'link',
+ danger: true,
+ auth: ['hrm:shift:delete'],
+ onClick: handleDelete.bind(null, row.id!),
+ },
+ ]"
+ />
+ </template>
+ </Grid>
+ </Page>
+</template>
--
Gitblit v1.9.3