chore: 初始化南京中车 APP

This commit is contained in:
yexingqiang
2026-06-08 17:22:44 +08:00
commit e705dfeab9
61 changed files with 25238 additions and 0 deletions

18
.babelrc Normal file
View File

@@ -0,0 +1,18 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
}
}
}

9
.editorconfig Normal file
View 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

7
.eslintignore Normal file
View File

@@ -0,0 +1,7 @@
/build/
/config/
/dist/
/*.js
/test/unit/coverage/
/*.vue
/src/

29
.eslintrc.js Normal file
View 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
View 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
View 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": {}
}
}

30
README.md Normal file
View File

@@ -0,0 +1,30 @@
# slapk
> 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).

41
build/build.js Normal file
View 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
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

101
build/utils.js Normal file
View File

@@ -0,0 +1,101 @@
'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,
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
View 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'
}
}

106
build/webpack.base.conf.js Normal file
View File

@@ -0,0 +1,106 @@
'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'),
}
},
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]')
}
},
// {
// test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
// loader: 'url-loader',
// options: {
// limit: 10000,
// name: '[name].[hash:7].[ext]',
// publicPath: '../fonts/',
// outputPath: utils.assetsPath('fonts/')
// }
// },
{
test: /\.less$/,
loader: 'style-loader!css-loader!less-loader'
},
]
},
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 Normal file
View 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: [`PDAYour 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
View 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
View File

@@ -0,0 +1,7 @@
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})

77
config/index.js Normal file
View File

@@ -0,0 +1,77 @@
'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: 'localhost', // can be overwritten by process.env.HOST
host: '127.0.0.1', // 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
View File

@@ -0,0 +1,4 @@
'use strict'
module.exports = {
NODE_ENV: '"production"'
}

7
config/test.env.js Normal file
View File

@@ -0,0 +1,7 @@
'use strict'
const merge = require('webpack-merge')
const devEnv = require('./dev.env')
module.exports = merge(devEnv, {
NODE_ENV: '"testing"'
})

30
index.html Normal file
View File

@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html style="font-size: 10px;">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel ="shortcut icon" type="image/x-icon" href="static/zc.ico">
<title>中车</title>
<script type="text/javascript">
document.write("<script src='./static/config.js?v=" + new Date().getTime() + "'><\/script>");
</script>
<style>
html,
body {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
display: flex;
}
</style>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

17589
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

95
package.json Normal file
View File

@@ -0,0 +1,95 @@
{
"name": "slapk",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "DESKTOP-4P88DS3\\mes_08 <1919787194@qq.com>",
"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",
"lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/",
"build": "node build/build.js"
},
"dependencies": {
"axios": "^1.2.1",
"element-ui": "^2.15.12",
"less": "^4.1.3",
"less-loader": "^5.0.0",
"mqtt": "^2.18.9",
"vant": "^2.12.53",
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vuex": "^4.1.0"
},
"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-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",
"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"
]
}

32
src/App.vue Normal file
View File

@@ -0,0 +1,32 @@
<template>
<div id="app">
<keep-alive>
<router-view />
</keep-alive>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
#app {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
box-sizing: border-box;
}
.el-select-dropdown__item {
font-size: 1.2rem !important;
}
.el-select-dropdown__item.selected {
color: red !important;
}
</style>

BIN
src/assets/key.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
src/assets/peo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
src/assets/zc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
src/assets/zc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,14 @@
<template>
<div></div>
</template>
<script>
export default {
data () {
return {}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,225 @@
<template>
<div class="container" v-loading.fullscreen.lock="fullscreenLoading">
<div v-if='!isshow'>
<div class="sel" style="margin-top: 120px;">
<el-select v-model='车间' placeholder="请选择车间" clearable @change="search">
<el-option v-for="(ele,index) in 车间数组" :key='index' :label='ele.text' :value="ele.value"></el-option>
</el-select>
</div>
<div class="sel">
<el-select v-model='产线' placeholder="请选择产线" clearable @change="search2">
<el-option v-for="(ele,index) in 产线数组" :key='index' :label='ele.text' :value="ele.value"></el-option>
</el-select>
</div>
<div class="sel">
<el-select v-model='工单' placeholder="请选择工单" clearable @change="show">
<el-option v-for="(ele,index) in 工单数组" :key='index' :label='ele.text' :value="ele.value"></el-option>
</el-select>
</div>
</div>
<div class="dialog" v-if="isshow" width="100%" :before-close="handleClose">
<div style="float: right;font-size: 24px;color: #409eff;margin-right: 10px;margin-top: 10px;margin-bottom:5px"><i @click='handleClose' class="el-icon-close"></i> </div>
<el-table :data="list" stripe border style="width: 100%;font-size: 18px;" max-height="480px"
:header-cell-style="{color: '#000',fonSize:'18px'}">
<el-table-column prop="物料名称" align="center" label="物料名称" width="150">
</el-table-column>
<el-table-column prop="物料批次" align="center" label="物料批次" width="110">
</el-table-column>
<el-table-column align="center" label="已配/应配">
<template slot-scope="scope">
<div>
{{scope.row.已领数量}}/{{scope.row.配送数量}}
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import request from '@/utils/request'
var requestConfig = window.dt_Config.requestConfig
export default {
created() {
},
mounted() {
this.get()
},
data() {
return {
fullscreenLoading: false,
车间: '',
车间数组: [],
工单: "",
工单数组: [],
产线:'',
产线数组:[],
isshow: false,
list: []
}
},
methods: {
toFixed(num) {
if (!isNaN(num)) {
return ((num + '').indexOf('.') == -1) ? num : num.toFixed(6);
}
},
init() {},
get() {
var data = this.CreateData(
'Select',
'基础表_车间',
['车间id', '车间名称'], {}
)
this.ExecDatabase(data).then(res => {
console.log(res)
this.车间数组 = res.data.map(item => {
return {
value: item.车间id,
text: item.车间名称
}
})
})
},
search() {
this.工单 = ''
this.工单数组 = []
this.产线 = ''
this.产线数组 = []
let data = this.CreateData(
'Select',
'基础表_产线名称',
['产线id', '产线名称'], {
where: [{
fieldname: '车间id',
value: parseInt(this.车间)
}]
}
)
this.ExecDatabase(data).then(res=>{
this.产线数组 = res.data.map(item => {
return {
value: item.产线id,
text: item.产线名称
}
})
})
},
search2(){
this.工单数组 = []
this.工单= ''
let data2 = this.CreateData(
'Select',
'工单管理_工单信息视图',
['工单id', '工单号'], {
where: [{
fieldname: '产线id',
value: parseInt(this.产线)
}]
}
)
this.ExecDatabase(data2).then(res => {
this.工单数组 = res.data.map(item => {
return {
value: item.工单id,
text: item.工单号
}
})
})
},
show() {
var data = this.CreateData(
'Select',
'仓储管理_物料配送单明细_视图',
[
'配送单id',
'单据编号',
'工单id',
'配送单明细id',
'物料编码',
'规格型号',
'物料名称',
'单位',
'配送数量',
'物料批次',
'已领数量',
'线边已领数量',
'生产订单',
'生产产线',
'车间id',
'订单状态',
'接收完成',
'工位'
],
{
where: [
{
fieldname: '工单id',
value: this.工单,
},
],
fieldOrder: ['配送数量 desc'],
}
)
this.ExecDatabase(data).then((res) => {
console.log(res)
this.list = res.data
})
this.isshow = true
},
handleClose() {
this.isshow = false
this.list = []
}
},
computed: {},
components: {},
watch: {},
props: {}
}
</script>
<style lang="less" scoped>
.container {
height: 100%;
width: 100%;
overflow: hidden;
}
.sel {
width:100%;
text-align: center;
.el-select{
width: 80%;
margin: 20px 0;
height: 60px;
line-height: 60px;
border: 1px solid #409eff;
border-radius: 4px;
}
/deep/ .el-input__inner {
height: 60px;
line-height: 60px;
font-size: 20px;
text-align: center;
}
}
.dialog{
height: 100%;
position: absolute;
top: 0;
}
/deep/ .el-input__inner::placeholder {
color: #000;
text-align: center;
}
/deep/ .el-select .el-input__inner{
color: #000;
}
</style>

View File

@@ -0,0 +1,834 @@
<template>
<div class="container" v-loading.fullscreen.lock="fullscreenLoading">
<div class="header">
<el-input class="head-inp" placeholder="扫物料码/批次码" v-model="bm" clearable @clear='clearData()'>
</el-input>
<el-button @click="gxzjEventEvent" icon="el-icon-check" class="head-btn">确定</el-button>
</div>
<div class="content">
<p class="form-item">
<label class="form-item-label"><strong>*</strong>生产产线</label>
<el-select class="form-item-input" v-model="sccx" placeholder="请选择" @change="getscdd">
<el-option v-for="item in sccxsz" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</p>
<p class="form-item">
<label class="form-item-label"><strong>*</strong>检测类型</label>
<el-select class="form-item-input" v-model="jclx" placeholder="请选择">
<el-option v-for="item in jclxsz" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</p>
<p class="form-item">
<label class="form-item-label">物料名称</label>
<el-input class="form-item-input" placeholder="暂无数据" v-model="gxwl" readonly>
</el-input>
</p>
<p class="form-item">
<label class="form-item-label"><strong>*</strong>物料编码</label>
<el-input class="form-item-input" placeholder="暂无数据" v-model="wldh" readonly>
</el-input>
</p>
<p class="form-item">
<label class="form-item-label"><strong>*</strong>物料批次</label>
<el-input class="form-item-input" placeholder="暂无数据" v-model="wlpc" readonly>
</el-input>
</p>
<p class="form-item">
<label class="form-item-label">批次数量</label>
<el-input class="form-item-input" placeholder="暂无数据" v-model="pcsl" readonly>
</el-input>
</p>
<p class="form-item">
<label class="form-item-label">规格型号</label>
<el-input class="form-item-input" placeholder="暂无数据" v-model="ggxh" readonly>
</el-input>
</p>
<p class="form-item">
<label class="form-item-label"><strong>*</strong>生产订单</label>
<!-- <el-input class="form-item-input" placeholder="暂无数据" v-model="scdd" readonly>
</el-input> -->
<el-select class="form-item-input" v-model="scdd" placeholder="请选择">
<el-option v-for="item in scddsz" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</p>
</div>
<div class="foot">
<el-button @click="furtherEvent(false)" icon="el-icon-close">不合格</el-button>
<el-button @click="furtherEvent(true)" icon="el-icon-check">合格</el-button>
</div>
<el-dialog center top="5vh" :visible.sync="dialogVisible" width="90%" :show-close="false"
:close-on-click-modal="false">
<div class="dialogMain">
<p class="form-item">
<label class="form-item-label"><strong>*</strong>原因</label>
<el-select filterable class="form-item-input" v-model="bhgyy" placeholder="请选择">
<el-option v-for="item in bhgyysz" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</p>
<p class="form-item">
<label class="form-item-label"><strong>*</strong>处理</label>
<el-select class="form-item-input" v-model="bhgcl" placeholder="请选择">
<el-option v-for="item in bhgclsz" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</p>
<p class="form-item">
<label class="form-item-label"><strong>*</strong>数量</label>
<el-input-number class="form-item-input" v-model="bhgsl" :min="1" label="描述文字"></el-input-number>
</p>
<p class="form-item">
<label class="form-item-label">&nbsp;备注</label>
<el-input class="form-item-input textarea1" type="textarea" :rows="2" placeholder="请输入内容" v-model="bz">
</el-input>
</p>
<p class="form-item pz">
<label class="form-item-label form-item-lastlabel">&nbsp;拍照</label>
<el-switch class="form-item-input switch1" v-model="sfsctp" active-color="#13ce66" inactive-color="#0052c0">
</el-switch>
</p>
<p v-if="sfsctp" class="form-item tp">
<el-upload id="invoiceScan" ref="upload" :multiple="true" :auto-upload="false" :on-success="uploadSuccess"
:before-upload="beforeUpload" :on-exceed="warningExceed" :limit="5" :data="uploadImgData" :action="action1"
list-type="picture-card">
<i class="el-icon-plus" />
</el-upload>
</p>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button @click="bhgclEvent" icon="el-icon-check" type="primary">
</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
//
import request from '@/utils/request'
var requestConfig = window.dt_Config.requestConfig
export default {
created () {
},
mounted () {},
data () {
return {
userInfo: null,
pcsl: '',
fullscreenLoading: false,
action1: '',
uploadImgData: {},
sccx: '',
sccxsz: [],
gxwl: '',
gdid: '',
bm: '',
jclx: '巡检',
wldh: '',
wlpc: '',
ggxh: '',
scdd: '',
bhgyy: '',
bhgcl: '',
bhgsl: 1,
bz: '',
sfsctp: false,
fileList: [],
dialogVisible: false,
scddsz: [],
jclxsz: [ // 检测类型数组
{
label: '首检',
value: '首检'
}, {
label: '巡检',
value: '巡检'
}, {
label: '终检',
value: '终检'
}
],
bhgyysz: [],
bhgclsz: []
}
},
methods: {
init () {
this.action1 = requestConfig
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
this.getcxlb()
},
clearData () {
this.bm = ''
this.sccx = ''
this.jclx = '巡检'
this.pcsl = ''
this.scdd = ''
this.gdid = ''
this.gxwl = ''
this.wldh = ''
this.wlpc = ''
this.ggxh = ''
this.bhgyy = ''
this.bhgcl = ''
this.bhgsl = 1
this.bz = ''
this.sfsctp = false
},
getMqttMessage (newVal) {
this.bm = newVal
if (newVal) {
if (!this.scdd) {
this.$message({
type: 'warning',
message: '请选择生产订单',
duration: 1000
})
} else {
if (newVal.length === 10) {
this.gxzjEvent(newVal, '')
} else {
this.gxzjEvent('', newVal)
}
}
}
},
getscdd (val) {
let data = {
method: 'post',
data: this.CreateData1('11', '质量管理_物料检测产线订单_查询', [
['产线id', val]
])
}
request(data).then(res => {
let scddsz = []
res.data.map(item => {
item.label = item.工单号
item.value = item.工单id
scddsz.push(item)
})
this.scddsz = scddsz
if (res.data.length > 0) {
let idx = res.data.findIndex(tar => tar.工单状态 === 2)
if (idx >= 0) {
this.scdd = res.data[idx].工单id
} else {
this.scdd = res.data[0].工单id
}
} else {
this.scdd = ''
}
}).catch(err => {
console.log(err)
})
},
getcxlb () { // 获取生产产线
let data = this.CreateData('Select', '基础表_产线名称', ['产线id', '产线名称'])
const param = {
method: 'post',
data: data
}
this.fullscreenLoading = true
request(param).then(res => {
let sccxsz = []
res.data.map(item => {
sccxsz.push({
label: item.产线名称,
value: item.产线id
})
})
this.sccxsz = sccxsz
this.fullscreenLoading = false
}).catch(err => {
console.log(err)
this.fullscreenLoading = false
if (err.code === 'ERR_NETWORK' || err.code === 'ECONNABORTED') {
this.$message({
duration: 1000,
type: 'error',
message: '网络错误'
})
}
})
},
uploadSuccess (res) { // 上传成功回调
this.$refs.upload.clearFiles()
this.clearData()
this.dialogVisible = false
this.$message({
type: 'success',
message: '操作成功',
duration: 1000
})
this.fullscreenLoading = false
},
beforeUpload (file) { // 上传前检测
const isJPG = /^image\/.*/.test(file.type)
if (!isJPG) {
this.$message({
type: 'warning',
message: '只能上传图片',
duration: 1000
})
}
return isJPG
},
warningExceed () {
this.$message({
type: 'warning',
message: '仅可上传五张照片',
duration: 1000
})
},
getbhgclsz () { // 获取不合格处理数组
return new Promise((resolve, reject) => {
let data = this.CreateData('Select', '质量管理_不合格处理', ['不合格处理id', '不合格处理'])
const param = {
method: 'post',
data: data
}
request(param).then(res => {
let bhgclsz = []
res.data.map(item => {
bhgclsz.push({
label: item.不合格处理,
value: item.不合格处理id
})
})
this.bhgclsz = bhgclsz
resolve('')
}).catch(err => {
reject(err)
})
})
},
getbhgyysz () { // 获取不合格原因数组
return new Promise((resolve, reject) => {
let data = this.CreateData('Select', '质量管理_不合格原因', ['不合格原因id', '不合格原因', '代码'])
const param = {
method: 'post',
data: data
}
request(param).then(res => {
let bhgyysz = []
res.data.map(item => {
bhgyysz.push({
label: item.不合格原因 + item.代码,
value: item.不合格原因id
})
})
this.bhgyysz = bhgyysz
resolve('')
}).catch(err => {
reject(err)
})
})
},
/**
* 扫码确定
*/
gxzjEventEvent () {
if (!this.bm) {
this.$message({
type: 'warning',
message: '请输入编码',
duration: 1000
})
return
}
if (!this.scdd) {
this.$message({
type: 'warning',
message: '请选择生产订单',
duration: 1000
})
return
}
if (this.bm.length === 10) {
this.gxzjEvent(this.bm, '')
} else {
this.gxzjEvent('', this.bm)
}
},
async furtherEvent (val) { // 合格不合格事件
if (this.jclx && this.sccx && this.scdd && this.wlpc && this.wldh) {
if (val) { // 合格处理
this.hgclEvent()
} else { // 不合格处理
this.fullscreenLoading = true
try {
await this.getbhgclsz()
await this.getbhgyysz()
if (this.pcsl && this.pcsl > 0) {
this.bhgsl = JSON.parse(JSON.stringify(this.pcsl))
}
this.dialogVisible = true
} catch (err) {
if (err.code === 'ERR_NETWORK' || err.code === 'ECONNABORTED') {
this.$message({
duration: 1000,
type: 'error',
message: '网络错误'
})
}
} finally {
this.fullscreenLoading = false
}
}
} else {
this.$message({
type: 'warning',
message: '请确保必要字段存在数据',
duration: 1000
})
}
},
bhgclEvent () { // 不合格处理
if (!this.bhgcl || !this.bhgyy) {
this.$message({
type: 'warning',
message: '请选择不合格处理与不合格原因',
duration: 1000
})
return
}
let param = []
param[0] = ['检测人', this.$store.state.userInfo.人员编号]
param[1] = ['备注', this.bz]
param[2] = ['不合格处理', this.bhgcl] // this.bhgyy.value
param[3] = ['不合格原因', this.bhgyy] // this.bhgcl.value
param[4] = ['工位id', 1]
param[5] = ['是否合格', 0]
param[6] = ['检测类型', this.jclx]
param[7] = ['物料码', this.wldh]
param[8] = ['物料名称', this.gxwl]
param[9] = ['产品名称', '111']
param[10] = ['物料批次', this.wlpc]
param[11] = ['规格型号', this.ggxh]
param[12] = ['操作者', this.czz]
param[13] = ['不合格数量', this.bhgsl]
param[14] = ['工单id', this.gdid]
param[15] = ['质量id', '1111', 'int', '1']
param[16] = ['数据类型', 2]
let data = {
method: 'post',
data: this.CreateData1('12', '质量管理_工序质检_不合格处理', param)
}
this.fullscreenLoading = true
request(data).then(res => {
if (this.sfsctp && this.$refs.upload.$data.uploadFiles.length > 0) {
this.bhgscEvent(res.data.output[0].质量id)
} else {
if (res.data.result[0].result === '1') {
this.$message({
type: 'success',
message: '操作成功',
duration: 1000
})
this.clearData()
this.dialogVisible = false
} else {
this.$message({
type: 'error',
message: '操作失败',
duration: 1000
})
}
this.fullscreenLoading = false
}
}).catch(err => {
this.fullscreenLoading = false
if (err.code === 'ERR_NETWORK' || err.code === 'ECONNABORTED') {
this.$message({
duration: 1000,
type: 'error',
message: '网络错误'
})
}
})
},
bhgscEvent (id) { // 不合格图片上传
var param = []
param[0] = ['质量id', id]
param[1] = ['文件名称', '']
param[2] = ['文件后缀', '']
param[3] = ['文件内容', null]
var Data1 = this.CreateData1('15', 'PDA_文件存储_增加', param)
this.uploadImgData.param = Data1
this.$refs.upload.submit()
},
hgclEvent () { // 合格处理
let param = []
param[0] = ['检测人', this.$store.state.userInfo.人员编号]
param[1] = ['工位id', 1]
param[2] = ['是否合格', 1]
param[3] = ['检测类型', this.jclx]
param[4] = ['物料码', this.wldh]
param[5] = ['物料名称', this.gxwl]
param[6] = ['产品名称', '111']
param[7] = ['物料批次', this.wlpc]
param[8] = ['规格型号', this.ggxh]
param[9] = ['操作者', this.czz]
param[10] = ['工单id', this.gdid]
param[11] = ['数据类型', 2]
let data = {
method: 'post',
data: this.CreateData1('12', '质量管理_工序质检_合格处理', param)
}
this.fullscreenLoading = true
request(data).then(res => {
if (res.data[0].result === '1') {
this.clearData()
this.$message({
type: 'success',
message: '操作成功',
duration: 1000
})
} else {
this.$message({
type: 'error',
message: '操作失败',
duration: 1000
})
}
this.fullscreenLoading = false
}).catch(err => {
this.fullscreenLoading = false
if (err.code === 'ERR_NETWORK' || err.code === 'ECONNABORTED') {
this.$message({
duration: 1000,
type: 'error',
message: '网络错误'
})
}
})
},
/**
* 查询信息
*/
gxzjEvent (wlbm, wlpc) { // 工序质检
let whereArr = []
let gd = this.scddsz.find(tar => tar.工单id === this.scdd)
if (wlbm) {
whereArr = [{
fieldname: '物料编码',
value: wlbm
}, {
fieldname: '生产订单',
value: gd ? gd.工单号 : ''
}]
} else {
whereArr = [{
fieldname: '物料批次',
value: wlpc
}, {
fieldname: '生产订单',
value: gd ? gd.工单号 : ''
}]
}
const data = this.CreateData(
'Select',
'仓储管理_物料配送单明细_视图',
['单据编号', '是否接收', '工单id', '配送单明细id', '物料编码', '规格型号', '物料名称', '单位', '配送数量', '物料批次', '已领数量',
'线边已领数量', '生产订单', '生产产线'
], {
where: whereArr
}
)
const param = {
method: 'post',
data: data
}
this.fullscreenLoading = true
request(param).then(res => {
if (res.data.length > 0) {
this.gxwl = res.data[0].物料名称
this.wldh = res.data[0].物料编码
this.wlpc = res.data[0].物料批次
this.ggxh = res.data[0].规格型号
this.gdid = res.data[0].工单id
this.pcsl = res.data[0].配送数量
} else {
this.$message({
type: 'warning',
message: '无数据',
duration: 1000
})
}
this.fullscreenLoading = false
}).catch(err => {
this.fullscreenLoading = false
if (err.code === 'ERR_NETWORK' || err.code === 'ECONNABORTED') {
this.$message({
duration: 1000,
type: 'error',
message: '网络错误'
})
}
})
}
},
computed: {},
components: {},
watch: {},
props: {}
}
</script>
<style lang="less" scoped>
.container {
height: 100%;
width: 100%;
/deep/.header {
padding: 1rem 1rem 1rem 2rem;
display: flex;
height: 4rem;
.head-inp {
.el-input__inner {
font-size: 2rem;
height: 100%;
}
input::-webkit-input-placeholder {
text-align: center;
}
}
.head-btn {
height: 100%;
padding: 0;
display: block;
width: 15rem;
margin-left: 1rem;
font-size: 1.8rem;
border-radius: 0.5rem;
background-color: rgba(0, 82, 192, 0.1);
color: #0052c0;
border: 1px solid #7da7df;
}
}
/deep/.form-item {
font-size: 2rem;
margin-top: 1rem;
margin-bottom: 0;
display: flex;
align-items: center;
.form-item-label {
width: 30%;
display: flex;
align-items: center;
justify-content: flex-end;
strong {
color: red;
}
}
.form-item-input {
width: 68%;
font-size: 2rem;
.el-input__inner {
font-size: 2rem;
border: 0;
background-color: #f9fdff;
border-radius: 0;
border-bottom: 1px solid #5a8fd7;
}
}
&:first-child {
.el-input__inner {
border-radius: 5px;
border: 1px solid #5a8fd7;
}
}
&:last-child {
.el-input__inner {
border-radius: 5px;
border: 1px solid #5a8fd7;
}
}
&:nth-child(2) {
.el-input__inner {
border-radius: 5px;
border: 1px solid #5a8fd7;
}
}
}
/deep/.foot {
padding: 0;
display: flex;
justify-content: space-between;
width: 100%;
height: 6rem;
position: relative;
bottom: 0rem;
.el-button {
width: 18rem;
background-color: #c70019;
color: #fff;
height: 6rem;
font-size: 3rem;
}
.el-button:last-child {
background-color: #0052c0;
}
}
.content {
overflow: auto;
height: calc(90% - 12rem);
min-height: 60vh;
.form-item {
&:nth-child(2) {
.form-item-input {
width: 40%
}
}
}
}
/deep/.el-dialog__header {
padding: 0;
}
/deep/.el-dialog__body {
padding-bottom: 0;
padding: 30px 5px;
}
/deep/.el-dialog__footer {
padding: 0.1rem;
}
/deep/.dialog-footer {
padding: 0;
display: flex;
justify-content: space-between;
.el-button {
width: 16rem;
font-size: 2rem;
&:first-child {
background-color: #aaaaaa;
color: #fff;
}
&:last-child {
background-color: #0052c0;
}
}
}
.dialogMain {
/deep/.form-item {
width: 100%;
padding: 0 0rem;
margin-top: 2rem;
display: flex;
align-items: center;
.form-item-label {
font-size: 2rem;
width: fit-content;
white-space: nowrap;
display: flex;
align-items: center;
justify-content: flex-end;
strong {
color: red;
}
}
.form-item-input {
width: max-content;
font-size: 2rem;
border-radius: 0.3rem;
.el-input__inner {
font-size: 2rem;
border-radius: 5px;
border: 1px solid #6294d8;
}
.el-input-number__increase {
color: #333333;
font-weight: bold;
background-color: transparent;
border: 0;
}
.el-input-number__decrease {
color: #333333;
font-weight: bold;
background-color: transparent;
border: 0;
}
}
.textarea1 {
width: -webkit-fill-available;
.el-textarea__inner {
border: 1px solid #6294d8;
}
}
}
.pz {
.form-item-lastlabel {
width: fit-content;
}
.switch1 {
width: max-content;
border: 0;
}
}
.tp {
display: flex;
justify-content: center;
}
/deep/.el-upload-list--picture-card {
display: flex;
justify-content: center;
flex-wrap: wrap;
}
/deep/.el-upload-list--picture-card .el-upload-list__item {
width: 10rem;
height: 10rem;
}
/deep/.el-upload--picture-card {
width: 10rem;
display: flex;
height: 10rem;
align-items: center;
justify-content: center;
}
}
}
</style>

