zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<template>
  <a-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel">
    <template slot="footer">
      <a-popconfirm title="确定放弃编辑?" @confirm="handleCancel" okText="确定" cancelText="取消">
        <a-button style="margin-right: .8rem">取消</a-button>
      </a-popconfirm>
 
      <a-button type="primary" :loading="confirmLoading" @click="handleOk()">
        保存
      </a-button>
    </template>
 
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model" :rules="validatorRules">
        <!-- 主表单区域 -->
        <a-row class="form-row" :gutter="16">
 
 
          <a-col :lg="8">
            <a-form-model-item label="技术类别" prop="jslb">
              <j-dict-select-tag disabled v-model="model.jslb" placeholder=""
                                 dictCode="bonus_jsfl" />
            </a-form-model-item>
          </a-col>
 
 
          <a-col v-if="showTechType1" :lg="8">
            <a-form-model-item label="发放进度" prop="ffjd">
              <j-dict-select-tag @input="changeProgress" v-model="model.ffjd" placeholder="请选择发放进度"
                                 dictCode="bonus_ffjd_gx" />
            </a-form-model-item>
          </a-col>
          <a-col v-if="showTechType2" :lg="8">
            <a-form-model-item label="发放进度" prop="ffjd">
              <j-dict-select-tag @input="changeProgress" v-model="model.ffjd" placeholder="请选择发放进度"
                                 dictCode="bonus_ffjd_gx_2" />
            </a-form-model-item>
          </a-col>
          <a-col v-if="showTechType3" :lg="8">
            <a-form-model-item label="发放进度" prop="ffjd">
              <j-dict-select-tag @input="changeProgress" v-model="model.ffjd" placeholder="请选择发放进度"
                                 dictCode="bonus_ffjd_gx_3" />
            </a-form-model-item>
          </a-col>
          <a-col v-if="showTechType4" :lg="8">
            <a-form-model-item label="发放进度" prop="ffjd">
              <j-dict-select-tag @input="changeProgress" v-model="model.ffjd" placeholder="请选择发放进度"
                                 dictCode="bonus_ffjd_gx_4" />
            </a-form-model-item>
          </a-col>
          <a-col :lg="8">
            <a-form-model-item label="成本系数" prop="tcxs">
              <a-input disabled v-model="model.tcxs" placeholder="成本系数" />
            </a-form-model-item>
          </a-col>
          <a-col :lg="8">
            <a-form-model-item label="销售实绩" prop="sale">
              <a-input-number @change="changeSale" style="width: 200px" :min="1" v-model="model.xse"
                              placeholder="销售实绩" />
            </a-form-model-item>
          </a-col>
 
 
          <a-col :lg="24">
            <div style="margin-left: 40px;">
              <p style="color: red">技术研发贡献奖金发放标准、发放期限</p>
              <p>A类:<label style="color: #00A0E9">发放标准-</label>销售实绩×1.5%×标准成本系数; <label style="color: #00A0E9">&nbsp;&nbsp;发放期限-</label>实际销售后的四年。前三年100%,第四年50%
              </p>
              <p>B类:<label style="color: #00A0E9">发放标准-</label>销售实绩×1%×标准成本系数; <label style="color: #00A0E9">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发放期限-</label>实际销售后的三年。前两年100%,第三年50%
              </p>
              <p>C类:<label style="color: #00A0E9">发放标准-</label>销售实绩×0.5%×标准成本系数; <label style="color: #00A0E9">&nbsp;&nbsp;发放期限-</label>实际销售后的二年。前一年100%,第二年50%
              </p>
              <p>D类:<label style="color: #00A0E9">发放标准-</label>销售实绩×0.5%×标准成本系数; <label style="color: #00A0E9">&nbsp;&nbsp;发放期限-</label>实际销售后的一年
              </p>
 
            </div>
            <p style="margin-left: 40px;margin-top: 30px">提成额:<label style="color: red">{{model.sfje}}</label></p>
 
          </a-col>
 
        </a-row>
 
      </a-form-model>
    </a-spin>
 
  </a-modal>
</template>
 
<script>
import JSelectUserByDepModal from '@/components/jeecgbiz/modal/JSelectUserByDepModal'
import { httpAction, getAction, postAction, putAction } from '@/api/manage'
 
