|
@@ -13,6 +13,7 @@ import ImportButton from '/src/components/ImportButton/index.vue';
|
|
import VerticalDivider from '/src/components/VerticalDivider/index.vue';
|
|
import VerticalDivider from '/src/components/VerticalDivider/index.vue';
|
|
import { productColumns } from '../ColumnsTsx';
|
|
import { productColumns } from '../ColumnsTsx';
|
|
import DataTableSlot from '/@/views/product-manage/product-monitor/component/DataTableSlot.vue';
|
|
import DataTableSlot from '/@/views/product-manage/product-monitor/component/DataTableSlot.vue';
|
|
|
|
+import CreateDialog from '/@/views/product-manage/product-monitor/component/createDialog.vue';
|
|
|
|
|
|
|
|
|
|
interface Parameter {
|
|
interface Parameter {
|
|
@@ -70,6 +71,7 @@ const gridOptions: any = reactive({
|
|
const checkedList = ref<Set<number>>(new Set());
|
|
const checkedList = ref<Set<number>>(new Set());
|
|
|
|
|
|
const editOpen = ref(false);
|
|
const editOpen = ref(false);
|
|
|
|
+const createOpen = ref(false);
|
|
const rowData = ref({});
|
|
const rowData = ref({});
|
|
|
|
|
|
const dialogVisible = ref(false);
|
|
const dialogVisible = ref(false);
|
|
@@ -107,6 +109,46 @@ function handleRefresh() {
|
|
fetchList();
|
|
fetchList();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+async function handleDownload() {
|
|
|
|
+ const confirmed = await ElMessageBox.confirm('是否确认导出当前时间内所有数据项?', '警告', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (confirmed) {
|
|
|
|
+ gridOptions.loading = true;
|
|
|
|
+ try {
|
|
|
|
+ const query = {
|
|
|
|
+ country_code: queryParameter?.country,
|
|
|
|
+ goods__brand: queryParameter?.brand,
|
|
|
|
+ goods__tag: queryParameter?.group,
|
|
|
|
+ status: queryParameter?.status,
|
|
|
|
+ shop_id: queryParameter?.shop,
|
|
|
|
+ asin: queryParameter?.asin,
|
|
|
|
+ goods__sku: queryParameter?.sku,
|
|
|
|
+ platform_number: queryParameter?.platformId,
|
|
|
|
+ goods__all_ratings: queryParameter?.scoreNumber,
|
|
|
|
+ goods__all_reviews: queryParameter?.commentNumber,
|
|
|
|
+ goods__all_score: queryParameter?.displayScore
|
|
|
|
+ };
|
|
|
|
+ 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; // 结束加载状态
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
async function batchOpen() {
|
|
async function batchOpen() {
|
|
const ids = Array.from(checkedList.value);
|
|
const ids = Array.from(checkedList.value);
|
|
await useResponse(api.updateShopDetail, { ids, status: 1 });
|
|
await useResponse(api.updateShopDetail, { ids, status: 1 });
|
|
@@ -141,6 +183,10 @@ function handleEdit(row: any) {
|
|
rowData.value = row;
|
|
rowData.value = row;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function handleCreate() {
|
|
|
|
+ createOpen.value = true;
|
|
|
|
+}
|
|
|
|
+
|
|
function singleDelete(row: any) {
|
|
function singleDelete(row: any) {
|
|
// dialogVisible.value = true;
|
|
// dialogVisible.value = true;
|
|
rowData.value = row;
|
|
rowData.value = row;
|
|
@@ -163,7 +209,7 @@ defineExpose({ fetchList });
|
|
<PermissionButton :disabled="!checkedList.size" :icon="Delete" plain round type="danger" @click="batchOpen">
|
|
<PermissionButton :disabled="!checkedList.size" :icon="Delete" plain round type="danger" @click="batchOpen">
|
|
批量删除
|
|
批量删除
|
|
</PermissionButton>
|
|
</PermissionButton>
|
|
- <PermissionButton :icon="Plus" plain round type="primary" @click="batchOpen">
|
|
|
|
|
|
+ <PermissionButton :icon="Plus" plain round type="primary" @click="handleCreate">
|
|
新 增
|
|
新 增
|
|
</PermissionButton>
|
|
</PermissionButton>
|
|
<div class="custom-el-input">
|
|
<div class="custom-el-input">
|
|
@@ -192,7 +238,7 @@ defineExpose({ fetchList });
|
|
<Refresh />
|
|
<Refresh />
|
|
</el-icon>
|
|
</el-icon>
|
|
</el-button>
|
|
</el-button>
|
|
- <el-button circle class="mr-3 toolbar-btn">
|
|
|
|
|
|
+ <el-button circle class="mr-3 toolbar-btn" @click="handleDownload">
|
|
<el-icon>
|
|
<el-icon>
|
|
<Download />
|
|
<Download />
|
|
</el-icon>
|
|
</el-icon>
|
|
@@ -216,6 +262,7 @@ defineExpose({ fetchList });
|
|
</template>
|
|
</template>
|
|
</vxe-grid>
|
|
</vxe-grid>
|
|
<EditDrawer v-if="editOpen" v-model="editOpen" :row-data="rowData" />
|
|
<EditDrawer v-if="editOpen" v-model="editOpen" :row-data="rowData" />
|
|
|
|
+ <CreateDialog v-if="createOpen" v-model="createOpen" @refresh="fetchList" />
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|