View File

@@ -0,0 +1,343 @@
<template>
<div class="container" v-loading.fullscreen.lock="fullscreenLoading">
<div v-if="!dialogVisible">
<el-table
:data="list"
stripe
border
style="width: 100%; font-size: 18px"
max-height="550px"
:header-cell-style="{ color: '#000', fonSize: '16px' }"
@row-click="rowclick"
>
<el-table-column prop="车间名称" align="center" label="车间" width="80">
</el-table-column>
<el-table-column prop="工位编号" align="center" label="工位" width="70">
</el-table-column>
<el-table-column
prop="物料名称"
align="center"
label="物料名称"
width="135"
>
</el-table-column>
<el-table-column align="center" prop="数量" label="数量">
</el-table-column>
</el-table>
</div>
<div
v-if="dialogVisible"
width="100%"
height="100%"
:before-close="handleClose"
class="dialog"
>
<div>
<i
@click="handleClose()"
class="el-icon-close"
style="
font-size: 24px;
color: #409eff;
margin-bottom: 10px;
float: right;
margin-top: 5px;
"
></i>
</div>
<div class="top">
<input type="text" v-model="bm" placeholder="扫料箱物料码" />
<el-button @click="buttonok">
<i class="el-icon-check"></i> 确定</el-button
>
</div>
<div>
<el-form ref="form" :model="obj" label-width="100px" class="form">
<el-form-item label="呼叫产线">
<el-input v-model="obj.产线名称" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="呼叫工位">
<el-input v-model="obj.工位编号" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="物料名称">
<el-input v-model="obj.物料名称" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="规格型号">
<el-input v-model="obj.规格" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="呼叫数量">
<el-input v-model="obj.数量" class="inp" disabled> </el-input>
</el-form-item>
<el-form-item label="已领数量">
<el-input v-model="obj.已领数量" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="本次配送" class="peisong">
<el-input v-model="sum"></el-input>
</el-form-item>
</el-form>
</div>
<div @click="buliaook" class="ok">
<i class="el-icon-check"></i> 补料完成
</div>
</div>
</div>
</template>
<script>
import request from '@/utils/request'
import { init } from '@/utils/mqttStart.js'
var mqttUrl = window.dt_Config.mqttUrl
export default {
mounted() {
this.get()
},
data() {
return {
fullscreenLoading: false,
dialogVisible: false,
isshow: false,
list: [],
obj: {},
bm: '',
mqttConnection: {
host: '192.168.30.201',
port: '8083',
endpoint: '/mqtt',
clean: true, // 保留会话
connectTimeout: 4000, // 超时时间
reconnectPeriod: 4000, // 重连时间间隔
clientId: '', // 同一个ID 无法二次连接 PDABarCode
username: '',
password: '',
},
subscription: {
topic: 'MesBarCode',
qos: 0,
},
publication: {
topic: 'PDABarCode',
qos: 0,
payload: '',
},
sum: 0,
}
},
created() {
this.mqttConnection.host = mqttUrl
// localStorage.pdaId=JSON.stringify('PDA_5X_GF9_ZP')/ /
let pdaId = 'PDA_5X_CK2_KK'
console.log(pdaId, 11111)
if (pdaId) {
init(pdaId, this.mqttConnection, this.subscription, this.publication)
} else {
this.$router.push({
name: 'main',
})
}
},
methods: {
buliaook() {
var param = []
param[0] = ['id', this.obj.id]
param[1] = ['本次配送', parseFloat(this.sum)]
var data = this.CreateData1('12', '仓储管理_缺料呼叫_补料', param)
this.ExecDatabase(data).then((res) => {
console.log(res)
if (res.data[0].result == '1') {
this.$message({
message: '补料成功',
type: 'success',
})
this.dialogVisible = false
this.sum = 0
this.get()
}
})
},
buttonok() {
let arr = this.bm.split(';')
if (arr[1] == this.obj.物料编号) {
this.bm = arr[1]
this.sum = parseFloat(this.sum) + parseFloat(arr[3])
} else {
this.$message({
message: '物料批次不满足先进先出,不能出库。',
type: 'warning',
})
}
},
init() {},
getmsg(newVal) {
this.bm = ''
this.bm = newVal
let arr = newVal.split(';')
if (arr[1] == this.obj.物料编号) {
this.bm = arr[1]
this.sum = parseFloat(this.sum) + parseFloat(arr[3])
} else {
this.$message({
message: '物料批次不满足先进先出,不能出库。',
type: 'warning',
})
}
},
handleClose() {
this.sum = 0
this.bm = ''
this.dialogVisible = false
this.obj = {}
},
rowclick(row) {
console.log(row)
this.obj = row
this.dialogVisible = true
},
toFixed(num) {
if (!isNaN(num)) {
return (num + '').indexOf('.') == -1 ? num : num.toFixed(6)
}
},
get() {
var data = this.CreateData(
'Select',
'看板管理_物料需求_查询视图',
[
'车间名称',
'物料名称',
'规格',
'数量',
'需求时间',
'工位编号',
'id',
'产线名称',
'已领数量',
'物料编号',
],
{
where: [
{
fieldname: '数量',
logic: '>',
value: 0,
},
],
}
)
this.ExecDatabase(data).then((res) => {
console.log(res, '数据')
res.data.map((ele) => {
ele.数量 = this.toFixed(ele.数量)
ele.需求时间 = ele.需求时间.slice(0, 5)
})
this.list = res.data
})
},
},
computed: {
getMqttMsg() {
return this.$store.state.mqttMsg
},
},
components: {},
watch: {
getMqttMsg: {
handler: function (newVal) {
if (newVal) {
this.getmsg(newVal)
}
// console.log(newVal)
setTimeout(() => {
this.$store.dispatch('saveMqttMsg', '')
})
},
},
},
props: {},
}
</script>
<style lang="less" scoped>
.container {
height: 100%;
width: 100%;
overflow: hidden;
}
.top {
width: 100%;
display: flex;
justify-content: space-between;
border: 1px solid #0052c0;
input {
outline: 0;
width: 80%;
border: 0;
text-align: center;
font-size: 16px;
}
.el-button {
border: 0;
border-left: 1px solid #0052c0;
color: #0052c0;
background: #f3f7fc;
}
}
.form {
margin-top: 20px;
margin-bottom: 20px;
/deep/ .el-form-item__label {
font-size: 18px;
color: #000;
}
/deep/ .el-input__inner {
text-align: center;
font-size: 18px;
color: #000;
}
.el-input {
border-radius: 4px;
}
}
.inp {
border: 0 !important;
outline: 0;
text-align: center;
}
.dialog {
width: 90%;
height: 100%;
margin: 0 !important;
position: absolute;
top: 0;
left: 20px;
right: 120px;
}
/deep/ .el-dialog__body {
padding: 40px 20px;
}
.ok {
width: 111%;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 20px;
background-color: #0052c0;
color: #fff;
margin-left: -20px;
margin-right: -20px;
}
/deep/ .el-form-item {
margin-bottom: 10px;
}
</style>

