日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

angularjs实现 - 增删改查+排序+敏感字(最终版)

發(fā)布時(shí)間:2023/12/16 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 angularjs实现 - 增删改查+排序+敏感字(最终版) 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

本篇博客將要實(shí)現(xiàn)的效果,包括添加信息、修改信息、查詢(xún)信息、刪除信息、對(duì)信息排序/敏感字過(guò)濾!

與上一篇文章不同的是:優(yōu)化了界面效果,實(shí)現(xiàn)敏感字過(guò)濾,bug修復(fù)

將要用到:HTML,CSS,AngularJS,jQuery

先來(lái)看一下主界面效果:

新增訂單表單界面:

修改訂單信息界面:

想要實(shí)現(xiàn)所有的功能,要實(shí)現(xiàn)以下幾點(diǎn):

首先看一下主界面實(shí)現(xiàn)的代碼(HTML文件):

<!DOCTYPE html> <html ng-app="OrderApp"> <head><meta charset="UTF-8"><title>訂單管理</title><!--添加依賴(lài)--><script type="text/javascript" src="lib/jquery.1.12.4.js"></script><script type="text/javascript" src="lib/angular-1.3.0.js"></script><!--添加css樣式--><link type="text/css" href="css/style.css" rel="stylesheet"/><!--添加angularjs實(shí)現(xiàn)效果--><!--1.初始化數(shù)據(jù)--><script type="text/javascript" src="js/Data.js"></script><!--2.實(shí)現(xiàn)內(nèi)部功能--><script type="text/javascript">// 全選框/全不選框$(function () {$("input[name='check_all']").click(function () {var checked = this.checked; // 獲取 <input type="checkbox" name="check_all"/> 中checked屬性的值$("input[name='order_id[]']").each(function () {this.checked = checked; // 依次設(shè)置每一個(gè) <input type="checkbox" name="order_id[]"/> 中checked屬性的值});});});// 定義angularJS的使用范圍var app = angular.module("OrderApp", []);// 敏感詞過(guò)濾app.filter("sensitiveWord", function () {return function (msg, flag) {return msg.replace(flag, "*");}});// 實(shí)現(xiàn)按鈕與鏈接的功能app.controller("OrderCtrl", function ($scope) {// 獲取到輸入信息$scope.data = data;// 獲取信息列表中的IDvar id = 12;// 通過(guò)月份判斷顯示的信息$scope.filterByMonth = function (order) {// 判斷‘是否有選擇查詢(xún)時(shí)間段的開(kāi)始時(shí)間’條件是否成立,成立則向下繼續(xù)判斷if ($scope.filter_begin_month == undefined || $scope.filter_begin_month == "") {return true;}// 判斷‘是否有選擇查詢(xún)時(shí)間段的結(jié)束時(shí)間’條件是否成立,成立則向下繼續(xù)判斷if ($scope.filter_end_month == undefined || $scope.filter_end_month == "") {return true;}// 獲取到查詢(xún)時(shí)間段的開(kāi)始時(shí)間var beginMonth = parseInt($scope.filter_begin_month);// 獲取到查詢(xún)時(shí)間段的結(jié)束時(shí)間var endMonth = parseInt($scope.filter_end_month);// 判斷‘開(kāi)始時(shí)間’到‘結(jié)束時(shí)間’條件是否成立,成立則向下繼續(xù)判斷if (beginMonth > endMonth) {return true;}// 定義判斷方法:沒(méi)有規(guī)定時(shí)間段時(shí),從信息列表‘第一條信息’到‘最后一條信息’為查詢(xún)條件var month = order.dtCreated.substr(0, order.dtCreated.indexOf("-"));// 獲取到符合條件的信息month = parseInt(month);// 將符合條件的信息輸出到界面中return (month >= beginMonth && month <= endMonth);};// 發(fā)貨:點(diǎn)擊‘發(fā)貨’鏈接時(shí),狀態(tài)值改變?yōu)椤寻l(fā)貨’$scope.deliver = function (id) {for (var i in $scope.data) {if ($scope.data[i].id == id) {$scope.data[i].status = "已發(fā)貨";}}};// 批量發(fā)貨:在多選或全選狀態(tài)下,點(diǎn)擊‘批量發(fā)貨’按鈕時(shí),選中的‘未發(fā)貨’狀態(tài)變?yōu)椤寻l(fā)貨’狀態(tài)$scope.batchDeliver = function () {$("input[name='order_id[]']:checked").each(function () {$scope.deliver(this.id);});};// 刪除:點(diǎn)擊‘刪除’鏈接時(shí),將信息從界面中移除$scope.remove = function (id) {for (var i in $scope.data) {if ($scope.data[i].id == id) {$scope.data.splice(i, 1);}}};// 批量刪除:在多選或全選狀態(tài)下,點(diǎn)擊‘批量刪除’按鈕時(shí),選中的信息都會(huì)從列表中移除$scope.batchRemove = function () {$("input[name='order_id[]']:checked").each(function () {$scope.remove(this.id);});};// 在主界面打開(kāi)時(shí),隱藏‘新增訂單表單’$scope.isShowAddOrderForm = false;// 點(diǎn)擊‘新增訂單’按鈕時(shí),顯示新增訂單表單$scope.showAddOrderForm = function () {$scope.isShowAddOrderForm = true;};// 創(chuàng)建一個(gè)空集合,用于接收‘新增訂單’表單中的信息$scope.errTips = [];// 點(diǎn)擊‘提交’按鈕時(shí),將‘新增訂單表單’中的輸入內(nèi)容添加到信息列表中$scope.submitAddOrderForm = function () {// 獲取到空集合$scope.errTips = [];// 為集合定義接收信息的標(biāo)識(shí)符$scope.goodsNameClassName = "";$scope.userNameClassName = "";$scope.phoneClassName = "";$scope.priceClassName = "";// 輸入信息有誤時(shí),hasErr狀態(tài)值為false$scope.hasErr = false;// 獲取到輸入的信息var goodsName = $scope.goodsName == undefined ? "" : $scope.goodsName.trim();var userName = $scope.userName == undefined ? "" : $scope.userName.trim();var phone = $scope.phone == undefined ? "" : $scope.phone.trim();var price = $scope.price == undefined ? "" : $scope.price.trim();// 對(duì)輸入的信息進(jìn)行判斷 - 輸入無(wú)誤時(shí),hasErr狀態(tài)值變?yōu)閠rue// 判斷商品名if (goodsName == "") {$scope.errTips.push("商品名不能為空!");$scope.goodsNameClassName = "formErr";$scope.hasErr = true;}// 判斷用戶(hù)名if (userName == "") {$scope.errTips.push("用戶(hù)名不能為空!");$scope.userNameClassName = "formErr";$scope.hasErr = true;}// 判斷手機(jī)號(hào)if (phone == "") {$scope.errTips.push("手機(jī)號(hào)不能為空!");$scope.phoneClassName = "formErr";$scope.hasErr = true;}// 判斷價(jià)格if (price == "") {$scope.errTips.push("價(jià)格不能為空!");$scope.priceClassName = "formErr";$scope.hasErr = true;}// 判斷城市if ($scope.city == undefined || $scope.city == "") {$scope.errTips.push("請(qǐng)選擇城市!");$scope.hasErr = true;}// 如果商品名輸入有誤時(shí),提示以下信息if (goodsName.length < 6 || goodsName.length > 20) {$scope.errTips.push("商品名必須是6-20個(gè)字符!");$scope.goodsNameClassName = "formErr";$scope.hasErr = true;}// 如果用戶(hù)名輸入有誤時(shí),提示以下信息if (userName.length < 4 || userName.length > 16) {$scope.errTips.push("用戶(hù)名必須是4-16個(gè)字符!");$scope.userNameClassName = "formErr";$scope.hasErr = true;}// 如果手機(jī)號(hào)輸入有誤時(shí),提示以下信息if (!/^\d{11}$/.test(phone)) {$scope.errTips.push("手機(jī)號(hào)格式不正確!");$scope.phoneClassName = "formErr";$scope.hasErr = true;}// 如果價(jià)格輸入有誤時(shí),提示以下信息price = parseFloat(price);if (isNaN(price) || price <= 0) {$scope.errTips.push("價(jià)格必須大于0!");$scope.priceClassName = "formErr";$scope.hasErr = true;}// 如果輸入無(wú)誤時(shí),提示以下信息if ($scope.hasErr) {return; // 提示為空:不提示信息}// 將輸入信息添加到信息列表中$scope.data.push({id: ++id,goodsName: goodsName,userName: userName,phone: phone,price: price,city: $scope.city,dtCreated: "10-25 10:00",status: "待發(fā)貨"});// 點(diǎn)擊提交時(shí),將輸入的內(nèi)容清空$scope.goodsName = "";$scope.userName = "";$scope.phone = "";$scope.price = "";$scope.city = "";$scope.isShowAddOrderForm = false;};// 點(diǎn)擊‘修改’鏈接時(shí),顯示修改訂單表單$scope.edit = function (id) {for (var i in $scope.data) {if ($scope.data[i].id == id) {$scope.edit_goodsName = $scope.data[i].goodsName;$scope.edit_userName = $scope.data[i].userName;$scope.edit_phone = $scope.data[i].phone;$scope.edit_price = $scope.data[i].price;$scope.edit_city = $scope.data[i].city;$scope.edit_id = $scope.data[i].id;}}$scope.isShowEditOrderForm = true;};// 提交修改訂單表單$scope.submitEditOrderForm = function () {// 獲取到空集合$scope.errTips = [];// 為集合定義接收信息的標(biāo)識(shí)符$scope.edit_userNameClassName = "";$scope.edit_phoneClassName = "";$scope.edit_priceClassName = "";// 輸入信息有誤時(shí),hasErr狀態(tài)值為false$scope.hasErr = false;// 獲取到輸入的信息var id = $scope.edit_id == undefined ? "" : parseInt($scope.edit_id);var userName = $scope.edit_userName == undefined ? "" : $scope.edit_userName.trim();var phone = $scope.edit_phone == undefined ? "" : $scope.edit_phone.trim();var price = $scope.edit_price == undefined ? "" : $scope.edit_price;// 對(duì)輸入的信息進(jìn)行判斷 - 輸入無(wú)誤時(shí),hasErr狀態(tài)值變?yōu)閠rue// 判斷用戶(hù)名if (userName == "") {$scope.errTips.push("用戶(hù)名不能為空!");$scope.userNameClassName = "formErr";$scope.hasErr = true;}// 判斷手機(jī)號(hào)if (phone == "") {$scope.errTips.push("手機(jī)號(hào)不能為空!");$scope.phoneClassName = "formErr";$scope.hasErr = true;}// 判斷價(jià)格if (price == "") {$scope.errTips.push("價(jià)格不能為空!");$scope.priceClassName = "formErr";$scope.hasErr = true;}// 判斷城市if ($scope.edit_city == undefined || $scope.edit_city == "") {$scope.errTips.push("請(qǐng)選擇城市!");$scope.hasErr = true;}// 如果用戶(hù)名輸入有誤時(shí),提示以下信息if (userName.length < 4 || userName.length > 16) {$scope.errTips.push("用戶(hù)名必須是4-16個(gè)字符!");$scope.userNameClassName = "formErr";$scope.hasErr = true;}// 如果手機(jī)號(hào)輸入有誤時(shí),提示以下信息if (!/^\d{11}$/.test(phone)) {$scope.errTips.push("手機(jī)號(hào)格式不正確!");$scope.phoneClassName = "formErr";$scope.hasErr = true;}// 如果價(jià)格輸入有誤時(shí),提示以下信息price = parseFloat(price);if (isNaN(price) || price <= 0) {$scope.errTips.push("價(jià)格必須大于0!");$scope.priceClassName = "formErr";$scope.hasErr = true;}// 如果輸入無(wú)誤時(shí),提示以下信息if ($scope.hasErr) {return; // 提示為空:不提示信息}// 將修改后的信息添加到信息列表中for (var i in $scope.data) {if ($scope.data[i].id == id) {$scope.data[i].userName = userName;$scope.data[i].phone = phone;$scope.data[i].price = price;$scope.data[i].city = $scope.edit_city;}}// 點(diǎn)擊提交時(shí),將輸入的內(nèi)容清空$scope.edit_goodsName = "";$scope.edit_userName = "";$scope.edit_phone = "";$scope.edit_price = "";$scope.edit_city = "";$scope.isShowEditOrderForm = false;};});</script> </head> <body ng-controller="OrderCtrl"> <!--導(dǎo)航條實(shí)現(xiàn)--> <div class="filter"><!--用戶(hù)名搜索--><input type="text" placeholder="用戶(hù)名搜索" ng-model="filter_user_name"/><!--手機(jī)號(hào)搜索--><input type="text" placeholder="手機(jī)號(hào)搜索" ng-model="filter_phone"/><!--選擇城市--><select class="choose_city" ng-model="filter_city"><option value="">選擇城市</option><option value="北京">北京</option><option value="上海">上海</option><option value="天津">天津</option><option value="重慶">重慶</option></select><!--選擇發(fā)貨狀態(tài)--><select class="choose_status" ng-model="filter_status"><option value="">選擇狀態(tài)</option><option value="待發(fā)貨">待發(fā)貨</option><option value="已發(fā)貨">已發(fā)貨</option><option value="已收貨">已收貨</option></select><!--選擇查詢(xún)時(shí)間段的開(kāi)始時(shí)間--><select class="choose_time_begin_month" ng-model="filter_begin_month"><option value="">開(kāi)始月份</option><option value="1">01</option><option value="2">02</option><option value="3">03</option><option value="4">04</option><option value="5">05</option><option value="6">06</option><option value="7">07</option><option value="8">08</option><option value="9">09</option><option value="10">10</option><option value="11">11</option><option value="12">12</option></select> -<!--選擇查詢(xún)時(shí)間段的結(jié)束時(shí)間--><select class="choose_time_end_month" ng-model="filter_end_month"><option value="">結(jié)束月份</option><option value="1">01</option><option value="2">02</option><option value="3">03</option><option value="4">04</option><option value="5">05</option><option value="6">06</option><option value="7">07</option><option value="8">08</option><option value="9">09</option><option value="10">10</option><option value="11">11</option><option value="12">12</option></select><!--正、反排序--><select class="id_order" ng-model="id_order_type"><option value="">ID排序</option><option value="id">ID正序</option><option value="-id">ID倒序</option></select> </div> <!--功能按鈕實(shí)現(xiàn)--> <div class="buttons"><!--新增訂單--><button class="add_btn" ng-click="showAddOrderForm();">新增訂單</button><!--批量發(fā)貨--><button class="deliver_btn" ng-click="batchDeliver()">批量發(fā)貨</button><!--批量刪除--><button class="remove_btn" ng-click="batchRemove()">批量刪除</button><!--敏感字提示-->敏感字:米(商品名)-> 替換成 * </div> <!--表格信息實(shí)現(xiàn)--> <div class="list"><table width="800px" cellspacing="0" rules="cols" border="1px"><!--表格頭部實(shí)現(xiàn)--><thead><tr><!--全選框/全不選框--><th width="4%"><input type="checkbox" name="check_all"/></th><!--表格頭部提示信息--><th width="6%">ID</th><th width="14%">商品名</th><th width="8%">用戶(hù)名</th><th width="14%">手機(jī)號(hào)</th><th width="10%">價(jià)格</th><th width="8%">城市</th><th width="12%">下單時(shí)間</th><th width="8%">狀態(tài)</th><th width="14%">操作</th></tr></thead><tbody><!--表格主體實(shí)現(xiàn)--><tr align="center"ng-repeat="order in data | filter: {userName: filter_user_name} | filter: {phone: filter_phone} | filter: {city: filter_city} | filter: {status: filter_status} | filter: filterByMonth | orderBy: id_order_type"><!--多選框:實(shí)現(xiàn)選中效果--><td><input type="checkbox" name="order_id[]" id="{{ order.id }}"/></td><!--angularjs信息占位符:內(nèi)部添加信息--><td>{{ order.id }}</td><td>{{ order.goodsName | sensitiveWord: "米"}}</td><td>{{ order.userName }}</td><td>{{ order.phone }}</td><td>{{ order.price | currency: "¥"}}</td><td>{{ order.city }}</td><td>{{ order.dtCreated }}</td><!--根據(jù)提供信息判斷是否發(fā)貨/收貨--><td><span ng-show="order.status=='待發(fā)貨'" ng-click="deliver(order.id)"><!--點(diǎn)擊"發(fā)貨"修改為"已發(fā)貨"--><a href="javascript: void(0);">發(fā)貨</a></span><span ng-show="order.status=='已發(fā)貨'">已發(fā)貨</span><span ng-show="order.status=='已收貨'">已收貨</span></td><!--按鈕功能的實(shí)現(xiàn)--><td><!--修改按鈕實(shí)現(xiàn)--><a href="javascript: void(0);" ng-click="edit(order.id)">修改</a><!--刪除按鈕實(shí)現(xiàn)--><a href="javascript: void(0);" ng-click="remove(order.id)">刪除</a></td></tr></tbody></table> </div> <!--新增訂單功能界面的實(shí)現(xiàn)--> <div class="form" ng-show="isShowAddOrderForm"><!--新增訂單標(biāo)題--><div><span class="label">新增訂單</span><span class="txt"></span></div><!--添加商品名--><div><span class="label">商品名</span><span class="txt"><input type="text" placeholder="6-20個(gè)字符" ng-model="goodsName" ng-class="goodsNameClassName"/></span></div><!--添加用戶(hù)名--><div><span class="label">用戶(hù)名</span><span class="txt"><input type="text" placeholder="4-16個(gè)字符" ng-model="userName" ng-class="userNameClassName"/></span></div><!--添加手機(jī)號(hào)--><div><span class="label">手機(jī)號(hào)</span><span class="txt"><input type="text" ng-model="phone" ng-class="phoneClassName"/></span></div><!--添加價(jià)格--><div><span class="label">價(jià)格</span><span class="txt"><input type="text" ng-model="price" ng-class="priceClassName"/></span></div><!--添加城市--><div><span class="label">城市</span><!--選擇城市--><span class="txt"><select ng-model="city"><option value="">選擇城市</option><option value="北京">北京</option><option value="上海">上海</option><option value="天津">天津</option><option value="重慶">重慶</option></select></span></div><!--msg模塊:輸入信息有誤時(shí),將提示信息添加到msg模塊中--><div class="errTips" ng-show="hasErr"><ul><li ng-repeat="msg in errTips">{{ msg }}</li></ul></div><!--msg中的提示內(nèi)容在<span class="label"></span>版塊中顯示--><div><span class="label"></span><span class="txt"><button ng-click="submitAddOrderForm()">提交</button></span></div><div style="clear: both"></div> </div> <!--修改已有訂單界面的實(shí)現(xiàn)--> <div class="form" ng-show="isShowEditOrderForm"><!--修改訂單標(biāo)題--><div><span class="label">修改訂單</span><span class="txt"></span></div><!--修改用戶(hù)名--><div><span class="label">商品名(只讀)</span><span class="txt"><input type="text" placeholder="6-20個(gè)字符" ng-model="edit_goodsName" readonly/></span></div><!--修改用戶(hù)名--><div><span class="label">用戶(hù)名</span><span class="txt"><input type="text" placeholder="4-16個(gè)字符" ng-model="edit_userName" ng-class="edit_userNameClassName"/></span></div><!--修改手機(jī)號(hào)--><div><span class="label">手機(jī)號(hào)</span><span class="txt"><input type="text" ng-model="edit_phone" ng-class="edit_phoneClassName"/></span></div><!--修改價(jià)格--><div><span class="label">價(jià)格</span><span class="txt"><input type="text" ng-model="edit_price" ng-class="edit_priceClassName"/></span></div><!--修改城市--><div><span class="label">城市</span><!--選擇城市--><span class="txt"><select ng-model="edit_city"><option value="">選擇城市</option><option value="北京">北京</option><option value="上海">上海</option><option value="天津">天津</option><option value="重慶">重慶</option></select></span></div><!--msg模塊:輸入信息有誤時(shí),將提示信息添加到msg模塊中--><div class="errTips" ng-show="hasErr"><ul><li ng-repeat="msg in errTips">{{ msg }}</li></ul></div><!--msg中的提示內(nèi)容在<span class="label"></span>版塊中顯示--><div><span class="label"></span><input type="hidden" ng-model="edit_id"/><span class="txt"><button ng-click="submitEditOrderForm()">提交</button></span></div><div style="clear: both"></div> </div> </body> </html>

