Эх сурвалжийг харах

feat: 组态管理-组态列表-列表/新增/修改 增加多语言

vera_min 1 сар өмнө
parent
commit
a9e6290ac5

+ 9 - 2
src/i18n/pages/iotmanagerI18n/en.ts

@@ -2,7 +2,7 @@
  * @Author: vera_min vera_min@163.com
  * @Date: 2025-08-05 12:42:31
  * @LastEditors: vera_min vera_min@163.com
- * @LastEditTime: 2025-08-30 12:46:22
+ * @LastEditTime: 2025-08-30 13:26:21
  * @FilePath: /sagoo-admin-ui/src/i18n/pages/iotmanagerI18n/en.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -393,7 +393,14 @@ export default {
 			designBtn: "Design",
 			remarks: "Remarks",
 			screenNamePlaceholder: "Enter screen name",
-			screenNameValidator: "Screen name cannot be empty",
+			screenNameValidator: "Screen name cannot be empty.",
+			editConfigure: "Edit Configure diagram",
+			addConfigure: "Add Configure diagram",
+			configureName: "Configure Name",
+			deleteDiagramMessage: "This operation will permanently delete the diagram: {name}, continue?",
+			configureNamePlaceholder: "Enter configure name",
+			configureNameValidator: "Configure name cannot be empty.",
+			defaultCategory: "Default Category"
 		}
 	}
 };

+ 8 - 1
src/i18n/pages/iotmanagerI18n/zh-cn.ts

@@ -2,7 +2,7 @@
  * @Author: vera_min vera_min@163.com
  * @Date: 2025-08-05 12:42:31
  * @LastEditors: vera_min vera_min@163.com
- * @LastEditTime: 2025-08-30 12:46:44
+ * @LastEditTime: 2025-08-30 13:25:32
  * @FilePath: /sagoo-admin-ui/src/i18n/pages/iotmanagerI18n/zh-cn.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -394,6 +394,13 @@ export default {
 			remarks: "说明",
 			screenNamePlaceholder: "输入大屏名称",
 			screenNameValidator: "规则名称不能为空",
+			editConfigure: "编辑组态图",
+			addConfigure: "新增组态图",
+			configureName: "组态图名称",
+			deleteDiagramMessage: "此操作将永久删除组态图:{name}, 是否继续?",
+			configureNamePlaceholder: "输入组态图名称",
+			configureNameValidator: "组态图名称不能为空",
+			defaultCategory: "默认分类"
 		}
 	}
 };

+ 8 - 1
src/i18n/pages/iotmanagerI18n/zh-tw.ts

@@ -2,7 +2,7 @@
  * @Author: vera_min vera_min@163.com
  * @Date: 2025-08-05 12:42:31
  * @LastEditors: vera_min vera_min@163.com
- * @LastEditTime: 2025-08-30 12:47:53
+ * @LastEditTime: 2025-08-30 13:27:03
  * @FilePath: /sagoo-admin-ui/src/i18n/pages/iotmanager/zh-tw.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -394,6 +394,13 @@ export default {
 			remarks: "說明",
 			screenNamePlaceholder: "輸入大屏名稱",
 			screenNameValidator: "規則名稱不能為空",
+			editConfigure: "編輯組態圖",
+			addConfigure: "新增組態圖",
+			configureName: "組態圖名稱",
+			deleteDiagramMessage: "此操作將永久刪除組態圖:{name}, 是否繼續?",
+			configureNamePlaceholder: "輸入組態圖名稱",
+			configureNameValidator: "組態圖名稱不能為空",
+			defaultCategory: "默認分類"
 		}
 	}
 };

+ 3 - 2
src/i18n/pages/tableI18n/en.ts

@@ -2,7 +2,7 @@
  * @Author: vera_min vera_min@163.com
  * @Date: 2025-08-06 01:16:57
  * @LastEditors: vera_min vera_min@163.com
- * @LastEditTime: 2025-08-30 12:25:53
+ * @LastEditTime: 2025-08-30 13:30:08
  * @FilePath: /sagoo-admin-ui/src/i18n/pages/tableI18n/en.ts
  * @Description: 表格国际化 - 英文
  */
