loulijun2021
2022-10-29 e713b378b01d189f972cfb5b9eae749ee95a8b51
src/views/wlgl/ckdy.vue
@@ -2,26 +2,29 @@
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup">
      <div class="bodyTopButtonGroup" style="justify-content: space-between">
        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <el-button
          icon="el-icon-refresh-right"
          @click="syncSeaveSearchWhareHouseLocation"
        >同步仓库/库位
        </el-button>
        <el-button icon="el-icon-download" @click="upload">导入</el-button>
        <div style="display: flex">
          <el-button
            icon="el-icon-refresh-right"
            @click="syncSeaveSearchWhareHouseLocation"
          >同步仓库/库位
          </el-button>
          <el-button icon="el-icon-download" @click="upload">导入</el-button>
        </div>
      </div>
      <div class="bodyTopFormGroup">
        <el-form
          ref="form"
          :model="form"
          label-width="80px"
          label-width="100px"
          inline
          style="display: flex;justify-content: space-between"
        >
          <div class="elForm">
            <el-form-item label="仓库编码" style=" display: flex;">
            <el-form-item label-width="70px" label="仓库编码" style=" display: flex;">
              <el-input v-model="form.warehousecode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="仓库名称" style=" display: flex;">
@@ -34,14 +37,19 @@
              <el-input v-model="form.createuser" style="width: 200px" placeholder="请输入" />
            </el-form-item>
          </div>
          <div style="display: flex;align-items: start;margin-top: 5px;z-index: 2">
          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened?'5%':'10%'}">
            <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
            <el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
        </el-form>
        <div
          class="bodyTopFormExpand"
        />
      </div>
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef"
          class="tableFixed"
          :data="tableData"
          border
          :height="tableHeight+'px'"
@@ -103,7 +111,7 @@
                <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                  <i class="el-icon-edit-outline" @click="edit('edit',row)" />
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="删除" placement="top">
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i class="el-icon-delete" @click="del(row)" />
                </el-tooltip>
              </div>
@@ -146,7 +154,12 @@
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="dialogVisibleConfirm">确 定</el-button>
          <el-button
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirm"
          >确 定</el-button>
        </div>
      </span>
    </el-dialog>
@@ -162,25 +175,14 @@
import { AddUpdateWareHouseDef, DeleteWareHouseDef, WareHouseDefSearch } from '@/api/wlgl'
import { SeaveSearchWhareHouseLocation } from '@/api/ErpSyncMes'
import ImportPicker from '@/components/ImportPicker'
import { validateCode } from '@/utils/global'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
  name: 'CKDY',
  components: {
    Pagination, ImportPicker
  },
  data() {
    const validateName = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请输入编码'))
      } else {
        if (SER_HZ.test(value)) {
          return callback(new Error('编码不能为中文'))
        } else {
          callback()
        }
      }
    }
    return {
      mainHeight: 0,
      tableHeight: 0,
@@ -207,7 +209,7 @@
      operation: '',
      dialogFormRules: {
        warehousecode: [
          { required: true, validator: validateName, trigger: ['blur', 'change'] }
          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
        ],
        warehousename: [
          { required: true, message: '请输入名称', trigger: ['blur', 'change'] }
@@ -322,6 +324,9 @@
        DeleteWareHouseDef({ warehousecode: row.code }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            if (this.form.page > 1 && this.tableData.length === 1) {
              this.form.page--
            }
            this.getWareHouseDefSearch()
          }
        })
@@ -344,6 +349,7 @@
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          this.$store.state.app.buttonIsDisabled = true
          const data = {
            'id': this.dialogForm.id,
            'warehousecode': this.dialogForm.warehousecode,
@@ -353,9 +359,10 @@
          }
          AddUpdateWareHouseDef(data).then(res => {
            if (res.code === '200') {
              this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogVisible = false
              this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.getWareHouseDefSearch()
              this.$store.state.app.buttonIsDisabled = false
            } else {
              this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
            }
@@ -367,10 +374,11 @@
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 200
        this.tableHeight = this.mainHeight - 195
        if (window.innerHeight < 769) {
          this.tableHeight = this.tableHeight - 40
        }
        this.$refs.tableDataRef.doLayout()
      })
    },
    tableRowClassName({ row, rowIndex }) {
@@ -470,6 +478,15 @@
  margin-bottom: 0;
}
.tableFixed{
  ::v-deep .el-table__fixed-right{
    height: 100% !important;
  }
  ::v-deep .el-table__fixed{
    height: 100% !important;
  }
}
</style>
<style>