init: CATL电池线质量检验APP首次入库

This commit is contained in:
XingCheng3
2026-06-08 17:11:44 +08:00
commit b5914d0ad1
72 changed files with 46833 additions and 0 deletions

18
.babelrc Normal file
View File

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

9
.editorconfig Normal file
View File

@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

7
.eslintignore Normal file
View File

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

29
.eslintrc.js Normal file
View File

@@ -0,0 +1,29 @@
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
// required to lint *.vue files
plugins: [
'vue'
],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}

20
.gitignore vendored Normal file
View 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
View File

@@ -0,0 +1,10 @@
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}

30
README.md Normal file
View File

@@ -0,0 +1,30 @@
# slapk
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
# run unit tests
npm run unit
# run e2e tests
npm run e2e
# run all tests
npm test
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

41
build/build.js Normal file
View File

@@ -0,0 +1,41 @@
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})

54
build/check-versions.js Normal file
View File

@@ -0,0 +1,54 @@
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}

BIN
build/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

101
build/utils.js Normal file
View File

@@ -0,0 +1,101 @@
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')
exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}
exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
return (severity, errors) => {
if (severity !== 'error') return
const error = errors[0]
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}

22
build/vue-loader.conf.js Normal file
View File

@@ -0,0 +1,22 @@
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}

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

@@ -0,0 +1,106 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve(dir) {
return path.join(__dirname, '..', dir)
}
const createLintingRule = () => ({
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter'),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
})
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production' ?
config.build.assetsPublicPath :
config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
},
module: {
rules: [
// ...(config.dev.useEslint ? [createLintingRule()] : []),
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
// limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
// limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
},
// {
// test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
// loader: 'url-loader',
// options: {
// limit: 10000,
// name: '[name].[hash:7].[ext]',
// publicPath: '../fonts/',
// outputPath: utils.assetsPath('fonts/')
// }
// },
{
test: /\.less$/,
loader: 'style-loader!css-loader!less-loader'
},
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}

95
build/webpack.dev.conf.js Normal file
View File

@@ -0,0 +1,95 @@
'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,
// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port
portfinder.getPort((err, port) => {
if (err) {
reject(err)
} else {
// publish the new Port, necessary for e2e tests
process.env.PORT = port
// add port to devServer config
devWebpackConfig.devServer.port = port
// Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [`PDAYour application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
},
onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback()
: undefined
}))
resolve(devWebpackConfig)
}
})
})

149
build/webpack.prod.conf.js Normal file
View File

@@ -0,0 +1,149 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = process.env.NODE_ENV === 'testing'
? require('../config/test.env')
: require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: process.env.NODE_ENV === 'testing'
? 'index.html'
: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig

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

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

79
config/index.js Normal file
View 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
View File

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

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

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

30
index.html Normal file
View File

@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html style="font-size: 10px;">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel ="shortcut icon" type="image/x-icon" href="static/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

File diff suppressed because it is too large Load Diff

89
package.json Normal file
View 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
View 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>

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

BIN
src/assets/key.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
src/assets/loginOff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

BIN
src/assets/peo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

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

View File

@@ -0,0 +1,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>

View File

@@ -0,0 +1,14 @@
<template>
<div id="tab-bar">
<slot></slot>
</div>
</template>
<script>
export default {
name:'TabBar'
}
</script>
<style>
</style>

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

View File

@@ -0,0 +1,49 @@
<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>
</top-bar>
<div style="position: absolute;right: 5px;top: 2px">
<van-button icon="home-o" style="background-color: #a5a5a5" @click="routeJump('main')"></van-button>
</div>
</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>

View File

@@ -0,0 +1,14 @@
<template>
<div id="top-bar">
<slot></slot>
</div>
</template>
<script>
export default {
name:'TopBar'
}
</script>
<style>
</style>

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

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

