Selaa lähdekoodia

Merge branch 'dev' of http://git.mydig.net/Sagoo-Cloud/sagoo-admin-ui into dev

vera_min 1 kuukausi sitten
vanhempi
sitoutus
e7072df312

+ 80 - 0
src/i18n/pages/dateCenter/en.ts

@@ -337,4 +337,84 @@ export default {
       },
     },
   },
+  indicator: {
+    actions: {
+      search: 'Search',
+      add: 'Add',
+      export: 'Export',
+      publish: 'Publish',
+      unpublish: 'Unpublish',
+      detail: 'Detail',
+      data: 'Data',
+      edit: 'Edit',
+      delete: 'Delete',
+      save: 'Save',
+      cancel: 'Cancel',
+      filter: 'Filter',
+    },
+    status: {
+      all: 'All',
+      published: 'Published',
+      unpublished: 'Unpublished',
+    },
+    placeholders: {
+      searchByNameOrCodeOrDesc: 'Enter name, code or description',
+      searchValue: 'Enter indicator value or raw value',
+      dateRangeSeparator: 'to',
+      startTime: 'Start Time',
+      endTime: 'End Time',
+      allDimensions: 'All Dimensions',
+      selectDate: 'Select date',
+      selectDimensionValue: 'Select dimension value',
+      inputDimensionValue: 'Enter dimension value',
+    },
+    columns: {
+      name: 'Name',
+      code: 'Code',
+      description: 'Description',
+      type: 'Type',
+      unit: 'Unit',
+      formula: 'Formula',
+      status: 'Status',
+      createdAt: 'Created At',
+      createdBy: 'Created By',
+      action: 'Actions',
+      time: 'Time',
+      value: 'Indicator Value',
+      maxValue: 'Max',
+      minValue: 'Min',
+      avgValue: 'Average',
+      sumValue: 'Sum',
+      countValue: 'Count',
+    },
+    messages: {
+      selectOrInputDimensionValue: 'Please select or enter dimension value',
+      confirmPublish: 'Confirm to {status}?',
+      opSuccess: 'Operation succeeded',
+    },
+    detail: {
+      title: 'Indicator Detail',
+      close: 'Close',
+      unitItems: 'items',
+      labels: {
+        name: 'Indicator Name',
+        description: 'Indicator Description',
+        type: 'Indicator Type',
+        unit: 'Unit',
+        formula: 'Formula',
+        dimensionCount: 'Dimension Count',
+        status: 'Status',
+        createdAt: 'Created At',
+        createdBy: 'Created By',
+      },
+    },
+    data: {
+      title: 'Indicator Data',
+      buttons: {
+        filter: 'Filter',
+        export: 'Export',
+      },
+      exportFileNameSuffix: 'Indicator Data Export.xlsx',
+    },
+  },
 };

+ 80 - 0
src/i18n/pages/dateCenter/zh-cn.ts

@@ -337,4 +337,84 @@ export default {
       },
     },
   },
+  indicator: {
+    actions: {
+      search: '查询',
+      add: '添加',
+      export: '导出',
+      publish: '发布',
+      unpublish: '取消发布',
+      detail: '详情',
+      data: '数据',
+      edit: '编辑',
+      delete: '删除',
+      save: '保存',
+      cancel: '取消',
+      filter: '筛选',
+    },
+    status: {
+      all: '全部',
+      published: '已发布',
+      unpublished: '未发布',
+    },
+    placeholders: {
+      searchByNameOrCodeOrDesc: '输入名称、编码或描述',
+      searchValue: '输入指标值或原始值',
+      dateRangeSeparator: '至',
+      startTime: '开始时间',
+      endTime: '结束时间',
+      allDimensions: '全部维度',
+      selectDate: '选择日期',
+      selectDimensionValue: '选择维度值',
+      inputDimensionValue: '输入维度值',
+    },
+    columns: {
+      name: '名称',
+      code: '编码',
+      description: '描述',
+      type: '类型',
+      unit: '单位',
+      formula: '公式',
+      status: '状态',
+      createdAt: '创建时间',
+      createdBy: '创建人',
+      action: '操作',
+      time: '时间',
+      value: '指标值',
+      maxValue: '最大值',
+      minValue: '最小值',
+      avgValue: '平均值',
+      sumValue: '总和',
+      countValue: '数量值',
+    },
+    messages: {
+      selectOrInputDimensionValue: '请选择或输入维度值',
+      confirmPublish: '是否{status}?',
+      opSuccess: '操作成功',
+    },
+    detail: {
+      title: '指标详情',
+      close: '关闭',
+      unitItems: '个',
+      labels: {
+        name: '指标名称',
+        description: '指标描述',
+        type: '指标类型',
+        unit: '单位',
+        formula: '计算公式',
+        dimensionCount: '维度数',
+        status: '状态',
+        createdAt: '创建时间',
+        createdBy: '创建人',
+      },
+    },
+    data: {
+      title: '指标数据',
+      buttons: {
+        filter: '筛选',
+        export: '导出',
+      },
+      exportFileNameSuffix: '指标数据导出.xlsx',
+    },
+  },
 };

+ 91 - 0
src/i18n/pages/dateCenter/zh-tw.ts

@@ -303,6 +303,17 @@ export default {
         4: '天',
       },
     },
