新增导出
This commit is contained in:
@@ -51,6 +51,15 @@ const AuthAPI = {
|
|||||||
method: "delete",
|
method: "delete",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 导出常用单位
|
||||||
|
exportUnits(params: any) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}/export`,
|
||||||
|
method: "get",
|
||||||
|
params,
|
||||||
|
responseType: 'blob'
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,15 @@ const AuthAPI = {
|
|||||||
method: "delete",
|
method: "delete",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 导出商品分类
|
||||||
|
exportCategories(params: any) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}/export`,
|
||||||
|
method: "get",
|
||||||
|
params,
|
||||||
|
responseType: 'blob'
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,17 +7,9 @@
|
|||||||
@reset-click="handleResetClick" /> -->
|
@reset-click="handleResetClick" /> -->
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<page-content
|
<page-content ref="contentRef" :content-config="contentConfig" @add-click="handleAddClick"
|
||||||
ref="contentRef"
|
@edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick"
|
||||||
:content-config="contentConfig"
|
@toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange">
|
||||||
@add-click="handleAddClick"
|
|
||||||
@edit-click="handleEditClick"
|
|
||||||
@export-click="handleExportClick"
|
|
||||||
@search-click="handleSearchClick"
|
|
||||||
@toolbar-click="handleToolbarClick"
|
|
||||||
@operat-click="handleOperatClick"
|
|
||||||
@filter-change="handleFilterChange"
|
|
||||||
>
|
|
||||||
<template #status="scope">
|
<template #status="scope">
|
||||||
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
||||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||||
@@ -25,12 +17,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #slotNameimage="scope">
|
<template #slotNameimage="scope">
|
||||||
<el-image
|
<el-image v-if="scope.row.pic" :src="scope.row.pic" lazy style="width: 40px; height: 40px" />
|
||||||
v-if="scope.row.pic"
|
|
||||||
:src="scope.row.pic"
|
|
||||||
lazy
|
|
||||||
style="width: 40px; height: 40px"
|
|
||||||
/>
|
|
||||||
<div v-else>无</div>
|
<div v-else>无</div>
|
||||||
</template>
|
</template>
|
||||||
<template #gender="scope">
|
<template #gender="scope">
|
||||||
@@ -38,42 +25,26 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #mobile="scope">
|
<template #mobile="scope">
|
||||||
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||||
<copy-button
|
<copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
|
||||||
v-if="scope.row[scope.prop]"
|
|
||||||
:text="scope.row[scope.prop]"
|
|
||||||
style="margin-left: 2px"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</page-content>
|
</page-content>
|
||||||
|
|
||||||
<!-- 新增 -->
|
<!-- 新增 -->
|
||||||
<page-modal
|
<page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick">
|
||||||
ref="addModalRef"
|
|
||||||
:modal-config="addModalConfig"
|
|
||||||
@submit-click="handleSubmitClick"
|
|
||||||
>
|
|
||||||
<template #gender="scope">
|
<template #gender="scope">
|
||||||
<Dict v-model="scope.formData[scope.prop]" code="gender" />
|
<Dict v-model="scope.formData[scope.prop]" code="gender" />
|
||||||
</template>
|
</template>
|
||||||
</page-modal>
|
</page-modal>
|
||||||
|
|
||||||
<!-- 编辑 -->
|
<!-- 编辑 -->
|
||||||
<page-modal
|
<page-modal ref="editModalRef" :modal-config="editModalConfig" @submit-click="handleSubmitClick">
|
||||||
ref="editModalRef"
|
|
||||||
:modal-config="editModalConfig"
|
|
||||||
@submit-click="handleSubmitClick"
|
|
||||||
>
|
|
||||||
<template #gender="scope">
|
<template #gender="scope">
|
||||||
<Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" />
|
<Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" />
|
||||||
</template>
|
</template>
|
||||||
</page-modal>
|
</page-modal>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<page-content
|
<page-content ref="contentRef" :content-config="contentConfig2" @operat-click="handleOperatClick">
|
||||||
ref="contentRef"
|
|
||||||
:content-config="contentConfig2"
|
|
||||||
@operat-click="handleOperatClick"
|
|
||||||
>
|
|
||||||
<template #status="scope">
|
<template #status="scope">
|
||||||
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
||||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||||
@@ -95,7 +66,7 @@ import contentConfig from "./categoryconfig/content";
|
|||||||
import contentConfig2 from "./categoryconfig/content2";
|
import contentConfig2 from "./categoryconfig/content2";
|
||||||
import editModalConfig from "./categoryconfig/edit";
|
import editModalConfig from "./categoryconfig/edit";
|
||||||
import searchConfig from "./categoryconfig/search";
|
import searchConfig from "./categoryconfig/search";
|
||||||
import { isSyncStatus } from "@/utils/index";
|
import { isSyncStatus, downloadFile } from "@/utils/index";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
searchRef,
|
searchRef,
|
||||||
@@ -107,7 +78,7 @@ const {
|
|||||||
// handleAddClick,
|
// handleAddClick,
|
||||||
// handleEditClick,
|
// handleEditClick,
|
||||||
handleSubmitClick,
|
handleSubmitClick,
|
||||||
handleExportClick,
|
// handleExportClick,
|
||||||
handleSearchClick,
|
handleSearchClick,
|
||||||
handleFilterChange,
|
handleFilterChange,
|
||||||
} = usePage();
|
} = usePage();
|
||||||
@@ -123,6 +94,18 @@ if (isSyncStatus()) {
|
|||||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false
|
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false
|
||||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false
|
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
async function handleExportClick() {
|
||||||
|
try {
|
||||||
|
const filterParams = searchRef.value?.getQueryParams();
|
||||||
|
const file = await UserAPI.exportCategories(filterParams);
|
||||||
|
downloadFile(file, "商品分类列表", "xlsx");
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
async function handleAddClick() {
|
async function handleAddClick() {
|
||||||
addModalRef.value?.setModalVisible();
|
addModalRef.value?.setModalVisible();
|
||||||
|
|||||||
@@ -52,6 +52,13 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
|||||||
name: "add",
|
name: "add",
|
||||||
auth: "import",
|
auth: "import",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
icon: "Download",
|
||||||
|
text: "导出",
|
||||||
|
type: "",
|
||||||
|
name: "export",
|
||||||
|
auth: "import",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
cols: [
|
cols: [
|
||||||
// { type: "selection", width: 50, align: "center" },
|
// { type: "selection", width: 50, align: "center" },
|
||||||
@@ -76,7 +83,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
|||||||
fixed: "right",
|
fixed: "right",
|
||||||
width: 280,
|
width: 280,
|
||||||
templet: "tool",
|
templet: "tool",
|
||||||
operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}],
|
operat: [{ text: "编辑", icon: 'edit', name: "edit" }, { text: "删除", icon: 'delete', type: 'danger', name: "delete" }],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ import contentConfig from "./unitconfig/content";
|
|||||||
import contentConfig2 from "./unitconfig/content2";
|
import contentConfig2 from "./unitconfig/content2";
|
||||||
import editModalConfig from "./unitconfig/edit";
|
import editModalConfig from "./unitconfig/edit";
|
||||||
import searchConfig from "./unitconfig/search";
|
import searchConfig from "./unitconfig/search";
|
||||||
import { isSyncStatus } from "@/utils/index";
|
import { isSyncStatus, downloadFile } from "@/utils/index";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
searchRef,
|
searchRef,
|
||||||
@@ -73,7 +73,7 @@ const {
|
|||||||
// handleAddClick,
|
// handleAddClick,
|
||||||
// handleEditClick,
|
// handleEditClick,
|
||||||
handleSubmitClick,
|
handleSubmitClick,
|
||||||
handleExportClick,
|
// handleExportClick,
|
||||||
handleSearchClick,
|
handleSearchClick,
|
||||||
handleFilterChange,
|
handleFilterChange,
|
||||||
} = usePage();
|
} = usePage();
|
||||||
@@ -88,6 +88,17 @@ if (isSyncStatus()) {
|
|||||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false
|
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出商品单位
|
||||||
|
async function handleExportClick() {
|
||||||
|
try {
|
||||||
|
const filterParams = searchRef.value?.getQueryParams();
|
||||||
|
const file = await UserAPI.exportUnits(filterParams);
|
||||||
|
downloadFile(file, "商品单位列表", "xlsx");
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
async function handleAddClick() {
|
async function handleAddClick() {
|
||||||
addModalRef.value?.setModalVisible();
|
addModalRef.value?.setModalVisible();
|
||||||
|
|||||||
@@ -45,6 +45,13 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
|||||||
name: "add",
|
name: "add",
|
||||||
auth: "import",
|
auth: "import",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
icon: "Download",
|
||||||
|
text: "导出",
|
||||||
|
type: "",
|
||||||
|
name: "export",
|
||||||
|
auth: "import",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
cols: [
|
cols: [
|
||||||
// { type: "selection", width: 50, align: "center" },
|
// { type: "selection", width: 50, align: "center" },
|
||||||
@@ -56,7 +63,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
|||||||
fixed: "right",
|
fixed: "right",
|
||||||
width: 280,
|
width: 280,
|
||||||
templet: "tool",
|
templet: "tool",
|
||||||
operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}],
|
operat: [{ text: "编辑", icon: 'edit', name: "edit" }, { text: "删除", icon: 'delete', type: 'danger', name: "delete" }],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user