View File

@@ -0,0 +1,346 @@
<template>
<div class="container" v-loading.fullscreen.lock="fullscreenLoading">
<!-- <p class="quit"> <i @click='quit' class="el-icon-arrow-left"></i> </p> -->
<div class="main " style="margin-top:80px">
<el-select v-model='车间' placeholder="请选择车间" clearable @change="search">
<el-option v-for="(ele,index) in 车间数组" :key='index' :label='ele.text' :value="ele.value"></el-option>
</el-select>
</div>
<div class="main">
<el-select v-model='产线' placeholder="请选择产线" clearable @change="search2">
<el-option v-for="(ele,index) in 产线数组" :key='index' :label='ele.text' :value="ele.value"></el-option>
</el-select>
</div>
<div class="main">
<el-select v-model='工单' placeholder="请选择工单" clearable @change="Selection">
<el-option v-for="(ele,index) in 工单数组" :key='index' :label='ele.text' :value="ele.value"></el-option>
</el-select>
</div>
<div class="main">
<el-select v-model='配送单' placeholder="请选择配送单" clearable>
<el-option v-for="(ele,index) in 配送单数组" :key='index' :label='ele.text' :value="ele.value"></el-option>
</el-select>
</div>
<div @click='to' class="foot">
确定
</div>
</div>
</template>
<script>
import request from '@/utils/request'
var requestConfig = window.dt_Config.requestConfig
export default {
created() {
},
mounted() {
console.log(this.车间)
this.get()
},
data() {
return {
userInfo: null,
fullscreenLoading: false,
action1: '',
车间: '',
车间数组: [],
产线: '',
产线数组: [],
工单: '',
工单数组: [],
配送单: '',
配送单数组: [],
obj: {
车间: '',
产线: '',
工单: '',
配送单: ''
}
}
},
methods: {
init() {
this.action1 = requestConfig
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
},
getMqttMessage(newVal) {
},
search2() {
if (this.产线 == '') {
this.工单数组 = []
this.配送单数组 = []
this.工单 = ''
this.配送单 = ''
}
this.工单数组 = []
this.配送单数组 = []
this.工单 = ''
this.配送单 = ''
let data2 = this.CreateData(
'Select',
'工单管理_工单信息视图',
['工单id', '工单号'], {
where: [{
fieldname: '产线id',
value: parseInt(this.产线)
},
{
fieldname: '是否领完',
value: 0
}
]
}
)
this.ExecDatabase(data2).then(res => {
this.工单数组 = res.data.map(item => {
return {
value: item.工单id,
text: item.工单号
}
})
})
},
get() {
var data = this.CreateData(
'Select',
'基础表_车间',
['车间id', '车间名称'], {}
)
this.ExecDatabase(data).then(res => {
this.车间数组 = res.data.map(item => {
return {
value: item.车间id,
text: item.车间名称
}
})
})
},
search() {
if(this.车间 == ''){
localStorage.setItem('车间', '')
localStorage.setItem('产线','')
localStorage.setItem('工单','')
localStorage.setItem('配送单','')
}
this.产线数组 = []
this.工单数组 = []
this.配送单数组 = []
this.产线 = ''
this.工单 = ''
this.配送单 = ''
let data = this.CreateData(
'Select',
'基础表_产线名称',
['产线id', '产线名称'], {
where: [{
fieldname: '车间id',
value: parseInt(this.车间)
}]
}
)
this.ExecDatabase(data).then(res => {
this.产线数组 = res.data.map(item => {
return {
value: item.产线id,
text: item.产线名称
}
})
})
},
Selection() {
this.配送单数组 = []
this.配送单 = ''
// var param = []
// param[0] = ['工单id',this.工单]
// var data = this.CreateData1(11,'物料管理_配送单列表',param)
// this.ExecDatabase(data).then(res=>{
// this.配送单数组 = res.data.map(item => {
// return {
// value: item.单据编号,
// text: item.单据编号
// }
// })
// })
var param = []
param[0] = ['工单id', this.工单]
var data = this.CreateData1(11, '物料管理_配送单列表', param)
this.ExecDatabase(data).then((res) => {
this.配送单数组 = res.data.map(item => {
return {
value: item.单据编号,
text: item.单据编号
}
})
})
},
to() {
if (this.配送单 == '') {
this.$message({
message: '请选择配送单',
type: 'warning'
})
} else {
this.$router.push({
path: '/peisong',
query: {
配送单: this.配送单
}
})
}
// 变成 /user?id=2
},
quit() {
this.产线 = ''
this.工单 = ''
this.配送单 = ''
this.车间 = ''
this.$router.replace('/')
}
},
computed: {},
components: {},
watch: {},
props: {},
// deactivated() {
// console.log('离开', this.obj)
// this.obj.车间 = this.车间
// this.obj.产线 = this.产线
// this.obj.工单 = this.工单
// this.obj.配送单 = this.配送单
// },
// activated() {
// console.log('进入', localStorage.getItem('产线'))
// let data = this.CreateData(
// 'Select',
// '基础表_产线名称',
// ['产线id', '产线名称'], {
// where: [{
// fieldname: '车间id',
// value: parseInt(localStorage.getItem('车间')) || ''
// }]
// }
// )
// this.ExecDatabase(data).then(res => {
// this.产线数组 = res.data.map(item => {
// return {
// value: item.产线id,
// text: item.产线名称
// }
// })
// // this.车间 = parseInt(localStorage.getItem('车间')) || ''
// // this.产线 = parseFloat(localStorage.getItem('产线')) || ''
// })
// let data2 = this.CreateData(
// 'Select',
// '工单管理_工单信息视图',
// ['工单id', '工单号'], {
// where: [{
// fieldname: '产线id',
// value: parseFloat(localStorage.getItem('产线')) || ''
// },
// {
// fieldname: '是否领完',
// value: 0
// }
// ]
// }
// )
// this.ExecDatabase(data2).then(res => {
// this.工单数组 = res.data.map(item => {
// return {
// value: item.工单id,
// text: item.工单号
// }
// })
// // this.工单 = parseFloat(localStorage.getItem('工单')) || ''
// // this.配送单 = localStorage.getItem('配送单') || ''
// })
// var param = []
// param[0] = ['工单id',localStorage.getItem('工单') || '']
// var data5 = this.CreateData1(11, '物料管理_配送单列表', param)
// this.ExecDatabase(data5).then((res) => {
// this.配送单数组 = res.data.map(item => {
// return {
// value: item.单据编号,
// text: item.单据编号
// }
// })
// })
// }
}
</script>
<style lang="less" scoped>
/deep/ .el-input__inner::placeholder {
color: #000;
text-align: center;
}
.container {
width: 100%;
}
.main {
width: 100%;
text-align: center;
margin: 20px 0;
.el-select {
width: 80%;
height: 60px;
line-height: 60px;
border: 1px solid #409eff;
border-radius: 4px;
}
/deep/ .el-input__inner {
height: 60px;
line-height: 60px;
font-size: 20px;
text-align: center;
}
/deep/ .el-select-dropdown__item {
height: 0 !important;
padding: 20px 20px !important;
}
}
.foot {
width: 100%;
text-align: center;
height: 60px;
line-height: 60px;
background: #0052c0;
color: #fff;
font-size: 22px;
margin-top: 60px;
}
.quit {
color: #0052c0;
font-size: 30px;
position: absolute;
top: 0;
padding: 8px 6px;
border-radius: 4px;
}
/deep/ .contaniner[data-v-c9a65f5a] {
padding: 0;
}
</style>

