jiangping
2024-05-08 fe3af72b806d42d60b099fe5795e40c390b1cd29
company/src/components/enterprise/add_subtract_return.vue
@@ -15,58 +15,58 @@
</template>
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import { applyChangeOpt } from '@/api/business/applyChange'
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { applyChangeOpt } from '@/api/business/applyChange'
    export default {
        name: 'add_subtract_return',
        extends: BaseOpera,
        components: { GlobalWindow },
        data () {
            return {
                // 表单数据
                form: {
                    id: null,
                    remark: ''
                }
            }
        },
        created () {
            this.config({
                api: '/business/insurance',
                'field.id': 'id'
            })
        },
        methods: {
            open (title, target) {
                this.title = title
                this.visible = true
                this.$nextTick(() => {
                    this.$refs.form.resetFields()
                    this.form[this.configData['field.id']] = null
                })
                this.$nextTick(() => {
                    for (const key in this.form) {
                        this.form[key] = target[key]
                    }
                })
            },
            confirm() {
                this.isWorking = true
                applyChangeOpt({ applyId: this.form.id, optIllustration: this.form.remark, optType: 3 })
                    .then(res => {
                        this.visible = false
                        this.$tip.apiSuccess('操作成功')
                        this.$emit('success')
                    })
                    .catch(e => {
                        this.$tip.apiFailed(e)
                    })
                    .finally(() => {
                        this.isWorking = false
                    })
            }
        }
export default {
  name: 'add_subtract_return',
  extends: BaseOpera,
  components: { GlobalWindow },
  data () {
    return {
      // 表单数据
      form: {
        id: null,
        remark: ''
      }
    }
  },
  created () {
    this.config({
      api: '/business/insurance',
      'field.id': 'id'
    })
  },
  methods: {
    open (title, target) {
      this.title = title
      this.visible = true
      this.$nextTick(() => {
        this.$refs.form.resetFields()
        this.form[this.configData['field.id']] = null
      })
      this.$nextTick(() => {
        for (const key in this.form) {
          this.form[key] = target[key]
        }
      })
    },
    confirm () {
      this.isWorking = true
      applyChangeOpt({ applyId: this.form.id, optIllustration: this.form.remark, optType: 3 })
        .then(res => {
          this.visible = false
          this.$tip.apiSuccess('操作成功')
          this.$emit('success')
        })
        .catch(e => {
          this.$tip.apiFailed(e)
        })
        .finally(() => {
          this.isWorking = false
        })
    }
  }
}
</script>