|
- <!DOCTYPE html>
- <html>
-
- <head>
- <meta name="viewport" content="width=device-width" />
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <title>CardPrint</title>
- @Html.AppendJsFile("/Content/jquery/jquery-1.10.2.min.js", "/Content/jquery/plugin/jqprint/jquery.jqprint-0.3.js", "/Content/js/qrcode.min.js")
- <link href="~/Content/cardprint/CardPrint.css" rel="stylesheet" />
- <script>
- function request(d) {
- for (var c = location.search.slice(1).split("&"), a = 0; a < c.length; a++) {
- var b = c[a].split("=");
- if (b[0] == d)
- if ("undefined" == unescape(b[1])) break;
- else return unescape(b[1]);
- }
- return "";
- };
- </script>
- <style>
- body {
- border: 0;
- padding: 0 0 0px 0;
- margin: 0;
- /* font-family: Arial, Helvetica, sans-serif!important; */
- /* font-weight: bold; */
- }
-
- #qrcodeBox {
- width: 390px;
- margin: 0 auto;
- }
-
- .qrcodeBox {
- padding: 18px 5px 0;
- /* margin-top:20px; */
- }
-
- .qrcodeBox > div {
- margin: 0 auto 5px;
- }
-
- .qrcodes {
- float: left;
- font-size: 12px;
- }
-
- #roghtDiv {
- margin-top: -2px;
- margin-left: 70px;
- text-align: left;
- }
-
- #roghtDiv div {
- height: 20px;
- line-height: 20px;
- font-size: 13px;
- }
-
- #top {
- overflow: hidden;
- }
-
- #bottom {
- line-height: 24px;
- font-size: 14x;
- padding-top: 10px;
- }
-
- #bottom div {
- height: 24px;
- overflow: hidden;
- }
- </style>
- </head>
-
- <body style="">
- <div id="qrcodeBox">
-
- </div>
- <div id="btnprint" type="button" class="btns" value="打印">打印</div>
- <script>
- var keyValue = request('keyValue');
- var aName = request('aName');
- var AIId = request('AIId');
- $(function () {
-
- $.ajax({
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetFormData?keyValue=' + AIId,
- type: "GET",
- dataType: "json",
- async: true,
- success: function (res) {
- var data = res.data.Ass_AssetsInfoItem;
- var arr = [];
- if(!Array.isArray(data)){
- arr.push(data)
- }else{
- arr = data
- }
- var html = '';
-
- $.each(arr, function(i, n){
- var AIDepartment = "部门:";
- top.learun.clientdata.getAsync('department', {
- key: n.AIDepartment,
- callback: function (_data) {
- AIDepartment += _data.name;
- }
- });
- var AIUsePeople = "姓名:";
- if (n.AIUsePeople) {
- top.learun.clientdata.getAsync('custmerData',
- {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
- key: n.AIUsePeople,
- keyId: 'f_userid',
- callback: function(_data) {
- AIUsePeople += _data['f_realname'];
- }
- });
- } else
- AIUsePeople += "暂无";
- var AIIStorage = "位置:";
- top.learun.clientdata.getAsync('custmerData',
- {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData',
- key: n.AIIStorageId,
- keyId: 'sid',
- callback: function (_data) {
- AIIStorage += _data['sname'];
- }
- });
- var AIIStoragePosition = "";
- top.learun.clientdata.getAsync('custmerData',
- {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room',
- key: n.AIIStoragePosition,
- keyId: 'rid',
- callback: function (_data) {
- AIIStoragePosition = _data['rcode'];
- }
- });
- var AIIStorageStr = ''
- if (AIIStoragePosition) {
- AIIStorageStr = AIIStorage + "-" + AIIStoragePosition;
- } else {
- AIIStorageStr = AIIStorage;
- }
- html += '<div class="qrcodeBox" style="page-break-before: auto;page-break-after: always;"><div style="">'+
- '<div id="top">'+
- '<div id="qrcode'+ i +'" class="qrcodes" val="'+ n.AICodeNumJY +'"></div>'+
- '<div id="roghtDiv" style="">'+
- '<div id="AIDepartment">'+ AIDepartment +'</div>'+
- '<div id="AIUsePeople">'+ AIUsePeople +'</div>'+
- '<div id="AIIStorageAndRoom">'+ AIIStorageStr +'</div>'+
- '</div>'+
- '</div>'+
- '<div id="bottom">'+
- '<div id="AICodeNumJY">编号:'+ n.AICodeNumJY +'</div>'+
- '<div id="AIASSName">名称:'+ n.AIASSName +'</div>'+
- '</div>'+
- '</div></div>';
- // $('#AIDepartment').html(AIDepartment);
- // $('#AIUsePeople').html(AIUsePeople);
- // if (AIIStoragePosition) {
- // $('#AIIStorageAndRoom').html(AIIStorage + "-" + AIIStoragePosition);
- // } else {
- // $('#AIIStorageAndRoom').html(AIIStorage);
- // }
- // $('#AICodeNumJY').html("编号:"+data.AICodeNumJY);
- // $('#AIASSName').html("名称:"+data.AIASSName);
- })
-
- $('#qrcodeBox').html(html);
- $('.qrcodes').each(function(i, n){
- var id = $(n).attr('id');
- var val = $(n).attr('val')
- var qrcode = new QRCode(document.getElementById(id), {
- width: 60,
- height: 60
- });
- qrcode.makeCode(val);
- })
- }
- });
-
- $("#btnprint").on("click", function () {
- $('#qrcodeBox').jqprint();
- });
-
-
- });
-
- function AddPrintContent3() {
- // $('#btnprint').css('display', 'none');
- // window.print();
- // $('#btnprint').css('display', 'block');
- $('.tableBox').jqprint();
- }
- </script>
- </body>
-
- </html>
|