|
@@ -12,29 +12,37 @@
|
|
|
</el-row>
|
|
|
<el-row :gutter="20" v-if="radio1==='任务策略'">
|
|
|
<el-col :span="24">
|
|
|
- <el-button type="primary" plain style="margin-top: 15px;" @click="handleUpdateTask">新增</el-button>
|
|
|
+<!-- <el-button type="primary" plain style="margin-top: 15px;" @click="handleUpdateTask">新增</el-button>-->
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row :gutter="20" v-if="radio1==='日常策略'">
|
|
|
<el-col :span="24">
|
|
|
<div class="table-box" style="margin-top: 10px;height: 58vh" >
|
|
|
<!-- 表格主体 -->
|
|
|
- <el-table stripe ref="tableRef" :border="true" :data="processTableData" size="small">
|
|
|
+ <el-table stripe ref="tableRef" :border="true" :data="tableDailyData" size="small">
|
|
|
<template v-for="item in columns" :key="item">
|
|
|
<el-table-column v-bind="item" :align="item.align ?? 'left'" :reserve-selection="item.type == 'selection'" :show-overflow-tooltip="true">
|
|
|
- <template v-if="item.prop === 'operation'">
|
|
|
- <el-tooltip
|
|
|
- class="box-item"
|
|
|
- effect="dark"
|
|
|
- content="编辑"
|
|
|
- placement="top"
|
|
|
- >
|
|
|
- <el-button type="primary" link @click="handleUpdate">
|
|
|
- <el-icon >
|
|
|
- <Edit />
|
|
|
- </el-icon>
|
|
|
- </el-button>
|
|
|
- </el-tooltip>
|
|
|
+ <template #default="scope">
|
|
|
+ <template v-if="item.prop === 'alarm'">
|
|
|
+ {{parseItemValue(scope.row[item.prop])}}
|
|
|
+ </template>
|
|
|
+ <template v-if="item.prop === 'eliminate'">
|
|
|
+ {{parseItemValue(scope.row[item.prop])}}
|
|
|
+ </template>
|
|
|
+ <template v-if="item.prop === 'operation'">
|
|
|
+ <el-tooltip
|
|
|
+ class="box-item"
|
|
|
+ effect="dark"
|
|
|
+ content="编辑"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <el-button type="primary" link @click="handleUpdate">
|
|
|
+ <el-icon >
|
|
|
+ <Edit />
|
|
|
+ </el-icon>
|
|
|
+ </el-button>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</template>
|
|
@@ -56,9 +64,26 @@
|
|
|
<el-col :span="24">
|
|
|
<div class="table-box" style="margin-top: 10px;height: 53vh" >
|
|
|
<!-- 表格主体 -->
|
|
|
- <el-table stripe ref="tableRef" :border="true" :data="processTableData2" size="small">
|
|
|
+ <el-table stripe ref="tableRef" :border="true" :data="taskData" size="small">
|
|
|
<template v-for="item in columns2" :key="item">
|
|
|
<el-table-column v-bind="item" :align="item.align ?? 'left'" :reserve-selection="item.type == 'selection'" :show-overflow-tooltip="true">
|
|
|
+ <template #default="scope">
|
|
|
+ <template v-if="item.prop === 'tact_name'">
|
|
|
+ {{scope.row[item.prop]}}
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.prop === 'tact_begin_dt_i'">
|
|
|
+ {{convertTimestampToDateTime(scope.row.tact_begin_dt_i)}}
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.prop === 'tact_end_dt_i'">
|
|
|
+ {{convertTimestampToDateTime(scope.row.tact_end_dt_i)}}
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ {{parseItemValue(scope.row[item.prop])}}
|
|
|
+ </template>
|
|
|
+ <template v-if="item.prop === 'l'">
|
|
|
+ 启用
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
</template>
|
|
|
|
|
@@ -334,7 +359,7 @@
|
|
|
<script setup lang="tsx">
|
|
|
import {defineProps, onMounted, reactive, ref} from "vue";
|
|
|
import {ColumnProps} from "@/components/ProTable/interface";
|
|
|
-import {getAstactList, getYaspacketList, getYasthreshold} from "@/api/modules/allData";
|
|
|
+import {getAstactList, getRgDataList, getYaspacketList, getYasthreshold} from "@/api/modules/allData";
|
|
|
const props = defineProps<{
|
|
|
selectData?: {};
|
|
|
}>();
|
|
@@ -346,17 +371,157 @@ const pageable = ref<any>({
|
|
|
});
|
|
|
const getList= async ()=>{
|
|
|
const { data } = await getAstactList(pageable.value);
|
|
|
+ const dataList = data[props.selectData.as_code]
|
|
|
+ dataList.forEach(item => {
|
|
|
+ if (item.tact_index === 1) {
|
|
|
+ dailyData.value.push(item);
|
|
|
+ } else {
|
|
|
+ taskData.value.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ getDailyData()
|
|
|
}
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- getList()
|
|
|
-})
|
|
|
-
|
|
|
+const getDailyData=()=>{
|
|
|
+ if(dailyData.value!=undefined&&dailyData.value.length>0){
|
|
|
+ const data = dailyData.value[0]
|
|
|
+ tableDailyData.value.forEach(item => {
|
|
|
+ if (item.name === '能见度') {
|
|
|
+ item.alarm = data.tact_njd_on;
|
|
|
+ item.eliminate = data.tact_njd_off;
|
|
|
+ item.alarmTime = getAlarmTime(data.tact_njd_on)
|
|
|
+ item.eliminateTime = getEliminateTime(data.tact_njd_off)
|
|
|
+ } else if (item.name === '风速') {
|
|
|
+ item.alarm = data.tact_fs_on;
|
|
|
+ item.eliminate = data.tact_fs_off;
|
|
|
+ item.alarmTime = getAlarmTime(data.tact_fs_on)
|
|
|
+ item.eliminateTime = getEliminateTime(data.tact_fs_off)
|
|
|
+ } else if (item.name === '大气电场') {
|
|
|
+ item.alarm = data.tact_dqdc_on;
|
|
|
+ item.eliminate = data.tact_dqdc_off;
|
|
|
+ item.alarmTime = getAlarmTime(data.tact_dqdc_on)
|
|
|
+ item.eliminateTime = getEliminateTime(data.tact_dqdc_off)
|
|
|
+ } else if (item.name === '云量') {
|
|
|
+ item.alarm = data.tact_yl_on;
|
|
|
+ item.eliminate = data.tact_yl_off;
|
|
|
+ item.alarmTime = getAlarmTime(data.tact_yl_on)
|
|
|
+ item.eliminateTime = getEliminateTime(data.tact_yl_off)
|
|
|
+ } else if (item.name === '云高') {
|
|
|
+ item.alarm = data.tact_yg_on;
|
|
|
+ item.eliminate = data.tact_yg_off;
|
|
|
+ item.alarmTime = getAlarmTime(data.tact_yg_on)
|
|
|
+ item.eliminateTime = getEliminateTime(data.tact_yg_off)
|
|
|
+ } else if (item.name === '气温') {
|
|
|
+ item.alarm = data.tact_wd_on;
|
|
|
+ item.eliminate = data.tact_wd_off;
|
|
|
+ item.alarmTime = getAlarmTime(data.tact_wd_on)
|
|
|
+ item.eliminateTime = getEliminateTime(data.tact_wd_off)
|
|
|
+ } else if (item.name === '湿度') {
|
|
|
+ item.alarm = data.tact_sd_on;
|
|
|
+ item.eliminate = data.tact_sd_off;
|
|
|
+ item.alarmTime = getAlarmTime(data.tact_sd_on)
|
|
|
+ item.eliminateTime = getEliminateTime(data.tact_sd_off)
|
|
|
+ } else if (item.name === '小时雨量') {
|
|
|
+ item.alarm = data.tact_xsyl_on;
|
|
|
+ item.eliminate = data.tact_xsyl_off;
|
|
|
+ item.alarmTime = getAlarmTime(data.tact_xsyl_on)
|
|
|
+ item.eliminateTime = getEliminateTime(data.tact_xsyl_off)
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(tableDailyData.value)
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+const tableDailyData =ref(
|
|
|
+ [
|
|
|
+ {
|
|
|
+ name:'能见度',
|
|
|
+ alarm:'',
|
|
|
+ eliminate:'',
|
|
|
+ alarmTime:'',
|
|
|
+ eliminateTime:'',
|
|
|
+ alarmManner:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'风速',
|
|
|
+ alarm:'',
|
|
|
+ eliminate:'',
|
|
|
+ alarmTime:'',
|
|
|
+ eliminateTime:'',
|
|
|
+ alarmManner:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'大气电场',
|
|
|
+ alarm:'',
|
|
|
+ eliminate:'',
|
|
|
+ alarmTime:'',
|
|
|
+ eliminateTime:'',
|
|
|
+ alarmManner:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'云量',
|
|
|
+ alarm:'',
|
|
|
+ eliminate:'',
|
|
|
+ alarmTime:'',
|
|
|
+ eliminateTime:'',
|
|
|
+ alarmManner:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'云高',
|
|
|
+ alarm:'',
|
|
|
+ eliminate:'',
|
|
|
+ alarmTime:'',
|
|
|
+ eliminateTime:'',
|
|
|
+ alarmManner:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'气温',
|
|
|
+ alarm:'',
|
|
|
+ eliminate:'',
|
|
|
+ alarmTime:'',
|
|
|
+ eliminateTime:'',
|
|
|
+ alarmManner:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'湿度',
|
|
|
+ alarm:'',
|
|
|
+ eliminate:'',
|
|
|
+ alarmTime:'',
|
|
|
+ eliminateTime:'',
|
|
|
+ alarmManner:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'小时雨量',
|
|
|
+ alarm:'',
|
|
|
+ eliminate:'',
|
|
|
+ alarmTime:'',
|
|
|
+ eliminateTime:'',
|
|
|
+ alarmManner:''
|
|
|
+ }
|
|
|
+ ]
|
|
|
+)
|
|
|
|
|
|
|
|
|
|
|
|
+onMounted(() => {
|
|
|
+ getAllRgDataList()
|
|
|
+ getList()
|
|
|
+})
|
|
|
|
|
|
+const dailyData = ref([])
|
|
|
+const taskData = ref([])
|
|
|
+function convertTimestampToDateTime(timestamp) {
|
|
|
+ const date = new Date(timestamp * 1000); // JavaScript 的 Date 需要毫秒级时间戳
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,所以加 1
|
|
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
+ const hours = String(date.getHours()).padStart(2, '0');
|
|
|
+ const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
+ const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
|
+
|
|
|
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
+}
|
|
|
const rules = ref<any>(
|
|
|
{
|
|
|
name: [{ required: true, message: "任务名称不能为空", trigger: "blur" }],
|
|
@@ -400,7 +565,94 @@ const handleUpdateTask = async (row?: any) => {
|
|
|
dialogTask.title = "策略管理";
|
|
|
dialogTask.isMode = false;
|
|
|
}
|
|
|
+const getAlarmTime = (itemValue)=>{
|
|
|
+ if (itemValue === '1|1|0') {
|
|
|
+ const time = itemValue.split('|');
|
|
|
+ return time[1]
|
|
|
+ }else if (typeof itemValue === 'string') {
|
|
|
+ const alarm = itemValue.split(';');
|
|
|
+ const time = alarm[0].split('|');
|
|
|
+ return time[1]
|
|
|
+ }
|
|
|
|
|
|
+ return '';
|
|
|
+}
|
|
|
+const getEliminateTime = (itemValue)=>{
|
|
|
+ if (itemValue === '0|15') {
|
|
|
+ const time = itemValue.split('|');
|
|
|
+ return time[1]
|
|
|
+ }else if (typeof itemValue === 'string') {
|
|
|
+ const alarm = itemValue.split(';');
|
|
|
+ const time = alarm[0].split('|');
|
|
|
+ return time[1]
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+const parseItemValue = (itemValue) => {
|
|
|
+ if (itemValue === '1|1|0'||itemValue === '0|15') {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ if (typeof itemValue === 'string') {
|
|
|
+ const alarm = itemValue.split(';');
|
|
|
+ let value = ''; // 初始化 value 为一个空字符串
|
|
|
+ for (var i = 1; i < alarm.length; i++) { // 循环从数组的第二个元素开始
|
|
|
+ value += getItemValue(alarm[i]) + ' '; // 拼接字符串并在最后添加空格
|
|
|
+ }
|
|
|
+ // 如果需要在最后的结果中没有尾随空格,可以使用 trimEnd() 方法
|
|
|
+ return value.trimEnd();
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+}
|
|
|
+
|
|
|
+const getItemValue=(itemValue)=>{
|
|
|
+ const [element, operator, value] = itemValue.split('|');
|
|
|
+ return `${findDataName(element)} ${operatorDataName(operator)} ${value}`;
|
|
|
+}
|
|
|
+
|
|
|
+const operatorDataName = (id) => {
|
|
|
+ const item = operatorList.find(item => item.value == parseInt(id));
|
|
|
+ if (item) {
|
|
|
+ return item.label;
|
|
|
+ } else {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const operatorList= [
|
|
|
+ {
|
|
|
+ value: 0,
|
|
|
+ label: '>',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: '<',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 2,
|
|
|
+ label: '=',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 3,
|
|
|
+ label: '≠',
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
+// 查询所有人工要素字典表
|
|
|
+const elementList =ref<any>([])
|
|
|
+const getAllRgDataList = async () => {
|
|
|
+ const { data } = await getRgDataList();
|
|
|
+ elementList.value = data.list
|
|
|
+};
|
|
|
+const findDataName = (id) => {
|
|
|
+ const item = elementList.value.find(item => item.data_id == parseInt(id));
|
|
|
+ if (item) {
|
|
|
+ return item.data_name;
|
|
|
+ } else {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
@@ -443,22 +695,15 @@ const submitForm = () => {
|
|
|
|
|
|
const radio1 = ref('日常策略')
|
|
|
|
|
|
-const processTableData = ref([
|
|
|
- {
|
|
|
- a: "能见度",
|
|
|
- d: "1",
|
|
|
- e: "告警时间",
|
|
|
- f: "字幕告警",
|
|
|
- }
|
|
|
-]);
|
|
|
+const processTableData = ref([]);
|
|
|
|
|
|
// 表格配置项
|
|
|
const columns = reactive<ColumnProps[]>([
|
|
|
- { prop: "a", label: "策略名称"},
|
|
|
- { prop: "b", label: "告警条件"},
|
|
|
- { prop: "c", label: "消警条件" },
|
|
|
- { prop: "d", label: "告警时间" },
|
|
|
- { prop: "e", label: "消警时间" },
|
|
|
+ { prop: "name", label: "策略名称"},
|
|
|
+ { prop: "alarm", label: "告警条件"},
|
|
|
+ { prop: "eliminate", label: "消警条件" },
|
|
|
+ { prop: "alarmTime", label: "告警时间" },
|
|
|
+ { prop: "eliminateTime", label: "消警时间" },
|
|
|
{ prop: "f", label: "告警方式" },
|
|
|
{ prop: "operation", label: "操作", width:150,align: 'center' }
|
|
|
]);
|
|
@@ -469,17 +714,17 @@ const processTableData2 = ref([
|
|
|
|
|
|
// 表格配置项
|
|
|
const columns2 = reactive<ColumnProps[]>([
|
|
|
- { prop: "a", label: "任务名称"},
|
|
|
- { prop: "b", label: "开始时间"},
|
|
|
- { prop: "c", label: "结束时间" },
|
|
|
- { prop: "d", label: "能见度" },
|
|
|
- { prop: "e", label: "风速" },
|
|
|
- { prop: "f", label: "大气电场" },
|
|
|
- { prop: "g", label: "云量" },
|
|
|
- { prop: "h", label: "云高" },
|
|
|
- { prop: "i", label: "气温" },
|
|
|
- { prop: "j", label: "湿度" },
|
|
|
- { prop: "k", label: "降水" },
|
|
|
+ { prop: "tact_name", label: "任务名称"},
|
|
|
+ { prop: "tact_begin_dt_i", label: "开始时间"},
|
|
|
+ { prop: "tact_end_dt_i", label: "结束时间" },
|
|
|
+ { prop: "tact_njd_on", label: "能见度" },
|
|
|
+ { prop: "tact_fs_on", label: "风速" },
|
|
|
+ { prop: "tact_dqdc_on", label: "大气电场" },
|
|
|
+ { prop: "tact_yl_on", label: "云量" },
|
|
|
+ { prop: "tact_yg_on", label: "云高" },
|
|
|
+ { prop: "tact_wd_on", label: "气温" },
|
|
|
+ { prop: "tact_sd_on", label: "湿度" },
|
|
|
+ { prop: "tact_xsyl_on", label: "降水" },
|
|
|
{ prop: "l", label: "启停" }
|
|
|
]);
|
|
|
|