TblSalaryCalculationFormTime.vue 2.5 KB
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" slot="detail">
        <a-row>
          <a-col :span="12">
            <a-form-model-item label="工资月份" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="salaryMonth">
              <a-month-picker
                v-model="model.salaryMonth"
                placeholder="请选择工资月份"
                format="YYYY-MM"
                @change="handleMonthChange"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>

<script>
import { httpAction, getAction } from '@/api/manage'
import { message } from 'ant-design-vue'
import { selectUp } from '../../../api/manage'
export default {
  name: 'TblSalaryCalculationFormTime',
  components: {},
  props: {
    //表单禁用
    disabled: {
      type: Boolean,
      default: false,
      required: false,
    },
  },
  data() {
    return {
      model: {
        salaryMonth: '', //工时
      },
      flg: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,

      url: {
        selectup: '/salary/calculation/selectup',
      },
    }
  },
  computed: {
    formDisabled() {
      return this.disabled
    },
  },
  methods: {
    handleMonthChange(value) {
      this.model.salaryMonth = value ? value.format('YYYY-MM') : null
    },
    selectup() {},
    submitForm() {
      const that = this
      // 触发表单验证
      this.$refs.form.validate((valid) => {
        if (valid) {
          that.confirmLoading = true
          selectUp(this.url.selectup, this.model)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok')
              } else {
                if (res.message === '操作失败,null') {
                  that.$message.warning('计算错误')
                } else if (this.model.salaryMonth === '') {
                  that.$message.error('请选择计算月份')
                } else {
                  that.$message.warning(res.message)
                }
              }
            })
            .finally(() => {
              that.confirmLoading = false
            })
        }
      })
    },
  },
}
</script>
<style lang="less" scoped>
.input_dis {
  border-color: #91d5ff;
  background-color: #e6f7ff;
}
</style>