添加设备新增页面
This commit is contained in:
@@ -86,6 +86,13 @@ public class JT1078Controller {
|
||||
assert device.getDeviceId() != null;
|
||||
service.addDevice(device);
|
||||
}
|
||||
@Operation(summary = "删除设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备ID", required = true)
|
||||
@DeleteMapping("/device/delete")
|
||||
public void addDevice(String deviceId){
|
||||
assert deviceId != null;
|
||||
service.deleteDeviceByDeviceId(deviceId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public interface JTDeviceMapper {
|
||||
"province_id,"+
|
||||
"city_id,"+
|
||||
"maker_id,"+
|
||||
"device_id,"+
|
||||
"device_model,"+
|
||||
"plate_color,"+
|
||||
"plate_no,"+
|
||||
@@ -63,6 +64,7 @@ public interface JTDeviceMapper {
|
||||
"#{provinceId}," +
|
||||
"#{cityId}," +
|
||||
"#{makerId}," +
|
||||
"#{deviceId}," +
|
||||
"#{deviceModel}," +
|
||||
"#{plateColor}," +
|
||||
"#{plateNo}," +
|
||||
@@ -73,4 +75,7 @@ public interface JTDeviceMapper {
|
||||
"#{updateTime}" +
|
||||
")")
|
||||
void addDevice(JTDevice device);
|
||||
|
||||
@Delete("delete from wvp_jt_device where device_id = #{deviceId}")
|
||||
void deleteDeviceByDeviceId(@Param("deviceId") String deviceId);
|
||||
}
|
||||
|
||||
@@ -13,4 +13,6 @@ public interface Ijt1078Service {
|
||||
PageInfo<JTDevice> getDeviceList(int page, int count, String query, Boolean online);
|
||||
|
||||
void addDevice(JTDevice device);
|
||||
|
||||
void deleteDeviceByDeviceId(String deviceId);
|
||||
}
|
||||
|
||||
@@ -42,4 +42,9 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
device.setUpdateTime(DateUtil.getNow());
|
||||
jtDeviceMapper.addDevice(device);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceByDeviceId(String deviceId) {
|
||||
jtDeviceMapper.deleteDeviceByDeviceId(deviceId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<script>
|
||||
import uiHeader from '../layout/UiHeader.vue'
|
||||
import deviceEdit from './dialog/deviceEdit.vue'
|
||||
import deviceEdit from './dialog/jtDeviceEdit.vue'
|
||||
import syncChannelProgress from './dialog/SyncChannelProgress.vue'
|
||||
|
||||
export default {
|
||||
@@ -121,7 +121,7 @@ export default {
|
||||
this.getDeviceListLoading = true;
|
||||
this.$axios({
|
||||
method: 'get',
|
||||
url: `/api/jt1078/devices`,
|
||||
url: `/api/jt1078/device/list`,
|
||||
params: {
|
||||
page: this.currentPage,
|
||||
count: this.count
|
||||
@@ -138,11 +138,7 @@ export default {
|
||||
});
|
||||
},
|
||||
deleteDevice: function (row) {
|
||||
let msg = "确定删除此设备?"
|
||||
if (row.online !== 0) {
|
||||
msg = "在线设备删除后仍可通过注册再次上线。<br/>如需彻底删除请先将设备离线。<br/><strong>确定删除此设备?</strong>"
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
this.$confirm("确定删除此设备?", '提示', {
|
||||
dangerouslyUseHTMLString: true,
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
@@ -151,7 +147,10 @@ export default {
|
||||
}).then(() => {
|
||||
this.$axios({
|
||||
method: 'delete',
|
||||
url: `/api/device/query/devices/${row.deviceId}/delete`
|
||||
url: '/api/jt1078/device/delete',
|
||||
params: {
|
||||
deviceId: row.deviceId
|
||||
}
|
||||
}).then((res) => {
|
||||
this.getDeviceList();
|
||||
}).catch((error) => {
|
||||
@@ -160,81 +159,6 @@ export default {
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
showChannelList: function (row) {
|
||||
this.$router.push(`/channelList/${row.deviceId}/0`);
|
||||
},
|
||||
showDevicePosition: function (row) {
|
||||
this.$router.push(`/map?deviceId=${row.deviceId}`);
|
||||
},
|
||||
|
||||
//gb28181平台对接
|
||||
//刷新设备信息
|
||||
refDevice: function (itemData) {
|
||||
console.log("刷新对应设备:" + itemData.deviceId);
|
||||
let that = this;
|
||||
this.$axios({
|
||||
method: 'get',
|
||||
url: '/api/device/query/devices/' + itemData.deviceId + '/sync'
|
||||
}).then((res) => {
|
||||
console.log("刷新设备结果:" + JSON.stringify(res));
|
||||
if (res.data.code !== 0) {
|
||||
that.$message({
|
||||
showClose: true,
|
||||
message: res.data.msg,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
// that.$message({
|
||||
// showClose: true,
|
||||
// message: res.data.msg,
|
||||
// type: 'success'
|
||||
// });
|
||||
this.$refs.syncChannelProgress.openDialog(itemData.deviceId)
|
||||
}
|
||||
that.initData()
|
||||
}).catch((e) => {
|
||||
console.error(e)
|
||||
that.$message({
|
||||
showClose: true,
|
||||
message: e,
|
||||
type: 'error'
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
getTooltipContent: async function (deviceId) {
|
||||
let result = "";
|
||||
await this.$axios({
|
||||
method: 'get',
|
||||
async: false,
|
||||
url: `/api/device/query/${deviceId}/sync_status/`,
|
||||
}).then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.errorMsg !== null) {
|
||||
result = res.data.data.errorMsg
|
||||
} else if (res.data.msg !== null) {
|
||||
result = res.data.msg
|
||||
} else {
|
||||
result = `同步中...[${res.data.data.current}/${res.data.data.total}]`;
|
||||
}
|
||||
}
|
||||
})
|
||||
return result;
|
||||
},
|
||||
transportChange: function (row) {
|
||||
console.log(`修改传输方式为 ${row.streamMode}:${row.deviceId} `);
|
||||
let that = this;
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url: '/api/device/query/transport/' + row.deviceId + '/' + row.streamMode
|
||||
}).then(function (res) {
|
||||
|
||||
}).catch(function (e) {
|
||||
});
|
||||
},
|
||||
edit: function (row) {
|
||||
this.$refs.deviceEdit.openDialog(row, () => {
|
||||
|
||||
88
web_src/src/components/dialog/jtDeviceEdit.vue
Executable file
88
web_src/src/components/dialog/jtDeviceEdit.vue
Executable file
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<div id="deviceEdit" v-loading="isLoging">
|
||||
<el-dialog
|
||||
title="设备编辑"
|
||||
width="40%"
|
||||
top="2rem"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="showDialog"
|
||||
:destroy-on-close="true"
|
||||
@close="close()"
|
||||
>
|
||||
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
|
||||
<el-form ref="form" :rules="rules" :model="form" label-width="200px" >
|
||||
<el-form-item label="设备编号" prop="deviceId">
|
||||
<el-input v-model="form.deviceId" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div style="float: right;">
|
||||
<el-button type="primary" @click="onSubmit" >确认</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "deviceEdit",
|
||||
props: {},
|
||||
computed: {},
|
||||
created() {},
|
||||
data() {
|
||||
return {
|
||||
listChangeCallback: null,
|
||||
showDialog: false,
|
||||
isLoging: false,
|
||||
form: {},
|
||||
isEdit: false,
|
||||
rules: {
|
||||
deviceId: [{ required: true, message: "请输入设备编号", trigger: "blur" }]
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openDialog: function (row, callback) {
|
||||
console.log(row)
|
||||
this.showDialog = true;
|
||||
this.isEdit = false;
|
||||
if (row) {
|
||||
this.isEdit = true;
|
||||
}
|
||||
this.form = {};
|
||||
this.listChangeCallback = callback;
|
||||
if (row != null) {
|
||||
this.form = row;
|
||||
}
|
||||
},
|
||||
onSubmit: function () {
|
||||
console.log("onSubmit");
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url:`/api/jt1078/device/${this.isEdit?'update':'add'}/`,
|
||||
params: this.form
|
||||
}).then((res) => {
|
||||
console.log(res.data)
|
||||
if (res.data.code === 0) {
|
||||
this.listChangeCallback()
|
||||
}else {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: res.data.msg,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
close: function () {
|
||||
this.showDialog = false;
|
||||
this.$refs.form.resetFields();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user