Explorar el Código

✨ feat<reportManage>: 新增数据中心、任务列表、数据录入页面

xinyan hace 1 año
padre
commit
e1c5aff5bb

+ 0 - 3
src/main.ts

@@ -39,7 +39,6 @@ import Timezon from 'dayjs/plugin/timezone'
 import IsSameOrBefore from 'dayjs/plugin/isSameOrBefore'
 import 'dayjs/locale/zh-cn'
 
-
 dayjs.extend(UTC)
 dayjs.extend(Timezon)
 dayjs.extend(IsSameOrBefore)
@@ -50,7 +49,6 @@ iconList.addIcon(forIconfont.list) // 添加iconfont dvadmin3的icon
 iconList.addIcon(elementPlus) // 添加element plus的图标
 iconList.addIcon(fontAwesome470) // 添加fontAwesome 470版本的图标
 
-
 let app = createApp(App)
 
 scanAndInstallPlugins(app)
@@ -65,7 +63,6 @@ pinia.use(piniaPersist)
 directive(app)
 other.elSvg(app)
 
-
 app.use(VXETable)
 app.use(permission)
 // @ts-ignore

+ 40 - 40
src/views/reportManage/dataCenter/components/CompareData.vue

@@ -1,42 +1,42 @@
-<script setup lang="ts">
-import { ref } from 'vue'
-// 筛选条件
-const value1 = ref([]) // 平台编号
-const value2 = ref([])
-const value3 = ref([])
-const value4 = ref([])
-const options = [
-  {
-    value: 'Option1',
-    label: 'Option1',
-  },
-  {
-    value: 'Option2',
-    label: 'Option2',
-  },
-]
-</script>
+<!--<script setup lang="ts">-->
+<!--import { ref } from 'vue'-->
+<!--// 筛选条件-->
+<!--const value1 = ref([]) // 平台编号-->
+<!--const value2 = ref([])-->
+<!--const value3 = ref([])-->
+<!--const value4 = ref([])-->
+<!--const options = [-->
+<!--  {-->
+<!--    value: 'Option1',-->
+<!--    label: 'Option1',-->
+<!--  },-->
+<!--  {-->
+<!--    value: 'Option2',-->
+<!--    label: 'Option2',-->
+<!--  },-->
+<!--]-->
+<!--</script>-->
 
-<template>
-  <div class="flex gap-1.5 justify-between">
-    <div class="flex gap-1.5">
-      <el-select v-model="value1" multiple placeholder="平台编号" style="width: 160px">
-        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
-      </el-select>
-      <el-select v-model="value2" multiple placeholder="平台名称" style="width: 160px">
-        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
-      </el-select>
-      <el-select v-model="value3" multiple placeholder="运营" style="width: 160px">
-        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
-      </el-select>
-      <el-select v-model="value4" multiple placeholder="国家" style="width: 160px">
-        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
-      </el-select>
-      <el-select v-model="value4" multiple placeholder="品牌" style="width: 160px">
-        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
-      </el-select>
-    </div>
-  </div>
-</template>
+<!--<template>-->
+<!--  <div class="flex gap-1.5 justify-between">-->
+<!--    <div class="flex gap-1.5">-->
+<!--      <el-select v-model="value1" multiple placeholder="平台编号" style="width: 160px">-->
+<!--        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--      </el-select>-->
+<!--      <el-select v-model="value2" multiple placeholder="平台名称" style="width: 160px">-->
+<!--        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--      </el-select>-->
+<!--      <el-select v-model="value3" multiple placeholder="运营" style="width: 160px">-->
+<!--        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--      </el-select>-->
+<!--      <el-select v-model="value4" multiple placeholder="国家" style="width: 160px">-->
+<!--        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--      </el-select>-->
+<!--      <el-select v-model="value4" multiple placeholder="品牌" style="width: 160px">-->
+<!--        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--      </el-select>-->
+<!--    </div>-->
+<!--  </div>-->
+<!--</template>-->
 
-<style scoped></style>
+<!--<style scoped></style>-->

+ 0 - 42
src/views/reportManage/dataCenter/components/DataEntry.vue

