|
@@ -33,7 +33,7 @@ const { tableOptions, handlePageChange } = usePagination(fetchList);
|
|
|
|
|
|
const gridRef = ref();
|
|
const gridRef = ref();
|
|
const gridOptions: any = reactive({
|
|
const gridOptions: any = reactive({
|
|
- size: "mini",
|
|
|
|
|
|
+ size: 'mini',
|
|
border: false,
|
|
border: false,
|
|
round: true,
|
|
round: true,
|
|
stripe: true,
|
|
stripe: true,
|
|
@@ -85,7 +85,7 @@ onMounted(() => {
|
|
async function fetchList() {
|
|
async function fetchList() {
|
|
gridOptions.data = [];
|
|
gridOptions.data = [];
|
|
gridOptions.columns = [];
|
|
gridOptions.columns = [];
|
|
-
|
|
|
|
|
|
+
|
|
const query = {
|
|
const query = {
|
|
country_code: queryParameter?.country,
|
|
country_code: queryParameter?.country,
|
|
brand: queryParameter?.brand,
|
|
brand: queryParameter?.brand,
|
|
@@ -95,7 +95,7 @@ async function fetchList() {
|
|
sku: queryParameter?.sku,
|
|
sku: queryParameter?.sku,
|
|
shop_id: queryParameter?.shop
|
|
shop_id: queryParameter?.shop
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+
|
|
await useTableData(api.getTableData, query, gridOptions);
|
|
await useTableData(api.getTableData, query, gridOptions);
|
|
await gridRef.value.loadColumn(productColumns);
|
|
await gridRef.value.loadColumn(productColumns);
|
|
gridOptions.showHeader = Boolean(gridOptions.data?.length);
|
|
gridOptions.showHeader = Boolean(gridOptions.data?.length);
|
|
@@ -106,39 +106,39 @@ function handleRefresh() {
|
|
}
|
|
}
|
|
|
|
|
|
async function handleDownload() {
|
|
async function handleDownload() {
|
|
- const confirmed = await ElMessageBox.confirm('是否确认导出当前时间内所有数据项?', '警告', {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning'
|
|
|
|
- });
|
|
|
|
|
|
+ const confirmed = await ElMessageBox.confirm('是否确认导出当前时间内所有数据项?', '警告', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ });
|
|
|
|
|
|
- if (confirmed) {
|
|
|
|
- gridOptions.loading = true;
|
|
|
|
- try {
|
|
|
|
- const query = {
|
|
|
|
- country_code: queryParameter?.country,
|
|
|
|
- brand: queryParameter?.brand,
|
|
|
|
- tag: queryParameter?.group,
|
|
|
|
- status: queryParameter?.status,
|
|
|
|
- asin: queryParameter?.asin,
|
|
|
|
- sku: queryParameter?.sku,
|
|
|
|
- shop_id: queryParameter?.shop
|
|
|
|
- };
|
|
|
|
- const response = await api.exportData(query);
|
|
|
|
- const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
|
|
- const link = document.createElement('a');
|
|
|
|
- link.href = url;
|
|
|
|
- link.setAttribute('download', '商品列表数据.xlsx');
|
|
|
|
- document.body.appendChild(link);
|
|
|
|
- link.click();
|
|
|
|
- ElMessage.success('数据导出成功!');
|
|
|
|
- } catch (error) {
|
|
|
|
- ElMessage.error('数据导出失败,请重试!');
|
|
|
|
- console.error(error);
|
|
|
|
- } finally {
|
|
|
|
- gridOptions.loading = false; // 结束加载状态
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if (confirmed) {
|
|
|
|
+ gridOptions.loading = true;
|
|
|
|
+ try {
|
|
|
|
+ const query = {
|
|
|
|
+ country_code: queryParameter?.country,
|
|
|
|
+ brand: queryParameter?.brand,
|
|
|
|
+ tag: queryParameter?.group,
|
|
|
|
+ status: queryParameter?.status,
|
|
|
|
+ asin: queryParameter?.asin,
|
|
|
|
+ sku: queryParameter?.sku,
|
|
|
|
+ shop_id: queryParameter?.shop
|
|
|
|
+ };
|
|
|
|
+ const response = await api.exportData(query);
|
|
|
|
+ const url = window.URL.createObjectURL(new Blob([ response.data ]));
|
|
|
|
+ const link = document.createElement('a');
|
|
|
|
+ link.href = url;
|
|
|
|
+ link.setAttribute('download', '商品列表数据.xlsx');
|
|
|
|
+ document.body.appendChild(link);
|
|
|
|
+ link.click();
|
|
|
|
+ ElMessage.success('数据导出成功!');
|
|
|
|
+ } catch (error) {
|
|
|
|
+ ElMessage.error('数据导出失败,请重试!');
|
|
|
|
+ console.error(error);
|
|
|
|
+ } finally {
|
|
|
|
+ gridOptions.loading = false; // 结束加载状态
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
function selectChangeEvent({ checked, row }: any) {
|
|
function selectChangeEvent({ checked, row }: any) {
|
|
@@ -174,7 +174,7 @@ function handleNotice(row: any) {
|
|
}
|
|
}
|
|
|
|
|
|
async function switchMonitor(row: any) {
|
|
async function switchMonitor(row: any) {
|
|
- const res = await useResponse(api.postMonitor, { ids: [row.id], status: row.is_monitor ? 1 : 0 })
|
|
|
|
|
|
+ const res = await useResponse(api.postMonitor, { ids: [ row.id ], status: row.is_monitor ? 1 : 0 });
|
|
if (res && res.code === 2000) {
|
|
if (res && res.code === 2000) {
|
|
ElMessage.success('操作成功!');
|
|
ElMessage.success('操作成功!');
|
|
} else {
|
|
} else {
|
|
@@ -183,7 +183,6 @@ async function switchMonitor(row: any) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
async function batchOpen() {
|
|
async function batchOpen() {
|
|
const ids = Array.from(checkedList.value);
|
|
const ids = Array.from(checkedList.value);
|
|
const res = await useResponse(api.postMonitor, { ids, status: 1 }, btnLoading);
|
|
const res = await useResponse(api.postMonitor, { ids, status: 1 }, btnLoading);
|
|
@@ -194,7 +193,6 @@ async function batchOpen() {
|
|
await fetchList();
|
|
await fetchList();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
function downloadTemplate() {
|
|
function downloadTemplate() {
|
|
const urlMap: { [key: string]: string } = {
|
|
const urlMap: { [key: string]: string } = {
|
|
notice: '/api/choice/goods/alarm/import_data/',
|
|
notice: '/api/choice/goods/alarm/import_data/',
|
|
@@ -224,7 +222,7 @@ defineExpose({ fetchList });
|
|
<!-- 工具栏左侧 -->
|
|
<!-- 工具栏左侧 -->
|
|
<template #toolbar_buttons>
|
|
<template #toolbar_buttons>
|
|
<div class="flex gap-2">
|
|
<div class="flex gap-2">
|
|
- <PermissionButton :disabled="!checkedList.size" :icon="Open" :loading="btnLoading" plain round type="primary"
|
|
|
|
|
|
+ <PermissionButton :disabled="!checkedList.size" :icon="Open" :loading="btnLoading" plain round type="primary"
|
|
@click="batchOpen">
|
|
@click="batchOpen">
|
|
批量开启
|
|
批量开启
|
|
</PermissionButton>
|
|
</PermissionButton>
|
|
@@ -232,9 +230,9 @@ defineExpose({ fetchList });
|
|
<el-select v-model="templateType" style="width: 190px">
|
|
<el-select v-model="templateType" style="width: 190px">
|
|
<template #prefix>
|
|
<template #prefix>
|
|
<div class="flex items-center">
|
|
<div class="flex items-center">
|
|
- <el-button size="small"
|
|
|
|
- type="success" bg text
|
|
|
|
- style="margin-left: -7px; font-size: 14px; border-radius: 29px;"
|
|
|
|
|
|
+ <el-button bg
|
|
|
|
+ size="small" style="margin-left: -7px; font-size: 14px; border-radius: 29px;" text
|
|
|
|
+ type="success"
|
|
@click.stop="downloadTemplate">下载
|
|
@click.stop="downloadTemplate">下载
|
|
</el-button>
|
|
</el-button>
|
|
<VerticalDivider style="margin-left: 7px" />
|
|
<VerticalDivider style="margin-left: 7px" />
|
|
@@ -247,12 +245,12 @@ defineExpose({ fetchList });
|
|
</div>
|
|
</div>
|
|
<VerticalDivider class="px-1" style="margin-left: 7px;" />
|
|
<VerticalDivider class="px-1" style="margin-left: 7px;" />
|
|
|
|
|
|
- <ImportButton :icon="Message" bg text :uploadFunction="api.uploadChangeNotice">变更通知导入</ImportButton>
|
|
|
|
- <ImportButton bg text :uploadFunction="api.uploadProducts">
|
|
|
|
|
|
+ <ImportButton :icon="Message" :uploadFunction="api.uploadChangeNotice" bg text>变更通知导入</ImportButton>
|
|
|
|
+ <ImportButton :uploadFunction="api.uploadProducts" bg text>
|
|
<i class="bi bi-box-seam mr-3"></i>
|
|
<i class="bi bi-box-seam mr-3"></i>
|
|
商品导入
|
|
商品导入
|
|
</ImportButton>
|
|
</ImportButton>
|
|
- <ImportButton :icon="Money" bg text :uploadFunction="api.uploadPrice">指导价格导入</ImportButton>
|
|
|
|
|
|
+ <ImportButton :icon="Money" :uploadFunction="api.uploadPrice" bg text>指导价格导入</ImportButton>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<!-- 工具栏右侧 -->
|
|
<!-- 工具栏右侧 -->
|
|
@@ -284,7 +282,7 @@ defineExpose({ fetchList });
|
|
<!-- 自定义列插槽 -->
|
|
<!-- 自定义列插槽 -->
|
|
<template v-for="col in productColumns" #[`${col.field}`]="{ row }">
|
|
<template v-for="col in productColumns" #[`${col.field}`]="{ row }">
|
|
<DataTableSlot :key="row.id" :field="col.field" :row="row" @edit-row="handleEdit" @handle-notice="handleNotice"
|
|
<DataTableSlot :key="row.id" :field="col.field" :row="row" @edit-row="handleEdit" @handle-notice="handleNotice"
|
|
- @handle-monitor="switchMonitor" />
|
|
|
|
|
|
+ @handle-monitor="switchMonitor" />
|
|
</template>
|
|
</template>
|
|
</vxe-grid>
|
|
</vxe-grid>
|
|
<EditDrawer v-if="editOpen" v-model="editOpen" :row-data="rowData" @refresh="handleRefresh" />
|
|
<EditDrawer v-if="editOpen" v-model="editOpen" :row-data="rowData" @refresh="handleRefresh" />
|