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

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() {
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.getSearchCondition();
votingWebStore.search();
@ -245,7 +251,7 @@ class VotingWeb extends React.Component {
*/
onOperatesClick = (record, index, operate, flag) => {
const { votingWebStore } = this.props,
{ auth } = votingWebStore;
{ auth } = votingWebStore;
let status = Number(record.status);
switch (operate.index) {
case '0':// 编辑

View File

@ -17,7 +17,7 @@ class VotingBasicInfo extends React.Component {
componentDidMount() {
const { votingInfoStore } = this.props,
{ form, votingTypeOptions, defaultSubCompany, detachable, id } = votingInfoStore;
{ form, votingTypeOptions, defaultSubCompany, detachable, id, defaultVotingType } = votingInfoStore;
if (votingTypeOptions == null) {
votingInfoStore.reloadOptions();
}
@ -35,6 +35,7 @@ class VotingBasicInfo extends React.Component {
valueObj: [{ id: `${defaultSubCompany.id}`, name: defaultSubCompany.name }],
},
});
};
if (detachable == -1) {
votingInfoStore.initDetachable().then(initForm);
@ -45,14 +46,15 @@ class VotingBasicInfo extends React.Component {
render() {
const { votingInfoStore } = this.props,
{ form, votingTypeStore, loading, operation } = votingInfoStore,
{ isFormInit } = form,
{ form, votingTypeStore, loading, operation } = votingInfoStore,
{ isFormInit } = form,
{ infoDialog } = votingTypeStore;
const conditions = this.getConditions();
const preCls = classnames({
'wea-voting-engine-basic-info': true,
isView: operation == 'view',
});
return (
<div className={preCls}>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@p99gl3`} spinning={loading}>
@ -78,10 +80,11 @@ class VotingBasicInfo extends React.Component {
getConditions = () => {
const { votingInfoStore } = this.props,
{ form, votingTypeStore, detachable, rightStr, operation } = votingInfoStore,
{ form, votingTypeStore, detachable, rightStr, operation } = votingInfoStore,
formParams = form.getFormParams(),
{ remindType, remindBeforeTime, remindEndTime } = formParams;
const votingTypeOptions = toJS(votingInfoStore.votingTypeOptions);
const marginCls = classnames({
'voting-form-margin': (remindBeforeTime && remindBeforeTime.remindBeforeStart === '1') || (remindEndTime && remindEndTime.remindBeforeEnd === '1'),
});
@ -94,10 +97,10 @@ formParams = form.getFormParams(),
{ conditionType: 'input', label: getLabel(433, '描述'), domkey: ['descr'], inputType: 'multilang', isBase64: true },
detachable == 1 ? {
conditionType: 'browser',
label: getLabel(17868, '所属机构'),
domkey: ['subcompany'],
viewAttr: 3,
rules: 'required',
label: getLabel(17868, '所属机构'),
domkey: ['subcompany'],
viewAttr: 3,
rules: 'required',
browserConditionParam: {
type: 169,
title: getLabel(33553, '分部'),
@ -106,27 +109,28 @@ rules: 'required',
},
} : null,
{ conditionType: 'DATEPICKER',
label: `${getLabel(24978, '开始日期')},${getLabel(277, '时间')}`,
domkey: ['startDate'],
rules: 'required',
viewAttr: 3,
showTime: true,
formatPattern: 8,
format: 'yyyy-MM-dd HH:mm',
noInput: true },
{ conditionType: 'DATEPICKER',
label: `${getLabel(24980, '结束日期')},${getLabel(277, '时间')}`,
domkey: ['endDate'],
showTime: true,
formatPattern: 8,
format: 'yyyy-MM-dd HH:mm',
noInput: true },
{ conditionType: 'SELECT',
label: getLabel(24111, '调查类型'),
domkey: ['votingType'],
options: votingTypeOptions,
hasAddBtn: true,
addOnClick: votingTypeStore.updateInfoDialog.bind(this, { visible: true }),
label: `${getLabel(24978, '开始日期')},${getLabel(277, '时间')}`,
domkey: ['startDate'],
rules: 'required',
viewAttr: 3,
showTime: true,
formatPattern: 8,
format: 'yyyy-MM-dd HH:mm',
noInput: true },
{ conditionType: 'DATEPICKER',
label: `${getLabel(24980, '结束日期')},${getLabel(277, '时间')}`,
domkey: ['endDate'],
showTime: true,
formatPattern: 8,
format: 'yyyy-MM-dd HH:mm',
noInput: true },
{ conditionType: 'SELECT',
label: getLabel(24111, '调查类型'),
domkey: ['votingType'],
options: votingTypeOptions,
hasAddBtn: true,
viewAttr: 1,
addOnClick: votingTypeStore.updateInfoDialog.bind(this, { visible: true }),
},
],
},
@ -238,7 +242,7 @@ clearSub: false,
}
saveVotingType = () => {
const { votingInfoStore } = this.props,
{ votingTypeStore } = votingInfoStore;
{ votingTypeStore } = votingInfoStore;
votingTypeStore.saveInfo().then(() => {
votingInfoStore.reloadOptions();
});

View File

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

View File

@ -49,18 +49,28 @@ export default class VotingWebStore {
};
constructor() {}
//二开
@observable defaultVotingType = null;
@action
getSearchCondition = () => API.getConditions().then((result) => {
this.searchForm.initFormFields(result.condition);
this.conditions = result.condition;
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 = () => {
this.loading = true;
let formParams = this.searchForm.getFormParams();
formParams.viewType = this.buttonType == 'delete' ? 'batchDelete' : 'batchApprove';
formParams.subcompanyid = this.choosedSubCompany ? this.choosedSubCompany.id : '';
formParams.votingtype = this.defaultVotingType ? this.defaultVotingType : '';
return API.getTable(formParams).then((result) => {
this.tableStore.getDatas(result.sessionkey, 1);
this.loading = false;