初始化代码
This commit is contained in:
commit
adc91b0b2b
3
.browserslistrc
Normal file
3
.browserslistrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
> 1%
|
||||
last 2 versions
|
||||
not dead
|
11
.env
Normal file
11
.env
Normal file
|
@ -0,0 +1,11 @@
|
|||
NODE_ENV=production
|
||||
VUE_APP_PREVIEW=false
|
||||
# VUE_APP_API_BASE_URL=http://172.20.10.2:7003
|
||||
# VUE_APP_API_IDENTITY_URL=http://172.20.10.2:7001
|
||||
# VUE_APP_API_FILE_URL=http://172.20.10.2:7003
|
||||
VUE_APP_API_BASE_URL=http://localhost:7003
|
||||
VUE_APP_API_IDENTITY_URL=http://localhost:7001
|
||||
VUE_APP_API_FILE_URL=http://localhost:7003
|
||||
|
||||
|
||||
|
3
.env.development
Normal file
3
.env.development
Normal file
|
@ -0,0 +1,3 @@
|
|||
NODE_ENV=development
|
||||
VUE_APP_PREVIEW=true
|
||||
VUE_APP_API_BASE_URL=http://localhost:7003
|
3
.env.preview
Normal file
3
.env.preview
Normal file
|
@ -0,0 +1,3 @@
|
|||
NODE_ENV=production
|
||||
VUE_APP_PREVIEW=true
|
||||
VUE_APP_API_BASE_URL=http://localhost:7003
|
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
19
README.md
Normal file
19
README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# report_generation
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
5
babel.config.js
Normal file
5
babel.config.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
19
jsconfig.json
Normal file
19
jsconfig.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
}
|
||||
}
|
11726
package-lock.json
generated
Normal file
11726
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
package.json
Normal file
26
package.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "report_generation",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"ant-design-vue": "^1.7.8",
|
||||
"axios": "^1.8.4",
|
||||
"core-js": "^3.8.3",
|
||||
"vue": "^2.6.14",
|
||||
"vue-router": "^3.5.1",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-router": "~5.0.0",
|
||||
"@vue/cli-plugin-vuex": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0",
|
||||
"sass": "^1.32.7",
|
||||
"sass-loader": "^12.0.0",
|
||||
"vue-template-compiler": "^2.6.14"
|
||||
}
|
||||
}
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
17
public/index.html
Normal file
17
public/index.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
28
src/App.vue
Normal file
28
src/App.vue
Normal file
|
@ -0,0 +1,28 @@
|
|||
<template>
|
||||
<div id="app">
|
||||
<router-view/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
nav {
|
||||
padding: 30px;
|
||||
|
||||
a {
|
||||
font-weight: bold;
|
||||
color: #2c3e50;
|
||||
|
||||
&.router-link-exact-active {
|
||||
color: #42b983;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
BIN
src/assets/logo.png
Normal file
BIN
src/assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
59
src/components/HelloWorld.vue
Normal file
59
src/components/HelloWorld.vue
Normal file
|
@ -0,0 +1,59 @@
|
|||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<p>
|
||||
For a guide and recipes on how to configure / customize this project,<br>
|
||||
check out the
|
||||
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
||||
</p>
|
||||
<h3>Installed CLI Plugins</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
|
||||
</ul>
|
||||
<h3>Essential Links</h3>
|
||||
<ul>
|
||||
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
|
||||
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
|
||||
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
|
||||
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
|
||||
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
|
||||
</ul>
|
||||
<h3>Ecosystem</h3>
|
||||
<ul>
|
||||
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
|
||||
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
|
||||
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
|
||||
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'HelloWorld',
|
||||
props: {
|
||||
msg: String
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped lang="scss">
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
15
src/main.js
Normal file
15
src/main.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
import Antd from 'ant-design-vue';
|
||||
import 'ant-design-vue/dist/antd.css';
|
||||
Vue.use(Antd);
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
20
src/router/index.js
Normal file
20
src/router/index.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
|
||||
Vue.use(VueRouter)
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'reprot',
|
||||
component: () => import('../views/ReportGeneration.vue')
|
||||
}
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
mode: 'history',
|
||||
// base: process.env.BASE_URL,
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
17
src/store/index.js
Normal file
17
src/store/index.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
},
|
||||
getters: {
|
||||
},
|
||||
mutations: {
|
||||
},
|
||||
actions: {
|
||||
},
|
||||
modules: {
|
||||
}
|
||||
})
|
75
src/utils/request.js
Normal file
75
src/utils/request.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
import axios from 'axios'
|
||||
import notification from 'ant-design-vue/es/notification'
|
||||
|
||||
// 创建 axios 实例
|
||||
const request = axios.create({
|
||||
// API 请求的默认前缀
|
||||
baseURL: process.env.VUE_APP_API_BASE_URL,
|
||||
timeout: 600000 // 请求超时时间 1分钟是60000,当前设置为10分钟,导出资料数据条数过多,等待时间比较久
|
||||
})
|
||||
|
||||
// request 请求拦截器
|
||||
request.interceptors.request.use(config => {
|
||||
// const token = storage.get(ACCESS_AUTHORIZATION)
|
||||
// // 如果 token 存在
|
||||
// // 让每个请求携带自定义 token 请根据实际情况自行修改
|
||||
// if (token) {
|
||||
// config.headers['Authorization'] = token
|
||||
// }
|
||||
return config
|
||||
}, error => {
|
||||
// 对请求错误做些什么
|
||||
return Promise.reject(error);
|
||||
})
|
||||
|
||||
// request 响应拦截器
|
||||
request.interceptors.response.use(response => {
|
||||
// 对响应数据做些什么
|
||||
return response.data;
|
||||
}, error => {
|
||||
// 对响应错误做些什么
|
||||
if (error.response) {
|
||||
// 根据不同的状态码进行不同的处理
|
||||
switch (error.response.status) {
|
||||
case 401:
|
||||
// 未授权,跳转到登录页面
|
||||
// router.push('/login');
|
||||
console.error('未授权');
|
||||
notification.error({
|
||||
message: '系统提示',
|
||||
description: error.response.data
|
||||
})
|
||||
break;
|
||||
case 404:
|
||||
// 资源未找到
|
||||
console.error('请求的资源不存在');
|
||||
notification.error({
|
||||
message: '系统提示',
|
||||
description: error.response.data
|
||||
})
|
||||
break;
|
||||
default:
|
||||
notification.error({
|
||||
message: '系统提示',
|
||||
description: error.response.data
|
||||
})
|
||||
}
|
||||
} else if (error.request) {
|
||||
// 请求已发出,但没有收到响应
|
||||
notification.error({
|
||||
message: '系统提示',
|
||||
description: error.request
|
||||
})
|
||||
console.error('请求超时或网络错误', error.request);
|
||||
} else {
|
||||
// 其他错误
|
||||
notification.error({
|
||||
message: '系统提示',
|
||||
description: error.message
|
||||
})
|
||||
console.error('请求配置错误', error.message);
|
||||
}
|
||||
return Promise.reject(error);
|
||||
})
|
||||
|
||||
export default service;
|
5
src/views/AboutView.vue
Normal file
5
src/views/AboutView.vue
Normal file
|
@ -0,0 +1,5 @@
|
|||
<template>
|
||||
<div class="about">
|
||||
<h1>This is an about page</h1>
|
||||
</div>
|
||||
</template>
|
18
src/views/HomeView.vue
Normal file
18
src/views/HomeView.vue
Normal file
|
@ -0,0 +1,18 @@
|
|||
<template>
|
||||
<div class="home">
|
||||
<img alt="Vue logo" src="../assets/logo.png">
|
||||
<HelloWorld msg="Welcome to Your Vue.js App"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// @ is an alias to /src
|
||||
import HelloWorld from '@/components/HelloWorld.vue'
|
||||
|
||||
export default {
|
||||
name: 'HomeView',
|
||||
components: {
|
||||
HelloWorld
|
||||
}
|
||||
}
|
||||
</script>
|
131
src/views/ReportGeneration.vue
Normal file
131
src/views/ReportGeneration.vue
Normal file
|
@ -0,0 +1,131 @@
|
|||
<template>
|
||||
<div class="rootContent">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="14">
|
||||
<div class="fileContent">
|
||||
<div class="fileListTitle">生成报告</div>
|
||||
<div class="generForm">
|
||||
<a-form :form="form" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
|
||||
<a-form-item label="结果文件">
|
||||
<a-upload-dragger name="file" :multiple="true"
|
||||
action="https://www.mocky.io/v2/5cc8019d300000980a055e76" @change="handleChange">
|
||||
<p class="ant-upload-drag-icon">
|
||||
<a-icon type="inbox" />
|
||||
</p>
|
||||
<p class="ant-upload-text">
|
||||
点击或拖动文件至此区域上传
|
||||
</p>
|
||||
<p class="ant-upload-hint">
|
||||
仅允许上传.xls; .xlsx文件
|
||||
</p>
|
||||
</a-upload-dragger>
|
||||
</a-form-item>
|
||||
<a-form-item :wrapper-col="{ span: 20, offset: 4 }" class="btns">
|
||||
<a-button type="primary" size="large">
|
||||
生成报告
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="10">
|
||||
<div class="fileContent">
|
||||
<div class="fileListTitle">报告文件</div>
|
||||
<div class="fileList">
|
||||
<a-table :columns="columns" :data-source="data">
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a>导出</a>
|
||||
</span>
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'ReportGeneration',
|
||||
data() {
|
||||
return {
|
||||
formLayout: 'horizontal',
|
||||
form: {},
|
||||
columns: [
|
||||
{
|
||||
title: '文件',
|
||||
key: 'name',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
scopedSlots: { customRender: 'action' },
|
||||
},
|
||||
],
|
||||
data: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
handleChange(info) {
|
||||
const status = info.file.status;
|
||||
if (status !== 'uploading') {
|
||||
console.log(info.file, info.fileList);
|
||||
}
|
||||
if (status === 'done') {
|
||||
this.$message.success(`${info.file.name} file uploaded successfully.`);
|
||||
} else if (status === 'error') {
|
||||
this.$message.error(`${info.file.name} file upload failed.`);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.rootContent {
|
||||
width: 80%;
|
||||
height: 100vh;
|
||||
margin: 0 auto;
|
||||
padding: 2% 30px;
|
||||
}
|
||||
|
||||
.btns {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.fileContent {
|
||||
border: 1px solid #d2d2d2;
|
||||
height: 90vh;
|
||||
}
|
||||
|
||||
.fileListTitle {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 18px;
|
||||
color: #fff;
|
||||
background: rgb(55, 134, 252);
|
||||
text-align: left;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.fileList {
|
||||
padding: 20px 10px;
|
||||
}
|
||||
|
||||
.generForm {
|
||||
padding: 20px 24px;
|
||||
}
|
||||
|
||||
::v-deep {
|
||||
.ant-btn-lg {
|
||||
height: 40px;
|
||||
padding: 0 45px;
|
||||
font-size: 16px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
4
vue.config.js
Normal file
4
vue.config.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
const { defineConfig } = require('@vue/cli-service')
|
||||
module.exports = defineConfig({
|
||||
transpileDependencies: true
|
||||
})
|
Loading…
Reference in New Issue
Block a user