Procházet zdrojové kódy

立即执行的显示问题

john před 2 roky
rodič
revize
157e244f9d

+ 2 - 2
ClientPlatform/src/pages/order/order.vue

@@ -26,9 +26,9 @@
         <vxe-column field="id" title="订单ID" width="80"></vxe-column>
         <vxe-column field="name" title="name" sortable></vxe-column>
         <vxe-column field="create_time" title="create Time"></vxe-column>
-        <vxe-column field="run_time" title="是否立即执行">
+        <vxe-column field="run_time" title="是否立即执行" width="230">
           <template #default="{ row }">
-            {{ row.run_time ? "是" : "否" }}
+            {{ row.is_run_now === "true" ? "是" : row.run_time }}
           </template>
         </vxe-column>
         <vxe-column field="source" title="数据来源"></vxe-column>

binární
admin_site/mysite.sqlite


+ 18 - 0
admin_site/order/migrations/0002_order_is_run_now.py

@@ -0,0 +1,18 @@
+# Generated by Django 4.1.7 on 2023-05-21 13:54
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('order', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='order',
+            name='is_run_now',
+            field=models.CharField(blank=True, max_length=100),
+        ),
+    ]

+ 1 - 0
admin_site/order/models.py

@@ -11,6 +11,7 @@ class Order(models.Model):
     name = models.CharField(max_length=10, blank=True, null=True)  # 订单名称
     source = models.CharField(max_length=100, blank=True, null=True)  # 数据来源,涉及后续的订单结果的计算方式
     run_time = models.DateTimeField(auto_now_add=False)  # 立即运行的时间,取创建订单的时间
+    is_run_now = models.CharField(max_length=100, blank=True)  # 立即运行的时间,取创建订单的时间
     create_time = models.DateTimeField(auto_now_add=True)  # 创建时间
     update_time = models.DateTimeField(auto_now=True)  # 更新时间
     end_time = models.DateTimeField(null=True)  # 订单完成时间

+ 17 - 11
admin_site/order/views.py

@@ -31,6 +31,7 @@ def info(request):
         order = Order_models.objects.get(id=body['id'])
     except Order_models.DoesNotExist:
         return JsonResponse(setError("Order not found"))
+
     def get_txt_data(name):
         base_path = 'Rdata/' + str(order.id) + '/'
         txt_data = []
@@ -41,6 +42,7 @@ def info(request):
         return txt_data
 
         # 将订单信息转换为字典形式
+
     order_dict = {
         "id": order.id,
         "user_id": order.user_id,
@@ -53,19 +55,19 @@ def info(request):
         "status": order.status,
         "create_time": order.create_time,
         "update_time": order.update_time,
-        "DL_GRS": "http://localhost:8000/order/img/"+ str(order.id) +"/DL_GRS.png",
+        "DL_GRS": "http://localhost:8000/order/img/" + str(order.id) + "/DL_GRS.png",
         "DL_GRS_list": get_txt_data('DL_GRS'),
-        "DL_GRS_prob_pre": "http://localhost:8000/order/img/"+ str(order.id) +"/DL_GRS_prob_pre.png",
-        "OR_GRS": "http://localhost:8000/order/img/"+ str(order.id) +"/OR_GRS.png",
+        "DL_GRS_prob_pre": "http://localhost:8000/order/img/" + str(order.id) + "/DL_GRS_prob_pre.png",
+        "OR_GRS": "http://localhost:8000/order/img/" + str(order.id) + "/OR_GRS.png",
         "OR_GRS_list": get_txt_data('OR_GRS'),
-        "OR_GRS_prob_pre": "http://localhost:8000/order/img/"+ str(order.id) +"/OR_GRS_prob_pre.png",
-        "SC_GRS": "http://localhost:8000/order/img/"+ str(order.id) +"/SC_GRS.png",
+        "OR_GRS_prob_pre": "http://localhost:8000/order/img/" + str(order.id) + "/OR_GRS_prob_pre.png",
+        "SC_GRS": "http://localhost:8000/order/img/" + str(order.id) + "/SC_GRS.png",
         "SC_GRS_list": get_txt_data('SC_GRS'),
-        "SC_GRS_prob_pre": "http://localhost:8000/order/img/"+ str(order.id) +"/SC_GRS_prob_pre.png",
-        "t_alt_count": "http://localhost:8000/order/img/"+ str(order.id) +"/t_alt_count.png",
-        "t_depth": "http://localhost:8000/order/img/"+ str(order.id) +"/t_depth.png",
-        "t_ref_count": "http://localhost:8000/order/img/"+ str(order.id) +"/t_ref_count.png",
-        "Variant_Type": "http://localhost:8000/order/img/"+ str(order.id) +"/Variant_Type.png",
+        "SC_GRS_prob_pre": "http://localhost:8000/order/img/" + str(order.id) + "/SC_GRS_prob_pre.png",
+        "t_alt_count": "http://localhost:8000/order/img/" + str(order.id) + "/t_alt_count.png",
+        "t_depth": "http://localhost:8000/order/img/" + str(order.id) + "/t_depth.png",
+        "t_ref_count": "http://localhost:8000/order/img/" + str(order.id) + "/t_ref_count.png",
+        "Variant_Type": "http://localhost:8000/order/img/" + str(order.id) + "/Variant_Type.png",
     }
 
     # 返回 JSON 格式的响应
@@ -106,6 +108,7 @@ def add(request):
         'source': body.get('source', None),
         'desc': body.get('desc', None),
         'user_id': body.get('user_id', None),
+        'is_run_now': body.get('isRunNow', None),
     }
     fileListID = body.get('fileListID', [])
     fileListID2 = body.get('fileListID2', [])
@@ -159,6 +162,7 @@ def add(request):
 def update(request):
     return JsonResponse(setSuccess(msg='更新成功', data=True))
 
+
 @csrf_exempt
 @require_http_methods(["POST"])
 def list(request):
@@ -199,7 +203,8 @@ def list(request):
         'num_pages': paginator.num_pages,
         'list': [{'id': item.id, 'create_time': item.create_time, 'update_time': item.update_time,
                   'start_time': item.start_time, 'desc': item.desc, 'name': item.name, 'source': item.source,
-                  'run_time': item.run_time, 'status': item.status, } for item in data]
+                  'run_time': item.run_time, 'status': item.status,
+                  'is_run_now': 'true' if item.is_run_now == 'True' else 'false'} for item in data]
     }
     return JsonResponse(setSuccess(msg='更新成功', data=data_json))
 
@@ -214,6 +219,7 @@ def create_order(request):
     body.setdefault('is_sick', body['isSick'])
     return JsonResponse(setSuccess(msg='更新成功', data=True))
 
+
 @csrf_exempt
 @require_http_methods(["POST"])
 def delete(request):