he wei
2025-04-23 b9bd29a1a81f6f7de479e3cc3fdfe3d85fc660bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<template>
  <div class="baoji-group-list">
    <ul>
      <li v-if="list.length == 0">
        <div class="no-data-text">暂无数据</div>
      </li>
      <li class="baoji-group-li" v-for="item in list" :key="item.key">
        <a
          href="javascript:;"
          :class="{'active-item': item.key == activeKey}"
          @click="handleClick(item)"
          >{{item.txt}}</a
        >
        <div class="baoji-group-tools" v-if="showGroupBtn">
          <!-- <el-button
            @click="changeGroup(item)"
            :type="item.dischargePlanFlag?'danger':'primary'"
            size="mini"
            >{{
            item.dischargePlanFlag?'取消班组':'设置班组' }}</el-button
          > -->
        </div>
      </li>
    </ul>
    <!-- 冲突机房显示 -->
    <el-dialog
      title="冲突机房显示"
      width="auto"
      v-model="clashStationDialog"
      :close-on-click-modal="false"
      top="0"
      class="dialog-center"
      :modal-append-to-body="false"
    >
      <clash-station :data="tableData"></clash-station>
    </el-dialog>
  </div>
</template>
 
<script setup name="BaojiGroupList">
// import { dischargeFlag } from "@/api/user.js";
import ClashStation from "./clashStation.vue";
import { ref, h, onMounted } from "vue";
const props = defineProps({
    list: {
        type: Array,
        default: () => []
    },
    showGroupBtn: {
        type: Boolean,
        default: false
    }
});
 
const emit = defineEmits(['handle-click', 'success']);
const activeKey = ref('');
const clashStationDialog = ref(false);
const tableData = ref([]);
 
function handleClick(item) {
    if (activeKey.value != item.key) {
        activeKey.value = item.key;
        emit('handle-click', item);
    }
}
 
function changeGroup(data) {
    let msg = "";
    if (data.dischargePlanFlag) {
        msg = h('p', null, [
            h('span', null, '把'),
            h('span', { style: 'color: teal;font-size:18px' }, data.txt),
            h('span', null, '从班组中'),
            h('span', { style: 'color: teal;font-size:18px' }, "移除"),
            h('span', null, "吗?"),
            h('p', null, "这可能导致生成放电计划的时候跳过该包机组!")
        ]);
    } else {
        msg = h('p', null, [
            h('span', null, '把'),
            h('span', { style: 'color: teal;font-size:18px' }, data.txt),
            h('span', null, '设置为班组吗'),
        ]);
    }
 
    $confirm(msg, () => {
        // handleChangeGroup(data);
    });
}
 
// function handleChangeGroup(data) {
//     let flag = data.dischargePlanFlag ? 0 : 1;
//     let baoJiGroupld = data.baoJiGroupId;
//     dischargeFlag(baoJiGroupld, flag).then(res => {
//         let rs = res.data;
//         if (rs.code == 1 && rs.data) {
//             let msg = data.dischargePlanFlag ? "移除成功" : "设置成功";
//             $message.success(msg);
//             emit('success', true);
//         } else {
//             if (rs.data2) {
//                 $alert("当前包机组与其他班组管理的机房存在冲突,请检查!",
//                     () => {
//                         tableData.value = rs.data2.map(item => {
//                             item.stationName = item.stationName1 + "-" + item.stationName2 + "-" + item.stationName5 + "-" + item.stationName3;
//                             return item;
//                         });
//                         clashStationDialog.value = true;
//                     }
//                 );
//             } else {
//                 $message.error(rs.msg);
//             }
//         }
//     });
// }
 
defineExpose({
  activeKey
});
</script>
 
<style scoped>
.baoji-group-list a {
  display: block;
  padding: 6px 8px;
  text-indent: 10px;
  text-decoration: none;
  color: #FFFFFF;
  font-size: 14px;
}
 
.baoji-group-list a:hover {
  background-color: #214865;
}
 
.baoji-group-list a.active-item {
  background-color: #00fefe;
  color: #021a64;
}
 
.no-data-text {
  padding-top: 18px;
  text-align: center;
}
 
.baoji-group-li {
  position: relative;
}
 
.baoji-group-tools {
  position: absolute;
  top: 0;
  right: 0;
}
</style>