custom/领悦

This commit is contained in:
黎永顺 2024-10-12 13:38:20 +08:00
parent 44fb334837
commit 925394e814
5 changed files with 51 additions and 16 deletions

View File

@ -30,15 +30,24 @@ class Index extends Component {
componentDidMount() {
const { value, fieldConfig } = this.props;
const { browserConditionParam: { replaceDatas = [] } } = fieldConfig;
if (value && replaceDatas.length > 0) {
const { value: defaultValue, browserConditionParam: { replaceDatas = [] } } = fieldConfig;
if ((value || defaultValue) && replaceDatas.length > 0) {
this.setState({
searchKeys: value.split(","),
searchKeys: (value || defaultValue).split(","),
selectedData: _.reduce(replaceDatas, (pre, cur) => ({ ...pre, [cur["id"]]: cur }), {})
});
}
}
componentWillReceiveProps(nextProps, nextContext) {
if (
(nextProps.value !== this.props.value && _.isEmpty(nextProps.value)) ||
(nextProps.fieldConfig.value !== this.props.fieldConfig.value && _.isEmpty(nextProps.fieldConfig.value))
) {
this.setState({ searchKeys: [], selectedData: [] });
}
}
renderSingle = () => {
const { fieldConfig } = this.props;
const { selectedData, searchKeys } = this.state;
@ -75,6 +84,7 @@ class Index extends Component {
selectedData: ((isSingle || browserConditionParam.isSingle) && !_.isEmpty(values)) ? { [_.last(values)]: datas[_.last(values)] } : datas
}, () => {
this.props.onChange && this.props.onChange(values.join(","));
this.props.onCustomChange && this.props.onCustomChange(this.state.selectedData);
if (form) {
form.updateFields({
[getKey(fieldConfig)]: { value: this.state.searchKeys.join(",") }

View File

@ -33,7 +33,7 @@ class GenerateDataDialog extends Component {
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.initLYForm();
if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.LYStore.initForm();
if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.LYStore.initDataForm();
}
initLYForm = () => {
@ -42,16 +42,16 @@ class GenerateDataDialog extends Component {
...item, items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) }))
}))
}, () => {
const { LYStore: { form } } = this.props;
form.initFormFields(this.state.conditions);
const { LYStore: { dataForm } } = this.props;
dataForm.initFormFields(this.state.conditions);
});
};
save = () => {
const { LYStore: { form }, type, onSearch } = this.props;
form.validateForm().then(f => {
const { LYStore: { dataForm }, type, onSearch } = this.props;
dataForm.validateForm().then(f => {
if (f.isValid) {
this.setState({ loading: true });
const payload = { ...form.getFormParams() };
const payload = { ...dataForm.getFormParams() };
APIFOX[type](payload).then(({ status, errormsg }) => {
this.setState({ loading: false });
if (status) {
@ -69,7 +69,7 @@ class GenerateDataDialog extends Component {
render() {
const { conditions, loading } = this.state;
const { LYStore: { form } } = this.props;
const { LYStore: { dataForm } } = this.props;
return (
<WeaDialog
{...this.props} style={{ width: 480, height: 80 }} initLoadCss title={getLabel(111, "生成数据")}
@ -77,7 +77,7 @@ class GenerateDataDialog extends Component {
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(537558, "保存")}</Button>
]}
>
<div className="form-dialog-layout">{getSearchs(form, conditions, 1, false)}</div>
<div className="form-dialog-layout">{getSearchs(dataForm, conditions, 1, false)}</div>
</WeaDialog>
);
}

View File

@ -113,12 +113,17 @@ class List extends Component {
};
handleOperate = (key) => {
const { payload, selectedRowKeys } = this.state;
const { type } = this.props;
const { type, query, ffgsqcLabel } = this.props;
switch (key) {
case "GENERATE":
this.setState({ visible: true });
break;
case "GENERATEVOUCHER":
const { ffgsqc } = query;
if (!ffgsqc) {
message.warning(getLabel(111, `${ffgsqcLabel}参数不能为空`));
return;
}
this.setState({ voucherDialog: { ...this.state.voucherDialog, visible: true } });
break;
case "EXPORTALL":

View File

@ -69,6 +69,7 @@ class Index extends Component {
rowKey: "bh", columns: [
{ title: getLabel(111, "名称"), dataIndex: "mc" },
{ title: getLabel(111, "辅助核算类型"), dataIndex: "fzhslx" },
{ title: getLabel(111, "辅助核算类型编号"), dataIndex: "fzhslxbh" },
{ title: getLabel(111, "编号"), dataIndex: "bh" }
]
},
@ -79,6 +80,9 @@ class Index extends Component {
}
}}
value={value}
onCustomChange={(value) => {
console.log("onCustomChange",value);
}}
onChange={(value) => onEdit({
record: { ...record, [col["column"]]: value }, index
})}
@ -101,13 +105,27 @@ class Index extends Component {
dataSource: _.head(datas).dataSource,
details: _.map(datas, o => ({
zy: o.zy, kjkm: o.kjkm, jfValue: o.jfValue, dfValue: o.dfValue,
fzhsXmqs: !o.fzhsXmqs ? "" : _.isString(o.fzhsXmqs) ? o.fzhsXmqs : o.fzhsXmqs.bh,
fzhsFwlb: !o.fzhsFwlb ? "" : _.isString(o.fzhsFwlb) ? o.fzhsFwlb : o.fzhsFwlb.bh,
fzhsSllb: !o.fzhsSllb ? "" : _.isString(o.fzhsSllb) ? o.fzhsSllb : o.fzhsSllb.bh,
fzhsKs: !o.fzhsKs ? "" : _.isString(o.fzhsKs) ? o.fzhsKs : o.fzhsKs.bh,
fzhsXmqs: !o.fzhsXmqs ? {} : _.isString(o.fzhsXmqs) ? o.fzhsXmqs : {
bh: o.fzhsXmqs.bh,
fzhslxbh: o.fzhsXmqs.fzhslxbh
},
fzhsFwlb: !o.fzhsFwlb ? {} : _.isString(o.fzhsFwlb) ? o.fzhsFwlb : {
bh: o.fzhsFwlb.bh,
fzhslxbh: o.fzhsFwlb.fzhslxbh
},
fzhsSllb: !o.fzhsSllb ? {} : _.isString(o.fzhsSllb) ? o.fzhsSllb : {
bh: o.fzhsSllb.bh,
fzhslxbh: o.fzhsFwlb.fzhslxbh
},
fzhsKs: !o.fzhsKs ? {} : _.isString(o.fzhsKs) ? o.fzhsKs : {
bh: o.fzhsKs.bh,
fzhslxbh: o.fzhsFwlb.fzhslxbh
},
fzhsOtherBmList: !o.fzhsOther ? [] : _.isString(o.fzhsOther) ? o.fzhsOther.split(",") : _.map(o.fzhsOther, o => (o.bh))
}))
};
console.log(payload, datas);
return;
this.setState({ loading: true });
API.pushUCAndSave(payload).then(({ status, errormsg }) => {
this.setState({ loading: false });

View File

@ -4,6 +4,8 @@ import { WeaForm } from "comsMobx";
export class LYStore {
@observable form = new WeaForm();
@action initForm = () => this.form = new WeaForm();
@observable dataForm = new WeaForm();//生成数据form
@action initDataForm = () => this.dataForm = new WeaForm();
@observable acctBookForm = new WeaForm(); //推送核算账簿form
@action initAcctBookForm = () => this.acctBookForm = new WeaForm();//重置推送核算账簿form
}