合并
Showing
29 changed files
with
7654 additions
and
1190 deletions
| ... | @@ -13,6 +13,7 @@ VITE_APP_AUTH_URL = 'ms-daop-auth-service' | ... | @@ -13,6 +13,7 @@ VITE_APP_AUTH_URL = 'ms-daop-auth-service' |
| 13 | 13 | ||
| 14 | # 系统管理 接口地址 | 14 | # 系统管理 接口地址 |
| 15 | VITE_APP_API_BASEURL = ms-daop-zcgl-system-manager-service | 15 | VITE_APP_API_BASEURL = ms-daop-zcgl-system-manager-service |
| 16 | |||
| 16 | # 文件上传请求地址 | 17 | # 文件上传请求地址 |
| 17 | VITE_APP_ADD_FILE = ms-daop-import-data-service | 18 | VITE_APP_ADD_FILE = ms-daop-import-data-service |
| 18 | # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 | 19 | # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 |
| ... | @@ -32,6 +33,10 @@ VITE_APP_QUALITY_BASEURL = ms-daop-data-quality-service | ... | @@ -32,6 +33,10 @@ VITE_APP_QUALITY_BASEURL = ms-daop-data-quality-service |
| 32 | # VITE_APP_CHECK_BASEURL = /mock | 33 | # VITE_APP_CHECK_BASEURL = /mock |
| 33 | VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory | 34 | VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory |
| 34 | 35 | ||
| 36 | # 数据字典接口地址 | ||
| 37 | VITE_APP_CONFIG_URL = 'ms-daop-configure-service' | ||
| 38 | |||
| 39 | |||
| 35 | #门户接口 | 40 | #门户接口 |
| 36 | VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal | 41 | VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal |
| 37 | 42 | ... | ... |
| 1 | # 页面标题 | 1 | # 页面标题 |
| 2 | VITE_APP_TITLE = 数据资产管理系统 | 2 | VITE_APP_TITLE = 数据资产管理系统 |
| 3 | # 接口域名 | 3 | # 接口域名 |
| 4 | VITE_API_BASEURL = https://www.zgsjzc.com/api | 4 | VITE_API_BASEURL = http://192.168.6.20:28052/ |
| 5 | # VITE_API_BASEURL = http://49.4.26.201:31709/ | 5 | # VITE_API_BASEURL = http://49.4.26.201:31709/ |
| 6 | # # 平台用户 接口请地址 | ||
| 7 | # VITE_APP_USER_API_BASEURL = gateway-server | ||
| 8 | # # 系统管理 接口地址 | ||
| 9 | # VITE_APP_API_BASEURL = ms-daop-zcgl-system-manager-service | ||
| 10 | # # 文件上传请求地址 | ||
| 11 | # VITE_APP_ADD_FILE = ms-daop-import-data-service | ||
| 12 | # # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 | ||
| 13 | # VITE_APP_DEBUG_TOOL = | ||
| 14 | # # 是否开启代理 | ||
| 15 | # VITE_OPEN_PROXY = true | ||
| 16 | # # vite serve base | ||
| 17 | # VITE_SERVE_BASE = / | ||
| 18 | # # 流程设计访问地址 | ||
| 19 | # VITE_BPMN_URL = https://workflow.zgsjzc.com | ||
| 20 | # # 数据标准、元数据、数据目录 接口地址 | ||
| 21 | # VITE_APP_PLAN_BASEURL = ms-daop-jgjf-data-plan-service | ||
| 22 | # #数据质量接口地址 | ||
| 23 | # VITE_APP_QUALITY_BASEURL = ms-daop-data-quality-service | ||
| 24 | |||
| 25 | # #门户接口 | ||
| 26 | # VITE_API_PORTALURL = https://www.zgsjzc.com/portal | ||
| 27 | |||
| 28 | # #数据资产接口地址 | ||
| 29 | # VITE_API_ASSET_BASEURL = ms-swzl-data-dam-service | ||
| 30 | # #数据同步接口地址 | ||
| 31 | # VITE_API_DATA_SYNC = ms-swzl-data-sync-service | ||
| 32 | # #消息接口 | ||
| 33 | # VITE_API_MESSAGE = ms-swzl-message-notification-service | ||
| 6 | # 平台用户 接口请地址 | 34 | # 平台用户 接口请地址 |
| 7 | VITE_APP_USER_API_BASEURL = gateway-server | 35 | VITE_APP_USER_API_BASEURL = gateway-server |
| 36 | |||
| 37 | #AUTH服务 | ||
| 38 | VITE_APP_AUTH_URL = 'ms-daop-auth-service' | ||
| 39 | |||
| 8 | # 系统管理 接口地址 | 40 | # 系统管理 接口地址 |
| 9 | VITE_APP_API_BASEURL = ms-daop-zcgl-system-manager-service | 41 | VITE_APP_API_BASEURL = ms-daop-zcgl-system-manager-service |
| 42 | |||
| 10 | # 文件上传请求地址 | 43 | # 文件上传请求地址 |
| 11 | VITE_APP_ADD_FILE = ms-daop-import-data-service | 44 | VITE_APP_ADD_FILE = ms-daop-import-data-service |
| 12 | # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 | 45 | # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 |
| ... | @@ -16,14 +49,22 @@ VITE_OPEN_PROXY = true | ... | @@ -16,14 +49,22 @@ VITE_OPEN_PROXY = true |
| 16 | # vite serve base | 49 | # vite serve base |
| 17 | VITE_SERVE_BASE = / | 50 | VITE_SERVE_BASE = / |
| 18 | # 流程设计访问地址 | 51 | # 流程设计访问地址 |
| 19 | VITE_BPMN_URL = https://workflow.zgsjzc.com | 52 | VITE_BPMN_URL = https://workflow-swzl-test.csbr.cn |
| 20 | # 数据标准、元数据、数据目录 接口地址 | 53 | # 数据标准、元数据、数据目录 接口地址 |
| 21 | VITE_APP_PLAN_BASEURL = ms-daop-jgjf-data-plan-service | 54 | VITE_APP_PLAN_BASEURL = ms-daop-jgjf-data-plan-service |
| 22 | #数据质量接口地址 | 55 | #数据质量接口地址 |
| 23 | VITE_APP_QUALITY_BASEURL = ms-daop-data-quality-service | 56 | VITE_APP_QUALITY_BASEURL = ms-daop-data-quality-service |
| 24 | 57 | ||
| 58 | #数据盘点接口地址ms-daop-zcgl-data-inventory | ||
| 59 | # VITE_APP_CHECK_BASEURL = /mock | ||
| 60 | VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory | ||
| 61 | |||
| 62 | # 数据字典接口地址 | ||
| 63 | VITE_APP_CONFIG_URL = 'ms-daop-configure-service' | ||
| 64 | |||
| 65 | |||
| 25 | #门户接口 | 66 | #门户接口 |
| 26 | VITE_API_PORTALURL = https://www.zgsjzc.com/portal | 67 | VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal |
| 27 | 68 | ||
| 28 | #数据资产接口地址 | 69 | #数据资产接口地址 |
| 29 | VITE_API_ASSET_BASEURL = ms-swzl-data-dam-service | 70 | VITE_API_ASSET_BASEURL = ms-swzl-data-dam-service | ... | ... |
| 1 | FROM 192.168.5.4:82/csbr/nginx:stable-alpine | 1 | |
| 2 | |||
| 3 | FROM 192.168.6.22:8081/csbr/nginx:stable-alpine | ||
| 2 | VOLUME /tmp | 4 | VOLUME /tmp |
| 3 | #将当前文件夹的dist文件复制到容器的/usr/share/nginx/html目录 | 5 | #将当前文件夹的dist文件复制到容器的/usr/share/nginx/html目录 |
| 4 | COPY ./dist/* /usr/share/nginx/html/ | 6 | COPY ./dist/* /usr/share/nginx/html/ |
| 5 | COPY ./dist/assets /usr/share/nginx/html/assets | 7 | COPY ./dist/assets /usr/share/nginx/html/assets |
| 6 | #COPY ./dist/importTemplate /usr/share/nginx/html/importTemplate | ||
| 7 | COPY default.conf /etc/nginx/conf.d/ | 8 | COPY default.conf /etc/nginx/conf.d/ |
| 8 | #声明运行时容器暴露的端口(容器提供的服务端口) | 9 | #声明运行时容器暴露的端口(容器提供的服务端口) |
| 9 | EXPOSE 8911 | 10 | RUN chown -R nginx:nginx /usr/share/nginx/html |
| 11 | EXPOSE 29900 | ||
| 10 | #CMD:指定容器启动时要运行的命令 | 12 | #CMD:指定容器启动时要运行的命令 |
| 11 | CMD ["nginx", "-g", "daemon off;"] | 13 | CMD ["nginx", "-g", "daemon off;"] | ... | ... |
| ... | @@ -3,21 +3,22 @@ pipeline { | ... | @@ -3,21 +3,22 @@ pipeline { |
| 3 | //环境定义 | 3 | //环境定义 |
| 4 | environment{ | 4 | environment{ |
| 5 | //服务名称 | 5 | //服务名称 |
| 6 | SVN_FOLD = "fe-swzl-asset-temp" | 6 | SVN_FOLD = "fe-data-asset-management" |
| 7 | //部署远程服务器 | 7 | //部署远程服务器 |
| 8 | //192.168.4.4服务器 | 8 | //192.168.4.4服务器 |
| 9 | //SSH_PATH = "csbr4.4" | 9 | //SSH_PATH = "csbr4.4" |
| 10 | //192.168.5.4 | 10 | //192.168.5.4 |
| 11 | SSH_PATH = "csbr5.2" | 11 | SSH_PATH = "csbr20" |
| 12 | SVN_TYPE = "dev" | ||
| 12 | //139.9.190.186 | 13 | //139.9.190.186 |
| 13 | //SSH_PATH = "csbr190.186" | 14 | //SSH_PATH = "csbr190.186" |
| 14 | //SVN_TYPE = "master" | 15 | //SVN_TYPE = "master" |
| 15 | //镜像版本号 | 16 | //镜像版本号 |
| 16 | image_tag = "1.0.0" | 17 | image_tag = "1.0.0" |
| 17 | //docker私服ip | 18 | //docker私服ip |
| 18 | ip = "192.168.5.4:82" | 19 | ip = "192.168.6.22:8081" |
| 19 | //前端端口号 | 20 | //前端端口号 |
| 20 | port = "8911" | 21 | port = "29900" |
| 21 | //映射端口号 | 22 | //映射端口号 |
| 22 | vport = "80" | 23 | vport = "80" |
| 23 | 24 | ||
| ... | @@ -49,8 +50,10 @@ pipeline { | ... | @@ -49,8 +50,10 @@ pipeline { |
| 49 | steps { | 50 | steps { |
| 50 | nodejs('node 16.20.2'){} | 51 | nodejs('node 16.20.2'){} |
| 51 | //配置私有npm仓库 | 52 | //配置私有npm仓库 |
| 52 | sh 'npm config set registry http://192.168.5.4:8001/repository/csbr-npm/' | 53 | // sh 'npm config set registry http://192.168.5.4:8001/repository/csbr-npm/' |
| 53 | sh 'yarn config set registry http://192.168.5.4:8001/repository/csbr-npm/' | 54 | // sh 'yarn config set registry http://192.168.5.4:8001/repository/csbr-npm/' |
| 55 | sh 'npm config set registry http://49.4.23.228:8001/repository/csbr-npm/' | ||
| 56 | sh 'yarn config set registry http://49.4.23.228:8001/repository/csbr-npm/' | ||
| 54 | // 配置后可通过下面方式来验证是否成功 | 57 | // 配置后可通过下面方式来验证是否成功 |
| 55 | sh 'npm config get registry' | 58 | sh 'npm config get registry' |
| 56 | sh 'npm install -g pnpm' | 59 | sh 'npm install -g pnpm' |
| ... | @@ -63,9 +66,9 @@ pipeline { | ... | @@ -63,9 +66,9 @@ pipeline { |
| 63 | steps { | 66 | steps { |
| 64 | //分分支构建 | 67 | //分分支构建 |
| 65 | script{ | 68 | script{ |
| 66 | if(env.BRANCH_NAME=='master-asset'){ | 69 | if(env.BRANCH_NAME=='develop'){ |
| 67 | //master-asset分支环境 | 70 | //master-asset分支环境 |
| 68 | echo 'start to deploy ${SVN_FOLD} on master-asset ...' | 71 | echo 'start to deploy ${SVN_FOLD} on develop ...' |
| 69 | sh ''' | 72 | sh ''' |
| 70 | #docker rmi -f $(docker images | grep "none" | awk '{print $3}') | 73 | #docker rmi -f $(docker images | grep "none" | awk '{print $3}') |
| 71 | CID=$(docker ps -a | grep "${SVN_FOLD}" | awk '{print $1}') | 74 | CID=$(docker ps -a | grep "${SVN_FOLD}" | awk '{print $1}') |
| ... | @@ -77,15 +80,15 @@ pipeline { | ... | @@ -77,15 +80,15 @@ pipeline { |
| 77 | ##构建镜像到远程仓库 | 80 | ##构建镜像到远程仓库 |
| 78 | docker login "${ip}" -u admin -p E6w611g864wQ2 | 81 | docker login "${ip}" -u admin -p E6w611g864wQ2 |
| 79 | #docker tag "${SVN_FOLD}":"${image_tag}" "${ip}"/csbr/"${SVN_FOLD}":"${image_tag}" | 82 | #docker tag "${SVN_FOLD}":"${image_tag}" "${ip}"/csbr/"${SVN_FOLD}":"${image_tag}" |
| 80 | docker build -t "${ip}"/csbr/"${SVN_FOLD}":"${image_tag}" . | 83 | docker build -t "${ip}"/csbr/"${SVN_FOLD}""-${SVN_TYPE}":"${image_tag}" . |
| 81 | docker push "${ip}"/csbr/"${SVN_FOLD}":"${image_tag}" | 84 | docker push "${ip}"/csbr/"${SVN_FOLD}""-${SVN_TYPE}":"${image_tag}" |
| 82 | else | 85 | else |
| 83 | echo "不存在'${SVN_FOLD}'镜像,开始构建镜像" | 86 | echo "不存在'${SVN_FOLD}'镜像,开始构建镜像" |
| 84 | ##构建镜像到远程仓库 | 87 | ##构建镜像到远程仓库 |
| 85 | docker login "${ip}" -u admin -p E6w611g864wQ2 | 88 | docker login "${ip}" -u admin -p E6w611g864wQ2 |
| 86 | #docker tag "${SVN_FOLD}":"${image_tag}" "${ip}"/csbr/"${SVN_FOLD}":"${image_tag}" | 89 | #docker tag "${SVN_FOLD}":"${image_tag}" "${ip}"/csbr/"${SVN_FOLD}":"${image_tag}" |
| 87 | docker build -t "${ip}"/csbr/"${SVN_FOLD}":"${image_tag}" . | 90 | docker build -t "${ip}"/csbr/"${SVN_FOLD}""-${SVN_TYPE}":"${image_tag}" . |
| 88 | docker push "${ip}"/csbr/"${SVN_FOLD}":"${image_tag}" | 91 | docker push "${ip}"/csbr/"${SVN_FOLD}""-${SVN_TYPE}":"${image_tag}" |
| 89 | fi | 92 | fi |
| 90 | ''' | 93 | ''' |
| 91 | echo 'Depoly ${SVN_FOLD} success ...' | 94 | echo 'Depoly ${SVN_FOLD} success ...' |
| ... | @@ -107,14 +110,14 @@ pipeline { | ... | @@ -107,14 +110,14 @@ pipeline { |
| 107 | echo 'Deploying' | 110 | echo 'Deploying' |
| 108 | //分分支部署 | 111 | //分分支部署 |
| 109 | script{ | 112 | script{ |
| 110 | if(env.BRANCH_NAME=='master-asset'){ | 113 | if(env.BRANCH_NAME=='develop'){ |
| 111 | //master-asset分支环境 | 114 | //master-asset分支环境 |
| 112 | echo 'start to deploy ${SVN_FOLD} on master-asset ...' | 115 | echo 'start to deploy ${SVN_FOLD} on develop ...' |
| 113 | //调用Publish Over SSH插件,上传docker-compose.yaml文件并且执行deploy脚本 | 116 | //调用Publish Over SSH插件,上传docker-compose.yaml文件并且执行deploy脚本 |
| 114 | sshPublisher(publishers: [sshPublisherDesc(configName: "csbr5.3", transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: """ | 117 | sshPublisher(publishers: [sshPublisherDesc(configName: "csbr20", transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: """ |
| 115 | #使用k8s构建 | 118 | #使用k8s构建 |
| 116 | kubectl delete -f /mnt/k8s/production/fe-swzl-asset.yaml | 119 | kubectl delete -f /mnt/k8s/develop/daop-jgjf/fe-data-asset-management.yaml |
| 117 | kubectl apply -f /mnt/k8s/production/fe-swzl-asset.yaml | 120 | kubectl apply -f /mnt/k8s/develop/daop-jgjf/fe-data-asset-management.yaml |
| 118 | """, execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/mnt/csbr/data', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'output/*.*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) | 121 | """, execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/mnt/csbr/data', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'output/*.*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) |
| 119 | 122 | ||
| 120 | echo 'Depoly ${SVN_FOLD} success ...' | 123 | echo 'Depoly ${SVN_FOLD} success ...' | ... | ... |
| ... | @@ -2,48 +2,53 @@ server { | ... | @@ -2,48 +2,53 @@ server { |
| 2 | listen 80; | 2 | listen 80; |
| 3 | listen [::]:80; | 3 | listen [::]:80; |
| 4 | server_name localhost; | 4 | server_name localhost; |
| 5 | # server_name http://192.168.6.20:8052; | ||
| 5 | 6 | ||
| 6 | #charset koi8-r; | 7 | |
| 7 | #access_log /var/log/nginx/host.access.log main; | 8 | # 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问 |
| 9 | add_header 'Access-Control-Allow-Origin' * always; | ||
| 10 | # 设置允许的 HTTP 方法 | ||
| 11 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT'; | ||
| 12 | # 设置允许的请求头 | ||
| 13 | add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept, Origin, X-Requested-With'; | ||
| 14 | # 如果需要支持 cookie,可以设置以下 header | ||
| 15 | add_header 'Access-Control-Allow-Credentials' 'true'; | ||
| 16 | # 缓存设置 | ||
| 17 | add_header Cache-Control no-cache; | ||
| 18 | add_header Cache-Control private; | ||
| 19 | # # 预检请求处理 | ||
| 20 | # if ($request_method = OPTIONS) { | ||
| 21 | # return 204; | ||
| 22 | # } | ||
| 8 | 23 | ||
| 9 | location / { | 24 | location / { |
| 10 | root /usr/share/nginx/html; | 25 | root /usr/share/nginx/html; |
| 11 | index index.html index.htm; | 26 | index index.html index.htm; |
| 12 | try_files $uri $uri/ /index.html; | 27 | try_files $uri $uri/ /index.html; |
| 28 | expires -1s; | ||
| 29 | } | ||
| 30 | |||
| 31 | location /api { | ||
| 32 | # 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问 | ||
| 33 | add_header 'Access-Control-Allow-Origin' * always; | ||
| 34 | # 设置允许的 HTTP 方法 | ||
| 35 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT'; | ||
| 36 | # 设置允许的请求头 | ||
| 37 | add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept, Origin, X-Requested-With'; | ||
| 38 | # 如果需要支持 cookie,可以设置以下 header | ||
| 39 | add_header 'Access-Control-Allow-Credentials' 'true'; | ||
| 40 | # 缓存设置 | ||
| 13 | add_header Cache-Control no-cache; | 41 | add_header Cache-Control no-cache; |
| 14 | add_header Cache-Control private; | 42 | add_header Cache-Control private; |
| 15 | expires -1s; | 43 | |
| 44 | # 使用 rewrite 将 /api 替换为 /new-api | ||
| 45 | rewrite ^/api/(.*)$ /$1 break; | ||
| 46 | proxy_pass http://192.168.6.20:28052; | ||
| 16 | } | 47 | } |
| 17 | 48 | ||
| 18 | #error_page 404 /404.html; | ||
| 19 | 49 | ||
| 20 | # redirect server error pages to the static page /50x.html | ||
| 21 | # | ||
| 22 | error_page 500 502 503 504 /50x.html; | 50 | error_page 500 502 503 504 /50x.html; |
| 23 | location = /50x.html { | 51 | location = /50x.html { |
| 24 | root /usr/share/nginx/html; | 52 | root /usr/share/nginx/html; |
| 25 | } | 53 | } |
| 26 | |||
| 27 | # proxy the PHP scripts to Apache listening on 127.0.0.1:80 | ||
| 28 | # | ||
| 29 | #location ~ \.php$ { | ||
| 30 | # proxy_pass http://127.0.0.1; | ||
| 31 | #} | ||
| 32 | |||
| 33 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | ||
| 34 | # | ||
| 35 | #location ~ \.php$ { | ||
| 36 | # root html; | ||
| 37 | # fastcgi_pass 127.0.0.1:9000; | ||
| 38 | # fastcgi_index index.php; | ||
| 39 | # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; | ||
| 40 | # include fastcgi_params; | ||
| 41 | #} | ||
| 42 | |||
| 43 | # deny access to .htaccess files, if Apache's document root | ||
| 44 | # concurs with nginx's one | ||
| 45 | # | ||
| 46 | #location ~ /\.ht { | ||
| 47 | # deny all; | ||
| 48 | #} | ||
| 49 | } | 54 | } | ... | ... |
src/api/modules/dataAssetQuality.ts
0 → 100644
| 1 | /** --------------------- 质量评估模型 ------------------------------- */ | ||
| 2 | |||
| 3 | import request from "@/utils/request"; | ||
| 4 | |||
| 5 | /** 获取质量评估方案资产名称列表 */ | ||
| 6 | export const getQualityDamList = () => request({ | ||
| 7 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/dam-name-list`, | ||
| 8 | method: 'get' | ||
| 9 | }) | ||
| 10 | |||
| 11 | /** 获取质量评估列表 */ | ||
| 12 | export const getQualityList = (params) => request({ | ||
| 13 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/dam-list`, | ||
| 14 | method: 'post', | ||
| 15 | data: params | ||
| 16 | }) | ||
| 17 | |||
| 18 | /** 获取可选择的资产目录列表 */ | ||
| 19 | export const getDamList = () => request({ | ||
| 20 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/dam-catalog-table/dam-name-list`, | ||
| 21 | method: 'post', | ||
| 22 | data: {} | ||
| 23 | }) | ||
| 24 | |||
| 25 | /** 获取资产目录的表列表 */ | ||
| 26 | export const getDamTableList = (damGuid) => request({ | ||
| 27 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/dam-catalog-table/get-table-list?damGuid=${damGuid}`, | ||
| 28 | method: 'get' | ||
| 29 | }) | ||
| 30 | |||
| 31 | /** 获取资产目录表的详情 */ | ||
| 32 | export const getTableFields = (subjectGuid) => request({ | ||
| 33 | url:`${import.meta.env.VITE_API_ASSET_BASEURL}/dam-catalog-table/get-table-detail?subjectGuid=${subjectGuid}`, | ||
| 34 | method: 'get' | ||
| 35 | }); | ||
| 36 | |||
| 37 | /** 获取资产表的规则列表 */ | ||
| 38 | export const getDamTableRulesList = (params) => request({ | ||
| 39 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/list/rule-by-dam-guid`, | ||
| 40 | method: 'post', | ||
| 41 | data: params | ||
| 42 | }) | ||
| 43 | |||
| 44 | /** 批量新增资产表的规则 */ | ||
| 45 | export const saveDamTableRules = (params) => request({ | ||
| 46 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/add`, | ||
| 47 | method: 'post', | ||
| 48 | data: params | ||
| 49 | }) | ||
| 50 | |||
| 51 | /** 获取资产表的单个规则 */ | ||
| 52 | export const getRuleConfDetail = (param) => request({ | ||
| 53 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/conf/detail?ruleConfGuid=${param}`, | ||
| 54 | method: 'get' | ||
| 55 | }) | ||
| 56 | |||
| 57 | /** 获取对应执行方案的规则详情 */ | ||
| 58 | export const getRecordRuleConfDetail = (param) => request({ | ||
| 59 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model-record/conf/detail?ruleConfGuid=${param.ruleConfGuid}&planExecGuid=${param.planExecGuid}`, | ||
| 60 | method: 'get' | ||
| 61 | }); | ||
| 62 | |||
| 63 | /** 编辑资产表的单个规则 */ | ||
| 64 | export const updateDamTableRule = (params) => request({ | ||
| 65 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/conf/update`, | ||
| 66 | method: 'post', | ||
| 67 | data: params | ||
| 68 | }) | ||
| 69 | |||
| 70 | /** 删除资产表的单个规则 */ | ||
| 71 | export const deleteDamTableRule = (ruleConfGuid, planGuid: any = null) => request({ | ||
| 72 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/conf/del?ruleConfGuid=${ruleConfGuid}&planGuid=${planGuid}`, | ||
| 73 | method: 'delete' | ||
| 74 | }) | ||
| 75 | |||
| 76 | // 获取规则类型的接口 | ||
| 77 | export const getRuleTypeList = () => request({ | ||
| 78 | url:`${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-rule/list`, | ||
| 79 | method: 'post', | ||
| 80 | data: {} | ||
| 81 | }) | ||
| 82 | |||
| 83 | // 获取规则大类的接口 | ||
| 84 | export const getLargeCategoryList = () => request({ | ||
| 85 | url:`${import.meta.env.VITE_APP_API_BASEURL}/data-dict/get-data-list`, | ||
| 86 | method: 'post', | ||
| 87 | data: { paramCode: "LARGE-CATEGORY" } | ||
| 88 | }) | ||
| 89 | |||
| 90 | // 获取规则小类的接口 | ||
| 91 | export const getSmallCategoryList = () => request({ | ||
| 92 | url:`${import.meta.env.VITE_APP_API_BASEURL}/data-dict/get-data-list`, | ||
| 93 | method: 'post', | ||
| 94 | data: { paramCode: "SMALL-CATEGORY" } | ||
| 95 | }) | ||
| 96 | |||
| 97 | /** 表的逻辑条件和sql检验。 */ | ||
| 98 | export const validateSubjectTableRule = (params) => request({ | ||
| 99 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/sql-operate/check-sql`, | ||
| 100 | method: 'post', | ||
| 101 | data: params | ||
| 102 | }) | ||
| 103 | |||
| 104 | /** 自定义sql检验 */ | ||
| 105 | export const validateCustomSql = (params) => request({ | ||
| 106 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/conf/check-custom-sql`, | ||
| 107 | method: 'post', | ||
| 108 | data: params | ||
| 109 | }) | ||
| 110 | |||
| 111 | /** 批量验证过滤条件 */ | ||
| 112 | export const batchValidateSubjectTableRule = (params) => request({ | ||
| 113 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/sql-operate/batch-check-sql`, | ||
| 114 | method: 'post', | ||
| 115 | data: params | ||
| 116 | }) | ||
| 117 | |||
| 118 | /** ---------- 第二步,规则权重设置接口 ------ - */ | ||
| 119 | |||
| 120 | /** 获取规则大类统计 */ | ||
| 121 | export const getModelRuleCount = (params) => request({ | ||
| 122 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/list/model-rule-category-count`, | ||
| 123 | method: 'post', | ||
| 124 | data: params | ||
| 125 | }) | ||
| 126 | |||
| 127 | /** 保存质量评估方案 */ | ||
| 128 | export const saveQualityPlan = (params) => request({ | ||
| 129 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/add`, | ||
| 130 | method: 'post', | ||
| 131 | data: params | ||
| 132 | }) | ||
| 133 | |||
| 134 | /** 更新质量方案 */ | ||
| 135 | export const updateQualityPlan = (params) => request({ | ||
| 136 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/update`, | ||
| 137 | method: 'put', | ||
| 138 | data: params | ||
| 139 | }) | ||
| 140 | |||
| 141 | /** 删除质量方案 */ | ||
| 142 | export const deleteQualityPlan = (guids) => request({ | ||
| 143 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/del`, | ||
| 144 | method: 'delete', | ||
| 145 | data: guids | ||
| 146 | }) | ||
| 147 | |||
| 148 | /** 获取方案详情,用于编辑 */ | ||
| 149 | export const getPlanDetail = (params) => request({ | ||
| 150 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/detail/${params}`, | ||
| 151 | method: 'get' | ||
| 152 | }) | ||
| 153 | |||
| 154 | /** 获取方案详情中的过滤条件,用于编辑 */ | ||
| 155 | export const getPlanFilterDetail = (params) => request({ | ||
| 156 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/query-plan-filter?planGuid=${params}`, | ||
| 157 | method: 'get' | ||
| 158 | }) | ||
| 159 | |||
| 160 | /** 手动执行方案 */ | ||
| 161 | export const executePlan = (params) => request({ | ||
| 162 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/dam-exec-plan?planGuid=${params.planGuid}&reportGuid=${params.reportGuid}`, | ||
| 163 | method: 'post' | ||
| 164 | }) | ||
| 165 | |||
| 166 | /** 获取方案查看详情列表数据。 */ | ||
| 167 | export const getAssessDetailTableData = (params) => request({ | ||
| 168 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-analysis-report/page-exec-log-list`, | ||
| 169 | method: 'post', | ||
| 170 | data: params | ||
| 171 | }) | ||
| 172 | |||
| 173 | /** 根据执行guid,获取方案执行详情。 */ | ||
| 174 | export const getExecPlanDetailTableData = (params) => request({ | ||
| 175 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/query-exec-detail?&planExecGuid=${params.planExecGuid}`, | ||
| 176 | method: 'get' | ||
| 177 | }) | ||
| 178 | |||
| 179 | /** 获取方案详情中每个表的规则详细执行列表数据。 */ | ||
| 180 | export const getAssessTableRulesData = (params) => request({ | ||
| 181 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/query-exec-table-detail?planExecGuid=${params.planExecGuid}&qualityModelGuid=${params.qualityModelGuid}`, | ||
| 182 | method: 'get' | ||
| 183 | }) | ||
| 184 | |||
| 185 | /** 下载脏数据 */ | ||
| 186 | export const downloadDirtyData = (params) => request({ | ||
| 187 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/down-dirty-data`, | ||
| 188 | method: 'post', | ||
| 189 | data: params, | ||
| 190 | responseType: 'blob' | ||
| 191 | }) | ||
| 192 | |||
| 193 | /** html转word接口 */ | ||
| 194 | export const htmlToWord = (params) => request({ | ||
| 195 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-analysis-report/download/html-to-word`, | ||
| 196 | method: 'postJsonD', | ||
| 197 | data: params, | ||
| 198 | responseType: 'blob' | ||
| 199 | }); | ||
| 200 | |||
| 201 | /** 获取方案执行表规则查看 */ | ||
| 202 | export const getTableRuleDetail= (params) => request({ | ||
| 203 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-analysis-report/query-exec-table-rule-detail?reportExecGuid=${params}`, | ||
| 204 | method: 'get' | ||
| 205 | }); | ||
| 206 | |||
| 207 | /** 获取数据质量一级指标得分统计 */ | ||
| 208 | export const getLargeCategoryScore = (params) => request({ | ||
| 209 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-analysis-report/get-largeCategory-score?reportExecGuid=${params}`, | ||
| 210 | method: 'get' | ||
| 211 | }); | ||
| 212 | |||
| 213 | /** 获取质量分析报告的详细内容,根绝报告guid。 */ | ||
| 214 | export const getReportDetail = (params) => request({ | ||
| 215 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-analysis-report/get-report-data`, | ||
| 216 | method: 'post', | ||
| 217 | data: params | ||
| 218 | }); | ||
| 219 | |||
| 220 | /** 获取方案执行明细 */ | ||
| 221 | export const getPlanReportDetail= (params) => request({ | ||
| 222 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-analysis-report/query-exec-table-detail?reportExecGuid=${params.reportExecGuid}&planGuid=${params.planGuid}`, | ||
| 223 | method: 'get' | ||
| 224 | }); | ||
| 225 | |||
| 226 | /** 下载sql语句执行 */ | ||
| 227 | export const downPlanSql = (planGuid) => request({ | ||
| 228 | url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-plan/down-plan-sql?planGuid=${planGuid}`, | ||
| 229 | method: 'post', | ||
| 230 | responseType: 'blob' | ||
| 231 | }) |
src/api/modules/dataFinance.ts
0 → 100644
| 1 | import request from "@/utils/request"; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * 流通撮合 | ||
| 5 | **/ | ||
| 6 | |||
| 7 | /** 获取已添加的数据产品列表 */ | ||
| 8 | export const getMatchList = (params) => request({ | ||
| 9 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/circulation-matching/page-list`, | ||
| 10 | method: 'post', | ||
| 11 | data: params | ||
| 12 | }) | ||
| 13 | |||
| 14 | /** 获取撮合详情 */ | ||
| 15 | export const getMatchDetail = (params) => request({ | ||
| 16 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/circulation-matching/detail`, | ||
| 17 | method: 'get', | ||
| 18 | params | ||
| 19 | }) | ||
| 20 | |||
| 21 | /** 新增撮合信息 */ | ||
| 22 | export const matchSave = (params) => request({ | ||
| 23 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/circulation-matching/save`, | ||
| 24 | method: 'post', | ||
| 25 | data: params | ||
| 26 | }); | ||
| 27 | |||
| 28 | /** 更新撮合信息 */ | ||
| 29 | export const matchUpdate = (params) => request({ | ||
| 30 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/circulation-matching/update`, | ||
| 31 | method: 'post', | ||
| 32 | data: params | ||
| 33 | }); | ||
| 34 | |||
| 35 | /** 删除撮合信息 */ | ||
| 36 | export const matchDelete = (params) => request({ | ||
| 37 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/circulation-matching/delete`, | ||
| 38 | method: 'delete', | ||
| 39 | data: params | ||
| 40 | }); | ||
| 41 | |||
| 42 | /** 获取撮合日志 */ | ||
| 43 | export const getMatchLog = (params) => request({ | ||
| 44 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/circulation-matching/state-change-log-list`, | ||
| 45 | method: 'get', | ||
| 46 | params | ||
| 47 | }); | ||
| 48 | |||
| 49 | /** | ||
| 50 | * 金融产品 | ||
| 51 | **/ | ||
| 52 | /** 获取金融产品列表。 */ | ||
| 53 | export const getFinancialList = (params) => request({ | ||
| 54 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/financial-products/page-list`, | ||
| 55 | method: 'post', | ||
| 56 | data: params | ||
| 57 | }) | ||
| 58 | |||
| 59 | /** 获取金融产品详情 */ | ||
| 60 | export const getFinancialDetail = (params) => request({ | ||
| 61 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/financial-products/detail`, | ||
| 62 | method: 'get', | ||
| 63 | params | ||
| 64 | }) | ||
| 65 | |||
| 66 | /** 新增金融产品信息 */ | ||
| 67 | export const financialSave = (params) => request({ | ||
| 68 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/financial-products/save`, | ||
| 69 | method: 'post', | ||
| 70 | data: params | ||
| 71 | }); | ||
| 72 | |||
| 73 | /** 更新金融产品信息 */ | ||
| 74 | export const financialUpdate = (params) => request({ | ||
| 75 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/financial-products/update`, | ||
| 76 | method: 'post', | ||
| 77 | data: params | ||
| 78 | }); | ||
| 79 | |||
| 80 | /** 删除金融产品信息 */ | ||
| 81 | export const financialDelete = (params) => request({ | ||
| 82 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/financial-products/delete`, | ||
| 83 | method: 'delete', | ||
| 84 | data: params | ||
| 85 | }); | ||
| 86 | |||
| 87 | /** 更新金融产品上架状态 */ | ||
| 88 | export const financialUpdateStatus = (params) => request({ | ||
| 89 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/financial-products/update-listing-Status`, | ||
| 90 | method: 'post', | ||
| 91 | data: params | ||
| 92 | }); | ||
| 93 | |||
| 94 | /** 验证金融产品名称唯一性 */ | ||
| 95 | export const checkFinancialName = (params) => request({ | ||
| 96 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/financial-products/verify-data-name`, | ||
| 97 | method: 'get', | ||
| 98 | params | ||
| 99 | }) | ||
| 100 | |||
| 101 | // 数据要素乘 | ||
| 102 | export const orderStates = [{ | ||
| 103 | value: 'N', | ||
| 104 | label: '待沟通' | ||
| 105 | }, { | ||
| 106 | value: 'I', | ||
| 107 | label: '沟通中' | ||
| 108 | }, { | ||
| 109 | value: 'R', | ||
| 110 | label: '达成意向' | ||
| 111 | }, { | ||
| 112 | value: 'C', | ||
| 113 | label: '合同拟定' | ||
| 114 | }, { | ||
| 115 | value: 'S', | ||
| 116 | label: '合同签署' | ||
| 117 | }, { | ||
| 118 | value: 'P', | ||
| 119 | label: '合同执行中' | ||
| 120 | }, { | ||
| 121 | value: 'Y', | ||
| 122 | label: '合同执行完' | ||
| 123 | }, { | ||
| 124 | value: 'D', | ||
| 125 | label: '撮合关闭' | ||
| 126 | }] | ||
| 127 | |||
| 128 | export const filterVal = (val, type) => { | ||
| 129 | if(type == 'orderState'){ | ||
| 130 | const row = orderStates.filter(d => d.value == val); | ||
| 131 | return row.length?row[0].label:'--'; | ||
| 132 | } else if(type == 'tenantNature'){ | ||
| 133 | let approval = '--'; | ||
| 134 | switch (val) { | ||
| 135 | case 1: | ||
| 136 | approval = '数据字典数据治理'; | ||
| 137 | break; | ||
| 138 | case 2: | ||
| 139 | approval = '律师事务所'; | ||
| 140 | break; | ||
| 141 | case 3: | ||
| 142 | approval = '会计师事务所'; | ||
| 143 | break; | ||
| 144 | case 4: | ||
| 145 | approval = '金融机构'; | ||
| 146 | break; | ||
| 147 | case 5: | ||
| 148 | approval = '资产评估机构'; | ||
| 149 | break; | ||
| 150 | case 6: | ||
| 151 | approval = '申请数据资产化企业'; | ||
| 152 | break; | ||
| 153 | case 7: | ||
| 154 | approval = '其他'; | ||
| 155 | break; | ||
| 156 | default: | ||
| 157 | approval = '--'; | ||
| 158 | break; | ||
| 159 | } | ||
| 160 | return approval; | ||
| 161 | } | ||
| 162 | } | ||
| 163 | |||
| 164 | export const filterStatus = (row, type) => { | ||
| 165 | let state = 'info' | ||
| 166 | if (type == 'orderState') { | ||
| 167 | switch (row[type]) { | ||
| 168 | case "N": | ||
| 169 | state = 'warning' | ||
| 170 | break; | ||
| 171 | case "I": | ||
| 172 | state = 'warning' | ||
| 173 | break; | ||
| 174 | case "R": | ||
| 175 | state = "warning" | ||
| 176 | break | ||
| 177 | case "C": | ||
| 178 | state = "warning" | ||
| 179 | break | ||
| 180 | case "S": | ||
| 181 | state = "primary" | ||
| 182 | break | ||
| 183 | case "P": | ||
| 184 | state = "primary" | ||
| 185 | break | ||
| 186 | case "Y": | ||
| 187 | state = 'success'; | ||
| 188 | break; | ||
| 189 | case "D": | ||
| 190 | state = "info" | ||
| 191 | break | ||
| 192 | default: | ||
| 193 | state = "info" | ||
| 194 | break | ||
| 195 | } | ||
| 196 | } | ||
| 197 | return state; | ||
| 198 | } |
| ... | @@ -2,16 +2,174 @@ import request from "@/utils/request"; | ... | @@ -2,16 +2,174 @@ import request from "@/utils/request"; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | /** | 4 | /** |
| 5 | * 数据字典 | ||
| 6 | **/ | ||
| 7 | |||
| 8 | // 编码规则流水号 | ||
| 9 | export const getCoderuleList = (params) => request({ | ||
| 10 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/code-rule/list`, | ||
| 11 | method: 'post', | ||
| 12 | data: params | ||
| 13 | }) | ||
| 14 | // 获取数据类型的接口 | ||
| 15 | export const getDataTypeList = (params) => request({ | ||
| 16 | url: `${import.meta.env.VITE_APP_API_BASEURL}/data-dict/get-data-list`, | ||
| 17 | method: 'post', | ||
| 18 | data: params, | ||
| 19 | }) | ||
| 20 | // 获取数据库列表 | ||
| 21 | export const getDataBaseList = (params) => request({ | ||
| 22 | url: `${import.meta.env.VITE_APP_API_BASEURL}/data-source/get-source-list`, | ||
| 23 | method: 'post', | ||
| 24 | data: params, | ||
| 25 | }) | ||
| 26 | |||
| 27 | // 新增 | ||
| 28 | export const addDictionary = (params) => request({ | ||
| 29 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/add`, | ||
| 30 | method: 'post', | ||
| 31 | data: params | ||
| 32 | }) | ||
| 33 | // 删除 | ||
| 34 | export const deleteDictionary = (params) => request({ | ||
| 35 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/del`, | ||
| 36 | method: 'delete', | ||
| 37 | data: params | ||
| 38 | }) | ||
| 39 | // 删除数据字典前的校验 | ||
| 40 | export const checkDeleteDictionary = (params) => request({ | ||
| 41 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/check-del`, | ||
| 42 | method: 'delete', | ||
| 43 | data: params | ||
| 44 | }) | ||
| 45 | // 编辑校验数据结构删除的条件 | ||
| 46 | export const checkDeleteDictionaryScheme = (params) => request({ | ||
| 47 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/check-del/dictionary-scheme`, | ||
| 48 | method: 'post', | ||
| 49 | data: params | ||
| 50 | }) | ||
| 51 | // 分页查询 | ||
| 52 | // export const getDictionary = (params) => request({ | ||
| 53 | // url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/page-list`, | ||
| 54 | // method: 'post', | ||
| 55 | // data: params | ||
| 56 | // }) | ||
| 57 | // 查询数据字典启用状态的数据 | ||
| 58 | export const getDictionaryAll = (params) => request({ | ||
| 59 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/list-all`, | ||
| 60 | method: 'post', | ||
| 61 | params | ||
| 62 | }) | ||
| 63 | // 修改 | ||
| 64 | export const updateDictionary = (params) => request({ | ||
| 65 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/update`, | ||
| 66 | method: 'put', | ||
| 67 | data: params | ||
| 68 | }) | ||
| 69 | // 详情 | ||
| 70 | export const getDictionaryDetail = (params) => request({ | ||
| 71 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/detail/${params}`, | ||
| 72 | method: 'get' | ||
| 73 | }) | ||
| 74 | // 查看数据字典数据 | ||
| 75 | export const getDictionaryFileds = (params) => request({ | ||
| 76 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/dictionary-data/${params}`, | ||
| 77 | method: 'get' | ||
| 78 | }) | ||
| 79 | // 数据字典启用停用 | ||
| 80 | export const updateDictionaryState = (params) => request({ | ||
| 81 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/change-state`, | ||
| 82 | method: 'get', | ||
| 83 | params | ||
| 84 | }) | ||
| 85 | // 检验是否存在 | ||
| 86 | export const checkDictionary = (params) => request({ | ||
| 87 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/check-exist`, | ||
| 88 | method: 'get', | ||
| 89 | params | ||
| 90 | }) | ||
| 91 | // 数据字典新增数据时生成编码规则 | ||
| 92 | export const getDictionaryRuleData = (params) => request({ | ||
| 93 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/generate/code-rule/byGuid`, | ||
| 94 | method: 'get', | ||
| 95 | params | ||
| 96 | }) | ||
| 97 | // 数据字典树形数据 | ||
| 98 | export const getDictionaryTree = (params) => request({ | ||
| 99 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/tree-list`, | ||
| 100 | method: 'post', | ||
| 101 | params | ||
| 102 | }) | ||
| 103 | // 保存动态数据字典数据 | ||
| 104 | export const saveDictionaryData = (params) => request({ | ||
| 105 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/save/dictionary-data`, | ||
| 106 | method: 'post', | ||
| 107 | data: params | ||
| 108 | }) | ||
| 109 | // 更新数据字典数据 | ||
| 110 | export const updateDictionaryData = (params) => request({ | ||
| 111 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/update/dictionary-data`, | ||
| 112 | method: 'post', | ||
| 113 | data: params | ||
| 114 | }) | ||
| 115 | // 删除数据字典数据 | ||
| 116 | export const deleteDictionaryData = (params) => request({ | ||
| 117 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/del/dictionary-data`, | ||
| 118 | method: 'delete', | ||
| 119 | data: params | ||
| 120 | }) | ||
| 121 | // 导入数据字典 | ||
| 122 | export const importDictionary = (params) => request({ | ||
| 123 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/import/data-dictionary`, | ||
| 124 | method: 'post', | ||
| 125 | data: params | ||
| 126 | }) | ||
| 127 | // 显示导入的数据字典数据 | ||
| 128 | export const showDictionary = (params) => request({ | ||
| 129 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/import/show/data-dictionary`, | ||
| 130 | method: 'post', | ||
| 131 | data: params, | ||
| 132 | headers: { | ||
| 133 | 'Content-Type': 'multipart/form-data' | ||
| 134 | } | ||
| 135 | }) | ||
| 136 | // 导出数据字典模板 | ||
| 137 | export const exportDictionary = (params) => request({ | ||
| 138 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/export/data-dictionary/schema`, | ||
| 139 | method: 'post', | ||
| 140 | data: params, | ||
| 141 | responseType: 'blob' | ||
| 142 | }) | ||
| 143 | // 导出数据字典数据 | ||
| 144 | export const exportDictionaryFileds = (params) => request({ | ||
| 145 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/export/data-dictionary/data`, | ||
| 146 | method: 'post', | ||
| 147 | data: params, | ||
| 148 | responseType: 'blob' | ||
| 149 | }) | ||
| 150 | // 验证数据是否符合标准 | ||
| 151 | export const checkDictionaryData = (params) => request({ | ||
| 152 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/check/dictionary-data`, | ||
| 153 | method: 'post', | ||
| 154 | data: params | ||
| 155 | }) | ||
| 156 | |||
| 157 | |||
| 158 | /** | ||
| 5 | * 获取数据级别 | 159 | * 获取数据级别 |
| 6 | * @param {Object} | 160 | * @param {Object} |
| 7 | * { paramCode: "DATA-CLASSIFY" } | 161 | * { paramCode: "DATA-CLASSIFY" } |
| 8 | * DATA-CLASSIFY 数据类别 | 162 | * DATA-CLASSIFY 数据类别 |
| 9 | * DATA-GRADE 数据级别 | 163 | * DATA-GRADE 数据级别 |
| 10 | */ | 164 | */ |
| 11 | export const getLargeCategoryList = (data) => request({ | 165 | // export const getLargeCategoryList = (data) => request({ |
| 12 | url:`${import.meta.env.VITE_APP_API_BASEURL}/data-dict/get-data-list`, | 166 | // url:`${import.meta.env.VITE_APP_API_BASEURL}/data-dict/get-data-list`, |
| 13 | method: 'post', | 167 | // method: 'post', |
| 14 | data | 168 | // data |
| 169 | // }) | ||
| 170 | export const getLargeCategoryList = (params) => request({ | ||
| 171 | url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-by-dictType?dictType=${params.dictType}`, | ||
| 172 | method: 'get', | ||
| 15 | }) | 173 | }) |
| 16 | 174 | ||
| 17 | 175 | ||
| ... | @@ -213,6 +371,18 @@ export const getCgTemplateClassifyTreeList = (data) => request({ | ... | @@ -213,6 +371,18 @@ export const getCgTemplateClassifyTreeList = (data) => request({ |
| 213 | 371 | ||
| 214 | 372 | ||
| 215 | /**-------------------------分类分级目录--------------------------------- */ | 373 | /**-------------------------分类分级目录--------------------------------- */ |
| 374 | /** | ||
| 375 | * 查询执行guid和目录名称 | ||
| 376 | * @param {no params} | ||
| 377 | * @path /cg-dir/get-exec-guid-and-name | ||
| 378 | */ | ||
| 379 | export const getExecGuidAndName = () => request({ | ||
| 380 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/cg-dir/get-exec-guid-and-name`, | ||
| 381 | method: 'post', | ||
| 382 | }) | ||
| 383 | |||
| 384 | |||
| 385 | |||
| 216 | 386 | ||
| 217 | /** | 387 | /** |
| 218 | * 分类分级目录树形列表 | 388 | * 分类分级目录树形列表 |
| ... | @@ -390,3 +560,152 @@ export const filterVal = (val, type) => { | ... | @@ -390,3 +560,152 @@ export const filterVal = (val, type) => { |
| 390 | } | 560 | } |
| 391 | return status; | 561 | return status; |
| 392 | } | 562 | } |
| 563 | |||
| 564 | /** 获取字典列表 | ||
| 565 | * VITE_APP_PLAN_BASEURL 为环境变量 现在只是mock数据 | ||
| 566 | */ | ||
| 567 | export const getDictionary = (params) => request({ | ||
| 568 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/data-dictionary-general/list-all?state=1`, | ||
| 569 | method: 'post' | ||
| 570 | }) | ||
| 571 | |||
| 572 | |||
| 573 | |||
| 574 | /** 业务规则配置-新增 | ||
| 575 | * @param {Object} | ||
| 576 | * @path /biz-rule-config/save | ||
| 577 | */ | ||
| 578 | export const saveBizRuleConfig = (data) => request({ | ||
| 579 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/save`, | ||
| 580 | method: 'post', | ||
| 581 | data | ||
| 582 | }) | ||
| 583 | |||
| 584 | |||
| 585 | /**树形目录 | ||
| 586 | * @param {Object} | ||
| 587 | * @path /db-dir/tree-list | ||
| 588 | */ | ||
| 589 | export const getDbDirTreeList = (data) => request({ | ||
| 590 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/tree-list`, | ||
| 591 | method: 'post', | ||
| 592 | data | ||
| 593 | }) | ||
| 594 | |||
| 595 | /** | ||
| 596 | * 数据库目录-表数据列表查询 | ||
| 597 | * @param {Object} | ||
| 598 | * @path /db-dir/table/page-list | ||
| 599 | */ | ||
| 600 | export const getDbDirTablePageList = (data) => request({ | ||
| 601 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/page-list`, | ||
| 602 | method: 'post', | ||
| 603 | data | ||
| 604 | }) | ||
| 605 | |||
| 606 | /** | ||
| 607 | * 数据库目录-已有数据库列表 | ||
| 608 | * @param {no params} | ||
| 609 | * @path /db-dir/data-source/list | ||
| 610 | */ | ||
| 611 | export const getDbDirDataSourceList = (params) => request({ | ||
| 612 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/data-source/list?execGuid=${params.execGuid}`, | ||
| 613 | method: 'post', | ||
| 614 | }) | ||
| 615 | |||
| 616 | /** | ||
| 617 | * 获取列表 | ||
| 618 | * @param {Object} | ||
| 619 | * @path /db-dir/field/page-list | ||
| 620 | * @returns | ||
| 621 | */ | ||
| 622 | export const getDbDirFieldPageList = (data) => request({ | ||
| 623 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/page-list`, | ||
| 624 | method: 'post', | ||
| 625 | data | ||
| 626 | }) | ||
| 627 | |||
| 628 | |||
| 629 | |||
| 630 | /** 获取已有字段信息 */ | ||
| 631 | export const getDsTableStructure= (data) => request({ | ||
| 632 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guid`, | ||
| 633 | method: 'post', | ||
| 634 | data | ||
| 635 | }); | ||
| 636 | |||
| 637 | /** 根据选择的连接池获取表列表 */ | ||
| 638 | export const getDsTableByDs = (params) => request({ | ||
| 639 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/list-by-datasource-guid`, | ||
| 640 | method: 'post', | ||
| 641 | data: params | ||
| 642 | }) | ||
| 643 | |||
| 644 | /** 根据数据表获取表结构 */ | ||
| 645 | export const getDsData= (params) => request({ | ||
| 646 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/table-column-list`, | ||
| 647 | method: 'post', | ||
| 648 | data: params | ||
| 649 | }); | ||
| 650 | |||
| 651 | |||
| 652 | /** | ||
| 653 | * 数据库新建目录表 | ||
| 654 | * @param {Object} | ||
| 655 | * @path /db-dir/table/save | ||
| 656 | */ | ||
| 657 | export const saveDbDirTable = (data) => request({ | ||
| 658 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/save`, | ||
| 659 | method: 'post', | ||
| 660 | data | ||
| 661 | }) | ||
| 662 | |||
| 663 | /** | ||
| 664 | * 数据库目录修改表 | ||
| 665 | * @param {Object} | ||
| 666 | * @path /db-dir/table/update | ||
| 667 | */ | ||
| 668 | export const updateDbDirTable = (data) => request({ | ||
| 669 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/update`, | ||
| 670 | method: 'post', | ||
| 671 | data | ||
| 672 | }) | ||
| 673 | |||
| 674 | /** | ||
| 675 | * 生成建表sql语句 | ||
| 676 | * @param {Object} | ||
| 677 | * @path /db-dir/table/create-table-sql | ||
| 678 | */ | ||
| 679 | export const createTableSql = (data) => request({ | ||
| 680 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/create-table-sql`, | ||
| 681 | method: 'post', | ||
| 682 | data | ||
| 683 | }) | ||
| 684 | |||
| 685 | |||
| 686 | |||
| 687 | |||
| 688 | /*********************业务规则配置 ************数据库目录************************* */ | ||
| 689 | |||
| 690 | /** | ||
| 691 | * 业务规则配置-详情 | ||
| 692 | * @param {Object} | ||
| 693 | * @path /biz-rule-config/detail | ||
| 694 | * @returns | ||
| 695 | */ | ||
| 696 | export const getBizRuleConfigDetail = (params) => request({ | ||
| 697 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/detail?tableGuid=${params.tableGuid}&execGuid=${params.execGuid}`, | ||
| 698 | method: 'get', | ||
| 699 | }) | ||
| 700 | |||
| 701 | /** | ||
| 702 | * 业务规则配置-修改 | ||
| 703 | * @param {Object} | ||
| 704 | * @path /biz-rule-config/update | ||
| 705 | * @returns | ||
| 706 | */ | ||
| 707 | export const updateBizRuleConfig = (data) => request({ | ||
| 708 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/update`, | ||
| 709 | method: 'post', | ||
| 710 | data | ||
| 711 | }) | ... | ... |
| ... | @@ -17,10 +17,11 @@ export const deleteMetaDataTask = (params) => request({ | ... | @@ -17,10 +17,11 @@ export const deleteMetaDataTask = (params) => request({ |
| 17 | }) | 17 | }) |
| 18 | // 分页查询 | 18 | // 分页查询 |
| 19 | export const getMetaDataTask = (params) => request({ | 19 | export const getMetaDataTask = (params) => request({ |
| 20 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-collect-task/page-list`, | 20 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/meta-collect-task/page-list`, |
| 21 | method: 'post', | 21 | method: 'post', |
| 22 | data: params | 22 | data: params |
| 23 | }) | 23 | }) |
| 24 | |||
| 24 | // 修改 | 25 | // 修改 |
| 25 | export const updateMetaDataTask = (params) => request({ | 26 | export const updateMetaDataTask = (params) => request({ |
| 26 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-collect-task/update`, | 27 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-collect-task/update`, |
| ... | @@ -92,7 +93,7 @@ export const getMetaDataSheet = (params) => request({ | ... | @@ -92,7 +93,7 @@ export const getMetaDataSheet = (params) => request({ |
| 92 | }) | 93 | }) |
| 93 | // 表字段查询 | 94 | // 表字段查询 |
| 94 | export const getMetaSheetField = (params) => request({ | 95 | export const getMetaSheetField = (params) => request({ |
| 95 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-table/meta-table-field-list`, | 96 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/meta-table/meta-table-field-list`, |
| 96 | method: 'post', | 97 | method: 'post', |
| 97 | params | 98 | params |
| 98 | }) | 99 | }) | ... | ... |
src/api/modules/dataPartners.ts
0 → 100644
| 1 | import request from "@/utils/request"; | ||
| 2 | |||
| 3 | /** 校验公司名称是否重复 */ | ||
| 4 | export const checkCompanyName = (params) => request({ | ||
| 5 | url: `${import.meta.env.VITE_API_PORTALURL}/portal/cooperate-register/verify-company-name`, | ||
| 6 | method: 'get', | ||
| 7 | params | ||
| 8 | }) | ||
| 9 | |||
| 10 | /** 获取短信验证码 */ | ||
| 11 | export const getRegisterCode = (params) => request({ | ||
| 12 | url: `${import.meta.env.VITE_API_PORTALURL}/portal/sms/get-verify-code`, | ||
| 13 | method: 'post', | ||
| 14 | params | ||
| 15 | }) | ||
| 16 | |||
| 17 | /** 校验短信验证码 */ | ||
| 18 | export const checkRegisterCode = (params) => request({ | ||
| 19 | url: `${import.meta.env.VITE_API_PORTALURL}/portal/sms/get-verify-code-validation`, | ||
| 20 | method: 'post', | ||
| 21 | params | ||
| 22 | }) | ||
| 23 | |||
| 24 | /** 注册信息申请 */ | ||
| 25 | export const registerInfoSave = (params) => request({ | ||
| 26 | url: `${import.meta.env.VITE_API_PORTALURL}/portal/cooperate/save`, | ||
| 27 | method: 'post', | ||
| 28 | data: params | ||
| 29 | }); | ||
| 30 | |||
| 31 | /** 获取注册信息列表。 */ | ||
| 32 | export const getRegisterInfoList = (params) => request({ | ||
| 33 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/cooperate-register/page-list`, | ||
| 34 | method: 'post', | ||
| 35 | data: params | ||
| 36 | }) | ||
| 37 | |||
| 38 | /** 获取注册信息详情 */ | ||
| 39 | export const getRegiaterInfoDetail = (params) => request({ | ||
| 40 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/cooperate-register/detail`, | ||
| 41 | method: 'get', | ||
| 42 | params | ||
| 43 | }) | ||
| 44 | |||
| 45 | /** 更新注册信息 */ | ||
| 46 | export const registerInfoUpdate = (params) => request({ | ||
| 47 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/cooperate-register/update`, | ||
| 48 | method: 'post', | ||
| 49 | data: params | ||
| 50 | }); | ||
| 51 | |||
| 52 | /** 删除注册信息 */ | ||
| 53 | export const registerInfoDelete = (params) => request({ | ||
| 54 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/cooperate-register/delete`, | ||
| 55 | method: 'delete', | ||
| 56 | data: params | ||
| 57 | }); | ||
| 58 | |||
| 59 | /** 验证管理员账号是否重复 */ | ||
| 60 | export const checkAccount = (params) => request({ | ||
| 61 | url: `${import.meta.env.VITE_API_ASSET_BASEURL}/cooperate-register/verify-admin-account`, | ||
| 62 | method: 'get', | ||
| 63 | params | ||
| 64 | }) | ||
| 65 | |||
| 66 | /** 获取登录日志 */ | ||
| 67 | export const getAccountLog = (params) => request({ | ||
| 68 | url: `${import.meta.env.VITE_APP_API_BASEURL}/user/user-login-record`, | ||
| 69 | method: 'post', | ||
| 70 | data: params | ||
| 71 | }) | ||
| 72 | |||
| 73 | |||
| 74 | /** 获取图形验证码 **/ | ||
| 75 | export const getImgCodeSrc = (params={}) => request({ | ||
| 76 | url: `${import.meta.env.VITE_API_PORTALURL}/portal/get-captcha`, | ||
| 77 | method: 'get', | ||
| 78 | params | ||
| 79 | }) | ||
| 80 | |||
| 81 | /** 校验图形验证码 **/ | ||
| 82 | export const checkImgCode = (params={}) => request({ | ||
| 83 | url: `${import.meta.env.VITE_API_PORTALURL}/portal/check`, | ||
| 84 | method: 'post', | ||
| 85 | params | ||
| 86 | }) |
| ... | @@ -2,18 +2,622 @@ import type { MockMethod } from 'vite-plugin-mock' | ... | @@ -2,18 +2,622 @@ import type { MockMethod } from 'vite-plugin-mock' |
| 2 | import Mock from 'mockjs' | 2 | import Mock from 'mockjs' |
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | export const confirmDelivery = { | 5 | /** |
| 6 | url: '/mock/youthBoost/admin/shipment', | 6 | * { |
| 7 | "children": [ | ||
| 8 | { | ||
| 9 | "parentGuids": [ | ||
| 10 | "string" | ||
| 11 | ] | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "parentGuids": [ | ||
| 15 | "string" | ||
| 16 | ], | ||
| 17 | "guid": "string", | ||
| 18 | "tenantGuid": "string", | ||
| 19 | "cgDirName": "string", | ||
| 20 | "classifyName": "string", | ||
| 21 | "orderNum": 0, | ||
| 22 | "level": 0, | ||
| 23 | "levelCode": "string", | ||
| 24 | "parentGuid": "string" | ||
| 25 | } | ||
| 26 | */ | ||
| 27 | export const getCgDirTreeList = { | ||
| 28 | url: '/mock/cg-dir/tree-list', | ||
| 29 | method: 'post', | ||
| 30 | response: ({body}:{body:any}) => { | ||
| 31 | |||
| 32 | return { | ||
| 33 | code: '00000', | ||
| 34 | message: '成功', | ||
| 35 | 'data|10-30': [{ | ||
| 36 | guid: '@guid', | ||
| 37 | tenantGuid: '@guid', | ||
| 38 | cgDirName: '@cword(3, 10)', | ||
| 39 | classifyName: '@cword(3, 5)', | ||
| 40 | orderNum: '@integer(1, 100)', | ||
| 41 | level: '@integer(1, 3)', | ||
| 42 | levelCode: '@string("number", 6)', | ||
| 43 | parentGuid: '@guid', | ||
| 44 | 'parentGuids|1-2': ['@guid'], | ||
| 45 | 'children|0-3': [{ | ||
| 46 | guid: '@guid', | ||
| 47 | tenantGuid: '@guid', | ||
| 48 | cgDirName: '@cword(3, 5)', | ||
| 49 | classifyName: '@cword(3, 5)', | ||
| 50 | orderNum: '@integer(1, 100)', | ||
| 51 | level: '@integer(1, 3)', | ||
| 52 | levelCode: '@string("number", 6)', | ||
| 53 | parentGuid: '@guid', | ||
| 54 | 'parentGuids|1-2': ['@guid'] | ||
| 55 | }] | ||
| 56 | }] | ||
| 57 | } | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | /** | ||
| 62 | * "data": { | ||
| 63 | "totalRows": 0, | ||
| 64 | "totalPages": 0, | ||
| 65 | "pageSize": 0, | ||
| 66 | "pageIndex": 0, | ||
| 67 | "records": [ | ||
| 68 | { | ||
| 69 | "guid": "string", | ||
| 70 | "tenantGuid": "string", | ||
| 71 | "cgDirName": "string", | ||
| 72 | "dirGuid": "string", | ||
| 73 | "classifyName": "string", | ||
| 74 | "gradeDetailName": "string", | ||
| 75 | "label": "string", | ||
| 76 | "fieldName": "string", | ||
| 77 | "fieldChName": "string", | ||
| 78 | "tableName": "string", | ||
| 79 | "tableChName": "string", | ||
| 80 | "database": "string", | ||
| 81 | "databaseChName": "string" | ||
| 82 | } | ||
| 83 | ], | ||
| 84 | export const getCgDirFieldPageList = (data) => request({ | ||
| 85 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/cg-dir/field/page-list`, | ||
| 86 | method: 'post', | ||
| 87 | data | ||
| 88 | }) | ||
| 89 | */ | ||
| 90 | |||
| 91 | export const getCgDirFieldPageList = { | ||
| 92 | url: '/mock/cg-dir/field/page-list', | ||
| 93 | method: 'post', | ||
| 94 | response: ({body}:{body:any}) => { | ||
| 95 | return { | ||
| 96 | code: '00000', | ||
| 97 | message: '成功', | ||
| 98 | 'data': { | ||
| 99 | totalRows: '@integer(50, 100)', | ||
| 100 | totalPages: '@integer(1, 10)', | ||
| 101 | pageSize: 10, | ||
| 102 | pageIndex: 1, | ||
| 103 | 'records|20-30': [{ | ||
| 104 | guid: '@guid', | ||
| 105 | tenantGuid: '@guid', | ||
| 106 | cgDirName: '@cword(3, 5)', | ||
| 107 | dirGuid: '@guid', | ||
| 108 | classifyName: '@cword(3, 5)', | ||
| 109 | gradeDetailName: '@cword(3, 5)', | ||
| 110 | label: '@cword(3, 5)', | ||
| 111 | fieldName: '@cword(3, 5)', | ||
| 112 | fieldChName: '@cword(3, 5)', | ||
| 113 | tableName: '@cword(3, 5)', | ||
| 114 | tableChName: '@cword(3, 5)', | ||
| 115 | database: '@cword(3, 5)', | ||
| 116 | databaseChName: '@cword(3, 5)' | ||
| 117 | }] | ||
| 118 | } | ||
| 119 | } | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | /** | ||
| 124 | * | ||
| 125 | * export const getDictionary = (params) => request({ | ||
| 126 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/list-all?state=1`, | ||
| 127 | method: 'post' | ||
| 128 | }) | ||
| 129 | */ | ||
| 130 | |||
| 131 | export const getDictionary = { | ||
| 132 | url: '/mock/data-dictionary-general/list-all', | ||
| 133 | method: 'post', | ||
| 134 | response: ({body}:{body:any}) => { | ||
| 135 | return { | ||
| 136 | code: '00000', | ||
| 137 | message: '成功', | ||
| 138 | 'data|10-30': [{ | ||
| 139 | guid: '@guid', | ||
| 140 | tenantGuid: '@guid', | ||
| 141 | chName: '@cword(3, 5)', | ||
| 142 | classifyName: '@cword(3, 5)', | ||
| 143 | orderNum: '@integer(1, 100)', | ||
| 144 | level: '@integer(1, 3)', | ||
| 145 | levelCode: '@string("number", 6)', | ||
| 146 | parentGuid: '@guid', | ||
| 147 | 'parentGuids|1-2': ['@guid'], | ||
| 148 | 'children|0-3': [{ | ||
| 149 | guid: '@guid', | ||
| 150 | tenantGuid: '@guid', | ||
| 151 | chName: '@cword(3, 5)', | ||
| 152 | classifyName: '@cword(3, 5)', | ||
| 153 | orderNum: '@integer(1, 100)', | ||
| 154 | level: '@integer(1, 3)', | ||
| 155 | levelCode: '@string("number", 6)', | ||
| 156 | parentGuid: '@guid', | ||
| 157 | 'parentGuids|1-2': ['@guid'] | ||
| 158 | }] | ||
| 159 | }] | ||
| 160 | } | ||
| 161 | } | ||
| 162 | } | ||
| 163 | |||
| 164 | export const saveBizRuleConfig = { | ||
| 165 | url: '/mock/biz-rule-config/save', | ||
| 166 | method: 'post', | ||
| 167 | response: ({body}:{body:any}) => { | ||
| 168 | return { | ||
| 169 | code: '00000', | ||
| 170 | message: '成功' | ||
| 171 | } | ||
| 172 | } | ||
| 173 | } | ||
| 174 | |||
| 175 | /** | ||
| 176 | * "data": [ | ||
| 177 | { | ||
| 178 | "cgDirName": "string", | ||
| 179 | "childList": [ | ||
| 180 | { | ||
| 181 | "databaseGuid": "string", | ||
| 182 | "database": "string", | ||
| 183 | "databaseChName": "string", | ||
| 184 | "childList": [ | ||
| 185 | { | ||
| 186 | "tableGuid": "string", | ||
| 187 | "tableName": "string", | ||
| 188 | "tableChName": "string" | ||
| 189 | } | ||
| 190 | ] | ||
| 191 | } | ||
| 192 | ] | ||
| 193 | } | ||
| 194 | ], | ||
| 195 | export const getDbDirTreeList = (data) => request({ | ||
| 196 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/tree-list`, | ||
| 197 | method: 'post', | ||
| 198 | data | ||
| 199 | }) | ||
| 200 | */ | ||
| 201 | |||
| 202 | export const getDbDirTreeList = { | ||
| 203 | url: '/mock/db-dir/tree-list', | ||
| 7 | method: 'post', | 204 | method: 'post', |
| 8 | response: ({body}:{body:any}) => { | 205 | response: ({body}:{body:any}) => { |
| 206 | return { | ||
| 207 | code: '00000', | ||
| 208 | message: '成功', | ||
| 209 | 'data|10-30': [{ | ||
| 210 | cgDirName: '@cword(3, 5)', | ||
| 211 | 'children|1-3': [{ | ||
| 212 | databaseGuid: '@guid', | ||
| 213 | database: '@cword(3, 5)', | ||
| 214 | databaseChName: '@cword(3, 5)', | ||
| 215 | 'children|1-3': [{ | ||
| 216 | tableGuid: '@guid', | ||
| 217 | tableName: '@cword(3, 5)', | ||
| 218 | tableChName: '@cword(3, 5)' | ||
| 219 | }] | ||
| 220 | }] | ||
| 221 | }] | ||
| 222 | } | ||
| 223 | } | ||
| 224 | } | ||
| 225 | |||
| 226 | /** | ||
| 227 | * /** | ||
| 228 | * 数据库目录-表数据列表查询 | ||
| 229 | * @param {Object} | ||
| 230 | * @path /db-dir/table/page-list | ||
| 231 | * export const getDbDirTablePageList = (data) => request({ | ||
| 232 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/page-list`, | ||
| 233 | method: 'post', | ||
| 234 | data | ||
| 235 | }) | ||
| 236 | "data": { | ||
| 237 | "totalRows": 0, | ||
| 238 | "totalPages": 0, | ||
| 239 | "pageSize": 0, | ||
| 240 | "pageIndex": 0, | ||
| 241 | "records": [ | ||
| 242 | { | ||
| 243 | "guid": "string", | ||
| 244 | "tenantGuid": "string", | ||
| 245 | "cgDirName": "string", | ||
| 246 | "dirGuid": "string", | ||
| 247 | "tableGuid": "string", | ||
| 248 | "tableName": "string", | ||
| 249 | "tableChName": "string", | ||
| 250 | "databaseGuid": "string", | ||
| 251 | "database": "string", | ||
| 252 | "databaseChName": "string", | ||
| 253 | "foundMode": 0, | ||
| 254 | "state": 0, | ||
| 255 | "isDataAsset": "string" | ||
| 256 | } | ||
| 257 | ], | ||
| 258 | } | ||
| 259 | */ | ||
| 9 | 260 | ||
| 261 | export const getDbDirTablePageList = { | ||
| 262 | url: '/mock/db-dir/table/page-list', | ||
| 263 | method: 'post', | ||
| 264 | response: ({body}:{body:any}) => { | ||
| 265 | const {pageIndex, pageSize} = body | ||
| 10 | return { | 266 | return { |
| 11 | code: 200, | 267 | code: '00000', |
| 12 | message: '成功', | 268 | message: '成功', |
| 13 | data: [] | 269 | 'data': { |
| 270 | totalRows: '@integer(50, 100)', | ||
| 271 | totalPages: '@integer(1, 10)', | ||
| 272 | pageSize, | ||
| 273 | pageIndex, | ||
| 274 | 'records|20-30': [{ | ||
| 275 | guid: '@guid', | ||
| 276 | tenantGuid: '@guid', | ||
| 277 | cgDirName: '@cword(3, 5)', | ||
| 278 | dirGuid: '@guid', | ||
| 279 | tableGuid: '@guid', | ||
| 280 | tableName: '@cword(3, 5)', | ||
| 281 | tableChName: '@cword(3, 5)', | ||
| 282 | databaseGuid: '@guid', | ||
| 283 | database: '@cword(3, 5)', | ||
| 284 | databaseChName: '@cword(3, 5)', | ||
| 285 | foundMode: '@integer(1, 3)', | ||
| 286 | state: '@integer(0,2)', | ||
| 287 | isDataAsset: 'Y', | ||
| 288 | description: '@cword(10, 15)', | ||
| 289 | }] | ||
| 290 | } | ||
| 14 | } | 291 | } |
| 15 | } | 292 | } |
| 16 | } | 293 | } |
| 17 | 294 | ||
| 295 | /** | ||
| 296 | * export const getDbDirDataSourceList = () => request({ | ||
| 297 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/data-source/list`, | ||
| 298 | method: 'post', | ||
| 299 | }) | ||
| 300 | "data": [ | ||
| 301 | { | ||
| 302 | "tableGuid": "string", | ||
| 303 | "tableName": "string", | ||
| 304 | "tableChName": "string", | ||
| 305 | "databaseGuid": "string", | ||
| 306 | "database": "string", | ||
| 307 | "databaseChName": "string" | ||
| 308 | } | ||
| 309 | ], | ||
| 310 | */ | ||
| 311 | |||
| 312 | export const getDbDirDataSourceList = { | ||
| 313 | url: '/mock/db-dir/data-source/list', | ||
| 314 | method: 'post', | ||
| 315 | response: ({body}:{body:any}) => { | ||
| 316 | return { | ||
| 317 | code: '00000', | ||
| 318 | message: '成功', | ||
| 319 | 'data|10-30': [{ | ||
| 320 | tableGuid: '@guid', | ||
| 321 | tableName: '@cword(3, 5)', | ||
| 322 | tableChName: '@cword(3, 5)', | ||
| 323 | databaseGuid: '@guid', | ||
| 324 | database: '@cword(3, 5)', | ||
| 325 | databaseChName: '@cword(3, 5)' | ||
| 326 | }] | ||
| 327 | } | ||
| 328 | } | ||
| 329 | } | ||
| 330 | |||
| 331 | /** | ||
| 332 | * export const getDsData = (params) => request({ | ||
| 333 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/list-by-datasource-guid`, | ||
| 334 | method: 'post', | ||
| 335 | data: params | ||
| 336 | }); | ||
| 337 | "data": { | ||
| 338 | "totalRows": 0, | ||
| 339 | "totalPages": 0, | ||
| 340 | "pageSize": 0, | ||
| 341 | "pageIndex": 0, | ||
| 342 | "records": [ | ||
| 343 | { | ||
| 344 | "tableGuid": "string", | ||
| 345 | "tableName": "string", | ||
| 346 | "tableChName": "string", | ||
| 347 | "databaseGuid": "string", | ||
| 348 | "database": "string", | ||
| 349 | "databaseChName": "string" | ||
| 350 | } | ||
| 351 | ], | ||
| 352 | */ | ||
| 353 | |||
| 354 | export const getDsTableByDs = { | ||
| 355 | url: '/mock/db-dir/table/list-by-datasource-guid', | ||
| 356 | method: 'post', | ||
| 357 | response: ({body}:{body:any}) => { | ||
| 358 | return { | ||
| 359 | code: '00000', | ||
| 360 | message: '成功', | ||
| 361 | 'data': { | ||
| 362 | totalRows: '@integer(50, 100)', | ||
| 363 | totalPages: '@integer(1, 10)', | ||
| 364 | pageSize: 10, | ||
| 365 | pageIndex: 1, | ||
| 366 | 'records|50-100': [{ | ||
| 367 | tableGuid: '@guid', | ||
| 368 | tableName: '@cword(3, 5)', | ||
| 369 | tableChName: '@cword(3, 5)', | ||
| 370 | databaseGuid: '@guid', | ||
| 371 | database: '@cword(3, 5)', | ||
| 372 | databaseChName: '@cword(3, 5)' | ||
| 373 | }] | ||
| 374 | } | ||
| 375 | } | ||
| 376 | } | ||
| 377 | } | ||
| 378 | export const getDsTableStructure = { | ||
| 379 | url: '/mock/db-dir/field/list-by-table-guid', | ||
| 380 | method: 'post', | ||
| 381 | response: ({body}:{body:any}) => { | ||
| 382 | return { | ||
| 383 | code: '00000', | ||
| 384 | message: '成功', | ||
| 385 | 'data|2-5': [{ | ||
| 386 | guid: '@guid', | ||
| 387 | tableGuid: '@guid', | ||
| 388 | tableName: '@cword(3, 5)', | ||
| 389 | tableChName: '@cword(3, 5)', | ||
| 390 | databaseGuid: '@guid', | ||
| 391 | database: '@cword(3, 5)', | ||
| 392 | databaseChName: '@cword(3, 5)', | ||
| 393 | fieldGuid: '@guid', | ||
| 394 | fieldName: '@cword(3, 5)', | ||
| 395 | fieldChName: '@cword(3, 5)', | ||
| 396 | fieldType: '@cword(3, 5)', | ||
| 397 | fieldLength: '@integer(1, 100)', | ||
| 398 | fieldPrecision: '@integer(1, 100)', | ||
| 399 | dimGuid: '@guid', | ||
| 400 | dictionaryGuid: '@guid', | ||
| 401 | sortValue: '@integer(1, 100)', | ||
| 402 | isPrimary: 'Y', | ||
| 403 | isFk: 'Y', | ||
| 404 | isNotNull: 'Y' | ||
| 405 | }] | ||
| 406 | } | ||
| 407 | } | ||
| 408 | } | ||
| 409 | |||
| 410 | /** | ||
| 411 | * export const getDbDirFieldPageList = (data) => request({ | ||
| 412 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/page-list`, | ||
| 413 | method: 'post', | ||
| 414 | data | ||
| 415 | }) | ||
| 416 | { | ||
| 417 | "code": "string", | ||
| 418 | "msg": "string", | ||
| 419 | "data": { | ||
| 420 | "totalRows": 0, | ||
| 421 | "totalPages": 0, | ||
| 422 | "pageSize": 0, | ||
| 423 | "pageIndex": 0, | ||
| 424 | "records": [ | ||
| 425 | { | ||
| 426 | "guid": "string", | ||
| 427 | "tenantGuid": "string", | ||
| 428 | "cgDirName": "string", | ||
| 429 | "dirGuid": "string", | ||
| 430 | "classifyName": "string", | ||
| 431 | "gradeDetailName": "string", | ||
| 432 | "label": "string", | ||
| 433 | "fieldName": "string", | ||
| 434 | "fieldChName": "string", | ||
| 435 | "tableName": "string", | ||
| 436 | "tableChName": "string", | ||
| 437 | "database": "string", | ||
| 438 | "databaseChName": "string" | ||
| 439 | } | ||
| 440 | ], | ||
| 441 | */ | ||
| 442 | |||
| 443 | export const getDbDirFieldPageList = { | ||
| 444 | url: '/mock/db-dir/field/page-list', | ||
| 445 | method: 'post', | ||
| 446 | response: ({body}:{body:any}) => { | ||
| 447 | return { | ||
| 448 | code: '00000', | ||
| 449 | message: '成功', | ||
| 450 | 'data': { | ||
| 451 | totalRows: '@integer(50, 100)', | ||
| 452 | totalPages: '@integer(1, 10)', | ||
| 453 | pageSize: 10, | ||
| 454 | pageIndex: 1, | ||
| 455 | 'records|20-30': [{ | ||
| 456 | guid: '@guid', | ||
| 457 | tenantGuid: '@guid', | ||
| 458 | cgDirName: '@cword(3, 5)', | ||
| 459 | dirGuid: '@guid', | ||
| 460 | classifyName: '@cword(3, 5)', | ||
| 461 | gradeDetailName: '@cword(3, 5)', | ||
| 462 | label: '@cword(3, 5)', | ||
| 463 | fieldName: '@cword(3, 5)', | ||
| 464 | fieldChName: '@cword(3, 5)', | ||
| 465 | tableName: '@cword(3, 5)', | ||
| 466 | tableChName: '@cword(3, 5)', | ||
| 467 | database: '@cword(3, 5)', | ||
| 468 | databaseChName: '@cword(3, 5)' | ||
| 469 | }] | ||
| 470 | } | ||
| 471 | } | ||
| 472 | } | ||
| 473 | } | ||
| 474 | /** | ||
| 475 | * export const getBizRuleConfigDetail = (params) => request({ | ||
| 476 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/detail?tableGuid=${params.tableGuid}&execGuid=${params.execGuid}`, | ||
| 477 | method: 'get', | ||
| 478 | }) | ||
| 479 | "data": [ | ||
| 480 | { | ||
| 481 | "guid": "string", | ||
| 482 | "tenantGuid": "string", | ||
| 483 | "classifyName": "string", | ||
| 484 | "gradeDetailName": "string", | ||
| 485 | "fieldName": "string", | ||
| 486 | "fieldChName": "string", | ||
| 487 | "fieldGuid": "string", | ||
| 488 | "fieldType": "string", | ||
| 489 | "fieldLengthCondition": "string", | ||
| 490 | "fieldPrecision": 0, | ||
| 491 | "dictionaryGuid": "string", | ||
| 492 | "isUnique": "string", | ||
| 493 | "isNotNull": "string", | ||
| 494 | "fieldValueRange": "string" | ||
| 495 | } | ||
| 496 | ], | ||
| 497 | */ | ||
| 498 | export const getBizRuleConfigDetail = { | ||
| 499 | url: '/mock/biz-rule-config/detail', | ||
| 500 | method: 'get', | ||
| 501 | response: ({body}:{body:any}) => { | ||
| 502 | return { | ||
| 503 | code: '00000', | ||
| 504 | message: '成功', | ||
| 505 | 'data|1-3': [{ | ||
| 506 | guid: '@guid', | ||
| 507 | tenantGuid: '@guid', | ||
| 508 | classifyName: '@cword(3, 5)', | ||
| 509 | gradeDetailName: '@cword(3, 5)', | ||
| 510 | fieldName: '@cword(3, 5)', | ||
| 511 | fieldChName: '@cword(3, 5)', | ||
| 512 | fieldGuid: '@guid', | ||
| 513 | fieldType: '@cword(3, 5)', | ||
| 514 | fieldLengthCondition: '>#10', | ||
| 515 | fieldPrecision: '@integer(1, 100)', | ||
| 516 | dictionaryGuid: '@guid', | ||
| 517 | isUnique: 'Y', | ||
| 518 | isNotNull: 'Y', | ||
| 519 | fieldValueRange: '0-100' | ||
| 520 | }] | ||
| 521 | } | ||
| 522 | } | ||
| 523 | } | ||
| 524 | /** | ||
| 525 | * export const updateBizRuleConfig = (data) => request({ | ||
| 526 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/update`, | ||
| 527 | method: 'post', | ||
| 528 | data | ||
| 529 | }){ | ||
| 530 | "code": "string", | ||
| 531 | "msg": "string", | ||
| 532 | "data": true, | ||
| 533 | "at": "string", | ||
| 534 | "serviceCode": "string" | ||
| 535 | } | ||
| 536 | */ | ||
| 537 | export const updateBizRuleConfig = { | ||
| 538 | url: '/mock/biz-rule-config/update', | ||
| 539 | method: 'post', | ||
| 540 | response: ({body}:{body:any}) => { | ||
| 541 | return { | ||
| 542 | code: '00000', | ||
| 543 | message: '成功', | ||
| 544 | data: true, | ||
| 545 | at: 'string', | ||
| 546 | serviceCode: 'string' | ||
| 547 | } | ||
| 548 | } | ||
| 549 | } | ||
| 550 | /** | ||
| 551 | * /** | ||
| 552 | * 数据库新建目录表 | ||
| 553 | * @param {Object} | ||
| 554 | * @path /db-dir/table/save | ||
| 555 | * export const saveDbDirTable = (data) => request({ | ||
| 556 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/save`, | ||
| 557 | method: 'post', | ||
| 558 | data | ||
| 559 | }) | ||
| 560 | */ | ||
| 561 | export const saveDbDirTable = { | ||
| 562 | url: '/mock/db-dir/table/save', | ||
| 563 | method: 'post', | ||
| 564 | response: ({body}:{body:any}) => { | ||
| 565 | return { | ||
| 566 | code: '00000', | ||
| 567 | message: '成功' | ||
| 568 | } | ||
| 569 | } | ||
| 570 | } | ||
| 571 | |||
| 572 | /** | ||
| 573 | * /** | ||
| 574 | * 数据库目录修改表 | ||
| 575 | * @param {Object} | ||
| 576 | * @path /db-dir/table/update | ||
| 577 | * export const updateDbDirTable = (data) => request({ | ||
| 578 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/update`, | ||
| 579 | method: 'post', | ||
| 580 | data | ||
| 581 | }) | ||
| 582 | |||
| 583 | */ | ||
| 584 | export const updateDbDirTable = { | ||
| 585 | url: '/mock/db-dir/table/update', | ||
| 586 | method: 'post', | ||
| 587 | response: ({body}:{body:any}) => { | ||
| 588 | return { | ||
| 589 | code: '00000', | ||
| 590 | message: '成功' | ||
| 591 | } | ||
| 592 | } | ||
| 593 | } | ||
| 594 | |||
| 595 | /*** | ||
| 596 | * /** | ||
| 597 | * 生成建表sql语句 | ||
| 598 | * @param {Object} | ||
| 599 | * @path /db-dir/table/create-table-sql | ||
| 600 | * export const createTableSql = (data) => request({ | ||
| 601 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/create-table-sql`, | ||
| 602 | method: 'post', | ||
| 603 | data | ||
| 604 | }) | ||
| 605 | */ | ||
| 606 | |||
| 607 | export const createTableSql = { | ||
| 608 | url: '/mock/db-dir/table/create-table-sql', | ||
| 609 | method: 'post', | ||
| 610 | response: ({body}:{body:any}) => { | ||
| 611 | return { | ||
| 612 | code: '00000', | ||
| 613 | message: '成功', | ||
| 614 | data: 'create table test_table (id int, name varchar(255))' | ||
| 615 | } | ||
| 616 | } | ||
| 617 | } | ||
| 18 | 618 | ||
| 19 | export default [confirmDelivery] as MockMethod[] | 619 | export default [getCgDirTreeList,getCgDirFieldPageList, |
| 620 | getDictionary,saveBizRuleConfig, getDbDirTreeList, | ||
| 621 | getDbDirTablePageList,getDbDirDataSourceList,getDsTableByDs, | ||
| 622 | getDsTableStructure,getDbDirFieldPageList,getBizRuleConfigDetail, | ||
| 623 | updateBizRuleConfig,saveDbDirTable,createTableSql,updateDbDirTable] as MockMethod[] | ... | ... |
| ... | @@ -209,8 +209,76 @@ const routes: RouteRecordRaw[] = [ | ... | @@ -209,8 +209,76 @@ const routes: RouteRecordRaw[] = [ |
| 209 | cache: true | 209 | cache: true |
| 210 | }, | 210 | }, |
| 211 | }, | 211 | }, |
| 212 | ], | 212 | { |
| 213 | path: 'configure-rules', | ||
| 214 | name: 'configureRules', | ||
| 215 | component: () => import('@/views/data_inventory/configureRules.vue'), | ||
| 216 | meta: { | ||
| 217 | title: '配置业务规则', | ||
| 218 | sidebar: false, | ||
| 219 | breadcrumb: false, | ||
| 220 | cache: true, | ||
| 221 | reuse: true, | ||
| 222 | editPage: true, | ||
| 223 | activeMenu: '/data-inventory/classify-grade-catalogue', | ||
| 224 | }, | ||
| 225 | }, | ||
| 226 | { | ||
| 227 | path: 'table-create-existing', | ||
| 228 | name: 'tableCreateExisting', | ||
| 229 | component: () => import('@/views/data_inventory/tableCreateExisting.vue'), | ||
| 230 | meta: { | ||
| 231 | title: '已有表新建', | ||
| 232 | sidebar: false, | ||
| 233 | breadcrumb: false, | ||
| 234 | cache: true, | ||
| 235 | reuse: true | ||
| 236 | }, | ||
| 237 | beforeEnter: (to, from) => { | ||
| 238 | if (to.query.domainName) { | ||
| 239 | to.meta.title = `已有表新建(${to.query.domainName})`; | ||
| 240 | to.meta.editPage = true; | ||
| 241 | } | ||
| 242 | } | ||
| 243 | }, | ||
| 244 | { | ||
| 245 | path: 'table-create-file', | ||
| 246 | name: 'tableCreateFile', | ||
| 247 | component: () => import('@/views/data_inventory/tableCreateFile.vue'), | ||
| 248 | meta: { | ||
| 249 | title: '根据文件新建', | ||
| 250 | sidebar: false, | ||
| 251 | breadcrumb: false, | ||
| 252 | cache: true, | ||
| 253 | reuse: true | ||
| 254 | }, | ||
| 255 | beforeEnter: (to, from) => { | ||
| 256 | |||
| 213 | } | 257 | } |
| 258 | }, | ||
| 259 | ], | ||
| 260 | }, | ||
| 261 | { | ||
| 262 | path: '/data-inventory/data-dictionary', | ||
| 263 | component: Layout, | ||
| 264 | meta: { | ||
| 265 | title: '数据字典', | ||
| 266 | icon: 'sidebar-cooperation', | ||
| 267 | }, | ||
| 268 | children: [ | ||
| 269 | { | ||
| 270 | path: '', | ||
| 271 | name: 'dictionary', | ||
| 272 | component: () => import('@/views/data_inventory/dictionary.vue'), | ||
| 273 | meta: { | ||
| 274 | title: '数据字典', | ||
| 275 | sidebar: false, | ||
| 276 | breadcrumb: false, | ||
| 277 | cache: true | ||
| 278 | }, | ||
| 279 | }, | ||
| 280 | ], | ||
| 281 | }, | ||
| 214 | ] | 282 | ] |
| 215 | 283 | ||
| 216 | export default routes | 284 | export default routes | ... | ... |
| ... | @@ -101,6 +101,13 @@ const systemRoutes: RouteRecordRaw[] = [ | ... | @@ -101,6 +101,13 @@ const systemRoutes: RouteRecordRaw[] = [ |
| 101 | // 动态路由(异步路由、导航栏路由) | 101 | // 动态路由(异步路由、导航栏路由) |
| 102 | const asyncRoutes: Route.recordMainRaw[] = [ | 102 | const asyncRoutes: Route.recordMainRaw[] = [ |
| 103 | { | 103 | { |
| 104 | meta:{ | ||
| 105 | title: '首页', | ||
| 106 | }, | ||
| 107 | children: [ | ||
| 108 | ], | ||
| 109 | }, | ||
| 110 | { | ||
| 104 | meta: { | 111 | meta: { |
| 105 | title: '数据资产管理', | 112 | title: '数据资产管理', |
| 106 | }, | 113 | }, | ... | ... |
| ... | @@ -218,7 +218,7 @@ const rulesDetailTableInfo: any = ref({ | ... | @@ -218,7 +218,7 @@ const rulesDetailTableInfo: any = ref({ |
| 218 | oneRulesDetailDialogVisible.value = true; | 218 | oneRulesDetailDialogVisible.value = true; |
| 219 | } else { | 219 | } else { |
| 220 | detailJson.value[row.ruleConfGuid] = { isRequest: true }; | 220 | detailJson.value[row.ruleConfGuid] = { isRequest: true }; |
| 221 | getRecordRuleConfDetail({ruleConfGuid: row.ruleConfGuid, planExecGuid: planExecGuid }).then((res: any) => { | 221 | getRecordRuleConfDetail({ ruleConfGuid: row.ruleConfGuid, planExecGuid: planExecGuid }).then((res: any) => { |
| 222 | detailLoading.value = false; | 222 | detailLoading.value = false; |
| 223 | oneRulesDetailDialogVisible.value = true; | 223 | oneRulesDetailDialogVisible.value = true; |
| 224 | if (res.code == proxy.$passCode) { | 224 | if (res.code == proxy.$passCode) { | ... | ... |
| ... | @@ -72,9 +72,12 @@ const tableInfo = ref({ | ... | @@ -72,9 +72,12 @@ const tableInfo = ref({ |
| 72 | return status == 'Y' ? '有效' : '停用'; | 72 | return status == 'Y' ? '有效' : '停用'; |
| 73 | } | 73 | } |
| 74 | }, | 74 | }, |
| 75 | { label: "定义说明", width: 360, field: "description", }, | 75 | { label: "定义说明", width: 140, field: "description", }, |
| 76 | { | 76 | { |
| 77 | label: "最低安全级别参考", field: "name", width: 140, | 77 | label: "最低安全级别参考", field: "name", width: 140, getName: (scope) => { |
| 78 | let dataGrade = scope.row.dataGrade; | ||
| 79 | return dataGrade + '级'; | ||
| 80 | } | ||
| 78 | }, | 81 | }, |
| 79 | { label: "修改人", field: "updateUserName", width: 140 }, | 82 | { label: "修改人", field: "updateUserName", width: 140 }, |
| 80 | { label: "更新时间", field: "updateTime", width: 180 }, | 83 | { label: "更新时间", field: "updateTime", width: 180 }, |
| ... | @@ -386,6 +389,7 @@ const getGradeListData = async () => { | ... | @@ -386,6 +389,7 @@ const getGradeListData = async () => { |
| 386 | 389 | ||
| 387 | const newCreateClass = () => { | 390 | const newCreateClass = () => { |
| 388 | drawerInfo.value.visible = true; | 391 | drawerInfo.value.visible = true; |
| 392 | classEditFormItems.value[2].options = treeListData.value; | ||
| 389 | drawerInfo.value.header.title = '添加分类'; | 393 | drawerInfo.value.header.title = '添加分类'; |
| 390 | classEditFormItems.value.forEach(item => { | 394 | classEditFormItems.value.forEach(item => { |
| 391 | if (item.field == 'status') { | 395 | if (item.field == 'status') { |
| ... | @@ -702,7 +706,7 @@ onMounted(() => { | ... | @@ -702,7 +706,7 @@ onMounted(() => { |
| 702 | style="margin-top:16px; height: calc(100% - 161px)"> | 706 | style="margin-top:16px; height: calc(100% - 161px)"> |
| 703 | <div class="tools_btns"> | 707 | <div class="tools_btns"> |
| 704 | <el-button v-show="dataShowMethod == 'table'" type="primary" @click="newCreateClass">添加分类</el-button> | 708 | <el-button v-show="dataShowMethod == 'table'" type="primary" @click="newCreateClass">添加分类</el-button> |
| 705 | <el-button v-show="dataShowMethod == 'table'" @click="importClass">导入分类</el-button> | 709 | <!-- <el-button v-show="dataShowMethod == 'table'" @click="importClass">导入分类</el-button> --> |
| 706 | <el-button class="show-change-btn" @click="changeShowMethod">{{ '图形展示' }}</el-button> | 710 | <el-button class="show-change-btn" @click="changeShowMethod">{{ '图形展示' }}</el-button> |
| 707 | </div> | 711 | </div> |
| 708 | <Table v-show="dataShowMethod == 'table'" :tableInfo="tableInfo" /> | 712 | <Table v-show="dataShowMethod == 'table'" :tableInfo="tableInfo" /> | ... | ... |
| ... | @@ -31,14 +31,14 @@ const getGradeListData = async () => { | ... | @@ -31,14 +31,14 @@ const getGradeListData = async () => { |
| 31 | // 获取数据类别 | 31 | // 获取数据类别 |
| 32 | const getDataGrade = async () => { | 32 | const getDataGrade = async () => { |
| 33 | const params = { | 33 | const params = { |
| 34 | paramCode: "DATA-CLASSIFY" | 34 | dictType: "数据类别" |
| 35 | } | 35 | } |
| 36 | const res: any = await getLargeCategoryList(params); | 36 | const res: any = await getLargeCategoryList(params); |
| 37 | if (res.code == proxy.$passCode) { | 37 | if (res.code == proxy.$passCode) { |
| 38 | // 提出value和label 作为select的options | 38 | // 提出value和label 作为select的options |
| 39 | const options = res.data.map((item: any) => ({ | 39 | const options = res.data.map((item: any) => ({ |
| 40 | label: item.paramName, | 40 | label: item.label, |
| 41 | value: item.paramValue | 41 | value: item.value |
| 42 | })); | 42 | })); |
| 43 | newCreateGradeFormItems.value[1].options = options; | 43 | newCreateGradeFormItems.value[1].options = options; |
| 44 | classDataRef.value = options; | 44 | classDataRef.value = options; |
| ... | @@ -50,14 +50,14 @@ const getDataGrade = async () => { | ... | @@ -50,14 +50,14 @@ const getDataGrade = async () => { |
| 50 | // 获取数据级别 | 50 | // 获取数据级别 |
| 51 | const getDataClassify = async () => { | 51 | const getDataClassify = async () => { |
| 52 | const params = { | 52 | const params = { |
| 53 | paramCode: "DATA-GRADE" | 53 | dictType: "数据级别" |
| 54 | } | 54 | } |
| 55 | const res: any = await getLargeCategoryList(params); | 55 | const res: any = await getLargeCategoryList(params); |
| 56 | if (res.code == proxy.$passCode) { | 56 | if (res.code == proxy.$passCode) { |
| 57 | // 提出value和label 作为select的options | 57 | // 提出value和label 作为select的options |
| 58 | const options = res.data.map((item: any) => ({ | 58 | const options = res.data.map((item: any) => ({ |
| 59 | label: item.paramName, | 59 | label: item.label, |
| 60 | value: item.paramValue | 60 | value: item.value |
| 61 | })); | 61 | })); |
| 62 | newCreateGradeFormItems.value[0].options = options; | 62 | newCreateGradeFormItems.value[0].options = options; |
| 63 | // 这里需要过滤已经在表格中数据级别 | 63 | // 这里需要过滤已经在表格中数据级别 | ... | ... |
| ... | @@ -3,54 +3,33 @@ | ... | @@ -3,54 +3,33 @@ |
| 3 | </route> | 3 | </route> |
| 4 | 4 | ||
| 5 | <script lang="ts" setup name="classifyGradeCatalogue"> | 5 | <script lang="ts" setup name="classifyGradeCatalogue"> |
| 6 | import { CirclePlus, Delete, Warning } from "@element-plus/icons-vue"; | 6 | import { Warning } from "@element-plus/icons-vue"; |
| 7 | import TableTools from '@/components/Tools/table_tools.vue'; | 7 | import TableTools from '@/components/Tools/table_tools.vue'; |
| 8 | import { getCgDirTreeList, getCgDirFieldPageList } from '@/api/modules/dataInventory'; | 8 | import { |
| 9 | 9 | getCgDirTreeList, getCgDirFieldPageList, getDictionary, saveBizRuleConfig, | |
| 10 | const currentPath = ref<string[]>(['全部', '个人信息', '个人自然信息', '个人基本概况信息']); | 10 | getDbDirTreeList, getDbDirTablePageList, getDbDirFieldPageList, getExecGuidAndName |
| 11 | 11 | } from '@/api/modules/dataInventory'; | |
| 12 | const tempData = [ | 12 | import { TableColumnWidth } from "@/utils/enum"; |
| 13 | { | 13 | import router from "@/router"; |
| 14 | guid: '1', | 14 | |
| 15 | standardName: '个人信息', | 15 | const currentPath = ref<string[]>([]); |
| 16 | status: 'published', | ||
| 17 | children: [ | ||
| 18 | { | ||
| 19 | guid: '1-1', | ||
| 20 | standardName: '个人自然信息', | ||
| 21 | status: 'published', | ||
| 22 | children: [ | ||
| 23 | { | ||
| 24 | guid: '1-1-1', | ||
| 25 | standardName: '个人基本概况信息', | ||
| 26 | status: 'published', | ||
| 27 | }, | ||
| 28 | { | ||
| 29 | guid: '1-1-2', | ||
| 30 | standardName: '个人财产信息', | ||
| 31 | status: 'published', | ||
| 32 | }, | ||
| 33 | { | ||
| 34 | guid: '1-1-3', | ||
| 35 | standardName: '个人健康信息', | ||
| 36 | status: 'published', | ||
| 37 | }, | ||
| 38 | ] | ||
| 39 | }, | ||
| 40 | ] | ||
| 41 | }, | ||
| 42 | ]; | ||
| 43 | const { proxy } = getCurrentInstance() as any; | 16 | const { proxy } = getCurrentInstance() as any; |
| 44 | 17 | ||
| 45 | // 分级分类树形列表 | 18 | // 分级分类树形列表 |
| 46 | const CgDirTreeList = ref(); | 19 | const CgDirTreeList = ref(); |
| 47 | const getCgDirTreeData = async () => { | 20 | const getCgDirTreeData = async () => { |
| 21 | treeInfo.value.loading = true; | ||
| 48 | const params = { | 22 | const params = { |
| 49 | classifyName: '', | 23 | classifyName: '', |
| 50 | } | 24 | } |
| 51 | const res: any = await getCgDirTreeList(params); | 25 | const res: any = await getCgDirTreeList(params); |
| 52 | if (res.code == proxy.$passCode) { | 26 | if (res.code == proxy.$passCode) { |
| 53 | CgDirTreeList.value = res.data; | 27 | CgDirTreeList.value = res.data; |
| 28 | treeInfo.value.data = res.data; | ||
| 29 | currentPath.value = [res.data[0].classifyName]; | ||
| 30 | treeInfo.value.expandedKey = [res.data[0].guid]; | ||
| 31 | treeInfo.value.currentNodeKey = res.data[0].guid; | ||
| 32 | treeInfo.value.loading = false; | ||
| 54 | } else { | 33 | } else { |
| 55 | proxy.$ElMessage.error(res.msg); | 34 | proxy.$ElMessage.error(res.msg); |
| 56 | } | 35 | } |
| ... | @@ -58,6 +37,7 @@ const getCgDirTreeData = async () => { | ... | @@ -58,6 +37,7 @@ const getCgDirTreeData = async () => { |
| 58 | // 分页列表 | 37 | // 分页列表 |
| 59 | const CgDirFieldPageList = ref(); | 38 | const CgDirFieldPageList = ref(); |
| 60 | const getCgDirFieldPage = async (params = {}) => { | 39 | const getCgDirFieldPage = async (params = {}) => { |
| 40 | tableInfo.value.loading = true; | ||
| 61 | // 在这里你可以根据需要扩展或修改 params | 41 | // 在这里你可以根据需要扩展或修改 params |
| 62 | const defaultParams = { | 42 | const defaultParams = { |
| 63 | pageIndex: 1, | 43 | pageIndex: 1, |
| ... | @@ -74,165 +54,74 @@ const getCgDirFieldPage = async (params = {}) => { | ... | @@ -74,165 +54,74 @@ const getCgDirFieldPage = async (params = {}) => { |
| 74 | const finalParams = { ...defaultParams, ...params }; | 54 | const finalParams = { ...defaultParams, ...params }; |
| 75 | const res: any = await getCgDirFieldPageList(finalParams); | 55 | const res: any = await getCgDirFieldPageList(finalParams); |
| 76 | if (res.code == proxy.$passCode) { | 56 | if (res.code == proxy.$passCode) { |
| 77 | CgDirFieldPageList.value = res.data; | 57 | CgDirFieldPageList.value = res.data.records; |
| 58 | tableInfo.value.page.rows = res.data.totalRows; | ||
| 59 | tableInfo.value.page.limit = res.data.pageSize | ||
| 60 | tableInfo.value.page.curr = res.data.pageIndex | ||
| 61 | tableInfo.value.data = res.data.records; | ||
| 62 | tableInfo.value.loading = false; | ||
| 63 | } else { | ||
| 64 | proxy.$ElMessage.error(res.msg); | ||
| 65 | } | ||
| 66 | }; | ||
| 67 | |||
| 68 | const dictionaryList = ref([]); | ||
| 69 | const getDictionaryList = () => { | ||
| 70 | getDictionary({}).then((res: any) => { | ||
| 71 | dictionaryList.value = []; | ||
| 72 | if (res.code == proxy.$passCode) { | ||
| 73 | dictionaryList.value = res.data || []; | ||
| 74 | classEditFormItems.value[4].options = res.data || []; | ||
| 78 | } else { | 75 | } else { |
| 79 | proxy.$ElMessage.error(res.msg); | 76 | proxy.$ElMessage.error(res.msg); |
| 80 | } | 77 | } |
| 78 | }) | ||
| 81 | }; | 79 | }; |
| 82 | 80 | ||
| 81 | // 获取执行guid | ||
| 82 | const execGuidInfo = ref<any>({}); | ||
| 83 | const getExecGuid = async () => { | ||
| 84 | const res: any = await getExecGuidAndName(); | ||
| 85 | if (res.code == proxy.$passCode) { | ||
| 86 | execGuidInfo.value = res.data; | ||
| 87 | } else { | ||
| 88 | proxy.$ElMessage.error(res.msg); | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 83 | onMounted(() => { | 93 | onMounted(() => { |
| 84 | getCgDirTreeData(); | 94 | getCgDirTreeData(); |
| 85 | getCgDirFieldPage(); | 95 | getCgDirFieldPage(); |
| 96 | getDictionaryList(); | ||
| 97 | getExecGuid(); | ||
| 86 | }) | 98 | }) |
| 87 | 99 | ||
| 88 | // 左侧tree-list | 100 | // 左侧tree-list |
| 89 | const treeInfo = ref({ | 101 | const treeInfo = ref({ |
| 90 | id: "data-pickup-tree", | 102 | id: "data-pickup-tree", |
| 91 | filter: true, | 103 | filter: true, |
| 92 | editTreeItem: true, | 104 | editTreeItem: false, |
| 93 | queryValue: "", | 105 | queryValue: "", |
| 94 | className: 'tree-list', | 106 | className: 'tree-list', |
| 95 | queryPlaceholder: "输入标准集名称搜索", | 107 | queryPlaceholder: "输入标准集名称搜索", |
| 96 | props: { | 108 | props: { |
| 97 | label: "standardName", | 109 | label: "classifyName", |
| 98 | value: "guid", | 110 | value: "guid", |
| 99 | }, | 111 | }, |
| 100 | nodeKey: 'guid', | 112 | nodeKey: 'guid', |
| 101 | expandedKey: ['0'], | 113 | expandedKey: ['0'], |
| 102 | currentNodeKey: '', | 114 | currentNodeKey: '', |
| 103 | expandOnNodeClick: false, | 115 | expandOnNodeClick: false, |
| 104 | data: tempData, | 116 | data: [], |
| 105 | loading: false | 117 | loading: false |
| 106 | }); | 118 | }); |
| 107 | 119 | ||
| 108 | // 弹窗配置 | ||
| 109 | const formItems: any = ref([ | ||
| 110 | { | ||
| 111 | label: '标准集名称', | ||
| 112 | type: 'input', | ||
| 113 | maxlength: 50, | ||
| 114 | placeholder: '请输入', | ||
| 115 | field: 'standardName', | ||
| 116 | clearable: true, | ||
| 117 | required: true | ||
| 118 | }, { | ||
| 119 | label: '标准集编号', | ||
| 120 | type: 'input', | ||
| 121 | placeholder: '', | ||
| 122 | field: 'standardCode', | ||
| 123 | required: true, | ||
| 124 | disabled: true | ||
| 125 | }, { | ||
| 126 | label: "上级标准集", | ||
| 127 | type: 'tree-select', | ||
| 128 | placeholder: '请选择', | ||
| 129 | field: 'parentGuid', | ||
| 130 | default: '', | ||
| 131 | checkStrictly: true, | ||
| 132 | lazy: false, | ||
| 133 | clearable: true, | ||
| 134 | options: [], | ||
| 135 | props: { | ||
| 136 | label: 'standardName', | ||
| 137 | value: 'guid', | ||
| 138 | children: 'children', | ||
| 139 | isLeaf: 'isLeaf' | ||
| 140 | }, | ||
| 141 | expandKeys: [], | ||
| 142 | filterable: true, | ||
| 143 | required: false | ||
| 144 | }, { | ||
| 145 | label: '排序', | ||
| 146 | type: 'input', | ||
| 147 | placeholder: '请输入', | ||
| 148 | field: 'orderNum', | ||
| 149 | maxlength: 6, | ||
| 150 | required: true, | ||
| 151 | clearable: true, | ||
| 152 | }, { | ||
| 153 | label: '描述', | ||
| 154 | type: 'textarea', | ||
| 155 | placeholder: '请输入', | ||
| 156 | field: 'description', | ||
| 157 | clearable: true, | ||
| 158 | required: false, | ||
| 159 | block: true | ||
| 160 | }, | ||
| 161 | ]) | ||
| 162 | const formRules: any = ref({ | ||
| 163 | standardName: [ | ||
| 164 | { | ||
| 165 | required: true, | ||
| 166 | message: '请输入标准集名称', | ||
| 167 | trigger: 'blur' | ||
| 168 | }, | ||
| 169 | { | ||
| 170 | max: 50, | ||
| 171 | message: '长度在 50 个字符以内', | ||
| 172 | trigger: 'blur' | ||
| 173 | }, | ||
| 174 | ], | ||
| 175 | orderNum: [{ | ||
| 176 | validator: (rule: any, value: any, callback: any) => { | ||
| 177 | if (value === 0) { | ||
| 178 | callback(); | ||
| 179 | return; | ||
| 180 | } | ||
| 181 | if (!value) { | ||
| 182 | callback(new Error('请填写排序')); | ||
| 183 | return; | ||
| 184 | } | ||
| 185 | const r = /(^[0-9]([0-9]*)$|^[0-9]$)/; // 正整数(可以以0打头) | ||
| 186 | if (value && !r.test(value)) { | ||
| 187 | callback(new Error('请填写大于或等于零整数')); | ||
| 188 | return; | ||
| 189 | } | ||
| 190 | callback(); | ||
| 191 | }, | ||
| 192 | trigger: "blur", | ||
| 193 | }], | ||
| 194 | }) | ||
| 195 | const formInfo = ref({ | ||
| 196 | type: "form", | ||
| 197 | title: "", | ||
| 198 | formInfo: { | ||
| 199 | id: "add-set-standard-form", | ||
| 200 | items: formItems.value, | ||
| 201 | rules: formRules.value | ||
| 202 | }, | ||
| 203 | }) | ||
| 204 | const standardSetDialogInfo: any = ref({ | ||
| 205 | visible: false, | ||
| 206 | size: 700, | ||
| 207 | direction: "column", | ||
| 208 | header: { | ||
| 209 | title: "新建", | ||
| 210 | }, | ||
| 211 | type: '', | ||
| 212 | contents: [formInfo.value], | ||
| 213 | footer: { | ||
| 214 | visible: true, | ||
| 215 | btns: [ | ||
| 216 | { type: "default", label: "取消", value: "cancel" }, | ||
| 217 | { type: "primary", label: "确定", value: "submit" }, | ||
| 218 | ], | ||
| 219 | }, | ||
| 220 | }) | ||
| 221 | |||
| 222 | const addStandardSet = () => { | 120 | const addStandardSet = () => { |
| 223 | standardSetDialogInfo.value.visible = true; | ||
| 224 | console.log('addStandardSet'); | 121 | console.log('addStandardSet'); |
| 225 | } | 122 | } |
| 226 | 123 | ||
| 227 | const standardSetDialogBtnClick = (btn: any, info: any) => { | 124 | |
| 228 | console.log('standardSetDialogBtnClick', btn, info); | ||
| 229 | if (btn.value === 'submit') { | ||
| 230 | standardSetDialogInfo.value.visible = false; | ||
| 231 | } | ||
| 232 | if (btn.value === 'cancel') { | ||
| 233 | standardSetDialogInfo.value.visible = false; | ||
| 234 | } | ||
| 235 | } | ||
| 236 | 125 | ||
| 237 | // 右侧上方搜索tab配置 | 126 | // 右侧上方搜索tab配置 |
| 238 | const searchItemList = ref([ | 127 | const searchItemList = ref([ |
| ... | @@ -250,20 +139,20 @@ const searchItemList = ref([ | ... | @@ -250,20 +139,20 @@ const searchItemList = ref([ |
| 250 | }, | 139 | }, |
| 251 | clearable: true, | 140 | clearable: true, |
| 252 | }, | 141 | }, |
| 253 | { | 142 | // { |
| 254 | label: '字段名', | 143 | // label: '字段名', |
| 255 | type: 'select', | 144 | // type: 'select', |
| 256 | maxlength: 19, | 145 | // maxlength: 19, |
| 257 | placeholder: '选择字段名', | 146 | // placeholder: '选择字段名', |
| 258 | field: 'fieldName', | 147 | // field: 'fieldName', |
| 259 | default: '', | 148 | // default: '', |
| 260 | options: [], | 149 | // options: [], |
| 261 | props: { | 150 | // props: { |
| 262 | label: 'name', | 151 | // label: 'name', |
| 263 | value: 'guid', | 152 | // value: 'guid', |
| 264 | }, | 153 | // }, |
| 265 | clearable: true, | 154 | // clearable: true, |
| 266 | }, | 155 | // }, |
| 267 | { | 156 | { |
| 268 | label: '分类', | 157 | label: '分类', |
| 269 | type: 'select', | 158 | type: 'select', |
| ... | @@ -290,34 +179,7 @@ const searchItemList = ref([ | ... | @@ -290,34 +179,7 @@ const searchItemList = ref([ |
| 290 | value: 'guid', | 179 | value: 'guid', |
| 291 | }, | 180 | }, |
| 292 | clearable: true, | 181 | clearable: true, |
| 293 | }, { | ||
| 294 | label: '数据库名', | ||
| 295 | type: 'select', | ||
| 296 | maxlength: 19, | ||
| 297 | placeholder: '选择数据库名', | ||
| 298 | field: 'databaseName', | ||
| 299 | default: '', | ||
| 300 | options: [], | ||
| 301 | props: { | ||
| 302 | label: 'name', | ||
| 303 | value: 'guid', | ||
| 304 | }, | 182 | }, |
| 305 | clearable: true, | ||
| 306 | }, | ||
| 307 | { | ||
| 308 | label: '表名', | ||
| 309 | type: 'select', | ||
| 310 | maxlength: 19, | ||
| 311 | placeholder: '选择表名', | ||
| 312 | field: 'tableName', | ||
| 313 | default: '', | ||
| 314 | options: [], | ||
| 315 | props: { | ||
| 316 | label: 'name', | ||
| 317 | value: 'guid', | ||
| 318 | }, | ||
| 319 | clearable: true, | ||
| 320 | } | ||
| 321 | ]) | 183 | ]) |
| 322 | const searchParams = ref({}) | 184 | const searchParams = ref({}) |
| 323 | const toSearch = (val: any, clear: boolean = false) => { | 185 | const toSearch = (val: any, clear: boolean = false) => { |
| ... | @@ -336,14 +198,11 @@ const toSearch = (val: any, clear: boolean = false) => { | ... | @@ -336,14 +198,11 @@ const toSearch = (val: any, clear: boolean = false) => { |
| 336 | // params.standardSetLevelCode = standardSetLevelCode.value; | 198 | // params.standardSetLevelCode = standardSetLevelCode.value; |
| 337 | // return getTableData(params); | 199 | // return getTableData(params); |
| 338 | }; | 200 | }; |
| 339 | const treeSelectNodeChange = (node: any) => { | ||
| 340 | console.log('treeSelectNodeChange', node); | ||
| 341 | const { guid, standardName } = node | ||
| 342 | treeInfo.value.currentNodeKey = guid; | ||
| 343 | console.log('nodeClick', guid, standardName); | ||
| 344 | 201 | ||
| 202 | const nodeClick = (data: any) => { | ||
| 203 | const { guid, classifyName } = data | ||
| 345 | // 递归tempData找到所有祖先元素的standardName,存入currentPath中 | 204 | // 递归tempData找到所有祖先元素的standardName,存入currentPath中 |
| 346 | const path = findPath(tempData, guid); | 205 | const path = findPath(CgDirTreeList.value, guid); |
| 347 | if (path) { | 206 | if (path) { |
| 348 | currentPath.value = path; | 207 | currentPath.value = path; |
| 349 | console.log('找到路径:', path); | 208 | console.log('找到路径:', path); |
| ... | @@ -351,31 +210,43 @@ const treeSelectNodeChange = (node: any) => { | ... | @@ -351,31 +210,43 @@ const treeSelectNodeChange = (node: any) => { |
| 351 | console.error('未找到路径'); | 210 | console.error('未找到路径'); |
| 352 | } | 211 | } |
| 353 | } | 212 | } |
| 213 | const findPath = (data: any[], targetGuid: string, path: string[] = []) => { | ||
| 214 | for (const item of data) { | ||
| 215 | path.push(item.classifyName); // 添加当前节点名称 | ||
| 216 | if (item.guid === targetGuid) { | ||
| 217 | return path; // 找到目标节点,返回路径 | ||
| 218 | } | ||
| 219 | if (item.children && item.children.length > 0) { | ||
| 220 | const result = findPath(item.children, targetGuid, path); | ||
| 221 | if (result) return result; // 子节点找到目标节点,返回路径 | ||
| 222 | } | ||
| 223 | path.pop(); // 回溯,移除当前节点 | ||
| 224 | } | ||
| 225 | return null; // 未找到目标节点 | ||
| 226 | }; | ||
| 227 | |||
| 354 | 228 | ||
| 355 | // btns-area | 229 | // btns-area |
| 356 | const checked1 = ref(false); | 230 | const checked = ref(false); |
| 231 | const changeCheck = (val) => { | ||
| 357 | 232 | ||
| 233 | checked.value = val; | ||
| 234 | getDataBaseTableData(); | ||
| 235 | } | ||
| 358 | 236 | ||
| 359 | //下方表格配置 | 237 | //下方表格配置 |
| 360 | const tableDataList = ref([{ | 238 | const tableDataList = ref(); |
| 361 | fieldStandardCode: '个人基本概况信息', | 239 | const page = ref({ |
| 362 | chName: '个人自然信息', | 240 | limit: 10, |
| 363 | enName: '个人信息', | 241 | curr: 1, |
| 364 | dataTypeValue: '规则', | 242 | sizes: [ |
| 365 | approveState: 'Y', | 243 | { label: "10", value: 10 }, |
| 366 | }, { | 244 | { label: "20", value: 20 }, |
| 367 | fieldStandardCode: '个人财产信息', | 245 | { label: "100", value: 100 }, |
| 368 | chName: '个人自然信息', | 246 | { label: "150", value: 150 }, |
| 369 | enName: '个人信息', | 247 | { label: "200", value: 200 }, |
| 370 | dataTypeValue: '规则', | 248 | ], |
| 371 | approveState: 'Y', | 249 | }); |
| 372 | }, { | ||
| 373 | fieldStandardCode: '个人健康信息', | ||
| 374 | chName: '个人自然信息', | ||
| 375 | enName: '个人信息', | ||
| 376 | dataTypeValue: '规则', | ||
| 377 | approveState: 'Y', | ||
| 378 | }]); | ||
| 379 | const tableInfo = ref({ | 250 | const tableInfo = ref({ |
| 380 | id: "role-manage-table", | 251 | id: "role-manage-table", |
| 381 | multiple: true, | 252 | multiple: true, |
| ... | @@ -384,20 +255,142 @@ const tableInfo = ref({ | ... | @@ -384,20 +255,142 @@ const tableInfo = ref({ |
| 384 | { label: "序号", type: "index", width: 56, align: "center" }, | 255 | { label: "序号", type: "index", width: 56, align: "center" }, |
| 385 | { label: "字段名", field: "fieldName", width: 140 }, | 256 | { label: "字段名", field: "fieldName", width: 140 }, |
| 386 | { label: "分类", field: "classifyName", width: 180 }, | 257 | { label: "分类", field: "classifyName", width: 180 }, |
| 387 | { label: "分级", field: "enName", width: 120 }, | 258 | { label: "分级", field: "gradeDetailName", width: 120 }, |
| 388 | { label: "标签", field: "labelName", width: 140 }, | 259 | { label: "标签", field: "label", width: 140 }, |
| 389 | { label: "规则", field: "rulesName", width: 180 }, | 260 | { label: "规则", field: "rulesName", width: 180 }, |
| 390 | { label: "表名", field: "tableName", width: 120, align: 'center' }, | 261 | { label: "表名", field: "tableName", width: 120, align: 'center' }, |
| 391 | { label: "表中文名", field: "tableCHName", width: 120, align: 'center' }, | 262 | { label: "表中文名", field: "tableChName", width: 120, align: 'center' }, |
| 392 | { label: "数据库名", field: "databaseName", width: 120, align: 'center' }, | 263 | { label: "数据库名", field: "database", width: 120, align: 'center' }, |
| 393 | { label: "数据类型", field: "databaseCHName", width: 120, align: 'center' }, | 264 | { label: "数据类型", field: "databaseChName", width: 120, align: 'center' }, |
| 265 | |||
| 266 | ], | ||
| 267 | data: [], | ||
| 268 | page: { | ||
| 269 | type: "normal", | ||
| 270 | rows: 0, | ||
| 271 | ...page.value, | ||
| 272 | }, | ||
| 273 | actionInfo: { | ||
| 274 | show: false, | ||
| 275 | }, | ||
| 276 | loading: false | ||
| 277 | }); | ||
| 278 | const tablePageChange = (info) => { | ||
| 279 | console.log('tablePageChange', info); | ||
| 280 | page.value.curr = Number(info.curr); | ||
| 281 | page.value.limit = Number(info.limit); | ||
| 282 | getCgDirFieldPage({ | ||
| 283 | pageIndex: info.curr, | ||
| 284 | pageSize: info.limit | ||
| 285 | }); | ||
| 286 | } | ||
| 287 | |||
| 288 | // 选中配置的业务规则 | ||
| 289 | const selectedRulesData = ref(); | ||
| 290 | const tableCheckboxSelectChange = (select, row) => { | ||
| 291 | // 遍历选中的数据,存入selectedRulesData | ||
| 292 | let rulesName: any = []; | ||
| 293 | let rulesGuid: any = []; | ||
| 294 | select.forEach((item: any) => { | ||
| 295 | rulesName.push(item.classifyName); | ||
| 296 | rulesGuid.push(item.guid); | ||
| 297 | }); | ||
| 298 | selectedRulesData.value = { | ||
| 299 | rulesName: rulesName.join('、'), | ||
| 300 | guids: rulesGuid | ||
| 301 | }; | ||
| 302 | } | ||
| 303 | const tableCheckboxAllSelectChange = (select) => { | ||
| 304 | // 遍历选中的数据,存入selectedRulesData | ||
| 305 | let rulesName: any = []; | ||
| 306 | let rulesGuid: any = []; | ||
| 307 | select.forEach((item: any) => { | ||
| 308 | rulesName.push(item.classifyName); | ||
| 309 | rulesGuid.push(item.guid); | ||
| 310 | }); | ||
| 311 | selectedRulesData.value = { | ||
| 312 | rulesName: rulesName.join('、'), | ||
| 313 | guids: rulesGuid | ||
| 314 | }; | ||
| 315 | } | ||
| 316 | |||
| 317 | // 批量配置业务规则 | ||
| 318 | const batchControlRules = () => { | ||
| 319 | // 判断是否选中数据 | ||
| 320 | if (!selectedRulesData.value || !selectedRulesData.value.guids || selectedRulesData.value.guids.length == 0) { | ||
| 321 | proxy.$ElMessage.warning('请选择数据'); | ||
| 322 | return; | ||
| 323 | } | ||
| 324 | drawerInfo.value.visible = true; | ||
| 325 | classEditFormItems.value[0].default = selectedRulesData.value.rulesName; | ||
| 326 | } | ||
| 327 | |||
| 328 | // 数据库目录 | ||
| 329 | // 左侧tree-list | ||
| 330 | const dataBaseTreeInfo = ref<any>({ | ||
| 331 | id: "data-pickup-tree", | ||
| 332 | filter: true, | ||
| 333 | editTreeItem: false, | ||
| 334 | queryValue: "", | ||
| 335 | className: 'tree-list', | ||
| 336 | queryPlaceholder: "输入标准集名称搜索", | ||
| 337 | props: { | ||
| 338 | label: "name", | ||
| 339 | value: "guid", | ||
| 340 | }, | ||
| 341 | nodeKey: 'guid', | ||
| 342 | expandedKey: ['0'], | ||
| 343 | currentNodeKey: '', | ||
| 344 | expandOnNodeClick: false, | ||
| 345 | data: [], | ||
| 346 | loading: false | ||
| 347 | }); | ||
| 394 | 348 | ||
| 349 | const dataBasePage = ref({ | ||
| 350 | limit: 10, | ||
| 351 | curr: 1, | ||
| 352 | sizes: [ | ||
| 353 | { label: "10", value: 10 }, | ||
| 354 | { label: "20", value: 20 }, | ||
| 355 | { label: "100", value: 100 }, | ||
| 356 | { label: "150", value: 150 }, | ||
| 357 | { label: "200", value: 200 }, | ||
| 395 | ], | 358 | ], |
| 396 | data: tableDataList.value, | 359 | }); |
| 360 | |||
| 361 | const dataBaseTableInfo = ref({ | ||
| 362 | id: "data-base-table", | ||
| 363 | multiple: true, | ||
| 364 | fixedSelection: true, | ||
| 365 | fields: [ | ||
| 366 | { label: "序号", type: "index", width: 56, align: "center" }, | ||
| 367 | { label: "数据源", field: "cgDirName", width: 140 }, | ||
| 368 | { label: "表名称", field: "tableName", width: 180 }, | ||
| 369 | { label: "数据库表", field: "tableChName", width: 120 }, | ||
| 370 | { | ||
| 371 | label: "新建方式", field: "foundMode", width: 140, getName: (scope) => { | ||
| 372 | let dataGrade = scope.row.foundMode; | ||
| 373 | return dataGrade == 1 ? '根据文件新建' : '已有表新建'; | ||
| 374 | } | ||
| 375 | }, | ||
| 376 | { | ||
| 377 | label: "状态", field: "state", type: 'tag', width: 180, getName: (scope) => { | ||
| 378 | let status = scope.row.state; | ||
| 379 | // 0 草稿中 1 已建表 2 已有默认表 | ||
| 380 | return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表'; | ||
| 381 | } | ||
| 382 | }, | ||
| 383 | { label: "任务修改人", field: "damName", width: 120 }, | ||
| 384 | { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME }, | ||
| 385 | { label: "描述", field: "description", width: 120, align: 'center' }, | ||
| 386 | { label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' }, | ||
| 387 | |||
| 388 | ], | ||
| 389 | data: [], | ||
| 397 | page: { | 390 | page: { |
| 398 | type: "normal", | 391 | type: "normal", |
| 399 | rows: 0, | 392 | rows: 0, |
| 400 | // ...page.value, | 393 | ...dataBasePage.value, |
| 401 | }, | 394 | }, |
| 402 | actionInfo: { | 395 | actionInfo: { |
| 403 | label: "操作", | 396 | label: "操作", |
| ... | @@ -406,22 +399,27 @@ const tableInfo = ref({ | ... | @@ -406,22 +399,27 @@ const tableInfo = ref({ |
| 406 | fixed: 'right', | 399 | fixed: 'right', |
| 407 | btns: [ | 400 | btns: [ |
| 408 | { | 401 | { |
| 409 | label: "编辑", value: "edit", click: (scope) => { | 402 | label: "配置业务规则", value: "edit", click: (scope) => { |
| 410 | console.log('编辑', scope); | 403 | console.log('编辑', scope); |
| 411 | drawerInfo.value.visible = true | 404 | // 路由跳转configure-rules |
| 405 | router.push({ | ||
| 406 | name: 'configureRules', | ||
| 407 | query: { | ||
| 408 | cgDirName: scope.row.cgDirName, | ||
| 409 | tableName: scope.row.tableName, | ||
| 410 | tableChName: scope.row.tableChName, | ||
| 411 | guid: scope.row.guid, | ||
| 412 | description: scope.row.description, | ||
| 413 | } | ||
| 414 | }); | ||
| 412 | } | 415 | } |
| 413 | }, | 416 | }, |
| 414 | 417 | ||
| 415 | { | 418 | { |
| 416 | label: "复制", value: "copy", click: (scope) => { | 419 | label: "编辑表结构", value: "copy", click: (scope) => { |
| 417 | console.log('复制', scope); | 420 | console.log('复制', scope); |
| 418 | } | 421 | } |
| 419 | }, | ||
| 420 | { | ||
| 421 | label: "删除 ", value: "delete", click: (scope) => { | ||
| 422 | console.log('删除', scope); | ||
| 423 | } | 422 | } |
| 424 | }, | ||
| 425 | ] | 423 | ] |
| 426 | 424 | ||
| 427 | }, | 425 | }, |
| ... | @@ -429,36 +427,17 @@ const tableInfo = ref({ | ... | @@ -429,36 +427,17 @@ const tableInfo = ref({ |
| 429 | }); | 427 | }); |
| 430 | 428 | ||
| 431 | 429 | ||
| 432 | const nodeClick = (data: any) => { | ||
| 433 | const { guid, standardName } = data | ||
| 434 | console.log('nodeClick', guid, standardName); | ||
| 435 | searchItemList.value[0].default = standardName; | ||
| 436 | // 递归tempData找到所有祖先元素的standardName,存入currentPath中 | ||
| 437 | const path = findPath(tempData, guid); | ||
| 438 | if (path) { | ||
| 439 | currentPath.value = path; | ||
| 440 | console.log('找到路径:', path); | ||
| 441 | } else { | ||
| 442 | console.error('未找到路径'); | ||
| 443 | } | ||
| 444 | 430 | ||
| 445 | } | ||
| 446 | const findPath = (data: any[], targetGuid: string, path: string[] = []) => { | ||
| 447 | for (const item of data) { | ||
| 448 | path.push(item.standardName); // 添加当前节点名称 | ||
| 449 | if (item.guid === targetGuid) { | ||
| 450 | return path; // 找到目标节点,返回路径 | ||
| 451 | } | ||
| 452 | if (item.children && item.children.length > 0) { | ||
| 453 | const result = findPath(item.children, targetGuid, path); | ||
| 454 | if (result) return result; // 子节点找到目标节点,返回路径 | ||
| 455 | } | ||
| 456 | path.pop(); // 回溯,移除当前节点 | ||
| 457 | } | ||
| 458 | return null; // 未找到目标节点 | ||
| 459 | }; | ||
| 460 | 431 | ||
| 461 | 432 | ||
| 433 | // 映射 大于,小于,等于 三种关系 | ||
| 434 | const selectLength = ref([ | ||
| 435 | { label: '大于', value: '>', }, | ||
| 436 | { label: '小于', value: '<', }, | ||
| 437 | { label: '等于', value: '=', }, | ||
| 438 | ] | ||
| 439 | ) | ||
| 440 | |||
| 462 | const classEditFormItems = ref([{ | 441 | const classEditFormItems = ref([{ |
| 463 | label: '已选字段', | 442 | label: '已选字段', |
| 464 | type: 'input', | 443 | type: 'input', |
| ... | @@ -468,14 +447,14 @@ const classEditFormItems = ref([{ | ... | @@ -468,14 +447,14 @@ const classEditFormItems = ref([{ |
| 468 | default: '', | 447 | default: '', |
| 469 | clearable: true, | 448 | clearable: true, |
| 470 | required: true, | 449 | required: true, |
| 471 | block: true | 450 | block: true, |
| 451 | disabled: true, | ||
| 472 | }, { | 452 | }, { |
| 473 | label: '长度', | 453 | label: '长度', |
| 474 | type: 'input', | 454 | type: 'select', |
| 475 | placeholder: '请选择', | 455 | placeholder: '请选择', |
| 476 | field: 'orderNum', | 456 | field: 'orderNumLength', |
| 477 | maxlength: 6, | 457 | options: selectLength.value, |
| 478 | regexp: /\D/g, | ||
| 479 | required: true, | 458 | required: true, |
| 480 | clearable: true, | 459 | clearable: true, |
| 481 | }, | 460 | }, |
| ... | @@ -494,31 +473,21 @@ const classEditFormItems = ref([{ | ... | @@ -494,31 +473,21 @@ const classEditFormItems = ref([{ |
| 494 | label: '精度', | 473 | label: '精度', |
| 495 | type: 'input', | 474 | type: 'input', |
| 496 | placeholder: '请选择', | 475 | placeholder: '请选择', |
| 497 | field: 'orderNum', | 476 | field: 'fieldPrecision', |
| 498 | maxlength: 6, | ||
| 499 | regexp: /\D/g, | ||
| 500 | required: true, | ||
| 501 | clearable: true, | ||
| 502 | }, | ||
| 503 | { | ||
| 504 | label: '', | ||
| 505 | type: 'input', | ||
| 506 | placeholder: '请输入', | ||
| 507 | field: 'orderNum', | ||
| 508 | maxlength: 6, | 477 | maxlength: 6, |
| 509 | regexp: /\D/g, | 478 | regexp: /\D/g, |
| 510 | required: true, | 479 | required: true, |
| 511 | clearable: true, | 480 | clearable: true, |
| 512 | col: 'numberClass', | 481 | block: true, |
| 513 | }, { | 482 | }, { |
| 514 | label: '关联字典', | 483 | label: '关联字典', |
| 515 | field: 'parentGuid', | 484 | field: 'dictionaryGuid', |
| 516 | type: 'select', | 485 | type: 'select', |
| 517 | placeholder: '请选择', | 486 | placeholder: '请选择', |
| 518 | default: '', | 487 | default: '', |
| 519 | options: [], | 488 | options: [], |
| 520 | props: { | 489 | props: { |
| 521 | label: "classifyName", | 490 | label: "chName", |
| 522 | value: "guid", | 491 | value: "guid", |
| 523 | }, | 492 | }, |
| 524 | filterable: true, | 493 | filterable: true, |
| ... | @@ -529,7 +498,7 @@ const classEditFormItems = ref([{ | ... | @@ -529,7 +498,7 @@ const classEditFormItems = ref([{ |
| 529 | label: '字段取值范围', | 498 | label: '字段取值范围', |
| 530 | type: 'input-group', | 499 | type: 'input-group', |
| 531 | placeholder: '请输入', | 500 | placeholder: '请输入', |
| 532 | field: 'numberAround', | 501 | field: 'fieldValueRange', |
| 533 | default: '', | 502 | default: '', |
| 534 | children: [ | 503 | children: [ |
| 535 | { | 504 | { |
| ... | @@ -555,26 +524,31 @@ const classEditFormItems = ref([{ | ... | @@ -555,26 +524,31 @@ const classEditFormItems = ref([{ |
| 555 | { | 524 | { |
| 556 | label: '数据是否唯一', | 525 | label: '数据是否唯一', |
| 557 | type: "radio-group", | 526 | type: "radio-group", |
| 558 | field: "radioField", | 527 | field: "isUnique", |
| 559 | disabled: false, | 528 | disabled: false, |
| 529 | default: 'N', | ||
| 560 | options: [ | 530 | options: [ |
| 561 | { label: "选项一", value: "option1", disabled: false }, | 531 | { label: "是", value: "Y", disabled: false }, |
| 562 | { label: "选项二", value: "option2", disabled: false }, | 532 | { label: "否", value: "N", disabled: false }, |
| 563 | ], | 533 | ], |
| 564 | }, | 534 | }, |
| 565 | { | 535 | { |
| 566 | label: '是否必填', | 536 | label: '是否必填', |
| 567 | type: "radio-group", | 537 | type: "radio-group", |
| 568 | field: "radioField", | 538 | field: "isNotNull", |
| 569 | disabled: false, | 539 | disabled: false, |
| 540 | default: 'N', | ||
| 570 | options: [ | 541 | options: [ |
| 571 | { label: "选项一", value: "option1", disabled: false }, | 542 | { label: "是", value: "Y", disabled: false }, |
| 572 | { label: "选项二", value: "option2", disabled: false }, | 543 | { label: "否", value: "N", disabled: false }, |
| 573 | ], | 544 | ], |
| 574 | } | 545 | } |
| 575 | ]); | 546 | ]); |
| 576 | const classEditFormRules = ref({ | 547 | const classEditFormRules = ref({ |
| 577 | classifyName: [{ required: true, message: '请填写分类名称', trigger: 'blur' }], | 548 | classifyName: [{ required: true, message: '请填写分类名称', trigger: 'blur' }], |
| 549 | orderNumLength: [{ required: true, message: '请选择长度', trigger: 'blur' }], | ||
| 550 | orderNum: [{ required: true, message: '请填写长度', trigger: 'blur' }], | ||
| 551 | fieldPrecision: [{ required: true, message: '请填写精度', trigger: 'blur' }], | ||
| 578 | }); | 552 | }); |
| 579 | /** 新增分类的form */ | 553 | /** 新增分类的form */ |
| 580 | const classEditFormInfo = ref({ | 554 | const classEditFormInfo = ref({ |
| ... | @@ -611,73 +585,258 @@ const drawerBtnClick = async (btn, info) => { | ... | @@ -611,73 +585,258 @@ const drawerBtnClick = async (btn, info) => { |
| 611 | if (btn.value == 'cancel') { | 585 | if (btn.value == 'cancel') { |
| 612 | drawerInfo.value.visible = false; | 586 | drawerInfo.value.visible = false; |
| 613 | } else { | 587 | } else { |
| 614 | // if (drawerInfo.value.header.title == '添加分类') { | 588 | btn.loading = true; |
| 615 | // const params = { | 589 | const { orderNumLength, orderNum, numberStart, numberEnd, fieldPrecision, dictionaryGuid, isUnique, isNotNull } = info; |
| 616 | // ...info, | 590 | let fieldLengthCondition = orderNumLength + '#' + orderNum; |
| 617 | // classifyGradeGuid: router.currentRoute.value.query.guid, | 591 | let fieldValueRange: any = []; |
| 618 | // } | 592 | if (numberStart && numberEnd) { |
| 619 | // const res: any = await saveClassify(params); | 593 | if (numberEnd < numberStart) { |
| 620 | // if (res.code == proxy.$passCode) { | 594 | proxy.$ElMessage.error('字段取值范围结束值不能小于开始值'); |
| 621 | // proxy.$ElMessage.success('添加成功!'); | 595 | return; |
| 622 | // drawerInfo.value.visible = false; | 596 | } |
| 623 | // getTreeListData(); | 597 | fieldValueRange = [numberStart, numberEnd]; |
| 624 | // } else { | 598 | } |
| 625 | // proxy.$ElMessage.error(res.msg); | 599 | const params = { |
| 626 | // } | 600 | fieldPrecision, |
| 627 | // } else { | 601 | dictionaryGuid, |
| 628 | // // 编辑分类 | 602 | isUnique, |
| 629 | // const params = { | 603 | isNotNull, |
| 630 | // ...info, | 604 | fieldLengthCondition, |
| 631 | // classifyGradeGuid: router.currentRoute.value.query.guid, | 605 | fieldValueRange, |
| 632 | // guid: currTableInfo.value.guid | 606 | fieldGuid: selectedRulesData.value.guids |
| 633 | // } | 607 | } |
| 634 | // const res: any = await updateClassify(params); | 608 | const res: any = await saveBizRuleConfig(params); |
| 635 | // if (res.code == proxy.$passCode) { | 609 | if (res.code == proxy.$passCode) { |
| 636 | // proxy.$ElMessage.success('修改成功!'); | 610 | btn.loading = false; |
| 637 | // drawerInfo.value.visible = false; | 611 | proxy.$ElMessage.success('配置成功!'); |
| 638 | // getTreeListData(); | 612 | drawerInfo.value.visible = false; |
| 639 | // } else { | 613 | getCgDirFieldPage(); |
| 640 | // proxy.$ElMessage.error(res.msg); | 614 | } else { |
| 641 | // } | 615 | proxy.$ElMessage.error(res.msg); |
| 642 | // } | 616 | } |
| 643 | console.log('aaa') | 617 | |
| 618 | |||
| 644 | } | 619 | } |
| 645 | } | 620 | } |
| 646 | 621 | ||
| 647 | const handleTreeItemMenuClick = (data: any, type) => { | 622 | const handleTreeItemMenuClick = (data: any, type) => { |
| 648 | console.log('handleTreeItemMenuClick', data, type); | 623 | console.log('handleTreeItemMenuClick', data, type); |
| 649 | } | 624 | } |
| 650 | const getItemStyle = (status: string) => { | ||
| 651 | const styles: { [key: string]: any } = { | ||
| 652 | published: { | ||
| 653 | color: '#1BA854', | ||
| 654 | background: '#F2FFF5', | ||
| 655 | border: '1px solid rgba(109, 209, 142, 1)', | ||
| 656 | }, | ||
| 657 | running: { | ||
| 658 | color: '#FF991C', | ||
| 659 | background: '#FFFBF2', | ||
| 660 | border: '1px solid rgba(255, 203, 120, 1)', | ||
| 661 | }, | ||
| 662 | pending: { | ||
| 663 | border: '1px solid rgba(217, 217, 217, 1)', | ||
| 664 | color: '#404040', | ||
| 665 | background: '#F5F5F5', | ||
| 666 | }, | ||
| 667 | }; | ||
| 668 | 625 | ||
| 669 | return styles[status] || {}; // 如果状态没有对应的样式,则返回空对象 | ||
| 670 | } | ||
| 671 | 626 | ||
| 672 | 627 | ||
| 628 | // tab切换 | ||
| 673 | const activeName = ref('first'); | 629 | const activeName = ref('first'); |
| 674 | const handleClick = (tab: any) => { | 630 | const handleClick = (tab: any) => { |
| 675 | console.log(tab.props.name); | 631 | console.log(tab.props.name); |
| 676 | activeName.value = tab.props.name; | 632 | activeName.value = tab.props.name; |
| 633 | if (tab.props.name === 'second') { | ||
| 634 | getDataBaseTreeData(); | ||
| 635 | getDataBaseTableData(); | ||
| 636 | getDataBaseFieldData(); | ||
| 637 | } | ||
| 638 | } | ||
| 639 | |||
| 640 | // 获取数据库树形列表 getDbDirTreeList | ||
| 641 | const dataBaseTreeData = ref<any>(); | ||
| 642 | const getDataBaseTreeData = async () => { | ||
| 643 | dataBaseTreeInfo.value.loading = true; | ||
| 644 | try { | ||
| 645 | const res: any = await getDbDirTreeList({}); | ||
| 646 | if (res.code == proxy.$passCode) { | ||
| 647 | const dataArray = [res.data]; | ||
| 648 | // 遍历并添加 GUIDs | ||
| 649 | dataArray.forEach(addGuids); | ||
| 650 | // 更新到绑定的响应式数据 | ||
| 651 | dataBaseTreeData.value = dataArray; | ||
| 652 | dataBaseTreeInfo.value.data = dataArray; | ||
| 653 | } else { | ||
| 654 | proxy.$ElMessage.error(res.msg); | ||
| 655 | } | ||
| 656 | } catch (error) { | ||
| 657 | proxy.$ElMessage.error('请求失败'); | ||
| 658 | } finally { | ||
| 659 | dataBaseTreeInfo.value.loading = false; | ||
| 660 | } | ||
| 661 | }; | ||
| 662 | // 处理数据,给每个节点添加 GUID | ||
| 663 | const addGuids = (node) => { | ||
| 664 | if (node.databaseGuid) { | ||
| 665 | node.guid = node.databaseGuid; | ||
| 666 | node.name = node.databaseChName; | ||
| 667 | } else if (node.tableGuid) { | ||
| 668 | node.guid = node.tableGuid; | ||
| 669 | node.name = node.tableChName; | ||
| 670 | } else { | ||
| 671 | node.guid = crypto.randomUUID(); | ||
| 672 | node.name = node.cgDirName; | ||
| 673 | } | ||
| 674 | |||
| 675 | if (node.children && Array.isArray(node.children)) { | ||
| 676 | node.children.forEach(addGuids); | ||
| 677 | } | ||
| 678 | }; | ||
| 679 | |||
| 680 | |||
| 681 | // 获取数据列表 | ||
| 682 | const dataBaseTableDataList = ref<any>(); | ||
| 683 | const getDataBaseTableData = async (params = {}) => { | ||
| 684 | dataBaseTableInfo.value.loading = true; | ||
| 685 | const dataBaseParams = { | ||
| 686 | pageIndex: 1, | ||
| 687 | pageSize: 10, | ||
| 688 | databaseGuid: "", | ||
| 689 | isDataAsset: checked.value ? 'Y' : 'N', | ||
| 690 | execGuid: execGuidInfo.value.execGuid, | ||
| 691 | }; | ||
| 692 | const finalParams = { ...dataBaseParams, ...params }; | ||
| 693 | |||
| 694 | const res: any = await getDbDirTablePageList(finalParams); | ||
| 695 | if (res.code == proxy.$passCode) { | ||
| 696 | dataBaseTableDataList.value = res.data.records; | ||
| 697 | dataBaseTableInfo.value.page.rows = res.data.totalRows; | ||
| 698 | dataBaseTableInfo.value.data = res.data.records; | ||
| 699 | dataBasePage.value.limit = res.data.pageSize | ||
| 700 | dataBasePage.value.curr = res.data.pageIndex | ||
| 701 | } else { | ||
| 702 | proxy.$ElMessage.error(res.msg); | ||
| 703 | } | ||
| 704 | dataBaseTableInfo.value.loading = false; | ||
| 705 | }; | ||
| 706 | |||
| 707 | const dataBaseTablePageChange = (info) => { | ||
| 708 | console.log('dataBaseTablePageChange', info); | ||
| 709 | dataBasePage.value.curr = Number(info.curr); | ||
| 710 | dataBasePage.value.limit = Number(info.limit); | ||
| 711 | getDataBaseTableData({ | ||
| 712 | pageIndex: info.curr, | ||
| 713 | pageSize: info.limit | ||
| 714 | }); | ||
| 715 | } | ||
| 716 | |||
| 717 | |||
| 718 | // 获取字段信息getDbDirFieldPageList | ||
| 719 | const tableFieldsLoading = ref(false); | ||
| 720 | const tableFieldsData = ref([]); | ||
| 721 | const getDataBaseFieldData = async (params = {}) => { | ||
| 722 | tableFieldsLoading.value = true; | ||
| 723 | const dataBaseParams = { | ||
| 724 | pageIndex: 1, | ||
| 725 | pageSize: 10, | ||
| 726 | tableGuid: "", | ||
| 727 | execGuid: execGuidInfo.value.execGuid, | ||
| 728 | databaseGuid: "", | ||
| 729 | isDataAsset: checked.value ? 'Y' : 'N', | ||
| 730 | }; | ||
| 731 | const finalParams = { ...dataBaseParams, ...params }; | ||
| 732 | |||
| 733 | const res: any = await getDbDirFieldPageList(finalParams); | ||
| 734 | if (res.code == proxy.$passCode) { | ||
| 735 | tableFieldsData.value = res.data.records; | ||
| 736 | tableFieldsDataInfo.value.data = res.data.records; | ||
| 737 | } else { | ||
| 738 | proxy.$ElMessage.error(res.msg); | ||
| 739 | } | ||
| 740 | tableFieldsLoading.value = false; | ||
| 741 | }; | ||
| 742 | |||
| 743 | const tableFieldsDataInfo = ref({ | ||
| 744 | id: "data-field-table", | ||
| 745 | multiple: false, | ||
| 746 | fixedSelection: true, | ||
| 747 | fields: [ | ||
| 748 | { label: "序号", type: "index", width: 56, align: "center" }, | ||
| 749 | { label: "字段名", field: "fieldName", width: 140 }, | ||
| 750 | { label: "字段中文名", field: "fieldChName", width: 180 }, | ||
| 751 | { label: "表名", field: "tableName", width: 120 }, | ||
| 752 | { label: "表中文名", field: "tableChName", width: 140, }, | ||
| 753 | { label: "数据库名称", field: "database", width: 120 }, | ||
| 754 | { label: "数据库中文名", field: "databaseChName", width: TableColumnWidth.DATETIME }, | ||
| 755 | { label: "分类", field: "description", width: 120, align: 'center' }, | ||
| 756 | { label: "分级", field: "isDataAsset", width: 120, align: 'center' }, | ||
| 757 | { label: "标签", field: "label", width: 120, align: 'center' }, | ||
| 758 | ], | ||
| 759 | data: [], | ||
| 760 | showPage: false, | ||
| 761 | page: { | ||
| 762 | // type: "normal", | ||
| 763 | // rows: 0, | ||
| 764 | // ...dataBasePage.value, | ||
| 765 | |||
| 766 | }, | ||
| 767 | actionInfo: { | ||
| 768 | show: false, | ||
| 769 | }, | ||
| 770 | loading: false | ||
| 771 | }); | ||
| 772 | |||
| 773 | |||
| 774 | const showTableOrDatabase = ref(true); | ||
| 775 | // 定义tableGuid | ||
| 776 | const tableGuid = ref(''); | ||
| 777 | const dataBaseGuid = ref(''); | ||
| 778 | |||
| 779 | const dataBasenodeClick = (data: any) => { | ||
| 780 | console.log('dataBasenodeClick', data); | ||
| 781 | if (data.cgDirName) { | ||
| 782 | tableGuid.value = ''; | ||
| 783 | dataBaseGuid.value = ''; | ||
| 784 | getDataBaseFieldData(); | ||
| 785 | getDataBaseTableData(); | ||
| 786 | } | ||
| 787 | if (data.databaseGuid) { | ||
| 788 | dataBaseGuid.value = data.databaseGuid; | ||
| 789 | tableGuid.value = ''; | ||
| 790 | getDataBaseFieldData({ | ||
| 791 | databaseGuid: data.databaseGuid | ||
| 792 | }); | ||
| 793 | getDataBaseTableData({ | ||
| 794 | databaseGuid: data.databaseGuid | ||
| 795 | }); | ||
| 796 | } | ||
| 797 | if (data.tableGuid) { | ||
| 798 | tableGuid.value = data.tableGuid; | ||
| 799 | dataBaseGuid.value = ''; | ||
| 800 | getDataBaseFieldData({ | ||
| 801 | tableGuid: data.tableGuid | ||
| 802 | }); | ||
| 803 | getDataBaseTableData({ | ||
| 804 | tableGuid: data.tableGuid | ||
| 805 | }); | ||
| 806 | } | ||
| 807 | |||
| 808 | if (data.databaseGuid || data.cgDirName) { | ||
| 809 | showTableOrDatabase.value = true; | ||
| 810 | return; | ||
| 811 | } | ||
| 812 | if (data.tableGuid) { | ||
| 813 | showTableOrDatabase.value = false; | ||
| 814 | return; | ||
| 815 | } | ||
| 816 | } | ||
| 817 | |||
| 818 | const nodeSelectChange = (data: any) => { | ||
| 819 | console.log('nodeSelectChange', data); | ||
| 677 | } | 820 | } |
| 678 | 821 | ||
| 679 | const handleSubjectTableCommand = (command: string) => { | 822 | const handleSubjectTableCommand = (command: string) => { |
| 680 | console.log('handleSubjectTableCommand', command); | 823 | console.log('handleSubjectTableCommand', command); |
| 824 | if (command === 'manualCreate') { | ||
| 825 | router.push({ | ||
| 826 | name: 'tableCreateFile', | ||
| 827 | query: { | ||
| 828 | type: 'tableCreateFile' | ||
| 829 | } | ||
| 830 | }); | ||
| 831 | } else if (command === 'existingCreate') { | ||
| 832 | // 已有表新建 | ||
| 833 | router.push({ | ||
| 834 | name: 'tableCreateExisting', | ||
| 835 | query: { | ||
| 836 | execGuid: execGuidInfo.value.execGuid | ||
| 837 | } | ||
| 838 | }); | ||
| 839 | } | ||
| 681 | } | 840 | } |
| 682 | 841 | ||
| 683 | // 文字提示区域 | 842 | // 文字提示区域 |
| ... | @@ -691,13 +850,112 @@ const addIsShowDatabaseTip = () => { | ... | @@ -691,13 +850,112 @@ const addIsShowDatabaseTip = () => { |
| 691 | isShowDatabaseTip.value = false; | 850 | isShowDatabaseTip.value = false; |
| 692 | } | 851 | } |
| 693 | 852 | ||
| 853 | // 表信息和字段信息切换 | ||
| 854 | const activeTab = ref('table'); | ||
| 855 | |||
| 856 | const setActiveTab = (tab) => { | ||
| 857 | console.log('setActiveTab', tab); | ||
| 858 | activeTab.value = tab; | ||
| 859 | }; | ||
| 860 | |||
| 861 | // 模拟后端接口 | ||
| 862 | const fetchOptionsA = () => { | ||
| 863 | return new Promise((resolve) => { | ||
| 864 | setTimeout(() => { | ||
| 865 | resolve([ | ||
| 866 | { label: "选项 A1", value: "a1" }, | ||
| 867 | { label: "选项 A2", value: "a2" }, | ||
| 868 | ]); | ||
| 869 | }, 500); | ||
| 870 | }); | ||
| 871 | }; | ||
| 872 | |||
| 873 | const fetchOptionsB = (aValue) => { | ||
| 874 | return new Promise((resolve) => { | ||
| 875 | setTimeout(() => { | ||
| 876 | const data = { | ||
| 877 | a1: [ | ||
| 878 | { label: "B1-1", value: "b1" }, | ||
| 879 | { label: "B1-2", value: "b2" }, | ||
| 880 | ], | ||
| 881 | a2: [ | ||
| 882 | { label: "B2-1", value: "b3" }, | ||
| 883 | { label: "B2-2", value: "b4" }, | ||
| 884 | ], | ||
| 885 | }; | ||
| 886 | resolve(data[aValue] || []); | ||
| 887 | }, 500); | ||
| 888 | }); | ||
| 889 | }; | ||
| 890 | |||
| 891 | const fetchOptionsC = (bValue) => { | ||
| 892 | return new Promise((resolve) => { | ||
| 893 | setTimeout(() => { | ||
| 894 | const data = { | ||
| 895 | b1: [ | ||
| 896 | { label: "C1-1", value: "c1" }, | ||
| 897 | { label: "C1-2", value: "c2" }, | ||
| 898 | ], | ||
| 899 | b3: [ | ||
| 900 | { label: "C2-1", value: "c3" }, | ||
| 901 | { label: "C2-2", value: "c4" }, | ||
| 902 | ], | ||
| 903 | }; | ||
| 904 | resolve(data[bValue] || []); | ||
| 905 | }, 500); | ||
| 906 | }); | ||
| 907 | }; | ||
| 908 | |||
| 909 | const selectedA = ref<any>(null); | ||
| 910 | const selectedB = ref<any>(null); | ||
| 911 | const selectedC = ref<any>(null); | ||
| 912 | |||
| 913 | const optionsA = ref<any>([]); | ||
| 914 | const optionsB = ref<any>([]); | ||
| 915 | const optionsC = ref<any>([]); | ||
| 916 | |||
| 917 | // 初始化加载第一个下拉框的选项 | ||
| 918 | const loadOptionsA = async () => { | ||
| 919 | optionsA.value = await fetchOptionsA(); | ||
| 920 | }; | ||
| 921 | |||
| 922 | // 第一个下拉框值改变时 | ||
| 923 | const onAChange = async () => { | ||
| 924 | selectedB.value = null; | ||
| 925 | selectedC.value = null; | ||
| 926 | optionsB.value = []; | ||
| 927 | optionsC.value = []; | ||
| 928 | optionsB.value = await fetchOptionsB(selectedA.value); // 根据 A 动态加载 B 的选项 | ||
| 929 | }; | ||
| 930 | |||
| 931 | // 第二个下拉框值改变时 | ||
| 932 | const onBChange = async () => { | ||
| 933 | selectedC.value = null; | ||
| 934 | optionsC.value = []; | ||
| 935 | optionsC.value = await fetchOptionsC(selectedB.value); // 根据 B 动态加载 C 的选项 | ||
| 936 | }; | ||
| 937 | |||
| 938 | // 页面加载时初始化 A 的数据 | ||
| 939 | loadOptionsA(); | ||
| 940 | |||
| 694 | </script> | 941 | </script> |
| 695 | 942 | ||
| 696 | <template> | 943 | <template> |
| 697 | <div class="classification-template-content"> | 944 | <div class="classification-template-content"> |
| 698 | <div class="v-table-tools"> | 945 | <div class="v-table-tools"> |
| 699 | <TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch" | 946 | <el-select v-model="selectedA" placeholder="选择数据库名" @change="onAChange" style="width: 140px; margin-right: 8px" |
| 700 | @treeSelectNodeChange="treeSelectNodeChange" /> | 947 | clearable> |
| 948 | <el-option v-for="item in optionsA" :key="item.value" :label="item.label" :value="item.value" /> | ||
| 949 | </el-select> | ||
| 950 | <el-select v-model="selectedB" placeholder="选择表名" :disabled="!selectedA" @change="onBChange" | ||
| 951 | style="width: 140px; margin-right: 8px" clearable> | ||
| 952 | <el-option v-for="item in optionsB" :key="item.value" :label="item.label" :value="item.value" /> | ||
| 953 | </el-select> | ||
| 954 | <el-select v-model="selectedC" placeholder="选择字段名" :disabled="!selectedB" style="width: 140px;margin-right: 8px" | ||
| 955 | clearable> | ||
| 956 | <el-option v-for="item in optionsC" :key="item.value" :label="item.label" :value="item.value" /> | ||
| 957 | </el-select> | ||
| 958 | <TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch" /> | ||
| 701 | </div> | 959 | </div> |
| 702 | <div class="container_wrap full flex"> | 960 | <div class="container_wrap full flex"> |
| 703 | <div class="aside_wrap"> | 961 | <div class="aside_wrap"> |
| ... | @@ -705,7 +963,9 @@ const addIsShowDatabaseTip = () => { | ... | @@ -705,7 +963,9 @@ const addIsShowDatabaseTip = () => { |
| 705 | <el-tab-pane label="分类分级目录" name="first"> | 963 | <el-tab-pane label="分类分级目录" name="first"> |
| 706 | <Tree :treeInfo="treeInfo" @nodeClick="nodeClick" @itemMenuClick="handleTreeItemMenuClick" /> | 964 | <Tree :treeInfo="treeInfo" @nodeClick="nodeClick" @itemMenuClick="handleTreeItemMenuClick" /> |
| 707 | </el-tab-pane> | 965 | </el-tab-pane> |
| 708 | <el-tab-pane label="数据库目录" name="second">Config</el-tab-pane> | 966 | <el-tab-pane label="数据库目录" name="second"> |
| 967 | <Tree :treeInfo="dataBaseTreeInfo" @nodeClick="dataBasenodeClick" @nodeSelectChange='nodeSelectChange' /> | ||
| 968 | </el-tab-pane> | ||
| 709 | </el-tabs> | 969 | </el-tabs> |
| 710 | </div> | 970 | </div> |
| 711 | <div class="main_wrap" v-if="activeName === 'first'"> | 971 | <div class="main_wrap" v-if="activeName === 'first'"> |
| ... | @@ -732,11 +992,13 @@ const addIsShowDatabaseTip = () => { | ... | @@ -732,11 +992,13 @@ const addIsShowDatabaseTip = () => { |
| 732 | <div class="left-btns"> | 992 | <div class="left-btns"> |
| 733 | <el-button type="primary" @click="addStandardSet">查看已生产报告</el-button> | 993 | <el-button type="primary" @click="addStandardSet">查看已生产报告</el-button> |
| 734 | <el-button>导出</el-button> | 994 | <el-button>导出</el-button> |
| 735 | <el-button>批量配置业务规则</el-button> | 995 | <el-button @click="batchControlRules">批量配置业务规则</el-button> |
| 736 | </div> | 996 | </div> |
| 737 | </div> | 997 | </div> |
| 738 | <div class="table_panel_wrap"> | 998 | <div class="table_panel_wrap"> |
| 739 | <Table :tableInfo="tableInfo" /> | 999 | <Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" |
| 1000 | @tableCheckboxSelectChange="tableCheckboxSelectChange" | ||
| 1001 | @tableCheckboxAllSelectChange="tableCheckboxAllSelectChange" /> | ||
| 740 | </div> | 1002 | </div> |
| 741 | </div> | 1003 | </div> |
| 742 | 1004 | ||
| ... | @@ -755,7 +1017,20 @@ const addIsShowDatabaseTip = () => { | ... | @@ -755,7 +1017,20 @@ const addIsShowDatabaseTip = () => { |
| 755 | </el-button> | 1017 | </el-button> |
| 756 | </div> | 1018 | </div> |
| 757 | <div>全部</div> | 1019 | <div>全部</div> |
| 758 | <div class="btns-area"> | 1020 | <div class="tab-btn"> |
| 1021 | 内容信息: | ||
| 1022 | <div v-if="showTableOrDatabase" class="table" :class="{ active: activeTab === 'table' }" | ||
| 1023 | @click="setActiveTab('table')"> | ||
| 1024 | 表信息 | ||
| 1025 | </div> | ||
| 1026 | <div class="word" :class="{ active: activeTab === 'word' || !showTableOrDatabase }" | ||
| 1027 | @click="setActiveTab('word')"> | ||
| 1028 | 字段信息 | ||
| 1029 | </div> | ||
| 1030 | </div> | ||
| 1031 | |||
| 1032 | |||
| 1033 | <div class="btns-area" v-if="!tableGuid && activeTab === 'table'"> | ||
| 759 | <div class="left-btns"> | 1034 | <div class="left-btns"> |
| 760 | <div class="dropdown_btn"> | 1035 | <div class="dropdown_btn"> |
| 761 | <el-dropdown popper-class="table-create-menu" @command="handleSubjectTableCommand" | 1036 | <el-dropdown popper-class="table-create-menu" @command="handleSubjectTableCommand" |
| ... | @@ -792,15 +1067,16 @@ const addIsShowDatabaseTip = () => { | ... | @@ -792,15 +1067,16 @@ const addIsShowDatabaseTip = () => { |
| 792 | <el-button>查看质量规则</el-button> | 1067 | <el-button>查看质量规则</el-button> |
| 793 | </div> | 1068 | </div> |
| 794 | <div class="right-btns"> | 1069 | <div class="right-btns"> |
| 795 | <el-checkbox v-model="checked1" label="仅看规划数据资产表" size="large" /> | 1070 | <el-checkbox v-model="checked" label="仅看规划数据资产表" size="large" @change="changeCheck" /> |
| 796 | </div> | 1071 | </div> |
| 797 | </div> | 1072 | </div> |
| 798 | <div class="table_panel_wrap_database"> | 1073 | <div class="table_panel_wrap_database" v-if="!tableGuid && activeTab === 'table'"> |
| 799 | <Table :tableInfo="tableInfo" /> | 1074 | <Table :tableInfo="dataBaseTableInfo" @tablePageChange="dataBaseTablePageChange" /> |
| 1075 | </div> | ||
| 1076 | <div class="table_field" v-if="tableGuid || activeTab === 'word'"> | ||
| 1077 | <Table :tableInfo="tableFieldsDataInfo" :loading="tableFieldsLoading" /> | ||
| 800 | </div> | 1078 | </div> |
| 801 | </div> | 1079 | </div> |
| 802 | |||
| 803 | <Dialog :dialogInfo="standardSetDialogInfo" @btnClick="standardSetDialogBtnClick" /> | ||
| 804 | <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" class="v-drawer" /> | 1080 | <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" class="v-drawer" /> |
| 805 | 1081 | ||
| 806 | </div> | 1082 | </div> |
| ... | @@ -817,6 +1093,8 @@ const addIsShowDatabaseTip = () => { | ... | @@ -817,6 +1093,8 @@ const addIsShowDatabaseTip = () => { |
| 817 | flex-direction: column; | 1093 | flex-direction: column; |
| 818 | 1094 | ||
| 819 | .v-table-tools { | 1095 | .v-table-tools { |
| 1096 | display: flex; | ||
| 1097 | align-items: center; | ||
| 820 | padding: 8px 12px; | 1098 | padding: 8px 12px; |
| 821 | } | 1099 | } |
| 822 | 1100 | ||
| ... | @@ -830,23 +1108,39 @@ const addIsShowDatabaseTip = () => { | ... | @@ -830,23 +1108,39 @@ const addIsShowDatabaseTip = () => { |
| 830 | border-right: 1px solid #d9d9d9; | 1108 | border-right: 1px solid #d9d9d9; |
| 831 | box-shadow: none; | 1109 | box-shadow: none; |
| 832 | 1110 | ||
| 833 | :deep(.v-tabs) { | 1111 | :deep(.el-tabs__item) { |
| 834 | .el-tabs__item { | 1112 | padding: 0 8px; |
| 835 | padding: 0 10px; | 1113 | } |
| 1114 | |||
| 1115 | |||
| 1116 | .v-tabs { | ||
| 1117 | height: 100%; | ||
| 1118 | |||
| 1119 | .el-tabs__content { | ||
| 1120 | height: 100%; | ||
| 1121 | |||
| 1122 | .el-tab-pane { | ||
| 1123 | height: 100%; | ||
| 836 | } | 1124 | } |
| 837 | } | 1125 | } |
| 838 | 1126 | ||
| 1127 | // :deep(.v-tabs) { | ||
| 1128 | // .el-tabs__item { | ||
| 1129 | // padding: 0 12px; | ||
| 1130 | // } | ||
| 1131 | // } | ||
| 1132 | |||
| 839 | .tree_panel { | 1133 | .tree_panel { |
| 840 | height: 100%; | 1134 | height: 100%; |
| 841 | padding-top: 0; | 1135 | padding-top: 0; |
| 842 | 1136 | ||
| 843 | :deep(.el-tree) { | 1137 | :deep(.el-tree) { |
| 844 | margin: 0; | 1138 | margin: 0; |
| 845 | height: calc(100% - 68px); | 1139 | height: calc(100% - 115px); |
| 846 | overflow: hidden auto; | 1140 | overflow: hidden auto; |
| 847 | } | 1141 | } |
| 848 | } | 1142 | } |
| 849 | 1143 | } | |
| 850 | } | 1144 | } |
| 851 | 1145 | ||
| 852 | .main_wrap { | 1146 | .main_wrap { |
| ... | @@ -915,17 +1209,66 @@ const addIsShowDatabaseTip = () => { | ... | @@ -915,17 +1209,66 @@ const addIsShowDatabaseTip = () => { |
| 915 | 1209 | ||
| 916 | .table_panel_wrap { | 1210 | .table_panel_wrap { |
| 917 | width: 100%; | 1211 | width: 100%; |
| 918 | height: calc(100% - 113px); | 1212 | height: calc(100% - 175px); |
| 919 | min-height: 210px; | 1213 | min-height: 210px; |
| 920 | overflow: visible; | 1214 | overflow: visible; |
| 921 | } | 1215 | } |
| 922 | 1216 | ||
| 923 | .table_panel_wrap_database { | 1217 | .table_panel_wrap_database { |
| 924 | width: 100%; | 1218 | width: 100%; |
| 925 | height: calc(100% - 113px); | 1219 | height: calc(100% - 215px); |
| 926 | min-height: 210px; | 1220 | min-height: 210px; |
| 927 | overflow: visible; | 1221 | overflow: visible; |
| 928 | } | 1222 | } |
| 1223 | |||
| 1224 | .table_field { | ||
| 1225 | width: 100%; | ||
| 1226 | height: calc(100% - 180px); | ||
| 1227 | min-height: 210px; | ||
| 1228 | overflow: visible; | ||
| 1229 | } | ||
| 1230 | |||
| 1231 | /* 外层容器 */ | ||
| 1232 | .tab-btn { | ||
| 1233 | display: flex; | ||
| 1234 | align-items: center; | ||
| 1235 | font-size: 14px; | ||
| 1236 | margin-top: 6px; | ||
| 1237 | margin-bottom: 6px; | ||
| 1238 | } | ||
| 1239 | |||
| 1240 | /* Tab 按钮样式 */ | ||
| 1241 | .tab-btn div { | ||
| 1242 | padding: 4px 12px; | ||
| 1243 | cursor: pointer; | ||
| 1244 | border: 1px solid #ccc; | ||
| 1245 | |||
| 1246 | background-color: #f7f7f7; | ||
| 1247 | transition: background-color 0.3s ease, color 0.3s ease; | ||
| 1248 | } | ||
| 1249 | |||
| 1250 | .tab-btn .table { | ||
| 1251 | border-top-left-radius: 2px; | ||
| 1252 | border-bottom-left-radius: 2px; | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | .tab-btn .word { | ||
| 1256 | border-top-right-radius: 2px; | ||
| 1257 | border-bottom-right-radius: 2px; | ||
| 1258 | } | ||
| 1259 | |||
| 1260 | |||
| 1261 | /* 默认未选中样式 */ | ||
| 1262 | .tab-btn div:not(.active):hover { | ||
| 1263 | background-color: #e0e0e0; | ||
| 1264 | } | ||
| 1265 | |||
| 1266 | /* 选中样式 */ | ||
| 1267 | .tab-btn .active { | ||
| 1268 | background-color: #4FA1A4; | ||
| 1269 | color: white; | ||
| 1270 | border-color: #4FA1A4; | ||
| 1271 | } | ||
| 929 | } | 1272 | } |
| 930 | } | 1273 | } |
| 931 | 1274 | ||
| ... | @@ -954,7 +1297,7 @@ const addIsShowDatabaseTip = () => { | ... | @@ -954,7 +1297,7 @@ const addIsShowDatabaseTip = () => { |
| 954 | 1297 | ||
| 955 | :deep(.v-drawer) { | 1298 | :deep(.v-drawer) { |
| 956 | .numberClass { | 1299 | .numberClass { |
| 957 | margin-top: 12px; | 1300 | margin-top: 10px; |
| 958 | } | 1301 | } |
| 959 | } | 1302 | } |
| 960 | } | 1303 | } | ... | ... |
| 1 | <template> | ||
| 2 | <el-select v-if="!readonly && isEdit && isSelectType(dbType, scope)" v-model="scope.row['defaultValue']" placeholder="请选择" collapse-tags-tooltip | ||
| 3 | filterable allow-create default-first-option :reserve-keyword="false"> | ||
| 4 | <el-option v-for="opt in optionsConfig[dataType]" :key="opt['value']" :label="opt['label']" :value="opt['value']" /> | ||
| 5 | </el-select> | ||
| 6 | <el-date-picker v-else-if="!readonly && isEdit && dataType === 'date'" v-model="scope.row['defaultValue']" type="date" | ||
| 7 | format="YYYY-MM-DD" value-format="YYYY-MM-DD" placeholder="请选择" /> | ||
| 8 | <el-date-picker v-else-if="!readonly && isEdit && dbType === 'mysql' && dataType === 'datetime'" | ||
| 9 | v-model="scope.row['defaultValue']" placeholder="请选择" type="datetime" format="YYYY-MM-DD HH:mm:ss" | ||
| 10 | value-format="YYYY-MM-DD HH:mm:ss" /> | ||
| 11 | <el-input v-else-if="!readonly && isEdit" v-model.trim="scope.row['defaultValue']" placeholder="请填写" | ||
| 12 | @input="(val) => inputChange(val, scope.row.dataType, scope)" /> | ||
| 13 | <span v-else>{{ scope.row["defaultValue"] == null ? '--' : (isSelectType(dbType, scope) ? | ||
| 14 | (optionsConfig[dataType].find(s => s.value == scope.row["defaultValue"])?.label ?? | ||
| 15 | scope.row["defaultValue"]) : scope.row["defaultValue"]) }}</span> | ||
| 16 | </template> | ||
| 17 | |||
| 18 | <script lang="ts" setup name="tableDefaultValue"> | ||
| 19 | import { ref } from "vue"; | ||
| 20 | import { useDefault } from "@/hooks/useDefault"; | ||
| 21 | const { optionsConfig, inputChange, isSelectType } = useDefault() | ||
| 22 | |||
| 23 | const props = defineProps({ | ||
| 24 | dbType: { | ||
| 25 | type: String, | ||
| 26 | default: '' | ||
| 27 | }, | ||
| 28 | scope: { | ||
| 29 | type: Object, | ||
| 30 | default: {} | ||
| 31 | }, | ||
| 32 | readonly: { | ||
| 33 | type: Boolean, | ||
| 34 | default: false | ||
| 35 | } | ||
| 36 | }) | ||
| 37 | |||
| 38 | const isEdit = computed(() => { | ||
| 39 | return props.scope.row['isEdit']; | ||
| 40 | }); | ||
| 41 | |||
| 42 | const dataType = computed(() => { | ||
| 43 | return props.scope.row['dataType']; | ||
| 44 | }); | ||
| 45 | |||
| 46 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <script lang="ts" setup name="uploadExcelFile"> | ||
| 2 | import { ref } from "vue"; | ||
| 3 | import { ElMessage, ElMessageBox, ElTable } from "element-plus"; | ||
| 4 | import { TableColumnWidth } from '@/utils/enum'; | ||
| 5 | import Moment from 'moment'; | ||
| 6 | import { calcColumnWidth } from "@/utils/index"; | ||
| 7 | import * as XLSX from 'xlsx'; | ||
| 8 | import { | ||
| 9 | getImageContent | ||
| 10 | } from '@/api/modules/queryService'; | ||
| 11 | const props = defineProps({ | ||
| 12 | noUpload: { | ||
| 13 | type: Boolean, | ||
| 14 | default: false | ||
| 15 | } | ||
| 16 | }) | ||
| 17 | const emits = defineEmits([ | ||
| 18 | "fileDataChange" | ||
| 19 | ]); | ||
| 20 | const noUpload = computed(() => props.noUpload) | ||
| 21 | const sheetList: any = ref([]); | ||
| 22 | const fileFormRef = ref(); | ||
| 23 | /** 文件上传表单配置。 */ | ||
| 24 | const fileFormItems: any = ref([ | ||
| 25 | { | ||
| 26 | label: '选择文件上传', | ||
| 27 | tip: '支持扩展名:xlsx、xls,文件大小不超过20MB', | ||
| 28 | type: 'upload-file', | ||
| 29 | accept: '.xlsx, .xls', | ||
| 30 | limit: 1, | ||
| 31 | limitSize: 20, | ||
| 32 | isExcel: true, | ||
| 33 | required: true, | ||
| 34 | default: [], | ||
| 35 | field: 'file', | ||
| 36 | }, | ||
| 37 | { | ||
| 38 | label: '选择sheet页', | ||
| 39 | type: 'select', | ||
| 40 | placeholder: '请选择', | ||
| 41 | field: 'sheet', | ||
| 42 | default: '', | ||
| 43 | options: sheetList, | ||
| 44 | required: true, | ||
| 45 | visible: true | ||
| 46 | }, | ||
| 47 | ]); | ||
| 48 | const fileFormRules = ref({ | ||
| 49 | file: [{ | ||
| 50 | validator: (rule: any, value: any, callback: any) => { | ||
| 51 | if (!value?.length) { | ||
| 52 | callback(new Error('请上传文件')) | ||
| 53 | } else { | ||
| 54 | callback(); | ||
| 55 | } | ||
| 56 | }, trigger: 'change' | ||
| 57 | }], | ||
| 58 | sheet: [ | ||
| 59 | { required: true, trigger: 'change', message: "请选择sheet页" } | ||
| 60 | ], | ||
| 61 | }); | ||
| 62 | const uploadFileChange = (file) => { | ||
| 63 | fileTableFields.value = []; | ||
| 64 | fileTableData.value = []; | ||
| 65 | sheetList.value = []; | ||
| 66 | if (!file.length) { | ||
| 67 | fileTableFields.value = []; | ||
| 68 | fileTableData.value = []; | ||
| 69 | sheetList.value = []; | ||
| 70 | fileFormItems.value[1].options = sheetList.value; | ||
| 71 | fileFormItems.value[1].default = ''; | ||
| 72 | fileFormItems.value[0].default = file; | ||
| 73 | fileWb.value = {}; | ||
| 74 | emits("fileDataChange", fileTableFields.value, file, '', fileTableData.value); | ||
| 75 | return; | ||
| 76 | } | ||
| 77 | let fileRaw = file[0].file; | ||
| 78 | fileFieldLoading.value = true; | ||
| 79 | fileRaw.arrayBuffer().then((f) => { | ||
| 80 | const wb = XLSX.read(f, { | ||
| 81 | raw: false, cellDates: true | ||
| 82 | }); | ||
| 83 | fileWb.value = wb; | ||
| 84 | console.log(wb); | ||
| 85 | sheetList.value = wb.SheetNames?.map(s => { | ||
| 86 | return { | ||
| 87 | value: s, | ||
| 88 | label: s | ||
| 89 | } | ||
| 90 | }) || []; | ||
| 91 | fileFormItems.value[1].options = sheetList.value; | ||
| 92 | fileFormItems.value[1].default = wb.SheetNames[0]; | ||
| 93 | fileFormItems.value[0].default = file; | ||
| 94 | const sheet = wb.Sheets[wb.SheetNames[0]]; | ||
| 95 | const json: any[] = XLSX.utils.sheet_to_json(sheet, { header: 1 }); | ||
| 96 | if (json.length == 0) { | ||
| 97 | fileTableFields.value = []; | ||
| 98 | fileTableData.value = []; | ||
| 99 | } else { | ||
| 100 | fileTableFields.value = json[0]?.map((j, index) => { | ||
| 101 | return { | ||
| 102 | index: index, | ||
| 103 | enName: j + '', | ||
| 104 | chName: j + '', | ||
| 105 | dataType: 'varchar' | ||
| 106 | } | ||
| 107 | }) || []; | ||
| 108 | if (json.length > 1) { | ||
| 109 | fileTableData.value = json.slice(1, 51).map((info, row) => { | ||
| 110 | let object = {}; | ||
| 111 | json[0].forEach((name, col) => { | ||
| 112 | if (info[col] === "" || info[col] == null) { | ||
| 113 | object[name] = info[col]; | ||
| 114 | } else { | ||
| 115 | var cellRef = XLSX.utils.encode_cell({ r: row + 1, c: col }); | ||
| 116 | var cell = sheet[cellRef]; | ||
| 117 | object[name] = cell.w || info[col]; | ||
| 118 | let isNum = cell.t == 'n'; | ||
| 119 | if (isNum && fileTableFields.value[col].dataType != 'int') { | ||
| 120 | fileTableFields.value[col].dataType = 'int'; | ||
| 121 | } | ||
| 122 | } | ||
| 123 | }); | ||
| 124 | return object; | ||
| 125 | }); | ||
| 126 | } else { | ||
| 127 | fileTableData.value = []; | ||
| 128 | } | ||
| 129 | } | ||
| 130 | fileFieldLoading.value = false; | ||
| 131 | emits("fileDataChange", fileTableFields.value, file, wb.SheetNames[0], fileTableData.value); | ||
| 132 | }); | ||
| 133 | } | ||
| 134 | /** 切换sheet页 */ | ||
| 135 | const handleSelectChange = (val, row, info) => { | ||
| 136 | if (!val) { | ||
| 137 | return; | ||
| 138 | } | ||
| 139 | let wb = fileWb.value; | ||
| 140 | const sheet = wb.Sheets[val]; | ||
| 141 | const json: any[] = XLSX.utils.sheet_to_json(sheet, { header: 1 }); | ||
| 142 | if (json.length == 0) { | ||
| 143 | fileTableFields.value = []; | ||
| 144 | fileTableData.value = []; | ||
| 145 | } else { | ||
| 146 | fileTableFields.value = json[0]?.map((j, index) => { | ||
| 147 | return { | ||
| 148 | index: index, | ||
| 149 | enName: j + '', | ||
| 150 | chName: j + '', | ||
| 151 | dataType: 'varchar' | ||
| 152 | } | ||
| 153 | }) || []; | ||
| 154 | if (json.length > 1) { | ||
| 155 | fileTableData.value = json.slice(1, 51).map((info, row) => { | ||
| 156 | let object = {}; | ||
| 157 | json[0].forEach((name, col) => { | ||
| 158 | if (info[col] === "" || info[col] == null) { | ||
| 159 | object[name] = info[col]; | ||
| 160 | } else { | ||
| 161 | var cellRef = XLSX.utils.encode_cell({ r: row + 1, c: col }); | ||
| 162 | var cell = sheet[cellRef]; | ||
| 163 | object[name] = cell.w || info[col]; | ||
| 164 | let isNum = cell.t == 'n'; | ||
| 165 | if (isNum && fileTableFields.value[col].dataType != 'int') { | ||
| 166 | fileTableFields.value[col].dataType = 'int'; | ||
| 167 | } | ||
| 168 | } | ||
| 169 | }); | ||
| 170 | return object; | ||
| 171 | }); | ||
| 172 | } else { | ||
| 173 | fileTableData.value = []; | ||
| 174 | } | ||
| 175 | } | ||
| 176 | emits("fileDataChange", fileTableFields.value, info.file, val, fileTableData.value); | ||
| 177 | } | ||
| 178 | /** 上传文件之后解析出字段和数据 */ | ||
| 179 | const fileFieldLoading = ref(false); | ||
| 180 | |||
| 181 | const fileTableFields: any = ref([]); | ||
| 182 | |||
| 183 | const fileTableData: any = ref([]); | ||
| 184 | |||
| 185 | /** 解析后的excel文件流信息,切换sheet页选择时使用。 */ | ||
| 186 | const fileWb: any = ref({}); | ||
| 187 | const getTextAlign = (field) => { | ||
| 188 | if (field.dataType === 'decimal' || field.dataType === 'int') { | ||
| 189 | return 'right'; | ||
| 190 | } | ||
| 191 | return 'left' | ||
| 192 | } | ||
| 193 | /** otherWidth表示使用标题宽度时添加标题排序图标等宽度 */ | ||
| 194 | const calcTableColumnWidth = (data: any[], prop, title, otherWidth = 0) => { | ||
| 195 | let d: any[] = []; | ||
| 196 | data.forEach((dt) => d.push(dt[prop])); | ||
| 197 | return calcColumnWidth( | ||
| 198 | d, | ||
| 199 | title, | ||
| 200 | { | ||
| 201 | fontSize: 14, | ||
| 202 | fontFamily: "SimSun", | ||
| 203 | }, | ||
| 204 | { | ||
| 205 | fontSize: 14, | ||
| 206 | fontFamily: "SimSun", | ||
| 207 | }, | ||
| 208 | otherWidth | ||
| 209 | ); | ||
| 210 | }; | ||
| 211 | /** 每列字段对应的列宽计算结果。 */ | ||
| 212 | const originTableFieldColumn = ref({}); | ||
| 213 | watch( | ||
| 214 | fileTableData, | ||
| 215 | (val: any[], oldVal) => { | ||
| 216 | if (!fileTableFields.value?.length) { | ||
| 217 | originTableFieldColumn.value = {}; | ||
| 218 | return; | ||
| 219 | } | ||
| 220 | originTableFieldColumn.value = {}; | ||
| 221 | fileTableFields.value.forEach((field, index) => { | ||
| 222 | originTableFieldColumn.value[field.enName] = calcTableColumnWidth( | ||
| 223 | val?.slice(0, 20) || [], | ||
| 224 | field.enName, | ||
| 225 | field.chName, | ||
| 226 | 24 | ||
| 227 | ); | ||
| 228 | }); | ||
| 229 | }, | ||
| 230 | { | ||
| 231 | deep: true, | ||
| 232 | } | ||
| 233 | ); | ||
| 234 | const formatterPreviewDate = (row, info) => { | ||
| 235 | let enName = info.enName; | ||
| 236 | let v = row[enName]; | ||
| 237 | if (v === 0) { | ||
| 238 | return v; | ||
| 239 | } | ||
| 240 | if (!v) { | ||
| 241 | return v || '--'; | ||
| 242 | } | ||
| 243 | if (info.dataType === 'datetime') { | ||
| 244 | return Moment(v).format('YYYY-MM-DD HH:mm:ss'); | ||
| 245 | } | ||
| 246 | if (info.dataType === 'date') { | ||
| 247 | if (isNaN(<any>(new Date(v)))) { | ||
| 248 | return Moment(parseInt(v)).format('YYYY-MM-DD'); | ||
| 249 | } else { | ||
| 250 | return Moment(v).format('YYYY-MM-DD'); | ||
| 251 | } | ||
| 252 | } | ||
| 253 | return v; | ||
| 254 | }; | ||
| 255 | const setFormValue = (v) => { | ||
| 256 | fileFormItems.value[1].default = v.sheetName || ""; | ||
| 257 | let url = v.file?.[0]?.url; | ||
| 258 | if (fileFormItems.value[0].default?.[0]?.url !== url) { | ||
| 259 | fileFormItems.value[0].default = v.file || []; | ||
| 260 | //获取文件流去解析出数据和字段。 | ||
| 261 | fileFieldLoading.value = true; | ||
| 262 | fileTableFields.value = []; | ||
| 263 | fileTableData.value = []; | ||
| 264 | getImageContent(url).then((res: any) => { | ||
| 265 | if (res && !res.msg) { | ||
| 266 | let urlNames = url.split('/'); | ||
| 267 | let name = urlNames.at(-1); | ||
| 268 | let reader = new FileReader(); | ||
| 269 | reader.onload = function (e) { | ||
| 270 | if (!e?.target) { | ||
| 271 | fileFieldLoading.value = false; | ||
| 272 | return; | ||
| 273 | } | ||
| 274 | let data = new Uint8Array(<any>e.target.result); | ||
| 275 | const wb = XLSX.read(data, { type: 'array', raw: false, cellDates: true }); | ||
| 276 | fileWb.value = wb; | ||
| 277 | console.log(wb); | ||
| 278 | sheetList.value = wb.SheetNames?.map(s => { | ||
| 279 | return { | ||
| 280 | value: s, | ||
| 281 | label: s | ||
| 282 | } | ||
| 283 | }) || []; | ||
| 284 | fileFormItems.value[1].options = sheetList.value; | ||
| 285 | fileFormItems.value[1].default = v.sheetName || ""; | ||
| 286 | const sheet = wb.Sheets[v.sheetName]; | ||
| 287 | const json: any[] = XLSX.utils.sheet_to_json(sheet, { header: 1 }); | ||
| 288 | if (json.length == 0) { | ||
| 289 | fileTableFields.value = []; | ||
| 290 | fileTableData.value = []; | ||
| 291 | } else { | ||
| 292 | fileTableFields.value = json[0]?.map((j, index) => { | ||
| 293 | return { | ||
| 294 | index: index, | ||
| 295 | enName: j + '', | ||
| 296 | chName: j + '', | ||
| 297 | dataType: 'varchar' | ||
| 298 | } | ||
| 299 | }) || []; | ||
| 300 | if (json.length > 1) { | ||
| 301 | fileTableData.value = json.slice(1, 51).map((info, row) => { | ||
| 302 | let object = {}; | ||
| 303 | json[0].forEach((name, col) => { | ||
| 304 | if (info[col] === "" || info[col] == null) { | ||
| 305 | object[name] = info[col]; | ||
| 306 | } else { | ||
| 307 | var cellRef = XLSX.utils.encode_cell({ r: row + 1, c: col }); | ||
| 308 | var cell = sheet[cellRef]; | ||
| 309 | object[name] = cell.w || info[col]; | ||
| 310 | let isNum = cell.t == 'n'; | ||
| 311 | if (isNum && fileTableFields.value[col].dataType != 'int') { | ||
| 312 | fileTableFields.value[col].dataType = 'int'; | ||
| 313 | } | ||
| 314 | } | ||
| 315 | }); | ||
| 316 | return object; | ||
| 317 | }); | ||
| 318 | } else { | ||
| 319 | fileTableData.value = []; | ||
| 320 | } | ||
| 321 | } | ||
| 322 | fileFieldLoading.value = false; | ||
| 323 | }; | ||
| 324 | reader.readAsArrayBuffer(res); | ||
| 325 | } else { | ||
| 326 | res?.msg && ElMessage.error(res?.msg); | ||
| 327 | } | ||
| 328 | }) | ||
| 329 | } | ||
| 330 | } | ||
| 331 | defineExpose({ | ||
| 332 | fileFormRef, | ||
| 333 | setFormValue | ||
| 334 | }); | ||
| 335 | </script> | ||
| 336 | <template> | ||
| 337 | <div class="upload-main"> | ||
| 338 | <div class="header-bg-title">选择文件上传</div> | ||
| 339 | <div class="form-main"> | ||
| 340 | <Form ref="fileFormRef" :itemList="fileFormItems" :noUpload="noUpload" formId="file-form" :rules="fileFormRules" | ||
| 341 | @uploadFileChange="uploadFileChange" @select-change="handleSelectChange" /> | ||
| 342 | </div> | ||
| 343 | <div class="header-bg-title">预览文件 | ||
| 344 | <div class="preview-data-totals"> | ||
| 345 | <span>该页面仅显示</span> | ||
| 346 | <span class="fontC-4fa1a4"> 50 </span> | ||
| 347 | <span>条数据</span> | ||
| 348 | </div> | ||
| 349 | </div> | ||
| 350 | <div class="table-main"> | ||
| 351 | <el-table ref="tableRef" v-loading="fileFieldLoading" v-show="fileTableFields.length" :data="fileTableData" | ||
| 352 | :highlight-current-row="true" stripe border tooltip-effect="light" height="100%" row-key="guid" | ||
| 353 | :style="{ width: '100%', height: '100%' }"> | ||
| 354 | <template v-for="(item, index) in (fileTableFields || [])"> | ||
| 355 | <el-table-column :label="item.chName" :width="item.dataType === 'datetime' | ||
| 356 | ? TableColumnWidth.DATETIME | ||
| 357 | : item.dataType === 'date' | ||
| 358 | ? TableColumnWidth.DATE | ||
| 359 | : originTableFieldColumn[item.enName] | ||
| 360 | " :align="getTextAlign(item)" :header-align="getTextAlign(item)" | ||
| 361 | :formatter="(row) => formatterPreviewDate(row, item)" :show-overflow-tooltip="true"> | ||
| 362 | </el-table-column> | ||
| 363 | </template> | ||
| 364 | </el-table> | ||
| 365 | <div v-show="!fileTableFields.length" class="empty-content"> | ||
| 366 | <img src="../../../assets/images/empty-data.png" :style="{ width: '168px', height: '96px' }" /> | ||
| 367 | <div class="empty-text">暂无数据</div> | ||
| 368 | </div> | ||
| 369 | </div> | ||
| 370 | </div> | ||
| 371 | </template> | ||
| 372 | <style lang="scss" scoped> | ||
| 373 | .upload-main { | ||
| 374 | height: calc(100% - 96px); | ||
| 375 | } | ||
| 376 | |||
| 377 | .header-bg-title { | ||
| 378 | margin: 16px 16px 0px; | ||
| 379 | background: #F5F5F5; | ||
| 380 | padding-left: 16px; | ||
| 381 | height: 48px; | ||
| 382 | font-size: 14px; | ||
| 383 | color: #212121; | ||
| 384 | letter-spacing: 0; | ||
| 385 | line-height: 21px; | ||
| 386 | font-weight: 600; | ||
| 387 | display: flex; | ||
| 388 | align-items: center; | ||
| 389 | position: relative; | ||
| 390 | |||
| 391 | .preview-data-totals { | ||
| 392 | position: absolute; | ||
| 393 | right: 16px; | ||
| 394 | line-height: 32px; | ||
| 395 | font-size: 14px; | ||
| 396 | color: #666666; | ||
| 397 | font-weight: 400; | ||
| 398 | } | ||
| 399 | |||
| 400 | .fontC-4fa1a4 { | ||
| 401 | color: var(--el-color-primary); | ||
| 402 | } | ||
| 403 | } | ||
| 404 | |||
| 405 | .form-main { | ||
| 406 | border: 1px solid #d9d9d9; | ||
| 407 | margin: 0px 16px; | ||
| 408 | padding: 16px 16px 0px 16px; | ||
| 409 | height: 125px; | ||
| 410 | |||
| 411 | .dialog-form-inline { | ||
| 412 | align-items: flex-start; | ||
| 413 | } | ||
| 414 | |||
| 415 | :deep(.el-form) { | ||
| 416 | .item-label { | ||
| 417 | width: 100%; | ||
| 418 | } | ||
| 419 | |||
| 420 | .el-select { | ||
| 421 | max-width: 300px; | ||
| 422 | } | ||
| 423 | } | ||
| 424 | } | ||
| 425 | |||
| 426 | .table-main { | ||
| 427 | height: calc(100% - 253px); | ||
| 428 | border: 1px solid #d9d9d9; | ||
| 429 | margin: 0px 16px 16px 16px; | ||
| 430 | padding: 16px; | ||
| 431 | } | ||
| 432 | |||
| 433 | .empty-content { | ||
| 434 | display: flex; | ||
| 435 | align-items: center; | ||
| 436 | justify-content: center; | ||
| 437 | height: 100%; | ||
| 438 | width: 100%; | ||
| 439 | flex-direction: column; | ||
| 440 | |||
| 441 | .empty-text { | ||
| 442 | font-size: 14px; | ||
| 443 | color: #b2b2b2; | ||
| 444 | } | ||
| 445 | } | ||
| 446 | |||
| 447 | :deep(.upload-file .el-upload-list) { | ||
| 448 | .el-upload-list__item { | ||
| 449 | &:first-child { | ||
| 450 | display: flex; | ||
| 451 | } | ||
| 452 | |||
| 453 | display: none | ||
| 454 | } | ||
| 455 | } | ||
| 456 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
src/views/data_inventory/configureRules.vue
0 → 100644
| 1 | <route lang="yaml"> | ||
| 2 | name: configureRules //标签管理 | ||
| 3 | </route> | ||
| 4 | |||
| 5 | <script lang="ts" setup name="configureRules"> | ||
| 6 | import { ref } from "vue"; | ||
| 7 | import router from "@/router"; | ||
| 8 | import { getBizRuleConfigDetail, updateBizRuleConfig } from '@/api/modules/dataInventory' | ||
| 9 | |||
| 10 | const { proxy } = getCurrentInstance() as any; | ||
| 11 | const bizRuleConfigData = ref<any>() | ||
| 12 | const getBizRuleConfigDetailData = async () => { | ||
| 13 | const params = { | ||
| 14 | tableGuid: router.currentRoute.value.query.guid, | ||
| 15 | execGuid: router.currentRoute.value.query.execGuid | ||
| 16 | } | ||
| 17 | const res: any = await getBizRuleConfigDetail(params) | ||
| 18 | if (res.code === proxy.$passCode) { | ||
| 19 | bizRuleConfigData.value = res.data | ||
| 20 | // 每条数据添加一个isEdit: false 属性,用于判断是否进入编辑模式 | ||
| 21 | bizRuleConfigData.value.forEach((item: any) => { | ||
| 22 | item.isEdit = false | ||
| 23 | }) | ||
| 24 | tableData.value = bizRuleConfigData.value | ||
| 25 | } else { | ||
| 26 | proxy.$message.error(res.msg) | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | onMounted(() => { | ||
| 31 | getBizRuleConfigDetailData() | ||
| 32 | }) | ||
| 33 | |||
| 34 | |||
| 35 | const tableData1 = ref([ | ||
| 36 | { | ||
| 37 | cgDirName: router.currentRoute.value.query.cgDirName, | ||
| 38 | tableName: router.currentRoute.value.query.tableName, | ||
| 39 | tableChName: router.currentRoute.value.query.tableChName, | ||
| 40 | description: router.currentRoute.value.query.description, | ||
| 41 | }, | ||
| 42 | ]) | ||
| 43 | // 表格数据 | ||
| 44 | const tableData = ref() | ||
| 45 | |||
| 46 | // 配置哪些字段可编辑 | ||
| 47 | const editableFields = { | ||
| 48 | fieldName: true, // 字段中文名可编辑 | ||
| 49 | length: true, // 长度可编辑 | ||
| 50 | isUnique: true, // 数据是否唯一可编辑 | ||
| 51 | fieldPrecision: true, // 精度可编辑 | ||
| 52 | dictionaryGuid: true, // 关联字典可编辑 | ||
| 53 | } | ||
| 54 | |||
| 55 | const tableFieldsLoading = ref(false) | ||
| 56 | const selectedRows = ref([]); | ||
| 57 | // 监听选中行 | ||
| 58 | const selectionFieldsChange = (selection) => { | ||
| 59 | console.log('selection', selection) | ||
| 60 | selectedRows.value = selection; | ||
| 61 | }; | ||
| 62 | |||
| 63 | // 上移功能 | ||
| 64 | const moveUp = () => { | ||
| 65 | // 1. 找到选中行在 tableData 中的索引 | ||
| 66 | const selectedIds = selectedRows.value.map((row: any) => row.id); | ||
| 67 | |||
| 68 | // 2. 遍历选中行,按顺序上移 | ||
| 69 | for (let i = 0; i < tableData.value.length; i++) { | ||
| 70 | const currentRow = tableData.value[i]; | ||
| 71 | |||
| 72 | // 如果当前行被选中,且不是第一行,则交换位置 | ||
| 73 | if (selectedIds.includes(currentRow.id) && i > 0) { | ||
| 74 | const previousRow = tableData.value[i - 1]; | ||
| 75 | |||
| 76 | // 如果上一行没有被选中,交换位置 | ||
| 77 | if (!selectedIds.includes(previousRow.id)) { | ||
| 78 | [tableData.value[i], tableData.value[i - 1]] = [tableData.value[i - 1], tableData.value[i]]; | ||
| 79 | } | ||
| 80 | } | ||
| 81 | } | ||
| 82 | }; | ||
| 83 | |||
| 84 | // 下移功能 | ||
| 85 | const moveDown = () => { | ||
| 86 | // 1. 找到选中行在 tableData 中的索引 | ||
| 87 | const selectedIds = selectedRows.value.map((row: any) => row.id); | ||
| 88 | |||
| 89 | // 2. 遍历选中行,倒序下移 | ||
| 90 | for (let i = tableData.value.length - 1; i >= 0; i--) { | ||
| 91 | const currentRow = tableData.value[i]; | ||
| 92 | |||
| 93 | // 如果当前行被选中,且不是最后一行,则交换位置 | ||
| 94 | if (selectedIds.includes(currentRow.id) && i < tableData.value.length - 1) { | ||
| 95 | const nextRow = tableData.value[i + 1]; | ||
| 96 | |||
| 97 | // 如果下一行没有被选中,交换位置 | ||
| 98 | if (!selectedIds.includes(nextRow.id)) { | ||
| 99 | [tableData.value[i], tableData.value[i + 1]] = [tableData.value[i + 1], tableData.value[i]]; | ||
| 100 | } | ||
| 101 | } | ||
| 102 | } | ||
| 103 | }; | ||
| 104 | |||
| 105 | // 编辑行 | ||
| 106 | const editRow = (row) => { | ||
| 107 | if (!row.isEdit) { | ||
| 108 | const [symbol, value] = row.fieldLengthCondition.split('#'); | ||
| 109 | row.lengthSymbol = symbol; // 初始化符号部分 | ||
| 110 | row.lengthValue = value; // 初始化数值部分 | ||
| 111 | row.isEdit = true; // 进入编辑模式 | ||
| 112 | } | ||
| 113 | }; | ||
| 114 | |||
| 115 | // 保存数据 | ||
| 116 | const saveRow = (row) => { | ||
| 117 | row.fieldLengthCondition = `${row.lengthSymbol}#${row.lengthValue}`; | ||
| 118 | row.isEdit = false | ||
| 119 | } | ||
| 120 | |||
| 121 | // 删除行 | ||
| 122 | const deleteRow = (index) => { | ||
| 123 | tableData.value.splice(index, 1) | ||
| 124 | } | ||
| 125 | // 批量删除功能 | ||
| 126 | const batchDelete = () => { | ||
| 127 | selectedRows.value.forEach((row: any) => { | ||
| 128 | const index = tableData.value.findIndex((item) => item.id === row.id); | ||
| 129 | if (index !== -1) tableData.value.splice(index, 1); | ||
| 130 | }); | ||
| 131 | selectedRows.value = []; | ||
| 132 | }; | ||
| 133 | const data = [ | ||
| 134 | { | ||
| 135 | value: '1', | ||
| 136 | label: 'Level one 1', | ||
| 137 | children: [ | ||
| 138 | { | ||
| 139 | value: '1-1', | ||
| 140 | label: 'Level two 1-1', | ||
| 141 | children: [ | ||
| 142 | { | ||
| 143 | value: '1-1-1', | ||
| 144 | label: 'Level three 1-1-1', | ||
| 145 | }, | ||
| 146 | ], | ||
| 147 | }, | ||
| 148 | ], | ||
| 149 | }, | ||
| 150 | { | ||
| 151 | value: '2', | ||
| 152 | label: 'Level one 2', | ||
| 153 | children: [ | ||
| 154 | { | ||
| 155 | value: '2-1', | ||
| 156 | label: 'Level two 2-1', | ||
| 157 | children: [ | ||
| 158 | { | ||
| 159 | value: '2-1-1', | ||
| 160 | label: 'Level three 2-1-1', | ||
| 161 | }, | ||
| 162 | ], | ||
| 163 | }, | ||
| 164 | { | ||
| 165 | value: '2-2', | ||
| 166 | label: 'Level two 2-2', | ||
| 167 | children: [ | ||
| 168 | { | ||
| 169 | value: '2-2-1', | ||
| 170 | label: 'Level three 2-2-1', | ||
| 171 | }, | ||
| 172 | ], | ||
| 173 | }, | ||
| 174 | ], | ||
| 175 | }, | ||
| 176 | { | ||
| 177 | value: '3', | ||
| 178 | label: 'Level one 3', | ||
| 179 | children: [ | ||
| 180 | { | ||
| 181 | value: '3-1', | ||
| 182 | label: 'Level two 3-1', | ||
| 183 | children: [ | ||
| 184 | { | ||
| 185 | value: '3-1-1', | ||
| 186 | label: 'Level three 3-1-1', | ||
| 187 | }, | ||
| 188 | ], | ||
| 189 | }, | ||
| 190 | { | ||
| 191 | value: '3-2', | ||
| 192 | label: 'Level two 3-2', | ||
| 193 | children: [ | ||
| 194 | { | ||
| 195 | value: '3-2-1', | ||
| 196 | label: 'Level three 3-2-1', | ||
| 197 | }, | ||
| 198 | ], | ||
| 199 | }, | ||
| 200 | ], | ||
| 201 | }, | ||
| 202 | ] | ||
| 203 | |||
| 204 | const saveData = async () => { | ||
| 205 | |||
| 206 | /**入参 | ||
| 207 | * "guid": "string", | ||
| 208 | "fieldGuid": "string", | ||
| 209 | "fieldLengthCondition": "string", | ||
| 210 | "fieldPrecision": 0, | ||
| 211 | "dictionaryGuid": "string", | ||
| 212 | "isUnique": "string", | ||
| 213 | "isNotNull": "string", | ||
| 214 | "fieldValueRange": "string" | ||
| 215 | */ | ||
| 216 | const params = tableData.value.map((item: any) => { | ||
| 217 | return { | ||
| 218 | guid: item.guid, | ||
| 219 | fieldGuid: item.fieldGuid, | ||
| 220 | fieldLengthCondition: item.fieldLengthCondition, | ||
| 221 | fieldPrecision: item.fieldPrecision, | ||
| 222 | dictionaryGuid: item.dictionaryGuid, | ||
| 223 | isUnique: item.isUnique, | ||
| 224 | isNotNull: item.isNotNull, | ||
| 225 | fieldValueRange: item.fieldValueRange | ||
| 226 | } | ||
| 227 | }) | ||
| 228 | const res: any = await updateBizRuleConfig(params) | ||
| 229 | if (res.code === proxy.$passCode) { | ||
| 230 | proxy.$message.success('修改配置规则成功!') | ||
| 231 | router.back() | ||
| 232 | } else { | ||
| 233 | proxy.$message.error(res.msg) | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | const cancel = () => { | ||
| 238 | router.back() | ||
| 239 | } | ||
| 240 | |||
| 241 | </script> | ||
| 242 | <template> | ||
| 243 | <div class="configure-rules"> | ||
| 244 | <div class="table_panel_wrap"> | ||
| 245 | <el-table :data="tableData1" :highlight-current-row="true" stripe border height="100%" row-key="guid" | ||
| 246 | tooltip-effect="light" :style="{ | ||
| 247 | width: '100%', | ||
| 248 | 'max-height': 'calc(100% - 16px)', | ||
| 249 | display: 'inline-block', | ||
| 250 | }"> | ||
| 251 | <el-table-column prop="cgDirName" label="数据源" width="180" /> | ||
| 252 | <el-table-column prop="tableName" label="表名称" width="180" /> | ||
| 253 | <el-table-column prop="tableChName" label="数据库表" width="280" /> | ||
| 254 | <el-table-column prop="description" label="描述" width="180" show-overflow-tooltip /> | ||
| 255 | </el-table> | ||
| 256 | </div> | ||
| 257 | <div class="btn-area"> | ||
| 258 | <el-button @click="moveUp">上移</el-button> | ||
| 259 | <el-button @click="moveDown">下移</el-button> | ||
| 260 | <el-button @click="batchDelete">批量删除</el-button> | ||
| 261 | </div> | ||
| 262 | <div class="bottom_table"> | ||
| 263 | <el-table :data="tableData" v-loading="tableFieldsLoading" :highlight-current-row="true" stripe border | ||
| 264 | height="100%" row-key="guid" @selection-change="selectionFieldsChange" tooltip-effect="light" :style="{ | ||
| 265 | width: '100%', | ||
| 266 | 'max-height': 'calc(100% - 16px)', | ||
| 267 | display: 'inline-block', | ||
| 268 | }"> | ||
| 269 | <el-table-column type="selection" :width="32" align="center" /> | ||
| 270 | <!-- 排序列(不可编辑) --> | ||
| 271 | <el-table-column prop="index" label="排序" width="80" align="center" /> | ||
| 272 | <!-- 字段中文名(不可编辑)fieldChName --> | ||
| 273 | <el-table-column prop="fieldName" label="字段中文名" width="120"> | ||
| 274 | <template #default="scope"> | ||
| 275 | {{ scope.row.fieldName ? scope.row.fieldName : '--' }} | ||
| 276 | </template> | ||
| 277 | </el-table-column> | ||
| 278 | <!-- 字段英文名(不可编辑) --> | ||
| 279 | <el-table-column prop="fieldEnglish" label="字段英文名" width="120"> | ||
| 280 | <template #default="scope"> | ||
| 281 | {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} | ||
| 282 | </template> | ||
| 283 | </el-table-column> | ||
| 284 | <!-- 分类(不可编辑)classifyName --> | ||
| 285 | <el-table-column prop="fieldEnglish" label="分类" width="120"> | ||
| 286 | <template #default="scope"> | ||
| 287 | {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} | ||
| 288 | </template> | ||
| 289 | </el-table-column> | ||
| 290 | <!-- 分级(不可编辑) --> | ||
| 291 | <el-table-column prop="gradeDetailName" label="分级" width="120" align="center"> | ||
| 292 | <template #default="scope"> | ||
| 293 | {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }} | ||
| 294 | </template> | ||
| 295 | </el-table-column> | ||
| 296 | <!-- 字段类型fieldType (不可编辑) --> | ||
| 297 | <el-table-column prop="fieldType" label="字段类型" width="150" align="center"> | ||
| 298 | <template #default="scope"> | ||
| 299 | {{ scope.row.fieldType ? scope.row.fieldType : '--' }} | ||
| 300 | </template> | ||
| 301 | </el-table-column> | ||
| 302 | |||
| 303 | <!-- 长度列 fieldLengthCondition: '>#10',--> | ||
| 304 | <el-table-column prop="fieldLengthCondition" label="长度" width="240" align="center"> | ||
| 305 | <template #default="scope"> | ||
| 306 | <span v-if="!scope.row.isEdit">{{ scope.row.fieldLengthCondition || '--' }}</span> | ||
| 307 | <div v-else> | ||
| 308 | <el-select v-model="scope.row.lengthSymbol" placeholder="请选择" style="width: 50%;margin-right: 8px;"> | ||
| 309 | <el-option label="大于" value=">"></el-option> | ||
| 310 | <el-option label="等于" value="="></el-option> | ||
| 311 | <el-option label="小于" value="<"></el-option> | ||
| 312 | </el-select> | ||
| 313 | <el-input v-model="scope.row.lengthValue" placeholder="请输入" style="width: 45%;" /> | ||
| 314 | </div> | ||
| 315 | </template> | ||
| 316 | </el-table-column> | ||
| 317 | |||
| 318 | <!-- 精度列 --> | ||
| 319 | <!-- <el-table-column prop="fieldPrecision" label="精度" width="240" align="center"> | ||
| 320 | <template #default="scope"> | ||
| 321 | <span v-if="!scope.row.isEdit">{{ scope.row.fieldPrecision || '--' }}</span> | ||
| 322 | <div v-else> | ||
| 323 | <el-select v-model="scope.row.fieldPrecision" placeholder="请选择" style="width: 50%;margin-right: 8px;"> | ||
| 324 | <el-option label="<=500" value="<=500"></el-option> | ||
| 325 | <el-option label=">500" value=">500"></el-option> | ||
| 326 | </el-select> | ||
| 327 | <el-input v-model="scope.row.precisionValue" placeholder="请输入" style="width: 45%;" /> | ||
| 328 | </div> | ||
| 329 | </template> | ||
| 330 | </el-table-column> --> | ||
| 331 | <!-- 精度(可编辑)fieldPrecision --> | ||
| 332 | <el-table-column prop="fieldPrecision" label="精度" width="120" align="center"> | ||
| 333 | <template #default="scope"> | ||
| 334 | <span v-if="!scope.row.isEdit || !editableFields.fieldPrecision">{{ | ||
| 335 | scope.row.fieldPrecision ? scope.row.fieldPrecision : '--' }}</span> | ||
| 336 | <el-input v-else v-model="scope.row.fieldPrecision" placeholder="请输入精度" /> | ||
| 337 | </template> | ||
| 338 | </el-table-column> | ||
| 339 | |||
| 340 | <!-- 关联字典(可编辑)el-tree-select 形式下拉形式 --> | ||
| 341 | <el-table-column prop="dictionaryGuid" label="关联字典" width="150" align="center"> | ||
| 342 | <template #default="scope"> | ||
| 343 | <span v-if="!scope.row.isEdit || !editableFields.dictionaryGuid">{{ scope.row.isDict ? scope.row.isDict : | ||
| 344 | '--' }}</span> | ||
| 345 | <el-tree-select v-else v-model="scope.row.isDict" :data="data" placeholder="请选择" /> | ||
| 346 | </template> | ||
| 347 | </el-table-column> | ||
| 348 | |||
| 349 | <!-- 数据是否唯一(可编辑) --> | ||
| 350 | <el-table-column prop="isUnique" label="数据是否唯一" width="150" align="center"> | ||
| 351 | <template #default="scope"> | ||
| 352 | <span v-if="!scope.row.isEdit || !editableFields.isUnique">{{ scope.row.isUnique ? scope.row.isUnique : '--' | ||
| 353 | }}</span> | ||
| 354 | <el-select v-else v-model="scope.row.isUnique" placeholder="请选择"> | ||
| 355 | <el-option label="是" value="Y" /> | ||
| 356 | <el-option label="否" value="N" /> | ||
| 357 | </el-select> | ||
| 358 | </template> | ||
| 359 | </el-table-column> | ||
| 360 | <!-- 是否必填(可编辑) --> | ||
| 361 | <el-table-column prop="isRequired" label="是否必填" width="120" align="center"> | ||
| 362 | <template #default="scope"> | ||
| 363 | <span v-if="!scope.row.isEdit">{{ scope.row.isRequired ? scope.row.isRequired : '--' }}</span> | ||
| 364 | <el-select v-else v-model="scope.row.isRequired" placeholder="请选择"> | ||
| 365 | <el-option label="是" value="Y" /> | ||
| 366 | <el-option label="否" value="N" /> | ||
| 367 | </el-select> | ||
| 368 | </template> | ||
| 369 | </el-table-column> | ||
| 370 | <!-- 字段取值范围 fieldValueRange(可编辑)--> | ||
| 371 | <el-table-column prop="fieldValueRange" label="字段取值范围" width="150" align="center"> | ||
| 372 | <template #default="scope"> | ||
| 373 | <span v-if="!scope.row.isEdit">{{ scope.row.fieldValueRange ? scope.row.fieldValueRange : '--' }}</span> | ||
| 374 | <el-input v-else v-model="scope.row.fieldValueRange" placeholder="请输入字段取值范围" /> | ||
| 375 | </template> | ||
| 376 | </el-table-column> | ||
| 377 | |||
| 378 | <!-- 操作列 --> | ||
| 379 | <el-table-column label="操作" width="100" align="center" fixed="right"> | ||
| 380 | <template #default="scope"> | ||
| 381 | <span class="text_btn" v-if="!scope.row.isEdit" @click="editRow(scope.row)">编辑</span> | ||
| 382 | <span class="text_btn" v-else @click="saveRow(scope.row)">保存</span> | ||
| 383 | <el-divider direction="vertical" /> | ||
| 384 | <span class="text_btn" @click="deleteRow(scope.$index)">删除</span> | ||
| 385 | </template> | ||
| 386 | </el-table-column> | ||
| 387 | </el-table> | ||
| 388 | </div> | ||
| 389 | <div class="botton_btn"> | ||
| 390 | <el-button type="primary" @click="saveData">保存</el-button> | ||
| 391 | <el-button @click="cancel">取消</el-button> | ||
| 392 | </div> | ||
| 393 | </div> | ||
| 394 | |||
| 395 | |||
| 396 | </template> | ||
| 397 | |||
| 398 | <style lang="scss" scoped> | ||
| 399 | .configure-rules { | ||
| 400 | padding: 16px; | ||
| 401 | height: 100%; | ||
| 402 | |||
| 403 | .table_panel_wrap { | ||
| 404 | width: 100%; | ||
| 405 | height: auto; | ||
| 406 | overflow: visible; | ||
| 407 | } | ||
| 408 | |||
| 409 | |||
| 410 | .btn-area { | ||
| 411 | margin-top: 12px; | ||
| 412 | } | ||
| 413 | |||
| 414 | :deep(.bottom_table) { | ||
| 415 | margin-top: 12px; | ||
| 416 | height: calc(100% - 150px); | ||
| 417 | overflow-y: auto; | ||
| 418 | |||
| 419 | .el-table td.el-table__cell { | ||
| 420 | padding: 2px 0; | ||
| 421 | height: 36px; | ||
| 422 | } | ||
| 423 | } | ||
| 424 | } | ||
| 425 | </style> |
| ... | @@ -7,7 +7,7 @@ import TableTools from '@/components/Tools/table_tools.vue'; | ... | @@ -7,7 +7,7 @@ import TableTools from '@/components/Tools/table_tools.vue'; |
| 7 | import { getGradeList } from "@/api/modules/dataInventory"; | 7 | import { getGradeList } from "@/api/modules/dataInventory"; |
| 8 | import { getLabelList, getClassifyGradeTreeList, saveLabel, getLabelPageList, deleteLabel, updateLabel } from "@/api/modules/dataLabel"; | 8 | import { getLabelList, getClassifyGradeTreeList, saveLabel, getLabelPageList, deleteLabel, updateLabel } from "@/api/modules/dataLabel"; |
| 9 | import { CirclePlus, Delete } from "@element-plus/icons-vue"; | 9 | import { CirclePlus, Delete } from "@element-plus/icons-vue"; |
| 10 | import { el, tr } from 'element-plus/es/locale'; | 10 | |
| 11 | 11 | ||
| 12 | const { proxy } = getCurrentInstance() as any; | 12 | const { proxy } = getCurrentInstance() as any; |
| 13 | const dialogLabelFormRef = ref(); | 13 | const dialogLabelFormRef = ref(); |
| ... | @@ -123,7 +123,7 @@ const treeInfo = ref<any>({ | ... | @@ -123,7 +123,7 @@ const treeInfo = ref<any>({ |
| 123 | filter: true, | 123 | filter: true, |
| 124 | queryValue: "", | 124 | queryValue: "", |
| 125 | className: 'tree-list', | 125 | className: 'tree-list', |
| 126 | queryPlaceholder: "输入标准集名称搜索", | 126 | queryPlaceholder: "输入目录名称搜索", |
| 127 | props: { | 127 | props: { |
| 128 | label: "classifyName", | 128 | label: "classifyName", |
| 129 | value: "guid", | 129 | value: "guid", |
| ... | @@ -560,7 +560,6 @@ const searchClass = async (val: any, clear: boolean = false) => { | ... | @@ -560,7 +560,6 @@ const searchClass = async (val: any, clear: boolean = false) => { |
| 560 | return; | 560 | return; |
| 561 | } | 561 | } |
| 562 | if (val?.labelName?.length !== 0) { | 562 | if (val?.labelName?.length !== 0) { |
| 563 | console.log('调用了吗'); | ||
| 564 | tableInfo.value.loading = true; | 563 | tableInfo.value.loading = true; |
| 565 | const params = { | 564 | const params = { |
| 566 | pageIndex: page.value.curr, | 565 | pageIndex: page.value.curr, | ... | ... |
src/views/data_inventory/dictFileds.vue
0 → 100644
| 1 | <route lang="yaml"> | ||
| 2 | name: dictFileds | ||
| 3 | </route> | ||
| 4 | |||
| 5 | <script lang="ts" setup name="dictFileds"> | ||
| 6 | import { ref } from 'vue' | ||
| 7 | import router from '@/router' | ||
| 8 | import { ElMessage, ElMessageBox } from "element-plus"; | ||
| 9 | import Table from '@/components/Table/index.vue' | ||
| 10 | // import Dialog from '@/components/Dialog/index.vue' | ||
| 11 | import useCatchStore from "@/store/modules/catch"; | ||
| 12 | import { chunk } from '@/utils/common' | ||
| 13 | |||
| 14 | import { | ||
| 15 | saveDictionaryData, | ||
| 16 | getDictionaryFileds, | ||
| 17 | deleteDictionaryData, | ||
| 18 | checkDictionaryData, | ||
| 19 | showDictionary, | ||
| 20 | getDictionaryRuleData | ||
| 21 | } from '@/api/modules/dataInventory'; | ||
| 22 | |||
| 23 | const emits = defineEmits(["exportData"]) | ||
| 24 | const { proxy } = getCurrentInstance() as any; | ||
| 25 | |||
| 26 | const cacheStore = useCatchStore() | ||
| 27 | const dictionaryGuid = ref("") | ||
| 28 | const tableSearchInput = ref('') | ||
| 29 | const tableFields: any = ref([]) | ||
| 30 | const orginData: any = ref([]) | ||
| 31 | const currTableData: any = ref<Object>({}); | ||
| 32 | const selectRowData = ref([]) | ||
| 33 | const page = ref({ | ||
| 34 | limit: 50, | ||
| 35 | curr: 1, | ||
| 36 | // sizes: [ | ||
| 37 | // { label: "100", value: 100 }, | ||
| 38 | // { label: "200", value: 200 }, | ||
| 39 | // { label: "300", value: 300 }, | ||
| 40 | // { label: "400", value: 400 }, | ||
| 41 | // { label: "500", value: 500 }, | ||
| 42 | // ], | ||
| 43 | }); | ||
| 44 | const tableChunkData: any = ref([]) | ||
| 45 | const tableData: any = ref([]) | ||
| 46 | const tableInfo: any = ref({ | ||
| 47 | id: 'data-fileds-table', | ||
| 48 | multiple: true, | ||
| 49 | fields: [], | ||
| 50 | data: [], | ||
| 51 | page: { | ||
| 52 | type: "count", | ||
| 53 | rows: 0, | ||
| 54 | ...page.value, | ||
| 55 | }, | ||
| 56 | // showPage: false, | ||
| 57 | actionInfo: { | ||
| 58 | label: "操作", | ||
| 59 | type: "btn", | ||
| 60 | width: 92, | ||
| 61 | btns: (scope) => { | ||
| 62 | return [ | ||
| 63 | { label: "编辑", value: "edit", visible: scope.row['STATE'] !== 'Running' }, | ||
| 64 | { label: "删除", value: "remove", visible: scope.row['STATE'] !== 'Running' }, | ||
| 65 | { label: "保存", value: "save", visible: scope.row['STATE'] === 'Running' }, | ||
| 66 | { label: "取消", value: "cancel", visible: scope.row['STATE'] === 'Running' }, | ||
| 67 | ] | ||
| 68 | }, | ||
| 69 | }, | ||
| 70 | editInfo: {}, | ||
| 71 | loading: false | ||
| 72 | }) | ||
| 73 | |||
| 74 | const uploadFiles = ref([]) | ||
| 75 | const uploadInfo = ref({ | ||
| 76 | type: 'upload', | ||
| 77 | title: '', | ||
| 78 | col: '', | ||
| 79 | uploadInfo: { | ||
| 80 | id: 'upload-file-form', | ||
| 81 | type: 'panel', | ||
| 82 | action: '', | ||
| 83 | auto: false, | ||
| 84 | cover: true, | ||
| 85 | fileList: [], | ||
| 86 | accept: '.xlsx, .xls', | ||
| 87 | triggerBtn: { | ||
| 88 | label: '导入', | ||
| 89 | value: 'import_file', | ||
| 90 | icon: 'Upload', | ||
| 91 | }, | ||
| 92 | tips: '当前支持xls、xlsx文件,默认使用第一个sheet' | ||
| 93 | }, | ||
| 94 | }) | ||
| 95 | |||
| 96 | const dialogInfo = ref({ | ||
| 97 | visible: false, | ||
| 98 | size: 640, | ||
| 99 | direction: "column", | ||
| 100 | header: { | ||
| 101 | title: "新建", | ||
| 102 | }, | ||
| 103 | type: '', | ||
| 104 | contents: [ | ||
| 105 | uploadInfo.value | ||
| 106 | ], | ||
| 107 | footer: { | ||
| 108 | visible: true, | ||
| 109 | btns: [ | ||
| 110 | { type: "default", label: "取消", value: "cancel" }, | ||
| 111 | { type: "primary", label: "开始导入", value: "submit" }, | ||
| 112 | ], | ||
| 113 | }, | ||
| 114 | }) | ||
| 115 | |||
| 116 | |||
| 117 | const getFirstPageData = () => { | ||
| 118 | toSearch({}) | ||
| 119 | } | ||
| 120 | |||
| 121 | const toSearch = (val: any, clear: boolean = false) => { | ||
| 122 | let params = dictionaryGuid.value | ||
| 123 | getTableData(params); | ||
| 124 | }; | ||
| 125 | |||
| 126 | const getTableData = (params) => { | ||
| 127 | tableInfo.value.loading = true | ||
| 128 | getDictionaryFileds(params).then((res: any) => { | ||
| 129 | if (res.code == proxy.$passCode) { | ||
| 130 | const data = res.data ?? {} | ||
| 131 | setUploadDataInfo(data, true) | ||
| 132 | } else { | ||
| 133 | ElMessage({ | ||
| 134 | type: 'error', | ||
| 135 | message: res.msg, | ||
| 136 | }) | ||
| 137 | } | ||
| 138 | tableInfo.value.loading = false | ||
| 139 | }).catch(xhr => { | ||
| 140 | tableInfo.value.loading = false | ||
| 141 | }) | ||
| 142 | }; | ||
| 143 | |||
| 144 | const tableSelectionChange = (val, tId) => { | ||
| 145 | selectRowData.value = val; | ||
| 146 | }; | ||
| 147 | |||
| 148 | const tablePageChange = (info) => { | ||
| 149 | page.value.curr = Number(info.curr); | ||
| 150 | if (page.value.limit != Number(info.limit)) { | ||
| 151 | page.value.limit = Number(info.limit); | ||
| 152 | chunkData() | ||
| 153 | } else { | ||
| 154 | tableData.value = tableChunkData.value[page.value.curr - 1] | ||
| 155 | tableInfo.value.data = tableData.value | ||
| 156 | tableInfo.value.page.limit = page.value.limit | ||
| 157 | tableInfo.value.page.curr = page.value.curr | ||
| 158 | } | ||
| 159 | }; | ||
| 160 | |||
| 161 | const toolBtnClick = (btn) => { | ||
| 162 | const type = btn.value | ||
| 163 | if (type == 'export') { | ||
| 164 | exportData() | ||
| 165 | } else if (type == 'import') { | ||
| 166 | const info = { | ||
| 167 | type: 'dictionary', | ||
| 168 | dictionaryGuid: dictionaryGuid.value | ||
| 169 | } | ||
| 170 | cacheStore.setCatch('uploadSetting', info) | ||
| 171 | nextTick(() => { | ||
| 172 | router.push({ | ||
| 173 | path: '/data-standards/import-file', | ||
| 174 | }); | ||
| 175 | }) | ||
| 176 | } else if (type == 'submit') { | ||
| 177 | saveData() | ||
| 178 | } else if (type == 'add_row') { | ||
| 179 | const params = { | ||
| 180 | guid: dictionaryGuid.value | ||
| 181 | } | ||
| 182 | getDictionaryRuleData(params).then((res: any) => { | ||
| 183 | if (res.code == proxy.$passCode) { | ||
| 184 | const data = res.data ?? {} | ||
| 185 | let rowInfo: any = {} | ||
| 186 | tableFields.value.map(item => { | ||
| 187 | rowInfo[item.field] = data[item.field] ?? '' | ||
| 188 | }) | ||
| 189 | rowInfo.guid = undefined; | ||
| 190 | rowInfo.STATE = 'Running' | ||
| 191 | rowInfo.STATUS = 'edit' | ||
| 192 | rowInfo.ROWID = `upload_${tableData.value.length}` | ||
| 193 | tableData.value.unshift(rowInfo) | ||
| 194 | orginData.value.unshift(rowInfo) | ||
| 195 | tableInfo.value.page.rows = tableData.value.length | ||
| 196 | // orginData.value.unshift(rowInfo) | ||
| 197 | // page.value.curr = 1 | ||
| 198 | // chunkData() | ||
| 199 | } else { | ||
| 200 | ElMessage({ | ||
| 201 | type: 'error', | ||
| 202 | message: res.msg | ||
| 203 | }) | ||
| 204 | } | ||
| 205 | }) | ||
| 206 | } | ||
| 207 | } | ||
| 208 | |||
| 209 | const tableBtnClick = (scope, btn) => { | ||
| 210 | const type = btn.value; | ||
| 211 | let row = scope.row; | ||
| 212 | currTableData.value = row; | ||
| 213 | if (type == "edit") { | ||
| 214 | row.STATE = 'Running' | ||
| 215 | row.STATUS = 'edit' | ||
| 216 | tableData.value[scope.$index] = row | ||
| 217 | } else if (type == 'save') { | ||
| 218 | saveData(scope) | ||
| 219 | } else if (type == 'cancel') { | ||
| 220 | if (row.guid != undefined) { | ||
| 221 | // row = orginData.value[(page.value.curr - 1) * page.value.limit + scope.$index] | ||
| 222 | row = JSON.parse(JSON.stringify(orginData.value[scope.$index])) | ||
| 223 | row.STATE = '' | ||
| 224 | row.STATUS = '' | ||
| 225 | tableData.value[scope.$index] = row | ||
| 226 | } else { | ||
| 227 | tableData.value.splice(scope.$index, 1) | ||
| 228 | orginData.value.splice(scope.$index, 1) | ||
| 229 | // orginData.value.splice((page.value.curr - 1) * page.value.limit + scope.$index, 1) | ||
| 230 | // if (scope.$index == 0) { | ||
| 231 | // page.value.curr = (page.value.curr - 1 > 1) ? page.value.curr - 1 : 1 | ||
| 232 | // } | ||
| 233 | // chunkData() | ||
| 234 | } | ||
| 235 | tableInfo.value.page.rows = tableData.value.length | ||
| 236 | } else if (type == 'remove') { | ||
| 237 | open("是否确定删除所选数据?", "warning"); | ||
| 238 | } | ||
| 239 | }; | ||
| 240 | |||
| 241 | const onUpload = (file, fileList) => { | ||
| 242 | uploadFiles.value = fileList | ||
| 243 | } | ||
| 244 | |||
| 245 | const uploadBtnClick = (btn) => { | ||
| 246 | exportData('model') | ||
| 247 | } | ||
| 248 | |||
| 249 | const exportData = (type: any = null) => { | ||
| 250 | emits('exportData', type) | ||
| 251 | } | ||
| 252 | |||
| 253 | const importData = (file: any = null) => { | ||
| 254 | let params = new FormData() | ||
| 255 | if (file) { | ||
| 256 | params.append("file", file.raw); | ||
| 257 | } else { | ||
| 258 | if (uploadFiles.value.length) { | ||
| 259 | uploadFiles.value.forEach((item: any, index: number) => { | ||
| 260 | params.append("file", item.raw); | ||
| 261 | }); | ||
| 262 | } | ||
| 263 | } | ||
| 264 | |||
| 265 | params.append("dictionaryGuid", dictionaryGuid.value); | ||
| 266 | showDictionary(params).then((res: any) => { | ||
| 267 | if (res.code == proxy.$passCode) { | ||
| 268 | dialogInfo.value.visible = false | ||
| 269 | let data = res.data ?? [] | ||
| 270 | // data.map((item: any, i) => { | ||
| 271 | // item.index = tableData.value.length + i | ||
| 272 | // }) | ||
| 273 | const tData = { jsonArray: data } | ||
| 274 | setUploadDataInfo(tData) | ||
| 275 | // saveData(null, tData) | ||
| 276 | } else { | ||
| 277 | ElMessage({ | ||
| 278 | type: "error", | ||
| 279 | message: res.msg, | ||
| 280 | }); | ||
| 281 | // dialogInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 282 | } | ||
| 283 | }).catch(() => { | ||
| 284 | // dialogInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 285 | }); | ||
| 286 | } | ||
| 287 | |||
| 288 | const checkSave = () => { | ||
| 289 | const toSaveData = tableData.value.filter(item => item.STATE === 'Running') | ||
| 290 | return toSaveData.length == 0 ? true : false | ||
| 291 | } | ||
| 292 | |||
| 293 | const checkParamsData = (scope: any = null) => { | ||
| 294 | let addJsonArray: any = [], upJsonArray: any = [], jsonArray: any = [], pass = true | ||
| 295 | let passArr = scope ? [scope.row] : tableData.value | ||
| 296 | passArr.map((item, index) => { | ||
| 297 | const obj = JSON.parse(JSON.stringify(item)) | ||
| 298 | delete obj.STATUS | ||
| 299 | delete obj.NOTES | ||
| 300 | delete obj.STATE | ||
| 301 | delete obj.ROWID | ||
| 302 | // if (item.STATE === 'Running') { | ||
| 303 | for (var i in obj) { | ||
| 304 | if (obj[i] == '') { | ||
| 305 | pass = false | ||
| 306 | } | ||
| 307 | } | ||
| 308 | // } | ||
| 309 | if (obj.guid !== undefined) { | ||
| 310 | upJsonArray.push(obj) | ||
| 311 | } else { | ||
| 312 | addJsonArray.push(obj) | ||
| 313 | } | ||
| 314 | if (scope) { | ||
| 315 | obj.index = scope.$index | ||
| 316 | jsonArray.push(obj) | ||
| 317 | } else { | ||
| 318 | obj.index = index | ||
| 319 | jsonArray.push(obj) | ||
| 320 | } | ||
| 321 | }) | ||
| 322 | return { pass, addJsonArray, upJsonArray, jsonArray } | ||
| 323 | } | ||
| 324 | |||
| 325 | const saveData = async (scope: any = null, checkParamData: any = null) => { | ||
| 326 | let passInfo: any = {} | ||
| 327 | if (checkParamData) { | ||
| 328 | passInfo = checkParamData | ||
| 329 | } else { | ||
| 330 | passInfo = await checkParamsData(scope) | ||
| 331 | if (!passInfo.pass) { | ||
| 332 | // ElMessage({ | ||
| 333 | // type: 'error', | ||
| 334 | // message: '请填写所有数据项' | ||
| 335 | // }) | ||
| 336 | // return | ||
| 337 | } | ||
| 338 | } | ||
| 339 | |||
| 340 | const checkParams = { | ||
| 341 | dictionaryGuid: dictionaryGuid.value, | ||
| 342 | addJsonArray: passInfo.jsonArray | ||
| 343 | } | ||
| 344 | checkDictionaryData(checkParams).then((res: any) => { | ||
| 345 | if (res.code == proxy.$passCode) { | ||
| 346 | const data = res.data | ||
| 347 | if (Object.keys(data).length) { | ||
| 348 | addColumn(data) | ||
| 349 | } else { | ||
| 350 | addColumn() | ||
| 351 | const params = { | ||
| 352 | dictionaryGuid: dictionaryGuid.value, | ||
| 353 | addJsonArray: passInfo.addJsonArray, | ||
| 354 | upJsonArray: passInfo.upJsonArray | ||
| 355 | } | ||
| 356 | saveDictionaryData(params).then((res: any) => { | ||
| 357 | if (res.code == proxy.$passCode) { | ||
| 358 | getFirstPageData(); | ||
| 359 | ElMessage({ | ||
| 360 | type: 'success', | ||
| 361 | message: '保存成功' | ||
| 362 | }) | ||
| 363 | } else { | ||
| 364 | ElMessage({ | ||
| 365 | type: 'error', | ||
| 366 | message: res.msg, | ||
| 367 | }) | ||
| 368 | } | ||
| 369 | }) | ||
| 370 | } | ||
| 371 | } else { | ||
| 372 | ElMessage({ | ||
| 373 | type: 'error', | ||
| 374 | message: res.msg, | ||
| 375 | }) | ||
| 376 | } | ||
| 377 | }) | ||
| 378 | } | ||
| 379 | |||
| 380 | const addColumn = (info: any = null) => { | ||
| 381 | const fields = tableFields.value | ||
| 382 | const existIndex = fields.findIndex(item => item.field == 'NOTES') | ||
| 383 | if (info) { | ||
| 384 | if (existIndex == -1) { | ||
| 385 | fields.push({ | ||
| 386 | label: '备注', | ||
| 387 | field: 'NOTES', | ||
| 388 | width: 200 | ||
| 389 | }) | ||
| 390 | } | ||
| 391 | for (var d in info) { | ||
| 392 | tableData.value[d].NOTES = info[d].join(',') | ||
| 393 | } | ||
| 394 | } else { | ||
| 395 | if (existIndex > -1) { | ||
| 396 | fields.splice(existIndex, 1) | ||
| 397 | } | ||
| 398 | } | ||
| 399 | } | ||
| 400 | |||
| 401 | // 生成表头 | ||
| 402 | const setUploadDataFields = (data) => { | ||
| 403 | let fields: any = [], editInfo: any = {} | ||
| 404 | data.map(item => { | ||
| 405 | let fieldItem: any = { | ||
| 406 | label: item.description, field: item.fieldName, width: 140 | ||
| 407 | } | ||
| 408 | fieldItem.type = 'edit' | ||
| 409 | fieldItem.columClass = 'edit-colum' | ||
| 410 | editInfo[item.fieldName] = { | ||
| 411 | label: '', | ||
| 412 | type: 'input', | ||
| 413 | placeholder: '', | ||
| 414 | maxlength: 50, | ||
| 415 | field: item.fieldName, | ||
| 416 | default: '', | ||
| 417 | disabled: item.codeRuleGuid ? true : false, | ||
| 418 | clearable: true, | ||
| 419 | } | ||
| 420 | fields.push(fieldItem) | ||
| 421 | }) | ||
| 422 | tableFields.value = fields | ||
| 423 | tableInfo.value.fields = tableFields.value | ||
| 424 | tableInfo.value.editInfo = editInfo | ||
| 425 | } | ||
| 426 | |||
| 427 | // 生成表数据 | ||
| 428 | const setUploadDataInfo = async (info, setField = false) => { | ||
| 429 | if (setField) { | ||
| 430 | const fields = info.schemaDataVOS ?? [] | ||
| 431 | await setUploadDataFields(fields) | ||
| 432 | } | ||
| 433 | let data = info.jsonArray ?? [] | ||
| 434 | // 设置表数据 | ||
| 435 | data.map((item, i) => { | ||
| 436 | item.ROWID = `upload_${tableData.value.length + i}` | ||
| 437 | }) | ||
| 438 | if (setField) { | ||
| 439 | tableData.value = data | ||
| 440 | } else { | ||
| 441 | tableData.value = [...tableData.value, ...data] | ||
| 442 | } | ||
| 443 | orginData.value = JSON.parse(JSON.stringify(tableData.value)) | ||
| 444 | tableInfo.value.data = tableData.value | ||
| 445 | tableInfo.value.page.rows = tableData.value.length | ||
| 446 | // if (setField) { | ||
| 447 | // orginData.value = data | ||
| 448 | // } else { | ||
| 449 | // orginData.value = [...orginData.value, ...data] | ||
| 450 | // } | ||
| 451 | // chunkData() | ||
| 452 | } | ||
| 453 | |||
| 454 | const chunkData = () => { | ||
| 455 | const data = orginData.value | ||
| 456 | tableChunkData.value = chunk(data, page.value.limit) | ||
| 457 | tableData.value = tableChunkData.value[page.value.curr - 1] | ||
| 458 | tableInfo.value.data = tableData.value | ||
| 459 | tableInfo.value.page.limit = page.value.limit | ||
| 460 | tableInfo.value.page.curr = page.value.curr | ||
| 461 | tableInfo.value.page.rows = orginData.value.length | ||
| 462 | } | ||
| 463 | |||
| 464 | const batching = (type) => { | ||
| 465 | if (type == 'delete') { | ||
| 466 | if (selectRowData.value.length == 0) { | ||
| 467 | ElMessage({ | ||
| 468 | type: 'error', | ||
| 469 | message: '请选择需要删除的数据', | ||
| 470 | }) | ||
| 471 | return | ||
| 472 | } | ||
| 473 | open("是否确定删除所选数据?", "warning", true); | ||
| 474 | } | ||
| 475 | }; | ||
| 476 | |||
| 477 | const open = (msg, type, isBatch = false) => { | ||
| 478 | ElMessageBox.confirm(msg, "提示", { | ||
| 479 | confirmButtonText: "确定", | ||
| 480 | cancelButtonText: "取消", | ||
| 481 | type: type, | ||
| 482 | }).then(() => { | ||
| 483 | let guids: any = [] | ||
| 484 | if (isBatch) { | ||
| 485 | const list = selectRowData.value.filter((item: any) => item.guid !== undefined) | ||
| 486 | if (list.length) { | ||
| 487 | guids = list.map((l: any) => l.guid) | ||
| 488 | } | ||
| 489 | const newRows = selectRowData.value.filter((item: any) => item.guid == undefined) | ||
| 490 | newRows.map((n: any, r) => { | ||
| 491 | const existIndex = tableData.value.findIndex(t => t.ROWID == n.ROWID) | ||
| 492 | if (existIndex > -1) { | ||
| 493 | tableData.value.splice(existIndex, 1) | ||
| 494 | orginData.value.splice(existIndex, 1) | ||
| 495 | } | ||
| 496 | // const existIndex = orginData.value.findIndex(t => t.id == n.id) | ||
| 497 | // existIndex > -1 && orginData.value.splice(existIndex, 1) | ||
| 498 | // if (r == newRows.length - 1) { | ||
| 499 | // page.value.curr = 1 | ||
| 500 | // chunkData() | ||
| 501 | // } | ||
| 502 | }) | ||
| 503 | tableInfo.value.page.rows = tableData.value.length | ||
| 504 | } else { | ||
| 505 | guids = [currTableData.value.guid] | ||
| 506 | } | ||
| 507 | if (guids.length) { | ||
| 508 | const params = { | ||
| 509 | guid: dictionaryGuid.value, | ||
| 510 | delGuids: guids | ||
| 511 | } | ||
| 512 | deleteDictionaryData(params).then((res: any) => { | ||
| 513 | if (res.code == proxy.$passCode) { | ||
| 514 | getFirstPageData(); | ||
| 515 | ElMessage({ | ||
| 516 | type: "success", | ||
| 517 | message: "删除成功", | ||
| 518 | }); | ||
| 519 | } else { | ||
| 520 | ElMessage({ | ||
| 521 | type: "error", | ||
| 522 | message: res.msg, | ||
| 523 | }); | ||
| 524 | } | ||
| 525 | }); | ||
| 526 | } | ||
| 527 | }); | ||
| 528 | }; | ||
| 529 | |||
| 530 | const dialogBtnClick = (btn, info) => { | ||
| 531 | if (btn.value == 'submit') { | ||
| 532 | // dialogInfo.value.footer.btns.map((item: any) => item.disabled = true) | ||
| 533 | importData() | ||
| 534 | } else if (btn.value == 'cancel') { | ||
| 535 | // dialogInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 536 | nextTick(() => { | ||
| 537 | dialogInfo.value.visible = false; | ||
| 538 | }) | ||
| 539 | } | ||
| 540 | }; | ||
| 541 | |||
| 542 | defineExpose({ | ||
| 543 | dictionaryGuid, | ||
| 544 | getFirstPageData, | ||
| 545 | checkSave | ||
| 546 | }); | ||
| 547 | |||
| 548 | </script> | ||
| 549 | |||
| 550 | <template> | ||
| 551 | <div class="container_wrap full flex"> | ||
| 552 | <div class="main_wrap"> | ||
| 553 | <div class="table_tool_wrap"> | ||
| 554 | <div class="tools_btns"> | ||
| 555 | <el-button type="primary" @click="toolBtnClick({ value: 'add_row' })" v-preReClick>新增行</el-button> | ||
| 556 | <el-button type="primary" plain @click="toolBtnClick({ value: 'submit' })" v-preReClick>保存数据</el-button> | ||
| 557 | <el-button @click="batching('delete')" v-preReClick>批量删除</el-button> | ||
| 558 | <el-button @click="toolBtnClick({ value: 'import' })" v-preReClick>导入数据</el-button> | ||
| 559 | <el-button @click="toolBtnClick({ value: 'export' })" v-preReClick>导出数据</el-button> | ||
| 560 | </div> | ||
| 561 | <!-- <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="输入名称搜索" :suffix-icon="Search" clearable | ||
| 562 | @change="val => toSearch({})" /> --> | ||
| 563 | </div> | ||
| 564 | <div class="table_panel_wrap full"> | ||
| 565 | <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange" | ||
| 566 | @tablePageChange="tablePageChange" /> | ||
| 567 | </div> | ||
| 568 | </div> | ||
| 569 | |||
| 570 | <!-- <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @onUpload="onUpload" @uploadBtnClick="uploadBtnClick" /> --> | ||
| 571 | </div> | ||
| 572 | </template> | ||
| 573 | |||
| 574 | <style lang="scss" scoped> | ||
| 575 | .container_wrap { | ||
| 576 | width: calc(100% - 200px); | ||
| 577 | |||
| 578 | .main_wrap { | ||
| 579 | width: 100%; | ||
| 580 | |||
| 581 | .table_panel_wrap { | ||
| 582 | height: calc(100% - 44px); | ||
| 583 | } | ||
| 584 | } | ||
| 585 | } | ||
| 586 | </style> |
src/views/data_inventory/dictionary.vue
0 → 100644
| 1 | <route lang="yaml"> | ||
| 2 | name: dictionary | ||
| 3 | </route> | ||
| 4 | |||
| 5 | <script lang="ts" setup name="dictionary"> | ||
| 6 | import { ref } from 'vue' | ||
| 7 | import { ElMessage, ElMessageBox } from "element-plus"; | ||
| 8 | import { Search } from '@element-plus/icons-vue' | ||
| 9 | import Tree from '@/components/Tree/index.vue' | ||
| 10 | import Table from '@/components/Table/index.vue' | ||
| 11 | import Drawer from '@/components/Drawer/index.vue' | ||
| 12 | import DictFileds from './dictFileds.vue' | ||
| 13 | import useCatchStore from "@/store/modules/catch"; | ||
| 14 | import { download } from '@/utils/common' | ||
| 15 | |||
| 16 | import { | ||
| 17 | addDictionary, | ||
| 18 | deleteDictionary, | ||
| 19 | getDictionary, | ||
| 20 | updateDictionary, | ||
| 21 | getDictionaryTree, | ||
| 22 | getDictionaryDetail, | ||
| 23 | exportDictionary, | ||
| 24 | showDictionary, | ||
| 25 | getDataBaseList, | ||
| 26 | getDataTypeList, | ||
| 27 | getCoderuleList, | ||
| 28 | saveDictionaryData, | ||
| 29 | getDictionaryFileds, | ||
| 30 | updateDictionaryState, | ||
| 31 | getDictionaryRuleData, | ||
| 32 | exportDictionaryFileds, | ||
| 33 | checkDeleteDictionary, | ||
| 34 | checkDeleteDictionaryScheme, | ||
| 35 | checkDictionaryData | ||
| 36 | } from '@/api/modules/dataInventory'; | ||
| 37 | |||
| 38 | const { proxy } = getCurrentInstance() as any; | ||
| 39 | |||
| 40 | const cacheStore = useCatchStore() | ||
| 41 | // 禁用字段 | ||
| 42 | const forbidFields = [ | ||
| 43 | 'guid', | ||
| 44 | 'sharding_flag', | ||
| 45 | 'create_user_id', | ||
| 46 | 'create_user_name', | ||
| 47 | 'update_user_id', | ||
| 48 | 'update_user_name', | ||
| 49 | 'create_time', | ||
| 50 | 'update_time', | ||
| 51 | 'is_deleted' | ||
| 52 | ] | ||
| 53 | const showFiledsPage = ref(false) | ||
| 54 | const dictFiledsRef = ref() | ||
| 55 | const dataTypeList = ref([]) | ||
| 56 | const dataBaseList = ref([]) | ||
| 57 | const codeRuleList = ref([]) | ||
| 58 | const dictTreeRef = ref() | ||
| 59 | const dictType = ref(-1) | ||
| 60 | const dictGuid = ref('') | ||
| 61 | const expandedKey: any = ref([]) | ||
| 62 | const currentNodeKey = ref('') | ||
| 63 | const showLoading = ref(true) | ||
| 64 | const treeData = ref([]) | ||
| 65 | const treeInfo = ref({ | ||
| 66 | id: "data-pickup-tree", | ||
| 67 | filter: true, | ||
| 68 | queryValue: "", | ||
| 69 | queryPlaceholder: "输入字典名称搜索", | ||
| 70 | props: { | ||
| 71 | label: "name", | ||
| 72 | value: "guid", | ||
| 73 | }, | ||
| 74 | nodeKey: 'guid', | ||
| 75 | expandedKey: [], | ||
| 76 | currentNodeKey: '', | ||
| 77 | data: [], | ||
| 78 | expandOnNodeClick: false, | ||
| 79 | loading: false | ||
| 80 | }); | ||
| 81 | |||
| 82 | const tableSearchInput = ref('') | ||
| 83 | const currTableData: any = ref<Object>({}); | ||
| 84 | const page = ref({ | ||
| 85 | limit: 50, | ||
| 86 | curr: 1, | ||
| 87 | sizes: [ | ||
| 88 | { label: "10", value: 10 }, | ||
| 89 | { label: "50", value: 50 }, | ||
| 90 | { label: "100", value: 100 }, | ||
| 91 | { label: "150", value: 150 }, | ||
| 92 | { label: "200", value: 200 }, | ||
| 93 | ], | ||
| 94 | }); | ||
| 95 | const selectRowData = ref([]) | ||
| 96 | const tableInfo: any = ref({ | ||
| 97 | id: 'data-source-table', | ||
| 98 | multiple: true, | ||
| 99 | fixedSelection: true, | ||
| 100 | fields: [ | ||
| 101 | { label: "序号", type: "index", width: 56, align: "center" }, | ||
| 102 | { label: "字典中文名", field: "chName", type: 'text_btn', class: 'drawer-detail-cell', width: 120, value: 'detail', columClass: 'text_btn' }, | ||
| 103 | { label: "字典英文名", field: "enName", width: 120 }, | ||
| 104 | { label: "字典类型", field: "dictionaryType", type: 'filter', width: 120 }, | ||
| 105 | { label: "排序", field: "orderNum", type: 'filter', width: 56, align: 'center' }, | ||
| 106 | { label: '状态', field: 'state', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 1, inactiveValue: 0, switchWidth: 56, width: 100, align: 'center' }, | ||
| 107 | { label: "编码规则", field: "codeRuleName", width: 120 }, | ||
| 108 | { label: "修改人", field: "updateUserName", width: 140 }, | ||
| 109 | { label: "修改时间", field: "updateTime", width: 180, }, | ||
| 110 | ], | ||
| 111 | data: [], | ||
| 112 | page: { | ||
| 113 | type: "normal", | ||
| 114 | rows: 0, | ||
| 115 | ...page.value, | ||
| 116 | }, | ||
| 117 | actionInfo: { | ||
| 118 | label: "操作", | ||
| 119 | type: "btn", | ||
| 120 | width: 92, //不要刚好90.缩小浏览器会因为小数点的差距而换行, | ||
| 121 | fixed: 'right', | ||
| 122 | btns: [ | ||
| 123 | { label: "编辑", value: "edit" }, | ||
| 124 | { label: "删除", value: "delete" }, | ||
| 125 | ], | ||
| 126 | }, | ||
| 127 | loading: false | ||
| 128 | }) | ||
| 129 | |||
| 130 | const dictionaryType = ref(1) | ||
| 131 | const orginOptions = [ | ||
| 132 | { label: 'code', value: 'code' }, | ||
| 133 | { label: 'name', value: 'name' }, | ||
| 134 | ] | ||
| 135 | const orginItems = [ | ||
| 136 | // { | ||
| 137 | // label: '数据库名称', | ||
| 138 | // type: 'select', | ||
| 139 | // placeholder: '请选择', | ||
| 140 | // field: 'databaseNameZh', | ||
| 141 | // options: [], | ||
| 142 | // clearable: true, | ||
| 143 | // required: true, | ||
| 144 | // visible: true, | ||
| 145 | // }, | ||
| 146 | { | ||
| 147 | label: '字典中文名', | ||
| 148 | type: 'input', | ||
| 149 | maxlength: 50, | ||
| 150 | placeholder: '请输入', | ||
| 151 | field: 'chName', | ||
| 152 | clearable: true, | ||
| 153 | required: true, | ||
| 154 | disabled: false | ||
| 155 | }, { | ||
| 156 | label: '字典英文名', | ||
| 157 | type: 'input', | ||
| 158 | maxlength: 50, | ||
| 159 | placeholder: '请输入', | ||
| 160 | field: 'enName', | ||
| 161 | clearable: true, | ||
| 162 | required: true, | ||
| 163 | disabled: false | ||
| 164 | }, { | ||
| 165 | label: '排序', | ||
| 166 | type: 'input', | ||
| 167 | placeholder: '请输入', | ||
| 168 | field: 'orderNum', | ||
| 169 | maxlength: 6, | ||
| 170 | clearable: true, | ||
| 171 | required: true, | ||
| 172 | visible: true, | ||
| 173 | }, { | ||
| 174 | label: '字典类型', | ||
| 175 | type: 'radio-panel', | ||
| 176 | placeholder: '', | ||
| 177 | field: 'dictionaryType', | ||
| 178 | default: 1, | ||
| 179 | options: [ | ||
| 180 | { label: '列表结构', value: 1 }, | ||
| 181 | { label: '层级结构', value: 2 }, | ||
| 182 | { label: '螺旋结构', value: 3 }, | ||
| 183 | { label: '通用结构', value: 4 }, | ||
| 184 | ], | ||
| 185 | children: [ | ||
| 186 | { | ||
| 187 | label: '编码字段', | ||
| 188 | type: 'select', | ||
| 189 | placeholder: '请输入', | ||
| 190 | field: 'codeColumn', | ||
| 191 | default: '', | ||
| 192 | options: [], | ||
| 193 | clearable: true, | ||
| 194 | required: true | ||
| 195 | }, { | ||
| 196 | label: '编码名称', | ||
| 197 | type: 'select', | ||
| 198 | placeholder: '请输入', | ||
| 199 | field: 'codeName', | ||
| 200 | default: '', | ||
| 201 | options: [], | ||
| 202 | clearable: true, | ||
| 203 | required: true | ||
| 204 | }, { | ||
| 205 | label: '顶级节点值', | ||
| 206 | type: 'input', | ||
| 207 | placeholder: '请输入', | ||
| 208 | field: 'topNodeValue', | ||
| 209 | clearable: true, | ||
| 210 | required: true, | ||
| 211 | visible: false | ||
| 212 | }, { | ||
| 213 | label: '路径', | ||
| 214 | type: 'input', | ||
| 215 | placeholder: '请输入', | ||
| 216 | field: 'path', | ||
| 217 | clearable: true, | ||
| 218 | required: true, | ||
| 219 | block: true, | ||
| 220 | visible: false | ||
| 221 | } | ||
| 222 | ], | ||
| 223 | clearable: true, | ||
| 224 | required: false, | ||
| 225 | block: true, | ||
| 226 | visible: true, | ||
| 227 | }, | ||
| 228 | ] | ||
| 229 | const formItems: any = ref([]) | ||
| 230 | const formRules: any = ref({ | ||
| 231 | chName: [ | ||
| 232 | { | ||
| 233 | required: true, | ||
| 234 | message: "请填写中文名", | ||
| 235 | trigger: "blur", | ||
| 236 | }, | ||
| 237 | ], | ||
| 238 | enName: [ | ||
| 239 | { | ||
| 240 | required: true, | ||
| 241 | message: "请填写英文名", | ||
| 242 | trigger: "blur", | ||
| 243 | }, | ||
| 244 | ], | ||
| 245 | orderNum: [{ | ||
| 246 | validator: (rule: any, value: any, callback: any) => { | ||
| 247 | if (value === 0) { | ||
| 248 | callback(); | ||
| 249 | return; | ||
| 250 | } | ||
| 251 | if (!value) { | ||
| 252 | callback(new Error('请填写排序')); | ||
| 253 | return; | ||
| 254 | } | ||
| 255 | const r = /(^[0-9]([0-9]*)$|^[0-9]$)/; // 正整数(可以以0打头) | ||
| 256 | if (value && !r.test(value)) { | ||
| 257 | callback(new Error('请填写大于或等于零整数')); | ||
| 258 | return; | ||
| 259 | } | ||
| 260 | callback(); | ||
| 261 | }, | ||
| 262 | trigger: "blur", | ||
| 263 | }], | ||
| 264 | codeColumn: [ | ||
| 265 | { | ||
| 266 | required: true, | ||
| 267 | message: "请填写编码字段", | ||
| 268 | trigger: "blur", | ||
| 269 | }, | ||
| 270 | ], | ||
| 271 | codeName: [ | ||
| 272 | { | ||
| 273 | required: true, | ||
| 274 | message: "请填写编码名称", | ||
| 275 | trigger: "blur", | ||
| 276 | }, | ||
| 277 | ], | ||
| 278 | }) | ||
| 279 | const formInfo = ref({ | ||
| 280 | type: 'form', | ||
| 281 | title: '', | ||
| 282 | col: 'span', | ||
| 283 | formInfo: { | ||
| 284 | id: 'add-dict-form', | ||
| 285 | col: 'col3', | ||
| 286 | readonly: false, | ||
| 287 | items: formItems.value, | ||
| 288 | rules: formRules.value | ||
| 289 | } | ||
| 290 | }) | ||
| 291 | |||
| 292 | const orginData = [ | ||
| 293 | { | ||
| 294 | ROWID: 'field_0', | ||
| 295 | fieldName: 'code', | ||
| 296 | description: '编码字段', | ||
| 297 | fieldType: 'varchar', | ||
| 298 | fieldLength: '10', | ||
| 299 | fieldPrecision: '', | ||
| 300 | // orderNum: '1', | ||
| 301 | codeRuleGuid: '', | ||
| 302 | STATUS: 'edit', | ||
| 303 | STATE: 'Running' | ||
| 304 | }, { | ||
| 305 | ROWID: 'field_1', | ||
| 306 | fieldName: 'name', | ||
| 307 | description: '编码名称', | ||
| 308 | fieldType: 'varchar', | ||
| 309 | fieldLength: '20', | ||
| 310 | fieldPrecision: '', | ||
| 311 | // orderNum: '2', | ||
| 312 | codeRuleGuid: '', | ||
| 313 | STATUS: 'edit', | ||
| 314 | STATE: 'Running' | ||
| 315 | } | ||
| 316 | ] | ||
| 317 | const orginFields = [ | ||
| 318 | { label: "序号", type: "index", width: 56, align: "center" }, | ||
| 319 | { label: "字段英文名", field: "fieldName", width: 140, }, | ||
| 320 | { label: "字段中文名", field: "description", width: 140, }, | ||
| 321 | { label: "字段类型", field: "fieldType", width: 100, }, | ||
| 322 | { label: "长度", field: "fieldLength", width: 80, }, | ||
| 323 | { label: "精度", field: "fieldPrecision", width: 80, }, | ||
| 324 | // { label: "排序", field: "orderNum", width: 56, }, | ||
| 325 | { label: "编码规则", field: "codeRuleGuid", width: 140, }, | ||
| 326 | ] | ||
| 327 | const formTableData: any = ref([]) | ||
| 328 | const formTableSelectRowData: any = ref([]) | ||
| 329 | const editTableInfo = ref({ | ||
| 330 | fieldName: { | ||
| 331 | label: '字段英文名', | ||
| 332 | type: 'input', | ||
| 333 | maxlength: 50, | ||
| 334 | placeholder: '', | ||
| 335 | field: 'fieldName', | ||
| 336 | default: '', | ||
| 337 | clearable: true, | ||
| 338 | required: true, | ||
| 339 | }, | ||
| 340 | description: { | ||
| 341 | label: '字段中文名', | ||
| 342 | type: 'input', | ||
| 343 | maxlength: 50, | ||
| 344 | placeholder: '', | ||
| 345 | field: 'description', | ||
| 346 | default: '', | ||
| 347 | clearable: true, | ||
| 348 | required: true, | ||
| 349 | }, | ||
| 350 | fieldType: { | ||
| 351 | label: '字段类型', | ||
| 352 | type: 'select', | ||
| 353 | placeholder: '', | ||
| 354 | field: 'fieldType', | ||
| 355 | default: '', | ||
| 356 | options: [], | ||
| 357 | clearable: true, | ||
| 358 | required: true | ||
| 359 | }, | ||
| 360 | fieldLength: { | ||
| 361 | label: '长度', | ||
| 362 | type: 'input', | ||
| 363 | placeholder: '', | ||
| 364 | field: 'fieldLength', | ||
| 365 | default: '', | ||
| 366 | clearable: true, | ||
| 367 | required: true, | ||
| 368 | }, | ||
| 369 | fieldPrecision: { | ||
| 370 | label: '精度', | ||
| 371 | type: 'input', | ||
| 372 | placeholder: '', | ||
| 373 | field: 'fieldPrecision', | ||
| 374 | default: '', | ||
| 375 | clearable: true, | ||
| 376 | required: true, | ||
| 377 | }, | ||
| 378 | // orderNum: { | ||
| 379 | // label: '排序', | ||
| 380 | // type: 'input', | ||
| 381 | // placeholder: '', | ||
| 382 | // field: 'orderNum', | ||
| 383 | // default: '', | ||
| 384 | // maxlength: 6, | ||
| 385 | // clearable: true, | ||
| 386 | // required: true, | ||
| 387 | // }, | ||
| 388 | codeRuleGuid: { | ||
| 389 | label: '编码规则', | ||
| 390 | type: 'select', | ||
| 391 | placeholder: '', | ||
| 392 | field: 'codeRuleGuid', | ||
| 393 | default: '', | ||
| 394 | options: [], | ||
| 395 | clearable: true, | ||
| 396 | required: true | ||
| 397 | } | ||
| 398 | }) | ||
| 399 | const formTable = ref({ | ||
| 400 | type: "table", | ||
| 401 | title: "定义表结构", | ||
| 402 | col: 'no-margin', | ||
| 403 | style: { | ||
| 404 | height: 'calc(100% - 234px)' | ||
| 405 | }, | ||
| 406 | tableInfo: { | ||
| 407 | id: "role-authority-table", | ||
| 408 | multiple: true, | ||
| 409 | minHeight: 'unset', | ||
| 410 | maxHeight: '100%', | ||
| 411 | fields: [], | ||
| 412 | data: [], | ||
| 413 | showPage: false, | ||
| 414 | actionInfo: { | ||
| 415 | show: true, | ||
| 416 | label: "操作", | ||
| 417 | type: "btn", | ||
| 418 | width: 60, | ||
| 419 | fixed: 'right', | ||
| 420 | btns: [ | ||
| 421 | { label: "删除", value: "remove" }, | ||
| 422 | ] | ||
| 423 | }, | ||
| 424 | editInfo: {}, | ||
| 425 | readonly: false, | ||
| 426 | col: 'auto-height', | ||
| 427 | style: { | ||
| 428 | height: 'calc(100% - 40px)' | ||
| 429 | }, | ||
| 430 | loading: false | ||
| 431 | }, | ||
| 432 | tableTool: { | ||
| 433 | col: 'float-right', | ||
| 434 | visible: true, | ||
| 435 | btns: [ | ||
| 436 | { label: "新增行", value: "add-row", type: 'primary', plain: true }, | ||
| 437 | { label: "批量删除", value: "remove_batch" }, | ||
| 438 | ] | ||
| 439 | }, | ||
| 440 | }) | ||
| 441 | |||
| 442 | const fieldSheetInfo: any = ref({}) | ||
| 443 | const uploadTableData: any = ref([]) | ||
| 444 | const uploadSelectRowData: any = ref([]) | ||
| 445 | const uploadTableFields: any = ref([]) | ||
| 446 | const uploadTableInfo = ref({ | ||
| 447 | id: "role-authority-table", | ||
| 448 | multiple: true, | ||
| 449 | // minHeight: 'unset', | ||
| 450 | // maxHeight: '100%', | ||
| 451 | fields: [], | ||
| 452 | data: [], | ||
| 453 | showPage: false, | ||
| 454 | actionInfo: { | ||
| 455 | label: "操作", | ||
| 456 | type: "btn", | ||
| 457 | width: 60, | ||
| 458 | btns: [ | ||
| 459 | { label: "删除", value: "remove" }, | ||
| 460 | ], | ||
| 461 | }, | ||
| 462 | editInfo: {}, | ||
| 463 | readonly: false, | ||
| 464 | loading: false | ||
| 465 | }) | ||
| 466 | const uploadFiles: any = ref([]) | ||
| 467 | const uploadInfo = ref({ | ||
| 468 | type: 'upload', | ||
| 469 | title: '添加表数据', | ||
| 470 | col: 'row-reverse', | ||
| 471 | uploadInfo: { | ||
| 472 | id: 'upload-file-form', | ||
| 473 | action: '', | ||
| 474 | auto: false, | ||
| 475 | fileList: [], | ||
| 476 | accept: '.xlsx, .xls', | ||
| 477 | cover: true, | ||
| 478 | triggerBtn: { | ||
| 479 | label: '导入文件', | ||
| 480 | value: 'import_file', | ||
| 481 | icon: 'Upload', | ||
| 482 | plain: true, | ||
| 483 | }, | ||
| 484 | toolBar: [ | ||
| 485 | { label: '下载模板', value: 'export_model', plain: true, icon: 'Download' }, | ||
| 486 | ] | ||
| 487 | // showList: false, | ||
| 488 | }, | ||
| 489 | tableInfo: {}, | ||
| 490 | tools: { | ||
| 491 | col: 'right', | ||
| 492 | visible: true, | ||
| 493 | btns: [ | ||
| 494 | { label: '树形显示', value: 'show_tree', type: 'primary', plain: true, visible: false }, | ||
| 495 | { label: '新增行', value: 'add_row', type: 'primary', plain: true }, | ||
| 496 | { label: '批量删除', value: 'remove_batch', plain: true }, | ||
| 497 | ] | ||
| 498 | } | ||
| 499 | }) | ||
| 500 | const fieldTableInfo = ref({ | ||
| 501 | type: 'field-table', | ||
| 502 | title: '表数据', | ||
| 503 | tableInfo: { | ||
| 504 | id: 'dict-field-table', | ||
| 505 | minHeight: 'unset', | ||
| 506 | maxHeight: '100%', | ||
| 507 | fields: [], | ||
| 508 | data: [], | ||
| 509 | loading: false, | ||
| 510 | showPage: false, | ||
| 511 | actionInfo: { | ||
| 512 | show: false | ||
| 513 | }, | ||
| 514 | col: 'auto-height' | ||
| 515 | } | ||
| 516 | }) | ||
| 517 | |||
| 518 | const contents = ref({ | ||
| 519 | add: [ | ||
| 520 | formInfo.value, | ||
| 521 | formTable.value, | ||
| 522 | ], | ||
| 523 | upload: [ | ||
| 524 | formInfo.value, | ||
| 525 | uploadInfo.value, | ||
| 526 | ], | ||
| 527 | sheet: [ | ||
| 528 | formInfo.value, | ||
| 529 | formTable.value, | ||
| 530 | ], | ||
| 531 | field: [ | ||
| 532 | formInfo.value, | ||
| 533 | fieldTableInfo.value, | ||
| 534 | ] | ||
| 535 | }) | ||
| 536 | |||
| 537 | const drawerRef = ref() | ||
| 538 | const drawerInfo: any = ref({ | ||
| 539 | visible: false, | ||
| 540 | direction: "rtl", | ||
| 541 | modalClass: "", | ||
| 542 | modalClose: false, | ||
| 543 | modal: true, | ||
| 544 | size: 700, | ||
| 545 | header: { | ||
| 546 | title: "新增", | ||
| 547 | }, | ||
| 548 | type: '', | ||
| 549 | container: { | ||
| 550 | contents: [], | ||
| 551 | }, | ||
| 552 | footer: { | ||
| 553 | btns: [ | ||
| 554 | { type: 'default', label: '取消', value: 'cancel' }, | ||
| 555 | { type: 'primary', label: '保存', value: 'submit' }, | ||
| 556 | { type: 'primary', label: '查看数据', value: 'fileds', visible: false }, | ||
| 557 | { type: 'primary', label: '查看表结构', value: 'sheet', visible: false }, | ||
| 558 | { type: 'primary', label: '保存并添加数据', value: 'saveAndAdd', visible: true }, | ||
| 559 | ] | ||
| 560 | }, | ||
| 561 | }) | ||
| 562 | |||
| 563 | const setFormItems = (row: any = null) => { | ||
| 564 | formItems.value = JSON.parse(JSON.stringify(orginItems)) | ||
| 565 | formItems.value.map(item => { | ||
| 566 | if (item.field == 'databaseNameZh') { | ||
| 567 | item.options = dataBaseList.value | ||
| 568 | item.default = row ? row[item.field] : '' | ||
| 569 | } else if (item.field == 'dictionaryType') { | ||
| 570 | item.default = dictionaryType.value | ||
| 571 | // item.disabled = drawerInfo.value.type == 'add' ? false : true | ||
| 572 | item.disabled = true | ||
| 573 | item.children.map(child => { | ||
| 574 | child.options = orginOptions | ||
| 575 | if (child.field == 'codeColumn') { | ||
| 576 | child.default = row ? row[child.field] : 'code' | ||
| 577 | } else if (child.field == 'codeName') { | ||
| 578 | child.default = row ? row[child.field] : 'name' | ||
| 579 | } else { | ||
| 580 | child.default = row ? row[child.field] : '' | ||
| 581 | } | ||
| 582 | child.disabled = drawerInfo.value.type == 'detail' ? true : false | ||
| 583 | child.clearable = drawerInfo.value.type == 'detail' ? false : true | ||
| 584 | }) | ||
| 585 | } else if (item.field == 'enName') { | ||
| 586 | item.default = row ? row[item.field] : '' | ||
| 587 | item.disabled = drawerInfo.value.type == 'add' ? false : true | ||
| 588 | item.clearable = drawerInfo.value.type == 'add' ? true : false | ||
| 589 | } else { | ||
| 590 | item.default = row ? row[item.field] : '' | ||
| 591 | item.disabled = drawerInfo.value.type == 'detail' ? true : false | ||
| 592 | item.clearable = drawerInfo.value.type == 'detail' ? false : true | ||
| 593 | } | ||
| 594 | }) | ||
| 595 | formInfo.value.formInfo.readonly = drawerInfo.value.type == 'detail' | ||
| 596 | formInfo.value.formInfo.items = formItems.value | ||
| 597 | |||
| 598 | // for(var e in editTableInfo.value){ | ||
| 599 | // const editItem = editTableInfo.value[e] | ||
| 600 | // if(editItem.field != 'description' && editItem.field != 'codeRuleGuid'){ | ||
| 601 | // editItem.disabled = drawerInfo.value.type != 'add' | ||
| 602 | // } | ||
| 603 | // } | ||
| 604 | } | ||
| 605 | |||
| 606 | // 获取数据类型列表 | ||
| 607 | const getDataType = (type) => { | ||
| 608 | let params = { | ||
| 609 | paramCode: type | ||
| 610 | } | ||
| 611 | getDataTypeList(params).then((res: any) => { | ||
| 612 | if (res.code == proxy.$passCode) { | ||
| 613 | const data = res.data | ||
| 614 | if (type == 'DATA_TYPE') { | ||
| 615 | data.map(item => { | ||
| 616 | item.label = item.paramName | ||
| 617 | item.value = item.paramValue | ||
| 618 | }) | ||
| 619 | dataTypeList.value = data | ||
| 620 | editTableInfo.value['fieldType'].options = data | ||
| 621 | } | ||
| 622 | } else { | ||
| 623 | ElMessage({ | ||
| 624 | type: 'error', | ||
| 625 | message: res.msg, | ||
| 626 | }) | ||
| 627 | } | ||
| 628 | }) | ||
| 629 | } | ||
| 630 | |||
| 631 | // 获取数据库列表 | ||
| 632 | const getDataBase = () => { | ||
| 633 | const params = { | ||
| 634 | pageIndex: 1, | ||
| 635 | connectStatus: '1' | ||
| 636 | } | ||
| 637 | getDataBaseList(params).then((res: any) => { | ||
| 638 | if (res.code == proxy.$passCode) { | ||
| 639 | const data = res.data ?? [] | ||
| 640 | data.map(item => { | ||
| 641 | item.label = item.databaseNameZh | ||
| 642 | item.value = item.guid | ||
| 643 | }) | ||
| 644 | dataBaseList.value = data | ||
| 645 | } else { | ||
| 646 | ElMessage({ | ||
| 647 | type: 'error', | ||
| 648 | message: res.msg, | ||
| 649 | }) | ||
| 650 | } | ||
| 651 | }) | ||
| 652 | } | ||
| 653 | |||
| 654 | // 获取编码规则列表 | ||
| 655 | const getCodeRuleData = () => { | ||
| 656 | let params = {} | ||
| 657 | getCoderuleList(params).then((res: any) => { | ||
| 658 | if (res.code == proxy.$passCode) { | ||
| 659 | const data = res.data | ||
| 660 | data.map(item => { | ||
| 661 | item.label = item.ruleName | ||
| 662 | item.value = item.guid | ||
| 663 | }) | ||
| 664 | codeRuleList.value = data | ||
| 665 | editTableInfo.value['codeRuleGuid'].options = data | ||
| 666 | } else { | ||
| 667 | ElMessage({ | ||
| 668 | type: 'error', | ||
| 669 | message: res.msg, | ||
| 670 | }) | ||
| 671 | } | ||
| 672 | }) | ||
| 673 | } | ||
| 674 | |||
| 675 | const treePromise = ref(); | ||
| 676 | |||
| 677 | // 获取数据字典树形数据 | ||
| 678 | const getTreeData = (needClick = false, currData = {}) => { | ||
| 679 | const params = { | ||
| 680 | paramCode: 'data_structure_code' | ||
| 681 | } | ||
| 682 | treeInfo.value.loading = true | ||
| 683 | treePromise.value = getDictionaryTree(params).then((res: any) => { | ||
| 684 | treePromise.value = null; | ||
| 685 | if (res.code == proxy.$passCode) { | ||
| 686 | const data = res.data ?? [] | ||
| 687 | const treeList = data.filter(item => item.children && item.children.length) | ||
| 688 | treeData.value = treeList | ||
| 689 | treeInfo.value.data = treeList | ||
| 690 | if (treeList.length) { | ||
| 691 | dictType.value = dictType.value == -1 ? Number(treeList[0].dictionaryType) : dictType.value; | ||
| 692 | expandedKey.value = expandedKey.value.length == 0 ? [treeList[0].guid] : expandedKey.value; | ||
| 693 | if (!needClick && !cacheStore.getCatch('dictionaryGuid')) { | ||
| 694 | currentNodeKey.value = currentNodeKey.value == '' ? treeList[0].guid : currentNodeKey.value | ||
| 695 | nextTick(() => { | ||
| 696 | treeInfo.value.currentNodeKey = currentNodeKey.value | ||
| 697 | treeInfo.value.expandedKey = expandedKey.value | ||
| 698 | }) | ||
| 699 | } else { | ||
| 700 | nextTick(() => { | ||
| 701 | treeInfo.value.expandedKey = expandedKey.value; | ||
| 702 | }); | ||
| 703 | } | ||
| 704 | getFirstPageData() | ||
| 705 | } | ||
| 706 | } else { | ||
| 707 | ElMessage({ | ||
| 708 | type: 'error', | ||
| 709 | message: res.msg, | ||
| 710 | }) | ||
| 711 | } | ||
| 712 | treeInfo.value.loading = false; | ||
| 713 | if (needClick) { | ||
| 714 | nextTick(() => { | ||
| 715 | nodeClick(currData); | ||
| 716 | }); | ||
| 717 | } | ||
| 718 | }).catch(() => { | ||
| 719 | treeInfo.value.loading = false | ||
| 720 | }) | ||
| 721 | } | ||
| 722 | |||
| 723 | const getFirstPageData = () => { | ||
| 724 | page.value.curr = 1; | ||
| 725 | toSearch({}) | ||
| 726 | } | ||
| 727 | |||
| 728 | const toSearch = (val: any, clear: boolean = false) => { | ||
| 729 | let params: any = Object.keys(val).length ? { ...val } : {} | ||
| 730 | params.pageIndex = page.value.curr; | ||
| 731 | params.pageSize = page.value.limit; | ||
| 732 | params.dictionaryType = dictType.value | ||
| 733 | params.name = tableSearchInput.value | ||
| 734 | getTableData(params); | ||
| 735 | }; | ||
| 736 | |||
| 737 | const getTableData = (params) => { | ||
| 738 | tableInfo.value.loading = true | ||
| 739 | getDictionary(params).then((res: any) => { | ||
| 740 | if (res.code == proxy.$passCode) { | ||
| 741 | const data = res.data || {} | ||
| 742 | tableInfo.value.data = data.records || [] | ||
| 743 | tableInfo.value.page.limit = data.pageSize | ||
| 744 | tableInfo.value.page.curr = data.pageIndex | ||
| 745 | tableInfo.value.page.rows = data.totalRows | ||
| 746 | } else { | ||
| 747 | ElMessage({ | ||
| 748 | type: 'error', | ||
| 749 | message: res.msg, | ||
| 750 | }) | ||
| 751 | } | ||
| 752 | tableInfo.value.loading = false | ||
| 753 | }).catch(xhr => { | ||
| 754 | tableInfo.value.loading = false | ||
| 755 | }) | ||
| 756 | }; | ||
| 757 | |||
| 758 | const tableSelectionChange = (val, tId) => { | ||
| 759 | if (drawerInfo.value.visible) { | ||
| 760 | if (formItems.value.length == 2) { | ||
| 761 | uploadSelectRowData.value = val | ||
| 762 | } else { | ||
| 763 | formTableSelectRowData.value = val | ||
| 764 | } | ||
| 765 | } else { | ||
| 766 | selectRowData.value = val.map((item) => item.guid); | ||
| 767 | } | ||
| 768 | }; | ||
| 769 | |||
| 770 | const tablePageChange = (info) => { | ||
| 771 | page.value.curr = Number(info.curr); | ||
| 772 | page.value.limit = Number(info.limit); | ||
| 773 | toSearch({}); | ||
| 774 | }; | ||
| 775 | |||
| 776 | const tableInputChange = (val, scope) => { | ||
| 777 | if (forbidFields.indexOf(val) > -1) { | ||
| 778 | ElMessage({ | ||
| 779 | type: "error", | ||
| 780 | message: '该名称已存在,请填写其他名称', | ||
| 781 | }); | ||
| 782 | return | ||
| 783 | } | ||
| 784 | setCodeOptions() | ||
| 785 | } | ||
| 786 | |||
| 787 | const setCodeOptions = () => { | ||
| 788 | let opts: any = [] | ||
| 789 | formTableData.value.map(item => { | ||
| 790 | if (item.fieldName) { | ||
| 791 | const row = JSON.parse(JSON.stringify(item)) | ||
| 792 | row.label = item.fieldName | ||
| 793 | row.value = item.fieldName | ||
| 794 | opts.push(row) | ||
| 795 | } | ||
| 796 | }) | ||
| 797 | formItems.value.at(-1).children.map(child => { | ||
| 798 | if (child.type == 'select') { | ||
| 799 | child.options = opts | ||
| 800 | } | ||
| 801 | }) | ||
| 802 | } | ||
| 803 | |||
| 804 | const toolBtnClick = (btn, data) => { | ||
| 805 | const type = btn.value | ||
| 806 | if (data) { | ||
| 807 | if (type.indexOf('add') > -1) { | ||
| 808 | if (formItems.value.length == 2) { | ||
| 809 | const params = { | ||
| 810 | guid: fieldSheetInfo.value.guid | ||
| 811 | } | ||
| 812 | uploadTableInfo.value.loading = true | ||
| 813 | getDictionaryRuleData(params).then((res: any) => { | ||
| 814 | if (res.code == proxy.$passCode) { | ||
| 815 | const data = res.data ?? {} | ||
| 816 | let rowInfo: any = {} | ||
| 817 | uploadTableFields.value.map(item => { | ||
| 818 | rowInfo[item.field] = data[item.field] ?? '' | ||
| 819 | }) | ||
| 820 | rowInfo.STATUS = 'edit' | ||
| 821 | rowInfo.STATE = 'Running' | ||
| 822 | rowInfo.ROWID = `upload_${uploadTableData.value.length}` | ||
| 823 | uploadTableData.value.push(rowInfo) | ||
| 824 | uploadTableInfo.value.data = uploadTableData.value | ||
| 825 | scrollTable(rowInfo) | ||
| 826 | } else { | ||
| 827 | ElMessage({ | ||
| 828 | type: 'error', | ||
| 829 | message: res.msg | ||
| 830 | }) | ||
| 831 | } | ||
| 832 | uploadTableInfo.value.loading = false | ||
| 833 | }).catch(() => { | ||
| 834 | uploadTableInfo.value.loading = false | ||
| 835 | }) | ||
| 836 | } else { | ||
| 837 | const rowInfo = { | ||
| 838 | ROWID: `formData_${formTableData.value.length}`, | ||
| 839 | fieldName: '', | ||
| 840 | description: '', | ||
| 841 | fieldType: '', | ||
| 842 | fieldLength: '', | ||
| 843 | fieldPrecision: '', | ||
| 844 | orderNum: '', | ||
| 845 | codeRuleGuid: '', | ||
| 846 | STATUS: 'edit', | ||
| 847 | STATE: 'Running' | ||
| 848 | } | ||
| 849 | let list: any = formTableData.value | ||
| 850 | list.push(rowInfo) | ||
| 851 | formTable.value.tableInfo.data = list | ||
| 852 | scrollTable(rowInfo) | ||
| 853 | } | ||
| 854 | } else if (type.indexOf('remove') > -1) { | ||
| 855 | if (formItems.value.length == 2) { | ||
| 856 | if (uploadSelectRowData.value.length == 0) { | ||
| 857 | ElMessage({ | ||
| 858 | type: "error", | ||
| 859 | message: '请选择需要删除的数据', | ||
| 860 | }); | ||
| 861 | return | ||
| 862 | } | ||
| 863 | uploadSelectRowData.value.map(item => { | ||
| 864 | const existIndex = uploadTableData.value.findIndex(s => s.ROWID == item.ROWID) | ||
| 865 | existIndex > -1 && uploadTableData.value.splice(existIndex, 1) | ||
| 866 | }) | ||
| 867 | } else { | ||
| 868 | if (formTableSelectRowData.value.length == 0) { | ||
| 869 | ElMessage({ | ||
| 870 | type: "error", | ||
| 871 | message: '请选择需要删除的数据', | ||
| 872 | }); | ||
| 873 | return | ||
| 874 | } | ||
| 875 | const removeRows = () => { | ||
| 876 | formTableSelectRowData.value.map(item => { | ||
| 877 | const existIndex = formTableData.value.findIndex(s => s.ROWID == item.ROWID) | ||
| 878 | existIndex > -1 && formTableData.value.splice(existIndex, 1) | ||
| 879 | }) | ||
| 880 | } | ||
| 881 | if (drawerInfo.value.type == 'edit') { | ||
| 882 | const editRows = formTableSelectRowData.value.filter(item => item.guid !== undefined) | ||
| 883 | if (editRows.length) { | ||
| 884 | formTable.value.tableInfo.loading = true | ||
| 885 | checkDelete().then((res: any) => { | ||
| 886 | if (res) { | ||
| 887 | ElMessageBox.confirm("数据字典有数据, 确定是否继续删除?", "提示", { | ||
| 888 | confirmButtonText: "确定", | ||
| 889 | cancelButtonText: "取消", | ||
| 890 | type: 'warning', | ||
| 891 | }).then(() => { | ||
| 892 | removeRows() | ||
| 893 | }) | ||
| 894 | } else { | ||
| 895 | removeRows() | ||
| 896 | } | ||
| 897 | formTable.value.tableInfo.loading = false | ||
| 898 | }).catch(xhr => { | ||
| 899 | ElMessage({ | ||
| 900 | type: 'error', | ||
| 901 | message: xhr | ||
| 902 | }) | ||
| 903 | formTable.value.tableInfo.loading = false | ||
| 904 | }) | ||
| 905 | } else { | ||
| 906 | removeRows() | ||
| 907 | } | ||
| 908 | } else { | ||
| 909 | removeRows() | ||
| 910 | } | ||
| 911 | } | ||
| 912 | } | ||
| 913 | } else { | ||
| 914 | if (type == 'export_model') { | ||
| 915 | exportData('model') | ||
| 916 | } else if (type == 'import_file') { | ||
| 917 | importData() | ||
| 918 | } | ||
| 919 | } | ||
| 920 | } | ||
| 921 | |||
| 922 | const tableSwitchBeforeChange = (scope, field, callback) => { | ||
| 923 | const msg = '确定修改状态?' | ||
| 924 | ElMessageBox.confirm( | ||
| 925 | msg, | ||
| 926 | '提示', | ||
| 927 | { | ||
| 928 | confirmButtonText: '确定', | ||
| 929 | cancelButtonText: '取消', | ||
| 930 | type: 'warning', | ||
| 931 | } | ||
| 932 | ).then(() => { | ||
| 933 | const state = scope.row[field] == 1 ? 0 : 1 | ||
| 934 | const result = tableSwitchChange(state, scope, field) | ||
| 935 | callback(result) | ||
| 936 | }).catch(() => { | ||
| 937 | callback(false) | ||
| 938 | }) | ||
| 939 | } | ||
| 940 | |||
| 941 | const tableSwitchChange = (val, scope, field) => { | ||
| 942 | return new Promise((resolve, reject) => { | ||
| 943 | let params = { | ||
| 944 | guid: scope.row.guid, | ||
| 945 | dictionaryState: val | ||
| 946 | } | ||
| 947 | updateDictionaryState(params).then((res: any) => { | ||
| 948 | if (res.code == proxy.$passCode && res.data) { | ||
| 949 | getFirstPageData() | ||
| 950 | ElMessage({ | ||
| 951 | type: "success", | ||
| 952 | message: '状态修改成功', | ||
| 953 | }); | ||
| 954 | resolve(true) | ||
| 955 | } else { | ||
| 956 | ElMessage({ | ||
| 957 | type: "error", | ||
| 958 | message: res.msg, | ||
| 959 | }); | ||
| 960 | reject(false) | ||
| 961 | } | ||
| 962 | }).catch(() => { | ||
| 963 | reject(false) | ||
| 964 | }) | ||
| 965 | }) | ||
| 966 | } | ||
| 967 | |||
| 968 | const tableBtnClick = (scope, btn) => { | ||
| 969 | const type = btn.value; | ||
| 970 | const row = scope.row; | ||
| 971 | if (type == "edit" || type == 'detail') { | ||
| 972 | fieldTableInfo.value.tableInfo.fields = [] | ||
| 973 | fieldTableInfo.value.tableInfo.data = [] | ||
| 974 | drawerInfo.value.header.title = type == 'edit' ? "编辑数据字典" : "数据字典详情"; | ||
| 975 | drawerInfo.value.modalClass = type == 'edit' ? '' : 'wrap_width_auto' | ||
| 976 | drawerInfo.value.type = type | ||
| 977 | drawerInfo.value.visible = true; | ||
| 978 | if (drawerInfo.value.type == 'detail') { | ||
| 979 | formTable.value.tableInfo.multiple = false | ||
| 980 | formTable.value.tableTool.visible = false | ||
| 981 | formTable.value.tableInfo.actionInfo.show = false | ||
| 982 | drawerInfo.value.footer.btns.at(1).visible = false | ||
| 983 | drawerInfo.value.footer.btns.at(-1).visible = false | ||
| 984 | drawerInfo.value.footer.btns.at(-2).visible = false | ||
| 985 | drawerInfo.value.footer.btns.at(-3).visible = true | ||
| 986 | } else { | ||
| 987 | formTable.value.tableInfo.multiple = true | ||
| 988 | formTable.value.tableInfo.actionInfo.show = true | ||
| 989 | formTable.value.tableTool.visible = true | ||
| 990 | drawerInfo.value.footer.btns.at(1).visible = true | ||
| 991 | drawerInfo.value.footer.btns.at(-1).visible = true | ||
| 992 | drawerInfo.value.footer.btns.at(-2).visible = false | ||
| 993 | drawerInfo.value.footer.btns.at(-3).visible = false | ||
| 994 | } | ||
| 995 | drawerInfo.value.loading = true; | ||
| 996 | formTable.value.tableInfo.loading = true | ||
| 997 | getDictionaryDetail(row.guid).then((res: any) => { | ||
| 998 | if (res.code == proxy.$passCode && res.data) { | ||
| 999 | let data = res.data | ||
| 1000 | currTableData.value = data; | ||
| 1001 | setDetailInfo() | ||
| 1002 | } else { | ||
| 1003 | ElMessage({ | ||
| 1004 | type: "error", | ||
| 1005 | message: res.msg, | ||
| 1006 | }); | ||
| 1007 | } | ||
| 1008 | formTable.value.tableInfo.loading = false | ||
| 1009 | drawerInfo.value.loading = false; | ||
| 1010 | }).catch(() => { | ||
| 1011 | formTable.value.tableInfo.loading = false | ||
| 1012 | drawerInfo.value.loading = false; | ||
| 1013 | }) | ||
| 1014 | } else if (type == 'remove') { | ||
| 1015 | const rowIndex = scope.$index | ||
| 1016 | if (formItems.value.length == 2) { | ||
| 1017 | uploadTableData.value.splice(rowIndex, 1) | ||
| 1018 | } else { | ||
| 1019 | if (row.guid !== undefined) { | ||
| 1020 | formTable.value.tableInfo.loading = true | ||
| 1021 | checkDelete().then((res: any) => { | ||
| 1022 | if (res) { | ||
| 1023 | ElMessageBox.confirm("数据字典有数据, 确定是否继续删除?", "提示", { | ||
| 1024 | confirmButtonText: "确定", | ||
| 1025 | cancelButtonText: "取消", | ||
| 1026 | type: 'warning', | ||
| 1027 | }).then(() => { | ||
| 1028 | formTableData.value.splice(rowIndex, 1) | ||
| 1029 | }) | ||
| 1030 | } else { | ||
| 1031 | formTableData.value.splice(rowIndex, 1) | ||
| 1032 | } | ||
| 1033 | formTable.value.tableInfo.loading = false | ||
| 1034 | }).catch(xhr => { | ||
| 1035 | ElMessage({ | ||
| 1036 | type: 'error', | ||
| 1037 | message: xhr | ||
| 1038 | }) | ||
| 1039 | formTable.value.tableInfo.loading = false | ||
| 1040 | }) | ||
| 1041 | } else { | ||
| 1042 | formTableData.value.splice(rowIndex, 1) | ||
| 1043 | } | ||
| 1044 | } | ||
| 1045 | } else if (type == "delete") { | ||
| 1046 | currTableData.value = row; | ||
| 1047 | tableInfo.value.loading = true | ||
| 1048 | checkDelete().then((res: any) => { | ||
| 1049 | if (res.used) { | ||
| 1050 | ElMessage({ | ||
| 1051 | type: 'error', | ||
| 1052 | message: '数据字典被引用,请解除引用关系后再删除' | ||
| 1053 | }) | ||
| 1054 | } else { | ||
| 1055 | const unused = res.data.filter(item => item.have.length > 0) | ||
| 1056 | if (unused.length) { | ||
| 1057 | open("数据字典有数据, 确定是否继续删除?", "warning"); | ||
| 1058 | } else { | ||
| 1059 | open("此操作将永久删除, 是否继续?", "warning"); | ||
| 1060 | } | ||
| 1061 | } | ||
| 1062 | tableInfo.value.loading = false | ||
| 1063 | }).catch(xhr => { | ||
| 1064 | ElMessage({ | ||
| 1065 | type: 'error', | ||
| 1066 | message: xhr | ||
| 1067 | }) | ||
| 1068 | tableInfo.value.loading = false | ||
| 1069 | }) | ||
| 1070 | } | ||
| 1071 | }; | ||
| 1072 | |||
| 1073 | const checkDelete = (isBatch: any = false) => { | ||
| 1074 | if (drawerInfo.value.visible) { | ||
| 1075 | return new Promise((resolve, reject) => { | ||
| 1076 | let params: any = { | ||
| 1077 | guid: currTableData.value.guid | ||
| 1078 | } | ||
| 1079 | checkDeleteDictionaryScheme(params).then((res: any) => { | ||
| 1080 | if (res.code == proxy.$passCode) { | ||
| 1081 | const data = res.data | ||
| 1082 | resolve(data) | ||
| 1083 | } else { | ||
| 1084 | reject(res.msg) | ||
| 1085 | } | ||
| 1086 | }).catch((xhr: any) => { | ||
| 1087 | reject(xhr.msg) | ||
| 1088 | }) | ||
| 1089 | }) | ||
| 1090 | } else { | ||
| 1091 | return new Promise((resolve, reject) => { | ||
| 1092 | let guids = [currTableData.value.guid] | ||
| 1093 | if (isBatch) { | ||
| 1094 | guids = selectRowData.value | ||
| 1095 | } | ||
| 1096 | checkDeleteDictionary(guids).then((res: any) => { | ||
| 1097 | if (res.code == proxy.$passCode) { | ||
| 1098 | const data = res.data ?? {} | ||
| 1099 | if (data.used) { | ||
| 1100 | resolve({ | ||
| 1101 | used: true, | ||
| 1102 | data: data.used | ||
| 1103 | }) | ||
| 1104 | } else { | ||
| 1105 | resolve({ | ||
| 1106 | used: false, | ||
| 1107 | data: data.unuse | ||
| 1108 | }) | ||
| 1109 | } | ||
| 1110 | } else { | ||
| 1111 | reject(res.msg) | ||
| 1112 | } | ||
| 1113 | }).catch((xhr: any) => { | ||
| 1114 | reject(xhr.msg) | ||
| 1115 | }) | ||
| 1116 | }) | ||
| 1117 | } | ||
| 1118 | } | ||
| 1119 | |||
| 1120 | const open = (msg, type, isBatch = false) => { | ||
| 1121 | ElMessageBox.confirm(msg, "提示", { | ||
| 1122 | confirmButtonText: "确定", | ||
| 1123 | cancelButtonText: "取消", | ||
| 1124 | type: type, | ||
| 1125 | }).then(() => { | ||
| 1126 | let guids = [currTableData.value.guid] | ||
| 1127 | if (isBatch) { | ||
| 1128 | guids = selectRowData.value | ||
| 1129 | } | ||
| 1130 | tableInfo.value.loading = true | ||
| 1131 | deleteDictionary(guids).then((res: any) => { | ||
| 1132 | if (res.code == proxy.$passCode) { | ||
| 1133 | getTreeData(); | ||
| 1134 | ElMessage({ | ||
| 1135 | type: "success", | ||
| 1136 | message: "删除成功", | ||
| 1137 | }); | ||
| 1138 | } else { | ||
| 1139 | ElMessage({ | ||
| 1140 | type: "error", | ||
| 1141 | message: res.msg, | ||
| 1142 | }); | ||
| 1143 | } | ||
| 1144 | tableInfo.value.loading = false | ||
| 1145 | }).catch(() => { | ||
| 1146 | tableInfo.value.loading = false | ||
| 1147 | }); | ||
| 1148 | }); | ||
| 1149 | }; | ||
| 1150 | |||
| 1151 | const onUpload = (file, fileList) => { | ||
| 1152 | uploadFiles.value = fileList | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | const uploadFile = (file) => { | ||
| 1156 | importData(file) | ||
| 1157 | } | ||
| 1158 | |||
| 1159 | const exportData = (type: any = null) => { | ||
| 1160 | if (type == 'model') { | ||
| 1161 | let params = { | ||
| 1162 | guid: dictGuid.value | ||
| 1163 | } | ||
| 1164 | if (drawerInfo.value.type == 'add') { | ||
| 1165 | params.guid = fieldSheetInfo.value.guid | ||
| 1166 | } | ||
| 1167 | exportDictionary(params).then((res: any) => { | ||
| 1168 | download(res, '数据字典模板.xlsx', 'excel') | ||
| 1169 | }); | ||
| 1170 | } else { | ||
| 1171 | let params = { | ||
| 1172 | guid: dictGuid.value | ||
| 1173 | } | ||
| 1174 | exportDictionaryFileds(params).then((res: any) => { | ||
| 1175 | download(res, '字典数据.xlsx', 'excel') | ||
| 1176 | }); | ||
| 1177 | } | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | const importData = (file: any = null) => { | ||
| 1181 | let params = new FormData() | ||
| 1182 | if (file) { | ||
| 1183 | params.append("file", file.raw); | ||
| 1184 | } else { | ||
| 1185 | if (uploadFiles.value.length) { | ||
| 1186 | uploadFiles.value.forEach((item: any, index: number) => { | ||
| 1187 | params.append("file", item.raw); | ||
| 1188 | }); | ||
| 1189 | } | ||
| 1190 | } | ||
| 1191 | |||
| 1192 | params.append("dictionaryGuid", fieldSheetInfo.value.guid); | ||
| 1193 | showDictionary(params).then((res: any) => { | ||
| 1194 | if (res.code == proxy.$passCode) { | ||
| 1195 | let data = res.data ?? [] | ||
| 1196 | setUploadDataInfo(data) | ||
| 1197 | } else { | ||
| 1198 | ElMessage({ | ||
| 1199 | type: "error", | ||
| 1200 | message: res.msg, | ||
| 1201 | }); | ||
| 1202 | } | ||
| 1203 | }) | ||
| 1204 | } | ||
| 1205 | |||
| 1206 | // 生成表头 | ||
| 1207 | const setUploadDataFields = (data) => { | ||
| 1208 | let fields: any = [], editInfo: any = {} | ||
| 1209 | data.map(item => { | ||
| 1210 | let fieldItem: any = { | ||
| 1211 | label: item.description, field: item.fieldName, width: 140 | ||
| 1212 | } | ||
| 1213 | if (drawerInfo.value.type != 'detail') { | ||
| 1214 | fieldItem.type = 'edit' | ||
| 1215 | fieldItem.columClass = 'edit-colum' | ||
| 1216 | editInfo[item.fieldName] = { | ||
| 1217 | label: '', | ||
| 1218 | type: 'input', | ||
| 1219 | placeholder: '', | ||
| 1220 | field: item.fieldName, | ||
| 1221 | default: '', | ||
| 1222 | disabled: item.codeRuleGuid ? true : false, | ||
| 1223 | clearable: true, | ||
| 1224 | } | ||
| 1225 | } | ||
| 1226 | fields.push(fieldItem) | ||
| 1227 | }) | ||
| 1228 | uploadTableFields.value = fields | ||
| 1229 | if (drawerInfo.value.type == 'detail') { | ||
| 1230 | fieldTableInfo.value.tableInfo.fields = uploadTableFields.value | ||
| 1231 | } else { | ||
| 1232 | uploadTableInfo.value.fields = uploadTableFields.value | ||
| 1233 | uploadTableInfo.value.editInfo = editInfo | ||
| 1234 | } | ||
| 1235 | } | ||
| 1236 | |||
| 1237 | // 生成表数据 | ||
| 1238 | const setUploadDataInfo = async (info) => { | ||
| 1239 | let data = info | ||
| 1240 | if (drawerInfo.value.type == 'detail') { | ||
| 1241 | data = info.jsonArray ?? [] | ||
| 1242 | const fields = info.schemaDataVOS ?? [] | ||
| 1243 | setUploadDataFields(fields) | ||
| 1244 | } | ||
| 1245 | |||
| 1246 | if (drawerInfo.value.type == 'detail') { | ||
| 1247 | fieldTableInfo.value.tableInfo.data = data | ||
| 1248 | drawerInfo.value.container.contents = contents.value['field'] | ||
| 1249 | } else { | ||
| 1250 | // 设置表数据 | ||
| 1251 | data.map((item, i) => { | ||
| 1252 | item.STATUS = 'edit' | ||
| 1253 | item.STATE = 'Running' | ||
| 1254 | item.ROWID = `upload_${i}` | ||
| 1255 | }) | ||
| 1256 | uploadTableData.value = data | ||
| 1257 | uploadTableInfo.value.data = uploadTableData.value | ||
| 1258 | } | ||
| 1259 | } | ||
| 1260 | |||
| 1261 | const loadDrawer = async () => { | ||
| 1262 | drawerInfo.value.header.title = '新增数据字典' | ||
| 1263 | drawerInfo.value.type = 'add' | ||
| 1264 | drawerInfo.value.modalClass = ''; | ||
| 1265 | await setFormItems() | ||
| 1266 | let fields = JSON.parse(JSON.stringify(orginFields)) | ||
| 1267 | fields.map((item: any) => { | ||
| 1268 | if (!item.type || item.type != 'index') { | ||
| 1269 | item.type = 'edit' | ||
| 1270 | item.columClass = 'edit-colum' | ||
| 1271 | } | ||
| 1272 | }) | ||
| 1273 | formTable.value.tableInfo.fields = fields | ||
| 1274 | formInfo.value.formInfo.items = formItems.value | ||
| 1275 | formTableData.value = JSON.parse(JSON.stringify(orginData)) | ||
| 1276 | formTable.value.tableInfo.data = formTableData.value | ||
| 1277 | formTable.value.tableInfo.editInfo = JSON.parse(JSON.stringify(editTableInfo.value)) | ||
| 1278 | formTable.value.tableInfo.readonly = false | ||
| 1279 | formTable.value.tableInfo.multiple = true | ||
| 1280 | formTable.value.tableInfo.actionInfo.show = true | ||
| 1281 | formTable.value.tableTool.visible = true | ||
| 1282 | drawerInfo.value.container.contents = contents.value['add'] | ||
| 1283 | drawerInfo.value.footer.btns.at(1).visible = true | ||
| 1284 | drawerInfo.value.footer.btns.at(-1).visible = true | ||
| 1285 | drawerInfo.value.footer.btns.at(-2).visible = false | ||
| 1286 | drawerInfo.value.footer.btns.at(-3).visible = false | ||
| 1287 | drawerInfo.value.visible = true | ||
| 1288 | }; | ||
| 1289 | |||
| 1290 | const batching = (type) => { | ||
| 1291 | if (type == 'delete') { | ||
| 1292 | if (selectRowData.value.length == 0) { | ||
| 1293 | ElMessage({ | ||
| 1294 | type: 'error', | ||
| 1295 | message: '请选择需要删除的数据', | ||
| 1296 | }) | ||
| 1297 | return | ||
| 1298 | } | ||
| 1299 | tableInfo.value.loading = true | ||
| 1300 | checkDelete().then((res: any) => { | ||
| 1301 | if (res.used) { | ||
| 1302 | ElMessage({ | ||
| 1303 | type: 'error', | ||
| 1304 | message: '数据字典被引用,请解除引用关系后再删除' | ||
| 1305 | }) | ||
| 1306 | } else { | ||
| 1307 | const unused = res.data.filter(item => !item.have || item.have.length == 0) | ||
| 1308 | if (unused.length) { | ||
| 1309 | open("数据字典有数据, 确定是否继续删除?", "warning", true); | ||
| 1310 | } else { | ||
| 1311 | open("此操作将永久删除, 是否继续?", "warning", true); | ||
| 1312 | } | ||
| 1313 | } | ||
| 1314 | tableInfo.value.loading = false | ||
| 1315 | }).catch(xhr => { | ||
| 1316 | ElMessage({ | ||
| 1317 | type: 'error', | ||
| 1318 | message: xhr | ||
| 1319 | }) | ||
| 1320 | tableInfo.value.loading = false | ||
| 1321 | }) | ||
| 1322 | } | ||
| 1323 | }; | ||
| 1324 | |||
| 1325 | const nodeClick = (data) => { | ||
| 1326 | drawerInfo.value.visible = false | ||
| 1327 | const changeCont = () => { | ||
| 1328 | dictGuid.value = data.guid | ||
| 1329 | const info = { | ||
| 1330 | type: 'dictionary', | ||
| 1331 | dictionaryGuid: dictGuid.value | ||
| 1332 | } | ||
| 1333 | cacheStore.setCatch('uploadSetting', info) | ||
| 1334 | if (data.type == 1) { | ||
| 1335 | showFiledsPage.value = false | ||
| 1336 | dictType.value = Number(data.dictionaryType) | ||
| 1337 | } else { | ||
| 1338 | showFiledsPage.value = true | ||
| 1339 | nextTick(() => { | ||
| 1340 | dictFiledsRef.value.dictionaryGuid = dictGuid.value | ||
| 1341 | dictFiledsRef.value.getFirstPageData() | ||
| 1342 | }) | ||
| 1343 | } | ||
| 1344 | nextTick(() => { | ||
| 1345 | treeInfo.value.currentNodeKey = dictGuid.value | ||
| 1346 | }) | ||
| 1347 | } | ||
| 1348 | if (showFiledsPage.value) { | ||
| 1349 | const toChange = dictFiledsRef.value.checkSave() | ||
| 1350 | if (!toChange) { | ||
| 1351 | ElMessageBox.confirm( | ||
| 1352 | '存在未保存的数据,切换后会丢失,是否确定切换', | ||
| 1353 | '提示', | ||
| 1354 | { | ||
| 1355 | confirmButtonText: '确定', | ||
| 1356 | cancelButtonText: '取消', | ||
| 1357 | type: 'warning', | ||
| 1358 | } | ||
| 1359 | ).then(() => { | ||
| 1360 | changeCont() | ||
| 1361 | }).catch(() => { | ||
| 1362 | treeInfo.value.currentNodeKey = dictGuid.value | ||
| 1363 | }) | ||
| 1364 | } else { | ||
| 1365 | changeCont() | ||
| 1366 | } | ||
| 1367 | } else { | ||
| 1368 | changeCont() | ||
| 1369 | } | ||
| 1370 | } | ||
| 1371 | |||
| 1372 | // 设置详情信息 | ||
| 1373 | const setDetailInfo = () => { | ||
| 1374 | const row = JSON.parse(JSON.stringify(currTableData.value)) | ||
| 1375 | dictionaryType.value = row.dictionaryType | ||
| 1376 | setFormItems(row) | ||
| 1377 | let fields = JSON.parse(JSON.stringify(orginFields)) | ||
| 1378 | let schemaVOS = row.schemaVOS ?? [] | ||
| 1379 | setGroup() | ||
| 1380 | let list: any = [] | ||
| 1381 | schemaVOS.map((schema, s) => { | ||
| 1382 | list.push({ | ||
| 1383 | label: schema.fieldName, | ||
| 1384 | value: schema.fieldName | ||
| 1385 | }) | ||
| 1386 | schema.STATUS = 'edit' | ||
| 1387 | schema.STATE = 'Running' | ||
| 1388 | schema.ROWID = `formData_${s}` | ||
| 1389 | }) | ||
| 1390 | formItems.value.at(-1).children.map(child => { | ||
| 1391 | if (child.type == 'select') { | ||
| 1392 | child.options = list | ||
| 1393 | child.default = row[child.field] | ||
| 1394 | child.clearable = drawerInfo.value.type == 'detail' ? false : true | ||
| 1395 | } | ||
| 1396 | }) | ||
| 1397 | fields.map((item: any) => { | ||
| 1398 | if (!item.type || item.type != 'index') { | ||
| 1399 | item.type = 'edit' | ||
| 1400 | item.columClass = 'edit-colum' | ||
| 1401 | } | ||
| 1402 | }) | ||
| 1403 | for (var key in editTableInfo.value) { | ||
| 1404 | editTableInfo.value[key].clearable = drawerInfo.value.type == 'detail' ? false : true | ||
| 1405 | } | ||
| 1406 | |||
| 1407 | let editInfo = JSON.parse(JSON.stringify(editTableInfo.value)) | ||
| 1408 | if (drawerInfo.value.type == 'edit') { | ||
| 1409 | for (var e in editInfo) { | ||
| 1410 | if (e == 'description' || e == 'fieldType' || e == 'fieldLength' || e == 'fieldPrecision') { | ||
| 1411 | editInfo[e].disabled = true | ||
| 1412 | } | ||
| 1413 | } | ||
| 1414 | } | ||
| 1415 | |||
| 1416 | formInfo.value.formInfo.items = formItems.value | ||
| 1417 | formTableData.value = schemaVOS | ||
| 1418 | formTable.value.tableInfo.fields = fields | ||
| 1419 | formTable.value.tableInfo.data = formTableData.value | ||
| 1420 | formTable.value.tableInfo.readonly = drawerInfo.value.type == 'detail' | ||
| 1421 | formTable.value.tableInfo.editInfo = editInfo | ||
| 1422 | drawerInfo.value.container.contents = contents.value['add'] | ||
| 1423 | |||
| 1424 | drawerInfo.value.visible = true | ||
| 1425 | } | ||
| 1426 | |||
| 1427 | const checkParamsData = () => { | ||
| 1428 | let addJsonArray: any = [], upJsonArray: any = [], jsonArray: any = [], pass = true | ||
| 1429 | let passArr = uploadTableData.value | ||
| 1430 | passArr.map((item, index) => { | ||
| 1431 | const obj = JSON.parse(JSON.stringify(item)) | ||
| 1432 | delete obj.STATE | ||
| 1433 | delete obj.STATUS | ||
| 1434 | delete obj.NOTES | ||
| 1435 | delete obj.ROWID | ||
| 1436 | for (var i in obj) { | ||
| 1437 | if (obj[i] == '') { | ||
| 1438 | pass = false | ||
| 1439 | } | ||
| 1440 | } | ||
| 1441 | if (obj.guid !== undefined) { | ||
| 1442 | upJsonArray.push(obj) | ||
| 1443 | } else { | ||
| 1444 | addJsonArray.push(obj) | ||
| 1445 | } | ||
| 1446 | obj.index = index | ||
| 1447 | jsonArray.push(obj) | ||
| 1448 | }) | ||
| 1449 | return { pass, addJsonArray, upJsonArray, jsonArray } | ||
| 1450 | } | ||
| 1451 | |||
| 1452 | const saveData = async () => { | ||
| 1453 | const passInfo = await checkParamsData() | ||
| 1454 | const checkParams = { | ||
| 1455 | dictionaryGuid: fieldSheetInfo.value.guid, | ||
| 1456 | addJsonArray: passInfo.jsonArray | ||
| 1457 | } | ||
| 1458 | checkDictionaryData(checkParams).then((res: any) => { | ||
| 1459 | if (res.code == proxy.$passCode) { | ||
| 1460 | const data = res.data | ||
| 1461 | if (Object.keys(data).length) { | ||
| 1462 | addColumn(data) | ||
| 1463 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1464 | } else { | ||
| 1465 | addColumn() | ||
| 1466 | const params = { | ||
| 1467 | dictionaryGuid: fieldSheetInfo.value.guid, | ||
| 1468 | addJsonArray: passInfo.addJsonArray, | ||
| 1469 | upJsonArray: passInfo.upJsonArray | ||
| 1470 | } | ||
| 1471 | saveDictionaryData(params).then((res: any) => { | ||
| 1472 | if (res.code == proxy.$passCode) { | ||
| 1473 | showLoading.value = true | ||
| 1474 | getTreeData(); | ||
| 1475 | ElMessage({ | ||
| 1476 | type: 'success', | ||
| 1477 | message: '保存数据字典成功' | ||
| 1478 | }) | ||
| 1479 | drawerInfo.value.visible = false; | ||
| 1480 | } else { | ||
| 1481 | ElMessage({ | ||
| 1482 | type: 'error', | ||
| 1483 | message: res.msg, | ||
| 1484 | }) | ||
| 1485 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1486 | } | ||
| 1487 | }).catch(() => { | ||
| 1488 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1489 | }) | ||
| 1490 | } | ||
| 1491 | } else { | ||
| 1492 | ElMessage({ | ||
| 1493 | type: 'error', | ||
| 1494 | message: res.msg, | ||
| 1495 | }) | ||
| 1496 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1497 | } | ||
| 1498 | }).catch(() => { | ||
| 1499 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1500 | }) | ||
| 1501 | } | ||
| 1502 | |||
| 1503 | const addColumn = (info: any = null) => { | ||
| 1504 | const fields = uploadTableFields.value | ||
| 1505 | const existIndex = fields.findIndex(item => item.field == 'NOTES') | ||
| 1506 | if (info) { | ||
| 1507 | if (existIndex == -1) { | ||
| 1508 | fields.push({ | ||
| 1509 | label: '备注', | ||
| 1510 | field: 'NOTES', | ||
| 1511 | width: 276 | ||
| 1512 | }) | ||
| 1513 | } | ||
| 1514 | for (var d in info) { | ||
| 1515 | uploadTableData.value[d].NOTES = info[d].join(',') | ||
| 1516 | } | ||
| 1517 | } else { | ||
| 1518 | if (existIndex > -1) { | ||
| 1519 | fields.splice(existIndex, 1) | ||
| 1520 | } | ||
| 1521 | } | ||
| 1522 | } | ||
| 1523 | |||
| 1524 | const scrollTable = (rowInfo) => { | ||
| 1525 | nextTick(() => { | ||
| 1526 | const drawerBody = document.getElementsByClassName('el-drawer__body')[0]; | ||
| 1527 | const tableListRef = drawerRef.value.getDrawerConRef("drawerTableRef"); | ||
| 1528 | if (!tableListRef) return; | ||
| 1529 | //设置选中表格当前新增行。 | ||
| 1530 | tableListRef.setCurrentRow(rowInfo); | ||
| 1531 | drawerBody.scrollTop = drawerBody.scrollHeight; | ||
| 1532 | let table = tableListRef.layout.table.refs; | ||
| 1533 | // 获取表格滚动元素 | ||
| 1534 | let tableScrollEle = | ||
| 1535 | table.bodyWrapper.firstElementChild.firstElementChild; | ||
| 1536 | // 设置表格滚动的位置 | ||
| 1537 | tableScrollEle.scrollTop = tableScrollEle.scrollHeight; | ||
| 1538 | }); | ||
| 1539 | }; | ||
| 1540 | |||
| 1541 | const drawerBtnClick = (btn, info) => { | ||
| 1542 | if (btn.value == 'submit' || btn.value == 'saveAndAdd') { | ||
| 1543 | drawerInfo.value.footer.btns.map((item: any) => item.disabled = true) | ||
| 1544 | if (formItems.value.length == 2) { | ||
| 1545 | if (drawerInfo.value.type == 'add') { | ||
| 1546 | saveData() | ||
| 1547 | } | ||
| 1548 | } else { | ||
| 1549 | if (drawerInfo.value.type == 'edit' && btn.value == 'saveAndAdd') { | ||
| 1550 | nodeClick(currTableData.value) | ||
| 1551 | drawerInfo.value.visible = false | ||
| 1552 | return | ||
| 1553 | } | ||
| 1554 | let params = { ...info } | ||
| 1555 | let dtos: any = [] | ||
| 1556 | if (formTableData.value.length == 0) { | ||
| 1557 | ElMessage({ | ||
| 1558 | type: 'error', | ||
| 1559 | message: '表结构至少需要一条数据', | ||
| 1560 | }) | ||
| 1561 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1562 | return | ||
| 1563 | } | ||
| 1564 | formTableData.value.map((item, i) => { | ||
| 1565 | const dto = { ...item } | ||
| 1566 | delete dto.STATE | ||
| 1567 | delete dto.STATUS | ||
| 1568 | delete dto.ROWID | ||
| 1569 | delete dto.NOTES | ||
| 1570 | dto.orderNum = i | ||
| 1571 | dtos.push(dto) | ||
| 1572 | }) | ||
| 1573 | params.dataDictionarySchemaAddDTOS = dtos | ||
| 1574 | if (drawerInfo.value.type == 'add') { | ||
| 1575 | formTable.value.tableInfo.loading = true | ||
| 1576 | addDictionary(params).then((res: any) => { | ||
| 1577 | if (res.code == proxy.$passCode) { | ||
| 1578 | ElMessage({ | ||
| 1579 | type: 'success', | ||
| 1580 | message: '添加数据字典成功' | ||
| 1581 | }) | ||
| 1582 | drawerInfo.value.visible = false; | ||
| 1583 | getTreeData(btn.value == 'saveAndAdd', res.data || {}); | ||
| 1584 | } else { | ||
| 1585 | ElMessage({ | ||
| 1586 | type: 'error', | ||
| 1587 | message: res.msg, | ||
| 1588 | }) | ||
| 1589 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1590 | } | ||
| 1591 | formTable.value.tableInfo.loading = false | ||
| 1592 | }).catch(() => { | ||
| 1593 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1594 | formTable.value.tableInfo.loading = false | ||
| 1595 | }) | ||
| 1596 | } else { | ||
| 1597 | params.guid = currTableData.value.guid | ||
| 1598 | updateDictionary(params).then((res: any) => { | ||
| 1599 | if (res.code == proxy.$passCode) { | ||
| 1600 | if (btn.value == 'saveAndAdd') { | ||
| 1601 | showLoading.value = false | ||
| 1602 | drawerInfo.value.container.id = 'upload-table-form' | ||
| 1603 | drawerInfo.value.footer.btns.at(-1).visible = false | ||
| 1604 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1605 | getDictionaryDataDetail(currTableData.value.guid) | ||
| 1606 | } else { | ||
| 1607 | getTreeData(); | ||
| 1608 | ElMessage({ | ||
| 1609 | type: 'success', | ||
| 1610 | message: '修改数据字典成功' | ||
| 1611 | }) | ||
| 1612 | drawerInfo.value.visible = false; | ||
| 1613 | } | ||
| 1614 | } else { | ||
| 1615 | ElMessage({ | ||
| 1616 | type: 'error', | ||
| 1617 | message: res.msg, | ||
| 1618 | }) | ||
| 1619 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1620 | } | ||
| 1621 | }).catch(() => { | ||
| 1622 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1623 | }) | ||
| 1624 | } | ||
| 1625 | } | ||
| 1626 | } else if (btn.value == 'fileds') { | ||
| 1627 | drawerInfo.value.footer.btns.at(-2).visible = true | ||
| 1628 | drawerInfo.value.footer.btns.at(-3).visible = false | ||
| 1629 | formItems.value.map(item => { | ||
| 1630 | if (item.field != 'chName' && item.field != 'enName') { | ||
| 1631 | item.visible = false | ||
| 1632 | } | ||
| 1633 | }) | ||
| 1634 | if (currTableData.value.detailInfo == null) { | ||
| 1635 | getTableFiled() | ||
| 1636 | } else { | ||
| 1637 | drawerInfo.value.container.contents = contents.value['field'] | ||
| 1638 | } | ||
| 1639 | } else if (btn.value == 'sheet') { | ||
| 1640 | formItems.value.map(item => { | ||
| 1641 | item.visible = true | ||
| 1642 | }) | ||
| 1643 | drawerInfo.value.container.contents = contents.value['add'] | ||
| 1644 | drawerInfo.value.footer.btns.at(-2).visible = false | ||
| 1645 | drawerInfo.value.footer.btns.at(-3).visible = true | ||
| 1646 | } else { | ||
| 1647 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | ||
| 1648 | nextTick(() => { | ||
| 1649 | drawerInfo.value.visible = false | ||
| 1650 | }) | ||
| 1651 | } | ||
| 1652 | } | ||
| 1653 | |||
| 1654 | const getTableFiled = () => { | ||
| 1655 | const guid = currTableData.value.guid; | ||
| 1656 | fieldTableInfo.value.tableInfo.loading = true; | ||
| 1657 | drawerInfo.value.container.contents = contents.value['field'] | ||
| 1658 | getDictionaryFileds(guid).then((res: any) => { | ||
| 1659 | fieldTableInfo.value.tableInfo.loading = false; | ||
| 1660 | if (res.code == proxy.$passCode) { | ||
| 1661 | const data = res.data ?? {} | ||
| 1662 | currTableData.value.detailInfo = data | ||
| 1663 | setUploadDataInfo(data) | ||
| 1664 | } else { | ||
| 1665 | ElMessage({ | ||
| 1666 | type: 'error', | ||
| 1667 | message: res.msg, | ||
| 1668 | }) | ||
| 1669 | } | ||
| 1670 | }).catch(() => { | ||
| 1671 | fieldTableInfo.value.tableInfo.loading = false; | ||
| 1672 | }) | ||
| 1673 | } | ||
| 1674 | |||
| 1675 | const getDictionaryDataDetail = (params) => { | ||
| 1676 | uploadTableInfo.value.loading = true | ||
| 1677 | getDictionaryFileds(params).then((res: any) => { | ||
| 1678 | if (res.code == proxy.$passCode) { | ||
| 1679 | const data = res.data ?? {} | ||
| 1680 | setContents(data) | ||
| 1681 | } else { | ||
| 1682 | ElMessage({ | ||
| 1683 | type: 'error', | ||
| 1684 | message: res.msg, | ||
| 1685 | }) | ||
| 1686 | } | ||
| 1687 | uploadTableInfo.value.loading = false | ||
| 1688 | }).catch(xhr => { | ||
| 1689 | uploadTableInfo.value.loading = false | ||
| 1690 | }) | ||
| 1691 | } | ||
| 1692 | |||
| 1693 | // 设置添加数据面板信息 | ||
| 1694 | const setContents = async (info) => { | ||
| 1695 | formItems.value.splice(2) | ||
| 1696 | formItems.value.map(item => { | ||
| 1697 | item.default = fieldSheetInfo.value[item.field] | ||
| 1698 | item.disabled = true | ||
| 1699 | }) | ||
| 1700 | const fields = info.schemaDataVOS ?? [] | ||
| 1701 | await setUploadDataFields(fields) | ||
| 1702 | uploadTableData.value = [] | ||
| 1703 | uploadTableInfo.value.data = [] | ||
| 1704 | uploadInfo.value.tableInfo = uploadTableInfo.value | ||
| 1705 | drawerInfo.value.container.contents = contents.value['upload'] | ||
| 1706 | } | ||
| 1707 | |||
| 1708 | const radioGroupChange = async (val, info) => { | ||
| 1709 | dictionaryType.value = Number(val) | ||
| 1710 | await setFormItems(info) | ||
| 1711 | setGroup() | ||
| 1712 | } | ||
| 1713 | |||
| 1714 | // 切换结构类型 设置选项显隐 | ||
| 1715 | const setGroup = () => { | ||
| 1716 | let dictionaryOpts = formItems.value.at(-1).children | ||
| 1717 | if (dictionaryType.value == 1) { | ||
| 1718 | dictionaryOpts[2].visible = false | ||
| 1719 | dictionaryOpts[3].visible = false | ||
| 1720 | } else if (dictionaryType.value == 2) { | ||
| 1721 | dictionaryOpts[2].visible = false | ||
| 1722 | dictionaryOpts[3].block = false | ||
| 1723 | dictionaryOpts[3].visible = true | ||
| 1724 | } else if (dictionaryType.value == 3) { | ||
| 1725 | dictionaryOpts[2].visible = true | ||
| 1726 | dictionaryOpts[3].block = true | ||
| 1727 | dictionaryOpts[3].visible = true | ||
| 1728 | } else if (dictionaryType.value == 4) { | ||
| 1729 | dictionaryOpts[2].visible = false | ||
| 1730 | dictionaryOpts[3].block = true | ||
| 1731 | dictionaryOpts[3].visible = true | ||
| 1732 | } | ||
| 1733 | formInfo.value.formInfo.items = formItems.value | ||
| 1734 | } | ||
| 1735 | |||
| 1736 | onActivated(() => { | ||
| 1737 | getCodeRuleData(); | ||
| 1738 | let guid = cacheStore.getCatch('dictionaryGuid'); | ||
| 1739 | if (guid) { | ||
| 1740 | nextTick(() => { | ||
| 1741 | if (treePromise.value) { | ||
| 1742 | treePromise.value.then(() => { | ||
| 1743 | nodeClick({ guid: guid, dictionaryType: '1', type: 2 }); | ||
| 1744 | cacheStore.setCatch('dictionaryGuid', null); | ||
| 1745 | }); | ||
| 1746 | } else { | ||
| 1747 | nodeClick({ guid: guid, type: 1 }); | ||
| 1748 | cacheStore.setCatch('dictionaryGuid', null); | ||
| 1749 | } | ||
| 1750 | }); | ||
| 1751 | } | ||
| 1752 | }) | ||
| 1753 | |||
| 1754 | onBeforeMount(() => { | ||
| 1755 | getDataType('DATA_TYPE') | ||
| 1756 | getTreeData() | ||
| 1757 | }) | ||
| 1758 | |||
| 1759 | onMounted(() => { | ||
| 1760 | let dom = document.getElementById('main-app'); | ||
| 1761 | if (dom) { | ||
| 1762 | dom.addEventListener('click', (event: any) => { | ||
| 1763 | // 新建时不要处理。 | ||
| 1764 | if (drawerInfo.value.header.title == '数据字典详情' && !event.target?.classList?.contains('drawer-detail-cell')) { | ||
| 1765 | if (drawerInfo.value.visible) { | ||
| 1766 | drawerInfo.value.visible = false; | ||
| 1767 | } | ||
| 1768 | } | ||
| 1769 | }); | ||
| 1770 | } | ||
| 1771 | }); | ||
| 1772 | |||
| 1773 | </script> | ||
| 1774 | |||
| 1775 | <template> | ||
| 1776 | <div class="container_wrap full flex"> | ||
| 1777 | <div class="aside_wrap"> | ||
| 1778 | <div class="aside_title">数据字典列表</div> | ||
| 1779 | <Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" /> | ||
| 1780 | </div> | ||
| 1781 | <DictFileds ref="dictFiledsRef" v-if="showFiledsPage" @exportData="exportData" /> | ||
| 1782 | <div class="main_wrap" v-else> | ||
| 1783 | <div class="table_tool_wrap"> | ||
| 1784 | <div class="tools_btns"> | ||
| 1785 | <el-button type="primary" @click="loadDrawer" v-preReClick>新建</el-button> | ||
| 1786 | <el-button @click="batching('delete')" v-preReClick>批量删除</el-button> | ||
| 1787 | </div> | ||
| 1788 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入字典中/英文名搜索" | ||
| 1789 | :suffix-icon="Search" clearable @change="val => getFirstPageData()" /> | ||
| 1790 | </div> | ||
| 1791 | <div class="table_panel_wrap full"> | ||
| 1792 | <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange" | ||
| 1793 | @tablePageChange="tablePageChange" @tableSwitchBeforeChange="tableSwitchBeforeChange" /> | ||
| 1794 | </div> | ||
| 1795 | </div> | ||
| 1796 | <Drawer ref="drawerRef" :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" | ||
| 1797 | @radioGroupChange="radioGroupChange" @drawerTableBtnClick="tableBtnClick" | ||
| 1798 | @drawerTableSelectionChange="tableSelectionChange" @drawerTableToolBtnClick="toolBtnClick" | ||
| 1799 | @drawerTableInputChange="tableInputChange" @drawerToolBtnClick="toolBtnClick" @onUpload="onUpload" | ||
| 1800 | @uploadFile="uploadFile" @uploadBtnClick="toolBtnClick" /> | ||
| 1801 | </div> | ||
| 1802 | </template> | ||
| 1803 | |||
| 1804 | <style lang="scss" scoped> | ||
| 1805 | .container_wrap { | ||
| 1806 | .aside_wrap { | ||
| 1807 | width: 200px; | ||
| 1808 | } | ||
| 1809 | } | ||
| 1810 | |||
| 1811 | .tree_panel { | ||
| 1812 | height: 100%; | ||
| 1813 | padding-top: 0; | ||
| 1814 | |||
| 1815 | :deep(.el-tree) { | ||
| 1816 | margin: 0; | ||
| 1817 | height: calc(100% - 68px); | ||
| 1818 | overflow: hidden auto; | ||
| 1819 | } | ||
| 1820 | } | ||
| 1821 | </style> |
| 1 | <script lang="ts" setup name="existingTableSelect"> | ||
| 2 | import { ref } from "vue"; | ||
| 3 | import { Search, Close } from "@element-plus/icons-vue"; | ||
| 4 | import { ElMessage, ElTable } from "element-plus"; | ||
| 5 | import PageNav from "@/components/PageNav/index.vue"; | ||
| 6 | import Moment from 'moment'; | ||
| 7 | import { | ||
| 8 | getDsTableByDs, | ||
| 9 | getDsData, | ||
| 10 | getDsTableStructure, | ||
| 11 | } from "@/api/modules/dataInventory"; | ||
| 12 | |||
| 13 | |||
| 14 | |||
| 15 | /** 需要从父组件接收已选中的数据表 和 数据库列表(由父组件获取,只需获取一次,因为父组件也需要使用)。 */ | ||
| 16 | const props = defineProps({ | ||
| 17 | databaseList: { | ||
| 18 | type: Array<any>, | ||
| 19 | default: [], | ||
| 20 | }, | ||
| 21 | dataSourceGuid: { | ||
| 22 | type: String, | ||
| 23 | default: '' | ||
| 24 | }, | ||
| 25 | dsList: { | ||
| 26 | type: Array<any>, | ||
| 27 | default: [], | ||
| 28 | }, | ||
| 29 | isLook: { | ||
| 30 | type: Boolean, | ||
| 31 | default: false, | ||
| 32 | }, | ||
| 33 | tableCreateType: { | ||
| 34 | type: Number, | ||
| 35 | default: 2, | ||
| 36 | }, | ||
| 37 | subjectDomainGuid: { | ||
| 38 | type: String, | ||
| 39 | default: '' | ||
| 40 | }, | ||
| 41 | execGuid: { | ||
| 42 | type: String, | ||
| 43 | default: '' | ||
| 44 | } | ||
| 45 | }); | ||
| 46 | |||
| 47 | watch(() => { }, () => { | ||
| 48 | // datasourceSelectedRows.value = props.dsList?.slice(0) || []; | ||
| 49 | let selectTableName = currDatasourceSelect.value?.tableName; | ||
| 50 | if (selectTableName) { | ||
| 51 | let ds = datasourceSelectedRows.value?.find(d => d.tableName === selectTableName); | ||
| 52 | if (!ds) { | ||
| 53 | currDatasourceSelect.value = {}; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | }) | ||
| 57 | |||
| 58 | const datasourceSelectedRows: any = ref([]); | ||
| 59 | |||
| 60 | const emits = defineEmits(["datasourceSelectedChange"]); | ||
| 61 | |||
| 62 | const { proxy } = getCurrentInstance() as any; | ||
| 63 | |||
| 64 | /** 当前选中的数据源连接池guid,和相关信息。 */ | ||
| 65 | const databaseInfo: any = computed(() => { | ||
| 66 | if (!databaseGuid.value) { | ||
| 67 | return {}; | ||
| 68 | } | ||
| 69 | return props.databaseList.find(d => d.guid == databaseGuid.value); | ||
| 70 | }); | ||
| 71 | |||
| 72 | const databaseGuid: any = ref(''); | ||
| 73 | |||
| 74 | watch(() => props.databaseList, (val) => { | ||
| 75 | if (!val?.length) { | ||
| 76 | return; | ||
| 77 | } | ||
| 78 | if (props.dataSourceGuid != "") { | ||
| 79 | databaseGuid.value = props.dataSourceGuid; | ||
| 80 | } else if (!databaseInfo.value.guid) { | ||
| 81 | databaseGuid.value = val[0]?.guid; | ||
| 82 | } | ||
| 83 | }) | ||
| 84 | |||
| 85 | const searchKey = ref(""); | ||
| 86 | |||
| 87 | const dsTableList: Ref<any> = ref(); | ||
| 88 | const dsTableListLoading = ref(false); | ||
| 89 | |||
| 90 | const datasourceTableRef = ref<InstanceType<typeof ElTable>>(); | ||
| 91 | |||
| 92 | const dsPageInfo = ref({ | ||
| 93 | limit: 50, | ||
| 94 | curr: 1, | ||
| 95 | rows: 0, | ||
| 96 | type: "concise", | ||
| 97 | }); | ||
| 98 | |||
| 99 | const currDatasourceSelect: Ref<any> = ref({}); | ||
| 100 | const currDsPreviewActiveName = ref("resultData"); | ||
| 101 | const currDsPreviewData = ref([]); | ||
| 102 | const currDsFields: Ref<any> = ref([]); | ||
| 103 | /** 每列字段对应的列宽计算结果。 */ | ||
| 104 | const originTableFieldColumn = ref({}); | ||
| 105 | const currDsPreviewDataLoading = ref(false); | ||
| 106 | const currDsTableStructure = ref([]); | ||
| 107 | const currDsTableStructureLoading = ref(false); | ||
| 108 | |||
| 109 | // const calcTableColumnWidth = (data: any[], prop, title) => { | ||
| 110 | // let d: any[] = []; | ||
| 111 | // data.forEach((dt) => d.push(dt[prop])); | ||
| 112 | // return calcColumnWidth( | ||
| 113 | // d, | ||
| 114 | // title, | ||
| 115 | // { | ||
| 116 | // fontSize: 14, | ||
| 117 | // fontFamily: "SimSun", | ||
| 118 | // }, | ||
| 119 | // { | ||
| 120 | // fontSize: 14, | ||
| 121 | // fontFamily: "SimSun", | ||
| 122 | // } | ||
| 123 | // ); | ||
| 124 | // }; | ||
| 125 | |||
| 126 | const formatterPreviewDate = (row, info) => { | ||
| 127 | let enName = info.enName; | ||
| 128 | let v = row[enName]; | ||
| 129 | if (v === 0) { | ||
| 130 | return v; | ||
| 131 | } | ||
| 132 | if (!v) { | ||
| 133 | return v || '--'; | ||
| 134 | } | ||
| 135 | if (info.dataType === 'datetime') { | ||
| 136 | return Moment(v).format('YYYY-MM-DD HH:mm:ss'); | ||
| 137 | } | ||
| 138 | if (info.dataType === 'date') { | ||
| 139 | if (isNaN(<any>(new Date(v)))) { | ||
| 140 | return Moment(parseInt(v)).format('YYYY-MM-DD'); | ||
| 141 | } else { | ||
| 142 | return Moment(v).format('YYYY-MM-DD'); | ||
| 143 | } | ||
| 144 | } | ||
| 145 | return v; | ||
| 146 | }; | ||
| 147 | |||
| 148 | const getTableListPromise = ref(); | ||
| 149 | |||
| 150 | const getDsTableList = (params) => { | ||
| 151 | dsTableList.value = []; | ||
| 152 | dsTableListLoading.value = true; | ||
| 153 | let promise: any = null; | ||
| 154 | promise = getTableListPromise.value = getDsTableByDs(params).then((res: any) => { | ||
| 155 | if (promise !== getTableListPromise.value) { | ||
| 156 | return; | ||
| 157 | } | ||
| 158 | dsTableListLoading.value = false; | ||
| 159 | if (res.code == proxy.$passCode) { | ||
| 160 | dsPageInfo.value.rows = res.data?.totalRows || 0; | ||
| 161 | dsTableList.value = res.data?.records || []; | ||
| 162 | //需要根据新的datasourceList 和选中行,设置表格的选中。 | ||
| 163 | nextTick(() => { | ||
| 164 | datasourceSelectedRows.value.forEach((d) => { | ||
| 165 | let row = dsTableList.value.find((v: any) => v.tableName == d.tableName); | ||
| 166 | if (row) { | ||
| 167 | datasourceTableRef.value?.toggleRowSelection(row, true); | ||
| 168 | } | ||
| 169 | }); | ||
| 170 | }); | ||
| 171 | } else { | ||
| 172 | ElMessage.error(res.msg); | ||
| 173 | } | ||
| 174 | }) | ||
| 175 | }; | ||
| 176 | |||
| 177 | const getPreviewData = () => { | ||
| 178 | currDsPreviewData.value = []; | ||
| 179 | currDsPreviewDataLoading.value = true; | ||
| 180 | getDsData({ | ||
| 181 | pageSize: 50, | ||
| 182 | pageIndex: 1, | ||
| 183 | dataSourceGuid: databaseInfo.value.guid, | ||
| 184 | database: currDatasourceSelect.value.database, | ||
| 185 | tableName: currDatasourceSelect.value.tableName, | ||
| 186 | }).then((res: any) => { | ||
| 187 | currDsPreviewDataLoading.value = false; | ||
| 188 | if (res.code == proxy.$passCode) { | ||
| 189 | currDsPreviewData.value = res.data.datas || []; | ||
| 190 | currDsFields.value = res.data.fields || []; | ||
| 191 | } else { | ||
| 192 | ElMessage.error(res.msg); | ||
| 193 | } | ||
| 194 | }); | ||
| 195 | }; | ||
| 196 | |||
| 197 | const getTableStructure = () => { | ||
| 198 | let tableName = currDatasourceSelect.value.tableName; | ||
| 199 | currDsTableStructureLoading.value = true; | ||
| 200 | currDsTableStructure.value = []; | ||
| 201 | getDsTableStructure({ | ||
| 202 | tableName: tableName, | ||
| 203 | dataSourceGuid: databaseInfo.value.guid, | ||
| 204 | database: databaseInfo.value.databaseNameEn, | ||
| 205 | databaseType: databaseInfo.value.databaseType | ||
| 206 | }).then((res: any) => { | ||
| 207 | currDsTableStructureLoading.value = false; | ||
| 208 | if (res.code == proxy.$passCode) { | ||
| 209 | currDsTableStructure.value = res.data || []; | ||
| 210 | } else { | ||
| 211 | ElMessage.error(res.msg); | ||
| 212 | } | ||
| 213 | }); | ||
| 214 | }; | ||
| 215 | |||
| 216 | watch(() => databaseInfo.value, (val) => { | ||
| 217 | if (!val) { | ||
| 218 | return; | ||
| 219 | } | ||
| 220 | dsPageInfo.value.curr = 1; | ||
| 221 | searchKey.value = ""; | ||
| 222 | getDsTableList({ | ||
| 223 | pageSize: dsPageInfo.value.limit, | ||
| 224 | pageIndex: dsPageInfo.value.curr, | ||
| 225 | dataSourceGuid: val.guid, | ||
| 226 | execGuid: props.execGuid | ||
| 227 | }); | ||
| 228 | }) | ||
| 229 | |||
| 230 | const handleSearchInputChange = () => { | ||
| 231 | dsPageInfo.value.curr = 1; | ||
| 232 | getDsTableList({ | ||
| 233 | pageSize: dsPageInfo.value.limit, | ||
| 234 | pageIndex: dsPageInfo.value.curr, | ||
| 235 | dataSourceGuid: databaseInfo.value.guid, | ||
| 236 | execGuid: props.execGuid | ||
| 237 | }); | ||
| 238 | }; | ||
| 239 | |||
| 240 | const dsPageChange = (page) => { | ||
| 241 | console.log(page); | ||
| 242 | dsPageInfo.value.curr = page.curr; | ||
| 243 | dsPageInfo.value.limit = page.limit; | ||
| 244 | getDsTableList({ | ||
| 245 | pageSize: dsPageInfo.value.limit, | ||
| 246 | pageIndex: dsPageInfo.value.curr, | ||
| 247 | dataSourceGuid: databaseInfo.value.guid, | ||
| 248 | execGuid: props.execGuid | ||
| 249 | }); | ||
| 250 | }; | ||
| 251 | |||
| 252 | const datasource_row_class_name = ({ row, rowIndex }) => { | ||
| 253 | return datasourceSelectedRows.value.find((v: any) => v.tableName == row.tableName) | ||
| 254 | ? "selected" | ||
| 255 | : ""; | ||
| 256 | }; | ||
| 257 | |||
| 258 | const datasource_selection_all_change = (selection) => { | ||
| 259 | let isChecked = selection.length > 0; | ||
| 260 | dsTableList.value.forEach((d) => { | ||
| 261 | let index = datasourceSelectedRows.value.findIndex( | ||
| 262 | (v: any) => v.tableName == d.tableName | ||
| 263 | ); | ||
| 264 | if (index === -1 && isChecked) { | ||
| 265 | datasourceSelectedRows.value.push(Object.assign({}, d, databaseInfo.value)); | ||
| 266 | } else if (index !== -1 && !isChecked) { | ||
| 267 | datasourceSelectedRows.value.splice(index, 1); | ||
| 268 | if (currDatasourceSelect.value?.tableName === d.tableName) { | ||
| 269 | currDatasourceSelect.value = {}; | ||
| 270 | } | ||
| 271 | } | ||
| 272 | }); | ||
| 273 | }; | ||
| 274 | const datasource_selection_change = (selection, row) => { | ||
| 275 | console.log(selection, row); | ||
| 276 | let index = selection.findIndex((s) => s.tableName == row.tableName); | ||
| 277 | if (index === -1) { | ||
| 278 | datasourceSelectedRows.value.splice( | ||
| 279 | datasourceSelectedRows.value.findIndex((v: any) => v.tableName == row.tableName), | ||
| 280 | 1 | ||
| 281 | ); | ||
| 282 | if (currDatasourceSelect.value?.tableName === row.tableName) { | ||
| 283 | currDatasourceSelect.value = {}; | ||
| 284 | } | ||
| 285 | } else { | ||
| 286 | datasourceSelectedRows.value.push(Object.assign({}, row)); | ||
| 287 | } | ||
| 288 | }; | ||
| 289 | /** 点击行选中或再次点击取消。不知是否有此种需求,一般都是点击勾选框选中。@row-click="datasource_row_click" */ | ||
| 290 | // const datasource_row_click = (row, column, event) => { | ||
| 291 | // let index = datasourceSelectedRows.value.findIndex( | ||
| 292 | // (v: any) => v.tableName == row.tableName | ||
| 293 | // ); | ||
| 294 | // datasourceTableRef.value?.toggleRowSelection(row, index === -1); | ||
| 295 | // if (index === -1) { | ||
| 296 | // datasourceSelectedRows.value.push(Object.assign({}, row, databaseInfo.value)); | ||
| 297 | // } else { | ||
| 298 | // datasourceSelectedRows.value.splice(index, 1); | ||
| 299 | // } | ||
| 300 | // }; | ||
| 301 | |||
| 302 | const handleDsSelect = (item) => { | ||
| 303 | currDatasourceSelect.value = item; | ||
| 304 | }; | ||
| 305 | |||
| 306 | const delSelectDs = (item, i) => { | ||
| 307 | datasourceSelectedRows.value.splice(i, 1); | ||
| 308 | if (currDatasourceSelect.value?.tableName === item.tableName) { | ||
| 309 | currDatasourceSelect.value = {}; | ||
| 310 | } | ||
| 311 | let table = dsTableList.value.find(t => t.tableName === item.tableName); | ||
| 312 | table && datasourceTableRef.value?.toggleRowSelection(table, false); | ||
| 313 | }; | ||
| 314 | |||
| 315 | watch( | ||
| 316 | datasourceSelectedRows, | ||
| 317 | (val, oldVal) => { | ||
| 318 | if (val?.length && !currDatasourceSelect.value?.tableName) { | ||
| 319 | currDatasourceSelect.value = val[0]; | ||
| 320 | } | ||
| 321 | emits("datasourceSelectedChange", val); | ||
| 322 | }, | ||
| 323 | { | ||
| 324 | deep: true, | ||
| 325 | } | ||
| 326 | ); | ||
| 327 | |||
| 328 | watch(currDatasourceSelect, (val) => { | ||
| 329 | if (val?.tableName) { | ||
| 330 | getPreviewData(); | ||
| 331 | getTableStructure(); | ||
| 332 | } | ||
| 333 | }); | ||
| 334 | |||
| 335 | const getTextAlign = (field) => { | ||
| 336 | if (field.dataType === 'decimal' || field.dataType === 'int' || field.dataType == 'bit' || field.dataType == 'tinyint') { | ||
| 337 | return 'right'; | ||
| 338 | } | ||
| 339 | return 'left' | ||
| 340 | } | ||
| 341 | </script> | ||
| 342 | |||
| 343 | <template> | ||
| 344 | <div class="first-step-content"> | ||
| 345 | <div class="content-left"> | ||
| 346 | <div class="title-left">待选库表</div> | ||
| 347 | <div class="content-selecte-left"> | ||
| 348 | <span class="select-ds-title">数据存储连接池</span> | ||
| 349 | <el-select v-model="databaseGuid" placeholder="请选择" filterable value-key="guid"> | ||
| 350 | <el-option v-for="opt in databaseList" :key="opt['guid']" :label="opt['databaseChName']" | ||
| 351 | :value="opt['guid']" /> | ||
| 352 | </el-select> | ||
| 353 | <el-input class="table_search_input" v-model.trim="searchKey" placeholder="关键字搜索" :prefix-icon="Search" | ||
| 354 | @change="handleSearchInputChange" clearable /> | ||
| 355 | <el-table class="datasource-small-table" ref="datasourceTableRef" :data="dsTableList" | ||
| 356 | v-loading="dsTableListLoading" :border="false" row-key="tableName" :row-class-name="datasource_row_class_name" | ||
| 357 | @select="datasource_selection_change" @select-all="datasource_selection_all_change" tooltip-effect="light"> | ||
| 358 | <el-table-column type="selection" :width="22" align="center" /> | ||
| 359 | <el-table-column prop="tableName" label="名称" width="100px" align="left" show-overflow-tooltip> | ||
| 360 | </el-table-column> | ||
| 361 | <el-table-column prop="tableComment" label="表注释" width="60px" align="left" show-overflow-tooltip> | ||
| 362 | <template #default="scope"> | ||
| 363 | <span>{{ scope.row['tableComment'] ?? '--' }}</span> | ||
| 364 | </template> | ||
| 365 | </el-table-column> | ||
| 366 | </el-table> | ||
| 367 | <PageNav :class="[dsPageInfo.type]" :pageInfo="dsPageInfo" @pageChange="dsPageChange" /> | ||
| 368 | </div> | ||
| 369 | </div> | ||
| 370 | <div class="content-right"> | ||
| 371 | <div class="title-right">已选库表</div> | ||
| 372 | <div class="ds-select-container"> | ||
| 373 | <template v-if="datasourceSelectedRows.length"> | ||
| 374 | <div v-for="(item, i) in datasourceSelectedRows" :key="item.tableName" :class="currDatasourceSelect?.tableName === item.tableName | ||
| 375 | ? 'ds-select-item selected' | ||
| 376 | : 'ds-select-item' | ||
| 377 | " @click="handleDsSelect(item)" v-preReClick> | ||
| 378 | <span class="item-title">{{ item.tableName }}</span> | ||
| 379 | <el-icon v-if="!isLook" @click.stop="delSelectDs(item, i)" v-preReClick> | ||
| 380 | <Close /> | ||
| 381 | </el-icon> | ||
| 382 | </div> | ||
| 383 | </template> | ||
| 384 | <div v-if="!datasourceSelectedRows.length" class="ds-select-placeholder"> | ||
| 385 | 请从左侧待选库表选择 | ||
| 386 | </div> | ||
| 387 | </div> | ||
| 388 | <div class="ds-data-preview"> | ||
| 389 | <div class="preview-data-totals t-left" v-show="currDsPreviewActiveName == 'resultData'"> | ||
| 390 | <span>该页面仅显示</span> | ||
| 391 | <span style="color: var(--el-color-primary)"> 50 </span> | ||
| 392 | <span>条数据</span> | ||
| 393 | </div> | ||
| 394 | <el-tabs class="preview-tabs" v-model="currDsPreviewActiveName"> | ||
| 395 | <el-tab-pane label="查询结果" name="resultData" class="t-left"> | ||
| 396 | <div v-if="!currDatasourceSelect?.tableName" class="no-select-table"> | ||
| 397 | <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> | ||
| 398 | <span>请从已选库表中选择</span> | ||
| 399 | </div> | ||
| 400 | <el-table key="previewTableData" v-loading="currDsPreviewDataLoading" :data="currDsPreviewData" border | ||
| 401 | tooltip-effect="light" style=" | ||
| 402 | width: 100%; | ||
| 403 | min-width: 200px; | ||
| 404 | max-width: calc(100% - 17px); | ||
| 405 | height: calc(100% - 8px); | ||
| 406 | display: inline-block; | ||
| 407 | margin: 0 8px; | ||
| 408 | " stripe ref="previewTable"> | ||
| 409 | <el-table-column v-for="(field, index) in currDsFields" :key="field.enName" :prop="field.enName" | ||
| 410 | :label="field.chName" :width="field.dataType === 'datetime' | ||
| 411 | ? 180 | ||
| 412 | : field.dataType === 'date' | ||
| 413 | ? 140 | ||
| 414 | : originTableFieldColumn[field.enName] | ||
| 415 | " :align="getTextAlign(field)" :header-align="getTextAlign(field)" :show-overflow-tooltip="true" | ||
| 416 | :formatter="(row) => formatterPreviewDate(row, field)"> | ||
| 417 | </el-table-column> | ||
| 418 | </el-table> | ||
| 419 | </el-tab-pane> | ||
| 420 | <el-tab-pane label="库表结构" name="tableStructure" class="t-left"> | ||
| 421 | <div v-if="!currDatasourceSelect?.tableName" class="no-select-table"> | ||
| 422 | <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> | ||
| 423 | <span>请从已选库表中选择</span> | ||
| 424 | </div> | ||
| 425 | <el-table key="previewTableStructure" v-loading="currDsTableStructureLoading" tooltip-effect="light" | ||
| 426 | :data="currDsTableStructure" border style=" | ||
| 427 | width: 100%; | ||
| 428 | max-width: calc(100% - 17px); | ||
| 429 | height: calc(100% - 8px); | ||
| 430 | display: inline-block; | ||
| 431 | margin: 0 8px; | ||
| 432 | " stripe ref="previewTableStructure"> | ||
| 433 | <el-table-column type="index" label="序号" :width="56" align="center" /> | ||
| 434 | <el-table-column prop="fieldName" label="字段英文名" width="150px" align="left" header-align="left" | ||
| 435 | show-overflow-tooltip> | ||
| 436 | </el-table-column> | ||
| 437 | <el-table-column prop="fieldChName" label="字段名" width="150px" align="left" header-align="left" | ||
| 438 | show-overflow-tooltip> | ||
| 439 | <template #default="scope"> | ||
| 440 | <span>{{ scope.row['fieldChName'] ?? '--' }}</span> | ||
| 441 | </template> | ||
| 442 | </el-table-column> | ||
| 443 | <el-table-column prop="fieldType" label="字段类型" width="100px" align="left" header-align="left" | ||
| 444 | show-overflow-tooltip> | ||
| 445 | <template #default="scope"> | ||
| 446 | <span>{{ scope.row['fieldType'] ?? '--' }}</span> | ||
| 447 | </template> | ||
| 448 | </el-table-column> | ||
| 449 | <el-table-column prop="fieldLength" label="长度" width="100px" align="left" header-align="left" | ||
| 450 | show-overflow-tooltip> | ||
| 451 | <template #default="scope"> | ||
| 452 | <!--- 直接用??会导致空字符串时无法显示'--',此处需要区分0和“” --> | ||
| 453 | <span>{{ (scope.row['fieldLength'] !== 0 && !scope.row['fieldLength']) ? "--" : | ||
| 454 | scope.row['fieldLength'] }}</span> | ||
| 455 | </template> | ||
| 456 | </el-table-column> | ||
| 457 | <el-table-column prop="fieldPrecision" label="精度" width="100px" align="left" header-align="left" | ||
| 458 | show-overflow-tooltip> | ||
| 459 | <template #default="scope"> | ||
| 460 | <!--- 直接用??会导致空字符串时无法显示'--',此处需要区分0和“” --> | ||
| 461 | <span>{{ (scope.row['fieldPrecision'] !== 0 && !scope.row['fieldPrecision']) ? "--" : | ||
| 462 | scope.row['fieldPrecision'] }}</span> | ||
| 463 | </template> | ||
| 464 | </el-table-column> | ||
| 465 | <el-table-column prop="isPrimary" label="是否主键" width="100px" align="left" header-align="left" | ||
| 466 | show-overflow-tooltip> | ||
| 467 | <template #default="scope"> | ||
| 468 | <span>{{ scope.row['isPrimary'] ?? '--' }}</span> | ||
| 469 | </template> | ||
| 470 | </el-table-column> | ||
| 471 | <el-table-column prop="isNotNull" label="是否必填" width="100px" align="left" header-align="left" | ||
| 472 | show-overflow-tooltip> | ||
| 473 | <template #default="scope">{{ scope.row['isNotNull'] === 'Y' ? 'N' : 'Y' }}</template> | ||
| 474 | </el-table-column> | ||
| 475 | <el-table-column prop="isFk" label="是否外键" width="100px" align="left" header-align="left" | ||
| 476 | show-overflow-tooltip> | ||
| 477 | <template #default="scope"> | ||
| 478 | <span>{{ scope.row['isFk'] ?? '--' }}</span> | ||
| 479 | </template> | ||
| 480 | </el-table-column> | ||
| 481 | </el-table> | ||
| 482 | </el-tab-pane> | ||
| 483 | </el-tabs> | ||
| 484 | </div> | ||
| 485 | </div> | ||
| 486 | </div> | ||
| 487 | </template> | ||
| 488 | |||
| 489 | <style lang="scss" scoped> | ||
| 490 | .first-step-content { | ||
| 491 | display: flex; | ||
| 492 | flex-direction: row; | ||
| 493 | height: calc(100% - 80px); | ||
| 494 | |||
| 495 | .content-left { | ||
| 496 | width: 200px; | ||
| 497 | border-right: 1px solid #d9d9d9; | ||
| 498 | |||
| 499 | .title-left { | ||
| 500 | height: 44px; | ||
| 501 | line-height: 44px; | ||
| 502 | border-bottom: 1px solid #d9d9d9; | ||
| 503 | padding-left: 8px; | ||
| 504 | font-size: 14px; | ||
| 505 | color: #212121; | ||
| 506 | } | ||
| 507 | |||
| 508 | .content-selecte-left { | ||
| 509 | height: calc(100% - 44px); | ||
| 510 | padding: 6px 8px 0px 8px; | ||
| 511 | |||
| 512 | .select-ds-title { | ||
| 513 | display: block; | ||
| 514 | font-size: 14px; | ||
| 515 | color: #999999; | ||
| 516 | line-height: 21px; | ||
| 517 | margin-bottom: 2px; | ||
| 518 | } | ||
| 519 | |||
| 520 | .table_search_input { | ||
| 521 | margin-top: 16px; | ||
| 522 | } | ||
| 523 | |||
| 524 | .page_nav_wrap.concise { | ||
| 525 | justify-content: center; | ||
| 526 | } | ||
| 527 | } | ||
| 528 | } | ||
| 529 | |||
| 530 | .content-right { | ||
| 531 | width: calc(100% - 200px); | ||
| 532 | |||
| 533 | .title-right { | ||
| 534 | height: 44px; | ||
| 535 | line-height: 44px; | ||
| 536 | border-bottom: 1px solid #d9d9d9; | ||
| 537 | padding-left: 8px; | ||
| 538 | font-size: 14px; | ||
| 539 | color: #212121; | ||
| 540 | } | ||
| 541 | |||
| 542 | .ds-select-container { | ||
| 543 | background: #f2f2f2; | ||
| 544 | height: 100px; | ||
| 545 | display: flex; | ||
| 546 | padding: 0px 0 12px 12px; | ||
| 547 | flex-direction: row; | ||
| 548 | flex-wrap: wrap; | ||
| 549 | overflow-y: auto; | ||
| 550 | |||
| 551 | .ds-select-placeholder { | ||
| 552 | width: 100%; | ||
| 553 | height: 100%; | ||
| 554 | display: flex; | ||
| 555 | align-items: center; | ||
| 556 | justify-content: center; | ||
| 557 | color: #999999; | ||
| 558 | } | ||
| 559 | |||
| 560 | .ds-select-item { | ||
| 561 | height: 32px; | ||
| 562 | border: 2px solid #d9d9d9; | ||
| 563 | display: flex; | ||
| 564 | align-items: center; | ||
| 565 | padding: 0 8px; | ||
| 566 | background: #fff; | ||
| 567 | cursor: pointer; | ||
| 568 | margin-right: 12px; | ||
| 569 | margin-top: 12px; | ||
| 570 | |||
| 571 | .item-title { | ||
| 572 | font-size: 14px; | ||
| 573 | color: #212121; | ||
| 574 | margin-right: 16px; | ||
| 575 | } | ||
| 576 | } | ||
| 577 | |||
| 578 | .ds-select-item:hover { | ||
| 579 | border: 2px solid var(--el-color-primary); | ||
| 580 | } | ||
| 581 | |||
| 582 | .ds-select-item.selected { | ||
| 583 | border: 2px solid var(--el-color-primary); | ||
| 584 | background-color: var(--el-menu-hover-bg-color); | ||
| 585 | } | ||
| 586 | } | ||
| 587 | |||
| 588 | .ds-data-preview { | ||
| 589 | height: calc(100% - 144px); | ||
| 590 | position: relative; | ||
| 591 | |||
| 592 | .preview-data-totals { | ||
| 593 | position: absolute; | ||
| 594 | right: 0; | ||
| 595 | top: 10px; | ||
| 596 | right: 16px; | ||
| 597 | } | ||
| 598 | } | ||
| 599 | } | ||
| 600 | } | ||
| 601 | |||
| 602 | :deep(.datasource-small-table) { | ||
| 603 | height: calc(100% - 143px); | ||
| 604 | margin-top: 4px; | ||
| 605 | border: 1px solid #d9d9d9; | ||
| 606 | |||
| 607 | td.el-table__cell::after, | ||
| 608 | .el-table__inner-wrapper::before { | ||
| 609 | height: 0px; | ||
| 610 | } | ||
| 611 | |||
| 612 | .cell { | ||
| 613 | padding: 0 2px; | ||
| 614 | } | ||
| 615 | |||
| 616 | th.el-table__cell { | ||
| 617 | line-height: 18px; | ||
| 618 | font-size: 12px; | ||
| 619 | color: #999999; | ||
| 620 | background-color: #fff; | ||
| 621 | } | ||
| 622 | |||
| 623 | td.el-table__cell .cell { | ||
| 624 | line-height: 18px; | ||
| 625 | font-size: 12px; | ||
| 626 | color: #212121; | ||
| 627 | } | ||
| 628 | |||
| 629 | tr.selected { | ||
| 630 | background-color: var(--el-menu-hover-bg-color); | ||
| 631 | |||
| 632 | td { | ||
| 633 | background-color: var(--el-menu-hover-bg-color); | ||
| 634 | } | ||
| 635 | } | ||
| 636 | |||
| 637 | .el-table__body tr.selected:hover>td.el-table__cell { | ||
| 638 | background-color: var(--el-menu-hover-bg-color); | ||
| 639 | } | ||
| 640 | } | ||
| 641 | |||
| 642 | :deep(.preview-tabs) { | ||
| 643 | height: 100%; | ||
| 644 | |||
| 645 | .el-tabs__header { | ||
| 646 | margin: 0 0 8px; | ||
| 647 | } | ||
| 648 | |||
| 649 | .el-tabs__nav-wrap::after { | ||
| 650 | height: 1px; | ||
| 651 | } | ||
| 652 | |||
| 653 | .el-tabs__item { | ||
| 654 | width: 88px; | ||
| 655 | padding: 0; | ||
| 656 | } | ||
| 657 | |||
| 658 | .el-tabs__nav { | ||
| 659 | padding-left: 8px; | ||
| 660 | } | ||
| 661 | |||
| 662 | .el-tabs__content { | ||
| 663 | height: calc(100% - 48px); | ||
| 664 | |||
| 665 | .el-tab-pane { | ||
| 666 | height: 100%; | ||
| 667 | |||
| 668 | :deep(.el-table) { | ||
| 669 | .cell { | ||
| 670 | white-space: nowrap; | ||
| 671 | } | ||
| 672 | } | ||
| 673 | |||
| 674 | .no-select-table { | ||
| 675 | width: 100%; | ||
| 676 | height: 100%; | ||
| 677 | display: flex; | ||
| 678 | align-items: center; | ||
| 679 | justify-content: center; | ||
| 680 | flex-direction: column; | ||
| 681 | color: #999999; | ||
| 682 | background-color: #fafafa; | ||
| 683 | } | ||
| 684 | } | ||
| 685 | } | ||
| 686 | } | ||
| 687 | |||
| 688 | :deep(.el-table) { | ||
| 689 | .el-scrollbar__view { | ||
| 690 | height: 100%; | ||
| 691 | } | ||
| 692 | } | ||
| 693 | </style> |
| 1 | <route lang="yaml"> | ||
| 2 | name: tableCreateExisting | ||
| 3 | </route> | ||
| 4 | |||
| 5 | <script lang="ts" setup name="tableCreateExisting"> | ||
| 6 | import { ref } from "vue"; | ||
| 7 | import { ElMessage } from "element-plus"; | ||
| 8 | import StepBar from "@/components/StepBar/index.vue"; | ||
| 9 | import { | ||
| 10 | getDbDirDataSourceList, | ||
| 11 | getDsData, | ||
| 12 | getDsTableStructure, | ||
| 13 | saveDbDirTable, | ||
| 14 | updateDbDirTable, | ||
| 15 | createTableSql, | ||
| 16 | } from "@/api/modules/dataInventory"; | ||
| 17 | import existingTableSelect from "./existingTableSelect.vue"; | ||
| 18 | |||
| 19 | /** 草稿中未建表时就可以编辑表相关信息。如果建表之后就只能编辑字段。 不能修改字段英文名称,数据库修改英文名就相当于删除再添加。都可以直接跳转到*/ | ||
| 20 | |||
| 21 | const { proxy } = getCurrentInstance() as any; | ||
| 22 | const router = useRouter(); | ||
| 23 | const route = useRoute(); | ||
| 24 | const isDimTable = route.query.isDim; | ||
| 25 | const execGuid: any = ref(route.query.execGuid); | ||
| 26 | |||
| 27 | // 获取数据库列表 | ||
| 28 | const databaseList: any = ref([]); | ||
| 29 | const getDbDirDataSourceListData = async () => { | ||
| 30 | const params = { | ||
| 31 | execGuid: execGuid.value, | ||
| 32 | }; | ||
| 33 | const res: any = await getDbDirDataSourceList(params); | ||
| 34 | if (res.code === proxy.$passCode) { | ||
| 35 | databaseList.value = processData(res.data); | ||
| 36 | } else { | ||
| 37 | proxy.$ElMessage.error(res.msg); | ||
| 38 | } | ||
| 39 | }; | ||
| 40 | // 数据处理函数 | ||
| 41 | const processData = (data) => { | ||
| 42 | return data.map(item => ({ | ||
| 43 | ...item, | ||
| 44 | guid: item.databaseGuid, // 添加新键 "guid" | ||
| 45 | databaseGuid: undefined, // 删除旧键 "databaseGuid" | ||
| 46 | })).map(({ databaseGuid, ...rest }) => rest); // 过滤掉 undefined 键 | ||
| 47 | }; | ||
| 48 | onMounted(async () => { | ||
| 49 | await getDbDirDataSourceListData(); | ||
| 50 | }); | ||
| 51 | |||
| 52 | const stepsInfo = ref({ | ||
| 53 | step: 0, | ||
| 54 | list: [ | ||
| 55 | { title: "选择数据库表", value: 1 }, | ||
| 56 | { title: "设置属性字段", value: 2 }, | ||
| 57 | ], | ||
| 58 | }); | ||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | const datasourceSelectedRows: Ref<any> = ref([]); | ||
| 63 | |||
| 64 | //记录下一步时选中的库表信息。 | ||
| 65 | const selectedDatabaseTable: Ref<any> = ref([]); | ||
| 66 | |||
| 67 | const handlDsSelectedChange = (v) => { | ||
| 68 | datasourceSelectedRows.value = v || []; | ||
| 69 | const params: any = []; | ||
| 70 | v.forEach((item) => { | ||
| 71 | params.push({ | ||
| 72 | tableName: item.tableName, | ||
| 73 | database: item.database, | ||
| 74 | }); | ||
| 75 | }); | ||
| 76 | selectedDatabaseTable.value = params; | ||
| 77 | console.log('params', params) | ||
| 78 | // if (isPrevious.value) { | ||
| 79 | // tableCreateInfo.value.tableFields = []; | ||
| 80 | // tableCreateInfo.value.inputNameValue = ''; | ||
| 81 | // tableCreateInfo.value.tableData[0].chName = ''; | ||
| 82 | // } | ||
| 83 | }; | ||
| 84 | |||
| 85 | |||
| 86 | const fullscreenLoading = ref(false); | ||
| 87 | /** 下一步 */ | ||
| 88 | const nextStep = () => { | ||
| 89 | if (!datasourceSelectedRows.value.length) { | ||
| 90 | ElMessage({ | ||
| 91 | type: "error", | ||
| 92 | message: "已选库表不能为空!", | ||
| 93 | }); | ||
| 94 | return; | ||
| 95 | } | ||
| 96 | getNextTableInfo(); | ||
| 97 | stepsInfo.value.step = 1; | ||
| 98 | }; | ||
| 99 | |||
| 100 | //下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value | ||
| 101 | const getNextTableInfo = async () => { | ||
| 102 | const res: any = await getDsTableStructure(selectedDatabaseTable.value); | ||
| 103 | if (res.code === proxy.$passCode) { | ||
| 104 | tableDataDetailInfo.value = res.data; | ||
| 105 | } else { | ||
| 106 | proxy.$ElMessage.error(res.msg); | ||
| 107 | } | ||
| 108 | }; | ||
| 109 | const isPrevious = ref(false); | ||
| 110 | |||
| 111 | /** 上一步 */ | ||
| 112 | const previousStep = () => { | ||
| 113 | stepsInfo.value.step = 0; | ||
| 114 | isPrevious.value = true; | ||
| 115 | }; | ||
| 116 | //记录当前正在编辑的表创建信息。 | ||
| 117 | const tableCreateInfo: Ref<any> = ref({ | ||
| 118 | guid: "", | ||
| 119 | isCreate: false, | ||
| 120 | inputNameValue: '', | ||
| 121 | tableData: [], | ||
| 122 | partitionAttribute: {}, | ||
| 123 | tableFields: [], // 字段标准数组。 | ||
| 124 | }); | ||
| 125 | |||
| 126 | |||
| 127 | const tableDataInfo = ref([ | ||
| 128 | { | ||
| 129 | tableName: '', | ||
| 130 | tableChName: '', | ||
| 131 | description: '', | ||
| 132 | }, | ||
| 133 | ]) | ||
| 134 | // 表格数据 | ||
| 135 | const tableDataDetailInfo = ref([ | ||
| 136 | { id: 1, fieldName: '系统唯一标识', fieldEnglish: 'ID', length: '<200', isUnique: '是', isEdit: false }, | ||
| 137 | { id: 2, fieldName: '姓名', fieldEnglish: 'NAME', length: '<=200', isUnique: '否', isEdit: false }, | ||
| 138 | { id: 3, fieldName: '年纪', fieldEnglish: 'AGE', length: '=200', isUnique: '否', isEdit: false }, | ||
| 139 | { id: 4, fieldName: '系统唯一标识', fieldEnglish: 'ID', length: '<200', isUnique: '是', isEdit: false }, | ||
| 140 | { id: 5, fieldName: '姓名', fieldEnglish: 'NAME', length: '<=200', isUnique: '否', isEdit: false }, | ||
| 141 | { id: 6, fieldName: '年纪', fieldEnglish: 'AGE', length: '=200', isUnique: '否', isEdit: false }, | ||
| 142 | ]) | ||
| 143 | |||
| 144 | // 配置哪些字段可编辑 | ||
| 145 | const editableFields = { | ||
| 146 | fieldName: true, // 字段中文名可编辑 | ||
| 147 | length: true, // 长度可编辑 | ||
| 148 | isUnique: true, // 数据是否唯一可编辑 | ||
| 149 | fieldPrecision: true, // 精度可编辑 | ||
| 150 | dictionaryGuid: true, // 关联字典可编辑 | ||
| 151 | } | ||
| 152 | |||
| 153 | const tableFieldsLoading = ref(false) | ||
| 154 | const selectedRows = ref([]); | ||
| 155 | // 监听选中行 | ||
| 156 | const selectionFieldsChange = (selection) => { | ||
| 157 | console.log('selection', selection) | ||
| 158 | selectedRows.value = selection; | ||
| 159 | }; | ||
| 160 | |||
| 161 | // 上移功能 | ||
| 162 | const moveUp = () => { | ||
| 163 | // 1. 找到选中行在 tableData 中的索引 | ||
| 164 | const selectedIds = selectedRows.value.map((row: any) => row.id); | ||
| 165 | |||
| 166 | // 2. 遍历选中行,按顺序上移 | ||
| 167 | for (let i = 0; i < tableDataDetailInfo.value.length; i++) { | ||
| 168 | const currentRow = tableDataDetailInfo.value[i]; | ||
| 169 | |||
| 170 | // 如果当前行被选中,且不是第一行,则交换位置 | ||
| 171 | if (selectedIds.includes(currentRow.id) && i > 0) { | ||
| 172 | const previousRow = tableDataDetailInfo.value[i - 1]; | ||
| 173 | |||
| 174 | // 如果上一行没有被选中,交换位置 | ||
| 175 | if (!selectedIds.includes(previousRow.id)) { | ||
| 176 | [tableDataDetailInfo.value[i], tableDataDetailInfo.value[i - 1]] = [tableDataDetailInfo.value[i - 1], tableDataDetailInfo.value[i]]; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | } | ||
| 180 | }; | ||
| 181 | |||
| 182 | // 下移功能 | ||
| 183 | const moveDown = () => { | ||
| 184 | // 1. 找到选中行在 tableData 中的索引 | ||
| 185 | const selectedIds = selectedRows.value.map((row: any) => row.id); | ||
| 186 | |||
| 187 | // 2. 遍历选中行,倒序下移 | ||
| 188 | for (let i = tableDataDetailInfo.value.length - 1; i >= 0; i--) { | ||
| 189 | const currentRow = tableDataDetailInfo.value[i]; | ||
| 190 | |||
| 191 | // 如果当前行被选中,且不是最后一行,则交换位置 | ||
| 192 | if (selectedIds.includes(currentRow.id) && i < tableDataDetailInfo.value.length - 1) { | ||
| 193 | const nextRow = tableDataDetailInfo.value[i + 1]; | ||
| 194 | |||
| 195 | // 如果下一行没有被选中,交换位置 | ||
| 196 | if (!selectedIds.includes(nextRow.id)) { | ||
| 197 | [tableDataDetailInfo.value[i], tableDataDetailInfo.value[i + 1]] = [tableDataDetailInfo.value[i + 1], tableDataDetailInfo.value[i]]; | ||
| 198 | } | ||
| 199 | } | ||
| 200 | } | ||
| 201 | }; | ||
| 202 | |||
| 203 | // 进入编辑模式 | ||
| 204 | const editRow = (row) => { | ||
| 205 | row.isEdit = true | ||
| 206 | } | ||
| 207 | |||
| 208 | // 保存数据 | ||
| 209 | const saveRow = (row) => { | ||
| 210 | row.isEdit = false | ||
| 211 | } | ||
| 212 | |||
| 213 | // 删除行 | ||
| 214 | const deleteRow = (index) => { | ||
| 215 | // confirm 弹窗 | ||
| 216 | proxy.$confirm('是否删除该行数据?', '提示', { | ||
| 217 | confirmButtonText: '确定', | ||
| 218 | cancelButtonText: '取消', | ||
| 219 | type: 'warning', | ||
| 220 | }).then(() => { | ||
| 221 | tableDataDetailInfo.value.splice(index, 1) | ||
| 222 | }).catch(() => { | ||
| 223 | proxy.$message({ | ||
| 224 | type: 'info', | ||
| 225 | message: '已取消删除' | ||
| 226 | }); | ||
| 227 | }); | ||
| 228 | } | ||
| 229 | // 批量删除功能 | ||
| 230 | const batchDelete = () => { | ||
| 231 | selectedRows.value.forEach((row: any) => { | ||
| 232 | const index = tableDataDetailInfo.value.findIndex((item) => item.id === row.id); | ||
| 233 | if (index !== -1) tableDataDetailInfo.value.splice(index, 1); | ||
| 234 | }); | ||
| 235 | selectedRows.value = []; | ||
| 236 | }; | ||
| 237 | |||
| 238 | // 新增一行 | ||
| 239 | const addRow = () => { | ||
| 240 | tableDataDetailInfo.value.push({ | ||
| 241 | id: tableDataDetailInfo.value.length + 1, | ||
| 242 | fieldName: '', | ||
| 243 | fieldEnglish: '', // 英文名不可编辑 | ||
| 244 | length: '', | ||
| 245 | isUnique: '', | ||
| 246 | isEdit: true, // 新增时默认进入编辑模式 | ||
| 247 | }) | ||
| 248 | } | ||
| 249 | |||
| 250 | const data = [ | ||
| 251 | { | ||
| 252 | value: '1', | ||
| 253 | label: 'Level one 1', | ||
| 254 | children: [ | ||
| 255 | { | ||
| 256 | value: '1-1', | ||
| 257 | label: 'Level two 1-1', | ||
| 258 | children: [ | ||
| 259 | { | ||
| 260 | value: '1-1-1', | ||
| 261 | label: 'Level three 1-1-1', | ||
| 262 | }, | ||
| 263 | ], | ||
| 264 | }, | ||
| 265 | ], | ||
| 266 | }, | ||
| 267 | { | ||
| 268 | value: '2', | ||
| 269 | label: 'Level one 2', | ||
| 270 | children: [ | ||
| 271 | { | ||
| 272 | value: '2-1', | ||
| 273 | label: 'Level two 2-1', | ||
| 274 | children: [ | ||
| 275 | { | ||
| 276 | value: '2-1-1', | ||
| 277 | label: 'Level three 2-1-1', | ||
| 278 | }, | ||
| 279 | ], | ||
| 280 | }, | ||
| 281 | { | ||
| 282 | value: '2-2', | ||
| 283 | label: 'Level two 2-2', | ||
| 284 | children: [ | ||
| 285 | { | ||
| 286 | value: '2-2-1', | ||
| 287 | label: 'Level three 2-2-1', | ||
| 288 | }, | ||
| 289 | ], | ||
| 290 | }, | ||
| 291 | ], | ||
| 292 | }, | ||
| 293 | { | ||
| 294 | value: '3', | ||
| 295 | label: 'Level one 3', | ||
| 296 | children: [ | ||
| 297 | { | ||
| 298 | value: '3-1', | ||
| 299 | label: 'Level two 3-1', | ||
| 300 | children: [ | ||
| 301 | { | ||
| 302 | value: '3-1-1', | ||
| 303 | label: 'Level three 3-1-1', | ||
| 304 | }, | ||
| 305 | ], | ||
| 306 | }, | ||
| 307 | { | ||
| 308 | value: '3-2', | ||
| 309 | label: 'Level two 3-2', | ||
| 310 | children: [ | ||
| 311 | { | ||
| 312 | value: '3-2-1', | ||
| 313 | label: 'Level three 3-2-1', | ||
| 314 | }, | ||
| 315 | ], | ||
| 316 | }, | ||
| 317 | ], | ||
| 318 | }, | ||
| 319 | ] | ||
| 320 | |||
| 321 | const submitAsDraft = () => { | ||
| 322 | // 保存为草稿,无论有没有guid 都传入guid | ||
| 323 | |||
| 324 | saveOrUpdate({ isDraft: 'Y' }, 0) | ||
| 325 | |||
| 326 | } | ||
| 327 | |||
| 328 | /** | ||
| 329 | * 需求写一个校验函数,校验表格数据是否填写完整 | ||
| 330 | * 1、表名称、数据库表、为空 | ||
| 331 | * 2、tableDataDetailInfo.value 每一项中的字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典、不能为空 | ||
| 332 | */ | ||
| 333 | |||
| 334 | const checkTableData = (tableDataInfo, tableDataDetailInfo) => { | ||
| 335 | |||
| 336 | const tableDataInfoKeys = ['tableName', 'tableChName'] | ||
| 337 | const tableDataDetailInfoKeys = ['fieldName', 'fieldEnglish', 'fieldType', 'length', 'fieldPrecision', 'isUnique', 'isRequired', 'fieldValueRange', 'dictionaryGuid'] | ||
| 338 | let flag = true | ||
| 339 | tableDataInfo.forEach(item => { | ||
| 340 | tableDataInfoKeys.forEach(key => { | ||
| 341 | if (!item[key]) { | ||
| 342 | flag = false | ||
| 343 | proxy.$ElMessage.error('表名称、数据库表不能为空') | ||
| 344 | } | ||
| 345 | }) | ||
| 346 | }) | ||
| 347 | tableDataDetailInfo.forEach(item => { | ||
| 348 | tableDataDetailInfoKeys.forEach(key => { | ||
| 349 | if (!item[key]) { | ||
| 350 | flag = false | ||
| 351 | proxy.$ElMessage.error('字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典不能为空') | ||
| 352 | } | ||
| 353 | }) | ||
| 354 | }) | ||
| 355 | return flag | ||
| 356 | } | ||
| 357 | |||
| 358 | const guid = ref('') | ||
| 359 | const submit = async () => { | ||
| 360 | console.log('提交', tableDataDetailInfo.value, tableDataInfo.value) | ||
| 361 | // 校验表格数据是否填写完整 | ||
| 362 | if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) { | ||
| 363 | return | ||
| 364 | } | ||
| 365 | /** | ||
| 366 | "guid": "string", | ||
| 367 | "cgDirName": "string", | ||
| 368 | "dirGuid": "string", | ||
| 369 | "tableGuid": "string", | ||
| 370 | "tableName": "string", | ||
| 371 | "tableChName": "string", | ||
| 372 | "databaseGuid": "string", | ||
| 373 | "database": "string", | ||
| 374 | "dbType": "string", | ||
| 375 | "databaseChName": "string", | ||
| 376 | "foundMode": 0, | ||
| 377 | "state": 0, | ||
| 378 | "isDraft": "string", | ||
| 379 | "fieldRQVOList": [ | ||
| 380 | { | ||
| 381 | "guid": "string", | ||
| 382 | "cgDirName": "string", | ||
| 383 | "dirGuid": "string", | ||
| 384 | "classifyName": "string", | ||
| 385 | "gradeDetailName": "string", | ||
| 386 | "tableGuid": "string", | ||
| 387 | "tableName": "string", | ||
| 388 | "tableChName": "string", | ||
| 389 | "databaseGuid": "string", | ||
| 390 | "database": "string", | ||
| 391 | "databaseChName": "string", | ||
| 392 | "fieldGuid": "string", | ||
| 393 | "fieldName": "string", | ||
| 394 | "fieldChName": "string", | ||
| 395 | "fieldType": "string", | ||
| 396 | "fieldLength": 0, | ||
| 397 | "fieldPrecision": 0, | ||
| 398 | "dimGuid": "string", | ||
| 399 | "dictionaryGuid": "string", | ||
| 400 | "sortValue": 0, | ||
| 401 | "isPrimary": "string", | ||
| 402 | "isFk": "string", | ||
| 403 | "isNotNull": "string", | ||
| 404 | "defaultValue": "string" | ||
| 405 | } | ||
| 406 | ], 这是入参 | ||
| 407 | */ | ||
| 408 | // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参 | ||
| 409 | if (!guid.value) { | ||
| 410 | saveOrUpdate({}, 0) | ||
| 411 | } else { | ||
| 412 | saveOrUpdate({}, 1) | ||
| 413 | } | ||
| 414 | |||
| 415 | } | ||
| 416 | |||
| 417 | // 单独将保存和修改函数提取出来 type 0 保存 1 修改 2 生成建表语句 | ||
| 418 | const saveOrUpdate = async (params: any = {}, type) => { | ||
| 419 | const InParams = { | ||
| 420 | guid: '', | ||
| 421 | cgDirName: '', | ||
| 422 | dirGuid: '', | ||
| 423 | tableGuid: '', | ||
| 424 | tableName: '', | ||
| 425 | tableChName: '', | ||
| 426 | databaseGuid: '', | ||
| 427 | database: '', | ||
| 428 | dbType: '', | ||
| 429 | databaseChName: '', | ||
| 430 | foundMode: 0, | ||
| 431 | state: 0, | ||
| 432 | isDraft: '', | ||
| 433 | fieldRQVOList: tableDataDetailInfo.value | ||
| 434 | } | ||
| 435 | const finalParams = { ...InParams, ...params } | ||
| 436 | // 使用switch case 语句 | ||
| 437 | switch (type) { | ||
| 438 | case 0: | ||
| 439 | // 保存/保存为草稿 | ||
| 440 | const res: any = await saveDbDirTable(finalParams); | ||
| 441 | if (res.code === proxy.$passCode) { | ||
| 442 | if (params.isDraft === 'Y') { | ||
| 443 | proxy.$ElMessage.success('保存为草稿成功!'); | ||
| 444 | } | ||
| 445 | proxy.$ElMessage.success('保存成功!'); | ||
| 446 | router.push({ name: 'classifyGradeCatalogue' }); | ||
| 447 | } else { | ||
| 448 | proxy.$ElMessage.error(res.msg); | ||
| 449 | } | ||
| 450 | break; | ||
| 451 | case 1: | ||
| 452 | // 修改 | ||
| 453 | const res1: any = await updateDbDirTable(finalParams); | ||
| 454 | if (res1.code === proxy.$passCode) { | ||
| 455 | proxy.$ElMessage.success('修改成功!'); | ||
| 456 | router.push({ name: 'classifyGradeCatalogue' }); | ||
| 457 | } else { | ||
| 458 | proxy.$ElMessage.error(res1.msg); | ||
| 459 | } | ||
| 460 | break; | ||
| 461 | case 2: | ||
| 462 | // 生成建表语句 | ||
| 463 | const res2: any = await createTableSql(finalParams); | ||
| 464 | if (res2.code === proxy.$passCode) { | ||
| 465 | proxy.$ElMessage.success('建表生成成功!'); | ||
| 466 | } else { | ||
| 467 | proxy.$ElMessage.error(res2.msg); | ||
| 468 | } | ||
| 469 | break; | ||
| 470 | default: | ||
| 471 | break; | ||
| 472 | } | ||
| 473 | } | ||
| 474 | |||
| 475 | // 生成建表弹窗区域 | ||
| 476 | |||
| 477 | const options = [ | ||
| 478 | { value: 'mysql', label: 'mysql' }, | ||
| 479 | { value: 'doris', label: 'doris' }, | ||
| 480 | |||
| 481 | ]; | ||
| 482 | |||
| 483 | const newCreateSqlFormItems = ref([{ | ||
| 484 | label: '选择数据库', | ||
| 485 | type: 'select', | ||
| 486 | maxlength: 50, | ||
| 487 | placeholder: '请输入', | ||
| 488 | field: 'name', | ||
| 489 | default: 'mysql', | ||
| 490 | options: options, | ||
| 491 | block: true, | ||
| 492 | clearable: true, | ||
| 493 | required: true | ||
| 494 | }]); | ||
| 495 | |||
| 496 | const newCreateSqlFormRules = ref({ | ||
| 497 | name: [ | ||
| 498 | { required: true, message: '请选择数据库名称', trigger: 'blur' }, | ||
| 499 | ] | ||
| 500 | }); | ||
| 501 | |||
| 502 | const newCreateSqlDialogInfo = ref({ | ||
| 503 | visible: false, | ||
| 504 | size: 460, | ||
| 505 | title: "生成建表语句", | ||
| 506 | type: "", | ||
| 507 | formInfo: { | ||
| 508 | id: "grade-form", | ||
| 509 | items: newCreateSqlFormItems.value, | ||
| 510 | rules: newCreateSqlFormRules.value, | ||
| 511 | }, | ||
| 512 | submitBtnLoading: false, | ||
| 513 | btns: { | ||
| 514 | cancel: () => { | ||
| 515 | newCreateSqlDialogInfo.value.visible = false; | ||
| 516 | }, | ||
| 517 | |||
| 518 | submit: async (btn, info) => { | ||
| 519 | newCreateSqlDialogInfo.value.submitBtnLoading = true; | ||
| 520 | const params = { | ||
| 521 | ...info, | ||
| 522 | }; | ||
| 523 | await saveOrUpdate(params, 2); | ||
| 524 | newCreateSqlDialogInfo.value.submitBtnLoading = false; | ||
| 525 | newCreateSqlDialogInfo.value.visible = false; | ||
| 526 | } | ||
| 527 | } | ||
| 528 | }) | ||
| 529 | |||
| 530 | // 生成建表语句 | ||
| 531 | const createNewSql = () => { | ||
| 532 | newCreateSqlDialogInfo.value.visible = true; | ||
| 533 | } | ||
| 534 | |||
| 535 | |||
| 536 | </script> | ||
| 537 | |||
| 538 | <template> | ||
| 539 | <div class="container_wrap full" v-loading.fullscreen.lock="fullscreenLoading"> | ||
| 540 | <div class="content_main"> | ||
| 541 | <div class="top_tool_wrap"> | ||
| 542 | <StepBar :steps-info="stepsInfo" /> | ||
| 543 | </div> | ||
| 544 | <existingTableSelect v-show="stepsInfo.step === 0" :databaseList="databaseList" :table-create-type="2" | ||
| 545 | :execGuid="execGuid" @datasource-selected-change="handlDsSelectedChange"></existingTableSelect> | ||
| 546 | <div class="second-step-content" v-show="stepsInfo.step === 1"> | ||
| 547 | <div class="table_panel_wrap"> | ||
| 548 | <el-table :data="tableDataInfo" :highlight-current-row="true" stripe border height="100%" row-key="guid" | ||
| 549 | tooltip-effect="light" :style="{ | ||
| 550 | width: '100%', | ||
| 551 | 'max-height': 'calc(100% - 16px)', | ||
| 552 | display: 'inline-block', | ||
| 553 | }"> | ||
| 554 | <!-- 表名称列 --> | ||
| 555 | <el-table-column prop="tableName" label="表名称" width="180"> | ||
| 556 | <template #header> | ||
| 557 | <span>表名称</span> | ||
| 558 | <span style="color:red;margin-left: 2px;">*</span> | ||
| 559 | </template> | ||
| 560 | <template #default="scope"> | ||
| 561 | <el-input v-model="scope.row.tableName" placeholder="请输入表名称" /> | ||
| 562 | </template> | ||
| 563 | </el-table-column> | ||
| 564 | |||
| 565 | <!-- 数据库表列 --> | ||
| 566 | <el-table-column prop="tableChName" label="数据库表" width="280"> | ||
| 567 | <template #header> | ||
| 568 | <span>数据库表</span> | ||
| 569 | <span style="color:red;margin-left: 2px;">*</span> | ||
| 570 | </template> | ||
| 571 | <template #default="scope"> | ||
| 572 | <el-input v-model="scope.row.tableChName" placeholder="请输入数据库表" /> | ||
| 573 | </template> | ||
| 574 | </el-table-column> | ||
| 575 | |||
| 576 | <!-- 描述列 --> | ||
| 577 | <el-table-column prop="description" label="描述" width="180"> | ||
| 578 | <template #default="scope"> | ||
| 579 | <el-input v-model="scope.row.description" placeholder="请输入描述" /> | ||
| 580 | </template> | ||
| 581 | </el-table-column> | ||
| 582 | </el-table> | ||
| 583 | </div> | ||
| 584 | <div class="btn-area"> | ||
| 585 | <el-button type="primary" @click="addRow">新增</el-button> | ||
| 586 | <el-button @click="moveUp">上移</el-button> | ||
| 587 | <el-button @click="moveDown">下移</el-button> | ||
| 588 | <el-button @click="batchDelete">批量删除</el-button> | ||
| 589 | <el-button @click="createNewSql">生成建表语句</el-button> | ||
| 590 | </div> | ||
| 591 | <div class="bottom_table"> | ||
| 592 | <el-table :data="tableDataDetailInfo" v-loading="tableFieldsLoading" :highlight-current-row="true" stripe | ||
| 593 | border height="100%" row-key="guid" @selection-change="selectionFieldsChange" tooltip-effect="light" :style="{ | ||
| 594 | width: '100%', | ||
| 595 | 'max-height': 'calc(100% - 16px)', | ||
| 596 | display: 'inline-block', | ||
| 597 | }"> | ||
| 598 | <el-table-column type="selection" :width="32" align="center" /> | ||
| 599 | <!-- 排序列(不可编辑) --> | ||
| 600 | <el-table-column prop="id" label="排序" width="80" align="center" /> | ||
| 601 | <!-- 字段中文名(不可编辑)fieldChName --> | ||
| 602 | <el-table-column prop="fieldName" label="字段中文名" width="150"> | ||
| 603 | <template #default="scope"> | ||
| 604 | {{ scope.row.fieldName ? scope.row.fieldName : '--' }} | ||
| 605 | </template> | ||
| 606 | </el-table-column> | ||
| 607 | <!-- 字段英文名(不可编辑) --> | ||
| 608 | <el-table-column prop="fieldEnglish" label="字段英文名" width="150"> | ||
| 609 | <template #default="scope"> | ||
| 610 | {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} | ||
| 611 | </template> | ||
| 612 | </el-table-column> | ||
| 613 | <!-- 分类(不可编辑)classifyName --> | ||
| 614 | <el-table-column prop="classifyName" label="分类" width="150"> | ||
| 615 | <template #default="scope"> | ||
| 616 | {{ scope.row.classifyName ? scope.row.classifyName : '--' }} | ||
| 617 | </template> | ||
| 618 | </el-table-column> | ||
| 619 | <!-- 分级(不可编辑) --> | ||
| 620 | <el-table-column prop="gradeDetailName" label="分级" width="120" align="center"> | ||
| 621 | <template #default="scope"> | ||
| 622 | {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }} | ||
| 623 | </template> | ||
| 624 | </el-table-column> | ||
| 625 | <!-- 字段类型fieldType (不可编辑) --> | ||
| 626 | <el-table-column prop="fieldType" label="字段类型" width="150" align="center"> | ||
| 627 | <template #default="scope"> | ||
| 628 | {{ scope.row.fieldType ? scope.row.fieldType : '--' }} | ||
| 629 | </template> | ||
| 630 | </el-table-column> | ||
| 631 | |||
| 632 | <!-- 长度(可编辑) --> | ||
| 633 | <el-table-column prop="length" label="长度" width="120" align="center"> | ||
| 634 | <template #default="scope"> | ||
| 635 | <span v-if="!scope.row.isEdit || !editableFields.length">{{ scope.row.length ? scope.row.length | ||
| 636 | : '--' }}</span> | ||
| 637 | <el-input v-else v-model="scope.row.length" placeholder="请输入长度" /> | ||
| 638 | </template> | ||
| 639 | </el-table-column> | ||
| 640 | <!-- 精度(可编辑)fieldPrecision --> | ||
| 641 | <el-table-column prop="fieldPrecision" label="精度" width="120" align="center"> | ||
| 642 | <template #default="scope"> | ||
| 643 | <span v-if="!scope.row.isEdit || !editableFields.fieldPrecision">{{ scope.row.fieldPrecision ? | ||
| 644 | scope.row.fieldPrecision : '--' }}</span> | ||
| 645 | <el-input v-else v-model="scope.row.fieldPrecision" placeholder="请输入精度" /> | ||
| 646 | </template> | ||
| 647 | </el-table-column> | ||
| 648 | |||
| 649 | <!-- 关联字典(可编辑)el-tree-select 形式下拉形式 --> | ||
| 650 | <el-table-column prop="dictionaryGuid" label="关联字典" width="150" align="center"> | ||
| 651 | <template #default="scope"> | ||
| 652 | <span v-if="!scope.row.isEdit || !editableFields.dictionaryGuid">{{ scope.row.isDict ? scope.row.isDict | ||
| 653 | : '--' }}</span> | ||
| 654 | <el-tree-select v-else v-model="scope.row.isDict" :data="data" placeholder="请选择" /> | ||
| 655 | </template> | ||
| 656 | </el-table-column> | ||
| 657 | |||
| 658 | <!-- 数据是否唯一(可编辑) --> | ||
| 659 | <el-table-column prop="isUnique" label="数据是否唯一" width="150" align="center"> | ||
| 660 | <template #default="scope"> | ||
| 661 | <span v-if="!scope.row.isEdit || !editableFields.isUnique">{{ scope.row.isUnique ? scope.row.isUnique : | ||
| 662 | '--' }}</span> | ||
| 663 | <el-select v-else v-model="scope.row.isUnique" placeholder="请选择"> | ||
| 664 | <el-option label="是" value="是" /> | ||
| 665 | <el-option label="否" value="否" /> | ||
| 666 | </el-select> | ||
| 667 | </template> | ||
| 668 | </el-table-column> | ||
| 669 | <!-- 是否必填(可编辑) --> | ||
| 670 | <el-table-column prop="isRequired" label="是否必填" width="120" align="center"> | ||
| 671 | <template #default="scope"> | ||
| 672 | <span v-if="!scope.row.isEdit">{{ scope.row.isRequired ? scope.row.isRequired : '--' }}</span> | ||
| 673 | <el-select v-else v-model="scope.row.isRequired" placeholder="请选择"> | ||
| 674 | <el-option label="是" value="是" /> | ||
| 675 | <el-option label="否" value="否" /> | ||
| 676 | </el-select> | ||
| 677 | </template> | ||
| 678 | </el-table-column> | ||
| 679 | <!-- 字段取值范围 fieldValueRange(可编辑)--> | ||
| 680 | <el-table-column prop="fieldValueRange" label="字段取值范围" width="150" align="center"> | ||
| 681 | <template #default="scope"> | ||
| 682 | <span v-if="!scope.row.isEdit">{{ scope.row.fieldValueRange ? scope.row.fieldValueRange : '--' }}</span> | ||
| 683 | <el-input v-else v-model="scope.row.fieldValueRange" placeholder="请输入字段取值范围" /> | ||
| 684 | </template> | ||
| 685 | </el-table-column> | ||
| 686 | |||
| 687 | <!-- 操作列 --> | ||
| 688 | <el-table-column label="操作" width="100" align="center" fixed="right"> | ||
| 689 | <template #default="scope"> | ||
| 690 | |||
| 691 | <!-- <el-button v-if="!scope.row.isEdit" type="primary" size="small" @click="editRow(scope.row)"> | ||
| 692 | 编辑 | ||
| 693 | </el-button> --> | ||
| 694 | <!-- <el-button v-else type="success" size="small" @click="saveRow(scope.row)"> | ||
| 695 | 保存 | ||
| 696 | </el-button> | ||
| 697 | |||
| 698 | <el-button type="danger" size="small" @click="deleteRow(scope.$index)"> | ||
| 699 | 删除 | ||
| 700 | </el-button> --> | ||
| 701 | <span class="text_btn" v-if="!scope.row.isEdit" @click="editRow(scope.row)">编辑</span> | ||
| 702 | <span class="text_btn" v-else @click="saveRow(scope.row)">保存</span> | ||
| 703 | <el-divider direction="vertical" /> | ||
| 704 | <span class="text_btn" @click="deleteRow(scope.$index)">删除</span> | ||
| 705 | </template> | ||
| 706 | </el-table-column> | ||
| 707 | </el-table> | ||
| 708 | </div> | ||
| 709 | </div> | ||
| 710 | </div> | ||
| 711 | <div class="bottom_tool_wrap"> | ||
| 712 | <template v-if="stepsInfo.step == 0"> | ||
| 713 | <el-button type="primary" @click="nextStep">下一步</el-button> | ||
| 714 | </template> | ||
| 715 | <template v-else> | ||
| 716 | <el-button @click="previousStep">上一步</el-button> | ||
| 717 | <el-button type="primary" @click="submitAsDraft">保存为草稿</el-button> | ||
| 718 | <el-button type="primary" @click="submit">提交</el-button> | ||
| 719 | </template> | ||
| 720 | </div> | ||
| 721 | <Dialog_form :dialogConfigInfo="newCreateSqlDialogInfo" /> | ||
| 722 | </div> | ||
| 723 | </template> | ||
| 724 | |||
| 725 | <style lang="scss" scoped> | ||
| 726 | .top_tool_wrap { | ||
| 727 | width: 100%; | ||
| 728 | height: 80px; | ||
| 729 | display: flex; | ||
| 730 | justify-content: center; | ||
| 731 | align-items: center; | ||
| 732 | border-bottom: 1px solid #d9d9d9; | ||
| 733 | |||
| 734 | :deep(.el-steps) { | ||
| 735 | width: 30%; | ||
| 736 | } | ||
| 737 | } | ||
| 738 | |||
| 739 | .content_main { | ||
| 740 | height: calc(100% - 40px); | ||
| 741 | |||
| 742 | .second-step-content { | ||
| 743 | height: calc(100% - 80px); | ||
| 744 | width: 100%; | ||
| 745 | padding: 16px; | ||
| 746 | |||
| 747 | .table_panel_wrap { | ||
| 748 | width: 100%; | ||
| 749 | height: auto; | ||
| 750 | overflow: visible; | ||
| 751 | } | ||
| 752 | |||
| 753 | |||
| 754 | .btn-area { | ||
| 755 | margin-top: 12px; | ||
| 756 | } | ||
| 757 | |||
| 758 | :deep(.bottom_table) { | ||
| 759 | margin-top: 12px; | ||
| 760 | height: calc(100% - 150px); | ||
| 761 | overflow-y: auto; | ||
| 762 | |||
| 763 | .el-table td.el-table__cell { | ||
| 764 | padding: 2px 0; | ||
| 765 | height: 36px; | ||
| 766 | } | ||
| 767 | } | ||
| 768 | } | ||
| 769 | } | ||
| 770 | |||
| 771 | :deep(.el-dialog) { | ||
| 772 | .dialog-form-inline { | ||
| 773 | .checkbox_input { | ||
| 774 | display: flex; | ||
| 775 | flex-direction: column; | ||
| 776 | |||
| 777 | .input_panel { | ||
| 778 | margin: 0; | ||
| 779 | } | ||
| 780 | } | ||
| 781 | |||
| 782 | .select_group { | ||
| 783 | .el-form-item__content>.el-input { | ||
| 784 | margin-top: 21px; | ||
| 785 | } | ||
| 786 | } | ||
| 787 | |||
| 788 | .radio_panel { | ||
| 789 | .panel_content { | ||
| 790 | display: none; | ||
| 791 | } | ||
| 792 | } | ||
| 793 | } | ||
| 794 | } | ||
| 795 | |||
| 796 | :deep(.batchDialog) { | ||
| 797 | .el-tree-node__content { | ||
| 798 | padding-left: 8px !important; | ||
| 799 | |||
| 800 | .el-icon { | ||
| 801 | display: none; | ||
| 802 | } | ||
| 803 | } | ||
| 804 | } | ||
| 805 | |||
| 806 | .bottom_tool_wrap { | ||
| 807 | height: 40px; | ||
| 808 | padding: 0 16px; | ||
| 809 | border-top: 1px solid #d9d9d9; | ||
| 810 | display: flex; | ||
| 811 | justify-content: flex-end; | ||
| 812 | align-items: center; | ||
| 813 | } | ||
| 814 | </style> |
src/views/data_inventory/tableCreateFile.vue
0 → 100644
| 1 | <route lang="yaml"> | ||
| 2 | name: tableCreateFile | ||
| 3 | </route> | ||
| 4 | |||
| 5 | <script lang="ts" setup name="tableCreateFile"> | ||
| 6 | |||
| 7 | import { ref } from "vue"; | ||
| 8 | import { ElMessage, ElMessageBox, ElTable } from "element-plus"; | ||
| 9 | import useUserStore from "@/store/modules/user"; | ||
| 10 | import useDataCatalogStore from "@/store/modules/dataCatalog"; | ||
| 11 | import expandPropertyDialog from "./expandPropertyDialog.vue"; | ||
| 12 | import tableDefaultValue from "./components/tableDefaultValue.vue"; | ||
| 13 | // import { | ||
| 14 | // getDatabase, | ||
| 15 | // getFileStandards, | ||
| 16 | // getDictionary, | ||
| 17 | // getSubjectFieldByFile, | ||
| 18 | // tableCategoryList, | ||
| 19 | // syncPolicys, | ||
| 20 | // getDataTypeList, | ||
| 21 | // tableModels, | ||
| 22 | // aggMethodList, | ||
| 23 | // getCharacterList, | ||
| 24 | // saveSubjectTable, | ||
| 25 | // updateSubjectTable, | ||
| 26 | // getTableStandardDetail, | ||
| 27 | // getSubjectDomainDetail, | ||
| 28 | // saveSubjectTableDraft, | ||
| 29 | // updateSubjectTableDraft, | ||
| 30 | // getFieldStandardTree, | ||
| 31 | // dimTypeList, | ||
| 32 | // getDimList, | ||
| 33 | // getSubjectTableDetail, | ||
| 34 | // checkSubjectTableData | ||
| 35 | // } from "@/api/modules/dataCatalogService"; | ||
| 36 | import { useDefault } from "@/hooks/useDefault"; | ||
| 37 | import uploadExcelFile from "./components/uploadExcelFile.vue"; | ||
| 38 | |||
| 39 | const userStore = useUserStore(); | ||
| 40 | const dataCatalogStore = useDataCatalogStore(); | ||
| 41 | const { checkDefault } = useDefault(); | ||
| 42 | const userData = JSON.parse(userStore.userData); | ||
| 43 | const { proxy } = getCurrentInstance() as any; | ||
| 44 | const router = useRouter(); | ||
| 45 | const route = useRoute(); | ||
| 46 | const isDimTable = route.query.isDim; | ||
| 47 | const subjectDomainGuid: any = ref(route.query.domainGuid); | ||
| 48 | const fullPath = route.fullPath; | ||
| 49 | const standardSetGuids = ref([]); | ||
| 50 | //记录已入库的表创建信息。 | ||
| 51 | const originTableCreateInfo = ref({}); | ||
| 52 | |||
| 53 | //记录当前正在编辑的表创建信息。 | ||
| 54 | const tableCreateInfo: Ref<any> = ref({ | ||
| 55 | guid: "", | ||
| 56 | isCreate: false, | ||
| 57 | inputNameValue: '', | ||
| 58 | isSync: 'Y', //是否默认同步数据。 | ||
| 59 | sheetName: '', //所选择的sheet页。 | ||
| 60 | tableData: [ | ||
| 61 | { | ||
| 62 | //数据库表信息。 | ||
| 63 | dataSourceGuid: '', | ||
| 64 | dataServerName: "", | ||
| 65 | dataServerChName: "", | ||
| 66 | enName: "", | ||
| 67 | chName: "", | ||
| 68 | subjectDomain: route.query.domainName, | ||
| 69 | subjectDomainGuid: subjectDomainGuid.value, | ||
| 70 | tableCategory: route.query.layereAttribute == '3' ? 6 : 1, | ||
| 71 | dimType: isDimTable ? 1 : null, | ||
| 72 | codeColumn: '', | ||
| 73 | codeName: '', | ||
| 74 | syncPolicy: 3, | ||
| 75 | characterSet: 'utf8mb3', | ||
| 76 | tableModel: 1, //若是聚合模型,下方出现一列聚合方式选择。处了主键列,其余列都需要选择。每个表里都要有主键。 | ||
| 77 | description: "", | ||
| 78 | }, | ||
| 79 | ], | ||
| 80 | partitionAttribute: {}, | ||
| 81 | tableFields: [], // 字段标准数组。 | ||
| 82 | }); | ||
| 83 | |||
| 84 | const stepsInfo = ref({ | ||
| 85 | step: 0, | ||
| 86 | list: [ | ||
| 87 | { title: "上传文件", value: 1 }, | ||
| 88 | { title: "设置属性字段", value: 2 }, | ||
| 89 | ], | ||
| 90 | }); | ||
| 91 | |||
| 92 | /** 上传的文件字段信息。 */ | ||
| 93 | const fileTableFields: any = ref([]); | ||
| 94 | /** 上传的文件数据信息 */ | ||
| 95 | const fileTableData: any = ref([]); | ||
| 96 | /** 上传的文件信息。 */ | ||
| 97 | const uploadDataFileInfo: any = ref([]); | ||
| 98 | |||
| 99 | const handleFileDataChange = (fileFields, files, sheetName, data) => { | ||
| 100 | if (fileTableFields.value != fileFields) {//文件字段改变,下一步时需要清空。 | ||
| 101 | fileTableFields.value = fileFields.slice(0); | ||
| 102 | tableCreateInfo.value.tableFields = []; | ||
| 103 | } | ||
| 104 | fileTableData.value = data; | ||
| 105 | uploadDataFileInfo.value = files; | ||
| 106 | tableCreateInfo.value.sheetName = sheetName; | ||
| 107 | console.log(files); | ||
| 108 | } | ||
| 109 | |||
| 110 | const uploadFileRef = ref(); | ||
| 111 | |||
| 112 | // const getSubjectField = () => { | ||
| 113 | // tableFieldsLoading.value = true; | ||
| 114 | // getSubjectFieldByFile(fileTableFields.value.map(f => f.chName), tableCreateInfo.value.tableData[0].subjectDomainGuid).then((res: any) => { | ||
| 115 | // tableFieldsLoading.value = false; | ||
| 116 | // if (res.code == proxy.$passCode) { | ||
| 117 | // tableCreateInfo.value.tableFields = res.data?.map((field, i) => { | ||
| 118 | // field.dimOrdictionaryGuid = field.dictionaryGuid; | ||
| 119 | // field.fileFieldName = fileTableFields.value[i].chName; | ||
| 120 | // field.isEdit = true; | ||
| 121 | // !field.notNull && (field.notNull = 'N'); | ||
| 122 | // return field; | ||
| 123 | // }) || []; | ||
| 124 | // } else { | ||
| 125 | // ElMessage.error(res.msg); | ||
| 126 | // } | ||
| 127 | // }); | ||
| 128 | // } | ||
| 129 | |||
| 130 | const nextStep = () => { | ||
| 131 | uploadFileRef.value.fileFormRef.ruleFormRef.validate((valid) => { | ||
| 132 | if (valid) { | ||
| 133 | if (!fileTableFields.value.length) { | ||
| 134 | ElMessage({ | ||
| 135 | type: "error", | ||
| 136 | message: "上传文件字段不能为空!", | ||
| 137 | }); | ||
| 138 | return; | ||
| 139 | } | ||
| 140 | if (!fileTableData.value.length) { | ||
| 141 | tableCreateInfo.value.isSync = 'N'; | ||
| 142 | } else { | ||
| 143 | tableCreateInfo.value.isSync = 'Y'; | ||
| 144 | } | ||
| 145 | stepsInfo.value.step = 1; | ||
| 146 | // getDictionaryList(); | ||
| 147 | // getDimListData(); | ||
| 148 | // if (!fieldTypes.value.length) { | ||
| 149 | // getFieldTypeList(); | ||
| 150 | // getCharacterListData(); | ||
| 151 | // } | ||
| 152 | // if (!databaseList.value.length) { | ||
| 153 | // getDatabaseList(); | ||
| 154 | // } | ||
| 155 | // getDomainDetail(subjectDomainGuid.value); | ||
| 156 | // if (!tableCreateInfo.value.tableFields.length) { | ||
| 157 | // getSubjectField(); | ||
| 158 | // } | ||
| 159 | } | ||
| 160 | }); | ||
| 161 | }; | ||
| 162 | |||
| 163 | const isPrevious = ref(false); | ||
| 164 | |||
| 165 | /** 上一步 */ | ||
| 166 | const previousStep = () => { | ||
| 167 | stepsInfo.value.step = 0; | ||
| 168 | isPrevious.value = true; | ||
| 169 | }; | ||
| 170 | |||
| 171 | /** 记录是否开启字段标准,根据主题域相关信息获取 */ | ||
| 172 | const isOpenStandard = ref(true); | ||
| 173 | |||
| 174 | const selectTableFieldRows = ref([]); | ||
| 175 | |||
| 176 | const tableStandardGuid = ref(''); | ||
| 177 | const tableStandardDetail: any = ref({}); | ||
| 178 | const fieldStandardSetGuids = ref([]); | ||
| 179 | |||
| 180 | // 实际显示的字段标准列表 | ||
| 181 | const standardListOptions: any = ref([]); | ||
| 182 | |||
| 183 | const databaseList: any = ref([]); | ||
| 184 | |||
| 185 | //字段类型 | ||
| 186 | const fieldTypes: any = ref([]); | ||
| 187 | |||
| 188 | //字符集 | ||
| 189 | const characterList: any = ref([]); | ||
| 190 | |||
| 191 | //是否列表 | ||
| 192 | const isNotList = ref([ | ||
| 193 | { | ||
| 194 | label: "Y", | ||
| 195 | value: "Y", | ||
| 196 | }, | ||
| 197 | { | ||
| 198 | label: "N", | ||
| 199 | value: "N", | ||
| 200 | }, | ||
| 201 | ]); | ||
| 202 | |||
| 203 | const batchAddFieldStandardPage = ref({ | ||
| 204 | pageSize: 50, | ||
| 205 | pageIndex: 1, | ||
| 206 | standardSetGuids: [], | ||
| 207 | approveState: 'Y', | ||
| 208 | name: '', | ||
| 209 | standardSetLevelCode: "" | ||
| 210 | }); | ||
| 211 | |||
| 212 | const init = ref(true); | ||
| 213 | |||
| 214 | const fullscreenLoading = ref(false); | ||
| 215 | |||
| 216 | /** 表里有数据时不能修改字段类型,长度,精度 */ | ||
| 217 | const hasSubjectData = ref(false); | ||
| 218 | |||
| 219 | |||
| 220 | |||
| 221 | /** 保存表 */ | ||
| 222 | const saveTable = () => { | ||
| 223 | } | ||
| 224 | </script> | ||
| 225 | |||
| 226 | <template> | ||
| 227 | <div class="container_wrap full" v-loading.fullscreen.lock="fullscreenLoading"> | ||
| 228 | <div class="content_main"> | ||
| 229 | <div class="top_tool_wrap"> | ||
| 230 | <StepBar :steps-info="stepsInfo" /> | ||
| 231 | </div> | ||
| 232 | <uploadExcelFile ref="uploadFileRef" v-show="stepsInfo.step === 0" @fileDataChange="handleFileDataChange"> | ||
| 233 | </uploadExcelFile> | ||
| 234 | <div class="second-step-content" v-show="stepsInfo.step === 1"> | ||
| 235 | aaa | ||
| 236 | </div> | ||
| 237 | </div> | ||
| 238 | <div class="bottom_tool_wrap"> | ||
| 239 | <template v-if="stepsInfo.step == 0"> | ||
| 240 | <el-button type="primary" @click="nextStep">下一步</el-button> | ||
| 241 | </template> | ||
| 242 | <template v-else> | ||
| 243 | <el-checkbox v-model="tableCreateInfo.isSync" true-label="Y" :disabled="!fileTableData?.length" | ||
| 244 | false-label="N">同步数据(说明:勾选代表建表同时写入表格数据。)</el-checkbox> | ||
| 245 | <el-button @click="previousStep">上一步</el-button> | ||
| 246 | <el-button type="primary">保存为草稿</el-button> | ||
| 247 | <el-button type="primary" @click="saveTable">提交</el-button> | ||
| 248 | </template> | ||
| 249 | </div> | ||
| 250 | |||
| 251 | </div> | ||
| 252 | </template> | ||
| 253 | |||
| 254 | <style lang="scss" scoped> | ||
| 255 | .top_tool_wrap { | ||
| 256 | width: 100%; | ||
| 257 | height: 80px; | ||
| 258 | display: flex; | ||
| 259 | justify-content: center; | ||
| 260 | align-items: center; | ||
| 261 | border-bottom: 1px solid #d9d9d9; | ||
| 262 | |||
| 263 | :deep(.el-steps) { | ||
| 264 | width: 30%; | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
| 268 | .content_main { | ||
| 269 | height: calc(100% - 40px); | ||
| 270 | |||
| 271 | .header-bg-title { | ||
| 272 | margin: 16px 16px 0px; | ||
| 273 | background: #F5F5F5; | ||
| 274 | padding-left: 16px; | ||
| 275 | height: 48px; | ||
| 276 | font-size: 14px; | ||
| 277 | color: #212121; | ||
| 278 | letter-spacing: 0; | ||
| 279 | line-height: 21px; | ||
| 280 | font-weight: 600; | ||
| 281 | display: flex; | ||
| 282 | align-items: center; | ||
| 283 | position: relative; | ||
| 284 | |||
| 285 | .preview-data-totals { | ||
| 286 | position: absolute; | ||
| 287 | right: 16px; | ||
| 288 | line-height: 32px; | ||
| 289 | font-size: 14px; | ||
| 290 | color: #666666; | ||
| 291 | font-weight: 400; | ||
| 292 | } | ||
| 293 | |||
| 294 | .fontC-4fa1a4 { | ||
| 295 | color: var(--el-color-primary); | ||
| 296 | } | ||
| 297 | } | ||
| 298 | |||
| 299 | .form-main { | ||
| 300 | border: 1px solid #d9d9d9; | ||
| 301 | margin: 0px 16px; | ||
| 302 | padding: 16px 16px 0px 16px; | ||
| 303 | height: 125px; | ||
| 304 | |||
| 305 | .dialog-form-inline { | ||
| 306 | align-items: flex-start; | ||
| 307 | } | ||
| 308 | |||
| 309 | :deep(.el-form) { | ||
| 310 | .item-label { | ||
| 311 | width: 100%; | ||
| 312 | } | ||
| 313 | |||
| 314 | .el-select { | ||
| 315 | max-width: 300px; | ||
| 316 | } | ||
| 317 | } | ||
| 318 | } | ||
| 319 | |||
| 320 | .table-main { | ||
| 321 | height: calc(100% - 350px); | ||
| 322 | border: 1px solid #d9d9d9; | ||
| 323 | margin: 0px 16px 16px 16px; | ||
| 324 | padding: 16px; | ||
| 325 | } | ||
| 326 | |||
| 327 | .empty-content { | ||
| 328 | display: flex; | ||
| 329 | align-items: center; | ||
| 330 | justify-content: center; | ||
| 331 | height: 100%; | ||
| 332 | width: 100%; | ||
| 333 | flex-direction: column; | ||
| 334 | |||
| 335 | .empty-text { | ||
| 336 | font-size: 14px; | ||
| 337 | color: #b2b2b2; | ||
| 338 | } | ||
| 339 | } | ||
| 340 | |||
| 341 | .second-step-content { | ||
| 342 | height: calc(100% - 80px); | ||
| 343 | width: 100%; | ||
| 344 | padding: 16px; | ||
| 345 | |||
| 346 | .tools_btns { | ||
| 347 | padding: 8px 0; | ||
| 348 | } | ||
| 349 | |||
| 350 | :deep(.el-table) { | ||
| 351 | .cell { | ||
| 352 | |||
| 353 | .prefix-or-suffix-cell { | ||
| 354 | display: inline-flex; | ||
| 355 | align-items: center; | ||
| 356 | } | ||
| 357 | } | ||
| 358 | } | ||
| 359 | |||
| 360 | .table_panel { | ||
| 361 | height: calc(100% - 114px); | ||
| 362 | } | ||
| 363 | |||
| 364 | :deep(.el-table) { | ||
| 365 | & td.el-table__cell { | ||
| 366 | padding: 3px 0; | ||
| 367 | height: 36px; | ||
| 368 | } | ||
| 369 | } | ||
| 370 | } | ||
| 371 | } | ||
| 372 | |||
| 373 | :deep(.el-dialog) { | ||
| 374 | .dialog-form-inline { | ||
| 375 | .checkbox_input { | ||
| 376 | display: flex; | ||
| 377 | flex-direction: column; | ||
| 378 | |||
| 379 | .input_panel { | ||
| 380 | margin: 0; | ||
| 381 | } | ||
| 382 | } | ||
| 383 | |||
| 384 | .select_group { | ||
| 385 | .el-form-item__content>.el-input { | ||
| 386 | margin-top: 21px; | ||
| 387 | } | ||
| 388 | } | ||
| 389 | |||
| 390 | .radio_panel { | ||
| 391 | .panel_content { | ||
| 392 | display: none; | ||
| 393 | } | ||
| 394 | } | ||
| 395 | } | ||
| 396 | } | ||
| 397 | |||
| 398 | :deep(.batchDialog) { | ||
| 399 | .el-tree-node__content { | ||
| 400 | padding-left: 8px !important; | ||
| 401 | |||
| 402 | .el-icon { | ||
| 403 | display: none; | ||
| 404 | } | ||
| 405 | } | ||
| 406 | } | ||
| 407 | |||
| 408 | .bottom_tool_wrap { | ||
| 409 | height: 40px; | ||
| 410 | padding: 0 16px; | ||
| 411 | border-top: 1px solid #d9d9d9; | ||
| 412 | display: flex; | ||
| 413 | justify-content: flex-end; | ||
| 414 | align-items: center; | ||
| 415 | |||
| 416 | .el-checkbox { | ||
| 417 | margin-right: 20px; | ||
| 418 | } | ||
| 419 | |||
| 420 | :deep(.el-checkbox__input.is-checked + .el-checkbox__label) { | ||
| 421 | color: var(--el-color-regular); | ||
| 422 | } | ||
| 423 | } | ||
| 424 | </style> |
| ... | @@ -137,6 +137,9 @@ const handleClassDataEdit = (params) => { | ... | @@ -137,6 +137,9 @@ const handleClassDataEdit = (params) => { |
| 137 | if (item.field === 'classStandardName') { | 137 | if (item.field === 'classStandardName') { |
| 138 | item.default = params.name | 138 | item.default = params.name |
| 139 | } | 139 | } |
| 140 | if (item.field === 'description') { | ||
| 141 | item.default = params.description | ||
| 142 | } | ||
| 140 | }) | 143 | }) |
| 141 | } | 144 | } |
| 142 | 145 | ||
| ... | @@ -209,6 +212,15 @@ const classStandardFormItems = ref([{ | ... | @@ -209,6 +212,15 @@ const classStandardFormItems = ref([{ |
| 209 | default: '', | 212 | default: '', |
| 210 | required: true, | 213 | required: true, |
| 211 | block: true, | 214 | block: true, |
| 215 | }, { | ||
| 216 | label: '分类描述', | ||
| 217 | type: 'textarea', | ||
| 218 | placeholder: '请输入', | ||
| 219 | field: 'description', | ||
| 220 | default: '', | ||
| 221 | clearable: true, | ||
| 222 | required: false, | ||
| 223 | block: true | ||
| 212 | }]); | 224 | }]); |
| 213 | 225 | ||
| 214 | const classStandardFormRules = ref({ | 226 | const classStandardFormRules = ref({ |
| ... | @@ -235,6 +247,7 @@ const newCreateClassStandardDialogInfo = ref({ | ... | @@ -235,6 +247,7 @@ const newCreateClassStandardDialogInfo = ref({ |
| 235 | if (newCreateClassStandardDialogInfo.value.title === '新增分类') { | 247 | if (newCreateClassStandardDialogInfo.value.title === '新增分类') { |
| 236 | newCreateClassStandardDialogInfo.value.submitBtnLoading = true; | 248 | newCreateClassStandardDialogInfo.value.submitBtnLoading = true; |
| 237 | const params = { | 249 | const params = { |
| 250 | description: info.description, | ||
| 238 | name: info.classStandardName, | 251 | name: info.classStandardName, |
| 239 | refGradeGuid: info.refGradeGuid, | 252 | refGradeGuid: info.refGradeGuid, |
| 240 | type: 'C' | 253 | type: 'C' | ... | ... |
src/views/home.vue
deleted
100644 → 0
| 1 | <route lang="yaml"> | ||
| 2 | name: home | ||
| 3 | meta: | ||
| 4 | title: 数据资产管理 | ||
| 5 | </route> | ||
| 6 | <script lang="ts" setup name="home"> | ||
| 7 | import homeDamRegister from './homeDamRegister.vue'; | ||
| 8 | import homeDamDataCircule from './homeDamDataCircule.vue'; | ||
| 9 | import homeDamDemand from './homeDamDemand.vue'; | ||
| 10 | import homeDamAlgorithm from './homeDamAlgorithm.vue'; | ||
| 11 | import homeDamFinance from './homeDamFinance.vue'; | ||
| 12 | import homeDamMarket from './homeDamMarket.vue'; | ||
| 13 | |||
| 14 | const activeName = ref('register'); | ||
| 15 | |||
| 16 | const enterCompany = () => { | ||
| 17 | window.open('https://www.csbr.cn/'); | ||
| 18 | } | ||
| 19 | |||
| 20 | const logon = () => { | ||
| 21 | window.open('/login'); | ||
| 22 | } | ||
| 23 | |||
| 24 | const register = () => { | ||
| 25 | window.open('/register'); | ||
| 26 | } | ||
| 27 | |||
| 28 | const companyDesc = ref('国家级数据交易所经纪服务商,为客户提供数据资产登记服务、数据要素及数据产品交易服务、数据要素金融服务等一揽子经纪服务。\n北京传世博润科技有限公司以软硬件一体化的人工智能物流网为基础,结合大数据技术提供数字化综合解决方案,帮助客户在数字经济时代转型为数字化企业的飞跃。'); | ||
| 29 | |||
| 30 | const tabsInfo = ref({ | ||
| 31 | activeName: "index", | ||
| 32 | tabs: [ | ||
| 33 | { label: "首页", name: 'index' }, | ||
| 34 | { label: "资产登记服务", name: "dam", description: '' }, | ||
| 35 | { label: "数据供给", name: "dataCircule" }, | ||
| 36 | { label: "供需信息", name: "demand" }, | ||
| 37 | { label: "算法竞赛", name: "algorithm" }, | ||
| 38 | { label: "服务工具", name: "market" }, | ||
| 39 | { label: "融资服务", name: "service" }, | ||
| 40 | ] | ||
| 41 | }); | ||
| 42 | |||
| 43 | const homeDamFinanceRef = ref(); | ||
| 44 | |||
| 45 | const homeDamDataCirculeRef = ref(); | ||
| 46 | |||
| 47 | const homeDamDemandRef = ref(); | ||
| 48 | |||
| 49 | const homeDamAlgorithmRef = ref(); | ||
| 50 | |||
| 51 | const homeDamMarketRef = ref(); | ||
| 52 | |||
| 53 | const tabClick = (val) => { | ||
| 54 | if (val?.props.name == 'dataCircule') { | ||
| 55 | homeDamDataCirculeRef.value.initPage(); | ||
| 56 | } else if (val?.props.name == 'demand') { | ||
| 57 | homeDamDemandRef.value.initPage(); | ||
| 58 | } else if (val?.props.name == 'algorithm') { | ||
| 59 | homeDamAlgorithmRef.value.initPage(); | ||
| 60 | } else if (val?.props.name == 'market') { | ||
| 61 | homeDamMarketRef.value.initPage(); | ||
| 62 | } else if (val?.props.name == 'service') { | ||
| 63 | homeDamFinanceRef.value.initPage(); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | </script> | ||
| 68 | |||
| 69 | <template> | ||
| 70 | <div class="home-full-wrap"> | ||
| 71 | <div class="home-container"> | ||
| 72 | <div class="logo-header"> | ||
| 73 | <img style="width: 120px;height: 36px;margin-left: 27px;" src="../assets/images/logo-white.png" alt="" /> | ||
| 74 | <el-tabs v-model="tabsInfo.activeName" class="header-tabs" @tab-click="tabClick"> | ||
| 75 | <el-tab-pane v-for="tab in tabsInfo.tabs" :label="tab.label" :name="tab.name"> | ||
| 76 | </el-tab-pane> | ||
| 77 | </el-tabs> | ||
| 78 | <div class="logon-btns"> | ||
| 79 | <el-button class="logon-btn" @click="register">注册</el-button> | ||
| 80 | <el-button class="logon-btn main-btn" @click="logon">登录</el-button> | ||
| 81 | </div> | ||
| 82 | </div> | ||
| 83 | <div v-show="tabsInfo.activeName == 'index'"> | ||
| 84 | <div class="banner"> | ||
| 85 | <img style="width: 100%;height: 100%;" src="../assets/images/home-banner.png" alt="" /> | ||
| 86 | <div class="header"> | ||
| 87 | <div class="header-content"> | ||
| 88 | <!-- <div class="header-top"> | ||
| 89 | <img src="../assets/images/logo.png" class="logo" /> | ||
| 90 | </div> --> | ||
| 91 | <div class="header-bottom"> | ||
| 92 | <div class="title">数据资产管理系统</div> | ||
| 93 | <div class="header-right">激活数据流通体系,释放数据要素新质生产力</div> | ||
| 94 | </div> | ||
| 95 | </div> | ||
| 96 | </div> | ||
| 97 | </div> | ||
| 98 | <div class="second-container"> | ||
| 99 | <div class="content"> | ||
| 100 | <div class="chunk"> | ||
| 101 | <img class="effect-img" src="../assets/images/financial-optimization.png" alt="" /> | ||
| 102 | </div> | ||
| 103 | <div class="chunk"> | ||
| 104 | <img class="effect-img" src="../assets/images/enhance.png" alt="" /> | ||
| 105 | </div> | ||
| 106 | <div class="chunk"> | ||
| 107 | <img class="effect-img" src="../assets/images/promote-circulation.png" alt="" /> | ||
| 108 | </div> | ||
| 109 | <div class="chunk"> | ||
| 110 | <img class="effect-img" src="../assets/images/data-element.png" alt="" /> | ||
| 111 | </div> | ||
| 112 | </div> | ||
| 113 | </div> | ||
| 114 | <el-tabs class="three-tabs" v-model="activeName"> | ||
| 115 | <el-tab-pane label="数据资产登记服务" name="register" class="register"> | ||
| 116 | <div class="title-a">确权凭证可交易</div> | ||
| 117 | <div class="step-main"> | ||
| 118 | <div class="step-one"> | ||
| 119 | <div class="left">1</div> | ||
| 120 | <div class="right">加入数据资产生产体系</div> | ||
| 121 | </div> | ||
| 122 | <div class="step-one"> | ||
| 123 | <div class="left">2</div> | ||
| 124 | <div class="right">资源盘点资产规划</div> | ||
| 125 | </div> | ||
| 126 | <div class="step-one"> | ||
| 127 | <div class="left">3</div> | ||
| 128 | <div class="right">合规核验权利梳理</div> | ||
| 129 | </div> | ||
| 130 | <div class="step-one"> | ||
| 131 | <div class="left">4</div> | ||
| 132 | <div class="right">资产登记确权凭证</div> | ||
| 133 | </div> | ||
| 134 | <div class="step-one"> | ||
| 135 | <div class="left">5</div> | ||
| 136 | <div class="right">确定目标资产质量评价</div> | ||
| 137 | </div> | ||
| 138 | <div class="step-one"> | ||
| 139 | <div class="left">6</div> | ||
| 140 | <div class="right">确定目标资产价值评估</div> | ||
| 141 | </div> | ||
| 142 | </div> | ||
| 143 | <div class="title-a" style="margin-top: 0px">确权凭证不可交易</div> | ||
| 144 | <div class="step-main"> | ||
| 145 | <div class="step-one"> | ||
| 146 | <div class="left">1</div> | ||
| 147 | <div class="right">加入数据资产生产体系</div> | ||
| 148 | </div> | ||
| 149 | <div class="step-one"> | ||
| 150 | <div class="left">2</div> | ||
| 151 | <div class="right">资源盘点资产规划</div> | ||
| 152 | </div> | ||
| 153 | <div class="step-one"> | ||
| 154 | <div class="left">3</div> | ||
| 155 | <div class="right">合规核验权利梳理</div> | ||
| 156 | </div> | ||
| 157 | <div class="step-one"> | ||
| 158 | <div class="left">4</div> | ||
| 159 | <div class="right">资产登记确权凭证</div> | ||
| 160 | </div> | ||
| 161 | <div class="step-one" style="background: transparent"></div> | ||
| 162 | <div class="step-one" style="background: transparent"></div> | ||
| 163 | </div> | ||
| 164 | </el-tab-pane> | ||
| 165 | <el-tab-pane label="数据资产入表服务" name="entry" class="entry"> | ||
| 166 | <div style="width: 100%; position: relative;"> | ||
| 167 | <img style="width: 100%;height: 208px;" src="../assets/images/entry-bg.png" alt="" /> | ||
| 168 | <div class="content"> | ||
| 169 | <div class="title">提供入表咨询服务</div> | ||
| 170 | <div class="desc">提供权威会计师律师事务所辅导资产入表工作 上市公司 拟上市公司 国有企业 事业单位</div> | ||
| 171 | </div> | ||
| 172 | </div> | ||
| 173 | </el-tab-pane> | ||
| 174 | <el-tab-pane label="数据场内交易服务" name="transactio" class="transactio"> | ||
| 175 | <div class="title-a">获取加工及产品经营授权,将数据资源形成数据产品,在可信空间进行买卖双方的交易</div> | ||
| 176 | <div class="step-main"> | ||
| 177 | <div class="step-one" style="width: calc(25% - 25px)"> | ||
| 178 | <div class="left">1</div> | ||
| 179 | <div class="right">数据产品设计</div> | ||
| 180 | </div> | ||
| 181 | <div class="step-one" style="width: calc(25% - 25px)"> | ||
| 182 | <div class="left">2</div> | ||
| 183 | <div class="right">数据产品发布</div> | ||
| 184 | </div> | ||
| 185 | <div class="step-one" style="width: calc(25% - 25px)"> | ||
| 186 | <div class="left">3</div> | ||
| 187 | <div class="right">寻找数据需求方</div> | ||
| 188 | </div> | ||
| 189 | <div class="step-one" style="width: calc(25% - 25px)"> | ||
| 190 | <div class="left">4</div> | ||
| 191 | <div class="right">撮合成交</div> | ||
| 192 | </div> | ||
| 193 | </div> | ||
| 194 | </el-tab-pane> | ||
| 195 | <el-tab-pane label="数据金融化服务" name="finace" class="finace"> | ||
| 196 | <div class="title-a">提供辅导完成数据资产金融化业务,获取以数据资产或数据产品的融资</div> | ||
| 197 | <div class="step-main"> | ||
| 198 | <div class="step-one" style="width: calc(33% - 35px)"> | ||
| 199 | <div class="left">1</div> | ||
| 200 | <div class="right">提出金融需求</div> | ||
| 201 | </div> | ||
| 202 | <div class="step-one" style="width: calc(33% - 35px)"> | ||
| 203 | <div class="left">2</div> | ||
| 204 | <div class="right">寻找资金方</div> | ||
| 205 | </div> | ||
| 206 | <div class="step-one" style="width: calc(33% - 35px)"> | ||
| 207 | <div class="left">3</div> | ||
| 208 | <div class="right">撮合成交</div> | ||
| 209 | </div> | ||
| 210 | </div> | ||
| 211 | </el-tab-pane> | ||
| 212 | <el-tab-pane label="治理及挖掘服务" name="governance" class="governance"> | ||
| 213 | <div style="width: 100%; position: relative;"> | ||
| 214 | <img style="width: 100%;height: 208px;" src="../assets/images/governance-bg.png" alt="" /> | ||
| 215 | <div class="content"> | ||
| 216 | <div class="title">治理及挖掘服务</div> | ||
| 217 | <div class="desc">提供专业的数据治理服务商为其提供数据治理服务及建议咨询</div> | ||
| 218 | <div class="desc">提供专业的数据挖掘应用服务</div> | ||
| 219 | </div> | ||
| 220 | </div> | ||
| 221 | </el-tab-pane> | ||
| 222 | </el-tabs> | ||
| 223 | <div class="four-container"> | ||
| 224 | <div style="height: 100%; width: 100%;"> | ||
| 225 | <div class="title">重点领域数据要素乘数效应</div> | ||
| 226 | <div class="desc">12重点领域</div> | ||
| 227 | <img style="width: 100%;margin-bottom: 61px;" src="../assets/images/primary-area.png" alt="" /> | ||
| 228 | </div> | ||
| 229 | </div> | ||
| 230 | <div class="company"> | ||
| 231 | <div style="height: 100%; width: 100%;"> | ||
| 232 | <div class="title">北京传世博润科技有限公司</div> | ||
| 233 | <div class="desc">{{ companyDesc }}</div> | ||
| 234 | <div class="btn-dom"> | ||
| 235 | <el-button class="btn" @click="enterCompany">了解我们</el-button> | ||
| 236 | </div> | ||
| 237 | <img style="width: 100%;height: 543px;" src="../assets/images/company-bg.png" alt="" /> | ||
| 238 | </div> | ||
| 239 | </div> | ||
| 240 | <div class="exchange"> | ||
| 241 | <div class="title">合作交易所</div> | ||
| 242 | <div class="img-main"> | ||
| 243 | <img class="img-exchange" src="../assets/images/exchange-beijing.png" alt="" /> | ||
| 244 | <img class="img-exchange" src="../assets/images/exchange-guiyang.png" alt="" /> | ||
| 245 | <img class="img-exchange" src="../assets/images/exchange-xibu.png" alt="" /> | ||
| 246 | <img class="img-exchange" src="../assets/images/exchange-wenzhou.png" alt="" /> | ||
| 247 | </div> | ||
| 248 | </div> | ||
| 249 | </div> | ||
| 250 | <homeDamRegister v-show="tabsInfo.activeName == 'dam'"></homeDamRegister> | ||
| 251 | <!-- 数据供给页面 --> | ||
| 252 | <homeDamDataCircule ref="homeDamDataCirculeRef" v-show="tabsInfo.activeName == 'dataCircule'"></homeDamDataCircule> | ||
| 253 | <!-- 供需信息页面 --> | ||
| 254 | <homeDamDemand ref="homeDamDemandRef" v-show="tabsInfo.activeName == 'demand'"></homeDamDemand> | ||
| 255 | <!-- 算法竞赛页面 --> | ||
| 256 | <homeDamAlgorithm ref="homeDamAlgorithmRef" v-show="tabsInfo.activeName == 'algorithm'"></homeDamAlgorithm> | ||
| 257 | <!-- 服务工具 --> | ||
| 258 | <homeDamMarket ref="homeDamMarketRef" v-show="tabsInfo.activeName == 'market'"></homeDamMarket> | ||
| 259 | <homeDamFinance ref="homeDamFinanceRef" v-show="tabsInfo.activeName == 'service'"></homeDamFinance> | ||
| 260 | <div class="footer-link"> | ||
| 261 | <div class="link-title">友情链接</div> | ||
| 262 | <div class="link-main"> | ||
| 263 | <div class="column"> | ||
| 264 | <!-- 目前没找到官网,暂时先不跳转,跟统计局不是同一个。 --> | ||
| 265 | <span class="link-detail" href="https://data.stats.gov.cn" target="_blank">国家数据局</span> | ||
| 266 | <a class="link-detail" href="https://www.miit.gov.cn" target="_blank">中华人民共和国工业和信息化部</a> | ||
| 267 | <a class="link-detail" href="http://www.caict.ac.cn" target="_blank">中国信息通信研究院</a> | ||
| 268 | <a class="link-detail" href="https://www.trimps.ac.cn" target="_blank">公安部第三研究所</a> | ||
| 269 | </div> | ||
| 270 | <div class="column"> | ||
| 271 | <a class="link-detail" href="https://www.cufe.edu.cn" target="_blank">中央财经大学</a> | ||
| 272 | <a class="link-detail" href="https://www.henu.edu.cn" target="_blank">河南大学</a> | ||
| 273 | <a class="link-detail" href="https://www.wzu.edu.cn" target="_blank">温州大学</a> | ||
| 274 | </div> | ||
| 275 | <div class="column"> | ||
| 276 | <a class="link-detail" href="https://www.landinglawyer.com" target="_blank">上海兰迪律师事务所</a> | ||
| 277 | <a class="link-detail" href="https://www.cairui.com.cn" target="_blank">上海财瑞会计事务所</a> | ||
| 278 | <a class="link-detail" href="https://www.cairui.com.cn" target="_blank">上海财瑞资产评估有限公司</a> | ||
| 279 | </div> | ||
| 280 | <div class="column"> | ||
| 281 | <a class="link-detail" href="https://ebanking1.ccb.com.cn" target="_blank">中国建设银行</a> | ||
| 282 | <a class="link-detail" href="https://bankofbeijing.com.cn" target="_blank">北京银行股份有限公司</a> | ||
| 283 | <a class="link-detail" href="https://www.cebbank.com" target="_blank">中国光大银行股份有限公司</a> | ||
| 284 | <a class="link-detail" href="https://www.zybank.com.cn" target="_blank">中原银行股份有限公司</a> | ||
| 285 | <a class="link-detail" href="https://www.shxibank.com" target="_blank">山西银行股份有限公司</a> | ||
| 286 | </div> | ||
| 287 | </div> | ||
| 288 | </div> | ||
| 289 | <div class="footer"> | ||
| 290 | <div class="desc">北京传世博润科技有限公司 Copyright @ 2023-2024 <a style="color: #fff" href="https://beian.miit.gov.cn" | ||
| 291 | target="_blank">京ICP备2024044205号 </a> | ||
| 292 | </div> | ||
| 293 | </div> | ||
| 294 | </div> | ||
| 295 | </div> | ||
| 296 | </template> | ||
| 297 | |||
| 298 | <style lang="scss" scoped> | ||
| 299 | .home-full-wrap { | ||
| 300 | height: 100%; | ||
| 301 | width: 100%; | ||
| 302 | overflow-y: auto; | ||
| 303 | overflow-x: hidden; | ||
| 304 | } | ||
| 305 | |||
| 306 | .home-container { | ||
| 307 | display: flex; | ||
| 308 | flex-direction: column; | ||
| 309 | min-height: 100%; | ||
| 310 | } | ||
| 311 | |||
| 312 | .logo-header { | ||
| 313 | height: 48px; | ||
| 314 | display: flex; | ||
| 315 | align-items: center; | ||
| 316 | justify-content: space-between; | ||
| 317 | |||
| 318 | :deep(.header-tabs.el-tabs) { | ||
| 319 | margin-top: 14px; | ||
| 320 | .el-tabs__nav-scroll { | ||
| 321 | display: flex; | ||
| 322 | justify-content: center; | ||
| 323 | } | ||
| 324 | |||
| 325 | .el-tabs__nav-wrap::after { | ||
| 326 | height: 0px; | ||
| 327 | } | ||
| 328 | |||
| 329 | .el-tabs__nav { | ||
| 330 | margin: 0px 20px; | ||
| 331 | } | ||
| 332 | |||
| 333 | .el-tabs__item:focus-visible { | ||
| 334 | box-shadow: none; | ||
| 335 | } | ||
| 336 | } | ||
| 337 | } | ||
| 338 | |||
| 339 | .banner { | ||
| 340 | height: 500px; | ||
| 341 | position: relative; | ||
| 342 | |||
| 343 | .header { | ||
| 344 | width: 100%; | ||
| 345 | height: 100%; | ||
| 346 | display: flex; | ||
| 347 | justify-content: center; | ||
| 348 | align-items: center; | ||
| 349 | color: #fff; | ||
| 350 | position: absolute; | ||
| 351 | left: 0; | ||
| 352 | top: 0; | ||
| 353 | |||
| 354 | .header-content { | ||
| 355 | width: 100%; | ||
| 356 | height: 100%; | ||
| 357 | display: flex; | ||
| 358 | flex-direction: column; | ||
| 359 | |||
| 360 | .header-top { | ||
| 361 | height: 80px; | ||
| 362 | display: flex; | ||
| 363 | align-items: center; | ||
| 364 | |||
| 365 | .logo { | ||
| 366 | margin-left: 40px; | ||
| 367 | height: 40px; | ||
| 368 | } | ||
| 369 | } | ||
| 370 | |||
| 371 | .header-bottom { | ||
| 372 | height: calc(100% - 120px); | ||
| 373 | display: flex; | ||
| 374 | flex-direction: column; | ||
| 375 | justify-content: center; | ||
| 376 | margin-bottom: 40px; | ||
| 377 | |||
| 378 | .title { | ||
| 379 | font-size: 56px; | ||
| 380 | color: #FFFFFF; | ||
| 381 | font-weight: 400; | ||
| 382 | margin-bottom: 18px; | ||
| 383 | display: block; | ||
| 384 | margin-left: 213px; | ||
| 385 | } | ||
| 386 | |||
| 387 | .header-right { | ||
| 388 | font-size: 30px; | ||
| 389 | font-weight: 200; | ||
| 390 | padding-top: 25px; | ||
| 391 | margin-left: 331px; | ||
| 392 | } | ||
| 393 | } | ||
| 394 | } | ||
| 395 | } | ||
| 396 | |||
| 397 | } | ||
| 398 | |||
| 399 | .logon-btns { | ||
| 400 | display: flex; | ||
| 401 | margin-right: 55px; | ||
| 402 | } | ||
| 403 | |||
| 404 | .logon-btn { | ||
| 405 | font-size: 14px; | ||
| 406 | color: #666666; | ||
| 407 | text-align: center; | ||
| 408 | height: 32px; | ||
| 409 | width: 64px; | ||
| 410 | display: block; | ||
| 411 | border-radius: 4px; | ||
| 412 | &.main-btn { | ||
| 413 | background: #0098E6; | ||
| 414 | color: #fff; | ||
| 415 | } | ||
| 416 | } | ||
| 417 | |||
| 418 | .second-container { | ||
| 419 | height: auto; | ||
| 420 | background-color: #fff; | ||
| 421 | display: flex; | ||
| 422 | flex-direction: row; | ||
| 423 | align-items: center; | ||
| 424 | justify-content: center; | ||
| 425 | padding: 32px 20px; | ||
| 426 | |||
| 427 | .content { | ||
| 428 | width: 100%; | ||
| 429 | display: flex; | ||
| 430 | height: 100%; | ||
| 431 | justify-content: space-between; | ||
| 432 | |||
| 433 | .chunk { | ||
| 434 | min-width: 250px; | ||
| 435 | width: 23.5%; | ||
| 436 | |||
| 437 | .effect-img { | ||
| 438 | height: 100%; | ||
| 439 | width: 100%; | ||
| 440 | } | ||
| 441 | |||
| 442 | .text { | ||
| 443 | font-size: 24px; | ||
| 444 | color: #1B1B1B; | ||
| 445 | font-weight: 200; | ||
| 446 | padding-left: 20px; | ||
| 447 | padding-right: 40px; | ||
| 448 | padding-top: 12px; | ||
| 449 | height: 118px; | ||
| 450 | } | ||
| 451 | } | ||
| 452 | } | ||
| 453 | } | ||
| 454 | |||
| 455 | :deep(.three-tabs.el-tabs) { | ||
| 456 | background-color: #EAEDF4; | ||
| 457 | |||
| 458 | .el-tabs__content { | ||
| 459 | padding: 0px 20px; | ||
| 460 | } | ||
| 461 | |||
| 462 | .el-tabs__nav-next, | ||
| 463 | .el-tabs__nav-prev { | ||
| 464 | top: 35px; | ||
| 465 | } | ||
| 466 | |||
| 467 | .el-tabs__nav-scroll { | ||
| 468 | display: flex; | ||
| 469 | flex-direction: row; | ||
| 470 | justify-content: center; | ||
| 471 | padding: 0px 20px; | ||
| 472 | |||
| 473 | .el-tabs__nav { | ||
| 474 | width: 100%; | ||
| 475 | } | ||
| 476 | } | ||
| 477 | |||
| 478 | .el-tabs__active-bar { | ||
| 479 | background-color: #E1822F; | ||
| 480 | } | ||
| 481 | |||
| 482 | .el-tabs__item { | ||
| 483 | height: 110px; | ||
| 484 | width: 256px; | ||
| 485 | font-size: 24px; | ||
| 486 | color: #414141; | ||
| 487 | font-weight: 200; | ||
| 488 | padding-right: 30px; | ||
| 489 | flex: 1; | ||
| 490 | |||
| 491 | &.is-active { | ||
| 492 | color: #E1822F; | ||
| 493 | font-weight: 500; | ||
| 494 | } | ||
| 495 | } | ||
| 496 | |||
| 497 | .el-tab-pane { | ||
| 498 | display: flex; | ||
| 499 | flex-direction: column; | ||
| 500 | align-items: center; | ||
| 501 | } | ||
| 502 | |||
| 503 | .title-a { | ||
| 504 | margin-top: 37px; | ||
| 505 | margin-bottom: 16px; | ||
| 506 | font-size: 24px; | ||
| 507 | color: #2B2B2B; | ||
| 508 | font-weight: 200; | ||
| 509 | width: 100%; | ||
| 510 | } | ||
| 511 | |||
| 512 | .governance, | ||
| 513 | .entry { | ||
| 514 | margin-bottom: 50px; | ||
| 515 | margin-top: 36px; | ||
| 516 | position: relative; | ||
| 517 | |||
| 518 | .content { | ||
| 519 | position: absolute; | ||
| 520 | left: 60px; | ||
| 521 | top: 0; | ||
| 522 | height: 100%; | ||
| 523 | display: flex; | ||
| 524 | flex-direction: column; | ||
| 525 | justify-content: center; | ||
| 526 | |||
| 527 | .title { | ||
| 528 | font-size: 32px; | ||
| 529 | color: #FFFFFF; | ||
| 530 | font-weight: 200; | ||
| 531 | } | ||
| 532 | |||
| 533 | .desc { | ||
| 534 | margin-top: 12px; | ||
| 535 | font-size: 20px; | ||
| 536 | color: #FFFFFF; | ||
| 537 | font-weight: 200; | ||
| 538 | } | ||
| 539 | } | ||
| 540 | } | ||
| 541 | |||
| 542 | .step-main { | ||
| 543 | margin-bottom: 81px; | ||
| 544 | display: flex; | ||
| 545 | width: 100%; | ||
| 546 | justify-content: space-between; | ||
| 547 | |||
| 548 | .step-one { | ||
| 549 | height: 127px; | ||
| 550 | background-image: linear-gradient(90deg, #D96D03 2%, #F1A981 100%); | ||
| 551 | display: flex; | ||
| 552 | min-width: 205px; | ||
| 553 | width: calc(16.7% - 20px); | ||
| 554 | |||
| 555 | .left { | ||
| 556 | display: flex; | ||
| 557 | align-items: center; | ||
| 558 | margin-left: 12px; | ||
| 559 | font-size: 80px; | ||
| 560 | color: #FFFFFF; | ||
| 561 | font-weight: 500; | ||
| 562 | } | ||
| 563 | |||
| 564 | .right { | ||
| 565 | display: flex; | ||
| 566 | align-items: center; | ||
| 567 | margin-left: 8px; | ||
| 568 | margin-right: 24px; | ||
| 569 | font-size: 24px; | ||
| 570 | color: #FFFFFF; | ||
| 571 | font-weight: 200; | ||
| 572 | } | ||
| 573 | } | ||
| 574 | } | ||
| 575 | } | ||
| 576 | |||
| 577 | .four-container { | ||
| 578 | height: auto; | ||
| 579 | display: flex; | ||
| 580 | flex-direction: column; | ||
| 581 | align-items: center; | ||
| 582 | padding: 0px 20px; | ||
| 583 | |||
| 584 | .title { | ||
| 585 | width: 100%; | ||
| 586 | margin-top: 80px; | ||
| 587 | font-size: 40px; | ||
| 588 | color: #242424; | ||
| 589 | line-height: 56px; | ||
| 590 | font-weight: 200; | ||
| 591 | } | ||
| 592 | |||
| 593 | .desc { | ||
| 594 | width: 100%; | ||
| 595 | font-size: 24px; | ||
| 596 | color: #242424; | ||
| 597 | line-height: 33px; | ||
| 598 | font-weight: 200; | ||
| 599 | margin-bottom: 32px; | ||
| 600 | } | ||
| 601 | } | ||
| 602 | |||
| 603 | .company { | ||
| 604 | background: #EAEDF4; | ||
| 605 | display: flex; | ||
| 606 | flex-direction: column; | ||
| 607 | align-items: center; | ||
| 608 | padding: 0px 20px; | ||
| 609 | |||
| 610 | .title { | ||
| 611 | width: 100%; | ||
| 612 | margin-top: 80px; | ||
| 613 | font-size: 40px; | ||
| 614 | color: #2B2B2B; | ||
| 615 | font-weight: 200; | ||
| 616 | height: 56px; | ||
| 617 | } | ||
| 618 | |||
| 619 | .desc { | ||
| 620 | width: 100%; | ||
| 621 | margin-top: 14px; | ||
| 622 | font-size: 20px; | ||
| 623 | color: #2B2B2B; | ||
| 624 | font-weight: 200; | ||
| 625 | white-space: pre-line; | ||
| 626 | line-height: 28px; | ||
| 627 | } | ||
| 628 | |||
| 629 | .btn-dom { | ||
| 630 | width: 100%; | ||
| 631 | } | ||
| 632 | |||
| 633 | .btn { | ||
| 634 | font-size: 18px; | ||
| 635 | margin-top: 21px; | ||
| 636 | margin-bottom: 23px; | ||
| 637 | background: #0759B7; | ||
| 638 | border-radius: 0px; | ||
| 639 | color: #fff; | ||
| 640 | font-weight: 500; | ||
| 641 | padding: 8px 33px; | ||
| 642 | height: 40px; | ||
| 643 | width: 120px; | ||
| 644 | } | ||
| 645 | } | ||
| 646 | |||
| 647 | .exchange { | ||
| 648 | height: 394px; | ||
| 649 | display: flex; | ||
| 650 | flex-direction: column; | ||
| 651 | align-items: center; | ||
| 652 | padding: 0px 20px; | ||
| 653 | |||
| 654 | .title { | ||
| 655 | width: 100%; | ||
| 656 | margin-top: 40px; | ||
| 657 | margin-bottom: 30px; | ||
| 658 | font-size: 40px; | ||
| 659 | color: #2B2B2B; | ||
| 660 | font-weight: 200; | ||
| 661 | } | ||
| 662 | |||
| 663 | .img-main { | ||
| 664 | width: 100%; | ||
| 665 | height: 228px; | ||
| 666 | display: flex; | ||
| 667 | justify-content: space-between; | ||
| 668 | |||
| 669 | .img-exchange { | ||
| 670 | width: 23%; | ||
| 671 | min-width: 230px; | ||
| 672 | } | ||
| 673 | } | ||
| 674 | } | ||
| 675 | |||
| 676 | .footer { | ||
| 677 | height: 60px; | ||
| 678 | display: flex; | ||
| 679 | align-items: center; | ||
| 680 | justify-content: center; | ||
| 681 | background: #2A2B2C; | ||
| 682 | |||
| 683 | .desc { | ||
| 684 | font-size: 14px; | ||
| 685 | color: #FFFFFF; | ||
| 686 | font-weight: 200; | ||
| 687 | } | ||
| 688 | } | ||
| 689 | |||
| 690 | .footer-link { | ||
| 691 | height: 262px; | ||
| 692 | display: flex; | ||
| 693 | flex-direction: column; | ||
| 694 | align-items: flex-start; | ||
| 695 | background: #2A2B2C; | ||
| 696 | padding: 0px 90px; | ||
| 697 | |||
| 698 | .link-title { | ||
| 699 | margin: 28px 0px; | ||
| 700 | font-size: 16px; | ||
| 701 | color: #FFFFFF; | ||
| 702 | font-weight: 600; | ||
| 703 | } | ||
| 704 | |||
| 705 | .link-main { | ||
| 706 | display: flex; | ||
| 707 | flex-direction: row; | ||
| 708 | justify-content: space-between; | ||
| 709 | width: 100%; | ||
| 710 | |||
| 711 | .column { | ||
| 712 | display: flex; | ||
| 713 | flex-direction: column; | ||
| 714 | } | ||
| 715 | .link-detail { | ||
| 716 | font-size: 16px; | ||
| 717 | color: #C9C9C9; | ||
| 718 | line-height: 18px; | ||
| 719 | font-weight: 400; | ||
| 720 | line-height: 24px; | ||
| 721 | margin-bottom: 8px; | ||
| 722 | text-decoration: none; | ||
| 723 | cursor: pointer; | ||
| 724 | } | ||
| 725 | } | ||
| 726 | |||
| 727 | } | ||
| 728 | |||
| 729 | :deep(.el-overlay) { | ||
| 730 | background-color: transparent; | ||
| 731 | } | ||
| 732 | </style> |
| ... | @@ -4,14 +4,14 @@ | ... | @@ -4,14 +4,14 @@ |
| 4 | 4 | ||
| 5 | <script lang="ts" setup name="importFile"> | 5 | <script lang="ts" setup name="importFile"> |
| 6 | import { ref } from "vue"; | 6 | import { ref } from "vue"; |
| 7 | import { useRoute,useRouter } from "vue-router" | 7 | import { useRoute, useRouter } from "vue-router" |
| 8 | import useUserStore from "@/store/modules/user"; | 8 | import useUserStore from "@/store/modules/user"; |
| 9 | import { ElMessage, ElMessageBox } from "element-plus"; | 9 | import { ElMessage, ElMessageBox } from "element-plus"; |
| 10 | import Tabs from '@/components/Tabs/index.vue' | 10 | import Tabs from '@/components/Tabs/index.vue' |
| 11 | import Table from '@/components/Table/index.vue' | 11 | import Table from '@/components/Table/index.vue' |
| 12 | import Dialog from '@/components/Dialog/index.vue' | 12 | import Dialog from '@/components/Dialog/index.vue' |
| 13 | import useCatchStore from "@/store/modules/catch"; | 13 | import useCatchStore from "@/store/modules/catch"; |
| 14 | import { download, downFile,getDownloadUrl } from '@/utils/common' | 14 | import { download, downFile, getDownloadUrl } from '@/utils/common' |
| 15 | import { | 15 | import { |
| 16 | addImportData, | 16 | addImportData, |
| 17 | deleteImportData, | 17 | deleteImportData, |
| ... | @@ -45,15 +45,15 @@ const defaulttabs = [ | ... | @@ -45,15 +45,15 @@ const defaulttabs = [ |
| 45 | { label: '数据字典导入', name: 'dictionary' }, | 45 | { label: '数据字典导入', name: 'dictionary' }, |
| 46 | // { label: '质量模型导入', name: 'qualityModelGroup' }, | 46 | // { label: '质量模型导入', name: 'qualityModelGroup' }, |
| 47 | // { label: '质量规则导入', name: 'qualityRule' }, | 47 | // { label: '质量规则导入', name: 'qualityRule' }, |
| 48 | ] | 48 | ] |
| 49 | const importTabs = [ | 49 | const importTabs = [ |
| 50 | { label: '导入文件数据', name: 'importFile' }, | 50 | { label: '导入文件数据', name: 'importFile' }, |
| 51 | // { label: '质量模型导入', name: 'qualityModelGroup' }, | 51 | // { label: '质量模型导入', name: 'qualityModelGroup' }, |
| 52 | // { label: '质量规则导入', name: 'qualityRule' }, | 52 | // { label: '质量规则导入', name: 'qualityRule' }, |
| 53 | ] | 53 | ] |
| 54 | const tabsInfo = ref({ | 54 | const tabsInfo = ref({ |
| 55 | activeName: '', | 55 | activeName: '', |
| 56 | tabs: isfileImport?importTabs:defaulttabs | 56 | tabs: isfileImport ? importTabs : defaulttabs |
| 57 | }) | 57 | }) |
| 58 | 58 | ||
| 59 | const currTableData: any = ref<Object>({}); | 59 | const currTableData: any = ref<Object>({}); |
| ... | @@ -232,7 +232,7 @@ const tableBtnClick = async (scope, btn) => { | ... | @@ -232,7 +232,7 @@ const tableBtnClick = async (scope, btn) => { |
| 232 | if (res && !res.msg) { | 232 | if (res && !res.msg) { |
| 233 | let name = row.errorFilePath; | 233 | let name = row.errorFilePath; |
| 234 | var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : ''; | 234 | var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : ''; |
| 235 | let fileName = name ? name.substring(name.lastIndexOf('/') + 1) :'' | 235 | let fileName = name ? name.substring(name.lastIndexOf('/') + 1) : '' |
| 236 | download(res, fileName, fileSuffix); | 236 | download(res, fileName, fileSuffix); |
| 237 | } else { | 237 | } else { |
| 238 | res?.msg && ElMessage.error(res?.msg); | 238 | res?.msg && ElMessage.error(res?.msg); |
| ... | @@ -267,7 +267,7 @@ const batching = (type) => { | ... | @@ -267,7 +267,7 @@ const batching = (type) => { |
| 267 | return | 267 | return |
| 268 | } | 268 | } |
| 269 | open("此操作将永久删除, 是否继续?", "warning", true); | 269 | open("此操作将永久删除, 是否继续?", "warning", true); |
| 270 | } else if(type === 'importFile') { | 270 | } else if (type === 'importFile') { |
| 271 | if (isfileImport == '2' || isfileImport == '4') { | 271 | if (isfileImport == '2' || isfileImport == '4') { |
| 272 | dialogInfo.value.header.title = '导入数据' | 272 | dialogInfo.value.header.title = '导入数据' |
| 273 | dialogInfo.value.type = 'upload' | 273 | dialogInfo.value.type = 'upload' |
| ... | @@ -279,8 +279,8 @@ const batching = (type) => { | ... | @@ -279,8 +279,8 @@ const batching = (type) => { |
| 279 | dialogInfo.value.visible = true | 279 | dialogInfo.value.visible = true |
| 280 | } else { | 280 | } else { |
| 281 | router.push({ | 281 | router.push({ |
| 282 | name:"importData", | 282 | name: "importData", |
| 283 | query:route.query | 283 | query: route.query |
| 284 | }) | 284 | }) |
| 285 | } | 285 | } |
| 286 | } | 286 | } |
| ... | @@ -391,7 +391,7 @@ const importData = (info) => { | ... | @@ -391,7 +391,7 @@ const importData = (info) => { |
| 391 | uploadFiles.value.forEach((item: any, index: number) => { | 391 | uploadFiles.value.forEach((item: any, index: number) => { |
| 392 | params.append("uploadFile", item.raw); | 392 | params.append("uploadFile", item.raw); |
| 393 | }); | 393 | }); |
| 394 | paramUrl = `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-collect-task/meta-collect-import?staffGuid=${userData.staffGuid}&databaseNameZh=${info.databaseNameZh}&databaseNameEn=${info.databaseNameEn}&isCover=${info.isCover}` | 394 | paramUrl = `${import.meta.env.VITE_APP_CHECK_BASEURL}/meta-collect-task/meta-collect-import?staffGuid=${userData.staffGuid}&databaseNameZh=${info.databaseNameZh}&databaseNameEn=${info.databaseNameEn}&isCover=${info.isCover}` |
| 395 | } else { | 395 | } else { |
| 396 | uploadFiles.value.forEach((item: any, index: number) => { | 396 | uploadFiles.value.forEach((item: any, index: number) => { |
| 397 | params.append("file", item.raw); | 397 | params.append("file", item.raw); |
| ... | @@ -643,7 +643,7 @@ const setUploadInfo = () => { | ... | @@ -643,7 +643,7 @@ const setUploadInfo = () => { |
| 643 | 643 | ||
| 644 | onActivated(() => { | 644 | onActivated(() => { |
| 645 | uploadSetting.value = cacheStore.getCatch('uploadSetting') ?? {} | 645 | uploadSetting.value = cacheStore.getCatch('uploadSetting') ?? {} |
| 646 | if(isfileImport) { | 646 | if (isfileImport) { |
| 647 | tabsActiveName.value = 'importFile' | 647 | tabsActiveName.value = 'importFile' |
| 648 | } else { | 648 | } else { |
| 649 | tabsActiveName.value = uploadSetting.value?.type || 'standard' | 649 | tabsActiveName.value = uploadSetting.value?.type || 'standard' |
| ... | @@ -660,8 +660,10 @@ onActivated(() => { | ... | @@ -660,8 +660,10 @@ onActivated(() => { |
| 660 | <Tabs v-if="!isfileImport" :tabs-info="tabsInfo" @tabChange="tabsChange" /> | 660 | <Tabs v-if="!isfileImport" :tabs-info="tabsInfo" @tabChange="tabsChange" /> |
| 661 | <div class="table_tool_wrap"> | 661 | <div class="table_tool_wrap"> |
| 662 | <div class="tools_btns"> | 662 | <div class="tools_btns"> |
| 663 | <el-button type="primary" @click="batching('import')" v-if="tabsActiveName !== 'importFile'" v-preReClick>批量导入</el-button> | 663 | <el-button type="primary" @click="batching('import')" v-if="tabsActiveName !== 'importFile'" |
| 664 | <el-button type="primary" @click="batching('importFile')" v-if="tabsActiveName == 'importFile'" v-preReClick>文件导入</el-button> | 664 | v-preReClick>批量导入</el-button> |
| 665 | <el-button type="primary" @click="batching('importFile')" v-if="tabsActiveName == 'importFile'" | ||
| 666 | v-preReClick>文件导入</el-button> | ||
| 665 | <el-button @click="batching('delete')" v-preReClick>批量删除</el-button> | 667 | <el-button @click="batching('delete')" v-preReClick>批量删除</el-button> |
| 666 | <el-button @click="getFirstPageData" v-preReClick>刷新结果</el-button> | 668 | <el-button @click="getFirstPageData" v-preReClick>刷新结果</el-button> |
| 667 | </div> | 669 | </div> | ... | ... |
-
Please register or sign in to post a comment