|
|
@@ -383,7 +383,7 @@
|
|
|
<!-- @click="() => (active = 0)"-->
|
|
|
<!-- >上一步-->
|
|
|
<!-- </el-button>-->
|
|
|
- <el-button type="primary" size="small" @click="submit">提交</el-button>
|
|
|
+ <el-button type="primary" size="small" v-click-once @click="submit">提交</el-button>
|
|
|
<el-button size="small" @click="cancel">关闭</el-button>
|
|
|
<!-- <visibility-range-dialog-->
|
|
|
<!-- :visibilityRangeDialogFlag.sync="visibilityRangeDialogFlag"-->
|
|
|
@@ -891,6 +891,7 @@ this.postOptions.push(...response.data);
|
|
|
}).catch((err) => {
|
|
|
this.$message.error(err);
|
|
|
console.log(err);
|
|
|
+ throw err;
|
|
|
});
|
|
|
},
|
|
|
handleTreeChange() {
|
|
|
@@ -920,70 +921,75 @@ this.postOptions.push(...response.data);
|
|
|
});
|
|
|
},
|
|
|
async submit() {
|
|
|
- // console.log('this.form~~~', this.$refs.businessComponentRef.form);
|
|
|
+ try {
|
|
|
+ // console.log('this.form~~~', this.$refs.businessComponentRef.form);
|
|
|
|
|
|
- // const businessComponentForm = this.$refs.businessComponentRef.form;
|
|
|
- let data = await this.$refs.generateForm.getData(false);
|
|
|
- // data['blank_business_component'] = businessComponentForm.blank_business_component;
|
|
|
- // this.$refs.generateForm.setData({
|
|
|
- // 'blank_business_component': data['blank_business_component']
|
|
|
- // });
|
|
|
- // 获取所有组件的引用
|
|
|
- let validArr = [];
|
|
|
- // 过滤出存在于componentRef中的键
|
|
|
- Object.keys(data).forEach((key) => {
|
|
|
- if (this.componentRef.includes(key)) {
|
|
|
- validArr.push(key);
|
|
|
- }
|
|
|
- });
|
|
|
+ // const businessComponentForm = this.$refs.businessComponentRef.form;
|
|
|
+ let data = await this.$refs.generateForm.getData(false);
|
|
|
+ // data['blank_business_component'] = businessComponentForm.blank_business_component;
|
|
|
+ // this.$refs.generateForm.setData({
|
|
|
+ // 'blank_business_component': data['blank_business_component']
|
|
|
+ // });
|
|
|
+ // 获取所有组件的引用
|
|
|
+ let validArr = [];
|
|
|
+ // 过滤出存在于componentRef中的键
|
|
|
+ Object.keys(data).forEach((key) => {
|
|
|
+ if (this.componentRef.includes(key)) {
|
|
|
+ validArr.push(key);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- // 检查每个组件的数据是否为空数组
|
|
|
- let emptyComponents = [];
|
|
|
- validArr.forEach((item) => {
|
|
|
- // 检查data[item]是否存在且为数组,并且长度为0
|
|
|
- if (Array.isArray(data[item]) && data[item].length === 0) {
|
|
|
- emptyComponents.push(item);
|
|
|
+ // 检查每个组件的数据是否为空数组
|
|
|
+ let emptyComponents = [];
|
|
|
+ validArr.forEach((item) => {
|
|
|
+ // 检查data[item]是否存在且为数组,并且长度为0
|
|
|
+ if (Array.isArray(data[item]) && data[item].length === 0) {
|
|
|
+ emptyComponents.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 如果有未填写的组件,显示提示信息
|
|
|
+ if (emptyComponents.length > 0) {
|
|
|
+ // this.$message.warning(`请填写完整信息:${emptyComponents.map(comp => this.getComponentName(comp)).join('、')}`);
|
|
|
+ this.$message.warning(`请填写完整信息`);
|
|
|
+ return false;
|
|
|
}
|
|
|
- });
|
|
|
|
|
|
- // 如果有未填写的组件,显示提示信息
|
|
|
- if (emptyComponents.length > 0) {
|
|
|
- // this.$message.warning(`请填写完整信息:${emptyComponents.map(comp => this.getComponentName(comp)).join('、')}`);
|
|
|
- this.$message.warning(`请填写完整信息`);
|
|
|
- return false;
|
|
|
+ // 使用Promise.all并行校验所有组件
|
|
|
+ // try {
|
|
|
+ // await Promise.all(validArr.map(key => {
|
|
|
+ // if (this.$refs[key] && typeof this.$refs[key].validateForm === 'function') {
|
|
|
+ // return this.$refs[key].validateForm();
|
|
|
+ // }
|
|
|
+ // return Promise.resolve(true); // 如果组件不存在或没有validateForm方法,默认通过
|
|
|
+ // }));
|
|
|
+ // console.log('所有组件校验通过');
|
|
|
+ // } catch (error) {
|
|
|
+ // console.error('表单校验失败:', error);
|
|
|
+ // this.$message.error('表单校验失败,请检查必填项');
|
|
|
+ // return false; // 任一组件校验失败则整体失败
|
|
|
+ // }
|
|
|
+ // console.log('data~~~~', data);
|
|
|
+ this.form.valueJson = await this.generateFormValid();
|
|
|
+ this.form.processType = '1';
|
|
|
+ console.log('formformformform', this.form);
|
|
|
+ console.log('this.form.dictList', this.dictList);
|
|
|
+ await processInstanceCreateAPI({
|
|
|
+ ...this.form,
|
|
|
+ variables: {
|
|
|
+ ...this.form.valueJson,
|
|
|
+ businessCode: this.form.code,
|
|
|
+ businessName: this.form.name,
|
|
|
+ businessType: this.dictList['collaborative_type']?.find(item => item.value == this.form.dictType)?.label
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.$message('提交审核成功');
|
|
|
+ this.$emit('reload');
|
|
|
+ this.cancel();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('提交失败:', error);
|
|
|
+ // 错误已经在generateFormValid中处理,这里不需要重复处理
|
|
|
}
|
|
|
-
|
|
|
- // 使用Promise.all并行校验所有组件
|
|
|
- // try {
|
|
|
- // await Promise.all(validArr.map(key => {
|
|
|
- // if (this.$refs[key] && typeof this.$refs[key].validateForm === 'function') {
|
|
|
- // return this.$refs[key].validateForm();
|
|
|
- // }
|
|
|
- // return Promise.resolve(true); // 如果组件不存在或没有validateForm方法,默认通过
|
|
|
- // }));
|
|
|
- // console.log('所有组件校验通过');
|
|
|
- // } catch (error) {
|
|
|
- // console.error('表单校验失败:', error);
|
|
|
- // this.$message.error('表单校验失败,请检查必填项');
|
|
|
- // return false; // 任一组件校验失败则整体失败
|
|
|
- // }
|
|
|
- // console.log('data~~~~', data);
|
|
|
- this.form.valueJson = await this.generateFormValid();
|
|
|
- this.form.processType = '1';
|
|
|
- console.log('formformformform', this.form);
|
|
|
- console.log('this.form.dictList', this.dictList);
|
|
|
- await processInstanceCreateAPI({
|
|
|
- ...this.form,
|
|
|
- variables: {
|
|
|
- ...this.form.valueJson,
|
|
|
- businessCode: this.form.code,
|
|
|
- businessName: this.form.name,
|
|
|
- businessType: this.dictList['collaborative_type']?.find(item => item.value == this.form.dictType)?.label
|
|
|
- }
|
|
|
- });
|
|
|
- this.$message('提交审核成功');
|
|
|
- this.$emit('reload');
|
|
|
- this.cancel();
|
|
|
},
|
|
|
cancel() {
|
|
|
this.$emit('update:processSubmitDialogFlag', false);
|