优化设备管理
This commit is contained in:
parent
f4532070ae
commit
a894b1d510
@ -127,7 +127,7 @@ async function submit() {
|
|||||||
// 根据平台类型处理数据
|
// 根据平台类型处理数据
|
||||||
let processedFormValues = { ...formValues };
|
let processedFormValues = { ...formValues };
|
||||||
|
|
||||||
if (formValues.ioTPlatform === '1') {
|
if (formValues.ioTPlatform === '2') {
|
||||||
// OneNET平台
|
// OneNET平台
|
||||||
processedFormValues.ioTPlatformAccountId = formValues.oneNETAccountId;
|
processedFormValues.ioTPlatformAccountId = formValues.oneNETAccountId;
|
||||||
processedFormValues.ioTPlatformProductId = formValues.oneNETProductId;
|
processedFormValues.ioTPlatformProductId = formValues.oneNETProductId;
|
||||||
@ -136,7 +136,7 @@ async function submit() {
|
|||||||
delete processedFormValues.oneNETProductId;
|
delete processedFormValues.oneNETProductId;
|
||||||
delete processedFormValues.ctWingAccountId;
|
delete processedFormValues.ctWingAccountId;
|
||||||
delete processedFormValues.ctWingProductId;
|
delete processedFormValues.ctWingProductId;
|
||||||
} else if (formValues.ioTPlatform === '2') {
|
} else if (formValues.ioTPlatform === '1') {
|
||||||
// CTWing平台
|
// CTWing平台
|
||||||
processedFormValues.ioTPlatformAccountId = formValues.ctWingAccountId;
|
processedFormValues.ioTPlatformAccountId = formValues.ctWingAccountId;
|
||||||
processedFormValues.ioTPlatformProductId = formValues.ctWingProductId;
|
processedFormValues.ioTPlatformProductId = formValues.ctWingProductId;
|
||||||
@ -188,11 +188,11 @@ async function onEdit(record: any) {
|
|||||||
// 根据平台类型设置表单值
|
// 根据平台类型设置表单值
|
||||||
const formValues = { ...record };
|
const formValues = { ...record };
|
||||||
|
|
||||||
if (record.ioTPlatform === 1 || record.ioTPlatform === '1') {
|
if (record.ioTPlatform === 2 || record.ioTPlatform === '2') {
|
||||||
// OneNET平台
|
// OneNET平台
|
||||||
formValues.oneNETAccountId = record.ioTPlatformAccountId;
|
formValues.oneNETAccountId = record.ioTPlatformAccountId;
|
||||||
formValues.oneNETProductId = record.ioTPlatformProductId;
|
formValues.oneNETProductId = record.ioTPlatformProductId;
|
||||||
} else if (record.ioTPlatform === 2 || record.ioTPlatform === '2') {
|
} else if (record.ioTPlatform === 1 || record.ioTPlatform === '1') {
|
||||||
// CTWing平台
|
// CTWing平台
|
||||||
formValues.ctWingAccountId = record.ioTPlatformAccountId;
|
formValues.ctWingAccountId = record.ioTPlatformAccountId;
|
||||||
formValues.ctWingProductId = record.ioTPlatformProductId;
|
formValues.ctWingProductId = record.ioTPlatformProductId;
|
||||||
|
|||||||
@ -134,10 +134,10 @@ export const addDeviceFormSchema: any = computed(() => [
|
|||||||
label: $t('abp.deviceInfos.ioTPlatformAccountName'),
|
label: $t('abp.deviceInfos.ioTPlatformAccountName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
return values.ioTPlatform === '1'; // OneNET平台
|
return values.ioTPlatform === '2'; // OneNET平台
|
||||||
},
|
},
|
||||||
rules(values: any) {
|
rules(values: any) {
|
||||||
if (values.ioTPlatform === '1') {
|
if (values.ioTPlatform === '2') {
|
||||||
return 'required';
|
return 'required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -187,10 +187,10 @@ export const addDeviceFormSchema: any = computed(() => [
|
|||||||
label: $t('abp.deviceInfos.ioTPlatformAccountName'),
|
label: $t('abp.deviceInfos.ioTPlatformAccountName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
return values.ioTPlatform === '2'; // CTWing平台
|
return values.ioTPlatform === '1'; // CTWing平台
|
||||||
},
|
},
|
||||||
rules(values: any) {
|
rules(values: any) {
|
||||||
if (values.ioTPlatform === '2') {
|
if (values.ioTPlatform === '1') {
|
||||||
return 'required';
|
return 'required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -240,10 +240,10 @@ export const addDeviceFormSchema: any = computed(() => [
|
|||||||
label: $t('abp.deviceInfos.ioTPlatformProductName'),
|
label: $t('abp.deviceInfos.ioTPlatformProductName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
return values.ioTPlatform === '1' && values.oneNETAccountId; // OneNET平台且已选择账号
|
return values.ioTPlatform === '2' && values.oneNETAccountId; // OneNET平台且已选择账号
|
||||||
},
|
},
|
||||||
rules(values: any) {
|
rules(values: any) {
|
||||||
if (values.ioTPlatform === '1' && values.oneNETAccountId) {
|
if (values.ioTPlatform === '2' && values.oneNETAccountId) {
|
||||||
return 'required';
|
return 'required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -252,13 +252,13 @@ export const addDeviceFormSchema: any = computed(() => [
|
|||||||
},
|
},
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: postOneNetProductListAsync,
|
api: postOneNetProductListAsync,
|
||||||
params: {
|
params: (formValues: any) => ({
|
||||||
body: {
|
body: {
|
||||||
pageIndex: 1,
|
pageIndex: 1,
|
||||||
pageSize: 1000,
|
pageSize: 1000,
|
||||||
oneNETAccountId: '{{oneNETAccountId}}', // 动态参数
|
oneNETAccountId: formValues.oneNETAccountId,
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
labelField: 'productName',
|
labelField: 'productName',
|
||||||
valueField: 'ioTPlatformProductId',
|
valueField: 'ioTPlatformProductId',
|
||||||
immediate: true,
|
immediate: true,
|
||||||
@ -297,10 +297,10 @@ export const addDeviceFormSchema: any = computed(() => [
|
|||||||
label: $t('abp.deviceInfos.ioTPlatformProductName'),
|
label: $t('abp.deviceInfos.ioTPlatformProductName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
return values.ioTPlatform === '2' && values.ctWingAccountId; // CTWing平台且已选择账号
|
return values.ioTPlatform === '1' && values.ctWingAccountId; // CTWing平台且已选择账号
|
||||||
},
|
},
|
||||||
rules(values: any) {
|
rules(values: any) {
|
||||||
if (values.ioTPlatform === '2' && values.ctWingAccountId) {
|
if (values.ioTPlatform === '1' && values.ctWingAccountId) {
|
||||||
return 'required';
|
return 'required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -309,13 +309,13 @@ export const addDeviceFormSchema: any = computed(() => [
|
|||||||
},
|
},
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: postCtWingProductListAsync,
|
api: postCtWingProductListAsync,
|
||||||
params: {
|
params: (formValues: any) => ({
|
||||||
body: {
|
body: {
|
||||||
pageIndex: 1,
|
pageIndex: 1,
|
||||||
pageSize: 1000,
|
pageSize: 1000,
|
||||||
ctWingAccountId: '{{ctWingAccountId}}', // 动态参数
|
ctWingAccountId: formValues.ctWingAccountId,
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
labelField: 'productName',
|
labelField: 'productName',
|
||||||
valueField: 'ioTPlatformProductId',
|
valueField: 'ioTPlatformProductId',
|
||||||
immediate: true,
|
immediate: true,
|
||||||
@ -348,14 +348,6 @@ export const addDeviceFormSchema: any = computed(() => [
|
|||||||
},
|
},
|
||||||
rules: z.string().optional(),
|
rules: z.string().optional(),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'deviceName',
|
|
||||||
label: $t('abp.deviceInfos.deviceName'),
|
|
||||||
rules: z.string().min(1, {
|
|
||||||
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.deviceName')}`,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
fieldName: 'deviceAddress',
|
fieldName: 'deviceAddress',
|
||||||
@ -364,14 +356,6 @@ export const addDeviceFormSchema: any = computed(() => [
|
|||||||
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.deviceAddress')}`,
|
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.deviceAddress')}`,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'platformPassword',
|
|
||||||
label: $t('abp.deviceInfos.platformPassword'),
|
|
||||||
rules: z.string().min(1, {
|
|
||||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.deviceInfos.platformPassword')}`,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const editDeviceFormSchemaEdit: any = computed(() => [
|
export const editDeviceFormSchemaEdit: any = computed(() => [
|
||||||
@ -417,10 +401,10 @@ export const editDeviceFormSchemaEdit: any = computed(() => [
|
|||||||
label: $t('abp.deviceInfos.ioTPlatformAccountName'),
|
label: $t('abp.deviceInfos.ioTPlatformAccountName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
return values.ioTPlatform === '1'; // OneNET平台
|
return values.ioTPlatform === '2'; // OneNET平台
|
||||||
},
|
},
|
||||||
rules(values: any) {
|
rules(values: any) {
|
||||||
if (values.ioTPlatform === '1') {
|
if (values.ioTPlatform === '2') {
|
||||||
return 'required';
|
return 'required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -470,10 +454,10 @@ export const editDeviceFormSchemaEdit: any = computed(() => [
|
|||||||
label: $t('abp.deviceInfos.ioTPlatformAccountName'),
|
label: $t('abp.deviceInfos.ioTPlatformAccountName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
return values.ioTPlatform === '2'; // CTWing平台
|
return values.ioTPlatform === '1'; // CTWing平台
|
||||||
},
|
},
|
||||||
rules(values: any) {
|
rules(values: any) {
|
||||||
if (values.ioTPlatform === '2') {
|
if (values.ioTPlatform === '1') {
|
||||||
return 'required';
|
return 'required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -523,10 +507,10 @@ export const editDeviceFormSchemaEdit: any = computed(() => [
|
|||||||
label: $t('abp.deviceInfos.ioTPlatformProductName'),
|
label: $t('abp.deviceInfos.ioTPlatformProductName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
return values.ioTPlatform === '1' && values.oneNETAccountId; // OneNET平台且已选择账号
|
return values.ioTPlatform === '2' && values.oneNETAccountId; // OneNET平台且已选择账号
|
||||||
},
|
},
|
||||||
rules(values: any) {
|
rules(values: any) {
|
||||||
if (values.ioTPlatform === '1' && values.oneNETAccountId) {
|
if (values.ioTPlatform === '2' && values.oneNETAccountId) {
|
||||||
return 'required';
|
return 'required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -535,13 +519,13 @@ export const editDeviceFormSchemaEdit: any = computed(() => [
|
|||||||
},
|
},
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: postOneNetProductListAsync,
|
api: postOneNetProductListAsync,
|
||||||
params: {
|
params: (formValues: any) => ({
|
||||||
body: {
|
body: {
|
||||||
pageIndex: 1,
|
pageIndex: 1,
|
||||||
pageSize: 1000,
|
pageSize: 1000,
|
||||||
oneNETAccountId: '{{oneNETAccountId}}', // 动态参数
|
oneNETAccountId: formValues.oneNETAccountId,
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
labelField: 'productName',
|
labelField: 'productName',
|
||||||
valueField: 'ioTPlatformProductId',
|
valueField: 'ioTPlatformProductId',
|
||||||
immediate: true,
|
immediate: true,
|
||||||
@ -580,10 +564,10 @@ export const editDeviceFormSchemaEdit: any = computed(() => [
|
|||||||
label: $t('abp.deviceInfos.ioTPlatformProductName'),
|
label: $t('abp.deviceInfos.ioTPlatformProductName'),
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show(values: any) {
|
show(values: any) {
|
||||||
return values.ioTPlatform === '2' && values.ctWingAccountId; // CTWing平台且已选择账号
|
return values.ioTPlatform === '1' && values.ctWingAccountId; // CTWing平台且已选择账号
|
||||||
},
|
},
|
||||||
rules(values: any) {
|
rules(values: any) {
|
||||||
if (values.ioTPlatform === '2' && values.ctWingAccountId) {
|
if (values.ioTPlatform === '1' && values.ctWingAccountId) {
|
||||||
return 'required';
|
return 'required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -592,13 +576,13 @@ export const editDeviceFormSchemaEdit: any = computed(() => [
|
|||||||
},
|
},
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: postCtWingProductListAsync,
|
api: postCtWingProductListAsync,
|
||||||
params: {
|
params: (formValues: any) => ({
|
||||||
body: {
|
body: {
|
||||||
pageIndex: 1,
|
pageIndex: 1,
|
||||||
pageSize: 1000,
|
pageSize: 1000,
|
||||||
ctWingAccountId: '{{ctWingAccountId}}', // 动态参数
|
ctWingAccountId: formValues.ctWingAccountId,
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
labelField: 'productName',
|
labelField: 'productName',
|
||||||
valueField: 'ioTPlatformProductId',
|
valueField: 'ioTPlatformProductId',
|
||||||
immediate: true,
|
immediate: true,
|
||||||
@ -631,26 +615,10 @@ export const editDeviceFormSchemaEdit: any = computed(() => [
|
|||||||
},
|
},
|
||||||
rules: z.string().optional(),
|
rules: z.string().optional(),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'deviceName',
|
|
||||||
label: $t('abp.deviceInfos.deviceName'),
|
|
||||||
rules: z.string().min(1, {
|
|
||||||
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.deviceName')}`,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
fieldName: 'deviceAddress',
|
fieldName: 'deviceAddress',
|
||||||
label: $t('abp.deviceInfos.deviceAddress'),
|
label: $t('abp.deviceInfos.deviceAddress'),
|
||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'platformPassword',
|
|
||||||
label: $t('abp.deviceInfos.platformPassword'),
|
|
||||||
rules: z.string().min(1, {
|
|
||||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.deviceInfos.platformPassword')}`,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user