@@ -1,42 +0,0 @@
-<script setup lang="ts">
-import { reactive } from 'vue'
-import { VxeGridProps } from 'vxe-table'
-
-//表格
-const tableColumns = [
-  { type: 'seq', title: 'ID', width: 50 },
-  { field: 'Name', title: '平台名称' },
-  { field: 'Country', title: '国家' },
-  { field: 'Brand', title: '品牌' },
-  { field: 'Sales', title: '销售额' },
-  { field: 'TotalAdSales', title: '广告销售额' },
-  { field: 'AdSpend', title: '广告花费' },
-]
-
-const gridOptions = reactive<VxeGridProps<RowVO>>({
-  border: true,
-  height: 300,
-  align: null,
-  columnConfig: {
-    resizable: true,
-  },
-
-  columns: tableColumns,
-  toolbarConfig: {
-    slots: {
-      buttons: 'toolbar_buttons',
-    },
-  },
-  data: [{ Name: 10001, Country: 'Test1', Brand: 'T1', Sales: 'Develop', TotalAdSales: 11, AdSpend: 28 }],
-})
-</script>
-
-<template>
-  <div>
-    <vxe-grid v-bind="gridOptions">
-      <template #toolbar_buttons></template>
-    </vxe-grid>
-  </div>
-</template>
-
-<style scoped></style>

+ 168 - 6
src/views/reportManage/dataCenter/components/DataExport.vue

@@ -1,11 +1,173 @@
-<script setup lang="ts">
-
-</script>
-
 <template>
+  <div>
+    <vxe-grid ref="xGrid" v-bind="gridOptions" v-on="gridEvents">
+      <template #operate="{ row }">
+        <template v-if="hasActiveEditRow(row)">
+          <vxe-button content="取消" @click="clearRowEvent"></vxe-button>
+          <vxe-button status="primary" content="保存" @click="saveRowEvent(row)"></vxe-button>
+        </template>
+        <template v-else>
+          <vxe-button content="编辑" @click="editRowEvent(row)"></vxe-button>
+        </template>
+        <vxe-button status="danger" content="删除" @click="removeRowEvent(row)"></vxe-button>
+      </template>
 
+      <template #Name_edit="{ row }">
+        <vxe-input v-model="row.Name"></vxe-input>
+      </template>
+      <template #DailyDataHeader_edit="{ row }">
+        <vxe-input v-model="row.DailyDataHeader"></vxe-input>
+      </template>
+      <template #WeeklyDataHeader_edit="{ row }">
+        <vxe-input v-model="row.WeeklyDataHeader"></vxe-input>
+      </template>
+      <template #MonthlyDataHeader_edit="{ row }">
+        <vxe-input v-model="row.MonthlyDataHeader"></vxe-input>
+      </template>
+      <template #CreationTime_edit="{ row }">
+        <vxe-input v-model="row.CreationTime"></vxe-input>
+      </template>
+    </vxe-grid>
+  </div>
 </template>
 
