网络设备
This commit is contained in:
parent
5f232d125c
commit
c1c89099b2
|
|
@ -10,6 +10,20 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备标识">
|
||||
<a-input v-model:value="formData.deviceName" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备型号">
|
||||
<a-input v-model:value="formData.deviceModel" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备类型">
|
||||
|
|
@ -22,23 +36,26 @@
|
|||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备标识">
|
||||
<a-input v-model:value="formData.deviceName" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备状态">
|
||||
<a-form-item label="在线状态">
|
||||
<j-dict-select-tag v-model:value="formData.deviceStatus" dictCode="tplink_status" disabled
|
||||
placeholder="请选择设备状态" allow-clear />
|
||||
placeholder="请选择在线状态" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备型号">
|
||||
<a-input v-model:value="formData.deviceModel" :disabled="true"></a-input>
|
||||
<a-form-item label="分配状态">
|
||||
<a-select v-model:value="formData.izAllocate" :disabled="true">
|
||||
<a-select-option value="Y">已分配</a-select-option>
|
||||
<a-select-option value="N">未分配</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="MAC地址">
|
||||
<a-input v-model:value="formData.mac" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
|
@ -111,10 +128,12 @@ const emit = defineEmits(['register', 'ok']);
|
|||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
deviceIndex: '',
|
||||
deviceType: '',
|
||||
deviceName: '',
|
||||
deviceStatus: '',
|
||||
deviceModel: '',
|
||||
deviceType: '',
|
||||
deviceStatus: '',
|
||||
izAllocate: '',
|
||||
mac: '',
|
||||
ftpIp: undefined,
|
||||
ftpPort: undefined,
|
||||
ftpUsername: undefined,
|
||||
|
|
|
|||
|
|
@ -59,6 +59,13 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="更新时间">
|
||||
<a-input v-model:value="formData.updateDate" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
|
|
@ -91,7 +98,8 @@ const formData = reactive<Record<string, any>>({
|
|||
ftpPort: '',
|
||||
ftpUsername: '',
|
||||
ftpPassword: '',
|
||||
ftpUploadpath: ''
|
||||
ftpUploadpath: '',
|
||||
updateDate: ''
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ const confirmLoading = ref<boolean>(false);
|
|||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '摄像头信息',
|
||||
title: '监控设备',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: false,
|
||||
|
|
@ -114,6 +114,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
queryParam.routeType = 'camera';
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,211 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<JFormContainer :disabled="disabled">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="图门地址">
|
||||
<a-input v-model:value="formData.tumsUrl"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="用户">
|
||||
<a-input v-model:value="formData.tumsUsername"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="密码">
|
||||
<a-input v-model:value="formData.tumsPassword"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="FTP地址">
|
||||
<a-input v-model:value="formData.ftpIp"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="FTP端口">
|
||||
<a-input v-model:value="formData.ftpPort"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="FTP用户">
|
||||
<a-input v-model:value="formData.ftpUsername"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="FTP密码">
|
||||
<a-input v-model:value="formData.ftpPassword"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="FTP上传路径">
|
||||
<a-input v-model:value="formData.ftpUploadpath"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="更新时间">
|
||||
<a-input v-model:value="formData.updateDate" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { saveOrUpdateConfig } from '../network.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: ()=>{} },
|
||||
formBpm: { type: Boolean, default: true }
|
||||
});
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
tumsUrl: '',
|
||||
tumsUsername: '',
|
||||
tumsPassword: '',
|
||||
ftpIp: '',
|
||||
ftpPort: '',
|
||||
ftpUsername: '',
|
||||
ftpPassword: '',
|
||||
ftpUploadpath: '',
|
||||
updateDate: ''
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = {
|
||||
tumsUrl: [{ required: true, message: '请输入图门地址!'},],
|
||||
tumsUsername: [{ required: true, message: '请输入账户!'},],
|
||||
tumsPassword: [{ required: true, message: '请输入密码!'},],
|
||||
};
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return props.formDisabled;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
let record = {};
|
||||
edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
//赋值
|
||||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if(record.hasOwnProperty(key)){
|
||||
tmpData[key] = record[key]
|
||||
}
|
||||
})
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitForm() {
|
||||
try {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
} catch ({ errorFields }) {
|
||||
if (errorFields) {
|
||||
const firstField = errorFields[0];
|
||||
if (firstField) {
|
||||
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
return Promise.reject(errorFields);
|
||||
}
|
||||
confirmLoading.value = true;
|
||||
const isUpdate = ref<boolean>(false);
|
||||
//时间格式化
|
||||
let model = formData;
|
||||
if (model.id) {
|
||||
isUpdate.value = true;
|
||||
}
|
||||
//循环数据
|
||||
for (let data in model) {
|
||||
//如果该数据是数组并且是字符串类型
|
||||
if (model[data] instanceof Array) {
|
||||
let valueType = getValueType(formRef.value.getProps, data);
|
||||
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||
if (valueType === 'string') {
|
||||
model[data] = model[data].join(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
await saveOrUpdateConfig(model, isUpdate.value)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
createMessage.success(res.message);
|
||||
emit('ok');
|
||||
} else {
|
||||
createMessage.warning(res.message);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
<template>
|
||||
<a-drawer :title="title" :width="width" :visible="visible" :closable="true" :footer-style="{ textAlign: 'right' }"
|
||||
:bodyStyle="{ padding: '14px' }" @close="handleCancel">
|
||||
<template #footer>
|
||||
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
|
||||
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
|
||||
</template>
|
||||
<CameraInfoForm v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||
:formBpm="false">
|
||||
</CameraInfoForm>
|
||||
</a-drawer>
|
||||
<!-- 员工信息变更审核 -->
|
||||
<a-drawer :title="title" :width="width" :visible="configVisible" :closable="true" :footer-style="{ textAlign: 'right' }"
|
||||
:bodyStyle="{ padding: '14px' }" @close="handleConfigCancel">
|
||||
<template #footer>
|
||||
<a-button type="primary" style="margin-right: 8px" @click="handleConfigCancel">关闭</a-button>
|
||||
<a-button type="primary" @click="handleConfigOk">确认</a-button>
|
||||
</template>
|
||||
<ConfigInfoForm v-if="configVisible" ref="configForm" @ok="handleConfigCancel" :formBpm="false">
|
||||
</ConfigInfoForm>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import CameraInfoForm from './NetworkInfoForm.vue'
|
||||
import ConfigInfoForm from './ConfigInfoForm.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
import { getConfig } from '../network.api';
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const configForm = ref();
|
||||
const configVisible = ref<boolean>(false);
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑配置
|
||||
* @param
|
||||
*/
|
||||
async function configEdit() {
|
||||
await getConfig({}).then((res) => {
|
||||
console.log(res);
|
||||
configVisible.value = true;
|
||||
if(res!=null){
|
||||
title.value = '编辑配置';
|
||||
nextTick(() => {
|
||||
configForm.value.edit(res);
|
||||
});
|
||||
}else{
|
||||
title.value = '新增配置';
|
||||
nextTick(() => {
|
||||
configForm.value.add();
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工信息变更-关闭
|
||||
*/
|
||||
function handleConfigCancel() {
|
||||
configVisible.value = false
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工信息变更确认
|
||||
*/
|
||||
function handleConfigOk() {
|
||||
configForm.value.submitForm();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
configEdit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<JFormContainer :disabled="disabled">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备序号">
|
||||
<a-input v-model:value="formData.deviceIndex" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备标识">
|
||||
<a-input v-model:value="formData.deviceName" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备型号">
|
||||
<a-input v-model:value="formData.deviceModel" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备类型">
|
||||
<a-select v-model:value="formData.deviceType" :disabled="true">
|
||||
<a-select-option value="SWITCH">交换机</a-select-option>
|
||||
<a-select-option value="ROUTER">路由器</a-select-option>
|
||||
<a-select-option value="AP">无线AP</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="在线状态">
|
||||
<j-dict-select-tag v-model:value="formData.deviceStatus" dictCode="tplink_status" disabled
|
||||
placeholder="请选择在线状态" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="分配状态">
|
||||
<a-select v-model:value="formData.izAllocate" :disabled="true">
|
||||
<a-select-option value="Y">已分配</a-select-option>
|
||||
<a-select-option value="N">未分配</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="MAC地址">
|
||||
<a-input v-model:value="formData.mac" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="备注">
|
||||
<a-textarea v-model:value="formData.remarks" placeholder="请输入备注" :rows="4" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { update } from '../network.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: ()=>{} },
|
||||
formBpm: { type: Boolean, default: true }
|
||||
});
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
deviceIndex: '',
|
||||
deviceName: '',
|
||||
deviceModel: '',
|
||||
deviceType: '',
|
||||
deviceStatus: '',
|
||||
izAllocate: '',
|
||||
mac: '',
|
||||
remarks: '',
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = {
|
||||
// remarks: [{ required: true, message: '请输入备注!'},],
|
||||
};
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return props.formDisabled;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
let record = {};
|
||||
edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
//赋值
|
||||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if(record.hasOwnProperty(key)){
|
||||
tmpData[key] = record[key]
|
||||
}
|
||||
})
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitForm() {
|
||||
try {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
} catch ({ errorFields }) {
|
||||
if (errorFields) {
|
||||
const firstField = errorFields[0];
|
||||
if (firstField) {
|
||||
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
return Promise.reject(errorFields);
|
||||
}
|
||||
confirmLoading.value = true;
|
||||
const isUpdate = ref<boolean>(false);
|
||||
//时间格式化
|
||||
let model = formData;
|
||||
if (model.id) {
|
||||
isUpdate.value = true;
|
||||
}
|
||||
//循环数据
|
||||
for (let data in model) {
|
||||
//如果该数据是数组并且是字符串类型
|
||||
if (model[data] instanceof Array) {
|
||||
let valueType = getValueType(formRef.value.getProps, data);
|
||||
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||
if (valueType === 'string') {
|
||||
model[data] = model[data].join(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
await update(model)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
createMessage.success(res.message);
|
||||
emit('ok');
|
||||
} else {
|
||||
createMessage.warning(res.message);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
|
||||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<div class="p-2">
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" preIcon="ant-design:sync-outlined" @click="handleSync"> 拉取设备</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:sync-outlined" @click="handleSyncStatus"> 更新状态</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:setting-outlined" @click="handleConfig"> 配置管理</a-button>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<DrawerModal ref="registerDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iot-nuIotCameraInfo" setup>
|
||||
import {ref, reactive, createVNode, h, onMounted, watch, unref,nextTick} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns, searchFormSchema } from './network.data';
|
||||
import { list, syncAllDevices,syncDevicesStatus} from './network.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
// import { useDrawer } from "@/components/Drawer";
|
||||
import { useRouter } from 'vue-router';
|
||||
import DrawerModal from './components/DrawerModal.vue'
|
||||
|
||||
//注册drawer
|
||||
// const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
let router = useRouter();
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const registerModal = ref();
|
||||
const previewModal = ref();
|
||||
const deviceModal = ref();
|
||||
const registerDrawer = ref();
|
||||
const cameraPictureConfigModal = ref();
|
||||
const userStore = useUserStore();
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '网络设备',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: false,
|
||||
formConfig: {
|
||||
// labelWidth: 200,
|
||||
schemas: searchFormSchema,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
queryParam.routeType = 'network';
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs:24,
|
||||
sm:4,
|
||||
xl:6,
|
||||
xxl:4
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 20,
|
||||
});
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
registerDrawer.value.disableSubmit = false;
|
||||
registerDrawer.value.edit(record);
|
||||
}
|
||||
|
||||
function handleConfig(){
|
||||
registerDrawer.value.disableSubmit = false;
|
||||
registerDrawer.value.configEdit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步设备
|
||||
*/
|
||||
async function handleSync(){
|
||||
confirmLoading.value = true;
|
||||
//摄像头、录像机
|
||||
await syncAllDevices({deviceType: "SWITCH,ROUTER,AP"}).then((res) => {
|
||||
confirmLoading.value = false;
|
||||
reload();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
*/
|
||||
async function handleSyncStatus(){
|
||||
confirmLoading.value = true;
|
||||
await syncDevicesStatus({deviceType: "SWITCH,ROUTER,AP"}).then((res) => {
|
||||
confirmLoading.value = false;
|
||||
reload();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.query-group-cust{
|
||||
min-width: 100px !important;
|
||||
}
|
||||
.query-group-split-cust{
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
}
|
||||
.ant-form-item:not(.ant-form-item-with-help){
|
||||
margin-bottom: 16px;
|
||||
height: 32px;
|
||||
}
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.p-2{
|
||||
height: calc(100vh - 120px);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/iot/tplink/cameraInfo/list',
|
||||
syncAllDevices = '/iot/tplink/cameraInfo/syncAllDevices',
|
||||
syncDevicesStatus = '/iot/tplink/cameraInfo/syncDevicesStatus',
|
||||
edit = '/iot/tplink/cameraInfo/edit',
|
||||
getConfig = '/iot/tplink/config/getByCode',
|
||||
addConfig = '/iot/tplink/config/add',
|
||||
editConfig = '/iot/tplink/config/edit',
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 所有网络设备
|
||||
* @param params
|
||||
*/
|
||||
export const syncAllDevices = (params) => defHttp.get({ url: Api.syncAllDevices, params });
|
||||
|
||||
/**
|
||||
* 同步设备在线状态
|
||||
* @param params
|
||||
*/
|
||||
export const syncDevicesStatus = (params) => defHttp.get({ url: Api.syncDevicesStatus, params });
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param params
|
||||
*/
|
||||
export const update = (params) => {
|
||||
return defHttp.post({ url: Api.edit, params },{ isTransformResponse: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置数据
|
||||
* @param params
|
||||
*/
|
||||
export const getConfig = (params) => defHttp.get({ url: Api.getConfig, params });
|
||||
|
||||
/**
|
||||
* 保存或者更新配置
|
||||
* @param params
|
||||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdateConfig = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.editConfig : Api.addConfig;
|
||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||
};
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '设备序号',
|
||||
align: "center",
|
||||
dataIndex: 'deviceIndex'
|
||||
},
|
||||
{
|
||||
title: '设备标识',
|
||||
align: "center",
|
||||
dataIndex: 'deviceName'
|
||||
},
|
||||
{
|
||||
title: '设备型号',
|
||||
align: "center",
|
||||
dataIndex: 'deviceModel'
|
||||
},
|
||||
{
|
||||
title: '设备类型',
|
||||
align: "center",
|
||||
dataIndex: 'deviceType',
|
||||
customRender: ({record}) => {
|
||||
if (record.deviceType == 'SWITCH') {
|
||||
return "交换机";
|
||||
}
|
||||
if (record.deviceType == 'ROUTER') {
|
||||
return "路由器";
|
||||
}
|
||||
if (record.deviceType == 'AP') {
|
||||
return "无线AP";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '在线状态',
|
||||
align: "center",
|
||||
dataIndex: 'deviceStatus_dictText'
|
||||
},
|
||||
{
|
||||
title: '分配状态',
|
||||
align: "center",
|
||||
dataIndex: 'izAllocate',
|
||||
customRender:({record})=>{
|
||||
if(record.izAllocate=='Y'){
|
||||
return "已分配";
|
||||
}else{
|
||||
return "未分配";
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'MAC地址',
|
||||
align: "center",
|
||||
dataIndex: 'mac'
|
||||
}
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '设备类型',
|
||||
field: 'deviceType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择设备类型',
|
||||
options: [
|
||||
{ label: '交换机', value: 'SWITCH' },
|
||||
{ label: '路由器', value: 'ROUTER' },
|
||||
{ label: '无线AP', value: 'AP' },
|
||||
],
|
||||
},
|
||||
//colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '在线状态',
|
||||
field: 'deviceStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'tplink_status',
|
||||
placeholder: '请选择状态',
|
||||
stringToNumber: true,
|
||||
},
|
||||
//colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '分配状态',
|
||||
field: 'izAllocate',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择分配状态',
|
||||
options: [
|
||||
{ label: '已分配', value: 'Y' },
|
||||
{ label: '未分配', value: 'N' },
|
||||
],
|
||||
},
|
||||
//colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
Loading…
Reference in New Issue