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

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

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);
@ -45,14 +46,15 @@ class VotingBasicInfo extends React.Component {
render() { render() {
const { votingInfoStore } = this.props, const { votingInfoStore } = this.props,
{ form, votingTypeStore, loading, operation } = votingInfoStore, { form, votingTypeStore, loading, operation } = votingInfoStore,
{ isFormInit } = form, { isFormInit } = form,
{ infoDialog } = votingTypeStore; { infoDialog } = votingTypeStore;
const conditions = this.getConditions(); const conditions = this.getConditions();
const preCls = classnames({ const preCls = classnames({
'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}>
@ -78,10 +80,11 @@ class VotingBasicInfo extends React.Component {
getConditions = () => { getConditions = () => {
const { votingInfoStore } = this.props, const { votingInfoStore } = this.props,
{ form, votingTypeStore, detachable, rightStr, operation } = votingInfoStore, { form, votingTypeStore, detachable, rightStr, operation } = votingInfoStore,
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'),
}); });
@ -94,10 +97,10 @@ formParams = form.getFormParams(),
{ conditionType: 'input', label: getLabel(433, '描述'), domkey: ['descr'], inputType: 'multilang', isBase64: true }, { conditionType: 'input', label: getLabel(433, '描述'), domkey: ['descr'], inputType: 'multilang', isBase64: true },
detachable == 1 ? { detachable == 1 ? {
conditionType: 'browser', conditionType: 'browser',
label: getLabel(17868, '所属机构'), label: getLabel(17868, '所属机构'),
domkey: ['subcompany'], domkey: ['subcompany'],
viewAttr: 3, viewAttr: 3,
rules: 'required', rules: 'required',
browserConditionParam: { browserConditionParam: {
type: 169, type: 169,
title: getLabel(33553, '分部'), title: getLabel(33553, '分部'),
@ -106,27 +109,28 @@ rules: 'required',
}, },
} : null, } : null,
{ conditionType: 'DATEPICKER', { conditionType: 'DATEPICKER',
label: `${getLabel(24978, '开始日期')},${getLabel(277, '时间')}`, label: `${getLabel(24978, '开始日期')},${getLabel(277, '时间')}`,
domkey: ['startDate'], domkey: ['startDate'],
rules: 'required', rules: 'required',
viewAttr: 3, viewAttr: 3,
showTime: true, showTime: true,
formatPattern: 8, formatPattern: 8,
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
noInput: true }, noInput: true },
{ conditionType: 'DATEPICKER', { conditionType: 'DATEPICKER',
label: `${getLabel(24980, '结束日期')},${getLabel(277, '时间')}`, label: `${getLabel(24980, '结束日期')},${getLabel(277, '时间')}`,
domkey: ['endDate'], domkey: ['endDate'],
showTime: true, showTime: true,
formatPattern: 8, formatPattern: 8,
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
noInput: true }, noInput: true },
{ conditionType: 'SELECT', { conditionType: 'SELECT',
label: getLabel(24111, '调查类型'), label: getLabel(24111, '调查类型'),
domkey: ['votingType'], domkey: ['votingType'],
options: votingTypeOptions, options: votingTypeOptions,
hasAddBtn: true, hasAddBtn: true,
addOnClick: votingTypeStore.updateInfoDialog.bind(this, { visible: true }), viewAttr: 1,
addOnClick: votingTypeStore.updateInfoDialog.bind(this, { visible: true }),
}, },
], ],
}, },
@ -238,7 +242,7 @@ clearSub: false,
} }
saveVotingType = () => { saveVotingType = () => {
const { votingInfoStore } = this.props, const { votingInfoStore } = this.props,
{ votingTypeStore } = votingInfoStore; { votingTypeStore } = votingInfoStore;
votingTypeStore.saveInfo().then(() => { votingTypeStore.saveInfo().then(() => {
votingInfoStore.reloadOptions(); votingInfoStore.reloadOptions();
}); });

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;