瀏覽代碼

应收账款新增调整

qymljy 2 年之前
父節點
當前提交
f053c316b8
共有 2 個文件被更改,包括 51 次插入40 次删除
  1. 49 38
      src/Form/accountsOverdueAdjustment/add.vue
  2. 2 2
      src/template/tableTemplate/index.vue

+ 49 - 38
src/Form/accountsOverdueAdjustment/add.vue

@@ -48,11 +48,12 @@
             </el-col>
             <el-col :span="24">
               <el-form-item label="订单行" prop="orderRow">
-                <tableTemplate :checkbox="true" ref="orderRow" :param="orderRow.param" :layout="orderRow.tablecols" height="calc(100vh - 295px)" :custom="true" :width="true" @selectionChange="orderRowSelect">
+                <tableTemplate prop="amount" :checkbox="true" ref="orderRow" :param="orderRow.param" :layout="orderRow.tablecols" height="calc(100vh - 295px)" :custom="true" :width="true" @selectionChange="orderRowSelect">
                   <template v-slot:customcol="scope">
                     <div v-if="scope.column.columnname === 'amount'">
-                      <el-form-item  prop="amountRules">
+                      <el-form-item   style="margin-bottom: 0 !important;" :rules="[{required: true, validator: validateAmount(scope.column.data,scope.column.data.amount,scope.column.data.overdueamount),message: '姓名不能为空', trigger: 'blur'}]" >
                         <el-input  v-model="scope.column.data.amount" autocomplete="off" placeholder="请输入" ></el-input>
+                        <div style="font-size: 12px;color: red" v-if="scope.column.data.isAmount">大于原逾期金额</div>
                       </el-form-item>
                     </div>
                     <div v-else-if="scope.column.columnname === 'intoaccountdate'">
@@ -76,7 +77,7 @@
       </div>
       <div class="fixed__btn__panel">
         <el-button size="small" @click="dialogVisible = false" class="normal-btn-width">取 消</el-button>
-        <el-button size="small" type="primary" @click="onSubmit" :loading="loading" class="normal-btn-width">确 定</el-button>
+        <el-button size="small" type="primary" @click="onSubmit" :loading="loading" class="normal-btn-width" :disabled="orderInfo.length === 0">确 定</el-button>
       </div>
     </el-drawer>
   </div>
@@ -154,10 +155,10 @@ export default {
         /*orderRow:[
           { required: true, message: '请选择订单行', trigger: 'change'},
         ],*/
-        amountRules: [
+        /*amount: [
           { required: true, validator: validateAmount,message: '姓名不能为空', trigger: 'blur' },
           // 其他校验规则
-        ],
+        ],*/
       },
       orderInfo:[],
       loading:false,
@@ -165,18 +166,13 @@ export default {
     }
   },
   methods:{
-    validateInput(index,data) {
-      console.log(index,'1111')
-      console.log(data,'2222')
-       /*const inputValue = this.tableData[index].value;*/
-       // 校验规则示例:非空校验
-       if (index > data) {
-         console.log('大于')
-         this.$set(this.inputValidations, `input_${index}`, false);
-       } else {
-         console.log('小于')
-         this.$set(this.inputValidations, `input_${index}`, true);
-       }
+    validateAmount(data,val,oldVal) {
+      if (val > oldVal){
+        data.isAmount = true
+      }else {
+        data.isAmount = false
+      }
+      this.orderRowChange(data)
     },
     addShow(){
     },
@@ -230,36 +226,51 @@ export default {
       })
     },
     onSubmit(){
-      this.$refs.form.validate(async (valid)=>{
+      this.$refs.form.validate(async (valid)=> {
         if (!valid) return false
-        const res = await this.$api.requested({
-          "id": 20240306134804,
-          "content": {
-            "sys_enterpriseid": this.form.sys_enterpriseid,
-            "sa_overdueadjustid": 0,
-            "sa_orderid": this.form.sa_orderid
+        console.log(this.orderInfo, '22222')
+        let flag = false
+        this.orderInfo.forEach(item=>{
+          if (item.amount && item.intoaccountdate){
+            flag = true
+          }else {
+            flag = false
           }
         })
-        if (res.code != 0){
-          const res1 = await this.$api.requested({
-            "id": "20240319154904",
+        console.log(flag,'flag')
+        if (flag){
+          const res = await this.$api.requested({
+            "id": 20240306134804,
             "content": {
-              "sa_overdueadjustid": res.data.sa_overdueadjustid,
-              "overdueadjustitems": this.orderInfo
+              "sys_enterpriseid": this.form.sys_enterpriseid,
+              "sa_overdueadjustid": 0,
+              "sa_orderid": this.form.sa_orderid
             }
           })
-          this.tool.showMessage(res1,()=>{
-            this.$refs.form.resetFields()
-            this.orderInfo = []
-            this.enterprisename = ''
-            this.sonum = ''
-            this.$store.dispatch('changeDetailDrawer',true)
-            this.$router.push({path:'/overdueAdjustmentDetail',query:{id:res.data.sa_overdueadjustid,rowindex:res.data.rowindex}})
-          })
+          if (res.code != 0){
+            const res1 = await this.$api.requested({
+              "id": "20240319154904",
+              "content": {
+                "sa_overdueadjustid": res.data.sa_overdueadjustid,
+                "overdueadjustitems": this.orderInfo
+              }
+            })
+            this.tool.showMessage(res1,()=>{
+              this.$refs.form.resetFields()
+              this.orderInfo = []
+              this.enterprisename = ''
+              this.sonum = ''
+              this.$store.dispatch('changeDetailDrawer',true)
+              this.$router.push({path:'/overdueAdjustmentDetail',query:{id:res.data.sa_overdueadjustid,rowindex:res.data.rowindex}})
+            })
+          }else {
+            this.$message.error(res.msg)
+          }
         }else {
-          this.$message.error(res.msg)
+          this.$message.error('信息未完善')
         }
       })
+
     },
     onClose(){}
   },

+ 2 - 2
src/template/tableTemplate/index.vue

@@ -10,7 +10,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column ref="table" show-overflow-tooltip v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width ? col.width : 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
+      <el-table-column  ref="table" show-overflow-tooltip v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width ? col.width : 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
         <template v-slot:header="{ column,$index }" v-if="customHeader">
           <slot name="header" :data="column"></slot>
         </template>
@@ -51,7 +51,7 @@ export default {
   custom:是否启用自定义结构;
   opwidth:操作列宽度
 */
-  props:['layout','custom','param','height','fixedName','width','checkbox','redirect','customHeader'],
+  props:['layout','custom','param','height','fixedName','width','checkbox','redirect','customHeader','prop'],
   data () {
     return {
       list:[],