同步流程升级
This commit is contained in:
parent
ce2b3b9a03
commit
0bb15d922c
|
@ -83,10 +83,10 @@ async function bootstrap(props?: MainAppProps) {
|
|||
setupErrorHandle(app);
|
||||
|
||||
// 注册第三方组件
|
||||
// await registerThirdComp(app);
|
||||
await registerThirdComp(app);
|
||||
|
||||
// 当路由准备好时再执行挂载( https://next.router.vuejs.org/api/#isready)
|
||||
// await router.isReady();
|
||||
await router.isReady();
|
||||
|
||||
// 挂载应用
|
||||
app.mount(getMountContainer(props), true);
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/IotDeviceContent/iotDeviceContent/list',
|
||||
save='/IotDeviceContent/iotDeviceContent/add',
|
||||
edit='/IotDeviceContent/iotDeviceContent/edit',
|
||||
deleteOne = '/IotDeviceContent/iotDeviceContent/delete',
|
||||
deleteBatch = '/IotDeviceContent/iotDeviceContent/deleteBatch',
|
||||
importExcel = '/IotDeviceContent/iotDeviceContent/importExcel',
|
||||
exportXls = '/IotDeviceContent/iotDeviceContent/exportXls',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
// {
|
||||
// title: '机构编码',
|
||||
// align: "center",
|
||||
// dataIndex: 'orgCode'
|
||||
// },
|
||||
{
|
||||
title: '备注信息',
|
||||
align: "center",
|
||||
dataIndex: 'content'
|
||||
},
|
||||
{
|
||||
title: '创建日期',
|
||||
align: "center",
|
||||
dataIndex: 'createTime',
|
||||
width: 160,
|
||||
},
|
||||
// {
|
||||
// title: 'NUID',
|
||||
// align: "center",
|
||||
// dataIndex: 'nuId'
|
||||
// },
|
||||
];
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
orgCode: {title: '机构编码',order: 0,view: 'text', type: 'string',},
|
||||
content: {title: '备注信息',order: 1,view: 'text', type: 'string',},
|
||||
filePath: {title: '附件信息',order: 2,view: 'text', type: 'string',},
|
||||
nuId: {title: 'NUID',order: 3,view: 'text', type: 'string',},
|
||||
};
|
|
@ -0,0 +1,224 @@
|
|||
<template>
|
||||
<div class="p-2">
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" >
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<IotDeviceContentModal ref="registerModal" @success="handleSuccess"></IotDeviceContentModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="IotDeviceContent-iotDeviceContent" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns, superQuerySchema } from './IotDeviceContent.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './IotDeviceContent.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import IotDeviceContentModal from './components/IotDeviceContentModal.vue'
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const orgInfo = ref<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '物联设备同步备注信息',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
useSearchForm: false,
|
||||
immediate: false,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: "物联设备同步备注信息",
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
});
|
||||
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,
|
||||
});
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
var params = { orgCode: orgInfo.value.orgCode,nuId: orgInfo.value.nuId }
|
||||
console.log("🚀 ~ handleAdd ~ params:", params)
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.add(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'IotDeviceContent:nu_iot_device_content:delete'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
function init(record) {
|
||||
console.log("🚀 ~ init ~ record:", record)
|
||||
orgInfo.value = record;
|
||||
queryParam.orgCode = record.orgCode;
|
||||
queryParam.nuId = record.nuId;
|
||||
reload();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</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%;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,82 @@
|
|||
<template>
|
||||
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
|
||||
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
|
||||
<IotDeviceContentList ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></IotDeviceContentList>
|
||||
<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>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import IotDeviceContentList from './IotDeviceContentList.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function init(record) {
|
||||
title.value = '日志信息';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.init(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
|
@ -0,0 +1,163 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<JFormContainer :disabled="disabled">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="IotDeviceContentForm">
|
||||
<a-row>
|
||||
<a-col :span="24" >
|
||||
<a-form-item label="机构编码" v-bind="validateInfos.orgCode" id="IotDeviceContentForm-orgCode" name="orgCode">
|
||||
<a-input v-model:value="formData.orgCode" placeholder="请输入机构编码" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="备注信息" v-bind="validateInfos.content" id="IotDeviceContentForm-content" name="content">
|
||||
<a-textarea v-model:value="formData.content" placeholder="请输入备注信息" maxlength="100" :showCount="true" allow-clear ></a-textarea>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" hidden>
|
||||
<a-form-item label="附件信息" v-bind="validateInfos.filePath" id="IotDeviceContentForm-filePath" name="filePath">
|
||||
<a-input v-model:value="formData.filePath" placeholder="请输入附件信息" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" >
|
||||
<a-form-item label="NUID" v-bind="validateInfos.nuId" id="IotDeviceContentForm-nuId" name="nuId">
|
||||
<a-input v-model:value="formData.nuId" placeholder="请输入NUID" allow-clear ></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 { saveOrUpdate } from '../IotDeviceContent.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: '',
|
||||
orgCode: '',
|
||||
content: '',
|
||||
filePath: '',
|
||||
nuId: '',
|
||||
});
|
||||
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 = reactive({
|
||||
});
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return props.formDisabled;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add(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 saveOrUpdate(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>
|
||||
.antd-modal-form {
|
||||
padding: 14px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,83 @@
|
|||
<template>
|
||||
|
||||
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
|
||||
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
|
||||
<IotDeviceContentForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></IotDeviceContentForm>
|
||||
<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>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import IotDeviceContentForm from './IotDeviceContentForm.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add(record) {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
|
@ -14,7 +14,7 @@
|
|||
</template>
|
||||
<a-row>
|
||||
<a-col :span="12" style="margin-top: -10px;">
|
||||
<span style="text-align: right;background:#f6f6f6;padding: 2px 10px;border-radius:5px;">NUID: {{item.nuId?item.nuId:'未配置'}}</span>
|
||||
NUID: {{item.nuId?item.nuId:'未配置'}}
|
||||
</a-col>
|
||||
<a-col :span="12" style="margin-top: -10px;">
|
||||
用电量:{{item.eleValue?item.eleValue:'0.0'}}KWH
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<a-button type="primary" @click="checkDb" preIcon="ant-design:plus-outlined" style="margin-left:10px;"> 电表</a-button>
|
||||
<a-button type="primary" @click="checkSb" preIcon="ant-design:plus-outlined" style="margin-left:10px;"> 水表</a-button>
|
||||
<a-button type="primary" @click="checkWsdj" preIcon="ant-design:plus-outlined" style="margin-left:10px;"> 温湿度计</a-button>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:sync-outlined" style="margin-left:10px;"> 同步</a-button>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:snippets-outlined" style="margin-left:10px;"> 日志</a-button>
|
||||
<a-button type="primary" @click="handleSync" preIcon="ant-design:sync-outlined" style="margin-left:10px;"> 同步</a-button>
|
||||
<a-button type="primary" @click="handleAddContent" preIcon="ant-design:snippets-outlined" style="margin-left:10px;"> 日志</a-button>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-row>
|
||||
|
@ -22,6 +22,7 @@
|
|||
<CheckDbModal ref="checkDbModal" @success="handleDbSuccess"/>
|
||||
<CheckSbModal ref="checkSbModal" @success="handleSbSuccess"/>
|
||||
<CheckWsdjModal ref="checkWsdjModal" @success="handleWsdjSuccess"/>
|
||||
<IotDeviceContentListModal ref="iotDeviceContentListModal" />
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
|
@ -32,7 +33,7 @@ import { useMessage } from '/@/hooks/web/useMessage';
|
|||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { addNuIot } from '../DeviceSync.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import { Form,Modal } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import SxtList from '/@/views/deviceSync/compoents/SxtList.vue'
|
||||
import DbList from '/@/views/deviceSync/compoents/DbList.vue'
|
||||
|
@ -42,6 +43,8 @@ import CheckSxtModal from '/@/views/deviceSync/compoents/CheckSxtModal.vue'
|
|||
import CheckDbModal from '/@/views/deviceSync/compoents/CheckDbModal.vue'
|
||||
import CheckSbModal from '/@/views/deviceSync/compoents/CheckSbModal.vue'
|
||||
import CheckWsdjModal from '/@/views/deviceSync/compoents/CheckWsdjModal.vue'
|
||||
import IotDeviceContentListModal from '/@/views/deviceSync/IotDeviceContent/IotDeviceContentListModal.vue'
|
||||
import { set } from 'lodash-es';
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
|
@ -54,6 +57,7 @@ const checkSxtModal = ref();
|
|||
const checkDbModal = ref();
|
||||
const checkSbModal = ref();
|
||||
const checkWsdjModal = ref();
|
||||
const iotDeviceContentListModal = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const formData = reactive<Record<string, any>>({
|
||||
|
@ -89,7 +93,24 @@ const disabled = computed(() => {
|
|||
}
|
||||
return props.formDisabled;
|
||||
});
|
||||
|
||||
function handleSync(){
|
||||
Modal.confirm({
|
||||
title: '物联设备同步',
|
||||
content: '是否要进行物联设备同步?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
var params = { nuId: nuInfo.value.nuId };
|
||||
await defHttp.get({url: '/iot/syncbiz/syncIot',params}).then((res) => {
|
||||
console.log("🚀 ~ handleSync ~ res:", res)
|
||||
setTimeout(() => {
|
||||
reload();
|
||||
}, 2000);
|
||||
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
//选择温湿度计
|
||||
function checkWsdj(){
|
||||
checkWsdjModal.value.disabled = true;
|
||||
|
@ -173,6 +194,14 @@ function handleWsdjSuccess(record) {
|
|||
});
|
||||
console.log("🚀 ~ handleDbSuccess ~ params:", params)
|
||||
}
|
||||
//添加日志
|
||||
function handleAddContent(){
|
||||
var params = {nuId:nuInfo.value.nuId,orgCode:nuInfo.value.sysOrgCode}
|
||||
console.log("🚀 ~ handleAddContent ~ nuInfo.value:", nuInfo.value)
|
||||
console.log("🚀 ~ handleAddContent ~ params:", params)
|
||||
iotDeviceContentListModal.value.disableSubmit = false;
|
||||
iotDeviceContentListModal.value.init(params)
|
||||
}
|
||||
function hadleSuccess(){
|
||||
reload();
|
||||
}
|
||||
|
@ -189,7 +218,7 @@ function add(record) {
|
|||
}
|
||||
|
||||
function reload() {
|
||||
defHttp.get({ url: '/iot/ddvicesIot/list', params: { nuId: nuInfo.value.nuId } }).then((res) => {
|
||||
defHttp.get({ url: '/iot/devicesIot/list', params: { nuId: nuInfo.value.nuId } }).then((res) => {
|
||||
console.log("🚀 ~ reload ~ res:", res)
|
||||
dataList.value = res;
|
||||
});
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<div style="width: 236px;float:left;">
|
||||
<a-menu
|
||||
style="width: 236px;margin-top: -11px;border-radius: 8px;"
|
||||
mode="inline"
|
||||
v-model:selectedKeys="current"
|
||||
>
|
||||
<a-sub-menu :key="item.nuId" v-for="(item,index) in dataList" @titleClick="handleSblist(item.map,'all','')">
|
||||
<template #title >NUID:{{item.nuId}}</template>
|
||||
<a-menu-item @click="handleSblist(item.map,'1',itemA.id)" :key="itemA.id" v-for="(itemA,index) in item.map.cameraInfoList" >{{itemA.sn}}[摄像头]</a-menu-item>
|
||||
<a-menu-item @click="handleSblist(item.map,'2',itemB.id)" :key="itemB.id" v-for="(itemB,index) in item.map.electricityMeterList" >{{itemB.cid}}[电表]</a-menu-item>
|
||||
<a-menu-item @click="handleSblist(item.map,'3',itemC.id)" :key="itemC.id" v-for="(itemC,index) in item.map.humidDeviceList" >{{itemC.sn}}[温湿度计]</a-menu-item>
|
||||
<a-menu-item @click="handleSblist(item.map,'4',itemD.id)" :key="itemD.id" v-for="(itemD,index) in item.map.waterMeterList" >{{itemD.cid}}[水表]</a-menu-item>
|
||||
|
||||
<a-menu-item :key="item.id" @click="handleSblist(null,'all','')" v-if="getSblb(item)" >暂无数据</a-menu-item>
|
||||
</a-sub-menu>
|
||||
</a-menu>
|
||||
</div>
|
||||
<div style="width: calc(100% - 236px);float:left;margin-top: -21px;">
|
||||
<a-row>
|
||||
<SxtList :tableData="sbList.cameraInfoList" @ok="hadleSuccess"></SxtList>
|
||||
<DbList :tableData="sbList.electricityMeterList" @ok="hadleSuccess"></DbList>
|
||||
<SbList :tableData="sbList.waterMeterList" @ok="hadleSuccess"></SbList>
|
||||
<WsdjList :tableData="sbList.humidDeviceList" @ok="hadleSuccess"></WsdjList>
|
||||
</a-row>
|
||||
<a-row v-if="sbList.cameraInfoList.length==0 && sbList.electricityMeterList.length==0 && sbList.waterMeterList.length==0 && sbList.humidDeviceList.length==0">
|
||||
<a-col>
|
||||
<a-empty></a-empty>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</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 JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { addNuIot } from '../DeviceSync.api';
|
||||
import { Form,Modal } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import SxtList from '/@/views/deviceSync/compoents/SxtList.vue'
|
||||
import DbList from '/@/views/deviceSync/compoents/DbList.vue'
|
||||
import SbList from '/@/views/deviceSync/compoents/SbList.vue'
|
||||
import WsdjList from '/@/views/deviceSync/compoents/WsdjList.vue'
|
||||
import { set } from 'lodash-es';
|
||||
|
||||
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const nuInfo = ref<any>({})
|
||||
const dataList = ref<any>([])
|
||||
const sbList = ref<any>({cameraInfoList:[], waterMeterList:[], electricityMeterList:[], humidDeviceList:[]})
|
||||
const { createMessage } = useMessage();
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
const rootSubmenuKeys = [];
|
||||
const openKeys= ref<any>([]);
|
||||
const selectedKeys= [];
|
||||
|
||||
const current = ref<string[]>([]);
|
||||
function hadleSuccess(){
|
||||
reload();
|
||||
}
|
||||
|
||||
function getSblb(item){
|
||||
var listA = item.map.cameraInfoList;
|
||||
var listB = item.map.electricityMeterList;
|
||||
var listC = item.map.humidDeviceList;
|
||||
var listD = item.map.waterMeterList;
|
||||
if(!listA && !listB && !listC && !listD){
|
||||
return true;
|
||||
}else if(listA.length == 0 && listB.length == 0 && listC.length == 0 && listD.length == 0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
function init(record) {
|
||||
console.log("🚀 ~ add ~ record:", record)
|
||||
nextTick(() => {
|
||||
nuInfo.value = record;
|
||||
reload();
|
||||
});
|
||||
}
|
||||
|
||||
function reload() {
|
||||
sbList.value = {}
|
||||
defHttp.get({ url: '/iot/devicesIot/priviewList', params: { orgCode: nuInfo.value.orgCode } }).then((res) => {
|
||||
console.log("🚀 ~ reload ~ res:", res)
|
||||
dataList.value = res;
|
||||
if(res.length>0){
|
||||
sbList.value = res[0].map;
|
||||
openKeys.value.push(res[1].nuId) ;
|
||||
console.log("🚀 ~ reload ~ sbList.value:", sbList.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
function handleSblist(dataSource,type,deviceId){
|
||||
console.log("🚀 ~ handleSblist ~ type:", type)
|
||||
sbList.value = {cameraInfoList:[], waterMeterList:[], electricityMeterList:[], humidDeviceList:[]};
|
||||
if(type == 'all'){
|
||||
if(dataSource){
|
||||
sbList.value = dataSource;
|
||||
}
|
||||
}else if(type == '1'){
|
||||
sbList.value.cameraInfoList = dataSource.cameraInfoList.filter(item=>item.id == deviceId);
|
||||
}else if(type == '2'){
|
||||
sbList.value.electricityMeterList = dataSource.electricityMeterList.filter(item=>item.id == deviceId);
|
||||
}else if(type == '3'){
|
||||
sbList.value.humidDeviceList = dataSource.humidDeviceList.filter(item=>item.id == deviceId);
|
||||
}else if(type == '4'){
|
||||
sbList.value.waterMeterList = dataSource.waterMeterList.filter(item=>item.id == deviceId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.antd-modal-form {
|
||||
padding: 14px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,70 @@
|
|||
<template>
|
||||
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
|
||||
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
|
||||
<DevicesPriviewForm ref="devicesPriviewRef" @ok="submitCallback" :orgCode="orgCode" :formDisabled="disableSubmit"
|
||||
:formBpm="false"></DevicesPriviewForm>
|
||||
<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>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import DevicesPriviewForm from './DevicesPriviewForm.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<string>('90%');
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const devicesPriviewRef = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function init(record) {
|
||||
title.value = '预览';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
devicesPriviewRef.value.init(record);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
|
@ -14,7 +14,7 @@
|
|||
</template>
|
||||
<a-row>
|
||||
<a-col :span="12" style="margin-top: -10px;">
|
||||
<span style="text-align: right;background:#f6f6f6;padding: 2px 10px;border-radius:5px;">NUID: {{item.nuId?item.nuId:'未配置'}}</span>
|
||||
NUID: {{item.nuId?item.nuId:'未配置'}}
|
||||
</a-col>
|
||||
<a-col :span="12" style="margin-top: -10px;">
|
||||
用水量:{{item.eleValue?item.eleValue:'0.0'}}m³
|
||||
|
@ -37,7 +37,7 @@
|
|||
</a-col>-->
|
||||
<a-col :span="24" style="text-align: center;margin-top: 20px;">
|
||||
<span style="display:inline-block;cursor: pointer;" @click="handleRead(item)">
|
||||
<span class="tbClass"><img src="../../../assets/iot/a1.png" style="width:20px;" /></span><br/>
|
||||
<span class="tbClass"><img src="../../../assets/iot/a11.png" style="width:20px;" /></span><br/>
|
||||
<span class="antTitle">抄表</span>
|
||||
</span>
|
||||
<span style="display:inline-block;cursor: pointer;margin-left:10px;" @click="handleDel(item)" v-if="item.syncType=='0'">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</template>
|
||||
<a-row>
|
||||
<a-col :span="24" style="margin-top: -10px;">
|
||||
<span style="text-align: right;background:#f6f6f6;padding: 2px 10px;border-radius:5px;">NUID: {{item.nuId?item.nuId:'未配置'}}</span>
|
||||
NUID: {{item.nuId?item.nuId:'未配置'}}
|
||||
</a-col>
|
||||
<a-col :span="12" style="text-align: left;margin-top: 10px;">
|
||||
同步状态:{{item.syncType =='1'?'已同步':'未同步'}}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</a-col>-->
|
||||
<a-col :span="24" style="text-align: center;margin-top: 20px;">
|
||||
<span style="display:inline-block;cursor: pointer;" @click="handleRead(item)">
|
||||
<span class="tbClass"><img src="../../../assets/iot/a1.png" style="width:20px;" /></span><br/>
|
||||
<span class="tbClass"><img src="../../../assets/iot/a7.png" style="width:20px;" /></span><br/>
|
||||
<span class="antTitle">抄表</span>
|
||||
</span>
|
||||
<span style="display:inline-block;cursor: pointer;margin-left:10px;" @click="handleDel(item)" v-if="item.syncType=='0'">
|
||||
|
|
|
@ -44,16 +44,16 @@
|
|||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
<p>加1盟时间:{{ item.franchiseTime?.substring(0, 10) }}</p>
|
||||
<p>加盟时间:{{ item.franchiseTime?.substring(0, 10) }}</p>
|
||||
<p>机构负责人:{{ item.orgLeader }}</p>
|
||||
<p>负责人电话:{{ item.orgLeaderPhone }}</p>
|
||||
<p :title="item.comRegisterAddress">
|
||||
机构地址:{{ item.comRegisterAddress }}</p>
|
||||
<a-divider />
|
||||
<div style="text-align: center;">
|
||||
<a-button type="primary" @click="handleOrgSelected(item)">预览</a-button>
|
||||
<a-button type="primary" @click="handlePrview(item)">预览</a-button>
|
||||
<a-button type="primary" @click="handleOrgSelected(item)" style="margin-left:10px;">配置</a-button>
|
||||
<a-button type="primary" @click="handleOrgSelected(item)" style="margin-left:10px;">日志</a-button>
|
||||
<a-button type="primary" @click="handleAddContent(item)" style="margin-left:10px;">日志</a-button>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
|
@ -78,7 +78,7 @@
|
|||
<a-row>
|
||||
<a-col :span="24" style="margin-bottom: 10px;">
|
||||
<a-button type="primary" @click="handleAddNuIot">添加区域</a-button>
|
||||
<a-button type="primary" style="margin-left: 10px;">设备预览</a-button>
|
||||
<a-button type="primary" @click="handlePrview(orgData)" style="margin-left: 10px;">设备预览</a-button>
|
||||
</a-col>
|
||||
<a-col v-for="(item,index) in nuDataList" style="padding: 5px" :key="index" :xs="24" :sm="24" :md="12" :lg="12" :xl="8" :xxl="6">
|
||||
<a-card :title="`NUID:`+item.nuId"
|
||||
|
@ -102,6 +102,8 @@
|
|||
</div>
|
||||
<AddNuIotModal ref="addNuIotModal" @success="handleNuSuccess"/>
|
||||
<DevicesModal ref="devicesModal" @success="handleNuSuccess"/>
|
||||
<IotDeviceContentListModal ref="iotDeviceContentListModal" />
|
||||
<DevicesPriviewModal ref="devicesPriviewRef" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="synchronization-directive" setup>
|
||||
|
@ -112,7 +114,8 @@ import { Pagination } from 'ant-design-vue'
|
|||
import {getOrgInfo} from './DeviceSync.api'
|
||||
import AddNuIotModal from './compoents/AddNuIotModal.vue'
|
||||
import DevicesModal from './compoents/DevicesModal.vue'
|
||||
|
||||
import IotDeviceContentListModal from './IotDeviceContent/IotDeviceContentListModal.vue'
|
||||
import DevicesPriviewModal from '/@/views/deviceSync/compoents/DevicesPriviewModal.vue'
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
const emit = defineEmits(['orgChanged']);
|
||||
|
@ -142,17 +145,34 @@ const orgData = ref<OrganizationData | null>(null);
|
|||
const orgSelectedCon = ref(true);
|
||||
const addNuIotModal = ref();
|
||||
const devicesModal = ref();
|
||||
const iotDeviceContentListModal = ref();
|
||||
const devicesPriviewRef = ref();
|
||||
const nuDataList = ref([]);
|
||||
const isSelected = ref(false);
|
||||
|
||||
// 当前选中的卡片 ID 数组
|
||||
const selectedOrgs = ref<string[]>([])
|
||||
|
||||
//预览机构设备架构
|
||||
function handlePrview(record){
|
||||
console.log("🚀 ~ handlePrview ~ record:", record)
|
||||
var params = {orgCode: record.orgCode}
|
||||
console.log("🚀 ~ handlePrview ~ params:", params)
|
||||
devicesPriviewRef.value.init(params);
|
||||
devicesPriviewRef.value.disableSubmit = true;
|
||||
}
|
||||
//添加区域
|
||||
function handleAddNuIot(){
|
||||
addNuIotModal.value.disableSubmit = false;
|
||||
addNuIotModal.value.add(orgData.value)
|
||||
}
|
||||
|
||||
//添加日志
|
||||
function handleAddContent(record){
|
||||
var params = {orgCode:record.orgCode}
|
||||
console.log("🚀 ~ handleAddContent ~ params:", params)
|
||||
iotDeviceContentListModal.value.disableSubmit = false;
|
||||
iotDeviceContentListModal.value.init(params)
|
||||
}
|
||||
//设备管理
|
||||
function handleSbgl(item){
|
||||
item.departId = orgData.value.orgId;
|
||||
item.departName = orgData.value.departName;
|
||||
|
|
Loading…
Reference in New Issue