loulijun2021
2022-08-05 d33eacc1f85ac3a736b33ba4713a19aae466d711
src/views/wlgl/kwdy.vue
@@ -23,7 +23,13 @@
              <el-input v-model="form.createuser" style="width: 200px" placeholder="请输入" />
            </el-form-item>
            <el-form-item label="所属仓库" style=" display: flex;">
              <el-select v-model="form.stockcode" :popper-append-to-body="false" style="width: 200px" placeholder="请选择">
              <el-select
                v-model="form.stockcode"
                :popper-append-to-body="false"
                style="width: 200px"
                placeholder="请选择"
              >
                <!--                @focus="getWareHouseSelect"-->
                <el-option
                  v-for="item in stockArr"
                  :key="item.code"
@@ -42,7 +48,7 @@
      <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-upload2" @click="upload">导入</el-button>-->
      </div>
      <el-divider />
      <div class="elTableDiv">
@@ -50,7 +56,7 @@
          :data="tableData"
          border
          stripe
          :height="tableHeight"
          :height="tableHeight+'px'"
          :style="{width: 100+'%',height:tableHeight+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
@@ -95,9 +101,11 @@
            prop="lm_date"
            label="创建时间"
            sortable="custom"
            width="160"
          />
          <el-table-column
            label="操作"
            width="120"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
@@ -140,10 +148,12 @@
        <el-form-item label="所属库位" prop="stockcode">
          <el-select
            v-model="dialogForm.stockcode"
            filterable
            :popper-append-to-body="false"
            style="width: 200px"
            placeholder="请选择"
          >
            <!--            @focus="getWareHouseSelect2"-->
            <el-option
              v-for="item in stockArr"
              :key="item.code"
@@ -163,12 +173,13 @@
        </div>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateStorageDef, DeleteStorageDef, StorageDefSearch, WareHouseDefSearch, WareHouseSelect } from '@/api/wlgl'
import { AddUpdateStorageDef, DeleteStorageDef, StorageDefSearch, WareHouseSelect } from '@/api/wlgl'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
@@ -204,6 +215,7 @@
      },
      total: 10,
      stockArr: [], // 所属仓库数组
      // stockArr2: [], // 所属仓库数组对话框
      tableData: [],
      dialogVisible: false,
      dialogForm: {
@@ -230,23 +242,36 @@
    }
  },
  created() {
    this.getStorageDefSearch()
    this.getWareHouseSelect()
    this.handleRequest()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    handleRequest() {
      this.getStorageDefSearch().then(res => {
        if (res.code === '200') {
          this.getWareHouseSelect()
        }
      })
    },
    async getStorageDefSearch() {
      const res = await StorageDefSearch(this.form)
      this.tableData = res.data
      this.total = res.count
      return { code: res.code }
    },
    async getWareHouseSelect() {
      const { data: res } = await WareHouseSelect()
      this.stockArr = res
    },
    // 对话框中的
    // async getWareHouseSelect2() {
    //   const { data: res } = await WareHouseSelect()
    //   this.stockArr2 = res
    // },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
@@ -263,9 +288,6 @@
    // 查询
    search() {
      this.getStorageDefSearch()
    },
    upload() {
    },
    // 重置
    reset() {
@@ -351,12 +373,13 @@
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 250
        this.tableHeight = this.mainHeight - 100
        if (window.innerHeight < 800) {
        this.tableHeight = this.mainHeight - 50
        if (window.innerHeight < 769) {
          this.tableHeight = this.tableHeight - 50
        }
      })
    }
  }
}
</script>