View File

@@ -0,0 +1,182 @@
<template>
<div class="container" v-loading.fullscreen.lock="fullscreenLoading">
<div v-if='!isshow'>
<div class="sel" style="margin-top:120px">
<el-select v-model='车间' placeholder="请选择车间" clearable @change="search">
<el-option v-for="(ele,index) in 车间数组" :key='index' :label='ele.text' :value="ele.value"></el-option>
</el-select>
</div>
<div class="sel">
<el-select v-model='工单' placeholder="请选择工单" clearable @change="show">
<el-option v-for="(ele,index) in 工单数组" :key='index' :label='ele.text' :value="ele.value"></el-option>
</el-select>
</div>
</div>
<div v-if="isshow" width="100%" :before-close="handleClose" class="dialog">
<div style="float: right;font-size: 24px;color: #409eff;margin-right: 10px;padding-top: 10px;margin-bottom:5px"><i @click='handleClose' class="el-icon-close"></i> </div>
<el-table :data="list" stripe border style="width: 100%;font-size: 18px;" max-height="480px"
:header-cell-style="{color: '#000',fonSize:'16px'}">
<el-table-column prop="物料名称" align="center" label="物料名称" width="155">
</el-table-column>
<el-table-column prop="规格型号" align="center" label="规格型号" width="100">
</el-table-column>
<el-table-column align="center" label="数量">
<template slot-scope="scope">
<div>
{{scope.row.库存数量}}
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import request from '@/utils/request'
var requestConfig = window.dt_Config.requestConfig
export default {
created() {
},
mounted() {
this.get()
},
data() {
return {
fullscreenLoading: false,
车间: '',
车间数组: [],
工单: "",
工单数组: [],
isshow: false,
list: []
}
},
methods: {
toFixed(num) {
if (!isNaN(num)) {
return ((num + '').indexOf('.') == -1) ? num : num.toFixed(6);
}
},
init() {},
get() {
var data = this.CreateData(
'Select',
'基础表_车间',
['车间id', '车间名称'], {}
)
this.ExecDatabase(data).then(res => {
console.log(res)
this.车间数组 = res.data.map(item => {
return {
value: item.车间id,
text: item.车间名称
}
})
})
},
search() {
this.工单 = ''
this.工单数组 = []
var data2 = this.CreateData(
'Select',
'工单管理_工单信息视图',
['工单id', '工单号'],
{
where: [
{
fieldname:'车间id',
value:this.$store.state.车间id
},
{
fieldname:'是否消耗',
value:0
}
],
}
)
var param = []
param[0] = ['车间id',parseInt(this.车间)]
var data2 = this.CreateData1('11','物料管理_工单列表_线边物料',param)
this.ExecDatabase(data2).then(res => {
this.工单数组 = res.data.map(item => {
return {
value: item.工单id,
text: item.工单号
}
})
})
},
show() {
var param = []
param[0] = ['工单号_check', this.工单 ? 1 : 0]
param[1] = ['工单id', this.工单]
param[2] = ['物料名称_check', 0]
param[3] = ['物料名称', '']
param[4] = ['批次号_check', 0]
param[5] = ['批次号', '']
param[6] = ['物料来源_check', 0]
param[7] = ['物料来源', '']
var Data = this.CreateData1('11', '物料管理_线边物料_查询', param)
this.ExecDatabase(Data).then((res) => {
console.log(res.data)
res.data.forEach(ele =>
ele.库存数量 = this.toFixed(parseFloat(ele.库存数量))
)
this.list = res.data
})
this.isshow = true
},
handleClose() {
this.isshow = false
this.list = []
}
},
computed: {},
components: {},
watch: {},
props: {}
}
</script>
<style lang="less" scoped>
.container {
height: 100%;
width: 100%;
overflow: hidden;
}
.sel {
width:100%;
text-align: center;
.el-select{
width: 80%;
margin: 20px 0;
height: 60px;
line-height: 60px;
border: 1px solid #409eff;
border-radius: 4px;
}
/deep/ .el-input__inner {
height: 60px;
line-height: 60px;
font-size: 20px;
text-align: center;
}
}
.dialog{
position: absolute;
top: 0;
}
/deep/ .el-input__inner::placeholder {
color: #000;
text-align: center;
}
/deep/ .el-select .el-input__inner{
color: #000;
}
</style>

