init: CATL电池线返修工位APP首次入库
18
.babelrc
Normal 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
@@ -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
@@ -0,0 +1,7 @@
|
||||
/build/
|
||||
/config/
|
||||
/dist/
|
||||
/*.js
|
||||
/test/unit/coverage/
|
||||
/*.vue
|
||||
/src/
|
||||
29
.eslintrc.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// https://eslint.org/docs/user-guide/configuring
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
parser: 'babel-eslint'
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
extends: [
|
||||
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
|
||||
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
|
||||
'plugin:vue/essential',
|
||||
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
|
||||
'standard'
|
||||
],
|
||||
// required to lint *.vue files
|
||||
plugins: [
|
||||
'vue'
|
||||
],
|
||||
// add your custom rules here
|
||||
rules: {
|
||||
// allow async-await
|
||||
'generator-star-spacing': 'off',
|
||||
// allow debugger during development
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
|
||||
}
|
||||
}
|
||||
20
.gitignore
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
/dist/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
/test/unit/coverage/
|
||||
/test/e2e/reports/
|
||||
selenium-debug.log
|
||||
*.zip
|
||||
*.rar
|
||||
*.7z
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
10
.postcssrc.js
Normal file
@@ -0,0 +1,10 @@
|
||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||
|
||||
module.exports = {
|
||||
"plugins": {
|
||||
"postcss-import": {},
|
||||
"postcss-url": {},
|
||||
// to edit target browsers: use "browserslist" field in package.json
|
||||
"autoprefixer": {}
|
||||
}
|
||||
}
|
||||
30
README.md
Normal 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
@@ -0,0 +1,41 @@
|
||||
'use strict'
|
||||
require('./check-versions')()
|
||||
|
||||
process.env.NODE_ENV = 'production'
|
||||
|
||||
const ora = require('ora')
|
||||
const rm = require('rimraf')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const webpackConfig = require('./webpack.prod.conf')
|
||||
|
||||
const spinner = ora('building for production...')
|
||||
spinner.start()
|
||||
|
||||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
||||
if (err) throw err
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
spinner.stop()
|
||||
if (err) throw err
|
||||
process.stdout.write(stats.toString({
|
||||
colors: true,
|
||||
modules: false,
|
||||
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
||||
chunks: false,
|
||||
chunkModules: false
|
||||
}) + '\n\n')
|
||||
|
||||
if (stats.hasErrors()) {
|
||||
console.log(chalk.red(' Build failed with errors.\n'))
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log(chalk.cyan(' Build complete.\n'))
|
||||
console.log(chalk.yellow(
|
||||
' Tip: built files are meant to be served over an HTTP server.\n' +
|
||||
' Opening index.html over file:// won\'t work.\n'
|
||||
))
|
||||
})
|
||||
})
|
||||
54
build/check-versions.js
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
const chalk = require('chalk')
|
||||
const semver = require('semver')
|
||||
const packageConfig = require('../package.json')
|
||||
const shell = require('shelljs')
|
||||
|
||||
function exec (cmd) {
|
||||
return require('child_process').execSync(cmd).toString().trim()
|
||||
}
|
||||
|
||||
const versionRequirements = [
|
||||
{
|
||||
name: 'node',
|
||||
currentVersion: semver.clean(process.version),
|
||||
versionRequirement: packageConfig.engines.node
|
||||
}
|
||||
]
|
||||
|
||||
if (shell.which('npm')) {
|
||||
versionRequirements.push({
|
||||
name: 'npm',
|
||||
currentVersion: exec('npm --version'),
|
||||
versionRequirement: packageConfig.engines.npm
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
const warnings = []
|
||||
|
||||
for (let i = 0; i < versionRequirements.length; i++) {
|
||||
const mod = versionRequirements[i]
|
||||
|
||||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
||||
warnings.push(mod.name + ': ' +
|
||||
chalk.red(mod.currentVersion) + ' should be ' +
|
||||
chalk.green(mod.versionRequirement)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (warnings.length) {
|
||||
console.log('')
|
||||
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
||||
console.log()
|
||||
|
||||
for (let i = 0; i < warnings.length; i++) {
|
||||
const warning = warnings[i]
|
||||
console.log(' ' + warning)
|
||||
}
|
||||
|
||||
console.log()
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
BIN
build/logo.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
101
build/utils.js
Normal 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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,149 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||
|
||||
const env = process.env.NODE_ENV === 'testing'
|
||||
? require('../config/test.env')
|
||||
: require('../config/prod.env')
|
||||
|
||||
const webpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
extract: true,
|
||||
usePostCSS: true
|
||||
})
|
||||
},
|
||||
devtool: config.build.productionSourceMap ? config.build.devtool : false,
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
||||
},
|
||||
plugins: [
|
||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': env
|
||||
}),
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
},
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
parallel: true
|
||||
}),
|
||||
// extract css into its own file
|
||||
new ExtractTextPlugin({
|
||||
filename: utils.assetsPath('css/[name].[contenthash].css'),
|
||||
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
||||
allChunks: true,
|
||||
}),
|
||||
// Compress extracted CSS. We are using this plugin so that possible
|
||||
// duplicated CSS from different components can be deduped.
|
||||
new OptimizeCSSPlugin({
|
||||
cssProcessorOptions: config.build.productionSourceMap
|
||||
? { safe: true, map: { inline: false } }
|
||||
: { safe: true }
|
||||
}),
|
||||
// generate dist index.html with correct asset hash for caching.
|
||||
// you can customize output by editing /index.html
|
||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({
|
||||
filename: process.env.NODE_ENV === 'testing'
|
||||
? 'index.html'
|
||||
: config.build.index,
|
||||
template: 'index.html',
|
||||
inject: true,
|
||||
minify: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
removeAttributeQuotes: true
|
||||
// more options:
|
||||
// https://github.com/kangax/html-minifier#options-quick-reference
|
||||
},
|
||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
||||
chunksSortMode: 'dependency'
|
||||
}),
|
||||
// keep module.id stable when vendor modules does not change
|
||||
new webpack.HashedModuleIdsPlugin(),
|
||||
// enable scope hoisting
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
// split vendor js into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
minChunks (module) {
|
||||
// any required modules inside node_modules are extracted to vendor
|
||||
return (
|
||||
module.resource &&
|
||||
/\.js$/.test(module.resource) &&
|
||||
module.resource.indexOf(
|
||||
path.join(__dirname, '../node_modules')
|
||||
) === 0
|
||||
)
|
||||
}
|
||||
}),
|
||||
// extract webpack runtime and module manifest to its own file in order to
|
||||
// prevent vendor hash from being updated whenever app bundle is updated
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
minChunks: Infinity
|
||||
}),
|
||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
||||
// in a separate chunk, similar to the vendor chunk
|
||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'app',
|
||||
async: 'vendor-async',
|
||||
children: true,
|
||||
minChunks: 3
|
||||
}),
|
||||
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.build.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
||||
if (config.build.productionGzip) {
|
||||
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||
|
||||
webpackConfig.plugins.push(
|
||||
new CompressionWebpackPlugin({
|
||||
asset: '[path].gz[query]',
|
||||
algorithm: 'gzip',
|
||||
test: new RegExp(
|
||||
'\\.(' +
|
||||
config.build.productionGzipExtensions.join('|') +
|
||||
')$'
|
||||
),
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
if (config.build.bundleAnalyzerReport) {
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
||||
}
|
||||
|
||||
module.exports = webpackConfig
|
||||
7
config/dev.env.js
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
const merge = require('webpack-merge')
|
||||
const prodEnv = require('./prod.env')
|
||||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"'
|
||||
})
|
||||
79
config/index.js
Normal file
@@ -0,0 +1,79 @@
|
||||
'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
|
||||
// host: '192.168.43.124', // can be overwritten by process.env.HOST
|
||||
// host: '192.168.10.205', // can be overwritten by process.env.HOST
|
||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
autoOpenBrowser: false,
|
||||
errorOverlay: true,
|
||||
notifyOnErrors: true,
|
||||
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
||||
|
||||
// Use Eslint Loader?
|
||||
// If true, your code will be linted during bundling and
|
||||
// linting errors and warnings will be shown in the console.
|
||||
useEslint: true,
|
||||
// If true, eslint errors and warnings will also be shown in the error overlay
|
||||
// in the browser.
|
||||
showEslintErrorsInOverlay: false,
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
*/
|
||||
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
|
||||
// If you have problems debugging vue-files in devtools,
|
||||
// set this to false - it *may* help
|
||||
// https://vue-loader.vuejs.org/en/options.html#cachebusting
|
||||
cacheBusting: true,
|
||||
|
||||
cssSourceMap: true
|
||||
},
|
||||
|
||||
build: {
|
||||
// Template for index.html
|
||||
index: path.resolve(__dirname, '../dist/index.html'),
|
||||
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: './',
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
*/
|
||||
|
||||
productionSourceMap: true,
|
||||
// https://webpack.js.org/configuration/devtool/#production
|
||||
devtool: '#source-map',
|
||||
|
||||
// Gzip off by default as many popular static hosts such as
|
||||
// Surge or Netlify already gzip all static assets for you.
|
||||
// Before setting to `true`, make sure to:
|
||||
// npm install --save-dev compression-webpack-plugin
|
||||
productionGzip: false,
|
||||
productionGzipExtensions: ['js', 'css'],
|
||||
|
||||
// Run the build command with an extra argument to
|
||||
// View the bundle analyzer report after build finishes:
|
||||
// `npm run build --report`
|
||||
// Set to `true` or `false` to always turn it on or off
|
||||
bundleAnalyzerReport: process.env.npm_config_report
|
||||
}
|
||||
}
|
||||
4
config/prod.env.js
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict'
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"'
|
||||
}
|
||||
7
config/test.env.js
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
const merge = require('webpack-merge')
|
||||
const devEnv = require('./dev.env')
|
||||
|
||||
module.exports = merge(devEnv, {
|
||||
NODE_ENV: '"testing"'
|
||||
})
|
||||
30
index.html
Normal 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/favicon.ico">
|
||||
<title>CATL</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>
|
||||
38438
package-lock.json
generated
Normal file
89
package.json
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"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",
|
||||
"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.13.2",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
46
src/App.vue
Normal file
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<div v-if="$route.meta.keepAlive">
|
||||
<main-top-bar></main-top-bar>
|
||||
<router-view></router-view>
|
||||
<!-- <main-tab-bar v-show="showNav"></main-tab-bar>-->
|
||||
</div>
|
||||
<router-view v-if="!$route.meta.keepAlive"></router-view>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MainTabBar from '@/components/TabBar/MainTabBar'
|
||||
import MainTopBar from '@/components/TopBar/MainTopBar'
|
||||
export default {
|
||||
name: 'App',
|
||||
components: { MainTabBar, MainTopBar },
|
||||
data() {
|
||||
return {
|
||||
showNav: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.showNav = true
|
||||
}
|
||||
}
|
||||
|
||||
</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>
|
||||
191
src/api/BasicData/WorkshopPersonnelRoleMana.js
Normal file
@@ -0,0 +1,191 @@
|
||||
import request from '@/utils/request'
|
||||
import state from '@/store'
|
||||
import router from '@/router'
|
||||
|
||||
// 查询项目名称
|
||||
export function dialogtablevisible() {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: '人事档案管理_部门关系_查询节点',
|
||||
param: '子节点=0'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function dialogtablevisible1() {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: '人事档案管理_部门关系_查询节点',
|
||||
param: '子节点=0'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function addData1(code, groupNum) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: 2,
|
||||
name: '菜单系统模块_项目角色员工综合_增加数据',
|
||||
param: '人员编号=' + code + '=int&角色编号=' + groupNum + '=int&项目编号=10=int'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function addData2(lsh, code, groupNum) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: 2,
|
||||
name: '菜单系统模块_项目角色员工综合_修改数据',
|
||||
param: '人员角色流水号=' + lsh + '&人员编号=' + code + '&角色编号=' + groupNum
|
||||
}
|
||||
})
|
||||
}
|
||||
// 初始化科室
|
||||
export function initDepartment() {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: '人事档案管理_部门关系_查询节点'
|
||||
}
|
||||
})
|
||||
}
|
||||
// 初始化人员信息 弹出框
|
||||
export function getTree() {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: 1,
|
||||
name: '人事档案管理_部门关系_查询节点',
|
||||
param: '子节点=0=int'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function fn(data, pid) {
|
||||
const result = []
|
||||
let temp
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].父节点 === pid) {
|
||||
const obj = { label: data[i].节点名称, id: data[i].子节点 }
|
||||
temp = fn(data, data[i].子节点)
|
||||
if (temp.length > 0) {
|
||||
obj.children = temp
|
||||
}
|
||||
result.push(obj)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
export function fn2(data, pid) {
|
||||
const result = []
|
||||
let temp
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].父节点 === pid) {
|
||||
const obj = { text: data[i].节点名称, value: data[i].子节点 }
|
||||
temp = fn2(data, data[i].子节点)
|
||||
if (temp.length > 0) {
|
||||
obj.children = temp
|
||||
}
|
||||
result.push(obj)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
export function getTable8(code) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: 1,
|
||||
name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
|
||||
param: '考核部门编号=' + code + '=int'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function handledelete(ryjslsh) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: 2,
|
||||
name: '菜单系统模块_项目角色员工综合_删除数据',
|
||||
param: '人员角色流水号=' + ryjslsh + '=string'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function deleteData(Number) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '2',
|
||||
name: '菜单系统模块_项目角色员工综合_删除数据',
|
||||
param: '人员角色流水号=' + Number + '=int'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function searchdesigner(num2) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
|
||||
param: '考核部门编号=' + num2 + '=int'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function initOrderType() {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: '菜单系统模块_项目角色_查询数据_new'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function searchTable(check1, staffName, check2, systemAdministrator) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: '菜单系统模块_项目角色员工综合_查询数据',
|
||||
param: '姓名_check=' + check1 + '=int&姓名=' + staffName + '=string&角色编号_check=' + check2 + ' =int&角色编号=' + systemAdministrator + '=int'
|
||||
}
|
||||
})
|
||||
}
|
||||
BIN
src/assets/CheckPlanCreate.png
Normal file
|
After Width: | Height: | Size: 734 B |
BIN
src/assets/CheckPlanCreateActive.png
Normal file
|
After Width: | Height: | Size: 777 B |
BIN
src/assets/CheckPlanExec.png
Normal file
|
After Width: | Height: | Size: 671 B |
BIN
src/assets/CheckPlanExecActive.png
Normal file
|
After Width: | Height: | Size: 692 B |
BIN
src/assets/CheckPlanSearch.png
Normal file
|
After Width: | Height: | Size: 622 B |
BIN
src/assets/CheckPlanSearchActive.png
Normal file
|
After Width: | Height: | Size: 760 B |
BIN
src/assets/key.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src/assets/login/pdfbg01.jpg
Normal file
|
After Width: | Height: | Size: 101 KiB |
BIN
src/assets/loginOff.png
Normal file
|
After Width: | Height: | Size: 368 B |
BIN
src/assets/peo.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
14
src/components/HelloWorld.vue
Normal file
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
||||
42
src/components/TabBar/MainTabBar.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div>
|
||||
<tab-bar>
|
||||
<tab-bar-item path="/CheckPlanCreate" activeColor="#409eff">
|
||||
<img slot="item-icon" src="@/assets/CheckPlanCreate.png" alt="" >
|
||||
<img slot="item-icon-active" src="@/assets/CheckPlanCreateActive.png" alt="">
|
||||
<div slot="item-text">检验计划</div>
|
||||
</tab-bar-item>
|
||||
<tab-bar-item path="/CheckPlanExec" activeColor="#409eff">
|
||||
<img slot="item-icon" src="@/assets/CheckPlanExec.png" alt="" >
|
||||
<img slot="item-icon-active" src="@/assets/CheckPlanExecActive.png" alt="">
|
||||
<div slot="item-text">检验执行</div>
|
||||
</tab-bar-item>
|
||||
<tab-bar-item path="/CheckPlanSearch" activeColor="#409eff">
|
||||
<img slot="item-icon" src="@/assets/CheckPlanSearch.png" alt="" >
|
||||
<img slot="item-icon-active" src="@/assets/CheckPlanSearchActive.png" alt="">
|
||||
<div slot="item-text">检验历史</div>
|
||||
</tab-bar-item>
|
||||
<tab-bar-item path="/login1" activeColor="#409eff">
|
||||
<img slot="item-icon" src="@/assets/loginOff.png" alt="" >
|
||||
<img slot="item-icon-active" src="@/assets/loginOff.png" alt="">
|
||||
<div slot="item-text">退出</div>
|
||||
</tab-bar-item>
|
||||
</tab-bar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TabBar from './TabBar'
|
||||
import TabBarItem from './TabBarItem'
|
||||
export default {
|
||||
name:"MainTabBar",
|
||||
components:{
|
||||
TabBar,
|
||||
TabBarItem
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
14
src/components/TabBar/TabBar.vue
Normal file
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div id="tab-bar">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name:'TabBar'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
79
src/components/TabBar/TabBarItem.vue
Normal file
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div class="tab-bar-item" @click="itemClick">
|
||||
<div v-if="!isActive">
|
||||
<slot name="item-icon"></slot>
|
||||
</div>
|
||||
<div v-else>
|
||||
<slot name="item-icon-active"></slot>
|
||||
</div>
|
||||
<div :style="activeStyle"><slot name="item-text"></slot></div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"TabBarItem",
|
||||
props:{
|
||||
path:String,
|
||||
activeColor:{
|
||||
type:String,
|
||||
default:'red'
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
// isActive:true
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
isActive(){
|
||||
//判断
|
||||
//return this.$route.path.indexOf(this.path) !== -1
|
||||
//return this.$route.path === this.path
|
||||
return this.$route.path.indexOf(this.path) ? false : true
|
||||
},
|
||||
activeStyle(){
|
||||
return this.isActive?{color:this.activeColor}:{}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
itemClick(){
|
||||
this.$router.replace(this.path)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#tab-bar{
|
||||
display: flex;
|
||||
|
||||
}
|
||||
#tab-bar{
|
||||
background-color: #f6f6f6;
|
||||
border-top: 2px #ccc;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
box-shadow:0px -1px 1px rgba(100,100,100,.2) ;
|
||||
}
|
||||
.tab-bar-item{
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
height: 49px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.tab-bar-item img{
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-top: 3px;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.active{
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
50
src/components/TopBar/MainTopBar.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div>
|
||||
<top-bar>
|
||||
<div style="flex: 10;display: flex;align-items:center;justify-content:center;height: 50px;font-size: 2rem;">
|
||||
<span id="topPageName">首页</span>
|
||||
<div style="position: absolute;right: 5px;top: 0px">
|
||||
<van-button icon="home-o" style="background-color: #a5a5a5" @click="routeJump('main')"></van-button>
|
||||
</div>
|
||||
</div>
|
||||
</top-bar>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TopBar from './TopBar'
|
||||
// import TopBarItem from './TopBarItem'
|
||||
export default {
|
||||
name:"MainTopBar",
|
||||
components:{
|
||||
TopBar,
|
||||
// TopBarItem
|
||||
},
|
||||
methods: {
|
||||
routeJump(val){
|
||||
if (val.indexOf('/') !== -1) {
|
||||
val = val.substring(1)
|
||||
}
|
||||
this.$router.push({
|
||||
path: '/' + val
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#top-bar{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #e7e7e7;
|
||||
border-top: 2px #ccc;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
box-shadow:0px -1px 1px rgba(100,100,100,.2) ;
|
||||
}
|
||||
</style>
|
||||
14
src/components/TopBar/TopBar.vue
Normal file
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div id="top-bar">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name:'TopBar'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
78
src/components/TopBar/TopBarItem.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div class="top-bar-item" @click="itemClick">
|
||||
<div v-if="!isActive">
|
||||
<slot name="item-icon"></slot>
|
||||
</div>
|
||||
<div v-else>
|
||||
<slot name="item-icon-active"></slot>
|
||||
</div>
|
||||
<div :style="activeStyle"><slot name="item-text"></slot></div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"TopBarItem",
|
||||
props:{
|
||||
path:String,
|
||||
activeColor:{
|
||||
type:String,
|
||||
default:'red'
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
// isActive:true
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
isActive(){
|
||||
//判断
|
||||
//return this.$route.path.indexOf(this.path) !== -1
|
||||
//return this.$route.path === this.path
|
||||
return this.$route.path.indexOf(this.path) ? false : true
|
||||
},
|
||||
activeStyle(){
|
||||
return this.isActive?{color:this.activeColor}:{}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
itemClick(){
|
||||
this.$router.replace(this.path)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#top-bar{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #a5a5a5;
|
||||
border-top: 2px #ccc;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
box-shadow:0px -1px 1px rgba(100,100,100,.2) ;
|
||||
}
|
||||
.top-bar-item{
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
height: 49px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.top-bar-item img{
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-top: 3px;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.active{
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
114
src/main.js
Normal file
@@ -0,0 +1,114 @@
|
||||
// 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'
|
||||
import request from '@/utils/request'
|
||||
|
||||
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)
|
||||
Vue.prototype.CreateData = function(type, name, data, pageSize, pageList) {
|
||||
var param_Str = ''
|
||||
var param_array = []
|
||||
if (type === '7') {
|
||||
data.map(v => {
|
||||
pageSize.map(h => {
|
||||
const val = h.toString()
|
||||
if (!v[val]) {
|
||||
this.$set(v, val, '')
|
||||
}
|
||||
})
|
||||
})
|
||||
param_Str = data
|
||||
} else {
|
||||
if (data !== undefined) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
param_array.push({
|
||||
name: data[i][0],
|
||||
value: data[i][1],
|
||||
type: data[i][2],
|
||||
output: data[i][3]
|
||||
})
|
||||
}
|
||||
param_Str = JSON.stringify(param_array)
|
||||
}
|
||||
}
|
||||
var obj = []
|
||||
obj[0] = {}
|
||||
obj[0].type = type
|
||||
obj[0].name = name
|
||||
obj[0].param = param_Str
|
||||
obj[0].pageSize = pageSize
|
||||
obj[0].pageList = pageList
|
||||
// console.log(obj[0], 'obj[0]')
|
||||
var numn = JSON.stringify(obj[0])
|
||||
return numn
|
||||
}
|
||||
// 新通讯11/12---<
|
||||
Vue.prototype.ExecDatabase = function(num) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: num
|
||||
})
|
||||
}
|
||||
// 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/>'
|
||||
})
|
||||
57
src/router/index.js
Normal file
@@ -0,0 +1,57 @@
|
||||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
export default new Router({
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'login',
|
||||
meta: {
|
||||
keepAlive: false
|
||||
},
|
||||
component: () => import('@/views/login.vue')
|
||||
},
|
||||
{
|
||||
path: '/login1',
|
||||
name: 'login1',
|
||||
meta: {
|
||||
keepAlive: false
|
||||
},
|
||||
component: () => import('@/views/login.vue')
|
||||
},
|
||||
{
|
||||
path: '/main',
|
||||
name: 'main',
|
||||
meta: {
|
||||
keepAlive: true
|
||||
},
|
||||
component: () => import('@/views/main.vue')
|
||||
},
|
||||
{
|
||||
path: '/ChangeMaterial',
|
||||
name: 'ChangeMaterial',
|
||||
meta: {
|
||||
keepAlive: true
|
||||
},
|
||||
component: () => import('@/views/RepairManagement/ChangeMaterial/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/ProductScrapping',
|
||||
name: 'ProductScrapping',
|
||||
meta: {
|
||||
keepAlive: true
|
||||
},
|
||||
component: () => import('@/views/RepairManagement/ProductScrapping/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/RepairSearch',
|
||||
name: 'RepairSearch',
|
||||
meta: {
|
||||
keepAlive: true
|
||||
},
|
||||
component: () => import('@/views/RepairManagement/RepairSearch/index.vue')
|
||||
},
|
||||
]
|
||||
})
|
||||
30
src/store/actions.js
Normal 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
391
src/utils/tool.js
Normal file
@@ -0,0 +1,391 @@
|
||||
import request from '@/utils/request'
|
||||
// 传通讯服务器参数
|
||||
export default {
|
||||
install (Vue) {
|
||||
// 用于生成传通讯服务器参数。
|
||||
// 传入参数
|
||||
// 1)type:11查询;12增删改,必须
|
||||
// 2)name:存储过程名,必须
|
||||
// 3)data:存储过程参数名和对应值,例如:
|
||||
// param[0] = ['设备类型编码', '3', 'string', '0']
|
||||
// param[1] = ['output', '3', 'int', '1'],必须
|
||||
// 数组里四个分别对应:存储过程参数名(必须);存储过程参数值(必须);参数类型(若是output必须);参数是否为output(0否1是)
|
||||
// 4)pageSize,pageList:分页使用,可选
|
||||
// 旧通讯格式
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
export function getNowTime2() {
|
||||
const date = new Date()
|
||||
const month = zeroFill2(date.getMonth() + 1)
|
||||
const day = zeroFill(date.getDate())
|
||||
const time = date.getFullYear() + '-' + month + '-' + day
|
||||
return time
|
||||
}
|
||||
function zeroFill2(i) {
|
||||
if (i >= 0 && i <= 9) {
|
||||
if (i === 0) {
|
||||
return '01'
|
||||
} else {
|
||||
return '0' + i
|
||||
}
|
||||
} else {
|
||||
return i
|
||||
}
|
||||
}
|
||||
export function getBeforeOrAfterTime(AddDayCount) {
|
||||
var dd = new Date()
|
||||
dd.setDate(dd.getDate() + AddDayCount)// 获取AddDayCount天后的日期
|
||||
var y = dd.getFullYear()
|
||||
var m = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1)// 获取当前月份的日期,不足10补0
|
||||
var d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate()// 获取当前几号,不足10补0
|
||||
return y + '-' + m + '-' + d
|
||||
}
|
||||
// 数组去重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 formatDate(date) {
|
||||
const month = zeroFill2(date.getMonth() + 1)
|
||||
const day = zeroFill(date.getDate())
|
||||
const time = date.getFullYear() + '-' + month + '-' + day
|
||||
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
|
||||
}
|
||||
41
src/views/RepairManagement/ChangeMaterial/index.vue
Normal file
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<pass-station :page-type="0"></pass-station>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {Dialog, Toast} from 'vant'
|
||||
import passStation from '../passStation/index.vue'
|
||||
export default {
|
||||
name: 'index',
|
||||
components: {
|
||||
passStation
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
userInfo: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||
},
|
||||
mounted () {
|
||||
document.getElementById('topPageName').innerText = '更换物料'
|
||||
},
|
||||
methods: {
|
||||
forbid(){
|
||||
//禁止软键盘弹出
|
||||
document.activeElement.blur();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style scoped>
|
||||
.app-container{
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
</style>
|
||||
39
src/views/RepairManagement/ProductScrapping/index.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<pass-station :page-type="1"></pass-station>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {Dialog, Toast} from 'vant'
|
||||
import passStation from '../passStation/index.vue'
|
||||
|
||||
export default {
|
||||
name: 'index',
|
||||
components: {passStation},
|
||||
data() {
|
||||
return {
|
||||
userInfo: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||
},
|
||||
mounted () {
|
||||
document.getElementById('topPageName').innerText = '报废解体'
|
||||
},
|
||||
methods: {
|
||||
forbid(){
|
||||
//禁止软键盘弹出
|
||||
document.activeElement.blur();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style scoped>
|
||||
.app-container{
|
||||
margin-top: 50px;
|
||||
}
|
||||
</style>
|
||||
324
src/views/RepairManagement/RepairSearch/index.vue
Normal file
@@ -0,0 +1,324 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row>
|
||||
<div style="display: flex;margin: 20px 0">
|
||||
<van-field v-model="barcode" left-icon="scan" style="width: 270px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" />
|
||||
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px;" @click="getTable2">查询</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row style="overflow: auto;height: 660px">
|
||||
<van-list
|
||||
v-model="loading_checkOrder"
|
||||
:finished="true"
|
||||
finished-text="没有更多了"
|
||||
>
|
||||
<van-cell v-for="(item,index) in RepairManagementDataLogTable" :key="index" style="padding: 10px 5px">
|
||||
<van-card class="s-card">
|
||||
<template #tags>
|
||||
<van-row style="font-size: 1.5rem">
|
||||
<van-tag type="primary" size="large">【{{index+1 }}】{{ item.工位号 }}</van-tag>
|
||||
<van-tag type="primary" size="large"> {{ item.物料号 }}</van-tag>
|
||||
<van-tag v-if="item.操作类型代码 === 6" size="large" type="warning">{{item.操作类型名称}}</van-tag>
|
||||
<van-tag v-if="item.操作类型代码 === 7" size="large" type="danger">{{item.操作类型名称}}</van-tag>
|
||||
</van-row>
|
||||
<van-row style="font-size: 1.3rem">
|
||||
<van-col span="24" style="margin-top: 10px">
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="orders-o" color="#1989fa"/>
|
||||
<span>生产订单:</span>
|
||||
<span> {{item.订单号 }}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="comment-o" color="#1989fa"/>
|
||||
<span>物料名称:</span>
|
||||
{{item.零件名称}}
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="scan" color="#1989fa"/>
|
||||
<span>新条码:</span>
|
||||
{{item.更换物料条码}}
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="scan" color="#1989fa"/>
|
||||
<span>旧条码:</span>
|
||||
<span> {{item.物料条码}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="clock-o" color="#1989fa"/>
|
||||
<span>更换时间:</span>
|
||||
<span> {{item.更换时间}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="contact-o" color="#1989fa"/>
|
||||
<span>操作人员:</span>
|
||||
<span> {{item.更换人}}</span>
|
||||
</div>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</template>
|
||||
</van-card>
|
||||
</van-cell>
|
||||
</van-list>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- <el-tab-pane label="返修记录">-->
|
||||
<!-- <span style="font-size: 1.2rem">产品编号:</span>-->
|
||||
<!-- <el-input v-model="partCode" clearable style="width: 200px" />-->
|
||||
<!-- <el-button type="primary" icon="el-icon-search" style="margin-left: 15px" @click="getTable2">查询</el-button>-->
|
||||
<!-- <div style="margin-top: 5px">-->
|
||||
<!-- <el-table-->
|
||||
<!-- :data="RepairManagementDataLogTable"-->
|
||||
<!-- :header-cell-style="{ background: '#F5F5F5', fontSize: '22px' }"-->
|
||||
<!-- style="width: 100%; border: 1px solid #9e9b9b"-->
|
||||
<!-- border-->
|
||||
<!-- height="790px"-->
|
||||
<!-- tooltip-effect="dark"-->
|
||||
<!-- @row-click="getTable1"-->
|
||||
<!-- >-->
|
||||
<!-- <el-table-column type="index" align="center" label="序号" width="80px" />-->
|
||||
<!-- <el-table-column align="center" label="订单号" width="180px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.订单号 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="工位号" width="120px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.工位号 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="物料号" width="180px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.物料号 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="物料名称" show-overflow-tooltip>-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.零件名称 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="数量" width="100px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.零件数量 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="操作方式">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.操作类型名称 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="新条码">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.更换物料条码 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="旧条码">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.物料条码 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="操作人" width="140px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.更换人 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="返修时间" width="220px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.更换时间 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-tab-pane>-->
|
||||
<!-- </el-tabs>-->
|
||||
<!-- </el-row>-->
|
||||
<!-- <!– 更换物料 –>-->
|
||||
<!-- <el-dialog :visible.sync="RepairManagementReplaceDialogVisible" :append-to-body="true" title="更换物料" center width="400px">-->
|
||||
<!-- <el-form ref="RepairManagementReplaceForm" :model="RepairManagementReplaceForm" :rules="RepairManagementReplaceRules" label-position="center" label-width="110px" class="demo-ruleForm">-->
|
||||
<!-- <el-form-item label="物料号" prop="materialCode">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialCode" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料名称" prop="materialName">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialName" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="原物料条码" prop="materialBarCode">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialBarCode" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="数量" prop="materialCount">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialCount" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="更换物料" prop="materialBarCodeNew">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialBarCodeNew" size="small" clearable style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="工位物料" prop="isUsedOpMaterial">-->
|
||||
<!-- <el-checkbox v-model="RepairManagementReplaceForm.isUsedOpMaterial"></el-checkbox>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-form>-->
|
||||
<!-- <div slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button size="small" @click="RepairManagementReplaceCancel('RepairManagementReplaceForm')">取消</el-button>-->
|
||||
<!-- <el-button type="primary" size="small" @click="RepairManagementReplaceSubmit('RepairManagementReplaceForm')">确定</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-dialog>-->
|
||||
<!-- <!– 物料报废 –>-->
|
||||
<!-- <el-dialog :visible.sync="RepairManagementDestroyAllDialogVisible" :append-to-body="true" title="整件报废" center width="400px">-->
|
||||
<!-- <el-form ref="RepairManagementReplaceForm" :model="RepairManagementReplaceForm" :rules="RepairManagementReplaceRules" label-position="center" label-width="110px" class="demo-ruleForm">-->
|
||||
<!-- <el-form-item label="物料号" prop="materialCode">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialCode" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料名称" prop="materialName">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialName" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="原物料条码" prop="materialBarCode">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialBarCode" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="数量" prop="materialCount">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialCount" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="更换物料" prop="materialBarCodeNew">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialBarCodeNew" size="small" clearable style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-form>-->
|
||||
<!-- <div slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button size="small" @click="RepairManagementReplaceCancel('RepairManagementReplaceForm')">取消</el-button>-->
|
||||
<!-- <el-button type="primary" size="small" @click="RepairManagementReplaceSubmit('RepairManagementReplaceForm')">确定</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-dialog>-->
|
||||
<!-- </div>-->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Dialog, Toast} from 'vant'
|
||||
|
||||
export default {
|
||||
name: 'RepairManagement',
|
||||
props: {
|
||||
pageType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
barcode: 'CG1A6220NS241202001',
|
||||
barcodeMaterial: '',
|
||||
loading_checkOrder: false,
|
||||
RepairManagementDataTable: [],
|
||||
userInfo: '',
|
||||
showTableData_content: false,
|
||||
loading_checkOrder_content: false,
|
||||
RepairManagementMaterialDataTable: [],
|
||||
|
||||
showTableData_content_exchange: false,
|
||||
loading_checkOrder_content_exchange: false,
|
||||
|
||||
|
||||
RepairType: 1,
|
||||
currentSelectRow: {},
|
||||
RepairManagementReplaceDialogVisible: false,
|
||||
RepairManagementDestroyAllDialogVisible: false,
|
||||
RepairManagementReplaceForm: {
|
||||
ID: 0,
|
||||
OpCode: '',
|
||||
EngineID: '',
|
||||
isUsedOpMaterial: true,
|
||||
TraceabilityCode: 0,
|
||||
materialCount: 0,
|
||||
materialCode: '',
|
||||
materialBarCode: '',
|
||||
materialName: '',
|
||||
materialBarCodeNew: ''
|
||||
},
|
||||
RepairManagementReplaceRules: {
|
||||
materialBarCodeNew: [{ required: true, message: '请输入/扫描新物料码!', trigger: 'blur' }]
|
||||
},
|
||||
RepairManagementType: '1',
|
||||
partCode: '',
|
||||
opCode: '',
|
||||
opCodeS: [],
|
||||
stationArr: [],
|
||||
RepairManagementDataLogTable: [],
|
||||
RepairManagementDataTableOrigin: [],
|
||||
engineValue: {
|
||||
OpName: null,
|
||||
EngineID: null, // 产品编号
|
||||
EngineType: null, // 产品型号
|
||||
EngineTypeID: null, // 机型代码
|
||||
PalletCode: null,
|
||||
ProcessCode: null, // 程序号
|
||||
PartPalletCode: null, // 托盘号
|
||||
PalletInfo: null, // 托盘信息
|
||||
RepairPartStatusPLC: null,
|
||||
QualityMask: null,
|
||||
OrderForm: null, // 订单号
|
||||
EngineTypeString: null // 产品型号字符串北汽专用
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||
},
|
||||
mounted() {
|
||||
document.getElementById('topPageName').innerText = '返修记录'
|
||||
},
|
||||
methods: {
|
||||
getTable2() {
|
||||
if (this.barcode === '') {
|
||||
this.$message.error('请输入产品编号!')
|
||||
return
|
||||
}
|
||||
this.RepairManagementDataLogTable = []
|
||||
const param = []
|
||||
param[0] = ['发动机号', this.barcode]
|
||||
const Data = this.CreateData('11', '电子看板_装配零件_返修件_返修记录_查询', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
console.log(response.data)
|
||||
this.RepairManagementDataLogTable = response.data
|
||||
} else {
|
||||
this.RepairManagementDataLogTable = []
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.app-container{
|
||||
margin-top: 50px;
|
||||
}
|
||||
.dialog-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.dialog-header,
|
||||
.dialog-footer {
|
||||
position: sticky;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.dialog-header {
|
||||
top: 0;
|
||||
background-color: white;
|
||||
padding-top: 26px;
|
||||
font-weight: 500;
|
||||
line-height: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
bottom: -3px;
|
||||
background-color: white;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.scrollable-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
891
src/views/RepairManagement/passStation/index.vue
Normal file
@@ -0,0 +1,891 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row>
|
||||
<div style="display: flex;margin: 20px 0">
|
||||
<van-field v-model="barcode" left-icon="scan" style="width: 270px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" />
|
||||
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px;" @click="getTable">查询</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row v-if="pageType === 1">
|
||||
<div style="display: flex;margin: 0">
|
||||
<el-button type="warning" icon="el-icon-refresh-right" size="small" style="margin-left: 10px;" @click="RepairManagementReturnOp">物料回仓</el-button>
|
||||
<el-button type="danger" icon="el-icon-refresh-right" size="small" style="margin-left: 10px;" @click="RepairManagementDestroyShow">扫码报废</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<el-row style="overflow: auto;height: 660px">
|
||||
<van-list
|
||||
v-model="loading_checkOrder"
|
||||
:finished="true"
|
||||
finished-text="没有更多了"
|
||||
>
|
||||
<van-cell v-for="(item,index) in RepairManagementDataTable" :key="index" style="padding: 10px 5px">
|
||||
<van-card class="s-card">
|
||||
<template #tags>
|
||||
<van-row style="font-size: 1.5rem">
|
||||
<van-tag type="primary" size="large">{{ item.工位号 }}【{{item.扫码数量 }}】</van-tag>
|
||||
<van-tag v-if="item.是否合格 === '1'" size="large" type="success">OK</van-tag>
|
||||
<van-tag v-if="item.是否合格 === '2'" size="large" type="danger">NG</van-tag>
|
||||
</van-row>
|
||||
<van-row style="font-size: 1.3rem">
|
||||
<van-col span="20" style="margin-top: 10px">
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="contact-o" color="#1989fa"/>
|
||||
<span>生产订单:</span>
|
||||
<span> {{item.订单号 }}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="contact-o" color="#1989fa"/>
|
||||
<span>装配人员:</span>
|
||||
{{item.操作者}}
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="clock-o" color="#1989fa"/>
|
||||
<span>进站时间:</span>
|
||||
{{item.到达时间}}
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="clock-o" color="#1989fa"/>
|
||||
<span>离站时间:</span>
|
||||
<span> {{item.离开时间}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="comment-o" color="#1989fa"/>
|
||||
<span>车底盘码:</span>
|
||||
<span> {{item.车体二维码}}</span>
|
||||
</div>
|
||||
</van-col>
|
||||
<van-col span="4" style="margin-top: 10px">
|
||||
<van-button plain icon="eye-o" size="small" type="info" style="margin-top: 10px" @click="getTable1(item)">查看物料</van-button>
|
||||
<br/>
|
||||
<van-button v-if="pageType === 0" plain icon="exchange" size="small" type="warning" style="margin-top: 10px" @click="RepairManagementReplace(item)">更换物料</van-button>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</template>
|
||||
</van-card>
|
||||
</van-cell>
|
||||
</van-list>
|
||||
</el-row>
|
||||
<van-dialog
|
||||
v-model="showTableData_content"
|
||||
width="95%"
|
||||
:lock-scroll="false"
|
||||
:show-cancel-button="false"
|
||||
:show-confirm-button="false"
|
||||
style="max-height: 70%!important;overflow: auto"
|
||||
>
|
||||
<div class="dialog-content">
|
||||
<!-- 固定顶部的内容 -->
|
||||
<div class="dialog-header">物料详情【{{currentSelectRow['工位号']}}】</div>
|
||||
<!-- 可滚动的内容区域 -->
|
||||
<div class="scrollable-content">
|
||||
<van-list
|
||||
v-model="loading_checkOrder_content"
|
||||
:finished="true"
|
||||
>
|
||||
<van-cell v-for="(item,index) in RepairManagementMaterialDataTable" :key="index">
|
||||
<van-card class="s-card">
|
||||
<template #tags>
|
||||
<van-row style="font-size: 1.5rem">
|
||||
<van-tag type="primary" size="large">{{ index+1 }}</van-tag>
|
||||
</van-row>
|
||||
<van-row style="font-size: 1.3rem">
|
||||
<van-col span="20">
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="location-o" color="#1989fa"/>
|
||||
<span>物料号:</span>
|
||||
<span> {{item.物料号}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="description-o" color="#1989fa"/>
|
||||
<span>物料名称:</span>
|
||||
<span> {{item.零件名称}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="scan" color="#1989fa"/>
|
||||
<span>物料条码:</span>
|
||||
<span> {{item.物料条码}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="bar-chart-o" color="#1989fa"/>
|
||||
<span>零件数量:</span>
|
||||
<span> {{item.零件数量}}</span>
|
||||
</div>
|
||||
</van-col>
|
||||
<van-col span="4" style="margin-top: 10px">
|
||||
<van-button v-if="pageType === 1" plain icon="delete" size="small" type="warning" style="margin-top: 10px" @click="RepairManagementDestroy(item)">报废</van-button>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</template>
|
||||
</van-card>
|
||||
</van-cell>
|
||||
</van-list>
|
||||
</div>
|
||||
<!-- 固定底部的内容 -->
|
||||
<div class="dialog-footer">
|
||||
<van-button plain size="small" style="width: 100%;font-size: 16px;height: 48px;" @click="showTableData_content=false">关闭</van-button>
|
||||
<!-- <van-button plain size="small" style="width: 100%;font-size: 16px;height: 48px;background-color: #1989fa;color: #fff" @click="editCheckOrder_Finish()">结束工单</van-button>-->
|
||||
</div>
|
||||
</div>
|
||||
</van-dialog>
|
||||
<van-dialog
|
||||
v-model="showTableData_content_exchange"
|
||||
width="95%"
|
||||
:lock-scroll="false"
|
||||
:show-cancel-button="false"
|
||||
:show-confirm-button="false"
|
||||
style="max-height: 70%!important;overflow: auto"
|
||||
>
|
||||
<div class="dialog-content">
|
||||
<!-- 固定顶部的内容 -->
|
||||
<div class="dialog-header">物料详情【{{RepairManagementReplaceForm.OpCode}}】</div>
|
||||
<!-- 可滚动的内容区域 -->
|
||||
<div class="scrollable-content">
|
||||
<van-card class="s-card">
|
||||
<template #tags>
|
||||
<van-row style="font-size: 1.3rem;display: flex">
|
||||
<van-field v-model="barcodeMaterial" left-icon="scan" style="width: 400px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" />
|
||||
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px;" @click="getTableByBarcode">查询</el-button>
|
||||
</van-row>
|
||||
<van-radio-group v-if="foundMaterials.length > 1" v-model="selectedMaterialId" @change="onMaterialSelectChange">
|
||||
<van-cell-group inset style="margin:10px 0;">
|
||||
<van-cell v-for="material in foundMaterials" :key="material.ID" :title="`${material.零件名称} (${material.物料号})`" clickable style="font-size: 2rem" @click="selectedMaterialId = material.ID">
|
||||
<template #right-icon>
|
||||
<van-radio :name="material.ID" />
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-radio-group>
|
||||
<van-row style="font-size: 2rem">
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="location-o" color="#1989fa"/>
|
||||
<span>物料号:</span>
|
||||
<span> {{RepairManagementReplaceForm.materialCode}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="description-o" color="#1989fa"/>
|
||||
<span>物料名称:</span>
|
||||
<span> {{RepairManagementReplaceForm.materialName}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="bar-chart-o" color="#1989fa"/>
|
||||
<span>零件数量:</span>
|
||||
<span> {{RepairManagementReplaceForm.materialCount}}</span>
|
||||
</div>
|
||||
<van-divider>更换物料</van-divider>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-form validate-first ref="RepairManagementReplaceForm">
|
||||
<van-field
|
||||
v-model="RepairManagementReplaceForm.materialBarCodeNew"
|
||||
label="新物料条码"
|
||||
name="checkOrderValue"
|
||||
placeholder="新物料条码"
|
||||
:rules="[{ required: true, message: '请输入新物料条码' }]"
|
||||
/>
|
||||
<br/>
|
||||
<van-checkbox v-model="RepairManagementReplaceForm.isUsedOpMaterial" shape="square">线边物料</van-checkbox>
|
||||
</van-form>
|
||||
</div>
|
||||
</van-row>
|
||||
</template>
|
||||
</van-card>
|
||||
</div>
|
||||
<!-- 固定底部的内容 -->
|
||||
<div class="dialog-footer">
|
||||
<van-button plain size="small" style="width: 100%;font-size: 16px;height: 48px;" @click="showTableData_content_exchange=false">关闭</van-button>
|
||||
<van-button :disabled="!RepairManagementReplaceForm.ID" plain size="small" style="width: 100%;font-size: 16px;height: 48px;background-color: #1989fa;color: #fff" @click="RepairManagementReplaceSubmit('RepairManagementReplaceForm')">确认更换</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</van-dialog>
|
||||
<van-dialog
|
||||
v-model="showTableData_content_destroy"
|
||||
width="95%"
|
||||
:lock-scroll="false"
|
||||
:show-cancel-button="false"
|
||||
:show-confirm-button="false"
|
||||
style="max-height: 70%!important;overflow: auto"
|
||||
>
|
||||
<div class="dialog-content">
|
||||
<!-- 固定顶部的内容 -->
|
||||
<div class="dialog-header">物料详情【{{RepairManagementReplaceForm.OpCode}}】</div>
|
||||
<!-- 可滚动的内容区域 -->
|
||||
<div class="scrollable-content">
|
||||
<van-card class="s-card">
|
||||
<template #tags>
|
||||
<van-row style="font-size: 1.3rem;display: flex">
|
||||
<van-field v-model="barcodeMaterial" left-icon="scan" style="width: 400px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" />
|
||||
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px;" @click="getTableByBarcode">查询</el-button>
|
||||
</van-row>
|
||||
<van-radio-group v-if="foundMaterials.length > 1" v-model="selectedMaterialId" @change="onMaterialSelectChange">
|
||||
<van-cell-group inset style="margin:10px 0;">
|
||||
<van-cell v-for="material in foundMaterials" :key="material.ID" :title="`${material.零件名称} (${material.物料号})`" clickable style="font-size: 1.3rem" @click="selectedMaterialId = material.ID">
|
||||
<template #right-icon>
|
||||
<van-radio :name="material.ID" />
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-radio-group>
|
||||
<van-row style="font-size: 1.3rem">
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="location-o" color="#1989fa"/>
|
||||
<span>物料号:</span>
|
||||
<span> {{RepairManagementReplaceForm.materialCode}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="description-o" color="#1989fa"/>
|
||||
<span>物料名称:</span>
|
||||
<span> {{RepairManagementReplaceForm.materialName}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="bar-chart-o" color="#1989fa"/>
|
||||
<span>零件数量:</span>
|
||||
<span> {{RepairManagementReplaceForm.materialCount}}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 10px 0 0;">
|
||||
<van-icon name="bar-chart-o" color="#1989fa"/>
|
||||
<span>物料条码:</span>
|
||||
<span> {{RepairManagementReplaceForm.materialBarCode}}</span>
|
||||
</div>
|
||||
</van-row>
|
||||
</template>
|
||||
</van-card>
|
||||
</div>
|
||||
<!-- 固定底部的内容 -->
|
||||
<div class="dialog-footer">
|
||||
<van-button plain size="small" style="width: 100%;font-size: 16px;height: 48px;" @click="showTableData_content_destroy=false">关闭</van-button>
|
||||
<van-button :disabled="!RepairManagementReplaceForm.ID" plain size="small" style="width: 100%;font-size: 16px;height: 48px;background-color: #ff0000;color: #fff" @click="RepairManagementDestroy2(RepairManagementReplaceForm)">报废</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</van-dialog>
|
||||
</div>
|
||||
<!-- <div style="width: 99.4%; height: 99%; background-color: #d7dee6; padding: 5px; border: 2px solid #9e9b9b">-->
|
||||
<!-- <el-row>-->
|
||||
<!-- <el-tabs type="border-card">-->
|
||||
<!-- <el-tab-pane label="返修操作">-->
|
||||
<!-- <el-input v-model="barcode" clearable style="width: 200px" />-->
|
||||
<!-- <el-button type="primary" icon="el-icon-full-screen" style="margin-left: 15px" @click="getTable">扫描条码</el-button>-->
|
||||
<!-- <el-radio-group v-model="RepairType" class="myRadio" style="margin-left: 20px">-->
|
||||
<!-- <el-radio :label="1"><span style="font-size: 20px">物料更换模式</span></el-radio>-->
|
||||
<!-- <el-radio :label="2"><span style="font-size: 20px">整件报废模式</span></el-radio>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- <el-button v-if="RepairType === 2" type="warning" icon="el-icon-delete" style="margin-left: 100px" @click="RepairManagementReturnOp">物料回仓</el-button>-->
|
||||
<!-- <div style="margin-top: 5px">-->
|
||||
<!-- <el-col :span="10">-->
|
||||
<!-- <el-table-->
|
||||
<!-- :data="RepairManagementDataTable"-->
|
||||
<!-- :header-cell-style="{ background: '#F5F5F5', fontSize: '22px' }"-->
|
||||
<!-- style="width: 100%; border: 1px solid #9e9b9b"-->
|
||||
<!-- border-->
|
||||
<!-- height="790px"-->
|
||||
<!-- tooltip-effect="dark"-->
|
||||
<!-- @row-click="getTable1"-->
|
||||
<!-- >-->
|
||||
<!-- <el-table-column align="center" label="工位号" property="工位号" width="180" :filters="stationArr" :filter-method="filterHandler">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.工位号 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="订单号">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.订单号 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <!– <el-table-column align="center" label="车体号" width="100px">–>-->
|
||||
<!-- <!– <template slot-scope="scope">–>-->
|
||||
<!-- <!– {{ scope.row.车体二维码 }}–>-->
|
||||
<!-- <!– </template>–>-->
|
||||
<!-- <!– </el-table-column>–>-->
|
||||
<!-- <el-table-column align="center" label="装配人员" width="120px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.装配人员 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="结果" width="120px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <span v-if="parseInt(scope.row.是否合格) === 1" style="color: #00893d">OK</span>-->
|
||||
<!-- <span v-else style="color: #ff0000">NG</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="14">-->
|
||||
<!-- <el-table-->
|
||||
<!-- :data="RepairManagementMaterialDataTable"-->
|
||||
<!-- :header-cell-style="{ background: '#F5F5F5', fontSize: '22px' }"-->
|
||||
<!-- style="width: 99.9%; border: 1px solid #9e9b9b;margin-left: 5px"-->
|
||||
<!-- border-->
|
||||
<!-- height="790px"-->
|
||||
<!-- tooltip-effect="dark"-->
|
||||
<!-- >-->
|
||||
<!-- <el-table-column type="index" align="center" label="序号" width="80px" />-->
|
||||
<!-- <el-table-column align="center" label="物料号" width="200">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.物料号 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="物料名称" show-overflow-tooltip>-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.零件名称 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="物料条码">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.物料条码 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="数量" width="100px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.零件数量 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="操作" width="100px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-button v-if="RepairType === 1" type="primary" size="mini" style="font-size: 1rem" @click="RepairManagementReplace(scope.row)" >更换</el-button>-->
|
||||
<!-- <el-button v-if="RepairType === 2" type="danger" size="mini" style="font-size: 1rem" @click="RepairManagementDestroy(scope.row)" >报废</el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-tab-pane>-->
|
||||
<!-- <el-tab-pane label="返修记录">-->
|
||||
<!-- <span style="font-size: 1.2rem">产品编号:</span>-->
|
||||
<!-- <el-input v-model="partCode" clearable style="width: 200px" />-->
|
||||
<!-- <el-button type="primary" icon="el-icon-search" style="margin-left: 15px" @click="getTable2">查询</el-button>-->
|
||||
<!-- <div style="margin-top: 5px">-->
|
||||
<!-- <el-table-->
|
||||
<!-- :data="RepairManagementDataLogTable"-->
|
||||
<!-- :header-cell-style="{ background: '#F5F5F5', fontSize: '22px' }"-->
|
||||
<!-- style="width: 100%; border: 1px solid #9e9b9b"-->
|
||||
<!-- border-->
|
||||
<!-- height="790px"-->
|
||||
<!-- tooltip-effect="dark"-->
|
||||
<!-- @row-click="getTable1"-->
|
||||
<!-- >-->
|
||||
<!-- <el-table-column type="index" align="center" label="序号" width="80px" />-->
|
||||
<!-- <el-table-column align="center" label="订单号" width="180px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.订单号 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="工位号" width="120px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.工位号 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="物料号" width="180px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.物料号 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="物料名称" show-overflow-tooltip>-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.零件名称 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="数量" width="100px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.零件数量 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="操作方式">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.操作类型名称 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="新条码">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.更换物料条码 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="旧条码">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.物料条码 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="操作人" width="140px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.更换人 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column align="center" label="返修时间" width="220px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.更换时间 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-tab-pane>-->
|
||||
<!-- </el-tabs>-->
|
||||
<!-- </el-row>-->
|
||||
<!-- <!– 更换物料 –>-->
|
||||
<!-- <el-dialog :visible.sync="RepairManagementReplaceDialogVisible" :append-to-body="true" title="更换物料" center width="400px">-->
|
||||
<!-- <el-form ref="RepairManagementReplaceForm" :model="RepairManagementReplaceForm" :rules="RepairManagementReplaceRules" label-position="center" label-width="110px" class="demo-ruleForm">-->
|
||||
<!-- <el-form-item label="物料号" prop="materialCode">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialCode" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料名称" prop="materialName">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialName" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="原物料条码" prop="materialBarCode">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialBarCode" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="数量" prop="materialCount">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialCount" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="更换物料" prop="materialBarCodeNew">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialBarCodeNew" size="small" clearable style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="工位物料" prop="isUsedOpMaterial">-->
|
||||
<!-- <el-checkbox v-model="RepairManagementReplaceForm.isUsedOpMaterial"></el-checkbox>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-form>-->
|
||||
<!-- <div slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button size="small" @click="RepairManagementReplaceCancel('RepairManagementReplaceForm')">取消</el-button>-->
|
||||
<!-- <el-button type="primary" size="small" @click="RepairManagementReplaceSubmit('RepairManagementReplaceForm')">确定</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-dialog>-->
|
||||
<!-- <!– 物料报废 –>-->
|
||||
<!-- <el-dialog :visible.sync="RepairManagementDestroyAllDialogVisible" :append-to-body="true" title="整件报废" center width="400px">-->
|
||||
<!-- <el-form ref="RepairManagementReplaceForm" :model="RepairManagementReplaceForm" :rules="RepairManagementReplaceRules" label-position="center" label-width="110px" class="demo-ruleForm">-->
|
||||
<!-- <el-form-item label="物料号" prop="materialCode">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialCode" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料名称" prop="materialName">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialName" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="原物料条码" prop="materialBarCode">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialBarCode" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="数量" prop="materialCount">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialCount" size="small" disabled style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="更换物料" prop="materialBarCodeNew">-->
|
||||
<!-- <el-input v-model="RepairManagementReplaceForm.materialBarCodeNew" size="small" clearable style="width:200px"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-form>-->
|
||||
<!-- <div slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button size="small" @click="RepairManagementReplaceCancel('RepairManagementReplaceForm')">取消</el-button>-->
|
||||
<!-- <el-button type="primary" size="small" @click="RepairManagementReplaceSubmit('RepairManagementReplaceForm')">确定</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-dialog>-->
|
||||
<!-- </div>-->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Dialog, Toast} from 'vant'
|
||||
|
||||
export default {
|
||||
name: 'RepairManagement',
|
||||
props: {
|
||||
pageType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
barcode: '',
|
||||
barcodeMaterial: '',
|
||||
loading_checkOrder: false,
|
||||
RepairManagementDataTable: [],
|
||||
userInfo: '',
|
||||
showTableData_content: false,
|
||||
loading_checkOrder_content: false,
|
||||
RepairManagementMaterialDataTable: [],
|
||||
|
||||
showTableData_content_exchange: false,
|
||||
showTableData_content_destroy: false,
|
||||
loading_checkOrder_content_exchange: false,
|
||||
foundMaterials: [],
|
||||
selectedMaterialId: null,
|
||||
|
||||
RepairType: 1,
|
||||
currentSelectRow: {},
|
||||
RepairManagementReplaceDialogVisible: false,
|
||||
RepairManagementDestroyAllDialogVisible: false,
|
||||
RepairManagementReplaceForm: {
|
||||
ID: 0,
|
||||
OpCode: '',
|
||||
EngineID: '',
|
||||
isUsedOpMaterial: true,
|
||||
TraceabilityCode: 0,
|
||||
materialCount: 0,
|
||||
materialCode: '',
|
||||
materialBarCode: '',
|
||||
materialName: '',
|
||||
materialBarCodeNew: ''
|
||||
},
|
||||
RepairManagementReplaceRules: {
|
||||
materialBarCodeNew: [{ required: true, message: '请输入/扫描新物料码!', trigger: 'blur' }]
|
||||
},
|
||||
RepairManagementType: '1',
|
||||
partCode: '',
|
||||
opCode: '',
|
||||
opCodeS: [],
|
||||
stationArr: [],
|
||||
RepairManagementDataLogTable: [],
|
||||
RepairManagementDataTableOrigin: [],
|
||||
engineValue: {
|
||||
OpName: null,
|
||||
EngineID: null, // 产品编号
|
||||
EngineType: null, // 产品型号
|
||||
EngineTypeID: null, // 机型代码
|
||||
PalletCode: null,
|
||||
ProcessCode: null, // 程序号
|
||||
PartPalletCode: null, // 托盘号
|
||||
PalletInfo: null, // 托盘信息
|
||||
RepairPartStatusPLC: null,
|
||||
QualityMask: null,
|
||||
OrderForm: null, // 订单号
|
||||
EngineTypeString: null // 产品型号字符串北汽专用
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||
console.log(this.userInfo)
|
||||
this.getStation()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getStation() {
|
||||
this.stationArr = []
|
||||
const Data = this.CreateData('11', '工位与名称_视图_查询')
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.stationArr.push({
|
||||
label: `【${response.data[i].工位号}】${response.data[i].工位名称}`,
|
||||
value: response.data[i].工位号,
|
||||
text: `【${response.data[i].工位号}】${response.data[i].工位名称}`,
|
||||
MesWebCode: response.data[i].MesWebCode
|
||||
})
|
||||
}
|
||||
// this.stationArr.unshift({
|
||||
// label: `全部工位`,
|
||||
// value: 'ALL'
|
||||
// })
|
||||
// this.opCode = 'ALL'
|
||||
})
|
||||
},
|
||||
getTable() {
|
||||
this.RepairManagementDataTable = []
|
||||
this.RepairManagementMaterialDataTable = []
|
||||
this.currentSelectRow = {}
|
||||
this.RepairManagementReplaceForm.EngineID = ''
|
||||
if (this.barcode === '') {
|
||||
Toast.fail('请先扫描条码!')
|
||||
return
|
||||
}
|
||||
const param = []
|
||||
param[0] = ['发动机号', this.barcode]
|
||||
const Data = this.CreateData('11', '质量数据查询_测量数据发动机在线状态_返修工位', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
this.RepairManagementDataTable = response.data
|
||||
this.RepairManagementReplaceForm.EngineID = response.data[0].发动机号
|
||||
console.log(this.RepairManagementReplaceForm.EngineID)
|
||||
} else {
|
||||
this.RepairManagementDataTable = []
|
||||
}
|
||||
// this.$emit('initEngineValue', this.engineValue)
|
||||
})
|
||||
},
|
||||
getTable1(row, isShow = true) {
|
||||
this.currentSelectRow = row
|
||||
this.RepairManagementMaterialDataTable = []
|
||||
const param = []
|
||||
param[0] = ['工位号', row.工位号]
|
||||
param[1] = ['发动机号', row.发动机号]
|
||||
param[2] = ['发动机号_ischeck', 1]
|
||||
param[3] = ['工位号_ischeck', 1]
|
||||
param[4] = ['是否禁用', 0]
|
||||
param[5] = ['PageCurrent', 1]
|
||||
param[6] = ['PageSize', 1000]
|
||||
param[7] = ['PageCount', '1111', 'int', '1']
|
||||
param[8] = ['ItemCount', '1111', 'int', '1']
|
||||
const Data = this.CreateData('11', '物料数据_视图_查询_返修', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.result.length > 0) {
|
||||
this.RepairManagementMaterialDataTable = response.data.result
|
||||
this.showTableData_content = isShow
|
||||
} else {
|
||||
this.RepairManagementMaterialDataTable = []
|
||||
}
|
||||
})
|
||||
},
|
||||
getTableByBarcode() {
|
||||
if (this.barcodeMaterial === '') {
|
||||
Toast.fail('请输入物料条码!')
|
||||
return
|
||||
}
|
||||
this.RepairManagementReplaceForm.materialCode = ''
|
||||
this.RepairManagementReplaceForm.materialName = ''
|
||||
this.RepairManagementReplaceForm.TraceabilityCode = ''
|
||||
this.RepairManagementReplaceForm.ID = ''
|
||||
this.RepairManagementReplaceForm.materialCount = ''
|
||||
this.RepairManagementReplaceForm.materialBarCode = ''
|
||||
this.RepairManagementReplaceForm.materialBarCodeNew = ''
|
||||
this.foundMaterials = []
|
||||
this.selectedMaterialId = null
|
||||
const param = []
|
||||
param[0] = ['工位号', this.RepairManagementReplaceForm.OpCode]
|
||||
param[1] = ['发动机号', this.RepairManagementReplaceForm.EngineID]
|
||||
param[2] = ['发动机号_ischeck', 1]
|
||||
param[3] = ['工位号_ischeck', 0]
|
||||
param[4] = ['二维码_ischeck', 1]
|
||||
param[5] = ['二维码', this.barcodeMaterial]
|
||||
param[6] = ['是否禁用', 0]
|
||||
param[7] = ['PageCurrent', 1]
|
||||
param[8] = ['PageSize', 1000]
|
||||
param[9] = ['PageCount', '1111', 'int', '1']
|
||||
param[10] = ['ItemCount', '1111', 'int', '1']
|
||||
const Data = this.CreateData('11', '物料数据_视图_查询_返修', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.result.length > 0) {
|
||||
this.foundMaterials = response.data.result
|
||||
if (this.foundMaterials.length === 1) {
|
||||
this.selectedMaterialId = this.foundMaterials[0].ID
|
||||
this.onMaterialSelectChange(this.selectedMaterialId)
|
||||
}
|
||||
} else {
|
||||
Toast.fail('未查询到物料信息!')
|
||||
}
|
||||
}).catch(error => {
|
||||
Toast.fail('查询物料信息失败!')
|
||||
})
|
||||
},
|
||||
onMaterialSelectChange(selectedId) {
|
||||
const row = this.foundMaterials.find(item => item.ID === selectedId)
|
||||
if (row) {
|
||||
this.RepairManagementReplaceForm.materialCode = row.物料号
|
||||
this.RepairManagementReplaceForm.materialName = row.零件名称
|
||||
this.RepairManagementReplaceForm.TraceabilityCode = row.追溯代码
|
||||
this.RepairManagementReplaceForm.ID = row.ID
|
||||
this.RepairManagementReplaceForm.materialCount = row.零件数量
|
||||
this.RepairManagementReplaceForm.materialBarCode = row.物料条码
|
||||
this.RepairManagementReplaceForm.materialBarCodeNew = ''
|
||||
this.RepairManagementReplaceForm.OpCode = row.工位号
|
||||
}
|
||||
},
|
||||
RepairManagementReplace(row) {
|
||||
this.RepairManagementReplaceForm.OpCode = row.工位号
|
||||
this.RepairManagementReplaceForm.EngineID = row.发动机号
|
||||
this.RepairManagementReplaceForm.materialCode = ''
|
||||
this.RepairManagementReplaceForm.materialName = ''
|
||||
this.RepairManagementReplaceForm.TraceabilityCode = ''
|
||||
this.RepairManagementReplaceForm.ID = ''
|
||||
this.RepairManagementReplaceForm.materialCount = ''
|
||||
this.RepairManagementReplaceForm.materialBarCode = ''
|
||||
this.RepairManagementReplaceForm.materialBarCodeNew = ''
|
||||
this.barcodeMaterial = ''
|
||||
this.foundMaterials = []
|
||||
this.selectedMaterialId = null
|
||||
|
||||
this.showTableData_content_exchange = true
|
||||
},
|
||||
// 返修替换提交
|
||||
RepairManagementReplaceSubmit(formName) {
|
||||
this.$refs[formName].validate().then(()=>{
|
||||
const param = []
|
||||
param[0] = ['工位号', this.RepairManagementReplaceForm.OpCode]
|
||||
param[1] = ['ID', this.RepairManagementReplaceForm.ID]
|
||||
param[2] = ['追溯代码', this.RepairManagementReplaceForm.TraceabilityCode]
|
||||
param[3] = ['操作者', this.userInfo.姓名]
|
||||
param[4] = ['新物料条码', this.RepairManagementReplaceForm.materialBarCodeNew]
|
||||
param[5] = ['是否消耗工位物料', this.RepairManagementReplaceForm.isUsedOpMaterial ? 1 : 0]
|
||||
const Data = this.CreateData('11', '电子看板_装配零件_返修件_更换物料_编辑', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
if (response.data[0].result === 1) {
|
||||
Toast.success('物料更换成功!')
|
||||
this.showTableData_content_exchange = false
|
||||
} else if (response.data[0].result === 2) {
|
||||
// 物料验证失败,显示具体错误信息
|
||||
Toast.fail(response.data[0].msg || '物料验证失败!')
|
||||
} else {
|
||||
Toast.fail('物料更换失败!')
|
||||
}
|
||||
} else {
|
||||
Toast.fail('物料更换失败!')
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
RepairManagementDestroyShow() {
|
||||
this.RepairManagementReplaceForm.OpCode = ''
|
||||
this.RepairManagementReplaceForm.materialCode = ''
|
||||
this.RepairManagementReplaceForm.materialName = ''
|
||||
this.RepairManagementReplaceForm.TraceabilityCode = ''
|
||||
this.RepairManagementReplaceForm.ID = ''
|
||||
this.RepairManagementReplaceForm.materialCount = ''
|
||||
this.RepairManagementReplaceForm.materialBarCode = ''
|
||||
this.RepairManagementReplaceForm.materialBarCodeNew = ''
|
||||
this.barcodeMaterial = ''
|
||||
this.foundMaterials = []
|
||||
this.selectedMaterialId = null
|
||||
|
||||
this.showTableData_content_destroy = true
|
||||
},
|
||||
getTableAfterDestroy(row) {
|
||||
const param = []
|
||||
param[0] = ['发动机号', row.发动机号]
|
||||
const Data = this.CreateData('11', '质量数据查询_测量数据发动机在线状态_返修工位', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
console.log(response.data)
|
||||
if (response.data.length > 0) {
|
||||
this.RepairManagementDataTable = response.data
|
||||
} else {
|
||||
this.RepairManagementDataTable = []
|
||||
}
|
||||
// this.$emit('initEngineValue', this.engineValue)
|
||||
})
|
||||
},
|
||||
// 返修报废提交
|
||||
RepairManagementDestroy(row) {
|
||||
Dialog.confirm({
|
||||
title: '物料报废',
|
||||
message: `是否报废当前物料【${row.物料号}】【${row.零件名称}】?`
|
||||
}).then(() => {
|
||||
const param = []
|
||||
param[0] = ['工位号', '']
|
||||
param[1] = ['ID', row.ID]
|
||||
param[2] = ['追溯代码', row.追溯代码]
|
||||
param[3] = ['操作者', this.userInfo.姓名]
|
||||
param[4] = ['新物料条码', '']
|
||||
const Data = this.CreateData('12', '电子看板_装配零件_返修件_报废物料_编辑', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
if (response.data[0].result === '1') {
|
||||
Toast.success('物料报废成功!')
|
||||
this.getTable1(this.currentSelectRow, false)
|
||||
this.getTableAfterDestroy(this.currentSelectRow)
|
||||
} else {
|
||||
Toast.success('物料报废失败!')
|
||||
}
|
||||
} else {
|
||||
Toast.success('物料报废失败!')
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
Toast({
|
||||
message: '已取消操作',
|
||||
icon: 'close',
|
||||
});
|
||||
})
|
||||
},
|
||||
// 返修报废提交
|
||||
RepairManagementDestroy2() {
|
||||
const row = this.RepairManagementReplaceForm
|
||||
if(row.materialCode === '') {
|
||||
Toast.fail('请查询物料信息!')
|
||||
return
|
||||
}
|
||||
Dialog.confirm({
|
||||
title: '物料报废',
|
||||
message: `是否报废当前物料【${row.materialCode}】【${row.materialName}】?`
|
||||
}).then(() => {
|
||||
const param = []
|
||||
param[0] = ['工位号', '']
|
||||
param[1] = ['ID', row.ID]
|
||||
param[2] = ['追溯代码', row.TraceabilityCode]
|
||||
param[3] = ['操作者', this.userInfo.姓名]
|
||||
param[4] = ['新物料条码', '']
|
||||
const Data = this.CreateData('12', '电子看板_装配零件_返修件_报废物料_编辑', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
if (response.data[0].result === '1') {
|
||||
Toast.success('物料报废成功!')
|
||||
this.getTable1(this.currentSelectRow, false)
|
||||
this.getTableAfterDestroy(this.currentSelectRow)
|
||||
this.showTableData_content_destroy = false
|
||||
} else {
|
||||
Toast.fail('物料报废失败!')
|
||||
}
|
||||
} else {
|
||||
Toast.fail('物料报废失败!')
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
Toast({
|
||||
message: '已取消操作',
|
||||
icon: 'close',
|
||||
});
|
||||
})
|
||||
},
|
||||
// 返修报废 物料回仓
|
||||
RepairManagementReturnOp() {
|
||||
if (this.RepairManagementDataTable.length === 0) {
|
||||
Toast.fail('请先查询产品信息!')
|
||||
return
|
||||
}
|
||||
|
||||
Dialog.confirm({
|
||||
title: '物料返回提示',
|
||||
message: '剩余物料将返回线边库位?'
|
||||
}).then(() => {
|
||||
const param = []
|
||||
param[0] = ['发动机号', this.barcode]
|
||||
param[1] = ['操作者', this.userInfo.姓名]
|
||||
const Data = this.CreateData('12', '电子看板_装配零件_返修件_报废物料_返回', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
if (response.data[0].result === '1') {
|
||||
Toast.success('物料回仓成功!')
|
||||
this.getTableAfterDestroy(this.currentSelectRow)
|
||||
} else {
|
||||
Toast.fail('物料回仓失败!')
|
||||
}
|
||||
} else {
|
||||
Toast.fail('物料回仓失败!')
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
Toast({
|
||||
message: '已取消操作',
|
||||
icon: 'close',
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dialog-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.dialog-header,
|
||||
.dialog-footer {
|
||||
position: sticky;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.dialog-header {
|
||||
top: 0;
|
||||
background-color: white;
|
||||
padding-top: 26px;
|
||||
font-weight: 500;
|
||||
line-height: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
bottom: -3px;
|
||||
background-color: white;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.scrollable-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
529
src/views/RepairManagement/passStation/indexBal.vue
Normal file
@@ -0,0 +1,529 @@
|
||||
<template>
|
||||
<div style="width: 99.4%; height: 99%; background-color: #d7dee6; padding: 5px; border: 2px solid #9e9b9b">
|
||||
<el-row>
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="返修操作">
|
||||
<el-input v-model="barcode" clearable style="width: 200px" />
|
||||
<el-button type="primary" icon="el-icon-full-screen" style="margin-left: 15px" @click="getTable">扫描条码</el-button>
|
||||
<el-radio-group v-model="RepairType" class="myRadio" style="margin-left: 20px">
|
||||
<el-radio :label="1"><span style="font-size: 20px">物料更换模式</span></el-radio>
|
||||
<el-radio :label="2"><span style="font-size: 20px">整件报废模式</span></el-radio>
|
||||
</el-radio-group>
|
||||
<el-button v-if="RepairType === 2" type="warning" icon="el-icon-delete" style="margin-left: 100px" @click="RepairManagementReturnOp">物料回仓</el-button>
|
||||
<div style="margin-top: 5px">
|
||||
<el-col :span="10">
|
||||
<el-table
|
||||
:data="RepairManagementDataTable"
|
||||
:header-cell-style="{ background: '#F5F5F5', fontSize: '22px' }"
|
||||
style="width: 100%; border: 1px solid #9e9b9b"
|
||||
border
|
||||
height="790px"
|
||||
tooltip-effect="dark"
|
||||
@row-click="getTable1"
|
||||
>
|
||||
<el-table-column align="center" label="工位号" property="工位号" width="180" :filters="stationArr" :filter-method="filterHandler">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工位号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="订单号">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.订单号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" label="车体号" width="100px">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ scope.row.车体二维码 }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column align="center" label="装配人员" width="120px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.装配人员 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="结果" width="120px">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="parseInt(scope.row.是否合格) === 1" style="color: #00893d">OK</span>
|
||||
<span v-else style="color: #ff0000">NG</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<el-table
|
||||
:data="RepairManagementMaterialDataTable"
|
||||
:header-cell-style="{ background: '#F5F5F5', fontSize: '22px' }"
|
||||
style="width: 99.9%; border: 1px solid #9e9b9b;margin-left: 5px"
|
||||
border
|
||||
height="790px"
|
||||
tooltip-effect="dark"
|
||||
>
|
||||
<el-table-column type="index" align="center" label="序号" width="80px" />
|
||||
<el-table-column align="center" label="物料号" width="200">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="物料名称" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.零件名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="物料条码">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料条码 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="数量" width="100px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.零件数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="100px">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="RepairType === 1" type="primary" size="mini" style="font-size: 1rem" @click="RepairManagementReplace(scope.row)" >更换</el-button>
|
||||
<el-button v-if="RepairType === 2" type="danger" size="mini" style="font-size: 1rem" @click="RepairManagementDestroy(scope.row)" >报废</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="返修记录">
|
||||
<span style="font-size: 1.2rem">产品编号:</span>
|
||||
<el-input v-model="partCode" clearable style="width: 200px" />
|
||||
<el-button type="primary" icon="el-icon-search" style="margin-left: 15px" @click="getTable2">查询</el-button>
|
||||
<div style="margin-top: 5px">
|
||||
<el-table
|
||||
:data="RepairManagementDataLogTable"
|
||||
:header-cell-style="{ background: '#F5F5F5', fontSize: '22px' }"
|
||||
style="width: 100%; border: 1px solid #9e9b9b"
|
||||
border
|
||||
height="790px"
|
||||
tooltip-effect="dark"
|
||||
@row-click="getTable1"
|
||||
>
|
||||
<el-table-column type="index" align="center" label="序号" width="80px" />
|
||||
<el-table-column align="center" label="订单号" width="180px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.订单号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="工位号" width="120px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工位号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="物料号" width="180px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="物料名称" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.零件名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="数量" width="100px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.零件数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作方式">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.操作类型名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="新条码">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.更换物料条码 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="旧条码">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料条码 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作人" width="140px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.更换人 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="返修时间" width="220px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.更换时间 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-row>
|
||||
<!-- 更换物料 -->
|
||||
<el-dialog :visible.sync="RepairManagementReplaceDialogVisible" :append-to-body="true" title="更换物料" center width="400px">
|
||||
<el-form ref="RepairManagementReplaceForm" :model="RepairManagementReplaceForm" :rules="RepairManagementReplaceRules" label-position="center" label-width="110px" class="demo-ruleForm">
|
||||
<el-form-item label="物料号" prop="materialCode">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialCode" size="small" disabled style="width:200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialName" size="small" disabled style="width:200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="原物料条码" prop="materialBarCode">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialBarCode" size="small" disabled style="width:200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="materialCount">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialCount" size="small" disabled style="width:200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="更换物料" prop="materialBarCodeNew">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialBarCodeNew" size="small" clearable style="width:200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工位物料" prop="isUsedOpMaterial">
|
||||
<el-checkbox v-model="RepairManagementReplaceForm.isUsedOpMaterial"></el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="RepairManagementReplaceCancel('RepairManagementReplaceForm')">取消</el-button>
|
||||
<el-button type="primary" size="small" @click="RepairManagementReplaceSubmit('RepairManagementReplaceForm')">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 物料报废 -->
|
||||
<el-dialog :visible.sync="RepairManagementDestroyAllDialogVisible" :append-to-body="true" title="整件报废" center width="400px">
|
||||
<el-form ref="RepairManagementReplaceForm" :model="RepairManagementReplaceForm" :rules="RepairManagementReplaceRules" label-position="center" label-width="110px" class="demo-ruleForm">
|
||||
<el-form-item label="物料号" prop="materialCode">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialCode" size="small" disabled style="width:200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialName" size="small" disabled style="width:200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="原物料条码" prop="materialBarCode">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialBarCode" size="small" disabled style="width:200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="materialCount">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialCount" size="small" disabled style="width:200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="更换物料" prop="materialBarCodeNew">
|
||||
<el-input v-model="RepairManagementReplaceForm.materialBarCodeNew" size="small" clearable style="width:200px"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="RepairManagementReplaceCancel('RepairManagementReplaceForm')">取消</el-button>
|
||||
<el-button type="primary" size="small" @click="RepairManagementReplaceSubmit('RepairManagementReplaceForm')">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'RepairManagement',
|
||||
data() {
|
||||
return {
|
||||
RepairType: 1,
|
||||
currentSelectRow: {},
|
||||
RepairManagementReplaceDialogVisible: false,
|
||||
RepairManagementDestroyAllDialogVisible: false,
|
||||
RepairManagementReplaceForm: {
|
||||
ID: 0,
|
||||
isUsedOpMaterial: true,
|
||||
TraceabilityCode: 0,
|
||||
materialCount: 0,
|
||||
materialCode: '',
|
||||
materialBarCode: '',
|
||||
materialName: '',
|
||||
materialBarCodeNew: ''
|
||||
},
|
||||
RepairManagementReplaceRules: {
|
||||
materialBarCodeNew: [{ required: true, message: '请输入/扫描新物料码!', trigger: 'blur' }]
|
||||
},
|
||||
RepairManagementType: '1',
|
||||
partCode: '',
|
||||
barcode: '',
|
||||
opCode: '',
|
||||
opCodeS: [],
|
||||
stationArr: [],
|
||||
RepairManagementDataTable: [],
|
||||
RepairManagementDataLogTable: [],
|
||||
RepairManagementDataTableOrigin: [],
|
||||
RepairManagementMaterialDataTable: [],
|
||||
engineValue: {
|
||||
OpName: null,
|
||||
EngineID: null, // 产品编号
|
||||
EngineType: null, // 产品型号
|
||||
EngineTypeID: null, // 机型代码
|
||||
PalletCode: null,
|
||||
ProcessCode: null, // 程序号
|
||||
PartPalletCode: null, // 托盘号
|
||||
PalletInfo: null, // 托盘信息
|
||||
RepairPartStatusPLC: null,
|
||||
QualityMask: null,
|
||||
OrderForm: null, // 订单号
|
||||
EngineTypeString: null // 产品型号字符串北汽专用
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getStation()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getStation() {
|
||||
this.stationArr = []
|
||||
const Data = this.CreateData('11', '工位与名称_视图_查询')
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.stationArr.push({
|
||||
label: `【${response.data[i].工位号}】${response.data[i].工位名称}`,
|
||||
value: response.data[i].工位号,
|
||||
text: `【${response.data[i].工位号}】${response.data[i].工位名称}`,
|
||||
MesWebCode: response.data[i].MesWebCode
|
||||
})
|
||||
}
|
||||
// this.stationArr.unshift({
|
||||
// label: `全部工位`,
|
||||
// value: 'ALL'
|
||||
// })
|
||||
// this.opCode = 'ALL'
|
||||
})
|
||||
},
|
||||
getTable() {
|
||||
this.RepairManagementDataTable = []
|
||||
this.RepairManagementMaterialDataTable = []
|
||||
this.currentSelectRow = {}
|
||||
if (this.barcode === '') {
|
||||
this.$message.error('请先扫描条码!')
|
||||
return
|
||||
}
|
||||
const param = []
|
||||
param[0] = ['工位号', '']
|
||||
param[1] = ['工位号_check', false]
|
||||
param[2] = ['发动机号', this.barcode]
|
||||
param[3] = ['发动机号_check', true]
|
||||
param[4] = ['开始时间', null]
|
||||
param[5] = ['结束时间', null]
|
||||
param[6] = ['PageCurrent', 1]
|
||||
param[7] = ['PageSize', 100]
|
||||
param[8] = ['PageCount', '1111', 'int', '1']
|
||||
param[9] = ['ItemCount', '1111', 'int', '1']
|
||||
const Data = this.CreateData('11', '质量数据查询_测量数据发动机在线状态', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
console.log(response.data)
|
||||
if (response.data.result.length > 0) {
|
||||
this.RepairManagementDataTable = response.data.result
|
||||
this.engineValue.OrderForm = response.data.result[0]['订单号']
|
||||
this.engineValue.EngineType = response.data.result[0]['机型']
|
||||
// this.engineValue.EngineTypeID = response.data.result[0]['机型ID']
|
||||
this.engineValue.EngineID = response.data.result[0]['发动机号']
|
||||
this.engineValue.PalletInfo = response.data.result[0]['车体二维码']
|
||||
// this.engineValue.ProcessCode = response.data.result[0]['上线总排序']
|
||||
} else {
|
||||
this.RepairManagementDataTable = []
|
||||
this.engineValue.OrderForm = ''
|
||||
this.engineValue.EngineType = ''
|
||||
// this.engineValue.EngineTypeID = response.data.result[0]['机型ID']
|
||||
this.engineValue.EngineID = ''
|
||||
this.engineValue.PalletInfo = ''
|
||||
// this.engineValue.ProcessCode = response.data.result[0]['上线总排序']
|
||||
}
|
||||
this.$emit('initEngineValue', this.engineValue)
|
||||
})
|
||||
},
|
||||
getTable1(row) {
|
||||
this.currentSelectRow = row
|
||||
this.RepairManagementMaterialDataTable = []
|
||||
const param = []
|
||||
param[0] = ['工位号', row.工位号]
|
||||
param[1] = ['发动机号', row.发动机号]
|
||||
param[2] = ['发动机号_ischeck', 1]
|
||||
param[3] = ['工位号_ischeck', 1]
|
||||
param[4] = ['是否禁用', 0]
|
||||
param[5] = ['PageCurrent', 1]
|
||||
param[6] = ['PageSize', 100]
|
||||
param[7] = ['PageCount', '1111', 'int', '1']
|
||||
param[8] = ['ItemCount', '1111', 'int', '1']
|
||||
const Data = this.CreateData('11', '物料数据_视图_查询', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.result.length > 0) {
|
||||
console.log(response.data.result)
|
||||
this.RepairManagementMaterialDataTable = response.data.result
|
||||
} else {
|
||||
this.RepairManagementMaterialDataTable = []
|
||||
}
|
||||
})
|
||||
},
|
||||
getTable2() {
|
||||
if (this.partCode === '') {
|
||||
this.$message.error('请输入产品编号!')
|
||||
return
|
||||
}
|
||||
this.RepairManagementDataLogTable = []
|
||||
const param = []
|
||||
param[0] = ['发动机号', this.partCode]
|
||||
const Data = this.CreateData('11', '电子看板_装配零件_返修件_返修记录_查询', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
console.log(response.data)
|
||||
this.RepairManagementDataLogTable = response.data
|
||||
} else {
|
||||
this.RepairManagementDataLogTable = []
|
||||
}
|
||||
})
|
||||
},
|
||||
filterHandler(value, row, column) {
|
||||
const property = column['property']
|
||||
this.RepairManagementMaterialDataTable = []
|
||||
return row[property] === value
|
||||
},
|
||||
RepairManagementReplace(row) {
|
||||
this.RepairManagementReplaceForm.materialCode = row.物料号
|
||||
this.RepairManagementReplaceForm.materialName = row.零件名称
|
||||
this.RepairManagementReplaceForm.TraceabilityCode = row.追溯代码
|
||||
this.RepairManagementReplaceForm.ID = row.ID
|
||||
this.RepairManagementReplaceForm.materialCount = row.零件数量
|
||||
this.RepairManagementReplaceForm.materialBarCode = row.物料条码
|
||||
this.RepairManagementReplaceForm.materialBarCodeNew = ''
|
||||
|
||||
this.RepairManagementReplaceDialogVisible = true
|
||||
},
|
||||
// 返修替换提交
|
||||
RepairManagementReplaceSubmit(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
const param = []
|
||||
param[0] = ['工位号', this.$store.state.station.stationName]
|
||||
param[1] = ['ID', this.RepairManagementReplaceForm.ID]
|
||||
param[2] = ['追溯代码', this.RepairManagementReplaceForm.TraceabilityCode]
|
||||
param[3] = ['操作者', this.$store.state.user.name]
|
||||
param[4] = ['新物料条码', this.RepairManagementReplaceForm.materialBarCodeNew]
|
||||
param[5] = ['是否消耗工位物料', this.RepairManagementReplaceForm.isUsedOpMaterial ? 1 : 0]
|
||||
const Data = this.CreateData('11', '电子看板_装配零件_返修件_更换物料_编辑', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
if (response.data[0].result == 1) {
|
||||
this.$message.success('物料更换成功!')
|
||||
this.RepairManagementReplaceDialogVisible = false
|
||||
this.getTable1(this.currentSelectRow)
|
||||
} else if (response.data[0].result == 2) {
|
||||
// 物料验证失败,显示具体错误信息
|
||||
this.$message.error(response.data[0].msg || '物料验证失败!')
|
||||
} else {
|
||||
this.$message.error('物料更换失败!')
|
||||
}
|
||||
} else {
|
||||
this.$message.error('物料更换失败!')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 返修替换取消
|
||||
RepairManagementReplaceCancel(formName) {
|
||||
if (this.$refs[formName] !== undefined) {
|
||||
this.$refs[formName].resetFields()
|
||||
}
|
||||
this.RepairManagementReplaceDialogVisible = false
|
||||
},
|
||||
RepairManagementDestroy(row) {
|
||||
this.$confirm(`是否报废当前物料【${row.物料号}】【${row.零件名称}】?`, '物料报废', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const param = []
|
||||
param[0] = ['工位号', this.$store.state.station.stationName]
|
||||
param[1] = ['ID', row.ID]
|
||||
param[2] = ['追溯代码', row.追溯代码]
|
||||
param[3] = ['操作者', this.$store.state.user.name]
|
||||
param[4] = ['新物料条码', '']
|
||||
const Data = this.CreateData('12', '电子看板_装配零件_返修件_报废物料_编辑', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('物料报废成功!')
|
||||
this.getTable1(this.currentSelectRow)
|
||||
} else {
|
||||
this.$message.error('物料报废失败!')
|
||||
}
|
||||
} else {
|
||||
this.$message.error('物料报废失败!')
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消操作!'
|
||||
})
|
||||
})
|
||||
},
|
||||
RepairManagementReturnOp() {
|
||||
if (this.barcode === '') {
|
||||
this.$message.error('请先扫描条码!')
|
||||
return
|
||||
}
|
||||
this.$confirm(`剩余物料将返回线边库位?`, '物料返回', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const param = []
|
||||
param[0] = ['发动机号', this.barcode]
|
||||
param[1] = ['操作者', this.$store.state.user.name]
|
||||
const Data = this.CreateData('12', '电子看板_装配零件_返修件_报废物料_返回', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data.length > 0) {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('物料回仓成功!')
|
||||
this.getTable1(this.currentSelectRow)
|
||||
} else {
|
||||
this.$message.error('物料回仓失败!')
|
||||
}
|
||||
} else {
|
||||
this.$message.error('物料回仓失败!')
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消操作!'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
::v-deep.el-table .el-table__row .cell{
|
||||
line-height: 24px;
|
||||
font-size: 20px !important;
|
||||
}
|
||||
::v-deep.el-table .el-table__cell {
|
||||
padding: 11px 0;
|
||||
}
|
||||
::v-deep .el-table__column-filter-trigger {
|
||||
line-height: 24px;
|
||||
}
|
||||
::v-deep .el-tabs__item {
|
||||
padding: 0 32px !important;
|
||||
color: #005bac !important;
|
||||
}
|
||||
::v-deep.el-tabs__item.is-active {
|
||||
background-color: #005bac;
|
||||
}
|
||||
::v-deep.el-tabs--border-card>.el-tabs__header .el-tabs__item {
|
||||
font-size: 33px;
|
||||
font-weight: bolder;
|
||||
font-family: 等线, serif;
|
||||
width: 214px;
|
||||
height: 64px;
|
||||
line-height: 64px;
|
||||
border-top-left-radius: 8px;
|
||||
border-top-right-radius: 8px;
|
||||
border: 2px solid #0758bf !important;
|
||||
}
|
||||
::v-deep.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active {
|
||||
background-color: #005bac;
|
||||
color: #fff !important;
|
||||
font-weight: bolder;
|
||||
}
|
||||
</style>
|
||||
264
src/views/login.vue
Normal file
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="content">
|
||||
<div class="h01">离线返修</div>
|
||||
<div class="c_in">
|
||||
<el-input
|
||||
placeholder="账户"
|
||||
prefix-icon="el-icon-user"
|
||||
v-model="username"
|
||||
class="inp">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="c_in">
|
||||
<el-input
|
||||
placeholder="密码"
|
||||
prefix-icon="el-icon-lock"
|
||||
v-model="password"
|
||||
show-password
|
||||
class="inp">
|
||||
</el-input>
|
||||
</div>
|
||||
<el-button class="btn" :loading="loading" @click.native.prevent="signIn">登陆</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
export default {
|
||||
created() {
|
||||
console.log('login')
|
||||
this.$parent.showNav = true
|
||||
let _this = this
|
||||
this.setFontSize()
|
||||
window.onresize = function() {
|
||||
_this.setFontSize()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
localStorage.userInfo = ''
|
||||
localStorage.pdaId = ''
|
||||
this.showNav = false
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pda: '',
|
||||
pdaId: 'PDA_5X_CK2_KK',
|
||||
loading: 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 {
|
||||
this.loading = true
|
||||
const param = {
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '1',
|
||||
name: '菜单模块系统_用户名密码_查询数据_改造新增',
|
||||
param: `用户名=${this.username}&密码=${this.password}`
|
||||
}
|
||||
}
|
||||
request(param).then(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: auto;
|
||||
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;
|
||||
border: none;
|
||||
color: #000;
|
||||
font-size: 2.5rem;
|
||||
height: 2.5rem;
|
||||
line-height: 2.5rem;
|
||||
/deep/.el-input__icon {
|
||||
line-height: 1;
|
||||
font-size: 1.5rem;
|
||||
|
||||
}
|
||||
}
|
||||
/deep/.el-input .el-input__clear{
|
||||
font-size: 1.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 {
|
||||
//margin-left: -70px;
|
||||
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: 2.5rem;
|
||||
}
|
||||
|
||||
.content .btn {
|
||||
width: 26rem;
|
||||
margin-top: 3rem;
|
||||
border-style: none;
|
||||
outline: none;
|
||||
border-radius: 3rem;
|
||||
font-size: 2rem;
|
||||
background-color: #0128a9;
|
||||
cursor: pointer;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.content .h01 {
|
||||
color: #0128a9;
|
||||
font-weight: bold;
|
||||
font-size: 3.2rem;
|
||||
}
|
||||
|
||||
.content .h02 {
|
||||
color: #000;
|
||||
font-size: 1.4rem;
|
||||
padding-bottom: 2rem;
|
||||
}
|
||||
</style>
|
||||
117
src/views/main.vue
Normal file
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<van-row>
|
||||
<div style="margin-left: 50px;display: flex;align-items: center;">
|
||||
<van-icon name="friends-o" size="50" color="#1989fa" />
|
||||
<span style="font-size: 30px">{{userInfo.姓名}}</span>
|
||||
</div>
|
||||
|
||||
</van-row>
|
||||
<van-row>
|
||||
<van-col span="12">
|
||||
<van-button class="big-btn" type="info" @click="routeJump('ChangeMaterial')">
|
||||
<van-icon name="notes-o" size="60" color="#ffffff" />
|
||||
<br>
|
||||
<i>更换物料</i>
|
||||
</van-button>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
|
||||
<van-button class="big-btn" type="primary" @click="routeJump('ProductScrapping')">
|
||||
<van-icon name="records-o" size="60" color="#ffffff" />
|
||||
<br>
|
||||
<i>报废解体</i>
|
||||
</van-button>
|
||||
</van-col>
|
||||
</van-row>
|
||||
<van-row>
|
||||
<van-col span="12">
|
||||
<van-button class="big-btn" type="warning" @click="routeJump('RepairSearch')">
|
||||
<van-icon name="todo-list-o" size="60" color="#ffffff" />
|
||||
<br>
|
||||
<i>返修记录</i>
|
||||
</van-button>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<van-button class="big-btn" type="danger" @click="routeJump('')">
|
||||
<van-icon name="notes-o" size="60" color="#ffffff" />
|
||||
<br>
|
||||
<i>退出登录</i>
|
||||
</van-button>
|
||||
</van-col>
|
||||
</van-row>
|
||||
<!-- <van-row v-if="planCount !== 0">-->
|
||||
<!-- <div style="margin-left: 50px;display: flex;align-items: center;">-->
|
||||
<!-- <van-icon name="info-o" size="30" color="#1989fa" />-->
|
||||
<!-- <span style="font-size: 20px">消息提醒:</span>-->
|
||||
<!-- <span style="font-size: 20px">共有{{planCount}}待执行的计划,<a style="font-size: 25px;padding: 0 10px;color: #3a8ee6" @click="routeJump('CheckPlanExec')">前去执行</a></span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </van-row>-->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {getBeforeOrAfterTime, getNowTime2} from '../utils/tool'
|
||||
|
||||
export default {
|
||||
computed: {},
|
||||
components: {},
|
||||
watch: {},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
planCount: 0,
|
||||
pageCurrent: 1,
|
||||
pageSize: 10000,
|
||||
dateTime: [],
|
||||
userInfo: {
|
||||
姓名: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.dateTime = [getBeforeOrAfterTime(-30), getNowTime2()]
|
||||
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||
// this.fetchData()
|
||||
},
|
||||
mounted() {
|
||||
document.getElementById('topPageName').innerText = '首页'
|
||||
},
|
||||
methods: {
|
||||
routeJump(val){
|
||||
if (val.indexOf('/') !== -1) {
|
||||
val = val.substring(1)
|
||||
}
|
||||
this.$router.push({
|
||||
path: '/' + val
|
||||
})
|
||||
},
|
||||
fetchData() {
|
||||
var param = []
|
||||
param[0] = ['开始日期', this.dateTime[0]]
|
||||
param[1] = ['结束日期', this.dateTime[1]]
|
||||
param[2] = ['检验员id', this.userInfo['人员编号']]
|
||||
param[3] = ['PageCurrent', this.pageCurrent]
|
||||
param[4] = ['PageSize', this.pageSize]
|
||||
param[5] = ['PageCount', 1000, 'int', '1']
|
||||
param[6] = ['ItemCount', 1000, 'int', '1']
|
||||
var Data = this.CreateData('11', '质检_工单_未完成_查询', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
this.planCount = parseInt(response.data.output[0].ItemCount)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.main {
|
||||
margin-top: 60px;
|
||||
}
|
||||
.big-btn {
|
||||
margin: 20px 30px;
|
||||
height: 250px;
|
||||
width: 85%;
|
||||
font-size: 3rem;
|
||||
}
|
||||
</style>
|
||||
0
static/.gitkeep
Normal file
BIN
static/2质检项维护.png
Normal file
|
After Width: | Height: | Size: 75 KiB |
BIN
static/catl.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
8
static/config.js
Normal file
@@ -0,0 +1,8 @@
|
||||
window.dt_Config = {
|
||||
// requestConfig: `http://192.168.43.124:20021/submit/MESCommonBase.ashx`,
|
||||
// requestConfig: `http://192.168.10.3:10000/submit/MESCommonBase.ashx`,
|
||||
// requestConfig: `http://192.168.10.205:20021/submit/MESCommonBase.ashx`,
|
||||
requestConfig: `http://127.0.0.1:10170/submit/MESCommonBase.ashx`,
|
||||
// mqttUrl: '192.168.10.3'
|
||||
mqttUrl: '127.0.0.1'
|
||||
}
|
||||
BIN
static/favicon.ico
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
27
test/e2e/custom-assertions/elementCount.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// A custom Nightwatch assertion.
|
||||
// The assertion name is the filename.
|
||||
// Example usage:
|
||||
//
|
||||
// browser.assert.elementCount(selector, count)
|
||||
//
|
||||
// For more information on custom assertions see:
|
||||
// http://nightwatchjs.org/guide#writing-custom-assertions
|
||||
|
||||
exports.assertion = function (selector, count) {
|
||||
this.message = 'Testing if element <' + selector + '> has count: ' + count
|
||||
this.expected = count
|
||||
this.pass = function (val) {
|
||||
return val === this.expected
|
||||
}
|
||||
this.value = function (res) {
|
||||
return res.value
|
||||
}
|
||||
this.command = function (cb) {
|
||||
var self = this
|
||||
return this.api.execute(function (selector) {
|
||||
return document.querySelectorAll(selector).length
|
||||
}, [selector], function (res) {
|
||||
cb.call(self, res)
|
||||
})
|
||||
}
|
||||
}
|
||||
46
test/e2e/nightwatch.conf.js
Normal file
@@ -0,0 +1,46 @@
|
||||
require('babel-register')
|
||||
var config = require('../../config')
|
||||
|
||||
// http://nightwatchjs.org/gettingstarted#settings-file
|
||||
module.exports = {
|
||||
src_folders: ['test/e2e/specs'],
|
||||
output_folder: 'test/e2e/reports',
|
||||
custom_assertions_path: ['test/e2e/custom-assertions'],
|
||||
|
||||
selenium: {
|
||||
start_process: true,
|
||||
server_path: require('selenium-server').path,
|
||||
host: '127.0.0.1',
|
||||
port: 4444,
|
||||
cli_args: {
|
||||
'webdriver.chrome.driver': require('chromedriver').path
|
||||
}
|
||||
},
|
||||
|
||||
test_settings: {
|
||||
default: {
|
||||
selenium_port: 4444,
|
||||
selenium_host: 'localhost',
|
||||
silent: true,
|
||||
globals: {
|
||||
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
|
||||
}
|
||||
},
|
||||
|
||||
chrome: {
|
||||
desiredCapabilities: {
|
||||
browserName: 'chrome',
|
||||
javascriptEnabled: true,
|
||||
acceptSslCerts: true
|
||||
}
|
||||
},
|
||||
|
||||
firefox: {
|
||||
desiredCapabilities: {
|
||||
browserName: 'firefox',
|
||||
javascriptEnabled: true,
|
||||
acceptSslCerts: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
48
test/e2e/runner.js
Normal file
@@ -0,0 +1,48 @@
|
||||
// 1. start the dev server using production config
|
||||
process.env.NODE_ENV = 'testing'
|
||||
|
||||
const webpack = require('webpack')
|
||||
const DevServer = require('webpack-dev-server')
|
||||
|
||||
const webpackConfig = require('../../build/webpack.prod.conf')
|
||||
const devConfigPromise = require('../../build/webpack.dev.conf')
|
||||
|
||||
let server
|
||||
|
||||
devConfigPromise.then(devConfig => {
|
||||
const devServerOptions = devConfig.devServer
|
||||
const compiler = webpack(webpackConfig)
|
||||
server = new DevServer(compiler, devServerOptions)
|
||||
const port = devServerOptions.port
|
||||
const host = devServerOptions.host
|
||||
return server.listen(port, host)
|
||||
})
|
||||
.then(() => {
|
||||
// 2. run the nightwatch test suite against it
|
||||
// to run in additional browsers:
|
||||
// 1. add an entry in test/e2e/nightwatch.conf.js under "test_settings"
|
||||
// 2. add it to the --env flag below
|
||||
// or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
|
||||
// For more information on Nightwatch's config file, see
|
||||
// http://nightwatchjs.org/guide#settings-file
|
||||
let opts = process.argv.slice(2)
|
||||
if (opts.indexOf('--config') === -1) {
|
||||
opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
|
||||
}
|
||||
if (opts.indexOf('--env') === -1) {
|
||||
opts = opts.concat(['--env', 'chrome'])
|
||||
}
|
||||
|
||||
const spawn = require('cross-spawn')
|
||||
const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
|
||||
|
||||
runner.on('exit', function (code) {
|
||||
server.close()
|
||||
process.exit(code)
|
||||
})
|
||||
|
||||
runner.on('error', function (err) {
|
||||
server.close()
|
||||
throw err
|
||||
})
|
||||
})
|
||||
19
test/e2e/specs/test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// For authoring Nightwatch tests, see
|
||||
// http://nightwatchjs.org/guide#usage
|
||||
|
||||
module.exports = {
|
||||
'default e2e tests': function (browser) {
|
||||
// automatically uses dev Server port from /config.index.js
|
||||
// default: http://localhost:8080
|
||||
// see nightwatch.conf.js
|
||||
const devServer = browser.globals.devServerURL
|
||||
|
||||
browser
|
||||
.url(devServer)
|
||||
.waitForElementVisible('#app', 5000)
|
||||
.assert.elementPresent('.hello')
|
||||
.assert.containsText('h1', 'Welcome to Your Vue.js App')
|
||||
.assert.elementCount('img', 1)
|
||||
.end()
|
||||
}
|
||||
}
|
||||
7
test/unit/.eslintrc
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"env": {
|
||||
"jest": true
|
||||
},
|
||||
"globals": {
|
||||
}
|
||||
}
|
||||
30
test/unit/jest.conf.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
rootDir: path.resolve(__dirname, '../../'),
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'json',
|
||||
'vue'
|
||||
],
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1'
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
|
||||
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
|
||||
},
|
||||
testPathIgnorePatterns: [
|
||||
'<rootDir>/test/e2e'
|
||||
],
|
||||
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
|
||||
setupFiles: ['<rootDir>/test/unit/setup'],
|
||||
mapCoverage: true,
|
||||
coverageDirectory: '<rootDir>/test/unit/coverage',
|
||||
collectCoverageFrom: [
|
||||
'src/**/*.{js,vue}',
|
||||
'!src/main.js',
|
||||
'!src/router/index.js',
|
||||
'!**/node_modules/**'
|
||||
]
|
||||
}
|
||||
3
test/unit/setup.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
11
test/unit/specs/HelloWorld.spec.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import Vue from 'vue'
|
||||
import HelloWorld from '@/components/HelloWorld'
|
||||
|
||||
describe('HelloWorld.vue', () => {
|
||||
it('should render correct contents', () => {
|
||||
const Constructor = Vue.extend(HelloWorld)
|
||||
const vm = new Constructor().$mount()
|
||||
expect(vm.$el.querySelector('.hello h1').textContent)
|
||||
.toEqual('Welcome to Your Vue.js App')
|
||||
})
|
||||
})
|
||||