国标通道编辑重置支持选择字段

This commit is contained in:
lin
2025-11-06 20:31:51 +08:00
parent 01e72407ac
commit e453b3b394
7 changed files with 264 additions and 16 deletions

View File

@@ -86,16 +86,12 @@ public class CommonGBChannel {
@Schema(description = "国标-纬度 WGS-84坐标系")
private Double gbLatitude;
@Schema(description = "")
private Double gpsAltitude;
@Schema(description = "")
private Double gpsSpeed;
@Schema(description = "")
private Double gpsDirection;
@Schema(description = "")
private String gpsTime;
@Schema(description = "国标-虚拟组织所属的业务分组ID")

View File

@@ -104,7 +104,7 @@ public class ChannelController {
@Operation(summary = "重置国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/reset")
public void reset(ResetParam param){
public void reset(@RequestBody ResetParam param){
Assert.notNull(param.getId(), "通道ID不能为空");
Assert.notEmpty(param.getChanelFields(), "待重置字段不可以空");
channelService.reset(param.getId(), param.getChanelFields());

View File

@@ -237,8 +237,8 @@ public interface CommonGBChannelMapper {
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" SET update_time=#{updateTime}" +
"<foreach collection='fields' index='index' item='item' separator=';'> " +
", #{item} = null" +
"<foreach collection='fields' index='index' item='item'> " +
" ,${item} = null" +
"</foreach> " +
" WHERE id = #{id}"+
" </script>"})

View File

@@ -41,13 +41,11 @@ export function update(data) {
})
}
export function reset(id) {
export function reset(data) {
return request({
method: 'post',
url: '/api/common/channel/reset',
params: {
id: id
}
data: data
})
}

View File

@@ -72,9 +72,9 @@ const actions = {
})
})
},
reset({ commit }, id) {
reset({ commit }, data) {
return new Promise((resolve, reject) => {
reset(id).then(response => {
reset(data).then(response => {
const { data } = response
resolve(data)
}).catch(error => {

View File

@@ -233,7 +233,7 @@
<div style="text-align: right">
<el-button type="primary" @click="onSubmit" >保存</el-button>
<el-button v-if="showCancel" @click="cancelSubmit" >取消</el-button>
<el-button v-if="form.dataType === 1" @click="reset">重置</el-button>
<el-button v-if="form.dataType === 1" @click="showReset">重置</el-button>
</div>
</div>
@@ -241,6 +241,7 @@
<channelCode ref="channelCode" />
<chooseCivilCode ref="chooseCivilCode" />
<chooseGroup ref="chooseGroup" />
<resetChannel ref="resetChannel" @submit="reset"/>
</div>
</template>
@@ -249,10 +250,12 @@ import channelCode from './../dialog/channelCode'
import ChooseCivilCode from '../dialog/chooseCivilCode.vue'
import ChooseGroup from '../dialog/chooseGroup.vue'
import diff from '../../utils/diff'
import ResetChannel from './../dialog/resetChannel.vue'
export default {
name: 'CommonChannelEdit',
components: {
ResetChannel,
ChooseCivilCode,
ChooseGroup,
channelCode
@@ -346,7 +349,7 @@ export default {
}
})
},
reset: function() {
reset: function(fileIds) {
this.$confirm('确定重置为默认内容?', '提示', {
dangerouslyUseHTMLString: true,
confirmButtonText: '确定',
@@ -354,7 +357,10 @@ export default {
type: 'warning'
}).then(() => {
this.loading = true
this.$store.dispatch('commonChanel/reset', this.form.gbId)
this.$store.dispatch('commonChanel/reset', {
id: this.form.gbId,
chanelFields: fileIds
})
.then((data) => {
this.$message.success({
showClose: true,
@@ -406,6 +412,9 @@ export default {
cancelSubmit: function() {
this.$emit('cancel')
},
showReset: function() {
this.$refs.resetChannel.openDialog()
},
getPaths: function() {
this.parentPath = []
if (this.form.gbParentId && this.form.gbBusinessGroupId) {

View File

@@ -0,0 +1,245 @@
<template>
<el-dialog
v-el-drag-dialog
title="选择待重置字段"
width="45rem"
top="10rem"
center
:append-to-body="true"
:close-on-click-modal="false"
:visible.sync="showVideoDialog"
v-if="showVideoDialog"
:destroy-on-close="true"
>
<div style="padding: 0 1rem">
<el-checkbox v-for="(item,index) in allVal" v-bind:key="item.field" v-model="item.checked" :label="item.name" ></el-checkbox>
</div>
<div slot="footer">
<el-form size="small">
<el-form-item style="text-align: left">
<el-button @click="checkedSome" size="mini" >常用</el-button>
<el-button @click="checkedAll" size="mini" >全选</el-button>
<el-button @click="clearChecked" size="mini" >清空</el-button>
</el-form-item>
<el-form-item style="text-align: right">
<el-button type="primary" @click="handleOk">保存</el-button>
<el-button @click="closeModel" >取消</el-button>
</el-form-item>
</el-form>
</div>
</el-dialog>
</template>
<script>
import elDragDialog from '@/directive/el-drag-dialog'
export default {
directives: { elDragDialog },
props: {},
data() {
return {
showVideoDialog: false,
allVal: null
}
},
beforeMount() {
this.initData()
},
methods: {
openDialog: function() {
this.showVideoDialog = true
this.initData()
},
closeModel: function() {
this.showVideoDialog = false
},
initData: function() {
this.allVal = [
{
name: '名称',
field: 'gbName',
checked: true,
disable: false
},
{
name: '编码',
field: 'gbDeviceId',
checked: true,
disable: false
},
{
name: '设备厂商',
field: 'gbManufacturer',
checked: true,
disable: false
},
{
name: '设备型号',
field: 'gbModel',
checked: true,
disable: false
},
{
name: '行政区域',
field: 'gbCivilCode',
checked: true,
disable: false
},
{
name: '安装地址',
field: 'gbAddress',
checked: true,
disable: false
},
{
name: '监视方位',
field: 'gbDirectionType',
checked: true,
disable: false
},
{
name: '父节点编码',
field: 'gbParentId',
checked: true,
disable: false
},
{
name: '设备状态',
field: 'gbStatus',
checked: true,
disable: false
},
{
name: '经度',
field: 'gbLongitude',
checked: true,
disable: false
},
{
name: '纬度',
field: 'gbLatitude',
checked: true,
disable: false
},
{
name: '摄像机类型',
field: 'gbPtzType',
checked: true,
disable: false
},
{
name: '业务分组',
field: 'gbBusinessGroupId',
checked: true,
disable: false
},
{
name: '警区',
field: 'gbBlock',
checked: true,
disable: false
},
{
name: '保密属性',
field: 'gbSecrecy',
checked: true,
disable: false
},
{
name: 'IP地址',
field: 'gbIpAddress',
checked: true,
disable: false
},
{
name: '端口',
field: 'gbPort',
checked: true,
disable: false
},
{
name: '设备归属',
field: 'gbOwner',
checked: true,
disable: false
},
{
name: '是否有子设备',
field: 'gbParental',
checked: true,
disable: false
},
{
name: '位置类型',
field: 'gbPositionType',
checked: true,
disable: false
},
{
name: '室内/室外',
field: 'gbRoomType',
checked: true,
disable: false
},
{
name: '用途',
field: 'gbUseType',
checked: true,
disable: false
},
{
name: '补光',
field: 'gbSupplyLightType',
checked: true,
disable: false
},
{
name: '分辨率',
field: 'gbResolution',
checked: true,
disable: false
},
{
name: '下载倍速',
field: 'gbDownloadSpeed',
checked: true,
disable: false
}
]
},
clearChecked: function() {
for (let i = 0; i < this.allVal.length; i++) {
let item = this.allVal[i]
item.checked = false
}
},
checkedAll: function() {
for (let i = 0; i < this.allVal.length; i++) {
let item = this.allVal[i]
item.checked = true
}
},
checkedSome: function() {
for (let i = 0; i < this.allVal.length; i++) {
let item = this.allVal[i]
item.checked = (item.field === 'gbName' || item.field === 'gbStatus'
|| item.field === 'gbLongitude' || item.field === 'gbLatitude'
|| item.field === 'gbBusinessGroupId' || item.field === 'gbParentId')
}
},
handleOk: function() {
this.showVideoDialog = false
let fileArray = []
for (let i = 0; i < this.allVal.length; i++) {
let item = this.allVal[i]
if (item.checked) {
fileArray.push(item.field)
}
}
this.$emit('submit', fileArray)
}
}
}
</script>