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