|
@@ -4,7 +4,10 @@ |
|
@@ -4,7 +4,10 @@ |
4
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
4
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
5
|
import { deleteFormField, schemas } from '../index';
|
5
|
import { deleteFormField, schemas } from '../index';
|
6
|
import { useForm, BasicForm } from '/@/components/Form';
|
6
|
import { useForm, BasicForm } from '/@/components/Form';
|
7
|
- import { deviceProfileAccessInformation } from '/@/api/device/deviceAccess';
|
7
|
+ import {
|
|
|
8
|
+ deviceProfileAccessInformation,
|
|
|
9
|
+ updateDeviceProfileAccessInformation,
|
|
|
10
|
+ } from '/@/api/device/deviceAccess';
|
8
|
import { useMessage } from '/@/hooks/web/useMessage';
|
11
|
import { useMessage } from '/@/hooks/web/useMessage';
|
9
|
import { ipRegex } from '/@/utils/rules';
|
12
|
import { ipRegex } from '/@/utils/rules';
|
10
|
|
13
|
|
|
@@ -16,7 +19,7 @@ |
|
@@ -16,7 +19,7 @@ |
16
|
|
19
|
|
17
|
const { createMessage } = useMessage();
|
20
|
const { createMessage } = useMessage();
|
18
|
|
21
|
|
19
|
- const [registerForm, { getFieldsValue, setFieldsValue, validate }] = useForm({
|
22
|
+ const [registerForm, { getFieldsValue, setFieldsValue, validate, resetFields }] = useForm({
|
20
|
labelWidth: 150,
|
23
|
labelWidth: 150,
|
21
|
schemas,
|
24
|
schemas,
|
22
|
actionColOptions: {
|
25
|
actionColOptions: {
|
|
@@ -28,6 +31,7 @@ |
|
@@ -28,6 +31,7 @@ |
28
|
const recordInfo = ref<Recordable>({});
|
31
|
const recordInfo = ref<Recordable>({});
|
29
|
|
32
|
|
30
|
const [register, { closeModal, setModalProps }] = useModalInner(async (data) => {
|
33
|
const [register, { closeModal, setModalProps }] = useModalInner(async (data) => {
|
|
|
34
|
+ await resetFields();
|
31
|
setModalProps({ confirmLoading: false, loading: true });
|
35
|
setModalProps({ confirmLoading: false, loading: true });
|
32
|
isUpdate.value = data?.isUpdate;
|
36
|
isUpdate.value = data?.isUpdate;
|
33
|
recordInfo.value = data?.record;
|
37
|
recordInfo.value = data?.record;
|
|
@@ -52,9 +56,6 @@ |
|
@@ -52,9 +56,6 @@ |
52
|
const handleOk = async () => {
|
56
|
const handleOk = async () => {
|
53
|
await validate();
|
57
|
await validate();
|
54
|
let values = getFieldsValue();
|
58
|
let values = getFieldsValue();
|
55
|
- if (unref(isUpdate)) {
|
|
|
56
|
- values = { ...values, id: unref(recordInfo).id };
|
|
|
57
|
- }
|
|
|
58
|
const { intranetIpAndPort, outerIpAndPort } = values;
|
59
|
const { intranetIpAndPort, outerIpAndPort } = values;
|
59
|
values.intranetIp = intranetIpAndPort.inputIp;
|
60
|
values.intranetIp = intranetIpAndPort.inputIp;
|
60
|
values.intranetPort = intranetIpAndPort.inputPort;
|
61
|
values.intranetPort = intranetIpAndPort.inputPort;
|
|
@@ -81,7 +82,13 @@ |
|
@@ -81,7 +82,13 @@ |
81
|
deleteFormField.forEach((deleteItem) => {
|
82
|
deleteFormField.forEach((deleteItem) => {
|
82
|
Reflect.deleteProperty(values, deleteItem);
|
83
|
Reflect.deleteProperty(values, deleteItem);
|
83
|
});
|
84
|
});
|
84
|
- await deviceProfileAccessInformation(values);
|
85
|
+ if (unref(isUpdate)) {
|
|
|
86
|
+ // 更新
|
|
|
87
|
+ values = { ...values, id: unref(recordInfo).id };
|
|
|
88
|
+ await updateDeviceProfileAccessInformation(values);
|
|
|
89
|
+ } else {
|
|
|
90
|
+ await deviceProfileAccessInformation(values);
|
|
|
91
|
+ }
|
85
|
createMessage.success('操作成功');
|
92
|
createMessage.success('操作成功');
|
86
|
emit('handleReload');
|
93
|
emit('handleReload');
|
87
|
handleCancel();
|
94
|
handleCancel();
|