工单作业
28
.babelrc
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"modules": false,
|
||||
"targets": {
|
||||
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
|
||||
}
|
||||
}],
|
||||
"stage-2"
|
||||
],
|
||||
"plugins": [
|
||||
"transform-vue-jsx",
|
||||
"transform-runtime",
|
||||
[
|
||||
"component",
|
||||
{
|
||||
"libraryName": "element-ui",
|
||||
"styleLibraryName": "theme-chalk"
|
||||
}
|
||||
]
|
||||
],
|
||||
"env": {
|
||||
"test": {
|
||||
"presets": ["env", "stage-2"],
|
||||
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
|
||||
}
|
||||
}
|
||||
}
|
||||
9
.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
5
.eslintignore
Normal file
@@ -0,0 +1,5 @@
|
||||
/build/
|
||||
/config/
|
||||
/dist/
|
||||
/*.js
|
||||
/test/unit/coverage/
|
||||
29
.eslintrc.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// https://eslint.org/docs/user-guide/configuring
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
parser: 'babel-eslint'
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
extends: [
|
||||
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
|
||||
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
|
||||
'plugin:vue/essential',
|
||||
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
|
||||
'standard'
|
||||
],
|
||||
// required to lint *.vue files
|
||||
plugins: [
|
||||
'vue'
|
||||
],
|
||||
// add your custom rules here
|
||||
rules: {
|
||||
// allow async-await
|
||||
'generator-star-spacing': 'off',
|
||||
// allow debugger during development
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
|
||||
}
|
||||
}
|
||||
17
.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
/dist/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
/test/unit/coverage/
|
||||
/test/e2e/reports/
|
||||
selenium-debug.log
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
10
.postcssrc.js
Normal file
@@ -0,0 +1,10 @@
|
||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||
|
||||
module.exports = {
|
||||
"plugins": {
|
||||
"postcss-import": {},
|
||||
"postcss-url": {},
|
||||
// to edit target browsers: use "browserslist" field in package.json
|
||||
"autoprefixer": {}
|
||||
}
|
||||
}
|
||||
34
README.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# nl-aio-hl
|
||||
|
||||
> A Vue.js project
|
||||
|
||||
## Build Setup
|
||||
|
||||
``` bash
|
||||
# install dependencies
|
||||
npm install
|
||||
|
||||
# serve with hot reload at localhost:8080
|
||||
npm run dev
|
||||
|
||||
# build for production with minification
|
||||
npm run build
|
||||
|
||||
# build for production and view the bundle analyzer report
|
||||
npm run build --report
|
||||
|
||||
# run unit tests
|
||||
npm run unit
|
||||
|
||||
# run e2e tests
|
||||
npm run e2e
|
||||
|
||||
# run all tests
|
||||
npm test
|
||||
```
|
||||
|
||||
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
|
||||
|
||||
# 注意事项
|
||||
+ 一体机尺寸1920*1080
|
||||
+ http://47.98.105.245:8001/project/57/interface/api/cat_104
|
||||
41
build/build.js
Normal file
@@ -0,0 +1,41 @@
|
||||
'use strict'
|
||||
require('./check-versions')()
|
||||
|
||||
process.env.NODE_ENV = 'production'
|
||||
|
||||
const ora = require('ora')
|
||||
const rm = require('rimraf')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const webpackConfig = require('./webpack.prod.conf')
|
||||
|
||||
const spinner = ora('building for production...')
|
||||
spinner.start()
|
||||
|
||||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
||||
if (err) throw err
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
spinner.stop()
|
||||
if (err) throw err
|
||||
process.stdout.write(stats.toString({
|
||||
colors: true,
|
||||
modules: false,
|
||||
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
||||
chunks: false,
|
||||
chunkModules: false
|
||||
}) + '\n\n')
|
||||
|
||||
if (stats.hasErrors()) {
|
||||
console.log(chalk.red(' Build failed with errors.\n'))
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log(chalk.cyan(' Build complete.\n'))
|
||||
console.log(chalk.yellow(
|
||||
' Tip: built files are meant to be served over an HTTP server.\n' +
|
||||
' Opening index.html over file:// won\'t work.\n'
|
||||
))
|
||||
})
|
||||
})
|
||||
54
build/check-versions.js
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
const chalk = require('chalk')
|
||||
const semver = require('semver')
|
||||
const packageConfig = require('../package.json')
|
||||
const shell = require('shelljs')
|
||||
|
||||
function exec (cmd) {
|
||||
return require('child_process').execSync(cmd).toString().trim()
|
||||
}
|
||||
|
||||
const versionRequirements = [
|
||||
{
|
||||
name: 'node',
|
||||
currentVersion: semver.clean(process.version),
|
||||
versionRequirement: packageConfig.engines.node
|
||||
}
|
||||
]
|
||||
|
||||
if (shell.which('npm')) {
|
||||
versionRequirements.push({
|
||||
name: 'npm',
|
||||
currentVersion: exec('npm --version'),
|
||||
versionRequirement: packageConfig.engines.npm
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
const warnings = []
|
||||
|
||||
for (let i = 0; i < versionRequirements.length; i++) {
|
||||
const mod = versionRequirements[i]
|
||||
|
||||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
||||
warnings.push(mod.name + ': ' +
|
||||
chalk.red(mod.currentVersion) + ' should be ' +
|
||||
chalk.green(mod.versionRequirement)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (warnings.length) {
|
||||
console.log('')
|
||||
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
||||
console.log()
|
||||
|
||||
for (let i = 0; i < warnings.length; i++) {
|
||||
const warning = warnings[i]
|
||||
console.log(' ' + warning)
|
||||
}
|
||||
|
||||
console.log()
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
BIN
build/logo.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
102
build/utils.js
Normal file
@@ -0,0 +1,102 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const config = require('../config')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const packageConfig = require('../package.json')
|
||||
|
||||
exports.assetsPath = function (_path) {
|
||||
const assetsSubDirectory = process.env.NODE_ENV === 'production'
|
||||
? config.build.assetsSubDirectory
|
||||
: config.dev.assetsSubDirectory
|
||||
|
||||
return path.posix.join(assetsSubDirectory, _path)
|
||||
}
|
||||
|
||||
exports.cssLoaders = function (options) {
|
||||
options = options || {}
|
||||
|
||||
const cssLoader = {
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: options.sourceMap
|
||||
}
|
||||
}
|
||||
|
||||
const postcssLoader = {
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: options.sourceMap
|
||||
}
|
||||
}
|
||||
|
||||
// generate loader string to be used with extract text plugin
|
||||
function generateLoaders (loader, loaderOptions) {
|
||||
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
|
||||
|
||||
if (loader) {
|
||||
loaders.push({
|
||||
loader: loader + '-loader',
|
||||
options: Object.assign({}, loaderOptions, {
|
||||
sourceMap: options.sourceMap
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Extract CSS when that option is specified
|
||||
// (which is the case during production build)
|
||||
if (options.extract) {
|
||||
return ExtractTextPlugin.extract({
|
||||
use: loaders,
|
||||
publicPath: '../../',
|
||||
fallback: 'vue-style-loader'
|
||||
})
|
||||
} else {
|
||||
return ['vue-style-loader'].concat(loaders)
|
||||
}
|
||||
}
|
||||
|
||||
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
||||
return {
|
||||
css: generateLoaders(),
|
||||
postcss: generateLoaders(),
|
||||
less: generateLoaders('less'),
|
||||
sass: generateLoaders('sass', { indentedSyntax: true }),
|
||||
scss: generateLoaders('sass'),
|
||||
stylus: generateLoaders('stylus'),
|
||||
styl: generateLoaders('stylus')
|
||||
}
|
||||
}
|
||||
|
||||
// Generate loaders for standalone style files (outside of .vue)
|
||||
exports.styleLoaders = function (options) {
|
||||
const output = []
|
||||
const loaders = exports.cssLoaders(options)
|
||||
|
||||
for (const extension in loaders) {
|
||||
const loader = loaders[extension]
|
||||
output.push({
|
||||
test: new RegExp('\\.' + extension + '$'),
|
||||
use: loader
|
||||
})
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
exports.createNotifierCallback = () => {
|
||||
const notifier = require('node-notifier')
|
||||
|
||||
return (severity, errors) => {
|
||||
if (severity !== 'error') return
|
||||
|
||||
const error = errors[0]
|
||||
const filename = error.file && error.file.split('!').pop()
|
||||
|
||||
notifier.notify({
|
||||
title: packageConfig.name,
|
||||
message: severity + ': ' + error.name,
|
||||
subtitle: filename || '',
|
||||
icon: path.join(__dirname, 'logo.png')
|
||||
})
|
||||
}
|
||||
}
|
||||
22
build/vue-loader.conf.js
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const isProduction = process.env.NODE_ENV === 'production'
|
||||
const sourceMapEnabled = isProduction
|
||||
? config.build.productionSourceMap
|
||||
: config.dev.cssSourceMap
|
||||
|
||||
module.exports = {
|
||||
loaders: utils.cssLoaders({
|
||||
sourceMap: sourceMapEnabled,
|
||||
extract: isProduction
|
||||
}),
|
||||
cssSourceMap: sourceMapEnabled,
|
||||
cacheBusting: config.dev.cacheBusting,
|
||||
transformToRequire: {
|
||||
video: ['src', 'poster'],
|
||||
source: 'src',
|
||||
img: 'src',
|
||||
image: 'xlink:href'
|
||||
}
|
||||
}
|
||||
97
build/webpack.base.conf.js
Normal file
@@ -0,0 +1,97 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const vueLoaderConfig = require('./vue-loader.conf')
|
||||
|
||||
function resolve (dir) {
|
||||
return path.join(__dirname, '..', dir)
|
||||
}
|
||||
|
||||
const createLintingRule = () => ({
|
||||
test: /\.(js|vue)$/,
|
||||
loader: 'eslint-loader',
|
||||
enforce: 'pre',
|
||||
include: [resolve('src'), resolve('test')],
|
||||
options: {
|
||||
formatter: require('eslint-friendly-formatter'),
|
||||
emitWarning: !config.dev.showEslintErrorsInOverlay
|
||||
}
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
context: path.resolve(__dirname, '../'),
|
||||
entry: {
|
||||
app: './src/main.js'
|
||||
},
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: '[name].js',
|
||||
publicPath: process.env.NODE_ENV === 'production'
|
||||
? config.build.assetsPublicPath
|
||||
: config.dev.assetsPublicPath
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
alias: {
|
||||
'vue$': 'vue/dist/vue.esm.js',
|
||||
'@': resolve('src'),
|
||||
'@page': resolve('src') + '/pages',
|
||||
'@components': resolve('src') + '/components',
|
||||
'@style': resolve('src') + '/style',
|
||||
'@images': resolve('src') + '/images',
|
||||
'@config': resolve('src') + '/config'
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
...(config.dev.useEslint ? [createLintingRule()] : []),
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: vueLoaderConfig
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
node: {
|
||||
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
||||
// source contains it (although only uses it if it's native).
|
||||
setImmediate: false,
|
||||
// prevent webpack from injecting mocks to Node native modules
|
||||
// that does not make sense for the client
|
||||
dgram: 'empty',
|
||||
fs: 'empty',
|
||||
net: 'empty',
|
||||
tls: 'empty',
|
||||
child_process: 'empty'
|
||||
}
|
||||
}
|
||||
95
build/webpack.dev.conf.js
Executable file
@@ -0,0 +1,95 @@
|
||||
'use strict'
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const path = require('path')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
||||
const portfinder = require('portfinder')
|
||||
|
||||
const HOST = process.env.HOST
|
||||
const PORT = process.env.PORT && Number(process.env.PORT)
|
||||
|
||||
const devWebpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
|
||||
},
|
||||
// cheap-module-eval-source-map is faster for development
|
||||
devtool: config.dev.devtool,
|
||||
|
||||
// these devServer options should be customized in /config/index.js
|
||||
devServer: {
|
||||
clientLogLevel: 'warning',
|
||||
historyApiFallback: {
|
||||
rewrites: [
|
||||
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
|
||||
],
|
||||
},
|
||||
hot: true,
|
||||
contentBase: false, // since we use CopyWebpackPlugin.
|
||||
compress: true,
|
||||
host: HOST || config.dev.host,
|
||||
port: PORT || config.dev.port,
|
||||
open: config.dev.autoOpenBrowser,
|
||||
overlay: config.dev.errorOverlay
|
||||
? { warnings: false, errors: true }
|
||||
: false,
|
||||
publicPath: config.dev.assetsPublicPath,
|
||||
proxy: config.dev.proxyTable,
|
||||
quiet: true, // necessary for FriendlyErrorsPlugin
|
||||
watchOptions: {
|
||||
poll: config.dev.poll,
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': require('../config/dev.env')
|
||||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
// https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'index.html',
|
||||
template: 'index.html',
|
||||
inject: true
|
||||
}),
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.dev.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
||||
module.exports = new Promise((resolve, reject) => {
|
||||
portfinder.basePort = process.env.PORT || config.dev.port
|
||||
portfinder.getPort((err, port) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
} else {
|
||||
// publish the new Port, necessary for e2e tests
|
||||
process.env.PORT = port
|
||||
// add port to devServer config
|
||||
devWebpackConfig.devServer.port = port
|
||||
|
||||
// Add FriendlyErrorsPlugin
|
||||
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
|
||||
compilationSuccessInfo: {
|
||||
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
|
||||
},
|
||||
onErrors: config.dev.notifyOnErrors
|
||||
? utils.createNotifierCallback()
|
||||
: undefined
|
||||
}))
|
||||
|
||||
resolve(devWebpackConfig)
|
||||
}
|
||||
})
|
||||
})
|
||||
149
build/webpack.prod.conf.js
Normal file
@@ -0,0 +1,149 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||
|
||||
const env = process.env.NODE_ENV === 'testing'
|
||||
? require('../config/test.env')
|
||||
: require('../config/prod.env')
|
||||
|
||||
const webpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
extract: true,
|
||||
usePostCSS: true
|
||||
})
|
||||
},
|
||||
devtool: config.build.productionSourceMap ? config.build.devtool : false,
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
||||
},
|
||||
plugins: [
|
||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': env
|
||||
}),
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
},
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
parallel: true
|
||||
}),
|
||||
// extract css into its own file
|
||||
new ExtractTextPlugin({
|
||||
filename: utils.assetsPath('css/[name].[contenthash].css'),
|
||||
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
||||
allChunks: true,
|
||||
}),
|
||||
// Compress extracted CSS. We are using this plugin so that possible
|
||||
// duplicated CSS from different components can be deduped.
|
||||
new OptimizeCSSPlugin({
|
||||
cssProcessorOptions: config.build.productionSourceMap
|
||||
? { safe: true, map: { inline: false } }
|
||||
: { safe: true }
|
||||
}),
|
||||
// generate dist index.html with correct asset hash for caching.
|
||||
// you can customize output by editing /index.html
|
||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({
|
||||
filename: process.env.NODE_ENV === 'testing'
|
||||
? 'index.html'
|
||||
: config.build.index,
|
||||
template: 'index.html',
|
||||
inject: true,
|
||||
minify: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
removeAttributeQuotes: true
|
||||
// more options:
|
||||
// https://github.com/kangax/html-minifier#options-quick-reference
|
||||
},
|
||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
||||
chunksSortMode: 'dependency'
|
||||
}),
|
||||
// keep module.id stable when vendor modules does not change
|
||||
new webpack.HashedModuleIdsPlugin(),
|
||||
// enable scope hoisting
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
// split vendor js into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
minChunks (module) {
|
||||
// any required modules inside node_modules are extracted to vendor
|
||||
return (
|
||||
module.resource &&
|
||||
/\.js$/.test(module.resource) &&
|
||||
module.resource.indexOf(
|
||||
path.join(__dirname, '../node_modules')
|
||||
) === 0
|
||||
)
|
||||
}
|
||||
}),
|
||||
// extract webpack runtime and module manifest to its own file in order to
|
||||
// prevent vendor hash from being updated whenever app bundle is updated
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
minChunks: Infinity
|
||||
}),
|
||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
||||
// in a separate chunk, similar to the vendor chunk
|
||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'app',
|
||||
async: 'vendor-async',
|
||||
children: true,
|
||||
minChunks: 3
|
||||
}),
|
||||
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.build.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
||||
if (config.build.productionGzip) {
|
||||
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||
|
||||
webpackConfig.plugins.push(
|
||||
new CompressionWebpackPlugin({
|
||||
asset: '[path].gz[query]',
|
||||
algorithm: 'gzip',
|
||||
test: new RegExp(
|
||||
'\\.(' +
|
||||
config.build.productionGzipExtensions.join('|') +
|
||||
')$'
|
||||
),
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
if (config.build.bundleAnalyzerReport) {
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
||||
}
|
||||
|
||||
module.exports = webpackConfig
|
||||
7
config/dev.env.js
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
const merge = require('webpack-merge')
|
||||
const prodEnv = require('./prod.env')
|
||||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"'
|
||||
})
|
||||
76
config/index.js
Normal file
@@ -0,0 +1,76 @@
|
||||
'use strict'
|
||||
// Template version: 1.3.1
|
||||
// see http://vuejs-templates.github.io/webpack for documentation.
|
||||
|
||||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
dev: {
|
||||
|
||||
// Paths
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
proxyTable: {},
|
||||
|
||||
// Various Dev Server settings
|
||||
host: '0.0.0.0', // can be overwritten by process.env.HOST
|
||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
autoOpenBrowser: false,
|
||||
errorOverlay: true,
|
||||
notifyOnErrors: true,
|
||||
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
||||
|
||||
// Use Eslint Loader?
|
||||
// If true, your code will be linted during bundling and
|
||||
// linting errors and warnings will be shown in the console.
|
||||
useEslint: true,
|
||||
// If true, eslint errors and warnings will also be shown in the error overlay
|
||||
// in the browser.
|
||||
showEslintErrorsInOverlay: false,
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
*/
|
||||
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
|
||||
// If you have problems debugging vue-files in devtools,
|
||||
// set this to false - it *may* help
|
||||
// https://vue-loader.vuejs.org/en/options.html#cachebusting
|
||||
cacheBusting: true,
|
||||
|
||||
cssSourceMap: true
|
||||
},
|
||||
|
||||
build: {
|
||||
// Template for index.html
|
||||
index: path.resolve(__dirname, '../dist/index.html'),
|
||||
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: './',
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
*/
|
||||
|
||||
productionSourceMap: true,
|
||||
// https://webpack.js.org/configuration/devtool/#production
|
||||
devtool: '#source-map',
|
||||
|
||||
// Gzip off by default as many popular static hosts such as
|
||||
// Surge or Netlify already gzip all static assets for you.
|
||||
// Before setting to `true`, make sure to:
|
||||
// npm install --save-dev compression-webpack-plugin
|
||||
productionGzip: false,
|
||||
productionGzipExtensions: ['js', 'css'],
|
||||
|
||||
// Run the build command with an extra argument to
|
||||
// View the bundle analyzer report after build finishes:
|
||||
// `npm run build --report`
|
||||
// Set to `true` or `false` to always turn it on or off
|
||||
bundleAnalyzerReport: process.env.npm_config_report
|
||||
}
|
||||
}
|
||||
4
config/prod.env.js
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict'
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"'
|
||||
}
|
||||
7
config/test.env.js
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
const merge = require('webpack-merge')
|
||||
const devEnv = require('./dev.env')
|
||||
|
||||
module.exports = merge(devEnv, {
|
||||
NODE_ENV: '"testing"'
|
||||
})
|
||||
12
index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<title>山东金宝一体机</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
96
package.json
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"name": "nl-aio-hl",
|
||||
"version": "1.0.0",
|
||||
"description": "A Vue.js project",
|
||||
"author": "",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
|
||||
"start": "npm run dev",
|
||||
"unit": "jest --config test/unit/jest.conf.js --coverage",
|
||||
"e2e": "node test/e2e/runner.js",
|
||||
"test": "npm run unit && npm run e2e",
|
||||
"lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
|
||||
"build": "node build/build.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"element-ui": "^2.8.2",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"vue": "^2.5.2",
|
||||
"vue-router": "^3.0.1",
|
||||
"vue-seamless-scroll": "^1.1.23",
|
||||
"vuex": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^7.1.2",
|
||||
"babel-core": "^6.22.1",
|
||||
"babel-eslint": "^8.2.1",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
||||
"babel-jest": "^21.0.2",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-plugin-component": "^1.1.1",
|
||||
"babel-plugin-dynamic-import-node": "^1.2.0",
|
||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
|
||||
"babel-plugin-transform-runtime": "^6.22.0",
|
||||
"babel-plugin-transform-vue-jsx": "^3.5.0",
|
||||
"babel-preset-env": "^1.3.2",
|
||||
"babel-preset-stage-2": "^6.22.0",
|
||||
"babel-register": "^6.22.0",
|
||||
"chalk": "^2.0.1",
|
||||
"chromedriver": "^2.27.2",
|
||||
"copy-webpack-plugin": "^4.0.1",
|
||||
"cross-spawn": "^5.0.1",
|
||||
"css-loader": "^0.28.0",
|
||||
"eslint": "^4.15.0",
|
||||
"eslint-config-standard": "^10.2.1",
|
||||
"eslint-friendly-formatter": "^3.0.0",
|
||||
"eslint-loader": "^1.7.1",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"eslint-plugin-node": "^5.2.0",
|
||||
"eslint-plugin-promise": "^3.4.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"eslint-plugin-vue": "^4.0.0",
|
||||
"extract-text-webpack-plugin": "^3.0.0",
|
||||
"file-loader": "^1.1.4",
|
||||
"friendly-errors-webpack-plugin": "^1.6.1",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"jest": "^22.0.4",
|
||||
"jest-serializer-vue": "^0.3.0",
|
||||
"nightwatch": "^0.9.12",
|
||||
"node-notifier": "^5.1.2",
|
||||
"optimize-css-assets-webpack-plugin": "^3.2.0",
|
||||
"ora": "^1.2.0",
|
||||
"portfinder": "^1.0.13",
|
||||
"postcss-import": "^11.0.0",
|
||||
"postcss-loader": "^2.0.8",
|
||||
"postcss-url": "^7.2.1",
|
||||
"rimraf": "^2.6.0",
|
||||
"selenium-server": "^3.0.1",
|
||||
"semver": "^5.3.0",
|
||||
"shelljs": "^0.7.6",
|
||||
"stylus": "^0.54.5",
|
||||
"stylus-loader": "^3.0.2",
|
||||
"uglifyjs-webpack-plugin": "^1.1.1",
|
||||
"url-loader": "^0.5.8",
|
||||
"vue-jest": "^1.0.2",
|
||||
"vue-loader": "^13.3.0",
|
||||
"vue-style-loader": "^3.0.1",
|
||||
"vue-template-compiler": "^2.5.2",
|
||||
"webpack": "^3.6.0",
|
||||
"webpack-bundle-analyzer": "^2.9.0",
|
||||
"webpack-dev-server": "^2.9.1",
|
||||
"webpack-merge": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not ie <= 8"
|
||||
]
|
||||
}
|
||||
17
src/App.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'App'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
#app
|
||||
width 100%
|
||||
height 100%
|
||||
</style>
|
||||
71
src/components/header.vue
Normal file
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<header class="zd-row">
|
||||
<div class="zd-col-8 zd-row jcflexstart">
|
||||
<div v-if="!type" class="exit_btn" @click="toExit">退出</div>
|
||||
<div v-if="type" class="exit_btn" @click="toBack">返回</div>
|
||||
</div>
|
||||
<div class="zd-col-8 title_1">{{ title }}</div>
|
||||
<div class="zd-col-8">
|
||||
<jxTime></jxTime>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import jxTime from '@components/time.vue'
|
||||
export default {
|
||||
name: 'jxHeader',
|
||||
components: {
|
||||
jxTime
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String
|
||||
},
|
||||
type: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toExit () {
|
||||
let flag = !!(document.fullscreenElement || document.mozFullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement)
|
||||
if (flag) {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen()
|
||||
} else if (document.webkitCancelFullScreen) {
|
||||
document.webkitCancelFullScreen()
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen()
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen()
|
||||
}
|
||||
}
|
||||
this.$router.push('/setup')
|
||||
},
|
||||
toBack () {
|
||||
this.$router.back()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '~@style/mixin'
|
||||
.exit_btn
|
||||
width auto
|
||||
height .43rem
|
||||
padding 0 .14rem
|
||||
border 1px solid #68AFF4
|
||||
background linear-gradient(to bottom, #152B56, #1B4181)
|
||||
_font(.2rem,.43rem, #fff,,)
|
||||
.title_1
|
||||
_font(.4rem, .77rem, #8DBFEE, bold, center)
|
||||
font-family SourceHanSansCN-Bold
|
||||
font-style italic
|
||||
background linear-gradient(0deg, #A2C3E3 0%, #5E9ED9 11.9140625%, #A2C3E3 100%)
|
||||
-webkit-background-clip text
|
||||
-webkit-text-fill-color transparent
|
||||
border-bottom 0
|
||||
padding 0
|
||||
</style>
|
||||
105
src/components/time.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<div class="container zd-row flexcol alignend">
|
||||
<div class="date-wraper">{{hours}}:{{minutes}}:{{seconds}}</div>
|
||||
<div class="time-wraper">{{date}}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'jxTime',
|
||||
data () {
|
||||
return {
|
||||
timer: null,
|
||||
time: '',
|
||||
hours: '',
|
||||
minutes: '',
|
||||
seconds: '',
|
||||
date: '',
|
||||
week: ''
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.updateTime()
|
||||
// this.timer = window.setInterval(this.updateTime, 1000)
|
||||
},
|
||||
methods: {
|
||||
updateTime () {
|
||||
let cd = new Date()
|
||||
let year = cd.getFullYear()
|
||||
let month = cd.getMonth() + 1 < 10 ? '0' + (cd.getMonth() + 1) : cd.getMonth() + 1
|
||||
let date = cd.getDate() < 10 ? '0' + cd.getDate() : cd.getDate()
|
||||
let hh = cd.getHours() < 10 ? '0' + cd.getHours() : cd.getHours()
|
||||
let mm = cd.getMinutes() < 10 ? '0' + cd.getMinutes() : cd.getMinutes()
|
||||
let ss = cd.getSeconds() < 10 ? '0' + cd.getSeconds() : cd.getSeconds()
|
||||
var weekday = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
|
||||
let myddy = new Date().getDay()
|
||||
let week = weekday[myddy]
|
||||
this.time = `${hh}:${mm}:${ss}`
|
||||
this.hours = `${hh}`
|
||||
this.minutes = `${mm}`
|
||||
this.seconds = `${ss}`
|
||||
this.date = `${year} - ${month} - ${date}`
|
||||
// if (this.$i18n.locale === 'en-us') {
|
||||
// let enMonth = ''
|
||||
// switch (month) {
|
||||
// case 1:
|
||||
// enMonth = 'Jan.'
|
||||
// break
|
||||
// case 2:
|
||||
// enMonth = 'Feb.'
|
||||
// break
|
||||
// case 3:
|
||||
// enMonth = 'Mar.'
|
||||
// break
|
||||
// case 4:
|
||||
// enMonth = 'Apr.'
|
||||
// break
|
||||
// case 5:
|
||||
// enMonth = 'May'
|
||||
// break
|
||||
// case 6:
|
||||
// enMonth = 'Jun.'
|
||||
// break
|
||||
// case 7:
|
||||
// enMonth = 'Jul.'
|
||||
// break
|
||||
// case 8:
|
||||
// enMonth = 'Aug.'
|
||||
// break
|
||||
// case 9:
|
||||
// enMonth = 'Sep.'
|
||||
// break
|
||||
// case 10:
|
||||
// enMonth = 'Oct.'
|
||||
// break
|
||||
// case 11:
|
||||
// enMonth = 'Nov.'
|
||||
// break
|
||||
// case 12:
|
||||
// enMonth = 'Dec.'
|
||||
// break
|
||||
// }
|
||||
// this.date = `${date}th ${enMonth}, ${year}`
|
||||
// }
|
||||
this.week = `${week}`
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$once('hook:beforeDestroy', () => {
|
||||
clearInterval(this.timer)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '~@style/mixin'
|
||||
.date-wraper
|
||||
_font(.25rem, .25rem, #e1e9f4,,right)
|
||||
font-family SourceHanSansCN-Regular
|
||||
.time-wraper
|
||||
_font(.16rem, .16rem, #e1e9f4,,right)
|
||||
font-family SourceHanSansCN-Regular
|
||||
margin-top .1rem
|
||||
</style>
|
||||
35
src/config/getData.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import {post} from '@config/http.js'
|
||||
|
||||
// 查询设备
|
||||
export const queryDevices = () => post('api/pda/queryDevices', {})
|
||||
// 工单查询
|
||||
export const queryOrders = (code) => post('api/pda/queryOrders', {
|
||||
device_code: code
|
||||
})
|
||||
// 开始工单
|
||||
export const startOrder = (code, order) => post('api/pda/startOrder', {
|
||||
device_code: code,
|
||||
mfg_order_name: order
|
||||
})
|
||||
// 强制完成
|
||||
export const forceFinish = (order) => post('api/pda/forceFinish', {
|
||||
mfg_order_name: order
|
||||
})
|
||||
// 配料作业查询
|
||||
export const queryWorks = () => post('api/pda/queryWorks', {})
|
||||
// 下发配料作业
|
||||
export const sendWork = (code) => post('api/pda/sendWork', {
|
||||
work_code: code
|
||||
})
|
||||
// 补发配料作业
|
||||
export const reSendWork = (code) => post('api/pda/reSendWork', {
|
||||
work_code: code
|
||||
})
|
||||
// 完成配料作业
|
||||
export const finishWork = (code) => post('api/pda/finishWork', {
|
||||
work_code: code
|
||||
})
|
||||
// 暂停配料作业
|
||||
export const pdaPause = (code) => post('api/pda/pause', {
|
||||
work_code: code
|
||||
})
|
||||
80
src/config/http.js
Normal file
@@ -0,0 +1,80 @@
|
||||
import Vue from 'vue'
|
||||
import axios from 'axios'
|
||||
import store from '../vuex/store'
|
||||
import router from '@/router'
|
||||
|
||||
axios.defaults.timeout = 5000
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
|
||||
|
||||
axios.interceptors.request.use(
|
||||
config => {
|
||||
let token = ''
|
||||
if (store.getters.saveToken !== '') {
|
||||
token = store.getters.saveToken
|
||||
}
|
||||
token && (config.headers.Authorization = token)
|
||||
if (config.method === 'post') {
|
||||
if (!config.data.flag) {
|
||||
config.data = config.data
|
||||
} else {
|
||||
config.data = config.data.formData
|
||||
}
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
axios.interceptors.response.use(
|
||||
response => {
|
||||
return Promise.resolve(response)
|
||||
},
|
||||
error => {
|
||||
if (error && error.response) {
|
||||
switch (error.response.status) {
|
||||
case 400:
|
||||
break
|
||||
case 401:
|
||||
router.push('/login')
|
||||
break
|
||||
}
|
||||
return Promise.reject(error.response.data)
|
||||
} else {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
export const post = (sevmethod, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(`${store.getters.baseUrl}/` + sevmethod, params)
|
||||
.then(response => {
|
||||
resolve(response.data)
|
||||
}, error => {
|
||||
Vue.prototype.$message({
|
||||
message: error,
|
||||
type: 'error'
|
||||
})
|
||||
reject(error)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const get = (sevmethod, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${store.getters.baseUrl}/` + sevmethod + params)
|
||||
.then(response => {
|
||||
resolve(response.data)
|
||||
}, error => {
|
||||
reject(error)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
17
src/config/mork.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// 1.1查询所有设备
|
||||
export const queryDevices = () => {
|
||||
let res = [{device_code: '10001', device_name: '车号1'}, {device_code: '2', device_name: '车号2'}]
|
||||
return res
|
||||
}
|
||||
export const queryOrders = () => {
|
||||
let res = [{mfg_order_name: '001'}, {mfg_order_name: '2'}, {mfg_order_name: '3'}, {mfg_order_name: '4'}]
|
||||
return res
|
||||
}
|
||||
export const startOrder = (code, order) => {
|
||||
let res = {message: 'ok'}
|
||||
return res
|
||||
}
|
||||
export const queryWorks = () => {
|
||||
let res = [{mfg_order_name: '001'}, {mfg_order_name: '2'}, {mfg_order_name: '3'}, {mfg_order_name: '4'}]
|
||||
return res
|
||||
}
|
||||
13
src/config/rem.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// 800 * 600
|
||||
(function (doc, win) {
|
||||
var docEl = doc.documentElement
|
||||
var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
|
||||
var recalc = function () {
|
||||
var clientWidth = docEl.clientWidth
|
||||
if (!clientWidth) return
|
||||
docEl.style.fontSize = 100 * (clientWidth / 1920) + 'px'
|
||||
}
|
||||
if (!doc.addEventListener) return
|
||||
win.addEventListener(resizeEvt, recalc, false)
|
||||
doc.addEventListener('DOMContentLoaded', recalc, false)
|
||||
})(document, window)
|
||||
143
src/config/utils.js
Normal file
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* 存储localStorage
|
||||
*/
|
||||
export const setStore = (name, content) => {
|
||||
if (!name) return
|
||||
if (typeof content !== 'string') {
|
||||
content = JSON.stringify(content)
|
||||
}
|
||||
window.localStorage.setItem(name, content)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取localStorage
|
||||
*/
|
||||
export const getStore = name => {
|
||||
if (!name) return
|
||||
return window.localStorage.getItem(name)
|
||||
}
|
||||
|
||||
/**
|
||||
* yy-mm-dd
|
||||
*/
|
||||
export const dateFtt = date => {
|
||||
if (date == null) {
|
||||
return ''
|
||||
}
|
||||
let year = date.getFullYear()
|
||||
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
||||
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
/**
|
||||
* yy-mm-dd hh:mm:ss
|
||||
*/
|
||||
export const dateTimeFtt = date => {
|
||||
if (date == null) {
|
||||
return ''
|
||||
}
|
||||
let year = date.getFullYear()
|
||||
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
||||
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
|
||||
let hh = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
|
||||
let mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
|
||||
let ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
|
||||
return `${year}-${month}-${day} ${hh}:${mm}:${ss}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数加法
|
||||
*/
|
||||
export const accAdd = (arg1, arg2) => {
|
||||
var r1, r2, m, c
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
c = Math.abs(r1 - r2)
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
if (c > 0) {
|
||||
var cm = Math.pow(10, c)
|
||||
if (r1 > r2) {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', '')) * cm
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', '')) * cm
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
return (arg1 + arg2) / m
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数减法
|
||||
*/
|
||||
export const accSubtract = (arg1, arg2) => {
|
||||
var r1, r2, m, c
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
c = Math.abs(r1 - r2)
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
if (c > 0) {
|
||||
var cm = Math.pow(10, c)
|
||||
if (r1 > r2) {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', '')) * cm
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', '')) * cm
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
return (arg1 - arg2) / m
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数乘法
|
||||
*/
|
||||
export const accMul = (arg1, arg2) => {
|
||||
var m = 0
|
||||
var s1 = arg1.toString()
|
||||
var s2 = arg2.toString()
|
||||
try { m += s1.split('.')[1].length } catch (e) {}
|
||||
try { m += s2.split('.')[1].length } catch (e) {}
|
||||
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m)
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数除法
|
||||
*/
|
||||
export const accDiv = (arg1, arg2) => {
|
||||
var t1 = 0
|
||||
var t2 = 0
|
||||
var r1, r2
|
||||
try {
|
||||
t1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {}
|
||||
try {
|
||||
t2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {}
|
||||
r1 = Number(arg1.toString().replace('.', ''))
|
||||
r2 = Number(arg2.toString().replace('.', ''))
|
||||
return (r1 / r2) * Math.pow(10, t2 - t1)
|
||||
}
|
||||
BIN
src/images/arrow.png
Normal file
|
After Width: | Height: | Size: 831 B |
BIN
src/images/bg.png
Normal file
|
After Width: | Height: | Size: 1.8 MiB |
BIN
src/images/bg_box.png
Normal file
|
After Width: | Height: | Size: 272 KiB |
BIN
src/images/bg_header.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
src/images/bg_logo.png
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
src/images/btn_blue.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
src/images/btn_gray.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
src/images/btn_red.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
src/images/item_2_bg.png
Normal file
|
After Width: | Height: | Size: 439 KiB |
BIN
src/images/item_bg_1.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
src/images/th_bg.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/images/title_bg.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
38
src/main.js
Normal file
@@ -0,0 +1,38 @@
|
||||
// The Vue build version to load with the `import` command
|
||||
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
||||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
import router from './router'
|
||||
import store from './vuex/store'
|
||||
import '@config/rem.js'
|
||||
import '@style/reset.css'
|
||||
import '@style/layout.styl'
|
||||
import { MessageBox, Message, Select, Option } from 'element-ui'
|
||||
import scroll from 'vue-seamless-scroll'
|
||||
import JSEncrypt from 'jsencrypt'
|
||||
|
||||
Vue.prototype.$confirm = MessageBox.confirm
|
||||
Vue.prototype.$message = Message
|
||||
Vue.use(Select)
|
||||
Vue.use(Option)
|
||||
Vue.use(scroll)
|
||||
Vue.config.productionTip = false
|
||||
|
||||
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
|
||||
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='
|
||||
|
||||
// 加密
|
||||
export function encrypt (txt) {
|
||||
const encryptor = new JSEncrypt()
|
||||
encryptor.setPublicKey(publicKey) // 设置公钥
|
||||
return encryptor.encrypt(txt) // 对需要加密的数据进行加密
|
||||
}
|
||||
|
||||
/* eslint-disable no-new */
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
components: { App },
|
||||
template: '<App/>'
|
||||
})
|
||||
130
src/pages/index.vue
Normal file
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<div class="contianer">
|
||||
<jxHeader title="工单明细"></jxHeader>
|
||||
<div class="contianer content">
|
||||
<div class="contianer content_wraper">
|
||||
<div class="zd-row filter_wraper">
|
||||
<div class="zd-col-6 zd-row">
|
||||
<div class="zd-col-6 filter-label">设备号</div>
|
||||
<div class="zd-col-17 filter-select">
|
||||
<el-select v-model="value" placeholder="请选择" @change="selectChange">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.device_code"
|
||||
:label="item.device_name"
|
||||
:value="item.device_code">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="zd-col-18 zd-row jcflexend">
|
||||
<button class="button btn-primary" :class="{'btn-info': !pkId}" :disabled="disabled" @click="_startOrder">开始</button>
|
||||
<button class="button btn-primary mgl2" :class="{'btn-info': !pkId}" :disabled="disabled" @click="_forceFinish">强制完成</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="contianer mgt2 grid_wraper">
|
||||
<table>
|
||||
<tr>
|
||||
<th>工单编码</th>
|
||||
<th>产品编号</th>
|
||||
<th>产品名称</th>
|
||||
<th>计划重量</th>
|
||||
<th>产线</th>
|
||||
<th>开工时间</th>
|
||||
<th>站点编码</th>
|
||||
<th>工单状态</th>
|
||||
</tr>
|
||||
<tr v-for="(e, i) in dataList" :key="i" :class="{'tr_selected': pkId === e.mfg_order_name}" @click="toCheck(e)">
|
||||
<td>{{ e.mfg_order_name }}</td>
|
||||
<td>{{ e.product_name }}</td>
|
||||
<td>{{ e.description }}</td>
|
||||
<td>{{ e.total_qty }}</td>
|
||||
<td>{{ e.resource_name }}</td>
|
||||
<td>{{ e.StartTime }}</td>
|
||||
<td>{{ e.point_code }}</td>
|
||||
<td>{{ e.status }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import jxHeader from '@components/header.vue'
|
||||
import {queryDevices, queryOrders, startOrder} from '@config/mork.js'
|
||||
import {forceFinish} from '@config/getData.js'
|
||||
export default {
|
||||
components: {
|
||||
jxHeader
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
timer: null,
|
||||
value: '',
|
||||
options: [],
|
||||
dataList: [],
|
||||
pkId: '',
|
||||
disabled: false
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this._queryDevices()
|
||||
},
|
||||
methods: {
|
||||
async _queryDevices () {
|
||||
let res = await queryDevices()
|
||||
this.options = [...res]
|
||||
},
|
||||
async _queryOrders (e) {
|
||||
let res = await queryOrders(e)
|
||||
this.dataList = [...res]
|
||||
},
|
||||
selectChange (e) {
|
||||
if (e) {
|
||||
this._queryOrders(e)
|
||||
}
|
||||
},
|
||||
toCheck (e) {
|
||||
this.pkId = this.pkId === e.mfg_order_name ? '' : e.mfg_order_name
|
||||
},
|
||||
async _startOrder () {
|
||||
this.disabled = true
|
||||
if (!this.pkId) {
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await startOrder(this.value, this.pkId)
|
||||
if (res.message) {
|
||||
this.$router.push('/task')
|
||||
}
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
async _forceFinish () {
|
||||
this.disabled = true
|
||||
if (!this.pkId) {
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await forceFinish(this.pkId)
|
||||
this.$message({
|
||||
message: res.message,
|
||||
type: 'success'
|
||||
})
|
||||
this.disabled = false
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
// @import '~@style/mixin'
|
||||
</style>
|
||||
70
src/pages/setup.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div class="zd-row jccenter contianer">
|
||||
<div class="header-wrap"><h1>ACS</h1></div>
|
||||
<div class="setup-wrap">
|
||||
<div class="zd-row filter-item">
|
||||
<div class="zd-col-6 filter-label">域名地址</div>
|
||||
<input type="text" class="zd-col-18 filter-value" v-model="baseUrl">
|
||||
</div>
|
||||
<div class="zd-row filter-item">
|
||||
<div class="zd-col-6 filter-label">刷新时间(秒)</div>
|
||||
<input type="number" class="zd-col-18 filter-value" v-model="setTime">
|
||||
</div>
|
||||
<div class="zd-row jccenter button-wrap">
|
||||
<button class="button btn-primary" @click="_config">配置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
baseUrl: this.$store.getters.baseUrl,
|
||||
setTime: this.$store.getters.setTime / 1000
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
_viewport () {
|
||||
this.viewportWidth = window.screen.width
|
||||
this.viewportHeight = window.screen.height
|
||||
},
|
||||
_config () {
|
||||
if (this.setTime < 0) {
|
||||
this.$message({
|
||||
message: '刷新时间设置过短',
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.setTime > 10800) {
|
||||
this.$message({
|
||||
message: '刷新时间设置过长',
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
baseUrl: this.baseUrl,
|
||||
setTime: this.setTime * 1000
|
||||
}
|
||||
this.$store.dispatch('setConfig', obj)
|
||||
this.$router.push('/index')
|
||||
let element = document.documentElement
|
||||
if (!(document.fullscreenElement || document.mozFullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement)) {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen()
|
||||
} else if (element.webkitRequestFullScreen) {
|
||||
element.webkitRequestFullScreen()
|
||||
} else if (element.mozRequestFullScreen) {
|
||||
element.mozRequestFullScreen()
|
||||
} else if (element.msRequestFullscreen) {
|
||||
// IE11
|
||||
element.msRequestFullscreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
121
src/pages/task.vue
Normal file
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<div class="contianer">
|
||||
<jxHeader type="false" title="配料作业"></jxHeader>
|
||||
<div class="contianer content">
|
||||
<div class="contianer content_wraper">
|
||||
<div class="contianer mgt2 grid_wraper">
|
||||
<table>
|
||||
<tr>
|
||||
<th>工单编码</th>
|
||||
<th>序号</th>
|
||||
<th>物料编码</th>
|
||||
<th>物料名称</th>
|
||||
<th>产线</th>
|
||||
<th>站点编码</th>
|
||||
<th>配料桶数</th>
|
||||
<th>剩余桶数</th>
|
||||
<th>物料重量</th>
|
||||
<th>状态</th>
|
||||
<th style="text-align: center">操作</th>
|
||||
</tr>
|
||||
<tr v-for="(e, i) in dataList" :key="i">
|
||||
<td>{{ e.mfg_order_name }}</td>
|
||||
<td>{{ e.seq_no }}</td>
|
||||
<td>{{ e.material_code }}</td>
|
||||
<td>{{ e.material_name }}</td>
|
||||
<td>{{ e.resource_name }}</td>
|
||||
<td>{{ e.point_code }}</td>
|
||||
<td>{{ e.require_num }}</td>
|
||||
<td>{{ e.remain_num }}</td>
|
||||
<td>{{ e.qty }}</td>
|
||||
<td>{{ e.status }}</td>
|
||||
<td>
|
||||
<div class="zd-row btn_wraper">
|
||||
<button class="grid_button" :disabled="disabled" @click="_sendWork(e)">下发</button>
|
||||
<!-- <button class="grid_button" :disabled="disabled">执行中</button> -->
|
||||
<button class="grid_button" :disabled="disabled" @click="_reSendWork(e)">补发</button>
|
||||
<button class="grid_button" :disabled="disabled" @click="_finishWork(e)">完成</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import jxHeader from '@components/header.vue'
|
||||
import {queryWorks} from '@config/mork.js'
|
||||
import {sendWork, reSendWork, finishWork} from '@config/getData.js'
|
||||
export default {
|
||||
components: {
|
||||
jxHeader
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
timer: null,
|
||||
dataList: [],
|
||||
pkId: '',
|
||||
disabled: false
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this._queryWorks()
|
||||
},
|
||||
methods: {
|
||||
async _queryWorks () {
|
||||
let res = await queryWorks()
|
||||
this.dataList = [...res]
|
||||
},
|
||||
async _sendWork (e) {
|
||||
this.disabled = true
|
||||
try {
|
||||
let res = await sendWork(e.work_code)
|
||||
this.$message({
|
||||
message: res.message,
|
||||
type: 'success'
|
||||
})
|
||||
this.disabled = false
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
async _reSendWork (e) {
|
||||
this.disabled = true
|
||||
try {
|
||||
let res = await reSendWork(e.work_code)
|
||||
this.$message({
|
||||
message: res.message,
|
||||
type: 'success'
|
||||
})
|
||||
this.disabled = false
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
async _finishWork (e) {
|
||||
this.disabled = true
|
||||
try {
|
||||
let res = await finishWork(e.work_code)
|
||||
this.$message({
|
||||
message: res.message,
|
||||
type: 'success'
|
||||
})
|
||||
this.disabled = false
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
// @import '~@style/mixin'
|
||||
.grid_wraper
|
||||
height 100%
|
||||
.btn_wraper
|
||||
width 3.1rem
|
||||
</style>
|
||||
28
src/router/index.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
|
||||
const Setup = r => require.ensure([], () => r(require('@page/setup')), 'Setup')
|
||||
const Index = r => require.ensure([], () => r(require('@page/index')), 'Index')
|
||||
const Task = r => require.ensure([], () => r(require('@page/task')), 'Task')
|
||||
Vue.use(Router)
|
||||
|
||||
export default new Router({
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/setup'
|
||||
},
|
||||
{
|
||||
path: '/setup',
|
||||
component: Setup
|
||||
},
|
||||
{
|
||||
path: '/index',
|
||||
component: Index
|
||||
},
|
||||
{
|
||||
path: '/Task',
|
||||
component: Task
|
||||
}
|
||||
]
|
||||
})
|
||||
BIN
src/style/font/SourceHanSansCN-Bold.otf
Normal file
BIN
src/style/font/SourceHanSansCN-Medium.otf
Normal file
BIN
src/style/font/SourceHanSansCN-Regular.otf
Normal file
BIN
src/style/font/YouSheBiaoTiHei.ttf
Normal file
0
src/style/iconfont.styl
Normal file
BIN
src/style/iconfont/iconfont.ttf
Normal file
BIN
src/style/iconfont/iconfont.woff
Normal file
BIN
src/style/iconfont/iconfont.woff2
Normal file
267
src/style/layout.styl
Normal file
@@ -0,0 +1,267 @@
|
||||
@import 'iconfont.styl';
|
||||
@import 'mixin.styl';
|
||||
@font-face
|
||||
font-family 'iconfont';
|
||||
src: url('iconfont/iconfont.woff2') format('woff2'),
|
||||
url('iconfont/iconfont.woff') format('woff'),
|
||||
url('iconfont/iconfont.ttf') format('truetype');
|
||||
@font-face {
|
||||
font-family: "YouSheBiaoTiHei";
|
||||
src: url('font/YouSheBiaoTiHei.ttf') format('truetype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: "SourceHanSansCN-Bold";
|
||||
src: url('font/SourceHanSansCN-Bold.otf') format('truetype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: "SourceHanSansCN-Regular";
|
||||
src: url('font/SourceHanSansCN-Regular.otf') format('truetype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: "SourceHanSansCN-Medium";
|
||||
src: url('font/SourceHanSansCN-Medium.otf') format('truetype');
|
||||
}
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.icon-guanbi:before {
|
||||
content: "\e60f";
|
||||
}
|
||||
|
||||
// login
|
||||
.setup-wrap
|
||||
width 8.85rem
|
||||
background linear-gradient(45deg, rgba(28, 95, 161, 70%), rgba(20, 67, 120, 70%))
|
||||
border 1px solid #6fc4e2
|
||||
padding .49rem .48rem
|
||||
.contianer
|
||||
_wh(100%, 100%)
|
||||
.header-wrap
|
||||
position fixed
|
||||
z-index 10
|
||||
top 0
|
||||
_wh(100%, 1.25rem)
|
||||
background: url('~@/images/bg_logo.png') center / 16.82rem 100% no-repeat
|
||||
h1
|
||||
_font(.8rem, 1rem, #CF6A46,,center)
|
||||
font-family "YouSheBiaoTiHei"
|
||||
.button-wrap {
|
||||
margin-top: .2rem;
|
||||
}
|
||||
.button {
|
||||
width: 3.36rem;
|
||||
font-size: .48rem;
|
||||
line-height: .94rem;
|
||||
height: .94rem;
|
||||
color #fff;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
}
|
||||
.btn-primary {
|
||||
background: url('~@/images/btn_blue.png') center / 100% 100% no-repeat
|
||||
}
|
||||
.btn-danger {
|
||||
background: url('~@/images/btn_red.png') center / 100% 100% no-repeat
|
||||
}
|
||||
.button:disabled {
|
||||
background: url('~@/images/btn_gray.png') center / 100% 100% no-repeat
|
||||
}
|
||||
.btn-info {
|
||||
background: url('~@/images/btn_gray.png') center / 100% 100% no-repeat
|
||||
}
|
||||
.filter-item
|
||||
margin-bottom .3rem
|
||||
.filter-label
|
||||
_font(.3rem, .8rem, #fff,,)
|
||||
.filter-value
|
||||
_font(.3rem, .8rem, #fff,,)
|
||||
text-indent .23rem
|
||||
background: rgba(45,88,184,0.1);
|
||||
border: 1px solid #4980BD;
|
||||
&:focus
|
||||
background: rgba(45,88,184,0.25);
|
||||
border: 2px solid #21D0F2;
|
||||
|
||||
// header
|
||||
header
|
||||
position fixed
|
||||
padding 0 .4rem
|
||||
top 0
|
||||
left 0
|
||||
height .77rem
|
||||
background: url('~@/images/bg_header.png') center / 100% 100% no-repeat
|
||||
|
||||
// content
|
||||
.content
|
||||
padding 1.07rem .4rem .4rem .4rem
|
||||
.content_wraper
|
||||
padding .37rem .4rem .4rem .4rem
|
||||
background: url('~@/images/bg_box.png') center / 100% 100% no-repeat
|
||||
.grid_wraper
|
||||
height: calc(100% - 1rem)
|
||||
overflow-y auto
|
||||
table
|
||||
table-layout: fixed;
|
||||
min-width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
border: 0
|
||||
th
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
text-align: left;
|
||||
position: sticky;
|
||||
top: -1px;
|
||||
height: .81rem;
|
||||
font-size: .36rem;
|
||||
font-family: SourceHanSansCN-Bold;
|
||||
line-height: .81rem;
|
||||
color: #AFBED8;
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
z-index: 99;
|
||||
padding 0 .25rem;
|
||||
background left center / 1px 81px url('~@/images/th_bg.png') repeat-x
|
||||
td
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
// white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
padding: .05rem .05rem .05rem .25rem;
|
||||
border-bottom: 2px solid rgba(122,159,224,0.17);
|
||||
text-align: left;
|
||||
font-size: .3rem;
|
||||
line-height:.35rem;
|
||||
height: .82rem;
|
||||
color: #fff;
|
||||
.grid_wraper table .tr:nth-child(odd) td
|
||||
background: rgba(31,46,73,0.3);
|
||||
.grid_wraper table .tr:nth-child(even) td
|
||||
background: rgba(31,46,73,0.5);
|
||||
.grid_wraper table .tr_selected td
|
||||
background: rgba(63,106,202,0.3);
|
||||
.grid_wraper table th:first-child
|
||||
position: sticky;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
.grid_wraper table th:last-child
|
||||
position: sticky;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
.grid_wraper table td:first-child
|
||||
position: sticky;
|
||||
left: 0;
|
||||
z-index: 99;
|
||||
.grid_wraper table td:last-child
|
||||
position: sticky;
|
||||
right: 0;
|
||||
z-index: 99;
|
||||
.grid_button
|
||||
font-size: .3rem;
|
||||
line-height: .82rem;
|
||||
color: #3CC1FF;
|
||||
margin 0 .16rem;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
|
||||
// 下拉框
|
||||
.el-select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
.el-input {
|
||||
font-size: .3rem;
|
||||
}
|
||||
.el-input__inner {
|
||||
height .8rem;
|
||||
font-size: .3rem;
|
||||
line-height: .8rem;
|
||||
border: 1px solid#4980BD;
|
||||
background-color: rgba(45,88,184,0.1);
|
||||
color: #fff;
|
||||
border-radius: 0;
|
||||
}
|
||||
.el-input--suffix .el-input__inner {
|
||||
padding-right: .7rem
|
||||
}
|
||||
.el-input__inner:hover, .el-select:hover .el-input__inner {
|
||||
border-color: #21D0F2;
|
||||
}
|
||||
.el-input__suffix {
|
||||
right: .2rem
|
||||
}
|
||||
.el-input__icon {
|
||||
width: .3rem
|
||||
}
|
||||
.el-select-dropdown__item {
|
||||
font-size: .3rem;
|
||||
color: #fff;
|
||||
height: .8rem;
|
||||
line-height: .8rem;
|
||||
}
|
||||
.el-select-dropdown {
|
||||
background: rgba(7,31,62,0.95);
|
||||
border: 1px solid #4980BD;
|
||||
}
|
||||
.el-popper[x-placement^=bottom] .popper__arrow::after {
|
||||
top: 0;
|
||||
border-bottom-color: #4980BD;
|
||||
}
|
||||
.el-popper[x-placement^=bottom] .popper__arrow {
|
||||
border-bottom-color: #4980BD;
|
||||
}
|
||||
.el-icon-arrow-up:before {
|
||||
content: ''
|
||||
}
|
||||
.el-select .el-input .el-select__caret {
|
||||
background: center / 100% auto url('~@/images/arrow.png') no-repeat;
|
||||
}
|
||||
.el-message__icon {
|
||||
font-size: 16px
|
||||
}
|
||||
.el-select-dropdown__item.hover, .el-select-dropdown__item:hover {
|
||||
background-color: rgba(7,31,62,0.95)
|
||||
}
|
||||
|
||||
// 提示框
|
||||
.el-message-box {
|
||||
background-color: rgba(7, 22, 69, .85);
|
||||
border-color: #0b5deb;
|
||||
}
|
||||
.el-message-box__title, .el-message-box__headerbtn .el-message-box__close, .el-message-box__content {
|
||||
color: #fff;
|
||||
}
|
||||
.l-wrap
|
||||
_wh(calc(100% - 740px), 100%)
|
||||
overflow auto
|
||||
.r-wrap
|
||||
_wh(733px, 100%)
|
||||
background: center / 100% 100% url('~@/images/item_2_bg.png') no-repeat;
|
||||
.item-wrap
|
||||
width 100%
|
||||
padding 0.12rem 0.1rem 0.12rem 0.1rem
|
||||
margin-top .05rem
|
||||
background: center/ 100% 100% url('~@/images/item_bg_1.png') no-repeat;
|
||||
.list-wrap
|
||||
_wh(100%, calc(100% - 5.25rem))
|
||||
min-height 1.6rem
|
||||
padding 0.1rem 0.12rem
|
||||
background: center/ 100% 100% url('~@/images/item_bg_1.png') no-repeat;
|
||||
// background-color rgb(16, 38, 105)
|
||||
.scroll-tab
|
||||
_font(.14rem, .34rem, #fff,,center)
|
||||
font-family YouSheBiaoTiHei;
|
||||
background-color #1F438A
|
||||
.scroll-container
|
||||
height calc(100% - .34rem)
|
||||
overflow hidden
|
||||
.scroll-item
|
||||
_font(.14rem, .34rem, #fff,,center)
|
||||
background: rgba(31,46,73,0.9)
|
||||
border 1px solid rgba(122,159,224,0.17)
|
||||
32
src/style/mixin.styl
Normal file
@@ -0,0 +1,32 @@
|
||||
//宽高
|
||||
_wh(w, h)
|
||||
width: w
|
||||
height: h
|
||||
|
||||
//字体大小、行高、颜色
|
||||
_font(size,height,color=$fc1,weight=normal,align=left)
|
||||
font-size: size
|
||||
line-height: height
|
||||
color: color
|
||||
font-weight: weight
|
||||
text-align: align
|
||||
|
||||
//flex 布局和 子元素 对其方式
|
||||
_fj(x=space-between,y=center,z=row)
|
||||
display: flex
|
||||
justify-content: x
|
||||
align-items: y
|
||||
flex-direction: z
|
||||
|
||||
// 背景图片地址和大小
|
||||
_bis(url,w,h=auto,x=center,y=center)
|
||||
background-position: x y
|
||||
background-size: w h
|
||||
background-image: url(url)
|
||||
background-repeat: no-repeat
|
||||
|
||||
// 定位上下居中
|
||||
_ct()
|
||||
position: absolute
|
||||
top: 50%
|
||||
transform: translateY(-50%)
|
||||
170
src/style/reset.css
Normal file
@@ -0,0 +1,170 @@
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
font-style: normal;
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-family: Arial, "Microsoft Yahei", "Helvetica Neue", Helvetica, sans-serif;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-webkit-tap-highlight-color:transparent;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
body, html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-user-select: auto;
|
||||
-ms-user-select: auto;
|
||||
user-select: auto;
|
||||
background: #11337d url(../images/bg.png) center / cover no-repeat;
|
||||
}
|
||||
|
||||
input[type="button"], input[type="submit"], input[type="search"], input[type="reset"], textarea, select{
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 2px;
|
||||
background-color: #2650a4;
|
||||
}
|
||||
::-webkit-scrollbar-track {
|
||||
border-radius: 2px;
|
||||
background-color: #e7e7e7;
|
||||
border: 1px solid #cacaca;
|
||||
}
|
||||
|
||||
.relative {
|
||||
position: relative;
|
||||
}
|
||||
.absolute {
|
||||
position: absolute;
|
||||
}
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
.vhide {
|
||||
visibility:hidden;
|
||||
}
|
||||
.show {
|
||||
display: block;
|
||||
}
|
||||
.ellipsis{
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.zd-row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.flexcol {
|
||||
flex-direction: column;
|
||||
}
|
||||
.alignend {
|
||||
align-items: flex-end;
|
||||
}
|
||||
.flexstart {
|
||||
align-items: flex-start !important;
|
||||
}
|
||||
.jcflexstart {
|
||||
justify-content: flex-start !important;
|
||||
}
|
||||
.jcflexend {
|
||||
justify-content: flex-end !important;
|
||||
}
|
||||
.jccenter {
|
||||
justify-content: center !important;
|
||||
}
|
||||
.zd-col-24 {
|
||||
width: 100%;
|
||||
}
|
||||
.zd-col-23 {
|
||||
width: 95.83333%
|
||||
}
|
||||
.zd-col-22 {
|
||||
width: 91.66667%
|
||||
}
|
||||
.zd-col-21 {
|
||||
width: 87.5%
|
||||
}
|
||||
.zd-col-20 {
|
||||
width: 83.33333%
|
||||
}
|
||||
.zd-col-19 {
|
||||
width: 79.16667%
|
||||
}
|
||||
.zd-col-18 {
|
||||
width: 75%
|
||||
}
|
||||
.zd-col-17 {
|
||||
width: 70.83333%
|
||||
}
|
||||
.zd-col-16 {
|
||||
width: 66.66667%
|
||||
}
|
||||
.zd-col-15 {
|
||||
width: 62.5%
|
||||
}
|
||||
.zd-col-14 {
|
||||
width: 58.33333%
|
||||
}
|
||||
.zd-col-13 {
|
||||
width: 54.16667%
|
||||
}
|
||||
.zd-col-12 {
|
||||
width: 50%;
|
||||
}
|
||||
.zd-col-11 {
|
||||
width: 45.83333%
|
||||
}
|
||||
.zd-col-10 {
|
||||
width: 41.66667%
|
||||
}
|
||||
.zd-col-9 {
|
||||
width: 37.5%
|
||||
}
|
||||
.zd-col-8 {
|
||||
width: 33.33333%
|
||||
}
|
||||
.zd-col-7 {
|
||||
width: 29.16667%
|
||||
}
|
||||
.zd-col-6 {
|
||||
width: 25%
|
||||
}
|
||||
.zd-col-5 {
|
||||
width: 20.83333%
|
||||
}
|
||||
.zd-col-4 {
|
||||
width: 16.66667%
|
||||
}
|
||||
.zd-col-3 {
|
||||
width: 12.5%
|
||||
}
|
||||
.zd-col-2 {
|
||||
width: 8.33333%
|
||||
}
|
||||
.zd-col-1 {
|
||||
width: 4.16667%
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1rpx solid #e5e5e5;
|
||||
}
|
||||
.mgt2 {
|
||||
margin-top: .2rem;
|
||||
}
|
||||
.mgl2 {
|
||||
margin-left: .2rem;
|
||||
}
|
||||
35
src/vuex/modules/com.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import * as types from '../types'
|
||||
import { getStore, setStore } from '@config/utils.js'
|
||||
|
||||
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.171:8018' : 'http://192.168.81.171:8018'
|
||||
const state = {
|
||||
baseUrl: getStore('baseUrl') || baseUrl,
|
||||
setTime: getStore('setTime') || 3000
|
||||
}
|
||||
|
||||
const getters = {
|
||||
baseUrl: state => state.baseUrl,
|
||||
setTime: state => state.setTime
|
||||
}
|
||||
|
||||
const actions = {
|
||||
setConfig ({commit}, res) {
|
||||
setStore('baseUrl', res.baseUrl)
|
||||
setStore('setTime', res.setTime)
|
||||
commit(types.COM_CONFIG, res)
|
||||
}
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
[types.COM_CONFIG] (state, res) {
|
||||
state.baseUrl = res.baseUrl
|
||||
state.setTime = res.setTime
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
state,
|
||||
actions,
|
||||
getters,
|
||||
mutations
|
||||
}
|
||||
50
src/vuex/modules/user.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import * as types from '../types'
|
||||
import { getStore, setStore } from '@config/utils.js'
|
||||
|
||||
const state = {
|
||||
userInfo: getStore('userInfo') ? getStore('userInfo') : '',
|
||||
saveToken: getStore('saveToken') || ''
|
||||
}
|
||||
|
||||
const getters = {
|
||||
accountId: state => state.accountId,
|
||||
accountName: state => state.accountName,
|
||||
userName: state => state.userName,
|
||||
deptName: state => state.deptName,
|
||||
userInfo: state => state.userInfo,
|
||||
saveToken: state => state.saveToken
|
||||
}
|
||||
|
||||
const actions = {
|
||||
saveUserInfo ({commit}, res) {
|
||||
setStore('userInfo', res)
|
||||
commit(types.SAVE_USER_INFO, res)
|
||||
},
|
||||
delUserInfo ({commit}, res) {
|
||||
localStorage.removeItem('userInfo')
|
||||
localStorage.removeItem('saveToken')
|
||||
commit(types.DEL_USER_INFO, res)
|
||||
},
|
||||
saveToken ({commit}, res) {
|
||||
setStore('saveToken', res)
|
||||
commit(types.SAVE_TOKEN, res)
|
||||
}
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
[types.SAVE_USER_INFO] (state, res) {
|
||||
state.userInfo = res
|
||||
},
|
||||
[types.DEL_USER_INFO] (state, res) {
|
||||
},
|
||||
[types.SAVE_TOKEN] (state, res) {
|
||||
state.saveToken = res
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
14
src/vuex/store.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
import com from './modules/com'
|
||||
import user from './modules/user'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
com,
|
||||
user
|
||||
}
|
||||
})
|
||||
16
src/vuex/types.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// 公共配置
|
||||
export const COM_CONFIG = 'COM_CONFIG'
|
||||
|
||||
// 用户
|
||||
export const SAVE_USER_INFO = 'SAVE_USER_INFO'
|
||||
export const DEL_USER_INFO = 'DEL_USER_INFO'
|
||||
export const SAVE_TOKEN = 'SAVE_TOKEN'
|
||||
|
||||
// 缓存页面
|
||||
export const SET_KEEP_ALIVE = 'SET_KEEP_ALIVE'
|
||||
export const SET_MATER_ARR = 'SET_MATER_ARR'
|
||||
|
||||
// 数据
|
||||
export const SET_MATER_OBJ = 'SET_MATER_OBJ'
|
||||
export const DATA_DEVICE = 'DATA_DEVICE'
|
||||
export const DATA_IS_PROPLAN = 'DATA_IS_PROPLAN'
|
||||
0
static/.gitkeep
Normal file
27
test/e2e/custom-assertions/elementCount.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// A custom Nightwatch assertion.
|
||||
// The assertion name is the filename.
|
||||
// Example usage:
|
||||
//
|
||||
// browser.assert.elementCount(selector, count)
|
||||
//
|
||||
// For more information on custom assertions see:
|
||||
// http://nightwatchjs.org/guide#writing-custom-assertions
|
||||
|
||||
exports.assertion = function (selector, count) {
|
||||
this.message = 'Testing if element <' + selector + '> has count: ' + count
|
||||
this.expected = count
|
||||
this.pass = function (val) {
|
||||
return val === this.expected
|
||||
}
|
||||
this.value = function (res) {
|
||||
return res.value
|
||||
}
|
||||
this.command = function (cb) {
|
||||
var self = this
|
||||
return this.api.execute(function (selector) {
|
||||
return document.querySelectorAll(selector).length
|
||||
}, [selector], function (res) {
|
||||
cb.call(self, res)
|
||||
})
|
||||
}
|
||||
}
|
||||
46
test/e2e/nightwatch.conf.js
Normal file
@@ -0,0 +1,46 @@
|
||||
require('babel-register')
|
||||
var config = require('../../config')
|
||||
|
||||
// http://nightwatchjs.org/gettingstarted#settings-file
|
||||
module.exports = {
|
||||
src_folders: ['test/e2e/specs'],
|
||||
output_folder: 'test/e2e/reports',
|
||||
custom_assertions_path: ['test/e2e/custom-assertions'],
|
||||
|
||||
selenium: {
|
||||
start_process: true,
|
||||
server_path: require('selenium-server').path,
|
||||
host: '127.0.0.1',
|
||||
port: 4444,
|
||||
cli_args: {
|
||||
'webdriver.chrome.driver': require('chromedriver').path
|
||||
}
|
||||
},
|
||||
|
||||
test_settings: {
|
||||
default: {
|
||||
selenium_port: 4444,
|
||||
selenium_host: 'localhost',
|
||||
silent: true,
|
||||
globals: {
|
||||
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
|
||||
}
|
||||
},
|
||||
|
||||
chrome: {
|
||||
desiredCapabilities: {
|
||||
browserName: 'chrome',
|
||||
javascriptEnabled: true,
|
||||
acceptSslCerts: true
|
||||
}
|
||||
},
|
||||
|
||||
firefox: {
|
||||
desiredCapabilities: {
|
||||
browserName: 'firefox',
|
||||
javascriptEnabled: true,
|
||||
acceptSslCerts: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
48
test/e2e/runner.js
Normal file
@@ -0,0 +1,48 @@
|
||||
// 1. start the dev server using production config
|
||||
process.env.NODE_ENV = 'testing'
|
||||
|
||||
const webpack = require('webpack')
|
||||
const DevServer = require('webpack-dev-server')
|
||||
|
||||
const webpackConfig = require('../../build/webpack.prod.conf')
|
||||
const devConfigPromise = require('../../build/webpack.dev.conf')
|
||||
|
||||
let server
|
||||
|
||||
devConfigPromise.then(devConfig => {
|
||||
const devServerOptions = devConfig.devServer
|
||||
const compiler = webpack(webpackConfig)
|
||||
server = new DevServer(compiler, devServerOptions)
|
||||
const port = devServerOptions.port
|
||||
const host = devServerOptions.host
|
||||
return server.listen(port, host)
|
||||
})
|
||||
.then(() => {
|
||||
// 2. run the nightwatch test suite against it
|
||||
// to run in additional browsers:
|
||||
// 1. add an entry in test/e2e/nightwatch.conf.js under "test_settings"
|
||||
// 2. add it to the --env flag below
|
||||
// or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
|
||||
// For more information on Nightwatch's config file, see
|
||||
// http://nightwatchjs.org/guide#settings-file
|
||||
let opts = process.argv.slice(2)
|
||||
if (opts.indexOf('--config') === -1) {
|
||||
opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
|
||||
}
|
||||
if (opts.indexOf('--env') === -1) {
|
||||
opts = opts.concat(['--env', 'chrome'])
|
||||
}
|
||||
|
||||
const spawn = require('cross-spawn')
|
||||
const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
|
||||
|
||||
runner.on('exit', function (code) {
|
||||
server.close()
|
||||
process.exit(code)
|
||||
})
|
||||
|
||||
runner.on('error', function (err) {
|
||||
server.close()
|
||||
throw err
|
||||
})
|
||||
})
|
||||
19
test/e2e/specs/test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// For authoring Nightwatch tests, see
|
||||
// http://nightwatchjs.org/guide#usage
|
||||
|
||||
module.exports = {
|
||||
'default e2e tests': function (browser) {
|
||||
// automatically uses dev Server port from /config.index.js
|
||||
// default: http://localhost:8080
|
||||
// see nightwatch.conf.js
|
||||
const devServer = browser.globals.devServerURL
|
||||
|
||||
browser
|
||||
.url(devServer)
|
||||
.waitForElementVisible('#app', 5000)
|
||||
.assert.elementPresent('.hello')
|
||||
.assert.containsText('h1', 'Welcome to Your Vue.js App')
|
||||
.assert.elementCount('img', 1)
|
||||
.end()
|
||||
}
|
||||
}
|
||||
7
test/unit/.eslintrc
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"env": {
|
||||
"jest": true
|
||||
},
|
||||
"globals": {
|
||||
}
|
||||
}
|
||||
30
test/unit/jest.conf.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
rootDir: path.resolve(__dirname, '../../'),
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'json',
|
||||
'vue'
|
||||
],
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1'
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
|
||||
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
|
||||
},
|
||||
testPathIgnorePatterns: [
|
||||
'<rootDir>/test/e2e'
|
||||
],
|
||||
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
|
||||
setupFiles: ['<rootDir>/test/unit/setup'],
|
||||
mapCoverage: true,
|
||||
coverageDirectory: '<rootDir>/test/unit/coverage',
|
||||
collectCoverageFrom: [
|
||||
'src/**/*.{js,vue}',
|
||||
'!src/main.js',
|
||||
'!src/router/index.js',
|
||||
'!**/node_modules/**'
|
||||
]
|
||||
}
|
||||
3
test/unit/setup.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
11
test/unit/specs/HelloWorld.spec.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import Vue from 'vue'
|
||||
import HelloWorld from '@/components/HelloWorld'
|
||||
|
||||
describe('HelloWorld.vue', () => {
|
||||
it('should render correct contents', () => {
|
||||
const Constructor = Vue.extend(HelloWorld)
|
||||
const vm = new Constructor().$mount()
|
||||
expect(vm.$el.querySelector('.hello h1').textContent)
|
||||
.toEqual('Welcome to Your Vue.js App')
|
||||
})
|
||||
})
|
||||