69
src/main.js Normal file
View File

@@ -0,0 +1,69 @@
// 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 '@/store/index.js'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import tool from '@/utils/tool.js'
import Vant from 'vant'
import 'vant/lib/index.css'
Vue.use(Vant)
const throttle = {
bind: (el, binding) => {
let throttleTime = binding.value // 防抖时间
if (!throttleTime) { // 用户若不设置防抖时间则默认1s
throttleTime = 1000
}
let timer
let disable = false
el.addEventListener('click', event => {
if (timer) {
clearTimeout(timer)
}
if (!disable) { // 第一次执行(一点击触发当前事件)
disable = true
} else {
event && event.stopImmediatePropagation()
}
timer = setTimeout(() => {
timer = null
disable = false
}, throttleTime)
}, true)
}
}
Vue.directive('throttle', throttle);
Vue.config.productionTip = false
Vue.prototype.$axios = axios
Vue.prototype.$store = store
Vue.use(ElementUI)
Vue.use(tool)
// router.beforeEach((to, from, next) => {
// let userInfo = localStorage.userInfo
// let pdaId = localStorage.pdaId
// // console.log(userInfo)
// // console.log(pdaId)
// if (to.path === '/' && !userInfo && !pdaId) {
// next()
// } else {
// next('/login')
// }
// })
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
components: {
App
},
template: '<App/>'
})

41
src/router/index.js Normal file
View File

@@ -0,0 +1,41 @@
import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
Vue.use(Router)
export default new Router({
routes: [{
path: '/',
name: 'login',
component: () => import('@/views/login.vue'),
meta: {
keepAlive: true
}
},
{
path: '/main',
name: 'main',
component: () => import('@/views/main.vue'),
meta: {
keepAlive: true
}
},
{
path: '/peisong',
name: 'peisong',
component: () => import('@/views/peisong.vue'),
meta: {
keepAlive: true
}
},
{
path: '/peisongok',
name: 'peisongok',
component: () => import('@/views/peisongok.vue'),
meta: {
keepAlive: true
}
}
]
})

30
src/store/actions.js Normal file
View File

@@ -0,0 +1,30 @@
export const saveArr = (context, payload) => {
context.commit('saveArr', payload)
}
export const saveObj = ({
commit
}, payload) => {
commit('saveObj', payload)
}
export const saveUserInfo = (context, payload) => {
context.commit('saveUserInfo', payload)
}
export const savePdaId = (context, payload) => {
context.commit('savePdaId', payload)
}
export const saveMqttConnection = (context, payload) => {
context.commit('saveMqttConnection', payload)
}
export const saveSubscription = (context, payload) => {
context.commit('saveSubscription', payload)
}
export const savePublication = (context, payload) => {
context.commit('savePublication', payload)
}
export const saveMqttClient = (context, payload) => {
context.commit('saveMqttClient', payload)
}
export const saveMqttMsg = (context, payload) => {
context.commit('saveMqttMsg', payload)
}

14
src/store/index.js Normal file
View File

@@ -0,0 +1,14 @@
import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import * as actions from './actions'
import * as mutations from './mutations'
Vue.use(Vuex)
export default new Vuex.Store({
state,
actions,
mutations
})

29
src/store/mutations.js Normal file
View File

@@ -0,0 +1,29 @@
export const saveArr = (state, arr) => {
state.arr = arr
}
export const saveObj = (state, obj) => {
state.obj = obj
}
export const saveUserInfo = (state, userInfo) => {
state.userInfo = userInfo
}
export const savePdaId = (state, pdaId) => {
state.pdaId = pdaId
}
export const saveMqttConnection = (state, mqttConnection) => {
state.mqttConnection = mqttConnection
}
export const saveSubscription = (state, subscription) => {
state.subscription = subscription
}
export const savePublication = (state, publication) => {
state.publication = publication
}
export const saveMqttClient = (state, mqttClient) => {
state.mqttClient = mqttClient
}
export const saveMqttMsg = (state, mqttMsg) => {
state.mqttMsg = mqttMsg
}

38
src/store/state.js Normal file
View File

@@ -0,0 +1,38 @@
export default {
arr: [1, 2, 3],
obj: {
'a': 'aa'
},
userInfo: null,
pdaId: 'PDA_5X_CK2_KK',
mqttConnection: null,
subscription: null,
publication: null,
mqttClient: null,
mqttMsg: null
}
/* 读取
import {
mapState,
mapActions
} from 'vuex';
computed: {
...mapState(['arr']),
...mapState({
obj: state => state.obj,
}),
},
this.arr this.obj this.$store.state.arr */
/* 存入
methods: {
...mapActions(['saveArr', 'saveObj']),
...mapActions({
add: 'saveArr'
})}
this.$store.dispatch('saveObj', {
'a': 'bb'
});
this.saveArr(['a']).then(res => {
console.log(this.arr);
}) */

103
src/utils/mqtt.js Normal file
View File

