123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- $(function() {
- $itemGroupIdCombobox = $("#cargoCategoryId");
- // 仓库
- $('#warehouseId').combogrid({
- url : WEBROOT + "/loadData.action?entity=warehouse",
- idField : 'warehouseId',
- textField : 'warehouseName',
- delay : 500,
- showHeader : false,
- mode : 'remote',
- columns : [ [ {
- field : 'warehouseName',
- title : '仓库名称',
- width : 155
- } ] ],
- onBeforeLoad : function(param) {
- // 此设置使控件不会自动加载数据 这里不能使用this
- if (!$('#warehouseId').combogrid('getText')) {
- return false;
- } else {
- return true;
- }
- },
- onShowPanel : function() {
- // 在第一次触发下拉框事件是加载数据
- if (!$(this).combogrid('getText')) {
- $(this).combogrid({
- onBeforeLoad : function(param) {
- return true;
- }
- });
- }
- }
- });
- // 货主
- $('#customerId').combogrid({
- url : WEBROOT + "/loadData.action?entity=customer",
- idField : 'customerId',
- textField : 'customerName',
- delay : 500,
- mode : 'remote',
- showHeader : false,
- striped : true,
- columns : [ [ {
- field : 'customerName',
- width : '155'
- } ] ],
- onBeforeLoad : function(param) {
- // 此设置使控件不会自动加载数据 这里不能使用this
- if (!$("#customerId").combogrid('getText')) {
- return false;
- } else {
- return true;
- }
- },
- onShowPanel : function() {
- // 在第一次触发下拉框事件是加载数据
- if (!$(this).combogrid('getText')) {
- $(this).combogrid({
- onBeforeLoad : function(param) {
- return true;
- }
- });
- }
- }
- });
- // 某货主的客户
- $("#receiverId").combogrid({
- url : WEBROOT + "/loadData.action?entity=transceiver&isConsignee=1",
- mode : 'remote',
- idField : 'transceiverId',
- textField : 'transceiverName',
- delay : 500,
- showHeader : false,
- striped : true,
- columns : [ [ {
- field : 'transceiverName',
- width : 155
- } ] ],
- onBeforeLoad : function(param) {
- param.customerId = $("#customerId").combogrid('getValue');
- // 此设置使控件不会自动加载数据
- if (!$('#receiverId').combogrid('getText')) {
- return false;
- } else {
- return true;
- }
- },
- onShowPanel : function() {
- // 在第一次触发下拉框事件是加载数据
- if (!$(this).combogrid('getText')) {
- $(this).combogrid({
- onBeforeLoad : function(param) {
- param.customerId = $("#customerId").combogrid('getValue');
- return true;
- }
- });
- }
- },
- onClickRow : function(index, record) {
- getTransceiverAddressInfo(record.defaultAddressId);
- }
- });
- // 客户的地址
- $("#toTransceiverAddressId").combogrid({
- url : WEBROOT + "/loadData.action?entity=transceiverAddress",
- mode : 'remote',
- idField : 'id',
- textField : 'street',
- delay : 500,
- showHeader : false,
- striped : true,
- columns : [ [ {
- field : 'street',
- width : 155
- } ] ],
- onBeforeLoad : function(param) {
- param.transceiverId = $("#receiverId").combogrid('getValue');
- // 此设置使控件不会自动加载数据
- if (!$('#toTransceiverAddressId').combogrid('getText')) {
- return false;
- } else {
- return true;
- }
- },
- onShowPanel : function() {
- // 在第一次触发下拉框事件是加载数据
- if (!$(this).combogrid('getText')) {
- $(this).combogrid({
- onBeforeLoad : function(param) {
- param.transceiverId = $("#receiverId").combogrid('getValue');
- return true;
- }
- });
- }
- },
- onSelectAfter : function(index, record) {
- getTransceiverAddressInfo(record.id);
- }
- });
- // 产品
- $("#itemId").combogrid({
- url : WEBROOT + "/loadData.action?entity=item",
- mode : 'remote',
- idField : 'itemId',
- textField : 'itemName',
- delay : 500,
- showHeader : false,
- striped : true,
- columns : [ [ {
- field : 'itemName',
- width : 155
- } ] ],
- onBeforeLoad : function(param) {
- param.customerId = $("#customerId").combogrid('getValue');
- // 此设置使控件不会自动加载数据
- if (!$('#itemId').combogrid('getText')) {
- return false;
- } else {
- return true;
- }
- },
- onShowPanel : function() {
- // 在第一次触发下拉框事件是加载数据
- if (!$(this).combogrid('getText')) {
- $(this).combogrid({
- onBeforeLoad : function(param) {
- param.customerId = $("#customerId").combogrid('getValue');
- return true;
- }
- });
- }
- },
- onSelectAfter : function(index, record) {
- },
- onClickRow : function(index, record) {
- getItemInfo(record.itemId, function(itemData){
- if(itemData) {
- $("#detailWeight").val(itemData.nweight);
- $("#detailBulk").val(itemData.cube);
- }
- });
- }
- });
- // 货主关系人
- $("#relationedCustomerId").combogrid({
- url : WEBROOT + "/loadData.action?entity=customerRelation",
- mode : 'remote',
- idField : 'relationedCustomerId',
- textField : 'relationedCustomerName',
- delay : 500,
- showHeader : false,
- striped : true,
- columns : [ [ {
- field : 'relationedCustomerName',
- width : 155
- } ] ],
- onBeforeLoad : function(param) {
- param.customerId = $("#customerId").combogrid('getValue');
- // 此设置使控件不会自动加载数据
- if (!$('#relationedCustomerId').combogrid('getText')) {
- return false;
- } else {
- return true;
- }
- },
- onShowPanel : function() {
- // 在第一次触发下拉框事件是加载数据
- if (!$(this).combogrid('getText')) {
- $(this).combogrid({
- onBeforeLoad : function(param) {
- param.customerId = $("#customerId").combogrid('getValue');
- return true;
- }
- });
- }
- },
- onSelectAfter : function(index, record) {
- }
- });
- if ($("#carrierId")) {
- // 承运商
- $("#carrierId").combogrid({
- url : WEBROOT + "/loadData.action?entity=vender&isCarrier=1",
- mode : 'remote',
- idField : 'venderId',
- textField : 'venderName',
- delay : 500,
- showHeader : false,
- striped : true,
- columns : [ [ {
- field : 'venderName',
- width : 155
- } ] ],
- onBeforeLoad : function(param) {
- // 此设置使控件不会自动加载数据
- if (!$('#carrierId').combogrid('getText')) {
- return false;
- } else {
- return true;
- }
- },
- onShowPanel : function() {
- // 在第一次触发下拉框事件是加载数据
- if (!$(this).combogrid('getText')) {
- $(this).combogrid({
- onBeforeLoad : function(param) {
- return true;
- }
- });
- }
- },
- onSelectAfter : function(index, record) {
- }
- });
- }
- var $deliveryOutboundForm = $("#ordersForm");
-
- var $receiverContactor = $deliveryOutboundForm.find("input[name='receiverContactor']");
- var $receiverStreet = $deliveryOutboundForm.find("input[name='receiverStreet']");
- var $receiverContactorPhone = $deliveryOutboundForm.find("input[name='receiverContactorPhone']");
- var $receiverContactorMobile = $deliveryOutboundForm.find("input[name='receiverContactorMobile']");
- //var $toTransceiverAddressIdCombobox = $deliveryOutboundForm.find("input[name='toTransceiverAddressId']");
- var $countryCombobox = $deliveryOutboundForm.find("select[comboname='receiverCountry']");
- var $provinceCombobox = $deliveryOutboundForm.find("select[comboname='receiverProvince']");
- var $cityCombobox = $deliveryOutboundForm.find("select[comboname='receiverCity']");
- function initProvince(provinceVal, cityVal) {
- if ($deliveryOutboundForm.find("input[name='receiverCountry']").val() != "") {
- ajaxRequest(WEBROOT + "/findGlobalLocation.action", {
- country : $deliveryOutboundForm.find("input[name='receiverCountry']").val()
- }, function(data) {
- $provinceCombobox.combobox("clear");
- $cityCombobox.combobox("clear");
- var datas = [];
- for ( var i = 0, j = data.length; i < j; i++) {
- var ele = {};
- ele.value = data[i];
- ele.text = data[i];
- datas.push(ele);
- }
- $provinceCombobox.combobox("loadData", datas);
- if (provinceVal) {
- $provinceCombobox.combobox("setValue", provinceVal);
- initCity(cityVal);
- }
- });
- } else {
- $provinceCombobox.combobox({
- data : []
- });
- $cityCombobox.combobox({
- data : []
- });
- }
- }
- function initCity(cityVal) {
- if ($deliveryOutboundForm.find("input[name='receiverCountry']").val() != "" && $deliveryOutboundForm.find("input[name='receiverProvince']").val() != "") {
- ajaxRequest(WEBROOT + "/findGlobalLocation.action", {
- country : $deliveryOutboundForm.find("input[name='receiverCountry']").val(),
- province : $deliveryOutboundForm.find("input[name='receiverProvince']").val()
- }, function(data) {
- $cityCombobox.combobox("clear");
- var datas = [];
- for ( var i = 0, j = data.length; i < j; i++) {
- var ele = {};
- ele.value = data[i];
- ele.text = data[i];
- datas.push(ele);
- }
- $cityCombobox.combobox("loadData", datas);
- if (cityVal) {
- $cityCombobox.combobox("setValue", cityVal);
- }
- });
- }
- }
- ;
- $countryCombobox.combobox({// 国家修改事件
- onSelect : function() {
- contentChange($.DeliveryOutboundEdit.changeList, $countryCombobox);
- initProvince();
- }
- });
- $provinceCombobox.combobox({// 省修改事件
- onSelect : function() {
- contentChange($.DeliveryOutboundEdit.changeList, $provinceCombobox);
- initCity();
- }
- });
-
- // function initTransceiverAddress(transceiverId, defaultAddressId) {
- // ajaxRequest(WEBROOT + "/TransceiverAddress/getTransceiverAddressesInfo.action", {
- // transceiverId : transceiverId
- // }, function(resp) {
- // $toTransceiverAddressIdCombobox.combobox("clear");
- // var datas = [];
- // for ( var i = 0, j = resp.length; i < j; i++) {
- // var ele = {};
- // ele.id = resp[i].id;
- // ele.addressCode = resp[i].addressCode;
- // datas.push(ele);
- // }
- // $toTransceiverAddressIdCombobox.combobox("loadData", datas);
- // if (defaultAddressId) {
- // $toTransceiverAddressIdCombobox.combobox("setValue", defaultAddressId);
- // getTransceiverAddressInfo(defaultAddressId);
- // }
- // });
- // }
- function getTransceiverAddressInfo(id) {
- ajaxRequest(WEBROOT + "/TransceiverAddress/getTransceiverAddressInfo.action", {
- id : id
- }, function(data) {
- if (data) {
- $('#toTransceiverAddressId').combogrid("setValue", data.id).combogrid("setText", data.street);
- $receiverContactor.val(data.accountContactor);
- initProvince(data.province, data.city);
- $receiverStreet.val(data.street);
- $receiverContactorPhone.val(data.phone);
- $receiverContactorMobile.val(data.personalPhone);
- }
- });
- }
-
-
-
- if(operate=='add'){
- initProvince();
- }
- });
|