Pārlūkot izejas kodu

feat: 添加款项子类型选择功能,优化数据处理逻辑

xieyong 1 mēnesi atpakaļ
vecāks
revīzija
1d1c5bba98
1 mainītis faili ar 50 papildinājumiem un 0 dzēšanām
  1. 50 0
      src/BIZComponents/paymentCollectionPlan/Index.vue

+ 50 - 0
src/BIZComponents/paymentCollectionPlan/Index.vue

@@ -137,6 +137,29 @@
           </el-select>
         </el-form-item>
       </template>
+      <template v-slot:subType="scope">
+        <el-form-item
+          v-if="scope.row.type == 1"
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.subType'"
+        >
+          <el-select
+            v-model="scope.row.subType"
+            placeholder="请选择款项子类型"
+            style="width: 100%"
+            :disabled="type == 'view'"
+            @change="(val) => subTypeChange(val, scope.$index)"
+          >
+            <el-option
+              v-for="item in subTypeOp"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </template>
       <template v-slot:headerRatio="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
@@ -251,6 +274,8 @@
         remark: '',
         type: '',
         typeName: '',
+        subType: '',
+        subTypeName: '',
         issueNumber: null
       };
       return {
@@ -263,6 +288,10 @@
           datasource: []
         },
         paymentTypeOp,
+        subTypeOp: [
+          { value: 'ADVANCE', label: '预收款' },
+          { value: 'DEPOSIT', label: '定金' }
+        ],
         rules: {},
         isLoadingFromApi: false
       };
@@ -303,6 +332,13 @@
             headerSlot: 'headerType',
             align: 'center'
           },
+          {
+            width: 150,
+            prop: 'subType',
+            label: '款项子类型',
+            slot: 'subType',
+            align: 'center'
+          },
           {
             prop: 'moneyName',
             label: '款项名称',
@@ -407,6 +443,20 @@
             this.paymentTypeOp.find((item) => item.value === val).label
           );
         }
+        // 非预付款时清空子类型
+        if (val != 1) {
+          this.$set(this.form.datasource[index], 'subType', '');
+          this.$set(this.form.datasource[index], 'subTypeName', '');
+        }
+      },
+      subTypeChange(val, index = null) {
+        if (val) {
+          this.$set(
+            this.form.datasource[index],
+            'subTypeName',
+            this.subTypeOp.find((item) => item.value === val).label
+          );
+        }
       },
       //输入比例更新金额
       async ratioInput(val, index = null) {