123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var fd_id; var COLUMN_1_270;
- $(function(){
- //可否调用
- $("#IS_USED_270").initCanstSelect('BM_ISUSED');
- $("#IS_USED_270").render();
- //调拨状态
- $("#USED_STAT_270").initCanstSelect('BM_USEDSTAT');
- $("#USED_STAT_270").render();
- //燃料
- $("#CAR_GAS_270").initCanstSelect('BM_RANLIAO');
- $("#CAR_GAS_270").render();
-
- // var AreaSql = "select DEPT_ID,PARENT_ID,DEPT_NAME from SYS_DEPARTMENT_TEST";
- // //所属公司
- // var treeUrl = $.pathname() + '/ws/sys/constantService/getTreeCanst/';
- // var params = {
- // sql:AreaSql
- // };
- // $.post(treeUrl,params,function(data){
- // $("#AcceptUserTree").data("data",data[0].constlist);
- // $("#AcceptUserTree").render();
- // }, "json");
- // var deptUrl =$.pathname() + '/ws/orgInDeptService/OrgInDeptService/getDeptRootById';
- // //添加额外属性主要用于最初的初始节点
- // $("#AcceptUserTree").attr('params','{"deptId":"'+ deptName +'"}');
- // //异步加载请求地址
- // $("#AcceptUserTree").attr('url',deptUrl);
-
-
- //修改表单信息,获取记录
- if((window.location.href).indexOf('?')>-1){
- fd_id = (window.location.href).split('?')[1];
- var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
- var params = {
- classid : '270',
- objectID : fd_id
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- async:false, //异步
- dataType : 'json',
- success : function(data){
- $('#fillForm').ajaxWrite({data:data});
- $('#fillForm input[name="classid"]').val('270');
- COLUMN_1_270=data.COLUMN_1_270;
- //加载单位
- var name = data.COMP_ID_270;
- $("#COMP_ID_270").val(name);
- // $("#AcceptUserTree").attr("selectedValue",name);
- // var nameshow = data.COMP_ID_270_SHOW;
- // $("#AcceptUserTree").attr("relValue",name);
- // $("#AcceptUserTree").attr("relText",nameshow);
- // $("#AcceptUserTree").find("input:text").val(nameshow);
-
- $("#TYPEIN_TIME").html(data.UPDATEDATE_270);
- typein(data.TYPEIN_PEOPLE_270);
-
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
-
-
- }else{
- $("#COMP_ID_270").val(deptName);
- //初始化单位树
- // $.post(deptUrl,{"id":deptName},function(data){
- // $("#AcceptUserTree").data("data",data);
- // $("#AcceptUserTree").render();
- // }, "json");
- /******************录入人信息start********************/
- /* 页面展示用 */
- //取登录用户信息
- //登录用户姓名 要调整,还是要用id
- var userName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- $("#TYPEIN_PEOPLE").html(userName);
- //用户手机号
- var getMobile = top.com.sinosoft.lz.system.user.LoginInfo.getMobile();
- if(getMobile==undefined){
- $("#TYPEIN_PEOPLE_PHONE_NUM").html("暂无手机号码");
- }else{
- $("#TYPEIN_PEOPLE_PHONE_NUM").html(getMobile);
- }
- //用户所属单位
- var getCorp_names = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- $("#UNITE").html(getCorp_names);
- //用户所属部门
- var getDeptnames = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- $("#DEPT").html(getDeptnames);
- /*****************录入人信息end*********************/
- }
- });
- //录入人信息
- function typein(id){
- var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
- var params1 = {
- classid : '880',
- objectID : id
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params1,
- async:false, //异步
- dataType : 'json',
- success : function(data){
- $("#TYPEIN_PEOPLE").html(data.REAL_NAME_880); //录入人
- $("#TYPEIN_PEOPLE_PHONE_NUM").html(data.MOBILE_880); //手机
- $("#UNITE").html(data.COMPANY_ID_880_SHOW);//所属单位
- $("#DEPT").html(data.ORG_ID_880_SHOW);//所属部门
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
- //重置
- function resetSearch(){
- document.location.reload();
- }
- //删除原来信息
- function del(){
- // 删除记录
- $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
- "objectIDs" : fd_id,
- classid : 270
- }, function(result) {
- if (result.Msg.sucsess == true) {
- } else {
- top.Dialog.alert("废止失败!");
- }
- }, "json");
- }
-
- //表单验证
- function validateForm(containerId){
- // var unit = $("#AcceptUserTree").attr('relValue');
- var name= $("#CAR_NAME_270").val();
- var content = $("#CAR_CONTENT_270").val();
- var num= $("#CAR_NUM_270").val();
- var place= $("#STORE_PLACE_270").val();
- var inpire= $("#CAR_INPIRE_270").val();
- var phone= $("#MOBILE_PHONE_270").val();
- var col = $("#COLUMN_2_270").val();
-
- var valid = $(containerId).validationEngine({returnIsValid: true});
- if(valid == true){
- // alert("=========提交");
- var id = document.getElementById("fd_id270").value;
- if(id==""){
- add();
- }else{
- //先删除原来记录。
- del();
- $("#fd_id270").val("");
- edit();
- }
- }else{
- // if(unit==""){
- // top.Dialog.alert("所属单位名称不能为空!");
- // return;
- // }
- if(name==""){
- top.Dialog.alert("装备名称不能为空!");
- return;
- }
- if(content==""){
- top.Dialog.alert("乘员人数不能为空!");
- return;
- }
- if(num==""){
- top.Dialog.alert("数量不能为空!");
- return;
- }
- if(place==""){
- top.Dialog.alert("装备存放场所不能为空!");
- return;
- }
- if(inpire==""){
- top.Dialog.alert("负责人不能为空!");
- return;
- }
- if(phone==""){
- top.Dialog.alert("手机不能为空!");
- return;
- }
- if(col==""){
- top.Dialog.alert("可供吃饭人数不能为空!");
- return;
- }
- top.Dialog.alert('请检查标红输入框!');
- }
- }
-
- //新增
- function add(){
- //录入人id
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- $('#TYPEIN_PEOPLE_270').val(userId);
- $("body").eq(0).showLoading();
- var formValue = $('#fillForm').serialize();
- var url = $.pathname() + '/ws/crud/CRUDService/create';
- $.ajax({
- url : url,
- type : 'post',
- data : formValue,
- dataType : 'text',
- timeout : 60000,
- success : function(data){
- $("body").eq(0).hideLoading();
- $.messager.alert("保存成功",null,null,null,-1);
- window.location.href="/nwyj/page/business/am/resource/ledger/dining-car.jsp";
- // window.history.back();
- },
- error : function(){
- $("body").eq(0).hideLoading();
- $.messager.alert('操作失败');
- }
- });
- }
-
- //修改
- function edit(){
- if(COLUMN_1_270=="0"){
- $("#COLUMN_1_270").val(fd_id);
- }else{
- $("#COLUMN_1_270").val(COLUMN_1_270);
- }
- //新录入人id
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- $('#TYPEIN_PEOPLE_270').val(userId);
- $("body").eq(0).showLoading();
- var formValue = $('#fillForm').serialize();
- var url = $.pathname() + '/ws/crud/CRUDService/create';
- $.ajax({
- url : url,
- type : 'post',
- data : formValue,
- dataType : 'text',
- timeout : 60000,
- success : function(data){
- $("body").eq(0).hideLoading();
- $.messager.alert("保存成功",null,null,null,-1);
- window.location.href="/nwyj/page/business/am/resource/ledger/dining-car.jsp";
- // window.history.back();
- },
- error : function(){
- $.messager.alert('操作失败');
- }
- });
- }
- //返回
- function goBack(){
-
- // top.Dialog.confirm("您已修改了表单,是否需要离开?|离开", function() {
- window.location.href="/nwyj/page/business/am/resource/ledger/dining-car.jsp";
- // });
- }
- $.messager=top.Dialog;
|