diff options
Diffstat (limited to '97suifangqa/apps/indicator')
18 files changed, 610 insertions, 403 deletions
diff --git a/97suifangqa/apps/indicator/static/ajax/act_index b/97suifangqa/apps/indicator/static/ajax/act_index deleted file mode 100644 index 0f0c913..0000000 --- a/97suifangqa/apps/indicator/static/ajax/act_index +++ /dev/null @@ -1 +0,0 @@ -success
\ No newline at end of file diff --git a/97suifangqa/apps/indicator/static/ajax/close_sub_title b/97suifangqa/apps/indicator/static/ajax/close_sub_title deleted file mode 100644 index 0f0c913..0000000 --- a/97suifangqa/apps/indicator/static/ajax/close_sub_title +++ /dev/null @@ -1 +0,0 @@ -success
\ No newline at end of file diff --git a/97suifangqa/apps/indicator/static/ajax/edit_history_data b/97suifangqa/apps/indicator/static/ajax/edit_history_data deleted file mode 100644 index 0f0c913..0000000 --- a/97suifangqa/apps/indicator/static/ajax/edit_history_data +++ /dev/null @@ -1 +0,0 @@ -success
\ No newline at end of file diff --git a/97suifangqa/apps/indicator/static/ajax/getCardDataChart b/97suifangqa/apps/indicator/static/ajax/getCardDataChart deleted file mode 100644 index be4657a..0000000 --- a/97suifangqa/apps/indicator/static/ajax/getCardDataChart +++ /dev/null @@ -1 +0,0 @@ -[6.0, 5.9, 5.5, 4.5, 6.2, 6.5, 5.2, 6.0, 5.9, 5.5, 4.5, 6.2, 6.5, 5.2, 6.0, 5.9, 5.5, 4.5, 6.2, 6.5]
\ No newline at end of file diff --git a/97suifangqa/apps/indicator/static/ajax/getCardDataTable b/97suifangqa/apps/indicator/static/ajax/getCardDataTable deleted file mode 100644 index ac9b3f6..0000000 --- a/97suifangqa/apps/indicator/static/ajax/getCardDataTable +++ /dev/null @@ -1,13 +0,0 @@ -<tr><td>2013-08-10</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-09</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-08</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-08</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-07</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-06</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-05</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-04</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-03</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-02</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-08-01</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-07-31</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> -<tr><td>2013-07-30</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr>
\ No newline at end of file diff --git a/97suifangqa/apps/indicator/static/javascripts/edit_history_data.js b/97suifangqa/apps/indicator/static/javascripts/edit_history_data.js index e664a39..03c62e9 100644 --- a/97suifangqa/apps/indicator/static/javascripts/edit_history_data.js +++ b/97suifangqa/apps/indicator/static/javascripts/edit_history_data.js @@ -68,7 +68,7 @@ $(document).ready(function(){ var time = date.getTime(); $.ajax({ type: 'get', - url: '../../ajax/edit_history_data', + url: indicator_url + 'ajax/edit_history_data', data: 'time='+time, success: function(data){ if(data == 'success'){ @@ -80,4 +80,6 @@ $(document).ready(function(){ return false; }); -});
\ No newline at end of file +}); + +// vim: set ts=4 sw=4 tw=0 fenc=utf-8 ft=javascript: // diff --git a/97suifangqa/apps/indicator/static/javascripts/load_card.js b/97suifangqa/apps/indicator/static/javascripts/load_card.js index bea4f29..4db48a4 100644 --- a/97suifangqa/apps/indicator/static/javascripts/load_card.js +++ b/97suifangqa/apps/indicator/static/javascripts/load_card.js @@ -1,300 +1,302 @@ -var detail_chart;
-$(document).ready(function(){
- var startDate = '2013-07-13';
- startDate = new Date(startDate.replace(/-/g,"/"));
- var start_date_UTC_time = startDate.getTime() - startDate.getTimezoneOffset() * 60 * 1000;
- var chart3 = new Highcharts.Chart({
- chart: {
- renderTo: 'chart_3',
- type: 'area',
- marginLeft: 15,
- height: 223,
- spacingTop: 10,
- spacingBottom: 0,
- overflow: false,
- zIndex: 5
- },
- credits: {
- enabled: false
- },
- title: {
- text: ' '
- },
- colors: ['#31B6AD'],
- xAxis: {
- type: 'datetime',
- dateTimeLabelFormats: {
- day: '%e/%m'
- },
- lineColor: '#CECECE',
- gridLineColor: '#EFECEF',
- gridLineWidth: 1,
- tickWidth: 0,
- labels:{
- step: 2,
- maxStaggerLines: 1
- },
- tickInterval: (4 * 24 * 3600 * 1000),
- tickColor: '#FFFFFF'
- },
- yAxis: {
- title: {
- text: ''
- },
- allowDecimals: false,
- endOnTick: false,
- tickInterval: 1,
- lineColor: '#CECECE',
- lineWidth: 2,
- gridLineColor: '#EFECEF',
- gridLineWidth: 1,
- minPadding: 0.3,
- maxPadding: 1.2
- },
- legend: {
- enabled: false
- },
- tooltip: {
- formatter: function() {
- return '<span style="color:#969696;font-weight:bold;">' + Highcharts.dateFormat('%b %e', this.x) + '</span>' +'<br />' + '<span style="color:#464646;font-weight:bold;">' + this.y + 'mmol/L' + '</span>' + '<br />' + 'click for more info';
- },
-// positioner: function (boxWidth, boxHeight, point) {
-// return { x: point.plotX+80, y: point.plotY-20 };
-// },
- style: {
- padding: '7px'
- },
- borderColor: '#EAEAEA'
- },
- plotOptions: {
- series: {
- marker: {
- enabled: true, //false false的时候就不会突出显示点
- lineColor: '#31B6AD',
- lineWidth: 1,
- radius: 3, // 点的大小
- fillColor: '#FFFFFF' // 设置点中间填充的颜色
- },
- fillOpacity: 0.12,
- lineWidth: 1,
- threshold: null,
- shadow: false
- }
- },
- series: [{
- data: [6.0, 5.9, 5.5, 4.5, 6.2, 6.5, 5.2, 6.0, 5.9, 5.5, 4.5, 6.2, 6.5, 5.2, 6.0, 5.9, 5.5, 4.5, 6.2, 6.5],
- pointStart: start_date_UTC_time,
- pointInterval:1 * 24 * 3600 * 1000
- }]
- });
-
- detail_chart = new Highcharts.Chart({
- chart: {
- renderTo: 'detail_chart',
- type: 'area',
- marginLeft: 25,
- width: 562,
- height: 303,
- spacingTop: 10,
- spacingBottom: 0,
- overflow: false,
- zIndex: 5
- },
- credits: {
- enabled: false
- },
- title: {
- text: ' '
- },
- colors: ['#31B6AD'],
- xAxis: {
- type: 'datetime',
- dateTimeLabelFormats: {
- day: '%e/%m'
- },
- lineColor: '#CECECE',
- gridLineColor: '#EFECEF',
- gridLineWidth: 1,
- tickWidth: 0,
- labels:{
- step: 2
- },
- tickInterval: (2 * 24 * 3600 * 1000),
- tickColor: '#FFFFFF'
- },
- yAxis: {
- title: {
- text: ''
- },
- allowDecimals: true,
- endOnTick: false,
- tickInterval: 0.5,
- lineColor: '#CECECE',
- lineWidth: 2,
- gridLineColor: '#EFECEF',
- gridLineWidth: 1,
- minPadding: 0.3,
- maxPadding: 1.2,
- labels: {
- formatter: function() {
- var originYValue = this.value+'';
- if (originYValue.length == 1){
- originYValue += '.0';
- }
- return originYValue;
- }
- }
- },
- legend: {
- enabled: false
- },
- tooltip: {
- formatter: function() {
- return '<span style="color:#969696;font-weight:bold;">' + Highcharts.dateFormat('%b %e', this.x) + '</span>' +'<br />' + '<span style="color:#464646;font-weight:bold;">' + this.y + 'mmol/L' + '</span>' + '<br />' + 'click for more info';
- },
-// positioner: function (boxWidth, boxHeight, point) {
-// return { x: point.plotX+80, y: point.plotY-20 };
-// },
- style: {
- padding: '7px'
- },
- borderColor: '#EAEAEA'
- },
- plotOptions: {
- series: {
- marker: {
- enabled: true, //false false的时候就不会突出显示点
- lineColor: '#31B6AD',
- lineWidth: 1,
- radius: 3, // 点的大小
- fillColor: '#FFFFFF', // 设置点中间填充的颜色
- symbol: 'circle'
- },
- fillOpacity: 0.12,
- lineWidth: 1,
- threshold: null,
- shadow: false,
- point: {
- events: {
- click: function() {
- alert(this.x);
- alert(this.y);
- TB_show(false, '../pages/popup/EditHistoryData.html?TB_iframe=true&no1_title&transfer_params&height=351&width=630&card_id=3', false);
- }
- }
- }
- }
- },
- series: []
- });
-
- //详细历史记录
- $(".detail_history").bind("click", function(){
- card_detail_id = $(this).closest(".index_card").attr("id").replace('index_card_', '');
- var startDateLog = '2013-08-04';
- var endDateLog = '2013-08-10';
- var date = new Date();
- var time = date.getTime();
- redraw_chart(detail_chart, startDateLog, endDateLog);
- $(".act_card_container").addClass("move_div_2_left");
- return false;
- });
-
- //切换日期
- $(".shift_week").bind("click", function(){
- $(".shift_week").addClass("unselected");
- $(this).removeClass("unselected");
- var startDateLog = $(this).attr("start_date");
- var endDateLog = $(this).attr("end_date");
- redraw_chart(detail_chart, startDateLog, endDateLog);
- return false;
- });
-
- //根据日期搜索
- $("#search_start_date, #search_end_date").bind("change", function(){
- var startDateLog = $("#search_start_date").val();
- var endDateLog = $("#search_end_date").val();
- redraw_chart(detail_chart, startDateLog, endDateLog);
- return false;
- });
-
- //浏览更多
- $(".see_more_btn").bind("click", function(){
- var btn = $(".see_more_btn");
- var end = "2013-08-10";
- get_card_data_table(null, end, false);
- return false;
- });
-
- //收起历史记录
- $(".collapse_btn").bind("click", function(){
- //删除图表数据
- var serieses = detail_chart.series;
- for (series_key in serieses){
- serieses[series_key].remove();
- }
- //删除表格数据
- $("tr").not(".first_line").remove();
- //隐藏div
- $(".detail_card_info").hide();
- //初始化详细卡片id
- card_detail_id = 0;
- //添加删除div位置初始化
- $(".act_card_container").removeClass("move_div_2_left");
- return false;
- });
-});
-
-//重画历史记录图表
-function redraw_chart(detail_chart, start, end){
- var date = new Date();
- var time = date.getTime();
- $.ajax({
- type: 'get',
- url: '../ajax/getCardDataChart',
- data: 'card_detail_id='+card_detail_id+'&start='+start+'&end='+end+'&time='+time,
- dataType: 'json',
- success: function(dataJson){ //每一天都要有数据,否则x轴刻度时间对不上
- var startDateLogFormat = new Date(start.replace(/-/g,"/"));
- var start_date_log_UTC_time = startDateLogFormat.getTime() - startDateLogFormat.getTimezoneOffset() * 60 * 1000;
- var pointStart = start_date_log_UTC_time;
- var pointInterval = 1 * 24 * 3600 * 1000;
-
- //设置默认起始结束时间
- $("#search_start_date").datepicker( "setDate", start);
- $("#search_end_date").datepicker( "setDate", end);
-
- //删除chart已有数据
- var serieses = detail_chart.series;
- for (series_key in serieses){
- serieses[series_key].remove();
- }
- //更新chart数据
- detail_chart.addSeries({
- data: dataJson,
- pointStart: start_date_log_UTC_time,
- pointInterval: pointInterval
- });
- //更新table数据
- get_card_data_table(start, end, true);
- //显示
- $(".detail_card_info").show();
- }
- });
-}
-
-function get_card_data_table(start, end, redraw){
- var date = new Date();
- var time = date.getTime();
- $.ajax({
- type: 'get',
- url: '../ajax/getCardDataTable',
- data: 'card_detail_id='+card_detail_id+'&start='+start+'&end='+end+'&time='+time,
- success: function(data){
- if(redraw){
- $("tr").not(".first_line").remove();
- }
- $("table").append(data);
- }
- });
-}
\ No newline at end of file +var detail_chart; +$(document).ready(function(){ + var startDate = '2013-07-13'; + startDate = new Date(startDate.replace(/-/g,"/")); + var start_date_UTC_time = startDate.getTime() - startDate.getTimezoneOffset() * 60 * 1000; + var chart3 = new Highcharts.Chart({ + chart: { + renderTo: 'chart_3', + type: 'area', + marginLeft: 15, + height: 223, + spacingTop: 10, + spacingBottom: 0, + overflow: false, + zIndex: 5 + }, + credits: { + enabled: false + }, + title: { + text: ' ' + }, + colors: ['#31B6AD'], + xAxis: { + type: 'datetime', + dateTimeLabelFormats: { + day: '%e/%m' + }, + lineColor: '#CECECE', + gridLineColor: '#EFECEF', + gridLineWidth: 1, + tickWidth: 0, + labels:{ + step: 2, + maxStaggerLines: 1 + }, + tickInterval: (4 * 24 * 3600 * 1000), + tickColor: '#FFFFFF' + }, + yAxis: { + title: { + text: '' + }, + allowDecimals: false, + endOnTick: false, + tickInterval: 1, + lineColor: '#CECECE', + lineWidth: 2, + gridLineColor: '#EFECEF', + gridLineWidth: 1, + minPadding: 0.3, + maxPadding: 1.2 + }, + legend: { + enabled: false + }, + tooltip: { + formatter: function() { + return '<span style="color:#969696;font-weight:bold;">' + Highcharts.dateFormat('%b %e', this.x) + '</span>' +'<br />' + '<span style="color:#464646;font-weight:bold;">' + this.y + 'mmol/L' + '</span>' + '<br />' + 'click for more info'; + }, + // positioner: function (boxWidth, boxHeight, point) { + // return { x: point.plotX+80, y: point.plotY-20 }; + // }, + style: { + padding: '7px' + }, + borderColor: '#EAEAEA' + }, + plotOptions: { + series: { + marker: { + enabled: true, //false false的时候就不会突出显示点 + lineColor: '#31B6AD', + lineWidth: 1, + radius: 3, // 点的大小 + fillColor: '#FFFFFF' // 设置点中间填充的颜色 + }, + fillOpacity: 0.12, + lineWidth: 1, + threshold: null, + shadow: false + } + }, + series: [{ + data: [6.0, 5.9, 5.5, 4.5, 6.2, 6.5, 5.2, 6.0, 5.9, 5.5, 4.5, 6.2, 6.5, 5.2, 6.0, 5.9, 5.5, 4.5, 6.2, 6.5], + pointStart: start_date_UTC_time, + pointInterval:1 * 24 * 3600 * 1000 + }] + }); + + detail_chart = new Highcharts.Chart({ + chart: { + renderTo: 'detail_chart', + type: 'area', + marginLeft: 25, + width: 562, + height: 303, + spacingTop: 10, + spacingBottom: 0, + overflow: false, + zIndex: 5 + }, + credits: { + enabled: false + }, + title: { + text: ' ' + }, + colors: ['#31B6AD'], + xAxis: { + type: 'datetime', + dateTimeLabelFormats: { + day: '%e/%m' + }, + lineColor: '#CECECE', + gridLineColor: '#EFECEF', + gridLineWidth: 1, + tickWidth: 0, + labels:{ + step: 2 + }, + tickInterval: (2 * 24 * 3600 * 1000), + tickColor: '#FFFFFF' + }, + yAxis: { + title: { + text: '' + }, + allowDecimals: true, + endOnTick: false, + tickInterval: 0.5, + lineColor: '#CECECE', + lineWidth: 2, + gridLineColor: '#EFECEF', + gridLineWidth: 1, + minPadding: 0.3, + maxPadding: 1.2, + labels: { + formatter: function() { + var originYValue = this.value+''; + if (originYValue.length == 1){ + originYValue += '.0'; + } + return originYValue; + } + } + }, + legend: { + enabled: false + }, + tooltip: { + formatter: function() { + return '<span style="color:#969696;font-weight:bold;">' + Highcharts.dateFormat('%b %e', this.x) + '</span>' +'<br />' + '<span style="color:#464646;font-weight:bold;">' + this.y + 'mmol/L' + '</span>' + '<br />' + 'click for more info'; + }, + // positioner: function (boxWidth, boxHeight, point) { + // return { x: point.plotX+80, y: point.plotY-20 }; + // }, + style: { + padding: '7px' + }, + borderColor: '#EAEAEA' + }, + plotOptions: { + series: { + marker: { + enabled: true, //false false的时候就不会突出显示点 + lineColor: '#31B6AD', + lineWidth: 1, + radius: 3, // 点的大小 + fillColor: '#FFFFFF', // 设置点中间填充的颜色 + symbol: 'circle' + }, + fillOpacity: 0.12, + lineWidth: 1, + threshold: null, + shadow: false, + point: { + events: { + click: function() { + alert(this.x); + alert(this.y); + TB_show(false, indicator_url + 'popup/edithistorydata?TB_iframe=true&no1_title&transfer_params&height=351&width=630&card_id=3', false); + } + } + } + } + }, + series: [] + }); + + //详细历史记录 + $(".detail_history").bind("click", function(){ + card_detail_id = $(this).closest(".index_card").attr("id").replace('index_card_', ''); + var startDateLog = '2013-08-04'; + var endDateLog = '2013-08-10'; + var date = new Date(); + var time = date.getTime(); + redraw_chart(detail_chart, startDateLog, endDateLog); + $(".act_card_container").addClass("move_div_2_left"); + return false; + }); + + //切换日期 + $(".shift_week").bind("click", function(){ + $(".shift_week").addClass("unselected"); + $(this).removeClass("unselected"); + var startDateLog = $(this).attr("start_date"); + var endDateLog = $(this).attr("end_date"); + redraw_chart(detail_chart, startDateLog, endDateLog); + return false; + }); + + //根据日期搜索 + $("#search_start_date, #search_end_date").bind("change", function(){ + var startDateLog = $("#search_start_date").val(); + var endDateLog = $("#search_end_date").val(); + redraw_chart(detail_chart, startDateLog, endDateLog); + return false; + }); + + //浏览更多 + $(".see_more_btn").bind("click", function(){ + var btn = $(".see_more_btn"); + var end = "2013-08-10"; + get_card_data_table(null, end, false); + return false; + }); + + //收起历史记录 + $(".collapse_btn").bind("click", function(){ + //删除图表数据 + var serieses = detail_chart.series; + for (series_key in serieses){ + serieses[series_key].remove(); + } + //删除表格数据 + $("tr").not(".first_line").remove(); + //隐藏div + $(".detail_card_info").hide(); + //初始化详细卡片id + card_detail_id = 0; + //添加删除div位置初始化 + $(".act_card_container").removeClass("move_div_2_left"); + return false; + }); +}); + +//重画历史记录图表 +function redraw_chart(detail_chart, start, end){ + var date = new Date(); + var time = date.getTime(); + $.ajax({ + type: 'get', + url: indicator_url + 'ajax/get_card_data_chart', + data: 'card_detail_id='+card_detail_id+'&start='+start+'&end='+end+'&time='+time, + dataType: 'json', + success: function(dataJson) { //每一天都要有数据,否则x轴刻度时间对不上 + var startDateLogFormat = new Date(start.replace(/-/g,"/")); + var start_date_log_UTC_time = startDateLogFormat.getTime() - startDateLogFormat.getTimezoneOffset() * 60 * 1000; + var pointStart = start_date_log_UTC_time; + var pointInterval = 1 * 24 * 3600 * 1000; + + //设置默认起始结束时间 + $("#search_start_date").datepicker( "setDate", start); + $("#search_end_date").datepicker( "setDate", end); + + //删除chart已有数据 + var serieses = detail_chart.series; + for (series_key in serieses){ + serieses[series_key].remove(); + } + //更新chart数据 + detail_chart.addSeries({ + data: dataJson, + pointStart: start_date_log_UTC_time, + pointInterval: pointInterval + }); + //更新table数据 + get_card_data_table(start, end, true); + //显示 + $(".detail_card_info").show(); + } + }); +} + +function get_card_data_table(start, end, redraw){ + var date = new Date(); + var time = date.getTime(); + $.ajax({ + type: 'get', + url: indicator_url + 'ajax/get_card_data_table', + data: 'card_detail_id='+card_detail_id+'&start='+start+'&end='+end+'&time='+time, + success: function(data){ + if(redraw){ + $("tr").not(".first_line").remove(); + } + $("table").append(data); + } + }); +} + +// vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=javascript: // diff --git a/97suifangqa/apps/indicator/static/javascripts/new_delete_index.js b/97suifangqa/apps/indicator/static/javascripts/new_delete_index.js index f3fc5de..2c05d7f 100644 --- a/97suifangqa/apps/indicator/static/javascripts/new_delete_index.js +++ b/97suifangqa/apps/indicator/static/javascripts/new_delete_index.js @@ -17,7 +17,7 @@ $(document).ready(function(){ var time = date.getTime(); $.ajax({ type: 'get', - url: '../ajax/act_index', + url: indicator_url + 'ajax/act_index', data: 'index_id='+index_id+'&act=add'+'&time='+time, success: function(data){ if(data == 'success'){ @@ -40,7 +40,7 @@ $(document).ready(function(){ var time = date.getTime(); $.ajax({ type: 'get', - url: '../ajax/act_index', + url: indicator_url + 'ajax/act_index', data: 'index_id='+index_id+'&act=minus'+'&time='+time, success: function(data){ var obj = minus_icon.parent(); @@ -76,4 +76,6 @@ function classHover(obj, c){ $(this).removeClass(c); } ); -}
\ No newline at end of file +} + +// vim: set ts=4 sw=4 tw=0 fenc=utf-8 ft=javascript: // diff --git a/97suifangqa/apps/indicator/static/javascripts/sheetdefault.js b/97suifangqa/apps/indicator/static/javascripts/sheetdefault.js index 51bd8fa..55dfcd5 100644 --- a/97suifangqa/apps/indicator/static/javascripts/sheetdefault.js +++ b/97suifangqa/apps/indicator/static/javascripts/sheetdefault.js @@ -8,16 +8,16 @@ $(document).ready(function(){ //副标题点大叉 $("#index_title_closed_icon").bind("click", function(){ - var clostBtn = $(this); + var closeBtn = $(this); var date = new Date(); var time = date.getTime(); $.ajax({ //数据库还是cookie,都可以,建议使用cookie,html中是否显示sub_title也由后端读取的cookie决定 type: 'get', - url: '../ajax/close_sub_title', + url: indicator_url + 'ajax/close_sub_title', data: 'time='+time, success: function(data){ if(data == 'success'){ - clostBtn.parent().remove(); + closeBtn.parent().remove(); } } }); @@ -146,14 +146,14 @@ $(document).ready(function(){ //日期控件 $(".select_date>.datepicker").datepicker({ showOn: "both", - buttonImage: "../plugins/datepicker/images/calendar.png", + buttonImage: static_url + "plugins/datepicker/images/calendar.png", buttonImageOnly: true }); //时间范围控制(开始时间<结束时间) $("#search_start_date").datepicker({ showOn: "both", - buttonImage: "../plugins/datepicker/images/calendar.png", + buttonImage: static_url + "plugins/datepicker/images/calendar.png", buttonImageOnly: true, onClose: function( selectedDate ) { $("#search_end_date").datepicker("option", "minDate", selectedDate); @@ -178,4 +178,6 @@ function delete_card(){ } }); card.remove(); -}
\ No newline at end of file +} + +// vim: set ts=4 sw=4 tw=0 fenc=utf-8 ft=javascript: // diff --git a/97suifangqa/apps/indicator/templates/indicator/NewDeleteIndex.html b/97suifangqa/apps/indicator/templates/indicator/NewDeleteIndex.html index 5c1b568..29c15d0 100644 --- a/97suifangqa/apps/indicator/templates/indicator/NewDeleteIndex.html +++ b/97suifangqa/apps/indicator/templates/indicator/NewDeleteIndex.html @@ -1,17 +1,35 @@ -<!DOCTYPE HTML> -{% load staticfiles %} -<html> -<head> - <meta http-equiv="content-type" content="text/html;charset=UTF-8"> - <title>添加或删除关注指标</title> +{% extends "base.html" %} +{% load static from staticfiles %} + +{% block title %} +指标状态 | 随访工具 | 97 随访 +{% endblock %} + +{% block css %} <link rel="stylesheet" type="text/css" href="{% static "css/normalize.css" %}"/> - <link rel="stylesheet" type="text/css" href="{% static "plugins/thickbox/thickbox.css" %}"/> <link rel="stylesheet" type="text/css" href="{% static "css/new_delete_index.css" %}"/> + <link rel="stylesheet" type="text/css" href="{% static "plugins/thickbox/thickbox.css" %}"/> +{% endblock %} + +{% block jquery %} <script type="text/javascript" src="{% static "javascripts/jquery-1.6.min.js" %}"></script> - <script type="text/javascript" src="{% static "plugins/thickbox/thickbox.js" %}"></script> +{% endblock %} + +{% block scripts %} <script type="text/javascript" src="{% static "javascripts/new_delete_index.js" %}"></script> -</head> -<body> + <script type="text/javascript" src="{% static "plugins/thickbox/thickbox.js" %}"></script> + + <!-- set variables + 'static_url': used in js to load staticfiles + 'indicator_url': root url of 'apps/indicator' + --> + <script> + var static_url = "{{ STATIC_URL }}"; + var indicator_url = "/indicator/"; + </script> +{% endblock %} + +{% block page %} <!-- <iframe align="left" width="420" height="720" src="SideBar.html" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> --> @@ -423,6 +441,6 @@ <div style="clear:both;"></div> </div> </div> -</body> -</html> +{% endblock page %} + {# vim: set ts=2 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/97suifangqa/apps/indicator/templates/indicator/SheetDefault.html b/97suifangqa/apps/indicator/templates/indicator/SheetDefault.html index 50d71d7..56d0e6a 100644 --- a/97suifangqa/apps/indicator/templates/indicator/SheetDefault.html +++ b/97suifangqa/apps/indicator/templates/indicator/SheetDefault.html @@ -1,14 +1,22 @@ -<!DOCTYPE HTML> -{% load staticfiles %} -<html> -<head> - <meta http-equiv="content-type" content="text/html;charset=UTF-8"> - <title>页面4</title> +{% extends "base.html" %} +{% load static from staticfiles %} + +{% block title %} +指标状态 | 随访工具 | 97 随访 +{% endblock %} + +{% block css %} <link rel="stylesheet" type="text/css" href="{% static "css/normalize.css" %}"/> <link rel="stylesheet" type="text/css" href="{% static "plugins/datepicker/datepicker.css" %}"/> <link rel="stylesheet" type="text/css" href="{% static "plugins/thickbox/thickbox.css" %}"/> <link rel="stylesheet" type="text/css" href="{% static "css/sheet_default.css" %}"/> +{% endblock %} + +{% block jquery %} <script type="text/javascript" src="{% static "javascripts/jquery-1.6.min.js" %}"></script> +{% endblock %} + +{% block scripts %} <script type="text/javascript" src="{% static "plugins/datepicker/datepicker.js" %}"></script> <script type="text/javascript" src="{% static "plugins/datepicker/language-zh-CN.js" %}"></script> <script type="text/javascript" src="{% static "plugins/thickbox/thickbox.js" %}"></script> @@ -16,8 +24,18 @@ <script type="text/javascript" src="{% static "plugins/highcharts/highcharts-more.js" %}"></script> <script type="text/javascript" src="{% static "javascripts/sheetdefault.js" %}"></script> <script type="text/javascript" src="{% static "javascripts/load_card.js" %}"></script> -</head> -<body> + + <!-- set variables + 'static_url': used in js to load staticfiles + 'indicator_url': root url of 'apps/indicator' + --> + <script> + var static_url = "{{ STATIC_URL }}"; + var indicator_url = "/indicator/"; + </script> +{% endblock %} + +{% block page %} <!-- <iframe align="left" width="420" height="720" src="SideBar.html" style="position:fixed;left:0;top:0" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> --> @@ -203,10 +221,12 @@ </div> <div class="act_card_container index_card_sec"> - <div class="act_card"><a href="NewDeleteIndex.html">添加或删除关注指标</a></div> + <div class="act_card"> + <a href="{% url follow_indicator %}">添加或删除关注指标</a> + </div> </div> </div> </div> -</body> -</html> +{% endblock page %} + {# vim: set ts=2 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/97suifangqa/apps/indicator/templates/indicator/SideBar.html b/97suifangqa/apps/indicator/templates/indicator/SideBar.html index a6db044..710a8dd 100644 --- a/97suifangqa/apps/indicator/templates/indicator/SideBar.html +++ b/97suifangqa/apps/indicator/templates/indicator/SideBar.html @@ -1,15 +1,24 @@ -<!DOCTYPE HTML> -{% load staticfiles %} -<html> -<head> - <meta charset=UTF-8"> - <title>demo</title> +{% extends "base.html" %} +{% load static from staticfiles %} + +{% block title %} +边栏 | 随访工具 | 97 随访 +{% endblock %} + +{% block css %} <link rel="stylesheet" type="text/css" href="{% static "css/normalize.css" %}"/> <link rel="stylesheet" type="text/css" href="{% static "css/sidebar.css" %}"/> +{% endblock %} + +{% block jquery %} <script type="text/javascript" src="{% static "javascripts/jquery-1.6.min.js" %}"></script> +{% endblock %} + +{% block scripts %} <script type="text/javascript" src="{% static "javascripts/sidebar.js" %}"></script> -</head> -<body> +{% endblock %} + +{% block page %} <div id="sidebar_container"> <!-- ====================== navigation ====================== --> <div id="nav_container"> @@ -73,5 +82,6 @@ </div> </div> -</body> +{% endblock page %} + {# vim: set ts=2 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/97suifangqa/apps/indicator/templates/indicator/index.html b/97suifangqa/apps/indicator/templates/indicator/index.html index 94ab354..7c280f7 100644 --- a/97suifangqa/apps/indicator/templates/indicator/index.html +++ b/97suifangqa/apps/indicator/templates/indicator/index.html @@ -1,12 +1,15 @@ -<!DOCTYPE HTML> -<html> -<head> - <meta http-equiv="content-type" content="text/html;charset=UTF-8"> - <title>首页</title> -</head> -<body> - <a href="{% url indicator_status %}">指标状态</a> - <a href="{% url follow_indicator %}">关注指标</a> -</body> -</html> -<!-- vim: set ts=2 sw=2 tw=0 fenc=utf-8 ft=html: --> +{% extends "base.html" %} +{% load static from staticfiles %} + +{% block title %} +首页 | 随访工具 | 97 随访 +{% endblock %} + +{% block body %} + <ul> + <li><a href="{% url indicator_status %}">指标状态</a></li> + <li><a href="{% url follow_indicator %}">关注指标</a></li> + </ul> +{% endblock %} + +{# vim: set ts=2 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/97suifangqa/apps/indicator/templates/indicator/popup/DeleteCardTip.html b/97suifangqa/apps/indicator/templates/indicator/popup/DeleteCardTip.html index 3aed409..7424930 100644 --- a/97suifangqa/apps/indicator/templates/indicator/popup/DeleteCardTip.html +++ b/97suifangqa/apps/indicator/templates/indicator/popup/DeleteCardTip.html @@ -1,15 +1,24 @@ -<!DOCTYPE HTML> -{% load staticfiles %} -<html> -<head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> - <title>取消关注卡片提示</title> +{% extends "base.html" %} +{% load static from staticfiles %} + +{% block title %} +取消关注卡片提示 | 随访工具 | 97 随访 +{% endblock %} + +{% block css %} <link rel="stylesheet" type="text/css" href="{% static "css/normalize.css" %}"/> <link rel="stylesheet" type="text/css" href="{% static "css/delete_card_tip.css" %}"/> +{% endblock %} + +{% block jquery %} <script type="text/javascript" src="{% static "javascripts/jquery-1.6.min.js" %}"></script> +{% endblock %} + +{% block scripts %} <script type="text/javascript" src="{% static "javascripts/delete_card_tip.js" %}"></script> -</head> -<body> +{% endblock %} + +{% block page %} <div id="delete_card_tip_container"> <div class="delete_card_tip_title_line"> <div class="delete_card_tip_title">提示</div> @@ -21,6 +30,6 @@ <a class="action_confirm_ignore">继续关注</a> </div> </div> -</body> -</html> +{% endblock page %} + {# vim: set ts=2 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/97suifangqa/apps/indicator/templates/indicator/popup/EditHistoryData.html b/97suifangqa/apps/indicator/templates/indicator/popup/EditHistoryData.html index 094766d..2cf58d1 100644 --- a/97suifangqa/apps/indicator/templates/indicator/popup/EditHistoryData.html +++ b/97suifangqa/apps/indicator/templates/indicator/popup/EditHistoryData.html @@ -1,15 +1,33 @@ -<!DOCTYPE HTML> -{% load staticfiles %} -<html> -<head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> - <title>编辑历史数据</title> +{% extends "base.html" %} +{% load static from staticfiles %} + +{% block title %} +编辑历史数据 | 随访工具 | 97 随访 +{% endblock %} + +{% block css %} <link rel="stylesheet" type="text/css" href="{% static "css/normalize.css" %}"/> <link rel="stylesheet" type="text/css" href="{% static "css/edit_history_data.css" %}"/> +{% endblock %} + +{% block jquery %} <script type="text/javascript" src="{% static "javascripts/jquery-1.6.min.js" %}"></script> +{% endblock %} + +{% block scripts %} <script type="text/javascript" src="{% static "javascripts/edit_history_data.js" %}"></script> -</head> -<body> + + <!-- set variables + 'static_url': used in js to load staticfiles + 'indicator_url': root url of 'apps/indicator' + --> + <script> + var static_url = "{{ STATIC_URL }}"; + var indicator_url = "/indicator/"; + </script> +{% endblock %} + +{% block page %} <div id="edit_history_data_container"> <div class="edit_history_data_title_line"> <div class="edit_history_data_title">乙肝病毒核算定量(PCR)</div> @@ -37,6 +55,6 @@ </div> </div> </div> -</body> -</html> +{% endblock page %} + {# vim: set ts=2 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/97suifangqa/apps/indicator/templates/indicator/popup/IndexDesc.html b/97suifangqa/apps/indicator/templates/indicator/popup/IndexDesc.html index db83f19..ad9f20d 100644 --- a/97suifangqa/apps/indicator/templates/indicator/popup/IndexDesc.html +++ b/97suifangqa/apps/indicator/templates/indicator/popup/IndexDesc.html @@ -1,15 +1,24 @@ -<!DOCTYPE HTML> -{% load staticfiles %} -<html> -<head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> - <title>指标注释</title> +{% extends "base.html" %} +{% load static from staticfiles %} + +{% block title %} +指标注释 | 随访工具 | 97 随访 +{% endblock %} + +{% block css %} <link rel="stylesheet" type="text/css" href="{% static "css/normalize.css" %}"/> <link rel="stylesheet" type="text/css" href="{% static "css/index_desc.css" %}"/> +{% endblock %} + +{% block jquery %} <script type="text/javascript" src="{% static "javascripts/jquery-1.6.min.js" %}"></script> +{% endblock %} + +{% block scripts %} <script type="text/javascript" src="{% static "javascripts/index_desc.js" %}"></script> -</head> -<body> +{% endblock %} + +{% block page %} <div id="index_desc_container"> <div class="index_desc_title_line"> <div class="index_desc_title">乙肝病毒核算定量(PCR)</div> @@ -23,6 +32,6 @@ <div class="collection">收藏该注释(已有 100 人收藏)</div> <div class="go_library"><input type="button" class="go_library_btn" value="前往医学知识库" /></div> </div> -</body> -</html> +{% endblock page %} + {# vim: set ts=2 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/97suifangqa/apps/indicator/urls.py b/97suifangqa/apps/indicator/urls.py index dbfc1ae..0a9532b 100644 --- a/97suifangqa/apps/indicator/urls.py +++ b/97suifangqa/apps/indicator/urls.py @@ -70,6 +70,32 @@ urlpatterns += patterns('', name='indicator_indexdesc'), ) +## UI ajax +urlpatterns += patterns('indicator.views', + # act_index + # index action (add/minus): follow/unfollow indicator + url(r'^ajax/act_index/$', + 'ajax_act_index', + name='indicator_ajax_actindex'), + # close_sub_title + # close the small prompt banner above the indicator cards + url(r'^ajax/close_sub_title/$', + 'ajax_close_sub_title', + name='indicator_ajax_closesubtitle'), + # edit_history_data + url(r'^ajax/edit_history_data/$', + 'ajax_edit_history_data', + name='indicator_ajax_edithistorydata'), + # get_card_data_chart + url(r'^ajax/get_card_data_chart/$', + 'ajax_get_card_data_chart', + name='indicator_ajax_getcarddatachart'), + # get_card_data_table + url(r'^ajax/get_card_data_table/$', + 'ajax_get_card_data_table', + name='indicator_ajax_getcarddatatable'), +) + urlpatterns += patterns('indicator.views', ## test url(r'^test/$', 'test_view', name='test'), diff --git a/97suifangqa/apps/indicator/views.py b/97suifangqa/apps/indicator/views.py index a8ee9dc..73e1189 100644 --- a/97suifangqa/apps/indicator/views.py +++ b/97suifangqa/apps/indicator/views.py @@ -6,8 +6,10 @@ apps/indicator views """ from django.contrib.auth.decorators import login_required -from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden +from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, Http404 from django.shortcuts import render_to_response, get_object_or_404 +# json +from django.utils import simplejson as json # CRSF from django.template import RequestContext @@ -19,6 +21,7 @@ import re import datetime + def get_indicator_view(request, **kwargs): idict = get_indicator(**kwargs) return HttpResponse("%s" % idict) @@ -407,6 +410,106 @@ def add_recordhistory(request, record_id, template='indicator/simple.html'): ########################################################### +###### ajax ###### +def ajax_act_index(request): + """ + index action (add/minus) + follow/unfollow indicator + + TODO: + * howto relate 'index_id' to 'indicator_id'? + * howto implement follow/unfollow indicator function? + """ + if request.is_ajax(): + result = 'success' + else: + result = 'fail' + #raise Http404 + return HttpResponse(result) + + +def ajax_close_sub_title(request): + """ + close the small prompt banner above the indicator cards + + 'indicator/static/javascripts/sheetdefault.js' + """ + if request.is_ajax(): + result = 'success' + else: + result = 'fail' + #raise Http404 + return HttpResponse(result) + + +def ajax_edit_history_data(request): + """ + edit history data + used in 'detail history' view card + """ + if request.is_ajax(): + result = 'success' + else: + result = 'fail' + #raise Http404 + return HttpResponse(result) + + +def ajax_get_card_data_chart(request): + """ + 'indicator/static/javascripts/load_card.js' + get card data + for the 'chart' within the card + format: [v1, v2, v3, ...] + + NB. + 每一天都要有数据,否则时间轴对不上 (load_card.js: redraw_chard()) + TODO: + workaround for the above problem! + """ + # TODO + if request.is_ajax(): + result = [6.0, 5.9, 5.5, 4.5, 6.2, 6.5, 5.2, 6.0, + 5.9, 5.5, 4.5, 6.2, 6.5, 5.2, 6.0, 5.9, + 5.5, 4.5, 6.2, 6.5] + else: + result = '' + #raise Http404 + return HttpResponse(json.dumps(result), + mimetype='application/json') + + +def ajax_get_card_data_table(request): + """ + get card data + for used in 'detail data card' + format: + <tr><td>yyyy-mm-dd</td><td>hh:mm</td><td>value unit</td></tr> + """ + # TODO + if request.is_ajax(): + result = """ + <tr><td>2013-08-10</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-09</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-08</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-08</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-07</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-06</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-05</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-04</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-03</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-02</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-08-01</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-07-31</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + <tr><td>2013-07-30</td><td>11:20</td><td>100x10^4拷贝/mL</td></tr> + """ + else: + result = '' + #raise Http404 + return HttpResponse(result) + + +########################################################### ### test_view ### def test_view(request, **kwargs): |