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">
@@ -124,7 +132,7 @@
    <el-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="50%"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
@@ -132,18 +140,20 @@
    >
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="库位编码" prop="storagecode">
          <el-input v-model="dialogForm.storagecode" :disabled="operation!=='add'" style="width: 220px" />
          <el-input v-model="dialogForm.storagecode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="库位名称" prop="storagename">
          <el-input v-model="dialogForm.storagename" style="width: 220px" />
          <el-input v-model="dialogForm.storagename" style="width: 200px" />
        </el-form-item>
        <el-form-item label="所属库位" prop="stockcode">
          <el-select
            v-model="dialogForm.stockcode"
            filterable
            :popper-append-to-body="false"
            style="width: 220px"
            style="width: 200px"
            placeholder="请选择"
          >
            <!--            @focus="getWareHouseSelect2"-->
            <el-option
              v-for="item in stockArr"
              :key="item.code"
@@ -153,7 +163,7 @@
          </el-select>
        </el-form-item>
        <el-form-item label="库位描述">
          <el-input v-model="dialogForm.description" type="textarea" style="width: 220px" />
          <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
@@ -163,16 +173,17 @@
        </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 {
  name: 'Zzjg',
  name: 'KWDY',
  components: {
    Pagination
  },
@@ -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>