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
<template>
  <a-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <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="24">
            <a-form-model-item label="项目名称" prop="pro">
              <j-search-select-tag
                disabled
                v-model='model.pro'
                dict='pro_project,xmmc,id'
              >
              </j-search-select-tag>
            </a-form-model-item>
          </a-col>
          <a-col :lg="24">
            <a-form-model-item label="项目负责人" >
              <j-search-select-tag
                disabled
                v-model='model.fzr'
                dict='sys_user,realname,username'
                >
              </j-search-select-tag>
            </a-form-model-item>
          </a-col>
 
          <a-col :lg="24">
            <a-form-model-item label="项目奖励类型" prop="type">
              <j-dict-select-tag disabled v-model="model.type" title="项目奖励类型" dictCode="bonus_type" placeholder="请选择项目奖励类型" />
            </a-form-model-item>
          </a-col>
 
          <a-col :lg="24">
            <a-form-model-item label="发放进度" prop="ffjd">
              <j-dict-select-tag @input="changeFfjd" v-model="model.ffjd" title="发放进度" dictCode="bonus_ffjd_sc" placeholder="请选择项目奖励发放进度" />
            </a-form-model-item>
          </a-col>
          <a-col :lg="24">
            <a-form-model-item label="发放比例(%)"  prop="ffjd">
              <a-input disabled  v-model="model.yfbl" title="发放比例"    />
            </a-form-model-item>
          </a-col>
 
 
        </a-row>
      </a-form-model>
 
    </a-spin>
 
    <!--   选择用户  -->
  </a-modal>
</template>
 
<script>
import JSelectUserByDepModal from '@/components/jeecgbiz/modal/JSelectUserByDepModal'
import { postAction, putAction } from '@/api/manage'
 
export default {
  name: 'HsScModal',
  components: {
    JSelectUserByDepModal,
  },
  data() {
    return {
      title: '新增项目奖金核算',
      visible: false,
      form: this.$form.createForm(this),
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
      validatorRules: {
        pro: [{ required: true, message: '项目不能为空', trigger: 'blur' }],
        type: [{ required: true, message: '项目奖励类型不能为空', trigger: 'blur' }],
        ffjd: [{ required: true, message: '项目奖励发放进度不能为空', trigger: 'blur' }],
        yfbl: [{ required: true, message: '项目奖励发放比例不能为空', trigger: 'blur' }],
 
      },
      url: {
        add: '/bon/item/addsc',
        edit: '/bon/item/editsc',
      },
    }
  },
  watch: {
 
  },
  methods: {
    edit(record) {
      this.form.resetFields()
      this.visible = true
      this.model = Object.assign({}, record)
    },
    changeFfjd(value){
      switch (Number(value)) {
        case 11:
          this.model.yfbl = 42.5
          break
        case 12:
          this.model.yfbl = 42.5
          break
        case 13:
          this.model.yfbl = 15
          break
 
      }
 
    },
 
    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
              })*/
            that.confirmLoading = false
            that.close()
          }
        }
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
 
    handleChangeUserCommon(v) {},
  },
}
</script>
 
<style scoped>
</style>