Merge branch 'main' of http://10.10.14.176:3000/huanghai/QingLong
commit
fe0429dbc3
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,169 +1,123 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="utf-8">
|
||||||
<title>测试</title>
|
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
||||||
<style>
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
html,
|
<!-- style -->
|
||||||
body {
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vxe-pc-ui@4/lib/style.css">
|
||||||
height: 100%;
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vxe-table@4/lib/style.css">
|
||||||
margin: 0;
|
<!-- vue -->
|
||||||
overflow: hidden;
|
<script src="https://cdn.jsdelivr.net/npm/vue@3"></script>
|
||||||
}
|
<!-- table -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/xe-utils"></script>
|
||||||
.container {
|
<script src="https://cdn.jsdelivr.net/npm/vxe-pc-ui@4"></script>
|
||||||
height: calc(100% - 30px);
|
<script src="https://cdn.jsdelivr.net/npm/vxe-table@4"></script>
|
||||||
width: calc(100% - 30px);
|
|
||||||
margin: 15px;
|
|
||||||
border: 1px solid red;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div id="app">
|
||||||
1<br>1<br>1<br>1<br>1<br>1<br>
|
<div>
|
||||||
|
<p>
|
||||||
|
<vxe-button @click="getTreeExpansionEvent">获取已展开</vxe-button>
|
||||||
|
<vxe-button @click="expandAllEvent">展开所有</vxe-button>
|
||||||
|
<vxe-button @click="clearExpandEvent">关闭所有</vxe-button>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<vxe-table border="inner" :max-height="400" :menu-config="menuConfig" ref="tableRef" :column-config="{resizable: true}"
|
||||||
|
:tree-config="{transform: true, rowField: 'id', parentField: 'parentId'}" :data="tableData"
|
||||||
|
@toggle-tree-expand="toggleExpandChangeEvent">
|
||||||
|
<vxe-column field="name" title="Name" tree-node></vxe-column>
|
||||||
|
<vxe-column field="size" title="Size"></vxe-column>
|
||||||
|
<vxe-column field="type" title="Type"></vxe-column>
|
||||||
|
<vxe-column field="date" title="Date"></vxe-column>
|
||||||
|
</vxe-table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const data = [
|
(function () {
|
||||||
{
|
var App = {
|
||||||
"equipmentId": 1035,
|
data() {
|
||||||
"equipmentName": "驿来特充电站(震宇街海容广场站)-1#",
|
return {
|
||||||
"equipmentSn": "1002977003955001",
|
tableData: [
|
||||||
"equipmentType": 1,
|
{ id: 10000, parentId: null, name: 'Test1', type: 'mp3', size: 1024, date: '2020-08-01' },
|
||||||
"connectorList": [
|
{ id: 10050, parentId: null, name: 'Test2', type: 'mp4', size: 0, date: '2021-04-01' },
|
||||||
{
|
{ id: 24300, parentId: 10050, name: 'Test3', type: 'avi', size: 1024, date: '2020-03-01' },
|
||||||
"connectorId": 451006,
|
{ id: 20045, parentId: 24300, name: 'Test4', type: 'html', size: 600, date: '2021-04-01' },
|
||||||
"connectorSn": "100297700395500101",
|
{ id: 10053, parentId: 24300, name: 'Test5', type: 'avi', size: 0, date: '2021-04-01' },
|
||||||
"connectorNo": 1,
|
{ id: 24330, parentId: 10053, name: 'Test6', type: 'txt', size: 25, date: '2021-10-01' },
|
||||||
"chargeCurStatus": 6,
|
{ id: 21011, parentId: 10053, name: 'Test7', type: 'pdf', size: 512, date: '2020-01-01' },
|
||||||
"plugInCarStatus": 1,
|
{ id: 22200, parentId: 10053, name: 'Test8', type: 'js', size: 1024, date: '2021-06-01' },
|
||||||
"chargeVolt": 0.0,
|
{ id: 23666, parentId: null, name: 'Test9', type: 'xlsx', size: 2048, date: '2020-11-01' },
|
||||||
"chargeCurr": 0.0,
|
{ id: 23677, parentId: 23666, name: 'Test10', type: 'js', size: 1024, date: '2021-06-01' },
|
||||||
"electricityMeter": 28230.743,
|
{ id: 23671, parentId: 23677, name: 'Test11', type: 'js', size: 1024, date: '2021-06-01' },
|
||||||
"ambientTemperature": "0",
|
{ id: 23672, parentId: 23677, name: 'Test12', type: 'js', size: 1024, date: '2021-06-01' },
|
||||||
"plugTemperature": "24",
|
{ id: 23688, parentId: 23666, name: 'Test13', type: 'js', size: 1024, date: '2021-06-01' },
|
||||||
"chargeDegree": 0.0,
|
{ id: 23681, parentId: 23688, name: 'Test14', type: 'js', size: 1024, date: '2021-06-01' },
|
||||||
"chargeCurSoc": 0
|
{ id: 23682, parentId: 23688, name: 'Test15', type: 'js', size: 1024, date: '2021-06-01' },
|
||||||
},
|
{ id: 24555, parentId: null, name: 'Test16', type: 'avi', size: 224, date: '2020-10-01' },
|
||||||
{
|
{ id: 24566, parentId: 24555, name: 'Test17', type: 'js', size: 1024, date: '2021-06-01' },
|
||||||
"connectorId": 451007,
|
{ id: 24577, parentId: 24555, name: 'Test18', type: 'js', size: 1024, date: '2021-06-01' }
|
||||||
"connectorSn": "100297700395500102",
|
],
|
||||||
"connectorNo": 2,
|
menuConfig: {
|
||||||
"chargeCurStatus": 0,
|
header: {
|
||||||
"plugInCarStatus": 0,
|
options: [
|
||||||
"chargeVolt": 0.0,
|
[
|
||||||
"chargeCurr": 0.0,
|
{ code: 'myExportMenu', name: '导出数据' }
|
||||||
"electricityMeter": 33503.24,
|
]
|
||||||
"ambientTemperature": "0",
|
]
|
||||||
"plugTemperature": "21",
|
},
|
||||||
"chargeDegree": 28.92,
|
body: {
|
||||||
"chargeCurSoc": 0
|
options: [
|
||||||
|
[
|
||||||
|
{ code: 'myExportMenu', name: '导出数据' },
|
||||||
|
{ code: 'myPrintMenu', name: '打印' },
|
||||||
|
{ code: 'myLinkMenu', name: '打开官网' }
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
options: [
|
||||||
|
[
|
||||||
|
{ code: 'myLinkMenu', name: '打开官网' }
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
},
|
methods: {
|
||||||
{
|
toggleExpandChangeEvent(params) {
|
||||||
"equipmentId": 1036,
|
const $table = this.$refs.tableRef
|
||||||
"equipmentName": "驿来特充电站(震宇街海容广场站)-2#",
|
if ($table) {
|
||||||
"equipmentSn": "1005463003955002",
|
const { row, expanded } = params
|
||||||
"equipmentType": 1,
|
console.log('节点展开事件', expanded, '获取父节点:', $table.getParentRow(row))
|
||||||
"connectorList": [
|
}
|
||||||
{
|
|
||||||
"connectorId": 451008,
|
|
||||||
"connectorSn": "100546300395500201",
|
|
||||||
"connectorNo": 1,
|
|
||||||
"chargeCurStatus": 0,
|
|
||||||
"plugInCarStatus": 0,
|
|
||||||
"chargeVolt": 0.0,
|
|
||||||
"chargeCurr": 0.0,
|
|
||||||
"electricityMeter": 45887.342,
|
|
||||||
"ambientTemperature": "0",
|
|
||||||
"plugTemperature": "23",
|
|
||||||
"chargeDegree": 32.85,
|
|
||||||
"chargeCurSoc": 0
|
|
||||||
},
|
},
|
||||||
{
|
getTreeExpansionEvent() {
|
||||||
"connectorId": 451009,
|
const $table = this.$refs.tableRef
|
||||||
"connectorSn": "100546300395500202",
|
if ($table) {
|
||||||
"connectorNo": 2,
|
const treeExpandRecords = $table.getTreeExpandRecords()
|
||||||
"chargeCurStatus": 0,
|
VxeUI.modal.alert(treeExpandRecords.length)
|
||||||
"plugInCarStatus": 0,
|
}
|
||||||
"chargeVolt": 0.0,
|
},
|
||||||
"chargeCurr": 0.0,
|
expandAllEvent() {
|
||||||
"electricityMeter": 29300.452,
|
const $table = this.$refs.tableRef
|
||||||
"ambientTemperature": "0",
|
if ($table) {
|
||||||
"plugTemperature": "24",
|
$table.setAllTreeExpand(true)
|
||||||
"chargeDegree": 22.52,
|
}
|
||||||
"chargeCurSoc": 0
|
},
|
||||||
}
|
clearExpandEvent() {
|
||||||
]
|
const $table = this.$refs.tableRef
|
||||||
},
|
if ($table) {
|
||||||
{
|
$table.clearTreeExpand()
|
||||||
"equipmentId": 4532,
|
}
|
||||||
"equipmentName": "驿来特充电站(震宇街海容广场站)-4#",
|
|
||||||
"equipmentSn": "2002410003955004",
|
|
||||||
"equipmentType": 2,
|
|
||||||
"connectorList": [
|
|
||||||
{
|
|
||||||
"connectorId": 1506183,
|
|
||||||
"connectorSn": "200241000395500401",
|
|
||||||
"connectorNo": 1,
|
|
||||||
"chargeCurStatus": 0,
|
|
||||||
"plugInCarStatus": 0,
|
|
||||||
"chargeVolt": 239.6,
|
|
||||||
"chargeCurr": 0.0,
|
|
||||||
"electricityMeter": 0.0,
|
|
||||||
"ambientTemperature": "0",
|
|
||||||
"plugTemperature": "0",
|
|
||||||
"chargeDegree": 0.0,
|
|
||||||
"chargeCurSoc": 0
|
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
]
|
Vue.createApp(App).use(VxeUI).use(VXETable).mount('#app')
|
||||||
// 过滤函数
|
})()
|
||||||
function filterEquipment(data) {
|
|
||||||
return data.filter(equipment => {
|
|
||||||
const { connectorList } = equipment;
|
|
||||||
console.log("111111111111111111");
|
|
||||||
console.log(connectorList);
|
|
||||||
console.log("111111111111111111");
|
|
||||||
// 检查连接器列表是否为空
|
|
||||||
if (!connectorList || !connectorList.length) return false;
|
|
||||||
|
|
||||||
// 检查是否有连接器的 chargeCurStatus 为 -1 或 6
|
|
||||||
return connectorList.some(connector => [-1, 6].includes(connector.chargeCurStatus));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 应用过滤
|
|
||||||
// const filteredData = filterEquipment(data);
|
|
||||||
|
|
||||||
// console.log(filteredData);
|
|
||||||
|
|
||||||
|
|
||||||
console.log(11111);
|
|
||||||
|
|
||||||
|
|
||||||
async function fn() {
|
|
||||||
|
|
||||||
await setTimeout(function () {
|
|
||||||
console.log(3333)
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn();
|
|
||||||
|
|
||||||
|
|
||||||
console.log(22222);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
package UnitTest;
|
||||||
|
|
||||||
|
public class test01 {
|
||||||
|
/* 零钱兑换:贪心 */
|
||||||
|
private static int coinChangeGreedy(int[] coins, int amt) {
|
||||||
|
// 假设 coins 列表有序
|
||||||
|
int i = coins.length - 1;
|
||||||
|
int count = 0;
|
||||||
|
// 循环进行贪心选择,直到无剩余金额
|
||||||
|
while (amt > 0) {
|
||||||
|
// 找到小于且最接近剩余金额的硬币
|
||||||
|
while (i > 0 && coins[i] > amt) {
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
// 选择 coins[i]
|
||||||
|
amt -= coins[i];
|
||||||
|
System.out.println(coins[i]);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
// 若未找到可行方案,则返回 -1
|
||||||
|
return amt == 0 ? count : -1;
|
||||||
|
}
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
int[] coins = {1,5,10,20,50,100};
|
||||||
|
System.out.println(coinChangeGreedy(coins,1257));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue