diff --git a/pc4mobx/hrmSalary/apis/item.js b/pc4mobx/hrmSalary/apis/item.js
index 128cd24f..ccf93af9 100644
--- a/pc4mobx/hrmSalary/apis/item.js
+++ b/pc4mobx/hrmSalary/apis/item.js
@@ -107,6 +107,10 @@ export const saveSysItem = params => {
export const getItemTypeOption = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/listSalaryItemTypeOption', 'GET', params);
}
+//获取公式描述
+export const getFormulaDes = params => {
+ return WeaTools.callApi('/api/bs/hrmsalary/formula/des', 'GET', params);
+}
// *** 公式 start ***
// 获取公式变量类型
diff --git a/pc4mobx/hrmSalary/components/excelEditor/components/codeAction.js b/pc4mobx/hrmSalary/components/excelEditor/components/codeAction.js
new file mode 100644
index 00000000..1ab26b1f
--- /dev/null
+++ b/pc4mobx/hrmSalary/components/excelEditor/components/codeAction.js
@@ -0,0 +1,255 @@
+/*
+ * Author: 黎永顺
+ * name: 公式列表
+ * Description:
+ * Date: 2023/4/25
+ */
+import React, { Component } from "react";
+import { WeaInputSearch, WeaLocaleProvider } from "ecCom";
+import { Tree } from "antd";
+import { formualSearchField, formualSearchGroup, getFormulaDes } from "../../../apis/item";
+import "../index.less";
+
+const TreeNode = Tree.TreeNode;
+const getLabel = WeaLocaleProvider.getLabel;
+
+class CodeAction extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ disabled: false,
+ variableText: "",
+ funcText: "",
+ variItemText: "",
+ variableList: [], //变量列表
+ variableExpandedKeys: [], //变量展开的节点
+ funcList: [], //函数列表
+ funcExpandedKeys: [], //函数展开的节点
+ funcHoverItem: {} //选中的函数节点
+ };
+ }
+
+ componentDidMount() {
+ const { groupParams = {} } = this.props;
+ this.getFormulaDes();
+ this.formualSearchGroup(groupParams);
+ }
+
+ componentWillReceiveProps(nextProps, nextContext) {
+ const { isCustomFunction, isCustomFunctionClick, onChangeCustomFunction } = nextProps;
+ if (isCustomFunction === "1" && !isCustomFunctionClick) {
+ this.setState({ disabled: true });
+ } else {
+ this.setState({ disabled: false }, () => {
+ isCustomFunction === "1" && onChangeCustomFunction("0");
+ });
+ }
+ }
+
+ getFormulaDes = () => {
+ getFormulaDes().then(({ data }) => {
+ if (!_.isEmpty(data)) this.setState({ funcList: data });
+ });
+ };
+ formualSearchGroup = (payload) => {
+ formualSearchGroup(payload).then(({ status, data }) => {
+ if (status) this.setState({
+ variableList: _.map(data, item => ({
+ ...item,
+ children: [{ name: "", fieldId: "searchInput" }]
+ }))
+ });
+ });
+ };
+ formualSearchField = (sourceId) => {
+ const { groupParams } = this.props;
+ const { variableList } = this.state;
+ formualSearchField({ sourceId, extendParam: { ...groupParams } }).then(({ status, data }) => {
+ if (status) {
+ this.setState({
+ variableList: _.map(variableList, it => ({
+ ...it,
+ children: sourceId === it.key ? [...it.children, ...data] : [...it.children]
+ }))
+ });
+ }
+ });
+ };
+ handleExpandVari = (variableExpandedKeys, { expanded, node }) => {
+ const { props: { eventKey } } = node;
+ const { variableList } = this.state;
+ this.setState({ variableExpandedKeys });
+ if (expanded) {
+ this.formualSearchField(eventKey);
+ } else {
+ this.setState({
+ variableList: _.map(variableList, it => ({
+ ...it,
+ children: eventKey === it.key ? [{ name: "", fieldId: "searchInput" }] : [...it.children]
+ }))
+ });
+ }
+ };
+ handleVariNode = (selectedKeys) => {
+ const { onVariSelect } = this.props;
+ const { variableList } = this.state;
+ const parentNode = _.map(variableList, it => it.key);
+ if (selectedKeys.join() && selectedKeys.join().indexOf("searchInput") === -1 &&
+ !parentNode.includes(selectedKeys.join())) {
+ const selectParentNodeKey = selectedKeys.join().split("_")[0];
+ const convertStr = _.reduce(variableList, (pre, cur) => {
+ if (cur.key === selectParentNodeKey) {
+ return pre + cur.value + "." + _.find(cur.children, child => child.fieldId === selectedKeys.join()).name;
+ }
+ return pre;
+ }, "");
+ onVariSelect(convertStr);
+ }
+ };
+
+ render() {
+ const {
+ variableList, variableExpandedKeys, variableText, variItemText,
+ funcList, funcText, funcExpandedKeys, funcHoverItem, disabled
+ } = this.state;
+ const { groupParams = {} } = this.props;
+ const { referenceType } = groupParams;
+ const variableDatalist = _.filter(variableList, it => it.value.indexOf(variableText) !== -1);
+ const funcDatalist = _.map(funcList, it => ({
+ ...it,
+ children: _.filter(it.children, child => _.lowerCase(child.name).indexOf(funcText) !== -1)
+ }));
+ return (
+
+
+
+
{getLabel(111, "变量")}
+
+
+ this.setState({ variableText })}/>
+
+ {
+ _.map(variableDatalist, item => {
+ const { key, value, children = [] } = item;
+ const itemChildren = _.filter(children.slice(1), it => it.name.indexOf(variItemText) !== -1);
+ return
+ {
+ _.map([...children.slice(0, 1), ...itemChildren], (child, childIndex) => {
+ const { name, fieldId } = child;
+ return (
+ fieldId === "searchInput" ?
+ this.setState({ variItemText })}
+ />
+ }
+ key={fieldId + "_" + childIndex}/> :
+
+ );
+ })
+ }
+ ;
+ })
+ }
+
+
+
+ {
+ referenceType !== "sql" &&
+
+
+
+
{getLabel(111, "函数")}
+
+
+ this.setState({ funcText })}/>
+ this.setState({ funcExpandedKeys })}
+ >
+ {
+ _.map(funcDatalist, item => {
+ const { name, dataType, children = [] } = item;
+ return
+ {
+ _.map(children, (child, childIndex) => {
+ const { name: childName, chineseName } = child;
+ return (
+ this.props.onFuncSelect(childName)}
+ onMouseEnter={() => this.setState({ funcHoverItem: child })}>
+ {childName}
+ {chineseName}
+
+ }
+ key={childIndex}
+ />
+ );
+ })
+ }
+ ;
+ })
+ }
+
+
+
+
+
+
+ {!_.isEmpty(funcHoverItem) ? funcHoverItem.name : getLabel(111, "提示")}
+
+
+
+
+
+ }
+
+ );
+ }
+}
+
+export default CodeAction;
+
+const TipList = (props) => {
+ const { tips } = props;
+ const { paramDescs = [], formatString, description, example, result } = tips;
+ return _.isEmpty(tips) ?
+
+ {/*
{getLabel(111, "{C:选项} 用来选择特定选项字段下的备选项")}
*/}
+ {/*
{getLabel(111, "{U:姓名} 用来选择工作区成员")}
*/}
+ {/*
{getLabel(111, "{D:数据} 用来选择一个部门")}
*/}
+
+
:
+
+
{getLabel(111, "语法")}
+
+
{formatString}
+
{description}
+
+
{getLabel(111, "参数")}
+ {
+ _.map(paramDescs, it => {
+ return
+ .
+ {it}
+
;
+ })
+ }
+
{getLabel(111, "示例")}
+
{example}
+
{getLabel(111, "结果")}
+
{result}
+
+
;
+};
diff --git a/pc4mobx/hrmSalary/components/excelEditor/constants.js b/pc4mobx/hrmSalary/components/excelEditor/constants.js
new file mode 100644
index 00000000..2bb11e58
--- /dev/null
+++ b/pc4mobx/hrmSalary/components/excelEditor/constants.js
@@ -0,0 +1,16 @@
+export const keyboardBaseBtns=[
+ { key:"+", label: "+" },
+ { key:"-", label: "-" },
+ { key:">", label: ">" },
+ { key:">=", label: ">=" },
+ { key:"=", label: "=" },
+ { key:"*", label: "*" },
+ { key:"/", label: "/" },
+ { key:"<", label: "<" },
+ { key:"<=", label: "<=" },
+ { key:"!=", label: "!=" },
+ { key:"()", label: "(" },
+ { key:")", label: ")" },
+ { key:"%", label: "%" },
+ { key:" ", label: "space" },
+]
diff --git a/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js b/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js
new file mode 100644
index 00000000..e70c6967
--- /dev/null
+++ b/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js
@@ -0,0 +1,112 @@
+// extendCodeMirror.js
+/* eslint-disable */
+import * as CodeMirror from "codemirror";
+
+CodeMirror.extendMode("css", {
+ commentStart: "/*",
+ commentEnd: "*/",
+ newlineAfterToken: function (type, content) {
+ return /^[;{}]$/.test(content);
+ }
+});
+
+CodeMirror.extendMode("javascript", {
+ commentStart: "",
+ commentEnd: "",
+// FIXME semicolons inside of for
+ newlineAfterToken: function (type, content, textAfter, state) {
+ if (this.jsonMode) {
+ return /^[\[,{]$/.test(content) || /^}/.test(textAfter) || /^]/.test(textAfter);
+ } else {
+ if (content == ";" && state.lexical && state.lexical.type == ")") return false;
+ return /^[;{}]$/.test(content) && !/^;/.test(textAfter);
+ }
+ }
+});
+
+CodeMirror.extendMode("xml", {
+ commentStart: "",
+ newlineAfterToken: function (type, content, textAfter) {
+ return type == "tag" && />$/.test(content) || /^ -1 && endIndex > -1 && endIndex > startIndex) {
+ // Take string till comment start
+ selText = selText.substr(0, startIndex)
+ // From comment start till comment end
+ + selText.substring(startIndex + curMode.commentStart.length, endIndex)
+ // From comment end till string end
+ + selText.substr(endIndex + curMode.commentEnd.length);
+ }
+ cm.replaceRange(selText, from, to);
+ }
+ });
+});
+
+// Applies automatic mode-aware indentation to the specified range
+CodeMirror.defineExtension("autoIndentRange", function (from, to) {
+ var cmInstance = this;
+ this.operation(function () {
+ for (var i = from.line; i <= to.line; i++) {
+ cmInstance.indentLine(i, "smart");
+ }
+ });
+});
+
+// Applies automatic formatting to the specified range
+CodeMirror.defineExtension("autoFormatRange", function (from, to) {
+ var cm = this;
+ var outer = cm.getMode(), text = cm.getRange(from, to).split("\n");
+ var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state);
+ var tabSize = cm.getOption("tabSize");
+
+ var out = "", lines = 0, atSol = from.ch == 0;
+
+ function newline() {
+ out += "\n";
+ atSol = true;
+ ++lines;
+ }
+
+ for (var i = 0; i < text.length; ++i) {
+ var stream = new CodeMirror.StringStream(text[i], tabSize);
+ while (!stream.eol()) {
+ var inner = CodeMirror.innerMode(outer, state);
+ var style = outer.token(stream, state), cur = stream.current();
+ stream.start = stream.pos;
+ if (!atSol || /\S/.test(cur)) {
+ out += cur;
+ atSol = false;
+ }
+ if (!atSol && inner.mode.newlineAfterToken &&
+ inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i + 1] || "", inner.state))
+ newline();
+ }
+ if (!stream.pos && outer.blankLine) outer.blankLine(state);
+ if (!atSol) newline();
+ }
+
+ cm.operation(function () {
+ cm.replaceRange(out, from, to);
+ for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur)
+ cm.indentLine(cur, "smart");
+ cm.setSelection(from, cm.getCursor(false));
+ });
+});
+// export default CodeMirror;
+module.exports = { CodeMirror };
diff --git a/pc4mobx/hrmSalary/components/excelEditor/index.js b/pc4mobx/hrmSalary/components/excelEditor/index.js
new file mode 100644
index 00000000..1d1cd89f
--- /dev/null
+++ b/pc4mobx/hrmSalary/components/excelEditor/index.js
@@ -0,0 +1,175 @@
+import React, { Component } from "react";
+import { Button } from "antd";
+import { WeaLocaleProvider } from "ecCom";
+import { Controlled as CodeMirror } from "react-codemirror2";
+import { keyboardBaseBtns } from "./constants";
+import CodeAction from "./components/codeAction";
+import cs from "classnames";
+import "./index.less";
+import "codemirror/lib/codemirror.css";
+import "codemirror/lib/codemirror.js";
+import "codemirror/mode/javascript/javascript.js";
+
+require("./extendCodeMirror");
+const getLabel = WeaLocaleProvider.getLabel;
+
+class ExcelEditor extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ value: "",
+ isFormter: false,
+ isCustomFunctionClick: false
+ };
+ this.editorRef = null;
+ this.timer = null;
+ }
+
+ componentWillReceiveProps(nextProps, nextContext) {
+ if (nextProps.value !== this.props.value && nextProps.value) this.setState({ value: nextProps.value });
+ }
+
+ componentWillUnmount() {
+ if (this.timer) clearInterval(this.timer);
+ this.setState({ isCustomFunctionClick: false });
+ }
+
+ autoFormatSelection = () => {
+ const { isFormter } = this.state;
+ if (isFormter) {
+ const script_length = this.editorRef.getValue().length;
+ const startPos = { line: 0, ch: 0, sticky: null };
+ const endPos = this.editorRef.doc.posFromIndex(script_length);
+ this.editorRef.setSelection(startPos, endPos);
+ this.editorRef.autoFormatRange(startPos, endPos);
+ this.editorRef.commentRange(true, startPos, endPos);
+ } else {
+ this.editorRef.undo();
+ this.editorRef.undo();
+ }
+ };
+ insertText = text => {
+ const cursor = this.editorRef.getCursor();
+ this.editorRef.replaceRange(text, cursor);
+ this.editorRef.refresh();
+ this.editorRef.focus();
+ };
+ replaceToWidget = (editor) => {
+ editor.getAllMarks().forEach(m => m.clear());
+ };
+ handleVariSelect = str => this.insertText(`{${str}}`);
+ handleFuncSelect = str => {
+ const cursor = this.editorRef.getCursor();
+ this.editorRef.replaceRange(`${str}()`, cursor);
+ this.timer = setTimeout(() => {
+ const { line, ch } = this.editorRef.getCursor();
+ this.editorRef.setCursor({ line, ch: ch - 1 });
+ this.editorRef.refresh();
+ this.editorRef.focus();
+ }, 100);
+ };
+ handleEditorRedo = () => {
+ const { ch, line } = this.editorRef.getCursor();
+ const delStr = this.editorRef.getRange({ line, ch: ch - 1 }, { line, ch });
+ const codeValue = this.editorRef.getValue();
+ if (delStr === "}") {
+ if (codeValue.slice(0, ch).lastIndexOf("{") === -1) {
+ this.editorRef.replaceRange("", { line, ch: ch - 1 }, { line, ch });
+ } else {
+ this.editorRef.replaceRange("", { line, ch: codeValue.slice(0, ch).lastIndexOf("{") }, { line, ch });
+ }
+ } else {
+ this.editorRef.replaceRange("", { line, ch: ch - 1 }, { line, ch });
+ }
+ this.editorRef.refresh();
+ this.editorRef.focus();
+ };
+ handleBackSpaceRedo = () => {
+ const { ch, line } = this.editorRef.getCursor();
+ const delStr = this.editorRef.getRange({ line, ch: ch - 1 }, { line, ch });
+ const codeValue = this.editorRef.getValue();
+ if (delStr === "}") {
+ if (codeValue.slice(0, ch).lastIndexOf("{") === -1) {
+ this.editorRef.replaceRange("", { line, ch: ch - 1 }, { line, ch });
+ } else {
+ this.editorRef.replaceRange("", { line, ch: codeValue.slice(0, ch).lastIndexOf("{") + 1 }, { line, ch });
+ }
+ }
+ this.editorRef.refresh();
+ this.editorRef.focus();
+ };
+
+ render() {
+ const { isFormter, isCustomFunctionClick } = this.state;
+ const { groupParams = {}, isCustomFunction, value, onChangeCustomFunction } = this.props;
+ const { referenceType } = groupParams;
+ return (
+
+
+
+ this.editorRef = editor}
+ value={this.state.value}
+ onBeforeChange={(editor, data, value) => {
+ this.setState({ value }, () => this.props.onChange(this.state.value));
+ }}
+ onChange={(editor, data, value) => {
+ this.replaceToWidget(editor, data, value);
+ }}
+ options={{
+ lineNumbers: false,
+ mode: "javascript",
+ autofocus: false,
+ styleActiveLine: true,
+ lineWrapping: true,
+ matchBrackets: true,
+ lint: false,
+ indentUnit: 2,
+ cursorHeight: 0.85,
+ placeholder: "",
+ showCursorWhenSelecting: true
+ }}
+ onKeyDown={(_, { keyCode }) => keyCode === 8 && this.handleBackSpaceRedo()}
+ />
+
+ {
+ referenceType !== "sql" &&
+
+
+
+ {
+ _.map(keyboardBaseBtns, item => {
+ const { key, label } = item;
+ return ;
+ })
+ }
+
+
+
+
+
+
+
+
+ }
+
+ {/*公式参数列表*/}
+
+
+ );
+ }
+}
+
+export default ExcelEditor;
diff --git a/pc4mobx/hrmSalary/components/excelEditor/index.less b/pc4mobx/hrmSalary/components/excelEditor/index.less
new file mode 100644
index 00000000..0ea0081a
--- /dev/null
+++ b/pc4mobx/hrmSalary/components/excelEditor/index.less
@@ -0,0 +1,199 @@
+.excel-codeWrap {
+ width: 100%;
+ display: flex;
+ justify-content: space-around;
+ padding: 0 0 8px;
+
+ .excel-codeBox {
+ flex: 1;
+ overflow: auto;
+ background: #fff;
+ box-sizing: content-box;
+ border: 1px solid #e5e5e5;
+
+ span {
+ font-family: Liberation Mono, LiberationMonoRegular, Courier New, monospace;
+ }
+
+ .CodeMirror-code {
+ font-size: 16px;
+
+
+ }
+
+ .CodeMirror-scroll {
+ overflow-x: visible !important;
+ padding: 4px;
+ }
+
+ .CodeMirror-sizer {
+ margin-left: 0 !important;
+ }
+
+ .CodeMirror-gutters {
+ border-right: none;
+ background-color: #f7f7f7;
+ opacity: 0;
+ display: none;
+ }
+ }
+
+ .excel-codeBox-keyboard {
+ width: 272px;
+ min-height: 232px;
+ padding: 20px;
+ background: #fff;
+ border: 1px solid #e5e5e5;
+ border-left: none;
+
+ .excel-codeBox-keyboard-operate {
+ display: flex;
+
+ .excel-codeBox-keyboard-operate-content {
+ display: flex;
+ flex-wrap: wrap;
+ flex: 1;
+
+ .excel-codeBox-keyboard-base {
+ width: 30px;
+ height: 30px;
+ text-align: center;
+ margin: 0 10px 10px 0;
+ }
+
+ .excel-codeBox-keyboard-space {
+ width: 70px;
+ height: 30px;
+ }
+ }
+
+ .excel-codeBox-keyboard-operate-clear {
+ width: 30px;
+
+ .excel-codeBox-keyboard-del {
+ width: 30px;
+ height: 70px;
+ }
+
+ .excel-codeBox-keyboard-clear {
+ width: 30px;
+ height: 30px;
+ margin-top: 10px;
+ }
+ }
+ }
+ }
+}
+
+.excel-codeAction {
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+
+ .excel-codeAction-item:last-child {
+ margin-right: 0;
+
+ .excel-codeAction-header-title {
+ color: rgb(217, 82, 189);
+ }
+ }
+
+ .excel-codeAction-item {
+ width: 33%;
+ min-height: 317px;
+ flex: 1;
+ background: #fff;
+ border: 1px solid #e5e5e5;
+ margin-right: 16px;
+ display: flex;
+ flex-direction: column;
+
+ .excel-codeAction-header {
+ display: flex;
+ padding: 10px 16px;
+ border-bottom: 1px solid #e5e5e5;
+
+ .excel-codeAction-header-title {
+ flex: 1;
+ font-weight: 600;
+ }
+ }
+
+ .excel-codeAction-content {
+ flex: 1;
+ overflow: hidden auto;
+ padding: 0 16px;
+ max-height: 280px;
+ position: relative;
+
+ .variableOuterInput {
+ width: 100%;
+ margin-top: 10px;
+ position: sticky;
+ top: 10px;
+ background-color: #fff;
+ z-index: 1;
+ }
+
+ .variableTree {
+ li a:hover, li a.ant-tree-node-selected {
+ background: transparent;
+ }
+
+ li:first-child {
+ a {
+ padding: 2px 5px;
+ }
+ }
+
+ li a {
+ width: calc(100% - 16px);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+
+ .ant-tree-title {
+ display: inline-block;
+ width: 100%;
+
+ .funcListTitle {
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+
+ & > span {
+ display: inline-block;
+ flex: 1 1;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ word-break: keep-all;
+ white-space: nowrap;
+ }
+
+ .functionName {
+ max-width: 100px;
+ }
+
+ .functionDesc {
+ max-width: 100px;
+ text-align: right;
+ color: #999;
+ }
+ }
+ }
+ }
+ }
+
+ .code-action-list {
+ padding: 10px 0;
+ .code-action-tips-title{
+ height: 22px;
+ line-height: 22px;
+ }
+ .code-action-tips-info{
+ color: #999
+ }
+ }
+ }
+ }
+}
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js
index 6f58700a..2395f7f1 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js
@@ -142,13 +142,13 @@ class AttendanceDataComp extends Component {
}
});
};
- handleViewAttendanceData = ({ id, salaryCycle }) => {
+ handleViewAttendanceData = ({ id, attendCycle }) => {
const { attendanceViewPayload } = this.state;
this.setState({
attendanceViewPayload: {
...attendanceViewPayload,
visible: true, attendQuoteId: id,
- salaryYearMonth: salaryCycle
+ salaryYearMonth: attendCycle
}
});
};
diff --git a/pc4mobx/hrmSalary/pages/equationEditor/index.js b/pc4mobx/hrmSalary/pages/equationEditor/index.js
new file mode 100644
index 00000000..ffcc361c
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/equationEditor/index.js
@@ -0,0 +1,30 @@
+import React, { Component } from "react";
+import { Button, Modal } from "antd";
+import ExcelEditor from "../../components/excelEditor";
+
+class Index extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ title: "DialogTitle",
+ visible: false,
+ lvisible: false
+ };
+ }
+
+ render() {
+ return (
+
+ {}}/>
+
+ this.setState({ visible: false })}
+ >
+ {}}/>
+
+
+ );
+ }
+}
+
+export default Index;
diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemAddModal.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemAddModal.js
index de378287..f0ddd511 100644
--- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemAddModal.js
+++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemAddModal.js
@@ -28,10 +28,12 @@ export default class LedgerSalaryItemAddModal extends React.Component {
this.setState({ selectedRowKeys: [], dataSourceCopy: [] }, () => {
this.listSalaryItem();
});
+ } else {
+ this.setState({ pageInfo: { current: 1, pageSize: 10, total: 0 } });
}
}
- listSalaryItem = () => {
+ listSalaryItem = (extra = {}) => {
const { itemGroups } = this.props;
const { name, pageInfo, loading, dataSourceCopy } = this.state;
let excludeIds = [];
@@ -43,17 +45,19 @@ export default class LedgerSalaryItemAddModal extends React.Component {
const payload = {
excludeIds,
name,
- ...pageInfo
+ ...pageInfo,
+ ...extra
};
this.setState({ loading: { ...loading, query: true } });
listSalaryItem(payload).then(({ status, data }) => {
this.setState({ loading: { ...loading, query: false } });
if (status) {
const { pageNum: current, pageSize, total, columns, list: dataSource } = data;
+ const tmpV = !_.isEmpty(dataSource) ? dataSource : [];
this.setState({
- dataSourceCopy: [...dataSourceCopy, ...dataSource],
+ dataSourceCopy: [...dataSourceCopy, ...tmpV],
pageInfo: { ...pageInfo, current, pageSize, total },
- dataSource,
+ dataSource: tmpV,
columns
});
}
@@ -86,7 +90,7 @@ export default class LedgerSalaryItemAddModal extends React.Component {
const { onAddSalaryItems, id, onCancel, itemGroups } = this.props;
const arrItems = _.find(itemGroups, it => it.uuid === id).items || [];
let selectItems = [];
- dataSourceCopy.map((item) => {
+ _.uniqWith(dataSourceCopy, _.isEqual).map((item) => {
item = { ...item };
selectedRowKeys.map((key, keyIdx) => {
if (item.id === key) {
@@ -135,7 +139,7 @@ export default class LedgerSalaryItemAddModal extends React.Component {
placeholder="请输入薪资项目名称"
value={name}
onChange={(name) => this.setState({ name })}
- onSearch={() => this.listSalaryItem()}
+ onSearch={() => this.listSalaryItem({ current: 1 })}
/>
!_.isEmpty(it.items)), child => {
let columnItem = {
title: child.name,
- children: child.items.map(i => {
+ children: _.filter(child.items, t => t.itemHide !== "1").map(i => {
return {
title: i.name,
dataIndex: i.id,
diff --git a/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js b/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js
index 3bf2d4a9..5bba9d3f 100644
--- a/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js
+++ b/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js
@@ -1,9 +1,10 @@
import React from "react";
-import { Button, Col, Icon, message, Modal, Row } from "antd";
-import { WeaCheckbox, WeaDialog, WeaFormItem, WeaHelpfulTip, WeaInput, WeaSelect, WeaTextarea } from "ecCom";
+import { Button, Col, message, Modal, Row } from "antd";
+import { WeaCheckbox, WeaDialog, WeaFormItem, WeaHelpfulTip, WeaInput, WeaSelect } from "ecCom";
import { inject, observer } from "mobx-react";
import { testFormual } from "../../apis/item";
import TestModal from "./testModal";
+import ExcelEditor from "../../components/excelEditor";
import "./index.less";
@inject("salaryItemStore")
@@ -12,11 +13,11 @@ export default class FormalFormModal extends React.Component {
constructor(props) {
super(props);
this.state = {
- formalua: false, //是否删除操作过公式数据
validateType: "",
returnType: "",
value: "",
extendParam: {
+ isCustomFunction: "0",
sqlReturnKey: "",
openDecrypt: "0",
datasource: {
@@ -26,7 +27,8 @@ export default class FormalFormModal extends React.Component {
returnValue: "",
formulaDatasourceList: [],
testVisible: false,
- showTestVal: ""
+ showTestVal: "",
+ groupParams: {}
};
this.group = {};
this.field = {};
@@ -41,11 +43,6 @@ export default class FormalFormModal extends React.Component {
setSearchFields([]);
if (!!this.props.formulaId && this.props.formulaId != 0) {
detailFormual(this.props.formulaId).then(data => {
- this.setState({
- value: data.formula,
- returnType: data.returnType,
- validateType: data.validateType
- });
this.parameters = data.parameters;
this.referenceType = data.referenceType;
this.extendParam = data.extendParam;
@@ -58,6 +55,7 @@ export default class FormalFormModal extends React.Component {
}
this.setState({
extendParam: {
+ isCustomFunction: extendParam.isCustomFunction || "1",
sqlReturnKey: extendParam.sqlReturnKey,
openDecrypt: extendParam.openDecrypt,
datasource: {
@@ -66,14 +64,20 @@ export default class FormalFormModal extends React.Component {
}
});
}
- let groupParams = {};
- if (this.referenceType == "sql") {
- groupParams = { "referenceType": "sql" };
- } else {
- groupParams = this.props.backCalcType === "issuedItems" ? { "referenceType": "backCalc" } : {};
- }
- salaryAcctImportTemplateParam(groupParams);
+ this.setState({
+ value: data.formula,
+ returnType: data.returnType,
+ validateType: data.validateType
+ });
+ // salaryAcctImportTemplateParam(groupParams);
});
+ let groupParams = {};
+ if (this.props.valueType == "3") {
+ groupParams = { "referenceType": "sql" };
+ } else {
+ groupParams = this.props.backCalcType === "issuedItems" ? { "referenceType": "backCalc" } : {};
+ }
+ this.setState({ groupParams });
} else {
let groupParams = {};
if (this.props.valueType == "3") {
@@ -85,7 +89,8 @@ export default class FormalFormModal extends React.Component {
value: this.props.formulaContent
});
}
- salaryAcctImportTemplateParam(groupParams);
+ this.setState({ groupParams });
+ // salaryAcctImportTemplateParam(groupParams);
}
}
@@ -108,7 +113,6 @@ export default class FormalFormModal extends React.Component {
const index = value.lastIndexOf("{", end - 1);
const currentValue = value.substring(index, end);
this.setState({
- formalua: true,
value: value.replace(currentValue, "")
}, () => {
if (propsTextarea.setSelectionRange) {
@@ -138,14 +142,14 @@ export default class FormalFormModal extends React.Component {
};
// 多行文本编辑
- handleChange(value) {
+ handleChange = (value) => {
if (value && value.trim() == "") {
this.parameters = [];
}
this.setState({
- value, formalua: true
+ value
});
- }
+ };
// 获取光标位置
getPositionForTextArea(ctrl) {
@@ -206,12 +210,11 @@ export default class FormalFormModal extends React.Component {
returnType: this.props.dataType || this.state.returnType,
validateType: this.props.dataType || this.state.returnType,
extendParam: JSON.stringify(this.state.extendParam),
- formula: this.state.value,
+ formula: this.state.value.replace(/[\r\n]/g, ""),
parameters: this.parameters,
referenceType: this.referenceType == "" ? this.props.valueType == "2" ? "formula" : this.props.valueType == "3" ? "sql" : "" : this.referenceType
};
saveFormual(params).then(data => {
- this.setState({ formalua: false });
this.props.onSaveFormal(data);
this.props.onCancel();
});
@@ -319,17 +322,26 @@ export default class FormalFormModal extends React.Component {
}
});
};
+ handleChangeCustomFunction = (isCustomFunction) => {
+ const { extendParam } = this.state;
+ this.setState({
+ extendParam: {
+ ...extendParam,
+ isCustomFunction
+ }
+ });
+ };
render() {
const { salaryItemStore } = this.props;
const { searchGroup, searchFields } = salaryItemStore;
- const { value, formulaDatasourceList, extendParam, testVisible, showTestVal, formalua } = this.state;
+ const { value, formulaDatasourceList, extendParam, testVisible, showTestVal, groupParams } = this.state;
const title =
{`${(this.props.valueType == 2 || this.props.valueType === "FORMULA") ? "函数" : "SQL"}公式`}
{
value &&
]}
className="formula-wrapper"
initLoadCss
onCancel={() => {
- this.setState({ formalua: false });
this.props.onCancel();
}}>
{
@@ -427,66 +439,69 @@ export default class FormalFormModal extends React.Component {
}
-
- this.contentProps = input}
- minRows={8}
- maxRows={8}
- value={value}
- onChange={(value) => this.handleChange(value)}
- noResize={true}
- style={{ fontSize: "14px", lineHeight: 1.2 }}
- onKeyDown={this.triggerKeyDown}
- />
-
-
-
-
-
变量
-
- {
- searchGroup && searchGroup.map(item => {
- return
{
- this.handleItemClick(item);
- }}>
- {item.value}
-
- {item.value} 的字段
-
;
- })
- }
-
-
-
-
- {
- searchFields && searchFields.map(item => {
- return (
-
{
- this.handleFieldClick(item);
- }}>
- {item.name}
-
- );
- })
- }
-
-
+
this.handleChange(value)}
+ onChangeCustomFunction={this.handleChangeCustomFunction}/>
+ {/**/}
+ {/* this.contentProps = input}*/}
+ {/* minRows={8}*/}
+ {/* maxRows={8}*/}
+ {/* value={value}*/}
+ {/* onChange={(value) => this.handleChange(value)}*/}
+ {/* noResize={true}*/}
+ {/* style={{ fontSize: "14px", lineHeight: 1.2 }}*/}
+ {/* onKeyDown={this.triggerKeyDown}*/}
+ {/* />*/}
+ {/*
*/}
+ {/**/}
+ {/*
*/}
+ {/*
*/}
+ {/*
变量
*/}
+ {/*
*/}
+ {/* {*/}
+ {/* searchGroup && searchGroup.map(item => {*/}
+ {/* return
{*/}
+ {/* this.handleItemClick(item);*/}
+ {/* }}>*/}
+ {/* {item.value}*/}
+ {/* */}
+ {/* {item.value} 的字段*/}
+ {/*
;*/}
+ {/* })*/}
+ {/* }*/}
+ {/*
*/}
+ {/*
*/}
+ {/*
*/}
+ {/*
*/}
+ {/* {*/}
+ {/* searchFields && searchFields.map(item => {*/}
+ {/* return (*/}
+ {/*
{*/}
+ {/* this.handleFieldClick(item);*/}
+ {/* }}>*/}
+ {/* {item.name}*/}
+ {/*
*/}
+ {/* );*/}
+ {/* })*/}
+ {/* }*/}
+ {/*
*/}
+ {/*
*/}
);
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regList.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regList.js
index 32168268..849cb407 100644
--- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regList.js
+++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regList.js
@@ -58,7 +58,7 @@ class RegList extends Component {
}
};
postMessageToChild = () => {
- const paymentStatus = "3";
+ const paymentStatus = this.props.type === "difference" ? "4" : "3";
const creator = Number(getQueryString("creator"));
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
@@ -91,7 +91,7 @@ class RegList extends Component {
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
const creator = Number(getQueryString("creator"));
- const paymentStatus = "3";
+ const paymentStatus = type === "difference" ? "4" : "3";
const payload = {
billMonth, paymentStatus,
creator, paymentOrganization,