update
1.应急就医-aed组网迁移
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/health-emergency/api/aed/nearbyAed',
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
@@ -1,323 +0,0 @@
|
||||
<template>
|
||||
<div class="devive-map">
|
||||
<div class="map-search-box">
|
||||
<a-select
|
||||
v-model:value="intValue"
|
||||
allow-clear
|
||||
show-search
|
||||
label-in-value
|
||||
placeholder="请输入地点"
|
||||
style="width: 400px"
|
||||
:default-active-first-option="false"
|
||||
:show-arrow="true"
|
||||
:filter-option="false"
|
||||
:not-found-content="null"
|
||||
@search="onSearch"
|
||||
:options="panelList"
|
||||
@change="handleChange"
|
||||
/>
|
||||
<!-- <a-button type="primary" @click="onButtonSearch"> 搜索 </a-button>-->
|
||||
</div>
|
||||
<div id="panel" style="display: none"></div>
|
||||
<div class="list" id="list"> </div>
|
||||
<div class="map" id="container"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="aed-map" lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import AMapLoader from '@amap/amap-jsapi-loader';
|
||||
import { debounce } from 'lodash-es';
|
||||
import positionIcon from '/@/assets/images/position.png';
|
||||
import MarkersIcon from '/@/assets/images/markerCricle.png';
|
||||
import { list } from './DeviceMap.api';
|
||||
import { message } from 'ant-design-vue';
|
||||
import {mapCenter} from "/@/utils/mapInfo";
|
||||
|
||||
let SelfMap = null;
|
||||
let BasicMap = null;
|
||||
let overlayGroup = null;
|
||||
const intValue = ref('');
|
||||
let placeSearch = ref();
|
||||
let panelList = ref([]);
|
||||
let pointerArray = ref([]);
|
||||
let positionRef = ref({
|
||||
lng: '',
|
||||
lat: '',
|
||||
handleItem: {
|
||||
pname: '',
|
||||
},
|
||||
});
|
||||
let mapState = [];
|
||||
let defaultMarker = null;
|
||||
onMounted(() => {
|
||||
initMap();
|
||||
});
|
||||
function initMap() {
|
||||
AMapLoader.load({
|
||||
key: '4bbcb216b889f2d612cbed05ae6979c8',
|
||||
version: '2.0',
|
||||
plugins: ['AMap.Geocoder'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
||||
})
|
||||
.then((AMap) => {
|
||||
SelfMap = AMap;
|
||||
//设置地图容器id
|
||||
BasicMap = new AMap.Map('container', {
|
||||
viewMode: '3D', //是否为3D地图模式
|
||||
// zoom: 11, //初始化地图级别
|
||||
center: mapCenter, //初始化地图中心点位置
|
||||
resizeEnable: true,
|
||||
});
|
||||
// 注册搜索插件
|
||||
bindSearch(AMap);
|
||||
handleMarker({});
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
/*
|
||||
** 获取区域对角线的两点坐标,即这个区域内的最小坐标值和最大坐标值
|
||||
* @param pointerArray [[a,b],[c,d]]* @return Array {min:number[a,b], max:number[c,d]}
|
||||
* */
|
||||
function getMaxBoundsPointer(pointerArray) {
|
||||
let lngArray = pointerArray.map((item) => item[0]);
|
||||
let latArray = pointerArray.map((item) => item[1]);
|
||||
return { min: [Math.min(...lngArray), Math.min(...latArray)], max: [Math.max(...lngArray), Math.max(...latArray)] };
|
||||
}
|
||||
/**
|
||||
* @Description:输入框查询位置
|
||||
* @date 2023/7/8
|
||||
*/
|
||||
function onSearch(value: string) {
|
||||
//关键字查询
|
||||
if (value) {
|
||||
intValue.value = value;
|
||||
searchRes(value);
|
||||
}
|
||||
}
|
||||
const searchRes = debounce((value) => {
|
||||
placeSearch.value.search(value, (status: string, result: any) => {
|
||||
if (status === 'complete') {
|
||||
panelList.value = result.poiList.pois.map((item) => ({ label: item.name, value: item.name, ...item }));
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
function onButtonSearch() {
|
||||
onSearch(intValue.value);
|
||||
}
|
||||
/**
|
||||
* @Description下拉框选择事件
|
||||
* @date 2023/8/30
|
||||
*/
|
||||
function handleChange(value: any, option: any) {
|
||||
if (option) {
|
||||
setMapZoom(16);
|
||||
let params = {
|
||||
longitude: option.location.lng, // 经度
|
||||
latitude: option.location.lat, // 纬度
|
||||
radiusRange: '50', // 半径范围
|
||||
};
|
||||
addDefault(option.location.lng, option.location.lat);
|
||||
handleMarker(params);
|
||||
} else {
|
||||
handleMarker({});
|
||||
setMapZoom(12);
|
||||
removeDefault();
|
||||
}
|
||||
}
|
||||
function handleMarker(params) {
|
||||
list(params).then((res) => {
|
||||
if (res.length > 0) {
|
||||
pointerArray.value = res;
|
||||
let maxLocations = getMaxBoundsPointer(res.map((item) => [item.longitude, item.latitude]));
|
||||
hanleBounds(maxLocations);
|
||||
addMarker(res);
|
||||
} else {
|
||||
removeMarker();
|
||||
// message.warn('该位置附近暂无设备!');
|
||||
}
|
||||
});
|
||||
}
|
||||
function hanleBounds(maxLocations) {
|
||||
let lngGap = (maxLocations.max[0] - maxLocations.min[0]) / 4;
|
||||
let latGap = (maxLocations.max[1] - maxLocations.min[1]) / 4;
|
||||
let min = new SelfMap.LngLat(maxLocations.min[0] - lngGap, maxLocations.min[1] - latGap);
|
||||
let max = new SelfMap.LngLat(maxLocations.max[0] + lngGap, maxLocations.max[1] + latGap);
|
||||
if (pointerArray.value.length > 1) {
|
||||
let bounds = new SelfMap.Bounds(min, max);
|
||||
BasicMap.setBounds(bounds);
|
||||
}
|
||||
// 2. 一个点时,将其作为中心点
|
||||
else if (pointerArray.value.length === 1) {
|
||||
let pointValue = pointerArray.value;
|
||||
let centerLngLat = new SelfMap.LngLat(pointValue[0].longitude, pointValue[0].latitude);
|
||||
BasicMap.setCenter(centerLngLat); // 设置地图中心点坐标
|
||||
}
|
||||
}
|
||||
// 加载默认图标
|
||||
function addDefault(longitude, latitude) {
|
||||
removeDefault();
|
||||
let defaultIcon = new SelfMap.Icon({
|
||||
image: MarkersIcon,
|
||||
size: new SelfMap.Size(50, 58), //图标大小
|
||||
imageSize: new SelfMap.Size(50, 58),
|
||||
});
|
||||
|
||||
defaultMarker = new SelfMap.Marker({
|
||||
icon: defaultIcon,
|
||||
position: [longitude, latitude],
|
||||
offset: [-18, -32],
|
||||
maxZoom: 14,
|
||||
});
|
||||
defaultMarker.setMap(BasicMap);
|
||||
BasicMap.setCenter([longitude, latitude], true);
|
||||
}
|
||||
function addMarker(position) {
|
||||
removeMarker();
|
||||
if (position.length === 0) {
|
||||
return;
|
||||
}
|
||||
overlayGroup = new SelfMap.OverlayGroup();
|
||||
position.map((item) => {
|
||||
let marker = new SelfMap.Marker({
|
||||
icon: positionIcon,
|
||||
position: [item.longitude, item.latitude],
|
||||
offset: [-18, -32],
|
||||
maxZoom: 14,
|
||||
});
|
||||
marker.on('click', () => {
|
||||
infoWindow(item);
|
||||
});
|
||||
overlayGroup.setMap(BasicMap);
|
||||
overlayGroup.addOverlay(marker);
|
||||
});
|
||||
}
|
||||
function removeDefault() {
|
||||
defaultMarker && BasicMap.remove(defaultMarker);
|
||||
}
|
||||
function removeMarker() {
|
||||
if (overlayGroup) {
|
||||
BasicMap.remove(overlayGroup);
|
||||
overlayGroup.setMap(null);
|
||||
overlayGroup = null;
|
||||
}
|
||||
}
|
||||
function infoWindow(position) {
|
||||
let startDiv = `<div class="dialog-conMap">
|
||||
<div class="item">
|
||||
<span> 设备型号:</span>
|
||||
<span>${position.hostModel}</span>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span>设备编号:</span>
|
||||
<span>${position.hostSerialNum}</span>
|
||||
</div>
|
||||
`;
|
||||
if (position.installAddress) {
|
||||
startDiv += `<div class="item">
|
||||
<span>布点位置:</span>
|
||||
<span>${position.installAddress}</span>
|
||||
</div>`;
|
||||
}
|
||||
if (position.mfrsMobile) {
|
||||
startDiv += ` <div class="item">
|
||||
<span>售后电话:</span>
|
||||
<span>${position.mfrsMobile}</span>
|
||||
</div>`;
|
||||
}
|
||||
if (position.manageUserMobile) {
|
||||
startDiv += ` <div class="item">
|
||||
<span>管理人电话:</span>
|
||||
<span>${position.manageUserMobile}</span>
|
||||
</div>`;
|
||||
}
|
||||
if (position?.chargeFirstMobile) {
|
||||
startDiv += ` <div class="item">
|
||||
<span>负责人1电话:</span>
|
||||
<span>${position?.chargeFirstMobile}</span>
|
||||
</div>`;
|
||||
}
|
||||
if (position.chargeSecondMobile) {
|
||||
startDiv += ` <div class="item">
|
||||
<span>负责人2电话:</span>
|
||||
<span>${position?.chargeSecondMobile}</span>
|
||||
</div>`;
|
||||
}
|
||||
let endDiv = `</div>`;
|
||||
let infoWindow = new SelfMap.InfoWindow({
|
||||
position: [position.longitude, position.latitude],
|
||||
offset: new SelfMap.Pixel(0, -30),
|
||||
content: startDiv + endDiv,
|
||||
});
|
||||
infoWindow.open(BasicMap);
|
||||
}
|
||||
function setMapZoom(zoom: number) {
|
||||
if (zoom) BasicMap && (BasicMap as any).setZoom(zoom);
|
||||
}
|
||||
// 搜索插件
|
||||
function bindSearch(AMap) {
|
||||
AMap.plugin(['AMap.PlaceSearch'], function () {
|
||||
//构造地点查询类
|
||||
placeSearch.value = new AMap.PlaceSearch({
|
||||
pageSize: 20, // 单页显示结果条数
|
||||
pageIndex: 1, // 页码
|
||||
panel: 'panel', // 结果列表将在此容器中进行展示。
|
||||
autoFitView: false, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.devive-map {
|
||||
width: 100%;
|
||||
height: calc(100vh - 130px);
|
||||
.map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.map-search-box {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
z-index: 10;
|
||||
box-shadow: 1px 2px 1px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.panel-list {
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
max-height: 90%;
|
||||
overflow-y: auto;
|
||||
top: 70px;
|
||||
left: 13px;
|
||||
width: 280px;
|
||||
z-index: 9;
|
||||
.panel-item {
|
||||
padding: 10px 5px;
|
||||
color: #999;
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style lang="less">
|
||||
.dialog-conMap {
|
||||
padding: 10px;
|
||||
width: 380px;
|
||||
.item {
|
||||
padding: 8px 0;
|
||||
display: flex;
|
||||
span:nth-child(1) {
|
||||
display: inline-block;
|
||||
width: 30%;
|
||||
text-align: right;
|
||||
}
|
||||
span:nth-child(2) {
|
||||
display: inline-block;
|
||||
width: 70%;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,563 @@
|
||||
<template>
|
||||
<div style="width: 100%; height: 100%; overflow: hidden">
|
||||
<div class="devive-map">
|
||||
<div style="position: absolute; top: 20px; left: 20px; z-index: 10">
|
||||
<div class="map-search-box">
|
||||
<div>
|
||||
<a-select
|
||||
v-model:value="intValue"
|
||||
allow-clear
|
||||
show-search
|
||||
label-in-value
|
||||
placeholder="请输入位置信息"
|
||||
class="search-select"
|
||||
style="width: 400px"
|
||||
:default-active-first-option="false"
|
||||
:show-arrow="true"
|
||||
:filter-option="false"
|
||||
:not-found-content="null"
|
||||
@search="onSearch"
|
||||
:options="panelList"
|
||||
@change="handleChange"
|
||||
/>
|
||||
<!-- <a-button type="primary" @click="onButtonSearch"> 搜索 </a-button>-->
|
||||
<span style="cursor: pointer; margin-left: 5px" @click="onButtonSearch">搜索</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 5px; display: flex">
|
||||
<div class="d-num">设备总数量:{{ pointerArray.length }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="panel" style="display: none"></div>
|
||||
<div class="list" id="list"> </div>
|
||||
<div class="map" id="container"></div>
|
||||
<a-button class="recently" type="primary" @click="findRecently"> 查找距离最近 </a-button>
|
||||
<div class="right-win" v-if="showWindow">
|
||||
<Icon
|
||||
icon="ant-design:close-circle-outlined"
|
||||
style="position: absolute; right: 40px; cursor: pointer"
|
||||
@click="() => (showWindow = false)"
|
||||
/>
|
||||
<div class="bottom-top">
|
||||
<div class="top-title"> <img :src="aedP" alt="" /> {{ showWindowInfo?.name }} </div>
|
||||
<div class="top-title-bottom"> 距离{{ showWindowInfo?.dis ? showWindowInfo?.dis : 0 }}m </div>
|
||||
<div class="top-title-describe"> {{ showWindowInfo?.installAddress ? showWindowInfo?.installAddress : '无' }} </div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 设备厂家: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.mfrsName || '-' }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 设备型号: </div>
|
||||
<div class="value-d">
|
||||
{{ showWindowInfo?.mfrsName || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 设备状态: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.aedStatus }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 所属部门: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.departName }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 管理单位: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.controlOrgName }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 管理人: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.manageUserName }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 管理人电话: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.manageUserMobile }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 负责人1: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.chargeFirst }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 负责人1电话: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.chargeFirstMobile }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 负责人2: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.chargeSecond || '-' }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 负责人2电话: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.chargeSecondMobile || '-' }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 覆盖人数: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.coverUserNum }} </div>
|
||||
</div>
|
||||
<div class="table-list">
|
||||
<div class="label-d"> 设备状态: </div>
|
||||
<div class="value-d"> {{ showWindowInfo?.electrodeIsOk_dictText || '-' }} </div>
|
||||
</div>
|
||||
<!-- <div class="table-list">-->
|
||||
<!-- <div class="label-d"> 设备电量: </div>-->
|
||||
<!-- <div class="value-d"> {{ showWindowInfo?.electricQuantity }} </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="table-list" v-if="showWindowInfo.departCode.indexOf('A01A09') !== -1">-->
|
||||
<!-- <div class="label-d"> 更新日期: </div>-->
|
||||
<!-- <div class="value-d"> {{ showWindowInfo?.electrodeSheetValidTime }} </div>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
<div class="bottom-bottom">
|
||||
<a-button type="primary" @click="showPDF(showWindowInfo?.disclaimer)">免责声明</a-button>
|
||||
<a-button type="primary" @click="showAny('1')">操作视频</a-button>
|
||||
<a-button type="primary" @click="showAny('2')">操作图片</a-button>
|
||||
<!-- <a-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- :disabled="-->
|
||||
<!-- !(-->
|
||||
<!-- (showWindowInfo?.cameraNum || showWindowInfo?.cameraNum === 0) &&-->
|
||||
<!-- (showWindowInfo.cameraCode || showWindowInfo.cameraCode === 0)-->
|
||||
<!-- )-->
|
||||
<!-- "-->
|
||||
<!-- @click="showAny('3')"-->
|
||||
<!-- >摄像头监控</a-button-->
|
||||
<!-- >-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Image
|
||||
:width="200"
|
||||
:style="{ display: 'none' }"
|
||||
:preview="{
|
||||
visible,
|
||||
onVisibleChange: setVisible,
|
||||
}"
|
||||
:src="getFileAccessHttpUrl(showWindowInfo?.operateInstruction)"
|
||||
/>
|
||||
<VideoPreview :url="getFileAccessHttpUrl(showWindowInfo?.disclaimer)" ref="vp1" />
|
||||
<VideoPreview :url="getFileAccessHttpUrl(showWindowInfo?.operateVideo)" ref="vp2" />
|
||||
<location-modal @register="registerModal" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="aed-map" lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import AMapLoader from '@amap/amap-jsapi-loader';
|
||||
import { debounce } from 'lodash-es';
|
||||
import aedP from '/@/assets/images/aed/aedp.png';
|
||||
import positionIcon from '/@/assets/images/aed/aed.png';
|
||||
import MarkersIcon from '/@/assets/images/aed/point.png';
|
||||
import { listApi } from '/@/views/emergency/aed/deviceMap/index';
|
||||
import mapKey from '/@/utils/mapKey';
|
||||
import { getShort } from '/@/utils/mapUtils';
|
||||
import { Image, message } from 'ant-design-vue';
|
||||
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
|
||||
|
||||
import VideoPreview from '/@/components/Video/VideoPreview.vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import LocationModal from '/@/views/emergency/aed/location/compoents/locationModal.vue';
|
||||
import { Dict } from '/@/utils/cache/dict';
|
||||
let SelfMap = null;
|
||||
let BasicMap = null;
|
||||
let overlayGroup = null;
|
||||
const clickMapLngLat = ref([]);
|
||||
const showWindow = ref(false);
|
||||
const showWindowInfo = ref({});
|
||||
const intValue = ref('');
|
||||
let placeSearch = ref();
|
||||
let panelList = ref([]);
|
||||
let pointerArray = ref([]);
|
||||
let defaultMarker = null;
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
onMounted(() => {
|
||||
initMap();
|
||||
});
|
||||
|
||||
const visible = ref<boolean>(false);
|
||||
const setVisible = (value): void => {
|
||||
visible.value = value;
|
||||
};
|
||||
|
||||
const showIframe = async () => {
|
||||
openModal(true, {
|
||||
record: { ...showWindowInfo.value, orgName: showWindowInfo.value.departName },
|
||||
type: '1',
|
||||
});
|
||||
};
|
||||
|
||||
function initMap() {
|
||||
AMapLoader.reset();
|
||||
AMapLoader.load({
|
||||
key: mapKey,
|
||||
version: '2.0',
|
||||
plugins: ['AMap.Geocoder'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
||||
})
|
||||
.then((AMap) => {
|
||||
SelfMap = AMap;
|
||||
//设置地图容器id
|
||||
BasicMap = new AMap.Map('container', {
|
||||
viewMode: '3D', //是否为3D地图模式
|
||||
// zoom: 11, //初始化地图级别
|
||||
// center: [108.95, 34.33], //初始化地图中心点位置
|
||||
resizeEnable: true,
|
||||
});
|
||||
BasicMap.on('click', clickMap);
|
||||
// 注册搜索插件
|
||||
bindSearch(AMap);
|
||||
handleMarker({});
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
function clickMap(e) {
|
||||
clickMapLngLat.value = [e.lnglat.lng, e.lnglat.lat];
|
||||
addDefault(e.lnglat.lng, e.lnglat.lat, false, false);
|
||||
intValue.value = '';
|
||||
}
|
||||
|
||||
function setShowInfoDis(longitude: any, latitude: any) {
|
||||
if (clickMapLngLat.value.length === 0) return (showWindowInfo.value['dis'] = 0);
|
||||
const result = parseInt(SelfMap.GeometryUtil.distance(clickMapLngLat.value, [longitude, latitude]));
|
||||
showWindowInfo.value['dis'] = Math.abs(result);
|
||||
}
|
||||
|
||||
/*
|
||||
** 获取区域对角线的两点坐标,即这个区域内的最小坐标值和最大坐标值
|
||||
* @param pointerArray [[a,b],[c,d]]* @return Array {min:number[a,b], max:number[c,d]}
|
||||
* */
|
||||
function getMaxBoundsPointer(pointerArray) {
|
||||
let lngArray = pointerArray.map((item) => item[0]);
|
||||
let latArray = pointerArray.map((item) => item[1]);
|
||||
return { min: [Math.min(...lngArray), Math.min(...latArray)], max: [Math.max(...lngArray), Math.max(...latArray)] };
|
||||
}
|
||||
/**
|
||||
* @Description:输入框查询位置
|
||||
* @date 2023/7/8
|
||||
*/
|
||||
function onSearch(value: string) {
|
||||
//关键字查询
|
||||
if (value) {
|
||||
intValue.value = value;
|
||||
searchRes(value);
|
||||
}
|
||||
}
|
||||
const searchRes = debounce((value) => {
|
||||
placeSearch.value.search(value, (status: string, result: any) => {
|
||||
if (status === 'complete') {
|
||||
panelList.value = result.poiList.pois.map((item) => ({ label: item.name, value: item.name, ...item }));
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
function onButtonSearch() {
|
||||
onSearch(intValue.value);
|
||||
}
|
||||
/**
|
||||
* @Description下拉框选择事件
|
||||
* @date 2023/8/30
|
||||
*/
|
||||
function handleChange(value: any, option: any) {
|
||||
if (option) {
|
||||
setMapZoom(16);
|
||||
let params = {
|
||||
longitude: option.location.lng, // 经度
|
||||
latitude: option.location.lat, // 纬度
|
||||
radiusRange: '50', // 半径范围
|
||||
};
|
||||
setShowInfoDis(option.location.lng, option.location.lat);
|
||||
addDefault(option.location.lng, option.location.lat);
|
||||
handleMarker(params);
|
||||
} else {
|
||||
handleMarker({});
|
||||
setMapZoom(12);
|
||||
removeDefault();
|
||||
}
|
||||
}
|
||||
function handleMarker(params) {
|
||||
// pointerArray.value = dataData;
|
||||
// let maxLocations = getMaxBoundsPointer(dataData.map((item) => [item.longitude, item.latitude]));
|
||||
// hanleBounds(maxLocations);
|
||||
// addMarker(dataData);
|
||||
listApi(params).then((res) => {
|
||||
// res = dataData;
|
||||
if (res.length > 0) {
|
||||
pointerArray.value = res.filter((item) => !!item.longitude && !!item.latitude);
|
||||
let maxLocations = getMaxBoundsPointer(pointerArray.value.map((item) => [item.longitude, item.latitude]));
|
||||
hanleBounds(maxLocations);
|
||||
addMarker(pointerArray.value);
|
||||
} else {
|
||||
removeMarker();
|
||||
// message.warn('该位置附近暂无设备!');
|
||||
}
|
||||
});
|
||||
}
|
||||
function hanleBounds(maxLocations) {
|
||||
let lngGap = (maxLocations.max[0] - maxLocations.min[0]) / 4;
|
||||
let latGap = (maxLocations.max[1] - maxLocations.min[1]) / 4;
|
||||
let min = new SelfMap.LngLat(maxLocations.min[0] - lngGap, maxLocations.min[1] - latGap);
|
||||
let max = new SelfMap.LngLat(maxLocations.max[0] + lngGap, maxLocations.max[1] + latGap);
|
||||
if (pointerArray.value.length > 1) {
|
||||
let bounds = new SelfMap.Bounds(min, max);
|
||||
BasicMap.setBounds(bounds);
|
||||
}
|
||||
// 2. 一个点时,将其作为中心点
|
||||
else if (pointerArray.value.length === 1) {
|
||||
let pointValue = pointerArray.value;
|
||||
let centerLngLat = new SelfMap.LngLat(pointValue[0].longitude, pointValue[0].latitude);
|
||||
BasicMap.setCenter(centerLngLat); // 设置地图中心点坐标
|
||||
}
|
||||
}
|
||||
// 加载默认图标
|
||||
function addDefault(longitude, latitude, setCenter = true, cheap = true) {
|
||||
removeDefault();
|
||||
let defaultIcon = new SelfMap.Icon({
|
||||
image: MarkersIcon,
|
||||
size: new SelfMap.Size(50, 58), //图标大小
|
||||
imageSize: new SelfMap.Size(50, 58),
|
||||
});
|
||||
|
||||
defaultMarker = new SelfMap.Marker({
|
||||
icon: defaultIcon,
|
||||
position: [longitude, latitude],
|
||||
offset: cheap ? new SelfMap.Pixel(-18, -32) : new SelfMap.Pixel(-26, -29),
|
||||
// offset: cheap ? [-18, -32] : [-24, -30],
|
||||
// maxZoom: 14,
|
||||
});
|
||||
defaultMarker.setMap(BasicMap);
|
||||
if (setCenter) BasicMap.setCenter([longitude, latitude], true);
|
||||
}
|
||||
function addMarker(position) {
|
||||
removeMarker();
|
||||
if (position.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const icon = new SelfMap.Icon({
|
||||
image: positionIcon,
|
||||
size: new SelfMap.Size(50, 58), //图标大小
|
||||
imageSize: new SelfMap.Size(50, 58),
|
||||
});
|
||||
|
||||
overlayGroup = new SelfMap.OverlayGroup();
|
||||
position.map((item) => {
|
||||
let marker = new SelfMap.Marker({
|
||||
icon: icon,
|
||||
position: [item.longitude, item.latitude],
|
||||
offset: new SelfMap.Pixel(-18, -32),
|
||||
maxZoom: 14,
|
||||
});
|
||||
marker.on('click', () => {
|
||||
showWindow.value = true;
|
||||
showWindowInfo.value = item;
|
||||
setShowInfoDis(item.longitude, item.latitude);
|
||||
});
|
||||
overlayGroup.setMap(BasicMap);
|
||||
overlayGroup.addOverlay(marker);
|
||||
});
|
||||
}
|
||||
function removeDefault() {
|
||||
defaultMarker && BasicMap.remove(defaultMarker);
|
||||
}
|
||||
function removeMarker() {
|
||||
if (overlayGroup) {
|
||||
BasicMap.remove(overlayGroup);
|
||||
overlayGroup.setMap(null);
|
||||
overlayGroup = null;
|
||||
}
|
||||
}
|
||||
function setMapZoom(zoom: number) {
|
||||
if (zoom) BasicMap && (BasicMap as any).setZoom(zoom);
|
||||
}
|
||||
// 搜索插件
|
||||
function bindSearch(AMap) {
|
||||
AMap.plugin(['AMap.PlaceSearch'], function () {
|
||||
//构造地点查询类
|
||||
placeSearch.value = new AMap.PlaceSearch({
|
||||
pageSize: 20, // 单页显示结果条数
|
||||
pageIndex: 1, // 页码
|
||||
panel: 'panel', // 结果列表将在此容器中进行展示。
|
||||
autoFitView: false, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function findRecently() {
|
||||
if (clickMapLngLat.value.length === 0) return message.info('请先选择当前所在位置');
|
||||
const item = getShort(SelfMap, clickMapLngLat.value, pointerArray.value);
|
||||
showWindowInfo.value = item;
|
||||
setShowInfoDis(item.longitude, item.latitude);
|
||||
BasicMap.setCenter([item.longitude, item.latitude]); // 设置地图中心点坐标
|
||||
showWindow.value = true;
|
||||
}
|
||||
|
||||
const vp1 = ref();
|
||||
const vp2 = ref();
|
||||
function showAny(type: string) {
|
||||
switch (type) {
|
||||
case '0':
|
||||
// vp1.value.showPreview();
|
||||
break;
|
||||
case '1':
|
||||
vp2.value.showPreview();
|
||||
break;
|
||||
case '2':
|
||||
setVisible(true);
|
||||
break;
|
||||
case '3':
|
||||
showIframe();
|
||||
break;
|
||||
}
|
||||
}
|
||||
function showPDF(v) {
|
||||
window.open(getFileAccessHttpUrl(v), '_blank');
|
||||
}
|
||||
|
||||
function getName(val, list) {
|
||||
if (!val && val !== 0) return '';
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].value == val) {
|
||||
return list[i].label;
|
||||
}
|
||||
}
|
||||
return '-';
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.devive-map {
|
||||
width: 100%;
|
||||
height: calc(100% + 80px);
|
||||
.map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.map-search-box {
|
||||
//position: absolute;
|
||||
//top: 20px;
|
||||
//left: 20px;
|
||||
//z-index: 10;
|
||||
box-shadow: 1px 2px 1px rgba(0, 0, 0, 0.15);
|
||||
padding: 5px 10px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.panel-list {
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
max-height: 90%;
|
||||
overflow-y: auto;
|
||||
top: 70px;
|
||||
left: 13px;
|
||||
width: 280px;
|
||||
z-index: 9;
|
||||
.panel-item {
|
||||
padding: 10px 5px;
|
||||
color: #999;
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table-list {
|
||||
display: flex;
|
||||
padding: 5px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.recently {
|
||||
position: absolute;
|
||||
right: 50px;
|
||||
top: 20px;
|
||||
}
|
||||
.right-win {
|
||||
position: absolute;
|
||||
width: 420px;
|
||||
height: calc(100% - 100px);
|
||||
top: 70px;
|
||||
right: 50px;
|
||||
background-color: #ffffff;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.top-title {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
padding-bottom: 5px;
|
||||
font-weight: bold;
|
||||
img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.top-title-bottom {
|
||||
padding-bottom: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.top-title-describe {
|
||||
position: relative;
|
||||
padding-bottom: 10px;
|
||||
color: #6f6f6f;
|
||||
&:after {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
content: '';
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: #c3c3c3;
|
||||
}
|
||||
}
|
||||
.bottom-top {
|
||||
padding-top: 10px;
|
||||
height: calc(100% - 50px);
|
||||
overflow: auto;
|
||||
}
|
||||
.bottom-bottom {
|
||||
height: 50px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.label-d {
|
||||
color: #6f6f6f;
|
||||
}
|
||||
|
||||
.value-d {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
:deep(.ant-select-selector) {
|
||||
border-radius: 20px !important;
|
||||
background-color: #f7f7f9 !important;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.d-num {
|
||||
background-color: rgba(4, 4, 4, 0.41);
|
||||
padding: 3px 10px;
|
||||
border-radius: 10px;
|
||||
color: #ffffff;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
<style lang="less">
|
||||
.dialog-conMap {
|
||||
padding: 10px;
|
||||
width: 380px;
|
||||
.item {
|
||||
padding: 8px 0;
|
||||
display: flex;
|
||||
span:nth-child(1) {
|
||||
display: inline-block;
|
||||
width: 30%;
|
||||
text-align: right;
|
||||
}
|
||||
span:nth-child(2) {
|
||||
display: inline-block;
|
||||
width: 70%;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,78 +0,0 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/health-emergency/emergency/aed/list',
|
||||
save = '/health-emergency/emergency/aed/add',
|
||||
edit = '/health-emergency/emergency/aed/edit',
|
||||
deleteOne = '/health-emergency/emergency/aed/delete',
|
||||
deleteBatch = '/health-emergency/emergency/aed/deleteBatch',
|
||||
importExcel = '/health-emergency/emergency/aed/importExcel',
|
||||
exportXls = '/health-emergency/emergency/aed/exportXls',
|
||||
queryById = '/health-emergency/emergency/aed/queryById',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
export const queryByIdUrl = Api.queryById;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
*/
|
||||
export const deleteOne = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () =>
|
||||
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
await defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true });
|
||||
handleSuccess();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params });
|
||||
};
|
||||
@@ -1,510 +0,0 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { RendererElement, RendererNode, VNode } from 'vue';
|
||||
import { getSecondaryDepartmentList, getThirdDepartListByOrgCode } from '/@/views/system/user/user.api';
|
||||
import { BODY_CONTAINER } from '/@/utils/domUtils';
|
||||
import { rules } from '/@/utils/helper/validator';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const renderStatusTag = (span: VNode<RendererNode, RendererElement, { [p: string]: any }>) => {
|
||||
const text = span.children;
|
||||
switch (text) {
|
||||
case '正常':
|
||||
return render.renderTag(text, '#31d731');
|
||||
case '快过期':
|
||||
case '需检查':
|
||||
case '电量低':
|
||||
return render.renderTag(text, '#FFA440');
|
||||
case '已过期':
|
||||
case '需更换':
|
||||
case '未找到':
|
||||
case '无连接':
|
||||
return render.renderTag(text, '#f04141');
|
||||
case '待确认':
|
||||
return render.renderTag(text, '#999999');
|
||||
default:
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '所属单位',
|
||||
align: 'center',
|
||||
dataIndex: 'secondDepartName',
|
||||
},
|
||||
{
|
||||
title: '所属部门',
|
||||
align: 'center',
|
||||
dataIndex: 'departName',
|
||||
},
|
||||
{
|
||||
title: '设备名称',
|
||||
align: 'center',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '设备厂商',
|
||||
align: 'center',
|
||||
dataIndex: 'mfrsName',
|
||||
},
|
||||
|
||||
{
|
||||
title: '设备型号',
|
||||
align: 'center',
|
||||
dataIndex: 'hostModel',
|
||||
},
|
||||
{
|
||||
title: '设备编号',
|
||||
align: 'center',
|
||||
dataIndex: 'hostSerialNum',
|
||||
},
|
||||
{
|
||||
title: '入库时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '管理部门',
|
||||
align: 'center',
|
||||
dataIndex: 'manageDepartName',
|
||||
},
|
||||
{
|
||||
title: '管理电话',
|
||||
align: 'center',
|
||||
dataIndex: 'manageUserMobile',
|
||||
},
|
||||
{
|
||||
title: '厂商电话',
|
||||
align: 'center',
|
||||
dataIndex: 'mfrsMobile',
|
||||
},
|
||||
];
|
||||
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '所属单位',
|
||||
field: 'second',
|
||||
component: 'ApiSelect',
|
||||
componentProps: () => {
|
||||
return {
|
||||
api: getSecondaryDepartmentList,
|
||||
resultField: 'result',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '所属部门',
|
||||
field: 'three',
|
||||
component: 'ApiSelect',
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
api: getThirdDepartListByOrgCode,
|
||||
resultField: 'list',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
params: {
|
||||
orgCode: formModel?.second || 'asd(*',
|
||||
},
|
||||
onFocus: () => {
|
||||
if (!formModel.second) {
|
||||
return createMessage.warn('请先选择所属单位!');
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '管理部门',
|
||||
field: 'manageDepartCode',
|
||||
component: 'ApiSelect',
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
api: getThirdDepartListByOrgCode,
|
||||
resultField: 'result',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
params: {
|
||||
orgCode: formModel?.second || 'asd(*',
|
||||
},
|
||||
onFocus: () => {
|
||||
if (!formModel.second) {
|
||||
return createMessage.warn('请先选择所属单位!');
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'name',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '设备型号',
|
||||
field: 'hostModel',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '设备编号',
|
||||
field: 'hostSerialNum',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '详情字段',
|
||||
field: 'infoFlag',
|
||||
component: 'Input',
|
||||
ifShow: false,
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '设备信息',
|
||||
field: 'deviceInfoLine',
|
||||
component: 'Divider',
|
||||
componentProps: {
|
||||
//文字是否显示为普通正文样式
|
||||
plain: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'name',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '所属单位',
|
||||
field: 'second',
|
||||
component: 'ApiSelect',
|
||||
required: true,
|
||||
componentProps: () => {
|
||||
return {
|
||||
api: getSecondaryDepartmentList,
|
||||
resultField: 'result',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any): boolean => {
|
||||
const str: string = input.toLowerCase();
|
||||
return option.label.toLowerCase().indexOf(str) >= 0;
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '所属部门',
|
||||
field: 'departCode',
|
||||
component: 'ApiSelect',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
api: getThirdDepartListByOrgCode,
|
||||
resultField: 'list',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
params: {
|
||||
orgCode: formModel?.second || 'asd(*',
|
||||
},
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any): boolean => {
|
||||
const str: string = input.toLowerCase();
|
||||
return option.label.toLowerCase().indexOf(str) >= 0;
|
||||
},
|
||||
onFocus: () => {
|
||||
if (!formModel.second) {
|
||||
return createMessage.warn('请先选择所属单位!');
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '自检状态',
|
||||
field: 'checkStatus',
|
||||
component: 'Input',
|
||||
render: ({ values, field }) => {
|
||||
return renderStatusTag(render.renderDict(values[field], 'aed_check_status'));
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
return values.infoFlag == true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '电极片状态',
|
||||
field: 'electrodeSheetStatus',
|
||||
component: 'Input',
|
||||
render: ({ values, field }) => {
|
||||
return renderStatusTag(render.renderDict(values[field], 'aed_electrode_sheet_status'));
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
return values.infoFlag == true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '电池状态',
|
||||
field: 'batteryStatus',
|
||||
component: 'Input',
|
||||
render: ({ values, field }) => {
|
||||
return renderStatusTag(render.renderDict(values[field], 'aed_battery_status'));
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
return values.infoFlag == true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '路由状态',
|
||||
field: 'routerStatus',
|
||||
component: 'Input',
|
||||
render: ({ values, field }) => {
|
||||
return renderStatusTag(render.renderDict(values[field], 'aed_router_status'));
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
return values.infoFlag == true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '设备型号',
|
||||
field: 'hostModel',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '设备编号',
|
||||
field: 'hostSerialNum',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '电极片有效期',
|
||||
field: 'electrodeSheetValidTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: false,
|
||||
valueFormat: 'YYYY-MM',
|
||||
picker: 'month',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '路由器型号',
|
||||
field: 'routerModel',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '路由器序列号',
|
||||
field: 'routerSerialNum',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '电池型号',
|
||||
field: 'batteryModel',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '电池电压',
|
||||
field: 'batteryVoltage',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
controls: false,
|
||||
addonAfter: 'V',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '质保时间',
|
||||
field: 'warrantyDate',
|
||||
component: 'RangePicker',
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
showTime: false,
|
||||
format: 'YYYY-MM-DD',
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
getPopupContainer: () => BODY_CONTAINER,
|
||||
// onChange: ([start, end]) => {
|
||||
// formModel.warrantyStartDate = start;
|
||||
// formModel.warrantyEndDate = end;
|
||||
// },
|
||||
'onUpdate:value': (value) => {
|
||||
if (value) {
|
||||
formModel.warrantyStartDate = value[0];
|
||||
formModel.warrantyEndDate = value[1];
|
||||
} else {
|
||||
formModel.warrantyStartDate = null;
|
||||
formModel.warrantyEndDate = null;
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '质保开始时间',
|
||||
field: 'warrantyStartDate',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '质保结束时间',
|
||||
field: 'warrantyEndDate',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '设备图片',
|
||||
field: 'aedImg',
|
||||
component: 'JImageUpload',
|
||||
componentProps: {
|
||||
fileMax: 5,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '管理信息',
|
||||
field: 'manageInfoLine',
|
||||
component: 'Divider',
|
||||
componentProps: {
|
||||
//文字是否显示为普通正文样式
|
||||
plain: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '负责人id',
|
||||
field: 'manageUserId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '管理部门',
|
||||
field: 'manageDepartCode',
|
||||
component: 'ApiSelect',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
api: getThirdDepartListByOrgCode,
|
||||
resultField: 'list',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
params: {
|
||||
orgCode: formModel?.second || 'asd(*',
|
||||
},
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any): boolean => {
|
||||
const str: string = input.toLowerCase();
|
||||
return option.label.toLowerCase().indexOf(str) >= 0;
|
||||
},
|
||||
onFocus: () => {
|
||||
if (!formModel.second) {
|
||||
return createMessage.warn('请先选择所属单位!');
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '管理人员',
|
||||
field: 'manageUserName',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '管理电话',
|
||||
field: 'manageUserMobile',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
rules: rules.rule('phone', true),
|
||||
},
|
||||
{
|
||||
label: '负责人员1',
|
||||
field: 'chargeFirst',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '负责电话1',
|
||||
field: 'chargeFirstMobile',
|
||||
component: 'Input',
|
||||
rules: rules.rule('phone', false),
|
||||
},
|
||||
{
|
||||
label: '负责人员2',
|
||||
field: 'chargeSecond',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '负责电话2',
|
||||
field: 'chargeSecondMobile',
|
||||
component: 'Input',
|
||||
rules: rules.rule('phone', false),
|
||||
},
|
||||
{
|
||||
label: '安装信息',
|
||||
field: 'installInfoLine',
|
||||
component: 'Divider',
|
||||
componentProps: {
|
||||
//文字是否显示为普通正文样式
|
||||
plain: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '厂商名称',
|
||||
field: 'mfrsName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '联系电话',
|
||||
field: 'mfrsMobile',
|
||||
component: 'Input',
|
||||
rules: rules.rule('phone', false),
|
||||
},
|
||||
{
|
||||
label: '覆盖人数',
|
||||
field: 'coverUserNum',
|
||||
component: 'InputNumber',
|
||||
},
|
||||
{
|
||||
label: '安装位置',
|
||||
field: 'installAddress',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
slot: 'address',
|
||||
},
|
||||
{
|
||||
label: '经度',
|
||||
field: 'longitude',
|
||||
required: true,
|
||||
component: 'InputNumber',
|
||||
},
|
||||
{
|
||||
label: '纬度',
|
||||
field: 'latitude',
|
||||
required: true,
|
||||
component: 'InputNumber',
|
||||
},
|
||||
{
|
||||
label: '位置照片',
|
||||
field: 'installAddressImg',
|
||||
component: 'JImageUpload',
|
||||
componentProps: {
|
||||
fileMax: 5,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* 流程表单调用这个方法获取formSchema
|
||||
* @param param
|
||||
*/
|
||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||
return formSchema;
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable :rowSelection="rowSelection" @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button v-auth="'emergency:emergency_resource:add'" preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
v-auth="'emergency:emergency_resource:delete'"
|
||||
preIcon="ant-design:delete-outlined"
|
||||
type="primary"
|
||||
@click="batchHandleDelete"
|
||||
>
|
||||
批量删除
|
||||
</a-button>
|
||||
<!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> -->
|
||||
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> -->
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template #htmlSlot="{ text }">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<DeviceDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="aed-device" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import DeviceDrawer from './components/DeviceDrawer.vue';
|
||||
import { columns, searchFormSchema } from './Device.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, getImportUrl, list } from './Device.api';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { useDrawer } from '/@/components/Drawer';
|
||||
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
//注册model
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext } = useListPage({
|
||||
tableProps: {
|
||||
title: '设备管理',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: false,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: false,
|
||||
fieldMapToNumber: [],
|
||||
fieldMapToTime: [],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: (info) => {
|
||||
info['name'] = info?.name && `*${info.name}*`;
|
||||
info['hostModel'] = info?.hostModel && `*${info.hostModel}*`;
|
||||
if (info.second) {
|
||||
info['departCode'] = `${info.second}*`;
|
||||
}
|
||||
if (info.three) {
|
||||
info['departCode'] = `${info.three}`;
|
||||
}
|
||||
info['departCode'] = info?.departCode && `${info.departCode}`;
|
||||
info['hostSerialNum'] = info?.hostSerialNum && `*${info.hostSerialNum}*`;
|
||||
info['aidrange'] = info?.aidrange && `*${info.aidrange}*`;
|
||||
return info;
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '应急资源',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openDrawer(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
title: '新增',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
record.infoFlag = false;
|
||||
record.warrantyDate = [record.warrantyStartDate, record.warrantyEndDate];
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
title: '编辑',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
record.infoFlag = true;
|
||||
record.warrantyDate = [record.warrantyStartDate, record.warrantyEndDate];
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
title: '详情',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
if (selectedRowKeys.value.length === 0) {
|
||||
return message.warning('未选中任何数据');
|
||||
}
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
console.log(111111111111);
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'emergency:emergency_resource:edit',
|
||||
},
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
onClick: handleDelete.bind(null, record),
|
||||
auth: 'emergency:emergency_resource:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-popover-buttons) {
|
||||
display: flex !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
width="800px"
|
||||
:show-footer="true"
|
||||
:title="title"
|
||||
@register="registerDrawer"
|
||||
destroyOnClose
|
||||
@ok="handleSubmit"
|
||||
:maskClosable="false"
|
||||
>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import BasicDrawer from '/@/components/Drawer/src/BasicDrawer.vue';
|
||||
import { useDrawerInner } from '/@/components/Drawer';
|
||||
import { ref } from 'vue';
|
||||
import BasicForm from '/@/components/Form/src/BasicForm.vue';
|
||||
import { FormSchema, useForm } from '/@/components/Form';
|
||||
import { getFormSchema } from '/@/views/emergency/aed/devices/deviceList.data';
|
||||
import { addApi, editApi } from '/@/views/emergency/aed/devices/deviceList.api';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
|
||||
const title = ref();
|
||||
const isUpdate = ref(false);
|
||||
const emit = defineEmits(['success']);
|
||||
const props = defineProps({
|
||||
departList: propTypes.array.def([]),
|
||||
});
|
||||
|
||||
const [registerForm, { validate, setFieldsValue, clearValidate, resetFields }] = useForm({
|
||||
// schemas: formSchema,
|
||||
schemas: getFormSchema() as FormSchema[],
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
await resetFields();
|
||||
title.value = data.title;
|
||||
isUpdate.value = data.isUpdate;
|
||||
|
||||
if (data.isUpdate) {
|
||||
if (data.record?.departCode.length <= 6) {
|
||||
data.record = { ...data.record, ...{ orgCode1: data.record?.departCode, orgCode2: '' } };
|
||||
} else {
|
||||
data.record = { ...data.record, ...{ orgCode1: data.record?.departCode.slice(0, 6), orgCode2: data.record.departCode } };
|
||||
}
|
||||
await setFieldsValue({ ...data.record });
|
||||
} else {
|
||||
// await setProps({
|
||||
// schemas: getFormSchema(props.departList) as FormSchema[],
|
||||
// });
|
||||
}
|
||||
await clearValidate();
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
// values['operateInstruction'] = 'a';
|
||||
// values['operateVideo'] = 'a';
|
||||
// values['disclaimer'] = 'a';
|
||||
if (isUpdate.value) {
|
||||
await editApi(values);
|
||||
} else {
|
||||
await addApi(values);
|
||||
}
|
||||
closeDrawer();
|
||||
emit('success');
|
||||
} catch (e) {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less"></style>
|
||||
@@ -1,125 +0,0 @@
|
||||
<template>
|
||||
<BasicDrawer :showFooter="showFooter" :title="title" :width="800" destroyOnClose v-bind="$attrs" @ok="handleSubmit" @register="registerModal">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #address="{ model }">
|
||||
<a-input v-model:value="model['installAddress']" placeholder="请输入安装位置或地图选点" :disabled="!showFooter" style="width: 82%" />
|
||||
<a-button :disabled="!showFooter" style="margin-left: 10px" @click="viewMap"> 查看地图 </a-button>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<Map ref="map" :state="state" @register="registerMap" @get-position="getPosition" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, unref } from 'vue';
|
||||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../Device.data';
|
||||
import { saveOrUpdate } from '../Device.api';
|
||||
import Map from '/@/views/consult/resource/components/Map.vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
|
||||
// Emits声明
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const showFooter = ref<boolean>(true);
|
||||
const state = ref();
|
||||
//设置标题
|
||||
const title = ref<string>('');
|
||||
//表单配置
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, getFieldsValue, clearValidate }] = useForm({
|
||||
//labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
const [registerMap, { openModal }] = useModal();
|
||||
//表单赋值
|
||||
const [registerModal, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setDrawerProps({
|
||||
confirmLoading: false,
|
||||
showCancelBtn: !!data?.showFooter,
|
||||
showOkBtn: !!data?.showFooter,
|
||||
});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
showFooter.value = data.showFooter;
|
||||
title.value = data.title;
|
||||
let customAddress = '';
|
||||
if (unref(isUpdate)) {
|
||||
customAddress = `${data.record?.longitude},${data.record?.latitude}`;
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
customAddress,
|
||||
second: data.record?.departCode.slice(0, 6),
|
||||
});
|
||||
state.value = data.record;
|
||||
} else {
|
||||
state.value = {};
|
||||
}
|
||||
await clearValidate();
|
||||
// 隐藏底部时禁用整个表单
|
||||
await setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
function viewMap() {
|
||||
openModal(true, {
|
||||
record: { ...getFieldsValue() },
|
||||
});
|
||||
}
|
||||
|
||||
async function getPosition(val) {
|
||||
let { pname, cityname, adname, address, name } = val.handleItem || '';
|
||||
let nameList = [pname, cityname, adname, address, name];
|
||||
let str = '';
|
||||
nameList.map((item) => {
|
||||
if (item !== undefined) {
|
||||
str += item;
|
||||
}
|
||||
});
|
||||
await setFieldsValue({
|
||||
latitude: val.lat,
|
||||
longitude: val.lng,
|
||||
customAddress: `${val.lng},${val.lat}`,
|
||||
installAddress: str,
|
||||
});
|
||||
state.value = {
|
||||
...state.value,
|
||||
latitude: val.lat,
|
||||
longitude: val.lng,
|
||||
};
|
||||
}
|
||||
|
||||
//表单提交事件
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
let values = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params = {
|
||||
...state.value,
|
||||
...values,
|
||||
};
|
||||
//提交表单
|
||||
await saveOrUpdate(params, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeDrawer();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,30 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/health-emergency/intervene/v2/aedEquipmentManger/queryManagerPage',
|
||||
add = '/health-emergency/intervene/v2/aedEquipmentManger/add',
|
||||
edit = '/health-emergency/intervene/v2/aedEquipmentManger/updateManager',
|
||||
deleteBatchManager = '/health-emergency/intervene/v2/aedEquipmentManger/deleteBatchManager',
|
||||
exportXls = '/health-emergency/intervene/v2/aedEquipmentManger/exportXlsManager',
|
||||
}
|
||||
export const getExportUrl = (params: any) => defHttp.get({ url: Api.exportXls, params: params });
|
||||
export const listApi = (params: any) => defHttp.get({ url: Api.list, params: params });
|
||||
export const addApi = (params: any) => defHttp.post({ url: Api.add, params: params });
|
||||
export const editApi = (params: any) => defHttp.put({ url: Api.edit, params: params });
|
||||
export const deleteBatchManagerApi = (params: any, handleSuccess: any) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({ url: Api.deleteBatchManager, params: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,372 @@
|
||||
import { BasicColumn } from '/@/components/Table';
|
||||
import { getDefaultImage, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
|
||||
import { EyeOutlined } from '@ant-design/icons-vue';
|
||||
import { h } from 'vue';
|
||||
import VideoPreview from '/@/components/Video/VideoPreview.vue';
|
||||
import { Image } from 'ant-design-vue';
|
||||
import { getDictCache } from '/@/utils/dict';
|
||||
import { orgSearchInfoByCode } from '/@/utils/orgSearchInfo';
|
||||
// import { render } from '/@/utils/common/renderUtils';
|
||||
|
||||
interface dI {
|
||||
code1?: string;
|
||||
code2?: string;
|
||||
code3?: string;
|
||||
code4?: string;
|
||||
code5?: string;
|
||||
code6?: string;
|
||||
}
|
||||
|
||||
const d: dI = {
|
||||
code1: 'name',
|
||||
code6: 'hostSerialNum',
|
||||
code5: 'mfrsName',
|
||||
code2: 'hostModel',
|
||||
code3: 'orgName',
|
||||
code4: 'deptName',
|
||||
};
|
||||
export const getGeneralColumns = (data = d) => {
|
||||
const { code1, code2, code3, code4, code5, code6 } = { ...d, ...data };
|
||||
return [
|
||||
{
|
||||
title: '设备名称',
|
||||
align: 'center',
|
||||
dataIndex: code1,
|
||||
},
|
||||
{
|
||||
title: '设备编号',
|
||||
align: 'center',
|
||||
dataIndex: code6,
|
||||
},
|
||||
{
|
||||
title: '设备厂家',
|
||||
align: 'center',
|
||||
dataIndex: code5,
|
||||
},
|
||||
{
|
||||
title: '设备型号',
|
||||
align: 'center',
|
||||
dataIndex: code2,
|
||||
},
|
||||
{
|
||||
title: '所属单位',
|
||||
align: 'center',
|
||||
dataIndex: code3,
|
||||
},
|
||||
{
|
||||
title: '所属部门',
|
||||
align: 'center',
|
||||
dataIndex: code4,
|
||||
},
|
||||
] as BasicColumn[];
|
||||
};
|
||||
export const columns: BasicColumn[] = [
|
||||
...getGeneralColumns(),
|
||||
// {
|
||||
// title: '摄像头序列号',
|
||||
// align: 'center',
|
||||
// dataIndex: 'cameraNum',
|
||||
// },
|
||||
// {
|
||||
// title: '摄像头验证码',
|
||||
// align: 'center',
|
||||
// dataIndex: 'cameraCode',
|
||||
// },
|
||||
{
|
||||
title: '设备类型',
|
||||
align: 'center',
|
||||
dataIndex: 'type_dictText',
|
||||
width: 90,
|
||||
},
|
||||
// {
|
||||
// title: '入库日期',
|
||||
// align: 'center',
|
||||
// dataIndex: 'inStorageDate',
|
||||
// },
|
||||
// {
|
||||
// title: '电池电量',
|
||||
// align: 'center',
|
||||
// dataIndex: 'electricQuantity',
|
||||
// width: 90,
|
||||
// },
|
||||
// {
|
||||
// title: '电池有效期',
|
||||
// align: 'center',
|
||||
// dataIndex: 'batteryLife',
|
||||
// width: 100,
|
||||
// },
|
||||
// {
|
||||
// title: '电极片是否完好',
|
||||
// align: 'center',
|
||||
// dataIndex: 'electrodeIsOk_dictText',
|
||||
// },
|
||||
// {
|
||||
// title: '电极片有效期',
|
||||
// align: 'center',
|
||||
// dataIndex: 'electrodeSheetValidTime',
|
||||
// },
|
||||
{
|
||||
title: '操作图片',
|
||||
align: 'center',
|
||||
dataIndex: 'operateInstruction',
|
||||
customRender: ({ text }) => {
|
||||
return h(Image, {
|
||||
placeholder: true,
|
||||
src: getFileAccessHttpUrl(text),
|
||||
height: 50,
|
||||
width: 50,
|
||||
fallback: getDefaultImage(),
|
||||
previewMask: () => {
|
||||
return h(EyeOutlined, {
|
||||
style: {
|
||||
color: 'white',
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '操作视频',
|
||||
align: 'center',
|
||||
dataIndex: 'operateVideo',
|
||||
customRender: ({ text }) => {
|
||||
return h(VideoPreview, {
|
||||
url: getFileAccessHttpUrl(text),
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '管理部门',
|
||||
align: 'center',
|
||||
dataIndex: 'controlOrgName',
|
||||
},
|
||||
{
|
||||
title: '管理人',
|
||||
align: 'center',
|
||||
dataIndex: 'manageUserName',
|
||||
},
|
||||
{
|
||||
title: '管理人电话',
|
||||
align: 'center',
|
||||
dataIndex: 'manageUserMobile',
|
||||
},
|
||||
{
|
||||
title: '厂家电话',
|
||||
align: 'center',
|
||||
dataIndex: 'mfrsMobile',
|
||||
},
|
||||
];
|
||||
|
||||
export const getSearchSchema = () => {
|
||||
return [
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'name',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '设备厂家',
|
||||
field: 'mfrs',
|
||||
component: 'Input',
|
||||
// componentProps: ({ formModel }) => ({
|
||||
// dictCode: 'aed_mfrs',
|
||||
// onChange: () => {
|
||||
// formModel.model = '';
|
||||
// },
|
||||
// }),
|
||||
},
|
||||
{
|
||||
label: '设备型号',
|
||||
field: 'model',
|
||||
component: 'Input',
|
||||
// componentProps: ({ formModel }) => ({
|
||||
// dictCode: `aed_mfrs_model_${formModel.mfrs}`,
|
||||
// }),
|
||||
},
|
||||
{
|
||||
label: '设备类型',
|
||||
field: 'type',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: () => ({
|
||||
dictCode: 'intervene_aed_type',
|
||||
}),
|
||||
},
|
||||
...orgSearchInfoByCode('orgCode1', 'orgCode2', 'orgCode'),
|
||||
];
|
||||
};
|
||||
|
||||
export const getFormSchema = () => {
|
||||
return [
|
||||
...orgSearchInfoByCode('orgCode1', 'orgCode2', 'departCode', true, false),
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'name',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '设备编号',
|
||||
field: 'hostSerialNum',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '设备厂家',
|
||||
field: 'mfrsName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '设备型号',
|
||||
field: 'hostModel',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '设备类型',
|
||||
field: 'type',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: () => ({
|
||||
dictCode: 'intervene_aed_type',
|
||||
}),
|
||||
},
|
||||
// {
|
||||
// label: '摄像头序列号',
|
||||
// field: 'cameraNum',
|
||||
// component: 'Input',
|
||||
// },
|
||||
// {
|
||||
// label: '摄像头验证码',
|
||||
// field: 'cameraCode',
|
||||
// component: 'Input',
|
||||
// },
|
||||
// {
|
||||
// label: '出厂日期',
|
||||
// field: 'outFactoryDate',
|
||||
// component: 'DatePicker',
|
||||
// componentProps: () => ({ format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', style: { width: '100%' } }),
|
||||
// required: true,
|
||||
// },
|
||||
// {
|
||||
// label: '入库日期',
|
||||
// field: 'inStorageDate',
|
||||
// component: 'DatePicker',
|
||||
// componentProps: () => ({ format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', style: { width: '100%' } }),
|
||||
// required: true,
|
||||
// },
|
||||
// {
|
||||
// label: '电量',
|
||||
// field: 'electricQuantity',
|
||||
// component: 'InputNumber',
|
||||
// componentProps: () => ({ style: { width: '100%' } }),
|
||||
// required: true,
|
||||
// },
|
||||
// {
|
||||
// label: '电极片是否完好',
|
||||
// field: 'electrodeIsOk',
|
||||
// component: 'RadioGroup',
|
||||
// defaultValue:
|
||||
// getDictCache('aed_electrode_is_ok') && getDictCache('aed_electrode_is_ok')?.length > 0
|
||||
// ? getDictCache('aed_electrode_is_ok')?.[0].value
|
||||
// : '',
|
||||
// componentProps: () => {
|
||||
// return {
|
||||
// options: getDictCache('aed_electrode_is_ok'),
|
||||
// };
|
||||
// },
|
||||
// required: true,
|
||||
// },
|
||||
// {
|
||||
// label: '电池有效期',
|
||||
// field: 'batteryLife',
|
||||
// component: 'DatePicker',
|
||||
// componentProps: () => ({ format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', style: { width: '100%' } }),
|
||||
// required: true,
|
||||
// },
|
||||
// {
|
||||
// label: '电极片有效期',
|
||||
// field: 'electrodeSheetValidTime',
|
||||
// component: 'DatePicker',
|
||||
// componentProps: () => ({ format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', style: { width: '100%' } }),
|
||||
// required: true,
|
||||
// },
|
||||
{
|
||||
label: '操作图片',
|
||||
field: 'operateInstruction',
|
||||
component: 'JImageUpload',
|
||||
componentProps: () => {
|
||||
return {
|
||||
maxCount: 1,
|
||||
accept: '.png,.jpg',
|
||||
};
|
||||
},
|
||||
// required: true,
|
||||
},
|
||||
{
|
||||
label: '操作视频',
|
||||
field: 'operateVideo',
|
||||
component: 'JUpload',
|
||||
componentProps: () => {
|
||||
return {
|
||||
maxCount: 1,
|
||||
accept: '.mp4,video/mp4',
|
||||
tipText: '支持MP4格式,最大200M',
|
||||
};
|
||||
},
|
||||
// required: true,
|
||||
},
|
||||
{
|
||||
label: '免责声明',
|
||||
field: 'disclaimer',
|
||||
component: 'JUpload',
|
||||
componentProps: () => {
|
||||
return {
|
||||
maxCount: 1,
|
||||
accept: 'application/pdf',
|
||||
tipText: '仅支持PDF格式文件,最大200M',
|
||||
};
|
||||
},
|
||||
// required: true,
|
||||
},
|
||||
{
|
||||
label: '管理部门',
|
||||
field: 'controlOrgName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '管理人',
|
||||
field: 'manageUserName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '管理人电话',
|
||||
field: 'manageUserMobile',
|
||||
component: 'Input',
|
||||
// rules: [{ pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误' }],
|
||||
},
|
||||
{
|
||||
label: '厂家电话',
|
||||
field: 'mfrsMobile',
|
||||
component: 'Input',
|
||||
// rules: [{ pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误' }],
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
field: 'status',
|
||||
component: 'RadioGroup',
|
||||
defaultValue:
|
||||
getDictCache('intervene_aed_status') && getDictCache('intervene_aed_status')?.length > 0
|
||||
? getDictCache('intervene_aed_status')?.[0].value
|
||||
: '',
|
||||
componentProps: () => {
|
||||
return {
|
||||
options: getDictCache('intervene_aed_status'),
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
];
|
||||
};
|
||||
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="addB" preIcon="ant-design:plus-outlined"> 新增 </a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="exportFile"
|
||||
v-auth="'intervene:aed_equipment_manger:exportXlsManager'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="recordExport"
|
||||
v-auth="'intervene:aed_equipment_manger:exportXlsManager'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
>
|
||||
导出记录
|
||||
</a-button>
|
||||
<a-button type="primary" @click="largeDel" preIcon="ant-design:delete-outlined"> 批量删除 </a-button>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
|
||||
<device-drawer :departList="result" @register="registerDrawer" @success="handleSuccess" />
|
||||
<export-util task-code="interveneAedExport" @register="registerExport" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import BasicTable from '/@/components/Table/src/BasicTable.vue';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { deleteBatchManagerApi, listApi, getExportUrl } from '/@/views/emergency/aed/devices/deviceList.api';
|
||||
import { columns, getSearchSchema } from '/@/views/emergency/aed/devices/deviceList.data';
|
||||
import { FormSchema, TableAction } from '/@/components/Table';
|
||||
import DeviceDrawer from '/@/views/emergency/aed/devices/compoents/deviceDrawer.vue';
|
||||
import { useDrawer } from '/@/components/Drawer';
|
||||
import { ref } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import ExportUtil from '/@/utils/export/exportUtil.vue';
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
const [registerExport, { openDrawer: openDrawer1 }] = useDrawer();
|
||||
|
||||
function recordExport() {
|
||||
openDrawer1(true, {});
|
||||
}
|
||||
|
||||
const exportFile = () => {
|
||||
let form = getForm().getFieldsValue();
|
||||
|
||||
getExportUrl({ ...form, departCode: form.orgCode })
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
};
|
||||
|
||||
const result = ref([]);
|
||||
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
api: listApi,
|
||||
columns,
|
||||
canResize: false,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: getSearchSchema() as FormSchema[],
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: false,
|
||||
fieldMapToNumber: [],
|
||||
fieldMapToTime: [],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload, setProps, getForm }, { selectedRowKeys, rowSelection }] = tableContext;
|
||||
|
||||
function addB() {
|
||||
openDrawer(true, {
|
||||
title: '新增设备',
|
||||
isUpdate: false,
|
||||
});
|
||||
}
|
||||
function largeDel() {
|
||||
if (selectedRowKeys.value.length === 0) return message.info('请至少选择一条数据');
|
||||
deleteBatchManagerApi({ ids: selectedRowKeys.value.join(',') }, handleSuccess);
|
||||
}
|
||||
function getTableAction(record: Recordable) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
onClick: handleDelete.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openDrawer(true, {
|
||||
record,
|
||||
title: '编辑设备',
|
||||
isUpdate: true,
|
||||
});
|
||||
}
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteBatchManagerApi({ ids: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less"></style>
|
||||
@@ -0,0 +1,155 @@
|
||||
<template>
|
||||
<BasicDrawer v-bind="$attrs" width="800px" :show-footer="true" :title="title" @register="registerDrawer" destroyOnClose @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #old="{ model, field }">
|
||||
<a-input placeholder="请选择未布点设备" v-model:value="model[field]" readonly style="cursor: pointer" @click="clickDevice" />
|
||||
</template>
|
||||
<template #hostSerialNum="{ model, field }"> {{ model[field] }} </template>
|
||||
|
||||
<template #installAddress="{ model, field }">
|
||||
<div style="display: flex">
|
||||
<a-input v-model:value="model[field]" :disabled="true" />
|
||||
<a-button style="margin-left: 10px" @click="viewMap">查看地图</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</BasicForm>
|
||||
|
||||
<Map @register="registerMap" :state="state" ref="map" @get-position="getPosition" />
|
||||
</BasicDrawer>
|
||||
<choose-some :width="'600px'" @register="registerDrawer1" @select-some="selectSome" title="选择设备" :tableprops="tableProps" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import BasicDrawer from '/@/components/Drawer/src/BasicDrawer.vue';
|
||||
import { useDrawer, useDrawerInner } from '/@/components/Drawer';
|
||||
import { ref } from 'vue';
|
||||
import BasicForm from '/@/components/Form/src/BasicForm.vue';
|
||||
import { useForm } from '/@/components/Form';
|
||||
import { formSchema, mColumns, mSearchFormSchema } from '/@/views/emergency/aed/location/locationList.data';
|
||||
import ChooseSome from '/@/views/compoents/chooseSome/index.vue';
|
||||
import { addApi, editApi, getUnPublishEquipmentApi } from '/@/views/emergency/aed/location/locationList.api';
|
||||
import Map from '/@/views/consult/resource/components/Map.vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
|
||||
const title = ref();
|
||||
const state = ref();
|
||||
const isUpdate = ref(false);
|
||||
const emit = defineEmits(['success']);
|
||||
|
||||
const [registerDrawer1, { openDrawer }] = useDrawer();
|
||||
|
||||
const [registerMap, { openModal }] = useModal();
|
||||
function viewMap() {
|
||||
openModal(true, {
|
||||
record: state.value,
|
||||
});
|
||||
}
|
||||
|
||||
async function getPosition(val) {
|
||||
let { pname, cityname, adname, address, name } = val.handleItem || '';
|
||||
let nameList = [pname, cityname, adname, address, name];
|
||||
let str = '';
|
||||
nameList.map((item) => {
|
||||
if (item !== undefined) {
|
||||
str += item;
|
||||
}
|
||||
});
|
||||
console.log(str);
|
||||
await setFieldsValue({
|
||||
latitude: val.lat,
|
||||
longitude: val.lng,
|
||||
installAddress: str,
|
||||
});
|
||||
state.value = {
|
||||
...state.value,
|
||||
latitude: val.lat,
|
||||
longitude: val.lng,
|
||||
};
|
||||
}
|
||||
const tableProps = ref({
|
||||
tableProps: {
|
||||
// title: '一线医疗点医药管理',
|
||||
api: getUnPublishEquipmentApi,
|
||||
columns: mColumns,
|
||||
canResize: false,
|
||||
rowKey: (record: Recordable) => {
|
||||
return JSON.stringify(record);
|
||||
},
|
||||
beforeFetch: (params: any) => {
|
||||
params['publishFlag'] = '0';
|
||||
},
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: mSearchFormSchema,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: false,
|
||||
fieldMapToNumber: [],
|
||||
fieldMapToTime: [],
|
||||
baseColProps: {
|
||||
xs: 8,
|
||||
sm: 8,
|
||||
md: 8,
|
||||
lg: 8,
|
||||
xl: 12,
|
||||
xxl: 12,
|
||||
},
|
||||
actionColOptions: {
|
||||
span: 24,
|
||||
offset: 0,
|
||||
xs: 8,
|
||||
sm: 8,
|
||||
md: 8,
|
||||
lg: 8,
|
||||
xl: 12,
|
||||
xxl: 12,
|
||||
},
|
||||
},
|
||||
showActionColumn: false,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerForm, { setFieldsValue, validate }] = useForm({
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
title.value = data.title;
|
||||
isUpdate.value = data.isUpdate;
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
if (data.isUpdate) {
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
...{ installTIme: data.record.installTime },
|
||||
});
|
||||
state.value = { ...data.record, address: data.record.installAddress };
|
||||
}
|
||||
});
|
||||
|
||||
function selectSome(v) {
|
||||
setFieldsValue({
|
||||
name: JSON.parse(v).name,
|
||||
id: JSON.parse(v).id,
|
||||
// hostModel: JSON.parse(v).hostModel,
|
||||
});
|
||||
}
|
||||
|
||||
function clickDevice() {
|
||||
openDrawer(true, {});
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
if (isUpdate.value) {
|
||||
await editApi(values);
|
||||
} else {
|
||||
await addApi(values);
|
||||
}
|
||||
closeDrawer();
|
||||
emit('success');
|
||||
} catch {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less"></style>
|
||||
@@ -0,0 +1,176 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="70%">
|
||||
<div class="modal-container">
|
||||
<div class="user">
|
||||
<div>设备厂家:{{ getName(userInfo?.mfrsName, Dict.getDict('aed_mfrs')) || '-' }}</div>
|
||||
<div>设备型号:{{ getName(userInfo?.hostModel, Dict.getDict('aed_mfrs_model_' + userInfo?.mfrsName) || []) }}</div>
|
||||
<div>设备名称:{{ userInfo?.name }}</div>
|
||||
<div>设备型号:{{ userInfo?.hostModel }}</div>
|
||||
<div>所属部门:{{ userInfo?.orgName }}</div>
|
||||
<div v-if="type === '0'">布点日期:{{ userInfo?.installTime }}</div>
|
||||
<div>布点地址:{{ userInfo?.installAddress }}</div>
|
||||
<div>覆盖人数:{{ userInfo?.coverUserNum }}</div>
|
||||
<div>责任人1:{{ userInfo?.chargeFirst }}</div>
|
||||
<div>责任人1电话:{{ userInfo?.chargeFirstMobile }}</div>
|
||||
<div>责任人2:{{ userInfo?.chargeSecond || '--' }}</div>
|
||||
<div>责任人2电话:{{ userInfo?.chargeSecondMobile || '--' }}</div>
|
||||
</div>
|
||||
<div style="flex: 1; display: flex">
|
||||
<template v-if="type === '0'">
|
||||
<div v-if="showMap" style="flex: 1; padding-left: 20px; overflow: hidden">
|
||||
<div class="map" id="userMap"></div>
|
||||
</div>
|
||||
<div v-else class="no-map">
|
||||
<div class="map-icon"></div>
|
||||
<div class="tips">未知位置</div>
|
||||
<div class="reason-title">可能是以下原因导致:</div>
|
||||
<div class="resource"
|
||||
>1. 员工未授权;<br />
|
||||
2. 手表端未打开位置;<br />3. 获取位置信息超时;
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div style="flex: 1; padding-left: 20px">
|
||||
<iframe v-if="iframeSrc" :src="iframeSrc" id="ysOpenDevice" allowfullscreen style="width: 100%; height: 100%"> </iframe>
|
||||
<div v-else class="no-map">
|
||||
<div class="map-icon"></div>
|
||||
<div class="tips">未知路径</div>
|
||||
<div class="reason-title">未获取到路径</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="abnormalEventsModal">
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import AMapLoader from '@amap/amap-jsapi-loader';
|
||||
import mapKey from '/@/utils/mapKey';
|
||||
import { getSrcApi } from '/@/views/emergency/aed/location/locationList.api';
|
||||
import { Dict } from '/@/utils/cache/dict';
|
||||
|
||||
//设置标题
|
||||
const title = ref('查看详情');
|
||||
const userInfo = ref({});
|
||||
const showMap = ref(false);
|
||||
const type = ref<string>('0');
|
||||
const iframeSrc = ref<string>('');
|
||||
//表单赋值
|
||||
const [registerModal, { setModalProps }] = useModalInner(async (data) => {
|
||||
type.value = data.type;
|
||||
userInfo.value = data.record;
|
||||
setModalProps({ footer: false });
|
||||
if (data.type === '0') {
|
||||
let { longitude, latitude } = data.record;
|
||||
showMap.value = ![0, null, undefined].includes(longitude);
|
||||
if (showMap.value) {
|
||||
initMap(longitude, latitude);
|
||||
}
|
||||
} else {
|
||||
title.value = '查看监控';
|
||||
const res = await getSrcApi({});
|
||||
iframeSrc.value = res.url
|
||||
? `${res.url || ''}?accessToken=${res?.accessToken || ''}&url=ezopen://${data.record?.cameraCode || ''}@open.ys7.com/${
|
||||
data.record?.cameraNum || ''
|
||||
}/1.live&themeId=mobileLive&env=`
|
||||
: '';
|
||||
}
|
||||
});
|
||||
function initMap(lon, lat) {
|
||||
AMapLoader.reset();
|
||||
AMapLoader.load({
|
||||
key: mapKey,
|
||||
version: '2.0',
|
||||
plugins: ['AMap.Geocoder'],
|
||||
})
|
||||
.then((AMap) => {
|
||||
const map = new AMap.Map('userMap', {
|
||||
viewMode: '3D',
|
||||
zoom: 15,
|
||||
center: [lon, lat],
|
||||
resizeEnable: true,
|
||||
});
|
||||
const position = new AMap.LngLat(lon, lat);
|
||||
const marker = new AMap.Marker({
|
||||
position: position,
|
||||
offset: new AMap.Pixel(0, 0),
|
||||
});
|
||||
map.add(marker);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
|
||||
function getName(val, list) {
|
||||
if (!val && val !== 0) return '';
|
||||
for (let i = 0; i < (list || []).length; i++) {
|
||||
if (list[i].value == val) {
|
||||
return list[i].label;
|
||||
}
|
||||
}
|
||||
return '-';
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.modal-container {
|
||||
div {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
display: flex;
|
||||
height: 55vh;
|
||||
padding: 0 20px;
|
||||
:deep(.scroll-containe) {
|
||||
padding: 0;
|
||||
}
|
||||
.user {
|
||||
width: 40%;
|
||||
max-width: 300px;
|
||||
padding: 20px;
|
||||
border-right: 1px solid #f0f0f0;
|
||||
overflow: auto;
|
||||
div {
|
||||
padding: 5px 0;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
.map {
|
||||
width: 100%;
|
||||
height: calc(100% + 20px);
|
||||
}
|
||||
.no-map {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #d92f2f;
|
||||
font-size: 15px;
|
||||
.map-icon {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
background: url('/@/assets/images/medicalCenter/closeWarn.png') no-repeat;
|
||||
background-size: 100% 100%;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.reason-title {
|
||||
padding-top: 40px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.resource {
|
||||
padding-top: 5px;
|
||||
line-height: 32px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,33 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/health-emergency/intervene/v2/aedEquipmentManger/queryPublishPage',
|
||||
getUnPublishEquipment = '/health-emergency/intervene/v2/aedEquipmentManger/getUnPublishEquipment',
|
||||
insertPublishEquipment = '/health-emergency/intervene/v2/aedEquipmentManger/insertPublishEquipment',
|
||||
updateManager = '/health-emergency/intervene/v2/aedEquipmentManger/edit',
|
||||
deleteBatchPublish = '/health-emergency/intervene/v2/aedEquipmentManger/deleteBatchPublish',
|
||||
exportXls = '/health-emergency/intervene/v2/aedEquipmentManger/exportXlsPublish',
|
||||
getSrc = '/health-emergency/intervene/v2/aedEquipmentManger/getSrc',
|
||||
}
|
||||
export const getExportUrl = (params: any) => defHttp.get({ url: Api.exportXls, params: params });
|
||||
export const getSrcApi = (params: any) => defHttp.get({ url: Api.getSrc, params: params });
|
||||
export const listApi = (params: any) => defHttp.get({ url: Api.list, params: params });
|
||||
export const getUnPublishEquipmentApi = (params: any) => defHttp.get({ url: Api.getUnPublishEquipment, params: params });
|
||||
export const addApi = (params: any) => defHttp.post({ url: Api.insertPublishEquipment, params: params });
|
||||
export const editApi = (params: any) => defHttp.put({ url: Api.updateManager, params: params });
|
||||
export const deleteBatchPublishApi = (params: any, handleSuccess: any) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({ url: Api.deleteBatchPublish, params: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,285 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { orgSearchInfoByCode } from '/@/utils/orgSearchInfo';
|
||||
import { getGeneralColumns } from '/@/views/emergency/aed/devices/deviceList.data';
|
||||
// import { render } from '/@/utils/common/renderUtils';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
...getGeneralColumns({ code3: 'secondDepart', code4: 'orgName' }),
|
||||
// {
|
||||
// title: '设备名称',
|
||||
// align: 'center',
|
||||
// dataIndex: 'name',
|
||||
// },
|
||||
// {
|
||||
// title: '所属部门',
|
||||
// align: 'center',
|
||||
// dataIndex: 'orgName',
|
||||
// },
|
||||
// {
|
||||
// title: '设备型号',
|
||||
// align: 'center',
|
||||
// dataIndex: 'hostSerialNum',
|
||||
// },
|
||||
{
|
||||
title: '详细位置',
|
||||
align: 'center',
|
||||
dataIndex: 'location',
|
||||
},
|
||||
// {
|
||||
// title: '设备自检',
|
||||
// align: 'center',
|
||||
// children: [
|
||||
// {
|
||||
// title: '更新日期',
|
||||
// align: 'center',
|
||||
// dataIndex: 'selfCheckUpdateTime',
|
||||
// customRender: ({ text, record }) => {
|
||||
// if ((!text && text !== 0) || !record.departCode || record.departCode.indexOf('A01A09') === -1) {
|
||||
// return '-';
|
||||
// }
|
||||
// return text;
|
||||
// },
|
||||
// width: 100,
|
||||
// },
|
||||
// {
|
||||
// title: '电量',
|
||||
// align: 'center',
|
||||
// dataIndex: 'electricQuantity',
|
||||
// customRender: ({ text, record }) => {
|
||||
// if ((!text && text !== 0) || !record.departCode || record.departCode.indexOf('A01A09') === -1) {
|
||||
// return '-';
|
||||
// }
|
||||
// return text + '%';
|
||||
// },
|
||||
// width: 100,
|
||||
// },
|
||||
// {
|
||||
// title: '状态',
|
||||
// align: 'center',
|
||||
// dataIndex: 'checkStatus',
|
||||
// customRender: ({ text, record }) => {
|
||||
// return !record.departCode || record.departCode.indexOf('A01A09') === -1
|
||||
// ? '-'
|
||||
// : render.renderDict(text, 'aed_check_status') || '-';
|
||||
// },
|
||||
// width: 100,
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// title: '摄像头监控',
|
||||
// align: 'center',
|
||||
// dataIndex: 'video',
|
||||
// },
|
||||
// {
|
||||
// title: '状态',
|
||||
// align: 'center',
|
||||
// dataIndex: 'status_dictText',
|
||||
// },
|
||||
// {
|
||||
// title: '布点日期',
|
||||
// align: 'center',
|
||||
// dataIndex: 'installTime',
|
||||
// },
|
||||
// {
|
||||
// title: '管理部门',
|
||||
// align: 'center',
|
||||
// dataIndex: 'controlOrgName',
|
||||
// },
|
||||
// {
|
||||
// title: '管理人',
|
||||
// align: 'center',
|
||||
// dataIndex: 'manageUserName',
|
||||
// },
|
||||
// {
|
||||
// title: '管理人电话',
|
||||
// align: 'center',
|
||||
// dataIndex: 'manageUserMobile',
|
||||
// },
|
||||
{
|
||||
title: '责任人1',
|
||||
align: 'center',
|
||||
dataIndex: 'chargeFirst',
|
||||
},
|
||||
{
|
||||
title: '责任人1电话',
|
||||
align: 'center',
|
||||
dataIndex: 'chargeFirstMobile',
|
||||
},
|
||||
{
|
||||
title: '责任人2',
|
||||
align: 'center',
|
||||
dataIndex: 'chargeSecond',
|
||||
customRender: ({ text }) => {
|
||||
if (!text && text !== 0) {
|
||||
return '-';
|
||||
}
|
||||
return text;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '责任人2电话',
|
||||
align: 'center',
|
||||
dataIndex: 'chargeSecondMobile',
|
||||
customRender: ({ text }) => {
|
||||
if (!text && text !== 0) {
|
||||
return '-';
|
||||
}
|
||||
return text;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '布点设备',
|
||||
field: 'name',
|
||||
component: 'Input',
|
||||
slot: 'old',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'oldId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
// {
|
||||
// label: '设备型号',
|
||||
// field: 'hostModel',
|
||||
// slot: 'hostSerialNum',
|
||||
// component: 'Input',
|
||||
// },
|
||||
{
|
||||
label: '布点日期',
|
||||
field: 'installTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: () => ({ format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', style: { width: '100%' } }),
|
||||
},
|
||||
{
|
||||
label: '布点地址',
|
||||
field: 'installAddress',
|
||||
component: 'Input',
|
||||
slot: 'installAddress',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '经度',
|
||||
field: 'longitude',
|
||||
component: 'InputNumber',
|
||||
componentProps: () => ({ style: { width: '100%' } }),
|
||||
show: false,
|
||||
// required: true,
|
||||
},
|
||||
{
|
||||
label: '纬度',
|
||||
field: 'latitude',
|
||||
component: 'InputNumber',
|
||||
componentProps: () => ({ style: { width: '100%' } }),
|
||||
show: false,
|
||||
// required: true,
|
||||
},
|
||||
{
|
||||
label: '覆盖人数',
|
||||
field: 'coverUserNum',
|
||||
component: 'InputNumber',
|
||||
componentProps: () => ({ style: { width: '100%' } }),
|
||||
},
|
||||
{
|
||||
label: '责任人1',
|
||||
field: 'chargeFirst',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '责任人1电话',
|
||||
field: 'chargeFirstMobile',
|
||||
component: 'Input',
|
||||
// rules: rules.phone(true),
|
||||
},
|
||||
{
|
||||
label: '责任人2',
|
||||
field: 'chargeSecond',
|
||||
component: 'Input',
|
||||
// required: true,
|
||||
},
|
||||
{
|
||||
label: '责任人2电话',
|
||||
field: 'chargeSecondMobile',
|
||||
component: 'Input',
|
||||
// rules: rules.phone(false),
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
];
|
||||
|
||||
export const mColumns: BasicColumn[] = [
|
||||
{
|
||||
title: '设备名称',
|
||||
align: 'center',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '所属单位',
|
||||
align: 'center',
|
||||
dataIndex: 'secondDepart',
|
||||
},
|
||||
{
|
||||
title: '所属部门',
|
||||
align: 'center',
|
||||
dataIndex: 'departName',
|
||||
},
|
||||
// {
|
||||
// title: '设备型号',
|
||||
// align: 'center',
|
||||
// dataIndex: 'hostModel',
|
||||
// },
|
||||
// {
|
||||
// title: '品牌',
|
||||
// align: 'center',
|
||||
// dataIndex: 'brand',
|
||||
// },
|
||||
// {
|
||||
// title: '设备类型',
|
||||
// align: 'center',
|
||||
// dataIndex: 'type_dictText',
|
||||
// },
|
||||
];
|
||||
export const mSearchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'name',
|
||||
component: 'Input',
|
||||
},
|
||||
// {
|
||||
// label: '设备类型',
|
||||
// field: 'type',
|
||||
// component: 'JDictSelectTag',
|
||||
// componentProps: () => ({
|
||||
// dictCode: 'intervene_aed_type',
|
||||
// }),
|
||||
// },
|
||||
...orgSearchInfoByCode('orgCode1', 'orgCode2', 'orgCode'),
|
||||
// {
|
||||
// label: '所属部门',
|
||||
// field: 'orgCode',
|
||||
// component: 'ApiSelect',
|
||||
// componentProps: () => {
|
||||
// return {
|
||||
// api: getThirdDepartsNewApi,
|
||||
// resultField: 'list',
|
||||
// labelField: 'departName',
|
||||
// valueField: 'orgCode',
|
||||
// placeholder: '请选择所属部门',
|
||||
// showSearch: true,
|
||||
// filterOption: (input: string, option: any): boolean => {
|
||||
// const str: string = input.toLowerCase();
|
||||
// return option.label.toLowerCase().indexOf(str) >= 0;
|
||||
// },
|
||||
// };
|
||||
// },
|
||||
// },
|
||||
];
|
||||
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<BasicTable @register="registerTable" :row-selection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="addB" preIcon="ant-design:plus-outlined"> 新增 </a-button>
|
||||
<a-button type="primary" @click="exportFile" v-auth="'intervene:aed_equipment_manger:exportXls'" preIcon="ant-design:export-outlined">
|
||||
导出
|
||||
</a-button>
|
||||
<a-button type="primary" @click="recordExport" v-auth="'intervene:aed_equipment_manger:exportXls'" preIcon="ant-design:export-outlined">
|
||||
导出记录
|
||||
</a-button>
|
||||
<a-button type="primary" @click="largeDel" preIcon="ant-design:delete-outlined"> 批量删除 </a-button>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<div v-if="column.dataIndex === 'location'">
|
||||
<a-button type="text" @click="lookInfo(record, '0')" style="color: #1890ff; background-color: transparent">查看</a-button>
|
||||
</div>
|
||||
<div v-if="column.dataIndex === 'video'">
|
||||
<template v-if="(record?.cameraNum || record?.cameraNum === 0) && (record.cameraCode || record.cameraCode === 0)">
|
||||
<a-button type="text" @click="lookInfo(record, '1')" style="color: #1890ff; background-color: transparent">查看</a-button>
|
||||
</template>
|
||||
<template v-else> - </template>
|
||||
</div>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
|
||||
<location-drawer @register="registerDrawer" @success="handleSuccess" />
|
||||
<location-modal @register="registerModal" />
|
||||
<export-util task-code="interveneAedPublishExport" @register="registerExport" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import BasicTable from '/@/components/Table/src/BasicTable.vue';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { deleteBatchPublishApi, listApi, getExportUrl } from '/@/views/emergency/aed/location/locationList.api';
|
||||
import { columns } from '/@/views/emergency/aed/location/locationList.data';
|
||||
import { FormSchema, TableAction } from '/@/components/Table';
|
||||
import { useDrawer } from '/@/components/Drawer';
|
||||
import LocationDrawer from '/@/views/emergency/aed/location/compoents/locationDrawer.vue';
|
||||
import LocationModal from '/@/views/emergency/aed/location/compoents/locationModal.vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { getSearchSchema } from '/@/views/emergency/aed/devices/deviceList.data';
|
||||
import { message } from 'ant-design-vue';
|
||||
import ExportUtil from '/@/utils/export/exportUtil.vue';
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerExport, { openDrawer: openDrawer1 }] = useDrawer();
|
||||
|
||||
function recordExport() {
|
||||
openDrawer1(true, {});
|
||||
}
|
||||
|
||||
const exportFile = () => {
|
||||
getExportUrl(getForm().getFieldsValue())
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
};
|
||||
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
api: listApi,
|
||||
columns,
|
||||
canResize: false,
|
||||
clickToRowSelect: false,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: getSearchSchema() as FormSchema[],
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: false,
|
||||
fieldMapToNumber: [],
|
||||
fieldMapToTime: [],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '布点信息',
|
||||
url: getExportUrl,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload, setProps, getForm }, { selectedRowKeys, rowSelection }] = tableContext;
|
||||
|
||||
function addB() {
|
||||
openDrawer(true, {
|
||||
isUpdate: false,
|
||||
title: '新增布点位置',
|
||||
});
|
||||
}
|
||||
function lookInfo(record: Recordable, type: string) {
|
||||
openModal(true, {
|
||||
record,
|
||||
type,
|
||||
});
|
||||
}
|
||||
function largeDel() {
|
||||
if (selectedRowKeys.value.length === 0) return message.info('请至少选择一条数据');
|
||||
deleteBatchPublishApi({ ids: selectedRowKeys.value.join(',') }, handleSuccess);
|
||||
}
|
||||
function getTableAction(record: Recordable) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
onClick: handleDelete.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openDrawer(true, {
|
||||
title: '编辑布点位置',
|
||||
record,
|
||||
isUpdate: true,
|
||||
});
|
||||
}
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteBatchPublishApi({ ids: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less"></style>
|
||||
@@ -1,78 +0,0 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/health-emergency/emergency/aed/list',
|
||||
save = '/health-emergency/emergency/aed/add',
|
||||
edit = '/health-emergency/emergency/aed/edit',
|
||||
deleteOne = '/health-emergency/emergency/aed/delete',
|
||||
deleteBatch = '/health-emergency/emergency/aed/deleteBatch',
|
||||
importExcel = '/health-emergency/emergency/aed/importExcel',
|
||||
exportXls = '/health-emergency/emergency/aed/exportXls',
|
||||
queryById = '/health-emergency/emergency/aed/queryById',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
export const queryByIdUrl = Api.queryById;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
*/
|
||||
export const deleteOne = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () =>
|
||||
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
await defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true });
|
||||
handleSuccess();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params });
|
||||
};
|
||||
@@ -1,566 +0,0 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { RendererElement, RendererNode, VNode } from 'vue';
|
||||
import { getSecondaryDepartmentList, getThirdDepartListByOrgCode } from '/@/views/system/user/user.api';
|
||||
import { BODY_CONTAINER } from '/@/utils/domUtils';
|
||||
import { rules } from '/@/utils/helper/validator';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
const { createMessage } = useMessage();
|
||||
const renderStatusTag = (span: VNode<RendererNode, RendererElement, { [p: string]: any }>) => {
|
||||
const text = span.children;
|
||||
switch (text) {
|
||||
case '正常':
|
||||
return render.renderTag(text, '#31d731');
|
||||
case '快过期':
|
||||
case '需检查':
|
||||
case '电量低':
|
||||
return render.renderTag(text, '#FFA440');
|
||||
case '已过期':
|
||||
case '需更换':
|
||||
case '未找到':
|
||||
case '无连接':
|
||||
return render.renderTag(text, '#f04141');
|
||||
case '待确认':
|
||||
return render.renderTag(text, '#999999');
|
||||
default:
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '所属单位',
|
||||
align: 'center',
|
||||
dataIndex: 'secondDepartName',
|
||||
},
|
||||
{
|
||||
title: '所属部门',
|
||||
align: 'center',
|
||||
dataIndex: 'departName',
|
||||
},
|
||||
{
|
||||
title: '所属单位',
|
||||
align: 'center',
|
||||
dataIndex: 'manageDepartName',
|
||||
},
|
||||
{
|
||||
title: '设备编号',
|
||||
align: 'center',
|
||||
dataIndex: 'hostSerialNum',
|
||||
},
|
||||
{
|
||||
title: '布点位置',
|
||||
align: 'center',
|
||||
dataIndex: 'installAddress',
|
||||
},
|
||||
{
|
||||
title: '布点坐标',
|
||||
align: 'center',
|
||||
dataIndex: 'longitude',
|
||||
customRender: ({ record }) => {
|
||||
const { longitude, latitude} = record;
|
||||
const val = longitude !== null && latitude !== null ? `${longitude},${latitude}` : '';
|
||||
return val;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '覆盖人数',
|
||||
align: 'center',
|
||||
dataIndex: 'coverUserNum',
|
||||
},
|
||||
{
|
||||
title: '自检状态',
|
||||
align: 'center',
|
||||
dataIndex: 'checkStatus',
|
||||
customRender: ({ text }) => {
|
||||
return renderStatusTag(render.renderDict(text, 'aed_check_status'));
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '电极片监控',
|
||||
align: 'center',
|
||||
dataIndex: 'electrodeSheetStatus',
|
||||
customRender: ({ text }) => {
|
||||
return renderStatusTag(render.renderDict(text, 'aed_electrode_sheet_status'));
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '电池监控',
|
||||
align: 'center',
|
||||
dataIndex: 'batteryStatus',
|
||||
customRender: ({ text }) => {
|
||||
return renderStatusTag(render.renderDict(text, 'aed_battery_status'));
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '路由监控',
|
||||
align: 'center',
|
||||
dataIndex: 'routerStatus',
|
||||
customRender: ({ text }) => {
|
||||
return renderStatusTag(render.renderDict(text, 'aed_router_status'));
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '布防时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '管理单位',
|
||||
align: 'center',
|
||||
dataIndex: 'manageDepartName',
|
||||
},
|
||||
{
|
||||
title: '管理人',
|
||||
align: 'center',
|
||||
dataIndex: 'manageUserName',
|
||||
},
|
||||
{
|
||||
title: '管理人电话',
|
||||
align: 'center',
|
||||
dataIndex: 'manageUserMobile',
|
||||
},
|
||||
{
|
||||
title: '负责人1',
|
||||
align: 'center',
|
||||
dataIndex: 'chargeFirst',
|
||||
},
|
||||
{
|
||||
title: '负责人1电话',
|
||||
align: 'center',
|
||||
dataIndex: 'chargeFirstMobile',
|
||||
},
|
||||
{
|
||||
title: '负责人2',
|
||||
align: 'center',
|
||||
dataIndex: 'chargeSecond',
|
||||
},
|
||||
{
|
||||
title: '负责人2电话',
|
||||
align: 'center',
|
||||
dataIndex: 'chargeSecondMobile',
|
||||
},
|
||||
];
|
||||
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '所属单位',
|
||||
field: 'second',
|
||||
component: 'ApiSelect',
|
||||
componentProps: () => {
|
||||
return {
|
||||
api: getSecondaryDepartmentList,
|
||||
resultField: 'result',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '所属部门',
|
||||
field: 'three',
|
||||
component: 'ApiSelect',
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
api: getThirdDepartListByOrgCode,
|
||||
resultField: 'list',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
params: {
|
||||
orgCode: formModel?.second || 'asd(*',
|
||||
},
|
||||
onFocus: () => {
|
||||
if (!formModel.second) {
|
||||
return createMessage.warn('请先选择所属单位!');
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: 'AED型号',
|
||||
// field: 'hostModel',
|
||||
// component: 'Input',
|
||||
// },
|
||||
{
|
||||
label: '设备编号',
|
||||
field: 'hostSerialNum',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '自检状态',
|
||||
field: 'checkStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'aed_check_status',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '电极片监控',
|
||||
field: 'electrodeSheetStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'aed_electrode_sheet_status',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '电池监控',
|
||||
field: 'batteryStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'aed_battery_status',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '路由监控',
|
||||
field: 'routerStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'aed_router_status',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '详情字段',
|
||||
field: 'infoFlag',
|
||||
component: 'Input',
|
||||
ifShow: false,
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '设备信息',
|
||||
field: 'deviceInfoLine',
|
||||
component: 'Divider',
|
||||
componentProps: {
|
||||
//文字是否显示为普通正文样式
|
||||
plain: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'name',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '所属单位',
|
||||
field: 'second',
|
||||
component: 'ApiSelect',
|
||||
required: true,
|
||||
componentProps: () => {
|
||||
return {
|
||||
api: getSecondaryDepartmentList,
|
||||
resultField: 'result',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any): boolean => {
|
||||
const str: string = input.toLowerCase();
|
||||
return option.label.toLowerCase().indexOf(str) >= 0;
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '所属部门',
|
||||
field: 'departCode',
|
||||
component: 'ApiSelect',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
api: getThirdDepartListByOrgCode,
|
||||
resultField: 'list',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
params: {
|
||||
orgCode: formModel?.second || 'asd(*',
|
||||
},
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any): boolean => {
|
||||
const str: string = input.toLowerCase();
|
||||
return option.label.toLowerCase().indexOf(str) >= 0;
|
||||
},
|
||||
onFocus: () => {
|
||||
if (!formModel.second) {
|
||||
return createMessage.warn('请先选择所属单位!');
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '自检状态',
|
||||
field: 'checkStatus',
|
||||
component: 'Input',
|
||||
render: ({ values, field }) => {
|
||||
return renderStatusTag(render.renderDict(values[field], 'aed_check_status'));
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
return values.infoFlag == true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '电极片监控',
|
||||
field: 'electrodeSheetStatus',
|
||||
component: 'Input',
|
||||
render: ({ values, field }) => {
|
||||
return renderStatusTag(render.renderDict(values[field], 'aed_electrode_sheet_status'));
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
return values.infoFlag == true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '电池监控',
|
||||
field: 'batteryStatus',
|
||||
component: 'Input',
|
||||
render: ({ values, field }) => {
|
||||
return renderStatusTag(render.renderDict(values[field], 'aed_battery_status'));
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
return values.infoFlag == true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '路由监控',
|
||||
field: 'routerStatus',
|
||||
component: 'Input',
|
||||
render: ({ values, field }) => {
|
||||
return renderStatusTag(render.renderDict(values[field], 'aed_router_status'));
|
||||
},
|
||||
ifShow: ({ values }) => {
|
||||
return values.infoFlag == true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '设备型号',
|
||||
field: 'hostModel',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '设备编号',
|
||||
field: 'hostSerialNum',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '电极片有效期',
|
||||
field: 'electrodeSheetValidTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: false,
|
||||
valueFormat: 'YYYY-MM',
|
||||
picker: 'month',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '路由器型号',
|
||||
field: 'routerModel',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '路由器序列号',
|
||||
field: 'routerSerialNum',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '电池型号',
|
||||
field: 'batteryModel',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '电池电压',
|
||||
field: 'batteryVoltage',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
controls: false,
|
||||
addonAfter: 'V',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '质保时间',
|
||||
field: 'warrantyDate',
|
||||
component: 'RangePicker',
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
showTime: false,
|
||||
format: 'YYYY-MM-DD',
|
||||
getPopupContainer: () => BODY_CONTAINER,
|
||||
onChange: ([start, end]) => {
|
||||
formModel.warrantyStartDate = start;
|
||||
formModel.warrantyEndDate = end;
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '质保开始时间',
|
||||
field: 'warrantyStartDate',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '质保结束时间',
|
||||
field: 'warrantyEndDate',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '设备图片',
|
||||
field: 'aedImg',
|
||||
component: 'JImageUpload',
|
||||
componentProps: {
|
||||
fileMax: 5,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '管理信息',
|
||||
field: 'manageInfoLine',
|
||||
component: 'Divider',
|
||||
componentProps: {
|
||||
//文字是否显示为普通正文样式
|
||||
plain: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '负责人id',
|
||||
field: 'manageUserId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '管理部门',
|
||||
field: 'manageDepartCode',
|
||||
component: 'ApiSelect',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
api: getThirdDepartListByOrgCode,
|
||||
resultField: 'list',
|
||||
labelField: 'departName',
|
||||
valueField: 'orgCode',
|
||||
params: {
|
||||
orgCode: formModel?.second || 'asd(*',
|
||||
},
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any): boolean => {
|
||||
const str: string = input.toLowerCase();
|
||||
return option.label.toLowerCase().indexOf(str) >= 0;
|
||||
},
|
||||
onFocus: () => {
|
||||
if (!formModel.second) {
|
||||
return createMessage.warn('请先选择所属单位!');
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '管理人员',
|
||||
field: 'manageUserName',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '管理电话',
|
||||
field: 'manageUserMobile',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
rules: rules.rule('phone', true),
|
||||
},
|
||||
{
|
||||
label: '负责人员1',
|
||||
field: 'chargeFirst',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '负责电话1',
|
||||
field: 'chargeFirstMobile',
|
||||
component: 'Input',
|
||||
rules: rules.rule('phone', false),
|
||||
},
|
||||
{
|
||||
label: '负责人员2',
|
||||
field: 'chargeSecond',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '负责电话2',
|
||||
field: 'chargeSecondMobile',
|
||||
component: 'Input',
|
||||
rules: rules.rule('phone', false),
|
||||
},
|
||||
{
|
||||
label: '安装信息',
|
||||
field: 'installInfoLine',
|
||||
component: 'Divider',
|
||||
componentProps: {
|
||||
//文字是否显示为普通正文样式
|
||||
plain: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '厂商名称',
|
||||
field: 'mfrsName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '联系电话',
|
||||
field: 'mfrsMobile',
|
||||
component: 'Input',
|
||||
rules: rules.rule('phone', false),
|
||||
},
|
||||
{
|
||||
label: '覆盖人数',
|
||||
field: 'coverUserNum',
|
||||
component: 'InputNumber',
|
||||
},
|
||||
{
|
||||
label: '安装位置',
|
||||
field: 'installAddress',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
slot: 'address',
|
||||
},
|
||||
{
|
||||
label: '经度',
|
||||
field: 'longitude',
|
||||
required: true,
|
||||
component: 'InputNumber',
|
||||
},
|
||||
{
|
||||
label: '纬度',
|
||||
field: 'latitude',
|
||||
required: true,
|
||||
component: 'InputNumber',
|
||||
},
|
||||
{
|
||||
label: '位置照片',
|
||||
field: 'installAddressImg',
|
||||
component: 'JImageUpload',
|
||||
componentProps: {
|
||||
fileMax: 5,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* 流程表单调用这个方法获取formSchema
|
||||
* @param param
|
||||
*/
|
||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||
return formSchema;
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable">
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template #htmlSlot="{ text }">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<LocationManageDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="aed-locationManage" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import LocationManageDrawer from './components/LocationManageDrawer.vue';
|
||||
import { columns, searchFormSchema } from './LocationManage.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, getImportUrl, list } from './LocationManage.api';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { useDrawer } from '/@/components/Drawer';
|
||||
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
//注册model
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext } = useListPage({
|
||||
tableProps: {
|
||||
title: '布点管理',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: false,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: false,
|
||||
fieldMapToNumber: [],
|
||||
fieldMapToTime: [],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 110,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: (info) => {
|
||||
info['name'] = info?.name && `*${info.name}*`;
|
||||
if (info.second !== undefined) {
|
||||
info['departCode'] = `${info.second}*`;
|
||||
}
|
||||
if (info.three !== undefined) {
|
||||
info['departCode'] = `${info.three}`;
|
||||
}
|
||||
info['hostSerialNum'] = info?.hostSerialNum && `*${info.hostSerialNum}*`;
|
||||
info['aidrange'] = info?.aidrange && `*${info.aidrange}*`;
|
||||
return info;
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '应急资源',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openDrawer(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
title: '新增',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
record.infoFlag = false;
|
||||
record.warrantyDate = [record.warrantyStartDate, record.warrantyEndDate];
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
title: '编辑',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
record.infoFlag = true;
|
||||
record.warrantyDate = [record.warrantyStartDate, record.warrantyEndDate];
|
||||
openDrawer(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
title: '详情',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'emergency:emergency_resource:edit',
|
||||
},
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-popover-buttons) {
|
||||
display: flex !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,126 +0,0 @@
|
||||
<template>
|
||||
<BasicDrawer :showFooter="showFooter" :title="title" :width="800" destroyOnClose v-bind="$attrs" @ok="handleSubmit" @register="registerModal">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #address="{ model }">
|
||||
<a-input v-model:value="model['installAddress']" placeholder="请输入安装位置或地图选点" :disabled="!showFooter" style="width: 82%" />
|
||||
<a-button :disabled="!showFooter" style="margin-left: 10px" @click="viewMap"> 查看地图 </a-button>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<Map ref="map" :state="state" @register="registerMap" @get-position="getPosition" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, unref } from 'vue';
|
||||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../LocationManage.data';
|
||||
import { saveOrUpdate } from '../LocationManage.api';
|
||||
import Map from '/@/views/consult/resource/components/Map.vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
|
||||
// Emits声明
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const showFooter = ref<boolean>(true);
|
||||
const state = ref();
|
||||
//设置标题
|
||||
const title = ref<string>('');
|
||||
//表单配置
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, getFieldsValue, clearValidate }] = useForm({
|
||||
//labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
const [registerMap, { openModal }] = useModal();
|
||||
//表单赋值
|
||||
const [registerModal, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setDrawerProps({
|
||||
confirmLoading: false,
|
||||
showCancelBtn: !!data?.showFooter,
|
||||
showOkBtn: !!data?.showFooter,
|
||||
});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
showFooter.value = data.showFooter;
|
||||
title.value = data.title;
|
||||
let customAddress = '';
|
||||
if (unref(isUpdate)) {
|
||||
customAddress = `${data.record?.longitude},${data.record?.latitude}`;
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
customAddress,
|
||||
second: data.record?.departCode.slice(0, 6),
|
||||
});
|
||||
state.value = data.record;
|
||||
} else {
|
||||
state.value = {};
|
||||
}
|
||||
await clearValidate();
|
||||
// 隐藏底部时禁用整个表单
|
||||
await setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
function viewMap() {
|
||||
openModal(true, {
|
||||
record: { ...getFieldsValue() },
|
||||
});
|
||||
}
|
||||
|
||||
async function getPosition(val) {
|
||||
let { pname, cityname, adname, address, name } = val.handleItem || '';
|
||||
let nameList = [pname, cityname, adname, address, name];
|
||||
let str = '';
|
||||
nameList.map((item) => {
|
||||
if (item !== undefined) {
|
||||
str += item;
|
||||
}
|
||||
});
|
||||
await setFieldsValue({
|
||||
latitude: val.lat,
|
||||
longitude: val.lng,
|
||||
customAddress: `${val.lng},${val.lat}`,
|
||||
installAddress: str,
|
||||
});
|
||||
state.value = {
|
||||
...state.value,
|
||||
latitude: val.lat,
|
||||
longitude: val.lng,
|
||||
};
|
||||
}
|
||||
|
||||
//表单提交事件
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
let values = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params = {
|
||||
...state.value,
|
||||
...values,
|
||||
};
|
||||
console.log(values);
|
||||
//提交表单
|
||||
await saveOrUpdate(params, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeDrawer();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user