From e4994fccfb49ebfb108ba62cbd82aea4e004f6d8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 15 十月 2026 10:02:46 +0800
Subject: [PATCH] fix(mes/qc): 不合格品处理单的不合格物料改查 MDM 物料
---
src/views/hrm/salary/calculation/index.vue | 122 ++++++++++++++++++++++++++++++----------
1 files changed, 91 insertions(+), 31 deletions(-)
diff --git a/src/views/hrm/salary/calculation/index.vue b/src/views/hrm/salary/calculation/index.vue
index 8536a41..3b58d12 100644
--- a/src/views/hrm/salary/calculation/index.vue
+++ b/src/views/hrm/salary/calculation/index.vue
@@ -2,7 +2,7 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { HrmSalaryCalculationApi } from '#/api/hrm/salary/calculation';
-import { ref } from 'vue';
+import { ref, watch } from 'vue';
import { Page } from '#/packages/effects/common-ui/src';
import { downloadFileFromBlobPart } from '#/packages/utils/src';
@@ -14,11 +14,12 @@
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
- calculateSalary,
confirmSalary,
+ deleteSalaryCalculation,
exportSalaryCalculation,
getSalaryCalculationPage,
previewSalaryCalculation,
+ revokeSalaryCalculation,
saveSalaryCalculation,
} from '#/api/hrm/salary/calculation';
import { getDeptList } from '#/api/system/dept';
@@ -35,7 +36,6 @@
const previewLoading = ref(false);
const previewData = ref<HrmSalaryCalculationApi.SalaryCalculation[]>([]);
const submitLoading = ref(false);
-const calculateLoading = ref(false);
// 鎵撳紑鏍哥畻寮圭獥
async function openCalculateModal() {
@@ -54,25 +54,14 @@
gridApi.query();
}
-/** 鎵ц钖叕鏍哥畻锛堣嚜鍔ㄨ绠楀苟淇濆瓨锛� */
-async function handleCalculate() {
- if (!calculatePeriod.value) {
- message.warning('璇烽�夋嫨鏍哥畻鍛ㄦ湡');
- return;
+// 鏍哥畻鎴愭灉鍙厑璁稿湪銆岄瑙� 鈫� 淇濆瓨銆嶄箣闂存祦杞細鏀逛簡鍛ㄦ湡/閮ㄩ棬灏卞繀椤婚噸鏂伴瑙堬紝
+// 鍚﹀垯浼氭妸涓婁竴杞殑棰勮缁撴灉鎸夋柊鐨勫懆鏈熷瓨涓嬪幓
+watch([calculatePeriod, calculateDeptId], () => {
+ if (previewData.value.length > 0) {
+ previewData.value = [];
+ message.info('鏍哥畻鍛ㄦ湡鎴栭儴闂ㄥ凡鍙樻洿锛岃閲嶆柊棰勮鏁版嵁');
}
- calculateLoading.value = true;
- try {
- await calculateSalary({
- period: calculatePeriod.value,
- deptId: calculateDeptId.value,
- });
- message.success('钖叕鏍哥畻鎵ц鎴愬姛');
- calculateVisible.value = false;
- handleRefresh();
- } finally {
- calculateLoading.value = false;
- }
-}
+});
/** 棰勮鏍哥畻鏁版嵁 */
async function handlePreview() {
@@ -153,7 +142,7 @@
handleRefresh();
}
-/** 鎵归噺纭 */
+/** 鎵归噺纭閫変腑鐨勮褰� */
async function handleBatchConfirm() {
const records = gridApi.grid.getCheckboxRecords() as HrmSalaryCalculationApi.SalaryCalculation[];
if (records.length === 0) {
@@ -164,6 +153,58 @@
await confirmSalary(ids);
message.success('纭鎴愬姛');
handleRefresh();
+}
+
+/** 鎵归噺淇濆瓨閫変腑鐨勬牳绠楄褰曪紙浠呭緟纭鐘舵�侊級 */
+async function handleBatchSave() {
+ const records = gridApi.grid.getCheckboxRecords() as HrmSalaryCalculationApi.SalaryCalculation[];
+ if (records.length === 0) {
+ message.warning('璇烽�夋嫨瑕佷繚瀛樼殑璁板綍');
+ return;
+ }
+ const pending = records.filter((r) => r.status === 0);
+ if (pending.length === 0) {
+ message.warning('閫変腑鐨勮褰曞潎闈炲緟纭鐘舵�侊紝鏃犻渶淇濆瓨');
+ return;
+ }
+ const first = pending[0];
+ if (!first?.period) {
+ message.warning('缂哄皯鏍哥畻鍛ㄦ湡');
+ return;
+ }
+ await saveSalaryCalculation({ period: first.period, list: pending });
+ message.success('鎵归噺淇濆瓨鎴愬姛');
+ handleRefresh();
+}
+
+/** 鎾ら攢纭锛堝凡纭 鈫� 寰呯‘璁わ紝鍙噸鏂版牳绠楋級 */
+async function handleRevoke(row: HrmSalaryCalculationApi.SalaryCalculation) {
+ Modal.confirm({
+ title: '鎾ら攢纭',
+ content: `纭畾鎾ら攢銆�${row.no}銆戠殑纭鍚楋紵鎾ら攢鍚庡彲閲嶆柊鏍哥畻銆俙,
+ okText: '纭畾',
+ cancelText: '鍙栨秷',
+ onOk: async () => {
+ await revokeSalaryCalculation([row.id!]);
+ message.success('鎾ら攢鎴愬姛');
+ handleRefresh();
+ },
+ });
+}
+
+/** 鍒犻櫎寰呯‘璁ょ殑鏍哥畻璁板綍 */
+async function handleDelete(row: HrmSalaryCalculationApi.SalaryCalculation) {
+ Modal.confirm({
+ title: '纭鍒犻櫎',
+ content: `纭畾鍒犻櫎銆�${row.no}銆戠殑鏍哥畻璁板綍鍚楋紵鍒犻櫎鍚庨渶閲嶆柊鏍哥畻銆俙,
+ okText: '纭畾',
+ cancelText: '鍙栨秷',
+ onOk: async () => {
+ await deleteSalaryCalculation(row.id!);
+ message.success('鍒犻櫎鎴愬姛');
+ handleRefresh();
+ },
+ });
}
/** 瀵煎嚭钖叕鏍哥畻 */
@@ -182,7 +223,6 @@
keepSource: true,
checkboxConfig: {
highlight: true,
- reserve: true,
},
proxyConfig: {
ajax: {
@@ -193,6 +233,10 @@
...formValues,
}),
},
+ },
+ pagingConfig: {
+ pageSize: 20,
+ pageSizes: [20, 50, 100],
},
rowConfig: {
keyField: 'id',
@@ -217,7 +261,7 @@
:maskClosable="false"
>
<Alert
- message="涓ょ鏍哥畻鏂瑰紡锛�1. 鎵ц鏍哥畻 - 鑷姩璁$畻骞朵繚瀛橈紱2. 棰勮鏁版嵁 - 鎵嬪姩璋冩暣鍚庝繚瀛�"
+ message="鏍哥畻娴佺▼锛氶�夊ソ鏍哥畻鍛ㄦ湡涓庨儴闂ㄥ悗鐐广�岄瑙堟暟鎹�嶁啋 鏍稿/璋冩暣鍚勯」閲戦 鈫� 鐐广�屼繚瀛樻牳绠椼�嶈惤搴�"
type="info"
show-icon
style="margin-bottom: 16px"
@@ -246,12 +290,7 @@
/>
</FormItem>
<FormItem>
- <a-button type="primary" :loading="calculateLoading" @click="handleCalculate">
- 鎵ц鏍哥畻
- </a-button>
- </FormItem>
- <FormItem>
- <a-button :loading="previewLoading" @click="handlePreview">
+ <a-button type="primary" :loading="previewLoading" @click="handlePreview">
棰勮鏁版嵁
</a-button>
</FormItem>
@@ -261,7 +300,7 @@
v-if="previewData.length > 0"
:columns="usePreviewColumns()"
:data-source="previewData"
- :pagination="false"
+ :pagination="{ pageSize: 20, showSizeChanger: true, showTotal: (t) => `鍏� ${t} 浜篳 }"
:scroll="{ x: 1800, y: 400 }"
size="small"
row-key="userId"
@@ -430,6 +469,12 @@
onClick: handleBatchConfirm,
},
{
+ label: '鎵归噺淇濆瓨',
+ type: 'primary',
+ auth: ['hrm:salary-calculation:save'],
+ onClick: handleBatchSave,
+ },
+ {
label: $t('ui.actionTitle.export'),
type: 'primary',
icon: ACTION_ICON.DOWNLOAD,
@@ -454,6 +499,21 @@
ifShow: row.status === 0,
onClick: handleConfirm.bind(null, row),
},
+ {
+ label: '鍒犻櫎',
+ type: 'link',
+ danger: true,
+ auth: ['hrm:salary-calculation:delete'],
+ ifShow: row.status === 0,
+ onClick: handleDelete.bind(null, row),
+ },
+ {
+ label: '鎾ら攢纭',
+ type: 'link',
+ auth: ['hrm:salary-calculation:confirm'],
+ ifShow: row.status === 10,
+ onClick: handleRevoke.bind(null, row),
+ },
]"
/>
</template>
--
Gitblit v1.9.3