首页 > 代码库 > CRM如何在新增模块中增加产品明细并从其他模块中取数

CRM如何在新增模块中增加产品明细并从其他模块中取数

一、如何在新增模块中增加产品明细模块并从其他模块中取数

 

1、新增一个功能模块如:CRM_MODULE_1

2、打开X:\MYOA\webroot\general\crm\apps\crm\modules\CRM_MODULE_1\EditView\ EditView.php,移至最下方,把以下代码粘贴到前</form>,即可!

 技术分享

   

<script src="http://www.mamicode.com/static/js/crm/productlist/productlist.js"></script>

<script src="http://www.mamicode.com/static/js/crm/productlist/productrow.js"></script>

<script src="http://www.mamicode.com/static/js/crm/productlist/productcheck.js"></script>

<script src="http://www.mamicode.com/static/js/crm/productlist/handle.js"></script>

 

 

<script>

jQuery("<br/><div id=‘productContainer‘></div>").insertAfter(jQuery("#page1_block1"));

var detailFieldName     = new Array(‘product_id‘, ‘quantity‘,‘price‘,‘total‘);

var detailFieldLabel    = new Array(‘产品编码‘, ‘数量‘, ‘单价‘,‘合计‘);

var detailFieldWidth    = new Array(‘15%‘,‘10%‘,‘10%‘,‘10%‘);

var detailFieldType     = new Array(‘PT~M‘,‘AMT~M‘,‘PC~M‘,‘TL~O‘);

var detailProdReltFlds  = new Array(‘product_code:产品编码:15%‘,‘product_name:产品名称:15%‘,‘product_specification:规格型号:15%‘,‘product_measure:计量单位:8%‘);

 

var prodRtFld        = "product_id";

var prodRtFldLabel       = "product_code";

var prodRtFlds              = "product_code,product_name,product_specification,product_measure,price";

 

var pList = new productList("prod", true, detailFieldName, detailFieldLabel,

                                                        detailFieldWidth, detailFieldType, detailProdReltFlds);

document.all("productContainer").innerHTML = pList;

 

      

 

      

       $(‘#field2‘).change(function(){//配置说明:field2是字段名称,即哪个文本框内容变化后填充表格

 

        

                     $.ajax({

                            url: "/general/ci/index.php/crm?id="+$(this).val(),//这个是获取数据的后台文件

                            dataType: "JSON",

                            cache: false,

                            success: function(json){

                           

                             for(var i=0; i<json.length; i++)

                              {

                             

                                                pList.addRow();

 

                                    $("#product_id"+(i+1)).val(json[i].product_id);

                                    $("#product_name"+(i+1)).val(json[i].product_name);

                                    $("#product_code"+(i+1)).val(json[i].product_code);

                                    $("#product_specification"+(i+1)).val(json[i].product_specification);

                                    $("#product_measure"+(i+1)).val(json[i].measure_id);

                                    $("#qty"+(i+1)).val(json[i].qty);

                                    $("#price"+(i+1)).val(json[i].price);

                              }

 

                              }

                      });

 

              });

             

                     calcTotal();

 

             

             

</script>

 

 

<input type="hidden" id="selectedRow" name="selectedRow" value="">

<input type="hidden" id="selectedIds" name="selectedIds" value="" />

<input type="hidden" id="selectedRowIds" name="selectedRowIds" value="">

<input type="hidden" id="prodList" name="prodList" value="http://www.mamicode.com/pList">

CRM如何在新增模块中增加产品明细并从其他模块中取数