liyongli 2 tahun lalu
induk
melakukan
dc8cc4beb0
3 mengubah file dengan 97 tambahan dan 9 penghapusan
  1. 20 9
      src/main.js
  2. 11 0
      src/router/report.js
  3. 66 0
      src/views/report/UpExcelSlcw/index.vue

+ 20 - 9
src/main.js

@@ -1,9 +1,9 @@
-import Vue from "vue";
-import App from "./App.vue";
-import router from "./router";
-import ElementUI from "element-ui";
-import "element-ui/lib/theme-chalk/index.css";
-import { getUser } from "./utils/tool";
+import Vue from 'vue';
+import App from './App.vue';
+import router from './router';
+import ElementUI from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+import { getUser } from './utils/tool';
 
 Vue.use(ElementUI);
 
@@ -16,14 +16,25 @@ router.beforeEach((to, from, next) => {
   const Calendar = /^\/Calendar/g.test(to.path);
   const SilkRoadData = /^\/SilkRoadData/g.test(to.path);
   const SilkRoadDetail = /^\/SilkRoadDetail/g.test(to.path);
-  if (traditional || advertisement || Mobile || menuDiet1 || Calendar || SilkRoadData || SilkRoadDetail) return next();
+  const UpExcelSlcw = /^\/UpExcelSlcw/g.test(to.path);
+  if (
+    traditional ||
+    advertisement ||
+    Mobile ||
+    menuDiet1 ||
+    Calendar ||
+    SilkRoadData ||
+    SilkRoadDetail ||
+    UpExcelSlcw
+  )
+    return next();
   if (!localStorage.user) {
     // apply 必须拿到oa用户数据
-    getUser(() => next())
+    getUser(() => next());
   } else next();
 });
 
 new Vue({
   router,
   render: h => h(App),
-}).$mount("#app");
+}).$mount('#app');

+ 11 - 0
src/router/report.js

@@ -98,4 +98,15 @@ export default [
           /* webpackChunkName: "SilkRoadData" */ "../views/report/SilkRoadDetail/index.vue"
         ),
     },
+    {
+      path: "/UpExcelSlcw",
+      name: "UpExcelSlcw",
+      meta: {
+        title: "2023丝路春晚数据上传页",
+      },
+      component: () =>
+        import(
+          /* webpackChunkName: "SilkRoadData" */ "../views/report/UpExcelSlcw/index.vue"
+        ),
+    },
 ];

+ 66 - 0
src/views/report/UpExcelSlcw/index.vue

@@ -0,0 +1,66 @@
+<template>
+  <div class="UpExcelSlcw">
+    <el-upload
+      class="upload-demo"
+      action="https://jsonplaceholder.typicode.com/posts/"
+      :on-preview="handlePreview"
+      accept= "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
+      :on-remove="handleRemove"
+      :before-remove="beforeRemove"
+      :on-exceed="handleExceed"
+      :file-list="fileList"
+    >
+      <el-button size="small" type="primary">点击上传</el-button>
+      <div slot="tip" class="el-upload__tip">
+        只能上传excel文件
+      </div>
+    </el-upload>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'UpExcelSlcw',
+  data() {
+    return {
+      fileList: [],
+    };
+  },
+  props: [],
+  mixins: [],
+  watch: {},
+  mounted() {},
+  computed: {},
+  filters: {},
+  methods: {
+    handleRemove(file, fileList) {
+      console.log(file, fileList);
+    },
+    handlePreview(file) {
+      console.log(file);
+    },
+    handleExceed(files, fileList) {
+      this.$message.warning(
+        `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
+          files.length + fileList.length
+        } 个文件`
+      );
+    },
+    beforeRemove(file) {
+      return this.$confirm(`确定移除 ${file.name}?`);
+    },
+  },
+  beforeUnmount() {},
+  components: {},
+};
+</script>
+
+<style scoped>
+.UpExcelSlcw {
+  padding: 2em 1em 0 1em;
+
+}
+.upload-demo {
+  text-align: center;
+}
+</style>