水表设备同步

This commit is contained in:
曹磊 2025-08-05 11:15:47 +08:00
parent b9f6684b53
commit 758ca4fe00
7 changed files with 64 additions and 32 deletions

View File

@ -77,7 +77,7 @@ function getTableAction(record) {
}); });
} else { } else {
actions.push({ actions.push({
label: '重新选择', label: '变更',
onClick: () => { onClick: () => {
toggleSelect(record); toggleSelect(record);
} }
@ -146,11 +146,15 @@ const updateSelection = (selectedRecords) => {
} }
}; };
function reloadData(){
reload();
}
// //
defineExpose({ defineExpose({
updateSelection, updateSelection,
clearSelected, clearSelected,
reload, reloadData,
allSelectedRows, allSelectedRows,
}); });

View File

@ -50,10 +50,7 @@
fixed: 'right', fixed: 'right',
}, },
beforeFetch: async (params) => { beforeFetch: async (params) => {
queryParam.delFlag = '0'//
queryParam.izSync = '1'//
// queryParam.orgCode = props.orgCode // // queryParam.orgCode = props.orgCode //
queryParam.column = 'nuId' //
return Object.assign(params, queryParam); return Object.assign(params, queryParam);
}, },
}, },

View File

@ -81,9 +81,13 @@ const removeSelected = (record) => {
emit('removeSelect',record); emit('removeSelect',record);
}; };
function reloadData(){
reload();
}
// //
defineExpose({ defineExpose({
reload, reloadData,
allSelectedRows, allSelectedRows,
}); });

View File

