黎星凯
2024-04-15 62b6a7fac3f2acde70b578431147c4a01f19c182
admin-web/src/views/stock/inventorycount/inventorytask/inventory.vue
@@ -1,6 +1,6 @@
<template>
  <win-md :title="setting.title" @close="close" :width="'1200px'">
    <el-form class="form" ref="ruleForm" :model="formData" :rules="rules">
    <el-form v-loading="loading" class="form" ref="ruleForm" :model="formData" :rules="rules">
      <el-row :gutter="20" style="margin-bottom: 20px" type="flex" align="middle">
        <el-col :span="6">盘点单号:{{ formData.businessFormCode }}</el-col>
        <el-col :span="6">盘点任务:{{ formData.businessFormName }}</el-col>
@@ -10,21 +10,22 @@
        </el-col>
      </el-row>
      <el-table
        v-loading="loading"
        :data="formData.formInventoryGoodsList"
        :rules="rules"
        height="400"
        height="500"
        :stripe="true"
        class="the-table"
      >
        <el-table-column prop="goodsTemplateName" label="物品名称"> </el-table-column>
        <el-table-column prop="baseGoodsModelsName" label="型号" align="center"> </el-table-column>
        <el-table-column prop="baseGoodsModelsId" label="型号id" v-show="false" align="center"> </el-table-column>
        <el-table-column prop="type" label="类别"> </el-table-column>
        <el-table-column prop="unit" label="单位" align="center"> </el-table-column>
        <el-table-column prop="inventoryCount" label="应有库存" align="center"> </el-table-column>
        <el-table-column prop="realNum" label="实盘数量" align="center">
          <template slot-scope="scope">
            <el-form-item
              style="margin-bottom: 0"
              label-width="0"
              :prop="`formInventoryGoodsList[${scope.$index}].realNum`"
              :rules="rules.realNum"
@@ -46,7 +47,8 @@
<script>
import winMd from '@/components/win/win-md';
import myButton from '@/components/myButton/myButton';
import { inventoryQuery, inventoryTemporaryStorage, inventoryFinish } from '@/api/stock/inventory';
import {inventoryDetail, inventoryFinish, inventoryQuery, inventoryTemporaryStorage} from '@/api/stock/inventory';
export default {
  components: { winMd, myButton },
  props: {
@@ -57,7 +59,7 @@
  },
  data() {
    return {
      loading: false,
      loading: true,
      btnLoading: false,
      formData: {
        businessFormCode: '',
@@ -75,38 +77,42 @@
  },
  created() {
    const info = JSON.parse(this.setting.info);
    console.log('info', info);
    if (info.states == 1) {
      // 继续盘点
      inventoryDetail({ id: this.setting.id }).then((res) => {
        this.loading = false
        this.formData = res;
        this.formData.id = this.setting.id;
      }).catch(()=>{
        this.loading = false
      });
    } else {
      inventoryQuery({ id: this.setting.id }).then((res) => {
        this.loading = false
        this.formData = res;
        this.formData.id = this.setting.id;
      }).catch(()=>{
        this.loading = false
      });
    }
      inventoryQuery({ id: this.setting.id }).then((res) => {
        this.formData = res;
        this.formData.id = this.setting.id;
      });
  },
  methods: {
    close() {
      this.$emit('close');
    },
    staging() {
      this.$refs['ruleForm'].validate((valid) => {
        if (valid) {
          const params = {
            ...this.formData,
            inventoryGoodsList: this.formData.formInventoryGoodsList,
          };
          inventoryTemporaryStorage(params).then(() => {
            this.$message.success('暂存成功!');
            this.close();
            this.$emit('search');
          });
        }
      const params = {
        id: this.formData.id,
        inventoryGoodsList: this.formData.formInventoryGoodsList,
      };
      this.loading = true
      inventoryTemporaryStorage(params).then(() => {
        this.loading = false
        this.$message.success('暂存成功!');
        this.close();
        this.$emit('search');
      }).catch(()=>{
        this.loading = false
      });
    },
    save() {
@@ -116,10 +122,13 @@
            ...this.formData,
            inventoryGoodsList: this.formData.formInventoryGoodsList,
          };
          this.loading = true
          inventoryFinish(params).then(() => {
            this.$message.success('暂存成功!');
            this.close();
            this.$emit('search');
          }).catch(()=>{
            this.loading = false
          });
        }
      });