设备配置管理
This commit is contained in:
parent
839a34928b
commit
86cb02a298
|
@ -0,0 +1,91 @@
|
|||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
@register="registerDrawer"
|
||||
:title="getTitle"
|
||||
:width="adaptiveWidth"
|
||||
@ok="handleSubmit"
|
||||
:showFooter="showFooter"
|
||||
destroyOnClose
|
||||
>
|
||||
<BasicForm @register="registerForm" >
|
||||
</BasicForm>
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {defineComponent, ref, computed, unref, useAttrs, createVNode, h} from 'vue';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
||||
import { useDrawerAdaptiveWidth } from '/@/hooks/jeecg/useAdaptiveWidth';
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
|
||||
import { formSchema } from "../config.data";
|
||||
import { add,edit } from '../config.api';
|
||||
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
const attrs = useAttrs();
|
||||
const isUpdate = ref(true);
|
||||
const rowId = ref('');
|
||||
const departOptions = ref([]);
|
||||
let isFormDepartUser = false;
|
||||
//表单配置
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
||||
labelWidth: 90,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
const showFooter = ref(true);
|
||||
//表单赋值
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
await resetFields();
|
||||
showFooter.value = data?.showFooter ?? true;
|
||||
setDrawerProps({ confirmLoading: false, showFooter: showFooter.value });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
// 无论新增还是编辑,都可以设置表单值
|
||||
if (typeof data.record === 'object') {
|
||||
setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !showFooter.value });
|
||||
});
|
||||
//获取标题
|
||||
const getTitle = computed(() => {
|
||||
if (!unref(isUpdate)) {
|
||||
return '新增配置';
|
||||
} else {
|
||||
return unref(showFooter) ? '编辑配置' : '配置详情';
|
||||
}
|
||||
});
|
||||
const { adaptiveWidth } = useDrawerAdaptiveWidth();
|
||||
|
||||
/**
|
||||
* 提交事件
|
||||
*/
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
let values = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
let params = values;
|
||||
if (!unref(isUpdate)) {
|
||||
await add(params);
|
||||
}else {
|
||||
await edit(params);
|
||||
}
|
||||
//关闭弹窗
|
||||
closeDrawer();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,28 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
|
||||
list = '/iot/tplink/config/list',
|
||||
add = '/iot/tplink/config/add',
|
||||
edit = '/iot/tplink/config/edit',
|
||||
|
||||
}
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
/**
|
||||
* 更新
|
||||
* @param params
|
||||
*/
|
||||
export const add = (params) => {
|
||||
return defHttp.post({ url: Api.add, params });
|
||||
}
|
||||
/**
|
||||
* 更新
|
||||
* @param params
|
||||
*/
|
||||
export const edit = (params) => {
|
||||
return defHttp.post({ url: Api.edit, params });
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '图门地址',
|
||||
align: "center",
|
||||
dataIndex: 'tumsUrl',
|
||||
width: 340,
|
||||
},
|
||||
{
|
||||
title: '用户',
|
||||
align: "center",
|
||||
dataIndex: 'tumsUsername'
|
||||
},
|
||||
{
|
||||
title: '密码',
|
||||
align: "center",
|
||||
dataIndex: 'tumsPassword'
|
||||
},
|
||||
{
|
||||
title: 'FTP地址',
|
||||
align: "center",
|
||||
dataIndex: 'ftpIp'
|
||||
},
|
||||
{
|
||||
title: 'FTP端口',
|
||||
align: "center",
|
||||
dataIndex: 'ftpPort'
|
||||
},
|
||||
{
|
||||
title: 'FTP用户',
|
||||
align: "center",
|
||||
dataIndex: 'ftpUsername'
|
||||
},
|
||||
{
|
||||
title: 'FTP密码',
|
||||
align: "center",
|
||||
dataIndex: 'ftpPassword'
|
||||
},
|
||||
{
|
||||
title: 'FTP上传路径',
|
||||
align: "center",
|
||||
dataIndex: 'ftpUploadpath'
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
align: "center",
|
||||
dataIndex: 'updateTime'
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '图门地址',
|
||||
field: 'tumsUrl',
|
||||
component: 'Input',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
label: '用户',
|
||||
field: 'tumsUsername',
|
||||
component: 'Input',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
label: '密码',
|
||||
field: 'tumsPassword',
|
||||
component: 'Input',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
label: 'FTP地址',
|
||||
field: 'ftpIp',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: 'FTP端口',
|
||||
field: 'ftpPort',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: 'FTP用户',
|
||||
field: 'ftpUsername',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: 'FTP密码',
|
||||
field: 'ftpPassword',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: 'FTP上传路径',
|
||||
field: 'ftpUploadpath',
|
||||
component: 'Input',
|
||||
}
|
||||
];
|
|
@ -0,0 +1,173 @@
|
|||
<template>
|
||||
<div>
|
||||
<a-tabs v-model:activeKey="tabActiveKey" class="tabs-container">
|
||||
<a-tab-pane key="dataAsync" tab="配置信息">
|
||||
<!--引用表格-->
|
||||
<BasicTable ref="tableRef" @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button v-show="isShow" type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd"> 新增</a-button>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="syncLogList" tab="同步历史">
|
||||
<!-- <SyncLogList ref="syncLogListRef" :orgCode="orgData.orgCode"></SyncLogList>-->
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
<!-- 表单区域 -->
|
||||
<ConfigDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iot-nuIotCameraInfo" setup>
|
||||
import {ref, reactive, createVNode, h, onMounted, watch, unref} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './config.data';
|
||||
import { list } from './config.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useDrawer } from "@/components/Drawer";
|
||||
import { useRouter } from 'vue-router';
|
||||
import ConfigDrawer from './components/ConfigDrawer.vue'
|
||||
|
||||
//注册drawer
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
let router = useRouter();
|
||||
const formRef = ref();
|
||||
const tableRef = ref();
|
||||
const isShow = ref(false);
|
||||
const queryParam = reactive<any>({});
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '配置信息',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: false,
|
||||
showIndexColumn: true,
|
||||
actionColumn: {
|
||||
width: 100,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
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 handleAdd(record: Recordable) {
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
tenantSaas: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
tenantSaas: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
watch(
|
||||
() => tableRef.value.getDataSource(),
|
||||
async () => {
|
||||
if(tableRef.value.getDataSource().length<1){
|
||||
isShow.value = true
|
||||
}else{
|
||||
isShow.value = false
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
</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);
|
||||
}
|
||||
|
||||
.tabs-container {
|
||||
width: 100%;
|
||||
background-color: white;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
|
@ -0,0 +1,91 @@
|
|||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
@register="registerDrawer"
|
||||
:title="getTitle"
|
||||
:width="adaptiveWidth"
|
||||
@ok="handleSubmit"
|
||||
:showFooter="showFooter"
|
||||
destroyOnClose
|
||||
>
|
||||
<BasicForm @register="registerForm" >
|
||||
</BasicForm>
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {defineComponent, ref, computed, unref, useAttrs, createVNode, h} from 'vue';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
||||
import { useDrawerAdaptiveWidth } from '/@/hooks/jeecg/useAdaptiveWidth';
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
|
||||
import { formSchema } from "../config.data";
|
||||
import { add,edit } from '../config.api';
|
||||
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
const attrs = useAttrs();
|
||||
const isUpdate = ref(true);
|
||||
const rowId = ref('');
|
||||
const departOptions = ref([]);
|
||||
let isFormDepartUser = false;
|
||||
//表单配置
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
||||
labelWidth: 90,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
const showFooter = ref(true);
|
||||
//表单赋值
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
await resetFields();
|
||||
showFooter.value = data?.showFooter ?? true;
|
||||
setDrawerProps({ confirmLoading: false, showFooter: showFooter.value });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
// 无论新增还是编辑,都可以设置表单值
|
||||
if (typeof data.record === 'object') {
|
||||
setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !showFooter.value });
|
||||
});
|
||||
//获取标题
|
||||
const getTitle = computed(() => {
|
||||
if (!unref(isUpdate)) {
|
||||
return '新增配置';
|
||||
} else {
|
||||
return unref(showFooter) ? '编辑配置' : '配置详情';
|
||||
}
|
||||
});
|
||||
const { adaptiveWidth } = useDrawerAdaptiveWidth();
|
||||
|
||||
/**
|
||||
* 提交事件
|
||||
*/
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
let values = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
let params = values;
|
||||
if (!unref(isUpdate)) {
|
||||
await add(params);
|
||||
}else {
|
||||
await edit(params);
|
||||
}
|
||||
//关闭弹窗
|
||||
closeDrawer();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,28 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
|
||||
list = '/iot/tq/config/list',
|
||||
add = '/iot/tq/config/add',
|
||||
edit = '/iot/tq/config/edit',
|
||||
|
||||
}
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
/**
|
||||
* 更新
|
||||
* @param params
|
||||
*/
|
||||
export const add = (params) => {
|
||||
return defHttp.post({ url: Api.add, params });
|
||||
}
|
||||
/**
|
||||
* 更新
|
||||
* @param params
|
||||
*/
|
||||
export const edit = (params) => {
|
||||
return defHttp.post({ url: Api.edit, params });
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '机构编码',
|
||||
align: "center",
|
||||
dataIndex: 'orgCode',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '机构名称',
|
||||
align: "center",
|
||||
dataIndex: 'orgCode_dictText',
|
||||
width: 240,
|
||||
},
|
||||
{
|
||||
title: '厂家云地址',
|
||||
align: "center",
|
||||
dataIndex: 'requestUrl',
|
||||
},
|
||||
{
|
||||
title: '授权码',
|
||||
align: "center",
|
||||
dataIndex: 'authCode',
|
||||
width: 260,
|
||||
},
|
||||
{
|
||||
title: '随机字符串',
|
||||
align: "center",
|
||||
dataIndex: 'randomCode',
|
||||
width: 260,
|
||||
},
|
||||
{
|
||||
title: '通知地址',
|
||||
align: "center",
|
||||
dataIndex: 'notifyUrl'
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
align: "center",
|
||||
dataIndex: 'updateTime',
|
||||
width: 160,
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '机构',
|
||||
field: 'orgCode',
|
||||
component: 'JSelectDept',
|
||||
componentProps: {
|
||||
rowKey: 'orgCode',
|
||||
labelKey: 'departName',
|
||||
selectType: true,
|
||||
},
|
||||
required: true
|
||||
},
|
||||
{
|
||||
label: '厂家云地址',
|
||||
field: 'requestUrl',
|
||||
component: 'Input',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
label: '授权码',
|
||||
field: 'authCode',
|
||||
component: 'Input',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
label: '随机字符串',
|
||||
field: 'randomCode',
|
||||
component: 'Input',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
label: '通知地址',
|
||||
field: 'notifyUrl',
|
||||
component: 'Input',
|
||||
},
|
||||
|
||||
];
|
|
@ -0,0 +1,158 @@
|
|||
<template>
|
||||
<div>
|
||||
<a-tabs v-model:activeKey="tabActiveKey" class="tabs-container">
|
||||
<a-tab-pane key="dataAsync" tab="配置信息">
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd"> 新增</a-button>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="syncLogList" tab="同步历史">
|
||||
<!-- <SyncLogList ref="syncLogListRef" :orgCode="orgData.orgCode"></SyncLogList>-->
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
<!-- 表单区域 -->
|
||||
<ConfigDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iot-nuIotCameraInfo" setup>
|
||||
import {ref, reactive, createVNode, h, onMounted, watch, unref} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './config.data';
|
||||
import { list } from './config.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useDrawer } from "@/components/Drawer";
|
||||
import { useRouter } from 'vue-router';
|
||||
import ConfigDrawer from './components/ConfigDrawer.vue'
|
||||
|
||||
//注册drawer
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
let router = useRouter();
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '配置信息',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: false,
|
||||
showIndexColumn: true,
|
||||
actionColumn: {
|
||||
width: 100,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
params.column = 'id'
|
||||
params.order = 'asc'
|
||||
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 handleAdd(record: Recordable) {
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
tenantSaas: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
tenantSaas: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
</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);
|
||||
}
|
||||
|
||||
.tabs-container {
|
||||
width: 100%;
|
||||
background-color: white;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
|
@ -0,0 +1,91 @@
|
|||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
@register="registerDrawer"
|
||||
:title="getTitle"
|
||||
:width="adaptiveWidth"
|
||||
@ok="handleSubmit"
|
||||
:showFooter="showFooter"
|
||||
destroyOnClose
|
||||
>
|
||||
<BasicForm @register="registerForm" >
|
||||
</BasicForm>
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {defineComponent, ref, computed, unref, useAttrs, createVNode, h} from 'vue';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
||||
import { useDrawerAdaptiveWidth } from '/@/hooks/jeecg/useAdaptiveWidth';
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
|
||||
import { formSchema } from "../config.data";
|
||||
import { add,edit } from '../config.api';
|
||||
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
const attrs = useAttrs();
|
||||
const isUpdate = ref(true);
|
||||
const rowId = ref('');
|
||||
const departOptions = ref([]);
|
||||
let isFormDepartUser = false;
|
||||
//表单配置
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
||||
labelWidth: 90,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
const showFooter = ref(true);
|
||||
//表单赋值
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
await resetFields();
|
||||
showFooter.value = data?.showFooter ?? true;
|
||||
setDrawerProps({ confirmLoading: false, showFooter: showFooter.value });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
// 无论新增还是编辑,都可以设置表单值
|
||||
if (typeof data.record === 'object') {
|
||||
setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !showFooter.value });
|
||||
});
|
||||
//获取标题
|
||||
const getTitle = computed(() => {
|
||||
if (!unref(isUpdate)) {
|
||||
return '新增配置';
|
||||
} else {
|
||||
return unref(showFooter) ? '编辑配置' : '配置详情';
|
||||
}
|
||||
});
|
||||
const { adaptiveWidth } = useDrawerAdaptiveWidth();
|
||||
|
||||
/**
|
||||
* 提交事件
|
||||
*/
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
let values = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
let params = values;
|
||||
if (!unref(isUpdate)) {
|
||||
await add(params);
|
||||
}else {
|
||||
await edit(params);
|
||||
}
|
||||
//关闭弹窗
|
||||
closeDrawer();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,28 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
|
||||
list = '/iot/yiweilian/config/list',
|
||||
add = '/iot/yiweilian/config/add',
|
||||
edit = '/iot/yiweilian/config/edit',
|
||||
|
||||
}
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
/**
|
||||
* 更新
|
||||
* @param params
|
||||
*/
|
||||
export const add = (params) => {
|
||||
return defHttp.post({ url: Api.add, params });
|
||||
}
|
||||
/**
|
||||
* 更新
|
||||
* @param params
|
||||
*/
|
||||
export const edit = (params) => {
|
||||
return defHttp.post({ url: Api.edit, params });
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '厂家云地址',
|
||||
align: "center",
|
||||
dataIndex: 'requestUrl',
|
||||
},
|
||||
{
|
||||
title: '用户标识',
|
||||
align: "center",
|
||||
dataIndex: 'clientId'
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
align: "center",
|
||||
dataIndex: 'updateTime'
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '厂家云地址',
|
||||
field: 'requestUrl',
|
||||
component: 'Input',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
label: '用户标识',
|
||||
field: 'clientId',
|
||||
component: 'Input',
|
||||
required: true
|
||||
},
|
||||
];
|
|
@ -0,0 +1,172 @@
|
|||
<template>
|
||||
<div>
|
||||
<a-tabs v-model:activeKey="tabActiveKey" class="tabs-container">
|
||||
<a-tab-pane key="dataAsync" tab="配置信息">
|
||||
<!--引用表格-->
|
||||
<BasicTable ref="tableRef" @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button v-show="isShow" type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd"> 新增</a-button>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="syncLogList" tab="同步历史">
|
||||
<!-- <SyncLogList ref="syncLogListRef" :orgCode="orgData.orgCode"></SyncLogList>-->
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
<!-- 表单区域 -->
|
||||
<ConfigDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iot-nuIotCameraInfo" setup>
|
||||
import {ref, reactive, createVNode, h, onMounted, watch, unref} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './config.data';
|
||||
import { list } from './config.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useDrawer } from "@/components/Drawer";
|
||||
import { useRouter } from 'vue-router';
|
||||
import ConfigDrawer from './components/ConfigDrawer.vue'
|
||||
|
||||
//注册drawer
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
let router = useRouter();
|
||||
const formRef = ref();
|
||||
const tableRef = ref();
|
||||
const isShow = ref(false);
|
||||
const queryParam = reactive<any>({});
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '配置信息',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: false,
|
||||
showIndexColumn: true,
|
||||
actionColumn: {
|
||||
width: 100,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
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 handleAdd(record: Recordable) {
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
tenantSaas: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
tenantSaas: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
watch(
|
||||
() => tableRef.value.getDataSource(),
|
||||
async () => {
|
||||
if(tableRef.value.getDataSource().length<1){
|
||||
isShow.value = true
|
||||
}else{
|
||||
isShow.value = false
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
</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);
|
||||
}
|
||||
|
||||
.tabs-container {
|
||||
width: 100%;
|
||||
background-color: white;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue