Переглянути джерело

Merge branch 'master' of http://94.191.59.107:3000/wukai/jy2024-ui

zhangwenya 9 місяців тому
батько
коміт
377771d80c
2 змінених файлів з 127 додано та 152 видалено
  1. 39 105
      src/views/alarm/record/bizSort.vue
  2. 88 47
      src/views/hl/bm/index.vue

+ 39 - 105
src/views/alarm/record/bizSort.vue

@@ -1,111 +1,45 @@
 <template>
-<div class="app-container">
-    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="0">
-      <el-form-item label="" style="width: 308px;margin-right:10px">
-        <el-date-picker
-            v-model="daterangeAlarmTime"
-            value-format="YYYY-MM-DD"
-            type="daterange"
-            range-separator="-"
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-        ></el-date-picker>
-      </el-form-item>
-      <el-form-item label="" style="width: 208px;margin-right:10px">
-        <el-select v-model="queryParams.objType" placeholder="请选择业务类型" clearable style="width: 100%">
-          <el-option
-              v-for="dict in biz_type"
-              :key="dict.value"
-              :label="dict.label"
-              :value="dict.value"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
-        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
-      </el-form-item>
-    </el-form>
-
-    <el-table v-loading="loading" border :data="recordList">
-      <el-table-column label="告警ID" align="center" prop="objId" width="80"/>
-      <el-table-column label="告警对象/应用组件" align="center" prop="objName"/>
-      <el-table-column label="告警数量" align="center" prop="num"/>
-      <el-table-column label="操作" align="center" prop="alarmTime" width="180">
-        <template #default="scope">
-          <el-button type="text" plain icon="Position" @click="handleDetails(scope.row)">明细</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <pagination
-        v-show="total>0"
-        :total="total"
-        v-model:page="queryParams.pageNum"
-        v-model:limit="queryParams.pageSize"
-        @pagination="getList"
-    />
+  <div class="app-container">
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="12">
+        <el-card>
+          <div ref="echartsRef" style="width: 600px; height: 400px;"></div>
+        </el-card>
+      </el-col>
+      <el-col :span="12"></el-col>
+    </el-row>
   </div>
 </template>
 
