loulijun2021
2022-08-05 d33eacc1f85ac3a736b33ba4713a19aae466d711
src/views/wlgl/kwdy.vue
@@ -28,8 +28,8 @@
                :popper-append-to-body="false"
                style="width: 200px"
                placeholder="请选择"
                @focus="getWareHouseSelect"
              >
                <!--                @focus="getWareHouseSelect"-->
                <el-option
                  v-for="item in stockArr"
                  :key="item.code"
@@ -48,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">
@@ -101,9 +101,11 @@
            prop="lm_date"
            label="创建时间"
            sortable="custom"
            width="160"
          />
          <el-table-column
            label="操作"
            width="120"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
@@ -150,10 +152,10 @@
            :popper-append-to-body="false"
            style="width: 200px"
            placeholder="请选择"
            @focus="getWareHouseSelect2"
          >
            <!--            @focus="getWareHouseSelect2"-->
            <el-option
              v-for="item in stockArr2"
              v-for="item in stockArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
@@ -171,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 {
@@ -212,7 +215,7 @@
      },
      total: 10,
      stockArr: [], // 所属仓库数组
      stockArr2: [], // 所属仓库数组对话框
      // stockArr2: [], // 所属仓库数组对话框
      tableData: [],
      dialogVisible: false,
      dialogForm: {
@@ -239,28 +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
    },
    // async getWareHouseSelect2() {
    //   const { data: res } = await WareHouseSelect()
    //   this.stockArr2 = res
    // },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
@@ -277,9 +288,6 @@
    // 查询
    search() {
      this.getStorageDefSearch()
    },
    upload() {
    },
    // 重置
    reset() {
@@ -365,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>