-<style scoped>
+<script lang="ts" setup>
+import { ref, reactive } from 'vue'
+import { VXETable, VxeGridInstance, VxeGridProps, VxeGridListeners } from 'vxe-table'
+
+interface RowVO {
+  Name: string
+  DailyDataHeader: string
+  WeeklyDataHeader: string
+  MonthlyDataHeader: string
+  CreationTime: number
+}
+
+const xGrid = ref<VxeGridInstance<RowVO>>()
+
+const gridOptions = reactive<VxeGridProps<RowVO>>({
+  border: true,
+  keepSource: true,
+  showOverflow: true,
+  height: 530,
+  loading: false,
+  columnConfig: {
+    resizable: true
+  },
+  pagerConfig: {
+    enabled: true,
+    total: 0,
+    currentPage: 1,
+    pageSize: 10,
+    pageSizes: [10, 20, 50, 100, 200, 500]
+  },
+  editConfig: {
+    trigger: 'manual',
+    mode: 'row',
+    showStatus: true
+  },
+  columns: [
+    { field: 'Name', title: '模板名称', editRender: { autofocus: '.vxe-input--inner' }, slots: { edit: 'Name_edit' } },
+    { field: 'DailyDataHeader', title: '日数据表头', editRender: { autofocus: '.vxe-input--inner' }, slots: { edit: 'DailyDataHeader_edit' } },
+    { field: 'WeeklyDataHeader', title: '周数据表头', editRender: {}, slots: { edit: 'WeeklyDataHeader_edit' } },
+    { field: 'MonthlyDataHeader', title: '月数据表头', editRender: {}, slots: { edit: 'MonthlyDataHeader_edit' } },
+    { field: 'CreationTime', title: '创建时间', editRender: {}, slots: { edit: 'CreationTime_edit' } },
+    { title: '操作', width: 300, slots: { default: 'operate' } }
+  ],
+  data: []
+})
+
+
+const findList = () => {
+  gridOptions.loading = true
+  setTimeout(() => {
+    gridOptions.loading = false
+    if (gridOptions.pagerConfig) {
+      gridOptions.pagerConfig.total = 10
+    }
+    gridOptions.data = [
+      {
+        Name: 'John Brown',
+        DailyDataHeader: 'New York No. 1 Lake Park',
+        WeeklyDataHeader: 'New York No. 1 Lake Park',
+        MonthlyDataHeader: 'New York No. 1 Lake Park',
+        'CreationTime': '2016-10-03',
+      },
+        {
+          Name: 'Jim Green',
+          DailyDataHeader: 'London No. 1 Lake Park',
+          WeeklyDataHeader: 'London No. 1 Lake Park',
+          MonthlyDataHeader: 'London No. 1 Lake Park',
+          'CreationTime': '2016-10-01',
+        },
+    ]
+  }, 300)
+}
+
+const gridEvents: VxeGridListeners<RowVO> = {
+  pageChange ({ currentPage, pageSize }) {
+    if (gridOptions.pagerConfig) {
+      gridOptions.pagerConfig.currentPage = currentPage
+      gridOptions.pagerConfig.pageSize = pageSize
+    }
+    findList()
+  }
+}
+
+const formatSex = (value: string) => {
+  if (value === '1') {
+    return '男'
+  }
+  if (value === '0') {
+    return '女'
+  }
+  return ''
+}
+
+const hasActiveEditRow = (row: RowVO) => {
+  const $grid = xGrid.value
+  if ($grid) {
+    return $grid.isEditByRow(row)
+  }
+  return false
+}
+
+const editRowEvent = (row: RowVO) => {
+  const $grid = xGrid.value
+  if ($grid) {
+    $grid.setEditRow(row)
+  }
+}
+
+const clearRowEvent = () => {
+  const $grid = xGrid.value
+  if ($grid) {
+    $grid.clearEdit()
+  }
+}
+
+const saveRowEvent = async (row: RowVO) => {
+  const $grid = xGrid.value
+  if ($grid) {
+    await $grid.clearEdit()
+    gridOptions.loading = true
+    // 模拟异步保存
+    setTimeout(() => {
+      gridOptions.loading = false
+      VXETable.modal.message({ content: `${JSON.stringify(row)}`, status: 'success' })
+    }, 300)
+  }
+}
+
+const removeRowEvent = async (row: RowVO) => {
+  const type = await VXETable.modal.confirm('您确定要删除该数据?')
+  const $grid = xGrid.value
+  if ($grid) {
+    if (type === 'confirm') {
+      await $grid.remove(row)
+    }
+  }
+}
 
-</style>
+findList()
+</script>

+ 21 - 4
src/views/reportManage/dataCenter/components/NormalDisplay.vue

@@ -7,7 +7,11 @@ import DateRangePicker from '/@/components/DateRangePicker/index.vue'
 import { storeToRefs } from 'pinia'
 import { useShopInfo } from '/@/stores/shopInfo'
 import { usePublicData } from '/@/stores/publicData'
+import { useRouter } from 'vue-router'
 
+const router = useRouter()
+// import router from "/@/router";
+import DataEntry from "/src/views/reportManage/dataCenter/components/EntryDetail.vue";
 // 店铺信息
 const shopInfo = useShopInfo()
 const { profile } = storeToRefs(shopInfo)
@@ -59,6 +63,7 @@ const gridOptions = reactive({
   border: true,
   height: 300,
   align: null,
+  round: true,
   columnConfig: {
     resizable: true,
   },
@@ -87,11 +92,19 @@ const gridOptions = reactive({
     },
   ],
 })
+
+//数据导入
+const handleImport = (row: any) => {
+  router.push({
+    name: 'EntryDetail',
+  })
+}
+
+
 </script>
 
 <template>
   <div>
-    <el-alert></el-alert>
     <div class="flex gap-1.5 justify-between">
       <div class="flex gap-1.5">
         <el-select v-model="value1" multiple placeholder="平台编号" style="width: 160px">
