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

维保方案修改周计划

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