@@ -26,7 +26,8 @@ export default {
 		editSuccess: "Updated successfully",
 		deleteSelectedMessage: "Are you sure you want to delete the selected data?",
 		selectDataFirst: "Please select the data to delete first.",
-		saveSuccess: "Saved successfully"
+		saveSuccess: "Saved successfully",
+		handleSuccess: "Operate successfully"
 	},
 	tableI18nAction: {
 		detail: "Detail",

+ 3 - 2
src/i18n/pages/tableI18n/zh-cn.ts

@@ -2,7 +2,7 @@
  * @Author: vera_min vera_min@163.com
  * @Date: 2025-08-06 01:16:57
  * @LastEditors: vera_min vera_min@163.com
- * @LastEditTime: 2025-08-30 12:24:59
+ * @LastEditTime: 2025-08-30 13:29:37
  * @FilePath: /sagoo-admin-ui/src/i18n/pages/tableI18n/zh-cn.ts
  * @Description: 表格国际化 - 简体中文
  */
@@ -26,7 +26,8 @@ export default {
 		editSuccess: "编辑成功",
 		deleteSelectedMessage: "你确定要删除所选数据?",
 		selectDataFirst: "请选择要删除的数据。",
-		saveSuccess: "保存成功"
+		saveSuccess: "保存成功",
+		handleSuccess: "操作成功"
 	},
 	tableI18nAction: {
 		detail: "详情",

+ 3 - 2
src/i18n/pages/tableI18n/zh-tw.ts

@@ -2,7 +2,7 @@
  * @Author: vera_min vera_min@163.com
  * @Date: 2025-08-06 01:16:57
  * @LastEditors: vera_min vera_min@163.com
- * @LastEditTime: 2025-08-30 12:26:00
+ * @LastEditTime: 2025-08-30 13:30:22
  * @FilePath: /sagoo-admin-ui/src/i18n/pages/tableI18n/zh-tw.ts
  * @Description: 表格国际化 - 繁体中文
  */
@@ -26,7 +26,8 @@ export default {
 		editSuccess: "編輯成功",
 		deleteSelectedMessage: "你確定要刪除所選數據?",
 		selectDataFirst: "請選擇要刪除的數據。",
-		saveSuccess: "保存成功"
+		saveSuccess: "保存成功",
+		handleSuccess: "操作成功"
 	},
 	tableI18nAction: {
 		detail: "詳情",

+ 27 - 13
src/views/iot/configuration/list/edit.vue

@@ -1,8 +1,11 @@
 <template>
-  <el-dialog class="api-edit" v-model="showDialog" :title="`${formData.id ? '编辑组态图' : '新增组态图'}`" width="600px" :close-on-click-modal="false" :close-on-press-escape="false">
-    <el-form ref="formRef" :model="formData" :rules="ruleForm" label-width="100px">
-      <el-form-item label="组态图名称" prop="name">
-        <el-input v-model.trim="formData.name" placeholder="输入组态图名称" />
+  <!-- 编辑组态图/新增组态图 -->
+  <el-dialog class="api-edit" v-model="showDialog" :title="`${formData.id ? $t('message.configuration.designScreen.editConfigure') : $t('message.configuration.designScreen.addConfigure')}`" width="600px" :close-on-click-modal="false" :close-on-press-escape="false">
+    <el-form ref="formRef" :model="formData" :rules="ruleForm" :label-width="currentLocale == 'en' ? '126px' : '100px'">
+      <!-- 组态图名称 -->
+      <el-form-item :label="$t('message.configuration.designScreen.configureName')" prop="name">
+        <!-- 输入组态图名称 -->
+        <el-input v-model.trim="formData.name" :placeholder="$t('message.configuration.designScreen.configureNamePlaceholder')" />
       </el-form-item>
       <!-- <el-form-item label="说明" prop="remarks">
         <el-input v-model="formData.remarks" type="textarea" :rows="3" />
@@ -10,20 +13,29 @@
     </el-form>
     <template #footer>
       <div class="dialog-footer">
-        <el-button @click="showDialog = false">取消</el-button>
-        <el-button type="primary" @click="onSubmit">确定</el-button>
+        <!-- 取消 -->
+        <el-button @click="showDialog = false">{{ $t('message.tableI18nAction.cancel') }}</el-button>
+        <!-- 编辑/新增 -->
+				<el-button type="primary" @click="onSubmit">{{ formData.id ? $t('message.tableI18nAction.edit') : $t('message.tableI18nAction.add') }}</el-button>
+        <!-- <el-button type="primary" @click="onSubmit">确定</el-button> -->
       </div>
     </template>
   </el-dialog>
 </template>
 
 <script lang="ts" setup>
-import { ref, reactive, nextTick } from 'vue';
+import { ref, reactive, nextTick, computed } from 'vue';
 import api from '/@/api/configuration';
 import { ruleRequired } from '/@/utils/validator';
 import { ElMessage } from 'element-plus';
 import pako from 'pako'
 import { Session } from '/@/utils/storage';
+import { useI18n } from 'vue-i18n';
+// 国际化
+const { locale, t } = useI18n();
+
+const currentLocale = computed(() => locale.value);
+
 
 const emit = defineEmits(['getList']);
 
@@ -47,9 +59,10 @@ const formData = reactive({
   ...baseForm,
 });
 
-const ruleForm = {
-  name: [ruleRequired('图纸名称不能为空')],
-};
+const ruleForm = computed(() => ({
+    // 图纸名称不能为空
+    name: [ruleRequired(t('message.configuration.designScreen.configureNameValidator'))],
+}));
 
 const onSubmit = async () => {
   await formRef.value.validate();
@@ -63,7 +76,8 @@ const onSubmit = async () => {
         formData.folderId = res.topology[0].id;
         toSend(theApi, formData)
       } else {
-        api.addFolder({ types: 'topology', name: '默认分类-' + Session.get('userInfo')?.dept?.deptName }).then(({ folderId }: any) => {
+        // 默认分类-
+        api.addFolder({ types: 'topology', name: t('message.configuration.designScreen.defaultCategory') + '-' + Session.get('userInfo')?.dept?.deptName }).then(({ folderId }: any) => {
           formData.folderId = folderId
           toSend(theApi, formData)
         })
@@ -76,8 +90,8 @@ const onSubmit = async () => {
 
 const toSend = async (theApi: any, formData: any) => {
   await theApi(formData);
-
-  ElMessage.success('操作成功');
+  // 操作成功
+  ElMessage.success(t('message.tableI18nConfirm.handleSuccess'));
   resetForm();
   showDialog.value = false;
   emit('getList');

+ 38 - 19
src/views/iot/configuration/list/index.vue

@@ -3,38 +3,51 @@
     <el-card shadow="never">
       <div class="search">
         <el-form inline>
-          <el-form-item label="关键字">
-            <el-input v-model="params.keyWord" style="width: 200px; margin-left: 20px" class="search-input" placeholder="请输入搜索关键字" @keyup.enter.native="getList(1)" clearable>
+          <!-- 关键字 -->
+          <el-form-item :label="$t('message.device.formI18nLabel.keyword')">
+            <!-- 请输入搜索关键字 -->
+            <el-input v-model="params.keyWord" style="width: 200px; margin-left: 20px" class="search-input" :placeholder="$t('message.configuration.designScreen.keywordPlaceholder')" @keyup.enter.native="getList(1)" clearable>
             </el-input>
+            <!-- 查询 -->
             <el-button type="primary" class="ml10" @click="getList(1)">
               <el-icon>
                 <ele-Search />
               </el-icon>
-              查询
+              {{ $t('message.formI18nButton.query') }}
             </el-button>
           </el-form-item>
           <el-form-item>
+            <!-- 新增组态图 -->
             <el-button type="primary" v-auth="'add'" @click="addOrEdit()">
               <el-icon>
                 <ele-FolderAdd />
               </el-icon>
-              新增组态图
+              {{ $t('message.configuration.designScreen.addConfigure') }}
             </el-button>
           </el-form-item>
         </el-form>
       </div>
       <el-table :data="tableData" style="width: 100%" row-key="id" v-loading="loading">
         <!-- <el-table-column type="index" label="序号" width="60" align="center" /> -->
-        <el-table-column prop="id" label="ID" width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="name" label="组态图名称" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="createdAt" label="创建时间" min-width="100" align="center"></el-table-column>
-        <el-table-column prop="updatedAt" label="更新时间" min-width="100" align="center"></el-table-column>
-        <el-table-column label="操作" width="200" align="center">
+         <!-- ID -->
+        <el-table-column prop="id" :label="$t('message.tableI18nColumn.id')" width="100" show-overflow-tooltip></el-table-column>
+        <!-- 组态图名称 -->
+        <el-table-column prop="name" :label="$t('message.configuration.designScreen.configureName')" show-overflow-tooltip></el-table-column>
+        <!-- 创建时间 -->
+        <el-table-column prop="createdAt" :label="$t('message.tableI18nColumn.createdAt')" min-width="100" align="center"></el-table-column>
+        <!-- 更新时间 -->
+        <el-table-column prop="updatedAt" :label="$t('message.tableI18nColumn.updatedAt')" min-width="100" align="center"></el-table-column>
+        <!-- 操作 -->
+        <el-table-column :label="$t('message.tableI18nColumn.operation')" :width="currentLocale === 'en' ? 300 : 200" align="center">
           <template #default="scope">
-            <el-button size="small" text type="primary" v-if="!scope.row.folderName" @click="view(scope.row)">预览</el-button>
-            <el-button size="small" text type="warning" v-auth="'edit'" @click="addOrEdit(scope.row)">编辑</el-button>
-            <el-button size="small" text type="warning" @click="edit(scope.row)">编辑组态图</el-button>
-            <el-button size="small" text type="info" v-auth="'del'" @click="del(scope.row)">删除</el-button>
+            <!-- 预览 -->
+            <el-button size="small" text type="primary" v-if="!scope.row.folderName" @click="view(scope.row)">{{ $t('message.configuration.designScreen.previewBtn') }}</el-button>
+            <!-- 编辑 -->
+            <el-button size="small" text type="warning" v-auth="'edit'" @click="addOrEdit(scope.row)">{{ $t('message.tableI18nAction.edit') }}</el-button>
+            <!-- 编辑组态图 -->
+            <el-button size="small" text type="warning" @click="edit(scope.row)">{{$t('message.configuration.designScreen.editConfigure')}}</el-button>
+            <!-- 删除 -->
+            <el-button size="small" text type="info" v-auth="'del'" @click="del(scope.row)">{{ $t('message.tableI18nAction.delete') }}</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -45,12 +58,16 @@
 </template>
 
 <script lang="ts" setup>
+import { ref, computed } from 'vue';
 import api from '/@/api/configuration';
 import { useSearch } from '/@/hooks/useCommon';
 import { ElMessageBox, ElMessage } from 'element-plus';
-import getOrigin from '/@/utils/origin'
 import EditForm from './edit.vue';
-import { ref } from 'vue';
+import { useI18n } from 'vue-i18n';
+// 国际化
+const { locale, t } = useI18n();
+
+const currentLocale = computed(() => locale.value);	
 
 const editFormRef = ref();
 
@@ -85,13 +102,15 @@ const edit = (row: any) => {
 };
 
 const del = (row: any) => {
-  ElMessageBox.confirm(`此操作将删除图形:“${row.name}”,是否继续?`, '提示', {
-    confirmButtonText: '确认',
-    cancelButtonText: '取消',
+  ElMessageBox.confirm(
+    t('message.configuration.designScreen.deleteDiagramMessage', { name: row.name }),
+    t('message.tableI18nConfirm.deleteTitle'), {
+    confirmButtonText: t('message.tableI18nConfirm.confirmText'),
+    cancelButtonText: t('message.tableI18nConfirm.cancelText'),
     type: 'warning',
   }).then(async () => {
     await api.del(row.id);
-    ElMessage.success('删除成功');
+    ElMessage.success(t('message.tableI18nConfirm.deleteSuccess'));
     getList(1);
   });
 };