联调台账变更推送
This commit is contained in:
@@ -3,107 +3,149 @@
|
||||
<TableHeader datePicker ref="header">
|
||||
<template v-slot:select>
|
||||
<el-form-item label="统计类型">
|
||||
<el-select v-model="tableStore.table.params.statisticalType" value-key="id" placeholder="请选择统计类型">
|
||||
<el-select
|
||||
v-model="tableStore.table.params.statisticalType"
|
||||
value-key="id"
|
||||
placeholder="请选择统计类型"
|
||||
>
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-DataAnalysis"
|
||||
@click="rankingClick(null, true)">排名前10监测点</el-button>
|
||||
<el-button type="primary" icon="el-icon-DataAnalysis" @click="rankingClick(null, true)">
|
||||
排名前10监测点
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<div v-loading="tableStore.table.loading" class="pr10">
|
||||
<el-row>
|
||||
<el-col :span="12" class="pd10">
|
||||
<el-tag style="background: #339966;" class="tag" size="small">1级</el-tag>
|
||||
<span style="color: #339966;" class="text">:无污染(0,1]</span>
|
||||
<el-tag style="background: #3399ff;" class="tag" size="small">2级</el-tag>
|
||||
<span style="color: #3399ff;" class="text">:轻微污染(1,1.2]</span>
|
||||
<el-tag style="background: #ffcc33;" class="tag" size="small">3级</el-tag>
|
||||
<span style="color: #ffcc33;" class="text">:轻度污染(1.2,1.6]</span>
|
||||
<el-tag style="background: #ff9900;" class="tag" size="small">4级</el-tag>
|
||||
<span style="color: #ff9900;" class="text">:中度污染(1.6,2]</span>
|
||||
<el-tag style="background: #cc0000;" class="tag" size="small">5级</el-tag>
|
||||
<span style="color: #cc0000;" class="text">:重度污染(2,+∞)</span>
|
||||
<el-tag style="background: #339966" class="tag" size="small">1级</el-tag>
|
||||
<span style="color: #339966" class="text">:无污染(0,1]</span>
|
||||
<el-tag style="background: #3399ff" class="tag" size="small">2级</el-tag>
|
||||
<span style="color: #3399ff" class="text">:轻微污染(1,1.2]</span>
|
||||
<el-tag style="background: #ffcc33" class="tag" size="small">3级</el-tag>
|
||||
<span style="color: #ffcc33" class="text">:轻度污染(1.2,1.6]</span>
|
||||
<el-tag style="background: #ff9900" class="tag" size="small">4级</el-tag>
|
||||
<span style="color: #ff9900" class="text">:中度污染(1.6,2]</span>
|
||||
<el-tag style="background: #cc0000" class="tag" size="small">5级</el-tag>
|
||||
<span style="color: #cc0000" class="text">:重度污染(2,+∞)</span>
|
||||
<div :style="{ height: layout.height }" style="overflow-y: auto" class="mt10">
|
||||
<div class=" cardBox">
|
||||
<div class="cardBox">
|
||||
<el-card v-for="(item, index) in tableStore.table.data" :key="index">
|
||||
<template #header>
|
||||
<div style="cursor: pointer;" @click="queryline(item, false)">
|
||||
<el-tag v-if="item.data == 3.14159 || item.data == 0"
|
||||
style="background: #ccc; color: #fff" size="small">
|
||||
<div style="cursor: pointer" @click="queryline(item, false)">
|
||||
<el-tag
|
||||
v-if="item.data == 3.14159 || item.data == 0"
|
||||
style="background: #ccc; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
无
|
||||
</el-tag>
|
||||
<el-tag v-if="0 < item.data && item.data < 1 && item.data !== 3.14159"
|
||||
style="background: #339966; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="0 < item.data && item.data < 1 && item.data !== 3.14159"
|
||||
style="background: #339966; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
1级
|
||||
</el-tag>
|
||||
<el-tag v-if="1 <= item.data && item.data < 1.2 && item.data !== 3.14159"
|
||||
style="background: #3399ff; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="1 <= item.data && item.data < 1.2 && item.data !== 3.14159"
|
||||
style="background: #3399ff; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
2级
|
||||
</el-tag>
|
||||
<el-tag v-if="1.2 <= item.data && item.data < 1.6 && item.data !== 3.14159"
|
||||
style="background: #ffcc33; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="1.2 <= item.data && item.data < 1.6 && item.data !== 3.14159"
|
||||
style="background: #ffcc33; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
3级
|
||||
</el-tag>
|
||||
<el-tag v-if="1.6 <= item.data && item.data < 2 && item.data !== 3.14159"
|
||||
style="background: #ff9900; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="1.6 <= item.data && item.data < 2 && item.data !== 3.14159"
|
||||
style="background: #ff9900; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
4级
|
||||
</el-tag>
|
||||
<el-tag v-if="2 <= item.data && item.data && item.data !== 3.14159"
|
||||
style="background: #cc0000; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="2 <= item.data && item.data && item.data !== 3.14159"
|
||||
style="background: #cc0000; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
5级
|
||||
</el-tag>
|
||||
<span>{{ item.name }}</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
<div class="card-content">
|
||||
<div class="card-item" v-for="(item1, index1) in item.children" :key="index1"
|
||||
@click="queryline(item1, true)">
|
||||
<el-tag v-if="item1.data == 3.14159 || item1.data == 0"
|
||||
style="background: #ccc; color: #fff" size="small">
|
||||
<div
|
||||
class="card-item"
|
||||
v-for="(item1, index1) in item.children"
|
||||
:key="index1"
|
||||
@click="queryline(item1, true)"
|
||||
>
|
||||
<el-tag
|
||||
v-if="item1.data == 3.14159 || item1.data == 0"
|
||||
style="background: #ccc; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
无
|
||||
</el-tag>
|
||||
<el-tag v-if="0 < item1.data && item1.data < 1 && item1.data !== 3.14159"
|
||||
style="background: #339966; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="0 < item1.data && item1.data < 1 && item1.data !== 3.14159"
|
||||
style="background: #339966; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
1级
|
||||
</el-tag>
|
||||
<el-tag v-if="1 <= item1.data && item1.data < 1.2 && item1.data !== 3.14159"
|
||||
style="background: #3399ff; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="1 <= item1.data && item1.data < 1.2 && item1.data !== 3.14159"
|
||||
style="background: #3399ff; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
2级
|
||||
</el-tag>
|
||||
<el-tag v-if="1.2 <= item1.data && item1.data < 1.6 && item1.data !== 3.14159"
|
||||
style="background: #ffcc33; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="1.2 <= item1.data && item1.data < 1.6 && item1.data !== 3.14159"
|
||||
style="background: #ffcc33; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
3级
|
||||
</el-tag>
|
||||
<el-tag v-if="1.6 <= item1.data && item1.data < 2 && item1.data !== 3.14159"
|
||||
style="background: #ff9900; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="1.6 <= item1.data && item1.data < 2 && item1.data !== 3.14159"
|
||||
style="background: #ff9900; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
4级
|
||||
</el-tag>
|
||||
<el-tag v-if="2 <= item1.data && item1.data && item1.data !== 3.14159"
|
||||
style="background: #cc0000; color: #fff" size="small">
|
||||
<el-tag
|
||||
v-if="2 <= item1.data && item1.data && item1.data !== 3.14159"
|
||||
style="background: #cc0000; color: #fff"
|
||||
size="small"
|
||||
>
|
||||
5级
|
||||
</el-tag>
|
||||
<span class="xdf">
|
||||
<el-tooltip :show-arrow="false" :offset="-0" :content="item1.name"
|
||||
popper-class="atooltip" placement="bottom-start">
|
||||
|
||||
<el-tooltip
|
||||
:show-arrow="false"
|
||||
:offset="-0"
|
||||
:content="item1.name"
|
||||
popper-class="atooltip"
|
||||
placement="bottom-start"
|
||||
>
|
||||
<div class="tooltipText">
|
||||
{{ item1.name }}
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -111,61 +153,54 @@
|
||||
<my-echart class="tall" :options="echartList" />
|
||||
<div class="tall">
|
||||
<vxe-table height="auto" auto-resize :data="tableStore.table.data" v-bind="defaultAttribute">
|
||||
|
||||
<vxe-column field="name" title="名称"></vxe-column>
|
||||
<vxe-column field="zc" title="污染值">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.data == 3.14159" style="color: #000;">
|
||||
暂无数据
|
||||
</span>
|
||||
<span v-if="scope.row.data !== 3.14159" style="color: #000;">
|
||||
<span v-if="scope.row.data == 3.14159" style="color: #000">暂无数据</span>
|
||||
<span v-if="scope.row.data !== 3.14159" style="color: #000">
|
||||
{{ scope.row.data }}
|
||||
</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="zd" title="评估">
|
||||
<template #default="scope">
|
||||
<span v-if="
|
||||
0 <= scope.row.data &&
|
||||
scope.row.data < 1 &&
|
||||
scope.row.data !== 3.14159
|
||||
" style=" font-weight: bold;color: #339966;">
|
||||
<span
|
||||
v-if="0 <= scope.row.data && scope.row.data < 1 && scope.row.data !== 3.14159"
|
||||
style="font-weight: bold; color: #339966"
|
||||
>
|
||||
无污染
|
||||
</span>
|
||||
<span v-if="
|
||||
1 <= scope.row.data &&
|
||||
scope.row.data < 1.2 &&
|
||||
scope.row.data !== 3.14159
|
||||
" style=" font-weight: bold;color: #3399ff;">
|
||||
<span
|
||||
v-if="1 <= scope.row.data && scope.row.data < 1.2 && scope.row.data !== 3.14159"
|
||||
style="font-weight: bold; color: #3399ff"
|
||||
>
|
||||
轻微污染
|
||||
</span>
|
||||
<span v-if="
|
||||
1.2 <= scope.row.data &&
|
||||
scope.row.data < 1.6 &&
|
||||
scope.row.data !== 3.14159
|
||||
" style=" font-weight: bold;color: #ffcc33;">
|
||||
<span
|
||||
v-if="
|
||||
1.2 <= scope.row.data && scope.row.data < 1.6 && scope.row.data !== 3.14159
|
||||
"
|
||||
style="font-weight: bold; color: #ffcc33"
|
||||
>
|
||||
轻度污染
|
||||
</span>
|
||||
<span v-if="
|
||||
1.6 <= scope.row.data &&
|
||||
scope.row.data < 2 &&
|
||||
scope.row.data !== 3.14159
|
||||
" style=" font-weight: bold;color: #ff9900;">
|
||||
<span
|
||||
v-if="1.6 <= scope.row.data && scope.row.data < 2 && scope.row.data !== 3.14159"
|
||||
style="font-weight: bold; color: #ff9900"
|
||||
>
|
||||
中度污染
|
||||
</span>
|
||||
<span v-if="
|
||||
2 <= scope.row.data && scope.row.data && scope.row.data !== 3.14159
|
||||
" style=" font-weight: bold;color: #cc0000;">
|
||||
<span
|
||||
v-if="2 <= scope.row.data && scope.row.data && scope.row.data !== 3.14159"
|
||||
style="font-weight: bold; color: #cc0000"
|
||||
>
|
||||
重度污染
|
||||
</span>
|
||||
<span v-if="scope.row.data == 3.14159" style="color: #000;">
|
||||
暂无评估
|
||||
</span>
|
||||
<span v-if="scope.row.data == 3.14159" style="color: #000">暂无评估</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
@@ -196,7 +231,14 @@ const provinceDetailsRef = ref()
|
||||
const rankingRef = ref()
|
||||
|
||||
const header = ref()
|
||||
const options = dictData.getBasicData('Pollution_Statis', ['I_Neg', 'V_Inharm', 'V_Dev', 'V_Unbalance', 'Plt', 'Freq_Dev'])
|
||||
const options = dictData.getBasicData('Pollution_Statis', [
|
||||
'I_Neg',
|
||||
'V_Inharm',
|
||||
'V_Dev',
|
||||
'V_Unbalance',
|
||||
'Plt',
|
||||
'Freq_Dev'
|
||||
])
|
||||
const tableStore = new TableStore({
|
||||
url: '/harmonic-boot/PollutionSubstation/deptSubstationRelations',
|
||||
method: 'POST',
|
||||
@@ -204,10 +246,6 @@ const tableStore = new TableStore({
|
||||
loadCallback: () => {
|
||||
histogram(tableStore.table.data)
|
||||
header.value.areaRef.change()
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
provide('tableStore', tableStore)
|
||||
@@ -219,9 +257,6 @@ tableStore.table.params.powerFlag = 2
|
||||
tableStore.table.params.reportFlag = 3
|
||||
tableStore.table.params.serverName = 'event-boot'
|
||||
|
||||
|
||||
|
||||
|
||||
// 地图数处理
|
||||
const rankingClick = () => {
|
||||
rankingRef.value.open(tableStore.table.params)
|
||||
@@ -233,7 +268,7 @@ const queryline = (row: any, flag: boolean) => {
|
||||
// 表格数据处理
|
||||
// 柱状图数据处理
|
||||
const histogram = (res: any) => {
|
||||
console.log(123);
|
||||
console.log(123)
|
||||
|
||||
echartList.value = {
|
||||
title: {
|
||||
@@ -245,7 +280,23 @@ const histogram = (res: any) => {
|
||||
var tips = ''
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
tips += params[i].name + '</br/>'
|
||||
tips += '监测点数' + ':' + ' ' + ' ' + (params[i].value == 0.14159 ? '暂无数据' : params[i].value) + '</br/>'
|
||||
tips +=
|
||||
'监测等级' +
|
||||
':' +
|
||||
' ' +
|
||||
' ' +
|
||||
(params[i].value == 0.14159
|
||||
? '无污染'
|
||||
: params[i].value < 1
|
||||
? '无污染'
|
||||
: params[i].value < 1.2
|
||||
? '轻微污染'
|
||||
: params[i].value < 1.6
|
||||
? '轻度污染'
|
||||
: params[i].value < 2
|
||||
? '中度污染'
|
||||
: '重度污染') +
|
||||
'</br/>'
|
||||
}
|
||||
return tips
|
||||
}
|
||||
@@ -256,7 +307,7 @@ const histogram = (res: any) => {
|
||||
data: res.map((item: any) => item.name)
|
||||
},
|
||||
yAxis: {
|
||||
name: '等级',// 给X轴加单位
|
||||
name: '等级', // 给X轴加单位
|
||||
min: 0,
|
||||
max: 2,
|
||||
interval: 0.2,
|
||||
@@ -282,14 +333,13 @@ const histogram = (res: any) => {
|
||||
}
|
||||
return texts
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
options: {
|
||||
dataZoom: null,
|
||||
series: [
|
||||
{
|
||||
|
||||
type: 'bar',
|
||||
data: res.map((item: any) => {
|
||||
return item.data == 3.14159 ? 0.14159 : item.data
|
||||
@@ -482,8 +532,7 @@ const histogram = (res: any) => {
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -514,7 +563,6 @@ const layout1 = mainHeight(93) as any
|
||||
}
|
||||
|
||||
:deep(.cardBox) {
|
||||
|
||||
box-sizing: border-box;
|
||||
overflow: auto;
|
||||
display: grid;
|
||||
@@ -527,8 +575,6 @@ const layout1 = mainHeight(93) as any
|
||||
background-image: linear-gradient(var(--el-color-primary), var(--el-color-primary-light-3));
|
||||
font-weight: bold;
|
||||
|
||||
|
||||
|
||||
.el-card__header {
|
||||
padding: 10px !important;
|
||||
color: #fff;
|
||||
@@ -537,7 +583,6 @@ const layout1 = mainHeight(93) as any
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.el-card__body {
|
||||
@@ -557,7 +602,6 @@ const layout1 = mainHeight(93) as any
|
||||
width: 50%;
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
|
||||
.xdf {
|
||||
@@ -573,11 +617,8 @@ const layout1 = mainHeight(93) as any
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-left: 5px;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
<template>
|
||||
<div class="class-compopnents">
|
||||
<!-- 容器用于放置所有课程分类 -->
|
||||
<div class="class-container">
|
||||
<!-- 循环生成可拖拽的课程分类 -->
|
||||
<div
|
||||
v-for="(item, index) in classTypeList"
|
||||
class="class-type"
|
||||
:key="index"
|
||||
:style="{ 'background-color': item.color }"
|
||||
:draggable="item.draggable"
|
||||
@dragstart="onDragStart(index)"
|
||||
@dragover.prevent="() => onDragOver(index)"
|
||||
@dragend="onDragEnd"
|
||||
:class="{ dragging: draggingIndex === index }"
|
||||
>
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="course-schedule-container">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in classScheduleCardList" :key="index">
|
||||
<td
|
||||
v-for="(v, i) in item.courseList"
|
||||
:key="i"
|
||||
:parentIndex="index"
|
||||
@dragstart="e => tdDragStart(index, i, e)"
|
||||
@dragover.prevent="e => tdDragOver(index, i, e)"
|
||||
@dragleave="e => tdDragleave(index, i, e)"
|
||||
@dragend="e => tdDragend(index, i, e)"
|
||||
:draggable="v && v.draggable"
|
||||
:style="{
|
||||
'background-color': v ? v.color : '#fff',
|
||||
width: '150px',
|
||||
cursor: 'grab'
|
||||
}"
|
||||
>
|
||||
<div class="course-name">
|
||||
<span class="title notSelect">
|
||||
{{ v ? v.name : '' }}
|
||||
</span>
|
||||
<div class="remove" v-if="v" @click.stop="() => remove(index, i)">+</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
// 定义课程分类数据
|
||||
const classTypeList = ref([
|
||||
{ name: 'A1', color: '#8dedfb', draggable: true },
|
||||
{ name: 'A2', color: '#f1957b', draggable: true },
|
||||
{ name: 'A3', color: '#f6f1a9', draggable: true },
|
||||
{ name: 'A4', color: '#8cdb27', draggable: true },
|
||||
{ name: 'B1', color: '#d3dc28', draggable: true },
|
||||
{ name: 'B2', color: '#e5b46f', draggable: true },
|
||||
{ name: 'B3', color: '#656ef9', draggable: true },
|
||||
{ name: 'B4', color: '#f6efa1', draggable: true }
|
||||
])
|
||||
|
||||
const classScheduleCardList = ref<any>([
|
||||
{
|
||||
courseList: [null, null]
|
||||
},
|
||||
{
|
||||
courseList: [null, null]
|
||||
},
|
||||
{
|
||||
courseList: [null, null]
|
||||
},
|
||||
{
|
||||
courseList: [null, null]
|
||||
},
|
||||
{
|
||||
courseList: [null, null]
|
||||
},
|
||||
{
|
||||
courseList: [null, null]
|
||||
},
|
||||
{
|
||||
courseList: [null, null]
|
||||
},
|
||||
{
|
||||
courseList: [null, null]
|
||||
}
|
||||
])
|
||||
|
||||
// 当前正在拖拽的元素索引
|
||||
const draggingIndex = ref<number | null>(null)
|
||||
|
||||
// 拖拽开始:记录当前拖拽的索引
|
||||
function onDragStart(index: number) {
|
||||
draggingIndex.value = index
|
||||
}
|
||||
|
||||
// 拖拽经过:动态调整拖拽顺序
|
||||
function onDragOver(targetIndex: number) {
|
||||
if (draggingIndex.value !== null && draggingIndex.value !== targetIndex) {
|
||||
// 拖拽元素和目标位置互换
|
||||
const draggedItem = classTypeList.value[draggingIndex.value]
|
||||
classTypeList.value.splice(draggingIndex.value, 1) // 移除拖拽的元素
|
||||
classTypeList.value.splice(targetIndex, 0, draggedItem) // 插入到目标位置
|
||||
draggingIndex.value = targetIndex // 更新拖拽元素的当前索引
|
||||
}
|
||||
}
|
||||
|
||||
// 拖拽结束:清空拖拽状态
|
||||
function onDragEnd() {
|
||||
draggingIndex.value = null
|
||||
currentTDinfo.value = null
|
||||
processCourseData()
|
||||
}
|
||||
|
||||
// 处理课程数据
|
||||
function processCourseData() {
|
||||
// 拖拽结束后, 将课程表进行处理,添加上 自定义删除的标识,避免其他元素移出后,将其置空
|
||||
const list = JSON.parse(JSON.stringify(classScheduleCardList.value))
|
||||
list.forEach((item: any) => {
|
||||
item.courseList.forEach((v: any) => {
|
||||
if (v) v.customDelete = true
|
||||
})
|
||||
})
|
||||
classScheduleCardList.value = list
|
||||
}
|
||||
|
||||
// 拖拽中的 td 元素
|
||||
const dragingTdInfo = ref<any>(null)
|
||||
// 移动到的 td 信息
|
||||
const currentTDinfo = ref<any>(null)
|
||||
|
||||
// td 中开始拖拽拖拽
|
||||
function tdDragStart(parentIndex: number, index: number, e: any) {
|
||||
if (!classScheduleCardList.value[parentIndex].courseList[index]) return
|
||||
const item = JSON.parse(JSON.stringify(classScheduleCardList.value[parentIndex].courseList[index]))
|
||||
item.customDelete = false
|
||||
dragingTdInfo.value = item
|
||||
classScheduleCardList.value[parentIndex].courseList[index] = null
|
||||
}
|
||||
|
||||
// 移动到 td 上触发
|
||||
function tdDragOver(parentIndex: number, index: number, e: any) {
|
||||
currentTDinfo.value = { parentIndex, index }
|
||||
const currentTd = classScheduleCardList.value[parentIndex].courseList[index]
|
||||
if (draggingIndex.value !== null && !currentTd) {
|
||||
const draggedItem = classTypeList.value[draggingIndex.value]
|
||||
// 将对应的课程数据 暂时 放入到td中
|
||||
classScheduleCardList.value[parentIndex].courseList[index] = draggedItem
|
||||
}
|
||||
|
||||
// td 中进行拖拽
|
||||
if (dragingTdInfo.value && !currentTd) {
|
||||
classScheduleCardList.value[parentIndex].courseList[index] = JSON.parse(JSON.stringify(dragingTdInfo.value))
|
||||
}
|
||||
}
|
||||
|
||||
// 课程在 td 上离开
|
||||
function tdDragleave(parentIndex: number, index: number, event: any) {
|
||||
// 检查 relatedTarget 是否在目标元素内
|
||||
const relatedTarget = event.relatedTarget as HTMLElement
|
||||
const isInside = relatedTarget?.closest('td') === event.currentTarget
|
||||
if (!isInside) {
|
||||
// 如果存在课程 return ,只有用户删除之后才可以添加新的课程
|
||||
// 存在 customDelete 删除属性,只能用户主动删除才可以清空,其余情况 拖拽元素移出就 清空
|
||||
const currentTd = classScheduleCardList.value[parentIndex].courseList[index]
|
||||
// 从课程类型中拖拽到 td 中
|
||||
if (draggingIndex.value !== null && currentTd && !currentTd.customDelete) {
|
||||
classScheduleCardList.value[parentIndex].courseList[index] = null
|
||||
}
|
||||
|
||||
// td 中进行拖拽
|
||||
if (dragingTdInfo.value && !dragingTdInfo.value.customDelete && currentTd && !currentTd.customDelete) {
|
||||
classScheduleCardList.value[parentIndex].courseList[index] = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// td中拖拽课程结束
|
||||
function tdDragend(parentIndex: number, index: number, e: any) {
|
||||
const { parentIndex: currentParentIndex, index: currentIndex } = currentTDinfo.value
|
||||
|
||||
const currentTd = classScheduleCardList.value[currentParentIndex].courseList[currentIndex]
|
||||
if (!currentTd) return
|
||||
|
||||
const isSameTd = currentParentIndex === parentIndex && currentIndex === index
|
||||
const tdHasCourses = classScheduleCardList.value[currentParentIndex].courseList[currentIndex].customDelete
|
||||
if (isSameTd || tdHasCourses) {
|
||||
classScheduleCardList.value[parentIndex].courseList[index] = JSON.parse(JSON.stringify(dragingTdInfo.value))
|
||||
}
|
||||
|
||||
dragingTdInfo.value = null
|
||||
currentTDinfo.value = null
|
||||
processCourseData()
|
||||
}
|
||||
|
||||
// 删除
|
||||
function remove(parentIndex: number, index: number) {
|
||||
classScheduleCardList.value[parentIndex].courseList[index] = null
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.class-compopnents {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.class-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 120px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.class-type {
|
||||
width: 50px;
|
||||
padding: 10px 10px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
text-align: center;
|
||||
cursor: grab;
|
||||
|
||||
text-align: center;
|
||||
user-select: none; /* 防止拖拽时选中文字 */
|
||||
transition: transform 0.2s, background-color 0.2s;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.05); /* 鼠标悬浮时的缩放效果 */
|
||||
}
|
||||
}
|
||||
|
||||
/* 正在拖拽的元素样式 */
|
||||
.dragging {
|
||||
opacity: 0.5;
|
||||
transform: scale(1.1); /* 拖拽中的缩放效果 */
|
||||
// background-color: #d3d3d3;
|
||||
}
|
||||
|
||||
.class {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.course-schedule-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 300px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.header-tr {
|
||||
background-color: #f8f8f8;
|
||||
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.notSelect {
|
||||
user-select: none;
|
||||
}
|
||||
.course-name {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
||||
.remove {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
text-align: center;
|
||||
line-height: 20px;
|
||||
position: absolute;
|
||||
top: -20px;
|
||||
right: -20px;
|
||||
font-size: 20px;
|
||||
transform: rotate(45deg);
|
||||
border-radius: 50%;
|
||||
border: 1px solid #000;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid #ccc;
|
||||
border-collapse: collapse; /* 消除双边框效果 */
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -8,6 +8,9 @@
|
||||
<el-tab-pane label="终端在线率图表" name="2">
|
||||
<Echart />
|
||||
</el-tab-pane>
|
||||
<!-- <el-tab-pane label="123" name="3">
|
||||
<aaa />
|
||||
</el-tab-pane> -->
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
@@ -18,6 +21,7 @@ import { onMounted, reactive, ref, getCurrentInstance } from 'vue'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import Table from './components/table.vue'
|
||||
import Echart from './components/echart.vue'
|
||||
import aaa from './components/123.vue'
|
||||
defineOptions({
|
||||
name: 'harmonic-boot/area/OnlineRate'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user