BUG修改配置
This commit is contained in:
parent
0b98f72e17
commit
1622d4cfac
@ -6,53 +6,96 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, watch, defineEmits, onBeforeUnmount } from 'vue'
|
import { ref, onMounted, watch, defineEmits, onBeforeUnmount } from 'vue'
|
||||||
import * as d3 from 'd3'
|
import * as d3 from 'd3'
|
||||||
import chinaData from './newJson.json'
|
import chinaData from './newJson.json'
|
||||||
|
|
||||||
|
// ==================== 常量与类型定义 ====================
|
||||||
|
const DEFAULT_MAP_SIZE = { width: 800, height: 600 }
|
||||||
|
const PROJECTION_CENTER = [104, 37] // 中国地理中心近似坐标
|
||||||
|
const SCALE_FACTORS = { normal: 600, fullscreen: 1000 }
|
||||||
|
|
||||||
|
// ==================== 组件Props/Emits ====================
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
coordinates: {
|
coordinates: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [
|
default: () => [
|
||||||
[116.405285, 39.904989], // 北京
|
[116.405285, 39.904989], // 北京
|
||||||
[121.472644, 31.231706] // 上海
|
[121.472644, 31.231706] // 上海
|
||||||
]
|
],
|
||||||
|
validator: value => value.every(coord =>
|
||||||
|
Array.isArray(coord) && coord.length === 2 &&
|
||||||
|
typeof coord[0] === 'number' && typeof coord[1] === 'number'
|
||||||
|
)
|
||||||
},
|
},
|
||||||
qvehuan: {
|
qvehuan: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: () => false
|
default: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['qvehuan1']);
|
|
||||||
|
const emit = defineEmits(['qvehuan1'])
|
||||||
|
|
||||||
|
// ==================== 响应式状态 ====================
|
||||||
const mapContainer = ref(null)
|
const mapContainer = ref(null)
|
||||||
const isFullscreen = ref(false)
|
const isFullscreen = ref(false)
|
||||||
let svg, mapGroup, markersGroup, zoom, width, height
|
const isRouteInitialized = ref(false) // 原initqie,重命名以明确含义
|
||||||
|
|
||||||
const initMap = () => {
|
// ==================== D3相关变量 ====================
|
||||||
// 动态获取容器尺寸
|
let svgInstance = null
|
||||||
width = mapContainer.value.clientWidth?mapContainer.value.clientWidth:800
|
let mapGroup = null
|
||||||
height = mapContainer.value.clientHeight?mapContainer.value.clientHeight:600
|
let markersGroup = null
|
||||||
const projection = d3.geoMercator()
|
let zoomBehavior = null
|
||||||
.center([104, 37])
|
|
||||||
.scale(isFullscreen.value ? 1000 : 600)
|
// ==================== 地图核心逻辑 ====================
|
||||||
|
/**
|
||||||
|
* 创建地理投影配置
|
||||||
|
* @returns {d3.GeoProjection} D3地理投影实例
|
||||||
|
*/
|
||||||
|
const createProjection = () => {
|
||||||
|
const { width, height } = getContainerSize()
|
||||||
|
return d3.geoMercator()
|
||||||
|
.center(PROJECTION_CENTER)
|
||||||
|
.scale(isFullscreen.value ? SCALE_FACTORS.fullscreen : SCALE_FACTORS.normal)
|
||||||
.translate([width / 2, height / 2])
|
.translate([width / 2, height / 2])
|
||||||
|
}
|
||||||
|
|
||||||
const path = d3.geoPath().projection(projection)
|
/**
|
||||||
|
* 初始化地图基础结构
|
||||||
|
*/
|
||||||
|
const initializeMap = () => {
|
||||||
|
// 清理旧实例
|
||||||
|
if (svgInstance) svgInstance.remove()
|
||||||
|
|
||||||
if (svg) svg.remove()
|
const { width, height } = getContainerSize()
|
||||||
|
const projection = createProjection()
|
||||||
|
const pathGenerator = d3.geoPath().projection(projection)
|
||||||
|
|
||||||
svg = d3.select(mapContainer.value)
|
// 创建SVG容器
|
||||||
|
svgInstance = d3.select(mapContainer.value)
|
||||||
.append('svg')
|
.append('svg')
|
||||||
.attr('width', width)
|
.attr('width', width)
|
||||||
.attr('height', height)
|
.attr('height', height)
|
||||||
|
|
||||||
// 修改分组结构
|
// 创建分层结构
|
||||||
const mainGroup = svg.append('g')
|
const mainGroup = svgInstance.append('g')
|
||||||
mapGroup = mainGroup.append('g')
|
mapGroup = mainGroup.append('g').attr('class', 'map-layer')
|
||||||
markersGroup = mainGroup.append('g') // 标记层放入主缩放组
|
markersGroup = mainGroup.append('g').attr('class', 'markers-layer')
|
||||||
|
|
||||||
|
// 绘制中国地图
|
||||||
|
renderChinaMap(pathGenerator)
|
||||||
|
|
||||||
|
// 初始化缩放行为
|
||||||
|
initializeZoomBehavior(mainGroup)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染中国地图路径和文字
|
||||||
|
* @param {d3.GeoPath} path - 路径生成器
|
||||||
|
*/
|
||||||
|
const renderChinaMap = (path) => {
|
||||||
|
// 绘制省份路径
|
||||||
mapGroup.append('g')
|
mapGroup.append('g')
|
||||||
.selectAll('path')
|
.selectAll('path')
|
||||||
.data(chinaData.features)
|
.data(chinaData.features)
|
||||||
@ -61,64 +104,63 @@ const initMap = () => {
|
|||||||
.attr('d', path)
|
.attr('d', path)
|
||||||
.attr('fill', '#e7e7e7')
|
.attr('fill', '#e7e7e7')
|
||||||
.attr('stroke', '#fff')
|
.attr('stroke', '#fff')
|
||||||
|
|
||||||
|
// 添加省份名称
|
||||||
mapGroup.append('g')
|
mapGroup.append('g')
|
||||||
.selectAll('text')
|
.selectAll('text')
|
||||||
.data(chinaData.features)
|
.data(chinaData.features)
|
||||||
.enter()
|
.enter()
|
||||||
.append('text')
|
.append('text')
|
||||||
.attr('x', d => {
|
.attr('transform', d => `translate(${path.centroid(d)})`)
|
||||||
const centroid = path.centroid(d)
|
.text(d => d.properties.name || '')
|
||||||
return centroid[0]
|
|
||||||
})
|
|
||||||
.attr('y', d => {
|
|
||||||
const centroid = path.centroid(d)
|
|
||||||
return centroid[1]
|
|
||||||
})
|
|
||||||
.text(d => d.properties.name || '') // 确保JSON数据包含properties.name
|
|
||||||
.attr('text-anchor', 'middle')
|
.attr('text-anchor', 'middle')
|
||||||
.attr('dominant-baseline', 'central')
|
.attr('dominant-baseline', 'central')
|
||||||
|
.style('font', '12px Arial')
|
||||||
.attr('fill', '#333')
|
.attr('fill', '#333')
|
||||||
.style('font-size', '12px')
|
.style('pointer-events', 'none')
|
||||||
.style('font-family', 'Arial')
|
}
|
||||||
.style('pointer-events', 'none') // 防止干扰交互
|
|
||||||
zoom = d3.zoom()
|
/**
|
||||||
.scaleExtent([0.2, 8])
|
* 初始化缩放行为
|
||||||
.on('zoom', (event) => {
|
* @param {d3.Selection} group - 需要应用缩放的分组
|
||||||
mainGroup.attr('transform', event.transform)
|
*/
|
||||||
|
const initializeZoomBehavior = (group) => {
|
||||||
|
zoomBehavior = d3.zoom()
|
||||||
|
.scaleExtent([0.2, 68])
|
||||||
|
.on('zoom', ({ transform }) => {
|
||||||
|
group.attr('transform', transform)
|
||||||
})
|
})
|
||||||
svg.call(zoom)
|
svgInstance.call(zoomBehavior)
|
||||||
}
|
|
||||||
const handleResize = () => {
|
|
||||||
if (!isFullscreen.value) return
|
|
||||||
initMap()
|
|
||||||
updateRoute()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleFullscreen = () => {
|
// ==================== 路线相关逻辑 ====================
|
||||||
isFullscreen.value = !isFullscreen.value
|
/**
|
||||||
setTimeout(() => {
|
* 更新路线和标记点
|
||||||
initMap()
|
*/
|
||||||
updateRoute()
|
|
||||||
}, 100)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const updateRoute = () => {
|
const updateRoute = () => {
|
||||||
width = mapContainer.value.clientWidth?mapContainer.value.clientWidth:800
|
if (!props.coordinates?.length) return
|
||||||
height = mapContainer.value.clientHeight?mapContainer.value.clientHeight:600
|
if (!mapGroup) initializeMap()
|
||||||
const projection = d3.geoMercator()
|
const projection = createProjection()
|
||||||
.center([104, 37])
|
const pathGenerator = d3.geoPath().projection(projection)
|
||||||
.scale(isFullscreen.value ? 1000 : 600)
|
|
||||||
.translate([width / 2, height / 2])
|
// 清理旧数据
|
||||||
if (initqie.value) {
|
if (isRouteInitialized.value) {
|
||||||
// debugger
|
|
||||||
mapGroup.selectAll('.route-path').remove()
|
mapGroup.selectAll('.route-path').remove()
|
||||||
markersGroup.selectAll('*').remove()
|
markersGroup.selectAll('*').remove()
|
||||||
initqie.value = false
|
isRouteInitialized.value = false
|
||||||
emit('qvehuan1', initqie.value);
|
emit('qvehuan1', isRouteInitialized.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 绘制新路线
|
||||||
|
renderRoutePath(pathGenerator)
|
||||||
|
renderMarkers(projection)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制路径动画
|
||||||
|
* @param {d3.GeoPath} path - 路径生成器
|
||||||
|
*/
|
||||||
|
const renderRoutePath = (path) => {
|
||||||
const routeData = {
|
const routeData = {
|
||||||
type: "LineString",
|
type: "LineString",
|
||||||
coordinates: props.coordinates
|
coordinates: props.coordinates
|
||||||
@ -127,7 +169,7 @@ const updateRoute = () => {
|
|||||||
mapGroup.append('path')
|
mapGroup.append('path')
|
||||||
.datum(routeData)
|
.datum(routeData)
|
||||||
.attr('class', 'route-path')
|
.attr('class', 'route-path')
|
||||||
.attr('d', d3.geoPath().projection(projection))
|
.attr('d', path)
|
||||||
.attr('fill', 'none')
|
.attr('fill', 'none')
|
||||||
.attr('stroke', '#f00')
|
.attr('stroke', '#f00')
|
||||||
.attr('stroke-width', 0.1)
|
.attr('stroke-width', 0.1)
|
||||||
@ -140,44 +182,74 @@ const updateRoute = () => {
|
|||||||
.transition()
|
.transition()
|
||||||
.duration(2000)
|
.duration(2000)
|
||||||
.attr('stroke-dashoffset', 0)
|
.attr('stroke-dashoffset', 0)
|
||||||
|
}
|
||||||
|
|
||||||
// 修改标记点绘制逻辑
|
/**
|
||||||
props.coordinates.forEach((coord, i) => {
|
* 绘制位置标记点
|
||||||
if (!Array.isArray(coord) || coord.length !== 2) return
|
* @param {d3.GeoProjection} projection - 地理投影实例
|
||||||
const lon = Number(coord[0])
|
*/
|
||||||
const lat = Number(coord[1])
|
const renderMarkers = (projection) => {
|
||||||
|
props.coordinates.forEach(coord => {
|
||||||
|
if (!isValidCoordinate(coord)) return
|
||||||
|
|
||||||
if (isNaN(lon) || isNaN(lat)) return
|
const [x, y] = projection(coord)
|
||||||
|
|
||||||
const [x, y] = projection([lon, lat])
|
|
||||||
|
|
||||||
// 添加缩放补偿逻
|
|
||||||
markersGroup.append('circle')
|
markersGroup.append('circle')
|
||||||
.attr('cx', x)
|
.attr('cx', x)
|
||||||
.attr('cy', y)
|
.attr('cy', y)
|
||||||
.attr('r', 0.3) // 根据缩放级别调整半径
|
.attr('r', 0.3)
|
||||||
.attr('fill', '#ff4757')
|
.attr('fill', '#ff4757')
|
||||||
.attr('stroke', 'white')
|
.attr('stroke', 'white')
|
||||||
.attr('stroke-width', 0) // 同步调整描边宽度
|
.attr('stroke-width', 0)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const initqie = ref(false)
|
|
||||||
onMounted(() => {
|
// ==================== 工具函数 ====================
|
||||||
window.addEventListener('resize', handleResize)
|
const getContainerSize = () => ({
|
||||||
if (props.coordinates) {
|
width: mapContainer.value?.clientWidth || DEFAULT_MAP_SIZE.width,
|
||||||
initMap()
|
height: mapContainer.value?.clientHeight || DEFAULT_MAP_SIZE.height
|
||||||
|
})
|
||||||
|
|
||||||
|
const isValidCoordinate = (coord) =>
|
||||||
|
Array.isArray(coord) && coord.length === 2 &&
|
||||||
|
!isNaN(coord[0]) && !isNaN(coord[1])
|
||||||
|
|
||||||
|
// ==================== 全屏处理 ====================
|
||||||
|
const handleWindowResize = () => {
|
||||||
|
if (!isFullscreen.value) return
|
||||||
|
initializeMap()
|
||||||
updateRoute()
|
updateRoute()
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
const toggleFullscreen = () => {
|
||||||
onBeforeUnmount(() => {
|
isFullscreen.value = !isFullscreen.value
|
||||||
window.removeEventListener('resize', handleResize)
|
setTimeout(() => {
|
||||||
})
|
initializeMap()
|
||||||
watch(() => props.qvehuan, (newVal) => {
|
|
||||||
initqie.value = newVal
|
|
||||||
updateRoute()
|
updateRoute()
|
||||||
}, { deep: true })
|
}, 100) // 等待DOM更新
|
||||||
watch(() => props.coordinates, (newVal) => {
|
}
|
||||||
|
|
||||||
|
// ==================== 生命周期钩子 ====================
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener('resize', handleWindowResize)
|
||||||
|
// 强制初始化地图基础结构
|
||||||
|
initializeMap() // [!code ++]
|
||||||
|
// 仅在coordinates存在时更新路线
|
||||||
|
if (props.coordinates?.length) { // [!code ++]
|
||||||
|
updateRoute() // [!code ++]
|
||||||
|
} // [!code ++]
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('resize', handleWindowResize)
|
||||||
|
})
|
||||||
|
|
||||||
|
// ==================== 响应式监听 ====================
|
||||||
|
watch(() => props.qvehuan, (newVal) => {
|
||||||
|
isRouteInitialized.value = newVal
|
||||||
|
updateRoute()
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(() => props.coordinates, () => {
|
||||||
updateRoute()
|
updateRoute()
|
||||||
}, { deep: true })
|
}, { deep: true })
|
||||||
</script>
|
</script>
|
||||||
@ -201,19 +273,24 @@ watch(() => props.coordinates, (newVal) => {
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
z-index: 9999;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fullscreen-btn {
|
.fullscreen-btn {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: 25px;
|
right: 25px;
|
||||||
z-index: 10000;
|
z-index: 1001;
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
background: rgba(0, 0, 0, 0.7);
|
background: rgba(0, 0, 0, 0.7);
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: opacity 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fullscreen-btn:hover {
|
||||||
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -54,7 +54,7 @@ const info = ref({
|
|||||||
description: "",
|
description: "",
|
||||||
custom1: "",
|
custom1: "",
|
||||||
});
|
});
|
||||||
//新建企业数组
|
//新建组织数组
|
||||||
const causeInfo = ref({
|
const causeInfo = ref({
|
||||||
id: "",
|
id: "",
|
||||||
parentid: "",
|
parentid: "",
|
||||||
@ -68,9 +68,9 @@ const causeInfo = ref({
|
|||||||
const title = ref("");
|
const title = ref("");
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
const dialogCause = ref(false);
|
const dialogCause = ref(false);
|
||||||
//删除企业
|
//删除组织
|
||||||
const choosetreeid = ref("");
|
const choosetreeid = ref("");
|
||||||
//获取企业树形信息
|
//获取组织树形信息
|
||||||
function getTree() {
|
function getTree() {
|
||||||
const params = {
|
const params = {
|
||||||
parentid: "0",
|
parentid: "0",
|
||||||
@ -103,10 +103,10 @@ function getData() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
const multipleSelection = ref([]);
|
const multipleSelection = ref([]);
|
||||||
//定义企业填写规则
|
//定义组织填写规则
|
||||||
const rules = reactive<FormRules>({
|
const rules = reactive<FormRules>({
|
||||||
orgname: [{ required: true, message: "请填写企业名称", trigger: "blur" }],
|
orgname: [{ required: true, message: "请填写组织名称", trigger: "blur" }],
|
||||||
manager: [{ required: true, message: "请填写企业负责人名称", trigger: "blur" }],
|
manager: [{ required: true, message: "请填写组织负责人名称", trigger: "blur" }],
|
||||||
});
|
});
|
||||||
//定义部门填写规则
|
//定义部门填写规则
|
||||||
const moderules = reactive<FormRules>({
|
const moderules = reactive<FormRules>({
|
||||||
@ -148,9 +148,9 @@ function switchChange(row: any) {
|
|||||||
getData();
|
getData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//新建企业
|
//新建组织
|
||||||
function causeAdd() {
|
function causeAdd() {
|
||||||
title.value = "新增企业";
|
title.value = "新增组织";
|
||||||
dialogCause.value = true;
|
dialogCause.value = true;
|
||||||
const causeInfogase = ref({
|
const causeInfogase = ref({
|
||||||
id: "",
|
id: "",
|
||||||
@ -164,7 +164,7 @@ function causeAdd() {
|
|||||||
});
|
});
|
||||||
causeInfo.value = causeInfogase.value;
|
causeInfo.value = causeInfogase.value;
|
||||||
}
|
}
|
||||||
//新键企业-保存
|
//新键组织-保存
|
||||||
function editisrepetition(formEl: any) {
|
function editisrepetition(formEl: any) {
|
||||||
formEl.validate((valid: any) => {
|
formEl.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
@ -214,16 +214,16 @@ function handleClose() {
|
|||||||
dialogCause.value = false;
|
dialogCause.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改企业
|
//修改组织
|
||||||
function edittree(data: any) {
|
function edittree(data: any) {
|
||||||
title.value = "修改企业";
|
title.value = "修改组织";
|
||||||
causeInfo.value = JSON.parse(JSON.stringify(data));
|
causeInfo.value = JSON.parse(JSON.stringify(data));
|
||||||
dialogCause.value = true;
|
dialogCause.value = true;
|
||||||
}
|
}
|
||||||
function remove(data: any) {
|
function remove(data: any) {
|
||||||
choosetreeid.value = "";
|
choosetreeid.value = "";
|
||||||
choosetreeid.value = data.id;
|
choosetreeid.value = data.id;
|
||||||
ElMessageBox.confirm("确定删除该企业及该企业下的所有部门吗?", "删除提示", {
|
ElMessageBox.confirm("确定删除该组织及该组织下的所有部门吗?", "删除提示", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
@ -375,7 +375,7 @@ const vMove = {
|
|||||||
<div class="faulttemplate-box">
|
<div class="faulttemplate-box">
|
||||||
<aside id="silderLeft">
|
<aside id="silderLeft">
|
||||||
<div v-hasPerm="['add:org']" class="p-[15px]"><el-button class="w-full mb-[15px]" style="color: #0099ff; border: 1px solid #0099ff;"
|
<div v-hasPerm="['add:org']" class="p-[15px]"><el-button class="w-full mb-[15px]" style="color: #0099ff; border: 1px solid #0099ff;"
|
||||||
@click="causeAdd"> <img src="@/assets/MenuIcon/u241.png" style="margin-right: 10px;"> 新增企业</el-button></div>
|
@click="causeAdd"> <img src="@/assets/MenuIcon/u241.png" style="margin-right: 10px;"> 新增组织</el-button></div>
|
||||||
<el-tree :class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" v-loading="treeloading"
|
<el-tree :class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" v-loading="treeloading"
|
||||||
ref="treeRef" node-key="id" :data="treedata" :highlight-current="true" :props="defaultProps"
|
ref="treeRef" node-key="id" :data="treedata" :highlight-current="true" :props="defaultProps"
|
||||||
@node-click="handleNodeClick" style="height: calc(100vh - 215px); overflow: auto">
|
@node-click="handleNodeClick" style="height: calc(100vh - 215px); overflow: auto">
|
||||||
@ -475,25 +475,25 @@ const vMove = {
|
|||||||
<el-button type="primary" style="padding: 10px 15px" @click="confirmClick(infoForm)">确定</el-button>
|
<el-button type="primary" style="padding: 10px 15px" @click="confirmClick(infoForm)">确定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!-- 企业弹框-->
|
<!-- 组织弹框-->
|
||||||
<el-dialog v-model="dialogCause" :before-close="handleClose" :title="title" draggable width="620px">
|
<el-dialog v-model="dialogCause" :before-close="handleClose" :title="title" draggable width="620px">
|
||||||
<el-form ref="causeForm" :model="causeInfo" label-width="90px" :rules="rules">
|
<el-form ref="causeForm" :model="causeInfo" label-width="90px" :rules="rules">
|
||||||
<el-form-item label="企业编号" prop="orgcode">
|
<el-form-item label="组织编号" prop="orgcode">
|
||||||
<el-input v-model="causeInfo.orgcode" style="width: 100%" :disabled="true"></el-input>
|
<el-input v-model="causeInfo.orgcode" style="width: 100%" :disabled="true"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="企业名称" prop="orgname">
|
<el-form-item label="组织名称" prop="orgname">
|
||||||
<el-input v-model="causeInfo.orgname" style="width: 100%" placeholder="请输入企业名称"></el-input>
|
<el-input v-model="causeInfo.orgname" style="width: 100%" placeholder="请输入组织名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="负责人" prop="manager">
|
<el-form-item label="负责人" prop="manager">
|
||||||
<el-input v-model="causeInfo.manager" style="width: 100%" placeholder="请输入负责人姓名"> </el-input>
|
<el-input v-model="causeInfo.manager" style="width: 100%" placeholder="请输入负责人姓名"> </el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="企业描述" prop="description">
|
<el-form-item label="组织描述" prop="description">
|
||||||
<el-input v-model="causeInfo.description" type="textarea" :autosize="{ minRows: 2 }" style="width: 100%"
|
<el-input v-model="causeInfo.description" type="textarea" :autosize="{ minRows: 2 }" style="width: 100%"
|
||||||
placeholder="请输入企业描述"></el-input>
|
placeholder="请输入组织描述"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="联系信息" prop="custom1">
|
<el-form-item label="联系信息" prop="custom1">
|
||||||
<el-input v-model="causeInfo.custom1" type="textarea" :autosize="{ minRows: 2 }" style="width: 100%"
|
<el-input v-model="causeInfo.custom1" type="textarea" :autosize="{ minRows: 2 }" style="width: 100%"
|
||||||
placeholder="请输入企业联系信息"></el-input>
|
placeholder="请输入组织联系信息"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
|
@ -137,10 +137,10 @@ function handleNodeClick(row: any) {
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
// 系统配置 / 用户配置 - 切换
|
// 系统配置 / 用户配置 - 切换
|
||||||
function activeNameChange(name: any) {
|
// function activeNameChange(name: any) {
|
||||||
activeName.value = name.props.name
|
// activeName.value = name.props.name
|
||||||
getTree()
|
// getTree()
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 新增字典
|
// 新增字典
|
||||||
function dictAdd() {
|
function dictAdd() {
|
||||||
@ -389,18 +389,18 @@ const total = ref()
|
|||||||
<template>
|
<template>
|
||||||
<div class="faulttemplate-box">
|
<div class="faulttemplate-box">
|
||||||
<aside id="silderLeft">
|
<aside id="silderLeft">
|
||||||
<el-tabs :class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" v-model="activeName"
|
<!-- <el-tabs :class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" v-model="activeName"
|
||||||
class="demo-tabs" @tab-click="activeNameChange">
|
class="demo-tabs" @tab-click="activeNameChange">
|
||||||
<el-tab-pane label="系统配置" name="00"></el-tab-pane>
|
<el-tab-pane label="系统配置" name="00"></el-tab-pane>
|
||||||
<el-tab-pane label="用户配置" name="01"></el-tab-pane>
|
<el-tab-pane label="用户配置" name="01"></el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs> -->
|
||||||
<div class="menu-box">
|
<div class="menu-box">
|
||||||
<el-button style="border:1px solid #0099FF;width:100%;color:#0099FF;margin-bottom:10px;" @click="dictAdd"> <img
|
<el-button style="border:1px solid #0099FF;width:100%;color:#0099FF;margin-bottom:10px;" @click="dictAdd"> <img
|
||||||
src="@/assets/MenuIcon/czan_xz.png" alt="" style="width: 14px; margin-right: 5px;"> 新增字典</el-button>
|
src="@/assets/MenuIcon/czan_xz.png" alt="" style="width: 14px; margin-right: 5px;"> 新增字典</el-button>
|
||||||
<el-tree v-loading="treeloading" ref="treeRef"
|
<el-tree v-loading="treeloading" ref="treeRef"
|
||||||
:class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" node-key="id"
|
:class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" node-key="id"
|
||||||
:allow-drop="allowDrop" :data="treedata" draggable :highlight-current="true" :props="defaultProps"
|
:allow-drop="allowDrop" :data="treedata" draggable :highlight-current="true" :props="defaultProps"
|
||||||
@node-click="handleNodeClick" @node-drop="treenodeDrop" style="height:calc(100vh - 254px);overflow: auto;">
|
@node-click="handleNodeClick" @node-drop="treenodeDrop" style="height:calc(79vh);overflow: auto;">
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<span class="custom-tree-node">
|
<span class="custom-tree-node">
|
||||||
<span class="custom-tree-node-img">
|
<span class="custom-tree-node-img">
|
||||||
|
@ -52,7 +52,8 @@ const infoForm = ref();
|
|||||||
const treeloading = ref(true)
|
const treeloading = ref(true)
|
||||||
function getTree() {
|
function getTree() {
|
||||||
const params = {
|
const params = {
|
||||||
parentid: "0",
|
parentid:'0',
|
||||||
|
params:queryName.value
|
||||||
};
|
};
|
||||||
getTreelist(params).then((res: any) => {
|
getTreelist(params).then((res: any) => {
|
||||||
treedata.value = res
|
treedata.value = res
|
||||||
@ -68,14 +69,13 @@ function getTree() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
const currentNodeKey = ref("")
|
|
||||||
const institutionId = ref('')
|
|
||||||
function handleNodeClick(data: Tree, node: any) {
|
function handleNodeClick(data: Tree, node: any) {
|
||||||
|
|
||||||
institutionId.value = data.id
|
// institutionId.value = data.id
|
||||||
|
orgId.value = data.id;
|
||||||
getdata();
|
getdata();
|
||||||
// if (data.childList.length == 0) {
|
// if (data.childList.length == 0) {
|
||||||
// orgId.value = data.id;
|
//
|
||||||
// dialog.value = true
|
// dialog.value = true
|
||||||
// getdata();
|
// getdata();
|
||||||
// } else {
|
// } else {
|
||||||
@ -119,25 +119,26 @@ function addClick() {
|
|||||||
const multipleSelection = ref([]);
|
const multipleSelection = ref([]);
|
||||||
const tableData = ref([]);
|
const tableData = ref([]);
|
||||||
const orgId = ref("");
|
const orgId = ref("");
|
||||||
|
const dataloading = ref(false)
|
||||||
//获取用户列表信息
|
//获取用户列表信息
|
||||||
function getdata() {
|
function getdata() {
|
||||||
const params = {
|
const params = {
|
||||||
current: queryParams.value.current,
|
current: queryParams.value.current,
|
||||||
size: queryParams.value.size,
|
size: queryParams.value.size,
|
||||||
orgid: orgId.value,
|
orgid: orgId.value,
|
||||||
institutionId: institutionId.value,
|
nickname: queryParams.value.querystr,
|
||||||
username: queryParams.value.querystr,
|
|
||||||
}
|
}
|
||||||
loading.value = true;
|
dataloading.value = true
|
||||||
gettableData(params).then((res => {
|
gettableData(params).then((res => {
|
||||||
|
dataloading.value = false
|
||||||
total.value = res.data.total
|
total.value = res.data.total
|
||||||
tableData.value = res.data.records
|
tableData.value = res.data.records
|
||||||
queryParams.value.size = res.data.size
|
queryParams.value.size = res.data.size
|
||||||
queryParams.value.current = res.data.current
|
queryParams.value.current = res.data.current
|
||||||
dialog.value = true
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
})).catch(() => {
|
})).catch(() => {
|
||||||
loading.value = false;
|
dataloading.value = false;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//禁用启用
|
//禁用启用
|
||||||
@ -221,7 +222,6 @@ function confirmClick(formEl: any) {
|
|||||||
email: info.value.email,
|
email: info.value.email,
|
||||||
phone: info.value.phone,
|
phone: info.value.phone,
|
||||||
orgid: orgId.value,
|
orgid: orgId.value,
|
||||||
institutionId: info.value.institution_id,
|
|
||||||
institutionType: info.value.institution_type
|
institutionType: info.value.institution_type
|
||||||
};
|
};
|
||||||
const roleids = String(info.value.roleinfo)
|
const roleids = String(info.value.roleinfo)
|
||||||
@ -241,7 +241,6 @@ function confirmClick(formEl: any) {
|
|||||||
email: info.value.email,
|
email: info.value.email,
|
||||||
phone: info.value.phone,
|
phone: info.value.phone,
|
||||||
orgid: orgId.value,
|
orgid: orgId.value,
|
||||||
institutionId: info.value.institution_id,
|
|
||||||
institutionType: info.value.institution_type
|
institutionType: info.value.institution_type
|
||||||
};
|
};
|
||||||
const roleids = info.value.roleinfo;
|
const roleids = info.value.roleinfo;
|
||||||
@ -476,7 +475,7 @@ const queryName = ref('')
|
|||||||
<template>
|
<template>
|
||||||
<div class="faulttemplate-box">
|
<div class="faulttemplate-box">
|
||||||
<aside id="silderLeft">
|
<aside id="silderLeft">
|
||||||
<el-input v-model="queryName" clearable @keydown.enter="getTree()" placeholder="组织名称">
|
<el-input v-model="queryName" clearable @change="getTree()" placeholder="部门名称">
|
||||||
<template #append>
|
<template #append>
|
||||||
<el-button type="primary" :icon="Search" @click="getTree()" />
|
<el-button type="primary" :icon="Search" @click="getTree()" />
|
||||||
</template>
|
</template>
|
||||||
@ -513,7 +512,7 @@ const queryName = ref('')
|
|||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table :data="tableData" style="width: 100%;margin-bottom: 20px;height: calc(100vh - 250px);" row-key="id"
|
<el-table :data="tableData" style="width: 100%;margin-bottom: 20px;height: calc(100vh - 250px);" row-key="id"
|
||||||
border default-expand-all :v-loading="dialog" @selection-change="handleSelectionChange"
|
border default-expand-all v-loading="dataloading" @selection-change="handleSelectionChange"
|
||||||
:header-cell-style="{ background: 'rgb(250 250 250)', color: ' #383838', height: '50px' }">
|
:header-cell-style="{ background: 'rgb(250 250 250)', color: ' #383838', height: '50px' }">
|
||||||
<el-table-column type="selection" width="50" align="center" />
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
<el-table-column type="index" label="序号" width="70" align="center" />
|
<el-table-column type="index" label="序号" width="70" align="center" />
|
||||||
@ -521,16 +520,13 @@ const queryName = ref('')
|
|||||||
<!-- <el-table-column prop="avatar" label="头像"></el-table-column> -->
|
<!-- <el-table-column prop="avatar" label="头像"></el-table-column> -->
|
||||||
<el-table-column prop="email" label="邮箱"></el-table-column>
|
<el-table-column prop="email" label="邮箱"></el-table-column>
|
||||||
<el-table-column prop="phone" label="手机号" min-width="90"></el-table-column>
|
<el-table-column prop="phone" label="手机号" min-width="90"></el-table-column>
|
||||||
<el-table-column prop="username" label="登录账号" width="120"></el-table-column>
|
<el-table-column prop="username" label="登录账号" ></el-table-column>
|
||||||
<!-- <el-table-column prop="custom1" label="登录账号"></el-table-column> -->
|
<!-- <el-table-column prop="custom1" label="登录账号"></el-table-column> -->
|
||||||
<el-table-column prop="rolename" label="所属角色" width="210">
|
<el-table-column prop="rolename" label="所属角色" width="210">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-for="(item, index) in scope.row.roles" :key="index">{{ item.rolename }} <span></span> </span>
|
<span v-for="(item, index) in scope.row.roles" :key="index">{{ item.rolename }} <span></span> </span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="institution_name" label="所属机构" min-width="90"></el-table-column>
|
|
||||||
|
|
||||||
|
|
||||||
<el-table-column prop="status" label="账号状态" align="center" width="120">
|
<el-table-column prop="status" label="账号状态" align="center" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch v-model="scope.row.status" active-value="1" inactive-value="0" @change="switchChange(scope.row)"
|
<el-switch v-model="scope.row.status" active-value="1" inactive-value="0" @change="switchChange(scope.row)"
|
||||||
@ -581,21 +577,12 @@ const queryName = ref('')
|
|||||||
<el-input v-model="info.username" style="width: 100%" placeholder="请输入登录账号"></el-input>
|
<el-input v-model="info.username" style="width: 100%" placeholder="请输入登录账号"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属角色">
|
<el-form-item label="所属角色">
|
||||||
<el-select v-model="info.roleinfo" placeholder=" " style="width: 100%" multiple :disabled="isRoles == true"
|
<el-select v-model="info.roleinfo" placeholder="请选择所属角色" style="width: 100%" multiple :disabled="isRoles == true"
|
||||||
filterable>
|
filterable>
|
||||||
<el-option v-for="item in rolesdata" :key="item.id" :label="item.rolename" :value="item.id" />
|
<el-option v-for="item in rolesdata" :key="item.id" :label="item.rolename" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="组织机构" v-if="isRoles == false">
|
|
||||||
<el-input v-if="userInfo.level == '1'" v-model="info.institution_name" autocomplete="off"
|
|
||||||
placeholder="请选择所属机构" disabled style="width: 390px;" />
|
|
||||||
<el-button v-if="userInfo.level == '1'" type="primary" class="ml-[5px]"
|
|
||||||
@click="viewInstitution">选择</el-button>
|
|
||||||
<el-select v-if="userInfo.level != '1'" v-model="info.institution_id" placeholder="请选择所属机构"
|
|
||||||
style="width: 100%" @change="institutionClick">
|
|
||||||
<el-option v-for="item in userInfo.list" :key="item.id" :label="item.name" :value="item.id" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<span class="dialog-footer"
|
<span class="dialog-footer"
|
||||||
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
|
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
|
||||||
|
@ -28,7 +28,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
|
|||||||
//线上API地址
|
//线上API地址
|
||||||
//target: 'https://edu.mmhyvision.com:8443',
|
//target: 'https://edu.mmhyvision.com:8443',
|
||||||
// 本地API地址
|
// 本地API地址
|
||||||
target: 'http://192.168.1.40:8087',
|
target: 'http://192.168.1.208:8087',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: path =>
|
rewrite: path =>
|
||||||
path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
|
path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
|
||||||
|
Loading…
Reference in New Issue
Block a user