diff --git a/pc4mobx/organization/components/branchNumSetting/index.less b/pc4mobx/organization/components/numberSetting/branchNumSetting/index.less
similarity index 100%
rename from pc4mobx/organization/components/branchNumSetting/index.less
rename to pc4mobx/organization/components/numberSetting/branchNumSetting/index.less
diff --git a/pc4mobx/organization/components/numberSetting/constants.js b/pc4mobx/organization/components/numberSetting/constants.js
new file mode 100644
index 0000000..442abae
--- /dev/null
+++ b/pc4mobx/organization/components/numberSetting/constants.js
@@ -0,0 +1,18 @@
+export const serialFieldOptions = [
+ {
+ key: "string",
+ showname: "字符串",
+ },
+ {
+ key: "year",
+ showname: "当前年份",
+ },
+ {
+ key: "month",
+ showname: "当前月份",
+ },
+ {
+ key: "day",
+ showname: "当前日期",
+ },
+]
\ No newline at end of file
diff --git a/pc4mobx/organization/components/numberSetting/deptNumberSet/index.js b/pc4mobx/organization/components/numberSetting/deptNumberSet/index.js
new file mode 100644
index 0000000..01fa1ad
--- /dev/null
+++ b/pc4mobx/organization/components/numberSetting/deptNumberSet/index.js
@@ -0,0 +1,481 @@
+/*
+ * Author: 黎永顺
+ * Description: 部门编号设置
+ * Date: 2022-06-06 09:37:39
+ * LastEditTime: 2022-06-15 09:52:04
+ */
+import React, { Component, Fragment } from "react";
+import { inject, observer } from "mobx-react";
+import { Button, message } from "antd";
+import {
+ WeaTop,
+ WeaFormItem,
+ WeaCheckbox,
+ WeaSearchGroup,
+ WeaSelect,
+ WeaHelpfulTip,
+} from "ecCom";
+import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
+import NumberComposition from "../branchNumSetting/components/numberComposition";
+import { serialFieldOptions } from "../constants";
+import { i18n } from "../../../public/i18n";
+import moment from "moment";
+import "../branchNumSetting/index.less";
+
+const deptSerialFieldOptions = [{ key: 'subcompany', showname: "分部编号" }]
+
+@inject("numberSet")
+@observer
+export default class DeptNumberSet extends Component {
+ constructor() {
+ super();
+ this.state = {
+ options: [],
+ loading: false,
+ dataSource: [],
+ startNumberInfo: {
+ columns: [],
+ dataSource: [],
+ },
+ subCompanyInfo: {
+ details: [],
+ serialenable: "0",
+ deptSerial: {
+ enable: "0",
+ key: "",
+ },
+ dateSerial: {
+ enable: "0",
+ key: "",
+ },
+ },
+ };
+ }
+
+ componentDidMount() {
+ this.getCodeSetting();
+ }
+
+ getCodeSetting = () => {
+ const { numberSet } = this.props;
+ numberSet
+ .getCodeSetting({ serialtype: "DEPARTMENT" })
+ .then(({ api_status, details, serialenable, dateSerial = {}, deptSerial = {} }) => {
+ if (api_status && !_.isEmpty(details)) {
+ this.setState({
+ subCompanyInfo: { details, serialenable, dateSerial, deptSerial },
+ });
+ }
+ });
+ };
+
+ handleSubmit = () => {
+ let promise = new Promise((resolve, reject) => {
+ const { numberSet } = this.props;
+ const { dataSource, subCompanyInfo } = this.state;
+ const { serialenable, dateSerial, deptSerial } = subCompanyInfo;
+ const details = _.map(dataSource, (it, showorder) => {
+ const { numField, value: rulevalue } = it;
+ return {
+ ruletype: _.upperCase(numField),
+ rulevalue,
+ showorder,
+ };
+ });
+ const payload = {
+ datas: JSON.stringify({
+ serialenable,
+ details,
+ dateSerial,
+ deptSerial,
+ serialtype: "DEPARTMENT",
+ }),
+ };
+ this.setState({ loading: true });
+ numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
+ this.setState({ loading: false });
+ if (api_status) {
+ message.success("保存成功");
+ resolve(api_status);
+ } else {
+ reject("接口调用失败");
+ }
+ });
+ });
+ return promise;
+ };
+
+ handleChangeCode = (data) => {
+ const tmpV = _.filter(
+ data,
+ (it) =>
+ it.numField === "year" ||
+ it.numField === "month" ||
+ it.numField === "day" ||
+ it.numField === "subcompany" ||
+ it.numField === "department" ||
+ it.numField === "jobtitles"
+ );
+ this.setState({
+ dataSource: _.cloneDeep(data),
+ options: _.map(tmpV, (it) => {
+ const { numFieldName: showname, numField: key } = it;
+ return { key: _.upperCase(key), showname };
+ }),
+ });
+ };
+
+ handleSetNumber = (type, data = {}) => {
+ this.handleSubmit().then((res) => {
+ const { numberSet } = this.props;
+ const { subCompanyInfo } = this.state;
+ const { dateSerial, deptSerial } = subCompanyInfo;
+ if (type === "start") {
+ const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
+ let payload = {
+ coderuleid: 2,
+ type: dateSerial.enable == '1' ? dateSerial.key : '',
+ dateStart: data.startDate ? data.startDate : moment().format(formatVal),
+ dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
+ subCompanyId: data.subCompanyId ? data.subCompanyId : "",
+ deptId: "",
+ jobtitlesId: "",
+ };
+ if (deptSerial.enable === '1' && !data.subCompanyId) return
+ if (deptSerial.enable === '1' && data.subCompanyId) {
+ payload = { ...payload, type: payload.type + ',' + deptSerial.key }
+ }
+ numberSet.getStartNumForm(payload).then(({ api_status, columns, dataSource }) => {
+ if (api_status) {
+ this.setState({
+ startNumberInfo: { columns, dataSource },
+ });
+ }
+ });
+ } else {
+ numberSet.getAdvanceSearchCondition();
+ numberSet.getSearchReservedCodeList({
+ serialtype: "DEPARTMENT",
+ checkboxType: "multi",
+ });
+ }
+ });
+ };
+ handleChangeTable = (newColumns, datas) => {
+ this.setState({
+ startNumberInfo: {
+ ...this.state.startNumberInfo,
+ columns: newColumns,
+ dataSource: datas,
+ },
+ });
+ };
+
+ handleSubmitStartNumber = () => {
+ const { numberSet } = this.props;
+ const payload = {
+ datas: JSON.stringify({
+ coderuleid: 2,
+ ...this.state.startNumberInfo,
+ }),
+ };
+ numberSet.saveStartNum(payload).then(({ api_status }) => {
+ if (api_status) {
+ message.success("保存成功");
+ this.numberSetRef.handleClose();
+ }
+ });
+ };
+
+ /**
+ * name: 删除预留编号
+ * param {*} ids
+ * return {*}
+ */
+ deleteReservedNumber = (ids) => {
+ const { numberSet } = this.props;
+ numberSet.deleteReservedCodeById({ ids }).then(({ api_status }) => {
+ if (api_status) {
+ message.success("删除成功");
+ numberSet.getSearchReservedCodeList({
+ serialtype: "DEPARTMENT",
+ checkboxType: "multi",
+ });
+ }
+ });
+ };
+ /**
+ * name:新增预留编号
+ * return {*}
+ */
+ handleAddReservedNumber = () => {
+ const { numberSet } = this.props;
+ const { reservedForm } = numberSet;
+ const { options } = this.state;
+ numberSet.getReservedCodeFrom({ serialtype: "DEPARTMENT" }).then(() => {
+ const type = _.get(_.last(options), ['key']);
+ const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
+ const payload = {
+ coderuleid: 2,
+ type,
+ dateStart: moment().format(format),
+ dateEnd: moment().format(format),
+ subCompanyId: "",
+ deptId: "",
+ jobtitlesId: "",
+ };
+ numberSet
+ .getStartNumForm(payload)
+ .then(({ api_status, dataSource }) => {
+ if (api_status && !_.isEmpty(dataSource)) {
+ const currentnumber = _.get(_.last(dataSource), ['startnum']);
+ reservedForm.updateFields({
+ currentnumber: {
+ value: currentnumber,
+ },
+ });
+ }
+ });
+ })
+ };
+ /**
+ * name: 保存预留设置
+ * param {*} params
+ * return {*}
+ */
+ handleSubmitReservedNumber = (params) => {
+ const { numberSet } = this.props;
+ const payload = { ...params, serialtype: "DEPARTMENT" };
+ numberSet.saveReservedCode(payload).then(({ api_status }) => {
+ if (api_status) {
+ message.success("保存成功");
+ this.numberSetRef.handleCloseReservedModal();
+ numberSet.getSearchReservedCodeList({
+ serialtype: "DEPARTMENT",
+ checkboxType: "multi",
+ });
+ }
+ });
+ };
+
+ /**
+ * name:提示文本
+ * return {*}
+ */
+ helpContent = () => {
+ return (
+
+ );
+ };
+ render() {
+ const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
+ const { numberSet } = this.props;
+ const { details, serialenable, dateSerial = {}, deptSerial = {} } = subCompanyInfo;
+ const btns = [
+
,
+ ];
+ const dropMenuDatas = [
+ {
+ key: "save",
+ disabled: false,
+ icon:
,
+ content: "保存",
+ onClick: (key) => this.handleSubmit(),
+ },
+ ];
+ return (
+
+ );
+ }
+}
diff --git a/pc4mobx/organization/components/deptNumberSet/index.js b/pc4mobx/organization/components/numberSetting/postNumberSet/index.js
similarity index 62%
rename from pc4mobx/organization/components/deptNumberSet/index.js
rename to pc4mobx/organization/components/numberSetting/postNumberSet/index.js
index 4a384a2..9bb1745 100644
--- a/pc4mobx/organization/components/deptNumberSet/index.js
+++ b/pc4mobx/organization/components/numberSetting/postNumberSet/index.js
@@ -1,8 +1,8 @@
/*
* Author: 黎永顺
- * Description: 部门编号设置
+ * Description: 岗位编号设置
* Date: 2022-06-06 09:37:39
- * LastEditTime: 2022-06-07 17:44:30
+ * LastEditTime: 2022-06-15 12:47:43
*/
import React, { Component, Fragment } from "react";
import { inject, observer } from "mobx-react";
@@ -17,13 +17,14 @@ import {
} from "ecCom";
import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
import NumberComposition from "../branchNumSetting/components/numberComposition";
-import { i18n } from "../../public/i18n";
-import moment from 'moment';
+import { serialFieldOptions } from "../constants";
+import { i18n } from "../../../public/i18n";
+import moment from "moment";
import "../branchNumSetting/index.less";
@inject("numberSet")
@observer
-export default class DeptNumberSet extends Component {
+export default class PostNumberSet extends Component {
constructor() {
super();
this.state = {
@@ -52,7 +53,7 @@ export default class DeptNumberSet extends Component {
getCodeSetting = () => {
const { numberSet } = this.props;
numberSet
- .getCodeSetting({ serialtype: "DEPARTMENT" })
+ .getCodeSetting({ serialtype: "JOBTITLES" })
.then(({ api_status, details, serialenable, dateSerial = {} }) => {
if (api_status && !_.isEmpty(details)) {
this.setState({
@@ -63,32 +64,38 @@ export default class DeptNumberSet extends Component {
};
handleSubmit = () => {
- const { numberSet } = this.props;
- const { dataSource, subCompanyInfo } = this.state;
- const { serialenable, dateSerial } = subCompanyInfo;
- const details = _.map(dataSource, (it, showorder) => {
- const { numField, value: rulevalue } = it;
- return {
- ruletype: _.upperCase(numField),
- rulevalue,
- showorder,
+ let promise = new Promise((resolve, reject) => {
+ const { numberSet } = this.props;
+ const { dataSource, subCompanyInfo } = this.state;
+ const { serialenable, dateSerial } = subCompanyInfo;
+ const details = _.map(dataSource, (it, showorder) => {
+ const { numField, value: rulevalue } = it;
+ return {
+ ruletype: _.upperCase(numField),
+ rulevalue,
+ showorder,
+ };
+ });
+ const payload = {
+ datas: JSON.stringify({
+ serialenable,
+ details,
+ dateSerial,
+ serialtype: "JOBTITLES",
+ }),
};
+ this.setState({ loading: true });
+ numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
+ this.setState({ loading: false });
+ if (api_status) {
+ message.success("保存成功");
+ resolve(api_status);
+ } else {
+ reject("接口调用失败");
+ }
+ });
});
- const payload = {
- datas: JSON.stringify({
- serialenable,
- details,
- dateSerial,
- serialtype: "DEPARTMENT",
- }),
- };
- this.setState({ loading: true });
- numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
- this.setState({ loading: false });
- if (api_status) {
- message.success("保存成功");
- }
- });
+ return promise;
};
handleChangeCode = (data) => {
@@ -108,29 +115,39 @@ export default class DeptNumberSet extends Component {
});
};
- handleSetNumber = (type) => {
- this.handleSubmit();
- const { numberSet } = this.props;
- if (type === "start") {
- const payload = {
- coderuleid: 2,
- type: "",
- dateStart: moment().format("YYYY"),
- dateEnd: moment().format("YYYY"),
- subCompanyId: "",
- deptId: "",
- jobtitlesId: "",
- };
- numberSet
- .getStartNumForm(payload)
- .then(({ api_status, columns, dataSource }) => {
- if (api_status) {
- this.setState({
- startNumberInfo: { columns, dataSource },
- });
- }
+ handleSetNumber = (type, data = {}) => {
+ this.handleSubmit().then(() => {
+ const { numberSet } = this.props;
+ const { subCompanyInfo } = this.state;
+ const { dateSerial } = subCompanyInfo;
+ if (type === "start") {
+ const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
+ const payload = {
+ coderuleid: 4,
+ type: dateSerial.enable == '1' ? dateSerial.key : '',
+ dateStart: data.startDate ? data.startDate : moment().format(formatVal),
+ dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
+ subCompanyId: "",
+ deptId: "",
+ jobtitlesId: "",
+ };
+ numberSet
+ .getStartNumForm(payload)
+ .then(({ api_status, columns, dataSource }) => {
+ if (api_status) {
+ this.setState({
+ startNumberInfo: { columns, dataSource },
+ });
+ }
+ });
+ } else {
+ numberSet.getAdvanceSearchCondition();
+ numberSet.getSearchReservedCodeList({
+ serialtype: "JOBTITLES",
+ checkboxType: "multi",
});
- }
+ }
+ });
};
handleChangeTable = (newColumns, datas) => {
this.setState({
@@ -146,7 +163,7 @@ export default class DeptNumberSet extends Component {
const { numberSet } = this.props;
const payload = {
datas: JSON.stringify({
- coderuleid: 2,
+ coderuleid: 4,
...this.state.startNumberInfo,
}),
};
@@ -157,6 +174,76 @@ export default class DeptNumberSet extends Component {
}
});
};
+ /**
+ * name: 删除预留编号
+ * param {*} ids
+ * return {*}
+ */
+ deleteReservedNumber = (ids) => {
+ const { numberSet } = this.props;
+ numberSet.deleteReservedCodeById({ ids }).then(({ api_status }) => {
+ if (api_status) {
+ message.success("删除成功");
+ numberSet.getSearchReservedCodeList({
+ serialtype: "JOBTITLES",
+ checkboxType: "multi",
+ });
+ }
+ });
+ };
+ /**
+ * name:新增预留编号
+ * return {*}
+ */
+ handleAddReservedNumber = () => {
+ const { numberSet } = this.props;
+ const { reservedForm } = numberSet;
+ const { options } = this.state;
+ numberSet.getReservedCodeFrom({ serialtype: "JOBTITLES" }).then(() => {
+ const type = _.get(_.last(options), ['key']);
+ const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
+ const payload = {
+ coderuleid: 4,
+ type,
+ dateStart: moment().format(format),
+ dateEnd: moment().format(format),
+ subCompanyId: "",
+ deptId: "",
+ jobtitlesId: "",
+ };
+ numberSet
+ .getStartNumForm(payload)
+ .then(({ api_status, dataSource }) => {
+ if (api_status && !_.isEmpty(dataSource)) {
+ const currentnumber = _.get(_.last(dataSource), ['startnum']);
+ reservedForm.updateFields({
+ currentnumber: {
+ value: currentnumber,
+ },
+ });
+ }
+ });
+ })
+ };
+ /**
+ * name: 保存预留设置
+ * param {*} params
+ * return {*}
+ */
+ handleSubmitReservedNumber = (params) => {
+ const { numberSet } = this.props;
+ const payload = { ...params, serialtype: "JOBTITLES" };
+ numberSet.saveReservedCode(payload).then(({ api_status }) => {
+ if (api_status) {
+ message.success("保存成功");
+ this.numberSetRef.handleCloseReservedModal();
+ numberSet.getSearchReservedCodeList({
+ serialtype: "JOBTITLES",
+ checkboxType: "multi",
+ });
+ }
+ });
+ };
/**
* name:提示文本
@@ -174,6 +261,7 @@ export default class DeptNumberSet extends Component {
);
};
render() {
+ const { numberSet } = this.props;
const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
const { details, serialenable, dateSerial } = subCompanyInfo;
const btns = [
@@ -193,7 +281,7 @@ export default class DeptNumberSet extends Component {
return (
}
iconBgcolor="#217346"
buttons={btns}
@@ -203,7 +291,7 @@ export default class DeptNumberSet extends Component {
@@ -254,6 +343,7 @@ export default class DeptNumberSet extends Component {
dateSerial: {
...dateSerial,
enable: isSingle,
+ key: isSingle == '0' ? 'YEAR' : dateSerial.key
},
},
})
@@ -261,7 +351,7 @@ export default class DeptNumberSet extends Component {
/>
{dateSerial.enable == "1" && (
({ ...item, showname: item.showname.substr(2, 1) }))}
value={dateSerial.key}
detailtype={3}
supportCancel
@@ -297,9 +387,20 @@ export default class DeptNumberSet extends Component {
(this.numberSetRef = dom)}
onSet={this.handleSetNumber}
+ companyInfo={subCompanyInfo}
+ loading={loading}
startNumberInfo={startNumberInfo}
onChange={this.handleChangeTable}
onSaveStartNumber={this.handleSubmitStartNumber}
+ onDeleteReservedNumber={this.deleteReservedNumber}
+ onAddReservedNumber={this.handleAddReservedNumber}
+ onSubmitReservedNumber={this.handleSubmitReservedNumber}
+ onSearchReservedNumberset={() =>
+ numberSet.getSearchReservedCodeList({
+ serialtype: "JOBTITLES",
+ checkboxType: "multi",
+ })
+ }
/>
diff --git a/pc4mobx/organization/components/numberSetting/resourceNumberSet/index.js b/pc4mobx/organization/components/numberSetting/resourceNumberSet/index.js
new file mode 100644
index 0000000..d1245a2
--- /dev/null
+++ b/pc4mobx/organization/components/numberSetting/resourceNumberSet/index.js
@@ -0,0 +1,529 @@
+/*
+ * Author: 黎永顺
+ * Description: 岗位编号设置
+ * Date: 2022-06-06 09:37:39
+ * LastEditTime: 2022-06-15 10:36:30
+ */
+import React, { Component, Fragment } from "react";
+import { inject, observer } from "mobx-react";
+import { Button, message } from "antd";
+import {
+ WeaTop,
+ WeaFormItem,
+ WeaCheckbox,
+ WeaSearchGroup,
+ WeaSelect,
+ WeaHelpfulTip,
+} from "ecCom";
+import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
+import NumberComposition from "../branchNumSetting/components/numberComposition";
+import { serialFieldOptions } from "../constants";
+import { i18n } from "../../../public/i18n";
+import moment from "moment";
+import "../branchNumSetting/index.less";
+const resourceSerialFieldOptions = [
+ { key: 'subcompany', showname: "分部编号" },
+ { key: 'department', showname: "部门编号" },
+ { key: 'jobtitles', showname: "岗位编号" }
+]
+
+@inject("numberSet")
+@observer
+export default class ResourceNumberSet extends Component {
+ constructor() {
+ super();
+ this.state = {
+ options: [],
+ loading: false,
+ dataSource: [],
+ startNumberInfo: {
+ columns: [],
+ dataSource: [],
+ },
+ subCompanyInfo: {
+ details: [],
+ serialenable: "0",
+ deptSerial: {
+ enable: "0",
+ key: "",
+ },
+ jobtitlesSerial: {
+ enable: "0",
+ key: "",
+ },
+ dateSerial: {
+ enable: "0",
+ key: "",
+ },
+ },
+ };
+ }
+
+ componentDidMount() {
+ this.getCodeSetting();
+ }
+
+ getCodeSetting = () => {
+ const { numberSet } = this.props;
+ numberSet
+ .getCodeSetting({ serialtype: "USER" })
+ .then(({ api_status, details, serialenable, dateSerial = {}, jobtitlesSerial = {}, deptSerial = {} }) => {
+ if (api_status && !_.isEmpty(details)) {
+ this.setState({
+ subCompanyInfo: { details, serialenable, dateSerial, jobtitlesSerial, deptSerial },
+ });
+ }
+ });
+ };
+
+ handleSubmit = () => {
+ let promise = new Promise((resolve, reject) => {
+ const { numberSet } = this.props;
+ const { dataSource, subCompanyInfo } = this.state;
+ const { serialenable, dateSerial, jobtitlesSerial, deptSerial } = subCompanyInfo;
+ const details = _.map(dataSource, (it, showorder) => {
+ const { numField, value: rulevalue } = it;
+ return {
+ ruletype: _.upperCase(numField),
+ rulevalue,
+ showorder,
+ };
+ });
+ const payload = {
+ datas: JSON.stringify({
+ serialenable,
+ details,
+ dateSerial,
+ jobtitlesSerial, deptSerial,
+ serialtype: "USER",
+ }),
+ };
+ this.setState({ loading: true });
+ numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
+ this.setState({ loading: false });
+ if (api_status) {
+ message.success("保存成功");
+ resolve(api_status);
+ } else {
+ reject("接口调用失败");
+ }
+ });
+ });
+ return promise;
+ };
+
+ handleChangeCode = (data) => {
+ const tmpV = _.filter(
+ data,
+ (it) =>
+ it.numField === "year" ||
+ it.numField === "month" ||
+ it.numField === "day" ||
+ it.numField === "subcompany" ||
+ it.numField === "department" ||
+ it.numField === "jobtitles"
+ );
+ this.setState({
+ dataSource: _.cloneDeep(data),
+ options: _.map(tmpV, (it) => {
+ const { numFieldName: showname, numField: key } = it;
+ return { key: _.upperCase(key), showname };
+ }),
+ });
+ };
+
+ handleSetNumber = (type, data = {}) => {
+ this.handleSubmit().then(() => {
+ const { numberSet } = this.props;
+ const { subCompanyInfo } = this.state;
+ const { dateSerial, deptSerial, jobtitlesSerial } = subCompanyInfo;
+ if (type === "start") {
+ const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
+ let payload = {
+ coderuleid: 3,
+ type: dateSerial.enable == '1' ? dateSerial.key : '',
+ dateStart: data.startDate ? data.startDate : moment().format(formatVal),
+ dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
+ subCompanyId: data.subCompanyId ? data.subCompanyId : "",
+ deptId: data.deptId ? data.deptId : "",
+ jobtitlesId: data.jobtitlesId ? data.jobtitlesId : "",
+ };
+ if (deptSerial.enable === '1' && deptSerial.key === 'SUBCOMPANY' && !data.subCompanyId) return
+ if (deptSerial.enable === '1' && deptSerial.key === 'DEPARTMENT' && !data.deptId) return
+ if (jobtitlesSerial.enable === '1' && !data.jobtitlesId) return
+ if (deptSerial.enable === '1' && data.subCompanyId) {
+ payload = { ...payload, type: payload.type + ',' + deptSerial.key }
+ }
+ if (jobtitlesSerial.enable === '1' && data.jobtitlesId) {
+ payload = { ...payload, type: payload.type + ',' + jobtitlesSerial.key }
+ }
+ numberSet
+ .getStartNumForm(payload)
+ .then(({ api_status, columns, dataSource }) => {
+ if (api_status) {
+ this.setState({
+ startNumberInfo: { columns, dataSource },
+ });
+ }
+ });
+ } else {
+ numberSet.getAdvanceSearchCondition();
+ numberSet.getSearchReservedCodeList({
+ serialtype: "USER",
+ checkboxType: "multi",
+ });
+ }
+ });
+ };
+
+ handleChangeTable = (newColumns, datas) => {
+ this.setState({
+ startNumberInfo: {
+ ...this.state.startNumberInfo,
+ columns: newColumns,
+ dataSource: datas,
+ },
+ });
+ };
+
+ handleSubmitStartNumber = () => {
+ const { numberSet } = this.props;
+ const payload = {
+ datas: JSON.stringify({
+ coderuleid: 4,
+ ...this.state.startNumberInfo,
+ }),
+ };
+ numberSet.saveStartNum(payload).then(({ api_status }) => {
+ if (api_status) {
+ message.success("保存成功");
+ this.numberSetRef.handleClose();
+ }
+ });
+ };
+
+ /**
+ * name: 删除预留编号
+ * param {*} ids
+ * return {*}
+ */
+ deleteReservedNumber = (ids) => {
+ const { numberSet } = this.props;
+ numberSet.deleteReservedCodeById({ ids }).then(({ api_status }) => {
+ if (api_status) {
+ message.success("删除成功");
+ numberSet.getSearchReservedCodeList({
+ serialtype: "USER",
+ checkboxType: "multi",
+ });
+ }
+ });
+ };
+ /**
+ * name:新增预留编号
+ * return {*}
+ */
+ handleAddReservedNumber = () => {
+ const { numberSet } = this.props;
+ const { reservedForm } = numberSet;
+ const { options } = this.state;
+ numberSet.getReservedCodeFrom({ serialtype: "USER" }).then(() => {
+ const type = _.get(_.last(options), ['key']);
+ const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
+ const payload = {
+ coderuleid: 3,
+ type,
+ dateStart: moment().format(format),
+ dateEnd: moment().format(format),
+ subCompanyId: "",
+ deptId: "",
+ jobtitlesId: "",
+ };
+ numberSet
+ .getStartNumForm(payload)
+ .then(({ api_status, dataSource }) => {
+ if (api_status && !_.isEmpty(dataSource)) {
+ const currentnumber = _.get(_.last(dataSource), ['startnum']);
+ reservedForm.updateFields({
+ currentnumber: {
+ value: currentnumber,
+ },
+ });
+ }
+ });
+ })
+ };
+ /**
+ * name: 保存预留设置
+ * param {*} params
+ * return {*}
+ */
+ handleSubmitReservedNumber = (params) => {
+ const { numberSet } = this.props;
+ const payload = { ...params, serialtype: "USER" };
+ numberSet.saveReservedCode(payload).then(({ api_status }) => {
+ if (api_status) {
+ message.success("保存成功");
+ this.numberSetRef.handleCloseReservedModal();
+ numberSet.getSearchReservedCodeList({
+ serialtype: "USER",
+ checkboxType: "multi",
+ });
+ }
+ });
+ };
+
+ /**
+ * name:提示文本
+ * return {*}
+ */
+ helpContent = () => {
+ return (
+
+
开启后,可根据设置的部门编号规则自动生成部门编号,涉及场景如下:
+
1.手动新建和手动编辑部门时可选择重新生成编号和选择预留部门编号;
+
2.导入人员-添加时,新创建的部门可自动生成部门编号;
+
3.组织结构导入-添加新部门且部门编号列为空时可自动生成部门编号;
+
【注意】开启前请先确认部门编号字段已启用!
+
+ );
+ };
+ render() {
+ const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
+ const { numberSet } = this.props;
+ const { details, serialenable, dateSerial, jobtitlesSerial, deptSerial } = subCompanyInfo;
+ const btns = [
+
,
+ ];
+ const dropMenuDatas = [
+ {
+ key: "save",
+ disabled: false,
+ icon:
,
+ content: "保存",
+ onClick: (key) => this.handleSubmit(),
+ },
+ ];
+ return (
+
+
}
+ iconBgcolor="#217346"
+ buttons={btns}
+ showDropIcon={true}
+ dropMenuDatas={dropMenuDatas}
+ />
+
+
+
+
+ this.setState({
+ subCompanyInfo: {
+ ...subCompanyInfo,
+ serialenable: checkVal,
+ },
+ })
+ }
+ />
+
+
+ {/* 内容区 */}
+ {serialenable === "1" && (
+
+
+
+
+
+
+ {!_.isEmpty(options) && (
+
+
+ {
+ !_.isEmpty(_.filter(options, item => ["YEAR", "MONTH", "DAY"].includes(item.key))) &&
+ !["YEAR", "MONTH", "DAY"].includes(item.key))) && 0 }}>
+
+
+
+ this.setState({
+ subCompanyInfo: {
+ ...subCompanyInfo,
+ dateSerial: {
+ ...dateSerial,
+ enable: isSingle,
+ key: isSingle == '0' ? 'YEAR' : dateSerial.key
+ },
+ },
+ })
+ }
+ />
+ {dateSerial.enable == "1" && (
+ ["YEAR", "MONTH", "DAY"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(2, 1) }))}
+ value={dateSerial.key}
+ detailtype={3}
+ supportCancel
+ onChange={(key) =>
+ this.setState({
+ subCompanyInfo: {
+ ...subCompanyInfo,
+ dateSerial: {
+ ...dateSerial,
+ key,
+ },
+ },
+ })
+ }
+ />
+ )}
+
+
+
+
+ }
+ {
+ !_.isEmpty(_.filter(options, item => ["SUBCOMPANY", "DEPARTMENT"].includes(item.key))) &&
+ !["JOBTITLES"].includes(item.key))) && 0 }}>
+
+
+
+ this.setState({
+ subCompanyInfo: {
+ ...subCompanyInfo,
+ deptSerial: {
+ ...deptSerial,
+ enable: isSingle,
+ },
+ },
+ })
+ }
+ />
+ {deptSerial.enable == "1" && (
+ ["SUBCOMPANY", "DEPARTMENT"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(0, 2) }))}
+ value={deptSerial.key}
+ detailtype={3}
+ supportCancel
+ onChange={(key) =>
+ this.setState({
+ subCompanyInfo: {
+ ...subCompanyInfo,
+ deptSerial: {
+ ...deptSerial,
+ key,
+ },
+ },
+ })
+ }
+ />
+ )}
+
+
+
+
+ }
+ {
+ !_.isEmpty(_.filter(options, item => ["JOBTITLES"].includes(item.key))) &&
+
+
+
+
+ this.setState({
+ subCompanyInfo: {
+ ...subCompanyInfo,
+ jobtitlesSerial: {
+ ...jobtitlesSerial,
+ enable: isSingle,
+ },
+ },
+ })
+ }
+ />
+
+
+
+
+ }
+
+
+ )}
+
+
+ (this.numberSetRef = dom)}
+ onSet={this.handleSetNumber}
+ companyInfo={subCompanyInfo}
+ loading={loading}
+ startNumberInfo={startNumberInfo}
+ onChange={this.handleChangeTable}
+ onSaveStartNumber={this.handleSubmitStartNumber}
+ onDeleteReservedNumber={this.deleteReservedNumber}
+ onAddReservedNumber={this.handleAddReservedNumber}
+ onSubmitReservedNumber={this.handleSubmitReservedNumber}
+ onSearchReservedNumberset={() =>
+ numberSet.getSearchReservedCodeList({
+ serialtype: "USER",
+ checkboxType: "multi",
+ })
+ }
+ />
+
+
+
+ )}
+
+
+ );
+ }
+}
diff --git a/pc4mobx/organization/components/postNumberSet/index.js b/pc4mobx/organization/components/postNumberSet/index.js
deleted file mode 100644
index 5866c6c..0000000
--- a/pc4mobx/organization/components/postNumberSet/index.js
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Author: 黎永顺
- * Description: 岗位编号设置
- * Date: 2022-06-06 09:37:39
- * LastEditTime: 2022-06-07 18:13:32
- */
-import React, { Component, Fragment } from "react";
-import { inject, observer } from "mobx-react";
-import { Button, message } from "antd";
-import {
- WeaTop,
- WeaFormItem,
- WeaCheckbox,
- WeaSearchGroup,
- WeaSelect,
- WeaHelpfulTip,
-} from "ecCom";
-import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
-import NumberComposition from "../branchNumSetting/components/numberComposition";
-import { i18n } from "../../public/i18n";
-import moment from "moment";
-import "../branchNumSetting/index.less";
-
-@inject("numberSet")
-@observer
-export default class PostNumberSet extends Component {
- constructor() {
- super();
- this.state = {
- options: [],
- loading: false,
- dataSource: [],
- startNumberInfo: {
- columns: [],
- dataSource: [],
- },
- subCompanyInfo: {
- details: [],
- serialenable: "0",
- dateSerial: {
- enable: "0",
- key: "",
- },
- },
- };
- }
-
- componentDidMount() {
- this.getCodeSetting();
- }
-
- getCodeSetting = () => {
- const { numberSet } = this.props;
- numberSet
- .getCodeSetting({ serialtype: "JOBTITLES" })
- .then(({ api_status, details, serialenable, dateSerial = {} }) => {
- if (api_status && !_.isEmpty(details)) {
- this.setState({
- subCompanyInfo: { details, serialenable, dateSerial },
- });
- }
- });
- };
-
- handleSubmit = () => {
- const { numberSet } = this.props;
- const { dataSource, subCompanyInfo } = this.state;
- const { serialenable, dateSerial } = subCompanyInfo;
- const details = _.map(dataSource, (it, showorder) => {
- const { numField, value: rulevalue } = it;
- return {
- ruletype: _.upperCase(numField),
- rulevalue,
- showorder,
- };
- });
- const payload = {
- datas: JSON.stringify({
- serialenable,
- details,
- dateSerial,
- serialtype: "JOBTITLES",
- }),
- };
- this.setState({ loading: true });
- numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
- this.setState({ loading: false });
- if (api_status) {
- message.success("保存成功");
- }
- });
- };
-
- handleChangeCode = (data) => {
- const tmpV = _.filter(
- data,
- (it) =>
- it.numField === "year" ||
- it.numField === "month" ||
- it.numField === "day"
- );
- this.setState({
- dataSource: _.cloneDeep(data),
- options: _.map(tmpV, (it) => {
- const { numFieldName: showname, numField: key } = it;
- return { key: _.upperCase(key), showname };
- }),
- });
- };
-
- handleSetNumber = (type) => {
- this.handleSubmit();
- const { numberSet } = this.props;
- if (type === "start") {
- const payload = {
- coderuleid: 3,
- type: "",
- dateStart: moment().format("YYYY"),
- dateEnd: moment().format("YYYY"),
- subCompanyId: "",
- deptId: "",
- jobtitlesId: "",
- };
- numberSet
- .getStartNumForm(payload)
- .then(({ api_status, columns, dataSource }) => {
- if (api_status) {
- this.setState({
- startNumberInfo: { columns, dataSource },
- });
- }
- });
- }
- };
- handleChangeTable = (newColumns, datas) => {
- this.setState({
- startNumberInfo: {
- ...this.state.startNumberInfo,
- columns: newColumns,
- dataSource: datas,
- },
- });
- };
-
- handleSubmitStartNumber = () => {
- const { numberSet } = this.props;
- const payload = {
- datas: JSON.stringify({
- coderuleid: 3,
- ...this.state.startNumberInfo,
- }),
- };
- numberSet.saveStartNum(payload).then(({ api_status }) => {
- if (api_status) {
- message.success("保存成功");
- this.numberSetRef.handleClose();
- }
- });
- };
-
- /**
- * name:提示文本
- * return {*}
- */
- helpContent = () => {
- return (
-
-
开启后,可根据设置的岗位编号规则自动生成岗位编号,涉及场景如下:
-
1.新建岗位和编辑岗位时可选择重新生成编号和选择预留编号;
-
2.导入人员-添加时,新创建的岗位可自动生成岗位编号;
-
3.岗位导入新岗位且岗位编号列为空时可自动生成编号;
-
- );
- };
- render() {
- const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
- const { details, serialenable, dateSerial } = subCompanyInfo;
- const btns = [
-
,
- ];
- const dropMenuDatas = [
- {
- key: "save",
- disabled: false,
- icon:
,
- content: "保存",
- onClick: (key) => this.handleSubmit(),
- },
- ];
- return (
-
-
}
- iconBgcolor="#217346"
- buttons={btns}
- showDropIcon={true}
- dropMenuDatas={dropMenuDatas}
- />
-
-
-
-
- this.setState({
- subCompanyInfo: {
- ...subCompanyInfo,
- serialenable: checkVal,
- },
- })
- }
- />
-
-
- {/* 内容区 */}
- {serialenable === "1" && (
-
-
-
-
-
-
- {!_.isEmpty(options) && (
-
-
-
-
-
-
- this.setState({
- subCompanyInfo: {
- ...subCompanyInfo,
- dateSerial: {
- ...dateSerial,
- enable: isSingle,
- },
- },
- })
- }
- />
- {dateSerial.enable == "1" && (
-
- this.setState({
- subCompanyInfo: {
- ...subCompanyInfo,
- dateSerial: {
- ...dateSerial,
- key,
- },
- },
- })
- }
- />
- )}
-
-
-
-
-
-
- )}
-
-
- (this.numberSetRef = dom)}
- onSet={this.handleSetNumber}
- startNumberInfo={startNumberInfo}
- onChange={this.handleChangeTable}
- onSaveStartNumber={this.handleSubmitStartNumber}
- />
-
-
-
- )}
-
-
- );
- }
-}
diff --git a/pc4mobx/organization/components/resourceNumberSet/index.js b/pc4mobx/organization/components/resourceNumberSet/index.js
deleted file mode 100644
index dda9ed6..0000000
--- a/pc4mobx/organization/components/resourceNumberSet/index.js
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Author: 黎永顺
- * Description: 岗位编号设置
- * Date: 2022-06-06 09:37:39
- * LastEditTime: 2022-06-07 18:12:11
- */
-import React, { Component, Fragment } from "react";
-import { inject, observer } from "mobx-react";
-import { Button, message } from "antd";
-import {
- WeaTop,
- WeaFormItem,
- WeaCheckbox,
- WeaSearchGroup,
- WeaSelect,
- WeaHelpfulTip,
-} from "ecCom";
-import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
-import NumberComposition from "../branchNumSetting/components/numberComposition";
-import { i18n } from "../../public/i18n";
-import moment from "moment";
-import "../branchNumSetting/index.less";
-
-@inject("numberSet")
-@observer
-export default class ResourceNumberSet extends Component {
- constructor() {
- super();
- this.state = {
- options: [],
- loading: false,
- dataSource: [],
- startNumberInfo: {
- columns: [],
- dataSource: [],
- },
- subCompanyInfo: {
- details: [],
- serialenable: "0",
- dateSerial: {
- enable: "0",
- key: "",
- },
- },
- };
- }
-
- componentDidMount() {
- this.getCodeSetting();
- }
-
- getCodeSetting = () => {
- const { numberSet } = this.props;
- numberSet
- .getCodeSetting({ serialtype: "USER" })
- .then(({ api_status, details, serialenable, dateSerial = {} }) => {
- if (api_status && !_.isEmpty(details)) {
- this.setState({
- subCompanyInfo: { details, serialenable, dateSerial },
- });
- }
- });
- };
-
- handleSubmit = () => {
- const { numberSet } = this.props;
- const { dataSource, subCompanyInfo } = this.state;
- const { serialenable, dateSerial } = subCompanyInfo;
- const details = _.map(dataSource, (it, showorder) => {
- const { numField, value: rulevalue } = it;
- return {
- ruletype: _.upperCase(numField),
- rulevalue,
- showorder,
- };
- });
- const payload = {
- datas: JSON.stringify({
- serialenable,
- details,
- dateSerial,
- serialtype: "USER",
- }),
- };
- this.setState({ loading: true });
- numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
- this.setState({ loading: false });
- if (api_status) {
- message.success("保存成功");
- }
- });
- };
-
- handleChangeCode = (data) => {
- const tmpV = _.filter(
- data,
- (it) =>
- it.numField === "year" ||
- it.numField === "month" ||
- it.numField === "day"
- );
- this.setState({
- dataSource: _.cloneDeep(data),
- options: _.map(tmpV, (it) => {
- const { numFieldName: showname, numField: key } = it;
- return { key: _.upperCase(key), showname };
- }),
- });
- };
-
- handleSetNumber = (type) => {
- this.handleSubmit();
- const { numberSet } = this.props;
- if (type === "start") {
- const payload = {
- coderuleid: 4,
- type: "",
- dateStart: moment().format("YYYY"),
- dateEnd: moment().format("YYYY"),
- subCompanyId: "",
- deptId: "",
- jobtitlesId: "",
- };
- numberSet
- .getStartNumForm(payload)
- .then(({ api_status, columns, dataSource }) => {
- if (api_status) {
- this.setState({
- startNumberInfo: { columns, dataSource },
- });
- }
- });
- }
- };
- handleChangeTable = (newColumns, datas) => {
- this.setState({
- startNumberInfo: {
- ...this.state.startNumberInfo,
- columns: newColumns,
- dataSource: datas,
- },
- });
- };
-
- handleSubmitStartNumber = () => {
- const { numberSet } = this.props;
- const payload = {
- datas: JSON.stringify({
- coderuleid: 4,
- ...this.state.startNumberInfo,
- }),
- };
- numberSet.saveStartNum(payload).then(({ api_status }) => {
- if (api_status) {
- message.success("保存成功");
- this.numberSetRef.handleClose();
- }
- });
- };
-
- /**
- * name:提示文本
- * return {*}
- */
- helpContent = () => {
- return (
-
-
开启后,可根据设置的人员编号规则自动生成人员编号,涉及场景如下:
-
1.手动新建和手动编辑人员时可选择自动生成和选择预留人员编号;
-
- 2.导入人员类型选择-添加,导入Excel中人员编号为空时,可自动生成人员编号;
-
-
3.人员入职流程中人员编号字段为空时可自动生成人员编号;
-
- );
- };
- render() {
- const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
- const { details, serialenable, dateSerial } = subCompanyInfo;
- const btns = [
-
,
- ];
- const dropMenuDatas = [
- {
- key: "save",
- disabled: false,
- icon:
,
- content: "保存",
- onClick: (key) => this.handleSubmit(),
- },
- ];
- return (
-
-
}
- iconBgcolor="#217346"
- buttons={btns}
- showDropIcon={true}
- dropMenuDatas={dropMenuDatas}
- />
-
-
-
-
- this.setState({
- subCompanyInfo: {
- ...subCompanyInfo,
- serialenable: checkVal,
- },
- })
- }
- />
-
-
- {/* 内容区 */}
- {serialenable === "1" && (
-
-
-
-
-
-
- {!_.isEmpty(options) && (
-
-
-
-
-
-
- this.setState({
- subCompanyInfo: {
- ...subCompanyInfo,
- dateSerial: {
- ...dateSerial,
- enable: isSingle,
- },
- },
- })
- }
- />
- {dateSerial.enable == "1" && (
-
- this.setState({
- subCompanyInfo: {
- ...subCompanyInfo,
- dateSerial: {
- ...dateSerial,
- key,
- },
- },
- })
- }
- />
- )}
-
-
-
-
-
-
- )}
-
-
- (this.numberSetRef = dom)}
- onSet={this.handleSetNumber}
- startNumberInfo={startNumberInfo}
- onChange={this.handleChangeTable}
- onSaveStartNumber={this.handleSubmitStartNumber}
- />
-
-
-
- )}
-
-
- );
- }
-}
diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js
index 917c942..e51c7ef 100644
--- a/pc4mobx/organization/index.js
+++ b/pc4mobx/organization/index.js
@@ -11,10 +11,10 @@ import Sequence from "./components/sequence/Sequence";
import Group from "./components/group/Group";
import OfficeManage from "./components/office/officeManage";
import CompanyExtend from "./components/company/CompanyExtend";
-import BranchNumSetting from "./components/branchNumSetting";
-import DeptNumberSet from "./components/deptNumberSet";
-import PostNumberSet from "./components/postNumberSet";
-import ResourceNumberSet from "./components/resourceNumberSet";
+import BranchNumSetting from "./components/numberSetting/branchNumSetting";
+import DeptNumberSet from "./components/numberSetting/deptNumberSet";
+import PostNumberSet from "./components/numberSetting/postNumberSet";
+import ResourceNumberSet from "./components/numberSetting/resourceNumberSet";
import Company from "./components/company/company";
import StaffScheme from "./components/staff/StaffScheme";
import Staff from "./components/staff/Staff";
diff --git a/pc4mobx/organization/stores/numberSet.js b/pc4mobx/organization/stores/numberSet.js
index 55917a5..6a8610a 100644
--- a/pc4mobx/organization/stores/numberSet.js
+++ b/pc4mobx/organization/stores/numberSet.js
@@ -2,13 +2,74 @@
* Author: 黎永顺
* Description: 编号设置
* Date: 2022-06-07 09:54:46
- * LastEditTime: 2022-06-07 17:00:49
+ * LastEditTime: 2022-06-15 13:09:28
*/
import { observable, action } from "mobx";
+import { WeaForm } from "comsMobx";
+import { WeaTableNew } from "comsMobx";
import * as mobx from "mobx";
import * as API from "../apis/numberSet"; // 引入API接口文件
+const { TableStore } = WeaTableNew;
+
export class NumberSetStore {
+ @observable searchCondition = []; //高级搜索框form数据
+ @observable tableStore = new TableStore(); //列表store
+ @observable form = new WeaForm(); //高级搜索渲染的表单
+ @observable condition = []; //新增职务信息form数据
+ @observable reservedForm = new WeaForm(); //新增预留编号表单
+
+ @action("高级搜索表单渲染")
+ getAdvanceSearchCondition() {
+ API.getAdvanceSearchCondition().then(({ api_status, conditions }) => {
+ if (api_status && !_.isEmpty(conditions)) {
+ this.setSearchCondition(conditions);
+ this.form.initFormFields(conditions);
+ }
+ });
+ }
+
+ @action("获取表格数据")
+ getSearchReservedCodeList(params) {
+ const payload = {
+ ...this.form.getFormParams(),
+ ...params,
+ };
+ API.getSearchReservedCodeList(payload).then(
+ ({ api_status, sessionkey }) => {
+ if (api_status && !_.isEmpty(sessionkey)) {
+ this.tableStore.getDatas(sessionkey, 1);
+ }
+ }
+ );
+ }
+
+ @action("新增预留编号表单查询")
+ getReservedCodeFrom(payload) {
+ return API.getReservedCodeFrom(payload).then(({ api_status, conditioninfo }) => {
+ if (api_status && !_.isEmpty(conditioninfo)) {
+ conditioninfo.map((c) =>
+ c.items.map((item) => {
+ if (item.domkey[0] == "YEAR") {
+ item.value = item.value.toString();
+ }
+ })
+ );
+ this.setCondition(conditioninfo);
+ this.reservedForm.initFormFields(conditioninfo);
+ }
+ });
+ }
+ @action
+ setCondition(condition) {
+ this.condition = condition;
+ }
+
+ @action
+ setSearchCondition(condition) {
+ this.searchCondition = condition;
+ }
+
@action
getCodeSetting(params) {
return API.getCodeSetting(params);
@@ -23,8 +84,19 @@ export class NumberSetStore {
getStartNumForm(params) {
return API.getStartNumForm(params);
}
+
@action
saveStartNum(params) {
return API.saveStartNum(params);
}
-}
+
+ @action("删除预留编号")
+ deleteReservedCodeById(params) {
+ return API.deleteReservedCodeById(params);
+ }
+
+ @action("保存预留编号")
+ saveReservedCode(params) {
+ return API.saveReservedCode(params);
+ }
+}
\ No newline at end of file
From 2d1c75698524c496bb7f5d829d7ff56782c621a6 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Thu, 16 Jun 2022 08:43:36 +0800
Subject: [PATCH 021/155] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E6=A0=91=E5=92=8Ctab=E6=8E=A5=E5=8F=A3=E5=AF=B9?=
=?UTF-8?q?=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/fieldDefined.js | 29 +-
.../fieldDefinedSet/FieldDefined.js | 10 +-
pc4mobx/organization/public/i18n.js | 1 +
pc4mobx/organization/stores/companyextend.js | 2 +-
pc4mobx/organization/stores/fieldDefined.js | 272 +++++++-----------
5 files changed, 137 insertions(+), 177 deletions(-)
diff --git a/pc4mobx/organization/apis/fieldDefined.js b/pc4mobx/organization/apis/fieldDefined.js
index 5a5a66a..a642d7d 100644
--- a/pc4mobx/organization/apis/fieldDefined.js
+++ b/pc4mobx/organization/apis/fieldDefined.js
@@ -7,7 +7,7 @@ import {
* @param {Object} params [description]
* @return {[type]} [description]
*/
-export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/getTabInfo?is_multilang_set=true`, 'GET', params)
+export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi('/api/bs/hrmorganization/fieldDefined/getTabInfo', 'GET', params)
export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/getFieldDefinedInfo?is_multilang_set=true`, 'GET', params)
@@ -15,11 +15,34 @@ export const saveFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callAp
export const removeFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/del`, 'POST', params)
-export const saveGroupInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/saveGroup`, 'POST', params)
+export const saveGroupInfo = (moduleName,params) => {
+ return fetch('/api/bs/hrmorganization/fieldDefined/saveTitle', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+
+export const changeTypeInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeTree`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+
export const removeGroupInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/delGroup`, 'POST', params)
-export const getTree = (params = {}) => WeaTools.callApi(`/api/hrm/resourcefielddefined/getTree`, 'GET', params)
+export const getTree = (moduleName,params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTree`, 'GET', params)
export const saveTree = (params = {}) => WeaTools.callApi(`/api/hrm/resourcefielddefined/saveTree`, 'POST', params)
diff --git a/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js b/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
index d835966..698ff79 100644
--- a/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
+++ b/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
@@ -56,13 +56,15 @@ export default class FieldDefined extends Component {
let moduleName, logSmallType;
if (moduleType === 'subCompany') {
moduleName = 'subcompanyfielddefined';
- logSmallType = 'HRM_ENGINE_SUBCOMPANYFIELDDEFINED';
+ //logSmallType = 'HRM_ENGINE_SUBCOMPANYFIELDDEFINED';
} else if (moduleType === 'department') {
moduleName = 'departmentfielddefined';
- logSmallType = 'HRM_ENGINE_DEPARTMENTFIELDDEFINED';
- } else {
+ //logSmallType = 'HRM_ENGINE_DEPARTMENTFIELDDEFINED';
+ } else if(moduleType === 'job') {
+ moduleName = 'jobfielddefined';
+ }else {
moduleName = 'resourcefielddefined';
- logSmallType = 'HRM_ENGINE_RESOURCEFIELDDEFINED';
+ //logSmallType = 'HRM_ENGINE_RESOURCEFIELDDEFINED';
}
// let callbackFunc = () => initData(false, true, moduleName);
// if (moduleType === 'resource')
diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js
index 567877f..fad5e61 100644
--- a/pc4mobx/organization/public/i18n.js
+++ b/pc4mobx/organization/public/i18n.js
@@ -843,6 +843,7 @@ export const i18n = {
button: {
back: () => getLabel(1290, '返回'),
createType: () => getLabel(30131, '新建类型'),
+ editTypeInfo: () => getLabel(32732, '编辑类型'),
batchOpen: () => getLabel(534249, '批量解锁'),
collect: () => getLabel(28111, '收藏'),
diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js
index 95ba257..8079896 100644
--- a/pc4mobx/organization/stores/companyextend.js
+++ b/pc4mobx/organization/stores/companyextend.js
@@ -56,9 +56,9 @@ export class CompanyExtendStore {
save = () => {
if (this.loading)
return;
- this.loading = true;
this.form.validateForm().then(f => {
if (f.isValid) {
+ this.loading = true;
if (this.personalEditTables) {
const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas,
isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true
diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js
index d034da6..e64f25f 100644
--- a/pc4mobx/organization/stores/fieldDefined.js
+++ b/pc4mobx/organization/stores/fieldDefined.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:16:00
- * @LastEditTime: 2022-06-13 16:55:34
+ * @LastEditTime: 2022-06-15 18:47:39
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js
*/
@@ -67,7 +67,9 @@ export class FieldDefinedStore extends HrmBaseStore {
}, {
comType: 'button',
type: 'primary',
- onClickHandle: () => this.editType(),
+ onClickHandle: () => this.editTypeInfo(true, {
+ name: this.selectedTreeNodeInfo.name,
+ }),
label: i18n.button.createType,
icon: this.menuIconCollection.create
}, {
@@ -504,7 +506,7 @@ export class FieldDefinedStore extends HrmBaseStore {
"items": [{
"colSpan": 2,
"conditionType": "INPUT",
- "domkey": ["typeName"],
+ "domkey": ["name"],
"fieldcol": 12,
"isQuickSearch": false,
"label": i18n.label.typeName,
@@ -513,59 +515,6 @@ export class FieldDefinedStore extends HrmBaseStore {
"rules": "required|string",
"value": "",
"viewAttr": 3,
- }, {
- "belong": "PC",
- "checkbox": false,
- "checkboxValue": false,
- "colSpan": 2,
- "conditionType": "SELECT",
- "dateGroup": false,
- "defaultDisplayInBar": false,
- "detailtype": 3,
- "domkey": [
- "tableType"
- ],
- "entSearch": false,
- "fieldcol": 16,
- "hasBorder": false,
- "helpfulTipProps": {},
- "hide": false,
- "isBase64": false,
- "isQuickSearch": false,
- "label": "新增到",
- "labelcol": 6,
- "length": 0,
- "maxFilesNumber": 0,
- "maxUploadSize": 0,
- "multiSelection": false,
- "multiple": false,
- "options": [
- {
- "disabled": false,
- "key": "0",
- "selected": false,
- "showname": "主表",
- "visible": true
- },
- {
- "disabled": false,
- "key": "1",
- "selected": false,
- "showname": "明细表",
- "visible": true
- }
- ],
- "precision": 0,
- "secretLimit": false,
- "showOrder": 0,
- "showTime": false,
- "stringLength": 0,
- "supportCancel": false,
- "tipPosition": "bottom",
- "value": "0",
- "valueList": [],
- "rules": "required|string",
- "viewAttr": 3
}],
"defaultshow": true
}]
@@ -821,7 +770,7 @@ export class FieldDefinedStore extends HrmBaseStore {
this.dialogParams.childInfoSetting.visible && this.doSaveChildInfoSetting();
}
- @action editGroup = (group, moveToGroup = false) => {
+ @action("新建分组") editGroup = (group, moveToGroup = false) => {
this.moveToGroup = moveToGroup;
this.editGroupInfoFormFields.map(f => {
if (typeof (f.title) == 'function')
@@ -851,7 +800,9 @@ export class FieldDefinedStore extends HrmBaseStore {
this.setDialogVisible('editGroupInfo', true, dialogTitle);
}
- @action editType = () => {
+ isCreateTypeInfo = false;
+ @action("新增或创建类型") editTypeInfo = (create = true, data = {}) => {
+ this.isCreateTypeInfo = create;
this.editTypeInfoFormFields.map(f => {
if (typeof (f.title) == 'function')
f.title = f.title();
@@ -862,17 +813,20 @@ export class FieldDefinedStore extends HrmBaseStore {
})
})
let fields = [...this.editTypeInfoFormFields],
- dialogTitle = '';
+ dialogTitle = create ? i18n.button.createType() : i18n.button.editTypeInfo();
this.setFormData('typeInfoFrom', fields);
- // this.formTarget.typeInfoFrom.updateFields({
- // typeName: { value: '' }
- // });
- // this.opId = null;
- dialogTitle = i18n.button.createType();
+ if (!create) {
+ this.formTarget.typeInfoFrom.updateFields({
+ name: { value: data.name }
+ });
+ }else {
+ this.selectedTreeNodeInfo.domid = null;
+ }
+
this.setDialogVisible('editTypeInfo', true, dialogTitle);
}
- @action doGroupSetting = () => {
+ @action("分组维护") doGroupSetting = () => {
this.tableEditConfig.groupSetting.datas.length = 0;
let arr = [];
this.tabRecord.map(tabInfo => {
@@ -920,36 +874,27 @@ export class FieldDefinedStore extends HrmBaseStore {
}
- @action doSaveTypeInfo = () => {
+ @action("保存类型") doSaveTypeInfo = () => {
this.formTarget.typeInfoFrom.validateForm().then(f => {
if (f.isValid) {
- let record = {
- ...this.formTarget.typeInfoFrom.getFormParams(),
- }
+ debugger
let params = {
- data: JSON.stringify({
- record: record
- })
+ ... this.formTarget.typeInfoFrom.getFormParams(),
+ id: this.selectedTreeNodeInfo.domid
}
- // api.saveTypeInfo(this.moduleName, params).then(data => {
- // if (data.status === '1') {
- // this.setDialogVisible('editGroupInfo', false, '');
- // if (this.moveToGroup) {
- // const ids = data.groupid.split(',');
- // this.changeGroup(null, ids[ids.length - 1]);
- // } else {
- // //if (this.moduleName.indexOf('resource') >= 0)
- // this.getTabInfoByTreeNode();
- // // else
- // // this.initData(this.opId == null);
- // message.success(i18n.message.saveSuccess());
- // }
- // } else
- // message.error(data.message);
- // }, error => {
- // message.error(i18n.message.actionError());
- // });
- this.getTree()
+ api.changeTypeInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ this.setDialogVisible('editTypeInfo', false, '');
+ this.getTree()
+ message.success(i18n.message.saveSuccess());
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
} else {
f.showErrors();
this.showError = new Date().getTime();
@@ -957,7 +902,7 @@ export class FieldDefinedStore extends HrmBaseStore {
});
}
- doSaveGroupInfo = () => {
+ @action("分组保存") doSaveGroupInfo = () => {
this.formTarget.groupInfoFrom.validateForm().then(f => {
if (f.isValid) {
let record = {
@@ -972,51 +917,33 @@ export class FieldDefinedStore extends HrmBaseStore {
this.showError = new Date().getTime();
return;
}
- let found = false,
- records = [];
- this.opId != null && Object.assign(record, {
- id: this.opId,
- isShow: this.activeTabInfo.tabInfo.isShow
- });
- this.tabConfig.tabs.map(tabInfo => {
- if (tabInfo.groupid === this.opId) {
- found = true;
- records.push(record)
- } else {
- records.push({
- id: tabInfo.groupid,
- isShow: tabInfo.isShow,
- groupName: tabInfo.title
- })
- }
- });
- !found && records.push(record);
let params = {
- data: JSON.stringify({
- records: records
- })
+ ...this.formTarget.groupInfoFrom.getFormParams(),
+ isShow: 1
}
+
if (this.selectedTreeNodeInfo != null)
params.groupType = this.selectedTreeNodeInfo.key
- api.saveGroupInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+ api.saveGroupInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
this.setDialogVisible('editGroupInfo', false, '');
if (this.moveToGroup) {
- const ids = data.groupid.split(',');
+ const ids = data.data.groupid.split(',');
this.changeGroup(null, ids[ids.length - 1]);
} else {
- //if (this.moduleName.indexOf('resource') >= 0)
this.getTabInfoByTreeNode();
- // else
- // this.initData(this.opId == null);
message.success(i18n.message.saveSuccess());
}
- } else
- message.error(data.message);
- }, error => {
- message.error(i18n.message.actionError());
- });
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+
} else {
f.showErrors();
this.showError = new Date().getTime();
@@ -1341,7 +1268,8 @@ export class FieldDefinedStore extends HrmBaseStore {
dataObj.groupType = this.selectedTreeNodeInfo.key;
params.groupType = this.selectedTreeNodeInfo.key;
}
- params.data = JSON.stringify(dataObj);
+ params.data = dataObj;
+
api.saveGroupInfo(this.moduleName, params).then(data => {
if (data.status === '1') {
this.setDialogVisible('groupInfoSetting', false, '');
@@ -1355,6 +1283,7 @@ export class FieldDefinedStore extends HrmBaseStore {
}, error => {
message.error(i18n.message.actionError());
});
+
} else {
message.error(i18n.confirm.groupNameExist());
}
@@ -1446,27 +1375,21 @@ export class FieldDefinedStore extends HrmBaseStore {
this.selectedTreeNodeInfo = null;
this.dropdownSelectedKey = '1';
this.moduleName = module;
- // let columns = cloneDeep(this.fieldDefColumns())
- // columns.splice(1, 1);
- // columns[1].width = '65%';
- // this.tableEditConfig.fieldDef.columns = this.getColumns();
this.treeConfig.treeExpandKeys.length = 0;
- api.getTree().then(data => {
- if (data.status === '1') {
+ api.getTree(this.moduleName).then(res => {
+ if (res.code === 200) {
this.containerInitFinished = {
...this.containerInitFinished,
init: true
}
-
- // this.setTableEditColTitle();
- if (data.treejson.length > 0) {
- this.treeConfig.data = data.treejson;
- this.treeConfig.selectedKeys = [data.treejson[0].key];
- this.selectedTreeNodeInfo = data.treejson[0];
+ if (res.data.length > 0) {
+ this.treeConfig.data = res.data;
+ this.treeConfig.selectedKeys = [res.data[0].key];
+ this.selectedTreeNodeInfo = res.data[0];
this.getTabInfoByTreeNode(null, true);
}
} else {
- message.error(data.message);
+ message.error(res.msg);
}
}, error => { })
}
@@ -1474,9 +1397,9 @@ export class FieldDefinedStore extends HrmBaseStore {
getTree = (callback) => {
this.treeConfig.data.length = 0;
this.refreshTree = new Date().getTime();
- api.getTree().then(data => {
- if (data.status === '1') {
- this.treeConfig.data = data.treejson;
+ api.getTree(this.moduleName).then(res => {
+ if (res.code === 200) {
+ this.treeConfig.data = res.data;
this.treeConfig.data.map(p => {
if (p.domid === this.treeConfig.selectedKeys[0])
this.selectedTreeNodeInfo = p;
@@ -1487,7 +1410,7 @@ export class FieldDefinedStore extends HrmBaseStore {
})
callback && callback();
} else {
- message.error(data.message);
+ message.error(res.msg);
}
this.refreshTree = new Date().getTime();
}, error => { })
@@ -1497,38 +1420,46 @@ export class FieldDefinedStore extends HrmBaseStore {
if (!this.selectedTreeNodeInfo.hasGroup) {
t.topButtonDef.splice(1, 3);
}
- if (this.selectedTreeNodeInfo.addChild) {
+ t.topButtonDef.push({
+ comType: 'button',
+ type: 'primary',
+ onClickHandle: () => this.editTypeInfo(false, {
+ name: this.selectedTreeNodeInfo.name,
+ }),
+ label: i18n.button.editTypeInfo(),
+ icon: this.menuIconCollection.setting
+ })
+ if (this.selectedTreeNodeInfo.addChild) { //非子节点
this.tableEditConfig.childInfoSetting.showTitle = true;
this.tableEditConfig.childInfoSetting.showAdd = true;
this.tableEditConfig.childInfoSetting.showDelete = true;
- // this.selectedTreeNodeInfo.domid != '-1' && t.topButtonDef.push({
- // comType: 'button',
- // type: 'primary',
- // onClickHandle: this.doChildInfoSetting,
- // label: i18n.button.childInfoMaintain(),
- // icon: this.menuIconCollection.setting,
- // checkAction: 'childInfoOperability'
- // });
+ let domid = this.selectedTreeNodeInfo.domid;
+ //非基本类型()
+ (domid != '-1' && domid != '-2' && domid != '-3' && domid != '-4') && t.topButtonDef.push({
+ comType: 'button',
+ type: 'primary',
+ onClickHandle: this.doChildInfoSetting,
+ label: i18n.button.childInfoMaintain(),
+ icon: this.menuIconCollection.setting,
+ checkAction: 'childInfoOperability'
+ }) && t.topButtonDef.push({
+ comType: 'button',
+ type: 'primary',
+ onClickHandle: this.removeTypeInfo,
+ label: i18n.button.delete(),
+ icon: this.menuIconCollection.setting
+ });
} else {
this.tableEditConfig.childInfoSetting.showTitle = false;
this.tableEditConfig.childInfoSetting.showAdd = false;
this.tableEditConfig.childInfoSetting.showDelete = false;
- this.selectedTreeNodeInfo.domid != '-1' && t.topButtonDef.push({
+ t.topButtonDef.push({
comType: 'button',
type: 'primary',
- onClickHandle: () => this.createChildInfo(false, {
- name: this.selectedTreeNodeInfo.name,
- multiName: this.selectedTreeNodeInfo.multiName
- }),
- label: i18n.button.editChildInfo(),
- icon: this.menuIconCollection.setting
- }) && t.topButtonDef.push({
- comType: 'button',
- type: 'primary',
- onClickHandle: this.removeChildInfo,
+ onClickHandle: this.removeTypeInfo,
label: i18n.button.delete(),
icon: this.menuIconCollection.setting
- });
+ })
}
if (this.selectedTreeNodeInfo.domid === '-1' || this.selectedTreeNodeInfo.addChild) {
@@ -1553,12 +1484,12 @@ export class FieldDefinedStore extends HrmBaseStore {
@action getTabInfoByTreeNode = (create = false, init = false, isLeaf) => {
api.getTabInfo(this.moduleName, {
groupType: this.treeConfig.selectedKeys[0]
- }).then(data => {
- if (data.status === '1') {
- this._groupInfoOperability = data.tabs.length === 0;
+ }).then(res => {
+ if (res.code === 200) {
+ this._groupInfoOperability = res.data.tabs.length === 0;
let tabArr = [];
- this.tabRecord = data.tabs;
- data.tabs && data.tabs.map((tabInfo, index) => {
+ this.tabRecord = res.data.tabs;
+ res.data.tabs && res.data.tabs.map((tabInfo, index) => {
let t = cloneDeep(this.tabDef);
this.setBtn(t);
tabArr.push({
@@ -1616,6 +1547,9 @@ export class FieldDefinedStore extends HrmBaseStore {
this.setDialogVisible('createChildInfo', true, dialogTitle);
}
+
+
+
@action doSaveChildInfo = () => {
this.formTarget.childInfoForm.validateForm().then(f => {
if (f.isValid) {
From 19e1d07e3c4153b3bf801d9aec9b990a63078e93 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Thu, 16 Jun 2022 18:35:17 +0800
Subject: [PATCH 022/155] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/fieldDefined.js | 59 ++++--
.../fieldDefinedSet/FieldDefined.js | 15 +-
pc4mobx/organization/stores/baseStore.js | 3 +-
pc4mobx/organization/stores/fieldDefined.js | 180 ++++++++++--------
4 files changed, 155 insertions(+), 102 deletions(-)
diff --git a/pc4mobx/organization/apis/fieldDefined.js b/pc4mobx/organization/apis/fieldDefined.js
index a642d7d..8306fbb 100644
--- a/pc4mobx/organization/apis/fieldDefined.js
+++ b/pc4mobx/organization/apis/fieldDefined.js
@@ -7,16 +7,12 @@ import {
* @param {Object} params [description]
* @return {[type]} [description]
*/
-export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi('/api/bs/hrmorganization/fieldDefined/getTabInfo', 'GET', params)
+export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTabInfo`, 'GET', params)
-export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/getFieldDefinedInfo?is_multilang_set=true`, 'GET', params)
+export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getFieldDefinedInfo`, 'GET', params)
-export const saveFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/save`, 'POST', params)
-
-export const removeFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/del`, 'POST', params)
-
-export const saveGroupInfo = (moduleName,params) => {
- return fetch('/api/bs/hrmorganization/fieldDefined/saveTitle', {
+export const saveFieldDefinedInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
method: 'POST',
mode: 'cors',
headers: {
@@ -26,6 +22,30 @@ export const saveGroupInfo = (moduleName,params) => {
})
}
+export const removeFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/del`, 'POST', params)
+
+export const saveGroupInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+
+export const saveGroupSettingInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveGroup`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
export const changeTypeInfo = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeTree`, {
@@ -38,13 +58,30 @@ export const changeTypeInfo = (moduleName,params) => {
})
}
+export const removeGroupInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTitle`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
-export const removeGroupInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/delGroup`, 'POST', params)
-
export const getTree = (moduleName,params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTree`, 'GET', params)
-export const saveTree = (params = {}) => WeaTools.callApi(`/api/hrm/resourcefielddefined/saveTree`, 'POST', params)
+export const saveTree = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTree`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
export const changeGroup = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/changeGroup`, 'POST', params)
diff --git a/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js b/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
index 698ff79..c2812e6 100644
--- a/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
+++ b/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
@@ -56,20 +56,18 @@ export default class FieldDefined extends Component {
let moduleName, logSmallType;
if (moduleType === 'subCompany') {
moduleName = 'subcompanyfielddefined';
- //logSmallType = 'HRM_ENGINE_SUBCOMPANYFIELDDEFINED';
} else if (moduleType === 'department') {
moduleName = 'departmentfielddefined';
- //logSmallType = 'HRM_ENGINE_DEPARTMENTFIELDDEFINED';
} else if(moduleType === 'job') {
moduleName = 'jobfielddefined';
}else {
moduleName = 'resourcefielddefined';
- //logSmallType = 'HRM_ENGINE_RESOURCEFIELDDEFINED';
}
// let callbackFunc = () => initData(false, true, moduleName);
// if (moduleType === 'resource')
- let callbackFunc = () => initResourceData(moduleName);
- checkAuthorized(moduleName, null, callbackFunc);
+ //let callbackFunc = () => initResourceData(moduleName);
+ //checkAuthorized(moduleName, null, callbackFunc);
+ initResourceData(moduleName);
this.setState({ logSmallType })
}
@@ -87,7 +85,7 @@ export default class FieldDefined extends Component {
fieldDefined: store,
params
} = this.props, {
- containerInitFinished,
+ //containerInitFinished,//权限验证
refreshMainTabComponent,
spinning
} = store, {
@@ -145,7 +143,8 @@ export default class FieldDefined extends Component {
}
}
let children = [];
- if (containerInitFinished.init && containerInitFinished.authorized) {
+ const hasRight = true;//todo
+ if (hasRight) {
const {
data,
onSelectedTreeNode,
@@ -176,7 +175,7 @@ export default class FieldDefined extends Component {
)
]
- } else if (containerInitFinished.init && !containerInitFinished.authorized) {
+ } else {
children = [
(
diff --git a/pc4mobx/organization/stores/baseStore.js b/pc4mobx/organization/stores/baseStore.js
index 0a23a00..fe5b741 100644
--- a/pc4mobx/organization/stores/baseStore.js
+++ b/pc4mobx/organization/stores/baseStore.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:14:20
- * @LastEditTime: 2022-06-13 14:50:36
+ * @LastEditTime: 2022-06-16 18:26:17
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/baseStore.js
*/
@@ -540,6 +540,7 @@ export default class HrmBaseStore {
return otherParams;
}
+ //重新计算列
convertData = (datas, target) => {
let tData = [],
selectedData = this.generateTableSelectedData(target);
diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js
index e64f25f..c2950f2 100644
--- a/pc4mobx/organization/stores/fieldDefined.js
+++ b/pc4mobx/organization/stores/fieldDefined.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:16:00
- * @LastEditTime: 2022-06-15 18:47:39
+ * @LastEditTime: 2022-06-16 18:34:18
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js
*/
@@ -648,10 +648,10 @@ export class FieldDefinedStore extends HrmBaseStore {
this.tabConfig.tabs = [...tabArr];
// this.setTableEditColTitle();
this.setActiveTab(this.tabConfig, init ? '1' : !create ? this.tabConfig.activeTabKey : `${tabArr.length}`);
- this.containerInitFinished = {
- ...this.containerInitFinished,
- init: true
- }
+ // this.containerInitFinished = {
+ // ...this.containerInitFinished,
+ // init: true
+ // }
}
} else {
message.error(data.message);
@@ -696,38 +696,38 @@ export class FieldDefinedStore extends HrmBaseStore {
if (this.selectedTreeNodeInfo != null)
params.groupType = this.selectedTreeNodeInfo.key
this.spinning = true;
- api.getFieldDefinedInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+
+ api.getFieldDefinedInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(res => {
+ if (res.code === 200) {
const {
datas,
selectedData
- } = this.convertData(data.data, 'fieldDef');
- this.encryptEnable = data.encryptEnable;
+ } = this.convertData(res.data.data, 'fieldDef');
+ this.encryptEnable = res.data.encryptEnable;
this.tableEditConfig.fieldDef.datas = datas;
this.tableEditConfig.fieldDef.columns = this.getColumns();
-
- //人员卡片字段定义columns是动态的,因此需要重新计算得出selectedData
- if (this.moduleName === 'resourcefielddefined') {
- const {
- selectedData
- } = this.convertData(data.data, 'fieldDef');
- this.tableEditConfig.fieldDef.selectedData = selectedData;
- } else {
- this.tableEditConfig.fieldDef.selectedData = selectedData;
- }
+ this.tableEditConfig.fieldDef.selectedData = selectedData;
if (this.tabRecord.length > 0) {
- this.tabRecord[this.activeTabInfo.activeTabIndex].editable = (data.data.length === 0);
- this.activeTabInfo.tabInfo.editable = (data.data.length === 0);
+ this.tabRecord[this.activeTabInfo.activeTabIndex].editable = (res.data.data.length === 0);
+ this.activeTabInfo.tabInfo.editable = (res.data.data.length === 0);
}
- } else
- message.error(data.message);
+ } else {
+ message.warning(res.msg);
+ }
this.spinning = false;
this.refreshMainTabComponent = new Date().getTime();
- }, error => { this.spinning = false; })
+ }).catch(error => {
+ this.spinning = false;
+ message.warning(error.msg);
+ })
+
+
}
- @action onTabEdit = (targetKey, action) => {
+ @action("分组tab删除") onTabEdit = (targetKey, action) => {
const tabIndex = this.getTabIndex(this.tabConfig.tabs, targetKey);
if (tabIndex < 0) return;
const tabInfo = this.tabConfig.tabs[tabIndex];
@@ -741,18 +741,19 @@ export class FieldDefinedStore extends HrmBaseStore {
}
if (this.selectedTreeNodeInfo != null)
params.groupType = this.selectedTreeNodeInfo.key
- api.removeGroupInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+
+ api.removeGroupInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.tabConfig.activeTabKey = '1';
- // if (this.moduleName.indexOf('resource') >= 0)
- // this.getTabInfoByTreeNode();
- // else
- // this.initData();
this.getTabInfoByTreeNode();
} else {
- message.error(data.message);
+ message.warning(data.msg);
}
+ }).catch(error => {
+ message.warning(error.msg);
})
}
});
@@ -819,10 +820,10 @@ export class FieldDefinedStore extends HrmBaseStore {
this.formTarget.typeInfoFrom.updateFields({
name: { value: data.name }
});
- }else {
+ } else {
this.selectedTreeNodeInfo.domid = null;
}
-
+
this.setDialogVisible('editTypeInfo', true, dialogTitle);
}
@@ -877,7 +878,6 @@ export class FieldDefinedStore extends HrmBaseStore {
@action("保存类型") doSaveTypeInfo = () => {
this.formTarget.typeInfoFrom.validateForm().then(f => {
if (f.isValid) {
- debugger
let params = {
... this.formTarget.typeInfoFrom.getFormParams(),
id: this.selectedTreeNodeInfo.domid
@@ -1019,18 +1019,20 @@ export class FieldDefinedStore extends HrmBaseStore {
return;
}
- api.saveFieldDefinedInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+ api.saveFieldDefinedInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
message.success(i18n.message.saveSuccess());
- // if (this.moduleName.indexOf('resource') >= 0)
this.getTabInfoByTreeNode();
- // else
- // this.initData();
} else {
- message.error(data.message);
+ message.warning(data.msg);
}
this.spinning = false;
- }, error => { this.spinning = false; })
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+
} else {
message.error(i18n.confirm.displayOrDBFieldExist());
this.spinning = false;
@@ -1243,7 +1245,7 @@ export class FieldDefinedStore extends HrmBaseStore {
return sel;
}
- doSaveGroupSetting = () => {
+ @action("分组维护保存") doSaveGroupSetting = () => {
this.recordOP(this.editTable['groupSetting'], 'valid');
let groupNameArr = [],
tabArr = [];
@@ -1270,26 +1272,27 @@ export class FieldDefinedStore extends HrmBaseStore {
}
params.data = dataObj;
- api.saveGroupInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+ api.saveGroupSettingInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
this.setDialogVisible('groupInfoSetting', false, '');
- // if (this.moduleName.indexOf('resource') >= 0)
this.getTabInfoByTreeNode(false, true);
- // else
- // this.initData(false, true);
message.success(i18n.message.saveSuccess());
- } else
- message.error(data.message);
- }, error => {
- message.error(i18n.message.actionError());
- });
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
} else {
message.error(i18n.confirm.groupNameExist());
}
}
- @action onGroupSettingDeleteOpr = (ks, ds, type) => {
+ @action("分组维护中删除") onGroupSettingDeleteOpr = (ks, ds, type) => {
+ debugger
let ids = [];
ds.map(d => {
if (has(d, 'id'))
@@ -1315,7 +1318,7 @@ export class FieldDefinedStore extends HrmBaseStore {
} else { }
}
- //人员卡片字段定义部分
+ //字段定义部分
@observable refreshTree = new Date().getTime();
@observable treeConfig = {
data: [],
@@ -1330,7 +1333,7 @@ export class FieldDefinedStore extends HrmBaseStore {
this.getTabInfoByTreeNode(null, true);
}
}
- //人员卡片字段定义-选中树节点的信息
+ //选中树节点的信息
@observable selectedTreeNodeInfo;
//计算【工作信息】树节点以及子节点的domid
@@ -1378,10 +1381,10 @@ export class FieldDefinedStore extends HrmBaseStore {
this.treeConfig.treeExpandKeys.length = 0;
api.getTree(this.moduleName).then(res => {
if (res.code === 200) {
- this.containerInitFinished = {
- ...this.containerInitFinished,
- init: true
- }
+ // this.containerInitFinished = {
+ // ...this.containerInitFinished,
+ // init: true
+ // }
if (res.data.length > 0) {
this.treeConfig.data = res.data;
this.treeConfig.selectedKeys = [res.data[0].key];
@@ -1434,21 +1437,23 @@ export class FieldDefinedStore extends HrmBaseStore {
this.tableEditConfig.childInfoSetting.showAdd = true;
this.tableEditConfig.childInfoSetting.showDelete = true;
let domid = this.selectedTreeNodeInfo.domid;
- //非基本类型()
- (domid != '-1' && domid != '-2' && domid != '-3' && domid != '-4') && t.topButtonDef.push({
+ t.topButtonDef.push({
comType: 'button',
type: 'primary',
onClickHandle: this.doChildInfoSetting,
label: i18n.button.childInfoMaintain(),
- icon: this.menuIconCollection.setting,
- checkAction: 'childInfoOperability'
- }) && t.topButtonDef.push({
+ icon: this.menuIconCollection.setting
+ //checkAction: 'childInfoOperability'
+ });
+ //非基本类型()
+ (domid != '-1' && domid != '-2' && domid != '-3' && domid != '-4') && t.topButtonDef.push({
comType: 'button',
type: 'primary',
onClickHandle: this.removeTypeInfo,
label: i18n.button.delete(),
icon: this.menuIconCollection.setting
});
+
} else {
this.tableEditConfig.childInfoSetting.showTitle = false;
this.tableEditConfig.childInfoSetting.showAdd = false;
@@ -1462,6 +1467,8 @@ export class FieldDefinedStore extends HrmBaseStore {
})
}
+
+
if (this.selectedTreeNodeInfo.domid === '-1' || this.selectedTreeNodeInfo.addChild) {
this.tableEditConfig.fieldDef.columns[2].com[0].options = remove(this.tableEditConfig.fieldDef.columns[1].com[0].options, (v) => v != 'upload');
} else {
@@ -1550,7 +1557,7 @@ export class FieldDefinedStore extends HrmBaseStore {
- @action doSaveChildInfo = () => {
+ @action("编辑子信息保存(f)") doSaveChildInfo = () => {
this.formTarget.childInfoForm.validateForm().then(f => {
if (f.isValid) {
let record = {
@@ -1625,7 +1632,8 @@ export class FieldDefinedStore extends HrmBaseStore {
}, error => {
message.error(i18n.message.actionError());
});
- // }
+
+
} else {
f.showErrors();
this.showError = new Date().getTime();
@@ -1633,7 +1641,7 @@ export class FieldDefinedStore extends HrmBaseStore {
});
}
- @action doChildInfoSetting = () => {
+ @action("子信息维护") doChildInfoSetting = () => {
this.tableEditConfig.childInfoSetting.datas.length = 0;
let arr = [];
if (!this.selectedTreeNodeInfo.addChild) {
@@ -1653,6 +1661,7 @@ export class FieldDefinedStore extends HrmBaseStore {
}
})
} else {
+ this.selectedTreeNodeInfo.childs = this.selectedTreeNodeInfo.childs ? this.selectedTreeNodeInfo.childs : [];
this.selectedTreeNodeInfo.childs.map(child => {
let viewAttr = child.viewAttr;
if (viewAttr != 1 && has(child, 'editable')) {
@@ -1698,6 +1707,7 @@ export class FieldDefinedStore extends HrmBaseStore {
this.setDialogVisible('childInfoSetting', true, i18n.button.childInfoMaintain());
}
+
convertAttr = (cloneTree) => {
let arr = [];
cloneTree.map(root => {
@@ -1763,7 +1773,8 @@ export class FieldDefinedStore extends HrmBaseStore {
});
}
- doSaveChildInfoSetting = () => {
+ @action("保存子信息维护") doSaveChildInfoSetting = () => {
+ debugger
this.recordOP(this.editTable['childInfoSetting'], 'valid');
let infoNameArr = [],
infoArr = [];
@@ -1772,7 +1783,7 @@ export class FieldDefinedStore extends HrmBaseStore {
infoArr.push({
id: group.id,
isShow: group.isShow == null ? '0' : group.isShow,
- name: group.name
+ groupName: group.name
})
return group.name === '';
})
@@ -1802,30 +1813,35 @@ export class FieldDefinedStore extends HrmBaseStore {
})
})
}
-
const params = {
- data: JSON.stringify({
- records: this.convertAttr(cloneTree)
- }),
+ // data: JSON.stringify({
+ // records: this.convertAttr(cloneTree)
+ // }),
+ data: JSON.stringify(infoArr),
parentId
}
- api.saveTree(params).then(data => {
- if (data.status === '1') {
+
+ api.saveTree(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
this.setDialogVisible('childInfoSetting', false, '');
this.getTree();
this.getTabInfoByTreeNode(null, true);
message.success(i18n.message.saveSuccess());
- } else
- message.error(data.message);
- }, error => {
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
message.error(i18n.message.actionError());
- });
+ })
+
} else {
message.error(i18n.confirm.groupNameExist());
}
}
- //移动到组
- @action dropdownClick = (e) => {
+
+ @action("移动到组") dropdownClick = (e) => {
switch (e.key) {
case 'createAndMove':
this.editGroup(null, true);
From 1dce4484278bac500223072199516f00f17e4921 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Fri, 17 Jun 2022 18:06:07 +0800
Subject: [PATCH 023/155] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/fieldDefined.js | 24 ++-
pc4mobx/organization/stores/baseStore.js | 6 +-
pc4mobx/organization/stores/fieldDefined.js | 177 ++++++++++----------
3 files changed, 116 insertions(+), 91 deletions(-)
diff --git a/pc4mobx/organization/apis/fieldDefined.js b/pc4mobx/organization/apis/fieldDefined.js
index 8306fbb..155fb2a 100644
--- a/pc4mobx/organization/apis/fieldDefined.js
+++ b/pc4mobx/organization/apis/fieldDefined.js
@@ -12,7 +12,7 @@ export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs
export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getFieldDefinedInfo`, 'GET', params)
export const saveFieldDefinedInfo = (moduleName,params) => {
- return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`, {
method: 'POST',
mode: 'cors',
headers: {
@@ -22,7 +22,16 @@ export const saveFieldDefinedInfo = (moduleName,params) => {
})
}
-export const removeFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/del`, 'POST', params)
+export const removeFieldDefinedInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/del`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
export const saveGroupInfo = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
@@ -83,6 +92,17 @@ export const saveTree = (moduleName,params) => {
})
}
+export const deleteTree = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTree`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
export const changeGroup = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/changeGroup`, 'POST', params)
export const getEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/getEncryptFieldSettingForm`, 'GET', params)
diff --git a/pc4mobx/organization/stores/baseStore.js b/pc4mobx/organization/stores/baseStore.js
index fe5b741..4801715 100644
--- a/pc4mobx/organization/stores/baseStore.js
+++ b/pc4mobx/organization/stores/baseStore.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:14:20
- * @LastEditTime: 2022-06-16 18:26:17
+ * @LastEditTime: 2022-06-17 10:59:30
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/baseStore.js
*/
@@ -539,8 +539,8 @@ export default class HrmBaseStore {
}
return otherParams;
}
-
- //重新计算列
+
+
convertData = (datas, target) => {
let tData = [],
selectedData = this.generateTableSelectedData(target);
diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js
index c2950f2..b1c4fe6 100644
--- a/pc4mobx/organization/stores/fieldDefined.js
+++ b/pc4mobx/organization/stores/fieldDefined.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:16:00
- * @LastEditTime: 2022-06-16 18:34:18
+ * @LastEditTime: 2022-06-17 18:05:13
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js
*/
@@ -202,7 +202,7 @@ export class FieldDefinedStore extends HrmBaseStore {
label: '',
type: 'INPUT',
key: 'fieldname',
- viewAttr: '3',
+ viewAttr: '1',
otherParams: {
length: 25,
regExp: /^[a-zA-Z][a-zA-Z0-9]*$/,
@@ -222,7 +222,7 @@ export class FieldDefinedStore extends HrmBaseStore {
key: 'fieldType',
useRecord: true,
colSpan: 1,
- width: (this.moduleName === 'resourcefielddefined' && !this.isJobTreeNode) ? "30%" : "40%",
+ width: "30%",
com: [{
label: '',
type: 'CUSTOMFIELD',
@@ -386,13 +386,13 @@ export class FieldDefinedStore extends HrmBaseStore {
getColumns = () => {
let columns = cloneDeep(this.fieldDefColumns())
- if (this.moduleName.indexOf('resource') >= 0) {
- columns[1].com = [{
- label: '',
- type: 'TEXT',
- key: 'fieldname',
- }]
- }
+ // if (this.moduleName.indexOf('resource') >= 0) {
+ // columns[1].com = [{
+ // label: '',
+ // type: 'TEXT',
+ // key: 'fieldname',
+ // }]
+ // }
return columns;
}
@@ -464,17 +464,6 @@ export class FieldDefinedStore extends HrmBaseStore {
if (this.dialogParams.groupInfoSetting.visible) {
let logType = '';
- switch (this.moduleName) {
- case 'subcompanyfielddefined':
- logType = 'HRM_ENGINE_SUBCOMPANYFIELDDEFINED_GROUP';
- break;
- case 'departmentfielddefined':
- logType = 'HRM_ENGINE_DEPARTMENTFIELDDEFINED_GROUP';
- break;
- case 'resourcefielddefined':
- logType = 'HRM_ENGINE_RESOURCEFIELDDEFINED_GROUP';
- break;
- }
this.editorDialogRightMenu.push(...this.getBasicMenus(logType));
}
@@ -697,9 +686,7 @@ export class FieldDefinedStore extends HrmBaseStore {
params.groupType = this.selectedTreeNodeInfo.key
this.spinning = true;
- api.getFieldDefinedInfo(this.moduleName, params).then(response => {
- return response.json()
- }).then(res => {
+ api.getFieldDefinedInfo(this.moduleName, params).then(res => {
if (res.code === 200) {
const {
datas,
@@ -719,10 +706,9 @@ export class FieldDefinedStore extends HrmBaseStore {
}
this.spinning = false;
this.refreshMainTabComponent = new Date().getTime();
- }).catch(error => {
this.spinning = false;
- message.warning(error.msg);
- })
+ this.refreshMainTabComponent = new Date().getTime();
+ }, error => {this.spinning = false;})
}
@@ -748,7 +734,13 @@ export class FieldDefinedStore extends HrmBaseStore {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.tabConfig.activeTabKey = '1';
- this.getTabInfoByTreeNode();
+ if(data.data === 0) {
+ this.getTabInfoByTreeNode();
+ }else {
+ this.initResourceData(this.moduleName)
+ }
+
+
} else {
message.warning(data.msg);
}
@@ -951,7 +943,8 @@ export class FieldDefinedStore extends HrmBaseStore {
});
}
- @action saveFieldDefine = () => {
+ @action("保存按钮") saveFieldDefine = () => {
+
if (this.spinning)
return;
this.spinning = true;
@@ -984,18 +977,21 @@ export class FieldDefinedStore extends HrmBaseStore {
let fieldlabel = d.fieldlabel || '',
fieldname = d.fieldname || '';
- if (fieldlabel === '' || (this.moduleName != 'resourcefielddefined' && fieldname === '')) {
+ if (fieldlabel === '' ) {
return true;
}
labelArr.push(getCurrentLabel(d.fieldlabel));
nameArr.push(d.fieldname);
return false;
})
- let checkSame = false;
- if (this.moduleName.indexOf('resource') >= 0)
- checkSame = uniq(labelArr).length === data.length;
- else
- checkSame = uniq(labelArr).length === data.length && uniq(nameArr).length === data.length;
+ let checkSame = true;
+
+ //数据库字段名不校验 后端生成
+ // if (this.moduleName.indexOf('resource') >= 0)
+ // checkSame = uniq(labelArr).length === data.length;
+ // else
+ // checkSame = uniq(labelArr).length === data.length && uniq(nameArr).length === data.length;
+
if (invalidEmpty) {
this.spinning = false;
return;
@@ -1008,7 +1004,7 @@ export class FieldDefinedStore extends HrmBaseStore {
if (this.selectedTreeNodeInfo != null)
dataObj.groupType = this.selectedTreeNodeInfo.key;
let params = {
- data: JSON.stringify(dataObj)
+ data: dataObj
}
if (this.selectedTreeNodeInfo != null)
params.groupType = this.selectedTreeNodeInfo.key;
@@ -1040,20 +1036,20 @@ export class FieldDefinedStore extends HrmBaseStore {
}
@action onEdit = (keys, datas, c, dataIndex) => {
- if (dataIndex === 'fieldlabel' && this.moduleName != 'resourcefielddefined') {
+ if (dataIndex === 'fieldlabel') {
const oldRecord = this.tableEditConfig.fieldDef.datas[keys[0]];
if (has(oldRecord, 'com') && has(oldRecord.com, 'fieldname') && oldRecord.com.fieldname.length > 0 && oldRecord.com.fieldname[0].type === 'TEXT') {
return;
}
- this.getPinYin({ labelName: getCurrentLabel(datas[0].fieldlabel) }).then(data => {
- const { pinyin } = data;
- oldRecord.fieldname = pinyin;
- const arr = filter(this.tableEditConfig.fieldDef.datas, { fieldname: pinyin });
- if (arr.length > 1 && pinyin != '') {
- oldRecord.fieldname = pinyin + '1';
- }
- this.refreshFeildDef = new Date().getTime();
- });
+ // this.getPinYin({ labelName: getCurrentLabel(datas[0].fieldlabel) }).then(data => {
+ // const { pinyin } = data;
+ // oldRecord.fieldname = pinyin;
+ // const arr = filter(this.tableEditConfig.fieldDef.datas, { fieldname: pinyin });
+ // if (arr.length > 1 && pinyin != '') {
+ // oldRecord.fieldname = pinyin + '1';
+ // }
+ // this.refreshFeildDef = new Date().getTime();
+ // });
}
}
@action onAdd = (keys, datas) => {
@@ -1292,7 +1288,7 @@ export class FieldDefinedStore extends HrmBaseStore {
}
@action("分组维护中删除") onGroupSettingDeleteOpr = (ks, ds, type) => {
- debugger
+
let ids = [];
ds.map(d => {
if (has(d, 'id'))
@@ -1407,6 +1403,8 @@ export class FieldDefinedStore extends HrmBaseStore {
if (p.domid === this.treeConfig.selectedKeys[0])
this.selectedTreeNodeInfo = p;
p.childs && p.childs.map(c => {
+
+ console.log(this.treeConfig.selectedKeys[0])
if (c.domid === this.treeConfig.selectedKeys[0])
this.selectedTreeNodeInfo = c;
})
@@ -1437,7 +1435,10 @@ export class FieldDefinedStore extends HrmBaseStore {
this.tableEditConfig.childInfoSetting.showAdd = true;
this.tableEditConfig.childInfoSetting.showDelete = true;
let domid = this.selectedTreeNodeInfo.domid;
- t.topButtonDef.push({
+
+ let defaultType = domid != '1' && domid != '2' && domid != '3' && domid != '4'
+
+ defaultType && t.topButtonDef.push({
comType: 'button',
type: 'primary',
onClickHandle: this.doChildInfoSetting,
@@ -1445,14 +1446,15 @@ export class FieldDefinedStore extends HrmBaseStore {
icon: this.menuIconCollection.setting
//checkAction: 'childInfoOperability'
});
- //非基本类型()
- (domid != '-1' && domid != '-2' && domid != '-3' && domid != '-4') && t.topButtonDef.push({
- comType: 'button',
- type: 'primary',
- onClickHandle: this.removeTypeInfo,
- label: i18n.button.delete(),
- icon: this.menuIconCollection.setting
- });
+
+ // defaultType && !this.tableEditConfig.childInfoSetting.hasGroup && t.topButtonDef.push({
+ // comType: 'button',
+ // type: 'primary',
+ // onClickHandle: this.removeTypeInfo,
+ // label: i18n.button.delete(),
+ // icon: this.menuIconCollection.setting
+ // })
+
} else {
this.tableEditConfig.childInfoSetting.showTitle = false;
@@ -1514,7 +1516,7 @@ export class FieldDefinedStore extends HrmBaseStore {
this.refreshMainTabComponent = new Date().getTime();
}
} else {
- message.error(data.message);
+ message.error(res.message);
}
})
}
@@ -1554,9 +1556,6 @@ export class FieldDefinedStore extends HrmBaseStore {
this.setDialogVisible('createChildInfo', true, dialogTitle);
}
-
-
-
@action("编辑子信息保存(f)") doSaveChildInfo = () => {
this.formTarget.childInfoForm.validateForm().then(f => {
if (f.isValid) {
@@ -1644,6 +1643,7 @@ export class FieldDefinedStore extends HrmBaseStore {
@action("子信息维护") doChildInfoSetting = () => {
this.tableEditConfig.childInfoSetting.datas.length = 0;
let arr = [];
+
if (!this.selectedTreeNodeInfo.addChild) {
arr.push({
"record": {
@@ -1733,48 +1733,56 @@ export class FieldDefinedStore extends HrmBaseStore {
return arr;
}
- removeChildInfo = () => {
+ @action("删除树信息") removeTypeInfo = () => {
this.confirmInfo({
content: i18n.confirm.deleteSelected(),
onOk: () => {
- let parentId;
- let cloneTree = cloneDeep(this.toJS(this.treeConfig.data));
- cloneTree.map(p => {
- p.childs && p.childs.map((c, i) => {
- if (c.domid === this.selectedTreeNodeInfo.domid) {
- parentId = p.domid;
- p.childs.splice(i, 1);
- }
- })
- })
+ // let parentId;
+ // let cloneTree = cloneDeep(this.toJS(this.treeConfig.data));
+ // cloneTree.map(p => {
+ // p.childs && p.childs.map((c, i) => {
+ // if (c.domid === this.selectedTreeNodeInfo.domid) {
+ // parentId = p.domid;
+ // p.childs.splice(i, 1);
+ // }
+ // })
+ // })
+ // const params = {
+ // data: JSON.stringify({
+ // records: this.convertAttr(cloneTree)
+ // }),
+ // parentId
+ // }
const params = {
- data: JSON.stringify({
- records: this.convertAttr(cloneTree)
- }),
- parentId
+ id: this.selectedTreeNodeInfo.domid
}
- api.saveTree(params).then(data => {
- if (data.status === '1') {
+
+ api.deleteTree(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.getTree(() => {
- this.treeConfig.selectedKeys = ['-1'];
+ this.treeConfig.selectedKeys = ['1'];
this.selectedTreeNodeInfo = this.treeConfig.data[0];
this.getTabInfoByTreeNode(null, true);
});
// this.treeConfig.selectedKeys = [this.treeConfig.data[0].key];
// this.selectedTreeNodeInfo = this.treeConfig.data[0];
// this.getTabInfoByTreeNode(null, true);
- } else
- message.error(data.message);
- }, error => {
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
message.error(i18n.message.actionError());
- });
+ })
+
+
}
});
}
@action("保存子信息维护") doSaveChildInfoSetting = () => {
- debugger
this.recordOP(this.editTable['childInfoSetting'], 'valid');
let infoNameArr = [],
infoArr = [];
@@ -1814,9 +1822,6 @@ export class FieldDefinedStore extends HrmBaseStore {
})
}
const params = {
- // data: JSON.stringify({
- // records: this.convertAttr(cloneTree)
- // }),
data: JSON.stringify(infoArr),
parentId
}
From ed990bcfb20ad59f1a2909bec1c28b7eebe9fd3e Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Mon, 20 Jun 2022 11:08:19 +0800
Subject: [PATCH 024/155] =?UTF-8?q?=E5=AE=8C=E6=88=90v1.20?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/fieldDefined.js | 11 ++++-
pc4mobx/organization/stores/fieldDefined.js | 48 +++++++++------------
2 files changed, 31 insertions(+), 28 deletions(-)
diff --git a/pc4mobx/organization/apis/fieldDefined.js b/pc4mobx/organization/apis/fieldDefined.js
index 155fb2a..0d550c1 100644
--- a/pc4mobx/organization/apis/fieldDefined.js
+++ b/pc4mobx/organization/apis/fieldDefined.js
@@ -103,7 +103,16 @@ export const deleteTree = (moduleName,params) => {
})
}
-export const changeGroup = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/changeGroup`, 'POST', params)
+export const changeGroup = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeGroup`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
export const getEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/getEncryptFieldSettingForm`, 'GET', params)
diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js
index b1c4fe6..cc230f6 100644
--- a/pc4mobx/organization/stores/fieldDefined.js
+++ b/pc4mobx/organization/stores/fieldDefined.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:16:00
- * @LastEditTime: 2022-06-17 18:05:13
+ * @LastEditTime: 2022-06-20 11:07:43
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js
*/
@@ -50,7 +50,7 @@ export class FieldDefinedStore extends HrmBaseStore {
//override baseStore.tabConfig
tabDef = {
color: '#000000',
- groupId: '',
+ //groupId: '',
viewCondition: '1',
topButtonDef: [{
comType: 'button',
@@ -138,9 +138,14 @@ export class FieldDefinedStore extends HrmBaseStore {
isDropBtn: true
}
]
- if (this.selectedTreeNodeInfo != null && this.selectedTreeNodeInfo.viewAttr != 1) {
+ // if (this.selectedTreeNodeInfo != null && this.selectedTreeNodeInfo.viewAttr != 1) {
+ // datas.splice(2, 1);
+ // }
+
+ if (this.selectedTreeNodeInfo != null && !this.selectedTreeNodeInfo.addChild) {
datas.splice(2, 1);
}
+
return datas;
}
dropdownProps = () => ({
@@ -635,7 +640,7 @@ export class FieldDefinedStore extends HrmBaseStore {
});
if (tabArr.length > 0) {
this.tabConfig.tabs = [...tabArr];
- // this.setTableEditColTitle();
+ //this.setTableEditColTitle();
this.setActiveTab(this.tabConfig, init ? '1' : !create ? this.tabConfig.activeTabKey : `${tabArr.length}`);
// this.containerInitFinished = {
// ...this.containerInitFinished,
@@ -1403,8 +1408,6 @@ export class FieldDefinedStore extends HrmBaseStore {
if (p.domid === this.treeConfig.selectedKeys[0])
this.selectedTreeNodeInfo = p;
p.childs && p.childs.map(c => {
-
- console.log(this.treeConfig.selectedKeys[0])
if (c.domid === this.treeConfig.selectedKeys[0])
this.selectedTreeNodeInfo = c;
})
@@ -1446,16 +1449,6 @@ export class FieldDefinedStore extends HrmBaseStore {
icon: this.menuIconCollection.setting
//checkAction: 'childInfoOperability'
});
-
- // defaultType && !this.tableEditConfig.childInfoSetting.hasGroup && t.topButtonDef.push({
- // comType: 'button',
- // type: 'primary',
- // onClickHandle: this.removeTypeInfo,
- // label: i18n.button.delete(),
- // icon: this.menuIconCollection.setting
- // })
-
-
} else {
this.tableEditConfig.childInfoSetting.showTitle = false;
this.tableEditConfig.childInfoSetting.showAdd = false;
@@ -1470,7 +1463,6 @@ export class FieldDefinedStore extends HrmBaseStore {
}
-
if (this.selectedTreeNodeInfo.domid === '-1' || this.selectedTreeNodeInfo.addChild) {
this.tableEditConfig.fieldDef.columns[2].com[0].options = remove(this.tableEditConfig.fieldDef.columns[1].com[0].options, (v) => v != 'upload');
} else {
@@ -1853,7 +1845,7 @@ export class FieldDefinedStore extends HrmBaseStore {
break;
default:
const groupid = e.key;
- const tabInfo = this.tabConfig.tabs[findIndex(this.tabConfig.tabs, { groupid })];
+ const tabInfo = this.tabConfig.tabs[findIndex(this.tabConfig.tabs, {groupid })];
let moveFieldConfirm = i18n.confirm.moveFieldConfirm().replace('{params}', tabInfo.title);
this.changeGroup(moveFieldConfirm, groupid);
}
@@ -1880,7 +1872,7 @@ export class FieldDefinedStore extends HrmBaseStore {
})
} else {
Object.assign(params, {
- ids: ids.join(','),
+ fieldids: ids.join(','),
groupid
});
}
@@ -1895,16 +1887,18 @@ export class FieldDefinedStore extends HrmBaseStore {
}
@action doChangeGroup = (params) => {
- api.changeGroup(this.moduleName, params).then(data => {
- if (data.status === '1') {
+ api.changeGroup(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
message.success(i18n.message.moveSuccess());
- // if (this.moduleName.indexOf('resource') >= 0)
this.getTabInfoByTreeNode();
- // else
- // this.initData();
- } else
- message.error(data.message);
- }, error => { message.error(i18n.message.actionError()); });
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.error(i18n.message.actionError());
+ })
}
@observable encryptDialogVisible = false;
From 74d55222397d423ef6fc71918a7198180d6a847f Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Mon, 20 Jun 2022 17:08:10 +0800
Subject: [PATCH 025/155] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/resource.js | 64 +++
.../components/resource/ResourceExtend.js | 0
.../components/resource/resource.js | 448 ++++++++++++++++++
pc4mobx/organization/index.js | 2 +
pc4mobx/organization/public/i18n.js | 1 +
pc4mobx/organization/stores/index.js | 4 +-
pc4mobx/organization/stores/resource.js | 316 ++++++++++++
pc4mobx/organization/stores/resourceExtend.js | 0
8 files changed, 834 insertions(+), 1 deletion(-)
create mode 100644 pc4mobx/organization/apis/resource.js
create mode 100644 pc4mobx/organization/components/resource/ResourceExtend.js
create mode 100644 pc4mobx/organization/components/resource/resource.js
create mode 100644 pc4mobx/organization/stores/resource.js
create mode 100644 pc4mobx/organization/stores/resourceExtend.js
diff --git a/pc4mobx/organization/apis/resource.js b/pc4mobx/organization/apis/resource.js
new file mode 100644
index 0000000..c3fff25
--- /dev/null
+++ b/pc4mobx/organization/apis/resource.js
@@ -0,0 +1,64 @@
+
+import {
+ WeaTools
+} from 'ecCom'
+
+export const getSearchList = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params);
+}
+
+export const deleteTableData = (params) => {
+ return fetch('/api/bs/hrmorganization/scheme/deleteByIds', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+export const getAdvanceSearchCondition = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSearchCondition', 'GET', params);
+}
+
+export const add = (params) => {
+ return fetch('/api/bs/hrmorganization/scheme/save', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+export const edit = (params) => {
+ return fetch('/api/bs/hrmorganization/scheme/updateScheme', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+export const updateForbiddenTag = (params) => {
+ return fetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+export const getSchemeForm = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSchemeForm', 'GET', params);
+}
+
+export const getHasRight = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params);
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/components/resource/ResourceExtend.js b/pc4mobx/organization/components/resource/ResourceExtend.js
new file mode 100644
index 0000000..e69de29
diff --git a/pc4mobx/organization/components/resource/resource.js b/pc4mobx/organization/components/resource/resource.js
new file mode 100644
index 0000000..26ac068
--- /dev/null
+++ b/pc4mobx/organization/components/resource/resource.js
@@ -0,0 +1,448 @@
+import React from 'react'
+import * as mobx from 'mobx'
+import {
+ inject,
+ observer,
+} from 'mobx-react'
+import {
+ WeaTop,
+ WeaTab,
+ WeaFormItem,
+ WeaRightMenu,
+ WeaLeftRightLayout,
+ WeaOrgTree,
+} from 'ecCom'
+import {
+ Row,
+ Col,
+ Spin,
+ Modal,
+ Button,
+ message,
+ Switch,
+ Menu, Dropdown, Icon
+} from 'antd'
+import {
+ WeaSwitch,
+ WeaTableNew
+} from 'comsMobx'
+import {
+ i18n
+} from '../../public/i18n';
+
+import '../../style/common.less';
+
+import NewAndEditDialog from '../NewAndEditDialog';
+import { renderNoright } from '../../util';
+
+
+
+const toJS = mobx.toJS;
+const confirm = Modal.confirm;
+const WeaTable = WeaTableNew.WeaTable;
+
+
+@inject('resource')
+@observer
+export default class Resource extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ componentWillMount() {
+ }
+
+ componentDidMount() {
+ this.init();
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const {
+ resource
+ } = this.props;
+
+ if (this.props.location.key !== nextProps.location.key) {
+ this.init();
+ }
+ }
+
+ init() {
+ const {
+ resource
+ } = this.props;
+ resource.getTableInfo();
+ resource.getHasRight();
+ }
+
+ //左侧树
+ getTree = () => {
+ const {
+ resource
+ } = this.props;
+ const {
+ companysId,
+ } = resource
+
+ let tree = (
+ ${i18n.label.organization()}`}
+ treeNodeClick={this.treeNodeClick}
+ expandAllChildrenOnSearch={true}
+ />
+ )
+
+ return tree;
+ }
+
+ getTopMenuBtns() {
+ const {
+ resource
+ } = this.props;
+ const {
+ topMenu,
+ tableStore
+ } = resource;
+
+ let btns = [];
+ topMenu.map((item, i) => {
+ if (item.menuFun !== 'batchDelete') {
+ btns.push();
+ } else {
+ btns.push();
+ }
+
+ });
+
+ return btns;
+ }
+
+ handleClick(item) {
+ const {
+ resource
+ } = this.props;
+ const {
+ isPanelShow
+ } = resource;
+
+ isPanelShow && resource.setPanelStatus(false);
+ this[item.menuFun] && this[item.menuFun]();
+ }
+
+ new() {
+ const {
+ resource
+ } = this.props;
+
+ resource.setNeDialogTitle(i18n.label.newRankScheme());
+ resource.setIsNew(true);
+ resource.setVisible(true);
+ resource.getForm();
+ }
+
+ batchDelete() {
+ const {
+ resource
+ } = this.props;
+ const {
+ tableStore
+ } = resource;
+
+ let keys = toJS(tableStore.selectedRowKeys).toString();
+ resource.setIds(keys);
+ this.showConfirm('batchDel');
+ }
+ showConfirm(v) {
+ let _this = this;
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (v == 'del') ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ _this.onOk();
+ },
+ onCancel() {
+ return false;
+ },
+ });
+ }
+ onOk() {
+ const {
+ resource
+ } = this.props;
+ resource.delete();
+ }
+
+
+ getDropMenuDatas() {
+ const {
+ resource
+ } = this.props;
+ const {
+ rightMenu
+ } = resource;
+
+ let menus = [];
+ toJS(rightMenu).map((item, index) => {
+ let obj = {
+ key: item.menuFun,
+ icon: ,
+ content: item.menuName,
+ }
+ if (item.menuFun == 'collection' || item.menuFun == 'help' || item.menuFun == 'pageAddress') {
+ obj.disabled = true;
+ }
+ menus.push(obj);
+ })
+ return menus;
+ }
+
+ handleMenuClick(key) {
+ const {
+ resource
+ } = this.props;
+ const {
+ isPanelShow
+ } = resource;
+
+ isPanelShow && resource.setPanelStatus(false);
+ this[key] && this[key]();
+ }
+
+ getTabBtn() {
+ const {
+ resource
+ } = this.props;
+ const {
+ form2
+ } = resource;
+
+ const btn = [
+ (),
+ (),
+ (),
+ ];
+
+ return btn;
+ }
+
+ custom = () => {
+ const {
+ resource
+ } = this.props, {
+ tableStore,
+ } = resource;
+
+ tableStore.setColSetVisible(true);
+ tableStore.tableColSet(true);
+ }
+
+ onSearchChange(val) {
+ const {
+ resource
+ } = this.props;
+ const {
+ form2
+ } = resource;
+
+ resource.setSchemeName(val);
+ !this.isEmptyObject(form2.getFormParams()) && resource.updateFields(val);
+ }
+
+ reRenderColumns(columns) {
+ let _this = this;
+ columns.forEach((c, index) => {
+ //todo
+ })
+ }
+
+ updateForbiddenTag(checked, id) {
+ const {
+ resource
+ } = this.props;
+ resource.updateForbiddenTag(checked, id);
+ }
+
+ onOperatesClick(record, rowIndex, operate) {
+ const {
+ index
+ } = operate;
+ (index == '0') && this.doEdit(record.randomFieldId);
+ (index == '1') && this.doDel(record.randomFieldId);
+
+ }
+
+ doEdit(id) {
+ const {
+ resource
+ } = this.props;
+
+ resource.setNeDialogTitle(i18n.label.editRankScheme());
+ resource.setSchemeId(id);
+ resource.setIsNew(false);
+ resource.setVisible(true);
+ resource.getForm();
+ }
+
+ doDel(id) {
+ const {
+ resource
+ } = this.props;
+ resource.setIds(id);
+ this.showConfirm('del');
+ }
+
+
+ handleSave() {
+ const {
+ resource
+ } = this.props;
+ const {
+ isNew
+ } = resource;
+
+ isNew && resource.save();
+ !isNew && resource.edit();
+ }
+
+ getPanelComponents() {
+ const {
+ resource
+ } = this.props;
+ const {
+ searchCondition,
+ form2,
+ searchConditionLoading
+ } = resource;
+
+ let arr = [];
+ let formParams = form2.getFormParams();
+ const {
+ isFormInit
+ } = form2;
+
+ isFormInit && searchCondition.map(c => {
+ c.items.map((field, index) => {
+ arr.push(
+
+
+ {}
+
+
+ )
+ })
+ })
+
+ if (searchConditionLoading) {
+ return (
+
+
+
+ )
+ } else {
+ return {
+ if (e.keyCode == 13 && e.target.tagName === "INPUT") {
+ resource.getTableInfo();
+ resource.setPanelStatus(false)
+ }
+ }}>{arr}
+ }
+
+ }
+
+ //非空判断
+ isEmptyObject(obj) {
+ for (let key in obj) {
+ return false;
+ }
+ return true;
+ }
+
+
+
+
+ render() {
+
+ const {
+ resource
+ } = this.props;
+ const {
+ isPanelShow, form2, schemeName, conditionNum, tableStore, nEdialogTitle, visible, condition,
+ form, dialogLoading, isEdit, date, hasRight,defaultShowLeft
+ } = resource;
+
+ if (hasRight === false) {
+ return renderNoright();
+ }
+
+ return (
+ hasRight &&
+
this.handleMenuClick(key)}
+ >
+ }
+ iconBgcolor='#217346'
+ loading={true}
+ buttons={this.getTopMenuBtns()}
+ showDropIcon={true}
+ dropMenuDatas={this.getDropMenuDatas()}
+ onDropMenuClick={(e) => this.handleMenuClick(e)}
+ >
+
+ resource.setPanelStatus(bool)}
+ hideSearchAd={() => resource.setPanelStatus(false)}
+ searchsAd={isPanelShow ? this.getPanelComponents() : }
+ advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
+ hasMask={false}
+ buttonsAd={this.getTabBtn()}
+ onSearch={() => resource.getTableInfo()}
+ onSearchChange={val => this.onSearchChange(val)}
+ />
+ this.reRenderColumns(c)}
+ onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
+ />
+
+
+
+
this.handleSave()}
+ onCancel={() => resource.setVisible(false)}
+ enable={false} //是否开启字段联动
+ />
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js
index 475b598..0217c86 100644
--- a/pc4mobx/organization/index.js
+++ b/pc4mobx/organization/index.js
@@ -23,6 +23,7 @@ import JobExtend from "./components/job/JobExtend";
import Department from "./components/department/department";
import DepartmentExtendStore from "./components/department/departmentExtend";
import FieldDefined from "./components/fieldDefinedSet/FieldDefined";
+import Resource from "./components/resource/resource";
import stores from "./stores";
import "./style/index";
@@ -79,6 +80,7 @@ const Routes = (
+
);
diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js
index fad5e61..9f31395 100644
--- a/pc4mobx/organization/public/i18n.js
+++ b/pc4mobx/organization/public/i18n.js
@@ -148,6 +148,7 @@ export const i18n = {
mergeDept:()=> getLabel(386246, '合并部门'),
transferDept:()=> getLabel(386246, '转移部门'),
typeName: () => getLabel(129927, '类型名称'),
+ ResourceName: () => getLabel(385936, '人员'),
authorizationGroup: () => getLabel(492, '权限组'),
diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js
index ca229ff..7eed1b0 100644
--- a/pc4mobx/organization/stores/index.js
+++ b/pc4mobx/organization/stores/index.js
@@ -16,6 +16,7 @@ import { JobStore } from "./job";
import { JobExtendStore } from "./jobextend";
import { NumberSetStore } from "./numberSet";
import {FieldDefinedStore} from "./fieldDefined";
+import {ResourceStore} from "./resource";
module.exports = {
simpleOrgStore: new SimpleOrgStore(),
@@ -35,5 +36,6 @@ module.exports = {
job: new JobStore(),
jobExtend: new JobExtendStore(),
numberSet: new NumberSetStore(),
- fieldDefined: new FieldDefinedStore()
+ fieldDefined: new FieldDefinedStore(),
+ resource: new ResourceStore()
};
diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js
new file mode 100644
index 0000000..0a093c0
--- /dev/null
+++ b/pc4mobx/organization/stores/resource.js
@@ -0,0 +1,316 @@
+import {
+ observable,
+ action
+} from 'mobx';
+import * as mobx from 'mobx';
+import * as Api from '../apis/resource'; // 引入API接口文件
+import {
+ WeaForm
+} from 'comsMobx';
+import {
+ WeaTableNew
+} from 'comsMobx';
+import {
+ Modal,
+ message,
+} from 'antd'
+import {
+ i18n
+} from '../public/i18n';
+
+const toJS = mobx.toJS;
+const {
+ TableStore
+} = WeaTableNew;
+
+
+ export class ResourceStore {
+ @observable tableStore = new TableStore();
+ @observable topMenu = []
+ @observable rightMenu = [];
+ @observable condition = [];
+ @observable searchCondition = [];
+ @observable isEdit = true;
+ @observable isNew = true;
+ @observable isPanelShow = false; //高级搜索面板
+ @observable form2 = new WeaForm();
+ @observable form = new WeaForm();
+ @observable form1 = new WeaForm();
+ @observable schemeName = '';
+ @observable conditionNum = 2;
+ @observable ids = ''; //选择行id
+ @observable searchConditionLoading = true;
+ @observable nEdialogTitle = '';
+ @observable visible = false;
+ @observable dialogLoading = true;
+ @observable schemeId = '';
+ @observable date = '';
+
+ @observable defaultShowLeft = true;
+ @observable companysId = 1
+ @observable hasRight = '';
+
+
+ @action
+ getTableInfo() {
+ let params;
+ this.tableStore = new TableStore();
+ if (this.isEmptyObject(this.form2.getFormParams())) {
+ params = {
+ ...this.form2.getFormParams(),
+ schemeName: this.schemeName
+ };
+ } else {
+ params = {
+ ...this.form2.getFormParams()
+ };
+ }
+ Api.getSearchList(params).then(res => {
+ if (res.code === 200) {
+ this.setHasRight(res.data.hasRight);
+ res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+
+ }
+
+ //删除
+ delete() {
+ let params = {
+ ids: this.ids
+ };
+ Api.deleteTableData(params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ message.success(i18n.message.deleteSuccess());
+ this.getTableInfo();
+ } else {
+ message.warning(data.msg);
+ }
+ })
+ .catch(error => {
+ message.warning(error.msg);
+ })
+ }
+
+ save() {
+ let params = {
+ ...this.form.getFormParams()
+ };
+ this.form.validateForm().then(f => {
+ if (f.isValid) {
+ Api.add(params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ message.success(data.msg);
+ this.getTableInfo();
+ this.setVisible(false);
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+ } else {
+ f.showErrors();
+ this.setDate(new Date());
+ }
+ });
+ }
+
+ edit() {
+ let params = { ...this.form.getFormParams(), id: this.schemeId };
+ this.form.validateForm().then(f => {
+ if (f.isValid) {
+ Api.edit(params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ message.success(data.msg);
+ this.getTableInfo();
+ this.setVisible(false);
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+ } else {
+ f.showErrors();
+ this.setDate(new Date());
+ }
+ });
+ }
+
+ updateForbiddenTag(checked, id) {
+ let params = {
+ forbiddenTag: checked,
+ id: id
+ }
+ Api.updateForbiddenTag(params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ message.success(data.msg);
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+
+ }
+
+ getForm() {
+ let params = this.isNew ? {} : {
+ id: this.schemeId
+ }
+ this.setDialogLoadingStatus(true);
+
+ Api.getSchemeForm(params).then(res => {
+ if (res.code === 200) {
+ this.setDialogLoadingStatus(false);
+ res.data.condition && this.setCondition(res.data.condition);
+ res.data.condition && this.form.initFormFields(res.data.condition);
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+
+ }
+
+ getSearchCondition() {
+ this.setScLoadingStatus(false);
+ Api.getAdvanceSearchCondition().then(res => {
+ if (res.code === 200) {
+ this.setScLoadingStatus(false);
+ res.data.conditions && this.setSearchCondition(res.data.conditions);
+ res.data.conditions && this.form2.initFormFields(res.data.conditions);
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+ }
+
+
+ @action
+ getHasRight() {
+ Api.getHasRight().then(res => {
+ if (res.code === 200) {
+ res.data.rightMenu && this.setRightMenu(res.data.rightMenu);
+ res.data.topMenu && this.setTopMenu(res.data.topMenu);
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+ }
+
+ updateFields(val) {
+ this.form2.updateFields({
+ schemeName: {
+ value: val
+ }
+ });
+ }
+
+ setSearchCondition(condition) {
+ this.searchCondition = condition;
+ }
+
+ setScLoadingStatus(bool) {
+ this.searchConditionLoading = bool;
+ }
+
+ setPanelStatus(bool) {
+ this.isPanelShow = bool;
+ bool && this.getSearchCondition();
+ if (!bool) {
+ this.scLoadingReset();
+ }
+ }
+
+ setSchemeName(val) {
+ this.schemeName = val;
+ }
+
+ isEmptyObject(obj) {
+ for (let key in obj) {
+ return false;
+ }
+ return true;
+ }
+
+ setIds(ids) {
+ this.ids = ids;
+ }
+
+ scLoadingReset() {
+ this.searchConditionLoading = true;
+ }
+
+
+ formReset() {
+ this.form = new WeaForm();
+ }
+
+ dialogLoadingReset() {
+ this.dialogLoading = true;
+ }
+
+ setVisible(bool) {
+ this.visible = bool;
+ this.formReset();
+ !bool && this.dialogLoadingReset();
+ }
+
+ setDialogLoadingStatus(bool) {
+ this.dialogLoading = bool;
+ }
+
+ setNeDialogTitle(title) {
+ this.nEdialogTitle = title;
+ }
+
+ setIsNew(bool) {
+ this.isNew = bool;
+ }
+
+ setCondition(condition) {
+ this.condition = condition;
+ }
+
+ setSchemeId(schemeId) {
+ this.schemeId = schemeId;
+ }
+
+ @action
+ setDate(date) {
+ this.date = date;
+ }
+
+ setTopMenu(topMenu) {
+ this.topMenu = topMenu;
+ }
+
+ setRightMenu(rightMenu) {
+ this.rightMenu = rightMenu;
+ }
+
+ setHasRight(bool) {
+ this.hasRight = bool;
+ }
+
+
+ }
\ No newline at end of file
diff --git a/pc4mobx/organization/stores/resourceExtend.js b/pc4mobx/organization/stores/resourceExtend.js
new file mode 100644
index 0000000..e69de29
From 32a0c9cbd2c9b888fee7a7aa766d386136894f3a Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Tue, 21 Jun 2022 18:39:50 +0800
Subject: [PATCH 026/155] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/resource.js | 16 +-
.../components/postionrank/RankScheme.js | 15 +-
.../components/resource/ResourceExtend.js | 282 ++++++++++++++++++
.../components/resource/resource.js | 15 +-
pc4mobx/organization/index.js | 2 +
pc4mobx/organization/public/i18n.js | 5 +
pc4mobx/organization/stores/index.js | 4 +-
pc4mobx/organization/stores/resource.js | 4 +-
pc4mobx/organization/stores/resourceExtend.js | 237 +++++++++++++++
9 files changed, 568 insertions(+), 12 deletions(-)
diff --git a/pc4mobx/organization/apis/resource.js b/pc4mobx/organization/apis/resource.js
index c3fff25..bd794ec 100644
--- a/pc4mobx/organization/apis/resource.js
+++ b/pc4mobx/organization/apis/resource.js
@@ -4,7 +4,7 @@ import {
} from 'ecCom'
export const getSearchList = (params) => {
- return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params);
+ return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/listPage', 'GET', params);
}
export const deleteTableData = (params) => {
@@ -23,7 +23,7 @@ export const getAdvanceSearchCondition = (params) => {
}
export const add = (params) => {
- return fetch('/api/bs/hrmorganization/scheme/save', {
+ return fetch('/api/bs/hrmorganization/hrmresource/saveBaseForm', {
method: 'POST',
mode: 'cors',
headers: {
@@ -56,9 +56,17 @@ export const updateForbiddenTag = (params) => {
}
export const getSchemeForm = (params) => {
- return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSchemeForm', 'GET', params);
+ return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getSaveForm', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params);
-}
\ No newline at end of file
+}
+
+export const editResource = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/updateForm', 'POST', params);
+}
+
+export const getResourceExtendForm = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getBaseForm', 'GET', params);
+}
diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js
index 2289d6f..86e8ab6 100644
--- a/pc4mobx/organization/components/postionrank/RankScheme.js
+++ b/pc4mobx/organization/components/postionrank/RankScheme.js
@@ -239,10 +239,23 @@ export default class RankScheme extends React.Component {
}
updateForbiddenTag(checked, id) {
+ debugger
const {
rankScheme
} = this.props;
- rankScheme.updateForbiddenTag(checked, id);
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (checked == '0') ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ rankScheme.updateForbiddenTag(checked, id);
+ },
+ onCancel() {
+ return false;
+ },
+ });
+
}
onOperatesClick(record, rowIndex, operate) {
diff --git a/pc4mobx/organization/components/resource/ResourceExtend.js b/pc4mobx/organization/components/resource/ResourceExtend.js
index e69de29..a241998 100644
--- a/pc4mobx/organization/components/resource/ResourceExtend.js
+++ b/pc4mobx/organization/components/resource/ResourceExtend.js
@@ -0,0 +1,282 @@
+/**
+ * @Author: 程亮
+ * @Date: 2022-06-20 14:59:21
+ * @LastEditTime: 2022-06-21 18:05:35
+ * @Description:
+ * @FilePath: /trunk/src4js/pc4mobx/organization/components/resource/ResourceExtend.js
+ */
+
+
+ import { Button, Modal, message, Row, Col, Spin } from 'antd';
+ import isEmpty from 'lodash/isEmpty'
+ import cloneDeep from 'lodash/cloneDeep'
+ import forEach from 'lodash/forEach'
+ import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab,WeaTop } from 'ecCom'
+ import { WeaSwitch } from 'comsMobx';
+ import { inject, observer } from 'mobx-react';
+ import * as mobx from 'mobx';
+ import { i18n } from '../../public/i18n';
+
+ const toJS = mobx.toJS;
+ import '../../style/common.less';
+
+
+ @inject('resourceExtend')
+ @inject('resource')
+ @observer
+ export default class ResourceExtend extends React.Component {
+
+ componentDidMount() {
+ this.init();
+ }
+ init = () => {
+ const { resourceExtend,resource } = this.props;
+ let {hash} = window.location;
+ hash = hash.split("?")[0];
+ let id = hash.match("[^/]+(?=/$|$)")[0];
+ resourceExtend.init();
+ resourceExtend.setId(id);
+ resourceExtend.getData();
+ }
+
+ getTabChildren = () => {
+ const { resourceExtend } = this.props;
+ let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = resourceExtend;
+ let tabChildren = [];
+ tableInfo = toJS(tableInfo);
+ tableInfo && tableInfo.map((t, i) => {
+ if (detailSelectedKey == i) {
+ tabChildren.push(
+ resourceExtend.setPersonalEditTables(ref)}
+ showTitle={isEditor}
+ // title={'列表信息'}
+ //addFirstRow={isEditor}
+ columns={t.tabinfo.columns}
+ datas={t.tabinfo.datas}
+ onChange={this.tableEditChange}
+ selectedRowKeys={toJS(selectedRowKeys)}
+ onRowSelect={keys => onRowSelect(keys)}
+ onBtnsSelect={key => this.onBtnsSelect(key, i)}
+ viewAttr={isEditor ? 2 : 1}
+ getRowSelection={isEditor ? (rowSelection) => {
+ Object.assign(rowSelection, {
+ getCheckboxProps: record => ({
+ disabled: record.viewAttr === 1, // 配置无法勾选的列
+ })
+ })
+ return rowSelection;
+ } : () => null}
+ />
+ );
+ }
+ })
+ return tabChildren;
+ }
+
+ onBtnsSelect = (key, index) => {
+ const {
+ resourceExtend
+ } = this.props, {
+ tableInfo,
+ selectedRows,
+ setSelectedRowKeys,
+ selectedRowKeys
+ } = resourceExtend;
+
+ const datas = tableInfo[index].tabinfo.datas;
+ if (key === 'copy') {
+ tableInfo[index].tabinfo.datas = datas.map((data, i) => {
+ if (!selectedRows[index].includes(i)) {
+ data.viewAttr = 2;
+ }
+ return data
+ })
+ }
+ if (key === 'delete') {
+ tableInfo[index].tabinfo.datas = datas.map((data, i) => {
+ if (selectedRows[index].includes(i)) {
+ data.viewAttr = 1;
+ }
+ return data
+ });
+ setSelectedRowKeys(selectedRowKeys.filter(row => !selectedRows[index].includes(row)))
+ }
+ }
+
+ getSearchs = () => {
+ const { resourceExtend } = this.props;
+ let { form, conditions, isEditor } = resourceExtend;
+ const { isFormInit } = form;
+ let group = [];
+ let tipPosition = 'bottom';
+ window.e9HideFormFieldKeys = [];
+ isFormInit && conditions.forEach((c, i) => {
+ let items = [];
+ c.items.forEach((field, j) => {
+ if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) {
+ window.e9HideFormFieldKeys.push(field.domkey[0]);
+ } else {
+ items.push({
+ com: (
+
+ ),
+ colSpan: 1
+ });
+ }
+ });
+ group.push()
+ });
+ return group;
+ }
+
+ tableEditChange = (data) => {
+ const { resourceExtend } = this.props;
+ let { detailSelectedKey = '0', tableInfo } = resourceExtend;
+ tableInfo = toJS(tableInfo);
+ let d = cloneDeep(tableInfo);
+ d[Number(detailSelectedKey)].tabinfo.datas = data;
+ resourceExtend.updateTableInfo(d);
+ }
+
+ getRightMenu = () => {
+ const { resourceExtend } = this.props;
+ const { isEditor, buttons } = resourceExtend;
+ let arr = [];
+ try {
+ if (buttons.hasEdit) {
+ if (isEditor) {
+ arr = [{
+ icon: ,
+ content: i18n.button.save(),
+ key: 'save',
+ onClick: key => {
+ this.saveEditCard();
+ }
+ }, {
+ icon: ,
+ content: i18n.button.back(),
+ key: 'back',
+ onClick: key => {
+ this.backCard();
+ }
+ }]
+ } else {
+ arr = [{
+ icon: ,
+ content: i18n.button.modify(),
+ key: 'editCard',
+ onClick: key => {
+ this.editCard();
+ }
+ }
+ ]
+ }
+ }
+ } catch (e) { }
+ return arr;
+ }
+
+ getTopButtons = () => {
+ const { resourceExtend } = this.props;
+ const { isEditor, buttons } = resourceExtend;
+ const save = ;
+ const back = ;
+ const edit = ;
+ const btns = [];
+ try {
+ if (isEditor) {
+ if (buttons.hasSave) {
+ btns.push(save);
+ btns.push(back);
+ }
+ } else {
+ if (buttons.hasEdit) {
+ btns.push(edit);
+ }
+ }
+ } catch (e) { }
+ return btns;
+ }
+
+ editCard = () => {
+ const { resourceExtend } = this.props;
+ resourceExtend.edit();
+ }
+
+ saveEditCard = () => {
+ const { resourceExtend } = this.props;
+ resourceExtend.save();
+ }
+
+ backCard = () => {
+ this.init();
+ }
+
+ changeData(key) {
+ const {
+ resourceExtend
+ } = this.props;
+ resourceExtend.changeData(key);
+ }
+
+ render() {
+ const { resourceExtend } = this.props;
+ const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = resourceExtend;
+
+ try {
+ return (
+
+
+
+
+
+ {this.getSearchs()}
+ {
+ !isEmpty(tabInfo) &&
+ {
+ resourceExtend.updateDetailSelectedKey(v);
+ }}
+ />
+ {this.getTabChildren()}
+
+ }
+
+
+
+
+
+ )
+ } catch (e) {
+ return
+ {i18n.message.authFailed()}
+
+ }
+ }
+ }
+
+
\ No newline at end of file
diff --git a/pc4mobx/organization/components/resource/resource.js b/pc4mobx/organization/components/resource/resource.js
index 26ac068..014f296 100644
--- a/pc4mobx/organization/components/resource/resource.js
+++ b/pc4mobx/organization/components/resource/resource.js
@@ -86,7 +86,7 @@ export default class Resource extends React.Component {
let tree = (
{
- //todo
+ if (c.dataIndex == 'last_name') {
+ c.render = function (text, record) {
+ return {
+ window.open(`/spa/organization/static/index.html#/main/organization/ResourceExtend/${record.id}`, "_blank")
+ }}>{text}
+ }
+ }
})
}
@@ -363,7 +369,7 @@ export default class Resource extends React.Component {
}
- //非空判断
+ // 非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
@@ -388,6 +394,7 @@ export default class Resource extends React.Component {
return renderNoright();
}
+
return (
hasRight &&
this.handleSave()}
onCancel={() => resource.setVisible(false)}
diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js
index 0217c86..bbc703d 100644
--- a/pc4mobx/organization/index.js
+++ b/pc4mobx/organization/index.js
@@ -24,6 +24,7 @@ import Department from "./components/department/department";
import DepartmentExtendStore from "./components/department/departmentExtend";
import FieldDefined from "./components/fieldDefinedSet/FieldDefined";
import Resource from "./components/resource/resource";
+import ResourceExtend from "./components/resource/ResourceExtend";
import stores from "./stores";
import "./style/index";
@@ -81,6 +82,7 @@ const Routes = (
+
);
diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js
index 9f31395..2a44586 100644
--- a/pc4mobx/organization/public/i18n.js
+++ b/pc4mobx/organization/public/i18n.js
@@ -149,6 +149,7 @@ export const i18n = {
transferDept:()=> getLabel(386246, '转移部门'),
typeName: () => getLabel(129927, '类型名称'),
ResourceName: () => getLabel(385936, '人员'),
+ newPeople: () => getLabel(386246, '新建人员'),
authorizationGroup: () => getLabel(492, '权限组'),
@@ -939,6 +940,10 @@ export const i18n = {
deleteImg: () => getLabel('16075', "删除图片")
},
confirm: {
+ forbiddenTag: () => getLabel(131329, '确定禁用该记录吗'),
+ enableTag: () => getLabel(131329, '确定启用该记录吗'),
+
+
defaultTitle: () => getLabel(131329, '信息确认'),
removeGroupInfo: () => getLabel(383053, '删除分组,该分组下的字段将显示到“基本信息”分组中,确定要删除吗?'),
groupNameExist: () => getLabel(130074, '已存在同名分组,请确认'),
diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js
index 7eed1b0..b1c5c1d 100644
--- a/pc4mobx/organization/stores/index.js
+++ b/pc4mobx/organization/stores/index.js
@@ -17,6 +17,7 @@ import { JobExtendStore } from "./jobextend";
import { NumberSetStore } from "./numberSet";
import {FieldDefinedStore} from "./fieldDefined";
import {ResourceStore} from "./resource";
+import {ResourceExtendStore} from "./resourceExtend";
module.exports = {
simpleOrgStore: new SimpleOrgStore(),
@@ -37,5 +38,6 @@ module.exports = {
jobExtend: new JobExtendStore(),
numberSet: new NumberSetStore(),
fieldDefined: new FieldDefinedStore(),
- resource: new ResourceStore()
+ resource: new ResourceStore(),
+ resourceExtend: new ResourceExtendStore()
};
diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js
index 0a093c0..8dc8d88 100644
--- a/pc4mobx/organization/stores/resource.js
+++ b/pc4mobx/organization/stores/resource.js
@@ -48,7 +48,7 @@ const {
@observable defaultShowLeft = true;
@observable companysId = 1
- @observable hasRight = '';
+ @observable hasRight = true;
@action
@@ -67,7 +67,7 @@ const {
}
Api.getSearchList(params).then(res => {
if (res.code === 200) {
- this.setHasRight(res.data.hasRight);
+ //this.setHasRight(res.data.hasRight);
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.warning(res.msg);
diff --git a/pc4mobx/organization/stores/resourceExtend.js b/pc4mobx/organization/stores/resourceExtend.js
index e69de29..4faa146 100644
--- a/pc4mobx/organization/stores/resourceExtend.js
+++ b/pc4mobx/organization/stores/resourceExtend.js
@@ -0,0 +1,237 @@
+import { observable, action, toJS } from "mobx";
+import { WeaForm } from "comsMobx";
+import isEmpty from 'lodash/isEmpty'
+import { WeaTableNew } from "comsMobx";
+import { Modal, message } from "antd";
+import { i18n } from "../public/i18n";
+import forEach from 'lodash/forEach'
+import * as Api from '../apis/resource'; // 引入API接口文件
+
+
+export class ResourceExtendStore {
+ @observable form = new WeaForm();
+ @observable tableInfo = []
+ @observable conditions = [];
+ @observable isEditor = false;
+ @observable isNew = true;
+ @observable loading = true;
+ @observable tabInfo = [];
+ @observable selectedKey = '0';
+ @observable detailSelectedKey = '0';
+ @observable topTab = [];
+ @observable buttons = {};
+ @observable id = ''; //人员id
+ @observable date = '';
+ @observable personalEditTables;
+ @observable tabkey = '0'
+
+
+ @observable selectedRowKeys = [];
+ @observable selectedRows = [];
+
+ @action onRowSelect = (keys) => {
+ this.setSelectedRowKeys(keys);
+ }
+
+ @action setSelectedRowKeys = (keys) => {
+ this.selectedRowKeys = keys;
+ }
+
+
+ @action
+ edit = () => {
+ this.isEditor = true;
+ this.getData();
+ this.getTabInfo();
+ this.detailSelectedKey = '0'
+ }
+
+ init = () => {
+ this.detailSelectedKey = '0'
+ this.isEditor = false;
+ }
+
+ save = () => {
+ if (this.loading)
+ return;
+ this.loading = true;
+ this.form.validateForm().then(f => {
+ if (f.isValid) {
+ if (this.personalEditTables) {
+ const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas,
+ isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true
+ if (isPass) {
+ this.editResource()
+ } else {
+ this.loading = false;
+ }
+ } else {
+ this.editResource();
+ }
+ } else {
+ f.showErrors();
+ this.setDate(new Date());
+ this.loading = false;
+ }
+ })
+ }
+
+ editResource = () => {
+ let pDatas = this.form.getFormParams();
+ Api.editResource({ ...{
+ id: this.id
+ },
+ ...pDatas,
+ ...this.getTableEditParams()
+ }).then(data => {
+ if (data.code == 200) {
+ message.success(i18n.message.saveSuccess());
+ this.init();
+ this.getData();
+ this.selectedRowKeys = [];
+ } else {
+ message.warning(data.message);
+ }
+ this.loading = false;
+ }, error => {
+ message.warning(error.message);
+ this.loading = false;
+ })
+ }
+
+ getTableEditParams = () => {
+ const params = {};
+ this.tableInfo && this.tableInfo.forEach(t => {
+ t.tabinfo.datas = t.tabinfo.datas || [];
+ params[t.tabinfo.rownum] = t.tabinfo.datas.length;
+ t.tabinfo && t.tabinfo.datas && t.tabinfo.datas.forEach((item, index) => {
+ !isEmpty(item) && forEach(item, (value, key) => {
+ Object.assign(params, {
+ [`${key}_${index}`]: value
+ });
+ })
+ })
+ })
+ return params
+ }
+
+
+
+ getData = () => {
+ this.setLoading(true);
+ let params = {
+ viewAttr: this.isEditor ? 2 : 1,
+ id: this.id,
+ viewCondition:this.selectedKey
+ }
+ Api.getResourceExtendForm(params).then((res) => {
+ if (res.code === 200) {
+ res.data.result.conditions && this.form.initFormFields(res.data.result.conditions);
+ res.data.result.conditions && this.setConditions(res.data.result.conditions);
+ this.tableInfo = this.handleTable(res.data.result.tables);
+ this.getTabInfo();
+ res.data.result.buttons && this.setButtons(res.data.result.buttons);
+ res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo);
+ this.isEditor && this.getSelectedRows();
+ this.setLoading(false);
+
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+
+
+
+
+ }
+
+ handleTable = (datas) => {
+ return datas && datas.map(data => {
+ const { tabinfo: { columns } } = data;
+ const length = columns.length;
+ columns.map(c => {
+ c.width = `${95 / length}%`
+ })
+ return data
+ })
+ }
+
+ getTabInfo = () => {
+ this.tabInfo = [];
+ this.tableInfo && this.tableInfo.forEach((c, idx) => {
+ if (!c.hide) {
+ this.tabInfo.push({
+ key: `${idx}`,
+ title: c.tabname,
+ })
+ }
+ })
+ //if (!isEmpty(this.tabInfo)) this.tabkey = this.tabInfo[0].key;
+ if (!isEmpty(this.tabInfo)) this.detailSelectedKey = this.tabInfo[0].key;
+ }
+
+ setLoading(val) {
+ this.loading = val;
+ }
+
+
+ updateTabKey = (key) => {
+ this.tabKey = key;
+ }
+
+ updateDetailSelectedKey =(key) => {
+ this.detailSelectedKey = key;
+ }
+
+ updateTableInfo = (data) => {
+ this.tableInfo = data
+ }
+
+ setSelectedKey = (key) => {
+ this.selectedKey = key;
+ }
+
+ getSelectedRows = () => {
+ const selectedRows = [];
+ this.tableInfo.forEach(t => {
+ const singleTableRows = [];
+ t.tabinfo.datas.forEach((data, i) => {
+ if (data.viewAttr === 1) {
+ singleTableRows.push(i);
+ }
+ });
+ selectedRows.push(singleTableRows);
+ })
+ this.selectedRows = selectedRows;
+ }
+
+
+ setTopTab(topTab) {
+ this.topTab = topTab;
+ }
+
+ changeData(key) {
+ this.setSelectedKey(key);
+ this.getData();
+ }
+
+ setId(id) {
+ this.id = id;
+ }
+
+ setPersonalEditTables = (ref) => {
+ this.personalEditTables = ref;
+ }
+
+ setConditions(conditions) {
+ this.conditions = conditions;
+ }
+
+ setButtons(buttons) {
+ this.buttons = buttons;
+ }
+
+
+}
From 4102c1e135d29cfcfea6c715caa04b979242fd8b Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Wed, 22 Jun 2022 10:28:25 +0800
Subject: [PATCH 027/155] =?UTF-8?q?=E9=9C=80=E6=B1=82=E7=BB=9F=E4=B8=80?=
=?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/resource.js | 36 +--------------
.../components/company/company.js | 17 +++++--
.../components/department/department.js | 17 +++++--
pc4mobx/organization/components/job/Job.js | 17 +++++--
.../components/postionrank/JobGrade.js | 15 +++++-
.../components/postionrank/JobLevel.js | 15 +++++-
.../components/postionrank/RankScheme.js | 5 +-
.../components/sequence/Sequence.js | 15 +++++-
.../organization/components/staff/Staff.js | 6 ---
.../components/staff/StaffScheme.js | 15 +++++-
pc4mobx/organization/public/i18n.js | 4 +-
pc4mobx/organization/stores/department.js | 1 +
pc4mobx/organization/stores/job.js | 1 +
pc4mobx/organization/stores/jobgrade.js | 5 +-
pc4mobx/organization/stores/joblevel.js | 3 +-
pc4mobx/organization/stores/rankscheme.js | 1 +
pc4mobx/organization/stores/resource.js | 46 +------------------
pc4mobx/organization/stores/sequence.js | 3 +-
pc4mobx/organization/stores/staffscheme.js | 1 +
19 files changed, 112 insertions(+), 111 deletions(-)
diff --git a/pc4mobx/organization/apis/resource.js b/pc4mobx/organization/apis/resource.js
index bd794ec..9f64dcf 100644
--- a/pc4mobx/organization/apis/resource.js
+++ b/pc4mobx/organization/apis/resource.js
@@ -7,19 +7,8 @@ export const getSearchList = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/listPage', 'GET', params);
}
-export const deleteTableData = (params) => {
- return fetch('/api/bs/hrmorganization/scheme/deleteByIds', {
- method: 'POST',
- mode: 'cors',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(params)
- })
-}
-
export const getAdvanceSearchCondition = (params) => {
- return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSearchCondition', 'GET', params);
+ return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getSearchCondition', 'GET', params);
}
export const add = (params) => {
@@ -33,34 +22,13 @@ export const add = (params) => {
})
}
-export const edit = (params) => {
- return fetch('/api/bs/hrmorganization/scheme/updateScheme', {
- method: 'POST',
- mode: 'cors',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(params)
- })
-}
-
-export const updateForbiddenTag = (params) => {
- return fetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById', {
- method: 'POST',
- mode: 'cors',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(params)
- })
-}
export const getSchemeForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getSaveForm', 'GET', params);
}
export const getHasRight = (params) => {
- return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params);
+ return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getHasRight', 'GET', params);
}
export const editResource = (params) => {
diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js
index f026a49..560202f 100644
--- a/pc4mobx/organization/components/company/company.js
+++ b/pc4mobx/organization/components/company/company.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-05-18 16:23:32
- * @LastEditTime: 2022-06-07 16:39:25
+ * @LastEditTime: 2022-06-22 10:08:54
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
*/
@@ -255,7 +255,7 @@ export default class Company extends React.Component {
columns.forEach((c, index) => {
if (c.dataIndex == 'forbiddenTag') {
c.render = function (text, record) {
- return _this.updateForbiddenTag(checked, record.id)} />
+ return _this.updateForbiddenTag(checked, record.id)} />
}
};
if (c.dataIndex == 'compName') {
@@ -294,7 +294,18 @@ export default class Company extends React.Component {
const {
company
} = this.props;
- company.updateForbiddenTag(checked, id);
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ company.updateForbiddenTag(checked, id);
+ },
+ onCancel() {
+ return false;
+ },
+ });
}
doDel(id) {
diff --git a/pc4mobx/organization/components/department/department.js b/pc4mobx/organization/components/department/department.js
index ec8277f..b533783 100644
--- a/pc4mobx/organization/components/department/department.js
+++ b/pc4mobx/organization/components/department/department.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-02 09:19:37
- * @LastEditTime: 2022-06-07 16:15:54
+ * @LastEditTime: 2022-06-22 10:10:28
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/department/department.js
*/
@@ -295,7 +295,18 @@
const {
department
} = this.props;
- department.updateForbiddenTag(checked, id);
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ department.updateForbiddenTag(checked, id);
+ },
+ onCancel() {
+ return false;
+ },
+ });
}
@@ -321,7 +332,7 @@
columns.forEach((c, index) => {
if (c.dataIndex == 'forbiddenTag') {
c.render = function (text, record) {
- return _this.updateForbiddenTag(checked, record.id)} />
+ return _this.updateForbiddenTag(checked, record.id)} />
}
};
if (c.dataIndex == 'deptName') {
diff --git a/pc4mobx/organization/components/job/Job.js b/pc4mobx/organization/components/job/Job.js
index 3d6ce54..1131898 100644
--- a/pc4mobx/organization/components/job/Job.js
+++ b/pc4mobx/organization/components/job/Job.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-05-26 14:05:59
- * @LastEditTime: 2022-06-08 16:03:50
+ * @LastEditTime: 2022-06-22 10:10:58
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js
*/
@@ -268,7 +268,18 @@ export default class Job extends React.Component {
const {
job
} = this.props;
- job.updateForbiddenTag(checked, id);
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ job.updateForbiddenTag(checked, id);
+ },
+ onCancel() {
+ return false;
+ },
+ });
}
@@ -294,7 +305,7 @@ export default class Job extends React.Component {
columns.forEach((c, index) => {
if (c.dataIndex == 'forbiddenTag') {
c.render = function (text, record) {
- return _this.updateForbiddenTag(checked, record.id)} />
+ return _this.updateForbiddenTag(checked, record.id)} />
}
};
if (c.dataIndex == 'jobName') {
diff --git a/pc4mobx/organization/components/postionrank/JobGrade.js b/pc4mobx/organization/components/postionrank/JobGrade.js
index a3be8e6..347501d 100644
--- a/pc4mobx/organization/components/postionrank/JobGrade.js
+++ b/pc4mobx/organization/components/postionrank/JobGrade.js
@@ -241,7 +241,7 @@ export default class JobGrade extends React.Component {
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function(text, record) {
- return _this.updateForbiddenTag(checked,record.id)} />
+ return _this.updateForbiddenTag(checked,record.id)} />
}
};
})
@@ -251,7 +251,18 @@ export default class JobGrade extends React.Component {
const {
jobGrade
} = this.props;
- jobGrade.updateForbiddenTag(checked,id);
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ jobGrade.updateForbiddenTag(checked, id);
+ },
+ onCancel() {
+ return false;
+ },
+ });
}
onOperatesClick(record, rowIndex, operate) {
diff --git a/pc4mobx/organization/components/postionrank/JobLevel.js b/pc4mobx/organization/components/postionrank/JobLevel.js
index 426ff7b..88a1103 100644
--- a/pc4mobx/organization/components/postionrank/JobLevel.js
+++ b/pc4mobx/organization/components/postionrank/JobLevel.js
@@ -226,7 +226,7 @@ export default class JobLevel extends React.Component {
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function (text, record) {
- return _this.updateForbiddenTag(checked, record.id)} />
+ return _this.updateForbiddenTag(checked, record.id)} />
}
};
})
@@ -236,7 +236,18 @@ export default class JobLevel extends React.Component {
const {
jobLevel
} = this.props;
- jobLevel.updateForbiddenTag(checked, id);
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ jobLevel.updateForbiddenTag(checked, id);
+ },
+ onCancel() {
+ return false;
+ },
+ });
}
onOperatesClick(record, rowIndex, operate) {
diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js
index 86e8ab6..2158d77 100644
--- a/pc4mobx/organization/components/postionrank/RankScheme.js
+++ b/pc4mobx/organization/components/postionrank/RankScheme.js
@@ -232,20 +232,19 @@ export default class RankScheme extends React.Component {
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function (text, record) {
- return _this.updateForbiddenTag(checked, record.id)} />
+ return _this.updateForbiddenTag(checked, record.id)} />
}
};
})
}
updateForbiddenTag(checked, id) {
- debugger
const {
rankScheme
} = this.props;
confirm({
title: i18n.confirm.defaultTitle(),
- content: (checked == '0') ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
diff --git a/pc4mobx/organization/components/sequence/Sequence.js b/pc4mobx/organization/components/sequence/Sequence.js
index deb6b49..042000f 100644
--- a/pc4mobx/organization/components/sequence/Sequence.js
+++ b/pc4mobx/organization/components/sequence/Sequence.js
@@ -227,7 +227,7 @@ export default class Sequence extends React.Component {
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function(text, record) {
- return _this.updateForbiddenTag(checked,record.id)} />
+ return _this.updateForbiddenTag(checked,record.id)} />
}
};
})
@@ -248,7 +248,18 @@ export default class Sequence extends React.Component {
const {
sequence
} = this.props;
- sequence.updateForbiddenTag(checked,id);
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ sequence.updateForbiddenTag(checked, id);
+ },
+ onCancel() {
+ return false;
+ },
+ });
}
onOperatesClick(record, rowIndex, operate) {
diff --git a/pc4mobx/organization/components/staff/Staff.js b/pc4mobx/organization/components/staff/Staff.js
index 5b354b6..7b8222f 100644
--- a/pc4mobx/organization/components/staff/Staff.js
+++ b/pc4mobx/organization/components/staff/Staff.js
@@ -222,12 +222,6 @@ export default class Staff extends React.Component {
// })
}
- updateForbiddenTag(checked,id) {
- const {
- staff
- } = this.props;
- staff.updateForbiddenTag(checked,id);
- }
onOperatesClick(record, rowIndex, operate) {
const {
diff --git a/pc4mobx/organization/components/staff/StaffScheme.js b/pc4mobx/organization/components/staff/StaffScheme.js
index 2ee79bf..7860494 100644
--- a/pc4mobx/organization/components/staff/StaffScheme.js
+++ b/pc4mobx/organization/components/staff/StaffScheme.js
@@ -220,7 +220,7 @@ export default class StaffScheme extends React.Component {
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function(text, record) {
- return _this.updateForbiddenTag(checked,record.id)} />
+ return _this.updateForbiddenTag(checked,record.id)} />
}
};
})
@@ -230,7 +230,18 @@ export default class StaffScheme extends React.Component {
const {
staffScheme
} = this.props;
- staffScheme.updateForbiddenTag(checked,id);
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ staffScheme.updateForbiddenTag(checked, id);
+ },
+ onCancel() {
+ return false;
+ },
+ });
}
onOperatesClick(record, rowIndex, operate) {
diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js
index 2a44586..aa5228b 100644
--- a/pc4mobx/organization/public/i18n.js
+++ b/pc4mobx/organization/public/i18n.js
@@ -940,8 +940,8 @@ export const i18n = {
deleteImg: () => getLabel('16075', "删除图片")
},
confirm: {
- forbiddenTag: () => getLabel(131329, '确定禁用该记录吗'),
- enableTag: () => getLabel(131329, '确定启用该记录吗'),
+ forbiddenTag: () => getLabel(-131329, '确定禁用该记录吗'),
+ enableTag: () => getLabel(-131328, '确定启用该记录吗'),
defaultTitle: () => getLabel(131329, '信息确认'),
diff --git a/pc4mobx/organization/stores/department.js b/pc4mobx/organization/stores/department.js
index 224bd5f..1f6f10b 100644
--- a/pc4mobx/organization/stores/department.js
+++ b/pc4mobx/organization/stores/department.js
@@ -158,6 +158,7 @@ export class DepartmentStore {
}).then(data => {
if (data.code === 200) {
message.success(data.msg, 1);
+ this.getTableInfo();
} else {
message.warning(data.msg);
}
diff --git a/pc4mobx/organization/stores/job.js b/pc4mobx/organization/stores/job.js
index 306b269..853dd2a 100644
--- a/pc4mobx/organization/stores/job.js
+++ b/pc4mobx/organization/stores/job.js
@@ -152,6 +152,7 @@ export class JobStore {
}).then(data => {
if (data.code === 200) {
message.success(data.msg, 1);
+ this.getTableInfo();
} else {
message.warning(data.msg);
}
diff --git a/pc4mobx/organization/stores/jobgrade.js b/pc4mobx/organization/stores/jobgrade.js
index e6adaf2..5014b82 100644
--- a/pc4mobx/organization/stores/jobgrade.js
+++ b/pc4mobx/organization/stores/jobgrade.js
@@ -77,8 +77,8 @@ export class JobGradeStore {
}, error => {
message.warning(error.msg);
})
- //获取tab信息
- this.getTabInfo();
+ //获取tab信息(去除)
+ //this.getTabInfo();
}
@@ -175,6 +175,7 @@ export class JobGradeStore {
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
+ this.getTableInfo();
} else {
message.warning(data.msg);
}
diff --git a/pc4mobx/organization/stores/joblevel.js b/pc4mobx/organization/stores/joblevel.js
index 607bc43..8a2e8e2 100644
--- a/pc4mobx/organization/stores/joblevel.js
+++ b/pc4mobx/organization/stores/joblevel.js
@@ -55,7 +55,7 @@ export class JobLevelStore {
getTableInfo() {
let params;
//获取tab信息
- this.getTabInfo();
+ // this.getTabInfo();
this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
@@ -166,6 +166,7 @@ export class JobLevelStore {
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
+ this.getTableInfo();
} else {
message.warning(data.msg);
}
diff --git a/pc4mobx/organization/stores/rankscheme.js b/pc4mobx/organization/stores/rankscheme.js
index 11f799a..955f10a 100644
--- a/pc4mobx/organization/stores/rankscheme.js
+++ b/pc4mobx/organization/stores/rankscheme.js
@@ -156,6 +156,7 @@ export class RankSchemeStore {
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
+ this.getTableInfo();
} else {
message.warning(data.msg);
}
diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js
index 8dc8d88..2eba6ae 100644
--- a/pc4mobx/organization/stores/resource.js
+++ b/pc4mobx/organization/stores/resource.js
@@ -37,7 +37,7 @@ const {
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable schemeName = '';
- @observable conditionNum = 2;
+ @observable conditionNum = 8;
@observable ids = ''; //选择行id
@observable searchConditionLoading = true;
@observable nEdialogTitle = '';
@@ -78,26 +78,6 @@ const {
}
- //删除
- delete() {
- let params = {
- ids: this.ids
- };
- Api.deleteTableData(params).then(response => {
- return response.json()
- }).then(data => {
- if (data.code === 200) {
- message.success(i18n.message.deleteSuccess());
- this.getTableInfo();
- } else {
- message.warning(data.msg);
- }
- })
- .catch(error => {
- message.warning(error.msg);
- })
- }
-
save() {
let params = {
...this.form.getFormParams()
@@ -124,30 +104,6 @@ const {
});
}
- edit() {
- let params = { ...this.form.getFormParams(), id: this.schemeId };
- this.form.validateForm().then(f => {
- if (f.isValid) {
- Api.edit(params).then(response => {
- return response.json()
- }).then(data => {
- if (data.code === 200) {
- message.success(data.msg);
- this.getTableInfo();
- this.setVisible(false);
- } else {
- message.warning(data.msg);
- }
- }).catch(error => {
- message.warning(error.msg);
- })
- } else {
- f.showErrors();
- this.setDate(new Date());
- }
- });
- }
-
updateForbiddenTag(checked, id) {
let params = {
forbiddenTag: checked,
diff --git a/pc4mobx/organization/stores/sequence.js b/pc4mobx/organization/stores/sequence.js
index d7556c7..e2ec395 100644
--- a/pc4mobx/organization/stores/sequence.js
+++ b/pc4mobx/organization/stores/sequence.js
@@ -77,7 +77,7 @@ export class SequenceStore {
message.warning(error.msg);
})
//获取tab信息
- this.getTabInfo();
+ // this.getTabInfo();
}
@@ -165,6 +165,7 @@ export class SequenceStore {
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
+ this.getTableInfo();
} else {
message.warning(data.msg);
}
diff --git a/pc4mobx/organization/stores/staffscheme.js b/pc4mobx/organization/stores/staffscheme.js
index 11fe89e..adf62a4 100644
--- a/pc4mobx/organization/stores/staffscheme.js
+++ b/pc4mobx/organization/stores/staffscheme.js
@@ -156,6 +156,7 @@ export class StaffSchemeStore {
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
+ this.getTableInfo();
} else {
message.warning(data.msg);
}
From 4878b6be1d3c34d5eccae59cae7e790f1bbb9e17 Mon Sep 17 00:00:00 2001
From: liyongshun <971387674@qq.com>
Date: Wed, 22 Jun 2022 16:09:43 +0800
Subject: [PATCH 028/155] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=81=8C=E5=8A=A1?=
=?UTF-8?q?=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/officeManage.js | 60 +++---
.../components/office/components/leftTree.js | 187 ++++++++--------
.../components/office/officeManage.js | 202 ++++++++++--------
pc4mobx/organization/public/i18n.js | 3 +-
pc4mobx/organization/stores/officeManage.js | 51 +++--
5 files changed, 282 insertions(+), 221 deletions(-)
diff --git a/pc4mobx/organization/apis/officeManage.js b/pc4mobx/organization/apis/officeManage.js
index db1be85..1d081fc 100644
--- a/pc4mobx/organization/apis/officeManage.js
+++ b/pc4mobx/organization/apis/officeManage.js
@@ -2,11 +2,11 @@
* Author: 黎永顺
* Description:
* Date: 2022-05-13 16:36:09
- * LastEditTime: 2022-05-16 16:27:08
+ * LastEditTime: 2022-06-22 14:37:27
*/
import { WeaTools } from "ecCom";
-export const getHasRight = (params) => {
+export const getHasRight = params => {
return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getHasRight",
"GET",
@@ -14,7 +14,7 @@ export const getHasRight = (params) => {
);
};
-export const getSearchCondition = (params) => {
+export const getSearchCondition = params => {
return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getSearchCondition",
"GET",
@@ -22,84 +22,94 @@ export const getSearchCondition = (params) => {
);
};
-export const getPostInfoForm = (params) => {
+export const getPostInfoForm = params => {
return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getPostInfoForm",
"GET",
params
);
};
-export const savePostInfo = (params) => {
+export const savePostInfo = params => {
return fetch("/api/bs/hrmorganization/postinfo/savePostInfo", {
method: "POST",
mode: "cors",
headers: {
- "Content-Type": "application/json",
+ "Content-Type": "application/json"
},
- body: JSON.stringify(params),
+ body: JSON.stringify(params)
});
};
-export const updatePostInfo = (params) => {
+export const updatePostInfo = params => {
return fetch("/api/bs/hrmorganization/postinfo/updatePostInfo", {
method: "POST",
mode: "cors",
headers: {
- "Content-Type": "application/json",
+ "Content-Type": "application/json"
},
- body: JSON.stringify(params),
+ body: JSON.stringify(params)
});
};
-export const updateForbiddenTagById = (params) => {
+export const updateForbiddenTagById = params => {
return fetch("/api/bs/hrmorganization/postinfo/updateForbiddenTagById", {
method: "POST",
mode: "cors",
headers: {
- "Content-Type": "application/json",
+ "Content-Type": "application/json"
},
- body: JSON.stringify(params),
+ body: JSON.stringify(params)
});
};
-export const savePost = (params) => {
+export const savePost = params => {
return fetch("/api/bs/hrmorganization/post/savePost", {
method: "POST",
mode: "cors",
headers: {
- "Content-Type": "application/json",
+ "Content-Type": "application/json"
},
- body: JSON.stringify(params),
+ body: JSON.stringify(params)
+ });
+};
+export const updatePost = params => {
+ return fetch("/api/bs/hrmorganization/post/updatePost", {
+ method: "POST",
+ mode: "cors",
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify(params)
});
};
-export const deleteByIds = (params) => {
+export const deleteByIds = params => {
return fetch("/api/bs/hrmorganization/post/deleteByIds", {
method: "POST",
mode: "cors",
headers: {
- "Content-Type": "application/json",
+ "Content-Type": "application/json"
},
- body: JSON.stringify(params),
+ body: JSON.stringify(params)
});
};
-export const deletePostinfoByIds = (params) => {
+export const deletePostinfoByIds = params => {
return fetch("/api/bs/hrmorganization/postinfo/deleteByIds", {
method: "POST",
mode: "cors",
headers: {
- "Content-Type": "application/json",
+ "Content-Type": "application/json"
},
- body: JSON.stringify(params),
+ body: JSON.stringify(params)
});
};
-export const getTreeData = (params) => {
+export const getTreeData = params => {
return WeaTools.callApi(
"/api/bs/hrmorganization/post/getTreeData",
"GET",
params
);
};
-export const getPostForm = (params) => {
+export const getPostForm = params => {
return WeaTools.callApi(
"/api/bs/hrmorganization/post/getPostForm",
"GET",
@@ -107,7 +117,7 @@ export const getPostForm = (params) => {
);
};
-export const getPostInfoTable = (params) => {
+export const getPostInfoTable = params => {
return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getPostInfoTable",
"GET",
diff --git a/pc4mobx/organization/components/office/components/leftTree.js b/pc4mobx/organization/components/office/components/leftTree.js
index 4fa7773..d84ffc5 100644
--- a/pc4mobx/organization/components/office/components/leftTree.js
+++ b/pc4mobx/organization/components/office/components/leftTree.js
@@ -10,49 +10,6 @@ import "../index.less";
const confirm = Modal.confirm;
const TreeNode = Tree.TreeNode;
-const treeData = [
- {
- title: "0-0",
- key: "0-0",
- children: [
- {
- title: "0-0-0",
- key: "0-0-0",
- children: [
- { title: "0-0-0-0-88", key: "0-0-0-0" },
- { title: "0-0-0-1", key: "0-0-0-1" },
- { title: "0-0-0-2", key: "0-0-0-2" },
- ],
- },
- {
- title: "0-0-1",
- key: "0-0-1",
- children: [
- { title: "0-0-1-0", key: "0-0-1-0" },
- { title: "0-0-1-1", key: "0-0-1-1" },
- { title: "0-0-1-2", key: "0-0-1-2" },
- ],
- },
- {
- title: "0-0-2",
- key: "0-0-2",
- },
- ],
- },
- {
- title: "99",
- key: "0-1",
- children: [
- { title: "0-1-0-0", key: "0-1-0-0" },
- { title: "9988", key: "0-1-0-1" },
- { title: "0-1-0-2-99988", key: "0-1-0-2" },
- ],
- },
- {
- title: "0-2",
- key: "0-2",
- },
-];
@inject("officeManageStore")
@observer
@@ -66,7 +23,7 @@ class LeftTree extends Component {
copyTree: [],
copyExpandedKeys: [],
searchValue: "",
- rightClickNodeTreeItem: null,
+ rightClickNodeTreeItem: null
};
}
componentDidMount() {
@@ -77,9 +34,19 @@ class LeftTree extends Component {
document.removeEventListener("click", this.handleClick);
}
+ componentWillReceiveProps(nextProps) {
+ if (
+ nextProps.deleteOfficeClassifyFlag !== this.props.deleteOfficeClassifyFlag
+ ) {
+ const { officeManageStore } = this.props;
+ const { officeClassifyId } = officeManageStore;
+ this.handleDelete(officeClassifyId);
+ }
+ }
+
getTreeData = () => {
const { officeManageStore } = this.props;
- officeManageStore.getTreeData().then((res) => {
+ officeManageStore.getTreeData().then(res => {
const { code, data, msg } = res;
if (code === 200) {
let cp = JSON.stringify([data]);
@@ -87,7 +54,7 @@ class LeftTree extends Component {
treeData: [data],
expandedKeys: this.expandedKeysFun([data]),
copyTree: cp,
- copyExpandedKeys: [],
+ copyExpandedKeys: []
});
} else {
message.error(res.msg);
@@ -98,23 +65,28 @@ class LeftTree extends Component {
handleClick = () => {
this.setState({ rightClickNodeTreeItem: null });
};
- onSelect = (node) => {
+ onSelect = node => {
const [postId] = node;
const { officeManageStore } = this.props;
+ officeManageStore.setOfficeClassifyId(
+ !postId
+ ? officeManageStore.officeClassifyId
+ : postId != "-1" ? postId : ""
+ );
officeManageStore.getPostInfoTable(postId);
this.setState({
- rightClickNodeTreeItem: null,
+ rightClickNodeTreeItem: null
});
};
- treeNodeonRightClick = (e) => {
+ treeNodeonRightClick = e => {
this.setState({
rightClickNodeTreeItem: {
pageX: e.event.pageX,
pageY: e.event.pageY,
id: e.node.props["eventKey"],
- categoryName: e.node.props["data-title"],
- },
+ categoryName: e.node.props["data-title"]
+ }
});
};
@@ -149,9 +121,9 @@ class LeftTree extends Component {
}
return new RegExp(filterText, "i").test(data.title);
};
- flatTreeFun = (treeData) => {
+ flatTreeFun = treeData => {
let arr = [];
- const flatTree = (treeData) => {
+ const flatTree = treeData => {
treeData.map((item, index) => {
arr.push(item);
if (item.children && item.children.length > 0) {
@@ -163,12 +135,12 @@ class LeftTree extends Component {
flatTree(treeData);
return arr;
};
- expandedKeysFun = (treeData) => {
+ expandedKeysFun = treeData => {
if (treeData && treeData.length == 0) {
return [];
}
let arr = [];
- const expandedKeysFn = (treeData) => {
+ const expandedKeysFn = treeData => {
treeData.map((item, index) => {
arr.push(item.key);
if (item.children && item.children.length > 0) {
@@ -179,13 +151,13 @@ class LeftTree extends Component {
expandedKeysFn(treeData);
return arr;
};
- onChange = (value) => {
+ onChange = value => {
if (value == "") {
let { copyTree, copyExpandedKeys } = this.state;
this.setState({
treeData: JSON.parse(copyTree),
expandedKeys: copyExpandedKeys,
- searchValue: value,
+ searchValue: value
});
} else {
let { copyTree, copyExpandedKeys } = this.state;
@@ -198,7 +170,7 @@ class LeftTree extends Component {
this.setState({
treeData: res,
expandedKeys: expkey,
- searchValue: value,
+ searchValue: value
});
}
};
@@ -208,7 +180,7 @@ class LeftTree extends Component {
const tmpStyle = {
position: "absolute",
left: `${pageX}px`,
- top: `${pageY}px`,
+ top: `${pageY}px`
};
const menu = (
diff --git a/pc4mobx/organization/components/postionrank/JobLevel.js b/pc4mobx/organization/components/postionrank/JobLevel.js
index 3df8592..a8959f0 100644
--- a/pc4mobx/organization/components/postionrank/JobLevel.js
+++ b/pc4mobx/organization/components/postionrank/JobLevel.js
@@ -454,7 +454,6 @@ export default class JobLevel extends React.Component {
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => jobLevel.setVisible(false)}
- enable={false} //是否开启字段联动
/>
)
diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js
index 2158d77..4008a37 100644
--- a/pc4mobx/organization/components/postionrank/RankScheme.js
+++ b/pc4mobx/organization/components/postionrank/RankScheme.js
@@ -422,7 +422,6 @@ export default class RankScheme extends React.Component {
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => rankScheme.setVisible(false)}
- enable={false} //是否开启字段联动
/>