+    units: {
+      1: '秒',
+      2: '分',
+      3: '時',
+      4: '天',
+    },
+    indicator: {
+      key: '指標標識',
+      name: '指標名稱',
+      formula: '計算公式',
+    },
     relation: {
       dialogTitle: '設定主源、關聯欄位',
       labels: {
@@ -326,4 +337,84 @@ export default {
       },
     },
   },
+  indicator: {
+    actions: {
+      search: '查詢',
+      add: '新增',
+      export: '匯出',
+      publish: '發布',
+      unpublish: '取消發布',
+      detail: '詳情',
+      data: '資料',
+      edit: '編輯',
+      delete: '刪除',
+      save: '儲存',
+      cancel: '取消',
+      filter: '篩選',
+    },
+    status: {
+      all: '全部',
+      published: '已發布',
+      unpublished: '未發布',
+    },
+    placeholders: {
+      searchByNameOrCodeOrDesc: '輸入名稱、編碼或描述',
+      searchValue: '輸入指標值或原始值',
+      dateRangeSeparator: '至',
+      startTime: '開始時間',
+      endTime: '結束時間',
+      allDimensions: '全部維度',
+      selectDate: '選擇日期',
+      selectDimensionValue: '選擇維度值',
+      inputDimensionValue: '輸入維度值',
+    },
+    columns: {
+      name: '名稱',
+      code: '編碼',
+      description: '描述',
+      type: '類型',
+      unit: '單位',
+      formula: '公式',
+      status: '狀態',
+      createdAt: '建立時間',
+      createdBy: '建立人',
+      action: '操作',
+      time: '時間',
+      value: '指標值',
+      maxValue: '最大值',
+      minValue: '最小值',
+      avgValue: '平均值',
+      sumValue: '總和',
+      countValue: '數量值',
+    },
+    messages: {
+      selectOrInputDimensionValue: '請選擇或輸入維度值',
+      confirmPublish: '是否{status}?',
+      opSuccess: '操作成功',
+    },
+    detail: {
+      title: '指標詳情',
+      close: '關閉',
+      unitItems: '個',
+      labels: {
+        name: '指標名稱',
+        description: '指標描述',
+        type: '指標類型',
+        unit: '單位',
+        formula: '計算公式',
+        dimensionCount: '維度數',
+        status: '狀態',
+        createdAt: '建立時間',
+        createdBy: '建立人',
+      },
+    },
+    data: {
+      title: '指標資料',
+      buttons: {
+        filter: '篩選',
+        export: '匯出',
+      },
+      exportFileNameSuffix: '指標資料匯出.xlsx',
+    },
+  },
 };

+ 1 - 1
src/utils/download.ts

