lichao 3 éve
szülő
commit
ff81837395
1 módosított fájl, 271 hozzáadás és 257 törlés
  1. 271 257
      src/components/finance/applyPayment.vue

+ 271 - 257
src/components/finance/applyPayment.vue

@@ -2,12 +2,13 @@
   <div>
     <div v-for="(item, index) in list" :key="index">
       <el-row>
-        <el-col :span="24"><span class="delete_group" v-if="list.length !== 1"  @click="deleteGroup(index)">删除组</span></el-col>
+        <el-col :span="24"><span class="delete_group" v-if="list.length !== 1" @click="deleteGroup(index)">删除组</span>
+        </el-col>
       </el-row>
       <basic-container>
         <avue-form class="trading-form" :option="option" ref="form" v-model="item.form">
           <template slot-scope="scope" slot="corpId">
-            <selectComponent v-model="corpId" :configuration="configuration"/>
+            <selectComponent v-model="item.form.corpId" :configuration="configuration"/>
           </template>
           <template slot-scope="scope" slot="billNo">
             <el-select placeholder="请选择" v-model="item.form.billNo" clearable>
@@ -60,283 +61,296 @@
 </template>
 
 <script>
-  import { applyLoan,paymentApply } from "@/api/financialManagement/paymentRequest";
-  import _ from "lodash";
+import {applyLoan, paymentApply} from "@/api/financialManagement/paymentRequest";
+import _ from "lodash";
 