@@ -0,0 +1,103 @@
import { v4 as uuid } from 'uuid'
import mqtt from 'mqtt'
class Mqtt {
constructor (config) {
this.connection = {
host: config.host,
port: config.port,
endpoint: config.endpoint || '/mqtt',
clean: config.clean || true,
connectTimeout: config.connectTimeout || 4000,
reconnectPeriod: config.reconnectPeriod || 4000,
clientId: config.clientId || uuid(),
username: config.username || '',
password: config.password || ''
}
this.client = {
connected: false
}
}
// 创建连接
createConnection () {
// 连接字符串, 通过协议指定使用的连接方式
// ws 未加密 WebSocket 连接
// wss 加密 WebSocket 连接
// mqtt 未加密 TCP 连接
// mqtts 加密 TCP 连接
// wxs 微信小程序连接
// alis 支付宝小程序连接
const { host, port, endpoint, ...options } = this.connection
const connectUrl = `ws://${host}:${port}${endpoint}`
try {
this.client = mqtt.connect(connectUrl, options)
} catch (error) {
// 连接错位、
this.connectError(error)
}
}
connectError (error) {
console.log('mqtt.connect error', error)
}
// 订阅主题
doSubscribe (subscription) {
const { topic, qos } = subscription
let subscribeSuccess = false
this.client.subscribe(topic, { qos }, (error, res) => {
if (error) {
subscribeSuccess = false
console.log('Subscribe to topics error', error)
} else {
subscribeSuccess = true
console.log('Subscribe to topics res', res)
}
})
return subscribeSuccess
}
// 取消订阅
doUnSubscribe (subscription) {
const { topic } = subscription
let unSubscribeSuccess = false
this.client.unsubscribe(topic, error => {
if (error) {
unSubscribeSuccess = false
console.log('Unsubscribe error', error)
} else {
unSubscribeSuccess = true
}
})
return unSubscribeSuccess
}
// 发送消息
doPublish (publish) {
const { topic, qos, payload } = publish
let doPublishSuccess = false
this.client.publish(topic, payload, qos, error => {
if (error) {
doPublishSuccess = false
console.log('Publish error', error)
} else {
doPublishSuccess = true
}
})
return doPublishSuccess
}
// 断开连接
destroyConnection () {
let destroyConnectionSuccess = false
if (this.client.connected) {
try {
this.client.end()
this.client = {
connected: false
}
destroyConnectionSuccess = true
console.log('Successfully disconnected!')
} catch (error) {
destroyConnectionSuccess = false
console.log('Disconnect failed', error.toString())
}
}
return destroyConnectionSuccess
}
}
export { Mqtt }

90
src/utils/mqttStart.js Normal file
View File

@@ -0,0 +1,90 @@
import {
Mqtt
} from '@/utils/mqtt.js'
import store from '@/store/index.js'
function init (pdaId, mqttConnection, subscription, publication) {
store.dispatch('savePdaId', pdaId)
store.dispatch('saveMqttConnection', mqttConnection)
store.dispatch('saveSubscription', subscription)
store.dispatch('savePublication', publication)
// store.dispatch('saveMqttClient', );
// pdaId = pdaId
// mqttConnection = mqttConnection
// console.log(mqttConnection);
// subscription = subscription
// publication = publication
connectMqtt()
}
function connectMqtt () {
let mqttClient = store.state.mqttClient
mqttClient = new Mqtt(store.state.mqttConnection)
mqttClient.createConnection()
mqttClient.client.on('connect', () => {
console.log('MQTT Connection succeeded!')
})
mqttClient.doSubscribe(store.state.subscription)
// 使用过程中的报错 断开连接 服务端出问题
mqttClient.client.on('error', error => {
console.log('Connection failed', error)
})
mqttClient.client.on('message', (topic, message) => {
mqttOnMessage(topic, message)
})
}
function disConnectMqtt () {
if (store.state.mqttConnection) {
store.state.mqttConnection.destroyConnection()
store.state.mqttConnection = null
}
}
function mqttOnMessage (topic, message) {
let pdaId = 'PDA_1010'
// console.log(topic, message.toString())
const arraysSignal = message.toString().split('|')
const mSource = arraysSignal[0] // MES
// const m_Command = arraysSignal[1]
const mOpName = arraysSignal[2]
switch (mSource) {
case 'BarCode':
switch (mOpName) {
case pdaId:
// const BarValue = arraysSignal[3]
connectMessage(arraysSignal[3], message)
// uni.$emit("connect-mqttOnMessage", arraysSignal[3], message)
// this.mqttSendMessage(`PDABarCode|Bar|${mOpName}|${BarValue}`)
break
default:
console.log(`消息工位号不匹配:${message.toString()};工位号:${pdaId}`)
break
}
break
default:
console.log(`消息来源不匹配:${message.toString()};工位号:${pdaId}`)
break
}
}
function connectMessage (val, msg) {
// window.dispatchEvent(new CustomEvent('onmessageMqtt', {
// detail: {
// data: val
// }
// }))
// window.addEventListener('onmessageMqtt', this.getMqttMessage)
store.dispatch('saveMqttMsg', val)
}
// function mqttSendMessage (message) {
// publication.payload = message
// mqttClient.doPublish(this.publication)
// }
export {
init,
mqttOnMessage,
disConnectMqtt,
connectMessage
}

35
src/utils/request.js Normal file
View File

@@ -0,0 +1,35 @@
import axios from 'axios'
var requestConfig = window.dt_Config.requestConfig
// `baseURL` 将自动加在 `url` 前面,除非 `url` 是一个绝对 URL。
let baseURL = ''
const instance = axios.create({
baseURL: baseURL,
timeout: 10000,
headers: {}
})
// 另一种配置超时时间
instance.defaults.timeout = 25000
function request ({
url = '',
method = 'get',
data = {},
params = {}
}) {
if (!url) {
url = requestConfig
}
return new Promise((resolve, reject) => {
instance({
method: method,
url: url,
data: data,
params: params
}).then(resolve).catch(err => {
reject(err)
})
})
}
export default request

360
src/utils/tool.js Normal file
View File

@@ -0,0 +1,360 @@
import request from '@/utils/request'
// 传通讯服务器参数
export default {
install (Vue) {
// 用于生成传通讯服务器参数。
// 传入参数
// 1type11查询12增删改必须
// 2name存储过程名必须
// 3data存储过程参数名和对应值例如
// param[0] = ['设备类型编码', '3', 'string', '0']
// param[1] = ['output', '3', 'int', '1'],必须
// 数组里四个分别对应存储过程参数名必须存储过程参数值必须参数类型若是output必须参数是否为output0否1是
// 4pageSizepageList分页使用可选
// 旧通讯格式
Vue.prototype.CreateData1 = function (type, name, data, pageSize, pageList) {
var paramStr = ''
var paramarray = []
if (type === '7') {
data.map(v => {
pageSize.map(h => {
const val = h.toString()
if (!v[val]) {
this.$set(v, val, '')
}
})
})
paramStr = data
} else {
if (data !== undefined) {
for (let i = 0; i < data.length; i++) {
paramarray.push({
name: data[i][0],
value: data[i][1],
type: data[i][2],
output: data[i][3]
})
}
paramStr = JSON.stringify(paramarray)
}
}
var obj = []
obj[0] = {}
obj[0].type = type
obj[0].name = name
obj[0].param = paramStr
obj[0].pageSize = pageSize
obj[0].pageList = pageList
var numn = JSON.stringify(obj[0])
return numn
}
// 新通讯格式
Vue.prototype.CreateData = (cmd, tbname, fieldshow, other) => {
const Param = JSON.stringify({
cmd,
tbname,
fieldshow,
...other
})
const data = {
type: 3001,
Param,
Name: '',
Pagination: '',
UserID: '',
HasReturn: false
}
return JSON.stringify(data)
}
// 新通讯11/12---<
Vue.prototype.ExecDatabase = function (num) {
return request({
url: '',
method: 'post',
data: num
})
}
// 设置字段宽度
Vue.prototype.setColumnWidth = function (str) {
let columnWidth = 0
if (str === '日期') {
columnWidth = 100
} else if (str === '工单号' || str === '产品名称') {
columnWidth = 160
} else if (str === '规则型号' || str === '产品编号') {
columnWidth = 150
} else if (str === '大数') {
columnWidth = 110
} else if (str === '状态') {
columnWidth = 100
} else if (str === '序号') {
columnWidth = 60
} else if (str === '单位') {
columnWidth = 60
} else if (str === '数量' || str === '库存') {
columnWidth = 80
} else if (str === '单价') {
columnWidth = 90
} else if (str === '金额') {
columnWidth = 120
} else if (str === '状态' || str === '类型' || str === '选入' || str === '选出') {
columnWidth = 80
} else if (str === '付款方式') {
columnWidth = 100
} else if (str === '买方' || str === '买方名称') {
columnWidth = 150
} else if (str === '外协厂家' || str === '调入仓库' || str === '调出仓库') {
columnWidth = 150
} else if (str === '姓名') {
columnWidth = 80
} else if (str === '日期时间') {
columnWidth = 140
} else if (str === '工序') {
columnWidth = 80
} else if (str === '物料名称' || str === '工件名称' || str === '零件名称') {
columnWidth = 140
} else if (str === '图号或型号' || str === '规格' || str === '零件图号' || str === '图号' || str === '图号/型号') {
columnWidth = 120
} else if (str === '物料编码' || str === '物料编号') {
columnWidth = 120
} else if (str === '材料') {
columnWidth = 80
} else if (str === '仓位' || str === '库位') {
columnWidth = 90
} else if (str === '品名/规格/型号') {
columnWidth = 140
} else if (str === '备注') {
columnWidth = 120
} else if (str === '工序名称') {
columnWidth = 150
} else if (str === '工序说明') {
columnWidth = 300
} else if (str === '加工工时M' || str === '加工时长H' || str === '加工时长M') {
columnWidth = 90
} else if (str === '加工设备') {
columnWidth = 130
} else if (str === '产品详情' || str === '详情') {
columnWidth = 340
} else if (str === '最低库存') {
columnWidth = 110
} else if (str === '本次到货数' || str === '本次入库' || str === '补货数') {
columnWidth = 100
} else {
columnWidth = 110
}
return columnWidth
}
}
}
// 数组去重s
export function arrayUnique (arr) {
arr.filter((element, index, arr) => {
return arr.indexOf(element) === index
})
}
// 时间转时间戳
export function timeToStamp (time) {
const date = new Date(time)
return date.getTime()
}
// 数组的深度拷贝
export function arrDeepCopy (arr) {
const newArr = []
for (const prop in arr) newArr[prop] = typeof arr[prop] === 'object' ? arrDeepCopy(arr[prop]) : arr[prop]
return newArr
}
// 对象的深度拷贝
export function objDeepCopy (obj) {
const newObj = {}
for (const prop in obj) newObj[prop] = typeof obj[prop] === 'object' ? objDeepCopy(obj[prop]) : obj[prop]
return newObj
}
function zeroFill (i) {
if (i >= 0 && i <= 9) {
return '0' + i
} else {
return i
}
}
// 获取当前日期时间
export function getNowTime () {
const date = new Date()
const month = zeroFill(date.getMonth() + 1)
const day = zeroFill(date.getDate())
const hour = zeroFill(date.getHours())
const minute = zeroFill(date.getMinutes())
const second = zeroFill(date.getSeconds())
const time = date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
return time
}
// 获取当前日期
export function getNowDate () {
const date = new Date()
const month = zeroFill(date.getMonth() + 1)
const day = zeroFill(date.getDate())
const time = date.getFullYear() + '-' + month + '-' + day
return time
}
// 获取当前时间
export function getNowDate1 () {
const date = new Date()
const hour = zeroFill(date.getHours())
const minute = zeroFill(date.getMinutes())
const second = zeroFill(date.getSeconds())
const time = hour + ':' + minute + ':' + second
return time
}
// 每月1号
export function getTime1 () {
const date = new Date()
const month = zeroFill(date.getMonth() + 1)
const time = date.getFullYear() + '-' + month + '-' + '01'
return time
}
// 工时统计上个月26-本月25
export function getTime26 () {
const date = new Date()
const day = date.getDate()
if (day > 25) {
var month = zeroFill(date.getMonth() + 1)
if (month === 0) {
month = 12
const day = 26
const time = date.getFullYear() - 1 + '-' + month + '-' + day
return time
} else {
const day = 26
const time = date.getFullYear() + '-' + month + '-' + day
return time
}
} else {
var month2 = zeroFill(date.getMonth() + 1) - 1
if (month2 === 0) {
month2 = 12
const day = 26
const time = date.getFullYear() - 1 + '-' + month2 + '-' + day
return time
} else {
const day = 26
const time = date.getFullYear() + '-' + month2 + '-' + day
return time
}
}
}
export function getTime25 () {
const date = new Date()
const day = date.getDate()
var time
if (day > 25) {
const month = zeroFill(date.getMonth() + 2)
const day2 = 25
if (month === 13) {
const month = 1
time = (date.getFullYear() + 1) + '-' + month + '-' + day2
} else {
time = date.getFullYear() + '-' + month + '-' + day2
}
return time
} else {
const month = zeroFill(date.getMonth() + 1)
const day2 = 25
if (month === 13) {
const month = 1
time = (date.getFullYear() + 1) + '-' + month + '-' + day2
} else {
time = date.getFullYear() + '-' + month + '-' + day2
}
return time
}
}
// 判断类型
export function type (target) {
const ret = typeof (target)
const template = {
'[object Array]': 'array',
'[object Object]': 'object',
'[object String]': 'string - object',
'[object Number]': 'Number - object',
'[object Boolean]': 'Boolean - object'
}
if (target === null) {
return 'null'
}
if (ret === 'object') {
const str = Object.prototype.toString.call(target)
return template[str]
} else {
return ret
}
}
export function SectionToChinese (section) {
const chnNumChar = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']
const chnUnitChar = ['', '十', '百', '千']
let strIns = ''
let chnStr = ''
let unitPos = 0
let zero = true
while (section > 0) {
const v = section % 10
if (v === 0) {
if (!zero) {
zero = true
chnStr = chnNumChar[v] + chnStr
}
} else {
zero = false
strIns = chnNumChar[v]
strIns += chnUnitChar[unitPos]
chnStr = strIns + chnStr
}
unitPos++
section = Math.floor(section / 10)
}
return chnStr
}
export function sleep (time) {
return new Promise(resolve => {
setTimeout(resolve, time)
})
}
export function groupBy (datas, keys) {
const list = datas || []
const groups = []
const result = []
list.forEach(v => {
const key = {}
keys.forEach(k => {
key[k] = v[k]
})
let group = groups.find(v => {
return v._key === JSON.stringify(key)
})
if (!group) {
group = {
_key: JSON.stringify(key),
key: key
}
groups.push(group)
}
group.data1 = group.data1 || 0
group.key.数量 = group.data1 += v.数量
group.data2 = group.data2 || ''
group.key.机床图号_组号 = group.data2 += (v.机床图号 || '') + '-' + (v.组号 ? v.组号.split('组')[0] : '') + ';'
})
groups.map(v => {
result.push(v.key)
})
return result
}

