From 27c8277d717b34b55f3ea967027b53b067f77df3 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 20 八月 2026 16:58:49 +0800
Subject: [PATCH] feat 功能变更
---
src/views/hrm/performance-appraise/modules/item.vue | 147 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 147 insertions(+), 0 deletions(-)
diff --git a/src/views/hrm/performance-appraise/modules/item.vue b/src/views/hrm/performance-appraise/modules/item.vue
new file mode 100644
index 0000000..c017d22
--- /dev/null
+++ b/src/views/hrm/performance-appraise/modules/item.vue
@@ -0,0 +1,147 @@
+<script lang="ts" setup>
+import type { HrmPerformanceAppraiseApi } from '#/api/hrm/performance-appraise';
+
+import { ref } from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import { message } from 'ant-design-vue';
+
+import {
+ getAppraiseItemList,
+ saveAppraiseItems,
+} from '#/api/hrm/performance-appraise';
+
+const emit = defineEmits(['success']);
+
+const appraiseId = ref<number>();
+const items = ref<HrmPerformanceAppraiseApi.AppraiseItem[]>([]);
+
+const SCORER_TYPE_OPTIONS = [
+ { label: '鑷瘎', value: 1 },
+ { label: '涓婄骇璇�', value: 2 },
+];
+
+function addRow() {
+ items.value.push({
+ itemName: '',
+ weight: undefined,
+ scoringStandard: '',
+ scorerType: 1,
+ sort: items.value.length + 1,
+ });
+}
+
+function removeRow(index: number) {
+ items.value.splice(index, 1);
+ items.value.forEach((item, idx) => {
+ item.sort = idx + 1;
+ });
+}
+
+const [Modal, modalApi] = useVbenModal({
+ async onConfirm() {
+ // 鏍¢獙锛氭寚鏍囧悕绉颁笌鏉冮噸蹇呭~
+ const invalid = items.value.some(
+ (item) => !item.itemName || item.weight == null,
+ );
+ if (invalid) {
+ message.warning('璇峰~鍐欏畬鏁寸殑鎸囨爣鍚嶇О涓庢潈閲�');
+ return;
+ }
+ modalApi.lock();
+ try {
+ await saveAppraiseItems({ appraiseId: appraiseId.value!, items: items.value });
+ await modalApi.close();
+ emit('success');
+ message.success('鎸囨爣淇濆瓨鎴愬姛');
+ } finally {
+ modalApi.unlock();
+ }
+ },
+ async onOpenChange(isOpen: boolean) {
+ if (!isOpen) {
+ appraiseId.value = undefined;
+ items.value = [];
+ return;
+ }
+ const data = modalApi.getData<{ id: number }>();
+ appraiseId.value = data?.id;
+ modalApi.lock();
+ try {
+ items.value = await getAppraiseItemList(appraiseId.value!);
+ } finally {
+ modalApi.unlock();
+ }
+ },
+});
+</script>
+
+<template>
+ <Modal title="閰嶇疆鑰冩牳鎸囨爣" class="w-3/4">
+ <div class="mb-3 flex items-center justify-between">
+ <span class="text-sm text-gray-500">璁剧疆鑰冩牳鎸囨爣鍚嶇О銆佹潈閲嶄笌璇勫垎鏍囧噯锛屾潈閲嶅悎璁″缓璁� 100</span>
+ <a-button type="primary" @click="addRow">娣诲姞鎸囨爣</a-button>
+ </div>
+ <a-table
+ :data-source="items"
+ :pagination="false"
+ :scroll="{ y: 360 }"
+ bordered
+ row-key="sort"
+ size="small"
+ >
+ <a-table-column title="鎸囨爣鍚嶇О" width="220">
+ <template #default="{ record }">
+ <a-input
+ v-model:value="record.itemName"
+ placeholder="璇疯緭鍏ユ寚鏍囧悕绉�"
+ />
+ </template>
+ </a-table-column>
+ <a-table-column title="鏉冮噸" width="120">
+ <template #default="{ record }">
+ <a-input-number
+ v-model:value="record.weight"
+ :min="0"
+ :precision="2"
+ class="!w-full"
+ placeholder="鏉冮噸"
+ />
+ </template>
+ </a-table-column>
+ <a-table-column title="璇勫垎鏍囧噯" min-width="220">
+ <template #default="{ record }">
+ <a-input
+ v-model:value="record.scoringStandard"
+ placeholder="璇疯緭鍏ヨ瘎鍒嗘爣鍑�"
+ />
+ </template>
+ </a-table-column>
+ <a-table-column title="璇勫垎浜�" width="120">
+ <template #default="{ record }">
+ <a-select
+ v-model:value="record.scorerType"
+ :options="SCORER_TYPE_OPTIONS"
+ class="!w-full"
+ />
+ </template>
+ </a-table-column>
+ <a-table-column title="鎺掑簭" width="90">
+ <template #default="{ record }">
+ <a-input-number
+ v-model:value="record.sort"
+ :min="1"
+ :precision="0"
+ class="!w-full"
+ />
+ </template>
+ </a-table-column>
+ <a-table-column title="鎿嶄綔" width="80" align="center">
+ <template #default="{ index }">
+ <a-button type="link" danger @click="removeRow(index)">鍒犻櫎</a-button>
+ </template>
+ </a-table-column>
+ </a-table>
+ </Modal>
+</template>
--
Gitblit v1.9.3