為了給信息列表實(shí)現(xiàn)數(shù)據(jù),要獲取到數(shù)據(jù)文件(Data.js):

var data = [{id: 1,goodsName: "iPhone 8 Plus",userName: "曹操",phone: "15111111111",price: 7588.00,city: "北京",dtCreated: "09-04 10:00",status: "已發(fā)貨"},{id: 2,goodsName: "華為 暢享6S",userName: "劉備",phone: "15222222222",price: 899.00,city: "天津",dtCreated: "08-09 10:00",status: "已發(fā)貨"},{id: 3,goodsName: "努比亞Z17",userName: "孫權(quán)",phone: "15333333333",price: 2099.00,city: "上海",dtCreated: "07-01 10:00",status: "待發(fā)貨"},{id: 4,goodsName: "三星 Galaxy S7",userName: "司馬懿",phone: "15444444444",price: 2999.00,city: "北京",dtCreated: "06-02 10:00",status: "已發(fā)貨"},{id: 5,goodsName: "魅藍(lán)5S",userName: "夏侯淳",phone: "15555555555",price: 999.00,city: "北京",dtCreated: "10-03 10:00",status: "已發(fā)貨"},{id: 6,goodsName: "三星 Galaxy Note8",userName: "張遼",phone: "15666666666",price: 2599.00,city: "北京",dtCreated: "04-02 10:00",status: "已收貨"},{id: 7,goodsName: "OPPO R9sk",userName: "關(guān)羽",phone: "15777777777",price: 4999.00,city: "北京",dtCreated: "03-09 10:00",status: "已發(fā)貨"},{id: 8,goodsName: "紅米Note4X",userName: "張飛",phone: "15888888888",price: 999.00,city: "上海",dtCreated: "05-18 10:00",status: "已收貨"},{id: 9,goodsName: "紅米5A",userName: "周瑜",phone: "15999999999",price: 599.00,city: "重慶",dtCreated: "06-16 10:00",status: "待發(fā)貨"},{id: 10,goodsName: "小米Mix2",userName: "黃蓋",phone: "13111111111",price: 3299.00,city: "北京",dtCreated: "03-15 10:00",status: "待發(fā)貨"},{id: 11,goodsName: "小米Note5",userName: "黃忠",phone: "13222222222",price: 699.00,city: "重慶",dtCreated: "02-28 10:00",status: "待發(fā)貨"},{id: 12,goodsName: "VIVO X20",userName: "趙云",phone: "13333333333",price: 2998.00,city: "上海",dtCreated: "08-22 10:00",status: "已發(fā)貨"} ];

