You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1931 lines
94 KiB
1931 lines
94 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[8447],{
|
|
|
|
/***/ 47229:
|
|
/*!************************************************************!*\
|
|
!*** ./src/components/ui-customization/reset.less?modules ***!
|
|
\************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ __webpack_exports__.Z = ({"flex_box_center":"flex_box_center___vG4eV","flex_space_between":"flex_space_between___qVVxe","flex_box_vertical_center":"flex_box_vertical_center___P8Z8s","flex_box_center_end":"flex_box_center_end___VMme3","flex_box_column":"flex_box_column___VMHwm","dropdownmenus":"dropdownmenus___oVzoj","popupClassNames":"popupClassNames___OcZq7","selectdown":"selectdown___mmcA8"});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 45755:
|
|
/*!***********************************************************************!*\
|
|
!*** ./src/pages/virtualSpaces/Lists/Knowledge/index.tsx + 3 modules ***!
|
|
\***********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"default": function() { return /* binding */ Knowledge; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 15 modules
|
|
var _umi_production_exports = __webpack_require__(23852);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
|
|
var row = __webpack_require__(95237);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
|
|
var spin = __webpack_require__(71418);
|
|
;// CONCATENATED MODULE: ./src/pages/virtualSpaces/Lists/Knowledge/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Knowledgemodules = ({"flex_box_center":"flex_box_center___JKPl3","flex_space_between":"flex_space_between___QuVBb","flex_box_vertical_center":"flex_box_vertical_center___Ksaxh","flex_box_center_end":"flex_box_center_end___nIhjx","flex_box_column":"flex_box_column___NAJ16","wrap":"wrap___NZWPs","content":"content___OLcvS","name":"name____Thh2","list":"list___F7fxl","head":"head___ffJpn","models":"models___kudCc","btns":"btns___CQDPq","rowsHead":"rowsHead___oC1SU","time":"time___r7Qed","rowsBody":"rowsBody___ZNF9c"});
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__(64841);
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 34 modules
|
|
var ui_customization = __webpack_require__(20473);
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 15 modules
|
|
var markdown_editor = __webpack_require__(16393);
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
|
|
var RenderHtml = __webpack_require__(92936);
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/reset.less?modules
|
|
var resetmodules = __webpack_require__(47229);
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
var authority = __webpack_require__(77883);
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(75798);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
|
|
var es_form = __webpack_require__(78241);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
var tooltip = __webpack_require__(6848);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js + 1 modules
|
|
var dropdown = __webpack_require__(38854);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/index.js
|
|
var es_select = __webpack_require__(57809);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
var input = __webpack_require__(20008);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tree/index.js + 8 modules
|
|
var tree = __webpack_require__(22631);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
|
|
var col = __webpack_require__(43604);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/upload/index.js + 24 modules
|
|
var upload = __webpack_require__(73598);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/list/index.js + 3 modules
|
|
var list = __webpack_require__(73755);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/avatar/index.js + 4 modules
|
|
var avatar = __webpack_require__(26743);
|
|
// EXTERNAL MODULE: ./node_modules/_gojs-react@1.1.2@gojs-react/lib/esm/gojsreact.js + 1 modules
|
|
var gojsreact = __webpack_require__(85160);
|
|
// EXTERNAL MODULE: ./node_modules/_gojs3@2.3.10@gojs3/release/go-module.js
|
|
var go_module = __webpack_require__(12378);
|
|
// EXTERNAL MODULE: ./src/utils/fullscreen.ts
|
|
var fullscreen = __webpack_require__(91676);
|
|
;// CONCATENATED MODULE: ./src/pages/virtualSpaces/Lists/Knowledge/knowledge/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var knowledgemodules = ({"flex_box_center":"flex_box_center___dw6yv","flex_space_between":"flex_space_between___bkc32","flex_box_vertical_center":"flex_box_vertical_center___jDpm2","flex_box_center_end":"flex_box_center_end___g9JOB","flex_box_column":"flex_box_column___ngIjI","diagram-component":"diagram-component___fHDp0","rightmodal":"rightmodal___Fwj_F","title":"title___YZZgl","button":"button___yQKxh","linetitles":"linetitles___CFVw5","line":"line___hSEjG","additem":"additem___cy1wv","lebels":"lebels___E2znG","describe":"describe___emw2X","describetitle":"describetitle___bgNOs","ehover":"ehover____RCDx","dhover":"dhover___IP_3b","header":"header___PCDQg","headeractivite":"headeractivite___x56tJ","a":"a___QYqeC"});
|
|
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
|
|
var NoData = __webpack_require__(46948);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(19351);
|
|
// EXTERNAL MODULE: ./node_modules/_react-draggable@4.4.6@react-draggable/build/cjs/cjs.js
|
|
var cjs = __webpack_require__(12911);
|
|
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
|
|
// EXTERNAL MODULE: ./node_modules/_react-infinite-scroller@1.2.4@react-infinite-scroller/index.js
|
|
var _react_infinite_scroller_1_2_4_react_infinite_scroller = __webpack_require__(26724);
|
|
var _react_infinite_scroller_1_2_4_react_infinite_scroller_default = /*#__PURE__*/__webpack_require__.n(_react_infinite_scroller_1_2_4_react_infinite_scroller);
|
|
;// CONCATENATED MODULE: ./src/pages/virtualSpaces/Lists/Knowledge/knowledge/index.tsx
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContinuousForceDirectedLayout extends go_module.ForceDirectedLayout {
|
|
isFixed(v) {
|
|
return v.node.isSelected;
|
|
}
|
|
doLayout(coll) {
|
|
if (!this._isObserving) {
|
|
this._isObserving = true;
|
|
this.diagram.addModelChangedListener((e) => {
|
|
if (e.modelChange !== "" || e.change === go_module.ChangedEvent.Transaction && e.propertyName === "StartingFirstTransaction") {
|
|
this.network = null;
|
|
}
|
|
});
|
|
}
|
|
var net = this.network;
|
|
if (net === null) {
|
|
this.network = net = this.makeNetwork(coll);
|
|
} else {
|
|
this.diagram.nodes.each((n) => {
|
|
var v = net.findVertex(n);
|
|
if (v !== null)
|
|
v.bounds = n.actualBounds;
|
|
});
|
|
}
|
|
super.doLayout(coll);
|
|
this.network = net;
|
|
}
|
|
}
|
|
let textcolor = [
|
|
"\u6839\u8282\u70B9",
|
|
"\u7AE0\u8282\u77E5\u8BC6\u5355\u5143",
|
|
"\u8D44\u6E90\u77E5\u8BC6\u5355\u5143",
|
|
"\u77E5\u8BC6\u70B9"
|
|
];
|
|
let colors = [
|
|
"#3CDAA3",
|
|
"#30A7F1",
|
|
"#F84F90",
|
|
"#6656FF"
|
|
];
|
|
let types = [
|
|
{ name: "\u5B9E\u8BAD", type: "Shixun" },
|
|
{ name: "\u8BFE\u4EF6", type: "Attachment" },
|
|
{ name: "\u89C6\u9891", type: "VideoItem" },
|
|
{ name: "\u8003\u8BD5", type: "ExaminationBank" },
|
|
{ name: "\u4F5C\u4E1A", type: "SubjectHomework" },
|
|
{ name: "\u7EC3\u4E60", type: "Practice" },
|
|
{ name: "\u6587\u672C", type: "Text" }
|
|
];
|
|
const Atlas = ({
|
|
globalSetting,
|
|
dispatch,
|
|
virtualSpaces
|
|
}) => {
|
|
var _a, _b, _c, _d;
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const diagramRef = (0,_react_17_0_2_react.useRef)();
|
|
const [upname, setupname] = (0,_react_17_0_2_react.useState)(false);
|
|
const [buttonloading, setbuttonloading] = (0,_react_17_0_2_react.useState)(false);
|
|
const [additem, setadditem] = (0,_react_17_0_2_react.useState)(false);
|
|
const [addunit, setaddunit] = (0,_react_17_0_2_react.useState)(false);
|
|
const [ismind, setismind] = (0,_react_17_0_2_react.useState)(true);
|
|
const [sploading, setsploading] = (0,_react_17_0_2_react.useState)(false);
|
|
let [items, setitems] = (0,_react_17_0_2_react.useState)({});
|
|
const [form] = es_form["default"].useForm();
|
|
const [relation, setrelation] = (0,_react_17_0_2_react.useState)(false);
|
|
const [urldisabled, seturldisabled] = (0,_react_17_0_2_react.useState)(true);
|
|
const [describe, setdescribe] = (0,_react_17_0_2_react.useState)({
|
|
index: "",
|
|
name: "",
|
|
add: false
|
|
});
|
|
let [datas, setdatas] = (0,_react_17_0_2_react.useState)({});
|
|
const containerRef = (0,_react_17_0_2_react.useRef)(null);
|
|
const [IsFulls, setIsFull] = (0,_react_17_0_2_react.useState)(false);
|
|
const [exportshow, setexport] = (0,_react_17_0_2_react.useState)(false);
|
|
const [fileList, setFileList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [three, setthree] = (0,_react_17_0_2_react.useState)([]);
|
|
const [expandedKeys, setExpandedKeys] = (0,_react_17_0_2_react.useState)([]);
|
|
const [searchValue, setSearchValue] = (0,_react_17_0_2_react.useState)("");
|
|
const [autoExpandParent, setAutoExpandParent] = (0,_react_17_0_2_react.useState)(true);
|
|
const [AddModal, setAddModal] = (0,_react_17_0_2_react.useState)();
|
|
const [threelist, setthreelist] = (0,_react_17_0_2_react.useState)([]);
|
|
const [showadd, setshowadd] = (0,_react_17_0_2_react.useState)(false);
|
|
const [selectmodal, setselectmodal] = (0,_react_17_0_2_react.useState)(false);
|
|
const relationshipDiagramRef = (0,_react_17_0_2_react.useRef)();
|
|
const treeDiagramRef = (0,_react_17_0_2_react.useRef)();
|
|
const [disabled, setDisabled] = (0,_react_17_0_2_react.useState)(false);
|
|
const [bounds, setBounds] = (0,_react_17_0_2_react.useState)({ left: 0, top: 0, bottom: 0, right: 0 });
|
|
const draggleRef = (0,_react_17_0_2_react.useRef)(null);
|
|
const { virtualSpacesDetails } = virtualSpaces;
|
|
const permission = (virtualSpacesDetails == null ? void 0 : virtualSpacesDetails.is_member) || (0,authority/* isSuperAdmins */.Ny)();
|
|
const [threenodata, setThreenodata] = (0,_react_17_0_2_react.useState)(false);
|
|
const [isedit, setisedit] = (0,_react_17_0_2_react.useState)(false);
|
|
const [lishlist, setlishilist] = (0,_react_17_0_2_react.useState)([]);
|
|
const [hasMore, sethasMore] = (0,_react_17_0_2_react.useState)(false);
|
|
const [page, setpage] = (0,_react_17_0_2_react.useState)(1);
|
|
const [isshowlish, setisshowlish] = (0,_react_17_0_2_react.useState)(false);
|
|
const onStart = (_event, uiData) => {
|
|
var _a2;
|
|
const { clientWidth, clientHeight } = window.document.documentElement;
|
|
const targetRect = (_a2 = draggleRef.current) == null ? void 0 : _a2.getBoundingClientRect();
|
|
setBounds({
|
|
left: -targetRect.left + uiData.x,
|
|
right: clientWidth - (targetRect.right - uiData.x),
|
|
top: -targetRect.top + uiData.y,
|
|
bottom: clientHeight - (targetRect.bottom - uiData.y) - 70
|
|
});
|
|
};
|
|
let [widths, setwidths] = (0,_react_17_0_2_react.useState)(600);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
setdatas({});
|
|
getdatas();
|
|
}, [params, ismind]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
treeChart();
|
|
message/* default */.ZP.config({
|
|
getContainer: () => containerRef.current,
|
|
top: 100
|
|
});
|
|
}, []);
|
|
const treeChart = () => {
|
|
if (treeDiagramRef.current)
|
|
return;
|
|
const $ = go_module.GraphObject.make;
|
|
var myDiagram = new go_module.Diagram(
|
|
"myDiagramDiv",
|
|
{
|
|
// when the user drags a node, also move/copy/delete the whole subtree starting with that node
|
|
"commandHandler.copiesTree": false,
|
|
"commandHandler.copiesParentKey": false,
|
|
"commandHandler.deletesTree": false,
|
|
"draggingTool.dragsTree": false,
|
|
"undoManager.isEnabled": false,
|
|
"doubleClick": false
|
|
}
|
|
);
|
|
treeDiagramRef.current = myDiagram;
|
|
var layout = go_module.GraphObject.make(go_module.TreeLayout);
|
|
layout.angle = 0;
|
|
layout.arrangement = go_module.TreeLayout.ArrangementFixedRoots;
|
|
myDiagram.layout = layout;
|
|
myDiagram.nodeTemplate = $(
|
|
go_module.Node,
|
|
"Vertical",
|
|
{ selectionObjectName: "TEXT" },
|
|
$(
|
|
go_module.TextBlock,
|
|
{
|
|
name: "TEXT",
|
|
minSize: new go_module.Size(30, 15)
|
|
},
|
|
// remember not only the text string but the scale and the font in the node data
|
|
new go_module.Binding("text", "text").makeTwoWay(),
|
|
new go_module.Binding("scale", "scale").makeTwoWay(),
|
|
new go_module.Binding("font", "font").makeTwoWay()
|
|
),
|
|
$(
|
|
go_module.Shape,
|
|
"LineH",
|
|
{
|
|
stretch: go_module.GraphObject.Horizontal,
|
|
strokeWidth: 3,
|
|
height: 3,
|
|
// this line shape is the port -- what links connect with
|
|
portId: "",
|
|
fromSpot: go_module.Spot.LeftRightSides,
|
|
toSpot: go_module.Spot.LeftRightSides
|
|
},
|
|
new go_module.Binding("stroke", "brush"),
|
|
// make sure links come in from the proper direction and go out appropriately
|
|
new go_module.Binding("fromSpot", "dir", (d) => spotConverter(d, true)),
|
|
new go_module.Binding("toSpot", "dir", (d) => spotConverter(d, false))
|
|
),
|
|
// remember the locations of each node in the node data
|
|
new go_module.Binding("location", "loc", go_module.Point.parse).makeTwoWay(go_module.Point.stringify),
|
|
// make sure text "grows" in the desired direction
|
|
new go_module.Binding("locationSpot", "dir", (d) => spotConverter(d, false)),
|
|
{
|
|
click(e, thisObj) {
|
|
setisedit(false);
|
|
setitems(thisObj == null ? void 0 : thisObj.data);
|
|
setBounds({ left: 0, top: 0, bottom: 0, right: 0 });
|
|
}
|
|
}
|
|
);
|
|
myDiagram.allowDoubleClick = false;
|
|
myDiagram.allowSelect = "single";
|
|
myDiagram.commandHandler.canDeleteSelection = false;
|
|
myDiagram.commandHandler.canUndo = false;
|
|
const clickSelectingTool = myDiagram.toolManager.clickSelectingTool;
|
|
clickSelectingTool.canStartMulti = false;
|
|
myDiagram.linkTemplate = $(
|
|
go_module.Link,
|
|
{
|
|
curve: go_module.Link.Bezier,
|
|
fromShortLength: -2,
|
|
toShortLength: -2,
|
|
selectable: false
|
|
},
|
|
$(
|
|
go_module.Shape,
|
|
{ strokeWidth: 3 },
|
|
new go_module.Binding("stroke", "toNode", (n) => {
|
|
if (n.data.brush)
|
|
return n.data.brush;
|
|
return "black";
|
|
}).ofObject()
|
|
)
|
|
);
|
|
};
|
|
function layoutAll(myDiagram, id) {
|
|
var root = myDiagram.findNodeForKey(id);
|
|
if (root === null)
|
|
return;
|
|
myDiagram.startTransaction("Layout");
|
|
var rightward = new go_module.Set(
|
|
/*go.Part*/
|
|
);
|
|
var leftward = new go_module.Set(
|
|
/*go.Part*/
|
|
);
|
|
root.findLinksConnected().each((link) => {
|
|
var child = link.toNode;
|
|
if (child.data.dir === "left") {
|
|
leftward.add(root);
|
|
leftward.add(link);
|
|
leftward.addAll(child.findTreeParts());
|
|
} else {
|
|
rightward.add(root);
|
|
rightward.add(link);
|
|
rightward.addAll(child.findTreeParts());
|
|
}
|
|
});
|
|
layoutAngle(rightward, 0);
|
|
layoutAngle(leftward, 180);
|
|
myDiagram.commitTransaction("Layout");
|
|
}
|
|
function layoutAngle(parts, angle) {
|
|
var layout = go_module.GraphObject.make(
|
|
go_module.TreeLayout,
|
|
{
|
|
angle,
|
|
arrangement: go_module.TreeLayout.ArrangementFixedRoots,
|
|
nodeSpacing: 5,
|
|
layerSpacing: 20,
|
|
setsPortSpot: false,
|
|
// don't set port spots since we're managing them with our spotConverter function
|
|
setsChildPortSpot: false
|
|
}
|
|
);
|
|
layout.doLayout(parts);
|
|
}
|
|
function loadTreeChart(nodeData) {
|
|
var _a2;
|
|
const id = (_a2 = nodeData == null ? void 0 : nodeData[0]) == null ? void 0 : _a2.id;
|
|
let num = 0;
|
|
treeDiagramRef.current.model = go_module.Model.fromJson(JSON.stringify(
|
|
{
|
|
"class": "go.TreeModel",
|
|
"nodeDataArray": nodeData.map((item) => {
|
|
if (item.parent == id) {
|
|
if (num % 2 === 0) {
|
|
item.dir = "left";
|
|
} else {
|
|
item.dir = "right";
|
|
}
|
|
++num;
|
|
}
|
|
item.brush = item.unit_type === 0 ? "#3CDAA3" : [1, 2, 5, 6, 7, 8].includes(item.unit_type) ? "#F84F90" : item.unit_type === 3 ? "#30A7F1" : "#6656FF";
|
|
return item;
|
|
})
|
|
}
|
|
));
|
|
layoutAll(treeDiagramRef.current, id);
|
|
}
|
|
function getdatas() {
|
|
return __async(this, null, function* () {
|
|
var _a2, _b2;
|
|
let url = ismind ? `/api/knowledge_graphs/tree.json` : `/api/knowledge_graphs/map.json`;
|
|
let res = yield (0,fetch/* default */.ZP)(url, {
|
|
method: "get",
|
|
params: {
|
|
type: 2,
|
|
identifier: params.virtual_spacesId,
|
|
type: 2,
|
|
virtual_module_id: window.localStorage.getItem("vtrsModuleId")
|
|
}
|
|
});
|
|
if (res.status === 0) {
|
|
let ritems = (_a2 = res == null ? void 0 : res.nodeData) == null ? void 0 : _a2.map((item2, index) => {
|
|
return __spreadProps(__spreadValues({}, item2), {
|
|
bgcolor: item2.unit_type === 0 ? "#3CDAA3" : [1, 2, 5, 6, 7, 8].includes(item2.unit_type) ? "#F84F90" : item2.unit_type === 3 ? "#30A7F1" : "#6656FF",
|
|
parent: item2.parent_id
|
|
});
|
|
});
|
|
setdatas(__spreadProps(__spreadValues({}, res), { nodeData: ritems }));
|
|
if (ismind) {
|
|
loadTreeChart(ritems);
|
|
setTimeout(() => {
|
|
zoomToFit();
|
|
}, 300);
|
|
} else {
|
|
zoomToFit();
|
|
}
|
|
let item = (_b2 = res == null ? void 0 : res.nodeData) == null ? void 0 : _b2.filter((item2) => item2.id === items.id);
|
|
if ((item == null ? void 0 : item.length) > 0) {
|
|
setitems(__spreadValues({}, item == null ? void 0 : item[0]));
|
|
}
|
|
}
|
|
});
|
|
}
|
|
const Draggers = {
|
|
onRemove: () => {
|
|
setFileList([]);
|
|
},
|
|
beforeUpload: (file) => {
|
|
console.log(file);
|
|
if ((file == null ? void 0 : file.size) > 1024 * 1024 * 50) {
|
|
message/* default */.ZP.info("\u6587\u4EF6\u8D85\u8FC750M\uFF0C\u4E0D\u7B26\u5408\u4E0A\u4F20\u8981\u6C42");
|
|
return false;
|
|
}
|
|
let filelist = [];
|
|
filelist.push(file);
|
|
setFileList([...filelist]);
|
|
return false;
|
|
},
|
|
fileList,
|
|
accept: ".xls,.xlsx"
|
|
};
|
|
const treeData = (0,_react_17_0_2_react.useMemo)(() => {
|
|
const loop = (data) => data.map((item) => {
|
|
const strTitle = item.title;
|
|
const index = strTitle.indexOf(searchValue);
|
|
const beforeStr = strTitle.substring(0, index);
|
|
const afterStr = strTitle.slice(index + searchValue.length);
|
|
const title = index > -1 ? /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, beforeStr, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { color: "#f50" } }, searchValue), afterStr) : /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, strTitle);
|
|
if (item.children) {
|
|
return { title, key: item.key, children: loop(item.children) };
|
|
}
|
|
return {
|
|
title,
|
|
key: item.key
|
|
};
|
|
});
|
|
return loop(three);
|
|
}, [searchValue, three]);
|
|
function initDiagram() {
|
|
const $ = go_module.GraphObject.make;
|
|
const myDiagram = $(
|
|
go_module.Diagram,
|
|
{
|
|
allowSelect: false,
|
|
"undoManager.isEnabled": true,
|
|
// 'clickCreatingTool.archetypeNodeData': { text: 'new node', color: 'lightblue' },
|
|
initialAutoScale: go_module.Diagram.Uniform,
|
|
contentAlignment: go_module.Spot.Center,
|
|
layout: $(
|
|
ContinuousForceDirectedLayout,
|
|
{ defaultSpringLength: 30, defaultElectricalCharge: 100 }
|
|
),
|
|
"SelectionMoved": (e) => e.diagram.layout.invalidateLayout(),
|
|
model: $(
|
|
go_module.GraphLinksModel,
|
|
{
|
|
linkKeyProperty: "key",
|
|
makeUniqueKeyFunction: (m, data) => {
|
|
let k = data.key || 1;
|
|
while (m.findNodeDataForKey(k))
|
|
k++;
|
|
data.key = k;
|
|
return k;
|
|
},
|
|
makeUniqueLinkKeyFunction: (m, data) => {
|
|
let k = data.key || -1;
|
|
while (m.findLinkDataForKey(k))
|
|
k--;
|
|
data.key = k;
|
|
return k;
|
|
}
|
|
}
|
|
)
|
|
}
|
|
);
|
|
myDiagram.toolManager.draggingTool.doMouseMove = function() {
|
|
go_module.DraggingTool.prototype.doMouseMove.call(this);
|
|
if (this.isActive)
|
|
this.diagram.layout.doLayout(true);
|
|
};
|
|
myDiagram.nodeTemplate = $(
|
|
go_module.Node,
|
|
"Auto",
|
|
{ minSize: new go_module.Size(100, 100) },
|
|
$(
|
|
go_module.Shape,
|
|
"Circle",
|
|
{ stroke: "white", spot1: new go_module.Spot(0, 0, 5, 5), spot2: new go_module.Spot(1, 1, -5, -5) },
|
|
new go_module.Binding("fill", "bgcolor")
|
|
),
|
|
$(
|
|
go_module.TextBlock,
|
|
{ font: "bold 10pt helvetica, bold arial, sans-serif", stroke: "white", textAlign: "center", maxSize: new go_module.Size(100, NaN) },
|
|
new go_module.Binding("text", "text")
|
|
),
|
|
{
|
|
click(e, thisObj) {
|
|
setisedit(false);
|
|
setitems(thisObj == null ? void 0 : thisObj.data);
|
|
setBounds({ left: 0, top: 0, bottom: 0, right: 0 });
|
|
}
|
|
}
|
|
);
|
|
myDiagram.linkTemplate = $(
|
|
go_module.Link,
|
|
// the whole link panel
|
|
{ layerName: "Background" },
|
|
$(
|
|
go_module.Shape,
|
|
// the link shape
|
|
{ stroke: "black" }
|
|
),
|
|
$(
|
|
go_module.Shape,
|
|
// the arrowhead
|
|
{ toArrow: "standard", stroke: null }
|
|
),
|
|
$(
|
|
go_module.Panel,
|
|
"Auto",
|
|
$(
|
|
go_module.Shape,
|
|
{
|
|
fill: $(go_module.Brush, "Radial", { 0: "rgb(240, 240, 240)", 0.3: "rgb(240, 240, 240)", 1: "rgba(240, 240, 240, 0)" }),
|
|
stroke: null
|
|
}
|
|
),
|
|
$(
|
|
go_module.TextBlock,
|
|
// the label text
|
|
{
|
|
textAlign: "center",
|
|
font: "10pt helvetica, arial, sans-serif",
|
|
stroke: "#555555",
|
|
margin: 4
|
|
},
|
|
new go_module.Binding("text", "text")
|
|
)
|
|
)
|
|
);
|
|
myDiagram.doubleClick = false;
|
|
myDiagram.allowDoubleClick = false;
|
|
myDiagram.allowSelect = "single";
|
|
myDiagram.commandHandler.canDeleteSelection = false;
|
|
myDiagram.commandHandler.canUndo = false;
|
|
myDiagram.allowInsert = false;
|
|
const clickSelectingTool = myDiagram.toolManager.clickSelectingTool;
|
|
clickSelectingTool.canStartMulti = false;
|
|
relationshipDiagramRef.current = myDiagram;
|
|
return myDiagram;
|
|
}
|
|
function spotConverter(dir, from) {
|
|
if (dir === "left") {
|
|
return from ? go_module.Spot.Left : go_module.Spot.Right;
|
|
} else {
|
|
return from ? go_module.Spot.Right : go_module.Spot.Left;
|
|
}
|
|
}
|
|
function zoomToFit() {
|
|
var _a2, _b2, _c2, _d2;
|
|
setwidths(600);
|
|
(_b2 = (_a2 = treeDiagramRef.current) == null ? void 0 : _a2.zoomToFit) == null ? void 0 : _b2.call(_a2);
|
|
(_d2 = (_c2 = relationshipDiagramRef.current) == null ? void 0 : _c2.zoomToFit) == null ? void 0 : _d2.call(_c2);
|
|
}
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
ref: containerRef,
|
|
style: { paddingBottom: 20, background: "#FFF", position: "relative", height: "100vh" }
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { spinning: sploading }, (datas == null ? void 0 : datas.is_root) && /* @__PURE__ */ _react_17_0_2_react.createElement(NoData/* default */.Z, { ButtonClick: () => __async(void 0, null, function* () {
|
|
setsploading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/set_root.json`, {
|
|
method: "post",
|
|
body: {
|
|
type: 2,
|
|
identifier: params.virtual_spacesId,
|
|
virtual_module_id: window.localStorage.getItem("vtrsModuleId")
|
|
}
|
|
});
|
|
setsploading(false);
|
|
if (res.status === 0) {
|
|
getdatas();
|
|
}
|
|
}), buttonProps: { type: "primary" }, ButtonText: permission && "\u65B0\u589E\u8282\u70B9", ButtonTwo: permission && /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { style: { marginLeft: 20 }, onClick: () => {
|
|
setexport(true);
|
|
}, type: "primary" }, "\u6587\u4EF6\u5BFC\u5165"), styles: { margin: "auto", paddingTop: 100 } }), !(datas == null ? void 0 : datas.is_root) && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { height: 60, border: "1px solid #e7e7e7", display: "flex" } }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => {
|
|
setismind(true);
|
|
setitems({});
|
|
}, className: ismind ? knowledgemodules.headeractivite : knowledgemodules.header }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-zhishishu" })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u77E5\u8BC6\u6811")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => {
|
|
setismind(false);
|
|
setitems({});
|
|
}, className: ismind ? knowledgemodules.header : knowledgemodules.headeractivite }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-guanxitu" })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u5173\u7CFB\u56FE")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => {
|
|
var _a2, _b2, _c2, _d2;
|
|
var viewportWidth = ismind ? treeDiagramRef.current.viewportBounds.width : relationshipDiagramRef.current.viewportBounds.width;
|
|
var viewportHeight = ismind ? treeDiagramRef.current.viewportBounds.height : relationshipDiagramRef.current.viewportBounds.height;
|
|
(_b2 = (_a2 = treeDiagramRef.current) == null ? void 0 : _a2.zoomToRect) == null ? void 0 : _b2.call(_a2, new go_module.Rect(1, 1, viewportWidth / 1.1, viewportHeight / 1.1));
|
|
(_d2 = (_c2 = relationshipDiagramRef.current) == null ? void 0 : _c2.zoomToRect) == null ? void 0 : _d2.call(_c2, new go_module.Rect(1, 1, viewportWidth / 1.1, viewportHeight / 1.1));
|
|
}, className: knowledgemodules.header }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-fangda3" })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u653E\u5927")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => {
|
|
var _a2, _b2, _c2, _d2;
|
|
var viewportWidth = ismind ? treeDiagramRef.current.viewportBounds.width : relationshipDiagramRef.current.viewportBounds.width;
|
|
var viewportHeight = ismind ? treeDiagramRef.current.viewportBounds.height : relationshipDiagramRef.current.viewportBounds.height;
|
|
(_b2 = (_a2 = treeDiagramRef.current) == null ? void 0 : _a2.zoomToRect) == null ? void 0 : _b2.call(_a2, new go_module.Rect(1, 1, viewportWidth * 1.1, viewportHeight * 1.1));
|
|
(_d2 = (_c2 = relationshipDiagramRef.current) == null ? void 0 : _c2.zoomToRect) == null ? void 0 : _d2.call(_c2, new go_module.Rect(1, 1, viewportWidth * 1.1, viewportHeight * 1.1));
|
|
}, className: knowledgemodules.header }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-suoxiao3" })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u7F29\u5C0F")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => {
|
|
var _a2, _b2, _c2, _d2;
|
|
setwidths(600);
|
|
(_b2 = (_a2 = treeDiagramRef.current) == null ? void 0 : _a2.zoomToFit) == null ? void 0 : _b2.call(_a2);
|
|
(_d2 = (_c2 = relationshipDiagramRef.current) == null ? void 0 : _c2.zoomToFit) == null ? void 0 : _d2.call(_c2);
|
|
}, className: knowledgemodules.header }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-zishiying" })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u6700\u4F73\u9002\u5E94")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => __async(void 0, null, function* () {
|
|
var _a2;
|
|
setselectmodal(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs.json`, {
|
|
method: "get",
|
|
params: {
|
|
type: 2,
|
|
identifier: params.virtual_spacesId
|
|
}
|
|
});
|
|
if (res.status === 0) {
|
|
setthreelist(res == null ? void 0 : res.list);
|
|
setthree(res == null ? void 0 : res.knowledge_graphs);
|
|
setExpandedKeys((_a2 = res == null ? void 0 : res.list) == null ? void 0 : _a2.map((item) => item.key));
|
|
}
|
|
}), className: knowledgemodules.header }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-chazhao" })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u67E5\u627E")), permission && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => {
|
|
setexport(true);
|
|
}, className: knowledgemodules.header }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-daoru" })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u5BFC\u5165")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { flex: 1, textAlign: "end", lineHeight: "60px" } }, permission && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u5386\u53F2\u8BB0\u5F55" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-lishijilu ${knowledgemodules.ehover}`, onClick: () => __async(void 0, null, function* () {
|
|
var _a2;
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/history.json`, {
|
|
method: "get",
|
|
params: {
|
|
identifier: params.virtual_spacesId,
|
|
limit: 10,
|
|
type: 2,
|
|
page
|
|
}
|
|
});
|
|
if (res.status === 0) {
|
|
setisshowlish(true);
|
|
if (((_a2 = res == null ? void 0 : res.histories) == null ? void 0 : _a2.length) < 10)
|
|
sethasMore(false);
|
|
setlishilist(res == null ? void 0 : res.histories);
|
|
}
|
|
}), style: { marginRight: 30 } })), permission && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
tooltip/* default */.Z,
|
|
{
|
|
title: "\u6E05\u7A7A\u6240\u6709\u6570\u636E",
|
|
getPopupContainer: () => containerRef.current
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("i", { onClick: () => {
|
|
modal["default"].confirm({
|
|
title: "\u63D0\u793A",
|
|
icon: null,
|
|
centered: true,
|
|
getContainer: () => containerRef.current,
|
|
content: "\u8BF7\u786E\u5B9A\u662F\u5426\u5C06\u77E5\u8BC6\u56FE\u8C31\u6240\u6709\u7684\u6570\u636E\u6E05\u7A7A\uFF0C\u6062\u590D\u7A7A\u72B6\u6001\uFF0C\u6E05\u7A7A\u540E\u6570\u636E\u4E0D\u53EF\u6062\u590D\uFF01\u672C\u6B21\u6E05\u7A7A\u4E0D\u4F1A\u5F71\u54CD\u5230\u8BFE\u7A0B\u7AE0\u8282\u5185\u5BB9\uFF0C\u4EC5\u4F5C\u7528\u4E8E\u77E5\u8BC6\u56FE\u8C31\u7684\u6570\u636E\u3002",
|
|
onOk: () => __async(void 0, null, function* () {
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/delete_all.json`, {
|
|
method: "DELETE",
|
|
body: {
|
|
type: 2,
|
|
identifier: params.virtual_spacesId,
|
|
virtual_module_id: window.localStorage.getItem("vtrsModuleId")
|
|
}
|
|
});
|
|
if (res.status === 0) {
|
|
getdatas();
|
|
setitems({});
|
|
}
|
|
})
|
|
});
|
|
}, className: `iconfont icon-shanchu14 ${knowledgemodules.dhover}` })
|
|
), permission && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
tooltip/* default */.Z,
|
|
{
|
|
title: "\u540C\u6B65\u8BFE\u7A0B\u77E5\u8BC6\u7ED3\u6784",
|
|
getPopupContainer: () => containerRef.current
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("i", { onClick: () => {
|
|
modal["default"].confirm({
|
|
title: "\u63D0\u793A",
|
|
icon: null,
|
|
centered: true,
|
|
getContainer: () => containerRef.current,
|
|
content: "\u8BF7\u786E\u5B9A\u662F\u5426\u5C06\u540C\u6B65\u8BFE\u7A0B\u77E5\u8BC6\u7ED3\u6784\uFF0C\u66F4\u65B0\u540E\u539F\u6709\u77E5\u8BC6\u7ED3\u6784\u5C06\u88AB\u8986\u76D6\uFF0C\u8986\u76D6\u540E\u4E0D\u53EF\u64A4\u9500\u6062\u590D\u3002",
|
|
onOk: () => __async(void 0, null, function* () {
|
|
setsploading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/sync.json`, {
|
|
method: "post",
|
|
body: {
|
|
identifier: params.pathId,
|
|
type: 2
|
|
}
|
|
});
|
|
setsploading(false);
|
|
if (res.status === 0) {
|
|
getdatas();
|
|
}
|
|
})
|
|
});
|
|
}, style: { margin: "0px 30px" }, className: `iconfont icon-jiazai_shuaxin_o ${knowledgemodules.ehover}` })
|
|
), permission && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
dropdown/* default */.Z,
|
|
{
|
|
getPopupContainer: () => containerRef.current,
|
|
menu: {
|
|
items: [
|
|
{
|
|
key: "1",
|
|
style: { width: 100 },
|
|
label: /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"a",
|
|
{
|
|
href: `${env/* default */.Z.API_SERVER}/api/knowledge_graphs/export.xlsx?identifier=${params.virtual_spacesId}&type=2`
|
|
},
|
|
"\u5BFC\u51FAExcel"
|
|
)
|
|
},
|
|
{
|
|
key: "2",
|
|
label: /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"a",
|
|
{
|
|
href: `${env/* default */.Z.API_SERVER}/api/knowledge_graphs/export.json?identifier=${params.virtual_spacesId}&type=2`
|
|
},
|
|
"\u5BFC\u51FAWord"
|
|
)
|
|
}
|
|
]
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-xiazai6 ${knowledgemodules.ehover}` })
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("i", { onClick: () => {
|
|
if ((0,fullscreen/* IsFull */.vp)()) {
|
|
setIsFull(false);
|
|
(0,fullscreen/* exitFull */.BU)();
|
|
} else {
|
|
setIsFull(true);
|
|
(0,fullscreen/* requestFullScreen */.Dj)(containerRef.current);
|
|
}
|
|
zoomToFit();
|
|
}, style: { marginLeft: 30, marginRight: 20 }, className: `iconfont ${IsFulls ? "icon-tuichuquanping3" : "icon-quanping4"} ${knowledgemodules.ehover}` }))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "relative" }, !ismind && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
gojsreact/* ReactDiagram */.FI,
|
|
{
|
|
ref: diagramRef,
|
|
divClassName: "diagram-component",
|
|
style: { backgroundColor: "#fff", height: IsFulls ? "calc(100vh - 100px)" : 540, visibility: (datas == null ? void 0 : datas.is_root) ? "hidden" : "visible" },
|
|
initDiagram,
|
|
nodeDataArray: datas == null ? void 0 : datas.nodeData,
|
|
linkDataArray: datas == null ? void 0 : datas.linkData
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { id: "myDiagramDiv", style: { height: IsFulls ? "calc(100vh - 100px)" : 540, width: "100%", visibility: (datas == null ? void 0 : datas.is_root) ? "hidden" : ismind ? "visible" : "hidden", position: ismind ? "relative" : "absolute" } })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, !(datas == null ? void 0 : datas.is_root) && textcolor.map((item, index) => /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { marginLeft: index === 0 && 20, marginRight: 30 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { marginRight: 6, width: 16, height: 8, background: colors[index], display: "inline-flex", borderRadius: 4 } }), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { color: "#9096A3" } }, item))))),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { zIndex: 1e3 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
(cjs_default()),
|
|
{
|
|
disabled,
|
|
bounds,
|
|
onStart: (event, uiData) => onStart(event, uiData)
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { ref: draggleRef, style: { position: "fixed", cursor: "move", right: IsFulls ? 0 : 0, top: IsFulls ? 60 : 260, zIndex: 12 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
onMouseOver: () => {
|
|
if (disabled) {
|
|
if (!urldisabled) {
|
|
setDisabled(true);
|
|
} else {
|
|
setDisabled(false);
|
|
}
|
|
}
|
|
},
|
|
onMouseOut: () => {
|
|
setDisabled(true);
|
|
}
|
|
},
|
|
items.id && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.rightmodal }, /* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { spinning: sploading }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { display: "flex", padding: 25, paddingBottom: 0 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.title }, items.text, " ", isedit && /* @__PURE__ */ _react_17_0_2_react.createElement("i", { onClick: () => {
|
|
setupname(true);
|
|
form.setFieldsValue({
|
|
name: items.text
|
|
});
|
|
}, className: "iconfont icon-bianji3", style: { marginLeft: 14, color: "#666666", cursor: "pointer" } })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { style: { cursor: "pointer" }, onClick: () => {
|
|
var _a2, _b2;
|
|
if (isedit) {
|
|
setisedit(false);
|
|
return;
|
|
}
|
|
setitems({});
|
|
(_a2 = treeDiagramRef.current) == null ? void 0 : _a2.clearSelection();
|
|
(_b2 = relationshipDiagramRef.current) == null ? void 0 : _b2.clearSelection();
|
|
}, className: "iconfont icon-danchuangguanbi" }))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { maxHeight: 580, overflow: "auto", padding: 25, paddingTop: 0 } }, isedit && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginTop: 25 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.button, onClick: () => {
|
|
if (items.unit_type >= 4 || items.unit_type === 0) {
|
|
if (items.unit_type === 0) {
|
|
message/* default */.ZP.info("\u6839\u8282\u70B9\u6682\u4E0D\u652F\u6301\u63D2\u5165\u77E5\u8BC6\u70B9");
|
|
} else {
|
|
message/* default */.ZP.info("\u77E5\u8BC6\u70B9\u4E3A\u6700\u5C0F\u5355\u4F4D\u6682\u4E0D\u652F\u6301\u63D2\u5165\u77E5\u8BC6\u70B9");
|
|
}
|
|
return;
|
|
}
|
|
form.setFieldsValue({
|
|
name: ""
|
|
});
|
|
setadditem(true);
|
|
} }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { style: { marginRight: 8 }, className: "iconfont icon-charuzhishidian1" }), " \u63D2\u5165\u77E5\u8BC6\u70B9"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.button, onClick: () => {
|
|
if (items.unit_type >= 4) {
|
|
message/* default */.ZP.info("\u77E5\u8BC6\u70B9\u4E3A\u6700\u5C0F\u5355\u4F4D\u6682\u4E0D\u652F\u6301\u63D2\u5165\u77E5\u8BC6\u5355\u5143");
|
|
return;
|
|
}
|
|
form.setFieldsValue({
|
|
name: "",
|
|
unit_type: 3,
|
|
url: ""
|
|
});
|
|
setaddunit(true);
|
|
} }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { style: { marginRight: 8 }, className: "iconfont icon-charuzhishidanyuan" }), " \u63D2\u5165\u77E5\u8BC6\u5355\u5143"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.button, onClick: () => {
|
|
modal["default"].confirm({
|
|
icon: null,
|
|
title: "\u63D0\u793A",
|
|
centered: true,
|
|
getContainer: () => containerRef.current,
|
|
content: "\u5220\u9664\u8BE5\u8282\u70B9\u4F1A\u5BFC\u81F4\u5B83\u7684\u5B50\u8282\u70B9\u4E00\u5E76\u5220\u9664\uFF0C\u5220\u9664\u8282\u70B9\u4E0D\u4F1A\u5F71\u54CD\u5230\u8BFE\u7A0B\u7AE0\u8282\u5185\u5BB9\uFF0C\u5220\u9664\u540E\uFF0C\u6570\u636E\u4E0D\u53EF\u6062\u590D\u8BF7\u786E\u8BA4\u662F\u5426\u5220\u9664",
|
|
onOk: () => __async(void 0, null, function* () {
|
|
setsploading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/${items.id}.json`, {
|
|
method: "DELETE"
|
|
});
|
|
setsploading(false);
|
|
if ((res == null ? void 0 : res.status) === 0) {
|
|
setitems({});
|
|
getdatas();
|
|
}
|
|
})
|
|
});
|
|
} }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { style: { marginRight: 8 }, className: "iconfont icon-shanchujiedian" }), " \u5220\u9664\u8282\u70B9"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.button, onClick: () => __async(void 0, null, function* () {
|
|
var _a2;
|
|
setrelation(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs.json`, {
|
|
method: "get",
|
|
params: {
|
|
identifier: params.pathId,
|
|
type: 2
|
|
}
|
|
});
|
|
if (res.status === 0) {
|
|
setthreelist(res == null ? void 0 : res.list);
|
|
setthree(res == null ? void 0 : res.knowledge_graphs);
|
|
setExpandedKeys((_a2 = res == null ? void 0 : res.list) == null ? void 0 : _a2.map((item) => item.key));
|
|
}
|
|
}) }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { style: { marginRight: 8 }, className: "iconfont icon-guanxi" }), " \u5173\u7CFB")), isedit && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginTop: 20 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.linetitles }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.line }), "\u5C5E\u6027"), items.unit_type != 4 && items.unit_type > 0 && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { paddingLeft: 8 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("label", { className: knowledgemodules.lebels }, "\u7C7B\u578B"), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_select["default"],
|
|
{
|
|
size: "large",
|
|
getPopupContainer: () => containerRef.current,
|
|
style: { width: "100%", marginTop: 6 },
|
|
value: items.unit_type,
|
|
onChange: (e) => __async(void 0, null, function* () {
|
|
items.unit_type = e;
|
|
setitems(__spreadValues({}, items));
|
|
setsploading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/${items.id}.json`, {
|
|
method: "put",
|
|
body: {
|
|
unit_type: e
|
|
}
|
|
});
|
|
setsploading(false);
|
|
if (res.status === 0) {
|
|
setupname(false);
|
|
getdatas();
|
|
}
|
|
}),
|
|
placeholder: "\u8BF7\u9009\u62E9\u7C7B\u578B"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 1 }, "\u8BFE\u4EF6"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 3 }, "\u6587\u672C"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 2 }, "\u5B9E\u8BAD"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 5 }, "\u8003\u8BD5"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 6 }, "\u4F5C\u4E1A"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 7 }, "\u7EC3\u4E60"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 8 }, "\u89C6\u9891")
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { paddingLeft: 8, marginTop: 15 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("label", { className: knowledgemodules.lebels, style: { display: "flex" } }, "\u8DF3\u8F6C\u5730\u5740"), /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { size: "large", value: items.url, onChange: (e) => {
|
|
items.url = e.target.value;
|
|
setitems(__spreadValues({}, items));
|
|
}, disabled: urldisabled, onBlur: (e) => __async(void 0, null, function* () {
|
|
setDisabled(false);
|
|
if (e.target.value) {
|
|
var reg = new RegExp(/^(https?:\/\/)?([\w.-]+)\.([a-z]{2,})(\/\S*)?$/, "i");
|
|
if (!reg.test(e.target.value)) {
|
|
message/* default */.ZP.info("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u8DF3\u8F6C\u5730\u5740");
|
|
return;
|
|
}
|
|
}
|
|
setsploading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/${items.id}.json`, {
|
|
method: "put",
|
|
body: {
|
|
url: e.target.value
|
|
}
|
|
});
|
|
setsploading(false);
|
|
seturldisabled(true);
|
|
if (res.status === 0) {
|
|
setupname(false);
|
|
getdatas();
|
|
}
|
|
}), style: { width: "81%", marginTop: 6 } }), /* @__PURE__ */ _react_17_0_2_react.createElement("i", { onClick: () => {
|
|
seturldisabled(false);
|
|
}, className: "iconfont icon-bianji3", style: { marginLeft: 12, marginRight: 20, color: "#666666", cursor: "pointer" } }), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.button, style: { marginRight: 0 }, onClick: () => {
|
|
if (!items.url) {
|
|
message/* default */.ZP.info("\u94FE\u63A5\u4E0D\u80FD\u4E3A\u7A7A");
|
|
return;
|
|
}
|
|
window.open(items.url);
|
|
} }, "\u8DF3\u8F6C"))), isedit && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginTop: 20 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.linetitles }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.line }), "\u5173\u7CFB"), (_a = items == null ? void 0 : items.relations) == null ? void 0 : _a.map((item, index) => /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { display: "flex", paddingLeft: 8 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.multi_ellipsis1 }, "\u4E0E\u8282\u70B9\u201C", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { fontWeight: 600, color: "#000000" } }, item.name), "\u201D\u4E3A", item.relation, "\u5173\u7CFB"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { width: "10%", textAlign: "end" } }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { onClick: () => {
|
|
modal["default"].confirm({
|
|
icon: null,
|
|
title: "\u63D0\u793A",
|
|
getContainer: () => containerRef.current,
|
|
centered: true,
|
|
content: "\u8BF7\u786E\u8BA4\u662F\u5426\u5C06\u8282\u70B9\u4E4B\u95F4\u7684\u5173\u7CFB\u89E3\u7ED1",
|
|
onOk: () => __async(void 0, null, function* () {
|
|
var _a2;
|
|
setsploading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/${items == null ? void 0 : items.id}/delete_relation.json`, {
|
|
method: "POST",
|
|
body: {
|
|
relation_id: item.relation_id
|
|
}
|
|
});
|
|
setsploading(false);
|
|
if (res.status === 0) {
|
|
(_a2 = items.relations) == null ? void 0 : _a2.splice(index, 1);
|
|
setitems(__spreadValues({}, items));
|
|
getdatas();
|
|
}
|
|
})
|
|
});
|
|
}, className: `${knowledgemodules.dhover} iconfont icon-shanchu10` }))))), !isedit && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginTop: 20 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.linetitles }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.line }), "\u5B66\u4E60\u8D44\u6E90"), (_b = items == null ? void 0 : items.sub_knowledge_graphs) == null ? void 0 : _b.map((item, index) => {
|
|
var _a2, _b2;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.a, onClick: () => {
|
|
window.open(item == null ? void 0 : item.url);
|
|
}, style: { display: "flex", paddingLeft: 8, alignItems: "center", cursor: "pointer" } }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-lianjie2", style: { marginRight: 10, fontSize: 12 } }), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `${knowledgemodules.multi_ellipsis1} ${knowledgemodules.a}`, style: { fontWeight: 600, marginTop: 0, width: "90%", display: "inline-flex" } }, " \u3010", ((_b2 = (_a2 = types == null ? void 0 : types.filter((val) => item.type === val.type)) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.name) || "\u6587\u672C", "\u3011 ", item.name, " "), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u67E5\u770B"));
|
|
})), !isedit && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginTop: 20 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.linetitles }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.line }), "\u5B58\u5728\u5173\u7CFB\u7684\u77E5\u8BC6\u8282\u70B9"), (_c = items == null ? void 0 : items.relations) == null ? void 0 : _c.map((item, index) => /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.a, onClick: () => {
|
|
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
(_a2 = treeDiagramRef.current) == null ? void 0 : _a2.clearSelection();
|
|
(_b2 = relationshipDiagramRef.current) == null ? void 0 : _b2.clearSelection();
|
|
const node = (_d2 = (_c2 = relationshipDiagramRef.current) == null ? void 0 : _c2.findNodeForKey) == null ? void 0 : _d2.call(_c2, item == null ? void 0 : item.relation_id);
|
|
const node2 = (_f = (_e = treeDiagramRef.current) == null ? void 0 : _e.findNodeForKey) == null ? void 0 : _f.call(_e, item == null ? void 0 : item.relation_id);
|
|
(_h = (_g = treeDiagramRef.current) == null ? void 0 : _g.commandHandler) == null ? void 0 : _h.scrollToPart(node2);
|
|
(_j = (_i = relationshipDiagramRef.current) == null ? void 0 : _i.commandHandler) == null ? void 0 : _j.scrollToPart(node);
|
|
if (node) {
|
|
node.isSelected = true;
|
|
}
|
|
if (node2) {
|
|
node2.isSelected = true;
|
|
}
|
|
let listitems = (_l = (_k = datas == null ? void 0 : datas.nodeData) == null ? void 0 : _k.filter((val) => (val == null ? void 0 : val.id) === (item == null ? void 0 : item.relation_id))) == null ? void 0 : _l[0];
|
|
setitems(__spreadValues({}, listitems));
|
|
}, style: { display: "flex", paddingLeft: 8, cursor: "pointer" } }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.multi_ellipsis1 }, "\u3010", item.relation, "\u3011", item.name)))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginTop: 20 } }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.linetitles }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: knowledgemodules.line }), "\u63CF\u8FF0", /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { flex: 1, textAlign: "end" } }, isedit && /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => {
|
|
setdescribe({
|
|
add: true,
|
|
name: ""
|
|
});
|
|
form.setFieldsValue({
|
|
describe: ""
|
|
});
|
|
}, className: knowledgemodules.additem }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { style: { fontSize: 12 }, className: "iconfont icon-tianjiashitixiaojiahao" }), " \u6DFB\u52A0"))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { height: 200, overflow: "auto" } }, (_d = items.descriptions) == null ? void 0 : _d.map((item, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.describe }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: knowledgemodules.describetitle }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { fontSize: 14, color: "#000000", fontWeight: 500 } }, "\u63CF\u8FF0", index + 1), isedit && /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { onClick: () => {
|
|
setdescribe({
|
|
index,
|
|
name: item
|
|
});
|
|
form.setFieldsValue({
|
|
describe: item
|
|
});
|
|
}, style: { marginRight: 10 }, className: `iconfont icon-bianji-moren ${knowledgemodules.ehover}` }), /* @__PURE__ */ _react_17_0_2_react.createElement("i", { onClick: () => {
|
|
modal["default"].confirm({
|
|
icon: null,
|
|
title: "\u63D0\u793A",
|
|
getContainer: () => containerRef.current,
|
|
centered: true,
|
|
content: "\u5220\u9664\u63CF\u8FF0\u540E\uFF0C\u6570\u636E\u4E0D\u53EF\u6062\u590D\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5220\u9664",
|
|
onOk: () => __async(void 0, null, function* () {
|
|
var _a2;
|
|
(_a2 = items.descriptions) == null ? void 0 : _a2.splice(index, 1);
|
|
setitems(__spreadValues({}, items));
|
|
setsploading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/${items.id}.json`, {
|
|
method: "put",
|
|
body: {
|
|
descriptions: items.descriptions
|
|
}
|
|
});
|
|
setsploading(false);
|
|
if (res.status === 0) {
|
|
setupname(false);
|
|
getdatas();
|
|
}
|
|
})
|
|
});
|
|
}, className: `iconfont icon-shanchutimu ${knowledgemodules.dhover}` }))), /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: item || "" }));
|
|
})), !isedit && permission && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { textAlign: "center", marginTop: 10 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "primary", style: { width: 120 }, onClick: () => {
|
|
setisedit(true);
|
|
} }, "\u7F16\u8F91"))))))
|
|
))
|
|
)),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
open: upname,
|
|
centered: true,
|
|
title: "\u7F16\u8F91",
|
|
getContainer: () => containerRef.current,
|
|
onCancel: () => setupname(false),
|
|
okButtonProps: {
|
|
loading: buttonloading
|
|
},
|
|
onOk: () => {
|
|
form.submit();
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
size: "large",
|
|
form,
|
|
onFinish: (values) => __async(void 0, null, function* () {
|
|
setbuttonloading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/${items.id}.json`, {
|
|
method: "put",
|
|
body: {
|
|
type: 2,
|
|
name: values.name
|
|
}
|
|
});
|
|
setbuttonloading(false);
|
|
if (res.status === 0) {
|
|
if (ismind) {
|
|
items.text = values.name;
|
|
setitems(items);
|
|
} else {
|
|
}
|
|
setupname(false);
|
|
message/* default */.ZP.info("\u4FEE\u6539\u6210\u529F");
|
|
getdatas();
|
|
}
|
|
})
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "name",
|
|
label: "\u540D\u79F0",
|
|
rules: [
|
|
{
|
|
required: true,
|
|
validator: (_, value) => {
|
|
var _a2;
|
|
return ((_a2 = value == null ? void 0 : value.replaceAll(" ", "")) == null ? void 0 : _a2.length) > 0 ? Promise.resolve() : Promise.reject("\u8BF7\u8F93\u5165\u540D\u79F0");
|
|
}
|
|
}
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { maxLength: 30 })
|
|
)
|
|
)
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
open: additem,
|
|
centered: true,
|
|
title: "\u63D2\u5165\u77E5\u8BC6\u70B9",
|
|
getContainer: () => containerRef.current,
|
|
onCancel: () => setadditem(false),
|
|
okButtonProps: {
|
|
loading: buttonloading
|
|
},
|
|
onOk: () => {
|
|
form.submit();
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
size: "large",
|
|
form,
|
|
onFinish: (value) => __async(void 0, null, function* () {
|
|
setbuttonloading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs.json`, {
|
|
method: "post",
|
|
body: __spreadProps(__spreadValues({}, value), {
|
|
unit_type: 4,
|
|
type: 2,
|
|
identifier: params.virtual_spacesId,
|
|
parent_id: items.id,
|
|
virtual_module_id: window.localStorage.getItem("vtrsModuleId")
|
|
})
|
|
});
|
|
setbuttonloading(false);
|
|
if (res.status === 0) {
|
|
setadditem(false);
|
|
getdatas();
|
|
message/* default */.ZP.info("\u63D2\u5165\u77E5\u8BC6\u70B9\u6210\u529F");
|
|
}
|
|
})
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "name",
|
|
label: "\u77E5\u8BC6\u70B9\u540D\u79F0",
|
|
rules: [
|
|
{
|
|
required: true,
|
|
validator: (_, value) => {
|
|
var _a2;
|
|
return ((_a2 = value == null ? void 0 : value.replaceAll(" ", "")) == null ? void 0 : _a2.length) > 0 ? Promise.resolve() : Promise.reject("\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9\u540D\u79F0");
|
|
}
|
|
}
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { maxLength: 20 })
|
|
)
|
|
)
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
open: addunit,
|
|
centered: true,
|
|
width: 550,
|
|
title: "\u63D2\u5165\u77E5\u8BC6\u5355\u5143",
|
|
getContainer: () => containerRef.current,
|
|
onCancel: () => setaddunit(false),
|
|
okButtonProps: {
|
|
loading: buttonloading
|
|
},
|
|
onOk: () => {
|
|
form.submit();
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
size: "large",
|
|
form,
|
|
labelCol: { span: 5 },
|
|
onFinish: (value) => __async(void 0, null, function* () {
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs.json`, {
|
|
method: "post",
|
|
body: __spreadProps(__spreadValues({}, value), {
|
|
type: 2,
|
|
identifier: params.virtual_spacesId,
|
|
parent_id: items.id,
|
|
virtual_module_id: window.localStorage.getItem("vtrsModuleId")
|
|
})
|
|
});
|
|
setbuttonloading(false);
|
|
if (res.status === 0) {
|
|
setaddunit(false);
|
|
getdatas();
|
|
message/* default */.ZP.info("\u63D2\u5165\u77E5\u8BC6\u5355\u5143\u6210\u529F");
|
|
}
|
|
})
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "name",
|
|
label: "\u77E5\u8BC6\u5355\u5143\u540D\u79F0",
|
|
rules: [
|
|
{
|
|
required: true,
|
|
validator: (_, value) => {
|
|
var _a2;
|
|
return ((_a2 = value == null ? void 0 : value.replaceAll(" ", "")) == null ? void 0 : _a2.length) > 0 ? Promise.resolve() : Promise.reject("\u8BF7\u8F93\u5165\u77E5\u8BC6\u5355\u5143\u540D\u79F0");
|
|
}
|
|
}
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { placeholder: "\u8BF7\u8F93\u5165\u77E5\u8BC6\u5355\u5143\u540D\u79F0", maxLength: 20 })
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "unit_type",
|
|
label: "\u7C7B\u578B"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"], { getPopupContainer: () => containerRef.current, placeholder: "\u8BF7\u9009\u62E9\u7C7B\u578B" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 1 }, "\u8BFE\u4EF6"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 3 }, "\u6587\u672C"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 2 }, "\u5B9E\u8BAD"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 5 }, "\u8003\u8BD5"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 6 }, "\u4F5C\u4E1A"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 7 }, "\u7EC3\u4E60"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 8 }, "\u89C6\u9891"))
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "url",
|
|
label: "\u8DF3\u8F6C\u5730\u5740",
|
|
rules: [{
|
|
pattern: new RegExp(/^(https?:\/\/)?([\w.-]+)\.([a-z]{2,})(\/\S*)?$/, "i"),
|
|
message: "\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5730\u5740"
|
|
}]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { placeholder: "\u8BF7\u8F93\u5165\u70B9\u51FB\u8BE5\u8282\u70B9\u8DF3\u8F6C\u7684\u94FE\u63A5\u5730\u5740" })
|
|
)
|
|
)
|
|
),
|
|
relation && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
open: relation,
|
|
centered: true,
|
|
width: 550,
|
|
title: "\u6DFB\u52A0\u5173\u7CFB",
|
|
getContainer: () => containerRef.current,
|
|
onCancel: () => {
|
|
setAddModal("");
|
|
setrelation(false);
|
|
},
|
|
okButtonProps: {
|
|
loading: buttonloading
|
|
},
|
|
onOk: () => {
|
|
if (!AddModal) {
|
|
message/* default */.ZP.info("\u8BF7\u5148\u9009\u62E9\u8282\u70B9");
|
|
return;
|
|
}
|
|
setrelation(false);
|
|
setshowadd(true);
|
|
form.setFieldsValue({
|
|
relation: 1
|
|
});
|
|
setSearchValue("");
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"].Search, { size: "large", onChange: (e) => {
|
|
let value = e.target.value;
|
|
const newExpandedKeys = threelist.filter((item) => item.title.indexOf(value) > -1).map((item) => item.key);
|
|
setExpandedKeys(newExpandedKeys);
|
|
setAutoExpandParent(true);
|
|
setSearchValue(e.target.value);
|
|
} }),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
tree["default"],
|
|
{
|
|
onExpand: (newExpandedKeys) => {
|
|
setExpandedKeys(newExpandedKeys);
|
|
setAutoExpandParent(false);
|
|
},
|
|
style: { maxHeight: 300, height: 300, marginTop: 20, overflow: "auto" },
|
|
onSelect: (e) => {
|
|
console.log("---", e);
|
|
setAddModal(e == null ? void 0 : e[0]);
|
|
},
|
|
expandedKeys,
|
|
defaultExpandAll: true,
|
|
autoExpandParent,
|
|
treeData
|
|
}
|
|
)
|
|
),
|
|
(describe.name || describe.add) && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
open: describe.name || describe.add,
|
|
title: "\u63CF\u8FF0",
|
|
width: 900,
|
|
getContainer: () => containerRef.current,
|
|
centered: true,
|
|
onCancel: () => {
|
|
setdescribe("");
|
|
},
|
|
okButtonProps: {
|
|
loading: buttonloading
|
|
},
|
|
onOk: () => {
|
|
form.submit();
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
form,
|
|
onFinish: (values) => __async(void 0, null, function* () {
|
|
setbuttonloading(true);
|
|
if (describe.add) {
|
|
items.descriptions.push(values.describe);
|
|
setitems(__spreadValues({}, items));
|
|
} else {
|
|
items.descriptions[describe.index] = values.describe;
|
|
setitems(__spreadValues({}, items));
|
|
}
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/${items.id}.json`, {
|
|
method: "put",
|
|
body: {
|
|
type: 2,
|
|
descriptions: items.descriptions
|
|
}
|
|
});
|
|
setbuttonloading(false);
|
|
setdescribe("");
|
|
if (res.status === 0) {
|
|
setupname(false);
|
|
getdatas();
|
|
}
|
|
})
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "describe",
|
|
style: { marginBottom: -10 },
|
|
rules: [
|
|
{
|
|
required: true,
|
|
validator: (_, value) => {
|
|
var _a2;
|
|
return ((_a2 = value == null ? void 0 : value.replaceAll(" ", "")) == null ? void 0 : _a2.length) > 0 ? Promise.resolve() : Promise.reject("\u8BF7\u8F93\u5165\u63CF\u8FF0\u5185\u5BB9");
|
|
}
|
|
}
|
|
]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(markdown_editor/* default */.Z, { placeholder: "\u8BF7\u5728\u6B64\u8F93\u5165\u5185\u5BB9\uFF0C\u6700\u5927\u9650\u5236\u4E3A65000\u4E2A\u5B57\u7B26", watch: true, defaultValue: describe.name })
|
|
)
|
|
)
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
title: "\u6587\u4EF6\u5BFC\u5165",
|
|
open: exportshow,
|
|
centered: true,
|
|
getContainer: () => containerRef.current,
|
|
okButtonProps: {
|
|
loading: buttonloading
|
|
},
|
|
onCancel: () => {
|
|
setexport(false);
|
|
setFileList([]);
|
|
},
|
|
onOk: () => __async(void 0, null, function* () {
|
|
var _a2;
|
|
const formData = new FormData();
|
|
if (fileList.length > 0) {
|
|
formData.append("file", fileList[0]);
|
|
} else {
|
|
message/* default */.ZP.warning("\u8BF7\u9009\u62E9\u6587\u4EF6");
|
|
return;
|
|
}
|
|
setbuttonloading(true);
|
|
formData.append("ec_year_id", params.ec_year_id);
|
|
formData.append("identifier", params.virtual_spacesId);
|
|
formData.append("type", "2");
|
|
formData.append("virtual_module_id", window.localStorage.getItem("vtrsModuleId"));
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/import.json`, {
|
|
method: "post",
|
|
body: formData
|
|
}, true);
|
|
setbuttonloading(false);
|
|
if ((res == null ? void 0 : res.status) === 0) {
|
|
if (((_a2 = res == null ? void 0 : res.fail) == null ? void 0 : _a2.length) > 0) {
|
|
modal["default"].confirm({
|
|
icon: null,
|
|
title: "\u5BFC\u5165\u5931\u8D25",
|
|
content: /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, "\u68C0\u6D4B\u5230\u672C\u6B21\u5BFC\u5165\u5B58\u5728\u4E0D\u7B26\u5408\u8981\u6C42\u7684\u6570\u636E\uFF0C\u70B9\u51FB\u4E0B\u8F7D", /* @__PURE__ */ _react_17_0_2_react.createElement("a", { href: `${env/* default */.Z.API_SERVER}${res == null ? void 0 : res.url}`, download: `\u5931\u8D25\u6570\u636E.xlsx` }, "\u5BFC\u5165\u5931\u8D25\u7684\u6570\u636E"), "\u67E5\u770B")
|
|
});
|
|
}
|
|
setFileList([]);
|
|
items = {};
|
|
setitems({});
|
|
if ((res == null ? void 0 : res.success) > 0) {
|
|
message/* default */.ZP.info("\u6DFB\u52A0\u6210\u529F");
|
|
}
|
|
getdatas();
|
|
setexport(false);
|
|
}
|
|
})
|
|
},
|
|
!(datas == null ? void 0 : datas.is_root) && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginBottom: 30, color: "#333333" } }, "\u68C0\u6D4B\u5F53\u524D\u5DF2\u5B58\u5728\u6570\u636E\uFF0C\u5BFC\u5165\u540E\u539F\u6570\u636E\u5C06\u4F1A\u88AB\u5220\u9664\uFF0C\u6309\u7167\u6700\u65B0\u5BFC\u5165\u7684\u4E3A\u4E3B\uFF0C\u5982\u7EE7\u7EED\u5BFC\u5165\uFF0C\u8BF7\u6309\u7167\u4E0B\u65B9\u6B65\u9AA4\u8FDB\u884C"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("p", { style: { color: "#5F6368" } }, "\u6B65\u9AA41\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { color: "#000000" } }, "\u4E0B\u8F7D"), /* @__PURE__ */ _react_17_0_2_react.createElement("a", { href: `${env/* default */.Z.API_SERVER}/api/knowledge_graphs/down_template.json`, download: `\u6A21\u7248.xlsx` }, "\u77E5\u8BC6\u56FE\u8C31\u5BFC\u5165\u6A21\u7248")),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { style: { color: "#5F6368" } }, "\u6B65\u9AA42\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { color: "#000000" } }, "\u4E0A\u4F20\u586B\u5199\u597D\u7684\u300A\u77E5\u8BC6\u56FE\u8C31\u5BFC\u5165\u6A21\u7248\u300B"))),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { style: { marginTop: 10, marginLeft: 50 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
upload["default"],
|
|
__spreadValues({}, Draggers),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { padding: "0px 16px", color: "#3061D0", cursor: "pointer", height: 32, alignItems: "center", display: "inline-flex", borderRadius: 2, border: "1px solid #BACFFE", background: "#F6F7F9 linear-gradient(180deg, #FFFFFF 0%, #F6F7F9 100%)", boxShadow: "0px 2px 4px 0px #E0DFE1, inset 0px 1px 3px 0px rgba(255,255,255,0.5)" } }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { style: { fontSize: 12, marginRight: 6 }, className: "iconfont icon-tianjiashitixiaojiahao" }), " \u9009\u62E9\u6587\u4EF6")
|
|
))
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
open: showadd,
|
|
title: "\u6DFB\u52A0\u5173\u7CFB",
|
|
width: 500,
|
|
getContainer: () => containerRef.current,
|
|
centered: true,
|
|
onCancel: () => {
|
|
setshowadd(false);
|
|
form.setFieldsValue({
|
|
relation: null
|
|
});
|
|
},
|
|
okButtonProps: {
|
|
loading: buttonloading
|
|
},
|
|
onOk: () => {
|
|
form.submit();
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
form,
|
|
onFinish: (values) => __async(void 0, null, function* () {
|
|
setbuttonloading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/${items.id}/relation.json`, {
|
|
method: "post",
|
|
body: __spreadValues({
|
|
type: 2,
|
|
parent_id: AddModal
|
|
}, values)
|
|
});
|
|
setbuttonloading(false);
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.info("\u5173\u8054\u6210\u529F");
|
|
getdatas();
|
|
setAddModal("");
|
|
setshowadd(false);
|
|
form.setFieldsValue({
|
|
relation: null
|
|
});
|
|
}
|
|
})
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "relation",
|
|
label: "\u7C7B\u578B"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"], { getPopupContainer: () => containerRef.current, placeholder: "\u8BF7\u9009\u62E9\u7C7B\u578B" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 1 }, "\u5173\u8054"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: 2 }, "\u540E\u5E8F"))
|
|
)
|
|
)
|
|
),
|
|
selectmodal && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
open: selectmodal,
|
|
centered: true,
|
|
width: 550,
|
|
title: "\u67E5\u627E",
|
|
getContainer: () => containerRef.current,
|
|
onCancel: () => {
|
|
setAddModal("");
|
|
setselectmodal(false);
|
|
},
|
|
okButtonProps: {
|
|
loading: buttonloading
|
|
},
|
|
onOk: () => {
|
|
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j;
|
|
setselectmodal(false);
|
|
(_a2 = treeDiagramRef.current) == null ? void 0 : _a2.clearSelection();
|
|
(_b2 = relationshipDiagramRef.current) == null ? void 0 : _b2.clearSelection();
|
|
const node = (_d2 = (_c2 = relationshipDiagramRef.current) == null ? void 0 : _c2.findNodeForKey) == null ? void 0 : _d2.call(_c2, AddModal);
|
|
const node2 = (_f = (_e = treeDiagramRef.current) == null ? void 0 : _e.findNodeForKey) == null ? void 0 : _f.call(_e, AddModal);
|
|
(_h = (_g = treeDiagramRef.current) == null ? void 0 : _g.commandHandler) == null ? void 0 : _h.scrollToPart(node2);
|
|
(_j = (_i = relationshipDiagramRef.current) == null ? void 0 : _i.commandHandler) == null ? void 0 : _j.scrollToPart(node);
|
|
if (node) {
|
|
node.isSelected = true;
|
|
if (permission) {
|
|
setBounds({ left: 0, top: 0, bottom: 0, right: 0 });
|
|
setitems(node.data);
|
|
}
|
|
}
|
|
if (node2) {
|
|
node2.isSelected = true;
|
|
if (permission) {
|
|
setBounds({ left: 0, top: 0, bottom: 0, right: 0 });
|
|
setitems(node2.data);
|
|
}
|
|
}
|
|
setAddModal("");
|
|
setSearchValue("");
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"].Search, { size: "large", allowClear: true, onChange: (e) => {
|
|
let value = e.target.value;
|
|
const newExpandedKeys = threelist.filter((item) => item.title.indexOf(value) > -1).map((item) => item.key);
|
|
setExpandedKeys(newExpandedKeys);
|
|
if (newExpandedKeys.length <= 0) {
|
|
setThreenodata(true);
|
|
} else {
|
|
setThreenodata(false);
|
|
}
|
|
setAutoExpandParent(true);
|
|
setSearchValue(e.target.value);
|
|
} }),
|
|
threenodata ? /* @__PURE__ */ _react_17_0_2_react.createElement(NoData/* default */.Z, null) : /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
tree["default"],
|
|
{
|
|
onExpand: (newExpandedKeys) => {
|
|
setExpandedKeys(newExpandedKeys);
|
|
setAutoExpandParent(false);
|
|
},
|
|
style: { maxHeight: 400, height: 400, marginTop: 20, overflow: "auto" },
|
|
onSelect: (e) => {
|
|
setAddModal(e == null ? void 0 : e[0]);
|
|
},
|
|
expandedKeys,
|
|
defaultExpandAll: true,
|
|
autoExpandParent,
|
|
treeData
|
|
}
|
|
)
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
title: "\u5386\u53F2\u8BB0\u5F55",
|
|
open: isshowlish,
|
|
onCancel: () => setisshowlish(false),
|
|
footer: false
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
style: {
|
|
maxHeight: 200,
|
|
overflow: "auto",
|
|
padding: 10
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
(_react_infinite_scroller_1_2_4_react_infinite_scroller_default()),
|
|
{
|
|
initialLoad: false,
|
|
pageStart: 1,
|
|
threshold: 20,
|
|
loadMore: () => __async(void 0, null, function* () {
|
|
var _a2;
|
|
setpage(page + 1);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/knowledge_graphs/history.json`, {
|
|
method: "get",
|
|
params: {
|
|
identifier: params.virtual_spacesId,
|
|
limit: 10,
|
|
page: page + 1
|
|
}
|
|
});
|
|
if (res.status === 0) {
|
|
setlishilist([...lishlist, ...res == null ? void 0 : res.histories]);
|
|
if (((_a2 = res == null ? void 0 : res.histories) == null ? void 0 : _a2.length) < 10)
|
|
sethasMore(false);
|
|
}
|
|
}),
|
|
hasMore,
|
|
useWindow: false
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
list/* default */.Z,
|
|
{
|
|
dataSource: lishlist,
|
|
renderItem: (item) => /* @__PURE__ */ _react_17_0_2_react.createElement(list/* default */.Z.Item, { key: item.id }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
list/* default */.Z.Item.Meta,
|
|
{
|
|
avatar: /* @__PURE__ */ _react_17_0_2_react.createElement(avatar/* default */.C, { src: env/* default */.Z.IMG_SERVER + "/images/" + item.avatar_url }),
|
|
title: /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, item.real_name),
|
|
description: item.content
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, item.created_at))
|
|
}
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
};
|
|
/* harmony default export */ var knowledge = ((0,_umi_production_exports.connect)(
|
|
({
|
|
virtualSpaces,
|
|
globalSetting
|
|
}) => ({
|
|
globalSetting,
|
|
virtualSpaces
|
|
})
|
|
)(Atlas));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/virtualSpaces/Lists/Knowledge/index.tsx
|
|
var Knowledge_defProp = Object.defineProperty;
|
|
var Knowledge_defProps = Object.defineProperties;
|
|
var Knowledge_getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var Knowledge_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var Knowledge_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var Knowledge_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var Knowledge_defNormalProp = (obj, key, value) => key in obj ? Knowledge_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var Knowledge_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (Knowledge_hasOwnProp.call(b, prop))
|
|
Knowledge_defNormalProp(a, prop, b[prop]);
|
|
if (Knowledge_getOwnPropSymbols)
|
|
for (var prop of Knowledge_getOwnPropSymbols(b)) {
|
|
if (Knowledge_propIsEnum.call(b, prop))
|
|
Knowledge_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var Knowledge_spreadProps = (a, b) => Knowledge_defProps(a, Knowledge_getOwnPropDescs(b));
|
|
var Knowledge_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Page = ({
|
|
globalSetting,
|
|
dispatch,
|
|
virtualSpaces
|
|
}) => {
|
|
var _a;
|
|
const [searchParams] = (0,_umi_production_exports.useSearchParams)();
|
|
const [loading, setLoading] = (0,_react_17_0_2_react.useState)(true);
|
|
const [btnLoading, setBtnLoading] = (0,_react_17_0_2_react.useState)(false);
|
|
const [edit, setEdit] = (0,_react_17_0_2_react.useState)(false);
|
|
const [data, setData] = (0,_react_17_0_2_react.useState)({});
|
|
const [description, setDescription] = (0,_react_17_0_2_react.useState)("");
|
|
const [active, setActive] = (0,_react_17_0_2_react.useState)((searchParams == null ? void 0 : searchParams.get("active")) || "position_and_target");
|
|
const { virtualSpacesDetails } = virtualSpaces;
|
|
const query = (0,_umi_production_exports.useParams)();
|
|
const permission = (virtualSpacesDetails == null ? void 0 : virtualSpacesDetails.is_member) || (0,authority/* isSuperAdmins */.Ny)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
getData();
|
|
}, [active, window.localStorage.getItem("vtrsModuleId")]);
|
|
const getData = () => Knowledge_async(void 0, null, function* () {
|
|
setLoading(true);
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/virtual_classrooms/${query.virtual_spacesId}/knowledge_systems/show.json`, {
|
|
method: "get",
|
|
params: {
|
|
column: active,
|
|
virtual_module_id: window.localStorage.getItem("vtrsModuleId")
|
|
}
|
|
});
|
|
if ((res == null ? void 0 : res.status) !== -1) {
|
|
setData(Knowledge_spreadValues({}, res));
|
|
setDescription((res == null ? void 0 : res[active]) || "");
|
|
}
|
|
setLoading(false);
|
|
});
|
|
const tabs = [
|
|
{
|
|
id: "position_and_target",
|
|
name: "\u8BFE\u7A0B\u5B9A\u4F4D\u4E0E\u76EE\u6807"
|
|
},
|
|
{
|
|
id: "desc",
|
|
name: "\u8BFE\u7A0B\u77E5\u8BC6\u70B9"
|
|
},
|
|
{
|
|
id: "knowledge_graph",
|
|
name: "\u77E5\u8BC6\u56FE\u8C31\u63CF\u8FF0"
|
|
},
|
|
{
|
|
id: "knowledge",
|
|
name: "\u77E5\u8BC6\u56FE\u8C31"
|
|
}
|
|
];
|
|
const handleEdit = () => Knowledge_async(void 0, null, function* () {
|
|
setBtnLoading(true);
|
|
const body = {};
|
|
body[active] = description;
|
|
let res = yield (0,fetch/* default */.ZP)(`/api/virtual_classrooms/${query.virtual_spacesId}/knowledge_systems/edit.json`, {
|
|
method: "put",
|
|
body: Knowledge_spreadProps(Knowledge_spreadValues({}, body), {
|
|
virtual_module_id: window.localStorage.getItem("vtrsModuleId")
|
|
})
|
|
});
|
|
if ((res == null ? void 0 : res.status) !== -1) {
|
|
getData();
|
|
setEdit(false);
|
|
}
|
|
setBtnLoading(false);
|
|
});
|
|
const handleDelete = (id, name) => {
|
|
modal["default"].confirm({
|
|
title: "\u63D0\u793A",
|
|
okText: "\u786E\u5B9A\u5220\u9664",
|
|
okButtonProps: {
|
|
danger: true
|
|
},
|
|
icon: false,
|
|
className: resetmodules/* default */.Z.CustomTipsModalCss,
|
|
cancelText: "\u53D6\u6D88",
|
|
content: /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u786E\u8BA4\u5220\u9664 ", name, " \u5417\uFF1F"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt10" }, "\u5220\u9664\u540E\uFF0C\u5C06\u65E0\u6CD5\u6062\u590D\uFF0C\u8BF7\u8C28\u614E\u64CD\u4F5C")),
|
|
onOk: () => Knowledge_async(void 0, null, function* () {
|
|
const res = yield (0,fetch/* default */.ZP)(`/api/virtual_classrooms/${query.virtual_spacesId}/knowledge_systems/${id}/del_content.json`, {
|
|
method: "delete"
|
|
});
|
|
if ((res == null ? void 0 : res.status) !== -1) {
|
|
getData();
|
|
}
|
|
})
|
|
});
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: Knowledgemodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
ui_customization/* CustomTabs */.YG,
|
|
{
|
|
value: active,
|
|
onChange: (k) => {
|
|
if (k === active) {
|
|
return;
|
|
}
|
|
setActive(k);
|
|
setEdit(false);
|
|
},
|
|
tabBarExtraContent: permission && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, active === "position_and_target" && /* @__PURE__ */ _react_17_0_2_react.createElement(ui_customization/* CustomButton */.op, { onClick: () => setEdit(true) }, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-bianji7 font14 mr5" }), "\u7F16\u8F91"), active === "desc" && /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle" }, /* @__PURE__ */ _react_17_0_2_react.createElement(ui_customization/* CustomButton */.op, { onClick: () => setEdit(true) }, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-bianji7 font14 mr5" }), "\u7F16\u8F91\u8BF4\u660E"), /* @__PURE__ */ _react_17_0_2_react.createElement(ui_customization/* CustomButton */.op, { onClick: () => {
|
|
_umi_production_exports.history.push(`/${util/* vtrsKey */.AS}/${query.virtual_spacesId}/knowledge/add?leftMenuId=${window.localStorage.getItem("vtrsModuleId")}`);
|
|
}, className: "ml20" }, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-tianjiashitixiaojiahao font14 mr5" }), "\u65B0\u589E\u77E5\u8BC6\u70B9\u6A21\u5757")), active === "knowledge_graph" && /* @__PURE__ */ _react_17_0_2_react.createElement(ui_customization/* CustomButton */.op, { onClick: () => setEdit(true) }, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-bianji7 font14 mr5" }), "\u7F16\u8F91\u77E5\u8BC6\u56FE\u8C31")),
|
|
dataSource: tabs
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { spinning: loading }, active !== "desc" && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: active !== "knowledge" && "mt20" }, edit ? /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
onChange: (v) => setDescription(v),
|
|
watch: true,
|
|
defaultValue: description
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
ui_customization/* ConfirmAndCancel */.QD,
|
|
{
|
|
confirmTitle: "\u4FDD\u5B58",
|
|
confirmLoading: btnLoading,
|
|
confirmClick: handleEdit,
|
|
cancelClick: () => {
|
|
setEdit(false);
|
|
setDescription(data[active] || "");
|
|
},
|
|
cancelTitle: "\u53D6\u6D88",
|
|
className: "mb25"
|
|
}
|
|
)) : /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: description })), active === "knowledge" && /* @__PURE__ */ _react_17_0_2_react.createElement(knowledge, null), active === "desc" && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.content }, !!description && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.name }, /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, "\u8BF4\u660E"), /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: description })), (_a = data == null ? void 0 : data.subject_modules) == null ? void 0 : _a.map((item) => {
|
|
const { members: { module_content, module_name, subject_module_id } } = item;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.list, key: subject_module_id }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.head }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.models }, module_name), permission && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.btns }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => _umi_production_exports.history.push(`/${util/* vtrsKey */.AS}/${query.virtual_spacesId}/knowledge/${subject_module_id}/edit?leftMenuId=${window.localStorage.getItem("vtrsModuleId")}`) }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "primary-hover" }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-bianji7 font14 mr5" }), "\u7F16\u8F91")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => handleDelete(subject_module_id, module_name) }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "delete-hover" }, " ", /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-piliangshanchubeifen font14 mr5" }), "\u5220\u9664")))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.rowsHead }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u77E5\u8BC6\u70B9"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u4E3B\u8981\u5185\u5BB9"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u80FD\u529B\u76EE\u6807"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.time }, "\u5B66\u65F6"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginRight: 0 } }, "\u6559\u6848")), module_content == null ? void 0 : module_content.map((e, i) => {
|
|
const { knowledge_point, content, target, class_hour, lesson_plan } = e;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.rowsBody, key: i }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, knowledge_point), /* @__PURE__ */ _react_17_0_2_react.createElement("pre", null, content), /* @__PURE__ */ _react_17_0_2_react.createElement("pre", null, target), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Knowledgemodules.time }, class_hour), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginRight: 0 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: lesson_plan })));
|
|
}));
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
title: "\u7F16\u8F91\u8BF4\u660E",
|
|
destroyOnClose: true,
|
|
open: active === "desc" && edit,
|
|
onOk: handleEdit,
|
|
centered: true,
|
|
onCancel: () => {
|
|
setEdit(false);
|
|
setDescription(data[active] || "");
|
|
},
|
|
confirmLoading: btnLoading,
|
|
width: 686,
|
|
okText: "\u786E\u8BA4",
|
|
cancelText: "\u53D6\u6D88",
|
|
wrapClassName: resetmodules/* default */.Z.CustomCss
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", null, "\u8BF4\u660E\uFF1A"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
onChange: (v) => setDescription(v),
|
|
watch: true,
|
|
defaultValue: description
|
|
}
|
|
)
|
|
)));
|
|
};
|
|
/* harmony default export */ var Knowledge = ((0,_umi_production_exports.connect)(
|
|
({
|
|
virtualSpaces,
|
|
globalSetting
|
|
}) => ({
|
|
globalSetting,
|
|
virtualSpaces
|
|
})
|
|
)(Page));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 91676:
|
|
/*!*********************************!*\
|
|
!*** ./src/utils/fullscreen.ts ***!
|
|
\*********************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ BU: function() { return /* binding */ exitFull; },
|
|
/* harmony export */ Dj: function() { return /* binding */ requestFullScreen; },
|
|
/* harmony export */ gH: function() { return /* binding */ fullscreenChange; },
|
|
/* harmony export */ vp: function() { return /* binding */ IsFull; }
|
|
/* harmony export */ });
|
|
function requestFullScreen(element) {
|
|
try {
|
|
if (element.mozRequestFullScreen) {
|
|
element.mozRequestFullScreen();
|
|
} else if (element.webkitRequestFullScreen) {
|
|
element.webkitRequestFullScreen();
|
|
}
|
|
} catch (e) {
|
|
console.log(e, ":e");
|
|
}
|
|
}
|
|
function exitFull() {
|
|
if (window.top.document.webkitExitFullscreen) {
|
|
window.top.document.webkitExitFullscreen();
|
|
} else if (document.exitFullscreen) {
|
|
window.top.document.exitFullscreen();
|
|
} else if (document.msExitFullscreen) {
|
|
window.top.document.msExitFullscreen();
|
|
} else if (document.mozCancelFullScreen) {
|
|
window.top.document.mozCancelFullScreen();
|
|
}
|
|
}
|
|
const fullscreenChange = () => {
|
|
if (document.webkitExitFullscreen) {
|
|
return "webkitfullscreenchange";
|
|
} else if (document.exitFullscreen) {
|
|
return "fullscreenchange";
|
|
} else if (document.msExitFullscreen) {
|
|
return "msfullscreenchange";
|
|
} else if (document.mozCancelFullScreen) {
|
|
return "mozfullscreenchange";
|
|
}
|
|
};
|
|
function IsFull() {
|
|
var fullscreenElement = window.top.document.fullscreenElement || window.top.document.mozFullscreenElement || window.top.document.webkitFullscreenElement;
|
|
var fullscreenEnabled = document.fullscreenEnabled || document.mozFullscreenEnabled || document.webkitFullscreenEnabled;
|
|
console.log("fullscreenElement", fullscreenElement);
|
|
if (fullscreenElement == null) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |