批处理前端
This commit is contained in:
		
							parent
							
								
									916cf4ced3
								
							
						
					
					
						commit
						f4f946a00d
					
				
							
								
								
									
										28
									
								
								com.actionsoft.apps.coe.pal.batch/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								com.actionsoft.apps.coe.pal.batch/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | ||||
| .DS_Store | ||||
| node_modules | ||||
| # awsDevParams.js | ||||
| /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? | ||||
| 
 | ||||
| .history/* | ||||
| 
 | ||||
| # Doc | ||||
| ~$* | ||||
| .~* | ||||
							
								
								
									
										27
									
								
								com.actionsoft.apps.coe.pal.batch/AWSDevParams.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								com.actionsoft.apps.coe.pal.batch/AWSDevParams.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | ||||
| module.exports = { | ||||
| 	AWSPortalUrl: "http://localhost:8088/portal/",//aws平台启动地址,用于开发时获取平台静态资源,请求数据等(注意最后的/,不要删)
 | ||||
| 	AWSReleasePath: "/Users/sunlh/idea-workspace-aws6/release/", /*C:/work/workspace/release/*/  //aws的平台路径,暂时写绝对路径,用于build生成的主文件位置(注意最后的/,不要删)
 | ||||
| 	moduleTemplateInAWS: "apps/install/com.actionsoft.apps.coe.pal.batch/template/page/main.htm", /*apps/install/_bpm.platform/template/page/console.m.dw.design.vue.htm*/ //build后生成到平台的模板位置及名称
 | ||||
| 	outputDir: "apps/install/com.actionsoft.apps.coe.pal.batch/web/com.actionsoft.apps.coe.pal.batch/main", /*webserver/webapps/portal/apps/_bpm.platform/dw/designer/main*/ //build后js或css生成到平台的位置
 | ||||
| 	publicPath: "../apps/com.actionsoft.apps.coe.pal.batch/main", /*../apps/_bpm.platform/dw/designer/main*/ //build到平台后生成到模板中,引入js文件的相对平台的位置
 | ||||
| 	AWSJSAndCSSImport: [  //引入平台的js或css,在portal目录开始,开发或build通用
 | ||||
| 		/* | ||||
| 		// 示例
 | ||||
| 		{ | ||||
| 			type: "js", | ||||
| 			path: "commons/js/util/Base64.js" | ||||
| 		}, | ||||
| 		{ | ||||
| 			type: "css", | ||||
| 			path: "commons/css/font/iconfont.css" | ||||
| 		}, | ||||
| 		*/ | ||||
| 
 | ||||
| 	], | ||||
| 	devUserInfo: {//开发时通过用户名及密码获取sessionId,!!前提必须需要安装并启动app:com.actionsoft.apps.getsession.app
 | ||||
| 		userid: "admin", //具有后台管理的用户名
 | ||||
| 		pwd: "admin", //密码
 | ||||
| 		deviceType: "pc", | ||||
| 		systemType: "C" | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										24
									
								
								com.actionsoft.apps.coe.pal.batch/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								com.actionsoft.apps.coe.pal.batch/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | ||||
| # dataviewsetting | ||||
| 
 | ||||
| ## Project setup | ||||
| ``` | ||||
| yarn install | ||||
| ``` | ||||
| 
 | ||||
| ### Compiles and hot-reloads for development | ||||
| ``` | ||||
| yarn serve | ||||
| ``` | ||||
| 
 | ||||
| ### Compiles and minifies for production | ||||
| ``` | ||||
| yarn build | ||||
| ``` | ||||
| 
 | ||||
| ### Lints and fixes files | ||||
| ``` | ||||
| yarn lint | ||||
| ``` | ||||
| 
 | ||||
| ### Customize configuration | ||||
| See [Configuration Reference](https://cli.vuejs.org/config/). | ||||
							
								
								
									
										5
									
								
								com.actionsoft.apps.coe.pal.batch/babel.config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								com.actionsoft.apps.coe.pal.batch/babel.config.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| module.exports = { | ||||
|   presets: [ | ||||
|     '@vue/cli-plugin-babel/preset' | ||||
|   ] | ||||
| } | ||||
							
								
								
									
										96593
									
								
								com.actionsoft.apps.coe.pal.batch/lib/awsui-vue.common.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96593
									
								
								com.actionsoft.apps.coe.pal.batch/lib/awsui-vue.common.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								com.actionsoft.apps.coe.pal.batch/lib/awsui-vue.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								com.actionsoft.apps.coe.pal.batch/lib/awsui-vue.css
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										96603
									
								
								com.actionsoft.apps.coe.pal.batch/lib/awsui-vue.umd.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96603
									
								
								com.actionsoft.apps.coe.pal.batch/lib/awsui-vue.umd.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										22
									
								
								com.actionsoft.apps.coe.pal.batch/lib/awsui-vue.umd.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								com.actionsoft.apps.coe.pal.batch/lib/awsui-vue.umd.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										10
									
								
								com.actionsoft.apps.coe.pal.batch/lib/demo.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								com.actionsoft.apps.coe.pal.batch/lib/demo.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | ||||
| <meta charset="utf-8"> | ||||
| <title>awsui-vue demo</title> | ||||
| <script src="./awsui-vue.umd.js"></script> | ||||
| 
 | ||||
| <link rel="stylesheet" href="./awsui-vue.css"> | ||||
| 
 | ||||
| 
 | ||||
| <script> | ||||
| console.log(awsui-vue) | ||||
| </script> | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										2447
									
								
								com.actionsoft.apps.coe.pal.batch/lib/src/img/iconfont.ce1b01d3.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2447
									
								
								com.actionsoft.apps.coe.pal.batch/lib/src/img/iconfont.ce1b01d3.svg
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| After Width: | Height: | Size: 1.2 MiB | 
							
								
								
									
										50
									
								
								com.actionsoft.apps.coe.pal.batch/package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								com.actionsoft.apps.coe.pal.batch/package.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | ||||
| { | ||||
|   "name": "com.actionsoft.apps.coe.pal.batch", | ||||
|   "version": "0.1.0", | ||||
|   "private": true, | ||||
|   "scripts": { | ||||
|     "serve": "vue-cli-service serve", | ||||
|     "build": "vue-cli-service build", | ||||
|     "lint": "vue-cli-service lint" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "axios": "^0.20.0", | ||||
|     "codemirror": "^5.61.1", | ||||
|     "core-js": "^3.12.1", | ||||
|     "element-ui": "^2.15.1", | ||||
|     "vue": "^2.6.12", | ||||
|     "vue-codemirror": "^4.0.6", | ||||
|     "vue-router": "^3.5.1", | ||||
|     "vuex": "^3.6.2" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@vue/cli-plugin-babel": "~4.4.0", | ||||
|     "@vue/cli-plugin-eslint": "~4.4.0", | ||||
|     "@vue/cli-plugin-router": "~4.4.0", | ||||
|     "@vue/cli-plugin-vuex": "~4.4.0", | ||||
|     "@vue/cli-service": "~4.4.0", | ||||
|     "babel-eslint": "^10.1.0", | ||||
|     "eslint": "^6.7.2", | ||||
|     "eslint-plugin-vue": "^6.2.2", | ||||
|     "vue-template-compiler": "^2.6.11" | ||||
|   }, | ||||
|   "eslintConfig": { | ||||
|     "root": true, | ||||
|     "env": { | ||||
|       "node": true | ||||
|     }, | ||||
|     "extends": [ | ||||
|       "plugin:vue/essential", | ||||
|       "eslint:recommended" | ||||
|     ], | ||||
|     "parserOptions": { | ||||
|       "parser": "babel-eslint" | ||||
|     }, | ||||
|     "rules": {} | ||||
|   }, | ||||
|   "browserslist": [ | ||||
|     "> 1%", | ||||
|     "last 2 versions", | ||||
|     "not dead" | ||||
|   ] | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								com.actionsoft.apps.coe.pal.batch/public/favicon.ico
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								com.actionsoft.apps.coe.pal.batch/public/favicon.ico
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 4.2 KiB | 
							
								
								
									
										57
									
								
								com.actionsoft.apps.coe.pal.batch/public/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								com.actionsoft.apps.coe.pal.batch/public/index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,57 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="en"> | ||||
|   <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"> | ||||
|     <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||||
|     <title><%= htmlWebpackPlugin.options.title %></title> | ||||
|     <%= htmlWebpackPlugin.options.AWSJSAndCSSImport %> | ||||
|     <!-- | ||||
|       其它的js或css引用方式示例(<%= htmlWebpackPlugin.options.awsjsandcsspath%>) | ||||
|       <link rel="stylesheet" type="text/css" href="<%= htmlWebpackPlugin.options.awsjsandcsspath%>apps/_bpm.platform/css/model/console.m.dw.design.css"/> | ||||
|     --> | ||||
|     <script> | ||||
|       const settingParam = <%= htmlWebpackPlugin.options.settingParam %>; | ||||
|       const axiosBaseUrl = "<%= htmlWebpackPlugin.options.axiosBaseUrl %>"; | ||||
|       const production = <%= htmlWebpackPlugin.options.isproduction %>; | ||||
|     </script> | ||||
|   <% if(!htmlWebpackPlugin.options.isproduction) {%> | ||||
|     <script> | ||||
|       const devUserInfo = <%= JSON.stringify(htmlWebpackPlugin.options.devUserInfo) %>; | ||||
|     </script> | ||||
|   <%  }%> | ||||
|     <script> | ||||
|       <% if(!htmlWebpackPlugin.options.isproduction) {%> | ||||
|         var mainPage = 'replace';// create 批量创建   replace 批量替换 | ||||
|         var wsId = 'f391f672-100b-4d4b-89d1-ba1b4b3d0132'; | ||||
|         var teamId = ''; | ||||
|         var methodCategory = 'process'; | ||||
|         var appId = 'com.actionsoft.apps.coe.pal.batch'; | ||||
|         var repositoryName = 'tmp'; | ||||
|         var groupValue = 'upload'; | ||||
|         var processFileValue = '1234'; | ||||
|         var shapeFileValue = '5678'; | ||||
|         var palId = '241e1259-2bf9-4e33-a362-bb94b7ec27b7';// 流程id,不为空则为设计器内单只流程形状属性替换 | ||||
|         var wHref = "http://localhost:8088/portal/r/w"; | ||||
|         var jdHref = "http://localhost:8088/portal/r/jd"; | ||||
|       <%}else {%> | ||||
|         var mainPage = '<#mainPage>';// create 批量创建   replace 批量替换 | ||||
|         var wsId = '<#wsId>'; | ||||
|         var teamId = '<#teamId>'; | ||||
|         var methodCategory = '<#methodCategory>'; | ||||
|         var appId = '<#appId>'; | ||||
|         var repositoryName = '<#repositoryName>'; | ||||
|         var groupValue = '<#groupValue>'; | ||||
|         var processFileValue = '<#processFileValue>'; | ||||
|         var shapeFileValue = '<#shapeFileValue>'; | ||||
|         var palId = '<#palId>';// 流程id,不为空则为设计器内单只流程形状属性替换 | ||||
|         var wHref = "./w"; | ||||
|         var jdHref = "./jd"; | ||||
|       <%}%> | ||||
|     </script> | ||||
|   </head> | ||||
|   <body style="margin:0;"> | ||||
|     <div id="app"></div> | ||||
|   </body> | ||||
| </html> | ||||
							
								
								
									
										27
									
								
								com.actionsoft.apps.coe.pal.batch/src/App.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								com.actionsoft.apps.coe.pal.batch/src/App.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | ||||
| <template> | ||||
|   <div id="app"> | ||||
|     <router-view /> | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
| <style> | ||||
| #app { | ||||
|   font-family: Avenir, Helvetica, Arial, sans-serif; | ||||
|   -webkit-font-smoothing: antialiased; | ||||
|   -moz-osx-font-smoothing: grayscale; | ||||
|   color: #2c3e50; | ||||
| } | ||||
| 
 | ||||
| #nav { | ||||
|   padding: 30px; | ||||
| } | ||||
| 
 | ||||
| #nav a { | ||||
|   font-weight: bold; | ||||
|   color: #2c3e50; | ||||
| } | ||||
| 
 | ||||
| #nav a.router-link-exact-active { | ||||
|   color: #42b983; | ||||
| } | ||||
| </style> | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| After Width: | Height: | Size: 158 KiB | 
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								com.actionsoft.apps.coe.pal.batch/src/assets/logo.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								com.actionsoft.apps.coe.pal.batch/src/assets/logo.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 6.7 KiB | 
							
								
								
									
										109
									
								
								com.actionsoft.apps.coe.pal.batch/src/awsuiAxios/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								com.actionsoft.apps.coe.pal.batch/src/awsuiAxios/index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,109 @@ | ||||
| import axios from 'axios' | ||||
| import store from '../store' | ||||
| // 创建axios请求实例
 | ||||
| // const request = axios.create({
 | ||||
| //     baseURL: axiosBaseUrl, 
 | ||||
| //     timeout: 1000,
 | ||||
| //     headers: {
 | ||||
| //         'Content-Type': 'application/json; charset=utf-8'
 | ||||
| //     }
 | ||||
| // })
 | ||||
| axios.defaults.baseURL = typeof axiosBaseUrl == "undefined" ? "" : axiosBaseUrl; // 设置跨域代理接口统一的前置地址
 | ||||
| axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'; | ||||
| 
 | ||||
| // 添加请求拦截器
 | ||||
| axios.interceptors.request.use(function (request) { | ||||
|     // 在发送请求之前做些什么
 | ||||
|     if(request.method == 'post'){ | ||||
|         request.params = {}; | ||||
|     } | ||||
|     return request | ||||
| }, function (error) { | ||||
|     // 对请求错误做些什么
 | ||||
|     return Promise.reject(error) | ||||
| }) | ||||
| 
 | ||||
| // 添加响应拦截器
 | ||||
| axios.interceptors.response.use(function (response) { | ||||
|     // 只返回数据
 | ||||
|     return response.data | ||||
| }, function (error) { | ||||
|     if(error.response == null){ | ||||
|         throw error; | ||||
|     } | ||||
|     const status = error.response.status | ||||
|     if (status >= 500) { | ||||
|         alert('服务繁忙请稍后再试') | ||||
|     } else if (status >= 400) { | ||||
|         alert(error.response.data.message) | ||||
|     } | ||||
|     // 对响应错误做点什么
 | ||||
|     console.dir(error) | ||||
|     return Promise.reject(error) | ||||
| }) | ||||
| 
 | ||||
| function _toChangeData(data){ | ||||
|     let dataArray = []; | ||||
|     for(let key in data){ | ||||
|         dataArray.push(encodeURIComponent(key)+"="+encodeURIComponent(data[key])); | ||||
|     } | ||||
|     return dataArray.join("&"); | ||||
| } | ||||
| 
 | ||||
| //可能需要更改,暂时用不到
 | ||||
