|
@@ -234,7 +234,6 @@ const pageable = ref<any>({
|
|
|
|
|
|
|
|
|
const changeHot =(row)=>{
|
|
|
- console.log(row)
|
|
|
if(row){
|
|
|
pageable.value.time_space = 60
|
|
|
}else {
|
|
@@ -245,7 +244,6 @@ const changeHot =(row)=>{
|
|
|
const changeMultiTime =(time)=>{
|
|
|
if(time){
|
|
|
const timeStamp = new Date(time).getTime();
|
|
|
- console.log(timeStamp)
|
|
|
pageable.value.begin_time = timeStamp/1000
|
|
|
pageable.value.end_time = timeStamp/1000
|
|
|
}else {
|
|
@@ -255,6 +253,50 @@ const changeMultiTime =(time)=>{
|
|
|
|
|
|
}
|
|
|
|
|
|
+function transformData(dataArray) {
|
|
|
+ return dataArray.map(item => {
|
|
|
+ const transformedItem = {};
|
|
|
+ for (const key in item) {
|
|
|
+ if (key === 'as_code' || key === 'data_time_i' || key === 'as_name' || key === 'data_count' || key === 'data_time') {
|
|
|
+ transformedItem[key] = item[key];
|
|
|
+ } else {
|
|
|
+ const value = item[key];
|
|
|
+ const device = deviceType.find(d => d.value === value);
|
|
|
+ transformedItem[key] = device ? device.label : value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return transformedItem;
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+const deviceType= [
|
|
|
+ {
|
|
|
+ value: 0,
|
|
|
+ label: '正常',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: '未连接',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 2,
|
|
|
+ label: '告警',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 3,
|
|
|
+ label: '故障',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 4,
|
|
|
+ label: '不确定',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 5,
|
|
|
+ label: '未启用',
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
+
|
|
|
const timeSpaceList= [
|
|
|
{
|
|
|
value: 1,
|
|
@@ -311,18 +353,7 @@ const processTableData = ref([]);
|
|
|
const sensorList =ref<any>([])
|
|
|
// 被选中当条数据下标
|
|
|
const selectedItemIndex = ref(0)
|
|
|
-let customizeColumns= ref<any>([
|
|
|
- {
|
|
|
- se_type: 0,
|
|
|
- se_name: "预处理器",
|
|
|
- data_item: "",
|
|
|
- se_state: 0,
|
|
|
- data_r_table: "",
|
|
|
- data_h_table: "",
|
|
|
- data_value: "",
|
|
|
- isSelected: false
|
|
|
- }
|
|
|
-])
|
|
|
+let customizeColumns= ref<any>([])
|
|
|
|
|
|
const changeMoveUp = () =>{
|
|
|
//上移
|
|
@@ -422,6 +453,7 @@ const getSensorList = async () => {
|
|
|
const submitForm = () => {
|
|
|
dialog.visible = false;
|
|
|
customizeColumns.value = [...copiedCustomizeColumns.value]
|
|
|
+ console.log( customizeColumns.value)
|
|
|
updateColumns()
|
|
|
saveCustomizeColumns()
|
|
|
}
|
|
@@ -430,19 +462,18 @@ const updateColumns = () => {
|
|
|
const column = [
|
|
|
{ prop: "as_name", label: "站名", width: 100 },
|
|
|
{ prop: "as_code", label: "站号", width: 100 },
|
|
|
- { prop: "data_time_i", label: "观测时间", width: 100 }
|
|
|
+ { prop: "data_time_i", label: "观测时间", width: 170 }
|
|
|
];
|
|
|
-
|
|
|
- console.log(customizeColumns.value)
|
|
|
const newColumns = customizeColumns.value.map(item => ({
|
|
|
- prop: item.se_type,
|
|
|
+ prop: item.se_type===0?'yclq_state':item.se_type,
|
|
|
label: item.se_name,
|
|
|
width: calculateTextLengthInPixels(item.se_name)
|
|
|
}));
|
|
|
+ console.log('==============')
|
|
|
+ console.log(newColumns)
|
|
|
|
|
|
columns = [...column, ...newColumns];
|
|
|
-
|
|
|
- // pageable.value.data_items = [...customizeColumns.value];
|
|
|
+ pageable.value.data_items = [...customizeColumns.value];
|
|
|
getList()
|
|
|
}
|
|
|
|
|
@@ -503,7 +534,8 @@ const getPlatforms = async () => {
|
|
|
|
|
|
const getList = async () => {
|
|
|
const { data } = await getStaitemList(pageable.value);
|
|
|
- processTableData.value = data.list
|
|
|
+ console.log(transformData(data.list))
|
|
|
+ processTableData.value = transformData(data.list)
|
|
|
pageable.value.total = data.total
|
|
|
};
|
|
|
|