init: CATL电池线OCC APP首次入库

This commit is contained in:
XingCheng3
2026-06-08 17:11:58 +08:00
commit 3b4a765c06
75 changed files with 55764 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'
}
}

21
.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
.DS_Store
node_modules/
/dist/
OQC_APP/
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')
})
}
}

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

@@ -0,0 +1,23 @@
'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
}),
transpileDependencies: ['uview-ui'],
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'
}
}

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

@@ -0,0 +1,96 @@
'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"'
})

80
config/index.js Normal file
View File

@@ -0,0 +1,80 @@
'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: '0.0.0.0', // 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

94
package.json Normal file
View File

@@ -0,0 +1,94 @@
{
"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": "^0.27.2",
"cube-ui": "^1.12.54",
"element-ui": "^2.15.12",
"eruda": "^3.4.1",
"image-conversion": "^2.1.1",
"less": "^4.1.3",
"less-loader": "^5.0.0",
"mqtt": "^2.18.9",
"vant": "2.13.2",
"vue": "^2.5.2",
"vue-mobile-calendar": "^3.3.0",
"vue-router": "^3.0.1",
"vue-simple-mobile-calendar": "^1.0.7",
"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

BIN
src/assets/leftPic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

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,56 @@
<template>
<div>
<top-bar>
<div style="display: flex;width: 100%;height: 50px;font-size: 2rem;">
<van-col span="2" style="display: flex;align-items:center;justify-content:center;">
<img src="../../assets/leftPic.png" style="margin-left: 1rem" />
</van-col>
<van-col span="20" style="display: flex;align-items:center;justify-content:center;font-size: 2.5rem ">
<span id="topPageName">充电宝OQC系统</span>
</van-col>
<van-col span="2" style="display: flex;align-items:center;justify-content:center;">
<van-button icon="home-o" style="background-color: #a5a5a5;margin-right: 3rem" @click="routeJump('main')"></van-button>
</van-col>
</div>
</top-bar>
</div>
</template>
<script>
import TopBar from './TopBar'
// import TopBarItem from './TopBarItem'
export default {
name:"MainTopBar",
components:{
TopBar,
// TopBarItem
},
methods: {
routeJump(val){
if (val.indexOf('/') !== -1) {
val = val.substring(1)
}
this.$router.push({
path: '/' + val
})
}
}
}
</script>
<style>
#top-bar{
display: flex;
align-items: center;
justify-content: center;
background-color: #e7e7e7;
border-top: 2px #ccc;
position: fixed;
left: 0;
right: 0;
top: 0;
box-shadow:0px -1px 1px rgba(100,100,100,.2) ;
}
</style>

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>

102
src/main.js Normal file
View File

@@ -0,0 +1,102 @@
// 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
})
}
new Vue({
el: '#app',
router,
store,
components: {
App
},
template: '<App/>'
})

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

@@ -0,0 +1,73 @@
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: '/OccCreate',
name: 'OccCreate',
meta: {
keepAlive: true
},
component: () => import('@/views/OCC/OccCreate/index.vue')
},
{
path: '/OccSearch',
name: 'OccSearch',
meta: {
keepAlive: true
},
component: () => import('@/views/OCC/OccSearch/index.vue')
},
{
path: '/OccBase',
name: 'OccBase',
meta: {
keepAlive: true
},
component: () => import('@/views/OCC/OccBase/index.vue')
},
{
path: '/OccSolve',
name: 'OccSolve',
meta: {
keepAlive: true
},
component: () => import('@/views/OCC/OccSolve/index.vue')
},
{
path: '/LoadingCard',
name: 'LoadingCard',
meta: {
keepAlive: true
},
component: () => import('@/views/OCC/LoadingCard/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);
}) */

1
src/style/uni.scss Normal file
View File

@@ -0,0 +1 @@
@import 'uview-ui/theme.scss';

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
}

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

@@ -0,0 +1,36 @@
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 const url = requestConfig
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)
}

View File

