123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- <%--
- time:2017-06-05 16:33:55
- desc:edit the 物品申请
- --%>
- <%@page language="java" pageEncoding="UTF-8"%>
- <%@include file="/commons/include/html_doctype.html"%>
- <html>
- <head>
- <title>编辑 物品申请</title>
- <%@include file="/commons/include/form.jsp" %>
- <script type="text/javascript" src="${ctx}/js/hotent/CustomValid.js"></script>
- <script type="text/javascript" src="${ctx}/js/hotent/formdata.js"></script>
- <script type="text/javascript" src="${ctx}/js/hotent/subform.js"></script>
- <script type="text/javascript">
- var productids;
- $(function() {
- $("a.add").click(function() {
- var flag = '${sysGoodsApplication.flag}';
- if(flag == 2){
- $('#sysGoodsApplicationRelaTable a').css('display','');
- $('#sysGoodsApplicationRelaTable input:text').not('input[name="quantity"]').prop('readonly',true);
- }
- });
- });
-
- $(function() {
- $("a.save").click(function() {
- var productcode = $("input[name='productcode']").val();
- if(!productcode) {
- $.ligerDialog.warn("请添加至少一件物品","消息提示");
- return;
- }
- $("#sysGoodsApplicationForm").attr("action","save.ht");
- $("#saveData").val(1);
- submitForm();
- });
- });
-
- //提交表单
- function submitForm(){
- var options={};
- if(showResponse){
- options.success=showResponse;
- }
- var frm=$('#sysGoodsApplicationForm').form();
- frm.ajaxForm(options);
- if(frm.valid()){
- frm.sortList();
- frm.submit();
- }
- }
-
- function showResponse(responseText) {
- var obj = new com.hotent.form.ResultMessage(responseText);
- if(!obj.isSuccess()){
- $.ligerDialog.err("提示信息"," 物品申请保存失败!",obj.getMessage());
- return;
- }
- $.ligerDialog.confirm(obj.getMessage()+",是否继续操作","提示信息", function(rtn) {
- if(rtn){
- window.location.href = window.location.href;
- }else{
- window.location.href = "${ctx}/platform/system/sysGoodsApplication/list.ht?flag=${sysGoodsApplication.flag}";
- }
- });
- }
-
- /*选择物品*/
- function selectGoods(flag){goodsDialog(flag,{callback:function (data){
- var temddata = data[0].value.split("#");
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="productid"]').val(temddata[0]);
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="productcode"]').val(temddata[1]);
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="productname"]').val(temddata[2]);
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="brand"]').val(temddata[3]);
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="specification"]').val(temddata[4]);
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="price"]').val(temddata[5]);
- }});
- }
-
- /*物品对话框*/
- function goodsDialog(flag,conf){
- $("input[name='productid']").each(function(){
- var pro = $(this),
- tr = pro.parents("tr"),
- productid = $("input[name='productid']",tr).val();
- if(productid && productids.indexOf(productid) == -1) {
- productids = productid + "," + productids;
- }
- });
- if(!productids) productids = "";
- if(!conf) conf={};
- var url=__ctx + "/platform/system/sysGoodsApplication/selector.ht?flag=" + flag + "&productids=" + productids;
- var dialog = null;
- dialog = DialogUtil.open({
- passConf : {dialog:dialog},
- url:url,
- title : "物品列表",
- width : 600,
- height : 400,
- modal : true,
- resizable : true,
- buttons:[{
- text:'确定',
- onclick:function(){
- var arrysysgoods = dialog.jiframe.contents().find("input[name='sysgoodsdata'][checked]");
- if(conf.callback){
- conf.callback(arrysysgoods);
- dialog.close();
- }else{
- dialog.close();
- }
- }
- },{
- text:'取消',
- onclick: function (item,dialog) { dialog.close(); }
- }]
- });
- }
-
- function calculateP(obj) {
- if($("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="quantity"]').val() != 0) {
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="totalprice"]').val(($("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="quantity"]').val()*(obj.val()*100).toFixed(2))/100);
- }
- }
-
- function calculateQ(obj) {
- if($("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="price"]').val() != 0) {
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="totalprice"]').val((($("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="price"]').val()*100).toFixed(2)*obj.val())/100);
- }
- }
-
- function validateP(obj){
- var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
- if(!reg.test(obj.val())){
- $.ligerDialog.error("请输入正确数字类型","提示信息");
- obj.val("");
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="totalprice"]').val("");
- return;
- }
- }
-
- function validateQ(obj){
- var quantity = obj.val();
- var reg = /^[0-9]*$/;
- if(!reg.test(quantity)){
- $.ligerDialog.error("请输入正确数字类型","提示信息");
- obj.val("");
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="totalprice"]').val("");
- return;
- }
- var productid = $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="productid"]').val();
- var url = __ctx + "/platform/system/sysGoodsApplication/validate.ht";
- if(quantity.length > 0) {
- var rtn = {
- status : 0,
- msg : ""
- };
- $.ajax({
- url:url,
- data:{
- productid : productid,
- quantity : quantity
- },
- async:false
- }).done(function(data){
- if(data.status){
- rtn.status = -1;
- rtn.msg = data.msg;
- }
- }).fail(function(){
- rtn.status = -1;
- rtn.msg='后台出错!';
- });
- if(rtn.status){
- if(rtn.msg){
- $.ligerDialog.warn(rtn.msg,"消息提示");
- }
- obj.val("");
- $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="totalprice"]').val("");
- return;
- }
- }
- }
- </script>
- </head>
- <body>
- <div class="panel">
- <div class="panel-top">
- <div class="tbar-title">
- <c:choose>
- <c:when test="${sysGoodsApplication.id !=null}">
- <span class="tbar-label"><span></span>编辑物品申请</span>
- </c:when>
- <c:otherwise>
- <span class="tbar-label"><span></span>添加物品申请</span>
- </c:otherwise>
- </c:choose>
- </div>
- <div class="panel-toolbar">
- <div class="toolBar">
- <div class="group"><a class="link save" id="dataFormSave" href="#"><span></span>申请</a></div>
- <div class="l-bar-separator"></div>
- <div class="group"><a class="link back" href="list.ht?flag=${sysGoodsApplication.flag}"><span></span>返回</a></div>
- </div>
- </div>
- </div>
- <div class="panel-body">
- <form id="sysGoodsApplicationForm" method="post" action="save.ht">
- <table class="table-detail" cellpadding="0" cellspacing="0" border="0" type="main">
- <tr>
- <th width="20%">申请科室: </th>
- <td><input type="text" id="department" name="department" value="${sysGoodsApplication.department}" class="inputText" validate="{required:false,maxlength:32}" readonly /></td>
- </tr>
- <tr>
- <th width="20%">人员: </th>
- <td><input type="text" id="personnel" name="personnel" value="${sysGoodsApplication.personnel}" class="inputText" validate="{required:false,maxlength:32}" readonly /></td>
- </tr>
- <tr>
- <th width="20%">申请时间: </th>
- <td><input type="text" id="applicationdate" name="applicationdate" value="<fmt:formatDate value='${sysGoodsApplication.applicationdate}' pattern='yyyy-MM-dd HH:mm:ss'/>" class="inputText" style="width:150px" validate="{date:true}" readonly /></td>
- </tr>
- <tr>
- <th width="20%">申请原因: </th>
- <td><textarea rows="6" style="width:500px" id="reason" name="reason" validate={required:false}></textarea></td>
- </tr>
- </table>
- <table class="table-grid table-list" cellpadding="1" cellspacing="1" id="sysGoodsApplicationRela" formtype="form" type="subtable">
- <tr>
- <td colspan="8">
- <div class="group" align="left">
- <a id="btnAdd" class="link add">添加</a>
- </div>
- <div align="center">
- 申请物品
- </div>
- </td>
- </tr>
- <tr>
- <th>物品编号</th>
- <th>物品名称</th>
- <th>品牌</th>
- <th>规格</th>
- <th id="price">价格</th>
- <th>数量</th>
- <th id="totalprice">总价</th>
- </tr>
- <c:forEach items="${sysGoodsApplicationRelaList}" var="sysGoodsApplicationRelaItem" varStatus="status">
- <tr type="subdata">
- <td style="text-align: center" name="productcode">${sysGoodsApplicationRelaItem.productcode}</td>
- <td style="text-align: center" name="productname">${sysGoodsApplicationRelaItem.productname}</td>
- <td style="text-align: center" name="brand">${sysGoodsApplicationRelaItem.brand}</td>
- <td style="text-align: center" name="specification">${sysGoodsApplicationRelaItem.specification}</td>
- <td style="text-align: center" id="price" name="price">${sysGoodsApplicationRelaItem.price}</td>
- <td style="text-align: center" name="quantity">${sysGoodsApplicationRelaItem.quantity}</td>
- <td style="text-align: center" id="totalprice" name="totalprice">${sysGoodsApplicationRelaItem.totalprice}</td>
- <input type="hidden" name="productid" value="${sysGoodsApplicationRelaItem.productid}"/>
- <input type="hidden" name="productcode" value="${sysGoodsApplicationRelaItem.productcode}"/>
- <input type="hidden" name="productname" value="${sysGoodsApplicationRelaItem.productname}"/>
- <input type="hidden" name="brand" value="${sysGoodsApplicationRelaItem.brand}"/>
- <input type="hidden" name="specification" value="${sysGoodsApplicationRelaItem.specification}"/>
- <input type="hidden" id="price" name="price" value="${sysGoodsApplicationRelaItem.price}"/>
- <input type="hidden" name="quantity" value="${sysGoodsApplicationRelaItem.quantity}"/>
- <input type="hidden" id="totalprice" name="totalprice" value="${sysGoodsApplicationRelaItem.totalprice}"/>
- </tr>
- </c:forEach>
- <tr type="append">
- <td style="text-align: center" name="productcode"></td>
- <td style="text-align: center" name="productname"></td>
- <td style="text-align: center" name="brand"></td>
- <td style="text-align: center" name="specification"></td>
- <td style="text-align: center" id="price" name="price"></td>
- <td style="text-align: center" name="quantity"></td>
- <td style="text-align: center" id="totalprice" name="totalprice"></td>
- <input type="hidden" name="productid" value=""/>
- <input type="hidden" name="productcode" value=""/>
- <input type="hidden" name="productname" value=""/>
- <input type="hidden" name="brand" value=""/>
- <input type="hidden" name="specification" value=""/>
- <input type="hidden" id="price" name="price" value=""/>
- <input type="hidden" name="quantity" value=""/>
- <input type="hidden" id="totalprice" name="totalprice" value=""/>
- </tr>
- </table>
- <input type="hidden" name="id" value="${sysGoodsApplication.id}" />
- <input type="hidden" name="flag" value="${sysGoodsApplication.flag}" />
- <input type="hidden" name="saveData" id="saveData" />
- <input type="hidden" name="executeType" value="start" />
- </form>
-
- </div>
- <form id="sysGoodsApplicationRelaForm" style="display:none" title="申请物品">
- <table class="table-detail" id="sysGoodsApplicationRelaTable" cellpadding="0" cellspacing="0" border="0">
- <tr>
- <th width="20%">物品编号: <span class="required red">*</span></th>
- <td>
- <input type="text" name="productcode" value="" class="inputText" validate="{required:true,number:true }"/>
- <a class="button" style="display:none" onclick="selectGoods('${sysGoodsApplication.flag}');"><span>选择</span></a>
- </td>
- </tr>
- <tr>
- <th width="20%">物品名称: <span class="required red">*</span></th>
- <td><input type="text" name="productname" value="" class="inputText" validate="{required:true,maxlength:128}"/></td>
- </tr>
- <tr>
- <th width="20%">品牌: <span class="required red">*</span></th>
- <td><input type="text" name="brand" value="" class="inputText" validate="{required:true,maxlength:32}"/></td>
- </tr>
- <tr>
- <th width="20%">规格: <span class="required red">*</span></th>
- <td><input type="text" name="specification" value="" class="inputText" validate="{required:true}"/></td>
- </tr>
- <tr id="price">
- <th width="20%">价格: <span class="required red">*</span></th>
- <td><input type="text" name="price" value="" class="inputText" onBlur="validateP($(this))" onchange="calculateP($(this))" validate="{required:true,number:true,maxDecimalLen:2,maxIntLen:18 }"/></td>
- </tr>
- <tr>
- <th width="20%">数量: <span class="required red">*</span></th>
- <td><input type="text" name="quantity" value="" class="inputText" onBlur="validateQ($(this))" onchange="calculateQ($(this))" validate="{required:true,number:true }"/></td>
- </tr>
- <tr id="totalprice">
- <th width="20%">总价: <span class="required red">*</span></th>
- <td><input type="text" name="totalprice" value="" class="inputText" validate="{required:true,number:true,maxDecimalLen:2,maxIntLen:18 }" readonly /></td>
- </tr>
- </table>
- <input type="hidden" name="productid" value=""/>
- </form>
- </div>
- </body>
- </html>
|