Browse Source

feat: 新增插件功能模块

曾坤森 2 months ago
parent
commit
d22618b0fa

+ 2 - 2
.env.production

@@ -1,3 +1,3 @@
 VITE_NODE_ENV= production
-VITE_API_BASE_URL= 'https://192.168.1.214:5000/'
-VITE_API_DOWN_URL= 'https://192.168.1.214:5000/'
+VITE_API_BASE_URL= 'https://192.168.1.214:5001/'
+VITE_API_DOWN_URL= 'https://192.168.1.214:5001/'

+ 1 - 1
config/vite.config.dev.ts

@@ -13,7 +13,7 @@ export default mergeConfig(
       proxy: {
         '/api': {
           // 代理路径前缀
-          target: 'http://192.168.1.214:5000/', // 目标服务器地址
+          target: 'http://192.168.1.214:5001/', // 目标服务器地址
           changeOrigin: true, // 修改请求头中的 Origin
           // rewrite: path => path.replace(/^\/api/, ''), // 重写路径(可选)
         },

+ 36 - 34
src/api/dashboard.ts

@@ -1,58 +1,60 @@
 import axios from 'axios';
 import type { TableData } from '@arco-design/web-vue/es/table/interface';
 import instance from './interceptor';
-export interface RootObject {
-  pageIndex: number;
-  pageSize: number;
-  name: string;
-  address: string;
-  status: number;
-  startTime: string;
-  endTime: string;
-  entityType: number;
-}
-export interface Data {
-  id: number;
-  entityType: number;
-  name: string;
-  address: string;
-  status: number;
-  time: string;
-  data: string;
+export interface DataRes {
+  success: boolean;
+  message: string;
+  code: string;
+  data: DataList;
+}
+export interface DataList {
+  id?: number;
+  userId?: number;
+  server?: string;
+  user?: string;
+  password?: string;
+  location: string;
+  hostName: string;
 }
-
 export interface ExportUrl {
   success: boolean;
   message: string;
   code: string;
   data: string;
 }
-export interface DashboardList {
+export interface PluginList {
   success: boolean;
   message: string;
   code: string;
-  data: Data[];
+  data: DataList[];
   totalCount: number;
   totalPage: number;
 }
-export interface DashboardParams {
+export interface PluginParams {
   pageIndex: number;
   pageSize: number;
-  name: string | null;
+  hostName: string | null;
   address: string | null;
-  status: number | null;
-  time: [string, string];
-  startTime: string | null;
-  endTime: string | null;
-  entityType: number | null;
-}
-export async function queryDashboardList(
-  params: object
-): Promise<DashboardList> {
-  const res = await instance.post('/api/Author/GetDeviceList', params);
+  server: string | null;
+  location: string | null;
+}
+export async function queryPluginList(params: object): Promise<PluginList> {
+  const res = await instance.post('/api/Plugin/PluginList', params);
+  return res.data;
+}
+export async function deletePluginDetails(params: object): Promise<DataRes> {
+  const res = await instance.post('/api/Plugin/DeletePlugin', params);
+  return res.data;
+}
+export async function getPluginDetails(params: object): Promise<DataRes> {
+  const res = await instance.post('/api/Plugin/PluginDetail', params);
+  return res.data;
+}
+export async function savePluginDetails(params: object): Promise<DataRes> {
+  const res = await instance.post('/api​/Plugin​/SavePlugin', params);
   return res.data;
 }
-export async function exportDashboardList(params: object): Promise<ExportUrl> {
+export async function exportPluginList(params: object): Promise<ExportUrl> {
   const res = await instance.post('/api/Author/Export', params);
   return res.data;
 }

+ 1 - 1
src/api/user.ts

@@ -15,7 +15,7 @@ export interface Data {
   token: string;
   refreshToken: string;
   id: number;
-  name: string;
+  user: string;
   password: string;
   desc: string;
   privilege: number;

+ 2 - 1
src/locale/en-US.ts

@@ -1,7 +1,7 @@
 import localeMessageBox from '@/components/message-box/locale/en-US';
 import localeLogin from '@/views/login/locale/en-US';
 
-import localeWorkplace from '@/views/dashboard/workplace/locale/en-US';
+import localeWorkplace from '@/views/dashboard/plugin/locale/en-US';
 
 import locale403 from '@/views/exception/403/locale/en-US';
 import locale404 from '@/views/exception/404/locale/en-US';
@@ -28,6 +28,7 @@ export default {
   'searchTable.form.delete': 'Delete',
   'searchTable.form.confirm': 'Confirm',
   'searchTable.table.number': 'No.',
+  'searchTable.form.edit': 'Edit',
   'searchTable.table.optional': 'Optional',
   'modal.warning.title': 'Warning',
   'modal.warning.content':

+ 2 - 1
src/locale/zh-CN.ts

@@ -1,7 +1,7 @@
 import localeMessageBox from '@/components/message-box/locale/zh-CN';
 import localeLogin from '@/views/login/locale/zh-CN';
 
-import localeWorkplace from '@/views/dashboard/workplace/locale/zh-CN';
+import localeWorkplace from '@/views/dashboard/plugin/locale/zh-CN';
 
 import locale403 from '@/views/exception/403/locale/zh-CN';
 import locale404 from '@/views/exception/404/locale/zh-CN';
@@ -28,6 +28,7 @@ export default {
   'searchTable.form.add': '新增',
   'searchTable.form.confirm': '确定',
   'searchTable.table.number': '序号',
+  'searchTable.form.edit': '编辑',
   'searchTable.table.optional': '操作',
   'modal.warning.title': '提示',
   'modal.warning.content': '是否继续进行该操作删除后无法恢复?',

+ 3 - 3
src/router/constants.ts

@@ -9,10 +9,10 @@ export const NOT_FOUND = {
 
 export const REDIRECT_ROUTE_NAME = 'Redirect';
 
-export const DEFAULT_ROUTE_NAME = 'Workplace';
+export const DEFAULT_ROUTE_NAME = 'Plugin';
 
 export const DEFAULT_ROUTE = {
-  title: 'menu.dashboard.workplace',
+  title: 'menu.dashboard.plugin',
   name: DEFAULT_ROUTE_NAME,
-  fullPath: '/dashboard/workplace',
+  fullPath: '/dashboard/plugin',
 };

+ 1 - 1
src/router/index.ts

@@ -17,7 +17,7 @@ const router = createRouter({
   routes: [
     {
       path: '/',
-      redirect: '/dashboard/workplace',
+      redirect: '/dashboard/plugin',
     },
     {
       path: '/login',

+ 4 - 4
src/router/routes/modules/dashboard.ts

@@ -13,11 +13,11 @@ const DASHBOARD: AppRouteRecordRaw = {
   },
   children: [
     {
-      path: 'workplace',
-      name: 'Workplace',
-      component: () => import('@/views/dashboard/workplace/index.vue'),
+      path: 'plugin',
+      name: 'Plugin',
+      component: () => import('@/views/dashboard/plugin/index.vue'),
       meta: {
-        locale: 'menu.dashboard.workplace',
+        locale: 'menu.dashboard.plugin',
         requiresAuth: true,
         roles: ['*'],
       },

+ 4 - 4
src/store/modules/user/index.ts

@@ -13,7 +13,7 @@ import useAppStore from '../app';
 const { setToken, clearToken } = useAuth();
 const useUserStore = defineStore('user', {
   state: (): UserState => ({
-    name: loginInfo.value.name || '',
+    name: loginInfo.value.user || '',
     avatar:
       'https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/a8c8cdb109cb051163646151a4a5083b.png~tplv-uwbnlip3yd-webp.webp',
     email: undefined,
@@ -49,15 +49,15 @@ const useUserStore = defineStore('user', {
     // Get user's information
     async info(data: Data) {
       // const res = await getUserInfo();
-      const { name } = data;
-      this.setInfo({ name: name, role: String(data.privilege) as RoleType });
+      const { user } = data;
+      this.setInfo({ name: user, role: String(data.privilege) as RoleType });
     },
 
     // Login
     async login(loginForm: LoginData) {
       try {
         const params = {
-          name: loginForm.username,
+          user: loginForm.username,
           password: loginForm.password,
         };
         const res = await userLogin(params);

+ 2 - 2
src/utils/auth.ts

@@ -8,7 +8,7 @@ interface Token {
 interface LoginConfig {
   rememberPassword: boolean;
   id: number | null;
-  name: string | null;
+  user: string | null;
   privilege: number | null;
 }
 export const useAuth = () => {
@@ -46,6 +46,6 @@ export const useAuth = () => {
 export const loginInfo = useStorage<LoginConfig>(USER_INFO, {
   rememberPassword: true,
   id: null,
-  name: '',
+  user: '',
   privilege: null,
 });

+ 0 - 0
src/views/dashboard/workplace/conf.ts → src/views/dashboard/plugin/conf.ts


+ 132 - 0
src/views/dashboard/plugin/edit.vue

@@ -0,0 +1,132 @@
+<template>
+  <div>
+    <a-modal
+      v-model:visible="visible"
+      width="auto"
+      :title="id ? $t('searchTable.form.edit') : $t('searchTable.form.add')"
+      @cancel="() => handleCancel()"
+      @before-ok="handleBeforeOk"
+    >
+      <a-form :model="form" auto-label-width ref="formRef">
+        <a-row :gutter="8">
+          <a-col :span="12">
+            <a-form-item
+              field="user"
+              :label="t('dashboard.form.user')"
+              :rules="getRules(t).required"
+            >
+              <a-input v-model="form.user" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              field="server"
+              :label="t('dashboard.form.server')"
+              :rules="getRules(t).required"
+            >
+              <a-input v-model="form.server" />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="8">
+          <a-col :span="12">
+            <a-form-item
+              field="location"
+              :label="t('dashboard.form.location')"
+              :rules="getRules(t).required"
+            >
+              <a-input v-model="form.location" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              field="hostName"
+              :label="t('dashboard.form.hostName')"
+              :rules="getRules(t).required"
+            >
+              <a-input v-model="form.hostName" />
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </a-form>
+    </a-modal>
+  </div>
+</template>
+<script setup lang="ts" name="EditDialog">
+import { reactive, ref, shallowRef, watch, getCurrentInstance } from 'vue';
+import { getPluginDetails, savePluginDetails } from '@/api/dashboard';
+import type { DataList } from '@/api/dashboard';
+import { privilegeList } from '@/utils/const';
+import { useI18n } from 'vue-i18n';
+import { getRules } from '@/utils/const';
+const formRef = ref();
+const { t } = useI18n();
+
+const this_ = getCurrentInstance()?.appContext.config.globalProperties;
+
+interface EditDialogProps {
+  modelValue: boolean;
+  id: number | null;
+}
+interface EditDialogEmits {
+  (e: 'update:modelValue', value: boolean): void;
+  (e: 'update-list'): void;
+}
+const props = withDefaults(defineProps<EditDialogProps>(), {
+  modelValue: false,
+  id: null,
+});
+const emit = defineEmits<EditDialogEmits>();
+const visible = shallowRef<boolean>(false);
+
+watch(
+  () => props.modelValue,
+  value => {
+    visible.value = value;
+    if (value && props.id) {
+      getPluginDetails({ id: props.id }).then(res => {
+        form.value = res.data;
+      });
+    }
+  }
+);
+const formModel = () => {
+  return {
+    server: '',
+    user: '',
+    password: '',
+    location: '',
+    hostName: '',
+  } as DataList;
+};
+const form = ref<DataList>(formModel());
+
+const handleBeforeOk = (done: (closed: boolean) => void) => {
+  formRef.value.validate().then((data: DataList) => {
+    if (!data) {
+      savePluginDetails(form.value)
+        .then(res => {
+          if (res.success) {
+            this_?.$message.success(t('message.success'));
+            handleCancel();
+            done(true); // 关闭模态框
+          } else {
+            res.message && this_?.$message.error(res.message);
+            done(false); // 关闭loading
+          }
+        })
+        .catch(() => {
+          done(false); // 不关闭模态框(例如提交失败时)
+        });
+    } else {
+      done(false); // 不关闭模态框(例如提交失败时)
+    }
+  });
+};
+const handleCancel = () => {
+  form.value = formModel();
+  visible.value = false;
+  emit('update:modelValue', false);
+  emit('update-list');
+};
+</script>

+ 111 - 138
src/views/dashboard/workplace/index.vue → src/views/dashboard/plugin/index.vue

@@ -12,82 +12,34 @@
             <a-row :gutter="16">
               <a-col :span="6">
                 <a-form-item
-                  field="address"
-                  :label="t('dashboard.form.address')"
+                  field="server"
+                  :label="t('dashboard.form.server')"
                   label-col-flex="50px"
                 >
                   <a-input
-                    v-model="formModel.address"
-                    :placeholder="t('dashboard.form.address')"
+                    v-model="formModel.server"
+                    :placeholder="t('dashboard.form.server')"
                     allow-clear
                   />
                 </a-form-item>
               </a-col>
               <a-col :span="6">
                 <a-form-item
-                  field="name"
-                  :label="t('dashboard.form.name')"
+                  field="hostName"
+                  :label="t('dashboard.form.hostName')"
                   label-col-flex="50px"
                 >
                   <a-input
-                    v-model="formModel.name"
-                    :placeholder="t('dashboard.form.name')"
+                    v-model="formModel.hostName"
+                    :placeholder="t('dashboard.form.hostName')"
                     allow-clear
                   />
                 </a-form-item>
               </a-col>
-              <a-col :span="6">
-                <a-form-item
-                  field="entityType"
-                  :label="t('dashboard.form.entityType')"
-                  label-col-flex="60px"
-                >
-                  <a-select
-                    v-model="formModel.entityType"
-                    :placeholder="t('dashboard.form.entityType')"
-                    allow-clear
-                    @clear="formModel.entityType = null"
-                  >
-                    <a-option
-                      v-for="item of entityTypeList"
-                      :value="item.value"
-                      :label="item.label"
-                    />
-                  </a-select>
-                </a-form-item>
-              </a-col>
-              <a-col :span="6">
-                <a-form-item
-                  field="statusTypeList"
-                  :label="t('dashboard.form.status')"
-                  label-col-flex="60px"
-                >
-                  <a-select
-                    v-model="formModel.status"
-                    :placeholder="t('dashboard.form.status')"
-                    allow-clear
-                    @clear="formModel.status = null"
-                  >
-                    <a-option
-                      v-for="item of statusTypeList"
-                      :value="item.value"
-                      :label="item.label"
-                    />
-                  </a-select>
-                </a-form-item>
-              </a-col>
-              <a-col :span="6">
-                <a-form-item
-                  :label="t('dashboard.form.timeRange')"
-                  label-col-flex="60px"
-                >
-                  <a-range-picker v-model="formModel.time" />
-                </a-form-item>
-              </a-col>
             </a-row>
           </a-form>
         </a-col>
-        <a-divider :style="{ height: '84px' }" direction="vertical" />
+        <a-divider :style="{ height: '86px' }" direction="vertical" />
         <a-col :flex="'86px'">
           <a-space :size="10">
             <a-button type="primary" @click="search">
@@ -103,14 +55,16 @@
               {{ t('searchTable.form.reset') }}
             </a-button>
           </a-space>
-          <a-space class="right-side">
-            <a-button type="primary" @click="downloadExcel">
-              <template #icon>
-                <icon-download />
-              </template>
-              {{ t('searchTable.form.down') }}
-            </a-button>
-          </a-space>
+          <a-button
+            type="primary"
+            class="right-side"
+            @click="showEditDialog = true"
+          >
+            <template #icon>
+              <icon-plus />
+            </template>
+            {{ t('searchTable.form.add') }}
+          </a-button>
         </a-col>
       </a-row>
       <a-table
@@ -118,7 +72,7 @@
         row-key="name"
         :loading="loading"
         :pagination="pagination"
-        :columns="(cloneColumns as TableColumnData[])"
+        :columns="cloneColumns as TableColumnData[]"
         :data="renderData"
         :bordered="false"
         :size="size"
@@ -129,26 +83,26 @@
         <template #index="{ rowIndex }">
           {{ rowIndex + 1 + (pagination.current - 1) * pagination.pageSize }}
         </template>
-
-        <template #entityType="{ record }">
-          <span>
-            {{
-              entityTypeList.find(item => item.value === record.entityType)
-                ?.label
-            }}
-          </span>
-        </template>
-        <template #status="{ record }">
-          <BTag :status="record.status">
-            {{
-              statusTypeList.find(item => item.value === record.status)?.label
-            }}
-          </BTag>
-        </template>
-        <template #time="{ record }">
-          <span>{{
-            record.time && dayjs(record.time).format('YYYY-MM-DD HH:mm:ss')
-          }}</span>
+        <template #optional="{ record }">
+          <a-button
+            type="primary"
+            size="mini"
+            class="action-button"
+            @click="
+              () => {
+                ((pluginId = record.id), (showEditDialog = true));
+              }
+            "
+          >
+            {{ t('searchTable.form.edit') }}
+          </a-button>
+          <a-button
+            status="danger"
+            size="mini"
+            @click="handleDeleteFun(record.id)"
+          >
+            {{ t('searchTable.form.delete') }}
+          </a-button>
         </template>
       </a-table>
     </a-card>
@@ -166,6 +120,11 @@
         <!-- 只保留取消按钮,确认按钮被隐藏 -->
       </template>
     </a-modal>
+    <EditDialog
+      v-model="showEditDialog"
+      :id="pluginId"
+      @updateList="updateListFun"
+    ></EditDialog>
   </div>
 </template>
 
@@ -178,10 +137,15 @@ import {
   getCurrentInstance,
   computed,
 } from 'vue';
-import { queryDashboardList, exportDashboardList } from '@/api/dashboard';
-import type { DashboardParams, Data } from '@/api/dashboard';
+import {
+  queryPluginList,
+  exportPluginList,
+  deletePluginDetails,
+} from '@/api/dashboard';
+import type { PluginParams, DataList } from '@/api/dashboard';
 import { SizeProps, Pagination } from '@/types/global';
 import BTag from '@/components/business/b-tag/index.vue';
+import { Modal } from '@arco-design/web-vue';
 import type { TableColumnData } from '@arco-design/web-vue';
 import useLoading from '@/hooks/loading';
 import { useI18n } from 'vue-i18n';
@@ -189,6 +153,7 @@ import { entityTypeList, statusTypeList, DeviceInfo } from './conf';
 import dayjs from 'dayjs';
 import { downLoadFun } from '@/utils/const';
 import { useIntervalFn } from '@vueuse/core';
+import EditDialog from './edit.vue';
 
 const { t } = useI18n();
 
@@ -203,33 +168,31 @@ const cloneColumns = computed(() => [
     width: 60,
   },
   {
-    title: t('dashboard.table.time'),
-    dataIndex: 'time',
-    slotName: 'time',
+    title: t('dashboard.form.server'),
+    dataIndex: 'server',
+    slotName: 'server',
     ellipsis: true,
   },
   {
-    title: t('dashboard.form.status'),
-    dataIndex: 'status',
-    slotName: 'status',
+    title: t('dashboard.form.user'),
+    dataIndex: 'user',
+    slotName: 'user',
     width: 120,
   },
   {
-    title: t('dashboard.form.name'),
-    dataIndex: 'name',
-    slotName: 'name',
+    title: t('dashboard.form.location'),
+    dataIndex: 'location',
+    slotName: 'location',
   },
   {
-    title: t('dashboard.form.entityType'),
-    dataIndex: 'entityType',
-    slotName: 'entityType',
+    title: t('dashboard.form.hostName'),
+    dataIndex: 'hostName',
+    slotName: 'hostName',
   },
-
   {
-    title: t('dashboard.form.address'),
-    dataIndex: 'address',
-    ellipsis: true,
-    tooltip: true,
+    title: t('searchTable.table.optional'),
+    align: 'center',
+    slotName: 'optional',
   },
 ]);
 
@@ -244,29 +207,24 @@ const generateFormModel = () => {
   return {
     pageIndex: 1,
     pageSize: 20,
-    name: null,
+    hostName: null,
     address: null,
-    status: null,
-    startTime: null,
-    endTime: null,
-    time: ['', ''],
-    entityType: null,
-  } as DashboardParams;
+    user: null,
+    server: null,
+    location: null,
+  } as PluginParams;
 };
-const renderData = ref<Data[]>([] as Data[]);
+const renderData = ref<DataList[]>([] as DataList[]);
 const size = ref<SizeProps>('medium');
-const formModel = ref<DashboardParams>(generateFormModel());
+const formModel = ref<PluginParams>(generateFormModel());
 const visible = shallowRef<boolean>(false);
+const showEditDialog = shallowRef<boolean>(false);
+const pluginId = shallowRef<number | null>(null);
 const this_ = getCurrentInstance()?.appContext.config.globalProperties;
 const deviceInfo = ref<DeviceInfo[]>([] as DeviceInfo[]);
 function searchTable() {
   // setLoading(true);
-  const [startTime, endTime] = formModel.value.time
-    ? formModel.value.time
-    : ['', ''];
-  formModel.value.startTime = startTime ? startTime : null;
-  formModel.value.endTime = endTime ? endTime : null;
-  queryDashboardList(formModel.value)
+  queryPluginList(formModel.value)
     .then(res => {
       pagination.current = formModel.value.pageIndex;
       pagination.pageSize = pagination.pageSize;
@@ -278,11 +236,6 @@ function searchTable() {
     });
 }
 searchTable();
-const { pause, resume, isActive } = useIntervalFn(() => {
-  /* your function */
-  formModel.value.pageIndex = 1;
-  searchTable();
-}, 1000);
 const search = () => {
   searchTable();
 };
@@ -291,10 +244,7 @@ const reset = () => {
 };
 const downloadExcel = () => {
   setLoading(true);
-  const [startTime, endTime] = formModel.value.time;
-  formModel.value.startTime = startTime ? startTime : null;
-  formModel.value.endTime = endTime ? endTime : null;
-  exportDashboardList(formModel.value)
+  exportPluginList(formModel.value)
     .then(res => {
       if (!res.success) {
         return;
@@ -308,18 +258,13 @@ const downloadExcel = () => {
 };
 const onPageChange = (current: number) => {
   formModel.value.pageIndex = current;
-  if (current === 1) {
-    resume();
-  } else {
-    pause();
-  }
   searchTable();
 };
 
-const handleClick = (value: Data) => {
-  if (value.data) {
+const handleClick = (value: DataList) => {
+  if (value.server) {
     deviceInfo.value.length = 0;
-    const obj = JSON.parse(value.data);
+    const obj = JSON.parse(value.server);
     for (const key in obj) {
       deviceInfo.value.push({
         label: key,
@@ -335,12 +280,36 @@ const handleClick = (value: Data) => {
 const handleCancel = () => {
   visible.value = false;
 };
+const updateListFun = () => {
+  pluginId.value = null;
+  searchTable();
+};
+const handleDeleteFun = (id: number) => {
+  Modal.warning({
+    title: t('modal.warning.title'),
+    content: t('modal.warning.content'),
+    okText: t('searchTable.form.confirm'),
+    onBeforeOk: (done: (closed: boolean) => void) => {
+      deletePluginDetails({ id })
+        .then(res => {
+          if (res.success) {
+            this_?.$message.success(t('message.success'));
+            searchTable();
+          }
+        })
+        .finally(() => {
+          done(true); // 确定关闭模态框
+        });
+    },
+  });
+};
 </script>
 
 <style lang="less" scoped>
 .container {
   padding: 10px 10px 20px;
 
+  // 注意这里的空行是重要的
   .general-card {
     padding-top: 20px;
 
@@ -350,7 +319,11 @@ const handleCancel = () => {
   }
 
   .table-list {
-    margin-top: 0;
+    margin-top: 10px;
+  }
+
+  .action-button {
+    margin-right: 10px;
   }
 }
 </style>

+ 11 - 0
src/views/dashboard/plugin/locale/en-US.ts

@@ -0,0 +1,11 @@
+export default {
+  'menu.dashboard.plugin': 'Plugin',
+  'workplace.welcome': 'Welcome!',
+  'dashboard.dialog.title': 'Device Information',
+  'dashboard.form.location': 'Location',
+  'dashboard.form.user': 'User',
+  'dashboard.form.server': 'Server',
+  'dashboard.form.hostName': 'HostName',
+  'dashboard.form.timeRange': 'TimeRange',
+  'dashboard.table.time': 'Time',
+};

+ 11 - 0
src/views/dashboard/plugin/locale/zh-CN.ts

@@ -0,0 +1,11 @@
+export default {
+  'menu.dashboard.plugin': '插件',
+  'workplace.welcome': '欢迎回来!',
+  'dashboard.dialog.title': '设备信息',
+  'dashboard.form.location': 'IP地址',
+  'dashboard.form.user': '账号',
+  'dashboard.form.server': '服务器',
+  'dashboard.form.hostName': '主机名',
+  'dashboard.form.timeRange': '时间范围',
+  'dashboard.table.time': '时间',
+};

+ 0 - 11
src/views/dashboard/workplace/locale/en-US.ts

@@ -1,11 +0,0 @@
-export default {
-  'menu.dashboard.workplace': 'System Status',
-  'workplace.welcome': 'Welcome!',
-  'dashboard.dialog.title': 'Device Information',
-  'dashboard.form.address': 'Location',
-  'dashboard.form.name': 'Name',
-  'dashboard.form.entityType': 'DeviceType',
-  'dashboard.form.status': 'Status',
-  'dashboard.form.timeRange': 'TimeRange',
-  'dashboard.table.time': 'Time',
-};

+ 0 - 11
src/views/dashboard/workplace/locale/zh-CN.ts

@@ -1,11 +0,0 @@
-export default {
-  'menu.dashboard.workplace': '设备状态',
-  'workplace.welcome': '欢迎回来!',
-  'dashboard.dialog.title': '设备信息',
-  'dashboard.form.address': 'IP地址',
-  'dashboard.form.name': '名称',
-  'dashboard.form.entityType': '设备类型',
-  'dashboard.form.status': '状态',
-  'dashboard.form.timeRange': '时间范围',
-  'dashboard.table.time': '时间',
-};

+ 4 - 4
src/views/login/components/login-form.vue

@@ -82,7 +82,7 @@ const { loading, setLoading } = useLoading();
 const userStore = useUserStore();
 
 const userInfo = reactive({
-  username: loginInfo.value.name,
+  username: loginInfo.value.user,
   password: null,
 });
 
@@ -101,18 +101,18 @@ const handleSubmit = async ({
       const { redirect, ...othersQuery } = router.currentRoute.value.query;
       if (res.success) {
         await router.push({
-          name: (redirect as string) || 'Workplace',
+          name: (redirect as string) || 'Plugin',
           query: {
             ...othersQuery,
           },
         });
         Message.success(t('login.form.login.success'));
         const { rememberPassword } = loginInfo.value;
-        const { name, id, privilege } = res.data;
+        const { user, id, privilege } = res.data;
         // 实际生产环境需要进行加密存储。
         // The actual production environment requires encrypted storage.
         loginInfo.value.id = id ? id : 0;
-        loginInfo.value.name = name ? name : '';
+        loginInfo.value.user = user ? user : '';
         loginInfo.value.privilege = privilege ? privilege : 0;
       } else {
         Message.error(res.message);