Browse Source

表单验证

Hu Jie 7 years ago
parent
commit
b340a88f87
1 changed files with 17 additions and 8 deletions
  1. 17 8
      src/main/webapp/resources/tpl/index/purc/change_new.html

+ 17 - 8
src/main/webapp/resources/tpl/index/purc/change_new.html

@@ -192,10 +192,14 @@
     top: 712px;
     left: 1100.5px!important;
 }
+.save button[disabled] {
+    background-color: #A9A9A9;
+}
 </style>
+<form class="width100" name="orderChange" autocomplete="off" id="orderChange">
 <div class="warp">
     <div class=" purchase">
-        <form class="width100" name="order" autocomplete="off">
+
             <div class="com_head"><span>采购变更单</span></div>
             <div class="purchase_form">
                 <!--基本信息-->
@@ -276,7 +280,7 @@
                             </div>
                             <div class="fr">
                                 <em>是否需要供应商确认:</em>
-                                <select name="" class="select" ng-model="change.unNeedReply" ng-required="true">
+                                <select name="" class="select" ng-model="change.unNeedReply">
                                     <option value="0">是</option>
                                     <option value="1">否</option>
                                 </select>
@@ -311,16 +315,19 @@
                             <td ng-bind="item.oldProduct.cmpCode || '-'" title="{{item.oldProduct.cmpCode}}"></td>
                             <td ng-bind="item.oldProduct.brand || '-'" title="{{item.oldProduct.brand}}"></td>
                             <td ng-bind="item.oldQty || '-'" title="{{item.oldQty}}"></td>
-                            <td><input type="text" class="text-center" ng-model="item.newQty" placeholder="新数量"></td>
+                            <td><input type="text" class="text-center" ng-model="item.newQty" placeholder="新数量"
+                                       ng-pattern="/^(([0-9]+\.[0-9]{1,3})|([0-9]*[1-9][0-9]*\.[0-9]{1,3})|([0-9]*[1-9][0-9]*))$/" ></td>
                             <td ng-bind="item.oldPrice || '-'" title="{{item.oldPrice}}"></td>
-                            <td><input type="text" class="text-center" ng-model="item.newPrice" placeholder="新单价"></td>
+                            <td><input type="text" class="text-center" ng-model="item.newPrice" placeholder="新单价"
+                                       ng-pattern="/^(([0-9]+\.[0-9]{1,6})|([0-9]*[1-9][0-9]*\.[0-9]{1,6})|([0-9]*[1-9][0-9]*))$/" ></td>
                             <td ng-bind="item.oldTaxrate || '-'" title="{{item.oldTaxrate}}"></td>
-                            <td><input type="text" class="text-center" ng-model="item.newTaxrate" placeholder="新税率"></td>
+                            <td><input type="text" class="text-center" ng-model="item.newTaxrate" placeholder="新税率"
+                                       ng-pattern="/^[0-9][0-9]{0,1}$/"></td>
                             <td ng-bind="item.oldDelivery | date: 'yyyy-MM-dd'" title="{{item.oldDelivery | date: 'yyyy-MM-dd'}}"></td>
                             <td style="overflow: visible;" id="delivery">
                                 <input ng-model="item.newDelivery" type="text" class="editable"
                                        placeholder="点击选择时间" datepicker-popup="yyyy-MM-dd" is-open="item.$dateOpen"
-                                       min-date="getMinDate()" ng-required="true"
+                                       min-date="getMinDate()"
                                        current-text="今天" clear-text="清除" close-text="关闭"
                                        datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
                                        ng-focus="openDatePicker($event, $dateOpen)" readonly
@@ -334,12 +341,14 @@
                         </tbody>
                     </table>
                 </div>
+                {{orderChange.$invalid}}
                 <div class="save">
-                	<button ng-click="save()">提交</button>
+                	<button ng-click="save()" ng-disabled="orderChange.$invalid">提交</button>
                 </div>
             </div>
-        </form>
+
     </div>
 </div>
+</form>
 </body>
 </html>