@@ -123,16 +136,20 @@ const gridOptions = reactive({
         >np
       </DataTendencyChart>
     </el-card>
+    </div>
     <el-card>
       <vxe-grid v-bind="gridOptions">
         <template #toolbar_buttons>
           <!--TODO: 数据录入-->
-          <vxe-button @click="">数据录入</vxe-button>
+          <vxe-button @click="handleImport">数据录入</vxe-button>
           <vxe-button @click="">任务列表</vxe-button>
         </template>
       </vxe-grid>
     </el-card>
-  </div>
 </template>
 
-<style scoped></style>
+<style scoped>
+.vxe-grid {
+  border-radius: 8px; /* 更改这个值以设置你想要的圆角大小 */
+}
+</style>

+ 1 - 0
src/views/reportManage/dataCenter/components/TableBrowsing.vue

@@ -65,6 +65,7 @@ const gridOptions = reactive({
   border: true,
   height: 300,
   align: null,
+  round: true,
   columnConfig: {
     resizable: true,
   },

+ 37 - 43
src/views/reportManage/dataCenter/index.vue

@@ -1,44 +1,38 @@
 <script setup lang="ts">
-  import {ref,reactive} from 'vue'
-  import type {TabsPaneContext} from 'element-plus'
-  import TableBrowsing from "/@/views/reportManage/dataCenter/components/TableBrowsing.vue";
-  import DataExport from "/@/views/reportManage/dataCenter/components/DataExport.vue";
-  import CompareData from "/@/views/reportManage/dataCenter/components/CompareData.vue";
-  import NormalDisplay from "/@/views/reportManage/dataCenter/components/NormalDisplay.vue";
-  
-  const activeName = ref('NormalDisplay');
-  const tabsComponents: any = {
-    NormalDisplay,
-    TableBrowsing,
-    CompareData ,
-    DataExport
-  }
-  const panes = [
-    { label: "普通展示", name: "NormalDisplay" },
-    { label: "表格浏览", name: "TableBrowsing" },
-    { label: "对比数据", name: "CompareData" },
-    { label: "数据导出", name: "DataExport" },
-  ];
-  
-  /**
-   *
-   * @param tab
-   * @param event
-   */
-  function handleTabClick(tab: TabsPaneContext, event: Event) {
-    return "test name";
-  }
-  
+import { ref } from 'vue'
+import type { TabsPaneContext } from 'element-plus'
+import TableBrowsing from '/@/views/reportManage/dataCenter/components/TableBrowsing.vue'
+import DataExport from '/@/views/reportManage/dataCenter/components/DataExport.vue'
+import CompareData from '/@/views/reportManage/dataCenter/components/CompareData.vue'
+import NormalDisplay from '/@/views/reportManage/dataCenter/components/NormalDisplay.vue'
+
+const activeName = ref('NormalDisplay')
+const tabsComponents: any = {
+  NormalDisplay,
+  TableBrowsing,
+  // CompareData,
+  DataExport,
+}
+const panes = [
+  { label: '普通展示', name: 'NormalDisplay' },
+  { label: '表格浏览', name: 'TableBrowsing' },
+  // { label: '对比数据', name: 'CompareData' },
+  { label: '数据导出', name: 'DataExport' },
+]
+
+/**
+ *
+ * @param tab
+ * @param event
+ */
+function handleTabClick(tab: TabsPaneContext, event: Event) {
+  return 'test name'
+}
 </script>
 
 <template>
   <div class="px-2">
-    <el-tabs
-        v-model="activeName"
-        type="card"
-        class="demo-tabs"
-        @tab-click="handleTabClick"
-    >
+    <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="handleTabClick">
       <el-tab-pane v-for="pane in panes" :key="pane.name" :label="pane.label" :name="pane.name"></el-tab-pane>
       <component :is="tabsComponents[activeName]"></component>
     </el-tabs>
@@ -46,10 +40,10 @@
 </template>
 
 <style scoped>
-  .demo-tabs > .el-tabs__content {
-    padding: 32px;
-    color: #6b778c;
-    font-size: 32px;
-    font-weight: 600;
-  }
-</style>
+.demo-tabs > .el-tabs__content {
+  padding: 32px;
+  color: #6b778c;
+  font-size: 32px;
+  font-weight: 600;
+}
+</style>