物模型:新增字段 是否可见visbile 数据类型dataType
This commit is contained in:
parent
a0f22756d3
commit
cd3bc0a045
@ -6,12 +6,13 @@ VITE_BASE_PATH = './'
|
|||||||
|
|
||||||
# 代理配置(开发使用),必须在一行中
|
# 代理配置(开发使用),必须在一行中
|
||||||
# 本地
|
# 本地
|
||||||
# VITE_APP_PROXY=[["/api","http://10.65.57.55:8080/api"]]
|
# VITE_APP_PROXY=[["/api","http://192.168.130.12:8080/api"]]
|
||||||
# 线上
|
# 线上
|
||||||
VITE_APP_PROXY=[["/api","https://test.jsspisoft.com/api"]]
|
VITE_APP_PROXY=[["/api","https://test.jsspisoft.com/api"]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 开发环境下跨域代理,请输入要跨域的api地址 - 尾部无需带'/'
|
# 开发环境下跨域代理,请输入要跨域的api地址 - 尾部无需带'/'
|
||||||
# VITE_PROXY_URL = 'http://localhost:8000'
|
# VITE_PROXY_URL = 'http://localhost:8000'
|
||||||
VITE_AXIOS_BASE_URL = 'http://localhost:1818'
|
VITE_AXIOS_BASE_URL = 'http://localhost:1818'
|
||||||
|
@ -185,13 +185,28 @@
|
|||||||
<el-form-item :label="ModelAttributeFieldsEnums['attributeCode']" prop="attributeCode">
|
<el-form-item :label="ModelAttributeFieldsEnums['attributeCode']" prop="attributeCode">
|
||||||
<el-input v-model="attributeForm.attributeCode" :placeholder="'请输入' + ModelAttributeFieldsEnums['attributeCode']"></el-input>
|
<el-input v-model="attributeForm.attributeCode" :placeholder="'请输入' + ModelAttributeFieldsEnums['attributeCode']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<div class="formRowStyle">
|
||||||
<el-form-item :label="ModelAttributeFieldsEnums['attributeTypeName']" prop="attributeType">
|
<el-form-item :label="ModelAttributeFieldsEnums['attributeTypeName']" prop="attributeType">
|
||||||
<el-select v-model="attributeForm.attributeType" :placeholder="'请选择' + ModelAttributeFieldsEnums['attributeTypeName']">
|
<el-select
|
||||||
|
v-model="attributeForm.attributeType"
|
||||||
|
:placeholder="'请选择' + ModelAttributeFieldsEnums['attributeTypeName']"
|
||||||
|
@change="attributeTypeChange"
|
||||||
|
>
|
||||||
<el-option label="模拟量" :value="138"></el-option>
|
<el-option label="模拟量" :value="138"></el-option>
|
||||||
<el-option label="累积量" :value="139"></el-option>
|
<el-option label="累积量" :value="139"></el-option>
|
||||||
<el-option label="离散量" :value="140"></el-option>
|
<el-option label="离散量" :value="140"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="ModelAttributeFieldsEnums['dataType']" prop="dataType">
|
||||||
|
<el-select
|
||||||
|
:disabled="!attributeForm.attributeType || attributeForm.attributeType === 140"
|
||||||
|
v-model="attributeForm.dataType"
|
||||||
|
:placeholder="'请选择' + ModelAttributeFieldsEnums['dataType']"
|
||||||
|
>
|
||||||
|
<el-option v-for="v in attributeFormDataTypeOptions" :key="v.value" :label="v.value" :value="v.value"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
|
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
|
||||||
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
|
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -201,6 +216,9 @@
|
|||||||
<el-form-item :label="ModelAttributeFieldsEnums['highSpeed']" prop="highSpeed">
|
<el-form-item :label="ModelAttributeFieldsEnums['highSpeed']" prop="highSpeed">
|
||||||
<el-checkbox v-model="attributeForm.highSpeed"></el-checkbox>
|
<el-checkbox v-model="attributeForm.highSpeed"></el-checkbox>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="ModelAttributeFieldsEnums['visible']" prop="visible">
|
||||||
|
<el-checkbox v-model="attributeForm.visible"></el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button type="primary" @click="submitAttributeForm">提交</el-button>
|
<el-button type="primary" @click="submitAttributeForm">提交</el-button>
|
||||||
@ -278,7 +296,9 @@ import {
|
|||||||
ModelAttributeTableType,
|
ModelAttributeTableType,
|
||||||
ModelServiceTableType,
|
ModelServiceTableType,
|
||||||
ModelServiceFieldsEnums,
|
ModelServiceFieldsEnums,
|
||||||
|
ModelAttributeType,
|
||||||
AttributeDialogTitleStateType,
|
AttributeDialogTitleStateType,
|
||||||
|
attributeTypeDataType,
|
||||||
serviceDialogTitleStateType,
|
serviceDialogTitleStateType,
|
||||||
GetModelServiceType,
|
GetModelServiceType,
|
||||||
GetModelAttributeType,
|
GetModelAttributeType,
|
||||||
@ -533,6 +553,7 @@ const getAttributeList = (type?: radioGroupType, value?: string) => {
|
|||||||
? '离散量'
|
? '离散量'
|
||||||
: item.attributeType!,
|
: item.attributeType!,
|
||||||
highSpeed: item.highSpeed === 1,
|
highSpeed: item.highSpeed === 1,
|
||||||
|
visible: item.visible === 1,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
pageTotal.value = res.total
|
pageTotal.value = res.total
|
||||||
@ -607,6 +628,12 @@ const delServiceForm = (data: AddModelServiceType & UpdateModelServiceType) => {
|
|||||||
|
|
||||||
const attributeVisible = ref(false)
|
const attributeVisible = ref(false)
|
||||||
const attributeFormTitle = ref(AttributeDialogTitleStateType['add'])
|
const attributeFormTitle = ref(AttributeDialogTitleStateType['add'])
|
||||||
|
const attributeFormDataTypeOptions: { value: attributeTypeDataType }[] = [
|
||||||
|
{ value: 'int4' },
|
||||||
|
{ value: 'int8' },
|
||||||
|
{ value: 'float4' },
|
||||||
|
{ value: 'float8' },
|
||||||
|
]
|
||||||
const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
||||||
id: null,
|
id: null,
|
||||||
iotModelId: '',
|
iotModelId: '',
|
||||||
@ -615,7 +642,9 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
|||||||
attributeType: null,
|
attributeType: null,
|
||||||
porder: null,
|
porder: null,
|
||||||
highSpeed: false,
|
highSpeed: false,
|
||||||
subsystem:'',
|
subsystem: '',
|
||||||
|
dataType: '',
|
||||||
|
visible: true,
|
||||||
revision: 1,
|
revision: 1,
|
||||||
createdBy: undefined,
|
createdBy: undefined,
|
||||||
createdTime: undefined,
|
createdTime: undefined,
|
||||||
@ -625,6 +654,12 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
|||||||
const attributeFormRef = ref<FormInstance>()
|
const attributeFormRef = ref<FormInstance>()
|
||||||
const attributeForm = ref<AddModelAttributeType & UpdateModelAttributeType>(JSON.parse(JSON.stringify(originAttributeForm)))
|
const attributeForm = ref<AddModelAttributeType & UpdateModelAttributeType>(JSON.parse(JSON.stringify(originAttributeForm)))
|
||||||
|
|
||||||
|
const attributeTypeChange = (value: ModelAttributeType) => {
|
||||||
|
if (value === 140) {
|
||||||
|
attributeForm.value.dataType = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const closeAttributeForm = () => {
|
const closeAttributeForm = () => {
|
||||||
attributeVisible.value = false
|
attributeVisible.value = false
|
||||||
attributeForm.value = JSON.parse(JSON.stringify(originAttributeForm))
|
attributeForm.value = JSON.parse(JSON.stringify(originAttributeForm))
|
||||||
@ -633,11 +668,12 @@ const closeAttributeForm = () => {
|
|||||||
const submitAttributeForm = () => {
|
const submitAttributeForm = () => {
|
||||||
attributeFormRef.value?.validate((valid: boolean) => {
|
attributeFormRef.value?.validate((valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
const copyFormData = JSON.parse(JSON.stringify(attributeForm.value))
|
||||||
|
copyFormData.highSpeed = copyFormData.highSpeed ? 1 : 0
|
||||||
|
copyFormData.visible = copyFormData.visible ? 1 : 0
|
||||||
if (attributeFormTitle.value === AttributeDialogTitleStateType['add']) {
|
if (attributeFormTitle.value === AttributeDialogTitleStateType['add']) {
|
||||||
const addFormData = JSON.parse(JSON.stringify(attributeForm.value))
|
copyFormData.iotModelId = curContextMenuTreeData.value!.id!
|
||||||
addFormData.iotModelId = curContextMenuTreeData.value!.id!
|
addModelAttributeReq(copyFormData)
|
||||||
addFormData.highSpeed = addFormData.highSpeed ? 1 : 0
|
|
||||||
addModelAttributeReq(addFormData)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
ElMessage.success('新增物模型属性成功')
|
ElMessage.success('新增物模型属性成功')
|
||||||
@ -651,9 +687,7 @@ const submitAttributeForm = () => {
|
|||||||
ElMessage.error(err?.response?.data?.msg ?? '新增失败')
|
ElMessage.error(err?.response?.data?.msg ?? '新增失败')
|
||||||
})
|
})
|
||||||
} else if (attributeFormTitle.value === AttributeDialogTitleStateType['edit']) {
|
} else if (attributeFormTitle.value === AttributeDialogTitleStateType['edit']) {
|
||||||
const updateForm = JSON.parse(JSON.stringify(attributeForm.value))
|
updateModelAttributeReq(copyFormData)
|
||||||
updateForm.highSpeed = updateForm.highSpeed ? 1 : 0
|
|
||||||
updateModelAttributeReq(updateForm)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
ElMessage.success('修改物模型属性成功')
|
ElMessage.success('修改物模型属性成功')
|
||||||
@ -964,4 +998,10 @@ $paginationHeight: 32px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.formRowStyle {
|
||||||
|
display: flex;
|
||||||
|
.el-select {
|
||||||
|
width: 184px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -62,8 +62,10 @@ export enum ModelAttributeFieldsEnums {
|
|||||||
'attributeType' = '属性类型value',
|
'attributeType' = '属性类型value',
|
||||||
'attributeTypeName' = '属性类型',
|
'attributeTypeName' = '属性类型',
|
||||||
'porder' = '序号',
|
'porder' = '序号',
|
||||||
'highSpeed'='是否高频',
|
'highSpeed' = '是否高频',
|
||||||
'subsystem'='子系统',
|
'subsystem' = '子系统',
|
||||||
|
'dataType' = '数据类型',
|
||||||
|
'visible'='是否可见',
|
||||||
'revision' = '乐观锁',
|
'revision' = '乐观锁',
|
||||||
'createdBy' = '创建人',
|
'createdBy' = '创建人',
|
||||||
'createdTime' = '创建时间',
|
'createdTime' = '创建时间',
|
||||||
@ -94,14 +96,17 @@ export type GetModelAttributeType = {
|
|||||||
pageNum: number
|
pageNum: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type attributeTypeDataType = 'int4' | 'int8' | 'float4' | 'float8'
|
||||||
export type AddModelAttributeType = {
|
export type AddModelAttributeType = {
|
||||||
iotModelId: string
|
iotModelId: string
|
||||||
attributeCode: string
|
attributeCode: string
|
||||||
attributeName: string
|
attributeName: string
|
||||||
attributeType: ModelAttributeType | null
|
attributeType: ModelAttributeType | null
|
||||||
porder: number | null
|
porder: number | null
|
||||||
highSpeed:0|1|boolean
|
highSpeed: 0 | 1 | boolean
|
||||||
subsystem:string
|
subsystem: string
|
||||||
|
dataType: ''
|
||||||
|
visible: 0 | 1 | boolean
|
||||||
revision: number
|
revision: number
|
||||||
createdBy?: string
|
createdBy?: string
|
||||||
createdTime?: string
|
createdTime?: string
|
||||||
|
Loading…
Reference in New Issue
Block a user