|
|
@@ -49,7 +49,7 @@
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import { InputNumber } from 'ant-design-vue';
|
|
|
// AddDevice
|
|
|
- import { checkDevice } from '/@/api/corporation/modal';
|
|
|
+ import { checkDevice, AddDevice } from '/@/api/corporation/modal';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import { Icon } from '/@/components/Icon/index';
|
|
|
import { clamp, range } from 'lodash-es';
|
|
|
@@ -94,6 +94,18 @@
|
|
|
};
|
|
|
const schemas: FormSchema[] = [
|
|
|
{
|
|
|
+ field: 'id',
|
|
|
+ label: 'id',
|
|
|
+ show: false,
|
|
|
+ component: 'Input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'subNum',
|
|
|
+ label: 'subNum',
|
|
|
+ show: false,
|
|
|
+ component: 'Input',
|
|
|
+ },
|
|
|
+ {
|
|
|
field: 'companyName',
|
|
|
label: t('routes.corporation.enterpriseName'),
|
|
|
slot: 'userName',
|
|
|
@@ -106,11 +118,11 @@
|
|
|
component: 'Input',
|
|
|
},
|
|
|
{
|
|
|
- field: 'subNum',
|
|
|
+ field: 'deviceNumber',
|
|
|
component: 'InputNumber',
|
|
|
label: t('routes.corporation.cameraNum'),
|
|
|
+ defaultValue: 0,
|
|
|
slot: 'subNum',
|
|
|
-
|
|
|
colProps: {
|
|
|
span: 8,
|
|
|
},
|
|
|
@@ -186,19 +198,28 @@
|
|
|
try {
|
|
|
const values = await validate();
|
|
|
console.log('values,', values);
|
|
|
- // await AddDevice({
|
|
|
- // childNames: childNameList as any as string[],
|
|
|
- // companyId: id,
|
|
|
- // subNum: String(subNum),
|
|
|
- // userName,
|
|
|
- // });
|
|
|
- success('11');
|
|
|
+ let childNameList: string[] = [];
|
|
|
+ Object.keys(values).map((ele) => {
|
|
|
+ if (ele.includes('ID')) {
|
|
|
+ childNameList.push(values[ele]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ await AddDevice({
|
|
|
+ childNames: childNameList,
|
|
|
+ companyId: values.id,
|
|
|
+ subNum: String(values.subNum),
|
|
|
+ userName: values.userName,
|
|
|
+ });
|
|
|
+ success(t('common.optSuccess'));
|
|
|
closeModal();
|
|
|
} catch (error) {}
|
|
|
}
|
|
|
|
|
|
function onDataReceive(data) {
|
|
|
// 方式1;
|
|
|
+ console.log('userName', data.record);
|
|
|
+
|
|
|
resetFields();
|
|
|
setFieldsValue({
|
|
|
...data.record,
|
|
|
@@ -306,7 +327,7 @@
|
|
|
|
|
|
async function deviceMapping() {
|
|
|
const values = getFieldsValue();
|
|
|
- const devices: number = clamp(values.subNum, 0, 20);
|
|
|
+ const devices: number = clamp(values.deviceNumber, 0, 20);
|
|
|
const currentLength = unref(modelRef).mappingLength;
|
|
|
|
|
|
const rest = devices - currentLength;
|
|
|
@@ -336,19 +357,19 @@
|
|
|
}
|
|
|
async function handlePlusDevice() {
|
|
|
const values = getFieldsValue();
|
|
|
- const currentsubNum = values.subNum;
|
|
|
+ const currentsubNum = values.deviceNumber;
|
|
|
const currentDevice = clamp(currentsubNum + 1, 0, 20);
|
|
|
await setFieldsValue({
|
|
|
- subNum: currentDevice,
|
|
|
+ deviceNumber: currentDevice,
|
|
|
});
|
|
|
deviceMapping();
|
|
|
}
|
|
|
async function handleMinusDevice() {
|
|
|
const values = getFieldsValue();
|
|
|
- const currentsubNum = values.subNum;
|
|
|
+ const currentsubNum = values.deviceNumber;
|
|
|
const currentDevice = clamp(currentsubNum - 1, 0, 20);
|
|
|
await setFieldsValue({
|
|
|
- subNum: currentDevice,
|
|
|
+ deviceNumber: currentDevice,
|
|
|
});
|
|
|
deviceMapping();
|
|
|
}
|