最后進(jìn)行界面優(yōu)化(style.css):

/*全局標(biāo)識(shí)符{字體大小,外邊框,內(nèi)邊框}*/ * {font-size: 14px;margin: 0;padding: 0; } /*body標(biāo)簽標(biāo)識(shí)符{內(nèi)邊框:上下 左右}*/ body {padding: 16px 32px; } /*導(dǎo)航條{相對(duì)定位,寬,高,居中}*/ .filter {position: relative;width: 800px;height: 40px;margin: 0 auto; } /*導(dǎo)航條 -> input{寬,高,邊框,圓角,左內(nèi)邊距} */ .filter input {width: 152px;height: 24px;border: 1px solid #999;border-radius: 4px;padding-left: 8px; } /*導(dǎo)航條 -> ‘選擇城市’下拉列表{寬,高,邊框,圓角}*/ .filter select {width: 86px;height: 24px;border: 1px solid #999;border-radius: 4px; } /*功能按鈕實(shí)現(xiàn){寬,高,居中}*/ .buttons {width: 800px;height: 40px;margin: 0 auto; } /*功能按鈕實(shí)現(xiàn) -> 按鈕{寬,高,背景色,邊框,圓角,顏色}*/ .buttons button {width: 80px;height: 24px;background-color: green;border: 0;border-radius: 4px;color: white; } /*功能按鈕實(shí)現(xiàn) -> ‘批量刪除’按鈕{背景色}*/ .buttons .remove_btn {background-color: red; } /*表格信息實(shí)現(xiàn){寬,居中}*/ .list {width: 800px;margin: 0 auto; } /*表格信息實(shí)現(xiàn) -> 表格主體實(shí)現(xiàn){高}*/ .list table tr {height: 32px; } /*表格信息實(shí)現(xiàn) -> 表格頭部實(shí)現(xiàn){背景色}*/ .list thead tr {background-color: #777; } /*表格信息實(shí)現(xiàn) -> 表格主體實(shí)現(xiàn) -> 奇數(shù)行{背景色}*/ .list tbody tr:nth-child(odd) {background-color: #ccc; } /*表格信息實(shí)現(xiàn) -> 表格主體實(shí)現(xiàn) -> 偶數(shù)行{背景色}*/ .list tbody tr:nth-child(even) {background-color: #fff; } /*新增訂單功能界面的按鈕{寬,高,行高,背景色,邊框,圓角,顏色,字體大小}*/ .list button {width: 40px;height: 18px;line-height: 18px;background-color: green;border: 0;border-radius: 4px;color: white;font-size: 8px; } /*新增訂單功能界面{寬,邊框,居中}*/ .form {width: 460px;border: 1px solid #999;margin: 0 auto; } /*新增訂單功能界面 -> 每一行的div樣式{顏色}*/ .form div {clear: both; } /*判斷商品名有誤時(shí),邊框顏色改變{紅色}*/ .form .formErr {border: 1px solid red; } /*新增訂單功能界面提示字體樣式{清除塊級(jí)樣式,浮動(dòng),寬,高,行高,字體下劃線}*/ .form .label {display: block;float: left;width: 80px;height: 40px;line-height: 40px;text-align: end; } /*新增訂單功能界面包含輸入框的div樣式{清除快級(jí)樣式,浮動(dòng),寬,高,行高,左內(nèi)邊距}*/ .form .txt {display: block;float: left;width: 340px;height: 40px;line-height: 40px;padding-left: 16px; } /*新增訂單功能界面輸入框的樣式{寬,高,邊框,圓角,左內(nèi)邊距}*/ .form input {width: 312px;height: 24px;border: 1px solid #999;border-radius: 4px;padding-left: 8px; } /*新增訂單功能界面城市下拉列表樣式{寬,高,邊框,圓角}*/ .form select {width: 86px;height: 24px;border: 1px solid #999;border-radius: 4px; } /*新增訂單功能界面提交按鈕樣式{寬,高,背景色,邊框,圓角,顏色}*/ .form button {width: 56px;height: 24px;background-color: green;border: 0;border-radius: 4px;color: white; } /*‘輸入信息有誤時(shí),將提示信息添加到msg模塊中’msg模板樣式{寬,背景色,字體顏色,圓角,左外邊框,上外邊框,下外邊框,內(nèi)邊框:上下 左右}*/ .form .errTips {width: 226px;background-color: lightpink;color: darkred;border-radius: 4px;margin-left: 96px;margin-top: 6px;margin-bottom: 4px;padding: 16px 48px; }

以上就是實(shí)現(xiàn)所有效果的全部代碼了,希望對(duì)大家有所幫助!

總結(jié)

以上是生活随笔為你收集整理的angularjs实现 - 增删改查+排序+敏感字(最终版)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。