Просмотр исходного кода

fix: 优化获取详情逻辑,确保来源清单为空时不报错

xieyong 5 дней назад
Родитель
Сommit
3d0494b7f0

+ 3 - 2
src/views/bpm/handleTask/components/financialManage/invoiceManage/components/addOrEditDialog.vue

@@ -534,8 +534,9 @@
       },
       //获取详情
       async getInfo(id) {
-        this.form = await invoiceApplyInfoV2API(id);
-        this.form.relatedList = [this.form.relatedVO];
+        this.form = (await invoiceApplyInfoV2API(id)) || {};
+        //来源清单没有数据时给空数组,避免表格因空行报错
+        this.form.relatedList = this.form.relatedVO ? [this.form.relatedVO] : [];
         this.$nextTick(() => {
           // 根据来源类型设置数据源:99 用 tableInfo(setValue),非 99 用 tableInfoNew(putValue)
           if (this.form.sourceType == 99) {

+ 3 - 2
src/views/bpm/handleTask/components/financialManage/invoiceManage/components/detailDialog.vue

@@ -414,8 +414,9 @@
     methods: {
       //获取详情
       async getInfo(id) {
-        this.form = await invoiceApplyInfoV2API(id);
-        this.form.relatedList = [this.form.relatedVO];
+        this.form = (await invoiceApplyInfoV2API(id)) || {};
+        //来源清单没有数据时给空数组,避免表格因空行报错
+        this.form.relatedList = this.form.relatedVO ? [this.form.relatedVO] : [];
         this.form.category = Number(this.form.category) || '';
         this.$nextTick(() => {
           // 根据来源类型设置数据源:99 用 tableInfo(setValue),非 99 用 tableInfoNew(putValue)