This commit is contained in:
sjl
2024-10-28 08:39:09 +08:00
parent 3af786876e
commit 870bc9c5f5
10 changed files with 252 additions and 242 deletions

View File

@@ -15,6 +15,7 @@ export namespace ErrorSystem {
export interface ErrorSystemDetail { export interface ErrorSystemDetail {
measured: string;//被测量 measured: string;//被测量
deviceLevel: string;//检测装置级别 deviceLevel: string;//检测装置级别
measurementType?: string;//测量类型
condition: string;//测量条件 condition: string;//测量条件
maxErrorValue: string;//最大误差 maxErrorValue: string;//最大误差
} }

View File

@@ -6,7 +6,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'id': '1', 'id': '1',
'name': '检测计划', 'name': '检测计划',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':1, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -17,7 +17,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'id': '2', 'id': '2',
'name': '台账管理', 'name': '台账管理',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':2, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -28,7 +28,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '检测脚本', 'name': '检测脚本',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':21, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -40,7 +40,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '被检设备', 'name': '被检设备',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':22, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -52,7 +52,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '误差体系', 'name': '误差体系',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':23, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -63,7 +63,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '检测源', 'name': '检测源',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':24, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -78,7 +78,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '权限管理', 'name': '权限管理',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':3, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -89,7 +89,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '用户管理', 'name': '用户管理',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':31, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -101,7 +101,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '角色管理', 'name': '角色管理',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':32, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -113,7 +113,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '菜单管理', 'name': '菜单管理',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':33, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -127,7 +127,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '系统配置', 'name': '系统配置',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':4, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -138,7 +138,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '通用配置', 'name': '通用配置',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':41, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -150,7 +150,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '数据字典', 'name': '数据字典',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':42, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -162,7 +162,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '报告模版', 'name': '报告模版',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':43, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -173,7 +173,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '版本注册', 'name': '版本注册',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':44, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -188,7 +188,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '日志管理', 'name': '日志管理',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':5, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -200,7 +200,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '统计分析', 'name': '统计分析',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':6, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',
@@ -212,7 +212,7 @@ const resourcedata = ref<Resource.ResResourceList[]>([
'name': '示例', 'name': '示例',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'sort':7, 'sort':100,
'type':'菜单', 'type':'菜单',
'remark':'检测计划描述', 'remark':'检测计划描述',
'route_Name':'route', 'route_Name':'route',

View File

@@ -22,6 +22,7 @@
v-model='startDate' v-model='startDate'
type='date' type='date'
placeholder='起始时间' placeholder='起始时间'
@change="emitDateChange"
:disabled-date="disableStartDate" :disabled-date="disableStartDate"
:readonly="timeUnit != '自定义'" :readonly="timeUnit != '自定义'"
></el-date-picker> ></el-date-picker>
@@ -31,6 +32,7 @@
v-model='endDate' v-model='endDate'
type='date' type='date'
placeholder='结束时间' placeholder='结束时间'
@change="emitDateChange"
:disabled-date="disableEndDate" :disabled-date="disableEndDate"
:readonly="timeUnit !== '自定义'" :readonly="timeUnit !== '自定义'"
></el-date-picker> ></el-date-picker>
@@ -45,7 +47,7 @@
<div class='left_triangle'></div> <div class='left_triangle'></div>
</el-button> </el-button>
<el-button class='triangle-button' type='primary' @click='goToCurrent'> <el-button class='triangle-button' type='primary' @click='goToCurrent'>
{{ timeUnit }} 当前
</el-button> </el-button>
<el-button <el-button
style='width: 10px;' style='width: 10px;'
@@ -63,21 +65,50 @@
<script setup lang="ts"> <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 startDate = ref<Date>(new Date()); // 起始日期
const endDate = ref<Date>(new Date()); // 结束日期 const endDate = ref<Date>(new Date()); // 结束日期
const isNextDisabled = ref<boolean>(false); // 控制下一周期按钮的禁用状态 const isNextDisabled = ref<boolean>(false); // 控制下一周期按钮的禁用状态
const today = ref<Date>(new Date()); // 当前日期 const today = ref<Date>(new Date()); // 当前日期
const timeUnits = [ // 过滤出可用的时间单位
{ label: '日', value: '日' }, const timeUnits = ref<TimeUnit[]>(
{ label: '周', value: '周' }, props.include.filter(unit => !props.exclude.includes(unit)).map(unit => ({
{ label: '月', value: '月' }, label: unit,
{ label: '季度', value: '季度' }, value: unit,
{ label: '年', value: '年' }, }))
{ label: '自定义', value: '自定义' }, );
];
// 发出日期变化事件
const emitDateChange = () => {
emit('update-dates', startDate.value, endDate.value);
};
// 在组件挂载时更新日期范围 // 在组件挂载时更新日期范围
onMounted(() => { onMounted(() => {
@@ -92,6 +123,8 @@
startDate.value = new Date(new Date().setDate(new Date().getDate() - 1)) startDate.value = new Date(new Date().setDate(new Date().getDate() - 1))
endDate.value = new Date() endDate.value = new Date()
} }
timeUnit.value = unit;
emitDateChange(); // 变化时也发出更新事件
updateNextButtonStatus() updateNextButtonStatus()
} }
const updateDateRange = () => { const updateDateRange = () => {
@@ -218,3 +251,4 @@
<style scoped lang='scss'> <style scoped lang='scss'>
@import "./index.scss"; @import "./index.scss";
</style> </style>

View File

@@ -0,0 +1,13 @@
<template>
<div>
</div>
</template>
<script setup lang="ts">
</script>
<style scoped>
</style>

View File

@@ -65,7 +65,7 @@
const proTable = ref<ProTableInstance>() const proTable = ref<ProTableInstance>()
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<Resource.ResResourceList>[]>([ const columns = reactive<ColumnProps<Resource.ResResourceList>[]>([
{ type: 'selection', fixed: 'left', width: 50 }, { type: 'selection', fixed: 'left', width: 70 },
{ {
prop: 'name', prop: 'name',
label: '名称', label: '名称',
@@ -150,7 +150,7 @@ const openAddDialog = () => {
id: '', id: '',
name: '', name: '',
path: '', path: '',
sort: 0, sort: 100,
type: '', type: '',
remark: '', remark: '',
route_Name: '', route_Name: '',

View File

@@ -9,7 +9,7 @@
> >
<!-- 表格 header 按钮 --> <!-- 表格 header 按钮 -->
<template #tableHeader> <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> <el-button type='primary' :icon='Upload'>导出csv</el-button>
</template> </template>
</ProTable> </ProTable>
@@ -28,17 +28,18 @@ import { reactive,ref } from 'vue'
let multipleSelection = ref<string[]>([]) let multipleSelection = ref<string[]>([])
const logData = logDataList const logData = logDataList
// 定义包含和排除的单位 // 定义包含和排除的单位
const includedUnits = ['日', '周', '月', '季度']; // 可以根据需要包含的单位 const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
const excludedUnits = ['年']; // 要排除的单位 const excludedUnits = ['季度','年']; // 要排除的单位
const defaultUnits = '日'; // 默认的单位
// ProTable 实例 // ProTable 实例
const proTable = ref<ProTableInstance>() const proTable = ref<ProTableInstance>()
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<Log.LogList>[]>([ const columns = reactive<ColumnProps<Log.LogList>[]>([
{ type: 'selection', fixed: 'left', width: 50 }, { type: 'selection', fixed: 'left', width: 70 },
{ {
prop: 'id', prop: 'id',
label: '序号', label: '序号',
width: 100, width: 70,
}, },
{ {
prop: 'user', prop: 'user',
@@ -55,7 +56,11 @@ const columns = reactive<ColumnProps<Log.LogList>[]>([
render: ({ searchParam }) => { render: ({ searchParam }) => {
return ( return (
<div class='flx-flex-start'> <div class='flx-flex-start'>
<TimeControl/> <TimeControl
include={includedUnits}
exclude={excludedUnits}
default={defaultUnits}
/>
</div> </div>
) )
}, },
@@ -85,10 +90,11 @@ const columns = reactive<ColumnProps<Log.LogList>[]>([
// 处理选择变化 // 处理选择变化
const handleSelectionChange = (selection: Log.LogList[]) => { const handleSelectionChange = (selection: Log.LogList[]) => {
multipleSelection.value = selection.map(row => row.id) // 更新选中的行 multipleSelection.value = selection.map(row => row.id) // 更新选中的行
} }
</script> </script>
<style scoped> <style scoped>

View File

@@ -1,73 +1,75 @@
<template> <template>
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogBig"> <el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogBig">
<ProTable <el-table :data="errorData" style="width: 100%" :span-method="spanMethod" border>
ref='proTable' <el-table-column prop="measured" label="被测量" />
:columns='columns' <el-table-column prop="deviceLevel" label="检测装置级别" />
:data='errorData' <el-table-column prop="condition" label="测量条件" />
:tool-button="false" <el-table-column prop="maxErrorValue" label="最大误差" />
/> </el-table>
</el-dialog> </el-dialog>
</template> </template>
<script lang="ts" setup name="IndicatorTypeDialog"> <script lang="ts" setup name="IndicatorTypeDialog">
import { defineProps, defineEmits, reactive,watch,ref } from 'vue'; import { defineProps, defineEmits, reactive,watch,ref,computed } from 'vue';
import { dialogBig} from '@/utils/elementBind' import { dialogBig} from '@/utils/elementBind'
import type { ColumnProps } from '@/components/ProTable/interface' import type { ColumnProps } from '@/components/ProTable/interface'
import type { ErrorSystem } from '@/api/error/interface' import type { ErrorSystem } from '@/api/error/interface'
import errorDataList from '@/api/error/errorData' import errorDataList from '@/api/error/errorData'
const errorData = errorDataList.errordetail const errorData = errorDataList.errordetail
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemDetail>[]>([ const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemDetail>[]>([
{ {
prop: 'measured', prop: 'measured',
label: '被测量', label: '被测量',
}, },
{ {
prop: 'deviceLevel', prop: 'deviceLevel',
label: '检测装置级别', label: '检测装置级别',
}, },
{ {
prop: 'condition', prop: 'condition',
label: '测量条件', label: '测量条件',
}, },
{ {
prop: 'maxErrorValue', prop: 'maxErrorValue',
label: '最大误差', label: '最大误差',
}, },
]) ])
const props = defineProps<{ const props = defineProps<{
visible: boolean; visible: boolean;
dialogTitle: string; 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; </script>
(e: 'submit', data: any): void;
}>();
const handleCancel = () => {
emit('update:visible', false); // 关闭对话框
};
// 当 props.visible 改变时,更新 formData
watch(() => props.visible, (newVal) => {
if (!newVal) {
// 这里可以重置表单数据,如果需要的话
}
});
</script>

View File

@@ -50,29 +50,33 @@
</el-tabs> </el-tabs>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button :icon='CirclePlus' type="primary" @click="openAddDialog">新增</el-button> <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>
<div class="table-container"> <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 type="selection" width="55" />
<el-table-column prop="id" label="序号" width="60" /> <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="起止范围" >
<el-table-column label="起始"> <el-table-column label="起始">
<template #default="{ row }"> <template #default="{ row }">
<el-row type="flex"> <el-row type="flex">
<el-col :span="16"> <el-col :span="14">
<el-select v-model="row.startSelect" placeholder="选择起始值" style="width: 70px;"> <el-select v-model="row.startSelect" placeholder="选择起始值" style="width: 70px;">
<el-option <el-option v-for="option in errorStartOptions" :key="option.value" :label="option.label" :value="option.value"/>
v-for="option in errorStartOptions"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="10">
<span>{{ row.startRange }}</span> <el-input v-model= "row.startRange" style="width: 70px;"
/>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
@@ -80,23 +84,18 @@
<el-table-column label="结束"> <el-table-column label="结束">
<template #default="{ row }"> <template #default="{ row }">
<el-row type="flex" > <el-row type="flex" >
<el-col :span="16"> <el-col :span="14">
<el-select v-model="row.endSelect" placeholder="选择结束值" style="width: 70px;"> <el-select v-model="row.endSelect" placeholder="选择结束值" style="width: 70px;">
<el-option <el-option v-for="option in errorEndOptions" :key="option.value" :label="option.label" :value="option.value"/>
v-for="option in errorEndOptions"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="10">
<span>{{ row.endRange }}</span> <el-input v-model= "row.endRange" style="width: 70px;"/>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单位" width="120"> <el-table-column label="单位" width="115">
<template #default="{ row }"> <template #default="{ row }">
<el-select v-model="row.unit" placeholder="选择单位"> <el-select v-model="row.unit" placeholder="选择单位">
<el-option <el-option
@@ -110,7 +109,11 @@
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="最大误差"> <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="误差类型"> <el-table-column label="误差类型">
<template #default="{ row }"> <template #default="{ row }">
<el-select v-model="row.errorType" placeholder="选择误差类型"> <el-select v-model="row.errorType" placeholder="选择误差类型">
@@ -125,9 +128,9 @@
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150">
<template #default> <template #default="{ row }">
<el-button type="primary" link :icon='CopyDocument'>复制</el-button> <el-button type="primary" link :icon='CopyDocument' @click="copyRow(row)">复制</el-button>
<el-button type='primary' link :icon='Delete' >删除</el-button> <el-button type='primary' link :icon='Delete' @click="deleteRow(row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -141,13 +144,7 @@
</template> </template>
</el-dialog> </el-dialog>
<!-- 新增/编辑资源对话框 -->
<IndicatorTypeDialog
:visible="dialogFormVisible"
:formData="dialogForm"
:dialogTitle="dialogTitle"
@update:visible="dialogFormVisible = $event"
/>
</template> </template>
<script lang="ts" setup name="ErrorSystemDialog"> <script lang="ts" setup name="ErrorSystemDialog">
@@ -168,11 +165,8 @@
state: string; state: string;
}; };
}>(); }>();
const dialogFormVisible = ref(false)
const dialogForm =ref({ let multipleSelection = ref<number[]>([])
type : '',
})
let multipleSelection = ref<string[]>([])
const errorTypeOptions = [ const errorTypeOptions = [
{ label: '绝对值-标称值', value: 'type1' }, { label: '绝对值-标称值', value: 'type1' },
{ label: '相对值-I类', value: 'type2' }, { label: '相对值-I类', value: 'type2' },
@@ -197,17 +191,29 @@ const errorEndOptions = [
{ label: '<=', value: 'type2' }, { label: '<=', value: 'type2' },
{ label: '无', value: 'type3' }, { 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: '电压', type: '电压',
startSelect: 'type1', startSelect: 'type1',
startRange: '0.1', startRange: '0.1',
@@ -218,7 +224,7 @@ const errorEndOptions = [
errorType:'type1' errorType:'type1'
}, },
{ {
id: '2', id: 2,
type: '电流', type: '电流',
startSelect: 'type2', startSelect: 'type2',
startRange: '0.01', startRange: '0.01',
@@ -229,7 +235,7 @@ const errorEndOptions = [
errorType:'type1' errorType:'type1'
}, },
{ {
id: '3', id: 3,
type: '频率', type: '频率',
startSelect: 'type2', startSelect: 'type2',
startRange: '42.5', startRange: '42.5',
@@ -240,7 +246,7 @@ const errorEndOptions = [
errorType:'type4' errorType:'type4'
}, },
] ])
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update:visible', value: boolean): void; (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 = () => { 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> </script>

View File

@@ -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>

View File

@@ -76,11 +76,11 @@ const detail_dialogForm = ref<ErrorSystem.ErrorSystemDetail>({
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemList>[]>([ const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
{ type: 'selection', fixed: 'left', width: 50 }, { type: 'selection', fixed: 'left', width: 70 },
{ {
prop: 'id', prop: 'id',
label: '序号', label: '序号',
width: 100, width: 70,
}, },
{ {
prop: 'name', prop: 'name',