Commit 0aaeb735 authored by chenshouchao's avatar chenshouchao

Merge branch 'feat-20220608-projectdata' into 'release'

Feat 20220608 projectdata

See merge request sunyihao/bkunyun!33
parents a4f71f04 62c3eeff
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAtIx3AYKqrzXgRJJHrUwgNM5vdKOgCHfSzLqZVxU5MpONzD+Y
pbIA9Ykwo9tNSFY6jYC/1Hg5Kamj24mCDOuRr9UX4/GCB+ypV4jTVBLvueNghfd8
cYdAQEC4/Anb4w1Xe5NB5jKTWaC7Usi4kOfaXxtI1mG6uB2oSc3cbPQydT7qPjz8
/k8Ltw0TuXYmTtrqyyCt22f203+vsvJJJ/zCn1wjyvfF/hjcbk+qsClYcTe/YYD2
4ajyZqrMtYGKufHC0gZKvChpVqcRzBktZat9dthO+6m769Y57juG7B4iSCKSE5ef
0IKxKhLITIqII0rHumvTFetaC3jrBtRs2A3pkwIDAQABAoIBAD05SputAxMyClBG
aF7oKx2tCRd86uYkN8vr1Na2YDR528IwqKM7dt7MPD28Pnsynl1glOxILl4l4+Ys
vXiDI16EPLszqLvmMVB5GexvFXKsG42iLEVVL2D6caAp+bIHUqyZdWXJrbTdb9g1
L30X2jGZD3x/HHGVwPzx/XbG4htmfem0sNjfXUo65GJQ5rc7SSRxPeHKVYpEWvGn
7TNjiOFixQI+iC73V1+XkgX/GBzJYVeupFqaHAVxT36DaHSWx10tGUQ8Ia02BgPn
I9ZZyADkMsdrRiqxGoz1bDTZPaZKm2TL7HAtE8GCxq002KKaLfDttL33mtsSG5jY
6FsJaGkCgYEA3Y0kVyX+g6caKaTRC6YGNMxUSWTpY6zmpUPKvoq2z3ZvsF8mTsYD
LdcHiEyyAfBRtULew2ddgTacBHD/Gp91MXRlFAqfXMFVpU1yJkncOw0PlRvF3c9a
qiRQypf7DYxsxGSlxTjB0+3Fw3nEbFwQHCdS6dSoHBpjnir24EAbajkCgYEA0J82
GK4299y1ciUInoxyfiQjwdIrKNN8rAWGDDnu+0O+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/x922G4CMmY63AS39dxoNcbuIPAgAAAXnpY0BOAAAEAwBIMEYCIQDb
UcpTWE+UGxnrWqA1/h28DvhakqEzQqNr1Pf5P31AxwIhAPdmmjrRAvGiqW3RBJVw
RvxmpLGvc12445pw+Xj81T7dAHYAQcjKsd8iRkoQxqE6CUKHXk4xixsD6+tLx2jw
kGKWBvYAAAF56WNAFQAABAMARzBFAiEA+AH8S2VvEdIjgrodGEDiKlTidyKigM4a
WbkEwEWNfLUCICv0w3apBeY8PU5s6SgJEX7WIU/ZPl9QxIjEcUuktORcMA0GCSqG
SIb3DQEBCwUAA4IBAQDNBnMLKBijkBxwbsByUNgVeAzZFsX30ew5fe9ngLngnSa3
LgwRl7tdrG8yBA3rATAu6+WxriQ8/vvWmjqIKAOnvy7/wSEoh+1vk4KAgg8EVghg
xgT0gjeRRw40oDv4wDsWvsOsCMsCZ4r0gS4VvVfywWsnuGWv65qEuHYmrp1ozbvE
Q/8PAJOkJbTnh89ix60khA6GCI66nC4KEgKvR9BGUvzVwiERDlDho8N7jyEOrJOn
LdOdnhiNajDMFkwhjJUY6dYixTM+BwJbR1n2/NoI9Ksv6hWT5chNVnHkPWfr8A+m
bwEc3WpLF3ZO5zx2kuSqVmJ/IHCTvdMhVr3XAHp3
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIFUTCCBDmgAwIBAgIQB5g2A63jmQghnKAMJ7yKbDANBgkqhkiG9w0BAQsFADBh
......
This diff is collapsed.
......@@ -32,6 +32,7 @@
"camelcase": "^6.2.1",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"classnames": "^2.3.1",
"crypto-js": "^4.1.1",
"css-loader": "^6.5.1",
"css-minimizer-webpack-plugin": "^3.2.0",
"dotenv": "^10.0.0",
......@@ -65,6 +66,7 @@
"react-app-polyfill": "^3.0.0",
"react-dev-utils": "^12.0.1",
"react-dom": "^18.1.0",
"react-dropzone": "^14.2.1",
"react-refresh": "^0.11.0",
"react-router-dom": "^6.3.0",
"resolve": "^1.20.0",
......@@ -81,7 +83,8 @@
"webpack": "^5.64.4",
"webpack-dev-server": "^4.6.0",
"webpack-manifest-plugin": "^4.0.2",
"workbox-webpack-plugin": "^6.4.1"
"workbox-webpack-plugin": "^6.4.1",
"tus-js-client": "2.1.1"
},
"scripts": {
"start:master": "set \"REACT_APP_ENV=master\" && npm start",
......@@ -173,6 +176,7 @@
]
},
"devDependencies": {
"@types/crypto-js": "^4.1.1",
"@types/mockjs": "^1.0.6"
}
}
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-13 09:56:57
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-13 09:59:29
* @FilePath: /bkunyun/src/api/api_manager.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { BACKEND_API_URI_PREFIX } from "./api_prefix";
const RESTAPI = {
......@@ -9,18 +17,16 @@ const RESTAPI = {
API_PROJECT_DELETE: `${BACKEND_API_URI_PREFIX}/cpp/project/delete`, //删除项目
API_PROJECT_GET: `${BACKEND_API_URI_PREFIX}/cpp/project/get`, //获取项目信息
API_CPCE_HPCZONE: `${BACKEND_API_URI_PREFIX}/cpp/cpce/hpczone`, //获取计算区列表
API_USER_PERMISSION_LIST: `${BACKEND_API_URI_PREFIX}/uaa/routes/privilege/list`,//获取用户包含的权限列表
API_DATA_FILETOKEN: `${BACKEND_API_URI_PREFIX}/cpp/data/filetoken`, //获取项目目录的filetoken
API_DATA_FIND: `${BACKEND_API_URI_PREFIX}/cpp/data/find`, //查询某路径下数据集
API_DATA_SEARCH: `${BACKEND_API_URI_PREFIX}/cpp/data/search`, //搜索项目中某路径下的数据集
API_DATA_MOVE: `${BACKEND_API_URI_PREFIX}/cpp/data/move`, //移动到
API_DATA_DEL: `${BACKEND_API_URI_PREFIX}/cpp/data/del`, //删除项目中的数据集
API_USER_PERMISSION_LIST: `${BACKEND_API_URI_PREFIX}/uaa/routes/privilege/list`, //获取用户包含的权限列表
API_WORKBENCH_TEMPLATE_LIST: `${BACKEND_API_URI_PREFIX}/cpp/workbench/project/workflowspec`,//查询项目下工作流模板列表
API_WORKBENCH_DELETE_TEMPLATE: `${BACKEND_API_URI_PREFIX}/cpp/workbench/project/workflowspec`,//项目管理员-删除工作流模板
API_WORKBENCH_ADD_TEMPLATE_LIST: `${BACKEND_API_URI_PREFIX}/cpp/workbench/product/workflowspec`,//项目管理员-添加工作流模板-模板列表
API_WORKBENCH_ADD_TEMPLATE: `${BACKEND_API_URI_PREFIX}/cpp/workbench/project/workflowspec`,//项目管理员-添加工作流模板-提交
}
export default RESTAPI;
......@@ -2,47 +2,39 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:17:48
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-10 11:16:16
* @LastEditTime: 2022-06-13 09:59:45
* @FilePath: /bkunyun/src/api/api_prefix.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// const AWSPREFIX = "/0xaws";
// const PRIVATIZATIONPREFIX = "/fileserver"
// const PRIVATIZATIONPREFIX = "/fileserver";
// const PRIVATIZATION_API_URI_PREFIX = process.env.NODE_ENV === 'development' ? "http://123.57.131.31" : "";
let BACKEND_API_URI_PREFIX = "";
console.log('process.env.REACT_APP_ENV: 11313', process.env.REACT_APP_ENV)
console.log("process.env.REACT_APP_ENV: ", process.env.REACT_APP_ENV);
switch (process.env.REACT_APP_ENV) {
case "dev-cn":
BACKEND_API_URI_PREFIX = "http://47.57.4.97";
break;
case "dev-en":
BACKEND_API_URI_PREFIX = "http://47.75.109.159";
break;
case "release-cn":
BACKEND_API_URI_PREFIX = "http://47.75.104.171";
break;
case "release-en":
BACKEND_API_URI_PREFIX = "http://47.57.235.86";
break;
case "global":
BACKEND_API_URI_PREFIX = "https://www.cloudam.io";
break;
default:
if (['www.bkunyun.com'].includes(window.location.host)) {
BACKEND_API_URI_PREFIX = "https://www.bkunyun.com";
} else {
BACKEND_API_URI_PREFIX = "http://47.57.4.97";
}
break;
case "dev-cn":
BACKEND_API_URI_PREFIX = "http://47.57.4.97";
break;
case "dev-en":
BACKEND_API_URI_PREFIX = "http://47.75.109.159";
break;
case "release-cn":
BACKEND_API_URI_PREFIX = "http://47.75.104.171";
break;
case "release-en":
BACKEND_API_URI_PREFIX = "http://47.57.235.86";
break;
case "global":
BACKEND_API_URI_PREFIX = "https://www.cloudam.io";
break;
default:
if (["www.bkunyun.com"].includes(window.location.host)) {
BACKEND_API_URI_PREFIX = "https://www.bkunyun.com";
} else {
BACKEND_API_URI_PREFIX = "http://47.57.4.97";
}
break;
}
export { BACKEND_API_URI_PREFIX } // 导出放在11行后面,避免发布时被替换
export { BACKEND_API_URI_PREFIX }; // 导出放在11行后面,避免发布时被替换
import axios from "axios";
// import Api from '../../../../commons/utils/api_manager'
// import CloudEStore from '../stores/CloudEStore'
// import { Actions, Constants } from '../../../../commons/utils/constants'
// import MessageUtil from '../../../../commons/utils/MessageUtil'
// import ApiUtils from '../../../../commons/utils/ApiUtils'
import { APIOPTION, urlToken, ZONEID } from "./raysyncApi";
// import UserStore from '../../../../console/common/stores/UserStore'
import { ApiUtils } from "./utils";
import Base64 from "crypto-js/enc-base64";
import Utf8 from "crypto-js/enc-utf8";
import { getLoaclStorageOfKey } from "./utils";
let headers: any = {
"Content-Type": "application/json",
};
class CloudEController {
// 新建文件夹
static JobFileNewFolder(url: any, filetoken: string, projectId: string) {
if (ApiUtils.getAuthorizationHeaders(headers)) {
url = url += urlToken(filetoken, projectId);
headers["Content-Type"] = "multipart/form-data";
return axios.post(
APIOPTION() + "/createdir" + url,
{},
{
headers: headers,
}
);
}
}
//文件 删除
static JobOutFileDel(urls: any, filetoken: string, projectId: string) {
if (ApiUtils.getAuthorizationHeaders(headers)) {
headers["Cache-Control"] = "no-cache";
headers["delfilepath"] = Base64.stringify(Utf8.parse(urls));
let url = "";
if (getLoaclStorageOfKey("userinfo")) {
url += urlToken(filetoken, projectId);
}
return axios.get(APIOPTION() + "/delete/" + url, {
headers: headers,
});
// .then(function (response) {
// console.log(response);
// })
// .catch(function (error) {
// console.log(error);
// });
}
}
// 文件树
static JobOutFileDirtree(
url: any,
filetoken: string,
projectId: string,
showHide = false,
items?: any
) {
if (ApiUtils.getAuthorizationHeaders(headers)) {
headers["Cache-Control"] = "no-cache";
if (getLoaclStorageOfKey("userinfo")) {
url += urlToken(filetoken, projectId);
}
return axios.get(
APIOPTION() + "/dirtree" + url + "&showhidden=" + showHide,
{
headers: headers,
}
);
}
}
// 文件列表
static JobOutFileList(
url: any,
filetoken: string,
projectId: string,
showHide = false,
items?: any
) {
if (ApiUtils.getAuthorizationHeaders(headers)) {
headers["Cache-Control"] = "no-cache";
// headers['parentName'] = ''
if (getLoaclStorageOfKey("userinfo")) {
url += urlToken(filetoken, projectId);
}
return axios.get(
APIOPTION() + "/list" + url + "&showhidden=" + showHide,
{
headers: headers,
}
);
}
}
// 全局搜索 文件名
static JobSearchFileList(
url: any,
base: any,
filetoken: string,
projectId: string,
showHide = false
) {
if (ApiUtils.getAuthorizationHeaders(headers)) {
headers["Cache-Control"] = "no-cache";
if (getLoaclStorageOfKey("userinfo")) {
url = urlToken(filetoken, projectId) + "&q=" + url;
}
return axios
.get(APIOPTION() + "/search" + base + url + "&showhidden=" + showHide, {
headers: headers,
})
}
}
// 文件移动
// static JobOutFileListMove(url: any, filetoken: string, projectId: string) {
// if (ApiUtils.getAuthorizationHeaders(headers)) {
// headers["Cache-Control"] = "no-cache";
// if (getLoaclStorageOfKey("userinfo")) {
// url += urlToken(filetoken, projectId);
// }
// return axios.get(APIOPTION() + "/download" + url, {
// headers: headers,
// });
// }
// }
// 文件移动
static JobFileMove(
url: any,
original_filepath: any,
value: any,
filetoken: string,
projectId: string
) {
if (ApiUtils.getAuthorizationHeaders(headers)) {
url = url += urlToken(filetoken, projectId);
headers["Content-Type"] = "multipart/form-data";
headers["originalfilepath"] = encodeURIComponent(original_filepath);
let param = new FormData();
param.append("", value);
return axios.post(APIOPTION() + "/rename" + url, param, {
headers: headers,
});
}
}
// 文件批量移动
static JobFileBatchMove(
url: any,
original_filepath: Array<string>,
value: any,
filetoken: string,
projectId: string
) {
if (ApiUtils.getAuthorizationHeaders(headers)) {
url = url + urlToken(filetoken, projectId) + "&batch=true";
headers["Content-Type"] = "multipart/form-data";
// Base64.stringify(Utf8.parse(urls))
// headers["originalfilepath"] = encodeURIComponent(
// original_filepath.join(" ")
// );
headers["originalfilepath"] = Base64.stringify(
Utf8.parse(original_filepath.join(" "))
);
let param = new FormData();
param.append("", value);
return axios.post(APIOPTION() + "/rename" + url, param, {
headers: headers,
});
}
}
}
export default CloudEController;
// const API = "https://fileserver.cloudam.cn:8091"
// const APIOPTION = "https://fileserver.cloudam.cn"
// const APIPORT = "39.105.230.38"
import { getLoaclStorageOfKey } from "./utils";
// const raysyncAddr = {
// bandwidth: null
// capacity: 10485760
// enableLargeFileTransfer: true
// fileServerEndPoint: "https://fileserver.cloudam.cn"
// fileSystemType: "standard"
// jobLogServerEndPoint: "https://fileserver.cloudam.cn:6677"
// privateIp: "10.8.2.67"
// protocolType: "NFS"
// publicMountDir: "/public"
// publicMountUrl: "132594ad6e-atf93.cn-beijing.nas.aliyuncs.com"
// ramUserId: "61261f8a2a2aa4d72f752c3c"
// smbMountUrl: null
// srcAddr: "fileserver.cloudam.cn"
// srcIp: "47.94.198.50"
// sshServerEndPoint: "https://fileserver.cloudam.cn:8888"
// storageType: "Capacity"
// token: null
// userMountDir: "/public/data/"
// userMountUrl: "132594ad6e-uop2.cn-beijing.nas.aliyuncs.com"
// vncServerEndPoint: "https://fileserver.cloudam.cn:9090"
// zoneId: "cn-beijing-h"
// }
const API = function () {
const raysyncAddr = getLoaclStorageOfKey("raysyncAddr");
return raysyncAddr.srcAddr ? `https://${raysyncAddr.srcAddr}:8091` : "";
};
// 文件服务器指向
const APIOPTION = function () {
// todo isPrivatization
let fileServerEndPoint = localStorage.getItem("fileServerEndPoint");
if (fileServerEndPoint) {
return fileServerEndPoint;
} else {
// 云超算逻辑
const raysyncAddr = getLoaclStorageOfKey("raysyncAddr");
return raysyncAddr.fileServerEndPoint || "";
}
};
// api端口号
const APIPORT = function () {
const raysyncAddr = getLoaclStorageOfKey("raysyncAddr");
return raysyncAddr.srcIp || "";
};
// const currentRegion = {
// cloudProvider: "ALIYUN"
// description: "本计算区有丰富的CPU资源,并提供部分GPU资源,可以满足大部分计算作业需求。"
// enabled: true
// id: "CE-Z1"
// initialized: true
// location: "CLOUD"
// name: "通用计算区"
// primary: true
// storageConfig: {srcAddr: "fileserver.cloudam.cn", srcIp: "47.94.198.50", privateIp: "10.8.2.67",…}
// bandwidth: null
// capacity: 10485760
// enableLargeFileTransfer: true
// fileServerEndPoint: "https://fileserver.cloudam.cn"
// fileSystemType: "standard"
// jobLogServerEndPoint: "https://fileserver.cloudam.cn:6677"
// privateIp: "10.8.2.67"
// protocolType: "NFS"
// publicMountDir: "/public"
// publicMountUrl: "132594ad6e-atf93.cn-beijing.nas.aliyuncs.com"
// ramUserId: "61261f8a2a2aa4d72f752c3c"
// smbMountUrl: null
// srcAddr: "fileserver.cloudam.cn"
// srcIp: "47.94.198.50"
// sshServerEndPoint: "https://fileserver.cloudam.cn:8888"
// storageType: "Capacity"
// token: null
// userMountDir: "/public/data/"
// userMountUrl: "132594ad6e-uop2.cn-beijing.nas.aliyuncs.com"
// vncServerEndPoint: "https://fileserver.cloudam.cn:9090"
// zoneId: "cn-beijing-h"
// }
// 当前计算区
let currentRegion = localStorage.getItem("current-region");
let currentRegionJson = currentRegion && JSON.parse(currentRegion);
let user = getLoaclStorageOfKey("userinfo");
// 文件路径
const FILEPATH =
currentRegionJson &&
currentRegionJson.location &&
currentRegionJson.location === "ON_PREMISE" &&
localStorage.getItem("userinfo")
? `/home/${user.name}`
: "/home/cloudam";
const FILEPATH_SHARE = "/share";
// 工作日志
const APIJOBLOGPOINT = function () {
const raysyncAddr = getLoaclStorageOfKey("raysyncAddr");
return raysyncAddr.jobLogServerEndPoint || "";
};
// 区id
const ZONEID = (params: string) => {
let currentRegion = getLoaclStorageOfKey("current-region");
return currentRegion[params || "id"] || "";
};
const urlToken = (filetoken: string, projectId: string) => {
let token = getLoaclStorageOfKey("token_key").access_token;
return `?username=${projectId}&token=${token}&filetoken=${encodeURIComponent(
filetoken
)}&share=false&project=true`;
// let json = getLoaclStorageOfKey("current-region");
// const userInfo = getLoaclStorageOfKey("userinfo");
// if (json["location"] && json["location"] === "ON_PREMISE") {
// return `?username=${
// userInfo["name"]
// }&token=${token}&filetoken=${encodeURIComponent(filetoken)}&share=false`; // 之前的filetoken是: userInfo["shareFileAccessToken"]
// }
// if (root && root === "home") {
// return `?username=${
// userInfo["homeDirectoryMountPoint"]
// }&token=${token}&filetoken=${encodeURIComponent(filetoken)}&share=false`;
// }
// // 是否共有文件系统
// if (
// localStorage.getItem("isShareFileSystem") &&
// localStorage.getItem("isShareFileSystem") === "true"
// ) {
// return `?username=${
// userInfo["shareDirectoryMountPoint"]
// }&token=${token}&filetoken=${encodeURIComponent(filetoken)}&share=true`;
// } else {
// return `?username=${
// userInfo["homeDirectoryMountPoint"]
// }&token=${token}&filetoken=${encodeURIComponent(filetoken)}&share=false`;
// }
};
const getUuid = () => {
const userInfo = getLoaclStorageOfKey("userinfo");
// 是否共有文件系统
if (
localStorage.getItem("isShareFileSystem") &&
localStorage.getItem("isShareFileSystem") === "true"
) {
return userInfo["shareDirectoryMountPoint"];
} else {
return userInfo["homeDirectoryMountPoint"];
}
};
const USERNAME = () => {
return getLoaclStorageOfKey("userinfo").name;
};
// 加密传输
const encryptTransfer = () => {
const userInfo = getLoaclStorageOfKey("userinfo");
if (userInfo) {
let encryptTransfer = userInfo.encryptTransfer;
if (encryptTransfer) {
return true;
}
return false;
}
return false;
};
const getType = function () {
if (
localStorage.getItem("isShareFileSystem") &&
localStorage.getItem("isShareFileSystem") === "true"
) {
return "share";
} else {
return "data";
}
};
export {
API,
APIPORT,
FILEPATH,
FILEPATH_SHARE,
APIOPTION,
APIJOBLOGPOINT,
ZONEID,
urlToken,
USERNAME,
getUuid,
encryptTransfer,
getType,
};
// import { Constants, MESSAGETIP } from "./constants";
export const getLoaclStorageOfKey = (key: string) => {
return JSON.parse(localStorage.getItem(key) || "{}");
};
export const isEn = () => {
return (
(localStorage.getItem("language") &&
localStorage.getItem("language") === "en") ||
[
"www.cloudam.se",
"47.75.109.159",
"47.57.235.86",
"www.cloudam.io",
].includes(window.location.host)
);
};
export class ApiUtils {
static getAuthorizationHeaders(headers: any) {
let token_key = getLoaclStorageOfKey("token_key");
if (!token_key) {
if (
window.location.pathname.indexOf("/login-page") > -1 ||
window.location.pathname.indexOf("/pages/Internlogin-page") > -1
) {
return false;
} else {
setTimeout(() => {
// localStorage.removeItem("temporary_token_key");
// localStorage.removeItem("token_key");
if (
window.location.href &&
!window.location.href.includes("/login-page") &&
!window.location.href.includes("/pages/Internlogin-page")
)
isEn()
? (window.location.href = "/v2/pages/Internlogin-page")
: (window.location.href = "/v2/pages/login-page");
}, 4000);
}
return false;
}
let token = token_key.access_token;
headers["Authorization"] = "Bearer " + token;
headers["Accept-Language"] =
localStorage.getItem("language") === "en"
? "en-US,en;q=0.5"
: "zh-CN,zh,q=0.5";
return true;
}
// 临时token
static getTemporaryAuthorizationHeaders(obj: any, headers: any, action: any) {
if (!localStorage.getItem("temporary_token_key")) {
obj.setError({
errorCode: "x0001",
message: "临时登陆凭证过期或失效,请重新连接云账号",
});
obj.emitChange(action, false);
return false;
}
headers["Authorization"] =
"Bearer " + getLoaclStorageOfKey("temporary_token_key").access_token;
headers["Accept-Language"] =
localStorage.getItem("language") === "en"
? "en-US,en;q=0.5"
: "zh-CN,zh,q=0.5";
return true;
}
static poll(fn: any, timeout: number, interval: number) {
var endTime = Number(new Date()) + (timeout || 2000);
interval = interval || 100;
let hasCanceled = false;
var checkCondition = function (resolve: any, reject: any) {
if (hasCanceled) {
reject({ isCanceled: true, type: "1" }); //type ===1 用户手动取消
return;
}
// If the condition is met, we're done!
var result = fn();
if (result) {
resolve(result);
}
// If the condition isn't met but the timeout hasn't elapsed, go again
else if (Number(new Date()) < endTime) {
setTimeout(checkCondition, interval, resolve, reject);
}
// Didn't match and too much time, reject!
else {
reject({ isCanceled: true, type: "2" });
}
};
const wrappedPromise = new Promise(checkCondition);
return {
promise: wrappedPromise,
cancel() {
hasCanceled = true;
},
};
}
}
......@@ -87,6 +87,86 @@ const deleteProject = (params: deleteProjectParams) => {
});
};
type getDataFileTokenParams = {
id: string;
};
// 获取项目目录的filetoken
const getDataFileToken = (params: getDataFileTokenParams) => {
return request({
url: Api.API_DATA_FILETOKEN,
method: "get",
params,
});
};
type getDataFindParams = {
projectId: string;
path: string;
};
// 查询某路径下数据集
const getDataFind = (params: getDataFindParams) => {
return request({
url: Api.API_DATA_FIND,
method: "get",
params,
});
};
type getDataFileSearchParams = {
projectId: string;
name: string;
path?: string;
};
// 搜索项目中某路径下的数据集
const getDataFileSearch = (params: getDataFileSearchParams) => {
return request({
url: Api.API_DATA_SEARCH,
method: "get",
params,
});
};
type getDataFileMoveParams = {
projectId: string;
names: string;
spath?: string; // 原路径
dpath?: string; // 目标路径
};
// Content-Type application/x-www-form-urlencoded
// 移动到
const getDataFileMove = (params: getDataFileMoveParams) => {
return request({
url: Api.API_DATA_MOVE,
method: "put",
data: params,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
};
type getDataFileDelParams = {
projectId: string;
names: string;
path?: string;
};
// Content-Type application/x-www-form-urlencoded
// 删除项目中的数据集
const getDataFileDel = (params: getDataFileDelParams) => {
return request({
url: Api.API_DATA_DEL,
method: "delete",
params,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
};
export {
current,
menu,
......@@ -96,4 +176,9 @@ export {
getProject,
updateProject,
deleteProject,
getDataFileToken,
getDataFind,
getDataFileSearch,
getDataFileMove,
getDataFileDel,
};
<?xml version="1.0" encoding="UTF-8"?>
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>编组 6备份 5</title>
<g id="上线UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="项目数据-移动文件" transform="translate(-554.000000, -309.000000)">
<g id="编组-6备份-5" transform="translate(554.000000, 309.000000)">
<rect id="矩形" x="0" y="0" width="22" height="22"></rect>
<g id="编组-25" transform="translate(11.000000, 11.000000) scale(-1, 1) rotate(-90.000000) translate(-11.000000, -11.000000) translate(0.163690, 3.797619)">
<path d="M2.25848043,5.99517195 L2.25848043,1.1 C2.25848043,0.492486775 2.7509672,1.8140083e-13 3.35848043,1.81289231e-13 L9.5197711,1.81289231e-13 C9.81180738,1.8145763e-13 10.0918574,0.116128852 10.2981967,0.32279113 L11.1489864,1.17491279 C11.3553257,1.38157507 11.6353757,1.49770392 11.927412,1.49770392 L16.6934589,1.49770392 C17.3009722,1.49770392 17.7934589,1.99019069 17.7934589,2.59770392 L17.7934589,5.74540783 L17.7934589,5.74540783 L9.97591007,5.58202826 L2.25848043,5.99517195 Z" id="路径-7" fill="#F09C3C"></path>
<path d="M1.33057336,4.82874117 L20.3420457,4.82874117 C20.9495589,4.82874117 21.4420457,5.32122794 21.4420457,5.92874117 C21.4420457,5.99815212 21.4354759,6.06740728 21.4224242,6.1355801 L20.0102818,13.5116008 C19.9110449,14.0299435 19.45766,14.4047619 18.9299033,14.4047619 L2.74271574,14.4047619 C2.21495905,14.4047619 1.76157419,14.0299435 1.66233726,13.5116008 L0.250194881,6.1355801 C0.135960895,5.53890354 0.527057873,4.96259668 1.12373443,4.84836269 C1.19190725,4.83531097 1.2611624,4.82874117 1.33057336,4.82874117 Z" id="矩形" fill="#FFC133"></path>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>编组 4备份 3</title>
<g id="上线UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="项目数据-数据集" transform="translate(-300.000000, -730.000000)">
<g id="编组-5" transform="translate(244.000000, 250.000000)">
<g id="编组-4备份-3" transform="translate(56.000000, 480.000000)">
<g id="矩形-2">
<rect id="矩形" x="0" y="0" width="22" height="22"></rect>
</g>
<path d="M18.14,3 L3.86,3 C3.385,3 3,3.3852 3,3.86 L3,6.54 C3,7.015 3.385,7.4 3.86,7.4 L18.14,7.4 C18.615,7.4 19,7.015 19,6.54 L19,3.86 C19,3.3852 18.615,3 18.14,3 Z M17.28,5.68 L9.28,5.68 C9.298916,5.6446 9.30956773,5.6036 9.30956773,5.56 L9.30956773,4.84 C9.30956773,4.7964 9.298916,4.7554 9.28,4.72 L17.28,4.72 L17.28,5.68 Z M18.14,8.8 L3.86,8.8 C3.385,8.8 3,9.1852 3,9.66 L3,12.34 C3,12.815 3.385,13.2 3.86,13.2 L18.14,13.2 C18.615,13.2 19,12.815 19,12.34 L19,9.66 C19,9.1852 18.615,8.8 18.14,8.8 Z M17.28,11.48 L9.28,11.48 C9.298916,11.4446 9.30956773,11.4036 9.30956773,11.36 L9.30956773,10.64 C9.30956773,10.5964 9.298916,10.5554 9.28,10.52 L17.28,10.52 L17.28,11.48 Z M18.14,14.6 L3.86,14.6 C3.385,14.6 3,14.9852 3,15.46 L3,18.14 C3,18.615 3.385,19 3.86,19 L18.14,19 C18.615,19 19,18.615 19,18.14 L19,15.46 C19,14.9852 18.615,14.6 18.14,14.6 Z M17.28,17.28 L9.28,17.28 C9.298916,17.2446 9.30956773,17.2036 9.30956773,17.16 L9.30956773,16.44 C9.30956773,16.3964 9.298916,16.3554 9.28,16.32 L17.28,16.32 L17.28,17.28 Z" id="形状" fill="#D1D6DE" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>编组 7备份 10</title>
<g id="上线UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="项目数据-多选状态" transform="translate(-300.000000, -622.000000)">
<g id="编组-12" transform="translate(244.000000, 250.000000)">
<g id="编组-7" transform="translate(0.000000, 96.000000)">
<g id="编组-8" transform="translate(56.000000, 12.000000)">
<g id="编组-7备份-10" transform="translate(0.000000, 264.000000)">
<rect id="矩形" x="0" y="0" width="22" height="22"></rect>
<g id="编组-6" transform="translate(3.928571, 2.357143)">
<path d="M1.2,0 L9.49020093,0 L9.49020093,0 L14.1428571,4.65265622 L14.1428571,16.0857143 C14.1428571,16.748456 13.6055988,17.2857143 12.9428571,17.2857143 L1.2,17.2857143 C0.5372583,17.2857143 -1.40882155e-16,16.748456 0,16.0857143 L0,1.2 C-8.11624501e-17,0.5372583 0.5372583,1.21743675e-16 1.2,0 Z" id="矩形" fill="#D1D6DE"></path>
<g id="编组-4" transform="translate(3.535714, 7.142857)" stroke="#FFFFFF" stroke-width="1.2">
<line x1="7.85086282e-15" y1="6.39285714" x2="7.07142857" y2="6.39285714" id="路径-15备份-2"></line>
<line x1="7.85086282e-15" y1="3.39285714" x2="7.07142857" y2="3.39285714" id="路径-15备份-3"></line>
<line x1="7.85086282e-15" y1="0.392857143" x2="7.07142857" y2="0.392857143" id="路径-15备份-4"></line>
</g>
<path d="M9.49020093,0 L14.1428571,4.65265622 L10.6902009,4.65265622 C10.0274592,4.65265622 9.49020093,4.11539792 9.49020093,3.45265622 L9.49020093,0 L9.49020093,0 Z" id="路径-9" fill="#EBEDF0"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>编组 6备份 4</title>
<g id="上线UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="项目数据—传输列表(切换线路)" transform="translate(-300.000000, -460.000000)">
<g id="编组-27" transform="translate(244.000000, 250.000000)">
<g id="编组-7" transform="translate(0.000000, 96.000000)">
<g id="编组-8" transform="translate(56.000000, 12.000000)">
<g id="编组-25" transform="translate(0.000000, 102.000000)">
<rect id="矩形" x="0" y="0" width="22" height="22"></rect>
<path d="M1.64236826,7.68304472 L1.64236826,4.34285714 C1.64236826,3.68011544 2.17962656,3.14285714 2.84236826,3.14285714 L9.56377626,3.14285714 C9.88236129,3.14285714 10.1878704,3.26954316 10.4129678,3.49499292 L11.3411021,4.42458018 C11.5661995,4.65002994 11.8717086,4.77671596 12.1902936,4.77671596 L17.3896175,4.77671596 C18.0523592,4.77671596 18.5896175,5.31397426 18.5896175,5.97671596 L18.5896175,6.41057478 L18.5896175,6.41057478 L10.0613824,9.23234252 L1.64236826,7.68304472 Z" id="路径-7" fill="#F09C3C"></path>
<rect id="矩形" fill="#FFC133" x="1.17857143" y="6.41057478" width="19.6428571" height="12.4465681" rx="1.2"></rect>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="67px" height="57px" viewBox="0 0 67 57" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>img_no data</title>
<defs>
<polygon id="path-1" points="0 0 65.7607024 0 65.7607024 46.987 0 46.987"></polygon>
<linearGradient x1="50%" y1="20.7300519%" x2="50%" y2="102.568465%" id="linearGradient-3">
<stop stop-color="#E3F0FF" offset="0%"></stop>
<stop stop-color="#8CBAFF" offset="100%"></stop>
</linearGradient>
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-4">
<stop stop-color="#CEE2F9" offset="0%"></stop>
<stop stop-color="#9FC0F0" offset="100%"></stop>
</linearGradient>
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-5">
<stop stop-color="#DBEAFC" offset="0%"></stop>
<stop stop-color="#8AAFE6" offset="100%"></stop>
</linearGradient>
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-6">
<stop stop-color="#DBEAFC" offset="0%"></stop>
<stop stop-color="#8AAFE6" offset="100%"></stop>
</linearGradient>
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-7">
<stop stop-color="#F2F7FF" offset="0%"></stop>
<stop stop-color="#E1EDFF" offset="100%"></stop>
</linearGradient>
<path d="M17.9695,0 C18.1602024,0 18.3370714,0.101 18.435881,0.267 L18.435881,0.267 L22.5265952,7.169 C22.6254048,7.335 22.8022738,7.436 22.9929762,7.436 L22.9929762,7.436 L42.7677262,7.436 C42.9584286,7.436 43.1352976,7.335 43.233119,7.169 L43.233119,7.169 L47.3258095,0.267 C47.423631,0.101 47.6005,0 47.7912024,0 L47.7912024,0 L65.21725,0 C65.517631,0 65.7607024,0.246 65.7607024,0.55 L65.7607024,0.55 L65.7607024,18.864 C65.7607024,19.534 65.2231786,20.078 64.5611548,20.078 L64.5611548,20.078 L1.19855952,20.078 C0.536535714,20.078 0,19.534 0,18.864 L0,18.864 L0,0.55 C0,0.246 0.243071429,0 0.542464286,0 L0.542464286,0 Z M41.7340798,12.3811 L24.0274131,12.3811 C23.5254607,12.3811 23.1193536,12.7931 23.1193536,13.3001 C23.1193536,13.8081 23.5254607,14.2191 24.0274131,14.2191 L24.0274131,14.2191 L41.7340798,14.2191 C42.235044,14.2191 42.6421393,13.8081 42.6421393,13.3001 C42.6421393,12.7931 42.235044,12.3811 41.7340798,12.3811 L41.7340798,12.3811 Z" id="path-8"></path>
</defs>
<g id="上线UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="项目数据-无数据状态" transform="translate(-797.000000, -593.000000)">
<g id="编组-6" transform="translate(788.000000, 587.000000)">
<g id="编组" transform="translate(1.000000, 0.000000)">
<g id="img_no-data" transform="translate(8.645833, 6.999500)">
<g id="编组" transform="translate(0.000000, 8.970200)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<g id="Clip-2"></g>
<path d="M49.3205762,0 L32.8806476,0 L16.440719,0 L0.257695238,26.488 C0.0897190476,26.764 -0.000197619048,27.081 -0.000197619048,27.405 L-0.000197619048,45.323 C-0.000197619048,45.689 1.28235,46.987 1.64498095,46.987 L32.8806476,46.987 L64.1173024,46.987 C64.4789452,46.987 65.7614929,45.689 65.7614929,45.323 L65.7614929,27.405 C65.7614929,27.081 65.6725643,26.764 65.5036,26.488 L49.3205762,0 Z" id="Fill-1" fill="url(#linearGradient-3)" mask="url(#mask-2)"></path>
</g>
<polygon id="Fill-3" fill="url(#linearGradient-4)" points="32.880944 8.5034 16.4400274 8.5034 16.4400274 18.3434 32.880944 18.3434 49.3208726 18.3434 49.3208726 8.5034"></polygon>
<path d="M1.25705476,53.0815 L16.4401262,18.3435 L16.4401262,8.5035 L0.250185714,35.4635 C0.0861619048,35.7355 0.000197619048,36.0495 0.000197619048,36.3675 L0.000197619048,52.8125 C0.000197619048,53.5315 0.969519048,53.7385 1.25705476,53.0815" id="Fill-5" fill="url(#linearGradient-5)"></path>
<path d="M64.5048333,53.0815 L49.3207738,18.3435 L49.3207738,8.5035 L65.5117024,35.4635 C65.6747381,35.7355 65.7607024,36.0495 65.7607024,36.3675 L65.7607024,52.8125 C65.7607024,53.5315 64.791381,53.7385 64.5048333,53.0815" id="Fill-7" fill="url(#linearGradient-6)"></path>
<g id="编组" transform="translate(0.000198, 35.880000)">
<mask id="mask-9" fill="white">
<use xlink:href="#path-8"></use>
</mask>
<use id="形状结合" fill="url(#linearGradient-7)" xlink:href="#path-8"></use>
</g>
<line x1="13.3284167" y1="4.812" x2="10.3582024" y2="0" id="Stroke-13" stroke="#C2DAFE" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></line>
<line x1="16.1112881" y1="4.5181" x2="17.7248476" y2="0.0531" id="Stroke-15" stroke="#C2DAFE" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></line>
<line x1="11.8462738" y1="7.2143" x2="7.17357143" y2="6.7233" id="Stroke-17" stroke="#C2DAFE" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></line>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="56px" height="56px" viewBox="0 0 56 56" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>编组 60</title>
<g id="上线UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="上传文件" transform="translate(-325.000000, -482.000000)">
<g id="编组-57" transform="translate(179.000000, 276.000000)">
<g id="编组-18" transform="translate(62.000000, 206.000000)">
<g id="编组-60" transform="translate(84.000000, 0.000000)">
<g id="编组-59备份" transform="translate(1.400000, 7.000000)">
<path d="M28.7159091,0 C37.4357661,0 44.5876594,6.37181248 45.2851301,14.4775054 C49.9052925,16.0883207 53.2,20.302527 53.2,25.2471154 C53.2,31.3738473 48.1415865,36.3792127 41.7724852,36.7060962 L41.1090909,36.7230769 L9.67272727,36.7230769 C4.23205673,36.1520517 0,31.7108914 0,26.3947115 C0,22.6288201 2.12348719,19.3336707 5.29597862,17.5290977 C4.99754301,16.7130376 4.83636364,15.8337592 4.83636364,14.91875 C4.83636364,10.482151 8.62566271,6.88557692 13.3,6.88557692 C13.8401456,6.88557692 14.3684733,6.93360229 14.8805016,7.0253996 C17.8638158,2.78919919 22.946682,0 28.7159091,0 Z M28.7159091,3.33846154 C24.4392195,3.33846154 20.5270314,5.23755123 18.0439412,8.35433733 L17.595369,8.95283825 L16.3756995,10.6847257 L14.2960378,10.3118804 C13.9714328,10.2536846 13.6386173,10.2240385 13.3,10.2240385 C10.4214979,10.2240385 8.16136364,12.3692216 8.16136364,14.91875 C8.16136364,15.2574889 8.20014598,15.5884063 8.27595544,15.9079789 L8.41722056,16.3783889 L9.38966938,19.0375106 L6.93493578,20.4338094 C4.69458135,21.7081653 3.325,23.952957 3.325,26.3947115 C3.325,29.7523113 5.92395044,32.6493441 9.47797889,33.2646729 L10.0180408,33.3396318 L10.46045,33.3846154 L16.6758021,33.3848359 L16.625,36.7230769 L36.575,36.7230769 L36.6362796,33.385544 L41.0243527,33.3856997 L41.6027449,33.3719877 C46.2681023,33.1325459 49.875,29.5303701 49.875,25.2471154 C49.875,22.0546731 47.8637479,19.1784464 44.784147,17.8599099 L44.1944324,17.6312415 L42.1580208,16.9212485 L41.9724703,14.7648626 C41.422491,8.37324989 35.6942082,3.33846154 28.7159091,3.33846154 Z" id="形状结合" fill="#D7E8FF" fill-rule="nonzero"></path>
<line x1="26.6" y1="16.6923077" x2="26.6" y2="43.4" id="路径-10" stroke="#D7E8FF" stroke-width="3.36"></line>
<polyline id="路径-15" stroke="#D7E8FF" stroke-width="3.36" points="16.625 26.7076923 26.6 16.6923077 36.575 26.7076923"></polyline>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
import style from "./InformationDisplay.module.css";
import React from "react";
type InfoLi = {
label: string | number;
......
......@@ -15,18 +15,30 @@ import EnhancedTableHeadComponent from "./Table/EnhancedTableHead"
import { getComparator, stableSort, useStyles } from "./Table/function";
import ActionsComponent from "./Table/ActionsComponent"
import { useEffect } from "react";
import { useImperativeHandle } from "react";
export default function EnhancedTable(props) {
const classes = useStyles;
const [order, setOrder] = React.useState("asc");
const [orderBy, setOrderBy] = React.useState("");
const { headCells, rows, footer = true, elevation1, tableStyle,tablecellstyle, tableContainerStyle, stickyheader, TableHeadClasses, onRowClick, defaultRow, minHeight='', borderBottom='', onDoubleClick,
load, size, checkboxData, rowsPerPage = 10, initSelected, page = 0, changePage = function () { }, toolbar, count, param, disabledparam = "id", headTableCellCheckbox ,RowHeight='',CellWidth='',rowHover, TableNodataPadding = '',TableNodataLineHeight=''} = props;
const { headCells, rows, footer = true, elevation1, tableStyle, tablecellstyle, tableContainerStyle, stickyheader, TableHeadClasses, onRowClick, defaultRow, minHeight = '', borderBottom = '', onDoubleClick,
load, size, checkboxData, rowsPerPage = 10, initSelected, page = 0, changePage = function () { }, toolbar, count, param, disabledparam = "id", headTableCellCheckbox, RowHeight = '', CellWidth = '', rowHover, TableNodataPadding = '', TableNodataLineHeight = '', tableBoySx } = props;
const [selected, setSelected] = React.useState(initSelected || []);
const [rowsPerPageOptions, setRowsPerPageOptions] = React.useState(initSelected || [5, 10, 20, 50, { value: -1, label: 'All' }]);
// const [spin, setSpin] = React.useState(false)
const [onRow, setOnRow] = React.useState('')
// 重置复选框选中选项
const initSelectedFunc = (e) => {
setSelected(e)
}
useImperativeHandle(props.onRef, () => {
return {
initSelectedFunc: initSelectedFunc,
};
});
useEffect(() => {
setOnRow(defaultRow)
}, [defaultRow])
......@@ -90,7 +102,9 @@ export default function EnhancedTable(props) {
return (
<div className={classes.root}>
<Paper className={classes.paper} classes={{ elevation1: elevation1 || classes.elevation1 }} >
<Paper sx={{
boxShadow: 'none'
}} className={classes.paper} classes={{ elevation1: elevation1 || classes.elevation1 }} >
{/* <Spin spin={spin} /> */}
{toolbar && toolbar}
<TableContainer style={{ ...tableContainerStyle }}>
......@@ -107,13 +121,18 @@ export default function EnhancedTable(props) {
rowCount={rows.length}
headCells={headCells || []}
/>
<TableBody>
<TableBody sx={{
...tableBoySx
}}>
{
(rows.length === 0 && !load) && <TableRow>
<TableCell
sx={{
borderBottom: '1px solid #F0F2F5'
}}
colSpan={headCells?.filter(k => k.id === "checkbox")?.length === 0 ? headCells?.length : headCells?.length + 1}
className={classes.TypographyStyle}
style={{ minHeight: minHeight, height: minHeight, borderBottom: borderBottom ,padding:TableNodataPadding,lineHeight:TableNodataLineHeight}}
style={{ minHeight: minHeight, height: minHeight, borderBottom: borderBottom, padding: TableNodataPadding, lineHeight: TableNodataLineHeight }}
>
No Data
</TableCell>
......@@ -124,13 +143,13 @@ export default function EnhancedTable(props) {
const labelId = `enhanced-table-checkbox-${index}`;
return (
<TableRow
hover={ rowHover ? false : (row[disabledparam || "enabled"] ? true : false)}
hover={rowHover ? false : (row[disabledparam || "enabled"] ? true : false)}
onDoubleClick={() => {
onDoubleClick && onDoubleClick(row)
}}
style={{
height:RowHeight,
height: RowHeight,
border: onRow === row[param || "id"] ? !row[disabledparam] ? "" : '1px solid #136EFA' : "",
backgroundColor: onRow === row[param || "id"] ? !row[disabledparam] ? "rgba(255, 255, 255, 0.4)" : "rgba(19, 110, 250, 0.1)" : "",
cursor: props.cursor ? (row[props.cursor] ? "pointer" : "auto") : (onRowClick ? !row[disabledparam] ? "no-drop" : "pointer" : "auto"),
......@@ -142,31 +161,37 @@ export default function EnhancedTable(props) {
selected={isItemSelected}
>
{
headCells.filter(k => k.id === "checkbox").length > 0 && <TableCell
onClick={(event) => {
// if (!row[disabledparam]) return;
onRowClick && onRowClickDefault(row[param || "id"])
headCells.filter(k => k.id === "checkbox").length > 0 && handleClick(event, row[param || "id"])
}}
padding="checkbox">
<Checkbox color={"primary"} checked={isItemSelected} inputProps={{ "aria-labelledby": labelId }} />
headCells.filter(k => k.id === "checkbox").length > 0 && <TableCell
sx={{
borderBottom: '1px solid #F0F2F5'
}}
onClick={(event) => {
// if (!row[disabledparam]) return;
onRowClick && onRowClickDefault(row[param || "id"])
headCells.filter(k => k.id === "checkbox").length > 0 && handleClick(event, row[param || "id"])
}}
padding="checkbox">
<Checkbox sx={{ color: '#D1D6DE' }} color={"primary"} checked={isItemSelected} inputProps={{ "aria-labelledby": labelId }} />
</TableCell>
}
{
headCells.filter(item=>item.id !== 'checkbox').map((item, k) => {
headCells.filter(item => item.id !== 'checkbox').map((item, k) => {
return (
<TableCell key={k} component="th" id={labelId + k}
sx={{
borderBottom: '1px solid #F0F2F5'
}}
// align={}
style={{ width:CellWidth, textAlign: item.numeric ? "right" : "left", paddingRight: item.sort && item.numeric ? "40px" : "",border:tablecellstyle }}
style={{ width: CellWidth, textAlign: item.numeric ? "right" : "left", paddingRight: item.sort && item.numeric ? "40px" : "", border: tablecellstyle }}
scope="row"
padding={item.disablePadding ? "none" : "normal"}
classes={{
body: props.bodyTableCell || classes.bodyTableCell
}}
> {
item.render ? <>{item.render(row[item.id],row,index)}</> :
row[item.id]
}
item.render ? <>{item.render(row[item.id], row, index)}</> :
row[item.id]
}
</TableCell>
)
})
......
......@@ -13,25 +13,28 @@ import PropTypes from "prop-types";
import TableRow from "@mui/material/TableRow";
import TableCell from "@mui/material/TableCell";
import Checkbox from "@mui/material/Checkbox";
import Typography from "@mui/material/Typography";
import Typography from "@mui/material/Typography";
import Tooltip from '@mui/material/Tooltip';
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
const EnhancedTableHead = (props) => {
const { classes, onSelectAllClick, order, orderBy, TableHeadClasses, numSelected, rowCount, onRequestSort, headCells, headTableCell, headTableCellCheckbox,RowStyle } = props;
const { classes, onSelectAllClick, order, orderBy, TableHeadClasses, numSelected, rowCount, onRequestSort, headCells, headTableCell, headTableCellCheckbox, RowStyle, headTableCellStyle } = props;
const createSortHandler = (property) => (event) => {
onRequestSort(event, property);
};
return (
<TableHead classes={{ root: TableHeadClasses || classes.TableHeadClasses }} sx={{
th:{
th: {
backgroundColor: '#F7F8FA',
}
}}>
<TableRow style={{...RowStyle}}>
<TableRow style={{ ...RowStyle }}>
{
headCells.filter(k => k.id === "checkbox").length > 0 && <TableCell padding="checkbox">
headCells.filter(k => k.id === "checkbox").length > 0 && <TableCell sx={{
border: 'none'
}} padding="checkbox">
<Checkbox
sx={{ color: '#D1D6DE' }}
color={'primary'}
indeterminate={numSelected > 0 && numSelected < rowCount}
checked={rowCount > 0 && numSelected === rowCount}
......@@ -40,28 +43,32 @@ const EnhancedTableHead = (props) => {
/>
</TableCell>
}
{headCells.map((headCell,k) => (
<TableCell
key={headCell.id}
style={{ width: headCell.width ? headCell.width : "", textAlign: headCell.numeric ? "right" : "left", display: headCell.id !== "checkbox" ? "" : "none" }}
padding={headCell.disablePadding ? "none" : "normal"}
sortDirection={orderBy === headCell.id ? order : false}
classes={{ head:( k && headTableCell) || classes.headTableCell }}
>
{
headCell.sort && <TableSortLabel active={orderBy === headCell.id} direction={order} onClick={createSortHandler(headCell.id)} >
{headCell.label}
</TableSortLabel>
}
{
!headCell.sort && <Typography className={headTableCellCheckbox || ''} style={headCell.tooltip ? { display: "flex", alignItems: "center" } : {}} >
{headCell.label}
{headCell.tooltip ? <Tooltip title={headCell.tooltip} placement="top" arrow>
<ErrorOutlineIcon style={{ fontSize: "16px",marginLeft:"5px" }} fontSize="small" />
</Tooltip> : ""}
</Typography>
}
</TableCell>
{headCells.map((headCell, k) => (
<TableCell
sx={{
border: 'none',
...headTableCellStyle
}}
key={headCell.id}
style={{ width: headCell.width ? headCell.width : "", textAlign: headCell.numeric ? "right" : "left", display: headCell.id !== "checkbox" ? "" : "none" }}
padding={headCell.disablePadding ? "none" : "normal"}
sortDirection={orderBy === headCell.id ? order : false}
classes={{ head: (k && headTableCell) || classes.headTableCell }}
>
{
headCell.sort && <TableSortLabel active={orderBy === headCell.id} direction={order} onClick={createSortHandler(headCell.id)} >
{headCell.label}
</TableSortLabel>
}
{
!headCell.sort && <Typography className={headTableCellCheckbox || ''} style={headCell.tooltip ? { display: "flex", alignItems: "center" } : {}} >
{headCell.label}
{headCell.tooltip ? <Tooltip title={headCell.tooltip} placement="top" arrow>
<ErrorOutlineIcon style={{ fontSize: "16px", marginLeft: "5px" }} fontSize="small" />
</Tooltip> : ""}
</Typography>
}
</TableCell>
))}
</TableRow>
</TableHead>
......
import { useStores } from "@/store/index";
import { elements } from "@/router";
import { current, } from "@/api/demo_api";
import { current } from "@/api/demo_api";
import { product } from "@/api/project_api";
import localStorageKey from "@/utils/localStorageKey";
......@@ -8,6 +8,7 @@ import NotFound from "@/views/404";
import useMyRequest from "@/hooks/useMyRequest";
import { useEffect } from "react";
import { menu } from "@/api/routes_api";
import { setFileServerEndPointLocalStorage } from "@/views/Project/project";
const useMyRouter = () => {
const { permissionStore, menuStore, currentProjectStore } = useStores();
......@@ -51,6 +52,7 @@ const useMyRouter = () => {
} else {
currentProjectStore.setProjectList(list);
currentProjectStore.changeProject(list[0]);
setFileServerEndPointLocalStorage(list[0].zoneId);
}
}
......
......@@ -18,6 +18,8 @@ const MyDialog = (props: any) => {
handleSubmit,
submitloading,
submitStyle = { backgroundColor: "#1370FF" },
showCloseButton = true,
submitText = "确定",
} = props;
const handleClickOpen = () => {
......@@ -39,9 +41,22 @@ const MyDialog = (props: any) => {
<Dialog
open={open}
onClose={handleClose}
className="aaa"
aria-labelledby="form-dialog-title"
sx={{
"& .MuiDialog-container": {
"& .MuiPaper-root": {
// 设置最大宽度, 实际宽度让子元素撑大
maxWidth: "1920px",
},
},
}}
>
{title && <DialogTitle id="form-dialog-title">{title}</DialogTitle>}
{title && (
<DialogTitle id="form-dialog-title" sx={{ fontWeight: "600" }}>
{title}
</DialogTitle>
)}
<DialogContent>
{props.children}
<IconButton
......@@ -52,23 +67,27 @@ const MyDialog = (props: any) => {
<CloseIcon style={{ color: "#C2C6CC" }} />
</IconButton>
</DialogContent>
<DialogActions style={{ padding: "24px" }}>
<Button
onClick={handleClose}
color="inherit"
variant="contained"
style={{ color: "#1E2633", backgroundColor: "#fff" }}
>
取消
</Button>
<DialogActions style={{ padding: "16px 24px" }}>
{showCloseButton && (
<Button
onClick={handleClose}
color="inherit"
variant="contained"
style={{ color: "#1E2633", backgroundColor: "#fff" }}
size="small"
>
取消
</Button>
)}
<LoadingButton
loading={submitloading}
onClick={handleSubmit}
color="primary"
variant="contained"
style={submitStyle}
size="small"
>
确认
{submitText}
</LoadingButton>
</DialogActions>
</Dialog>
......
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-11 09:33:46
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-11 11:33:17
* @FilePath: /bkunyun/src/components/mui/MyPopover.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import * as React from "react";
import Popover, { PopoverProps } from "@mui/material/Popover";
import Typography from "@mui/material/Typography";
interface IProps extends Omit<PopoverProps, "open"> {
/** 触发行为 */
trigger?: "hover" | "click";
/** 触发dom */
children: React.ReactNode;
/** 显示内容 */
content: React.ReactNode;
}
const MyPopover = (props: IProps) => {
const [anchorEl, setAnchorEl] = React.useState<any | null>(null);
const {
trigger = "click",
children,
content,
anchorOrigin,
transformOrigin,
} = props;
const handlePopoverOpen = (event: any) => {
setAnchorEl(event.currentTarget);
};
const handelClick = (event: any) => {
setAnchorEl(event?.currentTarget);
};
const handlePopoverClose = () => {
setAnchorEl(null);
};
const open = Boolean(anchorEl);
const id = open ? "simple-popover" : undefined;
return (
<div>
<Typography
aria-owns={id}
onClick={trigger === "click" ? handelClick : undefined}
onMouseEnter={trigger === "hover" ? handlePopoverOpen : undefined}
onMouseLeave={trigger === "hover" ? handlePopoverClose : undefined}
>
{children}
</Typography>
<Popover
id={id}
open={open}
anchorEl={anchorEl}
onClose={handlePopoverClose}
sx={{
pointerEvents: trigger === "hover" ? "none" : undefined,
}}
anchorOrigin={
anchorOrigin || {
vertical: "bottom",
horizontal: "center",
}
}
transformOrigin={
transformOrigin || {
vertical: "top",
horizontal: "center",
}
}
>
<Typography sx={{ p: 1 }}>{content}</Typography>
</Popover>
</div>
);
};
export default MyPopover;
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2021-12-04 15:46:25
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-07 21:13:38
* @LastEditTime: 2022-06-11 18:22:50
* @FilePath: /lionet-slb-pc/src/components/SearchView/components/Collapse.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -23,10 +23,15 @@ interface IProps
value?: IOption;
options: IOption[];
onChange?: (val: IOption) => void;
/** 类型变种 */
variant?: "standard" | "outlined" | "filled";
/** title */
title?: string;
/** 是否显示title */
isTitle?: boolean;
}
export default function BasicSelect(props: IProps) {
const { value, options, onChange, title, input } = props;
export default function MySelect(props: IProps) {
const { value, options, onChange, title, isTitle = false, variant } = props;
const handleChange = (event: any) => {
const newValue = options?.filter((item) => {
......@@ -39,12 +44,12 @@ export default function BasicSelect(props: IProps) {
return (
<Box sx={{ minWidth: 120 }}>
<FormControl fullWidth>
{input ? null : (
<FormControl fullWidth variant={variant}>
{isTitle ? (
<InputLabel id="demo-simple-select-label">
{title || "请选择"}
</InputLabel>
)}
) : null}
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
......
import { Box } from "@mui/material";
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-11 11:35:22
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-11 15:10:56
* @FilePath: /bkunyun/src/components/mui/MyTitle.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
interface IProps {
/** 标题 */
title: string;
/** 自定义类名 */
className?: string;
/** 自定义样式 */
style?: React.CSSProperties;
}
const MyTitle = (props: IProps) => {
const { title } = props;
return (
<Box
style={{
padding: 12,
}}
{...props}
>
<span
style={{
display: "inline-block",
color: "#1E2633",
fontSize: 16,
fontWeight: 600,
padding: "0px 2px 8px 2px",
borderBottom: "3px solid #1370FF",
}}
>
{title}
</span>
</Box>
);
};
export default MyTitle;
import TreeView from "@mui/lab/TreeView";
import ArrowRightIcon from "@mui/icons-material/ArrowRight";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import TreeItem from "@mui/lab/TreeItem";
interface TreeItemType {
id: string;
name: string;
subdirs?: readonly TreeItemType[];
}
type MyTreeViewProps = {
// treeData: RenderTree;
treeData: Array<TreeItemType>;
onNodeFocus?: (event: object, value: string) => void; // 点击某一项的回调
onNodeSelect?: (event: object, value: Array<any> | string) => void; // 点击某一项的回调
onNodeToggle?: (event: object, nodeIds: Array<any>) => void; // 点击某一项的回调
renderLabel?: (labelNmae: string) => React.ReactNode;
treeViewSx?: any;
defaultExpanded?: Array<string>;
idKey?: string;
idFunc?: (node: any) => string;
};
interface RenderTree {
id: string | number;
name: string;
subdirs?: readonly RenderTree[];
}
const MyTreeView = (props: MyTreeViewProps) => {
const {
treeData = [],
renderLabel,
treeViewSx,
onNodeFocus,
onNodeSelect,
onNodeToggle,
defaultExpanded,
idKey,
idFunc,
} = props;
const renderTreeObj = (nodes: RenderTree, index: number) => (
<TreeItem
key={nodes.id || `${nodes.name}${index}`}
nodeId={String(
idFunc ? idFunc(nodes) : nodes.id || `${nodes.name}${index}`
)}
label={renderLabel === undefined ? nodes.name : renderLabel(nodes.name)}
>
{Array.isArray(nodes.subdirs)
? nodes.subdirs.map((node, i) => renderTreeObj(node, i))
: null}
</TreeItem>
);
// const renderTreeArray = (node: TreeItemType, index: number) => {
// return (
// <TreeItem
// key={node.id || `${node.name}${index}`}
// nodeId={String(node.id)}
// label={renderLabel === undefined ? node.name : renderLabel(node.name)}
// >
// {Array.isArray(node.subdirs)
// ? node.subdirs.map((nodeLi: any, i) => renderTreeArray(nodeLi, i))
// : null}
// </TreeItem>
// );
// };
return (
<TreeView
defaultCollapseIcon={<ArrowRightIcon />}
defaultExpandIcon={<ArrowDropDownIcon />}
onNodeFocus={onNodeFocus}
onNodeSelect={onNodeSelect}
onNodeToggle={onNodeToggle}
defaultExpanded={defaultExpanded}
sx={{ ...treeViewSx }}
>
{treeData.length === 0 ? (
<div>暂无数据</div>
) : (
treeData.map((treeItem, index) => {
// return renderTreeArray(treeItem, index);
return renderTreeObj(treeItem, index);
})
)}
</TreeView>
);
};
export default MyTreeView;
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-13 16:50:40
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-13 21:09:24
* @FilePath: /bkunyun/src/hooks/useGlobalStore.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { useContext } from 'react';
import { MobXProviderContext } from 'mobx-react';
import { Stores } from '@/store';
export default function useGlobalStore<T extends keyof Stores>(storeName: T) {
const context = useContext(MobXProviderContext) as Stores;
return context[storeName];
}
\ No newline at end of file
......@@ -38,13 +38,15 @@ const demo = [
icon: "",
element: "ProjectSetting",
show: "true",
// children: [
// {
// id: "PROJECT_OVERIVEW_CREATE",
// type: "operation",
// name: "创建项目",
// },
// ],
},
{
id: "PROJECT_DATA",
type: "page",
name: "项目管理",
path: "/data",
icon: "",
element: "ProjectData",
show: "true",
},
{
id: "PROJECT_OVERIVEW",
......
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:17:23
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-02 17:15:35
* @LastEditTime: 2022-06-14 10:28:43
* @FilePath: /bkunyun/src/react-app-env.d.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -12,72 +12,75 @@
declare namespace NodeJS {
interface ProcessEnv {
readonly NODE_ENV: 'development' | 'production' | 'test';
readonly NODE_ENV: "development" | "production" | "test";
readonly PUBLIC_URL: string;
}
}
declare module '*.avif' {
declare module "*.avif" {
const src: string;
export default src;
}
declare module '*.bmp' {
declare module "*.bmp" {
const src: string;
export default src;
}
declare module '*.gif' {
declare module "*.gif" {
const src: string;
export default src;
}
declare module '*.jpg' {
declare module "*.jpg" {
const src: string;
export default src;
}
declare module '*.jpeg' {
declare module "*.jpeg" {
const src: string;
export default src;
}
declare module '*.png' {
declare module "*.png" {
const src: string;
export default src;
}
declare module '*.webp' {
const src: string;
export default src;
declare module "*.webp" {
const src: string;
export default src;
}
declare module '*.svg' {
import * as React from 'react';
declare module "*.svg" {
import * as React from "react";
export const ReactComponent: React.FunctionComponent<React.SVGProps<
SVGSVGElement
> & { title?: string }>;
export const ReactComponent: React.FunctionComponent<
React.SVGProps<SVGSVGElement> & { title?: string }
>;
const src: string;
export default src;
}
declare module '*.module.css' {
declare module "*.module.css" {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.scss' {
declare module "*.module.scss" {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.sass' {
declare module "*.module.sass" {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '@mui/lab';
declare module 'lodash';
declare module "@mui/material/Tab"
declare module "@mui/lab";
declare module "lodash";
declare module "@mui/material/Tab";
declare module "tus-js-client";
declare module "uuid";
......@@ -14,8 +14,10 @@ import * as React from "react";
import NotFound from "@/views/404";
import Demo from "@/views/demo";
import ProjectSetting from "@/views/Project/ProjectSetting";
import ProjectData from "@/views/Project/ProjectData";
import ProjectWorkbench from "@/views/Project/ProjectWorkbench";
export type route = {
id?: string;
type: "page";
......@@ -48,6 +50,7 @@ export const elements: {
} = {
Demo: Demo,
ProjectSetting: ProjectSetting,
ProjectData: ProjectData,
ProjectWorkbench:ProjectWorkbench
};
......
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-09 20:41:05
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-14 10:16:23
* @FilePath: /bkunyun/src/store/index.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import * as React from "react";
import { configure } from "mobx";
import permissionStore from "./modules/permission";
import menuStore from "./modules/menu";
import currentProjectStore from "./modules/currentProject";
import fileList from "./modules/fileList";
configure({ enforceActions: "always" });
export const stores = { permissionStore, menuStore, currentProjectStore };
export const stores = { permissionStore, menuStore, currentProjectStore, fileList };
/** Store类型 */
export type Stores = typeof stores;
export const CounterContext = React.createContext(stores);
export const useStores = () => React.useContext(CounterContext);
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-13 17:00:19
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-14 11:06:13
* @FilePath: /bkunyun/src/store/modules/upload.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { makeAutoObservable } from "mobx";
interface IUploadInfo {
id: string,
open: boolean,
list: any,
isPermanence: boolean,
}
/** 存储地图派单websocket推送数据状态的store */
class FileList {
constructor() {
makeAutoObservable(this);
}
/** 文件上传列表 */
fileList: IUploadInfo[] = [];
setFileList (val: IUploadInfo[]) {
this.fileList = val
}
/** 设置文件上传信息 */
setUploadInfo(id: string, val: IUploadInfo) {
const newFileList = this.fileList?.map((item)=>{
if(item.id === id){
return val
} return item
})
this.fileList = newFileList
}
setUploadInfoOpen(id: string, val: boolean) {
const newFileList = this.fileList?.map((item)=>{
if(item.id === id){
return {...item,open: val};
}
return item;
})
this.fileList = newFileList
}
setUploadInfoList(id: string, val: any) {
const newFileList = this.fileList?.map((item)=>{
if(item.id === id){
return {...item, list: val}
} return item
})
this.fileList = newFileList
}
setUploadInfoIsPermanence(id: string, val: boolean) {
const newFileList = this.fileList?.map((item)=>{
if(item.id === id){
return {...item, isPermanence: val}
} return item
})
this.fileList = newFileList
}
}
export default new FileList();
This diff is collapsed.
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-13 17:23:49
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-13 17:28:59
* @FilePath: /bkunyun/src/utils/helper.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
const getTrueLength = (str: string) => {//获取字符串的真实长度(字节长度)
let len = str.length, truelen = 0;
for (let x = 0; x < len; x++) {
if (str.charCodeAt(x) > 128) {
truelen += 2;
} else {
truelen += 1;
}
}
return truelen;
}
export const verifyLettersNumbersCertainChars4 = (str: string) => {
if (str.slice(0, 1) === ".") {
return false;
}
if (getTrueLength(str) > 127) {
return false;
}
let validString = /^[\u4e00-\u9fa5_0-9a-zA-Z-_.]+$/;
return validString.test(str);
};
export const verifyLettersNumbersCertainChars5 = (str: string) => {
if (str.slice(0, 1) === ".") {
return false;
}
if (getTrueLength(str) > 127) {
return false;
}
let validString = /^[\u4e00-\u9fa5_0-9a-zA-Z\/-_.]+$/;
return validString.test(str);
};
\ No newline at end of file
......@@ -2,18 +2,54 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-07 18:37:53
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-07 19:59:25
* @LastEditTime: 2022-06-14 10:32:54
* @FilePath: /bkunyun/src/utils/util.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export const isProjectOwner = (name: string)=>{
let localName =''
try{
localName = JSON.parse(
localStorage.getItem("userInfo") || "{}"
)?.name
import { v4 as uuidv4 } from 'uuid';
export const isProjectOwner = (name: string) => {
let localName = "";
try {
localName = JSON.parse(localStorage.getItem("userInfo") || "{}")?.name;
} catch {
console.error('获取localStorage出错')
console.error("获取localStorage出错");
}
return localName === name
}
\ No newline at end of file
return localName === name;
};
/**
* 生成32位的随机id
* @returns 返回32位的uuid
*/
export const uuid = () => {
const reg = /-/g;
const pwd = uuidv4().replace(reg, '');
return pwd;
};
// 获取用户token 信息
export const getUserInfo = () => {
let val: any;
try {
val = JSON.parse(localStorage.getItem("userInfo") || "{}")
}
catch {
console.error("获取用户信息token 出错");
}
return val
}
const IsNumberLetterChineseReg = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$");
export const checkIsNumberLetterChinese = (string: string) => {
return IsNumberLetterChineseReg.test(string);
};
export const getMbfromB = (b: number) => {
return Math.floor(b / 1048576);
};
import { useEffect } from "react";
import useGlobalStore from "@/hooks/useGlobalStore";
import { observer } from "mobx-react-lite";
import { toJS } from "mobx";
import UseTusUpload from "@/utils/Upload/tusUpload";
// toJS(currentProjectStore.currentProjectInfo.id);
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-11 15:46:42
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-14 11:07:55
* @FilePath: /bkunyun/src/views/ConsoleLayout/components/FileItem/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
const FileItem = observer(() => {
const fileList = toJS(useGlobalStore("fileList"));
const { uploadFile } = UseTusUpload(fileList?.fileList);
useEffect(() => {
fileList?.fileList?.forEach((item) => {
uploadFile(
item.id,
item.list,
"/",
"/",
(upload: any, filepath: string) => console.log(upload, filepath, 1111)
);
});
console.log(fileList?.fileList, 1111);
}, [fileList.fileList, uploadFile]);
return <div>dd</div>;
});
export default FileItem;
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-10 18:05:21
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-11 18:08:27
* @FilePath: /bkunyun/src/views/ConsoleLayout/components/TransferList/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { Box, InputLabel, MenuItem, Select } from "@mui/material";
import { memo } from "react";
import MySelect from "@/components/mui/MySelect";
import MyTitle from "@/components/mui/MyTitle";
import FileItem from "../FileItem";
const TranSferList = () => {
return (
<Box style={{ width: 520, padding: 20 }}>
<MyTitle title="传输列表" />
<Box
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
>
<Box style={{ color: "#8A9099" }}>请勿在上传过程中刷新页面!</Box>
<MySelect
variant="standard"
value={{
label: "默认线路",
value: "default",
}}
onChange={() => console.log(11)}
options={[
{
label: "默认线路",
value: "default",
},
]}
size="small"
/>
</Box>
<Box>
<FileItem />
</Box>
</Box>
);
};
export default memo(TranSferList);
.topApp {
height: 56px;
background-color: white;
border-bottom: #E6E8EB 1px solid;
border-bottom: #e6e8eb 1px solid;
display: flex;
align-items: center;
justify-content: space-between;
......@@ -18,23 +18,29 @@
}
.topRightBox {
padding-right: 30px;
display: flex;
justify-content: flex-end;
align-items: center;
}
.topRightItem {
margin-right: 20px;
}
.ArrowDropDownIconRoot {
color: #8A9099;
color: #8a9099;
transition: all 0.2s !important;
transform: rotate(0)
transform: rotate(0);
}
.ArrowDropDownIconRootOpen {
color: #8A9099;
transform: rotate(180deg)
color: #8a9099;
transform: rotate(180deg);
}
.menuPaper {
border: 1px solid #F0F2F5;
background: #FFFFFF;
border: 1px solid #f0f2f5;
background: #ffffff;
border-radius: 4px;
box-shadow: 4px 4px 20px 0px rgba(0, 24, 57, 0.06) !important;
}
......@@ -42,4 +48,4 @@
.menuItemRoot {
width: 143px;
font-size: 14px !important;
}
\ No newline at end of file
}
import { Box, Menu, MenuItem } from "@mui/material";
import React, { useEffect } from "react";
import { Outlet, useLocation, useNavigate } from "react-router-dom";
import style from "./index.module.css";
import cx from "classnames";
import { observer } from "mobx-react-lite";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import Add from "@mui/icons-material/Add";
import Avatar from "@mui/material/Avatar";
import { Box, Menu, MenuItem } from "@mui/material";
import globalText from "@/utils/globalText_CN";
import useIndex from "./useIndex";
import { useStores } from "@/store/index";
import { observer } from "mobx-react-lite";
import Button from "@/components/mui/Button";
import logo from "@/assets/img/logo.svg";
import Avatar from "@mui/material/Avatar";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import cx from "classnames";
import MyPopover from "@/components/mui/MyPopover";
import TranSferList from "./components/TransferList";
import style from "./index.module.css";
const ConsoleLayout = observer(() => {
const {
......@@ -92,54 +97,67 @@ const ConsoleLayout = observer(() => {
</Box>
<Box className={style.topRightBox}>
<Box
sx={{ display: "flex", alignItems: "center" }}
onClick={handleUtilityClick}
<MyPopover
content={<TranSferList />}
transformOrigin={{
vertical: "top",
horizontal: "right",
}}
>
<Avatar
sx={{
bgcolor: "#1370FF",
width: 28,
height: 28,
fontSize: "14px",
cursor: "pointer",
}}
<Box className={style.topRightItem}>
<Add />
</Box>
</MyPopover>
<Box className={style.topRightItem}>
<Box
sx={{ display: "flex", alignItems: "center" }}
onClick={handleUtilityClick}
>
H
</Avatar>
<ArrowDropDownIcon
classes={{
root: cx({
[style.ArrowDropDownIconRoot]: true,
[style.ArrowDropDownIconRootOpen]: Boolean(utilityOpen),
}),
<Avatar
sx={{
bgcolor: "#1370FF",
width: 28,
height: 28,
fontSize: "14px",
cursor: "pointer",
}}
>
H
</Avatar>
<ArrowDropDownIcon
classes={{
root: cx({
[style.ArrowDropDownIconRoot]: true,
[style.ArrowDropDownIconRootOpen]: Boolean(utilityOpen),
}),
}}
/>
</Box>
<Menu
id="utility-menu"
anchorEl={utilityAnchorEl}
open={utilityOpen}
onClose={handleClose}
MenuListProps={{
"aria-labelledby": "utility-button",
}}
/>
>
{menuStore.utilityList.map((item) => {
return (
<MenuItem
key={item.path}
onClick={() => {
navigate(item.path);
handleClose();
}}
>
{item.name}
</MenuItem>
);
})}
</Menu>
</Box>
<Menu
id="utility-menu"
anchorEl={utilityAnchorEl}
open={utilityOpen}
onClose={handleClose}
MenuListProps={{
"aria-labelledby": "utility-button",
}}
>
{menuStore.utilityList.map((item) => {
return (
<MenuItem
key={item.path}
onClick={() => {
navigate(item.path);
handleClose();
}}
>
{item.name}
</MenuItem>
);
})}
</Menu>
</Box>
</Box>
<Box>
......
import React, { useState, useImperativeHandle } from "react";
import { TextField } from "@mui/material";
import MyDialog from "@/components/mui/MyDialog";
import { checkIsNumberLetterChinese } from "@/utils/util";
import { useMessage } from "@/components/MySnackbar";
import CloudEController from "@/api/fileserver/CloudEController";
const AddFolder = (props: any) => {
const { list, path, projectId, fileToken, refresh } = props;
const Message = useMessage();
let addFolderDialogRef: any = React.createRef();
const showDialog = () => {
addFolderDialogRef.current.handleClickOpen();
};
useImperativeHandle(props.onRef, () => {
return {
showDialog: showDialog,
};
});
const handleAddSubmit = () => {
if (fileName && !fileNameCheck.error) {
const newFolderPath =
path === "/" ? `${path}${fileName}` : `${path}/${fileName}`;
// 请求接口
CloudEController.JobFileNewFolder(
newFolderPath,
fileToken,
projectId
)?.then((res) => {
Message.success("新建成功");
addFolderDialogRef.current.handleClose();
refresh()
});
} else {
Message.info(fileNameCheck.help || "请输入文件夹名称");
}
};
const addFolderSubmitloading = false;
const [fileName, setFileName] = useState("");
const [fileNameCheck, setFileNameCheck] = useState({
error: false,
help: "",
});
const handleFileNameChange = (e: any) => {
const fileName = e.target.value;
setFileName(fileName);
if (!fileName) {
setFileNameCheck({
error: true,
help: "文件夹名称不能为空",
});
} else if (!checkIsNumberLetterChinese(fileName) || fileName.length > 30) {
setFileNameCheck({
error: true,
help: "格式不正确,必须在30字符以内,仅限大小写字母、数字、中文",
});
} else if (isRepeat(fileName)) {
setFileNameCheck({
error: true,
help: "已存在同名文件夹",
});
} else {
setFileNameCheck({
error: false,
help: "",
});
}
};
const isRepeat = (fileName: string) => {
return list.some((item: any) => {
return item.name === fileName;
});
};
return (
<MyDialog
handleSubmit={handleAddSubmit}
onRef={addFolderDialogRef}
title="新建文件夹"
submitloading={addFolderSubmitloading}
>
<TextField
sx={{
width: "388px",
border: "1px solide #E6E8EB",
marginTop: "12px",
}}
required
error={fileNameCheck.error}
id="fileName"
label="名称"
variant="outlined"
value={fileName}
onChange={handleFileNameChange}
helperText={fileNameCheck.help}
size="small"
/>
</MyDialog>
);
};
export default AddFolder;
.rootTitle {
border-radius: 4px 4px 0 0;
background-color: rgba(25, 118, 210, 0.08);
/* background-color: rgba(25, 118, 210, 0.5); */
line-height: 44px;
color: rgba(30, 38, 51, 1);
font-size: 14px;
font-weight: 600;
display: flex;
justify-content: flex-start;
align-items: center;
}
.rootTitleActive {
background-color: rgba(25, 118, 210, 0.2);
}
.bigFolderIcon {
margin: 0 9px;
}
.treeLabel {
display: flex;
justify-content: flex-start;
align-items: center;
line-height: 44px;
}
.labelFolderIcon {
margin-right: 9px;
}
import React, { useState, useImperativeHandle, useCallback } from "react";
import style from "./index.module.css";
import MyDialog from "@/components/mui/MyDialog";
import folderIcon from "@/assets/project/folderIcon.svg";
import bigFolderIcon from "@/assets/project/bigFolderIcon.svg";
import { useMessage } from "@/components/MySnackbar";
import MyTreeView from "@/components/mui/MyTreeView";
import CloudEController from "@/api/fileserver/CloudEController";
import { getDataFileMove } from "@/api/project_api";
import useMyRequest from "@/hooks/useMyRequest";
import classNames from "classnames";
const MoveFile = (props: any) => {
const {
path,
projectId,
fileToken,
currentOperateFile,
selectIds,
refresh,
activeTab,
showList,
} = props;
const Message = useMessage();
const { run: getDataFileMoveRun } = useMyRequest(getDataFileMove, {
onSuccess: (res: any) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
refresh();
},
});
const [newPath, setNewPath] = useState("/");
const [rootActive, setRootActive] = useState(true);
const [treeData, setTreeData] = useState<any>([]);
const getTree = useCallback(() => {
if (fileToken && projectId) {
return CloudEController.JobOutFileDirtree(
"/",
fileToken,
projectId,
false
)?.then((res) => {
if (Array.isArray(res.data)) {
setTreeData(res.data);
} else {
setTreeData([]);
}
});
}
}, [fileToken, projectId]);
let moveFileDialogRef: any = React.createRef();
const showDialog = () => {
moveFileDialogRef.current.handleClickOpen();
getTree();
};
useImperativeHandle(props.onRef, () => {
return {
showDialog: showDialog,
};
});
const handleMoveFileSubmit = () => {
if (newPath) {
if (!currentOperateFile) {
// 批量移动
if (activeTab === 1) {
const oldPaths = selectIds.map((name: any) => {
return `${path}${path === "/" ? "" : "/"}${name}`;
});
CloudEController.JobFileBatchMove(
newPath,
oldPaths,
"",
fileToken,
projectId
)?.then((res) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
refresh();
});
} else {
const datSetMoveList = showList.filter((item: any) => {
return (
selectIds.indexOf(item.name) !== -1 && item.type === "dataSet"
);
});
const otherMoveList = showList.filter((item: any) => {
return (
selectIds.indexOf(item.name) !== -1 && item.type !== "dataSet"
);
});
if (datSetMoveList.length > 0) {
const oldPaths = `${path}${path === "/" ? "" : "/"}`;
getDataFileMoveRun({
projectId: projectId as string,
names: datSetMoveList.map((item: any) => item.name).join(","),
spath: oldPaths,
dpath: newPath === "/" ? "/" : `${newPath}/`,
});
}
if (otherMoveList.length > 0) {
const oldPaths = otherMoveList.map((item: any) => {
return `${path}${path === "/" ? "" : "/"}${item.name}`;
});
CloudEController.JobFileBatchMove(
newPath,
oldPaths,
"",
fileToken,
projectId
)?.then((res) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
refresh();
});
}
}
} else {
if (currentOperateFile.type === "dataSet") {
const oldPaths = `${path}${path === "/" ? "" : "/"}`;
getDataFileMoveRun({
projectId: projectId as string,
names: currentOperateFile.name,
spath: oldPaths,
dpath: newPath === "/" ? "/" : `${newPath}/`,
});
} else {
const oldPath = `${path}${path === "/" ? "" : "/"}${
currentOperateFile.name
}`;
if (oldPath === newPath) {
Message.info("当前目录和目标目录一致,请重新选择目标目录");
return;
}
CloudEController.JobFileMove(
newPath,
oldPath,
"",
fileToken,
projectId
)?.then((res) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
});
}
}
} else {
Message.error("请选择移动到哪个目录");
}
};
const renderLabel = (labelNmae: string) => {
return (
<span className={style.treeLabel}>
<img className={style.labelFolderIcon} src={folderIcon} alt="" />
{labelNmae}
</span>
);
};
const onNodeSelect = (a: any, b: any) => {
setNewPath(b);
setRootActive(false);
};
const handleRoot = () => {
setNewPath("/");
setRootActive(true);
};
const moveFileSubmitloading = false;
const idFunc = (item: any) => {
return `${item.dir.substr(1)}${item.name}`;
};
return (
<MyDialog
handleSubmit={handleMoveFileSubmit}
onRef={moveFileDialogRef}
title="移动至"
submitloading={moveFileSubmitloading}
>
<div
className={classNames({
[style.rootTitle]: true,
[style.rootTitleActive]: rootActive,
})}
onClick={handleRoot}
>
<img className={style.bigFolderIcon} src={bigFolderIcon} alt="" />
ProjectData
</div>
<MyTreeView
treeData={treeData}
renderLabel={renderLabel}
onNodeSelect={onNodeSelect}
idFunc={idFunc}
treeViewSx={{
width: 400,
overflow: "hidden",
}}
></MyTreeView>
</MyDialog>
);
};
export default MoveFile;
.uploderBox {
width: 900px;
display: flex;
justify-content: space-between;
}
.uploderBoxLeft {
width: 300px;
}
.dropTitle {
line-height: 22px;
font-size: 14px;
color: #1e2633;
margin-bottom: 14px;
font-weight: 600;
}
.dropBox {
height: 300px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border: 1px dashed #d1d6de;
border-radius: 4px;
}
.dropBoxDragActive {
background-color: #f7f8fa;
}
.uploaderIcon {
width: 56px;
margin-bottom: 24px;
}
.uploderText1 {
line-height: 22px;
font-size: 14px;
color: #565c66;
margin-bottom: 2px;
}
.uploderText2 {
line-height: 20px;
font-size: 12px;
color: #8a9099;
}
.fileListBox {
width: 528px;
box-sizing: border-box;
position: relative;
}
.tableBox {
height: 300px;
overflow: scroll;
}
.fileIconBox {
display: flex;
justify-content: flex-start;
align-items: center;
}
.noFile {
position: absolute;
top: 92px;
height: 200px;
width: 100%;
background-color: #fff;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.noFileIcon {
width: 83px;
height: 70px;
height: auto;
margin-bottom: 6px;
}
.noFileText {
line-height: 18px;
font-size: 12px;
color: rgba(34, 34, 34, 0.45);
}
.fileIcon {
margin-right: 12px;
}
.red {
color: #ff4e4e;
}
import React, { useState, useImperativeHandle, useCallback } from "react";
import style from "./index.module.css";
import { TextField } from "@mui/material";
import MyDialog from "@/components/mui/MyDialog";
import { Button } from "@mui/material";
import { checkIsNumberLetterChinese, uuid } from "@/utils/util";
import { useMessage } from "@/components/MySnackbar";
import { useDropzone } from "react-dropzone";
import Table from "@/components/Material.Ui/Table";
import fileIcon from "@/assets/project/fileIcon.svg";
import noFile from "@/assets/project/noFile.svg";
import uploaderIcon from "@/assets/project/uploaderIcon.svg";
import classnames from "classnames";
import { getMbfromB } from "@/utils/util";
import { observer } from "mobx-react-lite";
import useGlobalStore from "@/hooks/useGlobalStore";
const UpLoaderFile = observer((props: any) => {
const uploadInfoStore = useGlobalStore("fileList");
const message = useMessage();
const [fileList, setFileList] = useState<any>([]);
// list 是项目数据table的数据
const { path, list } = props;
const onDrop = useCallback(
(acceptedFiles: any) => {
// 判断是否有文件名重复
const fileListRepeatName = getRepeatName(fileList, acceptedFiles);
const listRepeatName = getRepeatName(list, acceptedFiles);
if (fileListRepeatName || listRepeatName) {
message.error(`${fileListRepeatName || listRepeatName}文件已存在`);
return;
}
// 插入新的文件列表
const popLength = 10 - fileList.length;
let newFileList = [...acceptedFiles.slice(0, popLength), ...fileList];
setFileList(newFileList);
},
[fileList, list, message]
);
const getRepeatName = (fList: Array<any>, Alist: Array<any>) => {
let repeatName = "";
Alist.forEach((aItem) => {
fList.forEach((fItem: any) => {
if (fItem.name === aItem.name) {
repeatName = fItem.name;
}
});
});
return repeatName;
};
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop });
const submitloading = false;
let dialogRef: any = React.createRef();
const handleSubmit = () => {
const newFileList = fileList?.map((item: any) => {
return {
id: uuid(),
open: false,
list: item,
isPermanence: true,
};
});
uploadInfoStore.setFileList(newFileList);
console.log("handleSubmit");
};
const showDialog = () => {
dialogRef.current.handleClickOpen();
};
useImperativeHandle(props.onRef, () => {
return {
showDialog: showDialog,
};
});
const fileListHeadCells = [
{ id: "name", numeric: false, label: "名称", width: "60%" },
{ id: "size", numeric: false, label: "大小", width: "25%" },
{ id: "caozuo", numeric: false, label: "操作", width: "15%" },
];
const renderName = (item: any) => {
return (
<span className={style.fileIconBox}>
<img className={style.fileIcon} src={fileIcon} alt="" />
{item.name}
</span>
);
};
// 1,048,576
const renderSize = (item: any) => {
return (
<span>{item.size ? `${getMbfromB(Number(item.size))}MB` : "-"}</span>
);
};
const handleRowDelete = (index: number) => {
fileList.splice(index, 1);
setFileList([...fileList]);
};
const renderButtons = (item: any, index: number) => {
return (
<span>
<Button
sx={{ position: "relative", left: "-18px" }}
variant="text"
size="small"
color="error"
onClick={() => handleRowDelete(index)}
>
删除
</Button>
</span>
);
};
return (
<MyDialog
handleSubmit={handleSubmit}
onRef={dialogRef}
title="上传文件"
submitloading={submitloading}
submitText="开始上传"
showCloseButton={false}
>
<div className={style.uploderBox}>
<div className={style.uploderBoxLeft}>
<div className={style.dropTitle}>添加文件</div>
{/* <div {...getRootProps()} className={style.dropBox}> */}
<div
{...getRootProps()}
className={classnames({
[style.dropBox]: true,
[style.dropBoxDragActive]: isDragActive,
})}
>
{/* isDragActive */}
<input {...getInputProps()} multiple />
<img className={style.uploaderIcon} src={uploaderIcon} alt="" />
<div className={style.uploderText1}>
点击添加文件或将文件拖到此处添加
</div>
<div className={style.uploderText2}>一次最多添加10个文件</div>
</div>
</div>
<div className={style.fileListBox}>
<div className={style.dropTitle}>
已添加文件
<span
className={classnames({
[style.red]: fileList.length >= 10,
})}
>
{fileList.length}/10)
</span>
</div>
<div className={style.tableBox}>
<Table
rowHover={true}
stickyheader={true}
rows={fileList.map((item: any, index: number) => ({
...item,
name: renderName(item),
size: renderSize(item),
caozuo: renderButtons(item, index),
}))}
rowsPerPage={"99"}
headCells={fileListHeadCells}
nopadding={true}
footer={false}
headTableCellStyle={{
fontSize: "12px",
lineHeight: "20px",
color: "#8A9099",
// padding: "12px 24px",
}}
tableBoySx={{
backgroundColor:
fileList.length >= 10 ? "rgba(255, 0, 0, 0.6)" : "",
}}
></Table>
</div>
{fileList.length === 0 && (
<div className={style.noFile}>
<img className={style.noFileIcon} src={noFile} alt="" />
<span className={style.noFileText}>暂无添加文件</span>
</div>
)}
</div>
</div>
</MyDialog>
);
});
export default UpLoaderFile;
.projectData {
position: relative;
}
.projectDataStickyTop {
padding: 28px 24px;
}
.projectDataTitle {
font-size: 18px;
color: #1e2633;
line-height: 26px;
font-weight: 600;
margin-bottom: 24px;
}
.projectDataButtonAndSearch {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
}
.projectDataSearch {
padding-left: 12px;
padding-right: 8px;
border-radius: 4px;
border: 1px solid #ebedf0;
}
.projectDataPathAndTabs {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
}
.projectDataPath {
font-size: 14px;
color: #1e2633;
line-height: 22px;
font-weight: 600;
}
.projectDataTabsAndBtton {
display: flex;
justify-content: flex-end;
align-items: center;
}
.projectDataTabs {
display: flex;
justify-content: space-between;
border: 1px solid #e6e8eb;
border-radius: 4px;
background-color: #e6e8eb;
cursor: pointer;
margin-right: 12px;
}
.projectDataTab {
height: 32px;
box-sizing: border-box;
font-size: 14px;
color: #565c66;
border-radius: 4px;
line-height: 20px;
padding: 3px 18px;
background-color: #e6e8eb;
display: flex;
align-items: center;
}
.projectDataTabActive {
color: #1370ff;
background-color: #fff;
border: 1px solid #e6e8eb;
}
.folderIconBox {
display: flex;
justify-content: flex-start;
align-items: center;
}
.folderIcon {
margin-right: 12px;
}
.projectDataStickyBox {
height: 64px;
position: sticky;
bottom: -1px;
border: 1px solid #ebedf0;
z-index: 100;
background-color: #fff;
display: flex;
justify-content: flex-end;
align-items: center;
}
.showPathSpan{
cursor: pointer;
line-height: 22px;
font-size: 14px;
color: #1E2633;
/* display: flex;
align-items: center; */
}
.showPathI{
margin: 0 10px;
line-height: 22px;
font-size: 20px;
color: #C2C6CC;
cursor: default ;
}
.showPathSpan:hover{
color: #1370FF;
}
.showPathSpanActive{
color: #1370FF;
}
\ No newline at end of file
This diff is collapsed.
......@@ -27,8 +27,8 @@ import { useMessage } from "@/components/MySnackbar";
import Loading from "@/views/Loading";
import MyDialog from "@/components/mui/MyDialog";
import { getProjectList } from "../../project";
const reg = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$");
import { checkIsNumberLetterChinese } from "@/utils/util";
import { setFileServerEndPointLocalStorage } from "@/views/Project/project";
type zoneIdOption = {
id: string;
......@@ -127,7 +127,7 @@ const BaseInfo = observer(() => {
// 修改项目
const handleClickUpdate = () => {
if (projectInfo.name) {
if (reg.test(projectInfo.name)) {
if (checkIsNumberLetterChinese(projectInfo.name)) {
updateProjectRun({ ...projectInfo, product: "CADD" });
} else {
message.info(
......@@ -148,6 +148,7 @@ const BaseInfo = observer(() => {
const projectList = await getProjectList();
currentProjectStore.setProjectList(projectList);
currentProjectStore.changeProject(projectList[0]);
setFileServerEndPointLocalStorage(projectList[0].zoneId);
setProjectInfo(projectList[0]);
},
}
......
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-07 21:50:55
* @LastEditTime: 2022-06-11 15:24:15
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -18,7 +18,7 @@ import SearchIcon from "@mui/icons-material/Search";
import { IResponse, useHttp } from "@/api/http";
import { useStores } from "@/store";
import { useMessage } from "@/components/MySnackbar";
import Select, { IOption } from "@/components/mui/Select";
import MySelect, { IOption } from "@/components/mui/MySelect";
interface IProps {
setAddMemberDialog: (val: boolean) => void;
addMemberDialog: boolean;
......@@ -68,7 +68,7 @@ const AddMember = observer((props: IProps) => {
(every) => every.value === item
);
return (
<Select
<MySelect
input={<OutlinedInput />}
value={
defaultValue?.length
......
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-07 21:45:49
* @LastEditTime: 2022-06-11 15:25:23
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -11,7 +11,7 @@ import { memo, useEffect, useMemo, useState } from "react";
import { observer } from "mobx-react-lite";
import { toJS } from "mobx";
import Select, { IOption } from "@/components/mui/Select";
import MySelect, { IOption } from "@/components/mui/MySelect";
import Dialog from "@/components/mui/Dialog";
import { IResponse, useHttp } from "@/api/http";
import { useStores } from "@/store/index";
......@@ -93,7 +93,7 @@ const ChangePermission = observer((props: IProps) => {
title="更改权限"
>
<div style={{ marginTop: 12 }}>
<Select
<MySelect
title="项目权限"
value={selectValue}
onChange={changePermission}
......
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-07 21:39:30
* @LastEditTime: 2022-06-10 18:08:00
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -16,7 +16,6 @@ import SearchIcon from "@mui/icons-material/Search";
import Add from "@mui/icons-material/Add";
import Table from "@/components/Material.Ui/Table";
import { IResponse, useHttp } from "@/api/http";
import Input from "@/components/Material.Ui/Input";
import RemoveItem from "./components/RemoveItem";
import ChangePermission from "./components/ChangePermission";
import AddMember from "./components/AddMember";
......
......@@ -7,8 +7,7 @@ import { hpczone, addProject } from "@/api/project_api";
import { useMessage } from "@/components/MySnackbar";
import { getProjectList } from "../../project";
import { useStores } from "@/store";
const reg = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$");
import { checkIsNumberLetterChinese } from "@/utils/util";
type zoneIdOption = {
id: string;
......@@ -79,7 +78,7 @@ const AddProject = (props: any) => {
error: true,
help: "格式不正确,必须在30字符以内,仅限大小写字母、数字、中文",
});
} else if (reg.test(name)) {
} else if (checkIsNumberLetterChinese(name)) {
setNameCheck({
error: false,
help: "",
......@@ -159,6 +158,7 @@ const AddProject = (props: any) => {
value={name}
onChange={handleNameChange}
helperText={nameCheck.help}
size="small"
/>
<TextField
id="zoneId"
......@@ -169,6 +169,7 @@ const AddProject = (props: any) => {
onChange={handleZoneIdChange}
variant="outlined"
onClick={handleFromBox}
size="small"
>
{zoneIdOptions &&
zoneIdOptions.map((option) => (
......@@ -187,6 +188,7 @@ const AddProject = (props: any) => {
placeholder="请输入项目描述"
onChange={handleDescChange}
helperText={descCheck.help}
size="small"
/>
</div>
</MyDialog>
......
......@@ -7,36 +7,40 @@ import ProjectListPopper from "../ProjectListPopper";
import React, { useEffect, useState } from "react";
import { observer } from "mobx-react-lite";
import AddProject from "../AddProject";
import { setFileServerEndPointLocalStorage } from "@/views/Project/project";
const CurrentProject = observer(() => {
const { currentProjectStore } = useStores();
let addProjectRef: any = React.createRef();
const [open, setOpen] = useState(false);
// let addProjectRef: any = React.createRef();
const [projectListOpen, setProjectListOpen] = useState(false);
const [addProjectOpen, setAddProjectOpen] = useState(false);
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
// 结合handleShowProjectList中的event.nativeEvent.stopImmediatePropagation();实现点击空白区域隐藏项目列表
useEffect(()=>{
document.addEventListener('click', (e) => {
setOpen(false)
})
}, [])
useEffect(() => {
document.addEventListener("click", (e) => {
setProjectListOpen(false);
});
}, []);
const handleShowProjectList = (event: React.MouseEvent<HTMLElement>) => {
event.nativeEvent.stopImmediatePropagation();
setAnchorEl(event.currentTarget);
setOpen((previousOpen) => !previousOpen);
setProjectListOpen((previousOpen) => !previousOpen);
};
const canBeOpen = open && Boolean(anchorEl);
const canBeOpen = projectListOpen && Boolean(anchorEl);
const id = canBeOpen ? "spring-popper" : undefined;
const handleChangeCurrentProject = (project: any) => {
currentProjectStore.changeProject(project);
setOpen(!open);
setFileServerEndPointLocalStorage(project.zoneId);
setProjectListOpen(!projectListOpen);
};
const openAddProject = () => {
addProjectRef.current.handleClickOpen()
setOpen(false)
}
// addProjectRef.current.handleClickOpen();
setAddProjectOpen(true);
setProjectListOpen(false);
};
return (
<div>
......@@ -59,10 +63,10 @@ const CurrentProject = observer(() => {
style={{ fontSize: 12 }}
/>
</div>
<AddProject onRef={addProjectRef} />
<AddProject open={addProjectOpen} />
<Popper
id={id}
open={open}
open={projectListOpen}
anchorEl={anchorEl}
placement="right-start"
transition
......
import { product } from "@/api/project_api"
import { product, hpczone } from "@/api/project_api";
export const getProjectList = async () => {
const res = await product({product: "CADD",})
return res.data
}
\ No newline at end of file
const res = await product({ product: "CADD" });
return res.data;
};
export const setFileServerEndPointLocalStorage = async (zoneId: string) => {
const res = await hpczone();
console.log(res);
let fileServerEndPoint = "";
if (Array.isArray(res)) {
res.forEach((item: any) => {
if (item.id === zoneId) {
fileServerEndPoint = item.storageConfig.fileServerEndPoint;
}
});
localStorage.setItem("fileServerEndPoint", fileServerEndPoint);
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment