Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

hujingpei 4 жил өмнө
parent
commit
155453f344

+ 1 - 0
.gitignore

@@ -11,4 +11,5 @@ local_settings.*
 venv
 .idea
 python*
+uis/up*
 .history

+ 7 - 1
apps/tenant/device/views.py

@@ -11,6 +11,8 @@ from apps.log.models import BizLog
 from apps.tenant import tenant_log
 from utils import response_ok, response_error
 from .resources import DeviceImporter
+from django.conf import settings
+from apps.WechatApplet.models import WechatApplet
 
 # Create your views here.
 class DeviceViewSet(CustomModelViewSet):
@@ -66,7 +68,11 @@ class DeviceImportView(APIView):
                         data['address'] = row[u'大地点']
                         data['create_user'] = request.user
                         data['tenant'] = request.user.employee.tenant
-                        DeviceModel.objects.create(**data)
+                        instance = DeviceModel.objects.create(**data)
+                        # applet = WechatApplet.objects.filter(authorizer_appid=settings.WEAPP['appid']).first()
+                        # filename = applet.getDeviceCode(instance.id, instance.tenant.company_no)
+                        # instance.wxapp_img = "{0}{1}".format(settings.MEDIA_URL, filename)
+                        # instance.save()
                     except CustomError as e:
                         raise CustomError(u'第%d行:%s' % (line, e.get_error_msg()))
                     except Exception as e:

+ 2 - 2
apps/tenant/repair_order/views.py

@@ -99,7 +99,7 @@ class RepairOrderViewSet(CustomModelViewSet):
             with transaction.atomic():
                 instance = RepairOrder.get_instance_by_id(pk, user.employee.tenant)
                 if not instance.status == settings.CHECKED:
-                    return response_ok('当前报修工单状态非待派单状态,不能进行派单!')
+                    return response_error('当前报修工单状态非待派单状态,不能进行派单!')
                 instance.dispatch_repair_order(user, user_ids)
             if user.id != user_ids:
                 user = User.objects.filter(id=user_ids).first()
@@ -124,7 +124,7 @@ class RepairOrderViewSet(CustomModelViewSet):
             with transaction.atomic():
                 instance = RepairOrder.get_instance_by_id(pk, user.employee.tenant)
                 if not instance.status == settings.DISPATCH:
-                    return response_ok('当前报修单状态还未派单,不能进行转单!')
+                    return response_error('当前报修单状态还未派单,不能进行转单!')
                 instance.repair_users_id = user_ids
                 instance.save()
                 # 记录操作

+ 19 - 1
uis/tenant/device/index.html

@@ -110,6 +110,9 @@
                             <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="device_del"
                             >删除</a>
                         </div>
+                        <div class="layui-btn-group">
+                            <a class="layui-btn layui-btn-xs" lay-event="print">打印二维码</a>
+                        </div>
                     </script>
                 </div>
             </div>
@@ -142,7 +145,7 @@
                 , {field: 'repair_count', title: '维修次数', width: 100}
                 , {field: 'create_user_text', title: '添加人', width: 100}
                 , {field: 'create_time', title: '添加时间', width: 200}
-                , {width: 150, align: 'center', fixed: 'right', toolbar: '#device-operate-bar'}
+                , {width: 200, align: 'center', fixed: 'right', toolbar: '#device-operate-bar'}
             ]]
             , page: true
             , height: 'full-108'
@@ -202,6 +205,21 @@
                     },
                     content: 'edit.html?id=' + data.id
                 });
+            }else if (obj.event === 'print') {
+                layer.open({
+                    type: 2,
+                    title: '打印',
+                    shadeClose: true,
+                    area: ['900px', '90%'],
+                    btn: ['打印', '取消'],
+                    yes: function (index, dom) {
+                        $("#layui-layer-iframe" + index)[0].contentWindow.doPrint();
+                    },
+                    btn2: function (index, layero) {
+                        layer.close(index);
+                    },
+                    content: 'print.html'
+                });
             }
         });
 

+ 98 - 0
uis/tenant/device/print.html

@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>订单打印</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
+    <style>
+        h3, td, th {
+            color: #000000
+        }
+
+        .layui-table td, .layui-table th {
+            border-color: #000000;
+            height: 1px
+        }
+
+        .title {
+            text-align: center;
+            width: 12%;
+            padding-top: 5px;
+            padding-bottom: 5px;
+            border-width: 1px;
+            border-color: rgb(0, 0, 0);
+        }
+
+        .cell {
+            text-align: center;
+            border-width: 1px;
+            border-color: rgb(0, 0, 0);
+        }
+
+        .content {
+            padding: 5px;
+            border-width: 1px;
+            border-color: rgb(0, 0, 0);
+            position: relative;
+        }
+
+        .img {
+            width: 10px;
+            height: 10px;
+            position: absolute;
+        }
+    </style>
+</head>
+<body>
+
+<div class="layui-fluid">
+    <div class="layui-card">
+        <div class="layui-card-body" pad15>
+            <div class="layui-row layui-col-space15">
+                <div class="layui-col-md12">
+
+                    <div id="print_div" class="qrcode">
+                        <canvas width="40" height="40" >
+                        </canvas>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script src="../../layuiadmin/layui/layui.js?t=1"></script>
+<script src="../../layuiadmin/layui/qrcode.js"></script>
+
+<script>
+    layui.config({
+        base: '../../../layuiadmin/' //静态资源所在路径
+    }).extend({
+        index: 'lib/index' //主入口模块
+    }).use(['index', 'table'], function () {
+        var $ = layui.$
+            , admin = layui.admin
+        $('.qrcode').empty()
+        $('.qrcode').qrcode({width: 60, height: 60, text: 'device=50'});
+        var canvas = $('.qrcode canvas')
+        var img = canvas[0].toDataURL("image/png")
+        $('.qrcode').html("<div align=\"center\"><img src='" + img + "'></div>")
+
+
+    });
+
+    function doPrint() {
+        document.body.innerHTML = document.getElementById('print_div').innerHTML;
+        window.print();
+        parent.layer.closeAll('iframe');
+    }
+
+</script>
+</body>
+</html>
+

+ 1 - 1
uis/tenant/repairManage/index.html

@@ -182,7 +182,7 @@
                     content: 'detail.html'
                 })
             } else if (obj.event === 'dispatch') {
-                if (data.status < 1) {
+                if (data.status == 1) {
                     layer.msg('该报修单未审核,禁止派工!');
                     return false
                 }

BIN
uis/up/operation_help_img/15517558888_20210419155852833879.png


BIN
uis/up/operation_help_img/15517558888_20210419160730330472.jpg


BIN
uis/up/operation_help_img/15517558888_20210419160820682683.png


BIN
uis/up/operation_help_img/15517558888_20210419161131714864.jpg


BIN
uis/up/operation_help_img/15517558888_20210419161339089783.png


BIN
uis/up/operation_help_img/15517558888_20210419161353236826.png


BIN
uis/up/operation_help_img/15517558888_20210419164648087694.png


BIN
uis/up/operation_help_img/15517558888_20210419172237203453.jpg