@@ -0,0 +1,816 @@
<template>
<div class="loading-card">
<!-- 顶部搜索区域 -->
<van-sticky>
<div class="search-header">
<van-field v-model="searchValue" placeholder="请输入产品编号" left-icon="search" clearable
@keyup.enter="searchProducts" />
<van-button type="primary" size="small" @click="searchProducts" style="margin-left: 10px;">
查询
</van-button>
<van-button type="success" size="small" @click="uploadShowPDF" style="margin-left: 10px;">
上传
</van-button>
</div>
</van-sticky>
<!-- 内容区域 -->
<div class="content-wrapper">
<!-- 左侧产品列表 -->
<div class="product-list">
<div class="section-title">产品列表</div>
<div class="product-items">
<div v-for="item in productList" :key="item.产品编号" class="product-item"
:class="{ active: selectedProduct === item.产品编号 }" @click="selectProduct(item)">
<div class="product-no">{{ item.产品编号 }}</div>
<div class="attachment-count">附件: {{ item.附件数量 }}</div>
</div>
</div>
</div>
<!-- 右侧附件列表 -->
<div class="attachment-section">
<!-- 附件列表 -->
<div class="attachment-list">
<div class="section-title">
附件列表
<span v-if="selectedProduct" class="selected-product">{{ selectedProduct }}</span>
</div>
<div class="attachment-items">
<div v-for="attachment in attachmentList" :key="attachment.ID" class="attachment-item">
<van-icon :name="getFileIcon(attachment.附件类型)" size="24" :color="getFileColor(attachment.附件类型)" />
<div class="attachment-info">
<div class="attachment-name">{{ attachment.附件名称 }}</div>
<div class="attachment-time">{{ attachment.操作时间 }}</div>
</div>
<div class="action-buttons">
<van-button type="info" size="mini" @click="previewFile(attachment)">
预览
</van-button>
<van-button type="primary" size="mini" @click="downloadFile(attachment)" style="margin-left: 5px;">
下载
</van-button>
<van-button type="danger" size="mini" @click="deleteFile(attachment)" style="margin-left: 5px;">
删除
</van-button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 上传文件对话框 - 使用Element UI与管理系统完全一致 -->
<el-dialog :visible.sync="imgDialogFormVisible" title="上传文件" center width="460px">
<div style="margin-bottom: 5px;margin-left: 30px">
<span>产品编号</span>
<el-input v-model="stationNumberValue1" size="mini" style="width: 200px" placeholder="请输入产品编号" />
</div>
<el-upload id="invoiceScan" ref="uploadPDF" :multiple="true" :auto-upload="false" :on-success="uploadSuccessPDF"
:on-preview="handlePictureCardPreview" :before-upload="beforeUploadPdf" :on-exceed="warningExceedPdf"
:limit="limit" :data="DataPDF" :action="uploadPDF" accept=".pdf,.jpg,.jpeg,.png,.gif,.bmp"
style="margin-left: 30px" drag>
<i class="el-icon-upload" />
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">支持上传pdfjpgpnggifbmp等格式文件单个文件不超过100MB</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelUpload">取消</el-button>
<el-button type="primary" style="width: 70px" @click="submitPicturePDF()">确定</el-button>
</div>
</el-dialog>
<!-- 文件预览弹窗 -->
<van-popup v-model="showPreview" position="center"
style="width: 90%; height: 90%; max-width: 1000px; border-radius: 8px;" closeable close-icon="cross">
<div class="preview-popup">
<div class="preview-header">
<span class="preview-title">文件预览 - {{ previewFileName }}</span>
</div>
<div class="preview-body">
<!-- PDF提示信息 -->
<div v-if="previewType === 'pdf'" class="pdf-tip">
<van-icon name="description" size="80" color="#f56c6c" />
<p class="tip-title">PDF文件预览</p>
<p class="tip-content">移动设备不支持PDF预览</p>
<p class="tip-content">请在PC端打开管理系统进行预览</p>
<div class="tip-actions">
<van-button type="primary" size="small"
@click="downloadFile({ 附件类型: 'pdf', 附件内容: currentPdfContent, 附件名称: previewFileName })">
下载文件
</van-button>
</div>
</div>
<!-- 图片预览 -->
<div v-else-if="previewType === 'image'" class="image-preview">
<img :src="previewUrl" style="max-width: 100%; max-height: 100%; object-fit: contain;" />
</div>
<!-- 不支持的文件类型 -->
<div v-else class="unsupported-preview">
<van-icon name="warning-o" size="80" color="#ff976a" />
<p>不支持的文件格式</p>
</div>
</div>
</div>
</van-popup>
<!-- 相机弹窗 -->
<van-popup v-model="showCamera" style="height: 100%; width: 100%;">
<div class="camera-popup">
<div class="camera-header">
<van-button type="default" @click="closeCamera">取消</van-button>
<span class="camera-title">拍照</span>
<van-button type="primary" @click="takePhoto">拍照</van-button>
</div>
<video ref="video" autoplay playsinline style="width: 100%; height: calc(100% - 60px);"></video>
<canvas ref="canvas" style="display: none;"></canvas>
</div>
</van-popup>
</div>
</template>
<script>
import { Toast, Dialog } from 'vant'
import { url } from '@/utils/request'
export default {
name: 'LoadingCard',
data() {
return {
searchValue: '',
selectedProduct: '',
productList: [],
attachmentList: [],
showPreview: false, // 预览弹窗显示状态
previewType: '',
previewUrl: '',
previewFileName: '', // 预览文件名称
currentPdfContent: '', // 当前PDF文件内容
imgDialogFormVisible: false, // 使用Element UI的对话框
showCamera: false,
stationNumberValue1: '', // 产品编号输入
limit: 5, // 支持多个文件
DataPDF: {}, // Element UI upload组件需要的数据
uploadPDF: url, // 上传地址
mediaStream: null
}
},
mounted() {
document.getElementById('topPageName').innerText = '随车卡管理'
this.searchProducts()
},
beforeDestroy() {
this.closeCamera()
},
methods: {
// 搜索产品
async searchProducts() {
try {
const param = []
param[0] = ['产品编号', this.searchValue]
const Data = this.CreateData('11', 'CATL_随车卡_PDF_查询', param)
console.log('搜索参数:', Data)
const response = await this.ExecDatabase(Data)
console.log('搜索响应:', response)
this.productList = response.data || []
this.clearAttachmentAndPreview()
} catch (error) {
Toast.fail('查询失败: ' + (error.message || error))
console.error('搜索错误:', error)
}
},
// 选择产品
selectProduct(product) {
this.selectedProduct = product.产品编号
this.getAttachmentList(product.产品编号)
},
// 获取附件列表
async getAttachmentList(productNo) {
try {
this.attachmentList = []
const param = []
param[0] = ['产品编号', productNo]
const Data = this.CreateData('11', 'CATL_随车卡_PDF_附件列表查询', param)
const response = await this.ExecDatabase(Data)
this.attachmentList = response.data || []
this.clearPreview()
} catch (error) {
Toast.fail('获取附件列表失败')
console.error(error)
}
},
// 预览文件 - 弹窗形式
previewFile(attachment) {
const fileType = attachment.附件类型.toLowerCase()
const fileContent = attachment.附件内容
// 设置文件名称
this.previewFileName = attachment.附件名称
if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(fileType)) {
this.previewType = 'image'
this.previewUrl = `data:image/${fileType};base64,${fileContent}`
this.showPreview = true
} else if (fileType === 'pdf') {
this.previewType = 'pdf'
this.currentPdfContent = fileContent // 保存PDF内容供下载使用
this.showPreview = true
} else {
this.previewType = 'unsupported'
this.showPreview = true
Toast.fail('不支持的文件格式')
}
},
// 创建PDF预览URL
createPdfUrl(content) {
const bstr = atob(content)
let n = bstr.length
const u8arr = new Uint8Array(n)
while (n--) { u8arr[n] = bstr.charCodeAt(n) }
const blob = new Blob([u8arr], { type: 'application/pdf' })
return window.URL.createObjectURL(blob)
},
// 下载文件
downloadFile(attachment) {
const fileType = attachment.附件类型.toLowerCase()
const fileContent = attachment.附件内容
const fileName = attachment.附件名称
let url = ''
if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(fileType)) {
url = `data:image/${fileType};base64,${fileContent}`
} else if (fileType === 'pdf') {
url = this.createPdfUrl(fileContent)
} else {
Toast.fail('不支持的下载格式')
return
}
const a = document.createElement('a')
a.href = url
a.download = `${fileName}.${fileType}`
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
},
// 获取文件图标
getFileIcon(fileType) {
const type = fileType.toLowerCase()
if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(type)) {
return 'photo-o'
} else if (type === 'pdf') {
return 'description'
}
return 'document'
},
// 获取文件颜色
getFileColor(fileType) {
const type = fileType.toLowerCase()
if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(type)) {
return '#52c41a'
} else if (type === 'pdf') {
return '#f5222d'
}
return '#666'
},
// 拍照 - 与Element UI upload组件配合
takePhoto() {
const video = this.$refs.video
const canvas = this.$refs.canvas
const context = canvas.getContext('2d')
canvas.width = video.videoWidth
canvas.height = video.videoHeight
context.drawImage(video, 0, 0)
canvas.toBlob((blob) => {
const file = new File([blob], `photo_${Date.now()}.jpg`, { type: 'image/jpeg' })
// 手动将文件添加到Element UI的upload组件中
this.$refs.uploadPDF.handleStart(file)
this.closeCamera()
Toast.success('拍照成功,文件已添加到上传列表')
}, 'image/jpeg', 0.8)
},
// 关闭相机
closeCamera() {
this.showCamera = false
if (this.mediaStream) {
this.mediaStream.getTracks().forEach(track => track.stop())
this.mediaStream = null
}
},
// 添加指导文件
uploadShowPDF() {
this.imgDialogFormVisible = true
},
// 上传成功回调 - 与管理系统一致
uploadSuccessPDF(res) {
this.imgDialogFormVisible = false
this.$refs.uploadPDF.clearFiles()
this.$message.success('文件上传成功!')
this.searchProducts()
// 如果有选中的产品,刷新附件列表
if (this.selectedProduct) {
this.getAttachmentList(this.selectedProduct)
}
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url
this.dialogVisiblePictureCard = true
},
// 上传前检测 - 与管理系统一致
beforeUploadPdf(file) {
const fileName = file.name.toLowerCase()
const fileExt = fileName.substring(fileName.lastIndexOf('.') + 1)
const allowedTypes = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp']
if (!allowedTypes.includes(fileExt)) {
this.$message.error('只能上传PDF或图片文件jpg、png、gif、bmp')
return false
}
const isLt100M = file.size / 1024 / 1024 < 100
if (!isLt100M) {
this.$message.error('文件大小不能超过 100MB!')
return false
}
if (this.stationNumberValue1 === '') {
this.$message.error('请输入产品编号')
return false
}
return true
},
warningExceedPdf() {
this.$message.error('最多可上传5个文件')
},
// 保存文件 - 与管理系统一致
submitPicturePDF() {
if (this.stationNumberValue1 === '') {
this.$message.error('请输入产品编号!')
return
}
var param = []
param[0] = ['产品编号', this.stationNumberValue1]
param[1] = ['说明', '']
param[2] = ['文件名称', '']
param[3] = ['文件后缀', '']
param[4] = ['文件内容', null]
var Data1 = this.CreateData('15', 'CATL_随车卡_PDF_增加', param)
this.DataPDF.param = Data1
this.$refs.uploadPDF.submit()
this.imgDialogFormVisible = false
},
// 取消上传 - 与管理系统一致
cancelUpload() {
this.imgDialogFormVisible = false
this.$refs.uploadPDF.clearFiles()
this.stationNumberValue1 = ''
},
// 清空附件和预览
clearAttachmentAndPreview() {
this.selectedProduct = ''
this.attachmentList = []
this.clearPreview()
},
// 清空预览
clearPreview() {
this.showPreview = false
this.previewType = ''
this.previewUrl = ''
this.previewFileName = ''
this.currentPdfContent = ''
},
// 删除文件
deleteFile(attachment) {
Dialog.confirm({
title: '提示',
message: '此操作将永久删除该附件,是否继续?'
}).then(async () => {
try {
const param = []
param[0] = ['id', attachment.id]
const Data = this.CreateData('12', 'CATL_随车卡_PDF_删除', param)
const response = await this.ExecDatabase(Data)
if (response && response.data && response.data[0] && response.data[0].result === '1') {
Toast.success('删除成功')
// 刷新附件列表
if (this.selectedProduct) {
await this.getAttachmentList(this.selectedProduct)
}
// 刷新产品列表
await this.searchProducts()
// 清空预览
this.clearPreview()
} else {
Toast.fail('删除失败')
}
} catch (error) {
Toast.fail('删除失败: ' + (error.message || error))
console.error('删除错误:', error)
}
}).catch(() => {
// 用户取消删除
console.log('用户取消删除')
})
}
}
}
</script>
<style lang="less" scoped>
.loading-card {
height: calc(100vh - 60px);
margin-top: 60px;
display: flex;
flex-direction: column;
background-color: #f7f8fa;
}
.search-header {
display: flex;
align-items: center;
padding: 15px;
background: white;
border-bottom: 1px solid #ebedf0;
}
.content-wrapper {
flex: 1;
display: flex;
padding: 10px;
gap: 10px;
overflow: hidden;
}
.product-list {
flex: 0 0 40%;
/* 使用flex布局占40%宽度 */
min-width: 350px;
/* 最小宽度 */
max-width: 500px;
/* 最大宽度 */
background: white;
border-radius: 8px;
padding: 15px;
overflow-y: auto;
}
.attachment-section {
flex: 1;
/* 占据剩余空间 */
min-width: 300px;
/* 最小宽度保证可用性 */
}
.attachment-list {
height: 100%;
/* 占满高度 */
background: white;
border-radius: 8px;
padding: 15px;
overflow-y: auto;
}
.section-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 15px;
color: #323233;
}
.selected-product {
font-size: 14px;
color: #1989fa;
font-weight: normal;
}
.product-items,
.attachment-items {
display: flex;
flex-direction: column;
gap: 10px;
}
.product-item {
padding: 12px;
border: 1px solid #ebedf0;
border-radius: 6px;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #1989fa;
}
&.active {
border-color: #1989fa;
background-color: #f0f9ff;
}
}
.product-no {
font-size: 16px;
font-weight: bold;
color: #323233;
}
.attachment-count {
font-size: 12px;
color: #969799;
margin-top: 4px;
}
.attachment-item {
display: flex;
align-items: center;
padding: 12px;
border: 1px solid #ebedf0;
border-radius: 6px;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #1989fa;
background-color: #f0f9ff;
}
}
.attachment-info {
flex: 1;
margin-left: 12px;
}
.attachment-name {
font-size: 14px;
color: #323233;
}
.attachment-time {
font-size: 12px;
color: #969799;
margin-top: 4px;
}
.action-buttons {
display: flex;
gap: 5px;
}
/* 预览弹窗样式 */
.preview-popup {
height: 100%;
display: flex;
flex-direction: column;
background: white;
}
.preview-header {
padding: 15px 20px;
border-bottom: 1px solid #ebedf0;
background: #f7f8fa;
}
.preview-title {
font-size: 16px;
font-weight: bold;
color: #323233;
}
.preview-body {
flex: 1;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.image-preview {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.pdf-tip {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
padding: 40px 20px;
text-align: center;
}
.tip-title {
font-size: 18px;
font-weight: bold;
color: #323233;
margin: 15px 0 10px 0;
}
.tip-content {
font-size: 14px;
color: #969799;
line-height: 1.5;
margin: 5px 0;
}
.tip-actions {
margin-top: 25px;
}
.unsupported-preview {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
color: #969799;
}
.upload-popup {
padding: 20px;
height: 100%;
display: flex;
flex-direction: column;
}
.popup-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.popup-title {
font-size: 18px;
font-weight: bold;
}
.upload-form {
flex: 1;
display: flex;
flex-direction: column;
}
.upload-section {
margin: 20px 0;
}
.upload-title {
font-size: 16px;
margin-bottom: 10px;
}
.upload-buttons {
display: flex;
gap: 10px;
margin-bottom: 15px;
}
.upload-preview {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.upload-file-item {
position: relative;
width: 100px;
height: 100px;
border: 1px solid #ebedf0;
border-radius: 6px;
overflow: hidden;
}
.upload-preview-img {
width: 100%;
height: 100%;
object-fit: cover;
}
.upload-file-info {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
padding: 10px;
text-align: center;
span {
font-size: 12px;
margin-top: 5px;
word-break: break-all;
}
}
.remove-btn {
position: absolute;
top: -5px;
right: -5px;
background: #ee0a24;
color: white;
border-radius: 50%;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
}
.upload-actions {
display: flex;
justify-content: flex-end;
margin-top: auto;
padding-top: 20px;
}
.camera-popup {
height: 100%;
display: flex;
flex-direction: column;
}
.camera-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
background: #323233;
color: white;
}
.camera-title {
font-size: 18px;
font-weight: bold;
}
@media (max-width: 768px) {
.content-wrapper {
flex-direction: column;
}
.product-list {
flex: none;
/* 移除flex属性 */
width: 100%;
/* 占满宽 */
min-width: auto;
/* 重置最小宽度 */
max-width: none;
/* 重置最大宽度 */
height: 250px;
/* 高度 */
}
.attachment-section {
flex: 1;
min-width: auto;
/* 重置最小宽度 */
}
.attachment-list {
height: calc(100vh - 320px);
/* 适应小屏幕高度 */
}
.action-buttons {
flex-direction: column;
/* 手机端按钮垂直排列 */
gap: 3px;
}
}
</style>

View File

@@ -0,0 +1,630 @@
<template>
<div class="app-container">
<el-row>
<div style="display: flex;margin: 20px 0">
<van-field v-model="stationNumberValueShow" style="width: 220px;border-radius: 4px;border:1px solid #DCDFE6;height: 36px;line-height: 18px" placeholder="点击选择工位" readonly @focus="forbid;dialogFormVisible_addCheckContentBase_selectStation=true" />
<el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 10px" @click="searchTableCheckContentBase()">查询</el-button>
<el-button type="warning" plain size="small" icon="el-icon-plus" style="margin-left: 10px" @click="addCheckContentBase()">新增</el-button>
</div>
</el-row>
<van-row style="overflow: auto;max-height:600px">
<van-list v-model="listLoading1" :finished="listLoading1" finished-text="没有更多了">
<van-cell v-for="(item,index) in tableDataCheckContentBase" :key="index">
<van-card class="s-card">
<template #tags>
<van-row style="font-size: 1.5rem">
<van-tag type="primary" size="large">{{index + 1}}</van-tag>
<van-button plain icon="delete-o" size="small" type="danger" style="float: right;margin-left: 10px;height: 24px" @click="deleteCheckContentBase(item)">删除</van-button>
<van-button plain icon="edit" size="small" type="warning" style="float: right;height: 24px" @click="editCheckContentBase(item)">修改</van-button>
</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="comment-o" color="#1989fa"/>
<span>问题项目</span>
<span> {{item.问题项目}}</span>
</div>
</van-row>
</template>
</van-card>
</van-cell>
</van-list>
</van-row>
<!-- 基础数据增加检查项维护-->
<van-dialog
v-model="dialogFormVisible_addCheckContentBase"
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_addCheckContentBase">
<!-- 通过 pattern 进行正则校验 -->
<van-field
v-model="form_addCheckContentBase.stationName"
label="工位"
name="stationNumberValue"
placeholder="点击选择工位"
@click="dialogFormVisible_addCheckContentBase_selectStation=true"
/>
<van-field
v-model="form_addCheckContentBase.checkItem"
label="问题项"
name="checkItem"
placeholder="问题项"
:rules="[{ required: true, message: '请填写问题项' }]"
/>
<div style="background-color: white;text-align: center;margin-top: 10px;display: flex;">
<van-button type="default" style="width: 100%" @click="addCheckContentBase_cancel('form_addCheckContentBase')">关闭</van-button>
<van-button type="info" native-type="submit" style="width: 100%" @click="addCheckContentBase_sure('form_addCheckContentBase')">确定</van-button>
</div>
</van-form>
</van-dialog>
<!-- 基础数据编辑检查项维护-->
<van-dialog
v-model="dialogFormVisible_editCheckContentBase"
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_editCheckContentBase">
<van-field
v-model="form_editCheckContentBase.checkItem"
label="问题项"
name="checkItem"
placeholder="问题项"
:rules="[{ required: true, message: '请填写问题项' }]"
/>
<div style="background-color: white;text-align: center;margin-top: 10px;display: flex;">
<van-button type="default" style="width: 100%" @click="editCheckContentBase_cancel('form_editCheckContentBase')">关闭</van-button>
<van-button type="info" native-type="submit" style="width: 100%" @click="editCheckContentBase_sure('form_editCheckContentBase')">确定</van-button>
</div>
</van-form>
</van-dialog>
<!-- 工位选择-->
<van-popup v-model="dialogFormVisible_addCheckContentBase_selectStation" position="bottom">
<van-picker
title="工位选择"
show-toolbar
:columns="stationNumber1"
@confirm="getCheckContentBase_station"
@cancel="dialogFormVisible_addCheckContentBase_selectStation = false"
/>
</van-popup>
</div>
</template>
<script>
import {Dialog, Toast} from 'vant'
export default {
name: 'OccBase',
data() {
return {
dialogFormVisible_addCheckContentBase: false,
dialogFormVisible_addCheckContentBase_selectStation: false,
form_addCheckContentBase: {
stationNumberValue: '',
stationName: '',
checkItem: '',
checkItemContent: '',
standardValue: '',
maximumValue: '',
minimumValue: '',
unit: ''
},
rules_addCheckContentBase: {
// stationNumberValue: [{ required: true, message: '请选择工位号', trigger: 'change' }],
checkItem: [{ required: true, message: '请输入检查项', trigger: 'blur' }],
checkItemContent: [{ required: true, message: '请输入检查项内容', trigger: 'blur' }]
},
dialogFormVisible_editCheckContentBase: false,
form_editCheckContentBase: {
ID: '',
stationNumberValue: '',
stationName: '',
checkItem: '',
checkItemContent: '',
standardValue: '',
maximumValue: '',
minimumValue: '',
unit: ''
},
rules_editCheckContentBase: {
// stationNumberValue: [{ required: true, message: '请选择工位号', trigger: 'change' }],
checkItem: [{ required: true, message: '请输入检查项', trigger: 'blur' }],
checkItemContent: [{ required: true, message: '请输入检查项内容', trigger: 'blur' }]
},
occCreateForm: {
productCode: '',
opCode: '',
problem: '',
problemId: '',
remake: ''
},
dialogFormVisible_selectStation: false,
dialogFormVisible_selectProgram: false,
stationNumber: [],
stationNumber1: [],
dialogFormVisible_CheckContent: false,
activeIndex: 0,
CheckContentBase: [],
listLoading1: false,
tableDataCheckContentBase: [],
stationNumberValueShow: '',
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() {
if(localStorage.getItem('userInfo') === '' || localStorage.getItem('userInfo') === null) {
alert('账号失效,请重新登录')
this.$router.push('/')
}
this.userInfo = localStorage.getItem('userInfo') === '' ? {} : JSON.parse(localStorage.getItem('userInfo'))
console.log(this.userInfo)
this.getStationNumber()
this.searchTableCheckContentBase()
},
mounted() {
document.getElementById('topPageName').innerText = '数据维护'
},
methods: {
forbid(){
//禁止软键盘弹出
document.activeElement.blur();
},
searchTableCheckContentBase() {
this.listLoading1 = true
this.tableDataCheckContentBase = []
var param = []
param[0] = ['工位号', this.stationNumberValue]
var Data = this.CreateData('11', 'CATL_基础_OCC_查询', param)
this.ExecDatabase(Data).then(response => {
console.log(response.data)
this.tableDataCheckContentBase = response.data
this.listLoading1 = false
}).catch(er => {
this.listLoading1 = false
Toast.fail('错误!')
// this.$message.error('错误')
})
},
addCheckContentBase() {
this.dialogFormVisible_addCheckContentBase = true
this.form_addCheckContentBase.stationNumberValue = ''
this.form_addCheckContentBase.stationName = ''
this.form_addCheckContentBase.checkItem = ''
this.form_addCheckContentBase.checkItemContent = ''
this.form_addCheckContentBase.standardValue = ''
this.form_addCheckContentBase.maximumValue = ''
this.form_addCheckContentBase.minimumValue = ''
this.form_addCheckContentBase.unit = ''
},
addCheckContentBase_sure(formName) {
this.$refs[formName].validate().then(()=>{
var param = []
param[0] = ['工位号', this.form_addCheckContentBase.stationNumberValue]
param[1] = ['问题项目', this.form_addCheckContentBase.checkItem]
var Data = this.CreateData('12', 'CATL_基础_OCC_增加', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
Toast.success('增加成功!')
this.dialogFormVisible_addCheckContentBase = false
this.searchTableCheckContentBase()
} else {
Toast.fail('增加失败!')
// this.$message.error('增加失败!')
}
})
})
},
addCheckContentBase_cancel(formName) {
this.dialogFormVisible_addCheckContentBase = false
this.$refs[formName].resetValidation()
},
editCheckContentBase(row) {
this.dialogFormVisible_editCheckContentBase = true
this.form_editCheckContentBase.stationNumberValue = row.工位号
this.form_editCheckContentBase.stationName = ''
for (const stationNumber of this.stationNumber) {
if(stationNumber.value === row.工位号) {
this.form_editCheckContentBase.stationName = stationNumber.labelName
}
}
this.form_editCheckContentBase.checkItem = row.问题项目
this.form_editCheckContentBase.ID = row.ID
},
editCheckContentBase_sure(formName) {
this.$refs[formName].validate().then(()=>{
var param = []
param[0] = ['工位号', this.form_editCheckContentBase.stationNumberValue]
param[1] = ['问题项目', this.form_editCheckContentBase.checkItem]
param[2] = ['ID', this.form_editCheckContentBase.ID]
var Data = this.CreateData('12', 'CATL_基础_OCC_编辑', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
Toast.success('编辑成功!')
this.dialogFormVisible_editCheckContentBase = false
this.searchTableCheckContentBase()
} else {
Toast.fail('编辑失败!')
}
})
})
},
editCheckContentBase_cancel(formName) {
this.dialogFormVisible_editCheckContentBase = false
this.$refs[formName].resetValidation()
},
deleteCheckContentBase(row) {
Dialog.confirm({
title: '删除提示',
message: `是否删除检查项`,
})
.then(() => {
var param = []
param[0] = ['ID', row.ID]
var Data = this.CreateData('12', 'CATL_基础_OCC_删除', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
Toast.success('检查项删除成功!')
// this.$message({
// message: '检查项删除成功',
// type: 'success'
// })
this.searchTableCheckContentBase()
} else {
Toast.fail('检查项删除失败!')
// this.$message.error('检查项删除失败!')
}
})
})
.catch(() => {
})
//
// this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
//
// }).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// })
// })
},
getCheckContentBase_station(params, index) {
this.form_addCheckContentBase.stationNumberValue = this.stationNumber[index].value
this.form_addCheckContentBase.stationName = params
this.form_editCheckContentBase.stationNumberValue = this.stationNumber[index].value
this.form_editCheckContentBase.stationName = params
this.stationNumberValue = this.stationNumber[index].value
this.stationNumberValueShow = params
this.dialogFormVisible_addCheckContentBase_selectStation = false
this.searchTableCheckContentBase()
},
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.姓名]
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,412 @@
<template>
<div class="app-container">
<van-card class="s-card" style="height: 100vh">
<template #tags>
<van-form @submit="RepairManagementReplaceSubmit" ref="occCreateForm">
<van-field
v-model="occCreateForm.productCode"
ref="occCreateFormProductCode"
left-icon="scan"
name="产品编号"
label="产品编号"
clearable
placeholder="请扫描产品编号"
:rules="[{ required: true, message: '请扫描产品编号' }]"
/>
<van-field
readonly
clickable
left-icon="label-o"
name="picker"
:value="occCreateForm.problem"
label="问题点"
placeholder="点击选择问题点"
:rules="[{ required: true, message: '点击选择问题点' }]"
@click="dialogFormVisible_CheckContent = true"
/>
<van-field
left-icon="comment-o"
v-model="occCreateForm.remake"
rows="4"
autosize
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() {
if(localStorage.getItem('userInfo') === '' || localStorage.getItem('userInfo') === null) {
alert('账号失效,请重新登录')
this.$router.push('/')
}
this.userInfo = localStorage.getItem('userInfo') === '' ? {} : JSON.parse(localStorage.getItem('userInfo'))
console.log(this.userInfo)
this.getStationNumber()
this.searchCheckContentBase('')
},
mounted() {
document.getElementById('topPageName').innerText = 'NC记录'
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.姓名]
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,403 @@
<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: 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.放行方式 === '合格放行'" 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 plain icon="completed-o" size="small" type="primary" style="margin-top: 10px" @click="solveNc(item)">图片上传</van-button>
<br>
<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>
<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="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">
<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="showTableData_content_exchange1 = false">关闭</van-button>
<van-button type="info" native-type="submit" style="width: 100%" @click="reportPicUpload()">上传</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: 1,
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,
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() {
if(localStorage.getItem('userInfo') === '' || localStorage.getItem('userInfo') === null) {
alert('账号失效,请重新登录')
this.$router.push('/')
}
// 获取今日日期
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] = ['状态', 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项目')
}
})
},
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) {
try {
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(response.data[i]['附件内容']))
}
}
} catch (e) {
}
this.RepairManagementDataTableOrigin = response.data
this.showTableData_content_exchange = true
} else {
this.showTableData_content_exchange = true
this.RepairManagementDataTableOrigin = []
}
})
},
showPic(item) {
ImagePreview({
images: [
item.url
]
});
},
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); //获取上传图片信息
};
},
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,697 @@
<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>
<el-button v-if="!isSelectMode" type="primary" size="small" style="margin-left: 10px;" @click="enterSelectMode">批量处理</el-button>
<el-button v-if="isSelectMode" type="default" size="small" style="margin-left: 10px;" @click="exitSelectMode">取消选择</el-button>
<el-button v-if="isSelectMode" type="warning" size="small" style="margin-left: 5px;" @click="selectAll">全选</el-button>
<el-button v-if="isSelectMode" type="info" size="small" style="margin-left: 5px;" @click="unselectAll">取消全选</el-button>
</div>
</el-row>
<el-row :style="'overflow: auto;height: 730px;' + (isSelectMode ? 'margin-bottom: 60px;' : '')">
<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-col span="18">
<van-tag type="primary" size="large">{{index+1 }}</van-tag>
<van-tag type="success" size="large">{{item.产品编号 }}</van-tag>
</van-col>
<van-col span="6" v-if="isSelectMode" style="text-align: right;">
<van-checkbox
v-model="item.selected"
:disabled="item.合格放行 !== 0"
@change="handleItemSelect(item)"
style="margin-top: 5px;">
</van-checkbox>
</van-col>
</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" v-if="!isSelectMode">
<van-button plain icon="completed-o" size="small" type="primary" style="margin-top: 10px" @click="solveNc(item)">NC处理</van-button>
</van-col>
</van-row>
</template>
</van-card>
</van-cell>
</van-list>
</el-row>
<!-- 批量处理底部操作栏 -->
<div v-if="isSelectMode" class="batch-bottom-bar">
<van-row>
<van-col span="12">
<div style="padding: 10px; text-align: center;">
<span>已选择: {{ multipleSelection.length }} / {{ getUnprocessedCount() }} </span>
<br>
<span style="font-size: 12px; color: #666;">仅显示可处理项目</span>
</div>
</van-col>
<van-col span="12">
<van-button
type="primary"
size="large"
style="width: 100%; margin: 5px 5px 5px 0;"
:disabled="multipleSelection.length === 0"
@click="showBatchProcessDialog">
确认处理 ({{ multipleSelection.length }})
</van-button>
</van-col>
</van-row>
</div>
<van-dialog
v-model="showTableData_content_exchange"
width="70%"
title="NC处理"
: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
v-model="RepairManagementReplaceForm.solveRemark"
name="solveRemark"
label="处理备注"
type="textarea"
placeholder="请输入处理备注"
:autosize="{ minHeight: 60 }"
/>
<van-field name="uploader" label="照片上传">
<template #input>
<van-uploader
v-model="uploader"
:after-read="afterRead"
:max-count="9"
:before-read='beforeRead'
upload-text="选择照片"
multiple
/>
</template>
<template #label>
<span>照片上传</span>
<span style="color: #999; font-size: 12px; margin-left: 5px;">最多9张</span>
</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>
<!-- 批量处理对话框 -->
<van-dialog
v-model="showBatchDialog"
title="批量处理NC"
width="80%"
:lock-scroll="false"
:show-cancel-button="false"
:show-confirm-button="false"
style="max-height: 60%!important;overflow: auto"
>
<van-form validate-first ref="batchForm">
<van-field
readonly
clickable
name="solveType"
:value="batchForm.solveType"
label="处理方式"
placeholder="点击选择处理方式"
@click="batchSolveTypeShow = true"
:rules="[{ required: true, message: '请选择处理方式' }]"
/>
<van-field
v-model="batchForm.solveRemark"
name="solveRemark"
label="处理备注"
type="textarea"
placeholder="请输入处理备注"
:autosize="{ minHeight: 60 }"
/>
<div style="background-color: white;text-align: center;margin-top: 10px;display: flex;">
<van-button type="default" style="width: 100%" @click="closeBatchDialog">取消</van-button>
<van-button type="info" style="width: 100%" @click="submitBatchProcess">确定</van-button>
</div>
</van-form>
</van-dialog>
<!-- 批量处理方式选择 -->
<van-popup v-model="batchSolveTypeShow" position="bottom">
<van-picker
title="选择处理方式"
show-toolbar
:columns="solveTypeList"
@confirm="getBatchSolveType"
@cancel="batchSolveTypeShow = false"
/>
</van-popup>
</div>
</template>
<script>
import {Dialog, Toast} from 'vant'
import axios from 'axios'
import {formatDate, getBeforeOrAfterTime, getNowTime2} from '../../../utils/tool'
import * as imageConversion from 'image-conversion'
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: '',
solveRemark: ''
},
solveTypeList: ['合格放行','偏差放行','返工放行'],
solveTypeShow: false,
uploader: [],
compressedFiles: [], // 存储压缩后的文件
isUploading: false, // 上传状态
// 批量处理相关数据
isSelectMode: false,
multipleSelection: [],
showBatchDialog: false,
batchForm: {
solveType: '',
solveRemark: '',
solvePeople: ''
},
batchSolveTypeShow: false,
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() {
if(localStorage.getItem('userInfo') === '' || localStorage.getItem('userInfo') === null) {
alert('账号失效,请重新登录')
this.$router.push('/')
}
// 获取今日日期
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 = 'NC处理'
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] = ['状态', 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
// 为每个项目初始化selected属性
this.RepairManagementDataLogTable.forEach(item => {
this.$set(item, 'selected', false)
})
} else {
this.RepairManagementDataLogTable = []
Toast.fail('不存在NC项目')
}
})
},
solveNc(row) {
this.showTableData_content_exchange = true
this.RepairManagementReplaceForm.ID = row.ID
this.RepairManagementReplaceForm.productCode = row.产品编号
this.RepairManagementReplaceForm.solvePeople = this.userInfo.姓名
this.RepairManagementReplaceForm.solveType = '' // 清空处理方式
this.RepairManagementReplaceForm.solveRemark = '' // 清空处理备注
this.uploader = []
this.compressedFiles = [] // 清空压缩文件列表
},
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]
param[3] = ['处理备注', this.RepairManagementReplaceForm.solveRemark]
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 files = Array.isArray(file) ? file : [file];
for (let i = 0; i < files.length; i++) {
const singleFile = files[i];
const imgformat = /image\/(png|jpg|jpeg)$/;
if (!imgformat.test(singleFile.type)) {
Toast.fail(`${i + 1}个文件格式不正确,请上传 jpg/jpeg/png 格式图片`);
return false;
}
if (singleFile.size > 20 * 1024 * 1024) {
Toast.fail(`${i + 1}个文件大小超过 20M请选择较小的文件`);
return false;
}
}
// 如果是多文件,给用户提示
if (files.length > 1) {
Toast.success(`已选择${files.length}张照片,正在压缩处理...`);
}
return true
},
afterRead(file){
// 支持多文件上传file可能是单个文件或文件数组
const files = Array.isArray(file) ? file : [file];
files.forEach((singleFile, index) => {
let canvas = document.createElement('canvas'); // 创建Canvas对象(画布)
let context = canvas.getContext('2d');
let img = new Image();
img.src = singleFile.content; // 指定图片的DataURL(图片的base64编码数据)
img.onload = () => {
// 画布大小
canvas.width = img.width;
canvas.height = img.height;
context.drawImage(img, 0, 0, img.width, img.height); // 图片大小
const dataurl = canvas.toDataURL(singleFile.file.type, 0.5); // 压缩质量0.5
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], singleFile.file.name, {type: mime});
// 将压缩后的文件添加到数组中
this.compressedFiles.push({
file: fileNew,
name: singleFile.file.name,
originalFile: singleFile
});
};
});
},
reportPicUpload() {
//如果文件列表为空,则不需要调用上传
if(this.compressedFiles == null || this.compressedFiles.length === 0){
this.getTable2()
return
}
this.isUploading = true;
Toast.loading({
message: `正在上传第1个附件${this.compressedFiles.length}个...`,
forbidClick: true,
duration: 0
});
// 逐个上传文件
this.uploadFilesSequentially(0);
},
uploadFilesSequentially(index) {
if (index >= this.compressedFiles.length) {
// 所有文件上传完成
this.isUploading = false;
Toast.clear();
Toast.success(`${this.compressedFiles.length}个附件上传成功!`);
this.showTableData_content_exchange = false
this.compressedFiles = [] // 清空文件列表
this.getTable2()
return
}
// 更新上传进度提示
if (index > 0) {
Toast.loading({
message: `正在上传第${index + 1}个附件,共${this.compressedFiles.length}个...`,
forbidClick: true,
duration: 0
});
}
const currentFile = this.compressedFiles[index];
const formData = new FormData();
formData.append("file", currentFile.file);
var param = []
param[0] = ['OCC_ID', this.RepairManagementReplaceForm.ID]
param[1] = ['文件名称', '']
param[2] = ['文件后缀', '']
param[3] = ['文件内容', null]
var Data1 = this.CreateData('15', 'CATL_OCC_历史附件_增加', param)
const uploadData = { param: Data1 };
axios({
method: "post",
url: window.dt_Config.requestConfig,
params: uploadData,
data: formData,
}).then((res) => {
if(res.status === 200){
// 当前文件上传成功,继续上传下一个
this.uploadFilesSequentially(index + 1);
}else{
this.isUploading = false;
Toast.clear();
Toast.fail(`${index + 1}个附件上传失败!`);
}
}).catch((error) => {
this.isUploading = false;
Toast.clear();
Toast.fail(`${index + 1}个附件上传失败!`);
console.error('Upload error:', error);
})
},
addCheckOrder_cancel(formName) {
this.showTableData_content_exchange = false
this.RepairManagementReplaceForm.solveType = '' // 清空处理方式
this.RepairManagementReplaceForm.solveRemark = '' // 清空处理备注
this.compressedFiles = [] // 清空压缩文件列表
this.isUploading = false
Toast.clear() // 清除loading提示
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()
},
// 批量处理相关方法
enterSelectMode() {
this.isSelectMode = true
this.multipleSelection = []
// 为每个项目添加selected属性
this.RepairManagementDataLogTable.forEach(item => {
this.$set(item, 'selected', false)
})
},
exitSelectMode() {
this.isSelectMode = false
this.multipleSelection = []
// 清除selected属性
this.RepairManagementDataLogTable.forEach(item => {
this.$set(item, 'selected', false)
})
},
selectAll() {
this.multipleSelection = []
this.RepairManagementDataLogTable.forEach(item => {
// 只选择未处理的项目
if (item.合格放行 === 0) {
this.$set(item, 'selected', true)
this.multipleSelection.push(item)
}
})
if (this.multipleSelection.length > 0) {
Toast.success(`已选择 ${this.multipleSelection.length} 个未处理项目`)
} else {
Toast.fail('当前列表中没有可处理的NC项目')
}
},
unselectAll() {
this.multipleSelection = []
this.RepairManagementDataLogTable.forEach(item => {
this.$set(item, 'selected', false)
})
Toast.success('已取消全部选择')
},
handleItemSelect(item) {
if (item.selected) {
// 添加到选中列表
if (!this.multipleSelection.find(selected => selected.ID === item.ID)) {
this.multipleSelection.push(item)
}
} else {
// 从选中列表移除
const index = this.multipleSelection.findIndex(selected => selected.ID === item.ID)
if (index > -1) {
this.multipleSelection.splice(index, 1)
}
}
},
showBatchProcessDialog() {
if (this.multipleSelection.length === 0) {
Toast.fail('请选择要处理的NC项目')
return
}
this.batchForm.solveType = ''
this.batchForm.solveRemark = ''
this.batchForm.solvePeople = this.userInfo.姓名
this.showBatchDialog = true
},
getBatchSolveType(value) {
this.batchForm.solveType = value
this.batchSolveTypeShow = false
},
closeBatchDialog() {
this.showBatchDialog = false
this.$refs.batchForm.resetValidation()
},
submitBatchProcess() {
this.$refs.batchForm.validate().then(() => {
const idGroup = this.multipleSelection.map(item => item.ID)
const param = []
param[0] = ['ID组', idGroup]
param[1] = ['放行方式', this.batchForm.solveType]
param[2] = ['处理人', this.batchForm.solvePeople]
param[3] = ['处理备注', this.batchForm.solveRemark]
const Data = this.CreateData('12', 'CATL_OCC_历史处理_批量增加', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
Toast.success('批量处理成功!')
this.showBatchDialog = false
this.exitSelectMode()
this.getTable2()
} else {
Toast.fail('批量处理失败!')
}
})
}).catch(er => {})
},
getUnprocessedCount() {
return this.RepairManagementDataLogTable.filter(item => item.合格放行 === 0).length
},
}
}
</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;
}
.batch-bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: white;
border-top: 1px solid #eee;
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
z-index: 1000;
}
</style>

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

@@ -0,0 +1,293 @@
<template>
<div class="main">
<div class="content">
<div class="h01">充电宝OQC系统</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>
<!-- <el-button @click.native.prevent="signInTest">测试登陆</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'
},
signInTest() {
this.username = '0000'
this.password = 'admin'
this.signIn()
},
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])
this.getRole(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)
})
}
},
getRole(id) {
localStorage.tokenCode = 3
const param = {
method: 'post',
data: {
type: '1',
name: 'CATL_三级权限_查询节点',
param: `人员编号=${id}`
}
}
request(param).then(response => {
if(response.data.length > 0) {
let TokenCode = 3
if (response.data.length > 0) {
TokenCode = response.data[0]['当前权限']
}
localStorage.tokenCode = TokenCode
}
}).catch(err => {
console.log(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>

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

@@ -0,0 +1,163 @@
<template>
<div class="main" style="height: 800px;overflow:auto;">
<van-row>
<div style="margin-left: 50px;display: flex;align-items: center;">
<van-icon name="friends-o" size="50" color="#1989fa" />
<span style="font-size: 30px">{{userInfo.姓名}}</span>
</div>
</van-row>
<div style="display: flex;flex-wrap: wrap;">
<van-button class="big-btn" type="info" @click="routeJump('OccCreate')">
<van-icon name="notes-o" size="60" color="#ffffff" />
<br>
<i>NC记录</i>
</van-button>
<van-button v-if="tokenCode === 1 || tokenCode === 2 " class="big-btn" type="primary" @click="routeJump('OccSolve')">
<van-icon name="notes-o" size="60" color="#ffffff" />
<br>
<i>NC处理</i>
</van-button>
<van-button class="big-btn" type="info" @click="routeJump('LoadingCard')">
<van-icon name="newspaper-o" size="60" color="#ffffff" />
<br>
<i>随车卡</i>
</van-button>
<van-button class="big-btn" type="warning" @click="routeJump('OccBase')">
<van-icon name="records-o" size="60" color="#ffffff" />
<br>
<i>数据维护</i>
</van-button>
<van-button class="big-btn" type="warning" @click="routeJump('OccSearch')">
<van-icon name="todo-list-o" size="60" color="#ffffff" />
<br>
<i>历史查询</i>
</van-button>
<van-button class="big-btn" type="danger" @click="routeJump('')">
<van-icon name="contact-o" size="60" color="#ffffff" />
<br>
<i>退出登录</i>
</van-button>
</div>
<!-- <van-row>-->
<!-- <van-col span="12">-->
<!-- <van-button class="big-btn" type="info" @click="routeJump('OccCreate')">-->
<!-- <van-icon name="notes-o" size="60" color="#ffffff" />-->
<!-- <br>-->
<!-- <i>NC记录</i>-->
<!-- </van-button>-->
<!-- </van-col>-->
<!-- <van-col span="12">-->
<!-- <van-button class="big-btn" type="primary" @click="routeJump('OccSolve')">-->
<!-- <van-icon name="notes-o" size="60" color="#ffffff" />-->
<!-- <br>-->
<!-- <i>NC处理</i>-->
<!-- </van-button>-->
<!-- </van-col>-->
<!-- </van-row>-->
<!-- <van-row>-->
<!-- <van-col span="12">-->
<!-- <van-button class="big-btn" type="warning" @click="routeJump('OccBase')">-->
<!-- <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="warning" @click="routeJump('OccSearch')">-->
<!-- <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="danger" @click="routeJump('')">-->
<!-- <van-icon name="contact-o" size="60" color="#ffffff" />-->
<!-- <br>-->
<!-- <i>退出登录</i>-->
<!-- </van-button>-->
<!-- </van-col>-->
<!-- </van-row>-->
<!-- <van-row v-if="planCount !== 0">-->
<!-- <div style="margin-left: 50px;display: flex;align-items: center;">-->
<!-- <van-icon name="info-o" size="30" color="#1989fa" />-->
<!-- <span style="font-size: 20px">消息提醒</span>-->
<!-- <span style="font-size: 20px">共有{{planCount}}待执行的计划<a style="font-size: 25px;padding: 0 10px;color: #3a8ee6" @click="routeJump('CheckPlanExec')">前去执行</a></span>-->
<!-- </div>-->
<!-- </van-row>-->
</div>
</template>
<script>
import {getBeforeOrAfterTime, getNowTime2} from '../utils/tool'
export default {
computed: {},
components: {},
watch: {},
props: {},
data() {
return {
planCount: 0,
pageCurrent: 1,
pageSize: 10000,
tokenCode: 3,
dateTime: [],
userInfo: {
姓名: ''
}
}
},
created() {
if(localStorage.getItem('userInfo') === '' || localStorage.getItem('userInfo') === null) {
alert('账号失效,请重新登录')
this.$router.push('/')
}
this.dateTime = [getBeforeOrAfterTime(-30), getNowTime2()]
this.userInfo = localStorage.getItem('userInfo') === '' ? {} : JSON.parse(localStorage.getItem('userInfo'))
this.tokenCode= localStorage.getItem('tokenCode') === '' ? 3 : parseInt(localStorage.getItem('tokenCode'))
// this.fetchData()
},
mounted() {
document.getElementById('topPageName').innerText = '充电宝OQC系统'
},
methods: {
routeJump(val){
if (val.indexOf('/') !== -1) {
val = val.substring(1)
}
this.$router.push({
path: '/' + val
})
},
fetchData() {
var param = []
param[0] = ['开始日期', this.dateTime[0]]
param[1] = ['结束日期', this.dateTime[1]]
param[2] = ['检验员id', this.userInfo['人员编号']]
param[3] = ['PageCurrent', this.pageCurrent]
param[4] = ['PageSize', this.pageSize]
param[5] = ['PageCount', 1000, 'int', '1']
param[6] = ['ItemCount', 1000, 'int', '1']
var Data = this.CreateData('11', '质检_工单_未完成_查询', param)
this.ExecDatabase(Data).then(response => {
this.planCount = parseInt(response.data.output[0].ItemCount)
})
},
},
}
</script>
<style lang="less" scoped>
.main {
margin-top: 60px;
}
.big-btn {
margin: 20px 30px;
height: 250px;
width: 230px;
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

9
static/config.js Normal file
View File

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

3
vue.config.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = {
transpileDependencies: ['uview-ui']
}

11309
yarn.lock Normal file

File diff suppressed because it is too large Load Diff