703 lines
20 KiB
Plaintext
703 lines
20 KiB
Plaintext
<template>
|
|
<div class="fa-full-height">
|
|
<FaSearchBar
|
|
v-show="showSearchBar"
|
|
ref="searchBarRef"
|
|
v-model="searchForm"
|
|
:items="SeedlingSearchItems"
|
|
:rules="searchBarRules"
|
|
:is-expand="false"
|
|
:show-expand="true"
|
|
:show-reset="true"
|
|
:show-search="true"
|
|
:disabled-search="false"
|
|
:default-expanded="false"
|
|
include-audit
|
|
@search="handleSearch"
|
|
@reset="onResetSearch"
|
|
/>
|
|
|
|
<ElCard class="fa-table-card" :style="{ 'margin-top': showSearchBar ? '12px' : '0' }">
|
|
<FaTableHeader
|
|
v-model:columns="columnChecks"
|
|
v-model:showSearchBar="showSearchBar"
|
|
:loading="loading"
|
|
@refresh="refreshData"
|
|
>
|
|
<template #left>
|
|
<FaTableHeaderLeft
|
|
:remove-ids="selectedIds"
|
|
:perm-create="['module_bre:seedling:create']"
|
|
:perm-import="['module_bre:seedling:import']"
|
|
:perm-export="['module_bre:seedling:export']"
|
|
:perm-delete="['module_bre:seedling:delete']"
|
|
:delete-loading="batchDeleting"
|
|
:create-loading="createLoading"
|
|
@add="handleAdd"
|
|
@import="openImport"
|
|
@export="openExport"
|
|
@delete="handleBatchDelete"
|
|
/>
|
|
</template>
|
|
</FaTableHeader>
|
|
|
|
<FaTable
|
|
ref="faTableRef"
|
|
:loading="loading"
|
|
:data="data"
|
|
:columns="columns"
|
|
:pagination="pagination"
|
|
@selection-change="onTableSelectionChange"
|
|
@pagination:size-change="handleSizeChange"
|
|
@pagination:current-change="handleCurrentChange"
|
|
/>
|
|
</ElCard>
|
|
|
|
<FaDialog
|
|
v-model="dialogVisible.visible"
|
|
:title="dialogVisible.title"
|
|
width="920px"
|
|
dialog-class="crud-embed-dialog"
|
|
modal-class="crud-embed-dialog"
|
|
:form-mode="dialogVisible.type"
|
|
:confirm-loading="submitLoading"
|
|
:close-on-click-modal="false"
|
|
@cancel="crud.handleCloseDialog"
|
|
@close="crud.handleCloseDialog"
|
|
@confirm="crud.handleSubmit"
|
|
>
|
|
<template v-if="dialogVisible.type === 'detail'">
|
|
<FaDescriptions
|
|
:column="4"
|
|
:data="detailFormData"
|
|
:items="SeedlingDetailItems"
|
|
max-height="70vh"
|
|
/>
|
|
</template>
|
|
<template v-else>
|
|
<FaForm
|
|
:key="SeedlingFormRenderKey"
|
|
scrollbar
|
|
max-height="70vh"
|
|
ref="dataFormRef"
|
|
v-model="formData"
|
|
:items="SeedlingDialogFormItems"
|
|
:rules="rules"
|
|
label-suffix=":"
|
|
:label-width="120"
|
|
label-position="right"
|
|
:span="12"
|
|
:gutter="16"
|
|
:show-reset="false"
|
|
:show-submit="false"
|
|
class="crud-dialog-art-form"
|
|
/>
|
|
</template>
|
|
</FaDialog>
|
|
|
|
<FaImportDialog
|
|
v-model="importVisible"
|
|
:content-config="SeedlingImportContentConfig"
|
|
default-template-file-name="seedling_import_template.xlsx"
|
|
@upload="handleCrudImportUpload"
|
|
/>
|
|
|
|
<FaExportDialog
|
|
v-model="exportVisible"
|
|
:content-config="SeedlingExportContentConfig"
|
|
:query-params="exportQueryParams"
|
|
:page-data="data"
|
|
:selection-data="selectedRows"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { TableOperationAction } from "@/utils/table";
|
|
import { renderTableOperationCell, stripPaginationParams, toCrudCols } from "@utils";
|
|
import { useCrudForm } from "@/hooks/core/useCrudForm";
|
|
import { ResultEnum } from "@/enums/api/result.enum";
|
|
import type { IContentConfig, IObject } from "@/components/modal/types";
|
|
import type { AuditSearchFormParams } from "@/components/forms/fa-search-bar/auditSearchFormItems";
|
|
import type { FormItem } from "@/components/forms/fa-form/index.vue";
|
|
import CrossCombinationAPI, { type CrossCombinationOption } from "@/api/module_bre/cross_combination";
|
|
import PersonnelAPI, { type PersonnelOption } from "@/api/module_bre/personnel";
|
|
import SeedTreatmentAPI, { type SeedTreatmentOption } from "@/api/module_bre/seed_treatment";
|
|
import SeedlingAPI, { type SeedlingForm, type SeedlingPageQuery, type SeedlingTable } from "@/api/module_bre/seedling";
|
|
import type { ColumnOption } from "@/types/component";
|
|
import FaDescriptions from "@/components/others/fa-descriptions/index.vue";
|
|
import FaForm from "@/components/forms/fa-form/index.vue";
|
|
import FaTableHeader from "@/components/tables/fa-table-header/index.vue";
|
|
|
|
defineOptions({
|
|
name: "Seedling",
|
|
inheritAttrs: false,
|
|
});
|
|
|
|
const cross_combinationOptions = ref<CrossCombinationOption[]>([]);
|
|
const personnelOptions = ref<PersonnelOption[]>([]);
|
|
const treatmentOptions = ref<SeedTreatmentOption[]>([]);
|
|
|
|
const cross_combinationOptionsMap = computed(() => {
|
|
const m: Record<number, string> = {};
|
|
for (const o of cross_combinationOptions.value) m[o.value] = o.label;
|
|
return m;
|
|
});
|
|
const personnelOptionsMap = computed(() => {
|
|
const m: Record<number, string> = {};
|
|
for (const o of personnelOptions.value) m[o.value] = o.label;
|
|
return m;
|
|
});
|
|
|
|
async function loadCrossCombinationOptions() {
|
|
try {
|
|
const res = await CrossCombinationAPI.getCrossCombinationOptions();
|
|
if (res.data.code === ResultEnum.SUCCESS) {
|
|
cross_combinationOptions.value = res.data.data ?? [];
|
|
}
|
|
} catch (error: unknown) {
|
|
if (import.meta.env.DEV) console.error("[Seedling] loadCrossCombinationOptions", error);
|
|
}
|
|
}
|
|
async function loadPersonnelOptions() {
|
|
try {
|
|
const res = await PersonnelAPI.getPersonnelOptions();
|
|
if (res.data.code === ResultEnum.SUCCESS) {
|
|
personnelOptions.value = res.data.data ?? [];
|
|
}
|
|
} catch (error: unknown) {
|
|
if (import.meta.env.DEV) console.error("[Seedling] loadPersonnelOptions", error);
|
|
}
|
|
}
|
|
async function loadTreatmentOptions() {
|
|
try {
|
|
const res = await SeedTreatmentAPI.getSeedTreatmentOptions();
|
|
if (res.data.code === ResultEnum.SUCCESS) {
|
|
treatmentOptions.value = res.data.data ?? [];
|
|
}
|
|
} catch (error: unknown) {
|
|
if (import.meta.env.DEV) console.error("[Seedling] loadTreatmentOptions", error);
|
|
}
|
|
}
|
|
|
|
const createInitialFormData = (): SeedlingForm => ({
|
|
id: undefined,
|
|
combination_id: undefined,
|
|
treatment_id: undefined,
|
|
batch_no: undefined,
|
|
sowing_date: undefined,
|
|
tray_no: undefined,
|
|
nursery: undefined,
|
|
seedling_count: undefined,
|
|
emergence_date: undefined,
|
|
strong_seedling_date: undefined,
|
|
strong_seedling_count: undefined,
|
|
stage: "1",
|
|
bre_personnel_id: undefined,
|
|
remark: undefined,
|
|
});
|
|
|
|
type SeedlingSearchFormParams = {
|
|
combination_id?: number;
|
|
treatment_id?: number;
|
|
batch_no?: string;
|
|
tray_no?: string;
|
|
nursery?: string;
|
|
bre_personnel_id?: number;
|
|
} & AuditSearchFormParams;
|
|
|
|
const searchForm = ref<SeedlingSearchFormParams>({
|
|
combination_id: undefined,
|
|
treatment_id: undefined,
|
|
batch_no: undefined,
|
|
tray_no: undefined,
|
|
nursery: undefined,
|
|
bre_personnel_id: undefined,
|
|
created_id: undefined,
|
|
updated_id: undefined,
|
|
created_time: [],
|
|
updated_time: [],
|
|
});
|
|
|
|
const showSearchBar = ref(true);
|
|
const searchBarRef = ref<{ validate: () => Promise<boolean> } | null>(null);
|
|
const searchBarRules: Record<string, unknown> = {};
|
|
|
|
const SeedlingSearchItems = computed(() => [
|
|
{
|
|
label: "杂交组合",
|
|
key: "combination_id",
|
|
type: "select",
|
|
props: {
|
|
placeholder: "请选择杂交组合",
|
|
options: cross_combinationOptions.value,
|
|
clearable: true,
|
|
filterable: true,
|
|
},
|
|
span: 8,
|
|
},
|
|
{
|
|
label: "来源种子处理",
|
|
key: "treatment_id",
|
|
type: "select",
|
|
props: {
|
|
placeholder: "请选择来源种子处理",
|
|
options: treatmentOptions.value,
|
|
clearable: true,
|
|
filterable: true,
|
|
},
|
|
span: 8,
|
|
},
|
|
{
|
|
label: "育苗批次号",
|
|
key: "batch_no",
|
|
type: "input",
|
|
placeholder: "请输入育苗批次号",
|
|
clearable: true,
|
|
span: 8,
|
|
},
|
|
{
|
|
label: "穴盘号",
|
|
key: "tray_no",
|
|
type: "input",
|
|
placeholder: "请输入穴盘号",
|
|
clearable: true,
|
|
span: 8,
|
|
},
|
|
{
|
|
label: "苗圃",
|
|
key: "nursery",
|
|
type: "input",
|
|
placeholder: "请输入苗圃",
|
|
clearable: true,
|
|
span: 8,
|
|
},
|
|
{
|
|
label: "育苗人",
|
|
key: "bre_personnel_id",
|
|
type: "select",
|
|
props: {
|
|
placeholder: "请选择育苗人",
|
|
options: personnelOptions.value,
|
|
clearable: true,
|
|
filterable: true,
|
|
},
|
|
span: 8,
|
|
},
|
|
]);
|
|
|
|
const faTableRef = ref<{ elTableRef?: { clearSelection: () => void } } | null>(null);
|
|
const { selectedRows, selectedIds, batchDeleting, onTableSelectionChange } = useTableSelection<SeedlingTable>();
|
|
|
|
const createLoading = ref(false);
|
|
|
|
const {
|
|
columns,
|
|
columnChecks,
|
|
data,
|
|
loading,
|
|
pagination,
|
|
searchParams,
|
|
getData,
|
|
replaceSearchParams,
|
|
resetSearchParams,
|
|
handleSizeChange,
|
|
handleCurrentChange,
|
|
refreshData,
|
|
refreshCreate,
|
|
refreshUpdate,
|
|
refreshRemove,
|
|
} = useTable({
|
|
core: {
|
|
apiFn: SeedlingAPI.getSeedlingList,
|
|
apiParams: {
|
|
page_no: 1,
|
|
page_size: 10,
|
|
},
|
|
columnsFactory: (): ColumnOption<SeedlingTable>[] => [
|
|
{ type: "globalIndex", width: 56, label: "序号" },
|
|
{ type: "selection", width: 48, fixed: "left" },
|
|
{ prop: "combination_name", label: "杂交组合", minWidth: 140, showOverflowTooltip: true },
|
|
{ prop: "treatment_batch_no", label: "来源处理方式", minWidth: 120, showOverflowTooltip: true },
|
|
{ prop: "batch_no", label: "育苗批次号", minWidth: 160, showOverflowTooltip: true },
|
|
{ prop: "sowing_date", label: "播种日期", minWidth: 120, showOverflowTooltip: true },
|
|
{ prop: "tray_no", label: "穴盘号", minWidth: 120, showOverflowTooltip: true },
|
|
{ prop: "nursery", label: "苗圃", minWidth: 120, showOverflowTooltip: true },
|
|
{ prop: "seedling_count", label: "出苗数", minWidth: 100 },
|
|
{ prop: "emergence_date", label: "出苗日期", minWidth: 120, showOverflowTooltip: true },
|
|
{ prop: "strong_seedling_date", label: "壮苗日期", minWidth: 120, showOverflowTooltip: true },
|
|
{ prop: "strong_seedling_count", label: "壮苗数", minWidth: 100 },
|
|
{ prop: "stage", label: "阶段", minWidth: 100, formatter: (row: SeedlingTable) => ({ "1": "播种", "2": "出苗", "3": "壮苗" })[row.stage ?? "1"] ?? "—" },
|
|
{ prop: "bre_personnel_name", label: "育苗人", minWidth: 140, showOverflowTooltip: true },
|
|
{
|
|
prop: "created_time",
|
|
label: "创建时间",
|
|
width: 168,
|
|
sortable: true,
|
|
showOverflowTooltip: true,
|
|
},
|
|
{
|
|
prop: "updated_time",
|
|
label: "更新时间",
|
|
width: 168,
|
|
sortable: true,
|
|
showOverflowTooltip: true,
|
|
},
|
|
{
|
|
prop: "created_by",
|
|
label: "创建人",
|
|
minWidth: 100,
|
|
formatter: (row: SeedlingTable) => row.created_by?.name ?? "—",
|
|
},
|
|
{
|
|
prop: "updated_by",
|
|
label: "更新人",
|
|
minWidth: 100,
|
|
formatter: (row: SeedlingTable) => row.updated_by?.name ?? "—",
|
|
},
|
|
{
|
|
prop: "operation",
|
|
label: "操作",
|
|
width: 180,
|
|
fixed: "right",
|
|
align: "center",
|
|
formatter: (row: SeedlingTable) => formatSeedlingOperationCell(row),
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
const SeedlingCrudCols = toCrudCols(columns);
|
|
|
|
const exportQueryParams = computed(() => {
|
|
return stripPaginationParams(searchParams as Record<string, unknown>);
|
|
});
|
|
|
|
const SeedlingImportContentConfig = computed<IContentConfig>(() => ({
|
|
permPrefix: "module_bre:seedling",
|
|
cols: SeedlingCrudCols.value,
|
|
indexAction: async () => ({}),
|
|
importTemplate: () => SeedlingAPI.downloadTemplateSeedling(),
|
|
}));
|
|
|
|
const SeedlingExportContentConfig = computed(() => ({
|
|
permPrefix: "module_bre:seedling",
|
|
cols: SeedlingCrudCols.value,
|
|
exportsBlobAction: async (params: IObject) => {
|
|
const merged = {
|
|
...(exportQueryParams.value as unknown as Record<string, unknown>),
|
|
...params,
|
|
} as unknown as SeedlingPageQuery;
|
|
const res = await SeedlingAPI.exportSeedling(merged);
|
|
return res.data as Blob;
|
|
},
|
|
}));
|
|
|
|
const { dialogVisible } = useCrudDialog();
|
|
|
|
const detailFormData = ref<SeedlingTable>({});
|
|
|
|
const SeedlingDetailItems: import("@/components/others/fa-descriptions/index.vue").DescriptionsItem[] = [
|
|
{ label: "杂交组合", prop: "combination_name" },
|
|
{ label: "来源处理方式", prop: "treatment_batch_no" },
|
|
{ label: "育苗批次号", prop: "batch_no" },
|
|
{ label: "播种日期", prop: "sowing_date" },
|
|
{ label: "穴盘号", prop: "tray_no" },
|
|
{ label: "苗圃", prop: "nursery" },
|
|
{ label: "出苗数", prop: "seedling_count" },
|
|
{ label: "出苗日期", prop: "emergence_date" },
|
|
{ label: "壮苗日期", prop: "strong_seedling_date" },
|
|
{ label: "壮苗数", prop: "strong_seedling_count" },
|
|
{ label: "阶段", prop: "stage" },
|
|
{ label: "育苗人", prop: "bre_personnel_name" },
|
|
{ label: "备注", prop: "remark" },
|
|
{ label: "UUID", prop: "uuid" },
|
|
{ label: "创建人", prop: "created_by.name" },
|
|
{ label: "更新人", prop: "updated_by.name" },
|
|
{ label: "创建时间", prop: "created_time" },
|
|
{ label: "更新时间", prop: "updated_time" },
|
|
];
|
|
|
|
const SeedlingDialogFormItems = computed<FormItem[]>(() => [
|
|
{
|
|
key: "combination_id",
|
|
label: "杂交组合",
|
|
type: "select",
|
|
props: {
|
|
placeholder: "请选择杂交组合",
|
|
options: cross_combinationOptions.value,
|
|
clearable: true,
|
|
filterable: true,
|
|
},
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "treatment_id",
|
|
label: "来源种子处理",
|
|
type: "select",
|
|
props: {
|
|
placeholder: "请选择来源种子处理",
|
|
options: treatmentOptions.value,
|
|
clearable: true,
|
|
filterable: true,
|
|
},
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "batch_no",
|
|
label: "育苗批次号",
|
|
type: "input",
|
|
props: { placeholder: "留空自动生成(YP-组合-日期-序号)", maxlength: 50 },
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "sowing_date",
|
|
label: "播种日期",
|
|
type: "date",
|
|
props: {
|
|
type: "date",
|
|
placeholder: "请选择播种日期",
|
|
},
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "tray_no",
|
|
label: "穴盘号",
|
|
type: "input",
|
|
props: { placeholder: "请输入穴盘号", maxlength: 100 },
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "nursery",
|
|
label: "苗圃",
|
|
type: "input",
|
|
props: { placeholder: "请输入苗圃", maxlength: 100 },
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "seedling_count",
|
|
label: "出苗数",
|
|
type: "number",
|
|
props: { placeholder: "请输入出苗数" },
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "emergence_date",
|
|
label: "出苗日期",
|
|
type: "date",
|
|
props: { type: "date", placeholder: "请选择出苗日期" },
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "strong_seedling_date",
|
|
label: "壮苗日期",
|
|
type: "date",
|
|
props: { type: "date", placeholder: "请选择壮苗日期" },
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "strong_seedling_count",
|
|
label: "壮苗数",
|
|
type: "number",
|
|
props: { placeholder: "请输入壮苗数" },
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "stage",
|
|
label: "阶段",
|
|
type: "select",
|
|
props: {
|
|
placeholder: "请选择阶段",
|
|
options: [
|
|
{ label: "播种", value: "1" },
|
|
{ label: "出苗", value: "2" },
|
|
{ label: "壮苗", value: "3" },
|
|
],
|
|
clearable: true,
|
|
},
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "bre_personnel_id",
|
|
label: "育苗人",
|
|
type: "select",
|
|
props: {
|
|
placeholder: "请选择育苗人",
|
|
options: personnelOptions.value,
|
|
clearable: true,
|
|
filterable: true,
|
|
},
|
|
span: 12,
|
|
},
|
|
{
|
|
key: "remark",
|
|
label: "备注",
|
|
type: "input",
|
|
props: { type: "textarea", rows: 3, placeholder: "请输入备注" },
|
|
span: 24,
|
|
},
|
|
]);
|
|
|
|
const formData = ref<SeedlingForm>(createInitialFormData());
|
|
|
|
const rules = reactive({
|
|
combination_id: [{ required: true, message: "请选择杂交组合", trigger: "change" }],
|
|
});
|
|
|
|
const dataFormRef = ref<InstanceType<typeof FaForm> | null>(null);
|
|
const SeedlingFormRenderKey = ref(0);
|
|
|
|
const crud = useCrudForm<SeedlingForm>({
|
|
formData,
|
|
initialFormData: createInitialFormData(),
|
|
dialogVisible,
|
|
dataFormRef,
|
|
formRenderKey: SeedlingFormRenderKey,
|
|
detailApi: SeedlingAPI.getSeedlingDetail,
|
|
createApi: SeedlingAPI.createSeedling,
|
|
updateApi: SeedlingAPI.updateSeedling,
|
|
titles: { create: "新增育苗管理", update: "修改育苗管理", detail: "育苗管理详情" },
|
|
detailFormData,
|
|
onCreateSuccess: async () => {
|
|
await refreshCreate();
|
|
},
|
|
onUpdateSuccess: async () => {
|
|
await refreshUpdate();
|
|
},
|
|
});
|
|
|
|
const { submitLoading } = crud;
|
|
|
|
const { importVisible, exportVisible, openImport, openExport } = useImportExport();
|
|
|
|
const handleSearch = async (params: SeedlingSearchFormParams) => {
|
|
await searchBarRef.value?.validate();
|
|
replaceSearchParams({
|
|
combination_id: params.combination_id,
|
|
treatment_id: params.treatment_id,
|
|
batch_no: params.batch_no,
|
|
tray_no: params.tray_no,
|
|
nursery: params.nursery,
|
|
bre_personnel_id: params.bre_personnel_id,
|
|
created_id: params.created_id ?? undefined,
|
|
updated_id: params.updated_id ?? undefined,
|
|
created_time:
|
|
Array.isArray(params.created_time) && params.created_time.length === 2
|
|
? params.created_time
|
|
: undefined,
|
|
updated_time:
|
|
Array.isArray(params.updated_time) && params.updated_time.length === 2
|
|
? params.updated_time
|
|
: undefined,
|
|
} as Record<string, unknown>);
|
|
await getData();
|
|
};
|
|
|
|
const onResetSearch = async () => {
|
|
searchForm.value = {
|
|
combination_id: undefined,
|
|
treatment_id: undefined,
|
|
batch_no: undefined,
|
|
tray_no: undefined,
|
|
nursery: undefined,
|
|
bre_personnel_id: undefined,
|
|
created_id: undefined,
|
|
updated_id: undefined,
|
|
created_time: [],
|
|
updated_time: [],
|
|
};
|
|
await resetSearchParams();
|
|
};
|
|
|
|
function buildSeedlingRowActions(row: SeedlingTable): TableOperationAction[] {
|
|
const all: TableOperationAction[] = [
|
|
{
|
|
key: "detail",
|
|
label: "详情",
|
|
artType: "view",
|
|
perm: "module_bre:seedling:detail",
|
|
run: () => void crud.handleOpenDialog("detail", row.id),
|
|
},
|
|
{
|
|
key: "edit",
|
|
label: "编辑",
|
|
artType: "edit",
|
|
icon: "ri:edit-2-line",
|
|
perm: "module_bre:seedling:update",
|
|
run: () => void crud.handleOpenDialog("update", row.id),
|
|
},
|
|
{
|
|
key: "delete",
|
|
label: "删除",
|
|
artType: "delete",
|
|
icon: "ri:delete-bin-4-line",
|
|
perm: "module_bre:seedling:delete",
|
|
run: () => deleteSeedlingRow(row),
|
|
},
|
|
];
|
|
return all;
|
|
}
|
|
|
|
function formatSeedlingOperationCell(row: SeedlingTable) {
|
|
return renderTableOperationCell(buildSeedlingRowActions(row), {
|
|
wrapperClass: "inline-flex flex-wrap items-center justify-end gap-1",
|
|
});
|
|
}
|
|
|
|
async function handleAdd() {
|
|
createLoading.value = true;
|
|
try {
|
|
await crud.handleOpenDialog("create");
|
|
} finally {
|
|
createLoading.value = false;
|
|
}
|
|
}
|
|
|
|
const deleteSeedlingRow = async (row: SeedlingTable) => {
|
|
if (!row.id) return;
|
|
try {
|
|
await confirmDelete(`确定删除「${row.id ?? row.id}」吗?此操作不可恢复!`);
|
|
await SeedlingAPI.deleteSeedling([row.id!]);
|
|
faTableRef.value?.elTableRef?.clearSelection();
|
|
await refreshRemove();
|
|
} catch {
|
|
// 用户取消
|
|
}
|
|
};
|
|
|
|
async function handleBatchDelete() {
|
|
const ids = selectedIds.value;
|
|
if (ids.length === 0) return;
|
|
try {
|
|
await confirmBatchDelete(ids.length);
|
|
batchDeleting.value = true;
|
|
await SeedlingAPI.deleteSeedling(ids);
|
|
faTableRef.value?.elTableRef?.clearSelection();
|
|
await refreshRemove();
|
|
} catch {
|
|
// 用户取消
|
|
} finally {
|
|
batchDeleting.value = false;
|
|
}
|
|
}
|
|
|
|
async function handleCrudImportUpload(uploadFormData: FormData) {
|
|
try {
|
|
const res = await SeedlingAPI.importSeedling(uploadFormData);
|
|
if (res.data.code === ResultEnum.SUCCESS) {
|
|
ElMessage.success(res.data.msg || "导入成功");
|
|
importVisible.value = false;
|
|
await refreshData();
|
|
}
|
|
} catch (error: unknown) {
|
|
if (import.meta.env.DEV) console.error("[Import]", error);
|
|
}
|
|
}
|
|
|
|
onMounted(() => {
|
|
loadCrossCombinationOptions();
|
|
loadPersonnelOptions();
|
|
loadTreatmentOptions();
|
|
});
|
|
</script>
|