-<script setup name="Record">
-import {getBizSort} from "@/api/alarm/record";
-import {useRouter} from "vue-router";
-
-const {proxy} = getCurrentInstance();
-const {alarm_level} = proxy.useDict('alarm_level');
-const {biz_type} = proxy.useDict('biz_type');
-
-const recordList = ref([]);
-const open = ref(false);
-const loading = ref(true);
-const showSearch = ref(true);
-const total = ref(0);
-const daterangeAlarmTime = ref([]);
-const router = useRouter();
-
-const data = reactive({
-  form: {},
-  queryParams: {
-    pageNum: 1,
-    pageSize: 10,
-    bizType: null
-  },
+<script setup>
+import {onMounted, ref} from 'vue';
+import * as echarts from 'echarts';
+
+const echartsRef = ref(null);
+
+onMounted(() => {
+  const chart = echarts.init(echartsRef.value);
+  const option = {
+    // ECharts 配置项
+    title: {
+      text: 'ECharts 示例'
+    },
+    tooltip: {},
+    xAxis: {
+      data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
+    },
+    yAxis: {},
+    series: [{
+      name: '销量',
+      type: 'bar',
+      data: [5, 20, 36, 10, 10, 20]
+    }]
+  };
+
+  chart.setOption(option);
 });
-
-const {queryParams, form} = toRefs(data);
-
-function handleDetails(row){
-  console.log(row,router)
-}
-
-/** 查询告警记录列表 */
-function getList() {
-  loading.value = true;
-  queryParams.value.params = {};
-  if (null != daterangeAlarmTime && '' != daterangeAlarmTime) {
-    queryParams.value.params["start"] = daterangeAlarmTime.value[0];
-    queryParams.value.params["end"] = daterangeAlarmTime.value[1];
-  }
-  getBizSort(queryParams.value).then(response => {
-    recordList.value = response.rows;
-    total.value = response.total;
-    loading.value = false;
-  });
-}
-
-
-/** 搜索按钮操作 */
-function handleQuery() {
-  queryParams.value.pageNum = 1;
-  getList();
-}
-
-/** 重置按钮操作 */
-function resetQuery() {
-  daterangeAlarmTime.value = [];
-  proxy.resetForm("queryRef");
-  handleQuery();
-}
-getList();
 </script>
+
+<style>
+/* 你的样式 */
+</style>

+ 88 - 47
src/views/hl/bm/index.vue

@@ -1,6 +1,16 @@
 <template>
   <div class="app-container">
     <el-row :gutter="10" class="mb8">
+      <el-col :span="12">
+        <el-card>
+          <div ref="myChartOne" style="height: 400px;"></div>
+        </el-card>
+      </el-col>
+      <el-col :span="12" style="text-align: right">
+        <div style="width: 100%;height: 60px;color: #1f2d3d;border: #c03639"></div>
+      </el-col>
+    </el-row>
+    <el-row :gutter="10" class="mb8">
       <el-col :span="18">
         <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="0">
           <el-form-item label="" prop="modelName" style="margin-right:10px">
@@ -19,59 +29,68 @@
       </el-col>
       <el-col :span="6" style="text-align: right">
         <el-button
-          type="primary"
-          plain
-          icon="Plus"
-          @click="handleAdd"
-          v-hasPermi="['hl:bm:add']"
-        >新增</el-button>
+            type="primary"
+            plain
+            icon="Plus"
+            @click="handleAdd"
+            v-hasPermi="['hl:bm:add']"
+        >新增
+        </el-button>
       </el-col>
     </el-row>
 
     <el-table v-loading="loading" :data="bmList" border>
-      <el-table-column label="模型ID" align="center" prop="modelId"  width="80"/>
-      <el-table-column label="模型名称" align="left" prop="modelName" />
-      <el-table-column label="昨日健康度" align="center" prop="yesterdayScore"  width="180"/>
-      <el-table-column label="最近一次健康度得分" align="center" prop="lastScore"  width="180"/>
-<!--      <el-table-column label="更新时间" align="left" prop="updateTime" width="180">-->
-<!--        <template #default="scope">-->
-<!--          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{mi}:{s}') }}</span>-->
-<!--        </template>-->
-<!--      </el-table-column>-->
-      <el-table-column label="操作" width="480" class-name="small-padding fixed-width" align="left" >
+      <el-table-column label="模型ID" align="center" prop="modelId" width="80"/>
+      <el-table-column label="模型名称" align="left" prop="modelName"/>
+      <el-table-column label="昨日健康度" align="center" prop="yesterdayScore" width="180"/>
+      <el-table-column label="最近一次健康度得分" align="center" prop="lastScore" width="180"/>
+      <!--      <el-table-column label="更新时间" align="left" prop="updateTime" width="180">-->
+      <!--        <template #default="scope">-->
+      <!--          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{mi}:{s}') }}</span>-->
+      <!--        </template>-->
+      <!--      </el-table-column>-->
+      <el-table-column label="操作" width="480" class-name="small-padding fixed-width" align="left">
         <template #default="scope">
-          <el-button link type="primary" icon="Position" @click="handleHealthSet(scope.row,'health')">健康度配置</el-button>
-          <el-button link type="primary" icon="Calendar" @click="handleHealthSet(scope.row,'history')">历史健康度</el-button>
-          <el-button link type="primary" icon="Clock"  @click="handleHealthSet(scope.row,'day')">日健康度</el-button>
-          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['hl:bm:edit']">修改</el-button>
-          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['hl:bm:remove']">删除</el-button>
+          <el-button link type="primary" icon="Position" @click="handleHealthSet(scope.row,'health')">健康度配置
+          </el-button>
+          <el-button link type="primary" icon="Calendar" @click="handleHealthSet(scope.row,'history')">历史健康度
+          </el-button>
+          <el-button link type="primary" icon="Clock" @click="handleHealthSet(scope.row,'day')">日健康度</el-button>
+          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['hl:bm:edit']">修改
+          </el-button>
+          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['hl:bm:remove']">
+            删除
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
 
     <pagination
-      v-show="total>0"
-      :total="total"
-      v-model:page="queryParams.pageNum"
-      v-model:limit="queryParams.pageSize"
-      @pagination="getList"
+        v-show="total>0"
+        :total="total"
+        v-model:page="queryParams.pageNum"
+        v-model:limit="queryParams.pageSize"
+        @pagination="getList"
     />
 
     <!-- 添加或修改业务模型对话框 -->
-    <el-dialog :title="title" v-model="open" :width="dialogType ==='health'?'1200px':'800px'" append-to-body :style="dialogType ==='health'?'margin-top:2px!important;':''">
+    <el-dialog :title="title" v-model="open" :width="dialogType ==='health'?'1200px':'800px'" append-to-body
+               :style="dialogType ==='health'?'margin-top:2px!important;':''">
       <add-bm-info ref="bmRef" @cancel="open = false" @success="getList" v-if="dialogType==='add'"/>
-      <component :is="activeComponent[currentActive]" v-else-if="dialogType!=='add' && open" :modelId="modelId" :dialogType="dialogType"/>
+      <component :is="activeComponent[currentActive]" v-else-if="dialogType!=='add' && open" :modelId="modelId"
+                 :dialogType="dialogType"/>
     </el-dialog>
   </div>
 </template>
 
 <script setup name="Bm">
 
-import { listBm, getBm, delBm, addBm, updateBm } from "@/api/hl/bm";
-import addBmInfo from "./component/addBm.vue"
+import {addBm, delBm, listBm, updateBm} from "@/api/hl/bm";
 import healthSetting from "./component/healthSetting.vue"
 import historyHealth from "./component/historyHealth.vue"
-const { proxy } = getCurrentInstance();
+import * as echarts from 'echarts'
+
+const {proxy} = getCurrentInstance();
 
 const bmList = ref([]);
 const open = ref(false);
@@ -84,8 +103,9 @@ const total = ref(0);
 const title = ref("");
 const dialogType = ref("add")
 const modelId = ref(0)
-const activeComponent = [healthSetting,historyHealth]
-const currentActive=ref(0)
+const activeComponent = [healthSetting, historyHealth]
+const currentActive = ref(0)
+const myChartOne=ref(null)
 
 const data = reactive({
   form: {},
@@ -102,24 +122,44 @@ const data = reactive({
     updateTime: null,
     remark: null
   },
-  rules: {
-  }
+  rules: {}
 });
 
-const { queryParams, form, rules } = toRefs(data);
+const {queryParams, form, rules} = toRefs(data);
 
-function handleHealthSet(row,type){
+function handleHealthSet(row, type) {
   modelId.value = row.modelId
   currentActive.value = type === "health" ? 0 : 1
   dialogType.value = type
   open.value = true
-  title.value = type === "health" ? "健康度配置" :(row.modelName + ((type==="day"?"日":"历史")+"健康度"))
+  title.value = type === "health" ? "健康度配置" : (row.modelName + ((type === "day" ? "日" : "历史") + "健康度"))
 }
 
 
+function initChart() {
+  const myChart = echarts.init(myChartOne.value);
+  const option = {
+    // ECharts 配置项
+    title: {
+      text: 'ECharts 示例'
+    },
+    tooltip: {},
+    xAxis: {
+      data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
+    },
+    yAxis: {},
+    series: [{
+      name: '销量',
+      type: 'bar',
+      data: [5, 20, 36, 10, 10, 20]
+    }]
+  };
+  myChart.setOption(option)
+}
 
 /** 查询业务模型列表 */
 function getList() {
+  initChart();
   loading.value = true;
   listBm(queryParams.value).then(response => {
     bmList.value = response.rows;
@@ -173,7 +213,7 @@ function handleSelectionChange(selection) {
 /** 新增按钮操作 */
 function handleAdd() {
   reset();
-  dialogType.value ="add"
+  dialogType.value = "add"
   open.value = true;
   title.value = "添加业务模型";
   proxy.$nextTick(() => {
@@ -183,12 +223,12 @@ function handleAdd() {
 
 /** 修改按钮操作 */
 function handleUpdate(row) {
-    dialogType.value ="add"
-    open.value = true;
-    title.value = "修改业务模型";
-    proxy.$nextTick(() => {
-      proxy.$refs["bmRef"].editRow(row)
-    })
+  dialogType.value = "add"
+  open.value = true;
+  title.value = "修改业务模型";
+  proxy.$nextTick(() => {
+    proxy.$refs["bmRef"].editRow(row)
+  })
 }
 
 /** 提交按钮 */
@@ -215,12 +255,13 @@ function submitForm() {
 /** 删除按钮操作 */
 function handleDelete(row) {
   const _modelIds = row.modelId || ids.value;
-  proxy.$modal.confirm('是否确认删除业务模型编号为"' + _modelIds + '"的数据项?').then(function() {
+  proxy.$modal.confirm('是否确认删除业务模型编号为"' + _modelIds + '"的数据项?').then(function () {
     return delBm(_modelIds);
   }).then(() => {
     getList();
     proxy.$modal.msgSuccess("删除成功");
-  }).catch(() => {});
+  }).catch(() => {
+  });
 }
 
 /** 导出按钮操作 */