设备管理
This commit is contained in:
BIN
src/renderer/public/excel/imporTemp.et
Normal file
BIN
src/renderer/public/excel/imporTemp.et
Normal file
Binary file not shown.
BIN
src/renderer/public/excel/imporTemp.xlsx
Normal file
BIN
src/renderer/public/excel/imporTemp.xlsx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -36,4 +36,13 @@ export const deviceApi = {
|
||||
url: `/device/import/template`
|
||||
})
|
||||
},
|
||||
uploadSingle: async (data: any) => {
|
||||
return await request.post({
|
||||
url: `/device/import`,
|
||||
data,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
@ -21,7 +21,11 @@
|
||||
</template>
|
||||
<span>下载模板</span>
|
||||
</el-button>
|
||||
<el-button color="#004b4b" style="border: 1px solid rgba(0, 255, 255, 0.5)">
|
||||
<el-button
|
||||
color="#004b4b"
|
||||
style="border: 1px solid rgba(0, 255, 255, 0.5)"
|
||||
@click="attachUpload"
|
||||
>
|
||||
<template #icon>
|
||||
<svg-icon name="pitchImport" />
|
||||
</template>
|
||||
@ -33,13 +37,14 @@
|
||||
placeholder="请输入设备名称进行搜索"
|
||||
class="input-with-select"
|
||||
:suffix-icon="Search"
|
||||
@input="getTableList()"
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
<div class="nav_table">
|
||||
<el-table :data="tableData" height="40vh" style="width: 100%">
|
||||
<el-table-column fixed prop="cameraName" label="设备名称" width="150" />
|
||||
<el-table-column prop="cameraName" label="设备名称" width="150" />
|
||||
<el-table-column prop="deviceType" label="设备类型" width="120">
|
||||
<template #default="scope">
|
||||
<span class="deviceType"></span>
|
||||
@ -120,7 +125,11 @@ var statusTrans = (id) => {
|
||||
}
|
||||
|
||||
const getTableList = async () => {
|
||||
const res = await deviceApi.deviceList(pages)
|
||||
let params = {
|
||||
...pages,
|
||||
cameraName: input3.value
|
||||
}
|
||||
const res = await deviceApi.deviceList(params)
|
||||
// if (res.code === 50) {
|
||||
// ElMessage.warning(res.message)
|
||||
// return
|
||||
@ -211,8 +220,29 @@ var delFun = (row) => {
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
const downloadTemp = () => {
|
||||
let serve = localStorage.getItem('ip')
|
||||
const attachUpload = async () => {
|
||||
let option = {
|
||||
properties: ['openFile'],
|
||||
filters: [
|
||||
{
|
||||
name: '模板', //、底图
|
||||
extensions: ['xlsx']
|
||||
}
|
||||
]
|
||||
}
|
||||
$sendElectronChanel('open-directory-dialog', option)
|
||||
$recvElectronChanel('selectedItem', (e, path) => {
|
||||
if (path.length) {
|
||||
const params = new URLSearchParams()
|
||||
params.append('filePath', path[0])
|
||||
deviceApi.uploadSingle(params).then((res) => {
|
||||
console.log(res, 'res')
|
||||
ElMessage.success('导入成功')
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const downloadTemp = async () => {
|
||||
let p = 'xlsx'
|
||||
if (process.platform == 'linux') {
|
||||
p = 'et'
|
||||
@ -220,7 +250,10 @@ const downloadTemp = () => {
|
||||
p = 'xlsx'
|
||||
}
|
||||
|
||||
let url = serve + '/static/excel/%E8%AE%BE%E5%A4%87%E6%A8%A1%E6%9D%BF.' + p
|
||||
const { ipcRenderer } = require('electron')
|
||||
let availablePort = await ipcRenderer.invoke('get-available-port')
|
||||
|
||||
let url = `http://localhost:${availablePort}/excel/imporTemp.` + p
|
||||
$sendElectronChanel('saveNetFile', {
|
||||
title: '保存文件',
|
||||
filename: '模板',
|
||||
@ -229,6 +262,7 @@ const downloadTemp = () => {
|
||||
})
|
||||
|
||||
$recvElectronChanel('saveNetFileRes', (e, key) => {
|
||||
console.log(key, 'key')
|
||||
ElMessage({
|
||||
message: '下载结束',
|
||||
type: 'success'
|
||||
@ -237,8 +271,6 @@ const downloadTemp = () => {
|
||||
console.log(res)
|
||||
})
|
||||
})
|
||||
|
||||
deviceApi.downloadTemp().then((res) => {})
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user