loulijun2021
2022-08-05 d33eacc1f85ac3a736b33ba4713a19aae466d711
src/views/wlgl/ckdy.vue
@@ -32,7 +32,13 @@
      <el-divider />
      <div style="margin-left: 10px;display: flex">
        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <!--        <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button>-->
        <el-button
          type="primary"
          icon="el-icon-refresh-right"
          @click="syncSeaveSearchWhareHouseLocation"
        >同步仓库/库位
        </el-button>
        <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button>
      </div>
      <el-divider />
      <div class="elTableDiv">
@@ -80,9 +86,11 @@
            prop="lm_date"
            label="创建时间"
            sortable="custom"
            width="160"
          />
          <el-table-column
            label="操作"
            width="120"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
@@ -133,18 +141,24 @@
        </div>
      </span>
    </el-dialog>
    <!--导入组件-->
    <import-picker ref="importPickerFunc" :shows.sync="shows" :title="title_value" :colos="colos" :code="code" />
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateWareHouseDef, DeleteWareHouseDef, WareHouseDefSearch } from '@/api/wlgl'
import { SeaveSearchWhareHouseLocation } from '@/api/ErpSyncMes'
import ImportPicker from '@/components/ImportPicker'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
  name: 'CKDY',
  components: {
    Pagination
    Pagination, ImportPicker
  },
  data() {
    const validateName = (rule, value, callback) => {
@@ -189,9 +203,19 @@
        warehousename: [
          { required: true, message: '请输入名称', trigger: ['blur', 'change'] }
        ]
      },
      title_value: '数据导入 / 仓库、库位定义',
      code: '6',
      shows: false
    }
  },
  watch: {
    shows() {
      if (!this.shows) {
        this.getWareHouseDefSearch()
      }
    }
  },
  created() {
@@ -206,6 +230,29 @@
      const res = await WareHouseDefSearch(this.form)
      this.tableData = res.data
      this.total = res.count
    },
    // 同步仓库/库位
    async syncSeaveSearchWhareHouseLocation() {
      const loading = this.$loading({
        lock: true,
        text: '正在同步仓库/库位,请稍等...',
        spinner: 'el-icon-loading',
        customClass: 'osloading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      const res = await SeaveSearchWhareHouseLocation()
      if (res.code === '200') {
        setTimeout(() => {
          this.getWareHouseDefSearch()
          loading.close()
          this.$message.success('同步成功!')
        }, 2000)
      } else {
        setTimeout(() => {
          loading.close()
          this.$message.error('同步失败!')
        }, 10000)
      }
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
@@ -224,8 +271,13 @@
    search() {
      this.getWareHouseDefSearch()
    },
    // 导入按钮
    upload() {
      this.shows = true
      this.$refs.importPickerFunc.newDataFunc()
    },
    colos() {
      this.shows = false
    },
    // 重置
    reset() {
@@ -306,7 +358,10 @@
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 250
        this.tableHeight = this.mainHeight - 100
        this.tableHeight = this.mainHeight - 50
        if (window.innerHeight < 769) {
          this.tableHeight = this.tableHeight - 50
        }
      })
    }
  }