首頁 web前端 js教程 Angular JQuery產生簡單快遞管理介面的程式碼分享

Angular JQuery產生簡單快遞管理介面的程式碼分享

Apr 09, 2018 pm 04:04 PM
angular jquery

這篇文章給大家分享的內容是Angular JQuery產生簡單快遞管理介面的程式碼分享,有著一定的參考價值,有需要的朋友可以參考一下

話不多說,直接上程式碼:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="css/sty.css" />
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
</head>
<body ng-app="MyApp" ng-controller="MyCont">
<center ng-hide="hi">
<input type="button" value="新增订单" class="btn" ng-click="tian()"/>
<input type="button" value="批量删除" class="btn" ng-click="del_sel()"/>
<input type="text" placeholder="按商品名称查询" class="se1" ng-model="shop" ng-blur="name()"/>
<input type="text" placeholder="按手机号查询" class="se" ng-model="num" ng-blur="num_sel()"/>
<select class="sel" ng-model="zhuang_sel" ng-change="zhuang()">
<option>--按状态查询--</option>
<option>已发货</option>
<option>未发货</option>
</select><br />
<table class="table" cellpadding="0px" cellspacing="0px">
<tr style="background-color: #999999">
<td><input type="checkbox" ng-click="quan()" ng-model="cb"/></td>
<td>id  <input type="button" value="排序" class="pai" ng-click="id_pai()"/></td>
<td>商品名</td>
<td>用户名</td>
<td>手机号</td>
<td>价格  <input type="button" value="排序" class="pai" ng-click="price_pai()"/></td>
<td>城市</td>
<td>下单时间  <input type="button" value="排序" class="pai" ng-click="time_pai()"/></td>
<td>状态</td>
</tr>
<tr ng-repeat="li in xin">
<td><input type="checkbox" ng-checked="cb" ng-click="chec($index)"/></td>
<td>{{li.id}}</td>
<td>{{li.goodsName}}</td>
<td>{{li.userName}}</td>
<td>{{li.tel}}</td>
<td>{{li.price|currency:"¥:"}}</td>
<td>{{li.city}}</td>
<td>{{li.time|date:"MM-dd HH:mm:ss"}}</td>
<td><input  type="button" value="{{li.goodsState}}" class="{{li.state}}" ng-click="haha($index)"/></td>
</tr>
</table>
</center>
<center ng-show="sh">
<button style="border-radius: 5px;">新增订单</button>
<fieldset class="fie">
<legend>haha</legend>
<form>
<table>
<tr>
<td>id</td>
<td><input type="text" id="sel_id"/></td>
</tr>
<tr>
<td>商品名</td>
<td><input type="text" id="sel_name"/></td>
</tr>
<tr>
<td>用户名</td>
<td><input type="text" id="sel_user"/></td>
</tr>
<tr>
<td>手机号</td>
<td><input type="text" id="sel_tel"/></td>
</tr>
<tr>
<td>价格</td>
<td><input type="text" id="sel_pirce"/></td>
</tr>
<tr>
<td>城市</td>
<td>
<select id="sel_cary">
<option>北京</option>
<option>郑州</option>
<option>上海</option>
<option>杭州</option>
<option>黑龙江</option>
</select>
</td>
</tr>
<tr>
<td>下单时间</td>
<td><input type="text" id="sel_time"/></td>
</tr>
<tr>
<td>状态</td>
<td>
<select id="sel_zhuang">
<option>已发货</option>
<option>未发货</option>
</select>
</td>
</tr>
<tr>
<td colspan="2"><input type="button" value="保存" ng-click="bao()"/></td>
</tr>
</table>
</form>
</fieldset>
</center>
<script>
var arr = [{
id: 2001,
goodsName: "iPhoneX",
userName: "张三",
tel: 1352565588,
price: 8699.00,
city: "北京",
time: "1123100000",
goodsState: "已发货",
state: true,
flag: false
},
{
id: 3006,
goodsName: "iPhone6",
userName: "王红",
tel: 18524565588,
price: 5635.00,
city: "郑州",
time: "1123113820",
goodsState: "已发货",
state: true,
flag: false
},
{
id: 5312,
goodsName: "iPhone7",
userName: "赵小龙",
tel: 17545585598,
price: 6180.00,
city: "北京",
time: "1123091730",
goodsState: "未发货",
state: false,
flag: false
},
{
id: 2132,
goodsName: "iPhone8",
userName: "赵强",
tel: 17625565618,
price: 7190.00,
city: "上海",
time: "1123104021",
goodsState: "未发货",
state: false,
flag: false
}
]
var mo = angular.module("MyApp", []);
mo.controller("MyCont", function($scope,$filter) {
$scope.xin = arr;
$scope.tian=function(){
$scope.hi=true;
$scope.sh=true;
}
$scope.name=function(){
var aa = $scope.shop;
if(aa!=undefined){
$scope.xin = $filter("shopsha")(arr,aa);
}else{
alert("内容不能为空")
}
}
$scope.num_sel=function(){
var aa = $scope.num;
if(aa!=undefined){
$scope.xin = $filter("num_test")(arr,aa);
}else{
alert("内容不能为空")
}
}
$scope.zhuang=function(){
var aa = $scope.zhuang_sel;
$scope.xin = $filter("zhuang_test")(arr,aa);
}
var id_flag=false;
$scope.id_pai=function(){
if(id_flag){
arr.sort(function(a,b){
return b.id-a.id;
})
}else{
arr.sort(function(a,b){
return a.id-b.id;
})
}
id_flag=!id_flag;
arr=$scope.xin;
}
var price_flag=false;
$scope.price_pai=function(){
if(price_flag){
arr.sort(function(a,b){
return b.price-a.price;
})
}else{
arr.sort(function(a,b){
return a.price-b.price;
})
}
price_flag=!price_flag;
arr=$scope.xin;
}
var time_flag=false;
$scope.time_pai=function(){
if(time_flag){
arr.sort(function(a,b){
return b.time-a.time;
})
}else{
arr.sort(function(a,b){
return a.time-b.time;
})
}
time_flag=!time_flag;
arr=$scope.xin;
}
$scope.haha=function($index){
if(arr[$index].goodsState=="已发货"){
arr[$index].goodsState="未发货"
arr[$index].state=false;
}else{
arr[$index].goodsState="已发货"
arr[$index].state=true;
}
$scope.xin=arr;
}
$scope.quan=function(){
var qwe = $scope.cb;
for (var i=0;i<arr.length;i++) {
arr[i].flag=qwe;
}
$scope.xin=arr;
}
$scope.chec=function($index){
arr[$index].flag=!arr[$index].flag;
$scope.xin=arr;
}
$scope.del_sel=function(){
for (var i=arr.length-1;i>=0;i--) {
if(arr[i].flag&&!(arr[i].state)){
arr.splice(i,1);
}
}
$scope.xin=arr;
}
$scope.bao=function(){
if(test1("#sel_id")&&test1("#sel_name")&&test1("#sel_user")&&test1("#sel_tel")&&test1("#sel_pirce")&&test1("#sel_cary")&&test1("#sel_time")&&test1("#sel_zhuang")){
var val1 = $("#sel_id").val()
var val2 = $("#sel_name").val()
var val3 = $("#sel_user").val()
var val4 = $("#sel_tel").val()
var val5 = $("#sel_pirce").val()
var val6 = $("#sel_cary").val()
var val7 = $("#sel_time").val()
var val8 = $("#sel_zhuang").val()
var obj={
id: val1,
goodsName: val2,
userName: val3,
tel: val4,
price: val5,
city: val6,
time: val7,
goodsState: val8,
state: false,
flag: false
}
arr.push(obj);
$scope.xin=arr;
$scope.hi=false;
$scope.sh=false;
}else{
alert("失败!不能为空");
}
}
})
mo.filter("shopsha",function(){
return function(input,aa){
var arr2=[];
for (var i=0;i<input.length;i++) {
if(input[i].goodsName==aa){
arr2.push(input[i])
}
}
if(arr2.length==0){
alert("对不起没有数据")
}
return arr2
}
})
mo.filter("num_test",function(){
return function(input,aa){
var arr2=[];
for (var i=0;i<input.length;i++) {
if((input[i].tel+"").indexOf(aa)!=-1){
arr2.push(input[i])
}
}
if(arr2.length==0){
alert("对不起没有数据")
}
return arr2
}
})
mo.filter("zhuang_test",function(){
return function(input,aa){
var arr2=[]
for (var i=0;i<input.length;i++) {
if(input[i].goodsState==aa){
arr2.push(input[i])
}
}
if(aa=="--按状态查询--"){
return input;
}
return arr2;
}
})
mo.filter("but_test",function(){
return function(input){
}
})
function test1(yang){
var val = $(yang).val();
var f=/^\s*$/;
if(f.test(val.trim())){
$(yang).css("border","1px solid red");
return false;
}else{
$(yang).css("border","1px solid black");
return true;
}
}
</script>
</body>
</html>
登入後複製


