|  | @@ -11,14 +11,16 @@ import { usePagination } from '/@/utils/usePagination';
 | 
	
		
			
				|  |  |  import { useTableData } from '/@/utils/useTableData';
 | 
	
		
			
				|  |  |  import { useResponse } from '/@/utils/useResponse';
 | 
	
		
			
				|  |  |  import { ProductMonitorColumns } from '/@/views/product-manage/Columns';
 | 
	
		
			
				|  |  | +import { downloadFile } from '/@/utils/service';
 | 
	
		
			
				|  |  |  import DataTableSlot from '/@/views/product-manage/product-monitor/component/DataTableSlot.vue';
 | 
	
		
			
				|  |  |  import PermissionButton from '/src/components/PermissionButton/index.vue';
 | 
	
		
			
				|  |  |  import VerticalDivider from '/src/components/VerticalDivider/index.vue';
 | 
	
		
			
				|  |  |  import ImportButton from '/src/components/ImportButton/index.vue';
 | 
	
		
			
				|  |  |  import EditDrawer from './EditDrawer.vue';
 | 
	
		
			
				|  |  |  import CreateDialog from '/src/views/product-manage/product-monitor/component/CreateDialog.vue';
 | 
	
		
			
				|  |  | +import CommentDetail from '/src/views/product-manage/comment-detail/index.vue';
 | 
	
		
			
				|  |  |  import * as api from '../api';
 | 
	
		
			
				|  |  | -import { downloadFile } from '/@/utils/service';
 | 
	
		
			
				|  |  | +import HistoricalDetail from '/@/views/product-manage/historical-detail/index.vue';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  interface Parameter {
 | 
	
	
		
			
				|  | @@ -50,7 +52,7 @@ const gridOptions: any = reactive({
 | 
	
		
			
				|  |  |    currentRowHighLight: true,
 | 
	
		
			
				|  |  |    height: '100%',
 | 
	
		
			
				|  |  |    customConfig: {
 | 
	
		
			
				|  |  | -    storage: true,
 | 
	
		
			
				|  |  | +    storage: true
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    toolbarConfig: {
 | 
	
		
			
				|  |  |      size: 'large',
 | 
	
	
		
			
				|  | @@ -84,10 +86,13 @@ const checkedList = ref<Set<number>>(new Set());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const editOpen = ref(false);
 | 
	
		
			
				|  |  |  const createOpen = ref(false);
 | 
	
		
			
				|  |  | -const rowData = ref({});
 | 
	
		
			
				|  |  | +const rowData = ref<any>({});
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const templateType = ref('monitor');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +const isShowComment = ref(false);
 | 
	
		
			
				|  |  | +const isShowHistory = ref(false);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  onMounted(() => {
 | 
	
		
			
				|  |  |    fetchList();
 | 
	
		
			
				|  |  |  });
 | 
	
	
		
			
				|  | @@ -120,35 +125,35 @@ function handleRefresh() {
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  async function handleDownload() {
 | 
	
		
			
				|  |  | -		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; // 结束加载状态
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | +  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 batchDelete() {
 | 
	
	
		
			
				|  | @@ -200,28 +205,38 @@ function handleCreate() {
 | 
	
		
			
				|  |  |    createOpen.value = true;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +function showComment(row: any) {
 | 
	
		
			
				|  |  | +  isShowComment.value = true;
 | 
	
		
			
				|  |  | +  rowData.value = row;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +function showHistory(row: any) {
 | 
	
		
			
				|  |  | +  isShowHistory.value = true;
 | 
	
		
			
				|  |  | +  rowData.value = row;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  function downloadTemplate() {
 | 
	
		
			
				|  |  | -	const url = '/api/choice/reviews_monitor/import_data/';
 | 
	
		
			
				|  |  | -	const fileName = '商品监控模板.xlsx';
 | 
	
		
			
				|  |  | +  const url = '/api/choice/reviews_monitor/import_data/';
 | 
	
		
			
				|  |  | +  const fileName = '商品监控模板.xlsx';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	if (url) {
 | 
	
		
			
				|  |  | -		downloadFile({
 | 
	
		
			
				|  |  | -			url,
 | 
	
		
			
				|  |  | -			method: 'GET',
 | 
	
		
			
				|  |  | -			filename: fileName,
 | 
	
		
			
				|  |  | -		});
 | 
	
		
			
				|  |  | -	} else {
 | 
	
		
			
				|  |  | -		console.error('未知的模板类型:', templateType.value);
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | +  if (url) {
 | 
	
		
			
				|  |  | +    downloadFile({
 | 
	
		
			
				|  |  | +      url,
 | 
	
		
			
				|  |  | +      method: 'GET',
 | 
	
		
			
				|  |  | +      filename: fileName
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +  } else {
 | 
	
		
			
				|  |  | +    console.error('未知的模板类型:', templateType.value);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const gridEvents = {
 | 
	
		
			
				|  |  | -  custom ({ type }: any) {
 | 
	
		
			
				|  |  | +  custom({ type }: any) {
 | 
	
		
			
				|  |  |      if (type == 'confirm') {
 | 
	
		
			
				|  |  |        fetchList();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  defineExpose({ fetchList });
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -257,8 +272,8 @@ defineExpose({ fetchList });
 | 
	
		
			
				|  |  |            <el-select v-model="templateType" style="width: 190px">
 | 
	
		
			
				|  |  |              <template #prefix>
 | 
	
		
			
				|  |  |                <div class="flex items-center">
 | 
	
		
			
				|  |  | -                <el-button size="small" type="success" text
 | 
	
		
			
				|  |  | -                           style="margin-left: -7px; font-size: 14px; border-radius: 29px;"
 | 
	
		
			
				|  |  | +                <el-button size="small" style="margin-left: -7px; font-size: 14px; border-radius: 29px;" text
 | 
	
		
			
				|  |  | +                           type="success"
 | 
	
		
			
				|  |  |                             @click.stop="downloadTemplate">
 | 
	
		
			
				|  |  |                    下载
 | 
	
		
			
				|  |  |                  </el-button>
 | 
	
	
		
			
				|  | @@ -278,31 +293,31 @@ defineExpose({ fetchList });
 | 
	
		
			
				|  |  |            <Refresh />
 | 
	
		
			
				|  |  |          </el-icon>
 | 
	
		
			
				|  |  |        </el-button>
 | 
	
		
			
				|  |  | -			<el-popconfirm
 | 
	
		
			
				|  |  | -				width="220"
 | 
	
		
			
				|  |  | -				:icon="InfoFilled"
 | 
	
		
			
				|  |  | -				icon-color="#626AEF"
 | 
	
		
			
				|  |  | -				title="是否确认导出当前时间内所有数据项?"
 | 
	
		
			
				|  |  | -				@confirm="handleDownload"
 | 
	
		
			
				|  |  | -			>
 | 
	
		
			
				|  |  | -				<template #reference>
 | 
	
		
			
				|  |  | -					<el-button circle class="mr-3 toolbar-btn">
 | 
	
		
			
				|  |  | -						<el-icon>
 | 
	
		
			
				|  |  | -							<Download />
 | 
	
		
			
				|  |  | -						</el-icon>
 | 
	
		
			
				|  |  | -					</el-button>
 | 
	
		
			
				|  |  | -				</template>
 | 
	
		
			
				|  |  | -				<template #actions="{ confirm, cancel }">
 | 
	
		
			
				|  |  | -					<el-button size="small" @click="cancel">No!</el-button>
 | 
	
		
			
				|  |  | -					<el-button
 | 
	
		
			
				|  |  | -						type="danger"
 | 
	
		
			
				|  |  | -						size="small"
 | 
	
		
			
				|  |  | -						@click="confirm"
 | 
	
		
			
				|  |  | -					>
 | 
	
		
			
				|  |  | -						Yes?
 | 
	
		
			
				|  |  | -					</el-button>
 | 
	
		
			
				|  |  | -				</template>
 | 
	
		
			
				|  |  | -			</el-popconfirm>
 | 
	
		
			
				|  |  | +      <el-popconfirm
 | 
	
		
			
				|  |  | +          :icon="InfoFilled"
 | 
	
		
			
				|  |  | +          icon-color="#626AEF"
 | 
	
		
			
				|  |  | +          title="是否确认导出当前时间内所有数据项?"
 | 
	
		
			
				|  |  | +          width="220"
 | 
	
		
			
				|  |  | +          @confirm="handleDownload"
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  | +        <template #reference>
 | 
	
		
			
				|  |  | +          <el-button circle class="mr-3 toolbar-btn">
 | 
	
		
			
				|  |  | +            <el-icon>
 | 
	
		
			
				|  |  | +              <Download />
 | 
	
		
			
				|  |  | +            </el-icon>
 | 
	
		
			
				|  |  | +          </el-button>
 | 
	
		
			
				|  |  | +        </template>
 | 
	
		
			
				|  |  | +        <template #actions="{ confirm, cancel }">
 | 
	
		
			
				|  |  | +          <el-button size="small" @click="cancel">No!</el-button>
 | 
	
		
			
				|  |  | +          <el-button
 | 
	
		
			
				|  |  | +              size="small"
 | 
	
		
			
				|  |  | +              type="danger"
 | 
	
		
			
				|  |  | +              @click="confirm"
 | 
	
		
			
				|  |  | +          >
 | 
	
		
			
				|  |  | +            Yes?
 | 
	
		
			
				|  |  | +          </el-button>
 | 
	
		
			
				|  |  | +        </template>
 | 
	
		
			
				|  |  | +      </el-popconfirm>
 | 
	
		
			
				|  |  |      </template>
 | 
	
		
			
				|  |  |      <template #top>
 | 
	
		
			
				|  |  |        <div class="mb-2"></div>
 | 
	
	
		
			
				|  | @@ -318,11 +333,14 @@ defineExpose({ fetchList });
 | 
	
		
			
				|  |  |      </template>
 | 
	
		
			
				|  |  |      <!-- 自定义列插槽 -->
 | 
	
		
			
				|  |  |      <template v-for="col in ProductMonitorColumns" #[`${col.field}`]="{ row }">
 | 
	
		
			
				|  |  | -      <DataTableSlot :key="row.id" :field="col.field" :row="row" @edit-row="handleEdit" @handle-delete="singleDelete" />
 | 
	
		
			
				|  |  | +      <DataTableSlot :key="row.id" :field="col.field" :row="row" @edit-row="handleEdit" @handle-delete="singleDelete"
 | 
	
		
			
				|  |  | +                     @show-comment="showComment" @show-history="showHistory" />
 | 
	
		
			
				|  |  |      </template>
 | 
	
		
			
				|  |  |    </vxe-grid>
 | 
	
		
			
				|  |  |    <EditDrawer v-if="editOpen" v-model="editOpen" :row-data="rowData" @refresh="handleRefresh" />
 | 
	
		
			
				|  |  |    <CreateDialog v-if="createOpen" v-model="createOpen" @refresh="fetchList" />
 | 
	
		
			
				|  |  | +  <CommentDetail v-if="isShowComment" v-model="isShowComment" :row-data="rowData.goods" title="商品监控" />
 | 
	
		
			
				|  |  | +  <HistoricalDetail v-if="isShowHistory" v-model="isShowHistory" :row-data="rowData.goods" title="商品监控"  />
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <style scoped>
 |