微调
This commit is contained in:
13
frontend/src/views/analyse/index.vue
Normal file
13
frontend/src/views/analyse/index.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -65,7 +65,7 @@
|
||||
const proTable = ref<ProTableInstance>()
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<Resource.ResResourceList>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 50 },
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
@@ -150,7 +150,7 @@ const openAddDialog = () => {
|
||||
id: '',
|
||||
name: '',
|
||||
path: '',
|
||||
sort: 0,
|
||||
sort: 100,
|
||||
type: '',
|
||||
remark: '',
|
||||
route_Name: '',
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
>
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader>
|
||||
<el-button type='primary' :icon='DataAnalysis'>分析</el-button>
|
||||
<el-button type='primary' :icon='DataAnalysis' >分析</el-button>
|
||||
<el-button type='primary' :icon='Upload'>导出csv</el-button>
|
||||
</template>
|
||||
</ProTable>
|
||||
@@ -28,17 +28,18 @@ import { reactive,ref } from 'vue'
|
||||
let multipleSelection = ref<string[]>([])
|
||||
const logData = logDataList
|
||||
// 定义包含和排除的单位
|
||||
const includedUnits = ['日', '周', '月', '季度']; // 可以根据需要包含的单位
|
||||
const excludedUnits = ['年']; // 要排除的单位
|
||||
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
|
||||
const excludedUnits = ['季度','年']; // 要排除的单位
|
||||
const defaultUnits = '日'; // 默认的单位
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<Log.LogList>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 50 },
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{
|
||||
prop: 'id',
|
||||
label: '序号',
|
||||
width: 100,
|
||||
width: 70,
|
||||
},
|
||||
{
|
||||
prop: 'user',
|
||||
@@ -55,7 +56,11 @@ const columns = reactive<ColumnProps<Log.LogList>[]>([
|
||||
render: ({ searchParam }) => {
|
||||
return (
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl/>
|
||||
<TimeControl
|
||||
include={includedUnits}
|
||||
exclude={excludedUnits}
|
||||
default={defaultUnits}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
@@ -85,10 +90,11 @@ const columns = reactive<ColumnProps<Log.LogList>[]>([
|
||||
// 处理选择变化
|
||||
const handleSelectionChange = (selection: Log.LogList[]) => {
|
||||
multipleSelection.value = selection.map(row => row.id) // 更新选中的行
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,73 +1,75 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogBig">
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:data='errorData'
|
||||
:tool-button="false"
|
||||
/>
|
||||
</el-dialog>
|
||||
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogBig">
|
||||
<el-table :data="errorData" style="width: 100%" :span-method="spanMethod" border>
|
||||
<el-table-column prop="measured" label="被测量" />
|
||||
<el-table-column prop="deviceLevel" label="检测装置级别" />
|
||||
<el-table-column prop="condition" label="测量条件" />
|
||||
<el-table-column prop="maxErrorValue" label="最大误差" />
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="IndicatorTypeDialog">
|
||||
import { defineProps, defineEmits, reactive,watch,ref } from 'vue';
|
||||
import { dialogBig} from '@/utils/elementBind'
|
||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
||||
import type { ErrorSystem } from '@/api/error/interface'
|
||||
import errorDataList from '@/api/error/errorData'
|
||||
const errorData = errorDataList.errordetail
|
||||
|
||||
<script lang="ts" setup name="IndicatorTypeDialog">
|
||||
import { defineProps, defineEmits, reactive,watch,ref,computed } from 'vue';
|
||||
import { dialogBig} from '@/utils/elementBind'
|
||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
||||
import type { ErrorSystem } from '@/api/error/interface'
|
||||
import errorDataList from '@/api/error/errorData'
|
||||
const errorData = errorDataList.errordetail
|
||||
|
||||
// 表格配置项
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemDetail>[]>([
|
||||
{
|
||||
prop: 'measured',
|
||||
label: '被测量',
|
||||
},
|
||||
{
|
||||
prop: 'deviceLevel',
|
||||
label: '检测装置级别',
|
||||
},
|
||||
{
|
||||
prop: 'condition',
|
||||
label: '测量条件',
|
||||
},
|
||||
{
|
||||
prop: 'maxErrorValue',
|
||||
label: '最大误差',
|
||||
},
|
||||
{
|
||||
prop: 'measured',
|
||||
label: '被测量',
|
||||
},
|
||||
{
|
||||
prop: 'deviceLevel',
|
||||
label: '检测装置级别',
|
||||
},
|
||||
{
|
||||
prop: 'condition',
|
||||
label: '测量条件',
|
||||
},
|
||||
{
|
||||
prop: 'maxErrorValue',
|
||||
label: '最大误差',
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
dialogTitle: string;
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
dialogTitle: string;
|
||||
|
||||
formData: {
|
||||
measured: string,
|
||||
deviceLevel: string,
|
||||
condition: string,
|
||||
maxErrorValue: string
|
||||
};
|
||||
}>();
|
||||
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void;
|
||||
(e: 'submit', data: any): void;
|
||||
}>();
|
||||
|
||||
const handleCancel = () => {
|
||||
emit('update:visible', false); // 关闭对话框
|
||||
};
|
||||
|
||||
// 当 props.visible 改变时,更新 formData
|
||||
watch(() => props.visible, (newVal) => {
|
||||
if (!newVal) {
|
||||
// 这里可以重置表单数据,如果需要的话
|
||||
|
||||
formData: {
|
||||
measured: string,
|
||||
deviceLevel: string,
|
||||
condition: string,
|
||||
maxErrorValue: string
|
||||
};
|
||||
}>();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void;
|
||||
(e: 'submit', data: any): void;
|
||||
}>();
|
||||
|
||||
const handleCancel = () => {
|
||||
emit('update:visible', false); // 关闭对话框
|
||||
};
|
||||
|
||||
|
||||
|
||||
// 当 props.visible 改变时,更新 formData
|
||||
watch(() => props.visible, (newVal) => {
|
||||
if (!newVal) {
|
||||
// 这里可以重置表单数据,如果需要的话
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -50,29 +50,33 @@
|
||||
</el-tabs>
|
||||
<div class="dialog-footer">
|
||||
<el-button :icon='CirclePlus' type="primary" @click="openAddDialog">新增</el-button>
|
||||
<el-button :icon='Delete' type="danger" plain :disabled='!multipleSelection.length'>批量删除</el-button>
|
||||
<el-button :icon='Delete' type="danger" plain :disabled='!multipleSelection.length' @click="deleteSelectedRows">批量删除</el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="table-container">
|
||||
<el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange" >
|
||||
<el-table :data="tableData" :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" @selection-change="handleSelectionChange" >
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="id" label="序号" width="60" />
|
||||
<el-table-column prop="type" label="电能质量检测指标类型" width="200"/>
|
||||
<el-table-column prop="type" label="电能质量检测指标类型" width="181">
|
||||
<template #default="{ row }">
|
||||
<el-select v-model="row.type" placeholder="选择指标类型">
|
||||
<el-option v-for="option in typeList" :key="option.value" :label="option.label" :value="option.value"/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="起止范围" >
|
||||
<el-table-column label="起始">
|
||||
<template #default="{ row }">
|
||||
<el-row type="flex">
|
||||
<el-col :span="16">
|
||||
<el-col :span="14">
|
||||
<el-select v-model="row.startSelect" placeholder="选择起始值" style="width: 70px;">
|
||||
<el-option
|
||||
v-for="option in errorStartOptions"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
<el-option v-for="option in errorStartOptions" :key="option.value" :label="option.label" :value="option.value"/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<span>{{ row.startRange }}</span>
|
||||
<el-col :span="10">
|
||||
<el-input v-model= "row.startRange" style="width: 70px;"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
@@ -80,23 +84,18 @@
|
||||
<el-table-column label="结束">
|
||||
<template #default="{ row }">
|
||||
<el-row type="flex" >
|
||||
<el-col :span="16">
|
||||
<el-col :span="14">
|
||||
<el-select v-model="row.endSelect" placeholder="选择结束值" style="width: 70px;">
|
||||
<el-option
|
||||
v-for="option in errorEndOptions"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
<el-option v-for="option in errorEndOptions" :key="option.value" :label="option.label" :value="option.value"/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<span>{{ row.endRange }}</span>
|
||||
<el-col :span="10">
|
||||
<el-input v-model= "row.endRange" style="width: 70px;"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="120">
|
||||
<el-table-column label="单位" width="115">
|
||||
<template #default="{ row }">
|
||||
<el-select v-model="row.unit" placeholder="选择单位">
|
||||
<el-option
|
||||
@@ -110,7 +109,11 @@
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="最大误差">
|
||||
<el-table-column prop="maxErrorValue" label="最大误差值" width="100"/>
|
||||
<el-table-column prop="maxErrorValue" label="最大误差值" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model= "row.startRange" style="width: 70px;"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="误差类型">
|
||||
<template #default="{ row }">
|
||||
<el-select v-model="row.errorType" placeholder="选择误差类型">
|
||||
@@ -125,9 +128,9 @@
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default>
|
||||
<el-button type="primary" link :icon='CopyDocument'>复制</el-button>
|
||||
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link :icon='CopyDocument' @click="copyRow(row)">复制</el-button>
|
||||
<el-button type='primary' link :icon='Delete' @click="deleteRow(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -141,13 +144,7 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 新增/编辑资源对话框 -->
|
||||
<IndicatorTypeDialog
|
||||
:visible="dialogFormVisible"
|
||||
:formData="dialogForm"
|
||||
:dialogTitle="dialogTitle"
|
||||
@update:visible="dialogFormVisible = $event"
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="ErrorSystemDialog">
|
||||
@@ -168,11 +165,8 @@
|
||||
state: string;
|
||||
};
|
||||
}>();
|
||||
const dialogFormVisible = ref(false)
|
||||
const dialogForm =ref({
|
||||
type : '',
|
||||
})
|
||||
let multipleSelection = ref<string[]>([])
|
||||
|
||||
let multipleSelection = ref<number[]>([])
|
||||
const errorTypeOptions = [
|
||||
{ label: '绝对值-标称值', value: 'type1' },
|
||||
{ label: '相对值-I类', value: 'type2' },
|
||||
@@ -197,17 +191,29 @@ const errorEndOptions = [
|
||||
{ label: '<=', value: 'type2' },
|
||||
{ label: '无', value: 'type3' },
|
||||
];
|
||||
const typeList = [
|
||||
{ label: '电压', value: '电压' },
|
||||
{ label: '频率', value: '频率' },
|
||||
{ label: '电压三相不平衡度', value: '电压三相不平衡度' },
|
||||
{ label: '电流三相不平衡度', value: '电流三相不平衡度' },
|
||||
{ label: '电压波动', value: '电压波动' },
|
||||
{ label: '短时闪变', value: '短时闪变' },
|
||||
{ label: '谐波电压', value: '谐波电压' },
|
||||
{ label: '谐波电流', value: '谐波电流' },
|
||||
{ label: '谐波相角', value: '谐波相角' },
|
||||
{ label: '谐波功率', value: '谐波功率' },
|
||||
{ label: '间谐波电压', value: '间谐波电压' },
|
||||
{ label: '间谐波电流', value: '间谐波电流' },
|
||||
{ label: '功率', value: '功率' },
|
||||
{ label: '电流', value: '电流' },
|
||||
{ label: '暂态电压幅值', value: '暂态电压幅值' },
|
||||
{ label: '暂态持续时间', value: '暂态持续时间' },
|
||||
];
|
||||
|
||||
//选中
|
||||
// 处理选择变化
|
||||
const handleSelectionChange = (selection: any[]) => {
|
||||
multipleSelection.value = selection.map((row: { id: any; }) => row.id); // 更新选中的行
|
||||
|
||||
};
|
||||
|
||||
const tableData = [
|
||||
const tableData = ref([
|
||||
{
|
||||
id: '1',
|
||||
id: 1,
|
||||
type: '电压',
|
||||
startSelect: 'type1',
|
||||
startRange: '0.1',
|
||||
@@ -218,7 +224,7 @@ const errorEndOptions = [
|
||||
errorType:'type1'
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
id: 2,
|
||||
type: '电流',
|
||||
startSelect: 'type2',
|
||||
startRange: '0.01',
|
||||
@@ -229,7 +235,7 @@ const errorEndOptions = [
|
||||
errorType:'type1'
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
id: 3,
|
||||
type: '频率',
|
||||
startSelect: 'type2',
|
||||
startRange: '42.5',
|
||||
@@ -240,7 +246,7 @@ const errorEndOptions = [
|
||||
errorType:'type4'
|
||||
},
|
||||
|
||||
]
|
||||
])
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void;
|
||||
@@ -264,8 +270,44 @@ const errorEndOptions = [
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//选中
|
||||
// 处理选择变化
|
||||
const handleSelectionChange = (selection: any[]) => {
|
||||
multipleSelection.value = selection.map(row => row.id); // 更新选中的行
|
||||
|
||||
};
|
||||
const openAddDialog = () => {
|
||||
dialogFormVisible.value = true; // 打开对话框
|
||||
tableData.value.push({
|
||||
id: tableData.value.length + 1,
|
||||
type: '',
|
||||
startSelect: '',
|
||||
startRange: '',
|
||||
endSelect: '',
|
||||
endRange: '',
|
||||
unit:'',
|
||||
maxErrorValue:'',
|
||||
errorType:''
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const copyRow = (row: any) => {
|
||||
tableData.value.push({ ...row, id: tableData.value.length + 1, });
|
||||
};
|
||||
|
||||
const deleteRow = (row: { id: number; type: string; startSelect: string; startRange: string; endSelect: string; endRange: string; unit: string; maxErrorValue: string; errorType: string; }) => {
|
||||
const index = tableData.value.indexOf(row);
|
||||
if (index !== -1) {
|
||||
tableData.value.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const deleteSelectedRows = () => {
|
||||
tableData.value = tableData.value.filter(row => !multipleSelection.value.includes(row.id));
|
||||
multipleSelection.value = []; // 清空已选择的行
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<template >
|
||||
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogSmall" >
|
||||
<el-form-item label="指标类型" prop="type">
|
||||
<el-select
|
||||
class='select'
|
||||
placeholder='选择指标类型'
|
||||
v-model="formData.type"
|
||||
>
|
||||
<!-- 采用 v-for 动态渲染 -->
|
||||
<el-option
|
||||
v-for="unit in typeList"
|
||||
:key="unit.value"
|
||||
:label="unit.label"
|
||||
:value="unit.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">新增</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="IndicatorTypeDialog">
|
||||
import { defineProps, defineEmits, reactive,watch ,ref} from 'vue';
|
||||
import { dialogSmall} from '@/utils/elementBind'
|
||||
const dialogTitle = ref('新增检测指标误差项')
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
formData: {
|
||||
type: string;
|
||||
};
|
||||
}>();
|
||||
|
||||
const formData = reactive({
|
||||
type: ''
|
||||
});
|
||||
|
||||
const typeList = [
|
||||
{ label: '电压', value: '电压' },
|
||||
{ label: '频率', value: '频率' },
|
||||
{ label: '电压三相不平衡度', value: '电压三相不平衡度' },
|
||||
{ label: '电流三相不平衡度', value: '电流三相不平衡度' },
|
||||
{ label: '电压波动', value: '电压波动' },
|
||||
{ label: '短时闪变', value: '短时闪变' },
|
||||
{ label: '谐波电压', value: '谐波电压' },
|
||||
{ label: '谐波电流', value: '谐波电流' },
|
||||
{ label: '谐波相角', value: '谐波相角' },
|
||||
{ label: '谐波功率', value: '谐波功率' },
|
||||
{ label: '间谐波电压', value: '间谐波电压' },
|
||||
{ label: '间谐波电流', value: '间谐波电流' },
|
||||
{ label: '功率', value: '功率' },
|
||||
{ label: '电流', value: '电流' },
|
||||
{ label: '暂态电压幅值', value: '暂态电压幅值' },
|
||||
{ label: '暂态持续时间', value: '暂态持续时间' },
|
||||
];
|
||||
|
||||
const rules = {
|
||||
name :[
|
||||
{require:true,trigger:"blur",message:"请填写菜单名称"}
|
||||
]
|
||||
}
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void;
|
||||
(e: 'submit', data: any): void;
|
||||
}>();
|
||||
|
||||
const handleCancel = () => {
|
||||
emit('update:visible', false); // 关闭对话框
|
||||
};
|
||||
|
||||
const handleSubmit = () => {
|
||||
emit('submit', props.formData); // 提交表单数据
|
||||
emit('update:visible', false); // 提交后关闭对话框
|
||||
};
|
||||
|
||||
// 当 props.visible 改变时,更新 formData
|
||||
watch(() => props.visible, (newVal) => {
|
||||
if (!newVal) {
|
||||
// 这里可以重置表单数据,如果需要的话
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -76,11 +76,11 @@ const detail_dialogForm = ref<ErrorSystem.ErrorSystemDetail>({
|
||||
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 50 },
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{
|
||||
prop: 'id',
|
||||
label: '序号',
|
||||
width: 100,
|
||||
width: 70,
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
|
||||
Reference in New Issue
Block a user