11 files modified
2 files added
| | |
| | | const titleEnum = ref({ edit: '编辑', view: '查看', add: '新增' }) |
| | | |
| | | const rules = { |
| | | deviceName: fieldRules(true, 50), |
| | | deviceType: fieldRules(true, 0), |
| | | deviceAtt: fieldRules(true, 0), |
| | | deviceModel: fieldRules(true, 50), |
| | | belongDept: fieldRules(true, 50), |
| | | contactPhone: fieldRules(true, 50), |
| | | charger: fieldRules(true, 0), |
| | | deviceName: fieldRules(true, false, 50), |
| | | deviceType: fieldRules(true, true), |
| | | deviceAtt: fieldRules(true, true), |
| | | deviceModel: fieldRules(true, false, 50), |
| | | belongDept: fieldRules(true, true), |
| | | contactPhone: fieldRules(true, false, 50), |
| | | charger: fieldRules(true, true), |
| | | } |
| | | |
| | | // 部门重置 |
| | |
| | | let pointList = [] |
| | | |
| | | const rules = { |
| | | areaName: fieldRules(true, 50), |
| | | areaType: fieldRules(true, 0), |
| | | controlLevel: fieldRules(true, 0), |
| | | areaName: fieldRules(true, false, 50), |
| | | areaType: fieldRules(true, true), |
| | | controlLevel: fieldRules(true, true), |
| | | } |
| | | |
| | | // 关闭弹框 |
| | |
| | | const tempLocation = ref({ longitude: null, latitude: null }) |
| | | |
| | | const rules = { |
| | | address: fieldRules(true, 50), |
| | | stationName: fieldRules(true, 50), |
| | | contactPerson: fieldRules(true, 50), |
| | | contactPhone: fieldRules(true, 0), |
| | | address: fieldRules(true, false, 50), |
| | | stationName: fieldRules(true, false, 50), |
| | | contactPerson: fieldRules(true, false, 50), |
| | | contactPhone: fieldRules(true, false, 50), |
| | | } |
| | | |
| | | // 关闭弹框 |
| New file |
| | |
| | | <template> |
| | | <el-dialog v-model="visible" :title="titleEnum[dialogMode]" :close-on-click-modal="false" width="80%"> |
| | | <div class="bodyBox"> |
| | | <div class="leftMap ztzf-cesium" id="mapContainer"></div> |
| | | <div class="rightInfo"> |
| | | <div v-if="readonly"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <div>场景名称: {{ formData.sceneName }}</div> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <div>指挥点位置: {{ formatLocation(formData) }}</div> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <div>场景类型: {{ getDictLabel(formData.sceneType, dictObj.sceneType) }}</div> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <div>防控负责人: {{ formData.defenseLeader }}</div> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <div>防控负责人电话: {{ formData.leaderPhone }}</div> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <div>设备模式: {{ getDictLabel(formData.deviceMode, dictObj.deviceMode) }}</div> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <div>关联区域: {{ formatAreaNames() }}</div> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <div>防控面积: {{ formatDefenseArea(formData.defenseArea) }}</div> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <el-form v-else ref="formRef" :model="formData" :rules="rules" :disabled="readonly" label-width="100px"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="场景名称" prop="sceneName"> |
| | | <el-input v-model="formData.sceneName" maxlength="50" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="指挥点位置" prop="longitude"> |
| | | <div>{{ formatLocation(formData) }}</div> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="场景类型" prop="sceneType"> |
| | | <el-select v-model="formData.sceneType" placeholder="请选择" clearable> |
| | | <el-option |
| | | v-for="item in dictObj.sceneType" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="防控负责人" prop="defenseLeader"> |
| | | <el-input v-model="formData.defenseLeader" maxlength="50" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="防控负责人电话" prop="leaderPhone"> |
| | | <el-input v-model="formData.leaderPhone" maxlength="50" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="设备模式" prop="deviceMode"> |
| | | <el-select v-model="formData.deviceMode" placeholder="请选择" clearable> |
| | | <el-option |
| | | v-for="item in dictObj.deviceMode" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="防控面积" prop="defenseArea"> |
| | | <div>{{ formatDefenseArea(formData.defenseArea) }}</div> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="关联区域" prop="areaDivideIds"> |
| | | <el-table |
| | | ref="areaTableRef" |
| | | :data="areaList" |
| | | row-key="id" |
| | | @selection-change="handleAreaSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="areaName" label="区域名称" /> |
| | | <el-table-column prop="areaType" label="区域类型"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.areaType, dictObj.areaType) }} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </div> |
| | | </div> |
| | | <template #footer> |
| | | <el-button @click="handleCancel">{{ readonly ? '关闭' : '取消' }}</el-button> |
| | | <el-button v-if="!readonly" type="primary" :loading="submitting" :disabled="submitting" @click="handleSubmit"> |
| | | 确定 |
| | | </el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, inject, nextTick, onMounted, ref } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import { fwDefenseSceneDetailApi, fwDefenseSceneSubmitApi } from './sceneConfigApi' |
| | | import { fieldRules, getDictLabel } from '@ztzf/utils' |
| | | import { PublicCesium } from '@/utils/cesium/publicCesium' |
| | | import * as Cesium from 'cesium' |
| | | import { fwAreaDivideListApi } from '../partition/partitionApi' |
| | | |
| | | const initForm = () => ({ |
| | | sceneName: '', // 场景名称 |
| | | sceneType: '', // 场景类型 |
| | | defenseLeader: '', // 防控负责人 |
| | | leaderPhone: '', // 防控负责人电话 |
| | | deviceMode: '', // 设备模式 |
| | | areaDivideIds: '', // 关联区域ID |
| | | areaCount: 0, // 区域数量 |
| | | defenseArea: 0, // 防控面积 |
| | | latitude: null, // 指挥点纬度 |
| | | longitude: null, // 指挥点经度 |
| | | }) |
| | | |
| | | const emit = defineEmits(['success']) |
| | | const formRef = ref(null) // 表单实例 |
| | | const formData = ref(initForm()) // 表单数据 |
| | | const visible = defineModel() // 弹框显隐 |
| | | const dialogMode = ref('add') // 弹框模式 |
| | | const submitting = ref(false) // 提交中 |
| | | const readonly = computed(() => dialogMode.value === 'view') |
| | | const titleEnum = ref({ edit: '编辑', view: '查看', add: '新增' }) |
| | | const areaTableRef = ref(null) |
| | | const areaList = ref([]) // 关联区域列表 |
| | | const selectedAreaRows = ref([]) |
| | | const dictObj = inject('dictObj') |
| | | |
| | | const rules = { |
| | | sceneName: fieldRules(true, false, 50), |
| | | sceneType: fieldRules(true, true), |
| | | defenseLeader: fieldRules(true, false, 50), |
| | | leaderPhone: fieldRules(true, false, 50), |
| | | deviceMode: fieldRules(true, true), |
| | | longitude: fieldRules(true, true), |
| | | areaDivideIds: fieldRules(true, true), |
| | | } |
| | | |
| | | // 关闭弹框 |
| | | function handleCancel() { |
| | | visible.value = false |
| | | } |
| | | |
| | | // 提交新增/编辑 |
| | | async function handleSubmit() { |
| | | const isValid = await formRef.value?.validate().catch(() => false) |
| | | if (!isValid) return |
| | | submitting.value = true |
| | | try { |
| | | const ids = selectedAreaRows.value.map(item => item.id) |
| | | formData.value.areaDivideIds = ids.join(',') |
| | | formData.value.areaCount = ids.length |
| | | formData.value.defenseArea = calcDefenseArea(selectedAreaRows.value) |
| | | await fwDefenseSceneSubmitApi(formData.value) |
| | | ElMessage.success(dialogMode.value === 'add' ? '新增成功' : '更新成功') |
| | | visible.value = false |
| | | emit('success') |
| | | } finally { |
| | | submitting.value = false |
| | | } |
| | | } |
| | | |
| | | // 加载详情 |
| | | async function loadDetail() { |
| | | if (!formData.value.id) return |
| | | const res = await fwDefenseSceneDetailApi({ id: formData.value.id }) |
| | | formData.value = res?.data?.data ?? initForm() |
| | | } |
| | | |
| | | // 获取区域列表 |
| | | async function getAreaList() { |
| | | if (areaList.value.length) return |
| | | const res = await fwAreaDivideListApi() |
| | | areaList.value = res?.data?.data ?? [] |
| | | } |
| | | |
| | | // 关联区域变更 |
| | | function handleAreaSelectionChange(rows) { |
| | | selectedAreaRows.value = rows |
| | | const ids = rows.map(item => item.id) |
| | | formData.value.areaDivideIds = ids.join(',') |
| | | formData.value.areaCount = ids.length |
| | | formData.value.defenseArea = calcDefenseArea(rows) |
| | | formRef.value?.validateField('areaDivideIds') |
| | | } |
| | | |
| | | function calcDefenseArea(rows) { |
| | | const total = rows.reduce((sum, item) => sum + (Number(item.areaSize) || 0), 0) |
| | | return _.round(total, 2) |
| | | } |
| | | |
| | | function getAreaIdList() { |
| | | if (!formData.value.areaDivideIds) return [] |
| | | return formData.value.areaDivideIds.split(',').filter(Boolean) |
| | | } |
| | | |
| | | function syncAreaSelection() { |
| | | if (!areaTableRef.value) return |
| | | areaTableRef.value.clearSelection() |
| | | const ids = new Set(getAreaIdList().map(String)) |
| | | const rows = [] |
| | | areaList.value.forEach(row => { |
| | | if (ids.has(String(row.id))) { |
| | | areaTableRef.value.toggleRowSelection(row, true) |
| | | rows.push(row) |
| | | } |
| | | }) |
| | | selectedAreaRows.value = rows |
| | | if (!rows.length) return |
| | | formData.value.areaCount = rows.length |
| | | formData.value.defenseArea = calcDefenseArea(rows) |
| | | } |
| | | |
| | | function formatAreaNames() { |
| | | const rows = selectedAreaRows.value.length ? selectedAreaRows.value : getAreaRowsByIds() |
| | | return rows.map(item => item.areaName).join(', ') |
| | | } |
| | | |
| | | function getAreaRowsByIds() { |
| | | const ids = new Set(getAreaIdList().map(String)) |
| | | return areaList.value.filter(item => ids.has(String(item.id))) |
| | | } |
| | | |
| | | function formatDefenseArea(value) { |
| | | if (value == null || value === '') return '' |
| | | return `${value}k㎡` |
| | | } |
| | | |
| | | // 格式化指挥点位置 |
| | | function formatLocation(row) { |
| | | if (row?.longitude == null || row?.latitude == null) return '' |
| | | return `${_.round(row.longitude, 6)}, ${_.round(row.latitude, 6)}` |
| | | } |
| | | |
| | | // 初始化地图实例 |
| | | function initMap() { |
| | | const publicCesiumInstance = new PublicCesium({ |
| | | dom: 'mapContainer', |
| | | flatMode: false, |
| | | terrain: true, |
| | | layerMode: 4, |
| | | boundary: false, |
| | | }) |
| | | if (!readonly.value) { |
| | | publicCesiumInstance.addLeftClickEvent(null, LeftClickEvent) |
| | | } |
| | | viewer = publicCesiumInstance.getViewer() |
| | | } |
| | | |
| | | function LeftClickEvent(click) { |
| | | const pos = click.position |
| | | const cartesian3 = viewer.camera.pickEllipsoid(pos, viewer.scene.globe.ellipsoid) |
| | | if (!cartesian3) return |
| | | const carto = Cesium.Cartographic.fromCartesian(cartesian3) |
| | | const longitude = Cesium.Math.toDegrees(carto.longitude) |
| | | const latitude = Cesium.Math.toDegrees(carto.latitude) |
| | | formData.value.longitude = _.round(longitude, 6) |
| | | formData.value.latitude = _.round(latitude, 6) |
| | | setMapPoint(formData.value.longitude, formData.value.latitude) |
| | | } |
| | | |
| | | function setMapPoint(longitude, latitude) { |
| | | if (!viewer || longitude == null || latitude == null) return |
| | | if (!redPointEntity) { |
| | | redPointEntity = viewer.entities.add({ |
| | | position: Cesium.Cartesian3.fromDegrees(longitude, latitude), |
| | | point: { |
| | | color: Cesium.Color.RED, |
| | | pixelSize: 10, |
| | | }, |
| | | label: { |
| | | text: `${longitude.toFixed(6)}, ${latitude.toFixed(6)}`, |
| | | fillColor: Cesium.Color.WHITE, |
| | | outlineColor: Cesium.Color.BLACK, |
| | | outlineWidth: 2, |
| | | style: Cesium.LabelStyle.FILL_AND_OUTLINE, |
| | | verticalOrigin: Cesium.VerticalOrigin.BOTTOM, |
| | | pixelOffset: new Cesium.Cartesian2(0, -12), |
| | | }, |
| | | }) |
| | | } else { |
| | | redPointEntity.position = Cesium.Cartesian3.fromDegrees(longitude, latitude) |
| | | redPointEntity.label.text = `${longitude.toFixed(6)}, ${latitude.toFixed(6)}` |
| | | } |
| | | } |
| | | |
| | | let viewer |
| | | let redPointEntity |
| | | |
| | | // 打开弹框 |
| | | async function open({ mode, row } = {}) { |
| | | dialogMode.value = mode || 'add' |
| | | formData.value = dialogMode.value === 'add' ? initForm() : row |
| | | selectedAreaRows.value = [] |
| | | redPointEntity = null |
| | | await nextTick() |
| | | initMap() |
| | | await getAreaList() |
| | | if (dialogMode.value !== 'add') { |
| | | await loadDetail() |
| | | } |
| | | await nextTick() |
| | | syncAreaSelection() |
| | | setMapPoint(formData.value.longitude, formData.value.latitude) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getAreaList() |
| | | }) |
| | | |
| | | defineExpose({ |
| | | open, |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .bodyBox { |
| | | display: flex; |
| | | height: 600px; |
| | | .leftMap { |
| | | width: 70%; |
| | | height: 100%; |
| | | } |
| | | .rightInfo { |
| | | width: 30%; |
| | | height: 100%; |
| | | overflow: auto; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <basic-container> |
| | | 场景配置管理 |
| | | </basic-container> |
| | | <basic-container> |
| | | <el-form ref="queryParamsRef" :model="searchParams"> |
| | | <el-row :gutter="16"> |
| | | <el-col :span="4"> |
| | | <el-form-item label="场景名称" prop="sceneName"> |
| | | <el-input v-model="searchParams.sceneName" placeholder="请输入" clearable @clear="handleSearch" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="场景类型" prop="sceneType"> |
| | | <el-select v-model="searchParams.sceneType" placeholder="请选择" clearable @change="handleSearch"> |
| | | <el-option |
| | | v-for="item in dictObj.sceneType" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="场景状态" prop="status"> |
| | | <el-select v-model="searchParams.status" placeholder="请选择" clearable @change="handleSearch"> |
| | | <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item> |
| | | <el-button @click="resetForm">重置</el-button> |
| | | <el-button type="primary" @click="handleSearch">查询</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">新增</el-button> |
| | | <el-button type="danger" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button> |
| | | </div> |
| | | <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column type="index" width="60" label="序号" /> |
| | | <el-table-column prop="deviceName" label="设备名称" /> |
| | | <el-table-column prop="sceneName" label="场景名称" /> |
| | | <el-table-column prop="sceneType" label="场景类型"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.sceneType, dictObj.sceneType) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="指挥点位置"> |
| | | <template v-slot="{ row }"> |
| | | {{ formatLocation(row) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="defenseLeader" label="防控负责人" /> |
| | | <el-table-column prop="leaderPhone" label="防控负责人电话" /> |
| | | <el-table-column prop="areaCount" label="区域数量" /> |
| | | <el-table-column prop="counterDeviceCount" label="反制设备数量" /> |
| | | <el-table-column prop="detectDeviceCount" label="探测设备数量" /> |
| | | <el-table-column label="操作"> |
| | | <template v-slot="{ row }"> |
| | | <el-link @click="openForm('view', row)" type="primary">查看</el-link> |
| | | <el-link @click="openForm('edit', row)" type="warning">编辑</el-link> |
| | | <el-link @click="handleDelete(row)" type="danger">删除</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div> |
| | | <el-pagination |
| | | v-model:current-page="searchParams.current" |
| | | v-model:page-size="searchParams.size" |
| | | :total="total" |
| | | @change="getList" |
| | | /> |
| | | </div> |
| | | |
| | | <FormDiaLog v-if="dialogVisible" v-model="dialogVisible" ref="dialogRef" @success="getList" /> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { nextTick, onMounted, provide, ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { fwDefenseScenePageApi, fwDefenseSceneRemoveApi } from './sceneConfigApi' |
| | | import FormDiaLog from './FormDiaLog.vue' |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | | import { getDictLabel } from '@ztzf/utils' |
| | | |
| | | const initSearchParams = () => ({ |
| | | sceneName: '', // 场景名称 |
| | | sceneType: '', // 场景类型 |
| | | status: '', // 场景状态 |
| | | current: 1, // 当前页 |
| | | size: 10, // 每页大小 |
| | | }) |
| | | |
| | | const searchParams = ref(initSearchParams()) // 查询参数 |
| | | const total = ref(0) // 总条数 |
| | | const loading = ref(false) // 列表加载中 |
| | | const list = ref([]) // 列表数据 |
| | | const selectedIds = ref([]) // 勾选的ID列表 |
| | | const queryParamsRef = ref(null) // 查询表单实例 |
| | | const dialogRef = ref(null) // 弹框实例 |
| | | const dialogVisible = ref(false) |
| | | |
| | | const statusOptions = ref([ |
| | | { label: '正常', value: 0 }, |
| | | { label: '停用', value: 1 }, |
| | | ]) |
| | | |
| | | // 获取列表 |
| | | async function getList() { |
| | | loading.value = true |
| | | try { |
| | | const res = await fwDefenseScenePageApi(searchParams.value) |
| | | list.value = res?.data?.data?.records ?? [] |
| | | total.value = res?.data?.data?.total ?? 0 |
| | | } finally { |
| | | loading.value = false |
| | | } |
| | | } |
| | | |
| | | // 查询 |
| | | function handleSearch() { |
| | | searchParams.value.current = 1 |
| | | getList() |
| | | } |
| | | |
| | | // 重置查询 |
| | | function resetForm() { |
| | | queryParamsRef.value?.resetFields() |
| | | searchParams.value.current = 1 |
| | | getList() |
| | | } |
| | | |
| | | // 删除 |
| | | async function handleDelete(row) { |
| | | const tips = row ? '该条' : '选中的项' |
| | | await ElMessageBox.confirm(`确认删除${tips}吗?`, '提示', { type: 'warning' }) |
| | | const ids = row ? row.id : selectedIds.value.join(',') |
| | | await fwDefenseSceneRemoveApi({ ids }) |
| | | ElMessage.success('删除成功') |
| | | selectedIds.value = [] |
| | | getList() |
| | | } |
| | | |
| | | // 勾选值设置 |
| | | function handleSelectionChange(rows) { |
| | | selectedIds.value = rows.map(item => item.id) |
| | | } |
| | | |
| | | function formatLocation(row) { |
| | | if (row?.longitude == null || row?.latitude == null) return '' |
| | | return `${_.round(row.longitude, 6)}, ${_.round(row.latitude, 6)}` |
| | | } |
| | | |
| | | const dictObj = ref({ |
| | | sceneType: [], // 场景类型 |
| | | deviceMode: [], // 设备模式 |
| | | areaType: [], // 区域类型 |
| | | }) |
| | | provide('dictObj', dictObj) |
| | | |
| | | // 获取字典 |
| | | function getDictList() { |
| | | getDictionaryByCode('sceneType,deviceMode,areaType').then(res => { |
| | | dictObj.value = res.data.data |
| | | }) |
| | | } |
| | | |
| | | // 新增/编辑/查看 弹框 |
| | | function openForm(mode, row) { |
| | | dialogVisible.value = true |
| | | nextTick(() => { |
| | | dialogRef.value?.open({ mode, row }) |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList() |
| | | getDictList() |
| | | }) |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | </style> |
| | | <style scoped lang="scss"></style> |
| New file |
| | |
| | | import request from '@/axios' |
| | | |
| | | // 查page |
| | | export const fwDefenseScenePageApi = params => { |
| | | return request({ |
| | | url: `/drone-fw/area/fwDefenseScene/page`, |
| | | method: 'get', |
| | | params, |
| | | }) |
| | | } |
| | | |
| | | // 查list |
| | | export const fwDefenseSceneListApi = params => { |
| | | return request({ |
| | | url: `/drone-fw/area/fwDefenseScene/list`, |
| | | method: 'get', |
| | | params, |
| | | }) |
| | | } |
| | | |
| | | // 增加或更新 |
| | | export const fwDefenseSceneSubmitApi = data => { |
| | | return request({ |
| | | url: `/drone-fw/area/fwDefenseScene/submit`, |
| | | method: 'post', |
| | | data, |
| | | }) |
| | | } |
| | | |
| | | //删除 |
| | | export const fwDefenseSceneRemoveApi = params => { |
| | | return request({ |
| | | url: `/drone-fw/area/fwDefenseScene/remove`, |
| | | method: 'post', |
| | | params, |
| | | }) |
| | | } |
| | | |
| | | //详情 |
| | | export const fwDefenseSceneDetailApi = params => { |
| | | return request({ |
| | | url: `/drone-fw/area/fwDefenseScene/detail`, |
| | | method: 'get', |
| | | params, |
| | | }) |
| | | } |
| | |
| | | }) |
| | | |
| | | const rules = { |
| | | scrapReason: fieldRules(true, 200), |
| | | disposeWay: fieldRules(true, 200), |
| | | scrapTime: fieldRules(true, 0), |
| | | scrapReason: fieldRules(true, false, 200), |
| | | disposeWay: fieldRules(true, false, 200), |
| | | scrapTime: fieldRules(true, true), |
| | | } |
| | | |
| | | // 关闭弹框 |
| | |
| | | }) |
| | | |
| | | const rules = { |
| | | charger: fieldRules(true, 0), // 负责人 |
| | | contactPhone: fieldRules(true, 50), // 联系电话 |
| | | outTarget: fieldRules(true, 50), |
| | | outTime: fieldRules(true, 0), |
| | | purpose: fieldRules(true, 50), // 用途 |
| | | charger: fieldRules(true, true), // 负责人 |
| | | contactPhone: fieldRules(true, false, 50), // 联系电话 |
| | | outTarget: fieldRules(true, false, 50), |
| | | outTime: fieldRules(true, true), |
| | | purpose: fieldRules(true, false, 50), // 用途 |
| | | } |
| | | |
| | | const userList = ref([]) |
| | |
| | | }) |
| | | |
| | | const rules = { |
| | | deviceName: fieldRules(true, 50), |
| | | deviceType: fieldRules(true, 0), |
| | | deviceAtt: fieldRules(true, 0), |
| | | deviceModel: fieldRules(true, 50), |
| | | deviceSpecification: fieldRules(true, 50), |
| | | manufacturer: fieldRules(true, 50), |
| | | source: fieldRules(true, 50), |
| | | purpose: fieldRules(true, 50), |
| | | belongDept: fieldRules(true, 50), |
| | | contactPhone: fieldRules(true, 50), |
| | | charger: fieldRules(true, 0), |
| | | deviceName: fieldRules(true, false, 50), |
| | | deviceType: fieldRules(true, true), |
| | | deviceAtt: fieldRules(true, true), |
| | | deviceModel: fieldRules(true, false, 50), |
| | | deviceSpecification: fieldRules(true, false, 50), |
| | | manufacturer: fieldRules(true, false, 50), |
| | | source: fieldRules(true, false, 50), |
| | | purpose: fieldRules(true, false, 50), |
| | | belongDept: fieldRules(true, true), |
| | | contactPhone: fieldRules(true, false, 50), |
| | | charger: fieldRules(true, true), |
| | | } |
| | | |
| | | const userList = ref([]) |
| | |
| | | }) |
| | | |
| | | const rules = { |
| | | deviceId: fieldRules(true, 0), |
| | | planCycleType: fieldRules(true, 0), |
| | | deviceId: fieldRules(true, true), |
| | | planCycleType: fieldRules(true, true), |
| | | planCycleValue: [{ required: true, message: '请选择', trigger: ['blur', 'change'] }], |
| | | } |
| | | |
| | |
| | | }) |
| | | |
| | | const rules = { |
| | | maintainContent: fieldRules(true, 200), |
| | | replacePart: fieldRules(true, 200), |
| | | maintainTime: fieldRules(true, 0), |
| | | maintainContent: fieldRules(true, false, 200), |
| | | replacePart: fieldRules(true, false, 200), |
| | | maintainTime: fieldRules(true, true), |
| | | } |
| | | |
| | | // 关闭弹框 |
| | |
| | | }) |
| | | |
| | | const rules = { |
| | | droneName: fieldRules(true, 50), |
| | | areaCode: fieldRules(true, 50), |
| | | droneType: fieldRules(true, 50), |
| | | alarmType: fieldRules(true, 50), |
| | | alarmTime: fieldRules(true, 50), |
| | | triggerReason: fieldRules(false, 200), |
| | | droneName: fieldRules(true, false, 50), |
| | | areaCode: fieldRules(true, false, 50), |
| | | droneType: fieldRules(true, false, 50), |
| | | alarmType: fieldRules(true, false, 50), |
| | | alarmTime: fieldRules(true, false, 50), |
| | | triggerReason: fieldRules(false, false, 200), |
| | | } |
| | | |
| | | // 关闭弹框 |
| | |
| | | export function fieldRules(required, max) { |
| | | export function fieldRules(required,isSelect = false, max = 50, ) { |
| | | const trigger = ['blur', 'change'] |
| | | return [ |
| | | required ? { required: true, message: max ? '请输入' : '请选择', trigger } : {}, |
| | | max ? { max, message: `长度不超过${max}`, trigger } : {}, |
| | | ] |
| | | const rules = [] |
| | | if (required) { |
| | | rules.push({ required: true, message: isSelect ? '请选择' : '请输入', trigger, }) |
| | | } |
| | | if (!isSelect) { |
| | | rules.push({ max, message: `长度不超过${max}`, trigger }) |
| | | } |
| | | return rules |
| | | } |
| | | |
| | | |
| | | export function getDictLabel(value, dictList) { |
| | | return dictList.find(item => item.dictKey === value)?.dictValue || value || '-' |
| | | } |