@@ -6,7 +6,7 @@ const downloadFile = (res: any, fileName: string = '导出日志.xlsx') => {
   // 判断是不是返回的是json,是json说明报错了,否则返回的是文本流
   const decoder = new TextDecoder('utf-8');
   const text = decoder.decode(res.data);
-  console.log(text)
+  // console.log(text)
 
   try {
     const errJson = JSON.parse(text)

+ 3 - 2
src/views/iot/device/instance/component/function.vue

@@ -25,8 +25,8 @@
 					<el-input type="textarea" :value="item.result" class="result" read-only placeholder="执行结果:"> </el-input>
 				</div>
 				<div class="btn">
-					<el-button type="primary" :loading="item.loading" @click="run(item)">执行</el-button>
-					<el-button @click="clear(item)">清空</el-button>
+					<el-button type="primary" :loading="item.loading" @click="run(item)" :disabled="status!==2">执行</el-button>
+					<el-button @click="clear(item)" :disabled="status!==2">清空</el-button>
 				</div>
 			</el-tab-pane>
 		</el-tabs>
@@ -41,6 +41,7 @@ import api from '/@/api/device'
 const props = defineProps({
 	productKey: String,
 	deviceKey: String,
+	status: Number,
 })
 
 interface IListItem {

+ 26 - 25
src/views/iot/device/instance/detail.vue

@@ -12,7 +12,6 @@
         <el-tag v-else-if="areaData.status === 2" type="success" style="margin-left: 20px">{{ $t('message.device.formI18nOption.online') }}</el-tag>
       </div>
     </div>
-
     <div class="content-box page-full-part page-full">
       <el-tabs v-model="activeName" @tab-click="handleClick">
         <!-- 运行状态 -->
@@ -81,7 +80,7 @@
           <div class="pro-box">
             <div class="protitle">{{$t('message.device.deviceInfo')}}</div>
             <div>
-              <el-button size="small" type="primary" v-auth="'edit'" @click="onOpenEditDic(detail)">{{ $t('message.tableI18nAction.edit') }}</el-button>
+              <el-button size="small" :disabled="!canEdit" type="primary" v-auth="'edit'" @click="onOpenEditDic(detail)">{{ $t('message.tableI18nAction.edit') }}</el-button>
             </div>
           </div>
 
@@ -134,7 +133,7 @@
               <template #append>{{ $t('message.device.unitSecond') }}</template>
             </el-input>
             <!-- 更新 -->
-            <el-button type="primary" @click="onlineTimeoutUpdate">
+            <el-button type="primary" :disabled="!canEdit" @click="onlineTimeoutUpdate">
               <el-icon style="font-size: 18px"><ele-Refresh /></el-icon>
               {{ $t('message.device.update') }}
             </el-button>
@@ -147,7 +146,7 @@
               <div class="wu-title">
                 <div class="title"></div>
                 <div>
-                  <el-button size="small" type="primary" v-auth="'add'" @click="onOpenEditAttr()">添加</el-button>
+                  <el-button size="small" :disabled="!canEdit" type="primary" v-auth="'add'" @click="onOpenEditAttr()">添加</el-button>
                 </div>
               </div>
 
@@ -156,12 +155,12 @@
                 <el-table-column label="属性名称" prop="name" show-overflow-tooltip />
                 <el-table-column prop="valueType" label="数据类型" width="100" align="center">
                   <template #default="scope">
-                    <span>{{ scope.row.valueType.type }}</span>
+                    <span>{{ scope.row.valueType?.type }}</span>
                   </template>
                 </el-table-column>
                 <el-table-column prop="decimals" label="精度" width="60" align="center">
                   <template #default="scope">
-                    <span>{{ scope.row.valueType.decimals }}</span>
+                    <span>{{ scope.row.valueType?.decimals }}</span>
                   </template>
                 </el-table-column>
                 <el-table-column prop="unit" label="单位" width="60" align="center">
@@ -176,11 +175,11 @@
                   </template>
                 </el-table-column>
                 <el-table-column label="说明" prop="desc" show-overflow-tooltip />
-                <el-table-column label="操作" width="150" align="right" header-align="center" fixed="right">
+                <el-table-column label="操作" width="150" align="center" fixed="right">
                   <template #default="scope">
-                    <el-button size="small" text type="primary" v-auth="'edit'" v-if="!scope.row.accessMode" @click="setAttr(scope.row)">设置属性</el-button>
-                    <el-button size="small" text type="warning" v-auth="'edit'" @click="onEditAttr(scope.row)">修改</el-button>
-                    <el-button size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'attr')">删除</el-button>
+                    <el-button size="small" text type="primary" :disabled="!canEdit" v-auth="'edit'" v-if="!scope.row.accessMode" @click="setAttr(scope.row)">设置属性</el-button>
+                    <el-button size="small" text type="warning" :disabled="!canEdit" v-auth="'edit'" @click="onEditAttr(scope.row)">修改</el-button>
+                    <el-button size="small" text type="danger" :disabled="!canEdit" v-auth="'del'" @click="onRowDel(scope.row.key, 'attr')">删除</el-button>
                   </template>
                 </el-table-column>
               </el-table>
@@ -189,7 +188,7 @@
               <div class="wu-title">
                 <div class="title"></div>
                 <div>
-                  <el-button size="small" type="primary" v-auth="'add'" @click="onOpenEditFun()">添加</el-button>
+                  <el-button size="small" type="primary" v-auth="'add'" :disabled="!canEdit" @click="onOpenEditFun()">添加</el-button>
                 </div>
               </div>
 
@@ -200,8 +199,8 @@
                 <el-table-column label="描述" prop="desc" show-overflow-tooltip />
                 <el-table-column label="操作" width="300" align="center" fixed="right">
                   <template #default="scope">
-                    <el-button size="small" text type="warning" v-auth="'edit'" @click="onEditFun(scope.row)">修改</el-button>
-                    <el-button size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'fun')">删除</el-button>
+                    <el-button size="small" text type="warning" v-auth="'edit'" :disabled="!canEdit" @click="onEditFun(scope.row)">修改</el-button>
+                    <el-button size="small" text type="danger" v-auth="'del'" :disabled="!canEdit" @click="onRowDel(scope.row.key, 'fun')">删除</el-button>
                   </template>
                 </el-table-column>
               </el-table>
@@ -210,7 +209,7 @@
               <div class="wu-title">
                 <div class="title"></div>
                 <div>
-                  <el-button type="primary" size="small" v-auth="'add'" @click="onOpenEditEvent()">添加</el-button>
+                  <el-button type="primary" size="small" v-auth="'add'" :disabled="!canEdit" @click="onOpenEditEvent()">添加</el-button>
                 </div>
               </div>
 
@@ -228,8 +227,8 @@
 
                 <el-table-column label="操作" width="300" align="center" fixed="right">
                   <template #default="scope">
-                    <el-button size="small" text type="warning" v-auth="'edit'" @click="onEditEvent(scope.row)">修改</el-button>
-                    <el-button size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'event')">删除</el-button>
+                    <el-button size="small" text type="warning" v-auth="'edit'" :disabled="!canEdit" @click="onEditEvent(scope.row)">修改</el-button>
+                    <el-button size="small" text type="danger" v-auth="'del'" :disabled="!canEdit" @click="onRowDel(scope.row.key, 'event')">删除</el-button>
                   </template>
                 </el-table-column>
               </el-table>
@@ -238,7 +237,7 @@
               <div class="wu-title">
                 <div class="title"></div>
                 <div>
-                  <el-button size="small" type="primary" v-auth="'add'" @click="onOpenEditTab()">添加</el-button>
+                  <el-button size="small" type="primary" v-auth="'add'" :disabled="!canEdit" @click="onOpenEditTab()">添加</el-button>
                 </div>
               </div>
 
@@ -247,7 +246,7 @@
                 <el-table-column label="属性名称" prop="name" show-overflow-tooltip />
                 <el-table-column prop="valueType" label="数据类型" width="120" align="center">
                   <template #default="scope">
