parent
f61630df8f
commit
c3195997a0
|
@ -60,7 +60,7 @@ const formItemContext = Form.useInjectFormItemContext()
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [{}]
|
default: () => []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,12 @@
|
||||||
placeholder="请输入字符串长度" :precision="0" :controls="false" :maxlength="64" :disabled="disabled" />
|
placeholder="请输入字符串长度" :precision="0" :controls="false" :maxlength="64" :disabled="disabled" />
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
|
|
||||||
<j-form-item v-if="form.configuration.type == 'Bool'" label="位偏移量(bit)" :name="['configuration', 'bits']" :rules="{
|
<j-form-item v-if="form.configuration.type == 'Bool'" label="位偏移量(bit)" :name="['configuration', 'bits']"
|
||||||
required: true,
|
:rules="{
|
||||||
message: '请输入0~7之间的正整数',
|
required: true,
|
||||||
trigger: 'blur',
|
message: '请输入0~7之间的正整数',
|
||||||
}">
|
trigger: 'blur',
|
||||||
|
}">
|
||||||
<j-input-number type="number" style="width: 100%" addon-after="位" v-model:value="form.configuration.bits"
|
<j-input-number type="number" style="width: 100%" addon-after="位" v-model:value="form.configuration.bits"
|
||||||
placeholder="请输入位偏移量" :precision="0" :min="0" :max="7" :controls="false" :maxlength="2" />
|
placeholder="请输入位偏移量" :precision="0" :min="0" :max="7" :controls="false" :maxlength="2" />
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
|
@ -116,6 +117,9 @@
|
||||||
<j-checkbox value="changedOnly">只推送变化的数据</j-checkbox>
|
<j-checkbox value="changedOnly">只推送变化的数据</j-checkbox>
|
||||||
</j-checkbox-group>
|
</j-checkbox-group>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
|
<j-form-item label="说明" name="description">
|
||||||
|
<j-textarea placeholder="请输入说明" v-model:value="form.description" :maxlength="200" :rows="3" showCount />
|
||||||
|
</j-form-item>
|
||||||
</j-form>
|
</j-form>
|
||||||
<j-modal title="采集频率" :visible="intervalRef.visible" @cancel="handleCancelInterval" @ok="handleInterval">
|
<j-modal title="采集频率" :visible="intervalRef.visible" @cancel="handleCancelInterval" @ok="handleInterval">
|
||||||
<j-form ref="formRef2" name="virtual-form" layout="vertical" :model="intervalRef">
|
<j-form ref="formRef2" name="virtual-form" layout="vertical" :model="intervalRef">
|
||||||
|
@ -127,6 +131,7 @@
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</j-form>
|
</j-form>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<j-button key="back" @click="handleCancel">取消</j-button>
|
<j-button key="back" @click="handleCancel">取消</j-button>
|
||||||
<PermissionButton key="submit" type="primary" :loading="loading" @click="handleOk" style="margin-left: 8px"
|
<PermissionButton key="submit" type="primary" :loading="loading" @click="handleOk" style="margin-left: 8px"
|
||||||
|
@ -189,7 +194,7 @@ const form = ref<any>({
|
||||||
type: undefined,
|
type: undefined,
|
||||||
interval: 3000,
|
interval: 3000,
|
||||||
areaNumber: undefined,
|
areaNumber: undefined,
|
||||||
bytes:undefined,
|
bytes: undefined,
|
||||||
terms: []
|
terms: []
|
||||||
},
|
},
|
||||||
accessModes: [],
|
accessModes: [],
|
||||||
|
@ -268,19 +273,19 @@ const handleCancelInterval = () => {
|
||||||
|
|
||||||
|
|
||||||
const handleOk = async () => {
|
const handleOk = async () => {
|
||||||
const res:any = await formRef.value?.validate();
|
const res: any = await formRef.value?.validate();
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
...res,
|
...res,
|
||||||
configuration:{
|
configuration: {
|
||||||
...res.configuration,
|
...res.configuration,
|
||||||
bytes:res.configuration.bytes || form.value.configuration.bytes
|
bytes: res.configuration.bytes || form.value.configuration.bytes
|
||||||
},
|
},
|
||||||
inheritBreaker: true,
|
inheritBreaker: true,
|
||||||
pointKey: props.data.pointKey || randomString(9),
|
pointKey: props.data.pointKey || randomString(9),
|
||||||
provider:props.data.provider,
|
provider: props.data.provider,
|
||||||
collectorId:props.data.collectorId,
|
collectorId: props.data.collectorId,
|
||||||
accessModes:res?.accessModes.filter((item:any)=>item)
|
accessModes: res?.accessModes.filter((item: any) => item)
|
||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const response = !props.data.id
|
const response = !props.data.id
|
||||||
|
@ -296,13 +301,15 @@ const handleCancel = () => {
|
||||||
|
|
||||||
const Area = (_: any, value: any): Promise<any> =>
|
const Area = (_: any, value: any): Promise<any> =>
|
||||||
new Promise(async (resolve, reject) => {
|
new Promise(async (resolve, reject) => {
|
||||||
console.log('value',value)
|
if (!value) {
|
||||||
if(value.length === 0){
|
|
||||||
return resolve('')
|
return resolve('')
|
||||||
}else if(value.length === 1){
|
}
|
||||||
|
if (value?.length === 0) {
|
||||||
|
return resolve('')
|
||||||
|
} else if (value?.length === 1) {
|
||||||
return value[0].value && value[0].termType ? resolve('') : reject('请配置点位死区');
|
return value[0].value && value[0].termType ? resolve('') : reject('请配置点位死区');
|
||||||
}else{
|
} else {
|
||||||
if(value[0].column === 'currentValue'){
|
if (value?.[0].column === 'currentValue') {
|
||||||
// value.forEach((item:any) => {
|
// value.forEach((item:any) => {
|
||||||
// if(item.termType && item.value){
|
// if(item.termType && item.value){
|
||||||
// return resolve('')
|
// return resolve('')
|
||||||
|
@ -310,52 +317,54 @@ const Area = (_: any, value: any): Promise<any> =>
|
||||||
// return reject('请配置点位死区')
|
// return reject('请配置点位死区')
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
const pass = value.every((item:any)=>item.termType && item.value)
|
const pass = value.every((item: any) => item.termType && item.value)
|
||||||
return pass ? resolve(''):reject('请配置点位死区')
|
return pass ? resolve('') : reject('请配置点位死区')
|
||||||
}else{
|
} else {
|
||||||
value.forEach((item:any) => {
|
value.forEach((item: any) => {
|
||||||
if(item.column ===`this['currentValue'] - this['lastValue']*init/100`){
|
if (item.column === `this['currentValue'] - this['lastValue']*init/100`) {
|
||||||
return reject('请配置点位死区')
|
return reject('请配置点位死区')
|
||||||
}else{
|
} else {
|
||||||
return resolve('')
|
return resolve('')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
form.value.features = props.data.features?.map((item:any)=>item.value)
|
form.value.features = props.data.features?.map((item: any) => item.value)
|
||||||
form.value.configuration.bytes = props.data.configuration?.bytes
|
form.value.configuration.bytes = props.data.configuration?.bytes
|
||||||
if(props.data.accessModes?.length!==0){
|
if (props.data.accessModes?.length !== 0) {
|
||||||
form.value.accessModes = props.data.accessModes?.map((item:any)=>item.value)
|
form.value.accessModes = props.data.accessModes?.map((item: any) => item.value)
|
||||||
}
|
}
|
||||||
|
console.log(props.data.configuration, 123)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => dataTypesList.value,
|
() => dataTypesList.value,
|
||||||
(val: any[]) => {
|
(val: any[]) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
const result: any = dataTypesList.value.find(
|
const result: any = dataTypesList.value.find(
|
||||||
(item: any) => item.id == form.value.configuration.type,
|
(item: any) => item.id == form.value.configuration.type,
|
||||||
);
|
);
|
||||||
if(result) {
|
if (result) {
|
||||||
// console.log('result',result)
|
// console.log('result',result)
|
||||||
disabled.value = (result && result.length !== 0);
|
disabled.value = (result && result.length !== 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => form.value.configuration.type,
|
() => form.value.configuration.type,
|
||||||
(val) => {
|
(val) => {
|
||||||
if (val !== 'Bool') {
|
if (val !== 'Bool') {
|
||||||
form.value.configuration.bits = 0;
|
form.value.configuration.bits = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true },
|
{ deep: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -18,16 +18,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="importing-status" v-if="importStatus == 'importing'">
|
<div class="importing-status" v-if="importStatus == 'importing'">
|
||||||
<loading-outlined />
|
<AIcon type="LoadingOutlined" />
|
||||||
正在导入
|
正在导入
|
||||||
</div>
|
</div>
|
||||||
<div class="column" v-if="importStatus != 'wait'">
|
<div class="column" v-if="importStatus != 'wait'">
|
||||||
<p>
|
<p>
|
||||||
<check-outlined style="color: #00a4ff" />导入成功 总数量
|
<AIcon style="color: #00a4ff" type="CheckOutlined"/>导入成功 总数量
|
||||||
{{ successNumber }}
|
{{ successNumber }}
|
||||||
</p>
|
</p>
|
||||||
<span v-if="failNumber">
|
<span v-if="failNumber">
|
||||||
<close-outlined style="color: #e50012" />导入失败 总数量
|
<AIcon style="color: #e50012" type="CloseOutlined"/>导入失败 总数量
|
||||||
{{ failNumber }}
|
{{ failNumber }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,12 +44,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {
|
|
||||||
ArrowLeftOutlined,
|
|
||||||
CheckOutlined,
|
|
||||||
CloseOutlined,
|
|
||||||
LoadingOutlined,
|
|
||||||
} from '@ant-design/icons-vue';
|
|
||||||
import { FILE_UPLOAD } from '@/api/comm';
|
import { FILE_UPLOAD } from '@/api/comm';
|
||||||
import { TOKEN_KEY, BASE_API_PATH } from '@/utils/variable';
|
import { TOKEN_KEY, BASE_API_PATH } from '@/utils/variable';
|
||||||
import { LocalStore, onlyMessage } from '@/utils/comm';
|
import { LocalStore, onlyMessage } from '@/utils/comm';
|
||||||
|
|
Loading…
Reference in New Issue