This commit is contained in:
baoliang 2018-10-23 15:29:31 +08:00
parent a0da2e9964
commit ee82a76743
4 changed files with 3 additions and 38 deletions

View File

@ -115,6 +115,8 @@ class Probe(models.Model):
factor5 = models.CharField(u'factor5', max_length=32, blank=True, null=True) factor5 = models.CharField(u'factor5', max_length=32, blank=True, null=True)
factor6 = models.CharField(u'factor6', max_length=32, blank=True, null=True) factor6 = models.CharField(u'factor6', max_length=32, blank=True, null=True)
drilling = models.ForeignKey(Drilling, blank=True, null=True) drilling = models.ForeignKey(Drilling, blank=True, null=True)
other_code = models.CharField(max_length=256, blank=True, null=True)
other_recorded = models.DateTimeField(blank=True, null=True)
def __unicode__(self): def __unicode__(self):
return self.name return self.name

View File

@ -15,7 +15,6 @@
<li role="presentation"><a href="#z" role="tab" data-toggle="tab">探头</a></li> <li role="presentation"><a href="#z" role="tab" data-toggle="tab">探头</a></li>
<li role="presentation"><a href="#y" role="tab" data-toggle="tab">钻孔岩心</a></li> <li role="presentation"><a href="#y" role="tab" data-toggle="tab">钻孔岩心</a></li>
<li role="presentation"><a href="#s" role="tab" data-toggle="tab">土工试验报告</a></li> <li role="presentation"><a href="#s" role="tab" data-toggle="tab">土工试验报告</a></li>
<li role="presentation"><a href="#t" role="tab" data-toggle="tab">图表</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="x"> <div role="tabpanel" class="tab-pane fade in active" id="x">
@ -133,39 +132,6 @@
{% endif %} {% endif %}
</table> </table>
</div> </div>
<div role="tabpanel" class="tab-pene fade" id="t">
<div style="margin-top: 15px">
<h4>{{ drilling.code }}各深度温度变化曲线</h4>
<div class="row">
<div class="col-lg-5">
<div class="form-group">
<div class="input-group date">
<span class="input-group-addon">
开始时间
</span>
<input type="text" class="form-control timepicker" id="startTime"/>
</div>
</div>
</div>
<div class="col-lg-5">
<div class="form-group">
<div class="input-group date">
<span class="input-group-addon">
结束时间
</span>
<input type="text" class="form-control timepicker" id="endTime"/>
</div>
</div>
</div>
<div class="col-lg-2">
<button class="btn btn-default" id="startButton">生成图表</div>
</div>
</div>
<div class="list list-group" style="margin-top:15px">
<div id="main" style="width:778px;height:400px;"></div>
</div>
</div>
</div>
</div> </div>
{% endblock %} {% endblock %}
{% block add_css %} {% block add_css %}

View File

@ -121,7 +121,6 @@
} }
}, },
legend: { legend: {
data: ['温度']
}, },
xAxis: { xAxis: {
data: [] data: []

View File

@ -142,9 +142,7 @@ def search(request):
# 返回探头图表json # 返回探头图表json
def probedata_json(request): def probedata_json(request):
probe_code = request.GET.get('probe_code') probe_code = request.GET.get('probe_code')
start_date = datetime.date(2018, 8, 1) probedata = ProbeData.objects.filter(probe_code=probe_code).order_by('-recorded')[:100]
end_date = datetime.date(2018, 8, 31)
probedata = ProbeData.objects.filter(probe_code=probe_code, recorded__range=(start_date, end_date))
data = [] data = []
for pd in probedata: for pd in probedata:
data.append([pd.recorded.strftime('%Y-%m-%d %H:%M:%S'), pd.value2]) data.append([pd.recorded.strftime('%Y-%m-%d %H:%M:%S'), pd.value2])