Commit 4060c07f authored by mayongxin's avatar mayongxin
parent dcbc9618
Pipeline #27937 passed with stages
in 25 minutes 45 seconds
......@@ -9,22 +9,25 @@ import { get, PUBLISH_SERVICE } from '@/services';
import styles from './index.less';
import { getImageBases } from '@/services/common/api';
import UploadContext from './context.js'
import _, { clone } from 'lodash'
const { TabPane } = Tabs;
const { TabPane } = Tabs;
const { Search } = Input;
// 维护图片分类映射
const wallCateName: any = {
icon: '图标',
bg: '背景',
uploaded: '上传',
};
const tabNames:any = {
const tabNames: any = {
CityTemp: '用户上传',
icon: 'icon图标',
androidMenu: '移动应用图标',
menuNew: '应用图标',
logo:'项目logo',
menu:'菜单图标'
logo: '项目logo',
menu: '菜单图标'
}
function getBase64(file: File | Blob) {
......@@ -45,7 +48,7 @@ interface PicturesWallType {
onChange?: (v: any) => void;
cropRate?: number | boolean;
isCrop?: boolean;
type?: 'CityTemp'|'icon'|'androidMenu'|'menuNew',
type?: 'CityTemp' | 'icon' | 'androidMenu' | 'menuNew',
value?: string | string[],
uploadContext: any,
search: string,
......@@ -61,8 +64,8 @@ class PicturesWall extends React.Component<PicturesWallType> {
previewTitle: '',
imgBed: this.props.uploadContext?.imgBed || [],
curSelectedImg: '',
baseUrl:'',
prevProps:{},
baseUrl: '',
prevProps: {},
search: '',
actives: {},
fileList: this.props.value ? Array.isArray(this.props.value) ? this.props.value.map((v) => ({
......@@ -70,7 +73,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
uid: uuid(8, 16),
name: '熊猫运维中台系统',
status: 'done',
})) as UploadFile<any>[]: [{
})) as UploadFile<any>[] : [{
url: this.props.value,
uid: uuid(8, 16),
name: '熊猫运维中台系统',
......@@ -85,11 +88,11 @@ class PicturesWall extends React.Component<PicturesWallType> {
* @param state
*/
static getDerivedStateFromProps = (props, state) => {
const {value, uploadContext = {}} = props;
const { value, uploadContext = {} } = props;
const { imgBed, update } = uploadContext;
const fileList = state.fileList;
const shouldUpdate = fileList.every(f => Array.isArray(value) ? !value.some(v => f.url === v) : f.url !== value)
if(value !== state.prevProps.value && shouldUpdate){
if (value !== state.prevProps.value && shouldUpdate) {
return {
prevProps: props,
fileList: Array.isArray(value) ? value.map((v) => ({
......@@ -97,7 +100,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
uid: uuid(8, 16),
name: '熊猫运维中台系统',
status: 'done',
})) as UploadFile<any>[]: value? [{
})) as UploadFile<any>[] : value ? [{
url: value,
uid: uuid(8, 16),
name: '熊猫运维中台系统',
......@@ -105,7 +108,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
}] as UploadFile<any>[] : []
}
}
if(imgBed != state.prevProps.uploadContext?.imgBed){
if (imgBed != state.prevProps.uploadContext?.imgBed) {
const activeKeys = {};
imgBed.forEach(item => activeKeys[item.moduleName] = item.child.map(c => c.moduleName));
return {
......@@ -119,15 +122,15 @@ class PicturesWall extends React.Component<PicturesWallType> {
};
}
update = () =>{
if(this.props.value){
update = () => {
if (this.props.value) {
this.setState({
fileList: Array.isArray(this.props.value) ? this.props.value.map((v) => ({
url: v,
uid: uuid(8, 16),
name: '熊猫运维中台系统',
status: 'done',
})) as UploadFile<any>[]: [{
})) as UploadFile<any>[] : [{
url: this.props.value,
uid: uuid(8, 16),
name: '熊猫运维中台系统',
......@@ -159,10 +162,10 @@ class PicturesWall extends React.Component<PicturesWallType> {
});
};
handleImgSelected = (url: string,baseUrl:any) => {
handleImgSelected = (url: string, baseUrl: any) => {
this.setState({
curSelectedImg: url,
baseUrl:baseUrl
baseUrl: baseUrl
});
};
......@@ -174,7 +177,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
handleModalOk = () => {
const { maxLen = 1 } = this.props;
const { baseUrl,curSelectedImg} = this.state
const { baseUrl, curSelectedImg } = this.state
const fileList = [
{
uid: uuid(8, 16),
......@@ -183,20 +186,20 @@ class PicturesWall extends React.Component<PicturesWallType> {
url: curSelectedImg,
},
];
if(!curSelectedImg){
if (!curSelectedImg) {
message.warn({
duration:2,
content:'请先选择图片'
duration: 2,
content: '请先选择图片'
})
return
}
if(curSelectedImg.includes('CityTemp')){
localStorage.setItem('pd-baseUrl',baseUrl)
}else{
localStorage.setItem('pd2-baseUrl',baseUrl)
if (curSelectedImg.includes('CityTemp')) {
localStorage.setItem('pd-baseUrl', baseUrl)
} else {
localStorage.setItem('pd2-baseUrl', baseUrl)
}
console.log(fileList[0].url)
this.props.onChange && this.props.onChange( maxLen === 1 ? fileList[0].url.replace('Web4\\', '') : fileList.map(f => f.url.replace('Web4\\', '')));
this.props.onChange && this.props.onChange(maxLen === 1 ? fileList[0].url.replace('Web4\\', '') : fileList.map(f => f.url.replace('Web4\\', '')));
this.setState({ fileList, wallModalVisible: false });
};
......@@ -206,11 +209,11 @@ class PicturesWall extends React.Component<PicturesWallType> {
if (file.status === 'done') {
const files = fileList.map(item => {
const { status, name, thumbUrl } = item;
const url = item.response && item.response.data || thumbUrl ;
const url = item.response && item.response.data || thumbUrl;
return { uid: uuid(8, 16), name, status, url };
});
this.setState({fileList: files})
this.props.onChange && this.props.onChange( maxLen === 1 ? files[0].url : files.map(f => f.url));
this.setState({ fileList: files })
this.props.onChange && this.props.onChange(maxLen === 1 ? files[0].url : files.map(f => f.url));
uploadContext?.update && uploadContext.update()
}
};
......@@ -240,35 +243,35 @@ class PicturesWall extends React.Component<PicturesWallType> {
// })
// }
getImageUrl(path){
if(path&&path.indexOf('http') === 0){
getImageUrl(path) {
if (path && path.indexOf('http') === 0) {
return path
}
if(path&&path.indexOf('data:') === 0) {
if (path && path.indexOf('data:') === 0) {
return path
}
if(path && path.indexOf('assets') === 0) {
if (path && path.indexOf('assets') === 0) {
return `${window.location.origin}/Web4/${path}`.replace(/\\/g, '/')
}
return `${window.location.origin}/${path}`.replace(/\\/g, '/')
}
getFileName(path:string){
getFileName(path: string) {
const match = path.match(/(?<=[\/\\])([^\\\/\.]*)(\.?\w*)$/)
return match&&match[1]||''
return match && match[1] || ''
}
renderImgItem(url,baseUrl){
renderImgItem(url, baseUrl) {
const fileName = this.getFileName(url)
const {curSelectedImg, search} = this.state;
const { curSelectedImg, search } = this.state;
return (
<div
className={classnames({
[styles.imgItem]:true,
[styles.imgItem]: true,
[styles.hide]: !fileName.includes(search)
})}
key={url}
onClick={() => this.handleImgSelected(url,baseUrl)}>
onClick={() => this.handleImgSelected(url, baseUrl)}>
<div
className={classnames(
curSelectedImg === url ? styles.seleted : '',
......@@ -290,10 +293,10 @@ class PicturesWall extends React.Component<PicturesWallType> {
);
}
renderCollapse(module){
renderCollapse(module) {
const { Panel } = Collapse;
const items = module.fileUrls.map(url =>this.renderImgItem(url,module.baseUrl))
return items.length>0&&<Panel
const items = module.fileUrls.map(url => this.renderImgItem(url, module.baseUrl))
return items.length > 0 && <Panel
forceRender
header={module.moduleName}
key={module.moduleName}>
......@@ -301,8 +304,8 @@ class PicturesWall extends React.Component<PicturesWallType> {
</Panel>
}
handleCollapseChange(v, moduleName){
const activeKeys = {...this.state.actives}
handleCollapseChange(v, moduleName) {
const activeKeys = { ...this.state.actives }
activeKeys[moduleName] = v;
this.setState({
actives: activeKeys
......@@ -321,7 +324,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
curSelectedImg,
} = this.state;
const {
action = `${window.location.origin}${PUBLISH_SERVICE}/FileCenter/UploadSingleFile` ,
action = `${window.location.origin}${PUBLISH_SERVICE}/FileCenter/UploadSingleFile`,
headers,
withCredentials = true,
maxLen = 1,
......@@ -336,6 +339,38 @@ class PicturesWall extends React.Component<PicturesWallType> {
<div className="ant-upload-text">上传</div>
</div>
);
const onSearch = (key) => {
const bed = this.props.uploadContext.imgBed
const nodes = _.cloneDeep(bed)
for(const node of nodes){
arrayTreeFilter(node,key)
}
console.log(nodes)
this.setState({imgBed:nodes})
}
const arrayTreeFilter = (node,key) => {
let reg = new RegExp(`/${key}/g`)
for (const nodeItem of node.child) {
if ( nodeItem.child.length < 1) {
if(!reg.test(nodeItem.moduleName)){
node.child.splice(nodeItem,1)
console.log(nodeItem.moduleName,"--------------------移除图包-----------------")
}
}else{
arrayTreeFilter(nodeItem,key);
}
}
}
return (
<>
......@@ -348,7 +383,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
aspect={cropRate as number}
>
<Upload
fileList={fileList.map(f => ({...f, url: this.getImageUrl(f.url) }))}
fileList={fileList.map(f => ({ ...f, url: this.getImageUrl(f.url) }))}
onPreview={this.handlePreview}
onChange={this.handleChange}
name="singleFile"
......@@ -368,7 +403,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
</ImgCrop>
) : (
<Upload
fileList={fileList.map(f => ({...f, url: this.getImageUrl(f.url) }))}
fileList={fileList.map(f => ({ ...f, url: this.getImageUrl(f.url) }))}
onPreview={this.handlePreview}
onChange={this.handleChange}
name="singleFile"
......@@ -407,20 +442,21 @@ class PicturesWall extends React.Component<PicturesWallType> {
onOk={this.handleModalOk}
className={styles.modal}
>
<Search onSearch={onSearch} />
<Tabs defaultActiveKey={imgBed[0]?.moduleName} tabPosition="left" style={{ height: 520 }}>
{imgBed.map((item, i) => {
if(item.moduleName==picType || item.moduleName=='CityTemp'){
if (item.moduleName == picType || item.moduleName == 'CityTemp') {
const child = [...item.child] || [];
if(item.fileUrls.length > 0){
if (item.fileUrls.length > 0) {
child.push({
moduleName: item.moduleName,
fileUrls: item.fileUrls,
child: [],
baseUrl:item.baseUrl
baseUrl: item.baseUrl
})
}
return (
<TabPane tab={tabNames[item.moduleName]||item.moduleName} key={item.moduleName}>
<TabPane tab={tabNames[item.moduleName] || item.moduleName} key={item.moduleName}>
{/* <Input
placeholder="搜索图库"
className={styles.search}
......@@ -452,7 +488,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
const PicturesWallWrapper = (props: any) => {
return <UploadContext.Consumer>
{(uploadContext) => <PicturesWall {...props} uploadContext={uploadContext}/>}
{(uploadContext) => <PicturesWall {...props} uploadContext={uploadContext} />}
</UploadContext.Consumer>
}
export default PicturesWallWrapper;
......@@ -18,6 +18,7 @@ import { EditTwoTone, DeleteOutlined } from '@ant-design/icons';
import { get, CITY_SERVICE } from '@/services';
import styles from './WebDic.less';
const {Search} = Input;
const WebDic = () => {
const [loading, setLoading] = useState(false);
const [level, setLevel] = useState(0); // 设置级别,一级1,二级2,添加条目时使用
......@@ -272,6 +273,9 @@ const WebDic = () => {
showQuickJumper: true,
showSizeChanger: true,
};
const onSearch = (key)=>{
}
return (
<div className={styles.WebDic}>
......@@ -283,6 +287,7 @@ const WebDic = () => {
<Button type="primary" size="small" onClick={() => setItem(1)}>
添加
</Button>
<Search style={{width:"300px",marginLeft:"10px"}} onSearch={onSearch}/>
</div>
{/* 一级条目 表格 */}
<Table
......
import React, { useState, useEffect } from 'react'
import { Descriptions } from 'antd'
import { Button, Descriptions, Input } from 'antd'
import styles from './BaseConfig.less'
import { S_GetDataBaseConfig, GetTCPConfigInfo, GetDataBaseConfig, GetBasicInfo } from '@/services/platform/hostmanager'
......@@ -72,9 +72,16 @@ const BaseConfig = () => {
}
return (
<div className={styles.base_container}>
<div style={{ backgroundColor: "white", padding: "10px", width: "400px" }}>
<div style={{ backgroundColor: "white", padding: "10px", width: "100%" }}>
<Descriptions title="" bordered >
<Descriptions.Item label="站点编号" span={3}>{currentSiteInfo}</Descriptions.Item>
<Descriptions.Item label="站点编号" span={3}>
{
!currentSiteInfo?<Input value={currentSiteInfo} disabled={true} style={{with:"200px"}}/>:<div>
<Input value={currentSiteInfo} style={{with:"200px"}} disabled={true}/>
<Button>生成编号</Button>
</div>
}
</Descriptions.Item>
<Descriptions.Item label="服务器IP" span={3}>{currentDataBase.ip}</Descriptions.Item>
<Descriptions.Item label="数据库名称" span={3}>{currentDataBase.dbName}</Descriptions.Item>
<Descriptions.Item label="登录名" span={1}>{currentDataBase.userName}</Descriptions.Item>
......
......@@ -871,8 +871,8 @@ const UserManage = () => {
// message.error(err);
// });
DeleteUserNew({
userID:`"${currentUser.userID}"`,
ouID:`"${currentUser.OUID}"`
userID:currentUser.userID,
ouID:currentUser.OUID
}).then(res => {
if (res.code == 0) {
setDeleteUserVisible(false);
......
......@@ -199,11 +199,11 @@ export default {
},
],
},
{
path: '/platformCenter/order',
name: '业务平台',
component: JumpContainer,
},
// {
// path: '/platformCenter/order',
// name: '业务平台',
// component: JumpContainer,
// },
{
path: '/platformCenter/notify',
name: '消息平台',
......
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