@@ -0,0 +1,81 @@
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: '/CheckPlanCreate',
name: 'CheckPlanCreate',
meta: {
keepAlive: true
},
component: () => import('@/views/ProductionCheck/CheckPlanCreate/index.vue')
},
{
path: '/CheckPlanExec',
name: 'CheckPlanExec',
meta: {
keepAlive: true
},
component: () => import('@/views/ProductionCheck/CheckPlanExec/index.vue')
},
{
path: '/CheckPlanSearch',
name: 'CheckPlanSearch',
meta: {
keepAlive: true
},
component: () => import('@/views/ProductionCheck/CheckPlanSearch/index.vue')
},
{
path: '/OccCreate',
name: 'OccCreate',
meta: {
keepAlive: true
},
component: () => import('@/views/ProductionCheck/OccCreate/index.vue')
},
{
path: '/OccSearch',
name: 'OccSearch',
meta: {
keepAlive: true
},
component: () => import('@/views/ProductionCheck/OccSearch/index.vue')
},
{
path: '/ProblemDeclarationSolve',
name: 'ProblemDeclarationSolve',
meta: {
keepAlive: true
},
component: () => import('@/views/ProductionCheck/ProblemDeclarationSolve/index.vue')
}
]
})

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -0,0 +1,434 @@
import request from '@/utils/request'
// 传通讯服务器参数
export default {
install (Vue) {
// 用于生成传通讯服务器参数。
// 传入参数
// 1type11查询12增删改必须
// 2name存储过程名必须
// 3data存储过程参数名和对应值例如
// param[0] = ['设备类型编码', '3', 'string', '0']
// param[1] = ['output', '3', 'int', '1'],必须
// 数组里四个分别对应存储过程参数名必须存储过程参数值必须参数类型若是output必须参数是否为output0否1是
// 4pageSizepageList分页使用可选
// 旧通讯格式
Vue.prototype.CreateData1 = function (type, name, data, pageSize, pageList) {
var paramStr = ''
var paramarray = []
if (type === '7') {
data.map(v => {
pageSize.map(h => {
const val = h.toString()
if (!v[val]) {
this.$set(v, val, '')
}
})
})
paramStr = data
} else {
if (data !== undefined) {
for (let i = 0; i < data.length; i++) {
paramarray.push({
name: data[i][0],
value: data[i][1],
type: data[i][2],
output: data[i][3]
})
}
paramStr = JSON.stringify(paramarray)
}
}
var obj = []
obj[0] = {}
obj[0].type = type
obj[0].name = name
obj[0].param = paramStr
obj[0].pageSize = pageSize
obj[0].pageList = pageList
var numn = JSON.stringify(obj[0])
return numn
}
// 新通讯格式
Vue.prototype.CreateData = (cmd, tbname, fieldshow, other) => {
const Param = JSON.stringify({
cmd,
tbname,
fieldshow,
...other
})
const data = {
type: 3001,
Param,
Name: '',
Pagination: '',
UserID: '',
HasReturn: false
}
return JSON.stringify(data)
}
// 新通讯11/12---<
Vue.prototype.ExecDatabase = function (num) {
return request({
url: '',
method: 'post',
data: num
})
}
// 设置字段宽度
Vue.prototype.setColumnWidth = function (str) {
let columnWidth = 0
if (str === '日期') {
columnWidth = 100
} else if (str === '工单号' || str === '产品名称') {
columnWidth = 160
} else if (str === '规则型号' || str === '产品编号') {
columnWidth = 150
} else if (str === '大数') {
columnWidth = 110
} else if (str === '状态') {
columnWidth = 100
} else if (str === '序号') {
columnWidth = 60
} else if (str === '单位') {
columnWidth = 60
} else if (str === '数量' || str === '库存') {
columnWidth = 80
} else if (str === '单价') {
columnWidth = 90
} else if (str === '金额') {
columnWidth = 120
} else if (str === '状态' || str === '类型' || str === '选入' || str === '选出') {
columnWidth = 80
} else if (str === '付款方式') {
columnWidth = 100
} else if (str === '买方' || str === '买方名称') {
columnWidth = 150
} else if (str === '外协厂家' || str === '调入仓库' || str === '调出仓库') {
columnWidth = 150
} else if (str === '姓名') {
columnWidth = 80
} else if (str === '日期时间') {
columnWidth = 140
} else if (str === '工序') {
columnWidth = 80
} else if (str === '物料名称' || str === '工件名称' || str === '零件名称') {
columnWidth = 140
} else if (str === '图号或型号' || str === '规格' || str === '零件图号' || str === '图号' || str === '图号/型号') {
columnWidth = 120
} else if (str === '物料编码' || str === '物料编号') {
columnWidth = 120
} else if (str === '材料') {
columnWidth = 80
} else if (str === '仓位' || str === '库位') {
columnWidth = 90
} else if (str === '品名/规格/型号') {
columnWidth = 140
} else if (str === '备注') {
columnWidth = 120
} else if (str === '工序名称') {
columnWidth = 150
} else if (str === '工序说明') {
columnWidth = 300
} else if (str === '加工工时M' || str === '加工时长H' || str === '加工时长M') {
columnWidth = 90
} else if (str === '加工设备') {
columnWidth = 130
} else if (str === '产品详情' || str === '详情') {
columnWidth = 340
} else if (str === '最低库存') {
columnWidth = 110
} else if (str === '本次到货数' || str === '本次入库' || str === '补货数') {
columnWidth = 100
} else {
columnWidth = 110
}
return columnWidth
}
}
}
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
}
/**
* Base64字符串转File文件
* @param {String} dataurl Base64字符串(字符串包含Data URI scheme例如data:image/png;base64, )
* @param {String} filename 文件名称
*/
export function dataURLtoFile(dataurl, filename) {
const arr = dataurl.split(',')
const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1])
let n = bstr.length
const u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], filename, {
type: mime
})
}
export function base64ImgtoFile(dataurl, filename = 'file', suffix) {
// 将base64格式分割['data:image/png;base64','XXXX']
// const arr = dataurl.split(',')
// // .* 表示匹配任意字符到下一个符合条件的字符 刚好匹配到:
// // image/png
// const mime = arr[0].match(/:(.*?);/)[1] // image/png
// // [image,png] 获取图片类型后缀
// const suffix = mime.split('/')[1] // png
const bstr = atob(dataurl) // atob() 方法用于解码使用 base-64 编码的字符串
let n = bstr.length
const u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], `${filename}.${suffix}`)
}
export function base64ToPdfUrl(content, type, fileName) {
const bstr = atob(content)
let n = bstr.length
const u8arr = new Uint8Array(n)
while (n--) { u8arr[n] = bstr.charCodeAt(n) }
// 确定解析格式可能可以变成img没有深入研究
const blob = new Blob([u8arr], { type: 'application/pdf;chartset=UTF-8' })
return window.URL.createObjectURL(blob)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,545 @@
<template>
<div class="app-container">
<el-card style="">
<el-row>
<div style="display: flex;margin-bottom: 20px">
<van-field v-model="dateTimeShowInfo" left-icon="clock-o" style="width: 220px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" readonly @focus="forbid;dateTimeShow=!dateTimeShow" />
<!-- <van-calendar v-model="dateTimeShow" :min-date="new Date(2000,1,1)" :default-date="dateTimeDefault" type="range" @confirm="confirmFnDate" />-->
<van-calendar v-model="dateTimeShow" :min-date="minDate" :max-date="maxDate" :default-date="dateTimeDefault" type="range" @confirm="confirmFnDate" />
<!-- <el-select v-model="statusNumberValue" placeholder="状态" size="medium" style="margin-left:10px;width:120px" @change="fetchData">-->
<!-- <el-option-->
<!-- v-for="item in statusNumber"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"/>-->
<!-- </el-select>-->
<el-button type="warning" icon="el-icon-search" size="small" style="margin-left: 20px;" @click="fetchData()">查询</el-button>
</div>
</el-row>
<el-row style="overflow: auto;height: 700px">
<van-list
v-model="loading_checkOrder"
:finished="true"
finished-text="没有更多了"
>
<van-cell v-for="(item,index) in tableData" :key="index">
<van-card class="s-card">
<template #tags>
<van-row style="font-size: 1.5rem">
<van-tag type="primary" size="large" @click="CheckOrder_rowClick(item)">{{item.质检数量}}</van-tag>
<van-tag v-if="item.状态 === 4 && item.是否合格 === 1" size="large" type="success">OK</van-tag>
<van-tag v-if="item.状态 === 4 && item.是否合格 === 2" size="large" type="danger">NOK</van-tag>
<van-tag v-if="item.状态 === 1" size="large" style="float: right" type="danger">未下发</van-tag>
<van-tag v-if="item.状态 === 2" size="large" style="float: right" type="primary">已下发</van-tag>
<van-tag v-if="item.状态 === 3" size="large" style="float: right" type="warning">质检中</van-tag>
<van-tag v-if="item.状态 === 4" size="large" style="float: right" type="success">已完成</van-tag>
</van-row>
<van-row style="font-size: 1.3rem">
<div style="margin: 10px 10px 0 0;">
<van-icon name="todo-list-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="contact-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-row>
</template>
</van-card>
</van-cell>
</van-list>
</el-row>
<el-row style="position: absolute;left: 0;bottom: 10px;width: 100%;background: #e7e7e7;">
<van-pagination
v-model="pageCurrent"
:total-items="totalNum"
:items-per-page="pageSize"
force-ellipses
@change="handleCurrentChange"
/>
</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">检查项目详情{{tableData_content.length}}</div>
<!-- 可滚动的内容区域 -->
<div class="scrollable-content">
<van-list
v-model="loading_checkOrder_content"
:finished="finished_checkOrder_content"
>
<van-cell v-for="(item,index) in tableData_content" :key="index">
<van-card class="s-card">
<template #tags>
<van-row style="font-size: 1.5rem">
<van-tag v-if="item['状态'] === 0" type="danger" size="large">{{index + 1}}.未检</van-tag>
<van-tag v-if="item['状态'] === 1" type="success" size="large">{{index + 1}}.已检</van-tag>
<van-tag v-if="item.项目类型 === '定性'" type="primary" size="large">{{item.项目类型}}{{item.检查数量}}</van-tag>
<van-tag v-if="item.项目类型 === '定量'"type="warning" size="large">{{item.项目类型}}{{item.检查数量}}</van-tag>
</van-row>
<van-row style="font-size: 1.3rem">
<van-col span="24">
<div style="margin: 10px 10px 0 0;">
<van-icon name="star-o" color="#1989fa"/>
<span>项目</span>
<span> {{item.检查项目}}</span>
</div>
</van-col>
<!-- <van-col span="8" v-if="item.指导图片数量 > 0">-->
<!-- <div style="margin: 10px 10px 0 0;">-->
<!-- <van-icon name="photo-o" color="#1989fa"/>-->
<!-- <span>指导图片</span>-->
<!-- <el-link type="primary">{{item.指导图片数量}}</el-link>-->
<!-- </div>-->
<!-- </van-col>-->
</van-row>
<van-row style="font-size: 1.3rem">
<div style="margin: 10px 10px 0 0;">
<van-icon name="coupon-o" color="#1989fa"/>
<span>内容</span>
<span> {{item.检查内容}}</span>
</div>
</van-row>
<van-row style="font-size: 1.3rem">
<van-col span="24">
<div style="margin: 10px 10px 0 0;">
<van-icon name="font-o" color="#1989fa"/>
<span>工具</span>
<span>{{item.检查工具编号1}}{{item.检查工具名称}}</span>
</div>
</van-col>
</van-row>
<van-row style="font-size: 1.3rem">
<van-col span="12">
<div style="margin: 10px 10px 0 0;">
<van-icon name="setting-o" color="#1989fa"/>
<span>方法</span>
<span>{{item.检查方法名称}}</span>
</div>
</van-col>
<van-col v-if="item.项目类型 === '定量'" span="6">
<div style="margin: 10px 10px 0 0;">
<van-icon name="arrow-up" color="#1989fa"/>
<span>上限</span>
{{item.上限}}
</div>
</van-col>
<van-col v-if="item.项目类型 === '定量'" span="6">
<div style="margin: 10px 10px 0 0;">
<van-icon name="arrow-down" color="#1989fa"/>
<span>下限</span>
{{item.下限}}
</div>
</van-col>
</van-row>
<!-- <van-row style="font-size: 1.3rem">-->
<!-- <div style="margin: 10px 10px 0 0;">-->
<!-- <van-icon name="comment-o" color="#1989fa"/>-->
<!-- <span>备注</span>-->
<!-- <span>{{item.原始备注 }}</span>-->
<!-- </div>-->
<!-- </van-row>-->
<van-divider>检查结果</van-divider>
<!-- <van-row style="font-size: 1.3rem">-->
<!-- <van-field-->
<!-- v-model="item.产品编号"-->
<!-- label="产品编号"-->
<!-- readonly-->
<!-- placeholder="产品编号"-->
<!-- style="margin: 1px 0"-->
<!-- />-->
<!-- </van-row>-->
<van-row v-if="item.项目类型 === '定性'" style="font-size: 1.3rem;display: flex;align-items: center;">
<van-col span="24" style="pointer-events: none;">
<div v-for="(item1, index1) in item.children" style="display: flex;align-items: center;margin: 1px 0">
<van-col span="15" style="margin: 1px 0">
<van-field
v-model="item1.产品编号"
readonly
left-icon="scan"
placeholder=""
style="width: 95%"
/>
</van-col>
<van-col span="9" style="margin: 1px 0">
<div style="display: flex;">
<van-tag v-if="item1.是否合格 === 1" type="success" size="large" style="width: 35px;display: flex;justify-content: center;">OK</van-tag>
<van-tag v-else-if="item1.是否合格 === 2" type="danger" size="large" style="width: 35px;display: flex;justify-content: center;">NOK</van-tag>
<van-tag v-else size="large" color="#909399" text-color="#ffffff" style="width: 35px;display: flex;justify-content: center;">&nbsp;</van-tag>
</div>
</van-col>
</div>
</van-col>
</van-row>
<van-row v-if="item.项目类型 === '定量'" style="font-size: 1.3rem;">
<div v-for="(item1, index1) in item.children" style="display: flex;align-items: center;">
<van-col span="15" style="pointer-events: none;margin: 1px 0">
<van-field
v-model="item1.产品编号"
readonly
style="width: 95%"
left-icon="scan"
/>
</van-col>
<van-col span="7" style="margin: 1px 0">
<van-field
v-model="item1.测量值"
:label="(index1 + 1)"
name="checkOrderValue"
label-width="2rem"
readonly
placeholder="检验值"
/>
</van-col>
<van-col span="2" style="pointer-events: none;">
<van-tag v-if="item1.是否合格 === 1" type="success" size="large" style="width: 35px;display: flex;justify-content: center;">OK</van-tag>
<van-tag v-else-if="item1.是否合格 === 2" type="danger" size="large" style="width: 35px;display: flex;justify-content: center;">NOK</van-tag>
<van-tag v-else size="large" color="#909399" text-color="#ffffff" style="width: 35px;display: flex;justify-content: center;">&nbsp;</van-tag>
</van-col>
</div>
</van-row>
<van-row style="font-size: 1.3rem;display: flex;align-items: center;">
<van-col span="15">
<van-field
v-model="item.备注"
label="备注"
readonly
style="width: 95%;margin: 1px 0"
/>
</van-col>
<van-col span="9">
<el-button v-if="item.上传图片数量 > 0" type="primary" size="small" @click="getGuidePic1(item)">查看图片({{item.上传图片数量}})</el-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>
</div>
</div>
</van-dialog>
<van-dialog
v-model="showTableData_content_exchange2"
width="70%"
: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">图片查看</div>
<!-- 可滚动的内容区域 -->
<div class="scrollable-content">
<van-list :finished="true">
<van-cell v-for="(item,index) in RepairManagementDataTableOrigin" :key="index">
<el-row v-if="/(jpg|jpeg|png|GIF|JPG|PNG)$/i.test(item.附件类型)">
{{index + 1}}<el-link type="primary" @click="showPic(item)" class="noShowAllText">{{item.附件名称}}.{{item.附件类型 }}</el-link>
</el-row>
<el-row v-else>
{{index + 1}}{{item.附件名称}}.{{item.附件类型 }}
</el-row>
</van-cell>
</van-list>
</div>
<!-- 固定底部的内容 -->
<div class="dialog-footer">
<van-button size="small" style="width: 100%" @click="showTableData_content_exchange2=false">关闭</van-button>
</div>
</div>
</van-dialog>
</el-card>
</div>
</template>
<script>
import {base64ImgtoFile, formatDate, getBeforeOrAfterTime, getNowTime2} from '../../../utils/tool'
import {ImagePreview, Toast} from 'vant'
export default {
data() {
return {
userInfo: {},
minDate: null,
maxDate: null,
statusNumberValue: 4,
statusNumber: [
{
value: 0,
label: '全部'
},
{
value: 1,
label: '未下发'
},
{
value: 2,
label: '已下发'
},
{
value: 3,
label: '质检中'
},
{
value: 4,
label: '已完成'
}
],
dateTime: [],
dateTimeDefault: [],
dateTimeShowInfo: '',
dateTimeShow: false,
loading_checkOrder: false,
finished_checkOrder: true,
tableData: [],
tableData_content: [],
showTableData_content: false,
loading_checkOrder_content: true,
finished_checkOrder_content: true,
currentSelectCheckOrder: {},
currentSelectCheckOrderContent: {},
RepairManagementReplaceForm: {
ID: ''
},
dialogFormVisible_addCheckOrder_content_show: false,
showTableData_content_exchange: false,
showTableData_content_exchange2: false,
RepairManagementDataTableOrigin: [],
imageType: ['bmp', 'jpg', 'png', 'gif'],
pdfType: ['pdf'],
currentPage: 1,
pageSize: 10,
pageCurrent: 1,
totalNum: null
}
},
watch: {},
created() {
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
// 获取今日日期
const today = new Date();
this.minDate = new Date(today.getFullYear(), today.getMonth() - 1, today.getDate());
this.maxDate = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
console.log('CheckPlanSearch')
this.$parent.showNav = true
this.dateTime = [getBeforeOrAfterTime(-30), getNowTime2()]
this.dateTimeShowInfo = this.dateTime[0] + ' ~ ' + this.dateTime[1]
this.dateTimeDefault = [new Date(getBeforeOrAfterTime(-7)), new Date(getNowTime2())]
this.fetchData()
},
mounted () {
document.getElementById('topPageName').innerText = '检验历史'
},
methods: {
forbid(){
//禁止软键盘弹出
document.activeElement.blur();
},
confirmFnDate(date) {
this.dateTimeShow = false
this.dateTime=[formatDate(date[0]), formatDate(date[1])]
this.dateTimeShowInfo= this.dateTime[0] + ' ~ ' + this.dateTime[1]
this.fetchData()
},
fetchData() {
this.listLoading = true
const statusNumber = this.statusNumberValue === 0 ? 0 : 1
var param = []
param[0] = ['开始日期', this.dateTime[0]]
param[1] = ['结束日期', this.dateTime[1]]
param[2] = ['状态', this.statusNumberValue]
param[3] = ['状态_ischeck', statusNumber]
param[4] = ['PageCurrent', this.pageCurrent]
param[5] = ['PageSize', this.pageSize]
param[6] = ['PageCount', 1000, 'int', '1']
param[7] = ['ItemCount', 1000, 'int', '1']
param[8] = ['日期_ischeck', 1]
param[9] = ['部门id', this.userInfo['考核部门编号']]
var Data = this.CreateData('11', '质检_工单_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.result
this.totalNum = parseInt(response.data.output[0].ItemCount)
this.listLoading = false
}).catch(er => {
this.listLoading = false
this.$message.error('错误')
})
},
CheckOrder_rowClick(row) {
this.currentSelectCheckOrder = row
this.showTableData_content = true
this.fetchData_content(row)
},
fetchData_content(row) {
var param = []
param[0] = ['质检单号', row.质检单号]
var Data = this.CreateData('11', '质检_工单检查内容_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableData_content = []
const tableData_content1 = {}
for (let i = 0; i < response.data.length; i++) {
if(Object.prototype.hasOwnProperty.call(tableData_content1, response.data[i]['ID'])) {
tableData_content1[response.data[i]['ID']]['children'].push({
ID: response.data[i]['测量值id'],
测量值: response.data[i]['测量值'],
产品编号: response.data[i]['产品编号1'],
是否合格: response.data[i]['是否合格1'],
状态: response.data[i]['测量值状态'],
})
} else {
tableData_content1[response.data[i]['ID']] = { ...{children: [{
ID: response.data[i]['测量值id'],
测量值: response.data[i]['测量值'],
产品编号: response.data[i]['产品编号1'],
是否合格: response.data[i]['是否合格1'],
状态: response.data[i]['测量值状态'],
}]}, ...response.data[i], }
}
}
for (const [key, value] of Object.entries(tableData_content1) ) {
this.tableData_content.push(value)
if(value.状态 === 1) this.tableData_contentFinish++
}
}).catch(er => {
this.$message.error('错误')
})
},
getGuidePic1(item) {
this.RepairManagementReplaceForm.ID = item.ID
const param = []
param[0] = ['检查项id', item.ID]
const Data = this.CreateData('11', '质检_质检单_详细内容_图片_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length > 0) {
for (let i = 0; i < response.data.length; i++) {
if (this.imageType.indexOf(response.data[i]['附件类型'].toLowerCase()) !== -1) {
response.data[i]['url'] = window.URL.createObjectURL(base64ImgtoFile(response.data[i]['附件内容'], response.data[i]['附件名称'], response.data[i]['附件类型']))
} else {
response.data[i]['url'] = window.URL.createObjectURL(base64ImgtoFile(response.data[i]['附件内容'], response.data[i]['附件名称'], response.data[i]['附件类型']))
}
}
this.RepairManagementDataTableOrigin = response.data
this.showTableData_content_exchange2 = true
} else {
this.RepairManagementDataTableOrigin = []
Toast.fail('暂无图片!')
}
})
},
showPic(item) {
ImagePreview({
images: [
item.url
]
});
},
// 分页功能改变显示数量
onLoad(){
this.loading_checkOrder = true
this.pageCurrent++
this.fetchData()
},
handleSizeChange(val) {
this.pageSize = val
this.fetchData()
},
// 分页功能改变当前页
handleCurrentChange(val) {
this.pageCurrent = val
this.fetchData()
}
}
}
</script>
<style scoped>
.app-container{
margin-top: 50px;
}
.check-Content-Name {
font-size: 14px;
line-height: 30px;
}
.check-Content-Value {
font-size: 14px;
font-weight: bolder;
line-height: 30px;
}
.xin-main{
position: relative;
height: 100%;
overflow: hidden;
}
.xin-content{
overflow-y: scroll;
box-sizing: border-box;
overflow-x: hidden;
}
.xin-footer {
text-align: center;
margin: 20px;
}
.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>

View File

@@ -0,0 +1,397 @@
<template>
<div class="app-container">
<van-card class="s-card" style="height: 100vh;margin: 10px">
<template #tags>
<van-form @submit="RepairManagementReplaceSubmit" ref="occCreateForm">
<van-field
v-model="occCreateForm.productCode"
ref="occCreateFormProductCode"
name="产品编号"
label="产品编号"
clearable
right-icon="scan"
required
placeholder="请输入/扫描产品编号"
:rules="[{ required: true, message: '请输入/扫描产品编号' }]"
/>
<van-field
v-model="occCreateForm.remake"
rows="4"
autosize
required
clearable
label="缺陷描述"
type="textarea"
placeholder="请输入缺陷描述"
/>
<div style="margin: 16px;">
<van-button round block type="info" native-type="submit">提交</van-button>
</div>
</van-form>
</template>
</van-card>
<!-- 问题选择项目选择-->
<van-popup v-model="dialogFormVisible_CheckContent" position="bottom">
<van-tree-select
:items="stationNumber"
:main-active-index.sync="activeIndex"
@click-nav="addCheckOrder_content_stationNumber_Click"
@click-item="addCheckOrder_content_stationNumber_Click_sure"
/>
</van-popup>
</div>
</template>
<script>
import {Dialog, Toast} from 'vant'
export default {
name: 'OccCreate',
data() {
return {
occCreateForm: {
productCode: '',
opCode: '',
problem: '',
problemId: '',
remake: ''
},
dialogFormVisible_selectStation: false,
dialogFormVisible_selectProgram: false,
stationNumber: [],
stationNumber1: [],
dialogFormVisible_CheckContent: false,
activeIndex: 0,
CheckContentBase: [],
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,
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 = localStorage.getItem('userInfo') === '' ? {} : JSON.parse(localStorage.getItem('userInfo'))
console.log(this.userInfo)
this.getStationNumber()
this.searchCheckContentBase('')
},
mounted() {
document.getElementById('topPageName').innerText = '缺陷记录'
this.$refs.occCreateFormProductCode.focus()
},
methods: {
getStationNumber() {
this.stationNumber = []
this.stationNumber1 = []
var param = []
var Data = this.CreateData('11', 'MES_计划BOM_工位与名称_查询', param)
this.ExecDatabase(Data).then(response => {
this.stationNumber.push({
label: '无工位选项',
value: '',
// id: response.data[i].工位号,
text: '无工位选项',
children: [],
labelName: '无工位选项'
})
this.stationNumber1.push('无工位选项')
for (let i = 0; i < response.data.length; i++) {
this.stationNumber.push({
label: `${response.data[i].工位号}${response.data[i].工位名称}`,
value: response.data[i].工位号,
// id: response.data[i].工位号,
text: response.data[i].工位名称,
children: [],
labelName: response.data[i].工位名称
})
this.stationNumber1.push(response.data[i].工位名称)
}
})
},
addCheckOrder_content_stationNumber_Click(index) {
this.searchCheckContentBase(this.stationNumber[index].value)
},
addCheckOrder_content_stationNumber_Click_sure(param) {
this.occCreateForm.problemId = param['ID']
this.occCreateForm.problem = param['问题项目']
this.dialogFormVisible_CheckContent = false
},
searchCheckContentBase(stationNumberValue) {
this.CheckContentBase = []
var param = []
param[0] = ['工位号', stationNumberValue]
var Data = this.CreateData('11', 'CATL_基础_OCC_查询', param)
this.ExecDatabase(Data).then(response => {
this.CheckContentBase = response.data
for (let i = 0; i < response.data.length; i++) {
response.data[i].value = response.data[i].ID
response.data[i].text = response.data[i].问题项目
}
for (let i = 0; i < this.stationNumber.length; i++) {
if(this.stationNumber[i].value === stationNumberValue) {
this.stationNumber[i].children = response.data
}
}
}).catch(er => {
Toast.fail('错误')
})
},
// 提交
RepairManagementReplaceSubmit() {
this.$refs['occCreateForm'].validate().then(()=>{
const param = []
param[0] = ['产品编号', this.occCreateForm.productCode]
param[1] = ['问题ID', this.occCreateForm.problemId]
param[2] = ['备注', this.occCreateForm.remake]
param[3] = ['记录人', this.userInfo.姓名]
param[4] = ['问题来源', '技术质量']
const Data = this.CreateData('12', 'CATL_OCC_历史_增加', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length > 0) {
if (response.data[0].result === '1') {
Toast.success('问题记录成功!')
this.occCreateForm.remake = ''
this.occCreateForm.problemId = ''
this.occCreateForm.problem = ''
} 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.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>
.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>

View File

@@ -0,0 +1,420 @@
<template>
<div class="app-container">
<el-card style="height: 800px">
<el-row>
<div style="display: flex;margin: 20px 0">
<!-- <van-field ref="barcode" v-model="barcode" left-icon="scan" clearable style="width: 260px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" />-->
<van-field v-model="dateTimeShowInfo" left-icon="clock-o" style="width: 270px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" readonly @focus="forbid;dateTimeShow=!dateTimeShow" />
<van-calendar v-model="dateTimeShow" :min-date="minDate" :max-date="maxDate" :default-date="dateTimeDefault" type="range" @confirm="confirmFnDate" />
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px;" @click="getTable2">查询</el-button>
<el-button type="danger" icon="el-icon-add" size="small" style="margin-left: 10px;" @click="addOqc">缺陷记录</el-button>
</div>
</el-row>
<el-row style="overflow: auto;height: 750px">
<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 }}</van-tag>
<van-tag type="success" size="large">{{item.产品编号 }}</van-tag>
<van-tag style="float: right" v-if="item.放行方式 === null" type="warning" size="large">未处理</van-tag>
<van-tag style="float: right" v-if="item.放行方式 === '合格放行'" type="success" size="large">{{item.放行方式 }}</van-tag>
<van-tag style="float: right" v-if="item.放行方式 === '偏差放行'" type="warning" size="large">{{item.放行方式 }}</van-tag>
<van-tag style="float: right" v-if="item.放行方式 === '返工放行'" type="danger" size="large">{{item.放行方式}}</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="clock-o" color="#1989fa"/>
<span>记录时间</span>
{{item.记录时间}}
</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="notes-o" color="#1989fa"/>
<span>缺陷描述</span>
<span> {{item.备注}}</span>
</div>
</van-col>
<van-col span="4">
<van-button v-if="item.附件数量 > 0" plain icon="orders-o" size="small" type="warning" style="margin-top: 10px" @click="showFile(item)">查看附件</van-button>
</van-col>
</van-row>
</template>
</van-card>
</van-cell>
</van-list>
</el-row>
</el-card>
<van-dialog
v-model="showTableData_content_exchange"
width="70%"
: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">附件</div>
<!-- 可滚动的内容区域 -->
<div class="scrollable-content">
<van-list :finished="true">
<van-cell v-for="(item,index) in RepairManagementDataTableOrigin" :key="index">
<el-row v-if="/(jpg|jpeg|png|GIF|JPG|PNG)$/i.test(item.附件类型)">
{{index + 1}}<el-link type="primary" @click="showPic(item)">{{item.附件名称}}.{{item.附件类型 }}</el-link>
</el-row>
<el-row v-else>
{{index + 1}}{{item.附件名称}}.{{item.附件类型 }}
</el-row>
</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_exchange=false">关闭</van-button>
</div>
</div>
</van-dialog>
<van-dialog
v-model="showTableData_content_exchange1"
width="80%"
title="缺陷记录"
:lock-scroll="false"
:show-cancel-button="false"
:show-confirm-button="false"
style="max-height: 70%!important;overflow: auto"
>
<van-form ref="occCreateForm">
<van-field
v-model="occCreateForm.productCode"
ref="occCreateFormProductCode"
name="产品编号"
label="产品编号"
clearable
right-icon="scan"
required
placeholder="请输入/扫描产品编号"
:rules="[{ required: true, message: '请输入/扫描产品编号' }]"
@keydown.enter.prevent
/>
<van-field
v-model="occCreateForm.remake"
rows="4"
autosize
required
clearable
label="缺陷描述"
type="textarea"
placeholder="请输入缺陷描述"
/>
<div style="background-color: white;text-align: center;margin-top: 10px;display: flex;">
<van-button type="default" style="width: 100%" @click="showTableData_content_exchange1 = false">关闭</van-button>
<van-button type="info" native-type="submit" style="width: 100%" @click="RepairManagementReplaceSubmit('form_editCheckOrder')">提交</van-button>
</div>
</van-form>
</van-dialog>
</div>
</template>
<script>
import {Dialog, ImagePreview, Toast} from 'vant'
import {base64ImgtoFile, dataURLtoFile, formatDate, getBeforeOrAfterTime, getNowTime2} from '../../../utils/tool'
import axios from 'axios'
let forms = null; //设置公共变量,用来创建 FromData 对象,把文件带到后台
export default {
name: 'RepairManagement',
props: {
pageType: {
type: Number,
default: 0
}
},
data() {
return {
minDate: null,
maxDate: null,
statusNumber: [
{
label: '全部',
value: 9999
},
{
label: '未处理',
value: 0
},
{
label: '已处理',
value: 1
}
],
statusNumberValue: 9999,
dateTimeShowInfo: '',
dateTimeShow: false,
dateTimeDefault: [],
dateTime: [],
barcode: '',
barcodeMaterial: '',
loading_checkOrder: false,
showImages: false,
imageList: [],
RepairManagementDataTable: [],
userInfo: '',
showTableData_content: false,
loading_checkOrder_content: false,
RepairManagementMaterialDataTable: [],
showTableData_content_exchange1: false,
occCreateForm: {
productCode: '',
opCode: '',
problem: '',
problemId: '',
remake: ''
},
uploader: [],
Data: {},
RepairManagementReplaceForm: {
ID: 0,
productCode: '',
solveType: '',
solvePeople: ''
},
showTableData_content_exchange: false,
loading_checkOrder_content_exchange: false,
RepairType: 1,
currentSelectRow: {},
RepairManagementReplaceDialogVisible: false,
RepairManagementDestroyAllDialogVisible: false,
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() {
// 获取今日日期
const today = new Date();
this.minDate = new Date(today.getFullYear(), today.getMonth() - 1, today.getDate());
this.maxDate = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
this.userInfo = localStorage.getItem('userInfo') === '' ? {} : JSON.parse(localStorage.getItem('userInfo'))
this.dateTime = [getBeforeOrAfterTime(-7), getNowTime2()]
this.dateTimeShowInfo = this.dateTime[0] + ' ~ ' + this.dateTime[1]
this.dateTimeDefault = [new Date(getBeforeOrAfterTime(-7)), new Date(getNowTime2())]
},
mounted() {
document.getElementById('topPageName').innerText = '缺陷历史'
// this.$refs.barcode.focus()
this.getTable2()
},
methods: {
forbid(){
//禁止软键盘弹出
document.activeElement.blur();
},
addOqc() {
this.showTableData_content_exchange1 = true
this.occCreateForm.productCode = ''
this.occCreateForm.remake = ''
this.occCreateForm.problemId = ''
this.occCreateForm.problem = ''
},
// 提交
RepairManagementReplaceSubmit() {
this.$refs['occCreateForm'].validate().then(()=>{
const param = []
param[0] = ['产品编号', this.occCreateForm.productCode]
param[1] = ['问题ID', this.occCreateForm.problemId]
param[2] = ['备注', this.occCreateForm.remake]
param[3] = ['记录人', this.userInfo.姓名]
param[4] = ['问题来源', '技术质量']
const Data = this.CreateData('12', 'CATL_OCC_历史_增加', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length > 0) {
if (response.data[0].result === '1') {
Toast.success('问题记录成功!')
this.occCreateForm.remake = ''
this.occCreateForm.problemId = ''
this.occCreateForm.problem = ''
this.showTableData_content_exchange1 = false
} else {
Toast.fail('问题记录失败!')
}
} else {
Toast.fail('问题记录失败!')
}
})
})
},
getTable2() {
this.RepairManagementDataLogTable = []
const param = []
param[0] = ['产品编号', this.barcode]
param[1] = ['开始日期', this.dateTime[0]]
param[2] = ['结束日期', this.dateTime[1]]
param[3] = ['状态', this.statusNumberValue]
param[4] = ['PageCurrent', 1]
param[5] = ['PageSize', 50]
param[6] = ['PageCount', '1111', 'int', '1']
param[7] = ['ItemCount', '1111', 'int', '1']
const Data = this.CreateData('11', 'CATL_OCC_历史_查询_分页_技术质量', param)
this.ExecDatabase(Data).then(response => {
if (response.data.result && response.data.result.length > 0) {
this.RepairManagementDataLogTable = response.data.result
} else {
this.RepairManagementDataLogTable = []
Toast.fail('不存在NC项目')
}
console.log(this.RepairManagementDataLogTable)
})
},
showFile(item) {
const param = []
param[0] = ['ID', item.ID]
const Data = this.CreateData('11', 'CATL_OCC_历史附件列表_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length > 0) {
for (let i = 0; i < response.data.length; i++) {
if(!/\.(jpg|jpeg|png|GIF|JPG|PNG)$/.test(response.data[i]['附件类型'])) {
response.data[i]['url'] = window.URL.createObjectURL(base64ImgtoFile('data:image/png;base64,' + response.data[i]['附件内容']))
}
}
this.RepairManagementDataTableOrigin = response.data
this.showTableData_content_exchange = true
} else {
this.RepairManagementDataTableOrigin = []
}
})
},
showPic(item) {
ImagePreview({
images: [
item.url
]
});
},
afterRead(file){
forms = new FormData()
forms.append("file", file.file); //获取上传图片信息
},
solveNc(row) {
this.showTableData_content_exchange1 = true
this.RepairManagementReplaceForm.ID = row.ID
this.uploader = []
},
reportPicUpload() {
//如果文件列表为空,则不需要调用上传
if(this.uploader == null || this.uploader.length === 0){
return
}
var param = []
param[0] = ['OCC_ID', this.RepairManagementReplaceForm.ID]
param[1] = ['文件名称', '']
param[2] = ['文件后缀', '']
param[3] = ['文件内容', null]
var Data1 = this.CreateData('15', 'CATL_OCC_历史附件_增加', param)
this.Data.param = Data1
axios({
method: "post",
url: window.dt_Config.requestConfig,
params: this.Data,
data: forms,
}).then((res) => {
if(res.status === 200){
Toast.success('附件上传成功!')
this.getTable2()
this.showTableData_content_exchange1 = false
}else{
Toast.fail('附件上传失败!');
}
})
},
confirmFnDate(date) {
this.dateTimeShow = false
this.dateTime=[formatDate(date[0]), formatDate(date[1])]
this.dateTimeShowInfo= this.dateTime[0] + ' ~ ' + this.dateTime[1]
this.getTable2()
}
}
}
</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>

View File

@@ -0,0 +1,396 @@
<template>
<div class="app-container">
<el-row>
<div style="display: flex;margin: 20px 0">
<van-field ref="barcode" v-model="barcode" left-icon="scan" clearable style="width: 260px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" />
<van-field v-model="dateTimeShowInfo" left-icon="clock-o" style="width: 270px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" readonly @focus="forbid;dateTimeShow=!dateTimeShow" />
<van-calendar v-model="dateTimeShow" :min-date="minDate" :max-date="maxDate" :default-date="dateTimeDefault" type="range" @confirm="confirmFnDate" />
<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: 730px">
<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 }}</van-tag>
<van-tag type="success" size="large">{{item.产品编号 }}</van-tag>
<van-tag style="float: right" v-if="item.放行方式 === null" type="warning" size="large">未处理</van-tag>
<van-tag style="float: right" v-if="item.放行方式 === '合格放行'" type="success" size="large">{{item.放行方式 }}</van-tag>
<van-tag style="float: right" v-if="item.放行方式 === '偏差放行'" type="warning" size="large">{{item.放行方式 }}</van-tag>
<van-tag style="float: right" v-if="item.放行方式 === '返工放行'" type="danger" size="large">{{item.放行方式}}</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="clock-o" color="#1989fa"/>
<span>申告时间</span>
{{item.记录时间}}
</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="notes-o" color="#1989fa"/>
<span>申告问题</span>
<span> {{item.备注}}</span>
</div>
</van-col>
<van-col span="4">
<van-button v-if="item.合格放行 === 0" plain icon="completed-o" size="small" type="primary" style="margin-top: 10px" @click="solveNc(item)">申告处理</van-button>
</van-col>
</van-row>
</template>
</van-card>
</van-cell>
</van-list>
</el-row>
<van-dialog
v-model="showTableData_content_exchange"
width="70%"
title="申告处理"
:lock-scroll="false"
:show-cancel-button="false"
:show-confirm-button="false"
style="max-height: 70%!important;overflow: auto"
>
<van-form validate-first ref="form_addCheckOrder">
<!-- 通过 pattern 进行正则校验 -->
<van-field
v-model="RepairManagementReplaceForm.productCode"
label="产品编号"
readonly
name="productCode"
placeholder="产品编号"
/>
<van-field
readonly
clickable
name="area"
:value="RepairManagementReplaceForm.solveType"
label="处理方式"
placeholder="点击选择处理方式"
@click="solveTypeShow = true"
:rules="[{ required: true, message: '请选择处理方式' }]"
/>
<van-field name="uploader" label="照片上传">
<template #input>
<van-uploader v-model="uploader" :after-read="afterRead" :max-count="1" :before-read='beforeRead' />
</template>
</van-field>
<div style="background-color: white;text-align: center;margin-top: 10px;display: flex;">
<van-button type="default" style="width: 100%" @click="addCheckOrder_cancel('form_addCheckOrder')">关闭</van-button>
<van-button type="info" native-type="submit" style="width: 100%" @click="addCheckOrder_sure('form_addCheckOrder')">确定</van-button>
</div>
</van-form>
</van-dialog>
<!-- 增加检查工单的人员选择-->
<van-popup v-model="solveTypeShow" position="bottom">
<van-picker
title="标题"
show-toolbar
:columns="solveTypeList"
@confirm="getSolveType"
@cancel="solveTypeShow = false"
/>
</van-popup>
</div>
</template>
<script>
import {Dialog, Toast} from 'vant'
import axios from 'axios'
import {formatDate, getBeforeOrAfterTime, getNowTime2} from '../../../utils/tool'
let forms = null; //设置公共变量,用来创建 FromData 对象,把文件带到后台
export default {
name: 'RepairManagement',
props: {
pageType: {
type: Number,
default: 0
}
},
data() {
return {
minDate: null,
maxDate: null,
statusNumber: [
{
label: '全部',
value: 9999
},
{
label: '未处理',
value: 0
},
{
label: '已处理',
value: 1
}
],
statusNumberValue: 0,
dateTimeShowInfo: '',
dateTimeShow: false,
dateTimeDefault: [],
dateTime: [],
barcode: '',
loading_checkOrder: false,
RepairManagementDataLogTable: [],
showTableData_content_exchange: false,
Data: {},
RepairManagementReplaceForm: {
ID: 0,
productCode: '',
solveType: '',
solvePeople: ''
},
solveTypeList: ['合格放行','偏差放行','返工放行'],
solveTypeShow: false,
uploader: [],
RepairManagementDataTable: [],
userInfo: '',
showTableData_content: false,
loading_checkOrder_content: false,
RepairManagementMaterialDataTable: [],
loading_checkOrder_content_exchange: false,
RepairType: 1,
currentSelectRow: {},
RepairManagementReplaceDialogVisible: false,
RepairManagementDestroyAllDialogVisible: false,
RepairManagementReplaceRules: {
materialBarCodeNew: [{ required: true, message: '请输入/扫描新物料码!', trigger: 'blur' }]
},
RepairManagementType: '1',
partCode: '',
opCode: '',
opCodeS: [],
stationArr: [],
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() {
// 获取今日日期
const today = new Date();
this.minDate = new Date(today.getFullYear(), today.getMonth() - 1, today.getDate());
this.maxDate = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
this.userInfo = localStorage.getItem('userInfo') === '' ? {} : JSON.parse(localStorage.getItem('userInfo'))
this.dateTime = [getBeforeOrAfterTime(-7), getNowTime2()]
this.dateTimeShowInfo = this.dateTime[0] + ' ~ ' + this.dateTime[1]
this.dateTimeDefault = [new Date(getBeforeOrAfterTime(-7)), new Date(getNowTime2())]
},
mounted() {
document.getElementById('topPageName').innerText = '申告处理'
this.$refs.barcode.focus()
this.getTable2()
},
methods: {
forbid(){
//禁止软键盘弹出
document.activeElement.blur();
},
getTable2() {
this.RepairManagementDataLogTable = []
const param = []
param[0] = ['产品编号', this.barcode]
param[1] = ['开始日期', this.dateTime[0]]
param[2] = ['结束日期', this.dateTime[1]]
param[3] = ['PageCurrent', 1]
param[4] = ['PageSize', 50]
param[5] = ['PageCount', '1111', 'int', '1']
param[6] = ['ItemCount', '1111', 'int', '1']
const Data = this.CreateData('11', 'CATL_问题申告_处理查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.result && response.data.result.length > 0) {
this.RepairManagementDataLogTable = response.data.result
console.log(this.RepairManagementDataLogTable)
} else {
this.RepairManagementDataLogTable = []
Toast.fail('不存在未处理申告!')
}
})
},
solveNc(row) {
this.showTableData_content_exchange = true
this.RepairManagementReplaceForm.ID = row.ID
this.RepairManagementReplaceForm.productCode = row.产品编号
this.RepairManagementReplaceForm.solvePeople = this.userInfo.姓名
this.uploader = []
},
getSolveType(value) {
this.RepairManagementReplaceForm.solveType = value
this.solveTypeShow = false
},
addCheckOrder_sure(formName) {
this.$refs[formName].validate().then(()=>{
var param = []
param[0] = ['ID', this.RepairManagementReplaceForm.ID]
param[1] = ['放行方式', this.RepairManagementReplaceForm.solveType]
param[2] = ['处理人', this.RepairManagementReplaceForm.solvePeople]
var Data = this.CreateData('12', 'CATL_OCC_历史处理_增加', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
Toast.success('处理成功!')
this.showTableData_content_exchange = false
this.reportPicUpload()
} else {
Toast.fail('处理失败!')
}
})
}).catch(er => {})
},
beforeRead(file) {
const imgformat = /image\/(png|jpg|jpeg)$/;
if (!imgformat.test(file.type)) {
Toast.fail('请上传 jpg/jpeg/png 格式图片');
return false;
}
if (file.size > 20 * 1024 * 1024) {
Toast.fail('文件大小不能超过 20M');
return false;
}
return true
},
afterRead(file){
let canvas = document.createElement('canvas'); // 创建Canvas对象(画布)
let context = canvas.getContext('2d');
let img = new Image();
img.src = file.content; // 指定图片的DataURL(图片的base64编码数据)
img.onload = function () {
// 画布大小 这里的this指向img
canvas.width = this.width;
canvas.height = this.height;
context.drawImage(img, 0, 0, this.width, this.height); // 图片大小
// file.content = canvas.toDataURL(file.file.type, 0.3); // 0.92为默认压缩质量
const dataurl = canvas.toDataURL(file.file.type, 0.5); // 0.92为默认压缩质量
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
var fileNew = new File([u8arr], file.file.name, {type: mime});
forms = new FormData()
forms.append("file", fileNew); //获取上传图片信息
};
},
reportPicUpload() {
//如果文件列表为空,则不需要调用上传
if(this.uploader == null || this.uploader.length === 0){
this.getTable2()
return
}
var param = []
param[0] = ['OCC_ID', this.RepairManagementReplaceForm.ID]
param[1] = ['文件名称', '']
param[2] = ['文件后缀', '']
param[3] = ['文件内容', null]
var Data1 = this.CreateData('15', 'CATL_OCC_历史附件_增加', param)
this.Data.param = Data1
axios({
method: "post",
url: window.dt_Config.requestConfig,
params: this.Data,
data: forms,
}).then((res) => {
if(res.status === 200){
Toast.success('附件上传成功!');
this.showTableData_content_exchange = false
this.getTable2()
}else{
Toast.fail('附件上传失败!');
}
})
},
addCheckOrder_cancel(formName) {
this.showTableData_content_exchange = false
this.$refs[formName].resetValidation()
},
confirmFnDate(date) {
this.dateTimeShow = false
this.dateTime=[formatDate(date[0]), formatDate(date[1])]
this.dateTimeShowInfo= this.dateTime[0] + ' ~ ' + this.dateTime[1]
this.getTable2()
},
}
}
</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>

