123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437 |
- <!--#include file="/inc/header.html"-->
- <style>
- @media screen
- {
- #canvas
- {
- display: block;
- }
- #image
- {
- display: none;
- }
- }
- @media print
- {
- #canvas
- {
- display: none;
- }
- #image
- {
- display: block;
- }
- }
- </style>
- <style>
- .author-nav-tree {
- display: inline-block;
- width: 200px;
- min-height: 400px;
- border: 1px solid lightgrey;
- float: left;
- overflow-x: hidden;
- overflow-y: auto;
- margin-top: 10px;
- }
- #con-map {
- min-height: 400px;
- display: inline-block;
- margin-top: 10px;
- }
- .bif-con {
- width: 1200px;
- height:500px;
- margin-top: 0px;
- margin-left: 0px;
- float: left;
- }
- .bif-nav-item {
- width: 150px;
- text-align: center;
- }
- </style>
- <script type="text/javascript">
- window.renderHeader=function(e)
- {
- var template="{{#childenList}}<li class=\"bif-nav-item\" title=\"{{moduleUrl}}\" data-fun=\"{{moduleUrl}}\" data-href=\"{{moduleUrl}}\">{{moduleName}}</li>{{/childenList}}";
- var views = Mustache.render(template, e);
- $("#bif-nav-ul").html(views);
- $("#bif-nav-ul li").each(function(){
- var txt=$(this).text();
- if(txt=='巡查点定义'){
- $(this).addClass("active");
- $(".tree-breadcrumb #nav-item-a").html("巡查点定义");
- }
- })
- };
- $(function(){
- var modules=JSON.parse(window.sessionStorage.getItem("modules"));
- if(window.treemap){
- renderHeader(window.treemap[13]);//参数管理 7
- }else if(modules){
- renderHeader(modules.treemap[13]);
- }
- })
- var getGrainData = {};
- $.ajax({
- type: "get",
- dataType: 'json',
- async: false,
- url: config.baseUrl + config.organization.getAllGrainList,
- success: function(e) {
- getGrainData = e.data.data;
- },
- error: function(e) {
- console.log(e);
- }
- });
- </script>
- <div class="con-wrap" style="min-height: 400px;">
- <div class="tree-breadcrumb">
- <span class="nav-prov">首页</span>>
- <span class="nav-prov"><a id="cansgl" href="/pages/basedata/index.html">参数管理</a></span>>
- <span class="nav-prov"><a href="javascript:;" id="nav-item-a"></a></span>
- </div>
- <div id="con-map" class="main3" style="margin-top: 0px;overflow:hidden">
- <div class="bif-nav">
- <ul id="bif-nav-ul" >
- </ul>
- </div>
- <div class="bif-container">
- <div class="bif-con panel-noscroll" style="width:1200px">
- <div id="bd-toolbar" style="margin-top: 0;padding: 10px 5px"> 
- 库名:<input class="easyui-combobox libraryNameT" style="width:120px" name="inventoryDetail-libraryName" editable=true>
- 巡查点名称:<input class="easyui-textbox easyui-validatebox search-nameOther bd-w-name" name="checkpointName" data-options="validType:'length[0,20]'"> 
- <a href="javascript:;" class="easyui-linkbutton bd-add-s bd-search"> 查找</a>
- <a href="#" class="easyui-linkbutton bd-add-s bd-add-bt3">新增</a>
- <a href="#" class="easyui-linkbutton bd-add-s clear-btn2" plain="true">清空</a>
- </div>
- <div id="base-table">
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="checkadd-w easyui-window " style="padding-left: 10px" data-options="closed:true"></div>
- <div class="bd-w easyui-window" style="padding-left: 10px" data-options="closed:true">
- <form class="bd-w-form" style="margin-top: 12px;">
- <input type="hidden" name="id" >
- <span class="pf-pitem-li">
- <span class="pf-pitem-lit">巡查点名称:</span>
- <span class="pf-pitem-lic"><input class="easyui-textbox checkpointName" data-options="validType:'length[0,20]',width:'160px',height:'20px',required:true" name="checkpointName"></span>
- </span>
- <span class="pf-pitem-li">
- <span class="pf-pitem-lit">库名:</span>
- <span class="pf-pitem-lic"><input class="easyui-combobox updateGrainId " data-options="required:true,width:'160px'" name="checkpointGrainId" editable=false></span>
- </span>
- <span class="pf-pitem-li">
- <span class="pf-pitem-lit">位置描述:</span>
- <span class="pf-pitem-lic">
- <input class="easyui-textbox easyui-validatebox" data-options="validType:'length[0,50]',width:'160px',height:'70px',multiline:true" name="checkpointDesc">
- </span>
- </span>
- <br/>
- <a href="#" class="easyui-linkbutton bd-add-s btn-add-new" plain="true" style="margin-top: 20px;">确定</a>
- <a href="javascript:;" class="easyui-linkbutton bd-add-s " onclick="$('.bd-w').window('close');" plain="true" style="margin-top: 20px;">取消</a>
- </form>
- </div>
- <!--#include file="/inc/footer.html"-->
- <!--二维码页面-->
- <div class="erweimap easyui-window" style="padding-left: 10px" data-options="closed:true">
- <!--startprint-->
- <div id="codeHtml">
- <div id="code"></div>
- </div>
- <a id="download" download="qrcode.jpg"></a>
- <a href="#" class="easyui-linkbutton dayin" plain="true" style="margin-top: 20px;">打印</a>
- <a id="saveQrCode" class="easyui-linkbutton" plain="true" style="margin-top: 20px;cursor: pointer;">下载二维码</a>
- <!--endprint onclick="$('.erweimap').window('close');"-->
- </div>
- <img id="image" src=""/>
- </body>
- </html>
- <script type="text/javascript">
- $(function() {
- // var value=["虫害","结露","温度","验收"];
- group.dropdownWhole(".libraryNameT");
- baseData.initNav();
- loadData();
- search();
- addNewLine();
- $('.clear-btn2').on('click',function(e){
- e.preventDefault();
- $('.search-nameOther').textbox('clear');
- $('.libraryNameT').combobox('clear');
- });
- });
- function loadData(name,grainId){
- var url=config.baseUrl + config.checkpoint.listPage+"?1=1";
- if(name){
- url=url+"&checkpointName="+name;
- }
- if(grainId){
- url=url+"&grainId="+grainId;
- }
- $('#base-table').datagrid({
- url: url,
- method: 'post',
- rownumbers: true,
- pagination: true,
- fitColumns: true,
- singleSelect: true,
- selectOnCheck: false,
- checkOnSelect: false,
- toolbar: '#bd-toolbar',
- fit: true,
- columns: [[
- {field:'checkpointGrainName', title:'库名', width:'15%',
- formatter: function(value,row,index){
- if(value=='' || value=='undefined' || value==null || value=='null'){
- }else{
- return '<span title='+value+'>'+value+'</span>';
- }
- }},
- {field:'checkpointName', title:'巡查点名称', width:'20%',
- formatter: function(value,row,index){
- if(value=='' || value=='undefined' || value==null || value=='null'){
- }else{
- return '<span title='+value+'>'+value+'</span>';
- }
- }},
- {field:'checkpointDesc', title:'巡查点位置描述', width:'20%',
- formatter: function(value,row,index){
- if(value=='' || value=='undefined' || value==null || value=='null'){
- }else{
- return '<span title='+value+'>'+value+'</span>';
- }
- }},
- {
- field:'id',
- title:'操作',
- width:'25%',
- align: 'center',
- formatter: function(value, row, index) {
- //return '<a class="record_record_update t-update" data-id=' + row.id + '>更新</a>';
- return '<a class="record_record_update t-update" data-id=' + row.id + '>修改</a> | <a class="t-del bm-del" data-id=' + row.id + '>删除</a> | <a class=" t-update erweima" data-id=' + row.id + ' >二维码</a>';
- }
- }
- ]],
- loadFilter: function(e) {
- return {
- total: e.data.count,
- rows: e.data.list
- };
- },
- onLoadSuccess: function() {
- // base.delInfo('.iso-noticeMag-del', config.noticeMag.toDelete, '#noticeMag-info');
- update();
- $('.t-del').on('click', function() {
- var id = $(this).data('id');
- $.messager.confirm('提示', '确认删除', function(e) {
- if (e) {
- base.ajaxFunc('get', config.checkpoint.toDelete, {
- id: id
- }, function(e) {
- if (e.code === 0) {
- $.messager.alert('提示', e.msg, 'info');
- $('#tree-tt').tree('reload');
- $('#base-table').datagrid('reload');
- } else {
- $.messager.alert('警告', e.msg, 'error');
- }
- });
- }
- });
- });
- $(".erweima").off("click").on("click",function(){
- $("#code").empty();
- base.renderwindow('.erweimap',
- {
- title: '二维码',
- width: 440,
- height: 500,
- });
- var id=$(this).data('id');
- var erwei="checkpoint_"+id;
- erwei=toUtf8(erwei);
- $("#code").qrcode({
- render: "canvas", //table方式
- width: 400, //宽度
- height:400, //高度
- text: erwei //任意内容
- });
- $('.erweimap').window('open').window('center');
- dayinerweima();
- xiazai();
- });
- }
- });
- }
- function xiazai() {
- $('#saveQrCode').click(function () {
- var canvas = $('#code').find("canvas").get(0);
- try {//解决IE转base64时缓存不足,canvas转blob下载
- var blob = canvas.msToBlob();
- navigator.msSaveBlob(blob, 'qrcode.jpg');
- } catch (e) {//如果为其他浏览器,使用base64转码下载
- var url = canvas.toDataURL('image/jpeg');
- $("#download").attr('href', url).get(0).click();
- }
- return false;
- });
- }
- function dayinerweima(){
- $(".dayin").off().on("click",function(){
- var img = document.getElementById("image"); /// get image element
- var canvas = document.getElementsByTagName("canvas")[0]; /// get canvas element
- img.src = canvas.toDataURL(); /// update image
- $("#image").jqprint({
- debug:false,
- importCSS:true,
- printContainer:true,
- operaSupport:false
- });
- });
- }
- function update(){
- $(".record_record_update").off("click").on("click",function(){
- base.renderwindow('.bd-w',
- {
- title: '修改巡查点信息',
- width: 450,
- height: 270,
- });
- var id=$(this).data('id');
- $('.bd-w').window('open').window('center');
- //将id的值绑定到确认按钮上
- base.ajaxFunc('get', config.checkpoint.getById, {id: id}, function(e) {
- var row = e.obj;
- $('.bd-w-form').form("clear").form('load',row);
- group.initGrainHouseCombox(".bd-w-form .updateGrainId",true);
- group.editGrainHouseCombox(".bd-w-form .updateGrainId",".houseId",e.obj.checkpointGrainId,e.obj.houseId,false);
- //当鼠标移动到文本框时显示该文本框的信息内容
- $(".bd-w-form input,textarea").each(function(i) {
- var str=$(this).val();
- $(this).attr("title", $(this).val());
- });
- doupdate();
- });
- });
- }
- function doupdate(){
- $(".btn-add-new").off().on("click",function(){
- var data = $('.bd-w-form').serializeArray();
- var valresult=$(".bd-w-form").form('validate');
- if(!valresult){
- $.messager.alert('提示', base.tooltip, 'info');
- return;
- }
- base.ajaxFunc('post', config.checkpoint.toUpdate, data, function(e) {
- base.requestTip(e, '.bd-w', '#base-table', 0);
- });
- });
- }
- function search(){
- $(".bd-search").off("click").on("click",function(){
- if(!$('.search-nameOther').textbox('isValid')) return;
- var checkpointName = $('.search-nameOther').textbox('getValue');
- var grainId = $('.libraryNameT').combobox('getValue');
- loadData(checkpointName,grainId);
- });
- }
- function addNewLine() {
- //添加按钮bd-add-bt3点击事件
- $('.bd-add-bt3').off('click').on('click', function(e) {
- e.preventDefault();
- $(".checkpointGrainId").combobox('clear');
- group.initGrainHouseCombox(".storeman-manage-form .checkpointGrainId",true);
- var href = '/pages/basedata/checkpointAdd.html';
- $('.checkadd-w').load(href,function(){
- $.parser.parse($('.checkadd-w'));
- $('#bm-add-form').form('clear');
- //确定按钮事件
- $('.bd-win-y').on('click', function(e){
- e.preventDefault();
- var $form = $("#bm-add-form");//表单信息
- var postData = $form.serialize();
- if($("#bm-add-form .bd-w-checkpointName").val() == ""){
- $.messager.alert('操作提示', '有重要参数未填写');
- return false;
- }
- //postData.typeName = $('#typeName').combobox('getValue');
- base.ajaxFunc('post', config.checkpoint.toInsert, postData, function(e){
- //$.messager.alert('操作提示', '添加成功');
- base.requestTip(e, '.checkadd-w', '#base-table', 0);
- $('.checkadd-w').window('close');
- });
- });
- });
- base.renderwindow('.checkadd-w', {
- title: '新增基础参数',
- width: 450,
- height: 300,
- top: 100
- });
- $('.checkadd-w').window('open');
- $('#bm-add-form').form('clear');
- });
- }
- function toUtf8(str) {
- var out, i, len, c;
- out = "";
- len = str.length;
- for(i = 0; i < len; i++) {
- c = str.charCodeAt(i);
- if ((c >= 0x0001) && (c <= 0x007F)) {
- out += str.charAt(i);
- } else if (c > 0x07FF) {
- out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
- out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
- out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
- } else {
- out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
- out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
- }
- }
- return out;
- }
- </script>
|