Merge branch 'dev_lxw' of http://whychdw@118.89.139.230:10101/r/~whyclxw/gx_tieta.git into dev_lxw
| | |
| | | <label ></label>
|
| | | <div class="layui-input-block">
|
| | | <select name="province" id="province" lay-filter="province">
|
| | | <option value="">请选择省</option>
|
| | | </select>
|
| | | <option value="">请选择省</option>
|
| | | </select>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | |
| | | <div class="layui-tbl-filter">
|
| | | <div class="layui-form layui-form-pane" lay-filter="tblFilter">
|
| | | <div class="layui-inline">
|
| | | <div class="layui-input-inline">
|
| | | <div class="layui-form" lay-filter="addTypeFilter">
|
| | | <select name="addType" id="addType" lay-filter="addType">
|
| | | <option value="0">单个机房</option>
|
| | | <option value="5">全区/县</option>
|
| | | <option value="2">全市</option>
|
| | | <option value="1">全省</option>
|
| | | </select>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <button class="layui-btn layui-btn-sm mrl8" id="batchAdd"><i class="fa fa-plus mrr8"></i>添加电池组</button>
|
| | | <div class="layui-input-inline">
|
| | | <div class="layui-form" lay-filter="addTypeFilter">
|
| | | <select name="addType" id="addType" lay-filter="addType">
|
| | | <option value="0">单个机房</option>
|
| | | <option value="5">全区/县</option>
|
| | | <option value="2">全市</option>
|
| | | <option value="1">全省</option>
|
| | | </select>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <button class="layui-btn layui-btn-sm mrl8" id="batchAdd"><i class="fa fa-plus mrr8"></i>添加电池组</button>
|
| | | <button class="layui-btn layui-btn-sm" id="batchSetCurr">批量设置放电参数</button>
|
| | | <button class="layui-btn layui-btn-sm" id="startTest">批量启动测试</button>
|
| | | <button class="layui-btn layui-btn-sm" id="startTest">批量启动测试</button>
|
| | | <button class="layui-btn layui-btn-sm" id="export_table"><s:text name="Export"/><!-- 导出 --></button>
|
| | | <!-- <button class="layui-btn layui-btn-sm" id="noNuclearExport">批量导入待核容设备</button> -->
|
| | | </div>
|
| | | </div>
|
| | | <!-- 表格内容 -->
|
| | | <table id="pageTbl" lay-filter="pageTbl"></table>
|
| | | <table id="pageTbl" lay-filter="pageTbl"></table>
|
| | | </div>
|
| | | </div>
|
| | | <!-- bts设备弹出框 -->
|
| | |
| | | // 查询区县
|
| | | searchCounty(true);
|
| | | });
|
| | | |
| | |
|
| | | $('#export_table').click(function(){
|
| | | var data = table.checkStatus('pageTbl').data;
|
| | | if (data.length) {
|
| | | table.exportFile('pageTbl', data, 'xls');
|
| | | } else {
|
| | | layer.msg("请选中要导出的记录");
|
| | | }
|
| | | });
|
| | |
|
| | | // 查询区/县
|
| | | function searchCounty(isLoad) {
|
| | |
| | |
|
| | | // 生成表格数据
|
| | | table.render(tOptions);
|
| | | |
| | |
|
| | | // 点击表格中的工具按钮
|
| | | table.on('tool(pageTbl)', function(obj){
|
| | | //console.log(obj);
|
| | |
| | | break;
|
| | | };
|
| | | });
|
| | |
|
| | | // 检测是否有批量核容权限
|
| | | // 如果有权限就无感操作
|
| | | // 如果无权限 不让多选 弹窗提示无权限
|
| | | // $('body').on('click', )
|
| | |
|
| | | // 表格中行的选中事件
|
| | | table.on("checkbox(pageTbl)", function (obj) {
|
| | | // console.log('check');
|
| | | // console.log($(this));
|
| | | // console.log($(this).siblings('input'));
|
| | | // console.log(table.checkStatus('pageTbl').data.length);
|
| | | // console.log(table.checkStatus('pageTbl').data);
|
| | | var batt_discharge_model_permit = checkUserPermit(permits, 'batt_discharge_model_permit');
|
| | | if(table.checkStatus('pageTbl').data.length > 1 && !batt_discharge_model_permit) {
|
| | | layer.msg('当前用户没有批量核容权限');
|
| | | // 更新表单 显示
|
| | | $(this).siblings('input').prop('checked', false);
|
| | | form.render("checkbox");
|
| | |
|
| | | // 更新表格数据
|
| | | obj.checked = false;
|
| | | obj.update({
|
| | | LAY_CHECKED: false
|
| | | });
|
| | | }
|
| | | });
|
| | |
|
| | | // 表格行 全选事件
|
| | | form.on('checkbox(layTableAllChoose)', function (obj) {
|
| | | // console.log('selectAll');
|
| | | var child = $(".layui-table-box input[type='checkbox']");
|
| | | |
| | | var batt_discharge_model_permit = checkUserPermit(permits, 'batt_discharge_model_permit');
|
| | | if (!batt_discharge_model_permit) {
|
| | | layer.msg('当前用户没有批量核容权限');
|
| | | child.each(function (index, item) {
|
| | | if($(item).is(':checked')) {
|
| | | $(item).prop('checked', true);
|
| | | return true;
|
| | | }
|
| | | $(item).prop('checked', false);
|
| | | });
|
| | | // 全选框取消选择
|
| | | $(obj.elem).prop('checked', false);
|
| | | form.render('checkbox');
|
| | | }
|
| | | });
|
| | |
|
| | | |
| | |
|
| | | // 跳转到实时界面
|
| | | function targetControl(obj) {
|
| | |
| | | if(rs.code == 1) {
|
| | | var data = rs.data;
|
| | | // console.log(data);
|
| | | layuiTbl.getCache(table.cache['pageTbl']);
|
| | | for(var i=0; i<data.length; i++) {
|
| | | var obj = data[i];
|
| | | if(obj.fstate.num > 0){
|
| | |
| | | }
|
| | | // 设置文本值
|
| | | str = "状态:" + workStates[index]+
|
| | | ",告警:"+alarmStates[obj.fstate.dev_alarmstate]+
|
| | | ",组端电压(V):"+obj.fstate.dev_captest_groupvol+
|
| | | ",电流(A):"+obj.fstate.dev_captest_curr+
|
| | | ",容量(AH):"+obj.fstate.dev_captest_cap;
|
| | | ",告警:"+alarmStates[obj.fstate.dev_alarmstate]+
|
| | | ",组端电压(V):"+obj.fstate.dev_captest_groupvol+
|
| | | ",电流(A):"+obj.fstate.dev_captest_curr+
|
| | | ",容量(AH):"+obj.fstate.dev_captest_cap;
|
| | | if(index == 3){
|
| | | str = "状态:"+workStates[index]+
|
| | | ",组号:"+obj.fstate.dev_testgroupnum+
|
| | | ",当前单体编号:"+(obj.fstate.dev_restest_monindex+1)+
|
| | | ",被测单体总数:"+obj.fstate.dev_restest_moncount;
|
| | | ",组号:"+obj.fstate.dev_testgroupnum+
|
| | | ",当前单体编号:"+(obj.fstate.dev_restest_monindex+1)+
|
| | | ",被测单体总数:"+obj.fstate.dev_restest_moncount;
|
| | | }
|
| | | var temp = {
|
| | | devStatus: str // 设备状态
|
| | |
| | | // 如果有查询结果
|
| | | if(rs.code == 1) {
|
| | | var data = rs.data;
|
| | | layuiTbl.getCache(table.cache["pageTbl"]);
|
| | | for(var i=0; i<data.length; i++) {
|
| | | var _data = data[i];
|
| | | _data = _data[0];
|
| | |
| | | var monCap = _data.dev_captest_cap==0?_data.dev_captest_cap:_data.dev_captest_cap.toFixed(1);
|
| | | // 设置设备状态字符串
|
| | | str = "状态:" + workStates[index]+
|
| | | ",告警:"+alarmStates[_data.dev_alarmstate]+
|
| | | ",组端电压(V):"+_data.dev_captest_groupvol+
|
| | | ",在线电压(V):"+_data.dev_captest_onlinevol+
|
| | | ",电流(A):"+_data.dev_captest_curr+
|
| | | ",容量(AH):"+monCap;
|
| | | ",告警:"+alarmStates[_data.dev_alarmstate]+
|
| | | ",在线电压(V):"+_data.dev_captest_onlinevol+
|
| | | ",电流(A):"+_data.dev_captest_curr+
|
| | | ",容量(AH):"+monCap;
|
| | | // 设置设备内阻测试的字符串
|
| | | if(index == 3){
|
| | | str = "状态:"+workStates[index]+
|
| | | ",组号:"+_data.dev_testgroupnum+
|
| | | ",当前单体编号:"+(_data.dev_restest_monindex+1)+
|
| | | ",被测单体总数:"+_data.dev_restest_moncount;
|
| | | ",组号:"+_data.dev_testgroupnum+
|
| | | ",当前单体编号:"+(_data.dev_restest_monindex+1)+
|
| | | ",被测单体总数:"+_data.dev_restest_moncount;
|
| | | }
|
| | | // 构造更新表格数据对象
|
| | | var temp = {
|
| | |
| | | <%
|
| | | String path = request.getContextPath();
|
| | | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
|
| | | // 是否是从告警页面跳转过来的 如果是 就要弹窗新增问题 并选好筛选条件
|
| | | String popFlag = request.getParameter("fromwarn") == null ? "0" : request.getParameter("fromwarn");
|
| | | // System.out.print(popFlag);
|
| | | %>
|
| | | <%@ taglib uri="/struts-tags" prefix="s"%>
|
| | | <!DOCTYPE HTML>
|
| | |
| | | </script>
|
| | | <script type="text/javascript">
|
| | | var permits;
|
| | | var popFlag = 0;
|
| | | <% Object obj=session.getAttribute("permits");
|
| | | if(obj!=null){
|
| | | String permits =obj.toString(); %>
|
| | | permits=<%=permits%>;
|
| | | popFlag = <%=popFlag%>;
|
| | | //console.info(json);
|
| | | <% } %>
|
| | | |
| | |
|
| | | var Page = {
|
| | | pageCurr:1,
|
| | | pageSize:10,
|
| | | pageAll:0
|
| | | };
|
| | |
|
| | | var searchFlag = true;
|
| | | // 如果是从告警页面跳转过来的 先不执行查询 关闭问题记录窗之后再更新为可查询
|
| | | if (popFlag) {
|
| | | searchFlag = false;
|
| | | }
|
| | |
|
| | | // 应用layui框架
|
| | | layui.use(['layer', 'table', 'form', 'laytpl', 'element','jquery'],function() {
|
| | |
| | |
|
| | | });
|
| | |
|
| | | // 如果是从告警页面跳转过来的 要打开弹窗并给对应的筛选条件
|
| | | $(function () {
|
| | | var searchStr = window.location.search;
|
| | | if (popFlag) {
|
| | | // layer.msg('是否是从告警页面跳转过来的');
|
| | | layer.open({
|
| | | type: 2,
|
| | | title: '<span style="font-weight:bold">>>问题添加</span>',
|
| | | area: ['1200px', '600px'],
|
| | | fixed: false, //不固定
|
| | | resize: false,
|
| | | maxmin: true,
|
| | | content: 'iframe/batt-fault-manage-add1.html' + searchStr
|
| | | ,cancel: function (index, layero) {
|
| | | searchFlag = true;
|
| | | // if(confirm('关闭吗?')) {
|
| | | // layer.close(index);
|
| | | // }
|
| | | // return false;
|
| | | }
|
| | | });
|
| | | }
|
| | | });
|
| | |
|
| | | // 查询故障详情
|
| | | function faultDetails(data) {
|
| | | var imgOpts = setDetailsOpts(data);
|
| | |
| | | // 查询故障内容
|
| | | function searchfault()
|
| | | {
|
| | | // searchFlag |
| | | // 当从告警页跳转过来 searchFlag为false 不执行查询
|
| | | // 当问题记录窗关闭时 searchFlag为true 可执行查询
|
| | | if (!searchFlag) {
|
| | | return false;
|
| | | }
|
| | | var sData = tempCondition();
|
| | | var load = layer.load(1);
|
| | | tOptions.data = [];
|
| | |
| | | font-size: 16px;
|
| | | vertical-align: middle;
|
| | | }
|
| | | .panel_warning {
|
| | | display: none;
|
| | | height: 400px;
|
| | | }
|
| | | .warning_container {
|
| | | float: left;
|
| | | width: 35%;
|
| | | height: 100%;
|
| | | padding: 10px 20px;
|
| | | overflow-y: auto;
|
| | | -webkit-box-sizing: border-box;
|
| | | -moz-box-sizing: border-box;
|
| | | box-sizing: border-box;
|
| | | }
|
| | | .warning_container:first-of-type {
|
| | | width: 65%;
|
| | | }
|
| | | .warning_title {
|
| | | font-size: 18px;
|
| | | margin-bottom: 6px;
|
| | | color: #333;
|
| | | font-weight: bold;
|
| | | }
|
| | | .warning_container th {
|
| | | text-align: center;
|
| | | }
|
| | | .warning_container thead {
|
| | | background: #e0edff;
|
| | | }
|
| | | .warning_container th,
|
| | | #bat_warning td,
|
| | | #dev_warning td {
|
| | | border: 1px #ccc solid;
|
| | | vertical-align: middle;
|
| | | height: 24px;
|
| | | padding: 2px 4px;
|
| | | }
|
| | | .warning_container thead th:first-of-type {
|
| | | width: 7em;
|
| | | }
|
| | | .warning_content > div {
|
| | | font-size: 20px;
|
| | | line-height: 1.6;
|
| | | text-indent: 1.4em;
|
| | | color: #008000;
|
| | | }
|
| | | .warning_container ul li {
|
| | | margin-bottom: 8px;
|
| | | }
|
| | | .warning_container span {
|
| | | color: #f00;
|
| | | font-weight: bold;
|
| | | padding-right: 1em;
|
| | | }
|
| | | </style>
|
| | |
|
| | | </head>
|
| | |
| | | </li>
|
| | | <li><span id="MonJHCurr">均衡电流</span>
|
| | | </li>
|
| | | <li><span id="Warning">告警</span>
|
| | | </li>
|
| | | </ul>
|
| | | </div>
|
| | | <!-- <div id="ele_statue"></div> -->
|
| | |
| | | </a>
|
| | | </div>
|
| | | </div>
|
| | |
|
| | | <!-- 告警面板 -->
|
| | | <div class="panel_warning">
|
| | | <!-- 电池组告警 -->
|
| | | <div class="warning_container">
|
| | | <div class="warning_title">电池组告警</div>
|
| | | <div id="bat_warning" class="warning_content"></div>
|
| | | </div>
|
| | | <!-- 设备告警 -->
|
| | | <div class="warning_container">
|
| | | <div class="warning_title">设备告警</div>
|
| | | <div id="dev_warning" class="warning_content"></div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <!--放大后的条形图-->
|
| | | <div id="big_echarts">
|
| | |
| | | <!-- 鼠标右键菜单显示 -->
|
| | | <div id="right_menu">
|
| | | <ul>
|
| | | <li><a href="javascript:"><s:text name="Check_the_battery_card"></s:text></a></li> <!-- 查看电池组机历卡 -->
|
| | | <li><a href="javascript:"><s:text name="Check_the_battery_card"></s:text></a></li> <!-- 查看电池组机历卡 -->
|
| | | <!-- 修改电池组信息 需要有相关权限 -->
|
| | | <li id="battcfg_modify" style="display: none;"><a href="javascript:;" class="btn_battcfg_modify">修改电池组信息</a></li>
|
| | | <!-- <li><a href="upload.jsp" target="_blank"><s:text name="Upload_FBO/IDC_data"></s:text></a></li> --> <!-- 上传'FBO/IDC'数据 -->
|
| | | <!-- <li><a href="uploadresis.jsp" target="_blank"><s:text name="Upload_resistance_conductivity_data"></s:text></a></li> --> <!-- 上传电阻电导数据 -->
|
| | | <li><a href="eleBrdwMaint.jsp" target="_blank"><s:text name="Batt_failure_maintenance_record_query" /></a></li> <!-- 电池故障维护记录查询 -->
|
| | |
| | | <div class="clear"></div>
|
| | | <!-- iframe数据临时存储位置 -->
|
| | | <div id="homeInfoIframeData"></div>
|
| | | <!-- 存储iframe -->
|
| | | <div id="iframeEdit"></div>
|
| | | <!-- 关闭页面中iframe弹出层 -->
|
| | | <div id="iframeClose"></div>
|
| | | <!-- 引入layui框架 -->
|
| | | <script type="text/javascript" src="src/layui.all.js"></script>
|
| | | <script type="text/javascript" src="pages/js/common.js"></script>
|
| | |
| | | permits=<%=permits%>;
|
| | | //console.info(json);
|
| | | <% } %>
|
| | |
|
| | | //拓扑图状态对象
|
| | | var mygraph = {
|
| | | battstate:0,
|
| | |
| | | var isFirLoadPage = 1; // 判断是否是第一次加载页面
|
| | |
|
| | | var BattGroupId=0; //当前选中的电池组id
|
| | | var _StationName = ""; //当前选中的电池组所对应的设备名称 机房名称
|
| | |
|
| | | var cPicker = {
|
| | | 'min': 'red',
|
| | |
| | | $(".ele-circle .tools-btn").remove();
|
| | | }
|
| | |
|
| | | });
|
| | |
|
| | | // 判断有没有修改电池组信息的权限
|
| | | $(function() {
|
| | | var modify = checkUserPermit(permits, 'battcfg_modify_permit');
|
| | | if(modify) {
|
| | | $("#battcfg_modify").css('display', 'block');
|
| | | }
|
| | | });
|
| | |
|
| | |
|
| | |
| | | if(lname != 'eleCircleBtn') {
|
| | | table_index = $(this).index();
|
| | | }
|
| | |
|
| | | // 添加一个新的tab 显示当前站点警概况
|
| | | if (lname == 'Warning') {
|
| | | // console.log('warning');
|
| | | // 准备告警数据
|
| | | // 如果告警数据变化不是很频繁 此处可以优化为不是每次取数据 可以页面进来就取数据 这里只处理显示 隐藏
|
| | | // 查询电池组告警信息
|
| | | getBatWarning();
|
| | | // 查询设备告警信息
|
| | | getDevWarning();
|
| | | |
| | | // 点击告警标签 隐藏下方表格 其他标签再显示表格 ##tbHead , #tbBrdw
|
| | | $('.graph, .ele-circle, #tbHead, #tbBrdw').hide();
|
| | | $('.panel_warning').show();
|
| | | return false;
|
| | | } else {
|
| | | $('#tbHead, #tbBrdw').show();
|
| | | $('.panel_warning').hide();
|
| | | }
|
| | |
|
| | | createPicture();
|
| | | setTitle();
|
| | | });
|
| | | |
| | |
|
| | | // 获取电池组的告警信息
|
| | | function getBatWarning () {
|
| | | var param = {
|
| | | "bmd.page.pageCurr": 1,
|
| | | "bmd.page.pageSize": 99999,
|
| | | "bmd.binf.StationName1": "",
|
| | | "bmd.binf.StationName2": "",
|
| | | "bmd.binf.StationName5": "",
|
| | | "bmd.binf.StationName": "",
|
| | | "bmd.binf.BattGroupId": BattGroupId,
|
| | | "bmd.mainf.usr_id": 119001,
|
| | | "bmd.mainf.fault_type_id": 119002,
|
| | | "bmd.mainf.fault_level": 119003,
|
| | | "bmd.mainf.record_uid": 119004,
|
| | | "bmd.adata.MonNum": 0,
|
| | | "bmd.adata.Record_Id": 0,
|
| | | "bmd.mainf.maint_type_id": 119005,
|
| | | "bmd.mainf.maint_close": 119007,
|
| | | "bmd.mainf.master_id": 0,
|
| | | "bmd.mainf.maint_done": 119006,
|
| | | "bmd.adata.alm_id": 1,
|
| | | "bmd.adata.alm_signal_id": 0,
|
| | | "bmd.mainf.num": 1,
|
| | | "bmd.mainf.BattGroupId": 2,
|
| | | "bmd.mainf.master_audit": 3,
|
| | | "bmd.mainf.appoint_uid": 4,
|
| | | "bmd.binf.num": 1
|
| | | }
|
| | | var _param = objTransUrlParams(param);
|
| | | // console.log(b);
|
| | | $.post("Battalarm_dataAction!serchByCondition", _param, function(data){
|
| | | data=JSON.parse(data.result);
|
| | | console.info(data);
|
| | |
|
| | | // layer.close(alarmLoad); |
| | | if(data.code==1 && data.data.length>1) {
|
| | | var _data = data.data;
|
| | | var obj = {};
|
| | | for (let i = 0, j = _data.length; i < j - 1; i++) {
|
| | | // 告警类型
|
| | | let warntype = _data[i].binf.StationName8;
|
| | | obj[warntype] = obj[warntype] || [];
|
| | | obj[warntype].push("#" + _data[i].adata.MonNum);
|
| | | }
|
| | |
|
| | | var $html = "<table><thead><tr><th>告警类型</th><th>单体列表</th></tr></thead><tbody>";
|
| | | Object.keys(obj).forEach(function (c, i, a) {
|
| | | $html += "<tr><th>" + c + "</th><td>" + obj[c].join(', ') + "</td>";
|
| | | });
|
| | |
|
| | | $html += "</tbody></table>";
|
| | | $('#bat_warning').html($html);
|
| | | } else {
|
| | | $('#bat_warning').html("<div>暂无告警</div>");
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | // 查询设备告警
|
| | | function getDevWarning () {
|
| | | var param = {
|
| | | "stationName1": "",
|
| | | "stationName2": "",
|
| | | "stationName5": "",
|
| | | "stationName": _StationName,
|
| | | "alm_type": "0",
|
| | | "page": {
|
| | | "pageSize": 99999,
|
| | | "pageCurr": 1
|
| | | }
|
| | | }
|
| | | var _param = "json=" + JSON.stringify(param);
|
| | | // console.log(b);
|
| | | // $.ajax({ |
| | | // type:"post", |
| | | // url: "Batt_devalarm_dataAction!serchByInfo", |
| | | // async:true, |
| | | // dataType:'text',
|
| | | // data: "json="+JSON.stringify(temp), |
| | | // success: function(data){},
|
| | | // error: function () {}
|
| | | // });
|
| | | $.post("Batt_devalarm_dataAction!serchByInfo", _param, function (data){
|
| | | data=JSON.parse(data.result);
|
| | | console.info(data);
|
| | | |
| | | // layer.close(alarmLoad); |
| | | if(data.code==1 && data.data.length>0) {
|
| | | var $html = "<table><thead><tr><th>序号</th><th>告警类型</th></tr></thead><tbody>";
|
| | | var _data = data.data;
|
| | | for (var i = 0, j = _data.length; i < j; i++) {
|
| | | var str = getAlarmTypeByAlmType(_data[i].alm_type);
|
| | | $html += "<tr><th>" + (i + 1) + "</th><td>" + str + "</td>";
|
| | | }
|
| | | $html += "</tbody></table>";
|
| | | $('#dev_warning').html($html);
|
| | | } else {
|
| | | $('#dev_warning').html("<div>暂无告警</div>");
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | //获取设备的告警类型
|
| | | function getAlarmTypeByAlmType(alm_type){
|
| | | if(alm_type>0){
|
| | | switch(alm_type){
|
| | | case 618501:return "继电器K1告警";
|
| | | case 618502:return "通讯告警";
|
| | | case 618503:return "设备过温告警";
|
| | | case 618504:return "二极管D1告警";
|
| | | case 119023:return "续航不足告警";
|
| | | case 119024:return "基站停电告警";
|
| | | case 119025:return "基站发电告警";
|
| | | case 119026:return "基站掉站告警";
|
| | | case 119027:return "基站开门告警";
|
| | | case 119028:return "设备高温告警";
|
| | | case 119032:return "设备SD卡故障";
|
| | | case 119033:return "采集线告警";
|
| | | }
|
| | | }
|
| | | return "通信故障";
|
| | | }
|
| | |
|
| | | function objTransUrlParams(obj) {
|
| | | var params = [];
|
| | | Object.keys(obj).forEach((key) => {
|
| | | let value = obj[key]
|
| | | // 如果值为undefined我们将其置空
|
| | | if (typeof value === 'undefined') {
|
| | | value = ''
|
| | | }
|
| | | // 对于需要编码的文本(比如说中文)我们要进行编码
|
| | | params.push([key, encodeURIComponent(value)].join('='))
|
| | | })
|
| | | return params.join('&')
|
| | | }
|
| | |
|
| | | // 对页面进行初始化
|
| | | function initPage() {
|
| | | var winHt = $(window).height();
|
| | |
| | | max = (Math.max.apply( Math, array)*1.1).toFixed(3);
|
| | | }
|
| | | //console.info("max:"+max+" min:"+min);
|
| | | if(lname=='Resistance' || lname=='Temperature'){
|
| | | CreateResistanceEchart(oConEcharts,unit, realname, mon_num_list, array,tname,max,min, cPicker);
|
| | | $('.graph').show();
|
| | | $('.ele-circle').hide();
|
| | | if(lname=='Warning'){
|
| | | $('.graph, .ele-circle').hide();
|
| | | $('.panel_warning').show();
|
| | | }else if(lname == 'eleCircleBtn') {
|
| | | $('.graph').hide();
|
| | | $('.graph, .panel_warning').hide();
|
| | | $('.ele-circle').show();
|
| | | }else{
|
| | | $('.ele-circle, .panel_warning').hide();
|
| | | $('.graph').show();
|
| | | $('.ele-circle').hide();
|
| | | CreateEchart(oConEcharts,unit, realname, mon_num_list, array,tname,max,min,cPicker);
|
| | | }
|
| | | maxflag=true;
|
| | | minflag=true;
|
| | | myChart.resize();
|
| | | //debugger;
|
| | | }
|
| | |
|
| | | function getArray(name){
|
| | |
| | | });
|
| | | // 菜单栏鼠标右键菜单显示
|
| | | $(document).ready(function(){
|
| | | $('#ele_content').on('mousedown', '.eleGroup', function(e){
|
| | | /*$('#ele_content').on('mousedown', '.eleGroup', function(e){
|
| | | alert(123);
|
| | | //利用jquery的方式获取当前点击的是否是右键
|
| | | if(e.which==3)
|
| | |
| | | setPosition($("#right_menu"),disX, disY);
|
| | |
|
| | | }
|
| | | });
|
| | | });*/
|
| | |
|
| | | //利用not选中器使不是点击.thr时就隐藏菜单
|
| | | $("body:not('.thr')").click(function(){
|
| | |
| | | findrtdata();
|
| | | //查询设备的dcdc状态
|
| | | searchDevDcDcState();
|
| | |
|
| | | // 查询电池组告警信息
|
| | | getBatWarning();
|
| | | // 查询设备告警信息
|
| | | getDevWarning();
|
| | |
|
| | | // 更新拓扑图状态
|
| | | searchDevStatusByDev_id();
|
| | |
| | | _str = GLOBAL.circleStatus.BTSCircle(batt, model, mygraph, updateEleCircle);
|
| | | }
|
| | | //console.log(mygraph);
|
| | | //debugger;
|
| | | if(model.code == 1) {
|
| | | var _data = model.data[0];
|
| | |
|
| | |
| | | var treeView = new TreeView($('#lside'));
|
| | | $('#lside').width($('#ele_content').width());
|
| | | treeView.setContainer();
|
| | |
|
| | | var iframePopup; // 页面中iframe的弹出层
|
| | | var layer; // 弹出框模块
|
| | | layui.use(['layer'], function() {
|
| | | layer = layui.layer; // 获取弹出框模块
|
| | | });
|
| | |
|
| | | $('#iframeClose').click(function() {
|
| | | layer.close(iframePopup);
|
| | | });
|
| | | // 设置容器可拖动
|
| | | $('#ele_content').resizable({
|
| | | handles: 'e',
|
| | |
| | | var eleGroup = $(this).data('attr');
|
| | | var status = GLOBAL.circleStatus.status;
|
| | | var btsOpts = GLOBAL.circleStatus.btsOpts;
|
| | | _StationName = eleGroup.StationName;
|
| | | // 根据BattGroupId查询数据
|
| | | if(BattGroupId != eleGroup.BattGroupId) {
|
| | | BattGroupId = eleGroup.BattGroupId;
|
| | |
| | | changeEleCircleOpt(eleCircle, 'disCurrMax', {name:'最大核容电流:'+disCurrMax}); */
|
| | | searchBattLife(); // 查询本站续航时长
|
| | |
|
| | | // 查询电池组告警信息
|
| | | getBatWarning();
|
| | | // 查询设备告警信息
|
| | | getDevWarning();
|
| | |
|
| | | getBattStr();
|
| | | searchBattAlarmParam(); //查询电池告警参数
|
| | | searchDevSDState();
|
| | |
| | | if(e.which==3)
|
| | | {
|
| | | BattGroupId=$(this).attr("id");
|
| | | var eleGroup = $(this).data('attr');
|
| | | _StationName = eleGroup.StationName;
|
| | |
|
| | | var disX=(e||event).clientX+10; //得到鼠标点击X的位置
|
| | | var disY=(e||event).clientY+10; //得到鼠标点击Y的位置
|
| | | var scrollY=$(window).scrollTop(); //获取浏览器滚动的高度
|
| | | //console.log(scrollY);
|
| | | var oRightMenu=document.getElementById("right_menu");
|
| | |
|
| | | $(this).click();
|
| | | // TODO
|
| | | // $(this).click();
|
| | |
|
| | | //显示菜单内容
|
| | | $("#right_menu").show();
|
| | |
| | | $('#all_hide').click(function(){
|
| | | treeView.ele.find('li').removeClass('sider-menu-open');
|
| | | });
|
| | |
|
| | | // 修改电池组信息
|
| | | $('body').on('click', '.btn_battcfg_modify', function() {
|
| | | // 如果是右侧拓普图这边点击 就要getBatt() 获取当前active状态的电池组信息
|
| | | var stationName = _StationName
|
| | | if ( $(this).hasClass('needCheckActive') ) {
|
| | | stationName = getBatt().StationName;
|
| | | }
|
| | | battcfg_modify(stationName);
|
| | | });
|
| | |
|
| | | // 修改电池组信息
|
| | | function battcfg_modify (param) {
|
| | | // 根据机房的名称查询机房的信息
|
| | | var temp = {
|
| | | binf:{
|
| | | StationName1: '', // 省
|
| | | StationName2: '', // 市
|
| | | StationName5: '', // 区/县
|
| | | StationName: param // 机房名称
|
| | | }
|
| | | ,page: {
|
| | | pageCurr: 1
|
| | | ,pageSize: 100
|
| | | }
|
| | | };
|
| | | |
| | | var load = layer.load(1);
|
| | | // 请求后台
|
| | | $.ajax({
|
| | | type: "post", |
| | | url: "BattInfAction!searchInform", |
| | | async: true, |
| | | dataType: 'json',
|
| | | data:"json=" + JSON.stringify(temp),
|
| | | success: function(res){
|
| | | var rs = JSON.parse(res.result)
|
| | | if(rs.code == 1) {
|
| | | var data = rs.data;
|
| | | var tmp = {
|
| | | btsinfo: []
|
| | | };
|
| | | // 遍历查询结果
|
| | | for(var i = 0, j = data.length; i < j; i++) {
|
| | | var _data = data[i];
|
| | | // 遍历结果集生成特殊的格式数据
|
| | | var _tmp = {};
|
| | | Object.keys(_data).forEach(function(key) {
|
| | | switch (key) {
|
| | | // 设备索引
|
| | | case "GroupIndexInFBSDevice":
|
| | | // 电池组名称
|
| | | case "BattGroupName":
|
| | | // 电池组ID
|
| | | case "BattGroupId":
|
| | | // 单体数量
|
| | | case "MonCount":
|
| | | // 标称容量
|
| | | case "MonCapStd":
|
| | | // 单体电压
|
| | | case "MonVolStd":
|
| | | // 电池品牌
|
| | | case "BattProducer":
|
| | | // 电池型号
|
| | | case "BattModel":
|
| | | _tmp[key] = _data[key];
|
| | | break;
|
| | | default:
|
| | | tmp[key] = _data[key];
|
| | | break;
|
| | | }
|
| | | });
|
| | | tmp.btsinfo.push(_tmp);
|
| | | }
|
| | | |
| | | //console.log(tmp);
|
| | | $('#iframeEdit').data('data', tmp);
|
| | | iframePopup = layer.open({
|
| | | type: 2
|
| | | ,title: '修改电池组'
|
| | | ,area:['1200px', '620px']
|
| | | ,resize: false
|
| | | ,content: 'iframe/batt-info-edit.html'
|
| | | });
|
| | | }else {
|
| | | layer.msg('获取数据失败!')
|
| | | }
|
| | | },
|
| | | complete: function() {
|
| | | layer.close(load);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | // 电路拓扑图右键菜单
|
| | | var menuItems = [
|
| | |
| | | {txt: '设备充放电模块状态', cla:'target', data: {target: 'equip-charge-param.jsp'}},
|
| | | {txt: '机房历史事件查询', cla:'target', data: {target: 'batt-state-statistical.jsp'}},
|
| | | ];
|
| | |
|
| | | // 如果有修改电池组信息的权限 添加右键菜单
|
| | | if ( checkUserPermit(permits, 'battcfg_modify_permit') ) {
|
| | | menuItems.splice(2, 0, {txt: '修改电池信息', cla: 'btn_battcfg_modify needCheckActive'});
|
| | | }
|
| | |
|
| | | // 给表格添加自己的右键菜单
|
| | | $('#contai').on('mousedown','.ele-circle canvas',function(e){
|
| | | var batt = getBatt();
|
| | |
| | | //console.log(sdStatus);
|
| | | status.setText('sdCard', "SD卡状态:"+sdStatus);
|
| | | clearTimeout(searchDevSDState.timeout);
|
| | | searchDevSDState.timeout = setTimeout(function() { |
| | | searchDevSDState(); |
| | | searchDevSDState.timeout = setTimeout(function() {
|
| | | searchDevSDState();
|
| | | }, 2000);
|
| | | },
|
| | | error: function() {
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | </script>
|
| | | <script type="text/javascript" src="js/Title.js"></script>
|
| | | <script type="text/javascript" src="js/control.js"></script>
|
| | |
| | | }
|
| | | #con_tab ul{
|
| | | width:100%;
|
| | | min-width: 820px;
|
| | | height:30px;
|
| | | background: url(../image/table_th_bg.gif) repeat-x;
|
| | | }
|
| | | #con_tab li{
|
| | | float: left;
|
| | | width:120px;
|
| | | width:112px;
|
| | | height:30px;
|
| | | text-align: center;
|
| | | line-height: 30px;
|
| | |
| | | }
|
| | | .action{
|
| | | display: block;
|
| | | width:100px;
|
| | | /*width:100px;*/
|
| | | height:36px;
|
| | | margin-top:4px;
|
| | | margin-left:20px;
|
| | |
| | | }
|
| | | #con_tab span:hover{
|
| | | display: block;
|
| | | width:100px;
|
| | | /*width:100px;*/
|
| | | height:36px;
|
| | | margin-top:4px;
|
| | | margin-left:20px;
|
| | |
| | | <td>市</td> <!-- 市 -->
|
| | | <td>区/县</td> <!-- 市 -->
|
| | | <td><s:text name="Computer_name"/></td> <!-- 机房名称 -->
|
| | | <td colspan="2">更换日期</td> <!-- 更换日期 style="width: 30%;" -->
|
| | | </tr>
|
| | | <tr>
|
| | | <td>
|
| | |
| | | </div>
|
| | | </div>
|
| | | </td>
|
| | | <td><input type="text" id="replace_date" readonly="readonly" name="replace_date" /></td>
|
| | | <td><input type="text" id="replace_date1" readonly="readonly" name="replace_date1" /></td>
|
| | | </tr>
|
| | | </table>
|
| | | </div>
|
| | |
| | | //console.info(json);
|
| | | <% } %>
|
| | |
|
| | | layui.use(['form', 'table', 'layer', 'element'], function() {
|
| | | layui.use(['form', 'table', 'layer', 'element', 'laydate'], function() {
|
| | | /* 页面导入layui模块 */
|
| | | var table = layui.table; // 获取表格模块
|
| | | var form = layui.form; // 获取表单模块
|
| | | var layer = layui.layer; // 获取弹出框模块
|
| | | var element = layui.element; // 获取元素操作模块
|
| | | var laytpl = layui.laytpl; // 获取模板操作模块
|
| | | var laydate = layui.laydate; // 获取laydate模块
|
| | |
|
| | | /* 分页信息模块 */
|
| | | var Page = new TblPage(); // 实例化TblPage对象--验收的的审核信息
|
| | |
| | | });
|
| | |
|
| | | pagePage.init(Page, search);
|
| | | |
| | | // 更换日期起
|
| | | laydate.render({
|
| | | elem: '#replace_date'
|
| | | ,format: 'yyyy-MM-dd'
|
| | | ,value: "2001-01-01"
|
| | | ,showBottom: false
|
| | | });
|
| | | |
| | | // 更换日期止
|
| | | laydate.render({
|
| | | elem: '#replace_date1'
|
| | | ,format: 'yyyy-MM-dd'
|
| | | ,value: new Date()
|
| | | ,showBottom: false
|
| | | });
|
| | |
|
| | | // 省-市-区县-机房联动
|
| | | var isNewLoad = true;
|
| | |
| | | {type:'checkbox',fixed: 'left'}
|
| | | ,{field:'stationid', title:'机房编号', align:'center', width: 120}
|
| | | ,{field:'stationname', title:'机房名称', align:'center', minWidth: 400}
|
| | | ,{field:'battgroupname', title:'电池组名称', align:'center', width: 180}
|
| | | ,{field:'replaced_producer', title:'电池品牌', align:'center', width: 180}
|
| | | ,{field:'replaced_moncapstd', title:'标称容量(AH)', align:'center', width: 160}
|
| | | ,{field:'replaced_monvolstd', title:'标称电压(V)', align:'center', width: 160}
|
| | | ,{field:'replaced_moncount', title:'单体数量', align:'center', width: 120}
|
| | | ,{field:'replaced_reason', title:'更换理由', align:'center', minWidth: 300}
|
| | | ,{field:'replaced_time', title:'更换时间', align:'center', width: 160}
|
| | | ,{field:'replace_date', title:'更换日期', align:'center', minWidth: 160}
|
| | | ,{field:'replaced_time', title:'记录时间', align:'center', width: 160}
|
| | | ,{field: 'replaced_uname', title: '更换人', align: 'center', width: 160}
|
| | | ,{field:'doThings', fixed: 'right', title:'操作', align: 'center', toolbar: '#doThings', width:120}
|
| | | ]]
|
| | |
| | | layer.open({
|
| | | type: 2
|
| | | ,title: '修改机房更换信息'
|
| | | ,area:['770px', '425px']
|
| | | ,area:['770px', '490px']
|
| | | ,resize: false
|
| | | ,content: 'iframe/ele-change-manage-edit.html'
|
| | | });
|
| | |
| | | layer.open({
|
| | | type: 2
|
| | | ,title: '添加机房更换信息'
|
| | | ,area:['1200px', '460px']
|
| | | ,area:['1200px', '520px']
|
| | | ,fixed: false //不固定
|
| | | ,resize: true
|
| | | ,maxHeight: 660
|
| | |
| | | if(rs.code == 1) {
|
| | | var data = rs.data;
|
| | | // console.log(data);
|
| | | tOptions.data = data;
|
| | | Page.setAll(data.length); // 设置值
|
| | | tOptions.data = formatDate(data);
|
| | | Page.setAll(data[data.length - 1].page.pageAll); // 设置值
|
| | |
|
| | | }else {
|
| | |
|
| | | layer.msg('暂无数据!');
|
| | | }
|
| | | Page.setAll(tOptions.data.length);
|
| | | // Page.setAll(tOptions.data.length);
|
| | | pagePage.setVal(); // 设置分页信息
|
| | | // 生成表格数据
|
| | | table.render(tOptions);
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | // 格式代日期 去掉时分秒
|
| | | // 改数组元素对象的指定键值
|
| | | function formatDate(arr) {
|
| | | for (var i = 0, j = arr.length; i < j; i++) {
|
| | | arr[i].replace_date = arr[i].replace_date.split(' ')[0];
|
| | | }
|
| | | return arr;
|
| | | }
|
| | | |
| | | // 构造查询条件
|
| | | function createSearchForm() {
|
| | | var temp = {
|
| | |
| | | stationname2: $('#city').val(),
|
| | | stationname5: $('#county').val(),
|
| | | stationid: $('#home').val(),
|
| | | replace_date: $('#replace_date').val() + " 00:00:00",
|
| | | replace_date1: $('#replace_date1').val() + " 23:59:59",
|
| | | page: Page.getPage()
|
| | | };
|
| | |
|
| | |
| | | iframePopup = layer.open({
|
| | | type: 2
|
| | | ,title: '修改电池组'
|
| | | ,area:['1200px', '520px']
|
| | | ,area:['1200px', '620px']
|
| | | ,resize: false
|
| | | ,content: 'iframe/batt-info-edit.html'
|
| | | });
|
| | |
| | | $('.tbl-body table tbody tr').removeClass('b8cfe5');
|
| | | $(this).addClass('b8cfe5');
|
| | | }
|
| | |
|
| | | /**
|
| | | * 右键时如果选中了多个 或者选了一个 但是是未确认的行
|
| | | * 右键菜单就不用加 跳转到问题记录页面
|
| | | *
|
| | | * 即 只有选中一个 且状态已确认
|
| | | */
|
| | | // 复制原右键菜单数组 非引用
|
| | | var _menuItems = JSON.parse(JSON.stringify(menuItems));
|
| | | var actLen = $('.tbl-body .b8cfe5').length;
|
| | | if (actLen < 2 && data.adata_H.alm_is_confirmed) {
|
| | | _menuItems.splice(2, 0, {txt: '机房问题记录', cla: 'target', data: {target: 'batt-fault-manage.jsp'}});
|
| | | }
|
| | | //alert($(this).attr('class'));
|
| | | var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
| | | var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
| | | var scrollY=$(document).scrollTop();
|
| | |
|
| | | // 遍历menuItems向data属性中添加data值
|
| | | for(var i=0; i<menuItems.length; i++) {
|
| | | var _menuItems = menuItems[i];
|
| | | _menuItems.data.data = data;
|
| | | for(var i=0; i<_menuItems.length; i++) {
|
| | | var __menuItems = _menuItems[i];
|
| | | __menuItems.data.data = data;
|
| | | }
|
| | |
|
| | | rightMenu.showMenu(menuItems,disX, disY);
|
| | | rightMenu.showMenu(_menuItems,disX, disY);
|
| | | }
|
| | | });
|
| | | });
|
| | |
| | | var data = $(this).data('data');
|
| | | console.log(data);
|
| | | try{
|
| | | var pageName = data.target; // 跳转页面名称
|
| | | var _data = data.data;
|
| | | //console.log(_data);
|
| | | var _binf = _data.binf;
|
| | | var _adata = _data.adata_H;
|
| | | var province = _binf.StationName1; // 省
|
| | | var city = _binf.StationName2; // 市
|
| | | var county = _binf.StationName5; // 区县
|
| | | var home = _binf.StationName; // 机房名称
|
| | | var battid = _adata.BattGroupId; // 电池组id
|
| | | var param = {
|
| | | page: data.target // 跳转页面名称
|
| | | ,province: _binf.StationName1 // 省
|
| | | ,city: _binf.StationName2 // 市
|
| | | ,county: _binf.StationName5 // 区县
|
| | | ,home: _binf.StationName // 机房名称
|
| | | ,battid: _data.adata_H.BattGroupId // 电池组id
|
| | | ,fromwarn: 1
|
| | | }
|
| | | // 实现跳转
|
| | | window.open(skipUrl(pageName, province, city, county, home, battid));
|
| | | window.open(skipURL(param));
|
| | | }catch(e){
|
| | | layer.msg("获取信息失败,跳转失败!");
|
| | | }
|
| | |
| | | <a href="javascript:;" class="en-warn"><s:text name='Confirm_alarm'/></a> <!-- 确认告警 -->
|
| | | <a href="javascript:;" class="cncl-warn"><s:text name='Cancel_alarm'/></a> <!-- 取消告警 -->
|
| | | <a href="javascript:;" class="del"><s:text name='Delete_records'/></a> <!-- 删除记录 -->
|
| | | <a href="javascript:;" class="control">实时数据</a> <!-- 实时数据 -->
|
| | | <a href="javascript:;" class="control fault" data-page="batt-fault-manage.jsp" style="display: none;">机房问题记录</a> <!-- 机房问题记录 -->
|
| | | <a href="javascript:;" class="control" data-page="control.jsp">实时数据</a> <!-- 实时数据 -->
|
| | | </div>
|
| | |
|
| | | <!--主题内容结束-->
|
| | |
| | | var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
| | | var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
| | | var scrollY=$(document).scrollTop();
|
| | |
|
| | | /**
|
| | | * 右键时如果选中了多个 或者选了一个 但是是未确认的行
|
| | | * 右键菜单就不显示 跳转到问题记录页面
|
| | | *
|
| | | * 即 只有选中一个 且状态已确认
|
| | | */
|
| | | // 当前选中的行数
|
| | | var actLen = $('#tbWarn .tr-action').length;
|
| | | if (actLen < 2 && data.adata.alm_is_confirmed) {
|
| | | $('#right-menu .fault').css("display", "block");
|
| | | } else {
|
| | | // 问题记录 隐藏
|
| | | $('#right-menu .fault').css("display", "none");
|
| | | }
|
| | |
|
| | | $('#right-menu').css('top',disY+scrollY+'px');
|
| | | $('#right-menu').css('left',disX+'px');
|
| | | $('#right-menu').find('a').each(function() {
|
| | |
| | | var data=$(this).data();
|
| | | try{
|
| | | var _data = data.data.binf;
|
| | | var pageName = "control.jsp"; // 跳转页面名称
|
| | | var province = _data.StationName1; // 省
|
| | | var city = _data.StationName2; // 市
|
| | | var county = _data.StationName5; // 区县
|
| | | var home = _data.StationName; // 机房名称
|
| | | var battid = _data.BattGroupId; // 电池组ID
|
| | | var param = {
|
| | | page: data.page // 跳转页面名称
|
| | | ,province: _data.StationName1 // 省
|
| | | ,city: _data.StationName2 // 市
|
| | | ,county: _data.StationName5 // 区县
|
| | | ,home: _data.StationName // 机房名称
|
| | | ,battid: _data.BattGroupId // 电池组ID
|
| | | ,fromwarn: 1
|
| | | }
|
| | | // 实现跳转
|
| | | window.open(skipUrl(pageName, province, city, county, home, battid));
|
| | | window.open(skipURL(param));
|
| | | }catch(e){
|
| | | layer.msg("获取信息失败,跳转失败!");
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | tOptions.data =data;
|
| | | debugger;
|
| | | }else {
|
| | | hisPage.setAll(0);
|
| | | }
|
| | |
| | | var actLen = $('#tbBrdw').find('.active').length;
|
| | | //console.info(actLen);
|
| | | if (e.which == 3) {
|
| | | /**
|
| | | * 右键时如果选中了多个 或者选了一个 但是是未确认的行
|
| | | * 右键菜单就不用加 跳转到问题记录页面
|
| | | *
|
| | | * 即 只有选中一个 且状态已确认
|
| | | */
|
| | | // 复制原右键菜单数组 非引用
|
| | | var _menuItems = JSON.parse(JSON.stringify(menuItems));
|
| | | if(actLen < 2) {
|
| | | $('#tbBrdw table tbody tr').removeClass('active');
|
| | | $(this).addClass('active');
|
| | |
|
| | | var is_confirmed = $(this).data('data').alm_is_confirmed;
|
| | | if (is_confirmed) {
|
| | | _menuItems.splice(2, 0, {txt: '机房问题记录', cla: 'target', data: {target: 'batt-fault-manage.jsp'}});
|
| | | // console.log(menuItems);
|
| | | }
|
| | | }
|
| | |
|
| | | var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
| | | var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
| | | var scrollY=$(document).scrollTop();
|
| | | // 遍历menuItems向data属性中添加data值
|
| | | for(var i=0; i<menuItems.length; i++) {
|
| | | var _menuItems = menuItems[i];
|
| | | _menuItems.data.data = data;
|
| | | }
|
| | | |
| | | rightMenu.showMenu(menuItems,disX, disY);
|
| | | var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
| | | var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
| | | var scrollY=$(document).scrollTop();
|
| | | // 遍历menuItems向data属性中添加data值
|
| | | for(var i=0; i<_menuItems.length; i++) {
|
| | | var __menuItems = _menuItems[i];
|
| | | __menuItems.data.data = data;
|
| | | }
|
| | |
|
| | | rightMenu.showMenu(_menuItems,disX, disY);
|
| | | }
|
| | | });
|
| | |
|
| | | // 点击右键菜单跳转
|
| | | $('body').on('click', '#rightMenu .target', function() {
|
| | | var data = $(this).data('data');
|
| | | console.log(data);
|
| | | // console.log(data);
|
| | | try{
|
| | | var pageName = data.target; // 跳转页面名称
|
| | | var _data = data.data;
|
| | | var province = _data.stationName1; // 省
|
| | | var city = _data.stationName2; // 市
|
| | | var county = _data.stationName5; // 区县
|
| | | var home = _data.stationName; // 机房名称
|
| | | // 实现跳转
|
| | | window.open(skipUrl(pageName, province, city, county, home));
|
| | | var param = {
|
| | | page: data.target // 跳转页面名称
|
| | | ,province: _data.stationName1 // 省
|
| | | ,city: _data.stationName2 // 市
|
| | | ,county: _data.stationName5 // 区县
|
| | | ,home: _data.stationName // 机房名称
|
| | | ,fromwarn: 1
|
| | | }
|
| | | // 实现跳转
|
| | | window.open(skipURL(param));
|
| | | }catch(e){
|
| | | layer.msg("获取信息失败,跳转失败!");
|
| | | }
|
| | |
| | | $('#tbBrdw').on('mousedown','table tbody tr',function(e){
|
| | | var data = $(this).data('data');
|
| | | var actLen = $('#tbBrdw').find('.active').length;
|
| | | //console.info(actLen);
|
| | | if (e.which == 3) {
|
| | | if(actLen < 2) {
|
| | | $('#tbBrdw table tbody tr').removeClass('active');
|
| | | $(this).addClass('active');
|
| | | }
|
| | | |
| | | var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
| | | var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
| | | var scrollY=$(document).scrollTop();
|
| | | // 遍历menuItems向data属性中添加data值
|
| | | for(var i=0; i<menuItems.length; i++) {
|
| | | var _menuItems = menuItems[i];
|
| | | _menuItems.data.data = data;
|
| | | }
|
| | | |
| | | rightMenu.showMenu(menuItems,disX, disY);
|
| | | //console.info(actLen);
|
| | | if (e.which == 3) {
|
| | | /**
|
| | | * 右键时如果选中了多个 或者选了一个 但是是未确认的行
|
| | | * 右键菜单就不用加 跳转到问题记录页面
|
| | | *
|
| | | * 即 只有选中一个 且状态已确认
|
| | | */
|
| | | // 复制原右键菜单数组 非引用
|
| | | var _menuItems = JSON.parse(JSON.stringify(menuItems));
|
| | | if(actLen < 2) {
|
| | | $('#tbBrdw table tbody tr').removeClass('active');
|
| | | $(this).addClass('active');
|
| | | // alm_is_confirmed
|
| | | // console.log($(this).data('data'));
|
| | | var is_confirmed = $(this).data('data').alm_is_confirmed;
|
| | | if (is_confirmed) {
|
| | | _menuItems.splice(4, 0, {txt: '机房问题记录', cla: 'target', data: {target: 'batt-fault-manage.jsp'}});
|
| | | // console.log(menuItems);
|
| | | }
|
| | | }
|
| | | |
| | | var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
| | | var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
| | | var scrollY=$(document).scrollTop();
|
| | | // 遍历menuItems向data属性中添加data值
|
| | | for(var i=0; i<_menuItems.length; i++) {
|
| | | var __menuItems = _menuItems[i];
|
| | | __menuItems.data.data = data;
|
| | | }
|
| | | |
| | | rightMenu.showMenu(_menuItems,disX, disY);
|
| | | }
|
| | | });
|
| | |
|
| | | // 点击右键菜单跳转
|
| | | $('body').on('click', '#rightMenu .target', function() {
|
| | | var data = $(this).data('data');
|
| | | console.log(data);
|
| | | // console.log(data);
|
| | | try{
|
| | | var pageName = data.target; // 跳转页面名称
|
| | | var _data = data.data;
|
| | | console.log(_data);
|
| | | var province = _data.stationName1; // 省
|
| | | var city = _data.stationName2; // 市
|
| | | var county = _data.stationName5; // 区县
|
| | | var home = _data.stationName; // 机房名称
|
| | | // console.log(_data);
|
| | | var param = {
|
| | | page: data.target // 跳转页面名称
|
| | | ,province: _data.stationName1 // 省
|
| | | ,city: _data.stationName2 // 市
|
| | | ,county: _data.stationName5 // 区县
|
| | | ,home: _data.stationName // 机房名称
|
| | | ,fromwarn: 1
|
| | | }
|
| | | // 实现跳转
|
| | | window.open(skipUrl(pageName, province, city, county, home));
|
| | | window.open(skipURL(param));
|
| | | }catch(e){
|
| | | layer.msg("获取信息失败,跳转失败!");
|
| | | }
|
| | |
| | | layer.close(load);
|
| | | layer.closeAll();
|
| | | layer.msg('上传成功!3秒后自动关闭') ;
|
| | | // 父页面 查询标志位更新 可以查询
|
| | | parent.searchFlag = true;
|
| | | setTimeout(function() {
|
| | | closePage.click();
|
| | | }, 3000);
|
| | |
| | | error:function(e){
|
| | | layer.close(load);
|
| | | layer.msg('上传失败!') ;
|
| | | parent.searchFlag = true;
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | searchProvince();
|
| | | // 查询省
|
| | | function searchProvince() {
|
| | | var pre_province = getQueryString('province');
|
| | | // 请求后台查询
|
| | | $.ajax({
|
| | | type:'post',
|
| | |
| | | for(var i=0; i<data.length; i++) {
|
| | | var _data = data[i];
|
| | | var _tmp = getLayuiSelect(_data, _data, {}, {});
|
| | | if(pre_province == _data) {
|
| | | _tmp = getLayuiSelect(_data, _data, {}, {}, true);
|
| | | }
|
| | | list.push(_tmp);
|
| | | }
|
| | | }else {
|
| | |
| | | var tmp = {
|
| | | StationName1: $("#province").val()
|
| | | };
|
| | | var pre_city = getQueryString('city');
|
| | | // 是否添加等待
|
| | | if(isLoad) {
|
| | | filterLoad = layer.load();
|
| | |
| | | for(var i=0; i<data.length; i++) {
|
| | | var _data = data[i];
|
| | | var _tmp = getLayuiSelect(_data.StationName2, _data.StationName2, {}, _data);
|
| | | if(pre_city == _data.StationName2){
|
| | | _tmp = getLayuiSelect(_data.StationName2, _data.StationName2, {}, _data,true);
|
| | | }
|
| | | list.push(_tmp);
|
| | | }
|
| | | }else {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | var pre_county = getQueryString('county');
|
| | | // 构造查询条件
|
| | | var tmp = {
|
| | | StationName1: $("#province").val(),
|
| | |
| | | for(var i=0; i<data.length; i++) {
|
| | | var _data = data[i];
|
| | | var _tmp = getLayuiSelect(_data.StationName5, _data.StationName5, {}, _data);
|
| | | if(pre_county == _data.StationName5) {
|
| | | _tmp = getLayuiSelect(_data.StationName5, _data.StationName5, {}, _data, true);
|
| | | }
|
| | | list.push(_tmp);
|
| | | }
|
| | | }else {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | var pre_home = getQueryString('home');
|
| | | // 构造查询条件
|
| | | var tmp = {
|
| | | StationName1:$("#province").val(),
|
| | |
| | | StationId: _data.StationId
|
| | | };
|
| | | var _tmp = getLayuiSelect(_data.StationName, _data.StationName, _attr, _data);
|
| | | if(pre_home == _data.StationName) {
|
| | | _tmp = getLayuiSelect(_data.StationName3, _data.StationName3, _attr, _data, true);
|
| | | }
|
| | | list.push(_tmp);
|
| | | }
|
| | | }else {
|
| | |
| | | <div class="layui-block">
|
| | | <label class="layui-form-label">使用日期</label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="BattInUseDate" disabled="" id="usedate" autocomplete="off" class="layui-input layui-bg-gray" value="{{= d.BattInUseDate }}">
|
| | | <input type="text" name="BattInUseDate" id="usedate" autocomplete="off" class="layui-input" value="{{= d.BattInUseDate }}">
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | |
| | | laydate.render({
|
| | | elem: '#usedate'
|
| | | ,format: 'yyyy-MM-dd HH:mm:ss'
|
| | | ,showBottom: false
|
| | | });
|
| | | });
|
| | |
|
| | |
|
| | |
|
| | | // 验证信息
|
| | | form.verify({
|
| | |
| | | <div class="layui-row layui-col-space5">
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">更换日期<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" id="replace_date" lay-verify="required" class="layui-input" readonly="readonly" name="replace_date" />
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <!-- -->
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane" lay-filter="battgroupNameFilter">
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label">电池组<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <select name="GroupIndexInFBSDevice" id="battgroup_name" lay-verify="required" lay-filter="battgroup_name">
|
| | | <option value="">请选择电池组</option>
|
| | | </select>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <!-- -->
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">标称容量(AH)<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="replaced_moncapstd" lay-verify="required|number" autocomplete="off" placeholder="请输入标称容量" class="layui-input">
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label">电池品牌<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | |
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">标称容量(AH)<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="replaced_moncapstd" lay-verify="required|number" autocomplete="off" placeholder="请输入标称容量" class="layui-input">
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">标称电压(V)<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="replaced_monvolstd" lay-verify="required|number" autocomplete="off" placeholder="请输入标称电压" class="layui-input">
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item">
|
| | |
| | | <option value="4">4</option>
|
| | | <option value="24">24</option>
|
| | | </select>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">标称电压(V)<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="replaced_monvolstd" lay-verify="required|number" autocomplete="off" placeholder="请输入标称电压" class="layui-input">
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | |
| | | ,format: 'yyyy-MM-dd HH:mm:ss'
|
| | | ,value: new Date()
|
| | | });
|
| | | |
| | | // 更换日期
|
| | | laydate.render({
|
| | | elem: '#replace_date'
|
| | | ,format: 'yyyy-MM-dd'
|
| | | ,value: new Date()
|
| | | ,showBottom: false
|
| | | });
|
| | |
|
| | | // 提交内容
|
| | | form.on('submit(enAdd)', function(obj) {
|
| | |
| | | return false;
|
| | | }
|
| | | var data = obj.field;
|
| | | // 更换日期格式 拼上时分秒
|
| | | data.replace_date = data.replace_date + " 00:00:00";
|
| | | data.stationid = $('#home').find('option:selected').attr('stationid');
|
| | | data.stationname = $('#home').val();
|
| | | // 确认提示框
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | //根据维护区和机房查询蓄电池组
|
| | | function searchBattGroupName(isLoad){
|
| | | var list = []; // option结果集
|
| | | var ele = $('#battgroup_name'); // 目标select
|
| | | // 判断必要条件是否存在 是否选了机房
|
| | | var parentStatus = checkLayuiParent($("#home"));
|
| | | if(!parentStatus) {
|
| | | layer.close(filterLoad); // 关闭等待框
|
| | | list.push(getLayuiSelect('请先选择机房', '', {}, undefined));
|
| | | // 根据对象数组生成下拉列表
|
| | | createLayuiSelect(ele, list);
|
| | | form.render('select', 'battgroupNameFilter');
|
| | | return;
|
| | | }
|
| | | // var pre_battid = getQueryString('battid');
|
| | | var stationid = $("#home").find('option:selected').attr('stationid') ? $("#home").find('option:selected').attr('stationid') : '';
|
| | | // 构造查询条件
|
| | | var tmp = {
|
| | | StationName1:$("#province").val(),
|
| | | StationName2:$("#city").val(),
|
| | | StationName5:$("#county").val(),
|
| | | StationName: $("#home").val(),
|
| | | StationId: stationid
|
| | | };
|
| | | // 是否添加等待
|
| | | if(isLoad) {
|
| | | filterLoad = layer.load();
|
| | | }
|
| | | |
| | | $.post("BattInfAction!serchBattByStation","json="+JSON.stringify(tmp),function(data){
|
| | | data = JSON.parse(data.result);
|
| | | //console.info(data); |
| | | if(data.code == 1 && data.data.length > 0){
|
| | | var allTxt = "全部(共"+data.data.length+"种)";
|
| | | list.push(getLayuiSelect(allTxt, '', {stationname: '', dev_id: '', batt_num:''}, undefined));
|
| | | // 根据数据构造生成下拉列表的数据
|
| | | for (var i=0;i<data.data.length;i++) {
|
| | | var _data = data.data[i];
|
| | | var _attr = {
|
| | | stationname: _data.StationName,
|
| | | dev_id: _data.FBSDeviceId,
|
| | | batt_num: _data.GroupIndexInFBSDevice+1
|
| | | };
|
| | | var txt = _data.BattGroupName+'-'+_data.MonCount+"节";
|
| | | var _tmp = getLayuiSelect(txt, _data.GroupIndexInFBSDevice, _attr, _data);
|
| | | // if(pre_battid == _data.BattGroupId && isNewLoad) {
|
| | | // _tmp = getLayuiSelect(txt, _data.BattGroupId, _attr, _data, true);
|
| | | // }
|
| | | list.push(_tmp);
|
| | | }
|
| | | }else{
|
| | | list.push(getLayuiSelect('暂无可选蓄电池组', '', {}, undefined));
|
| | | }
|
| | | createLayuiSelect(ele, list);
|
| | | form.render('select', 'battgroupNameFilter');
|
| | | isNewLoad = false;
|
| | | layer.close(filterLoad);
|
| | | });
|
| | | }
|
| | |
|
| | | // 切换机房查询蓄电池组
|
| | | form.on('select(home)', function() {
|
| | | searchBattGroupName(true);
|
| | | });
|
| | |
|
| | | // 切换市-区县
|
| | | form.on('select(county)', function(data) {
|
| | |
| | | // 根据对象数组生成下拉列表
|
| | | createLayuiSelect(ele, list);
|
| | | form.render('select', 'homeFilter');
|
| | | // 查询电池组
|
| | | searchBattGroupName();
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | // 根据对象数组生成下拉列表
|
| | | createLayuiSelect(ele, list);
|
| | | form.render('select', 'homeFilter');
|
| | | // 查询电池组
|
| | | searchBattGroupName();
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">更换日期<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" id="replace_date" lay-verify="required" class="layui-input" readonly="readonly" name="replace_date" />
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane" lay-filter="battgroupNameFilter">
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label">电池组</label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="battgroup_name" lay-verify="title" autocomplete="off" placeholder="电池组名称" class="layui-input layui-bg-gray" disabled="disabled">
|
| | | <!-- <select name="BattGroupId" id="battgroup_name" disabled="disabled" lay-filter="battgroup_name">
|
| | | <option value="0">请选择电池组</option>
|
| | | </select> -->
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">标称容量(AH)<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="replaced_moncapstd" lay-verify="required|number" autocomplete="off" placeholder="请输入标称容量" class="layui-input">
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item">
|
| | | <label class="layui-form-label">电池品牌<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | |
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">标称容量(AH)<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="replaced_moncapstd" lay-verify="required|number" autocomplete="off" placeholder="请输入标称容量" class="layui-input">
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">标称电压(V)<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="replaced_monvolstd" lay-verify="required|number" autocomplete="off" placeholder="请输入标称电压" class="layui-input">
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item">
|
| | |
| | | <option value="4">4</option>
|
| | | <option value="24">24</option>
|
| | | </select>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div class="layui-col-xs6 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
| | | <div class="layui-form layui-form-pane">
|
| | | <div class="layui-form-item layui-form-item160">
|
| | | <label class="layui-form-label">标称电压(V)<span class="red">*</span></label>
|
| | | <div class="layui-input-block">
|
| | | <input type="text" name="replaced_monvolstd" lay-verify="required|number" autocomplete="off" placeholder="请输入标称电压" class="layui-input">
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | |
| | | // 设置form表单的初始值
|
| | | form.val('eleChange', {
|
| | | 'num': editData.num, // 主键
|
| | | 'stationid': editData.stationid, // 机房ID
|
| | | 'stationname':editData.stationname, // 机房名称
|
| | | 'stationid': editData.stationid, // 机房ID
|
| | | 'stationname':editData.stationname, // 机房名称
|
| | | 'battgroup_name': editData.battgroupname, // 电池组名称
|
| | | 'replaced_producer': editData.replaced_producer, // 电池品牌
|
| | | 'replaced_moncapstd': editData.replaced_moncapstd, // 标称容量
|
| | | 'replaced_monvolstd': editData.replaced_monvolstd, // 标称电压
|
| | | 'replaced_reason': editData.replaced_reason, // 更换理由
|
| | | 'replaced_moncount': editData.replaced_moncount // 单体数量
|
| | | });
|
| | | });
|
| | |
|
| | | // 投入使用日期渲染
|
| | | laydate.render({
|
| | |
| | | ,format: 'yyyy-MM-dd HH:mm:ss'
|
| | | ,value: new Date()
|
| | | });
|
| | | |
| | | // 更换日期
|
| | | laydate.render({
|
| | | elem: '#replace_date'
|
| | | ,format: 'yyyy-MM-dd'
|
| | | ,value: new Date()
|
| | | ,showBottom: false
|
| | | });
|
| | |
|
| | | // 提交内容
|
| | | form.on('submit(enEdit)', function(obj) {
|
| | | var data = obj.field;
|
| | | // 确认提示框
|
| | | layer.confirm('是否确认修改',{icon: 3, title: '修改提示'}, function(index) {
|
| | | layer.close(index);
|
| | | // 调用取人修改的方法
|
| | | // 更换日期格式 拼上时分秒
|
| | | data.replace_date = data.replace_date + " 00:00:00";
|
| | | delete data.battgroup_name;
|
| | | // 确认提示框
|
| | | layer.confirm('是否确认修改',{icon: 3, title: '修改提示'}, function(index) {
|
| | | layer.close(index);
|
| | | // 调用取人修改的方法
|
| | | enEdit(data);
|
| | | });
|
| | | return false;
|
| | |
| | |
|
| | | //电池放电测试
|
| | | {permit_item_name:'batt_test_op_permit',num:58}, //电池放电测试
|
| | | {permit_item_name:'batt_discharge_model_permit',num:81}, //批量电池放电测试
|
| | | {permit_item_name:'batt_test_op_permit',num:81}, //批量电池放电测试
|
| | | //{permit_item_name:'batt_discharge_model_permit',num:81}, //批量电池放电测试
|
| | |
|
| | | {permit_item_name:'batt_discharge_model_permit',num:59}, //设备充放电模块参数
|
| | | {permit_item_name:'battcfg_query_permit', num:63}, //电池信息配置
|
| | |
| | | min-width: 12%;
|
| | | }
|
| | | .tbl-container table {
|
| | | width: 200%;
|
| | | /*width: 200%;*/
|
| | | border-collapse: collapse;
|
| | | }
|
| | | </style>
|
| | |
| | | <a href="elestatus.html" target="_top" data-transition="slidefade">电池实时状态查询</a>
|
| | | </li>
|
| | | <li>
|
| | | <a href="endure.html" target="_top" data-transition="slidefade">机房续航能力历史查询</a>
|
| | | <a href="endure.html" target="_top" data-transition="slidefade">电池组续航能力查询</a>
|
| | | </li>
|
| | | <li>
|
| | | <a href="batt-life-manage.html" target="_top" data-transition="slidefade">机房续航能力查询</a>
|
| | |
| | | .tbl-container table {
|
| | | width: 100%;
|
| | | border-collapse: collapse;
|
| | | margin-bottom: 10px;
|
| | | }
|
| | | .tbl-container table th{
|
| | | border: 1px solid #ccc;
|
| | | line-height: 1.8em;
|
| | | white-space: nowrap;
|
| | | /*white-space: nowrap;*/
|
| | | white-space: normal;
|
| | | width: 30%;
|
| | | background-color: #ddd;
|
| | | }
|
| | |
|
| | | .tbl-container td{
|
| | | border: 1px solid #ccc;
|
| | | white-space: nowrap;
|
| | | /*white-space: nowrap;*/
|
| | | white-space: normal;
|
| | | line-height: 1.8em;
|
| | | padding: 4px;
|
| | | }
|
| | |
|
| | | tbody tr.active {
|
| | |
| | | top: 50%;
|
| | | margin-top: -15px;
|
| | | z-index:99;
|
| | | display: none;
|
| | | }
|
| | | .next-page {
|
| | | right: 0;
|
| | |
| | | ArrTd.push(data[i].alm_low_en==0?'<input type="checkbox" disabled />':'<input type="checkbox" checked="checked" disabled />'); //告警下限使能
|
| | | Alm_id.push(data[i].alm_id); //告警ID数组
|
| | | }
|
| | | createTbl(tblCon, arrTh, ArrTd); |
| | | createTbl(tblCon, arrTh, ArrTd);
|
| | | // createTBL(tblCon, arrTh, ArrTd);
|
| | | }
|
| | | else{
|
| | | $('#searchNull').popup('open');
|
| | |
| | |
|
| | | <input type="hidden" name="bmd.mainf.master_audit" value="3" class="3"> <!-- 三级告警 -->
|
| | | <input type="hidden" name="bmd.mainf.appoint_uid" value="4" class="4"> <!-- 四级告警 -->
|
| | | <input type="hidden" name="bmd.binf.num" value="0"> <!-- 排序 -->
|
| | | </div>
|
| | | <div class="fg-panel-btn">
|
| | | <a href="javascript:panel.hide(true);" data-role="button" id="search" class="ui-btn ui-mini ui-btn-b ui-shadow">确定</a>
|
| | |
| | | if(pagecurr == 1){
|
| | | //setPage();
|
| | | createTbl(tblCon, arrTh, ArrWarnTb);
|
| | | // createTBL(tblCon, arrTh, ArrWarnTb);
|
| | | }else
|
| | | {
|
| | | addTrToTbl(tblCon, arrTh, ArrWarnTb);
|
| | |
| | | <select id="homeName" data-mini="true">
|
| | | <option value="">全部</option>
|
| | | </select>
|
| | | <p>蓄电池组</p>
|
| | | <!-- <p>蓄电池组</p>
|
| | | <select id="battgroup_name" data-mini="true">
|
| | | <option value="0">全部</option>
|
| | | </select>
|
| | | </select> -->
|
| | | <p>续航能力类型</p>
|
| | | <select id="endu_type" data-mini="true">
|
| | | <option value="0">实时续航能力数据</option>
|
| | | <option value="1">历史续航能力数据</option>
|
| | | <option value="1">历史续航能力数据</option>
|
| | | </select>
|
| | | <p>系统类型</p>
|
| | | <select name="monvolstd" id="monvolstd" lay-filter="monvolstd">
|
| | | <select name="monvolstd" id="monvolstd" data-mini="true" lay-filter="monvolstd">
|
| | | + <option value =0>全部</option>
|
| | | + <option value=2>2V设备</option>
|
| | | + <option value=12>12V设备</option>
|
| | | + </select>
|
| | | <fieldset data-role="collapsible" data-collapsed="false">
|
| | | <!-- <fieldset data-role="collapsible" data-collapsed="false">
|
| | | <legend><strong>电池组放电时间段:</strong></legend>
|
| | | <label for="startTimeselect"><strong>开始时间:</strong></label>
|
| | | <input type="text" name="startTimeselect" id="startTimeselect" value="1970-07-06">
|
| | | <label for="endTimeselect"><strong>结束时间:</strong></label>
|
| | | <input type="text" name="endTimeselect" id="endTimeselect" value="2017-05-04">
|
| | | </fieldset>
|
| | | </fieldset> -->
|
| | | </div>
|
| | | <div class="fg-panel-btn">
|
| | | <a href="javascript:panel.hide(true);" data-role="button" id="search" class="ui-btn ui-mini ui-btn-b ui-shadow">确定</a>
|
| | |
| | | <!-- 头部内容 -->
|
| | | <div data-role="header" data-position="fixed">
|
| | | <a href="count-report.html" target="_top" class="ui-btn ui-corner-all ui-shadow ui-icon-back ui-btn-icon-left" style="padding-top: 0.7em; padding-bottom: 0.7em;">返回</a>
|
| | | <h1>电池续航能力历史查询</h1>
|
| | | <h1 id="page_title">电池续航能力查询</h1>
|
| | | <a href="javascript:panel.show();" class="ui-btn ui-corner-all ui-shadow ui-icon-grid ui-btn-icon-left" style="padding-top: 0.7em; padding-bottom: 0.7em;" id="screen">筛选</a>
|
| | | </div>
|
| | | <!-- 主体内容 -->
|
| | |
| | | $(document).ready(function() {
|
| | | $("#endTimeselect").attr("value", new Date().format("yyyy-MM-dd"));
|
| | |
|
| | | }); |
| | | var arrTh = ['机房名称','标称容量', '实际容量','剩余容量', '实时电流', '停电续航时间'];
|
| | | });
|
| | | // 历史
|
| | | var arrTh_his = ['机房名称','电池组标称容量(AH)', '电池组实际容量(AH)', '53V实时电流(A)', '45V实时电流(A)', '核容时间', '停电续航时间(min)'];
|
| | | // 实时
|
| | | var arrTh = ['机房名称', '电池组名称', '电池组标称容量(AH)', '电池组实际容量(AH)', '剩余容量(AH)', '53V实时电流(A)', '45V实时电流(A)', '停电续航时间(min)'];
|
| | | var dataArr = new Array();
|
| | |
|
| | | var arrTd = new Array();
|
| | |
| | |
|
| | |
|
| | | $(document).ready(function(){
|
| | | $("#search").click(function(){
|
| | | serchBattLife();
|
| | | });
|
| | | $("#search").click(function(){
|
| | | if (1 == $("#endu_type").val()) {
|
| | | $('#page_title').text('电池续航(历史)查询');
|
| | | } else {
|
| | | $('#page_title').text('电池续航(实时)查询');
|
| | | }
|
| | | serchBattLife();
|
| | | });
|
| | | });
|
| | |
|
| | |
|
| | |
|
| | | function serchBattLife(){
|
| | | loadshow();
|
| | | var temp = createSearchForm();
|
| | | console.info(temp);
|
| | | var isHis = 1 == $("#endu_type").val();
|
| | | var temp = createSearchForm1();
|
| | | |
| | | // console.info(temp);
|
| | | arrTd = new Array();
|
| | | var url = "Batttestdata_infAction!serchBattLife";
|
| | | if (!isHis) {
|
| | | temp = createSearchForm();
|
| | | url = "Batttestdata_infAction!serchBattLifeNow";
|
| | | }
|
| | | //$.post('Batttestdata_infAction!serchBattLife',"result="+JSON.stringify(temp),
|
| | | $.ajax({
|
| | | type: "post",
|
| | | async: true,
|
| | | url: "Batttestdata_infAction!serchBattLife",
|
| | | url: url,
|
| | | data: "json="+JSON.stringify(temp),
|
| | | dataType: "json",
|
| | | success:function(data){
|
| | | data=data.result;
|
| | | var model=eval("("+data+")");
|
| | | console.info(model);
|
| | | data = data.result;
|
| | | var model = JSON.parse(data);
|
| | | // console.info(model);
|
| | | //console.info(data.data[1].page);
|
| | | if(model.code==1 && model.data.length>0){
|
| | | data = model.data;
|
| | | if(temp.BattGroupId == 0){
|
| | | setRealdate(model.data, arrTd);
|
| | | }else if(temp.BattGroupId == 1){
|
| | | sethistorydata(model.data, arrTd);
|
| | | }
|
| | | }else{
|
| | | Page.pageAll = 0;
|
| | | $('#searchNull').popup('open');
|
| | | } |
| | | setPage(); |
| | | createTbl(tblCon, arrTh, arrTd);
|
| | | if (model.code == 1 && model.data.length > 0) {
|
| | | data = model.data;
|
| | | if (!isHis) {
|
| | | setRealdate(data, arrTd);
|
| | | createTbl(tblCon, arrTh, arrTd);
|
| | | } else {
|
| | | sethistorydata(data, arrTd);
|
| | | createTbl(tblCon, arrTh_his, arrTd);
|
| | | }
|
| | | } else {
|
| | | Page.pageAll = 0;
|
| | | $('#searchNull').popup('open');
|
| | | } |
| | | setPage();
|
| | | loadclose();
|
| | | }
|
| | | }).error(function(){
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | //设置实时数据的表格数据
|
| | | function setRealdate(data,arr){
|
| | | var alldata = new Array();
|
| | | //设置实时数据的表格数据
|
| | | function setRealdate (data, arr){
|
| | | for(var i = 0;i<data.length;i++){
|
| | | var moncapstd = data[i].moncapstd;
|
| | | var monvolstd = data[i].monvolstd;
|
| | | var maxvol = data[i].bdata.mon_vol;
|
| | | var minvol = data[i].bdata.mon_tmp;
|
| | | var test_cap = data[i].bstate.batt_test_cap;
|
| | | var moncapstd = data[i].binf.MonCapStd;
|
| | | // 测试容量
|
| | | var test_cap = Math.abs(data[i].bstate.batt_test_cap);
|
| | | // 实际容量
|
| | | var real_cap = Math.abs(data[i].bstate.batt_real_cap);
|
| | | var test_curr = data[i].bstate.group_curr.toFixed(1);
|
| | | var actionvalue = (GetMonomerCap(moncapstd,GetHourRate(moncapstd,test_curr),test_cap,maxvol,minvol,monvolstd,CapType_Real)).toFixed(0);
|
| | | var restvalue = (GetMonomerCap(moncapstd,GetHourRate(moncapstd,test_curr),test_cap,maxvol,minvol,monvolstd,CapType_Rest)).toFixed(0);
|
| | | var percent = (restvalue*100/moncapstd).toFixed(1);
|
| | | var restTime = test_curr==0?formartTime(0):formartTime(restvalue*60/test_curr);
|
| | | var temp = getObjByStationName(alldata, data[i].binf.StationName);
|
| | | console.info(actionvalue+"=="+restvalue);
|
| | | if(temp == undefined){
|
| | | alldata.push({
|
| | | StationName1:data[i].binf.StationName1,
|
| | | StationName:data[i].binf.StationName,
|
| | | moncapstd:moncapstd,
|
| | | actionvalue:parseInt(actionvalue),
|
| | | restvalue:parseInt(restvalue),
|
| | | test_curr:test_curr,
|
| | | });
|
| | | }else{
|
| | | temp.actionvalue +=parseInt(actionvalue);
|
| | | temp.restvalue += parseInt(restvalue);
|
| | | // 剩余容量 = 实际容量-测试容量
|
| | | var res_cap = (real_cap - test_curr).toFixed(1);
|
| | | var endur_time_long = getGruopEndurTimeLong(data[i].binf.MonCapStd, real_cap, data[i].bstate.group_curr) * 60;
|
| | | arr.push(
|
| | | // 机房名称
|
| | | data[i].binf.StationName,
|
| | | // 电池组名称
|
| | | data[i].binf.BattGroupName,
|
| | | // 电池组标称容量(AH)
|
| | | moncapstd,
|
| | | // 电池组实际容量(AH)
|
| | | parseInt(real_cap),
|
| | | // 剩余容量(AH)
|
| | | res_cap,
|
| | | // 53V实时电流(A)
|
| | | data[i].bstate.group_curr,
|
| | | // 45V实时电流(A)
|
| | | (data[i].bstate.group_curr*53/45).toFixed(1),
|
| | | // 停电续航时间(min)
|
| | | endur_time_long ? endur_time_long.toFixed(0) : 0
|
| | | );
|
| | | if (data[i].binf.MonNum) {
|
| | | Page.pageAll = data[i].binf.MonNum;
|
| | | }
|
| | | }
|
| | | for(var i = (Page.pageCurr-1)*Page.pageSize;i<alldata.length && i<Page.pageCurr*Page.pageSize;i++){
|
| | | arr.push(alldata[i].StationName);
|
| | | arr.push(alldata[i].moncapstd);
|
| | | arr.push(alldata[i].actionvalue);
|
| | | arr.push(alldata[i].restvalue);
|
| | | arr.push((alldata[i].test_curr));
|
| | | arr.push(alldata[i].test_curr==0?formartTime(0):formartTime(alldata[i].restvalue*60/alldata[i].test_curr));
|
| | | }
|
| | | Page.pageAll = alldata.length;
|
| | | }
|
| | |
|
| | | //设置历史数据的表格数据
|
| | | function sethistorydata(data,arr){
|
| | | console.info(data);
|
| | | var alldata = new Array(); //存放所有数据机房的数据
|
| | | function sethistorydata (data, arr){
|
| | | for(var i=0;i<data.length;i++){
|
| | | var stationid = data[i].binf.StationId; |
| | | var moncapstd = data[i].binf.MonCapStd;
|
| | | var monvolstd = data[i].binf.MonVolStd;
|
| | | var maxvol = data[i].tdata.max_monvol;
|
| | | var minvol = data[i].tdata.min_monvol;
|
| | | var test_cap = data[i].tdata.test_cap;
|
| | | var test_curr = data[i].tdata.test_curr;
|
| | | var actionvalue = (GetMonomerCap(moncapstd,GetHourRate(moncapstd,test_curr),test_cap,maxvol,minvol,monvolstd,CapType_Real)).toFixed(0);
|
| | | var restvalue = (GetMonomerCap(moncapstd,GetHourRate(moncapstd,test_curr),test_cap,maxvol,minvol,monvolstd,CapType_Rest)).toFixed(0);
|
| | | |
| | | //console.info(moncapstd+"==="+actionvalue+"==="+restvalue);
|
| | | var percent = (restvalue*100/moncapstd).toFixed(1);
|
| | | |
| | | var restTime = test_curr==0?formartTime(0):formartTime(restvalue*60/test_curr);
|
| | | var temp = getObjByStationName(alldata, data[i].binf.StationName);
|
| | | //console.info(temp);
|
| | | if(temp == undefined){
|
| | | alldata.push({
|
| | | stationid:stationid,
|
| | | StationName1:data[i].binf.StationName1,
|
| | | StationName:data[i].binf.StationName,
|
| | | moncapstd:moncapstd,
|
| | | actionvalue:parseInt(actionvalue),
|
| | | restvalue:parseInt(restvalue),
|
| | | test_curr:test_curr,
|
| | | });
|
| | | }else{
|
| | | temp.actionvalue +=parseInt(actionvalue);
|
| | | temp.restvalue += parseInt(restvalue);
|
| | | } |
| | | |
| | | //sconsole.info(alldata);
|
| | | }
|
| | | for(var i = (Page.pageCurr-1)*Page.pageSize;i<alldata.length && i<Page.pageCurr*Page.pageSize;i++){
|
| | | arr.push(alldata[i].StationName);
|
| | | arr.push(alldata[i].moncapstd);
|
| | | arr.push(alldata[i].actionvalue);
|
| | | arr.push(alldata[i].restvalue);
|
| | | arr.push((alldata[i].test_curr).toFixed(1));
|
| | | arr.push(alldata[i].test_curr==0?formartTime(0):formartTime(alldata[i].actionvalue*60/alldata[i].test_curr));
|
| | | }
|
| | | Page.pageAll = alldata.length;
|
| | | }
|
| | | |
| | | //判断station在list中是否存在
|
| | | function getObjByStationName(list,StationName){
|
| | | var obj = undefined;
|
| | | for(var i=0;list!=undefined && i<list.length;i++){
|
| | | if(list[i].StationName == StationName){
|
| | | obj = list[i];
|
| | | break;
|
| | | var moncapstd = data[i].batts_moncapstd;
|
| | | var endur_time_long = getEndurTimeLong(data[i]);
|
| | | arr.push(
|
| | | // 机房名称
|
| | | data[i].stationName,
|
| | | // 电池组标称容量(AH)
|
| | | moncapstd,
|
| | | // 电池组实际容量(AH)
|
| | | getRealCap(data[i].groupcount, data[i]),
|
| | | // 53V实时电流(A)
|
| | | data[i].real_curr,
|
| | | // 45V实时电流(A)
|
| | | (data[i].real_curr*53/45).toFixed(1),
|
| | | // 核容时间
|
| | | data[i].batts_teststarttime,
|
| | | // 停电续航时间(min)
|
| | | endur_time_long
|
| | | );
|
| | | if (data[i].page.pageAll) {
|
| | | Page.pageAll = data[i].page.pageAll;
|
| | | }
|
| | | }
|
| | | return obj;
|
| | | } |
| | | }
|
| | |
|
| | | // 历史 电池组实际容量
|
| | | function getRealCap (num, d) {
|
| | | var rs = "";
|
| | | var g1=d.real_cap_group1, g2=d.real_cap_group2, g3=d.real_cap_group3, g4=d.real_cap_group4;
|
| | | g1=g1?g1.toFixed(1):0;
|
| | | g2=g2?g2.toFixed(1):0;
|
| | | g3=g3?g3.toFixed(1):0;
|
| | | g4=g4?g4.toFixed(1):0;
|
| | | switch(num) {
|
| | | case 1:
|
| | | rs = g1;
|
| | | break;
|
| | | case 2:
|
| | | rs = g1+"/"+g2;
|
| | | break;
|
| | | case 3:
|
| | | rs = g1+"/"+g2+"/"+g3;
|
| | | break;
|
| | | case 4:
|
| | | rs = g1+"/"+g2+"/"+g3+"/"+g4;
|
| | | break;
|
| | | }
|
| | | return rs;
|
| | | }
|
| | | |
| | | // 废弃
|
| | | //判断station在list中是否存在 |
| | | // function getObjByStationName(list,StationName){
|
| | | // var obj = undefined;
|
| | | // for(var i=0;list!=undefined && i<list.length;i++){
|
| | | // if(list[i].StationName == StationName){
|
| | | // obj = list[i];
|
| | | // break;
|
| | | // }
|
| | | // }
|
| | | // return obj;
|
| | | // } |
| | |
|
| | | // 获取停电续航时间
|
| | | function getEndurTimeLong (data) {
|
| | | var endurTimeLongs = 0;
|
| | | var battsMoncapstd = data.batts_moncapstd.split("/");
|
| | | var real_curr53 = data.real_curr; |
| | | // 遍历电池组标称容量
|
| | | for(var i=0; i<battsMoncapstd.length; i++) {
|
| | | var moncapstd = Number(battsMoncapstd[i]);
|
| | | var realCapStr = "real_cap_group"+(i+1);
|
| | | //console.log(realCapStr);
|
| | | realcap = data[realCapStr];
|
| | | var endurTimeLong = getGruopEndurTimeLong(moncapstd, realcap, real_curr53);
|
| | | endurTimeLong = (endurTimeLong*60).toFixed(0);
|
| | | endurTimeLongs += Number(endurTimeLong);
|
| | | }
|
| | | |
| | | return endurTimeLongs;
|
| | | }
|
| | |
|
| | | //格式化时间
|
| | | function formartTime(value){
|
| | |
| | | return day_num+"天"+hour_num+"小时"+min_num+"分";
|
| | | }
|
| | | function createSearchForm(){
|
| | | var temp ={
|
| | | num:3,
|
| | | stationName1:$('#mainteArea').val(),
|
| | | stationName2:$('#city').val(),
|
| | | stationName5: $('#country').val(),
|
| | | stationName:$('#homeName').val(),
|
| | | BattGroupId:$('#battgroup_name').val(),
|
| | | BattProductDate:$('#startTimeselect').val()+" 00:00:00",
|
| | | BattProductDate1:$('#endTimeselect').val()+" 23:59:59",
|
| | | page:Page,
|
| | | monvolstd: $('#monvolstd').val() |
| | | |
| | | };
|
| | | return temp;
|
| | | } |
| | | |
| | | |
| | | var temp ={
|
| | | // num:3,
|
| | | StationName1: $('#mainteArea').val(),
|
| | | StationName2: $('#city').val(),
|
| | | StationName5: $('#country').val(),
|
| | | StationName: $('#homeName').val(),
|
| | | // BattGroupId:$('#battgroup_name').val(),
|
| | | // BattProductDate:$('#startTimeselect').val()+" 00:00:00",
|
| | | // BattProductDate1:$('#endTimeselect').val()+" 23:59:59",
|
| | | page: Page,
|
| | | MonVolStd: $('#monvolstd').val() |
| | | |
| | | };
|
| | | return temp;
|
| | | }
|
| | |
|
| | | function createSearchForm1(){
|
| | | var temp ={
|
| | | // num:3,
|
| | | stationName1: $('#mainteArea').val(),
|
| | | stationName2: $('#city').val(),
|
| | | stationName5: $('#country').val(),
|
| | | stationName: $('#homeName').val(),
|
| | | // BattGroupId:$('#battgroup_name').val(),
|
| | | // BattProductDate:$('#startTimeselect').val()+" 00:00:00",
|
| | | // BattProductDate1:$('#endTimeselect').val()+" 23:59:59",
|
| | | page: Page,
|
| | | monvolstd: $('#monvolstd').val() |
| | | |
| | | };
|
| | | return temp;
|
| | | } |
| | |
|
| | | //页面加载时查询省
|
| | | $.post("BattInfAction_serchByStation",null,function(data){
|
| | |
| | | updataSelStation($Ostation_name1, arr);
|
| | | }
|
| | |
|
| | | findserchByBattGroupNamebystationname(); |
| | | // findserchByBattGroupNamebystationname(); |
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | //根据机房获取电池组 |
| | | function findserchByBattGroupNamebystationname(){
|
| | | //根据机房获取电池组 此页面现在不用
|
| | | /* function findserchByBattGroupNamebystationname(){
|
| | | var stationid = $("#homeName").find('option:selected').attr('stationid')?$("#homeName").find('option:selected').attr('stationid'):'';
|
| | |
|
| | | var data = {
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | }*/
|
| | |
|
| | | //当省改变时更新市
|
| | | $('#mainteArea').change(function(){
|
| | |
| | | findStationNamebyStationname1();
|
| | | });
|
| | | //当机房改变时,更新电池组
|
| | | $('#homeName').change(function(){
|
| | | findserchByBattGroupNamebystationname();
|
| | | });
|
| | | // $('#homeName').change(function(){
|
| | | // findserchByBattGroupNamebystationname();
|
| | | // });
|
| | |
|
| | | //设置页面的跳转链接
|
| | | function setPage(){
|
| | |
| | | $('.pre-page').show();
|
| | | }
|
| | | var pageNum = Math.ceil(Page.pageAll/Page.pageSize);
|
| | | |
| | | // debugger;
|
| | | if(Page.pageCurr < pageNum){
|
| | | $('.next-page').show();
|
| | | }else{
|
| | |
| | | //ThArr表格的头数据,TdArr表格的单元格数据
|
| | | function createTbl(ele,ThArr,TdArr){
|
| | | /*function createTbl(ele,ThArr,TdArr){
|
| | | ele.children('table').remove();
|
| | | var _table=$('<table data-role="table" class="ui-responsive"></table>');
|
| | | var _thead=$('<thead></thead>');
|
| | |
| | | _table.append(_tbody);
|
| | | //将table添加到指定的容器中
|
| | | ele.append(_table).trigger('create');
|
| | | }*/
|
| | |
|
| | | //ThArr表格的头数据,TdArr表格的单元格数据
|
| | | function createTbl(ele,ThArr,TdArr){
|
| | | ele.children('table').remove();
|
| | | |
| | | var TdLength; //获取单元格个数
|
| | | var TrLength; //获取行数 也就是最后的表格数
|
| | | TdLength=TdArr.length;
|
| | | TrLength=Math.ceil(TdLength/ThArr.length);
|
| | |
|
| | | for (let i = 0; i < TrLength; i++) {
|
| | | var _table=$('<table data-role="table" class="ui-responsive"></table>');
|
| | | var _tbody=$('<tbody></tbody>');
|
| | | for (let m = 0, n = ThArr.length; m < n; m++) {
|
| | | _tbody.append('<tr><th>' + ThArr[m] + '</th><td>' + TdArr[n * i + m] + '</td></tr>')
|
| | | }
|
| | | _table.append(_tbody);
|
| | | ele.append(_table);
|
| | | }
|
| | | }
|
| | |
|
| | | // 创建非自适应表格
|
| | |
| | | @param array ThArr 表格头部数据
|
| | | @param array TdArr 表格数据
|
| | | */
|
| | | /*function addTrToTbl(ele, ThArr, TdArr) {
|
| | | var _table=$('<table data-role="table" class="ui-responsive"></table>');
|
| | | var _thead=$('<thead></thead>');
|
| | | var _tbody=$('<tbody></tbody>');
|
| | | var ThArray=new Array(); //设置th的数组
|
| | | var TrArray=new Array(); //设置tr的数组
|
| | | var TdArray=new Array(); //设置td的数组
|
| | | var TdLength; //获取单元格个数
|
| | | var TrLength; //获取行数
|
| | | TdLength=TdArr.length;
|
| | | TrLength=Math.ceil(TdLength/ThArr.length);
|
| | | // 给每个th设置值
|
| | | for(var i=0;i<ThArr.length;i++)
|
| | | {
|
| | | ThArray[i]=$('<th>'+ThArr[i]+'</th>');
|
| | | }
|
| | | // 给每个td设置值
|
| | | for(var i=0;i<TdLength;i++)
|
| | | {
|
| | | TdArray[i]=$("<td>"+TdArr[i]+"</td>");
|
| | | }
|
| | |
|
| | | //设置tr
|
| | | for(var i=0;i<TrLength;i++)
|
| | | {
|
| | | TrArray[i]=$("<tr></tr>");
|
| | | }
|
| | | //将td以col个赋给tr
|
| | | var n=0;
|
| | | for(var i=0;i<TrLength;i++)
|
| | | {
|
| | | for(var k=0;k<ThArr.length;k++)
|
| | | {
|
| | | TrArray[i].append(TdArray[n]);
|
| | | n++;
|
| | | }
|
| | | TrArray[i].append($('<td style="visibility: hidden"></td>'));
|
| | | }
|
| | | //给th赋给thead
|
| | | var _tr = $('<tr></tr>');
|
| | | for(var i=0;i<ThArr.length;i++)
|
| | | {
|
| | | _tr.append(ThArray[i]);
|
| | | }
|
| | | _tr.append($('<th style="visibility: hidden"></th>'));
|
| | | _thead.append(_tr);
|
| | | _table.append(_thead);
|
| | | // 将tr赋给table
|
| | | for(var i=0;i<TrLength;i++)
|
| | | {
|
| | | _tbody.append(TrArray[i]);
|
| | | }
|
| | | _table.append(_tbody);
|
| | | //将table添加到指定的容器中
|
| | | ele.append(_table).trigger('create');
|
| | | }*/
|
| | |
|
| | | /**
|
| | | 向表格内添加数据
|
| | | @param object ele jquery对象表格容器
|
| | | @param array ThArr 表格头部数据
|
| | | @param array TdArr 表格数据
|
| | | */
|
| | | function addTrToTbl(ele, ThArr, TdArr) {
|
| | | var _table=$('<table data-role="table" class="ui-responsive"></table>');
|
| | | var _thead=$('<thead></thead>');
|
| | | var _tbody=$('<tbody></tbody>');
|
| | | var ThArray=new Array(); //设置th的数组
|
| | | var TrArray=new Array(); //设置tr的数组
|
| | | var TdArray=new Array(); //设置td的数组
|
| | | var TdLength; //获取单元格个数
|
| | | var TrLength; //获取行数
|
| | | TdLength=TdArr.length;
|
| | | TrLength=Math.ceil(TdLength/ThArr.length);
|
| | | // 给每个th设置值
|
| | | for(var i=0;i<ThArr.length;i++)
|
| | | {
|
| | | ThArray[i]=$('<th>'+ThArr[i]+'</th>');
|
| | | }
|
| | | // 给每个td设置值
|
| | | for(var i=0;i<TdLength;i++)
|
| | | {
|
| | | TdArray[i]=$("<td>"+TdArr[i]+"</td>");
|
| | | }
|
| | |
|
| | | //设置tr
|
| | | for(var i=0;i<TrLength;i++)
|
| | | {
|
| | | TrArray[i]=$("<tr></tr>");
|
| | | }
|
| | | //将td以col个赋给tr
|
| | | var n=0;
|
| | | for(var i=0;i<TrLength;i++)
|
| | | {
|
| | | for(var k=0;k<ThArr.length;k++)
|
| | | {
|
| | | TrArray[i].append(TdArray[n]);
|
| | | n++;
|
| | | }
|
| | | TrArray[i].append($('<td style="visibility: hidden"></td>'));
|
| | | }
|
| | | //给th赋给thead
|
| | | var _tr = $('<tr></tr>');
|
| | | for(var i=0;i<ThArr.length;i++)
|
| | | {
|
| | | _tr.append(ThArray[i]);
|
| | | }
|
| | | _tr.append($('<th style="visibility: hidden"></th>'));
|
| | | _thead.append(_tr);
|
| | | _table.append(_thead);
|
| | | // 将tr赋给table
|
| | | for(var i=0;i<TrLength;i++)
|
| | | {
|
| | | _tbody.append(TrArray[i]);
|
| | | }
|
| | | _table.append(_tbody);
|
| | | //将table添加到指定的容器中
|
| | | ele.append(_table).trigger('create');
|
| | | for (let i = 0; i < TrLength; i++) {
|
| | | var _table=$('<table data-role="table" class="ui-responsive"></table>');
|
| | | var _tbody=$('<tbody></tbody>');
|
| | | for (let m = 0, n = ThArr.length; m < n; m++) {
|
| | | _tbody.append('<tr><th>' + ThArr[m] + '</th><td>' + TdArr[n * i + m] + '</td></tr>')
|
| | | }
|
| | | _table.append(_tbody);
|
| | | ele.append(_table);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
| | | */
|
| | | function getGruopEndurTimeLong(moncapstd, realcap, curr53) {
|
| | | var endurTimeLong = 0;
|
| | | var real_curr45 = curr53*53/45;
|
| | | var hourRate = N_TO_10H(GetHourRate(moncapstd, real_curr45));
|
| | | endurTimeLong = realcap/(hourRate*real_curr45);
|
| | | |
| | | if(curr53 != 0) {
|
| | | var real_curr45 = curr53*53/45;
|
| | | var hourRate = N_TO_10H(GetHourRate(moncapstd, real_curr45));
|
| | | endurTimeLong = realcap/(hourRate*real_curr45);
|
| | | }
|
| | | return endurTimeLong;
|
| | | }
|
| | |
|
| | |
| | | .page-filter-content .layui-select {
|
| | | border: 0;
|
| | | }
|
| | | .page-filter-content input[type=text] {
|
| | | height: 36px;
|
| | | width: 100%;
|
| | | }
|
| | | .page-filter-content .layui-input {
|
| | | height: 30px;
|
| | | font-size: 14px;
|
| | |
| | | return str;
|
| | | }
|
| | |
|
| | | // 生成跳转的链接
|
| | | function skipURL (param) {
|
| | | // page, province, city, county, home,battid,monnum
|
| | | if (!param.page) {
|
| | | console.log('参数错误');
|
| | | return "PARAM_ERROR";
|
| | | }
|
| | | var str = Object.keys(param).length > 1 ? param.page + '?' : param.page;
|
| | | var paramKeys = Object.keys(param);
|
| | | paramKeys.splice(paramKeys.indexOf('page'), 1);
|
| | | paramKeys.forEach(function (c, i, a) {
|
| | | if (i == 0) {
|
| | | str += c + "=" + encodeURIComponent(param[c]);
|
| | | } else {
|
| | | str += "&" + c + "=" + encodeURIComponent(param[c]);
|
| | | }
|
| | | });
|
| | | // console.log('url :', str);
|
| | | return str;
|
| | | }
|
| | |
|
| | | // 检测用户是否有权限
|
| | | function checkUserPermit(permits, name) {
|
| | | var rs = false;
|
| | |
| | | // 切换省调整市和区/县
|
| | | this.province.off('change.LinkAge.event').on('change.LinkAge.event', function() {
|
| | | var val = $(this).find('option:selected').attr('num');
|
| | | console.log(val);
|
| | | // console.log(val);
|
| | | // 市
|
| | | var citiesData = _this._getCities(val);
|
| | | var citiesOptions = _this._createDom(citiesData);
|
| | |
| | | // 切换市
|
| | | this.city.off('change.LinkAge.event').on('change.LinkAge.event', function() {
|
| | | var val = $(this).find('option:selected').attr('num');
|
| | | console.log(val);
|
| | | // console.log(val);
|
| | | // 区/县
|
| | | var countiesData = _this._getCounty(_this.province.find('option:selected').attr('num'), val);
|
| | | var countiesOptions = _this._createDom(countiesData);
|
| | |
| | | var _data = $.extend(preData||{}, data||{});
|
| | | var tds = this._getBodyTds(index);
|
| | | var tdRs = this._getFixedRTds(index);
|
| | | //console.log(_data);
|
| | | this.cache[index] = _data;
|
| | | // 遍历
|
| | | var _this = this;
|
| | | layui.each(_data, function(key, value) {
|
| | |
| | | this.updateTr(index, _data); // 更新指定的行
|
| | | }else {
|
| | | console.log(' 第'+i+'个对象没有对象的表格行');
|
| | | console.log(_data);
|
| | | // console.log(_data);
|
| | | }
|
| | | }else {
|
| | | console.log(' 第'+i+'个对象的'+field+'主键标识不存在');
|
| | | }
|
| | | }
|
| | | }
|
| | | // 更新tablecache 重新获取
|
| | | ,getCache: function (cache) {
|
| | | this.cache = cache;
|
| | | }
|
| | | ,_getBodyTds: function(index) {
|
| | | var layuiTableView = $(this.ele).next('.layui-table-view');
|
| | | var layuiTableBody = layuiTableView.find('.layui-table-body .layui-table tbody');
|
| | |
| | | ,_setStyle() {
|
| | | var _this = this;
|
| | | var imgs = this.container.find('img');
|
| | | console.log(imgs.length);
|
| | | // console.log(imgs.length);
|
| | | imgs.each(function() {
|
| | | var size = $(this).data();
|
| | | // 判断宽高是否存在
|
| | |
| | | <div class="layui-page-container">
|
| | | <!-- 条件筛选 -->
|
| | | <div class="layui-page-filter">
|
| | | <div class="page-filter-header layui-page-filter-fweight">电池信息配置</div>
|
| | | <div class="page-filter-header layui-page-filter-fweight">设备温度统计</div>
|
| | | <div class="page-filter-content">
|
| | | <table>
|
| | | <tr class="layui-page-filter-tbl-header layui-page-filter-fweight">
|
| | | <td>省</td> <!-- 省 -->
|
| | | <td>市</td> <!-- 市 -->
|
| | | <td>区/县</td> <!-- 市 -->
|
| | | <td><s:text name="Computer_name"/></td> <!-- 机房名称 -->
|
| | | <!-- <td><s:text name="Computer_name"/></td> --> <!-- 机房名称 -->
|
| | | <td colspan='2'>日期范围</td>
|
| | | </tr>
|
| | | <tr>
|
| | |
| | | {"taskchange_query_permit","37"}, //作业变更查询
|
| | |
|
| | | {"batt_test_op_permit","58"}, //电池放电测试
|
| | | {"batt_discharge_model_permit","81"}, //批量电池放电测试
|
| | | {"batt_test_op_permit","81"}, //电池放电测试
|
| | | //{"batt_discharge_model_permit","81"}, //批量电池放电测试
|
| | |
|
| | | //超级管理员界面
|
| | | {"batt_discharge_model_permit","59"}, //设备充放电模块参数
|
| | |
| | | {"batt_discharge_model_permit","64"}, //用户密码重置
|
| | | {"batt_discharge_model_permit","65"}, //班组管理
|
| | | {"batt_discharge_model_permit","71"}, //电池组配组管理
|
| | | {"install_look_permit","82"}, //基站安装审批
|
| | | {"install_look_permit","82"}, //基站安装审批
|
| | | {"batt_discharge_model_permit","83"}, //BTS设备升级
|
| | | {"batt_discharge_model_permit","84"}, //批量电池组参数设置
|
| | | {"batt_discharge_model_permit","85"}, //批量系统参数设置
|
| | |
| | |
|
| | | //web版登录
|
| | | public String login() {
|
| | | //System.err.println(uinf);
|
| | | model=vservice.login(uinf);
|
| | | //System.out.println(model);
|
| | | if(model.getCode()!=1){
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | if(model.getCode()==1){
|
| | | Cookie c = null;
|
| | | //System.out.println(ActionUtil.DecryptionBase64());
|
| | | if(uinf.getUId() == 1){
|
| | | c = new Cookie("user", ActionUtil.EncryptionBase64(ActionUtil.getGson().toJson(uinf)).toString());
|
| | | }else{
|
| | | c = new Cookie("user", "");
|
| | | }
|
| | | //让Cookie保留30天
|
| | | c.setMaxAge(30*24*60*60);
|
| | | ActionUtil.getResponse().addCookie(c);
|
| | | }
|
| | | result=ActionUtil.tojson(model);
|
| | | return "success";
|
| | | }
|
| | |
|
| | | |
| | | |
| | | //手机端登录action
|
| | | public String MobileLogin(){
|
| | | System.out.println(uinf);
|
| | | //System.out.println(uinf);
|
| | | String usnId64=(String) ActionUtil.EncryptionBase64(uinf.getUpassword());
|
| | | uinf.setUpassword(usnId64);
|
| | | //System.out.println(usnId64+" : action");
|
| | |
| | | package com.fgkj.dao.impl;
|
| | |
|
| | | import java.sql.Connection;
|
| | | import java.sql.ResultSet;
|
| | | import java.sql.SQLException;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import com.fgkj.dao.BaseDAO;
|
| | | import com.fgkj.dao.CallBack;
|
| | | import com.fgkj.dao.DAOHelper;
|
| | | import com.fgkj.dao.LimitNumberFactory;
|
| | | import com.fgkj.dao.UinfDaoFactory;
|
| | | import com.fgkj.db.DBUtil;
|
| | | import com.fgkj.dto.Batt_replace;
|
| | | import com.fgkj.dto.Page;
|
| | | import com.fgkj.dto.User_log;
|
| | | import com.fgkj.services.User_logService;
|
| | | import com.sun.org.apache.regexp.internal.recompile;
|
| | |
|
| | | public class Batt_replaceImpl implements BaseDAO,CallBack{
|
| | | //添加机房电池更改记录
|
| | | @Override
|
| | | public boolean add(Object obj) {
|
| | | Batt_replace re=(Batt_replace) obj;
|
| | | String sql=" insert into web_site.tb_batt_replace(stationid,replaced_producer,replaced_moncapstd,replaced_monvolstd,replaced_moncount,replaced_uid,replaced_time,replaced_reason) values(?,?,?,?,?,?,?,?) ";
|
| | | boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[] {re.getStationid(),re.getReplaced_producer(),re.getReplaced_moncapstd(),re.getReplaced_monvolstd(),re.getReplaced_moncount()
|
| | | ,re.getReplaced_uid(),re.getReplaced_time(),re.getReplaced_reason()});
|
| | | return bl;
|
| | | }
|
| | | //修改机房电池更改记录
|
| | | @Override
|
| | | public boolean update(Object obj) {
|
| | | Batt_replace re=(Batt_replace) obj;
|
| | | String sql=" update web_site.tb_batt_replace set replaced_producer=?,replaced_moncapstd=?,replaced_monvolstd=?,replaced_moncount=?,replaced_uid=?,replaced_time=?,replaced_reason=? where stationid=? and num=? ";
|
| | | boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[] {re.getReplaced_producer(),re.getReplaced_moncapstd(),re.getReplaced_monvolstd(),re.getReplaced_moncount()
|
| | | ,re.getReplaced_uid(),re.getReplaced_time(),re.getReplaced_reason(),re.getStationid(),re.getNum()});
|
| | | return bl;
|
| | | }
|
| | | //删除机房电池更改记录(多条)
|
| | | @Override
|
| | | public boolean del(Object obj) {
|
| | | List<Batt_replace> list=(List<Batt_replace>) obj;
|
| | | ArrayList sql_str=new ArrayList();
|
| | | List<User_log> listU=new ArrayList<User_log>();//存放user_log
|
| | | if(list!=null&&list.size()>0) {
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Batt_replace re=list.get(i);
|
| | | String sql=" delete from web_site.tb_batt_replace where stationid="+re.getStationid()+" and num="+re.getNum();
|
| | | sql_str.add(sql);
|
| | | {
|
| | | String msg="删除"+re.getStationid()+"机房的电池更改记录";
|
| | | User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Delete, msg);
|
| | | listU.add(ulog);
|
| | | }
|
| | | }
|
| | | }
|
| | | boolean bl=DAOHelper.makeManualCommit(DBUtil.getConn(), sql_str);
|
| | | (new User_logService()).addPro(listU);//将用户的操作记录下来
|
| | | return bl;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List searchAll() {
|
| | | // TODO Auto-generated method stub
|
| | | return null;
|
| | | }
|
| | | //机房电池更换管理查询
|
| | | @Override
|
| | | public List serchByCondition(Object obj) {
|
| | | Batt_replace breplace=(Batt_replace) obj;
|
| | | Page p=breplace.getPage();
|
| | | String numberSql=" SELECT FOUND_ROWS() number";
|
| | | Connection conn=DBUtil.getConn();
|
| | | String sql=" select SQL_CALC_FOUND_ROWS distinct tb_batt_replace.num, tb_batt_replace.stationid,replaced_producer,replaced_moncapstd,replaced_monvolstd"
|
| | | + ",replaced_moncount,replaced_uid,replaced_time,replaced_reason"
|
| | | + ",db_battinf.tb_battinf.stationname "
|
| | | + " from db_battinf.tb_battinf,web_site.tb_batt_replace "
|
| | | + " where db_battinf.tb_battinf.stationid=tb_batt_replace.stationid "
|
| | | + " and stationname1 like ? and stationname2 like ? and stationname5 like ? and tb_batt_replace.stationid like ? "
|
| | | + " order by stationid ";
|
| | | String limitSql=" limit ?,? ";
|
| | | sql+=limitSql;
|
| | | List<Batt_replace> list=DAOHelper.executeQueryLimit(sql, conn, new Object [] {"%"+breplace.getStationname1()+"%","%"+breplace.getStationname2()+"%","%"+breplace.getStationname5()+"%","%"+breplace.getStationid()+"%"
|
| | | ,(p.getPageCurr() - 1)* p.getPageSize(),p.getPageSize() }, new CallBack() {
|
| | | |
| | | @Override
|
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()) {
|
| | | Batt_replace re=new Batt_replace();
|
| | | re.setNum(rs.getInt("num"));
|
| | | re.setStationid(rs.getString("stationid"));
|
| | | re.setStationname(rs.getString("stationname"));
|
| | | re.setReplaced_producer(rs.getString("replaced_producer"));
|
| | | re.setReplaced_moncapstd(rs.getInt("replaced_moncapstd"));
|
| | | re.setReplaced_monvolstd(rs.getFloat("replaced_monvolstd"));
|
| | | re.setReplaced_moncount(rs.getInt("replaced_moncount"));
|
| | | re.setReplaced_time(rs.getTimestamp("replaced_time"));
|
| | | re.setReplaced_uid(rs.getInt("replaced_uid"));
|
| | | re.setReplaced_uname((new User_infImpl()).changeUidToUname(rs.getInt("replaced_uid")));
|
| | | re.setReplaced_reason(rs.getString("replaced_reason"));
|
| | | Page p=new Page();
|
| | | re.setPage(p);
|
| | | list.add(re);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | });
|
| | | //去掉limit条件后的总数
|
| | | int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql);
|
| | | //System.out.println("number: "+number);
|
| | | if(list!=null&&list.size()>0){
|
| | | list.get(list.size()-1).getPage().setPageAll(number);
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List serchByInfo(Object obj) {
|
| | | // TODO Auto-generated method stub
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List getResults(ResultSet rs) {
|
| | | // TODO Auto-generated method stub
|
| | | return null;
|
| | | }
|
| | | public static void main(String[] args) {
|
| | | Batt_replaceImpl bimpl=new Batt_replaceImpl();
|
| | | Batt_replace re=new Batt_replace();
|
| | | re.setStationid("42000011");
|
| | | re.setStationname1("");
|
| | | re.setStationname2("");
|
| | | re.setStationname5("");
|
| | | Page p=new Page();
|
| | | p.setPageCurr(1);
|
| | | p.setPageSize(10);
|
| | | re.setPage(p);
|
| | | List<Batt_replace> list=bimpl.serchByCondition(re);
|
| | | for (Batt_replace b : list) {
|
| | | System.out.println(b);
|
| | | }
|
| | | }
|
| | | }
|
| | | package com.fgkj.dao.impl; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.fgkj.dao.BaseDAO; |
| | | import com.fgkj.dao.CallBack; |
| | | import com.fgkj.dao.DAOHelper; |
| | | import com.fgkj.dao.LimitNumberFactory; |
| | | import com.fgkj.dao.UinfDaoFactory; |
| | | import com.fgkj.db.DBUtil; |
| | | import com.fgkj.dto.Batt_replace; |
| | | import com.fgkj.dto.Page; |
| | | import com.fgkj.dto.User_log; |
| | | import com.fgkj.services.User_logService; |
| | | import com.sun.org.apache.regexp.internal.recompile; |
| | | |
| | | public class Batt_replaceImpl implements BaseDAO,CallBack{ |
| | | //添加机房电池更改记录 |
| | | @Override |
| | | public boolean add(Object obj) { |
| | | Batt_replace re=(Batt_replace) obj; |
| | | String sql=" insert into web_site.tb_batt_replace(stationid,replaced_producer,replaced_moncapstd,replaced_monvolstd,replaced_moncount,replaced_uid,replaced_time,replaced_reason,replace_date,GroupIndexInFBSDevice) values(?,?,?,?,?,?,?,?,?,?) "; |
| | | boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[] {re.getStationid(),re.getReplaced_producer(),re.getReplaced_moncapstd(),re.getReplaced_monvolstd(),re.getReplaced_moncount() |
| | | ,re.getReplaced_uid(),re.getReplaced_time(),re.getReplaced_reason(),re.getReplace_date(),re.getGroupIndexInFBSDevice()}); |
| | | return bl; |
| | | } |
| | | //修改机房电池更改记录 |
| | | @Override |
| | | public boolean update(Object obj) { |
| | | Batt_replace re=(Batt_replace) obj; |
| | | String sql=" update web_site.tb_batt_replace set replaced_producer=?,replaced_moncapstd=?,replaced_monvolstd=?,replaced_moncount=?,replaced_uid=?,replace_date=?,replaced_time=?,replaced_reason=? where stationid=? and num=? "; |
| | | boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[] {re.getReplaced_producer(),re.getReplaced_moncapstd(),re.getReplaced_monvolstd(),re.getReplaced_moncount() |
| | | ,re.getReplaced_uid(),re.getReplace_date(),re.getReplaced_time(),re.getReplaced_reason(),re.getStationid(),re.getNum()}); |
| | | return bl; |
| | | } |
| | | //删除机房电池更改记录(多条) |
| | | @Override |
| | | public boolean del(Object obj) { |
| | | List<Batt_replace> list=(List<Batt_replace>) obj; |
| | | ArrayList sql_str=new ArrayList(); |
| | | List<User_log> listU=new ArrayList<User_log>();//存放user_log |
| | | if(list!=null&&list.size()>0) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | Batt_replace re=list.get(i); |
| | | String sql=" delete from web_site.tb_batt_replace where stationid="+re.getStationid()+" and num="+re.getNum(); |
| | | sql_str.add(sql); |
| | | { |
| | | String msg="删除"+re.getStationid()+"机房的电池更改记录"; |
| | | User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Delete, msg); |
| | | listU.add(ulog); |
| | | } |
| | | } |
| | | } |
| | | boolean bl=DAOHelper.makeManualCommit(DBUtil.getConn(), sql_str); |
| | | (new User_logService()).addPro(listU);//将用户的操作记录下来 |
| | | return bl; |
| | | } |
| | | |
| | | @Override |
| | | public List searchAll() { |
| | | // TODO Auto-generated method stub |
| | | return null; |
| | | } |
| | | //机房电池更换管理查询 |
| | | @Override |
| | | public List serchByCondition(Object obj) { |
| | | Batt_replace breplace=(Batt_replace) obj; |
| | | Page p=breplace.getPage(); |
| | | String numberSql=" SELECT FOUND_ROWS() number"; |
| | | Connection conn=DBUtil.getConn(); |
| | | String sql=" select SQL_CALC_FOUND_ROWS distinct tb_batt_replace.num, tb_batt_replace.stationid,replaced_producer,replaced_moncapstd,replaced_monvolstd" |
| | | + ",replaced_moncount,replaced_uid,replaced_time,replaced_reason,replace_date " |
| | | + ",db_battinf.tb_battinf.stationname,db_battinf.tb_battinf.battgroupid,db_battinf.tb_battinf.battgroupname,db_battinf.tb_battinf.GroupIndexInFBSDevice " |
| | | + " from db_battinf.tb_battinf,web_site.tb_batt_replace " |
| | | + " where db_battinf.tb_battinf.stationid=tb_batt_replace.stationid " |
| | | + " and db_battinf.tb_battinf.GroupIndexInFBSDevice=tb_batt_replace.GroupIndexInFBSDevice " |
| | | + " and stationname1 like ? and stationname2 like ? and stationname5 like ? and tb_batt_replace.stationid like ? " |
| | | + " and replace_date>=? and replace_date<=? " |
| | | + " order by stationid "; |
| | | String limitSql=" limit ?,? "; |
| | | sql+=limitSql; |
| | | //sssSystem.out.println(sql); |
| | | List<Batt_replace> list=DAOHelper.executeQueryLimit(sql, conn, new Object [] {"%"+breplace.getStationname1()+"%","%"+breplace.getStationname2()+"%","%"+breplace.getStationname5()+"%","%"+breplace.getStationid()+"%" |
| | | ,breplace.getReplace_date(),breplace.getReplace_date1(),(p.getPageCurr() - 1)* p.getPageSize(),p.getPageSize() }, new CallBack() { |
| | | |
| | | @Override |
| | | public List getResults(ResultSet rs) { |
| | | List list=new ArrayList(); |
| | | try { |
| | | while(rs.next()) { |
| | | Batt_replace re=new Batt_replace(); |
| | | re.setNum(rs.getInt("num")); |
| | | re.setStationid(rs.getString("stationid")); |
| | | re.setStationname(rs.getString("stationname")); |
| | | re.setReplaced_producer(rs.getString("replaced_producer")); |
| | | re.setReplaced_moncapstd(rs.getInt("replaced_moncapstd")); |
| | | re.setReplaced_monvolstd(rs.getFloat("replaced_monvolstd")); |
| | | re.setReplaced_moncount(rs.getInt("replaced_moncount")); |
| | | re.setReplaced_time(rs.getTimestamp("replaced_time")); |
| | | re.setReplaced_uid(rs.getInt("replaced_uid")); |
| | | re.setReplaced_uname((new User_infImpl()).changeUidToUname(rs.getInt("replaced_uid"))); |
| | | re.setReplaced_reason(rs.getString("replaced_reason")); |
| | | re.setReplace_date(rs.getDate("replace_date")); |
| | | re.setBattgroupid(rs.getString("battgroupid")); |
| | | re.setBattgroupname(rs.getString("battgroupname")); |
| | | re.setGroupIndexInFBSDevice(rs.getInt("groupIndexInFBSDevice")); |
| | | Page p=new Page(); |
| | | re.setPage(p); |
| | | list.add(re); |
| | | } |
| | | } catch (SQLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | //去掉limit条件后的总数 |
| | | int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql); |
| | | //System.out.println("number: "+number); |
| | | if(list!=null&&list.size()>0){ |
| | | list.get(list.size()-1).getPage().setPageAll(number); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List serchByInfo(Object obj) { |
| | | // TODO Auto-generated method stub |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List getResults(ResultSet rs) { |
| | | // TODO Auto-generated method stub |
| | | return null; |
| | | } |
| | | public static void main(String[] args) throws ParseException { |
| | | Batt_replaceImpl bimpl=new Batt_replaceImpl(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date date1 = sdf.parse("2000-01-01"); |
| | | Date date2 = sdf.parse("2050-01-01"); |
| | | Batt_replace re=new Batt_replace(); |
| | | re.setStationid(""); |
| | | re.setStationname1(""); |
| | | re.setStationname2(""); |
| | | re.setStationname5(""); |
| | | re.setReplace_date(date1); |
| | | re.setReplace_date1(date2); |
| | | Page p=new Page(); |
| | | p.setPageCurr(1); |
| | | p.setPageSize(10); |
| | | re.setPage(p); |
| | | List<Batt_replace> list=bimpl.serchByCondition(re); |
| | | for (Batt_replace b : list) { |
| | | System.out.println(b); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.fgkj.dto;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | public class Batt_replace implements Serializable{
|
| | | private int num;
|
| | | private String stationid;
|
| | | private String stationname;
|
| | | private String stationname1;
|
| | | private String stationname2;
|
| | | private String stationname5;
|
| | | private String replaced_producer;
|
| | | private int replaced_moncapstd;
|
| | | private float replaced_monvolstd;
|
| | | private int replaced_moncount;
|
| | | private int replaced_uid;
|
| | | private String replaced_uname;
|
| | | private Date replaced_time;
|
| | | private Date replaced_time1;
|
| | | private String replaced_reason;
|
| | | private String note;
|
| | | private Page page;
|
| | | public int getNum() {
|
| | | return num;
|
| | | }
|
| | | public void setNum(int num) {
|
| | | this.num = num;
|
| | | }
|
| | | public String getStationid() {
|
| | | return stationid;
|
| | | }
|
| | | public void setStationid(String stationid) {
|
| | | this.stationid = stationid;
|
| | | }
|
| | | public String getStationname() {
|
| | | return stationname;
|
| | | }
|
| | | public void setStationname(String stationname) {
|
| | | this.stationname = stationname;
|
| | | }
|
| | | public String getReplaced_producer() {
|
| | | return replaced_producer;
|
| | | }
|
| | | public void setReplaced_producer(String replaced_producer) {
|
| | | this.replaced_producer = replaced_producer;
|
| | | }
|
| | | public int getReplaced_moncapstd() {
|
| | | return replaced_moncapstd;
|
| | | }
|
| | | public void setReplaced_moncapstd(int replaced_moncapstd) {
|
| | | this.replaced_moncapstd = replaced_moncapstd;
|
| | | }
|
| | | public float getReplaced_monvolstd() {
|
| | | return replaced_monvolstd;
|
| | | }
|
| | | public void setReplaced_monvolstd(float replaced_monvolstd) {
|
| | | this.replaced_monvolstd = replaced_monvolstd;
|
| | | }
|
| | | public int getReplaced_moncount() {
|
| | | return replaced_moncount;
|
| | | }
|
| | | public void setReplaced_moncount(int replaced_moncount) {
|
| | | this.replaced_moncount = replaced_moncount;
|
| | | }
|
| | | public int getReplaced_uid() {
|
| | | return replaced_uid;
|
| | | }
|
| | | public void setReplaced_uid(int replaced_uid) {
|
| | | this.replaced_uid = replaced_uid;
|
| | | }
|
| | | public Date getReplaced_time() {
|
| | | return replaced_time;
|
| | | }
|
| | | public void setReplaced_time(Date replaced_time) {
|
| | | this.replaced_time = replaced_time;
|
| | | }
|
| | | public String getReplaced_reason() {
|
| | | return replaced_reason;
|
| | | }
|
| | | public void setReplaced_reason(String replaced_reason) {
|
| | | this.replaced_reason = replaced_reason;
|
| | | }
|
| | | public String getNote() {
|
| | | return note;
|
| | | }
|
| | | public void setNote(String note) {
|
| | | this.note = note;
|
| | | }
|
| | | public String getStationname1() {
|
| | | return stationname1;
|
| | | }
|
| | | public void setStationname1(String stationname1) {
|
| | | this.stationname1 = stationname1;
|
| | | }
|
| | | public String getStationname2() {
|
| | | return stationname2;
|
| | | }
|
| | | public void setStationname2(String stationname2) {
|
| | | this.stationname2 = stationname2;
|
| | | }
|
| | | public String getStationname5() {
|
| | | return stationname5;
|
| | | }
|
| | | public void setStationname5(String stationname5) {
|
| | | this.stationname5 = stationname5;
|
| | | }
|
| | | |
| | | public String getReplaced_uname() {
|
| | | return replaced_uname;
|
| | | }
|
| | | public void setReplaced_uname(String replaced_uname) {
|
| | | this.replaced_uname = replaced_uname;
|
| | | }
|
| | | public Page getPage() {
|
| | | return page;
|
| | | }
|
| | | public void setPage(Page page) {
|
| | | this.page = page;
|
| | | }
|
| | | public Date getReplaced_time1() {
|
| | | return replaced_time1;
|
| | | }
|
| | | public void setReplaced_time1(Date replaced_time1) {
|
| | | this.replaced_time1 = replaced_time1;
|
| | | }
|
| | | @Override
|
| | | public String toString() {
|
| | | return "Batt_replace [num=" + num + ", stationid=" + stationid
|
| | | + ", stationname=" + stationname + ", stationname1="
|
| | | + stationname1 + ", stationname2=" + stationname2
|
| | | + ", stationname5=" + stationname5 + ", replaced_producer="
|
| | | + replaced_producer + ", replaced_moncapstd="
|
| | | + replaced_moncapstd + ", replaced_monvolstd="
|
| | | + replaced_monvolstd + ", replaced_moncount="
|
| | | + replaced_moncount + ", replaced_uid=" + replaced_uid
|
| | | + ", replaced_uname=" + replaced_uname + ", replaced_time="
|
| | | + replaced_time + ", replaced_time1=" + replaced_time1
|
| | | + ", replaced_reason=" + replaced_reason + ", note=" + note
|
| | | + ", page=" + page + "]";
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | }
|
| | | package com.fgkj.dto; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class Batt_replace implements Serializable{ |
| | | private int num; |
| | | private String stationid; |
| | | private String battgroupid; |
| | | private String stationname; |
| | | private String stationname1; |
| | | private String stationname2; |
| | | private String stationname5; |
| | | private String battgroupname; |
| | | private int GroupIndexInFBSDevice; |
| | | private String replaced_producer; |
| | | private int replaced_moncapstd; |
| | | private float replaced_monvolstd; |
| | | private int replaced_moncount; |
| | | private int replaced_uid; |
| | | private String replaced_uname; |
| | | private Date replaced_time; |
| | | private Date replaced_time1; |
| | | private String replaced_reason; |
| | | private String note; |
| | | private Page page; |
| | | private Date replace_date; |
| | | private Date replace_date1; |
| | | public int getNum() { |
| | | return num; |
| | | } |
| | | public void setNum(int num) { |
| | | this.num = num; |
| | | } |
| | | public String getStationid() { |
| | | return stationid; |
| | | } |
| | | public void setStationid(String stationid) { |
| | | this.stationid = stationid; |
| | | } |
| | | public String getStationname() { |
| | | return stationname; |
| | | } |
| | | public void setStationname(String stationname) { |
| | | this.stationname = stationname; |
| | | } |
| | | public String getReplaced_producer() { |
| | | return replaced_producer; |
| | | } |
| | | public void setReplaced_producer(String replaced_producer) { |
| | | this.replaced_producer = replaced_producer; |
| | | } |
| | | public int getReplaced_moncapstd() { |
| | | return replaced_moncapstd; |
| | | } |
| | | public void setReplaced_moncapstd(int replaced_moncapstd) { |
| | | this.replaced_moncapstd = replaced_moncapstd; |
| | | } |
| | | public float getReplaced_monvolstd() { |
| | | return replaced_monvolstd; |
| | | } |
| | | public void setReplaced_monvolstd(float replaced_monvolstd) { |
| | | this.replaced_monvolstd = replaced_monvolstd; |
| | | } |
| | | public int getReplaced_moncount() { |
| | | return replaced_moncount; |
| | | } |
| | | public void setReplaced_moncount(int replaced_moncount) { |
| | | this.replaced_moncount = replaced_moncount; |
| | | } |
| | | public int getReplaced_uid() { |
| | | return replaced_uid; |
| | | } |
| | | public void setReplaced_uid(int replaced_uid) { |
| | | this.replaced_uid = replaced_uid; |
| | | } |
| | | public Date getReplaced_time() { |
| | | return replaced_time; |
| | | } |
| | | public void setReplaced_time(Date replaced_time) { |
| | | this.replaced_time = replaced_time; |
| | | } |
| | | public String getReplaced_reason() { |
| | | return replaced_reason; |
| | | } |
| | | public void setReplaced_reason(String replaced_reason) { |
| | | this.replaced_reason = replaced_reason; |
| | | } |
| | | public String getNote() { |
| | | return note; |
| | | } |
| | | public void setNote(String note) { |
| | | this.note = note; |
| | | } |
| | | public String getStationname1() { |
| | | return stationname1; |
| | | } |
| | | public void setStationname1(String stationname1) { |
| | | this.stationname1 = stationname1; |
| | | } |
| | | public String getStationname2() { |
| | | return stationname2; |
| | | } |
| | | public void setStationname2(String stationname2) { |
| | | this.stationname2 = stationname2; |
| | | } |
| | | public String getStationname5() { |
| | | return stationname5; |
| | | } |
| | | public void setStationname5(String stationname5) { |
| | | this.stationname5 = stationname5; |
| | | } |
| | | |
| | | public String getReplaced_uname() { |
| | | return replaced_uname; |
| | | } |
| | | public void setReplaced_uname(String replaced_uname) { |
| | | this.replaced_uname = replaced_uname; |
| | | } |
| | | public Page getPage() { |
| | | return page; |
| | | } |
| | | public void setPage(Page page) { |
| | | this.page = page; |
| | | } |
| | | public Date getReplaced_time1() { |
| | | return replaced_time1; |
| | | } |
| | | public void setReplaced_time1(Date replaced_time1) { |
| | | this.replaced_time1 = replaced_time1; |
| | | } |
| | | |
| | | public Date getReplace_date() { |
| | | return replace_date; |
| | | } |
| | | public void setReplace_date(Date replace_date) { |
| | | this.replace_date = replace_date; |
| | | } |
| | | |
| | | public Date getReplace_date1() { |
| | | return replace_date1; |
| | | } |
| | | public void setReplace_date1(Date replace_date1) { |
| | | this.replace_date1 = replace_date1; |
| | | } |
| | | |
| | | public String getBattgroupid() { |
| | | return battgroupid; |
| | | } |
| | | public void setBattgroupid(String battgroupid) { |
| | | this.battgroupid = battgroupid; |
| | | } |
| | | |
| | | public String getBattgroupname() { |
| | | return battgroupname; |
| | | } |
| | | public void setBattgroupname(String battgroupname) { |
| | | this.battgroupname = battgroupname; |
| | | } |
| | | public int getGroupIndexInFBSDevice() { |
| | | return GroupIndexInFBSDevice; |
| | | } |
| | | public void setGroupIndexInFBSDevice(int groupIndexInFBSDevice) { |
| | | GroupIndexInFBSDevice = groupIndexInFBSDevice; |
| | | } |
| | | @Override |
| | | public String toString() { |
| | | return "Batt_replace [num=" + num + ", stationid=" + stationid |
| | | + ", battgroupid=" + battgroupid + ", stationname=" |
| | | + stationname + ", stationname1=" + stationname1 |
| | | + ", stationname2=" + stationname2 + ", stationname5=" |
| | | + stationname5 + ", battgroupname=" + battgroupname |
| | | + ", GroupIndexInFBSDevice=" + GroupIndexInFBSDevice |
| | | + ", replaced_producer=" + replaced_producer |
| | | + ", replaced_moncapstd=" + replaced_moncapstd |
| | | + ", replaced_monvolstd=" + replaced_monvolstd |
| | | + ", replaced_moncount=" + replaced_moncount |
| | | + ", replaced_uid=" + replaced_uid + ", replaced_uname=" |
| | | + replaced_uname + ", replaced_time=" + replaced_time |
| | | + ", replaced_time1=" + replaced_time1 + ", replaced_reason=" |
| | | + replaced_reason + ", note=" + note + ", page=" + page |
| | | + ", replace_date=" + replace_date + ", replace_date1=" |
| | | + replace_date1 + "]"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.fgkj.services;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.servlet.ServletContext;
|
| | |
|
| | | import com.fgkj.actions.ActionUtil;
|
| | | import com.fgkj.dao.BaseDAO;
|
| | | import com.fgkj.dao.BaseDAOFactory;
|
| | | import com.fgkj.dao.impl.User_infImpl;
|
| | | import com.fgkj.dto.Batt_User_Permit;
|
| | | import com.fgkj.dto.Page;
|
| | | import com.fgkj.dto.ServiceModel;
|
| | | import com.fgkj.dto.UserClient;
|
| | | import com.fgkj.dto.User_battgroup_baojigroup;
|
| | | import com.fgkj.dto.User_battgroup_baojigroup_battgroup;
|
| | | import com.fgkj.dto.User_inf;
|
| | | import com.fgkj.dto.User_permitgroup;
|
| | |
|
| | | public class User_infService extends ActionUtil {
|
| | | private ServiceModel model;
|
| | | private User_permitgroupService upservice;
|
| | | private BaseDAO dao;
|
| | |
|
| | | public User_infService() {
|
| | | model = new ServiceModel();
|
| | | dao = BaseDAOFactory.getBaseDAO(BaseDAO.USER_INF);
|
| | | upservice = new User_permitgroupService();
|
| | | }
|
| | |
|
| | | //5.1用户管理(添加)
|
| | | public ServiceModel add(Object obj) {
|
| | | int flag=((User_infImpl)dao).addJudge(obj);
|
| | | //System.out.println(flag);
|
| | | if(flag!=0){
|
| | | Boolean bl=dao.add(obj);
|
| | | if(bl){
|
| | | model.setCode(1);
|
| | | model.setMsg("添加成功!");
|
| | | }
|
| | | else{
|
| | | model.setCode(0);
|
| | | model.setMsg("添加失败!");
|
| | | }
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("用户名存在,请重新输入!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | |
|
| | | // 5.1用户管理(编辑)
|
| | | public ServiceModel update(Object obj) {
|
| | | Boolean bl = false;
|
| | | bl=dao.update(obj);
|
| | | if(bl){
|
| | | model.setCode(1);
|
| | | model.setMsg("修改成功");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("修改失败");
|
| | | }
|
| | | return model;
|
| | | }
|
| | |
|
| | | // 5.1用户管理(删除)
|
| | | public ServiceModel delete(Object obj) {
|
| | | Boolean bl = dao.del(obj);
|
| | | //System.out.println(obj);
|
| | | if (bl) {
|
| | | model.setCode(1);
|
| | | model.setMsg("删除成功!");
|
| | | } else {
|
| | | model.setMsg("删除失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | |
|
| | | public ServiceModel serchByCondition(Object obj) {
|
| | | List list = dao.serchByCondition(obj);
|
| | | /*
|
| | | * for (Object object : list) { System.out.println(object); }
|
| | | */
|
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | }
|
| | | // System.out.println(model);
|
| | | return model;
|
| | | }
|
| | | //5.1查询所有员工信息
|
| | | public ServiceModel searchAll() {
|
| | | List<User_inf> list = dao.searchAll();
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | }
|
| | | return model;
|
| | | }
|
| | |
|
| | | // 根据battgroupid查对应的包机人
|
| | | public ServiceModel searchByBattGroupId(Object obj) {
|
| | | model = new ServiceModel();
|
| | | List<User_inf> list = ((User_infImpl) dao).searchByBattGroupId(obj);
|
| | | // System.out.println(list.size());
|
| | | /*
|
| | | * for(User_inf u:list){ System.out.println(u); }
|
| | | */
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | // battgroupid对应的所有包机人姓名和id
|
| | | String uStrN = "";
|
| | | String uStrI = "";
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | uStrN += ",";
|
| | | uStrI += ",";
|
| | | uStrN += list.get(i).getUName().toString();
|
| | | uStrI += list.get(i).getUId().toString();
|
| | | }
|
| | | uStrN = uStrN.substring(1, uStrN.length());
|
| | | uStrI = uStrI.substring(1, uStrI.length());
|
| | | model.setMsg(uStrN);
|
| | | model.setMsgO(uStrI);
|
| | | } else {
|
| | | model.setCode(0);
|
| | | }
|
| | | // System.out.println(model.getMsg());
|
| | | // System.out.println(model);
|
| | | return model;
|
| | | }
|
| | |
|
| | | // 3.1根据uid查用户信息(uname)
|
| | | public ServiceModel serchuName(Object obj) {
|
| | | model = new ServiceModel();
|
| | | List list = ((User_infImpl) dao).serchUname(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | } else {
|
| | | model.setCode(0);
|
| | | }
|
| | | // System.out.println(model);
|
| | | return model;
|
| | | }
|
| | |
|
| | | // 5.1查询员工的所有信息
|
| | | public ServiceModel searchAll(Object obj) {
|
| | | // System.out.println((Batt_User_Permit)obj);
|
| | | model = new ServiceModel();
|
| | | Batt_User_Permit bup = new Batt_User_Permit();
|
| | | User_permitgroup usergroup = new User_permitgroup();
|
| | | List<Batt_User_Permit> list = ((User_infImpl) dao).searchAll(obj);// 存放的是员工信息
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | ServiceModel model1 = upservice.serchByCondition(list.get(i).getUinf());// 存放权限
|
| | | // System.out.println(model1.getMsgN());
|
| | | if (model1.getCode() > 0) {
|
| | | list.get(i).getUinf().setPermitgroupName(model1.getMsgN());
|
| | | } else {
|
| | | list.get(i).getUinf().setPermitgroupName("");
|
| | | }
|
| | | }
|
| | | model.setData(list);
|
| | | }
|
| | | // System.out.println(model);
|
| | | return model;
|
| | | }
|
| | |
|
| | | // 5.3根据uid查所在的包机组
|
| | | public ServiceModel serchByInfo(Object obj) {
|
| | | model = new ServiceModel();
|
| | | List<User_battgroup_baojigroup> list = dao.serchByInfo(obj);
|
| | | // System.out.println(list.size());
|
| | | // for(User_battgroup_baojigroup u:list){
|
| | | // System.out.println(u);
|
| | | // }
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | |
|
| | | } else {
|
| | | model.setCode(0);
|
| | | }
|
| | | // System.out.println(model);
|
| | | return model;
|
| | | }
|
| | |
|
| | | // 用户登录
|
| | | public ServiceModel login(Object obj) {
|
| | | User_inf uinf = (User_inf) obj;
|
| | | //String usnId64 = (String) ActionUtil.DecryptionBase64(uinf.getUpassword());
|
| | | //String usnIdMd5 = (String) ActionUtil.EncryptionMD5(usnId64);
|
| | | // System.out.println(uinf.getUSnId()+" "+usnId64+" "+usnIdMd5+" :service");
|
| | | //uinf.setUpassword(usnIdMd5);
|
| | | List list = dao.serchByCondition(uinf);
|
| | | if (list == null || list.size() < 1) {
|
| | | model.setMsg(this.getText("Username_error"));
|
| | | // System.out.println("用户名不存在");
|
| | | } else {
|
| | | User_inf u = (User_inf) list.get(0);
|
| | | //System.out.println(uinf.getUpassword());
|
| | | // System.out.println(uinf.getUSnId()+"=="+u.getUNote());
|
| | | if (!uinf.getUpassword().equals(u.getUpassword())) {
|
| | | System.out.println("密码错误"+uinf.getUpassword()+"=="+u.getUpassword());
|
| | | model.setMsg(getText("Password_error"));
|
| | | } else {
|
| | | uinf.setUSnId(u.getUSnId());
|
| | | model.setCode(1);
|
| | | model.setMsg("index.jsp");
|
| | | //model.setMsg("index-outline.jsp");
|
| | | // 将登陆成功的用户存入session
|
| | | ActionUtil.getSession().setAttribute("user", u);
|
| | | |
| | | //设置session不活动时间为30分
|
| | | ActionUtil.getSession().setMaxInactiveInterval(60*30);
|
| | | ActionUtil.getSession().setAttribute("ip",ActionUtil.getRequest().getRemoteAddr());
|
| | | User_permitgroupService upgs=new User_permitgroupService();
|
| | | ServiceModel model1=upgs.serchItem(u);
|
| | | //System.out.println(model.getData());
|
| | | if(model1.getCode()==1){
|
| | | ActionUtil.getSession().setAttribute("permits", ActionUtil.tojson(model1.getData()));
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("还未分配权限");
|
| | | }
|
| | | //将新登录的用户存入application
|
| | | setApplication(u);
|
| | | }
|
| | | }
|
| | | return model;
|
| | | }
|
| | |
|
| | | // 将所有登陆的用户的信息存到application中
|
| | | public void setApplication(User_inf user) {
|
| | | ServletContext application = ActionUtil.getApplication();
|
| | | Map<String, UserClient> map = (Map) application.getAttribute("users");
|
| | | if (map == null) {
|
| | | map = new HashMap<String, UserClient>();
|
| | | } else {
|
| | | UserClient client = map.get(user.getUName());
|
| | | if (client != null) {
|
| | | map.remove(user.getUName());
|
| | | }
|
| | | }
|
| | | Long login_time = new Date().getTime();
|
| | | ActionUtil.getSession().setAttribute("login_time", login_time);
|
| | | map.put(user.getUName(), new UserClient(ActionUtil.getRequest().getRemoteAddr(),user,login_time));
|
| | | application.setAttribute("users", map);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 开始查看application中是否有另一用使用该账号登陆
|
| | | * |
| | | * @return
|
| | | */
|
| | | |
| | | public ServiceModel checkUser() {
|
| | | Map<String, UserClient> map = (Map) ActionUtil.getApplication().getAttribute("users");
|
| | | // System.out.println(map);
|
| | | if (map != null && map.size() > 0) {
|
| | | User_inf user = (User_inf) ActionUtil.getSession().getAttribute("user");
|
| | | Long login_time = (Long) ActionUtil.getSession().getAttribute("login_time");
|
| | | if (user != null && login_time != null) {
|
| | | UserClient client = map.get(user.getUName());
|
| | | if (client != null) {
|
| | | if (login_time == client.getLogin_times()) {
|
| | | model.setCode(0);
|
| | | }else {
|
| | | model.setCode(1);
|
| | | model.setMsg(getText("The landing on the account in another host, please log in again"));
|
| | | }
|
| | | }else {
|
| | | model.setCode(1);
|
| | | model.setMsg(getText("You are not logged in, please log in"));
|
| | | }
|
| | | } else {
|
| | | model.setCode(1);
|
| | | model.setMsg(getText("You are not logged in, please log in"));
|
| | | }
|
| | | } else {
|
| | | model.setCode(1);
|
| | | model.setMsg(getText("You are not logged in, please log in"));
|
| | | }
|
| | | return model;
|
| | | }
|
| | |
|
| | | //修改用户密码
|
| | | public ServiceModel updatePassword(Object obj){
|
| | | User_inf uinf=(User_inf) obj;
|
| | | uinf.setUpassword((String)ActionUtil.EncryptionMD5(uinf.getUSnId()));
|
| | | //System.out.println(uinf);
|
| | | Boolean bl=((User_infImpl)dao).updatePassword(uinf);
|
| | | if(bl){
|
| | | model.setCode(1);
|
| | | model.setMsg("修改成功!");
|
| | | }
|
| | | else{
|
| | | model.setMsg("修改失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | |
| | | //根据员工信息和员工编号去匹配合适的员工
|
| | | public ServiceModel searchByNameOrId(Object obj){
|
| | | List<User_inf> list=((User_infImpl)dao).searchByNameOrId(obj);
|
| | | |
| | | if(list!=null&&list.size()>0){
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }
|
| | | else{
|
| | | model.setCode(0);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | |
|
| | | //重置用户密码
|
| | | public ServiceModel resetPassword(Object obj){
|
| | | Boolean bl=((User_infImpl)dao).resetPassword(obj);
|
| | | if(bl){
|
| | | model.setCode(1);
|
| | | model.setMsg("修改成功!");
|
| | | }
|
| | | else{
|
| | | model.setMsg("修改失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | public static void main(String[] args) {
|
| | | User_infService us = new User_infService();
|
| | | User_inf u = new User_inf();
|
| | | u.setUName("a");
|
| | | u.setUEmployeeId("a");
|
| | | u.setUId(1003);
|
| | | Batt_User_Permit bup = new Batt_User_Permit();
|
| | | Page page = new Page();
|
| | | page.setPageSize(10);
|
| | | page.setPageCurr(1);
|
| | | bup.setPage(page);
|
| | | bup.setUinf(u);
|
| | |
|
| | | //User_battgroup_baojigroup_battgroup ub = new User_battgroup_baojigroup_battgroup();
|
| | | // ub.setBattGroupId(1000012);
|
| | | // us.searchByBattGroupId(ub);
|
| | | // us.serchByInfo(u);
|
| | | // System.out.println(us.searchAll(bup).getData());
|
| | | us.searchByNameOrId(bup);
|
| | | }
|
| | | }
|
| | | package com.fgkj.services; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.ServletContext; |
| | | import javax.servlet.http.Cookie; |
| | | |
| | | import com.fgkj.actions.ActionUtil; |
| | | import com.fgkj.dao.BaseDAO; |
| | | import com.fgkj.dao.BaseDAOFactory; |
| | | import com.fgkj.dao.impl.User_infImpl; |
| | | import com.fgkj.dto.Batt_User_Permit; |
| | | import com.fgkj.dto.Page; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.UserClient; |
| | | import com.fgkj.dto.User_battgroup_baojigroup; |
| | | import com.fgkj.dto.User_battgroup_baojigroup_battgroup; |
| | | import com.fgkj.dto.User_inf; |
| | | import com.fgkj.dto.User_permitgroup; |
| | | |
| | | public class User_infService extends ActionUtil { |
| | | private ServiceModel model; |
| | | private User_permitgroupService upservice; |
| | | private BaseDAO dao; |
| | | |
| | | public User_infService() { |
| | | model = new ServiceModel(); |
| | | dao = BaseDAOFactory.getBaseDAO(BaseDAO.USER_INF); |
| | | upservice = new User_permitgroupService(); |
| | | } |
| | | |
| | | //5.1用户管理(添加) |
| | | public ServiceModel add(Object obj) { |
| | | int flag=((User_infImpl)dao).addJudge(obj); |
| | | //System.out.println(flag); |
| | | if(flag!=0){ |
| | | Boolean bl=dao.add(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("添加成功!"); |
| | | } |
| | | else{ |
| | | model.setCode(0); |
| | | model.setMsg("添加失败!"); |
| | | } |
| | | }else{ |
| | | model.setCode(0); |
| | | model.setMsg("用户名存在,请重新输入!"); |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | // 5.1用户管理(编辑) |
| | | public ServiceModel update(Object obj) { |
| | | Boolean bl = false; |
| | | bl=dao.update(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("修改成功"); |
| | | }else{ |
| | | model.setCode(0); |
| | | model.setMsg("修改失败"); |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | // 5.1用户管理(删除) |
| | | public ServiceModel delete(Object obj) { |
| | | Boolean bl = dao.del(obj); |
| | | //System.out.println(obj); |
| | | if (bl) { |
| | | model.setCode(1); |
| | | model.setMsg("删除成功!"); |
| | | } else { |
| | | model.setMsg("删除失败!"); |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | public ServiceModel serchByCondition(Object obj) { |
| | | List list = dao.serchByCondition(obj); |
| | | /* |
| | | * for (Object object : list) { System.out.println(object); } |
| | | */ |
| | | |
| | | if (list != null && list.size() > 0) { |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | } |
| | | // System.out.println(model); |
| | | return model; |
| | | } |
| | | //5.1查询所有员工信息 |
| | | public ServiceModel searchAll() { |
| | | List<User_inf> list = dao.searchAll(); |
| | | if (list != null && list.size() > 0) { |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | // 根据battgroupid查对应的包机人 |
| | | public ServiceModel searchByBattGroupId(Object obj) { |
| | | model = new ServiceModel(); |
| | | List<User_inf> list = ((User_infImpl) dao).searchByBattGroupId(obj); |
| | | // System.out.println(list.size()); |
| | | /* |
| | | * for(User_inf u:list){ System.out.println(u); } |
| | | */ |
| | | if (list != null && list.size() > 0) { |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | // battgroupid对应的所有包机人姓名和id |
| | | String uStrN = ""; |
| | | String uStrI = ""; |
| | | for (int i = 0; i < list.size(); i++) { |
| | | uStrN += ","; |
| | | uStrI += ","; |
| | | uStrN += list.get(i).getUName().toString(); |
| | | uStrI += list.get(i).getUId().toString(); |
| | | } |
| | | uStrN = uStrN.substring(1, uStrN.length()); |
| | | uStrI = uStrI.substring(1, uStrI.length()); |
| | | model.setMsg(uStrN); |
| | | model.setMsgO(uStrI); |
| | | } else { |
| | | model.setCode(0); |
| | | } |
| | | // System.out.println(model.getMsg()); |
| | | // System.out.println(model); |
| | | return model; |
| | | } |
| | | |
| | | // 3.1根据uid查用户信息(uname) |
| | | public ServiceModel serchuName(Object obj) { |
| | | model = new ServiceModel(); |
| | | List list = ((User_infImpl) dao).serchUname(obj); |
| | | if (list != null && list.size() > 0) { |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | } else { |
| | | model.setCode(0); |
| | | } |
| | | // System.out.println(model); |
| | | return model; |
| | | } |
| | | |
| | | // 5.1查询员工的所有信息 |
| | | public ServiceModel searchAll(Object obj) { |
| | | // System.out.println((Batt_User_Permit)obj); |
| | | model = new ServiceModel(); |
| | | Batt_User_Permit bup = new Batt_User_Permit(); |
| | | User_permitgroup usergroup = new User_permitgroup(); |
| | | List<Batt_User_Permit> list = ((User_infImpl) dao).searchAll(obj);// 存放的是员工信息 |
| | | if (list != null && list.size() > 0) { |
| | | model.setCode(1); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | ServiceModel model1 = upservice.serchByCondition(list.get(i).getUinf());// 存放权限 |
| | | // System.out.println(model1.getMsgN()); |
| | | if (model1.getCode() > 0) { |
| | | list.get(i).getUinf().setPermitgroupName(model1.getMsgN()); |
| | | } else { |
| | | list.get(i).getUinf().setPermitgroupName(""); |
| | | } |
| | | } |
| | | model.setData(list); |
| | | } |
| | | // System.out.println(model); |
| | | return model; |
| | | } |
| | | |
| | | // 5.3根据uid查所在的包机组 |
| | | public ServiceModel serchByInfo(Object obj) { |
| | | model = new ServiceModel(); |
| | | List<User_battgroup_baojigroup> list = dao.serchByInfo(obj); |
| | | // System.out.println(list.size()); |
| | | // for(User_battgroup_baojigroup u:list){ |
| | | // System.out.println(u); |
| | | // } |
| | | if (list != null && list.size() > 0) { |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | |
| | | } else { |
| | | model.setCode(0); |
| | | } |
| | | // System.out.println(model); |
| | | return model; |
| | | } |
| | | |
| | | // 用户登录 |
| | | public ServiceModel login(Object obj) { |
| | | User_inf uinf = (User_inf) obj; |
| | | //String usnId64 = (String) ActionUtil.DecryptionBase64(uinf.getUpassword()); |
| | | //String usnIdMd5 = (String) ActionUtil.EncryptionMD5(usnId64); |
| | | // System.out.println(uinf.getUSnId()+" "+usnId64+" "+usnIdMd5+" :service"); |
| | | //uinf.setUpassword(usnIdMd5); |
| | | List list = dao.serchByCondition(uinf); |
| | | if (list == null || list.size() < 1) { |
| | | model.setMsg(this.getText("Username_error")); |
| | | // System.out.println("用户名不存在"); |
| | | } else { |
| | | User_inf u = (User_inf) list.get(0); |
| | | //System.out.println(uinf.getUpassword()); |
| | | // System.out.println(uinf.getUSnId()+"=="+u.getUNote()); |
| | | if (!uinf.getUpassword().equals(u.getUpassword())) { |
| | | //System.out.println("密码错误"+uinf.getUpassword()+"=="+u.getUpassword()); |
| | | model.setMsg(getText("Password_error")); |
| | | } else { |
| | | //uinf.setUSnId(u.getUSnId()); |
| | | model.setCode(1); |
| | | model.setMsg("index.jsp"); |
| | | //model.setMsg("index-outline.jsp"); |
| | | |
| | | setMyCookie("user",u,30,uinf.getUId() == 1); //用户记住密码功能 |
| | | |
| | | // 将登陆成功的用户存入session |
| | | u.setUSnId(""); |
| | | u.setUpassword(""); |
| | | ActionUtil.getSession().setAttribute("user", u); |
| | | |
| | | //设置session不活动时间为30分 |
| | | ActionUtil.getSession().setMaxInactiveInterval(60*30); |
| | | ActionUtil.getSession().setAttribute("ip",ActionUtil.getRequest().getRemoteAddr()); |
| | | User_permitgroupService upgs=new User_permitgroupService(); |
| | | ServiceModel model1=upgs.serchItem(u); |
| | | //System.out.println(model.getData()); |
| | | if(model1.getCode()==1){ |
| | | ActionUtil.getSession().setAttribute("permits", ActionUtil.tojson(model1.getData())); |
| | | }else{ |
| | | model.setCode(0); |
| | | model.setMsg("还未分配权限"); |
| | | } |
| | | //将新登录的用户存入application |
| | | setApplication(u); |
| | | } |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | // 将所有登陆的用户的信息存到application中 |
| | | public void setApplication(User_inf user) { |
| | | ServletContext application = ActionUtil.getApplication(); |
| | | Map<String, UserClient> map = (Map) application.getAttribute("users"); |
| | | if (map == null) { |
| | | map = new HashMap<String, UserClient>(); |
| | | } else { |
| | | UserClient client = map.get(user.getUName()); |
| | | if (client != null) { |
| | | map.remove(user.getUName()); |
| | | } |
| | | } |
| | | Long login_time = new Date().getTime(); |
| | | ActionUtil.getSession().setAttribute("login_time", login_time); |
| | | map.put(user.getUName(), new UserClient(ActionUtil.getRequest().getRemoteAddr(),user,login_time)); |
| | | application.setAttribute("users", map); |
| | | } |
| | | |
| | | /** |
| | | * 保存指定的cookie值 |
| | | * @param key cookie 键 |
| | | * @param obj 值 |
| | | * @param timelong 保存时长(秒) |
| | | * @param flag 是否保存 |
| | | */ |
| | | public void setMyCookie(String key,Object obj,long timelong,boolean flag){ |
| | | Cookie c = null; |
| | | if(flag){ |
| | | //记住密码 |
| | | c = new Cookie(key, ActionUtil.EncryptionBase64(ActionUtil.getGson().toJson(obj)).toString()); |
| | | }else{ |
| | | c = new Cookie(key, ""); |
| | | } |
| | | //让Cookie保留30天 |
| | | c.setMaxAge(30*24*60*60); |
| | | ActionUtil.getResponse().addCookie(c); |
| | | } |
| | | |
| | | /** |
| | | * 开始查看application中是否有另一用使用该账号登陆 |
| | | * |
| | | * @return |
| | | */ |
| | | |
| | | public ServiceModel checkUser() { |
| | | Map<String, UserClient> map = (Map) ActionUtil.getApplication().getAttribute("users"); |
| | | // System.out.println(map); |
| | | if (map != null && map.size() > 0) { |
| | | User_inf user = (User_inf) ActionUtil.getSession().getAttribute("user"); |
| | | Long login_time = (Long) ActionUtil.getSession().getAttribute("login_time"); |
| | | if (user != null && login_time != null) { |
| | | UserClient client = map.get(user.getUName()); |
| | | if (client != null) { |
| | | if (login_time == client.getLogin_times()) { |
| | | model.setCode(0); |
| | | }else { |
| | | model.setCode(1); |
| | | model.setMsg(getText("The landing on the account in another host, please log in again")); |
| | | } |
| | | }else { |
| | | model.setCode(1); |
| | | model.setMsg(getText("You are not logged in, please log in")); |
| | | } |
| | | } else { |
| | | model.setCode(1); |
| | | model.setMsg(getText("You are not logged in, please log in")); |
| | | } |
| | | } else { |
| | | model.setCode(1); |
| | | model.setMsg(getText("You are not logged in, please log in")); |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | //修改用户密码 |
| | | public ServiceModel updatePassword(Object obj){ |
| | | User_inf uinf=(User_inf) obj; |
| | | uinf.setUpassword((String)ActionUtil.EncryptionMD5(uinf.getUSnId())); |
| | | //System.out.println(uinf); |
| | | Boolean bl=((User_infImpl)dao).updatePassword(uinf); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("修改成功!"); |
| | | } |
| | | else{ |
| | | model.setMsg("修改失败!"); |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | //根据员工信息和员工编号去匹配合适的员工 |
| | | public ServiceModel searchByNameOrId(Object obj){ |
| | | List<User_inf> list=((User_infImpl)dao).searchByNameOrId(obj); |
| | | |
| | | if(list!=null&&list.size()>0){ |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | model.setMsg("查询成功!"); |
| | | } |
| | | else{ |
| | | model.setCode(0); |
| | | model.setMsg("查询失败!"); |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | //重置用户密码 |
| | | public ServiceModel resetPassword(Object obj){ |
| | | Boolean bl=((User_infImpl)dao).resetPassword(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("修改成功!"); |
| | | } |
| | | else{ |
| | | model.setMsg("修改失败!"); |
| | | } |
| | | return model; |
| | | } |
| | | public static void main(String[] args) { |
| | | User_infService us = new User_infService(); |
| | | User_inf u = new User_inf(); |
| | | u.setUName("a"); |
| | | u.setUEmployeeId("a"); |
| | | u.setUId(1003); |
| | | Batt_User_Permit bup = new Batt_User_Permit(); |
| | | Page page = new Page(); |
| | | page.setPageSize(10); |
| | | page.setPageCurr(1); |
| | | bup.setPage(page); |
| | | bup.setUinf(u); |
| | | |
| | | //User_battgroup_baojigroup_battgroup ub = new User_battgroup_baojigroup_battgroup(); |
| | | // ub.setBattGroupId(1000012); |
| | | // us.searchByBattGroupId(ub); |
| | | // us.serchByInfo(u); |
| | | // System.out.println(us.searchAll(bup).getData()); |
| | | us.searchByNameOrId(bup); |
| | | } |
| | | } |
| | |
| | | import java.util.Map;
|
| | |
|
| | | import javax.servlet.ServletContext;
|
| | | import javax.servlet.http.Cookie;
|
| | |
|
| | | import com.fgkj.actions.ActionUtil;
|
| | | import com.fgkj.dao.BaseDAO;
|
| | |
| | | model.setMsg("navConfig.jsp");
|
| | | getSession().setAttribute("vip",list.get(i));
|
| | | Map<String, UserClient> map = (Map) ActionUtil.getApplication().getAttribute("vips");
|
| | | |
| | | setMyCookie("user",uinf,30,uinf.getUId() == 1); //用户记住密码功能
|
| | | if (map == null) {
|
| | | map = new HashMap<String, UserClient>();
|
| | | } else {
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 保存指定的cookie值
|
| | | * @param key cookie 键
|
| | | * @param obj 值
|
| | | * @param timelong 保存时长(秒)
|
| | | * @param flag 是否保存
|
| | | */
|
| | | public void setMyCookie(String key,Object obj,long timelong,boolean flag){
|
| | | Cookie c = null;
|
| | | if(flag){
|
| | | //记住密码
|
| | | c = new Cookie(key, ActionUtil.EncryptionBase64(ActionUtil.getGson().toJson(obj)).toString());
|
| | | }else{
|
| | | c = new Cookie(key, "");
|
| | | }
|
| | | //让Cookie保留30天
|
| | | c.setMaxAge(30*24*60*60);
|
| | | ActionUtil.getResponse().addCookie(c);
|
| | | }
|
| | | |
| | | /**
|
| | | * 开始是否有另一台主机登陆当前账号
|
| | | *
|
| | | * @return
|