-    export default {
-      name: "applyPayment",
-      props:{
-        billType:{
-          type:String
-        },
-        billData:{
-          type:Object
-        },
-        choceFun:{
-          type:Function
-        },
-        arrList: {
-          type: Array,
-          default: [],
-        }
+export default {
+  name: "applyPayment",
+  props: {
+    billType: {
+      type: String
+    },
+    billData: {
+      type: Object
+    },
+    choceFun: {
+      type: Function
+    },
+    arrList: {
+      type: Array,
+      default: []
+    }
+
+  },
+  data() {
+    return {
+      form: {
+        form: {}
       },
-      data(){
-        return{
-          form:{
-            form:{}
-          },
-          list:[],
-          currencyDic:[],
-          corpId:"",
-          configuration:{
-            multipleChoices:false,
-            multiple:false,
-            disabled:true,
-            searchShow:true,
-            collapseTags:false,
-            placeholder:'请点击右边按钮选择',
-            dicData:[]
-          },
-          breakConfiguration:{
-            multipleChoices:false,
-            multiple:false,
-            disabled:true,
-            searchShow:true,
-            collapseTags:false,
-            placeholder:'请点击右边按钮选择',
-            dicData:[]
-          },
-          option:{
-            emptyBtn: false,
-            submitBtn: false,
-            labelWidth: 120,
-            menuSpan: 8,
-            column: [
+      list: [],
+      currencyDic: [],
+      corpId: "",
+      configuration: {
+        multipleChoices: false,
+        multiple: false,
+        disabled: true,
+        searchShow: true,
+        collapseTags: false,
+        placeholder: '请点击右边按钮选择',
+        dicData: []
+      },
+      breakConfiguration: {
+        multipleChoices: false,
+        multiple: false,
+        disabled: true,
+        searchShow: true,
+        collapseTags: false,
+        placeholder: '请点击右边按钮选择',
+        dicData: []
+      },
+      option: {
+        emptyBtn: false,
+        submitBtn: false,
+        labelWidth: 120,
+        menuSpan: 8,
+        column: [
+          {
+            label: this.billData.optionType === "JK" ? "合同号" : "订单号",
+            prop: 'srcOrderno',
+            span: 8,
+            disabled: true,
+            rules: [
               {
-                label: this.billData.optionType === "JK"?"合同号":"订单号",
-                prop: 'srcOrderno',
-                span: 8,
-                disabled:true,
-                rules: [
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
-              },
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: '客户名称',
+            prop: 'corpId',
+            span: 16,
+            rules: [
               {
-                label: '客户名称',
-                prop: 'corpId',
-                span: 16,
-                rules: [
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
-              },
-              this.billData.optionType === "JK"?
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          this.billData.optionType === "JK" ?
+            {
+              label: '提单号',
+              prop: 'billNo',
+              span: 8,
+              rules: [
+                {
+                  required: true,
+                  message: ' ',
+                  trigger: 'blur'
+                }
+              ]
+            } : {display: false},
+          {
+            label: '费用名称',
+            prop: 'costType',
+            span: 8,
+            rules: [
               {
-                label: '提单号',
-                prop: 'billNo',
-                span: 8,
-                rules: [
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
-              }:{display:false},
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: this.billData.optionType === "JK" ? '合同日期' : "订单日期",
+            type: "date",
+            prop: 'accDate',
+            span: 8,
+            rules: [
               {
-                label: '费用名称',
-                prop: 'costType',
-                span: 8,
-                rules: [
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
-              },
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: '单价',
+            prop: 'price',
+            span: 8,
+            rules: [
               {
-                label: this.billData.optionType === "JK"?'合同日期':"订单日期",
-                type:"date",
-                prop: 'accDate',
-                span: 8,
-                rules: [
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
+                pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
+                message: ' ',
+                trigger: 'blur'
               },
               {
-                label: '单价',
-                prop: 'price',
-                span: 8,
-                rules: [
-                  {
-                    pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
-                    message: ' ',
-                    trigger: 'blur'
-                  },
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
-              },
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: '金额',
+            prop: 'amount',
+            span: 8,
+            rules: [
               {
-                label: '金额',
-                prop: 'amount',
-                span: 8,
-                rules: [
-                  {
-                    pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
-                    message: ' ',
-                    trigger: 'blur'
-                  },
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
+                pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
+                message: ' ',
+                trigger: 'blur'
               },
               {
-              label: this.billType == ("采购申请货款" || "销售申请退款")?'付款日期':"收款日期",
-              prop: 'date',
-                type:'date',
-                span: 8,
-                rules: [
-                  {
-                    required: false,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
-              },
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: this.billData.itemType === "采购" ? '付款日期' : "收款日期",
+            prop: 'date',
+            type: 'date',
+            span: 8,
+            rules: [
               {
-                label: '计价单位',
-                prop: 'unit',
-                type:"select",
-                span: 8,
-                rules: [
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ],
-                dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
-                props: {
-                  label: "dictValue",
-                  value: "dictKey"
-                }
-              },
+                required: false,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: '计价单位',
+            prop: 'unit',
+            type: "select",
+            span: 8,
+            rules: [
               {
-                label: '币别',
-                prop: 'currency',
-                span: 8,
-                type:"select",
-                dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
-                props: {
-                  label: "dictValue",
-                  value: "dictKey"
-                },
-                rules: [
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
-              },
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ],
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            }
+          },
+          {
+            label: '币别',
+            prop: 'currency',
+            span: 8,
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            },
+            rules: [
               {
-                label: '汇率',
-                prop: 'exchangeRate',
-                span: 8,
-                rules: [
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
-              },
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: '汇率',
+            prop: 'exchangeRate',
+            span: 8,
+            rules: [
               {
-                label: '税率',
-                prop: 'taxRate',
-                span: 8,
-                rules: [
-                  {
-                    required: true,
-                    message: ' ',
-                    trigger: 'blur'
-                  }
-                ]
-              },
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: '税率',
+            prop: 'taxRate',
+            span: 8,
+            rules: [
               {
-                label: '备注',
-                prop: 'remarks',
-                span: 24,
-                type: 'textarea',
-                row: true,
-                minRows: 2,
-                isRules: false
+                required: true,
+                message: ' ',
+                trigger: 'blur'
               }
             ]
           },
-        }
+          {
+            label: '备注',
+            prop: 'remarks',
+            span: 24,
+            type: 'textarea',
+            row: true,
+            minRows: 2,
+            isRules: false
+          }
+        ]
       },
-      created() {
-        //币别
-        this.getWorkDicts("currency").then(res =>{
-          this.currencyDic = res.data.data
-        })
-        if (this.arrList.length == 0) {
-          this.form.form = this.billData
-          this.corpId =  this.billData.corpId
-          this.configuration.dicData = this.billData.corpsName
-        }
-        if (this.arrList.length > 0) {
-          this.list = this.arrList
+    }
+  },
+  created() {
+    //币别
+    this.getWorkDicts("currency").then(res => {
+      this.currencyDic = res.data.data
+    })
+    if (this.arrList.length == 0) {
+      this.form.form = this.billData
+      this.corpId = this.billData.corpId
+      this.configuration.dicData = this.billData.corpsName
+      this.addForm();
+    }
+    if (this.arrList.length > 0) {
+      this.list = this.arrList
+      let arr = []
+      this.list.forEach(item => {
+        let a = {
+          id: item.form.corpId,
+          cname: item.form.corpsName
         }
-        this.addForm();
-      },
-      methods:{
-        addForm(){
-          //去除form身上双向绑定
-          this.list.push(JSON.parse(JSON.stringify(this.form)))
-        },
-        deleteGroup(index){
-          this.list.splice(index, 1);
-        },
-        //计算单价  数量
-        // calculate(valueForm){
-        //   if(valueForm.price && valueForm.quantity){
-        //     valueForm.amount = _.multiply(valueForm.price, valueForm.quantity).toFixed(2);
-        //   }
-        // },
-        //币别选择
-        currencyChange(valueForm){
-          if(valueForm.currency === "USD"){
-            valueForm.exchangeRate = 6.3686;
-          }else{
-            valueForm.exchangeRate = 1;
-          }
-        },
-        async submit(){
-          let result = [];
-          await this.handleRulesValid(["form"],result)
-          if (result.some(item => item)) {
-            const itemsList =  this.list.map(item =>{ item.form.corpId = this.corpId; return item.form})
+        arr.push(a)
+      })
+      this.configuration.dicData = this.configuration.dicData.concat(arr)
+    }
+  },
+  methods: {
+    addForm() {
+      //去除form身上双向绑定
+      this.list.push(JSON.parse(JSON.stringify(this.form)))
+    },
+    deleteGroup(index) {
+      this.list.splice(index, 1);
+    },
+    //计算单价  数量
+    // calculate(valueForm){
+    //   if(valueForm.price && valueForm.quantity){
+    //     valueForm.amount = _.multiply(valueForm.price, valueForm.quantity).toFixed(2);
+    //   }
+    // },
+    //币别选择
+    currencyChange(valueForm) {
+      if (valueForm.currency === "USD") {
+        valueForm.exchangeRate = 6.3686;
+      } else {
+        valueForm.exchangeRate = 1;
+      }
+    },
+    async submit() {
+      let result = [];
+      await this.handleRulesValid(["form"], result)
+      if (result.some(item => item)) {
+        const itemsList = this.list.map(item => {
+          item.form.corpId = this.corpId;
+          return item.form
+        })
 
             const params = {
               billType : this.billType,