ChangeBasicSalary.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div class="reply" ref = "replyModal">
  3. <a-modal
  4. title="薪资调整"
  5. width="25%"
  6. :visible="visible"
  7. :confirmLoading="loading"
  8. :getContainer ='()=>$refs.replyModal'
  9. @cancel="handleCancel"
  10. :closable="!loading"
  11. :maskClosable="!loading"
  12. destroyOnClose
  13. >
  14. <template #footer>
  15. <a-button @click="handleCancel" style="margin-left: 8px;" :loading = "loading">取消</a-button>
  16. <a-button @click="handleOk" type="primary" style="margin-left: 8px;" :loading = "loading">确认</a-button>
  17. </template>
  18. <div class="table-page-search-wrapper" >
  19. <a-form-model layout="inline" ref="form" :model="formState" :rules="validatorRules">
  20. <a-row :gutter="24">
  21. <a-col :md="24" >
  22. <a-form-model-item label="姓名" :labelCol="{offset: 2}">
  23. <a-input placeholder="请输入" v-model="formState.name" disabled/>
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :md="24" >
  27. <a-form-model-item label="组织" prop="name" :labelCol="{offset: 2}">
  28. <a-input v-model="formState.orgName" disabled/>
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :md="24" >
  32. <a-form-model-item label="部门" prop="name" :labelCol="{offset: 2}">
  33. <a-input v-model="formState.sysOrgCode" disabled/>
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :md="24" >
  37. <a-form-model-item label="当前薪资" prop="totalNum" >
  38. <a-input placeholder="" v-model="formState.beforeAdjustment" disabled/>
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :md="24">
  42. <a-form-model-item label="加薪" :labelCol="{offset: 1}" prop="salaryIncrease">
  43. <a-input placeholder="请输入" v-model="formState.salaryIncrease" @change="changeSalaryIncrease" :disabled="formState.salaryReduction!==''&&formState.salaryReduction"/>
  44. </a-form-model-item>
  45. </a-col>
  46. <a-col :md="24">
  47. <a-form-model-item label="减薪" :labelCol="{offset: 1}" prop="salaryReduction">
  48. <a-input placeholder="请输入" v-model="formState.salaryReduction" @change="changeSalaryReduction" :disabled="formState.salaryIncrease!==''&&formState.salaryIncrease"/>
  49. </a-form-model-item>
  50. </a-col>
  51. <a-col :md="24">
  52. <a-form-model-item label="调后薪资">
  53. <a-input placeholder="请输入" v-model="formState.afterAdjustment" disabled/>
  54. </a-form-model-item>
  55. </a-col>
  56. <a-col :md="24" >
  57. <a-form-model-item label="调整说明" class="nresume" style="height:100px !important">
  58. <a-input type="textarea" placeholder="请输入" v-model="formState.remarks" />
  59. </a-form-model-item>
  60. </a-col>
  61. </a-row>
  62. </a-form-model>
  63. </div>
  64. </a-modal>
  65. </div>
  66. </template>
  67. <script>
  68. import moment from 'moment'
  69. import pick from 'lodash.pick'
  70. import { FormTypes } from '@/utils/JEditableTableUtil'
  71. import { putAction,getAction,postAction } from '@/api/manage'
  72. export default {
  73. name: 'ChangeBasicSalary',
  74. components: {
  75. moment,
  76. },
  77. data() {
  78. return {
  79. formState:{},
  80. visible:false,
  81. loading:false,
  82. validatorRules: {
  83. salaryIncrease: [{required: true,message: '请输入!'}],
  84. salaryReduction: [{required: true,message: '请输入!'}],
  85. },
  86. }
  87. },
  88. created(){
  89. },
  90. watch: {
  91. },
  92. methods: {
  93. handleCancel(){
  94. this.visible = false
  95. this.formState = {}
  96. this.validatorRules.salaryReduction[0].required = true
  97. this.validatorRules.salaryIncrease[0].required = true
  98. this.RlabelCol={offset: 1 }
  99. this.IlabelCol={offset: 1 }
  100. },
  101. handleOk(){
  102. this.$refs.form.validate(valid => {
  103. if (valid) {
  104. this.loading = true
  105. postAction('/salary/salaryChangeRecord/saveSalaryChangeRecord', this.formState).then((res) => {
  106. if (res.success) {
  107. this.$message.success('添加成功!');
  108. this.handleCancel()
  109. this.$emit('ok')
  110. } else {
  111. this.$message.error(res.message);
  112. }
  113. }).finally(() => {
  114. this.loading = false
  115. })
  116. }
  117. })
  118. },
  119. getData(record){
  120. this.formState={
  121. userId :record.userId,
  122. name:record.name,
  123. orgName:record.orgName,
  124. sysOrgCode:record.sysOrgCode,
  125. beforeAdjustment:record.beforeAdjustment,
  126. salaryIncrease:record.salaryIncrease,
  127. salaryReduction:record.salaryReduction,
  128. afterAdjustment:record.afterAdjustment,
  129. remarks:record.remarks,
  130. code:record.code,
  131. cardNo:record.cardNo,
  132. }
  133. },
  134. changeSalaryIncrease(data){
  135. this.formState.afterAdjustment=Number(this.formState.beforeAdjustment)+Number(this.formState.salaryIncrease)
  136. if(!this.formState.salaryIncrease||this.formState.salaryIncrease==''){
  137. this.validatorRules.salaryReduction[0].required = true
  138. }else{
  139. this.validatorRules.salaryReduction[0].required = false
  140. }
  141. this.validatorRules.salaryIncrease[0].required = true
  142. this.$refs.form.clearValidate();
  143. },
  144. changeSalaryReduction(){
  145. this.formState.afterAdjustment=Number(this.formState.beforeAdjustment)-Number(this.formState.salaryReduction)
  146. if(!this.formState.salaryReduction||this.formState.salaryReduction==''){
  147. this.validatorRules.salaryIncrease[0].required = true
  148. }else{
  149. this.validatorRules.salaryIncrease[0].required = false
  150. }
  151. this.validatorRules.salaryReduction[0].required = true
  152. this.$refs.form.clearValidate();
  153. }
  154. }
  155. }
  156. </script>
  157. <style scoped lang="less">
  158. /deep/ .nresume .ant-input{
  159. height: 100px !important;
  160. }
  161. /deep/ .ant-select{
  162. width: 100%;
  163. }
  164. .form-table-heard:before {
  165. content: '*';
  166. color: red;
  167. }
  168. /deep/ .ant-calendar-picker{
  169. width: 113px !important;
  170. }
  171. /deep/.ant-modal-root>.ant-modal-wrap>.ant-modal {
  172. min-width: 0 !important;
  173. }
  174. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item>.ant-form-item-label{
  175. padding-right:0 !important
  176. }
  177. </style>