From 8f672aa531f3131648942ae564176eb4346c367b Mon Sep 17 00:00:00 2001 From: tianya <8445295+llgoer@user.noreply.gitee.com> Date: Thu, 28 Apr 2022 14:48:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9F=BA=E7=A1=80=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + README.md | 18 +- docs/demo.json | 409 ++++++++++++++++++++++++++++++++++++ knmanage/knmodel/Cargo.lock | 126 +++++++++++ knmanage/knmodel/Cargo.toml | 12 ++ knmanage/knmodel/src/lib.rs | 13 ++ knmanage/package-lock.json | 3 + knmanage/package.json | 1 + knmanage/src/App.js | 8 + 9 files changed, 590 insertions(+), 1 deletion(-) create mode 100644 docs/demo.json create mode 100644 knmanage/knmodel/Cargo.lock create mode 100644 knmanage/knmodel/Cargo.toml create mode 100644 knmanage/knmodel/src/lib.rs diff --git a/.gitignore b/.gitignore index 9bea433..8b95ee0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store +knmanage/knmodel/target/ diff --git a/README.md b/README.md index 2ab4bf3..abf8eec 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,19 @@ # knmanage -知识库规则js组件 \ No newline at end of file +知识库规则js组件 + +## 开发资料 +地址:`http://42.192.72.252:99/policy` + +账户:`hx` + +密码:`one123456` + +## 目录说明 +``` +./docs 文档 +./knmanage 项目目录 + |__knmodel 采用Rust WASM开发的模型库,主要用于快速便捷操作JSON数据模型 + |__public 站点根目录 + |__src 源码 +``` \ No newline at end of file diff --git a/docs/demo.json b/docs/demo.json new file mode 100644 index 0000000..fc61415 --- /dev/null +++ b/docs/demo.json @@ -0,0 +1,409 @@ +[ + { + "field": "就诊卡号", + "fieldColumn": "card_no", + "id": 3, + "dataType": "STRING", + "collapse": true, + "linkId": "", + "required": "1", + "attribute": "single", + "child": [ + { + "field": "测试规则", + "fieldColumn": "", + "id": 0, + "dataType": "STRING", + "collapse": true, + "child": [ + { + "field": "onerws病人id", + "fieldColumn": "patient_id", + "id": 1, + "dataType": "NUMBER", + "collapse": true, + "linkId": "", + "required": "0", + "attribute": "single", + "child": [ + { + "field": "", + "fieldColumn": "", + "id": 0, + "dataType": "STRING", + "collapse": true, + "child": [ + { + "field": "就诊卡号", + "fieldColumn": "card_no", + "id": 3, + "dataType": "STRING", + "collapse": true, + "linkId": "", + "required": "1", + "attribute": "single", + "child": [ + { + "field": "", + "fieldColumn": "", + "id": 0, + "dataType": "STRING", + "collapse": true, + "child": [], + "filterList": [], + "weight": 0, + "parentOperation": 0 + } + ] + }, + { + "field": "性别", + "fieldColumn": "sex", + "id": 7, + "dataType": "STRING", + "collapse": true, + "linkId": "", + "required": "1", + "attribute": "single", + "child": [ + { + "field": "", + "fieldColumn": "", + "id": 0, + "dataType": "STRING", + "collapse": true, + "child": [ + { + "field": "住址", + "fieldColumn": "address", + "id": 15, + "dataType": "STRING", + "collapse": true, + "linkId": "", + "required": "1", + "attribute": "single", + "child": [ + { + "field": "", + "fieldColumn": "", + "id": 0, + "dataType": "STRING", + "collapse": true, + "child": [], + "filterList": [ + { + "operation": 0, + "narutoList": [ + { + "field": "住址", + "id": 15, + "dataType": "STRING", + "fieldColumn": "address", + "condition": [ + "555" + ], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T03:13:17.910Z", + "conditionDateEnd": "2022-04-28T03:13:17.911Z" + } + ] + }, + { + "operation": 1, + "narutoList": [ + { + "field": "住址", + "id": 15, + "dataType": "STRING", + "fieldColumn": "address", + "condition": [ + "ttttfff" + ], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T03:13:21.991Z", + "conditionDateEnd": "2022-04-28T03:13:21.991Z" + }, + { + "field": "住址", + "id": 15, + "dataType": "STRING", + "fieldColumn": "address", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T03:13:34.445Z", + "conditionDateEnd": "2022-04-28T03:13:34.445Z" + } + ] + } + ], + "weight": 0, + "parentOperation": 0 + } + ] + } + ], + "filterList": [ + { + "operation": 0, + "narutoList": [ + { + "field": "性别", + "id": 7, + "dataType": "STRING", + "fieldColumn": "sex", + "condition": [ + "111" + ], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T02:00:12.827Z", + "conditionDateEnd": "2022-04-28T02:00:12.827Z" + } + ] + } + ], + "weight": 0, + "parentOperation": 0 + } + ] + } + ], + "filterList": [ + { + "operation": 1, + "narutoList": [ + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "not equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-26T10:50:30.625Z", + "conditionDateEnd": "2022-04-26T10:50:30.625Z" + }, + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "greater than", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-26T10:50:34.363Z", + "conditionDateEnd": "2022-04-26T10:50:34.363Z" + }, + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-26T10:51:52.333Z", + "conditionDateEnd": "2022-04-26T10:51:52.333Z" + }, + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T02:07:58.433Z", + "conditionDateEnd": "2022-04-28T02:07:58.433Z" + } + ] + }, + { + "operation": 0, + "narutoList": [ + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-26T10:51:44.929Z", + "conditionDateEnd": "2022-04-26T10:51:44.929Z" + }, + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T02:08:00.533Z", + "conditionDateEnd": "2022-04-28T02:08:00.533Z" + }, + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T02:08:02.262Z", + "conditionDateEnd": "2022-04-28T02:08:02.262Z" + } + ] + }, + { + "operation": 1, + "narutoList": [ + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-26T10:51:57.931Z", + "conditionDateEnd": "2022-04-26T10:51:57.931Z" + }, + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 2, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-26T11:51:44.247Z", + "conditionDateEnd": "2022-04-26T11:51:44.247Z" + } + ] + }, + { + "operation": 0, + "narutoList": [ + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T02:08:05.035Z", + "conditionDateEnd": "2022-04-28T02:08:05.035Z" + }, + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T02:08:32.746Z", + "conditionDateEnd": "2022-04-28T02:08:32.746Z" + } + ] + }, + { + "operation": 0, + "narutoList": [ + { + "field": "onerws病人id", + "id": 1, + "dataType": "NUMBER", + "fieldColumn": "patient_id", + "condition": [], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-28T02:08:07.640Z", + "conditionDateEnd": "2022-04-28T02:08:07.640Z" + } + ] + } + ], + "weight": 0, + "parentOperation": 0 + } + ] + } + ], + "filterList": [ + { + "operation": 0, + "narutoList": [ + { + "field": "就诊卡号", + "id": 3, + "dataType": "STRING", + "fieldColumn": "card_no", + "condition": [ + "112" + ], + "operation": "equal", + "operation1": "equal", + "conditionNumberStart": 0, + "conditionNumberEnd": 0, + "conditionDateStart": "2022-04-25T07:25:38.749Z", + "conditionDateEnd": "2022-04-25T07:25:38.750Z" + } + ] + } + ], + "weight": 0, + "parentOperation": 0 + } + ] + }, + { + "field": "性别", + "fieldColumn": "sex", + "id": 7, + "dataType": "STRING", + "collapse": true, + "linkId": "", + "required": "1", + "attribute": "single", + "child": [] + } +] \ No newline at end of file diff --git a/knmanage/knmodel/Cargo.lock b/knmanage/knmodel/Cargo.lock new file mode 100644 index 0000000..ffe8b60 --- /dev/null +++ b/knmanage/knmodel/Cargo.lock @@ -0,0 +1,126 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bumpalo" +version = "3.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "knmodel" +version = "0.1.0" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "log" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "proc-macro2" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "wasm-bindgen" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" diff --git a/knmanage/knmodel/Cargo.toml b/knmanage/knmodel/Cargo.toml new file mode 100644 index 0000000..a1eeacb --- /dev/null +++ b/knmanage/knmodel/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "knmodel" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wasm-bindgen = "0.2" \ No newline at end of file diff --git a/knmanage/knmodel/src/lib.rs b/knmanage/knmodel/src/lib.rs new file mode 100644 index 0000000..34fcf45 --- /dev/null +++ b/knmanage/knmodel/src/lib.rs @@ -0,0 +1,13 @@ +extern crate wasm_bindgen; + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern { + pub fn alert(s: &str); +} + +#[wasm_bindgen] +pub fn greet(name: &str) { + alert(&format!("Hello, {}!", name)); +} \ No newline at end of file diff --git a/knmanage/package-lock.json b/knmanage/package-lock.json index 84c8c3d..e3e99ea 100644 --- a/knmanage/package-lock.json +++ b/knmanage/package-lock.json @@ -7891,6 +7891,9 @@ "resolved": "https://registry.npmmirror.com/klona/-/klona-2.0.5.tgz", "integrity": "sha512-pJiBpiXMbt7dkzXe8Ghj/u4FfXOOa98fPW+bihOJ4SjnoijweJrNThJfd3ifXpXhREjpoF2mZVH1GfS9LV3kHQ==" }, + "knmodel": { + "version": "file:knmodel/pkg" + }, "language-subtag-registry": { "version": "0.3.21", "resolved": "https://registry.npmmirror.com/language-subtag-registry/-/language-subtag-registry-0.3.21.tgz", diff --git a/knmanage/package.json b/knmanage/package.json index 5f70b28..2fc0db7 100644 --- a/knmanage/package.json +++ b/knmanage/package.json @@ -6,6 +6,7 @@ "@testing-library/jest-dom": "^5.16.4", "@testing-library/react": "^13.1.1", "@testing-library/user-event": "^13.5.0", + "knmodel": "file:knmodel/pkg", "react": "^18.1.0", "react-dom": "^18.1.0", "react-scripts": "5.0.1", diff --git a/knmanage/src/App.js b/knmanage/src/App.js index 3784575..825f214 100644 --- a/knmanage/src/App.js +++ b/knmanage/src/App.js @@ -1,7 +1,15 @@ import logo from './logo.svg'; import './App.css'; +import init, { greet } from "knmodel"; +import React, { useEffect } from 'react'; function App() { + useEffect(() => { + init().then(() => { + greet("Hello Tianya"); + }) + }, []) + return (