|
|
@@ -19,22 +19,14 @@
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import { allCompanyApi, addCameraApi } from '/@/api/device/list';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
- // address: "11111"
|
|
|
- // balance: "111"
|
|
|
- // cameraType: "4"
|
|
|
- // childName: "11111"
|
|
|
- // companyId: 1146
|
|
|
- // orderSn: "1111"
|
|
|
- // own: "0"
|
|
|
- // rnd: 0.9923218970879999
|
|
|
- // snCode: "1111"
|
|
|
- // wifiName: "1111"
|
|
|
+
|
|
|
const { t } = useI18n();
|
|
|
export default defineComponent({
|
|
|
components: { BasicModal, BasicForm },
|
|
|
props: {
|
|
|
userData: { type: Object },
|
|
|
},
|
|
|
+ emits: ['update', 'register'],
|
|
|
setup(props, { emit }) {
|
|
|
const modelRef = ref({});
|
|
|
const { createMessage } = useMessage();
|
|
|
@@ -146,7 +138,7 @@
|
|
|
},
|
|
|
},
|
|
|
];
|
|
|
- const [registerForm, { getFieldsValue, validateFields, resetFields }] = useForm({
|
|
|
+ const [registerForm, { validate, resetFields }] = useForm({
|
|
|
labelWidth: 120,
|
|
|
schemas,
|
|
|
showActionButtonGroup: false,
|
|
|
@@ -198,19 +190,14 @@
|
|
|
}
|
|
|
}
|
|
|
const handleSubmit = async () => {
|
|
|
- console.log('getFieldsValue()', getFieldsValue());
|
|
|
try {
|
|
|
- const data = await validateFields();
|
|
|
- const param = await getFieldsValue();
|
|
|
- let res = await addCameraApi(param);
|
|
|
- console.log('getFieldsValue()', res, data, param);
|
|
|
- if (res.code) {
|
|
|
- createMessage.error(res.error || t('common.optFail'));
|
|
|
- } else {
|
|
|
- emit('getList');
|
|
|
- closeModal();
|
|
|
- resetFields();
|
|
|
- }
|
|
|
+ const params = await validate();
|
|
|
+ const res = await addCameraApi(params as any);
|
|
|
+ console.log('res', res);
|
|
|
+ closeModal();
|
|
|
+ resetFields();
|
|
|
+ createMessage.success(res);
|
|
|
+ emit('update');
|
|
|
} catch (error) {
|
|
|
console.log('not passing', error);
|
|
|
}
|