Browse Source

提交费用

panhui 5 years ago
parent
commit
8ec84787de
1 changed files with 37 additions and 14 deletions
  1. 37 14
      src/main/vue/src/components/fee/FeeAdd.vue

+ 37 - 14
src/main/vue/src/components/fee/FeeAdd.vue

@@ -10,7 +10,7 @@
             class="fee"
         >
             <el-form-item prop="feeName" label="费用名称">
-                <el-select v-model="form.feeType" clearable filterable placeholder="请选择" style="width: 100px;">
+                <el-select v-model="form.feeType" filterable placeholder="请选择" style="width: 100px;">
                     <el-option
                         v-for="item in feeMaintenanceIdOptions"
                         :key="item.value"
@@ -20,12 +20,17 @@
                     </el-option>
                 </el-select>
 
-                <el-input
+                <el-select
                     v-model="form.feeName"
-                    placeholder="请输入"
-                    clearable
+                    filterable
+                    allow-create
+                    default-first-option
+                    placeholder="请输入或选择"
                     style="width: 170px; margin-left: 10px;"
-                ></el-input>
+                >
+                    <el-option v-for="item in feeList" :key="item.value" :label="item.label" :value="item.value">
+                    </el-option>
+                </el-select>
             </el-form-item>
             <el-form-item prop="patentPartnerId" label="专利权人">
                 <el-select v-model="form.patentPartnerId" clearable filterable placeholder="请选择">
@@ -96,7 +101,8 @@ export default {
                     this.feeMaintenanceIdOptions = res[0].children.map(item => {
                         return {
                             label: item.name,
-                            value: item.name
+                            value: item.name,
+                            children: item.children
                         };
                     });
                 }
@@ -108,14 +114,12 @@ export default {
         this.$http
             .post('/partner/all', { size: 1000, query: { del: false } }, { body: 'json' })
             .then(res => {
-                if (res.length > 0) {
-                    res.forEach(item => {
-                        this.patentPartnerIdOptions.push({
-                            label: item.name,
-                            value: item.id
-                        });
-                    });
-                }
+                this.patentPartnerIdOptions = res.map(item => {
+                    return {
+                        label: item.name,
+                        value: item.id
+                    };
+                });
             })
             .catch(e => {
                 console.log(e);
@@ -156,6 +160,25 @@ export default {
             currencyMaintenanceIdOptions: []
         };
     },
+    computed: {
+        feeList() {
+            if (this.form.feeType) {
+                let feeType = [...this.feeMaintenanceIdOptions].find(item => {
+                    return item.value === this.form.feeType;
+                }) || { children: [] };
+                console.log(feeType);
+                console.log([...this.feeMaintenanceIdOptions]);
+                return feeType.children.map(item => {
+                    return {
+                        label: item.name,
+                        value: item.name
+                    };
+                });
+            } else {
+                return [];
+            }
+        }
+    },
     methods: {
         onSave() {
             this.$refs.form.validate(valid => {