WirewayUpdateCircleResultModal.vue 2.93 KB
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model">
        <a-row>
          <a-col :span="24">
            <a-form-model-item :label="'库区'" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zoneCode">
              <a-select
                show-search
                placeholder="请选择库区"
                option-filter-prop="children"
                v-model="model.zoneCode">
                <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code">
                  {{ item.name }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item :label="'忽略差异数量'" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="diffQty">
              <a-input v-model="model.diffQty" :placeholder="'请输入忽略库存更新差异数量'"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>

<script>

import {batchRefreshInventory, getZoneList} from '@/api/api'

export default {
  name: "WirewayUpdateCircleResultModal",
  components: {},
  data() {
    return {
      title: "操作",
      width: 500,
      portList: [],
      zoneList: [],
      querySource: {},
      visible: false,
      model: {},
      labelCol: {
        xs: {span: 24},
        sm: {span: 5},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 16},
      },

      confirmLoading: false,
      validatorRules: {},
      url: {
        // add: "/task/taskHeader/createEmptyOut",
      }

    }
  },
  created() {
    //备份model原始值
    this.modelDefault = JSON.parse(JSON.stringify(this.model));
    this.loadFrom();
  },
  methods: {
    add() {
      this.edit(this.modelDefault);
    },
    edit() {
      // this.getPortList();
      // this.model = Object.assign({}, record);
      this.visible = true;
    },
    close() {
      this.$emit('close');
      this.visible = false;
      this.$refs.form.clearValidate();
    },
    loadFrom() {
      getZoneList().then((res) => {
        if (res.success) {
          this.zoneList = res.result
        }
      })
    },
    handleOk() {
      this.loading = true
      batchRefreshInventory(this.model).then((res) => {
        if (res.success) {
          //重新计算分页问题
          this.$message.success(res.message)
          this.loadData()
          this.onClearSelected()
        } else {
          this.$message.warning(res.message)
          this.selectedRowKeys = []
        }
      }).finally(() => {
        this.loading = false
      })
      this.close();
    },
    handleCancel() {
      this.close()
    },


  }
}
</script>