水表设备同步
This commit is contained in:
parent
b9f6684b53
commit
758ca4fe00
|
@ -77,7 +77,7 @@ function getTableAction(record) {
|
|||
});
|
||||
} else {
|
||||
actions.push({
|
||||
label: '重新选择',
|
||||
label: '变更',
|
||||
onClick: () => {
|
||||
toggleSelect(record);
|
||||
}
|
||||
|
@ -146,11 +146,15 @@ const updateSelection = (selectedRecords) => {
|
|||
}
|
||||
};
|
||||
|
||||
function reloadData(){
|
||||
reload();
|
||||
}
|
||||
|
||||
// 暴露给父组件的方法
|
||||
defineExpose({
|
||||
updateSelection,
|
||||
clearSelected,
|
||||
reload,
|
||||
reloadData,
|
||||
allSelectedRows,
|
||||
});
|
||||
|
||||
|
|
|
@ -50,10 +50,7 @@
|
|||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
queryParam.delFlag = '0'//查正常数据
|
||||
queryParam.izSync = '1'//查未同步数据
|
||||
// queryParam.orgCode = props.orgCode //查对应机构数据
|
||||
queryParam.column = 'nuId' //排序字段
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -81,9 +81,13 @@ const removeSelected = (record) => {
|
|||
emit('removeSelect',record);
|
||||
};
|
||||
|
||||
function reloadData(){
|
||||
reload();
|
||||
}
|
||||
|
||||
// 暴露给父组件的方法
|
||||
defineExpose({
|
||||
reload,
|
||||
reloadData,
|
||||
allSelectedRows,
|
||||
});
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ function getTableAction(record) {
|
|||
} else {
|
||||
let label = '添加';
|
||||
if(record.nuId){
|
||||
label = '重新选择';
|
||||
label = '变更';
|
||||
}
|
||||
actions.push({
|
||||
label: label,
|
||||
|
@ -140,11 +140,16 @@ const updateSelection = (selectedRecords) => {
|
|||
}
|
||||
};
|
||||
|
||||
function reloadData(){
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
// 暴露给父组件的方法
|
||||
defineExpose({
|
||||
updateSelection,
|
||||
clearSelected,
|
||||
reload,
|
||||
reloadData,
|
||||
allSelectedRows,
|
||||
});
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<a-row :gutter="24">
|
||||
<a-col :span="4">
|
||||
<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-option value="source" key="source">源数据</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-form-item>
|
||||
</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">
|
||||
<template #label><span title="机构">机构</span></template>
|
||||
<a-select v-model:value="queryParam.departId" placeholder="请选择机构" allowClear @change="handleDepartChange">
|
||||
|
@ -30,7 +30,7 @@
|
|||
</a-select>
|
||||
</a-form-item>
|
||||
</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">
|
||||
<template #label><span title="区域">区域</span></template>
|
||||
<a-select v-model:value="queryParam.nuId" placeholder="请选择区域" allowClear>
|
||||
|
@ -38,7 +38,16 @@
|
|||
</a-select>
|
||||
</a-form-item>
|
||||
</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">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined"
|
||||
@click="searchQuery">查询</a-button>
|
||||
|
@ -80,7 +89,7 @@
|
|||
<a-radio-button value="selected">已同步</a-radio-button>
|
||||
</a-radio-group>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -160,9 +169,9 @@ const wrapperCol = reactive({
|
|||
xs: 24,
|
||||
sm: 20,
|
||||
});
|
||||
const queryParam = ref()//源数据查询参数
|
||||
const sourceParam = ref({viewType: 'unselected',departServerUrl:''})//源数据查询参数
|
||||
const businessParam = ref({departServerUrl:''})//源数据查询参数
|
||||
const queryParam = ref({status: '0'})//源数据查询参数
|
||||
const sourceParam = ref({viewType: 'unselected',departServerUrl:'',status: '0'})//源数据查询参数
|
||||
const businessParam = ref({departServerUrl:'',status: '0'})//源数据查询参数
|
||||
const sourceComRef = ref();
|
||||
const selectedComRef = ref();
|
||||
const businessComRef = ref();
|
||||
|
@ -192,9 +201,9 @@ const orgChanged = async (org) => {
|
|||
//清空当前选择
|
||||
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};
|
||||
// 切换视图
|
||||
|
@ -204,7 +213,7 @@ const orgChanged = async (org) => {
|
|||
}
|
||||
|
||||
/**
|
||||
* 机构重新选择
|
||||
* 机构变更
|
||||
*/
|
||||
const orgReset = async (org) => {
|
||||
showDevices.value = false;
|
||||
|
@ -218,24 +227,28 @@ function searchQuery() {
|
|||
sourceParam.value.address = queryParam.value.address;
|
||||
sourceParam.value.departId = queryParam.value.departId;
|
||||
sourceParam.value.nuId = queryParam.value.nuId;
|
||||
sourceComRef.value.reload();
|
||||
sourceParam.value.status = queryParam.value.status;
|
||||
sourceComRef.value.reloadData();
|
||||
}else{
|
||||
businessParam.value.address = queryParam.value.address;
|
||||
businessParam.value.departId = queryParam.value.departId;
|
||||
businessParam.value.nuId = queryParam.value.nuId;
|
||||
businessComRef.value.reload();
|
||||
businessParam.value.status = queryParam.value.status;
|
||||
businessComRef.value.reloadData();
|
||||
}
|
||||
}
|
||||
|
||||
function searchReset() {
|
||||
queryParam.value = {};
|
||||
queryParam.value = {
|
||||
status: '0'
|
||||
};
|
||||
if(dataType.value=='source'){
|
||||
let vt = sourceParam.value.viewType;
|
||||
let dsu = sourceParam.value.departServerUrl;
|
||||
sourceParam.value = { viewType: vt,departServerUrl:dsu };
|
||||
sourceParam.value = { viewType: vt,departServerUrl:dsu,status: '0' };
|
||||
}else{
|
||||
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) => {
|
||||
if(value=='source'){
|
||||
if(viewType.value=='selected'){
|
||||
sourceButtonText.value = '重新选择';
|
||||
sourceButtonText.value = '变更';
|
||||
const departServerUrl = sourceParam.value.departServerUrl;
|
||||
getDepartList({dataType:'source',departServerUrl:departServerUrl});
|
||||
getNuList({dataType:'source',departServerUrl:departServerUrl});
|
||||
|
@ -285,7 +298,7 @@ const viewTypeChanged = (value) => {
|
|||
sourceParam.value.viewType = value
|
||||
if(value=='selected'){
|
||||
const departServerUrl = sourceParam.value.departServerUrl;
|
||||
sourceButtonText.value = '重新选择';
|
||||
sourceButtonText.value = '变更';
|
||||
getDepartList({dataType:'source',departServerUrl:departServerUrl});
|
||||
getNuList({dataType:'source',departServerUrl:departServerUrl});
|
||||
}
|
||||
|
@ -426,7 +439,7 @@ function selectNuHandleSuccess(nuInfo){
|
|||
}
|
||||
let item = {};
|
||||
item["address"] = record.address;
|
||||
item["actionType"] = '修改';
|
||||
item["actionType"] = '调整';
|
||||
item["dataType"] = 'business';
|
||||
item["dataTypeText"] = '已同步区';
|
||||
item["nuId"] = nuInfo.nuId;
|
||||
|
@ -446,7 +459,6 @@ function selectNuHandleSuccess(nuInfo){
|
|||
}
|
||||
|
||||
function selectNuHandleCancel(nuInfo){
|
||||
console.log(nuInfo);
|
||||
if(nuInfo.type == 'source'){
|
||||
updateSourceSelection();
|
||||
}else{
|
||||
|
@ -480,9 +492,9 @@ function handleReload(){
|
|||
//同步
|
||||
async function handleAsync(){
|
||||
const arr = Array.from(allSelectedItems.value.values())
|
||||
console.log(arr);
|
||||
const res = await syncDevicesApi(arr);
|
||||
console.log(res);
|
||||
await syncDevicesApi(arr);
|
||||
sourceComRef.value.reloadData();
|
||||
businessComRef.value.reloadData();
|
||||
handleReload();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ enum Api {
|
|||
departList = '/iot/tq/waterMeter/departList',
|
||||
nuList = '/iot/tq/waterMeter/nuList',
|
||||
businessList = '/iot/tq/waterMeter/businessList',
|
||||
nuSyncList = '/admin/nuBaseInfo/nuBaseInfo/list',
|
||||
nuSyncList = '/iot/tq/waterMeter/nuSyncList',
|
||||
syncDevices = '/iot/tq/waterMeter/syncDevices',
|
||||
syncLogList = '/iot/tq/waterMeter/syncLogList',
|
||||
}
|
||||
|
|
|
@ -137,6 +137,11 @@ export const nusColumns: BasicColumn[] = [
|
|||
align: "center",
|
||||
dataIndex: 'areaFlag_dictText',
|
||||
resizable: true,
|
||||
},
|
||||
{
|
||||
title: '绑定设备数量',
|
||||
align: "center",
|
||||
dataIndex: 'deviceNum'
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -221,6 +226,11 @@ export const asyncSeedColumns: BasicColumn[] = [
|
|||
align: "center",
|
||||
dataIndex: 'syncType',
|
||||
},
|
||||
{
|
||||
title: '同步状态',
|
||||
align: "center",
|
||||
dataIndex: 'status',
|
||||
},
|
||||
{
|
||||
title: '同步时间',
|
||||
align: "center",
|
||||
|
|
Loading…
Reference in New Issue