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

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

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