加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
owner.html 14.18 KB
一键复制 编辑 原始数据 按行查看 历史
zz 提交于 2023-03-16 08:57 . 修改了页面跳转
<!doctype html>
<html lang="en">
<head>
<title>车主信息</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- vue.js -->
<script src="vue.js"></script>
</head>
<body>
<!-- UI -->
<div id="app">
<!-- 导航栏 -->
<n-nav></n-nav>
<!-- 巨幕 -->
<n-jum id="" class="" :info="show"></n-jum>
<!-- 容器 -->
<div class="container-fluid">
<!-- 表单 -->
<div class="row">
<!-- 左侧表单 -->
<div class="col-lg-4">
<div class="form-group">
<label for="">姓名</label>
<input v-model="vname" type="text"
class="form-control" name="" id="" aria-describedby="helpId" placeholder="请输入车主姓名">
</div>
<div class="form-group">
<label for="">性别</label>
<select class="form-control" name="" id="" v-model="vsex">
<option></option>
<option></option>
</select>
</div>
<div class="form-group">
<label for="">身份证</label>
<input v-model="vid" type="text"
class="form-control" name="" id="" aria-describedby="helpId" placeholder="请输入身份证" maxlength="18" required>
</div>
<div class="form-group">
<label for="">联系方式</label>
<input v-model="vtel" type="text"
class="form-control" name="" id="" aria-describedby="helpId" placeholder="请输入联系方式" maxlength="11" pattern="1\d{10}" required>
</div>
<div class="form-group">
<label for="">车牌号</label>
<input v-model="vcard" type="text"
class="form-control" name="" id="" aria-describedby="helpId" placeholder="请输入车牌号">
</div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="card1" id="" v-model="vcard1" value="固定车主"> 固定车主
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="card1" id="" v-model="vcard1" value="租赁车主"> 租赁车主
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="card1" id="" v-model="vcard1" value="临时车主"> 临时车主
</label>
</div>
<button v-on:click="add()" type="button" class="btn btn-block btn-primary ">提交</button>
</div>
<!-- 右侧表格 -->
<div class="col-lg-8">
<table class="table">
<thead>
<tr>
<th>姓名</th>
<th>性别</th>
<th>身份证</th>
<th>联系方式</th>
<th>车牌号</th>
<th>车主类型</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in ownerList" :key="index">
<template v-if="editIndex!=index">
<td>{{item.name}}</td>
<td>{{item.sex}}</td>
<td>{{item.id}}</td>
<td>{{item.tel}}</td>
<td>{{item.card}}</td>
<td>{{item.card1}}</td>
<td>
<div class="row">
<div class="col">
<button v-on:click="edit(index,item)" type="button" class="btn btn-outline-warning btn-sm btn-block">编辑</button>
</div>
</div>
<button v-on:click="rm(index)" type="button" class="btn btn-outline-danger btn-block">X</button>
</td>
</template>
<template v-else>
<td><input type="text" v-model="editName" style="width: 100%"></td>
<td>
<div class="form-group">
<select class="form-control" v-model="editSex">
<option v-for="(o, index) in vsex" :key="index" >{{o}}</option>
</select>
</div>
</td>
<td><input type="text" v-model="editID" style="width: 100%"></td>
<td><input type="text" v-model="editTel" style="width: 100%"></td>
<td><input type="text" v-model="editCard" style="width: 100%"></td>
<td>
<div class="form-group">
<select class="form-control" v-model="editCard1">
<option v-for="(o, index) in vcard1" :key="index" >{{o}}</option>
</select>
</div>
</td>
<td>
<div class="row">
<div class="col">
<button v-on:click="update(index)" type="button" class="btn btn-success">保存</button>
</div>
<div class="col">
<button @click="cancel()" type="button" class="btn btn-primary">取消</button>
</div>
</div>
</td>
</template>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- JS -->
<script>
//定义组件component 导航栏
Vue.component('n-nav',{
data(){
return{
title:'首页',
link:'车主信息',
links:'车位信息',
}
},
methods: {
},
template:`
<nav class="navbar navbar-expand-sm navbar-dark" style=" background-color: #0dccea;">
<a class="navbar-brand" style="color:black;" href="index.html">{{title}}</a>
<button class="navbar-toggler d-lg-none" type="button" data-toggle="collapse" data-target="#collapsibleNavId" aria-controls="collapsibleNavId"
aria-expanded="false" aria-label="Toggle navigation"></button>
<div class="collapse navbar-collapse" id="collapsibleNavId">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item active" >
<a class="nav-link" href="owner.html"> <span style="color: black;">{{link}}</span><span class="sr-only">(current)</span></a>
</li>
<li class="nav-item active" >
<a class="nav-link" href="park.html"> <span style="color: black;">{{links}}</span><span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdownId" style="color:black;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">车辆出入信息</a>
<div class="dropdown-menu" aria-labelledby="dropdownId" style="color:black;">
<a class="dropdown-item" href="inCar.html">车辆入场信息</a>
<a class="dropdown-item" href="outCar.html">车辆出场信息</a>
</div>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
`
});
// 定义组件component 巨幕
Vue.component('n-jum', {
// 属性,从外部传入数据
props: ['info'],
// 组件的成员变量,内部
data() {
return {
}
},
template: `
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1 class="display-3">{{info}}</h1>
</div>
</div>
`
});
//创建Vue实例
let v1 = new Vue({
el :'#app',
data:{
show:'停车场',
editIndex:-1,
vname:'',
vsex:['',''],
vid:'',
vtel:'',
vcard:'',
vcard1:['固定车主','租赁车主','临时车主'],
editName:'',
editSex:'',
editID:'',
editTel:'',
editCard:'',
editCard1:'',
ownerList:[
{
name:'徐添栋',
sex:'',
id:'430921200111116988',
tel:'15700830899',
card:'湘A66666',
card1:'固定车主'
},
{
name:'杨凯迪',
sex:'',
id:'430921200111116988',
tel:'17570101601',
card:'湘B88888',
card1:'固定车主'
},
]
},
methods: {
add(){
let o =
{
name:this.vname,
sex:this.vsex,
id:this.vid,
tel:this.vtel,
card:this.vcard,
card1:this.vcard1
}
this.ownerList.push(o);
this.vname = '';
this.vsex='';
this.vid='';
this.vtel = '';
this.vcard = '';
this.vcard1='';
},
rm(i){
this.ownerList.splice(i,1);
},
//编辑
edit:function(i,o){
this.editIndex = i;
this.editName = o.name;
this.editSex = o.sex;
this.editID = o.id;
this.editTel= o.tel;
this.editCard = o.card;
this.editCard1 = o.card1;
},
//更新
update:function(i){
this.ownerList[i].name = this.editName;
this.ownerList[i].sex = this.editSex;
this.ownerList[i].id = this.editID;
this.ownerList[i].tel = this.editTel;
this.ownerList[i].card = this.editCard;
this.ownerList[i].card1 = this.editCard1;
this.cancel();
},
//取消
cancel:function(){
this.editIndex = -1;
this.editName = '';
this.editSex = '';
this.editID = '';
this.editTel = '';
this.editCard = '';
this.editCard1 = '';
}
}
})
</script>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化