From dc1d067c566bbde1c7170186960a8bd27f210a47 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 09 九月 2026 13:45:58 +0800
Subject: [PATCH] feat(bi): 新增决策总览仪表盘并优化预测分析功能
---
src/views/wls/equipmentreceipt/modules/line-list.vue | 142 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 142 insertions(+), 0 deletions(-)
diff --git a/src/views/wls/equipmentreceipt/modules/line-list.vue b/src/views/wls/equipmentreceipt/modules/line-list.vue
new file mode 100644
index 0000000..e156dab
--- /dev/null
+++ b/src/views/wls/equipmentreceipt/modules/line-list.vue
@@ -0,0 +1,142 @@
+<script lang="ts" setup>
+import type { FormType } from '../data';
+
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MesWmEquipmentReceiptLineApi } from '#/api/mes/wm/equipmentreceipt/line';
+
+import { computed } from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import { message } from 'ant-design-vue';
+
+import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+import {
+ deleteEquipmentReceiptLine,
+ getEquipmentReceiptLineListByReceiptId,
+} from '#/api/mes/wm/equipmentreceipt/line';
+import { $t } from '#/locales';
+
+import { useLineGridColumns } from '../data';
+import LineForm from './line-form.vue';
+
+const props = defineProps<{
+ formType: FormType;
+ receiptId: number;
+}>();
+
+const isEditable = computed(() =>
+ // 鏄惁鍙紪杈戞槑缁嗚
+ ['create', 'update'].includes(props.formType),
+);
+
+const [LineFormModal, lineFormModalApi] = useVbenModal({
+ connectedComponent: LineForm,
+ destroyOnClose: true,
+});
+
+/** 鍒锋柊琛ㄦ牸 */
+function handleRefresh() {
+ gridApi.query();
+}
+
+/** 娣诲姞璁惧 */
+function handleCreate() {
+ lineFormModalApi.setData({ receiptId: props.receiptId }).open();
+}
+
+/** 缂栬緫璁惧 */
+function handleEdit(row: MesWmEquipmentReceiptLineApi.EquipmentReceiptLine) {
+ lineFormModalApi.setData({ id: row.id, receiptId: props.receiptId }).open();
+}
+
+/** 鍒犻櫎璁惧 */
+async function handleDelete(row: MesWmEquipmentReceiptLineApi.EquipmentReceiptLine) {
+ const hideLoading = message.loading({
+ content: $t('ui.actionMessage.deleting', [row.machineryName]),
+ duration: 0,
+ });
+ try {
+ await deleteEquipmentReceiptLine(row.id!);
+ message.success($t('ui.actionMessage.deleteSuccess', [row.machineryName]));
+ handleRefresh();
+ } finally {
+ hideLoading();
+ }
+}
+
+const [Grid, gridApi] = useVbenVxeGrid({
+ gridOptions: {
+ columns: useLineGridColumns(isEditable.value),
+ height: 360,
+ keepSource: true,
+ pagerConfig: {
+ enabled: false,
+ },
+ proxyConfig: {
+ ajax: {
+ query: async () => {
+ if (!props.receiptId) {
+ return { list: [], total: 0 };
+ }
+ const list = await getEquipmentReceiptLineListByReceiptId(
+ props.receiptId,
+ );
+ return { list, total: list.length };
+ },
+ },
+ },
+ rowConfig: {
+ keyField: 'id',
+ isHover: true,
+ },
+ toolbarConfig: {
+ refresh: true,
+ },
+ } as VxeTableGridOptions<MesWmEquipmentReceiptLineApi.EquipmentReceiptLine>,
+});
+</script>
+
+<template>
+ <div>
+ <LineFormModal @success="handleRefresh" />
+ <Grid table-title="璁惧鏄庣粏">
+ <template v-if="isEditable" #toolbar-tools>
+ <TableAction
+ :actions="[
+ {
+ label: '娣诲姞璁惧',
+ type: 'primary',
+ icon: ACTION_ICON.ADD,
+ onClick: handleCreate,
+ },
+ ]"
+ />
+ </template>
+ <template #actions="{ row }">
+ <TableAction
+ :actions="[
+ {
+ label: $t('common.edit'),
+ type: 'link',
+ icon: ACTION_ICON.EDIT,
+ ifShow: isEditable,
+ onClick: handleEdit.bind(null, row),
+ },
+ {
+ label: $t('common.delete'),
+ type: 'link',
+ danger: true,
+ icon: ACTION_ICON.DELETE,
+ ifShow: isEditable,
+ popConfirm: {
+ title: $t('ui.actionMessage.deleteConfirm', [row.machineryName]),
+ confirm: handleDelete.bind(null, row),
+ },
+ },
+ ]"
+ />
+ </template>
+ </Grid>
+ </div>
+</template>
\ No newline at end of file
--
Gitblit v1.9.3