yuansh hai 11 meses
pai
achega
94013e5f03

+ 18 - 2
src/views/oa/salary_management/personnelSalary/modules/ChangeBasicSalary.vue

@@ -40,12 +40,12 @@
                         </a-col>
                         <a-col :md="24">
                             <a-form-model-item label="加薪" :labelCol="{offset: 1}" prop="salaryIncrease">
-                                <a-input placeholder="请输入" v-model="formState.salaryIncrease"  @change="changeSalaryIncrease" :disabled="formState.salaryReduction!==''&&formState.salaryReduction"/>
+                                <a-input-number style="width: 70%;" placeholder="请输入" v-model="formState.salaryIncrease"  @change="changeSalaryIncrease" :disabled="formState.salaryReduction!==''&&formState.salaryReduction"/>
                             </a-form-model-item>
                         </a-col>
                         <a-col :md="24">
                             <a-form-model-item label="减薪" :labelCol="{offset: 1}" prop="salaryReduction">
-                                <a-input placeholder="请输入" v-model="formState.salaryReduction" @change="changeSalaryReduction" :disabled="formState.salaryIncrease!==''&&formState.salaryIncrease"/>
+                                <a-input-number style="width: 70%;" placeholder="请输入" v-model="formState.salaryReduction" @change="changeSalaryReduction" :disabled="formState.salaryIncrease!==''&&formState.salaryIncrease"/>
                             </a-form-model-item>
                         </a-col>
                         <a-col :md="24">
@@ -134,6 +134,15 @@
                 }
             },
             changeSalaryIncrease(data){
+            
+            
+              let num = Number(this.formState.beforeAdjustment)+Number(this.formState.salaryIncrease)
+             console.log(num);
+              if(num < 0){
+                this.$message.error('调整后薪资不能为负数!');
+                this.formState.salaryIncrease = 0;
+              }
+            
                 this.formState.afterAdjustment=Number(this.formState.beforeAdjustment)+Number(this.formState.salaryIncrease)
                 if(!this.formState.salaryIncrease||this.formState.salaryIncrease==''){
                     this.validatorRules.salaryReduction[0].required = true
@@ -144,6 +153,13 @@
                 this.$refs.form.clearValidate();
             },
             changeSalaryReduction(){
+              
+              let num = Number(this.formState.beforeAdjustment)-Number(this.formState.salaryReduction);
+              if(num < 0){
+                this.$message.error('调整后薪资不能为负数!');
+                this.formState.salaryReduction = 0;
+              }
+              
                 this.formState.afterAdjustment=Number(this.formState.beforeAdjustment)-Number(this.formState.salaryReduction)
                 if(!this.formState.salaryReduction||this.formState.salaryReduction==''){
                     this.validatorRules.salaryIncrease[0].required = true

+ 3 - 3
src/views/oa/salary_management/personnelSalary/modules/ChangeSalaryBase.vue

@@ -19,13 +19,13 @@
                 <a-form-model layout="inline" ref="form" :model="formState"  :rules="validatorRules">
                     <a-row :gutter="24">
                         <a-col :md="24">
-                            <a-form-model-item label="工资基数"  prop="totalNum"  :labelCol="{offset: 2}">
+                            <a-form-model-item label="当前工资基数"  prop="totalNum"  :labelCol="{offset: 0}">
                                 <a-input placeholder="请输入" v-model="formState.oldSalaryBase" disabled/>
                             </a-form-model-item>
                         </a-col>
                         <a-col :md="24" >
-                            <a-form-model-item label="新工资基数"  prop="basicSalary" >
-                                <a-input placeholder="请输入" v-model="formState.basicSalary" />
+                            <a-form-model-item label="新工资基数"  prop="basicSalary" >
+                                <a-input-number style="width: 100%;" placeholder="请输入" v-model="formState.basicSalary" />
                             </a-form-model-item>
                         </a-col>
                     </a-row>