-                    <span>{{ scope.row.valueType.type }}</span>
+                    <span>{{ scope.row.valueType?.type }}</span>
                   </template>
                 </el-table-column>
                 <el-table-column prop="accessMode" label="是否只读" width="120" align="center">
@@ -259,8 +258,8 @@
                 <el-table-column label="描述" prop="desc" show-overflow-tooltip />
                 <el-table-column label="操作" width="300" align="center" fixed="right">
                   <template #default="scope">
-                    <el-button size="small" text type="warning" v-auth="'edit'" @click="onEditTag(scope.row)">修改</el-button>
-                    <el-button size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'tab')">删除</el-button>
+                    <el-button size="small" text type="warning" v-auth="'edit'" :disabled="!canEdit" @click="onEditTag(scope.row)">修改</el-button>
+                    <el-button size="small" text type="danger" v-auth="'del'" :disabled="!canEdit" @click="onRowDel(scope.row.key, 'tab')">删除</el-button>
                   </template>
                 </el-table-column>
               </el-table>
@@ -270,7 +269,7 @@
         </el-tab-pane>
         <!-- 设备功能 -->
         <el-tab-pane :label="$t('message.device.deviceFunction')" name="5">
-          <functionCom :device-key="detail.key" :product-key="prodetail.key" v-if="detail.key && prodetail.key && activeName === '5'"></functionCom>
+          <functionCom :status="areaData.status" :device-key="detail.key" :product-key="prodetail.key" v-if="detail.key && prodetail.key && activeName === '5'"></functionCom>
         </el-tab-pane>
         <!-- 日志管理 -->
         <el-tab-pane :label="$t('message.device.logManagement')" name="4">
@@ -373,7 +372,7 @@
             <div class="pro-box">
               <div class="protitle">设备档案</div>
               <div>
-                <el-button size="small" type="primary" v-auth="'edit'" @click="onOpenEditAsset">编辑</el-button>
+                <el-button size="small" type="primary" v-auth="'edit'" @click="onOpenEditAsset" :disabled="!canEdit">编辑</el-button>
               </div>
             </div>
 
@@ -424,7 +423,7 @@
   </div>
 </template>
 <script lang="ts">
-import { toRefs, reactive, onMounted, ref, defineComponent, nextTick, onUnmounted } from "vue";
+import { toRefs, reactive, onMounted, ref, defineComponent, nextTick, onUnmounted, computed } from "vue";
 import { ElMessageBox, ElMessage, FormInstance } from "element-plus";
 import functionCom from "./component/function.vue";
 import "vue3-json-viewer/dist/index.css";
@@ -443,7 +442,6 @@ import api from "/@/api/device";
 import datahub from "/@/api/datahub";
 import FromData from "/@/views/iot/property/dossier/component/from.vue";
 import EditAssetRef from "/@/views/iot/property/dossier/edit.vue";
