Commit 1f92bf9a by 温丽香

ci/cd

1 parent 19a0d507
Pipeline #3290 failed
in 1 minute 54 seconds
src/client/* src/client/*
src/components/select/*
\ No newline at end of file
stages:
- build-dev
variables:
CONFIG_DEV: ./public/config.js
# 开发构建
build-dev:
stage: build-dev
script:
- docker-compose build && docker-compose -p device_manage up -d
only:
- develop
tags:
- develop
FROM node:lts-alpine3.12 as build
# RUN npm config set registry https://registry.npm.taobao.org
WORKDIR /tmp/cache
COPY package.json .
COPY package-lock.json .
RUN npm install
COPY . .
RUN npm run build
FROM socialengine/nginx-spa:latest as nginx
COPY --from=build /tmp/cache/dist /app
version: "3.7"
services:
aiot_control:
container_name: device_manage
restart: always
image: device_manage:${CI_COMMIT_REF_NAME}
build:
dockerfile: Dockerfile
context: .
volumes:
- /ssl:/app/ssl
ports:
- 9998:80
\ No newline at end of file
...@@ -2707,6 +2707,65 @@ ...@@ -2707,6 +2707,65 @@
} }
} }
}, },
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
"dev": true,
"requires": {
"chalk": "^1.1.3",
"esutils": "^2.0.2",
"js-tokens": "^3.0.2"
},
"dependencies": {
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
},
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
"dev": true
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
}
},
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
"dev": true
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
"dev": true
}
}
},
"babel-eslint": { "babel-eslint": {
"version": "10.1.0", "version": "10.1.0",
"resolved": "https://registry.npm.taobao.org/babel-eslint/download/babel-eslint-10.1.0.tgz", "resolved": "https://registry.npm.taobao.org/babel-eslint/download/babel-eslint-10.1.0.tgz",
...@@ -2721,6 +2780,133 @@ ...@@ -2721,6 +2780,133 @@
"resolve": "^1.12.0" "resolve": "^1.12.0"
} }
}, },
"babel-helper-builder-binary-assignment-operator-visitor": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz",
"integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=",
"dev": true,
"requires": {
"babel-helper-explode-assignable-expression": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-helper-call-delegate": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz",
"integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=",
"dev": true,
"requires": {
"babel-helper-hoist-variables": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helper-define-map": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz",
"integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=",
"dev": true,
"requires": {
"babel-helper-function-name": "^6.24.1",
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"lodash": "^4.17.4"
}
},
"babel-helper-explode-assignable-expression": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz",
"integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helper-function-name": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz",
"integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=",
"dev": true,
"requires": {
"babel-helper-get-function-arity": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helper-get-function-arity": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz",
"integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-helper-hoist-variables": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz",
"integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-helper-optimise-call-expression": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz",
"integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-helper-regex": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz",
"integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"lodash": "^4.17.4"
}
},
"babel-helper-remap-async-to-generator": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz",
"integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=",
"dev": true,
"requires": {
"babel-helper-function-name": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helper-replace-supers": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz",
"integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=",
"dev": true,
"requires": {
"babel-helper-optimise-call-expression": "^6.24.1",
"babel-messages": "^6.23.0",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helper-vue-jsx-merge-props": { "babel-helper-vue-jsx-merge-props": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz", "resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
...@@ -2738,6 +2924,24 @@ ...@@ -2738,6 +2924,24 @@
"schema-utils": "^2.6.5" "schema-utils": "^2.6.5"
} }
}, },
"babel-messages": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
"integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-check-es2015-constants": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz",
"integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-dynamic-import-node": { "babel-plugin-dynamic-import-node": {
"version": "2.3.3", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
...@@ -2777,6 +2981,417 @@ ...@@ -2777,6 +2981,417 @@
"@babel/helper-define-polyfill-provider": "^0.2.2" "@babel/helper-define-polyfill-provider": "^0.2.2"
} }
}, },
"babel-plugin-syntax-async-functions": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz",
"integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=",
"dev": true
},
"babel-plugin-syntax-exponentiation-operator": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz",
"integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=",
"dev": true
},
"babel-plugin-syntax-jsx": {
"version": "6.18.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz",
"integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=",
"dev": true
},
"babel-plugin-syntax-trailing-function-commas": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz",
"integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=",
"dev": true
},
"babel-plugin-transform-async-to-generator": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz",
"integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=",
"dev": true,
"requires": {
"babel-helper-remap-async-to-generator": "^6.24.1",
"babel-plugin-syntax-async-functions": "^6.8.0",
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-arrow-functions": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz",
"integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-block-scoped-functions": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz",
"integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-block-scoping": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz",
"integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"babel-template": "^6.26.0",
"babel-traverse": "^6.26.0",
"babel-types": "^6.26.0",
"lodash": "^4.17.4"
}
},
"babel-plugin-transform-es2015-classes": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz",
"integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=",
"dev": true,
"requires": {
"babel-helper-define-map": "^6.24.1",
"babel-helper-function-name": "^6.24.1",
"babel-helper-optimise-call-expression": "^6.24.1",
"babel-helper-replace-supers": "^6.24.1",
"babel-messages": "^6.23.0",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-computed-properties": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz",
"integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-plugin-transform-es2015-destructuring": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz",
"integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-duplicate-keys": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz",
"integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-for-of": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz",
"integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-function-name": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz",
"integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=",
"dev": true,
"requires": {
"babel-helper-function-name": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-literals": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz",
"integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-modules-amd": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz",
"integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=",
"dev": true,
"requires": {
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-plugin-transform-es2015-modules-commonjs": {
"version": "6.26.2",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz",
"integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==",
"dev": true,
"requires": {
"babel-plugin-transform-strict-mode": "^6.24.1",
"babel-runtime": "^6.26.0",
"babel-template": "^6.26.0",
"babel-types": "^6.26.0"
}
},
"babel-plugin-transform-es2015-modules-systemjs": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz",
"integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=",
"dev": true,
"requires": {
"babel-helper-hoist-variables": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-plugin-transform-es2015-modules-umd": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz",
"integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=",
"dev": true,
"requires": {
"babel-plugin-transform-es2015-modules-amd": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-plugin-transform-es2015-object-super": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz",
"integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=",
"dev": true,
"requires": {
"babel-helper-replace-supers": "^6.24.1",
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-parameters": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz",
"integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=",
"dev": true,
"requires": {
"babel-helper-call-delegate": "^6.24.1",
"babel-helper-get-function-arity": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-shorthand-properties": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz",
"integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-spread": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz",
"integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-sticky-regex": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz",
"integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=",
"dev": true,
"requires": {
"babel-helper-regex": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-template-literals": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz",
"integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-typeof-symbol": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz",
"integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-es2015-unicode-regex": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz",
"integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=",
"dev": true,
"requires": {
"babel-helper-regex": "^6.24.1",
"babel-runtime": "^6.22.0",
"regexpu-core": "^2.0.0"
},
"dependencies": {
"jsesc": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true
},
"regexpu-core": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz",
"integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=",
"dev": true,
"requires": {
"regenerate": "^1.2.1",
"regjsgen": "^0.2.0",
"regjsparser": "^0.1.4"
}
},
"regjsgen": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz",
"integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=",
"dev": true
},
"regjsparser": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz",
"integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=",
"dev": true,
"requires": {
"jsesc": "~0.5.0"
}
}
}
},
"babel-plugin-transform-exponentiation-operator": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz",
"integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=",
"dev": true,
"requires": {
"babel-helper-builder-binary-assignment-operator-visitor": "^6.24.1",
"babel-plugin-syntax-exponentiation-operator": "^6.8.0",
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-regenerator": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz",
"integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=",
"dev": true,
"requires": {
"regenerator-transform": "^0.10.0"
},
"dependencies": {
"regenerator-transform": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz",
"integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==",
"dev": true,
"requires": {
"babel-runtime": "^6.18.0",
"babel-types": "^6.19.0",
"private": "^0.1.6"
}
}
}
},
"babel-plugin-transform-strict-mode": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz",
"integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-vue-jsx": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-vue-jsx/-/babel-plugin-transform-vue-jsx-3.7.0.tgz",
"integrity": "sha512-W39X07/n3oJMQd8tALBO+440NraGSF//Lo1ydd/9Nme3+QiRGFBb1Q39T9iixh0jZPPbfv3so18tNoIgLatymw==",
"dev": true,
"requires": {
"esutils": "^2.0.2"
}
},
"babel-preset-env": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz",
"integrity": "sha512-9OR2afuKDneX2/q2EurSftUYM0xGu4O2D9adAhVfADDhrYDaxXV0rBbevVYoY9n6nyX1PmQW/0jtpJvUNr9CHg==",
"dev": true,
"requires": {
"babel-plugin-check-es2015-constants": "^6.22.0",
"babel-plugin-syntax-trailing-function-commas": "^6.22.0",
"babel-plugin-transform-async-to-generator": "^6.22.0",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoping": "^6.23.0",
"babel-plugin-transform-es2015-classes": "^6.23.0",
"babel-plugin-transform-es2015-computed-properties": "^6.22.0",
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
"babel-plugin-transform-es2015-duplicate-keys": "^6.22.0",
"babel-plugin-transform-es2015-for-of": "^6.23.0",
"babel-plugin-transform-es2015-function-name": "^6.22.0",
"babel-plugin-transform-es2015-literals": "^6.22.0",
"babel-plugin-transform-es2015-modules-amd": "^6.22.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.23.0",
"babel-plugin-transform-es2015-modules-systemjs": "^6.23.0",
"babel-plugin-transform-es2015-modules-umd": "^6.23.0",
"babel-plugin-transform-es2015-object-super": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.23.0",
"babel-plugin-transform-es2015-shorthand-properties": "^6.22.0",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es2015-sticky-regex": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-plugin-transform-es2015-typeof-symbol": "^6.23.0",
"babel-plugin-transform-es2015-unicode-regex": "^6.22.0",
"babel-plugin-transform-exponentiation-operator": "^6.22.0",
"babel-plugin-transform-regenerator": "^6.22.0",
"browserslist": "^3.2.6",
"invariant": "^2.2.2",
"semver": "^5.3.0"
},
"dependencies": {
"browserslist": {
"version": "3.2.8",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz",
"integrity": "sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==",
"dev": true,
"requires": {
"caniuse-lite": "^1.0.30000844",
"electron-to-chromium": "^1.3.47"
}
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
}
}
},
"babel-runtime": { "babel-runtime": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
...@@ -2798,6 +3413,79 @@ ...@@ -2798,6 +3413,79 @@
} }
} }
}, },
"babel-template": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz",
"integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"babel-traverse": "^6.26.0",
"babel-types": "^6.26.0",
"babylon": "^6.18.0",
"lodash": "^4.17.4"
}
},
"babel-traverse": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz",
"integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=",
"dev": true,
"requires": {
"babel-code-frame": "^6.26.0",
"babel-messages": "^6.23.0",
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"babylon": "^6.18.0",
"debug": "^2.6.8",
"globals": "^9.18.0",
"invariant": "^2.2.2",
"lodash": "^4.17.4"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"globals": {
"version": "9.18.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
"integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==",
"dev": true
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
}
}
},
"babel-types": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz",
"integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"esutils": "^2.0.2",
"lodash": "^4.17.4",
"to-fast-properties": "^1.0.3"
},
"dependencies": {
"to-fast-properties": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
"integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=",
"dev": true
}
}
},
"babel-walk": { "babel-walk": {
"version": "3.0.0-canary-5", "version": "3.0.0-canary-5",
"resolved": "https://registry.npmjs.org/babel-walk/-/babel-walk-3.0.0-canary-5.tgz", "resolved": "https://registry.npmjs.org/babel-walk/-/babel-walk-3.0.0-canary-5.tgz",
...@@ -2806,6 +3494,12 @@ ...@@ -2806,6 +3494,12 @@
"@babel/types": "^7.9.6" "@babel/types": "^7.9.6"
} }
}, },
"babylon": {
"version": "6.18.0",
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
"integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==",
"dev": true
},
"balanced-match": { "balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.2.tgz?cache=0&sync_timestamp=1617714233441&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbalanced-match%2Fdownload%2Fbalanced-match-1.0.2.tgz", "resolved": "https://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.2.tgz?cache=0&sync_timestamp=1617714233441&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbalanced-match%2Fdownload%2Fbalanced-match-1.0.2.tgz",
...@@ -7515,6 +8209,15 @@ ...@@ -7515,6 +8209,15 @@
} }
} }
}, },
"invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
"dev": true,
"requires": {
"loose-envify": "^1.0.0"
}
},
"ip": { "ip": {
"version": "1.1.5", "version": "1.1.5",
"resolved": "https://registry.npm.taobao.org/ip/download/ip-1.1.5.tgz", "resolved": "https://registry.npm.taobao.org/ip/download/ip-1.1.5.tgz",
...@@ -8630,6 +9333,15 @@ ...@@ -8630,6 +9333,15 @@
"integrity": "sha1-AF/eL15uRwaPk1/yhXPhJe9y8Zc=", "integrity": "sha1-AF/eL15uRwaPk1/yhXPhJe9y8Zc=",
"dev": true "dev": true
}, },
"loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
"dev": true,
"requires": {
"js-tokens": "^3.0.0 || ^4.0.0"
}
},
"loud-rejection": { "loud-rejection": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz",
...@@ -10695,6 +11407,12 @@ ...@@ -10695,6 +11407,12 @@
"renderkid": "^2.0.4" "renderkid": "^2.0.4"
} }
}, },
"private": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
"integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==",
"dev": true
},
"process": { "process": {
"version": "0.11.10", "version": "0.11.10",
"resolved": "https://registry.npm.taobao.org/process/download/process-0.11.10.tgz", "resolved": "https://registry.npm.taobao.org/process/download/process-0.11.10.tgz",
......
...@@ -58,7 +58,11 @@ ...@@ -58,7 +58,11 @@
"@vue/eslint-config-standard": "^4.0.0", "@vue/eslint-config-standard": "^4.0.0",
"@vue/eslint-config-typescript": "^4.0.0", "@vue/eslint-config-typescript": "^4.0.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-plugin-dynamic-import-node": "^2.3.3", "babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-env": "^1.7.0",
"echarts": "^4.8.0", "echarts": "^4.8.0",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
......
window.g = { window.g = {
baseURL: 'http://218.94.122.141:8089/api', baseURL: 'http://hzdev.seetatech.com:9997',
defaultLang: 'zh-CN', // 目前支持 zh-CN / ja-JP defaultLang: 'zh-CN', // 目前支持 zh-CN / ja-JP
} }
\ No newline at end of file
import axios from './http'
const GET = 'get'
const POST = 'post'
const FRONT = '/front'
const USER = '/user'
export const loginApi = data => axios(POST, FRONT + USER + '/login', data)
const PARAMETER = '/parameter'
export const getParameter = data => axios(GET, FRONT + PARAMETER + '/query_list', data)
const TABLE = '/table'
export const getTable = data => axios(GET, FRONT + TABLE + '/query_list', data)
...@@ -23,6 +23,7 @@ import seetaTable from './seeta-ui/seeta-table' ...@@ -23,6 +23,7 @@ import seetaTable from './seeta-ui/seeta-table'
// import seetaTooltip from './seeta-ui/seeta-tooltip.vue' // import seetaTooltip from './seeta-ui/seeta-tooltip.vue'
import seetaTabs from './seeta-ui/seeta-tabs.vue' import seetaTabs from './seeta-ui/seeta-tabs.vue'
import seetaSelect from './seeta-ui/seeta-select.vue' import seetaSelect from './seeta-ui/seeta-select.vue'
import packSelect from './select'
import seetaMenu from './seeta-ui/seeta-menu.vue' import seetaMenu from './seeta-ui/seeta-menu.vue'
import seetaCrumb from './seeta-ui/seeta-crumb.vue' import seetaCrumb from './seeta-ui/seeta-crumb.vue'
// import dateRange from './list-filter/date-range.vue' // import dateRange from './list-filter/date-range.vue'
...@@ -64,6 +65,7 @@ Vue.component('popup', popup) ...@@ -64,6 +65,7 @@ Vue.component('popup', popup)
// Vue.component('st-tooltip', seetaTooltip) // Vue.component('st-tooltip', seetaTooltip)
Vue.component('st-tabs', seetaTabs) Vue.component('st-tabs', seetaTabs)
Vue.component('st-select', seetaSelect) Vue.component('st-select', seetaSelect)
Vue.component('pack-select', packSelect)
Vue.component('st-menu', seetaMenu) Vue.component('st-menu', seetaMenu)
Vue.component('st-crumb', seetaCrumb) Vue.component('st-crumb', seetaCrumb)
Vue.component('puzzle-validator', puzzlevalidator) Vue.component('puzzle-validator', puzzlevalidator)
import Select from './src/select';
/* istanbul ignore next */
Select.install = function(Vue) {
Vue.component(Select.name, Select);
};
export default Select;
export default {
data() {
return {
hoverOption: -1
};
},
computed: {
optionsAllDisabled() {
return this.options.filter(option => option.visible).every(option => option.disabled);
}
},
watch: {
hoverIndex(val) {
if (typeof val === 'number' && val > -1) {
this.hoverOption = this.options[val] || {};
}
this.options.forEach(option => {
option.hover = this.hoverOption === option;
});
}
},
methods: {
navigateOptions(direction) {
if (!this.visible) {
this.visible = true;
return;
}
if (this.options.length === 0 || this.filteredOptionsCount === 0) return;
if (!this.optionsAllDisabled) {
if (direction === 'next') {
this.hoverIndex++;
if (this.hoverIndex === this.options.length) {
this.hoverIndex = 0;
}
} else if (direction === 'prev') {
this.hoverIndex--;
if (this.hoverIndex < 0) {
this.hoverIndex = this.options.length - 1;
}
}
const option = this.options[this.hoverIndex];
if (option.disabled === true ||
option.groupDisabled === true ||
!option.visible) {
this.navigateOptions(direction);
}
this.$nextTick(() => this.scrollToOption(this.hoverOption));
}
}
}
};
<template>
<ul class="el-select-group__wrap" v-show="visible">
<li class="el-select-group__title">{{ label }}</li>
<li>
<ul class="el-select-group">
<slot></slot>
</ul>
</li>
</ul>
</template>
<script type="text/babel">
import Emitter from 'element-ui/src/mixins/emitter';
export default {
mixins: [Emitter],
name: 'ElOptionGroup',
componentName: 'ElOptionGroup',
props: {
label: String,
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
visible: true
};
},
watch: {
disabled(val) {
this.broadcast('ElOption', 'handleGroupDisabled', val);
}
},
methods: {
queryChange() {
this.visible = this.$children &&
Array.isArray(this.$children) &&
this.$children.some(option => option.visible === true);
}
},
created() {
this.$on('queryChange', this.queryChange);
},
mounted() {
if (this.disabled) {
this.broadcast('ElOption', 'handleGroupDisabled', this.disabled);
}
}
};
</script>
<template>
<li
@mouseenter="hoverItem"
@click.stop="selectOptionClick"
class="el-select-dropdown__item"
v-show="visible"
:class="{
'selected': itemSelected,
'is-disabled': disabled || groupDisabled || limitReached,
'hover': hover
}">
<slot>
<span>{{ currentLabel }}</span>
</slot>
</li>
</template>
<script type="text/babel">
import Emitter from 'element-ui/src/mixins/emitter';
import { getValueByPath, escapeRegexpString } from 'element-ui/src/utils/util';
export default {
mixins: [Emitter],
name: 'ElOption',
componentName: 'ElOption',
inject: ['select'],
props: {
value: {
required: true
},
label: [String, Number],
created: Boolean,
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
index: -1,
groupDisabled: false,
visible: true,
hitState: false,
hover: false
};
},
computed: {
isObject() {
return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
},
currentLabel() {
return this.label || (this.isObject ? '' : this.value);
},
currentValue() {
return this.value || this.label || '';
},
itemSelected() {
if (!this.select.multiple) {
return this.isEqual(this.value, this.select.value);
} else {
return this.contains(this.select.value, this.value);
}
},
limitReached() {
if (this.select.multiple) {
return !this.itemSelected &&
(this.select.value || []).length >= this.select.multipleLimit &&
this.select.multipleLimit > 0;
} else {
return false;
}
}
},
watch: {
currentLabel() {
if (!this.created && !this.select.remote) this.dispatch('ElSelect', 'setSelected');
},
value(val, oldVal) {
const { remote, valueKey } = this.select;
if (!this.created && !remote) {
if (valueKey && typeof val === 'object' && typeof oldVal === 'object' && val[valueKey] === oldVal[valueKey]) {
return;
}
this.dispatch('ElSelect', 'setSelected');
}
}
},
methods: {
isEqual(a, b) {
if (!this.isObject) {
return a === b;
} else {
const valueKey = this.select.valueKey;
return getValueByPath(a, valueKey) === getValueByPath(b, valueKey);
}
},
contains(arr = [], target) {
if (!this.isObject) {
return arr && arr.indexOf(target) > -1;
} else {
const valueKey = this.select.valueKey;
return arr && arr.some(item => {
return getValueByPath(item, valueKey) === getValueByPath(target, valueKey);
});
}
},
handleGroupDisabled(val) {
this.groupDisabled = val;
},
hoverItem() {
if (!this.disabled && !this.groupDisabled) {
this.select.hoverIndex = this.select.options.indexOf(this);
}
},
selectOptionClick() {
if (this.disabled !== true && this.groupDisabled !== true) {
this.dispatch('ElSelect', 'handleOptionClick', [this, true]);
}
},
queryChange(query) {
this.visible = new RegExp(escapeRegexpString(query), 'i').test(this.currentLabel) || this.created;
if (!this.visible) {
this.select.filteredOptionsCount--;
}
}
},
created() {
this.select.options.push(this);
this.select.cachedOptions.push(this);
this.select.optionsCount++;
this.select.filteredOptionsCount++;
this.$on('queryChange', this.queryChange);
this.$on('handleGroupDisabled', this.handleGroupDisabled);
},
beforeDestroy() {
const { selected, multiple } = this.select;
let selectedOptions = multiple ? selected : [selected];
let index = this.select.cachedOptions.indexOf(this);
let selectedIndex = selectedOptions.indexOf(this);
// if option is not selected, remove it from cache
if (index > -1 && selectedIndex < 0) {
this.select.cachedOptions.splice(index, 1);
}
this.select.onOptionDestroy(this.select.options.indexOf(this));
}
};
</script>
<template>
<div
class="el-select-dropdown el-popper"
:class="[{ 'is-multiple': $parent.multiple }, popperClass]"
:style="{ minWidth: minWidth }">
<slot></slot>
</div>
</template>
<script type="text/babel">
import Popper from 'element-ui/src/utils/vue-popper';
export default {
name: 'ElSelectDropdown',
componentName: 'ElSelectDropdown',
mixins: [Popper],
props: {
placement: {
default: 'bottom-start'
},
boundariesPadding: {
default: 0
},
popperOptions: {
default() {
return {
gpuAcceleration: false
};
}
},
visibleArrow: {
default: true
},
appendToBody: {
type: Boolean,
default: true
}
},
data() {
return {
minWidth: ''
};
},
computed: {
popperClass() {
return this.$parent.popperClass;
}
},
watch: {
'$parent.inputWidth'() {
this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
}
},
mounted() {
this.referenceElm = this.$parent.$refs.reference.$el;
this.$parent.popperElm = this.popperElm = this.$el;
this.$on('updatePopper', () => {
if (this.$parent.visible) this.updatePopper();
});
this.$on('destroyPopper', this.destroyPopper);
}
};
</script>
<template>
<div
class="el-select"
:class="[selectSize ? 'el-select--' + selectSize : '']"
@click="toggleMenu"
v-clickoutside="handleClose">
<div
class="el-select__tags"
v-if="multiple"
ref="tags"
:style="{ 'max-width': inputWidth - 32 + 'px', width: '100%' }">
<span v-if="collapseTags && selected.length">
<el-tag
:closable="!selectDisabled"
:size="collapseTagSize"
:hit="selected[0].hitState"
type="info"
@close="deleteTag($event, selected[0])"
disable-transitions>
<span class="el-select__tags-text">{{ selected[0].currentLabel }}</span>
</el-tag>
<el-tag
v-if="selected.length > 1"
:closable="false"
:size="collapseTagSize"
type="info"
disable-transitions>
<span class="el-select__tags-text">+ {{ selected.length - 1 }}</span>
</el-tag>
</span>
<transition-group @after-leave="resetInputHeight" v-if="!collapseTags">
<el-tag
v-for="item in selected"
:key="getValueKey(item)"
:closable="!selectDisabled"
:size="collapseTagSize"
:hit="item.hitState"
type="info"
@close="deleteTag($event, item)"
disable-transitions>
<span class="el-select__tags-text">{{ item.currentLabel }}</span>
</el-tag>
</transition-group>
<input
type="text"
class="el-select__input"
:class="[selectSize ? `is-${ selectSize }` : '']"
:disabled="selectDisabled"
:autocomplete="autoComplete || autocomplete"
@focus="handleFocus"
@blur="softFocus = false"
@keyup="managePlaceholder"
@keydown="resetInputState"
@keydown.down.prevent="navigateOptions('next')"
@keydown.up.prevent="navigateOptions('prev')"
@keydown.enter.prevent="selectOption"
@keydown.esc.stop.prevent="visible = false"
@keydown.delete="deletePrevTag"
@keydown.tab="visible = false"
@compositionstart="handleComposition"
@compositionupdate="handleComposition"
@compositionend="handleComposition"
v-model="query"
@input="debouncedQueryChange"
v-if="filterable"
:style="{ 'flex-grow': '1', width: inputLength / (inputWidth - 32) + '%', 'max-width': inputWidth - 42 + 'px' }"
ref="input">
</div>
<el-input
ref="reference"
v-model="selectedLabel"
type="text"
:placeholder="currentPlaceholder"
:name="name"
:id="id"
:autocomplete="autoComplete || autocomplete"
:size="selectSize"
:disabled="selectDisabled"
:readonly="readonly"
:validate-event="false"
:class="{ 'is-focus': visible }"
:tabindex="(multiple && filterable) ? '-1' : null"
@focus="handleFocus"
@blur="handleBlur"
@keyup.native="debouncedOnInputChange"
@keydown.native.down.stop.prevent="navigateOptions('next')"
@keydown.native.up.stop.prevent="navigateOptions('prev')"
@keydown.native.enter.prevent="selectOption"
@keydown.native.esc.stop.prevent="visible = false"
@keydown.native.tab="visible = false"
@paste.native="debouncedOnInputChange"
@mouseenter.native="inputHovering = true"
@mouseleave.native="inputHovering = false">
<template slot="prefix" v-if="$slots.prefix">
<slot name="prefix"></slot>
</template>
<template slot="suffix">
<i v-show="!showClose" :class="['el-select__caret', 'el-input__icon', 'el-icon-' + iconClass]"></i>
<i v-if="showClose" class="el-select__caret el-input__icon el-icon-circle-close" @click="handleClearClick"></i>
</template>
</el-input>
<transition
name="el-zoom-in-top"
@before-enter="handleMenuEnter"
@after-leave="doDestroy">
<el-select-menu
ref="popper"
:append-to-body="popperAppendToBody"
v-show="visible && emptyText !== false">
<el-scrollbar
tag="ul"
wrap-class="el-select-dropdown__wrap"
view-class="el-select-dropdown__list"
ref="scrollbar"
:class="{ 'is-empty': !allowCreate && query && filteredOptionsCount === 0 }"
v-show="options.length > 0 && !loading">
<el-option
:value="query"
created
v-if="showNewOption">
</el-option>
<slot></slot>
</el-scrollbar>
<template v-if="emptyText && (!allowCreate || loading || (allowCreate && options.length === 0 ))">
<slot name="empty" v-if="$slots.empty"></slot>
<p class="el-select-dropdown__empty" v-else>
{{ emptyText }}
</p>
</template>
</el-select-menu>
</transition>
</div>
</template>
<script type="text/babel">
import Emitter from 'element-ui/src/mixins/emitter';
import Focus from 'element-ui/src/mixins/focus';
import Locale from 'element-ui/src/mixins/locale';
import ElInput from 'element-ui/packages/input';
import ElSelectMenu from './select-dropdown.vue';
import ElOption from './option.vue';
import ElTag from 'element-ui/packages/tag';
import ElScrollbar from 'element-ui/packages/scrollbar';
import debounce from 'throttle-debounce/debounce';
import Clickoutside from 'element-ui/src/utils/clickoutside';
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
import scrollIntoView from 'element-ui/src/utils/scroll-into-view';
import { getValueByPath, valueEquals, isIE, isEdge } from 'element-ui/src/utils/util';
import NavigationMixin from './navigation-mixin';
import { isKorean } from 'element-ui/src/utils/shared';
export default {
mixins: [Emitter, Locale, Focus('reference'), NavigationMixin],
name: 'ElSelect',
componentName: 'ElSelect',
inject: {
elForm: {
default: ''
},
elFormItem: {
default: ''
}
},
provide() {
return {
'select': this
};
},
computed: {
_elFormItemSize() {
return (this.elFormItem || {}).elFormItemSize;
},
readonly() {
return !this.filterable || this.multiple || (!isIE() && !isEdge() && !this.visible);
},
showClose() {
let hasValue = this.multiple
? Array.isArray(this.value) && this.value.length > 0
: this.value !== undefined && this.value !== null && this.value !== '';
let criteria = this.clearable &&
!this.selectDisabled &&
this.inputHovering &&
hasValue;
return criteria;
},
iconClass() {
return this.remote && this.filterable ? '' : (this.visible ? 'arrow-up is-reverse' : 'arrow-up');
},
debounce() {
return this.remote ? 300 : 0;
},
emptyText() {
if (this.loading) {
return this.loadingText || this.t('el.select.loading');
} else {
if (this.remote && this.query === '' && this.options.length === 0) return false;
if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
return this.noMatchText || this.t('el.select.noMatch');
}
if (this.options.length === 0) {
return this.noDataText || this.t('el.select.noData');
}
}
return null;
},
showNewOption() {
let hasExistingOption = this.options.filter(option => !option.created)
.some(option => option.currentLabel === this.query);
return this.filterable && this.allowCreate && this.query !== '' && !hasExistingOption;
},
selectSize() {
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
},
selectDisabled() {
return this.disabled || (this.elForm || {}).disabled;
},
collapseTagSize() {
return ['small', 'mini'].indexOf(this.selectSize) > -1
? 'mini'
: 'small';
},
propPlaceholder() {
return typeof this.placeholder !== 'undefined' ? this.placeholder : this.t('el.select.placeholder');
}
},
components: {
ElInput,
ElSelectMenu,
ElOption,
ElTag,
ElScrollbar
},
directives: { Clickoutside },
props: {
name: String,
id: String,
value: {
required: true
},
autocomplete: {
type: String,
default: 'off'
},
/** @Deprecated in next major version */
autoComplete: {
type: String,
validator(val) {
process.env.NODE_ENV !== 'production' &&
console.warn('[Element Warn][Select]\'auto-complete\' property will be deprecated in next major version. please use \'autocomplete\' instead.');
return true;
}
},
automaticDropdown: Boolean,
size: String,
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
allowCreate: Boolean,
loading: Boolean,
popperClass: String,
remote: Boolean,
loadingText: String,
noMatchText: String,
noDataText: String,
remoteMethod: Function,
filterMethod: Function,
multiple: Boolean,
multipleLimit: {
type: Number,
default: 0
},
placeholder: {
type: String,
required: false
},
defaultFirstOption: Boolean,
reserveKeyword: Boolean,
valueKey: {
type: String,
default: 'value'
},
collapseTags: Boolean,
popperAppendToBody: {
type: Boolean,
default: true
}
},
data() {
return {
options: [],
cachedOptions: [],
createdLabel: null,
createdSelected: false,
selected: this.multiple ? [] : {},
inputLength: 20,
inputWidth: 0,
initialInputHeight: 0,
cachedPlaceHolder: '',
optionsCount: 0,
filteredOptionsCount: 0,
visible: false,
softFocus: false,
selectedLabel: '',
hoverIndex: -1,
query: '',
previousQuery: null,
inputHovering: false,
currentPlaceholder: '',
menuVisibleOnFocus: false,
isOnComposition: false,
isSilentBlur: false
};
},
watch: {
selectDisabled() {
this.$nextTick(() => {
this.resetInputHeight();
});
},
propPlaceholder(val) {
this.cachedPlaceHolder = this.currentPlaceholder = val;
},
value(val, oldVal) {
if (this.multiple) {
this.resetInputHeight();
if ((val && val.length > 0) || (this.$refs.input && this.query !== '')) {
this.currentPlaceholder = '';
} else {
this.currentPlaceholder = this.cachedPlaceHolder;
}
if (this.filterable && !this.reserveKeyword) {
this.query = '';
this.handleQueryChange(this.query);
}
}
this.setSelected();
if (this.filterable && !this.multiple) {
this.inputLength = 20;
}
if (!valueEquals(val, oldVal)) {
this.dispatch('ElFormItem', 'el.form.change', val);
}
},
visible(val) {
if (!val) {
this.broadcast('ElSelectDropdown', 'destroyPopper');
if (this.$refs.input) {
this.$refs.input.blur();
}
this.query = '';
this.previousQuery = null;
this.selectedLabel = '';
this.inputLength = 20;
this.menuVisibleOnFocus = false;
this.resetHoverIndex();
this.$nextTick(() => {
if (this.$refs.input &&
this.$refs.input.value === '' &&
this.selected.length === 0) {
this.currentPlaceholder = this.cachedPlaceHolder;
}
});
if (!this.multiple) {
if (this.selected) {
if (this.filterable && this.allowCreate &&
this.createdSelected && this.createdLabel) {
this.selectedLabel = this.createdLabel;
} else {
this.selectedLabel = this.selected.currentLabel;
}
if (this.filterable) this.query = this.selectedLabel;
}
if (this.filterable) {
this.currentPlaceholder = this.cachedPlaceHolder;
}
}
} else {
this.broadcast('ElSelectDropdown', 'updatePopper');
if (this.filterable) {
this.query = this.remote ? '' : this.selectedLabel;
this.handleQueryChange(this.query);
if (this.multiple) {
this.$refs.input.focus();
} else {
if (!this.remote) {
this.broadcast('ElOption', 'queryChange', '');
this.broadcast('ElOptionGroup', 'queryChange');
}
if (this.selectedLabel) {
this.currentPlaceholder = this.selectedLabel;
this.selectedLabel = '';
}
}
}
}
this.$emit('visible-change', val);
},
options() {
if (this.$isServer) return;
this.$nextTick(() => {
this.broadcast('ElSelectDropdown', 'updatePopper');
});
if (this.multiple) {
this.resetInputHeight();
}
let inputs = this.$el.querySelectorAll('input');
if ([].indexOf.call(inputs, document.activeElement) === -1) {
this.setSelected();
}
if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
this.checkDefaultFirstOption();
}
}
},
methods: {
handleComposition(event) {
const text = event.target.value;
if (event.type === 'compositionend') {
this.isOnComposition = false;
this.$nextTick(_ => this.handleQueryChange(text));
} else {
const lastCharacter = text[text.length - 1] || '';
this.isOnComposition = !isKorean(lastCharacter);
}
},
handleQueryChange(val) {
if (this.previousQuery === val || this.isOnComposition) return;
if (
this.previousQuery === null &&
(typeof this.filterMethod === 'function' || typeof this.remoteMethod === 'function')
) {
this.previousQuery = val;
return;
}
this.previousQuery = val;
this.$nextTick(() => {
if (this.visible) this.broadcast('ElSelectDropdown', 'updatePopper');
});
this.hoverIndex = -1;
if (this.multiple && this.filterable) {
this.$nextTick(() => {
const length = this.$refs.input.value.length * 15 + 20;
this.inputLength = this.collapseTags ? Math.min(50, length) : length;
this.managePlaceholder();
this.resetInputHeight();
});
}
if (this.remote && typeof this.remoteMethod === 'function') {
this.hoverIndex = -1;
this.remoteMethod(val);
} else if (typeof this.filterMethod === 'function') {
this.filterMethod(val);
this.broadcast('ElOptionGroup', 'queryChange');
} else {
this.filteredOptionsCount = this.optionsCount;
this.broadcast('ElOption', 'queryChange', val);
this.broadcast('ElOptionGroup', 'queryChange');
}
if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
this.checkDefaultFirstOption();
}
},
scrollToOption(option) {
const target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
if (this.$refs.popper && target) {
const menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
scrollIntoView(menu, target);
}
this.$refs.scrollbar && this.$refs.scrollbar.handleScroll();
},
handleMenuEnter() {
this.$nextTick(() => this.scrollToOption(this.selected));
},
emitChange(val) {
if (!valueEquals(this.value, val)) {
this.$emit('change', val);
}
},
getOption(value) {
let option;
const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
const isNull = Object.prototype.toString.call(value).toLowerCase() === '[object null]';
const isUndefined = Object.prototype.toString.call(value).toLowerCase() === '[object undefined]';
for (let i = this.cachedOptions.length - 1; i >= 0; i--) {
const cachedOption = this.cachedOptions[i];
const isEqual = isObject
? getValueByPath(cachedOption.value, this.valueKey) === getValueByPath(value, this.valueKey)
: cachedOption.value === value;
if (isEqual) {
option = cachedOption;
break;
}
}
if (option) return option;
const label = (!isObject && !isNull && !isUndefined)
? String(value) : '';
let newOption = {
value: value,
currentLabel: label
};
if (this.multiple) {
newOption.hitState = false;
}
return newOption;
},
setSelected() {
if (!this.multiple) {
let option = this.getOption(this.value);
if (option.created) {
this.createdLabel = option.currentLabel;
this.createdSelected = true;
} else {
this.createdSelected = false;
}
this.selectedLabel = option.currentLabel;
this.selected = option;
if (this.filterable) this.query = this.selectedLabel;
return;
}
let result = [];
if (Array.isArray(this.value)) {
this.value.forEach(value => {
result.push(this.getOption(value));
});
}
this.selected = result;
this.$nextTick(() => {
this.resetInputHeight();
});
},
handleFocus(event) {
if (!this.softFocus) {
if (this.automaticDropdown || this.filterable) {
this.visible = true;
if (this.filterable) {
this.menuVisibleOnFocus = true;
}
}
this.$emit('focus', event);
} else {
this.softFocus = false;
}
},
blur() {
this.visible = false;
this.$refs.reference.blur();
},
handleBlur(event) {
setTimeout(() => {
if (this.isSilentBlur) {
this.isSilentBlur = false;
} else {
this.$emit('blur', event);
}
}, 50);
this.softFocus = false;
},
handleClearClick(event) {
this.deleteSelected(event);
},
doDestroy() {
this.$refs.popper && this.$refs.popper.doDestroy();
},
handleClose() {
this.visible = false;
},
toggleLastOptionHitState(hit) {
if (!Array.isArray(this.selected)) return;
const option = this.selected[this.selected.length - 1];
if (!option) return;
if (hit === true || hit === false) {
option.hitState = hit;
return hit;
}
option.hitState = !option.hitState;
return option.hitState;
},
deletePrevTag(e) {
if (e.target.value.length <= 0 && !this.toggleLastOptionHitState()) {
const value = this.value.slice();
value.pop();
this.$emit('input', value);
this.emitChange(value);
}
},
managePlaceholder() {
if (this.currentPlaceholder !== '') {
this.currentPlaceholder = this.$refs.input.value ? '' : this.cachedPlaceHolder;
}
},
resetInputState(e) {
if (e.keyCode !== 8) this.toggleLastOptionHitState(false);
this.inputLength = this.$refs.input.value.length * 15 + 20;
this.resetInputHeight();
},
resetInputHeight() {
if (this.collapseTags && !this.filterable) return;
this.$nextTick(() => {
if (!this.$refs.reference) return;
let inputChildNodes = this.$refs.reference.$el.childNodes;
let input = [].filter.call(inputChildNodes, item => item.tagName === 'INPUT')[0];
const tags = this.$refs.tags;
const sizeInMap = this.initialInputHeight || 40;
input.style.height = this.selected.length === 0
? sizeInMap + 'px'
: Math.max(
tags ? (tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0)) : 0,
sizeInMap
) + 'px';
if (this.visible && this.emptyText !== false) {
this.broadcast('ElSelectDropdown', 'updatePopper');
}
});
},
resetHoverIndex() {
setTimeout(() => {
if (!this.multiple) {
this.hoverIndex = this.options.indexOf(this.selected);
} else {
if (this.selected.length > 0) {
this.hoverIndex = Math.min.apply(null, this.selected.map(item => this.options.indexOf(item)));
} else {
this.hoverIndex = -1;
}
}
}, 300);
},
handleOptionSelect(option, byClick) {
if (this.multiple) {
const value = (this.value || []).slice();
const optionIndex = this.getValueIndex(value, option.value);
if (optionIndex > -1) {
value.splice(optionIndex, 1);
} else if (this.multipleLimit <= 0 || value.length < this.multipleLimit) {
value.push(option.value);
}
this.$emit('input', value);
this.emitChange(value);
if (option.created) {
this.query = '';
this.handleQueryChange('');
this.inputLength = 20;
}
if (this.filterable) this.$refs.input.focus();
} else {
this.$emit('input', option.value);
this.emitChange(option.value);
this.visible = false;
}
this.isSilentBlur = byClick;
this.setSoftFocus();
if (this.visible) return;
this.$nextTick(() => {
this.scrollToOption(option);
});
},
setSoftFocus() {
this.softFocus = true;
const input = this.$refs.input || this.$refs.reference;
if (input) {
input.focus();
}
},
getValueIndex(arr = [], value) {
const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
if (!isObject) {
return arr.indexOf(value);
} else {
const valueKey = this.valueKey;
let index = -1;
arr.some((item, i) => {
if (getValueByPath(item, valueKey) === getValueByPath(value, valueKey)) {
index = i;
return true;
}
return false;
});
return index;
}
},
toggleMenu() {
if (!this.selectDisabled) {
if (this.menuVisibleOnFocus) {
this.menuVisibleOnFocus = false;
} else {
this.visible = !this.visible;
}
if (this.visible) {
(this.$refs.input || this.$refs.reference).focus();
}
}
},
selectOption() {
if (!this.visible) {
this.toggleMenu();
} else {
if (this.options[this.hoverIndex]) {
this.handleOptionSelect(this.options[this.hoverIndex]);
}
}
},
deleteSelected(event) {
event.stopPropagation();
const value = this.multiple ? [] : '';
this.$emit('input', value);
this.emitChange(value);
this.visible = false;
this.$emit('clear');
},
deleteTag(event, tag) {
let index = this.selected.indexOf(tag);
if (index > -1 && !this.selectDisabled) {
const value = this.value.slice();
value.splice(index, 1);
this.$emit('input', value);
this.emitChange(value);
this.$emit('remove-tag', tag.value);
}
event.stopPropagation();
},
onInputChange() {
if (this.filterable && this.query !== this.selectedLabel) {
this.query = this.selectedLabel;
this.handleQueryChange(this.query);
}
},
onOptionDestroy(index) {
if (index > -1) {
this.optionsCount--;
this.filteredOptionsCount--;
this.options.splice(index, 1);
}
},
resetInputWidth() {
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
},
handleResize() {
this.resetInputWidth();
if (this.multiple) this.resetInputHeight();
},
checkDefaultFirstOption() {
this.hoverIndex = -1;
// highlight the created option
let hasCreated = false;
for (let i = this.options.length - 1; i >= 0; i--) {
if (this.options[i].created) {
hasCreated = true;
this.hoverIndex = i;
break;
}
}
if (hasCreated) return;
for (let i = 0; i !== this.options.length; ++i) {
const option = this.options[i];
if (this.query) {
// highlight first options that passes the filter
if (!option.disabled && !option.groupDisabled && option.visible) {
this.hoverIndex = i;
break;
}
} else {
// highlight currently selected option
if (option.itemSelected) {
this.hoverIndex = i;
break;
}
}
}
},
getValueKey(item) {
if (Object.prototype.toString.call(item.value).toLowerCase() !== '[object object]') {
return item.value;
} else {
return getValueByPath(item.value, this.valueKey);
}
}
},
created() {
this.cachedPlaceHolder = this.currentPlaceholder = this.propPlaceholder;
if (this.multiple && !Array.isArray(this.value)) {
this.$emit('input', []);
}
if (!this.multiple && Array.isArray(this.value)) {
this.$emit('input', '');
}
this.debouncedOnInputChange = debounce(this.debounce, () => {
this.onInputChange();
});
this.debouncedQueryChange = debounce(this.debounce, (e) => {
this.handleQueryChange(e.target.value);
});
this.$on('handleOptionClick', this.handleOptionSelect);
this.$on('setSelected', this.setSelected);
},
mounted() {
if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
this.currentPlaceholder = '';
}
addResizeListener(this.$el, this.handleResize);
const reference = this.$refs.reference;
if (reference && reference.$el) {
const sizeMap = {
medium: 36,
small: 32,
mini: 28
};
const input = reference.$el.querySelector('input');
this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize];
}
if (this.remote && this.multiple) {
this.resetInputHeight();
}
this.$nextTick(() => {
if (reference && reference.$el) {
this.inputWidth = reference.$el.getBoundingClientRect().width;
}
});
this.setSelected();
},
beforeDestroy() {
if (this.$el && this.handleResize) removeResizeListener(this.$el, this.handleResize);
}
};
</script>
'use strict' 'use strict'
import Axios from 'axios' import Axios from 'axios'
import { getToken } from '@/utils/user'
// import * as api from '../src/client'
import { baseUrl } from '../src/config'
import browserStorage from '@/services/local-storage' import browserStorage from '@/services/local-storage'
import store from '@/store' import store from '@/store'
import { Notification } from 'element-ui' import { Notification } from 'element-ui'
import Router from '@/router/index.js' import Router from '@/router/index.js'
import { baseUrl } from '@/config'
// 配置默认进度条事件
Axios.defaults.onUploadProgress = p => {
const obj = document.querySelector('.uploadForm .el-icon-circle-check')
if (obj) {
const percent = ((p.loaded / p.total) * 100) | 0
obj.setAttribute('data-text', percent + '%')
store.dispatch('setChangeUploadPercent', percent)
}
}
function notificationError(title: any, msg: any, duration: number = 1500) { function notificationError(title: any, msg: any, duration: number = 1500) {
Notification.error({ Notification.error({
...@@ -27,56 +15,19 @@ function notificationError(title: any, msg: any, duration: number = 1500) { ...@@ -27,56 +15,19 @@ function notificationError(title: any, msg: any, duration: number = 1500) {
}) })
} }
interface resData { code: string, text: string, msg: string } Axios.defaults.baseURL = baseUrl
interface optionsType {
allow_throw: boolean,
valid_code: boolean,
error_page: boolean,
must_fields?: [],
routerCancel?: boolean,
cancelToken?: any,
}
const m = new Map()
// 获取请求头
function getHeaders() {
const token = getToken()
return token ? { Authorization: token } : null
}
// 全局错误提示
function throwErr(resData: resData) {
vm.$notify.error({
title: resData.text,
message: resData.msg,
})
}
function validBackendCode(resData: resData, options: optionsType) {
if (resData.code === 'Success') return true
if (options.error_page) {
if (resData.code === 'NoAuthority') vm.$router.replace('/403')
if (resData.code === 'RecordNotFoundError') vm.$router.replace('/404')
}
if (options.allow_throw) { export default (method, url, data, config) => {
const code = resData.code method = method.toLowerCase()
const d = new Date() switch (method) {
if (m.has(code)) { case 'get':
if (d.getTime() - m.get(code) > 2000) { return Axios({ method: 'get', url, headers: { 'Token': browserStorage.getItem('token') }, params: data })
throwErr(resData) case 'post':
m.set(code, d.getTime()) return Axios({ method: 'post', url, headers: { 'Token': browserStorage.getItem('token') }, data })
} default:
} else {
throwErr(resData)
m.set(code, d.getTime())
}
}
return false return false
}
} }
// 添加请求拦截器 // 添加请求拦截器
Axios.interceptors.request.use(function(config) { Axios.interceptors.request.use(function(config) {
const urlBase = config.url.split('?')[0] const urlBase = config.url.split('?')[0]
...@@ -131,13 +82,3 @@ Axios.interceptors.response.use(res => { ...@@ -131,13 +82,3 @@ Axios.interceptors.response.use(res => {
// }) // })
} }
}) })
// const configuration = new api.Configuration({
// // basePath: process.env.API_URL,
// basePath: baseUrl,
// apiKey() {
// // TODO: 从localStorage中获取Token,Organization-Id
// return browserStorage.getItem('id')
// }
// })
// export const usersApi = new api.UsersApi(configuration)
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<div class="page-nav"> <div class="page-nav">
<div class="search-fields"> <div class="search-fields">
<span class="fields">用户名:</span> <span class="fields">用户名:</span>
<!-- <st-input width="240px" class="align contents" id="align-input" v-model="deviceName"></st-input> --> <st-input width="240px" class="align contents" id="align-input" v-model="deviceName"></st-input>
<input type="text" id="raw-input" autocomplete="off" class="align contents" :style="{borderColor: borderColor}" placeholder="请输入" @blur="getData" v-model.trim="deviceName" @keyup.enter="getData" @input="checkSearchContent"> <!-- <input type="text" id="raw-input" autocomplete="off" class="align contents" :style="{borderColor: borderColor}" placeholder="请输入" @blur="getData" v-model.trim="deviceName" @keyup.enter="getData" @input="checkSearchContent"> -->
<span class="fields">用户角色:</span> <span class="fields">用户角色:</span>
<st-select <st-select
v-model="logLevel" v-model="logLevel"
......
...@@ -42,6 +42,15 @@ ...@@ -42,6 +42,15 @@
<el-table-column v-for="(column, index) in tableData[0].columns" :key="index" :label="`列${index + 1}`"> <el-table-column v-for="(column, index) in tableData[0].columns" :key="index" :label="`列${index + 1}`">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="column-box"> <div class="column-box">
<!-- <div style="display: flex"> -->
<!-- <pack-select v-model="scope.row.columns[index].type" @blur="handleBlur" placeholder="请选择" class="none-display" style="margin-right: 10px">
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</pack-select> -->
<input type="text" v-model="scope.row.columns[index].value" @blur="handleBlur"> <input type="text" v-model="scope.row.columns[index].value" @blur="handleBlur">
<el-select v-model="scope.row.columns[index].type" placeholder="请选择"> <el-select v-model="scope.row.columns[index].type" placeholder="请选择">
<el-option <el-option
...@@ -145,12 +154,33 @@ export default { ...@@ -145,12 +154,33 @@ export default {
this.setCurrent() this.setCurrent()
event.target && event.target.classList && event.target.classList.remove('write') event.target && event.target.classList && event.target.classList.remove('write')
}, },
// handleBlur(event) {
// console.log(event.target, event.target.classList)
// if (this.selectBlur && this.inputBlur) {
// this.setCurrent()
// event.path.map(item => {
// if (item.classList && Array.from(item.classList).includes('cell')) {
// item.getElementsByClassName('el-select')[0].classList.add('none-display')
// item.getElementsByTagName('input')[0].classList.remove('write')
// item.getElementsByTagName('input')[1].classList.remove('write')
// }
// })
// }
// },
cellClick(row, column, cell, event) { cellClick(row, column, cell, event) {
if (cell.getElementsByTagName('input')[0]) { if (cell.getElementsByTagName('input')[0]) {
cell.getElementsByTagName('input')[0].classList.add('write') cell.getElementsByTagName('input')[0].classList.add('write')
cell.getElementsByTagName('input')[0].focus() cell.getElementsByTagName('input')[0].focus()
} }
}, },
// cellClick(row, column, cell, event) {
// cell.getElementsByClassName('el-select')[0].classList.remove('none-display')
// if (cell.getElementsByTagName('input')[0] && cell.getElementsByTagName('input')[1]) {
// cell.getElementsByTagName('input')[0].classList.add('write')
// cell.getElementsByTagName('input')[1].classList.add('write')
// cell.getElementsByTagName('input')[1].focus()
// }
// },
rowClick(row, column, event) { rowClick(row, column, event) {
this.setCurrent(row) this.setCurrent(row)
}, },
...@@ -185,6 +215,7 @@ export default { ...@@ -185,6 +215,7 @@ export default {
width: 70px width: 70px
.el-input__inner .el-input__inner
width: 50px width: 50px
color: #999
::v-deep.el-icon-arrow-up ::v-deep.el-icon-arrow-up
&::before &::before
content: '\e78f' content: '\e78f'
...@@ -298,4 +329,6 @@ export default { ...@@ -298,4 +329,6 @@ export default {
color: #666 color: #666
&:disabled &:disabled
color: #C0C4CC color: #C0C4CC
.none-display
display: none
</style> </style>
...@@ -62,14 +62,14 @@ ...@@ -62,14 +62,14 @@
</el-table-column> </el-table-column>
<el-table-column label="类型"> <el-table-column label="类型">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.type" placeholder="请选择" @change="handleChange(scope.row)"> <pack-select v-model="scope.row.type" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange" @change="handleChange(scope.row)">
<el-option <el-option
v-for="item in typeOptions" v-for="item in typeOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </pack-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="值"> <el-table-column label="值">
...@@ -81,14 +81,14 @@ ...@@ -81,14 +81,14 @@
<span class="file-btn" v-if="scope.row.value">{{scope.row.value}}<i class="iconfont icon-guanbi" @click="deleteFile(scope.row)"></i></span> <span class="file-btn" v-if="scope.row.value">{{scope.row.value}}<i class="iconfont icon-guanbi" @click="deleteFile(scope.row)"></i></span>
</div> </div>
<div v-if="scope.row.type === 'table'"> <div v-if="scope.row.type === 'table'">
<el-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur"> <pack-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange">
<el-option <el-option
v-for="item in tableOptions" v-for="item in tableOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </pack-select>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -201,6 +201,11 @@ export default { ...@@ -201,6 +201,11 @@ export default {
row.file = '' row.file = ''
row.value = '' row.value = ''
}, },
handleVisibleChange(val) {
if (!val) {
this.setCurrent()
}
},
handleBlur(event) { handleBlur(event) {
this.setCurrent() this.setCurrent()
event.target && event.target.classList && event.target.classList.remove('write') event.target && event.target.classList && event.target.classList.remove('write')
...@@ -228,9 +233,9 @@ export default { ...@@ -228,9 +233,9 @@ export default {
.page-content .page-content
text-align: left text-align: left
position: relative position: relative
::v-deep.el-form-item ::v-deep.el-form-item, ::v-deep.el-form-item__label, ::v-deep.el-form-item__content
// height: 32px height: 32px
// line-height: 32px line-height: 32px
margin-bottom: 24px margin-bottom: 24px
::v-deep.el-form-item.textarea ::v-deep.el-form-item.textarea
height: 100px height: 100px
...@@ -287,7 +292,7 @@ export default { ...@@ -287,7 +292,7 @@ export default {
height: calc(100% - 60px) height: calc(100% - 60px)
overflow: hidden overflow: hidden
.flex-item .flex-item
height: calc(100% - 380px) height: calc(100% - 370px)
.delete-btn .delete-btn
margin-left: 12px margin-left: 12px
color: #F56C6C color: #F56C6C
......
...@@ -122,7 +122,7 @@ import crypto from 'crypto-js' ...@@ -122,7 +122,7 @@ import crypto from 'crypto-js'
import browserStorage from '@/services/local-storage' import browserStorage from '@/services/local-storage'
import seetaPopover from '@/components/seeta-ui/seeta-popover' import seetaPopover from '@/components/seeta-ui/seeta-popover'
import { saveUser } from '@/utils/user' import { saveUser } from '@/utils/user'
// import { usersApi } from '../../http' import { loginApi } from '@/axios'
import { langList } from '@/i18n/utils' import { langList } from '@/i18n/utils'
export default { export default {
...@@ -271,7 +271,7 @@ export default { ...@@ -271,7 +271,7 @@ export default {
async prelogin(val) { async prelogin(val) {
}, },
async login() { async login() {
const res = await usersApi.login({ const res = await loginApi({
username: this.userName, username: this.userName,
password: this.userPassWord password: this.userPassWord
}) })
......
...@@ -40,6 +40,16 @@ module.exports = { ...@@ -40,6 +40,16 @@ module.exports = {
happyPackMode: false happyPackMode: false
}) })
.end() .end()
config.module
.rule('thejs')
.test(/\.js$/)
.include
.add(path.resolve('src'))
.add(path.resolve('node_modules/element-ui/packages'))
.end()
.use('babel-loader')
.loader('babel-loader')
.end()
}, },
// devServer: { // devServer: {
// // development server port 8000 // // development server port 8000
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!