|
@@ -5,24 +5,27 @@
|
|
|
:model="formData"
|
|
:model="formData"
|
|
|
:rules="formRules"
|
|
:rules="formRules"
|
|
|
v-loading="formLoading"
|
|
v-loading="formLoading"
|
|
|
- style="margin-right: 4em; margin-left: 0.5em; margin-top: 1em"
|
|
|
|
|
- label-width="130px"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ style="margin-top: 1em; margin-right: 4em; margin-left: 0.5em"
|
|
|
|
|
+ label-width="130px">
|
|
|
<div class="base-expandable-content">
|
|
<div class="base-expandable-content">
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item :label="t('main.planName')" prop="name">
|
|
<el-form-item :label="t('main.planName')" prop="name">
|
|
|
- <el-input type="text" v-model="formData.name" disabled/>
|
|
|
|
|
|
|
+ <el-input type="text" v-model="formData.name" disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item :label="t('main.planCode')" prop="serialNumber">
|
|
<el-form-item :label="t('main.planCode')" prop="serialNumber">
|
|
|
- <el-input type="text" v-model="formData.serialNumber" disabled/>
|
|
|
|
|
|
|
+ <el-input type="text" v-model="formData.serialNumber" disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="t('form.remark')" prop="remark">
|
|
<el-form-item :label="t('form.remark')" prop="remark">
|
|
|
- <el-input v-model="formData.remark" type="textarea" :placeholder="t('deviceForm.remarkHolder')" disabled/>
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formData.remark"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :placeholder="t('deviceForm.remarkHolder')"
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
@@ -34,26 +37,39 @@
|
|
|
<ContentWrap>
|
|
<ContentWrap>
|
|
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
|
|
<!-- 添加序号列 -->
|
|
<!-- 添加序号列 -->
|
|
|
- <el-table-column
|
|
|
|
|
- type="index"
|
|
|
|
|
- :label="t('monitor.serial')"
|
|
|
|
|
- width="70"
|
|
|
|
|
- align="center"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <el-table-column type="index" :label="t('monitor.serial')" width="70" align="center" />
|
|
|
<el-table-column :label="t('monitor.deviceCode')" align="center" prop="deviceCode" />
|
|
<el-table-column :label="t('monitor.deviceCode')" align="center" prop="deviceCode" />
|
|
|
<el-table-column :label="t('monitor.deviceName')" align="center" prop="deviceName" />
|
|
<el-table-column :label="t('monitor.deviceName')" align="center" prop="deviceName" />
|
|
|
- <el-table-column :label="t('operationFillForm.sumTime')" align="center" prop="totalRunTime" :formatter="erpPriceTableColumnFormatter">
|
|
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ :label="t('operationFillForm.sumTime')"
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ prop="totalRunTime"
|
|
|
|
|
+ :formatter="erpPriceTableColumnFormatter">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
{{ row.totalRunTime ?? row.tempTotalRunTime }}
|
|
{{ row.totalRunTime ?? row.tempTotalRunTime }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column :label="t('operationFillForm.sumKil')" align="center" prop="totalMileage" :formatter="erpPriceTableColumnFormatter">
|
|
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ :label="t('operationFillForm.sumKil')"
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ prop="totalMileage"
|
|
|
|
|
+ :formatter="erpPriceTableColumnFormatter">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
{{ row.totalMileage ?? row.tempTotalMileage }}
|
|
{{ row.totalMileage ?? row.tempTotalMileage }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="tempTotalRunTime" align="center" prop="tempTotalRunTime" :formatter="erpPriceTableColumnFormatter" v-if="false"/>
|
|
|
|
|
- <el-table-column label="tempTotalMileage" align="center" prop="tempTotalMileage" :formatter="erpPriceTableColumnFormatter" v-if="false"/>
|
|
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ label="tempTotalRunTime"
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ prop="tempTotalRunTime"
|
|
|
|
|
+ :formatter="erpPriceTableColumnFormatter"
|
|
|
|
|
+ v-if="false" />
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ label="tempTotalMileage"
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ prop="tempTotalMileage"
|
|
|
|
|
+ :formatter="erpPriceTableColumnFormatter"
|
|
|
|
|
+ v-if="false" />
|
|
|
<el-table-column :label="t('bomList.bomNode')" align="center" prop="name" />
|
|
<el-table-column :label="t('bomList.bomNode')" align="center" prop="name" />
|
|
|
<el-table-column :label="t('main.mileage')" key="mileageRule" width="80">
|
|
<el-table-column :label="t('main.mileage')" key="mileageRule" width="80">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
@@ -61,8 +77,7 @@
|
|
|
v-model="scope.row.mileageRule"
|
|
v-model="scope.row.mileageRule"
|
|
|
:active-value="0"
|
|
:active-value="0"
|
|
|
:inactive-value="1"
|
|
:inactive-value="1"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column :label="t('main.runTime')" key="runningTimeRule" width="90">
|
|
<el-table-column :label="t('main.runTime')" key="runningTimeRule" width="90">
|
|
@@ -71,8 +86,7 @@
|
|
|
v-model="scope.row.runningTimeRule"
|
|
v-model="scope.row.runningTimeRule"
|
|
|
:active-value="0"
|
|
:active-value="0"
|
|
|
:inactive-value="1"
|
|
:inactive-value="1"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column :label="t('main.date')" key="naturalDateRule" width="80">
|
|
<el-table-column :label="t('main.date')" key="naturalDateRule" width="80">
|
|
@@ -81,22 +95,16 @@
|
|
|
v-model="scope.row.naturalDateRule"
|
|
v-model="scope.row.naturalDateRule"
|
|
|
:active-value="0"
|
|
:active-value="0"
|
|
|
:inactive-value="1"
|
|
:inactive-value="1"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column :label="t('workplace.operation')" align="center" min-width="120px">
|
|
<el-table-column :label="t('workplace.operation')" align="center" min-width="120px">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<div style="display: flex; justify-content: center; align-items: center; width: 100%">
|
|
<div style="display: flex; justify-content: center; align-items: center; width: 100%">
|
|
|
- <div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div> </div>
|
|
|
<!-- 新增配置按钮 -->
|
|
<!-- 新增配置按钮 -->
|
|
|
<div style="margin-left: 12px">
|
|
<div style="margin-left: 12px">
|
|
|
- <el-button
|
|
|
|
|
- link
|
|
|
|
|
- type="primary"
|
|
|
|
|
- @click="openConfigDialog(scope.row)"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-button link type="primary" @click="openConfigDialog(scope.row)">
|
|
|
{{ t('form.set') }}
|
|
{{ t('form.set') }}
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</div>
|
|
</div>
|
|
@@ -109,7 +117,7 @@
|
|
|
<ContentWrap>
|
|
<ContentWrap>
|
|
|
<el-form>
|
|
<el-form>
|
|
|
<el-form-item style="float: right">
|
|
<el-form-item style="float: right">
|
|
|
- <el-button @click="close">{{t('operationFillForm.cancel')}}</el-button>
|
|
|
|
|
|
|
+ <el-button @click="close">{{ t('operationFillForm.cancel') }}</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</ContentWrap>
|
|
</ContentWrap>
|
|
@@ -117,52 +125,54 @@
|
|
|
<!-- 新增配置对话框 -->
|
|
<!-- 新增配置对话框 -->
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
v-model="configDialog.visible"
|
|
v-model="configDialog.visible"
|
|
|
- :title="`设备 ${configDialog.current?.deviceCode+'-'+configDialog.current?.name} 保养项配置`"
|
|
|
|
|
- width="600px"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ :title="`设备 ${configDialog.current?.deviceCode + '-' + configDialog.current?.name} 保养项配置`"
|
|
|
|
|
+ width="600px">
|
|
|
<!-- 使用header插槽自定义标题 -->
|
|
<!-- 使用header插槽自定义标题 -->
|
|
|
<template #header>
|
|
<template #header>
|
|
|
- <span>设备 <strong>{{ configDialog.current?.deviceCode }}-{{ configDialog.current?.name }}</strong> 保养项配置</span>
|
|
|
|
|
|
|
+ <span
|
|
|
|
|
+ >设备
|
|
|
|
|
+ <strong>{{ configDialog.current?.deviceCode }}-{{ configDialog.current?.name }}</strong>
|
|
|
|
|
+ 保养项配置</span
|
|
|
|
|
+ >
|
|
|
</template>
|
|
</template>
|
|
|
- <el-form :model="configDialog.form" label-width="200px" :rules="configFormRules" ref="configFormRef">
|
|
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ :model="configDialog.form"
|
|
|
|
|
+ label-width="200px"
|
|
|
|
|
+ :rules="configFormRules"
|
|
|
|
|
+ ref="configFormRef">
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
<div class="group-title">{{ t('mainPlan.basicMaintenanceRecords') }}</div>
|
|
<div class="group-title">{{ t('mainPlan.basicMaintenanceRecords') }}</div>
|
|
|
<!-- 里程配置 -->
|
|
<!-- 里程配置 -->
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="configDialog.current?.mileageRule === 0"
|
|
v-if="configDialog.current?.mileageRule === 0"
|
|
|
:label="t('mainPlan.lastMaintenanceMileage')"
|
|
:label="t('mainPlan.lastMaintenanceMileage')"
|
|
|
- prop="lastRunningKilometers"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ prop="lastRunningKilometers">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="configDialog.form.lastRunningKilometers"
|
|
v-model="configDialog.form.lastRunningKilometers"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
|
:controls="false"
|
|
:controls="false"
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
style="width: 60%"
|
|
style="width: 60%"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<!-- 运行时间配置 -->
|
|
<!-- 运行时间配置 -->
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="configDialog.current?.runningTimeRule === 0"
|
|
v-if="configDialog.current?.runningTimeRule === 0"
|
|
|
:label="t('mainPlan.lastMaintenanceOperationTime')"
|
|
:label="t('mainPlan.lastMaintenanceOperationTime')"
|
|
|
- prop="lastRunningTime"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ prop="lastRunningTime">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="configDialog.form.lastRunningTime"
|
|
v-model="configDialog.form.lastRunningTime"
|
|
|
:precision="1"
|
|
:precision="1"
|
|
|
:controls="false"
|
|
:controls="false"
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
style="width: 60%"
|
|
style="width: 60%"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<!-- 自然日期配置 -->
|
|
<!-- 自然日期配置 -->
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="configDialog.current?.naturalDateRule === 0"
|
|
v-if="configDialog.current?.naturalDateRule === 0"
|
|
|
:label="t('mainPlan.lastMaintenanceNaturalDate')"
|
|
:label="t('mainPlan.lastMaintenanceNaturalDate')"
|
|
|
- prop="lastNaturalDate"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ prop="lastNaturalDate">
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
v-model="configDialog.form.lastNaturalDate"
|
|
v-model="configDialog.form.lastNaturalDate"
|
|
|
type="date"
|
|
type="date"
|
|
@@ -170,8 +180,7 @@
|
|
|
format="YYYY-MM-DD"
|
|
format="YYYY-MM-DD"
|
|
|
value-format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
|
style="width: 60%"
|
|
style="width: 60%"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -181,8 +190,7 @@
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="configDialog.current?.mileageRule === 0"
|
|
v-if="configDialog.current?.mileageRule === 0"
|
|
|
:label="t('mainPlan.operatingMileageCycle')"
|
|
:label="t('mainPlan.operatingMileageCycle')"
|
|
|
- prop="nextRunningKilometers"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ prop="nextRunningKilometers">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="configDialog.form.nextRunningKilometers"
|
|
v-model="configDialog.form.nextRunningKilometers"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
@@ -190,14 +198,12 @@
|
|
|
:controls="false"
|
|
:controls="false"
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
style="width: 60%"
|
|
style="width: 60%"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="configDialog.current?.mileageRule === 0"
|
|
v-if="configDialog.current?.mileageRule === 0"
|
|
|
:label="t('mainPlan.OperatingMileageCycle_lead')"
|
|
:label="t('mainPlan.OperatingMileageCycle_lead')"
|
|
|
- prop="kiloCycleLead"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ prop="kiloCycleLead">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="configDialog.form.kiloCycleLead"
|
|
v-model="configDialog.form.kiloCycleLead"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
@@ -205,8 +211,7 @@
|
|
|
:controls="false"
|
|
:controls="false"
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
style="width: 60%"
|
|
style="width: 60%"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -215,8 +220,7 @@
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="configDialog.current?.runningTimeRule === 0"
|
|
v-if="configDialog.current?.runningTimeRule === 0"
|
|
|
:label="t('mainPlan.RunTimeCycle')"
|
|
:label="t('mainPlan.RunTimeCycle')"
|
|
|
- prop="nextRunningTime"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ prop="nextRunningTime">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="configDialog.form.nextRunningTime"
|
|
v-model="configDialog.form.nextRunningTime"
|
|
|
:precision="1"
|
|
:precision="1"
|
|
@@ -224,14 +228,12 @@
|
|
|
:controls="false"
|
|
:controls="false"
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
style="width: 60%"
|
|
style="width: 60%"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="configDialog.current?.runningTimeRule === 0"
|
|
v-if="configDialog.current?.runningTimeRule === 0"
|
|
|
:label="t('mainPlan.RunTimeCycle_Lead')"
|
|
:label="t('mainPlan.RunTimeCycle_Lead')"
|
|
|
- prop="timePeriodLead"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ prop="timePeriodLead">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="configDialog.form.timePeriodLead"
|
|
v-model="configDialog.form.timePeriodLead"
|
|
|
:precision="1"
|
|
:precision="1"
|
|
@@ -239,8 +241,7 @@
|
|
|
:controls="false"
|
|
:controls="false"
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
style="width: 60%"
|
|
style="width: 60%"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -248,94 +249,104 @@
|
|
|
<div class="group-title">{{ t('mainPlan.NaturalDayRuleConfig') }}</div>
|
|
<div class="group-title">{{ t('mainPlan.NaturalDayRuleConfig') }}</div>
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="configDialog.current?.naturalDateRule === 0"
|
|
v-if="configDialog.current?.naturalDateRule === 0"
|
|
|
- :label="t('mainPlan.NaturalDailyCycle') "
|
|
|
|
|
- prop="nextNaturalDate"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ :label="t('mainPlan.NaturalDailyCycle')"
|
|
|
|
|
+ prop="nextNaturalDate">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="configDialog.form.nextNaturalDate"
|
|
v-model="configDialog.form.nextNaturalDate"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
:controls="false"
|
|
:controls="false"
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
style="width: 60%"
|
|
style="width: 60%"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="configDialog.current?.naturalDateRule === 0"
|
|
v-if="configDialog.current?.naturalDateRule === 0"
|
|
|
- :label="t('mainPlan.NaturalDailyCycle_Lead') "
|
|
|
|
|
- prop="naturalDatePeriodLead"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ :label="t('mainPlan.NaturalDailyCycle_Lead')"
|
|
|
|
|
+ prop="naturalDatePeriodLead">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="configDialog.form.naturalDatePeriodLead"
|
|
v-model="configDialog.form.naturalDatePeriodLead"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
:controls="false"
|
|
:controls="false"
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
style="width: 60%"
|
|
style="width: 60%"
|
|
|
- disabled
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 运行记录模板中 多个 累计运行时长 累计运行里程 属性匹配-->
|
|
<!-- 运行记录模板中 多个 累计运行时长 累计运行里程 属性匹配-->
|
|
|
- <div class="form-group"
|
|
|
|
|
- v-if="(configDialog.current?.runningTimeRule === 0 || configDialog.current?.mileageRule === 0)
|
|
|
|
|
- && (configDialog.current?.timeAccumulatedAttrs?.length || configDialog.current?.mileageAccumulatedAttrs?.length)
|
|
|
|
|
- && !configDialog.current.totalRunTime && !configDialog.current.totalMileage" >
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="form-group"
|
|
|
|
|
+ v-if="
|
|
|
|
|
+ (configDialog.current?.runningTimeRule === 0 ||
|
|
|
|
|
+ configDialog.current?.mileageRule === 0) &&
|
|
|
|
|
+ (configDialog.current?.timeAccumulatedAttrs?.length ||
|
|
|
|
|
+ configDialog.current?.mileageAccumulatedAttrs?.length) &&
|
|
|
|
|
+ !configDialog.current.totalRunTime &&
|
|
|
|
|
+ !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
|
|
|
|
|
- && configDialog.current?.timeAccumulatedAttrs?.length && !configDialog.current.totalRunTime"
|
|
|
|
|
|
|
+ v-if="
|
|
|
|
|
+ configDialog.current?.runningTimeRule === 0 &&
|
|
|
|
|
+ configDialog.current?.timeAccumulatedAttrs?.length &&
|
|
|
|
|
+ !configDialog.current.totalRunTime
|
|
|
|
|
+ "
|
|
|
:label="t('mainPlan.accumulatedRunTime')"
|
|
:label="t('mainPlan.accumulatedRunTime')"
|
|
|
prop="accumulatedTimeOption"
|
|
prop="accumulatedTimeOption"
|
|
|
- :rules="[{
|
|
|
|
|
- required: configDialog.current?.runningTimeRule === 0 && configDialog.current?.timeAccumulatedAttrs?.length,
|
|
|
|
|
- message: '请选择累计运行时长',
|
|
|
|
|
- trigger: 'change'
|
|
|
|
|
- }]"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ :rules="[
|
|
|
|
|
+ {
|
|
|
|
|
+ required:
|
|
|
|
|
+ configDialog.current?.runningTimeRule === 0 &&
|
|
|
|
|
+ configDialog.current?.timeAccumulatedAttrs?.length,
|
|
|
|
|
+ message: '请选择累计运行时长',
|
|
|
|
|
+ trigger: 'change'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]">
|
|
|
<el-select
|
|
<el-select
|
|
|
v-model="configDialog.form.accumulatedTimeOption"
|
|
v-model="configDialog.form.accumulatedTimeOption"
|
|
|
placeholder="请选择累计运行时长"
|
|
placeholder="请选择累计运行时长"
|
|
|
style="width: 80%"
|
|
style="width: 80%"
|
|
|
clearable
|
|
clearable
|
|
|
@change="handleAccumulatedTimeChange"
|
|
@change="handleAccumulatedTimeChange"
|
|
|
- disabled
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ disabled>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="(item, index) in configDialog.current.timeAccumulatedAttrs"
|
|
v-for="(item, index) in configDialog.current.timeAccumulatedAttrs"
|
|
|
:key="`time-${item.pointName}-${index}`"
|
|
:key="`time-${item.pointName}-${index}`"
|
|
|
:label="item.pointName"
|
|
:label="item.pointName"
|
|
|
- :value="item.pointName"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ :value="item.pointName" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<!-- 累计运行公里数 -->
|
|
<!-- 累计运行公里数 -->
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
- v-if="configDialog.current?.mileageRule === 0
|
|
|
|
|
- && configDialog.current?.mileageAccumulatedAttrs?.length && !configDialog.current.totalMileage"
|
|
|
|
|
|
|
+ v-if="
|
|
|
|
|
+ configDialog.current?.mileageRule === 0 &&
|
|
|
|
|
+ configDialog.current?.mileageAccumulatedAttrs?.length &&
|
|
|
|
|
+ !configDialog.current.totalMileage
|
|
|
|
|
+ "
|
|
|
:label="t('mainPlan.accumulatedMileage')"
|
|
:label="t('mainPlan.accumulatedMileage')"
|
|
|
prop="accumulatedMileageOption"
|
|
prop="accumulatedMileageOption"
|
|
|
- :rules="[{
|
|
|
|
|
- required: configDialog.current?.mileageRule === 0 && configDialog.current?.mileageAccumulatedAttrs?.length,
|
|
|
|
|
- message: '请选择累计运行公里数',
|
|
|
|
|
- trigger: 'change'
|
|
|
|
|
- }]"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ :rules="[
|
|
|
|
|
+ {
|
|
|
|
|
+ required:
|
|
|
|
|
+ configDialog.current?.mileageRule === 0 &&
|
|
|
|
|
+ configDialog.current?.mileageAccumulatedAttrs?.length,
|
|
|
|
|
+ message: '请选择累计运行公里数',
|
|
|
|
|
+ trigger: 'change'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]">
|
|
|
<el-select
|
|
<el-select
|
|
|
v-model="configDialog.form.accumulatedMileageOption"
|
|
v-model="configDialog.form.accumulatedMileageOption"
|
|
|
placeholder="请选择累计运行公里数"
|
|
placeholder="请选择累计运行公里数"
|
|
|
style="width: 80%"
|
|
style="width: 80%"
|
|
|
clearable
|
|
clearable
|
|
|
@change="handleAccumulatedMileageChange"
|
|
@change="handleAccumulatedMileageChange"
|
|
|
- disabled
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ disabled>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="(item, index) in configDialog.current.mileageAccumulatedAttrs"
|
|
v-for="(item, index) in configDialog.current.mileageAccumulatedAttrs"
|
|
|
:key="`mileage-${item.pointName}-${index}`"
|
|
:key="`mileage-${item.pointName}-${index}`"
|
|
|
:label="item.pointName"
|
|
:label="item.pointName"
|
|
|
- :value="item.pointName"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ :value="item.pointName" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</div>
|
|
</div>
|
|
@@ -344,20 +355,19 @@
|
|
|
<el-button @click="configDialog.visible = false">{{ t('common.cancel') }}</el-button>
|
|
<el-button @click="configDialog.visible = false">{{ t('common.cancel') }}</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
-
|
|
|
|
|
</template>
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { IotMaintainApi, IotMaintainVO } from '@/api/pms/maintain'
|
|
|
|
|
-import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
|
|
|
|
|
+import { IotMaintainApi } from '@/api/pms/maintain'
|
|
|
|
|
+import { IotDeviceApi } from '@/api/pms/device'
|
|
|
import * as UserApi from '@/api/system/user'
|
|
import * as UserApi from '@/api/system/user'
|
|
|
import { useUserStore } from '@/store/modules/user'
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
import { ref } from 'vue'
|
|
import { ref } from 'vue'
|
|
|
import { IotMaintenanceBomApi, IotMaintenanceBomVO } from '@/api/pms/iotmaintenancebom'
|
|
import { IotMaintenanceBomApi, IotMaintenanceBomVO } from '@/api/pms/iotmaintenancebom'
|
|
|
-import { IotMaintenancePlanApi, IotMaintenancePlanVO } from '@/api/pms/maintenance'
|
|
|
|
|
|
|
+import { IotMaintenancePlanApi } from '@/api/pms/maintenance'
|
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
|
-import MainPlanDeviceList from "@/views/pms/maintenance/MainPlanDeviceList.vue";
|
|
|
|
|
-import * as DeptApi from "@/api/system/dept";
|
|
|
|
|
-import {erpPriceTableColumnFormatter} from "@/utils";
|
|
|
|
|
|
|
+import MainPlanDeviceList from '@/views/pms/maintenance/maintenance-device-list.vue'
|
|
|
|
|
+import * as DeptApi from '@/api/system/dept'
|
|
|
|
|
+import { erpPriceTableColumnFormatter } from '@/utils'
|
|
|
import dayjs from 'dayjs'
|
|
import dayjs from 'dayjs'
|
|
|
|
|
|
|
|
/** 保养计划 表单 */
|
|
/** 保养计划 表单 */
|
|
@@ -386,11 +396,11 @@ const formData = ref({
|
|
|
responsiblePerson: undefined,
|
|
responsiblePerson: undefined,
|
|
|
remark: undefined,
|
|
remark: undefined,
|
|
|
failureName: undefined,
|
|
failureName: undefined,
|
|
|
- status: undefined,
|
|
|
|
|
|
|
+ status: undefined
|
|
|
})
|
|
})
|
|
|
const formRules = reactive({
|
|
const formRules = reactive({
|
|
|
name: [{ required: true, message: '计划名称不能为空', trigger: 'blur' }],
|
|
name: [{ required: true, message: '计划名称不能为空', trigger: 'blur' }],
|
|
|
- responsiblePerson: [{ required: true, message: '责任人不能为空', trigger: 'blur' }],
|
|
|
|
|
|
|
+ responsiblePerson: [{ required: true, message: '责任人不能为空', trigger: 'blur' }]
|
|
|
})
|
|
})
|
|
|
const formRef = ref() // 表单 Ref
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
|
|
|
@@ -411,8 +421,8 @@ const configDialog = reactive({
|
|
|
timePeriodLead: 0,
|
|
timePeriodLead: 0,
|
|
|
naturalDatePeriodLead: 0,
|
|
naturalDatePeriodLead: 0,
|
|
|
// 多个累计时长 累计里程 匹配
|
|
// 多个累计时长 累计里程 匹配
|
|
|
- accumulatedTimeOption: null, // 累计运行时长选项
|
|
|
|
|
- accumulatedMileageOption: null, // 累计运行公里数选项
|
|
|
|
|
|
|
+ accumulatedTimeOption: null, // 累计运行时长选项
|
|
|
|
|
+ accumulatedMileageOption: null // 累计运行公里数选项
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -444,15 +454,15 @@ const openConfigDialog = (row: IotMaintenanceBomVO) => {
|
|
|
naturalDatePeriodLead: row.naturalDatePeriodLead || 0
|
|
naturalDatePeriodLead: row.naturalDatePeriodLead || 0
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- configDialog.form.accumulatedTimeOption = row.code || null;
|
|
|
|
|
- configDialog.form.accumulatedMileageOption = row.type || null;
|
|
|
|
|
|
|
+ configDialog.form.accumulatedTimeOption = row.code || null
|
|
|
|
|
+ configDialog.form.accumulatedMileageOption = row.type || null
|
|
|
|
|
|
|
|
configDialog.visible = true
|
|
configDialog.visible = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 保存配置
|
|
// 保存配置
|
|
|
const saveConfig = () => {
|
|
const saveConfig = () => {
|
|
|
- (configFormRef.value as any).validate((valid: boolean) => {
|
|
|
|
|
|
|
+ ;(configFormRef.value as any).validate((valid: boolean) => {
|
|
|
if (!valid) return
|
|
if (!valid) return
|
|
|
if (!configDialog.current) return
|
|
if (!configDialog.current) return
|
|
|
|
|
|
|
@@ -468,8 +478,8 @@ const saveConfig = () => {
|
|
|
requiredFields.push('nextNaturalDate', 'naturalDatePeriodLead')
|
|
requiredFields.push('nextNaturalDate', 'naturalDatePeriodLead')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const missingFields = requiredFields.filter(field =>
|
|
|
|
|
- !configDialog.form[field as keyof typeof configDialog.form]
|
|
|
|
|
|
|
+ const missingFields = requiredFields.filter(
|
|
|
|
|
+ (field) => !configDialog.form[field as keyof typeof configDialog.form]
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
if (missingFields.length > 0) {
|
|
if (missingFields.length > 0) {
|
|
@@ -510,8 +520,8 @@ const queryParams = reactive({
|
|
|
planId: id
|
|
planId: id
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const deviceChoose = async(selectedDevices) => {
|
|
|
|
|
- const newIds = selectedDevices.map(device => device.id)
|
|
|
|
|
|
|
+const deviceChoose = async (selectedDevices) => {
|
|
|
|
|
+ const newIds = selectedDevices.map((device) => device.id)
|
|
|
deviceIds.value = [...new Set([...deviceIds.value, ...newIds])]
|
|
deviceIds.value = [...new Set([...deviceIds.value, ...newIds])]
|
|
|
const params = {
|
|
const params = {
|
|
|
deviceIds: deviceIds.value.join(',') // 明确传递数组参数
|
|
deviceIds: deviceIds.value.join(',') // 明确传递数组参数
|
|
@@ -520,7 +530,7 @@ const deviceChoose = async(selectedDevices) => {
|
|
|
// 根据选择的设备筛选出设备关系的分类BOM中与保养相关的节点项
|
|
// 根据选择的设备筛选出设备关系的分类BOM中与保养相关的节点项
|
|
|
const res = await IotDeviceApi.deviceAssociateBomList(queryParams)
|
|
const res = await IotDeviceApi.deviceAssociateBomList(queryParams)
|
|
|
const rawData = res || []
|
|
const rawData = res || []
|
|
|
- if(rawData.length === 0){
|
|
|
|
|
|
|
+ if (rawData.length === 0) {
|
|
|
message.error('选择的设备不存在待保养BOM项')
|
|
message.error('选择的设备不存在待保养BOM项')
|
|
|
}
|
|
}
|
|
|
if (!Array.isArray(rawData)) {
|
|
if (!Array.isArray(rawData)) {
|
|
@@ -528,7 +538,7 @@ const deviceChoose = async(selectedDevices) => {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
// 转换数据结构(根据你的接口定义调整)
|
|
// 转换数据结构(根据你的接口定义调整)
|
|
|
- const newItems = rawData.map(device => ({
|
|
|
|
|
|
|
+ const newItems = rawData.map((device) => ({
|
|
|
assetClass: device.assetClass,
|
|
assetClass: device.assetClass,
|
|
|
deviceCode: device.deviceCode,
|
|
deviceCode: device.deviceCode,
|
|
|
deviceName: device.deviceName,
|
|
deviceName: device.deviceName,
|
|
@@ -537,7 +547,7 @@ const deviceChoose = async(selectedDevices) => {
|
|
|
name: device.name,
|
|
name: device.name,
|
|
|
code: device.code,
|
|
code: device.code,
|
|
|
assetProperty: device.assetProperty,
|
|
assetProperty: device.assetProperty,
|
|
|
- remark: null, // 初始化备注
|
|
|
|
|
|
|
+ remark: null, // 初始化备注
|
|
|
deviceId: device.id, // 移除操作需要
|
|
deviceId: device.id, // 移除操作需要
|
|
|
bomNodeId: device.bomNodeId,
|
|
bomNodeId: device.bomNodeId,
|
|
|
totalRunTime: device.totalRunTime,
|
|
totalRunTime: device.totalRunTime,
|
|
@@ -552,13 +562,13 @@ const deviceChoose = async(selectedDevices) => {
|
|
|
naturalDatePeriodLead: 0
|
|
naturalDatePeriodLead: 0
|
|
|
}))
|
|
}))
|
|
|
// 获取选择的设备相关的id数组
|
|
// 获取选择的设备相关的id数组
|
|
|
- newItems.forEach(item => {
|
|
|
|
|
|
|
+ newItems.forEach((item) => {
|
|
|
deviceIds.value.push(item.deviceId)
|
|
deviceIds.value.push(item.deviceId)
|
|
|
})
|
|
})
|
|
|
// 合并到现有列表(去重)
|
|
// 合并到现有列表(去重)
|
|
|
- newItems.forEach(item => {
|
|
|
|
|
|
|
+ newItems.forEach((item) => {
|
|
|
const exists = list.value.some(
|
|
const exists = list.value.some(
|
|
|
- existing => (existing.deviceId === item.deviceId && existing.bomNodeId === item.bomNodeId)
|
|
|
|
|
|
|
+ (existing) => existing.deviceId === item.deviceId && existing.bomNodeId === item.bomNodeId
|
|
|
)
|
|
)
|
|
|
if (!exists) {
|
|
if (!exists) {
|
|
|
list.value.push(item)
|
|
list.value.push(item)
|
|
@@ -568,21 +578,19 @@ const deviceChoose = async(selectedDevices) => {
|
|
|
|
|
|
|
|
const deviceFormRef = ref<InstanceType<typeof MainPlanDeviceList>>()
|
|
const deviceFormRef = ref<InstanceType<typeof MainPlanDeviceList>>()
|
|
|
const openForm = () => {
|
|
const openForm = () => {
|
|
|
- deviceFormRef.value?.open();
|
|
|
|
|
|
|
+ deviceFormRef.value?.open()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const close = () => {
|
|
const close = () => {
|
|
|
delView(unref(currentRoute))
|
|
delView(unref(currentRoute))
|
|
|
- push({ name: 'IotMaintenancePlan', params:{}})
|
|
|
|
|
|
|
+ push({ name: 'IotMaintenancePlan', params: {} })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 累计运行时长变更
|
|
// 累计运行时长变更
|
|
|
-const handleAccumulatedTimeChange = (option) => {
|
|
|
|
|
-}
|
|
|
|
|
|
|
+const handleAccumulatedTimeChange = (option) => {}
|
|
|
|
|
|
|
|
// 累计运行公里数变更
|
|
// 累计运行公里数变更
|
|
|
-const handleAccumulatedMileageChange = (option) => {
|
|
|
|
|
-}
|
|
|
|
|
|
|
+const handleAccumulatedMileageChange = (option) => {}
|
|
|
|
|
|
|
|
/** 提交表单 */
|
|
/** 提交表单 */
|
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
@@ -617,46 +625,58 @@ const submitForm = async () => {
|
|
|
|
|
|
|
|
// 新增表单校验规则
|
|
// 新增表单校验规则
|
|
|
const configFormRules = reactive({
|
|
const configFormRules = reactive({
|
|
|
- nextRunningKilometers: [{
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '里程周期必须填写',
|
|
|
|
|
- trigger: 'blur'
|
|
|
|
|
- }],
|
|
|
|
|
- kiloCycleLead: [{
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '提前量必须填写',
|
|
|
|
|
- trigger: 'blur'
|
|
|
|
|
- }],
|
|
|
|
|
- nextRunningTime: [{
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '时间周期必须填写',
|
|
|
|
|
- trigger: 'blur'
|
|
|
|
|
- }],
|
|
|
|
|
- timePeriodLead: [{
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '提前量必须填写',
|
|
|
|
|
- trigger: 'blur'
|
|
|
|
|
- }],
|
|
|
|
|
- nextNaturalDate: [{
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '自然日周期必须填写',
|
|
|
|
|
- trigger: 'blur'
|
|
|
|
|
- }],
|
|
|
|
|
- naturalDatePeriodLead: [{
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '提前量必须填写',
|
|
|
|
|
- trigger: 'blur'
|
|
|
|
|
- }]
|
|
|
|
|
|
|
+ nextRunningKilometers: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '里程周期必须填写',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ kiloCycleLead: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '提前量必须填写',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ nextRunningTime: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '时间周期必须填写',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ timePeriodLead: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '提前量必须填写',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ nextNaturalDate: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '自然日周期必须填写',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ naturalDatePeriodLead: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '提前量必须填写',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
/** 校验表格数据 */
|
|
/** 校验表格数据 */
|
|
|
const validateTableData = (): boolean => {
|
|
const validateTableData = (): boolean => {
|
|
|
let isValid = true
|
|
let isValid = true
|
|
|
const errorMessages: string[] = []
|
|
const errorMessages: string[] = []
|
|
|
- const noRulesErrorMessages: string[] = [] // 未设置任何保养项规则 的错误提示信息
|
|
|
|
|
- const noRules: string[] = [] // 行记录中设置了保养规则的记录数量
|
|
|
|
|
- const configErrors: string[] = [] // 保养规则配置弹出框
|
|
|
|
|
- let shouldBreak = false;
|
|
|
|
|
|
|
+ const noRulesErrorMessages: string[] = [] // 未设置任何保养项规则 的错误提示信息
|
|
|
|
|
+ const noRules: string[] = [] // 行记录中设置了保养规则的记录数量
|
|
|
|
|
+ const configErrors: string[] = [] // 保养规则配置弹出框
|
|
|
|
|
+ let shouldBreak = false
|
|
|
|
|
|
|
|
if (list.value.length === 0) {
|
|
if (list.value.length === 0) {
|
|
|
errorMessages.push('请至少添加一条设备保养明细')
|
|
errorMessages.push('请至少添加一条设备保养明细')
|
|
@@ -667,20 +687,24 @@ const validateTableData = (): boolean => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
list.value.forEach((row, index) => {
|
|
list.value.forEach((row, index) => {
|
|
|
- if (shouldBreak) return;
|
|
|
|
|
|
|
+ if (shouldBreak) return
|
|
|
const rowNumber = index + 1 // 用户可见的行号从1开始
|
|
const rowNumber = index + 1 // 用户可见的行号从1开始
|
|
|
const deviceIdentifier = `${row.deviceCode}-${row.name}` // 设备标识
|
|
const deviceIdentifier = `${row.deviceCode}-${row.name}` // 设备标识
|
|
|
// 校验逻辑
|
|
// 校验逻辑
|
|
|
const checkConfig = (ruleName: string, ruleValue: number, configField: keyof typeof row) => {
|
|
const checkConfig = (ruleName: string, ruleValue: number, configField: keyof typeof row) => {
|
|
|
- if (ruleValue === 0) { // 规则开启
|
|
|
|
|
|
|
+ if (ruleValue === 0) {
|
|
|
|
|
+ // 规则开启
|
|
|
if (!row[configField] || row[configField] <= 0) {
|
|
if (!row[configField] || row[configField] <= 0) {
|
|
|
- configErrors.push(`第 ${rowNumber} 行(${deviceIdentifier}):请点击【配置】维护${ruleName}上次保养值`)
|
|
|
|
|
|
|
+ configErrors.push(
|
|
|
|
|
+ `第 ${rowNumber} 行(${deviceIdentifier}):请点击【配置】维护${ruleName}上次保养值`
|
|
|
|
|
+ )
|
|
|
isValid = false
|
|
isValid = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 里程校验逻辑
|
|
// 里程校验逻辑
|
|
|
- if (row.mileageRule === 0) { // 假设 0 表示开启状态
|
|
|
|
|
|
|
+ if (row.mileageRule === 0) {
|
|
|
|
|
+ // 假设 0 表示开启状态
|
|
|
if (!row.nextRunningKilometers || row.nextRunningKilometers <= 0) {
|
|
if (!row.nextRunningKilometers || row.nextRunningKilometers <= 0) {
|
|
|
errorMessages.push(`第 ${rowNumber} 行:开启里程规则必须填写有效的里程周期`)
|
|
errorMessages.push(`第 ${rowNumber} 行:开启里程规则必须填写有效的里程周期`)
|
|
|
isValid = false
|
|
isValid = false
|
|
@@ -713,10 +737,10 @@ const validateTableData = (): boolean => {
|
|
|
// 如果选中的一行记录未设置任何保养规则 提示 ‘保养项未设置任何保养规则’
|
|
// 如果选中的一行记录未设置任何保养规则 提示 ‘保养项未设置任何保养规则’
|
|
|
if (noRules.length === 3) {
|
|
if (noRules.length === 3) {
|
|
|
isValid = false
|
|
isValid = false
|
|
|
- shouldBreak = true; // 设置标志变量为true,退出循环
|
|
|
|
|
|
|
+ shouldBreak = true // 设置标志变量为true,退出循环
|
|
|
noRulesErrorMessages.push('保养项至少设置1个保养规则')
|
|
noRulesErrorMessages.push('保养项至少设置1个保养规则')
|
|
|
}
|
|
}
|
|
|
- noRules.length = 0;
|
|
|
|
|
|
|
+ noRules.length = 0
|
|
|
})
|
|
})
|
|
|
if (errorMessages.length > 0) {
|
|
if (errorMessages.length > 0) {
|
|
|
message.error('设置保养规则后,请维护对应的周期值')
|
|
message.error('设置保养规则后,请维护对应的周期值')
|
|
@@ -761,29 +785,31 @@ onMounted(async () => {
|
|
|
deptUsers.value = await UserApi.getDeptUsersByDeptId(deptId)
|
|
deptUsers.value = await UserApi.getDeptUsersByDeptId(deptId)
|
|
|
formData.value.deptId = deptId
|
|
formData.value.deptId = deptId
|
|
|
// if (id){
|
|
// if (id){
|
|
|
- formType.value = 'update'
|
|
|
|
|
- const plan = await IotMaintenancePlanApi.getIotMaintenancePlan(id);
|
|
|
|
|
- deviceLabel.value = plan.deviceName
|
|
|
|
|
- formData.value = plan
|
|
|
|
|
|
|
+ formType.value = 'update'
|
|
|
|
|
+ const plan = await IotMaintenancePlanApi.getIotMaintenancePlan(id)
|
|
|
|
|
+ deviceLabel.value = plan.deviceName
|
|
|
|
|
+ formData.value = plan
|
|
|
// 查询保养责任人
|
|
// 查询保养责任人
|
|
|
- const personId = formData.value.responsiblePerson ? Number(formData.value.responsiblePerson) : 0;
|
|
|
|
|
|
|
+ const personId = formData.value.responsiblePerson ? Number(formData.value.responsiblePerson) : 0
|
|
|
UserApi.getUser(personId).then((res) => {
|
|
UserApi.getUser(personId).then((res) => {
|
|
|
- formData.value.responsiblePerson = res.nickname;
|
|
|
|
|
|
|
+ formData.value.responsiblePerson = res.nickname
|
|
|
})
|
|
})
|
|
|
// 查询保养计划明细
|
|
// 查询保养计划明细
|
|
|
- const data = await IotMaintenanceBomApi.getMainPlanBOMs(queryParams);
|
|
|
|
|
|
|
+ const data = await IotMaintenanceBomApi.getMainPlanBOMs(queryParams)
|
|
|
list.value = []
|
|
list.value = []
|
|
|
if (Array.isArray(data)) {
|
|
if (Array.isArray(data)) {
|
|
|
- list.value = data.map(item => ({
|
|
|
|
|
|
|
+ list.value = data.map((item) => ({
|
|
|
...item,
|
|
...item,
|
|
|
// 这里可以添加必要的字段转换(如果有日期等需要格式化的字段)
|
|
// 这里可以添加必要的字段转换(如果有日期等需要格式化的字段)
|
|
|
- lastNaturalDate: item.lastNaturalDate ? dayjs(item.lastNaturalDate).format('YYYY-MM-DD') : null
|
|
|
|
|
|
|
+ lastNaturalDate: item.lastNaturalDate
|
|
|
|
|
+ ? dayjs(item.lastNaturalDate).format('YYYY-MM-DD')
|
|
|
|
|
+ : null
|
|
|
}))
|
|
}))
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
const handleDelete = async (str: string) => {
|
|
const handleDelete = async (str: string) => {
|
|
|
try {
|
|
try {
|
|
|
- const index = list.value.findIndex((item) => (item.id+'-'+item.bomNodeId) === str)
|
|
|
|
|
|
|
+ const index = list.value.findIndex((item) => item.id + '-' + item.bomNodeId === str)
|
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
|
// 通过 splice 删除元素
|
|
// 通过 splice 删除元素
|
|
|
list.value.splice(index, 1)
|
|
list.value.splice(index, 1)
|
|
@@ -799,17 +825,17 @@ const handleDelete = async (str: string) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
:deep(.el-input-number .el-input__inner) {
|
|
:deep(.el-input-number .el-input__inner) {
|
|
|
- text-align: left !important;
|
|
|
|
|
padding-left: 10px; /* 保持左侧间距 */
|
|
padding-left: 10px; /* 保持左侧间距 */
|
|
|
|
|
+ text-align: left !important;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* 分组容器样式 */
|
|
/* 分组容器样式 */
|
|
|
.form-group {
|
|
.form-group {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
- border: 1px solid #dcdfe6;
|
|
|
|
|
- border-radius: 4px;
|
|
|
|
|
padding: 20px 15px 10px;
|
|
padding: 20px 15px 10px;
|
|
|
margin-bottom: 18px;
|
|
margin-bottom: 18px;
|
|
|
|
|
+ border: 1px solid #dcdfe6;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
transition: border-color 0.2s;
|
|
transition: border-color 0.2s;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -818,10 +844,10 @@ const handleDelete = async (str: string) => {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
top: -10px;
|
|
top: -10px;
|
|
|
left: 20px;
|
|
left: 20px;
|
|
|
- background: white;
|
|
|
|
|
padding: 0 8px;
|
|
padding: 0 8px;
|
|
|
- color: #606266;
|
|
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
font-weight: 500;
|
|
font-weight: 500;
|
|
|
|
|
+ color: #606266;
|
|
|
|
|
+ background: white;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|