@ -84,7 +84,7 @@ function getTableAction(record) {
} else { } else {
let label = '添加'; let label = '添加';
if(record.nuId){ if(record.nuId){
label = '重新选择'; label = '变更';
} }
actions.push({ actions.push({
label: label, label: label,
@ -140,11 +140,16 @@ const updateSelection = (selectedRecords) => {
} }
}; };
function reloadData(){
reload();
}
// //
defineExpose({ defineExpose({
updateSelection, updateSelection,
clearSelected, clearSelected,
reload, reloadData,
allSelectedRows, allSelectedRows,
}); });

View File

@ -9,7 +9,7 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :span="4"> <a-col :span="4">
<a-form-item name="dataType"> <a-form-item name="dataType">
<template #label><span title="dataType"></span></template> <template #label><span title="dataType">操作</span></template>
<a-select v-model:value="dataType" placeholder="请选择来源" allowClear @change="dataTypeChanged(dataType)"> <a-select v-model:value="dataType" placeholder="请选择来源" allowClear @change="dataTypeChanged(dataType)">
<a-select-option value="source" key="source">源数据</a-select-option> <a-select-option value="source" key="source">源数据</a-select-option>
<a-select-option value="business" key="business">已同步</a-select-option> <a-select-option value="business" key="business">已同步</a-select-option>
@ -22,7 +22,7 @@
<a-input v-model:value="queryParam.address" placeholder="请输入SN" allowClear /> <a-input v-model:value="queryParam.address" placeholder="请输入SN" allowClear />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="5" v-show="viewType =='selected'||dataType=='business'"> <a-col :span="4" v-show="viewType =='selected'||dataType=='business'">
<a-form-item name="departId"> <a-form-item name="departId">
<template #label><span title="机构">机构</span></template> <template #label><span title="机构">机构</span></template>
<a-select v-model:value="queryParam.departId" placeholder="请选择机构" allowClear @change="handleDepartChange"> <a-select v-model:value="queryParam.departId" placeholder="请选择机构" allowClear @change="handleDepartChange">
@ -30,7 +30,7 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="5" v-show="viewType =='selected'||dataType=='business'"> <a-col :span="4" v-show="viewType =='selected'||dataType=='business'">
<a-form-item name="nuId"> <a-form-item name="nuId">
<template #label><span title="区域">区域</span></template> <template #label><span title="区域">区域</span></template>
<a-select v-model:value="queryParam.nuId" placeholder="请选择区域" allowClear> <a-select v-model:value="queryParam.nuId" placeholder="请选择区域" allowClear>
@ -38,7 +38,16 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="5"> <a-col :span="4" v-show="viewType =='selected'||dataType=='business'">
<a-form-item name="status">
<template #label><span title="状态">状态</span></template>
<a-select v-model:value="queryParam.status" placeholder="请选择状态" allowClear>
<a-select-option value="0" key="0">正常</a-select-option>
<a-select-option value="1" key="1">作废</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="4">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons"> <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-button type="primary" preIcon="ant-design:search-outlined" <a-button type="primary" preIcon="ant-design:search-outlined"
@click="searchQuery">查询</a-button> @click="searchQuery">查询</a-button>
@ -80,7 +89,7 @@
<a-radio-button value="selected">已同步</a-radio-button> <a-radio-button value="selected">已同步</a-radio-button>
</a-radio-group> </a-radio-group>
<div class="toggle-add-button-container" v-show="businessView=='selected'"> <div class="toggle-add-button-container" v-show="businessView=='selected'">
<a-button type="primary" size="small" @click="handleEditBusinessSelect" style="margin-left: 8px">重新选择</a-button> <a-button type="primary" size="small" @click="handleEditBusinessSelect" style="margin-left: 8px">调整</a-button>
<a-button type="primary" size="small" @click="handleDeleteBusinessSelect" style="margin-left: 8px">移除</a-button> <a-button type="primary" size="small" @click="handleDeleteBusinessSelect" style="margin-left: 8px">移除</a-button>
</div> </div>
</div> </div>
@ -160,9 +169,9 @@ const wrapperCol = reactive({
xs: 24, xs: 24,
sm: 20, sm: 20,
}); });
const queryParam = ref()// const queryParam = ref({status: '0'})//
const sourceParam = ref({viewType: 'unselected',departServerUrl:''})// const sourceParam = ref({viewType: 'unselected',departServerUrl:'',status: '0'})//
const businessParam = ref({departServerUrl:''})// const businessParam = ref({departServerUrl:'',status: '0'})//
const sourceComRef = ref(); const sourceComRef = ref();
const selectedComRef = ref(); const selectedComRef = ref();
const businessComRef = ref(); const businessComRef = ref();
@ -192,9 +201,9 @@ const orgChanged = async (org) => {
// //
allSelectedItems.value.clear(); allSelectedItems.value.clear();
// //
queryParam.value = {}; queryParam.value = {status: '0'};
// //
sourceParam.value = { viewType: 'unselected',departServerUrl:org.orgCode}; sourceParam.value = { viewType: 'unselected',departServerUrl:org.orgCode,status: '0'};
// //
businessParam.value = {departServerUrl: org.orgCode}; businessParam.value = {departServerUrl: org.orgCode};
// //
@ -204,7 +213,7 @@ const orgChanged = async (org) => {
} }
/** /**
* 机构重新选择 * 机构变更
*/ */
const orgReset = async (org) => { const orgReset = async (org) => {
showDevices.value = false; showDevices.value = false;
@ -218,24 +227,28 @@ function searchQuery() {
sourceParam.value.address = queryParam.value.address; sourceParam.value.address = queryParam.value.address;
sourceParam.value.departId = queryParam.value.departId; sourceParam.value.departId = queryParam.value.departId;
sourceParam.value.nuId = queryParam.value.nuId; sourceParam.value.nuId = queryParam.value.nuId;
sourceComRef.value.reload(); sourceParam.value.status = queryParam.value.status;
sourceComRef.value.reloadData();
}else{ }else{
businessParam.value.address = queryParam.value.address; businessParam.value.address = queryParam.value.address;
businessParam.value.departId = queryParam.value.departId; businessParam.value.departId = queryParam.value.departId;
businessParam.value.nuId = queryParam.value.nuId; businessParam.value.nuId = queryParam.value.nuId;
businessComRef.value.reload(); businessParam.value.status = queryParam.value.status;
businessComRef.value.reloadData();
} }
} }
function searchReset() { function searchReset() {
queryParam.value = {}; queryParam.value = {
status: '0'
};
if(dataType.value=='source'){ if(dataType.value=='source'){
let vt = sourceParam.value.viewType; let vt = sourceParam.value.viewType;
let dsu = sourceParam.value.departServerUrl; let dsu = sourceParam.value.departServerUrl;
sourceParam.value = { viewType: vt,departServerUrl:dsu }; sourceParam.value = { viewType: vt,departServerUrl:dsu,status: '0' };
}else{ }else{
let dsu = businessParam.value.departServerUrl; let dsu = businessParam.value.departServerUrl;
businessParam.value = { departServerUrl: dsu }; businessParam.value = { departServerUrl: dsu,status: '0' };
} }
} }
@ -266,7 +279,7 @@ const splitScreenChanged = (val) => {
const dataTypeChanged = (value) => { const dataTypeChanged = (value) => {
if(value=='source'){ if(value=='source'){
if(viewType.value=='selected'){ if(viewType.value=='selected'){
sourceButtonText.value = '重新选择'; sourceButtonText.value = '变更';
const departServerUrl = sourceParam.value.departServerUrl; const departServerUrl = sourceParam.value.departServerUrl;
getDepartList({dataType:'source',departServerUrl:departServerUrl}); getDepartList({dataType:'source',departServerUrl:departServerUrl});
getNuList({dataType:'source',departServerUrl:departServerUrl}); getNuList({dataType:'source',departServerUrl:departServerUrl});
@ -285,7 +298,7 @@ const viewTypeChanged = (value) => {
sourceParam.value.viewType = value sourceParam.value.viewType = value
if(value=='selected'){ if(value=='selected'){
const departServerUrl = sourceParam.value.departServerUrl; const departServerUrl = sourceParam.value.departServerUrl;
sourceButtonText.value = '重新选择'; sourceButtonText.value = '变更';
getDepartList({dataType:'source',departServerUrl:departServerUrl}); getDepartList({dataType:'source',departServerUrl:departServerUrl});
getNuList({dataType:'source',departServerUrl:departServerUrl}); getNuList({dataType:'source',departServerUrl:departServerUrl});
} }
@ -426,7 +439,7 @@ function selectNuHandleSuccess(nuInfo){
} }
let item = {}; let item = {};
item["address"] = record.address; item["address"] = record.address;
item["actionType"] = '修改'; item["actionType"] = '调整';
item["dataType"] = 'business'; item["dataType"] = 'business';
item["dataTypeText"] = '已同步区'; item["dataTypeText"] = '已同步区';
item["nuId"] = nuInfo.nuId; item["nuId"] = nuInfo.nuId;
@ -446,7 +459,6 @@ function selectNuHandleSuccess(nuInfo){
} }
function selectNuHandleCancel(nuInfo){ function selectNuHandleCancel(nuInfo){
console.log(nuInfo);
if(nuInfo.type == 'source'){ if(nuInfo.type == 'source'){
updateSourceSelection(); updateSourceSelection();
}else{ }else{
@ -480,9 +492,9 @@ function handleReload(){
// //
async function handleAsync(){ async function handleAsync(){
const arr = Array.from(allSelectedItems.value.values()) const arr = Array.from(allSelectedItems.value.values())
console.log(arr); await syncDevicesApi(arr);
const res = await syncDevicesApi(arr); sourceComRef.value.reloadData();
console.log(res); businessComRef.value.reloadData();
handleReload(); handleReload();
} }

View File

@ -5,7 +5,7 @@ enum Api {
departList = '/iot/tq/waterMeter/departList', departList = '/iot/tq/waterMeter/departList',
nuList = '/iot/tq/waterMeter/nuList', nuList = '/iot/tq/waterMeter/nuList',
businessList = '/iot/tq/waterMeter/businessList', businessList = '/iot/tq/waterMeter/businessList',
nuSyncList = '/admin/nuBaseInfo/nuBaseInfo/list', nuSyncList = '/iot/tq/waterMeter/nuSyncList',
syncDevices = '/iot/tq/waterMeter/syncDevices', syncDevices = '/iot/tq/waterMeter/syncDevices',
syncLogList = '/iot/tq/waterMeter/syncLogList', syncLogList = '/iot/tq/waterMeter/syncLogList',
} }

View File

@ -137,6 +137,11 @@ export const nusColumns: BasicColumn[] = [
align: "center", align: "center",
dataIndex: 'areaFlag_dictText', dataIndex: 'areaFlag_dictText',
resizable: true, resizable: true,
},
{
title: '绑定设备数量',
align: "center",
dataIndex: 'deviceNum'
} }
]; ];
@ -221,6 +226,11 @@ export const asyncSeedColumns: BasicColumn[] = [
align: "center", align: "center",
dataIndex: 'syncType', dataIndex: 'syncType',
}, },
{
title: '同步状态',
align: "center",
dataIndex: 'status',
},
{ {
title: '同步时间', title: '同步时间',
align: "center", align: "center",