| const get = (params) => { | ||||
| 
 | ||||
|     return axios({ | ||||
|         method: "get", | ||||
|         url: params.url, | ||||
|         params: params.params | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| const post = (params) => { | ||||
|     let postConfig = { | ||||
|         method: "post", | ||||
|         url: params.url, | ||||
|         data: params.data | ||||
|     } | ||||
|     //从vuex中获取sessionId
 | ||||
|     postConfig.data.sid = store.state.sessionId; | ||||
|     postConfig.data = _toChangeData(postConfig.data); | ||||
|     return axios(postConfig); | ||||
| } | ||||
| 
 | ||||
| const aslp = (params) => { | ||||
|     // {
 | ||||
|     //     portalUrl : "",
 | ||||
|     //     authentication : store.state.sessionId,
 | ||||
|     //     sourceAppId : "appid",
 | ||||
|     //     aslp : "aslp://XXXX",
 | ||||
|     //     params :{
 | ||||
|     //         aa:1,
 | ||||
|     //         bb:2
 | ||||
|     //     }
 | ||||
|     // }
 | ||||
|     let datas = { | ||||
|         authentication : store.state.sessionId, | ||||
|         sourceAppId : params.sourceAppId, | ||||
|         aslp : params.aslp, | ||||
|     } | ||||
|     Object.assign(datas,params.params) | ||||
|     let postConfig = { | ||||
|         method: "post", | ||||
|         url: params.portalUrl, | ||||
|         params: datas | ||||
|     } | ||||
|     postConfig.data = _toChangeData(postConfig.data); | ||||
|     return axios(postConfig); | ||||
| } | ||||
| // const delete = (url, data) => request.delete(url, data)
 | ||||
| // const head = (url, data) => request.head(url, data)
 | ||||
| // const options = (url, data) => request.options(url, data)
 | ||||
| // const put = (url, data) => request.put(url, data)
 | ||||
| // const patch = (url, data) => request.patch(url, data)
 | ||||
| export default { | ||||
|     get, | ||||
|     post, | ||||
|     aslp | ||||
| } | ||||
| @ -0,0 +1,62 @@ | ||||
| <!-- 示例,可删除 --> | ||||
| <template> | ||||
|   <div class="hello"> | ||||
|     <h1>{{ msg }}</h1> | ||||
|     <p> | ||||
|       For a guide and recipes on how to configure / customize this project,<br> | ||||
|       check out the | ||||
|       <a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>. | ||||
|     </p> | ||||
|     <h3>Installed CLI Plugins</h3> | ||||
|     <ul> | ||||
|       <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" | ||||
|           rel="noopener">babel</a></li> | ||||
|       <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" | ||||
|           rel="noopener">eslint</a></li> | ||||
|     </ul> | ||||
|     <h3>Essential Links</h3> | ||||
|     <ul> | ||||
|       <li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li> | ||||
|       <li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li> | ||||
|       <li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li> | ||||
|       <li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li> | ||||
|       <li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li> | ||||
|     </ul> | ||||
|     <h3>Ecosystem</h3> | ||||
|     <ul> | ||||
|       <li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li> | ||||
|       <li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li> | ||||
|       <li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a> | ||||
|       </li> | ||||
|       <li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li> | ||||
|       <li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li> | ||||
|     </ul> | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| export default { | ||||
|   name: "HelloWorld", | ||||
|   props: { | ||||
|     msg: String, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| 
 | ||||
| <!-- Add "scoped" attribute to limit CSS to this component only --> | ||||
| <style scoped> | ||||
| h3 { | ||||
|   margin: 40px 0 0; | ||||
| } | ||||
| ul { | ||||
|   list-style-type: none; | ||||
|   padding: 0; | ||||
| } | ||||
| li { | ||||
|   display: inline-block; | ||||
|   margin: 0 10px; | ||||
| } | ||||
| a { | ||||
|   color: #42b983; | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										23
									
								
								com.actionsoft.apps.coe.pal.batch/src/main.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								com.actionsoft.apps.coe.pal.batch/src/main.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| import Vue from 'vue' | ||||
| import App from './App.vue' | ||||
| import router from './router' | ||||
| import store from './store' | ||||
| // awsui-vue lib,已包含element-ui
 | ||||
| import Awsui from '../lib/awsui-vue.umd.min' | ||||
| import '../lib/awsui-vue.css' | ||||
| import '../static/common/common.css'; | ||||
| import '../static/common/theme1.css';// 主题颜色配置
 | ||||
| import './assets/iconfont/iconfont.css'; | ||||
| import VueCodeMirror from 'vue-codemirror'; | ||||
| import 'codemirror/lib/codemirror.css'; | ||||
| Vue.use(VueCodeMirror) | ||||
| 
 | ||||
| Vue.config.productionTip = false | ||||
| Vue.use(Awsui) | ||||
| new Vue({ | ||||
|   router, | ||||
|   store, | ||||
|   render: h => { | ||||
|     return h(App); | ||||
|   }, | ||||
| }).$mount('#app') | ||||
							
								
								
									
										66
									
								
								com.actionsoft.apps.coe.pal.batch/src/router/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								com.actionsoft.apps.coe.pal.batch/src/router/index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,66 @@ | ||||
| import Vue from 'vue' | ||||
| import VueRouter from 'vue-router' | ||||
| import store from '../store' | ||||
| 
 | ||||
| Vue.use(VueRouter) | ||||
| 
 | ||||
| const routes = [ | ||||
|   { | ||||
|     path: '/devGetSession',  //开发时获取session作用
 | ||||
|     name: 'devGetSession', | ||||
|     component: () => import('../views/DevGetSession.vue') | ||||
|   }, | ||||
|   { | ||||
|     path: '/create', | ||||
|     name: 'create', | ||||
|     component: () => import('../views/create/create') | ||||
|   }, | ||||
|   { | ||||
|     path: '/replace', | ||||
|     name: 'replace', | ||||
|     component: () => import('../views/replace/replace') | ||||
|   } | ||||
| ] | ||||
| 
 | ||||
| const router = new VueRouter({ | ||||
|   routes | ||||
| }) | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
|  * to 表示将要跳转到的组件 (目标组件) | ||||
|  * console.log(from); //(源组件)
 | ||||
|  * next(); | ||||
|  * next 是一个函数 | ||||
|  * next() 进入下一个组件的钩子函数 | ||||
|  * next(false) 阻止跳转 中断导航 | ||||
|  * next("/login") 进入指定的组件的钩子函数 | ||||
|  */ | ||||
| // 路由守卫
 | ||||
| router.beforeEach((to, from, next) => { | ||||
|   if (production === false && store.state.sessionId == null && to.path != "/devGetSession") { | ||||
|     //进入一个路由获取session,获取session后再进入主入口
 | ||||
|     next("/devGetSession"); | ||||
|   } else { | ||||
|     //跳转前设置title
 | ||||
|     //window.document.title = to.meta.title;
 | ||||
|     if (store.state.mainPage == 'create') { | ||||
|       store.commit("edit", { mainPage: Math.random() }); | ||||
|       next('/create'); | ||||
|     } else if (store.state.mainPage == 'replace') { | ||||
|       store.commit("edit", { mainPage: Math.random() }); | ||||
|       next('/replace'); | ||||
|     } else { | ||||
|       next(); | ||||
|     } | ||||
|     // next();
 | ||||
|   } | ||||
|   //to.matched.some(res=>{res.meta.isLogin}) 能够获取路由配置的参数
 | ||||
| 
 | ||||
| }); | ||||
| 
 | ||||
| //跳转后设置scroll为原点
 | ||||
| router.afterEach((to, from, next) => { | ||||
|   window.scrollTo(0, 0); | ||||
| }); | ||||
| export default router | ||||
							
								
								
									
										22
									
								
								com.actionsoft.apps.coe.pal.batch/src/store/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								com.actionsoft.apps.coe.pal.batch/src/store/index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| import Vue from 'vue' | ||||
| import Vuex from 'vuex' | ||||
| 
 | ||||
| Vue.use(Vuex) | ||||
| 
 | ||||
| export default new Vuex.Store({ | ||||
|   state: { | ||||
|     sessionId: settingParam.sessionId, | ||||
|     mainPage: mainPage | ||||
|   }, | ||||
|   mutations: { | ||||
|     edit(state, data) { | ||||
|       for (let p in data) { | ||||
|         state[p] = data[p]; | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   actions: { | ||||
|   }, | ||||
|   modules: { | ||||
|   } | ||||
| }) | ||||
| @ -0,0 +1,71 @@ | ||||
| <!-- 获取session方法,不可删除 --> | ||||
| <template> | ||||
|   <div class="devGetSession"> | ||||
|     正在获取session | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| import router from "../router/index"; | ||||
| import awsuiAxios from "../awsuiAxios/index"; | ||||
| import store from "../store/index"; | ||||
| /* | ||||
| 获取控制台用户会话,注意如果使用是控制台移动端会话,修改vueDeviceType:mobile | ||||
| data: { | ||||
|   cmd: "CONSOLE_ADMIN_LOGIN", | ||||
|   userid: devUserInfo.userid, | ||||
|   pwd: devUserInfo.pwd, | ||||
|   lang: "cn", | ||||
|   vueDeviceType: "pc", | ||||
| } | ||||
| */ | ||||
| /* | ||||
| 获取客户端用户会话,deviceType:pc/mobile/weixin | ||||
| data: { | ||||
|   cmd: "CLIENT_USER_LOGIN", | ||||
|   userid: devUserInfo.userid, | ||||
|   pwd: devUserInfo.pwd, | ||||
|   lang: "cn", | ||||
|   deviceType: "pc", | ||||
| } | ||||
| */ | ||||
| /* | ||||
| 获取CoE用户会话 | ||||
| data: { | ||||
|   cmd: "com.actionsoft.apps.coe.pal_user_login", | ||||
|   userid: devUserInfo.userid, | ||||
|   pwd: devUserInfo.pwd, | ||||
|   lang: "cn", | ||||
|   deviceType: "pc", | ||||
| } | ||||
| */ | ||||
| awsuiAxios | ||||
|   .post({ | ||||
|     url: "jd", | ||||
|     data: { | ||||
|       cmd: "CONSOLE_ADMIN_LOGIN", | ||||
|       userid: devUserInfo.userid, | ||||
|       pwd: devUserInfo.pwd, | ||||
|       lang: "cn", | ||||
|       vueDeviceType: "pc", | ||||
|     }, | ||||
|   }) | ||||
|   .then(function (r) { | ||||
|     // let r = response.data; | ||||
|     if (r.result == "error") { | ||||
|       //$.simpleAlert(r.msg, "error"); | ||||
|       alert("获取session错误:" + r.msg); | ||||
|     } else { | ||||
|       store.commit("edit", { sessionId: r.data.sid }); | ||||
|       router.replace("/" + mainPage); | ||||
|     } | ||||
|   }); | ||||
| export default { | ||||
|   data() { | ||||
|     return { | ||||
|       dwList: [], //dw的获取列表 | ||||
|     }; | ||||
|   }, | ||||
|   methods: {}, | ||||
|   mounted() {}, | ||||
| }; | ||||
| </script> | ||||
| @ -0,0 +1,85 @@ | ||||
| function getError(action, option, xhr) { | ||||
|   let msg; | ||||
|   if (xhr.response) { | ||||
|     msg = `${xhr.response.error || xhr.response}`; | ||||
|   } else if (xhr.responseText) { | ||||
|     msg = `${xhr.responseText}`; | ||||
|   } else { | ||||
|     msg = `fail to post ${action} ${xhr.status}`; | ||||
|   } | ||||
| 
 | ||||
|   const err = new Error(msg); | ||||
|   err.status = xhr.status; | ||||
|   err.method = 'post'; | ||||
|   err.url = action; | ||||
|   return err; | ||||
| } | ||||
| 
 | ||||
| function getBody(xhr) { | ||||
|   const text = xhr.responseText || xhr.response; | ||||
|   if (!text) { | ||||
|     return text; | ||||
|   } | ||||
| 
 | ||||
|   try { | ||||
|     return JSON.parse(text); | ||||
|   } catch (e) { | ||||
|     return text; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export default function upload(option) { | ||||
|   if (typeof XMLHttpRequest === 'undefined') { | ||||
|     return; | ||||
|   } | ||||
| 
 | ||||
|   const xhr = new XMLHttpRequest(); | ||||
|   const action = option.action; | ||||
| 
 | ||||
|   if (xhr.upload) { | ||||
|     xhr.upload.onprogress = function progress(e) { | ||||
|       if (e.total > 0) { | ||||
|         e.percent = e.loaded / e.total * 100; | ||||
|       } | ||||
|       option.onProgress(e); | ||||
|     }; | ||||
|   } | ||||
| 
 | ||||
|   const formData = new FormData(); | ||||
| 
 | ||||
|   if (option.data) { | ||||
|     Object.keys(option.data).forEach(key => { | ||||
|       formData.append(key, option.data[key]); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   formData.append(option.filename, option.file, option.file.name); | ||||
| 
 | ||||
|   xhr.onerror = function error(e) { | ||||
|     option.onError(e); | ||||
|   }; | ||||
| 
 | ||||
|   xhr.onload = function onload() { | ||||
|     if (xhr.status < 200 || xhr.status >= 300) { | ||||
|       return option.onError(getError(action, option, xhr)); | ||||
|     } | ||||
| 
 | ||||
|     option.onSuccess(getBody(xhr)); | ||||
|   }; | ||||
| 
 | ||||
|   xhr.open('post', action, true); | ||||
| 
 | ||||
|   if (option.withCredentials && 'withCredentials' in xhr) { | ||||
|     xhr.withCredentials = true; | ||||
|   } | ||||
| 
 | ||||
|   const headers = option.headers || {}; | ||||
| 
 | ||||
|   for (let item in headers) { | ||||
|     if (headers.hasOwnProperty(item) && headers[item] !== null) { | ||||
|       xhr.setRequestHeader(item, headers[item]); | ||||
|     } | ||||
|   } | ||||
|   xhr.send(formData); | ||||
|   return xhr; | ||||
| } | ||||
| @ -0,0 +1,353 @@ | ||||
| <script> | ||||
|   import UploadList from './upload-list'; | ||||
|   import Upload from './upload'; | ||||
|   import ElProgress from 'element-ui/packages/progress'; | ||||
|   import Migrating from 'element-ui/src/mixins/migrating'; | ||||
|   function noop() {} | ||||
|   export default { | ||||
|     name: 'ElUpload', | ||||
|     mixins: [Migrating], | ||||
|     components: { | ||||
|       ElProgress, | ||||
|       UploadList, | ||||
|       Upload | ||||
|     }, | ||||
|     provide() { | ||||
|       return { | ||||
|         uploader: this | ||||
|       }; | ||||
|     }, | ||||
|     inject: { | ||||
|       elForm: { | ||||
|         default: '' | ||||
|       } | ||||
|     }, | ||||
|     props: { | ||||
|       action: { | ||||
|         type: String, | ||||
|         default: '' | ||||
|       }, | ||||
|       headers: { | ||||
|         type: Object, | ||||
|         default() { | ||||
|           return {}; | ||||
|         } | ||||
|       }, | ||||
|       data: Object, | ||||
|       multiple: Boolean, | ||||
|       name: { | ||||
|         type: String, | ||||
|         default: 'file' | ||||
|       }, | ||||
|       drag: Boolean, | ||||
|       dragger: Boolean, | ||||
|       withCredentials: Boolean, | ||||
|       showFileList: { | ||||
|         type: Boolean, | ||||
|         default: true | ||||
|       }, | ||||
|       accept: String, | ||||
|       type: { | ||||
|         type: String, | ||||
|         default: 'select' | ||||
|       }, | ||||
|       beforeUpload: Function, | ||||
|       beforeRemove: Function, | ||||
|       onRemove: { | ||||
|         type: Function, | ||||
|         default: noop | ||||
|       }, | ||||
|       onChange: { | ||||
|         type: Function, | ||||
|         default: noop | ||||
|       }, | ||||
|       onPreview: { | ||||
|         type: Function | ||||
|       }, | ||||
|       onSuccess: { | ||||
|         type: Function, | ||||
|         default: noop | ||||
|       }, | ||||
|       onProgress: { | ||||
|         type: Function, | ||||
|         default: noop | ||||
|       }, | ||||
|       onError: { | ||||
|         type: Function, | ||||
|         default: noop | ||||
|       }, | ||||
|       fileList: { | ||||
|         type: Array, | ||||
|         default() { | ||||
|           return []; | ||||
|         } | ||||
|       }, | ||||
|       autoUpload: { | ||||
|         type: Boolean, | ||||
|         default: true | ||||
|       }, | ||||
|       listType: { | ||||
|         type: String, | ||||
|         default: 'text' // text,picture,picture-card | ||||
|       }, | ||||
|       httpRequest: Function, | ||||
|       disabled: Boolean, | ||||
|       limit: Number, | ||||
|       onExceed: { | ||||
|         type: Function, | ||||
|         default: noop | ||||
|       }, | ||||
|       appId: { | ||||
|         type: String, | ||||
|         required: true | ||||
|       }, | ||||
|       repositoryName: { | ||||
|         type: String, | ||||
|         required: true | ||||
|       }, | ||||
|       groupValue: { | ||||
|         type: String, | ||||
|         required: true | ||||
|       }, | ||||
|       fileValue: { | ||||
|         type: String, | ||||
|         required: true | ||||
|       }, | ||||
|       extParam: { | ||||
|         type: String, | ||||
|         default: '' | ||||
|       } | ||||
|     }, | ||||
|     data() { | ||||
|       return { | ||||
|         uploadFiles: [], | ||||
|         dragOver: false, | ||||
|         draging: false, | ||||
|         tempIndex: 1, | ||||
|         sid: this.$store.state.sessionId | ||||
|       }; | ||||
|     }, | ||||
|     computed: { | ||||
|       uploadDisabled() { | ||||
|         return this.disabled || (this.elForm || {}).disabled; | ||||
|       } | ||||
|     }, | ||||
|     watch: { | ||||
|       listType(type) { | ||||
|         if (type === 'picture-card' || type === 'picture') { | ||||
|           this.uploadFiles = this.uploadFiles.map(file => { | ||||
|             if (!file.url && file.raw) { | ||||
|               try { | ||||
|                 file.url = URL.createObjectURL(file.raw); | ||||
|               } catch (err) { | ||||
|                 console.error('[Element Error][Upload]', err); | ||||
|               } | ||||
|             } | ||||
|             return file; | ||||
|           }); | ||||
|         } | ||||
|       }, | ||||
|       fileList: { | ||||
|         immediate: true, | ||||
|         handler(fileList) { | ||||
|           this.uploadFiles = fileList.map(item => { | ||||
|             item.uid = item.uid || (Date.now() + this.tempIndex++); | ||||
|             item.status = item.status || 'success'; | ||||
|             return item; | ||||
|           }); | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     methods: { | ||||
|       handleStart(rawFile) { | ||||
|         rawFile.uid = Date.now() + this.tempIndex++; | ||||
|         let file = { | ||||
|           status: 'ready', | ||||
|           name: rawFile.name, | ||||
|           size: rawFile.size, | ||||
|           percentage: 0, | ||||
|           uid: rawFile.uid, | ||||
|           raw: rawFile | ||||
|         }; | ||||
|         if (this.listType === 'picture-card' || this.listType === 'picture') { | ||||
|           try { | ||||
|             file.url = URL.createObjectURL(rawFile); | ||||
|           } catch (err) { | ||||
|             console.error('[Element Error][Upload]', err); | ||||
|             return; | ||||
|           } | ||||
|         } | ||||
|         this.uploadFiles.push(file); | ||||
|         this.onChange(file, this.uploadFiles); | ||||
|       }, | ||||
|       handleProgress(ev, rawFile) { | ||||
|         const file = this.getFile(rawFile); | ||||
|         this.onProgress(ev, file, this.uploadFiles); | ||||
|         file.status = 'uploading'; | ||||
|         file.percentage = ev.percent || 0; | ||||
|       }, | ||||
|       handleSuccess(res, rawFile) { | ||||
|         const file = this.getFile(rawFile); | ||||
|         if (file) { | ||||
|           file.status = 'success'; | ||||
|           file.response = res; | ||||
|           this.onSuccess(res, file, this.uploadFiles); | ||||
|           this.onChange(file, this.uploadFiles); | ||||
|         } | ||||
|       }, | ||||
|       handleError(err, rawFile) { | ||||
|         const file = this.getFile(rawFile); | ||||
|         const fileList = this.uploadFiles; | ||||
|         file.status = 'fail'; | ||||
|         fileList.splice(fileList.indexOf(file), 1); | ||||
|         this.onError(err, file, this.uploadFiles); | ||||
|         this.onChange(file, this.uploadFiles); | ||||
|       }, | ||||
|       handleRemove(file, raw) { | ||||
|         if (raw) { | ||||
|           file = this.getFile(raw); | ||||
|         } | ||||
|         let doRemove = () => { | ||||
|           this.abort(file); | ||||
|           let fileList = this.uploadFiles; | ||||
|           fileList.splice(fileList.indexOf(file), 1); | ||||
|           this.onRemove(file, fileList); | ||||
|         }; | ||||
|         if (!this.beforeRemove) { | ||||
|           doRemove(); | ||||
|         } else if (typeof this.beforeRemove === 'function') { | ||||
|           const before = this.beforeRemove(file, this.uploadFiles); | ||||
|           if (before && before.then) { | ||||
|             before.then(() => { | ||||
|               doRemove(); | ||||
|             }, noop); | ||||
|           } else if (before !== false) { | ||||
|             doRemove(); | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       getFile(rawFile) { | ||||
|         let fileList = this.uploadFiles; | ||||
|         let target; | ||||
|         fileList.every(item => { | ||||
|           target = rawFile.uid === item.uid ? item : null; | ||||
|           return !target; | ||||
|         }); | ||||
|         return target; | ||||
|       }, | ||||
|       abort(file) { | ||||
|         this.$refs['upload-inner'].abort(file); | ||||
|       }, | ||||
|       clearFiles() { | ||||
|         this.uploadFiles = []; | ||||
|       }, | ||||
|       submit() { | ||||
|         this.uploadFiles | ||||
|           .filter(file => file.status === 'ready') | ||||
|           .forEach(file => { | ||||
|             this.$refs['upload-inner'].upload(file.raw); | ||||
|           }); | ||||
|       }, | ||||
|       getMigratingConfig() { | ||||
|         return { | ||||
|           props: { | ||||
|             'default-file-list': 'default-file-list is renamed to file-list.', | ||||
|             'show-upload-list': 'show-upload-list is renamed to show-file-list.', | ||||
|             'thumbnail-mode': 'thumbnail-mode has been deprecated, you can implement the same effect according to this case: http://element.eleme.io/#/zh-CN/component/upload#yong-hu-tou-xiang-shang-chuan' | ||||
|           } | ||||
|         }; | ||||
|       } | ||||
|     }, | ||||
|     beforeDestroy() { | ||||
|       this.uploadFiles.forEach(file => { | ||||
|         if (file.url && file.url.indexOf('blob:') === 0) { | ||||
|           URL.revokeObjectURL(file.url); | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|     render(h) { | ||||
|       let uploadList; | ||||
|       if (this.showFileList) { | ||||
|         uploadList = ( | ||||
|           <UploadList | ||||
|         disabled={this.uploadDisabled} | ||||
|         listType={this.listType} | ||||
|         files={this.uploadFiles} | ||||
|         on-remove={this.handleRemove} | ||||
|         handlePreview={this.onPreview}> | ||||
|           { | ||||
|           (props) => { | ||||
|           if (this.$scopedSlots.file) { | ||||
|             return this.$scopedSlots.file({ | ||||
|               file: props.file | ||||
|             }); | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       </UploadList> | ||||
|       ); | ||||
|       } | ||||
|       const uploadData = { | ||||
|         props: { | ||||
|           type: this.type, | ||||
|           drag: this.drag, | ||||
|           action: this.action != undefined && this.action != '' ? this.action : encodeURI(getUploadDestination() + "appId=" + this.appId + "&sid=" + this.sid + "&groupValue=" + this.groupValue + "&fileValue=" + this.fileValue + "&repositoryName=" + this.repositoryName + "&extParam=" + this.extParam), | ||||
|           multiple: this.multiple, | ||||
|           'before-upload': this.beforeUpload, | ||||
|           'with-credentials': this.withCredentials, | ||||
|           headers: this.headers, | ||||
|           name: this.name, | ||||
|           data: this.data, | ||||
|           accept: this.accept, | ||||
|           fileList: this.uploadFiles, | ||||
|           autoUpload: this.autoUpload, | ||||
|           listType: this.listType, | ||||
|           disabled: this.uploadDisabled, | ||||
|           limit: this.limit, | ||||
|           'on-exceed': this.onExceed, | ||||
|           'on-start': this.handleStart, | ||||
|           'on-progress': this.handleProgress, | ||||
|           'on-success': this.handleSuccess, | ||||
|           'on-error': this.handleError, | ||||
|           'on-preview': this.onPreview, | ||||
|           'on-remove': this.handleRemove, | ||||
|           'http-request': this.httpRequest, | ||||
|           appId: this.appId, | ||||
|           repositoryName: this.repositoryName, | ||||
|           groupValue: this.groupValue, | ||||
|           fileValue: this.fileValue, | ||||
|           extParam: this.extParam, | ||||
|           sid: this.sid | ||||
|         }, | ||||
|         ref: 'upload-inner' | ||||
|       }; | ||||
|       const trigger = this.$slots.trigger || this.$slots.default; | ||||
|       const uploadComponent = <upload {...uploadData}>{trigger}</upload>; | ||||
|       return ( | ||||
|         <div> | ||||
|         { this.listType === 'picture-card' ? uploadList : ''} | ||||
|       { | ||||
|         this.$slots.trigger | ||||
|           ? [uploadComponent, this.$slots.default] | ||||
|           : uploadComponent | ||||
|       } | ||||
|       {this.$slots.tip} | ||||
|       { this.listType !== 'picture-card' ? uploadList : ''} | ||||
|     </div> | ||||
|     ); | ||||
|     } | ||||
|   }; | ||||
| 
 | ||||
|   function getUploadDestination() { | ||||
|     var url = axiosBaseUrl; | ||||
|     var ret = "uf"; | ||||
|     if (url && url.indexOf("/r/") != -1) { | ||||
|       ret = url.substring(0, url.indexOf("/r/")) + "/r/uf"; | ||||
|     } else if (url && url.indexOf("/apps") > -1) { | ||||
|       ret = url.substring(0, url.indexOf("/apps")) + "/r/uf"; | ||||
|     } | ||||
|     var finalUrl = ret + "?"; | ||||
|     return finalUrl; | ||||
|   }; | ||||
| 
 | ||||
| </script> | ||||
| @ -0,0 +1,69 @@ | ||||
| <template> | ||||
|   <div | ||||
|     class="el-upload-dragger" | ||||
|     :class="{ | ||||
|       'is-dragover': dragover | ||||
|     }" | ||||
|     @drop.prevent="onDrop" | ||||
|     @dragover.prevent="onDragover" | ||||
|     @dragleave.prevent="dragover = false" | ||||
|   > | ||||
|     <slot></slot> | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'ElUploadDrag', | ||||
|     props: { | ||||
|       disabled: Boolean | ||||
|     }, | ||||
|     inject: { | ||||
|       uploader: { | ||||
|         default: '' | ||||
|       } | ||||
|     }, | ||||
|     data() { | ||||
|       return { | ||||
|         dragover: false | ||||
|       }; | ||||
|     }, | ||||
|     methods: { | ||||
|       onDragover() { | ||||
|         if (!this.disabled) { | ||||
|           this.dragover = true; | ||||
|         } | ||||
|       }, | ||||
|       onDrop(e) { | ||||
|         if (this.disabled || !this.uploader) return; | ||||
|         const accept = this.uploader.accept; | ||||
|         this.dragover = false; | ||||
|         if (!accept) { | ||||
|           this.$emit('file', e.dataTransfer.files); | ||||
|           return; | ||||
|         } | ||||
|         this.$emit('file', [].slice.call(e.dataTransfer.files).filter(file => { | ||||
|           const { type, name } = file; | ||||
|           const extension = name.indexOf('.') > -1 | ||||
|             ? `.${ name.split('.').pop() }` | ||||
|             : ''; | ||||
|           const baseType = type.replace(/\/.*$/, ''); | ||||
|           return accept.split(',') | ||||
|             .map(type => type.trim()) | ||||
|             .filter(type => type) | ||||
|             .some(acceptedType => { | ||||
|               if (/\..+$/.test(acceptedType)) { | ||||
|                 return extension === acceptedType; | ||||
|               } | ||||
|               if (/\/\*$/.test(acceptedType)) { | ||||
|                 return baseType === acceptedType.replace(/\/\*$/, ''); | ||||
|               } | ||||
|               if (/^[^\/]+\/[^\/]+$/.test(acceptedType)) { | ||||
|                 return type === acceptedType; | ||||
|               } | ||||
|               return false; | ||||
|             }); | ||||
|         })); | ||||
|       } | ||||
|     } | ||||
|   }; | ||||
| </script> | ||||
| @ -0,0 +1,100 @@ | ||||
| <template> | ||||
|   <transition-group | ||||
|     tag="ul" | ||||
|     :class="[ | ||||
|       'el-upload-list', | ||||
|       'el-upload-list--' + listType, | ||||
|       { 'is-disabled': disabled } | ||||
|     ]" | ||||
|     name="el-list" | ||||
|   > | ||||
|     <li | ||||
|       v-for="file in files" | ||||
|       :class="['el-upload-list__item', 'is-' + file.status, focusing ? 'focusing' : '']" | ||||
|       :key="file.uid" | ||||
|       tabindex="0" | ||||
|       @keydown.delete="!disabled && $emit('remove', file)" | ||||
|       @focus="focusing = true" | ||||
|       @blur="focusing = false" | ||||
|       @click="focusing = false" | ||||
|     > | ||||
|       <slot :file="file"> | ||||
|         <img | ||||
|           class="el-upload-list__item-thumbnail" | ||||
|           v-if="file.status !== 'uploading' && ['picture-card', 'picture'].indexOf(listType) > -1" | ||||
|           :src="file.url" alt="" | ||||
|         > | ||||
|         <a class="el-upload-list__item-name" @click="handleClick(file)"> | ||||
|           <i class="el-icon-document"></i>{{file.name}} | ||||
|         </a> | ||||
|         <label class="el-upload-list__item-status-label"> | ||||
|           <i :class="{ | ||||
|             'el-icon-upload-success': true, | ||||
|             'el-icon-circle-check': listType === 'text', | ||||
|             'el-icon-check': ['picture-card', 'picture'].indexOf(listType) > -1 | ||||
|           }"></i> | ||||
|         </label> | ||||
|         <i class="el-icon-close" v-if="!disabled" @click="$emit('remove', file)"></i> | ||||
|         <i class="el-icon-close-tip" v-if="!disabled">{{ t('el.upload.deleteTip') }}</i> <!--因为close按钮只在li:focus的时候 display, li blur后就不存在了,所以键盘导航时永远无法 focus到 close按钮上--> | ||||
|         <el-progress | ||||
|           v-if="file.status === 'uploading'" | ||||
|           :type="listType === 'picture-card' ? 'circle' : 'line'" | ||||
|           :stroke-width="listType === 'picture-card' ? 6 : 2" | ||||
|           :percentage="parsePercentage(file.percentage)"> | ||||
|         </el-progress> | ||||
|         <span class="el-upload-list__item-actions" v-if="listType === 'picture-card'"> | ||||
|           <span | ||||
|             class="el-upload-list__item-preview" | ||||
|             v-if="handlePreview && listType === 'picture-card'" | ||||
|             @click="handlePreview(file)" | ||||
|           > | ||||
|             <i class="el-icon-zoom-in"></i> | ||||
|           </span> | ||||
|           <span | ||||
|             v-if="!disabled" | ||||
|             class="el-upload-list__item-delete" | ||||
|             @click="$emit('remove', file)" | ||||
|           > | ||||
|             <i class="el-icon-delete"></i> | ||||
|           </span> | ||||
|         </span> | ||||
|       </slot> | ||||
|     </li> | ||||
|   </transition-group> | ||||
| </template> | ||||
| <script> | ||||
|   import Locale from 'element-ui/src/mixins/locale'; | ||||
|   import ElProgress from 'element-ui/packages/progress'; | ||||
|   export default { | ||||
|     name: 'ElUploadList', | ||||
|     mixins: [Locale], | ||||
|     data() { | ||||
|       return { | ||||
|         focusing: false | ||||
|       }; | ||||
|     }, | ||||
|     components: { ElProgress }, | ||||
|     props: { | ||||
|       files: { | ||||
|         type: Array, | ||||
|         default() { | ||||
|           return []; | ||||
|         } | ||||
|       }, | ||||
|       disabled: { | ||||
|         type: Boolean, | ||||
|         default: false | ||||
|       }, | ||||
|       handlePreview: Function, | ||||
|       listType: String | ||||
|     }, | ||||
|     methods: { | ||||
|       parsePercentage(val) { | ||||
|         return parseInt(val, 10); | ||||
|       }, | ||||
|       handleClick(file) { | ||||
|         this.handlePreview && this.handlePreview(file); | ||||
|       } | ||||
|     } | ||||
|   }; | ||||
| </script> | ||||
| @ -0,0 +1,200 @@ | ||||
| <script> | ||||
|   import ajax from './ajax'; | ||||
|   import UploadDragger from './upload-dragger.vue'; | ||||
|   export default { | ||||
|     inject: ['uploader'], | ||||
|     components: { | ||||
|       UploadDragger | ||||
|     }, | ||||
|     props: { | ||||
|       type: String, | ||||
|       action: { | ||||
|         type: String, | ||||
|         required: true | ||||
|       }, | ||||
|       name: { | ||||
|         type: String, | ||||
|         default: 'file' | ||||
|       }, | ||||
|       data: Object, | ||||
|       headers: Object, | ||||
|       withCredentials: Boolean, | ||||
|       multiple: Boolean, | ||||
|       accept: String, | ||||
|       onStart: Function, | ||||
|       onProgress: Function, | ||||
|       onSuccess: Function, | ||||
|       onError: Function, | ||||
|       beforeUpload: Function, | ||||
|       drag: Boolean, | ||||
|       onPreview: { | ||||
|         type: Function, | ||||
|         default: function() {} | ||||
|       }, | ||||
|       onRemove: { | ||||
|         type: Function, | ||||
|         default: function() {} | ||||
|       }, | ||||
|       fileList: Array, | ||||
|       autoUpload: Boolean, | ||||
|       listType: String, | ||||
|       httpRequest: { | ||||
|         type: Function, | ||||
|         default: ajax | ||||
|       }, | ||||
|       disabled: Boolean, | ||||
|       limit: Number, | ||||
|       onExceed: Function | ||||
|     }, | ||||
|     data() { | ||||
|       return { | ||||
|         mouseover: false, | ||||
|         reqs: {} | ||||
|       }; | ||||
|     }, | ||||
|     methods: { | ||||
|       isImage(str) { | ||||
|         return str.indexOf('image') !== -1; | ||||
|       }, | ||||
|       handleChange(ev) { | ||||
|         const files = ev.target.files; | ||||
|         if (!files) return; | ||||
|         this.uploadFiles(files); | ||||
|       }, | ||||
|       uploadFiles(files) { | ||||
|         if (this.limit && this.fileList.length + files.length > this.limit) { | ||||
|           this.onExceed && this.onExceed(files, this.fileList); | ||||
|           return; | ||||
|         } | ||||
|         let postFiles = Array.prototype.slice.call(files); | ||||
|         if (!this.multiple) { postFiles = postFiles.slice(0, 1); } | ||||
|         if (postFiles.length === 0) { return; } | ||||
|         postFiles.forEach(rawFile => { | ||||
|           this.onStart(rawFile); | ||||
|           if (this.autoUpload) this.upload(rawFile); | ||||
|         }); | ||||
|       }, | ||||
|       upload(rawFile) { | ||||
|         this.$refs.input.value = null; | ||||
|         if (!this.beforeUpload) { | ||||
|           return this.post(rawFile); | ||||
|         } | ||||
|         const before = this.beforeUpload(rawFile); | ||||
|         if (before && before.then) { | ||||
|           before.then(processedFile => { | ||||
|             const fileType = Object.prototype.toString.call(processedFile); | ||||
|             if (fileType === '[object File]' || fileType === '[object Blob]') { | ||||
|               if (fileType === '[object Blob]') { | ||||
|                 processedFile = new File([processedFile], rawFile.name, { | ||||
|                   type: rawFile.type | ||||
|                 }); | ||||
|               } | ||||
|               for (const p in rawFile) { | ||||
|                 if (rawFile.hasOwnProperty(p)) { | ||||
|                   processedFile[p] = rawFile[p]; | ||||
|                 } | ||||
|               } | ||||
|               this.post(processedFile); | ||||
|             } else { | ||||
|               this.post(rawFile); | ||||
|             } | ||||
|           }, () => { | ||||
|             this.onRemove(null, rawFile); | ||||
|           }); | ||||
|         } else if (before !== false) { | ||||
|           this.post(rawFile); | ||||
|         } else { | ||||
|           this.onRemove(null, rawFile); | ||||
|         } | ||||
|       }, | ||||
|       abort(file) { | ||||
|         const { reqs } = this; | ||||
|         if (file) { | ||||
|           let uid = file; | ||||
|           if (file.uid) uid = file.uid; | ||||
|           if (reqs[uid]) { | ||||
|             reqs[uid].abort(); | ||||
|           } | ||||
|         } else { | ||||
|           Object.keys(reqs).forEach((uid) => { | ||||
|             if (reqs[uid]) reqs[uid].abort(); | ||||
|             delete reqs[uid]; | ||||
|           }); | ||||
|         } | ||||
|       }, | ||||
|       post(rawFile) { | ||||
|         const { uid } = rawFile; | ||||
|         const options = { | ||||
|           headers: this.headers, | ||||
|           withCredentials: this.withCredentials, | ||||
|           file: rawFile, | ||||
|           data: this.data, | ||||
|           filename: this.name, | ||||
|           action: this.action, | ||||
|           onProgress: e => { | ||||
|             this.onProgress(e, rawFile); | ||||
|           }, | ||||
|           onSuccess: res => { | ||||
|             this.onSuccess(res, rawFile); | ||||
|             delete this.reqs[uid]; | ||||
|           }, | ||||
|           onError: err => { | ||||
|             this.onError(err, rawFile); | ||||
|             delete this.reqs[uid]; | ||||
|           } | ||||
|         }; | ||||
|         const req = this.httpRequest(options); | ||||
|         this.reqs[uid] = req; | ||||
|         if (req && req.then) { | ||||
|           req.then(options.onSuccess, options.onError); | ||||
|         } | ||||
|       }, | ||||
|       handleClick() { | ||||
|         if (!this.disabled) { | ||||
|           this.$refs.input.value = null; | ||||
|           this.$refs.input.click(); | ||||
|         } | ||||
|       }, | ||||
|       handleKeydown(e) { | ||||
|         if (e.target !== e.currentTarget) return; | ||||
|         if (e.keyCode === 13 || e.keyCode === 32) { | ||||
|           this.handleClick(); | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     render(h) { | ||||
|       let { | ||||
|         handleClick, | ||||
|         drag, | ||||
|         name, | ||||
|         handleChange, | ||||
|         multiple, | ||||
|         accept, | ||||
|         listType, | ||||
|         uploadFiles, | ||||
|         disabled, | ||||
|         handleKeydown | ||||
|       } = this; | ||||
|       const data = { | ||||
|         class: { | ||||
|           'el-upload': true | ||||
|         }, | ||||
|         on: { | ||||
|           click: handleClick, | ||||
|           keydown: handleKeydown | ||||
|         } | ||||
|       }; | ||||
|       data.class[`el-upload--${listType}`] = true; | ||||
|       return ( | ||||
|         <div {...data} tabindex="0" > | ||||
|       { | ||||
|         drag | ||||
|         ? <upload-dragger disabled={disabled} on-file={uploadFiles}>{this.$slots.default}</upload-dragger> | ||||
|     : this.$slots.default | ||||
|     } | ||||
|     <input class="el-upload__input" type="file" ref="input" name={name} on-change={handleChange} multiple={multiple} accept={accept}></input> | ||||
|         </div> | ||||
|     ); | ||||
|     } | ||||
|   }; | ||||
| </script> | ||||
| @ -0,0 +1,219 @@ | ||||
| <template> | ||||
|     <div v-loading="loading"> | ||||
|         <!--上传的清单内容预览--> | ||||
|         <div v-if="checkResult.checkTemplateResult == 'ok'"> | ||||
|             <div :style="{height: msgHeight}" v-html="checkResult.resultMsg"></div> | ||||
|             <div> | ||||
|                 <el-table | ||||
|                         id='table' | ||||
|                         :height="tableHeight" | ||||
|                         :data="tableData" | ||||
|                         border | ||||
|                         size="medium" | ||||
|                         style="width: 100%"> | ||||
|                         <el-table-column | ||||
|                             prop='index' | ||||
|                             label='' | ||||
|                             align='center' | ||||
|                             width=50px | ||||
|                         > | ||||
|                         </el-table-column> | ||||
|                     <el-table-column  | ||||
|                                 v-for="(item) in tableTitle"  | ||||
|                                 :key=item | ||||
|                                 :prop=item | ||||
|                                 :label="item"> | ||||
|                                 <template slot-scope="scope"> | ||||
|                                     <template v-if="scope.row[item] != undefined"> | ||||
|                                         {{scope.row[item].value}} | ||||
|                                         <!--警告类提示,上传可忽略--> | ||||
|                                         <span v-if="!scope.row[item].isRowOk && item == '名称'" style="color: #E6A23C"> | ||||
|                                             <br/><b>{{scope.row[item].rowMsg}}</b> | ||||
|                                         </span> | ||||
|                                         <!--错误类提示,不能上传--> | ||||
|                                         <span v-if="!scope.row[item].isOk" style="color: #ff0000"> | ||||
|                                             <br/><b>{{scope.row[item].msg}}</b> | ||||
|                                         </span> | ||||
|                                     </template> | ||||
|                                 </template> | ||||
|                         </el-table-column> | ||||
|                 </el-table> | ||||
|             </div> | ||||
|         </div> | ||||
|         <!--上传的清单校验失败时显示内容--> | ||||
|         <div v-if="checkResult.checkTemplateResult != 'ok'"> | ||||
|             <div style="background-color:#F56C6C;padding: 10px;" v-html="checkResult.checkTemplateResultMsg"></div> | ||||
|         </div> | ||||
|     </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../awsuiAxios"; | ||||
| 
 | ||||
|     export default { | ||||
|         name: "check-process", | ||||
|         props: { | ||||
|             fileName: {// 文件名称 | ||||
|                 type: String, | ||||
|                 default: '' | ||||
|             }, | ||||
|             totalHeight: { | ||||
|                 type: String,  | ||||
|                 default: 0 | ||||
|             } | ||||
|         }, | ||||
|         data() { | ||||
|             return { | ||||
|                 loading: false, | ||||
|                 wsId: wsId, | ||||
|                 teamId: teamId, | ||||
|                 processFileValue: processFileValue, | ||||
|                 msgHeight: '20px', | ||||
|                 tableHeight: parseInt(this.totalHeight) - 20 + 'px', | ||||
|                 tableTitle: [], | ||||
|                 tableData: [], | ||||
|                 checkResult: { | ||||
|                     okData: [], | ||||
|                     errData: [], | ||||
|                     existData: [], | ||||
|                     excelExistData: [], | ||||
|                     resultMsg: '正在校验...', | ||||
|                     chheckDone: false, | ||||
|                     checkTemplateResult: 'ok', | ||||
|                     checkTemplateResultMsg: '', | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         mounted() { | ||||
|             this.initData(); | ||||
|         }, | ||||
|         methods: { | ||||
|             initData() { | ||||
|                 const that = this; | ||||
|                 that.loading = true; | ||||
|                 const params = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_process_data_check", | ||||
|                         wsId: that.wsId, | ||||
|                         teamId: that.teamId, | ||||
|                         type: 'processList', | ||||
|                         fileValue: that.processFileValue, | ||||
|                         fileName: that.fileName | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(params).then(function (ro) { | ||||
|                     that.loading = false; | ||||
|                     if (ro.result == 'ok') { | ||||
|                         // 标题 | ||||
|                         that.tableTitle = ro.data.data.titleRow; | ||||
|                         // 内容 | ||||
|                         const data = ro.data.data.data; | ||||
|                         // 校验内容 | ||||
|                         let totalCount = 0;// 总数 | ||||
|                         let okCount = 0;// 校验通过数 | ||||
|                         let existCount = 0;// 重复数 | ||||
|                         let errCount = 0;// 校验失败数 | ||||
|                         let errRowIndexArr = [];// 校验失败的行数 | ||||
|                         for (let i = 0; i < data.length; i++) { | ||||
|                             let isOk = true; | ||||
|                             let rowData = []; | ||||
|                             let isExist = false;// 资产库是否重复 | ||||
|                             let isExcelExist = false;// excel表格是否重复 | ||||
|                             let excelExistRow = 0;// excel表格重复时重复行数 | ||||
|                             let isRowErr = false;// excel表格行是否错误 | ||||
|                             for (let j = 0; j < data[i].length; j++) { | ||||
|                                 let cell = data[i][j]; | ||||
|                                 // 资产库已存在 | ||||
|                                 if (j == 0) {// 首元素包含该行是否重复的校验结果 | ||||
|                                     if (cell.isExist) {// 资产库重复 | ||||
|                                         isExist = true; | ||||
|                                     } else if (cell.isExcelExist) {// excel行重复 | ||||
|                                         isExcelExist = true; | ||||
|                                         excelExistRow = cell.excelExistRow; | ||||
|                                     } | ||||
|                                 } | ||||
|                                 data[i][j].isRowOk = true;// 前端行校验结果判断 | ||||
|                                 data[i][j].rowMsg = '';// 前端行校验失败后的提示语 | ||||
|                                 if (isExist) { | ||||
|                                     isOk = false; | ||||
|                                     data[i][j].isRowOk = false; | ||||
|                                     data[i][j].rowMsg = '资产库中已存在该流程'; | ||||
|                                 } else if (isExcelExist) { | ||||
|                                     isOk = false; | ||||
|                                     data[i][j].isRowOk = false; | ||||
|                                     data[i][j].rowMsg = '流程与第' + excelExistRow + '行重复'; | ||||
|                                 } else { | ||||
|                                     if (cell.isOk) {// 校验通过 | ||||
|                                     } else { | ||||
|                                         isOk = false; | ||||
|                                         isRowErr = true; | ||||
|                                     } | ||||
|                                 } | ||||
|                                  | ||||
|                             } | ||||
|                             if (isRowErr) { | ||||
|                                 errRowIndexArr.push(i); | ||||
|                             } | ||||
|                             // tableData.push(rowData); | ||||
|                             totalCount++; | ||||
|                             if (isExist) {// 与资产库重复 | ||||
|                                 that.checkResult.existData.push(data[i]); | ||||
|                                 existCount++; | ||||
|                             } else if (isExcelExist) {// excel行重复 | ||||
|                                 that.checkResult.excelExistData.push(data[i]); | ||||
|                                 existCount++; | ||||
|                             } else if (isOk) {// excel行校验通过 | ||||
|                                 that.checkResult.okData.push(JSON.parse(JSON.stringify(data[i]))); | ||||
|                                 okCount++; | ||||
|                             } else {// 校验失败 | ||||
|                                 that.checkResult.errData.push(data[i]); | ||||
|                                 errCount++; | ||||
|                             } | ||||
| 
 | ||||
|                         } | ||||
|                         let result = '清单共<span style="font-weight:bold;">' + totalCount + '</span>条记录'; | ||||
|                         if (okCount > 0) { | ||||
|                             if (totalCount == okCount) { | ||||
|                                 result += ',全部校验通过'; | ||||
|                             } else { | ||||
|                                 result += ',校验通过<span style="font-weight:bold;">' + okCount + '</span>条'; | ||||
|                             } | ||||
|                         } | ||||
|                         if (errCount > 0) { | ||||
|                             result += ',校验失败<span style="color:red;font-weight:bold;">' + errCount + '</span>条'; | ||||
|                         } | ||||
|                         if (existCount > 0) { | ||||
|                             result += ',重复数据<span style="color:red;font-weight:bold;">' + existCount + '</span>条(上传时忽略)'; | ||||
|                         } | ||||
|                         that.checkResult.resultMsg = result; | ||||
|                         const tableData = []; | ||||
|                         for (let i = 0; i < data.length; i++) { | ||||
|                             const row = {}; | ||||
|                             const rowArr = data[i]; | ||||
|                             for (let j = 0; j < rowArr.length; j++) { | ||||
|                                 row[rowArr[j].name2] = rowArr[j]; | ||||
|                             } | ||||
|                             row.index = i + 1;// 序号列,方便用户识别 | ||||
|                             tableData.push(row); | ||||
|                         } | ||||
|                         that.tableData = tableData; | ||||
|                         that.checkResult.chheckDone = true; | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else {// 校验excel失败或其他错误类信息 | ||||
|                         // that.$message.error(ro.msg); | ||||
|                         that.checkResult.checkTemplateResult = 'error'; | ||||
|                         that.checkResult.checkTemplateResultMsg = ro.msg; | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
| 
 | ||||
| </style> | ||||
| @ -0,0 +1,179 @@ | ||||
| <template> | ||||
|     <div v-loading="loading"> | ||||
|         <!-- 校验结果 --> | ||||
|         <div v-if="checkResult.checkTemplateResult == 'ok'"> | ||||
|             <awsui-tabs v-model="activeName"> | ||||
|                 <awsui-tab-pane v-for="(tabItem, index) in tabData" :key="tabItem.id" :name="tabItem.id"> | ||||
|                     <span slot="label"><span :style="{color: tabItem.isOk ? '' : 'red'}">{{tabItem.sheetName}}</span></span> | ||||
|                     <div :style="{height: msgHeight}" v-html="checkResult.resultMsg[index]"></div> | ||||
|                     <div> | ||||
|                         <el-table | ||||
|                                 id='table' | ||||
|                                 :height="tableHeight" | ||||
|                                 :data="tabItem.data" | ||||
|                                 border | ||||
|                                 size="medium" | ||||
|                                 style="width: 100%"> | ||||
|                                 <el-table-column | ||||
|                                     prop='index' | ||||
|                                     label='' | ||||
|                                     align='center' | ||||
|                                     width=50px | ||||
|                                 > | ||||
|                                 </el-table-column> | ||||
|                                 <el-table-column  | ||||
|                                         v-for="(item) in tabItem.titleRow"  | ||||
|                                         :key=item | ||||
|                                         :prop=item | ||||
|                                         :label="item"> | ||||
|                                         <template slot-scope="scope"> | ||||
|                                             <template v-if="scope.row[item] != undefined"> | ||||
|                                                 {{scope.row[item].value}} | ||||
|                                                 <!--警告类提示,上传可忽略--> | ||||
|                                                 <span v-if="!scope.row[item].isRowOk && item == '名称'" style="color: #E6A23C"> | ||||
|                                                     <br/><b>{{scope.row[item].rowMsg}}</b> | ||||
|                                                 </span> | ||||
|                                                 <!--错误类提示,不能上传--> | ||||
|                                                 <span v-if="!scope.row[item].isOk" style="color: #ff0000"> | ||||
|                                                     <br/><b>{{scope.row[item].msg}}</b> | ||||
|                                                 </span> | ||||
|                                             </template> | ||||
|                                         </template> | ||||
|                                 </el-table-column> | ||||
|                         </el-table> | ||||
|                     </div> | ||||
|                 </awsui-tab-pane> | ||||
|             </awsui-tabs> | ||||
|         </div> | ||||
|         <!-- excel错误提示 --> | ||||
|         <div v-if="checkResult.checkTemplateResult != 'ok'"> | ||||
|             <div style="background-color:#F56C6C;padding: 10px;" v-html="checkResult.checkTemplateResultMsg"></div> | ||||
|         </div> | ||||
|     </div> | ||||
|      | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../awsuiAxios"; | ||||
|     export default { | ||||
|         name: "check-shape", | ||||
|         props: { | ||||
|             fileName: {// 文件名称 | ||||
|                 type: String, | ||||
|                 default: '' | ||||
|             }, | ||||
|             totalHeight: { | ||||
|                 type: String,  | ||||
|                 default: 0 | ||||
|             } | ||||
|         }, | ||||
|         data() { | ||||
|             return { | ||||
|                 loading: false, | ||||
|                 wsId: wsId, | ||||
|                 teamId: teamId, | ||||
|                 shapeFileValue: shapeFileValue, | ||||
|                 msgHeight: '20px', | ||||
|                 tableHeight: parseInt(this.totalHeight) - 20 - 45 + 'px', | ||||
|                 activeName: 'first', | ||||
|                 tabData: [], | ||||
|                 checkResult: { | ||||
|                     isOk: true, | ||||
|                     okData: [], | ||||
|                     resultMsg: [], | ||||
|                     chheckDone: false, | ||||
|                     checkTemplateResult: 'ok', | ||||
|                     checkTemplateResultMsg: [], | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         mounted() { | ||||
|             this.initData(); | ||||
|         }, | ||||
|         methods: { | ||||
|             initData() { | ||||
|                 const that = this; | ||||
|                 that.loading = true; | ||||
|                 const params = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_process_data_check", | ||||
|                         wsId: that.wsId, | ||||
|                         teamId: that.teamId, | ||||
|                         type: 'shapeList', | ||||
|                         fileValue: that.shapeFileValue, | ||||
|                         fileName: that.fileName | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(params).then(function (ro) { | ||||
|                     that.loading = false; | ||||
|                     if (ro.result == 'ok') { | ||||
|                         const data = ro.data; | ||||
|                         that.checkResult.okData = JSON.parse(JSON.stringify(data)); | ||||
|                         for (let i = 0; i < data.length; i++) { | ||||
|                             if (i == 0) { | ||||
|                                 that.activeName = data[i].id; | ||||
|                             } | ||||
|                             const tableDataTemp = []; | ||||
|                             const tableData = data[i].data; | ||||
|                             let msg = '清单共<span style="font-weight:bold;">' + tableData.length + '</span>条记录'; | ||||
|                             let okCount = 0; | ||||
|                             let errCount = 0; | ||||
|                             for (let j = 0; j < tableData.length; j++) { | ||||
|                                 const row = {}; | ||||
|                                 const rowArr = tableData[j]; | ||||
|                                 let isRowOk = true;// 每行结果 | ||||
|                                 for (let m = 0; m < rowArr.length; m++) { | ||||
|                                     if (!rowArr[m].isOk) { | ||||
|                                         isRowOk = false; | ||||
|                                         break; | ||||
|                                     } | ||||
|                                 } | ||||
|                                 for (let m = 0; m < rowArr.length; m++) { | ||||
|                                     row[rowArr[m].name2] = rowArr[m]; | ||||
|                                 } | ||||
|                                 row.index = j + 1;// 序号列,方便用户识别 | ||||
|                                 tableDataTemp.push(row); | ||||
|                                 if (isRowOk) { | ||||
|                                     okCount++; | ||||
|                                 } else { | ||||
|                                     errCount++; | ||||
|                                     that.checkResult.isOk = false; | ||||
|                                 } | ||||
|                             } | ||||
|                             if (okCount == tableData.length) { | ||||
|                                 msg += ',全部校验通过'; | ||||
|                             } else if (errCount == tableData.length) { | ||||
|                                 msg += ',全部校验失败'; | ||||
|                             } else { | ||||
|                                 msg += ',校验通过<span style="font-weight:bold;">' + okCount + '</span>条'; | ||||
|                                 msg += ',校验失败<span style="color:red;font-weight:bold;">' + errCount + '</span>条'; | ||||
|                             } | ||||
|                             that.checkResult.resultMsg.push(msg); | ||||
|                             data[i].data = tableDataTemp; | ||||
| 
 | ||||
|                         } | ||||
|                         that.tabData = ro.data; | ||||
|                         that.checkResult.chheckDone = true; | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else {// 校验excel失败或其他错误类信息 | ||||
|                         // that.$message.error(ro.msg); | ||||
|                         that.checkResult.checkTemplateResult = 'error'; | ||||
|                         that.checkResult.checkTemplateResultMsg = ro.msg; | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             handleClick() { | ||||
|                 alert(this.activeName) | ||||
|             } | ||||
|         } | ||||
|          | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
| 
 | ||||
| </style> | ||||
| @ -0,0 +1 @@ | ||||
| 说明:批量创建-批量创建模型结构-下载Excel模板-选择树组件 | ||||
| @ -0,0 +1,360 @@ | ||||
| <template> | ||||
|   <el-container> | ||||
|     <el-dialog | ||||
|       id="palRepositoryTree" | ||||
|       :title="title" | ||||
|       :visible.sync="dialogVisible" | ||||
|       :destroy-on-close=true | ||||
|       :width="width" | ||||
|       :modal-append-to-body=false | ||||
|       :append-to-body=true | ||||
|       :close-on-click-modal=false | ||||
|       :before-close="handleClose"> | ||||
|       <template v-if="refresh"> | ||||
|         <div | ||||
|           v-loading="loading" | ||||
|           element-loading-text="拼命加载中"> | ||||
|           <el-autocomplete | ||||
|             v-model="treeSearchKey" | ||||
|             size="small" | ||||
|             :fetch-suggestions="treeSearch" | ||||
|             @select="treeSearchSelect" | ||||
|             suffix-icon="el-icon-search" | ||||
|             placeholder="快速查询" | ||||
|             :trigger-on-focus=false | ||||
|             style="width:100%;" | ||||
|           > | ||||
|             <template slot-scope="{ item }"> | ||||
|               <el-tooltip class="item" placement="bottom-start"> | ||||
|                 <div slot="content">{{item.pathName}}</div> | ||||
|                 <span>{{ item.name }}</span> | ||||
|               </el-tooltip> | ||||
|             </template> | ||||
|           </el-autocomplete> | ||||
|           <div style="height: 200px;overflow: auto;border: 1px solid #f2f2f2;"> | ||||
|             <div class="tree"> | ||||
|               <el-tree | ||||
|                 ref="tree" | ||||
|                 :props="treeProps" | ||||
|                 :expand-on-click-node=false | ||||
|                 :highlight-current=true | ||||
|                 @node-click="openNode" | ||||
|                 @node-expand="expandNode" | ||||
|                 @node-collapse="closeNode" | ||||
|                 @check-change="checkedNode" | ||||
|                 :show-checkbox=multiple | ||||
|                 node-key="id" | ||||
|                 check-strictly | ||||
|                 lazy | ||||
|                 :load="loadNode"> | ||||
|                 <span slot-scope="{node, data}"> | ||||
|                   <i class="awsui-iconfont tree-content-icon tree-content-icon-padding" :style="{'color': node.data.icon.color}" v-html="node.data.icon.icon"></i> | ||||
|                   <span>{{node.label}}</span> | ||||
|                 </span> | ||||
|               </el-tree> | ||||
|             </div> | ||||
|           </div> | ||||
|         </div> | ||||
|       </template> | ||||
|       <span slot="footer" class="dialog-footer"> | ||||
|         <awsui-button class="button-general-color" type="primary" @click="submit">确定</awsui-button> | ||||
|         <awsui-button @click="cancel">取消</awsui-button> | ||||
|       </span> | ||||
|      </el-dialog> | ||||
|   </el-container> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../../../awsuiAxios"; | ||||
| 
 | ||||
|     export default { | ||||
|       name: "PALRepositoryTree", | ||||
|       props: { | ||||
|         visible: { | ||||
|           type: Boolean, | ||||
|           default: false | ||||
|         }, | ||||
|         wsId: {// 资产库ID | ||||
|           type: String, | ||||
|           default: '', | ||||
|           required: true | ||||
|         }, | ||||
|         teamId: {// 小组ID | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         categorys: {// 建模大类,多个则逗号分隔 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         rootId: {// 父节点,为空则查询根节点 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         multiple: {// 是否多选 | ||||
|           type: Boolean, | ||||
|           default: false | ||||
|         }, | ||||
|         title: {// 标题 | ||||
|           type: String, | ||||
|           default: '请选择' | ||||
|         }, | ||||
|         // width: {// 宽度 | ||||
|         //   type: String, | ||||
|         //   default: '500px' | ||||
|         // }, | ||||
|         selected: {// 默认选中,比如[],不区分单多选,单选只取第一个值 | ||||
|           type: Array, | ||||
|           default: function () { | ||||
|             return [] | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       data() { | ||||
|         return { | ||||
|           refresh: false, | ||||
|           dialogVisible: false, | ||||
|           loading: false, | ||||
|           searchKey: '', | ||||
|           treeSearchKey: '', | ||||
|           timeout:  null, | ||||
|           pid: '', | ||||
|           width: '500px', | ||||
|           treeProps: { | ||||
|             label: 'name', | ||||
|             isLeaf: 'leaf' | ||||
|           }, | ||||
|           data: [], | ||||
|         }; | ||||
|       }, | ||||
|       methods: { | ||||
|         handleClose(done) { | ||||
|           this.closeDlalog('cancel'); | ||||
|           done(); | ||||
|         }, | ||||
|         cancel() { | ||||
|           this.closeDlalog('cancel'); | ||||
|             this.dialogVisible = false; | ||||
|           }, | ||||
|           submit() { | ||||
|             this.closeDlalog('save'); | ||||
|             this.dialogVisible = false; | ||||
|           }, | ||||
|           closeDlalog(type) {// 取消/确定之后的关闭 | ||||
|             if (type == 'save') { | ||||
|               let result = []; | ||||
|               if (this.multiple) {// 多选 | ||||
|                 result = this.data; | ||||
|               } else {// 单选 | ||||
|                 const node = this.$refs.tree.getCurrentNode(); | ||||
|                 if (node != null) { | ||||
|                   result.push(node); | ||||
|                 } | ||||
|               } | ||||
|             this.$emit('getResult', result); | ||||
|           } else { | ||||
|             this.$emit('cancel'); | ||||
|           } | ||||
|           // 清空所有数据 | ||||
|         }, | ||||
|         handleNodeClick(data) { | ||||
|           console.log(data); | ||||
|         }, | ||||
|         openNode(obj, node, tree) {// 打开一只模型文件 | ||||
| 
 | ||||
|         }, | ||||
|         treeSearchSelect(item) { | ||||
|           this.queryTreeByIdAndPath(item.id, item.versionId, item.path); | ||||
|         }, | ||||
|         treeSearch(key, cb) { | ||||
|           const that = this; | ||||
|           if (key != undefined && key.trim() != '') { | ||||
|             // that.loading = true; | ||||
|             const data = { | ||||
|               url:'jd', | ||||
|               data:{ | ||||
|                 cmd: 'com.actionsoft.apps.coe.pal_repository_tree_component_search', | ||||
|                 wsId: that.wsId, | ||||
|                 teamId: that.teamId, | ||||
|                 categorys: that.categorys, | ||||
|                 rootId: that.rootId, | ||||
|                 name: key | ||||
|               } | ||||
|             }; | ||||
|             // 查询数据 | ||||
|             awsuiAxios.post(data).then(function (ro) { | ||||
|               if (ro.result == 'ok') { | ||||
|                 if (ro.data.length > 0) { | ||||
|                   clearTimeout(that.timeout); | ||||
|                   that.timeout = setTimeout(() => { | ||||
|                     cb(ro.data); | ||||
|                   }, 3000 * Math.random()); | ||||
|                 } else { | ||||
|                   clearTimeout(that.timeout); | ||||
|                 } | ||||
|               } else { | ||||
|                 clearTimeout(that.timeout); | ||||
|               } | ||||
|             }).catch(error=>{ | ||||
|               console.log(error); | ||||
|             }) | ||||
|           } else { | ||||
|             clearTimeout(that.timeout); | ||||
|           } | ||||
|         }, | ||||
|         queryTreeByIdAndPath(id, versionId, path) {// 定位展开某节点 | ||||
|           const that= this; | ||||
|           const tree = that.$refs.tree; | ||||
|           // 分隔字符串 | ||||
|           const pathArr = path.split(','); | ||||
|           let index = 1; | ||||
|           for (let i = 0; i < pathArr.length; i++) {// 依次展开 | ||||
|             if (i > 0) { | ||||
|               if (tree.getNode(pathArr[i-1]) != null) { | ||||
|                 setTimeout(that._expandNode(tree, pathArr[i-1]), index * 300); | ||||
|                 index++; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           setTimeout(function() { | ||||
|             if (tree.getNode(versionId) != null) { | ||||
|               tree.setCurrentKey(versionId); | ||||
|             } | ||||
|           }, index * 300); | ||||
|         }, | ||||
|         _expandNode(tree, versionId) { | ||||
|           return function() { | ||||
|             tree.getNode(versionId).expand(); | ||||
|           } | ||||
|         }, | ||||
|         loadNode(node, resolve) {// `动态`加载 | ||||
|           const that = this; | ||||
|           that.loading = true; | ||||
|           const data = { | ||||
|             url:'jd', | ||||
|             data:{ | ||||
|               cmd: 'com.actionsoft.apps.coe.pal.batch_create_repository_tree_data', | ||||
|               wsId: that.wsId, | ||||
|               teamId: that.teamId, | ||||
|               categorys: that.categorys, | ||||
|               pid: '' | ||||
|             } | ||||
|           }; | ||||
|           if (node.level === 0) { | ||||
|             // 获取根目录 | ||||
|             data.data.pid = that.pid; | ||||
|           } else { | ||||
|             // 获取其他目录 | ||||
|             data.data.pid = node.data.id; | ||||
|           } | ||||
|           // 查询数据 | ||||
|           awsuiAxios.post(data).then(function (ro) { | ||||
|             resolve(ro.data); | ||||
|             that.loading = false; | ||||
|             if (node.level == 0 && ro.data.length > 0) { | ||||
|               const tree = that.$refs.tree; | ||||
|               tree.getNode(ro.data[0].id).expand(); | ||||
|               setTimeout(function(){ | ||||
|                 const childNode = tree.getNode(ro.data[0].id).childNodes[0]; | ||||
|                 if (childNode != null) { | ||||
|                   childNode.expand(); | ||||
|                 } | ||||
|               }, 500); | ||||
|             } | ||||
|           }).catch(error=>{ | ||||
|             console.log(error); | ||||
|           }) | ||||
|         }, | ||||
|         expandNode(obj, node, tree) {// 展开节点 | ||||
| 
 | ||||
|         }, | ||||
|         closeNode(obj, node, tree) {// 关闭时清空,下次展开重新请求动态加载 | ||||
|           node.childNodes = []; | ||||
|           node.loaded = false; | ||||
|         }, | ||||
|         checkedNode(data, checked, subChecked) {// 节点选中事件 | ||||
|           // 获取所有子节点 | ||||
|           const that = this; | ||||
|           const params = { | ||||
|             url:'jd', | ||||
|             data:{ | ||||
|               cmd: 'com.actionsoft.apps.coe.pal.batch_create_repository_all_child_data_query', | ||||
|               wsId: that.wsId, | ||||
|               teamId: that.teamId, | ||||
|               pid: data.id | ||||
|             } | ||||
|           }; | ||||
|           awsuiAxios.post(params).then(function (ro) { | ||||
|             const childVerIds = ro.data;// 所有可选中子节点 | ||||
|             const currVerId = data.versionId;// 当前versionId | ||||
|             if (checked) {// 选中 | ||||
|               const checkedVerIds = that.data; | ||||
|               if (checkedVerIds.indexOf(currVerId) == -1) { | ||||
|                 checkedVerIds.push(currVerId); | ||||
|               } | ||||
|               for (let i = 0; i < childVerIds.length; i++) { | ||||
|                 if (checkedVerIds.indexOf(childVerIds[i]) == -1) { | ||||
|                   checkedVerIds.push(childVerIds[i]); | ||||
|                 } | ||||
|               } | ||||
|               that.$refs.tree.setCheckedKeys(checkedVerIds); | ||||
|             } else {// 取消选中 | ||||
|               const checkedVerIds = that.data; | ||||
|               const tempArr = []; | ||||
|               for (let i = 0; i < checkedVerIds.length; i++) { | ||||
|                 if (checkedVerIds[i] != currVerId && childVerIds.indexOf(checkedVerIds[i]) == -1) { | ||||
|                   tempArr.push(checkedVerIds[i]); | ||||
|                 } | ||||
|               } | ||||
|               that.data = tempArr; | ||||
|               that.$refs.tree.setCheckedKeys(that.data); | ||||
|             } | ||||
|           }).catch(error=>{ | ||||
|             console.log(error); | ||||
|           }) | ||||
|         } | ||||
|       }, | ||||
|       watch: { | ||||
|         visible(val) { | ||||
|           this.dialogVisible = val; | ||||
|           if (val) {// 打开 | ||||
|             this.pid = this.rootId; | ||||
|             this.refresh = true; | ||||
|           } else {// 关闭 | ||||
|             this.refresh = false; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|   #palRepositoryTree >>> .el-dialog__body { | ||||
|     padding: 10px 20px; | ||||
|     color: #606266; | ||||
|     font-size: 14px; | ||||
|     word-break: break-all; | ||||
|   } | ||||
|   #palRepositoryTree >>> .el-input__inner { | ||||
|     border-radius: 0px; | ||||
|   } | ||||
|   #palRepositoryTree >>> .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content { | ||||
|     background-color: #F5F7FA; | ||||
|     color: #4E7FF9; | ||||
|   } | ||||
|   #palRepositoryTree >>> .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont { | ||||
|     color: #4E7FF9 !important; | ||||
|   } | ||||
|   /*#palRepositoryTree >>> .el-tree .el-tree-node>.el-tree-node__children{*/ | ||||
|   /*  overflow: visible;*/ | ||||
|   /*}*/ | ||||
|   .tree{ | ||||
|     overflow: auto; | ||||
|     width:458px; | ||||
|     height: 200px; | ||||
|   } | ||||
|   #palRepositoryTree >>> .el-tree { | ||||
|     min-width: 100%; | ||||
|     display:inline-block !important; | ||||
|   } | ||||
| </style> | ||||
| @ -0,0 +1,7 @@ | ||||
| import CreateTree from './component' | ||||
| 
 | ||||
| CreateTree.install = function(Vue) { | ||||
|   Vue.component(CreateTree.name, CreateTree); | ||||
| } | ||||
| 
 | ||||
| export  default CreateTree; | ||||
							
								
								
									
										457
									
								
								com.actionsoft.apps.coe.pal.batch/src/views/create/create.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										457
									
								
								com.actionsoft.apps.coe.pal.batch/src/views/create/create.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,457 @@ | ||||
| <template> | ||||
|     <awsui-layout> | ||||
|         <awsui-header id="header"> | ||||
|             <el-steps :active="active" align-center> | ||||
|                 <el-step title="上传" icon="el-icon-upload"></el-step> | ||||
|                 <el-step title="校验" icon="el-icon-warning"></el-step> | ||||
|                 <el-step title="结果" icon="el-icon-success"></el-step> | ||||
|             </el-steps> | ||||
|         </awsui-header> | ||||
|         <awsui-main :style="{height: mainHeight, padding: '0'}"> | ||||
|             <!-- 上传 --> | ||||
|             <div v-if="this.active == 1" :style="{height: parseInt(mainHeight) - 40 + 'px', width: '100%'}"> | ||||
|                 <awsui-tabs v-model="uploadStep.activeName"> | ||||
|                     <awsui-tab-pane label="批量创建流程清单" name="processList"> | ||||
|                         <div v-loading="uploadStep.loading"> | ||||
|                             <!-- 文件上传功能 --> | ||||
|                             <div v-show="uploadStep.processUpload.status == 0" style="text-align: center;padding-top: 220px;"> | ||||
|                                 <awsui-button type="primary" class="button-general-color" style="margin: 0;" @click="uploadFile('process')">上传Excel文件</awsui-button> | ||||
|                                 <div style="padding-top: 30px;"> | ||||
|                                     <span class="text-linker-color" style="cursor: pointer;" @click.stop="downloadTemplate('processList')">下载Excel模板</span> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                             <!-- 已上传文件删除 --> | ||||
|                             <div v-show="uploadStep.processUpload.status == 1" style="text-align: center;"> | ||||
|                                 <div style="padding-top: 220px;"> | ||||
|                                     <div style="display:inline-block;height: 28px;width:119px;line-height: 28px;vertical-align: middle;background-color: #DEDEDE"> | ||||
|                                         已上传文件 | ||||
|                                     </div> | ||||
|                                 </div> | ||||
|                                 <div style="padding-top: 30px;"> | ||||
|                                     <span class="text-linker-color" style="cursor: pointer;" @click="downLoadUploaded(processFileValue, uploadStep.processUpload.data.name)">{{uploadStep.processUpload.data.name}}</span> | ||||
|                                     <i class="awsui-iconfont" style="cursor: pointer;" @click="deleteUploaded(processFileValue, uploadStep.processUpload.data.name)"></i> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                             <div v-show="false"> | ||||
|                                 <pal-upload ref="processUpload" style="width: 100%;" | ||||
|                                             class="upload-demo" | ||||
|                                             :appId=appId | ||||
|                                             :repositoryName=repositoryName | ||||
|                                             :groupValue=groupValue | ||||
|                                             :fileValue=processFileValue | ||||
|                                             :on-preview="handleProcessPreview" | ||||
|                                             :on-success="handleProcessSuccess" | ||||
|                                             :on-remove="handleProcessRemove" | ||||
|                                             :on-error="handleProcessError" | ||||
|                                             :before-remove="beforeProcessRemove" | ||||
|                                             :before-upload="beforeProcessUpload" | ||||
|                                             :limit="1" | ||||
|                                             :on-exceed="handleProcessExceed" | ||||
|                                             accept=".xlsx" | ||||
|                                             :file-list="uploadStep.processUpload.fileList"> | ||||
|                                     <div style="display: none;"> | ||||
|                                         <awsui-button id="selectProcessFileButton" style="width: 130px;" class="button-general-color" type="primary">本地文件上传</awsui-button> | ||||
|                                     </div> | ||||
|                                 </pal-upload> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </awsui-tab-pane> | ||||
|                     <awsui-tab-pane label="批量创建模型结构" name="shapeList"> | ||||
|                         <div v-loading="uploadStep.loading"> | ||||
|                             <!-- 文件上传功能 --> | ||||
|                             <div v-show="uploadStep.shapeUpload.status == 0" style="text-align: center;padding-top: 220px;"> | ||||
|                                 <awsui-button type="primary" class="button-general-color" style="margin: 0;" @click="uploadFile('shape')">上传Excel文件</awsui-button> | ||||
|                                 <div style="padding-top: 30px;"> | ||||
|                                     <span class="text-linker-color" style="cursor: pointer;" @click="openRepositoryTreeDlg">下载Excel模板</span> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                             <!-- 已上传文件删除 --> | ||||
|                             <div v-show="uploadStep.shapeUpload.status == 1" style="text-align: center;"> | ||||
|                                 <div style="padding-top: 220px;"> | ||||
|                                     <div style="display:inline-block;height: 28px;width:119px;line-height: 28px;vertical-align: middle;background-color: #DEDEDE"> | ||||
|                                         已上传文件 | ||||
|                                     </div> | ||||
|                                 </div> | ||||
|                                 <div style="padding-top: 30px;"> | ||||
|                                     <span class="text-linker-color" style="cursor: pointer;" @click="downLoadUploaded(shapeFileValue, uploadStep.shapeUpload.data.name)">{{uploadStep.shapeUpload.data.name}}</span> | ||||
|                                     <i class="awsui-iconfont" style="cursor: pointer;" @click="deleteUploaded(shapeFileValue, uploadStep.shapeUpload.data.name)"></i> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                             <div v-show="false"> | ||||
|                                 <pal-upload ref="shapeUpload" style="width: 100%;" | ||||
|                                             class="upload-demo" | ||||
|                                             :appId=appId | ||||
|                                             :repositoryName=repositoryName | ||||
|                                             :groupValue=groupValue | ||||
|                                             :fileValue=shapeFileValue | ||||
|                                             :on-preview="handleShapePreview" | ||||
|                                             :on-success="handleShapeSuccess" | ||||
|                                             :on-remove="handleShapeRemove" | ||||
|                                             :on-error="handleShapeError" | ||||
|                                             :before-remove="beforeShapeRemove" | ||||
|                                             :before-upload="beforeShapeUpload" | ||||
|                                             :limit="1" | ||||
|                                             :on-exceed="handleShapeExceed" | ||||
|                                             accept=".xlsx" | ||||
|                                             :file-list="uploadStep.shapeUpload.fileList"> | ||||
|                                     <div style="display: none;"> | ||||
|                                         <awsui-button id="selectShapeFileButton" style="width: 130px;" class="button-general-color" type="primary">本地文件上传</awsui-button> | ||||
|                                     </div> | ||||
|                                 </pal-upload> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                         <create-tree | ||||
|                                 ref="createTree" | ||||
|                                 :visible.sync="uploadStep.shapeUpload.createTree.visible" | ||||
|                                 :wsId="wsId" | ||||
|                                 :teamId="teamId" | ||||
|                                 :categorys="methodCategory" | ||||
|                                 :multiple=true | ||||
|                                 v-on:cancel="uploadStep.shapeUpload.createTree.visible = false" | ||||
|                                 v-on:getResult="saveCreateTreeResult" | ||||
|                                 :title="uploadStep.shapeUpload.createTree.title" | ||||
|                         ></create-tree> | ||||
| 
 | ||||
|                     </awsui-tab-pane> | ||||
|                 </awsui-tabs> | ||||
|             </div> | ||||
|             <!-- 校验 --> | ||||
|             <div v-if="this.active == 2" :style="{height: parseInt(mainHeight) - 40 + 'px', width: '100%'}"> | ||||
|                 <template v-if="checkStep.type == 'processList'"> | ||||
|                     <check-process ref="processListCheck" :file-name="uploadStep.processUpload.data.name" :totalHeight="mainHeight"/> | ||||
|                 </template> | ||||
|                 <template v-if="checkStep.type == 'shapeList'"> | ||||
|                     <check-shape ref="shapeListCheck" :file-name="uploadStep.shapeUpload.data.name" :totalHeight="mainHeight"/> | ||||
|                 </template> | ||||
|             </div> | ||||
|             <!-- 结果 --> | ||||
|             <div v-if="this.active == 3" :style="{height: parseInt(mainHeight) - 40 + 'px', width: '100%'}"> | ||||
|                 <save ref="save" :totalHeight="mainHeight" :param="saveData"/> | ||||
|             </div> | ||||
|         </awsui-main> | ||||
|         <awsui-footer> | ||||
|             <div style="float: right;"> | ||||
|                 <awsui-button v-if="this.active == 2" style="margin-top: 12px;" @click="prev">上一步</awsui-button> | ||||
|                 <awsui-button v-if="this.active == 1 || this.active == 2" style="margin-top: 12px;" @click="next">下一步</awsui-button> | ||||
|                 <template v-if="this.active == 3"> | ||||
|                     <awsui-button style="margin-top: 12px;" @click="downloadLog">导出报告</awsui-button> | ||||
|                     <awsui-button style="margin-top: 12px;" @click="success">完成</awsui-button> | ||||
|                 </template> | ||||
|             </div> | ||||
|         </awsui-footer> | ||||
|     </awsui-layout> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import palUpload from '../components/upload/index'; | ||||
|     import awsuiAxios from "../../awsuiAxios"; | ||||
|     import createTree from './components/createTree/index'; | ||||
|     import checkProcess from './check-process'; | ||||
|     import checkShape from './check-shape'; | ||||
|     import save from './save'; | ||||
| import Save from './save.vue'; | ||||
|     export default { | ||||
|         name: "create", | ||||
|         components: {palUpload, createTree, checkProcess, checkShape, save}, | ||||
|         data() { | ||||
|             return { | ||||
|                 active: 1, | ||||
|                 wsId: wsId, | ||||
|                 teamId: teamId, | ||||
|                 methodCategory: methodCategory, | ||||
|                 appId: appId, | ||||
|                 repositoryName: repositoryName, | ||||
|                 groupValue: groupValue, | ||||
|                 processFileValue: processFileValue, | ||||
|                 shapeFileValue: shapeFileValue, | ||||
|                 mainHeight: (document.documentElement.clientHeight) - 60 - 40 + 'px', | ||||
|                 uploadStep: { | ||||
|                     activeName: 'processList', | ||||
|                     loading: false, | ||||
|                     processUpload: {// 模型清单批量上传 | ||||
|                         status: 0, | ||||
|                         fileList: [],// 组件上传列表 | ||||
|                         data: {},// 自定义数据展示数据源 | ||||
|                     }, | ||||
|                     shapeUpload: {// 模型结构批量上传 | ||||
|                         status: 0, | ||||
|                         fileList: [], | ||||
|                         data: {}, | ||||
|                         createTree : { | ||||
|                             visible: false, | ||||
|                             title: '请选择流程' | ||||
|                         } | ||||
|                     } | ||||
|                 }, | ||||
|                 checkStep: { | ||||
|                     type: '' | ||||
|                 }, | ||||
|                 fileList: [], | ||||
|                 saveData: {// 待保存的数据 | ||||
|                     wsId: wsId, | ||||
|                     teamId: teamId, | ||||
|                     type: '', | ||||
|                     fileValue: '', | ||||
|                     fileName: '', | ||||
|                     data: { | ||||
|                         okData: [] | ||||
|                     } | ||||
|                 } | ||||
|             }; | ||||
|         }, | ||||
|         mounted() { | ||||
|             const that = this; | ||||
|             that.resize(); | ||||
|         }, | ||||
|         methods: { | ||||
|             prev() {// 上一步 | ||||
|                 if (this.active == 2) { | ||||
|                     this.checkStep.type = ''; | ||||
|                 } | ||||
|                 this.active--; | ||||
|             }, | ||||
|             next() {// 下一步 | ||||
|                 if (this.active == 1) {// 上传文件页面点击下一页 | ||||
|                     if (!this.checkUploadFile()) { | ||||
|                         this.$message({message: '请上传Excel文件', type: 'warning'}); | ||||
|                         return; | ||||
|                     } | ||||
|                     this.checkStep.type = this.uploadStep.activeName; | ||||
|                 } else if (this.active == 2) { | ||||
|                     if (this.checkStep.type == 'processList') {// 流程清单文件上传 | ||||
|                         const result = this.$refs.processListCheck.checkResult; | ||||
|                         if (!result.chheckDone) { | ||||
|                             this.$message({message: '正在校验或校验未通过,不支持此操作', type: 'warning'}); | ||||
|                             return; | ||||
|                         } | ||||
|                         if (result.errData.length > 0) { | ||||
|                             this.$message({message: '校验未通过', type: 'warning'}); | ||||
|                             return; | ||||
|                         } | ||||
|                         if (result.okData.length == 0) { | ||||
|                             this.$message({message: '上传文件无数据', type: 'warning'}); | ||||
|                             return; | ||||
|                         } | ||||
|                         this.saveData.type = 'processList'; | ||||
|                         this.saveData.fileValue = this.processFileValue; | ||||
|                         this.saveData.fileName = this.uploadStep.processUpload.data.name; | ||||
|                         this.saveData.data.okData = result.okData; | ||||
|                     } else {// 模型结构批量上传 | ||||
|                         const result = this.$refs.shapeListCheck.checkResult; | ||||
|                         if (!result.chheckDone) { | ||||
|                             this.$message({message: '正在校验或校验未通过,不支持此操作', type: 'warning'}); | ||||
|                             return; | ||||
|                         } | ||||
|                         if (!result.isOk) { | ||||
|                             this.$message({message: '校验未通过', type: 'warning'}); | ||||
|                             return; | ||||
|                         } | ||||
|                         this.saveData.type = 'shapeList'; | ||||
|                         this.saveData.fileValue = this.shapeFileValue; | ||||
|                         this.saveData.fileName = this.uploadStep.shapeUpload.data.name; | ||||
|                         this.saveData.data.okData = result.okData; | ||||
|                     } | ||||
|                 } | ||||
|                 this.active++; | ||||
|             }, | ||||
|             success() {// 完成,关闭窗口 | ||||
|                 parent.closeBatchCreateFn([]); | ||||
|             }, | ||||
|             downloadLog() {// 下载日志 | ||||
|                 this.$refs.save.downloadLog(); | ||||
|             }, | ||||
|             checkUploadFile() {// 上传模板之后下一步 | ||||
|                 if (this.uploadStep.activeName == 'processList') { | ||||
|                     if (this.uploadStep.processUpload.status == 1) { | ||||
|                         return true; | ||||
|                     } | ||||
|                 } else if (this.uploadStep.activeName == 'shapeList') { | ||||
|                     if (this.uploadStep.shapeUpload.status == 1) { | ||||
|                         return true; | ||||
|                     } | ||||
|                 } | ||||
|                 return false; | ||||
|             }, | ||||
|             uploadFile(type) {// 上传模板 | ||||
|                 if (type == 'process') {// 批量上传流程清单模板 | ||||
|                     this.$refs.processUpload.clearFiles(); | ||||
|                     document.getElementById("selectProcessFileButton").click(); | ||||
|                 } else {// 模型结构清单模板 | ||||
|                     this.$refs.shapeUpload.clearFiles(); | ||||
|                     document.getElementById("selectShapeFileButton").click(); | ||||
|                 } | ||||
|             }, | ||||
|             downloadTemplate(type, versionIds) { // 下载模板 | ||||
|                 const that = this; | ||||
|                 that.uploadStep.loading = true; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_download_template", | ||||
|                         wsId : that.wsId, | ||||
|                         type : type, | ||||
|                         versionIds : versionIds | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     that.uploadStep.loading = false; | ||||
|                     if (ro.result == 'ok') { | ||||
|                         window.open(ro.data.url); | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
| 
 | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             downLoadUploaded(fileValue, name) {// 下载已经上传的 | ||||
|                 const that = this; | ||||
|                 that.uploadStep.loading = true; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_uploaded_file_download", | ||||
|                         fileValue : fileValue, | ||||
|                         fileName : name | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     that.uploadStep.loading = false; | ||||
|                     if (ro.result == 'ok') { | ||||
|                         window.location.href = ro.data.url; | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             deleteUploaded(fileValue, name) {// 删除已经上传的 | ||||
|                 const that = this; | ||||
|                 that.uploadStep.loading = true; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_uploaded_file_delete", | ||||
|                         fileValue : fileValue, | ||||
|                         fileName : name | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     that.uploadStep.loading = false; | ||||
|                     if (ro.result == 'ok') { | ||||
|                         if (that.uploadStep.activeName == 'processList') {// 删除已上传流程清单模板 | ||||
|                             that.$refs.processUpload.clearFiles(); | ||||
|                             that.uploadStep.processUpload.status = 0; | ||||
|                             that.uploadStep.processUpload.data = {}; | ||||
|                         } else {// 删除已上传模型结构清单模板 | ||||
|                             that.$refs.shapeUpload.clearFiles(); | ||||
|                             that.uploadStep.shapeUpload.status = 0; | ||||
|                             that.uploadStep.shapeUpload.data = {}; | ||||
|                         } | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             /******模型结构模板下载start*******/ | ||||
|             openRepositoryTreeDlg () {// 打开模型选择框 | ||||
|                 this.uploadStep.shapeUpload.createTree.visible = true; | ||||
|             }, | ||||
|             saveCreateTreeResult(data) {// 模型选择完成后,获取选中的数据 | ||||
|                 if (data.length == 0) { | ||||
|                     this.$message({message: '未选择任何模型,下载模板被取消', type: 'warning'}); | ||||
|                 } else { | ||||
|                     this.downloadTemplate('shapeList', data.join(',')); | ||||
|                 } | ||||
|             }, | ||||
|             /******模型结构模板下载end*******/ | ||||
|             /******模型清单模板上传start*********/ | ||||
|             handleProcessRemove(file, fileList) { | ||||
|                 this.uploadStep.processUpload.status = 0; | ||||
|             }, | ||||
|             handleProcessPreview(file) { | ||||
|             }, | ||||
|             handleProcessExceed(files, fileList) { | ||||
|             }, | ||||
|             handleProcessError(err, file, fileList) { | ||||
|             }, | ||||
|             beforeProcessUpload(file) { | ||||
|                 // 上传之前校验判断大小 | ||||
|                 if (file.size / 1024 / 1024 > 10) {  //文件大于10M | ||||
|                     this.$message.warning('文件不允许超过10M'); | ||||
|                     return false; | ||||
|                 } | ||||
|             }, | ||||
|             handleProcessSuccess(response, file, fileList) { | ||||
|                 const that = this; | ||||
|                 that.uploadStep.processUpload.status = 1; | ||||
|                 that.uploadStep.processUpload.data = { | ||||
|                     name: file.name, | ||||
|                     size: file.size | ||||
|                 }; | ||||
|             }, | ||||
|             beforeProcessRemove(file, fileList) { | ||||
|             }, | ||||
|             /******模型清单模板上传end*********/ | ||||
|             /******模型结构模板上传start*********/ | ||||
|             handleShapeRemove(file, fileList) { | ||||
|                 this.uploadStep.shapeUpload.status = 0; | ||||
|             }, | ||||
|             handleShapePreview(file) { | ||||
|             }, | ||||
|             handleShapeExceed(files, fileList) { | ||||
|             }, | ||||
|             handleShapeError(err, file, fileList) { | ||||
|             }, | ||||
|             beforeShapeUpload(file) { | ||||
|                 // 上传之前校验判断大小 | ||||
|                 if (file.size / 1024 / 1024 > 10) {  //文件大于10M | ||||
|                     this.$message.warning('文件不允许超过10M'); | ||||
|                     return false; | ||||
|                 } | ||||
|             }, | ||||
|             handleShapeSuccess(response, file, fileList) { | ||||
|                 const that = this; | ||||
|                 that.uploadStep.shapeUpload.status = 1; | ||||
|                 that.uploadStep.shapeUpload.data = { | ||||
|                     name: file.name, | ||||
|                     size: file.size | ||||
|                 }; | ||||
| 
 | ||||
|             }, | ||||
|             beforeShapeRemove(file, fileList) { | ||||
|             }, | ||||
|             /******模型结构模板上传end*********/ | ||||
| 
 | ||||
|             resize() {// 窗口监听window.resize | ||||
|                 const that = this | ||||
|                 let resizeTimer = null; | ||||
|                 window.onresize = () => { | ||||
|                     return (() => { | ||||
|                         if (resizeTimer) clearTimeout(resizeTimer); | ||||
|                         resizeTimer = setTimeout(function(){ | ||||
|                             that.mainHeight = (document.documentElement.clientHeight) - 60 - 40 + 'px'; | ||||
|                         } , 400); | ||||
|                     })() | ||||
|                 } | ||||
|             }, | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|     #header >>> .el-step__title { | ||||
|     font-size: 14px; | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										184
									
								
								com.actionsoft.apps.coe.pal.batch/src/views/create/save.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										184
									
								
								com.actionsoft.apps.coe.pal.batch/src/views/create/save.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,184 @@ | ||||
| <template> | ||||
|     <div v-loading="loading" :style="{height: mainHeight, 'background-color': '#2c2c2c'}"> | ||||
|         <codemirror | ||||
|             id="mycode" | ||||
|             ref="mycode" | ||||
|             style="height: auto" | ||||
|             v-model="curCode" | ||||
|             :options="cmOptions" | ||||
|             class="code" | ||||
|         /> | ||||
|     </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../awsuiAxios"; | ||||
|     import { codemirror } from 'vue-codemirror' | ||||
|     import "codemirror/theme/ambiance.css";  // 这里引入的是主题样式,根据设置的theme的主题引入,一定要引入!! | ||||
|     require("codemirror/mode/javascript/javascript"); // 这里引入的模式的js,根据设置的mode引入,一定要引入!! | ||||
| 
 | ||||
|     export default { | ||||
|         name: "check-process", | ||||
|         props: { | ||||
|             param: {// 文件名称 | ||||
|                 type: Object, | ||||
|                 default: function () { | ||||
|                     return {} | ||||
|                 } | ||||
|             }, | ||||
|             totalHeight: { | ||||
|                 type: String,  | ||||
|                 default: 0 | ||||
|             } | ||||
|         }, | ||||
|         components: {codemirror}, | ||||
|         data() { | ||||
|             return { | ||||
|                 loading: false, | ||||
|                 wsId: wsId, | ||||
|                 teamId: teamId, | ||||
|                 processFileValue: processFileValue, | ||||
|                 msgHeight: '20px', | ||||
|                 mainHeight: parseInt(this.totalHeight) + 'px', | ||||
|                 curCode: '正在导入', | ||||
|                 cmOptions: { | ||||
|                     value:'', | ||||
|                     mode:"text/html", | ||||
|                     theme: "ambiance", | ||||
|                     lineNumbers: false, | ||||
|                     styleActiveLine: true, | ||||
|                     tabSize: 4, | ||||
|                     autofocus: true, | ||||
|                     scrollbarStyle: "null", | ||||
|                     readOnly:true, | ||||
|                 }, | ||||
|                 result: {// 保存结果 | ||||
|                     path: '', | ||||
|                     type: '', | ||||
|                     logId: '', | ||||
|                     count: 0, | ||||
|                     executeDone: false, | ||||
|                     interval: null, // 查询日志定时器 | ||||
|                     timer:0, // 时间戳记录 | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         mounted() { | ||||
|             this.save(); | ||||
|         }, | ||||
|         methods: { | ||||
|             save() {// 上传 | ||||
|                 const that = this; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_data_save", | ||||
|                         param : JSON.stringify(that.param) | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     if (ro.result == 'ok') { | ||||
|                         // 获取导入日志信息 | ||||
|                         that.result.path = ro.data.path; | ||||
|                         that.result.logId = ro.data.logId; | ||||
|                         that.result.type = ro.data.type; | ||||
|                         that.result.count = 0; | ||||
|                         that.getImportInfoEvent(); | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             getImportInfoEvent() {// 定时器查询导入日志 | ||||
|                 this.result.interval = setInterval(this.queryLog, 1000) | ||||
|             }, | ||||
|             queryLog() { | ||||
|                 const that = this; | ||||
|                 that.result.timer = new Date().getTime(); | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_log_query", | ||||
|                         type: that.result.type, | ||||
|                         logId: that.result.logId, | ||||
|                         path: that.result.path, | ||||
|                         timer: that.result.timer | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     if (ro.result == 'ok') { | ||||
|                         if (ro.data.timer == '') { | ||||
|                             that.curCode = ro.data.content; | ||||
|                             // 添加内容后定位到行尾 | ||||
|                             that.$nextTick(()=> { | ||||
|                                 that.$refs.mycode.codemirror.scrollIntoView(that.$refs.mycode.codemirror.lineCount() - 1); | ||||
|                             }); | ||||
|                             that.result.executeDone = true; | ||||
|                             that.clearInterval(); | ||||
|                         } else if (parseInt(ro.data.timer) <= that.result.timer){// axios异步,以时间戳对比获取最新日至内容 | ||||
|                             that.curCode = ro.data.content; | ||||
|                             // 添加内容后定位到行尾 | ||||
|                             that.$nextTick(()=> { | ||||
|                                 that.$refs.mycode.codemirror.scrollIntoView(that.$refs.mycode.codemirror.lineCount() - 1); | ||||
|                             }); | ||||
|                         } | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             clearInterval() { | ||||
|                 clearInterval(this.result.interval); | ||||
|             }, | ||||
|             downloadLog() { | ||||
|                 const that = this; | ||||
|                 if (that.result.path == '') { | ||||
|                     that.$message({message: '获取报告失败', type: 'warning'}); | ||||
|                     return; | ||||
|                 } | ||||
|                 if (!that.result.executeDone) { | ||||
|                     that.$message({message: '正在导入,请稍等', type: 'warning'}); | ||||
|                     return; | ||||
|                 } | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_log_download", | ||||
|                         type: that.result.type, | ||||
|                         path: that.result.path | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     if (ro.result == 'ok') { | ||||
|                         window.open(ro.data.url); | ||||
|                         parent.closeBatchCreateFn([]); | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|     #mycode >>> .CodeMirror-lines { | ||||
|         background-color: #2c2c2c; | ||||
|         color: #58A0F0; | ||||
|     } | ||||
|     #mycode >>> .CodeMirror { | ||||
|         height: auto !important; | ||||
|     } | ||||
| </style> | ||||
| @ -0,0 +1,3 @@ | ||||
| 说明:调用aws平台的部门、人员、角色组件 | ||||
| 复制的com.actionsoft.apps.coe.pal/src/components/common/BPMOrgAddress组件 | ||||
| 如有任何bug,请修改com.actionsoft.apps.coe.pal/src/components/common/BPMOrgAddress中的组件并完全覆盖此组件并修改该组件的awsuiAxios引用地址 | ||||
| @ -0,0 +1,352 @@ | ||||
| <template> | ||||
|   <el-container> | ||||
|     <el-dialog | ||||
|           id="bpmOrgAddress" | ||||
|           :title="title" | ||||
|           :visible.sync="dialogVisible" | ||||
|           :destroy-on-close=true | ||||
|           :width="width" | ||||
|           :modal-append-to-body=false | ||||
|           :append-to-body=true | ||||
|           :close-on-click-modal=false | ||||
|           :before-close="handleClose"> | ||||
|       <template v-if="refresh"> | ||||
|         <div | ||||
|               v-loading="loading" | ||||
|               element-loading-text="拼命加载中"> | ||||
| <!--          <el-autocomplete--> | ||||
| <!--                v-model="treeSearchKey"--> | ||||
| <!--                size="small"--> | ||||
| <!--                :fetch-suggestions="treeSearch"--> | ||||
| <!--                @select="treeSearchSelect"--> | ||||
| <!--                suffix-icon="el-icon-search"--> | ||||
| <!--                placeholder="快速查询"--> | ||||
| <!--                :trigger-on-focus=false--> | ||||
| <!--                style="width:100%;">--> | ||||
| <!--            <template slot-scope="{ item }">--> | ||||
| <!--              <el-tooltip class="item" placement="bottom">--> | ||||
| <!--                <div slot="content">{{item.pathName}}</div>--> | ||||
| <!--                <span>{{ item.name }}</span>--> | ||||
| <!--              </el-tooltip>--> | ||||
| <!--            </template>--> | ||||
| <!--          </el-autocomplete>--> | ||||
|           <div style="height: 300px;overflow: auto;border: 1px solid #f2f2f2;"> | ||||
|             <div class="tree"> | ||||
|               <el-tree | ||||
|                     ref="tree" | ||||
|                     :props="treeProps" | ||||
|                     :show-checkbox="multiple" | ||||
|                     :expand-on-click-node=false | ||||
|                     :check-strictly=true | ||||
|                     :highlight-current=true | ||||
|                     @node-click="openNode" | ||||
|                     @node-expand="expandNode" | ||||
|                     @node-collapse="closeNode" | ||||
|                     node-key="id" | ||||
|                     lazy | ||||
|                     :load="loadNode"> | ||||
|                 <span slot-scope="{node, data}"> | ||||
|                   <i class="awsui-iconfont tree-content-icon tree-content-icon-padding" :style="{'color': node.data.icon.color}" v-html="node.data.icon.icon"></i> | ||||
|                   <span>{{node.label}}</span> | ||||
|                 </span> | ||||
|               </el-tree> | ||||
|             </div> | ||||
|           </div> | ||||
|         </div> | ||||
|       </template> | ||||
|       <span slot="footer" class="dialog-footer"> | ||||
|         <awsui-button class="button-general-color" type="primary" @click="submit">确定</awsui-button> | ||||
|         <awsui-button @click="cancel">取消</awsui-button> | ||||
|       </span> | ||||
|     </el-dialog> | ||||
|   </el-container> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|   import awsuiAxios from "../../../../awsuiAxios"; | ||||
| 
 | ||||
|   export default { | ||||
|     name: "BpmOrgAddress", | ||||
|     props: { | ||||
|       visible: { | ||||
|         type: Boolean, | ||||
|         default: false | ||||
|       }, | ||||
|       addressType: {// 地址簿类型,默认部门地址簿,可进行部门department、用户user、角色role组合,逗号分隔 | ||||
|         type: String, | ||||
|         default: 'department' | ||||
|       }, | ||||
|       multiple: {// 是否多选 | ||||
|         type: Boolean, | ||||
|         default: false | ||||
|       }, | ||||
|       rootDeptId: {// 默认根部门,为空则默认当前人所属单位为根节点 | ||||
|         type: String, | ||||
|         default: '' | ||||
|       }, | ||||
|       highSecurityFilter: {// 地址簿过滤三员用户类型 三员开启模式并且地址簿类型包含用户user时有效,系统管理员sysAdmin、安全保密员secAdmin、安全审计员auditor,逗号分割 | ||||
|           type: String, | ||||
|           default: ''// 例如值为sysAdmin,auditor,则开启三员之后该地址簿不显示系统管理员和安全审计员 | ||||
|       }, | ||||
|       title: {// 标题 | ||||
|         type: String, | ||||
|         default: '' | ||||
|       }, | ||||
|       selected: {// 默认选中,比如{'department':[],'user':[],'role':[],'position':[]},不区分单多选,单选只取第一个值 | ||||
|         type: Object, | ||||
|         default: function () { | ||||
|           return {'department':[],'user':[],'role':[],'position':[]} | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     data() { | ||||
|       return { | ||||
|         refresh: false, | ||||
|         dialogVisible: false, | ||||
|         loading: false, | ||||
|         searchKey: '', | ||||
|         treeSearchKey: '', | ||||
|         timeout:  null, | ||||
|         pid: '', | ||||
|         width: '500px', | ||||
|         treeProps: { | ||||
|           label: 'name', | ||||
|           isLeaf: 'leaf' | ||||
|         } | ||||
|       }; | ||||
|     }, | ||||
|     methods: { | ||||
|       handleClose(done) { | ||||
|         this.closeDlalog('cancel'); | ||||
|         done(); | ||||
|       }, | ||||
|       cancel() { | ||||
|         this.closeDlalog('cancel'); | ||||
|         this.dialogVisible = false; | ||||
|       }, | ||||
|       submit() { | ||||
|         this.closeDlalog('save'); | ||||
|         this.dialogVisible = false; | ||||
|       }, | ||||
|       closeDlalog(type) {// 取消/确定之后的关闭 | ||||
|         if (type == 'save') { | ||||
|           let result = []; | ||||
|           if (this.multiple) {// 多选 | ||||
|             result = this.$refs.tree.getCheckedNodes(); | ||||
|           } else {// 单选 | ||||
|             const node = this.$refs.tree.getCurrentNode(); | ||||
|             if (node != null) { | ||||
|               result.push(node); | ||||
|             } | ||||
|           } | ||||
|           this.$emit('getResult', JSON.parse(JSON.stringify(result))); | ||||
|         } else { | ||||
|           this.$emit('cancel'); | ||||
|         } | ||||
|         // 清空所有数据 | ||||
|       }, | ||||
|       handleNodeClick(data) { | ||||
|         // console.log(data); | ||||
|       }, | ||||
|       openNode(obj, node, tree) {// 打开一只模型文件 | ||||
| 
 | ||||
|       }, | ||||
|       treeSearchSelect(item) { | ||||
|         this.queryTreeByIdAndPath(item.id, item.path); | ||||
|       }, | ||||
|       treeSearch(key, cb) { | ||||
|         const that = this; | ||||
|         if (key != undefined && key.trim() != '') { | ||||
|           // that.loading = true; | ||||
|           const data = { | ||||
|             url:'jd', | ||||
|             data:{ | ||||
|               cmd: 'com.actionsoft.apps.coe.pal_repository_tree_component_search', | ||||
|               addressType: that.addressType, | ||||
|               rootDeptId: that.rootDeptId, | ||||
|               name: key | ||||
|             } | ||||
|           }; | ||||
|           // 查询数据 | ||||
|           awsuiAxios.post(data).then(function (ro) { | ||||
|             if (ro.result == 'ok') { | ||||
|               if (ro.data.length > 0) { | ||||
|                 clearTimeout(that.timeout); | ||||
|                 that.timeout = setTimeout(() => { | ||||
|                   cb(ro.data); | ||||
|                 }, 3000 * Math.random()); | ||||
|               } else { | ||||
|                 clearTimeout(that.timeout); | ||||
|               } | ||||
|             } else { | ||||
|               clearTimeout(that.timeout); | ||||
|             } | ||||
|           }).catch(error=>{ | ||||
|             console.log(error); | ||||
|           }) | ||||
|         } else { | ||||
|           clearTimeout(that.timeout); | ||||
|         } | ||||
|       }, | ||||
|       queryTreeByIdAndPath(id, path) {// 定位展开某节点 | ||||
|         const that= this; | ||||
|         const tree = that.$refs.tree; | ||||
|         // 分隔字符串 | ||||
|         const pathArr = path.split(','); | ||||
|         let index = 1; | ||||
|         for (let i = 0; i < pathArr.length; i++) {// 依次展开 | ||||
|           if (i > 0) { | ||||
|             if (tree.getNode(pathArr[i-1]) != null) { | ||||
|               setTimeout(that._expandNode(tree, pathArr[i-1]), index * 300); | ||||
|               index++; | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|         setTimeout(function() { | ||||
|           if (tree.getNode(id) != null) { | ||||
|             tree.setCurrentKey(id); | ||||
|           } | ||||
|         }, index * 300); | ||||
|       }, | ||||
|       _expandNode(tree, id) { | ||||
|         return function() { | ||||
|           tree.getNode(id).expand(); | ||||
|         } | ||||
|       }, | ||||
|       loadNode(node, resolve) {// `动态`加载 | ||||
|         const that = this; | ||||
|         that.loading = true; | ||||
|         const data = { | ||||
|           url:'jd', | ||||
|           data:{ | ||||
|             cmd: 'com.actionsoft.apps.coe.pal_bpm_org_address_component_subjson', | ||||
|             addressType: that.addressType, | ||||
|             pid: '', | ||||
|             highSecurityFilter: that.highSecurityFilter | ||||
|           } | ||||
|         }; | ||||
|         if (node.level === 0) { | ||||
|           // 获取根目录 | ||||
|           data.data.pid = that.pid; | ||||
|           data.data.parentType = ''; | ||||
|         } else { | ||||
|           // 获取其他目录 | ||||
|           data.data.pid = node.data.id; | ||||
|           data.data.parentType = node.data.type; | ||||
|         } | ||||
|         // 查询数据 | ||||
|         awsuiAxios.post(data).then(function (ro) { | ||||
|           // 设置是否可选中 | ||||
|           if (that.multiple) {// 多选 | ||||
|             const isDept = that.addressType.indexOf('department') > -1; | ||||
|             const isUser = that.addressType.indexOf('user') > -1; | ||||
|             const isRole = that.addressType.indexOf('role') > -1; | ||||
|             const isPosition = that.addressType.indexOf('position') > -1; | ||||
|             for (let i = 0; i < ro.data.length; i++) { | ||||
|               const curr = ro.data[i]; | ||||
|               if (curr.type == 'company' || curr.type == 'roleRoot' || curr.type == 'roleGroup' || curr.type == 'positionRoot' || curr.type == 'positionGroup') { | ||||
|                 curr.disabled = true; | ||||
|               } else { | ||||
|                 if (isDept && curr.type == 'department') curr.disabled = false; | ||||
|                 if (!isDept && curr.type == 'department') curr.disabled = true; | ||||
|                 if (isUser && curr.type == 'user') curr.disabled = false; | ||||
|                 if (!isUser && curr.type == 'user') curr.disabled = true; | ||||
|                 if (isRole && curr.type == 'role') curr.disabled = false; | ||||
|                 if (!isRole && curr.type == 'role') curr.disabled = true; | ||||
|                 if (isPosition && curr.type == 'position') curr.disabled = false; | ||||
|                 if (!isPosition && curr.type == 'position') curr.disabled = true; | ||||
|               } | ||||
|             } | ||||
|           }; | ||||
|           resolve(ro.data); | ||||
|           that.loading = false; | ||||
|           if (node.level == 0 && ro.data.length > 0) { | ||||
|             const tree = that.$refs.tree; | ||||
|             tree.getNode(ro.data[0].id).expand(); | ||||
|             setTimeout(function(){ | ||||
|               const childNode = tree.getNode(ro.data[0].id).childNodes[0]; | ||||
|               if (childNode != null) { | ||||
|                 childNode.expand(); | ||||
|               } | ||||
|             }, 500); | ||||
|           } | ||||
|         }).catch(error=>{ | ||||
|           console.log(error); | ||||
|         }) | ||||
|       }, | ||||
|       expandNode(obj, node, tree) {// 展开节点 | ||||
| 
 | ||||
|       }, | ||||
|       closeNode(obj, node, tree) {// 关闭时清空,下次展开重新请求动态加载 | ||||
|         node.childNodes = []; | ||||
|         node.loaded = false; | ||||
|       }, | ||||
|       refreshNode(id) {// 刷新当前选中节点的子节点,即关闭当前节点后重新打开,会执行loadNode进行自动加载 | ||||
|         if (id == undefined) {// 未指定节点,默认刷新当前选中 | ||||
|           const nodeData = this.$refs.tree.getCurrentNode(); | ||||
|           if (nodeData != null) { | ||||
|             if (this.$refs.tree.store.nodesMap[nodeData.id] != undefined) { | ||||
|               this.$refs.tree.store.nodesMap[nodeData.id].expanded = false; | ||||
|             } | ||||
|             const node = this.$refs.tree.getNode(nodeData.id); | ||||
|             this.closeNode(null, node, null); | ||||
|             node.expand(); | ||||
|           } | ||||
|         } else {// 指定刷新某节点 | ||||
|           if (this.$refs.tree.store.nodesMap[id] != undefined) { | ||||
|             this.$refs.tree.store.nodesMap[id].expanded = false; | ||||
|           } | ||||
|           const node = this.$refs.tree.getNode(id); | ||||
|           if (node != null) { | ||||
|             this.closeNode(null, node, null); | ||||
|             node.expand(); | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     watch: { | ||||
|       visible(val) { | ||||
|         this.dialogVisible = val; | ||||
|         if (val) {// 打开 | ||||
|           if (this.addressType.indexOf('department') > 0) { | ||||
|             this.pid = this.rootDeptId; | ||||
|           } | ||||
|           this.refresh = true; | ||||
|         } else {// 关闭 | ||||
|           this.refresh = false; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|   #bpmOrgAddress >>> .el-dialog__body { | ||||
|     padding: 10px 20px; | ||||
|     color: #606266; | ||||
|     font-size: 14px; | ||||
|     word-break: break-all; | ||||
|   } | ||||
|   #bpmOrgAddress >>> .el-input__inner { | ||||
|     border-radius: 0px; | ||||
|   } | ||||
|   #bpmOrgAddress >>> .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content { | ||||
|     background-color: #F5F7FA; | ||||
|     color: #4E7FF9; | ||||
|   } | ||||
|   #bpmOrgAddress >>> .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont { | ||||
|     color: #4E7FF9 !important; | ||||
|   } | ||||
|   /*#bpmOrgAddress >>> .el-tree .el-tree-node>.el-tree-node__children{*/ | ||||
|   /*  overflow: visible;*/ | ||||
|   /*}*/ | ||||
|   .tree{ | ||||
|     overflow: auto; | ||||
|     width:458px; | ||||
|     height: 300px; | ||||
|   } | ||||
|   #bpmOrgAddress >>> .el-tree { | ||||
|     min-width: 100%; | ||||
|     display:inline-block !important; | ||||
|   } | ||||
| </style> | ||||
| @ -0,0 +1,7 @@ | ||||
| import BPMOrgAddress from './component' | ||||
| 
 | ||||
| BPMOrgAddress.install = function(Vue) { | ||||
|   Vue.component(BPMOrgAddress.name, BPMOrgAddress); | ||||
| } | ||||
| 
 | ||||
| export  default BPMOrgAddress; | ||||
| @ -0,0 +1,2 @@ | ||||
| 说明:PAL模型树组件,复制的com.actionsoft.apps.coe.pal/src/components/common/PALRepositoryTree组件 | ||||
| 如有任何bug,请修改com.actionsoft.apps.coe.pal/src/components/common/PALRepositoryTree中的组件并完全覆盖此组件并修改该组件的awsuiAxios引用地址 | ||||
| @ -0,0 +1,338 @@ | ||||
| <template> | ||||
|   <el-container> | ||||
|     <el-dialog | ||||
|       id="palRepositoryTree" | ||||
|       :title="title" | ||||
|       :visible.sync="dialogVisible" | ||||
|       :destroy-on-close=true | ||||
|       :width="width" | ||||
|       :modal-append-to-body=false | ||||
|       :append-to-body=true | ||||
|       :close-on-click-modal=false | ||||
|       :before-close="handleClose"> | ||||
|       <template v-if="refresh"> | ||||
|         <div | ||||
|           v-loading="loading" | ||||
|           element-loading-text="拼命加载中"> | ||||
|           <el-autocomplete | ||||
|             v-model="treeSearchKey" | ||||
|             size="small" | ||||
|             :fetch-suggestions="treeSearch" | ||||
|             @select="treeSearchSelect" | ||||
|             suffix-icon="el-icon-search" | ||||
|             placeholder="快速查询" | ||||
|             :trigger-on-focus=false | ||||
|             style="width:100%;" | ||||
|           > | ||||
|             <template slot-scope="{ item }"> | ||||
|               <el-tooltip class="item" placement="bottom-start"> | ||||
|                 <div slot="content">{{item.pathName}}</div> | ||||
|                 <span>{{ item.name }}</span> | ||||
|               </el-tooltip> | ||||
|             </template> | ||||
|           </el-autocomplete> | ||||
|           <div style="height: 300px;overflow: auto;border: 1px solid #f2f2f2;"> | ||||
|             <div class="tree"> | ||||
|               <el-tree | ||||
|                 ref="tree" | ||||
|                 :props="treeProps" | ||||
|                 :expand-on-click-node=false | ||||
|                 :highlight-current=true | ||||
|                 @node-click="openNode" | ||||
|                 @node-expand="expandNode" | ||||
|                 @node-collapse="closeNode" | ||||
|                 :show-checkbox=multiple | ||||
|                 node-key="id" | ||||
|                 lazy | ||||
|                 :load="loadNode"> | ||||
|                 <span slot-scope="{node, data}"> | ||||
|                   <i class="awsui-iconfont tree-content-icon tree-content-icon-padding" :style="{'color': node.data.icon.color}" v-html="node.data.icon.icon"></i> | ||||
|                   <span>{{node.label}}</span> | ||||
|                 </span> | ||||
|               </el-tree> | ||||
|             </div> | ||||
|           </div> | ||||
|         </div> | ||||
|       </template> | ||||
|       <span slot="footer" class="dialog-footer"> | ||||
|         <awsui-button class="button-general-color" type="primary" @click="submit">确定</awsui-button> | ||||
|         <awsui-button @click="cancel">取消</awsui-button> | ||||
|       </span> | ||||
|      </el-dialog> | ||||
|   </el-container> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../../../awsuiAxios"; | ||||
| 
 | ||||
|     export default { | ||||
|       name: "PALRepositoryTree", | ||||
|       props: { | ||||
|         visible: { | ||||
|           type: Boolean, | ||||
|           default: false | ||||
|         }, | ||||
|         wsId: {// 资产库ID | ||||
|           type: String, | ||||
|           default: '', | ||||
|           required: true | ||||
|         }, | ||||
|         teamId: {// 小组ID | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         categorys: {// 建模大类,多个则逗号分隔 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         rootId: {// 父节点,为空则查询根节点 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         multiple: {// 是否多选 | ||||
|           type: Boolean, | ||||
|           default: false | ||||
|         }, | ||||
|         title: {// 标题 | ||||
|           type: String, | ||||
|           default: '请选择' | ||||
|         }, | ||||
|         // width: {// 宽度 | ||||
|         //   type: String, | ||||
|         //   default: '500px' | ||||
|         // }, | ||||
|         selected: {// 默认选中,比如[],不区分单多选,单选只取第一个值 | ||||
|           type: Array, | ||||
|           default: function () { | ||||
|             return [] | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       data() { | ||||
|         return { | ||||
|           refresh: false, | ||||
|           dialogVisible: false, | ||||
|           loading: false, | ||||
|           searchKey: '', | ||||
|           treeSearchKey: '', | ||||
|           timeout:  null, | ||||
|           pid: '', | ||||
|           width: '500px', | ||||
|           treeProps: { | ||||
|             label: 'name', | ||||
|             isLeaf: 'leaf' | ||||
|           } | ||||
|         }; | ||||
|       }, | ||||
|       methods: { | ||||
|         handleClose(done) { | ||||
|           this.closeDlalog('cancel'); | ||||
|           done(); | ||||
|         }, | ||||
|         cancel() { | ||||
|           this.closeDlalog('cancel'); | ||||
|             this.dialogVisible = false; | ||||
|           }, | ||||
|           submit() { | ||||
|             this.closeDlalog('save'); | ||||
|             this.dialogVisible = false; | ||||
|           }, | ||||
|           closeDlalog(type) {// 取消/确定之后的关闭 | ||||
|             if (type == 'save') { | ||||
|               let result = []; | ||||
|               if (this.checkbox) {// 多选 | ||||
|                 result = this.$refs.tree.getCheckedNodes(); | ||||
|               } else {// 单选 | ||||
|                 const node = this.$refs.tree.getCurrentNode(); | ||||
|                 if (node != null) { | ||||
|                   result.push(node); | ||||
|                 } | ||||
|               } | ||||
|             this.$emit('getResult', result); | ||||
|           } else { | ||||
|             this.$emit('cancel'); | ||||
|           } | ||||
|           // 清空所有数据 | ||||
|         }, | ||||
|         handleNodeClick(data) { | ||||
|           console.log(data); | ||||
|         }, | ||||
|         openNode(obj, node, tree) {// 打开一只模型文件 | ||||
| 
 | ||||
|         }, | ||||
|         treeSearchSelect(item) { | ||||
|           this.queryTreeByIdAndPath(item.id, item.versionId, item.path); | ||||
|         }, | ||||
|         treeSearch(key, cb) { | ||||
|           const that = this; | ||||
|           if (key != undefined && key.trim() != '') { | ||||
|             // that.loading = true; | ||||
|             const data = { | ||||
|               url:'jd', | ||||
|               data:{ | ||||
|                 cmd: 'com.actionsoft.apps.coe.pal_repository_tree_component_search', | ||||
|                 wsId: that.wsId, | ||||
|                 teamId: that.teamId, | ||||
|                 categorys: that.categorys, | ||||
|                 rootId: that.rootId, | ||||
|                 name: key | ||||
|               } | ||||
|             }; | ||||
|             // 查询数据 | ||||
|             awsuiAxios.post(data).then(function (ro) { | ||||
|               if (ro.result == 'ok') { | ||||
|                 if (ro.data.length > 0) { | ||||
|                   clearTimeout(that.timeout); | ||||
|                   that.timeout = setTimeout(() => { | ||||
|                     cb(ro.data); | ||||
|                   }, 3000 * Math.random()); | ||||
|                 } else { | ||||
|                   clearTimeout(that.timeout); | ||||
|                 } | ||||
|               } else { | ||||
|                 clearTimeout(that.timeout); | ||||
|               } | ||||
|             }).catch(error=>{ | ||||
|               console.log(error); | ||||
|             }) | ||||
|           } else { | ||||
|             clearTimeout(that.timeout); | ||||
|           } | ||||
|         }, | ||||
|         queryTreeByIdAndPath(id, versionId, path) {// 定位展开某节点 | ||||
|           const that= this; | ||||
|           const tree = that.$refs.tree; | ||||
|           // 分隔字符串 | ||||
|           const pathArr = path.split(','); | ||||
|           let index = 1; | ||||
|           for (let i = 0; i < pathArr.length; i++) {// 依次展开 | ||||
|             if (i > 0) { | ||||
|               if (tree.getNode(pathArr[i-1]) != null) { | ||||
|                 setTimeout(that._expandNode(tree, pathArr[i-1]), index * 300); | ||||
|                 index++; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           setTimeout(function() { | ||||
|             if (tree.getNode(versionId) != null) { | ||||
|               tree.setCurrentKey(versionId); | ||||
|             } | ||||
|           }, index * 300); | ||||
|         }, | ||||
|         _expandNode(tree, versionId) { | ||||
|           return function() { | ||||
|             tree.getNode(versionId).expand(); | ||||
|           } | ||||
|         }, | ||||
|         loadNode(node, resolve) {// `动态`加载 | ||||
|           const that = this; | ||||
|           that.loading = true; | ||||
|           const data = { | ||||
|             url:'jd', | ||||
|             data:{ | ||||
|               cmd: 'com.actionsoft.apps.coe.pal_repository_tree_component_subjson', | ||||
|               wsId: that.wsId, | ||||
|               teamId: that.teamId, | ||||
|               categorys: that.categorys, | ||||
|               pid: '' | ||||
|             } | ||||
|           }; | ||||
|           if (node.level === 0) { | ||||
|             // 获取根目录 | ||||
|             data.data.pid = that.pid; | ||||
|           } else { | ||||
|             // 获取其他目录 | ||||
|             data.data.pid = node.data.id; | ||||
|           } | ||||
|           // 查询数据 | ||||
|           awsuiAxios.post(data).then(function (ro) { | ||||
|             resolve(ro.data); | ||||
|             that.loading = false; | ||||
|             if (node.level == 0 && ro.data.length > 0) { | ||||
|               const tree = that.$refs.tree; | ||||
|               tree.getNode(ro.data[0].id).expand(); | ||||
|               setTimeout(function(){ | ||||
|                 const childNode = tree.getNode(ro.data[0].id).childNodes[0]; | ||||
|                 if (childNode != null) { | ||||
|                   childNode.expand(); | ||||
|                 } | ||||
|               }, 500); | ||||
|             } | ||||
|           }).catch(error=>{ | ||||
|             console.log(error); | ||||
|           }) | ||||
|         }, | ||||
|         expandNode(obj, node, tree) {// 展开节点 | ||||
| 
 | ||||
|         }, | ||||
|         closeNode(obj, node, tree) {// 关闭时清空,下次展开重新请求动态加载 | ||||
|           node.childNodes = []; | ||||
|           node.loaded = false; | ||||
|         }, | ||||
|         refreshNode(id) {// 刷新当前选中节点的子节点,即关闭当前节点后重新打开,会执行loadNode进行自动加载 | ||||
|           if (id == undefined) {// 未指定节点,默认刷新当前选中 | ||||
|             const nodeData = this.$refs.tree.getCurrentNode(); | ||||
|             if (nodeData != null) { | ||||
|               if (this.$refs.tree.store.nodesMap[nodeData.id] != undefined) { | ||||
|                 this.$refs.tree.store.nodesMap[nodeData.id].expanded = false; | ||||
|               } | ||||
|               const node = this.$refs.tree.getNode(nodeData.id); | ||||
|               this.closeNode(null, node, null); | ||||
|               node.expand(); | ||||
|             } | ||||
|           } else {// 指定刷新某节点 | ||||
|             if (this.$refs.tree.store.nodesMap[id] != undefined) { | ||||
|               this.$refs.tree.store.nodesMap[id].expanded = false; | ||||
|             } | ||||
|             const node = this.$refs.tree.getNode(id); | ||||
|             if (node != null) { | ||||
|               this.closeNode(null, node, null); | ||||
|               node.expand(); | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       watch: { | ||||
|         visible(val) { | ||||
|           this.dialogVisible = val; | ||||
|           if (val) {// 打开 | ||||
|             this.pid = this.rootId; | ||||
|             this.refresh = true; | ||||
|           } else {// 关闭 | ||||
|             this.refresh = false; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|   #palRepositoryTree >>> .el-dialog__body { | ||||
|     padding: 10px 20px; | ||||
|     color: #606266; | ||||
|     font-size: 14px; | ||||
|     word-break: break-all; | ||||
|   } | ||||
|   #palRepositoryTree >>> .el-input__inner { | ||||
|     border-radius: 0px; | ||||
|   } | ||||
|   #palRepositoryTree >>> .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content { | ||||
|     background-color: #F5F7FA; | ||||
|     color: #4E7FF9; | ||||
|   } | ||||
|   #palRepositoryTree >>> .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont { | ||||
|     color: #4E7FF9 !important; | ||||
|   } | ||||
|   /*#palRepositoryTree >>> .el-tree .el-tree-node>.el-tree-node__children{*/ | ||||
|   /*  overflow: visible;*/ | ||||
|   /*}*/ | ||||
|   .tree{ | ||||
|     overflow: auto; | ||||
|     width:458px; | ||||
|     height: 300px; | ||||
|   } | ||||
|   #palRepositoryTree >>> .el-tree { | ||||
|     min-width: 100%; | ||||
|     display:inline-block !important; | ||||
|   } | ||||
| </style> | ||||
| @ -0,0 +1,7 @@ | ||||
| import PALRepositoryTree from './component' | ||||
| 
 | ||||
| PALRepositoryTree.install = function(Vue) { | ||||
|   Vue.component(PALRepositoryTree.name, PALRepositoryTree); | ||||
| } | ||||
| 
 | ||||
| export  default PALRepositoryTree; | ||||
| @ -0,0 +1 @@ | ||||
| 属性特性树 | ||||
| @ -0,0 +1,141 @@ | ||||
| <template> | ||||
|     <awsui-dialog | ||||
|             title="请选择属性" | ||||
|             :visible.sync="dialogVisible" | ||||
|             destroy-on-close | ||||
|             :before-close="handleClose" | ||||
|             :close-on-click-modal=false | ||||
|             :modal-append-to-body=false | ||||
|             :append-to-body=true | ||||
|             width="500px" | ||||
|             height="300px"> | ||||
|         <div v-if="refresh"> | ||||
|             <el-tree | ||||
|                     ref="attrTree" | ||||
|                     :data="attributeDlg.tree.data" | ||||
|                     :props="attributeDlg.tree.props" | ||||
|                     highlight-current | ||||
|                     :expand-on-click-node=false | ||||
|                     default-expand-all | ||||
|                     node-key="id"> | ||||
|             <span slot-scope="{node, data}"> | ||||
|               <i class="awsui-iconfont tree-content-icon tree-content-icon-padding" :style="{'color': data.iconColor}" v-html="node.data.iconCode"></i> | ||||
|               <span>{{node.label}}</span> | ||||
|             </span> | ||||
|             </el-tree> | ||||
|         </div> | ||||
|         <span slot="footer" class="dialog-footer"> | ||||
|                 <awsui-button type="primary" @click="submit">确定</awsui-button> | ||||
|                 <awsui-button @click="cancel">取消</awsui-button> | ||||
|             </span> | ||||
|     </awsui-dialog> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../../../awsuiAxios"; | ||||
| 
 | ||||
|     export default { | ||||
|         name: "PalAttributeTree", | ||||
|         props: { | ||||
|             visible: { | ||||
|                 type: Boolean, | ||||
|                 default: false | ||||
|             }, | ||||
|             methodId: { | ||||
|                 type: String, | ||||
|                 default: '', | ||||
|             }, | ||||
|             type: { | ||||
|                 type: String, | ||||
|                 default: 'file' | ||||
|             } | ||||
|         }, | ||||
|         data() { | ||||
|             return { | ||||
|                 refresh: false, | ||||
|                 dialogVisible: false, | ||||
|                 loading: false, | ||||
|                 attributeDlg: { | ||||
|                     tree: { | ||||
|                         props: { | ||||
|                             children: 'children', | ||||
|                             label: 'label' | ||||
|                         }, | ||||
|                         data: [] | ||||
|                     }, | ||||
|                     visible: false, | ||||
|                     currGroup: 0, | ||||
|                     currRow: 0 | ||||
|                 }, | ||||
|             } | ||||
|         }, | ||||
|         methods: { | ||||
|             initTree() {// 打开自定义属性树 | ||||
|                 const that = this; | ||||
|                 // 查询特性树 | ||||
|                 that.attributeDlg.tree.data = []; | ||||
|                 that.attributeDlg.visible = true; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd: 'com.actionsoft.apps.coe.pal.batch_replace_attribute_tree_data_query', | ||||
|                         wsId: wsId, | ||||
|                         type: that.type, | ||||
|                         methodId: that.methodId | ||||
|                     } | ||||
|                 }; | ||||
|                 // 查询数据 | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     if(ro.result == 'ok') { | ||||
|                         that.attributeDlg.tree.data = ro.data; | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             handleClose(done) { | ||||
|                 this.closeDlalog('cancel'); | ||||
|                 done(); | ||||
|             }, | ||||
|             cancel() { | ||||
|                 this.closeDlalog('cancel'); | ||||
|                 this.dialogVisible = false; | ||||
|             }, | ||||
|             submit() { | ||||
|                 const isOk = this.closeDlalog('save'); | ||||
|                 if (isOk) { | ||||
|                     this.dialogVisible = false; | ||||
|                 } | ||||
|             }, | ||||
|             closeDlalog(type) {// 取消/确定之后的关闭 | ||||
|                 if (type == 'save') { | ||||
|                     const node = this.$refs.attrTree.getCurrentNode(); | ||||
|                     if (node == null || node.type == 'group') { | ||||
|                         this.$message({message: '请选择属性',type: 'warning'}); | ||||
|                         return false; | ||||
|                     } | ||||
|                     this.$emit('getResult', JSON.parse(JSON.stringify(node))); | ||||
|                 } else { | ||||
|                     this.$emit('cancel'); | ||||
|                 } | ||||
|                 // 清空所有数据 | ||||
|             } | ||||
|         }, | ||||
|         watch: { | ||||
|             visible(val) { | ||||
|                 this.dialogVisible = val; | ||||
|                 if (val) {// 打开 | ||||
|                     this.refresh = true; | ||||
|                     this.initTree();// 初始化查询 | ||||
|                 } else {// 关闭 | ||||
|                     this.refresh = false; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
| 
 | ||||
| </style> | ||||
| @ -0,0 +1,7 @@ | ||||
| import PalAttributeTree from './component' | ||||
| 
 | ||||
| PalAttributeTree.install = function(Vue) { | ||||
|     Vue.component(PalAttributeTree.name, PalAttributeTree); | ||||
| } | ||||
| 
 | ||||
| export  default PalAttributeTree; | ||||
| @ -0,0 +1,3 @@ | ||||
| 说明:调用pal的组织、数据、控制等关联属性,包括前后置流程 | ||||
| 复制的com.actionsoft.apps.coe.pal/src/components/common/PalRelationAddress组件 | ||||
| 如有任何bug,请修改com.actionsoft.apps.coe.pal/src/components/common/PalRelationAddress中的组件并完全覆盖此组件并修改该组件的awsuiAxios引用地址 | ||||
| @ -0,0 +1,832 @@ | ||||
| <template> | ||||
|   <el-container> | ||||
|     <el-dialog | ||||
|       id="palRelationAddress" | ||||
|       :title="title" | ||||
|       :visible.sync="dialogVisible" | ||||
|       width="800px" | ||||
|       :modal-append-to-body=false | ||||
|       :destroy-on-close=true | ||||
|       :append-to-body=true | ||||
|       :close-on-click-modal=false | ||||
|       :before-close="handleClose"> | ||||
|       <template> | ||||
|         <div v-if="dialogVisible" style="width:100%; height: 400px; border:1px solid #f2f2f2;"> | ||||
|           <div class="div-left" :style="{'width': (relationType == 'file' ? '373px' : '249px')}"> | ||||
|             <div style="width: 100%;height: 32px;"> | ||||
|               <el-autocomplete | ||||
|                 v-model="treeSearchKey" | ||||
|                 size="small" | ||||
|                 :fetch-suggestions="treeSearch" | ||||
|                 @select="treeSearchSelect" | ||||
|                 suffix-icon="el-icon-search" | ||||
|                 placeholder="快速查询" | ||||
|                 :trigger-on-focus=false | ||||
|                 :style="{'width': (relationType == 'file' ? '373px' : '249px')}" | ||||
|               > | ||||
|                 <template slot-scope="{ item }"> | ||||
|                   <el-tooltip class="item" placement="bottom-start"> | ||||
|                     <div slot="content">{{item.pathName}}</div> | ||||
|                     <span>{{ item.name }}</span> | ||||
|                   </el-tooltip> | ||||
|                 </template> | ||||
|               </el-autocomplete> | ||||
|             </div> | ||||
|             <div> | ||||
|               <div style="height: 368px;overflow: auto;"> | ||||
|                 <div style="margin: 0px;"> | ||||
|                   <el-tree | ||||
|                     ref="tree" | ||||
|                     empty-text="无数据" | ||||
|                     :expand-on-click-node=false | ||||
|                     :props="treeProps" | ||||
|                     :show-checkbox="relationType == 'file' && multiple" | ||||
|                     :check-strictly=true | ||||
|                     :highlight-current=true | ||||
|                     @node-expand="expandNode" | ||||
|                     @node-collapse="closeNode" | ||||
|                     @check-change="handleNodeCheckChange" | ||||
|                     node-key="id" | ||||
|                     lazy | ||||
|                     :load="loadNode" | ||||
|                     @node-click="handleNodeClick"> | ||||
|                     <span slot-scope="{node, data}"> | ||||
|                       <i class="awsui-iconfont tree-content-icon tree-content-icon-padding" :style="{'color': node.data.icon.color}" v-html="node.data.icon.icon"></i> | ||||
|                       <span>{{node.label}}</span> | ||||
|                     </span> | ||||
|                   </el-tree> | ||||
|                 </div> | ||||
|               </div> | ||||
|             </div> | ||||
|           </div> | ||||
|           <div v-if="relationType != 'file'" class="div-middle"> | ||||
|             <div style="width: 100%;height: 32px;"> | ||||
|               <el-input | ||||
|                 size="small" | ||||
|                 placeholder="快速查询" | ||||
|                 suffix-icon="el-icon-search" | ||||
|                 v-model="shapeSearchKey" | ||||
|                 @input="shapeSearch" | ||||
|                 width="249px"> | ||||
|               </el-input> | ||||
|             </div> | ||||
|             <div> | ||||
|               <div style="height: 368px;overflow: auto;"> | ||||
|                 <div style="margin: 0px;"> | ||||
|                   <template v-if="multiple"> | ||||
|                     <el-checkbox-group style="margin: 5px 0px 5px 5px;" v-model="shapeChecked" @change="handleChangeCheckShape"> | ||||
|                       <el-checkbox class="checkbox-item" v-for="item in shapeData" :label="item.id" :key="item.id" :disabled="item.isDisabled">{{item.name}}</el-checkbox> | ||||
|                     </el-checkbox-group> | ||||
|                   </template> | ||||
|                   <template v-else> | ||||
|                     <el-radio-group style="margin: 5px 0px 5px 5px;" v-model="shapeSelected" @change="handleChangeRadioShape"> | ||||
|                       <el-radio class="redio-item" v-for="item in shapeData" :label="item.id" :key="item.id" :disabled="item.isDisabled">{{item.name}}</el-radio> | ||||
|                     </el-radio-group> | ||||
|                   </template> | ||||
|                 </div> | ||||
|               </div> | ||||
|             </div> | ||||
|           </div> | ||||
|           <div class="div-right" :style="{'width': (relationType == 'file' ? '373px' : '249px')}"> | ||||
|             <div style="height: 100%;"> | ||||
|               <template> | ||||
|                 <el-table | ||||
|                   :data="tableData" | ||||
|                   :show-header=false | ||||
|                   empty-text="请在左侧选择数据" | ||||
|                   size="mini" | ||||
|                   height="400px" | ||||
|                   style="width: 100%"> | ||||
|                   <el-table-column | ||||
|                     prop="name" | ||||
|                     label="名称"> | ||||
|                   </el-table-column> | ||||
|                   <el-table-column | ||||
|                     prop="address" | ||||
|                     label="操作" | ||||
|                     width="40"> | ||||
|                     <template slot-scope="scope"> | ||||
|                       <div class="icon-delete-display"> | ||||
|                         <i class="iconfont" style="cursor: pointer;" @click="remove(scope.row.id)"></i> | ||||
|                       </div> | ||||
|                     </template> | ||||
|                   </el-table-column> | ||||
|                 </el-table> | ||||
|               </template> | ||||
|             </div> | ||||
|           </div> | ||||
|         </div> | ||||
|       </template> | ||||
|       <span slot="footer" class="dialog-footer"> | ||||
|         <awsui-button class="button-general-color" type="primary" @click="submit">确定</awsui-button> | ||||
|         <awsui-button @click="cancel">取消</awsui-button> | ||||
|       </span> | ||||
|      </el-dialog> | ||||
|   </el-container> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../../../awsuiAxios"; | ||||
| 
 | ||||
|     export default { | ||||
|       name: "PalRelationAddress", | ||||
|       props: { | ||||
|         visible: { | ||||
|           type: Boolean, | ||||
|           default: false | ||||
|         }, | ||||
|         relationType: {// 关联组件类型,shape/file,关联形状/文件,默认形状 | ||||
|           type: String, | ||||
|           default: 'shape' | ||||
|         }, | ||||
|         multiple: {// 选值类型,单选single,多选multiple,默认单选 | ||||
|           type: Boolean, | ||||
|           default: false | ||||
|         }, | ||||
|         title: {// 标题 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         selectFileId: {// 选择的文件id,多个以逗号分隔 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         selectShapeId: {// 选择的形状id,多个以逗号分隔 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         wsId: {// 资产库ID | ||||
|           type: String, | ||||
|           default: '', | ||||
|           required: true | ||||
|         }, | ||||
|         teamId: {// 小组ID | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         categorys: {// 建模大类,多个则逗号分隔 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         methods: {// 建模分类,多个则逗号分隔,空值默认可选所有建模方法数据,非空则只能选择范围内的数据,数据显示不控制 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         }, | ||||
|         rootId: {// 指定根节点,为空则查询根节点 | ||||
|           type: String, | ||||
|           default: '' | ||||
|         } | ||||
|       }, | ||||
|       data() { | ||||
|         return { | ||||
|           dialogVisible: false, | ||||
|           pid: '', | ||||
|           shapeSearchKey: '', | ||||
|           shapeChecked: [], | ||||
|           shapeSelected: '', | ||||
|           shapeRecords: {}, | ||||
|           treeProps: { | ||||
|             label: 'name', | ||||
|             isLeaf: 'leaf' | ||||
|           }, | ||||
|           tableData: [], | ||||
|           shapeData: [], | ||||
|           shapeTempData: [], | ||||
|           treeSearchKey: '', | ||||
|           timeout:  null, | ||||
|           result: [],// [{id:xxx,versionId:xxx,name:xxxx,children:[{shapeId:xxx,name:xxx},{shapeId:xxx,name:xxx}]}] | ||||
|         }; | ||||
|       }, | ||||
|       created() { | ||||
|       }, | ||||
|       methods: { | ||||
|         clearAllParam() { | ||||
|           this.pid = ''; | ||||
|           this.shapeSearchKey = ''; | ||||
|           this.shapeChecked = []; | ||||
|           this.shapeSelected = ''; | ||||
|           this.shapeRecords = {}; | ||||
|           this.tableData = []; | ||||
|           this.shapeData = []; | ||||
|           this.shapeTempData = []; | ||||
|           this.treeSearchKey = ''; | ||||
|           this.timeout = null; | ||||
|           this.result = []; | ||||
|         }, | ||||
|         shapeSearch() {// 形状搜索 | ||||
|           if (this.shapeSearchKey && this.shapeSearchKey.trim() != '') { | ||||
|             const key = this.shapeSearchKey.trim().toLocaleLowerCase(); | ||||
|             const shapeData = []; | ||||
|             for (let i = 0; i < this.shapeTempData.length; i++) { | ||||
|               const shape = this.shapeTempData[i]; | ||||
|               if (shape.name != '') { | ||||
|                 let name = (shape.name + '').toLocaleLowerCase(); | ||||
|                 if (name.indexOf(key) != -1) { | ||||
|                   shapeData.push(JSON.parse(JSON.stringify(shape))); | ||||
|                 } | ||||
|               } | ||||
|             } | ||||
|             this.shapeData = shapeData; | ||||
|           } else { | ||||
|             this.shapeData = JSON.parse(JSON.stringify(this.shapeTempData)); | ||||
|           } | ||||
|         }, | ||||
|         treeSearchSelect(item) { | ||||
|           this.queryTreeByIdAndPath(item.id, item.path); | ||||
|         }, | ||||
|         treeSearch(key, cb) { | ||||
|           const that = this; | ||||
|           if (key != undefined && key.trim() != '') { | ||||
|             const data = { | ||||
|               url:'jd', | ||||
|               data:{ | ||||
|                 cmd: 'com.actionsoft.apps.coe.pal_repository_tree_component_search', | ||||
|                 wsId: that.wsId, | ||||
|                 teamId: that.teamId, | ||||
|                 categorys: that.categorys, | ||||
|                 rootId: that.rootId, | ||||
|                 name: key | ||||
|               } | ||||
|             }; | ||||
|             // 查询数据 | ||||
|             awsuiAxios.post(data).then(function (ro) { | ||||
|               if (ro.result == 'ok') { | ||||
|                 if (ro.data.length > 0) { | ||||
|                   clearTimeout(that.timeout); | ||||
|                   that.timeout = setTimeout(() => { | ||||
|                     cb(ro.data); | ||||
|                   }, 3000 * Math.random()); | ||||
|                 } else { | ||||
|                   clearTimeout(that.timeout); | ||||
|                 } | ||||
|               } else { | ||||
|                 clearTimeout(that.timeout); | ||||
|               } | ||||
|             }).catch(error=>{ | ||||
|               console.log(error); | ||||
|             }) | ||||
|           } else { | ||||
|             clearTimeout(that.timeout); | ||||
|           } | ||||
|         }, | ||||
|         queryTreeByIdAndPath(id, path) {// 定位展开某节点 | ||||
|           const that= this; | ||||
|           const tree = that.$refs.tree; | ||||
|           // 分隔字符串 | ||||
|           const pathArr = path.split(','); | ||||
|           let index = 1; | ||||
|           for (let i = 0; i < pathArr.length; i++) {// 依次展开 | ||||
|             if (i > 0) { | ||||
|               if (tree.getNode(pathArr[i-1]) != null) { | ||||
|                 setTimeout(that._expandNode(tree, pathArr[i-1]), index * 300); | ||||
|                 index++; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           setTimeout(function() { | ||||
|             if (tree.getNode(id) != null) { | ||||
|               tree.setCurrentKey(id); | ||||
|             } | ||||
|           }, index * 300); | ||||
|         }, | ||||
|         _expandNode(tree, id) { | ||||
|           return function() { | ||||
|             tree.getNode(id).expand(); | ||||
|           } | ||||
|         }, | ||||
|         loadNode(node, resolve) {// `动态`加载 | ||||
|           const that = this; | ||||
|           // that.loading = true; | ||||
|           const data = { | ||||
|             url:'jd', | ||||
|             data:{ | ||||
|               cmd: 'com.actionsoft.apps.coe.pal_repository_tree_component_subjson', | ||||
|               wsId: that.wsId, | ||||
|               teamId: that.teamId, | ||||
|               categorys: that.categorys, | ||||
|               pid: '' | ||||
|             } | ||||
|           }; | ||||
|           if (node.level === 0) { | ||||
|             // 获取根目录 | ||||
|             data.data.pid = that.pid; | ||||
|           } else { | ||||
|             // 获取其他目录 | ||||
|             data.data.pid = node.data.id; | ||||
|           } | ||||
|           // 查询数据 | ||||
|           awsuiAxios.post(data).then(function (ro) { | ||||
|             for (let i = 0; i < ro.data.length; i++) { | ||||
|               if (ro.data[i].id.length < 36) { | ||||
|                 ro.data[i].disabled = true; | ||||
|               } else { | ||||
|                 if (that.categorys != '' && that.methods != '') { | ||||
|                   if (that.methods.indexOf(ro.data[i].plMethodId) > -1) { | ||||
|                     ro.data[i].disabled = false; | ||||
|                   } else { | ||||
|                     ro.data[i].disabled = true; | ||||
|                   } | ||||
|                 } else if (that.categorys != '') { | ||||
|                   if (that.categorys.indexOf(ro.data[i].plCategory) > -1) { | ||||
|                     ro.data[i].disabled = false; | ||||
|                   } else { | ||||
|                     ro.data[i].disabled = true; | ||||
|                   } | ||||
|                 } else { | ||||
|                   if (that.methods.indexOf(ro.data[i].plMethodId) > -1) { | ||||
|                     ro.data[i].disabled = false; | ||||
|                   } else { | ||||
|                     ro.data[i].disabled = true; | ||||
|                   } | ||||
|                 } | ||||
|               } | ||||
|             } | ||||
|             resolve(ro.data); | ||||
|             that.initTreeCheck(); | ||||
|             // that.loading = false; | ||||
|             if (node.level == 0 && ro.data.length > 0) { | ||||
|               const tree = that.$refs.tree; | ||||
|               tree.getNode(ro.data[0].id).expand(); | ||||
|               setTimeout(function(){ | ||||
|                 const childNode = tree.getNode(ro.data[0].id).childNodes[0]; | ||||
|                 if (childNode != null) { | ||||
|                   childNode.expand(); | ||||
|                 } | ||||
|               }, 500); | ||||
|             } | ||||
|           }).catch(error=>{ | ||||
|             console.log(error); | ||||
|           }) | ||||
|         }, | ||||
|         expandNode(obj, node, tree) {// 展开节点 | ||||
| 
 | ||||
|         }, | ||||
|         closeNode(obj, node, tree) {// 关闭时清空,下次展开重新请求动态加载 | ||||
|           node.childNodes = []; | ||||
|           node.loaded = false; | ||||
|         }, | ||||
|         initTreeCheck() {// 初始化树选中节点 | ||||
|           const relationType = this.relationType; | ||||
|           if (relationType == 'file') {// 文件类型 | ||||
|             if (this.multiple) {// 多选 | ||||
|               const  result = this.result; | ||||
|               const tree = this.$refs.tree; | ||||
|               for (let i = 0; i < result.length; i++) { | ||||
|                 if (tree.getNode(result[i].id) != null) { | ||||
|                   tree.setChecked(result[i].id, true); | ||||
|                 } | ||||
|               } | ||||
|             } else {// 单选 | ||||
|               const  result = this.result; | ||||
|               const tree = this.$refs.tree; | ||||
|               for (let i = 0; i < result.length; i++) { | ||||
|                 if (tree.getNode(result[i].id) != null) { | ||||
|                   tree.setCurrentKey(result[i].id); | ||||
|                 } | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         handleNodeCheckChange(data, isCheck) {// 树多选,只有在relationType为file时会出现 | ||||
|           if (isCheck) {// 选中 | ||||
|             const  result = this.result; | ||||
|             if (!this.isFileExist(result,data.id, data.versionId)) { | ||||
|               const tempObj = {}; | ||||
|               tempObj.id = data.id; | ||||
|               tempObj.versionId = data.versionId; | ||||
|               tempObj.name = data.name; | ||||
|               tempObj.children = []; | ||||
|               result.push(tempObj); | ||||
|               this.initTableData(); | ||||
|             } | ||||
|           } else {// 取消选中 | ||||
|             this.remove(data.id); | ||||
|           } | ||||
|         }, | ||||
|         handleClose(done) { | ||||
|           this.closeDlalog('cancel'); | ||||
|           done(); | ||||
|         }, | ||||
|         cancel() { | ||||
|           this.closeDlalog('cancel'); | ||||
|           this.dialogVisible = false; | ||||
|         }, | ||||
|         submit() { | ||||
|           this.closeDlalog('save'); | ||||
|           this.dialogVisible = false; | ||||
|         }, | ||||
|         closeDlalog(type) {// 取消/确定之后的关闭 | ||||
|           if (type == 'save') { | ||||
|             const result = JSON.parse(JSON.stringify(this.result)); | ||||
|             if (this.relationType == 'file') { | ||||
|               for (let i = 0; i < result.length; i++) { | ||||
|                 delete result[i].children; | ||||
|               } | ||||
|             } | ||||
|             this.$emit('getResult', result); | ||||
|           } else { | ||||
|             this.$emit('cancel'); | ||||
|           } | ||||
|           // 清空所有数据 | ||||
|           this.clearAllParam(); | ||||
|         }, | ||||
|         handleNodeClick(data) {// 树节点点击 | ||||
|           const that = this; | ||||
|           const relationType = this.relationType; | ||||
|           if (relationType == 'file') {// 关联类型是文件 | ||||
|             if (!this.multiple) {// 单选处理,单选为选中 | ||||
|               // 判断 | ||||
|               if (that.categorys != '' && that.methods != '') { | ||||
|                 if (that.methods.indexOf(data.plMethodId) == -1) { | ||||
|                   // 不支持 | ||||
|                   that.$message({message: '不支持关联的模型',type: 'warning'}); | ||||
|                   return; | ||||
|                 } | ||||
|               } else if (that.categorys != '') { | ||||
|                 if (that.categorys.indexOf(data.plCategory) == -1) { | ||||
|                   that.$message({message: '不支持关联的模型',type: 'warning'}); | ||||
|                   return; | ||||
|                 } | ||||
|               } else { | ||||
|                 if (that.methods.indexOf(data.plMethodId) == -1) { | ||||
|                   that.$message({message: '不支持关联的模型',type: 'warning'}); | ||||
|                   return; | ||||
|                 } | ||||
|               } | ||||
|               this.result = [];// 清空 | ||||
|               const result = this.result; | ||||
|               const tempObj = {}; | ||||
|               tempObj.id = data.id; | ||||
|               tempObj.versionId = data.versionId; | ||||
|               tempObj.name = data.name; | ||||
|               tempObj.children = []; | ||||
|               result.push(tempObj); | ||||
|               this.initTableData(); | ||||
|             } | ||||
|           } else {// 关联类型是形状 | ||||
|             // 查询节点列表 | ||||
|             const that = this; | ||||
|             that.shapeSearchKey = ''; | ||||
|             const params = { | ||||
|               url:'jd', | ||||
|               data:{ | ||||
|                 cmd: 'com.actionsoft.apps.coe.pal_repository_tree_component_shapejson', | ||||
|                 id: data.id | ||||
|               } | ||||
|             }; | ||||
|             let isDisabled = true; | ||||
|             if (that.categorys != '' && that.methods != '') { | ||||
|               if (that.methods.indexOf(data.plMethodId) > -1) { | ||||
|                 isDisabled = false; | ||||
|               } else { | ||||
|                 isDisabled = true; | ||||
|               } | ||||
|             } else if (that.categorys != '') { | ||||
|               if (that.categorys.indexOf(data.plCategory) > -1) { | ||||
|                 isDisabled = false; | ||||
|               } else { | ||||
|                 isDisabled = true; | ||||
|               } | ||||
|             } else { | ||||
|               if (that.methods.indexOf(data.plMethodId) > -1) { | ||||
|                 isDisabled = false; | ||||
|               } else { | ||||
|                 isDisabled = true; | ||||
|               } | ||||
|             } | ||||
|             // 查询数据 | ||||
|             awsuiAxios.post(params).then(function (ro) { | ||||
|               if (ro.result == 'ok') { | ||||
|                 const list = ro.data.list; | ||||
|                 const tempData = []; | ||||
|                 for (let i = 0; i < list.length; i++) { | ||||
|                   const obj = { | ||||
|                     id: list[i].id, | ||||
|                     name: list[i].name, | ||||
|                     fileId: list[i].fileId, | ||||
|                     fileName: list[i].fileName, | ||||
|                     versionId: list[i].versionId, | ||||
|                     isDisabled: isDisabled | ||||
|                   } | ||||
| 
 | ||||
|                   tempData.push(obj); | ||||
|                   that.shapeRecords[list[i].id] = obj; | ||||
|                 } | ||||
|                 that.shapeData = tempData; | ||||
|                 that.shapeTempData = JSON.parse(JSON.stringify(that.shapeData));// 拷贝一份临时数据 | ||||
|               } | ||||
|             }).catch(error=>{ | ||||
|               console.log(error); | ||||
|             }) | ||||
|           } | ||||
|         }, | ||||
|         initTableData() {// 初始化最右侧表格 | ||||
|           const relationType = this.relationType; | ||||
|           if (relationType == 'file') {// 关联类型是文件 | ||||
|             const result = this.result; | ||||
|             const tempData = []; | ||||
|             for (let i = 0; i < result.length; i++) { | ||||
|               const tempObj = { | ||||
|                 id: result[i].id, | ||||
|                 name: result[i].name, | ||||
|                 versionId: result[i].versionId | ||||
|               } | ||||
|               tempData.push(tempObj); | ||||
|             } | ||||
|             this.tableData = tempData; | ||||
|           } else {// 关联类型是形状 | ||||
|             const result = this.result; | ||||
|             const tempData = []; | ||||
|             for (let i = 0; i < result.length; i++) { | ||||
|               const currFile = result[i]; | ||||
|               const children = currFile.children; | ||||
|               for (let j = 0; j < children.length; j++) { | ||||
|                 const currShape = children[j]; | ||||
|                 const tempObj = { | ||||
|                   id: currShape.shapeId, | ||||
|                   name: currShape.name, | ||||
|                   fileId: currFile.id, | ||||
|                   fileName: currFile.name, | ||||
|                   versionId: currFile.versionId | ||||
|                 } | ||||
|                 tempData.push(tempObj); | ||||
|               } | ||||
|             } | ||||
|             this.tableData = tempData; | ||||
|           } | ||||
|         }, | ||||
|         isFileExist(result, fileId, versionId){// 文件是否存在于结果中 | ||||
|           for (let i = 0; i < result.length; i++) { | ||||
|             const file = result[i]; | ||||
|             if (file.versionId == versionId) { | ||||
|               return true; | ||||
|             } | ||||
|           } | ||||
|           return false; | ||||
|         }, | ||||
|         remove(id) {// 右侧表格删除 | ||||
|           const relationType = this.relationType; | ||||
|           if (relationType == 'file') {// 关联类型是文件 | ||||
|             const result = this.result; | ||||
|             for (let i = 0; i < result.length; i++) { | ||||
|               const obj = result[i]; | ||||
|               if (obj.id == id) { | ||||
|                 result.splice(i, 1); | ||||
|                 if (this.multiple) { | ||||
|                   this.$refs.tree.setChecked(id, false); | ||||
|                 } else { | ||||
|                   this.$refs.tree.setCurrentKey(null); | ||||
|                 } | ||||
|                 break; | ||||
|               } | ||||
|             } | ||||
|           } else {// 形状 | ||||
|             if (this.multiple) {// 多选 | ||||
|               const data = this.shapeRecords[id]; | ||||
|               if (data) { | ||||
|                 const result = this.result; | ||||
|                 const shapeId = data.id; | ||||
|                 const name = data.name; | ||||
|                 const fileId = data.fileId; | ||||
|                 const fileName = data.fileName; | ||||
|                 const fileVersionId = data.versionId; | ||||
|                 for (let i = 0; i < result.length; i++) { | ||||
|                   const file = result[i]; | ||||
|                   if (file.id == fileId) { | ||||
|                     const children = file.children; | ||||
|                     for (let j = 0; j < children.length; j++) { | ||||
|                       if (children[j].shapeId == id) { | ||||
|                         children.splice(j, 1); | ||||
|                         break; | ||||
|                       } | ||||
|                     } | ||||
|                     if (children.length == 0) { | ||||
|                       result.splice(i, 1); | ||||
|                       break; | ||||
|                     } | ||||
|                   } | ||||
|                 } | ||||
|               } | ||||
|               // 删除选中节点 | ||||
|               for (let i = 0; i < this.shapeChecked.length; i++) { | ||||
|                 if (this.shapeChecked[i] == id) { | ||||
|                   this.shapeChecked.splice(i, 1); | ||||
|                   break; | ||||
|                 } | ||||
|               } | ||||
|             } else {// 单选 | ||||
|               this.result = []; | ||||
|               this.shapeSelected = ''; | ||||
|             } | ||||
|           } | ||||
|           this.initTableData(); | ||||
|         }, | ||||
|         handleChangeRadioShape(id) {// 形状单选变化事件 | ||||
|           const data = this.shapeRecords[id]; | ||||
|           if (data) { | ||||
|             const shapeId = data.id; | ||||
|             const name = data.name; | ||||
|             const fileId = data.fileId; | ||||
|             const fileName = data.fileName; | ||||
|             const fileVersionId = data.versionId; | ||||
|             this.result = []; | ||||
|             const result = this.result; | ||||
|             const tempObj = {}; | ||||
|             tempObj.id = fileId; | ||||
|             tempObj.versionId = fileVersionId; | ||||
|             tempObj.name = fileName; | ||||
|             tempObj.children = []; | ||||
|             const children = { | ||||
|               shapeId: shapeId, | ||||
|               name: name | ||||
|             }; | ||||
|             tempObj.children.push(children); | ||||
|             result.push(tempObj); | ||||
|             this.initTableData(); | ||||
|           } | ||||
|         }, | ||||
|         handleChangeCheckShape(ids) {// 形状多选变化事件 | ||||
|           this.result = []; | ||||
|           const result = this.result; | ||||
|           for (let i = 0; i < ids.length; i++) { | ||||
|             const id = ids[i]; | ||||
|             const data = this.shapeRecords[id]; | ||||
|             if (data) { | ||||
|               const shapeId = data.id; | ||||
|               const name = data.name; | ||||
|               const fileId = data.fileId; | ||||
|               const fileName = data.fileName; | ||||
|               const fileVersionId = data.versionId; | ||||
|               let fileExist = false; | ||||
|               for (let j = 0; j < result.length; j++) { | ||||
|                 const file = result[j]; | ||||
|                 if (file.id == fileId) { | ||||
|                   fileExist = true; | ||||
|                   const children = { | ||||
|                     shapeId: shapeId, | ||||
|                     name: name | ||||
|                   }; | ||||
|                   file.children.push(children); | ||||
|                 } | ||||
|               } | ||||
|               if (!fileExist) { | ||||
|                 const tempObj = {}; | ||||
|                 tempObj.id = fileId; | ||||
|                 tempObj.versionId = fileVersionId; | ||||
|                 tempObj.name = fileName; | ||||
|                 tempObj.children = []; | ||||
|                 const children = { | ||||
|                   shapeId: shapeId, | ||||
|                   name: name | ||||
|                 }; | ||||
|                 tempObj.children.push(children); | ||||
|                 result.push(tempObj); | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           this.initTableData(); | ||||
|         }, | ||||
|         initData() {// 初始化传递进来的数据 | ||||
|           // 已选中的数据初始化到result、shapeSelected、shapeChecked里面 | ||||
|           const that = this; | ||||
|           if (that.relationType == 'file') { | ||||
|             if (that.selectFileId != '') { | ||||
|               // 查询数据 | ||||
|               const data = { | ||||
|                 url:'jd', | ||||
|                 data:{ | ||||
|                   cmd: 'com.actionsoft.apps.coe.pal_repository_tree_component_file_query', | ||||
|                   versionIds: that.selectFileId | ||||
|                 } | ||||
|               }; | ||||
|               // 查询数据 | ||||
|               awsuiAxios.post(data).then(function (ro) { | ||||
|                 if (ro.result == 'ok') { | ||||
|                   const result = []; | ||||
|                   for (let i = 0; i < ro.data.length; i++) { | ||||
|                     const currData = ro.data[i]; | ||||
|                     const tempObj = {}; | ||||
|                     tempObj.id = currData.id; | ||||
|                     tempObj.versionId = currData.versionId; | ||||
|                     tempObj.name = currData.name; | ||||
|                     tempObj.children = []; | ||||
|                     result.push(tempObj); | ||||
|                   } | ||||
|                   that.result = result; | ||||
|                   that.initTableData(); | ||||
|                 } | ||||
|               }).catch(error=>{ | ||||
|                 console.log(error); | ||||
|               }) | ||||
|             } | ||||
|           } else { | ||||
|             if (that.selectFileId != '' && that.selectShapeId != '') { | ||||
|               // 查询数据 | ||||
|               const data = { | ||||
|                 url:'jd', | ||||
|                 data:{ | ||||
|                   cmd: 'com.actionsoft.apps.coe.pal_repository_tree_component_file_shape_query', | ||||
|                   fileIds: that.selectFileId, | ||||
|                   shapeIds: that.selectShapeId | ||||
|                 } | ||||
|               }; | ||||
|               // 查询数据 | ||||
|               awsuiAxios.post(data).then(function (ro) { | ||||
|                 if (ro.result == 'ok') { | ||||
|                   if (ro.data.data.length > 0) { | ||||
|                     that.shapeRecords = ro.data.shapes; | ||||
|                     if (that.multiple) { | ||||
|                       that.result = ro.data.data; | ||||
|                       for (let i = 0; i < that.result.length; i++) { | ||||
|                         const children = that.result[i].children; | ||||
|                         for (let j = 0; j < children.length; j++) { | ||||
|                           that.shapeChecked.push(children[j].shapeId); | ||||
|                         } | ||||
|                       } | ||||
|                     } else { | ||||
|                       that.result = ro.data.data; | ||||
|                       for (let i = 0; i < that.result.length; i++) { | ||||
|                         const children = that.result[i].children; | ||||
|                         for (let j = 0; j < children.length; j++) { | ||||
|                           that.shapeSelected = children[j].shapeId;// 取任意一个 | ||||
|                         } | ||||
|                       } | ||||
|                     } | ||||
|                     that.initTableData(); | ||||
|                   } | ||||
|                 } | ||||
|               }).catch(error=>{ | ||||
|                 console.log(error); | ||||
|               }) | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       watch: { | ||||
|         visible(val) { | ||||
|           this.dialogVisible = val; | ||||
|           if (val) {// 打开 | ||||
|             this.clearAllParam(); | ||||
|             this.pid = this.rootId; | ||||
|             this.initData(); | ||||
|           } else {// 关闭 | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|   #palRelationAddress >>> .el-dialog__body { | ||||
|     padding: 10px 20px; | ||||
|     color: #606266; | ||||
|     font-size: 14px; | ||||
|     word-break: break-all; | ||||
|   } | ||||
|   #palRelationAddress >>> .el-input__inner { | ||||
|     border-radius: 0px; | ||||
|   } | ||||
|   #palRelationAddress >>>  .el-tree { | ||||
|     min-width: 100%; | ||||
|     display:inline-block !important; | ||||
|   } | ||||
|   .checkbox-item { | ||||
|     margin: 10px 0px; | ||||
|     display: block; | ||||
|   } | ||||
|   .redio-item { | ||||
|     margin: 10px 0px; | ||||
|     display: block; | ||||
|   } | ||||
|   .div-left { | ||||
|     float:left; | ||||
|     width:249px; | ||||
|     height:400px; | ||||
|     border-right: 1px dashed #f2f2f2; | ||||
|   } | ||||
|   .div-middle { | ||||
|     float:left; | ||||
|     width: 248px; | ||||
|     height:400px; | ||||
|     border-right: 1px dashed #f2f2f2; | ||||
|   } | ||||
|   .div-right { | ||||
|     float: right; | ||||
|     width: 249px; | ||||
|     height:400px; | ||||
|     background-color: #2a85a0; | ||||
|   } | ||||
|   #palRelationAddress >>> .el-table__row .icon-delete-display{ | ||||
|     display: none; | ||||
|   } | ||||
|   #palRelationAddress >>> .el-table__row:hover .icon-delete-display{ | ||||
|     display: inline; | ||||
|   } | ||||
|   #palRelationAddress >>> .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content { | ||||
|     background-color: #F5F7FA; | ||||
|     color: #4E7FF9; | ||||
|   } | ||||
|   #palRelationAddress >>> .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .awsui-iconfont { | ||||
|     color: #4E7FF9 !important; | ||||
|   } | ||||
| </style> | ||||
| @ -0,0 +1,7 @@ | ||||
| import PalRelationAddress from './component' | ||||
| 
 | ||||
| PalRelationAddress.install = function(Vue) { | ||||
|   Vue.component(PalRelationAddress.name, PalRelationAddress); | ||||
| } | ||||
| 
 | ||||
| export  default PalRelationAddress; | ||||
| @ -0,0 +1,542 @@ | ||||
| <template> | ||||
|     <div id="conditionFilter"> | ||||
|         <div v-if="palId == ''"> | ||||
|             <div class="opt-category-title"><p style="padding-left: 5px;"><b>文件信息</b></p></div> | ||||
|             <awsui-form ref="form" :model="form" label-width="80px" label-position="right"> | ||||
|                 <awsui-form-item label="对象"> | ||||
|                     <awsui-radio awsui-radio v-model="form.type" label="file" @change="initMethod">文件</awsui-radio> | ||||
|                     <awsui-radio awsui-radio v-model="form.type" label="shape" @change="initMethod">文件内形状</awsui-radio> | ||||
|                 </awsui-form-item> | ||||
|                 <awsui-form-item label="范围"> | ||||
|                     <awsui-input v-model="form.rootFileName" placeholder="请选择一个根目录" readonly @click.native="rootFileTree.visible = true"></awsui-input> | ||||
|                     <awsui-input type="hidden" v-model="form.rootFileId" placeholder="请选择一个根目录"></awsui-input> | ||||
|                 </awsui-form-item> | ||||
|                 <awsui-row :gutter="0"> | ||||
|                     <awsui-col :span="12"> | ||||
|                         <awsui-form-item label="名称"> | ||||
|                             <div style="display: inline-block;width: 20%;"> | ||||
|                                 <awsui-select v-model="form.nameScope" :options="nameScopeOpts"></awsui-select> | ||||
|                             </div> | ||||
|                             <div style="display: inline-block;width: 80%;"> | ||||
|                                 <awsui-input v-model="form.name" placeholder="请输入名称"></awsui-input> | ||||
|                             </div> | ||||
|                         </awsui-form-item> | ||||
|                     </awsui-col> | ||||
|                     <awsui-col :span="12"> | ||||
|                         <awsui-form-item label="文件类型"> | ||||
|                             <awsui-select style="width: 99%;" v-model="form.methodId" :options="methodOpts" @change="initExAttr"></awsui-select> | ||||
|                         </awsui-form-item> | ||||
|                     </awsui-col> | ||||
|                 </awsui-row> | ||||
|             </awsui-form> | ||||
|         </div> | ||||
|         <div> | ||||
|             <div class="opt-category-title" style="margin-top: 10px;"><p style="padding-left: 5px;"><b>文件属性</b></p></div> | ||||
|             <div v-for="(attr, i) in extAttr"> | ||||
|                 <awsui-row v-for="(item, n) in attr" class="row"> | ||||
|                     <awsui-col :span="2"> | ||||
|                         <div style="text-align: center;line-height: 30px;height: 30px;"> | ||||
|                             <span v-if="n != 0">且</span> | ||||
|                         </div> | ||||
|                     </awsui-col> | ||||
|                     <awsui-col :span="8"> | ||||
|                         <awsui-input style="font-size: 0px" v-model="item.propertyName" placeholder="请选择属性" readonly @click.native="openAttrTree(i, n)"></awsui-input> | ||||
|                         <awsui-input type="hidden" v-model="item.propertyKey" placeholder="请选择属性"></awsui-input> | ||||
|                     </awsui-col> | ||||
|                     <awsui-col :span="6"> | ||||
|                         <awsui-select v-model="item.propertyCondition" :options="extAttrConditionOpts"></awsui-select> | ||||
|                     </awsui-col> | ||||
|                     <awsui-col :span="8"> | ||||
|                         <div style="padding-right: 25px;"> | ||||
|                             <template v-if="item.propertyCondition!='null' && item.propertyCondition!='notNull'"> | ||||
|                                 <!--单选类型--> | ||||
|                                 <awsui-select v-if="item.propertyType == 'select'" clearable v-model="item.propertyValue" :options="item.selectTypeOpts"></awsui-select> | ||||
|                                 <!--多选类型--> | ||||
|                                 <awsui-select v-else-if="item.propertyType == 'select_m'" multiple clearable v-model="item.propertyValue" :options="item.selectTypeOpts"></awsui-select> | ||||
|                                 <!--是否类型--> | ||||
|                                 <awsui-select v-else-if="item.propertyType == 'boolean'" v-model="item.propertyValue" :options="item.selectTypeOpts"></awsui-select> | ||||
|                                 <!--数字类型--> | ||||
|                                 <awsui-input-number v-else-if="item.propertyType == 'number'" v-model="item.propertyValue"></awsui-input-number> | ||||
|                                 <!--关联PAL类型--> | ||||
|                                 <awsui-input v-else-if="item.propertyType == 'relation'" v-model="item.propertyShowValue" placeholder="请选择" readonly @click.native="openPalRelationAddress(i, n)"></awsui-input> | ||||
|                                 <!--关联BPM组织架构类型--> | ||||
|                                 <awsui-input v-else-if="item.propertyType == 'awsorg'" v-model="item.propertyShowValue" placeholder="请选择" readonly @click.native="openBpmOrgAddress(i, n)"></awsui-input> | ||||
|                                 <!--文本、多行文本、其他类型--> | ||||
|                                 <awsui-input v-else v-model="item.propertyValue" placeholder="请输入"></awsui-input> | ||||
|                             </template> | ||||
|                             <template v-else> | ||||
|                                 <awsui-input value="" placeholder="不允许输入" readonly></awsui-input> | ||||
|                             </template> | ||||
|                         </div> | ||||
|                         <i class="awsui-iconfont operate-icon-display" style="float: right;position: relative; top: -22px;padding-right: 5px;" @click="removeRowCondition(i, n)"></i> | ||||
|                     </awsui-col> | ||||
|                 </awsui-row> | ||||
|                 <div> | ||||
|                     <span class="cursor-pointer" @click="addAndCondition(i)"><u>+并条件</u></span> | ||||
|                 </div> | ||||
|                 <div v-if="i != extAttr.length - 1" style="width: 100%;text-align: center;"> | ||||
|                     <div style="display: inline-block;border-top:1px solid #c2c2c2;position: relative;bottom: -3px;width:100%;"></div> | ||||
|                     <div style="display: inline-block;background-color:white;position: relative;bottom: 10px;color: #A8A5A5;">或</div> | ||||
|                 </div> | ||||
|             </div> | ||||
|             <div v-if="extAttr.length == 0"> | ||||
|                 <span class="cursor-pointer" @click="addAndCondition(undefined)"><u>+并条件</u></span> | ||||
|             </div> | ||||
|             <div> | ||||
|                 <div style="display: inline-block;border-top:1px solid #c2c2c2;position: relative;bottom: -3px;width:100%;"></div> | ||||
|                 <div class="cursor-pointer" style="display: inline-block;background-color:white;position: relative;bottom: 10px;left: 40px;" @click="addOrCondition"><u>+或条件</u></div> | ||||
|             </div> | ||||
|         </div> | ||||
|         <PALRepositoryTree | ||||
|                 ref="rootFileTree" | ||||
|                 :visible.sync="rootFileTree.visible" | ||||
|                 :wsId="rootFileTree.wsId" | ||||
|                 :teamId="rootFileTree.teamId" | ||||
|                 :categorys="rootFileTree.categorys" | ||||
|                 :multiple=false | ||||
|                 v-on:cancel="rootFileTree.visible = false" | ||||
|                 v-on:getResult="saveRootFileResult" | ||||
|                 :title="rootFileTree.title" | ||||
|         ></PALRepositoryTree> | ||||
|         <BPMOrgAddress | ||||
|                 ref="palAwsOrgAddress" | ||||
|                 :visible.sync="bpmOrgAddress.visible" | ||||
|                 :addressType="bpmOrgAddress.addressType" | ||||
|                 v-on:cancel="bpmOrgAddress.visible = false" | ||||
|                 v-on:getResult="saveBpmOrgAddressResult" | ||||
|                 :title="bpmOrgAddress.title" | ||||
|                 :multiple="bpmOrgAddress.multiple" | ||||
|         /> | ||||
|         <pal-relation-address | ||||
|                 ref="palRelationAddress" | ||||
|                 :visible.sync="palRelationAddress.visible" | ||||
|                 v-on:cancel="palRelationAddress.visible = false" | ||||
|                 v-on:getResult="saveRelationResult" | ||||
|                 :title="palRelationAddress.title" | ||||
|                 :selectFileId="palRelationAddress.selectFileId" | ||||
|                 :selectShapeId="palRelationAddress.selectShapeId" | ||||
|                 :relationType="palRelationAddress.relationType" | ||||
|                 :categorys="palRelationAddress.category" | ||||
|                 :methods="palRelationAddress.method" | ||||
|                 :wsId="palRelationAddress.wsId" | ||||
|                 :teamId="palRelationAddress.teamId" | ||||
|                 :multiple = palRelationAddress.multiple | ||||
|         /> | ||||
|         <pal-attribute-tree | ||||
|                 ref="palAttributeTree" | ||||
|                 :visible.sync="attributeDlg.visible" | ||||
|                 :methodId="attributeDlg.methodId" | ||||
|                 :type="attributeDlg.type" | ||||
|                 v-on:cancel="attributeDlg.visible = false" | ||||
|                 v-on:getResult="saveAttrTreeResult" | ||||
|         /> | ||||
|     </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import BPMOrgAddress from  "./components/BPMOrgAddress";// pal平台组织架构地址簿,调用平台部门人员角色 | ||||
|     import PalRelationAddress from  "./components/PalRelationAddress"; | ||||
|     import PALRepositoryTree from './components/PALRepositoryTree/index'; | ||||
|     import PalAttributeTree from './components/PalAttributeTree/index'; | ||||
|     import awsuiAxios from "../../awsuiAxios"; | ||||
|     export default { | ||||
|         name: "condition-filter", | ||||
|         components: {PALRepositoryTree, BPMOrgAddress, PalRelationAddress, PalAttributeTree}, | ||||
|         data () { | ||||
|             return { | ||||
|                 wsId: wsId, | ||||
|                 teamId: teamId, | ||||
|                 palId: palId, | ||||
|                 attributeDlg: { | ||||
|                     visible: false, | ||||
|                     methodId: '', | ||||
|                     type: '', | ||||
|                     currGroup: 0, | ||||
|                     currRow: 0 | ||||
|                 }, | ||||
|                 bpmOrgAddress: { | ||||
|                     visible: false, | ||||
|                     addressType: 'user', | ||||
|                     title: '', | ||||
|                     multiple: false, | ||||
|                     currGroup: 0, | ||||
|                     currRow: 0 | ||||
|                 }, | ||||
|                 palRelationAddress: { | ||||
|                     visible: false, | ||||
|                     selectFileId: '', | ||||
|                     selectShapeId: '', | ||||
|                     relationType: '', | ||||
|                     category: '', | ||||
|                     method: '', | ||||
|                     wsId: wsId, | ||||
|                     teamId: teamId, | ||||
|                     multiple: false, | ||||
|                     currGroup: 0, | ||||
|                     currRow: 0 | ||||
|                 }, | ||||
|                 rootFileTree: { | ||||
|                     visible: false, | ||||
|                     wsId: wsId, | ||||
|                     teamId: teamId, | ||||
|                     categorys: 'process', | ||||
|                     title: '请选择根目录' | ||||
|                 }, | ||||
|                 form: { | ||||
|                     type: 'file',// 对象,类型 | ||||
|                     rootFileName: '',// 范围根目录名称 | ||||
|                     rootFileId: '',// 范围根目录ID | ||||
|                     nameScope: 'equals',// 名称范围 | ||||
|                     name:'',// 名称筛选 | ||||
|                     methodId: '',// 文件类型(建模方法范围筛选) | ||||
|                 }, | ||||
|                 nameScopeOpts: [ | ||||
|                     { | ||||
|                         value: 'equals', | ||||
|                         label: '等于' | ||||
|                     }, | ||||
|                     { | ||||
|                         value: 'contain', | ||||
|                         label: '包含' | ||||
|                     } | ||||
|                 ], | ||||
|                 methodOpts: [], | ||||
|                 extAttrConditionOpts: [ | ||||
|                     {value:'equals', label: '等于'}, | ||||
|                     {value:'notEquals', label: '不等于'}, | ||||
|                     {value:'contain', label: '包含'}, | ||||
|                     {value:'notContain', label: '不包含'}, | ||||
|                     {value: 'null', label: '为空'}, | ||||
|                     {value: 'notNull', label: '不为空'} | ||||
|                 ], | ||||
|                 extAttr: [], | ||||
|                 extAttr2: [ | ||||
|                     [ | ||||
|                         {"propertyName":"单选密级","propertyKey":"securityclass","propertyType":"select","propertyCondition":"equals","propertyValue":"绝密","selectTypeOpts": [ | ||||
|                                 {value: '保密', label: '保密'}, | ||||
|                                 {value: '绝密', label: '绝密'}, | ||||
|                                 {value: '秘密', label: '秘密'}, | ||||
|                             ]}, | ||||
|                         {"propertyName":"多选密级","propertyKey":"securityclass2","propertyType":"select_m","propertyCondition":"equals","propertyValue":['绝密','秘密'],"selectTypeOpts": [ | ||||
|                                 {value: '保密', label: '保密'}, | ||||
|                                 {value: '绝密', label: '绝密'}, | ||||
|                                 {value: '秘密', label: '秘密'}, | ||||
|                             ]}, | ||||
|                         {"propertyName":"是否类型","propertyKey":"securityclass3","propertyType":"boolean","propertyCondition":"equals","propertyValue":"是","selectTypeOpts": [ | ||||
|                                 {value: '是', label: '是'}, | ||||
|                                 {value: '否', label: '否'} | ||||
|                             ]}, | ||||
|                         {"propertyName":"数字类型","propertyKey":"securityclass4","propertyType":"number","propertyCondition":"equals","propertyValue":5}, | ||||
|                         { | ||||
|                             "propertyName": "审批者(A)", | ||||
|                             "propertyKey": "approval_a", | ||||
|                             "propertyType": "relation", | ||||
|                             "propertyCondition": "equals", | ||||
|                             "propertyValue": "[{\"fileId\":\"\",\"shapeId\":\"\",\"shapeText\":\"\",\"attrId\":\"\",\"relationFileId\":\"de70f431-1143-4496-a109-a672f4e14a0d\",\"relationShapeId\":\"obj_c96e34f8b4e00001c1f4b45017301467\",\"relationShapeText\":\"角色3\"},{\"fileId\":\"\",\"shapeId\":\"\",\"shapeText\":\"\",\"attrId\":\"\",\"relationFileId\":\"de70f431-1143-4496-a109-a672f4e14a0d\",\"relationShapeId\":\"obj_c96e34f936b000019ebf1150e72099b0\",\"relationShapeText\":\"员工4\"}]", | ||||
|                             "propertyShowValue": "角色3,岗位4" | ||||
|                         }, | ||||
|                         { | ||||
|                             "propertyName": "咨询者(C)XML", | ||||
|                             "propertyKey": "counselor_c", | ||||
|                             "propertyType": "awsorg", | ||||
|                             "propertyCondition": "equals", | ||||
|                             "propertyValue": "{\"admin\":{\"id\":\"admin\",\"type\":\"user\",\"name\":\"管理员\"},\"5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe\":{\"name\":\"部门1\",\"id\":\"5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe\",\"type\":\"department\"}}", | ||||
|                             "propertyShowValue": "管理员,部门1" | ||||
|                         }, | ||||
|                         { | ||||
|                             "propertyName": "输出", | ||||
|                             "propertyKey": "out", | ||||
|                             "propertyType": "textarea", | ||||
|                             "propertyCondition": "notEquals", | ||||
|                             "propertyValue": "1" | ||||
|                         }, | ||||
|                         { | ||||
|                             "propertyName": "层次", | ||||
|                             "propertyKey": "level", | ||||
|                             "propertyType": "string", | ||||
|                             "propertyCondition": "null", | ||||
|                             "propertyValue": "" | ||||
|                         } | ||||
|                     ] | ||||
|                 ],// 属性筛选条件 | ||||
|             } | ||||
|         }, | ||||
|         mounted() { | ||||
|             if (palId != '') { | ||||
|                 this.form.type = 'shape'; | ||||
|             } | ||||
|             this.initMethod(); | ||||
|         }, | ||||
|         methods: { | ||||
|             initMethod() {// 初始化/查询建模方法 | ||||
|                 const that = this; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd: 'com.actionsoft.apps.coe.pal.batch_replace_active_method_query', | ||||
|                         type: that.form.type, | ||||
|                         palId: that.palId | ||||
|                     } | ||||
|                 }; | ||||
|                 // 查询数据 | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     if(ro.result == 'ok') { | ||||
|                         that.methodOpts = ro.data.methodOpts; | ||||
|                         if (that.palId != '') { | ||||
|                             that.form.methodId = that.methodOpts[0].value; | ||||
|                         } else { | ||||
|                             that.form.methodId = ''; | ||||
|                         } | ||||
|                         that.initExAttr(); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             initExAttr() { | ||||
|                 this.extAttr = [ | ||||
|                     [ | ||||
|                         { | ||||
|                             "propertyName": "", | ||||
|                             "propertyKey": "", | ||||
|                             "propertyType": "string", | ||||
|                             "propertyCondition": "equals", | ||||
|                             "propertyValue": "" | ||||
|                         } | ||||
|                     ] | ||||
|                 ]; | ||||
|             }, | ||||
|             openBpmOrgAddress(i, n) {// 打开关联BPM组织架构数据选择 | ||||
|                 const that = this; | ||||
|                 that.bpmOrgAddress.currGroup = i; | ||||
|                 that.bpmOrgAddress.currRow = n; | ||||
|                 const row = this.extAttr[this.bpmOrgAddress.currGroup][this.bpmOrgAddress.currRow]; | ||||
|                 const ref = row.ref; | ||||
| 
 | ||||
|                 const scope = ref.scope; | ||||
|                 that.bpmOrgAddress.addressType = scope.join(','); | ||||
|                 that.bpmOrgAddress.multiple = ref.multiple; | ||||
|                 that.bpmOrgAddress.title = row.propertyName; | ||||
|                 that.bpmOrgAddress.visible = true; | ||||
|             }, | ||||
|             saveBpmOrgAddressResult(data) {// 关联BPM组织架构数据回调 | ||||
|                 this.bpmOrgAddress.visible = false; | ||||
|                 console.log(data); | ||||
|                 // 保存 | ||||
|                 const params = {}; | ||||
|                 const propertyShowValue = []; | ||||
|                 for (let i = 0; i < data.length; i++) { | ||||
|                     params[data[i].id] = {name: data[i].name, id: data[i].id, type: data[i].type}; | ||||
|                     propertyShowValue.push(data[i].name); | ||||
|                 } | ||||
|                 const row = this.extAttr[this.bpmOrgAddress.currGroup][this.bpmOrgAddress.currRow]; | ||||
|                 row.propertyValue = JSON.stringify(params); | ||||
|                 row.propertyShowValue = propertyShowValue.join(','); | ||||
|             }, | ||||
|             openPalRelationAddress(i, n) {// 打开关联PAL组织架构数据选择 | ||||
|                 const that = this; | ||||
|                 that.palRelationAddress.currGroup = i; | ||||
|                 that.palRelationAddress.currRow = n; | ||||
|                 const row = this.extAttr[this.palRelationAddress.currGroup][this.palRelationAddress.currRow]; | ||||
|                 const ref = row.ref; | ||||
|                 const propertyValue = JSON.parse(row.propertyValue); | ||||
|                 const selectFileId = []; | ||||
|                 const selectShapeId = []; | ||||
|                 for (let j = 0; j < propertyValue.length; j++) { | ||||
|                     selectFileId.push(propertyValue[j].relationFileId); | ||||
|                     selectShapeId.push(propertyValue[j].relationShapeId); | ||||
|                 } | ||||
|                 this.palRelationAddress.relationType = ref.type; | ||||
|                 this.palRelationAddress.multiple = ref.multiple; | ||||
|                 this.palRelationAddress.title = row.propertyName; | ||||
|                 this.palRelationAddress.selectFileId = selectFileId.join(','); | ||||
|                 this.palRelationAddress.selectShapeId = selectShapeId.join(','); | ||||
|                 if (ref.method.indexOf('.') > 0) { | ||||
|                     this.palRelationAddress.method = ref.method; | ||||
|                     this.palRelationAddress.category = ref.method.split('.')[0]; | ||||
|                 } else { | ||||
|                     this.palRelationAddress.category = ref.method; | ||||
| 
 | ||||
|                 } | ||||
|                 this.palRelationAddress.visible = true; | ||||
|             }, | ||||
|             saveRelationResult(data) {// 关联PAL组织架构数据回调 | ||||
|                 this.palRelationAddress.visible = false | ||||
|                 const row = this.extAttr[this.palRelationAddress.currGroup][this.palRelationAddress.currRow]; | ||||
|                 const ref = row.ref; | ||||
|                 const propertyValue = []; | ||||
|                 if (ref.type == 'file') { | ||||
|                     for (let i = 0; i < data.length; i++) { | ||||
|                         propertyValue.push({ | ||||
|                             fileId : "", | ||||
|                             shapeId : "", | ||||
|                             shapeText : "", | ||||
|                             attrId : "", | ||||
|                             relationFileId : data[i].versionId, | ||||
|                             relationShapeId : '', | ||||
|                             relationShapeText : data[i].name | ||||
|                         }); | ||||
|                     } | ||||
|                 } else { | ||||
|                     for (let i = 0; i < data.length; i++) { | ||||
|                         const currFile = data[i]; | ||||
|                         const children = currFile.children; | ||||
|                         for (let j = 0; j < children.length; j++) { | ||||
|                             const currShape = children[j]; | ||||
|                             propertyValue.push({ | ||||
|                                 fileId : "", | ||||
|                                 shapeId : "", | ||||
|                                 shapeText : "", | ||||
|                                 attrId : "", | ||||
|                                 relationFileId : currFile.id, | ||||
|                                 relationShapeId : currShape.shapeId, | ||||
|                                 relationShapeText : currShape.name | ||||
|                             }); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 const propertyShowValue = []; | ||||
|                 row.propertyValue = JSON.stringify(propertyValue); | ||||
|                 for (let i = 0; i < propertyValue.length; i++) { | ||||
|                     propertyShowValue.push(propertyValue[i].relationShapeText); | ||||
|                 } | ||||
|                 row.propertyShowValue = propertyShowValue.join(','); | ||||
|             }, | ||||
|             saveRootFileResult(data) {// 选择根目录回调 | ||||
|                 this.rootFileTree.visible = false; | ||||
|                 let id = ''; | ||||
|                 let name = ''; | ||||
|                 if (data.length > 0) { | ||||
|                     const curr = data[0]; | ||||
|                     id = curr.currId; | ||||
|                     name = curr.name; | ||||
|                 } | ||||
|                 this.form.rootFileId = id; | ||||
|                 this.form.rootFileName = name; | ||||
|             }, | ||||
|             openAttrTree(i ,n) {// 打开自定义属性树组件 | ||||
|                 const that = this; | ||||
|                 if (this.form.methodId == '') { | ||||
|                     this.$message({message: '请选择文件类型',type: 'warning'}); | ||||
|                     return false; | ||||
|                 } | ||||
|                 // 查询特性树 | ||||
|                 that.attributeDlg.currGroup = i; | ||||
|                 that.attributeDlg.currRow = n; | ||||
|                 that.attributeDlg.methodId = that.form.methodId; | ||||
|                 that.attributeDlg.type = that.form.type; | ||||
|                 that.attributeDlg.visible = true; | ||||
|             }, | ||||
|             saveAttrTreeResult(data) {// 选择属性树点击确定按钮 | ||||
|                 const row = this.extAttr[this.attributeDlg.currGroup][this.attributeDlg.currRow]; | ||||
|                 row.propertyName = data.label; | ||||
|                 row.propertyKey = data.id; | ||||
|                 row.propertyType = 'string';// 先默认string,在nextTick中重新渲染对应的类型 | ||||
|                 row.propertyValue = ''; | ||||
|                 row.selectTypeOpts = []; | ||||
|                 row.propertyShowValue = ''; | ||||
|                 row.ref = data.ref; | ||||
|                 this.$nextTick(function() { | ||||
|                     row.propertyType = data.attrType; | ||||
|                     if (data.attrType == 'select' || data.attrType == 'select_m' || data.attrType == 'boolean') { | ||||
|                         row.selectTypeOpts = []; | ||||
|                         const refArr = data.ref.split(','); | ||||
|                         for (let i = 0; i < refArr.length; i++) { | ||||
|                             row.selectTypeOpts.push({value: refArr[i], label: refArr[i]}); | ||||
|                         } | ||||
|                     } else if (data.attrType == 'relation') { | ||||
|                         row.propertyShowValue = ''; | ||||
|                         row.propertyValue = JSON.stringify([]); | ||||
|                     } else if (data.attrType == 'awsorg') { | ||||
|                         row.propertyShowValue = ''; | ||||
|                         row.propertyValue = JSON.stringify({}); | ||||
|                     } | ||||
|                     this.attributeDlg.visible = false; | ||||
|                 }) | ||||
|             }, | ||||
|             addAndCondition(i) {// 增加"且条件" | ||||
|                 if (i != undefined) { | ||||
|                     this.extAttr[i].push( | ||||
|                         { | ||||
|                             "propertyName": "", | ||||
|                             "propertyKey": "", | ||||
|                             "propertyType": "string", | ||||
|                             "propertyCondition": "equals", | ||||
|                             "propertyValue": "" | ||||
|                         } | ||||
|                     ); | ||||
|                 } else { | ||||
|                     this.extAttr.push([ | ||||
|                         { | ||||
|                             "propertyName": "", | ||||
|                             "propertyKey": "", | ||||
|                             "propertyType": "string", | ||||
|                             "propertyCondition": "equals", | ||||
|                             "propertyValue": "" | ||||
|                         } | ||||
|                     ]) | ||||
|                 } | ||||
|             }, | ||||
|             addOrCondition() {// 增加"或"条件 | ||||
|                 if (this.extAttr.length == 0) { | ||||
|                     this.$message({message: '请先添加一条[+并条件]',type: 'warning'}); | ||||
|                     return false; | ||||
|                 } | ||||
|                 this.extAttr.push([ | ||||
|                     { | ||||
|                         "propertyName": "", | ||||
|                         "propertyKey": "", | ||||
|                         "propertyType": "string", | ||||
|                         "propertyCondition": "equals", | ||||
|                         "propertyValue": "" | ||||
|                     } | ||||
|                 ]) | ||||
|             }, | ||||
|             removeRowCondition(i, n) {// 删除"行条件" | ||||
|                 const group = this.extAttr[i]; | ||||
|                 group.splice(n, 1); | ||||
|                 if (group.length == 0) { | ||||
|                     this.extAttr.splice(i, 1); | ||||
|                 } | ||||
|             }, | ||||
|             getResults() {// 父组件获取该组件结果集 | ||||
|                 const result = {}; | ||||
|                 result.uuid = palId; | ||||
|                 result.wsId = wsId; | ||||
|                 result.type = this.form.type; | ||||
|                 result.rootFileId = this.form.rootFileId; | ||||
|                 result.nameScope = this.form.nameScope; | ||||
|                 result.name = this.form.name; | ||||
|                 result.methodId = this.form.methodId; | ||||
|                 result.extAttr = this.extAttr; | ||||
|                 return result; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|     #conditionFilter >>> .awsui-form-item__label { | ||||
|         text-align: right; | ||||
|     } | ||||
|     .opt-category-title { | ||||
|         height: 25px; | ||||
|         line-height: 25px; | ||||
|         vertical-align: center; | ||||
|         margin: 20px 30px 15px 20px; | ||||
|         border-left: 3px solid #4E7FF9; | ||||
|     } | ||||
|     #conditionFilter >>> .row .operate-icon-display{ | ||||
|         visibility: hidden; | ||||
|         cursor: pointer; | ||||
|         color: red; | ||||
|     } | ||||
|     #conditionFilter >>> .row:hover .operate-icon-display{ | ||||
|         visibility: visible; | ||||
|     } | ||||
|     .cursor-pointer { | ||||
|         cursor: pointer; | ||||
|         color: #4E7FF9; | ||||
|     } | ||||
| 
 | ||||
| </style> | ||||
| @ -0,0 +1,496 @@ | ||||
| <template> | ||||
|     <div id="replaceRule"> | ||||
|         <!--替换规则--> | ||||
|         <div> | ||||
|             <div class="opt-category-title"><p style="padding-left: 5px;"><b>替换规则</b></p></div> | ||||
|             <div> | ||||
|                 <awsui-row v-for="(item, n) in ruleData" class="row"> | ||||
|                     <awsui-col :span="2"> | ||||
|                         <div style="text-align: center;line-height: 30px;height: 30px;"> | ||||
|                             <span>将</span> | ||||
|                         </div> | ||||
|                     </awsui-col> | ||||
|                     <awsui-col :span="8"> | ||||
|                         <awsui-input style="font-size: 0px" v-model="item.propertyName" placeholder="请选择属性" readonly @click.native="openAttrTree(n)"></awsui-input> | ||||
|                         <awsui-input type="hidden" v-model="item.propertyKey" placeholder="请选择属性"></awsui-input> | ||||
|                     </awsui-col> | ||||
|                     <awsui-col :span="4"> | ||||
|                         <div style="text-align: center;"> | ||||
|                             <span>的值更新为</span> | ||||
|                         </div> | ||||
|                     </awsui-col> | ||||
|                     <awsui-col :span="10"> | ||||
|                         <div style="padding-right: 25px;"> | ||||
|                             <!--单选类型--> | ||||
|                             <awsui-select v-if="item.propertyType == 'select'" clearable v-model="item.propertyValue" :options="item.selectTypeOpts"></awsui-select> | ||||
|                             <!--多选类型--> | ||||
|                             <awsui-select v-else-if="item.propertyType == 'select_m'" multiple clearable v-model="item.propertyValue" :options="item.selectTypeOpts"></awsui-select> | ||||
|                             <!--是否类型--> | ||||
|                             <awsui-select v-else-if="item.propertyType == 'boolean'" v-model="item.propertyValue" :options="item.selectTypeOpts"></awsui-select> | ||||
|                             <!--数字类型--> | ||||
|                             <awsui-input-number v-else-if="item.propertyType == 'number'" v-model="item.propertyValue"></awsui-input-number> | ||||
|                             <!--关联PAL类型--> | ||||
|                             <awsui-input v-else-if="item.propertyType == 'relation'" v-model="item.propertyShowValue" placeholder="请选择" readonly @click.native="openPalRelationAddress(n)"></awsui-input> | ||||
|                             <!--关联BPM组织架构类型--> | ||||
|                             <awsui-input v-else-if="item.propertyType == 'awsorg'" v-model="item.propertyShowValue" placeholder="请选择" readonly @click.native="openBpmOrgAddress(n)"></awsui-input> | ||||
|                             <!--文本、多行文本、其他类型--> | ||||
|                             <awsui-input v-else v-model="item.propertyValue" placeholder="请输入"></awsui-input> | ||||
|                         </div> | ||||
|                         <i class="awsui-iconfont operate-icon-display" style="float: right;position: relative; top: -22px;padding-right: 5px;" @click="removeRowRule(n)"></i> | ||||
|                     </awsui-col> | ||||
|                 </awsui-row> | ||||
|             </div> | ||||
|             <div> | ||||
|                 <div style="display: inline-block;border-top:1px solid #c2c2c2;position: relative;bottom: -3px;width:100%;"></div> | ||||
|                 <div class="cursor-pointer" style="display: inline-block;background-color:white;position: relative;bottom: 10px;left: 40px;" @click="addRule"><u>+添加规则</u></div> | ||||
|             </div> | ||||
|         </div> | ||||
|         <!--筛选结果--> | ||||
|         <div> | ||||
|             <div class="opt-category-title" style="margin-top: 10px;"><p style="padding-left: 5px;"><b>筛选结果(<span>{{resultCount}}</span>)</b></p></div> | ||||
|             <div v-if="conditionData.type == 'file'"> | ||||
|                 <el-table | ||||
|                         :data="fileTableData" | ||||
|                         @selection-change="handleSelectionChange" | ||||
|                         style="width: 100%"> | ||||
|                     <el-table-column | ||||
|                             type="selection" | ||||
|                             align="center" | ||||
|                             min-width="5%"> | ||||
|                     </el-table-column> | ||||
|                     <el-table-column | ||||
|                             prop="name" | ||||
|                             label="文件名称" | ||||
|                             min-width="35%"> | ||||
|                     </el-table-column> | ||||
|                     <el-table-column | ||||
|                             prop="namePath" | ||||
|                             label="路径" | ||||
|                             min-width="25%"> | ||||
|                     </el-table-column> | ||||
|                     <el-table-column | ||||
|                             prop="updateDate" | ||||
|                             align="center" | ||||
|                             min-width="20%" | ||||
|                             label="最后修改"> | ||||
|                         <template slot-scope="scope"> | ||||
|                             <div style="text-align: center;"> | ||||
|                                 <p>{{scope.row.updateDate}}</p> | ||||
|                                 <p>({{scope.row.updateUser}})</p> | ||||
|                             </div> | ||||
|                         </template> | ||||
|                     </el-table-column> | ||||
|                 </el-table> | ||||
|             </div> | ||||
|             <div v-if="conditionData.type == 'shape'"> | ||||
|                 <el-table | ||||
|                         :data="shapeTableData" | ||||
|                         @selection-change="handleSelectionChange" | ||||
|                         style="width: 100%"> | ||||
|                     <el-table-column | ||||
|                             type="selection" | ||||
|                             align="center" | ||||
|                             min-width="5%"> | ||||
|                     </el-table-column> | ||||
|                     <el-table-column | ||||
|                             prop="name" | ||||
|                             label="文件名称" | ||||
|                             min-width="25%"> | ||||
|                     </el-table-column> | ||||
|                     <el-table-column | ||||
|                             prop="shapeName" | ||||
|                             label="形状名称" | ||||
|                             min-width="10%"> | ||||
|                     </el-table-column> | ||||
|                     <el-table-column | ||||
|                             prop="namePath" | ||||
|                             label="路径" | ||||
|                             min-width="30%"> | ||||
|                     </el-table-column> | ||||
|                     <el-table-column | ||||
|                             prop="updateDate" | ||||
|                             align="center" | ||||
|                             min-width="20%" | ||||
|                             label="最后修改"> | ||||
|                         <template slot-scope="scope"> | ||||
|                             <div style="text-align: center;"> | ||||
|                                 <p>{{scope.row.updateDate}}</p> | ||||
|                                 <p>({{scope.row.updateUser}})</p> | ||||
|                             </div> | ||||
|                         </template> | ||||
|                     </el-table-column> | ||||
|                 </el-table> | ||||
|             </div> | ||||
|         </div> | ||||
|         <BPMOrgAddress | ||||
|                 ref="palAwsOrgAddress" | ||||
|                 :visible.sync="bpmOrgAddress.visible" | ||||
|                 :addressType="bpmOrgAddress.addressType" | ||||
|                 v-on:cancel="bpmOrgAddress.visible = false" | ||||
|                 v-on:getResult="saveBpmOrgAddressResult" | ||||
|                 :title="bpmOrgAddress.title" | ||||
|                 :multiple="bpmOrgAddress.multiple" | ||||
|         /> | ||||
|         <pal-relation-address | ||||
|                 ref="palRelationAddress" | ||||
|                 :visible.sync="palRelationAddress.visible" | ||||
|                 v-on:cancel="palRelationAddress.visible = false" | ||||
|                 v-on:getResult="saveRelationResult" | ||||
|                 :title="palRelationAddress.title" | ||||
|                 :selectFileId="palRelationAddress.selectFileId" | ||||
|                 :selectShapeId="palRelationAddress.selectShapeId" | ||||
|                 :relationType="palRelationAddress.relationType" | ||||
|                 :categorys="palRelationAddress.category" | ||||
|                 :methods="palRelationAddress.method" | ||||
|                 :wsId="palRelationAddress.wsId" | ||||
|                 :teamId="palRelationAddress.teamId" | ||||
|                 :multiple = palRelationAddress.multiple | ||||
|         /> | ||||
|         <pal-attribute-tree | ||||
|                 ref="palAttributeTree" | ||||
|                 :visible.sync="attributeDlg.visible" | ||||
|                 :methodId="attributeDlg.methodId" | ||||
|                 :type="attributeDlg.type" | ||||
|                 v-on:cancel="attributeDlg.visible = false" | ||||
|                 v-on:getResult="saveAttrTreeResult" | ||||
|         /> | ||||
|     </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../awsuiAxios"; | ||||
|     import BPMOrgAddress from  "./components/BPMOrgAddress";// pal平台组织架构地址簿,调用平台部门人员角色 | ||||
|     import PalRelationAddress from  "./components/PalRelationAddress"; | ||||
|     import PalAttributeTree from './components/PalAttributeTree/index'; | ||||
|     export default { | ||||
|         name: "replace-rule", | ||||
|         components: {BPMOrgAddress, PalRelationAddress, PalAttributeTree}, | ||||
|         props: { | ||||
|             conditionData: {// 上一步的结果 | ||||
|                 type: Object, | ||||
|                 default: function () { | ||||
|                     return {} | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         data() { | ||||
|             return { | ||||
|                 resultCount: 0, | ||||
|                 wsId: wsId, | ||||
|                 teamId: teamId, | ||||
|                 attributeDlg: { | ||||
|                     visible: false, | ||||
|                     methodId: '', | ||||
|                     type: '', | ||||
|                     currRow: 0 | ||||
|                 }, | ||||
|                 bpmOrgAddress: { | ||||
|                     visible: false, | ||||
|                     addressType: 'user', | ||||
|                     title: '', | ||||
|                     multiple: false, | ||||
|                     currRow: 0 | ||||
|                 }, | ||||
|                 palRelationAddress: { | ||||
|                     visible: false, | ||||
|                     selectFileId: '', | ||||
|                     selectShapeId: '', | ||||
|                     relationType: '', | ||||
|                     category: '', | ||||
|                     method: '', | ||||
|                     wsId: wsId, | ||||
|                     teamId: teamId, | ||||
|                     multiple: false, | ||||
|                     currRow: 0 | ||||
|                 }, | ||||
|                 palId: palId,// 判断是否设计器内部的批量替换,不为空则是设计器内部调用 | ||||
|                 ruleData: [ | ||||
|                     { | ||||
|                         "propertyName": "", | ||||
|                         "propertyKey": "", | ||||
|                         "propertyType": "string", | ||||
|                         "propertyCondition": "equals", | ||||
|                         "propertyValue": "" | ||||
|                     } | ||||
|                 ], | ||||
|                 fileTableData: [], | ||||
|                 shapeTableData: [], | ||||
|                 checkedTableData: {},// 已选中的数据记录 | ||||
|             } | ||||
|         }, | ||||
|         mounted() { | ||||
|             this.queryFilterResultData(); | ||||
|         }, | ||||
|         methods: { | ||||
|             queryFilterResultData() {// 查询符合条件的筛选数据 | ||||
|                 const that = this; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_replace_process_condition_result_query", | ||||
|                         conditionData : JSON.stringify(that.conditionData) | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     if (ro.result == 'ok') { | ||||
|                         if (that.conditionData.type == 'file') { | ||||
|                             that.resultCount = ro.data.data.length; | ||||
|                             for (let i = 0; i < ro.data.data.length; i++) { | ||||
|                                 ro.data.data[i].idVal = ro.data.data[i].versionId; | ||||
|                             } | ||||
|                             that.fileTableData = ro.data.data; | ||||
|                         } else { | ||||
|                             let count = 0; | ||||
|                             const shapeTableData = []; | ||||
|                             for (let i = 0; i < ro.data.data.length; i++) { | ||||
|                                 const curr = ro.data.data[i]; | ||||
|                                 const shapeList = curr.shape; | ||||
|                                 for (let j = 0; j < shapeList.length; j++) { | ||||
|                                     count++; | ||||
|                                     const shape = shapeList[j]; | ||||
|                                     shapeTableData.push({ | ||||
|                                         id: curr.id + ',' + shape.id, | ||||
|                                         idVal: curr.id, | ||||
|                                         name: curr.name, | ||||
|                                         shapeName: shape.name, | ||||
|                                         namePath: curr.namePath, | ||||
|                                         updateDate: curr.updateDate, | ||||
|                                         updateUser: curr.updateUser | ||||
|                                     }) | ||||
|                                 } | ||||
|                             } | ||||
|                             that.resultCount = count; | ||||
|                             that.shapeTableData = shapeTableData; | ||||
|                         } | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             handleSelectionChange(tableList) {// 表格数据选择监听 | ||||
|                 this.checkedTableData = {}; | ||||
|                 for (let i = 0; i < tableList.length; i++) { | ||||
|                     this.checkedTableData[tableList[i].id] = tableList[i].idVal; | ||||
|                 } | ||||
|             }, | ||||
|             removeRowRule(n) {// 删除行替换 | ||||
|                 this.ruleData.splice(n, 1); | ||||
|             }, | ||||
|             addRule() {// 添加替换规则 | ||||
|                 this.ruleData.push({ | ||||
|                     "propertyName": "", | ||||
|                     "propertyKey": "", | ||||
|                     "propertyType": "string", | ||||
|                     "propertyCondition": "equals", | ||||
|                     "propertyValue": "" | ||||
|                 }) | ||||
|             }, | ||||
|             openBpmOrgAddress(n) {// 打开关联BPM组织架构数据选择 | ||||
|                 const that = this; | ||||
|                 that.bpmOrgAddress.currRow = n; | ||||
|                 const row = this.ruleData[this.bpmOrgAddress.currRow]; | ||||
|                 const ref = row.ref; | ||||
| 
 | ||||
|                 const scope = ref.scope; | ||||
|                 that.bpmOrgAddress.addressType = scope.join(','); | ||||
|                 that.bpmOrgAddress.multiple = ref.multiple; | ||||
|                 that.bpmOrgAddress.title = row.propertyName; | ||||
|                 that.bpmOrgAddress.visible = true; | ||||
|             }, | ||||
|             saveBpmOrgAddressResult(data) {// 关联BPM组织架构数据回调 | ||||
|                 this.bpmOrgAddress.visible = false; | ||||
|                 // 保存 | ||||
|                 const params = {}; | ||||
|                 const propertyShowValue = []; | ||||
|                 for (let i = 0; i < data.length; i++) { | ||||
|                     params[data[i].id] = {name: data[i].name, id: data[i].id, type: data[i].type}; | ||||
|                     propertyShowValue.push(data[i].name); | ||||
|                 } | ||||
|                 const row = this.ruleData[this.bpmOrgAddress.currRow]; | ||||
|                 row.propertyValue = JSON.stringify(params); | ||||
|                 row.propertyShowValue = propertyShowValue.join(','); | ||||
|             }, | ||||
|             openPalRelationAddress(n) {// 打开关联PAL组织架构数据选择 | ||||
|                 const that = this; | ||||
|                 that.palRelationAddress.currRow = n; | ||||
|                 const row = this.ruleData[this.palRelationAddress.currRow]; | ||||
|                 const ref = row.ref; | ||||
|                 const propertyValue = JSON.parse(row.propertyValue); | ||||
|                 const selectFileId = []; | ||||
|                 const selectShapeId = []; | ||||
|                 for (let j = 0; j < propertyValue.length; j++) { | ||||
|                     selectFileId.push(propertyValue[j].relationFileId); | ||||
|                     selectShapeId.push(propertyValue[j].relationShapeId); | ||||
|                 } | ||||
|                 this.palRelationAddress.relationType = ref.type; | ||||
|                 this.palRelationAddress.multiple = ref.multiple; | ||||
|                 this.palRelationAddress.title = row.propertyName; | ||||
|                 this.palRelationAddress.selectFileId = selectFileId.join(','); | ||||
|                 this.palRelationAddress.selectShapeId = selectShapeId.join(','); | ||||
|                 if (ref.method.indexOf('.') > 0) { | ||||
|                     this.palRelationAddress.method = ref.method; | ||||
|                     this.palRelationAddress.category = ref.method.split('.')[0]; | ||||
|                 } else { | ||||
|                     this.palRelationAddress.category = ref.method; | ||||
| 
 | ||||
|                 } | ||||
|                 this.palRelationAddress.visible = true; | ||||
|             }, | ||||
|             saveRelationResult(data) {// 关联PAL组织架构数据回调 | ||||
|                 this.palRelationAddress.visible = false | ||||
|                 const row = this.ruleData[this.palRelationAddress.currRow]; | ||||
|                 const ref = row.ref; | ||||
|                 const propertyValue = []; | ||||
|                 if (ref.type == 'file') { | ||||
|                     for (let i = 0; i < data.length; i++) { | ||||
|                         propertyValue.push({ | ||||
|                             fileId : "", | ||||
|                             shapeId : "", | ||||
|                             shapeText : "", | ||||
|                             attrId : "", | ||||
|                             relationFileId : data[i].versionId, | ||||
|                             relationShapeId : '', | ||||
|                             relationShapeText : data[i].name | ||||
|                         }); | ||||
|                     } | ||||
|                 } else { | ||||
|                     for (let i = 0; i < data.length; i++) { | ||||
|                         const currFile = data[i]; | ||||
|                         const children = currFile.children; | ||||
|                         for (let j = 0; j < children.length; j++) { | ||||
|                             const currShape = children[j]; | ||||
|                             propertyValue.push({ | ||||
|                                 fileId : "", | ||||
|                                 shapeId : "", | ||||
|                                 shapeText : "", | ||||
|                                 attrId : "", | ||||
|                                 relationFileId : currFile.id, | ||||
|                                 relationShapeId : currShape.shapeId, | ||||
|                                 relationShapeText : currShape.name | ||||
|                             }); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 const propertyShowValue = []; | ||||
|                 row.propertyValue = JSON.stringify(propertyValue); | ||||
|                 for (let i = 0; i < propertyValue.length; i++) { | ||||
|                     propertyShowValue.push(propertyValue[i].relationShapeText); | ||||
|                 } | ||||
|                 row.propertyShowValue = propertyShowValue.join(','); | ||||
|             }, | ||||
|             openAttrTree(n) {// 打开自定义属性树组件 | ||||
|                 const that = this; | ||||
|                 // 查询特性树 | ||||
|                 that.attributeDlg.currRow = n; | ||||
|                 that.attributeDlg.methodId = that.conditionData.methodId; | ||||
|                 that.attributeDlg.type = that.conditionData.type; | ||||
|                 that.attributeDlg.visible = true; | ||||
|             }, | ||||
|             saveAttrTreeResult(data) {// 选择属性树点击确定按钮 | ||||
|                 const row = this.ruleData[this.attributeDlg.currRow]; | ||||
|                 row.propertyName = data.label; | ||||
|                 row.propertyKey = data.id; | ||||
|                 row.propertyType = 'string';// 先默认string,在nextTick中重新渲染对应的类型 | ||||
|                 row.propertyValue = ''; | ||||
|                 row.selectTypeOpts = []; | ||||
|                 row.propertyShowValue = ''; | ||||
|                 row.ref = data.ref; | ||||
|                 this.$nextTick(function() { | ||||
|                     row.propertyType = data.attrType; | ||||
|                     if (data.attrType == 'select' || data.attrType == 'select_m' || data.attrType == 'boolean') { | ||||
|                         row.selectTypeOpts = []; | ||||
|                         const refArr = data.ref.split(','); | ||||
|                         for (let i = 0; i < refArr.length; i++) { | ||||
|                             row.selectTypeOpts.push({value: refArr[i], label: refArr[i]}); | ||||
|                         } | ||||
|                     } else if (data.attrType == 'relation' || data.attrType == 'awsorg') { | ||||
|                         row.propertyShowValue = ''; | ||||
|                         row.propertyValue = JSON.stringify([]); | ||||
|                     } | ||||
|                     this.attributeDlg.visible = false; | ||||
|                 }) | ||||
|             }, | ||||
|             getResults() {// 获取筛选结果 | ||||
|                 const param = { | ||||
|                     wsId : wsId, | ||||
|                     teamId : teamId, | ||||
|                     uuid : palId, | ||||
|                     methodId : this.conditionData.methodId, | ||||
|                     type : this.conditionData.type, | ||||
|                     conditionData : this.conditionData, | ||||
|                     data: {}, | ||||
|                     isOk: true, | ||||
|                     msg: '' | ||||
|                 }; | ||||
|                 const replaceRule = []; | ||||
|                 // 筛选条件 | ||||
|                 for (let i = 0; i < this.ruleData.length; i++) { | ||||
|                     const row = this.ruleData[i]; | ||||
|                     if (row.propertyKey != undefined && row.propertyKey != '') { | ||||
|                         var rowObj = {}; | ||||
|                         rowObj.propertyName = row.propertyName; | ||||
|                         rowObj.propertyKey = row.propertyKey; | ||||
|                         rowObj.propertyType = row.propertyType; | ||||
|                         rowObj.propertyValue = row.propertyValue; | ||||
|                         replaceRule.push(rowObj); | ||||
|                     } | ||||
|                 } | ||||
|                 if (replaceRule.length == 0) { | ||||
|                     param.isOk = false; | ||||
|                     param.msg = '请添加替换规则'; | ||||
|                 } else { | ||||
|                     // 校验是否有重复属性 | ||||
|                     var key = {}; | ||||
|                     for (let rule in replaceRule) { | ||||
|                         if (key[replaceRule[rule].propertyKey] != undefined) { | ||||
|                             param.isOk = false; | ||||
|                             param.msg = "属性[" + replaceRule[rule].propertyName + "]不允许重复"; | ||||
|                             break; | ||||
|                         } | ||||
|                         key[replaceRule[rule].propertyKey] = ""; | ||||
|                     } | ||||
|                 } | ||||
|                 param.replaceRule = replaceRule; | ||||
|                 // 筛选结果 | ||||
|                 if (param.isOk) { | ||||
|                     param.data = this.checkedTableData; | ||||
|                     if (JSON.stringify(param.data) == "{}") { | ||||
|                         param.isOk = false; | ||||
|                         if (this.conditionData.type == 'file') { | ||||
|                             param.msg = "请选择替换的流程文件"; | ||||
|                         } else { | ||||
|                             param.msg = "请选择替换的流程形状"; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 return param; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|     .opt-category-title { | ||||
|         height: 25px; | ||||
|         line-height: 25px; | ||||
|         vertical-align: center; | ||||
|         margin: 20px 30px 15px 20px; | ||||
|         border-left: 3px solid #4E7FF9; | ||||
|     } | ||||
|     #replaceRule >>> .row:hover .operate-icon-display{ | ||||
|         visibility: visible; | ||||
|     } | ||||
|     .cursor-pointer { | ||||
|         cursor: pointer; | ||||
|         color: #4E7FF9; | ||||
|     } | ||||
|     #replaceRule >>> .row .operate-icon-display{ | ||||
|         visibility: hidden; | ||||
|         cursor: pointer; | ||||
|         color: red; | ||||
|     } | ||||
| </style> | ||||
							
								
								
									
										331
									
								
								com.actionsoft.apps.coe.pal.batch/src/views/replace/replace.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										331
									
								
								com.actionsoft.apps.coe.pal.batch/src/views/replace/replace.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,331 @@ | ||||
| <template> | ||||
|     <awsui-layout> | ||||
|         <awsui-header id="header"> | ||||
|             <el-steps :active="active" align-center> | ||||
|                 <el-step title="筛选条件" icon="el-icon-search"></el-step> | ||||
|                 <el-step title="替换规则" icon="el-icon-edit-outline"></el-step> | ||||
|                 <el-step title="执行结果" icon="el-icon-success"></el-step> | ||||
|             </el-steps> | ||||
|         </awsui-header> | ||||
|         <awsui-main :style="{height: mainHeight, padding: '0'}"> | ||||
|             <!-- 筛选条件 用v-show,点击下一步再返回数据不会销毁 --> | ||||
|             <div v-show="this.active == 1" class="step" :style="{height: mainHeight}"> | ||||
|                 <condition-filter ref="conditionFilter"/> | ||||
|             </div> | ||||
|             <!-- 替换规则 --> | ||||
|             <div v-if="this.active == 2" class="step" :style="{height: mainHeight}"> | ||||
|                 <replace-rule ref="replaceRule" :condition-data="conditionData"/> | ||||
|             </div> | ||||
|             <!-- 执行结果 --> | ||||
|             <div v-if="this.active == 3" class="step" :style="{height: mainHeight}"> | ||||
|                 <save ref="save" :param="replaceRuleInfo" :totalHeight="mainHeight"/> | ||||
|             </div> | ||||
|         </awsui-main> | ||||
|         <awsui-footer> | ||||
|             <div style="float: right;"> | ||||
|                 <awsui-button v-if="this.active == 2" style="margin-top: 12px;" @click="prev">上一步</awsui-button> | ||||
|                 <awsui-button v-if="this.active == 1 || this.active == 2" style="margin-top: 12px;" @click="next">下一步</awsui-button> | ||||
|                 <template v-if="this.active == 3"> | ||||
|                     <awsui-button style="margin-top: 12px;" @click="downloadLog">导出报告</awsui-button> | ||||
|                     <awsui-button style="margin-top: 12px;" @click="success">完成</awsui-button> | ||||
|                 </template> | ||||
|             </div> | ||||
|         </awsui-footer> | ||||
|     </awsui-layout> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../awsuiAxios"; | ||||
|     import ConditionFilter from "./condition-filter"; | ||||
|     import ReplaceRule from "./replace-rule"; | ||||
|     import save from "./save"; | ||||
| 
 | ||||
|     export default { | ||||
|         name: "replace", | ||||
|         components: {ConditionFilter, ReplaceRule, save}, | ||||
|         data() { | ||||
|             return { | ||||
|                 active: 1, | ||||
|                 wsId: wsId, | ||||
|                 teamId: teamId, | ||||
|                 conditionData: {},// 第一步得到的结果值 | ||||
|                 replaceRuleInfo: {},// 第二步得到的结果值 | ||||
|                 methodCategory: methodCategory, | ||||
|                 appId: appId, | ||||
|                 repositoryName: repositoryName, | ||||
|                 groupValue: groupValue, | ||||
|                 processFileValue: processFileValue, | ||||
|                 shapeFileValue: shapeFileValue, | ||||
|                 mainHeight: (document.documentElement.clientHeight) - 60 - 40 + 'px', | ||||
|                 uploadStep: { | ||||
|                     activeName: 'processList', | ||||
|                     loading: false, | ||||
|                     processUpload: {// 模型清单批量上传 | ||||
|                         status: 0, | ||||
|                         fileList: [],// 组件上传列表 | ||||
|                         data: {},// 自定义数据展示数据源 | ||||
|                     }, | ||||
|                     shapeUpload: {// 模型结构批量上传 | ||||
|                         status: 0, | ||||
|                         fileList: [], | ||||
|                         data: {}, | ||||
|                         createTree : { | ||||
|                             visible: false, | ||||
|                             title: '请选择流程' | ||||
|                         } | ||||
|                     } | ||||
|                 }, | ||||
|                 checkStep: { | ||||
|                     type: '' | ||||
|                 }, | ||||
|                 fileList: [], | ||||
|                 saveData: {// 待保存的数据 | ||||
|                     wsId: wsId, | ||||
|                     teamId: teamId, | ||||
|                     type: '', | ||||
|                     fileValue: '', | ||||
|                     fileName: '', | ||||
|                     data: { | ||||
|                         okData: [] | ||||
|                     } | ||||
|                 }, | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|             }; | ||||
|         }, | ||||
|         mounted() { | ||||
|             const that = this; | ||||
|             that.resize(); | ||||
|         }, | ||||
|         methods: { | ||||
|             prev() {// 上一步 | ||||
|                 if (this.active == 2) { | ||||
|                     this.checkStep.type = ''; | ||||
|                 } | ||||
|                 this.active--; | ||||
|             }, | ||||
|             next() {// 下一步 | ||||
|                 if (this.active == 1) {// 上传文件页面点击下一页 | ||||
|                     const conditionFilter = this.$refs.conditionFilter.getResults(); | ||||
|                     if (conditionFilter.methodId == '') { | ||||
|                         this.$message({message: '请选择文件类型', type: 'warning'}); | ||||
|                         return false; | ||||
|                     } | ||||
|                     this.conditionData = conditionFilter; | ||||
|                 } else if (this.active == 2) { | ||||
|                     const replaceRuleInfo = this.$refs.replaceRule.getResults(); | ||||
|                     if (!replaceRuleInfo.isOk) { | ||||
|                         this.$message({message: replaceRuleInfo.msg, type: 'warning'}); | ||||
|                         return false; | ||||
|                     } | ||||
|                     this.replaceRuleInfo = replaceRuleInfo; | ||||
|                 } | ||||
|                 this.active++; | ||||
|             }, | ||||
|             success() {// 完成,关闭窗口 | ||||
|                 parent.closeBatchReplaceFn([]); | ||||
|             }, | ||||
|             downloadLog() {// 下载日志 | ||||
|                 this.$refs.save.downloadLog(); | ||||
|             }, | ||||
|             checkUploadFile() {// 上传模板之后下一步 | ||||
|                 if (this.uploadStep.activeName == 'processList') { | ||||
|                     if (this.uploadStep.processUpload.status == 1) { | ||||
|                         return true; | ||||
|                     } | ||||
|                 } else if (this.uploadStep.activeName == 'shapeList') { | ||||
|                     if (this.uploadStep.shapeUpload.status == 1) { | ||||
|                         return true; | ||||
|                     } | ||||
|                 } | ||||
|                 return false; | ||||
|             }, | ||||
|             uploadFile(type) {// 上传模板 | ||||
|                 if (type == 'process') {// 批量上传流程清单模板 | ||||
|                     this.$refs.processUpload.clearFiles(); | ||||
|                     document.getElementById("selectProcessFileButton").click(); | ||||
|                 } else {// 模型结构清单模板 | ||||
|                     this.$refs.shapeUpload.clearFiles(); | ||||
|                     document.getElementById("selectShapeFileButton").click(); | ||||
|                 } | ||||
|             }, | ||||
|             downloadTemplate(type, versionIds) { // 下载模板 | ||||
|                 const that = this; | ||||
|                 that.uploadStep.loading = true; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_download_template", | ||||
|                         wsId : that.wsId, | ||||
|                         type : type, | ||||
|                         versionIds : versionIds | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     that.uploadStep.loading = false; | ||||
|                     if (ro.result == 'ok') { | ||||
|                         window.open(ro.data.url); | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
| 
 | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             downLoadUploaded(fileValue, name) {// 下载已经上传的 | ||||
|                 const that = this; | ||||
|                 that.uploadStep.loading = true; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_uploaded_file_download", | ||||
|                         fileValue : fileValue, | ||||
|                         fileName : name | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     that.uploadStep.loading = false; | ||||
|                     if (ro.result == 'ok') { | ||||
|                         window.location.href = ro.data.url; | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             deleteUploaded(fileValue, name) {// 删除已经上传的 | ||||
|                 const that = this; | ||||
|                 that.uploadStep.loading = true; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_create_uploaded_file_delete", | ||||
|                         fileValue : fileValue, | ||||
|                         fileName : name | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     that.uploadStep.loading = false; | ||||
|                     if (ro.result == 'ok') { | ||||
|                         if (that.uploadStep.activeName == 'processList') {// 删除已上传流程清单模板 | ||||
|                             that.$refs.processUpload.clearFiles(); | ||||
|                             that.uploadStep.processUpload.status = 0; | ||||
|                             that.uploadStep.processUpload.data = {}; | ||||
|                         } else {// 删除已上传模型结构清单模板 | ||||
|                             that.$refs.shapeUpload.clearFiles(); | ||||
|                             that.uploadStep.shapeUpload.status = 0; | ||||
|                             that.uploadStep.shapeUpload.data = {}; | ||||
|                         } | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             /******模型结构模板下载start*******/ | ||||
|             openRepositoryTreeDlg () {// 打开模型选择框 | ||||
|                 this.uploadStep.shapeUpload.createTree.visible = true; | ||||
|             }, | ||||
|             saveCreateTreeResult(data) {// 模型选择完成后,获取选中的数据 | ||||
|                 if (data.length == 0) { | ||||
|                     this.$message({message: '未选择任何模型,下载模板被取消', type: 'warning'}); | ||||
|                 } else { | ||||
|                     this.downloadTemplate('shapeList', data.join(',')); | ||||
|                 } | ||||
|             }, | ||||
|             /******模型结构模板下载end*******/ | ||||
|             /******模型清单模板上传start*********/ | ||||
|             handleProcessRemove(file, fileList) { | ||||
|                 this.uploadStep.processUpload.status = 0; | ||||
|             }, | ||||
|             handleProcessPreview(file) { | ||||
|             }, | ||||
|             handleProcessExceed(files, fileList) { | ||||
|             }, | ||||
|             handleProcessError(err, file, fileList) { | ||||
|             }, | ||||
|             beforeProcessUpload(file) { | ||||
|                 // 上传之前校验判断大小 | ||||
|                 if (file.size / 1024 / 1024 > 10) {  //文件大于10M | ||||
|                     this.$message.warning('文件不允许超过10M'); | ||||
|                     return false; | ||||
|                 } | ||||
|             }, | ||||
|             handleProcessSuccess(response, file, fileList) { | ||||
|                 const that = this; | ||||
|                 that.uploadStep.processUpload.status = 1; | ||||
|                 that.uploadStep.processUpload.data = { | ||||
|                     name: file.name, | ||||
|                     size: file.size | ||||
|                 }; | ||||
|             }, | ||||
|             beforeProcessRemove(file, fileList) { | ||||
|             }, | ||||
|             /******模型清单模板上传end*********/ | ||||
|             /******模型结构模板上传start*********/ | ||||
|             handleShapeRemove(file, fileList) { | ||||
|                 this.uploadStep.shapeUpload.status = 0; | ||||
|             }, | ||||
|             handleShapePreview(file) { | ||||
|             }, | ||||
|             handleShapeExceed(files, fileList) { | ||||
|             }, | ||||
|             handleShapeError(err, file, fileList) { | ||||
|             }, | ||||
|             beforeShapeUpload(file) { | ||||
|                 // 上传之前校验判断大小 | ||||
|                 if (file.size / 1024 / 1024 > 10) {  //文件大于10M | ||||
|                     this.$message.warning('文件不允许超过10M'); | ||||
|                     return false; | ||||
|                 } | ||||
|             }, | ||||
|             handleShapeSuccess(response, file, fileList) { | ||||
|                 const that = this; | ||||
|                 that.uploadStep.shapeUpload.status = 1; | ||||
|                 that.uploadStep.shapeUpload.data = { | ||||
|                     name: file.name, | ||||
|                     size: file.size | ||||
|                 }; | ||||
| 
 | ||||
|             }, | ||||
|             beforeShapeRemove(file, fileList) { | ||||
|             }, | ||||
|             /******模型结构模板上传end*********/ | ||||
| 
 | ||||
|             resize() {// 窗口监听window.resize | ||||
|                 const that = this | ||||
|                 let resizeTimer = null; | ||||
|                 window.onresize = () => { | ||||
|                     return (() => { | ||||
|                         if (resizeTimer) clearTimeout(resizeTimer); | ||||
|                         resizeTimer = setTimeout(function(){ | ||||
|                             that.mainHeight = (document.documentElement.clientHeight) - 60 - 40 + 'px'; | ||||
|                         } , 400); | ||||
|                     })() | ||||
|                 } | ||||
|             }, | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|     #header >>> .el-step__title { | ||||
|         font-size: 14px; | ||||
|     } | ||||
|     .step { | ||||
|         overflow: auto; | ||||
|         width: 100%; | ||||
|     } | ||||
| 
 | ||||
| </style> | ||||
							
								
								
									
										184
									
								
								com.actionsoft.apps.coe.pal.batch/src/views/replace/save.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										184
									
								
								com.actionsoft.apps.coe.pal.batch/src/views/replace/save.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,184 @@ | ||||
| <template> | ||||
|     <div v-loading="loading" :style="{height: mainHeight, 'background-color': '#2c2c2c'}"> | ||||
|         <codemirror | ||||
|                 id="mycode" | ||||
|                 ref="mycode" | ||||
|                 style="height: auto" | ||||
|                 v-model="curCode" | ||||
|                 :options="cmOptions" | ||||
|                 class="code" | ||||
|         /> | ||||
|     </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
|     import awsuiAxios from "../../awsuiAxios"; | ||||
|     import { codemirror } from 'vue-codemirror' | ||||
|     import "codemirror/theme/ambiance.css";  // 这里引入的是主题样式,根据设置的theme的主题引入,一定要引入!! | ||||
|     require("codemirror/mode/javascript/javascript"); // 这里引入的模式的js,根据设置的mode引入,一定要引入!! | ||||
| 
 | ||||
|     export default { | ||||
|         name: "check-process", | ||||
|         props: { | ||||
|             param: {// 文件名称 | ||||
|                 type: Object, | ||||
|                 default: function () { | ||||
|                     return {} | ||||
|                 } | ||||
|             }, | ||||
|             totalHeight: { | ||||
|                 type: String, | ||||
|                 default: '0px' | ||||
|             } | ||||
|         }, | ||||
|         components: {codemirror}, | ||||
|         data() { | ||||
|             return { | ||||
|                 loading: false, | ||||
|                 wsId: wsId, | ||||
|                 teamId: teamId, | ||||
|                 processFileValue: processFileValue, | ||||
|                 msgHeight: '20px', | ||||
|                 mainHeight: parseInt(this.totalHeight) + 'px', | ||||
|                 curCode: '正在导入', | ||||
|                 cmOptions: { | ||||
|                     value:'', | ||||
|                     mode:"text/html", | ||||
|                     theme: "ambiance", | ||||
|                     lineNumbers: false, | ||||
|                     styleActiveLine: true, | ||||
|                     tabSize: 4, | ||||
|                     autofocus: true, | ||||
|                     scrollbarStyle: "null", | ||||
|                     readOnly:true, | ||||
|                 }, | ||||
|                 result: {// 保存结果 | ||||
|                     path: '', | ||||
|                     type: '', | ||||
|                     logId: '', | ||||
|                     count: 0, | ||||
|                     executeDone: false, | ||||
|                     interval: null, // 查询日志定时器 | ||||
|                     timer:0, // 时间戳记录 | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         mounted() { | ||||
|             this.save(); | ||||
|         }, | ||||
|         methods: { | ||||
|             save() {// 上传 | ||||
|                 const that = this; | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_replace_data_save", | ||||
|                         param : JSON.stringify(that.param) | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     if (ro.result == 'ok') { | ||||
|                         // 获取导入日志信息 | ||||
|                         that.result.path = ro.data.path; | ||||
|                         that.result.logId = ro.data.logId; | ||||
|                         that.result.type = ro.data.type; | ||||
|                         that.result.count = 0; | ||||
|                         that.getImportInfoEvent(); | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             getImportInfoEvent() {// 定时器查询导入日志 | ||||
|                 this.result.interval = setInterval(this.queryLog, 1000) | ||||
|             }, | ||||
|             queryLog() { | ||||
|                 const that = this; | ||||
|                 that.result.timer = new Date().getTime(); | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_replace_log_query", | ||||
|                         type: that.result.type, | ||||
|                         logId: that.result.logId, | ||||
|                         path: that.result.path, | ||||
|                         timer: that.result.timer | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     if (ro.result == 'ok') { | ||||
|                         if (ro.data.timer == '') { | ||||
|                             that.curCode = ro.data.content; | ||||
|                             // 添加内容后定位到行尾 | ||||
|                             that.$nextTick(()=> { | ||||
|                                 that.$refs.mycode.codemirror.scrollIntoView(that.$refs.mycode.codemirror.lineCount() - 1); | ||||
|                             }); | ||||
|                             that.result.executeDone = true; | ||||
|                             that.clearInterval(); | ||||
|                         } else if (parseInt(ro.data.timer) <= that.result.timer){// axios异步,以时间戳对比获取最新日至内容 | ||||
|                             that.curCode = ro.data.content; | ||||
|                             // 添加内容后定位到行尾 | ||||
|                             that.$nextTick(()=> { | ||||
|                                 that.$refs.mycode.codemirror.scrollIntoView(that.$refs.mycode.codemirror.lineCount() - 1); | ||||
|                             }); | ||||
|                         } | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             }, | ||||
|             clearInterval() { | ||||
|                 clearInterval(this.result.interval); | ||||
|             }, | ||||
|             downloadLog() { | ||||
|                 const that = this; | ||||
|                 if (that.result.path == '') { | ||||
|                     that.$message({message: '获取报告失败', type: 'warning'}); | ||||
|                     return; | ||||
|                 } | ||||
|                 if (!that.result.executeDone) { | ||||
|                     that.$message({message: '正在导入,请稍等', type: 'warning'}); | ||||
|                     return; | ||||
|                 } | ||||
|                 const data = { | ||||
|                     url:'jd', | ||||
|                     data:{ | ||||
|                         cmd : "com.actionsoft.apps.coe.pal.batch_replace_log_download", | ||||
|                         type: that.result.type, | ||||
|                         path: that.result.path | ||||
|                     } | ||||
|                 }; | ||||
|                 awsuiAxios.post(data).then(function (ro) { | ||||
|                     if (ro.result == 'ok') { | ||||
|                         window.open(ro.data.url); | ||||
|                         parent.closeBatchReplaceFn([]);// 关闭窗口 | ||||
|                     } else if (ro.result == 'warning') { | ||||
|                         that.$message({message: ro.msg, type: 'warning'}); | ||||
|                     } else { | ||||
|                         that.$message.error(ro.msg); | ||||
|                     } | ||||
|                 }).catch(error=>{ | ||||
|                     console.log(error); | ||||
|                 }) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
|     #mycode >>> .CodeMirror-lines { | ||||
|         background-color: #2c2c2c; | ||||
|         color: #58A0F0; | ||||
|     } | ||||
|     #mycode >>> .CodeMirror { | ||||
|         height: auto !important; | ||||
|     } | ||||
| </style> | ||||
							
								
								
									
										42
									
								
								com.actionsoft.apps.coe.pal.batch/static/common/common.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								com.actionsoft.apps.coe.pal.batch/static/common/common.css
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,42 @@ | ||||
| * { | ||||
|   padding: 0; | ||||
|   margin: 0; | ||||
| } | ||||
| 
 | ||||
| body { | ||||
|   color: #4a4a4a; | ||||
|   font-family: PingFangSC-Light; | ||||
| } | ||||
| 
 | ||||
| ul { | ||||
|   list-style: none; | ||||
| } | ||||
| 
 | ||||
| a { | ||||
|   text-decoration: none; | ||||
| } | ||||
| 
 | ||||
| div,span,section,i,button { | ||||
|   -webkit-tap-highlight-color: transparent; | ||||
|   outline: none; | ||||
| } | ||||
| 
 | ||||
| .radius3 { | ||||
|   -moz-border-radius: 3px 3px 3px 3px; | ||||
|   -webkit-border-radius: 3px 3px 3px 3px; | ||||
|   border-radius: 3px 3px 3px 3px; | ||||
| } | ||||
| 
 | ||||
| .tree-content-icon { | ||||
|   font-size: 13px; | ||||
| } | ||||
| .tree-content-icon-padding { | ||||
|   padding-right: 2px; | ||||
| } | ||||
| 
 | ||||
| .el-input__inner { | ||||
|   border-radius: 0px; | ||||
| } | ||||
| .el-textarea__inner { | ||||
|   border-radius: 0px; | ||||
| } | ||||
							
								
								
									
										244
									
								
								com.actionsoft.apps.coe.pal.batch/static/common/theme1.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										244
									
								
								com.actionsoft.apps.coe.pal.batch/static/common/theme1.css
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,244 @@ | ||||
| /*设计颜色规范*/ | ||||
| 
 | ||||
| /* | ||||
| 通用鼠标悬浮色 | ||||
| 所有悬浮状态的底色,包括下拉列表项、表格、卡片等。 | ||||
|  */ | ||||
| .general-bgcolor-hover:hover { | ||||
|   background-color: #F5F7FA !important; | ||||
| } | ||||
| .general-bgcolor-text-hover:hover { | ||||
|   background-color: #F5F7FA !important; | ||||
|   color : #4E7FF9 !important; | ||||
| } | ||||
| 
 | ||||
| /*通用分隔线*/ | ||||
| .general-dividing-line { | ||||
|   color: #F2F2F2; | ||||
| } | ||||
| 
 | ||||
| /**********************下拉菜单覆盖*************************/ | ||||
| /*下拉菜单定义悬浮颜色和悬浮字体色*/ | ||||
| .el-dropdown-menu__item:not(.is-disabled):hover{ | ||||
|   background-color: #F5F7FA !important; | ||||
|   color: #333333 !important; | ||||
| } | ||||
| 
 | ||||
| /**********************导航菜单栏颜色设置*************************/ | ||||
| .el-menu-item:hover{ | ||||
|   color: #4E7FF9; | ||||
|   background-color: #F5F7FA !important; | ||||
| } | ||||
| .el-submenu__title:hover{ | ||||
|   background-color: #F5F7FA !important; | ||||
| } | ||||
| .el-menu-item.is-active { | ||||
|   color: #4E7FF9; | ||||
|   background-color: #F5F7FA !important; | ||||
| } | ||||
| 
 | ||||
| /**********************文字*************************/ | ||||
| 
 | ||||
| /*主要字体颜色,通用字体颜色,系统普遍使用的字体颜色*/ | ||||
| .text-general-color { | ||||
|   color : #606266; | ||||
| } | ||||
| .text-general-bgcolor { | ||||
|   background-color : #606266; | ||||
| } | ||||
| 
 | ||||
| /* | ||||
| 次要字体颜色 | ||||
| 1	次要标注性信息	如,管理员 于2020年2月23日 19:30 修改 | ||||
| 2	非重要按钮	如,“取消”按钮文本 | ||||
| 3	列表表头	如,“流程清单”编号、流程名称 | ||||
|  */ | ||||
| .text-second-color { | ||||
|   color : #909399; | ||||
| } | ||||
| .text-second-bgcolor { | ||||
|   background-color : #909399; | ||||
| } | ||||
| 
 | ||||
| /*链接、可点击文本、icon颜色*/ | ||||
| .text-linker-color { | ||||
|   color : #4E7FF9; | ||||
| } | ||||
| 
 | ||||
| .text-linker-bgcolor { | ||||
|   background-color : #4E7FF9; | ||||
| } | ||||
| 
 | ||||
| /*重要文本颜色*/ | ||||
| .text-important-color { | ||||
|   color : #D9001B; | ||||
| } | ||||
| 
 | ||||
| .text-important-bgcolor { | ||||
|   background-color : #D9001B; | ||||
| } | ||||
| 
 | ||||
| /*el-link颜色*/ | ||||
| .el-link.el-link--primary { | ||||
|   color: #4E7FF9; | ||||
| } | ||||
| 
 | ||||
| /**********************表格*************************/ | ||||
| 
 | ||||
| /*表头文字颜色*/ | ||||
| .table-head-text-color { | ||||
|   color: #909399; | ||||
| } | ||||
| /*表头背景颜色*/ | ||||
| .table-head-bgcolor { | ||||
| 
 | ||||
| } | ||||
| /*表头文字颜色*/ | ||||
| .table-body-text-color { | ||||
| 
 | ||||
| } | ||||
| /*表格表体背景颜色*/ | ||||
| .table-body-bgcolor { | ||||
| 
 | ||||
| } | ||||
| /*表格表体行鼠标悬浮色*/ | ||||
| .table-body-row-bgcolor:hover { | ||||
|   background-color: #F5F7FA !important; | ||||
| } | ||||
| /*表格表体行下划线颜色*/ | ||||
| .el-table td { | ||||
|   border-bottom: 1px solid #F2F2F2; | ||||
| } | ||||
| 
 | ||||
| /*表格筛选的表头选中颜色*/ | ||||
| .el-table th>.cell.highlight { | ||||
|   color: #4E7FF9; | ||||
| } | ||||
| 
 | ||||
| /*表格筛选的表头选项筛选和重置按钮悬浮颜色*/ | ||||
| .el-table-filter__bottom button:hover { | ||||
|   color:#4E7FF9 | ||||
| } | ||||
| 
 | ||||
| /*表格筛选排序上下箭头*/ | ||||
| .el-table .descending .sort-caret.descending { | ||||
|   border-top-color: #4E7FF9; | ||||
| } | ||||
| .el-table .ascending .sort-caret.ascending { | ||||
|   border-bottom-color: #4E7FF9; | ||||
| } | ||||
| 
 | ||||
| /**********************按钮*************************/ | ||||
| 
 | ||||
| /*通用按钮1,例如窗口确定按钮,新建按钮等设计颜色*/ | ||||
| .button-general-color { | ||||
|   background-color: #4E7FF9 !important; | ||||
|   border-color: #4E7FF9 !important; | ||||
| } | ||||
| 
 | ||||
| .button-general-color-reverse { | ||||
|   border-color: #4E7FF9 !important; | ||||
|   color: #4E7FF9 !important; | ||||
| } | ||||
| 
 | ||||
| /*通用按钮2,例如重要操作类按钮*/ | ||||
| .button-general-color2 { | ||||
|   background-color: #D9001B !important; | ||||
|   border-color: #D9001B !important; | ||||
| } | ||||
| 
 | ||||
| .button-general-color-reverse2 { | ||||
|   border-color: #D9001B !important; | ||||
|   color: #D9001B !important; | ||||
| } | ||||
| /*通用按钮3,例如取消等灰色按钮*/ | ||||
| .button-general-color3 { | ||||
|   background-color: #909399 !important; | ||||
|   border-color: #909399 !important; | ||||
| } | ||||
| 
 | ||||
| .button-general-color-reverse3 { | ||||
|   border-color: #909399 !important; | ||||
|   color: #909399 !important; | ||||
| } | ||||
| 
 | ||||
| /********************多选框***********************/ | ||||
| .el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner { | ||||
|   background-color: #4E7FF9; | ||||
|   border-color: #4E7FF9; | ||||
| } | ||||
| .el-checkbox__input.is-checked+.el-checkbox__label { | ||||
|   color: #4E7FF9; | ||||
| } | ||||
| 
 | ||||
| /********************单选框***********************/ | ||||
| .el-radio__input.is-checked .el-radio__inner { | ||||
|   border-color: #4E7FF9; | ||||
|   background: #4E7FF9; | ||||
| } | ||||
| .el-radio__input.is-checked+.el-radio__label { | ||||
|   color: #4E7FF9; | ||||
| } | ||||
| 
 | ||||
| /********************列表***********************/ | ||||
| .li-general-hover-bgcolor:hover { | ||||
|   background-color: #F5F7FA; | ||||
| } | ||||
| .el-table__body tr.current-row>td { | ||||
|   background-color: #F5F7FA; | ||||
| } | ||||
| 
 | ||||
| /*******************加载中颜色********************/ | ||||
| .el-loading-spinner .path { | ||||
|   stroke: #4E7FF9; | ||||
| } | ||||
| .el-loading-spinner .el-loading-text { | ||||
|   color: #4E7FF9; | ||||
| } | ||||
| /******************下拉框文字选中颜色*************/ | ||||
| .el-select-dropdown__item.selected { | ||||
|   color: #4E7FF9 !important; | ||||
| } | ||||
| .el-select-dropdown.is-multiple .el-select-dropdown__item.selected { | ||||
|   color: #4E7FF9; | ||||
| } | ||||
| 
 | ||||
| /*****************步骤条**********************/ | ||||
| .el-step__title.is-process { | ||||
|   color: #909399; | ||||
| } | ||||
| .el-step__title.is-finish { | ||||
|   color: #4E7FF9; | ||||
| } | ||||
| .el-step__head.is-process { | ||||
|   color: #909399; | ||||
|   border-color: #909399; | ||||
| } | ||||
| .el-step__head.is-finish { | ||||
|   color: #4E7FF9; | ||||
|   border-color: #4E7FF9; | ||||
| } | ||||
| 
 | ||||
| /*********************Popover 弹出框***********************/ | ||||
| .el-popover__title { | ||||
|   color : #606266; | ||||
|   font-weight: 600; | ||||
| } | ||||
| 
 | ||||
| /*********************树***********************/ | ||||
| .el-tree-node__content { | ||||
|   height: 30px; | ||||
| } | ||||
| /*树展开关闭图标大小*/ | ||||
| .el-tree-node__expand-icon { | ||||
|   font-size: 12px; | ||||
| } | ||||
| /*树展开关闭图标的padding*/ | ||||
| .el-tree-node__content>.el-tree-node__expand-icon { | ||||
|   padding: 1px; | ||||
| } | ||||
| 
 | ||||
| .el-table__empty-text { | ||||
|   font-size: 12px; | ||||
| } | ||||
| 
 | ||||
							
								
								
									
										123
									
								
								com.actionsoft.apps.coe.pal.batch/vue.config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								com.actionsoft.apps.coe.pal.batch/vue.config.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,123 @@ | ||||
| const HtmlWebpackPlugin = require('html-webpack-plugin') | ||||
| const AWSDevParams = require('./AWSDevParams'); | ||||
| const AWSReleasePath = AWSDevParams.AWSReleasePath; | ||||
| const AWSPortalUrl = AWSDevParams.AWSPortalUrl; | ||||
| //开发时通过用户名及密码获取sessionId
 | ||||
| const devUserInfo =AWSDevParams.devUserInfo; | ||||
| const AWSproxyPath = "/AWSDEVURL/r/"; //防止跨域的地址
 | ||||
| 
 | ||||
| const moduleTemplateInAWS = AWSDevParams.moduleTemplateInAWS;//平台的模板路径
 | ||||
| const outputDir = AWSDevParams.outputDir; | ||||
| const publicPath = AWSDevParams.publicPath;//决定生成在平台的js或css的相对路径,与build配置的路径要对应
 | ||||
| 
 | ||||
| //判断是否开发
 | ||||
| const isproduction = process.env.NODE_ENV === 'production'; | ||||
| //开发时路径和build到平台路径
 | ||||
| let AWSJSAndCSSPath = isproduction ? "../" : AWSproxyPath.replace("r/",""); | ||||
| let AWSJSAndCSSImport = AWSDevParams.AWSJSAndCSSImport == null ? [] : AWSDevParams.AWSJSAndCSSImport; | ||||
| let AWSJSAndCSSImportArray = []; | ||||
| for(let k of AWSJSAndCSSImport){ | ||||
|   if(k.type == "css"){ | ||||
|     AWSJSAndCSSImportArray.push("<link type='text/css' rel='stylesheet' href='"+AWSJSAndCSSPath + k.path +"'/>"); | ||||
|   }else if(k.type == "js"){ | ||||
|     AWSJSAndCSSImportArray.push("<script type='text/javascript' src='"+AWSJSAndCSSPath + k.path + "'></script>"); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| const getAWSFileRelativePath = ()=>{ | ||||
|   let index = "./"; | ||||
|   if(isproduction){ | ||||
|     index = publicPath; | ||||
|   } | ||||
|   return index; | ||||
| } | ||||
| const getIndexPath = ()=>{ | ||||
|   let index = "index.html"; | ||||
|   if(isproduction){ | ||||
|     index = AWSReleasePath+moduleTemplateInAWS; | ||||
|   } | ||||
|   return index; | ||||
| } | ||||
| module.exports = { | ||||
|   // 基本路径 build后文件路径../apps/_bpm.platform/test2 ,开发运行时文件路径./
 | ||||
|   publicPath: getAWSFileRelativePath(), | ||||
| 
 | ||||
|   //生成入口的html文件位置
 | ||||
|   indexPath: getIndexPath(), | ||||
| 
 | ||||
|   outputDir : AWSReleasePath+outputDir, | ||||
| 
 | ||||
|   // eslint-loader 是否在保存的时候检查
 | ||||
|   lintOnSave: true, | ||||
| 
 | ||||
|   productionSourceMap: false, //打包不使用源码(false后在平台无法调试)
 | ||||
|   // use the full build with in-browser compiler?
 | ||||
|   // https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only
 | ||||
|   // compiler: false,
 | ||||
|   // webpack配置
 | ||||
|   // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
 | ||||
|   chainWebpack: (config) => { | ||||
|     config.plugin('html') | ||||
|         .tap(args => { | ||||
|           let buildVar = args[0]; | ||||
|           buildVar.AWSJSAndCSSImport = AWSJSAndCSSImportArray.join("\n"); | ||||
|           debugger | ||||
|           buildVar.AWSJSAndCSSPath = AWSJSAndCSSPath; | ||||
|           buildVar.devUserInfo = devUserInfo; | ||||
|           buildVar.isproduction = isproduction; | ||||
|           buildVar.axiosBaseUrl = isproduction ? "./" : AWSproxyPath; | ||||
|           buildVar.settingParam = isproduction ? "<#settingParam>" : "{}"; | ||||
|           return args; | ||||
|         }); | ||||
|   }, | ||||
| 
 | ||||
|   configureWebpack: config => { | ||||
|     if (isproduction) { | ||||
|       // 为生产环境修改配置...
 | ||||
|       config.mode = 'production' | ||||
|     } else { | ||||
|       // 为开发环境修改配置...
 | ||||
|       config.mode = 'development' | ||||
|     } | ||||
|   }, | ||||
| 
 | ||||
|   devServer: { | ||||
|     proxy: { | ||||
|       //配置跨域
 | ||||
|       "/AWSDEVURL": { | ||||
|         target: AWSPortalUrl, | ||||
|         ws: true, | ||||
|         changOrigin: true, //允许跨域
 | ||||
|         pathRewrite: { | ||||
|           "^/AWSDEVURL": "" //请求的时候使用这个URL就可以
 | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   // css相关配置
 | ||||
|   css: { | ||||
|     loaderOptions: {} | ||||
|   }, | ||||
| 
 | ||||
|   // 是否启用dll
 | ||||
|   // See https://github.com/vuejs/vue-cli/blob/dev/docs/cli-service.md#dll-mode
 | ||||
|   // dll: false,
 | ||||
|   // PWA 插件相关配置
 | ||||
|   // see https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa
 | ||||
|   pwa: {}, | ||||
| 
 | ||||
|   // webpack-dev-server 相关配置
 | ||||
|   //  devServer: {
 | ||||
|   //    open: process.platform === 'darwin',
 | ||||
|   //    disableHostCheck: true,
 | ||||
|   //    host: 'www.test.com',//如果是真机测试,就使用这个IP
 | ||||
|   //    port: 1234,
 | ||||
|   //    https: false,
 | ||||
|   //    hotOnly: false,
 | ||||
|   //   before: app => {}
 | ||||
|   //  },
 | ||||
| 
 | ||||
|   // 第三方插件配置
 | ||||
|   pluginOptions: { | ||||
|   } | ||||
| } | ||||
							
								
								
									
										8306
									
								
								com.actionsoft.apps.coe.pal.batch/yarn.lock
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8306
									
								
								com.actionsoft.apps.coe.pal.batch/yarn.lock
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user
	 446052889@qq.com
						446052889@qq.com