diff --git a/db/update18.3.sql b/db/update18.3.sql index 726ab1762c..cf9c51a501 100644 --- a/db/update18.3.sql +++ b/db/update18.3.sql @@ -274,6 +274,9 @@ SELECT t1.`group`, t1.`module`, 'myCollection' FROM `zt_grouppriv` AS t1 WHERE t INSERT IGNORE INTO `zt_grouppriv` (`group`, `module`, `method`) SELECT t1.`group`, t1.`module`, 'myCreation' FROM `zt_grouppriv` AS t1 WHERE t1.`module` = 'doc' AND t1.`method` = 'browse'; +INSERT IGNORE INTO `zt_grouppriv` (`group`, `module`, `method`) +SELECT t1.`group`, t1.`module`, 'myEdited' FROM `zt_grouppriv` AS t1 WHERE t1.`module` = 'doc' AND t1.`method` = 'browse'; + INSERT IGNORE INTO `zt_grouppriv` (`group`, `module`, `method`) SELECT t1.`group`, t1.`module`, 'productSpace' FROM `zt_grouppriv` AS t1 WHERE t1.`module` = 'doc' AND t1.`method` = 'tableContents'; diff --git a/db/zentao.sql b/db/zentao.sql index 53894ee901..597de86cd7 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -3426,6 +3426,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (1, 'doc', 'manageBook'), (1, 'doc', 'myCollection'), (1, 'doc', 'myCreation'), +(1, 'doc', 'myEdited'), (1, 'doc', 'mySpace'), (1, 'doc', 'myView'), (1, 'doc', 'productSpace'), @@ -4780,6 +4781,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (2, 'doc', 'index'), (2, 'doc', 'myCollection'), (2, 'doc', 'myCreation'), +(2, 'doc', 'myEdited'), (2, 'doc', 'mySpace'), (2, 'doc', 'myView'), (2, 'doc', 'productSpace'), @@ -5508,6 +5510,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (3, 'doc', 'index'), (3, 'doc', 'myCollection'), (3, 'doc', 'myCreation'), +(3, 'doc', 'myEdited'), (3, 'doc', 'mySpace'), (3, 'doc', 'myView'), (3, 'doc', 'productSpace'), @@ -6188,6 +6191,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (4, 'doc', 'manageBook'), (4, 'doc', 'myCollection'), (4, 'doc', 'myCreation'), +(4, 'doc', 'myEdited'), (4, 'doc', 'mySpace'), (4, 'doc', 'myView'), (4, 'doc', 'productSpace'), @@ -7223,6 +7227,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (5, 'doc', 'index'), (5, 'doc', 'myCollection'), (5, 'doc', 'myCreation'), +(5, 'doc', 'myEdited'), (5, 'doc', 'mySpace'), (5, 'doc', 'myView'), (5, 'doc', 'productSpace'), @@ -8142,6 +8147,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (6, 'doc', 'index'), (6, 'doc', 'myCollection'), (6, 'doc', 'myCreation'), +(6, 'doc', 'myEdited'), (6, 'doc', 'mySpace'), (6, 'doc', 'myView'), (6, 'doc', 'productSpace'), @@ -8939,6 +8945,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (7, 'doc', 'index'), (7, 'doc', 'myCollection'), (7, 'doc', 'myCreation'), +(7, 'doc', 'myEdited'), (7, 'doc', 'mySpace'), (7, 'doc', 'myView'), (7, 'doc', 'productSpace'), @@ -9751,6 +9758,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (8, 'doc', 'index'), (8, 'doc', 'myCollection'), (8, 'doc', 'myCreation'), +(8, 'doc', 'myEdited'), (8, 'doc', 'mySpace'), (8, 'doc', 'myView'), (8, 'doc', 'productSpace'), @@ -10592,6 +10600,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (9, 'doc', 'index'), (9, 'doc', 'myCollection'), (9, 'doc', 'myCreation'), +(9, 'doc', 'myEdited'), (9, 'doc', 'mySpace'), (9, 'doc', 'myView'), (9, 'doc', 'productSpace'), @@ -11259,6 +11268,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (10, 'doc', 'index'), (10, 'doc', 'myCollection'), (10, 'doc', 'myCreation'), +(10, 'doc', 'myEdited'), (10, 'doc', 'mySpace'), (10, 'doc', 'myView'), (10, 'doc', 'productSpace'), @@ -11762,6 +11772,7 @@ REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (11, 'doc', 'index'), (11, 'doc', 'myCollection'), (11, 'doc', 'myCreation'), +(11, 'doc', 'myEdited'), (11, 'doc', 'mySpace'), (11, 'doc', 'myView'), (11, 'doc', 'productSpace'), diff --git a/module/chart/js/common.js b/module/chart/js/common.js index f7d9bf587c..715932d691 100644 --- a/module/chart/js/common.js +++ b/module/chart/js/common.js @@ -87,3 +87,17 @@ function initDatepicker($obj, callback) if(typeof callback == 'function') callback($obj); } + +/** + * Attr date check. + * + * @param object $obj + * @access public + * @return void + */ +function attrDateCheck($obj) +{ + $obj.find('.form-date').attr('onchange', 'checkDate(this, this.value)'); + $obj.find('.form-datetime').attr('onchange', 'checkDate(this, this.value)'); +} + diff --git a/module/chart/js/preview.js b/module/chart/js/preview.js index 44955b951e..48b48de670 100644 --- a/module/chart/js/preview.js +++ b/module/chart/js/preview.js @@ -1,10 +1,8 @@ $(function() { initCheckBox(); - initQueryBtn(); $('#exportchart').modalTrigger(); - chartMap = new Map(); if(charts.length > 0) { var chartPros = charts.map(function(chart) @@ -12,7 +10,6 @@ $(function() var echartDom = $('#chartDraw' + chart.currentGroup + '_' + chart.id).get(0); var echart = echarts.init(echartDom); ajaxGetChart(false, chart, echart); - chartMap.set(chart.cudrrentGroup + chart.id, chart); return renderFilters(chart); }); @@ -21,9 +18,14 @@ $(function() calcPreviewGrowFilter(); $('body').resize(() => {calcPreviewGrowFilter(true);}); }); - } + chartMap = new Map(); + charts.forEach(function(chart) + { + chartMap.set(chart.currentGroup + '_' + chart.id, chart); + }); + $('[data-toggle="tooltip"]').tooltip(); }) @@ -73,53 +75,53 @@ function initCheckBox() /** * Init query button. * + * @param object $obj * @access public * @return void */ -function initQueryBtn() +function queryData(obj) { - $('.btn-query').click(function() + var chartID = $(obj).parents('.filterBox').attr('data-chart'); + var chartInfo = chartMap.get(chartID); + chartInfo.searchFilters = JSON.parse(JSON.stringify(chartInfo.filters)); + + // Foreach filters and set current value in searchFilters. */ + $('#filterItems' + chartID + ' .filter-items').children().each(function(index) { - var chartID = $(this).attr('data-chart'); - var chartInfo = chartMap.get(chartID); - chartInfo.searchFilters = JSON.parse(JSON.stringify(chartInfo.filters)); + var $child = $(this); + if(!$child.hasClass('filter-item')) return; - // Foreach filters and set current value in searchFilters. */ - $('#filterItems' + chartID + ' .filter-items').children().each(function(index) + var filter = chartInfo.searchFilters[index]; + var type = filter.type; + var value = null; + + if(type == 'input' || type == 'select') { - var $child = $(this); - var filter = chartInfo.searchFilters[index]; - var type = filter.type; - var value = null; + var value = $child.find('#default').val(); + chartInfo.searchFilters[index].default = value; + } + else if(type == 'date' || type == 'datetime') + { + var begin = $child.find('input').first().val(); + var end = $child.find('input').last().val(); - if(type == 'input' || type == 'select') - { - var value = $child.find('#default').val(); - chartInfo.searchFilters[index].default = value; - } - else if(type == 'date' || type == 'datetime') - { - var begin = $child.find('input').first().val(); - var end = $child.find('input').last().val(); + var value = {"begin":begin, "end":end}; + chartInfo.searchFilters[index].default = value; + } + else if(type == 'condition') + { + var operator = $child.find('#operator').data('zui.picker').getValue(); + var value = $child.find('#value').val(); - var value = {"begin":begin, "end":end}; - chartInfo.searchFilters[index].default = value; - } - else if(type == 'condition') - { - var operator = $child.find('#operator').data('zui.picker').getValue(); - var value = $child.find('#value').val(); - - chartInfo.searchFilters[index].operator = operator; - chartInfo.searchFilters[index].value = value; - } - }); - - //* Reload echart. */ - var echartDom = $('#chartDraw' + chartID).get(0); - var echartInfo = echarts.init(echartDom); - ajaxGetChart(false, chartInfo, echartInfo); + chartInfo.searchFilters[index].operator = operator; + chartInfo.searchFilters[index].value = value; + } }); + + //* Reload echart. */ + var echartDom = $('#chartDraw' + chartID).get(0); + var echartInfo = echarts.init(echartDom); + ajaxGetChart(false, chartInfo, echartInfo); } function calcPreviewGrowFilter(resize = false) @@ -247,6 +249,6 @@ function renderFilterItem(filter, resp, index, step) }; var html = $($.zui.formatString(tpl, data)) initPicker(html, 'picker-select', true); - initDatepicker(html); + initDatepicker(html, attrDateCheck); return html; } diff --git a/module/chart/view/preview.html.php b/module/chart/view/preview.html.php index bda28fc0f6..e007da1ad6 100644 --- a/module/chart/view/preview.html.php +++ b/module/chart/view/preview.html.php @@ -20,7 +20,7 @@ chart->widthInput);?> chart->widthDate);?> bi->pickerHeight);?> - ";?> + ";?>