物联设备-设备管理-新增批次/设备清单/编辑界面调整:最上方展示批次清单相关信息,下方列表展示原(设备管理)列表,主界面点确认后统一调用接口保存,其余操作均为界面临时存储
This commit is contained in:
parent
2400c2a27c
commit
6320e28f20
|
|
@ -0,0 +1,215 @@
|
|||
<template>
|
||||
<div class="p-2">
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" :model="queryParam" :label-col="labelCol"
|
||||
:wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="orgCode">
|
||||
<template #label><span title="机构编码">机构编码</span></template>
|
||||
<a-input v-model:value="queryParam.orgCode" placeholder="请输入机构编码" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="departName">
|
||||
<template #label><span title="机构名称">机构名称</span></template>
|
||||
<a-input v-model:value="queryParam.departName" placeholder="请输入机构名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||
style="margin-left: 8px">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- <DepartPreviewModal ref="previewDrawer" @success="handleSuccess" />-->
|
||||
<DeviceBatchListModal ref="previewDrawer" @success="handleSuccess" />
|
||||
<DeviceIntegrationModal ref="registerDrawer" @success="handleSuccess" />
|
||||
<DeviceLogModal ref="logDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iot-nuIotElectricitynInfo" setup>
|
||||
import {reactive, ref,h} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {list} from './manager.api';
|
||||
import { columns, searchFormSchema } from './manager.data';
|
||||
import {useModal} from "@/components/Modal";
|
||||
// import DepartPreviewModal from "./components/preview/DepartPreviewModal.vue";
|
||||
import DeviceBatchListModal from "./components/batch/DeviceBatchListModal.vue";
|
||||
import DeviceIntegrationModal from "./components/integration/DeviceIntegrationModal.vue";
|
||||
import DeviceLogModal from "./components/log/DeviceLogModal.vue";
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const previewDrawer = ref();
|
||||
const registerDrawer = ref();
|
||||
const logDrawer = ref();
|
||||
const tipVisible = ref(false);
|
||||
//注册model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
||||
tableProps:{
|
||||
title: '物联设备管理',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
useSearchForm: false,
|
||||
showIndexColumn: true,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 290,
|
||||
fixed:'right'
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
const labelCol = reactive({
|
||||
xs:24,
|
||||
sm:4,
|
||||
xl:6,
|
||||
xxl:4
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 20,
|
||||
});
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
function handleCancel() {
|
||||
tipVisible.value = false;
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
console.log(111111111);
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
{
|
||||
label: '设备清单',
|
||||
onClick: handleDeviceList.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '设备集成',
|
||||
onClick: handleDeviceIntegration.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '设备日志',
|
||||
onClick: handleDeviceLog.bind(null, record),
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
// function handleAdd() {
|
||||
// registerDrawer.value.disableSubmit = false;
|
||||
// registerDrawer.value.add();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 新增清单
|
||||
*/
|
||||
function handleDeviceList(record: Recordable) {
|
||||
previewDrawer.value.disableSubmit = true;
|
||||
previewDrawer.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备集成
|
||||
*/
|
||||
function handleDeviceIntegration(record: Recordable) {
|
||||
registerDrawer.value.disableSubmit = true;
|
||||
registerDrawer.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备日志
|
||||
*/
|
||||
function handleDeviceLog(record: Recordable) {
|
||||
logDrawer.value.disableSubmit = true;
|
||||
logDrawer.value.edit(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%;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<div style="background-color: white;border-radius: 10px;margin-bottom: 14px;padding-right: 14px;">
|
||||
<JFormContainer>
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="批次编号" v-bind="validateInfos.batchNo" id="deviceBatchForm-batchNo" name="batchNo">
|
||||
<a-input v-model:value="formData.batchNo" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="机构编码" v-bind="validateInfos.orgCode" id="deviceBatchForm-orgCode" name="orgCode">
|
||||
<a-input v-model:value="formData.orgCode" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="机构名称" v-bind="validateInfos.departName" id="deviceBatchForm-departName"
|
||||
:labelCol="labelCol2" :wrapperCol="wrapperCol2" name="departName">
|
||||
<a-input v-model:value="formData.departName" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="创建时间" v-bind="validateInfos.createTime" id="deviceBatchForm-createTime"
|
||||
name="createTime">
|
||||
<a-input v-model:value="formData.createTime" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="是否推送" v-bind="validateInfos.izPush" id="deviceBatchForm-izPush" name="izPush">
|
||||
<a-input :value="formData.izPush == 'Y' ? '已推送' : '未推送'" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="备注" v-bind="validateInfos.remarks" id="deviceBatchForm-remarks" name="remarks"
|
||||
:labelCol="labelCol2" :wrapperCol="wrapperCol2">
|
||||
<a-textarea v-model:value="formData.remarks" :auto-size="{ minRows: 1, maxRows: 6 }"
|
||||
:disabled="disabled"></a-textarea>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!--
|
||||
<a-col :span="12">
|
||||
<a-form-item label="创建人" v-bind="validateInfos.createBy" id="deviceBatchForm-createBy" name="createBy">
|
||||
<a-input v-model:value="formData.createBy" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col> -->
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
</div>
|
||||
<div>
|
||||
<NuPreviewList ref="registerForm" :formBpm="false" />
|
||||
</div>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted, unref } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { getBatchNo, saveOrUpdate } from './batch.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';
|
||||
import { nulist } from "@/views/iotManager/manager.api";
|
||||
import NuPreviewList from '../preview/NuPreviewList.vue'
|
||||
|
||||
const isUpdate = ref<boolean>(false);
|
||||
const orgCode = ref<any>('');
|
||||
const deviceConfigs = ref([]);
|
||||
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: undefined,
|
||||
orgCode: undefined,
|
||||
departName: undefined,
|
||||
batchNo: undefined,
|
||||
izPush: undefined,
|
||||
remarks: undefined,
|
||||
createTime: undefined
|
||||
});
|
||||
const registerForm = ref();
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 7 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 18 } });
|
||||
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 4 } });
|
||||
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 20 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = {
|
||||
};
|
||||
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;
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
async function add(record) {
|
||||
orgCode.value = record.orgCode;
|
||||
formData.orgCode = record.orgCode;
|
||||
formData.departName = record.departName;
|
||||
formData.izPush = 'N';
|
||||
formData.createTime = new Date().toISOString().slice(0, 10)
|
||||
isUpdate.value = false;
|
||||
await getBatchNo(record).then((res) => {
|
||||
formData.batchNo = res.batchNo;
|
||||
});
|
||||
nextTick(() => {
|
||||
registerForm.value.init({
|
||||
orgCode: record.orgCode,
|
||||
batchNo: '',
|
||||
izPush: 'N'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
orgCode.value = record.orgCode;
|
||||
isUpdate.value = true;
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
//赋值
|
||||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if (record.hasOwnProperty(key)) {
|
||||
tmpData[key] = record[key]
|
||||
}
|
||||
})
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
|
||||
registerForm.value.init({
|
||||
orgCode: record.orgCode,
|
||||
batchNo: record.batchNo,
|
||||
izPush: record.izPush
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
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;
|
||||
//时间格式化
|
||||
let model = formData;
|
||||
//循环数据
|
||||
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(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
let isUpdateVal = unref(isUpdate);
|
||||
await saveOrUpdate(model, isUpdateVal)
|
||||
.then((res) => {
|
||||
emit('ok');
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
<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>
|
||||
<DeviceBatchForm v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||
:formBpm="false">
|
||||
</DeviceBatchForm>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import DeviceBatchForm from './DeviceBatchForm.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(1200);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const configVisible = ref<boolean>(false);
|
||||
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>
|
||||
|
|
@ -0,0 +1,263 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="batchNo">
|
||||
<template #label><span title="批次编号">批次编号</span></template>
|
||||
<a-input v-model:value="queryParam.batchNo" placeholder="请输入批次编号" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="izPush">
|
||||
<template #label><span title="推送状态">推送状态</span></template>
|
||||
<a-select v-model:value="queryParam.izPush" placeholder="请选择推送状态" allow-clear>
|
||||
<a-select-option value="Y">已推送</a-select-option>
|
||||
<a-select-option value="N">未推送</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||
style="margin-left: 8px">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="addBatch"> 新增批次</a-button>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
</a-spin>
|
||||
<!-- 表单区域 -->
|
||||
<DeviceBatchFormModal ref="deviceBatchDrawer" @success="handleSuccess" />
|
||||
<DepartPreviewModal ref="previewDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iotManager-areaList" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, createVNode } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './batch.data';
|
||||
import { batchList, deleteBatch, sendBatch } from './batch.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import DeviceBatchFormModal from './DeviceBatchFormModal.vue';
|
||||
import DepartPreviewModal from "../preview/DepartPreviewModal.vue";
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { changeTheme } from "@/logics/theme";
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const deviceBatchDrawer = ref();
|
||||
const previewDrawer = ref();
|
||||
const orgCode = ref<any>('');
|
||||
const departName = ref<any>('');
|
||||
const confirmLoading = ref<any>(false);
|
||||
const izShow = ref<any>(true);
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '设备批次清单',
|
||||
api: batchList,
|
||||
columns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
showIndexColumn: true,
|
||||
immediate: false,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 240,
|
||||
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: 8,
|
||||
xl: 8,
|
||||
xxl: 8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
function addBatch() {
|
||||
let record = {
|
||||
orgCode: orgCode.value,
|
||||
departName: departName.value
|
||||
}
|
||||
deviceBatchDrawer.value.disableSubmit = false;
|
||||
deviceBatchDrawer.value.add(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清单
|
||||
*/
|
||||
function handlePreview(record: Recordable) {
|
||||
previewDrawer.value.disableSubmit = true;
|
||||
previewDrawer.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送
|
||||
*/
|
||||
async function handleSend(record: Recordable) {
|
||||
izShow.value = false;
|
||||
confirmLoading.value = true;
|
||||
await sendBatch(record).then((res) => {
|
||||
setTimeout(() => {
|
||||
reload();
|
||||
}, 8000);
|
||||
}).finally(() => {
|
||||
setTimeout(() => {
|
||||
confirmLoading.value = false;
|
||||
}, 8000);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
deviceBatchDrawer.value.disableSubmit = false;
|
||||
deviceBatchDrawer.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
async function handleDelete(record: Recordable) {
|
||||
await deleteBatch(record);
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '设备清单',
|
||||
onClick: handlePreview.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '推送清单',
|
||||
onClick: handleSend.bind(null, record),
|
||||
ifShow: record.izPush == 'N' && record.childrenCn > 0
|
||||
},
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
ifShow: record.izPush == 'N'
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确定删除?',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
ifShow: record.izPush == 'N'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
queryParam.orgCode = orgCode.value;
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
//刷新数据
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
//初始化
|
||||
function init(record) {
|
||||
orgCode.value = record.orgCode;
|
||||
departName.value = record.departName
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
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,83 @@
|
|||
<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>
|
||||
<DeviceBatchList v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||
:formBpm="false">
|
||||
</DeviceBatchList>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import DeviceBatchList from './DeviceBatchList.vue'
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(1200);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
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.init(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
emit('success');
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
batchList = '/iot/device/manager/batchList',
|
||||
getBatchNo = '/iot/device/manager/getBatchNo',
|
||||
addBatch = '/iot/device/manager/addBatch',
|
||||
editBatch = '/iot/device/manager/editBatch',
|
||||
deleteBatch = '/iot/device/manager/deleteBatch',
|
||||
sendBatch = '/iot/device/manager/sendBatch',
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
*/
|
||||
export const batchList = (params) => defHttp.get({ url: Api.batchList, params });
|
||||
export const getBatchNo = (params) => defHttp.get({ url: Api.getBatchNo, params });
|
||||
/**
|
||||
* 保存
|
||||
* @param id
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.editBatch : Api.addBatch;
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
export const deleteBatch = (params) => defHttp.post({ url: Api.deleteBatch, params });
|
||||
|
||||
export const sendBatch = (params) => defHttp.post({ url: Api.sendBatch, params });
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
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: 'departName',
|
||||
},
|
||||
{
|
||||
title: '批次号',
|
||||
align: "center",
|
||||
dataIndex: 'batchNo',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '是否推送',
|
||||
align: "center",
|
||||
dataIndex: 'izPush',
|
||||
customRender:({record})=>{
|
||||
if(record.izPush=='Y'){
|
||||
return "已推送";
|
||||
}else{
|
||||
return "未推送";
|
||||
}
|
||||
},
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '创建日期',
|
||||
align: "center",
|
||||
dataIndex: 'createTime',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
align: "center",
|
||||
dataIndex: 'createBy',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
align: "center",
|
||||
dataIndex: 'remarks'
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [];
|
||||
|
|
@ -0,0 +1,198 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
<template #deviceStatus="{ record }">
|
||||
<span v-if="record.deviceStatus === '待集成'" style="color:red">
|
||||
{{ record.deviceStatus }}
|
||||
</span>
|
||||
</template>
|
||||
<template #maintainStatus="{ record }">
|
||||
<span v-if="record.maintainStatus === '损坏'" style="color:red">
|
||||
{{ record.maintainStatus }}
|
||||
</span>
|
||||
<span v-if="record.maintainStatus == null || record.maintainStatus == ''">
|
||||
-
|
||||
</span>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<CameraPreviewModal ref="previewModal"></CameraPreviewModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="DeviceManager-Camera" setup>
|
||||
import { ref, reactive} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { deviceColumns } from './integration.data';
|
||||
import {cameraList, pullRecorder,pullCamera} from './integration.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import CameraPreviewModal from '/@/views/iot/tplink/camera/components/CameraPreviewModal.vue'
|
||||
const previewModal = ref();
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '监控设备',
|
||||
api: cameraList,
|
||||
columns: deviceColumns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
immediate: false,
|
||||
showActionColumn: true,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
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: 8,
|
||||
xl: 6,
|
||||
xxl: 8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览
|
||||
*/
|
||||
function handlePreview(record: Recordable) {
|
||||
if (record.deviceIndex == null) {
|
||||
return
|
||||
}
|
||||
record.streamType = 1;
|
||||
previewModal.value.disableSubmit = true;
|
||||
previewModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取设备
|
||||
*/
|
||||
async function handlePull(record: Recordable) {
|
||||
if(record.deviceType == 'NETWORKVIDEORECORDER'){
|
||||
await pullRecorder(record).then((res) => {
|
||||
setTimeout(() => {
|
||||
reload();
|
||||
}, 8000);
|
||||
})
|
||||
}else{
|
||||
await pullCamera(record).then((res) => {
|
||||
setTimeout(() => {
|
||||
reload();
|
||||
}, 4000);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '拉取设备',
|
||||
onClick: handlePull.bind(null, record),
|
||||
ifShow: record.sn != null && record.deviceStatus =='待集成' && record.maintainStatus !='损坏'
|
||||
},
|
||||
{
|
||||
label: '预览',
|
||||
onClick: handlePreview.bind(null, record),
|
||||
ifShow: record.deviceType == 'SURVEILLANCECAMERA' && record.deviceStatus !='待集成' && record.maintainStatus !='损坏'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function init(record) {
|
||||
queryParam.orgCode = record.orgCode;
|
||||
reload();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
margin-bottom: 14px;
|
||||
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 14px;
|
||||
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: 14px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
:deep(.ant-picker),
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
<template>
|
||||
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
|
||||
:footer-style="{ textAlign: 'right' }" :bodyStyle="{ padding: '14px' }" @close="handleCancel">
|
||||
<a-tabs v-model:activeKey="activeKey" type="card" @change="handleChange">
|
||||
<a-tab-pane key="1" tab="监控设备">
|
||||
<CameraList ref="CameraListModal"></CameraList>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="网络设备" force-render>
|
||||
<NetworkList ref="NetworkListModal"></NetworkList>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3" tab="智能电表" force-render>
|
||||
<ElectricityList ref="ElectricityListModal"></ElectricityList>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="4" tab="智能水表" force-render>
|
||||
<WaterList ref="WaterListModal"></WaterList>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="5" tab="温湿度计" force-render>
|
||||
<HumidList ref="HumidListModal"></HumidList>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<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 CameraList from './CameraList.vue'
|
||||
import NetworkList from './NetworkList.vue'
|
||||
import ElectricityList from './ElectricityList.vue'
|
||||
import WaterList from './WaterList.vue'
|
||||
import HumidList from './HumidList.vue'
|
||||
// import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const CameraListModal = ref();
|
||||
const NetworkListModal = ref();
|
||||
const ElectricityListModal = ref();
|
||||
const WaterListModal = ref();
|
||||
const HumidListModal = ref();
|
||||
const activeKey = ref('1');
|
||||
const dbsbInfo = ref<any>({});
|
||||
const title = ref<string>('');
|
||||
const width = ref<string>('1200');
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
async function edit(record) {
|
||||
visible.value = true;
|
||||
title.value = '设备集成';
|
||||
nextTick(() => {
|
||||
activeKey.value = "1";
|
||||
getDataList(activeKey.value, record);
|
||||
dbsbInfo.value = record;
|
||||
});
|
||||
}
|
||||
|
||||
function getDataList(type, record) {
|
||||
if (type == '1') {
|
||||
CameraListModal.value.init(record);
|
||||
} else if (type == '2') {
|
||||
NetworkListModal.value.init(record);
|
||||
} else if (type == '3') {
|
||||
ElectricityListModal.value.init(record);
|
||||
} else if (type == '4') {
|
||||
WaterListModal.value.init(record);
|
||||
} else if (type == '5') {
|
||||
HumidListModal.value.init(record);
|
||||
}
|
||||
}
|
||||
|
||||
function handleChange(key) {
|
||||
activeKey.value = key;
|
||||
getDataList(key, dbsbInfo.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback(params) {
|
||||
handleCancel();
|
||||
emit('success', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
<template #deviceStatus="{ record }">
|
||||
<span v-if="record.deviceStatus === '待集成'" style="color:red">
|
||||
{{ record.deviceStatus }}
|
||||
</span>
|
||||
</template>
|
||||
<template #maintainStatus="{ record }">
|
||||
<span v-if="record.maintainStatus === '损坏'" style="color:red">
|
||||
{{ record.maintainStatus }}
|
||||
</span>
|
||||
<span v-if="record.maintainStatus == null || record.maintainStatus == ''">
|
||||
-
|
||||
</span>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="DeviceManager-Electricity" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { deviceColumns } from './integration.data';
|
||||
import { electricityList,pullElectricity } from './integration.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import {sendBatch} from "@/views/device/manager/components/batch/batch.api";
|
||||
const previewModal = ref();
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '电表设备',
|
||||
api: electricityList,
|
||||
columns: deviceColumns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
immediate: false,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
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: 8,
|
||||
xl: 6,
|
||||
xxl: 8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取设备
|
||||
*/
|
||||
async function handlePull(record: Recordable) {
|
||||
await pullElectricity(record).then((res) => {
|
||||
setTimeout(() => {
|
||||
reload();
|
||||
}, 4000);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '拉取设备',
|
||||
onClick: handlePull.bind(null, record),
|
||||
ifShow: record.sn != null && record.deviceStatus =='待集成' && record.maintainStatus !='损坏'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function init(record) {
|
||||
queryParam.orgCode = record.orgCode;
|
||||
reload();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
margin-bottom: 14px;
|
||||
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 14px;
|
||||
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: 14px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
:deep(.ant-picker),
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
<template #deviceStatus="{ record }">
|
||||
<span v-if="record.deviceStatus === '待集成'" style="color:red">
|
||||
{{ record.deviceStatus }}
|
||||
</span>
|
||||
</template>
|
||||
<template #maintainStatus="{ record }">
|
||||
<span v-if="record.maintainStatus === '损坏'" style="color:red">
|
||||
{{ record.maintainStatus }}
|
||||
</span>
|
||||
<span v-if="record.maintainStatus == null || record.maintainStatus == ''">
|
||||
-
|
||||
</span>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<HumidFormModal ref="configModal"></HumidFormModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="DeviceManager-Electricity" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import HumidFormModal from './components/HumidFormModal.vue'
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { deviceColumns } from './integration.data';
|
||||
import {humidList, pullHumid} from './integration.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const previewModal = ref();
|
||||
const formRef = ref();
|
||||
const configModal = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '温湿度计',
|
||||
api: humidList,
|
||||
columns: deviceColumns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
immediate: false,
|
||||
showActionColumn: true,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
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: 8,
|
||||
xl: 6,
|
||||
xxl: 8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览
|
||||
*/
|
||||
function handleConfig(record: Recordable) {
|
||||
configModal.value.disableSubmit = false;
|
||||
configModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取设备
|
||||
*/
|
||||
async function handlePull(record: Recordable) {
|
||||
await pullHumid(record).then((res) => {
|
||||
setTimeout(() => {
|
||||
reload();
|
||||
}, 4000);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '拉取设备',
|
||||
onClick: handlePull.bind(null, record),
|
||||
ifShow: record.sn != null && record.deviceStatus =='待集成' && record.maintainStatus !='损坏'
|
||||
},
|
||||
{
|
||||
label: '配置',
|
||||
onClick: handleConfig.bind(null, record),
|
||||
ifShow: record.deviceStatus !='待集成' && record.maintainStatus !='损坏'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function init(record) {
|
||||
queryParam.orgCode = record.orgCode;
|
||||
reload();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
margin-bottom: 14px;
|
||||
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 14px;
|
||||
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: 14px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
:deep(.ant-picker),
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
<template #deviceStatus="{ record }">
|
||||
<span v-if="record.deviceStatus === '待集成'" style="color:red">
|
||||
{{ record.deviceStatus }}
|
||||
</span>
|
||||
</template>
|
||||
<template #maintainStatus="{ record }">
|
||||
<span v-if="record.maintainStatus === '损坏'" style="color:red">
|
||||
{{ record.maintainStatus }}
|
||||
</span>
|
||||
<span v-if="record.maintainStatus == null || record.maintainStatus == ''">
|
||||
-
|
||||
</span>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="DeviceManager-Network" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { deviceColumns } from './integration.data';
|
||||
import {networkList, pullNetwork} from './integration.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const previewModal = ref();
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '网络设备',
|
||||
api: networkList,
|
||||
columns: deviceColumns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
immediate: false,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
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: 8,
|
||||
xl: 6,
|
||||
xxl: 8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取设备
|
||||
*/
|
||||
async function handlePull(record: Recordable) {
|
||||
await pullNetwork(record).then((res) => {
|
||||
setTimeout(() => {
|
||||
reload();
|
||||
}, 4000);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '拉取设备',
|
||||
onClick: handlePull.bind(null, record),
|
||||
ifShow: record.sn != null && record.deviceStatus =='待集成' && record.maintainStatus !='损坏'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function init(record) {
|
||||
queryParam.orgCode = record.orgCode;
|
||||
reload();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
margin-bottom: 14px;
|
||||
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 14px;
|
||||
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: 14px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
:deep(.ant-picker),
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
<template #deviceStatus="{ record }">
|
||||
<span v-if="record.deviceStatus === '待集成'" style="color:red">
|
||||
{{ record.deviceStatus }}
|
||||
</span>
|
||||
</template>
|
||||
<template #maintainStatus="{ record }">
|
||||
<span v-if="record.maintainStatus === '损坏'" style="color:red">
|
||||
{{ record.maintainStatus }}
|
||||
</span>
|
||||
<span v-if="record.maintainStatus == null || record.maintainStatus == ''">
|
||||
-
|
||||
</span>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="DeviceManager-Electricity" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { deviceColumns } from './integration.data';
|
||||
import {pullWater, waterList} from './integration.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const previewModal = ref();
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '水表设备',
|
||||
api: waterList,
|
||||
columns: deviceColumns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
immediate: false,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
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: 8,
|
||||
xl: 6,
|
||||
xxl: 8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取设备
|
||||
*/
|
||||
async function handlePull(record: Recordable) {
|
||||
await pullWater(record).then((res) => {
|
||||
setTimeout(() => {
|
||||
reload();
|
||||
}, 4000);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '拉取设备',
|
||||
onClick: handlePull.bind(null, record),
|
||||
ifShow: record.sn != null && record.deviceStatus =='待集成' && record.maintainStatus !='损坏'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function init(record) {
|
||||
queryParam.orgCode = record.orgCode;
|
||||
reload();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
init,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
margin-bottom: 14px;
|
||||
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 14px;
|
||||
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: 14px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
:deep(.ant-picker),
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,310 @@
|
|||
<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-number v-model:value="formData.recordInterval" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="上报间隔(分钟)">
|
||||
<a-input-number v-model:value="formData.reportingInterval" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="历史上报时刻(00:00)">
|
||||
<a-input v-model:value="formData.historyReportTime"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="历史上报间隔(小时)">
|
||||
<a-input-number v-model:value="formData.historyInterval" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="温度预警-上限">
|
||||
<a-input-number v-model:value="formData.temperatureHigh" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="温度预警-下限">
|
||||
<a-input-number v-model:value="formData.temperatureLow" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="温度缓冲值">
|
||||
<a-input-number v-model:value="formData.temperatureBuffer" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="湿度预警-上限">
|
||||
<a-input-number v-model:value="formData.humidityHigh" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="湿度预警-下限">
|
||||
<a-input-number v-model:value="formData.humidityLow" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="湿度缓冲值">
|
||||
<a-input-number v-model:value="formData.humidityBuffer" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="断电报警开关">
|
||||
<a-select v-model:value="formData.izOutages" placeholder="请选择断电报警开关">
|
||||
<a-select-option value="0">开启</a-select-option>
|
||||
<a-select-option value="1">关闭</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="低电报警开关">
|
||||
<a-select v-model:value="formData.izLowBattery" placeholder="请选择低电报警开关">
|
||||
<a-select-option value="0">开启</a-select-option>
|
||||
<a-select-option value="1">关闭</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="上下线通知开关">
|
||||
<a-select v-model:value="formData.izOnline" placeholder="请选择上下线通知开关">
|
||||
<a-select-option value="0">开启</a-select-option>
|
||||
<a-select-option value="1">关闭</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row >
|
||||
<a-col :span="24">
|
||||
<a-form-item label="读取设备参数">
|
||||
<a-button preIcon="ant-design:appstore-outlined" @click="readParameters(formData.sn)">读取</a-button>
|
||||
</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 { getDeviceInfo, getDeviceParameters, updateDevice } from '@/views/iot/yiweilian/humid/humid.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: '',
|
||||
sn: '',
|
||||
recordInterval: '',
|
||||
reportingInterval: '',
|
||||
historyReportTime: '',
|
||||
historyInterval: '',
|
||||
temperatureHigh: '',
|
||||
temperatureLow: '',
|
||||
temperatureBuffer: '',
|
||||
humidityHigh: '',
|
||||
humidityLow: '',
|
||||
humidityBuffer: '',
|
||||
izOutages: '',
|
||||
izLowBattery: '',
|
||||
izOnline: '',
|
||||
});
|
||||
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 = {
|
||||
requestUrl: [{ required: true, message: '请输入云平台地址!'},],
|
||||
clientId: [{ 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) {
|
||||
getInfo(record);
|
||||
// nextTick(() => {
|
||||
// resetFields();
|
||||
// //赋值
|
||||
// const tmpData = {};
|
||||
// Object.keys(formData).forEach((key) => {
|
||||
// if(record.hasOwnProperty(key)){
|
||||
// tmpData[key] = record[key]
|
||||
// }
|
||||
// })
|
||||
// //赋值
|
||||
// Object.assign(formData, tmpData);
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取设备信息
|
||||
* @param record
|
||||
*/
|
||||
function getInfo(record){
|
||||
getDeviceInfo({
|
||||
"sn":record.sn
|
||||
}).then(res=> {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
//赋值
|
||||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if(res.hasOwnProperty(key)){
|
||||
tmpData[key] = res[key]
|
||||
}
|
||||
})
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取参数
|
||||
* @param record
|
||||
*/
|
||||
function readParameters(sn){
|
||||
confirmLoading.value = true;
|
||||
getDeviceParameters({
|
||||
"sn":sn
|
||||
}).then(res=> {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
//赋值
|
||||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if(res.hasOwnProperty(key)){
|
||||
tmpData[key] = res[key]
|
||||
}
|
||||
})
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
});
|
||||
}).finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
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 updateDevice(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,84 @@
|
|||
<template>
|
||||
<a-drawer :title="title" :width="width" :visible="visible" :closable="true"
|
||||
:footer-style="{ textAlign: 'right' }" :bodyStyle="{ padding: '14px' }" @close="handleCancel">
|
||||
<HumidForm ref="formRef" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false">
|
||||
</HumidForm>
|
||||
<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 HumidForm from './HumidForm.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<string>('800');
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const formRef = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
title.value = '新增配置';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
formRef.value.add();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '配置详情' : '编辑配置';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
formRef.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback(params) {
|
||||
handleCancel();
|
||||
emit('success', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
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>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
cameraList = '/iot/device/manager/cameraList',
|
||||
networkList = '/iot/device/manager/networkList',
|
||||
electricityList = '/iot/device/manager/electricityList',
|
||||
waterList = '/iot/device/manager/waterList',
|
||||
humidList = '/iot/device/manager/humidList',
|
||||
|
||||
pullRecorder = '/iot/device/manager/pullRecorder',
|
||||
pullCamera = '/iot/device/manager/pullCamera',
|
||||
pullNetwork = '/iot/device/manager/pullNetwork',
|
||||
pullElectricity = '/iot/device/manager/pullElectricity',
|
||||
pullWater = '/iot/device/manager/pullWater',
|
||||
pullHumid = '/iot/device/manager/pullHumid',
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
*/
|
||||
export const cameraList = (params) => defHttp.get({ url: Api.cameraList, params });
|
||||
export const networkList = (params) => defHttp.get({ url: Api.networkList, params });
|
||||
export const electricityList = (params) => defHttp.get({ url: Api.electricityList, params });
|
||||
export const waterList = (params) => defHttp.get({ url: Api.waterList, params });
|
||||
export const humidList = (params) => defHttp.get({ url: Api.humidList, params });
|
||||
|
||||
export const pullRecorder = (params) => defHttp.post({ url: Api.pullRecorder, params });
|
||||
export const pullCamera = (params) => defHttp.post({ url: Api.pullCamera, params });
|
||||
export const pullNetwork = (params) => defHttp.post({ url: Api.pullNetwork, params });
|
||||
export const pullElectricity = (params) => defHttp.post({ url: Api.pullElectricity, params });
|
||||
export const pullWater = (params) => defHttp.post({ url: Api.pullWater, params });
|
||||
export const pullHumid = (params) => defHttp.post({ url: Api.pullHumid, params });
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
|
||||
//列表数据
|
||||
export const deviceColumns: BasicColumn[] = [
|
||||
{
|
||||
title: '设备维度',
|
||||
align: "center",
|
||||
dataIndex: 'dimension',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '设备标识',
|
||||
align: "center",
|
||||
dataIndex: 'sn',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '设备名称',
|
||||
align: "center",
|
||||
dataIndex: 'deviceName',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '设备类型',
|
||||
align: "center",
|
||||
dataIndex: 'deviceType_dictText',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '设备型号',
|
||||
align: "center",
|
||||
dataIndex: 'deviceModel',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '生产厂家',
|
||||
align: "center",
|
||||
dataIndex: 'factory',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '在线状态',
|
||||
align: "center",
|
||||
dataIndex: 'deviceStatus',
|
||||
slots: { customRender: 'deviceStatus' },
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '设备状态',
|
||||
align: "center",
|
||||
dataIndex: 'maintainStatus',
|
||||
slots: { customRender: 'maintainStatus' },
|
||||
width: 80
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [];
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" :model="queryParam" :label-col="labelCol"
|
||||
:wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="deviceName">
|
||||
<template #label><span title="设备名称">设备名称</span></template>
|
||||
<a-input v-model:value="queryParam.deviceName" placeholder="请输入设备名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="dimension">
|
||||
<template #label><span title="设备维度">设备维度</span></template>
|
||||
<a-select v-model:value="queryParam.dimension" placeholder="请选择设备维度" allow-clear>
|
||||
<a-select-option value="机构维度">机构维度</a-select-option>
|
||||
<a-select-option value="区域维度">区域维度</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="deviceType">
|
||||
<template #label><span title="设备类型">设备类型</span></template>
|
||||
<j-dict-select-tag v-model:value="queryParam.deviceType" :showLabel="false" dictCode="tplink_device_type" placeholder="请选择设备类型" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||
style="margin-left: 8px">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iot-weihu" setup>
|
||||
import {onMounted, reactive, ref} from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { list } from './log.api';
|
||||
import { columns} from './log.data';
|
||||
import { useDrawer } from "@/components/Drawer";
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
|
||||
const formRef = ref();
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
const queryParam = reactive<any>({});
|
||||
const selectedRows = ref<any[]>([]);
|
||||
const remarksModal = ref();
|
||||
//注册table数据
|
||||
const { prefixCls,tableContext } = useListPage({
|
||||
tableProps:{
|
||||
title: '设备日志',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
showIndexColumn: true,
|
||||
showActionColumn: false,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 90,
|
||||
fixed:'right'
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
})
|
||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
const labelCol = reactive({
|
||||
xs:24,
|
||||
sm:8,
|
||||
xl:8,
|
||||
xxl:8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 20,
|
||||
});
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
function init(record) {
|
||||
console.log("🚀 ~ init ~ record:", record)
|
||||
queryParam.orgCode = record.orgCode;
|
||||
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" :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>
|
||||
<DeviceLogList v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||
:formBpm="false">
|
||||
</DeviceLogList>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import DeviceLogList from './DeviceLogList.vue'
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(1200);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
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.init(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>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/iot/device/manager/bingLogList',
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '区域编码',
|
||||
align: "center",
|
||||
dataIndex: 'nuId',
|
||||
customRender:({record})=>{
|
||||
if(record.nuId==null || record.nuId==''){
|
||||
return "-";
|
||||
}else{
|
||||
return record.nuId;
|
||||
}
|
||||
},
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '区域名称',
|
||||
align: "center",
|
||||
dataIndex: 'nuName',
|
||||
customRender:({record})=>{
|
||||
if(record.nuName==null || record.nuName==''){
|
||||
return "-";
|
||||
}else{
|
||||
return record.nuName;
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '设备维度',
|
||||
align: "center",
|
||||
dataIndex: 'dimension',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '设备名称',
|
||||
align: "center",
|
||||
dataIndex: 'deviceName',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '设备类型',
|
||||
align: "center",
|
||||
dataIndex: 'deviceType_dictText',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '设备型号',
|
||||
align: "center",
|
||||
dataIndex: 'deviceModel',
|
||||
},
|
||||
{
|
||||
title: '设备标识',
|
||||
align: "center",
|
||||
dataIndex: 'sn',
|
||||
},
|
||||
{
|
||||
title: '生产厂家',
|
||||
align: "center",
|
||||
dataIndex: 'factory',
|
||||
},
|
||||
{
|
||||
title: '操作时间',
|
||||
align: "center",
|
||||
dataIndex: 'optDate',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '操作类型',
|
||||
align: "center",
|
||||
dataIndex: 'optType',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
align: "center",
|
||||
dataIndex: 'remarks',
|
||||
width: 200
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [];
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
<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="选择设备" v-bind="validateInfos.deviceName" id="departPreviewForm-deviceName" name="deviceName">
|
||||
<a-select ref="select" :disabled="isUpdate"
|
||||
placeholder="请选择设备"
|
||||
v-model:value="formData.deviceName" @change="handleChange">
|
||||
<a-select-option :value="item.deviceName" v-for="item in deviceConfigs" :key="item.id">{{item.deviceName}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备类型" v-bind="validateInfos.deviceType" id="departPreviewForm-deviceType" name="deviceType">
|
||||
<j-dict-select-tag v-model:value="formData.deviceType" dictCode="tplink_device_type" disabled allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="规格型号" v-bind="validateInfos.deviceModel" id="departPreviewForm-deviceModel" name="deviceModel">
|
||||
<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="生产厂家" v-bind="validateInfos.factory" id="departPreviewForm-factory" name="factory">
|
||||
<a-input v-model:value="formData.factory" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备维度" v-bind="validateInfos.dimension" id="departPreviewForm-dimension" name="dimension">
|
||||
<a-input v-model:value="formData.dimension" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="采购数量" v-bind="validateInfos.purchaseQuantity" id="departPreviewForm-purchaseQuantity" name="purchaseQuantity">
|
||||
<a-input-number v-model:value="formData.purchaseQuantity" style="width: 100%"></a-input-number>
|
||||
</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, unref} from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { configList,savePreview } from './preview.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';
|
||||
import {nulist} from "@/views/iotManager/manager.api";
|
||||
const isUpdate = ref<boolean>(false);
|
||||
const orgCode = ref<any>('');
|
||||
const batchNo = ref<any>('');
|
||||
const deviceConfigs = ref([]);
|
||||
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: undefined,
|
||||
orgCode: undefined,
|
||||
batchNo: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
deviceModel: undefined,
|
||||
factory: undefined,
|
||||
dimension: "机构维度",
|
||||
purchaseQuantity: undefined
|
||||
});
|
||||
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 = {
|
||||
deviceName: [{ required: true, message: '请选择设备!'},],
|
||||
purchaseQuantity: [{ required: true, message: '请输入采购数量!'},],
|
||||
};
|
||||
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;
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
async function add(record) {
|
||||
getDeviceConfig();
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
formData.orgCode = record.orgCode;
|
||||
formData.batchNo = record.batchNo;
|
||||
isUpdate.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
async function edit(record) {
|
||||
getDeviceConfig();
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
isUpdate.value = true;
|
||||
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;
|
||||
//时间格式化
|
||||
let model = formData;
|
||||
//循环数据
|
||||
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(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
let isUpdateVal = unref(isUpdate);
|
||||
await savePreview(model,isUpdateVal)
|
||||
.then((res) => {
|
||||
emit('ok');
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
function getDeviceConfig(){
|
||||
let params = {'dimension': '机构维度'};
|
||||
configList(params)
|
||||
.then((res) => {
|
||||
deviceConfigs.value = res;
|
||||
}).catch(() =>{})
|
||||
.finally(() => {
|
||||
});
|
||||
}
|
||||
|
||||
function handleChange(key,record) {
|
||||
let vo = deviceConfigs.value.filter(item => item.id == record.key);
|
||||
formData.deviceType = vo[0]["deviceType"];
|
||||
formData.deviceModel = vo[0]["deviceModel"];
|
||||
formData.factory = vo[0]["factory"];
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
<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>
|
||||
<AddDepartPreviewForm v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||
:formBpm="false">
|
||||
</AddDepartPreviewForm>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import AddDepartPreviewForm from './AddDepartPreviewForm.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 configVisible = ref<boolean>(false);
|
||||
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>
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
<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="选择区域" v-bind="validateInfos.nuId" id="nuPreviewForm-nuId" name="nuId">
|
||||
<a-select ref="select" :disabled="isUpdate"
|
||||
placeholder="请选择区域"
|
||||
v-model:value="formData.nuId">
|
||||
<a-select-option :value="item.nuId" v-for="item in nuInfos" :key="item.nuId">{{item.nuName}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="选择设备" v-bind="validateInfos.deviceName" id="nuPreviewForm-deviceName" name="deviceName">
|
||||
<a-select ref="select" :disabled="isUpdate"
|
||||
placeholder="请选择设备"
|
||||
v-model:value="formData.deviceName" @change="handleChange">
|
||||
<a-select-option :value="item.deviceName" v-for="item in deviceConfigs" :key="item.id">{{item.deviceName}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备类型" v-bind="validateInfos.deviceType" id="nuPreviewForm-deviceType" name="deviceType">
|
||||
<j-dict-select-tag v-model:value="formData.deviceType" dictCode="tplink_device_type" disabled allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="规格型号" v-bind="validateInfos.deviceModel" id="departPreviewForm-deviceModel" name="deviceModel">
|
||||
<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="生产厂家" v-bind="validateInfos.factory" id="nuPreviewForm-factory" name="factory">
|
||||
<a-input v-model:value="formData.factory" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="设备维度" v-bind="validateInfos.dimension" id="nuPreviewForm-dimension" name="dimension">
|
||||
<a-input v-model:value="formData.dimension" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="采购数量" v-bind="validateInfos.purchaseQuantity" id="nuPreviewForm-purchaseQuantity" name="purchaseQuantity">
|
||||
<a-input-number v-model:value="formData.purchaseQuantity" style="width: 100%"></a-input-number>
|
||||
</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, unref} from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { nuList,configList,savePreview } from './preview.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 isUpdate = ref<boolean>(false);
|
||||
const orgCode = ref<any>('');
|
||||
const batchNo = ref<any>('');
|
||||
const deviceConfigs = ref([]);
|
||||
const nuInfos = ref([]);
|
||||
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: undefined,
|
||||
orgCode: undefined,
|
||||
nuId: undefined,
|
||||
batchNo: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
deviceModel: undefined,
|
||||
factory: undefined,
|
||||
dimension: "区域维度",
|
||||
purchaseQuantity: undefined
|
||||
});
|
||||
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 = {
|
||||
nuId: [{ required: true, message: '请选择区域!'},],
|
||||
deviceName: [{ required: true, message: '请选择设备!'},],
|
||||
purchaseQuantity: [{ required: true, message: '请输入采购数量!'},],
|
||||
};
|
||||
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;
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
async function add(record) {
|
||||
getNuInfos(record);
|
||||
getDeviceConfig();
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
formData.orgCode = record.orgCode;
|
||||
formData.batchNo = record.batchNo;
|
||||
isUpdate.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
async function edit(record) {
|
||||
getNuInfos(record);
|
||||
getDeviceConfig();
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
isUpdate.value = true;
|
||||
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;
|
||||
//时间格式化
|
||||
let model = formData;
|
||||
|
||||
//循环数据
|
||||
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(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
let isUpdateVal = unref(isUpdate);
|
||||
await savePreview(model,isUpdateVal)
|
||||
.then((res) => {
|
||||
emit('ok');
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
function getDeviceConfig(){
|
||||
let params = {'dimension': '区域维度'};
|
||||
configList(params)
|
||||
.then((res) => {
|
||||
deviceConfigs.value = res;
|
||||
}).catch(() =>{})
|
||||
.finally(() => {
|
||||
});
|
||||
}
|
||||
|
||||
function handleChange(key,record) {
|
||||
let vo = deviceConfigs.value.filter(item => item.id == record.key);
|
||||
formData.deviceType = vo[0]["deviceType"];
|
||||
formData.deviceModel = vo[0]["deviceModel"];
|
||||
formData.factory = vo[0]["factory"];
|
||||
}
|
||||
|
||||
async function getNuInfos(record){
|
||||
let params = {'orgCode': record.orgCode };
|
||||
nuInfos.value = await nuList(params);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,624 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-row style="margin-top: -4px;">
|
||||
<a-col v-for="(item, index) in nuInfos" style="padding:7px 7px;" :key="index" :span="24">
|
||||
<a-card :class="['card-3d', { 'card-collapsed': expandedCard !== item.nuId }]"
|
||||
style="height: auto; min-height: 320px;" @click="handleCardClick(item.nuId, $event)">
|
||||
<!-- 卡片头部:可点击展开 -->
|
||||
<div class="card-header">
|
||||
<div class="left-area">
|
||||
<div class="left-area">
|
||||
<div class="region-name">名称:{{ item.nuName }}</div>
|
||||
<div class="region-code">NUID:{{ item.nuId }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 展开时显示收起按钮,收起时显示展开图标 -->
|
||||
<div class="expand-icon" v-if="expandedCard === item.nuId">
|
||||
<span>▲ 收起</span>
|
||||
</div>
|
||||
<div class="expand-icon" v-else>
|
||||
<span>▼ 展开</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 卡片内容:只有展开的卡片才显示 -->
|
||||
<div class="card-content" v-if="expandedCard === item.nuId" @click.stop>
|
||||
<!-- 上半部分:左右布局 -->
|
||||
<div class="top-section">
|
||||
<!-- 右侧:其他内容区域 -->
|
||||
<div class="right-area">
|
||||
<div>基础功能:</div>
|
||||
<span v-for="(item2, index) in areaFuncInfo[item.nuId].children" :key="index">
|
||||
<a-checkbox style="margin-top:10px;" checked readonly disabled>{{ item2.nuName }}</a-checkbox>
|
||||
</span>
|
||||
<span v-for="(item2, index) in areaFuncInfo[item.nuId].children" :key="index">
|
||||
<div v-if="item2.children.length > 0">
|
||||
<div style="margin-top: 20px;">{{ item2.nuName }}:</div>
|
||||
<span v-for="(item3, index) in item2.children" :key="index">
|
||||
<a-checkbox style="margin-top:10px;" checked readonly disabled>{{ item3.nuName }}</a-checkbox>
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
<span v-if="areaFuncInfo[item.nuId].children.length == 0">暂无基础功能</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 下半部分:设备列表(无内部滚动) -->
|
||||
<div class="bottom-section">
|
||||
<div class="section-title">设备配置</div>
|
||||
<div class="device-list">
|
||||
<div v-for="(device, dIndex) in deviceConfigs" :key="dIndex" class="device-item">
|
||||
<div class="device-info">
|
||||
<div class="device-name">{{ device.deviceName }}</div>
|
||||
<div class="device-detail">
|
||||
{{ device.factory }}<span v-if="device.factory && device.deviceModel"> | </span>{{
|
||||
device.deviceModel }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="device-quantity">
|
||||
<a-input-number :value="getQuantity(item.nuId, device.id)"
|
||||
@update:value="(val) => setQuantity(item.nuId, device.id, val)" :min="0" :precision="0" :step="1"
|
||||
:disabled="disabled" :placeholder="'请输入数量'" class="quantity-input" />
|
||||
</div>
|
||||
</div>
|
||||
<a-empty v-if="!deviceConfigs.length" description="暂无设备配置" :image-style="{ height: '60px' }" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :span="24" v-if="nuInfos.length == 0" style="margin-top:50px;">
|
||||
<a-empty description="暂无数据" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, computed } from 'vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { nuList, configList, batchSave, queryQuantityByOrgCode, getNuListByOrgCode } from './preview.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
|
||||
// 定义数据类型
|
||||
interface DeviceConfig {
|
||||
id: string;
|
||||
deviceName: string;
|
||||
deviceType: string;
|
||||
deviceModel: string;
|
||||
factory: string;
|
||||
dimension: string;
|
||||
}
|
||||
|
||||
interface NuInfo {
|
||||
nuId: string;
|
||||
nuName: string;
|
||||
}
|
||||
|
||||
interface SavedData {
|
||||
id: string;
|
||||
nuId: string;
|
||||
deviceType: string;
|
||||
purchaseQuantity: number;
|
||||
}
|
||||
|
||||
interface QuantityData {
|
||||
quantity: number;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
const isUpdate = ref<boolean>(false);
|
||||
const orgCode = ref<string>('');
|
||||
const batchNo = ref<string>('');
|
||||
const deviceConfigs = ref<DeviceConfig[]>([]);
|
||||
const nuInfos = ref<NuInfo[]>([]);
|
||||
|
||||
// 当前展开的卡片ID,默认第一个
|
||||
const expandedCard = ref<string>('');
|
||||
|
||||
// 存储每个卡片的采购数量: Map<nuId, Map<deviceId, QuantityData>>
|
||||
const cardQuantities = ref<Map<string, Map<string, QuantityData>>>(new Map());
|
||||
|
||||
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: undefined,
|
||||
orgCode: undefined,
|
||||
nuId: undefined,
|
||||
batchNo: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
deviceModel: undefined,
|
||||
factory: undefined,
|
||||
dimension: "区域维度",
|
||||
purchaseQuantity: undefined
|
||||
});
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
const configData = ref<SavedData[]>([]);
|
||||
const areaFuncInfo = ref()
|
||||
|
||||
// 表单验证
|
||||
const validatorRules = {
|
||||
nuId: [{ required: true, message: '请选择区域!' }],
|
||||
deviceName: [{ required: true, message: '请选择设备!' }],
|
||||
purchaseQuantity: [{ required: true, message: '请输入采购数量!' }],
|
||||
};
|
||||
|
||||
const { resetFields, validate } = 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 handleCardClick(nuId: string, event: Event) {
|
||||
// 检查点击目标是否可能是可交互元素
|
||||
const target = event.target as HTMLElement;
|
||||
const isInputElement = target.tagName === 'INPUT' ||
|
||||
target.tagName === 'BUTTON' ||
|
||||
target.closest('.ant-input-number') ||
|
||||
target.closest('.ant-checkbox-wrapper') ||
|
||||
target.closest('button');
|
||||
|
||||
// 如果点击的是输入框、按钮等交互元素,且当前卡片是展开状态,则不触发展开/收起
|
||||
if (isInputElement && expandedCard.value === nuId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 否则执行展开/收起逻辑
|
||||
expandCard(nuId);
|
||||
}
|
||||
|
||||
// 展开/收起卡片
|
||||
function expandCard(nuId: string) {
|
||||
// 如果点击的是已经展开的卡片,则收起
|
||||
if (expandedCard.value === nuId) {
|
||||
expandedCard.value = '';
|
||||
return;
|
||||
}
|
||||
// 否则展开当前卡片
|
||||
expandedCard.value = nuId;
|
||||
}
|
||||
|
||||
// 获取指定卡片、指定设备的数量
|
||||
function getQuantity(nuId: string, deviceId: string): number {
|
||||
const nuMap = cardQuantities.value.get(nuId);
|
||||
if (!nuMap) return 0;
|
||||
const data = nuMap.get(deviceId);
|
||||
return data?.quantity ?? 0;
|
||||
}
|
||||
|
||||
// 设置指定卡片、指定设备的数量
|
||||
function setQuantity(nuId: string, deviceId: string, value: number | undefined) {
|
||||
const intValue = Math.max(0, Math.floor(value || 0));
|
||||
|
||||
let nuMap = cardQuantities.value.get(nuId);
|
||||
if (!nuMap) {
|
||||
nuMap = new Map();
|
||||
cardQuantities.value.set(nuId, nuMap);
|
||||
}
|
||||
|
||||
const existing = nuMap.get(deviceId);
|
||||
if (existing) {
|
||||
existing.quantity = intValue;
|
||||
} else {
|
||||
nuMap.set(deviceId, {
|
||||
quantity: intValue,
|
||||
id: undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 从已保存配置中填充数量到卡片
|
||||
function fillQuantitiesFromConfig() {
|
||||
if (!configData.value || configData.value.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 先清空现有数据
|
||||
cardQuantities.value.clear();
|
||||
|
||||
// 遍历已保存的数据
|
||||
for (const savedItem of configData.value) {
|
||||
const { nuId, deviceType, purchaseQuantity, id } = savedItem;
|
||||
|
||||
// 通过 deviceType 找到对应的设备
|
||||
const matchedDevice = deviceConfigs.value.find(device => device.deviceType === deviceType);
|
||||
|
||||
if (matchedDevice && nuId) {
|
||||
let nuMap = cardQuantities.value.get(nuId);
|
||||
if (!nuMap) {
|
||||
nuMap = new Map();
|
||||
cardQuantities.value.set(nuId, nuMap);
|
||||
}
|
||||
|
||||
nuMap.set(matchedDevice.id, {
|
||||
quantity: purchaseQuantity || 0,
|
||||
id: id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
console.log("填充后的 cardQuantities:", cardQuantities.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
async function add(record: any) {
|
||||
await getNuInfos(record);
|
||||
await getDeviceConfig();
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
formData.orgCode = record.orgCode;
|
||||
formData.batchNo = record.batchNo;
|
||||
isUpdate.value = false;
|
||||
|
||||
// 重置所有卡片的采购数量
|
||||
cardQuantities.value.clear();
|
||||
|
||||
configData.value = await queryQuantityByOrgCodeFunc();
|
||||
console.log("新增 - 已保存数据:", configData.value);
|
||||
|
||||
areaFuncInfo.value = await getNuListByOrgCodeFunc();
|
||||
console.log("🌊 ~ add ~ areaFuncInfo.value:", areaFuncInfo.value);
|
||||
|
||||
// 默认展开第一个卡片
|
||||
if (nuInfos.value.length > 0) {
|
||||
expandedCard.value = nuInfos.value[0].nuId;
|
||||
}
|
||||
|
||||
// 填充已保存的数据到卡片
|
||||
fillQuantitiesFromConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
async function edit(record: any) {
|
||||
await getNuInfos(record);
|
||||
await getDeviceConfig();
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
isUpdate.value = true;
|
||||
|
||||
nextTick(async () => {
|
||||
resetFields();
|
||||
// 赋值
|
||||
const tmpData: Record<string, any> = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if (record.hasOwnProperty(key)) {
|
||||
tmpData[key] = record[key];
|
||||
}
|
||||
});
|
||||
Object.assign(formData, tmpData);
|
||||
|
||||
configData.value = await queryQuantityByOrgCodeFunc();
|
||||
console.log("编辑 - 已保存数据:", configData.value);
|
||||
|
||||
areaFuncInfo.value = await getNuListByOrgCodeFunc();
|
||||
console.log("🌊 ~ edit ~ areaFuncInfo.value:", areaFuncInfo.value);
|
||||
|
||||
// 默认展开第一个卡片
|
||||
if (nuInfos.value.length > 0) {
|
||||
expandedCard.value = nuInfos.value[0].nuId;
|
||||
}
|
||||
|
||||
// 填充已保存的数据到卡片
|
||||
fillQuantitiesFromConfig();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitForm() {
|
||||
if (!deviceConfigs.value.length) {
|
||||
createMessage.warning('请先加载设备配置');
|
||||
return Promise.reject('无设备配置');
|
||||
}
|
||||
|
||||
confirmLoading.value = true;
|
||||
|
||||
try {
|
||||
// 构建提交数据: nu数量 * device数量 = 所有组合
|
||||
const submitRecords: any[] = [];
|
||||
|
||||
for (const nu of nuInfos.value) {
|
||||
for (const device of deviceConfigs.value) {
|
||||
const nuMap = cardQuantities.value.get(nu.nuId);
|
||||
const quantityData = nuMap?.get(device.id);
|
||||
const quantity = quantityData?.quantity ?? 0;
|
||||
const savedId = quantityData?.id;
|
||||
|
||||
submitRecords.push({
|
||||
id: savedId, // 如果有 id 说明是更新,没有则是新增
|
||||
orgCode: formData.orgCode,
|
||||
batchNo: formData.batchNo,
|
||||
nuId: nu.nuId,
|
||||
deviceName: device.deviceName,
|
||||
deviceType: device.deviceType,
|
||||
deviceModel: device.deviceModel,
|
||||
factory: device.factory,
|
||||
dimension: formData.dimension,
|
||||
purchaseQuantity: quantity
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
console.log("提交数据:", submitRecords);
|
||||
console.log("共提交条数:", submitRecords.length);
|
||||
|
||||
await batchSave(submitRecords);
|
||||
emit('ok');
|
||||
} catch (error) {
|
||||
createMessage.error('提交失败');
|
||||
console.error(error);
|
||||
return Promise.reject(error);
|
||||
} finally {
|
||||
confirmLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function getDeviceConfig() {
|
||||
const params = { dimension: '区域维度' };
|
||||
return configList(params)
|
||||
.then((res) => {
|
||||
deviceConfigs.value = res || [];
|
||||
console.log("设备配置:", deviceConfigs.value);
|
||||
})
|
||||
.catch(() => {
|
||||
deviceConfigs.value = [];
|
||||
});
|
||||
}
|
||||
|
||||
function handleChange(key: string, record: any) {
|
||||
const vo = deviceConfigs.value.filter(item => item.id === record.key);
|
||||
if (vo.length) {
|
||||
formData.deviceType = vo[0].deviceType;
|
||||
formData.deviceModel = vo[0].deviceModel;
|
||||
formData.factory = vo[0].factory;
|
||||
}
|
||||
}
|
||||
|
||||
async function getNuInfos(record: any) {
|
||||
const params = { orgCode: record.orgCode };
|
||||
nuInfos.value = await nuList(params);
|
||||
console.log("区域信息:", nuInfos.value);
|
||||
}
|
||||
|
||||
async function queryQuantityByOrgCodeFunc() {
|
||||
return await queryQuantityByOrgCode({ batchNo: formData.batchNo, orgCode: formData.orgCode });
|
||||
}
|
||||
|
||||
async function getNuListByOrgCodeFunc() {
|
||||
return await getNuListByOrgCode({ orgCode: formData.orgCode });
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/* 基础卡片样式 */
|
||||
.card-3d {
|
||||
border-radius: 12px;
|
||||
border: 1px solid #e8eef4;
|
||||
background: white;
|
||||
position: relative;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* 鼠标悬停效果 */
|
||||
.card-3d:hover {
|
||||
border-color: #1890ff;
|
||||
box-shadow: 0 4px 12px rgba(24, 144, 255, 0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
/* 收起状态样式 */
|
||||
.card-collapsed {
|
||||
min-height: auto !important;
|
||||
height: auto !important;
|
||||
|
||||
:deep(.ant-card-body) {
|
||||
padding: 16px 20px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 卡片内容区域 */
|
||||
:deep(.ant-card-body) {
|
||||
padding: 16px 20px;
|
||||
transition: padding 0.3s ease;
|
||||
}
|
||||
|
||||
/* 卡片头部的鼠标样式 */
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
cursor: inherit;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.card-header .left-area {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.region-name {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.region-code {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: darkgrey;
|
||||
}
|
||||
|
||||
.expand-icon {
|
||||
font-size: 14px;
|
||||
color: #1890ff;
|
||||
padding: 4px 12px;
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.card-header:hover .expand-icon {
|
||||
background-color: rgba(24, 144, 255, 0.1);
|
||||
}
|
||||
|
||||
/* 卡片内容容器 */
|
||||
.card-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
margin-top: 16px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid #f0f2f5;
|
||||
}
|
||||
|
||||
/* 上半部分 - 左右布局 */
|
||||
.top-section {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.right-area {
|
||||
flex: 3;
|
||||
background: #ffffff;
|
||||
padding: 12px;
|
||||
border-radius: 10px;
|
||||
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
|
||||
/* 下半部分 - 设备配置(无内部滚动) */
|
||||
.bottom-section {
|
||||
.section-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1f2f3d;
|
||||
margin-bottom: 12px;
|
||||
padding-left: 4px;
|
||||
border-left: 3px solid #1890ff;
|
||||
}
|
||||
}
|
||||
|
||||
.device-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.device-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 16px;
|
||||
background: #fafbfc;
|
||||
border-radius: 8px;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: #f5f8ff;
|
||||
transform: translateX(2px);
|
||||
}
|
||||
}
|
||||
|
||||
.device-info {
|
||||
flex: 1;
|
||||
|
||||
.device-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1f2f3d;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.device-detail {
|
||||
font-size: 12px;
|
||||
color: #8a9aa8;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
.device-quantity {
|
||||
margin-left: 16px;
|
||||
|
||||
.quantity-input {
|
||||
width: 130px;
|
||||
|
||||
:deep(.ant-input-number-input) {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 响应式调整 */
|
||||
@media (max-width: 768px) {
|
||||
.top-section {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.device-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.device-quantity {
|
||||
margin-left: 0;
|
||||
width: 100%;
|
||||
|
||||
.quantity-input {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 强制 checkbox 文字显示为黑色 */
|
||||
.right-area {
|
||||
|
||||
:deep(.ant-checkbox-wrapper),
|
||||
:deep(.ant-checkbox-wrapper-disabled),
|
||||
:deep(.ant-checkbox + span),
|
||||
:deep(.ant-checkbox-disabled + span) {
|
||||
color: rgba(0, 0, 0, 0.88) !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
<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>
|
||||
<AddNuPreviewForm v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||
:formBpm="false">
|
||||
</AddNuPreviewForm>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import AddNuPreviewForm from './AddNuPreviewForm.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 configVisible = ref<boolean>(false);
|
||||
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>
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" :model="queryParam" :label-col="labelCol"
|
||||
:wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="dimension">
|
||||
<template #label><span title="设备维度">设备维度</span></template>
|
||||
<a-select v-model:value="queryParam.dimension" placeholder="请选择设备维度" allow-clear>
|
||||
<a-select-option value="机构维度">机构维度</a-select-option>
|
||||
<a-select-option value="区域维度">区域维度</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="deviceType">
|
||||
<template #label><span title="设备类型">设备类型</span></template>
|
||||
<j-dict-select-tag v-model:value="queryParam.deviceType" :showLabel="false" dictCode="tplink_device_type" placeholder="请选择设备类型" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||
style="margin-left: 8px">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="addDepartDevice" v-if="izPush=='N'"> 机构维度</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="addNuDevice" v-if="izPush=='N'"> 区域维度</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="devicePreview"> 设备管理</a-button>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<AddDepartPreviewModal ref="addDepartPreviewDrawer" @success="handleSuccess" />
|
||||
<AddNuPreviewModal ref="addNuPreviewDrawer" @success="handleSuccess" />
|
||||
<NuPreviewModal ref="nuPreviewDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iotManager-areaList" setup>
|
||||
import {ref, reactive, defineExpose, nextTick, createVNode} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { departColumns } from './preview.data';
|
||||
import { departPreview } from './preview.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import AddDepartPreviewModal from './AddDepartPreviewModal.vue';
|
||||
import AddNuPreviewModal from './AddNuPreviewModal.vue';
|
||||
import NuPreviewModal from './NuPreviewModal.vue';
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const addDepartPreviewDrawer = ref();
|
||||
const addNuPreviewDrawer = ref();
|
||||
const nuPreviewDrawer = ref();
|
||||
const orgCode = ref<any>('');
|
||||
const batchNo = ref<any>('');
|
||||
const izPush = ref<any>('');
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '设备清单',
|
||||
api: departPreview,
|
||||
columns: departColumns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
showIndexColumn: true,
|
||||
showActionColumn: false,
|
||||
immediate: false,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 180,
|
||||
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:8,
|
||||
xl:8,
|
||||
xxl:8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构添加设备
|
||||
*/
|
||||
function addDepartDevice(){
|
||||
let record = {
|
||||
orgCode: orgCode.value,
|
||||
batchNo: batchNo.value
|
||||
}
|
||||
addDepartPreviewDrawer.value.disableSubmit = false;
|
||||
addDepartPreviewDrawer.value.add(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域添加设备
|
||||
*/
|
||||
function addNuDevice(){
|
||||
let record = {
|
||||
orgCode: orgCode.value,
|
||||
batchNo: batchNo.value
|
||||
}
|
||||
addNuPreviewDrawer.value.disableSubmit = false;
|
||||
addNuPreviewDrawer.value.add(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备预览
|
||||
*/
|
||||
function devicePreview(){
|
||||
let record ={
|
||||
orgCode: orgCode.value,
|
||||
batchNo: batchNo.value,
|
||||
izPush: izPush.value
|
||||
}
|
||||
nuPreviewDrawer.value.disableSubmit = true;
|
||||
nuPreviewDrawer.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
queryParam.orgCode = orgCode.value;
|
||||
queryParam.batchNo = batchNo.value;
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
//刷新数据
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
//初始化
|
||||
function init(record) {
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
izPush.value = record.izPush;
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
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,83 @@
|
|||
<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>
|
||||
<DepartPreviewList v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||
:formBpm="false">
|
||||
</DepartPreviewList>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import DepartPreviewList from './DepartPreviewList.vue'
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(1200);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
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.init(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
emit('success');
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
@ -0,0 +1,222 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" :model="queryParam" :label-col="labelCol"
|
||||
:wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="nuName">
|
||||
<template #label><span title="区域名称">区域名称</span></template>
|
||||
<a-input v-model:value="queryParam.nuName" placeholder="请输入区域名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="dimension">
|
||||
<template #label><span title="设备维度">设备维度</span></template>
|
||||
<a-select v-model:value="queryParam.dimension" placeholder="请选择设备维度" allow-clear>
|
||||
<a-select-option value="机构维度">机构维度</a-select-option>
|
||||
<a-select-option value="区域维度">区域维度</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="deviceType">
|
||||
<template #label><span title="设备类型">设备类型</span></template>
|
||||
<j-dict-select-tag v-model:value="queryParam.deviceType" :showLabel="false" dictCode="tplink_device_type" placeholder="请选择设备类型" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||
style="margin-left: 8px">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<AddDepartPreviewModal ref="addDepartPreviewDrawer" @success="handleSuccess" />
|
||||
<AddNuPreviewModal ref="addNuPreviewDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iotManager-areaList" setup>
|
||||
import {ref, reactive, defineExpose, nextTick, createVNode} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { nuColumns } from './preview.data';
|
||||
import { nuPreview,deletePreview } from './preview.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import AddDepartPreviewModal from './AddDepartPreviewModal.vue';
|
||||
import AddNuPreviewModal from './AddNuPreviewModal.vue';
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const addDepartPreviewDrawer = ref();
|
||||
const addNuPreviewDrawer = ref();
|
||||
const orgCode = ref<any>('');
|
||||
const batchNo = ref<any>('');
|
||||
const izPush = ref<any>('');
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '设备清单',
|
||||
api: nuPreview,
|
||||
columns: nuColumns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
showIndexColumn: true,
|
||||
showActionColumn: true,
|
||||
immediate: false,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
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:8,
|
||||
xl:8,
|
||||
xxl:8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function handleEdit(record) {
|
||||
if(record.dimension =='机构维度'){
|
||||
addDepartPreviewDrawer.value.disableSubmit = false;
|
||||
addDepartPreviewDrawer.value.edit(record);
|
||||
}
|
||||
if(record.dimension =='区域维度'){
|
||||
addNuPreviewDrawer.value.disableSubmit = false;
|
||||
addNuPreviewDrawer.value.edit(record);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
async function handleDelete(record: Recordable) {
|
||||
await deletePreview(record);
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
ifShow: izPush.value == 'N'
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确定删除?',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
ifShow: izPush.value == 'N'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
queryParam.orgCode = orgCode.value;
|
||||
queryParam.batchNo = batchNo.value;
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
//刷新数据
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
//初始化
|
||||
function init(record) {
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
izPush.value = record.izPush;
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
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,256 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="nuName">
|
||||
<template #label><span title="区域名称">区域名称</span></template>
|
||||
<a-input v-model:value="queryParam.nuName" placeholder="请输入区域名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="dimension">
|
||||
<template #label><span title="设备维度">设备维度</span></template>
|
||||
<a-select v-model:value="queryParam.dimension" placeholder="请选择设备维度" allow-clear>
|
||||
<a-select-option value="机构维度">机构维度</a-select-option>
|
||||
<a-select-option value="区域维度">区域维度</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="deviceType">
|
||||
<template #label><span title="设备类型">设备类型</span></template>
|
||||
<j-dict-select-tag v-model:value="queryParam.deviceType" :showLabel="false" dictCode="tplink_device_type"
|
||||
placeholder="请选择设备类型" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||
style="margin-left: 8px">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="addDepartDevice" v-if="izPush == 'N'">
|
||||
机构维度</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="addNuDevice" v-if="izPush == 'N'">
|
||||
区域维度</a-button>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<AddDepartPreviewModal ref="addDepartPreviewDrawer" @success="handleSuccess" />
|
||||
<AddNuPreviewModal ref="addNuPreviewDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iotManager-areaList" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, createVNode } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { nuColumns } from './preview.data';
|
||||
import { nuPreview, deletePreview } from './preview.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import AddDepartPreviewModal from './AddDepartPreviewModal.vue';
|
||||
import AddNuPreviewModal from './AddNuPreviewModal.vue';
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { Modal } from "ant-design-vue";
|
||||
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const addDepartPreviewDrawer = ref();
|
||||
const addNuPreviewDrawer = ref();
|
||||
const orgCode = ref<any>('');
|
||||
const batchNo = ref<any>('');
|
||||
const izPush = ref<any>('');
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '设备清单',
|
||||
api: nuPreview,
|
||||
columns: nuColumns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
showIndexColumn: true,
|
||||
showActionColumn: true,
|
||||
immediate: false,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
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: 8,
|
||||
xl: 8,
|
||||
xxl: 8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function handleEdit(record) {
|
||||
if (record.dimension == '机构维度') {
|
||||
addDepartPreviewDrawer.value.disableSubmit = false;
|
||||
addDepartPreviewDrawer.value.edit(record);
|
||||
}
|
||||
if (record.dimension == '区域维度') {
|
||||
addNuPreviewDrawer.value.disableSubmit = false;
|
||||
addNuPreviewDrawer.value.edit(record);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
async function handleDelete(record: Recordable) {
|
||||
await deletePreview(record);
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
ifShow: izPush.value == 'N'
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确定删除?',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
ifShow: izPush.value == 'N'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
queryParam.orgCode = orgCode.value;
|
||||
queryParam.batchNo = batchNo.value;
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
//刷新数据
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
//初始化
|
||||
function init(record) {
|
||||
console.log("🌊 ~ init ~ record:", record)
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
izPush.value = record.izPush;
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构添加设备
|
||||
*/
|
||||
function addDepartDevice() {
|
||||
let record = {
|
||||
orgCode: orgCode.value,
|
||||
batchNo: batchNo.value
|
||||
}
|
||||
addDepartPreviewDrawer.value.disableSubmit = false;
|
||||
addDepartPreviewDrawer.value.add(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域添加设备
|
||||
*/
|
||||
function addNuDevice() {
|
||||
let record = {
|
||||
orgCode: orgCode.value,
|
||||
batchNo: batchNo.value
|
||||
}
|
||||
addNuPreviewDrawer.value.disableSubmit = false;
|
||||
addNuPreviewDrawer.value.add(record);
|
||||
}
|
||||
|
||||
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,83 @@
|
|||
<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>
|
||||
<NuPreviewList v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||
:formBpm="false">
|
||||
</NuPreviewList>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import NuPreviewList from './NuPreviewList.vue'
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(1400);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
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.init(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
emit('success');
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
departPreview = '/iot/device/manager/departPreview',
|
||||
nuPreview = '/iot/device/manager/nuPreview',
|
||||
configList = '/iot/device/config/queryList',
|
||||
nuList = '/iot/device/manager/nuList',
|
||||
savePreview = '/iot/device/manager/savePreview',
|
||||
updatePreview = '/iot/device/manager/updatePreview',
|
||||
deletePreview = '/iot/device/manager/deletePreview',
|
||||
batchSave = '/iot/device/manager/batchSave',
|
||||
queryQuantityByOrgCode = '/iot/device/manager/queryQuantityByOrgCode',
|
||||
getNuListByOrgCode = '/iot/device/manager/getNuListByOrgCode',
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
*/
|
||||
export const departPreview = (params) => defHttp.get({ url: Api.departPreview, params });
|
||||
export const nuPreview = (params) => defHttp.get({ url: Api.nuPreview, params });
|
||||
export const configList = (params) => defHttp.get({ url: Api.configList, params });
|
||||
export const nuList = (params) => defHttp.get({ url: Api.nuList, params });
|
||||
/**
|
||||
* 新增机构
|
||||
* @param id
|
||||
*/
|
||||
export const savePreview = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.updatePreview : Api.savePreview;
|
||||
return defHttp.post({ url: url, params });
|
||||
};
|
||||
|
||||
/**
|
||||
* 批量保存
|
||||
* @param params
|
||||
* @returns
|
||||
*/
|
||||
export const batchSave = (params) => {
|
||||
return defHttp.post({ url: Api.batchSave, params });
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
export const deletePreview = (params) => defHttp.post({ url: Api.deletePreview, params });
|
||||
|
||||
export const queryQuantityByOrgCode = (params) => {
|
||||
return defHttp.get({ url: Api.queryQuantityByOrgCode, params });
|
||||
};
|
||||
|
||||
export const getNuListByOrgCode = (params) => {
|
||||
return defHttp.get({ url: Api.getNuListByOrgCode, params });
|
||||
};
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
|
||||
//列表数据
|
||||
export const departColumns: BasicColumn[] = [
|
||||
{
|
||||
title: '机构编码',
|
||||
align: "center",
|
||||
dataIndex: 'orgCode',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '机构名称',
|
||||
align: "center",
|
||||
dataIndex: 'departName',
|
||||
},
|
||||
{
|
||||
title: '批次编号',
|
||||
align: "center",
|
||||
dataIndex: 'batchNo',
|
||||
},
|
||||
{
|
||||
title: '设备类型',
|
||||
align: "center",
|
||||
dataIndex: 'deviceType_dictText',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '设备型号',
|
||||
align: "center",
|
||||
dataIndex: 'deviceModel',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '生产厂家',
|
||||
align: "center",
|
||||
dataIndex: 'factory',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '设备维度',
|
||||
align: "center",
|
||||
dataIndex: 'dimension',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '采购数量',
|
||||
align: "center",
|
||||
dataIndex: 'purchaseQuantity',
|
||||
width: 80
|
||||
},
|
||||
];
|
||||
|
||||
export const nuColumns: BasicColumn[] = [
|
||||
{
|
||||
title: '机构编码',
|
||||
align: "center",
|
||||
dataIndex: 'orgCode',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '机构名称',
|
||||
align: "center",
|
||||
dataIndex: 'departName',
|
||||
},
|
||||
{
|
||||
title: '区域编码',
|
||||
align: "center",
|
||||
dataIndex: 'nuId',
|
||||
customRender:({record})=>{
|
||||
if(record.nuId==null || record.nuId==''){
|
||||
return "-";
|
||||
}else{
|
||||
return record.nuId;
|
||||
}
|
||||
},
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '区域名称',
|
||||
align: "center",
|
||||
dataIndex: 'nuName',
|
||||
customRender:({record})=>{
|
||||
if(record.nuName==null || record.nuName==''){
|
||||
return "-";
|
||||
}else{
|
||||
return record.nuName;
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '设备类型',
|
||||
align: "center",
|
||||
dataIndex: 'deviceType_dictText',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '设备型号',
|
||||
align: "center",
|
||||
dataIndex: 'deviceModel',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '生产厂家',
|
||||
align: "center",
|
||||
dataIndex: 'factory',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '设备维度',
|
||||
align: "center",
|
||||
dataIndex: 'dimension',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '采购数量',
|
||||
align: "center",
|
||||
dataIndex: 'purchaseQuantity',
|
||||
width: 100
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [];
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/iot/device/manager/list',
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '机构编码',
|
||||
align: "center",
|
||||
dataIndex: 'orgCode',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '机构名称',
|
||||
align: "center",
|
||||
dataIndex: 'departName'
|
||||
},
|
||||
{
|
||||
title: '机构负责人',
|
||||
align: "center",
|
||||
dataIndex: 'orgLeader',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '审核状态',
|
||||
align: "center",
|
||||
dataIndex: 'auditStatus',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '审核日期',
|
||||
align: "center",
|
||||
dataIndex: 'auditTime',
|
||||
width: 200
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [];
|
||||
|
|
@ -1,44 +1,79 @@
|
|||
<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="批次编号" v-bind="validateInfos.batchNo" id="deviceBatchForm-batchNo" name="batchNo">
|
||||
<a-input v-model:value="formData.batchNo" :disabled="true"></a-input>
|
||||
<div style="background-color: white;border-radius: 10px;margin-bottom: 14px;padding-right: 14px;">
|
||||
<JFormContainer>
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="批次编号" v-bind="validateInfos.batchNo" id="deviceBatchForm-batchNo" name="batchNo">
|
||||
<a-input v-model:value="formData.batchNo" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="机构编码" v-bind="validateInfos.orgCode" id="deviceBatchForm-orgCode" name="orgCode">
|
||||
<a-input v-model:value="formData.orgCode" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="机构名称" v-bind="validateInfos.departName" id="deviceBatchForm-departName"
|
||||
:labelCol="labelCol2" :wrapperCol="wrapperCol2" name="departName">
|
||||
<a-input v-model:value="formData.departName" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="创建时间" v-bind="validateInfos.createTime" id="deviceBatchForm-createTime"
|
||||
name="createTime">
|
||||
<a-input v-model:value="formData.createTime" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="是否推送" v-bind="validateInfos.izPush" id="deviceBatchForm-izPush" name="izPush">
|
||||
<a-input :value="formData.izPush == 'Y' ? '已推送' : '未推送'" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="备注" v-bind="validateInfos.remarks" id="deviceBatchForm-remarks" name="remarks"
|
||||
:labelCol="labelCol2" :wrapperCol="wrapperCol2">
|
||||
<a-textarea v-model:value="formData.remarks" :auto-size="{ minRows: 1, maxRows: 6 }"
|
||||
placeholder="请填写批次清单备注" :disabled="disabled"></a-textarea>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!--
|
||||
<a-col :span="12">
|
||||
<a-form-item label="创建人" v-bind="validateInfos.createBy" id="deviceBatchForm-createBy" name="createBy">
|
||||
<a-input v-model:value="formData.createBy" :disabled="true"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="备注" v-bind="validateInfos.remarks" id="deviceBatchForm-remarks" name="factory">
|
||||
<a-textarea v-model:value="formData.remarks" :auto-size="{ minRows: 3, maxRows: 6 }"></a-textarea>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
</a-col> -->
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
</div>
|
||||
<div>
|
||||
<NuPreviewList ref="registerForm" :formBpm="false" :formDisabled="formDisabled" @ok="emit('ok')" />
|
||||
</div>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted, unref} from 'vue';
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted, unref } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { getBatchNo,saveOrUpdate } from './batch.api';
|
||||
import { getBatchNo, saveOrUpdate } from './batch.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';
|
||||
import {nulist} from "@/views/iotManager/manager.api";
|
||||
import { nulist } from "@/views/iotManager/manager.api";
|
||||
import NuPreviewList from '../preview/NuPreviewList.vue'
|
||||
|
||||
const isUpdate = ref<boolean>(false);
|
||||
const orgCode = ref<any>('');
|
||||
const deviceConfigs = ref([]);
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: ()=>{} },
|
||||
formData: { type: Object, default: () => { } },
|
||||
formBpm: { type: Boolean, default: true }
|
||||
});
|
||||
const formRef = ref();
|
||||
|
|
@ -47,13 +82,18 @@ const emit = defineEmits(['register', 'ok']);
|
|||
const formData = reactive<Record<string, any>>({
|
||||
id: undefined,
|
||||
orgCode: undefined,
|
||||
departName: undefined,
|
||||
batchNo: undefined,
|
||||
izPush: undefined,
|
||||
remarks: undefined
|
||||
remarks: undefined,
|
||||
createTime: undefined
|
||||
});
|
||||
const registerForm = ref();
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 7 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 18 } });
|
||||
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 4 } });
|
||||
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 20 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = {
|
||||
|
|
@ -61,11 +101,11 @@ const validatorRules = {
|
|||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
const disabled = computed(() => {
|
||||
if (props.formBpm === true) {
|
||||
if (props.formData.disabled === false) {
|
||||
return false;
|
||||
}else{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -78,9 +118,19 @@ const disabled = computed(()=>{
|
|||
async function add(record) {
|
||||
orgCode.value = record.orgCode;
|
||||
formData.orgCode = record.orgCode;
|
||||
formData.departName = record.departName;
|
||||
formData.izPush = 'N';
|
||||
formData.createTime = new Date().toISOString().slice(0, 10)
|
||||
isUpdate.value = false;
|
||||
await getBatchNo(record).then((res) => {
|
||||
formData.batchNo = res.batchNo;
|
||||
nextTick(() => {
|
||||
registerForm.value.add({
|
||||
orgCode: record.orgCode,
|
||||
batchNo: res.batchNo,
|
||||
izPush: 'N'
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -95,12 +145,18 @@ function edit(record) {
|
|||
//赋值
|
||||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if(record.hasOwnProperty(key)){
|
||||
if (record.hasOwnProperty(key)) {
|
||||
tmpData[key] = record[key]
|
||||
}
|
||||
})
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
|
||||
registerForm.value.edit({
|
||||
orgCode: record.orgCode,
|
||||
batchNo: record.batchNo,
|
||||
izPush: record.izPush
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -135,13 +191,16 @@ async function submitForm() {
|
|||
}
|
||||
}
|
||||
let isUpdateVal = unref(isUpdate);
|
||||
await saveOrUpdate(model,isUpdateVal)
|
||||
await saveOrUpdate(model, isUpdateVal)
|
||||
.then((res) => {
|
||||
emit('ok');
|
||||
nextTick(() => {
|
||||
registerForm.value.submitForm()
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
|
@ -151,5 +210,4 @@ defineExpose({
|
|||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<a-drawer :title="title" :width="width" :visible="visible" :closable="true" :footer-style="{ textAlign: 'right' }"
|
||||
<a-drawer :title="title" :width="width" :visible="visible" :closable="true" :footer-style="{ textAlign: 'right' }" :maskClosable="false"
|
||||
:bodyStyle="{ padding: '14px' }" @close="handleCancel">
|
||||
<template #footer>
|
||||
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
|
||||
|
|
@ -17,7 +17,7 @@ import DeviceBatchForm from './DeviceBatchForm.vue'
|
|||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const width = ref<number>(1200);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
<div>
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" :model="queryParam" :label-col="labelCol"
|
||||
:wrapper-col="wrapperCol">
|
||||
<a-form ref="formRef" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="batchNo">
|
||||
|
|
@ -25,7 +24,7 @@
|
|||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||
style="margin-left: 8px">重置</a-button>
|
||||
style="margin-left: 8px">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
|
|
@ -33,7 +32,7 @@
|
|||
</a-form>
|
||||
</div>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<!--引用表格-->
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
|
|
@ -41,7 +40,7 @@
|
|||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
|
|
@ -54,22 +53,23 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" name="iotManager-areaList" setup>
|
||||
import {ref, reactive, defineExpose, nextTick, createVNode} from 'vue';
|
||||
import { ref, reactive, defineExpose, nextTick, createVNode } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './batch.data';
|
||||
import { batchList,deleteBatch,sendBatch } from './batch.api';
|
||||
import { batchList, deleteBatch, sendBatch } from './batch.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import DeviceBatchFormModal from './DeviceBatchFormModal.vue';
|
||||
import DepartPreviewModal from "../preview/DepartPreviewModal.vue";
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import {changeTheme} from "@/logics/theme";
|
||||
import { changeTheme } from "@/logics/theme";
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const deviceBatchDrawer = ref();
|
||||
const previewDrawer = ref();
|
||||
const orgCode = ref<any>('');
|
||||
const departName = ref<any>('');
|
||||
const confirmLoading = ref<any>(false);
|
||||
const izShow = ref<any>(true);
|
||||
const userStore = useUserStore();
|
||||
|
|
@ -99,10 +99,10 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs:24,
|
||||
sm:8,
|
||||
xl:8,
|
||||
xxl:8
|
||||
xs: 24,
|
||||
sm: 8,
|
||||
xl: 8,
|
||||
xxl: 8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
|
|
@ -119,9 +119,10 @@ function handleSuccess() {
|
|||
/**
|
||||
* 添加
|
||||
*/
|
||||
function addBatch(){
|
||||
function addBatch() {
|
||||
let record = {
|
||||
orgCode: orgCode.value
|
||||
orgCode: orgCode.value,
|
||||
departName: departName.value
|
||||
}
|
||||
deviceBatchDrawer.value.disableSubmit = false;
|
||||
deviceBatchDrawer.value.add(record);
|
||||
|
|
@ -130,7 +131,7 @@ function addBatch(){
|
|||
/**
|
||||
* 清单
|
||||
*/
|
||||
function handlePreview(record: Recordable){
|
||||
function handlePreview(record: Recordable) {
|
||||
previewDrawer.value.disableSubmit = true;
|
||||
previewDrawer.value.edit(record);
|
||||
}
|
||||
|
|
@ -138,7 +139,7 @@ function handlePreview(record: Recordable){
|
|||
/**
|
||||
* 推送
|
||||
*/
|
||||
async function handleSend(record: Recordable){
|
||||
async function handleSend(record: Recordable) {
|
||||
izShow.value = false;
|
||||
confirmLoading.value = true;
|
||||
await sendBatch(record).then((res) => {
|
||||
|
|
@ -152,10 +153,18 @@ async function handleSend(record: Recordable){
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备清单(详情)
|
||||
*/
|
||||
function handleDeatail(record: Recordable) {
|
||||
deviceBatchDrawer.value.disableSubmit = true;
|
||||
deviceBatchDrawer.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
function handleEdit(record: Recordable){
|
||||
function handleEdit(record: Recordable) {
|
||||
deviceBatchDrawer.value.disableSubmit = false;
|
||||
deviceBatchDrawer.value.edit(record);
|
||||
}
|
||||
|
|
@ -163,7 +172,7 @@ function handleEdit(record: Recordable){
|
|||
/**
|
||||
* 删除
|
||||
*/
|
||||
async function handleDelete(record: Recordable){
|
||||
async function handleDelete(record: Recordable) {
|
||||
await deleteBatch(record);
|
||||
reload();
|
||||
}
|
||||
|
|
@ -176,7 +185,7 @@ function getTableAction(record) {
|
|||
return [
|
||||
{
|
||||
label: '设备清单',
|
||||
onClick: handlePreview.bind(null, record),
|
||||
onClick: handleDeatail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '推送清单',
|
||||
|
|
@ -219,6 +228,7 @@ function searchReset() {
|
|||
//初始化
|
||||
function init(record) {
|
||||
orgCode.value = record.orgCode;
|
||||
departName.value = record.departName
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
|
|
@ -229,27 +239,32 @@ defineExpose({
|
|||
</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{
|
||||
|
||||
.query-group-cust {
|
||||
min-width: 100px !important;
|
||||
}
|
||||
.query-group-split-cust{
|
||||
|
||||
.query-group-split-cust {
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
}
|
||||
.ant-form-item:not(.ant-form-item-with-help){
|
||||
|
||||
.ant-form-item:not(.ant-form-item-with-help) {
|
||||
margin-bottom: 16px;
|
||||
height: 32px;
|
||||
}
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
|
||||
:deep(.ant-picker),
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export const getBatchNo = (params) => defHttp.get({ url: Api.getBatchNo, params
|
|||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.editBatch : Api.addBatch;
|
||||
return defHttp.post({url: url, params});
|
||||
return defHttp.post({url: url, params}, { isTransformResponse: false });
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
|
|
|
|||
|
|
@ -0,0 +1,222 @@
|
|||
<template>
|
||||
<div>
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" :model="queryParam" :label-col="labelCol"
|
||||
:wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="nuName">
|
||||
<template #label><span title="区域名称">区域名称</span></template>
|
||||
<a-input v-model:value="queryParam.nuName" placeholder="请输入区域名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="dimension">
|
||||
<template #label><span title="设备维度">设备维度</span></template>
|
||||
<a-select v-model:value="queryParam.dimension" placeholder="请选择设备维度" allow-clear>
|
||||
<a-select-option value="机构维度">机构维度</a-select-option>
|
||||
<a-select-option value="区域维度">区域维度</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="deviceType">
|
||||
<template #label><span title="设备类型">设备类型</span></template>
|
||||
<j-dict-select-tag v-model:value="queryParam.deviceType" :showLabel="false" dictCode="tplink_device_type" placeholder="请选择设备类型" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||
style="margin-left: 8px">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<AddDepartPreviewModal ref="addDepartPreviewDrawer" @success="handleSuccess" />
|
||||
<AddNuPreviewModal ref="addNuPreviewDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="iotManager-areaList" setup>
|
||||
import {ref, reactive, defineExpose, nextTick, createVNode} from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { nuColumns } from './preview.data';
|
||||
import { nuPreview,deletePreview } from './preview.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import AddDepartPreviewModal from './AddDepartPreviewModal.vue';
|
||||
import AddNuPreviewModal from './AddNuPreviewModal.vue';
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const addDepartPreviewDrawer = ref();
|
||||
const addNuPreviewDrawer = ref();
|
||||
const orgCode = ref<any>('');
|
||||
const batchNo = ref<any>('');
|
||||
const izPush = ref<any>('');
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '设备清单',
|
||||
api: nuPreview,
|
||||
columns: nuColumns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
showIndexColumn: true,
|
||||
showActionColumn: true,
|
||||
immediate: false,
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
pageSizeOptions: ['15', '50', '70', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
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:8,
|
||||
xl:8,
|
||||
xxl:8
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 16,
|
||||
});
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function handleEdit(record) {
|
||||
if(record.dimension =='机构维度'){
|
||||
addDepartPreviewDrawer.value.disableSubmit = false;
|
||||
addDepartPreviewDrawer.value.edit(record);
|
||||
}
|
||||
if(record.dimension =='区域维度'){
|
||||
addNuPreviewDrawer.value.disableSubmit = false;
|
||||
addNuPreviewDrawer.value.edit(record);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
async function handleDelete(record: Recordable) {
|
||||
await deletePreview(record);
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
ifShow: izPush.value == 'N'
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确定删除?',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
ifShow: izPush.value == 'N'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
queryParam.orgCode = orgCode.value;
|
||||
queryParam.batchNo = batchNo.value;
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
//刷新数据
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
//初始化
|
||||
function init(record) {
|
||||
orgCode.value = record.orgCode;
|
||||
batchNo.value = record.batchNo;
|
||||
izPush.value = record.izPush;
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
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>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -7,6 +7,7 @@ enum Api {
|
|||
nuList = '/iot/device/manager/nuList',
|
||||
savePreview = '/iot/device/manager/savePreview',
|
||||
updatePreview = '/iot/device/manager/updatePreview',
|
||||
previewBatchSave = '/iot/device/manager/previewBatchSave',
|
||||
deletePreview = '/iot/device/manager/deletePreview',
|
||||
batchSave = '/iot/device/manager/batchSave',
|
||||
queryQuantityByOrgCode = '/iot/device/manager/queryQuantityByOrgCode',
|
||||
|
|
@ -36,7 +37,7 @@ export const savePreview = (params, isUpdate) => {
|
|||
* @returns
|
||||
*/
|
||||
export const batchSave = (params) => {
|
||||
return defHttp.post({ url: Api.batchSave, params });
|
||||
return defHttp.post({ url: Api.batchSave, params }, { isTransformResponse: false });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -51,4 +52,8 @@ export const queryQuantityByOrgCode = (params) => {
|
|||
|
||||
export const getNuListByOrgCode = (params) => {
|
||||
return defHttp.get({ url: Api.getNuListByOrgCode, params });
|
||||
};
|
||||
};
|
||||
|
||||
export const previewBatchSave = (params) => {
|
||||
return defHttp.post({ url: Api.previewBatchSave, params }, { isTransformResponse: false });
|
||||
};
|
||||
|
|
|
|||
|
|
@ -52,17 +52,17 @@ export const departColumns: BasicColumn[] = [
|
|||
];
|
||||
|
||||
export const nuColumns: BasicColumn[] = [
|
||||
{
|
||||
title: '机构编码',
|
||||
align: "center",
|
||||
dataIndex: 'orgCode',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '机构名称',
|
||||
align: "center",
|
||||
dataIndex: 'departName',
|
||||
},
|
||||
// {
|
||||
// title: '机构编码',
|
||||
// align: "center",
|
||||
// dataIndex: 'orgCode',
|
||||
// width: 100
|
||||
// },
|
||||
// {
|
||||
// title: '机构名称',
|
||||
// align: "center",
|
||||
// dataIndex: 'departName',
|
||||
// },
|
||||
{
|
||||
title: '区域编码',
|
||||
align: "center",
|
||||
|
|
|
|||
Loading…
Reference in New Issue