微调
This commit is contained in:
@@ -15,6 +15,7 @@ export namespace ErrorSystem {
|
||||
export interface ErrorSystemDetail {
|
||||
measured: string;//被测量
|
||||
deviceLevel: string;//检测装置级别
|
||||
measurementType?: string;//测量类型
|
||||
condition: string;//测量条件
|
||||
maxErrorValue: string;//最大误差
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'id': '1',
|
||||
'name': '检测计划',
|
||||
'path':'/plan/planList/index',
|
||||
'sort':1,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -17,7 +17,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'id': '2',
|
||||
'name': '台账管理',
|
||||
'path':'/plan/planList/index',
|
||||
'sort':2,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -28,7 +28,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '检测脚本',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':21,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -40,7 +40,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '被检设备',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':22,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -52,7 +52,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '误差体系',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':23,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -63,7 +63,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '检测源',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':24,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -78,7 +78,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '权限管理',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':3,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -89,7 +89,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '用户管理',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':31,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -101,7 +101,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '角色管理',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':32,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -113,7 +113,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '菜单管理',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':33,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -127,7 +127,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '系统配置',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':4,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -138,7 +138,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '通用配置',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':41,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -150,7 +150,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '数据字典',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':42,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -162,7 +162,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '报告模版',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':43,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -173,7 +173,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '版本注册',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':44,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -188,7 +188,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '日志管理',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':5,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -200,7 +200,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '统计分析',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':6,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
@@ -212,7 +212,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
|
||||
'name': '示例',
|
||||
|
||||
'path':'/plan/planList/index',
|
||||
'sort':7,
|
||||
'sort':100,
|
||||
'type':'菜单',
|
||||
'remark':'检测计划描述',
|
||||
'route_Name':'route',
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
v-model='startDate'
|
||||
type='date'
|
||||
placeholder='起始时间'
|
||||
@change="emitDateChange"
|
||||
:disabled-date="disableStartDate"
|
||||
:readonly="timeUnit != '自定义'"
|
||||
></el-date-picker>
|
||||
@@ -31,6 +32,7 @@
|
||||
v-model='endDate'
|
||||
type='date'
|
||||
placeholder='结束时间'
|
||||
@change="emitDateChange"
|
||||
:disabled-date="disableEndDate"
|
||||
:readonly="timeUnit !== '自定义'"
|
||||
></el-date-picker>
|
||||
@@ -45,7 +47,7 @@
|
||||
<div class='left_triangle'></div>
|
||||
</el-button>
|
||||
<el-button class='triangle-button' type='primary' @click='goToCurrent'>
|
||||
本{{ timeUnit }}
|
||||
当前
|
||||
</el-button>
|
||||
<el-button
|
||||
style='width: 10px;'
|
||||
@@ -63,21 +65,50 @@
|
||||
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watch,computed, ref,reactive ,onMounted, defineProps, defineEmits } from 'vue';
|
||||
import { ref ,onMounted, defineProps, defineEmits } from 'vue';
|
||||
|
||||
// 定义时间单位的类型
|
||||
interface TimeUnit {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
// 定义组件的props,包含包括和排除的时间单位
|
||||
const props = defineProps({
|
||||
include: {
|
||||
type: Array as () => string[],
|
||||
default: () => ['日', '周', '月', '季度', '年', '自定义'],
|
||||
},
|
||||
exclude: {
|
||||
type: Array as () => string[],
|
||||
default: () => [],
|
||||
},
|
||||
default: {
|
||||
type: String,
|
||||
default: '日',
|
||||
},
|
||||
});
|
||||
|
||||
const timeUnit = ref<string>('日'); // 默认选择按周
|
||||
// 定义事件
|
||||
const emit = defineEmits<{
|
||||
(e: 'update-dates', startDate: Date, endDate: Date): void;
|
||||
}>();
|
||||
const timeUnit = ref<string>(props.default); // 默认选择
|
||||
const startDate = ref<Date>(new Date()); // 起始日期
|
||||
const endDate = ref<Date>(new Date()); // 结束日期
|
||||
const isNextDisabled = ref<boolean>(false); // 控制下一周期按钮的禁用状态
|
||||
const today = ref<Date>(new Date()); // 当前日期
|
||||
const timeUnits = [
|
||||
{ label: '日', value: '日' },
|
||||
{ label: '周', value: '周' },
|
||||
{ label: '月', value: '月' },
|
||||
{ label: '季度', value: '季度' },
|
||||
{ label: '年', value: '年' },
|
||||
{ label: '自定义', value: '自定义' },
|
||||
];
|
||||
// 过滤出可用的时间单位
|
||||
const timeUnits = ref<TimeUnit[]>(
|
||||
props.include.filter(unit => !props.exclude.includes(unit)).map(unit => ({
|
||||
label: unit,
|
||||
value: unit,
|
||||
}))
|
||||
);
|
||||
|
||||
// 发出日期变化事件
|
||||
const emitDateChange = () => {
|
||||
emit('update-dates', startDate.value, endDate.value);
|
||||
};
|
||||
|
||||
// 在组件挂载时更新日期范围
|
||||
onMounted(() => {
|
||||
@@ -92,6 +123,8 @@
|
||||
startDate.value = new Date(new Date().setDate(new Date().getDate() - 1))
|
||||
endDate.value = new Date()
|
||||
}
|
||||
timeUnit.value = unit;
|
||||
emitDateChange(); // 变化时也发出更新事件
|
||||
updateNextButtonStatus()
|
||||
}
|
||||
const updateDateRange = () => {
|
||||
@@ -218,3 +251,4 @@
|
||||
<style scoped lang='scss'>
|
||||
@import "./index.scss";
|
||||
</style>
|
||||
|
||||
|
||||
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