|
|
@@ -552,13 +552,17 @@ export default {
|
|
|
formKey: 'fxcscsbV2',
|
|
|
defKey: 'Process_1li9h0n'
|
|
|
}
|
|
|
+
|
|
|
+ this.loading = true
|
|
|
for (let i = 0; i < addParams.paramWhere.length; i++) {
|
|
|
const item = addParams.paramWhere[i]
|
|
|
item.gai_jin_bian_hao_ = await this.getNextAlias('gjjllsh')
|
|
|
}
|
|
|
- console.log(addParams)
|
|
|
if (addParams.paramWhere.length) {
|
|
|
- await this.$common.request('add', addParams)
|
|
|
+ // 预防推送流程数据过多,做切片处理
|
|
|
+ await this.processInBatches(addParams.paramWhere).then(() => {}).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
console.log('改进流程推送成功')
|
|
|
} else {
|
|
|
console.log('无需推送')
|
|
|
@@ -609,6 +613,25 @@ export default {
|
|
|
this.$message.warning(error.message)
|
|
|
}
|
|
|
},
|
|
|
+ async processInBatches (array, batchSize = 20) {
|
|
|
+ for (let i = 0; i < array.length; i += batchSize) {
|
|
|
+ const batch = array.slice(i, i + batchSize)
|
|
|
+
|
|
|
+ try {
|
|
|
+ const addParams = {
|
|
|
+ 'tableName': 't_fxkzcsb2',
|
|
|
+ 'paramWhere': batch,
|
|
|
+ 'formKey': 'fxcscsbV2',
|
|
|
+ 'defKey': 'Process_1li9h0n'
|
|
|
+ }
|
|
|
+ await this.$common.request('add', addParams)
|
|
|
+ } catch (error) {
|
|
|
+ console.error('处理批次时出错:', error)
|
|
|
+ // 可以添加重试逻辑或错误处理
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('所有数据处理完成')
|
|
|
+ },
|
|
|
// id 转 姓名
|
|
|
switchIdtoUserName (id) {
|
|
|
const { userList } = this.$store.getters
|