#

以上是Angular JQuery產生簡單快遞管理介面的程式碼分享的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

如何在Ubuntu 24.04上安裝Angular 如何在Ubuntu 24.04上安裝Angular Mar 23, 2024 pm 12:20 PM

Angular.js是一種可自由存取的JavaScript平台,用於建立動態應用程式。它允許您透過擴展HTML的語法作為模板語言,以快速、清晰地表示應用程式的各個方面。 Angular.js提供了一系列工具,可協助您編寫、更新和測試程式碼。此外,它還提供了許多功能,如路由和表單管理。本指南將討論在Ubuntu24上安裝Angular的方法。首先,您需要安裝Node.js。 Node.js是一個基於ChromeV8引擎的JavaScript運行環境,可讓您在伺服器端執行JavaScript程式碼。要在Ub

jQuery引用方法詳解:快速上手指南 jQuery引用方法詳解:快速上手指南 Feb 27, 2024 pm 06:45 PM

jQuery引用方法詳解:快速上手指南jQuery是一個受歡迎的JavaScript庫,被廣泛用於網站開發中,它簡化了JavaScript編程,並為開發者提供了豐富的功能和特性。本文將詳細介紹jQuery的引用方法,並提供具體的程式碼範例,幫助讀者快速上手。引入jQuery首先,我們需要在HTML檔案中引入jQuery函式庫。可以透過CDN連結的方式引入,也可以下載

