main
kgdxpr 7 months ago
parent c39779fbbb
commit 7d714f1e2e

@ -185,7 +185,7 @@
<label style="width: 74px;text-align: right;margin-right: 10px;">更多筛选:</label> <label style="width: 74px;text-align: right;margin-right: 10px;">更多筛选:</label>
<div class="layui-input-block" <div class="layui-input-block"
style="margin: 0 5px 0 0;display: flex;align-items: center;width: 180px;"> style="margin: 0 5px 0 0;display: flex;align-items: center;width: 180px;">
<select id="czlProjectSourceSelect"> <select id="czlProjectSourceSelect" lay-filter="czlPsSelectChange">
<option value="">项目来源</option> <option value="">项目来源</option>
<option value="0">新建</option> <option value="0">新建</option>
<option value="2">续拨</option> <option value="2">续拨</option>

@ -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' },
{ id: 24577, parentId: 24555, name: 'Test18', type: 'js', size: 1024, date: '2021-06-01' }
],
menuConfig: {
header: {
options: [
[
{ code: 'myExportMenu', name: '导出数据' }
]
]
}, },
{ body: {
"connectorId": 451007, options: [
"connectorSn": "100297700395500102", [
"connectorNo": 2, { code: 'myExportMenu', name: '导出数据' },
"chargeCurStatus": 0, { code: 'myPrintMenu', name: '打印' },
"plugInCarStatus": 0, { code: 'myLinkMenu', name: '打开官网' }
"chargeVolt": 0.0, ]
"chargeCurr": 0.0,
"electricityMeter": 33503.24,
"ambientTemperature": "0",
"plugTemperature": "21",
"chargeDegree": 28.92,
"chargeCurSoc": 0
}
] ]
}, },
{ footer: {
"equipmentId": 1036, options: [
"equipmentName": "驿来特充电站(震宇街海容广场站)-2#", [
"equipmentSn": "1005463003955002", { code: 'myLinkMenu', name: '打开官网' }
"equipmentType": 1, ]
"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
}, },
{ methods: {
"connectorId": 451009, toggleExpandChangeEvent(params) {
"connectorSn": "100546300395500202", const $table = this.$refs.tableRef
"connectorNo": 2, if ($table) {
"chargeCurStatus": 0, const { row, expanded } = params
"plugInCarStatus": 0, console.log('节点展开事件', expanded, '获取父节点:', $table.getParentRow(row))
"chargeVolt": 0.0,
"chargeCurr": 0.0,
"electricityMeter": 29300.452,
"ambientTemperature": "0",
"plugTemperature": "24",
"chargeDegree": 22.52,
"chargeCurSoc": 0
} }
]
}, },
{ getTreeExpansionEvent() {
"equipmentId": 4532, const $table = this.$refs.tableRef
"equipmentName": "驿来特充电站(震宇街海容广场站)-4#", if ($table) {
"equipmentSn": "2002410003955004", const treeExpandRecords = $table.getTreeExpandRecords()
"equipmentType": 2, VxeUI.modal.alert(treeExpandRecords.length)
"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
} }
] },
expandAllEvent() {
const $table = this.$refs.tableRef
if ($table) {
$table.setAllTreeExpand(true)
} }
] },
// 过滤函数 clearExpandEvent() {
function filterEquipment(data) { const $table = this.$refs.tableRef
return data.filter(equipment => { if ($table) {
const { connectorList } = equipment; $table.clearTreeExpand()
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(); }
Vue.createApp(App).use(VxeUI).use(VXETable).mount('#app')
})()
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…
Cancel
Save