#4 -- Read rule string #20
@ -1,3 +1,24 @@
|
||||
|
||||
// Rules parsing
|
||||
function getAntecedent(rule) {
|
||||
withoutIf = rule.split('if');
|
||||
return withoutIf[1].trim().split('then')[0].trim();
|
||||
}
|
||||
|
||||
function getAntecedentComponents(antecedent) {
|
||||
return antecedent.split('and').map((i) => i.trim());
|
||||
}
|
||||
|
||||
function getVariable(antecedent) {
|
||||
return antecedent.split('is')[0].trim();
|
||||
}
|
||||
|
||||
function getVariableValue(antecedent) {
|
||||
return antecedent.split('is')[1].trim();
|
||||
}
|
||||
|
||||
// Rules creation
|
||||
|
||||
/* exported MessageTypesEnum */
|
||||
var MessageTypesEnum = {
|
||||
INFO: "info",
|
||||
|
@ -57,24 +57,8 @@
|
||||
class="btn btn-outline-dark">Добавить правило</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="/js/fuzzyRule.js"></script>
|
||||
<script>
|
||||
function getAntecedent(rule) {
|
||||
withoutIf = rule.split('if');
|
||||
return withoutIf[1].trim().split('then')[0].trim();
|
||||
}
|
||||
|
||||
function getAntecedentComponents(antecedent) {
|
||||
return antecedent.split('and').map((i) => i.trim());
|
||||
}
|
||||
|
||||
function getVariable(antecedent) {
|
||||
return antecedent.split('is')[0].trim();
|
||||
}
|
||||
|
||||
function getVariableValue(antecedent) {
|
||||
return antecedent.split('is')[1].trim();
|
||||
}
|
||||
|
||||
function addRule(index, el, rule) {
|
||||
ruleHtml = "<div class='col col-md-12'><span class='badge badge-light'>"+(index+1) +". Если</span></div>"
|
||||
antecedentComponents = getAntecedentComponents(getAntecedent(rule));
|
||||
|
@ -45,7 +45,11 @@
|
||||
<script type="text/javascript" src="/js/fuzzyRule.js"></script>
|
||||
<script>
|
||||
/*<![CDATA[*/
|
||||
addAntecedent($('#rules'), [[${projectId}]]);
|
||||
if ($('#ruleContent').val()) {
|
||||
alert('123');
|
||||
} else {
|
||||
addAntecedent($('#rules'), [[${projectId}]]);
|
||||
}
|
||||
/*]]>*/
|
||||
</script>
|
||||
</form>
|
||||
|
Loading…
x
Reference in New Issue
Block a user