fastlion-amis
Version:
一种MIS页面生成工具
154 lines (153 loc) • 10 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowingCodeRenderer = void 0;
var tslib_1 = require("tslib");
/**
* 流程
*/
var icons_1 = require("@ant-design/icons");
var antd_1 = require("antd");
var lodash_1 = require("lodash");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var icons_2 = require("../components/icons");
var factory_1 = require("../factory");
var helper_1 = require("../utils/helper");
var MobileProcess_1 = (0, tslib_1.__importDefault)(require("./Lion/MobileProcess"));
var FlowFileAsk_1 = (0, tslib_1.__importDefault)(require("./Lion/MobileProcess/components/FlowFileAsk"));
var FlowingCode = /** @class */ (function (_super) {
(0, tslib_1.__extends)(FlowingCode, _super);
function FlowingCode(props) {
var _this = _super.call(this, props) || this;
_this.handleChange = function () { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
var _a, env, flowCountApi, res;
return (0, tslib_1.__generator)(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.props, env = _a.env, flowCountApi = _a.flowCountApi;
return [4 /*yield*/, env.fetcher(flowCountApi)];
case 1:
res = _b.sent();
if (res.status == 0) {
this.handleContent(res.data.items);
}
return [2 /*return*/];
}
});
}); };
_this.handleContenticon = function (val) {
switch (val) {
case 'applyItem':
return react_1.default.createElement(icons_2.Icon, { icon: "Initiated-file", className: "icon" });
case 'todoItem':
return react_1.default.createElement(icons_2.Icon, { icon: "pending-documents", className: "icon" });
case 'doneItem':
return react_1.default.createElement(icons_2.Icon, { icon: "processed-file", className: "icon" });
default:
return react_1.default.createElement(icons_2.Icon, { icon: "documents-received", className: "icon" });
}
};
_this.handleContent = function (val) {
var date = val.map(function (item) {
return {
name: item.name,
count: item.count,
title: item.title,
key: item.name == "receivedItem" ? '我收到的' : item.name,
icon: _this.handleContenticon(item.name),
hierarchy: item.name == "applyItem" ? 0 : 1,
data: item.name == "applyItem" ? item.name : '我审批的',
};
});
_this.setState({ contextval: date });
};
_this.handleStatistics = function (val) {
_this.setState({ statistics: val });
};
_this.getContactsSeek = function (val) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
return (0, tslib_1.__generator)(this, function (_a) {
return [2 /*return*/];
});
}); };
// 防抖
_this.handleSearch = (0, lodash_1.debounce)(function (value) {
_this.getContactsSeek(value);
}, 1000);
_this.handleOnClickFather = function (value, hierarchy, data) {
if (hierarchy == 0) {
_this.setState({ tabsVal: data });
}
else {
_this.setState({ tabsVal: data, approve: value });
}
};
_this.state = {
statistics: 0,
iptVal: '',
tabsVal: "发起申请",
approve: 'todoItem',
contextval: []
};
return _this;
}
FlowingCode.prototype.componentDidMount = function () {
this.handleChange();
};
FlowingCode.prototype.render = function () {
var _this = this;
var _a = this.props, cx = _a.classnames, env = _a.env, render = _a.render, applyItem = _a.applyItem, doneItem = _a.doneItem, todoItem = _a.todoItem, actionsApi = _a.actionsApi, onImageEnlarge = _a.onImageEnlarge, returnNodeApi = _a.returnNodeApi, addrBookApi = _a.addrBookApi, attachmentUploadApi = _a.attachmentUploadApi, attachmentDownloadApi = _a.attachmentDownloadApi, attachmentDeleteApi = _a.attachmentDeleteApi, attachmentDeleteByTaskApi = _a.attachmentDeleteByTaskApi, attachmentGetTaskApi = _a.attachmentGetTaskApi;
var _b = this.state, statistics = _b.statistics, tabsVal = _b.tabsVal, approve = _b.approve, contextval = _b.contextval;
var attachmentApi = {
attachmentUploadApi: attachmentUploadApi,
attachmentDownloadApi: attachmentDownloadApi,
attachmentDeleteApi: attachmentDeleteApi,
attachmentDeleteByTaskApi: attachmentDeleteByTaskApi,
attachmentGetTaskApi: attachmentGetTaskApi,
addrBookApi: addrBookApi
};
return (react_1.default.createElement("div", { className: cx("Process", {
"Process_color": !(0, helper_1.isMobile)(),
"Process_height": (0, helper_1.isMobile)() && tabsVal !== "发起申请"
}) },
(0, helper_1.isMobile)() && tabsVal !== "发起申请" && react_1.default.createElement("div", { className: 'contacts-title-input' },
react_1.default.createElement(antd_1.Input, { placeholder: '\u641C\u7D22\u4EBA\u540D\u3001\u6807\u9898\u3001\u5185\u5BB9', onChange: function (e) { return _this.handleSearch(e.target.value); }, bordered: false })),
react_1.default.createElement(antd_1.Tabs, { centered: true, onTabClick: function (key) {
_this.setState({ tabsVal: key });
}, className: cx("Process-tabs", { 'Process-tabs-title': (0, helper_1.isMobile)(), 'ant-tabs-bottom': (0, helper_1.isMobile)() }), animated: false, tabPosition: (0, helper_1.isMobile)() ? "bottom" : "top", activeKey: tabsVal },
react_1.default.createElement(antd_1.Tabs.TabPane, { tab: react_1.default.createElement("span", null,
" ",
(0, helper_1.isMobile)() && react_1.default.createElement(icons_1.DiffOutlined, null),
"\u53D1\u8D77\u7533\u8BF7"), key: '发起申请', className: cx("Process-tabs-tabPane") },
react_1.default.createElement(FlowFileAsk_1.default, { env: env, render: render, actionsApi: actionsApi, contextval: contextval, handleOnClickFather: this.handleOnClickFather, handleOnChange: this.handleChange })),
react_1.default.createElement(antd_1.Tabs.TabPane, { tab: react_1.default.createElement("span", null,
(0, helper_1.isMobile)() && react_1.default.createElement(icons_1.UserOutlined, null),
"\u6211\u5BA1\u6279\u7684"), key: '我审批的', className: cx("Process-tabs-tabPane") },
react_1.default.createElement(antd_1.Tabs, { centered: true, className: cx("Process-tabs"), onTabClick: function (key) {
_this.setState({ approve: key });
}, activeKey: approve },
react_1.default.createElement(antd_1.Tabs.TabPane, { tab: todoItem.title + ("" + (statistics !== 0 ? ' · ' + statistics : '')), key: 'todoItem', className: cx("Process-tabs-tabPane") },
react_1.default.createElement(MobileProcess_1.default, { key: todoItem.title, env: env, val: todoItem, render: render, title: 'todoItem', handleStatistics: this.handleStatistics, handleOnChange: this.handleChange, onImageEnlarge: onImageEnlarge, returnNodeApi: returnNodeApi, attachmentApi: attachmentApi })),
react_1.default.createElement(antd_1.Tabs.TabPane, { tab: doneItem.title, key: 'doneItem', className: cx("Process-tabs-tabPane") },
react_1.default.createElement(MobileProcess_1.default, { key: doneItem.title, env: env, val: doneItem, render: render, title: 'doneItem', handleOnChange: this.handleChange, onImageEnlarge: onImageEnlarge, attachmentApi: attachmentApi })),
react_1.default.createElement(antd_1.Tabs.TabPane, { tab: '我收到的', key: '我收到的', className: cx("Process-tabs-tabPane") },
react_1.default.createElement(antd_1.Empty, { className: 'Empty', description: react_1.default.createElement("span", null, "\u6682\u65E0\u5F85\u5BA1\u6279") })))),
react_1.default.createElement(antd_1.Tabs.TabPane, { tab: react_1.default.createElement("span", null,
(0, helper_1.isMobile)() && react_1.default.createElement(icons_1.CloudUploadOutlined, null),
"\u5DF2\u63D0\u4EA4"), key: 'applyItem', className: cx("Process-tabs-tabPane") },
react_1.default.createElement(MobileProcess_1.default, { key: applyItem.title, env: env, val: applyItem, render: render, title: 'applyItem', handleOnChange: this.handleChange, attachmentApi: attachmentApi })))));
};
return FlowingCode;
}(react_1.default.Component));
var FlowingCodeRenderer = /** @class */ (function (_super) {
(0, tslib_1.__extends)(FlowingCodeRenderer, _super);
function FlowingCodeRenderer() {
return _super !== null && _super.apply(this, arguments) || this;
}
FlowingCodeRenderer = (0, tslib_1.__decorate)([
(0, factory_1.Renderer)({
type: 'flowing'
})
], FlowingCodeRenderer);
return FlowingCodeRenderer;
}(FlowingCode));
exports.FlowingCodeRenderer = FlowingCodeRenderer;
//# sourceMappingURL=./renderers/Flowing.js.map