无人机管理后台前端(已迁走)
rjg
2025-06-03 07317dfd4ba3af0b2e58daec9ea0c776ac3181ec
Merge branch 'feature_0.2_add_expire_num' into test
1 files modified
131 ■■■■ changed files
src/views/system/user.vue 131 ●●●● patch | view | raw | blame | history
src/views/system/user.vue
@@ -66,6 +66,7 @@
          <template #userTypeName="{ row }">
            <el-tag>{{ row.userTypeName }}</el-tag>
          </template>
        </avue-crud>
        <el-dialog title="用户角色配置" append-to-body v-model="roleBox" width="345px">
          <el-tree :data="roleGrantList" show-checkbox check-strictly default-expand-all node-key="id" ref="treeRole"
@@ -153,7 +154,10 @@
      }
    };
    return {
      form: {},
      form: {
        flightStartTime: null, // 飞行事件开始时间
        flightEndTime: null, // 飞行事件结束时间
      },
      search: {},
      roleBox: false,
      excelBox: false,
@@ -363,13 +367,7 @@
                viewDisplay: false,
                rules: [{ required: true, validator: validatePass2, trigger: 'blur' }],
              },
              {
                label: '到期时间',
                prop: 'expireTime',
                type: 'datetime',
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss',
              },
            ],
          },
          {
@@ -503,24 +501,58 @@
                  },
                ],
              },
              // {
              //   label: '所属岗位',
              //   prop: 'postId',
              //   type: 'tree',
              //   multiple: true,
              //   dicData: [],
              //   props: {
              //     label: 'postName',
              //     value: 'id',
              //   },
              //   rules: [
              //     {
              //       required: true,
              //       message: '请选择所属岗位',
              //       trigger: 'click',
              //     },
              //   ],
              // },
            ],
          },
           {
            label: '登录限制',
            prop: '',
            icon: 'el-icon-s-custom',
            column: [
               {
                label: '到期时间',
                prop: 'expireTime',
                type: 'datetime',
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss',
              },
                {
                label: '次数限制',
                prop: 'maxLoginNum',
                type: 'input',
              },
               {
                label: '飞行开始时间',
                prop: 'flightStartTime',
               type: 'time',
                 format: 'HH:mm',
                valueFormat: 'HH:mm',
                rules: [
                  {
                    required: false,
                    message: '请输入飞行开始时间',
                    trigger: 'blur',
                  },
                ],
              },
              {
                label: '飞行结束时间',
                prop: 'flightEndTime',
                type: 'time',
                format: 'HH:mm',
                valueFormat: 'HH:mm',
                rules: [
                  {
                    required: false,
                    message: '请输入飞行结束时间',
                    trigger: 'blur',
                  },
                ],
              },
            ],
          },
        ],
@@ -732,6 +764,23 @@
      });
    },
    rowSave(row, done, loading) {
      // 格式化时间数据
       if (row.flightStartTime && row.flightEndTime) {
    // 验证 flightEndTime 是否小于 flightStartTime
   const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number);
    const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number);
    const startTotalMinutes = startHours * 60 + startMinutes;
    const endTotalMinutes = endHours * 60 + endMinutes;
    if (endTotalMinutes < startTotalMinutes) {
        this.$message.error('飞行结束时间不能小于飞行开始时间');
            loading();
        return;
    }
       }
      row.deptId = func.join(row.deptId);
      row.roleId = func.join(row.roleId);
      row.postId = func.join(row.postId);
@@ -753,6 +802,28 @@
      );
    },
    rowUpdate(row, index, done, loading) {
         // 格式化时间数据
      // if (row.flightStartTime) {
      //   row.flightStartTime = this.formatTime(row.flightStartTime);
      // }
      // if (row.flightEndTime) {
      //   row.flightEndTime = this.formatTime(row.flightEndTime);
      // }
       if (row.flightStartTime && row.flightEndTime) {
    // 验证 flightEndTime 是否小于 flightStartTime
   const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number);
    const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number);
    const startTotalMinutes = startHours * 60 + startMinutes;
    const endTotalMinutes = endHours * 60 + endMinutes;
    if (endTotalMinutes < startTotalMinutes) {
        this.$message.error('飞行结束时间不能小于飞行开始时间');
           loading();
        return ;
      }
       }
      row.deptId = func.join(row.deptId);
      row.roleId = func.join(row.roleId);
      row.postId = func.join(row.postId);
@@ -987,6 +1058,7 @@
          if (this.form.hasOwnProperty('postId')) {
            this.form.postId = func.split(this.form.postId);
          }
        });
      }
      this.initFlag = true;
@@ -1081,6 +1153,13 @@
        this.selectionClear();
      });
    },
    formatTime(time) {
      // 格式化时间为 HH:mm
      const date = new Date(time);
      const hours = String(date.getHours()).padStart(2, '0');
      const minutes = String(date.getMinutes()).padStart(2, '0');
      return `${hours}:${minutes}`;
    },
  },
};
</script>