Commit d461d0aa authored by 皮倩雯's avatar 皮倩雯

fix: '新维保方案'

parent abc8a0ec
Pipeline #79819 failed with stages
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
"lodash": "4.17.11", "lodash": "4.17.11",
"minimist": "1.2.0", "minimist": "1.2.0",
"panda-xform": "^5.2.2", "panda-xform": "^5.2.2",
"parseForm": "^2.3.8",
"prop-types": "15.7.2", "prop-types": "15.7.2",
"quill": "^1.3.7", "quill": "^1.3.7",
"rc-tween-one": "^3.0.6", "rc-tween-one": "^3.0.6",
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Table } from 'antd'; import { Table } from 'antd';
import { HTML5Backend } from 'react-dnd-html5-backend'; import { HTML5Backend } from 'react-dnd-html5-backend';
...@@ -7,21 +7,29 @@ import { DndProvider } from 'react-dnd'; ...@@ -7,21 +7,29 @@ import { DndProvider } from 'react-dnd';
import DraggableBodyRow from './DraggableBodyRow'; import DraggableBodyRow from './DraggableBodyRow';
const DragTable = props => { const DragTable = props => {
const { columns, dataSource, dragCallBack, ItemTypes } = props; const { columns, dataSource, dragCallBack, ItemTypes, editEventType, setSelectColor } = props;
const [data, setData] = useState(null); // 分组后的数组 const [data, setData] = useState(null); // 分组后的数组
const moving = useRef(false);
const components = { const components = {
body: { body: {
row: DraggableBodyRow, row: DraggableBodyRow,
}, },
}; };
useEffect(() => { useEffect(() => {
moving.current = false;
if (dataSource.length > 0) { if (dataSource.length > 0) {
setData(dataSource); setData(dataSource);
} }
}, [dataSource]); }, [dataSource]);
// 每次拖拽后返回 // 每次拖拽后返回
useEffect(() => { useEffect(() => {
if (ItemTypes === 'maintenance') {
let moveState = moving.current;
let val = { data, moveState };
dragCallBack(val);
} else {
dragCallBack(data); dragCallBack(data);
}
}, [data]); }, [data]);
// 移动数组元素到指定位置 // 移动数组元素到指定位置
const moveInArray = (arr, from, to) => { const moveInArray = (arr, from, to) => {
...@@ -41,6 +49,7 @@ const DragTable = props => { ...@@ -41,6 +49,7 @@ const DragTable = props => {
}; };
// 拖拽表格 // 拖拽表格
const moveRow = (dragIndex, hoverIndex) => { const moveRow = (dragIndex, hoverIndex) => {
moving.current = true;
setData(val => { setData(val => {
let newData = JSON.parse(JSON.stringify(val)); let newData = JSON.parse(JSON.stringify(val));
newData = moveInArray(newData, dragIndex, hoverIndex); newData = moveInArray(newData, dragIndex, hoverIndex);
...@@ -50,6 +59,26 @@ const DragTable = props => { ...@@ -50,6 +59,26 @@ const DragTable = props => {
return ( return (
<div> <div>
<DndProvider backend={HTML5Backend}> <DndProvider backend={HTML5Backend}>
{ItemTypes === 'maintenance' ? (
<Table
bordered
columns={columns}
dataSource={data}
components={components}
onRow={(record, index) => ({
index,
ItemTypes,
moveRow,
onClick: () => props.onClick && props.onClick(record),
onDoubleClick: event => {
event.stopPropagation();
setSelectColor(record.id);
editEventType(record);
}, // 双击
})}
{...props}
/>
) : (
<Table <Table
bordered bordered
columns={columns} columns={columns}
...@@ -63,6 +92,7 @@ const DragTable = props => { ...@@ -63,6 +92,7 @@ const DragTable = props => {
})} })}
{...props} {...props}
/> />
)}
</DndProvider> </DndProvider>
</div> </div>
); );
......
.baseForm {
display: flex;
flex-wrap: wrap;
width: 100%;
justify-content: space-between;
margin-top: 15px;
}
.FormLast {
color: red;
}
.maintenanceContainer { .maintenanceContainer {
height: 100%; height: 100%;
.ant-table-body {
height: calc(100vh - 150px) !important;
width: 100%;
}
.ant-table-tbody {
.clickRowStyle {
background: #cfe7fd;
}
.clickRowStyle:hover > td {
background: #aed8fa;
}
}
.contentContainers { .contentContainers {
height: 100%; height: 100%;
...@@ -24,7 +36,7 @@ ...@@ -24,7 +36,7 @@
margin-left: 10px; margin-left: 10px;
height: 100%; height: 100%;
>div { > div {
margin-right: 10px; margin-right: 10px;
border: 1px solid gainsboro; border: 1px solid gainsboro;
padding: 5px 10px; padding: 5px 10px;
...@@ -33,8 +45,8 @@ ...@@ -33,8 +45,8 @@
cursor: pointer; cursor: pointer;
} }
&.active { &.active {
border-color: rgb(24,144,255); border-color: rgb(24, 144, 255);
color: rgb(24,144,255); color: rgb(24, 144, 255);
} }
} }
} }
...@@ -53,7 +65,8 @@ ...@@ -53,7 +65,8 @@
height: 38rem; height: 38rem;
overflow-y: scroll; overflow-y: scroll;
.ant-form-item-label>label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before { .ant-form-item-label
> label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
display: none; display: none;
} }
...@@ -88,7 +101,6 @@ ...@@ -88,7 +101,6 @@
} }
.optionModal { .optionModal {
} }
.doctorTable { .doctorTable {
...@@ -148,7 +160,7 @@ ...@@ -148,7 +160,7 @@
width: 300px; width: 300px;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
margin-top:6px; margin-top: 6px;
.ant-checkbox + span { .ant-checkbox + span {
// width: 280px; // width: 280px;
// overflow: hidden; // overflow: hidden;
...@@ -174,3 +186,43 @@ ...@@ -174,3 +186,43 @@
height: 99%; height: 99%;
overflow: hidden; overflow: hidden;
} }
.titleIcon {
display: flex;
align-items: center;
margin-bottom: 10px;
.icon {
width: 3px;
height: 14px;
background-color: #0389f7;
margin-right: 10px;
border-radius: 10px;
}
.font {
font-size: 15px;
font-weight: bold;
}
}
.labelItem {
display: flex;
align-items: center;
}
:global {
.editable-cell {
position: relative;
}
.editable-cell-value-wrap {
padding: 5px 12px;
cursor: pointer;
}
.editable-row:hover .editable-cell-value-wrap {
padding: 4px 11px;
border: 1px solid #d9d9d9;
border-radius: 2px;
}
[data-theme='dark'] .editable-row:hover .editable-cell-value-wrap {
border: 1px solid #434343;
}
}
...@@ -106,7 +106,8 @@ const TileData = props => { ...@@ -106,7 +106,8 @@ const TileData = props => {
GetMaplayerByTerminalType({ GetMaplayerByTerminalType({
terminalType: 'baseMapscheme', terminalType: 'baseMapscheme',
isBaseMap: false, isBaseMap: false,
}).then(res => { })
.then(res => {
console.log('res', res); console.log('res', res);
if (res.code == '0') { if (res.code == '0') {
setTreeLoading(false); setTreeLoading(false);
...@@ -115,6 +116,9 @@ const TileData = props => { ...@@ -115,6 +116,9 @@ const TileData = props => {
} else { } else {
setTreeLoading(false); setTreeLoading(false);
} }
})
.catch(() => {
setTreeLoading(false);
}); });
}, [flagAdd]); }, [flagAdd]);
const changebaseMap = record => { const changebaseMap = record => {
...@@ -204,7 +208,8 @@ const TileData = props => { ...@@ -204,7 +208,8 @@ const TileData = props => {
GettMaplayer({ GettMaplayer({
terminalType: 'base', terminalType: 'base',
isBaseMap: true, isBaseMap: true,
}).then(res => { })
.then(res => {
if (res.code == '0') { if (res.code == '0') {
setTreeLoading(false); setTreeLoading(false);
setTileData(res.data.general.baseMap.layers); setTileData(res.data.general.baseMap.layers);
...@@ -225,6 +230,9 @@ const TileData = props => { ...@@ -225,6 +230,9 @@ const TileData = props => {
description: res.message, description: res.message,
}); });
} }
})
.catch(() => {
setTreeLoading(false);
}); });
}; };
......
...@@ -147,7 +147,7 @@ const VectorPreviewModal = props => { ...@@ -147,7 +147,7 @@ const VectorPreviewModal = props => {
getMapInfo={e => getMapInfo(e)} getMapInfo={e => getMapInfo(e)}
config={currentMeta} config={currentMeta}
client="sandbox" client="sandbox"
// widgets={[]} widgets={[]}
/> />
)} )}
</div> </div>
......
...@@ -381,7 +381,7 @@ export default { ...@@ -381,7 +381,7 @@ export default {
}, },
{ {
path: '/biz/patrolMaintenance/maintenance', path: '/biz/patrolMaintenance/maintenance',
name: '维保模板', name: '维保方案',
component: Maintenance, component: Maintenance,
}, },
], ],
......
...@@ -98,6 +98,18 @@ const bizDataAdapter = response => { ...@@ -98,6 +98,18 @@ const bizDataAdapter = response => {
return response; return response;
}; };
// 7. 请求超时
const bizTimeoutHandler = response => {
const { status } = response;
if (status === 500) {
notification.warning({
title: '提示',
message: '请求超时',
duration: 4,
});
}
};
export default { export default {
bizDataAdapter, bizDataAdapter,
bizDevErrorAdapter, bizDevErrorAdapter,
...@@ -105,4 +117,5 @@ export default { ...@@ -105,4 +117,5 @@ export default {
bizSuccessMessageAdapter, bizSuccessMessageAdapter,
bizNotifyHandler, bizNotifyHandler,
bizRedirectHandler, bizRedirectHandler,
bizTimeoutHandler,
}; };
...@@ -8,6 +8,7 @@ import isFunction from 'lodash/isFunction'; ...@@ -8,6 +8,7 @@ import isFunction from 'lodash/isFunction';
import extendConfig from './defaultConfig'; import extendConfig from './defaultConfig';
const globalConfig = { const globalConfig = {
bizRedirectHandler: extendConfig.bizRedirectHandler, bizRedirectHandler: extendConfig.bizRedirectHandler,
bizTimeoutHandler: extendConfig.bizTimeoutHandler,
}; };
const globalConfigMatchers = []; const globalConfigMatchers = [];
/* no-unused-vars */ /* no-unused-vars */
...@@ -27,6 +28,7 @@ const getMatchedConfig = requestConfig => { ...@@ -27,6 +28,7 @@ const getMatchedConfig = requestConfig => {
} }
}; };
axios.defaults.withCredentials = true; axios.defaults.withCredentials = true;
axios.defaults.timeout = 60000;
axios.interceptors.request.use( axios.interceptors.request.use(
function(request) { function(request) {
const token = localStorage.getItem('token'); const token = localStorage.getItem('token');
...@@ -68,6 +70,8 @@ axios.interceptors.response.use( ...@@ -68,6 +70,8 @@ axios.interceptors.response.use(
switch (error.response.status) { switch (error.response.status) {
case 401: case 401:
globalConfig.bizRedirectHandler(error.response); globalConfig.bizRedirectHandler(error.response);
case 500:
globalConfig.bizTimeoutHandler(error.response);
} }
} }
return Promise.reject(error); return Promise.reject(error);
...@@ -104,6 +108,7 @@ export const request = (config, ctx) => { ...@@ -104,6 +108,7 @@ export const request = (config, ctx) => {
bizDataAdapter, bizDataAdapter,
bizParamsAdapter, bizParamsAdapter,
bizRequestAdapter, bizRequestAdapter,
bizTimeoutHandler,
} = curConf; } = curConf;
let finalParams = params || {}; let finalParams = params || {};
...@@ -162,6 +167,11 @@ export const request = (config, ctx) => { ...@@ -162,6 +167,11 @@ export const request = (config, ctx) => {
// 6. 数据转换 // 6. 数据转换
const data = bizDataAdapter ? bizDataAdapter(res) : res; const data = bizDataAdapter ? bizDataAdapter(res) : res;
// 7. 请求超时
if (bizTimeoutHandler) {
bizTimeoutHandler(res);
}
resolve(data); resolve(data);
}), }),
); );
......
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