1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
import pageSetting from './pageSetting';
import React, { Component, useContext } from 'react';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import ListTab from './ListTab';
import { getHandledPage, getWaitPage } from '../publicApiService';
import AuditModal from '@/webPublic/FormInsertDiy/AuditPage/BatchAudit/AuditModal';
import { ModalInfo } from '@/baseComponent/Modal';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import CreateC from '@/webPublic/FormInsertDiy/ExportComponent/ContextCreate';
class AuditPage extends Component {
constructor(props) {
super(props);
this.state = {};
}
// componentDidMount() {
// console.log(this.context);
// }
handleButtonSet = () => {
const { hasBatchAudit, batchAuditButtonName, noNeedForm, tab2Buttons = [] } = this.props;
return {
tab1: [
hasBatchAudit
? {
type: 'audit',
component: 'RenderComponent',
key: 'audit',
render: ({ selectRows, getPage }) => {
const disabled = !selectRows || !Array.isArray(selectRows) || !selectRows.length;
function handleClick(onShow) {
const taskName = selectRows[0].taskName;
const differentTask = selectRows.slice(1).find((i) => i.taskName !== taskName);
if (differentTask) {
return ModalInfo(
<div>
<strong style={{ color: 'red' }}> {differentTask.taskName} </strong>和
<strong> {taskName} </strong>
不能一起审核。
<br />
请将分开操作。
</div>,
);
}
onShow();
}
return (
<AuditModal
selectRows={selectRows}
getPage={getPage}
noNeedForm={noNeedForm}
key={'audit'}>
{({ onShow }) => (
<ButtonDiy
key={'audit'}
name={batchAuditButtonName || '批量审核'}
handleClick={() => handleClick(onShow)}
disabled={disabled}
/>
)}
</AuditModal>
);
},
}
: false,
].filter((i) => i),
tab2: tab2Buttons,
};
};
handleSearchSet = () => {
const { columns, searchCondition, allConfigSetInfo } = this.props;
const tab1 = {
search: {
field: {},
scroll: { x: 'max-content' },
getPageService: getWaitPage,
beforeSearchData: (data) => {
console.log(data);
let searcherKeyValue = {};
for (let item of searchCondition) {
if (
typeof data[item.key] !== 'undefined' &&
item.key !== 'taskDefKey' &&
item.key !== 'process_status'
) {
searcherKeyValue[item.base52] = data[item.key];
}
}
if (searcherKeyValue && Object.keys(searcherKeyValue).length) {
data.searcherKeyValue = JSON.stringify(searcherKeyValue);
}
if (data.process_status) {
data.formStatusId = data.process_status;
delete data.process_status;
}
return data;
},
responseCallBack: (response) => {
return response;
},
condition: searchCondition.filter((g) => {
if (!allConfigSetInfo.isShowWaitTaskDef) {
return g.key !== 'taskDefKey';
} else {
return true;
}
}),
nameSpan: {
big: 8,
small: 9,
},
fileSpan: {
big: 4,
small: 4,
},
...this.context.locationState?.tab1Props?.search,
},
tableRowKey: 'id',
columns,
};
const tab2 = {
search: {
field: {},
scroll: { x: 'max-content' },
getPageService: getHandledPage,
responseCallBack: (response) => {
return response;
},
beforeSearchData: (data) => {
let searcherKeyValue = {};
console.log(data);
for (let item of searchCondition) {
if (typeof data[item.key] !== 'undefined'
&& item.key !== 'taskDefKey'
&& item.key !== 'process_status'
) {
searcherKeyValue[item.base52] = data[item.key];
}
}
if (searcherKeyValue && Object.keys(searcherKeyValue).length) {
data.searcherKeyValue = JSON.stringify(searcherKeyValue);
}
if (data.process_status) {
data.formStatusId = data.process_status;
delete data.process_status;
}
return data;
},
condition: searchCondition.filter((g) => {
if (!allConfigSetInfo.isShowHandledTaskDef) {
return g.key !== 'taskDefKey';
} else {
return true;
}
}),
nameSpan: {
big: 8,
small: 9,
},
fileSpan: {
big: 4,
small: 4,
},
...this.context.locationState?.tab2Props?.search,
},
tableRowKey: 'id',
columns,
};
return {
tab1,
tab2,
};
};
render() {
const { workId, dataBaseId, addFields, searchCondition } = this.props;
return (
<PageHeaderWrapper title="">
<ListTab
tabList={pageSetting.tabList}
pageButton={this.handleButtonSet({})}
workId={workId}
dataBaseId={dataBaseId}
searchCondition={searchCondition}
addFields={addFields}
locationState={this.context.locationState}
pageSearch={this.handleSearchSet({})}
/>
</PageHeaderWrapper>
);
}
}
AuditPage.contextType = CreateC;
export default AuditPage;