248
src/views/login.vue Normal file
View File

@@ -0,0 +1,248 @@
<template>
<div class="main">
<div class="content">
<div class="h01" @dblclick="showVersion=!showVersion">中车</div>
<div class="c_in">
<img src="../assets/peo.png">
<input v-model="username" autocomplete="off" class="inp" placeholder="账户" type="text">
</div>
<div class="c_in">
<img src="../assets/key.png">
<input v-model="password" autocomplete="off" class="inp" placeholder="密码" type="password">
</div>
<!-- <el-select class="eSelect" v-model="pdaId" placeholder="请选择">
<el-option v-for="item in columns" :key="item.id" :label="item.label" :value="item.id">
</el-option>
</el-select> -->
<el-button :loading="loading" class="btn" @click.native.prevent="signIn">登陆</el-button>
<span v-if="showVersion">v:20250301.1356</span>
</div>
</div>
</template>
<script>
import request from '@/utils/request'
export default {
created() {
let _this = this
this.setFontSize()
window.onresize = function () {
_this.setFontSize()
}
},
mounted() {
},
data() {
return {
pda: '',
pdaId: 'PDA_5X_CK2_KK',
loading: false,
showVersion: false,
username: '',
password: '',
pickerShow: false,
columns: [
// {
// label: 'GF9机加车间',
// id: 'PDA_5X_GF9_JJ'
// },
// {
// label: '493机加车间',
// id: 'PDA_5X_493_JJ'
// },
// {
// label: '375装配车间',
// id: 'PDA_5X_375_ZP'
// },
// {
// label: '375机加车间',
// id: 'PDA_5X_375_JJ'
// },
// {
// label: 'GF9装配车间',
// id: 'PDA_5X_GF9_ZP'
// },
// {
// label: '机油泵车间',
// id: 'PDA_5X_OilPump'
// },
// {
// label: '电子泵车间',
// id: 'PDA_5X_ElectronicPump'
// }
{
label: '仓库1',
id: 'PDA_5X_CK1_KK'
},
{
label: '仓库2',
id: 'PDA_5X_CK2_KK'
}
]
}
},
methods: {
setFontSize() {
document.documentElement.style.fontSize = document.documentElement.clientWidth * 8 / 320 + 'px'
},
signIn() {
if (this.username === '' || this.password === '' || this.pdaId === '') {
this.$message.warning('用户名,密码,设备不能为空')
} else {
// 120.26.210.14:8102
// 120s.26.210.14:10021
this.loading = true
const param = {
method: 'post',
data: {
type: '1',
name: '菜单系统模块_用户名密码_查询数据_new2',
param: `用户名=${this.username}&密码=${this.password}`
}
}
request(param).then(res => {
console.log(res)
this.loading = false
if (res.data.length === 0 || res.data[0].result === '0') {
this.$message.error('用户名或密码错误')
} else {
this.$store.dispatch('saveUserInfo', res.data[0])
localStorage.userInfo = JSON.stringify(res.data[0])
localStorage.pdaId = JSON.stringify(this.pdaId)
this.$router.push({
path: '/main'
})
}
}).catch(err => {
console.log(err)
this.loading = false
this.$message.error(err)
})
}
}
},
computed: {},
components: {},
watch: {},
props: {}
}
</script>
<style lang="less" scoped>
.main {
height: 100%;
width: 100%;
display: flex;
justify-content: center;
background-size: cover;
background-position: center;
background-attachment: fixed;
background-repeat: no-repeat;
padding-top: 12rem;
overflow: hidden;
box-sizing: border-box;
}
.content {
display: flex;
align-items: center;
flex-direction: column;
overflow: hidden;
/deep/ .el-range-editor.is-active,
/deep/ .el-range-editor.is-active:hover,
/deep/ .el-select .el-input.is-focus .el-input__inner {
border-color: #000;
}
/deep/ .el-select .el-input__inner:focus {
border-color: #000;
}
.eSelect {
width: 26rem;
margin-top: 2rem;
}
/deep/ .el-input__inner {
background-color: transparent;
border-top: 0;
border-left: 0;
border-right: 0;
border-radius: 0;
color: #000;
font-size: 2.5rem;
}
}
input::input-placeholder {
color: #000;
}
input::-webkit-input-placeholder {
color: #000;
}
input::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: #000;
}
input:-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
color: #000;
}
input:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: #000;
}
.c_in {
display: flex;
justify-content: center;
img {
position: absolute;
left: 7rem;
margin-top: 3rem;
height: 3rem;
width: 3rem;
}
}
.content .inp {
border-style: none;
outline: none;
background: none;
border-bottom: 1px solid #000 !important;
color: #000;
font-size: 2.5rem;
margin-top: 3rem;
width: 22rem;
padding-left: 4rem;
}
.content .btn {
width: 26rem;
margin-top: 3rem;
border-style: none;
outline: none;
border-radius: 3rem;
font-size: 2rem;
background-color: red;
cursor: pointer;
color: #fff;
}
.content .h01 {
color: red;
font-weight: bold;
font-size: 3.2rem;
}
.content .h02 {
color: #000;
font-size: 1.4rem;
padding-bottom: 2rem;
}
</style>

2985
src/views/main.vue Normal file

File diff suppressed because it is too large Load Diff

424
src/views/peisong.vue Normal file
View File

