|
|
@ -49,6 +49,19 @@ |
|
|
|
<span class="name" @click.native="nameClick(row.deviceuuid)">{{ row.gTitle }}</span> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<template #pager> |
|
|
|
<!--使用 pager 插槽--> |
|
|
|
<vxe-pager |
|
|
|
class="tablePage" |
|
|
|
:layouts="['Sizes', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump', 'FullJump', 'Total']" |
|
|
|
v-model:current-page="tablePage.currentPage" |
|
|
|
v-model:page-size="tablePage.pageSize" |
|
|
|
auto-hidden |
|
|
|
:total="tablePage.total" |
|
|
|
@page-change="handlePageChange" |
|
|
|
> |
|
|
|
</vxe-pager> |
|
|
|
</template> |
|
|
|
</vxe-grid> |
|
|
|
<!-- <vxe-grid class="tableGrid" v-bind="gridOptions"> </vxe-grid> --> |
|
|
|
</n-spin> |
|
|
@ -110,7 +123,8 @@ import { |
|
|
|
VxeFormInstance, |
|
|
|
VxeFormPropTypes, |
|
|
|
VxeFormEvents, |
|
|
|
VxeTablePropTypes |
|
|
|
VxeTablePropTypes, |
|
|
|
VxePagerEvents |
|
|
|
} from 'vxe-table'; |
|
|
|
import { getTableHeader, getStationInfo, getTableData, editConfig, sendCtrl } from '@/api/table/list'; |
|
|
|
import { TableVo } from '@/api/table/types'; |
|
|
@ -136,6 +150,12 @@ const cellRow = ref({}); |
|
|
|
const cellColumn = ref(); |
|
|
|
const cellField = ref(); |
|
|
|
const tableBorder = ref(true); |
|
|
|
|
|
|
|
const tablePage = reactive({ |
|
|
|
total: 0, |
|
|
|
currentPage: 1, |
|
|
|
pageSize: 10 |
|
|
|
}); |
|
|
|
// const fields = ref(['deviceuuid']) //需要合并的列数据字段 |
|
|
|
// const waringArrow = ref([]) |
|
|
|
|
|
|
@ -182,7 +202,7 @@ const userInfo = JSON.parse(userStorageInfo === null ? '' : userStorageInfo); |
|
|
|
//const baseApi = import.meta.env.VITE_APP_BASE_API |
|
|
|
//const apiUrl = baseApi.replace(/https?:/, ''); |
|
|
|
const wsUrl = `ws://${window.location.host}/ws/websocket/${userInfo.userName}`; //websocket地址 |
|
|
|
// const wsUrl = `ws://10.10.10.56:9010/websocket/${userInfo.userName}`; //websocket地址 |
|
|
|
// const wsUrl = `ws://172.1.2.6:9010/websocket/${userInfo.userName}`; //websocket地址 |
|
|
|
|
|
|
|
const emit = defineEmits(['tableHeaderData']); |
|
|
|
// const listData = ref([ |
|
|
@ -228,11 +248,16 @@ const headerData = ref<HeaderVo[]>(); |
|
|
|
onMounted(() => { |
|
|
|
// stationInfo(); |
|
|
|
// tableHeader(); |
|
|
|
tablePage.currentPage = |
|
|
|
sessionStorage.getItem('currentPage') === null ? 1 : Number(sessionStorage.getItem('currentPage')); |
|
|
|
tablePage.pageSize = sessionStorage.getItem('pageSize') === null ? 10 : Number(sessionStorage.getItem('pageSize')); |
|
|
|
socket.initialize(wsUrl); //初始化websocket http:// |
|
|
|
}); |
|
|
|
|
|
|
|
mitt.on('menuKey', (res: any) => { |
|
|
|
//监听左侧菜单点击 |
|
|
|
tablePage.currentPage = 1; |
|
|
|
sessionStorageIns.setUseStorage('currentPage', 1); |
|
|
|
menuKey.value = res; |
|
|
|
tableHeader(); |
|
|
|
tableDatas(); |
|
|
@ -292,6 +317,14 @@ mitt.on('tableMessage', (res: any) => { |
|
|
|
// console.log("waringArrow:", waringArrow.value) |
|
|
|
}); |
|
|
|
|
|
|
|
const handlePageChange: VxePagerEvents.PageChange = ({ currentPage, pageSize }) => { |
|
|
|
tablePage.currentPage = currentPage; |
|
|
|
tablePage.pageSize = pageSize; |
|
|
|
sessionStorageIns.setUseStorage('currentPage', currentPage); |
|
|
|
sessionStorageIns.setUseStorage('pageSize', pageSize); |
|
|
|
tableDatas(); |
|
|
|
}; |
|
|
|
|
|
|
|
function stationInfo() { |
|
|
|
//获取热源信息 |
|
|
|
getStationInfo().then((res: any) => { |
|
|
@ -361,13 +394,19 @@ function tableHeader() { |
|
|
|
|
|
|
|
function tableDatas() { |
|
|
|
//获取表格数据 |
|
|
|
const params = menuKey.value; |
|
|
|
// const params = menuKey.value; |
|
|
|
const params = { |
|
|
|
pageNum: tablePage.currentPage, |
|
|
|
pageSize: tablePage.pageSize, |
|
|
|
orgCode: menuKey.value |
|
|
|
}; |
|
|
|
loadingShow.value = true; |
|
|
|
getTableData(params).then((res: any) => { |
|
|
|
if (res.code === 200) { |
|
|
|
// tableData.value=oldData |
|
|
|
tableData.value = res.data; |
|
|
|
tableStoreCounter.tableDataAction(res.data); |
|
|
|
tableData.value = res.rows; |
|
|
|
tableStoreCounter.tableDataAction(res.rows); |
|
|
|
tablePage.total = res.total; |
|
|
|
// gridOptions.data = res.data; |
|
|
|
loadingShow.value = false; |
|
|
|
} |
|
|
@ -399,7 +438,7 @@ const cellDBLClickEvent: VxeTableEvents.CellDblclick<TableVo> = ({ row, column } |
|
|
|
|
|
|
|
const formatRole: VxeColumnPropTypes.Formatter<HeaderVo> = ({ cellValue }) => { |
|
|
|
//表单参数为object时处理 |
|
|
|
console.log(cellValue); |
|
|
|
// console.log(cellValue); |
|
|
|
// const iconFont=cellValue.changeProp===-1?'<i class="iconfont icon-decline" />':(cellValue.changeProp===1?'<i class="iconfont icon-rise" />':'<i/>') |
|
|
|
// const cellData = `<span class="cellClass ${cellValue.alertProp===1?'warning':''}">${cellValue.val}</span>${iconFont}`; |
|
|
|
// const cellData = `<span class="cellClass ${cellValue.alertProp === 1 ? 'warning' : cellValue.canBeControl === '1' ? 'cellEdit' : ''}">${cellValue.val}</span><i class="iconfont ${cellValue.changeProp === -1 ? 'icon-decline' : cellValue.changeProp === 1 ? 'icon-rise' : ''}" ></i>${cellValue.canBeControl === '1' ? '<i class="iconfont icon-edit-icon"></i>' : ''}`; |
|
|
|