Commit a6823216 authored by 彭俊龙's avatar 彭俊龙

维保方案修改周计划

parent 2ea4d2d2
Pipeline #92880 failed with stages
......@@ -41,7 +41,7 @@ import {
} from '@ant-design/icons';
import styles from './maintenance.less';
import RuleConfig from '@/components/RuleConfig';
import { FormRender } from 'panda-xform';
// import { FormRender } from 'panda-xform';
import {
CM_XWBPlan_AccountTable,
NewCM_XWBPlan_feedbackTable,
......@@ -567,7 +567,7 @@ const AddModal = props => {
form.validateFields().then(validate => {
if (validate) {
let obj = form.getFieldsValue();
console.log(obj, 'objobjobjobj');
console.log(obj, 'objobjobjobj111');
let mappingFields = formAdd.getFieldValue('parmars');
mappingFields &&
mappingFields.forEach(i => {
......@@ -627,19 +627,35 @@ const AddModal = props => {
console.log(data, hasOverlappingIntervals(data.PlanDetails), '时间校验');
obj.inOrder = obj.inOrder ? 1 : 0;
obj.isDynamicCycle = obj.isDynamicCycle ? 1 : 0;
console.log('进来了', obj.time, data.cities, data.secondCity);
if (!obj.time) {
lastData.time = false;
lastData.StartExecLen = 0;
lastData.EndExecLen = 0;
// if (data.Unit === 'month') {
// lastData.StartExecLen = 0;
// lastData.EndExecLen = 31 - lastData.StartLen;
// } else if (data.Unit === 'week') {
// lastData.StartExecLen = 1;
// lastData.EndExecLen = 7;
// } else if (data.Unit === 'hour') {
// lastData.StartExecLen = 0;
// lastData.EndExecLen = 1;
// }
} else {
if (data.Unit === 'month') {
lastData.StartExecLen = 0;
lastData.EndExecLen = 31 - lastData.StartLen;
} else if (data.Unit === 'week') {
lastData.StartExecLen = 1;
lastData.EndExecLen = 7;
} else if (data.Unit === 'hour') {
}
else if (data.Unit === 'week') {
lastData.StartExecLen = data.cities;
lastData.EndExecLen = data.secondCity;
}
else if (data.Unit === 'hour') {
lastData.StartExecLen = 0;
lastData.EndExecLen = 1;
}
} else {
lastData.time = true;
}
obj.docycle = JSON.stringify(lastData);
......@@ -1830,7 +1846,8 @@ const AddModal = props => {
>
<Spin spinning={loading}>
{formJson ? (
<FormRender schemaValues={formJson} />
// <FormRender schemaValues={formJson} />
<></>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} style={{ marginTop: '300px' }} />
)}
......
......@@ -35,8 +35,8 @@ const BaseConfig = (props, ref) => {
const [MonthType2, setMonthType2] = useState(1);
const [MonthDayType1, setMonthDayType1] = useState('1'); // 月选择-日期
const [MonthDayType2, setMonthDayType2] = useState('31'); // 月选择-日期
const [cities, setCities] = useState('周一');
const [secondCity, setSecondCity] = useState(cityData[provinceData[0]][0]);
const [cities, setCities] = useState(1); //useState('周一');
const [secondCity, setSecondCity] = useState(1); // useState(cityData[provinceData[0]][0]);
const [startLen, setstartLen] = useState(1); // 开始日期
const [Unit, setValue] = useState();
const [visibleChecked, setVisibleChecked] = useState(false);
......@@ -120,8 +120,8 @@ const BaseConfig = (props, ref) => {
let zix = weekArr[props.keepTimeData.StartLen - 1]; // 执行开始周
setValue('week');
setstartLen(props.keepTimeData.StartLen);
setCities(cityData[zix][props.keepTimeData.StartExecLen - 1]);
setSecondCity(cityData[zix][props.keepTimeData.EndExecLen - 1]);
// setCities(cityData[zix][props.keepTimeData.StartExecLen - 1]);
// setSecondCity(cityData[zix][props.keepTimeData.EndExecLen - 1]);
} else if (props.keepTimeData?.Unit === '日') {
setValue('day');
setCycleLen(props.keepTimeData.CycleLen);
......@@ -173,8 +173,12 @@ const BaseConfig = (props, ref) => {
};
const handleProvinceChange = value => {
let arr = cityData[detailNumToWeek({ type: 'now', day: startLen })];
if (arr.indexOf(value) > arr.indexOf(secondCity)) {
// let arr = cityData[detailNumToWeek({ type: 'now', day: startLen })];
// if (arr.indexOf(value) > arr.indexOf(secondCity)) {
// setSecondCity(arr[arr.length - 1]);
// }
let arr = Array.form({ length: CycleLen * 7}, (v, k)=> k + 1);
if(value < secondCity){
setSecondCity(arr[arr.length - 1]);
}
setCities(value);
......@@ -267,9 +271,9 @@ const BaseConfig = (props, ref) => {
}}
onChange={value => {
setstartLen(value);
setCities(detailNumToWeek({ type: 'now', day: value }));
let arr = cityData[provinceData[value - 1]];
setSecondCity(arr[arr.length - 1]);
// setCities(detailNumToWeek({ type: 'now', day: value }));
// let arr = cityData[provinceData[value - 1]];
// setSecondCity(arr[arr.length - 1]);
}}
options={[1, 2, 3, 4, 5, 6, 7].map((city, i) => ({
label: weekArr[i],
......@@ -285,6 +289,8 @@ const BaseConfig = (props, ref) => {
}}
onChange={value => {
setCycleLen(value);
setCities(1);
setSecondCity(value * 7);
}}
options={[1, 2, 3].map(province => ({
label: province,
......@@ -671,6 +677,7 @@ const BaseConfig = (props, ref) => {
}
}
} else if (value == 'week') {
const numList = Array.from({ length: 7 * CycleLen}, (v, k) => k + 1);
return (
<>
<span style={{ marginRight: '5px' }}>将会在</span>
......@@ -682,11 +689,15 @@ const BaseConfig = (props, ref) => {
width: 90,
}}
onChange={handleProvinceChange}
options={cityData[detailNumToWeek({ type: 'now', day: startLen })].map(city => ({
options={numList.map(city => ({
label: city,
value: city,
}))}
/>{' '}
// options={cityData[detailNumToWeek({ type: 'now', day: startLen })].map(city => ({
// label: city,
// value: city,
// }))}
/>{' 日'}
<span
style={{
margin: '5px',
......@@ -700,12 +711,18 @@ const BaseConfig = (props, ref) => {
}}
value={secondCity}
onChange={onSecondCityChange}
options={cityData[detailNumToWeek({ type: 'now', day: startLen })].map((city, i) => ({
options={numList.map((city, i) => ({
label: city,
value: city,
disabled:
i < cityData[detailNumToWeek({ type: 'now', day: startLen })].indexOf(cities),
i < numList.indexOf(cities),
}))}
// options={cityData[detailNumToWeek({ type: 'now', day: startLen })].map((city, i) => ({
// label: city,
// value: city,
// disabled:
// i < cityData[detailNumToWeek({ type: 'now', day: startLen })].indexOf(cities),
// }))}
/>
<span
style={{
......
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