<template> <a-modal :title="title" :width="900" :visible="visible" :maskClosable="false" :confirmLoading="confirmLoading" @ok="handleOk" @cancel="handleCancel"> <a-spin :spinning="confirmLoading"> <a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model"> <!-- 主表单区域 --> <a-row class="form-row" :gutter="0"> <a-col :span="24"> <a-form-model-item label="物料分区存放" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialAreaCode"> <a-input v-model="model.materialAreaCode" placeholder="请输入物料分区存放"></a-input> </a-form-model-item> </a-col> </a-row> </a-form-model> </a-spin> </a-modal> </template> <script> import {batchMaterialArea} from '@/api/api' export default { name: 'LocationBatchAreaModal', components: { }, data() { return { title: '', width: 800, visible: false, disableSubmit: false, confirmLoading: false, labelCol: { xs: {span: 24}, sm: {span: 6} }, wrapperCol: { xs: {span: 24}, sm: {span: 24 - 6} }, model: {}, } }, methods: { edit(record) { console.log(record); this.visible = true this.model.ids=record; }, handleOk() { this.submitForm() }, handleCancel() { this.close() }, submitForm() { // 触发表单验证 this.$refs.form.validate(valid => { if (valid) { this.confirmLoading = true; let params = { ids: this.model.ids, materialAreaCode: this.model.materialAreaCode, } batchMaterialArea(params).then((res) => { this.confirmLoading = false; if (res.success) { this.$emit('ok'); this.visible = false; }else{ this.$message.error(res.message); } }); } }) }, close() { this.$emit('close') this.visible = false this.$refs.form.clearValidate() }, } } </script>