|
@ -63,7 +63,7 @@ import { |
|
|
VxeFormEvents, |
|
|
VxeFormEvents, |
|
|
VxeTablePropTypes |
|
|
VxeTablePropTypes |
|
|
} from 'vxe-table'; |
|
|
} from 'vxe-table'; |
|
|
import { getTableHeader, getStationInfo, getTableData, editConfig,sendCtrl } from '@/api/table/list'; |
|
|
import { getTableHeader, getStationInfo, getTableData, editConfig } from '@/api/table/list'; |
|
|
import { TableVo } from '@/api/table/types'; |
|
|
import { TableVo } from '@/api/table/types'; |
|
|
import { tableStore } from '@/store/modules/table'; |
|
|
import { tableStore } from '@/store/modules/table'; |
|
|
import mitt from '@/plugins/bus'; |
|
|
import mitt from '@/plugins/bus'; |
|
@ -91,17 +91,15 @@ const tableBorder=ref(true) |
|
|
// const waringArrow = ref([]) |
|
|
// const waringArrow = ref([]) |
|
|
|
|
|
|
|
|
interface FormDataVO { |
|
|
interface FormDataVO { |
|
|
//url: string; |
|
|
url: string; |
|
|
deviceName: string; |
|
|
deviceName: string; |
|
|
paramCode :string; |
|
|
|
|
|
value: string; |
|
|
value: string; |
|
|
} |
|
|
} |
|
|
const formRef = ref<VxeFormInstance>(); |
|
|
const formRef = ref<VxeFormInstance>(); |
|
|
const formLoading = ref(false); |
|
|
const formLoading = ref(false); |
|
|
const formData = ref<FormDataVO>({ |
|
|
const formData = ref<FormDataVO>({ |
|
|
//url: '', |
|
|
url: '', |
|
|
deviceName: '', |
|
|
deviceName: '', |
|
|
paramCode: '', |
|
|
|
|
|
value: '', |
|
|
value: '', |
|
|
}); |
|
|
}); |
|
|
const formRules = ref<VxeFormPropTypes.Rules>({ |
|
|
const formRules = ref<VxeFormPropTypes.Rules>({ |
|
@ -122,15 +120,15 @@ const formRules = ref<VxeFormPropTypes.Rules>({ |
|
|
|
|
|
|
|
|
const userStorageInfo = sessionStorage.getItem('userInfo') |
|
|
const userStorageInfo = sessionStorage.getItem('userInfo') |
|
|
const userInfo = JSON.parse(userStorageInfo === null ? '' : userStorageInfo); |
|
|
const userInfo = JSON.parse(userStorageInfo === null ? '' : userStorageInfo); |
|
|
//const apiUrl = import.meta.env.VITE_APP_WS_API |
|
|
const apiUrl = import.meta.env.VITE_APP_WS_API |
|
|
//const wsUrl = `${apiUrl}websocket/${userInfo.userName}`; //websocket地址 |
|
|
const wsUrl = `${apiUrl}/websocket/${userInfo.userName}`; //websocket地址 |
|
|
//const wsUrl = `${apiUrl}${userInfo.userName}`; //websocket地址 |
|
|
|
|
|
// const loginIp = userInfo.loginIp.split('.').join(''); |
|
|
// const loginIp = userInfo.loginIp.split('.').join(''); |
|
|
// const baseApi = "http://172.1.2.106:9000"//websocket链接地址,与项目接口地址一致。 |
|
|
// const baseApi = "http://172.1.2.106:9000"//websocket链接地址,与项目接口地址一致。 |
|
|
// const baseApi = "http://board.heatiot.cn:8001/prod-api"//websocket链接地址,与项目接口地址一致。 |
|
|
// const baseApi = "http://board.heatiot.cn:8001/prod-api"//websocket链接地址,与项目接口地址一致。 |
|
|
//const baseApi = import.meta.env.VITE_APP_BASE_API |
|
|
// const baseApi = import.meta.env.VITE_APP_BASE_API |
|
|
//const apiUrl = baseApi.replace(/https?:/, ''); |
|
|
// const apiUrl = baseApi.replace(/https?:/, ''); |
|
|
const wsUrl = `ws://${window.location.host}/ws/websocket/${userInfo.userName}`; //websocket地址 |
|
|
// const wsUrl = `ws:${apiUrl}/websocket/${userInfo.userName}`; //websocket地址 |
|
|
|
|
|
// const wsData = ref(socket.data); |
|
|
|
|
|
|
|
|
const emit = defineEmits(['tableHeaderData']); |
|
|
const emit = defineEmits(['tableHeaderData']); |
|
|
// const listData = ref([ |
|
|
// const listData = ref([ |
|
@ -176,7 +174,7 @@ const headerData = ref<HeaderVo[]>(); |
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
// stationInfo(); |
|
|
// stationInfo(); |
|
|
// tableHeader(); |
|
|
// tableHeader(); |
|
|
socket.initialize(wsUrl); //初始化websocket http:// |
|
|
socket.initialize(wsUrl); //初始化websocket |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
mitt.on('menuKey', (res: any) => { |
|
|
mitt.on('menuKey', (res: any) => { |
|
@ -324,22 +322,17 @@ function tableDatas() { |
|
|
|
|
|
|
|
|
const cellDBLClickEvent: VxeTableEvents.CellDblclick<TableVo> = ({ row, column }) => { |
|
|
const cellDBLClickEvent: VxeTableEvents.CellDblclick<TableVo> = ({ row, column }) => { |
|
|
//双击单元格 |
|
|
//双击单元格 |
|
|
//edit ty zhousq 2023-10-12 修改控制方式为接口方式,修改formdata提交的属性值 |
|
|
|
|
|
// ctrlPro.centeruuid 设备UUID cellField.ctrlPro.paramcode 设备参数编码 cellField.val 设备值 |
|
|
|
|
|
//ctrlPro 为新增的单元格属性,控制参数回传 |
|
|
|
|
|
console.log("cellData--", row, column); |
|
|
console.log("cellData--", row, column); |
|
|
const cellField = row[column.field]; |
|
|
const cellField = row[column.field]; |
|
|
//const data = row.data; |
|
|
const data = row.data; |
|
|
cellRow.value = row |
|
|
cellRow.value = row |
|
|
cellColumn.value = column |
|
|
cellColumn.value = column |
|
|
cellField.value = cellField |
|
|
cellField.value = cellField |
|
|
if (cellField.canBeControl === '1') { |
|
|
if (cellField.canBeControl === '1') { |
|
|
modalTitle.value = column.title; |
|
|
modalTitle.value = column.title; |
|
|
///formData.value.url = data.url; |
|
|
formData.value.url = data.url; |
|
|
//formData.value.deviceName = cellField.deviceName; |
|
|
formData.value.deviceName = cellField.deviceName; |
|
|
formData.value.value = cellField.val; |
|
|
formData.value.value = cellField.val; |
|
|
formData.value.deviceName=cellField.ctrlPro.centeruuid |
|
|
|
|
|
formData.value.paramCode=cellField.ctrlPro.paramcode |
|
|
|
|
|
editModal.value = true; |
|
|
editModal.value = true; |
|
|
} |
|
|
} |
|
|
console.log(row[column.field]); |
|
|
console.log(row[column.field]); |
|
@ -379,25 +372,15 @@ const submitEvent: VxeFormEvents.Submit = () => { |
|
|
formLoading.value = true; |
|
|
formLoading.value = true; |
|
|
const $table = tableRef.value; |
|
|
const $table = tableRef.value; |
|
|
const submitData = { |
|
|
const submitData = { |
|
|
//code: 'W01', |
|
|
code: 'W01', |
|
|
//data: { |
|
|
data: { |
|
|
//url: formData.value.url, |
|
|
url: formData.value.url, |
|
|
//deviceName: formData.value.deviceName, |
|
|
deviceName: formData.value.deviceName, |
|
|
//value: formData.value.value, |
|
|
value: formData.value.value, |
|
|
deviceUUID:formData.value.deviceName, |
|
|
}, |
|
|
paramCode: formData.value.paramCode, |
|
|
|
|
|
valueType: "", |
|
|
|
|
|
value:formData.value.value |
|
|
|
|
|
//}, |
|
|
|
|
|
}; |
|
|
}; |
|
|
console.log(submitData); |
|
|
console.log(submitData); |
|
|
//Add by zhousq 2023-10-12 控制接口调用 post 方法 |
|
|
socket.onSend(submitData); |
|
|
sendCtrl(submitData).then((res: any) => { |
|
|
|
|
|
if (res.code === 200) { |
|
|
|
|
|
console.log(res.data); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
//socket.onSend(submitData); |
|
|
|
|
|
formLoading.value = false; |
|
|
formLoading.value = false; |
|
|
editModal.value = false; |
|
|
editModal.value = false; |
|
|
|
|
|
|
|
|