-
 import { useRoute } from "vue-router";
 
 interface TableDataState {
@@ -493,6 +491,8 @@ export default defineComponent({
     deviceKey: String,
   },
   setup(props, context) {
+
+    const canEdit = computed(() => state.areaData.status===0);
     let timer: any;
 
     onUnmounted(() => clearInterval(timer));
@@ -526,7 +526,7 @@ export default defineComponent({
       phone: [],
       intro: "",
       deviceKeyList: [],
-      areaData: [],
+      areaData: {},
       isShowDialog: false,
       dialogVisible: false,
       logTypeData: [],
@@ -1074,6 +1074,7 @@ export default defineComponent({
     };
 
     return {
+      canEdit,
       topicData,
       initData,
       logqueryRef,

+ 3 - 2
src/views/iot/device/product/component/dataParse.vue

@@ -20,9 +20,9 @@
       </div>
     </div>
     <!-- 保存脚本 -->
-    <el-button type="primary" style="margin-top: 20px" v-auth="'save'" @click="saveCode">{{ $t("message.device.tip3") }}</el-button>
+    <el-button type="primary" style="margin-top: 20px" v-auth="'save'" :disabled="disabled" @click="saveCode">{{ $t("message.device.tip3") }}</el-button>
     <!-- 调试 -->
-    <el-button type="primary" style="margin-top: 20px" v-auth="'debug'" :loading="runing" @click="mock">{{ $t("message.device.tip4") }}</el-button>
+    <el-button type="primary" style="margin-top: 20px" v-auth="'debug'" :loading="runing" :disabled="disabled" @click="mock">{{ $t("message.device.tip4") }}</el-button>
   </div>
 </template>
 
@@ -71,6 +71,7 @@ const emit = defineEmits(["updateScript"]);
 
 defineProps({
   script: String,
+  disabled: Boolean,  
 });
 
 const inputData = ref("");

+ 21 - 26
src/views/iot/device/product/detail.vue

@@ -13,9 +13,9 @@
 			<!-- 产品信息 -->
 			<el-tab-pane :label="$t('message.device.productDetail.productInfo')" name="1">
 				<div class="pro-box">
-					<div class="protitle">{{$t('message.device.productDetail.productInfo')}}</div>
+					<div class="protitle mr-4">{{$t('message.device.productDetail.productInfo')}}</div>
 					<!-- 编辑 -->
-					<el-button type="" :icon="Edit" class="buttonedit" v-auth="'edit'" @click="onOpenEditDic(detail)">{{ $t('message.tableI18nAction.edit') }}</el-button>
+					<el-button :disabled="developer_status" type="text" :icon="Edit" v-auth="'edit'" @click="onOpenEditDic(detail)">{{ $t('message.tableI18nAction.edit') }}</el-button>
 				</div>
 
 				<el-descriptions class="margin-top" :column="3" border>
@@ -54,7 +54,7 @@
 							<div class="title">{{$t('message.device.productDetail.propertyDefinition')}}</div>
 							<!-- 新增 -->
 							<div>
-								<el-button size="small" type="primary" v-auth="'edit'" @click="onOpenEditAttr()">{{$t('message.tableI18nAction.add')}}</el-button>
+								<el-button :disabled="developer_status" size="small" type="primary" v-auth="'edit'" @click="onOpenEditAttr()">{{$t('message.tableI18nAction.add')}}</el-button>
 							</div>
 						</div>
 
@@ -66,19 +66,19 @@
 							<!-- 数据类型 -->
 							<el-table-column prop="valueType" :label="$t('message.device.productDetail.dataType')" width="100" align="center">
 								<template #default="scope">
-									<span>{{ scope.row.valueType.type }}</span>
+									<span>{{ scope.row.valueType?.type }}</span>
 								</template>
 							</el-table-column>
 							<!-- 精度 -->
 							<el-table-column prop="decimals" :label="$t('message.device.productDetail.precision')" :width="currentLang == 'en' ? '100' : '60'" align="center">
 								<template #default="scope">
-									<span>{{ scope.row.valueType.decimals }}</span>
+									<span>{{ scope.row.valueType?.decimals }}</span>
 								</template>
 							</el-table-column>
 							<!-- 单位 -->
 							<el-table-column prop="unit" :label="$t('message.device.productDetail.unit')" width="60" align="center">
 								<template #default="scope">
-									<span>{{ scope.row.valueType.unit }}</span>
+									<span>{{ scope.row.valueType?.unit }}</span>
 								</template>
 							</el-table-column>
 							<!-- 是否只读 -->
@@ -95,8 +95,8 @@
 							<!-- 操作 -->
 							<el-table-column :label="$t('message.tableI18nColumn.operation')" width="120" align="center" fixed="right">
 								<template #default="scope">
-									<el-button size="small" text type="warning" v-auth="'edit'" @click="onEditAttr(scope.row)">{{ $t('message.tableI18nAction.edit') }}</el-button>
-									<el-button size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'attr')">{{ $t('message.tableI18nAction.delete') }}</el-button>
+									<el-button :disabled="developer_status" size="small" text type="warning" v-auth="'edit'" @click="onEditAttr(scope.row)">{{ $t('message.tableI18nAction.edit') }}</el-button>
+									<el-button :disabled="developer_status" size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'attr')">{{ $t('message.tableI18nAction.delete') }}</el-button>
 								</template>
 							</el-table-column>
 						</el-table>
@@ -107,7 +107,7 @@
 							<div class="title">{{$t('message.device.productDetail.functionDefinition')}}</div>
 							<!-- 新增 -->
 							<div>
-								<el-button size="small" type="primary" v-auth="'add'" @click="onOpenEditFun()">{{$t('message.tableI18nAction.add')}}</el-button>
+								<el-button :disabled="developer_status" size="small" type="primary" v-auth="'add'" @click="onOpenEditFun()">{{$t('message.tableI18nAction.add')}}</el-button>
 							</div>
 						</div>
 
@@ -120,9 +120,9 @@
 							<el-table-column :label="$t('message.tableI18nColumn.operation')" width="120" align="center" fixed="right">
 								<template #default="scope">
 									<!-- 编辑 -->
-									<el-button size="small" text type="warning" v-auth="'edit'" @click="onEditFun(scope.row)">{{ $t('message.tableI18nAction.edit') }}</el-button>
+									<el-button :disabled="developer_status" size="small" text type="warning" v-auth="'edit'" @click="onEditFun(scope.row)">{{ $t('message.tableI18nAction.edit') }}</el-button>
 									<!-- 删除 -->
-									<el-button size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'fun')">{{ $t('message.tableI18nAction.delete') }}</el-button>
+									<el-button :disabled="developer_status" size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'fun')">{{ $t('message.tableI18nAction.delete') }}</el-button>
 								</template>
 							</el-table-column>
 						</el-table>
@@ -132,7 +132,7 @@
 						<div class="wu-title">
 							<div class="title">{{$t('message.device.productDetail.eventDefinition')}}</div>
 							<div>
-								<el-button size="small" type="primary" v-auth="'add'" @click="onOpenEditEvent()">{{$t('message.tableI18nAction.add')}}</el-button>
+								<el-button :disabled="developer_status" size="small" type="primary" v-auth="'add'" @click="onOpenEditEvent()">{{$t('message.tableI18nAction.add')}}</el-button>
 							</div>
 						</div>
 
@@ -158,9 +158,9 @@
 							<el-table-column :label="$t('message.tableI18nColumn.operation')" width="120" align="center" fixed="right">
 								<template #default="scope">
 									<!-- 编辑 -->
-									<el-button size="small" text type="warning" v-auth="'edit'" @click="onEditEvent(scope.row)">{{ $t('message.tableI18nAction.edit') }}</el-button>
+									<el-button :disabled="developer_status" size="small" text type="warning" v-auth="'edit'" @click="onEditEvent(scope.row)">{{ $t('message.tableI18nAction.edit') }}</el-button>
 									<!-- 删除 -->
-									<el-button size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'event')">{{ $t('message.tableI18nAction.delete') }}</el-button>
+									<el-button :disabled="developer_status" size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'event')">{{ $t('message.tableI18nAction.delete') }}</el-button>
 								</template>
 							</el-table-column>
 						</el-table>
@@ -172,7 +172,7 @@
 							<div class="title">{{ $t('message.device.productDetail.tagDefinition') }}</div>
 							<!-- 添加 -->
 							<div>
-								<el-button size="small" type="primary" v-auth="'add'" @click="onOpenEditTab()">{{ $t('message.tableI18nAction.add') }}</el-button>
+								<el-button :disabled="developer_status" size="small" type="primary" v-auth="'add'" @click="onOpenEditTab()">{{ $t('message.tableI18nAction.add') }}</el-button>
 							</div>
 						</div>
 
@@ -184,7 +184,7 @@
 							<!-- 数据类型 -->
 							<el-table-column prop="valueType" :label="$t('message.device.productDetail.dataType')" width="120" align="center">
 								<template #default="scope">
-									<span>{{ scope.row.valueType.type }}</span>
+									<span>{{ scope.row.valueType?.type }}</span>
 								</template>
 							</el-table-column>
 							<!-- 是否只读 -->
@@ -202,9 +202,9 @@
 							<el-table-column :label="$t('message.tableI18nColumn.operation')" width="120" align="center" fixed="right">
 								<template #default="scope">
 									<!-- 编辑 -->
-									<el-button size="small" text type="warning" v-auth="'edit'" @click="onEditTag(scope.row)">{{ $t('message.tableI18nAction.edit') }}</el-button>
+									<el-button :disabled="developer_status" size="small" text type="warning" v-auth="'edit'" @click="onEditTag(scope.row)">{{ $t('message.tableI18nAction.edit') }}</el-button>
 									<!-- 删除 -->
-									<el-button size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'tab')">{{ $t('message.tableI18nAction.delete') }}</el-button>
+									<el-button :disabled="developer_status" size="small" text type="danger" v-auth="'del'" @click="onRowDel(scope.row.key, 'tab')">{{ $t('message.tableI18nAction.delete') }}</el-button>
 								</template>
 							</el-table-column>
 						</el-table>
