|
|
@ -18,7 +18,7 @@ |
|
|
|
</el-select> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
<el-table ref="table" v-loading="loading" :data="tableData" style="width: 100%;" height="calc(100vh - 556px)" @row-click="clickRowHandler"> |
|
|
|
<el-table ref="table" v-loading="loading" :data="tableData" style="width: 100%;" height="calc(100vh - 556px)" @row-click="clickRowHandler" @selection-change="selectionChangeHandler"> |
|
|
|
<el-table-column type="selection" width="55" align="center" /> |
|
|
|
<el-table-column type="index" label="序号" width="80" align="center" /> |
|
|
|
<el-table-column prop="storeroomId.name" label="所属区域" min-width="150" align="center" /> |
|
|
@ -37,45 +37,59 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
// import { getAllDevice } from '@/api/storeManage/listenManage' |
|
|
|
import { bind, getDevice } from '@/api/storeManage/listenManage' |
|
|
|
import { getDeviceList } from '@/api/storeManage/deviceManage/device' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
tableData: [], |
|
|
|
bindVisible: false, |
|
|
|
devType: 1, |
|
|
|
devType: '', |
|
|
|
devOptions: [], |
|
|
|
timeType: 1, |
|
|
|
timeType: 10, |
|
|
|
timeOptions: [ |
|
|
|
{ value: 1, label: '事件触发前后10秒' }, |
|
|
|
{ value: 2, label: '事件触发前后20秒' }, |
|
|
|
{ value: 3, label: '事件触发前后30秒' } |
|
|
|
{ value: 10, label: '事件触发前后10秒' }, |
|
|
|
{ value: 20, label: '事件触发前后20秒' }, |
|
|
|
{ value: 30, label: '事件触发前后30秒' } |
|
|
|
], |
|
|
|
page: { |
|
|
|
size: 10, |
|
|
|
total: 0, |
|
|
|
page: 1 |
|
|
|
page: 0 |
|
|
|
}, |
|
|
|
loading: false |
|
|
|
loading: false, |
|
|
|
selections: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
handleSave() { |
|
|
|
if (this.selections.length === 0) { |
|
|
|
this.$message({ |
|
|
|
message: '请选择摄像头', |
|
|
|
type: 'warning' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
const storeroomName = this.devOptions.find(X => { return X.value === this.devType }).self.storeroomId.name |
|
|
|
const deviceName = this.devOptions.find(X => { return X.value === this.devType }).self.deviceName |
|
|
|
const data = this.selections.map(x => { return { deviceInfoId: this.devType, storeroomName: storeroomName, deviceName: deviceName, cameraId: x.id, timeSize: this.timeType } }) |
|
|
|
bind(data).then((devices) => { |
|
|
|
this.bindVisible = false |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
clickRowHandler(row) { |
|
|
|
this.$refs.table.toggleRowSelection(row) // 单击选中 |
|
|
|
}, |
|
|
|
selectionChangeHandler(val) { |
|
|
|
this.selections = val |
|
|
|
}, |
|
|
|
open() { |
|
|
|
this.getDevOptions() |
|
|
|
this.getAllCamera() |
|
|
|
}, |
|
|
|
getDevOptions() { |
|
|
|
Promise.all([getDeviceList({ deviceTypeId: 'DD656054BE3D1DF1E2F1FC' }), getDeviceList({ deviceTypeId: '65D1886B0F864291766421' })]).then((values) => { |
|
|
|
const devices = values.reduce((previousValue, currentValue) => { return { content: previousValue.content.concat(currentValue.content) } }, { content: [] }).content |
|
|
|
console.log(devices) |
|
|
|
this.devOptions = devices.map(data => { return { value: data.id, label: data.storeroomId.name + '-' + data.deviceName } }) |
|
|
|
getDevice().then((devices) => { |
|
|
|
this.devOptions = devices.map(data => { return { value: data.id, label: data.storeroomId.name + '-' + data.deviceName, self: data } }) |
|
|
|
if (this.devOptions?.length > 0) { |
|
|
|
this.devType = this.devOptions[0].value |
|
|
|
} |
|
|
@ -83,6 +97,7 @@ export default { |
|
|
|
}, |
|
|
|
getAllCamera() { |
|
|
|
this.loading = true |
|
|
|
console.log(this.page.page) |
|
|
|
getDeviceList({ deviceTypeId: '7305DE3D273B0CAC079538', page: this.page.page, size: this.page.size }).then((data) => { |
|
|
|
this.loading = false |
|
|
|
this.page.total = data.totalElements !== null ? data.totalElements : data.length |
|
|
@ -95,13 +110,13 @@ export default { |
|
|
|
}, |
|
|
|
// 当前页改变 |
|
|
|
pageChangeHandler(e) { |
|
|
|
this.page.page = e |
|
|
|
this.page.page = e - 1 |
|
|
|
this.getAllCamera() |
|
|
|
}, |
|
|
|
// 每页条数改变 |
|
|
|
sizeChangeHandler(e) { |
|
|
|
this.page.size = e |
|
|
|
this.page.page = 1 |
|
|
|
this.page.page = 0 |
|
|
|
this.getAllCamera() |
|
|
|
} |
|
|
|
} |
|
|
|