upload-component.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. $.ajax({
  2. type: "get",
  3. url: "./script/php/getTypeList.php",
  4. dataType: "json",
  5. async: false,
  6. success: function(data) {
  7. $.each(data.equipmentName, function(index, value) {
  8. $("#typeSelect").append("<option value='" + data.equipmentCode[index] + "'>" + value + "</option>");
  9. });
  10. },
  11. error: function(data) {
  12. console.log('error getDataTable:' + data);
  13. }
  14. });
  15. var $w1finish = $('#w1').find('ul.pager li.finish');
  16. $w1finish.on('click', function (ev) {
  17. ev.preventDefault();
  18. //alert("送出資料!");
  19. });
  20. $('#w1').bootstrapWizard({
  21. tabClass: 'wizard-steps',
  22. nextSelector: 'ul.pager li.next',
  23. previousSelector: 'ul.pager li.previous',
  24. firstSelector: null,
  25. lastSelector: null,
  26. onNext: function (tab, navigation, index, newindex) {
  27. },
  28. onTabClick: function (tab, navigation, index, newindex) {
  29. if (newindex == index + 1) {
  30. return this.onNext(tab, navigation, index, newindex);
  31. } else if (newindex > index + 1) {
  32. return false;
  33. } else {
  34. return true;
  35. }
  36. },
  37. onTabChange: function (tab, navigation, index, newindex) {
  38. var totalTabs = navigation.find('li').size() - 1;
  39. $w1finish[newindex != totalTabs ? 'addClass' : 'removeClass']('hidden');
  40. $('#w1').find(this.nextSelector)[newindex == totalTabs ? 'addClass' : 'removeClass']('hidden');
  41. }
  42. });
  43. $("#typeSelect").change(function() {
  44. type = $(this).val();
  45. $.ajax({
  46. type: "get",
  47. url: "./script/php/getTypeDetail.php",
  48. dataType: "json",
  49. data: {
  50. type: type
  51. },
  52. async: false,
  53. success: function(data) {
  54. var table = JSON.parse(data.table);
  55. $("#w1-profile").empty();
  56. $.each(data.columnName, function(index, value) {
  57. if (index % 4 == 0) {
  58. $("#w1-profile").append('<div class="form-group" id="w1-profile-group' + index + '">');
  59. $("#w1-profile-group" + index).append('<label class="col-md-1 control-label" for="inputDefault">' + table[0][data.columnName[index]] +
  60. '</label><div class="col-md-2"><input type="text" class="form-control" id="input' + index + '"></div>');
  61. if (index + 1 < data.columnName.length)
  62. $("#w1-profile-group" + index).append('<label class="col-md-1 control-label" for="inputDefault">' + table[0][data.columnName[index + 1]] +
  63. '</label><div class="col-md-2"><input type="text" class="form-control" id="input' + index + '"></div>');
  64. if (index + 2 < data.columnName.length)
  65. $("#w1-profile-group" + index).append('<label class="col-md-1 control-label" for="inputDefault">' + table[0][data.columnName[index + 2]] +
  66. '</label><div class="col-md-2"><input type="text" class="form-control" id="input' + index + '"></div>');
  67. if (index + 3 < data.columnName.length)
  68. $("#w1-profile-group" + index).append('<label class="col-md-1 control-label" for="inputDefault">' + table[0][data.columnName[index + 3]] +
  69. '</label><div class="col-md-2"><input type="text" class="form-control" id="input' + index + '"></div>');
  70. $("#w1-profile").append('</div>');
  71. }
  72. });
  73. },
  74. error: function(data) {
  75. console.log('error getDataTable:' + data);
  76. }
  77. });
  78. });