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