jQuery中如何使用PUT請求方式? jQuery中如何使用PUT請求方式? Feb 28, 2024 pm 03:12 PM

jQuery中如何使用PUT請求方式?在jQuery中,發送PUT請求的方法與發送其他類型的請求類似,但需要注意一些細節和參數設定。 PUT請求通常用於更新資源,例如更新資料庫中的資料或更新伺服器上的檔案。以下是在jQuery中使用PUT請求方式的具體程式碼範例。首先,確保引入了jQuery庫文件,然後可以透過以下方式發送PUT請求:$.ajax({u

Angular元件及其顯示屬性:了解非block預設值 Angular元件及其顯示屬性:了解非block預設值 Mar 15, 2024 pm 04:51 PM

Angular框架中元件的預設顯示行為不是區塊級元素。這種設計選擇促進了元件樣式的封裝,並鼓勵開發人員有意識地定義每個元件的顯示方式。透過明確設定CSS屬性 display,Angular組件的顯示可以完全控制,從而實現所需的佈局和響應能力。

jQuery小技巧:快速修改頁面所有a標籤的文本 jQuery小技巧:快速修改頁面所有a標籤的文本 Feb 28, 2024 pm 09:06 PM

標題:jQuery小技巧:快速修改頁面所有a標籤的文字在網頁開發中,我們經常需要對頁面中的元素進行修改和操作。使用jQuery時,有時候需要一次修改頁面中所有a標籤的文字內容,這樣可以節省時間和精力。以下將介紹如何使用jQuery快速修改頁面所有a標籤的文本,同時給出具體的程式碼範例。首先,我們需要引入jQuery庫文件,確保在頁面中引入了以下程式碼:&lt

jQuery如何移除元素的height屬性? jQuery如何移除元素的height屬性? Feb 28, 2024 am 08:39 AM

jQuery如何移除元素的height屬性?在前端開發中,經常會遇到需要操作元素的高度屬性的需求。有時候,我們可能需要動態改變元素的高度,而有時候又需要移除元素的高度屬性。本文將介紹如何使用jQuery來移除元素的高度屬性,並提供具體的程式碼範例。在使用jQuery操作高度屬性之前,我們首先需要了解CSS中的height屬性。 height屬性用於設定元素的高度

使用jQuery修改所有a標籤的文字內容 使用jQuery修改所有a標籤的文字內容 Feb 28, 2024 pm 05:42 PM

標題:使用jQuery修改所有a標籤的文字內容jQuery是一款受歡迎的JavaScript庫,被廣泛用於處理DOM操作。在網頁開發中,經常會遇到需要修改頁面上連結標籤(a標籤)的文字內容的需求。本文將介紹如何使用jQuery來實現這個目標,並提供具體的程式碼範例。首先,我們需要在頁面中引入jQuery庫。在HTML檔案中加入以下程式碼:

了解jQuery中eq的作用及應用場景 了解jQuery中eq的作用及應用場景 Feb 28, 2024 pm 01:15 PM

jQuery是一種流行的JavaScript庫,被廣泛用於處理網頁中的DOM操作和事件處理。在jQuery中,eq()方法是用來選擇指定索引位置的元素的方法,具體使用方法和應用場景如下。在jQuery中,eq()方法選擇指定索引位置的元素。索引位置從0開始計數,即第一個元素的索引是0,第二個元素的索引是1,依此類推。 eq()方法的語法如下:$("s

See all articles