bootstrap.js 1.2 KB

123456789101112131415161718192021222324252627
  1. require([], function () {
  2. $(document).on('click', "[data-toggle='areapicker']", function () {
  3. var iscustomer =$(this).data('iscustomer')?$(this).data('iscustomer'):false;
  4. var that = this;
  5. var callback = $(that).data('callback');
  6. var input_name = $(that).data("input-name") ? $(that).data("input-name") : "";
  7. var input_val = $(that).data("input-val") ? $(that).data("input-val") : "";
  8. var name = input_name ? $("#" + input_name).val() : '';
  9. var val = input_val ? $("#" + input_val).val() : '';
  10. var datasource = $(that).data("datasource") ? $(that).data("datasource") : "";
  11. var url = "/addons/areapicker/index?iscustomer="+iscustomer+"&ds="+datasource;
  12. url += val ? '&val=' + val : '';
  13. Fast.api.open(url, '区域选择', {
  14. callback: function (res) {
  15. input_name && $("#" + input_name).val(res.name);
  16. input_val && $("#" + input_val).val(res.val);
  17. try {
  18. if (typeof callback === 'function') {
  19. callback.call(that, res);
  20. }
  21. } catch (e) {
  22. }
  23. }
  24. });
  25. });
  26. });