123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- /**
- *码头
- *
- */
- $.namespace("mt.main");
- mt.main.sfdwkfData=null;
- mt.main.sfdwkf=null;
- mt.main.sfwhpData=null;
- mt.main.sfwhp=null;
- mt.main.init=function(){
- //把form传入,构造翻页控件
- pageinfo($("#mtform"));
- };
- mt.main.search=function(){
- $('#pagejump').val(1);
- $("#mtform").submit();
- };
- mt.main.del=function(data){
- $.confirm({
- title: '确认框',
- content: '确认删除吗',
- confirm: function(){
- $.post($.app + "/mt/delete", {
- id : data
- }, function(data) {
- if (data.success) {
- $.alert({
- title: '提示',
- content: '操作成功',
- confirm: function(){
- $("#mtform").submit();
- }
- });
- } else {
- $.alert({
- title: '提示',
- content: data.message,
- confirm: function(){
-
- }
- });
- }
- }, "json");
- },
- cancel: function(){
-
- }
- });
- }
- mt.main.edit=function(data){
- location.href=$.app+"/mt/edit?id="+data;
- }
- mt.main.view=function(data){
- location.href=$.app+"/mt/view?id="+data;
- }
- /**
- * 弹出新增页面
- * */
- mt.main.add=function(){
- location.href=$.app+"/mt/add";
- }
- mt.main.initSfdwkfSel=function(existVal){
-
- $.post($.app + "/selectSf", {
- }, function(data) {
-
- var str = "";
- str+="<select class='selectpicker' name='sfdwkfid' id='sfdwkfid' >";
- str+="<option></option>";
- if(data){
- for(var i=0;i<data.length;i++){
- var sf = data[i];
- if(sf.id==existVal){
- str+=" <option selected='selected' value='"+sf.id+"' >"+sf.text+"</option>";
- }else{
- str+=" <option value='"+sf.id+"' >"+sf.text+"</option>";
- }
- }
- }
- str+="</select>";
- $("#sfdwkfDiv").empty();
- $("#sfdwkfDiv").append(str);
- $('.selectpicker').selectpicker({
- width:'80%'
- });
- }, "json");
- };
- mt.main.initSfwhpSel=function(existVal){
- $.post($.app + "/selectSf", {
- }, function(data) {
-
- var str = "";
- str+="<select class='selectpicker' name='sfwhpid' id='sfwhpid' >";
- str+="<option></option>";
- if(data){
- for(var i=0;i<data.length;i++){
- var sf = data[i];
- if(sf.id==existVal){
- str+=" <option selected='selected' value='"+sf.id+"' >"+sf.text+"</option>";
- }else{
- str+=" <option value='"+sf.id+"' >"+sf.text+"</option>";
- }
- }
- }
- str+="</select>";
- $("#sfwhpDiv").empty();
- $("#sfwhpDiv").append(str);
- $('.selectpicker').selectpicker({
- width:'80%'
- });
- }, "json");
- }
-
- mt.main.initFwlx=function(divid, existVal){
- $.post($.app + "/bw/selectFwlx", {
-
- }, function(data) {
- if (data) {
- var str = "";
- str+="<select class='fwlxselectpicker' name='fwlxid' >";
- str+="<option></option>";
- for(var i=0;i<data.length;i++){
- var fwlx = data[i];
- if(fwlx.id==existVal){
- str+=" <option selected='selected' value='"+fwlx.id+"' >"+fwlx.text+"</option>";
- }else{
- str+=" <option value='"+fwlx.id+"' >"+fwlx.text+"</option>";
- }
- }
- str+="</select>";
- $("#"+divid).empty();
- $("#"+divid).append(str);
-
- $('.fwlxselectpicker').selectpicker({
- width:'80%'
- });
- } else {
-
- }
- }, "json");
- };
- mt.main.initMtyt=function(divid, existVal){
- $.post($.app + "/bw/selectMtyt", {
-
- }, function(data) {
- var str = "";
- str+="<select multiple='multiple' class='mtytselectpicker' name='mtyt' id='mtytid'>";
- str+="<option></option>";
- if (data) {
- var existValArr = new Array;
- if(existVal!=null){
- existValArr=existVal.split(";");
- }
- for(var i=0;i<data.length;i++){
- var flag = false;
- var mtyt= data[i];
- for(var j = 0; j < existValArr.length; j++){
- if(mtyt.id==existValArr[j]){
- flag = true;
- str+=" <option selected='selected' value='"+mtyt.id+"' >"+mtyt.text+"</option>";
- break;
- } else {
- flag = false;
- }
- }
- if(!flag){
- str+=" <option value='"+mtyt.id+"' >"+mtyt.text+"</option>";
- }
- }
-
- }
- str+="</select>";
- $("#"+divid).empty();
- $("#"+divid).append(str);
- $('.mtytselectpicker').selectpicker({
- width: '80%'
- });
-
- }, "json");
- };
|