main
kgdxpr 7 months ago
parent c39779fbbb
commit 7d714f1e2e

@ -185,7 +185,7 @@
<label style="width: 74px;text-align: right;margin-right: 10px;">更多筛选:</label>
<div class="layui-input-block"
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="0">新建</option>
<option value="2">续拨</option>

@ -1,169 +1,123 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="UTF-8">
<title>测试</title>
<style>
html,
body {
height: 100%;
margin: 0;
overflow: hidden;
}
.container {
height: calc(100% - 30px);
width: calc(100% - 30px);
margin: 15px;
border: 1px solid red;
overflow: auto;
}
</style>
<meta charset="utf-8">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- style -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vxe-pc-ui@4/lib/style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vxe-table@4/lib/style.css">
<!-- vue -->
<script src="https://cdn.jsdelivr.net/npm/vue@3"></script>
<!-- table -->
<script src="https://cdn.jsdelivr.net/npm/xe-utils"></script>
<script src="https://cdn.jsdelivr.net/npm/vxe-pc-ui@4"></script>
<script src="https://cdn.jsdelivr.net/npm/vxe-table@4"></script>
</head>
<body>
<div class="container">
1<br>1<br>1<br>1<br>1<br>1<br>
<div id="app">
<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>
<script>
const data = [
{
"equipmentId": 1035,
"equipmentName": "驿来特充电站(震宇街海容广场站)-1#",
"equipmentSn": "1002977003955001",
"equipmentType": 1,
"connectorList": [
{
"connectorId": 451006,
"connectorSn": "100297700395500101",
"connectorNo": 1,
"chargeCurStatus": 6,
"plugInCarStatus": 1,
"chargeVolt": 0.0,
"chargeCurr": 0.0,
"electricityMeter": 28230.743,
"ambientTemperature": "0",
"plugTemperature": "24",
"chargeDegree": 0.0,
"chargeCurSoc": 0
},
{
"connectorId": 451007,
"connectorSn": "100297700395500102",
"connectorNo": 2,
"chargeCurStatus": 0,
"plugInCarStatus": 0,
"chargeVolt": 0.0,
"chargeCurr": 0.0,
"electricityMeter": 33503.24,
"ambientTemperature": "0",
"plugTemperature": "21",
"chargeDegree": 28.92,
"chargeCurSoc": 0
(function () {
var App = {
data() {
return {
tableData: [
{ id: 10000, parentId: null, name: 'Test1', type: 'mp3', size: 1024, date: '2020-08-01' },
{ 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' },
{ id: 20045, parentId: 24300, name: 'Test4', type: 'html', size: 600, date: '2021-04-01' },
{ id: 10053, parentId: 24300, name: 'Test5', type: 'avi', size: 0, date: '2021-04-01' },
{ id: 24330, parentId: 10053, name: 'Test6', type: 'txt', size: 25, date: '2021-10-01' },
{ id: 21011, parentId: 10053, name: 'Test7', type: 'pdf', size: 512, date: '2020-01-01' },
{ id: 22200, parentId: 10053, name: 'Test8', type: 'js', size: 1024, date: '2021-06-01' },
{ id: 23666, parentId: null, name: 'Test9', type: 'xlsx', size: 2048, date: '2020-11-01' },
{ id: 23677, parentId: 23666, name: 'Test10', type: 'js', size: 1024, date: '2021-06-01' },
{ id: 23671, parentId: 23677, name: 'Test11', type: 'js', size: 1024, date: '2021-06-01' },
{ id: 23672, parentId: 23677, name: 'Test12', type: 'js', size: 1024, date: '2021-06-01' },
{ id: 23688, parentId: 23666, name: 'Test13', type: 'js', size: 1024, date: '2021-06-01' },
{ id: 23681, parentId: 23688, name: 'Test14', type: 'js', size: 1024, date: '2021-06-01' },
{ 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: {
options: [
[
{ code: 'myExportMenu', name: '导出数据' },
{ code: 'myPrintMenu', name: '打印' },
{ code: 'myLinkMenu', name: '打开官网' }
]
]
},
footer: {
options: [
[
{ code: 'myLinkMenu', name: '打开官网' }
]
]
}
}
}
]
},
{
"equipmentId": 1036,
"equipmentName": "驿来特充电站(震宇街海容广场站)-2#",
"equipmentSn": "1005463003955002",
"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: {
toggleExpandChangeEvent(params) {
const $table = this.$refs.tableRef
if ($table) {
const { row, expanded } = params
console.log('节点展开事件', expanded, '获取父节点:', $table.getParentRow(row))
}
},
{
"connectorId": 451009,
"connectorSn": "100546300395500202",
"connectorNo": 2,
"chargeCurStatus": 0,
"plugInCarStatus": 0,
"chargeVolt": 0.0,
"chargeCurr": 0.0,
"electricityMeter": 29300.452,
"ambientTemperature": "0",
"plugTemperature": "24",
"chargeDegree": 22.52,
"chargeCurSoc": 0
}
]
},
{
"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
getTreeExpansionEvent() {
const $table = this.$refs.tableRef
if ($table) {
const treeExpandRecords = $table.getTreeExpandRecords()
VxeUI.modal.alert(treeExpandRecords.length)
}
},
expandAllEvent() {
const $table = this.$refs.tableRef
if ($table) {
$table.setAllTreeExpand(true)
}
},
clearExpandEvent() {
const $table = this.$refs.tableRef
if ($table) {
$table.clearTreeExpand()
}
}
]
}
}
]
// 过滤函数
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);
Vue.createApp(App).use(VxeUI).use(VXETable).mount('#app')
})()
</script>
</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