¶Ô±ÈÐÂÎļþ |
| | |
| | | module.exports = { |
| | | root: true, |
| | | env: { |
| | | node: true |
| | | }, |
| | | 'extends': [ |
| | | 'plugin:vue/vue3-essential', |
| | | 'eslint:recommended' |
| | | ], |
| | | parserOptions: { |
| | | parser: 'babel-eslint' |
| | | }, |
| | | rules: { |
| | | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| | | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' |
| | | }, |
| | | overrides: [ |
| | | { |
| | | files: [ |
| | | '**/__tests__/*.{j,t}s?(x)', |
| | | '**/tests/unit/**/*.spec.{j,t}s?(x)' |
| | | ], |
| | | env: { |
| | | mocha: true |
| | | } |
| | | } |
| | | ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | .DS_Store |
| | | node_modules |
| | | /dist |
| | | |
| | | |
| | | # local env files |
| | | .env.local |
| | | .env.*.local |
| | | |
| | | # Log files |
| | | npm-debug.log* |
| | | yarn-debug.log* |
| | | yarn-error.log* |
| | | pnpm-debug.log* |
| | | |
| | | # Editor directories and files |
| | | .idea |
| | | .vscode |
| | | *.suo |
| | | *.ntvs* |
| | | *.njsproj |
| | | *.sln |
| | | *.sw? |
¶Ô±ÈÐÂÎļþ |
| | |
| | | # vol.vue3 |
| | | |
| | | ## Project setup |
| | | ``` |
| | | npm install |
| | | ``` |
| | | |
| | | ### Compiles and hot-reloads for development |
| | | ``` |
| | | npm run serve |
| | | ``` |
| | | |
| | | ### Compiles and minifies for production |
| | | ``` |
| | | npm run build |
| | | ``` |
| | | |
| | | ### Run your unit tests |
| | | ``` |
| | | npm run test:unit |
| | | ``` |
| | | |
| | | ### Lints and fixes files |
| | | ``` |
| | | npm run lint |
| | | ``` |
| | | |
| | | ### Customize configuration |
| | | See [Configuration Reference](https://cli.vuejs.org/config/). |
| | | |
| | | |
| | | ### npm run serveå¯å¨å¼å¸¸ï¼ |
| | | 使ç¨cmdè¾å
¥node -væ¥ççæ¬ï¼å¦ææ¯18.+çæ¬,请å°package.jsonä¸ç¬¬äºè¡scriptsä¸çå
å®¹æ¿æ¢ä¸ºï¼ |
| | | |
| | | "scripts": { |
| | | "serve": " SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", |
| | | "build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build", |
| | | "test:unit": "vue-cli-service test:unit", |
| | | "lint": "vue-cli-service lint" |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | module.exports = { |
| | | presets: [ |
| | | '@vue/cli-plugin-babel/preset' |
| | | ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | let buttons = [{ |
| | | name: "æ¥ è¯¢", |
| | | value: 'Search', |
| | | icon: 'el-icon-search', |
| | | class: '', |
| | | type: 'primary', |
| | | onClick: function () { |
| | | this.search(); |
| | | } |
| | | }, |
| | | { |
| | | name: "æ° å»º", |
| | | icon: 'el-icon-plus', |
| | | value: 'Add', |
| | | class: '', |
| | | // plain:true, |
| | | type: 'success', |
| | | // plain:true, |
| | | onClick: function () { |
| | | this.add(); |
| | | } |
| | | }, |
| | | { |
| | | name: "ç¼ è¾", |
| | | icon: 'el-icon-edit', |
| | | value: 'Update', |
| | | // plain:true, |
| | | class: '', |
| | | type: 'primary', |
| | | onClick: function () { |
| | | this.edit(); |
| | | } |
| | | }, |
| | | { |
| | | name: "ä»»å¡å®æ", |
| | | icon: '', |
| | | class: '', |
| | | value: 'TaskCompleted', |
| | | type: 'primary', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "ä»»å¡åæ¶", |
| | | icon: '', |
| | | class: '', |
| | | value: 'TaskCancel', |
| | | type: 'danger', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "任塿¢å¤", |
| | | icon: '', |
| | | class: '', |
| | | value: 'TaskRecovery', |
| | | type: 'danger', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "æ¥ç宿´è·¯ç±", |
| | | icon: '', |
| | | class: '', |
| | | value: 'ViewAllRouter', |
| | | type: 'info', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "è·¯ç±é
ç½®", |
| | | icon: '', |
| | | class: '', |
| | | value: 'AddRouters', |
| | | type: 'success', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "åæ»å°ä¸ä¸æ¥", |
| | | icon: '', |
| | | class: '', |
| | | value: 'Previous', |
| | | type: 'danger', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "跳转å°ä¸ä¸æ¥", |
| | | icon: '', |
| | | class: '', |
| | | value: 'Next', |
| | | type: 'warning', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | icon: 'el-icon-delete', |
| | | class: '', |
| | | value: 'Delete', |
| | | type: 'danger', |
| | | onClick: function () { |
| | | this.del(); |
| | | } |
| | | }, |
| | | { |
| | | name: "审 æ ¸", |
| | | icon: 'el-icon-check', |
| | | class: '', |
| | | value: 'Audit', |
| | | plain: true, |
| | | type: 'primary', |
| | | onClick: function () { |
| | | this.audit(); |
| | | } |
| | | }, |
| | | { |
| | | name: "导 å
¥", |
| | | icon: 'el-icon-top', |
| | | class: '', |
| | | type: 'success', |
| | | plain: true, |
| | | value: 'Import', |
| | | onClick: function () { |
| | | this.import(); |
| | | } |
| | | }, |
| | | { |
| | | name: "导 åº", |
| | | icon: 'el-icon-bottom', |
| | | type: 'success', |
| | | plain: true, |
| | | value: 'Export', |
| | | onClick: function () { |
| | | this.export(); |
| | | } |
| | | } |
| | | |
| | | ] |
| | | |
| | | export default buttons |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "name": "wideseawcs", |
| | | "version": "0.1.0", |
| | | "private": true, |
| | | "scripts": { |
| | | "server": "vue-cli-service serve", |
| | | "build": "vue-cli-service build", |
| | | "test:unit": "vue-cli-service test:unit", |
| | | "lint": "vue-cli-service lint" |
| | | }, |
| | | "dependencies": { |
| | | "@element-plus/icons-vue": "^2.1.0", |
| | | "@microsoft/signalr": "^6.0.4", |
| | | "ali-oss": "^6.17.1", |
| | | "axios": "^0.21.1", |
| | | "core-js": "^3.6.5", |
| | | "echarts": "^5.0.2", |
| | | "element-plus": "^2.2.14", |
| | | "less": "^4.1.1", |
| | | "vue": "^3.2.37", |
| | | "vue-draggable-next": "^2.0.1", |
| | | "vue-router": "^4.0.0-0", |
| | | "vuex": "^4.0.0-0", |
| | | "wangeditor": "^4.7.6" |
| | | }, |
| | | "devDependencies": { |
| | | "@babel/plugin-syntax-dynamic-import": "^7.8.3", |
| | | "@vue/cli-plugin-babel": "~4.5.0", |
| | | "@vue/cli-plugin-eslint": "~4.5.0", |
| | | "@vue/cli-plugin-router": "~4.5.0", |
| | | "@vue/cli-plugin-unit-mocha": "~4.5.0", |
| | | "@vue/cli-plugin-vuex": "~4.5.0", |
| | | "@vue/cli-service": "~4.5.0", |
| | | "@vue/compiler-sfc": "^3.0.0", |
| | | "@vue/test-utils": "^2.0.0-0", |
| | | "babel-eslint": "^10.1.0", |
| | | "chai": "^4.1.2", |
| | | "cross-env": "^7.0.3", |
| | | "less": "^4.1.1", |
| | | "less-loader": "^7.3.0", |
| | | "stylus": "^0.54.7", |
| | | "stylus-loader": "^3.0.2" |
| | | }, |
| | | "eslintConfig": { |
| | | "root": true, |
| | | "env": { |
| | | "node": true |
| | | }, |
| | | "extends": [ |
| | | "plugin:vue/essential", |
| | | "@vue/standard" |
| | | ], |
| | | "rules": { |
| | | "indent": [ |
| | | 1, |
| | | 4 |
| | | ] |
| | | }, |
| | | "parserOptions": { |
| | | "parser": "babel-eslint" |
| | | } |
| | | }, |
| | | "eslintIgnore": [ |
| | | "*" |
| | | ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!DOCTYPE html> |
| | | <html lang=""> |
| | | |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| | | <meta name="viewport" content="width=device-width,initial-scale=1.0"> |
| | | <meta name="keywords" content=".netccore,dotnet core,vue,element,element plus,vue3" /> |
| | | <meta name="description" content="" /> |
| | | <link rel="icon" href="<%= BASE_URL %>wcslogo.png"> |
| | | <title><%= htmlWebpackPlugin.options.title %></title> |
| | | <script src="webconfig.js"></script> |
| | | </head> |
| | | |
| | | <body> |
| | | <noscript> |
| | | <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. |
| | | Please enable it to continue.</strong> |
| | | </noscript> |
| | | <div id="app"></div> |
| | | <!-- built files will be auto injected --> |
| | | </body> |
| | | |
| | | </html> |
| | | <style> |
| | | html, |
| | | body { |
| | | margin: 0; |
| | | padding: 0; |
| | | height: 100%; |
| | | width: 100%; |
| | | } |
| | | |
| | | * { |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .el-loading { |
| | | z-index: 999999; |
| | | } |
| | | |
| | | .el-table th { |
| | | display: table-cell !important; |
| | | } |
| | | |
| | | .el-loading .el-loading-spinner { |
| | | padding: 7px; |
| | | background: #ececec; |
| | | width: 200px; |
| | | color: red; |
| | | left: 0; |
| | | right: 0; |
| | | margin: 0 auto; |
| | | border-radius: 5px; |
| | | border: 1px solid #a0a0a0; |
| | | |
| | | } |
| | | |
| | | h1, |
| | | h2, |
| | | h3, |
| | | h4 { |
| | | margin: 0; |
| | | } |
| | | |
| | | .v-dialog { |
| | | border-radius: 5px; |
| | | top: 50%; |
| | | /* margin-top: -220px !important; */ |
| | | } |
| | | |
| | | .v-dialog .el-dialog__header { |
| | | border-top-left-radius: 4px; |
| | | border-top-right-radius: 4px; |
| | | padding: 0px 13px; |
| | | line-height: 53px; |
| | | border-bottom: 1px solid #e2e2e2; |
| | | height: 50px; |
| | | color: white; |
| | | font-weight: bold; |
| | | font-size: 14px; |
| | | background-image: linear-gradient(135deg, #0cd7bd 10%, #50c3f7); |
| | | } |
| | | |
| | | .v-dialog .el-dialog__header .el-dialog__headerbtn { |
| | | top: 3px; |
| | | right: 0px; |
| | | } |
| | | |
| | | .v-dialog .el-dialog__header .el-dialog__headerbtn .el-dialog__close { |
| | | font-size: 19px; |
| | | color: white; |
| | | } |
| | | |
| | | .v-dialog .el-dialog__body { |
| | | padding: 0; |
| | | } |
| | | |
| | | .el-message { |
| | | z-index: 3500 !important; |
| | | } |
| | | |
| | | .v-date-range .el-input__inner { |
| | | padding: 0 15px 0 8px |
| | | } |
| | | |
| | | .v-date-range .el-input__suffix .el-input__icon { |
| | | display: table-caption; |
| | | background: white; |
| | | margin: 1px; |
| | | height: auto; |
| | | margin-right: -4px; |
| | | height: 33px; |
| | | width: 19px; |
| | | font-size: 13px; |
| | | border-top-right-radius: 3px; |
| | | border-bottom-right-radius: 3px; |
| | | } |
| | | |
| | | .v-date-range .el-icon-circle-check { |
| | | display: none !important; |
| | | } |
| | | |
| | | .v-dialog .el-dialog__header { |
| | | margin-right: 0; |
| | | } |
| | | |
| | | .el-button { |
| | | font-size: 12px !important; |
| | | } |
| | | |
| | | .el-button--small { |
| | | padding: 0px 15px !important; |
| | | height: 32px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | window.webConfig = { |
| | | "webApiDevelopment": "http://localhost:9291/", |
| | | "webApiProduction": "http://localhost:9291/", |
| | | "webApiDebug": "http://localhost:9291/", |
| | | "webSocketUrl": "ws://localhost:9260/", |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div id="nav"></div> |
| | | <el-config-provider :locale="locale"> |
| | | <router-view /> |
| | | </el-config-provider> |
| | | </template> |
| | | <script> |
| | | import { ElConfigProvider } from "element-plus"; |
| | | import zhCn from "element-plus/lib/locale/lang/zh-cn"; |
| | | export default { |
| | | name: "vol_app", |
| | | components: { |
| | | [ElConfigProvider.name]: ElConfigProvider, //æ·»å ç»ä»¶ |
| | | }, |
| | | data() { |
| | | return { |
| | | locale: zhCn, |
| | | }; |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="stylus"> |
| | | #app { |
| | | font-family: Avenir, Helvetica, Arial, sans-serif; |
| | | -webkit-font-smoothing: antialiased; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | height: 100%; |
| | | width: 100%; |
| | | } |
| | | |
| | | .el-alert--error.is-light { |
| | | border: 1px solid #ffe0e0; |
| | | } |
| | | |
| | | .el-alert--error.is-light { |
| | | color: #f74444 !important; |
| | | } |
| | | |
| | | .el-alert--warning.is-light { |
| | | border: 1px solid #ffe6c1; |
| | | } |
| | | |
| | | .el-alert--info.is-light { |
| | | border: 1px solid #e6e5e5; |
| | | } |
| | | |
| | | .el-alert--info .el-alert__description { |
| | | color: #6b6b6b !important; |
| | | } |
| | | |
| | | .el-alert--warning.is-light { |
| | | background-color: #fdf6ec; |
| | | color: #d68409 !important; |
| | | } |
| | | |
| | | .el-alert--success.is-light { |
| | | border: 1px solid #cdf7b8; |
| | | } |
| | | |
| | | .el-alert--success.is-light .el-alert__description { |
| | | color: #3baf02 !important; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import axios from 'axios' |
| | | import store from '../store/index' |
| | | // import {getCurrentInstance} from 'vue' |
| | | import { useRouter, useRoute } from 'vue-router' |
| | | const router = useRouter(); |
| | | axios.defaults.timeout = 50000; |
| | | axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'; |
| | | |
| | | import { ElLoading as Loading, ElMessage as Message } from 'element-plus'; |
| | | |
| | | |
| | | let loadingInstance; |
| | | let loadingStatus = false; |
| | | if (process.env.NODE_ENV == 'development') { |
| | | axios.defaults.baseURL = window.webConfig.webApiProduction; |
| | | } |
| | | else if (process.env.NODE_ENV == 'debug') { |
| | | axios.defaults.baseURL = window.webConfig.webApiDebug; |
| | | } |
| | | |
| | | else if (process.env.NODE_ENV == 'production') { |
| | | axios.defaults.baseURL = window.webConfig.webApiProduction; |
| | | } |
| | | if (!axios.defaults.baseURL.endsWith('/')) { |
| | | axios.defaults.baseURL+="/"; |
| | | } |
| | | |
| | | |
| | | let ipAddress = axios.defaults.baseURL; |
| | | axios.interceptors.request.use((config) => { |
| | | return config; |
| | | }, (error) => { |
| | | return Promise.reject(error); |
| | | }); |
| | | |
| | | axios.interceptors.response.use((res) => { |
| | | |
| | | closeLoading(); |
| | | |
| | | checkResponse(res); |
| | | |
| | | return Promise.resolve(res); |
| | | }, (error) => { |
| | | closeLoading(); |
| | | let httpMessage = ''; |
| | | if (error.response) { |
| | | if (error.response.status == '401') { |
| | | if (error.response.data && error.response.data.code == 401) { |
| | | if (!localStorage.getItem('user')) { |
| | | Message.error({ |
| | | showClose: true, |
| | | message: 'ç»éå·²è¿æ', |
| | | type: 'error' |
| | | }); |
| | | } |
| | | toLogin(); |
| | | return; |
| | | } |
| | | |
| | | } |
| | | if (error.response.status == '404') { |
| | | httpMessage = "æªæ¾å°è¯·æ±å°å"; |
| | | } |
| | | else if (error.response.data && error.response.data.message) { |
| | | httpMessage = error.response.data.message; |
| | | } |
| | | } |
| | | else { |
| | | httpMessage = 'æå¡å¨å¤çå¼å¸¸' |
| | | } |
| | | redirect(httpMessage); |
| | | return Promise.reject(error.response || {}, httpMessage); |
| | | }); |
| | | function closeLoading () { |
| | | if (loadingInstance) { |
| | | loadingInstance.close(); |
| | | } |
| | | if (loadingStatus) { |
| | | loadingStatus = false; |
| | | if (loadingInstance) { |
| | | loadingInstance.close(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | function checkResponse (res) { |
| | | //å·æ°token |
| | | if (!res.headers) { |
| | | if (res.getResponseHeader("wideseawcs_exp") == "1") { |
| | | replaceToken(); |
| | | } |
| | | } |
| | | else if (res.headers.wideseawcs_exp == "1") { |
| | | replaceToken(); |
| | | } |
| | | } |
| | | |
| | | const _Authorization = 'Authorization'; |
| | | |
| | | function showLoading (loading) { |
| | | if (!loading || loadingStatus) { |
| | | return; |
| | | } |
| | | loadingInstance = Loading.service({ |
| | | lock: true, |
| | | text: 'Loading', |
| | | customClass:"http-loading", |
| | | background: typeof loading == "string" ? loading : 'æ£å¨å¤ç.....', |
| | | background: 'rgba(58, 61, 63, 0.32)' |
| | | }); |
| | | } |
| | | |
| | | function getToken () { |
| | | return store.getters.getToken(); |
| | | } |
| | | |
| | | /* |
| | | url |
| | | params请æ±åå°çåæ°,å¦ï¼{name:123,values:['a','b','c']} |
| | | loadingæ¯å¦æ¾ç¤ºé®ç½©å±,å¯ä»¥ä¼ å
¥true.false.åæç¤ºææ¬ |
| | | configé
置信æ¯,å¦{timeout:3000,headers:{token:123}} |
| | | */ |
| | | function post (url, params, loading, config) { |
| | | showLoading(loading); |
| | | axios.defaults.headers[_Authorization] = getToken(); |
| | | return new Promise((resolve, reject) => { |
| | | axios.post(url, params, config) |
| | | .then(response => { |
| | | resolve(response.data); |
| | | }, err => { |
| | | reject(err && err.data && err.data.message ? err.data.message : 'æå¡å¨å¤çå¼å¸¸'); |
| | | }) |
| | | .catch((error) => { |
| | | reject(error) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | //=true弿¥è¯·æ±æ¶ä¼æ¾ç¤ºé®ç½©å±,=å符串ï¼å¼æ¥è¯·æ±æ¶é®ç½©å±æ¾ç¤ºå½åå符串 |
| | | function get (url, param, loading, config) { |
| | | showLoading(loading); |
| | | axios.defaults.headers[_Authorization] = getToken(); |
| | | return new Promise((resolve, reject) => { |
| | | axios.get(url, config) |
| | | .then(response => { |
| | | // console.log(response) |
| | | resolve(response.data) |
| | | }, err => { |
| | | reject(err) |
| | | }) |
| | | .catch((error) => { |
| | | reject(error) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | //url:urlå°å |
| | | //params:请æ±åæ° |
| | | //fileName:ä¸è½½çæä»¶å |
| | | //loading:æ¯å¦æ¾ç¤ºå è½½ç¶æ |
| | | function download (url, params, fileName, loading,callback) { |
| | | fileName = fileName.replace(">", "ï¼").replace("<", "ï¼"); |
| | | post(url, params, loading, { responseType: 'blob' }).then(content => { |
| | | const blob = new Blob([content]) |
| | | if ('download' in document.createElement('a')) { // éIEä¸è½½ |
| | | const elink = document.createElement('a') |
| | | elink.download = fileName |
| | | elink.style.display = 'none' |
| | | elink.href = URL.createObjectURL(blob) |
| | | document.body.appendChild(elink) |
| | | elink.click() |
| | | URL.revokeObjectURL(elink.href) // éæ¾URL 对象 |
| | | document.body.removeChild(elink) |
| | | } else { // IE10+ä¸è½½ |
| | | navigator.msSaveBlob(blob, fileName) |
| | | } |
| | | callback&&callback(); |
| | | }) |
| | | } |
| | | |
| | | |
| | | function createXHR () { |
| | | if (XMLHttpRequest) { |
| | | return new XMLHttpRequest(); |
| | | } |
| | | if (ActiveXObject) { |
| | | if (typeof arguments.callee.activeXString != "string") { |
| | | var versions = [ |
| | | "MSXML2.XMLHttp.6.0", |
| | | "MSXML2.XMLHttp", |
| | | "MSXML2.XMLHttp.3.0" |
| | | ]; |
| | | for (var i = 0; i < versions.length; i++) { |
| | | try { |
| | | new ActiveXObject(versions[i]); |
| | | arguments.callee.activeXString = versions[i]; |
| | | break; |
| | | } catch (e) { |
| | | console.log(e); |
| | | } |
| | | } |
| | | } |
| | | return new ActiveXObject(arguments.callee.activeXString); |
| | | } |
| | | } |
| | | |
| | | function redirect (responseText, message) { |
| | | try { |
| | | let responseData = typeof responseText == 'string' ? JSON.parse(responseText) : responseText; |
| | | if ((responseData.hasOwnProperty('code') && responseData.code == 401) |
| | | || (responseData.data && responseData.data.code == 401)) { |
| | | closeLoading(); |
| | | toLogin(); |
| | | } else { |
| | | if (message) { |
| | | Message.error({ |
| | | showClose: true, |
| | | message: message, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | console.log(error); |
| | | Message.error({ |
| | | showClose: true, |
| | | message: responseText, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | function toLogin () { |
| | | // const vueinstance= getCurrentInstance(); |
| | | if (window.location.hash) { |
| | | window.location.href = window.location.origin + '/#/login' |
| | | return |
| | | } |
| | | window.location.href = window.location.origin + '/login' |
| | | // router.push({ path: '/login', params: { r: Math.random() } }); |
| | | } |
| | | //卿巿°token |
| | | function replaceToken () { |
| | | ajax({ |
| | | url: "/api/User/replaceToken", |
| | | param: {}, |
| | | json: true, |
| | | success: function (x) { |
| | | if (x.status) { |
| | | let userInfo = store.getters.getUserInfo(); |
| | | userInfo.token = x.data; |
| | | store.commit('setUserInfo', userInfo); |
| | | } else { |
| | | console.log(x.message); |
| | | toLogin(); |
| | | } |
| | | }, |
| | | errror: function (ex) { |
| | | console.log(ex); |
| | | toLogin(); |
| | | }, |
| | | type: "post", |
| | | async: false |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | function ajax (param) { |
| | | let httpParam = |
| | | Object.assign({ |
| | | url: '', headers: {}, |
| | | param: {}, json: true, |
| | | success: function () { }, |
| | | errror: function () { }, |
| | | type: 'post', async: true |
| | | }, param); |
| | | |
| | | httpParam.url = axios.defaults.baseURL + httpParam.url.replace(/\/?/, ''); |
| | | httpParam.headers[_Authorization] = getToken(); |
| | | var xhr = createXHR(); |
| | | xhr.onreadystatechange = function () { |
| | | if (xhr.status == 403 || xhr.status == 401) { |
| | | redirect(xhr.responseText); |
| | | return; |
| | | } |
| | | checkResponse(xhr); |
| | | if (xhr.readyState == 4 && xhr.status == 200) { |
| | | httpParam.success(httpParam.json ? JSON.parse(xhr.responseText) : xhr.responseText); |
| | | return; |
| | | } |
| | | if (xhr.status != 0 && xhr.readyState != 1) { |
| | | httpParam.errror(xhr); |
| | | } |
| | | }; |
| | | //åå§åè¯·æ± |
| | | xhr.open( |
| | | httpParam.type, |
| | | httpParam.url, |
| | | httpParam.async |
| | | ); |
| | | xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
| | | for (const key in httpParam.headers) { |
| | | xhr.setRequestHeader(key, httpParam.headers[key]); |
| | | } |
| | | let dataStr = ''; |
| | | for (const key in httpParam.param) { |
| | | dataStr += key + "=" + httpParam.param[key]; |
| | | } |
| | | try { |
| | | xhr.send(dataStr); |
| | | } catch (error) { |
| | | toLogin(); |
| | | } |
| | | } |
| | | |
| | | ajax.post = function (url, param, success, errror) { |
| | | ajax({ url: url, param: param, success: success, error: errror, type: 'post' }) |
| | | } |
| | | ajax.get = function (url, param, success, errror) { |
| | | ajax({ url: url, param: param, success: success, error: errror, type: 'get' }) |
| | | } |
| | | export default { post, get,download, ajax, ipAddress } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | import http from '@/../src/api/http.js' |
| | | import buttons from '@/../config/buttons.js' |
| | | import store from '../store/index' |
| | | import { useRouter } from 'vue-router' |
| | | let permission = { |
| | | getMenu() { |
| | | return http.get("/api/getTreeMenu"); |
| | | }, getButtons(path, extra, table, tableName) {//extraèªå®é¢å¤æé® |
| | | //extraèªå®é¢å¤æé® |
| | | //tableè·åæå®è¡¨çæé |
| | | if (table) { |
| | | table = '/' + table; |
| | | } |
| | | let permission = store.getters.getPermission(table || path); |
| | | if (!permission) { |
| | | permission = store.getters.getPermission(path.substring(1)); |
| | | if (!permission) { |
| | | if ((tableName || '').indexOf('/') != -1) { |
| | | let arr = tableName.split('/'); |
| | | tableName = arr[arr.length - 1]; |
| | | } |
| | | permission = store.getters.getPermission('/' + tableName); |
| | | if (!permission) { |
| | | permission = (store.state.permission||[]).find(x => x.tableName ==tableName); |
| | | if (!permission) { |
| | | to401(); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | let permissions = permission.permission; //.split(','); |
| | | let gridButtons = buttons.filter((item) => { |
| | | return !item.value || permissions.indexOf(item.value) != -1; |
| | | }); |
| | | if (extra && extra instanceof Array) { |
| | | gridButtons.push(...extra); |
| | | } |
| | | return gridButtons; |
| | | }, to401() { |
| | | to401(); |
| | | } |
| | | } |
| | | function to401() { |
| | | const router = useRouter(); |
| | | router.push({ |
| | | path: '/401' |
| | | }); |
| | | } |
| | | |
| | | export default permission; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | const tipxx = { |
| | | install: function (vue) { |
| | | alert(1); |
| | | vue.prototype.$tip = function () { |
| | | alert('æµè¯use') |
| | | }; |
| | | } |
| | | } |
| | | export default { tipxx } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | *{ |
| | | box-sizing:border-box; |
| | | -moz-box-sizing:border-box; /* Firefox */ |
| | | -webkit-box-sizing:border-box; /* Safari */ |
| | | } |
| | | .el-pager li{ |
| | | font-weight: 100; |
| | | margin-right: 9px; |
| | | border: 1px solid #eee; |
| | | border-radius: 3px; |
| | | min-width: 28px; |
| | | } |
| | | .el-pager li.active,.el-pager li:hover{ |
| | | background: #ed4014; |
| | | color: white; |
| | | } |
| | | .el-pagination__editor.el-input .el-input__inner{ |
| | | height: 23px; |
| | | } |
| | | |
| | | |
| | | .animated { |
| | | -webkit-animation-duration: 0.5s; |
| | | animation-duration: 0.5s; |
| | | -webkit-animation-fill-mode: both; |
| | | animation-fill-mode: both; |
| | | } |
| | | |
| | | @media (print), (prefers-reduced-motion) { |
| | | .animated { |
| | | -webkit-animation: unset !important; |
| | | animation: unset !important; |
| | | -webkit-transition: none !important; |
| | | transition: none !important; |
| | | } |
| | | } |
| | | |
| | | @-webkit-keyframes fadeInDown { |
| | | from { |
| | | opacity: 1; |
| | | -webkit-transform: translate3d(0, -100%, 0); |
| | | transform: translate3d(0, -100%, 0); |
| | | } |
| | | |
| | | to { |
| | | opacity: 1; |
| | | -webkit-transform: translate3d(0, 0, 0); |
| | | transform: translate3d(0, 0, 0); |
| | | } |
| | | } |
| | | |
| | | @keyframes fadeInDown { |
| | | from { |
| | | opacity: 0; |
| | | -webkit-transform: translate3d(0, -100%, 0); |
| | | transform: translate3d(0, -100%, 0); |
| | | } |
| | | |
| | | to { |
| | | opacity: 1; |
| | | -webkit-transform: translate3d(0, 0, 0); |
| | | transform: translate3d(0, 0, 0); |
| | | } |
| | | } |
| | | |
| | | .fadeInDown { |
| | | -webkit-animation-name: fadeInDown; |
| | | animation-name: fadeInDown; |
| | | } |
| | | .ivu-message{ |
| | | z-index: 999999999 !important; |
| | | } |
| | | .ivu-form-item-content{ |
| | | text-align: left; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @font-face{font-family:element-icons;src:url(fonts/element-icons.woff) format("woff"),url(fonts/element-icons.ttf) format("truetype");font-weight:400;font-display:"auto";font-style:normal}[class*=" el-icon-"],[class^=el-icon-]{font-family:element-icons!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;vertical-align:baseline;display:inline-block;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.el-icon-ice-cream-round:before{content:"\e6a0"}.el-icon-ice-cream-square:before{content:"\e6a3"}.el-icon-lollipop:before{content:"\e6a4"}.el-icon-potato-strips:before{content:"\e6a5"}.el-icon-milk-tea:before{content:"\e6a6"}.el-icon-ice-drink:before{content:"\e6a7"}.el-icon-ice-tea:before{content:"\e6a9"}.el-icon-coffee:before{content:"\e6aa"}.el-icon-orange:before{content:"\e6ab"}.el-icon-pear:before{content:"\e6ac"}.el-icon-apple:before{content:"\e6ad"}.el-icon-cherry:before{content:"\e6ae"}.el-icon-watermelon:before{content:"\e6af"}.el-icon-grape:before{content:"\e6b0"}.el-icon-refrigerator:before{content:"\e6b1"}.el-icon-goblet-square-full:before{content:"\e6b2"}.el-icon-goblet-square:before{content:"\e6b3"}.el-icon-goblet-full:before{content:"\e6b4"}.el-icon-goblet:before{content:"\e6b5"}.el-icon-cold-drink:before{content:"\e6b6"}.el-icon-coffee-cup:before{content:"\e6b8"}.el-icon-water-cup:before{content:"\e6b9"}.el-icon-hot-water:before{content:"\e6ba"}.el-icon-ice-cream:before{content:"\e6bb"}.el-icon-dessert:before{content:"\e6bc"}.el-icon-sugar:before{content:"\e6bd"}.el-icon-tableware:before{content:"\e6be"}.el-icon-burger:before{content:"\e6bf"}.el-icon-knife-fork:before{content:"\e6c1"}.el-icon-fork-spoon:before{content:"\e6c2"}.el-icon-chicken:before{content:"\e6c3"}.el-icon-food:before{content:"\e6c4"}.el-icon-dish-1:before{content:"\e6c5"}.el-icon-dish:before{content:"\e6c6"}.el-icon-moon-night:before{content:"\e6ee"}.el-icon-moon:before{content:"\e6f0"}.el-icon-cloudy-and-sunny:before{content:"\e6f1"}.el-icon-partly-cloudy:before{content:"\e6f2"}.el-icon-cloudy:before{content:"\e6f3"}.el-icon-sunny:before{content:"\e6f6"}.el-icon-sunset:before{content:"\e6f7"}.el-icon-sunrise-1:before{content:"\e6f8"}.el-icon-sunrise:before{content:"\e6f9"}.el-icon-heavy-rain:before{content:"\e6fa"}.el-icon-lightning:before{content:"\e6fb"}.el-icon-light-rain:before{content:"\e6fc"}.el-icon-wind-power:before{content:"\e6fd"}.el-icon-baseball:before{content:"\e712"}.el-icon-soccer:before{content:"\e713"}.el-icon-football:before{content:"\e715"}.el-icon-basketball:before{content:"\e716"}.el-icon-ship:before{content:"\e73f"}.el-icon-truck:before{content:"\e740"}.el-icon-bicycle:before{content:"\e741"}.el-icon-mobile-phone:before{content:"\e6d3"}.el-icon-service:before{content:"\e6d4"}.el-icon-key:before{content:"\e6e2"}.el-icon-unlock:before{content:"\e6e4"}.el-icon-lock:before{content:"\e6e5"}.el-icon-watch:before{content:"\e6fe"}.el-icon-watch-1:before{content:"\e6ff"}.el-icon-timer:before{content:"\e702"}.el-icon-alarm-clock:before{content:"\e703"}.el-icon-map-location:before{content:"\e704"}.el-icon-delete-location:before{content:"\e705"}.el-icon-add-location:before{content:"\e706"}.el-icon-location-information:before{content:"\e707"}.el-icon-location-outline:before{content:"\e708"}.el-icon-location:before{content:"\e79e"}.el-icon-place:before{content:"\e709"}.el-icon-discover:before{content:"\e70a"}.el-icon-first-aid-kit:before{content:"\e70b"}.el-icon-trophy-1:before{content:"\e70c"}.el-icon-trophy:before{content:"\e70d"}.el-icon-medal:before{content:"\e70e"}.el-icon-medal-1:before{content:"\e70f"}.el-icon-stopwatch:before{content:"\e710"}.el-icon-mic:before{content:"\e711"}.el-icon-copy-document:before{content:"\e718"}.el-icon-full-screen:before{content:"\e719"}.el-icon-switch-button:before{content:"\e71b"}.el-icon-aim:before{content:"\e71c"}.el-icon-crop:before{content:"\e71d"}.el-icon-odometer:before{content:"\e71e"}.el-icon-time:before{content:"\e71f"}.el-icon-bangzhu:before{content:"\e724"}.el-icon-close-notification:before{content:"\e726"}.el-icon-microphone:before{content:"\e727"}.el-icon-turn-off-microphone:before{content:"\e728"}.el-icon-position:before{content:"\e729"}.el-icon-postcard:before{content:"\e72a"}.el-icon-message:before{content:"\e72b"}.el-icon-chat-line-square:before{content:"\e72d"}.el-icon-chat-dot-square:before{content:"\e72e"}.el-icon-chat-dot-round:before{content:"\e72f"}.el-icon-chat-square:before{content:"\e730"}.el-icon-chat-line-round:before{content:"\e731"}.el-icon-chat-round:before{content:"\e732"}.el-icon-set-up:before{content:"\e733"}.el-icon-turn-off:before{content:"\e734"}.el-icon-open:before{content:"\e735"}.el-icon-connection:before{content:"\e736"}.el-icon-link:before{content:"\e737"}.el-icon-cpu:before{content:"\e738"}.el-icon-thumb:before{content:"\e739"}.el-icon-female:before{content:"\e73a"}.el-icon-male:before{content:"\e73b"}.el-icon-guide:before{content:"\e73c"}.el-icon-news:before{content:"\e73e"}.el-icon-price-tag:before{content:"\e744"}.el-icon-discount:before{content:"\e745"}.el-icon-wallet:before{content:"\e747"}.el-icon-coin:before{content:"\e748"}.el-icon-money:before{content:"\e749"}.el-icon-bank-card:before{content:"\e74a"}.el-icon-box:before{content:"\e74b"}.el-icon-present:before{content:"\e74c"}.el-icon-sell:before{content:"\e6d5"}.el-icon-sold-out:before{content:"\e6d6"}.el-icon-shopping-bag-2:before{content:"\e74d"}.el-icon-shopping-bag-1:before{content:"\e74e"}.el-icon-shopping-cart-2:before{content:"\e74f"}.el-icon-shopping-cart-1:before{content:"\e750"}.el-icon-shopping-cart-full:before{content:"\e751"}.el-icon-smoking:before{content:"\e752"}.el-icon-no-smoking:before{content:"\e753"}.el-icon-house:before{content:"\e754"}.el-icon-table-lamp:before{content:"\e755"}.el-icon-school:before{content:"\e756"}.el-icon-office-building:before{content:"\e757"}.el-icon-toilet-paper:before{content:"\e758"}.el-icon-notebook-2:before{content:"\e759"}.el-icon-notebook-1:before{content:"\e75a"}.el-icon-files:before{content:"\e75b"}.el-icon-collection:before{content:"\e75c"}.el-icon-receiving:before{content:"\e75d"}.el-icon-suitcase-1:before{content:"\e760"}.el-icon-suitcase:before{content:"\e761"}.el-icon-film:before{content:"\e763"}.el-icon-collection-tag:before{content:"\e765"}.el-icon-data-analysis:before{content:"\e766"}.el-icon-pie-chart:before{content:"\e767"}.el-icon-data-board:before{content:"\e768"}.el-icon-data-line:before{content:"\e76d"}.el-icon-reading:before{content:"\e769"}.el-icon-magic-stick:before{content:"\e76a"}.el-icon-coordinate:before{content:"\e76b"}.el-icon-mouse:before{content:"\e76c"}.el-icon-brush:before{content:"\e76e"}.el-icon-headset:before{content:"\e76f"}.el-icon-umbrella:before{content:"\e770"}.el-icon-scissors:before{content:"\e771"}.el-icon-mobile:before{content:"\e773"}.el-icon-attract:before{content:"\e774"}.el-icon-monitor:before{content:"\e775"}.el-icon-search:before{content:"\e778"}.el-icon-takeaway-box:before{content:"\e77a"}.el-icon-paperclip:before{content:"\e77d"}.el-icon-printer:before{content:"\e77e"}.el-icon-document-add:before{content:"\e782"}.el-icon-document:before{content:"\e785"}.el-icon-document-checked:before{content:"\e786"}.el-icon-document-copy:before{content:"\e787"}.el-icon-document-delete:before{content:"\e788"}.el-icon-document-remove:before{content:"\e789"}.el-icon-tickets:before{content:"\e78b"}.el-icon-folder-checked:before{content:"\e77f"}.el-icon-folder-delete:before{content:"\e780"}.el-icon-folder-remove:before{content:"\e781"}.el-icon-folder-add:before{content:"\e783"}.el-icon-folder-opened:before{content:"\e784"}.el-icon-folder:before{content:"\e78a"}.el-icon-edit-outline:before{content:"\e764"}.el-icon-edit:before{content:"\e78c"}.el-icon-date:before{content:"\e78e"}.el-icon-c-scale-to-original:before{content:"\e7c6"}.el-icon-view:before{content:"\e6ce"}.el-icon-loading:before{content:"\e6cf"}.el-icon-rank:before{content:"\e6d1"}.el-icon-sort-down:before{content:"\e7c4"}.el-icon-sort-up:before{content:"\e7c5"}.el-icon-sort:before{content:"\e6d2"}.el-icon-finished:before{content:"\e6cd"}.el-icon-refresh-left:before{content:"\e6c7"}.el-icon-refresh-right:before{content:"\e6c8"}.el-icon-refresh:before{content:"\e6d0"}.el-icon-video-play:before{content:"\e7c0"}.el-icon-video-pause:before{content:"\e7c1"}.el-icon-d-arrow-right:before{content:"\e6dc"}.el-icon-d-arrow-left:before{content:"\e6dd"}.el-icon-arrow-up:before{content:"\e6e1"}.el-icon-arrow-down:before{content:"\e6df"}.el-icon-arrow-right:before{content:"\e6e0"}.el-icon-arrow-left:before{content:"\e6de"}.el-icon-top-right:before{content:"\e6e7"}.el-icon-top-left:before{content:"\e6e8"}.el-icon-top:before{content:"\e6e6"}.el-icon-bottom:before{content:"\e6eb"}.el-icon-right:before{content:"\e6e9"}.el-icon-back:before{content:"\e6ea"}.el-icon-bottom-right:before{content:"\e6ec"}.el-icon-bottom-left:before{content:"\e6ed"}.el-icon-caret-top:before{content:"\e78f"}.el-icon-caret-bottom:before{content:"\e790"}.el-icon-caret-right:before{content:"\e791"}.el-icon-caret-left:before{content:"\e792"}.el-icon-d-caret:before{content:"\e79a"}.el-icon-share:before{content:"\e793"}.el-icon-menu:before{content:"\e798"}.el-icon-s-grid:before{content:"\e7a6"}.el-icon-s-check:before{content:"\e7a7"}.el-icon-s-data:before{content:"\e7a8"}.el-icon-s-opportunity:before{content:"\e7aa"}.el-icon-s-custom:before{content:"\e7ab"}.el-icon-s-claim:before{content:"\e7ad"}.el-icon-s-finance:before{content:"\e7ae"}.el-icon-s-comment:before{content:"\e7af"}.el-icon-s-flag:before{content:"\e7b0"}.el-icon-s-marketing:before{content:"\e7b1"}.el-icon-s-shop:before{content:"\e7b4"}.el-icon-s-open:before{content:"\e7b5"}.el-icon-s-management:before{content:"\e7b6"}.el-icon-s-ticket:before{content:"\e7b7"}.el-icon-s-release:before{content:"\e7b8"}.el-icon-s-home:before{content:"\e7b9"}.el-icon-s-promotion:before{content:"\e7ba"}.el-icon-s-operation:before{content:"\e7bb"}.el-icon-s-unfold:before{content:"\e7bc"}.el-icon-s-fold:before{content:"\e7a9"}.el-icon-s-platform:before{content:"\e7bd"}.el-icon-s-order:before{content:"\e7be"}.el-icon-s-cooperation:before{content:"\e7bf"}.el-icon-bell:before{content:"\e725"}.el-icon-message-solid:before{content:"\e799"}.el-icon-video-camera:before{content:"\e772"}.el-icon-video-camera-solid:before{content:"\e796"}.el-icon-camera:before{content:"\e779"}.el-icon-camera-solid:before{content:"\e79b"}.el-icon-download:before{content:"\e77c"}.el-icon-upload2:before{content:"\e77b"}.el-icon-upload:before{content:"\e7c3"}.el-icon-picture-outline-round:before{content:"\e75f"}.el-icon-picture-outline:before{content:"\e75e"}.el-icon-picture:before{content:"\e79f"}.el-icon-close:before{content:"\e6db"}.el-icon-check:before{content:"\e6da"}.el-icon-plus:before{content:"\e6d9"}.el-icon-minus:before{content:"\e6d8"}.el-icon-help:before{content:"\e73d"}.el-icon-s-help:before{content:"\e7b3"}.el-icon-circle-close:before{content:"\e78d"}.el-icon-circle-check:before{content:"\e720"}.el-icon-circle-plus-outline:before{content:"\e723"}.el-icon-remove-outline:before{content:"\e722"}.el-icon-zoom-out:before{content:"\e776"}.el-icon-zoom-in:before{content:"\e777"}.el-icon-error:before{content:"\e79d"}.el-icon-success:before{content:"\e79c"}.el-icon-circle-plus:before{content:"\e7a0"}.el-icon-remove:before{content:"\e7a2"}.el-icon-info:before{content:"\e7a1"}.el-icon-question:before{content:"\e7a4"}.el-icon-warning-outline:before{content:"\e6c9"}.el-icon-warning:before{content:"\e7a3"}.el-icon-goods:before{content:"\e7c2"}.el-icon-s-goods:before{content:"\e7b2"}.el-icon-star-off:before{content:"\e717"}.el-icon-star-on:before{content:"\e797"}.el-icon-more-outline:before{content:"\e6cc"}.el-icon-more:before{content:"\e794"}.el-icon-phone-outline:before{content:"\e6cb"}.el-icon-phone:before{content:"\e795"}.el-icon-user:before{content:"\e6e3"}.el-icon-user-solid:before{content:"\e7a5"}.el-icon-setting:before{content:"\e6ca"}.el-icon-s-tools:before{content:"\e7ac"}.el-icon-delete:before{content:"\e6d7"}.el-icon-delete-solid:before{content:"\e7c9"}.el-icon-eleme:before{content:"\e7c7"}.el-icon-platform-eleme:before{content:"\e7ca"}.el-icon-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon--right{margin-left:5px}.el-icon--left{margin-right:5px}@-webkit-keyframes rotating{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}100%{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}}@keyframes rotating{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}100%{-webkit-transform:rotateZ(360deg);transform:rotateZ(360deg)}} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | var test1 = function () { alert(11) } |
| | | export { test1 } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | //对vueåæ°è¿è¡æ©å± |
| | | var extend = function (param) { |
| | | console.log(param) |
| | | } |
| | | export { extend } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | //对vueåæ°è¿è¡æ©å± |
| | | var extend = function ($vueParam) { |
| | | $vueParam.methods.volBoxFrom = function () { |
| | | this.$Message.info("æ©å±js,å¢å å¼¹åºæ¶æ¯"); |
| | | this.$refs.volBoxFrom.show(); |
| | | } |
| | | //ä¿®æ¹data屿§: |
| | | let data = $vueParam.data(); |
| | | data.formFileds['extend'] = "卿æ©å±å段"; |
| | | data.formOptions.splice(0,0,{ filed: "extend", title: "卿å¢å åæ®µ", type: "text", required: true }); |
| | | $vueParam.data = function () { |
| | | return data; |
| | | } |
| | | } |
| | | export { extend } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="text-align: center;font-size: 16px;padding: 20px;">æ£å¨å è½½èµæº...</div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | created() { |
| | | // console.log('loading') |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-alert |
| | | :title="'å½åéä¸' + auditParam.rows + 'æ¡è®°å½å¾
å®¡æ ¸..'" |
| | | type="success" |
| | | :closable="false" |
| | | > |
| | | </el-alert> |
| | | <div class="item"> |
| | | <label>å®¡æ ¸ç»æï¼</label> |
| | | <el-radio-group v-model="auditParam.status"> |
| | | <el-radio |
| | | v-for="item in auditParam.data" |
| | | :key="item.status" |
| | | :label="item.status" |
| | | > |
| | | <span>{{ item.text }}</span> |
| | | </el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | <div class="item"> |
| | | <label style="margin-right: 13px;">å¤ æ³¨ï¼</label> |
| | | <el-input |
| | | v-model="auditParam.reason" |
| | | type="textarea" |
| | | style="margin-right: 13px;" |
| | | :autosize="{ minRows: 4, maxRows: 10 }" |
| | | placeholder="å®¡æ ¸å¤æ³¨..." |
| | | ></el-input> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | props: { |
| | | auditParam: { |
| | | type: Object, |
| | | default: () => { |
| | | return { |
| | | auditParam: { |
| | | rows: 0, |
| | | model: false, |
| | | status: -1, |
| | | reason: "", |
| | | data: [], //[{ text: "éè¿", status: 1 }, { text: "æç»", status: 2 }] |
| | | }, |
| | | }; |
| | | }, |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .item{ |
| | | margin-top: 20px; |
| | | display: flex; |
| | | > label{ |
| | | width: 86px; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div></div> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div id="test"></div> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div data-v-394040b0 class="icons"> |
| | | <div |
| | | @click="select(index)" |
| | | v-for="(item, index) in icons" |
| | | :key="index" |
| | | class="icons-item" |
| | | > |
| | | <i |
| | | :class="[item, selectIndex == index ? 'active' : '']" |
| | | style="font-size: 32px" |
| | | ></i> |
| | | <p>{{ item }}</p> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | props: { |
| | | onSelect: { |
| | | type: Function, |
| | | default: () => { |
| | | return ""; |
| | | }, |
| | | }, |
| | | }, |
| | | methods: { |
| | | select(index) { |
| | | this.selectIndex = index; |
| | | this.onSelect(index < 0 ? "" : this.icons[index]); |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | selectIndex: -1, |
| | | icons: [ |
| | | //ivu-icon ivu-icon-ios-add |
| | | "el-icon-platform-eleme", |
| | | "el-icon-eleme", |
| | | "el-icon-delete-solid", |
| | | "el-icon-delete", |
| | | "el-icon-s-tools", |
| | | "el-icon-setting", |
| | | "el-icon-user-solid", |
| | | "el-icon-user", |
| | | "el-icon-phone", |
| | | "el-icon-phone-outline", |
| | | "el-icon-more", |
| | | "el-icon-more-outline", |
| | | "el-icon-star-on", |
| | | "el-icon-star-off", |
| | | "el-icon-s-goods", |
| | | "el-icon-goods", |
| | | "el-icon-warning", |
| | | "el-icon-warning-outline", |
| | | "el-icon-question", |
| | | "el-icon-info", |
| | | "el-icon-remove", |
| | | "el-icon-circle-plus", |
| | | "el-icon-success", |
| | | "el-icon-error", |
| | | "el-icon-zoom-in", |
| | | "el-icon-zoom-out", |
| | | "el-icon-remove-outline", |
| | | "el-icon-circle-plus-outline", |
| | | "el-icon-circle-check", |
| | | "el-icon-circle-close", |
| | | "el-icon-s-help", |
| | | "el-icon-help", |
| | | "el-icon-minus", |
| | | "el-icon-plus", |
| | | "el-icon-check", |
| | | "el-icon-close", |
| | | "el-icon-picture", |
| | | "el-icon-picture-outline", |
| | | "el-icon-picture-outline-round", |
| | | "el-icon-upload", |
| | | "el-icon-upload2", |
| | | "el-icon-download", |
| | | "el-icon-camera-solid", |
| | | "el-icon-camera", |
| | | "el-icon-video-camera-solid", |
| | | "el-icon-video-camera", |
| | | "el-icon-message-solid", |
| | | "el-icon-bell", |
| | | "el-icon-s-cooperation", |
| | | "el-icon-s-order", |
| | | "el-icon-s-platform", |
| | | "el-icon-s-fold", |
| | | "el-icon-s-unfold", |
| | | "el-icon-s-operation", |
| | | "el-icon-s-promotion", |
| | | "el-icon-s-home", |
| | | "el-icon-s-release", |
| | | "el-icon-s-ticket", |
| | | "el-icon-s-management", |
| | | "el-icon-s-open", |
| | | "el-icon-s-shop", |
| | | "el-icon-s-marketing", |
| | | "el-icon-s-flag", |
| | | "el-icon-s-comment", |
| | | "el-icon-s-finance", |
| | | "el-icon-s-claim", |
| | | "el-icon-s-custom", |
| | | "el-icon-s-opportunity", |
| | | "el-icon-s-data", |
| | | "el-icon-s-check", |
| | | "el-icon-s-grid", |
| | | "el-icon-menu", |
| | | "el-icon-share", |
| | | "el-icon-d-caret", |
| | | "el-icon-caret-left", |
| | | "el-icon-caret-right", |
| | | "el-icon-caret-bottom", |
| | | "el-icon-caret-top", |
| | | "el-icon-bottom-left", |
| | | "el-icon-bottom-right", |
| | | "el-icon-back", |
| | | "el-icon-right", |
| | | "el-icon-bottom", |
| | | "el-icon-top", |
| | | "el-icon-top-left", |
| | | "el-icon-top-right", |
| | | "el-icon-arrow-left", |
| | | "el-icon-arrow-right", |
| | | "el-icon-arrow-down", |
| | | "el-icon-arrow-up", |
| | | "el-icon-d-arrow-left", |
| | | "el-icon-d-arrow-right", |
| | | "el-icon-video-pause", |
| | | "el-icon-video-play", |
| | | "el-icon-refresh", |
| | | "el-icon-refresh-right", |
| | | "el-icon-refresh-left", |
| | | "el-icon-finished", |
| | | "el-icon-sort", |
| | | "el-icon-sort-up", |
| | | "el-icon-sort-down", |
| | | "el-icon-rank", |
| | | "el-icon-loading", |
| | | "el-icon-view", |
| | | "el-icon-c-scale-to-original", |
| | | "el-icon-date", |
| | | "el-icon-edit", |
| | | "el-icon-edit-outline", |
| | | "el-icon-folder", |
| | | "el-icon-folder-opened", |
| | | "el-icon-folder-add", |
| | | "el-icon-folder-remove", |
| | | "el-icon-folder-delete", |
| | | "el-icon-folder-checked", |
| | | "el-icon-tickets", |
| | | "el-icon-document-remove", |
| | | "el-icon-document-delete", |
| | | "el-icon-document-copy", |
| | | "el-icon-document-checked", |
| | | "el-icon-document", |
| | | "el-icon-document-add", |
| | | "el-icon-printer", |
| | | "el-icon-paperclip", |
| | | "el-icon-takeaway-box", |
| | | "el-icon-search", |
| | | "el-icon-monitor", |
| | | "el-icon-attract", |
| | | "el-icon-mobile", |
| | | "el-icon-scissors", |
| | | "el-icon-umbrella", |
| | | "el-icon-headset", |
| | | "el-icon-brush", |
| | | "el-icon-mouse", |
| | | "el-icon-coordinate", |
| | | "el-icon-magic-stick", |
| | | "el-icon-reading", |
| | | "el-icon-data-line", |
| | | "el-icon-data-board", |
| | | "el-icon-pie-chart", |
| | | "el-icon-data-analysis", |
| | | "el-icon-collection-tag", |
| | | "el-icon-film", |
| | | "el-icon-suitcase", |
| | | "el-icon-suitcase-1", |
| | | "el-icon-receiving", |
| | | "el-icon-collection", |
| | | "el-icon-files", |
| | | "el-icon-notebook-1", |
| | | "el-icon-notebook-2", |
| | | "el-icon-toilet-paper", |
| | | "el-icon-office-building", |
| | | "el-icon-school", |
| | | "el-icon-table-lamp", |
| | | "el-icon-house", |
| | | "el-icon-no-smoking", |
| | | "el-icon-smoking", |
| | | "el-icon-shopping-cart-full", |
| | | "el-icon-shopping-cart-1", |
| | | "el-icon-shopping-cart-2", |
| | | "el-icon-shopping-bag-1", |
| | | "el-icon-shopping-bag-2", |
| | | "el-icon-sold-out", |
| | | "el-icon-sell", |
| | | "el-icon-present", |
| | | "el-icon-box", |
| | | "el-icon-bank-card", |
| | | "el-icon-money", |
| | | "el-icon-coin", |
| | | "el-icon-wallet", |
| | | "el-icon-discount", |
| | | "el-icon-price-tag", |
| | | "el-icon-news", |
| | | "el-icon-guide", |
| | | "el-icon-male", |
| | | "el-icon-female", |
| | | "el-icon-thumb", |
| | | "el-icon-cpu", |
| | | "el-icon-link", |
| | | "el-icon-connection", |
| | | "el-icon-open", |
| | | "el-icon-turn-off", |
| | | "el-icon-set-up", |
| | | "el-icon-chat-round", |
| | | "el-icon-chat-line-round", |
| | | "el-icon-chat-square", |
| | | "el-icon-chat-dot-round", |
| | | "el-icon-chat-dot-square", |
| | | "el-icon-chat-line-square", |
| | | "el-icon-message", |
| | | "el-icon-postcard", |
| | | "el-icon-position", |
| | | "el-icon-turn-off-microphone", |
| | | "el-icon-microphone", |
| | | "el-icon-close-notification", |
| | | "el-icon-bangzhu", |
| | | "el-icon-time", |
| | | "el-icon-odometer", |
| | | "el-icon-crop", |
| | | "el-icon-aim", |
| | | "el-icon-switch-button", |
| | | "el-icon-full-screen", |
| | | "el-icon-copy-document", |
| | | "el-icon-mic", |
| | | "el-icon-stopwatch", |
| | | "el-icon-medal-1", |
| | | "el-icon-medal", |
| | | "el-icon-trophy", |
| | | "el-icon-trophy-1", |
| | | "el-icon-first-aid-kit", |
| | | "el-icon-discover", |
| | | "el-icon-place", |
| | | "el-icon-location", |
| | | "el-icon-location-outline", |
| | | "el-icon-location-information", |
| | | "el-icon-add-location", |
| | | "el-icon-delete-location", |
| | | "el-icon-map-location", |
| | | "el-icon-alarm-clock", |
| | | "el-icon-timer", |
| | | "el-icon-watch-1", |
| | | "el-icon-watch", |
| | | "el-icon-lock", |
| | | "el-icon-unlock", |
| | | "el-icon-key", |
| | | "el-icon-service", |
| | | "el-icon-mobile-phone", |
| | | "el-icon-bicycle", |
| | | "el-icon-truck", |
| | | "el-icon-ship", |
| | | "el-icon-basketball", |
| | | "el-icon-football", |
| | | "el-icon-soccer", |
| | | "el-icon-baseball", |
| | | "el-icon-wind-power", |
| | | "el-icon-light-rain", |
| | | "el-icon-lightning", |
| | | "el-icon-heavy-rain", |
| | | "el-icon-sunrise", |
| | | "el-icon-sunrise-1", |
| | | "el-icon-sunset", |
| | | "el-icon-sunny", |
| | | "el-icon-cloudy", |
| | | "el-icon-partly-cloudy", |
| | | "el-icon-cloudy-and-sunny", |
| | | "el-icon-moon", |
| | | "el-icon-moon-night", |
| | | "el-icon-dish", |
| | | "el-icon-dish-1", |
| | | "el-icon-food", |
| | | "el-icon-chicken", |
| | | "el-icon-fork-spoon", |
| | | "el-icon-knife-fork", |
| | | "el-icon-burger", |
| | | "el-icon-tableware", |
| | | "el-icon-sugar", |
| | | "el-icon-dessert", |
| | | "el-icon-ice-cream", |
| | | "el-icon-hot-water", |
| | | "el-icon-water-cup", |
| | | "el-icon-coffee-cup", |
| | | "el-icon-cold-drink", |
| | | "el-icon-goblet", |
| | | "el-icon-goblet-full", |
| | | "el-icon-goblet-square", |
| | | "el-icon-goblet-square-full", |
| | | "el-icon-refrigerator", |
| | | "el-icon-grape", |
| | | "el-icon-watermelon", |
| | | "el-icon-cherry", |
| | | "el-icon-apple", |
| | | "el-icon-pear", |
| | | "el-icon-orange", |
| | | "el-icon-coffee", |
| | | "el-icon-ice-tea", |
| | | "el-icon-ice-drink", |
| | | "el-icon-milk-tea", |
| | | "el-icon-potato-strips", |
| | | "el-icon-lollipop", |
| | | "el-icon-ice-cream-square", |
| | | "el-icon-ice-cream-round", |
| | | ], |
| | | }; |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | |
| | | <style lang="less" scoped> |
| | | .icons-item { |
| | | float: left; |
| | | margin: 6px 6px 6px 0; |
| | | width: 115px; |
| | | text-align: center; |
| | | list-style: none; |
| | | cursor: pointer; |
| | | height: 100px; |
| | | color: #5c6b77; |
| | | transition: all 0.2s ease; |
| | | position: relative; |
| | | padding-top: 10px; |
| | | } |
| | | .active { |
| | | border: 1px solid; |
| | | background: #f44336; |
| | | color: white; |
| | | font-size: 32px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-select |
| | | style="width: 150px" |
| | | v-if="['select', 'selectList'].indexOf(singleSearch.type) != -1" |
| | | v-model="searchFormFields[singleSearch.field]" |
| | | :filterable=" |
| | | singleSearch.filter || singleSearch.data.length > 10 ? true : false |
| | | " |
| | | :placeholder="'è¯·éæ©' + singleSearch.title" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in singleSearch.data" |
| | | :key="item.key" |
| | | :label="item.value" |
| | | :value="item.key" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <div |
| | | class="date-range" |
| | | v-else-if="['date', 'datetime'].indexOf(singleSearch.type) != -1" |
| | | > |
| | | <el-date-picker |
| | | style="width: 210px" |
| | | :clearable="false" |
| | | unlink-panels |
| | | v-model="searchFormFields[singleSearch.field]" |
| | | type="daterange" |
| | | :value-format="getDateFormat(singleSearch)" |
| | | :placeholder="singleSearch.title" |
| | | > |
| | | </el-date-picker> |
| | | <i |
| | | class="el-icon-circle-close" |
| | | @click="dateRangeClear(singleSearch.field)" |
| | | ></i> |
| | | </div> |
| | | <el-cascader |
| | | style="width: 210px" |
| | | clearable |
| | | v-model="searchFormFields[singleSearch.field]" |
| | | v-else-if="singleSearch.type == 'cascader'" |
| | | :options="singleSearch.data" |
| | | :props="{ checkStrictly: true }" |
| | | > |
| | | </el-cascader> |
| | | <el-input |
| | | clearable |
| | | v-else |
| | | style="width: 150px" |
| | | size="default" |
| | | v-model="searchFormFields[singleSearch.field]" |
| | | :placeholder="singleSearch.title" |
| | | @keypress="tiggerPress" |
| | | /> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | props: { |
| | | singleSearch: { |
| | | type: Object, |
| | | default: {}, |
| | | }, |
| | | searchFormFields: { |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | }, |
| | | }, |
| | | tiggerPress: { |
| | | type: Function, |
| | | default: () => {}, |
| | | }, |
| | | }, |
| | | methods: { |
| | | compareDate(date1, date2) { |
| | | if (!date2) { |
| | | return true; |
| | | } |
| | | return ( |
| | | date1.valueOf() < |
| | | (typeof date2 == "number" ? date2 : new Date(date2).valueOf()) |
| | | ); |
| | | }, |
| | | getDateFormat(item) { |
| | | //è§https://day.js.org/docs/zh-CN/display/format |
| | | return item.type == "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss"; |
| | | }, |
| | | getDateOptions(date, item) { |
| | | if ((!item.min && !item.max) || !date) { |
| | | return false; |
| | | } |
| | | if (item.min && item.min.indexOf(" ") == -1) { |
| | | //ä¸è®¾ç½®æ¶åç§ï¼åé¢ä¼èªå¨å ä¸ 08:00 |
| | | item.min = item.min + " 00:00:000"; |
| | | } |
| | | return ( |
| | | this.compareDate(date, item.min) || !this.compareDate(date, item.max) |
| | | ); |
| | | }, |
| | | dateRangeClear(field) { |
| | | this.searchFormFields[field]=[undefined,undefined]; |
| | | }, |
| | | }, |
| | | created() { |
| | | this.singleSearch.dateType = this.singleSearch.type + "range"; |
| | | if ( |
| | | this.singleSearch.type == "date" || |
| | | this.singleSearch.type == "datetime" |
| | | ) { |
| | | var _dateVal = this.searchFormFields[this.singleSearch.field]; |
| | | if ( |
| | | typeof this.singleSearch.range == "boolean" && |
| | | !this.singleSearch.range |
| | | ) { |
| | | this.searchFormFields[this.singleSearch.field] = ""; |
| | | this.singleSearch.dateType = this.singleSearch.type; |
| | | return this.singleSearch.dateType; |
| | | } else if (!(_dateVal instanceof Array)) { |
| | | this.searchFormFields[this.singleSearch.field] = ["", ""]; |
| | | } else if (_dateVal.length != 2) { |
| | | _dateVal.splice(0); |
| | | _dateVal.push(...["", ""]); |
| | | } |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .date-range{ |
| | | position: relative; |
| | | > i{ |
| | | display: none; |
| | | height: 27px; |
| | | line-height: 27px; |
| | | right: 1px; |
| | | top: 3px; |
| | | font-size: 13px; |
| | | color: #b4adad; |
| | | position: absolute; |
| | | padding: 0 6px 0 3px; |
| | | background: #ffff; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .date-range:hover > i{ |
| | | display: inline-block; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="router-loading" style="background: #eeeeee5c;"> |
| | | <div class="spanner"> |
| | | <span></span> |
| | | <span></span> |
| | | <span></span> |
| | | <span></span> |
| | | <span></span> |
| | | <span></span> |
| | | <span></span> |
| | | <span></span> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return {}; |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .router-loading { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | font-size: 100px; |
| | | text-align: center; |
| | | padding-top: 200px; |
| | | color: #808080; |
| | | z-index: 9999; |
| | | } |
| | | .spanner { |
| | | width: 100px; |
| | | height: 100px; |
| | | position: relative; |
| | | margin: 0 auto; |
| | | } |
| | | .router-loading span { |
| | | display: inline-block; |
| | | width: 20px; |
| | | height: 20px; |
| | | border-radius: 50%; |
| | | background: #66b1ff; |
| | | position: absolute; |
| | | animation: r_load 1.04s ease infinite; |
| | | } |
| | | @keyframes r_load { |
| | | 0% { |
| | | transform: scale(1.2); |
| | | opacity: 1; |
| | | } |
| | | 100% { |
| | | transform: scale(0.3); |
| | | opacity: 0.5; |
| | | } |
| | | } |
| | | .router-loading span:nth-child(1) { |
| | | left: 0; |
| | | top: 50%; |
| | | margin-top: -10px; |
| | | animation-delay: 0.13s; |
| | | } |
| | | .router-loading span:nth-child(2) { |
| | | left: 14px; |
| | | top: 14px; |
| | | animation-delay: 0.26s; |
| | | } |
| | | .router-loading span:nth-child(3) { |
| | | left: 50%; |
| | | top: 0; |
| | | margin-left: -10px; |
| | | animation-delay: 0.39s; |
| | | } |
| | | .router-loading span:nth-child(4) { |
| | | top: 14px; |
| | | right: 14px; |
| | | animation-delay: 0.52s; |
| | | } |
| | | .router-loading span:nth-child(5) { |
| | | right: 0; |
| | | top: 50%; |
| | | margin-top: -10px; |
| | | animation-delay: 0.65s; |
| | | } |
| | | .router-loading span:nth-child(6) { |
| | | right: 14px; |
| | | bottom: 14px; |
| | | animation-delay: 0.78s; |
| | | } |
| | | .router-loading span:nth-child(7) { |
| | | bottom: 0; |
| | | left: 50%; |
| | | margin-left: -10px; |
| | | animation-delay: 0.91s; |
| | | } |
| | | .router-loading span:nth-child(8) { |
| | | bottom: 14px; |
| | | left: 14px; |
| | | animation-delay: 1.04s; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="upload-container"> |
| | | <a :href="template.url" ref="template"></a> |
| | | <div class="button-group"> |
| | | <el-upload |
| | | style="float: left" |
| | | ref="uploadFile" |
| | | :max-size="maxSize" |
| | | :on-change="clearMsg" |
| | | :before-upload="beforeUpload" |
| | | :action="url" |
| | | > |
| | | <el-button size="small" |
| | | ><i class="el-icon-folder-opened"></i>éæ©æä»¶</el-button |
| | | > |
| | | </el-upload> |
| | | <el-button |
| | | v-if="template.url" |
| | | style="margin-left: 10px" |
| | | type="primary" |
| | | size="small" |
| | | @click="dowloadTemplate" |
| | | :loading="loadingStatus" |
| | | > |
| | | <i class="el-icon-bottom"></i> |
| | | ä¸è½½æ¨¡æ¿</el-button |
| | | > |
| | | <el-button |
| | | type="success" |
| | | size="small" |
| | | @click="upload" |
| | | :loading="loadingStatus" |
| | | > |
| | | <i class="el-icon-top"></i> |
| | | ä¸ä¼ æä»¶</el-button |
| | | > |
| | | </div> |
| | | <div class="alert"> |
| | | <el-alert title="ä¸ä¼ 说æ" type="warning" :closable="false" show-icon |
| | | >åªè½ä¸ä¼ excelæä»¶,æä»¶å¤§å°ä¸è¶
è¿{{ maxSize }}M</el-alert |
| | | > |
| | | </div> |
| | | |
| | | <div v-if="file"> |
| | | <h3>æä»¶å表</h3> |
| | | <div class="file-info"> |
| | | <span>æä»¶åï¼{{ file.name }}</span> |
| | | <span>大å°{{ (file.size / 1024).toFixed(2) }}KB</span> |
| | | </div> |
| | | </div> |
| | | <div v-show="message" class="v-r-message"> |
| | | <h3 class="title">ä¸ä¼ ç»æ</h3> |
| | | <div class="text" :class="resultClass" v-html="message"></div> |
| | | </div> |
| | | <slot></slot> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | //ç®ååªæ¯æå个Excelä¸ä¼ ï¼å
¶ä»åè½å¼åä¸... |
| | | export default { |
| | | components: {}, |
| | | props: { |
| | | url: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | template: { |
| | | //ä¸è½½æ¨¡æ¿é
ç½® |
| | | type: Object, |
| | | default: () => { |
| | | return { |
| | | url: '', //模æ¿ä¸è½½è·¯å¾ï¼å¦ææ²¡ææ¨¡æ¿è·¯å¾ï¼å䏿¾ç¤ºä¸è½½æ¨¡æ¿åè½ |
| | | fileName: 'æªå®ä¹æä»¶å' //ä¸è½½æ¨¡æ¿çæä»¶å |
| | | }; |
| | | } |
| | | }, |
| | | importExcelBefore: { |
| | | type: Function, |
| | | default: (file) => { |
| | | return true; |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | maxSize: 100, |
| | | model: true, |
| | | file: null, |
| | | loadingStatus: false, |
| | | message: '', |
| | | resultClass: '' |
| | | }; |
| | | }, |
| | | methods: { |
| | | clearMsg() { |
| | | this.message = ''; |
| | | }, |
| | | reset() { |
| | | this.file = null; |
| | | this.message = ''; |
| | | this.resultClass = ''; |
| | | }, |
| | | getFileType() { |
| | | let fileName = |
| | | this.file.name |
| | | .split('.') |
| | | .pop() |
| | | .toLocaleLowerCase() || ''; |
| | | if (['numbers', 'csv', 'xls', 'xlsx'].indexOf(fileName) == -1) { |
| | | this.$Message.error('åªè½éæ©excelæä»¶'); |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | beforeUpload(file) { |
| | | this.file = file; |
| | | if (!this.getFileType()) { |
| | | return false; |
| | | } |
| | | return false; |
| | | }, |
| | | upload() { |
| | | let _url = this.url; |
| | | if (!_url) { |
| | | return this.$Message.error('没æé
置好Url'); |
| | | } |
| | | |
| | | if (!this.file) { |
| | | return this.$Message.error('è¯·éæ©æä»¶'); |
| | | } |
| | | var formData = new FormData(); |
| | | formData.append('fileInput', this.file); |
| | | if (!this.importExcelBefore(formData)) { |
| | | return; |
| | | } |
| | | this.loadingStatus = true; |
| | | this.http.post(_url, formData).then( |
| | | (x) => { |
| | | // this.$refs.uploadFile.clearFiles(); |
| | | this.loadingStatus = false; |
| | | this.file = null; |
| | | if (x.status) { |
| | | this.$emit('importExcelAfter', x); |
| | | } |
| | | |
| | | this.message = x.message; |
| | | this.resultClass = x.status ? 'v-r-success' : 'v-r-error'; |
| | | }, |
| | | (error) => { |
| | | this.loadingStatus = false; |
| | | } |
| | | ); |
| | | }, |
| | | dowloadTemplate() { |
| | | let url = this.template.url; |
| | | let xmlResquest = new XMLHttpRequest(); |
| | | xmlResquest.open('GET', url, true); |
| | | xmlResquest.setRequestHeader('Content-type', 'application/json'); |
| | | xmlResquest.setRequestHeader( |
| | | 'Authorization', |
| | | this.$store.getters.getToken() |
| | | ); |
| | | let fileName = this.template.fileName + '.xlsx'; |
| | | let elink = this.$refs.template; |
| | | xmlResquest.responseType = 'blob'; |
| | | let $_vue = this; |
| | | this.loadingStatus = true; |
| | | xmlResquest.onload = function(oEvent) { |
| | | $_vue.loadingStatus = false; |
| | | if (xmlResquest.response.type == 'application/json') { |
| | | return $_vue.message.error('æªæ¾å°ä¸è½½æä»¶'); |
| | | } |
| | | let content = xmlResquest.response; |
| | | elink.download = fileName; |
| | | let blob = new Blob([content]); |
| | | elink.href = URL.createObjectURL(blob); |
| | | elink.click(); |
| | | }; |
| | | xmlResquest.send(); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .upload-container { |
| | | min-height: 270px !important; |
| | | display: inline-block; |
| | | width: 100%; |
| | | padding: 10px; |
| | | border: 1px dashed #989898; |
| | | min-height: 250px; |
| | | border-radius: 5px; |
| | | .alert { |
| | | margin-top: 12px; |
| | | } |
| | | .el-button-group > * { |
| | | display: flex; |
| | | } |
| | | h3 { |
| | | margin: 9px 0px; |
| | | } |
| | | .file-info > span { |
| | | margin-right: 20px; |
| | | } |
| | | .v-r-message { |
| | | margin-top: 10px; |
| | | .title { |
| | | margin-bottom: 2px; |
| | | } |
| | | > .text { |
| | | font-size: 13px; |
| | | } |
| | | .v-r-success { |
| | | color: #02b702; |
| | | } |
| | | .v-r-error { |
| | | color: #dc0909; |
| | | } |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <vol-table |
| | | :tableData="tableData" |
| | | :columns="columns" |
| | | :height="411" |
| | | :pagination-hide="true" |
| | | :load-key="false" |
| | | :text-inline="false" |
| | | :ck="false" |
| | | ></vol-table> |
| | | </template> |
| | | <script> |
| | | import VolTable from '@/components/basic/VolTable.vue'; |
| | | import { |
| | | defineComponent, |
| | | ref, |
| | | reactive, |
| | | toRefs, |
| | | getCurrentInstance |
| | | } from 'vue'; |
| | | export default defineComponent({ |
| | | components: { |
| | | VolTable |
| | | }, |
| | | props: { |
| | | tableData: { |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | } |
| | | } |
| | | }, |
| | | setup() { |
| | | const columns = reactive([ |
| | | { title: 'èç¹', field: 'stepName' }, |
| | | { title: '审æ¹äºº', field: 'auditor' }, |
| | | { title: '审æ¹ç»æ', field: 'auditStatus' }, |
| | | { title: 'å®¡æ¹æ¶é´', field: 'auditDate',width:150 }, |
| | | { title: '夿³¨', field: 'remark' } |
| | | ]); |
| | | return { |
| | | columns |
| | | } |
| | | } |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | .view-container { |
| | | // padding: 15px; |
| | | background: white; |
| | | .grid-search { |
| | | padding-top: 15px; |
| | | //padding: 15px 15px 0 15px; |
| | | } |
| | | .grid-container, |
| | | .grid-body { |
| | | padding: 0 15px; |
| | | } |
| | | .view-header { |
| | | padding-left: 15px; |
| | | padding-right: 15px; |
| | | } |
| | | .fs-line { |
| | | height: 9px; |
| | | background: #f1f1f1; |
| | | margin-top: -10px; |
| | | margin-bottom: 10px; |
| | | } |
| | | } |
| | | .view-header { |
| | | height: 45px; |
| | | position: relative; |
| | | padding-bottom: 11px; |
| | | display: flex; |
| | | .search-line { |
| | | min-width: 150px; |
| | | } |
| | | .search-line > div { |
| | | margin-left: 5px; |
| | | margin-right: 10px; |
| | | } |
| | | .search-line > div > div { |
| | | width: 200px; |
| | | text-align: left; |
| | | } |
| | | .search-line > div:first-child { |
| | | flex: 1; |
| | | } |
| | | .search-line > div .ivu-select-dropdown { |
| | | max-height: 300px; |
| | | } |
| | | .btn-group { |
| | | white-space: nowrap; |
| | | button { |
| | | margin-left: 10px; |
| | | // padding: 5px 16px; |
| | | } |
| | | } |
| | | .btn-group .ivu-dropdown-item { |
| | | text-align: left !important; |
| | | } |
| | | .btn-group .ivu-dropdown-item:not(:last-child) { |
| | | border-bottom: 1px dotted #eee; |
| | | } |
| | | .desc-text { |
| | | margin-top: 5px; |
| | | font-weight: bold; |
| | | margin-bottom: 3px; |
| | | font-size: 14px; |
| | | color: #313131; |
| | | white-space: nowrap; |
| | | border-bottom: 2px solid #646565; |
| | | i { |
| | | font-size: 16px; |
| | | position: relative; |
| | | top: 1px; |
| | | margin-right: 2px; |
| | | } |
| | | } |
| | | .search-box { |
| | | background: #fefefe; |
| | | margin-top: 45px; |
| | | border: 1px solid #ececec; |
| | | position: absolute; |
| | | z-index: 999; |
| | | left: 0; |
| | | right: 0; |
| | | padding: 25px 40px; |
| | | padding-bottom: 0; |
| | | box-shadow: 0px 7px 18px -12px #bdc0bb; |
| | | } |
| | | .notice { |
| | | font-size: 13px; |
| | | color: #6b6b6b; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | position: relative; |
| | | top: 12px; |
| | | flex: 1; |
| | | left: 10px; |
| | | margin-right: 20px; |
| | | } |
| | | } |
| | | |
| | | .table-info-cell-title { |
| | | background-color: #f5f5f5 !important; |
| | | } |
| | | .box-com { |
| | | > div.item { |
| | | // margin-bottom: 10px; |
| | | padding: 15px 17px 0 8px; |
| | | margin-bottom: 12px; |
| | | background: white; |
| | | } |
| | | > div.form-item { |
| | | padding: 19px 16px 0px 5px; |
| | | //box-shadow: 0 1px 7px rgb(199, 199, 199); |
| | | } |
| | | > div.table-item { |
| | | padding: 0 10px; |
| | | border-top: 1.5px solid #eaeaea; |
| | | } |
| | | .v-text { |
| | | line-height: 27px; |
| | | } |
| | | .form-text { |
| | | position: relative; |
| | | border-bottom: 1px solid #eee; |
| | | font-size: 14px; |
| | | margin-bottom: 14px; |
| | | } |
| | | } |
| | | |
| | | .form-closex { |
| | | text-align: right; |
| | | padding-bottom: 24px; |
| | | } |
| | | .form-closex button { |
| | | margin-left: 10px; |
| | | padding: 4px 13px; |
| | | } |
| | | .toolbar { |
| | | padding: 3px 0px; |
| | | width: 100%; |
| | | display: flex; |
| | | .title { |
| | | line-height: 29px; |
| | | border-bottom: none; |
| | | font-size: 13px; |
| | | font-weight: bolder; |
| | | margin-bottom: 0; |
| | | color: #5d5c5c; |
| | | .icon { |
| | | color: #009688; |
| | | font-size: 18px; |
| | | } |
| | | |
| | | i { |
| | | line-height: 29px; |
| | | border-bottom: none; |
| | | font-weight: bolder; |
| | | margin-bottom: 0; |
| | | color: #5d5c5c; |
| | | position: relative; |
| | | margin-top: -4px; |
| | | font-size: 14px; |
| | | } |
| | | } |
| | | .btns { |
| | | line-height: 28px; |
| | | flex: 1; |
| | | text-align: right; |
| | | button { |
| | | // border: none; |
| | | // margin-left:15px; |
| | | border: 0px; |
| | | padding: 0px 9px; |
| | | color: #292929; |
| | | } |
| | | button:hover{ |
| | | color: #0089f6; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="layout-container"> |
| | | <a :href="exportHref" ref="export"></a> |
| | | <!--å¼å¯æå è½½2020.12.06 --> |
| | | <vol-box |
| | | :on-model-close="closeCustomModel" |
| | | v-model="viewModel" |
| | | :height="520" |
| | | :width="500" |
| | | :padding="0" |
| | | :lazy="true" |
| | | title="设置" |
| | | > |
| | | <template #content> |
| | | <custom-column :view-columns="viewColumns"></custom-column> |
| | | </template> |
| | | <template #footer> |
| | | <div style="text-align: center"> |
| | | <el-button type="default" size="small" @click="closeCustomModel" |
| | | ><i class="el-icon-close"></i>åæ¶</el-button |
| | | > |
| | | <el-button type="success" size="small" @click="initViewColumns(true)" |
| | | ><i class="el-icon-refresh"></i>éç½®</el-button |
| | | > |
| | | <el-button type="primary" size="small" @click="saveColumnConfig" |
| | | ><i class="el-icon-check"></i>ç¡®å®</el-button |
| | | > |
| | | </div> |
| | | </template> |
| | | </vol-box> |
| | | <ViewGridAudit @auditClick="saveAudit" :option="table" ref="audit"> |
| | | |
| | | </ViewGridAudit> |
| | | <!--å¼å¯æå è½½2020.12.06 --> |
| | | <!--å®¡æ ¸(弿¥ç¹å»æé®æ¶æå è½½å¾
å®)--> |
| | | <!-- <vol-box |
| | | v-model="auditParam.model" |
| | | :height="auditParam.height" |
| | | :width="750" |
| | | :lazy="true" |
| | | :padding="0" |
| | | title="审æ¹" |
| | | > |
| | | <template #content> |
| | | <el-tabs type="card"> |
| | | <el-tab-pane label="å½å审æ¹"> |
| | | <div class="v-steps"> |
| | | <div |
| | | :class="{ 'step-current': item.isCurrent }" |
| | | class="step-item" |
| | | v-for="(item, index) in workFlowSteps" |
| | | :key="index" |
| | | > |
| | | <div class="left-item"> |
| | | <div>å®¡æ¹æ¶é´</div> |
| | | <div class="left-date">{{ item.auditDate || 'å¾
审æ¹' }}</div> |
| | | </div> |
| | | <div class="right-item"> |
| | | <div class="step-line"></div> |
| | | <i class="step-circle"></i> |
| | | <div class="step-title"> |
| | | {{ item.stepName }} |
| | | </div> |
| | | <div class="step-text">审æ¹äººï¼{{ item.auditor }}</div> |
| | | <div class="step-text"> |
| | | ç¶ æï¼ {{ getAuditStatus(item.auditStatus) }} |
| | | </div> |
| | | <div class="step-text">å¤ æ³¨ï¼ {{ item.remark || '-' }}</div> |
| | | </div> |
| | | </div> |
| | | <div |
| | | :style="{ |
| | | 'margin-top': workFlowSteps.length ? '20px' : '-17px' |
| | | }" |
| | | class="audit-content" |
| | | v-show="auditParam.showAction" |
| | | > |
| | | <div style="margin-bottom:10px;"> |
| | | 审æ¹ï¼ |
| | | <el-radio-group |
| | | style="margin-left:15px" |
| | | v-model="auditParam.value" |
| | | > |
| | | <el-radio |
| | | v-for="item in auditParam.data" |
| | | :key="item.value" |
| | | :label="item.value" |
| | | > |
| | | <span>{{ item.text }}</span> |
| | | </el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | |
| | | <el-input |
| | | v-model="auditParam.reason" |
| | | type="textarea" |
| | | style="margin-right: 13px;" |
| | | :autosize="{ minRows: 4, maxRows: 10 }" |
| | | placeholder="请è¾å
¥å¤æ³¨..." |
| | | ></el-input> |
| | | </div> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane v-if="workFlowSteps.length" label="审æ¹è®°å½"> |
| | | <audit-his :table-data="auditParam.auditHis"></audit-his> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </template> |
| | | <template #footer> |
| | | <div style="text-align: center;"> |
| | | <el-button size="small" @click="auditParam.model = false" |
| | | ><i class="el-icon-close"></i>å
³é</el-button |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | v-show="auditParam.showAction" |
| | | size="small" |
| | | @click="saveAudit" |
| | | ><i class="el-icon-check"></i>å®¡æ ¸</el-button |
| | | > |
| | | </div> |
| | | </template> |
| | | </vol-box> --> |
| | | |
| | | <!--导å
¥excelåè½--> |
| | | <!--2020.10.31æ·»å 导å
¥åçæ¹æ³--> |
| | | <!--å¼å¯æå è½½2020.12.06 --> |
| | | <!-- 2022.01.08å¢å æç»è¡¨å¯¼å
¥å¤æ --> |
| | | <vol-box |
| | | v-if="upload.url" |
| | | v-model="upload.excel" |
| | | :height="350" |
| | | :width="600" |
| | | :lazy="true" |
| | | :title="(boxModel ? detailOptions.cnName : table.cnName) + '-导å
¥'" |
| | | > |
| | | <UploadExcel |
| | | ref="upload_excel" |
| | | @importExcelAfter="importExcelAfter" |
| | | :importExcelBefore="importExcelBefore" |
| | | :url="upload.url" |
| | | :template="upload.template" |
| | | ></UploadExcel> |
| | | </vol-box> |
| | | <!--头é¨èªå®ä¹ç»ä»¶--> |
| | | <component |
| | | :is="dynamicComponent.gridHeader" |
| | | ref="gridHeader" |
| | | @parentCall="parentCall" |
| | | ></component> |
| | | <!--主ç颿¥è¯¢ä¸table表åå¸å±--> |
| | | <div class="view-container"> |
| | | <!-- 2020.09.11å¢å åºå®æ¥è¯¢è¡¨å --> |
| | | <!--æ¥è¯¢æ¡ä»¶--> |
| | | <div class="grid-search"> |
| | | <div |
| | | :class="[fiexdSearchForm ? 'fiexd-search-box' : 'search-box']" |
| | | v-show="searchBoxShow" |
| | | > |
| | | <!-- 2020.09.13å¢å formFiledsæ¼åé误å
¼å®¹å¤ç --> |
| | | <vol-form |
| | | ref="searchForm" |
| | | :load-key="false" |
| | | style="padding: 0 15px" |
| | | :label-width="labelWidth" |
| | | :formRules="searchFormOptions" |
| | | :formFields="searchFormFields" |
| | | :select2Count="select2Count" |
| | | > |
| | | <template #footer> |
| | | <div v-if="!fiexdSearchForm" class="form-closex"> |
| | | <el-button size="small" type="primary" plain @click="search"> |
| | | <i class="el-icon-search" />æ¥è¯¢ |
| | | </el-button> |
| | | |
| | | <el-button |
| | | size="small" |
| | | type="success" |
| | | plain |
| | | @click="resetSearch" |
| | | > |
| | | <i class="el-icon-refresh-right" />éç½® |
| | | </el-button> |
| | | <el-button |
| | | size="small" |
| | | plain |
| | | @click="searchBoxShow = !searchBoxShow" |
| | | > |
| | | <i class="el-icon-switch-button" />å
³é |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </vol-form> |
| | | <div v-if="fiexdSearchForm" class="fs-line"></div> |
| | | </div> |
| | | <div class="view-header"> |
| | | <div class="desc-text"> |
| | | <i class="el-icon-s-grid" /> |
| | | <span>{{ table.cnName }}</span> |
| | | </div> |
| | | <div class="notice"> |
| | | <a class="text" :title="extend.text">{{ extend.text }}</a> |
| | | </div> |
| | | <!--å¿«éæ¥è¯¢åæ®µ--> |
| | | <div class="search-line" v-if="!fiexdSearchForm"> |
| | | <QuickSearch |
| | | v-if="singleSearch" |
| | | :singleSearch="singleSearch" |
| | | :searchFormFields="searchFormFields" |
| | | :tiggerPress="quickSearchKeyPress" |
| | | ></QuickSearch> |
| | | </div> |
| | | <!--æä½æé®ç»--> |
| | | <!-- 2020.11.29å¢å æ¥è¯¢çé¢hidden屿§ --> |
| | | |
| | | <div class="btn-group"> |
| | | <template |
| | | :key="bIndex" |
| | | v-for="(btn, bIndex) in buttons.slice(0, maxBtnLength)" |
| | | > |
| | | <el-dropdown size="small" v-if="btn.data" :split-button="false"> |
| | | <el-button |
| | | :color="btn.color" |
| | | :dark="false" |
| | | :type="btn.type" |
| | | :plain="btn.plain" |
| | | > |
| | | {{ btn.name }}<i class="el-icon-arrow-down el-icon--right"></i |
| | | ></el-button> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <el-dropdown-item |
| | | v-for="(item, index) in btn.data" |
| | | :key="index" |
| | | > |
| | | <div @click="onClick(item.onClick)"> |
| | | <i :class="item.icon"></i> |
| | | {{ item.name }} |
| | | </div> |
| | | </el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | | </el-dropdown> |
| | | <el-button |
| | | v-else |
| | | :type="btn.type" |
| | | size="small" |
| | | :color="btn.color" |
| | | :dark="false" |
| | | :class="btn.class" |
| | | :plain="btn.plain" |
| | | v-show="!btn.hidden" |
| | | @click="onClick(btn.onClick)" |
| | | > |
| | | <i :class="btn.icon"></i> {{ btn.name }} |
| | | </el-button> |
| | | </template> |
| | | <!-- 设置åæé® --> |
| | | <el-button |
| | | type="default" |
| | | style="padding: 0px 10px" |
| | | size="small" |
| | | :plain="true" |
| | | v-if="showCustom" |
| | | @click="showCustomModel" |
| | | > |
| | | <i class="el-icon-s-grid"></i> |
| | | </el-button> |
| | | <el-dropdown |
| | | size="small" |
| | | @click="changeDropdown" |
| | | v-if="buttons.length > maxBtnLength" |
| | | > |
| | | <el-button type="primary" plain size="small"> |
| | | æ´å¤<i class="el-icon-arrow-down el-icon--right"></i> |
| | | </el-button> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <el-dropdown-item |
| | | @click="changeDropdown(item.name)" |
| | | :name="item.name" |
| | | v-show="!item.hidden" |
| | | v-for="(item, dIndex) in buttons.slice( |
| | | maxBtnLength, |
| | | buttons.length |
| | | )" |
| | | :key="dIndex" |
| | | > |
| | | <i :class="item.icon"></i> {{ item.name }}</el-dropdown-item |
| | | > |
| | | </el-dropdown-menu> |
| | | </template> |
| | | </el-dropdown> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- åå²ä½ç½® --> |
| | | <vol-box |
| | | v-if="boxInit" |
| | | v-model="boxModel" |
| | | :title="boxOptions.title" |
| | | :width="boxOptions.width" |
| | | :height="boxOptions.height" |
| | | :modal="boxOptions.modal" |
| | | :draggable="boxOptions.draggable" |
| | | :padding="0" |
| | | :on-model-close="onGridModelClose" |
| | | @fullscreen="fullscreen" |
| | | > |
| | | <!--æç»å¤´é¨èªå®ä¹ç»ä»¶--> |
| | | <template #content> |
| | | <div class="box-com"> |
| | | <component |
| | | :is="dynamicComponent.modelHeader" |
| | | ref="modelHeader" |
| | | @parentCall="parentCall" |
| | | ></component> |
| | | <!-- <div v-show="isBoxAudit" class="flow-step"> |
| | | <div v-for="(item, index) in workFlowSteps" :key="index"> |
| | | {{ item.stepName }} |
| | | </div> |
| | | </div> --> |
| | | <div class="item form-item"> |
| | | <vol-form |
| | | ref="form" |
| | | :editor="editor" |
| | | :load-key="false" |
| | | :label-width="boxOptions.labelWidth" |
| | | :formRules="editFormOptions" |
| | | :formFields="editFormFields" |
| | | :select2Count="select2Count" |
| | | ></vol-form> |
| | | </div> |
| | | <!--æç»bodyèªå®ä¹ç»ä»¶--> |
| | | <component |
| | | :is="dynamicComponent.modelBody" |
| | | ref="modelBody" |
| | | @parentCall="parentCall" |
| | | ></component> |
| | | <div |
| | | v-show="hasDetail" |
| | | v-if="detail.columns && detail.columns.length > 0" |
| | | class="grid-detail table-item item" |
| | | > |
| | | <div class="toolbar"> |
| | | <div class="title form-text"> |
| | | <span> |
| | | <i class="el-icon-menu" /> |
| | | {{ detail.cnName }} |
| | | </span> |
| | | </div> |
| | | <!--æç»è¡¨æ ¼æé®--> |
| | | <div class="btns" v-show="!isBoxAudit"> |
| | | <el-button |
| | | v-for="(btn, bIndex) in detailOptions.buttons" |
| | | :key="bIndex" |
| | | :plain="btn.plain" |
| | | v-show="!(typeof btn.hidden == 'boolean' && btn.hidden)" |
| | | @click="onClick(btn.onClick)" |
| | | size="small" |
| | | ><i :class="btn.icon"></i>{{ btn.name }}</el-button |
| | | > |
| | | </div> |
| | | </div> |
| | | <vol-table |
| | | ref="detail" |
| | | @loadBefore="loadInternalDetailTableBefore" |
| | | @loadAfter="loadDetailTableAfter" |
| | | @rowChange="detailRowOnChange" |
| | | @rowClick="detailRowOnClick" |
| | | :url="detailOptions.url" |
| | | :load-key="false" |
| | | :index="true" |
| | | :tableData="detailOptions.data" |
| | | :columns="detailOptions.columns" |
| | | :pagination="detailOptions.pagination" |
| | | :height="detailOptions.height" |
| | | :single="detailOptions.single" |
| | | :pagination-hide="false" |
| | | :defaultLoadPage="detailOptions.load" |
| | | :beginEdit="detailOptions.beginEdit" |
| | | :endEditBefore="detailOptions.endEditBefore" |
| | | :endEditAfter="detailOptions.endEditAfter" |
| | | :summary="detailOptions.summary" |
| | | :click-edit="detailOptions.clickEdit" |
| | | :double-edit="detailOptions.doubleEdit" |
| | | :column-index="detailOptions.columnIndex" |
| | | :ck="detailOptions.ck" |
| | | :text-inline="detailOptions.textInline" |
| | | :select2Count="select2Count" |
| | | :selectable="detailSelectable" |
| | | ></vol-table> |
| | | </div> |
| | | <!--æç»footerèªå®ä¹ç»ä»¶--> |
| | | <component |
| | | :is="dynamicComponent.modelFooter" |
| | | ref="modelFooter" |
| | | @parentCall="parentCall" |
| | | ></component> |
| | | </div> |
| | | </template> |
| | | <template #footer> |
| | | <div style="text-align: center;" v-show="isBoxAudit"> |
| | | <el-button |
| | | size="small" |
| | | type="primary" |
| | | plain |
| | | @click="onGridModelClose(false)" |
| | | > |
| | | <i class="el-icon-close">å
³é</i> |
| | | </el-button> |
| | | <el-button |
| | | size="small" |
| | | type="primary" |
| | | v-show="auditParam.showViewButton" |
| | | @click="auditParam.model = true" |
| | | > |
| | | <i class="el-icon-view">审æ¹</i> |
| | | </el-button> |
| | | </div> |
| | | <div v-show="!isBoxAudit"> |
| | | <el-button |
| | | v-for="(btn, bIndex) in boxButtons" |
| | | :key="bIndex" |
| | | :type="btn.type" |
| | | size="small" |
| | | :plain="btn.plain" |
| | | v-show="!(typeof btn.hidden == 'boolean' && btn.hidden)" |
| | | :disabled="btn.hasOwnProperty('disabled') && !!btn.disabled" |
| | | @click="onClick(btn.onClick)" |
| | | > |
| | | <i :class="btn.icon"> {{ btn.name }}</i> |
| | | </el-button> |
| | | <el-button |
| | | size="small" |
| | | type="primary" |
| | | plain |
| | | @click="onGridModelClose(false)" |
| | | > |
| | | <i class="el-icon-close">å
³é</i> |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </vol-box> |
| | | </div> |
| | | <!--bodyèªå®ä¹ç»ä»¶--> |
| | | <div class="grid-body"> |
| | | <component |
| | | :is="dynamicComponent.gridBody" |
| | | ref="gridBody" |
| | | @parentCall="parentCall" |
| | | ></component> |
| | | </div> |
| | | |
| | | <!--tableè¡¨æ ¼--> |
| | | <div class="grid-container"> |
| | | <!-- 2021.05.02å¢å æ å½¢ç»æ rowKey --> |
| | | <vol-table |
| | | ref="table" |
| | | :single="single" |
| | | :rowKey="rowKey" |
| | | :loadTreeChildren="loadTreeTableChildren" |
| | | @loadBefore="loadTableBefore" |
| | | @loadAfter="loadTableAfter" |
| | | @rowChange="rowOnChange" |
| | | @rowClick="rowOnClick" |
| | | @rowDbClick="rowOnDbClick" |
| | | :tableData="[]" |
| | | :linkView="linkData" |
| | | :columns="columns" |
| | | :pagination="pagination" |
| | | :height="height" |
| | | :max-height="tableMaxHeight" |
| | | :pagination-hide="false" |
| | | :url="url" |
| | | :load-key="false" |
| | | :defaultLoadPage="load" |
| | | :summary="summary" |
| | | :double-edit="doubleEdit" |
| | | :index="doubleEdit" |
| | | :beginEdit="tableBeginEdit" |
| | | :endEditBefore="tableEndEditBefore" |
| | | :click-edit="true" |
| | | :column-index="columnIndex" |
| | | :text-inline="textInline" |
| | | :ck="ck" |
| | | :select2Count="select2Count" |
| | | :selectable="selectable" |
| | | ></vol-table> |
| | | </div> |
| | | </div> |
| | | |
| | | <!--footerèªå®ä¹ç»ä»¶--> |
| | | <component |
| | | :is="dynamicComponent.gridFooter" |
| | | ref="gridFooter" |
| | | @parentCall="parentCall" |
| | | ></component> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | const _const = { |
| | | EDIT: 'update', |
| | | ADD: 'Add', |
| | | VIEW: 'view', |
| | | PAGE: 'getPageData', |
| | | AUDIT: 'audit', |
| | | DEL: 'del', |
| | | EXPORT: 'Export', //å¯¼åºæä½è¿åå å¯åçè·¯å¾ |
| | | DOWNLOAD: 'DownLoadFile', //å¯¼åºæä»¶ |
| | | DOWNLOADTEMPLATE: 'DownLoadTemplate', //ä¸è½½å¯¼å
¥æ¨¡æ¿ |
| | | IMPORT: 'Import', //导å
¥(导å
¥è¡¨çExcelåè½) |
| | | UPLOAD: 'Upload' //ä¸ä¼ æä»¶ |
| | | }; |
| | | import Empty from '@/components/basic/Empty.vue'; |
| | | |
| | | import VolTable from '@/components/basic/VolTable.vue'; |
| | | import VolForm from '@/components/basic/VolForm.vue'; |
| | | import { |
| | | defineAsyncComponent, |
| | | defineComponent, |
| | | ref, |
| | | shallowRef, |
| | | toRaw |
| | | } from 'vue'; |
| | | var vueParam = { |
| | | components: { |
| | | 'vol-form': VolForm, |
| | | 'vol-table': VolTable, |
| | | VolBox: defineAsyncComponent(() => import('@/components/basic/VolBox.vue')), |
| | | QuickSearch: defineAsyncComponent(() => |
| | | import('@/components/basic/QuickSearch.vue') |
| | | ), |
| | | Audit: defineAsyncComponent(() => import('@/components/basic/Audit.vue')), |
| | | UploadExcel: defineAsyncComponent(() => |
| | | import('@/components/basic/UploadExcel.vue') |
| | | ), |
| | | 'custom-column': defineAsyncComponent(() => |
| | | import('./ViewGridCustomColumn.vue') |
| | | ), |
| | | 'vol-header': defineAsyncComponent(() => import('./../VolHeader.vue')), |
| | | ViewGridAudit: defineAsyncComponent(() => import('./ViewGridAudit.vue')) |
| | | }, |
| | | props: {}, |
| | | setup(props) { |
| | | //2021.07.17è°æ´æ©å±ç»ä»¶ç»ä»¶ |
| | | const dynamicCom = { |
| | | gridHeader: Empty, |
| | | gridBody: Empty, |
| | | gridFooter: Empty, |
| | | modelHeader: Empty, |
| | | modelBody: Empty, |
| | | modelFooter: Empty |
| | | }; |
| | | //åå¹¶æ©å±ç»ä»¶ |
| | | if (props.extend.components) { |
| | | for (const key in props.extend.components) { |
| | | if (props.extend.components[key]) { |
| | | dynamicCom[key] = toRaw(props.extend.components[key]); |
| | | } |
| | | } |
| | | } |
| | | const dynamicComponent = shallowRef(dynamicCom); |
| | | return { dynamicComponent }; |
| | | }, |
| | | data() { |
| | | return { |
| | | isBoxAudit: false, |
| | | formFieldsType: [], |
| | | workFlowSteps: [], |
| | | //æ å½¢ç»æç主é®å段ï¼å¦æè®¾ç½®å¼é»è®¤ä¼å¼å¯æ å½¢tableï¼æ³¨ærowKeyåæ®µçå¼å¿
é¡»æ¯å¯ä¸ï¼2021.05.02ï¼ |
| | | rowKey: undefined, |
| | | fiexdSearchForm: false, //2020.09.011æ¯å¦åºå®æ¥è¯¢è¡¨åï¼trueæ¥è¯¢è¡¨åå°åºå®æ¾ç¤ºå¨è¡¨åçæä¸é¢ |
| | | _inited: false, |
| | | doubleEdit: false, //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ |
| | | single: false, //表æ¯å¦åé |
| | | const: _const, //å¢å æ¹æ¥å¯¼å
¥å¯¼åºç对åºçaction |
| | | boxInit: false, //æ°å»ºæç¼è¾çå¼¹åºæ¡ååç¶æï¼é»è®¤ä¸ååå§åï¼ç¹å»æ°å»ºæç¼è¾æåå§åå¼¹åºæ¡ |
| | | searchBoxShow: false, //é«çº§æ¥è¯¢(ç颿¥è¯¢åç䏿æ¡ç¹å»è§¦å) |
| | | singleSearch: {}, //å¿«éæ¥è¯¢åæ®µ |
| | | exportHref: '', |
| | | currentAction: _const.ADD, //彿°å»ºæç¼è¾æ¶ï¼è®°å½å½åçç¶æ:å¦å½åæä½æ¯æ°å»º |
| | | currentRow: {}, //å½åç¼è¾ææ¥çæ°æ®çè¡ |
| | | closable: false, |
| | | boxModel: false, //å¼¹åºæ°å»ºãç¼è¾æ¡ |
| | | width: 700, //å¼¹åºæ¡æ¥çè¡¨æ°æ®ç»æ |
| | | labelWidth: 100, //é«çº§æ¥è¯¢çæ ç¾å®½åº¦ |
| | | viewModel: false, //æ¥çè¡¨ç»æçå¼¹åºæ¡ |
| | | viewColumns: [], //æ¥çè¡¨ç»æçåæ°æ® |
| | | viewColumnsClone: [], |
| | | showCustom: true, //æ¯å¦æ¾ç¤ºèªå®ä¹é
ç½®åæé®2022.05.27 |
| | | // viewData: [], //æ¥çè¡¨ç»æä¿¡æ¯ |
| | | maxBtnLength: 8, //ç颿鮿夿¾ç¤ºç个æ°ï¼è¶
è¿çæ°é齿¾ç¤ºå¨æ´å¤ä¸ |
| | | buttons: [], //æ¥è¯¢çé¢æé® å¦éè¦å
¶ä»æä½æé®ï¼å¯å¨è¡¨å¯¹åºç.js䏿·»å (å¦:Sys_User.jsä¸buttonsæ·»å å
¶ä»æé®) |
| | | splitButtons: [], |
| | | uploadfiled: [], //ä¸ä¼ æä»¶å¾ççåæ®µ |
| | | boxButtons: [], //å¼¹åºæ¡æé® å¦éè¦å
¶ä»æä½æé®ï¼å¯å¨è¡¨å¯¹åºç.js䏿·»å |
| | | dicKeys: [], //å½åç颿æç䏿æ¡åå
¸ç¼å·åæ°æ®æº |
| | | hasKeyField: [], //æåå
¸æ°æ®æºçåæ®µ |
| | | keyValueType: { _dinit: false }, |
| | | url: '', //çé¢è¡¨æ¥è¯¢çæ°æ®æºçurl |
| | | hasDetail: false, //æ¯å¦æä»è¡¨(æç»)è¡¨æ ¼æ°æ® |
| | | initActivated: false, |
| | | load: true, //æ¯å¦é»è®¤å è½½è¡¨æ°æ® |
| | | activatedLoad: false, //页é¢è§¦åactivedæ¶æ¯å¦å·æ°é¡µé¢æ°æ® |
| | | summary: false, //æ¥è¯¢çé¢tableæ¯å¦æ¾ç¤ºå计 |
| | | //éè¦ä»è¿ç¨ç»å®æ°æ®æºçåå
¸ç¼å·,妿åå
¸æ°æ®æºçæ¥è¯¢ç»æè¾å¤ï¼è¯·å¨onInitä¸å°åå
¸ç¼å·æ·»å è¿æ¥ |
| | | //åªå¯¹èªå®sqlææ |
| | | remoteKeys: [], |
| | | columnIndex: true, //2020.11.01æ¯å¦æ¾ç¤ºè¡å· |
| | | ck: true, //2020.11.01æ¯å¦æ¾ç¤ºcheckbox |
| | | continueAdd: false, //2021.04.11æ°å»ºæ¶æ¯å¦å¯ä»¥è¿ç»æ°å»ºæä½ |
| | | continueAddName: 'ä¿ååç»§ç»æ·»å ', //2021.04.11æé®åç§° |
| | | // detailUrl: "", |
| | | detailOptions: { |
| | | //å¼¹åºæ¡ä»è¡¨(æç»)对象 |
| | | //ä»è¡¨é
ç½® |
| | | buttons: [], //å¼¹åºæ¡ä»è¡¨è¡¨æ ¼æä½æé®,ç®åæå é¤è¡ï¼æ·»å è¡ï¼å·æ°æä½ï¼å¦éè¦å
¶ä»æä½æé®ï¼å¯å¨è¡¨å¯¹åºç.js䏿·»å |
| | | cnName: '', //ä»è¡¨åç§° |
| | | key: '', //ä»è¡¨ä¸»é®å |
| | | data: [], //æ°æ®æº |
| | | columns: [], //ä»è¡¨åä¿¡æ¯ |
| | | edit: true, //æç»æ¯å¦å¯ä»¥ç¼è¾ |
| | | single: false, //æç»è¡¨æ¯å¦åé |
| | | load: false, // |
| | | delKeys: [], //å½ç¼è¾æ¶å é¤å½åæç»çè¡ä¸»é®å¼ |
| | | url: '', //ä»è¡¨å è½½æ°æ®çurl |
| | | pagination: { total: 0, size: 100, sortName: '' }, //ä»è¡¨å页é
ç½®æ°æ® |
| | | height: 0, //é»è®¤ä»è¡¨é«åº¦ |
| | | textInline: true, //æç»è¡¨è¡å
容æ¾ç¤ºå¨ä¸è¡ä¸ï¼å¦æéè¦æ¢è¡æ¾ç¤ºï¼è¯·è®¾ç½®ä¸ºfalse |
| | | doubleEdit: true, //使ç¨åå»ç¼è¾ |
| | | clickEdit: false, //æ¯å¦å¼å¯ç¹å»åå
æ ¼ç¼è¾ï¼ç¹å»å
¶ä»è¡æ¶ç»æç¼è¾ |
| | | currentReadonly: false, //å½åç¨æ·æ²¡æç¼è¾ææ°å»ºæéæ¶ï¼è¡¨ååªè¯»(å¯ç¨äºå¤æç¨æ·æ¯å¦æç¼è¾ææ°å»ºæé) |
| | | //å¼å¯ç¼è¾æ¶ |
| | | beginEdit: (row, column, index) => { |
| | | return true; |
| | | }, |
| | | //ç»æç¼è¾å |
| | | endEditBefore: (row, column, index) => { |
| | | return true; |
| | | }, |
| | | //ç»æç¼è¾å |
| | | endEditAfter: (row, column, index) => { |
| | | return true; |
| | | }, |
| | | columnIndex: false, //2020.11.01æç»æ¯å¦æ¾ç¤ºè¡å· |
| | | ck: true //2020.11.01æç»æ¯å¦æ¾ç¤ºcheckbox |
| | | }, |
| | | auditParam: { |
| | | //å®¡æ ¸å¯¹è±¡ |
| | | rows: 0, //å½åéä¸å®¡æ ¸çè¡æ° |
| | | model: false, //å®¡æ ¸å¼¹åºæ¡ |
| | | value: -1, //å®¡æ ¸ç»æ |
| | | status: -1, |
| | | reason: '', //å®¡æ ¸åå |
| | | height: 500, |
| | | showViewButton: true, |
| | | auditHis: [], |
| | | showAction: false, //æ¯å¦æ¾ç¤ºå®¡æ¹æä½(å½åèç¹ä¸ºç¨æ·å®¡æ¹æ¶æ¾ç¤º) |
| | | //å®¡æ ¸é项(å¯èªè¡åæ·»å ) |
| | | data: [ |
| | | { text: 'éè¿', value: 1 }, |
| | | { text: 'æç»', value: 2 }, |
| | | { text: '驳å', value: 3 } |
| | | ] |
| | | }, |
| | | upload: { |
| | | //导å
¥ä¸ä¼ excel对象 |
| | | excel: false, //导å
¥çå¼¹åºæ¡æ¯å¦æ¾ç¤º |
| | | url: '', //导å
¥çè·¯å¾,å¦ææ²¡æå¼ï¼å䏿¸²æå¯¼å
¥åè½ |
| | | template: { |
| | | //ä¸è½½æ¨¡æ¿å¯¹è±¡ |
| | | url: '', //ä¸è½½æ¨¡æ¿è·¯å¾ |
| | | fileName: '' //模æ¿ä¸è½½ç䏿å |
| | | }, |
| | | init: false //æ¯å¦æå¯¼å
¥æéï¼æææ¸²æå¯¼å
¥ç»ä»¶ |
| | | }, |
| | | height: 0, //表é«åº¦ |
| | | tableHeight: 0, //æ¥è¯¢é¡µé¢tableçé«åº¦ |
| | | tableMaxHeight: 0, //æ¥è¯¢é¡µé¢tableçæå¤§é«åº¦ |
| | | textInline: true, //tableå
容è¶
åºåæ¯å¦ä¸æ¢è¡2020.01.16 |
| | | pagination: { total: 0, size: 30, sortName: '' }, //ä»å页é
ç½®æ°æ® |
| | | boxOptions: { |
| | | title: '', //å¼¹åºæ¡æ¾ç¤ºçæ é¢2022.08.01 |
| | | saveClose: true, |
| | | labelWidth: 100, |
| | | height: 0, |
| | | width: 0, |
| | | summary: false, //å¼¹åºæ¡æç»tableæ¯å¦æ¾ç¤ºå计 |
| | | draggable: false, //2022.09.12å¼¹åºæ¡æå¨åè½ |
| | | modal: true //2022.09.12å¼¹åºæ¡èæ¯é®ç½©å± |
| | | }, //saveCloseæ°å»ºæç¼è¾æå忝å¦å
³éå¼¹åºæ¡//å¼¹åºæ¡çæ ç¾å®½åº¦labelWidth |
| | | editor: { |
| | | uploadImgUrl: '', //ä¸ä¼ è·¯å¾ |
| | | upload: null //ä¸ä¼ æ¹æ³ |
| | | }, |
| | | numberFields: [], |
| | | //2022.09.26å¢å èªå®ä¹å¯¼åºæä»¶å |
| | | downloadFileName: null, |
| | | select2Count: 500 //è¶
åº500æ°éæ¾ç¤ºselect2ç»ä»¶ |
| | | }; |
| | | }, |
| | | methods: {}, |
| | | activated() { |
| | | this.initFlowQuery(); |
| | | //2020.06.25å¢å activatedæ¹æ³ |
| | | this.onActivated && this.onActivated(); |
| | | if (!this._inited) { |
| | | this._inited = true; |
| | | return; |
| | | } |
| | | if (this.activatedLoad) { |
| | | this.refresh(); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.mounted(); |
| | | // this.$refs.searchForm.forEach() |
| | | }, |
| | | unmounted() { |
| | | this.destroyed(); |
| | | }, |
| | | created: function() { |
| | | //åå¹¶èªå®ä¹ä¸å¡æ©å±æ¹æ³ |
| | | Object.assign(this, this.extend.methods); |
| | | //å¦ææ²¡ææå®æåºå段ï¼åç¨ä¸»é®ä½ä¸ºé»è®¤æåºå段 |
| | | this.pagination.sortName = this.table.sortName || this.table.key; |
| | | this.initBoxButtons(); //åå§åå¼¹åºæ¡ä¸æç»è¡¨æ ¼æé® |
| | | this.initAuditColumn(); |
| | | this.onInit(); //åå§ååï¼å¦æéè¦åå
¶ä»å¤ç卿©å±æ¹æ³ä¸è¦çæ¤æ¹æ³ |
| | | this.getButtons(); |
| | | //åå§åèªå®ä¹è¡¨æ ¼å |
| | | this.initViewColumns(); |
| | | //åå§ç¼è¾æ¡çæ°æ® |
| | | this.initBoxHeightWidth(); |
| | | this.initDicKeys(); //åå§ä¸æ¡æ°æ®æº |
| | | this.onInited(); //åå§ååï¼å¦æéè¦åå
¶ä»å¤ç卿©å±æ¹æ³ä¸è¦çæ¤æ¹æ³ |
| | | }, |
| | | beforeUpdate: function() {}, |
| | | updated: function() {} |
| | | }; |
| | | |
| | | import props from './props.js'; |
| | | import methods from './methods.js'; |
| | | |
| | | //å并屿§ |
| | | vueParam.props = Object.assign(vueParam.props, props); |
| | | //åå¹¶æ¹æ³ |
| | | vueParam.methods = Object.assign( |
| | | vueParam.methods, |
| | | methods, |
| | | props.extend.methods |
| | | ); |
| | | export default defineComponent(vueParam); |
| | | </script> |
| | | <style lang="less" scoped> |
| | | @import './ViewGrid.less'; |
| | | </style> |
| | | <style lang="less" scoped> |
| | | .btn-group ::v-deep(.ivu-select-dropdown) { |
| | | padding: 0px !important; |
| | | right: 3px; |
| | | } |
| | | |
| | | .btn-group ::v-deep(.ivu-select-dropdown .ivu-dropdown-menu) { |
| | | min-width: 100px; |
| | | right: -2px; |
| | | position: absolute; |
| | | background: white; |
| | | width: 130px; |
| | | border-radius: 5px; |
| | | border: 1px solid #e7e5e5; |
| | | } |
| | | |
| | | .vertical-center-modal ::v-deep(.srcoll-content) { |
| | | padding: 0; |
| | | } |
| | | |
| | | .view-model-content { |
| | | background: #eee; |
| | | } |
| | | |
| | | .grid-detail ::v-deep(.v-table .el-table__header th) { |
| | | height: 44px; |
| | | } |
| | | </style> |
| | | <style lang="less" scoped> |
| | | .grid-search { |
| | | position: relative; |
| | | |
| | | .search-box { |
| | | background: #fefefe; |
| | | margin-top: 33px; |
| | | border: 1px solid #eae8e8; |
| | | position: absolute; |
| | | z-index: 999; |
| | | left: 15px; |
| | | right: 15px; |
| | | padding: 25px 20px; |
| | | padding-bottom: 0; |
| | | border-top: 0; |
| | | box-shadow: 0 7px 18px -12px #bdc0bb; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <vol-box :footer="false" v-model="model" :height="height" :width="width" :padding="0" :lazy="true" title="å®¡æ ¸"> |
| | | |
| | | <div class="audit-model-content" :style="{ height: height - 100 + 'px' }"> |
| | | <el-descriptions class="desc-top" :column="3" size="default" :border="true"> |
| | | <el-descriptions-item v-for="(item, index) in formData" :key="index"> |
| | | <template #label> |
| | | <div class="cell-item"> |
| | | {{ item.name }} |
| | | </div> |
| | | </template> |
| | | {{ item.value }} |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | <el-radio-group v-show="hasFlow" style="padding-left: 15px;" v-model="activeName" class="ml-4"> |
| | | <el-radio label="audit" size="large">å®¡æ ¸</el-radio> |
| | | <el-radio label="log" size="large">å®¡æ ¸è®°å½</el-radio> |
| | | </el-radio-group> |
| | | <div v-show="activeName == 'audit' || !hasFlow" class="audit-content"> |
| | | <div class="fx-left" v-if="hasFlow"> |
| | | <div class="v-steps"> |
| | | <div v-for="(item, index) in workFlowSteps" :key="index"> |
| | | <div class="step-item" :class="{'step-item-ad':item.auditId||item.stepAttrType=='start'}" v-if="item.stepAttrType == 'start'"> |
| | | <div class="left-item"> |
| | | <div>æµç¨å¼å§</div> |
| | | <div class="left-date">{{ item.createDate }}</div> |
| | | </div> |
| | | <div class="right-item"> |
| | | <div class="step-line"></div> |
| | | <i class="step-circle"></i> |
| | | <div class="step-title"> |
| | | {{ item.stepName }} |
| | | </div> |
| | | <div class="step-text">å起人ï¼{{ item.creator }}</div> |
| | | </div> |
| | | </div> |
| | | <div class="step-item" v-else-if="item.stepAttrType == 'end'"> |
| | | <div class="left-item"> |
| | | <div>æµç¨ç»æ</div> |
| | | </div> |
| | | <div class="right-item"> |
| | | <div class="step-line"></div> |
| | | <i class="step-circle"></i> |
| | | <div class="step-title"> |
| | | {{ item.stepName }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div v-else :class="{ 'step-current': item.isCurrent }" class="step-item"> |
| | | <div class="left-item"> |
| | | <div>å®¡æ¹æ¶é´</div> |
| | | <div class="left-date">{{ item.auditDate || 'å¾
审æ¹' }}</div> |
| | | </div> |
| | | <div class="right-item"> |
| | | <div class="step-line"></div> |
| | | <i class="step-circle"></i> |
| | | <div class="step-title"> |
| | | {{ item.stepName }} |
| | | </div> |
| | | <div class="step-text">审æ¹äººï¼{{ item.auditor }}</div> |
| | | <div class="step-text"> |
| | | ç¶ æï¼ {{ getAuditStatus(item.auditStatus) }} |
| | | </div> |
| | | <div class="step-text">å¤ æ³¨ï¼ {{ item.remark || '-' }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="fx-right" :style="{ width: !hasFlow ? '100%' : '400px' }" v-if="isCurrentUser || !hasFlow"> |
| | | |
| | | <div v-if="!hasFlow"> |
| | | <el-alert :title="'å½åéä¸ã' + rowLen + 'ãæ¡è®°å½å¾
å®¡æ ¸..'" type="success" :closable="false" /> |
| | | </div> |
| | | <div class="rd"> |
| | | <span>审æ¹ï¼</span> |
| | | <el-radio-group style="margin-left:15px" v-model="auditParam.value"> |
| | | <el-radio v-for="item in auditParam.data" :key="item.value" :label="item.value"> |
| | | <span>{{ item.text }}</span> |
| | | </el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | <el-input style="padding-top: 10px;" v-model="auditParam.reason" type="textarea" |
| | | :autosize="{ minRows: 4, maxRows: 10 }" placeholder="请è¾å
¥å¤æ³¨..."></el-input> |
| | | <div class="btn"> |
| | | <el-button type="primary" @click="auditClick" icon="Check">审æ¹</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div v-show="activeName == 'log'"> |
| | | <vol-table :tableData="tableData" :columns="columns" :height="height - 250" :pagination-hide="true" |
| | | :load-key="false" :text-inline="false" :ck="false"></vol-table> |
| | | </div> |
| | | </div> |
| | | </vol-box> |
| | | </template> |
| | | <script> |
| | | import VolTable from '@/components/basic/VolTable.vue'; |
| | | import VolBox from '@/components/basic/VolBox.vue'; |
| | | import http from '@/../src/api/http.js'; |
| | | import { defineComponent, ref, reactive, getCurrentInstance } from 'vue'; |
| | | export default defineComponent({ |
| | | components: { |
| | | VolTable, |
| | | VolBox |
| | | }, |
| | | props: { |
| | | option: { //çævueæä»¶çtableåæ° |
| | | type: Object, |
| | | default: { |
| | | key: '', |
| | | cnName: '', |
| | | name: '', |
| | | url: "" |
| | | } |
| | | } |
| | | }, |
| | | setup(props, { emit }) { |
| | | const height = ref(500); |
| | | const width = ref(820); |
| | | const model = ref(false) |
| | | const workFlowSteps = reactive([]); |
| | | |
| | | const hasFlow = ref(false) |
| | | const formData = reactive([]); |
| | | |
| | | const auditParam = reactive({ |
| | | //å®¡æ ¸å¯¹è±¡ |
| | | rows: 0, //å½åéä¸å®¡æ ¸çè¡æ° |
| | | model: false, //å®¡æ ¸å¼¹åºæ¡ |
| | | value: -1, //å®¡æ ¸ç»æ |
| | | reason: '', //å®¡æ ¸åå |
| | | //å®¡æ ¸é项(main.jséé¢å¯ä»¥æ·»å å
¶ä»é项) |
| | | data: [] |
| | | }) |
| | | const { proxy } = getCurrentInstance(); |
| | | auditParam.data = proxy.$global.audit.data; |
| | | const tableData = reactive([]); |
| | | const columns = reactive([ |
| | | { title: 'èç¹', field: 'stepName', width: 100 }, |
| | | { title: '审æ¹äºº', field: 'auditor', width: 80 }, |
| | | { title: '审æ¹ç»æ', field: 'auditStatus', width: 70, bind: { data: [] } }, |
| | | { title: 'å®¡æ¹æ¶é´', field: 'auditDate', width: 145 }, |
| | | { title: '夿³¨', field: 'remark', width: 120 } |
| | | ]); |
| | | |
| | | const isCurrentUser = ref(null); |
| | | const activeName = ref('audit') |
| | | |
| | | const auditDic = reactive([]); |
| | | const getAuditStatus = (key) => { |
| | | return (auditDic.find(x => { return x.key === key + '' }) || { value: key }).value; |
| | | } |
| | | const rowLen = ref(0) |
| | | let currentRows = [] |
| | | const getAuditInfo = (option) => { |
| | | const table = option.table; //props.option.url.replaceAll('/', ''); |
| | | const url = `api/Sys_WorkFlow/getSteps?tableName=${table}` |
| | | // let ids = currentRows.map(x => { return x[props.option.key] }); |
| | | let ids = currentRows.map(x => { return x[option.key] }); |
| | | // ['498043c1-fbd0-4a35-a870-523823912a9b'] |
| | | http.post(url, ids, true).then(result => { |
| | | if (!result.status) { |
| | | proxy.$message.error(result.message); |
| | | return; |
| | | } |
| | | |
| | | hasFlow.value = !!(result.list || []).length; |
| | | if (!hasFlow.value) { |
| | | |
| | | let auditStatus = Object.keys(currentRows[0]).find(x => { return x.toLowerCase() === 'auditstatus' }); |
| | | |
| | | let checkStatus = currentRows.every((x) => { |
| | | return proxy.$global.audit.status.some(c => { return c === x[auditStatus] || !x[auditStatus] }) |
| | | }); |
| | | if (!checkStatus) { |
| | | proxy.$message.error('åªè½éæ©å¾
å®¡æ¹æå®¡æ ¸ä¸çæ°æ®'); |
| | | return; |
| | | } |
| | | rowLen.value = currentRows.length; |
| | | model.value = true; |
| | | width.value = 430; |
| | | height.value = 330; |
| | | isCurrentUser.value = true; |
| | | //没æå®¡æ¹æµç¨çæ°æ®åªæ¾ç¤º |
| | | return; |
| | | } |
| | | model.value = true; |
| | | height.value = document.body.clientHeight * 0.95; |
| | | width.value = 820; |
| | | if (!auditDic.length) { |
| | | auditDic.push(...(result.auditDic || [])) |
| | | columns.forEach(item => { |
| | | if (item.field == 'auditStatus') { |
| | | item.bind.data = auditDic; |
| | | } |
| | | }) |
| | | } |
| | | isCurrentUser.value = result.list.some(x => { return x.isCurrentUser }) |
| | | workFlowSteps.length = 0; |
| | | workFlowSteps.push(...result.list); |
| | | tableData.length = 0; |
| | | tableData.push(...result.log) |
| | | formData.length = 0; |
| | | formData.push(...(result.form || [])) |
| | | }) |
| | | } |
| | | // |
| | | |
| | | const auditClick = () => { |
| | | if (auditParam.value == -1) { |
| | | proxy.$message.error('è¯·éæ©å®¡æ¹é¡¹'); |
| | | return; |
| | | } |
| | | |
| | | if (!isFlow.value) { |
| | | emit("auditClick", auditParam, currentRows, (result) => { |
| | | if (result.status) { |
| | | model.value = false; |
| | | tableData.length = 0; |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | //æçæµç¨ä¸ç¹å»å®¡æ¹ |
| | | //ä¿åå®¡æ ¸ |
| | | let keys = currentRows.map(x => { return x[currentOption.key] }); |
| | | let url = `api/${currentOption.table}/audit?auditReason=${auditParam.reason}&auditStatus=${auditParam.value}` |
| | | http.post(url, keys, 'å®¡æ ¸ä¸....').then((x) => { |
| | | if (!x.status) { |
| | | proxy.$message.error(x.message); |
| | | return; |
| | | } |
| | | model.value = false; |
| | | proxy.$parent.search() |
| | | proxy.$message.success(x.message) |
| | | }); |
| | | } |
| | | const isFlow = ref(false); |
| | | let currentOption = {}; |
| | | const open = (rows, flow) => { |
| | | isFlow.value = !!flow; |
| | | currentRows = rows; |
| | | activeName.value = 'audit' |
| | | auditParam.reason = ''; |
| | | auditParam.value = -1; |
| | | |
| | | if (flow) { |
| | | currentOption = { |
| | | table: rows[0].WorkTable, |
| | | key: "WorkTableKey"// rows[0].WorkTableKey |
| | | } |
| | | } else { |
| | | currentOption = { |
| | | table: props.option.url.replaceAll('/', ''), |
| | | key: props.option.key |
| | | } |
| | | } |
| | | getAuditInfo(currentOption); |
| | | |
| | | } |
| | | |
| | | return { |
| | | columns, |
| | | height, |
| | | width, |
| | | model, |
| | | workFlowSteps, |
| | | getAuditInfo, |
| | | getAuditStatus, |
| | | activeName, |
| | | reactive, |
| | | tableData, |
| | | auditParam, |
| | | auditClick, |
| | | open, |
| | | isCurrentUser, |
| | | hasFlow, |
| | | rowLen, |
| | | formData, |
| | | isFlow |
| | | } |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .audit-model-content { |
| | | padding: 10px; |
| | | } |
| | | |
| | | .step-item { |
| | | background: #fff; |
| | | display: flex; |
| | | } |
| | | |
| | | .left-item { |
| | | min-width: 180px; |
| | | text-align: right; |
| | | padding-right: 25px; |
| | | padding-top: 8px; |
| | | |
| | | .left-date { |
| | | font-size: 13px; |
| | | padding-top: 7px; |
| | | color: #6c6c6c; |
| | | } |
| | | } |
| | | |
| | | .right-item { |
| | | cursor: pointer; |
| | | position: relative; |
| | | border-bottom: 1px solid #f3f3f3; |
| | | padding: 5px 0 5px 5px; |
| | | } |
| | | |
| | | .left-item, |
| | | .right-item { |
| | | padding-bottom: 10px; |
| | | } |
| | | |
| | | .right-item:last-child { |
| | | border-bottom: 0; |
| | | } |
| | | |
| | | .step-line { |
| | | top: 16px; |
| | | left: -10px; |
| | | width: 1px; |
| | | height: 100%; |
| | | position: absolute; |
| | | background-color: #ebedf0; |
| | | } |
| | | |
| | | .step-circle { |
| | | position: absolute; |
| | | top: 17px; |
| | | left: -9px; |
| | | z-index: 2; |
| | | font-size: 12px; |
| | | line-height: 1; |
| | | transform: translate(-50%, -50%); |
| | | width: 7px; |
| | | height: 7px; |
| | | background-color: #a1a1a1; |
| | | border-radius: 50%; |
| | | } |
| | | |
| | | .right-item::before { |
| | | content: ''; |
| | | } |
| | | |
| | | .step-content { |
| | | padding-top: 2px; |
| | | font-size: 14px; |
| | | color: #828282; |
| | | line-height: 1.5; |
| | | } |
| | | |
| | | .step-title { |
| | | font-weight: bold; |
| | | padding-top: 3px; |
| | | } |
| | | |
| | | .step-text { |
| | | font-size: 13px; |
| | | color: #999999; |
| | | padding-top: 6px; |
| | | } |
| | | |
| | | .step-current { |
| | | * { |
| | | color: #2f95ff !important; |
| | | } |
| | | |
| | | .step-circle { |
| | | background: #2f95ff !important; |
| | | } |
| | | |
| | | // border-radius: 5px; |
| | | // border: 1px solid #d6eaff; |
| | | font-size: 13px; |
| | | padding-top: 6px; |
| | | // background-color: #eff7ffd9; |
| | | color: black; |
| | | } |
| | | |
| | | .audit-content { |
| | | // background: #f9f9f9; |
| | | padding: 10px; |
| | | border-radius: 4px; |
| | | display: flex; |
| | | |
| | | .fx-left { |
| | | flex: 1; |
| | | width: 0; |
| | | |
| | | .rd { |
| | | display: flex; |
| | | align-items: baseline; |
| | | } |
| | | } |
| | | |
| | | .fx-right { |
| | | // width: 400px; |
| | | |
| | | .btn { |
| | | margin-top: 10px; |
| | | text-align: center; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | .cell-item { |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .desc-top { |
| | | padding: 5px 10px 0 10px; |
| | | } |
| | | .step-item-ad{ |
| | | *{ |
| | | color: #9f9898 !important; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export default { |
| | | initViewColumns(isReset) { |
| | | //åå§åèªå®åé
ç½® |
| | | if (isReset) { |
| | | this.resetViewColumns(); |
| | | } |
| | | if (!this.orginColumnFields) { |
| | | this.orginColumnFields = this.columns.map((c) => { |
| | | return c.field; |
| | | }); |
| | | } |
| | | this.viewColumns = this.columns |
| | | .filter((c) => { |
| | | return !c.hidden && !c.render; |
| | | }) |
| | | .map((c) => { |
| | | return { field: c.field, title: c.title, show: !c.hidden }; |
| | | }); |
| | | if (isReset) { |
| | | return; |
| | | } |
| | | this.getCacheViewColumn(); |
| | | }, |
| | | getViewCacheKey(){ |
| | | return 'custom:column'+this.table.name; |
| | | }, |
| | | getCacheViewColumn() { |
| | | try { |
| | | let columns = localStorage.getItem(this.getViewCacheKey()); |
| | | if (!columns) return; |
| | | columns = JSON.parse(columns); |
| | | if (columns.some(x=>{return !this.viewColumns.some(c=> {return c.field==x.field})})|| |
| | | this.viewColumns.some(x=>{return !columns.some(c=> {return c.field==x.field})}) |
| | | ) { |
| | | localStorage.removeItem(this.getViewCacheKey()) |
| | | return; |
| | | } |
| | | let sortTableColumns = []; |
| | | //å¼¹åºæ¡çå |
| | | let _viewColumns = []; |
| | | columns.forEach((column) => { |
| | | let _column = this.viewColumns.find((c) => { |
| | | return c.field == column.field; |
| | | }); |
| | | if (_column) { |
| | | _column.show = column.show; |
| | | _viewColumns.push(_column); |
| | | } |
| | | let tableColumn = this.columns.find((c) => { |
| | | return c.field == column.field; |
| | | }); |
| | | if (tableColumn) { |
| | | tableColumn.hidden = !column.show; |
| | | sortTableColumns.push(tableColumn); |
| | | } |
| | | }); |
| | | //éæ°æçå¼¹åºæ¡èªå®ä¹å |
| | | let otherColumns = this.viewColumns.filter((c) => { |
| | | return !_viewColumns.some((s) => { |
| | | return c.field == s.field; |
| | | }); |
| | | }); |
| | | //éæ°æçå¼¹åºæ¡èªå®ä¹å |
| | | _viewColumns.push(...otherColumns); |
| | | this.viewColumns.splice(0); |
| | | this.viewColumns.push(..._viewColumns); |
| | | |
| | | this.sortViewColumns(sortTableColumns); |
| | | } catch (error) { |
| | | console.log('设置é»è®¤èªå®ä¹åå¼å¸¸:' + error.message); |
| | | } |
| | | }, |
| | | sortViewColumns(sortColumns) { |
| | | if (sortColumns.length) { |
| | | let hiddenColumns = this.columns.filter((c) => { |
| | | return !sortColumns.some((s) => { |
| | | return c.field == s.field; |
| | | }); |
| | | }); |
| | | sortColumns.push(...hiddenColumns); |
| | | this.columns.splice(0); |
| | | this.columns.push(...sortColumns); |
| | | } |
| | | }, |
| | | resetViewColumns() { |
| | | if (!this.orginColumnFields) { |
| | | return; |
| | | } |
| | | let _columns = []; |
| | | this.orginColumnFields.forEach((x) => { |
| | | _columns.push( |
| | | this.columns.find((c) => { |
| | | return c.field == x; |
| | | }) |
| | | ); |
| | | }); |
| | | let otherColumns = this.columns.filter((c) => { |
| | | return !this.orginColumnFields.some((s) => { |
| | | return c.field == s; |
| | | }); |
| | | }); |
| | | _columns.push(...otherColumns); |
| | | this.columns.splice(0); |
| | | this.columns.push(..._columns); |
| | | }, |
| | | showCustomModel() { |
| | | if (!this.viewColumns.length) { |
| | | this.initViewColumns(); |
| | | } |
| | | this.viewColumnsClone = JSON.parse(JSON.stringify(this.viewColumns)); |
| | | this.viewModel = true; |
| | | }, |
| | | closeCustomModel() { |
| | | this.viewModel=false; |
| | | if (this.checkColumnChanged()) { |
| | | this.viewColumns = JSON.parse(JSON.stringify(this.viewColumnsClone)); |
| | | } |
| | | }, |
| | | checkColumnChanged() { |
| | | return ( |
| | | JSON.stringify(this.viewColumns) != JSON.stringify(this.viewColumnsClone) |
| | | ); |
| | | }, |
| | | saveColumnConfig() { |
| | | let hasShowColumn = this.viewColumns.some((x) => { |
| | | return x.show; |
| | | }); |
| | | if (!hasShowColumn) { |
| | | return this.$message.error('è³å°éæ©ä¸åæ¾ç¤º'); |
| | | } |
| | | this.viewModel = false; |
| | | if (this.checkColumnChanged()) { |
| | | let sortColumns = []; |
| | | this.viewColumns.forEach((column) => { |
| | | let _column = this.columns.find((c) => { |
| | | return c.field == column.field; |
| | | }); |
| | | if (_column) { |
| | | _column.hidden = !column.show; |
| | | sortColumns.push(_column); |
| | | } |
| | | }); |
| | | this.sortViewColumns(sortColumns); |
| | | } |
| | | try { |
| | | localStorage.setItem(this.getViewCacheKey(), JSON.stringify(this.viewColumns)); |
| | | } catch (error) { |
| | | console.log('è·åèªå®ä¹åå¼å¸¸:' + error.message); |
| | | } |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-alert |
| | | title="æå¨ååå¯è°æ´è¡¨æ ¼åæ¾ç¤ºé¡ºåº" |
| | | type="success" |
| | | :show-icon="false" |
| | | > |
| | | </el-alert> |
| | | <div class="view-column view-column-title"> |
| | | <div class="view-column-index">#</div> |
| | | <div class="view-column-left">åå</div> |
| | | <div class="view-column-right">æ¯å¦æ¾ç¤º</div> |
| | | </div> |
| | | <draggable |
| | | class="list-group" |
| | | tag="transition-group" |
| | | :component-data="componentData" |
| | | :list="viewColumns" |
| | | v-bind="dragOptions" |
| | | item-key="order" |
| | | > |
| | | <transition-group class="drag-center-item"> |
| | | <div |
| | | class="view-column" |
| | | v-for="(column, index) in viewColumns" |
| | | :key="index" |
| | | > |
| | | <div class="view-column-index">{{ index + 1 }}</div> |
| | | <div class="view-column-left">{{ column.title }}</div> |
| | | <div class="view-column-right"> |
| | | <el-checkbox v-model="column.show"> |
| | | <div style="height: 100%; width: 250px"></div |
| | | ></el-checkbox> |
| | | </div> |
| | | </div> |
| | | </transition-group> |
| | | </draggable> |
| | | </template> |
| | | <script> |
| | | import { VueDraggableNext } from 'vue-draggable-next'; |
| | | import { defineComponent, ref, reactive } from 'vue'; |
| | | |
| | | export default defineComponent({ |
| | | props: { |
| | | viewColumns: { |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | } |
| | | } |
| | | }, |
| | | components: { |
| | | draggable: VueDraggableNext |
| | | }, |
| | | data() { |
| | | return {}; |
| | | }, |
| | | setup(props, context) { |
| | | const dragOptions = reactive({ |
| | | animation: 200, |
| | | group: 'description', |
| | | disabled: false, |
| | | ghostClass: 'ghost' |
| | | }); |
| | | const componentData = reactive({ |
| | | tag: 'ul', |
| | | type: 'transition-group' |
| | | }); |
| | | return { dragOptions, componentData }; |
| | | } |
| | | }); |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .view-column { |
| | | cursor: pointer; |
| | | display: flex; |
| | | padding: 10px; |
| | | border-bottom: 1px solid #f3f3f3; |
| | | .view-column-index { |
| | | width: 50px; |
| | | } |
| | | .view-column-left { |
| | | width: 120px; |
| | | padding: 0 10px; |
| | | } |
| | | .view-column-right { |
| | | flex: 1; |
| | | } |
| | | } |
| | | .view-column-title { |
| | | font-weight: bold; |
| | | } |
| | | .view-column:last-child { |
| | | border-bottom: 0; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | //ä»è¡¨æ¹æ³ |
| | | let detailMethods = { |
| | | //æ¥è¯¢ä»è¡¨åå
åå
é¨å¤ç |
| | | loadInternalDetailTableBefore(param, callBack) { |
| | | //å è½½æç»è¡¨æ°æ®ä¹å,éè¦è®¾å®æ¥è¯¢ç主表çID |
| | | //æ¯æ¬¡åªè¦å è½½æç»è¡¨æ ¼æ°æ®å°±éç½®å 餿ç»çå¼ |
| | | if (this.detailOptions.delKeys.length > 0) { |
| | | this.detailOptions.delKeys = []; |
| | | } |
| | | let key = this.table.key; |
| | | if (this.currentRow && this.currentRow.hasOwnProperty(key)) { |
| | | param.value = this.currentRow[key]; |
| | | } |
| | | return this.loadDetailTableBefore(param, callBack); |
| | | }, |
| | | detailRowOnChange(row) { |
| | | this.detailRowChange(row); |
| | | }, |
| | | detailRowChange(row) { |
| | | //checkboxéä¸è¡äºä»¶ |
| | | }, |
| | | detailRowOnClick({ row, column, event }) { |
| | | //æç»è¡¨ç¹å»è¡äºä»¶2020.11.07 |
| | | this.detailRowClick({ row, column, event }); |
| | | }, |
| | | detailRowClick({ row, column, event }) {}, |
| | | resetDetailTable(row) { |
| | | //ç¼è¾åæ¥çæç»æ¶éç½®ä»è¡¨æ°æ® |
| | | if (!this.detailOptions.columns || this.detailOptions.columns.length == 0) { |
| | | return; |
| | | } |
| | | let key = this.table.key; |
| | | let query = { value: row ? row[key] : this.currentRow[key] }; |
| | | this.$nextTick(() => { |
| | | if (this.$refs.detail) { |
| | | this.$refs.detail.reset(); |
| | | this.$refs.detail.load(query); |
| | | } |
| | | }); |
| | | }, |
| | | //ä»åé¢å è½½ä»è¡¨æ°æ® |
| | | refreshRow() { |
| | | this.resetDetailTable(); |
| | | }, |
| | | addRow() { |
| | | this.$refs.detail.addRow({}); |
| | | this.$refs.detail.edit.rowIndex=-1; |
| | | this.updateDetailTableSummaryTotal(); |
| | | }, |
| | | delRow() { |
| | | let rows = this.$refs.detail.getSelected(); |
| | | if (!rows || rows.length == 0) { |
| | | return this.$message.error('è¯·éæ©è¦å é¤çè¡!'); |
| | | } |
| | | if (!this.delDetailRow(rows)) { |
| | | return false; |
| | | } |
| | | |
| | | let tigger = false; |
| | | this.$confirm('确认è¦å é¤éæ©çæ°æ®å?', 'è¦å', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | center: true |
| | | }).then(() => { |
| | | if (tigger) return; |
| | | tigger = true; |
| | | rows = this.$refs.detail.delRow(); |
| | | let key = this.detailOptions.key; |
| | | //è®°å½å é¤çè¡æ°æ® |
| | | rows.forEach((x) => { |
| | | if (x.hasOwnProperty(key) && x[key]) { |
| | | this.detailOptions.delKeys.push(x[key]); |
| | | } |
| | | }); |
| | | this.updateDetailTableSummaryTotal(); |
| | | }); |
| | | }, |
| | | updateDetailTableSummaryTotal() { |
| | | //2021.09.25å¢å æç»è¡¨å é¤ãä¿®æ¹æ¶éæ°è®¡ç®è¡æ°ä¸æ±æ» |
| | | //2021.12.12å¢å æç»è¡¨å¤æ(强å¶å·æ°å计æ¶ä¼ç¨å°) |
| | | if (!this.$refs.detail) { |
| | | return; |
| | | } |
| | | //å 餿æ°å¢è¡æ¶éæ°è®¾ç½®æ¾ç¤ºçæ»è¡æ° |
| | | this.$refs.detail.paginations.total = this.$refs.detail.rowData.length; |
| | | //éæ°è®¾ç½®å计 |
| | | if (this.$refs.detail.summary) { |
| | | this.$refs.detail.columns.forEach((column) => { |
| | | if (column.summary) { |
| | | this.$refs.detail.getInputSummaries(null, null, null, column); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | detailSelectable(row, index){ |
| | | //æç»è¡¨CheckBox æ¯å¦å¯ä»¥å¾é |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | export default detailMethods; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import Grid from './ViewGrid.vue' |
| | | const ViewGrid = { |
| | | install: function (app) { |
| | | app.component('ViewGrid', Grid) |
| | | } |
| | | } |
| | | export default ViewGrid |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import detailMethods from './detailMethods.js'; |
| | | //ä¸å¡å¤çæ¹æ³,å
¨é¨å¯ä»¥ç±å¼åè¦ç |
| | | import serviceFilter from './serviceFilter.js'; |
| | | let methods = { |
| | | //彿·»å æ©å±ç»ä»¶gridHeader/gridBody/gridFooteråæç»modelHeader/modelBody/modelFooteræ¶ï¼ |
| | | //妿è¦è·åç¶çº§Vue对象,è¯·ä½¿ç¨æ¤æ¹æ³è¿è¡åè° |
| | | parentCall(fun) { |
| | | if (typeof fun != 'function') { |
| | | return console.log('æ©å±ç»ä»¶éè¦ä¼ å
¥ä¸ä¸ªåè°æ¹æ³æè½è·åç¶çº§Vue对象'); |
| | | } |
| | | fun(this); |
| | | }, |
| | | getCurrentAction() { |
| | | if (this.currentReadonly) { |
| | | return ''; |
| | | } |
| | | return '--' + (this.currentAction == this.const.ADD ? 'æ°å¢' : 'ç¼è¾'); |
| | | }, |
| | | quickSearchKeyPress($event) { |
| | | //æ¥è¯¢å段为inputæ¶ï¼æå车æ¥è¯¢ |
| | | if ($event.keyCode == 13) { |
| | | if (this.searchFormFields[this.singleSearch.field] != '') { |
| | | this.search(); |
| | | } |
| | | } |
| | | }, |
| | | getButtons() { |
| | | //çæViewGridçé¢çæä½æé®åæ´å¤é项 |
| | | let searchIndex = this.buttons.findIndex((x) => { |
| | | return x.value == 'Search'; |
| | | }); |
| | | //æ·»å é«çº§æ¥è¯¢ |
| | | let hasOneFormItem = |
| | | this.searchFormOptions.length == 1 && |
| | | this.searchFormOptions[0].length == 1; |
| | | if (searchIndex != -1 && !hasOneFormItem) { |
| | | this.buttons.splice(searchIndex + 1, 0, { |
| | | icon: this.fiexdSearchForm ? 'el-icon-refresh-left' : 'el-icon-search', |
| | | name: this.fiexdSearchForm ? 'éç½®' : 'é«çº§æ¥è¯¢', |
| | | plain: true, |
| | | type: this.buttons[searchIndex].type, |
| | | onClick: () => { |
| | | if (this.fiexdSearchForm) { |
| | | return this.resetSearch(); |
| | | } |
| | | this.searchBoxShow = !this.searchBoxShow; |
| | | } |
| | | }); |
| | | } |
| | | if (hasOneFormItem) { |
| | | this.fiexdSearchForm = false; |
| | | } |
| | | this.maxBtnLength += searchIndex == -1 ? 0 : 1; |
| | | // if (this.buttons.length <= this.maxBtnLength) { |
| | | // return this.buttons; |
| | | // } |
| | | // let btns = this.buttons.slice(0, this.maxBtnLength); |
| | | // btns[this.maxBtnLength - 1].last = true; |
| | | // return btns; |
| | | }, |
| | | extendBtn(btns, source) { |
| | | //btnsæéæé®ï¼source为æ©å±æé® |
| | | if (!btns || !(source && source instanceof Array)) { |
| | | return; |
| | | } |
| | | //sourceéè¿å¨è¡¨çæ©å±jsæä»¶ä¸buttonså¯¹åºæé®ç屿§indexå³å®æé®ææ¾ä½ç½® |
| | | source.forEach((x) => { |
| | | //éè¿æé®çIndex屿§ï¼æ¾å°æå®çä½ç½® |
| | | btns.splice(x.index == undefined ? btns.length : x.index, 0, x); |
| | | }); |
| | | // if (this.extend.buttons.view) { |
| | | // this.extend.buttons.view.forEach((x) => { |
| | | // //éè¿æé®çIndex屿§ï¼æ¾å°æå®çä½ç½® |
| | | // this.buttons.splice(x.index == undefined ? this.buttons.length : x.index, 0, x); |
| | | // }) |
| | | // } |
| | | }, |
| | | initBoxButtons() { |
| | | //åå§åViewGirdä¸å¼¹åºæ¡/æç»è¡¨æé® |
| | | let path = this.$route.path; |
| | | //éè¿èåè·åç¨æ·æå¯¹åºèåéè¦æ¾ç¤ºçæé® |
| | | let permissionButtons = this.permission.getButtons( |
| | | path, |
| | | null, |
| | | this.extend.tableAction, |
| | | this.table.name |
| | | ); |
| | | if (permissionButtons) { |
| | | //2020.03.31æ·»å æ·±æ·è´æé®ç» |
| | | permissionButtons.forEach((p) => { |
| | | let _obj = {}; |
| | | for (const key in p) { |
| | | _obj[key] = p[key]; |
| | | } |
| | | this.buttons.push(_obj); |
| | | }); |
| | | // this.buttons.push(...permissionButtons); |
| | | } |
| | | if (!this.extend) { |
| | | this.extend = {}; |
| | | } |
| | | if (!this.extend.buttons) { |
| | | this.extend.buttons = {}; |
| | | } |
| | | //æ¥è¯¢ç颿©å±æé®(æ©å±æé®å¯èªè¡éè¿è®¾ç½®æé®çIndex屿§æ¾ç¤ºå°å
·ä½ä½ç½®) |
| | | if (this.extend.buttons.view) { |
| | | this.extendBtn(this.buttons, this.extend.buttons.view); |
| | | } |
| | | |
| | | //å¼¹åºæ¡æé® |
| | | let boxButtons = []; |
| | | |
| | | let saveBtn = this.buttons.some((x) => { |
| | | if ( |
| | | x.value && |
| | | (x.value.toLowerCase() == this.const.ADD.toLowerCase() || |
| | | x.value.toLowerCase() == this.const.EDIT.toLowerCase()) |
| | | ) |
| | | return true; |
| | | }); |
| | | this.currentReadonly = !saveBtn; |
| | | //ä»è¡¨è¡¨æ ¼æä½æé® |
| | | let detailGridButtons = { |
| | | name: 'å·æ°', |
| | | type: 'info', |
| | | icon: 'el-icon-refresh', |
| | | onClick() { |
| | | //妿æç»è¡¨å½åçç¶æä¸ºæ°å»ºæ¶ï¼ç¦æ¢å·æ° |
| | | if (this.currentAction == this.const.ADD) { |
| | | return; |
| | | } |
| | | this.refreshRow(); |
| | | } |
| | | }; |
| | | |
| | | let importExcel = this.buttons.some((x) => { |
| | | if (x.value == this.const.IMPORT) return true; |
| | | }); |
| | | //妿æå¯¼å
¥æé,åéè¦åå§å导å
¥ç»ä»¶ |
| | | if (importExcel) { |
| | | this.upload.url = this.getUrl(this.const.IMPORT); |
| | | //å®ä¹ä¸è½½æ¨¡æ¿çæä»¶å |
| | | this.upload.template.fileName = this.table.cnName; |
| | | //å®ä¹ä¸è½½æ¨¡æ¿çUrlè·¯å¾ |
| | | this.upload.template.url = |
| | | this.http.ipAddress + this.getUrl(this.const.DOWNLOADTEMPLATE, true); |
| | | } |
| | | |
| | | // disabled |
| | | //妿å½åè§è²æ²¡æç¼è¾ææ°å»ºåè½ï¼æ¥çæç»æ¶å段设置å
¨é¨åªè¯» |
| | | //åªææç»è¡¨ï¼å°æç»è¡¨ä¹è®¾ç½®ä¸ºä¸å¯è½ç¼è¾ï¼å¹¶ä¸ä¸æ¾ç¤ºæ·»å è¡ãå é¤è¡ |
| | | if (!saveBtn) { |
| | | this.editFormOptions.forEach((row) => { |
| | | row.forEach((x) => { |
| | | x.disabled = true; |
| | | }); |
| | | }); |
| | | //æ²¡ææ°å¢ç¼è¾æéçï¼å¼¹åºæ¡é½è®¾ç½®ä¸ºåªè¯» |
| | | this.detail.columns.forEach((column) => { |
| | | if (column.hasOwnProperty('edit')) { |
| | | column.readonly = true; |
| | | // row['edit'] = false; |
| | | } |
| | | }); |
| | | //å¼¹åºæ¡æ©å±æé® |
| | | this.extendBtn(boxButtons, this.extend.buttons.box); |
| | | //å¼¹åºå¼¹æ¡æé®(2020.04.21),没æç¼è¾ææ°å»ºæéæ¶ï¼ä¹å¯ä»¥éè¿buttons屿§æ·»å èªå®ä¹å¼¹åºæ¡æé® |
| | | this.boxButtons.push(...boxButtons); |
| | | this.detailOptions.buttons.push(detailGridButtons); |
| | | this.detailOptions.buttons.forEach((button) => { |
| | | if (!button.hasOwnProperty('hidden')) { |
| | | button.hidden = false; |
| | | } |
| | | }); |
| | | //å¼¹åºæ¡æ©å±æç»è¡¨æé® |
| | | this.extendBtn(this.detailOptions.buttons, this.extend.buttons.detail); |
| | | |
| | | return boxButtons; |
| | | } |
| | | |
| | | this.detailOptions.edit = true; |
| | | boxButtons.push( |
| | | ...[ |
| | | { |
| | | name: 'ä¿ å', |
| | | icon: 'el-icon-check', |
| | | type: 'danger', |
| | | disabled: false, |
| | | value: 'save', |
| | | onClick() { |
| | | this.save(); |
| | | } |
| | | } |
| | | // { |
| | | // name: 'é ç½®', |
| | | // icon: 'el-icon-refresh-right', |
| | | // type: 'primary', |
| | | // disabled: false, |
| | | // onClick() { |
| | | // this.resetEdit(); |
| | | // } |
| | | // } |
| | | ] |
| | | ); |
| | | //ä»è¡¨è¡¨æ ¼æä½æé® |
| | | this.detailOptions.buttons.push( |
| | | ...[ |
| | | { |
| | | name: 'æ·»å è¡', |
| | | icon: 'el-icon-plus', |
| | | type: 'primary', |
| | | hidden: false, |
| | | plain: true, |
| | | onClick() { |
| | | this.addRow(); |
| | | } |
| | | }, |
| | | { |
| | | type: 'danger', |
| | | plain: true, |
| | | name: 'å é¤è¡', |
| | | hidden: false, |
| | | icon: 'el-icon-delete', |
| | | onClick() { |
| | | this.delRow(); |
| | | } |
| | | }, |
| | | //2022.01.08å¢å æç»è¡¨å¯¼å
¥å¯¼åºåè½ |
| | | //注æéè¦éååå°æç»è¡¨æ¥å£ç导å
¥ä¸ä¸è½½æ¨¡æ¿ã导åºçæé,Sys_DictionaryListController.cs/SellOrderListController.cs |
| | | { |
| | | type: 'danger', |
| | | plain: true, |
| | | name: '导å
¥', |
| | | value: 'import', |
| | | hidden: false, |
| | | icon: 'el-icon-upload2', |
| | | onClick() { |
| | | this.upload.url = `${this.http.ipAddress}api/${this.detail.table}/${this.const.IMPORT}?table=1`; |
| | | this.upload.template.url = `${this.http.ipAddress}api/${this.detail.table}/${this.const.DOWNLOADTEMPLATE}`; |
| | | //å®ä¹ä¸è½½æ¨¡æ¿çæä»¶å |
| | | this.upload.template.fileName = this.detail.cnName; |
| | | this.upload.excel = true; |
| | | } |
| | | }, |
| | | { |
| | | type: 'danger', |
| | | plain: true, |
| | | name: '导åº', |
| | | value: 'export', |
| | | icon: 'el-icon-download', |
| | | hidden: false, |
| | | onClick() { |
| | | this.export(true); |
| | | } |
| | | } |
| | | ] |
| | | ); |
| | | this.detailOptions.buttons.forEach((button) => { |
| | | if (button.hasOwnProperty('hidden')) { |
| | | button.hidden = false; |
| | | } |
| | | }); |
| | | //å¼¹åºæ¡æ©å±æé® |
| | | this.extendBtn(boxButtons, this.extend.buttons.box); |
| | | |
| | | //å¼¹åºæ¡æ©å±æç»è¡¨æé® |
| | | this.detailOptions.buttons.push(detailGridButtons); |
| | | this.extendBtn(this.detailOptions.buttons, this.extend.buttons.detail); |
| | | |
| | | //å¼¹åºå¼¹æ¡æé® |
| | | this.boxButtons.push(...boxButtons); |
| | | }, |
| | | onClick(click) { |
| | | click.apply(this); |
| | | }, |
| | | changeDropdown(btnName, v1) { |
| | | let button = this.buttons.filter((x) => { |
| | | return x.name == btnName; |
| | | }); |
| | | if (button && button.length > 0) { |
| | | button[0].onClick.apply(this); |
| | | } |
| | | }, |
| | | emptyValue(value) { |
| | | if (typeof value == 'string' && value.trim() === '') { |
| | | return true; |
| | | } |
| | | if (value instanceof Array && !value.length) { |
| | | return true; |
| | | } |
| | | return value === null || value === undefined || value === ''; |
| | | }, |
| | | getSearchParameters() { |
| | | //è·åæ¥è¯¢åæ° |
| | | // 2020.09.11å¢å åºå®æ¥è¯¢è¡¨å,å¦æè®¾ç½®åºå®äºæ¥è¯¢è¡¨åï¼ç¹å»æ¥è¯¢æ¶ï¼ä¸åå
³é |
| | | if (!this.fiexdSearchForm) { |
| | | this.searchBoxShow = false; |
| | | } |
| | | |
| | | let query = { wheres: [] }; |
| | | for (const key in this.searchFormFields) { |
| | | let value = this.searchFormFields[key]; |
| | | if (this.emptyValue(value)) continue; |
| | | |
| | | if (typeof value == 'number') { |
| | | value = value + ''; |
| | | } |
| | | let displayType = this.getSearchItem(key); |
| | | |
| | | //è级åªä¿çéä¸èç¹çæåä¸ä¸ªå¼ |
| | | if (displayType == 'cascader') { |
| | | //æ¥è¯¢ä¸é¢ææçåèç¹ï¼å¦ï¼éä¸çæ¯ç¶èç¹ï¼åºè¯¥æ¥è¯¢ä¸é¢ææçèç¹æ°æ®--å¾
å® |
| | | value = value.length ? value[value.length - 1] + '' : ''; |
| | | } |
| | | //2021.05.02å¢å åºé´æ¥è¯¢ |
| | | if ( |
| | | typeof value == 'string' || |
| | | ['date', 'datetime', 'range'].indexOf(displayType) == -1 |
| | | ) { |
| | | query.wheres.push({ |
| | | name: key, |
| | | value: |
| | | typeof value == 'string' ? (value + '').trim() : value.join(','), |
| | | displayType: displayType |
| | | }); |
| | | continue; |
| | | } |
| | | for (let index = 0; index < value.length; index++) { |
| | | if (!this.emptyValue(value[index])) { |
| | | query.wheres.push({ |
| | | name: key, |
| | | value: (value[index] + '').trim(), |
| | | displayType: (() => { |
| | | if (['date', 'datetime', 'range'].indexOf(displayType) != -1) { |
| | | return index ? 'lessorequal' : 'thanorequal'; |
| | | } |
| | | return displayType; |
| | | })() |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | return query; |
| | | }, |
| | | search() { |
| | | //æ¥è¯¢ |
| | | // let query = this.getSearchParameters(); |
| | | // this.$refs.table.load(query, true); |
| | | this.$refs.table.load(null, true); |
| | | }, |
| | | loadTableBefore(param, callBack) { |
| | | //æ¥è¯¢å设置æ¥è¯¢æ¡ä»¶ååé¡µä¿¡æ¯ |
| | | let query = this.getSearchParameters(); |
| | | if (query) { |
| | | param = Object.assign(param, query); |
| | | } |
| | | |
| | | if (this.$route.query.viewflow && this.$route.query.id) { |
| | | param.wheres.push({ |
| | | name: this.table.key, |
| | | value: this.$route.query.id |
| | | }); |
| | | } |
| | | // if (this.isViewFlow() && data && data.length) { |
| | | // let query = JSON.parse(JSON.stringify(this.$route.query)); |
| | | // query.viewflow = 0; |
| | | // this.$router.replace({ path: this.$route.path, query: query }); |
| | | // this.$nextTick(() => { |
| | | // this.getWorkFlowSteps(data[0]); |
| | | // }); |
| | | // } |
| | | let status = this.searchBefore(param); |
| | | callBack(status); |
| | | }, |
| | | |
| | | loadTableAfter(data, callBack, result) { |
| | | //æ¥è¯¢å |
| | | //2020.10.30å¢å æ¥è¯¢åè¿åææçæ¥è¯¢ä¿¡æ¯ |
| | | let status = this.searchAfter(data, result); |
| | | callBack(status); |
| | | //èªå¨å¼¹åºæ¡å®¡æ¹è¯¦æ
|
| | | }, |
| | | loadDetailTableBefore(param, callBack) { |
| | | //æç»æ¥è¯¢å |
| | | //æ°å»ºæ¶ç¦æ¢å è½½æç» |
| | | if (this.currentAction == this.const.ADD) { |
| | | callBack(false); |
| | | return false; |
| | | } |
| | | let status = this.searchDetailBefore(param); |
| | | callBack(status); |
| | | }, |
| | | loadDetailTableAfter(data, callBack) { |
| | | //æç»æ¥è¯¢å |
| | | let status = this.searchDetailAfter(data); |
| | | callBack(status); |
| | | }, |
| | | getSearchItem(field) { |
| | | //è·åæ¥è¯¢çåæ° |
| | | let data; |
| | | for (let index = 0; index < this.searchFormOptions.length; index++) { |
| | | if (data) return data.type; |
| | | const item = this.searchFormOptions[index]; |
| | | data = item.find((x) => { |
| | | return x.field == field; |
| | | }); |
| | | } |
| | | |
| | | return (data || {}).type; |
| | | }, |
| | | resetSearch() { |
| | | //éç½®æ¥è¯¢å¯¹è±¡ |
| | | this.resetSearchForm(); |
| | | //2020.10.17å¢å éç½®åæ¹æ³ |
| | | this.resetSearchFormAfter && this.resetSearchFormAfter(); |
| | | }, |
| | | resetEdit() { |
| | | //éç½®ç¼è¾çæ°æ® |
| | | let isEdit = this.currentAction != this.const.ADD; |
| | | //éç½®ä¹å |
| | | if (!this[isEdit ? 'resetUpdateFormBefore' : 'resetAddFormBefore']()) { |
| | | return; |
| | | } |
| | | let objKey = {}; |
| | | //ç¼è¾ç¶æä¸,ä¸éè¦é置主é®,å建æ¶é´å建人 |
| | | if (isEdit) { |
| | | objKey[this.table.key] = this.editFormFields[this.table.key]; |
| | | } |
| | | this.resetEditForm(objKey); |
| | | //éç½®ä¹å |
| | | |
| | | if (!this[isEdit ? 'resetUpdateFormAfter' : 'resetAddFormAfter']()) { |
| | | return; |
| | | } |
| | | }, |
| | | resetSearchForm(sourceObj) { |
| | | //éç½®æ¥è¯¢è¡¨ |
| | | this.resetForm('searchForm', sourceObj); |
| | | }, |
| | | resetEditForm(sourceObj) { |
| | | if (this.hasDetail && this.$refs.detail) { |
| | | // this.$refs.detail.rowData.splice(0); |
| | | this.$refs.detail.reset(); |
| | | } |
| | | this.resetForm('form', sourceObj); |
| | | if (this.$refs.form && this.$refs.form.$refs.volform) { |
| | | setTimeout(() => { |
| | | this.$refs.form.$refs.volform.clearValidate(); |
| | | }, 100); |
| | | } |
| | | }, |
| | | getKeyValueType(formData, isEditForm) { |
| | | try { |
| | | let keyLeft = (isEditForm ? 'e' : 's') + '_b_'; |
| | | formData.forEach((item) => { |
| | | item.forEach((x) => { |
| | | if (this.keyValueType.hasOwnProperty(keyLeft + x.field)) { |
| | | return true; |
| | | } |
| | | let data; |
| | | if (x.type == 'switch') { |
| | | this.keyValueType[x.field] = 1; |
| | | } else if (x.bind && x.bind.data) { |
| | | data = x.bind.data; |
| | | } else if (x.data) { |
| | | if (x.data instanceof Array) { |
| | | data = x.data; |
| | | } else if (x.data.data && x.data.data instanceof Array) { |
| | | data = x.data.data; |
| | | } |
| | | } |
| | | if ( |
| | | data && |
| | | data.length > 0 && |
| | | !this.keyValueType.hasOwnProperty(x.field) |
| | | ) { |
| | | this.keyValueType[x.field] = data[0].key; |
| | | this.keyValueType[keyLeft + x.field] = x.type; |
| | | } |
| | | }); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error.message); |
| | | } |
| | | }, |
| | | resetForm(formName, sourceObj) { |
| | | // return; |
| | | //éç½®è¡¨åæ°æ® |
| | | if (this.$refs[formName]) { |
| | | this.$refs[formName].reset(); |
| | | } |
| | | |
| | | if (!sourceObj) return; |
| | | let form, keyLeft; |
| | | if (formName == 'searchForm') { |
| | | form = this.searchFormFields; |
| | | keyLeft = 's' + '_b_'; |
| | | } else { |
| | | form = this.editFormFields; |
| | | keyLeft = 'e' + '_b_'; |
| | | } |
| | | //è·åæ°æ®æºçdataç±»åï¼å¦åå¦ææ°æ®æºdataçkeyæ¯æ°åï¼éç½®ç弿¯åç¬¦ä¸²å°±æ æ³ç»å®å¼ |
| | | if (!this.keyValueType._dinit) { |
| | | this.getKeyValueType(this.editFormOptions, true); |
| | | this.getKeyValueType(this.searchFormOptions, false); |
| | | this.keyValueType._dinit = true; |
| | | } |
| | | var _cascaderParentTree; |
| | | for (const key in form) { |
| | | if (sourceObj.hasOwnProperty(key)) { |
| | | let newVal = sourceObj[key]; |
| | | let kv_type = this.keyValueType[keyLeft + key]; |
| | | |
| | | if ( |
| | | kv_type == 'selectList' || |
| | | kv_type == 'checkbox' || |
| | | kv_type == 'cascader' || |
| | | kv_type == 'treeSelect' |
| | | ) { |
| | | // 2020.05.31å¢å iviewç»ä»¶Cascader |
| | | // 2020.11.01å¢å iviewç»ä»¶Cascader表åéç½®æ¶æ¥è¯¢ææçç¶èç¹ |
| | | if (kv_type == 'cascader' || kv_type == 'treeSelect') { |
| | | var treeDic = this.dicKeys.find((dic) => { |
| | | return dic.fileds && dic.fileds.indexOf(key) != -1; |
| | | }); |
| | | |
| | | if (treeDic && treeDic.orginData && treeDic.orginData.length) { |
| | | let keyIsNum = typeof treeDic.orginData[0].id == 'number'; |
| | | |
| | | if (kv_type == 'cascader') { |
| | | newVal = keyIsNum ? newVal * 1 || 0 : newVal + ''; |
| | | if (kv_type == 'cascader') { |
| | | _cascaderParentTree = this.base.getTreeAllParent( |
| | | newVal, |
| | | treeDic.orginData |
| | | ); |
| | | if (_cascaderParentTree) { |
| | | newVal = _cascaderParentTree.map((x) => { |
| | | return x.id; |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | if (newVal === null || newVal === undefined) { |
| | | newVal = []; |
| | | } else if (typeof newVal == 'string') { |
| | | newVal = newVal.split(','); |
| | | } |
| | | if (keyIsNum) { |
| | | if (Array.isArray(newVal)) { |
| | | newVal = newVal.map((x) => { |
| | | return x * 1 || 0; |
| | | }); |
| | | } |
| | | } else if (typeof newVal == 'number') { |
| | | newVal = [newVal + '']; |
| | | } |
| | | } |
| | | } else { |
| | | newVal = [newVal]; |
| | | } |
| | | } else if ( |
| | | newVal != '' && |
| | | newVal != undefined && |
| | | typeof newVal == 'string' |
| | | ) { |
| | | newVal = newVal.split(','); |
| | | } else if (kv_type == 'checkbox') { |
| | | newVal = []; |
| | | } |
| | | } else if ( |
| | | this.keyValueType.hasOwnProperty(key) && |
| | | typeof this.keyValueType[key] == 'number' && |
| | | newVal * 1 == newVal |
| | | ) { |
| | | newVal = newVal * 1; |
| | | } else { |
| | | if (newVal == null || newVal == undefined) { |
| | | newVal = ''; |
| | | } else if (this.numberFields.indexOf(key) != -1) { |
| | | newVal = newVal * 1 || 0; |
| | | } else { |
| | | newVal += ''; |
| | | } |
| | | } |
| | | if (newVal instanceof Array) { |
| | | if (form[key]) { |
| | | form[key] = []; |
| | | } |
| | | form[key] = newVal; |
| | | } else { |
| | | form[key] = newVal; |
| | | } |
| | | } else { |
| | | form[key] = form[key] instanceof Array ? [] : ''; |
| | | } |
| | | } |
| | | }, |
| | | onBtnClick(param) { |
| | | this[param.method](param.data); |
| | | }, |
| | | refresh() { |
| | | //å·æ° |
| | | this.search(); |
| | | // this.$refs.table.load(); |
| | | }, |
| | | saveBefore(formData) { |
| | | return true; |
| | | }, |
| | | saveAfter(formData, result) { |
| | | return true; |
| | | }, |
| | | save() { |
| | | //æ°å¢æç¼è¾æ¶ä¿å |
| | | // if (!this.$refs.form.validate()) return; |
| | | this.$refs.form.validate((result) => { |
| | | if (result) { |
| | | this.saveExecute(); |
| | | } |
| | | }); |
| | | }, |
| | | async saveExecute() { |
| | | let editFormFields = {}; |
| | | //ä¸ä¼ æä»¶ä»¥éå·éå¼ |
| | | for (const key in this.editFormFields) { |
| | | if ( |
| | | this.uploadfiled && |
| | | this.uploadfiled.length > 0 && |
| | | this.uploadfiled.indexOf(key) != -1 && |
| | | this.editFormFields[key] instanceof Array |
| | | ) { |
| | | let allPath = this.editFormFields[key].map((x) => { |
| | | return x.path; |
| | | }); |
| | | editFormFields[key] = allPath.join(','); |
| | | } else if (typeof this.editFormFields[key] == 'function') { |
| | | try { |
| | | editFormFields[key] = this.editFormFields[key](); |
| | | } catch (error) { } |
| | | } else { |
| | | //2021.05.30ä¿®å¤ä¸ææ¡æ¸
餿°æ®ååå°ä¸è½ä¿åçé®é¢ |
| | | if ( |
| | | this.editFormFields[key] === undefined && |
| | | this.dicKeys.some((x) => { |
| | | return x.fileds && x.fileds.indexOf(key) != -1; |
| | | }) |
| | | ) { |
| | | editFormFields[key] = null; |
| | | } else { |
| | | editFormFields[key] = this.editFormFields[key]; |
| | | } |
| | | } |
| | | } |
| | | //å°æ°ç»è½¬æ¢æstring |
| | | //2020.11.01å¢å 级èå¤ç |
| | | for (const key in editFormFields) { |
| | | if (editFormFields[key] instanceof Array) { |
| | | var iscascader = this.dicKeys.some((x) => { |
| | | return ( |
| | | x.type == 'cascader' && x.fileds && x.fileds.indexOf(key) != -1 |
| | | ); |
| | | }); |
| | | if (iscascader && editFormFields[key].length) { |
| | | editFormFields[key] = |
| | | editFormFields[key][editFormFields[key].length - 1]; |
| | | } else { |
| | | editFormFields[key] = editFormFields[key].join(','); |
| | | } |
| | | } |
| | | } |
| | | |
| | | let formData = { |
| | | mainData: editFormFields, |
| | | detailData: null, |
| | | delKeys: null |
| | | }; |
| | | |
| | | //è·åæç»æ°æ®(åå°æ°æ®æç»æªåæ ¡éªï¼å¾
å®.åå°å·²ç»æ ¡éª) |
| | | if (this.hasDetail) { |
| | | formData.detailData = this.$refs.detail.rowData; |
| | | let _fields = this.detail.columns |
| | | .filter((c) => { |
| | | return ( |
| | | c.type == 'selectList' || (c.edit && c.edit.type == 'selectList') |
| | | ); |
| | | }) |
| | | .map((c) => { |
| | | return c.field; |
| | | }); |
| | | //2022.06.20å¢å ä¿åæ¶å¯¹æç»è¡¨ä¸ææ¡å¤éç夿 |
| | | if (_fields.length) { |
| | | formData.detailData = JSON.parse(JSON.stringify(formData.detailData)); |
| | | formData.detailData.forEach((row) => { |
| | | for (let index = 0; index < _fields.length; index++) { |
| | | const _field = _fields[index]; |
| | | if (Array.isArray(row[_field])) { |
| | | row[_field] = row[_field].join(','); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | if (this.detailOptions.delKeys.length > 0) { |
| | | formData.delKeys = this.detailOptions.delKeys; |
| | | } |
| | | //ä¿ååæ¦æª |
| | | let _currentIsAdd = this.currentAction == this.const.ADD; |
| | | if (_currentIsAdd) { |
| | | //2020.12.06å¢å æ°å»ºå弿¥å¤çæ¹æ³ |
| | | //2021.08.16ä¿®å¤å¼æ¥è¯æ³åéçé®é¢ |
| | | if (!this.addBefore(formData) || !(await this.addBeforeAsync(formData))) |
| | | return; |
| | | } else { |
| | | //2020.12.06å¢å ä¿®æ¹å弿¥å¤çæ¹æ³ |
| | | if ( |
| | | !this.updateBefore(formData) || |
| | | !(await this.updateBeforeAsync(formData)) |
| | | ) |
| | | return; |
| | | } |
| | | let url = this.getUrl(this.currentAction); |
| | | this.http.post(url, formData, true).then((x) => { |
| | | //ä¿åå |
| | | if (_currentIsAdd) { |
| | | if (!this.addAfter(x)) return; |
| | | //è¿ç»æ·»å |
| | | if (this.continueAdd && x.status) { |
| | | this.$success(x.message); |
| | | //æ°å»º |
| | | this.currentAction = this.const.ADD; |
| | | this.currentRow = {}; |
| | | this.resetAdd(); |
| | | this.refresh(); |
| | | return; |
| | | } |
| | | } else { |
| | | if (!this.updateAfter(x)) return; |
| | | } |
| | | if (!x.status) return this.$error(x.message); |
| | | this.$success(x.message || 'æä½æå'); |
| | | //妿ä¿åæååéè¦å
³éç¼è¾æ¡ï¼ç´æ¥è¿åä¸å¤çåé¢ |
| | | if (this.boxOptions.saveClose) { |
| | | this.boxModel = false; |
| | | //2020.12.27妿æ¯ç¼è¾ä¿ååä¸éç½®å页页æ°ï¼å·æ°é¡µé¢æ¶è¿æ¯æ¾ç¤ºå½åé¡µçæ°æ® |
| | | this.$refs.table.load(null, _currentIsAdd); |
| | | //this.refresh(); |
| | | return; |
| | | } |
| | | let resultRow; |
| | | if (typeof x.data == 'string' && x.data != '') { |
| | | resultRow = JSON.parse(x.data); |
| | | } else { |
| | | resultRow = x.data; |
| | | } |
| | | |
| | | if (this.currentAction == this.const.ADD) { |
| | | // this.currentRow=x.data; |
| | | this.editFormFields[this.table.key] = ''; |
| | | this.currentAction = this.const.EDIT; |
| | | this.currentRow = resultRow.data; |
| | | } |
| | | this.resetEditForm(resultRow.data); |
| | | // console.log(resultRow); |
| | | if (this.hasDetail) { |
| | | this.detailOptions.delKeys = []; |
| | | if (resultRow.list) { |
| | | this.$refs.detail.rowData.push(...resultRow.list); |
| | | } |
| | | } |
| | | this.$refs.table.load(null, _currentIsAdd); |
| | | // this.refresh(); |
| | | }); |
| | | }, |
| | | del(rows) { |
| | | if (rows) { |
| | | if (!(rows instanceof Array)) { |
| | | rows = [rows]; |
| | | } |
| | | } else { |
| | | rows = this.$refs.table.getSelected(); |
| | | } |
| | | //å 餿°æ® |
| | | |
| | | if (!rows || rows.length == 0) return this.$error('è¯·éæ©è¦å é¤çè¡!'); |
| | | let delKeys = rows.map((x) => { |
| | | return x[this.table.key]; |
| | | }); |
| | | if (!delKeys || delKeys.length == 0) |
| | | return this.$error('没æè·åè¦å é¤çè¡æ°æ®!'); |
| | | //å é¤å |
| | | if (!this.delBefore(delKeys, rows)) { |
| | | return; |
| | | } |
| | | let tigger = false; |
| | | this.$confirm('确认è¦å é¤éæ©çæ°æ®å?', 'è¦å', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | center: true |
| | | }).then(() => { |
| | | if (tigger) return; |
| | | tigger = true; |
| | | let url = this.getUrl(this.const.DEL); |
| | | this.http.post(url, delKeys, 'æ£å¨å 餿°æ®....').then((x) => { |
| | | if (!x.status) return this.$error(x.message); |
| | | this.$success("å 餿å"); |
| | | //å é¤å |
| | | if (!this.delAfter(x)) { |
| | | return; |
| | | } |
| | | this.refresh(); |
| | | }); |
| | | }); |
| | | }, |
| | | async modelOpenBeforeAsync(row) { |
| | | return true; |
| | | }, |
| | | async initBox() { |
| | | //2022.01.08å¢å æ°å»ºæ¶éèæç»è¡¨å¯¼åºåè½ |
| | | this.detailOptions.buttons.forEach((x) => { |
| | | if (x.value == 'export') { |
| | | x.hidden = this.currentAction == 'Add'; |
| | | } |
| | | }); |
| | | //åå§åæ°å»ºãç¼è¾çå¼¹åºæ¡ |
| | | if (!(await this.modelOpenBeforeAsync(this.currentRow))) return false; |
| | | this.modelOpenBefore(this.currentRow); |
| | | if (!this.boxInit) { |
| | | this.boxInit = true; |
| | | this.boxModel = true; |
| | | // this.detailUrl = this.url; |
| | | } |
| | | return true; |
| | | }, |
| | | setEditForm(row) { |
| | | // if (this.remoteColumns.length == 0 || !rows || rows.length == 0) return; |
| | | let remoteColumns = this.$refs.table.remoteColumns; |
| | | remoteColumns.forEach((column) => { |
| | | this.editFormOptions.forEach((option) => { |
| | | option.forEach((x) => { |
| | | if (x.field == column.field) { |
| | | x.data.data = Object.assign([], x.data, column.bind.data); |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | this.editFormFields; |
| | | //éç½®ç¼è¾è¡¨åæ°æ® |
| | | this.editFormFields[this.table.key] = row[this.table.key]; |
| | | |
| | | this.resetEditForm(row); |
| | | this.currentAction = this.const.EDIT; |
| | | this.boxModel = true; |
| | | }, |
| | | async linkData(row, column) { |
| | | this.boxOptions.title = this.table.cnName + '(ç¼è¾)'; |
| | | //ç¹å»tableåå
æ ¼å¿«æ·é¾æ¥æ¾ç¤ºç¼è¾æ°æ® |
| | | this.currentAction = this.const.EDIT; |
| | | this.currentRow = row; |
| | | if (!(await this.initBox())) return; |
| | | this.resetDetailTable(row); |
| | | this.setEditForm(row); |
| | | this.setContinueAdd(false); |
| | | //设置è¿ç¨æ¥è¯¢è¡¨åçé»è®¤key/value |
| | | this.getRemoteFormDefaultKeyValue(); |
| | | //ç¹å»ç¼è¾æé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | this.modelOpenProcess(row); |
| | | }, |
| | | setContinueAdd(isAdd) { |
| | | if (!this.continueAdd) return; |
| | | var _button = this.boxButtons.find((x) => { |
| | | return x.value == 'save'; |
| | | }); |
| | | if (_button) { |
| | | _button.name = isAdd ? this.continueAddName : 'ä¿ å'; |
| | | } |
| | | }, |
| | | resetAdd() { |
| | | if (this.hasDetail) { |
| | | this.$refs.detail && |
| | | // this.$refs.detail.rowData && |
| | | this.$refs.detail.reset(); |
| | | } |
| | | let obj = {}; |
| | | //妿æswitchæ ç¾ï¼é»è®¤é½è®¾ç½®ä¸ºå¦ |
| | | this.editFormOptions.forEach((x) => { |
| | | x.forEach((item) => { |
| | | if (item.type == 'switch') { |
| | | obj[item.field] = 0; |
| | | } |
| | | }); |
| | | }); |
| | | this.resetEditForm(obj); |
| | | }, |
| | | async add() { |
| | | this.boxOptions.title = this.table.cnName + '(æ°å»º)'; |
| | | //æ°å»º |
| | | this.currentAction = this.const.ADD; |
| | | this.currentRow = {}; |
| | | if (!(await this.initBox())) return; |
| | | |
| | | this.resetAdd(); |
| | | this.setContinueAdd(true); |
| | | // this.resetEditForm(); |
| | | this.boxModel = true; |
| | | //ç¹å»æ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | this.modelOpenProcess(); |
| | | // this.modelOpenAfter(); |
| | | }, |
| | | async edit(rows) { |
| | | this.boxOptions.title = 'ç¼è¾'; |
| | | //ç¼è¾ |
| | | this.currentAction = this.const.EDIT; |
| | | if (rows) { |
| | | if (!(rows instanceof Array)) { |
| | | rows = [rows]; |
| | | } |
| | | } else { |
| | | rows = this.$refs.table.getSelected(); |
| | | } |
| | | if (rows.length == 0) { |
| | | return this.$error('è¯·éæ©è¦ç¼è¾çè¡!'); |
| | | } |
| | | if (rows.length != 1) { |
| | | return this.$error('åªè½éæ©ä¸è¡æ°æ®è¿è¡ç¼è¾!'); |
| | | } |
| | | //è®°å½å½åç¼è¾çè¡ |
| | | this.currentRow = rows[0]; |
| | | //åå§åå¼¹åºæ¡ |
| | | if (!(await this.initBox())) return; |
| | | this.setContinueAdd(false); |
| | | //é置表å |
| | | this.resetDetailTable(); |
| | | |
| | | //设置å½åçæ°æ®å°è¡¨åä¸ |
| | | this.setEditForm(rows[0]); |
| | | //设置è¿ç¨æ¥è¯¢è¡¨åçé»è®¤key/value |
| | | this.getRemoteFormDefaultKeyValue(); |
| | | //ç¹å»ç¼è¾æé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | this.modelOpenProcess(rows[0]); |
| | | // this.modelOpenAfter(rows[0]); |
| | | }, |
| | | getRemoteFormDefaultKeyValue() { |
| | | //设置表åè¿ç¨æ°æ®æºçé»è®¤key.value |
| | | if (this.currentAction != this.const.EDIT || this.remoteKeys.length == 0) |
| | | return; |
| | | this.editFormOptions.forEach((x, xIndex) => { |
| | | x.forEach((item, yIndex) => { |
| | | if (item.remote) { |
| | | let column = this.columns.find((x) => { |
| | | return x.bind && x.bind.key == item.dataKey; |
| | | }); |
| | | if (!column) return; |
| | | let key = this.currentRow[item.field]; |
| | | let obj = column.bind.data.find((x) => { |
| | | return x.key == key; |
| | | }); |
| | | // obj ? obj.value : keyå¦ææ²¡ææ¥å°æ°æ®æºï¼ç´æ¥ä½¿ç¨åæ°æ® |
| | | item.data = [{ key: key, value: obj ? obj.value : key }]; |
| | | this.editFormOptions[xIndex].splice(yIndex, 1, item); |
| | | // this.$set(item, 'data', [{ key: key + '', value: obj.value }]) |
| | | // item.data = [{ key: key + '', value: obj.value }]; |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | modelOpenProcess(row) { |
| | | this.$nextTick(() => { |
| | | this.modelOpenAfter(row); |
| | | }); |
| | | return; |
| | | // if (!this.$refs.form) { |
| | | // let timeOut = setTimeout(x => { |
| | | // this.modelOpenAfter(row); |
| | | // }, 500) |
| | | // return; |
| | | // } |
| | | // this.modelOpenAfter(row); |
| | | }, |
| | | import() { |
| | | //导å
¥(ä¸ä¼ excel),å¼¹åºå¯¼å
¥ç»ä»¶UploadExcel.vue |
| | | this.upload.excel = true; |
| | | this.$refs.upload_excel && this.$refs.upload_excel.reset(); |
| | | }, |
| | | download(url, fileName) { |
| | | //ä¸è½½å¯¼åºçæä»¶ |
| | | let xmlResquest = new XMLHttpRequest(); |
| | | xmlResquest.open('GET', url, true); |
| | | xmlResquest.setRequestHeader('Content-type', 'application/json'); |
| | | xmlResquest.setRequestHeader( |
| | | 'Authorization', |
| | | this.$store.getters.getToken() |
| | | ); |
| | | let elink = this.$refs.export; |
| | | xmlResquest.responseType = 'blob'; |
| | | xmlResquest.onload = function (oEvent) { |
| | | if (xmlResquest.status != 200) { |
| | | this.$error('ä¸è½½æä»¶åºéäº..'); |
| | | return; |
| | | } |
| | | let content = xmlResquest.response; |
| | | // let elink = this.$refs.export;//document.createElement("a"); |
| | | elink.download = fileName; //+".xlsx"; |
| | | // elink.style.display = "none"; |
| | | let blob = new Blob([content]); |
| | | elink.href = URL.createObjectURL(blob); |
| | | // document.body.appendChild(elink); |
| | | elink.click(); |
| | | // document.body.removeChild(elink); |
| | | }; |
| | | xmlResquest.send(); |
| | | }, |
| | | getFileName(isDetail) { |
| | | //2021.01.08å¢å 导åºexcelæ¶èªå®ä¹æä»¶å |
| | | if (isDetail) { |
| | | return this.detail.cnName + '.xlsx'; |
| | | } |
| | | return this.table.cnName + '.xlsx'; |
| | | }, |
| | | export(isDetail) { |
| | | //å¯¼åº |
| | | let url, query, param; |
| | | if (isDetail) { |
| | | //æç»è¡¨å¯¼åºæ¶å¦ææ¯æ°å»ºç¶æï¼ç¦æ¢å¯¼åº |
| | | if (this.currentAction == 'Add') { |
| | | return; |
| | | } |
| | | url = `api/${this.detail.table}/${this.const.EXPORT}`; |
| | | param = { |
| | | wheres: [ |
| | | { name: this.table.key, value: this.editFormFields[this.table.key] } |
| | | ] |
| | | }; |
| | | } else { |
| | | //ä¸»è¡¨å¯¼åº |
| | | url = this.getUrl(this.const.EXPORT); |
| | | query = this.getSearchParameters(); |
| | | param = { order: this.pagination.order, wheres: query.wheres || [] }; |
| | | } |
| | | //2020.06.25å¢å 导åºåå¤ç |
| | | if (!isDetail && !this.exportBefore(param)) { |
| | | return; |
| | | } |
| | | |
| | | if (param.wheres && typeof param.wheres == 'object') { |
| | | param.wheres = JSON.stringify(param.wheres); |
| | | } |
| | | let $http = this.http; |
| | | //2022.09.26å¢å èªå®ä¹å¯¼åºæä»¶å |
| | | let fileName = this.downloadFileName || this.getFileName(isDetail); |
| | | //2021.01.08ä¼å导åºåè½ |
| | | $http |
| | | .post(url, param, 'æ£å¨å¯¼åºæ°æ®....', { responseType: 'blob' }) |
| | | .then((content) => { |
| | | const blob = new Blob([content]); |
| | | if ('download' in document.createElement('a')) { |
| | | // éIEä¸è½½ |
| | | const elink = document.createElement('a'); |
| | | elink.download = fileName; |
| | | elink.style.display = 'none'; |
| | | elink.href = URL.createObjectURL(blob); |
| | | document.body.appendChild(elink); |
| | | elink.click(); |
| | | URL.revokeObjectURL(elink.href); |
| | | document.body.removeChild(elink); |
| | | } else { |
| | | // IE10+ä¸è½½ |
| | | navigator.msSaveBlob(blob, fileName); |
| | | } |
| | | }); |
| | | //.then(result => { |
| | | // if (!result.status) { |
| | | // return this.$error(result.message); |
| | | // } |
| | | // let path = this.getUrl(this.const.DOWNLOAD); |
| | | // path = path[0] == "/" ? path.substring(1) : path; |
| | | // this.download( |
| | | // $http.ipAddress + path + "?path=" + result.data, |
| | | // this.table.cnName + ".xlsx" // filePath |
| | | // ); |
| | | /// window.open($http.ipAddress + path + "?fileName=" + filePath, "_self"); |
| | | // }); |
| | | }, |
| | | getSelectRows() { |
| | | //è·åéä¸çè¡ |
| | | return this.$refs.table.getSelected(); |
| | | }, |
| | | getDetailSelectRows() { |
| | | //æè·åæç»éä¸çè¡ |
| | | if (!this.$refs.detail) { |
| | | return []; |
| | | } |
| | | return this.$refs.detail.getSelected(); |
| | | }, |
| | | audit() { |
| | | //å®¡æ ¸å¼¹åºæ¡ |
| | | let rows = this.$refs.table.getSelected(); |
| | | if (rows.length == 0) return this.$error('è¯·éæ©è¦å®¡æ ¸çè¡!'); |
| | | let auditStatus = Object.keys(rows[0]).find(x => { return x.toLowerCase() === 'auditstatus' }); |
| | | if (!auditStatus) { |
| | | return this.$message.error(`表å¿
é¡»å
æ¬å®¡æ ¸å段ãAuditStatusã,并䏿¯intç±»å`) |
| | | } |
| | | // let checkStatus = rows.every((x) => { |
| | | // return this.$global.audit.status.some(c => { return c === x[auditStatus] || !x[auditStatus] }) |
| | | // }); |
| | | // if (!checkStatus) return this.$error('åªè½éæ©å¾
å®¡æ¹æå®¡æ ¸ä¸çæ°æ®!'); |
| | | this.$refs.audit.open(rows); |
| | | }, |
| | | saveAudit(params, rows, callback) { |
| | | |
| | | //ä¿åå®¡æ ¸ |
| | | let keys = rows.map(x => { return x[this.table.key] }); |
| | | if (!this.auditBefore(keys, rows)) { |
| | | return; |
| | | } |
| | | let url = `${this.getUrl(this.const.AUDIT)}?auditReason=${params.reason}&auditStatus=${params.value}` |
| | | this.http.post(url, keys, 'å®¡æ ¸ä¸....').then((x) => { |
| | | if (!this.auditAfter(x, keys)) { |
| | | return; |
| | | } |
| | | if (!x.status) return this.$error(x.message); |
| | | |
| | | callback && callback(x); |
| | | this.$success(x.message); |
| | | this.refresh(); |
| | | }); |
| | | }, |
| | | viewModelCancel() { |
| | | //æ¥çè¡¨ç»æ |
| | | this.viewModel = false; |
| | | }, |
| | | initFormOptions(formOptions, keys, formFields, isEdit) { |
| | | //åå§åæ¥è¯¢ãç¼è¾å¯¹è±¡çä¸ææ¡æ°æ®æºãå¾çä¸ä¼ 龿¥å°å |
| | | //let defaultOption = { key: "", value: "è¯·éæ©" }; |
| | | //æä¸ä¼ çåæ®µ |
| | | //2020.05.03æ°å¢ |
| | | //ç¼è¾æ°æ®æºçç±»å |
| | | formOptions.forEach((item) => { |
| | | item.forEach((d) => { |
| | | if (d.type == 'number') { |
| | | //2022.08.22ä¼å表åç±»å为numberæ¶çé»è®¤å¼ |
| | | if (formFields[d.field] === '') { |
| | | formFields[d.field] = undefined; |
| | | } |
| | | this.numberFields.push(d.field); |
| | | } |
| | | if ( |
| | | d.type == 'img' || |
| | | d.type == 'excel' || |
| | | d.type == 'file' || |
| | | d.columnType == 'img' |
| | | ) { |
| | | d.url = this.http.ipAddress + 'api' + this.table.url + 'Upload'; |
| | | this.uploadfiled.push(d.field); |
| | | } |
| | | if (!d.dataKey) return true; |
| | | //2022.02.20强å¶å¼å¯è级å¯ä»¥éæ©æä¸ªèç¹ |
| | | if (d.type == 'cascader' && !d.hasOwnProperty('changeOnSelect')) { |
| | | //强å¶å¼å¯è级å¯ä»¥éæ©æä¸ªèç¹ |
| | | d.changeOnSelect = true; |
| | | } |
| | | //å¼å¯è¿ç¨æç´¢ |
| | | if (d.remote) { |
| | | this.remoteKeys.push(d.dataKey); |
| | | d.data = []; //{ dicNo: d.dataKey, data: [] }; |
| | | return true; |
| | | } |
| | | //2020.05.03å¢å ç¼è¾è¡¨å对checkboxçæ¯æ |
| | | if (d.type == 'checkbox' && !(formFields[d.field] instanceof Array)) { |
| | | formFields[d.field] = []; |
| | | } |
| | | if (keys.indexOf(d.dataKey) == -1) { |
| | | //2020.05.03å¢å è®°å½ç¼è¾åæ®µçæ°æ®æºç±»å |
| | | |
| | | keys.push(d.dataKey); |
| | | //2020.05.03ä¿®å¤æ¥è¯¢è¡¨åä¸ç¼è¾è¡¨åtypeç±»ååæå¼ºä¸è´æ§çé®é¢ |
| | | //this.dicKeys.push({ dicNo: d.dataKey, data: [], type: d.type }); |
| | | // 2020.11.01å¢å iviewç»ä»¶Cascaderæ°æ®æºåå¨ |
| | | let _dic = { |
| | | dicNo: d.dataKey, |
| | | data: [], |
| | | fileds: [d.field], |
| | | orginData: [] |
| | | }; |
| | | if (d.type == 'cascader') { |
| | | _dic.type = 'cascader'; |
| | | } |
| | | if (isEdit) { |
| | | _dic['e_type'] = d.type; |
| | | } |
| | | this.dicKeys.push(_dic); |
| | | } else if (d.type == 'cascader') { |
| | | this.dicKeys.forEach((x) => { |
| | | if (x.dicNo == d.dataKey) { |
| | | x.type = 'cascader'; |
| | | x.fileds.push(d.field); |
| | | } |
| | | }); |
| | | } |
| | | if (d.type != 'cascader') { |
| | | //2020.01.30ç§»é¤å
é¨è¡¨åformOptionsæ°æ®æºé
ç½®æ ¼å¼data.dataï¼ææåæ°æ¹ä¸ºä¸ç»ä»¶apiæ ¼å¼ç¸å |
| | | Object.assign( |
| | | d, |
| | | this.dicKeys.filter((f) => { |
| | | return f.dicNo == d.dataKey; |
| | | })[0], |
| | | { type: d.type } |
| | | ); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | //åå§table䏿ç»è¡¨çæ°æ®æºæådicKeys对象ï¼åå»åå°å è½½æ°æ®æº |
| | | initColumns(scoure, dicKeys, keys) { |
| | | if (!scoure || !(scoure instanceof Array)) return; |
| | | scoure.forEach((item) => { |
| | | if (!item.bind || (item.bind.data && item.bind.data.length > 0)) |
| | | return true; |
| | | let key = item.bind.key || item.bind.dicNo; |
| | | if (this.remoteKeys.indexOf(key) != -1) { |
| | | item.bind.remote = true; |
| | | return true; |
| | | } |
| | | if (this.hasKeyField.indexOf(item.field) == -1) { |
| | | this.hasKeyField.push(item.field); |
| | | } |
| | | var dic = dicKeys.filter((x) => { |
| | | return x.dicNo == key; |
| | | }); |
| | | if (!dic || dic.length == 0) { |
| | | dicKeys.push({ dicNo: key, data: [] }); |
| | | dic = [dicKeys[dicKeys.length - 1]]; |
| | | keys.push(key); |
| | | } |
| | | //2020.11.01å¢å 级èå¤ç |
| | | if (dic[0].type == 'cascader' || dic[0].type == 'treeSelect') { |
| | | item.bind = { data: dic[0].orginData, type: 'select', key: key }; |
| | | } else { |
| | | item.bind = dic[0]; |
| | | } |
| | | //2020.05.03ä¼åtableæ°æ®æºcheckboxä¸selectç±»åä»ç¼è¾åä¸éå |
| | | item.bind.type = item.bind.e_type || 'string'; |
| | | }); |
| | | }, |
| | | bindOptions(dic) { |
| | | //ç»å®ä¸ææ¡çæ°æ®æº |
| | | //ç»å®åå°çåå
¸æ°æ® |
| | | dic.forEach((d) => { |
| | | if (d.data.length >= (this.select2Count || 500)) { |
| | | if ( |
| | | !this.dicKeys.some((x) => { |
| | | return ( |
| | | x.dicNo == d.dicNo && |
| | | (x.type == 'cascader' || x.type == 'treeSelect') |
| | | ); |
| | | }) |
| | | ) { |
| | | d.data.forEach((item) => { |
| | | item.label = item.value; |
| | | item.value = item.key; |
| | | }); |
| | | } |
| | | } |
| | | this.dicKeys.forEach((x) => { |
| | | if (x.dicNo != d.dicNo) return true; |
| | | //2020.10.26å¢å çº§èæ°æ®æºç»å®å¤ç |
| | | if (x.type == 'cascader' || x.type == 'treeSelect') { |
| | | // x.data=d.data; |
| | | //çætreeç»æ |
| | | let _data = JSON.parse(JSON.stringify(d.data)); |
| | | //2022.04.04å¢å 级èåå
¸æ°æ®æºå·æ°åtable没æååçé®é¢ |
| | | this.columns.forEach((column) => { |
| | | if (column.bind && column.bind.key == d.dicNo) { |
| | | column.bind.data = d.data; |
| | | } |
| | | }); |
| | | let arr = this.base.convertTree(_data, (node, data, isRoot) => { |
| | | if (!node.inited) { |
| | | node.inited = true; |
| | | node.label = node.value; |
| | | node.value = node.key; |
| | | } |
| | | }); |
| | | x.data.push(...arr); |
| | | x.orginData.push(...d.data); |
| | | //2021.10.17ä¿®å¤æ¥è¯¢çº§èä¸è½ç»å®æ°æ®æºçé®é¢ |
| | | this.searchFormOptions.forEach((searhcOption) => { |
| | | searhcOption.forEach((_option) => { |
| | | if (_option.type == 'cascader' && _option.dataKey == x.dicNo) { |
| | | _option.data = arr; |
| | | _option.orginData = d.data; |
| | | } |
| | | }); |
| | | }); |
| | | //2021.10.17ä¿®å¤çº§èä¸è½äºçº§å·æ°çé®é¢ |
| | | this.editFormOptions.forEach((editOption) => { |
| | | editOption.forEach((_option) => { |
| | | if ( |
| | | (_option.type == 'cascader' || _option.type == 'treeSelect') && |
| | | _option.dataKey == x.dicNo |
| | | ) { |
| | | _option.data = arr; |
| | | _option.orginData = d.data; |
| | | } |
| | | }); |
| | | }); |
| | | } else if (d.data.length > 0 && !d.data[0].hasOwnProperty('key')) { |
| | | let source = d.data, |
| | | newSource = new Array(source.length); |
| | | for (let index = 0; index < source.length; index++) { |
| | | newSource[index] = { |
| | | //é»è®¤ä»åå
¸æ°æ®è¯»åºæ¥çkey齿¯stringç±»å,ä½å¦ææ°æ®ä»sql䏿¥è¯¢çå¯è½ä¸ºéstring,妿¯async-validatoréè¦éç½®è®¾ç½®æ ¼å¼ |
| | | key: source['key'] + '', //source[index][x.config.valueField] + "", |
| | | value: source['value'] //source[index][x.config.textField] |
| | | }; |
| | | } |
| | | |
| | | x.data.push(...newSource); |
| | | } else { |
| | | //2020.06.06ï¼å¦ææ¯selectListæ°æ®æºä½¿ç¨çèªå®ä¹sqlå¹¶ä¸keyæ¯æ°åï¼å¼ºå¶è½¬æ¢æå符串 |
| | | if ( |
| | | x.e_type == 'selectList' && |
| | | d.data.length > 0 && |
| | | typeof d.data[0].key == 'number' |
| | | ) { |
| | | d.data.forEach((c) => { |
| | | c.key = c.key + ''; |
| | | }); |
| | | } |
| | | x.data.push(...d.data); |
| | | } |
| | | if ( |
| | | this.singleSearch && |
| | | this.singleSearch.dataKey && |
| | | this.singleSearch.dataKey == x.dicNo |
| | | ) { |
| | | this.singleSearch.data.splice(0, 1, ...x.data); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | getUrl(action, ingorPrefix) { |
| | | //æ¯å¦å¿½ç¥åç¼/ è·åæä½çurl |
| | | return (!ingorPrefix ? '/' : '') + 'api' + this.table.url + action; |
| | | }, |
| | | |
| | | initDicKeys() { |
| | | //åå§ååå
¸æ°æ® |
| | | let keys = []; |
| | | //2022.04.17ä¼åéæ°å è½½æ°æ®æº |
| | | this.dicKeys.forEach((item) => { |
| | | item.data.splice(0); |
| | | item.orginData && item.orginData.splice(0); |
| | | }); |
| | | //this.dicKeys.splice(0); |
| | | //åå§åç¼è¾æ°æ®æº,é»è®¤ä¸ºä¸ä¸ªç©ºæ°ç»ï¼å¦æè¦æ±å¿
填设置type=number/decimalçæå°å¼ |
| | | this.initFormOptions(this.editFormOptions, keys, this.editFormFields, true); |
| | | //åå§åæ¥è¯¢æ°æ®æº,é»è®¤ä¸ºä¸ä¸ªç©ºæ°ç» |
| | | this.initFormOptions( |
| | | this.searchFormOptions, |
| | | keys, |
| | | this.searchFormFields, |
| | | false |
| | | ); |
| | | //æ¥è¯¢æ¥æè®¾ç½®ä¸ºå¯éå¼å§ä¸ç»ææ¥æ |
| | | this.searchFormOptions.forEach((item) => { |
| | | item.forEach((x) => { |
| | | if (x.type == 'date' || x.type == 'datetime') x.range = true; |
| | | }); |
| | | }); |
| | | //åå§ådatatableè¡¨æ°æ®æº,é»è®¤ä¸ºä¸ä¸ªç©ºæ°ç»,dicKeys为ç颿æçæ°æ®åå
¸ç¼å· |
| | | this.initColumns(this.columns, this.dicKeys, keys); |
| | | //2021.05.23é»è®¤å¼å¯æ¥è¯¢é¡µé¢ææå段æåº,妿ä¸éè¦æåºï¼å¨onInitedéåcolumns设置sort=false |
| | | //2021.09.25ç§»é¤å¼ºå¶æåºåè½ |
| | | // this.columns.forEach(x => { |
| | | // x.sort = x.render ? false : true; |
| | | // }) |
| | | if (this.detailOptions && this.detailOptions.columns) { |
| | | this.initColumns(this.detailOptions.columns, this.dicKeys, keys); |
| | | } |
| | | //åå§åå¿«éæ¥è¯¢åæ®µ,é»è®¤ä½¿ç¨ä»£ç çæå¨é
ç½®ç第ä¸ä¸ªæ¥è¯¢å段 |
| | | if (this.searchFormOptions.length > 0) { |
| | | this.singleSearch = { |
| | | dataKey: this.searchFormOptions[0][0].dataKey, |
| | | dicNo: this.searchFormOptions[0][0].dicNo, |
| | | field: this.searchFormOptions[0][0].field, |
| | | title: this.searchFormOptions[0][0].title, |
| | | type: this.searchFormOptions[0][0].type, |
| | | data: [] |
| | | }; |
| | | // this.singleSearch = this.searchFormOptions[0][0]; |
| | | } |
| | | if (keys.length == 0) return; |
| | | let $this = this; |
| | | this.http.post('/api/Sys_Dictionary/GetVueDictionary', keys).then((dic) => { |
| | | |
| | | $this.bindOptions(dic); |
| | | //2022.04.04å¢å åå
¸å è½½å®ææ¹æ³ |
| | | $this.dicInited && $this.dicInited(dic); |
| | | }); |
| | | }, |
| | | setFiexdColumn(columns, containerWidth) { |
| | | //è®¡ç®æ´ä¸ªtableçå®½åº¦ï¼æ ¹æ®å®½åº¦å³å®æ¯å¦å¯ç¨ç¬¬ä¸è¡æ¾ç¤ºçå为åºå®å |
| | | //2021.09.21ç§»é¤å¼ºå¶åºå®ç¬¬ä¸å |
| | | // let columnsWidth = 0; |
| | | // columns.forEach(x => { |
| | | // if (!x.hidden && x.width) { |
| | | // columnsWidth += x.width; |
| | | // } |
| | | // }); |
| | | // //å¯ç¨ç¬¬ä¸å为åºå®å |
| | | // if (columnsWidth > containerWidth) { |
| | | // let firstColumn = columns.find(x => !x.hidden); |
| | | // if (firstColumn) { |
| | | // firstColumn.fixed = true; |
| | | // } |
| | | // } |
| | | }, |
| | | initBoxHeightWidth() { |
| | | //åå§åå¼¹åºæ¡çé«åº¦ä¸å®½åº¦ |
| | | let clientHeight = document.documentElement.clientHeight; |
| | | //å¼¹åºæ¡é«åº¦è³å°250px |
| | | clientHeight = clientHeight < 250 ? 250 : clientHeight; |
| | | let clientWidth = document.documentElement.clientWidth; |
| | | if ( |
| | | this.editFormOptions.some((x) => { |
| | | return x.some((item) => { |
| | | return item.type == 'editor'; |
| | | }); |
| | | }) |
| | | ) { |
| | | this.editor.uploadImgUrl = this.getUrl('upload'); |
| | | this.boxOptions.height = clientHeight * 0.8; |
| | | this.boxOptions.width = clientWidth * 0.8; |
| | | } else { |
| | | if (this.boxOptions.height) { |
| | | //妿é«åº¦ä¸å®½åº¦è¶
è¿äºè·åå°çå¯è§é«å®½åº¦ï¼å设为é»è®¤ç90%é«å®½ |
| | | if (this.boxOptions.height > clientHeight * 0.8) { |
| | | this.boxOptions.height = clientHeight * 0.8; |
| | | } |
| | | } |
| | | if (this.boxOptions.width) { |
| | | //妿é«åº¦ä¸å®½åº¦è¶
è¿äºè·åå°çå¯è§é«å®½åº¦ï¼å设为é»è®¤ç90%é«å®½ |
| | | if (this.boxOptions.width > clientWidth * 0.8) { |
| | | this.boxOptions.width = clientWidth * 0.8; |
| | | } |
| | | } |
| | | } |
| | | //è®¡ç®æ´ä¸ªtableçå®½åº¦ï¼æ ¹æ®å®½åº¦å³å®æ¯å¦å¯ç¨ç¬¬ä¸è¡æ¾ç¤ºçå为åºå®å |
| | | let maxTableWidth = clientWidth - 270; |
| | | this.setFiexdColumn(this.columns, maxTableWidth); |
| | | |
| | | this.height = this.tableHeight || clientHeight - 206; |
| | | this.url = this.getUrl(this.const.PAGE); |
| | | //计ç®å¼¹åºæ¡çé«ä¸å®½åº¦ |
| | | //妿ææç»è¡¨ï¼é«åº¦ä¸å®½å¸¦è®¾ç½®ä¸º0.9/0.82 |
| | | if (this.detail.columns && this.detail.columns.length > 0) { |
| | | this.hasDetail = true; |
| | | clientWidth = clientWidth * 0.8; |
| | | clientHeight = clientHeight * 0.85; |
| | | if (!this.detailOptions.height) { |
| | | this.detailOptions.height = |
| | | clientHeight - this.editFormOptions.length * 36 - 234; |
| | | this.detailOptions.height = |
| | | this.detailOptions.height < 240 ? 240 : this.detailOptions.height; |
| | | } |
| | | |
| | | this.detailOptions.columns = this.detail.columns; |
| | | this.detailOptions.pagination.sortName = this.detail.sortName; |
| | | this.detailOptions.cnName = this.detail.cnName; |
| | | this.detailOptions.key = this.detail.key; |
| | | this.detailOptions.url = this.getUrl('getDetailPage'); |
| | | //计ç®å¼¹åºæ¡æ´ä¸ªtableçå®½åº¦ï¼æ ¹æ®å®½åº¦å³å®æ¯å¦å¯ç¨ç¬¬ä¸è¡æ¾ç¤ºçå为åºå®å |
| | | this.setFiexdColumn(this.detail.columns, clientWidth); |
| | | } else { |
| | | let maxColumns = 1; //æå¤§åæ°ï¼æ ¹æ®å计ç®å¼¹æ¡ç宽度 |
| | | this.editFormOptions.forEach((x) => { |
| | | if (x.length > maxColumns) maxColumns = x.length; |
| | | }); |
| | | let maxHeightRate = 0.7, |
| | | maxWidthRate = 0.5; |
| | | maxWidthRate = maxColumns / 10 + 0.3; |
| | | maxHeightRate = (this.editFormOptions.length || 1) * 0.1 + 0.03; |
| | | maxHeightRate = maxHeightRate > 0.9 ? 0.9 : maxHeightRate; |
| | | clientWidth = clientWidth * maxWidthRate; |
| | | clientHeight = clientHeight * maxHeightRate; |
| | | // this.boxOptions.width = clientWidth * maxWidthRate; |
| | | // this.boxOptions.height = clientHeight * maxHeightRate; |
| | | } |
| | | if (!this.boxOptions.height) { |
| | | this.boxOptions.height = clientHeight + 10; |
| | | } |
| | | if (!this.boxOptions.width) { |
| | | this.boxOptions.width = clientWidth + 30; |
| | | } |
| | | }, |
| | | rowOnChange(row) { |
| | | this.rowChange(row); |
| | | }, |
| | | rowChange(row) { |
| | | //éä¸è¡checkboxè¡äºä»¶ |
| | | }, |
| | | rowOnClick({ row, column, event }) { |
| | | this.rowClick({ row, column, event }); |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | // ç¹å»è¡äºä»¶(2020.11.07) |
| | | }, |
| | | rowOnDbClick({ row, column, event }) { |
| | | this.rowDbClick({ row, column, event }); |
| | | }, |
| | | rowDbClick({ row, column, event }) { |
| | | // åå»å»è¡äºä»¶(2021.05.23) |
| | | }, |
| | | $error(message) { |
| | | this.$message.error(message); |
| | | // this.$message({ |
| | | // type: 'error', |
| | | // content: message, |
| | | // duration: 5 |
| | | // }); |
| | | }, |
| | | $success(message) { |
| | | this.$message.success(message); |
| | | }, |
| | | setFiexdSearchForm(visiable) { |
| | | //2020.09.011å¢å åºå®æ¥è¯¢è¡¨ååè½,visiable=trueé»è®¤å°æ¥è¯¢è¡¨åå±å¼ |
| | | this.fiexdSearchForm = true; |
| | | let refreshBtn = this.buttons.find((x) => x.name == 'å· æ°'); |
| | | if (visiable) { |
| | | this.searchBoxShow = true; |
| | | } |
| | | if (refreshBtn) { |
| | | refreshBtn.name = 'é ç½®'; |
| | | refreshBtn.onClick = function () { |
| | | this.resetSearch(); |
| | | }; |
| | | } |
| | | }, |
| | | tableBeginEdit(row, column, index) { |
| | | //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ç»ææ¹æ³,è¿åfalseä¸ä¼ç»æç¼è¾ |
| | | return this.beginEdit(row, column, index); |
| | | }, |
| | | beginEdit(row, column, index) { |
| | | //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ç»ææ¹æ³,è¿åfalseä¸ä¼ç»æç¼è¾ |
| | | return true; |
| | | }, |
| | | tableEndEditBefore(row, column, index) { |
| | | return this.endEditBefore(row, column, index); |
| | | }, |
| | | endEditBefore(row, column, index) { |
| | | //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ç»ææ¹æ³,è¿åfalseä¸ä¼ç»æç¼è¾ |
| | | return true; |
| | | }, |
| | | filterPermission(tableName, permission) { |
| | | //2021.03.19夿æ¯å¦ææä¸ªè¡¨çæé®æé |
| | | //:["Search","Add","Delete","Update","Import","Export","Upload","Audit"] |
| | | const _result = (this.$store.state.permission || []).find((x) => { |
| | | return x.url == '/' + tableName; |
| | | }); |
| | | return _result && _result.permission.some((x) => x == permission); |
| | | }, |
| | | destroyed() { |
| | | //2021.04.11å¢å vue页é¢éæ¯æ¹æ³,è·¯ç±å¿
须设置keepLive:falseï¼è®¾ç½®æ¹æ³è§ï¼å端å¼åææ¡£-ã[ç¦ç¨é¡µé¢ç¼åkeepAlive] |
| | | }, |
| | | loadTreeTableChildren(tree, treeNode, resolve) { |
| | | this.loadTreeChildren.call(this, tree, treeNode, resolve); |
| | | }, |
| | | loadTreeChildren(tree, treeNode, resolve) { |
| | | //æ å½¢ç»æå è½½åèç¹(2021.05.02),å¨onInitä¸è®¾ç½®äºrowKey主é®å段åæä¼çæ |
| | | return resolve([]); |
| | | }, |
| | | importDetailAfter(data) { |
| | | //2022.01.08å¢å æç»è¡¨å¯¼å
¥åå¤ç |
| | | }, |
| | | importExcelAfter(data) { |
| | | //2022.01.08å¢å æç»è¡¨å¯¼å
¥åæ¹æ³å¤æ |
| | | |
| | | if (!data.status) { |
| | | return; // this.$message.error(data.message); |
| | | } |
| | | //æç»è¡¨å¯¼å
¥ |
| | | if (this.boxModel) { |
| | | if (data.data) { |
| | | data.data = JSON.parse(data.data); |
| | | } else { |
| | | data.data = []; |
| | | } |
| | | data.data.forEach((x) => { |
| | | x[this.detail.key] = undefined; |
| | | x[this.table.key] = undefined; |
| | | }); |
| | | this.importDetailAfter(data); //å¢å æç»è¡¨å¯¼å
¥åå¤ç |
| | | this.$refs.detail.rowData.unshift(...data.data); |
| | | this.upload.excel = false; |
| | | return; |
| | | } |
| | | this.importAfter(data); |
| | | }, |
| | | onGridModelClose(iconClick) { |
| | | if (this.isBoxAudit) { |
| | | this.initFormOptionType(false); |
| | | } |
| | | this.isBoxAudit = false; |
| | | this.onModelClose(iconClick); |
| | | }, |
| | | initAuditColumn() { |
| | | |
| | | }, |
| | | getWorkFlowSteps(row) { |
| | | let table = this.table.url.replaceAll('/', ''); |
| | | let url = `api/Sys_WorkFlow/getSteps?tableName=${table}&id=${row[this.table.key] |
| | | }`; |
| | | this.http.get(url, {}, true).then((result) => { |
| | | this.workFlowSteps.splice(0); |
| | | //æå¯è½æ²¡æé
ç½®å®¡æ¹æµç¨ |
| | | if (!result.list || !result.list.length) { |
| | | result.list = []; |
| | | this.auditParam.showAction = true; |
| | | this.auditParam.height = 240; |
| | | this.auditParam.showViewButton = row.AuditStatus == 0; |
| | | } else { |
| | | this.auditParam.showAction = result.list.some((c) => { |
| | | return c.isCurrentUser; |
| | | }); |
| | | this.auditParam.height = 511; |
| | | this.auditParam.showViewButton = true; |
| | | } |
| | | this.auditParam.reason = ''; |
| | | this.auditParam.status = -1; |
| | | this.auditParam.value = -1; |
| | | if (result.his) { |
| | | result.his.forEach((item) => { |
| | | item.auditStatus = this.getAuditStatus(item.auditStatus); |
| | | }); |
| | | } |
| | | |
| | | this.auditParam.auditHis = result.his; |
| | | this.workFlowSteps.push(...result.list); |
| | | this.isBoxAudit = true; |
| | | this.initFormOptionType(true); |
| | | this.edit(row); |
| | | this.boxOptions.title = 'å®¡æ ¸'; |
| | | }); |
| | | }, |
| | | initFormOptionType(isReadonly) { |
| | | this.editFormOptions.forEach((options) => { |
| | | options.forEach((option) => { |
| | | if (isReadonly) { |
| | | if (!option.readonly) { |
| | | this.formFieldsType.push(option.field); |
| | | option.readonly = true; |
| | | } |
| | | } else { |
| | | if (this.formFieldsType.indexOf(option.field) != -1) { |
| | | option.readonly = false; |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | getAuditStatus(status) { |
| | | let data = this.auditParam.data.find((x) => { |
| | | return x.value == status; |
| | | }); |
| | | if (!data) { |
| | | return '-'; |
| | | // return `å®¡æ ¸å¼ä¸æ£ç¡®:${status}` |
| | | } |
| | | return data.text; |
| | | }, |
| | | initFlowQuery() { |
| | | if (this.$route.query.viewflow) { |
| | | this.$refs.table && this.search(); |
| | | } |
| | | }, |
| | | fullscreen(full) { //å¼¹åºæ¡å
¨å±æ¹æ³ |
| | | |
| | | } |
| | | }; |
| | | import customColumns from './ViewGridCustomColumn.js'; |
| | | //åå¹¶æ©å±æ¹æ³ |
| | | methods = Object.assign(methods, detailMethods, serviceFilter, customColumns); |
| | | export default methods; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | let props = { |
| | | columns: {//å½å表çé
ç½®ä¿¡æ¯ |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | } |
| | | }, |
| | | detail: {//ä»è¡¨æç»é
ç½® |
| | | type: Object, |
| | | default: () => { |
| | | return { |
| | | columns: [],//ä»è¡¨å |
| | | sortName: ""//ä»è¡¨æåºå段 |
| | | }; |
| | | } |
| | | }, |
| | | editFormFields: {//æ°å»ºãç¼è¾å段(key/value) |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | } |
| | | }, |
| | | editFormOptions: {//æ°å»ºãç¼è¾é
ç½®ä¿¡æ¯ |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | } |
| | | }, |
| | | searchFormFields: {//æ¥è¯¢å段(key/value) |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | } |
| | | }, |
| | | searchFormOptions: {//æ¥è¯¢é
置信æ¯(key/value) |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | } |
| | | }, |
| | | table: {//表çé
置信æ¯ï¼ä¸»é®ãæåºç |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | } |
| | | }, |
| | | extend: {//è¡¨çæ©å±æ¹æ³ä¸ç»ä»¶é½åå¹¶å°æ¤å±æ§ä¸ |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | } |
| | | } |
| | | } |
| | | |
| | | export default props; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | |
| | | let serviceFilter = { |
| | | onInit () { //对åºcreated |
| | | console.log('Createæ§è¡å') |
| | | }, |
| | | onInited () { //对åºcreatedï¼å¨onInitä¸onInitedä¸é´ä¼åå§åç颿°æ®å¯¹è±¡ |
| | | console.log('Createæ§è¡å') |
| | | }, |
| | | mounted () { |
| | | console.log('mounted'); |
| | | }, |
| | | searchBefore (param) { //æ¥è¯¢ViewGirdè¡¨æ°æ®å,paramæ¥è¯¢åæ° |
| | | // console.log('表' + this.table.cnName + '触åloadTableBefore'); |
| | | return true; |
| | | }, |
| | | //2020.10.30å¢å æ¥è¯¢åè¿åææçæ¥è¯¢ä¿¡æ¯ |
| | | searchAfter (param, result) { //æ¥è¯¢ViewGirdè¡¨æ°æ®åparamæ¥è¯¢åæ°,resultåè¿æ¥è¯¢çç»æ |
| | | // console.log('表' + this.table.cnName + '触åloadTableAfter'); |
| | | return true; |
| | | }, |
| | | searchDetailBefore (param) {//æ¥è¯¢ä»è¡¨è¡¨æ°æ®å,paramæ¥è¯¢åæ° |
| | | //console.log(this.detailOptions.cnName + '触åloadDetailTableBefore'); |
| | | return true; |
| | | }, |
| | | searchDetailAfter (param, data) {//æ¥è¯¢ä»è¡¨åparamæ¥è¯¢åæ°,resultåè¿æ¥è¯¢çç»æ |
| | | // console.log(this.detailOptions.cnName + '触åloadDetailTableAfter'); |
| | | return true; |
| | | }, |
| | | delBefore (ids, rows) { //æ¥è¯¢çé¢ç表å é¤å ids为å é¤çidæ°ç»,,rowså é¤çè¡ |
| | | return true; |
| | | }, |
| | | delAfter (result) {//æ¥è¯¢çé¢ç表å é¤å |
| | | return true; |
| | | }, |
| | | delDetailRow (rows) { //å¼¹åºæ¡å 餿ç»è¡¨çè¡æ°æ®(åªæ¯å¯¹tableæä½ï¼å¹¶æ²¡ææä½åå°) |
| | | return true; |
| | | }, |
| | | addBefore (formData) { //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ |
| | | return true; |
| | | }, |
| | | async addBeforeAsync (formData) { //弿¥å¤ç,åè½åä¸(2020.12.06) |
| | | return true; |
| | | }, |
| | | addAfter (result) {//æ°å»ºä¿ååresultè¿åçç¶æå表å对象 |
| | | return true; |
| | | }, |
| | | updateBefore (formData) { //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | async updateBeforeAsync (formData) { //弿¥å¤ç,åè½åä¸(2020.12.06) |
| | | return true; |
| | | }, |
| | | updateAfter (result) {//ç¼è¾ä¿ååresultè¿åçç¶æå表å对象 |
| | | return true; |
| | | }, |
| | | auditBefore (ids, rows) {//å®¡æ ¸å |
| | | return true; |
| | | }, |
| | | auditAfter (result, rows) {// å®¡æ ¸å |
| | | return true; |
| | | }, |
| | | resetAddFormBefore () { //éç½®æ°å»ºè¡¨ååçå
容 |
| | | return true; |
| | | }, |
| | | resetAddFormAfter () { //éç½®æ°å»ºè¡¨ååçå
容 |
| | | return true; |
| | | }, |
| | | resetUpdateFormBefore () { //éç½®ç¼è¾è¡¨ååçå
容 |
| | | return true; |
| | | }, |
| | | resetUpdateFormAfter () { //éç½®ç¼è¾è¡¨ååçå
容 |
| | | return true; |
| | | }, |
| | | modelOpenBefore (row) { //ç¹å»ç¼è¾/æ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | |
| | | }, |
| | | modelOpenAfter (row) { //ç¹å»ç¼è¾/æ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | |
| | | }, |
| | | importAfter (data) { //导å
¥excelåå·æ°tableè¡¨æ ¼æ°æ® |
| | | this.search(); |
| | | }, |
| | | //2020.10.31æ·»å 导å
¥åçæ¹æ³ |
| | | importExcelBefore (formData) { //导å
¥excel导å
¥å |
| | | //å¾formDataåä¸äºå
¶ä»åæ°æäº¤å°åå°ï¼ |
| | | // formData.append("val2", "xxx"); |
| | | //åå°æä¸é¢æ¹æ³è·å请æ±çåæ° |
| | | // Core.Utilities.HttpContext.Current.Request("val2"); |
| | | return true; |
| | | }, |
| | | reloadDicSource () { //éæ°å è½½åå
¸ç»å®çæ°æ®æº |
| | | this.initDicKeys(); |
| | | }, |
| | | exportBefore (param) { //2020.06.25å¢å 导åºåå¤ç |
| | | return true; |
| | | }, |
| | | onModelClose(iconClick){ |
| | | //iconClick=true为ç¹å»å·¦ä¸ä¸è§X触åçå
³éäºä»¶ |
| | | //妿è¿å falseä¸ä¼å
³éå¼¹åºæ¡ |
| | | //return false; |
| | | this.boxModel=false; |
| | | }, |
| | | selectable(row, index){ |
| | | //表CheckBox æ¯å¦å¯ä»¥å¾é |
| | | return true; |
| | | } |
| | | } |
| | | export default serviceFilter; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="vol-dialog"> |
| | | |
| | | <el-dialog v-model="vmodel" :close-on-click-modal="false" :close-on-press-escape="false" :width="width" |
| | | :fullscreen="fullscreen" :draggable="draggable" :modal="modal" :before-close="handleClose"> |
| | | <template #header> |
| | | <i :class="icon"></i> {{ title }} |
| | | <button class="el-dialog__headerbtn" type="button" style="right: 35px; color: var(--el-color-info)" @click="handleFullScreen"> |
| | | <i class="el-icon el-icon-full-screen"></i> |
| | | </button> |
| | | </template> |
| | | <el-scrollbar :max-height="contentHeight"> |
| | | <div v-if="inited" style="min-height: 50px;" class="srcoll-content" :style="{ padding: padding + 'px' }"> |
| | | <slot name="content"></slot> |
| | | <slot></slot> |
| | | </div> |
| | | </el-scrollbar> |
| | | <template #footer> |
| | | <div class="dia-footer" v-if="footer"> |
| | | <slot name="footer"></slot> |
| | | <el-button type="primary" v-if="!footer" size="mini" @click="handleClose()"><i |
| | | class="el-icon-close"></i>å
³é</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { defineComponent, ref, watch, watchEffect } from 'vue'; |
| | | |
| | | export default defineComponent({ |
| | | props: { |
| | | modelValue: false, |
| | | lazy: { |
| | | //æ¯å¦å¼å¯æå è½½2020.12.06 |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | icon: { |
| | | type: String, |
| | | default: "el-icon-warning-outline", |
| | | }, |
| | | title: { |
| | | type: String, |
| | | default: "åºæ¬ä¿¡æ¯", |
| | | }, |
| | | height: { |
| | | type: Number, |
| | | default: 200, |
| | | }, |
| | | width: { |
| | | type: Number, |
| | | default: 650, |
| | | }, |
| | | padding: { |
| | | type: Number, |
| | | default: 16, |
| | | }, |
| | | modal: { |
| | | //æ¯å¦éè¦é®ç½©å± |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | draggable: { |
| | | //å¯ç¨å¯ææ½åè½ |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | mask: { |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | onModelClose: { |
| | | //2021.07.11å¢å å¼¹åºæ¡å
³éäºä»¶ |
| | | type: Function, |
| | | default: (iconClick) => { |
| | | return true; |
| | | } |
| | | }, |
| | | footer:{ //æ¯å¦æ¾ç¤ºåºé¨æé® |
| | | type: Boolean, |
| | | default: true |
| | | } |
| | | |
| | | }, |
| | | setup(props, context) { |
| | | const clientHeight = document.body.clientHeight * 0.95 - 60; |
| | | const inited = ref(true); |
| | | const vmodel = ref(false); |
| | | const footer = ref(false); |
| | | const top = ref(100); |
| | | vmodel.value = props.modelValue; |
| | | footer.value = !!context.slots.footer; |
| | | const contentHeight = ref(200); |
| | | contentHeight.value = props.height; |
| | | const handleClose = (done, iconClose) => { |
| | | let result = props.onModelClose(!!iconClose); |
| | | if (result === false) return; |
| | | vmodel.value = false; |
| | | context.emit("update:modelValue", false); |
| | | done && done(); |
| | | }; |
| | | const calcHeight = (val) => { |
| | | // if (props.height > clientHeight) { |
| | | // if(true){ |
| | | contentHeight.value = clientHeight - 30; |
| | | return clientHeight / -2 + 'px'; |
| | | // } |
| | | // contentHeight.value = val || props.height; |
| | | // return (props.height + 56) / -2 + 'px'; |
| | | }; |
| | | top.value = calcHeight(); |
| | | watch( |
| | | () => props.modelValue, |
| | | (newVal, oldVal) => { |
| | | vmodel.value = newVal; |
| | | } |
| | | ); |
| | | watch( |
| | | () => props.height, |
| | | (newVal, oldVal) => { |
| | | top.value = calcHeight(); |
| | | } |
| | | ); |
| | | const fullscreen=ref(false); |
| | | const handleFullScreen=()=> { |
| | | fullscreen.value = !fullscreen.value; |
| | | context.emit("fullscreen", fullscreen.value); |
| | | } |
| | | return { |
| | | handleClose, |
| | | inited, |
| | | vmodel, |
| | | footer, |
| | | top, |
| | | calcHeight, |
| | | contentHeight, |
| | | fullscreen, |
| | | handleFullScreen |
| | | }; |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .dia-footer { |
| | | text-align: right; |
| | | width: 100%; |
| | | border-top: 1px solid #e2e2e2; |
| | | text-align: right; |
| | | padding: 6px 8px; |
| | | } |
| | | </style> |
| | | |
| | | <style scoped lang="less"> |
| | | .vol-dialog ::v-deep(.el-overlay-dialog) { |
| | | display: flex !important; |
| | | } |
| | | |
| | | .vol-dialog ::v-deep(.el-dialog) { |
| | | margin: auto; |
| | | } |
| | | |
| | | .vol-dialog ::v-deep(.el-dialog) { |
| | | border-top-left-radius: 4px; |
| | | border-top-right-radius: 4px; |
| | | } |
| | | |
| | | .vol-dialog ::v-deep(.el-dialog__header) { |
| | | border-top-left-radius: 4px; |
| | | border-top-right-radius: 4px; |
| | | padding: 0px 13px; |
| | | line-height: 53px; |
| | | border-bottom: 1px solid #e6e6e6; |
| | | height: 50px; |
| | | color: rgb(79, 79, 79); |
| | | font-weight: bold; |
| | | font-size: 14px; |
| | | margin: 0; |
| | | // background-image: linear-gradient(135deg, #0cd7bd 10%, #50c3f7); |
| | | } |
| | | |
| | | .vol-dialog ::v-deep(.el-dialog__footer), |
| | | .vol-dialog ::v-deep(.el-dialog__body) { |
| | | padding: 0; |
| | | } |
| | | |
| | | .vol-dialog ::v-deep(.el-dialog__headerbtn) { |
| | | top: 0; |
| | | padding-top: 8px; |
| | | height: 50px; |
| | | width: 0; |
| | | padding-right: 30px; |
| | | padding-left: 5px; |
| | | } |
| | | // .vol-dialog ::v-deep(.el-dialog__headerbtn .el-dialog__close) { |
| | | // color: #fff; |
| | | // } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="vol-el-menu"> |
| | | <el-menu |
| | | close="vol-el-menu--vertical" |
| | | :default-openeds="openedIds" |
| | | :default-active="defaultActive" |
| | | :unique-opened="true" |
| | | @select="select" |
| | | :collapse="isCollapse" |
| | | @open="handleOpen" |
| | | @close="handleClose" |
| | | @contextmenu.prevent="bindRightClickMenu" |
| | | > |
| | | <template v-for="item in convertTree(list)"> |
| | | <el-sub-menu |
| | | :key="item.id" |
| | | :index="'' + item.id" |
| | | v-if="item.children.length && (!enable || item.enable == 1)" |
| | | > |
| | | <template #title> |
| | | <i class="menu-icon" :class="item.icon"></i> |
| | | <span> {{ item.name }}</span> |
| | | </template> |
| | | <vol-element-menu-child |
| | | :enable="enable" |
| | | :list="item.children" |
| | | ></vol-element-menu-child> |
| | | </el-sub-menu> |
| | | <template v-else> |
| | | <el-menu-item |
| | | class="menu-item-lv1" |
| | | v-if="!enable || item.enable == 1" |
| | | :key="item.id" |
| | | :index="'' + item.id" |
| | | > |
| | | <i :class="item.icon"></i> |
| | | <span> {{ item.name }}</span> |
| | | </el-menu-item> |
| | | </template> |
| | | </template> |
| | | </el-menu> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolElementMenuChild from './VolElementMenuChild'; |
| | | import { useRouter } from 'vue-router'; |
| | | |
| | | import { |
| | | defineComponent, |
| | | reactive, |
| | | watch, |
| | | ref, |
| | | toRef, |
| | | toRefs, |
| | | getCurrentInstance |
| | | // onMounted, |
| | | } from 'vue'; |
| | | export default defineComponent({ |
| | | components: { |
| | | 'vol-element-menu-child': VolElementMenuChild |
| | | }, |
| | | props: { |
| | | enable: { |
| | | type: Boolean, |
| | | default: false //æ¯å¦å¤æenable=1 |
| | | }, |
| | | isCollapse: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | onSelect: { |
| | | type: Function, |
| | | default: (x) => {} |
| | | }, |
| | | openSelect: { |
| | | //æå¼çæ¶åæ¯å¦è§¦åéä¸äºä»¶ |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | list: { |
| | | type: Array, |
| | | default: [] |
| | | }, |
| | | rootId: { |
| | | type: String, |
| | | default: '0' |
| | | }, |
| | | currentMenuId: { |
| | | type: Number, |
| | | default: 0 |
| | | } |
| | | }, |
| | | setup(props) { |
| | | // const { list } = toRefs(props); |
| | | // const treeList = ref([]); |
| | | const getTree = (id, node, data) => { |
| | | if (!node.children) { |
| | | node.children = []; |
| | | } |
| | | data.forEach((x) => { |
| | | if (x.parentId == id && !node.children.some((c) => c.id === x.id)) { |
| | | node.children.push(x); |
| | | getTree(x.id, x, data); |
| | | } |
| | | }); |
| | | }; |
| | | let rootTreeId = !isNaN(props.rootId) ? ~~props.rootId : props.rootId; |
| | | props.list.forEach((x) => { |
| | | if (!x.icon || x.icon.substring(0, 3) != 'el-') { |
| | | x.icon = 'el-icon-menu'; |
| | | } |
| | | x.children = []; |
| | | x.isRoot = x.parentId === rootTreeId; |
| | | }); |
| | | const convertTree = (data) => { |
| | | var root_data = []; |
| | | data.forEach((x) => { |
| | | if (x.parentId === rootTreeId) { |
| | | if (!x.hasOwnProperty('enable')) x.enable = 1; |
| | | root_data.push(x); |
| | | getTree(x.id, x, data); |
| | | } |
| | | }); |
| | | return root_data; |
| | | }; |
| | | const openedIds = reactive([props.currentMenuId]); |
| | | const defaultActive = ref(props.currentMenuId + ''); |
| | | let _base = getCurrentInstance().appContext.config.globalProperties.base; |
| | | watch( |
| | | () => props.currentMenuId, |
| | | (newVal, oldVal) => { |
| | | defaultActive.value = newVal + ''; |
| | | openedIds.splice(0); |
| | | openedIds.push( |
| | | ..._base.getTreeAllParent(newVal, props.list).map((c) => { |
| | | return c.id; |
| | | }) |
| | | ); |
| | | } |
| | | ); |
| | | const router = useRouter(); |
| | | let eventSelect = false; |
| | | const select = (index, path) => { |
| | | if (eventSelect) { |
| | | return; |
| | | } |
| | | eventSelect = true; |
| | | setTimeout(() => { |
| | | eventSelect = false; |
| | | }, 20); |
| | | |
| | | let _item = props.list.find((x) => { |
| | | return x.id == index; |
| | | }); |
| | | props.onSelect(index, _item); |
| | | router.push({ path: _item.path || '' }); |
| | | }; |
| | | |
| | | const handleOpen = (index, path) => { |
| | | if (props.openSelect) { |
| | | select(index, path); |
| | | } |
| | | }; |
| | | const handleClose = () => {}; |
| | | |
| | | /** |
| | | * èå导èªå³é®äºä»¶ |
| | | * @param {*} enable æ¯å¦å¯ç¨å³é®äºä»¶[true:å¯ç¨;false:ç¦ç¨;] |
| | | */ |
| | | const bindRightClickMenu = (enable) => { |
| | | if (!enable) return; |
| | | }; |
| | | |
| | | return { |
| | | // treeList, |
| | | // list, |
| | | select, |
| | | convertTree, |
| | | handleOpen, |
| | | handleClose, |
| | | bindRightClickMenu, |
| | | openedIds, |
| | | defaultActive |
| | | }; |
| | | } |
| | | }); |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .vol-el-menu { |
| | | box-sizing: content-box; |
| | | width: 100%; |
| | | .menu-icon { |
| | | font-size: 18px; |
| | | margin-right: 6px; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="vol-el-menu-item"> |
| | | <template v-for="(item) in list"> |
| | | <template v-if="item.children&&item.children.length"> |
| | | <el-menu-item :key="item.id" |
| | | :index="'' + item.id" |
| | | v-if="!item.children.length && (!enable || item.enable == 1)"> |
| | | <template #title></template> |
| | | <span> {{ item.name }}</span> |
| | | </el-menu-item> |
| | | <el-sub-menu :key="item.id" |
| | | :index="'' + item.id" |
| | | v-if="item.children.length && (!enable || item.enable == 1)"> |
| | | <template #title> |
| | | <span> {{ item.name }}</span> |
| | | </template> |
| | | <vol-element-menu-child :enable="enable" :list="item.children" /> |
| | | </el-sub-menu> |
| | | </template> |
| | | <template v-else> |
| | | <el-menu-item :key="item.id" |
| | | :index="'' + item.id" |
| | | v-if="(!enable || item.enable == 1)"> |
| | | <template #title></template> |
| | | <span> {{item.name }}</span> |
| | | </el-menu-item> |
| | | </template> |
| | | </template> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: "vol-element-menu-child", |
| | | props: { |
| | | list: { |
| | | type: Array, |
| | | default: [], |
| | | }, |
| | | enable: { |
| | | type: Boolean, |
| | | default: false, //æ¯å¦å¤æenable=1 |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |
| | | .vol-el-menu-item ::v-deep(.el-menu-item) { |
| | | height: 42px !important; |
| | | line-height: 42px !important; |
| | | } |
| | | </style> |
| | | |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-form |
| | | style="display: inline-block; width: 100%" |
| | | :inline="true" |
| | | ref="volform" |
| | | @submit.prevent |
| | | :model="formFields" |
| | | :label-width="labelWidth" |
| | | :rules="rules" |
| | | > |
| | | <template v-for="(row, findex) in formRules" :key="findex"> |
| | | <div class="vol-form-item"> |
| | | <el-form-item |
| | | :label="item.title ? item.title + 'ï¼' : ''" |
| | | v-show="!item.hidden" |
| | | v-for="(item, index) in row" |
| | | :prop="item.field" |
| | | :key="item.field + index" |
| | | :style="{ width: getColWidth(item) + '%' }" |
| | | > |
| | | <!-- render --> |
| | | <form-expand |
| | | v-if="item.render && typeof item.render == 'function'" |
| | | :render="item.render" |
| | | :par="12" |
| | | ></form-expand> |
| | | <!-- 2021.10.17å¢å 表å宿¶æ¹æ³è®¡ç® --> |
| | | <span |
| | | v-else-if=" |
| | | item.readonly && typeof formFields[item.field] == 'function' |
| | | " |
| | | >{{ formFields[item.field]() }}</span |
| | | > |
| | | <!-- åªè¯»å¾çææä»¶ --> |
| | | <div v-else-if="isReadonlyImgFile(item, formFields)"> |
| | | <div v-if="item.type == 'img'" class="form-imgs"> |
| | | <div |
| | | class="img-item" |
| | | v-for="(img, imgIndex) in formFields[item.field]" |
| | | :key="imgIndex" |
| | | > |
| | | <img |
| | | :src="getSrc(img.path)" |
| | | :onerror="errorImg" |
| | | @click="previewImg(img.path)" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <div |
| | | v-else |
| | | class="form-file-list" |
| | | v-for="(file, fileIndex) in formFields[item.field]" |
| | | :key="fileIndex" |
| | | > |
| | | <a @click="dowloadFile(formFields[item.field][fileIndex])">{{ |
| | | file.name |
| | | }}</a> |
| | | </div> |
| | | </div> |
| | | |
| | | <div v-else :class="{ 'form-item-extra': item.extra }"> |
| | | <!-- åªè¯»å±æ§ --> |
| | | <label |
| | | :style="item.inputStyle" |
| | | v-if="item.type == 'label'" |
| | | class="readonly-input" |
| | | >{{ getText(formFields, item) }}</label |
| | | > |
| | | <!-- 20223.05.13éæel-tree-select --> |
| | | <!-- :filter-method="(value)=>{filterMethod(value,item.data)}" --> |
| | | <!-- :filterable="true" --> |
| | | <el-tree-select |
| | | style="width: 100%" |
| | | v-else-if="item.type == 'treeSelect'" |
| | | v-model="formFields[item.field]" |
| | | :data="item.data" |
| | | :multiple="item.multiple" |
| | | :render-after-expand="false" |
| | | :show-checkbox="false" |
| | | :check-strictly="true" |
| | | check-on-click-node |
| | | node-key="key" |
| | | :props="{ label: 'label' }" |
| | | > |
| | | <template #default="{data,node }"> |
| | | <!-- <el-checkbox v-model="node.checked"></el-checkbox> --> |
| | | <!-- {{getNode(node, data)}} --> |
| | | <!-- {{node.checked}} --> |
| | | <!-- è¿éè¿æç¹é®é¢ï¼åé¢å¤ç --> |
| | | {{ data.label}}</template |
| | | > |
| | | </el-tree-select> |
| | | <template |
| | | v-else-if="['select', 'selectList'].indexOf(item.type) != -1" |
| | | > |
| | | <el-select-v2 |
| | | :disabled="item.readonly || item.disabled" |
| | | v-show="!item.hidden" |
| | | style="width: 100%" |
| | | :size="size" |
| | | v-if="item.data.length > select2Count" |
| | | v-model="formFields[item.field]" |
| | | filterable |
| | | :multiple="item.type == 'select' ? false : true" |
| | | :placeholder="item.placeholder ? item.placeholder : item.title" |
| | | :allow-create="item.autocomplete" |
| | | :options="item.data" |
| | | @change=" |
| | | (val) => { |
| | | item.onChange(val, item.data); |
| | | } |
| | | " |
| | | clearable |
| | | > |
| | | <template #default="{ item }"> |
| | | {{ item.label }} |
| | | </template> |
| | | </el-select-v2> |
| | | <el-select |
| | | :disabled="item.readonly || item.disabled" |
| | | v-show="!item.hidden" |
| | | style="width: 100%" |
| | | :size="size" |
| | | v-else-if="item.remote || item.url" |
| | | v-model="formFields[item.field]" |
| | | filterable |
| | | :multiple="item.type == 'select' ? false : true" |
| | | :placeholder="item.placeholder ? item.placeholder : item.title" |
| | | clearable |
| | | :remote-method=" |
| | | (val) => { |
| | | remoteSearch(item, formFields, val); |
| | | } |
| | | " |
| | | > |
| | | <el-option |
| | | v-for="item in item.data" |
| | | :key="item.key" |
| | | :label="item.value" |
| | | :value="item.key" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <el-select |
| | | :disabled="item.readonly || item.disabled" |
| | | v-show="!item.hidden" |
| | | style="width: 100%" |
| | | :size="size" |
| | | v-else |
| | | v-model="formFields[item.field]" |
| | | filterable |
| | | :multiple="item.type == 'select' ? false : true" |
| | | :placeholder="item.placeholder ? item.placeholder : item.title" |
| | | :allow-create="item.autocomplete" |
| | | @change=" |
| | | (val) => { |
| | | item.onChange(val, item.data); |
| | | } |
| | | " |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-show="!item.hidden" |
| | | :disabled="item.disabled" |
| | | v-for="item in item.data" |
| | | :key="item.key" |
| | | :label="item.value" |
| | | :value="item.key" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </template> |
| | | |
| | | <el-switch |
| | | v-show="!item.hidden" |
| | | v-else-if="item.type == 'switch'" |
| | | v-model="formFields[item.field]" |
| | | :disabled="item.readonly || item.disabled" |
| | | active-color="#0f84ff" |
| | | @change="item.onChange" |
| | | inactive-color="rgb(194 194 194)" |
| | | :active-value=" |
| | | typeof formFields[item.field] == 'boolean' |
| | | ? true |
| | | : typeof formFields[item.field] == 'string' |
| | | ? '1' |
| | | : 1 |
| | | " |
| | | :inactive-value=" |
| | | typeof formFields[item.field] == 'boolean' |
| | | ? false |
| | | : typeof formFields[item.field] == 'string' |
| | | ? '0' |
| | | : 0 |
| | | " |
| | | > |
| | | </el-switch> |
| | | |
| | | <el-radio-group |
| | | :disabled="item.readonly || item.disabled" |
| | | v-show="!item.hidden" |
| | | v-model="formFields[item.field]" |
| | | v-else-if="item.type == 'radio'" |
| | | @change="item.onChange" |
| | | > |
| | | <el-radio |
| | | v-for="kv in item.data" |
| | | :disabled="item.readonly || item.disabled" |
| | | :key="kv.key" |
| | | :label="kv.key" |
| | | >{{ kv.value }}</el-radio |
| | | > |
| | | </el-radio-group> |
| | | |
| | | <el-checkbox-group |
| | | :disabled="item.readonly || item.disabled" |
| | | v-show="!item.hidden" |
| | | v-model="formFields[item.field]" |
| | | v-else-if="item.type == 'checkbox'" |
| | | @change="item.onChange" |
| | | > |
| | | <el-checkbox |
| | | v-for="kv in item.data" |
| | | :key="kv.key" |
| | | :disabled="item.readonly || item.disabled" |
| | | :label="kv.key" |
| | | >{{ kv.value }}</el-checkbox |
| | | > |
| | | </el-checkbox-group> |
| | | <div |
| | | class="v-date-range" |
| | | style="display: flex" |
| | | v-else-if=" |
| | | ['date', 'datetime'].indexOf(item.type) != -1 && item.range |
| | | " |
| | | > |
| | | <el-date-picker |
| | | :size="size" |
| | | :disabled="item.readonly || item.disabled" |
| | | style="flex: 1; width: auto" |
| | | v-model="formFields[item.field][0]" |
| | | :type="item.type == 'date' ? 'date' : 'datetime'" |
| | | :disabledDate="(val) => getDateOptions(val, item)" |
| | | placeholder="å¼å§æ¶é´" |
| | | @change=" |
| | | (val) => { |
| | | dateRangeChange(val, item); |
| | | } |
| | | " |
| | | :value-format="getDateFormat(item)" |
| | | > |
| | | </el-date-picker> |
| | | <span style="margin: 0px 5px; font-size: 13px; color: #6f6b6b" |
| | | >è³</span |
| | | > |
| | | <el-date-picker |
| | | :size="size" |
| | | :disabled="item.readonly || item.disabled" |
| | | style="flex: 1; width: auto" |
| | | v-model="formFields[item.field][1]" |
| | | placeholder="ç»ææ¶é´" |
| | | :type="item.type == 'date' ? 'date' : 'datetime'" |
| | | :disabledDate="(val) => getDateOptions(val, item)" |
| | | @change=" |
| | | (val) => { |
| | | dateRangeChange(val, item); |
| | | } |
| | | " |
| | | :value-format="getDateFormat(item)" |
| | | > |
| | | </el-date-picker> |
| | | </div> |
| | | <!-- v-show䏿·»å æ ¹èç¹å°±ä¼æ¥éæ²¡ææ ¹ç¹è --> |
| | | <div |
| | | v-show="!item.hidden" |
| | | style="width: 100%" |
| | | v-else-if="['date', 'datetime', 'month'].indexOf(item.type) != -1" |
| | | > |
| | | <el-date-picker |
| | | :size="size" |
| | | clearable |
| | | :disabled="item.readonly || item.disabled" |
| | | style="width: 100%" |
| | | v-model="formFields[item.field]" |
| | | @change="item.onChange" |
| | | :type="item.type" |
| | | :placeholder=" |
| | | item.placeholder ? item.placeholder : 'è¯·éæ©' + item.title |
| | | " |
| | | :disabledDate="(val) => getDateOptions(val, item)" |
| | | :value-format="getDateFormat(item)" |
| | | > |
| | | </el-date-picker> |
| | | </div> |
| | | |
| | | <el-time-picker |
| | | :size="size" |
| | | v-else-if="item.type == 'time'" |
| | | v-model="formFields[item.field]" |
| | | :disabled="item.readonly || item.disabled" |
| | | placeholder="è¯·éæ©æ¶é´" |
| | | :value-format="item.format || 'HH:mm:ss'" |
| | | :format="item.format" |
| | | style="width: 100%" |
| | | > |
| | | </el-time-picker> |
| | | |
| | | <el-scrollbar |
| | | style="border: 1px solid #c7d8db; border-radius: 5px" |
| | | :height="item.height || 150" |
| | | v-else-if=" |
| | | item.type == 'editor' && (item.readonly || item.disabled) |
| | | " |
| | | > |
| | | <div ref="editor" v-html="formFields[item.field]"></div> |
| | | </el-scrollbar> |
| | | |
| | | <vol-wang-editor |
| | | ref="editor" |
| | | v-else-if="item.type == 'editor'" |
| | | :url="item.url || editor.uploadImgUrl" |
| | | :upload="item.upload || editor.upload" |
| | | v-model="formFields[item.field]" |
| | | :height="item.height || 350" |
| | | ></vol-wang-editor> |
| | | |
| | | <vol-upload |
| | | v-show="!item.hidden" |
| | | v-else-if="isFile(item, formFields)" |
| | | :desc="item.desc" |
| | | :multiple="item.multiple" |
| | | :max-file="item.maxFile" |
| | | :max-size="item.maxSize" |
| | | :autoUpload="item.autoUpload" |
| | | :fileInfo="formFields[item.field]" |
| | | :url="item.url" |
| | | :img="item.type == 'img' || item.columnType == 'img'" |
| | | :excel="item.type == 'excel'" |
| | | :fileTypes="item.fileTypes ? item.fileTypes : []" |
| | | :upload-before="item.uploadBefore" |
| | | :upload-after="item.uploadAfter" |
| | | :append="item.multiple" |
| | | :on-change=" |
| | | (files) => { |
| | | return fileOnChange(files, item); |
| | | } |
| | | " |
| | | :file-click="item.fileClick" |
| | | :remove-before="item.removeBefore" |
| | | :downLoad="item.downLoad ? true : false" |
| | | ></vol-upload> |
| | | <el-cascader |
| | | :size="size" |
| | | clearable |
| | | style="width: 100%; margin-top: -3px" |
| | | v-model="formFields[item.field]" |
| | | :disabled="item.readonly || item.disabled" |
| | | v-else-if="item.type == 'cascader'" |
| | | :options="item.data" |
| | | :props="{ |
| | | checkStrictly: item.changeOnSelect || item.checkStrictly |
| | | }" |
| | | @change="item.onChange" |
| | | > |
| | | </el-cascader> |
| | | <el-rate |
| | | v-else-if="item.type == 'rate'" |
| | | @change=" |
| | | (val) => { |
| | | item.onChange && item.onChange(val); |
| | | } |
| | | " |
| | | :max="item.max" |
| | | v-model="formFields[item.field]" |
| | | /> |
| | | <div |
| | | style="display: flex" |
| | | v-else-if="item.type == 'range' || item.range" |
| | | > |
| | | <el-input |
| | | :size="size" |
| | | :disabled="item.readonly || item.disabled" |
| | | style="flex: 1" |
| | | v-model="formFields[item.field][0]" |
| | | clearable |
| | | /> |
| | | <span style="margin: 0 5px">-</span> |
| | | <el-input |
| | | :size="size" |
| | | :disabled="item.readonly || item.disabled" |
| | | style="flex: 1" |
| | | v-model="formFields[item.field][1]" |
| | | clearable |
| | | /> |
| | | </div> |
| | | <el-input |
| | | :size="size" |
| | | clearable |
| | | :ref="item.field" |
| | | :input-style="item.inputStyle" |
| | | :disabled="item.readonly || item.disabled" |
| | | v-else-if="item.type == 'textarea'" |
| | | v-model="formFields[item.field]" |
| | | type="textarea" |
| | | :autosize="{ |
| | | minRows: item.minRows || 2, |
| | | maxRows: item.maxRows || 10 |
| | | }" |
| | | :placeholder="item.placeholder ? item.placeholder : item.title" |
| | | /> |
| | | <el-input-number |
| | | :size="size" |
| | | style="width: 100%" |
| | | :ref="item.field" |
| | | :input-style="item.inputStyle" |
| | | v-else-if="item.type == 'number'" |
| | | v-model="formFields[item.field]" |
| | | :min="item.min" |
| | | :disabled="item.readonly || item.disabled" |
| | | :max="item.max" |
| | | controls-position="right" |
| | | /> |
| | | <el-input |
| | | :size="size" |
| | | clearable |
| | | :input-style="item.inputStyle" |
| | | v-else-if="item.type == 'password'" |
| | | type="password" |
| | | v-model="formFields[item.field]" |
| | | :disabled="item.readonly || item.disabled" |
| | | v-show="!item.hidden" |
| | | :placeholder="item.placeholder ? item.placeholder : item.title" |
| | | /> |
| | | <!-- 2021.11.18ä¿®å¤el-input没æé»è®¤enteräºä»¶æ¶å车å¼å¸¸ --> |
| | | <el-input |
| | | :size="size" |
| | | clearable |
| | | :ref="item.field" |
| | | :input-style="item.inputStyle" |
| | | v-else-if="item.onKeyPress" |
| | | :placeholder="item.placeholder ? item.placeholder : item.title" |
| | | :disabled="item.readonly || item.disabled" |
| | | v-show="!item.hidden" |
| | | v-model="formFields[item.field]" |
| | | @keypress=" |
| | | ($event) => { |
| | | onKeyPress($event, item); |
| | | } |
| | | " |
| | | @change="item.onKeyPress" |
| | | @keyup.enter="item.onKeyPress" |
| | | ></el-input> |
| | | <el-input |
| | | :size="size" |
| | | clearable |
| | | v-else |
| | | :ref="item.field" |
| | | :input-style="item.inputStyle" |
| | | :placeholder="item.placeholder ? item.placeholder : item.title" |
| | | :disabled="item.readonly || item.disabled" |
| | | v-show="!item.hidden" |
| | | v-model="formFields[item.field]" |
| | | ></el-input> |
| | | |
| | | <div class="form-extra" v-if="item.extra"> |
| | | <form-expand |
| | | v-if="item.extra.render" |
| | | :render="item.extra.render" |
| | | ></form-expand> |
| | | <a |
| | | v-else-if="item.extra.click" |
| | | :style="item.extra.style" |
| | | @click="item.extra.click(item, formFields[item.field])" |
| | | > |
| | | <i v-if="item.extra.icon" :class="item.extra.icon" /> |
| | | {{ item.extra.text }} |
| | | </a> |
| | | <a v-else :style="item.extra.style"> |
| | | <i v-if="item.extra.icon" :class="item.extra.icon" /> |
| | | {{ item.extra.text }} |
| | | </a> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | | </div> |
| | | </template> |
| | | <slot></slot> |
| | | <div style="width: 100%"> |
| | | <slot name="footer"></slot> |
| | | </div> |
| | | </el-form> |
| | | </template> |
| | | <script> |
| | | const rule = { |
| | | change: [ |
| | | 'checkbox', |
| | | 'select', |
| | | 'date', |
| | | 'datetime', |
| | | 'drop', |
| | | 'radio', |
| | | 'cascader' |
| | | ], // 2020.05.31å¢å 级èç±»å |
| | | phone: /^[1][3,4,5,6,7,8,9][0-9]{9}$/, |
| | | decimal: /(^[\-0-9][0-9]*(.[0-9]+)?)$/, |
| | | number: /(^[\-0-9][0-9]*([0-9]+)?)$/ |
| | | }; |
| | | const inputTypeArr = ['text', 'string', 'mail', 'textarea', 'password']; |
| | | const types = { |
| | | int: 'number', |
| | | byte: 'number', |
| | | decimal: 'number', // "float", |
| | | string: 'string', |
| | | bool: 'boolean', |
| | | date: 'datetime', |
| | | date: 'date', |
| | | mail: 'email' |
| | | }; |
| | | //表åéªè¯æ³¨æï¼æ¯æ¬¡éªè¯é½å¿
é¡»æ§è¡callback,å¦åéªè¯ä¸æ§è¡åè°æ¹æ³ |
| | | const colPow = Math.pow(10, 3); |
| | | import FormExpand from './VolForm/VolFormRender'; |
| | | import { |
| | | defineAsyncComponent, |
| | | defineComponent, |
| | | ref, |
| | | reactive, |
| | | toRefs, |
| | | getCurrentInstance, |
| | | onMounted, |
| | | watch |
| | | } from 'vue'; |
| | | export default defineComponent({ |
| | | components: { |
| | | FormExpand, |
| | | 'vol-upload': defineAsyncComponent(() => |
| | | import('@/components/basic/VolUpload.vue') |
| | | ), |
| | | 'vol-wang-editor': defineAsyncComponent(() => |
| | | import('@/components/editor/VolWangEditor.vue') |
| | | ) |
| | | }, |
| | | props: { |
| | | loadKey: { |
| | | // æ¯å¦å è½½formRulesåæ®µé
ç½®çæ°æ®æº |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | width: { |
| | | // 表å宽度 |
| | | type: Number, |
| | | default: 0 |
| | | }, |
| | | labelWidth: { |
| | | // 表å左边labelæåæ ç¾ç宽度 |
| | | type: Number, |
| | | default: 100 |
| | | }, |
| | | formRules: { |
| | | // 表åé
ç½®è§åï¼å¦å段类åï¼æ¯å¦å¿
å¡« |
| | | type: Array, |
| | | default: [] |
| | | }, |
| | | formFields: { |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | } |
| | | }, |
| | | editor: { |
| | | // 2021.01.16ç¼è¾å¨ä¿¡æ¯ {uploadImgUrl:"",upload:null//ä¸ä¼ æ¹æ³} |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | } |
| | | }, |
| | | size: { |
| | | type: String, //large / default / small |
| | | default: 'large' |
| | | }, |
| | | select2Count: { |
| | | //è¶
åºæ°éæ¾ç¤ºselect2ç»ä»¶ |
| | | type: Number, |
| | | default: 500 |
| | | } |
| | | }, |
| | | computed: { |
| | | rules() { |
| | | let ruleResult = {}; |
| | | this.formRules.forEach((option, xIndex) => { |
| | | option.forEach((item) => { |
| | | ruleResult[item.field] = [this.getRule(item, this.formFields)]; |
| | | }); |
| | | }); |
| | | if (this.$refs.volform) { |
| | | setTimeout(() => { |
| | | this.$refs.volform.clearValidate(); |
| | | }, 100); |
| | | } |
| | | return ruleResult; |
| | | } |
| | | }, |
| | | setup(props, context) { |
| | | const { appContext, proxy } = getCurrentInstance(); |
| | | const remoteCall = ref(true); |
| | | const span = ref(1); |
| | | const rangeFields = toRefs([]); |
| | | const volform = ref(null); |
| | | const numberFields = toRefs([]); |
| | | onMounted(() => {}); |
| | | const initFormRules = (init) => { |
| | | if (props.loadKey) { |
| | | initSource(); |
| | | } |
| | | props.formRules.forEach((row, xIndex) => { |
| | | if (row.length > span.value) span.value = row.length; |
| | | let _count = 0, |
| | | _size = 0; |
| | | row.forEach((x) => { |
| | | if (x.colSize > 0) { |
| | | _size = _size + x.colSize; |
| | | _count++; |
| | | } |
| | | }); |
| | | if (_count > 0 && row.length - _count > 0) { |
| | | let _cellSize = (12 - _size) / (row.length - _count); |
| | | row.forEach((x) => { |
| | | if (!x.colSize) { |
| | | x.colSize = _cellSize; |
| | | } |
| | | }); |
| | | } |
| | | row.forEach((item, yIndex) => { |
| | | if (item.type == 'number') { |
| | | numberFields.push(item.field); |
| | | } |
| | | // ç®ååªæ¯æselectåéè¿ç¨æç´¢ï¼remoteè¿ç¨ä»åå°åå
¸æ°æ®æºè¿è¡æç´¢ï¼url仿å®çurlæç´¢ |
| | | if (item.remote || item.url) { |
| | | // item.remoteData = []; |
| | | item.loading = false; |
| | | item.point = { x: xIndex, y: yIndex }; |
| | | } |
| | | // åå§åä¸ä¼ æä»¶ä¿¡æ¯ |
| | | initUpload(item, init); |
| | | // åå§åæ°æ®æºç©ºå¯¹è±¡ |
| | | if (item.dataKey) { |
| | | // 䏿æ¡é½å¼ºå¶è®¾ç½®ä¸ºå符串类å |
| | | item.columnType = 'string'; |
| | | if (!item.data) { |
| | | item.data = []; |
| | | } |
| | | } |
| | | |
| | | if (item.range || item.type == 'range') { |
| | | if ( |
| | | !(props.formFields[item.field] instanceof Array) || |
| | | props.formFields[item.field].length != 2 |
| | | ) { |
| | | props.formFields[item.field] = ['', '']; |
| | | } |
| | | rangeFields.push(item.field); |
| | | } |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const initSource = () => { |
| | | let keys = [], |
| | | binds = []; |
| | | // åå§ååå
¸æ°æ®æº |
| | | props.formRules.forEach((item) => { |
| | | item.forEach((x) => { |
| | | if (x.dataKey && (!x.data || x.data.length == 0) && !x.remote) { |
| | | x.data = []; |
| | | binds.push({ key: x.dataKey, data: x.data, type: x.type }); |
| | | if (keys.indexOf(x.dataKey) == -1) { |
| | | keys.push(x.dataKey); |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | if (keys.length == 0) return; |
| | | appContext.config.globalProperties.http |
| | | .post('/api/Sys_Dictionary/GetVueDictionary', keys) |
| | | .then((dic) => { |
| | | bindOptions(dic, binds); |
| | | proxy.$emit('dicInited', dic); |
| | | }); |
| | | }; |
| | | const bindOptions = (dic, binds) => { |
| | | dic.forEach((d) => { |
| | | if (d.data.length > props.select2Count) { |
| | | if ( |
| | | !binds.some((x) => { |
| | | return x.key == d.dicNo && x.type == 'cascader'; |
| | | }) |
| | | ) { |
| | | d.data.forEach((item) => { |
| | | item.label = item.value; |
| | | item.value = item.key; |
| | | }); |
| | | } |
| | | } |
| | | binds.forEach((x) => { |
| | | if (x.key != d.dicNo) return true; |
| | | // å¦æææ°æ®çå䏿¥è¯¢ |
| | | if (x.data.length > 0) return true; |
| | | //2022.03.13å¢å çº§èæ°æ®æºèªå¨è½¬æ¢ |
| | | if (x.type == 'cascader' || x.type == 'treeSelect') { |
| | | let _data = JSON.parse(JSON.stringify(d.data)); |
| | | let cascaderArr = appContext.config.globalProperties.base.convertTree( |
| | | _data, |
| | | (node, data, isRoot) => { |
| | | if (!node.inited) { |
| | | node.inited = true; |
| | | node.label = node.value; |
| | | node.value = node.key; |
| | | } |
| | | } |
| | | ); |
| | | props.formRules.forEach((option) => { |
| | | option.forEach((item) => { |
| | | if (item.dataKey == x.key) { |
| | | item.orginData = x.data; |
| | | item.data = cascaderArr; |
| | | } |
| | | }); |
| | | }); |
| | | } else if (d.data.length > 0 && !d.data[0].hasOwnProperty('key')) { |
| | | let source = d.data, |
| | | newSource = new Array(source.length); |
| | | for (let index = 0; index < source.length; index++) { |
| | | newSource[index] = { |
| | | key: source['key'] + '', |
| | | value: source['value'] |
| | | }; |
| | | } |
| | | x.data.push(...newSource); |
| | | } else { |
| | | x.data.push(...d.data); |
| | | } |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const initUpload = (item, init) => { |
| | | if (!init) return; |
| | | if ( |
| | | ['img', 'excel', 'file'].indexOf(item.type != -1) || |
| | | item.columnType == 'img' |
| | | ) { |
| | | // åªæ¯æ²¡è®¾ç½®æ¯å¦èªå¨ä¸ä¼ çï¼é»è®¤é½æ¯éæ©æä»¶åèªå¨ä¸ä¼ |
| | | if (!item.hasOwnProperty('autoUpload')) { |
| | | item.autoUpload = true; |
| | | } |
| | | if (!item.hasOwnProperty('fileList')) { |
| | | item.fileList = true; |
| | | } |
| | | if (!item.hasOwnProperty('downLoad')) { |
| | | item.downLoad = true; |
| | | } |
| | | if (!item.removeBefore) { |
| | | item.removeBefore = (index, file, files) => { |
| | | return true; |
| | | }; |
| | | } |
| | | if (!item.fileClick) { |
| | | item.fileClick = (index, file, files) => { |
| | | return true; |
| | | }; |
| | | } |
| | | if (!item.onChange) { |
| | | item.onChange = (files) => { |
| | | return true; |
| | | }; |
| | | } |
| | | if (!item.uploadAfter) { |
| | | item.uploadAfter = (result, files) => { |
| | | return true; |
| | | }; |
| | | } |
| | | if (!item.uploadBefore) { |
| | | item.uploadBefore = (files) => { |
| | | return true; |
| | | }; |
| | | } |
| | | } |
| | | }; |
| | | const validate = (callback) => { |
| | | let result = true; |
| | | volform.value.validate((valid) => { |
| | | if (!valid) { |
| | | appContext.config.globalProperties.$message.error('æ°æ®éªè¯æªéè¿!'); |
| | | result = false; |
| | | } else if (typeof callback === 'function') { |
| | | try { |
| | | callback(valid); |
| | | } catch (error) { |
| | | let msg = `表åéªè¯åè°æ¹æ³å¼å¸¸ï¼${error.message}`; |
| | | appContext.config.globalProperties.$message.error(msg); |
| | | console.log(msg); |
| | | } |
| | | } |
| | | }); |
| | | return result; |
| | | }; |
| | | |
| | | initFormRules(true); |
| | | return { |
| | | remoteCall, |
| | | span, |
| | | rangeFields, |
| | | numberFields, |
| | | validate, |
| | | volform |
| | | // initFormRules, |
| | | // initSource |
| | | }; |
| | | }, |
| | | created() { |
| | | this.formRules.forEach((rules) => { |
| | | rules.forEach((option) => { |
| | | if (option.type == 'treeSelect' && option.multiple === undefined) { |
| | | option.multiple = true; |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | data() { |
| | | return { |
| | | // remoteCall: true, |
| | | errorImg: 'this.src="' + require('@/assets/imgs/error-img.png') + '"' |
| | | // span: 1, |
| | | // rangeFields: [], |
| | | }; |
| | | }, |
| | | methods: { |
| | | getColWidth(item) { |
| | | //2021.08.30 å¢å å¨æè®¡ç®è¡¨å宽度 |
| | | let _span = 0; |
| | | this.formRules.forEach((row, xIndex) => { |
| | | //2022.05.06 追å 表åä¸éèçå
ç´ ä¸åä¸å¨æè®¡ç®è¡¨å宽度 |
| | | let rowLength = row.filter((item) => { |
| | | return !item.hidden; |
| | | }).length; |
| | | if (rowLength > _span) _span = rowLength; |
| | | }); |
| | | let rete = |
| | | Math.round(((item.colSize || 12 / _span) / 0.12) * colPow, 10.0) / |
| | | colPow; |
| | | if (item.colSize) return rete.toFixed(3); |
| | | return rete.toFixed(3); |
| | | // return (100 - rete).toFixed(3); |
| | | }, |
| | | previewImg(url) { |
| | | this.base.previewImg(url, this.http.ipAddress); |
| | | }, |
| | | getSrc(path) { |
| | | if (!path) return; |
| | | if (!this.base.isUrl(path) && path.indexOf('.') != -1) { |
| | | return this.http.ipAddress + path; |
| | | } |
| | | return path; |
| | | }, |
| | | // æ¯å¦ä¸ºå¾çæä»¶çæ ¼å¼å¹¶å¯¹å段çè½¬æ¢ææ°ç»ï¼[{name:'1.jpg',path:'127.0.0.1/ff/1.jpg'}] |
| | | isFile(item, formFields) { |
| | | if ( |
| | | item.type == 'img' || |
| | | item.columnType == 'img' || |
| | | item.type == 'excel' || |
| | | item.type == 'file' |
| | | ) { |
| | | this.convertFileToArray(item, formFields); |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | isReadonlyImgFile(item, formFields) { |
| | | if ((item.disabled || item.readonly) && this.isFile(item, formFields)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | convertFileToArray(item, formFields) { |
| | | if (!item.maxFile) { |
| | | item.maxFile = 1; // é»è®¤åªè½ä¸ä¼ ä¸ä¸ªæä»¶ï¼å¯ä»¥å¨onInitä¸è®¾ç½® |
| | | } |
| | | |
| | | let fileInfo = formFields[item.field]; |
| | | if (fileInfo instanceof Array) { |
| | | return; |
| | | } |
| | | if (fileInfo === null || fileInfo === undefined) { |
| | | formFields[item.field] = []; |
| | | return; |
| | | } |
| | | // å°ä»¥éå·éå¼çæä»¶å岿æ°ç»127.0.0.1/aa/1.jpg,å°127.0.0.1/aa/2.jpg |
| | | if (typeof fileInfo === 'string') { |
| | | if (fileInfo.trim() === '') { |
| | | formFields[item.field] = []; |
| | | return; |
| | | } |
| | | // 妿æä»¶è·¯å¾æ¯å符串ï¼å使ç¨ï¼æå |
| | | fileInfo = fileInfo.replace(/\\/g, '/'); |
| | | let files = fileInfo.split(','); |
| | | formFields[item.field] = []; |
| | | for (let index = 0; index < files.length; index++) { |
| | | let file = files[index]; |
| | | let splitFile = file.split('/'); |
| | | formFields[item.field].push({ |
| | | name: splitFile.length > 0 ? splitFile[splitFile.length - 1] : file, |
| | | path: file // this.base.isUrl(file) ? file : this.http.ipAddress + file, |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | dowloadFile(file) { |
| | | this.base.dowloadFile( |
| | | file.path, |
| | | file.name, |
| | | { |
| | | Authorization: this.$store.getters.getToken() |
| | | }, |
| | | this.http.ipAddress |
| | | ); |
| | | }, |
| | | validatorPhone(ruleOption, value, callback) { |
| | | if (!ruleOption.required && !value && value != '0') { |
| | | return callback(); |
| | | } |
| | | if (!rule.phone.test((value || '').trim())) { |
| | | return callback(new Error('请è¾å
¥æ£ç¡®çææºå·')); |
| | | } |
| | | callback(); |
| | | }, |
| | | validatorPwd(ruleOption, value, callback) { |
| | | if (!ruleOption.required && !value && value != '0') { |
| | | return callback(); |
| | | } |
| | | if ((value + '').trim().length < 6) { |
| | | return callback(new Error('å¯ç é¿åº¦ä¸è½å°äº6ä½')); |
| | | } |
| | | callback(); |
| | | }, |
| | | convertArrayValue(data, val) { |
| | | // 2020.12.13å¢å 表åå¤éåªè½¬æ¢åå
¸ |
| | | // ç¼è¾å¤étableæ¾ç¤º |
| | | //2023.04.20ä¿®å¤åªè¯»ä¸ºlabelæ¶åæ°æ®è¢«åå
¸æ¿æ¢äºçé®é¢ |
| | | let valArr = Array.isArray(val) |
| | | ? val.map((x) => { |
| | | return x; |
| | | }) |
| | | : val.split(','); |
| | | for (let index = 0; index < valArr.length; index++) { |
| | | var _item = data.find((x) => { |
| | | return x.key && x.key != '0' && x.key + '' == valArr[index] + ''; |
| | | }); |
| | | if (_item) { |
| | | valArr[index] = _item.value; |
| | | } |
| | | } |
| | | return valArr.join(','); |
| | | }, |
| | | getText(formFields, item) { |
| | | // 2019.10.24ä¿®å¤è¡¨åselectç»ä»¶ä¸ºåªè¯»ç屿§æ¶æ²¡æç»å®æ°æ®æº |
| | | let text = formFields[item.field]; |
| | | if (typeof text === 'function') return text(formFields); |
| | | if (text === 'null' || text === '' || text === null || text === undefined) |
| | | return '--'; |
| | | //2021.03.02å¢å åªè¯»æ¶æ¥æå¤ç |
| | | if (item.type == 'date') { |
| | | return text.replace('T', ' ').split(' ')[0]; |
| | | } |
| | | //2021.03.31ä¿®å¤è¡¨åswitchåªè¯»æ¶æ²¡æè½¬æ¢å¼çé®é¢ |
| | | if (item.type == 'switch') { |
| | | return text ? 'æ¯' : 'å¦'; |
| | | } |
| | | if (!item.data) return text; |
| | | if (item.type == 'selectList' || item.type == 'checkbox') { |
| | | return this.convertArrayValue(item.data, text); |
| | | } |
| | | var _item = item.data.find((x) => { |
| | | return x.key == text; |
| | | }); |
| | | return _item ? _item.value : text; |
| | | }, |
| | | onClear(item, formFields) { |
| | | // è¿ç¨selectæ ç¾æ¸
空é项 |
| | | item.data.splice(0); |
| | | // console.log(2); |
| | | }, |
| | | onChange(item, value) { |
| | | if (item.onChange && typeof item.onChange === 'function') { |
| | | item.onChange(value, item); |
| | | } |
| | | }, |
| | | onRemoteChange(item, value) { |
| | | // ç¬¬äºæ¬¡æå¼æ¶ï¼é»è®¤å¼æäºundefinedï¼å¾
æ¥viewgridä¸é置代ç |
| | | if (value == undefined && item.data.length > 0) { |
| | | this.formFields[item.field] = item.data[0].key; |
| | | // console.log('undefined'); |
| | | } |
| | | this.remoteCall = false; |
| | | if (item.onChange && typeof item.onChange === 'function') { |
| | | item.onChange(value, item); |
| | | } |
| | | }, |
| | | getData(item) { |
| | | return item.data; |
| | | }, |
| | | |
| | | // è¿ç¨æç´¢(æå¼å¼¹åºæ¡æ¶åºè¯¥ç¦æ¢æç´¢) |
| | | remoteSearch(item, formFields, val) { |
| | | if (!item.remote && !item.url) { |
| | | return; |
| | | } |
| | | if ( |
| | | val == '' || |
| | | (item.data.length == 1 && |
| | | (val == item.data[0].key || val == item.data[0].value)) |
| | | ) { |
| | | return; |
| | | } |
| | | // å¼¹åºæ¡æåå§åè¡¨åæ¶ç»data设置æ°ç»é»è®¤å¼2 |
| | | // 2020.09.26ä¿®å¤è¿ç¨æç´¢èªå®ä¹urlä¸èµ·ä½ç¨çé®é¢ |
| | | let url; |
| | | if (typeof item.url === 'function') { |
| | | url = item.url(val, item.dataKey, item); |
| | | } else { |
| | | url = |
| | | (item.url || '/api/Sys_Dictionary/GetSearchDictionary') + |
| | | '?dicNo=' + |
| | | item.dataKey + |
| | | '&value=' + |
| | | val; |
| | | } |
| | | this.http.post(url).then((dicData) => { |
| | | //this.$set(item, "loading", false); |
| | | item.loading = false; |
| | | item.data = dicData; |
| | | this.formRules[item.point.x].splice(item.point.y, 1, item); |
| | | }); |
| | | }, |
| | | getObject(date) { |
| | | if (typeof date === 'object') { |
| | | return date; |
| | | } |
| | | return new Date(date); |
| | | }, |
| | | reset(sourceObj) { |
| | | // éç½®è¡¨åæ¶ï¼ç¦ç¨è¿ç¨æ¥è¯¢ |
| | | this.$refs['volform'].resetFields(); |
| | | if (this.rangeFields.length) { |
| | | this.rangeFields.forEach((key) => { |
| | | this.formFields[key].splice(0); |
| | | this.formFields[key] = [null, null]; |
| | | }); |
| | | } |
| | | if (!sourceObj) return; |
| | | for (const key in this.formFields) { |
| | | if (sourceObj.hasOwnProperty(key)) { |
| | | this.formFields[key] = sourceObj[key]; |
| | | if (this.numberFields.indexOf(key) != -1) { |
| | | this.formFields[key] = sourceObj[key] * 1 || 0; |
| | | } |
| | | } |
| | | } |
| | | // this.remoteCall = true; |
| | | }, |
| | | |
| | | fileOnChange(files, item) { |
| | | this.$refs.volform.clearValidate(item.field); |
| | | if (item.onChange) { |
| | | return item.onChange(files); |
| | | } |
| | | return true; |
| | | }, |
| | | isReadonly(item) { |
| | | return item.readonly || item.disabled; |
| | | }, |
| | | getRule(item, formFields) { |
| | | //2021.07.17å¢å åªè¯»è¡¨åä¸éªè¯ |
| | | //rangeä¸swtichææ¶ä¸åæ ¡éª |
| | | if ( |
| | | // item.readonly || |
| | | // item.disabled || |
| | | item.type == 'switch' || |
| | | item.type == 'range' |
| | | ) |
| | | return { required: false }; |
| | | // ç¨æ·è®¾ç½®çèªå®ä¹æ¹æ³ |
| | | if (item.validator && typeof item.validator === 'function') { |
| | | return { |
| | | validator: (rule, val, callback) => { |
| | | // ç¨æ·èªå®ä¹çæ¹æ³ï¼å¦æè¿åäºå¼ï¼ç´æ¥æ¾ç¤ºè¿åçå¼ï¼éªè¯ä¸éè¿ |
| | | let message = item.validator(rule, val); |
| | | if (message) return callback(new Error(message + '')); |
| | | return callback(); |
| | | }, |
| | | required: item.required, |
| | | trigger: rule.change.indexOf(item.type) != -1 ? 'change' : 'blur' |
| | | }; |
| | | } |
| | | if (['img', 'excel', 'file'].indexOf(item.type) != -1) { |
| | | return { |
| | | validator: (rule, val, callback) => { |
| | | //2021.09.05ç§»é¤æä»¶ä¸ä¼ é»è®¤å¿
å¡« |
| | | if ( |
| | | item.required && |
| | | !this.isReadonly(item) && |
| | | (!val || !val.length) |
| | | ) { |
| | | return callback( |
| | | new Error(item.type == 'img' ? '请ä¸ä¼ ç
§ç' : '请ä¸ä¼ æä»¶') |
| | | ); |
| | | } |
| | | return callback(); |
| | | }, |
| | | required: item.required, |
| | | trigger: 'change' |
| | | }; |
| | | } |
| | | // 设置æ°åçæå¤§å¼æ°æå°å¼ |
| | | if ( |
| | | item.type == 'number' || |
| | | item.columnType == 'number' || |
| | | item.columnType == 'int' || |
| | | item.type == 'decimal' |
| | | ) { |
| | | // 妿æ¯å¿
å¡«é¡¹çæ°åï¼è®¾ç½®ä¸ä¸ªé»è®¤æå¤§ä¸æå¼å° |
| | | if (item.required && typeof item.min !== 'number') { |
| | | item.min = 0; //item.type == "decimal" ? 0.1 : 1; |
| | | } |
| | | |
| | | return { |
| | | required: item.required, |
| | | message: item.title + 'åªè½æ¯æ°å', |
| | | title: item.title, |
| | | trigger: 'blur', |
| | | min: item.min, |
| | | max: item.max, |
| | | type: item.columnType || item.type, |
| | | validator: (ruleObj, value, callback) => { |
| | | if (!ruleObj.min && !ruleObj.max) { |
| | | if (ruleObj.required) { |
| | | if ((!value && value != '0') || !rule.decimal.test(value)) { |
| | | return callback(new Error('åªè½æ¯æ°å')); |
| | | } |
| | | } |
| | | return callback(); |
| | | } |
| | | if (this.isReadonly(item)) return callback(); |
| | | if (ruleObj.type == 'number') { |
| | | if (!rule.number.test(value)) { |
| | | ruleObj.message = ruleObj.title + 'åªè½æ¯æ´æ°'; |
| | | return callback(new Error(ruleObj.message)); |
| | | } |
| | | } else { |
| | | if (!rule.decimal.test(value)) { |
| | | ruleObj.message = ruleObj.title + 'åªè½æ¯æ°å'; |
| | | return callback(new Error(ruleObj.message)); |
| | | } |
| | | } |
| | | if ( |
| | | ruleObj.min !== undefined && |
| | | typeof ruleObj.min === 'number' && |
| | | value < ruleObj.min |
| | | ) { |
| | | ruleObj.message = ruleObj.title + 'ä¸è½å°äº' + ruleObj.min; |
| | | return callback(new Error(ruleObj.message)); |
| | | } |
| | | if ( |
| | | ruleObj.max !== undefined && |
| | | typeof ruleObj.max === 'number' && |
| | | value > ruleObj.max |
| | | ) { |
| | | ruleObj.message = ruleObj.title + 'ä¸è½å¤§äº' + ruleObj.max; |
| | | return callback(new Error(ruleObj.message)); |
| | | } |
| | | return callback(); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | // ææºãå¯ç éªè¯ |
| | | if (item.type == 'password' || item.type == 'phone') { |
| | | return { |
| | | validator: |
| | | item.type == 'phone' ? this.validatorPhone : this.validatorPwd, |
| | | required: item.required, |
| | | trigger: 'blur' |
| | | }; |
| | | } |
| | | |
| | | if (!item.required && item.type != 'mail') return { required: false }; |
| | | |
| | | if (!item.hasOwnProperty('type')) item.type = 'text'; |
| | | |
| | | if (inputTypeArr.indexOf(item.type) != -1) { |
| | | let message = |
| | | item.title + |
| | | (item.type == 'mail' ? 'å¿
é¡»æ¯ä¸ä¸ªé®ç®±å°å' : 'ä¸è½ä¸ºç©º'); |
| | | let type = item.type == 'mail' ? 'email' : types[item.columnType]; |
| | | let _rule = { |
| | | required: true, |
| | | message: message, |
| | | trigger: 'blur', |
| | | type: type, |
| | | validator: (ruleObj, value, callback) => { |
| | | if ( |
| | | !this.isReadonly(item) && |
| | | (value === '' || value === undefined || value === null) |
| | | ) { |
| | | return callback(new Error(ruleObj.message)); |
| | | } |
| | | return callback(); |
| | | } |
| | | }; |
| | | if (item.type == 'mail') { |
| | | _rule.validator = undefined; |
| | | return _rule; |
| | | } |
| | | if (item.min) { |
| | | _rule.min = item.min; |
| | | _rule.message = item.title + 'è³å°' + item.min + '个å符!'; |
| | | } |
| | | if (item.max) { |
| | | return [ |
| | | _rule, |
| | | { |
| | | max: item.max, |
| | | required: true, |
| | | message: item.title + 'æå¤' + item.max + '个å符!', |
| | | trigger: 'blur' |
| | | } |
| | | ]; |
| | | } |
| | | return _rule; |
| | | } |
| | | |
| | | if (item.type == 'radio') { |
| | | return { |
| | | required: item.required, |
| | | message: 'è¯·éæ©' + item.title, |
| | | trigger: 'change', |
| | | type: 'string' |
| | | }; |
| | | } |
| | | if ( |
| | | item.type == 'date' || |
| | | item.type == 'datetime' || |
| | | item.type == 'month' || |
| | | item.type == 'time' |
| | | ) { |
| | | return { |
| | | required: true, |
| | | message: 'è¯·éæ©' + item.title, |
| | | trigger: 'change', |
| | | type: item.range ? 'array' : 'string', |
| | | validator: (rule, val, callback) => { |
| | | if (this.isReadonly(item)) return callback(); |
| | | // ç¨æ·èªå®ä¹çæ¹æ³ï¼å¦æè¿åäºå¼ï¼ç´æ¥æ¾ç¤ºè¿åçå¼ï¼éªè¯ä¸éè¿ |
| | | if (!val || (item.range && !val.length)) { |
| | | return callback(new Error('è¯·éæ©æ¥æ')); |
| | | } |
| | | return callback(); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | if (item.type == 'cascader') { |
| | | return { |
| | | type: 'array', |
| | | required: true, |
| | | min: item.min || 1, |
| | | // message: "è¯·éæ©" + item.title, |
| | | trigger: 'change', |
| | | validator: (rule, val, callback) => { |
| | | if (this.isReadonly(item)) return callback(); |
| | | // ç¨æ·èªå®ä¹çæ¹æ³ï¼å¦æè¿åäºå¼ï¼ç´æ¥æ¾ç¤ºè¿åçå¼ï¼éªè¯ä¸éè¿ |
| | | let _arr = this.formFields[item.field]; |
| | | if (!_arr || !_arr.length) { |
| | | return callback(new Error('è¯·éæ©' + item.title)); |
| | | } |
| | | return callback(); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | if ( |
| | | ['select', 'selectList', 'checkbox', 'cascader', 'treeSelect'].indexOf( |
| | | item.type |
| | | ) != -1 |
| | | ) { |
| | | let _rule = { |
| | | type: item.type == 'select' ? 'string' : 'array', |
| | | required: true, |
| | | min: item.min || 1, |
| | | message: 'è¯·éæ©' + item.title, |
| | | trigger: 'change', |
| | | validator: (rule, value, callback) => { |
| | | if (this.isReadonly(item)) return callback(); |
| | | //2021.11.27ä¿®å¤å¤é没ææç¤ºçé®é¢ |
| | | if (value == undefined || value === '') { |
| | | return callback(new Error(rule.message)); |
| | | } else if ( |
| | | (item.type == 'checkbox' || |
| | | item.type == 'selectList' || |
| | | item.type == 'treeSelect') && |
| | | (!(value instanceof Array) || !value.length) |
| | | ) { |
| | | return callback(new Error(rule.message)); |
| | | } |
| | | return callback(); |
| | | } |
| | | }; |
| | | |
| | | if (_rule.max) { |
| | | _rule.nax = item.max; |
| | | _rule.message = 'æå¤åªè½éæ©' + item.max + '项'; |
| | | } |
| | | return _rule; |
| | | } |
| | | return {}; |
| | | }, |
| | | compareDate(date1, date2) { |
| | | if (!date2) { |
| | | return true; |
| | | } |
| | | return ( |
| | | date1.valueOf() < |
| | | (typeof date2 == 'number' ? date2 : new Date(date2).valueOf()) |
| | | ); |
| | | }, |
| | | getDateOptions(date, item) { |
| | | //2021.07.17设置æ¶é´å¯éèå´ |
| | | if ((!item.min && !item.max) || !date) { |
| | | return false; |
| | | } |
| | | if (item.min && item.min.indexOf(' ') == -1) { |
| | | //ä¸è®¾ç½®æ¶åç§ï¼åé¢ä¼èªå¨å ä¸ 08:00 |
| | | item.min = item.min + ' 00:00:000'; |
| | | } |
| | | return ( |
| | | this.compareDate(date, item.min) || !this.compareDate(date, item.max) |
| | | ); |
| | | }, |
| | | getDateFormat(item) { |
| | | if (item.type == 'month') { |
| | | return 'YYYY-MM'; |
| | | } |
| | | // if (item.type=='time') { |
| | | // return 'HH:mm:ss' |
| | | // } |
| | | //è§https://day.js.org/docs/zh-CN/display/format |
| | | return item.type == 'date' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'; |
| | | }, |
| | | dateRangeChange(val, item) { |
| | | if (!val) { |
| | | this.$emit('update:formFields'); |
| | | return; |
| | | } |
| | | item.onChange && item.onChange(val); |
| | | }, |
| | | onKeyPress($event, item) { |
| | | if ($event.keyCode == 13) { |
| | | return; |
| | | } |
| | | item.onKeyPress($event); |
| | | }, |
| | | filterMethod(value, data) { |
| | | return data.label.includes(value); |
| | | }, |
| | | getNode( label,node, data){ |
| | | console.log(label) |
| | | } |
| | | } |
| | | }); |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .el-form-item { |
| | | margin-right: 0; |
| | | } |
| | | .el-form-item { |
| | | .form-imgs { |
| | | img { |
| | | float: left; |
| | | cursor: pointer; |
| | | object-fit: cover; |
| | | margin: 0 10px 10px 0; |
| | | width: 65px; |
| | | height: 65px; |
| | | border: 1px solid #c7c7c7; |
| | | overflow: hidden; |
| | | border-radius: 5px; |
| | | box-sizing: content-box; |
| | | } |
| | | } |
| | | } |
| | | .el-form-item ::v-deep(.el-form-item__label) { |
| | | padding: 0 0px 0 4px; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | .el-form-item ::v-deep(.el-range-separator) { |
| | | text-align: center; |
| | | width: 13px; |
| | | padding: 0px 1px; |
| | | font-size: 12px; |
| | | } |
| | | .el-form-item ::v-deep(.el-range__close-icon) { |
| | | margin-right: -10px; |
| | | } |
| | | .form-item-extra { |
| | | > *:first-child { |
| | | flex: 1; |
| | | } |
| | | display: flex; |
| | | .form-extra { |
| | | padding-left: 7px; |
| | | line-height: 36px; |
| | | } |
| | | } |
| | | .vol-form-item { |
| | | width: 100%; |
| | | } |
| | | .vol-form-item ::v-deep(.el-form-item__content) { |
| | | display: unset !important; |
| | | } |
| | | .vol-form-item ::v-deep(.el-input--large .el-input__inner) { |
| | | height: 34px !important; |
| | | } |
| | | .vol-form-item ::v-deep(.el-input-number--large .el-input-number__increase) { |
| | | border-top: 1px solid #d4d4d4; |
| | | } |
| | | .vol-form-item ::v-deep(.el-input-number--large .el-input-number__decrease) { |
| | | border-bottom: 1px solid #d4d4d4; |
| | | } |
| | | .vol-form-item ::v-deep(.el-input--large.el-date-editor) { |
| | | height: 36px; |
| | | } |
| | | .v-date-range ::v-deep(.el-input__prefix) { |
| | | display: none; |
| | | } |
| | | .v-date-range ::v-deep(.el-input__inner) { |
| | | padding: 0; |
| | | } |
| | | |
| | | .el-form-item ::v-deep(.el-checkbox) { |
| | | margin-right: 8px; |
| | | } |
| | | .el-form-item ::v-deep(.el-checkbox .el-checkbox__label) { |
| | | padding-left: 5px; |
| | | } |
| | | .el-form-item ::v-deep(textarea) { |
| | | font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', |
| | | 'Microsoft YaHei', '微软é
é»', Arial, sans-serif !important; |
| | | } |
| | | .el-form-item ::v-deep(.el-select .el-select__tags > span) { |
| | | display: flex; |
| | | } |
| | | .el-form-item ::v-deep(.el-select-v2__combobox-input) { |
| | | height: 30px; |
| | | } |
| | | .el-form-item ::v-deep(.el-select__tags) { |
| | | overflow: hidden; |
| | | height: 30px; |
| | | } |
| | | .el-form-item ::v-deep(.el-select-tags-wrapper) { |
| | | position: absolute; |
| | | } |
| | | |
| | | .el-form-item { |
| | | vertical-align: top !important; |
| | | } |
| | | .form-file-list { |
| | | a { |
| | | color: #3ea9ff; |
| | | } |
| | | a:hover { |
| | | cursor: pointer; |
| | | color: #0281e7; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { h } from 'vue'; |
| | | |
| | | export default { |
| | | name: "FormExpand", |
| | | functional: true, |
| | | props: { |
| | | render: Function, |
| | | par: {}//æµè¯åæ° |
| | | }, |
| | | render: ({ render, par }) => { |
| | | return render(h, { par }); //h(); |
| | | } |
| | | }; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import templateCode from './templateCode' |
| | | export default function () { |
| | | let code = templateCode; |
| | | let _formOptions = this.options.formOptions.map(m => { |
| | | let _op = m.map((m1, i) => { |
| | | let _obj; |
| | | //.data[0].hasOwnProperty("key") |
| | | if (m1.data && m1.data.length && !m1.dataKey) { |
| | | let m2 = JSON.parse(JSON.stringify(m1)); |
| | | m2.data = m2.data.map(c => { |
| | | return { key: c.label || c.key, value: c.label } |
| | | }) |
| | | _obj = JSON.stringify(m2) |
| | | } else { |
| | | _obj = JSON.stringify(m1) |
| | | } |
| | | return (i === 0 ? '' : '\n\t\t\t\t') + _obj |
| | | }).join(','); |
| | | //return JSON.stringify(m, null, '') |
| | | return _op; |
| | | }) |
| | | code = code.replace('{#fields}', JSON.stringify(this.options.fields)) |
| | | .replace('{#formOptions}', '[' + _formOptions.join('],\n\t\t\t\t[') + ']'); |
| | | code = code.replace('}],', '\t\t\t\t\t}],') |
| | | .replace("[{#tableOptions}]", JSON.stringify(this.options.tables, null, '\t')) |
| | | .replace("[{#tabsOptions}]", JSON.stringify(this.options.tabs, null, '\t')) |
| | | // fields: {#fields}, |
| | | // formOptions: [{#formOptions}], |
| | | // tables: [{#tables}], |
| | | // tabs: [{#tabs}] |
| | | var tabsText = this.options.tabs.length ? ` <div class="tables" |
| | | style="padding-bottom: 10px"> |
| | | <el-tabs v-model="tabsModel" |
| | | @tab-click="() => {}"> |
| | | <el-tab-pane style="padding: 0" |
| | | class="table-item" |
| | | v-for="(item, index) in tabs" |
| | | :label="item.name" |
| | | :name="index+''" |
| | | :key="index"> |
| | | <div class="table-header"> |
| | | <div class="header-text"> |
| | | {{ item.name }} |
| | | </div> |
| | | <div class="header-btns"> |
| | | <el-button type="primary" |
| | | size="mini" |
| | | :key="bindex" |
| | | :icon="btnItem.icon" |
| | | plain |
| | | @click="tabsTableBtnClick(item, bindex, index)" |
| | | v-for="(btnItem, bindex) in item.buttons"> |
| | | {{ btnItem.name }} |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <vol-table :url="item.url" |
| | | :load-key="false" |
| | | :index="true" |
| | | :ref="'tabsTable' + index" |
| | | :tableData="item.tableData" |
| | | :columns="item.columns" |
| | | :max-height="250" |
| | | :pagination-hide="item.pagination" |
| | | :column-index="true" |
| | | :ck="true"></vol-table> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div>`: '' |
| | | code = code.replace('{#tabs}', tabsText); |
| | | if (this.options.tables.length || this.options.tabs.length) { |
| | | code = code.replace("{import_VolTable}", "import VolTable from '@/components/basic/VolTable'") |
| | | code = code.replace(",{component_table}", ",'vol-table': VolTable") |
| | | } else { |
| | | code = code.replace("{import_VolTable}", '') |
| | | code = code.replace("{component_table}", '') |
| | | } |
| | | |
| | | if (this.options.tables.length) { |
| | | |
| | | code = code.replace('{table_ms}', ` |
| | | tableBtnClick (item, btnIndex, index) { |
| | | if (item.buttons[btnIndex].value == "add") { |
| | | this.$refs["table" + index][0].addRow({}); |
| | | return; |
| | | } |
| | | if (item.buttons[btnIndex].value == "del") { |
| | | this.$refs["table" + index][0].delRow(); |
| | | return; |
| | | } |
| | | }, |
| | | tabsTableBtnClick (item, btnIndex, index) { |
| | | if (item.buttons[btnIndex].value == "add") { |
| | | this.$refs["tabsTable" + index][0].addRow({}); |
| | | return; |
| | | } |
| | | if (item.buttons[btnIndex].value == "del") { |
| | | this.$refs["tabsTable" + index][0].delRow(); |
| | | return; |
| | | } |
| | | },`) |
| | | code = code.replace('{#tables}', |
| | | ` |
| | | <!--tableé
ç½® --> |
| | | <div class="tables"> |
| | | <div class="table-item" |
| | | v-for="(item, index) in tables" |
| | | :key="index"> |
| | | <div class="table-header"> |
| | | <div class="header-text"> |
| | | {{ item.name }} |
| | | </div> |
| | | <div class="header-btns"> |
| | | <el-button type="primary" |
| | | size="mini" |
| | | :key="bindex" |
| | | plain |
| | | @click="tableBtnClick(item, bindex, index)" |
| | | :icon="btnItem.icon" |
| | | v-for="(btnItem, bindex) in item.buttons"> |
| | | {{ btnItem.name }} |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <vol-table :url="item.url" |
| | | :load-key="false" |
| | | :index="true" |
| | | :ref="'table' + index" |
| | | :tableData="item.tableData" |
| | | :columns="item.columns" |
| | | :max-height="250" |
| | | :pagination-hide="item.pagination" |
| | | :column-index="true" |
| | | :ck="true"></vol-table> |
| | | </div> |
| | | </div>`); |
| | | |
| | | } else { |
| | | |
| | | code = code.replace('{table_ms}', '') |
| | | code = code.replace('{#tables}', ''); |
| | | } |
| | | const blob = new Blob([code], { type: "text/plain;charset=utf-8" }) |
| | | if ('download' in document.createElement('a')) { // éIEä¸è½½ |
| | | const elink = document.createElement('a') |
| | | elink.download = `code${new Date().valueOf()}.vue`; |
| | | elink.style.display = 'none' |
| | | elink.href = URL.createObjectURL(blob) |
| | | document.body.appendChild(elink) |
| | | elink.click() |
| | | URL.revokeObjectURL(elink.href) // éæ¾URL 对象 |
| | | document.body.removeChild(elink) |
| | | } else { |
| | | navigator.msSaveBlob(blob, fileName) |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="drag-container"> |
| | | <!-- @start="onStart" --> |
| | | <div class="drag-left"> |
| | | <div class="left-title">ç»ä»¶å表</div> |
| | | <draggable |
| | | v-model="components" |
| | | @end="end1" |
| | | class="left-draggable-item" |
| | | :group="{ name: 'componentsGroup', pull: 'clone', put: false }" |
| | | animation="300" |
| | | @start="onStart" |
| | | :sort="false" |
| | | :move="onMove1" |
| | | > |
| | | <transition-group> |
| | | <div |
| | | :class="item.id == 1 ? 'item forbid' : 'item'" |
| | | v-for="item in components" |
| | | :key="item.id" |
| | | > |
| | | <i :class="item.icon"></i> {{ item.name }} |
| | | </div> |
| | | </transition-group> |
| | | </draggable> |
| | | <div class="example"> |
| | | <div @click="example1">示ä¾ä¸<i class="el-icon-arrow-right"></i></div> |
| | | <div @click="example2">示ä¾äº<i class="el-icon-arrow-right"></i></div> |
| | | <div @click="example3">示ä¾ä¸<i class="el-icon-arrow-right"></i></div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="drag-center"> |
| | | <div class="center-top"> |
| | | <span> |
| | | <!-- <i class="el-icon-warning-outline"></i>髿ç表åé
ç½® --> |
| | | </span> |
| | | <el-button type="primary" size="mini" plain @click="save" |
| | | ><i class="el-icon-check"> </i>ä¿å</el-button |
| | | > |
| | | <el-button type="primary" size="mini" plain @click="preview(true)" |
| | | ><i class="el-icon-view"> </i>é¢è§</el-button |
| | | > |
| | | <el-button type="primary" size="mini" plain @click="download" |
| | | ><i class="el-icon-view"> </i>ä¸è½½</el-button |
| | | > |
| | | <el-button type="primary" @click="clearItems" size="mini" plain |
| | | ><i class="el-icon-delete"> </i>æ¸
空</el-button |
| | | > |
| | | <a |
| | | style="margin-left: 15px" |
| | | href="http://v2.volcore.xyz/document/api" |
| | | target="_blank" |
| | | >设计å¨åºäºæ¡æ¶volformãvoltableãvoluploadãvolboxå®å¶å¼å</a |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-alert |
| | | title="å
³äºè¡¨å设计å¨" |
| | | type="success" |
| | | :show-icon="true" |
| | | :closable="false" |
| | | > |
| | | <div> |
| | | 1ã表å设计å¨åºäºdraggableå¼å,ä¸ºæ¬æ¡æ¶èªå®ä¹é¡µé¢åè½çè¡¥å
,æ¡æ¶ä»ä»¥å¯è§å代ç çæå¨ä¸ºæ ¸å¿ |
| | | </div> |
| | | <div> |
| | | 2ãæ¯æå¯è§å设计1对1ã1对å¤å表å䏿æ¡èªå¨ç»å®ãtableèªå¨å è½½æ°æ®(å页ãç¼è¾)ãèªå¨ä¸ä¼ æä»¶ã坿æ¬ç¼è¾ |
| | | </div> |
| | | </el-alert> |
| | | </div> |
| | | <el-scrollbar style="flex: 1"> |
| | | <div class="tips" key="empty" v-show="!currentComponents.length"> |
| | | 请å°å·¦è¾¹ç»ä»¶æå
¥æ¤å®¹å¨ä¸ |
| | | </div> |
| | | <el-form label-position="top"> |
| | | <draggable |
| | | class="draggable-container" |
| | | v-model="currentComponents" |
| | | @end="end2" |
| | | animation="300" |
| | | :move="onMove" |
| | | group="componentsGroup" |
| | | > |
| | | <transition-group class="drag-center-item"> |
| | | <div |
| | | class="item2" |
| | | :class="{ actived: index === currentIndex }" |
| | | @click="itemClick(item, index)" |
| | | :style="{ width: item.width + '%' }" |
| | | v-for="(item, index) in currentComponents" |
| | | :key="index" |
| | | > |
| | | <i |
| | | class="el-icon-document-copy" |
| | | @click.stop="copyItem(item)" |
| | | ></i> |
| | | <i class="el-icon-delete" @click.stop="removeItem(index)"> </i> |
| | | <el-form-item |
| | | :required="item.required" |
| | | label-position="top" |
| | | style="width: 100%" |
| | | :label="item.type == 'line' ? '' : item.name" |
| | | > |
| | | <el-col> |
| | | <!-- <div></div> --> |
| | | <!-- {{ item.name }} --> |
| | | <el-input |
| | | v-if="item.type == 'text'" |
| | | placeholder="请è¾å
¥å
容" |
| | | v-model="item.value" |
| | | :disabled="item.readonly" |
| | | size="medium" |
| | | ></el-input> |
| | | <el-input |
| | | v-else-if="item.type == 'textarea'" |
| | | type="textarea" |
| | | v-model="item.value" |
| | | :disabled="item.readonly" |
| | | placeholder="请è¾å
¥å
容" |
| | | ></el-input> |
| | | <el-date-picker |
| | | v-else-if="item.type == 'date'" |
| | | align="right" |
| | | v-model="item.value" |
| | | type="date" |
| | | :disabled="item.readonly" |
| | | size="medium" |
| | | placeholder="éæ©æ¥æ" |
| | | > |
| | | </el-date-picker> |
| | | <el-radio-group |
| | | :disabled="item.readonly" |
| | | v-else-if="item.type == 'radio'" |
| | | v-model="item.value" |
| | | > |
| | | <el-radio |
| | | v-for="item in item.data" |
| | | :key="item.key" |
| | | :label="item.value" |
| | | :value="item.key" |
| | | > |
| | | </el-radio> |
| | | <!-- <el-radio :label="1">æ¯</el-radio> |
| | | <el-radio :label="0">å¦</el-radio> --> |
| | | </el-radio-group> |
| | | |
| | | <el-checkbox-group |
| | | v-model="item.values" |
| | | :disabled="item.readonly" |
| | | style="width: 100%; display: inline-block" |
| | | v-else-if="item.type == 'checkbox'" |
| | | > |
| | | <el-checkbox |
| | | v-for="item in item.data" |
| | | :key="item.key" |
| | | :label="item.value" |
| | | :value="item.key" |
| | | > |
| | | </el-checkbox> |
| | | <!-- <el-checkbox label="å¤éæ¡ A"></el-checkbox> |
| | | <el-checkbox label="å¤éæ¡ B"></el-checkbox> |
| | | <el-checkbox label="å¤éæ¡ C"></el-checkbox> --> |
| | | </el-checkbox-group> |
| | | |
| | | <el-select |
| | | style="width: 100%" |
| | | :disabled="item.readonly" |
| | | v-model="item.value" |
| | | size="medium" |
| | | v-else-if="item.type == 'select'" |
| | | placeholder="è¯·éæ©" |
| | | > |
| | | <el-option |
| | | v-for="item in item.data" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <el-select |
| | | style="width: 100%" |
| | | :disabled="item.readonly" |
| | | v-model="item.values" |
| | | size="medium" |
| | | :multiple="true" |
| | | v-else-if="item.type == 'selectList'" |
| | | placeholder="è¯·éæ©" |
| | | > |
| | | <el-option |
| | | v-for="item in item.data" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <el-cascader |
| | | :disabled="item.readonly" |
| | | style="width: 100%" |
| | | v-else-if="item.type == 'cascader'" |
| | | v-model="item.values" |
| | | :options="item.data" |
| | | @change="() => {}" |
| | | ></el-cascader> |
| | | |
| | | <el-switch |
| | | :disabled="item.readonly" |
| | | v-model="item.value" |
| | | style="width: 100%" |
| | | v-else-if="item.type == 'switch'" |
| | | active-color="#13ce66" |
| | | inactive-color="#0e7ef3" |
| | | :active-value="1" |
| | | :inactive-value="0" |
| | | > |
| | | </el-switch> |
| | | <div class="col-line" v-else-if="item.type == 'line'"> |
| | | {{ item.name }} |
| | | </div> |
| | | |
| | | <vol-upload |
| | | v-else-if=" |
| | | item.type == 'img' || |
| | | item.type == 'excel' || |
| | | item.type == 'file' |
| | | " |
| | | :fileInfo="item.fileInfo" |
| | | :url="item.url" |
| | | :img="item.type == 'img'" |
| | | :excel="item.type == 'excel'" |
| | | :multiple="item.multiple" |
| | | :max-size="item.maxSize" |
| | | :max-file="item.maxFile" |
| | | :autoUpload="item.autoUpload" |
| | | > |
| | | </vol-upload> |
| | | <vol-wang-editor |
| | | v-else-if="item.type == 'editor'" |
| | | :url="item.url" |
| | | v-model="item.value" |
| | | :height="item.height" |
| | | ></vol-wang-editor> |
| | | |
| | | <vol-table |
| | | v-else-if="item.type == 'table'" |
| | | :url="item.url" |
| | | :load-key="true" |
| | | :index="item.edit" |
| | | :tableData="item.tableData" |
| | | :columns="item.columns" |
| | | :height="item.height" |
| | | :pagination-hide="true" |
| | | :column-index="item.columnIndex" |
| | | :ck="item.ck" |
| | | ></vol-table> |
| | | <el-button |
| | | @click="model = true" |
| | | v-else-if="item.type == 'box'" |
| | | type="primary" |
| | | size="small" |
| | | >{{ item.name }}</el-button |
| | | > |
| | | </el-col> |
| | | </el-form-item> |
| | | </div> |
| | | </transition-group> |
| | | </draggable> |
| | | </el-form> |
| | | </el-scrollbar> |
| | | </div> |
| | | <div class="drag-right"> |
| | | <div class="left-title">ç»ä»¶å±æ§</div> |
| | | <div class="attr" v-show="currentIndex != -1"> |
| | | <div class="attr-item"> |
| | | <div class="text">åæ®µåç§°</div> |
| | | <el-input size="medium" v-model="currentItem.name" /> |
| | | </div> |
| | | <div class="attr-item"> |
| | | <div class="text">åæ®µ(å¯ä¸å段)</div> |
| | | <el-input size="medium" v-model="currentItem.field" /> |
| | | </div> |
| | | <div class="attr-item" v-show="currentItem.type == 'table'"> |
| | | <div class="text">åå°è¿åæ°æ®æ¥å£å°å</div> |
| | | <el-input |
| | | size="medium" |
| | | placeholder="ä¾:api/表å/getPageData" |
| | | v-model="currentItem.url" |
| | | /> |
| | | </div> |
| | | <div |
| | | class="attr-item" |
| | | v-show=" |
| | | currentItem.type != 'table' && currentItem.hasOwnProperty('url') |
| | | " |
| | | > |
| | | <div class="text">ä¸ä¼ æ¥å£å°å(åå°æ¥å£)</div> |
| | | <el-input |
| | | size="medium" |
| | | placeholder="å¯ç¨æ¡æ¶å°å:api/表å/upload" |
| | | v-model="currentItem.url" |
| | | /> |
| | | <div class="text" style="margin-top: 10px">æä»¶å¤§å°éå¶(M)</div> |
| | | <el-input size="medium" v-model="currentItem.maxSize" /> |
| | | <div class="text" style="margin-top: 10px">æ¯å¦å¤æä»¶ä¸ä¼ </div> |
| | | <el-switch |
| | | v-model="currentItem.multiple" |
| | | style="width: 100%" |
| | | active-color="#13ce66" |
| | | inactive-color="rgb(165 165 165)" |
| | | :active-value="true" |
| | | :inactive-value="false" |
| | | > |
| | | </el-switch> |
| | | <div class="text" style="margin-top: 10px">æ¯å¦èªå¨ä¸ä¼ </div> |
| | | <el-switch |
| | | v-model="currentItem.autoUpload" |
| | | style="width: 100%" |
| | | active-color="#13ce66" |
| | | inactive-color="rgb(165 165 165)" |
| | | :active-value="true" |
| | | :inactive-value="false" |
| | | > |
| | | </el-switch> |
| | | </div> |
| | | <div class="attr-item" v-show="currentItem.data"> |
| | | <div class="text">æ°æ®æº(䏿æ¡ç»å®è®¾ç½®ä¸ç»´æ¤)</div> |
| | | |
| | | <!-- dicList --> |
| | | <el-select |
| | | style="width: 100%" |
| | | v-model="currentItem.key" |
| | | size="medium" |
| | | @change="dicChange" |
| | | placeholder="è¯·éæ©æ°æ®æºåå
¸" |
| | | > |
| | | <el-option |
| | | v-for="item in dicList" |
| | | :key="item.key" |
| | | :label="item.value" |
| | | :value="item.key" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="attr-item" v-show="currentItem.type != 'table'"> |
| | | <div class="text">æ ç¾å®½åº¦</div> |
| | | <el-slider |
| | | style="width: 90%" |
| | | :min="20" |
| | | v-model="colWidth" |
| | | :step="10" |
| | | show-stops |
| | | > |
| | | </el-slider> |
| | | </div> |
| | | <div class="attr-item attr2" v-show="currentItem.type != 'table'"> |
| | | <div> |
| | | <div class="text">å¿
å¡«</div> |
| | | <el-switch |
| | | v-model="currentItem.required" |
| | | style="width: 100%" |
| | | active-color="#13ce66" |
| | | inactive-color="rgb(165 165 165)" |
| | | :active-value="true" |
| | | :inactive-value="false" |
| | | > |
| | | </el-switch> |
| | | </div> |
| | | |
| | | <div> |
| | | <!-- active-text="æ¯" |
| | | inactive-text="å¦" --> |
| | | <div class="text">åªè¯»</div> |
| | | <el-switch |
| | | v-model="currentItem.readonly" |
| | | style="width: 100%" |
| | | active-color="#13ce66" |
| | | inactive-color="rgb(165 165 165)" |
| | | :active-value="true" |
| | | :inactive-value="false" |
| | | > |
| | | </el-switch> |
| | | </div> |
| | | </div> |
| | | <div v-show="currentItem.type == 'table'"> |
| | | <div class="attr-item"> |
| | | <div class="text">æ¯å¦ä½¿ç¨é项å¡(tabs)</div> |
| | | <div> |
| | | <el-switch |
| | | v-model="currentItem.tabs" |
| | | style="width: 100%" |
| | | active-text="æ¯" |
| | | inactive-text="å¦" |
| | | active-color="#13ce66" |
| | | inactive-color="rgb(165 165 165)" |
| | | :active-value="true" |
| | | :inactive-value="false" |
| | | > |
| | | </el-switch> |
| | | </div> |
| | | </div> |
| | | <div class="attr-item attr2"> |
| | | <el-button |
| | | style="width: 100%" |
| | | @click="openTableModel" |
| | | type="primary" |
| | | size="medium" |
| | | >tableé
ç½®</el-button |
| | | > |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <vol-box |
| | | v-model="model" |
| | | :height="300" |
| | | :width="550" |
| | | :lazy="true" |
| | | title="å¼¹åºæ¡" |
| | | > |
| | | <template #content> |
| | | <div>å¼¹åºæ¡å
容</div> |
| | | </template> |
| | | <template #footer> |
| | | <div> |
| | | <el-button type="primary" size="mini" @click="model = false" |
| | | ><i class="el-icon-close"></i>ç¹å»å
³é</el-button |
| | | > |
| | | <el-button size="mini" @click="model = false" |
| | | ><i class="el-icon-close"></i>å
³é</el-button |
| | | > |
| | | </div> |
| | | </template> |
| | | </vol-box> |
| | | |
| | | <vol-box |
| | | v-model="previewModel" |
| | | :height="600" |
| | | :width="1300" |
| | | :lazy="true" |
| | | :padding="1" |
| | | :close="false" |
| | | title="é¢è§" |
| | | > |
| | | <preview style="height:600px" :options="viewFormData"></preview> |
| | | </vol-box> |
| | | |
| | | <vol-box |
| | | v-model="tableModel" |
| | | :height="600" |
| | | :width="1300" |
| | | :lazy="true" |
| | | :padding="0" |
| | | :title="currentItem.name" |
| | | > |
| | | <template #content> |
| | | <div style="height:600px" > |
| | | <el-alert title="å
³äºtableé
ç½®" type="info" :closable="false" show-icon> |
| | | æ¤å¤tableæ¯å¯¹æ¡æ¶voltableåºæ¬æä½çé
ç½®,妿éè¦äºä»¶è§¦åãæ°æ®å è½½çæ´å¤åè½ï¼è¯·å¨çæåçä»£ç æ·»å éè¦çåè½ï¼å®æ´é
ç½®è§ææ¡£<a |
| | | href="http://v2.volcore.xyz/document/api" |
| | | style="color: #1e88e5; margin-left: 9px" |
| | | target="_blank" |
| | | >voltable</a |
| | | > |
| | | </el-alert> |
| | | <div class="btns"> |
| | | <div class="btns-left"> |
| | | è¡¨æ ¼é»è®¤åè½æé®ï¼ |
| | | <el-checkbox |
| | | v-for="item in currentItem.buttons" |
| | | :label="item.name" |
| | | :key="item.name" |
| | | >{{ item.name }}</el-checkbox |
| | | > |
| | | </div> |
| | | <div class="btns-right"> |
| | | <el-button type="primary" size="mini" @click="addRow" |
| | | ><i class="el-icon-plus"></i>æ·»å åæ®µ</el-button |
| | | > |
| | | <el-button type="primary" size="mini" @click="delRow" |
| | | ><i class="el-icon-delete"></i>å é¤å段</el-button |
| | | > |
| | | <el-button type="primary" size="mini" @click="sortRow" |
| | | ><i class="el-icon-sort"></i>éæ°æå</el-button |
| | | > |
| | | </div> |
| | | </div> |
| | | <vol-table |
| | | :load-key="true" |
| | | :tableData="currnetTableData" |
| | | :columns="currentTableOption" |
| | | :height="448" |
| | | ref="table" |
| | | :index="true" |
| | | :pagination-hide="true" |
| | | :column-index="true" |
| | | :ck="true" |
| | | ></vol-table> |
| | | </div> |
| | | </template> |
| | | <template #footer> |
| | | <div style="text-align: center"> |
| | | <el-button size="mini" @click="tableModel = false" |
| | | ><i class="el-icon-close"></i>å
³é</el-button |
| | | > |
| | | <el-button type="primary" size="mini" @click="saveConfigOptions" |
| | | ><i class="el-icon-check"></i>ä¿å</el-button |
| | | > |
| | | </div> |
| | | </template> |
| | | </vol-box> |
| | | </template> |
| | | |
| | | <script> |
| | | import { h, resolveComponent } from "vue"; |
| | | // import draggable from "vuedraggable"; |
| | | import { VueDraggableNext } from "vue-draggable-next"; |
| | | import VolWangEditor from "@/components/editor/VolWangEditor.vue"; |
| | | import VolUpload from "./../VolUpload"; |
| | | import VolTable from "./../VolTable"; |
| | | import VolBox from "./../VolBox"; |
| | | import VolFormPreview from "./VolFormPreview"; |
| | | import { components, tableOption } from "./options"; |
| | | import { options1, options2, options3 } from "./formTemplate"; |
| | | import downloadForm from "./DownloadForm"; |
| | | export default { |
| | | props: { |
| | | userComponents: { |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | }, |
| | | }, |
| | | }, |
| | | components: { |
| | | draggable: VueDraggableNext, |
| | | "vol-upload": VolUpload, |
| | | "vol-wang-editor": VolWangEditor, |
| | | "vol-table": VolTable, |
| | | "vol-box": VolBox, |
| | | preview: VolFormPreview, |
| | | }, |
| | | data() { |
| | | return { |
| | | options:{}, |
| | | options1: options1, |
| | | options2: options2, |
| | | options3: options3, |
| | | colWidth: 100, |
| | | currentIndex: -1, |
| | | currentItem: {}, |
| | | currnetTableData: [], |
| | | currentTableOption: tableOption, |
| | | //å®ä¹è¦è¢«ææ½å¯¹è±¡çæ°ç» |
| | | components: components, |
| | | currentComponents: [], |
| | | dicList: [], |
| | | model: false, |
| | | tableModel: false, |
| | | previewModel: false, |
| | | viewFormData: { fields: {}, formOptions: [], tables: [] }, |
| | | }; |
| | | }, |
| | | watch: { |
| | | colWidth(newVal) { |
| | | if (this.currentIndex != -1) { |
| | | this.currentComponents[this.currentIndex].width = newVal; |
| | | } |
| | | }, |
| | | userComponents: { |
| | | handler(newVal) { |
| | | this.currentComponents = newVal; |
| | | }, |
| | | immediate: true, |
| | | deep: true, |
| | | }, |
| | | }, |
| | | created() { |
| | | this.currentComponents = this.userComponents; |
| | | this.http |
| | | .post("api/Sys_Dictionary/GetBuilderDictionary", {}, false) |
| | | .then((x) => { |
| | | this.dicList = x.map((c) => { |
| | | return { key: c, value: c }; |
| | | }); |
| | | }); |
| | | }, |
| | | methods: { |
| | | getFormOptions(item) { |
| | | let _option = {}; |
| | | _option.field = item.field; |
| | | _option.title = item.name; |
| | | _option.type = item.type; |
| | | _option.required = item.required; |
| | | _option.readonly = item.readonly; |
| | | if (item.type == "line") { |
| | | _option.title = ""; |
| | | let title = item.name; |
| | | _option.render = (h) => { |
| | | return h( |
| | | "div", |
| | | { |
| | | style: { |
| | | "line-height": "25px", |
| | | "font-weight": "bold", |
| | | "margin-left": "15px", |
| | | "border-bottom": "1px solid #dadada", |
| | | }, |
| | | }, |
| | | title |
| | | //ä¹å¯ä»¥å¨è¿éæ¾ä¸äºç»ä»¶ï¼ä¾å¦ï¼ |
| | | // resolveComponent("el-tooltip"), |
| | | // { |
| | | // content: "è¿éæ¯æç¤ºçå
容", |
| | | // props: { effect: "dark", placement: "top-start" }, |
| | | // style: {}, |
| | | // }, |
| | | // [h("a", { style: { color: "#2a92ff" } }, "æç¤ºä¿¡æ¯")] |
| | | ); |
| | | }; |
| | | } |
| | | if (item.type == "editor") { |
| | | _option.height = item.height; |
| | | } |
| | | if (item.width == 100) { |
| | | _option.colSize = 12; |
| | | } else { |
| | | _option.colSize = (_option.width * 12) / 100; |
| | | } |
| | | if (["img", "excel", "file"].indexOf(item.type) != -1) { |
| | | _option.maxSize = item.maxSize; |
| | | _option.fileInfo = item.fileInfo; |
| | | _option.multiple = item.multiple; |
| | | _option.autoUpload = item.autoUpload; |
| | | _option.maxFile = item.maxFile; |
| | | } |
| | | if ( |
| | | ["img", "excel", "file", "editor", "table"].indexOf(item.type) != -1 |
| | | ) { |
| | | _option.url = item.url; |
| | | } |
| | | if (item.data) { |
| | | _option.data = item.data; |
| | | _option.dataKey = item.key; |
| | | } |
| | | return _option; |
| | | }, |
| | | getLineFormOptions(index) { |
| | | let _index = index; |
| | | let endIndex = index; |
| | | let width = 0; |
| | | let _options = []; |
| | | for (index; index < this.filterCurrentComponents().length; index++) { |
| | | const item = this.currentComponents[index]; |
| | | if (item.width + width <= 100) { |
| | | width = item.width + width; |
| | | endIndex = index; |
| | | _options.push(this.getFormOptions(item)); |
| | | } |
| | | } |
| | | return { options: _options, index: _index, endIndex: endIndex }; |
| | | }, |
| | | filterCurrentComponents() { |
| | | return this.currentComponents.filter((x) => { |
| | | return x.type != "table"; |
| | | }); |
| | | }, |
| | | setSpan() {}, |
| | | preview(isPre) { |
| | | let _fields = {}; |
| | | let _formOptions = []; |
| | | let endIndex = -1; |
| | | this.filterCurrentComponents().forEach((item, index) => { |
| | | if (item.hasOwnProperty("values")) { |
| | | _fields[item.field] = []; |
| | | } else { |
| | | _fields[item.field] = null; |
| | | } |
| | | |
| | | if (item.width == 100) { |
| | | _formOptions.push([this.getFormOptions(item)]); |
| | | } else { |
| | | if (endIndex == -1) { |
| | | let lineOptions = this.getLineFormOptions(index); |
| | | endIndex = lineOptions.endIndex; |
| | | _formOptions.push(lineOptions.options); |
| | | endIndex--; |
| | | } else { |
| | | endIndex--; |
| | | } |
| | | } |
| | | // _fields[item.field] = null;xc |
| | | // let _option = {}; |
| | | // _option.field = item.field; |
| | | // _option.title = item.name; |
| | | // _option.type = item.type; |
| | | // _option.required = item.required; |
| | | // _option.readonly = item.readonly; |
| | | // if (["img", "excel", "file"].indexOf(item.type) != -1) { |
| | | // _option.maxSize = item.maxSize; |
| | | // _option.fileInfo = item.fileInfo; |
| | | // _option.multiple = item.multiple; |
| | | // _option.autoUpload = item.autoUpload; |
| | | // _option.maxFile = item.maxFile; |
| | | // } |
| | | // if ( |
| | | // ["img", "excel", "file", "editor", "table"].indexOf(item.type) != -1 |
| | | // ) { |
| | | // _option.url = item.url; |
| | | // } |
| | | // if (item.data) { |
| | | // _option.data = item.data; |
| | | // _option.dataKey = item.key; |
| | | // } |
| | | // _formOptions.push(_option); |
| | | }); |
| | | this.viewFormData.fields = _fields; |
| | | // console.log(JSON.stringify(_formOptions)) |
| | | this.viewFormData.formOptions = _formOptions; |
| | | if (isPre) { |
| | | this.previewModel = true; |
| | | } |
| | | let tableIndex = 0; |
| | | let keys = []; |
| | | let tables = this.currentComponents |
| | | .filter((x) => { |
| | | return x.type == "table"; |
| | | }) |
| | | .map((m) => { |
| | | m.pagination = !m.url; |
| | | if (m.name == "è¡¨æ ¼") { |
| | | tableIndex++; |
| | | } |
| | | return { |
| | | name: m.name + (m.name == "è¡¨æ ¼" ? tableIndex : ""), |
| | | url: m.url, |
| | | tabs: m.tabs, |
| | | pagination: m.pagination, |
| | | buttons: m.buttons, |
| | | columns: m.columns.map((c) => { |
| | | let obj = { |
| | | title: c.title, |
| | | field: c.field, |
| | | hidden: !c.show, |
| | | width: c.width, |
| | | required: c.required, |
| | | }; |
| | | |
| | | if (c.dataSource) { |
| | | obj.bind = { key: c.dataSource, data: [] }; |
| | | } |
| | | if (c.dataSource) { |
| | | keys.push(c.dataSource); |
| | | } |
| | | if (c.edit) { |
| | | if (!obj.bind) { |
| | | obj.bind = { key: "", data: [] }; |
| | | } |
| | | obj.edit = { type: c.editType }; |
| | | } |
| | | return obj; |
| | | }), |
| | | tableData: [{}, {}, {}], |
| | | }; |
| | | }); |
| | | this.viewFormData.tables = tables.filter((x) => { |
| | | return !x.tabs; |
| | | }); |
| | | this.viewFormData.tabs = tables.filter((x) => { |
| | | return x.tabs; |
| | | }); |
| | | this.getDicKeys(keys); |
| | | this.options = this.viewFormData; |
| | | }, |
| | | getDicKeys(keys) { |
| | | if (!keys.length) { |
| | | return; |
| | | } |
| | | debugger |
| | | this.http |
| | | .post("api/Sys_Dictionary/GetVueDictionary", keys, true) |
| | | .then((result) => { |
| | | result.forEach((c) => { |
| | | this.viewFormData.tables.forEach((t) => { |
| | | let _option = t.columns.find((x) => { |
| | | return x.bind && x.bind.key == c.dicNo; |
| | | }); |
| | | if (_option) { |
| | | _option.bind.data = c.data; |
| | | } |
| | | }); |
| | | this.viewFormData.tabs.forEach((t) => { |
| | | let _option = t.columns.find((x) => { |
| | | return x.bind && x.bind.key == c.dicNo; |
| | | }); |
| | | if (_option) { |
| | | _option.bind.data = c.data; |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | }, |
| | | save() { |
| | | this.preview(false); |
| | | this.$emit("save", { |
| | | daraggeOptions: this.currentComponents, |
| | | formOptions: this.viewFormData, |
| | | }); |
| | | }, |
| | | download() { |
| | | this.preview(false); |
| | | downloadForm.call(this); |
| | | }, |
| | | openTableModel() { |
| | | let dataSource = this.currentTableOption.find((x) => { |
| | | return x.field == "dataSource"; |
| | | }); |
| | | if (!dataSource.bind.data.length) { |
| | | dataSource.bind.data = this.dicList; |
| | | } |
| | | this.currnetTableData = JSON.parse( |
| | | JSON.stringify(this.currentItem.columns) |
| | | ); |
| | | this.tableModel = true; |
| | | }, |
| | | addRow() { |
| | | this.currnetTableData.push({ field: this.getField() }); |
| | | }, |
| | | delRow() { |
| | | this.$confirm("确认è¦å é¤éæ©çæ°æ®å?", "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | center: true, |
| | | }).then(() => { |
| | | this.$refs.table.delRow(); |
| | | }); |
| | | }, |
| | | sortRow() { |
| | | this.currnetTableData = this.currnetTableData.sort((a, b) => { |
| | | return a.orderNo - b.orderNo; |
| | | }); //.reverse(); |
| | | this.$Message.success("åæ¾ç¤ºé¡ºåºå·²éæ°æå,ç¹å»é¢è§å¯æ¥ç"); |
| | | }, |
| | | saveConfigOptions() { |
| | | this.currentItem.columns = JSON.parse( |
| | | JSON.stringify(this.currnetTableData) |
| | | ); |
| | | this.tableModel = false; |
| | | }, |
| | | copyItem(item) { |
| | | let itemClone = JSON.parse(JSON.stringify(item)); |
| | | itemClone.field = "field" + new Date().valueOf(); |
| | | this.currentComponents.push(itemClone); |
| | | }, |
| | | removeItem(index) { |
| | | this.currentComponents.splice(index, 1); |
| | | this.colWidth = 100; |
| | | this.currentIndex = -1; |
| | | this.currentItem = {}; |
| | | }, |
| | | clearItems() { |
| | | this.currentComponents.length = 0; |
| | | this.colWidth = 100; |
| | | this.currentIndex = -1; |
| | | this.currentItem = {}; |
| | | }, |
| | | itemClick(item, index) { |
| | | this.currentIndex = index; |
| | | this.colWidth = this.currentComponents[this.currentIndex].width; |
| | | this.currentItem = this.currentComponents[this.currentIndex]; |
| | | }, |
| | | //å¼å§ææ½äºä»¶ |
| | | onStart(e, e1) { |
| | | this.drag = true; |
| | | }, |
| | | getField() { |
| | | return "field" + new Date().valueOf(); |
| | | }, |
| | | //左边å¾å³è¾¹æå¨æ¶çäºä»¶ |
| | | end1(e) { |
| | | if (1 == 1 && e.from !== e.to) { |
| | | let obj = JSON.parse(JSON.stringify(this.components[e.oldIndex])); |
| | | obj.field = this.getField(); |
| | | obj.width = 100; |
| | | obj.readonly = false; |
| | | obj.required = false; |
| | | this.currentComponents.splice(e.newIndex, 1, obj); |
| | | this.userComponents.splice(0); |
| | | this.userComponents.push(...this.currentComponents); |
| | | // this.currentComponents = this.currentComponents.filter((x) => { |
| | | // return x.hasOwnProperty("field"); |
| | | // }); |
| | | this.colWidth = 100; |
| | | this.currentIndex = e.newIndex; //this.currentComponents.length - 1; |
| | | this.currentItem = this.currentComponents[this.currentIndex]; |
| | | } |
| | | }, |
| | | //å³è¾¹å¾å·¦è¾¹æå¨æ¶çäºä»¶ |
| | | end2(e) {}, |
| | | onMove1(e, originalEvent) { |
| | | // this.moveId = e.relatedContext.element.id; |
| | | return true; |
| | | }, |
| | | //moveåè°æ¹æ³ |
| | | onMove(e, originalEvent) { |
| | | console.log(JSON.stringify(this.currentComponents)); |
| | | return true; |
| | | }, |
| | | dicChange(key) { |
| | | debugger |
| | | this.http |
| | | .post("api/Sys_Dictionary/GetVueDictionary", [key], true) |
| | | .then((result) => { |
| | | this.currentItem.data = result[0].data; |
| | | if (result[0].data.length) { |
| | | if (this.currentItem.type == "select") { |
| | | this.currentItem.value = result[0].data[0].value; |
| | | } else { |
| | | this.currentItem.values = [result[0].data[0].value]; |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | example1() { |
| | | this.currentComponents = this.options1; |
| | | }, |
| | | example2() { |
| | | this.currentComponents = this.options2; |
| | | }, |
| | | example3() { |
| | | this.currentComponents = this.options3; |
| | | }, |
| | | }, |
| | | computed: { |
| | | tabsTable() { |
| | | return this.currentComponents.filter((x) => { |
| | | return x.type == "table" && x.tabs == true; |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | * { |
| | | box-sizing: border-box; |
| | | } |
| | | .drag-container { |
| | | /* padding: 20px; */ |
| | | display: flex; |
| | | height: 100%; |
| | | position: absolute; |
| | | width: 100%; |
| | | box-sizing: border-box; |
| | | } |
| | | .drag-left { |
| | | width: 250px; |
| | | display: flex; |
| | | border-right: 1px solid #eee; |
| | | flex-direction: column; |
| | | } |
| | | .left-title { |
| | | height: 42px; |
| | | text-align: left; |
| | | border-right: 1px solid #eee; |
| | | padding: 10px 0 10px 11px; |
| | | border-bottom: 1px solid #eee; |
| | | } |
| | | .drag-center { |
| | | display: flex; |
| | | flex-direction: column; |
| | | flex: 1; |
| | | } |
| | | .left-draggable-item { |
| | | // flex: 1; |
| | | display: inline-block; |
| | | padding: 5px; |
| | | // border-right: 1px solid #eee; |
| | | } |
| | | |
| | | .left-draggable-item .item { |
| | | cursor: move; |
| | | float: left; |
| | | width: 111px; |
| | | /* height: 20px; */ |
| | | text-align: center; |
| | | border: 1px solid #eeeeee; |
| | | padding: 2px 13px; |
| | | text-align: left; |
| | | line-height: 28px; |
| | | margin: 4px; |
| | | border-radius: 3px; |
| | | background: #f0f9eb; |
| | | font-size: 13px; |
| | | } |
| | | // .drag-center-item { |
| | | // display: inline-block; |
| | | // width: 100%; |
| | | // height: calc(100vh - 122px); |
| | | // padding: 10px; |
| | | // } |
| | | .draggable-container { |
| | | display: inline-block; |
| | | width: 100%; |
| | | height: calc(100vh - 215px); |
| | | padding: 10px 0; |
| | | } |
| | | |
| | | .item2 { |
| | | position: relative; |
| | | cursor: move; |
| | | padding: 18px 10px 10px 10px; |
| | | text-align: left; |
| | | float: left; |
| | | margin-bottom: 10px; |
| | | } |
| | | .item2 .el-icon-delete, |
| | | .item2 .el-icon-document-copy { |
| | | position: absolute; |
| | | right: 10px; |
| | | top: 2px; |
| | | padding: 5px; |
| | | display: none; |
| | | color: red; |
| | | cursor: pointer; |
| | | } |
| | | .item2 .el-icon-document-copy { |
| | | right: 35px; |
| | | } |
| | | .item2:hover, |
| | | .actived { |
| | | background: #f0f9eb; |
| | | } |
| | | .item:hover { |
| | | border: 1px dashed #787be8; |
| | | color: #787be8; |
| | | } |
| | | .item2:hover .el-icon-delete, |
| | | .item2:hover .el-icon-document-copy { |
| | | display: block; |
| | | } |
| | | |
| | | .drag-right { |
| | | background: #f7fbff3d; |
| | | width: 250px; |
| | | border-left: 1px solid #eee; |
| | | } |
| | | |
| | | .center-top { |
| | | height: 42px; |
| | | line-height: 41px; |
| | | background: #f2f5fb; |
| | | border-bottom: 1px solid #eee; |
| | | text-align: left; |
| | | padding: 0 10px; |
| | | font-size: 12px; |
| | | color: #3391f3; |
| | | } |
| | | .center-top span { |
| | | margin-right: 10px; |
| | | } |
| | | .attr { |
| | | padding: 0px 15px 15px 15px; |
| | | } |
| | | .attr-item { |
| | | text-align: left; |
| | | margin-top: 12px; |
| | | font-size: 14px; |
| | | } |
| | | .attr-item .text { |
| | | padding: 0 0 5px 5px; |
| | | } |
| | | .attr2 { |
| | | display: flex; |
| | | } |
| | | .attr2 > div { |
| | | flex: 1; |
| | | } |
| | | .tips { |
| | | position: absolute; |
| | | font-size: 26px; |
| | | letter-spacing: 6px; |
| | | left: 0px; |
| | | right: 0px; |
| | | top: 150px; |
| | | width: 500px; |
| | | margin: auto; |
| | | color: #c5c5c5; |
| | | } |
| | | .col-line { |
| | | line-height: 25px; |
| | | font-weight: bold; |
| | | border-bottom: 1px solid rgb(218 218 218); |
| | | } |
| | | .drag-container ::v-deep(.el-col) { |
| | | width: 100%; |
| | | } |
| | | .drag-center ::v-deep(.el-form-item__label) { |
| | | line-height: 0 !important; |
| | | } |
| | | .drag-center ::v-deep(.el-scrollbar__wrap) { |
| | | overflow-x: hidden; |
| | | } |
| | | .drag-center ::v-deep(.el-form-item) { |
| | | margin-bottom: 10px; |
| | | } |
| | | .drag-center ::v-deep(.el-date-editor) { |
| | | width: 100%; |
| | | } |
| | | .drag-center ::v-deep(.el-checkbox) { |
| | | margin-right: 15px; |
| | | } |
| | | .drag-center ::v-deep(.el-checkbox__label) { |
| | | padding-left: 5px; |
| | | } |
| | | .drag-center ::v-deep(.hello > div) { |
| | | z-index: 500 !important; |
| | | } |
| | | .drag-center ::v-deep(th), |
| | | .drag-center ::v-deep(td) { |
| | | padding: 6px 0; |
| | | } |
| | | .example { |
| | | margin-top: 8px; |
| | | > div { |
| | | cursor: pointer; |
| | | padding: 14px 20px; |
| | | border-top: 1px solid #eee; |
| | | font-size: 13px; |
| | | color: #646465; |
| | | position: relative; |
| | | } |
| | | > div:hover { |
| | | background: rgb(231, 231, 231); |
| | | } |
| | | i { |
| | | position: absolute; |
| | | right: 20px; |
| | | } |
| | | } |
| | | .btns { |
| | | padding: 8px 0; |
| | | display: flex; |
| | | > div { |
| | | flex: 1; |
| | | } |
| | | .btns-left { |
| | | padding-top: 8px; |
| | | color: black; |
| | | font-weight: bold; |
| | | } |
| | | .btns-right { |
| | | text-align: right; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="padding: 15px 20px 15px 5px"> |
| | | <div class="pre-text">{{ text }}</div> |
| | | <vol-form |
| | | ref="form" |
| | | :labelWidth="80" |
| | | :load-key="false" |
| | | :formFields="options.fields" |
| | | :formRules="options.formOptions" |
| | | > |
| | | </vol-form> |
| | | <div class="tables"> |
| | | <div |
| | | class="table-item" |
| | | v-for="(item, index) in options.tables" |
| | | :key="index" |
| | | > |
| | | <div class="table-header"> |
| | | <div class="header-text"> |
| | | {{ item.name }} |
| | | </div> |
| | | <div class="header-btns"> |
| | | <el-button |
| | | type="primary" |
| | | size="small" |
| | | :key="bindex" |
| | | plain |
| | | @click="tableBtnClick(item, bindex, index)" |
| | | :icon="btnItem.icon" |
| | | v-for="(btnItem, bindex) in item.buttons" |
| | | > |
| | | {{ btnItem.name }} |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <vol-table |
| | | :url="item.url" |
| | | :load-key="false" |
| | | :index="true" |
| | | :ref="'table' + index" |
| | | :tableData="item.tableData" |
| | | :columns="item.columns" |
| | | :max-height="250" |
| | | :pagination-hide="item.pagination" |
| | | :column-index="true" |
| | | :ck="true" |
| | | ></vol-table> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="tables" style="padding-bottom: 10px"> |
| | | <el-tabs |
| | | v-model="tabsModel" |
| | | v-show="options.tabs.length" |
| | | @tab-click="() => {}" |
| | | > |
| | | <el-tab-pane |
| | | style="padding: 0" |
| | | class="table-item" |
| | | v-for="(item, index) in options.tabs" |
| | | :label="item.name" |
| | | :name="index" |
| | | :key="index" |
| | | > |
| | | <div class="table-header"> |
| | | <div class="header-text"> |
| | | {{ item.name }} |
| | | </div> |
| | | <div class="header-btns"> |
| | | <el-button |
| | | type="primary" |
| | | size="small" |
| | | :key="bindex" |
| | | :icon="btnItem.icon" |
| | | plain |
| | | @click="tabsTableBtnClick(item, bindex, index)" |
| | | v-for="(btnItem, bindex) in item.buttons" |
| | | > |
| | | {{ btnItem.name }} |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <vol-table |
| | | :url="item.url" |
| | | :load-key="false" |
| | | :index="true" |
| | | :ref="'tabsTable' + index" |
| | | :tableData="item.tableData" |
| | | :columns="item.columns" |
| | | :max-height="250" |
| | | :pagination-hide="item.pagination" |
| | | :column-index="true" |
| | | :ck="true" |
| | | ></vol-table> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | |
| | | <div class="form-btns"> |
| | | <el-button type="primary" @click="submit" icon="el-icon-check" size="small" |
| | | >æäº¤</el-button |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | @click="reset" |
| | | plain |
| | | icon="el-icon-refresh-right" |
| | | size="small" |
| | | >éç½®</el-button |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | @click="download" |
| | | plain |
| | | icon="el-icon-refresh-right" |
| | | size="small" |
| | | >ä¸è½½ä»£ç </el-button |
| | | > |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolTable from "./../VolTable"; |
| | | import VolBox from "./../VolBox"; |
| | | import VolForm from "./../VolForm"; |
| | | import downloadForm from "./DownloadForm"; |
| | | export default { |
| | | props: { |
| | | options: { |
| | | type: Object, |
| | | default: () => { |
| | | return { fields: {}, formOptions: [], tables: [], tabs: [] }; |
| | | }, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | text: "", |
| | | tabsModel: 0, |
| | | }; |
| | | }, |
| | | created() {}, |
| | | methods: { |
| | | tableBtnClick(item, btnIndex, index) { |
| | | if (item.buttons[btnIndex].value == "add") { |
| | | this.$refs["table" + index].addRow({}); |
| | | return; |
| | | } |
| | | if (item.buttons[btnIndex].value == "del") { |
| | | this.$refs["table" + index].delRow(); |
| | | return; |
| | | } |
| | | }, |
| | | tabsTableBtnClick(item, btnIndex, index) { |
| | | if (item.buttons[btnIndex].value == "add") { |
| | | this.$refs["tabsTable" + index].addRow({}); |
| | | return; |
| | | } |
| | | if (item.buttons[btnIndex].value == "del") { |
| | | this.$refs["tabsTable" + index].delRow(); |
| | | return; |
| | | } |
| | | }, |
| | | submit() {}, |
| | | reset() { |
| | | this.$refs.form.reset(); |
| | | this.$Message.success("表åå·²éç½®"); |
| | | }, |
| | | download() { |
| | | downloadForm.call(this); |
| | | }, |
| | | }, |
| | | components: { |
| | | "vol-table": VolTable, |
| | | "vol-box": VolBox, |
| | | "vol-form": VolForm, |
| | | }, |
| | | }; |
| | | |
| | | VolForm; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .form-btns { |
| | | text-align: center; |
| | | } |
| | | .tables { |
| | | padding-left: 15px; |
| | | .table-item { |
| | | padding: 10px; |
| | | } |
| | | .table-header { |
| | | display: flex; |
| | | margin-bottom: 8px; |
| | | } |
| | | .header-text { |
| | | position: relative; |
| | | bottom: -9px; |
| | | flex: 1; |
| | | font-weight: bold; |
| | | } |
| | | .header-btns { |
| | | text-align: right; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | |
| | | let options1 = [ |
| | | { |
| | | "id": 1, |
| | | "name": "è¾å
¥æ¡", |
| | | "type": "text", |
| | | "value": "", |
| | | "icon": "el-icon-document", |
| | | "field": "field1630258884671", |
| | | "width": 20, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 3, |
| | | "name": "æ¥æ", |
| | | "type": "date", |
| | | "icon": "el-icon-date", |
| | | "value": null, |
| | | "field": "field1630258891760", |
| | | "width": 20, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 7, |
| | | "name": "䏿æ¡", |
| | | "value": null, |
| | | "key": "", |
| | | "data": [ |
| | | { |
| | | "label": "è¯·è®¾ç½®æ°æ®æº", |
| | | "value": "è¯·è®¾ç½®æ°æ®æº" |
| | | } |
| | | ], |
| | | "type": "select", |
| | | "icon": "el-icon-arrow-down", |
| | | "field": "field1630258904862", |
| | | "width": 30, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 8, |
| | | "name": "䏿å¤é", |
| | | "type": "selectList", |
| | | "key": "", |
| | | "values": [], |
| | | "data": [ |
| | | { |
| | | "label": "è¯·è®¾ç½®æ°æ®æº", |
| | | "value": "è¯·è®¾ç½®æ°æ®æº" |
| | | } |
| | | ], |
| | | "icon": "el-icon-arrow-down", |
| | | "field": "field1630258924442", |
| | | "width": 30, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 81, |
| | | "name": "级è", |
| | | "type": "cascader", |
| | | "icon": "el-icon-share", |
| | | "values": [], |
| | | "key": "", |
| | | "data": [ |
| | | { |
| | | "value": "请é
ç½®æ°æ®æº", |
| | | "label": "请é
ç½®æ°æ®æº", |
| | | "children": [ |
| | | { |
| | | "value": "å
·ä½", |
| | | "label": "èå:䏿æ¡ç»å®è®¾ç½®" |
| | | }, |
| | | { |
| | | "value": "color", |
| | | "label": "å¯åç
§åå
¸ç¼å·[tree_roles]" |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | "field": "field1630259518082", |
| | | "width": 20, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 6, |
| | | "name": "å¤é", |
| | | "values": [ |
| | | "åè´§" |
| | | ], |
| | | "type": "checkbox", |
| | | "key": "ordertype", |
| | | "data": [ |
| | | { |
| | | "key": "1", |
| | | "value": "åè´§" |
| | | }, |
| | | { |
| | | "key": "2", |
| | | "value": "éè´§" |
| | | }, |
| | | { |
| | | "key": "3", |
| | | "value": "è¿å" |
| | | } |
| | | ], |
| | | "icon": "el-icon-circle-check", |
| | | "field": "field1630259033241", |
| | | "width": 30, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 5, |
| | | "name": "åé", |
| | | "type": "radio", |
| | | "icon": "el-icon-aim", |
| | | "value": 0, |
| | | "data": [ |
| | | { |
| | | "key": "0", |
| | | "value": "å¦" |
| | | }, |
| | | { |
| | | "key": "2", |
| | | "value": "xx11" |
| | | }, |
| | | { |
| | | "key": "1", |
| | | "value": "æ¯" |
| | | } |
| | | ], |
| | | "key": "enable", |
| | | "field": "field1630259538490", |
| | | "width": 30, |
| | | "readonly": false, |
| | | "required": false, |
| | | "values": [ |
| | | "å¦" |
| | | ] |
| | | }, |
| | | { |
| | | "id": 4, |
| | | "name": "switch", |
| | | "type": "switch", |
| | | "icon": "el-icon-turn-off", |
| | | "value": 0, |
| | | "field": "field1630259172794", |
| | | "width": 20, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 12, |
| | | "name": "åæ®µä¿¡æ¯", |
| | | "type": "line", |
| | | "icon": "el-icon-guide", |
| | | "field": "field1630259600186", |
| | | "width": 100, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 9, |
| | | "name": "å¾ç", |
| | | "type": "img", |
| | | "url": "api/SellOrder/upload", |
| | | "maxSize": 3, |
| | | "fileInfo": [], |
| | | "multiple": false, |
| | | "autoUpload": false, |
| | | "maxFile": 5, |
| | | "icon": "el-icon-picture-outline", |
| | | "field": "field1630259295154", |
| | | "width": 100, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 10, |
| | | "name": "excel", |
| | | "url": "api/SellOrder/upload", |
| | | "maxSize": 3, |
| | | "multiple": false, |
| | | "autoUpload": true, |
| | | "maxFile": 5, |
| | | "fileInfo": [], |
| | | "type": "excel", |
| | | "icon": "el-icon-upload", |
| | | "field": "field1630259610476", |
| | | "width": 100, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 5, |
| | | "name": "åé", |
| | | "type": "radio", |
| | | "icon": "el-icon-aim", |
| | | "value": 0, |
| | | "data": [ |
| | | { |
| | | "key": "0", |
| | | "value": "å®¡æ ¸ä¸" |
| | | }, |
| | | { |
| | | "key": "1", |
| | | "value": "å®¡æ ¸éè¿" |
| | | }, |
| | | { |
| | | "key": "2", |
| | | "value": "å®¡æ ¸æªéè¿" |
| | | } |
| | | ], |
| | | "key": "audit", |
| | | "field": "field1630258969346", |
| | | "width": 40, |
| | | "readonly": false, |
| | | "required": false, |
| | | "values": [ |
| | | "å®¡æ ¸ä¸" |
| | | ] |
| | | } |
| | | ]; |
| | | let options2=[ |
| | | { |
| | | "id": 1, |
| | | "name": "è¾å
¥æ¡", |
| | | "type": "text", |
| | | "value": "", |
| | | "icon": "el-icon-document", |
| | | "field": "field1630258884671", |
| | | "width": 20, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 3, |
| | | "name": "æ¥æ", |
| | | "type": "date", |
| | | "icon": "el-icon-date", |
| | | "value": null, |
| | | "field": "field1630258891760", |
| | | "width": 20, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 7, |
| | | "name": "䏿æ¡", |
| | | "value": null, |
| | | "key": "", |
| | | "data": [ |
| | | { |
| | | "label": "è¯·è®¾ç½®æ°æ®æº", |
| | | "value": "è¯·è®¾ç½®æ°æ®æº" |
| | | } |
| | | ], |
| | | "type": "select", |
| | | "icon": "el-icon-arrow-down", |
| | | "field": "field1630258904862", |
| | | "width": 30, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 8, |
| | | "name": "䏿å¤é", |
| | | "type": "selectList", |
| | | "key": "", |
| | | "values": [], |
| | | "data": [ |
| | | { |
| | | "label": "è¯·è®¾ç½®æ°æ®æº", |
| | | "value": "è¯·è®¾ç½®æ°æ®æº" |
| | | } |
| | | ], |
| | | "icon": "el-icon-arrow-down", |
| | | "field": "field1630258924442", |
| | | "width": 30, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 2, |
| | | "name": "textarea", |
| | | "type": "textarea", |
| | | "value": "", |
| | | "icon": "el-icon-document-copy", |
| | | "field": "field1630260207393", |
| | | "width": 100, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 13, |
| | | "name": "è¡¨æ ¼", |
| | | "type": "table", |
| | | "tabs": true, |
| | | "columns": [ |
| | | { |
| | | "title": "è¿åå·", |
| | | "field": "TranNo", |
| | | "show": true, |
| | | "required": false, |
| | | "edit": true, |
| | | "dataType": null, |
| | | "dataSource": null, |
| | | "width": "140", |
| | | "orderNo": null, |
| | | "elementIndex": 0 |
| | | }, |
| | | { |
| | | "title": "éå®è®¢åå·", |
| | | "field": "SellNo", |
| | | "show": true, |
| | | "required": false, |
| | | "edit": true, |
| | | "dataType": null, |
| | | "dataSource": null, |
| | | "width": "140", |
| | | "orderNo": null, |
| | | "elementIndex": 1 |
| | | }, |
| | | { |
| | | "title": "订åç±»å", |
| | | "field": "OrderType", |
| | | "show": true, |
| | | "required": false, |
| | | "edit": true, |
| | | "dataType": null, |
| | | "dataSource": "ordertype", |
| | | "width": 120, |
| | | "orderNo": null, |
| | | "elementIndex": 2, |
| | | "editType": "select" |
| | | }, |
| | | { |
| | | "title": "é宿°é", |
| | | "field": "Qty", |
| | | "show": true, |
| | | "required": false, |
| | | "edit": true, |
| | | "dataType": null, |
| | | "dataSource": null, |
| | | "width": "80", |
| | | "orderNo": null, |
| | | "elementIndex": 3 |
| | | }, |
| | | { |
| | | "field": "CreateDate", |
| | | "elementIndex": 4, |
| | | "show": 1, |
| | | "required": 0, |
| | | "edit": 0, |
| | | "title": "è®¢åæ¶é´", |
| | | "dataType": "date", |
| | | "width": "100" |
| | | } |
| | | ], |
| | | "tableData": [ |
| | | { |
| | | "field1": "field1", |
| | | "field2": "field2", |
| | | "field3": "field3", |
| | | "field4": "field4" |
| | | }, |
| | | { |
| | | "field1": "field1", |
| | | "field2": "field2", |
| | | "field3": "field3", |
| | | "field4": "field4" |
| | | }, |
| | | { |
| | | "field1": "field1", |
| | | "field2": "field2", |
| | | "field3": "field3", |
| | | "field4": "field4" |
| | | } |
| | | ], |
| | | "height": 200, |
| | | "icon": "el-icon-c-scale-to-original", |
| | | "url": "api/SellOrder/getPageData", |
| | | "index": false, |
| | | "columnIndex": false, |
| | | "ck": true, |
| | | "buttons": [ |
| | | { |
| | | "name": "æ·»å è¡", |
| | | "ck": false, |
| | | "icon": "el-icon-plus", |
| | | "value": "add" |
| | | }, |
| | | { |
| | | "name": "å é¤è¡", |
| | | "ck": false, |
| | | "icon": "el-icon-delete", |
| | | "value": "del" |
| | | }, |
| | | { |
| | | "name": "å·æ°", |
| | | "ck": false, |
| | | "icon": "el-icon-refresh-right", |
| | | "value": "ref" |
| | | } |
| | | ], |
| | | "field": "field1630260242867", |
| | | "width": 100, |
| | | "readonly": false, |
| | | "required": false, |
| | | "pagination": false |
| | | }, |
| | | { |
| | | "id": 13, |
| | | "name": "è¡¨æ ¼", |
| | | "type": "table", |
| | | "tabs": true, |
| | | "columns": [ |
| | | { |
| | | "title": "åæ®µ1", |
| | | "field": "field1", |
| | | "show": true, |
| | | "required": false, |
| | | "edit": false, |
| | | "dataType": null, |
| | | "dataSource": null, |
| | | "width": 120, |
| | | "orderNo": null |
| | | }, |
| | | { |
| | | "title": "åæ®µ2", |
| | | "field": "field2", |
| | | "show": true, |
| | | "required": false, |
| | | "edit": false, |
| | | "dataType": null, |
| | | "dataSource": null, |
| | | "width": 120, |
| | | "orderNo": null |
| | | }, |
| | | { |
| | | "title": "åæ®µ3", |
| | | "field": "field3", |
| | | "show": true, |
| | | "required": false, |
| | | "edit": false, |
| | | "dataType": null, |
| | | "dataSource": null, |
| | | "width": 120, |
| | | "orderNo": null |
| | | }, |
| | | { |
| | | "title": "åæ®µ4", |
| | | "field": "field4", |
| | | "show": true, |
| | | "required": false, |
| | | "edit": false, |
| | | "dataType": null, |
| | | "dataSource": null, |
| | | "width": 120, |
| | | "orderNo": null |
| | | } |
| | | ], |
| | | "tableData": [ |
| | | { |
| | | "field1": "field1", |
| | | "field2": "field2", |
| | | "field3": "field3", |
| | | "field4": "field4" |
| | | }, |
| | | { |
| | | "field1": "field1", |
| | | "field2": "field2", |
| | | "field3": "field3", |
| | | "field4": "field4" |
| | | }, |
| | | { |
| | | "field1": "field1", |
| | | "field2": "field2", |
| | | "field3": "field3", |
| | | "field4": "field4" |
| | | } |
| | | ], |
| | | "height": 200, |
| | | "icon": "el-icon-c-scale-to-original", |
| | | "url": null, |
| | | "index": false, |
| | | "columnIndex": false, |
| | | "ck": true, |
| | | "buttons": [ |
| | | { |
| | | "name": "æ·»å è¡", |
| | | "ck": false, |
| | | "icon": "el-icon-plus", |
| | | "value": "add" |
| | | }, |
| | | { |
| | | "name": "å é¤è¡", |
| | | "ck": false, |
| | | "icon": "el-icon-delete", |
| | | "value": "del" |
| | | }, |
| | | { |
| | | "name": "å·æ°", |
| | | "ck": false, |
| | | "icon": "el-icon-refresh-right", |
| | | "value": "ref" |
| | | } |
| | | ], |
| | | "field": "field1630260481283", |
| | | "width": 100, |
| | | "readonly": false, |
| | | "required": false, |
| | | "pagination": true |
| | | } |
| | | ] |
| | | |
| | | let options3=[ |
| | | { |
| | | "id": 1, |
| | | "name": "è¾å
¥æ¡", |
| | | "type": "text", |
| | | "value": "", |
| | | "icon": "el-icon-document", |
| | | "field": "field1630258884671", |
| | | "width": 20, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 3, |
| | | "name": "æ¥æ", |
| | | "type": "date", |
| | | "icon": "el-icon-date", |
| | | "value": null, |
| | | "field": "field1630258891760", |
| | | "width": 20, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 7, |
| | | "name": "䏿æ¡", |
| | | "value": null, |
| | | "key": "", |
| | | "data": [ |
| | | { |
| | | "label": "è¯·è®¾ç½®æ°æ®æº", |
| | | "value": "è¯·è®¾ç½®æ°æ®æº" |
| | | } |
| | | ], |
| | | "type": "select", |
| | | "icon": "el-icon-arrow-down", |
| | | "field": "field1630258904862", |
| | | "width": 30, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 8, |
| | | "name": "䏿å¤é", |
| | | "type": "selectList", |
| | | "key": "", |
| | | "values": [], |
| | | "data": [ |
| | | { |
| | | "label": "è¯·è®¾ç½®æ°æ®æº", |
| | | "value": "è¯·è®¾ç½®æ°æ®æº" |
| | | } |
| | | ], |
| | | "icon": "el-icon-arrow-down", |
| | | "field": "field1630258924442", |
| | | "width": 30, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 5, |
| | | "name": "åé", |
| | | "type": "radio", |
| | | "icon": "el-icon-aim", |
| | | "value": 0, |
| | | "data": [ |
| | | { |
| | | "key": "0", |
| | | "value": "å¦" |
| | | }, |
| | | { |
| | | "key": "2", |
| | | "value": "xx11" |
| | | }, |
| | | { |
| | | "key": "1", |
| | | "value": "æ¯" |
| | | } |
| | | ], |
| | | "key": "enable", |
| | | "field": "field1630260669595", |
| | | "width": 50, |
| | | "readonly": false, |
| | | "required": false, |
| | | "values": [ |
| | | "å¦" |
| | | ] |
| | | }, |
| | | { |
| | | "id": 6, |
| | | "name": "å¤é", |
| | | "values": [ |
| | | "å¦" |
| | | ], |
| | | "type": "checkbox", |
| | | "key": "enable", |
| | | "data": [ |
| | | { |
| | | "key": "0", |
| | | "value": "å¦" |
| | | }, |
| | | { |
| | | "key": "2", |
| | | "value": "xx11" |
| | | }, |
| | | { |
| | | "key": "1", |
| | | "value": "æ¯" |
| | | } |
| | | ], |
| | | "icon": "el-icon-circle-check", |
| | | "field": "field1630260695322", |
| | | "width": 50, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 2, |
| | | "name": "textarea", |
| | | "type": "textarea", |
| | | "value": "", |
| | | "icon": "el-icon-document-copy", |
| | | "field": "field1630260207393", |
| | | "width": 100, |
| | | "readonly": false, |
| | | "required": false |
| | | }, |
| | | { |
| | | "id": 13, |
| | | "name": "ç¼è¾å¨", |
| | | "type": "editor", |
| | | "value": "", |
| | | "url": "", |
| | | "height": 200, |
| | | "icon": "el-icon-notebook-2", |
| | | "field": "field1630260646842", |
| | | "width": 100, |
| | | "readonly": false, |
| | | "required": false |
| | | } |
| | | ] |
| | | export { options1, options2,options3 } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import VolFormDraggable from './VolFormDraggable' |
| | | |
| | | export default VolFormDraggable; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | const components = [ |
| | | { |
| | | id: 1, |
| | | name: "è¾å
¥æ¡", |
| | | type: "text", |
| | | value: "", |
| | | icon: "el-icon-document", |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: "textarea", |
| | | type: "textarea", |
| | | value: "", |
| | | icon: "el-icon-document-copy", |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: "æ¥æ", |
| | | type: "date", |
| | | icon: "el-icon-date", |
| | | value: null, |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: "switch", |
| | | type: "switch", |
| | | icon: "el-icon-turn-off", |
| | | value: 0, |
| | | }, |
| | | { id: 5, name: "åé", type: "radio", icon: "el-icon-aim", value: 0, data: [{ label: "0", value: "è¯·è®¾ç½®æ°æ®æº1" }, { label: "1", value: "è¯·è®¾ç½®æ°æ®æº2" }], key: "" }, |
| | | { |
| | | id: 6, |
| | | name: "å¤é", |
| | | values: [], |
| | | type: "checkbox", |
| | | key: "", |
| | | data: [{ label: "è¯·è®¾ç½®æ°æ®æº", value: "è¯·è®¾ç½®æ°æ®æº" }], |
| | | icon: "el-icon-circle-check", |
| | | }, |
| | | { |
| | | id: 7, |
| | | name: "䏿æ¡", |
| | | value: null, |
| | | key: "", |
| | | data: [{ label: "è¯·è®¾ç½®æ°æ®æº", value: "è¯·è®¾ç½®æ°æ®æº" }], |
| | | type: "select", |
| | | icon: "el-icon-arrow-down", |
| | | }, |
| | | { |
| | | id: 8, |
| | | name: "䏿æ¡å¤é", |
| | | type: "selectList", |
| | | key: "", |
| | | values: [], |
| | | data: [{ label: "è¯·è®¾ç½®æ°æ®æº", value: "è¯·è®¾ç½®æ°æ®æº" }], |
| | | icon: "el-icon-arrow-down", |
| | | }, |
| | | { |
| | | id: 81, |
| | | name: "级è", |
| | | type: "cascader", |
| | | icon: "el-icon-share", |
| | | values: [], |
| | | key: "", |
| | | data: [ |
| | | { |
| | | value: "请é
ç½®æ°æ®æº", |
| | | label: "请é
ç½®æ°æ®æº", |
| | | children: [ |
| | | { |
| | | value: "å
·ä½", |
| | | label: "èå:䏿æ¡ç»å®è®¾ç½®", |
| | | }, |
| | | { |
| | | value: "color", |
| | | label: "å¯åç
§åå
¸ç¼å·[tree_roles]", |
| | | } |
| | | ], |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 9, |
| | | name: "å¾çä¸ä¼ ", |
| | | type: "img", |
| | | url: "", |
| | | maxSize: 3, |
| | | fileInfo: [], |
| | | multiple: false, |
| | | autoUpload: false, |
| | | maxFile: 5, |
| | | icon: "el-icon-picture-outline", |
| | | }, |
| | | { |
| | | id: 10, |
| | | name: "excelä¸ä¼ ", |
| | | url: "", |
| | | maxSize: 3, |
| | | multiple: false, |
| | | autoUpload: false, |
| | | maxFile: 5, //æå¤å¯ä¸ä¼ 5个æä»¶ |
| | | fileInfo: [], |
| | | type: "excel", |
| | | icon: "el-icon-upload", |
| | | }, |
| | | { |
| | | id: 11, |
| | | name: "æä»¶ä¸ä¼ ", |
| | | type: "file", |
| | | url: "", |
| | | maxSize: 3, |
| | | multiple: false, |
| | | autoUpload: false, |
| | | maxFile: 5, |
| | | fileInfo: [], |
| | | icon: "el-icon-folder-opened", |
| | | }, |
| | | { |
| | | id: 12, |
| | | name: "åæ®µä¿¡æ¯", |
| | | type: "line", |
| | | icon: "el-icon-guide", |
| | | }, |
| | | { |
| | | id: 13, |
| | | name: "ç¼è¾å¨", |
| | | type: "editor", |
| | | value: "", |
| | | url: "", |
| | | height: 200, |
| | | icon: "el-icon-notebook-2", |
| | | }, |
| | | { |
| | | id: 13, |
| | | name: "å¼¹åºæ¡", |
| | | type: "box", |
| | | value: "", |
| | | url: "", |
| | | height: 250, |
| | | icon: "el-icon-notebook-2", |
| | | }, |
| | | { |
| | | id: 13, |
| | | name: "è¡¨æ ¼", |
| | | type: "table", |
| | | tabs: false, |
| | | columns: [ |
| | | { title: "åæ®µ1", field: "field1", show: true, required: false, edit: false, dataType: null, dataSource: null, width: 120, orderNo: null }, |
| | | { title: "åæ®µ2", field: "field2", show: true, required: false, edit: false, dataType: null, dataSource: null, width: 120, orderNo: null }, |
| | | { title: "åæ®µ3", field: "field3", show: true, required: false, edit: false, dataType: null, dataSource: null, width: 120, orderNo: null }, |
| | | { title: "åæ®µ4", field: "field4", show: true, required: false, edit: false, dataType: null, dataSource: null, width: 120, orderNo: null }, |
| | | // { title: "åæ®µ5", field: "Field5", width: 120 }, |
| | | ], |
| | | tableData: [ |
| | | { |
| | | field1: "field1", |
| | | field2: "field2", |
| | | field3: "field3", |
| | | field4: "field4", |
| | | }, |
| | | { |
| | | field1: "field1", |
| | | field2: "field2", |
| | | field3: "field3", |
| | | field4: "field4", |
| | | }, |
| | | { |
| | | field1: "field1", |
| | | field2: "field2", |
| | | field3: "field3", |
| | | field4: "field4", |
| | | }, |
| | | ], |
| | | height: 150, |
| | | icon: "el-icon-c-scale-to-original", |
| | | url: null, |
| | | index: false, //item.index, |
| | | height: 200, |
| | | index: false, |
| | | columnIndex: false, |
| | | ck: true, |
| | | buttons: [ |
| | | { name: 'æ·»å è¡', ck: false, icon: 'el-icon-plus',value:'add' }, |
| | | { name: 'å é¤è¡', ck: false, icon: 'el-icon-delete',value:'del' }, |
| | | { name: 'å·æ°', ck: false ,icon:'el-icon-refresh-right',value:'ref'}], |
| | | }, |
| | | ] |
| | | const tableOption = [ |
| | | { field: 'field', title: 'åæ®µ', edit: { type: "text", keep: true }, width: 160 }, |
| | | { field: 'title', title: 'åæ®µä¸æå', edit: { type: "text", keep: true }, width: 120 }, |
| | | { field: 'show', title: 'æ¯å¦æ¾ç¤º', edit: { type: "switch", keep: true }, width: 90 }, |
| | | { |
| | | field: 'dataType', title: 'æ¾ç¤ºç±»å', edit: { type: "select", keep: true }, width: 120, bind: { |
| | | key: '', data: [ |
| | | { "key": "switch", "value": "åé" }, |
| | | { "key": "date", "value": "å¹´ææ¥" }, |
| | | { "key": "img", "value": "å¾ç" }, |
| | | { "key": "excel", "value": "excel" }, |
| | | { "key": "file", "value": "æä»¶" } |
| | | ] |
| | | } |
| | | }, |
| | | |
| | | { field: 'required', title: 'æ¯å¦å¿
å¡«', edit: { type: "switch", keep: true }, width: 90 }, |
| | | { field: 'edit', title: 'æ¯å¦å¯ç¼è¾', edit: { type: "switch", keep: true }, width: 90 }, |
| | | { |
| | | field: 'editType', title: 'ç¼è¾ç±»å', edit: { type: "select", keep: true, }, width: 120, bind: { |
| | | key: '', data: [{ "key": "text", "value": "è¾å
¥æ¡" }, |
| | | { "key": "switch", "value": "åé" }, |
| | | { "key": "select", "value": "䏿æ¡" }, |
| | | { "key": "selectList", "value": "䏿æ¡å¤é" }, |
| | | { "key": "date", "value": "æ¥æ" }, |
| | | { "key": "datetime", "value": "æ¥ææ¶åç§" }, |
| | | { "key": "checkbox", "value": "å¤éæ¡å¤é" }, |
| | | { "key": "mail", "value": "é®ç®±å°å" }, |
| | | { "key": "number", "value": "æ°å" }, |
| | | { "key": "decimal", "value": "å°æ°" }, |
| | | { "key": "phone", "value": "ææºå·" }, |
| | | ] |
| | | } |
| | | }, |
| | | { field: 'dataSource', title: 'æ°æ®æº', edit: { type: "select", keep: true, data: [] }, bind: { key: '', data: [] }, width: 120 }, |
| | | { field: 'width', title: 'å宽度', edit: { type: "text", keep: true }, width: 80 }, |
| | | { field: 'orderNo', title: 'åæ¾ç¤ºé¡ºåº', edit: { type: "text", keep: true }, width: 100 } |
| | | ]; |
| | | export { components, tableOption } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | var code = `<template> |
| | | <div style="padding: 15px 20px 15px 5px"> |
| | | <div class="pre-text">{{ text }}</div> |
| | | <vol-form ref="form" |
| | | :labelWidth="80" |
| | | :load-key="false" |
| | | :formFields="fields" |
| | | :formRules="formOptions"> |
| | | </vol-form> |
| | | {#tables} |
| | | {#tabs} |
| | | |
| | | <div class="form-btns"> |
| | | <el-button type="primary" |
| | | @click="submit" |
| | | icon="el-icon-check" |
| | | size="mini">æäº¤</el-button> |
| | | <el-button type="primary" |
| | | @click="reset" |
| | | plain |
| | | icon="el-icon-refresh-right" |
| | | size="mini">éç½®</el-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | // ä½¿ç¨æ¹å¼ï¼ |
| | | // 1ãæ°å»ºä¸ä¸ªvue页é¢ï¼ææ¤é¡µé¢å
容å¤å¶è¿å» |
| | | // 2ãrouter->index.jsé
置路ç±ï¼é¡µé¢ä¸è¾å
¥å°åå³å¯çå°æ°æ®(ä¹å¯ä»¥æèåé
ç½®ä¸) |
| | | // 3ãæè
åç
§è¡¨å设计页é¢åå¨æé¡µé¢ |
| | | //**表å设计å¨çtableä¸è½½è¿å¨å¼åä¸ |
| | | {import_VolTable} |
| | | import VolForm from '@/components/basic/VolForm' |
| | | export default { |
| | | components: {"vol-form": VolForm,{component_table}}, |
| | | data () { |
| | | return { |
| | | text: "", |
| | | tabsModel: "0", |
| | | fields: {#fields}, |
| | | formOptions: [{#formOptions}], |
| | | tables: [{#tableOptions}], |
| | | tabs: [{#tabsOptions}] |
| | | }; |
| | | }, |
| | | created () { |
| | | |
| | | }, |
| | | methods: {{table_ms} |
| | | submit () { |
| | | this.$Message.success("submit") |
| | | return; |
| | | this.http.post("url",this.fields,true).then(result=>{ |
| | | |
| | | }) |
| | | }, |
| | | reset () { |
| | | this.$refs.form.reset(); |
| | | this.$Message.success("表åå·²éç½®") |
| | | }, |
| | | download () { |
| | | this.$Message.info("111") |
| | | } |
| | | } |
| | | }; |
| | | |
| | | VolForm; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .form-btns { |
| | | text-align: center; |
| | | } |
| | | .tables { |
| | | padding-left: 15px; |
| | | .table-item { |
| | | padding: 10px; |
| | | } |
| | | .table-header { |
| | | display: flex; |
| | | margin-bottom: 8px; |
| | | } |
| | | .header-text { |
| | | position: relative; |
| | | bottom: -9px; |
| | | flex: 1; |
| | | font-weight: bold; |
| | | } |
| | | .header-btns { |
| | | text-align: right; |
| | | } |
| | | } |
| | | </style>` |
| | | |
| | | export default code |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="v-header"> |
| | | <div class="v-left-text"> |
| | | <!-- <i size="20" :class="icon" class="h-icon"/> --> |
| | | <span>{{ title || text }}</span> |
| | | </div> |
| | | <div class="content"> |
| | | <slot name="content"></slot> |
| | | </div> |
| | | <div class="v-right-content"> |
| | | <slot></slot> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | props: { |
| | | icon: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | title: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | text: { |
| | | type: String, |
| | | default: 'æªå®ä¹åç§°' |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .v-header { |
| | | display: flex; |
| | | border-bottom: 1px solid #dcdee2; |
| | | .v-left-text { |
| | | margin-top: 3px; |
| | | padding-bottom: 6px; |
| | | font-weight: bold; |
| | | font-size: 15px; |
| | | color: #484848; |
| | | white-space: nowrap; |
| | | border-bottom: 2px solid #676767; |
| | | margin-bottom: -1px; |
| | | letter-spacing: 1px; |
| | | > span { |
| | | position: relative; |
| | | top: 2px; |
| | | } |
| | | } |
| | | .content { |
| | | line-height: 25px; |
| | | padding-left: 10px; |
| | | padding: 6px 0 0 10px; |
| | | } |
| | | .v-right-content { |
| | | flex: 1; |
| | | text-align: right; |
| | | } |
| | | .h-icon { |
| | | position: relative; |
| | | top: 2px; |
| | | margin-right: 3px; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <!-- 2021.11.18ç§»é¤voltableæ¹æ³@cell-mouse-leave="rowEndEdit" --> |
| | | <div |
| | | class="vol-table" |
| | | :class="[ |
| | | textInline ? 'text-inline' : '', |
| | | fxRight ? 'fx-right' : '', |
| | | isChrome ? 'chrome' : '', |
| | | ]" |
| | | > |
| | | <div class="mask" v-show="loading"></div> |
| | | <div class="message" v-show="loading">å è½½ä¸.....</div> |
| | | <el-table |
| | | :show-summary="summary" |
| | | :summary-method="getSummaryData" |
| | | :row-key="rowKey" |
| | | :key="randomTableKey" |
| | | lazy |
| | | stripe |
| | | :load="loadTreeChildren" |
| | | @select="userSelect" |
| | | @select-all="userSelect" |
| | | @selection-change="selectionChange" |
| | | @row-dblclick="rowDbClick" |
| | | @row-click="rowClick" |
| | | @header-click="headerClick" |
| | | :highlight-current-row="highlightCurrentRow" |
| | | ref="table" |
| | | class="v-table" |
| | | @sort-change="sortChange" |
| | | tooltip-effect="dark" |
| | | :height="realHeight" |
| | | :max-height="realMaxHeight" |
| | | :data="url ? rowData : tableData" |
| | | border |
| | | :row-class-name="initIndex" |
| | | :cell-style="getCellStyle" |
| | | style="width: 100%" |
| | | :scrollbar-always-on="true" |
| | | > |
| | | <el-table-column |
| | | v-if="ck" |
| | | type="selection" |
| | | :fixed="fixed" |
| | | :selectable="selectable" |
| | | width="55" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | v-if="columnIndex" |
| | | type="index" |
| | | :fixed="fixed" |
| | | width="55" |
| | | ></el-table-column> |
| | | |
| | | <!-- 2020.10.10ç§»é¤table第ä¸è¡å¼ºå¶æåº --> |
| | | <el-table-column |
| | | v-for="(column, cindex) in filterColumns" |
| | | :prop="column.field" |
| | | :label="column.title" |
| | | :min-width="column.width" |
| | | :formatter="formatter" |
| | | :fixed="column.fixed" |
| | | :key="column.field + cindex" |
| | | :align="column.align" |
| | | :sortable="column.sort ? 'custom' : false" |
| | | :show-overflow-tooltip="true" |
| | | > |
| | | <template #header> |
| | | <span |
| | | v-if="(column.require || column.required) && column.edit" |
| | | class="column-required" |
| | | >*</span |
| | | >{{ column.title }} |
| | | </template> |
| | | |
| | | <template #default="scope"> |
| | | <!-- 2022.01.08å¢å å¤è¡¨å¤´ï¼ç°å¨åªæ¯æå¸¸ç¨åè½æ¸²æï¼ä¸æ¯æç¼è¾åè½(æ¶åå°ç»ä»¶éå) --> |
| | | <el-table-column |
| | | style="border: none" |
| | | v-for="columnChildren in filterChildrenColumn(column.children)" |
| | | :key="columnChildren.field" |
| | | :min-width="columnChildren.width" |
| | | :class-name="columnChildren.class" |
| | | :prop="columnChildren.field" |
| | | :align="columnChildren.align" |
| | | :label="columnChildren.title" |
| | | > |
| | | <template #default="scopeChildren"> |
| | | <a |
| | | href="javascript:void(0)" |
| | | style="text-decoration: none" |
| | | @click="link(scopeChildren.row, columnChildren, $event)" |
| | | v-if="column.link" |
| | | v-text="scopeChildren.row[columnChildren.field]" |
| | | ></a> |
| | | <div |
| | | v-else-if="columnChildren.formatter" |
| | | @click=" |
| | | columnChildren.click && |
| | | columnChildren.click( |
| | | scopeChildren.row, |
| | | columnChildren, |
| | | scopeChildren.$index |
| | | ) |
| | | " |
| | | v-html=" |
| | | columnChildren.formatter( |
| | | scopeChildren.row, |
| | | columnChildren, |
| | | scopeChildren.$index |
| | | ) |
| | | " |
| | | ></div> |
| | | <div v-else-if="column.bind"> |
| | | {{ formatter(scopeChildren.row, columnChildren, true) }} |
| | | </div> |
| | | <span v-else-if="column.type == 'date'">{{ |
| | | formatterDate(scopeChildren.row, columnChildren) |
| | | }}</span> |
| | | <template v-else> |
| | | {{ scopeChildren.row[columnChildren.field] }} |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- 2020.06.18å¢å render渲æèªå®ä¹å
容 --> |
| | | <table-render |
| | | v-if="column.render && typeof column.render == 'function'" |
| | | :row="scope.row" |
| | | key="rd-01" |
| | | :index="scope.$index" |
| | | :column="column" |
| | | :render="column.render" |
| | | ></table-render> |
| | | <!-- å¯ç¨åå»ç¼è¾åè½ï¼å¸¦ç¼è¾åè½çä¸ä¼æ¸²æä¸ææ¡ææ¬èæ¯é¢è² --> |
| | | <!-- @click="rowBeginEdit(scope.$index,cindex)" --> |
| | | <!-- 2021.09.21å¢å ç¼è¾æ¶å¯¹readonly屿§å¤æ --> |
| | | <template |
| | | v-else-if=" |
| | | column.edit && |
| | | !column.readonly && |
| | | ['file', 'img', 'excel'].indexOf(column.edit.type) != -1 |
| | | " |
| | | > |
| | | <div style="display: flex; align-items: center" @click.stop> |
| | | <i |
| | | style=" |
| | | padding: 3px; |
| | | margin-right: 10px; |
| | | color: #8f9293; |
| | | cursor: pointer; |
| | | " |
| | | @click="showUpload(scope.row, column)" |
| | | class="el-icon-upload" |
| | | ></i> |
| | | <img |
| | | v-show="column.edit.type == 'img'" |
| | | v-for="(file, imgIndex) in getFilePath( |
| | | scope.row[column.field], |
| | | column |
| | | )" |
| | | :key="imgIndex" |
| | | :onerror="defaultImg" |
| | | @click="viewImg(scope.row, column, file.path, $event)" |
| | | class="table-img" |
| | | :src="file.path" |
| | | /> |
| | | <a |
| | | style="margin-right: 8px" |
| | | v-show="column.edit.type != 'img'" |
| | | class="t-file" |
| | | v-for="(file, fIndex) in getFilePath( |
| | | scope.row[column.field], |
| | | column |
| | | )" |
| | | :key="fIndex" |
| | | @click="dowloadFile(file)" |
| | | >{{ file.name }}</a |
| | | > |
| | | </div> |
| | | </template> |
| | | <div |
| | | v-else-if=" |
| | | column.edit && |
| | | !column.readonly && |
| | | (column.edit.keep || edit.rowIndex == scope.$index) |
| | | " |
| | | class="edit-el" |
| | | > |
| | | <div @click.stop class="e-item"> |
| | | <div> |
| | | <!-- 2020.07.24å¢å æ¥æonChangeäºä»¶ --> |
| | | <el-date-picker |
| | | clearable |
| | | size="default" |
| | | style="width: 100%" |
| | | v-if="['date', 'datetime'].indexOf(column.edit.type) != -1" |
| | | v-model="scope.row[column.field]" |
| | | @change=" |
| | | (val) => { |
| | | column.onChange && |
| | | column.onChange(scope.row, column, val); |
| | | } |
| | | " |
| | | :type="column.edit.type" |
| | | :placeholder="column.placeholder || column.title" |
| | | :disabledDate="(val) => getDateOptions(val, column)" |
| | | :value-format="getDateFormat(column)" |
| | | :disabled="initColumnDisabled(scope.row, column)" |
| | | > |
| | | </el-date-picker> |
| | | <el-time-picker |
| | | clearable |
| | | size="default" |
| | | style="width: 100%" |
| | | v-else-if="column.edit.type == 'time'" |
| | | v-model="scope.row[column.field]" |
| | | @change=" |
| | | (val) => { |
| | | column.onChange && |
| | | column.onChange(scope.row, column, val); |
| | | } |
| | | " |
| | | :placeholder="column.placeholder || column.title" |
| | | :value-format="column.format || 'HH:mm:ss'" |
| | | :disabled="initColumnDisabled(scope.row, column)" |
| | | > |
| | | </el-time-picker> |
| | | <el-switch |
| | | v-else-if="column.edit.type == 'switch'" |
| | | v-model="scope.row[column.field]" |
| | | active-color="#0f84ff" |
| | | inactive-color="rgb(194 194 194)" |
| | | @change=" |
| | | (val) => { |
| | | switchChange(val, scope.row, column); |
| | | } |
| | | " |
| | | :active-value=" |
| | | typeof scope.row[column.field] == 'boolean' |
| | | ? true |
| | | : typeof scope.row[column.field] == 'string' |
| | | ? '1' |
| | | : 1 |
| | | " |
| | | :inactive-value=" |
| | | typeof scope.row[column.field] == 'boolean' |
| | | ? false |
| | | : typeof scope.row[column.field] == 'string' |
| | | ? '0' |
| | | : 0 |
| | | " |
| | | :disabled="initColumnDisabled(scope.row, column)" |
| | | > |
| | | </el-switch> |
| | | <template |
| | | v-else-if=" |
| | | ['select', 'selectList'].indexOf(column.edit.type) != -1 |
| | | " |
| | | > |
| | | <el-select-v2 |
| | | style="width: 100%" |
| | | :size="size" |
| | | v-if="column.bind.data.length >= select2Count" |
| | | v-model="scope.row[column.field]" |
| | | filterable |
| | | :multiple="column.edit.type == 'select' ? false : true" |
| | | :placeholder="column.placeholder || column.title" |
| | | :autocomplete="column.autocomplete" |
| | | :options="column.bind.data" |
| | | @change=" |
| | | column.onChange && column.onChange(scope.row, column) |
| | | " |
| | | clearable |
| | | :disabled="initColumnDisabled(scope.row, column)" |
| | | > |
| | | <template #default="{ item }"> |
| | | {{ item.label }} |
| | | </template> |
| | | </el-select-v2> |
| | | |
| | | <el-select |
| | | size="default" |
| | | style="width: 100%" |
| | | v-else |
| | | v-model="scope.row[column.field]" |
| | | :filterable=" |
| | | column.filter || column.bind.data.length > 10 |
| | | ? true |
| | | : false |
| | | " |
| | | :multiple="column.edit.type == 'select'" |
| | | :placeholder="column.placeholder || column.title" |
| | | :autocomplete="column.autocomplete" |
| | | @change=" |
| | | column.onChange && column.onChange(scope.row, column) |
| | | " |
| | | clearable |
| | | :disabled="initColumnDisabled(scope.row, column)" |
| | | > |
| | | <el-option |
| | | v-for="item in column.bind.data" |
| | | :key="item.key" |
| | | v-show="!item.hidden" |
| | | :disabled="item.disabled" |
| | | :label="item.value" |
| | | :value="item.key" |
| | | >{{ item.value }} |
| | | </el-option> |
| | | </el-select> |
| | | </template> |
| | | <el-input |
| | | v-else-if="column.edit.type == 'textarea'" |
| | | type="textarea" |
| | | :placeholder="column.placeholder || column.title" |
| | | v-model="scope.row[column.field]" |
| | | :disabled="initColumnDisabled(scope.row, column)" |
| | | > |
| | | </el-input> |
| | | <input |
| | | class="table-input" |
| | | v-else-if="!column.summary && !column.onKeyPress" |
| | | v-model.lazy="scope.row[column.field]" |
| | | :disabled="initColumnDisabled(scope.row, column)" |
| | | /> |
| | | <el-input |
| | | v-else |
| | | @change="inputKeyPress(scope.row, column, $event)" |
| | | @input="inputKeyPress(scope.row, column, $event)" |
| | | @keyup.enter="inputKeyPress(scope.row, column, $event)" |
| | | size="default" |
| | | v-model="scope.row[column.field]" |
| | | :placeholder="column.placeholder || column.title" |
| | | :disabled="initColumnDisabled(scope.row, column)" |
| | | ></el-input> |
| | | </div> |
| | | <div |
| | | class="extra" |
| | | v-if="column.extra && edit.rowIndex == scope.$index" |
| | | > |
| | | <a |
| | | :style="column.extra.style" |
| | | style="text-decoration: none" |
| | | @click="extraClick(scope.row, column)" |
| | | > |
| | | <i v-if="column.extra.icon" :class="[column.extra.icon]" /> |
| | | {{ column.extra.text }} |
| | | </a> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!--没æç¼è¾åè½çç´æ¥æ¸²ææ ç¾--> |
| | | <template v-else> |
| | | <a |
| | | href="javascript:void(0)" |
| | | style="text-decoration: none" |
| | | @click="link(scope.row, column, $event)" |
| | | v-if="column.link" |
| | | v-text="scope.row[column.field]" |
| | | ></a> |
| | | <img |
| | | v-else-if="column.type == 'img'" |
| | | v-for="(file, imgIndex) in getFilePath( |
| | | scope.row[column.field], |
| | | column |
| | | )" |
| | | :key="imgIndex" |
| | | :onerror="defaultImg" |
| | | @click="viewImg(scope.row, column, file.path, $event)" |
| | | class="table-img" |
| | | :src="file.path" |
| | | /> |
| | | <a |
| | | style="margin-right: 8px" |
| | | v-else-if="column.type == 'file' || column.type == 'excel'" |
| | | class="t-file" |
| | | v-for="(file, fIndex) in getFilePath( |
| | | scope.row[column.field], |
| | | column |
| | | )" |
| | | :key="fIndex" |
| | | @click="dowloadFile(file)" |
| | | >{{ file.name }}</a |
| | | > |
| | | <span v-else-if="column.type == 'date'">{{ |
| | | formatterDate(scope.row, column) |
| | | }}</span> |
| | | <div |
| | | v-else-if="column.formatter" |
| | | @click="formatterClick(scope.row, column, $event)" |
| | | v-html="column.formatter(scope.row, column)" |
| | | ></div> |
| | | <!-- 2021.11.18ä¿®å¤tableæ°æ®æºè®¾ç½®ä¸ºnormalåç¹å»è¡$event缺失çé®é¢ --> |
| | | <div |
| | | v-else-if="column.bind && (column.normal || column.edit)" |
| | | @click="formatterClick(scope.row, column, $event)" |
| | | :style="column.getStyle && column.getStyle(scope.row, column)" |
| | | > |
| | | {{ formatter(scope.row, column, true) }} |
| | | </div> |
| | | <div |
| | | v-else-if="column.click && !column.bind" |
| | | @click="formatterClick(scope.row, column)" |
| | | > |
| | | {{ scope.row[column.field] }} |
| | | </div> |
| | | <div |
| | | @click=" |
| | | () => { |
| | | column.click && formatterClick(scope.row, column); |
| | | } |
| | | " |
| | | v-else-if="column.bind" |
| | | > |
| | | <el-tag |
| | | v-if="useTag" |
| | | :class="[isEmptyTag(scope.row, column)]" |
| | | :type="getColor(scope.row, column)" |
| | | :effect="column.effect" |
| | | >{{ formatter(scope.row, column, true) }}</el-tag |
| | | > |
| | | <template v-else>{{ |
| | | formatter(scope.row, column, true) |
| | | }}</template> |
| | | </div> |
| | | |
| | | <span v-else>{{ formatter(scope.row, column, true) }}</span> |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <template v-if="!paginationHide"> |
| | | <div class="block pagination" key="pagination-01" style="display: flex"> |
| | | <div style="flex: 1"></div> |
| | | <el-pagination |
| | | key="pagination-02" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="paginations.page" |
| | | :page-sizes="paginations.sizes" |
| | | :page-size="paginations.size" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="paginations.total" |
| | | ></el-pagination> |
| | | </div> |
| | | </template> |
| | | </div> |
| | | |
| | | <VolBox |
| | | v-model="uploadModel" |
| | | title="ä¸ä¼ " |
| | | :height="228" |
| | | :width="500" |
| | | :padding="15" |
| | | lazy |
| | | > |
| | | <!-- ä¸ä¼ å¾çãexcelæå
¶ä»æä»¶ãæä»¶æ°éã大å°éå¶é½å¯ä»¥ï¼åç
§voluploadç»ä»¶api --> |
| | | <div style="height: 200px; display: flex; align-items: center"> |
| | | <VolUpload |
| | | style="text-align: center" |
| | | :autoUpload="currentColumn.edit.autoUpload" |
| | | :multiple="currentColumn.edit.multiple" |
| | | :url="uploadUrl" |
| | | :max-file="currentColumn.edit.maxFile" |
| | | :img="currentColumn.edit.type == 'img'" |
| | | :excel="currentColumn.edit.type == 'excel'" |
| | | :fileTypes=" |
| | | currentColumn.edit.fileTypes ? currentColumn.edit.fileTypes : [] |
| | | " |
| | | :fileInfo="fileInfo" |
| | | :upload-after="uploadAfter" |
| | | > |
| | | <div>{{ currentColumn.message }}</div> |
| | | </VolUpload> |
| | | </div> |
| | | <template #footer> |
| | | <div style="text-align: center"> |
| | | <el-button type="default" size="small" @click="uploadModel = false" |
| | | >å
³é</el-button |
| | | > |
| | | <el-button type="primary" size="small" @click="saveUpload" |
| | | >ä¿å</el-button |
| | | > |
| | | </div> |
| | | </template> |
| | | </VolBox> |
| | | </template> |
| | | <script> |
| | | import VolTableRender from "./VolTable/VolTableRender"; |
| | | let _errMsg; |
| | | import { defineComponent, defineAsyncComponent } from "vue"; |
| | | export default defineComponent({ |
| | | //https://github.com/element-plus/element-plus/issues/1483 |
| | | //没æåå
çselection屿§äºï¼çissueä¸ä½¿ç¨select/selectallè·å |
| | | //ç嬿°ç»é¿åº¦ï¼å¦æå é¤äºæ°æ®ï¼ç°å¨åªè½è¢«è¿«æ¸
餿æéä¸çè¡ |
| | | watch: { |
| | | "tableData.length": { |
| | | handler(newLen, oldLen) { |
| | | this.watchRowSelectChange(newLen, oldLen); |
| | | }, |
| | | }, |
| | | "rowData.length": { |
| | | handler(newLen, oldLen) { |
| | | this.watchRowSelectChange(newLen, oldLen); |
| | | }, |
| | | }, |
| | | }, |
| | | components: { |
| | | "table-render": VolTableRender, |
| | | VolUpload: defineAsyncComponent(() => |
| | | import("@/components/basic/VolUpload.vue") |
| | | ), |
| | | VolBox: defineAsyncComponent(() => import("@/components/basic/VolBox.vue")), |
| | | }, |
| | | props: { |
| | | rowKey: { |
| | | // æ å½¢ç»æç主é®å段ï¼å¦æè®¾ç½®å¼é»è®¤ä¼å¼å¯æ å½¢tableï¼æ³¨ærowKeyåæ®µçå¼å¿
é¡»æ¯å¯ä¸ï¼2021.05.02ï¼ |
| | | typeof: String, |
| | | default: undefined, |
| | | }, |
| | | loadTreeChildren: { |
| | | // æ å½¢ç»æå è½½åèç¹ |
| | | type: Function, |
| | | default: (tree, treeNode, resolve) => { |
| | | return resolve([]); |
| | | }, |
| | | }, |
| | | textInline: { |
| | | // è¡¨æ ¼å
容è¶
åºåæ¯å¦æ¢è¡æ¾ç¤ºï¼2020.01.16ï¼ |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | tableData: { |
| | | // è¡¨æ°æ®æº,é
ç½®äºurlå°±ä¸ç¨ä¼ è¿ä¸ªåæ°äº |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | }, |
| | | }, |
| | | columns: { |
| | | type: Array, |
| | | default: [], |
| | | }, |
| | | height: { |
| | | type: Number, |
| | | default: 0, |
| | | }, |
| | | maxHeight: { |
| | | type: Number, |
| | | default: 0, |
| | | }, |
| | | linkView: { |
| | | type: Function, |
| | | default: function () { |
| | | return 1; |
| | | }, |
| | | }, |
| | | pagination: { |
| | | type: Object, |
| | | default: function () { |
| | | return { total: 0, size: 30, sortName: "" }; |
| | | }, |
| | | }, |
| | | url: { |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | paginationHide: { |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | color: { |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | index: { |
| | | // æ¯å¦å建索å¼å·,妿éè¦è¡¨æ ¼ç¼è¾åè½ï¼è¿ééè¦è®¾ç½®ä¸ºtrue |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | allowEmpty: { |
| | | // è¡¨æ ¼æ°æ®ä¸ºç©ºæ¶æ¯å¦é»è®¤ä¸º-- |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | defaultLoadPage: { |
| | | // ä¼ å
¥äºurlï¼æ¯å¦é»è®¤å è½½è¡¨æ ¼æ°æ® |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | loadKey: { |
| | | // æ¯å¦èªå¨ä»åå°å è½½æ°æ®æº |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | single: { |
| | | type: Boolean, // æ¯å¦åé |
| | | default: false, |
| | | }, |
| | | doubleEdit: { |
| | | type: Boolean, // æ¯å¦åå»å¯ç¨ç¼è¾åè½ |
| | | default: true, |
| | | }, |
| | | beginEdit: { |
| | | // ç¼è¾å¼å§ |
| | | type: Function, |
| | | default: function (row, column, index) { |
| | | return true; |
| | | }, |
| | | }, |
| | | endEditBefore: { |
| | | // ç»æç¼è¾å |
| | | type: Function, |
| | | default: function (row, column, index) { |
| | | return true; |
| | | }, |
| | | }, |
| | | endEditAfter: { |
| | | // ç»æç¼è¾å |
| | | type: Function, |
| | | default: function (row, column, index) { |
| | | return true; |
| | | }, |
| | | }, |
| | | ck: { |
| | | // æ¯å¦æ¾ç¤ºcheckbox |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | columnIndex: { |
| | | // æ¯å¦æ¾ç¤ºè¡å·(2020..11.1) |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | highlightCurrentRow: { |
| | | //å¢å éä¸è¡é«äº®æ¾ç¤º(2022.10.07) |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | select2Count: { |
| | | //è¶
åºæ°éæ¾ç¤ºselect2ç»ä»¶ |
| | | type: Number, |
| | | default: 500, |
| | | }, |
| | | selectable: { |
| | | type: Function, |
| | | default: (row, index) => { |
| | | return true; |
| | | }, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | fixed: false, //æ¯åºå®è¡å·ä¸checkbox |
| | | clickEdit: true, //2021.07.17设置为ç¹å»è¡ç»æç¼è¾ |
| | | randomTableKey: 1, |
| | | visiblyColumns: [], |
| | | key: "", |
| | | realHeight: 0, |
| | | realMaxHeight: 0, |
| | | enableEdit: false, // æ¯å¦å¯è¡¨æ ¼ç¨ç¼è¾åè½ |
| | | empty: this.allowEmpty ? "" : "--", |
| | | defaultImg: 'this.src="' + require("@/assets/imgs/error.png") + '"', |
| | | loading: false, |
| | | footer: {}, |
| | | total: 0, |
| | | formatConfig: {}, |
| | | // defaultColor: "", |
| | | // 2020.09.06è°æ´tableåæ°æ®æºçèæ¯é¢è² |
| | | colors: ["", "warning", "success", "danger", "info"], |
| | | rule: { |
| | | phone: /^[1][3,4,5,6,7,8,9][0-9]{9}$/, |
| | | decimal: /(^[\-0-9][0-9]*(.[0-9]+)?)$/, |
| | | number: /(^[\-0-9][0-9]*([0-9]+)?)$/, |
| | | }, |
| | | columnNames: [], |
| | | rowData: [], |
| | | paginations: { |
| | | sort: "", |
| | | order: "desc", |
| | | Foots: "", |
| | | total: 0, |
| | | // 2020.08.29å¢å èªå®ä¹å页æ¡å¤§å° |
| | | sizes: [30, 60, 100, 120], |
| | | size: 30, // é»è®¤åé¡µå¤§å° |
| | | Wheres: [], |
| | | page: 1, |
| | | rows: 30, |
| | | }, |
| | | errorFiled: "", |
| | | edit: { columnIndex: -1, rowIndex: -1 }, // å½ååå»ç¼è¾çè¡ä¸ååæ |
| | | editStatus: {}, |
| | | summary: false, // æ¯å¦æ¾ç¤ºå计 |
| | | // ç®ååªæ¯æä»åå°è¿åçsummaryDataæ°æ® |
| | | summaryData: [], |
| | | summaryIndex: {}, |
| | | remoteColumns: [], // éè¦æ¯æ¬¡å·æ°æå页åä»åå°å è½½åå
¸æ°æ®æºçåé
ç½® |
| | | cellStyleColumns: {}, // æèæ¯é¢è²çé
ç½® |
| | | fxRight: false, //æ¯å¦æå³è¾¹åºå®è¡¨å¤´ |
| | | selectRows: [], //å½åéä¸çè¡ |
| | | isChrome: false, |
| | | //vol-tableå¸¦æ°æ®æºçåå
æ ¼æ¯å¦å¯ç¨tagæ ç¾(䏿æ¡çåå
æ ¼ä»¥tagæ ç¾æ¾ç¤º) |
| | | //2023.04.02æ´æ°voltableä¸main.js |
| | | useTag: true, |
| | | currentRow: {}, |
| | | currentColumn: [], |
| | | fileInfo: [], |
| | | uploadUrl: "", |
| | | uploadModel: false, |
| | | }; |
| | | }, |
| | | created() { |
| | | try { |
| | | this.useTag = this.$global.table.useTag; |
| | | } catch (error) { |
| | | console.log(error.message); |
| | | } |
| | | //2021.06.19å¤æè°·æå
æ ¸æµè§éæ°è®¡ç®tableé«åº¦ |
| | | // if ( |
| | | // navigator.userAgent.indexOf('Chrome') != -1 || |
| | | // navigator.userAgent.indexOf('Edge') != -1 |
| | | // ) { |
| | | // this.isChrome = true; |
| | | // } |
| | | this.realHeight = this.getHeight(); |
| | | this.realMaxHeight = this.getMaxHeight(); |
| | | this.fxRight = this.columns.some((x) => { |
| | | return x.fixed == "right"; |
| | | }); |
| | | //2021.09.21ç§»é¤å¼ºå¶åºå®è¡å·ä¸checkboxå |
| | | if ( |
| | | this.columns.some((x) => { |
| | | return x.fixed && x.fixed != "right"; |
| | | }) |
| | | ) { |
| | | this.fixed = true; |
| | | } |
| | | //2022.04.06ä¼åtableå计åºå®åæ¾ç¤º |
| | | // if ( |
| | | // this.columns.some((x) => { |
| | | // return x.summary; |
| | | // }) |
| | | // ) { |
| | | // this.columns.forEach((x) => { |
| | | // if (x.fixed && x.fixed != 'right') { |
| | | // x.fixed = false; |
| | | // } |
| | | // }); |
| | | // this.fixed = false; |
| | | // } |
| | | |
| | | // ä»åå°å 䏿æ¡ç[æ¯å¦å¯ç¨ç]æ°æ®æº |
| | | let keys = []; |
| | | let columnBind = []; |
| | | this.summaryData.push("å计"); |
| | | if (this.columnIndex) { |
| | | this.summaryData.push(" "); |
| | | } |
| | | this.columns.forEach((x, _index) => { |
| | | if (x.cellStyle) { |
| | | this.cellStyleColumns[x.field] = x.cellStyle; |
| | | } |
| | | if (!x.hidden) { |
| | | // this.summaryIndex[x.field] = _index; |
| | | // 2020.10.11ä¿®å¤æ±ååéä½çé®é¢ |
| | | this.summaryData.push(""); |
| | | this.summaryIndex[x.field] = this.summaryData.length - 1; |
| | | } |
| | | // æ±å |
| | | if (x.summary && !this.summary) { |
| | | this.summary = true; |
| | | } |
| | | if (x.bind && x.bind.key && (!x.bind.data || x.bind.data.length == 0)) { |
| | | // åå
¥è¿ç¨ |
| | | if (!x.bind.data) x.bind.data = []; |
| | | if (x.bind.remote) { |
| | | this.remoteColumns.push(x); |
| | | } else if (this.loadKey) { |
| | | keys.push(x.bind.key); |
| | | x.bind.valueTyoe = x.type; |
| | | columnBind.push(x.bind); |
| | | } |
| | | } |
| | | }); |
| | | if (keys.length > 0) { |
| | | this.http |
| | | .post("/api/Sys_Dictionary/GetVueDictionary", keys) |
| | | .then((dic) => { |
| | | dic.forEach((x) => { |
| | | if (x.data.length > this.select2Count) { |
| | | x.data.forEach((item) => { |
| | | item.label = item.value; |
| | | item.value = item.key; |
| | | }); |
| | | } |
| | | columnBind.forEach((c) => { |
| | | // è½¬æ¢æ°æ®æºçç±»åä¸åçç±»åä¸è´(2020.04.04) |
| | | if ( |
| | | c.key == x.dicNo && |
| | | (c.valueTyoe == "int" || c.valueTyoe == "sbyte") |
| | | ) { |
| | | x.data.forEach((d) => { |
| | | // 2020.09.01å¢å 对æ°åç±»åçäºæ¬¡å¤æ |
| | | if (!isNaN(d.key)) { |
| | | d.key = ~~d.key; |
| | | } |
| | | }); |
| | | } |
| | | if (c.key == x.dicNo) c.data.push(...x.data); |
| | | }); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | this.paginations.sort = this.pagination.sortName; |
| | | // 2020.08.29å¢å èªå®ä¹å页æ¡å¤§å° |
| | | Object.assign(this.paginations, this.pagination); |
| | | if (this.pagination.size) { |
| | | this.paginations.rows = this.pagination.size; |
| | | } |
| | | this.enableEdit = this.columns.some((x) => { |
| | | return x.hasOwnProperty("edit"); |
| | | }); |
| | | let keyColumn = this.columns.find((x) => { |
| | | return x.isKey; |
| | | }); |
| | | if (keyColumn) { |
| | | this.key = keyColumn.field; |
| | | } |
| | | this.defaultLoadPage && this.load(); |
| | | }, |
| | | computed: { |
| | | filterColumns() { |
| | | return this.columns.filter((x, index) => { |
| | | if (!x.field) { |
| | | x.field = x.title + index; |
| | | } |
| | | return !x.hidden; |
| | | }); |
| | | }, |
| | | }, |
| | | methods: { |
| | | watchRowSelectChange(newLen, oldLen) { |
| | | if (newLen < oldLen && this.selectRows.length) { |
| | | this.selectRows = []; |
| | | this.$refs.table.clearSelection(); |
| | | } |
| | | }, |
| | | switchChange(val, row, column) { |
| | | //è¿éå¨åå§åçæ¶åä¹ä¼è§¦åchangeäºä»¶ |
| | | if (Object.keys(row).length <= 1) { |
| | | return; |
| | | } |
| | | if (column.onChange) { |
| | | column.onChange(val, row, column); |
| | | } |
| | | }, |
| | | inputKeyPress(row, column, $event, $e) { |
| | | column.onKeyPress && column.onKeyPress(row, column, $event); |
| | | this.getInputSummaries(null, null, $event, column); |
| | | }, |
| | | extraClick(row, column) { |
| | | column.extra.click && |
| | | column.extra.click( |
| | | row, |
| | | column, |
| | | this.url ? this.rowData : this.tableData |
| | | ); |
| | | }, |
| | | headerClick(column, event) { |
| | | if (this.clickEdit && this.edit.rowIndex != -1) { |
| | | if ( |
| | | this.rowEndEdit( |
| | | this.url |
| | | ? this.rowData[this.edit.rowIndex] |
| | | : this.tableData[this.edit.rowIndex], |
| | | column |
| | | ) |
| | | ) { |
| | | this.edit.rowIndex = -1; |
| | | } |
| | | } |
| | | // this.edit.rowIndex = -1; |
| | | }, |
| | | rowDbClick(row, column, event) { |
| | | //2021.05.23å¢å åå»è¡äºä»¶ |
| | | this.$emit("rowDbClick", { row, column, event }); |
| | | }, |
| | | rowClick(row, column, event) { |
| | | //2022.02.20å¢å ç¹å»æ¶è¡¨æ ¼åæ°å¤æ |
| | | if (!column) { |
| | | return; |
| | | } |
| | | //æ£å¨ç¼è¾æ¶ï¼ç¦æ¢åºårowClickäºä»¶ |
| | | if (this.edit.rowIndex == -1) { |
| | | this.$emit("rowClick", { row, column, event }); |
| | | } |
| | | // ç¹å»è¡äºä»¶(2020.11.07) |
| | | |
| | | if (!this.doubleEdit) { |
| | | return; |
| | | } |
| | | // ç¹å»å
¶ä»è¡æ¶ï¼å¦æç¹å»çè¡ä¸æ£å¨ç¼è¾çè¡ç¸åï¼ä¿æç¼è¾ç¶æ |
| | | if (this.clickEdit && this.edit.rowIndex != -1) { |
| | | if (row.elementIndex == this.edit.rowIndex) { |
| | | // ç¹å»çåå
æ ¼å¦æä¸å¯ä»¥ç¼è¾ï¼ç´æ¥ç»æç¼è¾ |
| | | // 2020.10.12ä¿®å¤ç»æç¼è¾æ¶ï¼element tableé«çæ¬å±æ§è·åä¸å°çé®é¢ |
| | | let _col = this.columns.find((x) => { |
| | | return x.field == ((event && event.property) || column.property); |
| | | }); |
| | | if (_col && (!_col.edit || _col.readonly)) { |
| | | if (this.rowEndEdit(row, event)) { |
| | | this.edit.rowIndex = -1; |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | if (this.rowEndEdit(row, event && event.property ? event : column)) { |
| | | this.edit.rowIndex = -1; |
| | | } |
| | | //彿£å¨ç¼è¾ï¼ä¸ç¹å»å°å
¶ä»è¡æ¶ï¼å¨åç¼è¾çè¡ç»æç¼è¾åï¼è§¦åæ°è¡çrowClickäºä»¶ |
| | | //æ£å¨ç¼è¾æ¶ï¼ç¦æ¢åºårowClickäºä»¶ |
| | | if (this.edit.rowIndex == -1) { |
| | | this.$emit("rowClick", { row, column, event }); |
| | | } |
| | | } |
| | | this.rowBeginEdit(row, column); |
| | | }, |
| | | dowloadFile(file) { |
| | | this.base.dowloadFile( |
| | | file.path, |
| | | file.name, |
| | | { |
| | | Authorization: this.$store.getters.getToken(), |
| | | }, |
| | | this.http.ipAddress |
| | | ); |
| | | }, |
| | | getFilePath(pathSring, column) { |
| | | // è·å表çå¾ç䏿件æ¾ç¤º |
| | | if (!pathSring) return []; |
| | | // å¢å å¾çèªå®ä¹æä½ |
| | | // è¿åæ ¼å¼å¿
é¡»æ¯[{name:"æä»¶å",path:"å¾çå
¨è·¯å¾æbase64æ ¼å¼"}] |
| | | if (column.formatter) { |
| | | return column.formatter(pathSring); |
| | | } |
| | | let filePath; |
| | | if (column.base64 && pathSring.indexOf("data") != -1) { |
| | | filePath = ("," + pathSring) |
| | | .split(",data") |
| | | .filter((x) => { |
| | | return x; |
| | | }) |
| | | .map((m) => { |
| | | return "data" + m; |
| | | }); |
| | | } else { |
| | | filePath = pathSring.replace(/\\/g, "/").split(","); |
| | | } |
| | | |
| | | let fileInfo = []; |
| | | for (let index = 0; index < filePath.length; index++) { |
| | | let file = filePath[index]; |
| | | // 2020.12.19å¢å base64å¾çæ¾ç¤º |
| | | if (column.base64) { |
| | | fileInfo.push({ |
| | | name: "", |
| | | path: |
| | | (file.indexOf("data") == -1 ? "data:image/png;base64," : "") + |
| | | file, |
| | | }); |
| | | } else if (file.indexOf(".") != -1) { |
| | | let splitFile = file.split("/"); |
| | | if (splitFile.length > 0) { |
| | | fileInfo.push({ |
| | | name: splitFile[splitFile.length - 1], |
| | | path: this.base.isUrl(file) ? file : this.http.ipAddress + file, |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | return fileInfo; |
| | | }, |
| | | // éç½®table |
| | | reset() { |
| | | if (this.tableData && this.tableData.length > 0) { |
| | | this.tableData.splice(0); |
| | | } |
| | | if (this.rowData && this.rowData.length > 0) { |
| | | this.rowData.splice(0); |
| | | } |
| | | if (!this.paginationHide) { |
| | | this.paginations.page = 1; |
| | | // this.paginations.rows = 30; |
| | | if (this.paginations.wheres && this.paginations.wheres.length > 0) { |
| | | this.paginations.wheres.splice(0); |
| | | } |
| | | } |
| | | this.errorFiled = ""; |
| | | this.edit.columnIndex = -1; |
| | | this.edit.rowIndex = -1; |
| | | }, |
| | | getHeight() { |
| | | // 没æå®ä¹é«åº¦ä¸æå¤§é«åº¦ï¼ä½¿ç¨tableé»è®¤å¼ |
| | | if (!this.height && !this.maxHeight) { |
| | | return null; |
| | | } |
| | | // å®ä¹äºæå¤§é«åº¦åä¸ä½¿ç¨é«åº¦ |
| | | if (this.maxHeight) { |
| | | return null; |
| | | } |
| | | // 使ç¨å½åå®ä¹çé«åº¦ |
| | | return this.height; |
| | | }, |
| | | getMaxHeight() { |
| | | // 没æå®ä¹é«åº¦ä¸æå¤§é«åº¦ï¼ä½¿ç¨tableé»è®¤å¼ |
| | | if (!this.height && !this.maxHeight) { |
| | | return null; |
| | | } |
| | | // å®ä¹äºæå¤§é«åº¦ä½¿ç¨æå¤§é«åº¦ |
| | | if (this.maxHeight) { |
| | | return this.maxHeight; |
| | | } |
| | | // ä¸ä½¿ç¨æå¤§é«åº¦ |
| | | return null; |
| | | }, |
| | | getSelectedOptions(column) { |
| | | if (column.bind && column.bind.data && column.bind.data.length > 0) { |
| | | return column.bind.data; |
| | | } |
| | | return []; |
| | | }, |
| | | formatterClick(row, column, event) { |
| | | if (column.click) { |
| | | column.click(row, column, event); |
| | | event.stopPropagation && event.stopPropagation(); |
| | | } else { |
| | | this.rowClick(row, column, event); |
| | | } |
| | | }, |
| | | initIndex({ row, rowIndex }) { |
| | | if (this.index) { |
| | | row.elementIndex = rowIndex; |
| | | } |
| | | // if (rowIndex%2!==0) { |
| | | // return "even-row"; |
| | | // } |
| | | return; |
| | | }, |
| | | toggleEdit(event) {}, |
| | | setEditStatus(status) { |
| | | // this.columns.forEach((x) => { |
| | | // if (x.hasOwnProperty("edit")) { |
| | | // this.$set(x.edit, "status", status); |
| | | // } |
| | | // }); |
| | | }, |
| | | // éè¿buttonæé®å¯ç¨ç¼è¾ |
| | | beginWithButtonEdit(scope) { |
| | | // url?rowData:tableData |
| | | this.rowBeginEdit(scope.row, this.columns[scope.$index]); |
| | | }, |
| | | rowBeginEdit(row, column) { |
| | | if (this.edit.rowIndex != -1) { |
| | | return; |
| | | } |
| | | let _row = this.columns.find((x) => x.field == column.property); |
| | | if (_row) { |
| | | if (_row.readonly) { |
| | | return; |
| | | } |
| | | if ( |
| | | //ä¸è½ç¼è¾çåæ®µãswitchï¼ç¹å»ä¸å¼å¯å¯ç¼è¾åè½ |
| | | !_row.edit || |
| | | (_row.edit.keep && _row.edit.type == "switch") |
| | | ) { |
| | | return; |
| | | } |
| | | } |
| | | if (!this.enableEdit) return; |
| | | _errMsg = ""; |
| | | // ç¼è¾å |
| | | this.columns |
| | | .filter((x) => { |
| | | return x.bind && x.bind.data && x.bind.data.length; |
| | | }) |
| | | .forEach((column) => { |
| | | let val = row[column.field]; |
| | | if (typeof column.bind.data[0].key == "string") { |
| | | if (typeof val == "number") { |
| | | row[column.field] = row[column.field] + ""; |
| | | } |
| | | } else { |
| | | if (typeof val == "string" && val) { |
| | | let _val = val * 1; |
| | | if (_val + "" === val) { |
| | | row[column.field] = _val; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | if (!this.beginEdit(row, column, row.elementIndex)) return; |
| | | if (row.hasOwnProperty("elementIndex")) { |
| | | if (this.edit.rowIndex == row.elementIndex) { |
| | | return; |
| | | } |
| | | this.edit.rowIndex = row.elementIndex; |
| | | } |
| | | }, |
| | | rowEndEdit(row, column, event) { |
| | | if (this.clickEdit && event) { |
| | | return true; |
| | | } |
| | | if (!this.enableEdit) { |
| | | if (!this.errorFiled) { |
| | | if ( |
| | | this.edit.rowIndex != -1 && |
| | | !this.endEditAfter(row, column, this.edit.rowIndex) |
| | | ) { |
| | | return false; |
| | | } |
| | | this.edit.rowIndex = -1; |
| | | } |
| | | return true; |
| | | } |
| | | if (!this.doubleEdit && event) { |
| | | return true; |
| | | } |
| | | let _row = this.url |
| | | ? this.rowData[this.edit.rowIndex] |
| | | : this.tableData[this.edit.rowIndex]; |
| | | // ç»æç¼è¾å |
| | | if (!this.endEditBefore(_row, column, this.edit.rowIndex)) return false; |
| | | if (this.edit.rowIndex != -1) { |
| | | //2022.06.26ä¿®å¤è¡¨æ ¼å
容忢åè¡æ°ä¸ä¸è´æ¶ä¸è½ç¼è¾çé®é¢ |
| | | if (this.edit.rowIndex - 1 > (this.rowData || this.tableData).length) { |
| | | this.edit.rowIndex = -1; |
| | | return; |
| | | } |
| | | let row = (this.url ? this.rowData : this.tableData)[ |
| | | this.edit.rowIndex |
| | | ]; |
| | | for (let index = 0; index < this.columns.length; index++) { |
| | | const _column = this.columns[index]; |
| | | if (_column.edit) { |
| | | if (!this.validateRow(row, _column)) { |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (!this.endEditAfter(_row, column, this.edit.rowIndex)) return false; |
| | | this.edit.rowIndex = -1; |
| | | return true; |
| | | }, |
| | | validateRow(row, option1) { |
| | | if (!this.validateColum(option1, row)) { |
| | | this.errorFiled = option1.field; |
| | | // 2022.05.06 ä¿®æ¹é误信æ¯éå¤çé®é¢ |
| | | this.$message.error(option1.title + _errMsg); |
| | | return false; |
| | | } |
| | | this.errorFiled = ""; |
| | | return true; |
| | | }, |
| | | validateColum(option, data) { |
| | | if (option.hidden || option.bind) return true; |
| | | let val = data[option.field]; |
| | | if (option.require || option.required) { |
| | | if (val != "0" && (val === "" || val === undefined)) { |
| | | if (!this.errorFiled) { |
| | | _errMsg = "ä¸è½ä¸ºç©º"; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | if (!option.edit) { |
| | | return true; |
| | | } |
| | | let editType = option.edit.type; |
| | | // éªè¯æ°å |
| | | if (editType == "int" || editType == "decimal" || editType == "number") { |
| | | if (val == "" || val == undefined) return true; |
| | | if (editType == "decimal") { |
| | | if (!this.rule.decimal.test(val)) { |
| | | _errMsg = "åªè½æ¯æ°å"; |
| | | return false; |
| | | } |
| | | } else if (!this.rule.decimal.test(val)) { |
| | | _errMsg = "åªè½æ¯æ°å"; |
| | | return false; |
| | | } |
| | | if ( |
| | | option.edit.min != undefined && |
| | | typeof option.edit.min === "number" && |
| | | val < option.edit.min |
| | | ) { |
| | | _errMsg = "ä¸è½å°äº" + option.edit.min; |
| | | return false; |
| | | } |
| | | if ( |
| | | option.edit.max != undefined && |
| | | typeof option.edit.max === "number" && |
| | | val > option.edit.max |
| | | ) { |
| | | _errMsg = "ä¸è½å¤§äº" + option.edit.max; |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // éªè¯å符串 |
| | | if (val && (editType == "text" || editType == "string")) { |
| | | if ( |
| | | option.edit.min != undefined && |
| | | typeof option.edit.min === "number" && |
| | | val.length < option.edit.min |
| | | ) { |
| | | _errMsg = "è³å°" + option.edit.min + "个å符"; |
| | | return false; |
| | | } |
| | | if ( |
| | | option.edit.max != undefined && |
| | | typeof option.edit.max === "number" && |
| | | val.length > option.edit.max |
| | | ) { |
| | | _errMsg = "æå¤" + option.edit.max + "个å符"; |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | }, |
| | | delRow() { |
| | | let rows = this.getSelected(); |
| | | if (rows.length == 0) return this.$Message.error("è¯·éæ©è¦å é¤çè¡!"); |
| | | |
| | | let data = this.url ? this.rowData : this.tableData; |
| | | let indexArr = this.getSelectedIndex(); |
| | | if (indexArr.length == 0) { |
| | | return this.$Message.error( |
| | | "å 餿ä½å¿
须设置VolTableç屿§index='true'" |
| | | ); |
| | | } |
| | | // if (indexArr.length == 0 || !this.key) { |
| | | // return this.$message.error( |
| | | // "请设置index=true屿§ææcolumnsçåæ®µä¸ºkey" |
| | | // ); |
| | | // } |
| | | if (indexArr.length == 0) { |
| | | // let keyValues=[] |
| | | // rows.forEach(x=>{ |
| | | // if (x[this.key]) { |
| | | // } |
| | | // keyValues.push(x[this.key]) |
| | | // }) |
| | | // data.find(x=>) |
| | | } else { |
| | | for (let i = data.length - 1; i >= 0; i--) { |
| | | if (indexArr.indexOf(i) != -1) { |
| | | data.splice(i, 1); |
| | | } |
| | | } |
| | | } |
| | | this.edit.rowIndex = -1; |
| | | return rows; |
| | | }, |
| | | addRow(row) { |
| | | if (!row) { |
| | | row = {}; |
| | | } |
| | | this.columns.forEach((x) => { |
| | | // 2022.05.06 æ·»å è¡æ¶ï¼å¦æåæç¼è¾å±æ§ï¼è®¾ç½®å¼å¯ç¼è¾(é¿å
å
³éç¼è¾åï¼æ æ³å次å¯ç¨ç¼è¾)?? |
| | | //x.readonly = false; |
| | | if (!row.hasOwnProperty(x.field)) { |
| | | if (x.edit && x.edit.type == "switch") { |
| | | row[x.field] = x.type == "bool" ? false : 0; |
| | | } else if (!row.hidden) { |
| | | // 2020.09.06æ·»å è¡æ¶ï¼è®¾ç½®é»è®¤å段 |
| | | row[x.field] = undefined; |
| | | } |
| | | } |
| | | }); |
| | | if (!this.url) { |
| | | this.tableData.push(row); |
| | | return; |
| | | } |
| | | this.rowData.push(row); |
| | | }, |
| | | viewImg(row, column, url, $event) { |
| | | $event.stopPropagation(); |
| | | this.base.previewImg(url); |
| | | // window.open(row[column.field]); |
| | | }, |
| | | link(row, column, $e) { |
| | | $e.stopPropagation(); |
| | | this.$props.linkView(row, column); |
| | | }, |
| | | getSelected() { |
| | | return this.selectRows; |
| | | }, |
| | | getSelectedIndex() { |
| | | if (!this.index) { |
| | | // åªæè®¾ç½®äºå±æ§indexææç´¢å¼è¡ |
| | | return []; |
| | | } |
| | | let indexArr = this.selectRows.map((x) => { |
| | | return x.elementIndex; |
| | | }); |
| | | return indexArr || []; |
| | | }, |
| | | GetTableDictionary(rows) { |
| | | // å页æå·æ°æéæ°ç»å®æ°æ®æº |
| | | if (this.remoteColumns.length == 0 || !rows || rows.length == 0) return; |
| | | let remoteInfo = {}; |
| | | for (let index = 0; index < this.remoteColumns.length; index++) { |
| | | const column = this.remoteColumns[index]; |
| | | // column.bind.data.splice(0); |
| | | let key = column.bind.key; |
| | | let data = []; |
| | | rows.forEach((row) => { |
| | | if (row[column.field] || row[column.field] == "0") { |
| | | if (data.indexOf(row[column.field]) == -1) { |
| | | data.push(row[column.field]); |
| | | } |
| | | } |
| | | }); |
| | | if (data.length > 0) { |
| | | remoteInfo[key] = data; |
| | | } |
| | | } |
| | | if (remoteInfo.length == 0) return; |
| | | // ha= Object.assign([], ha, hb) |
| | | this.http |
| | | .post("/api/Sys_Dictionary/GetTableDictionary", remoteInfo) |
| | | .then((dic) => { |
| | | dic.forEach((x) => { |
| | | this.remoteColumns.forEach((column) => { |
| | | if (column.bind.key == x.key) { |
| | | column.bind.data = Object.assign([], column.bind.data, x.data); |
| | | // column.bind.data.push(...x.data); |
| | | } |
| | | }); |
| | | }); |
| | | this.$emit("dicInited", dic); |
| | | }); |
| | | }, |
| | | load(query, isResetPage) { |
| | | // isResetPageéç½®åé¡µæ°æ® |
| | | if (!this.url) return; |
| | | if (isResetPage) { |
| | | this.resetPage(); |
| | | } |
| | | let param = { |
| | | page: this.paginations.page, |
| | | rows: this.paginations.rows, |
| | | sort: this.paginations.sort, |
| | | order: this.paginations.order, |
| | | wheres: [], // æ¥è¯¢æ¡ä»¶ï¼æ ¼å¼ä¸º[{ name: "åæ®µ", value: "xx" }] |
| | | }; |
| | | let status = true; |
| | | // åå¹¶æ¥è¯¢ä¿¡æ¯(å
æ¥è¯¢å页ãæåºãæ¥è¯¢æ¡ä»¶ç) |
| | | if (query) { |
| | | param = Object.assign(param, query); |
| | | } |
| | | /* æ¥è¯¢åå¤ç(妿éè¦æ¥è¯¢æ¡ä»¶ï¼å®ç°ç»ä»¶æ¹æ³loadBeforeæ¹æ³å³å¯: |
| | | loadBefore=(param, callBack)=>{ |
| | | param.wheres = [{ name: "PhoneNo", value: "13419098211" }]; |
| | | callBack(true); |
| | | }) |
| | | */ |
| | | this.$emit("loadBefore", param, (result) => { |
| | | status = result; |
| | | }); |
| | | if (!status) return; |
| | | |
| | | if (param.wheres && param.wheres instanceof Array) { |
| | | param.wheres = JSON.stringify(param.wheres); |
| | | } |
| | | this.loading = true; |
| | | this.http.post(this.url, param).then( |
| | | (data) => { |
| | | //2021.06.04ä¿®å¤treeä¸å·æ°çé®é¢ |
| | | if (this.rowKey) { |
| | | this.randomTableKey++; |
| | | this.rowData.splice(0); |
| | | } |
| | | this.loading = false; |
| | | // æ¥è¯¢è¿åç»æåå¤ç |
| | | // 2020.10.30å¢å æ¥è¯¢åè¿åææçæ¥è¯¢ä¿¡æ¯ |
| | | this.$emit( |
| | | "loadAfter", |
| | | data.rows || [], |
| | | (result) => { |
| | | status = result; |
| | | }, |
| | | data |
| | | ); |
| | | if (!status) return; |
| | | this.GetTableDictionary(data.rows); |
| | | this.rowData = data.rows || []; |
| | | this.paginations.total = data.total; |
| | | // å计 |
| | | this.getSummaries(data); |
| | | // this.$nextTick(() => { |
| | | // this.$refs.table.doLayout(); |
| | | // }); |
| | | }, |
| | | (error) => { |
| | | this.loading = false; |
| | | // this.$Message.error(error || "ç½ç»å¼å¸¸"); |
| | | } |
| | | ); |
| | | }, // è·åç»è®¡ |
| | | getSummaries(data) { |
| | | if (!this.summary || !data.summary) return; |
| | | this.summaryData.splice(0); |
| | | // å¼å¯äºè¡å·çï¼+1 |
| | | if (this.columnIndex) { |
| | | this.summaryData.push(""); |
| | | } |
| | | // 妿æcheckboxï¼åºè¯¥ç®ä½æ¯ç¬¬ä¸è¡ |
| | | if (this.ck) { |
| | | this.summaryData.push(""); |
| | | } |
| | | |
| | | this.columns.forEach((col) => { |
| | | if (col.children && col.children.length) { |
| | | col.children.forEach((item) => { |
| | | this.getColumnSummaries(item, data); |
| | | }); |
| | | } else { |
| | | this.getColumnSummaries(col, data); |
| | | } |
| | | }); |
| | | if (this.summaryData.length > 0 && this.summaryData[0] == "") { |
| | | this.summaryData[0] = "å计"; |
| | | } |
| | | }, |
| | | getColumnSummaries(col, data) { |
| | | if (!col.hidden) { |
| | | if (data.summary.hasOwnProperty(col.field)) { |
| | | let sum = data.summary[col.field]; |
| | | if (sum) { |
| | | sum = |
| | | (sum * 1.0).toFixed(col.numberLength || 2).replace(".00", "") * |
| | | 1.0; |
| | | } |
| | | this.summaryData.push(sum); |
| | | } else { |
| | | this.summaryData.push(""); |
| | | } |
| | | } |
| | | }, |
| | | getInputChangeSummaries() {}, |
| | | handleSizeChange(val) { |
| | | this.paginations.size = val; |
| | | this.paginations.rows = val; |
| | | this.load(); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.paginations.page = val; |
| | | this.load(); |
| | | }, |
| | | sortChange(sort) { |
| | | this.paginations.sort = sort.prop; |
| | | this.paginations.order = sort.order == "ascending" ? "asc" : "desc"; |
| | | this.load(); |
| | | }, |
| | | resetPage() { |
| | | // éç½®æ¥è¯¢å页 |
| | | // this.paginations.rows = 30; |
| | | this.paginations.page = 1; |
| | | }, |
| | | selectionChange(selection) { |
| | | // console.log(selection); |
| | | // éæ©è¡äºä»¶,åªæåéæè§¦å |
| | | this.selectRows = selection; |
| | | if (this.single) { |
| | | if (selection.length == 1) { |
| | | this.$emit("rowChange", selection[0]); |
| | | } |
| | | if (selection.length > 1) { |
| | | let _row = selection[selection.length - 1]; |
| | | this.$refs.table.toggleRowSelection(selection[0]); |
| | | this.selectRows = [_row]; |
| | | } |
| | | } |
| | | // å°selectionchangeæ´é²åºå» |
| | | this.$emit("selectionChange", selection); |
| | | }, |
| | | getColor(row, column) { |
| | | let val = row[column.field]; |
| | | if (column.getColor && typeof column.getColor === "function") { |
| | | let _color = column.getColor(row, column); |
| | | if (_color) { |
| | | return _color; |
| | | } |
| | | } |
| | | if (!val && val != "0") { |
| | | return ""; |
| | | } |
| | | if (!this.formatConfig[column.field]) { |
| | | this.formatConfig[column.field] = [val]; |
| | | return this.colors[0]; |
| | | } |
| | | let index = this.formatConfig[column.field].indexOf(val); |
| | | if (index != -1) { |
| | | return this.colors[index]; |
| | | } |
| | | if (this.formatConfig[column.field].length > 5) { |
| | | return ""; |
| | | } |
| | | |
| | | if (index == -1) { |
| | | this.formatConfig[column.field].push(val); |
| | | index = this.formatConfig[column.field].length - 1; |
| | | } |
| | | return this.colors[index]; |
| | | }, |
| | | formatterDate(row, column) { |
| | | return (row[column.field] || "").substr(0, 10); |
| | | }, |
| | | formatter(row, column, template) { |
| | | if (!template) return row[column.property]; |
| | | let val = row[column.field]; |
| | | if (!val && val != 0) return val; |
| | | // æ¯å¦å¼ |
| | | if (column.edit && column.edit.type == "switch") { |
| | | return val ? "æ¯" : "å¦"; |
| | | } |
| | | if (!column.bind || !column.bind.data) { |
| | | return row[column.field]; |
| | | } |
| | | |
| | | if ( |
| | | column.edit && |
| | | (column.edit.type == "selectList" || column.edit.type == "treeSelect") |
| | | ) { |
| | | if (!Array.isArray(val)) { |
| | | row[column.field] = val.split(","); |
| | | } else { |
| | | val = val.join(","); |
| | | } |
| | | return this.getSelectFormatter(column, val); |
| | | } |
| | | // ç¼è¾å¤étableæ¾ç¤º |
| | | if ( |
| | | column.bind.type == "selectList" || |
| | | column.bind.type == "checkbox" || |
| | | column.bind.type == "treeSelect" |
| | | ) { |
| | | // if (typeof val === 'string' && val.indexOf(',') != -1) { |
| | | return this.getSelectFormatter(column, val + ""); |
| | | // } |
| | | } |
| | | let source = column.bind.data.filter((x) => { |
| | | // return x.key != "" && x.key == val; |
| | | // 2020.06.06ä¿®å¤åç¬ä½¿ç¨tableç»ä»¶æ¶,key为æ°å0æ¶è½¬æ¢æææ¬å¤±è´¥çé®é¢ |
| | | return x.key !== "" && x.key !== undefined && x.key + "" === val + ""; |
| | | }); |
| | | if (source && source.length > 0) val = source[0].label || source[0].value; |
| | | return val; |
| | | }, |
| | | getSelectFormatter(column, val) { |
| | | // ç¼è¾å¤étableæ¾ç¤º |
| | | let valArr = val.split(","); |
| | | for (let index = 0; index < valArr.length; index++) { |
| | | (column.bind.orginData && column.bind.orginData.length |
| | | ? column.bind.orginData |
| | | : column.bind.data |
| | | ).forEach((x) => { |
| | | // 2020.06.06ä¿®å¤æ°æ®æºä¸ºselectListæ¶,key为æ°å0æ¶ä¸è½è½¬æ¢ææ¬çé®é¢ |
| | | if ( |
| | | x.key !== "" && |
| | | x.key !== undefined && |
| | | x.key + "" == valArr[index] + "" |
| | | ) { |
| | | valArr[index] = x.label || x.value; |
| | | } |
| | | }); |
| | | } |
| | | return valArr.join(","); |
| | | }, |
| | | onChange(scope, val, event, column) { |
| | | // 2020.09.03ä¿®å¤onChangeä¸è§¦åçé®é¢ |
| | | let row = scope.row; |
| | | if (column.onChange && !column.onChange(row, val, event)) { |
| | | return; |
| | | } |
| | | // è¾å
¥æ¡æ±å宿¶è®¡ç® |
| | | this.getInputSummaries(scope, val, event, column); |
| | | }, |
| | | // inputè¾å
¥å®æ¶æ±å |
| | | getInputSummaries(scope, val, event, column) { |
| | | // columnå设置äºsummary屿§çæè®¡ç®å¼ |
| | | if (!column.summary) return; |
| | | let sum = 0; |
| | | // let _index = 0; |
| | | (this.url ? this.rowData : this.tableData).forEach((x, index) => { |
| | | if (x.hasOwnProperty(column.field) && !isNaN(x[column.field])) { |
| | | // _index = index; |
| | | sum += x[column.field] * 1; |
| | | } |
| | | }); |
| | | if (sum) { |
| | | if (column.summary == "avg") { |
| | | sum = sum / (this.rowData.length || this.tableData.length || 1); |
| | | } |
| | | sum = |
| | | (sum * 1.0).toFixed(column.numberLength || 2).replace(".00", "") * |
| | | 1.0; |
| | | } |
| | | this.summaryData[this.summaryIndex[column.field]] = sum; |
| | | }, |
| | | getSummaryData({ columns, data }) { |
| | | return this.summaryData; |
| | | }, |
| | | getCellStyle(row) { |
| | | // 2020.12.13å¢å 设置åå
æ ¼é¢è² |
| | | if (row.column.property) { |
| | | return ( |
| | | this.cellStyleColumns[row.column.property] && |
| | | this.cellStyleColumns[row.column.property]( |
| | | row.row, |
| | | row.rowIndex, |
| | | row.columnIndex |
| | | ) |
| | | ); |
| | | } |
| | | }, |
| | | compareDate(date1, date2) { |
| | | if (!date2) { |
| | | return true; |
| | | } |
| | | return ( |
| | | date1.valueOf() < |
| | | (typeof date2 == "number" ? date2 : new Date(date2).valueOf()) |
| | | ); |
| | | }, |
| | | getDateOptions(date, item) { |
| | | //2021.07.17设置æ¶é´å¯éèå´ |
| | | if ((!item.min && !item.max) || !date) { |
| | | return false; |
| | | } |
| | | if (item.min && item.min.indexOf(" ") == -1) { |
| | | //ä¸è®¾ç½®æ¶åç§ï¼åé¢ä¼èªå¨å ä¸ 08:00 |
| | | item.min = item.min + " 00:00:000"; |
| | | } |
| | | return ( |
| | | this.compareDate(date, item.min) || !this.compareDate(date, item.max) |
| | | ); |
| | | }, |
| | | getDateFormat(column) { |
| | | //è§https://day.js.org/docs/zh-CN/display/format |
| | | return column.edit.type == "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss"; |
| | | }, |
| | | userSelect(selection, row) { |
| | | this.selectRows = selection; |
| | | if (!this.single) { |
| | | this.$emit("rowChange", { row, selection }); |
| | | } |
| | | }, |
| | | isEmptyTag(row, column) { |
| | | if (!row[column.field] && row[column.field] != "0") { |
| | | return "empty-tag"; |
| | | } |
| | | return ""; |
| | | }, |
| | | filterChildrenColumn(children) { |
| | | if (!children) { |
| | | return []; |
| | | } |
| | | return children.filter((x) => { |
| | | return !x.hidden; |
| | | }); |
| | | }, |
| | | initColumnDisabled(row, column) { |
| | | return column.getDisabled && column.getDisabled(row, column); |
| | | }, |
| | | showUpload(row, column) { |
| | | this.fileInfo = (row[column.field] || "") |
| | | .split(",") |
| | | .filter((x) => { |
| | | return x; |
| | | }) |
| | | .map((item) => { |
| | | return { path: item, name: "" }; |
| | | }); |
| | | this.currentRow = row; |
| | | this.currentColumn = column; |
| | | if (this.currentColumn.edit.autoUpload === undefined) { |
| | | this.currentColumn.edit.autoUpload = true; |
| | | } |
| | | if (this.currentColumn.edit.multiple === undefined) { |
| | | this.currentColumn.edit.multiple = false; |
| | | } |
| | | |
| | | if (this.currentColumn.edit.url === undefined) { |
| | | this.uploadUrl = |
| | | "api/" + |
| | | (this.url || "").replace("/api", "api").split("/")[1] + |
| | | "/upload"; |
| | | } else { |
| | | this.uploadUrl = this.currentColumn.edit.url; |
| | | } |
| | | this.uploadModel = true; |
| | | }, |
| | | uploadAfter(result, files) { |
| | | this.currentColumn.uploadAfter && |
| | | this.currentColumn.uploadAfter(result, files); |
| | | return true; |
| | | }, |
| | | saveUpload() { |
| | | //çæä¿ååè¿åçè·¯å¾ |
| | | let arr = this.fileInfo.map((x) => { |
| | | if (x.path) { |
| | | return x.path; |
| | | } |
| | | return result.data + x.name; |
| | | }); |
| | | |
| | | this.currentRow[this.currentColumn.field] = arr.join(","); |
| | | this.uploadModel = false; |
| | | return true; |
| | | }, |
| | | }, |
| | | }); |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .vol-table { |
| | | position: relative; |
| | | .mask { |
| | | opacity: 0.2; |
| | | position: absolute; |
| | | width: 100%; |
| | | height: 100%; |
| | | background: #d0d0d0; |
| | | z-index: 100; |
| | | } |
| | | .message { |
| | | text-align: center; |
| | | color: #635c5c; |
| | | font-size: 15px; |
| | | font-weight: 600; |
| | | background: #eee; |
| | | transform: translateY(-50%); |
| | | top: 50%; |
| | | position: absolute; |
| | | z-index: 200; |
| | | left: 0; |
| | | right: 0; |
| | | width: 150px; |
| | | margin: 0 auto; |
| | | line-height: 40px; |
| | | border-radius: 4px; |
| | | border: 1px solid #a09e9e; |
| | | } |
| | | } |
| | | .e-item { |
| | | display: flex; |
| | | > div:first-child { |
| | | flex: 1; |
| | | } |
| | | } |
| | | .vol-table ::v-deep(.el-pager .number) { |
| | | padding: 0 7px; |
| | | border-radius: 5px; |
| | | border: 1px solid #e6e6e6; |
| | | margin-left: 8px; |
| | | font-weight: 500; |
| | | min-width: 28px; |
| | | } |
| | | .vol-table ::v-deep(.el-pager .number.active) { |
| | | background: #ed4014; |
| | | color: #fff; |
| | | } |
| | | .vol-table .t-file { |
| | | color: #1e8cff; |
| | | cursor: pointer; |
| | | border-bottom: 1px solid; |
| | | padding-bottom: 2px; |
| | | } |
| | | .vol-table .empty-tag { |
| | | border: none; |
| | | background: none; |
| | | } |
| | | .v-table ::v-deep(.el-date-editor .el-icon-date), |
| | | .v-table ::v-deep(.el-date-editor .el-icon-time) { |
| | | width: 10px; |
| | | } |
| | | |
| | | .column-required { |
| | | position: relative; |
| | | color: #f20303; |
| | | font-size: 14px; |
| | | top: 2px; |
| | | right: 2px; |
| | | } |
| | | </style> |
| | | |
| | | <style scoped> |
| | | /* .v-table ::v-deep(.even-row){ |
| | | background: rgb(245,247,250); |
| | | } */ |
| | | .pagination { |
| | | text-align: right; |
| | | padding: 2px 28px; |
| | | border: 1px solid #eee; |
| | | border-top: 0px; |
| | | } |
| | | /* .v-table ::v-deep(.el-input .el-input__inner) { |
| | | padding: 0 7px; |
| | | } */ |
| | | .v-table ::v-deep(.el-table__header th) { |
| | | /* padding: 0px !important; */ |
| | | background-color: #f8f8f9 !important; |
| | | font-size: 13px; |
| | | height: 46px; |
| | | color: #616161; |
| | | } |
| | | |
| | | .v-table ::v-deep(.el-table__header th.is-sortable) { |
| | | padding: 3px !important; |
| | | } |
| | | .vol-table.text-inline ::v-deep(.el-table__body .cell), |
| | | .vol-table.text-inline ::v-deep(.el-table__header-wrapper .cell) { |
| | | word-break: inherit !important; |
| | | white-space: nowrap !important; |
| | | } |
| | | /* .v-table ::v-deep(.el-table__body td) { |
| | | padding: 9px 0 !important; |
| | | } */ |
| | | |
| | | .v-table ::v-deep(.el-table__footer td) { |
| | | padding: 7px 0 !important; |
| | | } |
| | | |
| | | .vol-table ::v-deep(.el-table-column--selection .cell) { |
| | | display: inline; |
| | | } |
| | | .vol-table.text-inline ::v-deep(.el-table th > .cell) { |
| | | white-space: nowrap !important; |
| | | } |
| | | |
| | | .vol-table .table-img { |
| | | height: 40px; |
| | | border-radius: 5px; |
| | | margin-right: 10px; |
| | | width: 40px; |
| | | object-fit: cover; |
| | | } |
| | | .vol-table .table-img:hover { |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .vol-table ::v-deep(.cell) { |
| | | padding: 2px 10px; |
| | | } |
| | | .vol-table ::v-deep(.cell .el-tag) { |
| | | padding: 5px 9px; |
| | | } |
| | | .table-input { |
| | | color: rgb(104, 103, 103); |
| | | padding: 3px 10px; |
| | | height: 32px; |
| | | line-height: 32px; |
| | | width: 100%; |
| | | border-radius: 4px; |
| | | border: 1px solid #dcdcdc; |
| | | } |
| | | .table-input:focus { |
| | | outline: 1px solid #49a3fd; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { h } from 'vue'; |
| | | export default { |
| | | name: "TableExpand", |
| | | functional: true, |
| | | props: { |
| | | render: Function, |
| | | row: {},//å½åè¡çæ°æ® |
| | | column: {},//å½åè¡çé
ç½®ä¿¡æ¯ |
| | | index: { type: Number, default: 0 }//å½åæå¨è¡ |
| | | }, |
| | | render: ({ render,row ,column,index }) => { |
| | | return render(h, {row ,column,index}); //h(); |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="upload-container"> |
| | | <div> |
| | | <div class="input-btns" style="margin-bottom: 10px"> |
| | | <input |
| | | ref="input" |
| | | type="file" |
| | | style="display: none" |
| | | @change="handleChange" |
| | | :multiple="multiple" |
| | | /> |
| | | <div v-if="img" class="upload-img"> |
| | | <!-- v-for="(file,index) in fileInfo.length>0?fileInfo: files" --> |
| | | <div v-for="(file, index) in files" :key="index" class="img-item"> |
| | | <div class="operation"> |
| | | <div class="action"> |
| | | <i class="el-icon-view view" @click="previewImg(index)"></i> |
| | | <i class="el-icon-delete remove" @click="removeFile(index)"></i> |
| | | </div> |
| | | <div class="mask"></div> |
| | | </div> |
| | | |
| | | <img :src="getImgSrc(file, index)" :onerror="errorImg" /> |
| | | </div> |
| | | <div |
| | | v-show="!autoUpload || (autoUpload && files.length < maxFile)" |
| | | class="img-selector" |
| | | :class="getSelector()" |
| | | > |
| | | <div class="selector" @click="handleClick"> |
| | | <i class="el-icon-camera-solid"></i> |
| | | </div> |
| | | <div |
| | | v-if="!autoUpload" |
| | | class="s-btn" |
| | | :class="{ readonly: changed }" |
| | | @click="upload" |
| | | > |
| | | <div>{{ loadText }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <el-button v-else @click="handleClick" |
| | | >éæ©{{ img ? 'å¾ç' : 'æä»¶' }}</el-button |
| | | > |
| | | |
| | | <el-button |
| | | v-if="!autoUpload && !img" |
| | | type="info" |
| | | :disabled="changed" |
| | | @click="upload(true)" |
| | | :loading="loadingStatus" |
| | | >ä¸ä¼ æä»¶</el-button |
| | | > |
| | | </div> |
| | | <slot></slot> |
| | | <div v-if="desc"> |
| | | <el-alert |
| | | :title="getText() + 'æä»¶å¤§å°ä¸è¶
è¿' + (maxSize || 50) + 'M'" |
| | | type="info" |
| | | show-icon |
| | | > |
| | | </el-alert> |
| | | </div> |
| | | <slot name="content"></slot> |
| | | <div v-if="!img"> |
| | | <ul class="upload-list" v-show="fileList"> |
| | | <li class="list-file" v-for="(file, index) in files" :key="index"> |
| | | <a> |
| | | <span @click="fileOnClick(index, file)"> |
| | | <i :class="format(file)"></i> |
| | | {{ file.name }} |
| | | </span> |
| | | </a> |
| | | <span @click="removeFile(index)" class="file-remove"> |
| | | <i class="el-icon-close"></i> |
| | | </span> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | <slot name="tip"></slot> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | let OSS = require('ali-oss'); |
| | | export default { |
| | | components: {}, |
| | | props: { |
| | | desc: { |
| | | //æ¯å¦æ¾ç¤ºé»è®¤ä»ç» |
| | | //æ¯å¦å¤é |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | fileInfo: { |
| | | //ç¨äºæ¥æ¶ä¸ä¼ çæä»¶ï¼ä¹å¯ä»¥å 以é»è®¤å¼ï¼æ¾ç¤ºå·²ä¸ä¼ çæä»¶ï¼ç¨æ·ä¸ä¼ åä¼è¦çé»è®¤å¼ |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | } //æ ¼å¼[{name:'1.jpg',path:'127.0.01/1.jpg'}] |
| | | }, |
| | | downLoad: { |
| | | //æ¯å¦å¯ä»¥ç¹å»æä»¶ä¸è½½ |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | multiple: { |
| | | //æ¯å¦å¤é |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | maxFile: { |
| | | //æå¤å¯éæä»¶æ°éï¼å¿
é¡»multiple=trueï¼æä¼çæ |
| | | type: Number, |
| | | default: 5 |
| | | }, |
| | | maxSize: { |
| | | //æä»¶éå¶å¤§å°3M |
| | | type: Number, |
| | | default: 50 |
| | | }, |
| | | |
| | | autoUpload: { |
| | | //éæ©æä»¶åæ¯å¦èªå¨ä¸ä¼ |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | img: { |
| | | //å¾çç±»å img>excel>fileTypesä¸ç§æä»¶ç±»åä¼å
级 |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | excel: { |
| | | //excelæä»¶ |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | fileTypes: { |
| | | //æå®ä¸ä¼ æä»¶çç±»å |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | } |
| | | }, |
| | | url: { |
| | | //ä¸ä¼ çurl |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | uploadBefore: { |
| | | //è¿åfalseä¼ä¸æ¢æ§è¡ |
| | | //ä¸ä¼ å |
| | | type: Function, |
| | | default: (files) => { |
| | | return true; |
| | | } |
| | | }, |
| | | uploadAfter: { |
| | | //è¿åfalseä¼ä¸æ¢æ§è¡ |
| | | //ä¸ä¼ å |
| | | type: Function, |
| | | default: (result, files) => { |
| | | return true; |
| | | } |
| | | }, |
| | | onChange: { |
| | | //éæ©æä»¶æ¶ //è¿åfalseä¼ä¸æ¢æ§è¡ |
| | | type: Function, |
| | | default: (files) => { |
| | | return true; |
| | | } |
| | | }, |
| | | // clear: { |
| | | // //ä¸ä¼ 宿忝妿¸
空æä»¶å表 |
| | | // type: Boolean, |
| | | // default: true |
| | | // }, |
| | | fileList: { |
| | | //æ¯å¦æ¾ç¤ºéæ©çæä»¶å表 |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | fileClick: { |
| | | //ç¹å»æä»¶äºä»¶ |
| | | type: Function, |
| | | default: (index, file, files) => { |
| | | return true; |
| | | } |
| | | }, |
| | | removeBefore: { |
| | | //ç§»é¤æä»¶äºä»¶ |
| | | type: Function, |
| | | default: (index, file, files) => { |
| | | return true; |
| | | } |
| | | }, |
| | | append: { |
| | | //æ¤å±æ§å·²åºå¼ï¼å¤æä»¶ä¸ä¼ ï¼é»è®¤è¿½å æä»¶ |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | compress: { |
| | | //å¼å¯å¾çå缩,å颿 ¹æ®éè¦åå®å |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | compressMinSize: { |
| | | //å缩çæå°æ¯ä¾ |
| | | type: Number, |
| | | default: 0.1 |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | errorImg: 'this.src="' + require('@/assets/imgs/error-img.png') + '"', |
| | | changed: false, //æå¨ä¸ä¼ æååç¦æ¢éå¤ä¸ä¼ ï¼å¿
须鿰鿩 |
| | | model: true, |
| | | files: [], |
| | | bigImg: '', |
| | | imgTypes: ['gif', 'jpg', 'jpeg', 'png', 'bmp', 'webp', 'jfif'], |
| | | loadingStatus: false, |
| | | loadText: 'ä¸ä¼ æä»¶' |
| | | }; |
| | | }, |
| | | created() { |
| | | //é»è®¤æå¾ççç¦æ¢ä¸ä¼ æä½ |
| | | if (this.fileInfo) { |
| | | this.changed = true; |
| | | } |
| | | this.cloneFile(this.fileInfo); |
| | | }, |
| | | watch: { |
| | | fileInfo: { |
| | | handler(files) { |
| | | this.cloneFile(files); |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | methods: { |
| | | cloneFile(files) { |
| | | this.files = files.map((x) => { |
| | | return { |
| | | name: x.name || this.getFileName(x.path), |
| | | path: x.path |
| | | }; |
| | | }); |
| | | }, |
| | | getFileName(path) { |
| | | if (!path) { |
| | | return 'æªå®ä¹æä»¶å'; |
| | | } |
| | | let _index = path.lastIndexOf('/'); |
| | | return path.substring(_index + 1); |
| | | }, |
| | | previewImg(index) { |
| | | //æ¥ç大å¾é¢è§æ¨¡å¼å¾
å® |
| | | this.base.previewImg(this.getImgSrc(this.files[index])); |
| | | // window.open(this.getImgSrc((this.files.length>0?this.files:this.fileInfo)[index])); |
| | | }, |
| | | getSelector() { |
| | | if (this.autoUpload) { |
| | | return 'auto-selector'; |
| | | } |
| | | return 'submit-selector'; |
| | | }, |
| | | getImgSrc(file, index) { |
| | | if (file.hasOwnProperty('path')) { |
| | | if (this.base.isUrl(file.path)) { |
| | | return file.path; |
| | | } |
| | | //2020.12.27å¢å base64å¾çæä½ |
| | | if (file.path.indexOf('/9j/') != -1) { |
| | | return 'data:image/jpeg;base64,' + file.path; |
| | | } |
| | | if (file.path.substr(0, 1) == '/') { |
| | | file.path = file.path.substr(1); |
| | | } |
| | | return this.http.ipAddress + file.path; |
| | | } |
| | | return window.URL.createObjectURL(file); |
| | | }, |
| | | fileOnClick(index, file) { |
| | | if (!this.fileClick(index, file, this.files)) { |
| | | return; |
| | | } |
| | | //ç¹å»ä¸ä¸è½½ |
| | | if (!this.downLoad) { |
| | | return; |
| | | } |
| | | if (!file.path) { |
| | | this.$message.error('请å
ä¸ä¼ æä»¶'); |
| | | return; |
| | | } |
| | | this.base.dowloadFile( |
| | | file.path, |
| | | file.name, |
| | | { |
| | | Authorization: this.$store.getters.getToken() |
| | | }, |
| | | this.http.ipAddress |
| | | ); |
| | | }, |
| | | getText() { |
| | | if (this.img) { |
| | | return 'åªè½ä¸ä¼ å¾ç,'; |
| | | } else if (this.excel) { |
| | | return 'åªè½ä¸ä¼ excelæä»¶,'; |
| | | } |
| | | }, |
| | | handleClick() { |
| | | this.$refs.input.click(); |
| | | }, |
| | | handleChange(e) { |
| | | //this.compresså¼å¯å¾çå缩,å颿 ¹æ®éè¦åå®å |
| | | // this.clearFiles(); |
| | | var result = this.checkFile(e.target.files); |
| | | if (!result) { |
| | | return; |
| | | } |
| | | |
| | | this.changed = false; |
| | | //å¦æä¼ å
¥äºFileInfoéè¦èªè¡å¤çç§»é¤FileInfo |
| | | if (!this.onChange(e.target.files)) { |
| | | return; |
| | | } |
| | | for (let index = 0; index < e.target.files.length; index++) { |
| | | const element = e.target.files[index]; |
| | | element.input = true; |
| | | } |
| | | if (!this.multiple) { |
| | | this.files.splice(0); |
| | | } |
| | | this.files.push(...e.target.files); |
| | | |
| | | this.$refs.input.value = null; |
| | | if (this.autoUpload && result) { |
| | | this.upload(false); |
| | | } |
| | | }, |
| | | removeFile(index) { |
| | | //å¦æä¼ å
¥äºFileInfoéè¦èªè¡å¤çç§»é¤FileInfo |
| | | //tç§»é¤æä»¶ |
| | | let removeFile = this.files[index]; |
| | | //å é¤çè¿æ²¡ä¸ä¼ çæä»¶ |
| | | if (removeFile.input) { |
| | | this.files.splice(index, 1); |
| | | } else { |
| | | this.fileInfo.splice(index, 1); |
| | | } |
| | | if (!this.removeBefore(index, removeFile, this.fileInfo)) { |
| | | return; |
| | | } |
| | | }, |
| | | clearFiles() { |
| | | this.files.splice(0); |
| | | }, |
| | | getFiles() { |
| | | return this.files; |
| | | }, |
| | | convertToFile(dataurl, filename) { |
| | | let arr = dataurl.split(','); |
| | | let mime = arr[0].match(/:(.*?);/)[1]; |
| | | let suffix = mime.split('/')[1]; |
| | | let bstr = atob(arr[1]); |
| | | let n = bstr.length; |
| | | let u8arr = new Uint8Array(n); |
| | | while (n--) { |
| | | u8arr[n] = bstr.charCodeAt(n); |
| | | } |
| | | // new Fileè¿åFile对象 第ä¸ä¸ªåæ°æ¯ ArraryBuffer æ Bolb æArrary 第äºä¸ªåæ°æ¯æä»¶å |
| | | // 第ä¸ä¸ªåæ°æ¯ è¦æ¾å°æä»¶ä¸çå
容ç MIME ç±»å |
| | | return new File([u8arr], `${filename}.${suffix}`, { |
| | | type: mime, |
| | | input: true |
| | | }); |
| | | }, |
| | | async compressImg(file) { |
| | | let fileSize = file.size / 1024 / 1024; |
| | | let read = new FileReader(); |
| | | read.readAsDataURL(file); |
| | | return new Promise((resolve, reject) => { |
| | | read.onload = (e) => { |
| | | let img = new Image(); |
| | | img.src = e.target.result; |
| | | let _this = this; |
| | | img.onload = function() { |
| | | //é»è®¤ææ¯ä¾å缩 |
| | | let w = this.width; |
| | | let h = this.height; |
| | | let canvas = document.createElement('canvas'); |
| | | let ctx = canvas.getContext('2d'); |
| | | canvas.setAttribute('width', w); |
| | | canvas.setAttribute('height', h); |
| | | ctx.drawImage(this, 0, 0, w, h); |
| | | let rate = 0.3; |
| | | if (fileSize > 2) { |
| | | rate = 0.1; |
| | | } else if (fileSize > 1) { |
| | | rate = 0.1; |
| | | } |
| | | if (_this.compressMinSize > rate) { |
| | | rate = _this.compressMinSize; |
| | | } |
| | | // rate=1; |
| | | let base64 = canvas.toDataURL('image/jpeg', rate); |
| | | resolve(_this.convertToFile(base64, file.name)); |
| | | }; |
| | | }; |
| | | }); |
| | | }, |
| | | async uploadOSS() { |
| | | this.http.get('api/alioss/getAccessToken', {}, false).then(async (x) => { |
| | | if (!x.status) return this.$Message.error(x.message); |
| | | let client = new OSS({ |
| | | // yourRegionå¡«åBucketæå¨å°åã以åä¸1ï¼æå·ï¼ä¸ºä¾ï¼Regionå¡«å为oss-cn-hangzhouã |
| | | region: x.data.region, |
| | | // ä»STSæå¡è·åç临æ¶è®¿é®å¯é¥ï¼AccessKey IDåAccessKey Secretï¼ã |
| | | accessKeyId: x.data.accessKeyId, |
| | | accessKeySecret: x.data.accessKeySecret, |
| | | // ä»STSæå¡è·åçå®å
¨ä»¤çï¼SecurityTokenï¼ã |
| | | stsToken: x.data.securityToken, |
| | | // å¡«åBucketåç§°ã |
| | | bucket: x.data.bucket |
| | | }); |
| | | console.log(this.files); |
| | | for (let index = 0; index < this.files.length; index++) { |
| | | const file = this.files[index]; |
| | | if (file.input) { |
| | | let result = await client.put( |
| | | x.data.bucketFolder + '/' + x.data.unique + file.name, |
| | | file |
| | | ); |
| | | file.path = result.url; |
| | | file.newName = x.data.unique + file.name; |
| | | } |
| | | } |
| | | |
| | | this.fileInfo.splice(0); |
| | | // } |
| | | let _files = this.files.map((file) => { |
| | | return { |
| | | name: file.newName || file.name, |
| | | path: file.path |
| | | }; |
| | | }); |
| | | this.fileInfo.push(..._files); |
| | | //2021.09.25ä¿®å¤æä»¶ä¸ä¼ åä¸è½åæ¶ä¸è½½çé®é¢ |
| | | this.files = _files; |
| | | }); |
| | | return; |
| | | }, |
| | | async upload(vail) { |
| | | if (vail && !this.checkFile()) return false; |
| | | if (!this.url) { |
| | | return this.$message.error('没æé
置好Url'); |
| | | } |
| | | if (!this.files || this.files.length == 0) { |
| | | return this.$message.error('è¯·éæ©æä»¶'); |
| | | } |
| | | //å¢å ä¸ä¼ æ¶èªå®ä¹åæ°ï¼åå°ä½¿ç¨è·åUtilities.HttpContext.Current.Request.Query["åæ®µ"] |
| | | let params={}; |
| | | if (!this.uploadBefore(this.files,params)) { |
| | | return; |
| | | } |
| | | let paramText=""; |
| | | if (Object.keys(params).length) { |
| | | paramText="?1=1"; |
| | | for (const key in params) { |
| | | let value=params[key]; |
| | | if(typeof(value)=='object'){ |
| | | value=JSON.stringify(value) |
| | | } |
| | | paramText+=`&${key}=${value}` |
| | | } |
| | | } |
| | | |
| | | this.loadingStatus = true; |
| | | this.loadText = 'ä¸ä¼ ä¸..'; |
| | | if (window.oss && window.oss.ali.use) { |
| | | await this.uploadOSS(); |
| | | this.loadingStatus = false; |
| | | this.loadText = 'ä¸ä¼ æä»¶'; |
| | | if (!this.uploadAfter({status:true}, this.files)) { |
| | | this.changed = false; |
| | | return; |
| | | } else { |
| | | this.changed = true; |
| | | } |
| | | this.$message.success('ä¸ä¼ æå'); |
| | | return; |
| | | } |
| | | |
| | | var forms = new FormData(); |
| | | for (let index = 0; index < this.files.length; index++) { |
| | | let file = this.files[index]; |
| | | if (file.input) { |
| | | let name = file.name.split('.'); |
| | | name = name[name.length - 1].toLocaleLowerCase(); |
| | | let isImg = this.imgTypes.indexOf(name) != -1; |
| | | if (isImg && (name == 'jpg' || name == 'jpeg')) { |
| | | //>200KBçå¼å¯å缩 |
| | | if (isImg && file.size / 1024 / 1024 > 0.2) { |
| | | console.log('å缩å' + file.size); |
| | | file = await this.compressImg(file); |
| | | file.compress = true; |
| | | this.files[index] = file; |
| | | this.files[index].input = true; |
| | | console.log('å缩å' + file.size); |
| | | } |
| | | } |
| | | forms.append('fileInput', file, file.name); |
| | | } |
| | | } |
| | | // forms.append("fileInput", this.files); |
| | | |
| | | this.http |
| | | .post(this.url+paramText, forms, this.autoUpload ? 'æ£å¨ä¸ä¼ æä»¶' : '') |
| | | .then( |
| | | (x) => { |
| | | // this.$refs.uploadFile.clearFiles(); |
| | | this.loadingStatus = false; |
| | | this.loadText = 'ä¸ä¼ æä»¶'; |
| | | if (!this.uploadAfter(x, this.files)) { |
| | | this.changed = false; |
| | | return; |
| | | } else { |
| | | this.changed = true; |
| | | } |
| | | this.$message.success(x.message); |
| | | this.changed = x.status; |
| | | if (!x.status) { |
| | | // this.files = null; |
| | | return; |
| | | } |
| | | //å鿏
é¤ä»¥åçæ°æ® |
| | | // if (!this.multiple) { |
| | | this.fileInfo.splice(0); |
| | | // } |
| | | let _files = this.files.map((file) => { |
| | | return { |
| | | name: file.name, |
| | | path: file.path || x.data + file.name |
| | | }; |
| | | }); |
| | | this.fileInfo.push(..._files); |
| | | //2021.09.25ä¿®å¤æä»¶ä¸ä¼ åä¸è½åæ¶ä¸è½½çé®é¢ |
| | | this.files = _files; |
| | | }, |
| | | (error) => { |
| | | this.loadText = 'ä¸ä¼ æä»¶'; |
| | | this.loadingStatus = false; |
| | | } |
| | | ); |
| | | }, |
| | | format(file, checkFileType) { |
| | | const format = |
| | | file.name |
| | | .split('.') |
| | | .pop() |
| | | .toLocaleLowerCase() || ''; |
| | | let fileIcon = 'el-icon-document'; |
| | | if (this.fileTypes.length > 0 && checkFileType != undefined) { |
| | | if (this.fileTypes.indexOf(format) != -1) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | if ( |
| | | checkFileType && |
| | | !(checkFileType instanceof Array) && |
| | | checkFileType != 'img' && |
| | | checkFileType != 'excel' |
| | | ) { |
| | | if (checkFileType.indexOf(format) > -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (checkFileType == 'img' || this.imgTypes.indexOf(format) > -1) { |
| | | if (checkFileType == 'img') { |
| | | if (this.imgTypes.indexOf(format) > -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | fileIcon = 'el-icon-picture-outline'; |
| | | } |
| | | if ( |
| | | ['mp4', 'm3u8', 'rmvb', 'avi', 'swf', '3gp', 'mkv', 'flv'].indexOf( |
| | | format |
| | | ) > -1 |
| | | ) { |
| | | fileIcon = 'el-icon-document'; |
| | | } |
| | | if (['mp3', 'wav', 'wma', 'ogg', 'aac', 'flac'].indexOf(format) > -1) { |
| | | fileIcon = 'el-icon-document'; |
| | | } |
| | | if (['doc', 'txt', 'docx', 'pages', 'epub', 'pdf'].indexOf(format) > -1) { |
| | | fileIcon = 'el-icon-document'; |
| | | } |
| | | if ( |
| | | checkFileType == 'excel' || |
| | | ['numbers', 'csv', 'xls', 'xlsx'].indexOf(format) > -1 |
| | | ) { |
| | | if (checkFileType == 'excel') { |
| | | if (['numbers', 'csv', 'xls', 'xlsx'].indexOf(format) > -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | fileIcon = 'el-icon-document'; |
| | | } |
| | | return fileIcon; |
| | | }, |
| | | beforeUpload() {}, |
| | | checkFile(inputFiles) { |
| | | const files = this.files; |
| | | |
| | | if ( |
| | | this.multiple && |
| | | files.length + (inputFiles || []).length > (this.maxFile || 5) |
| | | ) { |
| | | this.$message.error( |
| | | 'æå¤åªè½éã' + |
| | | (this.maxFile || 5) + |
| | | 'ã' + |
| | | (this.img ? 'å¼ å¾ç' : '个æä»¶') + |
| | | '' |
| | | ); |
| | | return false; |
| | | } |
| | | if (!inputFiles) { |
| | | inputFiles = this.files.filter((x) => { |
| | | return x.input; |
| | | }); |
| | | } |
| | | let names = []; |
| | | for (let index = 0; index < inputFiles.length; index++) { |
| | | const file = inputFiles[index]; |
| | | if (names.indexOf(file.name) != -1) { |
| | | file.name = '(' + index + ')' + file.name; |
| | | } |
| | | names.push(file.name); |
| | | if (this.img && !this.format(file, 'img')) { |
| | | this.$message.error('éæ©çæä»¶ã' + file.name + 'ãåªè½æ¯å¾çæ ¼å¼'); |
| | | return false; |
| | | } |
| | | if (this.excel && !this.format(file, 'excel')) { |
| | | this.$message.error('éæ©çæä»¶ã' + file.name + 'ãåªè½æ¯excelæä»¶'); |
| | | return false; |
| | | } |
| | | if ( |
| | | this.fileTypes && |
| | | this.fileTypes.length > 0 && |
| | | !this.format(file, this.fileTypes) |
| | | ) { |
| | | this.$message.error( |
| | | 'éæ©çæä»¶ã' + |
| | | file.name + |
| | | 'ãåªè½æ¯ã' + |
| | | this.fileTypes.join(',') + |
| | | 'ãæ ¼å¼' |
| | | ); |
| | | return false; |
| | | } |
| | | if (file.size > (this.maxSize || 50) * 1024 * 1024) { |
| | | this.$message.error( |
| | | 'éæ©çæä»¶ã' + |
| | | file.name + |
| | | 'ãä¸è½è¶
è¿:' + |
| | | (this.maxSize || 50) + |
| | | 'M' |
| | | ); |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .upload-list { |
| | | padding-left: 0; |
| | | list-style: none; |
| | | .list-file { |
| | | line-height: 20px; |
| | | padding: 4px; |
| | | color: #515a6e; |
| | | border-radius: 4px; |
| | | transition: background-color 0.2s ease-in-out; |
| | | overflow: hidden; |
| | | position: relative; |
| | | |
| | | font-size: 13px; |
| | | .file-remove { |
| | | display: none; |
| | | right: 0; |
| | | // margin-left: 50px; |
| | | color: #0e9286; |
| | | } |
| | | } |
| | | .list-file:hover { |
| | | cursor: pointer; |
| | | .file-remove { |
| | | display: initial; |
| | | } |
| | | color: #2d8cf0; |
| | | } |
| | | } |
| | | .upload-container { |
| | | display: inline-block; |
| | | width: 100%; |
| | | // padding: 10px; |
| | | |
| | | // min-height: 250px; |
| | | border-radius: 5px; |
| | | .alert { |
| | | margin-top: 43px; |
| | | } |
| | | .button-group > * { |
| | | float: left; |
| | | margin-right: 10px; |
| | | } |
| | | .file-info > span { |
| | | margin-right: 20px; |
| | | } |
| | | } |
| | | .upload-img { |
| | | display: inline-block; |
| | | .img-item:hover .operation { |
| | | display: block; |
| | | } |
| | | .img-item, |
| | | .img-selector { |
| | | position: relative; |
| | | cursor: pointer; |
| | | margin: 0 10px 10px 0; |
| | | float: left; |
| | | width: 65px; |
| | | height: 65px; |
| | | border: 1px solid #c7c7c7; |
| | | overflow: hidden; |
| | | border-radius: 5px; |
| | | box-sizing: content-box; |
| | | img { |
| | | margin: 0; |
| | | padding: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | object-fit: cover; |
| | | } |
| | | |
| | | .operation { |
| | | display: none; |
| | | position: absolute; |
| | | top: 0; |
| | | bottom: 0; |
| | | left: 0; |
| | | right: 0; |
| | | .action { |
| | | opacity: 0.6; |
| | | text-align: center; |
| | | background: #151515de; |
| | | font-size: 14px; |
| | | position: absolute; |
| | | z-index: 90; |
| | | width: 100%; |
| | | bottom: 3px; |
| | | bottom: 0; |
| | | color: #ded5d5; |
| | | padding-right: 7px; |
| | | padding-bottom: 3px; |
| | | line-height: 20px; |
| | | .el-icon-view { |
| | | margin: 0 10px; |
| | | } |
| | | } |
| | | .mask { |
| | | opacity: 0.6; |
| | | background: #9e9e9e; |
| | | top: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | position: absolute; |
| | | } |
| | | } |
| | | } |
| | | .img-selector { |
| | | font-size: 50px; |
| | | text-align: center; |
| | | i { |
| | | position: relative; |
| | | font-size: 40px; |
| | | color: #6f6f6f; |
| | | } |
| | | } |
| | | |
| | | .auto-selector { |
| | | .selector { |
| | | line-height: 64px; |
| | | } |
| | | } |
| | | .selector { |
| | | color: #a0a0a0; |
| | | } |
| | | .submit-selector { |
| | | .s-btn { |
| | | line-height: 22px; |
| | | font-size: 12px; |
| | | top: -6px; |
| | | // padding: 2px; |
| | | position: relative; |
| | | background: #2db7f5; |
| | | color: white; |
| | | } |
| | | .selector { |
| | | line-height: 50px; |
| | | } |
| | | .readonly { |
| | | background: #8c8c8c; |
| | | } |
| | | } |
| | | } |
| | | .big-model { |
| | | width: 100%; |
| | | height: 100%; |
| | | position: relative; |
| | | .m-img { |
| | | } |
| | | .mask { |
| | | position: absolute; |
| | | opacity: 0.6; |
| | | background: #eee; |
| | | top: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | position: absolute; |
| | | } |
| | | } |
| | | |
| | | .auto-upload { |
| | | z-index: 9999999; |
| | | width: 100%; |
| | | height: 100%; |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | .j-content { |
| | | text-align: center; |
| | | font-size: 17px; |
| | | top: 40%; |
| | | position: absolute; |
| | | z-index: 999; |
| | | left: 0; |
| | | right: 0; |
| | | width: 240px; |
| | | /* height: 100%; */ |
| | | margin: auto; |
| | | background: white; |
| | | /* bottom: 30px; */ |
| | | line-height: 50px; |
| | | border-radius: 6px; |
| | | border: 1px solid #d2d2d2; |
| | | } |
| | | .mask { |
| | | cursor: pointer; |
| | | opacity: 0.6; |
| | | width: 100%; |
| | | height: 100%; |
| | | background: #101010; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="hello" ref="volWangEditor"></div> |
| | | </template> |
| | | |
| | | <script> |
| | | import E from "wangeditor"; |
| | | export default { |
| | | props: { |
| | | url: { |
| | | //ä¸ä¼ å¾ççurl |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | upload: { |
| | | //ä¸ä¼ æ¹æ³ |
| | | type: Function, |
| | | // (file, insertImgFn) => {} |
| | | default: null, |
| | | }, |
| | | uploadCount: { |
| | | //æå¤å¯ä»¥ä¸ä¼ (å¾ç)çæ°é |
| | | type: Number, |
| | | default: 3, |
| | | }, |
| | | modelValue: "", |
| | | width: { |
| | | type: String, |
| | | default: "100%", |
| | | }, |
| | | height: { |
| | | type: Number, |
| | | default: 250, |
| | | }, |
| | | minWidth: { |
| | | type: Number, |
| | | default: 650, |
| | | }, |
| | | minHeight: { |
| | | type: Number, |
| | | default: 100, |
| | | }, |
| | | }, |
| | | name: "wang-editor", |
| | | data() { |
| | | return { |
| | | lastHtml: "", |
| | | change: false, |
| | | editor: null, |
| | | init: false, |
| | | }; |
| | | }, |
| | | watch: { |
| | | modelValue(newVal, val) { |
| | | if ( |
| | | (newVal !== val && |
| | | this.lastHtml !== "" && |
| | | val === this.lastHtml && |
| | | this.editor.txt.html() === this.lastHtml) || |
| | | this.editor.txt.html() === "" |
| | | ) { |
| | | this.editor.txt.html(newVal); |
| | | } |
| | | this.lastHtml = newVal; |
| | | }, |
| | | }, |
| | | destroyed() { |
| | | this.editor = null; |
| | | }, |
| | | mounted() { |
| | | this.editor = null; |
| | | let editor = new E(this.$refs.volWangEditor); |
| | | this.editor = editor; |
| | | let $this = this; |
| | | editor.config.zIndex = 500; |
| | | editor.config.height = this.height; |
| | | editor.config.onchange = (html) => { |
| | | if (!this.init && this.lastHtml === "") { |
| | | this.lastHtml = html; |
| | | this.init = true; |
| | | } |
| | | this.$emit("update:modelValue", html); |
| | | }; |
| | | // editor.config.uploadFileName = "fileInput"; |
| | | // //设置header |
| | | // editor.config.uploadImgHeaders = { |
| | | // Accept: "application/json", |
| | | // Authorization: this.$store.getters.getToken(), |
| | | // }; |
| | | //ä¸ä¼ å°å |
| | | editor.config.uploadImgServer = this.http.ipAddress + this.url; |
| | | // console.log(editor.config.uploadImgServer); |
| | | editor.config.customUploadImg = function (resultFiles, insertImgFn) { |
| | | // èªå®ä¹ä¸ä¼ |
| | | if ($this.upload) { |
| | | console.log("è°ç¨èªå®ä¹çä¸ä¼ æ¹æ³"); |
| | | console.log(resultFiles); |
| | | // resultFiles æ¯ input ä¸éä¸çæä»¶å表 |
| | | // insertImgFn æ¯è·åå¾ç url åï¼æå
¥å°ç¼è¾å¨çæ¹æ³ |
| | | //æå¯è½ä¼ä¸ä¼ å¤å¼ å¾ç,ä¸ä¼ å¤å¼ å¾çå°±éè¦è¿è¡éå |
| | | resultFiles.map((item) => { |
| | | // _this.getUploadImg(item, insertImgFn); |
| | | $this.upload(item, insertImgFn); |
| | | }); |
| | | } else { |
| | | let formData = new FormData(); |
| | | let nameArr = []; |
| | | resultFiles.forEach(function (file) { |
| | | formData.append("fileInput", file, file.name); |
| | | nameArr.push(file.name); |
| | | }); |
| | | if (!$this.url) { |
| | | $this.$message.error("æªé
ç½®url"); |
| | | return; |
| | | } |
| | | $this.http.post($this.url, formData, true).then((x) => { |
| | | if (!x.status) { |
| | | return $this.$message.error(x.message); |
| | | } |
| | | nameArr.forEach(m=>{ |
| | | insertImgFn($this.http.ipAddress + x.data + m); |
| | | }) |
| | | // let imgs = nameArr |
| | | // .map((m) => { |
| | | // return $this.http.ipAddress + x.data + m; |
| | | // }) |
| | | // .join(","); |
| | | // insertImgFn(imgs); |
| | | }); |
| | | } |
| | | }; |
| | | editor.create(); |
| | | editor.txt.html(this.modelValue); |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| | | <style scoped> |
| | | h1, |
| | | h2 { |
| | | font-weight: normal; |
| | | } |
| | | ul { |
| | | list-style-type: none; |
| | | padding: 0; |
| | | } |
| | | li { |
| | | display: inline-block; |
| | | margin: 0 10px; |
| | | } |
| | | a { |
| | | color: #42b983; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="height: 100%"> |
| | | <redirect-error :text="text" message="请æ±ç¡®è®¤æ¯å¦é
ç½®æé" :errorNumber="errorNumber"></redirect-error> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import RedirectError from "./RedirectError"; |
| | | export default { |
| | | components: { |
| | | RedirectError, |
| | | }, |
| | | data() { |
| | | return { |
| | | errorNumber: "401", |
| | | text: "æ±æï¼æ¨æ²¡ææéè¿è¡æ¤æä½~", |
| | | }; |
| | | }, |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="height:100%;"> |
| | | <redirect-error :text="text" :errorNumber="errorNumber"></redirect-error> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import RedirectError from "./RedirectError"; |
| | | export default { |
| | | components: { |
| | | RedirectError |
| | | }, |
| | | data() { |
| | | return { |
| | | errorNumber:'404', |
| | | text: "æ±æï¼é¡µé¢å¥½åå»ç«æäº~" |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="middle-box"> |
| | | <div class="text-center animated fadeInDown"> |
| | | <i style="font-size: 50px;color: #67c23a;margin-top:40px;" class="el-icon-circle-check"></i> |
| | | <div style="font-size: 20px;margin-top: 10px;" class="error-desc">{{ text }}</div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | props: { |
| | | text: { |
| | | type: String, |
| | | default: "æä½æåï¼", |
| | | }, |
| | | }, |
| | | methods: { |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | body { |
| | | background-color: #fff; |
| | | } |
| | | .middle-box { |
| | | text-align: center; |
| | | padding-top: 80px; |
| | | height: 100%; |
| | | // background: #eee; |
| | | h1 { |
| | | font-size: 140px; |
| | | font-weight: 100; |
| | | } |
| | | .back { |
| | | padding: 10px; |
| | | } |
| | | } |
| | | </style> |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="middle-box"> |
| | | <div class="text-center animated fadeInDown"> |
| | | <h1>{{ errorNumber }}</h1> |
| | | <h3 class="font-bold">{{message}}</h3> |
| | | <slot></slot> |
| | | <div class="error-desc">{{ text }}</div> |
| | | <div class="back"> |
| | | <el-button type="primary" @click="backHome" icon="md-arrow-round-back" |
| | | >è¿åé¦é¡µ</el-button > |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { Script } from "vm"; |
| | | export default { |
| | | props: { |
| | | errorNumber: { |
| | | type: String, |
| | | default: "500", |
| | | }, |
| | | message: { |
| | | type: String, |
| | | default: "页颿ªæ¾å°ï¼", |
| | | }, |
| | | text: { |
| | | type: String, |
| | | default: "å...好ååºäºç¹é®é¢~", |
| | | }, |
| | | }, |
| | | methods: { |
| | | backHome: function () { |
| | | this.$router.push({ |
| | | path: "/home", |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="less" scoped> |
| | | body { |
| | | background-color: #fff; |
| | | } |
| | | .middle-box { |
| | | text-align: center; |
| | | padding-top: 80px; |
| | | height: 100%; |
| | | // background: #eee; |
| | | h1 { |
| | | font-size: 140px; |
| | | font-weight: 100; |
| | | } |
| | | .back { |
| | | padding: 10px; |
| | | } |
| | | } |
| | | </style> |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="height:100%;"> |
| | | <redirect-error :text="text" :errorNumber="errorNumber"> |
| | | <div> |
| | | <router-link to="SellOrder"> |
| | | <Button>ç¹å»æ¥ç[æµè¯å®æ´ç¤ºä¾]</Button> |
| | | </router-link> |
| | | </div> |
| | | </redirect-error> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import RedirectError from "./RedirectError"; |
| | | export default { |
| | | components: { |
| | | RedirectError |
| | | }, |
| | | data() { |
| | | return { |
| | | errorNumber: "ç¨ä¾æ£å¨æ´çä¸", |
| | | text: "详ç»ç¨ä¾å¨æ£åå¤ä¸,ç®åå¯åè[æµè¯å®æ´ç¤ºä¾]çä½¿ç¨æ¹æ³" |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | let dataA = { |
| | | "name": "æµç¨A", |
| | | "nodeList": [ |
| | | { |
| | | "id": "0", |
| | | "name": "æµç¨å¼å§", |
| | | "type": "start", |
| | | "left": "346px", |
| | | "top": "22px", |
| | | "ico": "el-icon-user-solid" |
| | | }, |
| | | { |
| | | "id": "nodeA", |
| | | "name": "æµç¨A-èç¹A", |
| | | "type": "node", |
| | | "left": "346px", |
| | | "top": "132px", |
| | | "ico": "el-icon-user-solid" |
| | | }, |
| | | // { |
| | | // "id": "nodeB", |
| | | // "name": "æµç¨A-èç¹B", |
| | | // "type": "node", |
| | | // "left": "347px", |
| | | // "top": "235px", |
| | | // "ico": "el-icon-goods" |
| | | // }, |
| | | // { |
| | | // "id": "nodeC", |
| | | // "name": "æµç¨A-èç¹C", |
| | | // "type": "node", |
| | | // "left": "323px", |
| | | // "top": "399px", |
| | | // "ico": "el-icon-present" |
| | | // } |
| | | ], |
| | | "lineList": [ |
| | | { |
| | | "from": "0", |
| | | "to": "nodeA" |
| | | }, |
| | | // { |
| | | // "from": "nodeA", |
| | | // "to": "nodeB" |
| | | // }, |
| | | // { |
| | | // "from": "nodeB", |
| | | // "to": "nodeC" |
| | | // } |
| | | ] |
| | | } |
| | | export function getDataA () { |
| | | return dataA |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * æè°¢ https://github.com/chaangliu/ForceDirectedLayout/blob/master/javascript/force-directed.js |
| | | * A force directed graph layout implementation by liuchang on 2018/05/10. |
| | | */ |
| | | const CANVAS_WIDTH = 1000 |
| | | const CANVAS_HEIGHT = 1000 |
| | | let k |
| | | let mNodeList = [] |
| | | let mEdgeList = [] |
| | | let mDxMap = {} |
| | | let mDyMap = {} |
| | | let mNodeMap = {} |
| | | |
| | | export function ForceDirected(data = {}) { |
| | | // generate nodes and edges |
| | | // for (let i = 0; i < 20; i++) { |
| | | // mNodeList.push(new Node(i)) |
| | | // } |
| | | k = 0 |
| | | mNodeList = [] |
| | | mEdgeList = [] |
| | | mDxMap = {} |
| | | mDyMap = {} |
| | | mNodeMap = {} |
| | | |
| | | let nodeList = data.nodeList |
| | | for (let i = 0; i < nodeList.length; i++) { |
| | | let node = nodeList[i] |
| | | mNodeList.push(node) |
| | | } |
| | | |
| | | // for (let i = 0; i < 20; i++) { |
| | | // let edgeCount = Math.random() * 8 + 1 |
| | | // for (let j = 0; j < edgeCount; j++) { |
| | | // let targetId = Math.floor(Math.random() * 20) |
| | | // let edge = new Edge(i, targetId) |
| | | // mEdgeList.push(edge) |
| | | // } |
| | | // } |
| | | // line 转 edge |
| | | let lineList = data.lineList |
| | | for (let i = 0; i < lineList.length; i++) { |
| | | let line = lineList[i] |
| | | let edge = new Edge(line.from, line.to) |
| | | mEdgeList.push(edge) |
| | | } |
| | | |
| | | if (mNodeList && mEdgeList) { |
| | | k = Math.sqrt(CANVAS_WIDTH * CANVAS_HEIGHT / mNodeList.length) |
| | | } |
| | | for (let i = 0; i < mNodeList.length; i++) { |
| | | let node = mNodeList[i] |
| | | if (node) { |
| | | mNodeMap[node.id] = node |
| | | } |
| | | } |
| | | |
| | | // éæºçæåæ . Generate coordinates randomly. |
| | | let initialX, initialY, initialSize = 40.0 |
| | | for (let i in mNodeList) { |
| | | initialX = CANVAS_WIDTH * 0.5 |
| | | initialY = CANVAS_HEIGHT * 0.5 |
| | | mNodeList[i].x = initialX + initialSize * (Math.random() - 0.5) |
| | | mNodeList[i].y = initialY + initialSize * (Math.random() - 0.5) |
| | | } |
| | | |
| | | // è¿ä»£200次. Iterate 200 times. |
| | | for (let i = 0; i < 200; i++) { |
| | | calculateRepulsive() |
| | | calculateTraction() |
| | | updateCoordinates() |
| | | } |
| | | // console.log(JSON.stringify(new Result(mNodeList, mEdgeList))) |
| | | // åæ æ·»å px |
| | | for (let i = 0; i < mNodeList.length; i++) { |
| | | let node = mNodeList[i] |
| | | node.left = node.x + 'px' |
| | | node.top = node.y + 'px' |
| | | node.x = undefined |
| | | node.y = undefined |
| | | } |
| | | |
| | | data.nodeList = mNodeList |
| | | |
| | | // console.log(data) |
| | | return data |
| | | } |
| | | |
| | | function Node(id = null) { |
| | | this.id = id |
| | | this.x = 22 |
| | | this.y = null |
| | | } |
| | | |
| | | function Edge(source = null, target = null) { |
| | | this.source = source |
| | | this.target = target |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ä¸¤ä¸ªNodeçæ¥å产ççåä½ä½ç§»ã |
| | | * Calculate the displacement generated by the repulsive force between two nodes.* |
| | | */ |
| | | function calculateRepulsive() { |
| | | let ejectFactor = 6 |
| | | let distX, distY, dist |
| | | for (let i = 0; i < mNodeList.length; i++) { |
| | | mDxMap[mNodeList[i].id] = 0.0 |
| | | mDyMap[mNodeList[i].id] = 0.0 |
| | | for (let j = 0; j < mNodeList.length; j++) { |
| | | if (i !== j) { |
| | | distX = mNodeList[i].x - mNodeList[j].x |
| | | distY = mNodeList[i].y - mNodeList[j].y |
| | | dist = Math.sqrt(distX * distX + distY * distY) |
| | | } |
| | | if (dist < 30) { |
| | | ejectFactor = 5 |
| | | } |
| | | if (dist > 0 && dist < 250) { |
| | | let id = mNodeList[i].id |
| | | mDxMap[id] = mDxMap[id] + distX / dist * k * k / dist * ejectFactor |
| | | mDyMap[id] = mDyMap[id] + distY / dist * k * k / dist * ejectFactor |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 计ç®Edgeçå¼å对两端Node产ççå¼åã |
| | | * Calculate the traction force generated by the edge acted on the two nodes of its two ends. |
| | | */ |
| | | function calculateTraction() { |
| | | let condenseFactor = 3 |
| | | let startNode, endNode |
| | | for (let e = 0; e < mEdgeList.length; e++) { |
| | | let eStartID = mEdgeList[e].source |
| | | let eEndID = mEdgeList[e].target |
| | | startNode = mNodeMap[eStartID] |
| | | endNode = mNodeMap[eEndID] |
| | | if (!startNode) { |
| | | console.log('Cannot find start node id: ' + eStartID + ', please check it out.') |
| | | return |
| | | } |
| | | if (!endNode) { |
| | | console.log('Cannot find end node id: ' + eEndID + ', please check it out.') |
| | | return |
| | | } |
| | | let distX, distY, dist |
| | | distX = startNode.x - endNode.x |
| | | distY = startNode.y - endNode.y |
| | | dist = Math.sqrt(distX * distX + distY * distY) |
| | | mDxMap[eStartID] = mDxMap[eStartID] - distX * dist / k * condenseFactor |
| | | mDyMap[eStartID] = mDyMap[eStartID] - distY * dist / k * condenseFactor |
| | | mDxMap[eEndID] = mDxMap[eEndID] + distX * dist / k * condenseFactor |
| | | mDyMap[eEndID] = mDyMap[eEndID] + distY * dist / k * condenseFactor |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°åæ ã |
| | | * update the coordinates. |
| | | */ |
| | | function updateCoordinates() { |
| | | let maxt = 4, maxty = 3 // Additional coefficients. |
| | | for (let v = 0; v < mNodeList.length; v++) { |
| | | let node = mNodeList[v] |
| | | let dx = Math.floor(mDxMap[node.id]) |
| | | let dy = Math.floor(mDyMap[node.id]) |
| | | |
| | | if (dx < -maxt) dx = -maxt |
| | | if (dx > maxt) dx = maxt |
| | | if (dy < -maxty) dy = -maxty |
| | | if (dy > maxty) dy = maxty |
| | | node.x = node.x + dx >= CANVAS_WIDTH || node.x + dx <= 0 ? node.x - dx : node.x + dx |
| | | node.y = node.y + dy >= CANVAS_HEIGHT || node.y + dy <= 0 ? node.y - dy : node.y + dy |
| | | } |
| | | } |
| | | |
| | | function Result(nodes = null, links = null) { |
| | | this.nodes = nodes |
| | | this.links = links |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /*ç»å¸å®¹å¨*/ |
| | | .efContainer { |
| | | position: relative; |
| | | overflow: scroll; |
| | | flex: 1; |
| | | } |
| | | .tools { |
| | | position: absolute; |
| | | left: 220px; |
| | | /* background: #fff; */ |
| | | /* border: 1px solid #d8d7d7; */ |
| | | /* border-radius: 5px; */ |
| | | padding: 5px 5px; |
| | | display: flex; |
| | | z-index: 99; |
| | | background: #fcfcfc; |
| | | } |
| | | |
| | | /*é¡¶é¨å·¥å
·æ */ |
| | | .ef-tooltar { |
| | | padding-left: 10px; |
| | | box-sizing: border-box; |
| | | height: 42px; |
| | | line-height: 42px; |
| | | z-index: 3; |
| | | border-bottom: 1px solid #dadce0; |
| | | } |
| | | |
| | | .jtk-overlay { |
| | | cursor: pointer; |
| | | color: #4a4a4a; |
| | | } |
| | | |
| | | .ef-node-pmenu-item { |
| | | padding: 10px; |
| | | background: #f8f8f8; |
| | | font-size: 13px; |
| | | font-weight: bold; |
| | | letter-spacing: 1px; |
| | | border-top: 1px solid #eee; |
| | | border-bottom: 1px solid #eee; |
| | | border-right: 1px solid #eee; |
| | | } |
| | | /*èç¹èå*/ |
| | | .ef-node-pmenu { |
| | | cursor: pointer; |
| | | height: 32px; |
| | | line-height: 32px; |
| | | width: 225px; |
| | | display: block; |
| | | font-weight: bold; |
| | | color: #4a4a4a; |
| | | padding-left: 5px; |
| | | } |
| | | |
| | | .ef-node-pmenu:hover { |
| | | background-color: #e0e0e0; |
| | | } |
| | | .ef-node-menu-item { |
| | | padding: 10px; |
| | | } |
| | | .ef-node-menu-li { |
| | | cursor: move; |
| | | border: 1px solid #eee; |
| | | padding: 2px 13px; |
| | | text-align: left; |
| | | line-height: 28px; |
| | | margin: 4px; |
| | | border-radius: 3px; |
| | | background: #f0f9eb; |
| | | font-size: 12px; |
| | | float: left; |
| | | width: 98px; |
| | | |
| | | } |
| | | |
| | | .ef-node-menu-li > div:first-child{ |
| | | display: inline-block; |
| | | padding: 4px; |
| | | } |
| | | |
| | | .ef-node-menu-li:hover { |
| | | /* è®¾ç½®ç§»å¨æ ·å¼*/ |
| | | cursor: move; |
| | | border: 1px dashed #787be8; |
| | | color: #787be8; |
| | | /* background-color: #F0F7FF; |
| | | border: 1px dashed #1879FF; |
| | | border-left: 4px solid #1879FF; |
| | | padding-left: 5px; */ |
| | | } |
| | | |
| | | .ef-node-menu-ul { |
| | | list-style: none; |
| | | padding-left: 0; |
| | | margin: 0; |
| | | } |
| | | |
| | | /*èç¹çæå¤å±å®¹å¨*/ |
| | | .ef-node-container { |
| | | position: absolute; |
| | | display: flex; |
| | | width: 170px; |
| | | height: 32px; |
| | | border: 1px solid #e0e3e7; |
| | | border-radius: 5px; |
| | | background-color: #fff; |
| | | } |
| | | |
| | | .ef-node-container:hover { |
| | | /* è®¾ç½®ç§»å¨æ ·å¼*/ |
| | | cursor: move; |
| | | background-color: #f0f7ff; |
| | | /*box-shadow: #1879FF 0px 0px 12px 0px;*/ |
| | | background-color: #f0f7ff; |
| | | border: 1px dashed #1879ff; |
| | | } |
| | | |
| | | /*èç¹æ¿æ´»æ ·å¼*/ |
| | | .ef-node-active { |
| | | background-color: #f0f7ff; |
| | | /*box-shadow: #1879FF 0px 0px 12px 0px;*/ |
| | | background-color: #f0f7ff; |
| | | border: 1px solid #1879ff; |
| | | } |
| | | |
| | | /*èç¹å·¦ä¾§çç«çº¿*/ |
| | | .ef-node-left { |
| | | width: 4px; |
| | | background-color: #1879ff; |
| | | border-radius: 4px 0 0 4px; |
| | | } |
| | | |
| | | /*èç¹å·¦ä¾§ç徿 */ |
| | | .ef-node-left-ico { |
| | | line-height: 32px; |
| | | margin-left: 8px; |
| | | } |
| | | |
| | | .ef-node-left-ico:hover { |
| | | /* è®¾ç½®ææ½çæ ·å¼ */ |
| | | cursor: crosshair; |
| | | } |
| | | |
| | | /*èç¹æ¾ç¤ºçæå*/ |
| | | .ef-node-text { |
| | | color: #565758; |
| | | font-size: 12px; |
| | | line-height: 32px; |
| | | margin-left: 8px; |
| | | width: 100px; |
| | | /* 设置è¶
åºå®½åº¦ææ¬æ¾ç¤ºæ¹å¼*/ |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | text-align: center; |
| | | } |
| | | |
| | | /*èç¹å³ä¾§ç徿 */ |
| | | .ef-node-right-ico { |
| | | line-height: 32px; |
| | | position: absolute; |
| | | right: 5px; |
| | | color: #84cf65; |
| | | cursor: default; |
| | | } |
| | | |
| | | /*èç¹çå ç§ç¶ææ ·å¼*/ |
| | | .el-node-state-success { |
| | | line-height: 32px; |
| | | position: absolute; |
| | | right: 5px; |
| | | color: #84cf65; |
| | | cursor: default; |
| | | } |
| | | |
| | | .el-node-state-error { |
| | | line-height: 32px; |
| | | position: absolute; |
| | | right: 5px; |
| | | color: #f56c6c; |
| | | cursor: default; |
| | | } |
| | | |
| | | .el-node-state-warning { |
| | | line-height: 32px; |
| | | position: absolute; |
| | | right: 5px; |
| | | color: #e6a23c; |
| | | cursor: default; |
| | | } |
| | | |
| | | .el-node-state-running { |
| | | line-height: 32px; |
| | | position: absolute; |
| | | right: 5px; |
| | | color: #84cf65; |
| | | cursor: default; |
| | | } |
| | | |
| | | /*node-form*/ |
| | | .ef-node-form-header { |
| | | height: 32px; |
| | | border-top: 1px solid #dce3e8; |
| | | border-bottom: 1px solid #dce3e8; |
| | | background: #f1f3f4; |
| | | color: #000; |
| | | line-height: 32px; |
| | | padding-left: 12px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .ef-node-form-body { |
| | | margin-top: 10px; |
| | | padding-right: 10px; |
| | | padding-bottom: 20px; |
| | | } |
| | | |
| | | /* è¿çº¿ä¸çlabel æ ·å¼*/ |
| | | .jtk-overlay.flowLabel:not(.aLabel) { |
| | | /* padding: 4px 10px; */ |
| | | padding: 1px 8px 2px 8px; |
| | | background-color: white; |
| | | color: #a9aaaa !important; |
| | | border: 1px solid #e0e3e7; |
| | | border-radius: 3px; |
| | | } |
| | | |
| | | /* label ä¸ºç©ºçæ ·å¼ */ |
| | | .emptyFlowLabel { |
| | | } |
| | | |
| | | .ef-dot { |
| | | background-color: #1879ff; |
| | | border-radius: 10px; |
| | | } |
| | | |
| | | .ef-dot-hover { |
| | | background-color: red; |
| | | } |
| | | |
| | | .ef-rectangle { |
| | | background-color: #1879ff; |
| | | } |
| | | |
| | | .ef-rectangle-hover { |
| | | background-color: red; |
| | | } |
| | | |
| | | .ef-img { |
| | | } |
| | | |
| | | .ef-img-hover { |
| | | } |
| | | |
| | | .ef-drop-hover { |
| | | border: 1px dashed #1879ff; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export const easyFlowMixin = { |
| | | data() { |
| | | return { |
| | | jsplumbSetting: { |
| | | // 卿éç¹ãä½ç½®èªéåº |
| | | Anchors: ['Top', 'TopCenter', 'TopRight', 'TopLeft', 'Right', 'RightMiddle', 'Bottom', 'BottomCenter', 'BottomRight', 'BottomLeft', 'Left', 'LeftMiddle'], |
| | | // 容å¨ID |
| | | Container: 'efContainer', |
| | | // è¿çº¿çæ ·å¼ï¼ç´çº¿æè
æ²çº¿çï¼å¯éå¼: StateMachineãFlowchartï¼BezierãStraight |
| | | Connector: ['Bezier', {curviness: 100}], |
| | | // Connector: ['Straight', {stub: 20, gap: 1}], |
| | | // Connector: ['Flowchart', {stub: 30, gap: 1, alwaysRespectStubs: false, midpoint: 0.5, cornerRadius: 10}], |
| | | // Connector: ['StateMachine', {margin: 5, curviness: 10, proximityLimit: 80}], |
| | | // é¼ æ ä¸è½æå¨å é¤çº¿ |
| | | ConnectionsDetachable: false, |
| | | // å é¤çº¿çæ¶åèç¹ä¸å é¤ |
| | | DeleteEndpointsOnDetach: false, |
| | | /** |
| | | * è¿çº¿ç两端端ç¹ç±»åï¼åå½¢ |
| | | * radius: åçåå¾ï¼è¶å¤§åè¶å¤§ |
| | | */ |
| | | // Endpoint: ['Dot', {radius: 5, cssClass: 'ef-dot', hoverClass: 'ef-dot-hover'}], |
| | | /** |
| | | * è¿çº¿ç两端端ç¹ç±»åï¼ç©å½¢ |
| | | * height: ç©å½¢çé« |
| | | * width: ç©å½¢ç宽 |
| | | */ |
| | | // Endpoint: ['Rectangle', {height: 20, width: 20, cssClass: 'ef-rectangle', hoverClass: 'ef-rectangle-hover'}], |
| | | /** |
| | | * å¾åç«¯ç¹ |
| | | */ |
| | | // Endpoint: ['Image', {src: 'https://www.easyicon.net/api/resizeApi.php?id=1181776&size=32', cssClass: 'ef-img', hoverClass: 'ef-img-hover'}], |
| | | /** |
| | | * 空ç½ç«¯ç¹ |
| | | */ |
| | | Endpoint: ['Blank', {Overlays: ''}], |
| | | // Endpoints: [['Dot', {radius: 5, cssClass: 'ef-dot', hoverClass: 'ef-dot-hover'}], ['Rectangle', {height: 20, width: 20, cssClass: 'ef-rectangle', hoverClass: 'ef-rectangle-hover'}]], |
| | | /** |
| | | * è¿çº¿çä¸¤ç«¯ç«¯ç¹æ ·å¼ |
| | | * fill: é¢è²å¼ï¼å¦ï¼#12aabbï¼ä¸ºç©ºä¸æ¾ç¤º |
| | | * outlineWidth: å¤è¾¹çº¿å®½åº¦ |
| | | */ |
| | | EndpointStyle: {fill: '#1879ffa1', outlineWidth: 1}, |
| | | // æ¯å¦æå¼jsPlumbçå
鍿¥å¿è®°å½ |
| | | LogEnabled: true, |
| | | /** |
| | | * è¿çº¿çæ ·å¼ |
| | | */ |
| | | PaintStyle: { |
| | | // 线çé¢è² |
| | | stroke: '#E0E3E7', |
| | | // 线çç²ç»ï¼å¼è¶å¤§çº¿è¶ç² |
| | | strokeWidth: 1, |
| | | // 设置å¤è¾¹çº¿çé¢è²ï¼é»è®¤è®¾ç½®éæï¼è¿æ ·å«äººå°±çä¸è§äºï¼ç¹å»çº¿çæ¶åå¯ä»¥ä¸ç¨ç²¾ç¡®ç¹å»ï¼åè https://blog.csdn.net/roymno2/article/details/72717101 |
| | | outlineStroke: 'transparent', |
| | | // 线å¤è¾¹ç宽ï¼å¼è¶å¤§ï¼çº¿çç¹å»èå´è¶å¤§ |
| | | outlineWidth: 10 |
| | | }, |
| | | DragOptions: {cursor: 'pointer', zIndex: 2000}, |
| | | /** |
| | | * å å åèï¼ https://www.jianshu.com/p/d9e9918fd928 |
| | | */ |
| | | Overlays: [ |
| | | // ç®å¤´å å |
| | | ['Arrow', { |
| | | width: 10, // ç®å¤´å°¾é¨ç宽度 |
| | | length: 8, // ä»ç®å¤´çå°¾é¨å°å¤´é¨çè·ç¦» |
| | | location: 1, // ä½ç½®ï¼å»ºè®®ä½¿ç¨0ï½1ä¹é´ |
| | | direction: 1, // æ¹åï¼é»è®¤å¼ä¸º1ï¼è¡¨ç¤ºååï¼ï¼å¯é-1ï¼è¡¨ç¤ºååï¼ |
| | | foldback: 0.623 // æåï¼ä¹å°±æ¯å°¾ç¿¼çè§åº¦ï¼é»è®¤0.623ï¼å½ä¸º1æ¶ï¼ä¸ºæ£ä¸è§ |
| | | }], |
| | | // ['Diamond', { |
| | | // events: { |
| | | // dblclick: function (diamondOverlay, originalEvent) { |
| | | // console.log('double click on diamond overlay for : ' + diamondOverlay.component) |
| | | // } |
| | | // } |
| | | // }], |
| | | ['Label', { |
| | | label: '', |
| | | location: 0.1, |
| | | cssClass: 'aLabel' |
| | | }] |
| | | ], |
| | | // ç»å¶å¾çæ¨¡å¼ svgãcanvas |
| | | RenderMode: 'svg', |
| | | // é¼ æ æ»è¿çº¿çæ ·å¼ |
| | | HoverPaintStyle: {stroke: '#b0b2b5', strokeWidth: 1}, |
| | | // æ»è¿éç¹ææ |
| | | // EndpointHoverStyle: {fill: 'red'} |
| | | Scope: 'jsPlumb_DefaultScope' // èå´ï¼å
·æç¸åscopeçç¹æå¯è¿æ¥ |
| | | }, |
| | | /** |
| | | * è¿çº¿åæ° |
| | | */ |
| | | jsplumbConnectOptions: { |
| | | isSource: true, |
| | | isTarget: true, |
| | | // 卿éç¹ãæä¾äº4个æ¹å ContinuousãAutoDefault |
| | | anchor: 'Continuous', |
| | | // 设置è¿çº¿ä¸é¢çlabelæ ·å¼ |
| | | labelStyle: { |
| | | cssClass: 'flowLabel' |
| | | }, |
| | | // ä¿®æ¹äºjsplumb æºç ï¼æ¯ælabel ä¸ºç©ºä¼ å
¥èªå®ä¹style |
| | | emptyLabelStyle: { |
| | | cssClass: 'emptyFlowLabel' |
| | | } |
| | | }, |
| | | /** |
| | | * æºç¹é
ç½®åæ° |
| | | */ |
| | | jsplumbSourceOptions: { |
| | | // 设置å¯ä»¥ææ½çç±»åï¼åªè¦é¼ æ ç§»å¨å°è¯¥ç±»åä¸çDOMï¼å°±å¯ä»¥ææ½è¿çº¿ |
| | | filter: '.flow-node-drag', |
| | | filterExclude: false, |
| | | anchor: 'Continuous', |
| | | // æ¯å¦å
许èªå·±è¿æ¥èªå·± |
| | | allowLoopback: true, |
| | | maxConnections: -1, |
| | | onMaxConnections: function (info, e) { |
| | | console.log(`è¶
è¿äºæå¤§å¼è¿çº¿: ${info.maxConnections}`) |
| | | } |
| | | }, |
| | | // åè https://www.cnblogs.com/mq0036/p/7942139.html |
| | | jsplumbSourceOptions2: { |
| | | // 设置å¯ä»¥ææ½çç±»åï¼åªè¦é¼ æ ç§»å¨å°è¯¥ç±»åä¸çDOMï¼å°±å¯ä»¥ææ½è¿çº¿ |
| | | filter: '.flow-node-drag', |
| | | filterExclude: false, |
| | | // anchor: 'Continuous', |
| | | // æ¯å¦å
许èªå·±è¿æ¥èªå·± |
| | | allowLoopback: true, |
| | | connector: ['Flowchart', {curviness: 50}], |
| | | connectorStyle: { |
| | | // 线çé¢è² |
| | | stroke: 'red', |
| | | // 线çç²ç»ï¼å¼è¶å¤§çº¿è¶ç² |
| | | strokeWidth: 1, |
| | | // 设置å¤è¾¹çº¿çé¢è²ï¼é»è®¤è®¾ç½®éæï¼è¿æ ·å«äººå°±çä¸è§äºï¼ç¹å»çº¿çæ¶åå¯ä»¥ä¸ç¨ç²¾ç¡®ç¹å»ï¼åè https://blog.csdn.net/roymno2/article/details/72717101 |
| | | outlineStroke: 'transparent', |
| | | // 线å¤è¾¹ç宽ï¼å¼è¶å¤§ï¼çº¿çç¹å»èå´è¶å¤§ |
| | | outlineWidth: 10 |
| | | }, |
| | | connectorHoverStyle: {stroke: 'red', strokeWidth: 2} |
| | | }, |
| | | jsplumbTargetOptions: { |
| | | // 设置å¯ä»¥ææ½çç±»åï¼åªè¦é¼ æ ç§»å¨å°è¯¥ç±»åä¸çDOMï¼å°±å¯ä»¥ææ½è¿çº¿ |
| | | filter: '.flow-node-drag', |
| | | filterExclude: false, |
| | | // æ¯å¦å
许èªå·±è¿æ¥èªå·± |
| | | anchor: 'Continuous', |
| | | allowLoopback: true, |
| | | dropOptions: {hoverClass: 'ef-drop-hover'} |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div ref="node" class="node-item" :style="nodeContainerStyle" @click="clickNode" @mouseup="changeNodeSite" |
| | | :class="nodeContainerClass"> |
| | | <!-- æå·¦ä¾§ç飿¡ç«çº¿ --> |
| | | <div class="ef-node-left"></div> |
| | | <!-- èç¹ç±»åç徿 --> |
| | | <div class="ef-node-left-ico flow-node-drag"> |
| | | <i :class="nodeIcoClass"></i> |
| | | </div> |
| | | <!-- èç¹åç§° --> |
| | | <div class="ef-node-text" :show-overflow-tooltip="true"> |
| | | {{ node.name }} |
| | | </div> |
| | | <i @click.stop="delNode" v-if="node.type == 'node' && !disabled" style="display: none" class="el-icon-delete"></i> |
| | | <!-- èç¹ç¶æå¾æ --> |
| | | <div class="ef-node-right-ico"> |
| | | <i class="el-icon-circle-check el-node-state-success" v-show="node.state === 'success'"></i> |
| | | <i class="el-icon-circle-close el-node-state-error" v-show="node.state === 'error'"></i> |
| | | <i class="el-icon-warning-outline el-node-state-warning" v-show="node.state === 'warning'"></i> |
| | | <i class="el-icon-loading el-node-state-running" v-show="node.state === 'running'"></i> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | props: { |
| | | node: Object, |
| | | activeElement: Object, |
| | | disabled: { |
| | | typeof: Boolean, |
| | | default: false |
| | | } |
| | | }, |
| | | data() { |
| | | return {} |
| | | }, |
| | | computed: { |
| | | nodeContainerClass() { |
| | | return { |
| | | 'ef-node-container': true, |
| | | 'ef-node-active': this.activeElement.type == 'node' ? this.activeElement.nodeId === this.node.id : false |
| | | } |
| | | }, |
| | | // èç¹å®¹å¨æ ·å¼ |
| | | nodeContainerStyle() { |
| | | return { |
| | | top: this.node.top, |
| | | left: this.node.left |
| | | } |
| | | }, |
| | | nodeIcoClass() { |
| | | var nodeIcoClass = {} |
| | | nodeIcoClass[this.node.ico] = true |
| | | // æ·»å 该classå¯ä»¥æ¨æ½è¿çº¿åºæ¥ï¼viewOnly å¯ä»¥æ§å¶èç¹æ¯å¦è¿è¡ç¼è¾ |
| | | nodeIcoClass['flow-node-drag'] = this.node.viewOnly ? false : true |
| | | return nodeIcoClass |
| | | } |
| | | }, |
| | | methods: { |
| | | // ç¹å»èç¹ |
| | | clickNode() { |
| | | this.$emit('clickNode', this.node.id) |
| | | }, |
| | | // é¼ æ ç§»å¨åæ¬èµ· |
| | | changeNodeSite() { |
| | | // é¿å
æå¨ |
| | | if (this.node.left == this.$refs.node.style.left && this.node.top == this.$refs.node.style.top) { |
| | | return; |
| | | } |
| | | this.$emit('changeNodeSite', { |
| | | nodeId: this.node.id, |
| | | left: this.$refs.node.style.left, |
| | | top: this.$refs.node.style.top, |
| | | }) |
| | | }, delNode() { |
| | | this.$emit("delNode"); |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | /* .node-item{ |
| | | position: relative; |
| | | } */ |
| | | .node-item:hover .el-icon-delete { |
| | | display: inline-block !important; |
| | | } |
| | | |
| | | .el-icon-delete { |
| | | cursor: pointer; |
| | | position: relative; |
| | | top: -18px; |
| | | padding-left: 5px; |
| | | right: -16px; |
| | | color: #f61313; |
| | | height: 20px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="node-filter-container"> |
| | | <!-- <div class="add-btn"> |
| | | <span class="name">æ¡ä»¶è®¾ç½®</span> <el-button @click="addItem" link><i>+</i>æ·»å åæ®µ</el-button> |
| | | </div> --> |
| | | <!-- {{ $store.getters.data().flowTable.WorkTable }} --> |
| | | <div class="ef-node-pmenu-item" style="display: flex;"> |
| | | <div style="flex:1;"> |
| | | <span class="name"><i class="el-icon-news"></i>æ¡ä»¶è®¾ç½®</span> |
| | | </div> |
| | | <div><el-button link size="small" @click="addItem" type="primary" v-if="!disabled"> |
| | | + æ·»å åæ®µ</el-button></div> |
| | | </div> |
| | | |
| | | <div> |
| | | <table> |
| | | <tr> |
| | | <td>åæ®µ</td> |
| | | <td style="width:90px">æ¡ä»¶</td> |
| | | <td class="value">å¼</td> |
| | | <td style="width: 40px;" v-if="!disabled">æä½</td> |
| | | </tr> |
| | | <tr v-for="(item, index) in filters" :key="index"> |
| | | |
| | | <td><el-select @change="(field) => { fieldChange(field, index) }" size="small" v-model="item.field" |
| | | placeholder="è¯·éæ©" :disabled="disabled"> |
| | | <el-option v-for="data in fieldsOptions" :key="data.field" :label="data.name" |
| | | :value="data.field" /> |
| | | </el-select></td> |
| | | <td><el-select size="small" v-model="item.filterType" placeholder="è¯·éæ©" :disabled="disabled"> |
| | | <el-option v-for="data in filterType" :key="data.value" :label="data.name" |
| | | :value="data.value" /> |
| | | </el-select></td> |
| | | <td> |
| | | <template v-if="item.data"> |
| | | <el-select v-if="item.data.length >= 300" multiple size="small" v-model="item.value" |
| | | placeholder="è¯·éæ©"> |
| | | <el-option v-for="data in item.data" :key="data.key" :label="data.value" |
| | | :value="data.key" :disabled="disabled" /> |
| | | </el-select> |
| | | <el-select-v2 style="width: 100%;" v-else multiple size="small" :options="item.data" |
| | | v-model="item.value" placeholder="è¯·éæ©" :disabled="disabled"> |
| | | </el-select-v2> |
| | | </template> |
| | | <el-input v-else v-model="item.value" size="small" :disabled="disabled"></el-input> |
| | | </td> |
| | | <td @click="delItem(index)" class="item-del" v-if="!disabled"><i class="el-icon-delete"></i></td> |
| | | </tr> |
| | | </table> |
| | | </div> |
| | | <!-- <div> |
| | | <label>èªå®ä¹sql</label> |
| | | <div><el-input type="textarea" v-model="customSql"></el-input></div> |
| | | </div> --> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | let _this = this; |
| | | export default { |
| | | props: { |
| | | tableName: { |
| | | type: String, |
| | | default: "" |
| | | }, |
| | | filters: { |
| | | type: Array, |
| | | default: () => { |
| | | return [] |
| | | } |
| | | }, |
| | | disabled:{ |
| | | typeof:Boolean, |
| | | default:false |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | filter: this.$store.getters.data().flowTable, |
| | | customSql: "", |
| | | value: "", |
| | | //{ field: "åç§°", value: "", filterType: "=" }, |
| | | // filters: [], |
| | | fieldsOptions: [ |
| | | |
| | | ], |
| | | t: [], |
| | | filterType: [{ name: "çäº(=)", value: "=" }, |
| | | { name: "ä¸çäº(!=)", value: "!=" }, |
| | | { name: "大äº(>)", value: ">" }, |
| | | { name: "大äºçäº(>=)", value: ">=" }, |
| | | { name: "å°äº(<)", value: "<" }, |
| | | { name: "å°äºçäº(<=)", value: "<=" }, |
| | | { name: "å
æ¬(in)", value: "in" }, |
| | | // { name: "ä¸å
æ¬(not in)", value: "notin" }, |
| | | { name: "模ç³å¹é
(like)", value: "like" }, |
| | | { name: "æè
(or)", value: "or" } |
| | | ] |
| | | } |
| | | }, |
| | | methods: { |
| | | delItem(index) { |
| | | this.$confirm('确认è¦å é¤åé
ç½®æ¡ä»¶é
ç½®å?', 'è¦å', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | center: true |
| | | }).then(() => { |
| | | this.filters.splice(index, 1); |
| | | }); |
| | | }, |
| | | addItem() { |
| | | this.filters.push({ field: "", value: "", filterType: "", data: null }) |
| | | }, |
| | | fieldChange(field, index) { |
| | | let option = this.fieldsOptions.find(x => { return x.field == field }); |
| | | this.filters[index].field = option.field; |
| | | this.filters[index].value = option.data ? [] : null; |
| | | this.filters[index].data = option.data;; |
| | | }, |
| | | convertOptions(result) { |
| | | |
| | | }, |
| | | getOptions(tableName) { |
| | | const url = 'api/Sys_WorkFlow/getFields?table=' + tableName; |
| | | this.http.post(url, {}, false).then(result => { |
| | | result.forEach(c => { |
| | | if (c.data && c.data.length < 300) { |
| | | c.data = c.data.map(x => { |
| | | return { |
| | | value: x.key, |
| | | label: x.value, |
| | | key: x.key |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | _this.fieldsOptions = result; |
| | | }) |
| | | } |
| | | }, |
| | | watch: { |
| | | 'filter.WorkTable': { |
| | | handler(newvalue, oldvalue) { |
| | | if (newvalue) { |
| | | this.getOptions(newvalue); |
| | | } else { |
| | | // this.fieldsOptions.splice(0) |
| | | } |
| | | } |
| | | } |
| | | // deep:true, |
| | | // filter(newVal,oldVal){ |
| | | // alert(1) |
| | | // } |
| | | }, |
| | | created() { |
| | | _this = this; |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .node-filter-container { |
| | | margin-top: 15px; |
| | | |
| | | table { |
| | | width: 100%; |
| | | padding-left: 6px; |
| | | |
| | | td { |
| | | font-size: 13px; |
| | | padding: 5px; |
| | | |
| | | } |
| | | |
| | | tr:first-child { |
| | | font-size: 12px; |
| | | font-weight: bolder; |
| | | } |
| | | |
| | | .item-del { |
| | | text-align: center; |
| | | color: rgb(226, 4, 4); |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .value { |
| | | width: 150px; |
| | | } |
| | | } |
| | | |
| | | .add-btn { |
| | | text-align: right; |
| | | padding-right: 10px; |
| | | border-bottom: 1px solid #e8e8e8; |
| | | padding-bottom: 5px; |
| | | } |
| | | |
| | | .node-filter-item {} |
| | | }</style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <div class="ef-node-form"> |
| | | <div class="ef-node-pmenu-item"> |
| | | <div style="flex:1;"> |
| | | <span class="name"><i class="el-icon-news"></i>èç¹å±æ§</span> |
| | | <!-- <span @click="nameClick(1)" :class="{ active: index === 1 }" class="name">å®¡æ¹æ¡ä»¶</span> --> |
| | | </div> |
| | | <!-- <div><el-button link size="small" type="primary" @click="save"><i class="el-icon-check"></i> |
| | | ä¿åé
ç½®</el-button></div> --> |
| | | </div> |
| | | <div class="ef-node-form-body"> |
| | | <div class="form-info"> |
| | | <VolForm ref="form" style="padding:0 10px;" :label-width="130" :loadKey="false" :formFields="node" |
| | | :formRules="formRules" :disabled="disabled"> |
| | | </VolForm> |
| | | </div> |
| | | <div> |
| | | <node-filter :filters="node.filters" :disabled="disabled" :tableName="tableName" ref="filter"> |
| | | </node-filter> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="el-node-form-tag"></div>--> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | // import { cloneDeep } from 'lodash' |
| | | import VolForm from '@/components/basic/VolForm.vue'; |
| | | import nodeFilter from './node_filter.vue'; |
| | | export default { |
| | | components: { |
| | | VolForm, |
| | | 'node-filter': nodeFilter |
| | | }, |
| | | props: { |
| | | disabled:{ |
| | | typeof:Boolean, |
| | | default:false |
| | | } |
| | | // node: { |
| | | // type: Object, |
| | | // default: () => { |
| | | // return { |
| | | // name: '', |
| | | // auditType: 1,//å®¡æ ¸ç±»å |
| | | // userId: null, |
| | | // roleId: null, |
| | | // deptId: null, |
| | | // auditRefuse: null,//å®¡æ ¸æªéè¿ |
| | | // auditBack: null, //驳å |
| | | // auditMethod: 0,//å®¡æ¹æ¹å¼(ä¼ç¾) |
| | | // stepValue: null, |
| | | // sendMail: 0, |
| | | // filters: [] //åæ®µè¿æ»¤æ¡ä»¶ |
| | | // } |
| | | // } |
| | | // } |
| | | }, |
| | | created() { |
| | | this.http.get('api/Sys_WorkFlow/getNodeDic').then((result) => { |
| | | this.formRules.forEach((options) => { |
| | | options.forEach((option) => { |
| | | if (option.dataKey && !option.data.length) { |
| | | option.data = result[option.dataKey] || []; |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | }, |
| | | data() { |
| | | return { |
| | | tableName: "", |
| | | index: 1, |
| | | visible: true, |
| | | // node æ line |
| | | type: 'node', |
| | | node: {}, |
| | | line: {}, |
| | | data: {}, |
| | | |
| | | node: { |
| | | name: '', |
| | | auditType: 1,//å®¡æ ¸ç±»å |
| | | userId: null, |
| | | roleId: null, |
| | | deptId: null, |
| | | auditRefuse: null,//å®¡æ ¸æªéè¿ |
| | | auditBack: null, //驳å |
| | | auditMethod: 0,//å®¡æ¹æ¹å¼(ä¼ç¾) |
| | | // nodeValue: null, |
| | | sendMail: 0, |
| | | filters: [] |
| | | }, |
| | | formRules: [ |
| | | [ |
| | | { |
| | | title: 'èç¹åç§°', |
| | | field: 'name', |
| | | required: true, |
| | | colSize: 12 |
| | | }], |
| | | [ |
| | | { |
| | | dataKey: '', |
| | | title: '审æ¹ç±»å', |
| | | required: true, |
| | | hidden: false, |
| | | field: 'auditType', |
| | | data: [ |
| | | { key: 1, value: 'æç¨æ·å®¡æ¹' }, |
| | | { key: 2, value: 'æè§è²å®¡æ¹' }, |
| | | { key: 3, value: 'æé¨é¨å®¡æ¹' } |
| | | ], |
| | | type: 'select', |
| | | onChange: this.nodeTypeChange, |
| | | colSize: 12 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | dataKey: 'users', |
| | | hidden: false, |
| | | title: '审æ¹ç¨æ·', |
| | | required: true, |
| | | field: 'userId', |
| | | data: [], |
| | | type: 'selectList', |
| | | colSize: 12 |
| | | } |
| | | , |
| | | { |
| | | dataKey: 'roles', |
| | | hidden: true, |
| | | title: 'è§è²ä¿¡æ¯', |
| | | required: true, |
| | | field: 'roleId', |
| | | |
| | | data: [], |
| | | type: 'select', |
| | | colSize: 12 |
| | | } |
| | | , |
| | | { |
| | | dataKey: 'dept', |
| | | hidden: true, |
| | | title: 'é¨é¨ä¿¡æ¯', |
| | | required: true, |
| | | field: 'deptId', |
| | | data: [], |
| | | type: 'select', |
| | | colSize: 12 |
| | | } |
| | | ], [ |
| | | { |
| | | dataKey: '', |
| | | title: 'å®¡æ¹æªéè¿', |
| | | required: false, |
| | | field: 'auditRefuse', |
| | | hidden: false, |
| | | data: [ |
| | | { key: 1, value: 'è¿åä¸ä¸èç¹' }, |
| | | { key: 2, value: 'æµç¨éæ°å¼å§' }, |
| | | { key: 0, value: 'æµç¨ç»æ' }, |
| | | ], |
| | | type: 'select', |
| | | colSize: 6 |
| | | } |
| | | , |
| | | { |
| | | dataKey: '', |
| | | title: '审æ¹é©³å', |
| | | required: false, |
| | | hidden: false, |
| | | field: 'auditBack', |
| | | data: [ |
| | | { key: 1, value: 'è¿åä¸ä¸èç¹' }, |
| | | { key: 2, value: 'æµç¨éæ°å¼å§' }, |
| | | { key: 0, value: 'æµç¨ç»æ' }, |
| | | ], |
| | | type: 'select', |
| | | colSize: 6 |
| | | |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | dataKey: '', |
| | | title: 'å®¡æ ¸ååéé®ä»¶éç¥', |
| | | required: false, |
| | | hidden: false, |
| | | field: 'sendMail', |
| | | data: [ |
| | | { key: 1, value: 'æ¯' }, |
| | | { key: 0, value: 'å¦' }, |
| | | ], |
| | | type: 'switch' |
| | | }, |
| | | { |
| | | dataKey: '', |
| | | title: 'å¯ç¨ä¼ç¾', |
| | | required: false, |
| | | hidden: false, |
| | | field: 'auditMethod',//å®¡æ¹æ¹å¼ |
| | | data: [ |
| | | { key: 1, value: 'æ¯' }, |
| | | { key: 0, value: 'å¦' } |
| | | ], |
| | | type: 'switch' |
| | | } |
| | | ], |
| | | ], |
| | | } |
| | | }, |
| | | methods: { |
| | | nameClick(index) { |
| | | this.index = index; |
| | | }, |
| | | /** |
| | | * 表åä¿®æ¹ï¼è¿éå¯ä»¥æ ¹æ®ä¼ å
¥çIDè¿è¡ä¸å¡ä¿¡æ¯è·å |
| | | * @param data |
| | | * @param id |
| | | */ |
| | | nodeInit(data, id, tableName) { |
| | | this.tableName = tableName; |
| | | this.type = 'node' |
| | | this.data = data; |
| | | // this.tableName=data. |
| | | data.nodeList.filter((node) => { |
| | | if (node.id === id) { |
| | | this.formRules.forEach(options => { |
| | | options.forEach(c => { |
| | | if (c.field != 'name') { |
| | | c.hidden = node.type == 'start' || node.type == 'end'; |
| | | } |
| | | }) |
| | | }) |
| | | if (!node.filters) { |
| | | node.filters = []; |
| | | } |
| | | this.node = node;// cloneDeep(node) |
| | | if (node.type != 'start' && node.type != 'end') { |
| | | this.nodeTypeChange(node.auditType); |
| | | } |
| | | } |
| | | }) |
| | | // data.nodeList.filter((node) => { |
| | | // if (node.id === id) { |
| | | // let _node = cloneDeep(node); |
| | | // _node.roleId = _node.roleId || null; |
| | | // _node.userId = _node.userId || null; |
| | | // _node.nodeType = (_node.nodeType || 1) * 1; |
| | | // if (!node.filters) { |
| | | // node.filters = []; |
| | | // } |
| | | // _node.filters = node.filters; |
| | | // this.nodeTypeChange(_node.nodeType); |
| | | // Object.assign(this.node, _node); |
| | | // } |
| | | // }); |
| | | }, |
| | | nodeTypeChange(value) { |
| | | // { key: 1, value: 'æç¨æ·å®¡æ¹' }, |
| | | // { key: 2, value: 'æè§è²å®¡æ¹' }, |
| | | // { key: 3, value: 'æé¨é¨å®¡æ¹' } |
| | | this.formRules.forEach((options) => { |
| | | options.forEach((option) => { |
| | | if (option.field == 'userId') { |
| | | option.hidden = value != 1; |
| | | } else if (option.field == 'roleId') { |
| | | option.hidden = value != 2; |
| | | } else if (option.field == 'deptId') { |
| | | option.hidden = value != 3; |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | lineInit(line) { |
| | | this.type = 'line' |
| | | this.line = line |
| | | }, |
| | | // ä¿®æ¹è¿çº¿ |
| | | saveLine() { |
| | | this.$emit('setLineLabel', this.line.from, this.line.to, this.line.label) |
| | | }, |
| | | save() { |
| | | this.data.nodeList.filter((node) => { |
| | | if (node.id === this.node.id) { |
| | | node.name = this.node.name; |
| | | node.left = this.node.left; |
| | | node.top = this.node.top; |
| | | node.ico = this.node.ico; |
| | | node.state = this.node.state; |
| | | node.stepValue = this.node.stepValue; |
| | | this.$emit('repaintEverything', this.node); |
| | | } |
| | | |
| | | }); |
| | | this.$message.success('ä¿åæå') |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .el-node-form-tag { |
| | | position: absolute; |
| | | top: 50%; |
| | | margin-left: -15px; |
| | | height: 40px; |
| | | width: 15px; |
| | | background-color: #fbfbfb; |
| | | border: 1px solid rgb(220, 227, 232); |
| | | border-right: none; |
| | | z-index: 0; |
| | | } |
| | | |
| | | .btns { |
| | | text-align: center; |
| | | padding: 10px; |
| | | |
| | | buttton { |
| | | flex: 1; |
| | | } |
| | | } |
| | | |
| | | .ef-node-pmenu-item { |
| | | display: flex; |
| | | |
| | | .name { |
| | | cursor: pointer; |
| | | margin-right: 15px; |
| | | } |
| | | |
| | | .active { |
| | | color: #0659e8; |
| | | } |
| | | } |
| | | |
| | | .form-info ::v-deep(.vol-form-item) { |
| | | display: flex; |
| | | |
| | | .el-form-item:nth-child(2), |
| | | .el-form-item:nth-child(3), |
| | | .el-form-item:nth-child(4) { |
| | | margin-left: 12px; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="flow-menu" ref="tool"> |
| | | <div v-for="menu in menuList" :key="menu.id"> |
| | | <div class="ef-node-pmenu-item"><i class="el-icon-notebook-2"></i>èç¹é
ç½®</div> |
| | | <ul v-show="menu.open" class="ef-node-menu-ul"> |
| | | <draggable @end="end" @start="move" v-model="menu.children" :options="draggableOptions"> |
| | | <li v-for="subMenu in menu.children" class="ef-node-menu-li" :key="subMenu.id" :type="subMenu.type"> |
| | | <i :class="subMenu.ico"></i> {{ subMenu.name }} |
| | | </li> |
| | | </draggable> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { VueDraggableNext as draggable } from "vue-draggable-next"; |
| | | |
| | | var mousePosition = { |
| | | left: -1, |
| | | top: -1 |
| | | } |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | activeNames: '1', |
| | | // draggableé
ç½®åæ°åè https://www.cnblogs.com/weixin186/p/10108679.html |
| | | draggableOptions: { |
| | | preventOnFilter: false, |
| | | sort: false, |
| | | disabled: false, |
| | | ghostClass: 'tt', |
| | | // ä¸ä½¿ç¨H5åççé
ç½® |
| | | forceFallback: true, |
| | | // ææ½çæ¶åæ ·å¼ |
| | | // fallbackClass: 'flow-node-draggable' |
| | | }, |
| | | // é»è®¤æå¼ç左侧èåçid |
| | | defaultOpeneds: ['1', '2'], |
| | | menuList: [ |
| | | { |
| | | id: '1', |
| | | type: 'group', |
| | | name: 'å¼å§èç¹', |
| | | ico: 'el-icon-video-play', |
| | | open: true, |
| | | children: [ |
| | | { |
| | | id: '0', |
| | | type: 'start', |
| | | name: 'æµç¨å¼å§', |
| | | ico: 'el-icon-time', |
| | | // èªå®ä¹è¦çæ ·å¼ |
| | | style: {} |
| | | }, |
| | | { |
| | | id: '1', |
| | | type: 'end', |
| | | name: 'æµç¨ç»æ', |
| | | ico: 'el-icon-switch-button', |
| | | // èªå®ä¹è¦çæ ·å¼ |
| | | style: {} |
| | | }, { |
| | | id: '2', |
| | | type: 'node', |
| | | name: 'æµç¨èç¹', |
| | | ico: 'el-icon-news', |
| | | // èªå®ä¹è¦çæ ·å¼ |
| | | style: {} |
| | | } |
| | | ] |
| | | }], |
| | | |
| | | nodeMenu: {} |
| | | } |
| | | }, |
| | | components: { |
| | | draggable |
| | | }, |
| | | created() { |
| | | /** |
| | | * 以䏿¯ä¸ºäºè§£å³å¨ç«çæµè§å¨ä¸æ¨æ½æ¶å¼¹åºtabé¡µå°æç´¢é®é¢ |
| | | * @param event |
| | | */ |
| | | if (this.isFirefox()) { |
| | | document.body.ondrop = function (event) { |
| | | // è§£å³ç«çæµè§å¨æ æ³è·åé¼ æ ææ½ç»æçåæ é®é¢ |
| | | mousePosition.left = event.layerX |
| | | mousePosition.top = event.clientY - 50 |
| | | event.preventDefault(); |
| | | event.stopPropagation(); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // æ ¹æ®ç±»åè·å左侧èå对象 |
| | | getMenuByType(type) { |
| | | for (let i = 0; i < this.menuList.length; i++) { |
| | | let children = this.menuList[i].children; |
| | | for (let j = 0; j < children.length; j++) { |
| | | if (children[j].type === type) { |
| | | return children[j] |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | // ææ½å¼å§æ¶è§¦å |
| | | move(evt, a, b, c) { |
| | | var type = evt.item.attributes.type.nodeValue |
| | | this.nodeMenu = this.getMenuByType(type) |
| | | }, |
| | | // ææ½ç»ææ¶è§¦å |
| | | end(evt, e) { |
| | | this.$emit('addNode', evt, this.nodeMenu, mousePosition) |
| | | }, |
| | | // æ¯å¦æ¯ç«çæµè§å¨ |
| | | isFirefox() { |
| | | var userAgent = navigator.userAgent |
| | | if (userAgent.indexOf("Firefox") > -1) { |
| | | return true |
| | | } |
| | | return false |
| | | } |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- å®¡æ ¸æµç¨æä»¶åºäºhttps://gitee.com/xiaoka2017/easy-flowä¿®æ¹--> |
| | | <!--æè°¢è级å°èé¸ / easy-flow --> |
| | | <template> |
| | | <div v-if="easyFlowVisible" class="flow-panel"> |
| | | |
| | | <div style="display: flex;height: 100%;position: relative;"> |
| | | <el-scrollbar style="height: 100%;border-right: 1px solid rgb(220, 227, 232);"> |
| | | <div style="width: 220px;"> |
| | | <div class="ef-node-pmenu-item"><i class="el-icon-warning-outline"></i>åºç¡ä¿¡æ¯</div> |
| | | <VolForm ref="form" style="padding: 10px;" :label-width="180" :loadKey="true" :formFields="formFields" |
| | | :disabled="disabled" :formRules="formRules"></VolForm> |
| | | <node-menu @addNode="addNode" ref="nodeMenu" v-if="!disabled"></node-menu> |
| | | </div> |
| | | </el-scrollbar> |
| | | <div class="tools"> |
| | | <el-button circle @click="zoomAdd"><i class="el-icon-zoom-in"></i></el-button> |
| | | <el-button circle @click="zoomSub"><i class="el-icon-zoom-out"></i></el-button> |
| | | </div> |
| | | <div style="flex: 1;" id="efContainer" ref="efContainer" class="container efContainer" v-flowDrag> |
| | | <template :key="node.id" v-for="node in data.nodeList"> |
| | | <flow-node :id="node.id" @delNode="deleteNode(node.id)" :node="node" :activeElement="activeElement" |
| | | :disabled="disabled" @changeNodeSite="changeNodeSite" @nodeRightMenu="nodeRightMenu" |
| | | @clickNode="clickNode"> |
| | | </flow-node> |
| | | </template> |
| | | <!-- ç»ç»å¸ä¸ä¸ªé»è®¤ç宽度åé«åº¦ --> |
| | | <div style="position:absolute;top: 3000px;left: 4000px;"> </div> |
| | | </div> |
| | | <!-- å³ä¾§è¡¨å --> |
| | | <div style="width: 400px;border-left: 1px solid #dce3e8;background-color: #FBFBFB"> |
| | | <el-scrollbar style="height: 100%;padding-bottom: 10px;"> |
| | | <flow-node-form @delNode="deleteNode" ref="nodeForm" @setLineLabel="setLineLabel" :disabled="disabled" |
| | | @repaintEverything="repaintEverything"></flow-node-form> |
| | | </el-scrollbar> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { VueDraggableNext as draggable } from "vue-draggable-next"; |
| | | // import { jsPlumb } from 'jsplumb' |
| | | // 使ç¨ä¿®æ¹åçjsplumb |
| | | import './jsplumb' |
| | | import { easyFlowMixin } from './mixins' |
| | | import flowNode from './node' |
| | | import nodeMenu from './node_menu' |
| | | import FlowNodeForm from './node_form' |
| | | import lodash from 'lodash' |
| | | // import { getDataA } from './data_A' |
| | | import VolForm from '@/components/basic/VolForm.vue'; |
| | | export default { |
| | | props: { |
| | | disabled: { |
| | | typeof: Boolean, |
| | | default: false |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | formFields: { |
| | | WorkName: '', |
| | | WorkTable: '', |
| | | WorkTableName: '', |
| | | Weight: 1, |
| | | AuditingEdit: 0, |
| | | Remark: '' |
| | | }, |
| | | formRules: [ |
| | | [ |
| | | { |
| | | dataKey: 'æµç¨åç§°', |
| | | title: 'æµç¨åç§°', |
| | | field: 'WorkName', |
| | | required: true |
| | | }], |
| | | [{ |
| | | dataKey: '', |
| | | title: 'æµç¨å®ä¾', |
| | | required: true, |
| | | field: 'WorkTable', |
| | | data: [], |
| | | readonly: false, |
| | | type: 'select', |
| | | onChange: (value, item) => { |
| | | this.formRules.forEach((options) => { |
| | | options.forEach((option) => { |
| | | if (option.field == 'WorkTable') { |
| | | this.formFields.WorkTableName = option.data.find((x) => { |
| | | return x.key == value; |
| | | }).value; |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | }], |
| | | [{ |
| | | title: 'æé(ç¸åæ¡ä»¶æé大ä¼å
)', |
| | | field: 'Weight', |
| | | type: "number", |
| | | } |
| | | ], |
| | | |
| | | [{ |
| | | title: 'å®¡æ ¸ä¸æ°æ®æ¯å¦å¯ä»¥ç¼è¾', |
| | | field: 'AuditingEdit', |
| | | type: "switch", |
| | | data: [{ key: 0, value: "å¦" }, { key: 1, value: "æ¯" }] |
| | | } |
| | | ], |
| | | [{ |
| | | title: '夿³¨', |
| | | field: 'Remark' |
| | | } |
| | | ] |
| | | ], |
| | | // jsPlumb å®ä¾ |
| | | jsPlumb: null, |
| | | // æ§å¶ç»å¸éæ¯ |
| | | easyFlowVisible: true, |
| | | // æ¯å¦å è½½å®æ¯æ å¿ä½ |
| | | loadEasyFlowFinish: false, |
| | | // æ°æ® |
| | | data: {}, |
| | | // æ¿æ´»çå
ç´ ãå¯è½æ¯èç¹ãå¯è½æ¯è¿çº¿ |
| | | activeElement: { |
| | | // å¯éå¼ node ãline |
| | | type: undefined, |
| | | // èç¹ID |
| | | nodeId: undefined, |
| | | // è¿çº¿ID |
| | | sourceId: undefined, |
| | | targetId: undefined |
| | | }, |
| | | zoom: 1 |
| | | } |
| | | }, |
| | | // ä¸äºåºç¡é
置移å¨è¯¥æä»¶ä¸ |
| | | mixins: [easyFlowMixin], |
| | | components: { |
| | | draggable, flowNode, nodeMenu, FlowNodeForm, VolForm |
| | | }, |
| | | directives: { |
| | | 'flowDrag': { |
| | | mounted(el, binding, vnode, oldNode) { |
| | | if (!binding) { |
| | | return |
| | | } |
| | | el.onmousedown = (e) => { |
| | | if (e.button == 2) { |
| | | // å³é®ä¸ç®¡ |
| | | return |
| | | } |
| | | // é¼ æ æä¸ï¼è®¡ç®å½ååå§è·ç¦»å¯è§åºçé«åº¦ |
| | | let disX = e.clientX |
| | | let disY = e.clientY |
| | | el.style.cursor = 'move' |
| | | |
| | | document.onmousemove = function (e) { |
| | | // ç§»å¨æ¶ç¦æ¢é»è®¤äºä»¶ |
| | | e.preventDefault() |
| | | const left = e.clientX - disX |
| | | disX = e.clientX |
| | | el.scrollLeft += -left |
| | | |
| | | const top = e.clientY - disY |
| | | disY = e.clientY |
| | | el.scrollTop += -top |
| | | } |
| | | |
| | | document.onmouseup = function (e) { |
| | | el.style.cursor = 'auto' |
| | | document.onmousemove = null |
| | | document.onmouseup = null |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.jsPlumb = jsPlumb.getInstance() |
| | | // this.$nextTick(() => { |
| | | // // é»è®¤å è½½æµç¨Açæ°æ®ãå¨è¿éå¯ä»¥æ ¹æ®å
·ä½çä¸å¡è¿åç¬¦åæµç¨æ°æ®æ ¼å¼çæ°æ®å³å¯ |
| | | // this.dataReload(getDataA()) |
| | | // }) |
| | | }, |
| | | created() { |
| | | this.http.get('api/Sys_WorkFlow/getTableInfo').then((result) => { |
| | | this.formRules.forEach((options) => { |
| | | options.forEach((option) => { |
| | | if (option.field == 'WorkTable') { |
| | | option.data = result; |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | this.$store.getters.data().flowTable = this.formFields; |
| | | }, |
| | | methods: { |
| | | // è¿åå¯ä¸æ è¯ |
| | | getUUID() { |
| | | return Math.random().toString(36).substr(3, 10) |
| | | }, |
| | | jsPlumbInit() { |
| | | this.jsPlumb.ready(() => { |
| | | // 导å
¥é»è®¤é
ç½® |
| | | this.jsPlumb.importDefaults(this.jsplumbSetting) |
| | | // ä¼ä½¿æ´ä¸ªjsPlumbç«å³éç»ã |
| | | this.jsPlumb.setSuspendDrawing(false, true); |
| | | // åå§åèç¹ |
| | | this.loadEasyFlow() |
| | | // åç¹å»äºè¿æ¥çº¿, https://www.cnblogs.com/ysx215/p/7615677.html |
| | | this.jsPlumb.bind('click', (conn, originalEvent) => { |
| | | this.activeElement.type = 'line' |
| | | this.activeElement.sourceId = conn.sourceId |
| | | this.activeElement.targetId = conn.targetId |
| | | this.$refs.nodeForm.lineInit({ |
| | | from: conn.sourceId, |
| | | to: conn.targetId, |
| | | label: conn.getLabel() |
| | | }) |
| | | this.deleteElement(); |
| | | }) |
| | | // è¿çº¿ |
| | | this.jsPlumb.bind("connection", (evt) => { |
| | | let from = evt.source.id |
| | | let to = evt.target.id |
| | | if (this.loadEasyFlowFinish) { |
| | | this.data.lineList.push({ from: from, to: to }) |
| | | } |
| | | }) |
| | | |
| | | // å é¤è¿çº¿åè° |
| | | this.jsPlumb.bind("connectionDetached", (evt) => { |
| | | this.deleteLine(evt.sourceId, evt.targetId) |
| | | }) |
| | | |
| | | // æ¹å线çè¿æ¥èç¹ |
| | | this.jsPlumb.bind("connectionMoved", (evt) => { |
| | | this.changeLine(evt.originalSourceId, evt.originalTargetId) |
| | | }) |
| | | |
| | | // è¿çº¿å³å» |
| | | this.jsPlumb.bind("contextmenu", (evt) => { |
| | | console.log('contextmenu', evt) |
| | | }) |
| | | |
| | | // è¿çº¿ |
| | | this.jsPlumb.bind("beforeDrop", (evt) => { |
| | | let from = evt.sourceId |
| | | let to = evt.targetId |
| | | if (from === to) { |
| | | this.$message.error('èç¹ä¸æ¯æè¿æ¥èªå·±') |
| | | return false |
| | | } |
| | | if (this.hasLine(from, to)) { |
| | | this.$message.error('该å
³ç³»å·²åå¨,ä¸å
许éå¤å建') |
| | | return false |
| | | } |
| | | if (this.hashOppositeLine(from, to)) { |
| | | this.$message.error('䏿¯æä¸¤ä¸ªèç¹ä¹é´è¿çº¿åç¯'); |
| | | return false |
| | | } |
| | | this.$message.success('è¿æ¥æå') |
| | | setTimeout(() => { this.setLineLabel(from, to, 'x') }, 50) |
| | | return true |
| | | }) |
| | | |
| | | // beforeDetach |
| | | this.jsPlumb.bind("beforeDetach", (evt) => { |
| | | console.log('beforeDetach', evt) |
| | | }) |
| | | this.jsPlumb.setContainer(this.$refs.efContainer) |
| | | }) |
| | | }, |
| | | // å è½½æµç¨å¾ |
| | | loadEasyFlow() { |
| | | // åå§åèç¹ |
| | | for (var i = 0; i < this.data.nodeList.length; i++) { |
| | | let node = this.data.nodeList[i] |
| | | if (node.userId && node.userId != '') { |
| | | // userId为æ°å¼ç±»å |
| | | if (typeof node.userId == 'number'){ |
| | | node.userId = [node.userId] |
| | | } else { |
| | | node.userId = node.userId.split(',').map(Number); |
| | | } |
| | | } else { |
| | | node.userId = [] |
| | | } |
| | | // 设置æºç¹ï¼å¯ä»¥æåºçº¿è¿æ¥å
¶ä»èç¹ |
| | | this.jsPlumb.makeSource(node.id, lodash.merge(this.jsplumbSourceOptions, {})) |
| | | // // è®¾ç½®ç®æ ç¹ï¼å
¶ä»æºç¹æåºç线å¯ä»¥è¿æ¥è¯¥èç¹ |
| | | this.jsPlumb.makeTarget(node.id, this.jsplumbTargetOptions) |
| | | if (!node.viewOnly && !this.disabled) { |
| | | this.jsPlumb.draggable(node.id, { |
| | | containment: 'parent', |
| | | stop: function (el) { |
| | | // ææ½èç¹ç»æåçå¯¹è° |
| | | console.log('ææ½ç»æ: ', el) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | // åå§åè¿çº¿ |
| | | for (var i = 0; i < this.data.lineList.length; i++) { |
| | | let line = this.data.lineList[i] |
| | | var connParam = { |
| | | source: line.from, |
| | | target: line.to, |
| | | label: this.disabled ? null : (line.label ? line.label : 'x'), |
| | | connector: line.connector ? line.connector : '', |
| | | anchors: line.anchors ? line.anchors : undefined, |
| | | |
| | | paintStyle: line.paintStyle ? line.paintStyle : undefined, |
| | | } |
| | | this.jsPlumb.connect(connParam, this.jsplumbConnectOptions) |
| | | } |
| | | this.$nextTick(function () { |
| | | this.loadEasyFlowFinish = true |
| | | }) |
| | | }, |
| | | // 设置è¿çº¿æ¡ä»¶ |
| | | setLineLabel(from, to, label) { |
| | | var conn = this.jsPlumb.getConnections({ |
| | | source: from, |
| | | target: to |
| | | })[0] |
| | | if (!label || label === '') { |
| | | conn.removeClass('flowLabel ') |
| | | conn.addClass('emptyFlowLabel') |
| | | } else { |
| | | conn.addClass('flowLabel') |
| | | } |
| | | conn.setLabel({ |
| | | label: 'x' //label, |
| | | }) |
| | | this.data.lineList.forEach(function (line) { |
| | | if (line.from == from && line.to == to) { |
| | | line.label = 'x'// label |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | // å 餿¿æ´»çå
ç´ |
| | | deleteElement() { |
| | | if (this.disabled) |
| | | return |
| | | if (this.activeElement.type === 'node') { |
| | | this.deleteNode(this.activeElement.nodeId) |
| | | } else if (this.activeElement.type === 'line') { |
| | | this.$confirm('ç¡®å®å 餿ç¹å»ç线å?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | var conn = this.jsPlumb.getConnections({ |
| | | source: this.activeElement.sourceId, |
| | | target: this.activeElement.targetId |
| | | })[0] |
| | | this.jsPlumb.deleteConnection(conn) |
| | | }).catch(() => { |
| | | }) |
| | | } |
| | | }, |
| | | // å é¤çº¿ |
| | | deleteLine(from, to) { |
| | | this.data.lineList = this.data.lineList.filter(function (line) { |
| | | if (line.from == from && line.to == to) { |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | }, |
| | | // æ¹åè¿çº¿ |
| | | changeLine(oldFrom, oldTo) { |
| | | this.deleteLine(oldFrom, oldTo) |
| | | }, |
| | | // æ¹åèç¹çä½ç½® |
| | | changeNodeSite(data) { |
| | | for (var i = 0; i < this.data.nodeList.length; i++) { |
| | | let node = this.data.nodeList[i] |
| | | if (node.id === data.nodeId) { |
| | | node.left = data.left |
| | | node.top = data.top |
| | | } |
| | | } |
| | | }, |
| | | /** |
| | | * ææ½ç»æåæ·»å æ°çèç¹ |
| | | * @param evt |
| | | * @param nodeMenu 被添å çèç¹å¯¹è±¡ |
| | | * @param mousePosition é¼ æ ææ½ç»æçåæ |
| | | */ |
| | | addNode(evt, nodeMenu, mousePosition) { |
| | | if (nodeMenu.type == 'start' && this.data.nodeList.some(x => { return x.type == 'start' })) { |
| | | this.$message.error('ãæµç¨ç»æãèç¹å·²åå¨,åªæéæ©ä¸ä¸ªæµç¨å¼å§èç¹'); |
| | | return |
| | | } |
| | | if (nodeMenu.type == 'end' && this.data.nodeList.some(x => { return x.type == 'end' })) { |
| | | this.$message.error('ãæµç¨ç»æãèç¹å·²åå¨,åªæéæ©ä¸ä¸ªæµç¨å¼å§èç¹'); |
| | | return |
| | | } |
| | | var screenX = evt.originalEvent.clientX, screenY = evt.originalEvent.clientY |
| | | let efContainer = this.$refs.efContainer |
| | | var containerRect = efContainer.getBoundingClientRect() |
| | | var left = screenX, top = screenY |
| | | // è®¡ç®æ¯å¦æå
¥å°å®¹å¨ä¸ |
| | | if (left < containerRect.x || left > containerRect.width + containerRect.x || top < containerRect.y || containerRect.y > containerRect.y + containerRect.height) { |
| | | this.$message.error("请æèç¹æå
¥å°ç»å¸ä¸") |
| | | return |
| | | } |
| | | left = left - containerRect.x + efContainer.scrollLeft |
| | | top = top - containerRect.y + efContainer.scrollTop |
| | | // å±
ä¸ |
| | | left -= 85 |
| | | top -= 16 |
| | | var nodeId = this.getUUID() |
| | | // 卿çæåå |
| | | var origName = nodeMenu.name |
| | | var nodeName = origName |
| | | var index = 1 |
| | | while (index < 10000) { |
| | | var repeat = false |
| | | for (var i = 0; i < this.data.nodeList.length; i++) { |
| | | let node = this.data.nodeList[i] |
| | | if (node.name === nodeName) { |
| | | nodeName = origName + index |
| | | repeat = true |
| | | } |
| | | } |
| | | if (repeat) { |
| | | index++ |
| | | continue |
| | | } |
| | | break |
| | | } |
| | | var node = { |
| | | id: nodeId, |
| | | name: nodeName, |
| | | type: nodeMenu.type, |
| | | left: left + 'px', |
| | | top: top + 'px', |
| | | ico: nodeMenu.ico, |
| | | state: 'success' |
| | | } |
| | | /** |
| | | * è¿éå¯ä»¥è¿è¡ä¸å¡å¤æãæ¯å¦è½å¤æ·»å 该èç¹ |
| | | */ |
| | | this.data.nodeList.push(node) |
| | | this.$nextTick(function () { |
| | | this.jsPlumb.makeSource(nodeId, this.jsplumbSourceOptions) |
| | | this.jsPlumb.makeTarget(nodeId, this.jsplumbTargetOptions) |
| | | this.jsPlumb.draggable(nodeId, { |
| | | containment: 'parent', |
| | | stop: function (el) { |
| | | // ææ½èç¹ç»æåçå¯¹è° |
| | | console.log('ææ½ç»æ: ', el) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | /** |
| | | * å é¤èç¹ |
| | | * @param nodeId 被å é¤èç¹çID |
| | | */ |
| | | deleteNode(nodeId) { |
| | | this.$confirm('ç¡®å®è¦å é¤èç¹' + nodeId + '?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | closeOnClickModal: false |
| | | }).then(() => { |
| | | /** |
| | | * è¿ééè¦è¿è¡ä¸å¡å¤æï¼æ¯å¦å¯ä»¥å é¤ |
| | | */ |
| | | this.data.nodeList = this.data.nodeList.filter(function (node) { |
| | | if (node.id === nodeId) { |
| | | // 伪å é¤ï¼å°èç¹éèï¼å¦åä¼å¯¼è´ä½ç½®éä½ |
| | | // node.show = false |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | this.$nextTick(function () { |
| | | this.jsPlumb.removeAllEndpoints(nodeId); |
| | | }) |
| | | }).catch(() => { |
| | | }) |
| | | return true |
| | | }, |
| | | clickNode(nodeId) { |
| | | this.activeElement.type = 'node' |
| | | this.activeElement.nodeId = nodeId |
| | | this.$refs.nodeForm.nodeInit(this.data, nodeId, this.formFields.WorkTable) |
| | | }, |
| | | // æ¯å¦å
·æè¯¥çº¿ |
| | | hasLine(from, to) { |
| | | for (var i = 0; i < this.data.lineList.length; i++) { |
| | | var line = this.data.lineList[i] |
| | | if (line.from === from && line.to === to) { |
| | | return true |
| | | } |
| | | } |
| | | return false |
| | | }, |
| | | // æ¯å¦å«æç¸åç线 |
| | | hashOppositeLine(from, to) { |
| | | return this.hasLine(to, from) |
| | | }, |
| | | nodeRightMenu(nodeId, evt) { |
| | | this.menu.show = true |
| | | this.menu.curNodeId = nodeId |
| | | this.menu.left = evt.x + 'px' |
| | | this.menu.top = evt.y + 'px' |
| | | }, |
| | | repaintEverything(node) { |
| | | let _node = this.data.nodeList.find((x) => { |
| | | return x.id == node.id; |
| | | }); |
| | | Object.assign(_node, node); |
| | | console.log(_node); |
| | | this.jsPlumb.repaint(); |
| | | }, |
| | | // å è½½æµç¨å¾ |
| | | dataReload(data, isAdd) { |
| | | this.easyFlowVisible = false |
| | | this.data.nodeList = [] |
| | | this.data.lineList = [] |
| | | this.$nextTick(() => { |
| | | data = lodash.cloneDeep(data) |
| | | this.easyFlowVisible = true |
| | | this.data = data |
| | | this.$nextTick(() => { |
| | | this.jsPlumb = jsPlumb.getInstance() |
| | | this.$nextTick(() => { |
| | | this.jsPlumbInit() |
| | | }) |
| | | }) |
| | | }) |
| | | this.formRules.forEach(options => { |
| | | options.forEach(option => { |
| | | if (option.field == "WorkTable") { |
| | | option.readonly = !isAdd; |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | zoomAdd() { |
| | | if (this.zoom >= 1) { |
| | | return |
| | | } |
| | | this.zoom = this.zoom + 0.1 |
| | | this.$refs.efContainer.style.zoom = this.zoom; |
| | | // this.jsPlumb.setZoom(this.zoom) |
| | | }, |
| | | zoomSub() { |
| | | if (this.zoom <= 0) { |
| | | return |
| | | } |
| | | this.zoom = this.zoom - 0.1; |
| | | if (this.zoom < 0.3) { |
| | | this.zoom = 0.3; |
| | | } |
| | | this.$refs.efContainer.style.zoom = this.zoom; |
| | | // this.jsPlumb.setZoom(this.zoom) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style scoped lang="less"> |
| | | @import './index.css'; |
| | | |
| | | .flow-panel { |
| | | position: absolute; |
| | | height: 100%; |
| | | width: 100%; |
| | | } |
| | | |
| | | .flow-panel ::v-deep(.el-form-item__label) { |
| | | margin-bottom: -2px !important; |
| | | text-align: left; |
| | | padding: 0 !important; |
| | | justify-content: flex-start; |
| | | } |
| | | |
| | | .flow-panel ::v-deep(.el-form-item) { |
| | | display: flex; |
| | | flex-direction: column; |
| | | margin-bottom: 7px !important; |
| | | |
| | | } |
| | | |
| | | .ef-node-menu-form { |
| | | padding: 0px; |
| | | } |
| | | |
| | | ::-webkit-scrollbar { |
| | | width: 0px; |
| | | height: 0px; |
| | | } |
| | | |
| | | ::-webkit-scrollbar-thumb { |
| | | border-radius: 0px; |
| | | background: #e0e3e7; |
| | | height: 20px; |
| | | } |
| | | |
| | | ::-webkit-scrollbar-track { |
| | | background-color: transparent; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // æ¯å¦å
·æè¯¥çº¿ |
| | | export function hasLine(data, from, to) { |
| | | for (let i = 0; i < data.lineList.length; i++) { |
| | | let line = data.lineList[i] |
| | | if (line.from === from && line.to === to) { |
| | | return true |
| | | } |
| | | } |
| | | return false |
| | | } |
| | | |
| | | // æ¯å¦å«æç¸åç线 |
| | | export function hashOppositeLine(data, from, to) { |
| | | return hasLine(data, to, from) |
| | | } |
| | | |
| | | // è·åè¿çº¿ |
| | | export function getConnector(jsp, from, to) { |
| | | let connection = jsp.getConnections({ |
| | | source: from, |
| | | target: to |
| | | })[0] |
| | | return connection |
| | | } |
| | | |
| | | // è·åå¯ä¸æ è¯ |
| | | export function uuid() { |
| | | return Math.random().toString(36).substr(3, 10) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box |
| | | v-model="showDetialBox" |
| | | :lazy="true" |
| | | :width="width" |
| | | :padding="15" |
| | | title="è·¯ç±é
ç½®" |
| | | :footer="true" |
| | | > |
| | | <el-row height="50"> |
| | | <el-col :span="24"> |
| | | <div class="grid-content right-text"> |
| | | <!-- <el-link type="primary" @click="deleteNode">ç§»é¤èç¹</el-link> --> |
| | | <el-link type="primary" @click="addNode">æ·»å èç¹</el-link> |
| | | </div> |
| | | <div class="grid-content right-text"></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="6"> |
| | | <div |
| | | class="grid-content" |
| | | style="font-weight: bold; font-size: 18px; margin-left: 5%" |
| | | > |
| | | <el-form :rules="routeTypeRules" :model="routerType"> |
| | | <el-form-item label="è·¯ç±ç±»å" label-width="120" prop="type"> |
| | | <el-select |
| | | v-model="routerType.type" |
| | | filterable |
| | | placeholder="è¯·éæ©" |
| | | > |
| | | <el-option |
| | | v-for="item in routerTypes" |
| | | :key="item.key" |
| | | :label="item.value" |
| | | :value="item.key" |
| | | > |
| | | <span style="float: left">{{ item.value }}</span> |
| | | <span |
| | | style="float: right; color: #8492a6; font-size: 13px" |
| | | >{{ item.key }}</span |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <div style="overflow-x: auto"> |
| | | <el-row style="margin-top: 3%"> |
| | | <el-col :span="24"> |
| | | <el-steps align-center :active="routers.length"> |
| | | <el-step |
| | | v-for="(router, index) in routers" |
| | | :title="getTitle(index)" |
| | | :key="index" |
| | | icon="" |
| | | description="111" |
| | | style="min-width: 280px" |
| | | > |
| | | <template v-slot:description="{}"> |
| | | <div> |
| | | <el-form |
| | | :rules="rules" |
| | | class="demo-ruleForm" |
| | | :model="router" |
| | | label-width="110px" |
| | | style="margin-top: 1%" |
| | | ref="router" |
| | | > |
| | | <el-form-item |
| | | label="ä½ç½®ç¼å·" |
| | | placeholder="è¯·éæ©ä½ç½®ç¼å·" |
| | | prop="positionCode" |
| | | > |
| | | <el-select |
| | | filterable |
| | | v-model="router.positionCode" |
| | | @change="deviceCodeChange" |
| | | > |
| | | <el-option |
| | | v-for="deviceCode in filterDeviceCodes" |
| | | :key="deviceCode.key" |
| | | :label="deviceCode.key" |
| | | :value="deviceCode.key" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-show=" |
| | | index == routers.length - 1 && |
| | | !router.positionCode.includes('SC') |
| | | " |
| | | label="åä½ç½®ç¼å·" |
| | | prop="childPositionCode" |
| | | > |
| | | <el-select |
| | | filterable |
| | | v-model="router.childPositionCode" |
| | | @change="childDeviceCodeChange" |
| | | > |
| | | <el-option |
| | | v-for="childDeviceCode in filterChildDeviceCodes" |
| | | :key="childDeviceCode.key" |
| | | :label="childDeviceCode.key" |
| | | :value="childDeviceCode.key" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-show=" |
| | | router.positionCode.includes('SC') || |
| | | router.childPositionCode.includes('SC') |
| | | " |
| | | label="å åæºè¡" |
| | | prop="sCRow" |
| | | > |
| | | <el-input v-model="router.sCRow"></el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-show=" |
| | | router.positionCode.includes('SC') || |
| | | router.childPositionCode.includes('SC') |
| | | " |
| | | label="å åæºå" |
| | | prop="sCColumn" |
| | | > |
| | | <el-input v-model="router.sCColumn"></el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-show=" |
| | | router.positionCode.includes('SC') || |
| | | router.childPositionCode.includes('SC') |
| | | " |
| | | label="å åæºå±" |
| | | prop="sCLayer" |
| | | > |
| | | <el-input v-model="router.sCLayer"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | </el-step> |
| | | </el-steps> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <template #footer> |
| | | <div> |
| | | <el-button plain type="danger" @click="save" |
| | | ><i class="el-icon-check"></i>ä¿ å</el-button |
| | | > |
| | | <el-button type="primary" size="mini" @click="showDetialBox = false" |
| | | ><i class="el-icon-close"></i>å
³é</el-button |
| | | > |
| | | </div> |
| | | </template> |
| | | </vol-box> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | import { el } from "element-plus/es/locale"; |
| | | export default { |
| | | components: { VolBox }, |
| | | data() { |
| | | return { |
| | | width: 1200, |
| | | active: 0, |
| | | showDetialBox: false, |
| | | routerTypes: [], |
| | | routerType: { type: "" }, |
| | | deviceCodes: [], |
| | | filterDeviceCodes: [], |
| | | childDeviceCodes: [], |
| | | filterChildDeviceCodes: [], |
| | | routers: [ |
| | | { |
| | | positionCode: "", |
| | | childPositionCode: "", |
| | | sCRow: "", |
| | | sCColumn: "", |
| | | sCLayer: "", |
| | | }, |
| | | { |
| | | positionCode: "", |
| | | childPositionCode: "", |
| | | sCRow: "", |
| | | sCColumn: "", |
| | | sCLayer: "", |
| | | }, |
| | | ], |
| | | rules: { |
| | | positionCode: [ |
| | | { required: true, message: "è¯·éæ©ä½ç½®ç¼å·", trigger: "change" }, |
| | | ], |
| | | }, |
| | | routeTypeRules: { |
| | | type: [ |
| | | { required: true, message: "è¯·éæ©è·¯ç±ç±»å", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | open() { |
| | | this.routerTypes = []; |
| | | this.routerType = { type: "" }; |
| | | this.deviceCode = ""; |
| | | this.deviceCodes = []; |
| | | this.filterDeviceCodes = []; |
| | | this.childDeviceCodes = []; |
| | | this.filterChildDeviceCodes = []; |
| | | this.routers = [ |
| | | { |
| | | positionCode: "", |
| | | childPositionCode: "", |
| | | sCRow: "", |
| | | sCColumn: "", |
| | | sCLayer: "", |
| | | }, |
| | | { |
| | | positionCode: "", |
| | | childPositionCode: "", |
| | | sCRow: "", |
| | | sCColumn: "", |
| | | sCLayer: "", |
| | | }, |
| | | ]; |
| | | this.showDetialBox = true; |
| | | this.getData(); |
| | | }, |
| | | getData() { |
| | | this.http.post("/api/Router/GetBaseRouterInfo", {}, true).then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.routerTypes = x.data.routerTypes; |
| | | this.deviceCodes = x.data.deviceCodes; |
| | | x.data.areaInfos.forEach((v) => { |
| | | this.deviceCodes.push(v); |
| | | }); |
| | | this.filterDeviceCodes = this.deviceCodes; |
| | | this.childDeviceCodes = this.deviceCodes; |
| | | this.filterChildDeviceCodes = this.deviceCodes; |
| | | }); |
| | | }, |
| | | addNode() { |
| | | this.routers.push({ |
| | | positionCode: "", |
| | | childPositionCode: "", |
| | | childPosiDeviceCode: "", |
| | | sCRow: "", |
| | | sCColumn: "", |
| | | sCLayer: "", |
| | | }); |
| | | }, |
| | | deleteNode() { |
| | | this.routers.splice(this.routers.length - 1, 1); |
| | | }, |
| | | getTitle(index) { |
| | | if (index === 0) { |
| | | return "èµ·ç¹"; |
| | | } else if (index === this.routers.length - 1) { |
| | | return "ç»ç¹"; |
| | | } else { |
| | | return "åèç¹" + index; |
| | | } |
| | | }, |
| | | save() { |
| | | this.$refs.router.forEach((x) => { |
| | | console.log(x); |
| | | x.validate((valid) => { |
| | | if (!valid) { |
| | | return false; |
| | | } |
| | | }); |
| | | }); |
| | | this.http |
| | | .post( |
| | | "/api/Router/AddRouters?routerType=" + this.routerType.type, |
| | | this.routers, |
| | | true |
| | | ) |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.$emit("parentCall", ($vue) => { |
| | | $vue.refresh(); |
| | | }); |
| | | this.showDetialBox = false; |
| | | }); |
| | | }, |
| | | deviceCodeChange(value) { |
| | | var positionCodes = []; |
| | | this.routers.forEach((x) => { |
| | | if (x.positionCode && x.positionCode != "") { |
| | | positionCodes.push(x.positionCode); |
| | | } |
| | | }); |
| | | this.filterDeviceCodes = this.deviceCodes.filter( |
| | | (x) => !positionCodes.includes(x.key) |
| | | ); |
| | | }, |
| | | childDeviceCodeChange(value) { |
| | | var positionCodes = []; |
| | | this.routers.forEach((x) => { |
| | | if (x.childPositionCode && x.childPositionCode != "") { |
| | | positionCodes.push(x.childPositionCode); |
| | | } |
| | | }); |
| | | this.filterChildDeviceCodes = this.childDeviceCodes.filter( |
| | | (x) => !positionCodes.includes(x.key) |
| | | ); |
| | | }, |
| | | }, |
| | | created() {}, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .el-col { |
| | | border-radius: 4px; |
| | | } |
| | | .grid-content { |
| | | border-radius: 4px; |
| | | min-height: 36px; |
| | | } |
| | | .content-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .left-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | } |
| | | .right-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | } |
| | | </style> |
| | | <style> |
| | | .el-step.is-center .el-step__description { |
| | | padding-left: 5%; |
| | | padding-right: 5%; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box |
| | | v-model="showDetialBox" |
| | | :lazy="true" |
| | | width="1200px" |
| | | :padding="15" |
| | | title="宿´è·¯ç±æ¥ç" |
| | | > |
| | | <div |
| | | style="margin-bottom: 1%" |
| | | v-for="(item, index) in routerDatas" |
| | | :key="index" |
| | | > |
| | | <el-row> |
| | | <el-col> |
| | | <div |
| | | class="grid-content right-text" |
| | | style="font-weight: bold; font-size: 18px" |
| | | > |
| | | <span>{{ item.type == "Out" ? "åºåºè·¯ç±" : "å
¥åºè·¯ç±" }}</span> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-steps :active="item.routes.length" align-center simple> |
| | | <el-step |
| | | v-for="itemRouter in item.routes" |
| | | :key="itemRouter" |
| | | :title="itemRouter" |
| | | icon="" |
| | | ></el-step> |
| | | </el-steps> |
| | | </div> |
| | | </vol-box> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | export default { |
| | | components: { VolBox }, |
| | | data() { |
| | | return { |
| | | active: 0, |
| | | showDetialBox: false, |
| | | routerDatas: [], |
| | | }; |
| | | }, |
| | | methods: { |
| | | open() { |
| | | this.showDetialBox = true; |
| | | this.getData(); |
| | | }, |
| | | getData() { |
| | | this.http.post("/api/Router/GetAllWholeRouters", {}, true).then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.routerDatas = x.data; |
| | | }); |
| | | }, |
| | | }, |
| | | created() {}, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .el-col { |
| | | border-radius: 4px; |
| | | } |
| | | .grid-content { |
| | | border-radius: 4px; |
| | | min-height: 36px; |
| | | } |
| | | .content-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .left-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | } |
| | | </style> |
| | | <style> |
| | | .el-table .warning-row { |
| | | background: #fcf1e2; |
| | | } |
| | | |
| | | .el-table .success-row { |
| | | background: #f0f9eb; |
| | | } |
| | | |
| | | .el-table .error-row { |
| | | background: #fde2e2; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridBody from './extend/routerview.vue'; |
| | | import gridHeader from './extend/addrouters.vue'; |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: gridHeader, |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | var viewButton = this.buttons.find((x) => x.value == "ViewAllRouter"); |
| | | if (viewButton) { |
| | | viewButton.onClick = ()=>{ |
| | | this.$refs.gridBody.open(); |
| | | } |
| | | } |
| | | |
| | | var addRoutersButton = this.buttons.find((x) => x.value == "AddRouters"); |
| | | if (addRoutersButton) { |
| | | addRoutersButton.onClick = ()=>{ |
| | | this.$refs.gridHeader.open(); |
| | | } |
| | | } |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | import gridBody from './extend/importDevicePro.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | // console.log(this.detailOptions.buttons); |
| | | // console.log(this.$refs.detail) |
| | | var detailImport = this.detailOptions.buttons.find(item=>item.value == 'import'); |
| | | if(detailImport){ |
| | | detailImport.onClick = function () { |
| | | this.$refs.gridBody.open(); |
| | | } |
| | | } |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | // this.detailOptions.columns.forEach(column=>{ }); |
| | | // console.log(this) |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | }, |
| | | updated() { |
| | | //console.log(this.$refs) |
| | | this.$nextTick(() => { |
| | | if (this.$refs.upload_excel) { |
| | | alert('ç¹å»äºä¸ä¼ æé®') |
| | | this.$refs.upload_excel.upload = function () { |
| | | console.log('ç¹å»äºä¸ä¼ æé®') |
| | | } |
| | | } |
| | | // alert(1) |
| | | }) |
| | | |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box |
| | | v-model="showDetialBox" |
| | | :lazy="true" |
| | | :height="350" |
| | | :width="600" |
| | | :padding="15" |
| | | title="设å¤å议信æ¯-导å
¥" |
| | | > |
| | | <upload-excel |
| | | ref="upload_excel" |
| | | :url="url" |
| | | :template="template" |
| | | ></upload-excel> |
| | | </vol-box> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | import UploadExcel from "@/components/basic/UploadExcel.vue"; |
| | | export default { |
| | | components: { VolBox, UploadExcel }, |
| | | data() { |
| | | return { |
| | | showDetialBox: false, |
| | | url: "", |
| | | template: { |
| | | url: "", //模æ¿ä¸è½½è·¯å¾ï¼å¦ææ²¡ææ¨¡æ¿è·¯å¾ï¼å䏿¾ç¤ºä¸è½½æ¨¡æ¿åè½ |
| | | fileName: "设å¤å议信æ¯å¯¼å
¥æ¨¡æ¿", //ä¸è½½æ¨¡æ¿çæä»¶å |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | open() { |
| | | this.template.url = `${this.http.ipAddress}api/DeviceProtocol/DownLoadTemplate`; |
| | | this.url = `${this.http.ipAddress}api/DeviceProtocol/GetImportData`; |
| | | this.showDetialBox = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.upload_excel.upload = this.upload; |
| | | console.log(this.$refs.upload_excel); |
| | | }); |
| | | }, |
| | | upload() { |
| | | console.log("upload"); |
| | | let _url = this.url; |
| | | if (!_url) { |
| | | return this.$Message.error("没æé
置好Url"); |
| | | } |
| | | |
| | | if (!this.$refs.upload_excel.file) { |
| | | return this.$Message.error("è¯·éæ©æä»¶"); |
| | | } |
| | | var formData = new FormData(); |
| | | formData.append("fileInput", this.$refs.upload_excel.file); |
| | | if (!this.$refs.upload_excel.importExcelBefore(formData)) { |
| | | return; |
| | | } |
| | | this.$refs.upload_excel.loadingStatus = true; |
| | | this.http.post(_url, formData).then( |
| | | (x) => { |
| | | // this.$refs.uploadFile.clearFiles(); |
| | | this.$refs.upload_excel.loadingStatus = false; |
| | | this.$refs.upload_excel.file = null; |
| | | if (x.status) { |
| | | this.$emit("parentCall", ($vue) => { |
| | | $vue.$refs.detail.rowData.push(...x.data); |
| | | }); |
| | | } |
| | | |
| | | this.message = x.message; |
| | | this.resultClass = x.status ? "v-r-success" : "v-r-error"; |
| | | }, |
| | | (error) => { |
| | | this.$refs.upload_excel.loadingStatus = false; |
| | | } |
| | | ); |
| | | }, |
| | | }, |
| | | created() {}, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .el-col { |
| | | border-radius: 4px; |
| | | } |
| | | .grid-content { |
| | | border-radius: 4px; |
| | | min-height: 36px; |
| | | } |
| | | .content-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .left-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | } |
| | | </style> |
| | | <style> |
| | | .el-table .warning-row { |
| | | background: #fcf1e2; |
| | | } |
| | | |
| | | .el-table .success-row { |
| | | background: #f0f9eb; |
| | | } |
| | | |
| | | .el-table .error-row { |
| | | background: #fde2e2; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { h, resolveComponent } from 'vue'; |
| | | let extension = { |
| | | components: { //卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | //æ©å±ç»ä»¶å¼å
¥æ¹å¼ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | buttons: [], //æ©å±çæé® |
| | | methods: { //äºä»¶æ©å± |
| | | onInit() { |
| | | //ç¹å»åå
æ ¼ç¼è¾ä¸ç»æç¼è¾(é»è®¤æ¯ç¹å»åå
æ ¼ç¼è¾ï¼é¼ æ 离å¼ç»æç¼è¾) |
| | | this.detailOptions.clickEdit = true; |
| | | this.editFormOptions.forEach(x => { |
| | | x.forEach(item => { |
| | | if (item.field == 'ParentId') { |
| | | item.min = 0; |
| | | } |
| | | if (item.field == "DbSql") { |
| | | item.placeholder = "妿仿°æ®åºå è½½æ°æ®æºï¼è¯·ææ¤æ ¼å¼é
ç½®sqlè¯å¥ï¼select orderType as key,orderName as value from order 妿éè¦æ ¹æ®ç¨æ·ä¿¡æ¯å è½½æ°æ®æºï¼è¯·é
置好æ¤sql,åä¿®æ¹åå°DictionaryHandler.GetCustomDBSqlæ¹æ³"; |
| | | } |
| | | }) |
| | | }) |
| | | this.detailOptions.columns.forEach(x => { |
| | | if (x.field == 'OrderNo') { |
| | | x.summary = true; |
| | | } |
| | | }) |
| | | //ä¿ååä¸å
³éç¼è¾æ¡ |
| | | this.boxOptions.saveClose = false; |
| | | }, |
| | | onInited() { |
| | | this.boxOptions.height = document.body.clientHeight * 0.87 |
| | | this.height = this.height - 45; |
| | | }, |
| | | addBefore(formData) { |
| | | return this.saveBefore(formData); |
| | | }, |
| | | updateBefore(formData) { |
| | | return this.saveBefore(formData); |
| | | }, |
| | | saveBefore(formData) { |
| | | if (this.editFormFields.DbSql && |
| | | (this.editFormFields.DbSql.indexOf('value') == -1 || |
| | | this.editFormFields.DbSql.indexOf('key') == -1) |
| | | ) { |
| | | this.$message.error("sqlè¯å¥å¿
é¡»å
æ¬key/valueåæ®µ,å¦:select orderType as key,orderName as value from order"); |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | searchBefore(param) { |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | return true; |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | |
| | | let extension = { |
| | | components: {//卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader:'', |
| | | gridbody:'', |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | buttons: [],//æ©å±çæé® |
| | | methods: {//äºä»¶æ©å± |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { h, resolveComponent } from 'vue'; |
| | | let extension = { |
| | | components: { |
| | | //卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader: "", //{ template: "<div>æ©å±ç»xxä»¶</div>" }, |
| | | gridBody: '', |
| | | gridFooter: "", |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: "", |
| | | modelBody: "", |
| | | modelFooter: "" |
| | | }, |
| | | buttons: [], //æ©å±çæé® |
| | | methods: { |
| | | //äºä»¶æ©å± |
| | | onInit() { |
| | | console.log("sys_log") |
| | | this.setFiexdSearchForm(true); |
| | | }, |
| | | onInited() { |
| | | this.height = this.height - 170; |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | let extension = { |
| | | components: {//卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | buttons: [],//æ©å±çæé® |
| | | tableAction:"Sys_Role", |
| | | methods: {//äºä»¶æ©å± |
| | | onInited () { |
| | | this.height = this.height - 80; |
| | | this.editFormOptions.forEach(x => { |
| | | x.forEach(item => { |
| | | if (item.field == 'ParentId') { |
| | | item.title = "ä¸çº§è§è²"; |
| | | //设置任æèç¹é½è½éä¸(é»è®¤åªè½é䏿åä¸ä¸ªèç¹) |
| | | item.changeOnSelect = true; |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | onInit() { |
| | | //设置treetableçå¯ä¸å¼å段(è¿ä¸ªå段çå¼å¨è¡¨éé¢å¿
é¡»æ¯å¯ä¸ç) |
| | | this.rowKey="Role_Id"; |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | loadTreeChildren(tree, treeNode, resolve) { //å è½½åèç¹ |
| | | let url=`api/role/getTreeTableChildrenData?roleId=${tree.Role_Id}`; |
| | | this.http.post(url,{}).then(result=>{ |
| | | resolve(result.rows) |
| | | }) |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | searchBefore(params){//夿å è½½æ ¹èç¹æåèç¹ |
| | | //æ²¡ææ¥è¯¢æ¡ä»¶ï¼é»è®¤æ¥è¯¢è¿åæææ ¹èç¹æ°æ® |
| | | if (!params.wheres.length) { |
| | | params.value=1; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | import { h, resolveComponent } from 'vue'; |
| | | let extension = { |
| | | components: {//卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: { |
| | | render () { |
| | | return [ |
| | | h(resolveComponent('el-alert'), { |
| | | style: { 'margin-bottom': '12px' }, |
| | | 'show-icon': true, type: 'error', |
| | | closable: false, title: 'å
³äºTreeTable使ç¨' |
| | | }, ' treetableåæ ·å
¨é¨ä»£ç èªå¨çæï¼é¡µé¢çæå设置this.rowKe="xxx" tree主é®å段,å³å¯å®ææ å½¢tableé
ç½®,å
·ä½è¯´æè§Sys_Role1.js'), |
| | | ] |
| | | } |
| | | }, |
| | | |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | buttons: [],//æ©å±çæé® |
| | | tableAction:"Sys_Role", |
| | | methods: {//äºä»¶æ©å± |
| | | onInited () { |
| | | this.height = this.height - 80; |
| | | this.editFormOptions.forEach(x => { |
| | | x.forEach(item => { |
| | | if (item.field == 'ParentId') { |
| | | item.title = "ä¸çº§è§è²"; |
| | | //设置任æèç¹é½è½éä¸(é»è®¤åªè½é䏿åä¸ä¸ªèç¹) |
| | | item.changeOnSelect = true; |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | onInit() { |
| | | //设置treetableçå¯ä¸å¼å段(è¿ä¸ªå段çå¼å¨è¡¨éé¢å¿
é¡»æ¯å¯ä¸ç) |
| | | this.rowKey="Role_Id"; |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | loadTreeChildren(tree, treeNode, resolve) { //å è½½åèç¹ |
| | | let url=`api/role/getTreeTableChildrenData?roleId=${tree.Role_Id}`; |
| | | this.http.post(url,{}).then(result=>{ |
| | | resolve(result.rows) |
| | | }) |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | searchBefore(params){//夿å è½½æ ¹èç¹æåèç¹ |
| | | //æ²¡ææ¥è¯¢æ¡ä»¶ï¼é»è®¤æ¥è¯¢è¿åæææ ¹èç¹æ°æ® |
| | | if (!params.wheres.length) { |
| | | params.value=1; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { defineAsyncComponent } from "vue"; |
| | | let extension = { |
| | | components: { //卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader: defineAsyncComponent(() => |
| | | import("./Sys_User/Sys_UserGridHeader.vue")), |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | text: "åªè½çå°å½åè§è²ä¸çææå¸å·", |
| | | buttons: [], //æ©å±çæé® |
| | | methods: { //äºä»¶æ©å± |
| | | onInit() { |
| | | this.boxOptions.height = 530; |
| | | this.columns.push({ |
| | | title: 'æä½', |
| | | hidden: false, |
| | | align: "center", |
| | | fixed: 'right', |
| | | width: 120, |
| | | render: (h, { row, column, index }) => { |
| | | return h( |
| | | "div", { style: { 'font-size': '13px', 'cursor': 'pointer', 'color': '#409eff' } }, [ |
| | | h( |
| | | "a", { |
| | | style: { 'margin-right': '15px' }, |
| | | onClick: (e) => { |
| | | e.stopPropagation() |
| | | this.$refs.gridHeader.open(row); |
| | | } |
| | | }, "ä¿®æ¹å¯ç " |
| | | ), |
| | | h( |
| | | "a", { |
| | | style: {}, |
| | | onClick: (e) => { |
| | | e.stopPropagation() |
| | | this.edit(row); |
| | | } |
| | | }, |
| | | "ç¼è¾" |
| | | ), |
| | | ]) |
| | | } |
| | | }) |
| | | }, |
| | | onInited() { }, |
| | | addAfter(result) { //ç¨æ·æ°å»ºåï¼æ¾ç¤ºéæºçæçå¯ç |
| | | if (!result.status) { |
| | | return true; |
| | | } |
| | | //æ¾ç¤ºæ°å»ºç¨æ·çå¯ç |
| | | //2020.08.28ä¼åæ°å»ºæåæç¤ºæ¹å¼ |
| | | this.$confirm(result.message, 'æ°å»ºç¨æ·æå', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | type: 'success', |
| | | center: true |
| | | }).then(() => { }) |
| | | |
| | | this.boxModel = false; |
| | | this.refresh(); |
| | | return false; |
| | | }, |
| | | modelOpenAfter() { |
| | | //ç¹å»å¼¹åºæ¡åï¼å¦ææ¯ç¼è¾ç¶æï¼ç¦æ¢ç¼è¾ç¨æ·åï¼å¦ææ°å»ºç¶æï¼å°ç¨æ·ååæ®µè®¾ç½®ä¸ºå¯ç¼è¾ |
| | | let isEDIT = this.currentAction == this.const.EDIT; |
| | | this.editFormOptions.forEach(item => { |
| | | item.forEach(x => { |
| | | if (x.field == "UserName") { |
| | | x.disabled=isEDIT; |
| | | } |
| | | }) |
| | | //䏿¯æ°å»ºï¼æ§å«é»è®¤å¼è®¾ç½®ä¸ºç· |
| | | if (!isEDIT) { |
| | | this.editFormFields.Gender = "0"; |
| | | } |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box |
| | | v-model="model" |
| | | :padding="30" |
| | | title="ä¿®æ¹å¯ç " |
| | | :width="500" |
| | | :height="250" |
| | | > |
| | | <el-alert type="success"> |
| | | <h3> |
| | | <span>å¸å·ï¼{{ row.userName }}</span> |
| | | <span>ç¨æ·ï¼{{ row.userTrueName }}</span> |
| | | </h3> |
| | | </el-alert> |
| | | <div> |
| | | <el-input |
| | | placeholder="请è¾å
¥å¯ç " |
| | | v-model="password" |
| | | size="large" |
| | | style="width: 100%; margin-top: 15px" |
| | | /> |
| | | </div> |
| | | <template #footer> |
| | | <el-button |
| | | type="primary" |
| | | @click="savePwd()" |
| | | >ä¿®æ¹å¯ç </el-button |
| | | > |
| | | <el-button |
| | | @click="model = false" |
| | | >å
³é</el-button |
| | | > |
| | | </template> |
| | | </vol-box> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { defineComponent, defineAsyncComponent } from "vue"; |
| | | export default defineComponent({ |
| | | components: { |
| | | VolBox: defineAsyncComponent(() => import("@/components/basic/VolBox.vue")) |
| | | }, |
| | | data() { |
| | | return { |
| | | row: {}, |
| | | password: "", |
| | | model: false, |
| | | }; |
| | | }, |
| | | methods: { |
| | | open(row) { |
| | | this.password = ""; |
| | | this.row = row; |
| | | this.model = true; |
| | | }, |
| | | savePwd() { |
| | | if (!this.password) return this.$Message.error("请è¾å¯ç "); |
| | | if (this.password.length < 6) |
| | | return this.$Message.error("å¯ç é¿åº¦è³å°6ä½"); |
| | | let url = |
| | | "/api/user/modifyUserPwd?password=" + |
| | | this.password + |
| | | "&userName=" + |
| | | this.row.UserName; |
| | | this.http.post(url, {}, true).then((x) => { |
| | | if (!x.status) { |
| | | return this.$message.error(x.message); |
| | | } |
| | | this.model = false; |
| | | this.$Message.success(x.message); |
| | | }); |
| | | }, |
| | | }, |
| | | created() {}, |
| | | }) |
| | | </script> |
| | | <style lang="less" scoped> |
| | | h3 { |
| | | font-weight: 500; |
| | | > span:last-child { |
| | | margin-left: 30px; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /***************************************************************************************** |
| | | ** Author:jxx 2022 |
| | | ** QQ:283591387 |
| | | **宿´ææ¡£è§ï¼http://v2.volcore.xyz/document/api ã代ç çæé¡µé¢ViewGridã |
| | | **常ç¨ç¤ºä¾è§ï¼http://v2.volcore.xyz/document/vueDev |
| | | **åå°æä½è§ï¼http://v2.volcore.xyz/document/netCoreDev |
| | | *****************************************************************************************/ |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { //æ¡æ¶åå§åé
ç½®åï¼ |
| | | this.rowKey = "DepartmentId"; |
| | | }, |
| | | loadTreeChildren(tree, treeNode, resolve) { //å è½½åèç¹ |
| | | let url = `api/Sys_Department/getTreeTableChildrenData?departmentId=${tree.DepartmentId}`; |
| | | this.http.post(url, {}).then(result => { |
| | | resolve(result.rows) |
| | | }) |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | searchBefore(params) {//夿å è½½æ ¹èç¹æåèç¹ |
| | | //æ²¡ææ¥è¯¢æ¡ä»¶ï¼é»è®¤æ¥è¯¢è¿åæææ ¹èç¹æ°æ® |
| | | if (!params.wheres.length) { |
| | | params.value = 1; |
| | | } |
| | | return true; |
| | | }, |
| | | onInited() { |
| | | let hasUpdate, hasDel, hasAdd; |
| | | this.buttons.forEach((x) => { |
| | | if (x.value == 'Update') { |
| | | x.hidden = true; |
| | | hasUpdate = true; |
| | | } else if (x.value == 'Delete') { |
| | | hasDel = true; |
| | | x.hidden = true;//éèæé® |
| | | } |
| | | else if (x.value == 'Add') { |
| | | x.type="primary"; |
| | | hasAdd = true; |
| | | } |
| | | }); |
| | | if (!(hasUpdate || hasDel || hasAdd)) { |
| | | return; |
| | | } |
| | | this.columns.push({ |
| | | title: 'æä½', |
| | | field: 'æä½', |
| | | width: 80, |
| | | fixed: 'right', |
| | | align: 'center', |
| | | render: (h, { row, column, index }) => { |
| | | return ( |
| | | <div> |
| | | <el-button |
| | | onClick={($e) => { |
| | | this.addBtnClick(row) |
| | | }} |
| | | type="primary" |
| | | link |
| | | v-show={hasAdd} |
| | | icon="Plus" |
| | | > |
| | | </el-button> |
| | | <el-button |
| | | onClick={($e) => { |
| | | this.edit(row); |
| | | }} |
| | | type="success" |
| | | link |
| | | v-show={hasUpdate} |
| | | icon="Edit" |
| | | > |
| | | </el-button> |
| | | <el-tooltip |
| | | class="box-item" |
| | | effect="dark" |
| | | content="å é¤" |
| | | placement="top" |
| | | > |
| | | <el-button |
| | | link |
| | | onClick={($e) => { |
| | | this.del(row); |
| | | }} |
| | | v-show={hasDel} |
| | | type="danger" |
| | | icon="Delete" |
| | | > |
| | | </el-button> |
| | | </el-tooltip> |
| | | </div> |
| | | ); |
| | | } |
| | | }); |
| | | }, |
| | | addBtnClick(row) { |
| | | //è¿éæ¯å¨æaddCurrnetRow屿§è®°å½å½åç¹å»çè¡æ°æ®,ä¸é¢modelOpenAfter设置é»è®¤å¼ |
| | | this.addCurrnetRow = row; |
| | | this.add(); |
| | | }, |
| | | addAfter() {//æ·»å åå·æ°åå
¸ |
| | | this.initDicKeys(); |
| | | return true; |
| | | }, |
| | | updateAfter() { |
| | | this.initDicKeys(); |
| | | return true; |
| | | }, |
| | | delAfter(result) {//æ¥è¯¢çé¢ç表å é¤å |
| | | this.initDicKeys(); |
| | | return true; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»è¡ä¸çæ·»å æé®äºä»¶ |
| | | if (this.addCurrnetRow) { |
| | | |
| | | //è·åå½åç»ç»ææ¶çææç¶çº§id,ç¨äºè®¾ç½®æ°å»ºæ¶ç¶çº§idçé»è®¤å¼ |
| | | |
| | | //è·åæ°æ®æ°æ®æº |
| | | let data = []; |
| | | this.editFormOptions.forEach(options => { |
| | | options.forEach(option => { |
| | | if (option.field == 'ParentId') { |
| | | data = option.orginData; |
| | | } |
| | | }) |
| | | }) |
| | | let parentIds = this.base.getTreeAllParent(this.addCurrnetRow.DepartmentId, data).map(x => { return x.id }); |
| | | //设置ç¼è¾è¡¨åä¸çº§ç»ç»çé»è®¤å¼ |
| | | this.editFormFields.ParentId = parentIds; |
| | | this.addCurrnetRow = null; |
| | | |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box |
| | | v-model="showDetialBox" |
| | | :lazy="true" |
| | | width="1200px" |
| | | :padding="15" |
| | | title="ä»»å¡è¯¦æ
" |
| | | > |
| | | <el-row height="50"> |
| | | <el-col :span="24"> |
| | | <div class="grid-content right-text"> |
| | | <el-link type="primary" @click="switchView" v-if="false">忢è§å¾</el-link> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <div :style="{ height: height }"> |
| | | <div v-if="viewType == 1"> |
| | | <el-row height="50"> |
| | | <el-col :span="8"> |
| | | <div |
| | | class="grid-content content-text" |
| | | style="font-weight: bold; font-size: 18px" |
| | | > |
| | | <span>ä»»å¡ç¼å·ï¼{{ row.taskNum }}</span> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <div |
| | | class="grid-content content-text" |
| | | style="font-weight: bold; font-size: 18px" |
| | | > |
| | | <span>æçç¼å·ï¼{{ row.palletCode }}</span> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <div |
| | | class="grid-content content-text" |
| | | style="font-weight: bold; font-size: 18px" |
| | | > |
| | | <span>ä»»å¡ç¶æï¼{{ row.taskState }}</span> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <div style="height: 100px; margin-top: 3%"> |
| | | <el-steps :active="active" align-center finish-status="success"> |
| | | <el-step |
| | | v-for="item in steps" |
| | | :key="item.title" |
| | | :title="item.title" |
| | | :description="item.description" |
| | | ></el-step> |
| | | </el-steps> |
| | | </div> |
| | | <el-row height="50" v-show="previousShow || nextShow"> |
| | | <el-col :span="8"> |
| | | <div v-show="previousShow" class="grid-content content-text"> |
| | | <el-button type="danger" @click="previous" |
| | | >åæ»å°ä¸ä¸æ¥</el-button |
| | | > |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <div v-show="recoveryShow" class="grid-content content-text"> |
| | | <el-button type="primary" @click="recovery">ä»»å¡æèµ·æ¢å¤</el-button> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <div v-show="nextShow" class="grid-content content-text"> |
| | | <el-button type="warning" @click="next">跳转å°ä¸ä¸æ¥</el-button> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div v-else> |
| | | <el-table |
| | | :data="tableData" |
| | | style="width: 100%" |
| | | :row-class-name="tableRowClassName" |
| | | > |
| | | <el-table-column type="index" width="50"> </el-table-column> |
| | | <el-table-column prop="taskNum" label="ä»»å¡å·" width="90"> |
| | | </el-table-column> |
| | | <el-table-column prop="taskState" label="ä»»å¡ç¶æ" width="90"> |
| | | </el-table-column> |
| | | <el-table-column prop="currentAddress" label="å½åä½ç½®" width="90"> |
| | | </el-table-column> |
| | | <el-table-column prop="nextAddress" label="ä¸ä¸ä½ç½®" width="90"> |
| | | </el-table-column> |
| | | <el-table-column prop="isManual" label="æ¯å¦äººå·¥æä½" width="120"> |
| | | </el-table-column> |
| | | <el-table-column prop="isNormal" label="æ¯å¦æ£å¸¸" width="90"> |
| | | </el-table-column> |
| | | <el-table-column prop="description" label="æè¿°"> </el-table-column> |
| | | <el-table-column prop="createDate" label="å建æ¶é´" width="180"> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="夿³¨" width="180"> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | </vol-box> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | export default { |
| | | components: { VolBox }, |
| | | data() { |
| | | return { |
| | | active: 0, |
| | | showDetialBox: false, |
| | | row: {}, |
| | | steps: [], |
| | | viewType: 2, |
| | | height: "200px", |
| | | tableData: [], |
| | | previousShow: false, |
| | | nextShow: false, |
| | | recoveryShow: true, |
| | | }; |
| | | }, |
| | | methods: { |
| | | open(row) { |
| | | this.row = row; |
| | | this.showDetialBox = true; |
| | | if (this.viewType == 1) { |
| | | this.getSteps(); |
| | | } else { |
| | | this.getDetailDatas(); |
| | | } |
| | | |
| | | this.$emit("parentCall", ($vue) => { |
| | | var previousButton = $vue.buttons.find((x) => x.value == "Previous"); |
| | | this.previousShow = previousButton != null; |
| | | |
| | | var nextButton = $vue.buttons.find((x) => x.value == "Next"); |
| | | this.nextShow = nextButton != null; |
| | | }); |
| | | }, |
| | | getSteps() { |
| | | this.http |
| | | .post( |
| | | "/api/TaskExecuteDetail/GetDetailInfo?taskNum=" + this.row.taskNum, |
| | | {}, |
| | | true |
| | | ) |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.steps = x.data.list; |
| | | this.active = x.data.active; |
| | | }); |
| | | }, |
| | | getDetailDatas() { |
| | | this.http |
| | | .post( |
| | | "/api/TaskExecuteDetail/GetDetailDatas?taskNum=" + this.row.taskNum, |
| | | {}, |
| | | true |
| | | ) |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.tableData = x.data; |
| | | }); |
| | | }, |
| | | previous() { |
| | | this.http |
| | | .post( |
| | | "/api/Task/RollbackTaskStatusToLast?taskNum=" + this.row.taskNum, |
| | | {}, |
| | | true |
| | | ) |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.getSteps(); |
| | | }); |
| | | }, |
| | | recovery(){ |
| | | this.http |
| | | .post( |
| | | "/api/Task/TaskStatusRecovery?taskNum=" + this.row.taskNum, |
| | | {}, |
| | | true |
| | | ) |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.getSteps(); |
| | | }); |
| | | }, |
| | | next() { |
| | | this.http |
| | | .post( |
| | | "/api/Task/UpdateTaskStatusToNext?taskNum=" + this.row.taskNum, |
| | | {}, |
| | | true |
| | | ) |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.getSteps(); |
| | | }); |
| | | }, |
| | | switchView() { |
| | | this.viewType = this.viewType == 1 ? 2 : 1; |
| | | if (this.viewType == 2) { |
| | | this.height = "600px"; |
| | | this.getDetailDatas(); |
| | | } else { |
| | | this.height = "200px"; |
| | | } |
| | | }, |
| | | tableRowClassName({ row, rowIndex }) { |
| | | if (!row.isNormal) { |
| | | return "error-row"; |
| | | } else if (row.isManual) { |
| | | return "warning-row"; |
| | | } |
| | | return "success-row"; |
| | | }, |
| | | }, |
| | | created() {}, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .el-col { |
| | | border-radius: 4px; |
| | | } |
| | | .grid-content { |
| | | border-radius: 4px; |
| | | min-height: 36px; |
| | | } |
| | | .content-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .right-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | } |
| | | </style> |
| | | <style> |
| | | .el-table .warning-row { |
| | | background: #fcf1e2; |
| | | } |
| | | |
| | | .el-table .success-row { |
| | | background: #f0f9eb; |
| | | } |
| | | |
| | | .el-table .error-row { |
| | | background: #fde2e2; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridBody from './extend/taskExecuteDetail.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | // this.$Notice.success({ title: this.detailOptions.cnName + ',æ¥è¯¢ç»æ', desc: 'è¿åç对象ï¼' + JSON.stringify(data) }); |
| | | |
| | | var previousButton = this.buttons.find((x) => x.value == "Previous"); |
| | | if (previousButton) previousButton.hidden = true; |
| | | var nextButton = this.buttons.find((x) => x.value == "Next"); |
| | | if (nextButton) nextButton.hidden = true; |
| | | var recoveryButton = this.buttons.find((x) => x.value == "TaskRecovery"); |
| | | if (recoveryButton) recoveryButton.hidden = true; |
| | | |
| | | //æ©å±é¡µé¢åå§åæä½ |
| | | this.columns.push({ |
| | | field: 'æä½', |
| | | title: 'æä½', |
| | | width: 70, |
| | | fixed: 'right', |
| | | align: 'center', |
| | | formatter: (row) => { |
| | | return ( |
| | | '<i style="cursor: pointer;color: #2d8cf0;"class="el-icon-view">æ¥ç</i>' |
| | | ); |
| | | }, |
| | | click: (row) => { |
| | | this.$refs.gridBody.open(row); |
| | | } |
| | | },); |
| | | |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box |
| | | v-model="showDetialBox" |
| | | :lazy="true" |
| | | width="1500px" |
| | | :padding="15" |
| | | title="è´§ä½ç¶æåå¨è®°å½" |
| | | > |
| | | <div class="box-table" style="margin-top: 1%"> |
| | | <el-table |
| | | ref="singleTable" |
| | | :data="tableData" |
| | | style="width: 100%; height: 100%" |
| | | highlight-current-row |
| | | @row-click="handleRowClick" |
| | | height="500px" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | > |
| | | <!-- <el-table-column type="selection" width="55"> </el-table-column> --> |
| | | <el-table-column |
| | | label="åºå·" |
| | | type="index" |
| | | fixed="left" |
| | | width="55" |
| | | align="center" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | v-for="(item, index) in tableColumns.filter((x) => !x.hidden)" |
| | | :key="index" |
| | | :prop="item.field" |
| | | :label="item.title" |
| | | :width="item.width" |
| | | align="center" |
| | | > |
| | | <template #default="scoped"> |
| | | <div v-if="item.type == 'icon'"> |
| | | <el-tooltip |
| | | class="item" |
| | | effect="dark" |
| | | :content="item.title" |
| | | placement="bottom" |
| | | ><el-button |
| | | type="text" |
| | | @click="tableButtonClick(scoped.row, item)" |
| | | ><i |
| | | :class="item.icon" |
| | | style="font-size: 22px" |
| | | ></i></el-button |
| | | ></el-tooltip> |
| | | </div> |
| | | <div v-else-if="item.type == 'tag'"> |
| | | <el-tag size="small"> |
| | | {{ getDictionary(scoped.row, item) }} |
| | | </el-tag> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </vol-box> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | export default { |
| | | components: { VolBox }, |
| | | data() { |
| | | return { |
| | | showDetialBox: false, |
| | | row: null, |
| | | tableData: [], |
| | | tableColumns: [ |
| | | { |
| | | field: "locationId", |
| | | title: "è´§ä½ä¸»é®", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "locationCode", |
| | | title: "è´§ä½ç¼å·", |
| | | type: "string", |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "beforeStatus", |
| | | title: "åå¨åè´§ä½ç¶æ", |
| | | type: "tag", |
| | | width: 150, |
| | | align: "left", |
| | | bindKey: "locationStatusEnum", |
| | | }, |
| | | { |
| | | field: "afterStatus", |
| | | title: "åå¨åè´§ä½ç¶æ", |
| | | type: "tag", |
| | | width: 150, |
| | | align: "left", |
| | | bindKey: "locationStatusEnum", |
| | | }, |
| | | { |
| | | field: "changeType", |
| | | title: "åå¨ç±»å", |
| | | type: "tag", |
| | | width: 100, |
| | | align: "left", |
| | | bindKey: "locationChangeType", |
| | | }, |
| | | { |
| | | field: "orderId", |
| | | title: "忮䏻é®", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "orderNo", |
| | | title: "åæ®ç¼å·", |
| | | type: "int", |
| | | width: 160, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "orderDetailId", |
| | | title: "åæ®æç»ä¸»é®", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "taskNum", |
| | | title: "ä»»å¡å·", |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "creater", |
| | | title: "å建人", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "createDate", |
| | | title: "å建æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | sort: true, |
| | | }, |
| | | { |
| | | field: "modifier", |
| | | title: "ä¿®æ¹äºº", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "modifyDate", |
| | | title: "ä¿®æ¹æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | hidden: true, |
| | | sort: true, |
| | | }, |
| | | { |
| | | field: "remark", |
| | | title: "夿³¨", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | ], |
| | | paginations: { |
| | | sort: "CreateDate", |
| | | order: "desc", |
| | | Foots: "", |
| | | total: 0, |
| | | // 2020.08.29å¢å èªå®ä¹å页æ¡å¤§å° |
| | | sizes: [30, 60, 100, 120], |
| | | size: 30, // é»è®¤åé¡µå¤§å° |
| | | Wheres: [], |
| | | page: 1, |
| | | rows: 30, |
| | | }, |
| | | dictionaryList: null, |
| | | }; |
| | | }, |
| | | methods: { |
| | | open(row) { |
| | | this.row = row; |
| | | this.showDetialBox = true; |
| | | this.getDetailData(); |
| | | this.getDictionaryData(); |
| | | }, |
| | | getDetailData() { |
| | | this.http |
| | | .post( |
| | | "/api/LocationStatusChangeRecord/GetLocationState?id=" + this.row.id, |
| | | {}, |
| | | true |
| | | ) |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.tableData = x.data; |
| | | }); |
| | | }, |
| | | getDictionaryData() { |
| | | if (this.dictionaryList) { |
| | | return; |
| | | } |
| | | var param = []; |
| | | this.tableColumns.forEach((x) => { |
| | | if (x.type == "tag" && x.bindKey != "") { |
| | | param.push(x.bindKey); |
| | | } |
| | | }); |
| | | this.http |
| | | .post("api/Sys_Dictionary/GetVueDictionary", param, "æ¥è¯¢ä¸") |
| | | .then((x) => { |
| | | if (x.length > 0) { |
| | | this.dictionaryList = x; |
| | | } |
| | | }); |
| | | }, |
| | | getDictionary(row, column) { |
| | | if (this.dictionaryList) { |
| | | var item = this.dictionaryList.find((x) => x.dicNo == column.bindKey); |
| | | if (item) { |
| | | var dicItem = item.data.find((x) => x.key == row[column.field]); |
| | | console.log(dicItem); |
| | | if (dicItem) { |
| | | return dicItem.value; |
| | | } else { |
| | | return row[column.field]; |
| | | } |
| | | } else { |
| | | return row[column.field]; |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | |
| | | created() {}, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .el-col { |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .grid-content { |
| | | border-radius: 4px; |
| | | min-height: 36px; |
| | | } |
| | | |
| | | .content-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .right-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | } |
| | | </style> |
| | | <style> |
| | | .el-table .warning-row { |
| | | background: #e6a23c; |
| | | } |
| | | |
| | | .el-table .success-row { |
| | | background: #f0f9eb; |
| | | } |
| | | |
| | | .el-table .error-row { |
| | | background: #f56c6c; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridBody from './extend/GetLocationStatus.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | let EnableBtn = this.buttons.find(x => x.value == 'Enable'); |
| | | if (EnableBtn) { |
| | | EnableBtn.onClick = function () { |
| | | let rows = this.$refs.table.getSelected(); |
| | | if (rows.length == 0) return this.$error("è¯·éæ©æ°æ®!"); |
| | | var keys = rows.map(x => { return x.id }); |
| | | this.http |
| | | .post("api/LocationInfo/LocationEnableStatus", keys, "æ°æ®å¤çä¸") |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.refresh(); |
| | | }); |
| | | } |
| | | } |
| | | let DisableBtn = this.buttons.find(x => x.value == 'Disable'); |
| | | if (DisableBtn) { |
| | | DisableBtn.onClick = function () { |
| | | let rows = this.$refs.table.getSelected(); |
| | | if (rows.length == 0) return this.$error("è¯·éæ©æ°æ®!"); |
| | | var keys = rows.map(x => { return x.id }); |
| | | this.http |
| | | .post("api/LocationInfo/LocationDisableStatus", keys, "æ°æ®å¤çä¸") |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.refresh(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | this.columns.push({ |
| | | field: 'æä½', |
| | | title: 'æä½', |
| | | width: 90, |
| | | fixed: 'right', |
| | | align: 'center', |
| | | formatter: (row) => { |
| | | return ( |
| | | '<i style="cursor: pointer;color: #2d8cf0;"class="el-icon-view">æ¥çæç»</i>' |
| | | ); |
| | | }, |
| | | click: (row) => { |
| | | this.$refs.gridBody.open(row); |
| | | } |
| | | }); |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /***************************************************************************************** |
| | | ** Author:jxx 2022 |
| | | ** QQ:283591387 |
| | | **宿´ææ¡£è§ï¼http://v2.volcore.xyz/document/api ã代ç çæé¡µé¢ViewGridã |
| | | **常ç¨ç¤ºä¾è§ï¼http://v2.volcore.xyz/document/vueDev |
| | | **åå°æä½è§ï¼http://v2.volcore.xyz/document/netCoreDev |
| | | *****************************************************************************************/ |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { //æ¡æ¶åå§åé
ç½®åï¼ |
| | | //示ä¾ï¼å¨æé®çæå颿·»å ä¸ä¸ªæé® |
| | | // this.buttons.unshift({ //ä¹å¯ä»¥ç¨pushæè
spliceæ¹æ³æ¥ä¿®æ¹buttonsæ°ç» |
| | | // name: 'æé®', //æé®åç§° |
| | | // icon: 'el-icon-document', //æé®å¾æ vue2çæ¬è§iviewææ¡£iconï¼vue3çæ¬è§element uiææ¡£icon(注æä¸æ¯element pulsææ¡£) |
| | | // type: 'primary', //æé®æ ·å¼vue2çæ¬è§iviewææ¡£buttonï¼vue3çæ¬è§element uiææ¡£button |
| | | // onClick: function () { |
| | | // this.$Message.success('ç¹å»äºæé®'); |
| | | // } |
| | | // }); |
| | | |
| | | //示ä¾ï¼è®¾ç½®ä¿®æ¹æ°å»ºãç¼è¾å¼¹åºæ¡å段æ ç¾çé¿åº¦ |
| | | // this.boxOptions.labelWidth = 150; |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /***************************************************************************************** |
| | | ** Author:jxx 2022 |
| | | ** QQ:283591387 |
| | | **宿´ææ¡£è§ï¼http://v2.volcore.xyz/document/api ã代ç çæé¡µé¢ViewGridã |
| | | **常ç¨ç¤ºä¾è§ï¼http://v2.volcore.xyz/document/vueDev |
| | | **åå°æä½è§ï¼http://v2.volcore.xyz/document/netCoreDev |
| | | *****************************************************************************************/ |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { //æ¡æ¶åå§åé
ç½®åï¼ |
| | | //示ä¾ï¼å¨æé®çæå颿·»å ä¸ä¸ªæé® |
| | | // this.buttons.unshift({ //ä¹å¯ä»¥ç¨pushæè
spliceæ¹æ³æ¥ä¿®æ¹buttonsæ°ç» |
| | | // name: 'æé®', //æé®åç§° |
| | | // icon: 'el-icon-document', //æé®å¾æ vue2çæ¬è§iviewææ¡£iconï¼vue3çæ¬è§element uiææ¡£icon(注æä¸æ¯element pulsææ¡£) |
| | | // type: 'primary', //æé®æ ·å¼vue2çæ¬è§iviewææ¡£buttonï¼vue3çæ¬è§element uiææ¡£button |
| | | // onClick: function () { |
| | | // this.$Message.success('ç¹å»äºæé®'); |
| | | // } |
| | | // }); |
| | | |
| | | //示ä¾ï¼è®¾ç½®ä¿®æ¹æ°å»ºãç¼è¾å¼¹åºæ¡å段æ ç¾çé¿åº¦ |
| | | // this.boxOptions.labelWidth = 150; |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { createApp } from 'vue' |
| | | import App from './App.vue' |
| | | import router from './router' |
| | | import store from './store' |
| | | import ElementPlus from 'element-plus'; |
| | | // import 'element-plus/lib/theme-chalk/index.css'; |
| | | import 'element-plus/dist/index.css' |
| | | import './assets/element-icon/icon.css' |
| | | import base from './uitils/common' |
| | | import http from './api/http' |
| | | // import 'dayjs/locale/zh-cn' |
| | | // import locale from 'element-plus/lib/locale/lang/zh-cn' |
| | | import * as ElementPlusIconsVue from '@element-plus/icons-vue' |
| | | |
| | | |
| | | |
| | | import permission from './api/permission' |
| | | import viewgird from './components/basic/ViewGrid'; |
| | | const app = createApp(App); |
| | | for (const [key, component] of Object.entries(ElementPlusIconsVue)) { |
| | | app.component(key, component) |
| | | } |
| | | app.config.globalProperties.base = base; |
| | | app.config.globalProperties.http = http; |
| | | app.config.globalProperties.$tabs = {}; |
| | | app.config.globalProperties.permission = permission; |
| | | app.config.globalProperties.$global = { |
| | | signalR: false, //æ¯å¦å¼å¯signalR |
| | | table: { |
| | | //vol-tableå¸¦æ°æ®æºçåå
æ ¼æ¯å¦å¯ç¨tagæ ç¾(䏿æ¡çåå
æ ¼ä»¥tagæ ç¾æ¾ç¤º) |
| | | useTag: true |
| | | }, |
| | | audit: { //å®¡æ ¸é项 |
| | | data: [ |
| | | { text: 'éè¿', value: 1 }, |
| | | { text: 'æç»', value: 3 }, |
| | | { text: '驳å', value: 4 } |
| | | ], |
| | | status:[0,2] //å®¡æ ¸ä¸çæ°æ® |
| | | // å¾
å®¡æ ¸ = 0, |
| | | // å®¡æ ¸éè¿ = 1, |
| | | // å®¡æ ¸ä¸ = 2, |
| | | // å®¡æ ¸æªéè¿ = 3, |
| | | // 驳å = 4 |
| | | } |
| | | } |
| | | //2023.03.13ï¼ |
| | | //ä¿®æ¹è§ï¼volupload.vueï¼åå°AliOSSController.csï¼é¿éäºOSSé
ç½®.doc |
| | | window.oss = { |
| | | ali: { //é¿éäº |
| | | use: false,//使ç¨é¿éäºä¸ä¼ æä»¶ |
| | | //é¿é缩ç¥å¾åç¼©å¤§å° |
| | | //.aliyuncs.com |
| | | small: "?x-oss-process=image/resize,m_lfit,w_200" |
| | | } |
| | | } |
| | | app.use(store) |
| | | .use(ElementPlus, { size: 'default' }) |
| | | .use(router) |
| | | .use(viewgird) |
| | | .mount('#app'); |
| | | app.config.globalProperties.$Message = app.config.globalProperties.$message; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | let charts=[ |
| | | { |
| | | path: '/chart', |
| | | name: 'chart', |
| | | component: () => import('@/views/charts/chart.vue') |
| | | }, |
| | | { |
| | | path: '/formChart', |
| | | name: 'formChart', |
| | | component: () => import('@/views/charts/formChart.vue') |
| | | }, |
| | | { |
| | | path: '/flex', |
| | | name: 'flex', |
| | | component: () => import('@/views/charts/flex.vue') |
| | | }] |
| | | export default charts |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router' |
| | | import viewgird from './viewGird' |
| | | import store from '../store/index' |
| | | import redirect from './redirect' |
| | | import charts from './charts' |
| | | const routes = [ |
| | | { |
| | | path: '/', |
| | | name: 'Index', |
| | | component: () => import('@/views/Index'), |
| | | redirect: '/home', |
| | | children: [ |
| | | ...viewgird, |
| | | ...redirect, |
| | | ...charts, |
| | | { |
| | | path: '/home', |
| | | name: 'home', |
| | | component: () => import('@/views/Home.vue') |
| | | }, { |
| | | path: '/UserInfo', |
| | | name: 'UserInfo', |
| | | component: () => import('@/views/system/UserInfo.vue') |
| | | }, |
| | | { |
| | | path: '/sysMenu', |
| | | name: 'sysMenu', |
| | | component: () => import('@/views/system/Sys_Menu.vue') |
| | | }, { |
| | | path: '/coder', |
| | | name: 'coder', |
| | | component: () => import('@/views/builder/coder.vue') |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | path: '/login', |
| | | name: 'login', |
| | | component: () => import('@/views/Login.vue'), |
| | | meta:{ |
| | | anonymous:true |
| | | } |
| | | }, |
| | | { |
| | | path: '/bigdata', |
| | | name: 'bigdata', |
| | | component: () => import('@/views/charts/bigdata.vue'), |
| | | meta: { |
| | | keepAlive: false |
| | | } |
| | | } |
| | | ] |
| | | |
| | | const router = createRouter({ |
| | | history: createWebHashHistory(), //createWebHistory(process.env.BASE_URL), |
| | | routes |
| | | }) |
| | | |
| | | |
| | | router.beforeEach((to, from, next) => { |
| | | if (to.matched.length == 0) return next({ path: '/404' }); |
| | | //2020.06.03å¢å è·¯ç±åæ¢æ¶å è½½æç¤º |
| | | store.dispatch("onLoading", true); |
| | | if ((to.hasOwnProperty('meta') && to.meta.anonymous) || store.getters.isLogin() || to.path == '/login') { |
| | | return next(); |
| | | } |
| | | |
| | | next({ path: '/login', query: { redirect: Math.random() } }); |
| | | }) |
| | | router.afterEach((to, from) => { |
| | | store.dispatch("onLoading", false); |
| | | }) |
| | | router.onError((error) => { |
| | | // const targetPath = router.currentRoute.value.matched; |
| | | try { |
| | | console.log(error.message); |
| | | if (process.env.NODE_ENV == 'development') { |
| | | alert(error.message) |
| | | } |
| | | localStorage.setItem("route_error", error.message) |
| | | } catch (e) { |
| | | |
| | | } |
| | | window.location.href = '/' |
| | | }); |
| | | export default router |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | let redirect = [{ |
| | | path: '/404', |
| | | name: '404', |
| | | component: () => import('@/components/redirect/404'), |
| | | meta:{ |
| | | anonymous:true |
| | | } |
| | | }, { |
| | | path: '/401', |
| | | name: '401', |
| | | component: () => import('@/components/redirect/401') |
| | | }, { |
| | | path: '/coding', |
| | | name: 'coding', |
| | | component: () => import('@/components/redirect/coding') |
| | | }, { |
| | | path: '/message', |
| | | name: 'message', |
| | | component: () => import('@/components/redirect/Message.vue') |
| | | }] |
| | | export default redirect; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | let viewgird = [ |
| | | { |
| | | path: '/Sys_Log', |
| | | name: 'sys_Log', |
| | | component: () => import('@/views/system/Sys_Log.vue') |
| | | }, |
| | | { |
| | | path: '/Sys_User', |
| | | name: 'Sys_User', |
| | | component: () => import('@/views/system/Sys_User.vue') |
| | | }, |
| | | { |
| | | path: '/permission', |
| | | name: 'permission', |
| | | component: () => import('@/views/system/Permission.vue') |
| | | }, |
| | | |
| | | { |
| | | path: '/Sys_Dictionary', |
| | | name: 'Sys_Dictionary', |
| | | component: () => import('@/views/system/Sys_Dictionary.vue') |
| | | }, |
| | | { |
| | | path: '/Sys_Role', |
| | | name: 'Sys_Role', |
| | | component: () => import('@/views/system/Sys_Role.vue') |
| | | }, { |
| | | path: '/Sys_Role1', |
| | | name: 'Sys_Role1', |
| | | component: () => import('@/views/system/Sys_Role1.vue') |
| | | }, { |
| | | path: '/Sys_DictionaryList', |
| | | name: 'Sys_DictionaryList', |
| | | component: () => import('@/views/system/Sys_DictionaryList.vue') |
| | | }, { |
| | | path: '/deviceInfo', |
| | | name: 'deviceInfo', |
| | | component: () => import('@/views/quartzJob/deviceInfo.vue') |
| | | }, { |
| | | path: '/deviceProtocol', |
| | | name: 'deviceProtocol', |
| | | component: () => import('@/views/quartzJob/deviceProtocol.vue') |
| | | }, { |
| | | path: '/deviceProtocolDetail', |
| | | name: 'deviceProtocolDetail', |
| | | component: () => import('@/views/quartzJob/deviceProtocolDetail.vue') |
| | | }, { |
| | | path: '/dispatchInfo', |
| | | name: 'dispatchInfo', |
| | | component: () => import('@/views/quartzJob/dispatchInfo.vue') |
| | | }, { |
| | | path: '/task', |
| | | name: 'task', |
| | | component: () => import('@/views/taskinfo/task.vue') |
| | | }, { |
| | | path: '/router', |
| | | name: 'router', |
| | | component: () => import('@/views/basicinfo/router.vue') |
| | | }, { |
| | | path: '/locationInfo', |
| | | name: 'locationInfo', |
| | | component: () => import('@/views/wmsPart/locationInfo.vue') |
| | | }, { |
| | | path: '/stockInfo', |
| | | name: 'stockInfo', |
| | | component: () => import('@/views/wmsPart/stockInfo.vue') |
| | | }, { |
| | | path: '/stockInfoDetail', |
| | | name: 'stockInfoDetail', |
| | | component: () => import('@/views/wmsPart/stockInfoDetail.vue') |
| | | }, { |
| | | path: '/stockInfo_Hty', |
| | | name: 'stockInfo_Hty', |
| | | component: () => import('@/views/wmsPart/stockInfo_Hty.vue') |
| | | }, { |
| | | path: '/stockInfoDetail_Hty', |
| | | name: 'stockInfoDetail_Hty', |
| | | component: () => import('@/views/wmsPart/stockInfoDetail_Hty.vue') |
| | | }] |
| | | |
| | | export default viewgird |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { createStore } from 'vuex' |
| | | const keys = { USER: 'user' } |
| | | function getUserInfo(state) { |
| | | if (state.userInfo) return state.userInfo; |
| | | let userInfo = localStorage.getItem(keys.USER); |
| | | if (userInfo) { |
| | | state.userInfo = JSON.parse(userInfo); |
| | | } |
| | | return state.userInfo; |
| | | } |
| | | export default createStore({ |
| | | state: { |
| | | data: {}, |
| | | permission: [], |
| | | isLoading: false,//2020.06.03å¢å è·¯ç±åæ¢æ¶å è½½æç¤º |
| | | userInfo: null, |
| | | // wcsState: true//wcsæå¡ç¶æ |
| | | }, |
| | | mutations: { |
| | | setPermission(state, data) { //è°ç¨æ¹å¼ this.$store.commit('setPermission', data) |
| | | if (!data || typeof data != 'object') return; |
| | | if (data instanceof Array) { |
| | | state.permission.push(...data); |
| | | } else { |
| | | state.permission = data; |
| | | } |
| | | }, setUserInfo(state, data) { |
| | | state.userInfo = data; |
| | | localStorage.setItem(keys.USER, JSON.stringify(data)); |
| | | }, |
| | | clearUserInfo(state) { |
| | | state.permission = []; |
| | | state.userInfo = null; |
| | | localStorage.removeItem(keys.USER); |
| | | }, |
| | | test(state) { |
| | | return 113344; |
| | | }, |
| | | updateLoadingState(state, flag) { |
| | | state.isLoading = flag |
| | | } |
| | | }, getters: { |
| | | getPermission: (state) => (path) => { //è°ç¨æ¹å¼ store.getters.getPermission('sys_User') |
| | | if (!path) return state.permission; |
| | | return state.permission.find(x => x.path == path); |
| | | }, |
| | | getUserInfo: (state) => () => { |
| | | getUserInfo(state); |
| | | return state.userInfo; |
| | | }, getUserName: (state) => () => { |
| | | getUserInfo(state); |
| | | if (state.userInfo) { |
| | | return state.userInfo.userName; |
| | | } |
| | | return 'æªè·åå°ç»éä¿¡æ¯'; |
| | | }, |
| | | getToken: (state) => () => { |
| | | getUserInfo(state); |
| | | if (state.userInfo) { |
| | | return 'Bearer ' + state.userInfo.token; |
| | | } |
| | | return ''; |
| | | }, |
| | | isLogin: (state) => () => { |
| | | if (getUserInfo(state)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | isLoading: (state) => () => { |
| | | return state.isLoading; |
| | | }, |
| | | data: (state) => () => { |
| | | return state.data; |
| | | }, |
| | | getData: (state) => () => { |
| | | return state.data; |
| | | }, |
| | | }, actions: { |
| | | setPermission(context, data) { |
| | | context.commit('setPermission', data); //è°ç¨æ¹å¼ store.dispatch('push') |
| | | }, |
| | | toDo(context) { |
| | | return context.Store.m; |
| | | }, |
| | | onLoading(context, flag) { |
| | | context.commit("updateLoadingState", flag); |
| | | } |
| | | } |
| | | }) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | let base = { |
| | | addDays(date, days) { |
| | | //ç»æå®æ¥æå¢å å¤©æ° |
| | | if (!days) { |
| | | return date; |
| | | } |
| | | let dateArr = date.split(' '); |
| | | date = new Date(new Date(date).setDate(new Date(date).getDate() + days)); |
| | | var year = date.getFullYear(); |
| | | var month = date.getMonth() + 1; |
| | | if (month < 10) { |
| | | month = '0' + month; |
| | | } |
| | | var day = date.getDate(); |
| | | if (day < 10) { |
| | | day = '0' + day; |
| | | } |
| | | date = year + '-' + month + '-' + day; |
| | | if (dateArr.length == 1) { |
| | | return date; |
| | | } |
| | | return date + ' ' + dateArr[1]; |
| | | }, |
| | | //è·åå½åæ¶é´ï¼timeæ¯å¦å¸¦æ¶åç§ |
| | | getDate(time) { |
| | | let date = new Date(); |
| | | let year = date.getFullYear(); |
| | | let month = date.getMonth() + 1; |
| | | let day = date.getDate(); |
| | | |
| | | let datetime = |
| | | year + |
| | | '-' + |
| | | (month < 10 ? '0' + month : month) + |
| | | '-' + |
| | | (day < 10 ? '0' + day : day); |
| | | |
| | | if (!time) { |
| | | return datetime; |
| | | } |
| | | |
| | | let hour = date.getHours(); |
| | | let minutes = date.getMinutes(); |
| | | let second = date.getSeconds(); |
| | | |
| | | return ( |
| | | datetime + |
| | | '' + |
| | | ' ' + |
| | | (hour < 10 ? '0' + hour : hour) + |
| | | ':' + |
| | | (minutes < 10 ? '0' + minutes : minutes) + |
| | | ':' + |
| | | (second < 10 ? '0' + second : second) |
| | | ); |
| | | }, |
| | | isPhone(val) { |
| | | return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(val); |
| | | }, |
| | | isDecimal(val) { |
| | | return /(^[\-0-9][0-9]*(.[0-9]+)?)$/.test(val); |
| | | }, |
| | | isNumber(val) { |
| | | return /(^[\-0-9][0-9]*([0-9]+)?)$/.test(val); |
| | | }, |
| | | isMail(val) { |
| | | return /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(val); |
| | | }, |
| | | isUrl(url) { |
| | | return this.checkUrl(url); |
| | | }, |
| | | checkUrl(url) { |
| | | // url= åè®®://(ftpçç»å½ä¿¡æ¯)[IP|åå](:端å£å·)(/æ?请æ±åæ°) |
| | | var strRegex = |
| | | '^((https|http|ftp)://)?' + // (httpsæhttpæftp):// 坿坿 |
| | | "(([\\w_!~*'()\\.&=+$%-]+: )?[\\w_!~*'()\\.&=+$%-]+@)?" + // ftpçuser@ 坿坿 |
| | | '(([0-9]{1,3}\\.){3}[0-9]{1,3}' + // IPå½¢å¼çURL- 3使°å.3使°å.3使°å.3使°å |
| | | '|' + // å
许IPåDOMAINï¼ååï¼ |
| | | '(localhost)|' + // å¹é
localhost |
| | | "([\\w_!~*'()-]+\\.)*" + // åå- è³å°ä¸ä¸ª[è±æææ°å_!~*\'()-]å ä¸. |
| | | '\\w+\\.' + // ä¸çº§åå -è±æææ°å å ä¸. |
| | | '[a-zA-Z]{1,6})' + // 顶级åå- 1-6ä½è±æ |
| | | '(:[0-9]{1,5})?' + // 端å£- :80 ,1-5使°å |
| | | '((/?)|' + // urlæ åæ°ç»å°¾ - æææè¿æ²¡æ |
| | | "(/[\\w_!~*'()\\.;?:@&=+$,%#-]+)+/?)$"; // 请æ±åæ°ç»å°¾- è±æææ°åå[]å
çåç§å符 |
| | | var re = new RegExp(strRegex, 'i'); // iä¸åºå大å°å |
| | | // å°urlåuri转ç ååå¹é
ï¼è§£é¤è¯·æ±åæ°ä¸ç䏿å空å符影å |
| | | if (re.test(encodeURI(url))) { |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | matchUrlIp(url, ip) { |
| | | // urlä½¿ç¨æ¯å¦ä½¿ç¨çå½åip |
| | | if (!url || !ip) { |
| | | return false; |
| | | } |
| | | return url.indexOf(ip.replace('https://', '').replace('http://', '')) >= 0; |
| | | }, |
| | | getImgSrc(src, httpUrl) { |
| | | if (this.isUrl(src)) { |
| | | return src; |
| | | } |
| | | if (httpUrl) { |
| | | return httpUrl + src; |
| | | } |
| | | return src; |
| | | }, |
| | | previewImg(src, httpUrl) { |
| | | // å¾çé¢è§ï¼ç®ååªæ¯æåå¾çé¢è§ |
| | | if (src && !this.isUrl(src) && httpUrl) { |
| | | if ( |
| | | src.substr(0, 1) == '/' && |
| | | httpUrl.substr(httpUrl.length - 1, 1) == '/' |
| | | ) { |
| | | src = src.substr(1); |
| | | } |
| | | src = httpUrl + src; |
| | | } |
| | | let id = 'vol-preview'; |
| | | let $div = document.getElementById(id); |
| | | if (!$div) { |
| | | $div = document.createElement('div'); |
| | | $div.setAttribute('id', 'vol-preview'); |
| | | let $mask = document.createElement('div'); |
| | | $mask.style.position = 'absolute'; |
| | | $mask.style.width = '100%'; |
| | | $mask.style.height = '100%'; |
| | | $mask.style.background = 'black'; |
| | | $mask.style.opacity = '0.6'; |
| | | $div.appendChild($mask); |
| | | $div.style.position = 'fixed'; |
| | | $div.style.width = '100%'; |
| | | $div.style.height = '100%'; |
| | | // $div.style.overflow = "scroll"; |
| | | $div.style.top = 0; |
| | | $div.style['z-index'] = 9999999; |
| | | let $img = document.createElement('img'); |
| | | $img.setAttribute('class', 'vol-preview-img'); |
| | | $img.style.position = 'absolute'; |
| | | $img.style.top = '50%'; |
| | | $img.style.left = '50%'; |
| | | $img.style['max-width'] = '90%'; |
| | | $img.style['max-height'] = '90%'; |
| | | $img.style.transform = 'translate(-50%,-50%)'; |
| | | // $img.src = src; |
| | | $img.setAttribute('src', src); |
| | | $div.appendChild($img); |
| | | $div.addEventListener('click', function() { |
| | | this.style.display = 'none'; |
| | | }); |
| | | document.body.appendChild($div); |
| | | return; |
| | | } |
| | | let $img1 = document.body |
| | | .appendChild($div) |
| | | .querySelector('.vol-preview-img'); |
| | | // img.src = src; |
| | | $img1.setAttribute('src', src); |
| | | $div.style.display = 'block'; |
| | | }, |
| | | // ä¸è½½æä»¶ $element æ ç¾, url宿´url, fileName æä»¶å, header 以key/valueä¼ å¼ |
| | | // backGroundUrl åå°urlï¼å¦æåå°urlç´æ¥ä»åå°ä¸è½½ï¼å
¶ä»å
¨é¨éè¿ç¹å»aæ ç¾ä¸è½½ |
| | | dowloadFile(url, fileName, header, backGroundUrl) { |
| | | if (!url) return alert('æ¤æä»¶æ²¡æurlä¸è½ä¸è½½'); |
| | | if (!this.isUrl(url)) { |
| | | url = backGroundUrl + url; |
| | | } |
| | | window.open(url); |
| | | }, |
| | | downloadImg(data) { |
| | | if (!data.url || !data.callback || typeof data.callback !== 'function') { |
| | | return; |
| | | } |
| | | // url, backGroundUrl, header, callback |
| | | if ( |
| | | this.isUrl(data.url) && |
| | | !this.matchUrlIp(data.url, data.backGroundUrl) |
| | | ) { |
| | | return data.url; |
| | | } |
| | | // éè¿åå°apiæå¡å¨ä¸è½½ |
| | | if (!this.isUrl(data.url)) { |
| | | if (!this.isUrl(data.backGroundUrl + data.url)) { |
| | | return; |
| | | } |
| | | data.url = data.backGroundUrl + data.url; |
| | | } |
| | | var xmlResquest = new XMLHttpRequest(); |
| | | xmlResquest.open('get', data.url, true); |
| | | xmlResquest.responseType = 'blob'; |
| | | xmlResquest.setRequestHeader('Content-Type', 'application/json'); |
| | | if (data.header && typeof data.header === 'object') { |
| | | for (const key in data.header) { |
| | | xmlResquest.setRequestHeader(key, data.header[key]); |
| | | } |
| | | } |
| | | xmlResquest.onload = function() { |
| | | if (this.status == 200) { |
| | | var blob = this.response; |
| | | callback(window.URL.createObjectURL(blob)); |
| | | } |
| | | }; |
| | | xmlResquest.send(); |
| | | }, |
| | | // 2020.06.01å¢å éç¨æ¹æ³ï¼å°æ®é对象转æ¢ä¸ºtreeç»æ |
| | | // dataæ°æ®æ ¼å¼[ |
| | | // { name: 'tree1', id: 1, parentId: 0 }, |
| | | // { name: 'tree2', id: 2, parentId: 0 }] |
| | | |
| | | // 1ãidä¸parentIdè¿ä¸¤ä¸ªå段å¿
é¡»æ |
| | | // 2ãæ å½¢treeéè¦æ³¨æIdä¸parentId循ç¯ä¾èµçé®é¢ |
| | | // 3ãcallbackæ¯æ¬¡çæä¸æ°çèç¹çæ¶åè°çæ¹æ³ |
| | | |
| | | convertTree(data, callback) { |
| | | var treeIds = []; |
| | | var root_data = []; |
| | | if (data.length>100) { |
| | | data = JSON.parse(JSON.stringify(data)); |
| | | } |
| | | data.forEach((x) => { |
| | | // if (!x.children) { |
| | | // x.children = [] |
| | | // } |
| | | if ( |
| | | !x.hidden && |
| | | x.id !== undefined && |
| | | x.id !== x.parentId && |
| | | !data.some((s) => { |
| | | return x.parentId == s.id; |
| | | }) |
| | | ) { |
| | | x.isRoot = true; |
| | | callback && callback(x, data, true, treeIds); |
| | | root_data.push(x); |
| | | getTree(x.id, x, data, callback, treeIds); |
| | | } else { |
| | | callback && callback(x, data, true, treeIds); |
| | | } |
| | | }); |
| | | var exceptionNodes = data.filter((f) => { |
| | | return treeIds.indexOf(f.id) == -1 && !f.hidden; |
| | | }); |
| | | |
| | | root_data.push(...exceptionNodes); |
| | | return root_data; |
| | | }, |
| | | getTreeAllParent(id, data) { |
| | | // è·åæä¸ªèç¹çææç¶èç¹ä¿¡æ¯2020.11.01 |
| | | var nodes = []; |
| | | if (!(data instanceof Array)) { |
| | | return nodes; |
| | | } |
| | | if (data.length>100) { |
| | | data = JSON.parse(JSON.stringify(data)); |
| | | } |
| | | data.forEach((x) => { |
| | | if (x.id === x.parentId) { |
| | | x.parentId = 0; |
| | | } else if (data.some((c) => c.parentId === x.id && c.id === x.parentId)) { |
| | | x.parentId = 0; |
| | | } |
| | | }); |
| | | |
| | | var _child = data.find((x) => { |
| | | return x.id === id; |
| | | }); |
| | | if (!_child) { |
| | | return []; |
| | | } |
| | | nodes.push(_child); |
| | | var _parentIds = [_child.parentId]; |
| | | for (let index = 0; index < _parentIds.length; index++) { |
| | | var _node = data.find((x) => { |
| | | return x.id === _parentIds[index] && x.id !== x.parentId; |
| | | }); |
| | | if (!_node) { |
| | | return nodes; |
| | | } |
| | | _parentIds.push(_node.parentId); |
| | | nodes.unshift(_node); |
| | | } |
| | | return nodes; |
| | | }, |
| | | //è·åææèç¹çåèç¹ |
| | | // dataæ°æ®æ ¼å¼[ |
| | | // { name: 'tree1', id: 1, parentId: 0 }, |
| | | // { name: 'tree2', id: 2, parentId: 0 }] |
| | | getTreeAllChildren(id, data) { |
| | | //éå½è·åæä¸ªèç¹çææåèç¹ä¿¡æ¯ |
| | | var nodes = []; |
| | | if (!(data instanceof Array)) { |
| | | return nodes; |
| | | } |
| | | if (data.length>100) { |
| | | data = JSON.parse(JSON.stringify(data)); |
| | | } |
| | | var _child = data.find((x) => { |
| | | return x.id === id; |
| | | }); |
| | | if (!_child) { |
| | | return []; |
| | | } |
| | | nodes.push(_child); |
| | | var _parentIds = [_child.id]; |
| | | for (let index = 0; index < _parentIds.length; index++) { |
| | | data.forEach((_node) => { |
| | | if ( |
| | | _node.parentId === _parentIds[index] && |
| | | _node.parentId !== _node.id |
| | | ) { |
| | | _parentIds.push(_node.id); |
| | | nodes.unshift(_node); |
| | | } |
| | | }); |
| | | } |
| | | return nodes; |
| | | }, |
| | | //è·åææåèç¹çid |
| | | // dataæ°æ®æ ¼å¼[ |
| | | // { name: 'tree1', id: 1, parentId: 0 }, |
| | | // { name: 'tree2', id: 2, parentId: 0 }] |
| | | getTreeAllChildrenId(id, data) { |
| | | return this.getTreeAllChildren(id, data).map((c) => { |
| | | return c.id; |
| | | }); |
| | | } |
| | | }; |
| | | export default base; |
| | | |
| | | // 2020.06.01å¢å éç¨æ¹æ³ï¼å°æ®é对象转æ¢ä¸ºtreeç»æ |
| | | function getTree(id, node, data, callback, treeIds) { |
| | | if (treeIds.indexOf(id) == -1) { |
| | | treeIds.push(id); |
| | | } |
| | | data.forEach((x) => { |
| | | if (!x.hidden && x.parentId == id) { |
| | | if (!node.children) node.children = []; |
| | | callback && callback(x, node, false); |
| | | node.children.push(x); |
| | | getTree(x.id, x, data, callback, treeIds); |
| | | } |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="title"></div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { ref, reactive } from 'vue' |
| | | |
| | | export default { |
| | | setup() { |
| | | return { |
| | | |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .title { |
| | | line-height: 70vh; |
| | | text-align: center; |
| | | font-size: 28px; |
| | | color: orange; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div id="vol-container" :class="['vol-theme-' + theme]"> |
| | | <div class="vol-aside" :style="{ width: menuWidth + 'px' }"> |
| | | <div class="header" :style="{ width: menuWidth - 1 + 'px' }"> |
| | | <img v-show="!isCollapse" v-bind:src="logo" /> |
| | | <i |
| | | @click="toggleLeft" |
| | | class="collapse-menu" |
| | | :class="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" |
| | | /> |
| | | </div> |
| | | <div class="vol-menu"> |
| | | <el-scrollbar style="height: 100%"> |
| | | <VolMenu |
| | | :currentMenuId="currentMenuId" |
| | | :on-select="onSelect" |
| | | :enable="true" |
| | | :open-select="false" |
| | | :isCollapse="isCollapse" |
| | | :list="menuOptions" |
| | | ></VolMenu> |
| | | </el-scrollbar> |
| | | </div> |
| | | </div> |
| | | <div class="vol-container" :style="{ left: menuWidth - 1 + 'px' }"> |
| | | <div class="vol-header"> |
| | | <div class="project-name">WMS</div> |
| | | <div class="header-text"> |
| | | <div class="h-link"> |
| | | <a |
| | | href="javascript:void(0)" |
| | | @click="to(item)" |
| | | v-for="(item, index) in links.filter((c) => { |
| | | return !c.icon; |
| | | })" |
| | | :key="index" |
| | | > |
| | | <span v-if="!item.icon">{{ item.text }}</span> |
| | | <i v-else :class="item.icon"></i> |
| | | </a> |
| | | </div> |
| | | </div> |
| | | <div class="header-info"> |
| | | <div class="h-link"> |
| | | <a |
| | | href="javascript:void(0)" |
| | | @click="to(item)" |
| | | v-for="(item, index) in links.filter((c) => { |
| | | return c.icon; |
| | | })" |
| | | :key="index" |
| | | > |
| | | <span v-if="!item.icon">{{ item.text }}</span> |
| | | <i v-else :class="item.icon"></i> |
| | | </a> |
| | | </div> |
| | | <!--æ¶æ¯ç®¡ç--> |
| | | |
| | | <div class="h-link" @click="messageModel = true"> |
| | | <a> |
| | | <i class="el-icon-message-solid"> |
| | | <el-badge |
| | | :value="messageList.length" |
| | | :type="messageList.length > 0 ? 'danger' : 'success'" |
| | | class="item" |
| | | style="width: 10px" |
| | | ></el-badge> |
| | | </i> |
| | | </a> |
| | | </div> |
| | | <div> |
| | | <img class="user-header" :src="userImg" :onerror="errorImg" /> |
| | | </div> |
| | | <div class="user"> |
| | | <span>{{ userTrueName }}</span> |
| | | <span id="index-date"></span> |
| | | </div> |
| | | <div class="settings"> |
| | | <i style="font-size: 20px" class="el-icon-s-tools" @click="drawer_model = true" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="vol-path"> |
| | | <el-tabs |
| | | @tab-click="selectNav" |
| | | @tab-remove="removeNav" |
| | | @contextmenu.prevent="bindRightClickMenu(false)" |
| | | type="border-card" |
| | | class="header-navigation" |
| | | v-model="selectId" |
| | | :strtch="false" |
| | | > |
| | | <el-tab-pane |
| | | v-for="(item, navIndex) in navigation" |
| | | type="card" |
| | | :name="navIndex + ''" |
| | | :closable="navIndex > 0" |
| | | :key="navIndex" |
| | | :label="item.name" |
| | | > |
| | | <span style="display: none">{{ navIndex }}</span> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <!-- å³é®èå --> |
| | | <div v-show="contextMenuVisible"> |
| | | <ul :style="{ left: menuLeft + 'px', top: menuTop + 'px' }" class="contextMenu"> |
| | | <li v-show="visibleItem.all"> |
| | | <el-button link @click="closeTabs()"> |
| | | <i class="el-icon-close"></i> |
| | | {{ |
| | | navigation.length == 2 ? "å
³éèå" : "å
³éææ" |
| | | }} |
| | | </el-button> |
| | | </li> |
| | | <li v-show="visibleItem.left"> |
| | | <el-button link @click="closeTabs('left')"> |
| | | <i class="el-icon-back"></i>å
³é左边 |
| | | </el-button> |
| | | </li> |
| | | <li v-show="visibleItem.right"> |
| | | <el-button link @click="closeTabs('right')"> |
| | | <i class="el-icon-right"></i>å
³éå³è¾¹ |
| | | </el-button> |
| | | </li> |
| | | <li v-show="visibleItem.other"> |
| | | <el-button link @click="closeTabs('other')"> |
| | | <i class="el-icon-right"></i>å
³éå
¶ä» |
| | | </el-button> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | <div class="vol-main" id="vol-main"> |
| | | <el-scrollbar style="height: 100%" v-if="permissionInited"> |
| | | <loading v-show="$store.getters.isLoading()"></loading> |
| | | <router-view v-slot="{ Component }"> |
| | | <keep-alive> |
| | | <component |
| | | :is="Component" |
| | | :key="$route.name" |
| | | v-if=" |
| | | !$route.meta || |
| | | ($route.meta && !$route.meta.hasOwnProperty('keepAlive')) |
| | | " |
| | | /> |
| | | </keep-alive> |
| | | <component |
| | | :is="Component" |
| | | :key="$route.name" |
| | | v-if="$route.meta && $route.meta.hasOwnProperty('keepAlive')" |
| | | /> |
| | | </router-view> |
| | | </el-scrollbar> |
| | | </div> |
| | | </div> |
| | | <el-drawer title="鿩䏻é¢" v-model="drawer_model" direction="rtl" destroy-on-close> |
| | | <div class="theme-selector"> |
| | | <div |
| | | @click="changeTheme(item.name)" |
| | | class="item" |
| | | v-for="(item, index) in theme_color" |
| | | :key="index" |
| | | :style="{ background: item.color }" |
| | | > |
| | | <div |
| | | v-show="item.leftColor" |
| | | :style="{ background: item.leftColor }" |
| | | style="height: 100%; width: 20px" |
| | | class="t-left" |
| | | ></div> |
| | | <div class="t-right"></div> |
| | | </div> |
| | | </div> |
| | | </el-drawer> |
| | | |
| | | <el-drawer title="æ¶æ¯å表" v-model="messageModel" direction="rtl" destroy-on-close size="40%"> |
| | | <Message :list="messageList"></Message> |
| | | </el-drawer> |
| | | </div> |
| | | </template> |
| | | <style lang="less" scoped> |
| | | @import "./index/index.less"; |
| | | </style> |
| | | <script> |
| | | import loading from "@/components/basic/RouterLoading"; |
| | | import VolMenu from "@/components/basic/VolElementMenu.vue"; |
| | | import Message from "./index/Message.vue"; |
| | | import MessageConfig from "./index/MessageConfig.js"; |
| | | var imgUrl = require("@/assets/imgs/wms_x.png"); |
| | | var $this; |
| | | var $interval; |
| | | var $indexDate; |
| | | import { |
| | | defineComponent, |
| | | reactive, |
| | | ref, |
| | | watch, |
| | | onMounted, |
| | | getCurrentInstance, |
| | | h |
| | | } from "vue"; |
| | | import { useRouter, useRoute } from "vue-router"; |
| | | import store from "../store/index"; |
| | | import http from "@/../src/api/http.js"; |
| | | import { ElNotification } from "element-plus"; |
| | | export default defineComponent({ |
| | | components: { |
| | | VolMenu, |
| | | loading, |
| | | Message |
| | | }, |
| | | |
| | | data() { |
| | | return { |
| | | allTabs: true, |
| | | leftTabs: true, |
| | | rightTabs: true, |
| | | otherTabs: true, |
| | | menuLeft: 0, |
| | | menuTop: 0, |
| | | client: null |
| | | // contextMenuVisible: false, // å³é®å
³éæ¾/é |
| | | }; |
| | | }, |
| | | setup(props, context) { |
| | | let client = ref(null); |
| | | |
| | | // è·åå
¨å±å±æ§åæ¹æ³ |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // èå导èªé»è®¤å®½åº¦ |
| | | const menuWidth = ref(200); |
| | | const contextMenuVisible = ref(false); |
| | | const isCollapse = ref(false); |
| | | const drawer_model = ref(false); |
| | | const messageModel = ref(false); |
| | | const theme_color = ref([ |
| | | { name: "blue", color: "rgb(45, 140, 240)" }, |
| | | { name: "blue2", color: "rgb(45, 140, 240)", leftColor: "#0068d6" }, |
| | | { name: "red", color: "rgb(237, 64, 20)" }, |
| | | { name: "red2", color: "rgb(237, 64, 20)", leftColor: "#a90000" }, |
| | | { name: "dark", color: "#272929" }, |
| | | { name: "orange", color: "#ff9900" }, |
| | | { name: "orange2", color: "#ff9900", leftColor: "rgb(232 141 5)" }, |
| | | { name: "green", color: "rgb(25, 190, 107)" }, |
| | | { name: "green2", color: "rgb(25, 190, 107)", leftColor: "#019e4f" }, |
| | | { name: "white", color: "#fff" } |
| | | ]); |
| | | const links = ref([ |
| | | { text: "个人ä¸å¿", path: "/UserInfo", id: -1, icon: "el-icon-s-custom" }, |
| | | { |
| | | text: "å®å
¨éåº", |
| | | path: "/login", |
| | | id: -4, |
| | | icon: "el-icon-switch-button" |
| | | } |
| | | ]); |
| | | const errorImg = ref( |
| | | 'this.src="' + require("@/assets/imgs/error-img.png") + '"' |
| | | ); |
| | | const selectId = ref("1"); |
| | | // ãé¦é¡µãæ ç¾åºå·(å½åå³é®éä¸çèå) |
| | | const selectMenuIndex = ref("0"); |
| | | //2022.05.29å¢å tabé项ä¸èåèå¨åè½ |
| | | const currentMenuId = ref(0); |
| | | const userName = ref("--"); |
| | | const userTrueName = ref("--"); |
| | | const userInfo = ref({}); |
| | | const visibleItem = reactive({ |
| | | left: false, |
| | | right: false, |
| | | all: false, |
| | | other: false |
| | | }); |
| | | const userImg = ref(""); |
| | | const navigation = reactive([ |
| | | { orderNo: "0", id: "1", name: "é¦é¡µ", path: "/home" } |
| | | ]); |
| | | const logo = ref(imgUrl); |
| | | const theme = ref("blue2"); |
| | | const menuOptions = ref([]); |
| | | const permissionInited = ref(false); |
| | | const messageList = reactive([]); |
| | | let _config = getCurrentInstance().appContext.config.globalProperties; |
| | | let router = useRouter(); |
| | | const toggleLeft = () => { |
| | | isCollapse.value = !isCollapse.value; |
| | | menuWidth.value = isCollapse.value ? 63 : 200; |
| | | }; |
| | | //2021.08.28弿¾æå¨æå èåæ¹æ³ |
| | | _config.menu = { |
| | | show() { |
| | | toggleLeft(); |
| | | }, |
| | | hide() { |
| | | toggleLeft(); |
| | | } |
| | | }; |
| | | |
| | | const handleMessage = e => { |
| | | let data = JSON.parse(e.data); |
| | | messageList.push(data); |
| | | ElNotification({ |
| | | title: data.title, |
| | | message: h("i", { style: "color: teal" }, data.message), |
| | | position: "bottom-right" |
| | | }); |
| | | }; |
| | | |
| | | const createSocket = url => { |
| | | // å建WebSocketè¿æ¥ |
| | | //"ws://127.0.0.1:9295/admin" |
| | | client = new WebSocket(url); |
| | | |
| | | client.onopen = function() { |
| | | client.onmessage = handleMessage; |
| | | store.commit("setWebsocket", client); |
| | | console.log("WebSocket è¿æ¥æå"); |
| | | }; |
| | | |
| | | client.onclose = function() { |
| | | console.log("WebSocket è¿æ¥å
³é"); |
| | | setTimeout(createSocket, 10000); |
| | | }; |
| | | |
| | | client.onerror = function() {}; |
| | | }; |
| | | |
| | | const changeTheme = name => { |
| | | if (theme.value != name) { |
| | | theme.value = name; |
| | | } |
| | | localStorage.setItem("vol3_theme", name); |
| | | }; |
| | | const to = item => { |
| | | /* 2020.07.31å¢å æå¨æå¼tabs*/ |
| | | if (item.path == "#") { |
| | | window.open("https://github.com/cq-panda/Vue.NetCore"); |
| | | return; |
| | | } |
| | | if (item.path.indexOf("http") != -1) { |
| | | window.open(item.path); |
| | | return; |
| | | } |
| | | if (typeof item == "string" || item.path == "/login") { |
| | | if (item == "/login" || item.path == "/login") { |
| | | store.commit("clearUserInfo", ""); |
| | | window.location.href = "/"; |
| | | return; |
| | | } |
| | | router.push({ path: item }); |
| | | return; |
| | | } |
| | | if (item.path == "#") return; |
| | | open(item); |
| | | }; |
| | | const open = (item, useRoute) => { |
| | | /* 2020.07.31å¢å æå¨æå¼tabs*/ |
| | | let _index = navigation.findIndex(x => { |
| | | return x.path == item.path; |
| | | }); |
| | | if (_index == -1) { |
| | | navigation.push({ |
| | | // orderNo: String(navigation.length),// åºå· |
| | | id: item.id + "", |
| | | name: item.name || item.text || "æ æ é¢", |
| | | path: item.path, |
| | | query: item.query //2021.03.20ä¿®å¤èªå®ä¹äºæ¬¡æå¼$tabsæ¶åæ°ä¸¢å¤±çé®é¢ |
| | | }); |
| | | //æ°æå¼çtabç§»è³æåä¸ä¸ªé项 |
| | | selectId.value = navigation.length - 1 + ""; |
| | | } else { |
| | | selectId.value = _index + ""; |
| | | } |
| | | if (useRoute === undefined) { |
| | | //éæ åèåï¼è®°å½æå䏿¬¡è·³è½¬ç页é¢ï¼ç¨äºå·æ° |
| | | setItem(item); |
| | | router.push(item); |
| | | // this.$router.push(item); |
| | | } |
| | | currentMenuId.value = item.id * 1; |
| | | // tabèåç»å®å³é®äºä»¶ |
| | | proxy.$nextTick(function(e) { |
| | | proxy.bindRightClickMenu(true); |
| | | }); |
| | | }; |
| | | const close = path => { |
| | | /* 2020.07.31å¢å æå¨æå¼tabs*/ |
| | | let index = navigation.findIndex(x => { |
| | | return x.path == path; |
| | | }); |
| | | if (index == -1) { |
| | | return _config.$Message.error("æªæ¾å°èå"); |
| | | } |
| | | removeNav(index); |
| | | }; |
| | | const setItem = item => { |
| | | /* 2020.07.31å¢å æå¨æå¼tabs*/ |
| | | localStorage.setItem( |
| | | window.location.origin + "_tabs", |
| | | JSON.stringify(item) |
| | | ); |
| | | }; |
| | | const getItem = () => { |
| | | /* 2020.07.31å¢å æå¨æå¼tabs*/ |
| | | let nav = localStorage.getItem(window.location.origin + "_tabs"); |
| | | return nav ? JSON.parse(nav) : null; |
| | | }; |
| | | const selectNav = item => { |
| | | //å级elementæ£å¼çä¿®æ¹ |
| | | selectId.value = item.props.name; |
| | | let _path = navigation[item.index].path; |
| | | currentMenuId.value = ( |
| | | menuOptions.value.find(c => { |
| | | return c.path == _path; |
| | | }) || { id: 0 } |
| | | ).id; |
| | | |
| | | router.push({ |
| | | path: navigation[item.index].path, |
| | | query: navigation[item.index].query |
| | | }); |
| | | }; |
| | | |
| | | const removeNav = _index => { |
| | | return new Promise(() => { |
| | | //å
³éçå½å项,跳转å°åä¸ä¸ªé¡µé¢ |
| | | if (selectId.value == _index + "") { |
| | | console.log(navigation[_index - 1]); |
| | | setItem(navigation[_index - 1]); |
| | | router.push({ |
| | | path: navigation[_index - 1].path, |
| | | //2022.06.27ä¿®å¤tabsäºæ¬¡åæ¢å忰䏢失çé®é¢ |
| | | query: navigation[_index - 1].query |
| | | }); |
| | | navigation.splice(_index, 1); |
| | | selectId.value = selectId.value - 1 + ""; |
| | | return; |
| | | } |
| | | if (_index < selectId.value) { |
| | | selectId.value = selectId.value - 1 + ""; |
| | | } |
| | | navigation.splice(_index, 1); |
| | | currentMenuId.value = ( |
| | | menuOptions.value.find(c => { |
| | | return c.path == navigation[selectId.value * 1].path; |
| | | }) || { id: 0 } |
| | | ).id; |
| | | }); |
| | | }; |
| | | |
| | | const getSelectMenuName = id => { |
| | | return menuOptions.value.find(function(x) { |
| | | return x.id == id; |
| | | }); |
| | | }; |
| | | const onSelect = treeId => { |
| | | /* 2020.07.31å¢å æå¨æå¼tabs*/ |
| | | var item = getSelectMenuName(treeId); |
| | | open(item, false); |
| | | }; |
| | | |
| | | /** |
| | | * æ¾ç¤ºå³é®èå |
| | | * @param {*} e äºä»¶å¯¹è±¡ |
| | | */ |
| | | const openTabsMenu = function(e) { |
| | | e.preventDefault(); // 鲿¢é»è®¤èåå¼¹åº |
| | | let tabId = e.target.id.split("-")[1] * 1; |
| | | |
| | | //è®°å½å½åéä¸çèåindex |
| | | selectMenuIndex.value = |
| | | document.getElementById("pane-" + tabId).children[0].textContent * 1; |
| | | //åªæé¦é¡µæ¶ä¸æ¾ç¤º |
| | | if (navigation.length == 1) { |
| | | return; |
| | | } |
| | | |
| | | //é¦é¡µè®¾ç½®æ¾ç¤ºå
³éå³è¾¹èå |
| | | if (!selectMenuIndex.value) { |
| | | visibleItem.all = false; |
| | | visibleItem.right = true; |
| | | visibleItem.left = false; |
| | | visibleItem.other = false; |
| | | } else { |
| | | visibleItem.all = true; |
| | | //䏿¯æåä¸ä¸ªæ¾ç¤ºå
³éå³è¾¹èå |
| | | visibleItem.right = selectMenuIndex.value != navigation.length - 1; |
| | | //åªæä¸¤ä¸ªè忶䏿¾ç¤ºå
³é左边 |
| | | visibleItem.left = navigation.length != 2; |
| | | //åªæä¸¤ä¸ªè忶䏿¾ç¤ºå
³éå
¶ä» |
| | | visibleItem.other = navigation.length != 2; |
| | | } |
| | | contextMenuVisible.value = true; |
| | | // 设置å³é®èåæ¾ç¤ºçä½ç½® |
| | | proxy.menuLeft = |
| | | e.target.getBoundingClientRect().left - (isCollapse.value ? 63 : 198); //-e.target.clientWidth |
| | | proxy.menuTop = 36; |
| | | }; |
| | | |
| | | /** |
| | | * å
³éå³é®èå |
| | | */ |
| | | const closeTabsMenu = () => { |
| | | contextMenuVisible.value = false; |
| | | }; |
| | | const toHome = () => { |
| | | open({ |
| | | text: navigation[0].name, |
| | | path: navigation[0].path |
| | | }); |
| | | }; |
| | | /** |
| | | * å
³éå
¶å®æ ç¾é¡µ |
| | | * @param {*} par å
³éç±»å(left,right,other) |
| | | */ |
| | | const closeTabs = value => { |
| | | let _menuId = navigation[selectId.value * 1].id; |
| | | let currnetIndex = selectId.value * 1; // navigation.findIndex(c => { return c.id == selectId.value }); |
| | | switch (value) { |
| | | case "left": { |
| | | // å é¤å·¦ä¾§tabæ ç¾ |
| | | navigation.splice(1, currnetIndex - 1); // å é¤å·¦ä¾§tabæ ç¾ |
| | | break; |
| | | } |
| | | case "right": { |
| | | // å é¤å³ä¾§tabæ ç¾ |
| | | if (selectMenuIndex.value == 0) { |
| | | navigation.splice(currnetIndex); // å é¤å³ä¾§tabæ ç¾ |
| | | toHome(); |
| | | } else { |
| | | navigation.splice(currnetIndex + 1); // å é¤å³ä¾§tabæ ç¾ |
| | | if (selectMenuIndex.value < currnetIndex) { |
| | | navigation.splice( |
| | | selectMenuIndex.value, |
| | | currnetIndex - selectMenuIndex.value |
| | | ); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | case "other": { |
| | | // å é¤å
¶ä»æætabæ ç¾ |
| | | navigation.splice(currnetIndex + 1); // å é¤å³ä¾§tabæ ç¾(è¿éå¿
é¡»æç
§å³â左顺åºå é¤) |
| | | navigation.splice(1, currnetIndex - 1); // å é¤å·¦ä¾§tabæ ç¾ |
| | | break; |
| | | } |
| | | default: { |
| | | //å
³éææ |
| | | navigation.splice(1, navigation.length); |
| | | toHome(); |
| | | break; |
| | | } |
| | | } |
| | | selectId.value = |
| | | navigation.findIndex(c => { |
| | | return c.id == _menuId; |
| | | }) + ""; |
| | | closeTabsMenu(); |
| | | }; |
| | | |
| | | watch( |
| | | () => contextMenuVisible.value, |
| | | (newVal, oldVal) => { |
| | | // çè§ |
| | | if (newVal) { |
| | | document.body.addEventListener("click", closeTabsMenu); |
| | | } else { |
| | | document.body.removeEventListener("click", closeTabsMenu); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | /** |
| | | * ç³»ç»å建å¼å§ |
| | | */ |
| | | const created = () => { |
| | | let _theme = localStorage.getItem("vol3_theme"); |
| | | if (_theme) { |
| | | theme.value = _theme; |
| | | } |
| | | |
| | | let _userInfo = store.getters.getUserInfo(); |
| | | if (_userInfo) { |
| | | userName.value = _userInfo.userName; |
| | | userTrueName.value = _userInfo.userTrueName; |
| | | if (_userInfo.img) { |
| | | userImg.value = _config.base.getImgSrc(_userInfo.img, http.ipAddress); |
| | | } |
| | | } |
| | | |
| | | createSocket(window.webConfig.webSocketUrl); |
| | | |
| | | Object.assign(_config.$tabs, { open: open, close: close }); |
| | | |
| | | http.get("api/Sys_Menu/getTreeMenu", {}, true).then(data => { |
| | | data.push({ id: "1", name: "é¦é¡µ", url: "/home" }); // 为äºè·åéä¸idä½¿ç¨ |
| | | data.forEach(d => { |
| | | d.path = (d.url || "").replace("/Manager", ""); |
| | | d.to = (d.url || "").replace("/Manager", ""); |
| | | if (!d.icon || d.icon.substring(0, 3) != "el-") { |
| | | d.icon = "el-icon-menu"; |
| | | } |
| | | }); |
| | | store.dispatch("setPermission", data); |
| | | menuOptions.value = data; |
| | | permissionInited.value = true; |
| | | |
| | | //å¼å¯æ¶æ¯æ¨éï¼main.jsä¸è®¾ç½®æ¯å¦å¼å¯signalRï¼2022.05.05 |
| | | if (_config.$global.signalR) { |
| | | MessageConfig(http, result => { |
| | | messageList.unshift(result); |
| | | // console.log(result) |
| | | }); |
| | | } |
| | | |
| | | //å½åå·æ°æ¯ä¸æ¯é¦é¡µ |
| | | if (router.currentRoute.value.path != navigation[0].path) { |
| | | //æ¥æ¾ç³»ç»èå |
| | | let item = menuOptions.value.find(x => { |
| | | return x.path == router.currentRoute.value.path; //this.$route.path; |
| | | }); |
| | | if (item) return onSelect(item.id); |
| | | //æ¥æ¾é¡¶é¨å¿«æ·è¿æ¥ |
| | | item = links.value.find(x => { |
| | | return x.path == router.currentRoute.value.path; //this.$route.path; |
| | | }); |
| | | //æ¥æ¾æå䏿¬¡è·³è½¬çé¡µé¢ |
| | | if (!item) { |
| | | item = getItem(); |
| | | } |
| | | if (item) { |
| | | return open(item, false); |
| | | } |
| | | } |
| | | selectId.value = "1"; |
| | | }); |
| | | }; |
| | | created(); |
| | | return { |
| | | menuWidth, |
| | | isCollapse, |
| | | drawer_model, |
| | | theme_color, |
| | | errorImg, |
| | | userInfo, |
| | | userName, |
| | | userTrueName, |
| | | userImg, |
| | | selectId, |
| | | selectMenuIndex, |
| | | navigation, |
| | | links, |
| | | onSelect, |
| | | openTabsMenu, |
| | | selectNav, |
| | | getSelectMenuName, |
| | | removeNav, |
| | | logo, |
| | | theme, |
| | | menuOptions, |
| | | permissionInited, |
| | | changeTheme, |
| | | to, |
| | | toggleLeft, |
| | | messageModel, |
| | | messageList, |
| | | contextMenuVisible, |
| | | visibleItem, |
| | | closeTabsMenu, |
| | | closeTabs, |
| | | currentMenuId |
| | | }; |
| | | }, |
| | | /** |
| | | * æè½½é©å彿° |
| | | */ |
| | | mounted() { |
| | | let _date = showTime(); |
| | | $indexDate = document.getElementById("index-date"); |
| | | $indexDate.innerText = _date; |
| | | $interval = setInterval(function() { |
| | | $indexDate.innerText = showTime(); |
| | | }, 1000); |
| | | |
| | | this.bindRightClickMenu(true); |
| | | }, |
| | | |
| | | methods: { |
| | | /** |
| | | * ç»å®å³é®äºä»¶ |
| | | * @param {*} enable æ¯å¦å¯ç¨å³é®äºä»¶[true:å¯ç¨;false:ç¦ç¨;] |
| | | * @param {*} $event äºä»¶ |
| | | */ |
| | | bindRightClickMenu(enable) { |
| | | if (!enable) return; |
| | | let that = this; |
| | | // 使ç¨åçjs 为å个domç»å®é¼ æ å³å»äºä»¶ |
| | | that.$nextTick(() => { |
| | | let tab_top_dom = Object.assign( |
| | | [], |
| | | document.getElementsByClassName("el-tabs__item is-top") |
| | | ); |
| | | tab_top_dom.forEach((item, index) => { |
| | | item.oncontextmenu = that.openTabsMenu; |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 鿝é©å彿° |
| | | */ |
| | | destroyed() { |
| | | $this = null; |
| | | clearInterval($interval); |
| | | } |
| | | }); |
| | | const week = new Array( |
| | | "ææä¸", |
| | | "ææäº", |
| | | "ææä¸", |
| | | "ææå", |
| | | "ææäº", |
| | | "ææå
", |
| | | "æææ¥" |
| | | ); |
| | | function showTime() { |
| | | let date = new Date(); |
| | | let year = date.getFullYear(); |
| | | let month = date.getMonth() + 1; |
| | | let day = date.getDate(); |
| | | let hour = date.getHours(); |
| | | let minutes = date.getMinutes(); |
| | | let second = date.getSeconds(); |
| | | |
| | | return ( |
| | | year + |
| | | "." + |
| | | (month < 10 ? "0" + month : month) + |
| | | "." + |
| | | (day < 10 ? "0" + day : day) + //202.08.08ä¿®å¤æ¥æå¤©æ°å°äº10æ¶æ·»å 0 |
| | | "" + |
| | | " " + |
| | | (hour < 10 ? "0" + hour : hour) + |
| | | ":" + |
| | | (minutes < 10 ? "0" + minutes : minutes) + |
| | | ":" + |
| | | (second < 10 ? "0" + second : second) + |
| | | " " + //2020.08.30ä¿®å¤é¦é¡µæ¥æææå¤©ä¸æ¾ç¤ºçé®é¢ |
| | | (week[date.getDay() - 1] || week[6]) |
| | | ); |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .vol-container .vol-path ::v-deep(.el-tabs__content) { |
| | | padding: 0; |
| | | } |
| | | |
| | | .item { |
| | | margin-top: -20px; |
| | | margin-right: 40px; |
| | | } |
| | | |
| | | .contextMenu { |
| | | width: 120px; |
| | | margin: 0; |
| | | border: 1px solid #eaeaea; |
| | | background: #fff; |
| | | z-index: 30000; |
| | | position: absolute; |
| | | list-style-type: none; |
| | | padding: 5px 0; |
| | | border-radius: 4px; |
| | | font-size: 14px; |
| | | color: #333; |
| | | box-shadow: 2px 2px 3px 0 rgb(182 182 182 / 20%); |
| | | i, |
| | | button { |
| | | font-size: 14px !important; |
| | | } |
| | | } |
| | | |
| | | .contextMenu li { |
| | | margin: 0; |
| | | padding: 5px 17px; |
| | | } |
| | | |
| | | .contextMenu li:hover { |
| | | background: #fafafa; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .contextMenu li button { |
| | | color: #626060; |
| | | font-size: 14px; |
| | | letter-spacing: 1px; |
| | | } |
| | | |
| | | .el-tabs.el-tabs--top.el-tabs--border-card.header-navigation |
| | | > .el-tabs__header |
| | | .el-tabs__item:last-child, |
| | | .el-tabs--top.el-tabs--border-card.header-navigation |
| | | > .el-tabs__header |
| | | .el-tabs__item:nth-child(2) { |
| | | padding: 0; |
| | | } |
| | | |
| | | .header-navigation ::v-deep(.el-tabs__item.is-top) { |
| | | padding: 0 15px; |
| | | } |
| | | </style> |
| | | <style> |
| | | .horizontal-collapse-transition { |
| | | transition: 0s width ease-in-out, 0s padding-left ease-in-out, |
| | | 0s padding-right ease-in-out; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="login-container"> |
| | | <div class="project-name">WIDESEA_WMS</div> |
| | | <div class="login-form"> |
| | | <div class="form-user" @keypress="loginPress"> |
| | | <div class="login-text"> |
| | | <div> |
| | | <div>欢è¿ç»å½...</div> |
| | | <div class="login-line"></div> |
| | | </div> |
| | | <div style="flex:1;"></div> |
| | | </div> |
| | | <div class="login-text-small">WELCOME TO LOGIN</div> |
| | | <div class="item"> |
| | | <div class="input-icon el-icon-user"></div> |
| | | <input type="text" v-focus v-model="userInfo.userName" placeholder="请è¾å
¥è´¦å·" /> |
| | | </div> |
| | | <div class="item"> |
| | | <div class="input-icon el-icon-lock"></div> |
| | | <input type="password" v-focus v-model="userInfo.password" placeholder="请è¾å
¥å¯ç " /> |
| | | </div> |
| | | <div class="item"> |
| | | <div class="input-icon el-icon-mobile"></div> |
| | | |
| | | <input v-focus type="text" v-model="userInfo.verificationCode" placeholder="è¾å
¥éªè¯ç " /> |
| | | <div class="code" @click="getVierificationCode"> |
| | | <img v-show="codeImgSrc != ''" :src="codeImgSrc" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="loging-btn"> |
| | | <el-button size="large" :loading="loading" color="#3a6cd1" :dark="true" @click="login" long> |
| | | <span v-if="!loading">ç»å½</span> |
| | | <span v-else>æ£å¨ç»å½...</span> |
| | | </el-button> |
| | | </div> |
| | | |
| | | <!-- è´¦å·ä¿¡æ¯ --> |
| | | <!-- <div class="account-info"> |
| | | <p>æ¼ç¤ºè´¦å·ï¼admin666 å¯ç :123456</p> |
| | | <p>æ¬å°è´¦å·ï¼admin å¯ç :123456</p> |
| | | <p><a href="https://jq.qq.com/?_wv=1027&k=Sqstuy0M" style="text-decoration: none" |
| | | target="_blank">QQ3群:743852316</a> |
| | | |
| | | <a href="http://v2.volcore.xyz/document/guide" style="text-decoration: none" target="_blank">æ¡æ¶ææ¡£</a> |
| | | </p> |
| | | </div> --> |
| | | <!-- 龿¥ä½ç½® --> |
| | | <!-- <div class="app-link" > |
| | | <a href="#" style="text-decoration: none">ç§»å¨ç«¯æ«ç </a> |
| | | <a> |
| | | <i class="el-icon-chat-dot-round"></i> å°ç¨åº |
| | | <img src="https://app-1256993465.cos.ap-nanjing.myqcloud.com/wechat.jpg" /></a> |
| | | <a> |
| | | <i class="el-icon-apple"></i> |
| | | Android |
| | | <img src="https://app-1256993465.cos.ap-nanjing.myqcloud.com/Android.png" /></a> |
| | | <a> |
| | | <i class="el-icon-document"></i> |
| | | H5 |
| | | <img src="https://app-1256993465.cos.ap-nanjing.myqcloud.com/H5.png" /></a> |
| | | </div> --> |
| | | </div> |
| | | |
| | | <!-- 页é¢åºé¨ --> |
| | | <!-- <div class="login-footer"> |
| | | <a style="text-decoration: none" href="https://beian.miit.gov.cn/" target="_blank">京ICPå¤19056538å·-1</a> |
| | | |
| | | |
| | | <a href="https://dotnet9.com/" style="text-decoration: none" target="blank">Dotnet9</a> |
| | | <a href="https://space.bilibili.com/525836469" style="text-decoration: none" target="blank">NETè§é¢æç¨(微软MVP-ACEå½å¶)</a> |
| | | <a href="https://www.cctalk.com/m/group/90268531" style="text-decoration: none" target="blank">VOLæ¡æ¶è§é¢</a> |
| | | <a href="http://120.48.115.252:9990" style="text-decoration: none" target="blank">è§é¢æ¼ç¤ºå°å</a> |
| | | </div> --> |
| | | |
| | | <img class="login-bg" src="/static/login_bg.png" /> |
| | | </div> |
| | | </template> |
| | | |
| | | |
| | | <script > |
| | | import { |
| | | defineComponent, |
| | | ref, |
| | | reactive, |
| | | toRefs, |
| | | getCurrentInstance |
| | | } from 'vue'; |
| | | import { useRouter, useRoute } from 'vue-router'; |
| | | import store from '../store/index'; |
| | | import http from '@/../src/api/http.js'; |
| | | export default defineComponent({ |
| | | setup(props, context) { |
| | | store.commit('clearUserInfo', ''); |
| | | const loading = ref(false); |
| | | const codeImgSrc = ref(''); |
| | | const userInfo = reactive({ |
| | | userName: '', |
| | | password: '', |
| | | verificationCode: '', |
| | | UUID: undefined |
| | | }); |
| | | |
| | | const getVierificationCode = () => { |
| | | http.get('/api/User/getVierificationCode').then((x) => { |
| | | codeImgSrc.value = 'data:image/png;base64,' + x.img; |
| | | userInfo.UUID = x.uuid; |
| | | }); |
| | | }; |
| | | getVierificationCode(); |
| | | |
| | | let appContext = getCurrentInstance().appContext; |
| | | let $message = appContext.config.globalProperties.$message; |
| | | let router = useRouter(); |
| | | |
| | | const login = () => { |
| | | if (!userInfo.userName) return $message.error('请è¾å
¥ç¨æ·å'); |
| | | if (!userInfo.password) return $message.error('请è¾å
¥å¯ç '); |
| | | if (!userInfo.verificationCode) { |
| | | return $message.error('请è¾å
¥éªè¯ç '); |
| | | } |
| | | loading.value = true; |
| | | http.post('/api/User/login', userInfo, 'æ£å¨ç»å½....').then((result) => { |
| | | if (!result.status) { |
| | | loading.value = false; |
| | | getVierificationCode(); |
| | | return $message.error(result.message); |
| | | } |
| | | $message.success('ç»å½æå,æ£å¨è·³è½¬!'); |
| | | store.commit('setUserInfo', result.data); |
| | | router.push({ path: '/' }); |
| | | }); |
| | | }; |
| | | const loginPress = (e) => { |
| | | if (e.keyCode == 13) { |
| | | login(); |
| | | } |
| | | }; |
| | | const openUrl = (url) => { |
| | | window.open(url, '_blank'); |
| | | }; |
| | | return { |
| | | loading, |
| | | codeImgSrc, |
| | | getVierificationCode, |
| | | login, |
| | | userInfo, |
| | | loginPress, |
| | | openUrl |
| | | }; |
| | | }, |
| | | directives: { |
| | | focus: { |
| | | inserted: function (el) { |
| | | el.focus(); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .login-container { |
| | | display: flex; |
| | | width: 100%; |
| | | height: 100%; |
| | | background: rgb(246, 247, 252); |
| | | justify-content: flex-end; |
| | | align-items: center; |
| | | } |
| | | |
| | | .login-form { |
| | | align-items: center; |
| | | width: 50%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | // margin-right: 150px; |
| | | z-index: 999; |
| | | |
| | | .form-user { |
| | | // margin: 25px 0; |
| | | |
| | | .item { |
| | | border-radius: 5px; |
| | | border: 1px solid #ececec; |
| | | display: flex; |
| | | margin-bottom: 30px; |
| | | background: #ffff; |
| | | height: 45px; |
| | | padding-left: 20px; |
| | | display: flex; |
| | | |
| | | .code { |
| | | position: relative; |
| | | cursor: pointer; |
| | | width: 74px; |
| | | padding: 5px 10px 0 0; |
| | | } |
| | | |
| | | .input-icon { |
| | | line-height: 45px; |
| | | color: #7a7a7a; |
| | | padding-right: 20px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | input:-webkit-autofill { |
| | | box-shadow: 0 0 0px 1000px white inset; |
| | | -webkit-box-shadow: 0 0 0px 1000px white inset !important; |
| | | } |
| | | |
| | | input { |
| | | background: white; |
| | | display: block; |
| | | box-sizing: border-box; |
| | | width: 100%; |
| | | min-width: 0; |
| | | margin: 0; |
| | | padding: 0; |
| | | color: #323233; |
| | | line-height: inherit; |
| | | text-align: left; |
| | | border: 0; |
| | | outline: none; |
| | | font-size: 16px; |
| | | line-height: 20px; |
| | | } |
| | | } |
| | | |
| | | .form-user, |
| | | .loging-btn { |
| | | width: 400px; |
| | | } |
| | | |
| | | .loging-btn { |
| | | box-shadow: 2px 4px 11px #a4c2ff; |
| | | margin-top: 10px; |
| | | |
| | | button { |
| | | padding: 21px; |
| | | font-size: 14px !important; |
| | | width: 100%; |
| | | } |
| | | } |
| | | |
| | | .login-text { |
| | | font-weight: bolder; |
| | | font-size: 20px; |
| | | letter-spacing: 2px; |
| | | |
| | | position: relative; |
| | | display: flex; |
| | | |
| | | .login-line { |
| | | z-index: -1; |
| | | padding: 5px; |
| | | position: relative; |
| | | top: -8px; |
| | | width: 100%; |
| | | background-image: linear-gradient(to right, #6598ff, white); |
| | | } |
| | | } |
| | | |
| | | .login-text-small { |
| | | margin-bottom: 20px; |
| | | font-size: 13px; |
| | | color: #7d7c7c; |
| | | } |
| | | |
| | | .login-bg { |
| | | left: 0; |
| | | position: absolute; |
| | | height: 100%; |
| | | width: 50%; |
| | | z-index: 0; |
| | | } |
| | | |
| | | .project-name { |
| | | position: absolute; |
| | | top: 40px; |
| | | left: 40px; |
| | | z-index: 9999; |
| | | font-weight: bolder; |
| | | background-image: linear-gradient(to right, #1850c1, #9c009c); |
| | | -webkit-background-clip: text; |
| | | color: transparent; |
| | | font-size: 25px; |
| | | } |
| | | </style> |
| | | <style lang="less" scoped> |
| | | .app-link { |
| | | // font-weight: bolder; |
| | | text-align: center; |
| | | padding-top: 5px; |
| | | font-size: 12px; |
| | | width: 400px; |
| | | padding-left: 40px; |
| | | display: flex; |
| | | |
| | | a { |
| | | flex: 1; |
| | | position: relative; |
| | | cursor: pointer; |
| | | width: 70px; |
| | | color: #666666; |
| | | margin: 2px 10px 0 0; |
| | | } |
| | | |
| | | img { |
| | | display: none; |
| | | } |
| | | |
| | | a:hover { |
| | | color: #0545f6 !important; |
| | | |
| | | img { |
| | | display: block; |
| | | position: absolute; |
| | | z-index: 999999999; |
| | | top: -130px; |
| | | width: 120px; |
| | | left: -22px; |
| | | |
| | | border: 1px solid #b1b1b1; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .login-footer { |
| | | position: absolute; |
| | | width: 50%; |
| | | bottom: 0.5rem; |
| | | font-size: 12px; |
| | | text-align: center; |
| | | padding-bottom: 10px; |
| | | color: #4f4f4f; |
| | | |
| | | a { |
| | | margin-right: 10px; |
| | | font-size: 12px; |
| | | color: #4f4f4f; |
| | | } |
| | | |
| | | div { |
| | | margin-bottom: 5px; |
| | | } |
| | | |
| | | a:hover { |
| | | cursor: pointer; |
| | | color: #0540e3 !important; |
| | | } |
| | | } |
| | | |
| | | .account-info { |
| | | font-size: 12px; |
| | | color: #636363; |
| | | margin-top: 15px; |
| | | } |
| | | </style> |
| | | |
| | | <style lang="less" scoped> |
| | | @media screen and (max-width: 700px) { |
| | | |
| | | .login-bg, |
| | | .account-info, |
| | | .app-link, |
| | | .login-footer, |
| | | .project-name { |
| | | display: none; |
| | | } |
| | | |
| | | .login-container { |
| | | padding: 2rem; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .login-form { |
| | | width: 100%; |
| | | } |
| | | |
| | | .form-user, |
| | | .loging-btn { |
| | | width: 100%; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | <template> |
| | | <view-grid |
| | | ref="grid" |
| | | :columns="columns" |
| | | :detail="detail" |
| | | :editFormFields="editFormFields" |
| | | :editFormOptions="editFormOptions" |
| | | :searchFormFields="searchFormFields" |
| | | :searchFormOptions="searchFormOptions" |
| | | :table="table" |
| | | :extend="extend" |
| | | > |
| | | </view-grid> |
| | | </template> |
| | | <script> |
| | | import extend from "@/extension/basicinfo/router.js"; |
| | | import { ref, defineComponent } from "vue"; |
| | | export default defineComponent({ |
| | | setup() { |
| | | const table = ref({ |
| | | key: "id", |
| | | footer: "Foots", |
| | | cnName: "è·¯ç±é
置信æ¯", |
| | | name: "router", |
| | | url: "/Router/", |
| | | sortName: "createDate", |
| | | }); |
| | | const editFormFields = ref({ |
| | | // name: "", |
| | | // jobGroup: "", |
| | | // assemblyName: "", |
| | | // className: "", |
| | | // intervalSecond: "", |
| | | // beginTime: "", |
| | | // endTime: "", |
| | | // remark: "", |
| | | }); |
| | | const editFormOptions = ref([ |
| | | // [ |
| | | // { |
| | | // title: "ä»»å¡åç§°", |
| | | // required: true, |
| | | // field: "name", |
| | | // type: "string", |
| | | // }, |
| | | // { |
| | | // title: "ä»»å¡åç»", |
| | | // required: true, |
| | | // field: "jobGroup", |
| | | // type: "select", |
| | | // dataKey: "deviceType", |
| | | // data: [], |
| | | // }, |
| | | // { |
| | | // title: "ç¨åºéåç§°", |
| | | // required: true, |
| | | // field: "assemblyName", |
| | | // type: "string", |
| | | // type: "select", |
| | | // dataKey: "jobAssembly", |
| | | // data: [], |
| | | // }, |
| | | // { |
| | | // title: "任塿å¨ç±»", |
| | | // required: true, |
| | | // field: "className", |
| | | // type: "string", |
| | | // type: "select", |
| | | // dataKey: "jobClassName", |
| | | // data: [], |
| | | // }, |
| | | // ], |
| | | // [ |
| | | // { |
| | | // title: "é´éæ¶é´", |
| | | // required: true, |
| | | // field: "intervalSecond", |
| | | // type: "number", |
| | | // }, |
| | | // { |
| | | // title: "å¼å§æ¶é´", |
| | | // field: "beginTime", |
| | | // type: "datetime", |
| | | // }, |
| | | // { |
| | | // title: "ç»ææ¶é´", |
| | | // field: "endTime", |
| | | // type: "datetime", |
| | | // }, |
| | | // { |
| | | // title: "夿³¨", |
| | | // field: "remark", |
| | | // type: "string", |
| | | // }, |
| | | // ], |
| | | ]); |
| | | const searchFormFields = ref({ |
| | | startPosi: "", |
| | | nextPosi: "", |
| | | // assemblyName: "", |
| | | // className: "", |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { |
| | | title: "èµ·ç¹ä½ç½®", |
| | | field: "startPosi", |
| | | type: "like", |
| | | }, |
| | | { |
| | | title: "ç»ç¹ä½ç½®", |
| | | field: "nextPosi", |
| | | type: "like", |
| | | }, |
| | | // { |
| | | // title: "ç¨åºéåç§°", |
| | | // field: "assemblyName", |
| | | // type: "like", |
| | | // }, |
| | | // { |
| | | // title: "任塿å¨ç±»", |
| | | // field: "className", |
| | | // type: "like", |
| | | // }, |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | | { |
| | | field: "id", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "startPosi", |
| | | title: "èµ·ç¹ä½ç½®", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "nextPosi", |
| | | title: "ç»ç¹ä½ç½®", |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "inOutType", |
| | | title: "è·¯ç±ç±»å", |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "childPosi", |
| | | title: "åä½ç½®", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "childPosiDeviceCode", |
| | | title: "åä½ç½®æå±è®¾å¤", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "srmRow", |
| | | title: "å åæºåè´§/æ¾è´§è¡", |
| | | type: "int", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "srmColumn", |
| | | title: "å åæºåè´§/æ¾è´§å", |
| | | type: "int", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "srmLayer", |
| | | title: "å åæºåè´§/æ¾è´§å±", |
| | | type: "int", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "depth", |
| | | title: "深度", |
| | | type: "int", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "isEnd", |
| | | title: "æ¯å¦æ¯æç»ç¹", |
| | | type: "bool", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "creater", |
| | | title: "å建人", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "createDate", |
| | | title: "å建æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "modifier", |
| | | title: "ä¿®æ¹äºº", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "modifyDate", |
| | | title: "ä¿®æ¹æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "remark", |
| | | title: "夿³¨", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | ]); |
| | | const detail = ref({ |
| | | cnName: "", |
| | | table: "", |
| | | columns: [], |
| | | sortName: "", |
| | | key: "", |
| | | }); |
| | | return { |
| | | table, |
| | | extend, |
| | | editFormFields, |
| | | editFormOptions, |
| | | searchFormFields, |
| | | searchFormOptions, |
| | | columns, |
| | | detail, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | let columnType = [{ "key": 1, "value": "img" }, |
| | | { "key": 2, "value": "excel" }, |
| | | { "key": 3, "value": "file" }, |
| | | //2021.07.27å¢å tableåæ¾ç¤ºç±»ådate(èªå¨æ ¼å¼å) |
| | | { "key": 4, "value": "date" } |
| | | ] |
| | | |
| | | let dataType = [ |
| | | { "key": "text", "value": "input" }, |
| | | { "key": "textarea", "value": "textarea" }, |
| | | { "key": "switch", "value": "switch" }, |
| | | // { "key": "dropList", "value": "dropList" }, |
| | | { "key": "select", "value": "select" }, |
| | | { "key": "selectList", "value": "selectå¤é" }, |
| | | { "key": "date", "value": "date" }, |
| | | { "key": "datetime", "value": "datetime" }, |
| | | { "key": "month", "value": "å¹´ææ¥" }, |
| | | { "key": "rate", "value": "rateè¯å" }, |
| | | { "key": "time", "value": "time" }, |
| | | { "key": "checkbox", "value": "checkbox" }, |
| | | // 2021.05.16éæiview radioç»ä»¶ |
| | | { "key": "radio", "value": "radio" }, |
| | | { "key": "cascader", "value": "级è" },//2020.11.01å¢å 级èéæ© |
| | | { "key": "treeSelect", "value": "æ 形级ètree-select" },//2020.11.01å¢å 级èéæ© |
| | | { "key": "editor", "value": "坿æ¬ç¼è¾å¨" }, |
| | | { "key": "mail", "value": "mail" }, |
| | | { "key": "number", "value": "number" }, |
| | | { "key": "decimal", "value": "decimal" }, |
| | | { "key": "phone", "value": "phone" }, |
| | | { "key": "img", "value": "img" }, |
| | | { "key": "excel", "value": "excel" }, |
| | | { "key": "file", "value": "file" } |
| | | ]; |
| | | |
| | | let searchDataType = [ |
| | | { "key": "text", "value": "input" }, |
| | | { "key": "like", "value": "æ¨¡ç³æ¥è¯¢" }, |
| | | { "key": "textarea", "value": "textarea" }, |
| | | { "key": "switch", "value": "switch" }, |
| | | { "key": "select", "value": "select" }, |
| | | { "key": "selectList", "value": "selectå¤é" }, |
| | | { "key": "date", "value": "date" }, |
| | | { "key": "datetime", "value": "datetime" }, |
| | | { "key": "month", "value": "year_month" }, |
| | | { "key": "time", "value": "time" }, |
| | | { "key": "cascader", "value": "级è" },//2020.11.01å¢å 级èéæ© |
| | | { "key": "checkbox", "value": "checkbox" }, |
| | | // 2021.05.16éæiview radioç»ä»¶ |
| | | { "key": "radio", "value": "radio" }, |
| | | { "key": "range", "value": "åºé´æ¥è¯¢" }, |
| | | { "key": "mail", "value": "mail" }, |
| | | { "key": "number", "value": "number" }, |
| | | { "key": "decimal", "value": "decimal" }, |
| | | { "key": "phone", "value": "phone" } |
| | | ]; |
| | | let data = { |
| | | form: { |
| | | fields: { |
| | | table_Id: '', |
| | | parentId: null, |
| | | namespace: '', |
| | | columnCNName: '', |
| | | tableName: '', |
| | | tableTrueName: '', |
| | | folderName: '', |
| | | detailCnName: '', |
| | | detailName: '', |
| | | expressField: '', |
| | | sortName: '', |
| | | richtitle: '', |
| | | uploadField: '', |
| | | uploadMaxCount: '', |
| | | enable: 0, |
| | | vuePath: '', |
| | | appPath: "", |
| | | userPermissionDesc: 'å¼å¯åå½åç¨æ·åªè½æä½èªå·±(ä¸ä¸çº§è§è²)åå»ºçæ°æ®,å¦:æ¥è¯¢ãå é¤ãä¿®æ¹çæä½' |
| | | }, |
| | | addOptions: [ |
| | | [{ "title": "ç¶ çº§ ID", min: 0, "field": "parentId", "required": true, type: 'number', placeholder: 'æ¾å¨ã代ç çæé
ç½®ãå表çæä»¶å¤¹IDä¸,妿填å
¥ã0ãå°±æ¯ä¸çº§ç®å½' }], |
| | | [{ |
| | | "title": "项ç®ç±»åº", |
| | | "field": "namespace", |
| | | "placeholder": "代ç çæåçæå¨ç±»åº(å¯ä»¥èªå·±æåå¨åå°é¡¹ç®ä¸å建ä¸ä¸ª.netcoreç±»åº)", |
| | | "type": "select", |
| | | "required": true, |
| | | data: [] |
| | | }], |
| | | [{ "title": "è¡¨ä¸æå", "field": "columnCNName", "required": true, placeholder: "表对åºç䏿åå,çé¢ä¸æ¾ç¤ºä¼ç¨å°" }], |
| | | [{ "title": "å®é
表å", "field": "tableName", "required": true, placeholder: "æ°æ®åºå®é
表åæè
è§å¾å(å¤è¡¨å
³è请å建è§å¾åçæä»£ç )" }], |
| | | [{ "title": "æä»¶å¤¹å", placeholder: "çææä»¶æå¨ç±»åºä¸çæä»¶å¤¹å(æä»¶å¤¹å¯ä»¥ä¸åå¨);注æåªéè¦å¡«åæä»¶å¤¹åï¼ä¸æ¯è·¯å¾", "field": "folderName", "required": true }] |
| | | ], |
| | | options: [ |
| | | [ |
| | | { "title": "主 é® ID", "field": "table_Id", "dataSource": [], readonly: true, disabled: true, columnType: 'int' }, |
| | | { "title": "ç¶ çº§ ID", "field": "parentId", min: 0, "required": true, type: 'number' }, |
| | | { |
| | | "title": "项ç®ç±»åº", |
| | | "placeholder": "代ç çæåæ¾çä½ç½®", |
| | | "field": "namespace", |
| | | "type": "select", |
| | | "required": true, |
| | | data: [] |
| | | } |
| | | ], |
| | | [ |
| | | { "title": "è¡¨ä¸æå", "field": "columnCNName", "dataSource": [], "required": true }, |
| | | { "title": "表 å« å", placeholder: "é»è®¤ä¸å®é
表åç¸å", "field": "tableName", "required": true }, |
| | | { "title": "å®é
表å", "field": "tableTrueName" }, |
| | | |
| | | ], |
| | | [ |
| | | { "title": "æä»¶å¤¹å", placeholder: "çææä»¶æå¨ç±»åºä¸çæä»¶å¤¹å(æä»¶å¤¹å¯ä»¥ä¸åå¨)", "field": "folderName", "required": true }, |
| | | { "title": "æç»è¡¨å", "field": "detailCnName", placeholder: "æç»è¡¨ä¸æåå" }, |
| | | { "title": "æ ç» è¡¨", "field": "detailName", placeholder: "æ°æ®åºç表å" }, |
| | | |
| | | ], |
| | | [ |
| | | { "title": "å¿«æ·ç¼è¾", "field": "expressField", placeholder: "å¿«æ·ç¼è¾å段" }, |
| | | { "title": "æåºå段", "field": "sortName", "placeholder": "å¤ä¸ªæåºå段éå·éå¼(é»è®¤éåºæåº),å¦ï¼Name,Age", colSize: 8 }, |
| | | |
| | | // { "title": "è¿æ²¡æ³å¥½", "field": "richtitle" } |
| | | ], |
| | | [{ "title": "Vueè·¯å¾", "field": "vuePath", type: "text", placeholder: 'Vueé¡¹ç®æå¨ç»å¯¹è·¯å¾,å°viewsæä»¶å¤¹,å¦ï¼E:/app/src/views', colSize: 12 }, |
| | | // { "title": "appè·¯å¾", "field": "appPath", type: "text", placeholder: 'uniappé¡¹ç®æå¨ç»å¯¹è·¯å¾,å°pagesæä»¶å¤¹,å¦ï¼E:/uniapp/pages', colSize: 6 } |
| | | ] |
| | | // [ //å¾
å® |
| | | // { "title": "å¼å¯ç¨æ·æéæ°æ®", "field": "enable", bind: { data: [{ key: 1, value: 'æ¯', key: 0, value: 'å¦' }] }, type: 'switch', colSize: 2 }, |
| | | // { "title": "æç¤º", "required": true, "field": "userPermissionDesc", colSize: 10, "placeholder": "éèªå¢ä¸»é®éè¦è¾å
¥æåºå段",readonly:true } |
| | | // ], |
| | | // [ |
| | | |
| | | // ], |
| | | // [ |
| | | // { "title": "坿æ¬ç¼è¾å段", "field": "richtitle", "displayType": "title" }, |
| | | // { "title": "æä»¶ä¸ä¼ åæ®µ", "field": "uploadField", "displayType": "title" }, |
| | | // { "title": "æä»¶ä¸ä¼ æ°ééå¶", "field": "uploadMaxCount", "displayType": "title", columnType: 'int' } |
| | | // ], |
| | | // [ |
| | | // { "title": "Vueè§å¾ç»å¯¹è·¯å¾", "field": "vuePath", "displayType": "title", colSize: 12, placeholder: 'Vueé¡¹ç®æå¨ç»å¯¹è·¯å¾,å°viewsæä»¶å¤¹,å¦ï¼E:/app/src/views' }, |
| | | // ] |
| | | ] |
| | | }, |
| | | //2021.01.09å¢å 代ç çæå¨è®¾ç½®tableæåºåè½ |
| | | columns: [ |
| | | { field: 'columnId', title: 'ColumnId', width: 120, align: 'left', edit: { type: "text" }, hidden: true }, |
| | | { field: 'table_Id', title: 'Table_Id', width: 120, align: 'left', editor: 'text', hidden: true }, |
| | | { field: 'columnCnName', title: 'åæ¾ç¤ºåç§°', fixed: true, width: 120, align: 'left', edit: { type: "text" } }, |
| | | { field: 'columnName', title: 'åå', fixed: true, width: 120, align: 'left', edit: { type: "text" } }, |
| | | { field: 'isKey', title: '主é®', width: 90, align: 'left', edit: { type: "switch" } }, |
| | | { field: 'sortable', title: 'æ¯å¦æåº', width: 90, align: 'left', edit: { type: "switch", keep: true } }, |
| | | { |
| | | field: 'enable', title: 'appå', width: 140, align: 'left', edit: { type: "select" }, |
| | | bind: { |
| | | data: [ |
| | | { key: 1, value: "æ¾ç¤º/æ¥è¯¢/ç¼è¾" }, |
| | | { key: 2, value: "æ¾ç¤º/ç¼è¾" }, |
| | | { key: 3, value: "æ¾ç¤º/æ¥è¯¢" }, |
| | | { key: 4, value: "æ¾ç¤º" }, |
| | | { key: 5, value: "æ¥è¯¢/ç¼è¾" }, |
| | | { key: 6, value: "æ¥è¯¢" }, |
| | | { key: 7, value: "ç¼è¾" }, |
| | | ] |
| | | } |
| | | }, |
| | | { field: 'searchRowNo', title: 'æ¥è¯¢è¡', width: 90, align: 'left', edit: { type: "text" } }, |
| | | { field: 'searchColNo', title: 'æ¥è¯¢å', width: 90, align: 'left', edit: { type: "text" } }, |
| | | { field: 'searchType', title: 'æ¥è¯¢ç±»å', width: 150, align: 'left', edit: { type: "select" }, bind: { data: searchDataType } }, |
| | | { field: 'editRowNo', title: 'ç¼è¾è¡', width: 90, align: 'numberbox', edit: { type: "text" } }, |
| | | { field: 'editColNo', title: 'ç¼è¾å', width: 90, align: 'numberbox', edit: { type: "text" } }, |
| | | { field: 'editType', title: 'ç¼è¾ç±»å', width: 150, align: 'left', edit: { type: "select" }, bind: { data: dataType } }, |
| | | { field: 'dropNo', title: 'æ°æ®æº', width: 120, align: 'left', bind: { data: [] }, edit: { type: "select", data: [] } }, |
| | | { field: 'isImage', title: 'tableåæ¾ç¤ºç±»å', hidden: false, width: 130, align: 'left', edit: { type: "select" }, bind: { data: columnType } }, |
| | | { field: 'orderNo', title: 'åæ¾ç¤ºé¡ºåº', width: 120, align: 'left', edit: { type: "text" } }, |
| | | { field: 'maxlength', title: 'åæ®µæå¤§é¿åº¦', width: 130, align: 'left', edit: { type: "text" } }, |
| | | { field: 'columnType', title: 'æ°æ®ç±»å', width: 120, align: 'left', edit: { type: "text" } }, |
| | | { field: 'isNull', title: 'å¯ä¸ºç©º', width: 120, align: 'left', edit: { type: "switch", keep: true } }, |
| | | { field: 'isReadDataset', title: 'æ¯å¦åªè¯»', width: 120, align: 'left', edit: { type: "switch", keep: true } }, |
| | | { field: 'isColumnData', title: 'æ°æ®å', width: 120, align: 'left', edit: { type: "switch", keep: true } }, |
| | | { field: 'isDisplay', title: 'æ¯å¦æ¾ç¤º', width: 120, align: 'left', edit: { type: "switch", keep: true } }, |
| | | { field: 'columnWidth', title: 'tableå宽度', width: 120, align: 'left', edit: { type: "text" } }, |
| | | { field: 'colSize', title: 'ç¼è¾åæ ç¾å®½åº¦colSize', width: 180, align: 'left', edit: { type: "text" } }, |
| | | // { field: 'import', title: '导å
¥å', hidden: true, width: 100, align: 'left', edit: { type: "switch" } }, |
| | | // { field: 'apiInPut', title: 'Apiè¾å
¥å(å¾
å®ç°)', width: 100, align: 'left', edit: { type: "switch" } }, |
| | | // { field: 'apiIsNull', title: 'Apiè¾å
¥åå¯ä¸ºç©º(å¾
å®ç°)', width: 130, align: 'left', edit: { type: "switch" } }, |
| | | // { field: 'apiOutPut', title: 'Apiè¾åºå(å¾
å®ç°)', width: 100, align: 'left', edit: { type: "switch" } }, |
| | | // { field: 'columnformat', title: 'æ¾ç¤ºæ ¼å¼', width: 120, align: 'left', editor: 'text', editor: 'textarea' }, |
| | | // { field: 'script', title: 'èæ¬', width: 120, align: 'left', editor: 'textarea' }, |
| | | // { field: 'creator', title: 'å建人', width: 120, align: 'left' }, |
| | | { field: 'createDate', title: 'å建æ¶é´', width: 120, align: 'left' }, |
| | | // { field: 'modifier', title: 'ä¿®æ¹äºº', width: 120, align: 'left' }, |
| | | // { field: 'modifyDate', title: 'ä¿®æ¹æ¶é´', width: 120, align: 'left' } |
| | | ] |
| | | } |
| | | |
| | | export default data |
项目代码/WCS/WIDESEAWCS_Client/src/views/builder/coder.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/bigdata.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/bigdata/IviewCircle.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/bigdata/chart-options.js
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/bigdata/head_bg.png
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/bigdata/layout.less
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/chart.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/chartOptions.js
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/flex.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/formChart.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/charts/formOptions.js
项目代码/WCS/WIDESEAWCS_Client/src/views/home/home-chart-options.js
项目代码/WCS/WIDESEAWCS_Client/src/views/index/Message.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/index/MessageConfig.js
项目代码/WCS/WIDESEAWCS_Client/src/views/index/index.less
项目代码/WCS/WIDESEAWCS_Client/src/views/quartzJob/deviceInfo.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/quartzJob/deviceProtocol.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/quartzJob/deviceProtocolDetail.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/quartzJob/dispatchInfo.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/Permission.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/Permission/RoleTree.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/Sys_Dictionary.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/Sys_DictionaryList.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/Sys_Log.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/Sys_Menu.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/Sys_Role.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/Sys_Role1.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/Sys_User.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/UserInfo.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/system/Sys_Department.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/system/test.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/taskinfo/task.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/wmsPart/locationInfo.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/wmsPart/stockInfo.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/wmsPart/stockInfoDetail.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/wmsPart/stockInfoDetail_Hty.vue
项目代码/WCS/WIDESEAWCS_Client/src/views/wmsPart/stockInfo_Hty.vue
项目代码/WCS/WIDESEAWCS_Client/tests/unit/example.spec.js
项目代码/WCS/WIDESEAWCS_Client/vue.config.js
项目代码/WCS/WIDESEAWCS_Client/yarn.lock
项目代码/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/v17/DocumentLayout.backup.json
项目代码/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/v17/DocumentLayout.json
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Log.cs
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/WIDESEAWCS_DB.DBSeed.Json/Dt_DeviceInfo.tsv
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/WIDESEAWCS_DB.DBSeed.Json/Dt_DispatchInfo.tsv |