|
|
@@ -635,6 +635,7 @@
|
|
|
:disabled="readonlyMode"
|
|
|
type="number"
|
|
|
class="config-table-control"
|
|
|
+ @change="(value) => handleStandardHoursChange(row, value)"
|
|
|
>
|
|
|
<!-- <template slot="append">
|
|
|
<span>H</span>
|
|
|
@@ -2629,6 +2630,61 @@
|
|
|
}
|
|
|
this.$emit('row-submit', row);
|
|
|
},
|
|
|
+ parseStandardHours(value) {
|
|
|
+ if (value === null || value === undefined || value === '') {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ const text = String(value).trim();
|
|
|
+ if (!text) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ const num = Number(text);
|
|
|
+ if (!Number.isFinite(num) || num < 0) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ },
|
|
|
+ formatExecutionEndTime(date) {
|
|
|
+ if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ const pad = (n) => String(n).padStart(2, '0');
|
|
|
+ return (
|
|
|
+ `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(
|
|
|
+ date.getDate()
|
|
|
+ )} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(
|
|
|
+ date.getSeconds()
|
|
|
+ )}`
|
|
|
+ );
|
|
|
+ },
|
|
|
+ handleStandardHoursChange(row, value) {
|
|
|
+ if (!row || this.readonlyMode) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 同步输入值:el-input 的 v-model 已写入 row.standardHours,这里以参数兜底
|
|
|
+ if (value !== undefined && value !== null) {
|
|
|
+ this.$set(row, 'standardHours', value);
|
|
|
+ }
|
|
|
+ const hours = this.parseStandardHours(row.standardHours);
|
|
|
+ if (hours === null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const startTimeText = row.executionStartTime;
|
|
|
+ if (!startTimeText) {
|
|
|
+ this.$message.warning('请先填写执行开始时间');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const startMs = this.parseDispatchTime(startTimeText);
|
|
|
+ if (startMs === null) {
|
|
|
+ this.$message.warning('执行开始时间格式不合法');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const endDate = new Date(startMs + hours * 60 * 60 * 1000);
|
|
|
+ const formatted = this.formatExecutionEndTime(endDate);
|
|
|
+ this.$set(row, 'executionEndTime', formatted);
|
|
|
+ this.$emit('time-change', row, 'executionEndTime');
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
handleDispatchRowSubmit(row) {
|
|
|
const task = this.ensureDispatchObjectSelected(row);
|
|
|
if (!task) {
|