Skip to content

Commit

Permalink
feat: devicesDetailLite.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
dgiot-fe committed Apr 19, 2022
1 parent 6181d08 commit 78109fa
Show file tree
Hide file tree
Showing 12 changed files with 3,585 additions and 1,837 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@
"stylelint-config-recess-order": "^2.6.0",
"svg-sprite-loader": "6.0.11",
"url-loader": "4.1.1",
"vite": "^2.9.5",
"vite-plugin-vue2": "^1.9.3",
"vite-tsconfig-paths": "^3.4.1",
"vue-eslint-parser": "8.0.1",
"vue-template-compiler": "2.6.14",
"webpack": "4.46.0",
Expand Down
6 changes: 3 additions & 3 deletions src/api/Mock/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const queryParams = [
{
dataType: 'map',
vuekey: 'baiduMap',
table: 'baidu',
query: { keys: ['count(*)'] },
table: 'Device',
query: { keys: ['count(*)', 'name', 'location', 'status'] },
},
{
dataType: 'card',
Expand Down Expand Up @@ -79,7 +79,7 @@ const queryParams = [
table: 'Device',
query: {
limit: 1,
keys: ['count(*)'],
keys: ['count(*)', 'name', 'location', 'status'],
where: {},
},
},
Expand Down
16 changes: 8 additions & 8 deletions src/components/Device/info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@
{{ $translateTitle('application.secretkey') + ':' }}
</td>
<td>{{ devicedetail.deviceSecret || '-' }}</td>
<td class="cloumn">
{{ $translateTitle('node.operation') + ':' }}
</td>
<td>
<el-link plain size="mini" @click="handleDelete(devicedetail)">
{{ $translateTitle('konva.delete') }}
</el-link>
</td>
<!-- <td class="cloumn">-->
<!-- {{ $translateTitle('node.operation') + ':' }}-->
<!-- </td>-->
<!-- <td>-->
<!-- <el-link plain size="mini" @click="handleDelete(devicedetail)">-->
<!-- {{ $translateTitle('konva.delete') }}-->
<!-- </el-link>-->
<!-- </td>-->
</tr>
</table>
<el-table
Expand Down
2 changes: 1 addition & 1 deletion src/config/loca.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
*/
{
path: 'iotapi',
target: 'https://dev.iotn2n.com',
target: 'http://127.0.0.1:5080',
},
/**
* @description 静态资源目录。开发使用
Expand Down
68 changes: 51 additions & 17 deletions src/views/DeviceCloud/manage/devicelist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,25 @@
value-format="timestamp"
/>
</el-form-item>
<el-form-item label="所属产品:" prop="productId">
<el-select
v-model="productId"
placeholder="请选择"
style="width: 100%"
>
<el-option
v-for="item in Product"
:key="item.objectId"
:label="item.name"
:value="item.objectId"
>
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">
{{ item.objectId }}
</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="归属厂家:" prop="detail.factory">
<el-input
v-model="deviceForm.detail.factory"
Expand Down Expand Up @@ -288,8 +307,12 @@
width="120"
>
<template #default="{ row }">
<el-link effect="dark" :type="row.isEnable ? 'success' : 'info'">
{{ row.isEnable ? '开机' : '关机' }}
<el-link
effect="dark"
:type="row.isEnable == true ? 'success' : 'info'"
@click="print(row)"
>
{{ row.isEnable == true ? '开机' : '关机' }}
</el-link>
</template>
</el-table-column>
Expand Down Expand Up @@ -429,7 +452,7 @@

<script>
import TableEdit from '@/views/DeviceCloud/empty/tableEdit'
import { getProduct, queryProduct } from '@/api/Product/index'
import { queryProduct } from '@/api/Product/index'
import { getStatistics } from '@/api/Python'
import { mapGetters, mapMutations } from 'vuex'
import { queryView } from '@/api/View'
Expand Down Expand Up @@ -462,7 +485,8 @@
}, 1000)
}
return {
productId: '0765bee775',
Product: [],
productId: '',
deviceInfo: {},
roleProps: {
children: 'children',
Expand Down Expand Up @@ -559,7 +583,7 @@
route: {},
product: { __type: 'Pointer', className: 'Product', objectId: '' },
},
product: '0765bee775',
product: '',
createDeviceDialog: false,
drawerAdd: false,
infoData: 'Empty',
Expand Down Expand Up @@ -650,6 +674,10 @@
},
watch: {},
created() {
this.getProduct()
this.queryForm.search = this.$route.query.devicename
? this.$route.query.devicename
: ''
this.fetchData()
// 设置默认归属厂家
const aclKey1 = 'role' + ':' + this.currentDepartment.alias
Expand All @@ -660,21 +688,30 @@
}
this.deviceForm.detail.factory = this.currentDepartment.alias
this.deviceForm.ACL = aclObj
this.deviceForm.product = {
__type: 'Pointer',
className: 'Product',
objectId: this.productId,
}
console.log('deviceForm', this.deviceForm)
},
mounted() {},
destroyed() {},
methods: {
...mapMutations({
setCurrentDepartment: 'user/setCurrentDepartment',
}),
async getProduct() {
const { results = [] } = await queryProduct({})
this.Product = results
this.productId = results[0].objectId
this.product = results[0].objectId
this.deviceForm.product = {
__type: 'Pointer',
className: 'Product',
objectId: this.productId,
}
console.log('deviceForm', this.deviceForm)
},
async print(row) {
console.log(await getDevice(row.objectId))
console.log(row, row.isEnable)
},
getTime(t, row) {
console.log(t, row.basedata.expirationTime, row)
return t
? moment(Number(t)).format('YYYY-MM-DD')
: moment(Number(row.basedata.expirationTime) * 1000).format(
Expand All @@ -687,7 +724,7 @@
// 设备详情
deviceToDetail(row) {
this.$router.push({
path: '/roles/editdevices',
path: '/roles/devicesDetailLite',
query: {
deviceid: row.objectId,
nodeType: row.nodeType,
Expand Down Expand Up @@ -945,9 +982,7 @@
count: 'objectId',
order: '-createdAt',
excludeKeys: 'properties',
where: {
product: this.product,
},
where: {},
}
if (this.queryForm.type)
params.where[this.queryForm.type] = this.queryForm.search.length
Expand All @@ -960,7 +995,6 @@
if (_.isEmpty(i.detail)) i.detail = {}
if (_.isEmpty(i.content)) i.content = {}
if (_.isEmpty(i.profile)) i.profile = {}
if (_.isEmpty(i.isEnable)) i.isEnable = false
})
this.list = results
this.total = count
Expand Down

0 comments on commit 78109fa

Please sign in to comment.