diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index 5db2fdf3..e5942fb2 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -66,8 +66,8 @@ export const salaryItemConditions = [ value: "", options: [], multiple: true, - rules: "required|string", - viewAttr: 3, + rules: "", + viewAttr: 2, hide: true }, { @@ -118,7 +118,7 @@ export const salaryItemConditions = [ { key: "3", selected: false, showname: "3" }, { key: "4", selected: false, showname: "4" }, { key: "5", selected: false, showname: "5" }, - { key: "6", selected: true, showname: "6" }, + { key: "6", selected: false, showname: "6" }, { key: "7", selected: false, showname: "7" }, { key: "8", selected: false, showname: "8" }, { key: "9", selected: false, showname: "9" }, diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index dc2a1e81..37248849 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -3,6 +3,10 @@ import { inject, observer } from "mobx-react"; import { WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaSlideModal, WeaTools } from "ecCom"; import { WeaSwitch } from "comsMobx"; import { salaryItemConditions } from "./columns"; +import { commonEnumList } from "../../apis/archive"; +import { postFetch } from "../../util/request"; +import { getItemForm } from "../../apis/item"; + // import FormalFormModal from "./formalFormModal"; // import SalaryItemForm from "./salaryItemForm"; @@ -44,21 +48,32 @@ export default class CustomSalaryItemSlide extends React.Component { }); }; - // 保存公式成功回调 - handleSaveFormal = (data) => { - this.handleChange({ - formulaId: data.id, formulaContent: data.formula, - originFormulaContent: data.referenceType === "formula" ? data.formula : "", - originSqlContent: data.referenceType === "sql" ? data.formula : "" - }); - }; - initForm = (props) => { + initForm = async (props) => { + const { data: salaryItemForm } = props.id ? + await getItemForm({ id: props.id }) : { data: { sharedType: "0", useDefault: "0", hideDefault: "0" } }; + const [{ data: sharedTypeList }, { data: taxAgentList }] = await Promise.all([ + commonEnumList({ enumClass: "com.engine.salary.enums.sicategory.SharedTypeEnum" }), + postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" }) + ]); this.setState({ conditions: _.map(salaryItemConditions, c => { return { ...c, items: _.map(c.items, fields => { - fields = { ...fields, label: getLabel(fields.lanId, fields.label) }; + fields = { + ...fields, label: getLabel(fields.lanId, fields.label), + value: !_.isNil(salaryItemForm[getKey(fields)]) ? String(salaryItemForm[getKey(fields)]) : fields.value + }; switch (getKey(fields)) { + case "sharedType": + fields = { + ...fields, options: _.map(sharedTypeList, o => ({ key: o.value, showname: o.defaultLabel })) + }; + break; + case "taxAgentIds": + fields = { + ...fields, options: _.map(taxAgentList, o => ({ key: String(o.id), showname: o.name })) + }; + break; case "dataType": case "valueType": case "roundingMode": @@ -77,6 +92,23 @@ export default class CustomSalaryItemSlide extends React.Component { props.salaryItemStore.itemsForm.initFormFields(this.state.conditions); }); }; + handleChangeFormItem = (res) => { + const { conditions } = this.state, [key] = _.keys(res), value = res[key].value; + this.setState({ + conditions: _.map(conditions, c => { + return { + ...c, items: _.map(c.items, fields => { + if (key === "sharedType" && getKey(fields) === "taxAgentIds") { + fields = { + ...fields, viewAttr: value === "0" ? 2 : 3, hide: value === "0" + }; + } + return fields; + }) + }; + }) + }); + }; renderForm = () => { const { salaryItemStore: { itemsForm: form } } = this.props; const { conditions } = this.state, { isFormInit } = form, formParams = form.getFormParams(); @@ -88,7 +120,7 @@ export default class CustomSalaryItemSlide extends React.Component { com: ( - + { fields.tip && { + const { salaryItemStore: { itemsForm: form } } = this.props; + form.validateForm().then(f => { + if (f.isValid) { + console.log(form.getFormParams()); + } else { + f.showErrors(); + } + }); + }; onDropMenuClick = (key, targetid = "") => { switch (key) { case "log": @@ -202,16 +211,22 @@ export default class SalaryItem extends React.Component { case "customAdd": case "edit": const { taxAgentStore: { showOperateBtn, showSalaryItemBtn } } = this.props; + const { loading } = this.state; const title = key === "edit" ? getLabel(111, "修改自定义薪资项目") : getLabel(111, "新建自定义薪资项目"); const buttons = key === "edit" ? [ , - + ] : [ - , - + , + ]; this.setState({ - customItemDialog: { visible: true, title, buttons: (showSalaryItemBtn || showOperateBtn) ? buttons : [] } + customItemDialog: { + visible: true, title, buttons: (showSalaryItemBtn || showOperateBtn) ? buttons : [], id: targetid + } }); break; case "sysAdd": diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index b80727e6..9fcd0e95 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -7,6 +7,12 @@ .salaryItems_content { height: 100%; + padding: 8px 16px; + background: #f6f6f6; + + & > .wea-new-table { + background: #FFFFFF; + } } } @@ -19,6 +25,10 @@ .wea-slide-modal-content { height: 100%; background: #f6f6f6; + + .wea-form-item-wrapper { + display: block !important; + } } .titleDialog { diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js index eee77555..83445529 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemsTable.js @@ -101,12 +101,12 @@ class SalaryItemsTable extends Component { }; return ( ( - onDropMenuClick("edit", record)} + onDropMenuClick("edit", record.id)} href="javascript:void(0);">{(showOperateBtn || showSalaryItemBtn) ? getLabel(111, "编辑") : getLabel(111, "查看")} { (showOperateBtn || showSalaryItemBtn) && record.canDelete &&