mirror of
https://gitee.com/pnoker/iot-dc3.git
synced 2026-09-24 15:13:04 +08:00
feat(ui): improve layout and detail display across all entity card views
This commit is contained in:
@@ -71,7 +71,9 @@
|
||||
},
|
||||
handleCommand(command) {
|
||||
if (command === 'logout') {
|
||||
this.$store.dispatch('ClearToken').then(() => this.$router.push('/login'));
|
||||
this.$store.dispatch('ClearToken').then(() => this.$router.push('/login'))
|
||||
.catch(() => {
|
||||
});
|
||||
} else if (command === 'help') {
|
||||
window.open('https://doc.dc3.site');
|
||||
}
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
methods: {
|
||||
show() {
|
||||
if (this.url) {
|
||||
this.$router.push({name: 'application', query: {id: encode(this.url)}});
|
||||
this.$router.push({name: 'application', query: {id: encode(this.url)}})
|
||||
.catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
methods: {
|
||||
show() {
|
||||
if (this.url) {
|
||||
this.$router.push({name: 'dashboard', query: {id: encode(this.url)}});
|
||||
this.$router.push({name: 'dashboard', query: {id: encode(this.url)}})
|
||||
.catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,10 +120,14 @@
|
||||
});
|
||||
},
|
||||
edit(id, driverId) {
|
||||
this.$router.push({name: 'deviceEdit', query: {id, driverId, active: '0'}});
|
||||
this.$router.push({name: 'deviceEdit', query: {id, driverId, active: '0'}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
detail(id, driverId) {
|
||||
this.$router.push({name: 'deviceDetail', query: {id, driverId, active: 'detail'}});
|
||||
this.$router.push({name: 'deviceDetail', query: {id, driverId, active: 'detail'}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '设备ID');
|
||||
|
||||
@@ -280,7 +280,9 @@
|
||||
},
|
||||
changeActive(tab) {
|
||||
let query = this.$route.query;
|
||||
this.$router.push({query: {...query, active: tab.name}});
|
||||
this.$router.push({query: {...query, active: tab.name}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '设备ID');
|
||||
|
||||
@@ -523,7 +523,9 @@
|
||||
}
|
||||
this.active += step;
|
||||
if (this.active > 2) {
|
||||
this.$router.push({name: 'device'});
|
||||
this.$router.push({name: 'device'})
|
||||
.catch(() => {
|
||||
});
|
||||
} else {
|
||||
this.changeActive(this.active);
|
||||
}
|
||||
@@ -539,7 +541,9 @@
|
||||
},
|
||||
changeActive(step) {
|
||||
let query = this.$route.query;
|
||||
this.$router.push({query: {...query, active: step}});
|
||||
this.$router.push({query: {...query, active: step}})
|
||||
.catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="things-card">
|
||||
<el-card shadow="hover">
|
||||
<div class="things-card" @click="select(data)">
|
||||
<el-card :shadow="data.active?'always':'hover'" v-bind:class="{'active':data.active}">
|
||||
<div class="things-card-content">
|
||||
<div class="things-card__header" v-bind:class="{'header-enable':data.enable,'header-disable':!data.enable}">
|
||||
<div class="things-card-header-icon"><img :src="icon" :alt="data.name"></div>
|
||||
<div class="things-card-header-name nowrap-name" @click="copyId(data.id)">{{data.name}}</div>
|
||||
<div title="状态" class="things-card-header-status">
|
||||
<div title="状态" class="things-card-header-status" v-bind:class="{'active':data.active}">
|
||||
<el-tag v-if="status(data.id)==='ONLINE'" type="success" effect="plain">在线</el-tag>
|
||||
<el-tag v-else-if="status(data.id)==='MAINTAIN'" type="warning" effect="plain">维护</el-tag>
|
||||
<el-tag v-else-if="status(data.id)==='FAULT'" type="danger" effect="plain">故障</el-tag>
|
||||
@@ -24,7 +24,7 @@
|
||||
<li class="nowrap-item"><span><i class="el-icon-sunset"/> 创建日期: </span>{{timestamp(data.createTime)}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div title="驱动描述信息" class="things-card-body-content">
|
||||
<div :title="data.description?data.description:'驱动描述信息'" class="things-card-body-content">
|
||||
<p class="nowrap-description">{{data.description?data.description:'无描述信息'}}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,6 +53,16 @@
|
||||
export default {
|
||||
name: "driver-card",
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
default: 'images/common/driver.png'
|
||||
},
|
||||
statusTable: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
@@ -68,16 +78,6 @@
|
||||
};
|
||||
}
|
||||
},
|
||||
statusTable: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
default: 'images/common/driver.png'
|
||||
},
|
||||
footer: {
|
||||
type: Boolean,
|
||||
default: () => {
|
||||
@@ -90,7 +90,12 @@
|
||||
return this.statusTable[id];
|
||||
},
|
||||
detail(id) {
|
||||
this.$router.push({name: 'driverDetail', query: {id, active: 'detail'}});
|
||||
this.$router.push({name: 'driverDetail', query: {id, active: 'detail'}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
select(data) {
|
||||
this.$emit('select-change', data);
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '驱动ID');
|
||||
@@ -104,4 +109,16 @@
|
||||
|
||||
<style lang="scss">
|
||||
@import "~@/components/card/styles/things-card.scss";
|
||||
|
||||
.things-card-header-status.active {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.active {
|
||||
background: #ecf5ff;
|
||||
|
||||
.el-tag.el-tag--plain {
|
||||
background: #ecf5ff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
:data="data"
|
||||
:statusTable="driverStatusTable"
|
||||
:footer="true"
|
||||
@select-change="selectChange"
|
||||
></driver-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -39,6 +40,9 @@
|
||||
<ul>
|
||||
<li><i class="el-icon-data-line"></i> 驱动名称: {{data.name}}</li>
|
||||
<li><i class="el-icon-collection-tag"></i> 关联设备 [{{listDeviceData.length||0}} 个]: {{deviceName()}}</li>
|
||||
<li class="nowrap-item"><span><i class="el-icon-connection"/> 端口: </span>{{data.port}}</li>
|
||||
<li class="nowrap-item"><span><i class="el-icon-monitor"/> 主机: </span>{{data.host}}</li>
|
||||
<li class="nowrap-item"><span><i class="el-icon-s-promotion"/> 驱动服务: </span>{{data.serviceName}}</li>
|
||||
<li><i class="el-icon-edit-outline"></i> 修改日期: {{timestamp(data.createTime)}}</li>
|
||||
<li><i class="el-icon-sunset"></i> 创建日期: {{timestamp(data.updateTime)}}</li>
|
||||
</ul>
|
||||
@@ -134,6 +138,7 @@
|
||||
deviceByDriverId(this.id).then(res => {
|
||||
this.listDeviceData = res.data;
|
||||
}).catch(() => {
|
||||
this.listDeviceData = [];
|
||||
}).finally(() => {
|
||||
this.deviceLoading = false;
|
||||
});
|
||||
@@ -141,6 +146,7 @@
|
||||
deviceStatusByDriverId(this.id).then(res => {
|
||||
this.deviceStatusTable = res.data;
|
||||
}).catch(() => {
|
||||
this.deviceStatusTable = {};
|
||||
});
|
||||
},
|
||||
drivers() {
|
||||
@@ -168,6 +174,7 @@
|
||||
}).then(res => {
|
||||
const data = res.data;
|
||||
this.page.total = data.total;
|
||||
data.records.forEach(driver => driver.active = this.id === driver.id);
|
||||
this.listDriverData = data.records;
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -214,8 +221,23 @@
|
||||
return this.listDeviceData.map(device => device.name).join(", ");
|
||||
},
|
||||
changeActive(tab) {
|
||||
this.active = tab.name;
|
||||
let query = this.$route.query;
|
||||
this.$router.push({query: {...query, active: tab.name}});
|
||||
this.$router.push({query: {...query, active: tab.name}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
selectChange(data) {
|
||||
this.listDriverData.forEach(driver => driver.active = data.id === driver.id);
|
||||
this.listDriverData = JSON.parse(JSON.stringify(this.listDriverData));
|
||||
|
||||
this.id = data.id;
|
||||
let query = this.$route.query;
|
||||
this.$router.push({query: {...query, id: data.id}}).then(() => {
|
||||
this.driver();
|
||||
this.device();
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '驱动ID');
|
||||
|
||||
@@ -84,7 +84,9 @@
|
||||
return this.statusTable[id];
|
||||
},
|
||||
detail(id) {
|
||||
this.$router.push({name: 'gatewayDetail', query: {id, active: 'detail'}});
|
||||
this.$router.push({name: 'gatewayDetail', query: {id, active: 'detail'}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '网关ID');
|
||||
|
||||
@@ -99,7 +99,9 @@
|
||||
},
|
||||
changeActive(tab) {
|
||||
let query = this.$route.query;
|
||||
this.$router.push({query: {...query, active: tab.name}});
|
||||
this.$router.push({query: {...query, active: tab.name}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '网关ID');
|
||||
|
||||
@@ -123,10 +123,14 @@
|
||||
});
|
||||
},
|
||||
edit(id) {
|
||||
this.$router.push({name: 'pointEdit', query: {id, profileId: this.data.profileId, active: '0'}});
|
||||
this.$router.push({name: 'pointEdit', query: {id, profileId: this.data.profileId, active: '0'}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
detail(id) {
|
||||
this.$router.push({name: 'pointDetail', query: {id, active: 'detail'}});
|
||||
this.$router.push({name: 'pointDetail', query: {id, active: 'detail'}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '位号ID');
|
||||
|
||||
@@ -99,7 +99,9 @@
|
||||
},
|
||||
changeActive(tab) {
|
||||
let query = this.$route.query;
|
||||
this.$router.push({query: {...query, active: tab.name}});
|
||||
this.$router.push({query: {...query, active: tab.name}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '位号ID');
|
||||
|
||||
@@ -215,7 +215,9 @@
|
||||
next() {
|
||||
this.active++;
|
||||
if (this.active > 0) {
|
||||
this.$router.push({name: 'profileEdit', query: {id: this.$route.query.profileId, active: '1'}});
|
||||
this.$router.push({name: 'profileEdit', query: {id: this.$route.query.profileId, active: '1'}})
|
||||
.catch(() => {
|
||||
});
|
||||
} else {
|
||||
this.changeActive(this.active);
|
||||
}
|
||||
@@ -225,7 +227,9 @@
|
||||
},
|
||||
changeActive(step) {
|
||||
let query = this.$route.query;
|
||||
this.$router.push({query: {...query, active: step}});
|
||||
this.$router.push({query: {...query, active: step}})
|
||||
.catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="things-card-content">
|
||||
<div class="things-card__header" v-bind:class="{'header-enable':isConfig,'header-disable':!isConfig}">
|
||||
<div class="things-card-header-icon"><img :src="isSelect" :alt="data.name"></div>
|
||||
<div class="things-card-header-name nowrap-name" @click="copyId(data.id)">{{data.name}}</div>
|
||||
<div class="things-card-header-name nowrap-name">{{data.name}}</div>
|
||||
</div>
|
||||
<div class="things-card__body">
|
||||
<div class="things-card-body-content">
|
||||
|
||||
@@ -90,10 +90,14 @@
|
||||
});
|
||||
},
|
||||
edit(id) {
|
||||
this.$router.push({name: 'profileEdit', query: {id, active: '0'}});
|
||||
this.$router.push({name: 'profileEdit', query: {id, active: '0'}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
detail(id) {
|
||||
this.$router.push({name: 'profileDetail', query: {id, active: 'detail'}});
|
||||
this.$router.push({name: 'profileDetail', query: {id, active: 'detail'}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '模板ID');
|
||||
|
||||
@@ -145,7 +145,9 @@
|
||||
},
|
||||
changeActive(tab) {
|
||||
let query = this.$route.query;
|
||||
this.$router.push({query: {...query, active: tab.name}});
|
||||
this.$router.push({query: {...query, active: tab.name}})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
copyId(content) {
|
||||
setCopyContent(content, true, '模板ID');
|
||||
|
||||
@@ -143,7 +143,9 @@
|
||||
next() {
|
||||
this.active++;
|
||||
if (this.active > 1) {
|
||||
this.$router.push({name: 'profile'});
|
||||
this.$router.push({name: 'profile'})
|
||||
.catch(() => {
|
||||
});
|
||||
} else {
|
||||
this.changeActive(this.active);
|
||||
}
|
||||
@@ -153,7 +155,9 @@
|
||||
},
|
||||
changeActive(step) {
|
||||
let query = this.$route.query;
|
||||
this.$router.push({query: {...query, active: step}});
|
||||
this.$router.push({query: {...query, active: step}})
|
||||
.catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user