@@ -0,0 +1,424 @@
<template>
<div>
<div v-if="!dialogVisible">
<div class="back" @click="to">
<i class="el-icon-arrow-left"></i>
</div>
<el-table
:data="list"
stripe
border
style="width: 100%; font-size: 18px"
max-height="480px"
@row-click="handledbClick"
:header-cell-style="{ color: '#000' }"
>
<el-table-column
prop="物料名称"
align="center"
label="物料名称"
width="150"
>
</el-table-column>
<el-table-column
prop="规格型号"
align="center"
label="规格型号"
width="100"
>
</el-table-column>
<el-table-column align="center" label="本次/未配">
<template slot-scope="scope">
<div>{{ scope.row.线边已领数量 }}/{{ scope.row.未配数量 }}</div>
</template>
</el-table-column>
</el-table>
<div
class="foot"
@click="peisongok"
v-throttle="2000"
v-loading.fullscreen.lock="fullscreenLoading"
>
<i class="el-icon-check"></i> 配送完成
</div>
</div>
<div
v-if="dialogVisible"
width="100%"
height="100%"
class="dialog"
:before-close="handleClose"
>
<div>
<i
@click="handleClose()"
class="el-icon-close"
style="
font-size: 24px;
color: #409eff;
margin-bottom: 10px;
float: right;
margin-top: 10px;
"
></i>
</div>
<div class="top">
<input type="text" clearable v-model="xm" placeholder="扫料箱物料码" />
<el-button @click="buttonok">
<i class="el-icon-check"></i> 确定</el-button
>
</div>
<div>
<el-form ref="form" :model="obj" label-width="100px" class="form">
<el-form-item label="物料名称">
<el-input v-model="obj.物料名称" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="规格型号">
<el-input v-model="obj.规格型号" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="物料编码">
<el-input v-model="obj.物料编码" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="物料批次">
<el-input v-model="obj.物料批次" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="应配数量">
<el-input v-model="obj.配送数量" class="inp" disabled> </el-input>
</el-form-item>
<el-form-item label="已领数量">
<el-input v-model="obj.已领数量" class="inp" disabled></el-input>
</el-form-item>
<el-form-item label="本次配送">
<el-input
v-model="obj.线边已领数量"
type="number"
class="peisong"
></el-input>
</el-form-item>
<el-form-item label="未配数量">
<el-input v-model="obj.未配数量" class="inp" disabled></el-input>
</el-form-item>
</el-form>
</div>
<div @click="beihuook" class="ok">备货完成</div>
</div>
</div>
</template>
<script>
import { init } from '@/utils/mqttStart.js'
var mqttUrl = window.dt_Config.mqttUrl
export default {
data() {
return {
dialogVisible: false,
xm: '',
obj: {
本次配送: '',
},
list: [],
mqttConnection: {
host: '192.168.30.201',
port: '8083',
endpoint: '/mqtt',
clean: true, // 保留会话
connectTimeout: 4000, // 超时时间
reconnectPeriod: 4000, // 重连时间间隔
clientId: '', // 同一个ID 无法二次连接 PDABarCode
username: '',
password: '',
},
subscription: {
topic: 'MesBarCode',
qos: 0,
},
publication: {
topic: 'PDABarCode',
qos: 0,
payload: '',
},
sum: 0,
fullscreenLoading: false,
}
},
created() {
this.mqttConnection.host = mqttUrl
// localStorage.pdaId=JSON.stringify('PDA_5X_GF9_ZP')//
let pdaId = 'PDA_5X_CK2_KK'
if (pdaId) {
init(pdaId, this.mqttConnection, this.subscription, this.publication)
} else {
this.$router.push({
name: 'main',
})
}
},
methods: {
beihuook() {
var data = this.CreateData(
'Update',
'仓储管理_物料配送单明细',
['线边已领数量'],
{
values: [parseFloat(this.obj.线边已领数量)],
where: [
{
fieldname: '配送单明细id',
value: this.obj.配送单明细id,
},
],
}
)
this.ExecDatabase(data).then((res) => {
if (res.data[0].result == '1') {
this.$message({
message: '备货成功',
type: 'success',
})
this.dialogVisible = false
this.obj = {}
this.sum = 0
}
})
},
buttonok() {
let arr = this.xm.split(';')
if (arr[1] == this.obj.物料编码 && arr[2] == this.obj.物料批次) {
this.xm = arr[1]
this.sum = parseFloat(this.sum) + parseFloat(arr[3])
this.obj.线边已领数量 = this.sum
} else {
this.$message({
message: '物料批次不满足先进先出,不能出库。',
type: 'warning',
})
}
},
to() {
this.$router.go(-1)
// this.$router.push({
// path:'/main',
// })
},
getmsg(newVal) {
this.xm = ''
this.xm = newVal
let arr = newVal.split(';')
if (arr[1] == this.obj.物料编码 && arr[2] == this.obj.物料批次) {
this.xm = arr[1]
this.sum = parseFloat(this.sum) + parseFloat(arr[3])
this.obj.线边已领数量 = this.sum
} else {
this.$message({
message: '物料批次不满足先进先出,不能出库。',
type: 'warning',
})
}
},
handleClose() {
this.dialogVisible = false
this.obj = {}
this.sum = 0
},
num(num) {
return (num + '').indexOf('.') == -1 ? num : num.toFixed(1)
},
handledbClick(row) {
this.xm = ''
this.obj = row
this.dialogVisible = true
},
peisongok() {
this.fullscreenLoading = true
let idarr = this.list.map((ele) => {
return ele.配送单明细id
})
let takearr = this.list.map((ele) => {
return parseFloat(ele.线边已领数量)
})
var param = []
param[0] = ['配送单明细id组', idarr]
param[1] = ['领料数量组', takearr]
param[2] = ['人员id', '']
var data = this.CreateData1('12', '仓储管理_车间领料_接收_循环', param)
this.ExecDatabase(data).then((res) => {
if (res.data[0].result === '1') {
this.$message({
message: '接收成功',
type: 'success',
})
this.sum = 0
this.$router.push({
path: '/main',
})
}
this.fullscreenLoading = false
})
},
},
activated() {
this.list = []
var data = this.CreateData(
'Select',
'仓储管理_物料配送单明细_视图',
[
'配送单id',
'单据编号',
'工单id',
'配送单明细id',
'物料编码',
'规格型号',
'物料名称',
'单位',
'配送数量',
'物料批次',
'已领数量',
'线边已领数量',
'生产订单',
'生产产线',
'车间id',
'订单状态',
'接收完成',
'工位',
],
{
where: [
{
fieldname: '单据编号',
value: this.$route.query.配送单,
},
],
fieldOrder: ['配送数量 desc'],
}
)
this.ExecDatabase(data).then((res) => {
res.data.forEach((ele) => {
ele.配送数量 = this.num(ele.配送数量)
ele.已领数量 = this.num(ele.已领数量)
ele['未配数量'] = ele.配送数量 - ele.已领数量
ele.未配数量 = this.num(ele.未配数量)
ele['本次配送'] = 0
})
this.list = res.data
})
},
mounted() {},
watch: {
getMqttMsges: {
handler: function (newVal) {
if (newVal) {
this.getmsg(newVal)
}
// console.log(newVal)
setTimeout(() => {
this.$store.dispatch('saveMqttMsg', '')
})
},
},
},
computed: {
getMqttMsges() {
return this.$store.state.mqttMsg
},
},
}
</script>
<style lang="less" scoped>
.foot {
width: 100%;
text-align: center;
height: 60px;
line-height: 60px;
background: #0052c0;
color: #fff;
font-size: 22px;
position: fixed;
bottom: 10px;
}
.top {
width: 100%;
display: flex;
justify-content: space-between;
border: 1px solid #0052c0;
input {
outline: 0;
width: 80%;
border: 0;
text-align: center;
font-size: 16px;
border-radius: 0;
}
.el-button {
border: 0;
border-left: 1px solid #0052c0;
color: #0052c0;
background: #f3f7fc;
}
}
.form {
margin-top: 20px;
margin-bottom: 20px;
/deep/ .el-form-item__label {
font-size: 18px;
color: #000;
}
/deep/ .el-input__inner {
text-align: center;
color: #000;
}
.el-input {
border-radius: 4px;
}
/deep/ .el-input__inner {
font-size: 20px;
}
}
.inp {
border: 0 !important;
outline: 0;
text-align: center;
}
.dialog {
width: 90%;
height: 100%;
margin: 0 !important;
position: absolute;
top: 0;
left: 20px;
right: 120px;
}
.ok {
width: 111%;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 20px;
background-color: #0052c0;
color: #fff;
margin-left: -20px;
margin-right: -20px;
}
.back {
font-size: 30px;
margin-left: 10px;
color: #0052c0;
}
.peisong {
border-color: #0052c0 !important;
border-radius: 4px;
}
/deep/ .el-form-item {
margin-bottom: 10px;
}
</style>

98
src/views/peisongok.vue Normal file
View File

@@ -0,0 +1,98 @@
<template>
<div class="content">
<div class="back" @click='to'>
<i class="el-icon-arrow-left"></i>
</div>
<div class="top">
<input type="text" placeholder="扫料箱物料码">
<el-button> <i class="el-icon-check"></i> 确定</el-button>
</div>
<el-form ref="form" :model="obj" label-width="100px" class="form">
<el-form-item label="呼叫产线">
<el-input v-model="obj.呼叫产线" disabled></el-input>
</el-form-item>
<el-form-item label="呼叫工位" >
<el-input v-model="obj.呼叫工位" disabled></el-input>
</el-form-item>
<el-form-item label="物料名称">
<el-input v-model="obj.物料名称" disabled></el-input>
</el-form-item>
<el-form-item label="规格型号">
<el-input v-model="obj.规格型号" disabled></el-input>
</el-form-item>
<el-form-item label="呼叫数量">
<el-input v-model="obj.呼叫数量" disabled></el-input>
</el-form-item>
<el-form-item label="已领数量">
<el-input v-model="obj.已领数量" disabled></el-input>
</el-form-item>
<el-form-item label="本次配送">
<el-input v-model="obj.本次配送"></el-input>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
list: [],
obj:{}
}
},
methods: {
to(){
this.$router.go(-1);
},
},
mounted(){
this.obj = this.$route.query.obj
},
watch:{
obj(){}
}
}
</script>
<style lang="less" scoped>
.top {
width: 90%;
display: flex;
justify-content: space-between;
border: 1px solid #0052c0;
margin: 40px 0;
margin-left: 20px;
input {
outline: 0;
width: 80%;
border: 0;
text-align: center;
font-size: 16px;
}
.el-button {
border: 0;
border-left: 1px solid #0052c0;
color: #0052c0;
background: #f3f7fc;
}
}
/deep/ .el-form-item__label {
font-size: 16px;
color: #000;
}
.form{
.el-input{
width: 90%;
}
}
.back{
font-size: 30px;
margin-left: 10px;
color:#0052c0
}
</style>

0
static/.gitkeep Normal file
View File

10
static/config.js Normal file
View File

@@ -0,0 +1,10 @@
// var url = `http://120.26.210.14:10021`
// var url = `http://192.168.40.11:8010`
// var url = 'http://localhost:8085'
// var url = `http://10.16.7.30:8010`
var url = 'http://124.220.15.242:9020'
// var url = `http://192.168.30.201:8010`
window.dt_Config = {
requestConfig: url + `/submit/MESCommonBase.ashx`,
mqttUrl: '10.16.7.30'
}

BIN
static/zc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
static/zc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View 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)
})
}
}

View 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
View 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
View 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
View File

@@ -0,0 +1,7 @@
{
"env": {
"jest": true
},
"globals": {
}
}

30
test/unit/jest.conf.js Normal file
View 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
View File

@@ -0,0 +1,3 @@
import Vue from 'vue'
Vue.config.productionTip = false

View 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')
})
})