export default {
  name: 'HsGxModal',
  components: {
    JSelectUserByDepModal
  },
  data() {
 
    return {
      title: '操作',
      visible: false,
      form: this.$form.createForm(this),
      base: 0,
      coe: 0.0,
      part1: 0,
      part2: 0,
      part3: 0,
      part4: 0,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      confirmLoading: false,
      validatorRules: {
        jslb: [
          { required: true, message: '技术类别不能为空', trigger: 'blur' }
        ], type: [
          { required: true, message: '项目类型不能为空', trigger: 'blur' }
        ],
        xse: [
          { required: true, message: '销售额不能为空', trigger: 'blur' }
        ],
        tcxs: [
          { required: true, message: '提成系数不能为空', trigger: 'blur' }
        ],
        ffjd: [
          { required: true, message: '请选择发放进度', trigger: 'blur' }
        ],
 
        sfje: [
          { required: true, message: '奖金不能为空', trigger: 'blur' }
        ],
 
 
      },
      url: {
        add: '/bon/item/addgx',
        edit: '/bon/item/editgx',
      }
    }
  },
  created() {
  },
  watch: {},
 
  mounted() {
 
  },
  computed: {
    showTechType1: function() {
      return this.model.jslb == 1
    },
    showTechType2: function() {
      return this.model.jslb == 2
    },
    showTechType3: function() {
      return this.model.jslb == 3
    },
    showTechType4: function() {
      return this.model.jslb == 4
    }
  },
  methods: {
    add() {
      this.edit({})
    },
    edit(record) {
 
      this.form.resetFields()
      this.visible = true
      this.model = Object.assign({}, record)
      this.$nextTick(() => {
        if (this.model.id) {
          let progress = this.model.ffjd
          //获取每年应该多少系数
          this.initBase(progress)
          //根据技术产品类型确定发放标准
          this.initCoe(this.model.jslb)
          this.changeSale(this.model.xse)
        }
 
      })
 
    },
 
    handleCancel() {
      this.close()
    },
    handleOk() {
 
      let that = this
      this.$refs.form.validate(valid => {
        if (valid) {
          that.confirmLoading = true
          //add
          if (!this.model.id) {
            postAction(this.url.add, that.model).then((res) => {
              that.confirmLoading = false
              if (res.success) {
                that.close()
                that.$message.success(res.message)
                that.$emit('ok', res.result)
                that.close()
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.confirmLoading = false
 
            })
 
            //edit
          } else {
            putAction(this.url.edit, that.model).then((res) => {
              that.confirmLoading = false
              if (res.success) {
                that.close()
                that.$message.success(res.message)
                that.$emit('ok', res.result)
                that.close()
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.confirmLoading = false
 
            })
 
          }
 
        }
 
      })
 
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    changeSale(e) {
      if (typeof e != 'number') {
        return false
      }
 
      if (this.base == 0) {
        this.$message.warning('请先选择发放进度')
        return false
      }
      this.initCoe(this.model.jslb)
 
      console.info('年基数')
      console.info(this.base)
      console.info('类别基数')
      console.info(this.coe)
      console.info('定额')
      console.info(this.model.tcxs)
 
      this.model.sfje = e * this.base * this.coe * this.model.tcxs / 100
 
      this.model.sfje = Number(this.model.sfje.toFixed(2))
 
    },
    changeProgress(e) {
 
      this.initBase(e)
      //当计算后再修改发放进度时(修改系数)  需要重新计算
      if (this.model.xse > 0) {
        this.changeSale(this.model.xse)
      }
 
    },
    initBase(e) {
      /* 4.2.3.3.1    A类新技术产品
    实际销售后的四年。前三年100%,第四年50%
    4.2.3.3.2        B类新产品
    实际销售后的三年。前两年100%,第三年50%
    4.2.3.3.3        C类新产品
    实际销售后的二年。前一年100%,第二年50%
    4.2.3.3.4     D类新产品
    实际销售后的一年。*/
      console.info(this.model.jslb)
      console.info(e)
      switch (this.model.jslb) {
        case 1:
          if (e < 44) {
            this.base = 1
          } else {
            this.base = 0.5
          }
 
          break
        case 2:
          if (e < 43) {
            this.base = 1
          } else if (e == 43) {
            this.base = 0.5
          }
 
          break
        case 3:
          if (e == 41) {
            this.base = 1
          } else if (e == 42) {
            this.base = 0.5
          }
 
          break
        case 4:
          if (e == 41) {
            this.base = 1
          }
 
          break
 
      }
 
    },
    initCoe(value) {
      if (value == 1) {
        this.coe = 1.5
      } else if (value == 2) {
        this.coe = 1.0
      } else if (value == 3 || value == 4) this.coe = 0.5
 
    },
    handleChangeUserCommon(v) {
 
    }
 
  }
}
</script>
 
<style scoped>
 
</style>