264
src/views/login.vue Normal file
View 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>

137
src/views/main.vue Normal file
View File

@@ -0,0 +1,137 @@
<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.节点名称 }}{{userInfo.姓名}}</span>
</div>
</van-row>
<van-row>
<!-- <van-col span="12">-->
<!-- <van-button class="big-btn" type="info" @click="routeJump('CheckPlanCreate')">-->
<!-- <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="info" @click="routeJump('CheckPlanExec')">
<van-icon name="records-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('CheckPlanSearch')">
<van-icon name="todo-list-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('OccSearch')">
<van-icon name="fire-o" size="60" color="#ffffff" />
<br>
<i>缺陷记录</i>
</van-button>
</van-col>
<van-col span="12">
<van-button color="#CDDC39" class="big-btn" type="danger" @click="routeJump('ProblemDeclarationSolve')" >
<van-icon name="bulb-o" size="80" color="#ffffff" />
<br>
<i>申告处理</i>
</van-button>
</van-col>
</van-row>
<van-row>
<van-col span="24">
<van-button class="big-btn" style="width: 92%;height: 100px" type="danger" @click="routeJump('')" >
<van-icon name="revoke" size="45" color="#ffffff" />
<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'))
console.log(this.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: 15px 30px;
height: 200px;
width: 85%;
font-size: 3rem;
}
.big-btn_logoff {
margin: 10px 0px;
height: 90px;
width: 85%;
font-size: 3rem;
}
</style>

