parent
ff30a89ac0
commit
6597337d86
@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>进库药品统计</title>
|
||||
<link rel=" stylesheet" href="./Income-statistics.css">
|
||||
|
||||
|
||||
<body>
|
||||
<div class="cookie-card">
|
||||
<span class="title">进库药品统计</span>
|
||||
</div>
|
||||
<h1></h1>
|
||||
<button class="button2" onclick="pose()">进库记录</button>
|
||||
<h1></h1>
|
||||
<table id="jinku">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>药名</th>
|
||||
<th>药品公司</th>
|
||||
<th>药品公司联系电话</th>
|
||||
<th>数量</th>
|
||||
<th>价格</th>
|
||||
<th>进价</th>
|
||||
<th>时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</head>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
function pose(){
|
||||
const requestBody = {wenti:81,name:"陈永杭"};
|
||||
fetch('http://localhost:3000', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json' // 设置请求头为JSON
|
||||
},
|
||||
body: JSON.stringify(requestBody) // 将请求体转换为JSON字符串
|
||||
})
|
||||
.then(response =>
|
||||
response.json())
|
||||
.then(data => {
|
||||
cuizaied = data;
|
||||
console.log(data);
|
||||
var table = document.getElementById("jinku");
|
||||
for (ii=1;ii<table.rows.length;ii++){
|
||||
var ia = table.rows[ii];
|
||||
ia.innerHTML = '';
|
||||
}
|
||||
|
||||
|
||||
for (i=0;i<data.length;i++){
|
||||
console.log(data[i]);
|
||||
var row = table.insertRow();
|
||||
var cell1 = row.insertCell(0);
|
||||
cell1.innerHTML = data[i].name;
|
||||
var cell2 = row.insertCell(1);
|
||||
cell2.innerHTML = data[i].company;
|
||||
var cell3 = row.insertCell(2);
|
||||
cell3.innerHTML = data[i].phonenumber;
|
||||
var cell4 = row.insertCell(3);
|
||||
cell4.innerHTML = data[i].amount;
|
||||
var cell5 = row.insertCell(4);
|
||||
cell5.innerHTML = data[i].price;
|
||||
var cell6 = row.insertCell(5);
|
||||
cell6.innerHTML = data[i].purprice;
|
||||
var cell7 = row.insertCell(6);
|
||||
cell7.innerHTML = data[i].time
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
}) // 打印服务器返回的数据
|
||||
.catch(error => console.error('Error:', error)); // 捕获并打印错误信息
|
||||
|
||||
}
|
||||
pose();
|
||||
</script>
|
||||
|
||||
</html>
|
Loading…
Reference in new issue