|
|
@@ -2,26 +2,15 @@
|
|
|
<ele-page flex-table>
|
|
|
<page-search @search="reload" />
|
|
|
|
|
|
- <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns" :datasource="datasource">
|
|
|
+ <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
|
|
|
<template #toolbar>
|
|
|
<div class="flex gap-2">
|
|
|
<el-button type="primary" @click="handleImport">导入</el-button>
|
|
|
- <el-button type="success">导出</el-button>
|
|
|
+ <el-button type="success" @click="handleExport">导出</el-button>
|
|
|
<el-button type="primary" @click="handleAdd">添加图书</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <!-- 易投诉平台列 -->
|
|
|
- <template #platforms="{ row }">
|
|
|
- <div class="flex flex-wrap gap-1">
|
|
|
- <el-tag v-for="platform in row.platforms" :key="platform" :type="getPlatformTagType(platform)"
|
|
|
- :color="getPlatformTagColor(platform)" :style="{ color: getPlatformTagTextColor(platform) }"
|
|
|
- size="small" effect="dark">
|
|
|
- {{ getPlatformLabel(platform) }}
|
|
|
- </el-tag>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
<!-- 操作列 -->
|
|
|
<template #action="{ row }">
|
|
|
<el-button link type="primary" @click="handleEdit(row)">[编辑]</el-button>
|
|
|
@@ -35,128 +24,65 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive } from 'vue';
|
|
|
-import { ElMessageBox, ElMessage } from 'element-plus';
|
|
|
-import CommonTable from '@/components/CommonPage/CommonTable.vue';
|
|
|
-import PageSearch from './components/page-search.vue';
|
|
|
-import AddDialog from './components/add-dialog.vue';
|
|
|
-import ImportDialog from './components/import-dialog.vue';
|
|
|
-
|
|
|
-defineOptions({ name: 'HighComplaintBooks' });
|
|
|
-
|
|
|
-const pageRef = ref(null);
|
|
|
-const addDialogRef = ref(null);
|
|
|
-const importVisible = ref(false);
|
|
|
-
|
|
|
-const pageConfig = reactive({
|
|
|
- fileName: '易投诉书单',
|
|
|
- cacheKey: 'highComplaintBooksTable',
|
|
|
- rowKey: 'id'
|
|
|
-});
|
|
|
-
|
|
|
-const columns = ref([
|
|
|
- { label: 'ISBN', prop: 'isbn', width: 140, align: 'center' },
|
|
|
- { label: '书名', prop: 'bookName', minWidth: 150 },
|
|
|
- { label: '易投诉平台', prop: 'platforms', width: 220, slot: 'platforms' },
|
|
|
- { label: '投诉原因', prop: 'reasonLabel', width: 120 },
|
|
|
- { label: '操作员', prop: 'operator', width: 100, align: 'center' },
|
|
|
- { label: '添加日期', prop: 'createTime', width: 160, align: 'center' },
|
|
|
- { label: '操作', prop: 'action', width: 120, slot: 'action', fixed: 'right', align: 'center' }
|
|
|
-]);
|
|
|
+ import { ref, reactive } from 'vue';
|
|
|
+ import { ElMessageBox, ElMessage } from 'element-plus';
|
|
|
+ import CommonTable from '@/components/CommonPage/CommonTable.vue';
|
|
|
+ import PageSearch from './components/page-search.vue';
|
|
|
+ import AddDialog from './components/add-dialog.vue';
|
|
|
+ import ImportDialog from './components/import-dialog.vue';
|
|
|
+
|
|
|
+ defineOptions({ name: 'HighComplaintBooks' });
|
|
|
+
|
|
|
+ const pageRef = ref(null);
|
|
|
+ const addDialogRef = ref(null);
|
|
|
+ const importVisible = ref(false);
|
|
|
+
|
|
|
+ const pageConfig = reactive({
|
|
|
+ fileName: '易投诉书单',
|
|
|
+ cacheKey: 'highComplaintBooksTable',
|
|
|
+ rowKey: 'id',
|
|
|
+ pageUrl: '/shop/complaintBook/pagelist',
|
|
|
+ exportUrl: '/shop/complaintBook/export'
|
|
|
+ });
|
|
|
|
|
|
-// Helper functions for tags
|
|
|
-const getPlatformLabel = (val) => {
|
|
|
- const map = {
|
|
|
- 'pdd': '拼多多',
|
|
|
- 'taobao': '淘宝',
|
|
|
- 'kongwang': '孔网',
|
|
|
- 'miniapp': '小程序'
|
|
|
+ const columns = ref([
|
|
|
+ { label: 'ISBN', prop: 'isbn', minWidth: 100, align: 'center' },
|
|
|
+ { label: '书名', prop: 'bookName', minWidth: 180 },
|
|
|
+ { label: '易投诉平台', prop: 'platformList', minWidth: 220, slot: 'platform' },
|
|
|
+ { label: '投诉原因', prop: 'reason', minWidth: 120 },
|
|
|
+ { label: '操作员', prop: 'createName', width: 100, align: 'center' },
|
|
|
+ { label: '添加日期', prop: 'createTime', width: 160, align: 'center' },
|
|
|
+ { label: '操作', prop: 'action', width: 150, slot: 'action', fixed: 'right', align: 'center' }
|
|
|
+ ]);
|
|
|
+
|
|
|
+ const reload = (where) => {
|
|
|
+ pageRef.value?.reload(where);
|
|
|
};
|
|
|
- return map[val] || val;
|
|
|
-};
|
|
|
-
|
|
|
-const getPlatformTagType = (val) => {
|
|
|
- if (val === 'pdd') return 'danger';
|
|
|
- if (val === 'miniapp') return 'success';
|
|
|
- return '';
|
|
|
-};
|
|
|
|
|
|
-const getPlatformTagColor = (val) => {
|
|
|
- if (val === 'taobao') return '#f90'; // Orange
|
|
|
- if (val === 'kongwang') return '#8B4513'; // Brown
|
|
|
- return '';
|
|
|
-};
|
|
|
-
|
|
|
-const getPlatformTagTextColor = (val) => {
|
|
|
- if (val === 'taobao' || val === 'kongwang') return '#fff';
|
|
|
- return '';
|
|
|
-};
|
|
|
-
|
|
|
-// Mock Datasource
|
|
|
-const datasource = ({ page, limit, where }) => {
|
|
|
- return Promise.resolve({
|
|
|
- code: 0,
|
|
|
- msg: 'success',
|
|
|
- count: 1,
|
|
|
- data: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- isbn: '9787563215652',
|
|
|
- bookName: '人世间',
|
|
|
- platforms: ['pdd', 'taobao', 'kongwang', 'miniapp'],
|
|
|
- reason: 'publisher',
|
|
|
- reasonLabel: '出版社投诉',
|
|
|
- operator: 'zzz',
|
|
|
- createTime: '2022-05-15 15:00:00'
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- isbn: '9787563215652',
|
|
|
- bookName: '人世间',
|
|
|
- platforms: [],
|
|
|
- reason: '',
|
|
|
- reasonLabel: '',
|
|
|
- operator: '',
|
|
|
- createTime: ''
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- isbn: '9787563215652',
|
|
|
- bookName: '人世间',
|
|
|
- platforms: [],
|
|
|
- reason: '',
|
|
|
- reasonLabel: '',
|
|
|
- operator: '',
|
|
|
- createTime: ''
|
|
|
- }
|
|
|
- ]
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const reload = (where) => {
|
|
|
- pageRef.value?.reload(where);
|
|
|
-};
|
|
|
+ const handleAdd = () => {
|
|
|
+ addDialogRef.value?.handleOpen();
|
|
|
+ };
|
|
|
|
|
|
-const handleAdd = () => {
|
|
|
- addDialogRef.value?.handleOpen();
|
|
|
-};
|
|
|
+ const handleEdit = (row) => {
|
|
|
+ addDialogRef.value?.handleOpen(row);
|
|
|
+ };
|
|
|
|
|
|
-const handleEdit = (row) => {
|
|
|
- addDialogRef.value?.handleOpen(row);
|
|
|
-};
|
|
|
+ const handleDelete = (row) => {
|
|
|
+ ElMessageBox.confirm('确定要删除该条记录吗?', '提示', {
|
|
|
+ type: 'warning',
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消'
|
|
|
+ }).then(() => {
|
|
|
+ ElMessage.success('删除成功');
|
|
|
+ reload();
|
|
|
+ }).catch(() => { });
|
|
|
+ };
|
|
|
|
|
|
-const handleDelete = (row) => {
|
|
|
- ElMessageBox.confirm('确定要删除该条记录吗?', '提示', {
|
|
|
- type: 'warning',
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消'
|
|
|
- }).then(() => {
|
|
|
- ElMessage.success('删除成功');
|
|
|
- reload();
|
|
|
- }).catch(() => { });
|
|
|
-};
|
|
|
+ const handleImport = () => {
|
|
|
+ importVisible.value = true;
|
|
|
+ };
|
|
|
|
|
|
-const handleImport = () => {
|
|
|
- importVisible.value = true;
|
|
|
-};
|
|
|
+ const handleExport = () => {
|
|
|
+ pageRef.value?.exportData();
|
|
|
+ };
|
|
|
</script>
|