├── .babelrc ├── .editorconfig ├── .gitignore ├── .postcssrc.js ├── LICENSE ├── README.md ├── build ├── build.js ├── check-versions.js ├── dev-client.js ├── dev-server.js ├── 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 ├── index.html ├── libs └── CLodop_Setup_for_Win64NT_2.102.zip ├── package.json ├── src ├── App.vue ├── api │ ├── api.js │ └── index.js ├── assets │ ├── bg.jpg │ ├── bg1.jpg │ ├── echarts.png │ ├── fonts │ │ ├── ionicons.05acfdb.woff │ │ ├── ionicons.24712f6.ttf │ │ └── ionicons.2c2ae06.eot │ ├── form.png │ ├── img │ │ ├── bg.c4fc6ab.jpg │ │ ├── bg.jpg │ │ ├── bg1.jpg │ │ ├── echarts.png │ │ ├── form.png │ │ ├── ionicons.621bd38.svg │ │ ├── iview2.ico │ │ ├── logoin.png │ │ ├── table.png │ │ ├── user.5203b74.jpg │ │ ├── user.jpg │ │ ├── 发包.png │ │ ├── 地块.png │ │ ├── 地块_面积.png │ │ ├── 末页.png │ │ ├── 示意图.png │ │ └── 首页.png │ ├── iview2.ico │ ├── logoin.png │ ├── table.png │ ├── user.jpg │ ├── 发包.png │ ├── 地块.png │ ├── 地块_面积.png │ ├── 末页.png │ ├── 示意图.png │ └── 首页.png ├── common │ └── util.js ├── lib │ ├── CLodopfuncs.js │ └── LodopFuncs.js ├── main.js ├── mock │ ├── index.js │ └── mock.js ├── mockdata │ └── user.js ├── pages │ ├── 404.vue │ ├── Home.vue │ ├── Login.vue │ ├── Main.vue │ ├── charts │ │ └── echarts.vue │ ├── nav1 │ │ ├── Form.vue │ │ ├── Table.vue │ │ └── user.vue │ ├── nav2 │ │ ├── Page4.vue │ │ └── Page5.vue │ ├── nav3 │ │ └── Page6.vue │ └── print │ │ ├── endpage.vue │ │ ├── first.vue │ │ ├── firstpage.vue │ │ ├── fourthpage.vue │ │ ├── index.vue │ │ ├── secondpage.vue │ │ └── thirdpage.vue ├── routes.js └── vuex │ ├── actions.js │ ├── getters.js │ └── store.js └── static ├── .gitkeep ├── 内容.png └── 首页.png /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { "modules": false }], 4 | "stage-2" 5 | ], 6 | "plugins": ["transform-runtime"], 7 | "comments": false, 8 | "env": { 9 | "test": { 10 | "presets": ["env", "stage-2"], 11 | "plugins": [ "istanbul" ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log 5 | yarn-error.log 6 | .vscode/ 7 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserlist" field in package.json 6 | "autoprefixer": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 介绍 2 | vue2-iview2-admin 是基于vue2 + iview2 + axios + webpack2 为主要技术,开发的一个后台管理系统。
3 | ## 截图  4 |  登录界面
5 | ![](https://github.com/hanjiangxueying/vue2-iview2-admin/raw/master/src/assets/logoin.png) 6 |  登录进去之后的表格
7 | ![](https://github.com/hanjiangxueying/vue2-iview2-admin/raw/master/src/assets/table.png) 8 |  登录进去之后的echarts图表展示 9 | ![](https://github.com/hanjiangxueying/vue2-iview2-admin/raw/master/src/assets/echarts.png) 10 | form表单展示 11 | ![](https://github.com/hanjiangxueying/vue2-iview2-admin/raw/master/src/assets/form.png) 12 | ## 安装 13 |  可以有多种方法进行安装。 14 | ### 使用命令行 15 |  github
16 | * Fork 当前库 17 | * 复制一下命令到您的目录
18 | ``` 19 | https://github.com/hanjiangxueying/vue2-iview2-admin.git 20 | ``` 21 | ## 浏览器支持 22 | * IE 9+ 23 | * Firefox(最新) 24 | * Chrome(最新) 25 | * Safari(最新) 26 | ## 运行项目 27 |  进入vue2-iview2-admin 运行一下命令安装依赖包。 28 | ``` 29 | npm install 30 | ``` 31 |  安装完成之后,开始运行项目。 32 | ``` 33 | npm run dev 34 | ``` 35 | ## 编译项目 36 |  运行一下命令: 37 | ``` 38 | npm run build 39 | ``` 40 |  自动会在浏览器中打开 http://localhost:8080/#/login 的地址,如 第一幅图所示:
41 |  用户名: 任意输入(还未做校验)
42 |  密码: 大于6个字符。 -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.NODE_ENV = 'production' 4 | 5 | var ora = require('ora') 6 | var rm = require('rimraf') 7 | var path = require('path') 8 | var chalk = require('chalk') 9 | var webpack = require('webpack') 10 | var config = require('../config') 11 | var webpackConfig = require('./webpack.prod.conf') 12 | 13 | var spinner = ora('building for production...') 14 | spinner.start() 15 | 16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 17 | if (err) throw err 18 | webpack(webpackConfig, function (err, stats) { 19 | spinner.stop() 20 | if (err) throw err 21 | process.stdout.write(stats.toString({ 22 | colors: true, 23 | modules: false, 24 | children: false, 25 | chunks: false, 26 | chunkModules: false 27 | }) + '\n\n') 28 | 29 | console.log(chalk.cyan(' Build complete.\n')) 30 | console.log(chalk.yellow( 31 | ' Tip: built files are meant to be served over an HTTP server.\n' + 32 | ' Opening index.html over file:// won\'t work.\n' 33 | )) 34 | }) 35 | }) 36 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | }, 15 | { 16 | name: 'npm', 17 | currentVersion: exec('npm --version'), 18 | versionRequirement: packageConfig.engines.npm 19 | } 20 | ] 21 | 22 | module.exports = function () { 23 | var warnings = [] 24 | for (var i = 0; i < versionRequirements.length; i++) { 25 | var mod = versionRequirements[i] 26 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 27 | warnings.push(mod.name + ': ' + 28 | chalk.red(mod.currentVersion) + ' should be ' + 29 | chalk.green(mod.versionRequirement) 30 | ) 31 | } 32 | } 33 | 34 | if (warnings.length) { 35 | console.log('') 36 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 37 | console.log() 38 | for (var i = 0; i < warnings.length; i++) { 39 | var warning = warnings[i] 40 | console.log(' ' + warning) 41 | } 42 | console.log() 43 | process.exit(1) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | var config = require('../config') 4 | if (!process.env.NODE_ENV) { 5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 6 | } 7 | 8 | var opn = require('opn') 9 | var path = require('path') 10 | var express = require('express') 11 | var webpack = require('webpack') 12 | var proxyMiddleware = require('http-proxy-middleware') 13 | var webpackConfig = require('./webpack.dev.conf') 14 | 15 | // default port where dev server listens for incoming traffic 16 | var port = process.env.PORT || config.dev.port 17 | // automatically open browser, if not set will be false 18 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 19 | // Define HTTP proxies to your custom API backend 20 | // https://github.com/chimurai/http-proxy-middleware 21 | var proxyTable = config.dev.proxyTable 22 | 23 | var app = express() 24 | var compiler = webpack(webpackConfig) 25 | 26 | var devMiddleware = require('webpack-dev-middleware')(compiler, { 27 | publicPath: webpackConfig.output.publicPath, 28 | quiet: true 29 | }) 30 | 31 | var hotMiddleware = require('webpack-hot-middleware')(compiler, { 32 | log: () => {} 33 | }) 34 | // force page reload when html-webpack-plugin template changes 35 | compiler.plugin('compilation', function (compilation) { 36 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { 37 | hotMiddleware.publish({ action: 'reload' }) 38 | cb() 39 | }) 40 | }) 41 | 42 | // proxy api requests 43 | Object.keys(proxyTable).forEach(function (context) { 44 | var options = proxyTable[context] 45 | if (typeof options === 'string') { 46 | options = { target: options } 47 | } 48 | app.use(proxyMiddleware(options.filter || context, options)) 49 | }) 50 | 51 | // handle fallback for HTML5 history API 52 | app.use(require('connect-history-api-fallback')()) 53 | 54 | // serve webpack bundle output 55 | app.use(devMiddleware) 56 | 57 | // enable hot-reload and state-preserving 58 | // compilation error display 59 | app.use(hotMiddleware) 60 | 61 | // serve pure static assets 62 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 63 | app.use(staticPath, express.static('./static')) 64 | 65 | var uri = 'http://localhost:' + port 66 | 67 | devMiddleware.waitUntilValid(function () { 68 | console.log('> Listening at ' + uri + '\n') 69 | }) 70 | 71 | module.exports = app.listen(port, function (err) { 72 | if (err) { 73 | console.log(err) 74 | return 75 | } 76 | 77 | // when env is testing, don't need open it 78 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 79 | opn(uri) 80 | } 81 | }) 82 | -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var config = require('../config') 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | 5 | exports.assetsPath = function (_path) { 6 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 7 | ? config.build.assetsSubDirectory 8 | : config.dev.assetsSubDirectory 9 | return path.posix.join(assetsSubDirectory, _path) 10 | } 11 | 12 | exports.cssLoaders = function (options) { 13 | options = options || {} 14 | 15 | var cssLoader = { 16 | loader: 'css-loader', 17 | options: { 18 | minimize: process.env.NODE_ENV === 'production', 19 | sourceMap: options.sourceMap 20 | } 21 | } 22 | 23 | // generate loader string to be used with extract text plugin 24 | function generateLoaders (loader, loaderOptions) { 25 | var loaders = [cssLoader] 26 | if (loader) { 27 | loaders.push({ 28 | loader: loader + '-loader', 29 | options: Object.assign({}, loaderOptions, { 30 | sourceMap: options.sourceMap 31 | }) 32 | }) 33 | } 34 | 35 | // Extract CSS when that option is specified 36 | // (which is the case during production build) 37 | if (options.extract) { 38 | return ExtractTextPlugin.extract({ 39 | use: loaders, 40 | fallback: 'vue-style-loader' 41 | }) 42 | } else { 43 | return ['vue-style-loader'].concat(loaders) 44 | } 45 | } 46 | 47 | // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html 48 | return { 49 | css: generateLoaders(), 50 | postcss: generateLoaders(), 51 | less: generateLoaders('less'), 52 | sass: generateLoaders('sass', { indentedSyntax: true }), 53 | scss: generateLoaders('sass'), 54 | stylus: generateLoaders('stylus'), 55 | styl: generateLoaders('stylus') 56 | } 57 | } 58 | 59 | // Generate loaders for standalone style files (outside of .vue) 60 | exports.styleLoaders = function (options) { 61 | var output = [] 62 | var loaders = exports.cssLoaders(options) 63 | for (var extension in loaders) { 64 | var loader = loaders[extension] 65 | output.push({ 66 | test: new RegExp('\\.' + extension + '$'), 67 | use: loader 68 | }) 69 | } 70 | return output 71 | } 72 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | var isProduction = process.env.NODE_ENV === 'production' 4 | 5 | module.exports = { 6 | loaders: utils.cssLoaders({ 7 | sourceMap: isProduction 8 | ? config.build.productionSourceMap 9 | : config.dev.cssSourceMap, 10 | extract: isProduction 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var config = require('../config') 4 | var vueLoaderConfig = require('./vue-loader.conf') 5 | 6 | function resolve(dir) { 7 | return path.join(__dirname, '..', dir) 8 | } 9 | 10 | module.exports = { 11 | entry: { 12 | app: './src/main.js' 13 | }, 14 | output: { 15 | path: config.build.assetsRoot, 16 | filename: '[name].js', 17 | publicPath: process.env.NODE_ENV === 'production' ? 18 | config.build.assetsPublicPath : config.dev.assetsPublicPath 19 | }, 20 | resolve: { 21 | extensions: ['.js', '.vue', '.json'], 22 | alias: { 23 | 'vue$': 'vue/dist/vue.esm.js', 24 | '@': resolve('src') 25 | 26 | } 27 | }, 28 | module: { 29 | rules: [{ 30 | test: /\.vue$/, 31 | loader: 'vue-loader', 32 | options: vueLoaderConfig 33 | }, 34 | { 35 | test: /\.js$/, 36 | loader: 'babel-loader', 37 | include: [resolve('src'), resolve('test')] 38 | }, 39 | { 40 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 41 | loader: 'url-loader', 42 | query: { 43 | limit: 10000, 44 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 45 | } 46 | }, 47 | { 48 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 49 | loader: 'url-loader', 50 | query: { 51 | limit: 10000, 52 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 53 | } 54 | } 55 | ] 56 | } 57 | } -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var webpack = require('webpack') 3 | var config = require('../config') 4 | var merge = require('webpack-merge') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 8 | 9 | // add hot-reload related code to entry chunks 10 | Object.keys(baseWebpackConfig.entry).forEach(function (name) { 11 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 12 | }) 13 | 14 | module.exports = merge(baseWebpackConfig, { 15 | module: { 16 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) 17 | }, 18 | // cheap-module-eval-source-map is faster for development 19 | devtool: '#cheap-module-eval-source-map', 20 | plugins: [ 21 | new webpack.DefinePlugin({ 22 | 'process.env': config.dev.env 23 | }), 24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 25 | new webpack.HotModuleReplacementPlugin(), 26 | new webpack.NoEmitOnErrorsPlugin(), 27 | // https://github.com/ampedandwired/html-webpack-plugin 28 | new HtmlWebpackPlugin({ 29 | filename: 'index.html', 30 | template: 'index.html', 31 | inject: true 32 | }), 33 | new FriendlyErrorsPlugin() 34 | ] 35 | }) 36 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var config = require('../config') 5 | var merge = require('webpack-merge') 6 | var baseWebpackConfig = require('./webpack.base.conf') 7 | var CopyWebpackPlugin = require('copy-webpack-plugin') 8 | var HtmlWebpackPlugin = require('html-webpack-plugin') 9 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 11 | var TransferWebpackPlugin = require('transfer-webpack-plugin'); 12 | 13 | var env = config.build.env 14 | 15 | var webpackConfig = merge(baseWebpackConfig, { 16 | module: { 17 | rules: utils.styleLoaders({ 18 | sourceMap: config.build.productionSourceMap, 19 | extract: true 20 | }) 21 | }, 22 | devtool: config.build.productionSourceMap ? '#source-map' : false, 23 | output: { 24 | path: config.build.assetsRoot, 25 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 26 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 27 | }, 28 | plugins: [ 29 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 30 | new webpack.DefinePlugin({ 31 | 'process.env': env 32 | }), 33 | new webpack.optimize.UglifyJsPlugin({ 34 | compress: { 35 | warnings: false 36 | }, 37 | sourceMap: true 38 | }), 39 | // extract css into its own file 40 | new ExtractTextPlugin({ 41 | filename: utils.assetsPath('css/[name].[contenthash].css') 42 | }), 43 | // Compress extracted CSS. We are using this plugin so that possible 44 | // duplicated CSS from different components can be deduped. 45 | new OptimizeCSSPlugin(), 46 | // generate dist index.html with correct asset hash for caching. 47 | // you can customize output by editing /index.html 48 | // see https://github.com/ampedandwired/html-webpack-plugin 49 | new HtmlWebpackPlugin({ 50 | filename: config.build.index, 51 | template: 'index.html', 52 | favicon: './src/assets/iview2.ico', 53 | inject: true, 54 | minify: { 55 | removeComments: true, 56 | collapseWhitespace: true, 57 | removeAttributeQuotes: true 58 | // more options: 59 | // https://github.com/kangax/html-minifier#options-quick-reference 60 | }, 61 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 62 | chunksSortMode: 'dependency' 63 | }), 64 | // split vendor js into its own file 65 | new webpack.optimize.CommonsChunkPlugin({ 66 | name: 'vendor', 67 | minChunks: function(module, count) { 68 | // any required modules inside node_modules are extracted to vendor 69 | return ( 70 | module.resource && 71 | /\.js$/.test(module.resource) && 72 | module.resource.indexOf( 73 | path.join(__dirname, '../node_modules') 74 | ) === 0 75 | ) 76 | } 77 | }), 78 | // extract webpack runtime and module manifest to its own file in order to 79 | // prevent vendor hash from being updated whenever app bundle is updated 80 | new webpack.optimize.CommonsChunkPlugin({ 81 | name: 'manifest', 82 | chunks: ['vendor'] 83 | }), 84 | // copy custom static assets 85 | new CopyWebpackPlugin([{ 86 | from: path.resolve(__dirname, '../static'), 87 | to: config.build.assetsSubDirectory, 88 | ignore: ['.*'] 89 | }]), 90 | new CopyWebpackPlugin([{ 91 | from: path.resolve(__dirname, '../src/assets/img/'), 92 | to: config.build.assetsSubDirectory + '/img/', 93 | ignore: ['.*'] 94 | }]), 95 | new CopyWebpackPlugin([{ 96 | from: path.resolve(__dirname, '../src/assets/fonts/'), 97 | to: config.build.assetsSubDirectory + '/fonts/', 98 | ignore: ['.*'] 99 | }]) 100 | 101 | 102 | ] 103 | }) 104 | 105 | if (config.build.productionGzip) { 106 | var CompressionWebpackPlugin = require('compression-webpack-plugin') 107 | 108 | webpackConfig.plugins.push( 109 | new CompressionWebpackPlugin({ 110 | asset: '[path].gz[query]', 111 | algorithm: 'gzip', 112 | test: new RegExp( 113 | '\\.(' + 114 | config.build.productionGzipExtensions.join('|') + 115 | ')$' 116 | ), 117 | threshold: 10240, 118 | minRatio: 0.8 119 | }) 120 | ) 121 | } 122 | 123 | if (config.build.bundleAnalyzerReport) { 124 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 125 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 126 | } 127 | 128 | module.exports = webpackConfig -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | 4 | module.exports = { 5 | build: { 6 | env: require('./prod.env'), 7 | index: path.resolve(__dirname, '../dist/index.html'), 8 | assetsRoot: path.resolve(__dirname, '../dist'), 9 | assetsSubDirectory: 'static', 10 | assetsPublicPath: './', 11 | productionSourceMap: true, 12 | // Gzip off by default as many popular static hosts such as 13 | // Surge or Netlify already gzip all static assets for you. 14 | // Before setting to `true`, make sure to: 15 | // npm install --save-dev compression-webpack-plugin 16 | productionGzip: false, 17 | productionGzipExtensions: ['js', 'css'], 18 | // Run the build command with an extra argument to 19 | // View the bundle analyzer report after build finishes: 20 | // `npm run build --report` 21 | // Set to `true` or `false` to always turn it on or off 22 | bundleAnalyzerReport: process.env.npm_config_report 23 | }, 24 | dev: { 25 | env: require('./dev.env'), 26 | port: 8081, 27 | autoOpenBrowser: true, 28 | assetsSubDirectory: 'static', 29 | assetsPublicPath: '/', 30 | proxyTable: {}, 31 | // CSS Sourcemaps off by default because relative paths are "buggy" 32 | // with this option, according to the CSS-Loader README 33 | // (https://github.com/webpack/css-loader#sourcemaps) 34 | // In our experience, they generally work as expected, 35 | // just be aware of this issue when enabling this option. 36 | cssSourceMap: false 37 | } 38 | } -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 恩施市农村三权分置管理系统 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /libs/CLodop_Setup_for_Win64NT_2.102.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/libs/CLodop_Setup_for_Win64NT_2.102.zip -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-admin-echarts", 3 | "version": "1.0.0", 4 | "description": "admin echarts", 5 | "author": "jian.lv ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "node build/dev-server.js", 9 | "build": "node build/build.js" 10 | }, 11 | "dependencies": { 12 | "axios": "^0.15.3", 13 | "copy-webpack-plugin": "^4.0.1", 14 | "echarts": "^3.4.0", 15 | "nprogress": "^0.2.0", 16 | "optimize-css-assets-webpack-plugin": "^1.3.1", 17 | "rimraf": "^2.6.1", 18 | "vue": "^2.2.2", 19 | "vue-clipboard2": "0.0.6", 20 | "vue-router": "^2.3.0", 21 | "vuex": "^2.2.1" 22 | }, 23 | "devDependencies": { 24 | "autoprefixer": "^6.7.7", 25 | "axios-mock-adapter": "^1.8.1", 26 | "babel-core": "^6.24.0", 27 | "babel-loader": "^6.4.1", 28 | "babel-plugin-transform-runtime": "^6.23.0", 29 | "babel-polyfill": "^6.23.0", 30 | "babel-preset-env": "^1.2.2", 31 | "babel-preset-es2015": "^6.24.0", 32 | "babel-preset-stage-2": "^6.22.0", 33 | "babel-register": "^6.24.0", 34 | "chalk": "^1.1.3", 35 | "connect-history-api-fallback": "^1.3.0", 36 | "css-loader": "^0.27.3", 37 | "element-ui": "^1.2.5", 38 | "eventsource-polyfill": "^0.9.6", 39 | "express": "^4.15.2", 40 | "extract-text-webpack-plugin": "^2.1.0", 41 | "file-loader": "^0.10.1", 42 | "friendly-errors-webpack-plugin": "^1.6.1", 43 | "function-bind": "^1.1.0", 44 | "html-webpack-plugin": "^2.28.0", 45 | "http-proxy-middleware": "^0.17.4", 46 | "iview": "^2.0.0-rc.12", 47 | "json-loader": "^0.5.4", 48 | "mockjs": "^1.0.1-beta3", 49 | "opn": "^4.0.2", 50 | "ora": "^1.1.0", 51 | "semver": "^5.3.0", 52 | "shelljs": "^0.7.7", 53 | "transfer-webpack-plugin": "^0.1.4", 54 | "url-loader": "^0.5.8", 55 | "vue-loader": "^11.3.1", 56 | "vue-style-loader": "^2.0.4", 57 | "vue-template-compiler": "^2.2.4", 58 | "webpack": "^2.3.1", 59 | "webpack-bundle-analyzer": "^2.3.1", 60 | "webpack-dev-middleware": "^1.10.1", 61 | "webpack-hot-middleware": "^2.17.1", 62 | "webpack-merge": "^4.1.0" 63 | }, 64 | "engines": { 65 | "node": ">= 4.0.0", 66 | "npm": ">= 3.0.0" 67 | }, 68 | "browserslist": [ 69 | "> 1%", 70 | "last 2 versions", 71 | "not ie <= 8" 72 | ] 73 | } 74 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 21 | 22 | -------------------------------------------------------------------------------- /src/api/api.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | let base = ''; 4 | 5 | export const requestLogin = params => { return axios.post(`${base}/login`, params).then(res => res.data); }; 6 | 7 | export const getUserList = params => { return axios.get(`${base}/user/list`, { params: params }); }; 8 | 9 | export const getUserListPage = params => { return axios.get(`${base}/user/listpage`, { params: params }); }; 10 | 11 | export const removeUser = params => { return axios.get(`${base}/user/remove`, { params: params }); }; 12 | 13 | export const editUser = params => { return axios.get(`${base}/user/edit`, { params: params }); }; 14 | 15 | export const addUser = params => { return axios.get(`${base}/user/add`, { params: params }); }; -------------------------------------------------------------------------------- /src/api/index.js: -------------------------------------------------------------------------------- 1 | import * as api from './api'; 2 | 3 | export default api; -------------------------------------------------------------------------------- /src/assets/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/bg.jpg -------------------------------------------------------------------------------- /src/assets/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/bg1.jpg -------------------------------------------------------------------------------- /src/assets/echarts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/echarts.png -------------------------------------------------------------------------------- /src/assets/fonts/ionicons.05acfdb.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/fonts/ionicons.05acfdb.woff -------------------------------------------------------------------------------- /src/assets/fonts/ionicons.24712f6.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/fonts/ionicons.24712f6.ttf -------------------------------------------------------------------------------- /src/assets/fonts/ionicons.2c2ae06.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/fonts/ionicons.2c2ae06.eot -------------------------------------------------------------------------------- /src/assets/form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/form.png -------------------------------------------------------------------------------- /src/assets/img/bg.c4fc6ab.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/bg.c4fc6ab.jpg -------------------------------------------------------------------------------- /src/assets/img/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/bg.jpg -------------------------------------------------------------------------------- /src/assets/img/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/bg1.jpg -------------------------------------------------------------------------------- /src/assets/img/echarts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/echarts.png -------------------------------------------------------------------------------- /src/assets/img/form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/form.png -------------------------------------------------------------------------------- /src/assets/img/iview2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/iview2.ico -------------------------------------------------------------------------------- /src/assets/img/logoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/logoin.png -------------------------------------------------------------------------------- /src/assets/img/table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/table.png -------------------------------------------------------------------------------- /src/assets/img/user.5203b74.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/user.5203b74.jpg -------------------------------------------------------------------------------- /src/assets/img/user.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/user.jpg -------------------------------------------------------------------------------- /src/assets/img/发包.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/发包.png -------------------------------------------------------------------------------- /src/assets/img/地块.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/地块.png -------------------------------------------------------------------------------- /src/assets/img/地块_面积.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/地块_面积.png -------------------------------------------------------------------------------- /src/assets/img/末页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/末页.png -------------------------------------------------------------------------------- /src/assets/img/示意图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/示意图.png -------------------------------------------------------------------------------- /src/assets/img/首页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/img/首页.png -------------------------------------------------------------------------------- /src/assets/iview2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/iview2.ico -------------------------------------------------------------------------------- /src/assets/logoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/logoin.png -------------------------------------------------------------------------------- /src/assets/table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/table.png -------------------------------------------------------------------------------- /src/assets/user.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/user.jpg -------------------------------------------------------------------------------- /src/assets/发包.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/发包.png -------------------------------------------------------------------------------- /src/assets/地块.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/地块.png -------------------------------------------------------------------------------- /src/assets/地块_面积.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/地块_面积.png -------------------------------------------------------------------------------- /src/assets/末页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/末页.png -------------------------------------------------------------------------------- /src/assets/示意图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/示意图.png -------------------------------------------------------------------------------- /src/assets/首页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/src/assets/首页.png -------------------------------------------------------------------------------- /src/common/util.js: -------------------------------------------------------------------------------- 1 | var SIGN_REGEXP = /([yMdhsm])(\1*)/g; 2 | var DEFAULT_PATTERN = 'yyyy-MM-dd'; 3 | function padding(s, len) { 4 | var len = len - (s + '').length; 5 | for (var i = 0; i < len; i++) { s = '0' + s; } 6 | return s; 7 | }; 8 | 9 | export default { 10 | getQueryStringByName: function (name) { 11 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 12 | var r = window.location.search.substr(1).match(reg); 13 | var context = ""; 14 | if (r != null) 15 | context = r[2]; 16 | reg = null; 17 | r = null; 18 | return context == null || context == "" || context == "undefined" ? "" : context; 19 | }, 20 | formatDate: { 21 | 22 | 23 | format: function (date, pattern) { 24 | pattern = pattern || DEFAULT_PATTERN; 25 | return pattern.replace(SIGN_REGEXP, function ($0) { 26 | switch ($0.charAt(0)) { 27 | case 'y': return padding(date.getFullYear(), $0.length); 28 | case 'M': return padding(date.getMonth() + 1, $0.length); 29 | case 'd': return padding(date.getDate(), $0.length); 30 | case 'w': return date.getDay() + 1; 31 | case 'h': return padding(date.getHours(), $0.length); 32 | case 'm': return padding(date.getMinutes(), $0.length); 33 | case 's': return padding(date.getSeconds(), $0.length); 34 | } 35 | }); 36 | }, 37 | parse: function (dateString, pattern) { 38 | var matchs1 = pattern.match(SIGN_REGEXP); 39 | var matchs2 = dateString.match(/(\d)+/g); 40 | if (matchs1.length == matchs2.length) { 41 | var _date = new Date(1970, 0, 1); 42 | for (var i = 0; i < matchs1.length; i++) { 43 | var _int = parseInt(matchs2[i]); 44 | var sign = matchs1[i]; 45 | switch (sign.charAt(0)) { 46 | case 'y': _date.setFullYear(_int); break; 47 | case 'M': _date.setMonth(_int - 1); break; 48 | case 'd': _date.setDate(_int); break; 49 | case 'h': _date.setHours(_int); break; 50 | case 'm': _date.setMinutes(_int); break; 51 | case 's': _date.setSeconds(_int); break; 52 | } 53 | } 54 | return _date; 55 | } 56 | return null; 57 | } 58 | 59 | } 60 | 61 | }; 62 | -------------------------------------------------------------------------------- /src/lib/CLodopfuncs.js: -------------------------------------------------------------------------------- 1 | (function (win) { var CLODOP = { strWebPageID:"C70mt14",strTaskID:"",strHostURI:"http://localhost:18000", VERSION:"6.2.1.7",IVERSION:"6217",CVERSION:"2.1.0.2",HTTPS_STATUS:0, iBaseTask:1,timeThreshold:5,Priority:1,blIslocal:true, Iframes:[],ItemDatas:{},PageData:{},defStyleJson:{},PageDataEx:{},ItemCNameStyles:{}, blWorking:false,blNormalItemAdded:false,blTmpSelectedIndex:null,Caption:null,Color:null,CompanyName:null, Border:null,Inbrowse:null,webskt:null,SocketEnable:false,SocketOpened:false,NoClearAfterPrint:false,On_Return_Remain:false, On_Return:null,Result:null,iTrySendTimes:0,blOneByone:false,Printers:{"default":"4","list":[{"name":"Send To OneNote 2016","DriverName":"Send to Microsoft OneNote 16 Driver","PortName":"nul:","Orientation":"1","PaperSize":"9","PaperLength":"2970","PaperWidth":"2100","Copies":"1","DefaultSource":"15","PrintQuality":"600","Color":"2","Duplex":"1","FormName":"A4","Comment":"","DriverVersion":"1536","DCOrientation":"270","MaxExtentWidth":"2970","MaxExtentLength":"4318","MinExtentWidth":"984","MinExtentlength":"1905","pagelist":[{"name":"信纸"},{"name":"Tabloid"},{"name":"法律专用纸"},{"name":"Executive"},{"name":"A3"},{"name":"A4"},{"name":"B4 (JIS)"},{"name":"B5 (JIS)"},{"name":"信封 #10"},{"name":"信封 Monarch"}]},{"name":"Microsoft XPS Document Writer","DriverName":"Microsoft XPS Document Writer","PortName":"XPSPort:","Orientation":"1","PaperSize":"9","PaperLength":"2970","PaperWidth":"2100","Copies":"1","DefaultSource":"15","PrintQuality":"600","Color":"2","Duplex":"1","FormName":"A4","Comment":"","DriverVersion":"1536","DCOrientation":"270","MaxExtentWidth":"8636","MaxExtentLength":"11176","MinExtentWidth":"900","MinExtentlength":"900","pagelist":[{"name":"信纸"},{"name":"小号信纸"},{"name":"Tabloid"},{"name":"Ledger"},{"name":"法律专用纸"},{"name":"Statement"},{"name":"Executive"},{"name":"A3"},{"name":"A4"},{"name":"A4 小号"},{"name":"A5"},{"name":"B4 (JIS)"},{"name":"B5 (JIS)"},{"name":"Folio"},{"name":"Quarto"},{"name":"10x14"},{"name":"11x17"},{"name":"便笺"},{"name":"信封 #9"},{"name":"信封 #10"},{"name":"信封 #11"},{"name":"信封 #12"},{"name":"信封 #14"},{"name":"C size sheet"},{"name":"D size sheet"},{"name":"E size sheet"},{"name":"信封 DL"},{"name":"信封 C5"},{"name":"信封 C3"},{"name":"信封 C4"},{"name":"信封 C6"},{"name":"信封 C65"},{"name":"信封 B4"},{"name":"信封 B5"},{"name":"信封 B6"},{"name":"信封"},{"name":"信封 Monarch"},{"name":"6 3/4 信封"},{"name":"美国标准 Fanfold"},{"name":"德国标准 Fanfold"},{"name":"德国法律专用纸 Fanfold"},{"name":"B4 (ISO)"},{"name":"日式明信片"},{"name":"9x11"},{"name":"10x11"},{"name":"15x11"},{"name":"信封邀请函"},{"name":"特大信纸"},{"name":"特大法律专用纸"},{"name":"A4 特大"},{"name":"信纸横向"},{"name":"A4 横向"},{"name":"特大信纸横向"},{"name":"Super A"},{"name":"Super B"},{"name":"信纸加大"},{"name":"A4 加大"},{"name":"A5 横向"},{"name":"B5 (JIS) 横向"},{"name":"A3 特大"},{"name":"A5 特大"},{"name":"B5 (ISO) 特大"},{"name":"A2"},{"name":"A3 横向"},{"name":"A3 特大横向"},{"name":"日式往返明信片"},{"name":"A6"},{"name":"日式信封 Kaku #2"},{"name":"日式信封 Kaku #3"},{"name":"日式信封 Chou #3"},{"name":"日式信封 Chou #4"},{"name":"信纸旋转"},{"name":"A3 旋转"},{"name":"A4 旋转"},{"name":"A5 旋转"},{"name":"B4 (JIS) 旋转"},{"name":"B5 (JIS) 旋转"},{"name":"日式明信片旋转"},{"name":"双层日式明信片旋转"},{"name":"A6 旋转"},{"name":"日式信封 Kaku #2 旋转"},{"name":"日式信封 Kaku #3 旋转"},{"name":"日式信封 Chou #3 旋转"},{"name":"日式信封 Chou #4 旋转"},{"name":"B6 (JIS)"},{"name":"B6 (JIS) 旋转"},{"name":"12x11"},{"name":"日式信封 You #4"},{"name":"日式信封 You #4 旋转"},{"name":"PRC 信封 #1"},{"name":"PRC 信封 #3"},{"name":"PRC 信封 #4"},{"name":"PRC 信封 #5"},{"name":"PRC 信封 #6"},{"name":"PRC 信封 #7"},{"name":"PRC 信封 #8"},{"name":"PRC 信封 #9"},{"name":"PRC 信封 #10"},{"name":"PRC 信封 #1 旋转"},{"name":"PRC 信封 #3 旋转"},{"name":"PRC 信封 #4 旋转"},{"name":"PRC 信封 #5 旋转"},{"name":"PRC 信封 #6 旋转"},{"name":"PRC 信封 #7 旋转"},{"name":"PRC 信封 #8 旋转"},{"name":"PRC 信封 #9 旋转"}]},{"name":"Fax","DriverName":"Microsoft Shared Fax Driver","PortName":"SHRFAX:","Orientation":"1","PaperSize":"1","PaperLength":"0","PaperWidth":"0","Copies":"0","DefaultSource":"1","PrintQuality":"200","Color":"1","Duplex":"1","FormName":"Letter","Comment":"","DriverVersion":"1024","DCOrientation":"90","MaxExtentWidth":"2160","MaxExtentLength":"3556","MinExtentWidth":"0","MinExtentlength":"0","pagelist":[{"name":"信纸"},{"name":"小号信纸"},{"name":"法律专用纸"},{"name":"Statement"},{"name":"Executive"},{"name":"A4"},{"name":"A4 小号"},{"name":"A5"},{"name":"B5 (JIS)"},{"name":"Folio"},{"name":"Quarto"},{"name":"便笺"},{"name":"信封 #9"},{"name":"信封 #10"},{"name":"信封 #11"},{"name":"信封 #12"},{"name":"信封 #14"},{"name":"信封 DL"},{"name":"信封 C5"},{"name":"信封 C6"},{"name":"信封 C65"},{"name":"信封 B5"},{"name":"信封 B6"},{"name":"信封"},{"name":"信封 Monarch"},{"name":"6 3/4 信封"},{"name":"德国标准 Fanfold"},{"name":"德国法律专用纸 Fanfold"},{"name":"日式明信片"},{"name":"Reserved48"},{"name":"Reserved49"},{"name":"信纸横向"},{"name":"A4 横向"},{"name":"信纸加大"},{"name":"A4 加大"},{"name":"A5 横向"},{"name":"B5 (JIS) 横向"},{"name":"A5 特大"},{"name":"B5 (ISO) 特大"},{"name":"日式往返明信片"},{"name":"A6"},{"name":"日式信封 Kaku #3"},{"name":"日式信封 Chou #3"},{"name":"日式信封 Chou #4"},{"name":"A5 旋转"},{"name":"日式明信片旋转"},{"name":"双层日式明信片旋转"},{"name":"A6 旋转"},{"name":"日式信封 Chou #4 旋转"},{"name":"B6 (JIS)"},{"name":"B6 (JIS) 旋转"},{"name":"日式信封 You #4"},{"name":"PRC 16K"},{"name":"PRC 32K"},{"name":"PRC 32K(Big)"},{"name":"PRC 信封 #1"},{"name":"PRC 信封 #2"},{"name":"PRC 信封 #3"},{"name":"PRC 信封 #4"},{"name":"PRC 信封 #5"},{"name":"PRC 信封 #6"},{"name":"PRC 信封 #7"},{"name":"PRC 信封 #8"},{"name":"PRC 32K 旋转"},{"name":"PRC 32K(大)旋转"},{"name":"PRC 信封 #1 旋转"},{"name":"PRC 信封 #2 旋转"},{"name":"PRC 信封 #3 旋转"},{"name":"PRC 信封 #4 旋转"},{"name":"Letter"},{"name":"Legal"},{"name":"A5Transverse"},{"name":"B5"},{"name":"16K(195x270mm)"},{"name":"16K(184x260mm)"},{"name":"16K(197x273mm)"},{"name":"JISB5"},{"name":"B6"},{"name":"Com10"},{"name":"DL"},{"name":"C5"},{"name":"Monarch"},{"name":"3x5"},{"name":"Oficio"}]},{"name":"Brother PC-FAX v.2.2","DriverName":"Brother PC-FAX v.2.2","PortName":"BRN001BA9E9669B","Orientation":"1","PaperSize":"9","PaperLength":"0","PaperWidth":"0","Copies":"1","DefaultSource":"7","PrintQuality":"200","Color":"1","Duplex":"1","FormName":"A4","Comment":"MFC-7860DN LAN","DriverVersion":"280","DCOrientation":"270","MaxExtentWidth":"2159","MaxExtentLength":"3556","MinExtentWidth":"1050","MinExtentlength":"1485","pagelist":[{"name":"A4"},{"name":"Letter"},{"name":"Legal"}]},{"name":"Brother MFC-7860DN Printer","DriverName":"Brother MFC-7860DN Printer","PortName":"BRN001BA9E9669B","Orientation":"1","PaperSize":"9","PaperLength":"2970","PaperWidth":"2100","Copies":"1","DefaultSource":"7","PrintQuality":"600","Color":"1","Duplex":"1","FormName":"A4","Comment":"MFC-7860DN LAN","DriverVersion":"265","DCOrientation":"90","MaxExtentWidth":"2159","MaxExtentLength":"4064","MinExtentWidth":"762","MinExtentlength":"1160","pagelist":[{"name":"A4"},{"name":"Letter"},{"name":"Legal"},{"name":"Executive"},{"name":"A5"},{"name":"A5 长边"},{"name":"A6"},{"name":"B5"},{"name":"16K(195x270mm)"},{"name":"16K(184x260mm)"},{"name":"16K(197x273mm)"},{"name":"JIS B5"},{"name":"B6"},{"name":"Com-10"},{"name":"DL"},{"name":"C5"},{"name":"Monarch"},{"name":"3 x 5"},{"name":"Folio"},{"name":"DL 长边"},{"name":"A3"},{"name":"JIS B4"},{"name":"Ledger"},{"name":"用户定义"}]}]}, Browser: (function(){ var ua = navigator.userAgent; var isOpera = Object.prototype.toString.call(window.opera) == "[object Opera]"; return { IE: !!window.attachEvent && !isOpera, Opera: isOpera, WebKit: ua.indexOf("AppleWebKit/") > -1, Gecko: ua.indexOf("Gecko") > -1 && ua.indexOf("KHTML") === -1, MobileSafari: /Apple.*Mobile/.test(ua) } })(), GetTaskID:function(){ if (!this.strTaskID || this.strTaskID==""){ var dt=new Date(); this.iBaseTask=this.iBaseTask+1; this.strTaskID=""+dt.getHours()+dt.getMinutes()+dt.getSeconds()+"_"+this.iBaseTask; }; return this.strWebPageID+this.strTaskID; }, DoInit: function() { this.strTaskID=""; if (this.NoClearAfterPrint) return; this.ItemDatas={"count":0}; this.PageData={}; this.ItemCNameStyles={}; this.defStyleJson={"beginpage":0,"beginpagea":0}; this.blNormalItemAdded=false; }, OpenWebSocket: function() { if (!window.WebSocket && !window.MozWebSocket){ if (window.On_CLodop_Opened){ if (CLODOP.Priority==window.CLODOP_OK_Priority) setTimeout("window.On_CLodop_Opened()",1); }; return; }; this.SocketEnable=true; try { if (!this.webskt || this.webskt.readyState==3) { if (!window.WebSocket && window.MozWebSocket) window.WebSocket=window.MozWebSocket; this.webskt=new WebSocket('ws://127.0.0.1:18000/c_webskt/'); this.webskt.onopen = function(e) { CLODOP.SocketOpened=true; if (window.On_CLodop_Opened){ if (CLODOP.Priority==window.CLODOP_OK_Priority) setTimeout(window.On_CLodop_Opened(),1); }; }; this.webskt.onmessage = function(e) { CLODOP.blOneByone=false; var strResult=e.data; CLODOP.Result=strResult; try { var iPos=strResult.indexOf("="); var strFTaskID=null; if (iPos>=0 && iPos<30){ strFTaskID=strResult.slice(0,iPos); strResult=strResult.slice(iPos+1); }; if (strFTaskID.indexOf("ErrorMS")>-1){ alert(strResult); return; }; if (CLODOP.On_Return) { var selfFunc=CLODOP.On_Return; if (strResult == "true" || strResult == "false") CLODOP.On_Return(strFTaskID,strResult == "true"); else CLODOP.On_Return(strFTaskID,strResult); if (!CLODOP.On_Return_Remain && selfFunc === CLODOP.On_Return) CLODOP.On_Return=null; }; }catch(err){}; }; this.webskt.onclose = function(e) { if (!CLODOP.SocketOpened) {CLODOP.SocketEnable=false;return;}; setTimeout(CLODOP.OpenWebSocket(),2000); }; this.webskt.onerror = function(e){}; }; }catch(err){this.webskt=null;setTimeout(CLODOP.OpenWebSocket(),2000);}; }, wsSend: function(strData) { if (!this.SocketEnable) return; if (this.webskt && this.webskt.readyState==1){ this.Result=null; this.iTrySendTimes=0; this.webskt.send(strData); return true; } else { alert("WebSocket没准备好,点确定继续..."); this.iTrySendTimes++; if (this.iTrySendTimes<=1) {setTimeout(CLODOP.wsSend(strData),500);} else {this.OpenWebSocket();}; }; }, FORMAT: function(oType, oValue) { if (this.blWorking) {alert("It's Working... just a moment.");return null;} var tResult=null; if (oType!==undefined && oValue!==undefined) { if (oType.replace(/^\s+|\s+$/g,"").toLowerCase().indexOf("time:")==0) { oType=oType.replace(/^\s+|\s+$/g,"").slice(5); if (oValue.toLowerCase().indexOf("now")>-1) oValue=(new Date()).toString(); if (oValue.toLowerCase().indexOf("date")>-1) oValue=(new Date()).toString(); if (oValue.toLowerCase().indexOf("time")>-1) oValue=(new Date()).toString(); var TypeYMD="ymd"; if (oValue.toLowerCase().indexOf("ymd")>-1) {TypeYMD="ymd";oValue=oValue.slice(3);}; if (oValue.toLowerCase().indexOf("dmy")>-1) {TypeYMD="dmy";oValue=oValue.slice(3);}; if (oValue.toLowerCase().indexOf("mdy")>-1) {TypeYMD="mdy";oValue=oValue.slice(3);}; oValue=oValue.replace(/ [^ ]*\+[^ ]* /g," "); oValue=oValue.replace(/\(.*\)/g," "); oValue=oValue.replace(/星期日|星期一|星期二|星期三|星期四|星期五|星期六/g," "); oValue=oValue.replace(/[A-Za-z]+day|Mon|Tue|Wed|Thu|Fri|Sat|Sun/g," "); var aMonth=0; var exp=new RegExp("Oct[A-Za-z]*|十月|10月","i"); if (oValue.match(exp)!==null) {aMonth=10;oValue=oValue.replace(exp,"");}; exp=new RegExp("Nov[A-Za-z]*|十一月|11月","i"); if (oValue.match(exp)!==null) {aMonth=11;oValue=oValue.replace(exp,"");}; exp=new RegExp("Dec[A-Za-z]*|十二月|12月","i"); if (oValue.match(exp)!==null) {aMonth=12;oValue=oValue.replace(exp,"");}; exp=new RegExp("Jan[A-Za-z]*|一月|01月|1月","i"); if (oValue.match(exp)!==null) {aMonth=1;oValue=oValue.replace(exp,"");}; exp=new RegExp("Feb[A-Za-z]*|二月|02月|2月","i"); if (oValue.match(exp)!==null) {aMonth=2;oValue=oValue.replace(exp,"");}; exp=new RegExp("Mar[A-Za-z]*|三月|03月|3月","i"); if (oValue.match(exp)!==null) {aMonth=3;oValue=oValue.replace(exp,"");}; exp=new RegExp("Apr[A-Za-z]*|四月|04月|4月","i"); if (oValue.match(exp)!==null) {aMonth=4;oValue=oValue.replace(exp,"");}; exp=new RegExp("May[A-Za-z]*|五月|05月|5月","i"); if (oValue.match(exp)!==null) {aMonth=5;oValue=oValue.replace(exp,"");}; exp=new RegExp("Jun[A-Za-z]*|六月|06月|6月","i"); if (oValue.match(exp)!==null) {aMonth=6;oValue=oValue.replace(exp,"");}; exp=new RegExp("Jul[A-Za-z]*|七月|07月|7月","i"); if (oValue.match(exp)!==null) {aMonth=7;oValue=oValue.replace(exp,"");}; exp=new RegExp("Aug[A-Za-z]*|八月|08月|8月","i"); if (oValue.match(exp)!==null) {aMonth=8;oValue=oValue.replace(exp,"");}; exp=new RegExp("Sep[A-Za-z]*|九月|09月|9月","i"); if (oValue.match(exp)!==null) {aMonth=9;oValue=oValue.replace(exp,"");}; oValue=oValue.replace(/日|秒/g," "); oValue=oValue.replace(/时|分/g,":"); var subTime=oValue.match(/ \d+:\d+:\d+/); if (subTime==null) subTime=""; oValue=oValue.replace(/ \d+:\d+:\d+/,"")+subTime; var dValue=new Date(); var iYear=0;var iMonth=0;var iDate=0;var iHour=0;var iMinutes=0;var iSecond=0; var tmpValue=oValue; var sValue=""; var MC1=0;MC2=0;MC3=0; sValue=tmpValue.match(/\d+/); if (sValue!==null) {MC1=parseInt(sValue[0]);tmpValue=tmpValue.replace(/\d+/,"");}; sValue=tmpValue.match(/\d+/); if (sValue!==null) {MC2=parseInt(sValue[0]);tmpValue=tmpValue.replace(/\d+/,"");}; if (aMonth<=0){sValue=tmpValue.match(/\d+/); if (sValue!==null) {MC3=parseInt(sValue[0]);tmpValue=tmpValue.replace(/\d+/,"");};}; if (aMonth>0){iMonth=aMonth; if (MC2<=31){iYear=MC1;iDate=MC2;} else {iYear=MC2;iDate=MC1;};} else if (TypeYMD=="dmy"){iDate=MC1;iMonth=MC2;iYear=MC3;} else if (TypeYMD=="mdy"){iMonth=MC1;iDate=MC2;iYear=MC3;} else { iYear=MC1;iMonth=MC2;iDate=MC3; if(MC3>31){ iYear=MC3;iMonth=MC1;iDate=MC2;if(MC1>12){iDate=MC1;iMonth=MC2};} else {if(MC2>12){iYear=MC2;iMonth=MC1;}}; }; var sValue=tmpValue.match(/\d+/); if (sValue!==null) {iHour=parseInt(sValue[0]);tmpValue=tmpValue.replace(/\d+/,"");}; var sValue=tmpValue.match(/\d+/); if (sValue!==null) {iMinutes=parseInt(sValue[0]);tmpValue=tmpValue.replace(/\d+/,"");}; var sValue=tmpValue.match(/\d+/); if (sValue!==null) {iSecond=parseInt(sValue[0]);tmpValue=tmpValue.replace(/\d+/,"");}; if (oType.toLowerCase()=="isvalidformat") oValue=(iYear>0 && iMonth>0 && iMonth<=12 && iDate>0 && iDate<=31); else { if ((""+iYear).length<4) iYear=iYear+2000; dValue.setFullYear(iYear,iMonth-1,iDate); dValue.setHours(iHour); dValue.setMinutes(iMinutes); dValue.setSeconds(iSecond); var iDay=dValue.getDay(); if (oType.toLowerCase()=="weekindex") oValue=iDay; else if (oType.toLowerCase()=="floatvalue") oValue=dValue.getTime(); else { var sWeek=""; switch(iDay){case 0:sWeek="日";break;case 1:sWeek="一";break;case 2:sWeek="二";break;case 3:sWeek="三";break;case 4:sWeek="四";break;case 5:sWeek="五";break;case 6:sWeek="六";break;}; oValue=oType.replace(/dddd/ig,"星期"+sWeek); if(/(y+)/i.test(oValue)) oValue=oValue.replace(RegExp.$1,(iYear+"").substr(4-RegExp.$1.length)); if(/(m+:)/i.test(oValue)) oValue=oValue.replace(RegExp.$1,("00"+iMinutes+":").substr(("00"+iMinutes+":").length-RegExp.$1.length)); if(/(M+)/i.test(oValue)) { var dsWidth=(""+iMonth).length>RegExp.$1.length?(""+iMonth).length:RegExp.$1.length; oValue=oValue.replace(RegExp.$1,("00"+iMonth).substr(("00"+iMonth).length-dsWidth)); } if(/(d+)/i.test(oValue)) { var dsWidth=(""+iDate).length>RegExp.$1.length?(""+iDate).length:RegExp.$1.length; oValue=oValue.replace(RegExp.$1,("00"+iDate).substr(("00"+iDate).length-dsWidth)); } if(/(H+)/i.test(oValue)) oValue=oValue.replace(RegExp.$1,("00"+iHour).substr(("00"+iHour).length-RegExp.$1.length)); if(/(n+)/i.test(oValue)) oValue=oValue.replace(RegExp.$1,("00"+iMinutes).substr(("00"+iMinutes).length-RegExp.$1.length)); if(/(s+)/i.test(oValue)) oValue=oValue.replace(RegExp.$1,("00"+iSecond).substr(("00"+iSecond).length-RegExp.$1.length)); } } if (CLODOP.On_Return){ var selfFunc=CLODOP.On_Return; CLODOP.On_Return(0,oValue); if (!CLODOP.On_Return_Remain && selfFunc === CLODOP.On_Return) CLODOP.On_Return=null; }; return oValue; } else if (this.blIslocal || oType.indexOf("FILE:")<0) { this.PageData["format_type"]=oType; this.PageData["format_value"]=oValue; if (this.DoPostDatas("format")==true) { this.GetLastResult(false); tResult=this.GetTaskID(); }; } else alert("不能远程读写文件!"); }; this.DoInit(); this.blWorking=false; return tResult; }, SET_PRINT_PAPER: function(Top,Left,Width,Height,strPrintTask) { return this.PRINT_INITA(Top,Left,Width,Height,strPrintTask); }, PRINT_INIT: function(strPrintTask) { return this.PRINT_INITA(null,null,null,null,strPrintTask); }, PRINT_INITA: function(Top,Left,Width,Height,strPrintTask) { if (Top===undefined || Top===null) Top=""; if (Left===undefined || Left===null) Left=""; if (Width===undefined || Width===null) Width=""; if (Height===undefined || Height===null) Height=""; if (strPrintTask===undefined || strPrintTask===null) strPrintTask=""; this.NoClearAfterPrint=false; this.DoInit(); this.PageData["top"]=Top; this.PageData["left"]=Left; this.PageData["width"]=Width; this.PageData["height"]=Height; this.PageData["printtask"]=strPrintTask; }, SET_PRINT_MODE: function(strModeType,ModeValue) { if (strModeType===undefined || strModeType===null) strModeType=""; if (ModeValue===undefined || ModeValue===null) ModeValue=""; if (strModeType==="") return false; strModeType=strModeType.toLowerCase(); this.PageData[strModeType]=ModeValue; if (strModeType=="noclear_after_print") this.NoClearAfterPrint=ModeValue; if (strModeType.indexOf("window_def")>-1 || strModeType.indexOf("control_printer")>-1) { var tResult=null; if (this.DoPostDatas("onlysetprint")==true) { this.GetLastResult(false); tResult=this.GetTaskID(); }; this.DoInit(); this.blWorking=false; return tResult; }; }, ADD_PRINT_TEXT: function(top,left,width,height,strText) { return this.AddItemArray(2,top,left,width,height,strText); }, ADD_PRINT_TEXTA: function(itemName,top,left,width,height,strText) { return this.AddItemArray(2,top,left,width,height,strText,itemName); }, ADD_PRINT_HTM: function(top,left,width,height,strHTML) { return this.AddItemArray(4,top,left,width,height,strHTML); }, ADD_PRINT_HTML: function(top,left,width,height,strHTML) { return this.AddItemArray(1,top,left,width,height,strHTML); }, ADD_PRINT_HTMLA: function(itemName,top,left,width,height,strHTML) { return this.AddItemArray(1,top,left,width,height,strHTML,itemName); }, ADD_PRINT_BARCODE: function(top,left,width,height,BarType,BarValue) { return this.AddItemArray(9,top,left,width,height,BarValue,null,null,null,null,null,null,BarType); }, ADD_PRINT_BARCODEA: function(ItemName,top,left,width,height,BarType,BarValue) { return this.AddItemArray(9,top,left,width,height,BarValue,ItemName,null,null,null,null,null,BarType); }, ADD_PRINT_RECTA: function(top,left,width,height,intPenStyle,intPenWidth,intColor) { return this.AddItemArray(3,top,left,width,height,null,null,2,intPenStyle,intPenWidth,intColor,null); }, ADD_PRINT_RECT: function(top,left,width,height,intPenStyle,intPenWidth) { return this.AddItemArray(3,top,left,width,height,null,null,2,intPenStyle,intPenWidth,null,null); }, ADD_PRINT_ELLIPSEA: function(top,left,width,height,intPenStyle,intPenWidth,intColor) { return this.AddItemArray(3,top,left,width,height,null,null,3,intPenStyle,intPenWidth,intColor,null); }, ADD_PRINT_ELLIPSE: function(top,left,width,height,intPenStyle,intPenWidth) { return this.AddItemArray(3,top,left,width,height,null,null,3,intPenStyle,intPenWidth,null,null); }, ADD_PRINT_SHAPE: function(ShapeType,top,left,width,height,intPenStyle,intPenWidth,intColor) { return this.AddItemArray(3,top,left,width,height,null,null,ShapeType,intPenStyle,intPenWidth,intColor,null); }, ADD_PRINT_LINE: function(top1,left1,top2,left2,intPenStyle,intPenWidth) { return this.AddItemArray(3,top1,left1,top2,left2,null,null,0,intPenStyle,intPenWidth,null,"1"); }, ADD_PRINT_DNLINE: function(Top,Left,Width,Height,intPenStyle,intPenWidth) { return this.AddItemArray(3,Top,Left,Width,Height,null,null,1,intPenStyle,intPenWidth,null,null); }, ADD_PRINT_DNLINEA: function(Top,Left,Width,Height,intPenStyle,intPenWidth,intColor) { return this.AddItemArray(3,Top,Left,Width,Height,null,null,1,intPenStyle,intPenWidth,intColor,null); }, ADD_PRINT_UPLINE: function(Top,Left,Width,Height,intPenStyle,intPenWidth) { return this.AddItemArray(3,Top,Left,Width,Height,null,null,0,intPenStyle,intPenWidth,null,null); }, ADD_PRINT_UPLINEA: function(Top,Left,Width,Height,intPenStyle,intPenWidth,intColor) { return this.AddItemArray(3,Top,Left,Width,Height,null,null,0,intPenStyle,intPenWidth,intColor,null); }, ADD_PRINT_TABLE: function(top,left,width,height,strHTML) { return this.AddItemArray(6,top,left,width,height,strHTML); }, ADD_PRINT_TBURL: function(top,left,width,height,strURL) { return this.AddItemArray(7,top,left,width,height,strURL); }, ADD_PRINT_URL: function(top,left,width,height,strURL) { return this.AddItemArray(5,top,left,width,height,strURL); }, ADD_PRINT_IMAGE: function(top,left,width,height,strHTML) { return this.AddItemArray(8,top,left,width,height,strHTML); }, ADD_PRINT_CHART: function(top,left,width,height,strChartTypess,strHTML) { return this.AddItemArray(10,top,left,width,height,strHTML,null,null,null,null,null,null,null,strChartTypess); }, SET_PRINT_PROPERTY: function(ItemNO, intPageType, intHorzOrient, intVertOrient) { this.SET_PRINT_STYLEA(ItemNO,"ItemType",intPageType); this.SET_PRINT_STYLEA(ItemNO,"HOrient",intHorzOrient); this.SET_PRINT_STYLEA(ItemNO,"VOrient",intVertOrient); }, SET_PRINT_PROPERTYA: function(ItemName, intPageType, intHorzOrient, intVertOrient) { this.SET_PRINT_PROPERTY(ItemName,intPageType,intHorzOrient,intVertOrient); }, SET_PRINT_STYLE: function(strStyleName,StyleValue) { if (strStyleName===undefined || strStyleName===null) strStyleName=""; if (StyleValue===undefined || StyleValue===null) StyleValue=""; if (strStyleName==="") return false; strStyleName=strStyleName.toLowerCase(); this.defStyleJson[strStyleName]=StyleValue; }, SET_PRINT_STYLEA: function(ItemNo,strKey,Value) { if (ItemNo===undefined || ItemNo===null) ItemNo=""; if (strKey===undefined || strKey===null) strKey=""; if (Value===undefined || Value===null) Value=""; if (ItemNo==="" || strKey==="") return false; if (this.ItemDatas["count"]<=0) { if (this.PageData["add_print_program_data"]!==undefined) { this.ItemCNameStyles[strKey.toLowerCase()+"-"+ItemNo]=Value; return true; } else { return false; }; }; strKey=strKey.toLowerCase(); if (strKey=="type") return false; var blResult=false; if (ItemNo==0) {ItemNo=this.ItemDatas["count"];} for(var vItemNO in this.ItemDatas){ var ItemName=this.ItemDatas[vItemNO]["itemname"]; if ((ItemNo==vItemNO)||(ItemNo==ItemName)||((typeof ItemNo === "string")&&(typeof ItemName === "string")&&(ItemNo.toUpperCase()==ItemName.toUpperCase()))){ this.ItemDatas[vItemNO][strKey]=Value; blResult=true; }; }; if (blResult) return true; return false; }, SET_PRINT_TEXT_STYLE: function(ItemNO,strFontName,intSize,intBold,intItalic,intUnderline,intAlignment) { this.SET_PRINT_STYLEA(ItemNO,"fontname",strFontName); this.SET_PRINT_STYLEA(ItemNO,"fontsize",intSize); this.SET_PRINT_STYLEA(ItemNO,"bold",intBold); this.SET_PRINT_STYLEA(ItemNO,"italic",intItalic); this.SET_PRINT_STYLEA(ItemNO,"underline",intUnderline); this.SET_PRINT_STYLEA(ItemNO,"alignment",intAlignment); }, SET_PRINT_TEXT_STYLEA: function(ItemNO,strFontName,intSize,intBold,intItalic,intUnderline,intAlignment,Color) { this.SET_PRINT_TEXT_STYLE(ItemNO,strFontName,intSize,intBold,intItalic,intUnderline,intAlignment); this.SET_PRINT_STYLEA(ItemNO,"fontcolor",Color); }, SET_PRINT_TEXT_STYLEB: function(ItemNO,strFontName,intSize,intBold,intItalic,intUnderline,intAlignment,Color) { this.SET_PRINT_TEXT_STYLEA(ItemNO,strFontName,intSize,intBold,intItalic,intUnderline,intAlignment,Color); }, NEWPAGE: function() { this.NewPage(); }, NewPage: function() { var blSomeNormal=false; var noItemType; for(var vItemNO in this.ItemDatas){ if (vItemNO=="count") noItemType=false; else noItemType=true; for(var vItemxx in this.ItemDatas[vItemNO]){ if (vItemxx=="itemtype") { noItemType=false; if ((this.ItemDatas[vItemNO][vItemxx]==0)||(this.ItemDatas[vItemNO][vItemxx]==4)){ blSomeNormal=true; break; }; }; }; if (noItemType) blSomeNormal=true; if (blSomeNormal) break; }; if (blSomeNormal) this.defStyleJson["beginpage"]=this.defStyleJson["beginpage"]+1; }, NEWPAGEA: function() { this.NewPageA(); }, NewPageA: function() { var blSomeNormal=false; var noItemType; for(var vItemNO in this.ItemDatas){ if (vItemNO=="count") noItemType=false; else noItemType=true; for(var vItemxx in this.ItemDatas[vItemNO]){ if (vItemxx=="itemtype") { noItemType=false; if ((this.ItemDatas[vItemNO][vItemxx]==0)||(this.ItemDatas[vItemNO][vItemxx]==4)){ blSomeNormal=true; break; }; }; }; if (noItemType) blSomeNormal=true; if (blSomeNormal) break; }; if (blSomeNormal) this.defStyleJson["beginpagea"]=this.defStyleJson["beginpagea"]+1; }, PREVIEW: function(sView,iW,iH) { if (this.blWorking) {alert("It's Working... just a moment.");return null;} var tResult=null; if ((!sView)&&(this.blIslocal)) { if (this.DoPostDatas("preview")==true) { this.Result=null; this.GetLastResult(true); tResult=this.GetTaskID(); }; } else { if (this.DoPostDatas("cpreview")==true) { this.DoCPreview(sView,iW,iH); tResult=this.GetTaskID(); }; }; this.DoInit(); this.blWorking=false; return tResult; }, PRINT: function(sView,iW,iH) { if (this.blWorking) {alert("It's Working... just a moment.");return null;} var tResult=null; if (this.DoPostDatas("print")==true) tResult=this.GetTaskID(); this.DoInit(); this.blWorking=false; return tResult; }, GET_PRINTER_COUNT: function() { if (this.Printers===undefined) return 0; else { return this.Printers["list"].length; }; }, GET_PRINTER_NAME: function(intNO) { if (this.Printers===undefined) return ""; else { if (typeof intNO == "string" && intNO.indexOf(":")>-1){ var strPPname=intNO.slice(intNO.indexOf(":")+1); intNO=intNO.slice(0,intNO.indexOf(":")); if (intNO==-1) return this.Printers["list"][this.Printers["default"]][strPPname]; else return this.Printers["list"][intNO][strPPname]; } else { if (intNO==-1) return this.Printers["list"][this.Printers["default"]].name; else if (intNO>=0 && intNO-1) { this.PageData["add_print_program_data"]=oValue; return true; }; }; }, SHOW_CHART: function() { }, DO_ACTION: function() { }, Create_Printer_List: function(oElement){ while(oElement.childNodes.length>0){ var children = oElement.childNodes; for(var i=0;i0){ var children = oElement.childNodes; for(var i=0;ithis.timeThreshold*60000) { obody.removeChild(this.Iframes[i]["iframe"]); this.Iframes.splice(i,1); }; }; }catch(err){}; }, AddInputElement: function(odocument,oform,name,value) { if (value!==undefined){ var oinput= odocument.createElement("input"); oinput.name=name;oinput.type="hidden";oinput.value=value; oform.appendChild(oinput); }; }, createPostDataString: function(afterPostAction) { var strData="act="+afterPostAction+"\f"; strData=strData+"browseurl="+window.location.href+"\f"; for(var vMode in this.PageDataEx){ strData=strData+vMode+"="+this.PageDataEx[vMode]+"\f"; }; var PrintModeNamess=""; for(var vMode in this.PageData){ strData=strData+vMode+"="+this.PageData[vMode]+"\f"; if (vMode!="top" && vMode!="left" && vMode!="width" && vMode!="height" && vMode!="printtask" && vMode!="printerindex" && vMode!="orient" && vMode!="pagewidth" && vMode!="pageheight" && vMode!="pagename" && vMode!="printcopies" && vMode!="setup_bkimg") PrintModeNamess=PrintModeNamess+";"+vMode; }; if (PrintModeNamess !=="") strData=strData+"printmodenames="+PrintModeNamess+"\f"; var StyleClassNamess=""; for(var vClassStyle in this.ItemCNameStyles){ strData=strData+vClassStyle+"="+this.ItemCNameStyles[vClassStyle]+"\f"; StyleClassNamess=StyleClassNamess+";"+vClassStyle; }; if (StyleClassNamess !=="") strData=strData+"printstyleclassnames="+StyleClassNamess+"\f"; strData=strData+"itemcount="+this.ItemDatas["count"]+"\f"; for(var vItemNO in this.ItemDatas){ var ItemStyless=""; for(var vItemxx in this.ItemDatas[vItemNO]){ if (vItemxx!="beginpage" && vItemxx!="beginpagea" && vItemxx!="type" && vItemxx!="top" && vItemxx!="left" && vItemxx!="width" && vItemxx!="height") ItemStyless=ItemStyless+";"+vItemxx; }; strData=strData+vItemNO+"_itemstylenames"+"="+ItemStyless+"\f"; for(var vItemxx in this.ItemDatas[vItemNO]){strData=strData+vItemNO+"_"+vItemxx+"="+this.ItemDatas[vItemNO][vItemxx]+"\f";}; }; return strData; }, wsDoPostDatas: function(afterPostAction) { var strData="charset=丂\f"; strData=strData+"tid="+this.GetTaskID()+"\f"; strData=strData+this.createPostDataString(afterPostAction); return this.wsSend("post:"+strData); }, DoPostDatas: function(afterPostAction) { if (this.blOneByone==true){ alert("有窗口已打开,先关闭它(持续如此时请刷新页面)!"); return false; }; this.blWorking=true; if (this.blTmpSelectedIndex !== null) this.SET_PRINTER_INDEX(this.blTmpSelectedIndex); if (this.SocketEnable){ return this.wsDoPostDatas(afterPostAction); }; this.RemoveIframes(); var obody=document.body || document.getElementsByTagName("body")[0] || document.documentElement; var oiframe=document.createElement("iframe"); oiframe.setAttribute("src","about:blank"); oiframe.setAttribute("style","display:none"); oiframe.height=0; obody.appendChild(oiframe); var contentdocument=oiframe.contentWindow.document; contentdocument.write("
"); var oform=contentdocument.getElementsByTagName("form")[0]; this.AddInputElement(contentdocument,oform,"charset","丂"); this.AddInputElement(contentdocument,oform,"tid",this.GetTaskID()); this.AddInputElement(contentdocument,oform,"post",this.createPostDataString(afterPostAction)); oform.submit(); var IframeMS={}; IframeMS["time"]=(new Date()).getTime(); IframeMS["iframe"]=oiframe; this.Iframes.push(IframeMS); return true; }, GetLastResult: function(blFOneByone){ if (blFOneByone) this.blOneByone=true; if (this.SocketEnable){ return true; }; var url = this.strHostURI+"/c_lastresult.js"; url = url + "?times=" + (new Date().getTime()); url = url + "&tid=" + this.GetTaskID(); url = encodeURI(url).replace("%20","+"); var oscript = document.createElement("script"); oscript.src = url; oscript.async = false; oscript.type = "text/javascript"; oscript.charset="utf-8"; var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement; head.insertBefore(oscript,head.firstChild ); oscript.onload =oscript.onreadystatechange= function() { if ((!oscript.readyState|| /loaded|complete/.test(oscript.readyState))){ CLODOP.blOneByone=false; if (CLodop_ACTLastResult) var strResult=decodeURIComponent(CLodop_ACTLastResult); var strResultTaskID=CLodop_ACTTaskID; CLODOP.Result=strResult; if (CLodop_ACTAlert) CLodop_ACTAlert(); if (CLODOP.On_Return) try { var selfFunc=CLODOP.On_Return; if (strResult =="true" || strResult =="false") CLODOP.On_Return(strResultTaskID,strResult=="true"); else CLODOP.On_Return(strResultTaskID,strResult); if (!CLODOP.On_Return_Remain && selfFunc === CLODOP.On_Return) CLODOP.On_Return=null; }catch(err){}; oscript.onload = oscript.onreadystatechange = null; if ( oscript.parentNode ) { oscript.parentNode.removeChild( oscript );}; }; }; return true; }, DoCPreview: function(sView,iW,iH) { var obody=document.body || document.getElementsByTagName("body")[0] || document.documentElement; if (typeof iW !== "number") iW=Math.round(obody.offsetWidth*2/3); else if (obody.offsetWidth0) { if (document.getElementById(sView)) { document.getElementById(sView).src=strPURL; } else alert("iframe '"+sView+"' not exist!"); } else if (sView === "_dialog" ) { if (!this.Browser.Opera) {showModalDialog(strPURL,'dialog','center:yes');}else {window.open(strPURL,"", "scrollbars=yes,toolbar=no,left=150,top=100,resizable=yes");} } else if (sView === "_self" || sView === "_top" || sView === "_parent") { window.location.href=strPURL; } else if (sView === "_blank" ) { this.PreviewBox.create(strPURL,iW,iH); } else alert("Element '"+sView+"' is invalid!"); } else this.PreviewBox.create(strPURL,iW,iH); }catch(err){ alert("CLODOP PopView "+err); }; }, creatMyButtonElement: function(strType,strValue) { try { var oElement=document.createElement(""); } catch(e){}; if (!oElement){ oElement=document.createElement("input"); oElement.type=strType; oElement.value=strValue; }; return oElement; }, creatLabelElement: function(Type,Value,Width,Left,Top) { var TxtLabel=document.createElement(Type); TxtLabel.innerHTML=Value; TxtLabel.style.cssText="position:absolute;width:"+Width+"px;left:"+Left+"px;top:"+Top+"px;"; return TxtLabel; }, SelectBox:{ dragapproved:false, offsetx:0,offsety:0,tempx:0,tempy:0,FrantDiv:undefined,PopDiv:undefined,selPrinter:undefined,selCopies:undefined, closeit:function(){ if (CLODOP.SelectBox.PopDiv && CLODOP.SelectBox.PopDiv.parentNode) CLODOP.SelectBox.PopDiv.parentNode.removeChild(CLODOP.SelectBox.PopDiv); if (this.FrantDiv&&this.FrantDiv.parentNode) this.FrantDiv.parentNode.removeChild(this.FrantDiv); this.PopDiv=undefined; }, initializedrag:function(e){ var we=window.event || e; this.offsetx=we.clientX; this.offsety=we.clientY; this.tempx=parseInt(this.PopDiv.style.left); this.tempy=parseInt(this.PopDiv.style.top); this.dragapproved=true; }, drag_drop:function(e){ if (!this.dragapproved) return; var we=window.event || e; this.PopDiv.style.left=we.clientX-this.offsetx+this.tempx+"px"; this.PopDiv.style.top=we.clientY-this.offsety+this.tempy+"px"; }, stopdrag:function(){ this.dragapproved=false; }, clickOK:function(onlySelect){ CLODOP.PRINTAOK(CLODOP.SelectBox.selPrinter.value,CLODOP.SelectBox.selCopies.value,0,0,onlySelect); this.closeit(); }, create:function(iW,iH,onlySelect){ if (CLODOP.SelectBox.PopDiv) this.closeit(); var obody=document.body || document.getElementsByTagName("body")[0] || document.documentElement; var Boxdiv=document.createElement("div"); obody.appendChild(Boxdiv); Boxdiv.style.cssText="position:absolute;z-index:1100;display:block;top:2px;border:1px solid #6B97C1;background:#F5F5F5;color:#000;font-size:13px;"; Boxdiv.style.width=iW+"px"; Boxdiv.style.left=(obody.offsetWidth-iW)/2+"px"; Boxdiv.style.top=(obody.offsetHeight-iH)/2+"px"; Boxdiv.style.height=iH+"px"; this.PopDiv=Boxdiv; var titleDiv=document.createElement("div"); Boxdiv.appendChild(titleDiv); titleDiv.style.cssText="font: bold 13px Arial;line-height:25px;height:27px;text-indent:5px;color: white;background:#8BACCF"; titleDiv.innerHTML="      打印"; titleDiv.onmousedown=function(event){CLODOP.SelectBox.initializedrag(event);}; titleDiv.onmousemove=function(event){CLODOP.SelectBox.drag_drop(event);}; titleDiv.onmouseup=function(){CLODOP.SelectBox.stopdrag();}; var icoButton=document.createElement("button"); titleDiv.appendChild(icoButton); icoButton.style.cssText="background:transparent url("+CLODOP.strHostURI+"/c_favicon.ico) no-repeat scroll 0 0px;margin-left:5px;position:absolute;height:20px;line-height:100px;width:34px;left:3px;border:0;top:5px"; var CloseButton=document.createElement("button"); titleDiv.appendChild(CloseButton); CloseButton.style.cssText="background:transparent url("+CLODOP.strHostURI+"/images/c_winclose.png) no-repeat scroll 0 0px;margin-right:5px;position:absolute;height:20px;line-height:100px;width:34px;right:3px;border:0;top:4px"; CloseButton.onclick=function(){ CLODOP.SelectBox.closeit(); if (onlySelect && CLODOP.On_Return){ var selfFunc=CLODOP.On_Return; CLODOP.On_Return(0,-1); if (!CLODOP.On_Return_Remain && selfFunc === CLODOP.On_Return) CLODOP.On_Return=null; }; }; var areaDiv=document.createElement("div"); Boxdiv.appendChild(areaDiv); areaDiv.style.cssText="background:#F5F5F5;color:#000;border:0px;left:0px;top:0px;"; areaDiv.style.width=iW-2+"px"; areaDiv.style.height=(iH-27)+"px"; var OKButton=CLODOP.creatMyButtonElement("button","确定"); Boxdiv.appendChild(OKButton); OKButton.style.cssText="position:absolute;width:80px;f"; OKButton.style.left="110px"; OKButton.style.top=(iH-64)+"px"; OKButton.onclick=function(){CLODOP.SelectBox.clickOK(onlySelect);}; var CancelButton=CLODOP.creatMyButtonElement("button","取消"); Boxdiv.appendChild(CancelButton); CancelButton.style.cssText="position:absolute;width:80px;"; CancelButton.style.left="240px"; CancelButton.style.top=(iH-64)+"px"; CancelButton.onclick=function(){ CLODOP.SelectBox.closeit(); if (onlySelect && CLODOP.On_Return){ var selfFunc=CLODOP.On_Return; CLODOP.On_Return(0,-1); if (!CLODOP.On_Return_Remain && selfFunc === CLODOP.On_Return) CLODOP.On_Return=null; }; }; areaDiv.appendChild(CLODOP.creatLabelElement("span","选打印机:",200,46,67)); var oSelect=document.createElement("select"); Boxdiv.appendChild(oSelect); this.selPrinter=oSelect; oSelect.style.cssText="position:absolute;size:1;width:212px;left:110px;top:62px;"; CLODOP.Create_Printer_List(oSelect); areaDiv.appendChild(CLODOP.creatLabelElement("span","打印份数:",200,46,121)); var oCopies=CLODOP.creatMyButtonElement("text","1"); Boxdiv.appendChild(oCopies); this.selCopies=oCopies; oCopies.style.cssText="position:absolute;size:1;width:30px;left:110px;top:117px;"; this.FrantDiv=document.createElement("div"); obody.appendChild(this.FrantDiv); this.FrantDiv.style.cssText="border:0px;left:0px;top:0px;filter: alpha(opacity=20); position: fixed; opacity: 0.2;-moz-opacity: 0.2; _position: absolute;z-index:1009; over-flow: hidden;"; if (CLODOP.Browser.IE && (document.compatMode == "BackCompat" || navigator.userAgent.indexOf("MSIE 6.0")>0)){ this.FrantDiv.style.width=obody.scrollWidth+"px"; this.FrantDiv.style.height=obody.scrollHeight+"px"; }else{ this.FrantDiv.style.width="100%"; this.FrantDiv.style.height="100%"; }; } }, PreviewBox: { dragapproved:false, offsetx:0,offsety:0,tempx:0,tempy:0,FrantDiv:undefined,PopDiv:undefined,ContentFrame:undefined, closeit:function(oSelf){ if (CLODOP.PreviewBox.PopDiv && CLODOP.PreviewBox.PopDiv.parentNode) CLODOP.PreviewBox.PopDiv.parentNode.removeChild(CLODOP.PreviewBox.PopDiv); if (this.FrantDiv&&this.FrantDiv.parentNode) this.FrantDiv.parentNode.removeChild(this.FrantDiv); this.PopDiv=undefined; }, initializedrag:function(e,oSelf){ var we=window.event || e; this.offsetx=we.clientX; this.offsety=we.clientY; this.tempx=parseInt(oSelf.style.left); this.tempy=parseInt(oSelf.style.top); this.dragapproved=true; }, drag_drop:function(e,oSelf){ if (!this.dragapproved) return; var we=window.event || e; oSelf.style.left=we.clientX-this.offsetx+this.tempx+"px"; oSelf.style.top=we.clientY-this.offsety+this.tempy+"px"; }, stopdrag:function(){ this.dragapproved=false; if (this.ContentFrame) this.ContentFrame.style.display="block"; }, create:function(strURL,iW,iH){ if (CLODOP.PreviewBox.PopDiv) this.closeit(); var obody=document.body || document.getElementsByTagName("body")[0] || document.documentElement; var vBoxDiv=document.createElement("div"); obody.appendChild(vBoxDiv); vBoxDiv.style.cssText="position:absolute;z-index:1100;display:block;top:2px;border:1px solid #6B97C1;font-size:13px;"; vBoxDiv.style.width=iW+"px"; var iLeft=(obody.offsetWidth-iW)/2; if (window.screen.width0)){ this.FrantDiv.style.width=obody.scrollWidth+"px"; this.FrantDiv.style.height=obody.scrollHeight+"px"; }else{ this.FrantDiv.style.width="100%"; this.FrantDiv.style.height="100%"; }; } } }; if (win.CLODOP2015_7028 && win.CLODOP2015_7028.Priority && win.CLODOP2015_7028.Priority>CLODOP.Priority) { CLODOP=win.CLODOP2015_7028; win.CLODOP_OK_Priority=win.CLODOP2015_7028.Priority; return; }; win.LODOP=CLODOP; win.CLODOP=CLODOP; win.CLODOP2015_7028=CLODOP; win.CLODOP_OK_Priority=CLODOP.Priority; win.CLODOP.DoInit(); if (navigator.userAgent.indexOf("Lodop")<0) win.CLODOP.OpenWebSocket(); })(window); function getCLodop(){ return window.CLODOP2015_7028; }; -------------------------------------------------------------------------------- /src/lib/LodopFuncs.js: -------------------------------------------------------------------------------- 1 | //====页面动态加载C-Lodop云打印必须的文件CLodopfuncs.js==== 2 | 3 | var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement; 4 | 5 | //让其它电脑的浏览器通过本机打印(仅适用C-Lodop自带的例子): 6 | var oscript = document.createElement("script"); 7 | oscript.src = "http://localhost:8000/CLodopfuncs.js"; 8 | head.insertBefore(oscript, head.firstChild); 9 | 10 | //让本机的浏览器打印(更优先一点): 11 | oscript = document.createElement("script"); 12 | oscript.src = "http://localhost:8000/CLodopfuncs.js?priority=2"; 13 | head.insertBefore(oscript, head.firstChild); 14 | 15 | //加载双端口(8000和18000)避免其中某个端口被占用: 16 | oscript = document.createElement("script"); 17 | oscript.src = "http://localhost:18000/CLodopfuncs.js?priority=1"; 18 | head.insertBefore(oscript, head.firstChild); 19 | 20 | 21 | //====获取LODOP对象的主过程:==== 22 | function getLodop(oOBJECT, oEMBED) { 23 | var LODOP; 24 | try { 25 | LODOP.SET_LICENSES("","647464550565952565559561289003","688858710010010811411756128900",""); 26 | try { 27 | LODOP = getCLodop(); 28 | } catch (err) {}; 29 | 30 | if (!LODOP && document.readyState !== "complete") { 31 | alert("C-Lodop没准备好,请稍后再试!"); 32 | return; 33 | }; 34 | 35 | //清理原例子内的object或embed元素,避免乱提示: 36 | if (oEMBED && oEMBED.parentNode) oEMBED.parentNode.removeChild(oEMBED); 37 | if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT); 38 | LODOP.SET_LICENSES("","647464550565952565559561289003","688858710010010811411756128900",""); 39 | return LODOP; 40 | } catch (err) { alert("getLodop出错:" + err); }; 41 | }; 42 | 43 | 44 | function needCLodop() { 45 | return true; 46 | }; 47 | export default { 48 | getLodop, 49 | needCLodop 50 | } 51 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import babelpolyfill from 'babel-polyfill' 2 | import Vue from 'vue' 3 | import App from './App' 4 | import VueRouter from 'vue-router' 5 | import store from './vuex/store' 6 | import Vuex from 'vuex' 7 | import routes from './routes' 8 | import Mock from './mock' 9 | import iview from 'iview' 10 | import 'iview/dist/styles/iview.css' 11 | import VueClipboard from 'vue-clipboard2' 12 | 13 | Mock.bootstrap(); 14 | 15 | Vue.use(VueClipboard) 16 | Vue.use(VueRouter) 17 | Vue.use(Vuex) 18 | Vue.use(iview) 19 | 20 | const router = new VueRouter({ 21 | routes 22 | }) 23 | 24 | router.beforeEach((to, from, next) => { 25 | if (to.path == '/login') { 26 | sessionStorage.removeItem('user'); 27 | } 28 | let user = JSON.parse(sessionStorage.getItem('user')); 29 | if (!user && to.path != '/login') { 30 | next({ path: '/login' }) 31 | } else { 32 | next() 33 | } 34 | }) 35 | 36 | //router.afterEach(transition => { 37 | //NProgress.done(); 38 | //}); 39 | 40 | new Vue({ 41 | el: '#app', 42 | template: '', 43 | router, 44 | store, 45 | components: { App } 46 | //render: h => h(Login) 47 | }).$mount('#app') 48 | 49 | //router.replace('/login') -------------------------------------------------------------------------------- /src/mock/index.js: -------------------------------------------------------------------------------- 1 | import mock from './mock'; 2 | 3 | export default mock; 4 | -------------------------------------------------------------------------------- /src/mock/mock.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | import MockAdapter from 'axios-mock-adapter'; 3 | import { LoginUsers, Users } from '../mockdata/user'; 4 | let _Users = Users; 5 | 6 | export default { 7 | /** 8 | * mock bootstrap 9 | */ 10 | bootstrap() { 11 | let mock = new MockAdapter(axios); 12 | 13 | // mock success request 14 | mock.onGet('/success').reply(200, { 15 | msg: 'success' 16 | }); 17 | 18 | // mock error request 19 | mock.onGet('/error').reply(500, { 20 | msg: 'failure' 21 | }); 22 | 23 | //登录 24 | mock.onPost('/login').reply(config => { 25 | let { username, password } = JSON.parse(config.data); 26 | return new Promise((resolve, reject) => { 27 | let user = null; 28 | setTimeout(() => { 29 | let hasUser = LoginUsers.some(u => { 30 | if (u.username === username && u.password === password) { 31 | user = JSON.parse(JSON.stringify(u)); 32 | user.password = undefined; 33 | return true; 34 | } 35 | }); 36 | 37 | if (hasUser) { 38 | resolve([200, { code: 200, msg: '请求成功', user }]); 39 | } else { 40 | resolve([200, { code: 500, msg: '账号或密码错误' }]); 41 | } 42 | }, 500); 43 | }); 44 | }); 45 | 46 | //获取用户列表 47 | mock.onGet('/user/list').reply(config => { 48 | let { name } = config.params; 49 | let mockUsers = _Users.filter(user => { 50 | if (name && user.name.indexOf(name) == -1) return false; 51 | return true; 52 | }); 53 | return new Promise((resolve, reject) => { 54 | setTimeout(() => { 55 | resolve([200, { 56 | users: mockUsers 57 | }]); 58 | }, 500); 59 | }); 60 | }); 61 | 62 | //获取用户列表(分页) 63 | mock.onGet('/user/listpage').reply(config => { 64 | let { page, name } = config.params; 65 | let mockUsers = _Users.filter(user => { 66 | if (name && user.name.indexOf(name) == -1) return false; 67 | return true; 68 | }); 69 | let total = mockUsers.length; 70 | mockUsers = mockUsers.filter((u, index) => index < 10 * page && index >= 10 * (page - 1)); 71 | return new Promise((resolve, reject) => { 72 | setTimeout(() => { 73 | resolve([200, { 74 | total: total, 75 | users: mockUsers 76 | }]); 77 | }, 500); 78 | }); 79 | }); 80 | 81 | //删除用户 82 | mock.onGet('/user/remove').reply(config => { 83 | let { id } = config.params; 84 | _Users = _Users.filter(u => u.id !== id); 85 | return new Promise((resolve, reject) => { 86 | setTimeout(() => { 87 | resolve([200, { 88 | code: 200, 89 | msg: '删除成功' 90 | }]); 91 | }, 500); 92 | }); 93 | }); 94 | 95 | //编辑用户 96 | mock.onGet('/user/edit').reply(config => { 97 | let { id, name, addr, age, birth, sex } = config.params; 98 | _Users.some(u => { 99 | if (u.id === id) { 100 | u.name = name; 101 | u.addr = addr; 102 | u.age = age; 103 | u.birth = birth; 104 | u.sex = sex; 105 | return true; 106 | } 107 | }); 108 | return new Promise((resolve, reject) => { 109 | setTimeout(() => { 110 | resolve([200, { 111 | code: 200, 112 | msg: '编辑成功' 113 | }]); 114 | }, 500); 115 | }); 116 | }); 117 | 118 | //新增用户 119 | mock.onGet('/user/add').reply(config => { 120 | let { name, addr, age, birth, sex } = config.params; 121 | _Users.push({ 122 | name: name, 123 | addr: addr, 124 | age: age, 125 | birth: birth, 126 | sex: sex 127 | }); 128 | return new Promise((resolve, reject) => { 129 | setTimeout(() => { 130 | resolve([200, { 131 | code: 200, 132 | msg: '新增成功' 133 | }]); 134 | }, 500); 135 | }); 136 | }); 137 | 138 | } 139 | }; -------------------------------------------------------------------------------- /src/mockdata/user.js: -------------------------------------------------------------------------------- 1 | import Mock from 'mockjs'; 2 | const LoginUsers = [{ 3 | id: 1, 4 | username: 'admin', 5 | password: '123456', 6 | avatar: 'https://raw.githubusercontent.com/taylorchen709/markdown-images/master/vueadmin/user.png', 7 | name: '张某某' 8 | }]; 9 | 10 | const Users = []; 11 | 12 | for (let i = 0; i < 86; i++) { 13 | Users.push(Mock.mock({ 14 | id: Mock.mock('@increment'), 15 | name: Mock.Random.cname(), 16 | addr: Mock.mock('@county(true)'), 17 | 'age|18-60': 1, 18 | birth: Mock.Random.date(), 19 | sex: Mock.Random.integer(0, 1) 20 | })); 21 | } 22 | 23 | export { LoginUsers, Users }; -------------------------------------------------------------------------------- /src/pages/404.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pages/Home.vue: -------------------------------------------------------------------------------- 1 | 89 | 167 | 168 | 255 | -------------------------------------------------------------------------------- /src/pages/Login.vue: -------------------------------------------------------------------------------- 1 | 2 | 38 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/pages/Main.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /src/pages/charts/echarts.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 187 | 188 | -------------------------------------------------------------------------------- /src/pages/nav1/Form.vue: -------------------------------------------------------------------------------- 1 | 56 | 75 | -------------------------------------------------------------------------------- /src/pages/nav1/Table.vue: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /src/pages/nav1/user.vue: -------------------------------------------------------------------------------- 1 | 4 | 58 | -------------------------------------------------------------------------------- /src/pages/nav2/Page4.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /src/pages/nav2/Page5.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 40 | -------------------------------------------------------------------------------- /src/pages/nav3/Page6.vue: -------------------------------------------------------------------------------- 1 | 15 | 180 | -------------------------------------------------------------------------------- /src/pages/print/endpage.vue: -------------------------------------------------------------------------------- 1 | 63 | 387 | -------------------------------------------------------------------------------- /src/pages/print/first.vue: -------------------------------------------------------------------------------- 1 | 47 | 205 | -------------------------------------------------------------------------------- /src/pages/print/firstpage.vue: -------------------------------------------------------------------------------- 1 | 94 | 396 | -------------------------------------------------------------------------------- /src/pages/print/index.vue: -------------------------------------------------------------------------------- 1 | 22 | -------------------------------------------------------------------------------- /src/pages/print/secondpage.vue: -------------------------------------------------------------------------------- 1 | 367 | 810 | -------------------------------------------------------------------------------- /src/routes.js: -------------------------------------------------------------------------------- 1 | import Login from './pages/Login.vue' 2 | import NotFound from './pages/404.vue' 3 | import Home from './pages/Home.vue' 4 | import Main from './pages/Main.vue' 5 | import Table from './pages/nav1/Table.vue' 6 | import Form from './pages/nav1/Form.vue' 7 | import user from './pages/nav1/user.vue' 8 | import Page4 from './pages/nav2/Page4.vue' 9 | import Page5 from './pages/nav2/Page5.vue' 10 | import Page6 from './pages/nav3/Page6.vue' 11 | import echarts from './pages/charts/echarts.vue' 12 | import printpage from "./pages/print/index.vue" 13 | import firstpage from "./pages/print/firstpage.vue" 14 | let routes = [{ 15 | path: '/login', 16 | component: Login, 17 | name: '', 18 | hidden: true 19 | }, 20 | { 21 | path: '/404', 22 | component: NotFound, 23 | name: '', 24 | hidden: true 25 | }, 26 | { 27 | path: '/', 28 | component: Home, 29 | name: '工作台', 30 | iconCls: 'ios-home', //图标样式class 31 | children: [ 32 | { path: '/main', component: Main, name: '主页', hidden: true }, 33 | { 34 | path: '/print', component: printpage, name: '打印证书', 35 | children: [ 36 | // UserHome will be rendered inside User's 37 | // when /user/:id is matched 38 | { 39 | path: 'page0', name: '打印首页', component: function (resolve) { 40 | require(["./pages/print/firstpage.vue"], resolve) 41 | } 42 | }, 43 | // { 44 | // path: 'page1', name: '打印第2页', component: function (resolve) { 45 | // require(["./pages/print/secondpage.vue"], resolve) 46 | // } 47 | // }, 48 | { path: 'page1', name: '打印第2页', component: function (resolve) { 49 | require(["./pages/print/thirdpage.vue"], resolve) 50 | } }, 51 | { path: 'page2', name: '打印第3页', component: function (resolve) { 52 | require(["./pages/print/fourthpage.vue"], resolve) 53 | } 54 | } 55 | 56 | ] 57 | }, 58 | 59 | ] 60 | }, 61 | { 62 | path: '/test', name: 'table', component: function (resolve) { 63 | require(["./pages/print/endpage.vue"], resolve) 64 | } 65 | }, 66 | // { 67 | // path: '/', 68 | // component: Home, 69 | // name: '导航二', 70 | // iconCls: 'ios-paw', 71 | // children: [ 72 | // { path: '/page4', component: Page4, name: '页面4' }, 73 | // { path: '/page5', component: Page5, name: '页面5' } 74 | // ] 75 | // }, 76 | // { 77 | // path: '/', 78 | // component: Home, 79 | // name: '', 80 | // iconCls: 'social-freebsd-devil', 81 | // leaf: true, //只有一个节点 82 | // children: [ 83 | // { path: '/page6', component: Page6, name: '证书打印' } 84 | // ] 85 | // }, 86 | /*{ 87 | path: '/', 88 | component: Home, 89 | name: '报表', 90 | iconCls: 'stats-bars', 91 | children: [ 92 | { path: '/echarts', component: echarts, name: 'echarts' } 93 | ] 94 | },*/ 95 | { 96 | path: '*', 97 | hidden: true, 98 | redirect: { path: '/print' } 99 | } 100 | ]; 101 | 102 | export default routes; 103 | -------------------------------------------------------------------------------- /src/vuex/actions.js: -------------------------------------------------------------------------------- 1 | //test 2 | export const increment = ({commit}) => { 3 | commit('INCREMENT') 4 | } 5 | export const decrement = ({commit}) => { 6 | commit('DECREMENT') 7 | } 8 | export const update_currentData = ({commit},attr) => { 9 | 10 | commit('UPDATE_CURRENTDATA',attr) 11 | } 12 | -------------------------------------------------------------------------------- /src/vuex/getters.js: -------------------------------------------------------------------------------- 1 | //test 2 | export const getCount = state => { 3 | return state.count 4 | } 5 | export const get_currentData = state => { 6 | return state.currentData 7 | } 8 | -------------------------------------------------------------------------------- /src/vuex/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import * as actions from './actions' 4 | import * as getters from './getters' 5 | 6 | Vue.use(Vuex) 7 | 8 | // 应用初始状态 9 | const state = { 10 | count: 10, 11 | currentData: {} 12 | } 13 | 14 | // 定义所需的 mutations 15 | const mutations = { 16 | INCREMENT(state) { 17 | state.count++ 18 | }, 19 | DECREMENT(state) { 20 | state.count-- 21 | }, 22 | UPDATE_CURRENTDATA(state,params){ 23 | 24 | state.currentData[params.attrName] = params.value 25 | } 26 | } 27 | 28 | // 创建 store 实例 29 | export default new Vuex.Store({ 30 | actions, 31 | getters, 32 | state, 33 | mutations 34 | }) -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/static/.gitkeep -------------------------------------------------------------------------------- /static/内容.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/static/内容.png -------------------------------------------------------------------------------- /static/首页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dukelyuu/print-vue2-iview-admin/4862c9d201cc63a9f595e77e587ad3c41f8b2d40/static/首页.png --------------------------------------------------------------------------------