|
@@ -1,13 +1,8 @@
|
|
|
<script setup lang="tsx">
|
|
<script setup lang="tsx">
|
|
|
-import { nextTick, ref, useTemplateRef } from 'vue';
|
|
|
|
|
|
|
+import { nextTick, ref } from 'vue';
|
|
|
import { NButton, NImage } from 'naive-ui';
|
|
import { NButton, NImage } from 'naive-ui';
|
|
|
import type { InternalRowData } from 'naive-ui/es/data-table/src/interface';
|
|
import type { InternalRowData } from 'naive-ui/es/data-table/src/interface';
|
|
|
-import {
|
|
|
|
|
- fetchGategoryImport,
|
|
|
|
|
- fetchGetAllStoreList,
|
|
|
|
|
- fetchGetDeskCategoryList,
|
|
|
|
|
- fetchUpdateCategory
|
|
|
|
|
-} from '@/service/api/goods/desk-category';
|
|
|
|
|
|
|
+import { fetchGetAllStoreList, fetchGetDeskCategoryList, fetchUpdateCategory } from '@/service/api/goods/desk-category';
|
|
|
import { fetchGetAllTagList } from '@/service/api/goods/tag';
|
|
import { fetchGetAllTagList } from '@/service/api/goods/tag';
|
|
|
import { useAppStore } from '@/store/modules/app';
|
|
import { useAppStore } from '@/store/modules/app';
|
|
|
import { useModalFrom } from '@/components/zt/ModalForm/hooks/useModalForm';
|
|
import { useModalFrom } from '@/components/zt/ModalForm/hooks/useModalForm';
|
|
@@ -46,7 +41,7 @@ const [registerSearchForm, { getFieldsValue: getSearchForm }] = useForm({
|
|
|
},
|
|
},
|
|
|
collapsedRows: 1
|
|
collapsedRows: 1
|
|
|
});
|
|
});
|
|
|
-const importTemplateRef = useTemplateRef('importTemplateRef');
|
|
|
|
|
|
|
+// const importTemplateRef = useTemplateRef('importTemplateRef');
|
|
|
const tableColumns: NaiveUI.TableColumn<InternalRowData>[] = [
|
|
const tableColumns: NaiveUI.TableColumn<InternalRowData>[] = [
|
|
|
{
|
|
{
|
|
|
title: '分类名称',
|
|
title: '分类名称',
|
|
@@ -79,7 +74,7 @@ const tableColumns: NaiveUI.TableColumn<InternalRowData>[] = [
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
render: row => (
|
|
render: row => (
|
|
|
<div class="flex-center gap-8px">
|
|
<div class="flex-center gap-8px">
|
|
|
- {row.level == 0 && (
|
|
|
|
|
|
|
+ {row.level == 1 && (
|
|
|
<NButton type="primary" ghost size="small" onClick={() => edit(row)}>
|
|
<NButton type="primary" ghost size="small" onClick={() => edit(row)}>
|
|
|
编辑
|
|
编辑
|
|
|
</NButton>
|
|
</NButton>
|
|
@@ -104,7 +99,15 @@ const [
|
|
|
formConfig: {
|
|
formConfig: {
|
|
|
schemas: [
|
|
schemas: [
|
|
|
{ label: '', field: 'id', show: false, component: 'NInput' },
|
|
{ label: '', field: 'id', show: false, component: 'NInput' },
|
|
|
- { label: '分类名称', field: 'name', component: 'NInput', required: true },
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '分类名称',
|
|
|
|
|
+ field: 'name',
|
|
|
|
|
+ component: 'NInput',
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ disabled: true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
label: '分类图标',
|
|
label: '分类图标',
|
|
|
field: 'icon',
|
|
field: 'icon',
|
|
@@ -148,22 +151,22 @@ const [
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-async function handleSubmit(file: File) {
|
|
|
|
|
- const { error } = await fetchGategoryImport(file);
|
|
|
|
|
- if (!error) {
|
|
|
|
|
- importTemplateRef.value?.closeModal();
|
|
|
|
|
- }
|
|
|
|
|
- importTemplateRef.value?.setSubLoading(false);
|
|
|
|
|
-}
|
|
|
|
|
|
|
+// async function handleSubmit(file: File) {
|
|
|
|
|
+// const { error } = await fetchGategoryImport(file);
|
|
|
|
|
+// if (!error) {
|
|
|
|
|
+// importTemplateRef.value?.closeModal();
|
|
|
|
|
+// }
|
|
|
|
|
+// importTemplateRef.value?.setSubLoading(false);
|
|
|
|
|
+// }
|
|
|
function edit(row: Recordable) {
|
|
function edit(row: Recordable) {
|
|
|
openModalForm(row);
|
|
openModalForm(row);
|
|
|
- setModalFormValue({ ...row, label: Number(row.label) });
|
|
|
|
|
|
|
+ setModalFormValue({ ...row, label: row.label });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function getData() {
|
|
async function getData() {
|
|
|
const { data, error } = await fetchGetDeskCategoryList(getSearchForm());
|
|
const { data, error } = await fetchGetDeskCategoryList(getSearchForm());
|
|
|
if (!error) {
|
|
if (!error) {
|
|
|
- deskData.value = buildTree(data);
|
|
|
|
|
|
|
+ deskData.value = buildTree(data).sort((a, b) => b.num - a.num);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
async function handleSubmitForm() {
|
|
async function handleSubmitForm() {
|
|
@@ -174,9 +177,9 @@ async function handleSubmitForm() {
|
|
|
getData();
|
|
getData();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-function handleOpen() {
|
|
|
|
|
- importTemplateRef.value?.openModal();
|
|
|
|
|
-}
|
|
|
|
|
|
|
+// function handleOpen() {
|
|
|
|
|
+// importTemplateRef.value?.openModal();
|
|
|
|
|
+// }
|
|
|
interface BuildTreeOptions {
|
|
interface BuildTreeOptions {
|
|
|
idKey?: string;
|
|
idKey?: string;
|
|
|
pidKey?: string;
|
|
pidKey?: string;
|
|
@@ -234,7 +237,8 @@ function buildTree<T>(items: T[], options: BuildTreeOptions = {}): T[] {
|
|
|
<NCard title="前台类目" :bordered="false" size="small" class="card-wrapper sm:flex-1-hidden">
|
|
<NCard title="前台类目" :bordered="false" size="small" class="card-wrapper sm:flex-1-hidden">
|
|
|
<template #header-extra>
|
|
<template #header-extra>
|
|
|
<TableHeaderOperation :loading="loading" @refresh="getData">
|
|
<TableHeaderOperation :loading="loading" @refresh="getData">
|
|
|
- <template #prefix>
|
|
|
|
|
|
|
+ <!--
|
|
|
|
|
+ <template #prefix>
|
|
|
<NButton size="small" @click="handleOpen">
|
|
<NButton size="small" @click="handleOpen">
|
|
|
<template #icon>
|
|
<template #icon>
|
|
|
<icon-file-icons:microsoft-excel class="text-icon"></icon-file-icons:microsoft-excel>
|
|
<icon-file-icons:microsoft-excel class="text-icon"></icon-file-icons:microsoft-excel>
|
|
@@ -242,6 +246,7 @@ function buildTree<T>(items: T[], options: BuildTreeOptions = {}): T[] {
|
|
|
Excel导入分类
|
|
Excel导入分类
|
|
|
</NButton>
|
|
</NButton>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+-->
|
|
|
</TableHeaderOperation>
|
|
</TableHeaderOperation>
|
|
|
</template>
|
|
</template>
|
|
|
<NDataTable
|
|
<NDataTable
|
|
@@ -256,13 +261,15 @@ function buildTree<T>(items: T[], options: BuildTreeOptions = {}): T[] {
|
|
|
class="sm:h-full"
|
|
class="sm:h-full"
|
|
|
/>
|
|
/>
|
|
|
</NCard>
|
|
</NCard>
|
|
|
- <ZImportTemplate
|
|
|
|
|
|
|
+ <!--
|
|
|
|
|
+ <ZImportTemplate
|
|
|
ref="importTemplateRef"
|
|
ref="importTemplateRef"
|
|
|
url="/platform/shopCategory/exportTemplate"
|
|
url="/platform/shopCategory/exportTemplate"
|
|
|
template-text="店内分类导入模版.xlsx"
|
|
template-text="店内分类导入模版.xlsx"
|
|
|
modal-text="Excel导入分类"
|
|
modal-text="Excel导入分类"
|
|
|
@submit="handleSubmit"
|
|
@submit="handleSubmit"
|
|
|
></ZImportTemplate>
|
|
></ZImportTemplate>
|
|
|
|
|
+-->
|
|
|
<BasicModelForm @register-modal-form="registerModalForm" @submit-form="handleSubmitForm"></BasicModelForm>
|
|
<BasicModelForm @register-modal-form="registerModalForm" @submit-form="handleSubmitForm"></BasicModelForm>
|
|
|
</LayoutTable>
|
|
</LayoutTable>
|
|
|
</template>
|
|
</template>
|