通用配置
This commit is contained in:
@@ -1,26 +1,38 @@
|
|||||||
import type { ReqPage } from '@/api/interface'
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
// 检测脚本模块
|
// 检测脚本模块
|
||||||
export namespace TestScript {
|
export namespace TestScript {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电能质量指标字典数据表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqTestScriptParams extends ReqPage{
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
// 检测脚本接口
|
// 检测脚本接口
|
||||||
export interface TestScriptBO {
|
export interface ResTestScript {
|
||||||
id?: string; //检测脚本ID
|
id?: string; //检测脚本ID
|
||||||
name: string; //检测脚本名称
|
name: string; //检测脚本名称
|
||||||
type: string; //检测脚本类型(字典表Code字段,脚本还是模板)
|
type: string; //检测脚本类型(字典表Code字段,脚本还是模板)
|
||||||
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||||
valueType: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||||
standardName: string;//参照标准名称
|
standardName: string;//参照标准名称
|
||||||
standardTime: string;//标准推行时间
|
standardTime: string;//标准推行时间
|
||||||
state:number;//
|
state:number;//
|
||||||
createBy: string;
|
createBy?: string;
|
||||||
createTime: string;
|
createTime?: string;
|
||||||
updateBy: string;
|
updateBy?: string;
|
||||||
updateTime: string;
|
updateTime?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测脚本+分页
|
/**
|
||||||
export interface ReqTestScriptParams extends ReqPage,TestScriptBO {
|
* 被检设备表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResPqDevPage extends ResPage<ResTestScript> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,25 +2,25 @@ import type { Monitor } from '@/api/device/interface/monitor'
|
|||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name 被检设备管理模块
|
* @name 监测点管理模块
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//获取被检设备
|
//获取监测点
|
||||||
export const getPqMonList = (params: Monitor.ReqPqMonParams) => {
|
export const getPqMonList = (params: Monitor.ReqPqMonParams) => {
|
||||||
return http.post(`/pqMon/list`, params)
|
return http.post(`/pqMon/list`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//添加被检设备
|
//添加监测点
|
||||||
export const addPqMon = (params: Monitor.ResPqMon) => {
|
export const addPqMon = (params: Monitor.ResPqMon) => {
|
||||||
return http.post(`/pqMon/add`, params)
|
return http.post(`/pqMon/add`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//编辑被检设备
|
//编辑监测点
|
||||||
export const updatePqMon = (params: Monitor.ResPqMon) => {
|
export const updatePqMon = (params: Monitor.ResPqMon) => {
|
||||||
return http.post(`/pqMon/update`, params)
|
return http.post(`/pqMon/update`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除被检设备
|
//删除监测点
|
||||||
export const deletePqMon = (params: string[]) => {
|
export const deletePqMon = (params: string[]) => {
|
||||||
return http.post(`/pqMon/delete`, params)
|
return http.post(`/pqMon/delete`, params)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import type { ResPage } from '@/api/interface'
|
|
||||||
import type { TestScript } from '@/api/device/interface/testScript'
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
|
||||||
@@ -6,7 +5,17 @@ import http from '@/api'
|
|||||||
* @name 检测脚本管理模块
|
* @name 检测脚本管理模块
|
||||||
*/
|
*/
|
||||||
// 获取检测脚本列表
|
// 获取检测脚本列表
|
||||||
export const getTestScriptList = (params: TestScript.ReqTestScriptParams) => {
|
export const getPqScriptList = (params: TestScript.ReqTestScriptParams) => {
|
||||||
return http.post<ResPage<TestScript.TestScriptBO>>(`/testScript/list`, params)
|
return http.post(`/pqScript/list`, params)
|
||||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/testScript/list`, params)
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//升级为模版
|
||||||
|
export const updatePqScript = (params: TestScript.ResTestScript) => {
|
||||||
|
return http.get(`/pqScript/upgradeToTemplate?id=${params.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除检测脚本
|
||||||
|
export const deletePqScript = (params: string[]) => {
|
||||||
|
return http.post(`/pqScript/delete`, params)
|
||||||
}
|
}
|
||||||
|
|||||||
17
frontend/src/api/system/base/index.ts
Normal file
17
frontend/src/api/system/base/index.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import http from '@/api'
|
||||||
|
import {type Base} from '@/api/system/base/interface'
|
||||||
|
|
||||||
|
//获取检测配置
|
||||||
|
export const getTestConfig = () => {
|
||||||
|
return http.get(`/sysTestConfig/getConfig`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//编辑检测配置
|
||||||
|
export const updateTestConfig = (params: Base.ResTestConfig) => {
|
||||||
|
return http.post(`/sysTestConfig/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
19
frontend/src/api/system/base/interface/index.ts
Normal file
19
frontend/src/api/system/base/interface/index.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// 检测配置表模块
|
||||||
|
export namespace Base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测配置表查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResTestConfig {
|
||||||
|
id: string; //系统配置表Id
|
||||||
|
autoGenerate:number;//检测报告是否自动生成0 否;1是
|
||||||
|
maxTime:number;//最大复检次数,默认3次
|
||||||
|
dataRule:string;//数据处理原则,关联字典(所有值、部分值、cp95值、平均值、任意值),默认任意值
|
||||||
|
state: number; //状态
|
||||||
|
createBy?: string| null; //创建用户
|
||||||
|
createTime?: string| null; //创建时间
|
||||||
|
updateBy?: string| null; //更新用户
|
||||||
|
updateTime?: string| null; //更新时间
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
13
frontend/src/api/system/versionRegister/index.ts
Normal file
13
frontend/src/api/system/versionRegister/index.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import http from '@/api'
|
||||||
|
import {type VersionRegister} from '@/api/system/versionRegister/interface'
|
||||||
|
|
||||||
|
//获取有效数据配置
|
||||||
|
export const getRegRes = (params: VersionRegister.ResSys_Reg_Res) => {
|
||||||
|
return http.get(`/sysRegRes/getRegResByType?id=${params.type}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//编辑有效数据配置
|
||||||
|
export const updateRegRes = (params: VersionRegister.Sys_Reg_Res) => {
|
||||||
|
return http.post(`/sysRegRes/update`, params)
|
||||||
|
}
|
||||||
31
frontend/src/api/system/versionRegister/interface/index.ts
Normal file
31
frontend/src/api/system/versionRegister/interface/index.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// 检测配置表模块
|
||||||
|
export namespace VersionRegister {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测配置表查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResSys_Reg_Res {
|
||||||
|
id: string; //版本注册表Id
|
||||||
|
type: string; //版本类型(模拟式、数字式、比对式)
|
||||||
|
code: string; //注册码
|
||||||
|
licenseKey: string; //密钥
|
||||||
|
expireDate: string; //到期时间
|
||||||
|
waveRecord?: number;
|
||||||
|
realTime?: number;
|
||||||
|
statistics?: number;
|
||||||
|
flicker?: number;
|
||||||
|
state: number; //状态
|
||||||
|
createBy?: string| null; //创建用户
|
||||||
|
createTime?: string| null; //创建时间
|
||||||
|
updateBy?: string| null; //更新用户
|
||||||
|
updateTime?: string| null; //更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Sys_Reg_Res {
|
||||||
|
id: string;
|
||||||
|
waveRecord?: number;
|
||||||
|
realTime?: number;
|
||||||
|
statistics?: number;
|
||||||
|
flicker?: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,25 +3,23 @@
|
|||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:request-api="getTableList"
|
:request-api="getPqScriptList"
|
||||||
:init-param="initParam"
|
|
||||||
:data-callback="dataCallback"
|
|
||||||
>
|
>
|
||||||
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' :icon='CirclePlus' >新增</el-button>
|
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
<el-button type='primary' :icon='Download' plain >导出数据</el-button>
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
批量删除
|
批量删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
<el-button type='primary' link :icon='EditPen' >编辑</el-button>
|
<el-button type='primary' link :icon='EditPen' :model-value="false" @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||||
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||||
<el-button type='primary' :model-value="false" link :icon='Upload' >升级为模板</el-button>
|
<el-button type='primary' v-if="scope.row.type !== 1" link :icon='Share' @click='updateType(scope.row)'>升级</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
@@ -35,11 +33,12 @@ import { useDownload } from '@/hooks/useDownload'
|
|||||||
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import type{ ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
import type{ ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, EditPen, Share } from '@element-plus/icons-vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import {
|
import {
|
||||||
getTestScriptList,
|
getPqScriptList,updatePqScript,deletePqScript,
|
||||||
} from '@/api/device/testScript/index'
|
} from '@/api/device/testScript/index'
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
@@ -47,41 +46,17 @@ const dictStore = useDictStore()
|
|||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
const templateTypes = reactive([
|
||||||
const initParam = reactive({ pattern: 1 })//表示当前用户选择的是模拟式测试,后期要读取pinia中的数据 TODO...
|
{ id: 0, name: '脚本' },
|
||||||
|
{ id: 1, name: '模版' }
|
||||||
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
]);
|
||||||
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
|
||||||
const dataCallback = (data: any) => {
|
|
||||||
return {
|
|
||||||
list: data.list,
|
|
||||||
total: data.total,
|
|
||||||
pageNum: data.pageNum,
|
|
||||||
pageSize: data.pageSize,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
|
|
||||||
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
|
||||||
const getTableList = (params: any) => {
|
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
|
||||||
newParams.createTime && (newParams.startTime = newParams.createTime[0])
|
|
||||||
newParams.createTime && (newParams.endTime = newParams.createTime[1])
|
|
||||||
delete newParams.createTime
|
|
||||||
return getTestScriptList(newParams)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
|
||||||
const { BUTTONS } = useAuthButtons()
|
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<TestScript.TestScriptBO>[]>([
|
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
search: { el: 'input' },
|
|
||||||
minWidth: 350,
|
minWidth: 350,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -97,21 +72,51 @@ const columns = reactive<ColumnProps<TestScript.TestScriptBO>[]>([
|
|||||||
{
|
{
|
||||||
prop: 'valueType',
|
prop: 'valueType',
|
||||||
label: '值类型',
|
label: '值类型',
|
||||||
enum: dictStore.getDictData('testScriptValueType'),
|
enum: dictStore.getDictData('Script_Value_Type'),
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
search: { el: 'select' },
|
search: { el: 'select' },
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'type',
|
prop: 'type',
|
||||||
label: '模板类型',
|
label: '模板类型',
|
||||||
enum: dictStore.getDictData('testScriptType'),
|
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
|
||||||
search: { el: 'select' },
|
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
|
render: scope => {
|
||||||
|
return (
|
||||||
|
<el-tag type={scope.row.type ? 'success' : 'primary'} > {scope.row.type ? '模版' : '脚本'} </el-tag>
|
||||||
|
)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 打开 drawer(新增、编辑)
|
||||||
|
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 批量删除设备
|
||||||
|
const batchDelete = async (id: string[]) => {
|
||||||
|
await useHandleData(deletePqScript, id, '删除所选脚本')
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除设备
|
||||||
|
const handleDelete = async (params: TestScript.ResTestScript) => {
|
||||||
|
await useHandleData(deletePqScript, [params.id], `删除【${params.name}】脚本`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 升级为模版
|
||||||
|
const updateType = async (params: TestScript.ResTestScript) => {
|
||||||
|
await useHandleData(updatePqScript, params, `升级【${params.name}】为模版`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
158
frontend/src/views/system/base/index.vue
Normal file
158
frontend/src/views/system/base/index.vue
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
<template>
|
||||||
|
<div class='table-box' >
|
||||||
|
<el-tabs type="border-card">
|
||||||
|
<el-tab-pane label="检测相关配置">
|
||||||
|
<div class="form-grid">
|
||||||
|
<el-divider >检测配置</el-divider>
|
||||||
|
<el-row :gutter="24" >
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label='一键检测方式' prop='autoGenerate' :label-width="100">
|
||||||
|
<el-select v-model="TestConfigForm.autoGenerate" clearable placeholder="请选择一键检测方式" >
|
||||||
|
<el-option label="只检测,报告后续手动生成" :value="0"></el-option>
|
||||||
|
<el-option label="检测和生成报告同时进行" :value="1"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label='复检最大次数' prop='maxTime' :label-width="100">
|
||||||
|
<el-input-number v-model='TestConfigForm.maxTime' :min='1' :max='999' />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label='数据处理原则' prop='dataRule' :label-width="100">
|
||||||
|
<el-select v-model="TestConfigForm.dataRule" clearable placeholder="请选择数据处理原则" >
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Data_Rule')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
<el-divider >有效数据配置</el-divider>
|
||||||
|
<el-row :gutter="24" >
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="录波数据有效组数" prop="waveRecord" :label-width="125">
|
||||||
|
<el-input v-model.number='RegResForm.waveRecord' placeholder="/" disabled/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="实时数据有效组数" prop="realTime" :label-width="125">
|
||||||
|
<el-input number v-model.number='RegResForm.realTime' placeholder="请输入实时数据有效组数"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="统计数据有效组数" prop="statistics" :label-width="125">
|
||||||
|
<el-input number v-model.number='RegResForm.statistics' placeholder="请输入统计数据有效组数"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="闪变数据有效组数" prop="flicker" :label-width="125">
|
||||||
|
<el-input number v-model.number='RegResForm.flicker' placeholder="请输入闪变数据有效组数"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm()">保存配置</el-button>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="日志配置">
|
||||||
|
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="数据删除备份配置">
|
||||||
|
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx''>
|
||||||
|
import { type Dict } from '@/api/system/dictionary/interface'
|
||||||
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
|
import {type Base } from '@/api/system/base/interface'
|
||||||
|
import {type VersionRegister } from '@/api/system/versionRegister/interface'
|
||||||
|
import {getTestConfig,updateTestConfig } from '@/api/system/base/index'
|
||||||
|
import {getRegRes,updateRegRes } from '@/api/system/versionRegister/index'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { el } from 'element-plus/es/locale'
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const TestConfigForm = ref<Base.ResTestConfig>({
|
||||||
|
id: '',
|
||||||
|
autoGenerate: 0,
|
||||||
|
maxTime: 3,
|
||||||
|
dataRule: '',
|
||||||
|
state: 1, //状态
|
||||||
|
})
|
||||||
|
|
||||||
|
const RegResForm = ref<VersionRegister.ResSys_Reg_Res>({
|
||||||
|
id: '', //版本注册表Id
|
||||||
|
type: '', //版本类型(模拟式、数字式、比对式)
|
||||||
|
code: '', //注册码
|
||||||
|
licenseKey: '', //密钥
|
||||||
|
expireDate: '', //到期时间
|
||||||
|
waveRecord: 0,
|
||||||
|
realTime: 20,
|
||||||
|
statistics: 5,
|
||||||
|
flicker: 1,
|
||||||
|
state: 1, //状态
|
||||||
|
})
|
||||||
|
|
||||||
|
const RegResForm2 = ref<VersionRegister.Sys_Reg_Res>({
|
||||||
|
waveRecord: 0,
|
||||||
|
realTime: 20,
|
||||||
|
statistics: 5,
|
||||||
|
flicker: 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const TestConfigList = ref<Base.ResTestConfig>()
|
||||||
|
const RegResList = ref<VersionRegister.ResSys_Reg_Res>()
|
||||||
|
// 初始化时获取
|
||||||
|
onMounted(async () => {
|
||||||
|
const response = await getTestConfig()
|
||||||
|
TestConfigForm.value = response.data as unknown as Base.ResTestConfig
|
||||||
|
|
||||||
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name==='模拟式')?.id
|
||||||
|
RegResForm.value.type = patternId || '';
|
||||||
|
const response2 = await getRegRes(RegResForm.value)
|
||||||
|
RegResForm.value = response2.data as unknown as VersionRegister.ResSys_Reg_Res
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
const submitForm = async () => {
|
||||||
|
try {
|
||||||
|
if (TestConfigForm.value.id) {
|
||||||
|
await updateTestConfig(TestConfigForm.value);
|
||||||
|
|
||||||
|
// 提取并传递 4 个参数
|
||||||
|
const { id,waveRecord, realTime, statistics, flicker } = RegResForm.value
|
||||||
|
RegResForm2.value = { id,waveRecord, realTime, statistics, flicker }
|
||||||
|
|
||||||
|
if(RegResForm.value.waveRecord == null){
|
||||||
|
RegResForm2.value.waveRecord = -1
|
||||||
|
}
|
||||||
|
await updateRegRes(RegResForm2.value);
|
||||||
|
|
||||||
|
ElMessage.success({ message: `保存配置成功!` })
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.dialog-footer {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
0
frontend/src/views/system/versionRegister/index.ts
Normal file
0
frontend/src/views/system/versionRegister/index.ts
Normal file
Reference in New Issue
Block a user