From 4deae1fe191739329fe61572bc1d984fedc56515 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Thu, 16 May 2024 17:20:04 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=BD=91=E4=B8=8A=E5=BA=94?=
=?UTF-8?q?=E7=94=A8=E8=B0=83=E6=9F=A5=E4=B8=AD=E5=BF=83=E7=9B=B8=E5=85=B3?=
=?UTF-8?q?=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../smallApp/voting/components/VotingWeb.js | 8 ++-
.../smallApp/voting/public/VotingBasicInfo.js | 64 ++++++++++---------
.../smallApp/voting/stores/VotingInfoStore.js | 7 +-
.../smallApp/voting/stores/VotingWebStore.js | 12 +++-
4 files changed, 57 insertions(+), 34 deletions(-)
diff --git a/pc4backstage/smallApp/voting/components/VotingWeb.js b/pc4backstage/smallApp/voting/components/VotingWeb.js
index 56827f7..4a7081c 100644
--- a/pc4backstage/smallApp/voting/components/VotingWeb.js
+++ b/pc4backstage/smallApp/voting/components/VotingWeb.js
@@ -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':// 编辑
diff --git a/pc4backstage/smallApp/voting/public/VotingBasicInfo.js b/pc4backstage/smallApp/voting/public/VotingBasicInfo.js
index b2f1e93..258b169 100644
--- a/pc4backstage/smallApp/voting/public/VotingBasicInfo.js
+++ b/pc4backstage/smallApp/voting/public/VotingBasicInfo.js
@@ -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 (
@@ -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();
});
diff --git a/pc4backstage/smallApp/voting/stores/VotingInfoStore.js b/pc4backstage/smallApp/voting/stores/VotingInfoStore.js
index 53633b5..6554f74 100644
--- a/pc4backstage/smallApp/voting/stores/VotingInfoStore.js
+++ b/pc4backstage/smallApp/voting/stores/VotingInfoStore.js
@@ -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}`,
diff --git a/pc4backstage/smallApp/voting/stores/VotingWebStore.js b/pc4backstage/smallApp/voting/stores/VotingWebStore.js
index 0103b5f..eb3093e 100644
--- a/pc4backstage/smallApp/voting/stores/VotingWebStore.js
+++ b/pc4backstage/smallApp/voting/stores/VotingWebStore.js
@@ -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;