123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <script>
- $(document).ready(function() {
- var currType = "<?php echo isset($_GET['itemsType'])?$_GET['itemsType']:-1;?>";
- if(currType){
- var statusText = $(".pm_type>li[val='"+currType+"']").html();
- $('#itemsType').val(currType);
- $(".pm_type_txt").text(statusText);
- getItem(currType);
- }
- //初始化品目
- var currPmId = "<?php echo isset($_GET['itemId'])?$_GET['itemId']:'';?>";
- if(currPmId > 0){
- var pmNameText = $(".pm_name>li[val='"+currPmId+"']").html();
- $(".pm_name_txt").text(pmNameText);
- $("#itemId").val(currPmId);
- }
- var transType = "<?php echo isset($_GET['transferType'])?$_GET['transferType'] :0;?>";
- if(transType){
- var transferText = $(".pm_transfer>li[val='"+transType+"']").text();
- $('#transferType').val(transType);
- $(".pm_transfer_txt").text(transferText);
- }
- $('.create-allocation').click(function(){
- window.location.href='<?php echo $this->createUrl('imsStore/createtransfer')?>';
- });
- $('.select-type li').click(function () {
- var type = $(this).attr('val');
- if(type>=0){
- getItem(type);
- }else{
- $('.select-item .diy_select_txt').html("品目名称");
- $('#itemId').val(0);
- $('.select-item ul').html('<li val="0">品目名称</li>');
- }
- });
- function getItem(type){
- if(type>=0){
- $.ajax({
- type: 'POST',
- url: "<?php echo $this->createUrl('imsStore/ajaxGetItem');?>",
- data: {type:type},
- async: false,
- dataType: 'json',
- success: function (result) {
- var liStr = '';
- if (result.status == 1) {
- var data = result.data;
- for(var i in data){
- liStr += '<li val="'+data[i].itemId+'" >'+data[i].itemName+'</li>'
- }
- $('.pm_name_txt').html('品目名称');
- } else {
- $('.pm_name_txt').html('品目名称');
- }
- $('.select-item ul').html(liStr);
- var currPmId = "<?php echo isset($_GET['itemId'])?$_GET['itemId']:'';?>";
- var pmNameText = $(".pm_name>li[val='"+currPmId+"']").html();
- $('#itemId').val(0);
- $(".select-item .diy_select_txt").text(pmNameText);
- },
- error: function (jqXHR, textStatus, errorThrown) {
- /*错误信息处理*/
- flag = true;
- layer.msg('提交失败');
- }
- });
- }
- }
- });
- </script>
|