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

fix: '新维保方案'

parent abc8a0ec
Pipeline #79819 failed with stages
......@@ -124,6 +124,7 @@
"lodash": "4.17.11",
"minimist": "1.2.0",
"panda-xform": "^5.2.2",
"parseForm": "^2.3.8",
"prop-types": "15.7.2",
"quill": "^1.3.7",
"rc-tween-one": "^3.0.6",
......
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { Table } from 'antd';
import { HTML5Backend } from 'react-dnd-html5-backend';
......@@ -7,21 +7,29 @@ import { DndProvider } from 'react-dnd';
import DraggableBodyRow from './DraggableBodyRow';
const DragTable = props => {
const { columns, dataSource, dragCallBack, ItemTypes } = props;
const { columns, dataSource, dragCallBack, ItemTypes, editEventType, setSelectColor } = props;
const [data, setData] = useState(null); // 分组后的数组
const moving = useRef(false);
const components = {
body: {
row: DraggableBodyRow,
},
};
useEffect(() => {
moving.current = false;
if (dataSource.length > 0) {
setData(dataSource);
}
}, [dataSource]);
// 每次拖拽后返回
useEffect(() => {
dragCallBack(data);
if (ItemTypes === 'maintenance') {
let moveState = moving.current;
let val = { data, moveState };
dragCallBack(val);
} else {
dragCallBack(data);
}
}, [data]);
// 移动数组元素到指定位置
const moveInArray = (arr, from, to) => {
......@@ -41,6 +49,7 @@ const DragTable = props => {
};
// 拖拽表格
const moveRow = (dragIndex, hoverIndex) => {
moving.current = true;
setData(val => {
let newData = JSON.parse(JSON.stringify(val));
newData = moveInArray(newData, dragIndex, hoverIndex);
......@@ -50,19 +59,40 @@ const DragTable = props => {
return (
<div>
<DndProvider backend={HTML5Backend}>
<Table
bordered
columns={columns}
dataSource={data}
components={components}
onRow={(record, index) => ({
index,
ItemTypes,
moveRow,
onClick: () => props.onClick && props.onClick(record),
})}
{...props}
/>
{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
bordered
columns={columns}
dataSource={data}
components={components}
onRow={(record, index) => ({
index,
ItemTypes,
moveRow,
onClick: () => props.onClick && props.onClick(record),
})}
{...props}
/>
)}
</DndProvider>
</div>
);
......
.baseForm {
display: flex;
flex-wrap: wrap;
width: 100%;
justify-content: space-between;
margin-top: 15px;
}
.FormLast {
color: red;
}
.maintenanceContainer {
height: 100%;
.ant-table-body {
height: calc(100vh - 150px) !important;
width: 100%;
}
.ant-table-tbody {
.clickRowStyle {
background: #cfe7fd;
}
.clickRowStyle:hover > td {
background: #aed8fa;
}
}
.contentContainers {
height: 100%;
......@@ -24,7 +36,7 @@
margin-left: 10px;
height: 100%;
>div {
> div {
margin-right: 10px;
border: 1px solid gainsboro;
padding: 5px 10px;
......@@ -33,8 +45,8 @@
cursor: pointer;
}
&.active {
border-color: rgb(24,144,255);
color: rgb(24,144,255);
border-color: rgb(24, 144, 255);
color: rgb(24, 144, 255);
}
}
}
......@@ -53,7 +65,8 @@
height: 38rem;
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;
}
......@@ -88,7 +101,6 @@
}
.optionModal {
}
.doctorTable {
......@@ -148,12 +160,12 @@
width: 300px;
overflow: hidden;
white-space: nowrap;
margin-top:6px;
margin-top: 6px;
.ant-checkbox + span {
// width: 280px;
// overflow: hidden;
// text-overflow: ellipsis;
}
}
}
}
}
......@@ -173,4 +185,44 @@
z-index: 1000;
height: 99%;
overflow: hidden;
}
\ No newline at end of file
}
.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,16 +106,20 @@ const TileData = props => {
GetMaplayerByTerminalType({
terminalType: 'baseMapscheme',
isBaseMap: false,
}).then(res => {
console.log('res', res);
if (res.code == '0') {
setTreeLoading(false);
console.log(res.data.optionalLayer.layers);
setCardData(res.data.optionalLayer.layers);
} else {
})
.then(res => {
console.log('res', res);
if (res.code == '0') {
setTreeLoading(false);
console.log(res.data.optionalLayer.layers);
setCardData(res.data.optionalLayer.layers);
} else {
setTreeLoading(false);
}
})
.catch(() => {
setTreeLoading(false);
}
});
});
}, [flagAdd]);
const changebaseMap = record => {
setType('edit');
......@@ -204,28 +208,32 @@ const TileData = props => {
GettMaplayer({
terminalType: 'base',
isBaseMap: true,
}).then(res => {
if (res.code == '0') {
setTreeLoading(false);
setTileData(res.data.general.baseMap.layers);
let data = [];
res.data.general.baseMap.layers.map(item => {
data.push(item.servicename);
let index = baseMapData.indexOf(item.servicename);
if (index != -1) {
baseMapData.splice(index, 1);
}
});
setName(data);
setBaseMap(baseMapData);
} else {
})
.then(res => {
if (res.code == '0') {
setTreeLoading(false);
setTileData(res.data.general.baseMap.layers);
let data = [];
res.data.general.baseMap.layers.map(item => {
data.push(item.servicename);
let index = baseMapData.indexOf(item.servicename);
if (index != -1) {
baseMapData.splice(index, 1);
}
});
setName(data);
setBaseMap(baseMapData);
} else {
setTreeLoading(false);
notification.error({
message: '获取失败',
description: res.message,
});
}
})
.catch(() => {
setTreeLoading(false);
notification.error({
message: '获取失败',
description: res.message,
});
}
});
});
};
const addType = () => {
......
......@@ -147,7 +147,7 @@ const VectorPreviewModal = props => {
getMapInfo={e => getMapInfo(e)}
config={currentMeta}
client="sandbox"
// widgets={[]}
widgets={[]}
/>
)}
</div>
......
......@@ -381,7 +381,7 @@ export default {
},
{
path: '/biz/patrolMaintenance/maintenance',
name: '维保模板',
name: '维保方案',
component: Maintenance,
},
],
......
......@@ -98,6 +98,18 @@ const bizDataAdapter = response => {
return response;
};
// 7. 请求超时
const bizTimeoutHandler = response => {
const { status } = response;
if (status === 500) {
notification.warning({
title: '提示',
message: '请求超时',
duration: 4,
});
}
};
export default {
bizDataAdapter,
bizDevErrorAdapter,
......@@ -105,4 +117,5 @@ export default {
bizSuccessMessageAdapter,
bizNotifyHandler,
bizRedirectHandler,
bizTimeoutHandler,
};
......@@ -8,6 +8,7 @@ import isFunction from 'lodash/isFunction';
import extendConfig from './defaultConfig';
const globalConfig = {
bizRedirectHandler: extendConfig.bizRedirectHandler,
bizTimeoutHandler: extendConfig.bizTimeoutHandler,
};
const globalConfigMatchers = [];
/* no-unused-vars */
......@@ -27,6 +28,7 @@ const getMatchedConfig = requestConfig => {
}
};
axios.defaults.withCredentials = true;
axios.defaults.timeout = 60000;
axios.interceptors.request.use(
function(request) {
const token = localStorage.getItem('token');
......@@ -68,6 +70,8 @@ axios.interceptors.response.use(
switch (error.response.status) {
case 401:
globalConfig.bizRedirectHandler(error.response);
case 500:
globalConfig.bizTimeoutHandler(error.response);
}
}
return Promise.reject(error);
......@@ -104,6 +108,7 @@ export const request = (config, ctx) => {
bizDataAdapter,
bizParamsAdapter,
bizRequestAdapter,
bizTimeoutHandler,
} = curConf;
let finalParams = params || {};
......@@ -162,6 +167,11 @@ export const request = (config, ctx) => {
// 6. 数据转换
const data = bizDataAdapter ? bizDataAdapter(res) : res;
// 7. 请求超时
if (bizTimeoutHandler) {
bizTimeoutHandler(res);
}
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