@@ -214,13 +214,13 @@
 					<div class="row_bet">
 						<el-upload accept="json" :show-file-list="false" :limit="1" :data="{ productKey: detail.key }" :headers="headers" :action="uploadUrl" :on-success="updateImg">
 							<!-- 导入物模型 -->
-							<el-button size="small">
+							<el-button :disabled="developer_status" size="small">
 								<el-icon> <ele-Upload /> </el-icon>
 								{{ $t('message.device.productDetail.importModel') }}
 							</el-button>
 						</el-upload>
 						<!-- 导出物模型 -->
-						<el-button size="small" type="default" class="ml10" @click="onRowExport()">
+						<el-button :disabled="developer_status" size="small" type="default" class="ml10" @click="onRowExport()">
 							<el-icon>
 								<ele-Download />
 							</el-icon>
@@ -236,7 +236,7 @@
 			</el-tab-pane>
 			<!-- 数据解析 -->
 			<el-tab-pane :label="$t('message.device.productDetail.dataParsing')" name="4" lazy>
-				<dataParse v-if="activeName === '4'" :script="detail.scriptInfo" @updateScript="updateScript">
+				<dataParse v-if="activeName === '4'" :disabled="developer_status" :script="detail.scriptInfo" @updateScript="updateScript">
 				</dataParse>
 			</el-tab-pane>
 		</el-tabs>
@@ -590,11 +590,6 @@ const updateImg = (res: any) => {
 	line-height: 35px;
 }
 
