Commit 563e8a01 authored by 皮倩雯's avatar 皮倩雯

fix: '方案制定执行时间增加半年一年一次'

parent 6881d902
Pipeline #81821 passed with stages
......@@ -536,12 +536,13 @@ const AddModal = props => {
}
if (data.Unit == 'month') {
let obg = {
: 0,
: 1,
: 2,
1: 0,
2: 1,
3: 2,
6: 5,
12: 11,
};
StartExecLen = obg[data.MonthType1] * 31 + data.MonthDayType1 * 1 - startLen;
EndExecLen = obg[data.MonthType2] * 31 + data.MonthDayType2 * 1 - startLen;
}
let UnitObj = {
......
......@@ -18,14 +18,16 @@ const cityData = {
};
const BaseConfig = (props, ref) => {
const Mobj = {
: 1,
: 2,
: 3,
1: 1,
2: 2,
3: 3,
6: 6,
12: 12,
};
const weekArr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
const [CycleLen, setCycleLen] = useState(1); // xx周期 一次
const [MonthType1, setMonthType1] = useState('首'); // 月选择 首次末
const [MonthType2, setMonthType2] = useState('首');
const [MonthType1, setMonthType1] = useState(1); // 月选择 首次末
const [MonthType2, setMonthType2] = useState(1);
const [MonthDayType1, setMonthDayType1] = useState('1'); // 月选择-日期
const [MonthDayType2, setMonthDayType2] = useState('31'); // 月选择-日期
const [cities, setCities] = useState('周一');
......@@ -44,40 +46,38 @@ const BaseConfig = (props, ref) => {
setCycleLen(props.keepTimeData.CycleLen);
setstartLen(props.keepTimeData.StartLen);
if (props.keepTimeData.StartExecLen + props.keepTimeData.StartLen < 32) {
setMonthType1('首');
setMonthType1(1);
setMonthDayType1(props.keepTimeData.StartExecLen + props.keepTimeData.StartLen);
} else if (props.keepTimeData.StartExecLen + props.keepTimeData.StartLen < 63) {
setMonthType1('次');
setMonthType1(2);
setMonthDayType1(props.keepTimeData.StartExecLen - 31 + props.keepTimeData.StartLen);
} else if (props.keepTimeData.StartExecLen + props.keepTimeData.StartLen < 94) {
setMonthType1('末');
setMonthType1(3);
setMonthDayType1(props.keepTimeData.StartExecLen - 62 + props.keepTimeData.StartLen);
} else if (props.keepTimeData.StartExecLen + props.keepTimeData.StartLen < 187) {
setMonthType1(6);
setMonthDayType1(props.keepTimeData.StartExecLen - 155 + props.keepTimeData.StartLen);
} else if (props.keepTimeData.StartExecLen + props.keepTimeData.StartLen < 373) {
setMonthType1(12);
setMonthDayType1(props.keepTimeData.StartExecLen - 341 + props.keepTimeData.StartLen);
}
// else if (props.keepTimeData.StartExecLen + props.keepTimeData.StartLen < 187) {
// setMonthType1(6);
// setMonthDayType1(props.keepTimeData.StartExecLen - 155 + props.keepTimeData.StartLen);
// } else if (props.keepTimeData.StartExecLen + props.keepTimeData.StartLen < 373) {
// setMonthType1(12);
// setMonthDayType1(props.keepTimeData.StartExecLen - 341 + props.keepTimeData.StartLen);
// }
if (props.keepTimeData.EndExecLen + props.keepTimeData.StartLen < 32) {
setMonthType2('首');
setMonthType2(1);
setMonthDayType2(props.keepTimeData.EndExecLen + props.keepTimeData.StartLen);
} else if (props.keepTimeData.EndExecLen + props.keepTimeData.StartLen < 63) {
setMonthType2('次');
setMonthType2(2);
setMonthDayType2(props.keepTimeData.EndExecLen - 31 + props.keepTimeData.StartLen);
} else if (props.keepTimeData.EndExecLen + props.keepTimeData.StartLen < 94) {
setMonthType2('末');
setMonthType2(3);
setMonthDayType2(props.keepTimeData.EndExecLen - 62 + props.keepTimeData.StartLen);
} else if (props.keepTimeData.EndExecLen + props.keepTimeData.StartLen < 187) {
setMonthType2(6);
setMonthDayType2(props.keepTimeData.EndExecLen - 155 + props.keepTimeData.StartLen);
} else if (props.keepTimeData.EndExecLen + props.keepTimeData.StartLen < 373) {
setMonthType2(12);
setMonthDayType2(props.keepTimeData.EndExecLen - 341 + props.keepTimeData.StartLen);
}
// else if (props.keepTimeData.EndExecLen + props.keepTimeData.StartLen < 187) {
// setMonthType2(6);
// setMonthDayType2(props.keepTimeData.EndExecLen - 155 + props.keepTimeData.StartLen);
// } else if (props.keepTimeData.EndExecLen + props.keepTimeData.StartLen < 373) {
// setMonthType2(12);
// setMonthDayType2(props.keepTimeData.EndExecLen - 341 + props.keepTimeData.StartLen);
// }
} else if (props.keepTimeData?.Unit === '周') {
setCycleLen(props.keepTimeData.CycleLen);
let zix = weekArr[props.keepTimeData.StartLen - 1]; // 执行开始周
......@@ -142,14 +142,15 @@ const BaseConfig = (props, ref) => {
} else if (e.target.value === 'day') {
setCycleLen(1);
} else if (e.target.value === 'week') {
setCycleLen(1);
setstartLen(1);
setCities('周一');
setSecondCity('周日');
} else if (e.target.value === 'month') {
setCycleLen(1);
setstartLen(1);
setMonthType1('首');
setMonthType2('首');
setMonthType1(1);
setMonthType2(1);
setMonthDayType1('1');
setMonthDayType2('31');
}
......@@ -162,7 +163,6 @@ const BaseConfig = (props, ref) => {
CycleLen,
MonthType1,
MonthType2,
// MonthType3,
MonthDayType1,
MonthDayType2,
cities,
......@@ -231,8 +231,8 @@ const BaseConfig = (props, ref) => {
onChange={value => {
setCycleLen(value);
if (value === 1) {
setMonthType1('首');
setMonthType2('首');
setMonthType1(1);
setMonthType2(1);
if (MonthDayType1 < startLen) {
setMonthDayType1(startLen);
}
......@@ -240,9 +240,9 @@ const BaseConfig = (props, ref) => {
setMonthDayType2('31');
}
} else if (value === 2) {
if (MonthType2 === '末') {
setMonthType1('首');
setMonthType2('首');
if (MonthType2 === 3) {
setMonthType1(1);
setMonthType2(1);
if (MonthDayType1 < startLen) {
setMonthDayType1(startLen);
}
......@@ -281,10 +281,10 @@ const BaseConfig = (props, ref) => {
}}
onChange={value => {
setstartLen(value);
if (MonthType1 === '首') {
if (MonthType1 === 1) {
value > MonthDayType1 && setMonthDayType1(value);
}
if (MonthType2 === '首') {
if (MonthType2 === 1) {
value > MonthDayType2 && setMonthDayType2('31');
}
}}
......@@ -335,29 +335,18 @@ const BaseConfig = (props, ref) => {
}}
onChange={value => {
setCycleLen(value);
if (value === 1) {
setMonthType1('首');
setMonthType2('首');
if (value < MonthType2) {
setMonthType1(1);
setMonthType2(1);
if (MonthDayType1 < startLen) {
setMonthDayType1(startLen);
}
if (MonthDayType2 < startLen) {
setMonthDayType2('31');
}
} else if (value === 2) {
if (MonthType2 === '末') {
setMonthType1('首');
setMonthType2('首');
if (MonthDayType1 < startLen) {
setMonthDayType1(startLen);
}
if (MonthDayType2 < startLen) {
setMonthDayType2('31');
}
}
}
}}
options={[1, 2, 3].map(province => ({
options={[1, 2, 3, 6, 12].map(province => ({
label: province,
value: province,
}))}
......@@ -599,8 +588,7 @@ const BaseConfig = (props, ref) => {
} else if (value == 'month') {
return (
<>
<span>将会在</span>
<span>将会在第</span>
<Select
style={{
width: 65,
......@@ -608,18 +596,20 @@ const BaseConfig = (props, ref) => {
}}
onChange={value => {
setMonthType1(value);
if (['首', '次', '末'].indexOf(value) > ['首', '次', '末'].indexOf(MonthType2)) {
if ([1, 2, 3, 6, 12].indexOf(value) > [1, 2, 3, 6, 12].indexOf(MonthType2)) {
setMonthType2(value);
}
if (value === '首') {
if (value === 1) {
setMonthDayType1(startLen);
}
}}
value={MonthType1}
options={['首', '次', '末'].slice(0, CycleLen).map(city => ({
label: city,
value: city,
}))}
options={[1, 2, 3, 6, 12]
.slice(0, [1, 2, 3, 6, 12].indexOf(CycleLen) + 1)
.map(city => ({
label: city,
value: city,
}))}
/>
<span></span>
<Select
......@@ -666,10 +656,10 @@ const BaseConfig = (props, ref) => {
].map(city => ({
label: city,
value: city,
disabled: MonthType1 === '首' && city < startLen ? true : false,
disabled: MonthType1 === 1 && city < startLen ? true : false,
}))}
/>
<span>日到</span>
<span>日到</span>
<Select
key="MonthType2"
......@@ -679,11 +669,13 @@ const BaseConfig = (props, ref) => {
}}
value={MonthType2}
onChange={value => setMonthType2(value)}
options={['首', '次', '末'].slice(0, CycleLen).map(city => ({
label: city,
value: city,
disabled: Mobj[city] < Mobj[MonthType1] ? true : false,
}))}
options={[1, 2, 3, 6, 12]
.slice(0, [1, 2, 3, 6, 12].indexOf(CycleLen) + 1)
.map(city => ({
label: city,
value: city,
disabled: Mobj[city] < Mobj[MonthType1] ? true : false,
}))}
/>
<span></span>
<Select
......@@ -742,12 +734,6 @@ const BaseConfig = (props, ref) => {
</span>
</>
);
/* <CheckBox
key={'month'}
checkedList={[1]}
plainOptions={['1号','2号','3号','4号','5号','6号','7号','8号','9号','10号','11号','12号','13号','14号','15号','16号','17号','18号','19号','20号','21号','22号','23号','24号','25号','26号','27号','28号','29号','30号','31号']}
></CheckBox> */
} else if (value == 'hour') {
if (CycleLen == 1) {
return (
......@@ -788,32 +774,6 @@ const BaseConfig = (props, ref) => {
}
};
const detailSort = val => {
let newVal = numChange(val);
if (newVal < startLen) {
return true;
}
return false;
};
const numChange = val => {
if (val === '周一') {
return 1;
} else if (val === '周二') {
return 2;
} else if (val === '周三') {
return 3;
} else if (val === '周四') {
return 4;
} else if (val === '周五') {
return 5;
} else if (val === '周六') {
return 6;
} else if (val === '周日') {
return 7;
}
};
const change = e => {
setVisibleChecked(e);
};
......
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