123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- /**
- * bw
- *
- */
- $.namespace("bw.main");
- bw.main.init=function(){
- //把form传入,构造翻页控件
- pageinfo($("#bwform"));
- }
- bw.main.search=function(){
- $('#pagejump').val(1);
- $("#bwform").submit();
- }
- bw.main.del=function(data){
- $.confirm({
- title: '确认框',
- content: '确认删除吗',
- confirm: function(){
- $.post($.app + "/bw/delete", {
- id : data
- }, function(data) {
- if (data.success) {
- $.alert({
- title: '提示',
- content: '删除成功',
- confirm: function(){
- $("#bwform").submit();
- }
- });
- } else {
- $.alert({
- title: '提示',
- content: data.message,
- confirm: function(){
-
- }
- });
- }
- }, "json");
- },
- cancel: function(){
-
- }
- });
- }
- bw.main.edit=function(data){
- location.href=$.app+"/bw/edit?id="+data;
- }
- bw.main.view=function(data){
- location.href=$.app+"/bw/view?id="+data;
- }
- /**
- * 弹出新增页面
- * */
- bw.main.add=function(){
- location.href=$.app+"/bw/add";
- }
- bw.main.initSfwxpbw=function(divid, existVal){
- $.post($.app + "/bw/selectSfwxpbw", {
-
- }, function(data) {
- if (data) {
- var str = "";
- str+="<select class='sfwxpbwselectpicker' name='wxpbwid' >";
- str+="<option></option>";
- for(var i=0;i<data.length;i++){
- var sfwxpbw = data[i];
- if(sfwxpbw.id==existVal){
- str+=" <option selected='selected' value='"+sfwxpbw.id+"' >"+sfwxpbw.text+"</option>";
- }else{
- str+=" <option value='"+sfwxpbw.id+"' >"+sfwxpbw.text+"</option>";
- }
- }
- str+="</select>";
- $("#"+divid).empty();
- $("#"+divid).append(str);
-
- $('.sfwxpbwselectpicker').selectpicker({
- width:'80%'
- });
- } else {
-
- }
- }, "json");
- };
- bw.main.initBwsx=function(divid, existVal){
- $.post($.app + "/bw/selectBwsx", {
-
- }, function(data) {
- if (data) {
- var str = "";
- str+="<select class='bwsxselectpicker' name='bwsxid' id='bwsxid'>";
- str+="<option></option>";
- for(var i=0;i<data.length;i++){
- var bwsx = data[i];
- if(bwsx.id==existVal){
- str+=" <option selected='selected' value='"+bwsx.id+"' >"+bwsx.text+"</option>";
- }else{
- str+=" <option value='"+bwsx.id+"' >"+bwsx.text+"</option>";
- }
- }
- str+="</select>";
- $("#"+divid).empty();
- $("#"+divid).append(str);
-
- $('.bwsxselectpicker').selectpicker({
- width:'80%'
- });
- } else {
-
- }
- }, "json");
- };
- bw.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");
- };
- bw.main.initSfdwkf=function(divid, existVal){
- $.post($.app + "/bw/selectSfdwkf", {
-
- }, function(data) {
- if (data) {
- var str = "";
- str+="<select class='sfdwkfselectpicker' name='sfdwkfid' >";
- str+="<option></option>";
- for(var i=0;i<data.length;i++){
- var sfdwkf = data[i];
- if(sfdwkf.id==existVal){
- str+=" <option selected='selected' value='"+sfdwkf.id+"' >"+sfdwkf.text+"</option>";
- }else{
- str+=" <option value='"+sfdwkf.id+"' >"+sfdwkf.text+"</option>";
- }
- }
- str+="</select>";
- $("#"+divid).empty();
- $("#"+divid).append(str);
-
- $('.sfdwkfselectpicker').selectpicker({
- width:'80%'
- });
- } else {
-
- }
- }, "json");
- };
-
- bw.main.initBwyt=function(divid, existVal){
- $.post($.app + "/bw/selectBwyt", {
-
- }, function(data) {
- if (data) {
- var existValArr = existVal.split(",");
- var str = "";
- str+="<select multiple='multiple' class='bwytselectpicker' name='bwbwyt' >";
- str+="<option></option>";
- for(var i=0;i<data.length;i++){
- var flag = false;
- var bwyt = data[i];
- for(var j = 0; j < existValArr.length; j++){
- if(bwyt.id==existValArr[j]){
- flag = true;
- str+=" <option selected='selected' value='"+bwyt.id+"' >"+bwyt.text+"</option>";
- break;
- } else {
- flag = false;
- }
- }
- if(!flag){
- str+=" <option value='"+bwyt.id+"' >"+bwyt.text+"</option>";
- }
- }
- str+="</select>";
- $("#"+divid).empty();
- $("#"+divid).append(str);
-
- $('.bwytselectpicker').selectpicker({
- width: '80%'
- });
- } else {
-
- }
- }, "json");
- };
|