0
static/.gitkeep Normal file
View File

BIN
static/2质检项维护.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
static/catl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

8
static/config.js Normal file
View File

@@ -0,0 +1,8 @@
window.dt_Config = {
// requestConfig: `http://192.168.43.124:20021/submit/MESCommonBase.ashx`,
// requestConfig: `http://192.168.10.205:20021/submit/MESCommonBase.ashx`,
// requestConfig: `http://192.168.10.3:10000/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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,27 @@
// A custom Nightwatch assertion.
// The assertion name is the filename.
// Example usage:
//
// browser.assert.elementCount(selector, count)
//
// For more information on custom assertions see:
// http://nightwatchjs.org/guide#writing-custom-assertions
exports.assertion = function (selector, count) {
this.message = 'Testing if element <' + selector + '> has count: ' + count
this.expected = count
this.pass = function (val) {
return val === this.expected
}
this.value = function (res) {
return res.value
}
this.command = function (cb) {
var self = this
return this.api.execute(function (selector) {
return document.querySelectorAll(selector).length
}, [selector], function (res) {
cb.call(self, res)
})
}
}

View File

@@ -0,0 +1,46 @@
require('babel-register')
var config = require('../../config')
// http://nightwatchjs.org/gettingstarted#settings-file
module.exports = {
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],
selenium: {
start_process: true,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path
}
},
test_settings: {
default: {
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
globals: {
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
}

48
test/e2e/runner.js Normal file
View File

@@ -0,0 +1,48 @@
// 1. start the dev server using production config
process.env.NODE_ENV = 'testing'
const webpack = require('webpack')
const DevServer = require('webpack-dev-server')
const webpackConfig = require('../../build/webpack.prod.conf')
const devConfigPromise = require('../../build/webpack.dev.conf')
let server
devConfigPromise.then(devConfig => {
const devServerOptions = devConfig.devServer
const compiler = webpack(webpackConfig)
server = new DevServer(compiler, devServerOptions)
const port = devServerOptions.port
const host = devServerOptions.host
return server.listen(port, host)
})
.then(() => {
// 2. run the nightwatch test suite against it
// to run in additional browsers:
// 1. add an entry in test/e2e/nightwatch.conf.js under "test_settings"
// 2. add it to the --env flag below
// or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
// For more information on Nightwatch's config file, see
// http://nightwatchjs.org/guide#settings-file
let opts = process.argv.slice(2)
if (opts.indexOf('--config') === -1) {
opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
}
if (opts.indexOf('--env') === -1) {
opts = opts.concat(['--env', 'chrome'])
}
const spawn = require('cross-spawn')
const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
runner.on('exit', function (code) {
server.close()
process.exit(code)
})
runner.on('error', function (err) {
server.close()
throw err
})
})

19
test/e2e/specs/test.js Normal file
View File

@@ -0,0 +1,19 @@
// For authoring Nightwatch tests, see
// http://nightwatchjs.org/guide#usage
module.exports = {
'default e2e tests': function (browser) {
// automatically uses dev Server port from /config.index.js
// default: http://localhost:8080
// see nightwatch.conf.js
const devServer = browser.globals.devServerURL
browser
.url(devServer)
.waitForElementVisible('#app', 5000)
.assert.elementPresent('.hello')
.assert.containsText('h1', 'Welcome to Your Vue.js App')
.assert.elementCount('img', 1)
.end()
}
}

7
test/unit/.eslintrc Normal file
View File

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

30
test/unit/jest.conf.js Normal file
View File

@@ -0,0 +1,30 @@
const path = require('path')
module.exports = {
rootDir: path.resolve(__dirname, '../../'),
moduleFileExtensions: [
'js',
'json',
'vue'
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
},
testPathIgnorePatterns: [
'<rootDir>/test/e2e'
],
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
setupFiles: ['<rootDir>/test/unit/setup'],
mapCoverage: true,
coverageDirectory: '<rootDir>/test/unit/coverage',
collectCoverageFrom: [
'src/**/*.{js,vue}',
'!src/main.js',
'!src/router/index.js',
'!**/node_modules/**'
]
}

3
test/unit/setup.js Normal file
View File

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

View File

@@ -0,0 +1,11 @@
import Vue from 'vue'
import HelloWorld from '@/components/HelloWorld'
describe('HelloWorld.vue', () => {
it('should render correct contents', () => {
const Constructor = Vue.extend(HelloWorld)
const vm = new Constructor().$mount()
expect(vm.$el.querySelector('.hello h1').textContent)
.toEqual('Welcome to Your Vue.js App')
})
})