├── .DS_Store ├── README.md ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── index.js └── prod.env.js ├── dist ├── index.html └── static │ ├── css │ ├── app.70a413241b84a7b188c9937557752664.css │ └── app.70a413241b84a7b188c9937557752664.css.map │ ├── fonts │ ├── element-icons.535877f.woff │ └── element-icons.732389d.ttf │ ├── img │ ├── WechatIMG2.3c6c97f.jpeg │ ├── WechatIMG3.c6f4c2b.jpeg │ └── logo.183dc0d.png │ └── js │ ├── 0.89a4b3aac2a0611c4f8d.js │ ├── 0.89a4b3aac2a0611c4f8d.js.map │ ├── app.89cc9997bc3043c38207.js │ ├── app.89cc9997bc3043c38207.js.map │ ├── manifest.1034f33bfde735049804.js │ ├── manifest.1034f33bfde735049804.js.map │ ├── vendor.30ce11a4196d8d1025d0.js │ └── vendor.30ce11a4196d8d1025d0.js.map ├── images ├── .DS_Store ├── 1.png ├── 2.png ├── 3.png ├── 4.png └── null ├── index.html ├── package-lock.json ├── package.json ├── src ├── .DS_Store ├── App.vue ├── components │ ├── No.vue │ ├── headTop.vue │ ├── home.vue │ ├── login.vue │ ├── navBar.vue │ └── zhuce.vue ├── main.js ├── page │ ├── callme.vue │ ├── deptList.vue │ ├── first.vue │ ├── materialD.vue │ ├── materialInfo.vue │ ├── materialNum.vue │ ├── needPlan.vue │ ├── needPlanp.vue │ ├── peopleTable.vue │ ├── pruchase.vue │ ├── someCharts.vue │ ├── userList.vue │ └── webMap.vue ├── router │ └── index.js ├── store │ └── store.js └── vendor │ ├── .DS_Store │ ├── Blob.js │ └── Export2Excel.js └── static └── .gitkeep /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### VUE管理系统 2 | 3 | --- 4 | 5 | 此项目是vue+element-ui 快速开发的物资管理系统,后台用的java springBoot 所有数据都是从服务器实时获取的数据,具有登陆,注册,对数据进行管理,打印数据等功能 6 | 7 | 8 | 9 | ### 说明 10 | 11 | --- 12 | 13 | 如果对您对此项目有兴趣,可以点 "Star" 支持一下 谢谢! ^_^ 14 | 15 | 自己做了差不多一周,有一些功能还没有实现,大部分功能可用,有实际应用价值,后续会慢慢补上。 16 | 17 | 如果有问题可以在项目中找到联系方式。 18 | 19 | 开发环境macOS 10.14.0 java 20 | 21 | 本人是前端小白,所以项目感觉很粗糙,后续我会不断努力完善 22 | 23 | 后台代码:https://github.com/sYuanVery6/MATERIALS 24 | 25 | 26 | 27 | ### 技术栈 28 | 29 | --- 30 | 31 | vue2.5+vuex+vue-router+webpack+ES6+element-ui+echarts 32 | 33 | --- 34 | 35 | 36 | 37 | ### 项目运行 38 | 39 | --- 40 | 41 | 42 | 43 | 拷贝后 44 | 45 | ~~~javascript 46 | npm install 47 | 48 | npm run dev 49 | ~~~ 50 | 51 | ### 注意 52 | 在项目根目录新建postcss.config.js文件,并对postcss进行配置 有的话就不用了 53 | 添加下面代码 就可以正常运行了 54 | 55 | ~~~javascript 56 | module.exports = { 57 | plugins: { 58 | 'autoprefixer': {browsers: 'last 5 version'} 59 | } 60 | } 61 | ~~~ 62 | 63 | 64 | ### 效果演示 65 | 66 | --- 67 | 68 | 69 | [点击这里查看效果](http://www.guojiayu.vip:8080/materils_v2.0/#/) 70 | 71 | 72 | 73 | 默认账号 0001 74 | 75 | 密码 123456 76 | 77 | 78 | 79 | ### 实现功能列表 80 | 81 | --- 82 | 83 | * 系统管理 84 | - 人员管理 85 | - 部门管理 86 | * 物资管理 87 | - 物资编码申请 88 | - 物资编码审批 89 | - 打印物资数据 90 | * 采购管理 91 | - 需求计划申请 92 | - 需求计划审批 93 | - 请购 94 | * 地图 95 | 96 | 97 | 98 | ### 部分页面截图 99 | 100 | --- 101 | ![image](https://github.com/guojiayu01/Material/blob/master/images/1.png) 102 | 103 | ![image](https://github.com/guojiayu01/Material/blob/master/images/2.png) 104 | 105 | ![image](https://github.com/guojiayu01/Material/blob/master/images/3.png) 106 | 107 | ![image](https://github.com/guojiayu01/Material/blob/master/images/4.png) 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | ### 谢谢观看 118 | 119 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/build/logo.png -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function (_path) { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | 15 | exports.cssLoaders = function (options) { 16 | options = options || {} 17 | 18 | const cssLoader = { 19 | loader: 'css-loader', 20 | options: { 21 | sourceMap: options.sourceMap 22 | } 23 | } 24 | 25 | const postcssLoader = { 26 | loader: 'postcss-loader', 27 | options: { 28 | sourceMap: options.sourceMap 29 | } 30 | } 31 | 32 | // generate loader string to be used with extract text plugin 33 | function generateLoaders (loader, loaderOptions) { 34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 35 | 36 | if (loader) { 37 | loaders.push({ 38 | loader: loader + '-loader', 39 | options: Object.assign({}, loaderOptions, { 40 | sourceMap: options.sourceMap 41 | }) 42 | }) 43 | } 44 | 45 | // Extract CSS when that option is specified 46 | // (which is the case during production build) 47 | if (options.extract) { 48 | return ExtractTextPlugin.extract({ 49 | use: loaders, 50 | fallback: 'vue-style-loader', 51 | publicPath: '../../' //服务器上没有这个就会少静态样式 52 | }) 53 | } else { 54 | return ['vue-style-loader'].concat(loaders) 55 | } 56 | } 57 | 58 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 59 | return { 60 | css: generateLoaders(), 61 | postcss: generateLoaders(), 62 | less: generateLoaders('less'), 63 | sass: generateLoaders('sass', { indentedSyntax: true }), 64 | scss: generateLoaders('sass'), 65 | stylus: generateLoaders('stylus'), 66 | styl: generateLoaders('stylus') 67 | } 68 | } 69 | 70 | // Generate loaders for standalone style files (outside of .vue) 71 | exports.styleLoaders = function (options) { 72 | const output = [] 73 | const loaders = exports.cssLoaders(options) 74 | 75 | for (const extension in loaders) { 76 | const loader = loaders[extension] 77 | output.push({ 78 | test: new RegExp('\\.' + extension + '$'), 79 | use: loader 80 | }) 81 | } 82 | 83 | return output 84 | } 85 | 86 | exports.createNotifierCallback = () => { 87 | const notifier = require('node-notifier') 88 | 89 | return (severity, errors) => { 90 | if (severity !== 'error') return 91 | 92 | const error = errors[0] 93 | const filename = error.file && error.file.split('!').pop() 94 | 95 | notifier.notify({ 96 | title: packageConfig.name, 97 | message: severity + ': ' + error.name, 98 | subtitle: filename || '', 99 | icon: path.join(__dirname, 'logo.png') 100 | }) 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | 12 | 13 | module.exports = { 14 | context: path.resolve(__dirname, '../'), 15 | entry: { 16 | app: './src/main.js' 17 | }, 18 | output: { 19 | path: config.build.assetsRoot, 20 | filename: '[name].js', 21 | publicPath: process.env.NODE_ENV === 'production' 22 | ? config.build.assetsPublicPath 23 | : config.dev.assetsPublicPath 24 | }, 25 | resolve: { 26 | extensions: ['.js', '.vue', '.json'], 27 | alias: { 28 | 'vue$': 'vue/dist/vue.esm.js', 29 | '@': resolve('src'), 30 | } 31 | }, 32 | module: { 33 | rules: [ 34 | { 35 | test: /\.vue$/, 36 | loader: 'vue-loader', 37 | options: vueLoaderConfig 38 | }, 39 | { 40 | test: /\.js$/, 41 | loader: 'babel-loader', 42 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 43 | }, 44 | { 45 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 46 | loader: 'url-loader', 47 | options: { 48 | limit: 10000, 49 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 50 | } 51 | }, 52 | { 53 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 54 | loader: 'url-loader', 55 | options: { 56 | limit: 10000, 57 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 58 | } 59 | }, 60 | { 61 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 62 | loader: 'url-loader', 63 | options: { 64 | limit: 10000, 65 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 66 | } 67 | } 68 | ] 69 | }, 70 | node: { 71 | // prevent webpack from injecting useless setImmediate polyfill because Vue 72 | // source contains it (although only uses it if it's native). 73 | setImmediate: false, 74 | // prevent webpack from injecting mocks to Node native modules 75 | // that does not make sense for the client 76 | dgram: 'empty', 77 | fs: 'empty', 78 | net: 'empty', 79 | tls: 'empty', 80 | child_process: 'empty' 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const path = require('path') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 11 | const portfinder = require('portfinder') 12 | 13 | const HOST = process.env.HOST 14 | const PORT = process.env.PORT && Number(process.env.PORT) 15 | 16 | const devWebpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: config.dev.devtool, 22 | 23 | // these devServer options should be customized in /config/index.js 24 | devServer: { 25 | clientLogLevel: 'warning', 26 | historyApiFallback: { 27 | rewrites: [ 28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 29 | ], 30 | }, 31 | hot: true, 32 | contentBase: false, // since we use CopyWebpackPlugin. 33 | compress: true, 34 | host: HOST || config.dev.host, 35 | port: PORT || config.dev.port, 36 | open: config.dev.autoOpenBrowser, 37 | overlay: config.dev.errorOverlay 38 | ? { warnings: false, errors: true } 39 | : false, 40 | publicPath: config.dev.assetsPublicPath, 41 | proxy: config.dev.proxyTable, 42 | quiet: true, // necessary for FriendlyErrorsPlugin 43 | watchOptions: { 44 | poll: config.dev.poll, 45 | } 46 | }, 47 | plugins: [ 48 | new webpack.DefinePlugin({ 49 | 'process.env': require('../config/dev.env') 50 | }), 51 | new webpack.HotModuleReplacementPlugin(), 52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 53 | new webpack.NoEmitOnErrorsPlugin(), 54 | // https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: 'index.html', 57 | template: 'index.html', 58 | inject: true 59 | }), 60 | // copy custom static assets 61 | new CopyWebpackPlugin([ 62 | { 63 | from: path.resolve(__dirname, '../static'), 64 | to: config.dev.assetsSubDirectory, 65 | ignore: ['.*'] 66 | } 67 | ]) 68 | ] 69 | }) 70 | 71 | module.exports = new Promise((resolve, reject) => { 72 | portfinder.basePort = process.env.PORT || config.dev.port 73 | portfinder.getPort((err, port) => { 74 | if (err) { 75 | reject(err) 76 | } else { 77 | // publish the new Port, necessary for e2e tests 78 | process.env.PORT = port 79 | // add port to devServer config 80 | devWebpackConfig.devServer.port = port 81 | 82 | // Add FriendlyErrorsPlugin 83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 84 | compilationSuccessInfo: { 85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 86 | }, 87 | onErrors: config.dev.notifyOnErrors 88 | ? utils.createNotifierCallback() 89 | : undefined 90 | })) 91 | 92 | resolve(devWebpackConfig) 93 | } 94 | }) 95 | }) 96 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 13 | 14 | const env = require('../config/prod.env') 15 | 16 | const webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true, 21 | usePostCSS: true 22 | }) 23 | }, 24 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 25 | output: { 26 | path: config.build.assetsRoot, 27 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 29 | }, 30 | plugins: [ 31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 32 | new webpack.DefinePlugin({ 33 | 'process.env': env 34 | }), 35 | new UglifyJsPlugin({ 36 | uglifyOptions: { 37 | compress: { 38 | warnings: false 39 | } 40 | }, 41 | sourceMap: config.build.productionSourceMap, 42 | parallel: true 43 | }), 44 | // extract css into its own file 45 | new ExtractTextPlugin({ 46 | filename: utils.assetsPath('css/[name].[contenthash].css'), 47 | // Setting the following option to `false` will not extract CSS from codesplit chunks. 48 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. 49 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 50 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 51 | allChunks: true, 52 | }), 53 | // Compress extracted CSS. We are using this plugin so that possible 54 | // duplicated CSS from different components can be deduped. 55 | new OptimizeCSSPlugin({ 56 | cssProcessorOptions: config.build.productionSourceMap 57 | ? { safe: true, map: { inline: false } } 58 | : { safe: true } 59 | }), 60 | // generate dist index.html with correct asset hash for caching. 61 | // you can customize output by editing /index.html 62 | // see https://github.com/ampedandwired/html-webpack-plugin 63 | new HtmlWebpackPlugin({ 64 | filename: config.build.index, 65 | template: 'index.html', 66 | inject: true, 67 | minify: { 68 | removeComments: true, 69 | collapseWhitespace: true, 70 | removeAttributeQuotes: true 71 | // more options: 72 | // https://github.com/kangax/html-minifier#options-quick-reference 73 | }, 74 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 75 | chunksSortMode: 'dependency' 76 | }), 77 | // keep module.id stable when vendor modules does not change 78 | new webpack.HashedModuleIdsPlugin(), 79 | // enable scope hoisting 80 | new webpack.optimize.ModuleConcatenationPlugin(), 81 | // split vendor js into its own file 82 | new webpack.optimize.CommonsChunkPlugin({ 83 | name: 'vendor', 84 | minChunks (module) { 85 | // any required modules inside node_modules are extracted to vendor 86 | return ( 87 | module.resource && 88 | /\.js$/.test(module.resource) && 89 | module.resource.indexOf( 90 | path.join(__dirname, '../node_modules') 91 | ) === 0 92 | ) 93 | } 94 | }), 95 | // extract webpack runtime and module manifest to its own file in order to 96 | // prevent vendor hash from being updated whenever app bundle is updated 97 | new webpack.optimize.CommonsChunkPlugin({ 98 | name: 'manifest', 99 | minChunks: Infinity 100 | }), 101 | // This instance extracts shared chunks from code splitted chunks and bundles them 102 | // in a separate chunk, similar to the vendor chunk 103 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk 104 | new webpack.optimize.CommonsChunkPlugin({ 105 | name: 'app', 106 | async: 'vendor-async', 107 | children: true, 108 | minChunks: 3 109 | }), 110 | 111 | // copy custom static assets 112 | new CopyWebpackPlugin([ 113 | { 114 | from: path.resolve(__dirname, '../static'), 115 | to: config.build.assetsSubDirectory, 116 | ignore: ['.*'] 117 | } 118 | ]) 119 | ] 120 | }) 121 | 122 | if (config.build.productionGzip) { 123 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 124 | 125 | webpackConfig.plugins.push( 126 | new CompressionWebpackPlugin({ 127 | asset: '[path].gz[query]', 128 | algorithm: 'gzip', 129 | test: new RegExp( 130 | '\\.(' + 131 | config.build.productionGzipExtensions.join('|') + 132 | ')$' 133 | ), 134 | threshold: 10240, 135 | minRatio: 0.8 136 | }) 137 | ) 138 | } 139 | 140 | if (config.build.bundleAnalyzerReport) { 141 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 142 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 143 | } 144 | 145 | module.exports = webpackConfig 146 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.3.1 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '/', 13 | proxyTable: { 14 | '/api': { 15 | 16 | target: 'http://127.0.0.1:8080/materils_v2.0', 17 | changeOrigin: true,//是否允许跨越 18 | pathRewrite: { 19 | '^/api': '/api',//重写, 20 | } 21 | } 22 | }, 23 | 24 | // Various Dev Server settings 25 | host: 'localhost', // can be overwritten by process.env.HOST 26 | port: 8081, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 27 | autoOpenBrowser: true, 28 | errorOverlay: true, 29 | notifyOnErrors: true, 30 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 31 | 32 | 33 | /** 34 | * Source Maps 35 | */ 36 | 37 | // https://webpack.js.org/configuration/devtool/#development 38 | devtool: 'cheap-module-eval-source-map', 39 | 40 | // If you have problems debugging vue-files in devtools, 41 | // set this to false - it *may* help 42 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 43 | cacheBusting: true, 44 | 45 | cssSourceMap: true 46 | }, 47 | 48 | build: { 49 | // Template for index.html 50 | index: path.resolve(__dirname, '../dist/index.html'), 51 | 52 | // Paths 53 | assetsRoot: path.resolve(__dirname, '../dist'), 54 | assetsSubDirectory: 'static', 55 | assetsPublicPath: './', 56 | 57 | /** 58 | * Source Maps 59 | */ 60 | 61 | productionSourceMap: true, 62 | // https://webpack.js.org/configuration/devtool/#production 63 | devtool: '#source-map', 64 | 65 | // Gzip off by default as many popular static hosts such as 66 | // Surge or Netlify already gzip all static assets for you. 67 | // Before setting to `true`, make sure to: 68 | // npm install --save-dev compression-webpack-plugin 69 | productionGzip: false, 70 | productionGzipExtensions: ['js', 'css'], 71 | 72 | // Run the build command with an extra argument to 73 | // View the bundle analyzer report after build finishes: 74 | // `npm run build --report` 75 | // Set to `true` or `false` to always turn it on or off 76 | bundleAnalyzerReport: process.env.npm_config_report 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /dist/index.html: -------------------------------------------------------------------------------- 1 | 物资管理系统
-------------------------------------------------------------------------------- /dist/static/fonts/element-icons.535877f.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/dist/static/fonts/element-icons.535877f.woff -------------------------------------------------------------------------------- /dist/static/fonts/element-icons.732389d.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/dist/static/fonts/element-icons.732389d.ttf -------------------------------------------------------------------------------- /dist/static/img/WechatIMG2.3c6c97f.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/dist/static/img/WechatIMG2.3c6c97f.jpeg -------------------------------------------------------------------------------- /dist/static/img/WechatIMG3.c6f4c2b.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/dist/static/img/WechatIMG3.c6f4c2b.jpeg -------------------------------------------------------------------------------- /dist/static/img/logo.183dc0d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/dist/static/img/logo.183dc0d.png -------------------------------------------------------------------------------- /dist/static/js/manifest.1034f33bfde735049804.js: -------------------------------------------------------------------------------- 1 | !function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,a,c){for(var i,u,f,s=0,l=[];s 2 | 3 | 4 | 5 | 6 | 物资管理系统 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "work", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "guojiayu <2434957426@qq.com>", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "build": "node build/build.js" 11 | }, 12 | "dependencies": { 13 | "axios": "^0.19.0", 14 | "echarts": "^4.2.1", 15 | "element-ui": "^2.11.1", 16 | "file-saver": "^2.0.2", 17 | "normalize.css": "^8.0.1", 18 | "vue": "^2.5.2", 19 | "vue-baidu-map": "^0.21.22", 20 | "vue-router": "^3.0.1", 21 | "vuex": "^3.1.1", 22 | "xlsx": "^0.15.1" 23 | }, 24 | "devDependencies": { 25 | "autoprefixer": "^7.1.2", 26 | "babel-core": "^6.22.1", 27 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 28 | "babel-loader": "^7.1.1", 29 | "babel-plugin-syntax-jsx": "^6.18.0", 30 | "babel-plugin-transform-runtime": "^6.22.0", 31 | "babel-plugin-transform-vue-jsx": "^3.5.0", 32 | "babel-preset-env": "^1.3.2", 33 | "babel-preset-stage-2": "^6.22.0", 34 | "chalk": "^2.0.1", 35 | "copy-webpack-plugin": "^4.0.1", 36 | "css-loader": "^0.28.0", 37 | "extract-text-webpack-plugin": "^3.0.0", 38 | "file-loader": "^1.1.4", 39 | "friendly-errors-webpack-plugin": "^1.6.1", 40 | "html-webpack-plugin": "^2.30.1", 41 | "node-notifier": "^5.1.2", 42 | "optimize-css-assets-webpack-plugin": "^3.2.0", 43 | "ora": "^1.2.0", 44 | "portfinder": "^1.0.13", 45 | "postcss-import": "^11.0.0", 46 | "postcss-loader": "^2.0.8", 47 | "postcss-url": "^7.2.1", 48 | "rimraf": "^2.6.0", 49 | "script-loader": "^0.7.2", 50 | "semver": "^5.3.0", 51 | "shelljs": "^0.7.6", 52 | "uglifyjs-webpack-plugin": "^1.1.1", 53 | "url-loader": "^0.5.8", 54 | "vue-loader": "^13.3.0", 55 | "vue-style-loader": "^3.0.1", 56 | "vue-template-compiler": "^2.5.2", 57 | "webpack": "^3.6.0", 58 | "webpack-bundle-analyzer": "^2.9.0", 59 | "webpack-dev-server": "^2.9.1", 60 | "webpack-merge": "^4.1.0" 61 | }, 62 | "engines": { 63 | "node": ">= 6.0.0", 64 | "npm": ">= 3.0.0" 65 | }, 66 | "browserslist": [ 67 | "> 1%", 68 | "last 2 versions", 69 | "not ie <= 8" 70 | ] 71 | } 72 | -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/src/.DS_Store -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 37 | 38 | 50 | -------------------------------------------------------------------------------- /src/components/No.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /src/components/headTop.vue: -------------------------------------------------------------------------------- 1 | 76 | 77 | 138 | 139 | -------------------------------------------------------------------------------- /src/components/home.vue: -------------------------------------------------------------------------------- 1 | 148 | 149 | 189 | 190 | 231 | -------------------------------------------------------------------------------- /src/components/login.vue: -------------------------------------------------------------------------------- 1 | 59 | 60 | 124 | 125 | 320 | -------------------------------------------------------------------------------- /src/components/navBar.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 38 | 39 | -------------------------------------------------------------------------------- /src/components/zhuce.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 85 | 86 | 117 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import ElementUI from 'element-ui' 5 | import 'element-ui/lib/theme-chalk/index.css' 6 | import App from './App' 7 | import router from './router' 8 | import echarts from 'echarts' 9 | import bmap from 'vue-baidu-map' 10 | import './assets/normalize.css' 11 | import store from './store/store' 12 | 13 | 14 | 15 | 16 | var axios = require('axios') 17 | 18 | axios.defaults.baseURL = 'http://127.0.0.1:8080/materils_v2.0' 19 | 20 | Vue.prototype.$axios = axios 21 | Vue.prototype.$echarts = echarts 22 | Vue.config.productionTip = false 23 | 24 | 25 | Vue.use(bmap,{ 26 | ak : 'ybm7GO5cyZOsVS80dLuzBCKi306RfUrz' 27 | }) 28 | Vue.use(ElementUI) 29 | Vue.config.productionTip = false 30 | 31 | /* eslint-disable no-new */ 32 | new Vue({ 33 | el: '#app', 34 | router, 35 | store, 36 | components: { App }, 37 | template: '' 38 | }) 39 | 40 | 41 | 42 | // router.beforeEach((to, from, next) => { 43 | // console.log(to); 44 | // console.log(from); 45 | // if (to.meta.requireAuth) { // 判断该路由是否需要登录权限 46 | // if(JSON.parse(localStorage.getItem('islogin'))){ //判断本地是否存在access_token 47 | // next(); 48 | // }else { 49 | // next({ 50 | // path:'/home/first' 51 | // }) 52 | // } 53 | // } 54 | // else { 55 | // next(); 56 | 57 | // } 58 | // /*如果本地 存在 token 则 不允许直接跳转到 登录页面*/ 59 | // if(to.fullPath == "/login"){ 60 | // if(JSON.parse(localStorage.getItem('islogin'))){ 61 | // next({ 62 | // path:from.fullPath 63 | // }); 64 | // }else { 65 | // next(); 66 | // } 67 | // } 68 | // }); 69 | 70 | 71 | router.beforeEach((to, from, next) => { 72 | if (to.meta.requireAuth) { 73 | if (JSON.parse(localStorage.getItem("islogin"))) { 74 | next(); 75 | } else { 76 | next({ 77 | path: "/"//指向为你的登录界面 78 | }); 79 | } 80 | } else { 81 | next(); 82 | } 83 | 84 | if (to.fullPath === "/") { 85 | if (JSON.parse(localStorage.getItem("islogin"))) { 86 | next({ 87 | path: from.fullPath 88 | }); 89 | } else { 90 | next(); 91 | } 92 | } 93 | }); 94 | -------------------------------------------------------------------------------- /src/page/callme.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /src/page/deptList.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 164 | 165 | -------------------------------------------------------------------------------- /src/page/first.vue: -------------------------------------------------------------------------------- 1 | 94 | 95 | 317 | 318 | -------------------------------------------------------------------------------- /src/page/materialD.vue: -------------------------------------------------------------------------------- 1 | 47 | 48 | 129 | 130 | -------------------------------------------------------------------------------- /src/page/materialInfo.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 187 | 188 | -------------------------------------------------------------------------------- /src/page/materialNum.vue: -------------------------------------------------------------------------------- 1 | 144 | 145 | 365 | 366 | -------------------------------------------------------------------------------- /src/page/needPlan.vue: -------------------------------------------------------------------------------- 1 | 140 | 141 | 341 | 342 | -------------------------------------------------------------------------------- /src/page/needPlanp.vue: -------------------------------------------------------------------------------- 1 | 74 | 75 | 199 | 200 | -------------------------------------------------------------------------------- /src/page/peopleTable.vue: -------------------------------------------------------------------------------- 1 | 168 | 169 | 398 | 399 | -------------------------------------------------------------------------------- /src/page/pruchase.vue: -------------------------------------------------------------------------------- 1 | 73 | 74 | 203 | 204 | -------------------------------------------------------------------------------- /src/page/someCharts.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 110 | 111 | -------------------------------------------------------------------------------- /src/page/userList.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 27 | 28 | -------------------------------------------------------------------------------- /src/page/webMap.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 31 | 32 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import home from '@/components/home.vue' 4 | import login from '@/components/login.vue' 5 | import zhuce from '@/components/zhuce.vue' 6 | import headTop from '@/components/headTop.vue' 7 | import someCharts from '@/page/someCharts.vue' 8 | import webMap from '@/page/webMap.vue' 9 | import userList from '@/page/userList.vue' 10 | import materialInfo from '@/page/materialInfo.vue' 11 | import peopleTable from '@/page/peopleTable.vue' 12 | import navBar from '@/components/navBar.vue' 13 | import deptList from '@/page/deptList' 14 | import materialNum from '@/page/materialNum' 15 | import first from '@/page/first' 16 | import callme from '@/page/callme' 17 | import materialD from '@/page/materialD' 18 | import needPlan from '@/page/needPlan' 19 | import needPlanp from '@/page/needPlanp' 20 | import pruchase from '@/page/pruchase' 21 | import No from '@/components/No' 22 | 23 | 24 | 25 | Vue.use(Router) 26 | 27 | export default new Router({ 28 | 29 | routes: [ 30 | // { 31 | // path: '/', // 默认进入路由 32 | // redirect: '/home/first' //重定向 33 | // }, 34 | { 35 | path: '/', 36 | name: 'login', 37 | component: login 38 | }, 39 | { 40 | path: '/home', 41 | name: 'home', 42 | component: home, 43 | meta: { title: '首页', requireAuth:true }, 44 | children:[ 45 | 46 | { 47 | path: '/home/first', 48 | name: 'first', 49 | component : first, 50 | meta: { requireAuth:true }, 51 | }, 52 | { 53 | path: '/home/webMap', 54 | name: 'webMap', 55 | component : webMap, 56 | meta: { title: '地图' , requireAuth:true} 57 | }, 58 | { 59 | path: '/home/userList', 60 | name: 'userList', 61 | component : userList, 62 | // meta:{ title: '人员管理' } 63 | }, 64 | { 65 | path: '/home/someCharts', 66 | name: 'someCharts', 67 | component : someCharts, 68 | meta: { title: '物资类别' , requireAuth:true}, 69 | 70 | }, 71 | { 72 | path: '/home/materialInfo', 73 | name: 'materialInfo', 74 | component : materialInfo, 75 | meta: { title: '物资编码审批' ,requireAuth:true}, 76 | 77 | }, 78 | { 79 | path: '/home/materialD', 80 | name: 'materialD', 81 | component : materialD, 82 | meta: { title: '打印物资数据' ,requireAuth:true}, 83 | }, 84 | { 85 | path: '/home/needPlan', 86 | name: 'needPlan', 87 | component : needPlan, 88 | meta: { title: '需求计划申请' ,requireAuth:true}, 89 | }, 90 | { 91 | path: '/home/pruchase', 92 | name: 'pruchase', 93 | component : pruchase, 94 | meta: { title: '请购' ,requireAuth:true}, 95 | }, 96 | { 97 | path: '/home/needPlanp', 98 | name: 'needPlanp', 99 | component : needPlanp, 100 | meta: { title: '需求计划审批' ,requireAuth:true}, 101 | }, 102 | { 103 | path: '/home/peopleTable', 104 | name: 'peopleTable', 105 | component : peopleTable, 106 | meta:{ title: '人员管理' ,requireAuth:true } 107 | }, 108 | { 109 | path: '/home/deptList', 110 | name: 'deptList', 111 | component : deptList, 112 | meta:{ title: '部门管理' ,requireAuth:true} 113 | }, 114 | { 115 | path: '/home/materialNum', 116 | name: 'materialNum', 117 | component : materialNum, 118 | meta:{ title: '物资编码申请' ,requireAuth:true} 119 | }, 120 | { 121 | path: '/home/callme', 122 | name: 'callme', 123 | component : callme, 124 | meta:{ title: '请联系我' ,requireAuth:true} 125 | }, 126 | { 127 | path: '/home/No', 128 | name: 'No', 129 | component : No, 130 | meta:{ title: '404' } 131 | } 132 | 133 | 134 | 135 | ] 136 | }, 137 | { 138 | path: '/zhuce', 139 | name: 'zhuce', 140 | component: zhuce, 141 | meta:{ requireAuth:true} 142 | }, 143 | { 144 | path: '/headTop', 145 | name: 'headTop', 146 | component : headTop, 147 | meta:{ requireAuth:true} 148 | }, 149 | { 150 | path: '/navBar', 151 | name: 'navBar', 152 | component : navBar, 153 | meta:{ requireAuth:true} 154 | }, 155 | 156 | 157 | ] 158 | }) 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /src/store/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | const actions = {} 7 | const mutations = { 8 | handleUserName: (state, user_name) => { 9 | state.user_name = user_name 10 | localStorage.setItem('user_name', user_name) 11 | console.log(user_name) 12 | }, 13 | login:(state,n) => { 14 | //传入登录状态islogin 15 | let islogin = JSON.parse(n); 16 | localStorage.setItem('islogin',JSON.stringify(islogin)); 17 | console.log(islogin); 18 | state.islogin = islogin; 19 | } 20 | 21 | 22 | } 23 | 24 | const state = { 25 | user_name: '' || localStorage.getItem('user_name'), 26 | islogin:'' 27 | } 28 | const getters = { 29 | userName: (state) => state.user_name 30 | } 31 | 32 | const store = new Vuex.Store({ 33 | actions, 34 | mutations, 35 | state, 36 | getters 37 | }) 38 | export default store 39 | -------------------------------------------------------------------------------- /src/vendor/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/src/vendor/.DS_Store -------------------------------------------------------------------------------- /src/vendor/Blob.js: -------------------------------------------------------------------------------- 1 | /* Blob.js 2 | * A Blob, File, FileReader & URL implementation. 3 | * 2019-04-19 4 | * 5 | * By Eli Grey, http://eligrey.com 6 | * By Jimmy Wärting, https://github.com/jimmywarting 7 | * License: MIT 8 | * See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md 9 | */ 10 | 11 | ;(function () { 12 | var global = typeof window === 'object' 13 | ? window : typeof self === 'object' 14 | ? self : this 15 | 16 | var BlobBuilder = global.BlobBuilder 17 | || global.WebKitBlobBuilder 18 | || global.MSBlobBuilder 19 | || global.MozBlobBuilder 20 | 21 | global.URL = global.URL || global.webkitURL || function (href, a) { 22 | a = document.createElement('a') 23 | a.href = href 24 | return a 25 | } 26 | 27 | var origBlob = global.Blob 28 | var createObjectURL = URL.createObjectURL 29 | var revokeObjectURL = URL.revokeObjectURL 30 | var strTag = global.Symbol && global.Symbol.toStringTag 31 | var blobSupported = false 32 | var blobSupportsArrayBufferView = false 33 | var arrayBufferSupported = !!global.ArrayBuffer 34 | var blobBuilderSupported = BlobBuilder 35 | && BlobBuilder.prototype.append 36 | && BlobBuilder.prototype.getBlob 37 | 38 | try { 39 | // Check if Blob constructor is supported 40 | blobSupported = new Blob(['ä']).size === 2 41 | 42 | // Check if Blob constructor supports ArrayBufferViews 43 | // Fails in Safari 6, so we need to map to ArrayBuffers there. 44 | blobSupportsArrayBufferView = new Blob([new Uint8Array([1, 2])]).size === 2 45 | } catch (e) {} 46 | 47 | /** 48 | * Helper function that maps ArrayBufferViews to ArrayBuffers 49 | * Used by BlobBuilder constructor and old browsers that didn't 50 | * support it in the Blob constructor. 51 | */ 52 | function mapArrayBufferViews (ary) { 53 | return ary.map(function (chunk) { 54 | if (chunk.buffer instanceof ArrayBuffer) { 55 | var buf = chunk.buffer 56 | 57 | // if this is a subarray, make a copy so we only 58 | // include the subarray region from the underlying buffer 59 | if (chunk.byteLength !== buf.byteLength) { 60 | var copy = new Uint8Array(chunk.byteLength) 61 | copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)) 62 | buf = copy.buffer 63 | } 64 | 65 | return buf 66 | } 67 | 68 | return chunk 69 | }) 70 | } 71 | 72 | function BlobBuilderConstructor (ary, options) { 73 | options = options || {} 74 | 75 | var bb = new BlobBuilder() 76 | mapArrayBufferViews(ary).forEach(function (part) { 77 | bb.append(part) 78 | }) 79 | 80 | return options.type ? bb.getBlob(options.type) : bb.getBlob() 81 | } 82 | 83 | function BlobConstructor (ary, options) { 84 | return new origBlob(mapArrayBufferViews(ary), options || {}) 85 | } 86 | 87 | if (global.Blob) { 88 | BlobBuilderConstructor.prototype = Blob.prototype 89 | BlobConstructor.prototype = Blob.prototype 90 | } 91 | 92 | 93 | 94 | /********************************************************/ 95 | /* String Encoder fallback */ 96 | /********************************************************/ 97 | function stringEncode (string) { 98 | var pos = 0 99 | var len = string.length 100 | var out = [] 101 | var Arr = global.Uint8Array || Array // Use byte array when possible 102 | 103 | var at = 0 // output position 104 | var tlen = Math.max(32, len + (len >> 1) + 7) // 1.5x size 105 | var target = new Arr((tlen >> 3) << 3) // ... but at 8 byte offset 106 | 107 | while (pos < len) { 108 | var value = string.charCodeAt(pos++) 109 | if (value >= 0xd800 && value <= 0xdbff) { 110 | // high surrogate 111 | if (pos < len) { 112 | var extra = string.charCodeAt(pos) 113 | if ((extra & 0xfc00) === 0xdc00) { 114 | ++pos 115 | value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000 116 | } 117 | } 118 | if (value >= 0xd800 && value <= 0xdbff) { 119 | continue // drop lone surrogate 120 | } 121 | } 122 | 123 | // expand the buffer if we couldn't write 4 bytes 124 | if (at + 4 > target.length) { 125 | tlen += 8 // minimum extra 126 | tlen *= (1.0 + (pos / string.length) * 2) // take 2x the remaining 127 | tlen = (tlen >> 3) << 3 // 8 byte offset 128 | 129 | const update = new Uint8Array(tlen) 130 | update.set(target) 131 | target = update 132 | } 133 | 134 | if ((value & 0xffffff80) === 0) { // 1-byte 135 | target[at++] = value // ASCII 136 | continue 137 | } else if ((value & 0xfffff800) === 0) { // 2-byte 138 | target[at++] = ((value >> 6) & 0x1f) | 0xc0 139 | } else if ((value & 0xffff0000) === 0) { // 3-byte 140 | target[at++] = ((value >> 12) & 0x0f) | 0xe0 141 | target[at++] = ((value >> 6) & 0x3f) | 0x80 142 | } else if ((value & 0xffe00000) === 0) { // 4-byte 143 | target[at++] = ((value >> 18) & 0x07) | 0xf0 144 | target[at++] = ((value >> 12) & 0x3f) | 0x80 145 | target[at++] = ((value >> 6) & 0x3f) | 0x80 146 | } else { 147 | // FIXME: do we care 148 | continue 149 | } 150 | 151 | target[at++] = (value & 0x3f) | 0x80 152 | } 153 | 154 | return target.slice(0, at) 155 | } 156 | 157 | /********************************************************/ 158 | /* String Decoder fallback */ 159 | /********************************************************/ 160 | function stringDecode (buf) { 161 | var end = buf.length 162 | var res = [] 163 | 164 | var i = 0 165 | while (i < end) { 166 | var firstByte = buf[i] 167 | var codePoint = null 168 | var bytesPerSequence = (firstByte > 0xEF) ? 4 169 | : (firstByte > 0xDF) ? 3 170 | : (firstByte > 0xBF) ? 2 171 | : 1 172 | 173 | if (i + bytesPerSequence <= end) { 174 | var secondByte, thirdByte, fourthByte, tempCodePoint 175 | 176 | switch (bytesPerSequence) { 177 | case 1: 178 | if (firstByte < 0x80) { 179 | codePoint = firstByte 180 | } 181 | break 182 | case 2: 183 | secondByte = buf[i + 1] 184 | if ((secondByte & 0xC0) === 0x80) { 185 | tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) 186 | if (tempCodePoint > 0x7F) { 187 | codePoint = tempCodePoint 188 | } 189 | } 190 | break 191 | case 3: 192 | secondByte = buf[i + 1] 193 | thirdByte = buf[i + 2] 194 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { 195 | tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) 196 | if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { 197 | codePoint = tempCodePoint 198 | } 199 | } 200 | break 201 | case 4: 202 | secondByte = buf[i + 1] 203 | thirdByte = buf[i + 2] 204 | fourthByte = buf[i + 3] 205 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { 206 | tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) 207 | if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { 208 | codePoint = tempCodePoint 209 | } 210 | } 211 | } 212 | } 213 | 214 | if (codePoint === null) { 215 | // we did not generate a valid codePoint so insert a 216 | // replacement char (U+FFFD) and advance only 1 byte 217 | codePoint = 0xFFFD 218 | bytesPerSequence = 1 219 | } else if (codePoint > 0xFFFF) { 220 | // encode to utf16 (surrogate pair dance) 221 | codePoint -= 0x10000 222 | res.push(codePoint >>> 10 & 0x3FF | 0xD800) 223 | codePoint = 0xDC00 | codePoint & 0x3FF 224 | } 225 | 226 | res.push(codePoint) 227 | i += bytesPerSequence 228 | } 229 | 230 | var len = res.length 231 | var str = '' 232 | var i = 0 233 | 234 | while (i < len) { 235 | str += String.fromCharCode.apply(String, res.slice(i, i += 0x1000)) 236 | } 237 | 238 | return str 239 | } 240 | 241 | // string -> buffer 242 | var textEncode = typeof TextEncoder === 'function' 243 | ? TextEncoder.prototype.encode.bind(new TextEncoder()) 244 | : stringEncode 245 | 246 | // buffer -> string 247 | var textDecode = typeof TextDecoder === 'function' 248 | ? TextDecoder.prototype.decode.bind(new TextDecoder()) 249 | : stringDecode 250 | 251 | function FakeBlobBuilder () { 252 | function isDataView (obj) { 253 | return obj && DataView.prototype.isPrototypeOf(obj) 254 | } 255 | function bufferClone (buf) { 256 | var view = new Array(buf.byteLength) 257 | var array = new Uint8Array(buf) 258 | var i = view.length 259 | while (i--) { 260 | view[i] = array[i] 261 | } 262 | return view 263 | } 264 | function array2base64 (input) { 265 | var byteToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' 266 | 267 | var output = [] 268 | 269 | for (var i = 0; i < input.length; i += 3) { 270 | var byte1 = input[i] 271 | var haveByte2 = i + 1 < input.length 272 | var byte2 = haveByte2 ? input[i + 1] : 0 273 | var haveByte3 = i + 2 < input.length 274 | var byte3 = haveByte3 ? input[i + 2] : 0 275 | 276 | var outByte1 = byte1 >> 2 277 | var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4) 278 | var outByte3 = ((byte2 & 0x0F) << 2) | (byte3 >> 6) 279 | var outByte4 = byte3 & 0x3F 280 | 281 | if (!haveByte3) { 282 | outByte4 = 64 283 | 284 | if (!haveByte2) { 285 | outByte3 = 64 286 | } 287 | } 288 | 289 | output.push( 290 | byteToCharMap[outByte1], byteToCharMap[outByte2], 291 | byteToCharMap[outByte3], byteToCharMap[outByte4] 292 | ) 293 | } 294 | 295 | return output.join('') 296 | } 297 | 298 | var create = Object.create || function (a) { 299 | function c () {} 300 | c.prototype = a 301 | return new c() 302 | } 303 | 304 | if (arrayBufferSupported) { 305 | var viewClasses = [ 306 | '[object Int8Array]', 307 | '[object Uint8Array]', 308 | '[object Uint8ClampedArray]', 309 | '[object Int16Array]', 310 | '[object Uint16Array]', 311 | '[object Int32Array]', 312 | '[object Uint32Array]', 313 | '[object Float32Array]', 314 | '[object Float64Array]' 315 | ] 316 | 317 | var isArrayBufferView = ArrayBuffer.isView || function (obj) { 318 | return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 319 | } 320 | } 321 | 322 | function concatTypedarrays (chunks) { 323 | var size = 0 324 | var i = chunks.length 325 | while (i--) { size += chunks[i].length } 326 | var b = new Uint8Array(size) 327 | var offset = 0 328 | for (i = 0, l = chunks.length; i < l; i++) { 329 | var chunk = chunks[i] 330 | b.set(chunk, offset) 331 | offset += chunk.byteLength || chunk.length 332 | } 333 | 334 | return b 335 | } 336 | 337 | /********************************************************/ 338 | /* Blob constructor */ 339 | /********************************************************/ 340 | function Blob (chunks, opts) { 341 | chunks = chunks || [] 342 | opts = opts == null ? {} : opts 343 | for (var i = 0, len = chunks.length; i < len; i++) { 344 | var chunk = chunks[i] 345 | if (chunk instanceof Blob) { 346 | chunks[i] = chunk._buffer 347 | } else if (typeof chunk === 'string') { 348 | chunks[i] = textEncode(chunk) 349 | } else if (arrayBufferSupported && (ArrayBuffer.prototype.isPrototypeOf(chunk) || isArrayBufferView(chunk))) { 350 | chunks[i] = bufferClone(chunk) 351 | } else if (arrayBufferSupported && isDataView(chunk)) { 352 | chunks[i] = bufferClone(chunk.buffer) 353 | } else { 354 | chunks[i] = textEncode(String(chunk)) 355 | } 356 | } 357 | 358 | this._buffer = global.Uint8Array 359 | ? concatTypedarrays(chunks) 360 | : [].concat.apply([], chunks) 361 | this.size = this._buffer.length 362 | 363 | this.type = opts.type || '' 364 | if (/[^\u0020-\u007E]/.test(this.type)) { 365 | this.type = '' 366 | } else { 367 | this.type = this.type.toLowerCase() 368 | } 369 | } 370 | 371 | Blob.prototype.arrayBuffer = function () { 372 | return Promise.resolve(this._buffer) 373 | } 374 | 375 | Blob.prototype.text = function () { 376 | return Promise.resolve(textDecode(this._buffer)) 377 | } 378 | 379 | Blob.prototype.slice = function (start, end, type) { 380 | var slice = this._buffer.slice(start || 0, end || this._buffer.length) 381 | return new Blob([slice], {type: type}) 382 | } 383 | 384 | Blob.prototype.toString = function () { 385 | return '[object Blob]' 386 | } 387 | 388 | /********************************************************/ 389 | /* File constructor */ 390 | /********************************************************/ 391 | function File (chunks, name, opts) { 392 | opts = opts || {} 393 | var a = Blob.call(this, chunks, opts) || this 394 | a.name = name.replace(/\//g, ':') 395 | a.lastModifiedDate = opts.lastModified ? new Date(opts.lastModified) : new Date() 396 | a.lastModified = +a.lastModifiedDate 397 | 398 | return a 399 | } 400 | 401 | File.prototype = create(Blob.prototype) 402 | File.prototype.constructor = File 403 | 404 | if (Object.setPrototypeOf) { 405 | Object.setPrototypeOf(File, Blob) 406 | } else { 407 | try { File.__proto__ = Blob } catch (e) {} 408 | } 409 | 410 | File.prototype.toString = function () { 411 | return '[object File]' 412 | } 413 | 414 | /********************************************************/ 415 | /* FileReader constructor */ 416 | /********************************************************/ 417 | function FileReader () { 418 | if (!(this instanceof FileReader)) { 419 | throw new TypeError("Failed to construct 'FileReader': Please use the 'new' operator, this DOM object constructor cannot be called as a function.") 420 | } 421 | 422 | var delegate = document.createDocumentFragment() 423 | this.addEventListener = delegate.addEventListener 424 | this.dispatchEvent = function (evt) { 425 | var local = this['on' + evt.type] 426 | if (typeof local === 'function') local(evt) 427 | delegate.dispatchEvent(evt) 428 | } 429 | this.removeEventListener = delegate.removeEventListener 430 | } 431 | 432 | function _read (fr, blob, kind) { 433 | if (!(blob instanceof Blob)) { 434 | throw new TypeError("Failed to execute '" + kind + "' on 'FileReader': parameter 1 is not of type 'Blob'.") 435 | } 436 | 437 | fr.result = '' 438 | 439 | setTimeout(function () { 440 | this.readyState = FileReader.LOADING 441 | fr.dispatchEvent(new Event('load')) 442 | fr.dispatchEvent(new Event('loadend')) 443 | }) 444 | } 445 | 446 | FileReader.EMPTY = 0 447 | FileReader.LOADING = 1 448 | FileReader.DONE = 2 449 | FileReader.prototype.error = null 450 | FileReader.prototype.onabort = null 451 | FileReader.prototype.onerror = null 452 | FileReader.prototype.onload = null 453 | FileReader.prototype.onloadend = null 454 | FileReader.prototype.onloadstart = null 455 | FileReader.prototype.onprogress = null 456 | 457 | FileReader.prototype.readAsDataURL = function (blob) { 458 | _read(this, blob, 'readAsDataURL') 459 | this.result = 'data:' + blob.type + ';base64,' + array2base64(blob._buffer) 460 | } 461 | 462 | FileReader.prototype.readAsText = function (blob) { 463 | _read(this, blob, 'readAsText') 464 | this.result = textDecode(blob._buffer) 465 | } 466 | 467 | FileReader.prototype.readAsArrayBuffer = function (blob) { 468 | _read(this, blob, 'readAsText') 469 | // return ArrayBuffer when possible 470 | this.result = (blob._buffer.buffer || blob._buffer).slice() 471 | } 472 | 473 | FileReader.prototype.abort = function () {} 474 | 475 | /********************************************************/ 476 | /* URL */ 477 | /********************************************************/ 478 | URL.createObjectURL = function (blob) { 479 | return blob instanceof Blob 480 | ? 'data:' + blob.type + ';base64,' + array2base64(blob._buffer) 481 | : createObjectURL.call(URL, blob) 482 | } 483 | 484 | URL.revokeObjectURL = function (url) { 485 | revokeObjectURL && revokeObjectURL.call(URL, url) 486 | } 487 | 488 | /********************************************************/ 489 | /* XHR */ 490 | /********************************************************/ 491 | var _send = global.XMLHttpRequest && global.XMLHttpRequest.prototype.send 492 | if (_send) { 493 | XMLHttpRequest.prototype.send = function (data) { 494 | if (data instanceof Blob) { 495 | this.setRequestHeader('Content-Type', data.type) 496 | _send.call(this, textDecode(data._buffer)) 497 | } else { 498 | _send.call(this, data) 499 | } 500 | } 501 | } 502 | 503 | global.FileReader = FileReader 504 | global.File = File 505 | global.Blob = Blob 506 | } 507 | 508 | function fixFileAndXHR () { 509 | var isIE = !!global.ActiveXObject || ( 510 | '-ms-scroll-limit' in document.documentElement.style && 511 | '-ms-ime-align' in document.documentElement.style 512 | ) 513 | 514 | // Monkey patched 515 | // IE don't set Content-Type header on XHR whose body is a typed Blob 516 | // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6047383 517 | var _send = global.XMLHttpRequest && global.XMLHttpRequest.prototype.send 518 | if (isIE && _send) { 519 | XMLHttpRequest.prototype.send = function (data) { 520 | if (data instanceof Blob) { 521 | this.setRequestHeader('Content-Type', data.type) 522 | _send.call(this, data) 523 | } else { 524 | _send.call(this, data) 525 | } 526 | } 527 | } 528 | 529 | try { 530 | new File([], '') 531 | } catch (e) { 532 | try { 533 | var klass = new Function('class File extends Blob {' + 534 | 'constructor(chunks, name, opts) {' + 535 | 'opts = opts || {};' + 536 | 'super(chunks, opts || {});' + 537 | 'this.name = name.replace(/\//g, ":");' + 538 | 'this.lastModifiedDate = opts.lastModified ? new Date(opts.lastModified) : new Date();' + 539 | 'this.lastModified = +this.lastModifiedDate;' + 540 | '}};' + 541 | 'return new File([], ""), File' 542 | )() 543 | global.File = klass 544 | } catch (e) { 545 | var klass = function (b, d, c) { 546 | var blob = new Blob(b, c) 547 | var t = c && void 0 !== c.lastModified ? new Date(c.lastModified) : new Date() 548 | 549 | blob.name = d.replace(/\//g, ':') 550 | blob.lastModifiedDate = t 551 | blob.lastModified = +t 552 | blob.toString = function () { 553 | return '[object File]' 554 | } 555 | 556 | if (strTag) { 557 | blob[strTag] = 'File' 558 | } 559 | 560 | return blob 561 | } 562 | global.File = klass 563 | } 564 | } 565 | } 566 | 567 | if (blobSupported) { 568 | fixFileAndXHR() 569 | global.Blob = blobSupportsArrayBufferView ? global.Blob : BlobConstructor 570 | } else if (blobBuilderSupported) { 571 | fixFileAndXHR() 572 | global.Blob = BlobBuilderConstructor 573 | } else { 574 | FakeBlobBuilder() 575 | } 576 | 577 | if (strTag) { 578 | File.prototype[strTag] = 'File' 579 | Blob.prototype[strTag] = 'Blob' 580 | FileReader.prototype[strTag] = 'FileReader' 581 | } 582 | 583 | var blob = global.Blob.prototype 584 | var stream 585 | 586 | function promisify(obj) { 587 | return new Promise(function(resolve, reject) { 588 | obj.onload = 589 | obj.onerror = function(evt) { 590 | obj.onload = 591 | obj.onerror = null 592 | 593 | evt.type === 'load' 594 | ? resolve(obj.result || obj) 595 | : reject(new Error('Failed to read the blob/file')) 596 | } 597 | }) 598 | } 599 | 600 | 601 | try { 602 | new ReadableStream({ type: 'bytes' }) 603 | stream = function stream() { 604 | var position = 0 605 | var blob = this 606 | 607 | return new ReadableStream({ 608 | type: 'bytes', 609 | autoAllocateChunkSize: 524288, 610 | 611 | pull: function (controller) { 612 | var v = controller.byobRequest.view 613 | var chunk = blob.slice(position, position + v.byteLength) 614 | return chunk.arrayBuffer() 615 | .then(function (buffer) { 616 | var uint8array = new Uint8Array(buffer) 617 | var bytesRead = uint8array.byteLength 618 | 619 | position += bytesRead 620 | v.set(uint8array) 621 | controller.byobRequest.respond(bytesRead) 622 | 623 | if(position >= blob.size) 624 | controller.close() 625 | }) 626 | } 627 | }) 628 | } 629 | } catch (e) { 630 | try { 631 | new ReadableStream({}) 632 | stream = function stream(blob){ 633 | var position = 0 634 | var blob = this 635 | 636 | return new ReadableStream({ 637 | pull: function (controller) { 638 | var chunk = blob.slice(position, position + 524288) 639 | 640 | return chunk.arrayBuffer().then(function (buffer) { 641 | position += buffer.byteLength 642 | var uint8array = new Uint8Array(buffer) 643 | controller.enqueue(uint8array) 644 | 645 | if (position == blob.size) 646 | controller.close() 647 | }) 648 | } 649 | }) 650 | } 651 | } catch (e) { 652 | try { 653 | new Response('').body.getReader().read() 654 | stream = function stream() { 655 | return (new Response(this)).body 656 | } 657 | } catch (e) { 658 | stream = function stream() { 659 | throw new Error('Include https://github.com/MattiasBuelens/web-streams-polyfill') 660 | } 661 | } 662 | } 663 | } 664 | 665 | 666 | if (!blob.arrayBuffer) { 667 | blob.arrayBuffer = function arrayBuffer() { 668 | var fr = new FileReader() 669 | fr.readAsArrayBuffer(this) 670 | return promisify(fr) 671 | } 672 | } 673 | 674 | if (!blob.text) { 675 | blob.text = function text() { 676 | var fr = new FileReader() 677 | fr.readAsText(this) 678 | return promisify(fr) 679 | } 680 | } 681 | 682 | if (!blob.stream) { 683 | blob.stream = stream 684 | } 685 | })() 686 | -------------------------------------------------------------------------------- /src/vendor/Export2Excel.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('script-loader!file-saver'); 3 | require('script-loader!@/vendor/Blob'); 4 | require('script-loader!xlsx/dist/xlsx.core.min'); 5 | function generateArray(table) { 6 | var out = []; 7 | var rows = table.querySelectorAll('tr'); 8 | var ranges = []; 9 | for (var R = 0; R < rows.length; ++R) { 10 | var outRow = []; 11 | var row = rows[R]; 12 | var columns = row.querySelectorAll('td'); 13 | for (var C = 0; C < columns.length; ++C) { 14 | var cell = columns[C]; 15 | var colspan = cell.getAttribute('colspan'); 16 | var rowspan = cell.getAttribute('rowspan'); 17 | var cellValue = cell.innerText; 18 | if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue; 19 | 20 | //Skip ranges 21 | ranges.forEach(function (range) { 22 | if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) { 23 | for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null); 24 | } 25 | }); 26 | 27 | //Handle Row Span 28 | if (rowspan || colspan) { 29 | rowspan = rowspan || 1; 30 | colspan = colspan || 1; 31 | ranges.push({s: {r: R, c: outRow.length}, e: {r: R + rowspan - 1, c: outRow.length + colspan - 1}}); 32 | } 33 | ; 34 | 35 | //Handle Value 36 | outRow.push(cellValue !== "" ? cellValue : null); 37 | 38 | //Handle Colspan 39 | if (colspan) for (var k = 0; k < colspan - 1; ++k) outRow.push(null); 40 | } 41 | out.push(outRow); 42 | } 43 | return [out, ranges]; 44 | }; 45 | 46 | function datenum(v, date1904) { 47 | if (date1904) v += 1462; 48 | var epoch = Date.parse(v); 49 | return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); 50 | } 51 | 52 | function sheet_from_array_of_arrays(data, opts) { 53 | var ws = {}; 54 | var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}}; 55 | for (var R = 0; R != data.length; ++R) { 56 | for (var C = 0; C != data[R].length; ++C) { 57 | if (range.s.r > R) range.s.r = R; 58 | if (range.s.c > C) range.s.c = C; 59 | if (range.e.r < R) range.e.r = R; 60 | if (range.e.c < C) range.e.c = C; 61 | var cell = {v: data[R][C]}; 62 | if (cell.v == null) continue; 63 | var cell_ref = XLSX.utils.encode_cell({c: C, r: R}); 64 | 65 | if (typeof cell.v === 'number') cell.t = 'n'; 66 | else if (typeof cell.v === 'boolean') cell.t = 'b'; 67 | else if (cell.v instanceof Date) { 68 | cell.t = 'n'; 69 | cell.z = XLSX.SSF._table[14]; 70 | cell.v = datenum(cell.v); 71 | } 72 | else cell.t = 's'; 73 | 74 | ws[cell_ref] = cell; 75 | } 76 | } 77 | if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); 78 | return ws; 79 | } 80 | 81 | function Workbook() { 82 | if (!(this instanceof Workbook)) return new Workbook(); 83 | this.SheetNames = []; 84 | this.Sheets = {}; 85 | } 86 | 87 | function s2ab(s) { 88 | var buf = new ArrayBuffer(s.length); 89 | var view = new Uint8Array(buf); 90 | for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; 91 | return buf; 92 | } 93 | 94 | export function export_table_to_excel(id) { 95 | var theTable = document.getElementById(id); 96 | console.log('a') 97 | var oo = generateArray(theTable); 98 | var ranges = oo[1]; 99 | 100 | /* original data */ 101 | var data = oo[0]; 102 | var ws_name = "SheetJS"; 103 | console.log(data); 104 | 105 | var wb = new Workbook(), ws = sheet_from_array_of_arrays(data); 106 | 107 | /* add ranges to worksheet */ 108 | // ws['!cols'] = ['apple', 'banan']; 109 | ws['!merges'] = ranges; 110 | 111 | /* add worksheet to workbook */ 112 | wb.SheetNames.push(ws_name); 113 | wb.Sheets[ws_name] = ws; 114 | 115 | var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'}); 116 | 117 | saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx") 118 | } 119 | 120 | function formatJson(jsonData) { 121 | console.log(jsonData) 122 | } 123 | export function export_json_to_excel(th, jsonData, defaultTitle) { 124 | 125 | /* original data */ 126 | 127 | var data = jsonData; 128 | data.unshift(th); 129 | var ws_name = "SheetJS"; 130 | 131 | var wb = new Workbook(), ws = sheet_from_array_of_arrays(data); 132 | 133 | 134 | /* add worksheet to workbook */ 135 | wb.SheetNames.push(ws_name); 136 | wb.Sheets[ws_name] = ws; 137 | 138 | var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'}); 139 | var title = defaultTitle || '列表' 140 | saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx") 141 | } 142 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guojiayu01/vue-elementui-material/7fd4f8187349d161201f384da2a61344c843c0b2/static/.gitkeep --------------------------------------------------------------------------------