|
@@ -399,16 +399,19 @@
|
|
<div class="form-group"
|
|
<div class="form-group"
|
|
v-if="(configDialog.current?.runningTimeRule === 0 || configDialog.current?.mileageRule === 0)
|
|
v-if="(configDialog.current?.runningTimeRule === 0 || configDialog.current?.mileageRule === 0)
|
|
&& (configDialog.current?.timeAccumulatedAttrs?.length || configDialog.current?.mileageAccumulatedAttrs?.length)
|
|
&& (configDialog.current?.timeAccumulatedAttrs?.length || configDialog.current?.mileageAccumulatedAttrs?.length)
|
|
- && !configDialog.current.totalRunTime && !configDialog.current.totalMileage" >
|
|
|
|
|
|
+ && (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime))
|
|
|
|
+ && (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage))" >
|
|
<div class="group-title">{{ t('mainPlan.accumulatedParams') }}</div>
|
|
<div class="group-title">{{ t('mainPlan.accumulatedParams') }}</div>
|
|
<!-- 累计运行时长 -->
|
|
<!-- 累计运行时长 -->
|
|
<el-form-item
|
|
<el-form-item
|
|
v-if="configDialog.current?.runningTimeRule === 0
|
|
v-if="configDialog.current?.runningTimeRule === 0
|
|
- && configDialog.current?.timeAccumulatedAttrs?.length && !configDialog.current.totalRunTime"
|
|
|
|
|
|
+ && configDialog.current?.timeAccumulatedAttrs?.length
|
|
|
|
+ && (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime))"
|
|
:label="t('mainPlan.accumulatedRunTime')"
|
|
:label="t('mainPlan.accumulatedRunTime')"
|
|
prop="accumulatedTimeOption"
|
|
prop="accumulatedTimeOption"
|
|
:rules="[{
|
|
:rules="[{
|
|
- required: configDialog.current?.runningTimeRule === 0 && configDialog.current?.timeAccumulatedAttrs?.length,
|
|
|
|
|
|
+ required: configDialog.current?.runningTimeRule === 0 && configDialog.current?.timeAccumulatedAttrs?.length
|
|
|
|
+ && (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime)),
|
|
message: '请选择累计运行时长',
|
|
message: '请选择累计运行时长',
|
|
trigger: 'change'
|
|
trigger: 'change'
|
|
}]"
|
|
}]"
|
|
@@ -431,11 +434,13 @@
|
|
<!-- 累计运行公里数 -->
|
|
<!-- 累计运行公里数 -->
|
|
<el-form-item
|
|
<el-form-item
|
|
v-if="configDialog.current?.mileageRule === 0
|
|
v-if="configDialog.current?.mileageRule === 0
|
|
- && configDialog.current?.mileageAccumulatedAttrs?.length && !configDialog.current.totalMileage"
|
|
|
|
|
|
+ && configDialog.current?.mileageAccumulatedAttrs?.length
|
|
|
|
+ && (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage))"
|
|
:label="t('mainPlan.accumulatedMileage')"
|
|
:label="t('mainPlan.accumulatedMileage')"
|
|
prop="accumulatedMileageOption"
|
|
prop="accumulatedMileageOption"
|
|
:rules="[{
|
|
:rules="[{
|
|
- required: configDialog.current?.mileageRule === 0 && configDialog.current?.mileageAccumulatedAttrs?.length,
|
|
|
|
|
|
+ required: configDialog.current?.mileageRule === 0 && configDialog.current?.mileageAccumulatedAttrs?.length
|
|
|
|
+ && (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage)),
|
|
message: '请选择累计运行公里数',
|
|
message: '请选择累计运行公里数',
|
|
trigger: 'change'
|
|
trigger: 'change'
|
|
}]"
|
|
}]"
|
|
@@ -640,14 +645,16 @@ const saveConfig = () => {
|
|
// 累计运行时长配置 校验逻辑
|
|
// 累计运行时长配置 校验逻辑
|
|
if (configDialog.current.runningTimeRule === 0 &&
|
|
if (configDialog.current.runningTimeRule === 0 &&
|
|
configDialog.current.timeAccumulatedAttrs?.length &&
|
|
configDialog.current.timeAccumulatedAttrs?.length &&
|
|
- !configDialog.form.accumulatedTimeOption) {
|
|
|
|
|
|
+ !configDialog.form.accumulatedTimeOption &&
|
|
|
|
+ (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime)) ) {
|
|
message.error('请选择累计运行时长');
|
|
message.error('请选择累计运行时长');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// 累计运行公里数配置 校验逻辑
|
|
// 累计运行公里数配置 校验逻辑
|
|
if (configDialog.current.mileageRule === 0 &&
|
|
if (configDialog.current.mileageRule === 0 &&
|
|
configDialog.current.mileageAccumulatedAttrs?.length &&
|
|
configDialog.current.mileageAccumulatedAttrs?.length &&
|
|
- !configDialog.form.accumulatedMileageOption) {
|
|
|
|
|
|
+ !configDialog.form.accumulatedMileageOption &&
|
|
|
|
+ (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage)) ) {
|
|
message.error('请选择累计运行公里数');
|
|
message.error('请选择累计运行公里数');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -1070,8 +1077,8 @@ const checkRowFilled = (row: IotMaintenanceBomVO) => {
|
|
row.nextRunningKilometers > 0 &&
|
|
row.nextRunningKilometers > 0 &&
|
|
row.kiloCycleLead > 0 &&
|
|
row.kiloCycleLead > 0 &&
|
|
// 检查累计里程参数是否已选择(当条件满足时)
|
|
// 检查累计里程参数是否已选择(当条件满足时)
|
|
- (!(row.mileageAccumulatedAttrs?.length && !row.totalMileage) ||
|
|
|
|
- (row.mileageAccumulatedAttrs?.length && !row.totalMileage && row.type)));
|
|
|
|
|
|
+ (!(row.mileageAccumulatedAttrs?.length && (row.totalMileage==null || isNaN(row.totalMileage))) ||
|
|
|
|
+ (row.mileageAccumulatedAttrs?.length && (row.totalMileage==null || isNaN(row.totalMileage)) && row.type)));
|
|
|
|
|
|
// 检查运行时间规则
|
|
// 检查运行时间规则
|
|
const runningTimeFilled = row.runningTimeRule !== 0
|
|
const runningTimeFilled = row.runningTimeRule !== 0
|
|
@@ -1080,8 +1087,8 @@ const checkRowFilled = (row: IotMaintenanceBomVO) => {
|
|
row.nextRunningTime > 0 &&
|
|
row.nextRunningTime > 0 &&
|
|
row.timePeriodLead > 0 &&
|
|
row.timePeriodLead > 0 &&
|
|
// 检查累计时间参数是否已选择(当条件满足时)
|
|
// 检查累计时间参数是否已选择(当条件满足时)
|
|
- (!(row.timeAccumulatedAttrs?.length && !row.totalRunTime) ||
|
|
|
|
- (row.timeAccumulatedAttrs?.length && !row.totalRunTime && row.code)));
|
|
|
|
|
|
+ (!(row.timeAccumulatedAttrs?.length && (row.totalRunTime==null || isNaN(row.totalRunTime))) ||
|
|
|
|
+ (row.timeAccumulatedAttrs?.length && (row.totalRunTime==null || isNaN(row.totalRunTime)) && row.code)));
|
|
|
|
|
|
// 检查自然日期规则
|
|
// 检查自然日期规则
|
|
const naturalDateFilled = row.naturalDateRule !== 0
|
|
const naturalDateFilled = row.naturalDateRule !== 0
|
|
@@ -1351,7 +1358,7 @@ const validateTableData = (): boolean => {
|
|
// 累计参数校验逻辑
|
|
// 累计参数校验逻辑
|
|
if (row.mileageRule === 0 &&
|
|
if (row.mileageRule === 0 &&
|
|
row.mileageAccumulatedAttrs?.length &&
|
|
row.mileageAccumulatedAttrs?.length &&
|
|
- !row.totalMileage &&
|
|
|
|
|
|
+ (row.totalMileage==null || isNaN(row.totalMileage)) &&
|
|
!row.type) {
|
|
!row.type) {
|
|
errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行公里数参数`)
|
|
errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行公里数参数`)
|
|
isValid = false
|
|
isValid = false
|
|
@@ -1359,7 +1366,7 @@ const validateTableData = (): boolean => {
|
|
|
|
|
|
if (row.runningTimeRule === 0 &&
|
|
if (row.runningTimeRule === 0 &&
|
|
row.timeAccumulatedAttrs?.length &&
|
|
row.timeAccumulatedAttrs?.length &&
|
|
- !row.totalRunTime &&
|
|
|
|
|
|
+ (row.totalRunTime==null || isNaN(row.totalRunTime)) &&
|
|
!row.code) {
|
|
!row.code) {
|
|
errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行时长参数`)
|
|
errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行时长参数`)
|
|
isValid = false
|
|
isValid = false
|