-.pro-box .buttonedit {
-	border: 0px;
-	color: #1890ff;
-}
-
 .wu-title {
 	display: flex;
 	flex-direction: row;

+ 35 - 18
src/views/system/datahub/indicator/component/data.vue

@@ -1,40 +1,55 @@
 <template>
-  <el-dialog v-model="visible" :title="`指标数据 - ${title}`" width="1000px" :close-on-click-modal="false" destroy-on-close>
+  <el-dialog
+    v-model="visible"
+    :title="t('message.dateCenter.indicator.data.title') + ' - ' + title"
+    width="1000px"
+    :close-on-click-modal="false"
+    destroy-on-close
+  >
     <div v-if="visible">
       <el-form :inline="true" class="toolbar">
         <el-form-item>
-          <el-input v-model="query.searchValue" placeholder="输入指标值或原始值" clearable style="width: 160px" />
+          <el-input v-model="query.searchValue" :placeholder="t('message.dateCenter.indicator.placeholders.searchValue')" clearable style="width: 160px" />
         </el-form-item>
         <el-form-item label="">
-          <el-date-picker v-model="query.dateRange" type="datetimerange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" style="width: 380px" />
+          <el-date-picker
+            v-model="query.dateRange"
+            type="datetimerange"
+            :range-separator="t('message.dateCenter.indicator.placeholders.dateRangeSeparator')"
+            :start-placeholder="t('message.dateCenter.indicator.placeholders.startTime')"
+            :end-placeholder="t('message.dateCenter.indicator.placeholders.endTime')"
+            format="YYYY-MM-DD HH:mm:ss"
+            value-format="YYYY-MM-DD HH:mm:ss"
+            style="width: 380px"
+          />
         </el-form-item>
         <el-form-item label="">
-          <el-select v-model="dimensionsKey" style="width: 110px" placeholder="全部维度" clearable @change="handleDimensionChange">
+          <el-select v-model="dimensionsKey" style="width: 110px" :placeholder="t('message.dateCenter.indicator.placeholders.allDimensions')" clearable @change="handleDimensionChange">
             <el-option v-for="item in dimensions" :key="item.code" :label="item.name" :value="item.code" />
           </el-select>
         </el-form-item>
         <el-form-item label="" v-if="dimensionsKey">
-          <el-date-picker v-if="dimensionsType === 'date'" v-model="dimensionsValue" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" style="width: 140px" placeholder="选择日期" />
-          <el-select v-else-if="dimensionsType === 'text'" v-model="dimensionsValue" style="width: 120px" placeholder="选择维度值">
+          <el-date-picker v-if="dimensionsType === 'date'" v-model="dimensionsValue" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" style="width: 140px" :placeholder="t('message.dateCenter.indicator.placeholders.selectDate')" />
+          <el-select v-else-if="dimensionsType === 'text'" v-model="dimensionsValue" style="width: 120px" :placeholder="t('message.dateCenter.indicator.placeholders.selectDimensionValue')">
             <el-option v-for="item in dimensionsValues" :key="item" :label="item.name" :value="item" />
           </el-select>
-          <el-input v-else type="number" v-model="dimensionsValue" style="width: 120px" placeholder="输入维度值" />
+          <el-input v-else type="number" v-model="dimensionsValue" style="width: 120px" :placeholder="t('message.dateCenter.indicator.placeholders.inputDimensionValue')" />
         </el-form-item>
         <el-form-item label="">
-          <el-button type="primary" :icon="Filter" @click="fetchList(1)">筛选</el-button>
-          <el-button @click="exportData" :icon="Download" :loading="exportLoading">导出</el-button>
+          <el-button type="primary" :icon="Filter" @click="fetchList(1)">{{ t('message.dateCenter.indicator.data.buttons.filter') }}</el-button>
+          <el-button @click="exportData" :icon="Download" :loading="exportLoading">{{ t('message.dateCenter.indicator.data.buttons.export') }}</el-button>
         </el-form-item>
       </el-form>
 
       <el-table :data="list" style="width: 100%" v-loading="loading" max-height="50vh">
-        <el-table-column label="时间" align="center" prop="collectionTime" width="180" />
-        <el-table-column v-if="detail.computeStrategy !== 'aggregation'" prop="value" :label="`指标值${detail.unit ? ' (' + detail.unit + ')' : ''}`" min-width="140" align="center" />
+        <el-table-column :label="t('message.dateCenter.indicator.columns.time')" align="center" prop="collectionTime" width="180" />
+        <el-table-column v-if="detail.computeStrategy !== 'aggregation'" prop="value" :label="t('message.dateCenter.indicator.columns.value') + (detail.unit ? ' (' + detail.unit + ')' : '')" min-width="140" align="center" />
         <template v-else>
-          <el-table-column prop="maxValue" :label="`最大值${detail.unit ? ' (' + detail.unit + ')' : ''}`" align="center" min-width="140" />
-          <el-table-column prop="minValue" :label="`最小值${detail.unit ? ' (' + detail.unit + ')' : ''}`" align="center" min-width="140" />
-          <el-table-column prop="avgValue" :label="`平均值${detail.unit ? ' (' + detail.unit + ')' : ''}`" align="center" min-width="140" />
-          <el-table-column prop="sumValue" :label="`总和${detail.unit ? ' (' + detail.unit + ')' : ''}`" align="center" min-width="140" />
-          <el-table-column prop="countValue" label="数量值" align="center" min-width="140" />
+          <el-table-column prop="maxValue" :label="t('message.dateCenter.indicator.columns.maxValue') + (detail.unit ? ' (' + detail.unit + ')' : '')" align="center" min-width="140" />
+          <el-table-column prop="minValue" :label="t('message.dateCenter.indicator.columns.minValue') + (detail.unit ? ' (' + detail.unit + ')' : '')" align="center" min-width="140" />
+          <el-table-column prop="avgValue" :label="t('message.dateCenter.indicator.columns.avgValue') + (detail.unit ? ' (' + detail.unit + ')' : '')" align="center" min-width="140" />
+          <el-table-column prop="sumValue" :label="t('message.dateCenter.indicator.columns.sumValue') + (detail.unit ? ' (' + detail.unit + ')' : '')" align="center" min-width="140" />
+          <el-table-column prop="countValue" :label="t('message.dateCenter.indicator.columns.countValue')" align="center" min-width="140" />
         </template>
 
         <el-table-column v-for="item in dimensions" :key="item.code" :label="item.name" align="center" :prop="`dimensionValues.${item.code}`" min-width="140" />
@@ -49,6 +64,7 @@
 
 <script lang="ts" setup>
 import { reactive, ref } from "vue";
+import { useI18n } from "vue-i18n";
 import { ElMessage } from "element-plus";
 import { Filter, Download } from "@element-plus/icons-vue";
 import api from "/@/api/datahub";
@@ -67,6 +83,7 @@ const title = ref("");
 const detail = reactive<any>({}); // 详情含 unit/维度等
 const list = ref<any[]>([]);
 const total = ref(0);
+const { t } = useI18n();
 
 const baseQuery = {
   searchValue: "",
@@ -116,7 +133,7 @@ function fetchDetail() {
 
 function fetchList(p?: number) {
   if (dimensionsKey.value && !dimensionsValue.value) {
-    ElMessage.warning("请选择或输入维度值");
+    ElMessage.warning(t('message.dateCenter.indicator.messages.selectOrInputDimensionValue'));
     return;
   }
 
@@ -152,7 +169,7 @@ function exportData() {
   exportLoading.value = true;
   api.indicator
     .exportData(buildParams())
-    .then((res: any) => downloadFile(res, title.value + "指标数据导出.xlsx"))
+    .then((res: any) => downloadFile(res, title.value + ' ' + t('message.dateCenter.indicator.data.exportFileNameSuffix')))
     .finally(() => (exportLoading.value = false));
 }
 

+ 20 - 13
src/views/system/datahub/indicator/component/detail.vue

@@ -1,38 +1,45 @@
 <template>
-  <el-dialog v-model="visible" :title="`指标详情 - ${detail.name || '-'} (${detail.code || code})`" width="720px" :close-on-click-modal="false">
+  <el-dialog
+    v-model="visible"
+    :title="t('message.dateCenter.indicator.detail.title') + ' - ' + (detail.name || '-') + ' (' + ((detail as any).code || code) + ')'"
+    width="720px"
+    :close-on-click-modal="false"
+  >
     <div v-if="visible">
       <el-descriptions :column="1" border class="mt16">
-        <el-descriptions-item label="指标名称">{{ detail.name || "-" }}</el-descriptions-item>
-        <el-descriptions-item label="指标描述">{{ detail.description || "-" }}</el-descriptions-item>
-        <el-descriptions-item label="指标类型">
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.name')">{{ detail.name || "-" }}</el-descriptions-item>
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.description')">{{ detail.description || "-" }}</el-descriptions-item>
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.type')">
           <el-tag size="small">{{ detail.typeName || "-" }}</el-tag>
         </el-descriptions-item>
-        <el-descriptions-item label="单位">{{ detail.unit || "-" }}</el-descriptions-item>
-        <el-descriptions-item label="计算公式">
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.unit')">{{ detail.unit || "-" }}</el-descriptions-item>
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.formula')">
           <span class="mono">{{ detail.formula || "-" }}</span>
         </el-descriptions-item>
-        <el-descriptions-item label="维度数">{{ detail.dimensions?.length }} 个</el-descriptions-item>
-        <el-descriptions-item label="状态">
-          <el-tag :type="detail.status == '1' ? 'success' : 'info'">{{ detail.status == "1" ? "已发布" : "未发布" }}</el-tag>
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.dimensionCount')">{{ detail.dimensions?.length }} {{ t('message.dateCenter.indicator.detail.unitItems') }}</el-descriptions-item>
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.status')">
+          <el-tag :type="detail.status == '1' ? 'success' : 'info'">{{ detail.status == "1" ? t('message.dateCenter.indicator.status.published') : t('message.dateCenter.indicator.status.unpublished') }}</el-tag>
         </el-descriptions-item>
-        <el-descriptions-item label="指标描述">{{ detail.description || "-" }}</el-descriptions-item>
-        <el-descriptions-item label="创建时间">{{ detail.createdAt || detail.createTime || "-" }}</el-descriptions-item>
-        <el-descriptions-item label="创建人">{{ detail.createdBy || "-" }}</el-descriptions-item>
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.description')">{{ detail.description || "-" }}</el-descriptions-item>
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.createdAt')">{{ detail.createdAt || detail.createTime || "-" }}</el-descriptions-item>
+        <el-descriptions-item :label="t('message.dateCenter.indicator.detail.labels.createdBy')">{{ detail.createdBy || "-" }}</el-descriptions-item>
       </el-descriptions>
     </div>
     <template #footer>
-      <el-button @click="visible = false">关闭</el-button>
+      <el-button @click="visible = false">{{ t('message.dateCenter.indicator.detail.close') }}</el-button>
     </template>
   </el-dialog>
 </template>
 
 <script lang="ts" setup>
 import { reactive, ref } from "vue";
+import { useI18n } from "vue-i18n";
 import api from "/@/api/datahub";
 
 const visible = ref(false);
 const code = ref("");
 const detail = reactive<any>({});
+const { t } = useI18n();
 
 function open(row: any) {
   code.value = row?.code || "";

+ 1 - 1
src/views/system/datahub/indicator/index.vue

@@ -29,7 +29,7 @@
             <el-icon><ele-FolderAdd /></el-icon>
             新增指标
           </el-button>
-          <el-button class="ml10" @click="exportData()" :loading="exportLoading">
+          <el-button class="ml10" @click="exportData()" :loading="exportLoading" v-auth="'download'">
             <el-icon><ele-Download /></el-icon>
             导出
           </el-button>