zss
2023-11-17 2518e47a3ac999978fbf14612c967c3bbf421d25
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
<template>
  <el-dialog
    v-diadrag
    title="批量修改定额"
    :close-on-click-modal="false"
    :visible.sync="visible"
  >
    <el-form
      :model="dataForm"
      :rules="dataRule"
      ref="dataForm"
      label-width="120px"
      class="l-mes"
    >
      <el-row>
        <el-col :span="24">
          <el-form-item label="定额" prop="quota">
            <el-input v-model="dataForm.quota" placeholder="定额"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">关闭</el-button>
      <el-button
        type="primary"
        :disabled="isSubmit"
        v-thinclick="`dataFormSubmit`"
        >确定</el-button
      >
    </span>
  </el-dialog>
</template>
<script>
import { updateQuota } from '@/api/accounting/unitwork'
import { validateSixDecimalPositive } from '../../../util/validate'
 
export default {
  data() {
    return {
      visible: false,
      dataForm: {
        idList: [],
        quota: null
      },
      dataRule: {
        quota: [
          { required: true, message: '定额不能为空', trigger: 'blur' },
          { validator: validateSixDecimalPositive, trigger: 'blur' }
        ]
      },
      isSubmit: false
    }
  },
  methods: {
    init(ids) {
      this.visible = true
      this.dataForm.idList = ids
    },
    // 表单提交
    dataFormSubmit() {
      this.isSubmit = true
      this.$refs.dataForm.validate((valid) => {
        if (valid) {
          updateQuota(this.dataForm)
            .then((data) => {
              this.$message.success('修改成功')
              this.dataForm.quota = null
              this.visible = false
              this.isSubmit = false
              this.$emit('refreshDataList')
            })
            .catch((error) => {
              this.isSubmit = false
              console.log(error)
            })
        } else {
          this.isSubmit = false
        }
      })
    }
  },
  mounted() {}
}
</script>