Browse Source

报警等级设置 站点更改为限制场景的数据

master
Fuyuu 1 year ago
parent
commit
a015316b52
  1. 36
      src/views/military/modules/alarmManage/alarmLevel/MsWarnLevel.data.ts
  2. 125
      src/views/military/modules/alarmManage/alarmLevel/components/MsWarnLevelForm.vue

36
src/views/military/modules/alarmManage/alarmLevel/MsWarnLevel.data.ts

@ -1,3 +1,11 @@
/*
* @Author: Fuyuu 1805498209@qq.com
* @Date: 2023-12-07 18:07:21
* @LastEditors: Fuyuu 1805498209@qq.com
* @LastEditTime: 2023-12-29 11:28:03
* @FilePath: \dt-admin-pc-v2\src\views\military\modules\alarmManage\alarmLevel\MsWarnLevel.data.ts
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
@ -5,31 +13,30 @@ import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '区域编号',
align: "center",
dataIndex: 'lineId'
title: '报警区域',
align: 'center',
dataIndex: 'lineId_dictText',
},
{
title: '报警类型',
align: "center",
dataIndex: 'warnType_dictText'
align: 'center',
dataIndex: 'warnType_dictText',
},
{
title: '报警级别',
align: "center",
dataIndex: 'warnLevel_dictText'
align: 'center',
dataIndex: 'warnLevel_dictText',
},
{
title: '音频文件路径',
align: "center",
align: 'center',
dataIndex: 'warnAudio',
slots: { customRender: 'fileSlot' },
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
@ -38,7 +45,7 @@ export const formSchema: FormSchema[] = [
field: 'lineId',
component: 'JDictSelectTag',
componentProps: {
dictCode: "ms_map_line,name,id"
dictCode: 'ms_map_line,name,id',
},
},
{
@ -46,7 +53,7 @@ export const formSchema: FormSchema[] = [
field: 'warnType',
component: 'JDictSelectTag',
componentProps: {
dictCode: "ms_warn_type"
dictCode: 'ms_warn_type',
},
},
{
@ -54,15 +61,14 @@ export const formSchema: FormSchema[] = [
field: 'warnLevel',
component: 'JDictSelectTag',
componentProps: {
dictCode: "ms_warn_level"
dictCode: 'ms_warn_level',
},
},
{
label: '音频文件路径',
field: 'warnAudio',
component: 'JUpload',
componentProps: {
},
componentProps: {},
},
// TODO 主键隐藏字段,目前写死为ID
{

125
src/views/military/modules/alarmManage/alarmLevel/components/MsWarnLevelForm.vue

@ -2,7 +2,7 @@
* @Author: Fuyuu 1805498209@qq.com
* @Date: 2023-11-24 10:15:24
* @LastEditors: Fuyuu 1805498209@qq.com
* @LastEditTime: 2023-11-29 10:10:40
* @LastEditTime: 2023-12-29 11:22:51
* @FilePath: \dt-admin-pc\src\views\military\modules\prewarn\components\msWarnLevelForm.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@ -11,23 +11,45 @@
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row>
<a-col :span="24">
<a-form-item label="区域编号" v-bind="validateInfos.lineId">
<j-dict-select-tag v-model:value="formData.lineId" dictCode="ms_map_line,name,id" :string-to-number="true" placeholder="请选择区域编号" :disabled="disabled"/>
<a-form-item label="报警区域" v-bind="validateInfos.lineId">
<!-- <j-dict-select-tag v-model:value="formData.lineId" dictCode="ms_map_line,name,id" :string-to-number="true" placeholder="请选择区域编号" :disabled="disabled"/> -->
<a-tree-select
ref="cameraTree"
v-model:value="formData.lineId"
allow-clear
:treeData="nodeTree"
:disabled="disabled"
placeholder="请选择报警区域"
>
<template #suffixIcon><VideoCameraOutlined /></template>
</a-tree-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="报警类型" v-bind="validateInfos.warnType">
<j-dict-select-tag v-model:value="formData.warnType" dictCode="ms_warn_type" :string-to-number="true" placeholder="请选择报警类型" :disabled="disabled"/>
<j-dict-select-tag
v-model:value="formData.warnType"
dictCode="ms_warn_type"
:string-to-number="true"
placeholder="请选择报警类型"
:disabled="disabled"
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="报警级别" v-bind="validateInfos.warnLevel">
<j-dict-select-tag v-model:value="formData.warnLevel" dictCode="ms_warn_level" :string-to-number="true" placeholder="请选择报警级别" :disabled="disabled"/>
<j-dict-select-tag
v-model:value="formData.warnLevel"
dictCode="ms_warn_level"
:string-to-number="true"
placeholder="请选择报警级别"
:disabled="disabled"
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="报警声音" v-bind="validateInfos.warnAudio">
<j-upload v-model:value="formData.warnAudio" :disabled="disabled" ></j-upload>
<j-upload v-model:value="formData.warnAudio" :disabled="disabled"></j-upload>
</a-form-item>
</a-col>
</a-row>
@ -44,21 +66,86 @@
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../MsWarnLevel.api';
import { Form } from 'ant-design-vue';
//
import { useUserStore } from '/@/store/modules/user';
// id
const sceneId = useUserStore().userInfo?.sceneId;
//
const sceneList: any = [];
//
const areaList: any = [];
//
const nodeTree: any = ref([]);
//
function getCurrentScene() {
return defHttp.get(
{ url: '/military/msMapScene/list', params: { sceneId: sceneId + '*', pageNo: 1, pageSize: 9999 } },
{ isTransformResponse: false }
);
}
//
function getCurrentSceneArea() {
return defHttp.get({ url: '/military/msMapLine/list', params: { pageNo: 1, pageSize: 9999 } }, { isTransformResponse: false });
}
//
function handleCameraTree(data, index = undefined) {
let arr: any = [];
for (let i = 0; i < data.length; i++) {
let obj: any = {};
let item = data[i];
obj.title = item.title;
obj.value = obj.key = item.value;
obj.disabled = item.children?.length >= 0 ? true : false;
if (item.children && item.children.length > 0) {
obj.children = [];
let indexValue: any = index ? index + '-' + (i + 1) : i + 1;
obj.children = handleCameraTree(item.children, indexValue);
}
arr.push(obj);
}
return arr;
}
onMounted(() => {
//
getCurrentScene().then((res) => {
sceneList.value = res.result.records;
getCurrentSceneArea().then((res1) => {
areaList.value = res1.result.records;
//
const tree: any = [];
//
sceneList.value.forEach((row) => {
const node = { title: row.sceneName, value: row.sceneId, children: [] };
tree.push(node);
});
//
areaList.value.forEach((row) => {
const parentNode = tree.find((node) => node.value === row.sceneId);
if (parentNode) {
const node = { title: row.name, value: row.id, children: null };
parentNode.children.push(node);
}
});
// ant tree-select
nodeTree.value = handleCameraTree(tree);
});
});
});
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: ()=>{} },
formBpm: { type: Boolean, default: true }
formData: { type: Object, default: () => {} },
formBpm: { type: Boolean, default: true },
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
lineId: '',
lineId: undefined,
warnType: undefined,
warnLevel: undefined,
warnAudio: '',
warnAudio: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
@ -66,25 +153,24 @@
const confirmLoading = ref<boolean>(false);
//
const validatorRules = {
lineId: [{ required: true, message: '请选择区域编号!'},],
warnType: [{ required: true, message: '请选择报警类型!'},],
warnLevel: [{ required: true, message: '请选择报警级别!'},],
lineId: [{ required: true, message: '请选择区域编号!' }],
warnType: [{ required: true, message: '请选择报警类型!' }],
warnLevel: [{ required: true, message: '请选择报警级别!' }],
};
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
}else{
} else {
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
@ -141,7 +227,6 @@
});
}
defineExpose({
add,
edit,

Loading…
Cancel
Save