后台网上应用调查中心相关开发

This commit is contained in:
Chengliang 2024-05-16 17:20:04 +08:00
parent b7a6cdc416
commit 4deae1fe19
4 changed files with 57 additions and 34 deletions

View File

@ -27,6 +27,12 @@ class VotingWeb extends React.Component {
componentDidMount() { componentDidMount() {
const { votingWebStore } = this.props; const { votingWebStore } = this.props;
const { infoDialog } = votingWebStore,
{ votingInfoStore } = infoDialog;
const { hash } = window.location;
const match = hash.match(/votingtype=(\d+)/);
votingInfoStore.defaultVotingType = match ? match[1] : null;
votingWebStore.defaultVotingType = match ? match[1] : null;
votingWebStore.initAuth(); votingWebStore.initAuth();
votingWebStore.getSearchCondition(); votingWebStore.getSearchCondition();
votingWebStore.search(); votingWebStore.search();

View File

@ -17,7 +17,7 @@ class VotingBasicInfo extends React.Component {
componentDidMount() { componentDidMount() {
const { votingInfoStore } = this.props, const { votingInfoStore } = this.props,
{ form, votingTypeOptions, defaultSubCompany, detachable, id } = votingInfoStore; { form, votingTypeOptions, defaultSubCompany, detachable, id, defaultVotingType } = votingInfoStore;
if (votingTypeOptions == null) { if (votingTypeOptions == null) {
votingInfoStore.reloadOptions(); votingInfoStore.reloadOptions();
} }
@ -35,6 +35,7 @@ class VotingBasicInfo extends React.Component {
valueObj: [{ id: `${defaultSubCompany.id}`, name: defaultSubCompany.name }], valueObj: [{ id: `${defaultSubCompany.id}`, name: defaultSubCompany.name }],
}, },
}); });
}; };
if (detachable == -1) { if (detachable == -1) {
votingInfoStore.initDetachable().then(initForm); votingInfoStore.initDetachable().then(initForm);
@ -53,6 +54,7 @@ class VotingBasicInfo extends React.Component {
'wea-voting-engine-basic-info': true, 'wea-voting-engine-basic-info': true,
isView: operation == 'view', isView: operation == 'view',
}); });
return ( return (
<div className={preCls}> <div className={preCls}>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@p99gl3`} spinning={loading}> <Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@p99gl3`} spinning={loading}>
@ -82,6 +84,7 @@ class VotingBasicInfo extends React.Component {
formParams = form.getFormParams(), formParams = form.getFormParams(),
{ remindType, remindBeforeTime, remindEndTime } = formParams; { remindType, remindBeforeTime, remindEndTime } = formParams;
const votingTypeOptions = toJS(votingInfoStore.votingTypeOptions); const votingTypeOptions = toJS(votingInfoStore.votingTypeOptions);
const marginCls = classnames({ const marginCls = classnames({
'voting-form-margin': (remindBeforeTime && remindBeforeTime.remindBeforeStart === '1') || (remindEndTime && remindEndTime.remindBeforeEnd === '1'), 'voting-form-margin': (remindBeforeTime && remindBeforeTime.remindBeforeStart === '1') || (remindEndTime && remindEndTime.remindBeforeEnd === '1'),
}); });
@ -126,6 +129,7 @@ label: getLabel(24111, '调查类型'),
domkey: ['votingType'], domkey: ['votingType'],
options: votingTypeOptions, options: votingTypeOptions,
hasAddBtn: true, hasAddBtn: true,
viewAttr: 1,
addOnClick: votingTypeStore.updateInfoDialog.bind(this, { visible: true }), addOnClick: votingTypeStore.updateInfoDialog.bind(this, { visible: true }),
}, },
], ],

View File

@ -40,6 +40,9 @@ export default class VotingInfoStore {
@observable memberVisible = false; @observable memberVisible = false;
@observable memberTableStore = new TableStore(); @observable memberTableStore = new TableStore();
//二开
@observable defaultVotingType = null;
constructor(type) { constructor(type) {
this.type = type; this.type = type;
} }
@ -74,7 +77,7 @@ export default class VotingInfoStore {
reloadOptions = () => { reloadOptions = () => {
this.loading = true; this.loading = true;
API.getConditions().then((result) => { API.getConditions().then((result) => {
this.votingTypeOptions = result.votingType.options; this.votingTypeOptions = result.votingType.options;;
this.loading = false; this.loading = false;
}); });
} }
@ -249,7 +252,7 @@ export default class VotingInfoStore {
add = () => { add = () => {
if (this.form.isFormInit) { if (this.form.isFormInit) {
this.form.resetForm(); this.form.resetForm();
this.form.updateFields({ isAnony: { value: '0' }, disableSeeResult: { value: '1' } }); this.form.updateFields({ isAnony: { value: '0' }, disableSeeResult: { value: '1' },votingType:{value:this.defaultVotingType}});
this.form.updateFields({ this.form.updateFields({
subcompany: this.defaultSubCompany ? { subcompany: this.defaultSubCompany ? {
value: `${this.defaultSubCompany.id}`, value: `${this.defaultSubCompany.id}`,

View File

@ -49,18 +49,28 @@ export default class VotingWebStore {
}; };
constructor() {} constructor() {}
//二开
@observable defaultVotingType = null;
@action @action
getSearchCondition = () => API.getConditions().then((result) => { getSearchCondition = () => API.getConditions().then((result) => {
this.searchForm.initFormFields(result.condition); this.searchForm.initFormFields(result.condition);
this.conditions = result.condition; this.conditions = result.condition;
this.votingMouldBrowser = result.btnBrowser.votingMould; this.votingMouldBrowser = result.btnBrowser.votingMould;
this.infoDialog.votingInfoStore.votingTypeOptions = result.votingType.options; let options = result.votingType.options;
for (var i = 0; i < options.length; i++) {
if (options[i].key == this.defaultVotingType) {
options[i].selected = true;
}
}
this.infoDialog.votingInfoStore.votingTypeOptions = options;
}) })
search = () => { search = () => {
this.loading = true; this.loading = true;
let formParams = this.searchForm.getFormParams(); let formParams = this.searchForm.getFormParams();
formParams.viewType = this.buttonType == 'delete' ? 'batchDelete' : 'batchApprove'; formParams.viewType = this.buttonType == 'delete' ? 'batchDelete' : 'batchApprove';
formParams.subcompanyid = this.choosedSubCompany ? this.choosedSubCompany.id : ''; formParams.subcompanyid = this.choosedSubCompany ? this.choosedSubCompany.id : '';
formParams.votingtype = this.defaultVotingType ? this.defaultVotingType : '';
return API.getTable(formParams).then((result) => { return API.getTable(formParams).then((result) => {
this.tableStore.getDatas(result.sessionkey, 1); this.tableStore.getDatas(result.sessionkey, 1);
this.loading = false; this.loading = false;