wyg
2024-06-18 1308d4d7a162d3cabd0fe4f639b6d7f5dd376584
'基础数据仓库初次提交'
已修改5个文件
已添加13个文件
5217 ■■■■ 文件已修改
src/api/basicData/location.js 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/basicData/warehouse.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/BaseSearch.vue 226 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/index.vue 480 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/mixins/resize.js 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/variableSet/checkTaskItem.js 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/variableSet/columns.js 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/location/addModal.vue 283 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/location/index.vue 759 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/location/info.data.js 338 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/locationGroup/addModal.vue 294 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/locationGroup/index.vue 520 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/locationGroup/info.data.js 278 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/locationGroup/linshi.vue 410 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/warehouse/addModal.vue 247 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/warehouse/index.vue 534 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/warehouse/info.data.js 263 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/warehouse/linshi.vue 425 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/basicData/location.js
@@ -42,3 +42,25 @@
    method: 'delete'
  })
}
// æŸ¥è¯¢å·¥åŽ‚仓库列表
export function listWaresList() {
  return request({
    url: 'system/warehouse/listWerks',
    method: 'get',
  })
}
// æŸ¥è¯¢å·¥åŽ‚列表
export function listwerkshouse(query) {
  return request({
    url: '/system/werks/list',
    method: 'get',
    params: query
  })
}
src/api/basicData/warehouse.js
@@ -42,3 +42,7 @@
    method: 'delete'
  })
}
src/components/Table/BaseSearch.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,226 @@
<template>
  <div class="dialog-search">
    <el-form
      :inline="true"
      ref="ruleForm"
      :model="formInline"
      class="demo-form-inline"
      v-show="showSearch"
    >
      <el-form-item
        v-for="(item, index) in formItemListData"
        :key="index"
        :label="item.label"
      >
        <!-- ä¸‹æ‹‰é€‰æ‹©æ¡† -->
        <template v-if="item.component == 'Select'">
          <template v-if="item.slot">
            <slot :name="item.slot" :form="formInline" :field="item.field">
            </slot>
          </template>
          <template v-else>
            <el-select
              v-model="formInline[item.field]"
              :multiple="item.multiple"
              :placeholder="item.componentProps.placeholder"
              size="mini"
              clearable
            >
              <el-option
                v-for="(item2, index2) in item.selectOptions"
                size="mini"
                :key="index2"
                :label="item2.label"
                :value="item2.value"
              ></el-option>
            </el-select>
          </template>
        </template>
        <!-- ä¸‹æ‹‰é€‰æ‹©æ¡†end -->
        <!-- è¾“入框 -->
        <el-input
          v-if="item.component == 'Input' && item.show !== false"
          v-model.trim="formInline[item.field]"
          :placeholder="item.componentProps.placeholder"
          clearable
          size="mini"
        ></el-input>
        <!-- è¾“入框 -->
        <!-- æ—¥æœŸèŒƒå›´é€‰æ‹©æ¡† -->
        <el-date-picker
          v-if="
            item.component == 'daterange' ||
            item.component == 'datetimerange' ||
            item.component == 'date' ||
            item.component == 'datetime'
          "
          size="mini"
          v-model="formInline[item.field]"
          :value-format="item.valueFormat || 'yyyy/MM/dd'"
          :format="item.format || 'yyyy/MM/dd'"
          clearable
          :type="item.component || ''"
          :range-separator="item.rangeSeparator || '至'"
          :start-placeholder="item.componentProps.startPlaceholder"
          :end-placeholder="item.componentProps.endPlaceholder"
          :placeholder="item.componentProps.placeholder"
        >
        </el-date-picker>
        <!-- æ—¥æœŸèŒƒå›´é€‰æ‹©æ¡†end -->
        <!-- çº§è”选择器 -->
        <el-cascader
          v-if="item.component == 'cascader'"
          v-model="formInline[item.field]"
          :options="item.options"
          :props="item.props"
          size="mini"
          clearable
        ></el-cascader>
        <!-- çº§è”选择器end -->
      </el-form-item>
      <slot name="formItem"></slot>
      <el-form-item style="width: 10rem">
        <el-button type="primary" size="mini" @click="onSubmit">查询</el-button>
        <el-button type="" size="mini" @click="resetForm('ruleForm')"
          >重置</el-button
        >
      </el-form-item>
      <!-- å¯ç”¨äºŽæ˜¾ç¤ºå…¶ä»–按钮 -->
      <slot name="formButton"></slot>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <div class="bottonBox">
        <slot name="actionButton"></slot>
        <right-toolbar
          :showSearch.sync="showSearch"
          @queryTable="getList"
          class="rightbotton"
        ></right-toolbar>
      </div>
    </el-row>
  </div>
</template>
<script>
import request from "@/utils/request";
import { time } from "echarts";
export default {
  name: "BaseSearch",
  props: {
    emitSearch: {
      // æ˜¯å¦ç«‹å³æ‰§è¡Œæœç´¢
      type: Boolean,
      default: false,
    },
    formItemList: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  data() {
    let formInline = {};
    for (const obj of this.formItemList) {
      formInline[obj.field] = obj.defaultValue || "";
    }
    return {
      formInline,
      showSearch: true,
      // formItemListData: [],
    };
  },
  computed: {
    formItemListData() {
      return JSON.parse(JSON.stringify(this.formItemList)).map((item) => {
        if (item.component == "Select" && !item.slot) {
          if (item.componentProps.options) {
            item.selectOptions = item.componentProps.options;
          }
        }
        return item;
      });
    },
  },
  mounted() {},
  watch: {
    emitSearch(newVal, oldVal) {
      // æ˜¯å¦ç«‹å³è§¦å‘搜索  ç”¨åœ¨å¼¹çª—中异步请求下拉框后  æˆ–者给下拉框赋值默认值后  éœ€è¦ç”¨åˆ°è¿™ä¸ªæ–¹æ³•
      if (newVal) {
        console.log("此时触发--立即执行搜索");
        this.$emit("search", this.formInline);
      }
    },
    formItemList: {
      handler(newVal, oldVal) {
        for (const obj of this.formItemList) {
          console.log(obj);
          if (obj.defaultValue) {
            formInline[obj.field] = obj.defaultValue;
          }
        }
      },
      deep: true,
    },
    showSearch() {
      this.$emit("showSearchChange");
    },
  },
  methods: {
    onSubmit() {
      this.$emit("search", this.formInline);
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
      let formInline = {};
      for (const obj of this.formItemList) {
        formInline[obj.field] = ""; // æ‰€æœ‰ç­›é€‰æ¡ä»¶æ¸…空
      }
      this.formInline = formInline;
      this.$emit("search", this.formInline);
    },
    getList() {
      this.$emit("getList");
    },
  },
};
</script>
<style lang="scss" scoped>
.dialog-search {
  // margin: 0 1rem;
  margin-bottom: 20px;
  text-align: left;
  ::v-deep .el-form-item__content {
    // width: 16rem;
    .el-input {
      width: 16rem;
    }
    .el-select {
      .el-input__inner {
        // height: 3.2rem;
        width: 16rem;
      }
    }
  }
  ::v-deep .el-form-item {
    margin-bottom: 5px;
  }
}
.bottonclas {
  display: flex;
  justify-content: flex-start;
}
.bottonBox {
  display: flex;
  justify-content: flex-start;
}
.rightbotton {
  margin-left: 20px;
}
</style>
src/components/Table/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,480 @@
<template>
  <el-table
    ref="multipleTable"
    v-loading="tableLoading"
    :data="tableData"
    element-loading-text="拼命加载中"
    :height="elementHeight"
    :key='elementHeight'
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(255, 255, 255, 0.2)"
    tooltip-effect="dark"
    style="width: 100%"
    border
    :row-class-name="rowClassName"
    :header-cell-style="headerCellStyle"
    stripe
    cell-class-name="cellClassName"
    :row-key="isTree ? rowKey : ''"
    @expand-change="expandChange"
    @select="selectchange"
    @select-all="selectAll"
  >
    <template v-if="isSelection">
      <el-table-column type="selection" width="55" />
    </template>
    <template v-for="(item, index) in column">
      <el-table-column
        :key="index"
        :label="item.label"
        :prop="item.prop"
        :type="item.type"
        :width="item.width"
        :fixed="item.fixed"
        :sortable="item.sortable ? true : false"
        :filters="item.filters"
        :column-key="item.columnKey"
        :filtered-value="item.filteredValue"
        :filter-multiple="item.filterMultiple"
        :min-width="item.minWidth"
        :align="item.align"
        :show-overflow-tooltip="true"
      >
        <!-- <div class="123" v-if="item.type == ''"> -->
        <template
          v-if="item.hasOwnProperty('colunmTemplate')"
          :slot="item.colunmTemplate"
          slot-scope="scope"
        >
          <slot
            v-if="item.theadSlot"
            :name="item.theadSlot"
            :row="scope.row"
            :index="index"
          />
        </template>
        <template slot-scope="scope">
          <!-- æ’槽 -->
          <div v-if="item.dataType == 'slot'">
            <slot
              v-if="item.slot"
              :name="item.slot"
              :row="scope.row"
              :index="scope.$index"
            />
          </div>
          <!-- è¿›åº¦æ¡ -->
          <div v-else-if="item.dataType == 'progress'">
            <el-progress :percentage="Number(scope.row[item.prop])" />
          </div>
          <!-- tag -->
          <div v-else-if="item.dataType == 'tag'">
            <el-tag
              v-if="
                typeof dataTypeFn(scope.row[item.prop], item.formatData) ==
                'string'
              "
              :title="scope.row[item.prop] | formatters(item.formatData)"
              :type="formatType(scope.row[item.prop], item.formatType)"
            >
              {{ scope.row[item.prop] | formatters(item.formatData) }}
            </el-tag>
            <el-tag
              v-for="(tag, index) in dataTypeFn(
                scope.row[item.prop],
                item.formatData
              )"
              v-else-if="
                typeof dataTypeFn(scope.row[item.prop], item.formatData) ==
                'object'
              "
              :key="index"
              :title="scope.row[item.prop] | formatters(item.formatData)"
              :type="formatType(tag, item.formatType)"
            >
              {{
                item.tagGroup
                  ? tag[item.tagGroup.label]
                    ? tag[item.tagGroup.label]
                    : tag
                  : tag
              }}
            </el-tag>
            <el-tag
              v-else
              :title="scope.row[item.prop] | formatters(item.formatData)"
              :type="formatType(scope.row[item.prop], item.formatType)"
            >
              {{ scope.row[item.prop] | formatters(item.formatData) }}
            </el-tag>
          </div>
          <!-- æŒ‰é’® -->
          <div v-else-if="item.dataType == 'option'">
            <template >
              <el-button
                v-for="(o, key) in item.operation"
                v-show="o.showHide ? o.showHide(scope.row) : true"
                :key="key"
                :icon="o.icon | iconFn(scope.row)"
                :disabled="o.disabled ? o.disabled(scope.row) : false"
                :plain="o.plain"
                :type="o.type | typeFn(scope.row)"
                :size="o.size"
                @click="clickFun(scope.row, o.typeText)"
                v-hasPermi="[o.hasPermi]"
              >
                {{ o.name }}
                ã€€ã€€ã€€ã€€ã€€
              </el-button>
            </template>
          </div>
          <!--  -->
          <!-- é»˜è®¤çº¯å±•ç¤ºæ•°æ® -->
          <span v-else>
            <span class="overClass" v-if="!item.formatData">
              {{ scope.row[item.prop] }}
            </span>
            <span class="overClass" v-else>
              {{ scope.row[item.prop] | formatters(item.formatData) }}
            </span>
          </span>
        </template>
        <!-- </div>   -->
      </el-table-column>
    </template>
  </el-table>
</template>
<script>
export default {
  filters: {
    iconFn(val, row) {
      if (typeof val === "function") {
        return val(row);
      } else return val;
    },
    typeFn(val, row) {
      if (typeof val === "function") {
        return val(row);
      } else return val;
    },
    describeConts(val, describeCont) {
      if (typeof describeCont === "function") {
        return describeCont(val);
      } else return val;
    },
    formatters(val, format) {
      if (typeof format === "function") {
        return format(val);
      } else return val;
    },
  },
  props: {
    // æ˜¯å¦å¼€å¯å¤šé€‰
    isSelection: {
      type: Boolean,
      default: false,
    },
    // è®¾ç½®è¡¨æ ¼é«˜åº¦
    height: {
      type: Number|String,
      default: null,
    },
    // è¡¨æ ¼æ•°æ®è¯·æ±‚loading
    tableLoading: {
      type: Boolean,
      default: false,
    },
    // è¡¨æ ¼å¤´éƒ¨æ ·å¼
    headerCellStyle: {
      type: Object,
      default: () => {
        return {};
      },
    },
    // åˆ—数据表头
    column: {
      type: Array,
      default() {
        return [];
      },
    },
    // è¡Œæ•°æ®ç±»å
    rowClassName: {
      type: Function,
      default: () => {},
    },
    // è¡¨æ ¼æ•°æ®
    tableData: {
      type: Array,
      default() {
        return [];
      },
    },
    // åœ¨æ˜¯æ ‘状表格时需要使用rowKey默认不使用
    isTree: {
      type: Boolean,
      default: false,
    },
    // è¡¨æ ¼è¡Œç»‘定的id数据
    rowKey: {
      type: String,
      default: "",
    },
    // chectype选项类
    checktype: {
      type: String,
      default: "check",
    },
  },
  computed: {
    elementHeight() {
      return this.height;
    },
  },
  data() {
    return {
      expandedData: [],
      multipleSelection: [],
      isCheckedAll: false,
    };
  },
  watch: {
    multipleSelection(val, oldval) {
      this.setIsCheckedAll(val);
      this.$emit("checkData", val);
    },
    tableLoading() {
      this.multipleSelection = [];
    },
    elementHeight(){
       this.multipleSelection = [];
    }
  },
  mounted() {},
  methods: {
    formatType(val, format) {
      if (typeof format === "function") {
        return format(val);
      } else return "";
    },
    dataTypeFn(val, format) {
      if (typeof format === "function") {
        return format(val);
      } else return val;
    },
    toggleSelection(row, type) {
      this.$refs.multipleTable.toggleRowSelection(row, type);
    },
    clearSection(row) {
      this.$refs.multipleTable.clearSelection();
    },
    // é€‰æ‹©çš„方法
    // selectchange(selection, row) {
    //   if (this.checktype == "radio") {
    //     row.isChecked = true;
    //     if (this.multipleSelection.length < 0) {
    //       this.multipleSelection.push(row);
    //     } else {
    //       this.toggleSelection(this.multipleSelection[0],false)
    //       this.multipleSelection.splice(0, 1, row);
    //     }
    //   } else {
    //     if (!row.isChecked) {
    //       this.multipleSelection.push(row);
    //       row.isChecked = true;
    //       if (
    //         row.children &&
    //         this.expandedData.indexOf(row[this.rowKey]) > -1
    //       ) {
    //         row.children.map((item) => {
    //           this.toggleSelection(item, true);
    //           item.isChecked = true;
    //           this.multipleSelection.push(item);
    //         });
    //       }
    //     } else {
    //       row.isChecked = false;
    //       this.multipleSelection.splice(this.multipleSelection.indexOf(row), 1);
    //       if (row.children) {
    //         row.children.map((item) => {
    //           this.toggleSelection(item, false);
    //           item.isChecked = false;
    //           this.multipleSelection.splice(
    //             this.multipleSelection.indexOf(item),
    //             1
    //           );
    //         });
    //       }
    //     }
    //   }
    // },
     selectchange(selection, row) {
    if (this.checktype === "radio") {
      row.isChecked = true;
      if (this.multipleSelection.length < 0) {
        this.multipleSelection.push(row);
      } else {
        this.toggleSelection(this.multipleSelection[0], false);
        this.multipleSelection.splice(0, 1, row);
      }
    } else {
      if (!row.isChecked) {
        console.log('选择操作');
        this.multipleSelection.push(row);
        row.isChecked = true;
        if (row.children && this.expandedData.includes(row[this.rowKey])) {
          row.children.forEach((item) => {
            this.toggleSelection(item, true);
            item.isChecked = true;
            this.multipleSelection.push(item);
          });
        }
      } else {
        console.log('取消选择操作');
        row.isChecked = false;
        this.removeSelectionAndChildren(row);
      }
    }
  },
  removeSelectionAndChildren(row) {
    this.toggleSelection(row, false);
    this.multipleSelection = this.multipleSelection.filter(item => item !== row);
    if (row.children) {
      row.children.forEach((child) => {
        this.toggleSelection(child, false);
        child.isChecked = false;
        this.removeSelectionAndChildren(child); // é€’归移除
      });
    }
  },
    // æ•°æ®è¡Œç‚¹å‡»å±•å¼€çš„方法
    expandChange(record, expanded) {
      if (expanded) {
        this.expandedData.push(record[this.rowKey]);
      } else {
        this.expandedData = this.expandedData.filter(
          (key) => key !== record[this.rowKey]
        );
      }
    },
    //树状表格全选
    selectAll(selection) {
      if (this.checktype == "check") {
        this.isCheckedAll = !this.isCheckedAll;
        if (this.isCheckedAll) {
          this.$refs.multipleTable.data.map((items) => {
            if (!items.isChecked) {
              items.isChecked = true;
              this.toggleSelection(items, true);
              this.multipleSelection.push(items);
              if (
                this.expandedData.indexOf(items[this.rowKey]) > -1 &&
                items.children
              ) {
                items.children.map((item) => {
                  this.toggleSelection(item, true);
                  item.isChecked = true;
                  this.multipleSelection.push(item);
                });
              }
            }
          });
        } else {
          this.$refs.multipleTable.data.map((items) => {
            this.toggleSelection(items, false);
            items.isChecked = false;
            if (items.children) {
              items.children.map((item) => {
                this.toggleSelection(item, false);
                item.isChecked = false;
              });
            }
          });
          this.multipleSelection = [];
        }
      }else{
        this.clearSection()
      }
    },
    setIsCheckedAll(data) {
      let num = 0;
      let arrlist = this.$refs.multipleTable.data.map((item) => {
        return item[this.rowKey];
      });
      if (data.length) {
        data.forEach((item) => {
          if (item.isChecked && arrlist.indexOf(item[this.rowKey]) > -1) {
            num += 1;
          }
        });
        if (num == this.$refs.multipleTable.data.length) {
          this.isCheckedAll = true;
        } else {
          this.isCheckedAll = false;
        }
      } else {
        this.isCheckedAll = false;
      }
    },
    clickFun(info, type) {
      switch (type) {
        case 4:
          this.$emit("checkLook", info);
          break;
      }
    },
  },
};
</script>
<style scoped>
.overClass {
  /* white-space: pre-wrap; */
  width: 100% !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* .el-table .warning-row {
    background: oldlace;
  }
  .el-table .success-row {
    background: #f0f9eb;
  } */
/* .app-container /deep/  .el-table, .el-table__expanded-cell {
  background-color: transparent;
}
.app-container /deep/ .el-table tr {
  background-color: transparent!important;
}
.app-container /deep/  .el-table--enable-row-transition .el-table__body td, .el-table .cell{
  background-color: transparent;
} */
</style>
src/components/Table/mixins/resize.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
export default {
  data() {
    return {
      elementHeight: null,
      contHeight: null
    }
  },
  created() {
    this.getElHeight(0);
  },
  mounted() {
    window.addEventListener('resize', this.getElHeight)
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.getElHeight); // ç§»é™¤çª—口大小变化监听器
  },
  methods: {
    // è®¾ç½®è¡¨æ ¼é«˜åº¦
    getElHeight(num) {
      this.$nextTick(() => {
        this.elementHeight =
          this.$refs.contBox.$el.clientHeight -
          this.$refs.headBox.offsetHeight -
          124 -
          this.$refs.pagination.offsetHeight + num;
      });
    },
  }
}
src/variableSet/checkTaskItem.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
// ç»“果值
export const testVal = '100'
// æ•°æ®JSON
export const testValJson = '150'
// è¿‡ç¨‹ç»“æžœ1
export const testVal1 = '110'
// æŠ€æœ¯è¦æ±‚
// export const testVal2 = '180'
// è¿‡ç¨‹ç»“æžœ2
export const testVal2 = '110'
// è¿‡ç¨‹ç»“æžœ3
export const testVal3 = '110'
// è¿‡ç¨‹ç»“æžœ4
export const testVal4 = '110'
// è¿‡ç¨‹ç»“æžœ5
export const testVal5 = '110'
// æè¿°
export const description = '160'
// æœ€åŽæ›´æ–°äººå§“名
export const lastUpdatedUserName = '120'
// æœ€åŽæ›´æ–°æ—¥æœŸæ—¶é—´
export const lastUpdatedDateTime = '160'
src/variableSet/columns.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,83 @@
// æ£€éªŒé¡¹ç›®ç¼–号
export const checkItemNo = '150'
// æ£€éªŒé¡¹ç›®åç§°
export const checkItemName = '150'
// ç»Ÿè®¡ç±»åž‹
export const checkType = '80'
// æŠ€æœ¯è¦æ±‚
export const checkStandard = '180'
// å‚考标准值
export const standardVal = '150'
// å‚考上限值
export const standardHigh = '100'
// å‚考下限值
export const standardLow = '100'
// æ£€éªŒå·¥å…·
export const checkTool = '180'
// æ˜¯å¦è‡ªåŠ¨åˆ¤æ–­
export const isAutoCheck = '120'
// æ˜¯å¦å¿…å¡«
export const isToSpc = '80'
// å•ä½
export const unit = '100'
// æ˜¯å¦å¯ç”¨
export const status = '80'
// å¤‡æ³¨
export const description = '160'
// æœ€åŽæ›´æ–°äººå§“名
export const lastUpdatedUserName = '120'
// æœ€åŽæ›´æ–°æ—¥æœŸæ—¶é—´
export const lastUpdatedDateTime = '160'
// ç¼–号
export const noWidth = '150'
// åç§°
export const nameWidth = '150'
// ç±»åž‹
export const classWidth = '80'
// è¦æ±‚
export const requireWidth = '180'
// å¤‡æ³¨
export const descrWidth = '160'
// å·¥å…·
export const toolWidth = '180'
// æ˜¯å¦
export const whetherWidth = '80'
// çŠ¶æ€
export const statusWidth = '80'
// ä¸šåŠ¡
export const businessWidth = '120'
// å®¡æ ¸äººå‘˜å§“名
export const auditNameWidth = '100'
// æ—¶é—´
export const timeWidth = '160'
// å·¥åŽ‚
export const workWidth = '200'
// ä¾›åº”商
export const supplierWidth="180"
// istreeno
export const istreeno="200"
// æ£€æµ‹ä»»åŠ¡æ£€æµ‹é¡¹
export const testItem="150"
export const testWidth="500"
export const top="130"
export const checkResult="300"
export const action="100"
src/views/basicData/location/addModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,283 @@
<template>
  <!-- æ·»åŠ æˆ–修改IQC检验项目对话框 -->
  <el-dialog
    :title="title"
    :visible.sync="open"
    width="750px"
    custom-class="madelClass"
    :destroyOnClose="true"
  >
    <div class="contbox">
      <el-form
        ref="form"
        v-if="open"
        :model="form"
        :rules="rules"
        :disabled="isCheck"
      >
        <el-form-item
          v-for="(item, index) in formItem"
          :key="index"
          :label="item.label"
          :prop="item.prop"
          label-width="120px"
          :class="item.component == 'inputNumber' ? 'itemFixed' : ''"
        >
          <template v-if="item.component == 'input'">
            <el-input
              v-model="form[item.prop]"
              :readonly="item.readonly"
              :placeholder="
                item.prop == 'checkItemNo' ? '自动生成' : '请输入' + item.label
              "
            />
          </template>
          <template v-if="item.component == 'inputNumber'">
            <el-input-number
              v-model="form[item.prop]"
              :label="'请输入' + item.label"
            ></el-input-number>
          </template>
          <template v-if="item.component == 'textarea'">
            <el-input
              type="textarea"
              :rows="2"
              :placeholder="'请输入' + item.label"
              v-model="form[item.prop]"
            >
            </el-input>
          </template>
          <template v-if="item.component == 'select'">
            <template v-if="item.prop == 'checkType'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                v-if="item.prop == 'checkType'"
                style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.check_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
              <template v-if="item.prop == 'locationGroupNo'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                v-if="item.prop == 'locationGroupNo'"
                style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.check_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
            <template v-if="item.prop == 'isAutoCheck'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                    style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.is_auto_check"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
            <template v-if="item.prop == 'isRequired'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                    style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.is_required"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
            <template v-if="item.prop == 'isToSpc'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                    style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.is_to_spc"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
            <template v-if="item.prop == 'status'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                    style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.status"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
          </template>
        </el-form-item>
      </el-form>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button
        v-if="!isCheck"
        :loading="buttonLoading"
        type="primary"
        @click="submitForm"
        >ç¡® å®š</el-button
      >
      <el-button @click="cancel">取 æ¶ˆ</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { formatData, formrRquired, formatDataItem } from "./info.data";
import {  getLocation, addLocation, updateLocation } from "@/api/basicData/location";
export default {
  name: "checkItemAdd",
  components: {},
  dicts: ["check_type", "is_auto_check", "is_required", "is_to_spc", "status"],
  data() {
    return {
      form: JSON.parse(JSON.stringify(formatData)),
      rules: formrRquired,
      open: false,
      title: "",
      buttonLoading: false,
      isCheck: false,
    };
  },
  computed: {
    formItem() {
      return formatDataItem;
    },
  },
  watch:{
    open(val){
      if(!val){
      this.$refs["form"].resetFields();
      }
    }
  },
  mounted() {},
  methods: {
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.checkItemId != null) {
            updateLocation(this.form)
              .then((response) => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.$emit("getList");
              })
              .finally(() => {
                this.buttonLoading = false;
              });
          } else {
            addLocation(this.form)
              .then((response) => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.$emit("getList");
              })
              .finally(() => {
                this.buttonLoading = false;
              });
          }
        }
      });
    },
    // å–消按钮
    cancel() {
      this.reset();
    },
    reset() {
      this.$refs["form"].resetFields();
      this.open = false;
      this.isCheck = false;
    },
    elDialogShow(type, info = "") {
      this.open = true;
      if (type == 1) {
        this.title = "检测项目添加";
        this.isCheck = false;
      } else if (type == 2) {
        this.isCheck = false;
        this.getDetailse(info);
        this.title = "检测项目编辑";
      } else {
        this.title = "检测项目查看";
        this.isCheck = true;
        this.getDetailse(info);
      }
      this.$nextTick(()=>{
      })
    },
    getDetailse(id) {
      getLocation(id).then((res) => {
        if (res.code === 200) {
          this.form = res.data;
        }
      });
    },
  },
};
</script>
<style lang="less" scoped>
.contbox {
  max-height: 60vh !important;
  overflow: auto;
  box-sizing: border-box;
  padding: 0 20px;
}
.itemFixed {
  display: inline-block !important;
}
.itemFixed:first-child {
  display: block !important;
}
::v-deep .is-disabled .el-input__inner {
  color: #606266 !important;
}
// ::v-deep .el-input.is-disabled .el-input__inner
</style>
src/views/basicData/location/index.vue
@@ -1,40 +1,783 @@
<template>
  <div class="box">
    <el-card class="box-card1">
  <div v-for="o in 4" :key="o" class="text item">
    {{'列表内容 ' + o }}
      <div>
       <el-menu
          class="sidebar-el-menu"
          background-color="white"
          text-color="#7a8297"
          active-text-color="#2d8cf0"
        >
          <div v-for="(item, index) in leftListdata" :key="item.werksId">
            <!-- ä¸€çº§èœå• -->
            <el-menu-item
              :index="index.toString()"
                :class="{ 'is-active': currentIndex === index.toString() }"
              v-if="item.detailList == null"
              @click="handleClick(item, index.toString())"
            >
              <span slot="title">{{ item.werksName }}</span>
            </el-menu-item>
            <!-- äºŒçº§èœå• -->
            <el-submenu
              :index="index.toString()"
              v-else
            >
              <template #title>
                <span>{{ item.werksName }}</span>
              </template>
              <el-menu-item-group :class="{ 'is-active': currentIndex === index.toString() }">
                <el-menu-item
                  v-for="(it, subIndex) in item.detailList"
                  :key="it.warehouseId"
                  :index="`${index}-${subIndex}`"
                  :class="{ 'is-active': currentIndex === `${index}-${subIndex}` }"
                  @click="handleClick(it, `${index}-${subIndex}`)"
                >
                  {{ it.warehouseName }}
                </el-menu-item>
              </el-menu-item-group>
            </el-submenu>
          </div>
        </el-menu>
  </div>
</el-card>
    <!-- å³ä¾§ -->
<el-card class="box-card2">
  <div v-for="o in 4" :key="o" class="text item">
    {{'列表内容 ' + o }}
      <div class="box1">
        <el-form
          :model="queryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
        >
          <el-form-item label="仓库" prop="lgort">
            <el-input
              v-model="queryParams.lgort"
              placeholder="请输入仓库"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="名称" prop="locationName">
            <el-input
              v-model="queryParams.locationName"
              placeholder="请输入名称"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="状态" prop="state">
            <el-input
              v-model="queryParams.state"
              placeholder="请输入状态"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['system:location:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['system:location:edit']"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['system:location:remove']"
              >删除</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
              v-hasPermi="['system:location:export']"
              >导出</el-button
            >
          </el-col>
          <right-toolbar
            :showSearch.sync="showSearch"
            @queryTable="getList"
          ></right-toolbar>
        </el-row>
        <el-table
          v-loading="loading"
          border
          :data="locationList"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="序号" type="index" fixed width="50" />
          <!-- <el-table-column label="库位ID" align="center" prop="locationId" v-if="true"/> -->
          <el-table-column
            label="隶属库位ID"
            align="center"
            prop="parentLocationId"
          />
          <el-table-column label="仓库" align="center" prop="lgort" />
          <el-table-column label="库位序号" align="center" prop="locationNo" />
          <el-table-column label="名称" align="center" prop="locationName" />
          <el-table-column label="工厂" align="center" prop="werks" />
          <el-table-column label="类型" align="center" prop="type" />
          <el-table-column
            label="体积限制"
            align="center"
            prop="volumeRestriction"
          />
          <el-table-column label="重量限制" align="center" prop="weightLimit" />
          <el-table-column
            label="箱数限制"
            align="center"
            prop="containerNumberLimit"
          />
          <el-table-column
            label="数量限制"
            align="center"
            prop="quantitativeRestrictions"
          />
          <el-table-column label="托盘限制" align="center" prop="trayLimit" />
          <el-table-column label="长度" align="center" prop="length" />
          <el-table-column label="宽" align="center" prop="width" />
          <el-table-column label="高" align="center" prop="height" />
          <el-table-column label="坐标X" align="center" prop="coordinateX" />
          <el-table-column label="坐标Y" align="center" prop="coordinateY" />
          <el-table-column label="坐标Z" align="center" prop="coordinateZ" />
          <el-table-column label="像素X" align="center" prop="pixelX" />
          <el-table-column label="像素Y" align="center" prop="pixelY" />
          <el-table-column label="空间层数" align="center" prop="paceLayer" />
          <el-table-column
            label="1-允许"
            align="center"
            prop="allowMixedProduct"
          />
          <el-table-column
            label="1-允许"
            align="center"
            prop="allowMixedProductLot"
          />
          <el-table-column label="层级" align="center" prop="layer" />
          <el-table-column label="1-存在" align="center" prop="hasChild" />
          <el-table-column label="路径" align="center" prop="path" />
          <el-table-column label="描述" align="center" prop="description" />
          <!-- <el-table-column label="状态" align="center" prop="state" /> -->
          <el-table-column
            label="最后更新人id"
            align="center"
            prop="lastUpdatedUserId"
          />
          <el-table-column
            label="最后更新人姓名"
            align="center"
            prop="lastUpdatedUserName"
          />
          <el-table-column
            label="最后更新时间"
            align="center"
            prop="lastUpdatedDateTime"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{
                parseTime(scope.row.lastUpdatedDateTime, "{y}-{m}-{d}")
              }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['system:location:edit']"
                >修改</el-button
              >
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['system:location:remove']"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
  </div>
</el-card>
    <!-- æ·»åŠ æˆ–修改库位对话框 -->
    <el-dialog
      :title="title"
      v-if="open"
      :visible.sync="open"
      width="500px"
      append-to-body
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <!-- <el-form-item label="隶属库位ID" prop="parentLocationId">
          <el-input v-model="form.parentLocationId" placeholder="请输入隶属库位ID" />
        </el-form-item> -->
        <el-form-item label="仓库" prop="lgort">
          <el-input v-model="form.lgort" placeholder="请输入仓库" />
        </el-form-item>
        <el-form-item label="库位序号" prop="locationNo">
          <el-input v-model="form.locationNo" placeholder="请输入库位序号" />
        </el-form-item>
        <el-form-item label="名称" prop="locationName">
          <el-input v-model="form.locationName" placeholder="请输入名称" />
        </el-form-item>
        <el-form-item label="工厂" prop="werks">
          <!-- <el-input v-model="form.werks" placeholder="请输入工厂" /> -->
          <el-select
            v-model="form.werks"
            placeholder="请选择工厂"
            style="width: 100%"
          >
            <el-option
              v-for="dict in werksList"
              :key="dict.werks"
              :label="dict.werksName"
              :value="dict.werks"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="体积限制" prop="volumeRestriction">
          <el-input
            v-model.number="form.volumeRestriction"
            placeholder="请输入体积限制"
          />
        </el-form-item>
        <el-form-item label="重量限制" prop="weightLimit">
          <el-input
            v-model.number="form.weightLimit"
            placeholder="请输入重量限制"
          />
        </el-form-item>
        <el-form-item label="箱数限制" prop="containerNumberLimit">
          <el-input
            v-model.number="form.containerNumberLimit"
            placeholder="请输入箱数限制"
          />
        </el-form-item>
        <el-form-item label="数量限制" prop="quantitativeRestrictions">
          <el-input
            v-model.number="form.quantitativeRestrictions"
            placeholder="请输入数量限制"
          />
        </el-form-item>
        <el-form-item label="托盘限制" prop="trayLimit">
          <el-input v-model="form.trayLimit" placeholder="请输入托盘限制" />
        </el-form-item>
        <el-form-item label="长度" prop="length">
          <el-input v-model.number="form.length" placeholder="请输入长度" />
        </el-form-item>
        <el-form-item label="宽" prop="width">
          <el-input v-model.number="form.width" placeholder="请输入宽" />
        </el-form-item>
        <el-form-item label="高" prop="height">
          <el-input v-model.number="form.height" placeholder="请输入高" />
        </el-form-item>
        <el-form-item label="坐标X" prop="coordinateX">
          <el-input v-model="form.coordinateX" placeholder="请输入坐标X" />
        </el-form-item>
        <el-form-item label="坐标Y" prop="coordinateY">
          <el-input v-model="form.coordinateY" placeholder="请输入坐标Y" />
        </el-form-item>
        <el-form-item label="坐标Z" prop="coordinateZ">
          <el-input v-model="form.coordinateZ" placeholder="请输入坐标Z" />
        </el-form-item>
        <el-form-item label="像素X" prop="pixelX">
          <el-input v-model="form.pixelX" placeholder="请输入像素X" />
        </el-form-item>
        <el-form-item label="像素Y" prop="pixelY">
          <el-input v-model="form.pixelY" placeholder="请输入像素Y" />
        </el-form-item>
        <el-form-item label="空间层数" prop="paceLayer">
          <el-input v-model="form.paceLayer" placeholder="请输入空间层数" />
        </el-form-item>
        <el-form-item label="是否允许" prop="allowMixedProduct">
          <el-input
            v-model="form.allowMixedProduct"
            placeholder="请输入1-允许"
          />
        </el-form-item>
        <el-form-item label="是否允许" prop="allowMixedProductLot">
          <el-input
            v-model="form.allowMixedProductLot"
            placeholder="请输入1-允许"
          />
        </el-form-item>
        <el-form-item label="层级" prop="layer">
          <el-input v-model="form.layer" placeholder="请输入层级" />
        </el-form-item>
        <el-form-item label="是否存在" prop="hasChild">
          <el-input v-model="form.hasChild" placeholder="请输入1-存在" />
        </el-form-item>
        <el-form-item label="路径" prop="path">
          <el-input v-model="form.path" placeholder="请输入路径" />
        </el-form-item>
        <el-form-item label="描述" prop="description">
          <el-input v-model="form.description" placeholder="请输入描述" />
        </el-form-item>
        <!-- <el-form-item label="状态" prop="state">
          <el-input v-model="form.state" placeholder="请输入状态" />
        </el-form-item> -->
        <!-- <el-form-item label="最后更新人id" prop="lastUpdatedUserId">
          <el-input v-model="form.lastUpdatedUserId" placeholder="请输入最后更新人id" />
        </el-form-item>
        <el-form-item label="最后更新人姓名" prop="lastUpdatedUserName">
          <el-input v-model="form.lastUpdatedUserName" placeholder="请输入最后更新人姓名" />
        </el-form-item>
        <el-form-item label="最后更新时间" prop="lastUpdatedDateTime">
          <el-date-picker clearable
            v-model="form.lastUpdatedDateTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择最后更新时间">
          </el-date-picker>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm"
          >ç¡® å®š</el-button
        >
        <el-button @click="cancel">取 æ¶ˆ</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
import {
  listLocation,
  getLocation,
  delLocation,
  addLocation,
  updateLocation,
  listWaresList,
  listwerkshouse,
} from "@/api/basicData/location";
export default {
  name: "Location",
  data() {
    return {
      // æŒ‰é’®loading
      buttonLoading: false,
      // é®ç½©å±‚
      loading: true,
      // é€‰ä¸­æ•°ç»„
      ids: [],
      // éžå•ä¸ªç¦ç”¨
      single: true,
      // éžå¤šä¸ªç¦ç”¨
      multiple: true,
      // æ˜¾ç¤ºæœç´¢æ¡ä»¶
      showSearch: true,
      // æ€»æ¡æ•°
      total: 0,
      // åº“位表格数据
      locationList: [],
      // å¼¹å‡ºå±‚标题
      title: "",
      // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚
      open: false,
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        lgort: undefined,
        locationName: undefined,
        warehouseName:undefined,
        werks:undefined,
        lgort:undefined,
        type: undefined,
        state: undefined,
      },
      // è¡¨å•å‚æ•°
      form: {},
      werksList: [],
      leftListdata: [],
      currentIndex: null,
      defaultProps: {
        children: "detailList",
        label: "werksName",
      },
      // è¡¨å•æ ¡éªŒ
      rules: {
        // locationId: [
        //   { required: true, message: "库位ID不能为空", trigger: "blur" }
        // ],
        parentLocationId: [
          { required: true, message: "隶属库位ID不能为空", trigger: "blur" },
        ],
        lgort: [{ required: true, message: "仓库不能为空", trigger: "blur" }],
        locationNo: [
          { required: true, message: "库位序号不能为空", trigger: "blur" },
        ],
        locationName: [
          { required: true, message: "名称不能为空", trigger: "blur" },
        ],
        werks: [{ required: true, message: "工厂不能为空", trigger: "blur" }],
        type: [{ required: true, message: "类型不能为空", trigger: "change" }],
        volumeRestriction: [
          { required: true, message: "体积限制不能为空", trigger: "blur" },
        ],
        weightLimit: [
          { required: true, message: "重量限制不能为空", trigger: "blur" },
        ],
        containerNumberLimit: [
          { required: true, message: "箱数限制不能为空", trigger: "blur" },
        ],
        quantitativeRestrictions: [
          { required: true, message: "数量限制不能为空", trigger: "blur" },
        ],
        trayLimit: [
          { required: true, message: "托盘限制不能为空", trigger: "blur" },
        ],
        length: [{ required: true, message: "长度不能为空", trigger: "blur" }],
        width: [{ required: true, message: "宽不能为空", trigger: "blur" }],
        height: [{ required: true, message: "高不能为空", trigger: "blur" }],
        coordinateX: [
          { required: true, message: "坐标X不能为空", trigger: "blur" },
        ],
        coordinateY: [
          { required: true, message: "坐标Y不能为空", trigger: "blur" },
        ],
        coordinateZ: [
          { required: true, message: "坐标Z不能为空", trigger: "blur" },
        ],
        pixelX: [{ required: true, message: "像素X不能为空", trigger: "blur" }],
        pixelY: [{ required: true, message: "像素Y不能为空", trigger: "blur" }],
        paceLayer: [
          { required: true, message: "空间层数不能为空", trigger: "blur" },
        ],
        allowMixedProduct: [
          { required: true, message: "1-允许不能为空", trigger: "blur" },
        ],
        allowMixedProductLot: [
          { required: true, message: "1-允许不能为空", trigger: "blur" },
        ],
        layer: [{ required: true, message: "层级不能为空", trigger: "blur" }],
        hasChild: [
          { required: true, message: "1-存在不能为空", trigger: "blur" },
        ],
        path: [{ required: true, message: "路径不能为空", trigger: "blur" }],
        description: [
          { required: true, message: "描述不能为空", trigger: "blur" },
        ],
        // state: [{ required: true, message: "状态不能为空", trigger: "blur" }],
        displayOrder: [
          { required: true, message: "排序不能为空", trigger: "blur" },
        ],
        createdUserId: [
          { required: true, message: "创建人id不能为空", trigger: "blur" },
        ],
        createdUserName: [
          { required: true, message: "创建人姓名不能为空", trigger: "blur" },
        ],
        createdDateTime: [
          { required: true, message: "创建日期时间不能为空", trigger: "blur" },
        ],
        lastUpdatedUserId: [
          { required: true, message: "最后更新人id不能为空", trigger: "blur" },
        ],
        lastUpdatedUserName: [
          {
            required: true,
            message: "最后更新人姓名不能为空",
            trigger: "blur",
          },
        ],
        lastUpdatedDateTime: [
          { required: true, message: "最后更新时间不能为空", trigger: "blur" },
        ],
        isDeleted: [
          { required: true, message: "是否删除不能为空", trigger: "blur" },
        ],
      },
    };
  },
  created() {
    this.getList();
    this.leftList();
  },
  methods: {
    /** æŸ¥è¯¢åº“位列表 */
    getList() {
      this.loading = true;
      listLocation(this.queryParams).then((response) => {
        this.locationList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    leftList() {
      listWaresList().then((res) => {
        console.log(res, "左侧数据信息");
        this.leftListdata = res.data;
      });
      listwerkshouse({
        pageNum: 1,
        pageSize: 99,
      }).then((res) => {
        console.log(res, "工厂");
        this.werksList = res.rows;
      });
    },
    // å–消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // è¡¨å•é‡ç½®
    reset() {
      this.form = {
        locationId: undefined,
        parentLocationId: undefined,
        lgort: undefined,
        locationNo: undefined,
        locationName: undefined,
        werks: undefined,
        type: undefined,
        volumeRestriction: undefined,
        weightLimit: undefined,
        containerNumberLimit: undefined,
        quantitativeRestrictions: undefined,
        trayLimit: undefined,
        length: undefined,
        width: undefined,
        height: undefined,
        coordinateX: undefined,
        coordinateY: undefined,
        coordinateZ: undefined,
        pixelX: undefined,
        pixelY: undefined,
        paceLayer: undefined,
        allowMixedProduct: undefined,
        allowMixedProductLot: undefined,
        layer: undefined,
        hasChild: undefined,
        path: undefined,
        description: undefined,
        state: undefined,
        displayOrder: undefined,
        createdUserId: undefined,
        createdUserName: undefined,
        createdDateTime: undefined,
        lastUpdatedUserId: undefined,
        lastUpdatedUserName: undefined,
        lastUpdatedDateTime: undefined,
        isDeleted: undefined,
      };
      this.resetForm("form");
    },
    /** æœç´¢æŒ‰é’®æ“ä½œ */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** é‡ç½®æŒ‰é’®æ“ä½œ */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // å¤šé€‰æ¡†é€‰ä¸­æ•°æ®
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.locationId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** æ–°å¢žæŒ‰é’®æ“ä½œ */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加库位";
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const locationId = row.locationId || this.ids;
      getLocation(locationId).then((response) => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改库位";
      });
    },
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.locationId != null) {
            updateLocation(this.form)
              .then((response) => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              })
              .finally(() => {
                this.buttonLoading = false;
              });
          } else {
            addLocation(this.form)
              .then((response) => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              })
              .finally(() => {
                this.buttonLoading = false;
              });
}
        }
      });
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    handleDelete(row) {
      const locationIds = row.locationId || this.ids;
      this.$modal
        .confirm('是否确认删除库位编号为"' + locationIds + '"的数据项?')
        .then(() => {
          this.loading = true;
          return delLocation(locationIds);
        })
        .then(() => {
          this.loading = false;
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {})
        .finally(() => {
          this.loading = false;
        });
    },
    /** å¯¼å‡ºæŒ‰é’®æ“ä½œ */
    handleExport() {
      this.download(
        "system/location/export",
        {
          ...this.queryParams,
        },
        `location_${new Date().getTime()}.xlsx`
      );
    },
      handleClick(item, index) {
      this.currentIndex = index;
      if (item.lgort) {
         this.queryParams.lgort = item.lgort;
         this.getList();
      }else{
           this.queryParams.werks = item.werks;
      this.getList();
      }
      console.log(item); // å¤„理点击事件,可以在这里获取到当前点击行的信息
    },
  },
};
</script>
<style scoped>
.box{
  width: 100%;
  height: calc(100vh - 124px);
  display: flex;
  padding: 20px;
  padding: 20px 10px 0;
  background-color: #f0f0f0;
}
.box-card1{
  width: 20%;
  height: 100%;
  background-color: #4b0f0f;
  background-color: #fff;
  margin-right: 10px;
}
.box-card2{
  width: 80%;
  height: 100%;
  background-color: #58c8eb;
  background-color: #fff;
}
.box1 {
  width: 100%;
  height: 100%;
}
.is-active {
  background-color: #2d8cf0 !important; /* é«˜äº®é¢œè‰² */
}
::v-deep .el-menu-item {
  border: none !important; /* ä½¿ç”¨ !important æ¥ç¡®ä¿è¦†ç›–默认样式 */
}
/* å¦‚果边框是由 submenu å¼•èµ·çš„,可以这样写 */
::v-deep .el-submenu .el-submenu__title {
  border: none !important;
}
::v-deep .box-card1 > .el-card__body{
  padding: 20px 0 10px 10px  !important;
}
</style>
src/views/basicData/location/info.data.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,338 @@
import * as vars from "@/variableSet/columns";
export const columns = [
    {
        label: '检验项目编号',
        align: 'left',
        prop: 'checkItemNo',
        width: vars.checkItemNo,
        fixed: 'left',
        tooltip: true,
    },
    {
        label: '检验项目名称',
        align: 'left',
        prop: 'checkItemName',
        width: vars.checkItemName,
        fixed: 'left',
    },
    {
        label: '统计类型',
        prop: 'checkType',
        width: vars.checkType,
        dataType: 'slot',
        slot: 'checkType'
    },
    {
        label: '技术要求',
        align: 'left',
        prop: 'checkStandard',
        width: vars.checkStandard,
    },
    {
        label: '参考标准值',
        align: 'left',
        prop: 'standardVal',
        width: vars.standardVal,
    },
    {
        label: '参考上限值',
        align: 'left',
        prop: 'standardHigh',
        width: vars.standardHigh,
    },
    {
        label: '参考下限值',
        align: 'left',
        prop: 'standardLow',
        width: vars.standardLow,
    },
    {
        label: '检验工具',
        align: 'left',
        prop: 'checkTool',
        width: vars.checkTool,
    },
    {
        label: '是否自动判断',
        align: 'left',
        prop: 'isAutoCheck',
        width: vars.isAutoCheck,
        dataType: 'slot',
        slot: 'isAutoCheck'
    },
    {
        label: '是否必填',
        align: 'left',
        prop: 'isRequired',
        width: vars.isRequired,
        dataType: 'slot',
        slot: 'isRequired'
    },
    {
        label: '是否SPC',
        align: 'left',
        prop: 'isToSpc',
        width: vars.isToSpc,
        dataType: 'slot',
        slot: 'isToSpc'
    },
    {
        label: '单位',
        align: 'left',
        prop: 'unit',
        width: vars.unit,
    },
    {
        label: '是否启用',
        prop: 'status',
        width: vars.status,
        dataType: 'slot',
        slot: 'status'
    },
    {
        label: '备注',
        align: 'left',
        prop: 'description',
        width: vars.description,
        tooltip: true,
    },
    {
        label: '最后更新人姓名',
        align: 'left',
        prop: 'lastUpdatedUserName',
        width: vars.lastUpdatedUserName,
    },
    {
        label: '最后更新日期时间',
        align: 'left',
        prop: 'lastUpdatedDateTime',
        width: vars.lastUpdatedDateTime,
    },
    {
        dataType: 'option',
        label: '操作',
        width: '80',
        align: 'center',
        fixed: 'right',
        hasPermi: 'iqc_checkItem_check',
        operation: [
            {
                name: '查看',
                size: 'mini',
                plain: true,
                typeText: 4
            }
        ]
    }
];
export const searchFormSchema = [
    {
        field: 'checkItemNo',
        label: '检验项目编号:',
        labelWidth: 80,
        component: 'Input',
        componentProps: {
            placeholder: '请输入',
        },
    },
    {
        field: 'checkItemName',
        label: '检验项目名称:',
        labelWidth: 80,
        component: 'Input',
        componentProps: {
            placeholder: '请输入',
        },
    },
    {
        field: 'checkType',
        label: '统计类型:',
        labelWidth: 80,
        component: 'Select',
        componentProps: {
            options: [
                { label: '定性', value: 1 },
                { label: '定量', value: 3 },
            ],
        },
        multiple: false,
    },
    {
        field: 'checkStandard',
        label: '技术要求:',
        labelWidth: 80,
        component: 'Input',
        componentProps: {
            placeholder: '请输入',
        },
    },
];
export const formatData = {
    checkItemId: undefined,
    checkItemNo: undefined,
    checkItemName: undefined,
    bizType: 10,
    checkItemType: undefined,
    materialId: undefined,
    materialCatagoryId: undefined,
    procedureId: undefined,
    checkItemCategoryId: undefined,
    checkItemControlId: undefined,
    checkItemControlType: undefined,
    checkItemControlParameter: undefined,
    checkTool: undefined,
    checkType: undefined,
    checkStandard: undefined,
    standardVal: undefined,
    upperDeviation: undefined,
    lowerDeviation: undefined,
    standardHigh: undefined,
    standardLow: undefined,
    unit: undefined,
    isRequired: undefined,
    isSelfExternal: undefined,
    isAutoCheck: undefined,
    isToSpc: undefined,
    isSupplierCheckItem: undefined,
    description: undefined,
    displayOrder: undefined,
    status: undefined,
    createdUserId: undefined,
    createdUserName: undefined,
    createdDateTime: undefined,
    lastUpdatedUserId: undefined,
    lastUpdatedUserName: undefined,
    lastUpdatedDateTime: undefined,
    isDeleted: undefined
};
export const formrRquired = {
    checkItemName: [
        { required: true, message: "检验项目名称不能为空", trigger: "blur" }
    ],
    checkType: [
        { required: true, message: "统计类型", trigger: "change" }
    ],
    unit: [
        { required: true, message: "计量单位不能为空", trigger: "blur" }
    ],
    upperDeviation: [{
        required: true,
        message: "上偏差不能为空",
        trigger: "blur"
    }],
    lowerDeviation: [{
        required: true,
        message: "下偏差不能为空",
        trigger: "blur"
    }],
    unit: [
        { required: true, message: "计量单位不能为空", trigger: "blur" }
    ],
    standardHigh: [{
        required: true,
        message: "参考上限值不能为空",
        trigger: "blur"
    }],
    standardLow: [{
        required: true,
        message: "参考下限值不能为空",
        trigger: "blur"
    }],
}
export const formatDataItem = [
    {
        label: "检验项目编号",
        prop: 'checkItemNo',
        component: 'input',
        readonly: true
    },
    {
        label: "检验项目名称",
        prop: 'checkItemName',
        component: 'input'
    },
    {
        label: "统计类型",
        prop: 'checkType',
        component: 'select',
    },
    {
        label: "库位组",
        prop: 'locationGroupNo',
        component: 'select',
    },
    {
        label: "技术要求",
        prop: 'checkStandard',
        component: 'input'
    },
    {
        label: "检验工具",
        prop: 'checkTool',
        component: 'input'
    },
    {
        label: "参考标准值",
        prop: 'standardVal',
        component: 'inputNumber'
    },
    {
        label: "上公差",
        prop: 'upperDeviation',
        component: 'inputNumber'
    },
    {
        label: "下公差",
        prop: 'lowerDeviation',
        component: 'inputNumber'
    },
    {
        label: "参考上限值",
        prop: 'standardHigh',
        component: 'inputNumber'
    },
    {
        label: "参考下限值",
        prop: 'standardLow',
        component: 'inputNumber'
    },
    {
        label: "是否自动判断",
        prop: 'isAutoCheck',
        component: 'select'
    },
    {
        label: "是否必填",
        prop: 'isRequired',
        component: 'select'
    },
    {
        label: "是否SPC",
        prop: 'isToSpc',
        component: 'select'
    },
    {
        label: "单位",
        prop: 'unit',
        component: 'input'
    },
    {
        label: "备注",
        prop: 'description',
        component: 'textarea'
    },
    {
        label: "状态",
        prop: 'status',
        component: 'select'
    },
]
src/views/basicData/locationGroup/addModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,294 @@
<template>
  <!-- æ·»åŠ æˆ–修改IQC检验项目对话框 -->
  <el-dialog
    :title="title"
    :visible.sync="open"
    width="750px"
    custom-class="madelClass"
    :destroyOnClose="true"
  >
    <div class="contbox">
      <el-form
        ref="form"
        v-if="open"
        :model="form"
        :rules="rules"
        :disabled="isCheck"
      >
        <el-form-item
          v-for="(item, index) in formItem"
          :key="index"
          :label="item.label"
          :prop="item.prop"
          label-width="120px"
          :class="item.component == 'inputNumber' ? 'itemFixed' : ''"
        >
          <template v-if="item.component == 'input'">
            <el-input
              v-model="form[item.prop]"
              :readonly="item.readonly"
              :placeholder="
                item.prop == 'checkItemNo' ? '自动生成' : '请输入' + item.label
              "
            />
          </template>
          <template v-if="item.component == 'inputNumber'">
            <el-input-number
              v-model="form[item.prop]"
              :label="'请输入' + item.label"
            ></el-input-number>
          </template>
          <template v-if="item.component == 'textarea'">
            <el-input
              type="textarea"
              :rows="2"
              :placeholder="'请输入' + item.label"
              v-model="form[item.prop]"
            >
            </el-input>
          </template>
          <template v-if="item.component == 'select'">
            <template v-if="item.prop == 'checkType'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                v-if="item.prop == 'checkType'"
                style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.check_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
            <template v-if="item.prop == 'isAutoCheck'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                    style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.is_auto_check"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
            <template v-if="item.prop == 'isRequired'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                    style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.is_required"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
            <template v-if="item.prop == 'isToSpc'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                    style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.is_to_spc"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
               <template v-if="item.prop == 'werks'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                v-if="item.prop == 'werks'"
                style="width: 100%"
              >
               <el-option
                  v-for="dict in werksList"
                  :key="dict.werks"
                  :label="dict.werksName"
                  :value="dict.werks"
                >
                </el-option>
              </el-select>
            </template>
            <template v-if="item.prop == 'status'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                    style="width: 100%"
              >
                <el-option
                  v-for="dict in dict.type.status"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
          </template>
        </el-form-item>
      </el-form>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button
        v-if="!isCheck"
        :loading="buttonLoading"
        type="primary"
        @click="submitForm"
        >ç¡® å®š</el-button
      >
      <el-button @click="cancel">取 æ¶ˆ</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { formatData, formrRquired, formatDataItem } from "./info.data";
import { listwerkshouse } from "@/api/basicData/location";
import {  getLocationGroup, addLocationGroup, updateLocationGroup } from "@/api/basicData/locationGroup";
export default {
  name: "checkItemAdd",
  components: {},
  dicts: ["check_type", "is_auto_check", "is_required", "is_to_spc", "status"],
  data() {
    return {
      form: JSON.parse(JSON.stringify(formatData)),
      rules: formrRquired,
      open: false,
      title: "",
      buttonLoading: false,
      isCheck: false,
         werksList: [],
    };
  },
  computed: {
    formItem() {
      return formatDataItem;
    },
  },
  watch:{
    open(val){
      if(!val){
      this.$refs["form"].resetFields();
      }
    }
  },
  mounted() {
      listwerkshouse({
        pageNum: 1,
        pageSize: 99,
      }).then(res =>{
      console.log(res, '工厂');
      this.werksList = res.rows;
      })
  },
  methods: {
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.locationGroupId != null) {
            updateLocationGroup(this.form)
              .then((response) => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.$emit("getList");
              })
              .finally(() => {
                this.buttonLoading = false;
              });
          } else {
            addLocationGroup(this.form)
              .then((response) => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.$emit("getList");
              })
              .finally(() => {
                this.buttonLoading = false;
              });
          }
        }
      });
    },
    // å–消按钮
    cancel() {
      this.reset();
    },
    reset() {
      this.$refs["form"].resetFields();
      this.open = false;
      this.isCheck = false;
    },
    elDialogShow(type, info = "") {
      this.open = true;
      if (type == 1) {
        this.title = "检测项目添加";
        this.isCheck = false;
      } else if (type == 2) {
        this.isCheck = false;
        this.getDetailse(info);
        this.title = "检测项目编辑";
      } else {
        this.title = "检测项目查看";
        this.isCheck = true;
        this.getDetailse(info);
      }
      this.$nextTick(()=>{
      })
    },
    getDetailse(id) {
      getLocationGroup(id).then((res) => {
        if (res.code === 200) {
          this.form = res.data;
        }
      });
    },
  },
};
</script>
<style lang="less" scoped>
.contbox {
  max-height: 60vh !important;
  overflow: auto;
  box-sizing: border-box;
  padding: 0 20px;
}
.itemFixed {
  display: inline-block !important;
}
.itemFixed:first-child {
  display: block !important;
}
::v-deep .is-disabled .el-input__inner {
  color: #606266 !important;
}
// ::v-deep .el-input.is-disabled .el-input__inner
</style>
src/views/basicData/locationGroup/index.vue
@@ -1,37 +1,13 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="库位组编号" prop="locationGroupNo">
        <el-input
          v-model="queryParams.locationGroupNo"
          placeholder="请输入库位组编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="库位组名称" prop="locationGroupName">
        <el-input
          v-model="queryParams.locationGroupName"
          placeholder="请输入库位组名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="仓库编号" prop="lgort">
        <el-input
          v-model="queryParams.lgort"
          placeholder="请输入仓库编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
  <el-main class="contbox" ref="contBox">
    <div class="head" ref="headBox">
      <BaseSearch
        @getList="getList"
        :formItemList="searchFormSchema"
        @search="getList"
        @showSearchChange="getElHeight(28)"
      >
        <template #actionButton>
      <el-col :span="1.5">
        <el-button
          type="primary"
@@ -39,8 +15,9 @@
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:locationGroup:add']"
        >新增</el-button>
              v-hasPermi="['iqc_checkItem_create']"
              >新增</el-button
            >
      </el-col>
      <el-col :span="1.5">
        <el-button
@@ -48,10 +25,10 @@
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:locationGroup:edit']"
        >修改</el-button>
              v-hasPermi="['iqc_checkItem_edit']"
              >修改</el-button
            >
      </el-col>
      <el-col :span="1.5">
        <el-button
@@ -59,352 +36,193 @@
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:locationGroup:remove']"
        >删除</el-button>
              v-hasPermi="['iqc_checkItem_delete']"
              >删除</el-button
            >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:locationGroup:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" border :data="locationGroupList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
        <el-table-column
       label="序号"
      type="index"
      fixed
      width="50" />
      <!-- <el-table-column label="库位组ID" align="center" prop="locationGroupId" v-if="true"/> -->
      <el-table-column label="库位组编号" align="center" prop="locationGroupNo" />
      <el-table-column label="工厂" align="center" prop="werks" />
      <el-table-column label="库位组名称" align="center" prop="locationGroupName" />
      <el-table-column label="仓库编号" align="center" prop="lgort" />
      <el-table-column label="描述" align="center" prop="description" />
      <el-table-column label="状态" align="center" prop="state" />
      <el-table-column label="审核状态" align="center" prop="auditState" />
      <el-table-column label="审核人ID" align="center" prop="auditUserId" />
      <el-table-column label="审核人姓名" align="center" prop="auditUserName" />
      <el-table-column label="审核日期时间" align="center" prop="auditDateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.auditDateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核意见" align="center" prop="auditOpinion" />
      <el-table-column label="最后更新人id" align="center" prop="lastUpdatedUserId" />
      <el-table-column label="最后更新人姓名" align="center" prop="lastUpdatedUserName" />
      <el-table-column label="最后更新时间" align="center" prop="lastUpdatedDateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdatedDateTime, '{y}-{m}-{d}') }}</span>
      </BaseSearch>
    </div>
    <TableCom
      :column="tabiInfo.columns"
      :table-data="tabiInfo.tableData"
      :table-loading="tabiInfo.tableLoading"
      :isSelection="tabiInfo.isSelection"
      :height="elementHeight"
      rowKey="locationGroupId"
      ref="tabel"
      @checkData="checkData"
      @checkLook="checkInfo"
    >
      <template slot="checkType" slot-scope="scope">
        <dict-tag
          :options="dict.type.check_type"
          :value="scope.row.checkType"
        />
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:locationGroup:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:locationGroup:remove']"
          >删除</el-button>
      <template slot="isAutoCheck" slot-scope="scope">
        <dict-tag
          :options="dict.type.is_auto_check"
          :value="scope.row.isAutoCheck"
        />
        </template>
      </el-table-column>
    </el-table>
      <template slot="isRequired" slot-scope="scope">
        <dict-tag
          :options="dict.type.is_required"
          :value="scope.row.isRequired"
        />
      </template>
      <template slot="auditState" slot-scope="scope">
        <dict-tag :options="dict.type.audit_status" :value="scope.row.auditState" />
      </template>
      <template slot="status" slot-scope="scope">
        <dict-tag :options="dict.type.status" :value="scope.row.status" />
      </template>
    </TableCom>
    <div class="pagination" ref="pagination">
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
        v-show="pageInfo.pageTotal > 0"
        :total="pageInfo.pageTotal"
        :page.sync="pageInfo.currentPage"
        :limit.sync="pageInfo.pageSize"
      @pagination="getList"
    />
    <!-- æ·»åŠ æˆ–修改库位组对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="库位组编号" prop="locationGroupNo">
          <el-input v-model="form.locationGroupNo" placeholder="请输入库位组编号" />
        </el-form-item>
        <el-form-item label="工厂" prop="werks">
          <el-input v-model="form.werks" placeholder="请输入工厂" />
        </el-form-item>
        <el-form-item label="库位组名称" prop="locationGroupName">
          <el-input v-model="form.locationGroupName" placeholder="请输入库位组名称" />
        </el-form-item>
        <el-form-item label="仓库编号" prop="lgort">
          <el-input v-model="form.lgort" placeholder="请输入仓库编号" />
        </el-form-item>
        <el-form-item label="描述" prop="description">
          <el-input v-model="form.description" placeholder="请输入描述" />
        </el-form-item>
        <el-form-item label="状态" prop="state">
          <el-input v-model="form.state" placeholder="请输入状态" />
        </el-form-item>
        <!-- <el-form-item label="最后更新人id" prop="lastUpdatedUserId">
          <el-input v-model="form.lastUpdatedUserId" placeholder="请输入最后更新人id" />
        </el-form-item>
        <el-form-item label="最后更新人姓名" prop="lastUpdatedUserName">
          <el-input v-model="form.lastUpdatedUserName" placeholder="请输入最后更新人姓名" />
        </el-form-item>
        <el-form-item label="最后更新时间" prop="lastUpdatedDateTime">
          <el-date-picker clearable
            v-model="form.lastUpdatedDateTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择最后更新时间">
          </el-date-picker>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">ç¡® å®š</el-button>
        <el-button @click="cancel">取 æ¶ˆ</el-button>
      </div>
    </el-dialog>
  </div>
    <AddaddModal ref="addaddModal" @getList="getList" />
  </el-main>
</template>
<script>
import { listLocationGroup, getLocationGroup, delLocationGroup, addLocationGroup, updateLocationGroup } from "@/api/basicData/locationGroup";
import TableCom from "@/components/Table/index";
import BaseSearch from "@/components/Table/BaseSearch";
import { columns, searchFormSchema } from "./info.data";
import mixin from "@/components/Table/mixins/resize";
import { listLocationGroup, delLocationGroup } from "@/api/basicData/locationGroup";
import AddaddModal from "./addModal";
export default {
  name: "LocationGroup",
  components: { TableCom, BaseSearch, AddaddModal },
  mixins: [mixin],
  dicts: ["audit_status", "status"],
  data() {
    return {
      // æŒ‰é’®loading
      buttonLoading: false,
      // é®ç½©å±‚
      loading: true,
      // é€‰ä¸­æ•°ç»„
      ids: [],
      // éžå•ä¸ªç¦ç”¨
      single: true,
      // éžå¤šä¸ªç¦ç”¨
      multiple: true,
      // æ˜¾ç¤ºæœç´¢æ¡ä»¶
      showSearch: true,
      // æ€»æ¡æ•°
      total: 0,
      // åº“位组表格数据
      locationGroupList: [],
      // å¼¹å‡ºå±‚标题
      title: "",
      // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚
      open: false,
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        locationGroupNo: undefined,
        locationGroupName: undefined,
        lgort: undefined,
      searchFormSchema: searchFormSchema,
      tabiInfo: {
        columns: columns,
        tableData: [],
        tableLoading: false,
        isSelection: true,
        rowClassName: "rowClassName",
      },
      // è¡¨å•å‚æ•°
      form: {},
      // è¡¨å•æ ¡éªŒ
      rules: {
        locationGroupId: [
          { required: true, message: "库位组ID不能为空", trigger: "blur" }
        ],
        locationGroupNo: [
          { required: true, message: "库位组编号不能为空", trigger: "blur" }
        ],
        werks: [
          { required: true, message: "工厂不能为空", trigger: "blur" }
        ],
        locationGroupName: [
          { required: true, message: "库位组名称不能为空", trigger: "blur" }
        ],
        lgort: [
          { required: true, message: "仓库编号不能为空", trigger: "blur" }
        ],
        description: [
          { required: true, message: "描述不能为空", trigger: "blur" }
        ],
        state: [
          { required: true, message: "状态不能为空", trigger: "blur" }
        ],
        displayOrder: [
          { required: true, message: "排序不能为空", trigger: "blur" }
        ],
        createdUserId: [
          { required: true, message: "创建人id不能为空", trigger: "blur" }
        ],
        createdUserName: [
          { required: true, message: "创建人姓名不能为空", trigger: "blur" }
        ],
        createdDateTime: [
          { required: true, message: "创建日期时间不能为空", trigger: "blur" }
        ],
        auditState: [
          { required: true, message: "审核状态不能为空", trigger: "blur" }
        ],
        auditUserId: [
          { required: true, message: "审核人ID不能为空", trigger: "blur" }
        ],
        auditUserName: [
          { required: true, message: "审核人姓名不能为空", trigger: "blur" }
        ],
        auditDateTime: [
          { required: true, message: "审核日期时间不能为空", trigger: "blur" }
        ],
        auditOpinion: [
          { required: true, message: "审核意见不能为空", trigger: "blur" }
        ],
        lastUpdatedUserId: [
          { required: true, message: "最后更新人id不能为空", trigger: "blur" }
        ],
        lastUpdatedUserName: [
          { required: true, message: "最后更新人姓名不能为空", trigger: "blur" }
        ],
        lastUpdatedDateTime: [
          { required: true, message: "最后更新时间不能为空", trigger: "blur" }
        ],
        isDeleted: [
          { required: true, message: "是否删除不能为空", trigger: "blur" }
        ]
      }
      pageInfo: {
        pageSize: 10,
        pageTotal: 0,
        currentPage: 1,
      },
      visible: false,
      ids: [],
      open: false,
    };
  },
  created() {
  mounted() {
    this.getList();
  },
  methods: {
    /** æŸ¥è¯¢åº“位组列表 */
    getList() {
      this.loading = true;
      listLocationGroup(this.queryParams).then(response => {
        this.locationGroupList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // å–消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // è¡¨å•é‡ç½®
    reset() {
      this.form = {
        locationGroupId: undefined,
        locationGroupNo: undefined,
        werks: undefined,
        locationGroupName: undefined,
        lgort: undefined,
        description: undefined,
        state: undefined,
        displayOrder: undefined,
        createdUserId: undefined,
        createdUserName: undefined,
        createdDateTime: undefined,
        auditState: undefined,
        auditUserId: undefined,
        auditUserName: undefined,
        auditDateTime: undefined,
        auditOpinion: undefined,
        lastUpdatedUserId: undefined,
        lastUpdatedUserName: undefined,
        lastUpdatedDateTime: undefined,
        isDeleted: undefined
    getList(info = {}) {
      this.ids = [];
      this.tabiInfo.tableLoading = true;
      let params = {
        pageSize: this.pageInfo.pageSize,
        pageNum: this.pageInfo.currentPage,
        bizType: 10,
        ...info,
      };
      this.resetForm("form");
    },
    /** æœç´¢æŒ‰é’®æ“ä½œ */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** é‡ç½®æŒ‰é’®æ“ä½œ */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // å¤šé€‰æ¡†é€‰ä¸­æ•°æ®
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.locationGroupId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** æ–°å¢žæŒ‰é’®æ“ä½œ */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加库位组";
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const locationGroupId = row.locationGroupId || this.ids
      getLocationGroup(locationGroupId).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改库位组";
      listLocationGroup(params).then((res) => {
        if (res.code == 200) {
          this.pageInfo.pageTotal = res.total;
          this.tabiInfo.tableData = res.rows;
          this.tabiInfo.tableLoading = false;
        }
      });
    },
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.locationGroupId != null) {
            updateLocationGroup(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
    checkData(data) {
      if (data.length) {
        this.ids = data.map((item) => {
          return item.locationGroupId;
            });
          } else {
            addLocationGroup(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
        this.ids = [];
          }
        }
      });
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    handleDelete(row) {
      const locationGroupIds = row.locationGroupId || this.ids;
      this.$modal.confirm('是否确认删除库位组编号为"' + locationGroupIds + '"的数据项?').then(() => {
        this.loading = true;
    handleAdd() {
      this.$refs.addaddModal.elDialogShow(1);
    },
    checkInfo(info) {
      this.$refs.addaddModal.elDialogShow(3, info.locationGroupId);
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate() {
      if (this.ids.length > 1) {
        this.$message({
          message: "只能操作单条数据!",
          type: "warning",
        });
        return;
      } else if (this.ids.length < 1) {
        this.$message({
          message: "请选择数据",
          type: "warning",
        });
        return;
      }
      this.$refs.addaddModal.elDialogShow(2, this.ids[0]);
    },
    handleDelete() {
      const locationGroupIds = this.ids;
      if (locationGroupIds.length) {
        this.$modal
          .confirm(
            '是否确认删除已选中的数据项?'
          )
          .then(() => {
            this.tabiInfo.tableLoading = true;
        return delLocationGroup(locationGroupIds);
      }).then(() => {
        this.loading = false;
          })
          .then(() => {
            this.tabiInfo.tableLoading = false;
            this.ids = [];
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
            this.$message({
              message: "删除成功",
              type: "success",
      });
          })
          .catch(() => {})
          .finally(() => {
            this.tabiInfo.tableLoading = false;
          });
      } else {
        this.$message({
          message: "请选择数据",
          type: "warning",
        });
      }
    },
    /** å¯¼å‡ºæŒ‰é’®æ“ä½œ */
    handleExport() {
      this.download('system/locationGroup/export', {
        ...this.queryParams
      }, `locationGroup_${new Date().getTime()}.xlsx`)
    }
  }
  },
};
</script>
<style lang="less" scoped>
.rowClassName {
  height: 50px;
}
.contbox {
  width: 100;
  height: 100%;
}
</style>
src/views/basicData/locationGroup/info.data.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,278 @@
import * as vars from "@/variableSet/columns";
export const columns = [
    {
        label: '编号',
        align: 'left',
        prop: 'locationGroupNo',
        width: vars.timeWidth,
        fixed: 'left',
        tooltip: true,
    },
    {
        label: '名称',
        align: 'left',
        prop: 'locationGroupName',
        width: vars.timeWidth,
        fixed: 'left',
    },
    {
        label: '工厂',
        align: 'left',
        prop: 'werks',
        fixed: 'left',
        width: vars.timeWidth,
    },
    {
        label: '仓库编号',
        align: 'left',
        prop: 'lgort',
        width: vars.timeWidth,
    },
    {
        label: '描述',
        align: 'left',
        prop: 'description',
        width: vars.timeWidth,
        tooltip: true,
    },
    {
        label: '审核状态',
        align: 'left',
        prop: 'auditState',
        dataType: 'slot',
        slot: 'auditState',
        width: vars.timeWidth,
    },
    {
        label: '审核人姓名',
        align: 'left',
        prop: 'auditUserName',
        width: vars.timeWidth,
    },
    {
        label: '审核日期时间',
        align: 'left',
        prop: 'auditDateTime',
        width: vars.timeWidth,
    },
    {
        label: '最后更新人姓名',
        align: 'left',
        prop: 'lastUpdatedUserName',
        width: vars.lastUpdatedUserName,
    },
    {
        label: '最后更新日期时间',
        align: 'left',
        prop: 'lastUpdatedDateTime',
        width: vars.lastUpdatedDateTime,
    },
    {
        dataType: 'option',
        label: '操作',
        width: '80',
        align: 'center',
        fixed: 'right',
        hasPermi: 'iqc_checkItem_check',
        operation: [
            {
                name: '查看',
                size: 'mini',
                plain: true,
                typeText: 4
            }
        ]
    }
];
export const searchFormSchema = [
    {
        field: 'locationGroupName',
        label: '名称:',
        labelWidth: 80,
        component: 'Input',
        componentProps: {
            placeholder: '请输入',
        },
    },
    {
        field: 'locationGroupNo',
        label: '编号:',
        labelWidth: 80,
        component: 'Input',
        componentProps: {
            placeholder: '请输入',
        },
    },
    {
        field: 'lgort',
        label: '仓库编号:',
        labelWidth: 80,
        component: 'Input',
        componentProps: {
            placeholder: '请输入',
        },
    },
    // {
    //     field: 'state',
    //     label: '状态:',
    //     labelWidth: 80,
    //     component: 'Select',
    //     componentProps: {
    //         options: [
    //             { label: '启用', value: '1' },
    //             { label: '禁用', value: '0' },
    //         ],
    //     },
    //     multiple: false,
    // },
];
export const formatData = {
    locationGroupId: undefined,
    locationGroupNo: undefined,
    werks: undefined,
    locationGroupName: undefined,
    lgort: undefined,
    description: undefined,
    state: undefined,
    displayOrder: undefined,
    createdUserId: undefined,
    createdUserName: undefined,
    createdDateTime: undefined,
    auditState: undefined,
    auditUserId: undefined,
    auditUserName: undefined,
    auditDateTime: undefined,
    auditOpinion: undefined,
    lastUpdatedUserId: undefined,
    lastUpdatedUserName: undefined,
    lastUpdatedDateTime: undefined,
    isDeleted: undefined
};
export const formrRquired = {
    locationGroupId: [
        { required: true, message: "库位组ID不能为空", trigger: "blur" }
      ],
      locationGroupNo: [
        { required: true, message: "库位组编号不能为空", trigger: "blur" }
      ],
      werks: [
        { required: true, message: "工厂不能为空", trigger: "blur" }
      ],
      locationGroupName: [
        { required: true, message: "库位组名称不能为空", trigger: "blur" }
      ],
      lgort: [
        { required: true, message: "仓库编号不能为空", trigger: "blur" }
      ],
      description: [
        { required: true, message: "描述不能为空", trigger: "blur" }
      ],
      state: [
        { required: true, message: "状态不能为空", trigger: "blur" }
      ],
      displayOrder: [
        { required: true, message: "排序不能为空", trigger: "blur" }
      ],
      createdUserId: [
        { required: true, message: "创建人id不能为空", trigger: "blur" }
      ],
      createdUserName: [
        { required: true, message: "创建人姓名不能为空", trigger: "blur" }
      ],
      createdDateTime: [
        { required: true, message: "创建日期时间不能为空", trigger: "blur" }
      ],
      auditState: [
        { required: true, message: "审核状态不能为空", trigger: "blur" }
      ],
      auditUserId: [
        { required: true, message: "审核人ID不能为空", trigger: "blur" }
      ],
      auditUserName: [
        { required: true, message: "审核人姓名不能为空", trigger: "blur" }
      ],
      auditDateTime: [
        { required: true, message: "审核日期时间不能为空", trigger: "blur" }
      ],
      auditOpinion: [
        { required: true, message: "审核意见不能为空", trigger: "blur" }
      ],
      lastUpdatedUserId: [
        { required: true, message: "最后更新人id不能为空", trigger: "blur" }
      ],
      lastUpdatedUserName: [
        { required: true, message: "最后更新人姓名不能为空", trigger: "blur" }
      ],
      lastUpdatedDateTime: [
        { required: true, message: "最后更新时间不能为空", trigger: "blur" }
      ],
      isDeleted: [
        { required: true, message: "是否删除不能为空", trigger: "blur" }
      ]
}
export const formatDataItem = [
    {
        label: "编号",
        prop: 'locationGroupNo',
        component: 'input',
        // readonly: true
    },
    {
        label: "名称",
        prop: 'locationGroupName',
        component: 'input'
    },
    {
        label: "工厂",
        prop: 'werks',
        component: 'select',
    },
    {
        label: "仓库编号",
        prop: 'lgort',
        component: 'input'
    },
    // {
    //     label: "是否启用",
    //     prop: 'isUseLocation',
    //     component: 'select'
    // },
    // {
    //     label: "管理员名称",
    //     prop: 'userId',
    //     component: 'input'
    // },
    // {
    //     label: "管理员电话",
    //     prop: 'userPhone',
    //     component: 'input'
    // },
    // {
    //     label: "坐标X",
    //     prop: 'lowerDeviation',
    //     component: 'inputNumber'
    // },
    // {
    //     label: "坐标Y",
    //     prop: 'standardHigh',
    //     component: 'inputNumber'
    // },
    {
        label: "描述",
        prop: 'description',
        component: 'textarea'
    },
]
src/views/basicData/locationGroup/linshi.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,410 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="库位组编号" prop="locationGroupNo">
        <el-input
          v-model="queryParams.locationGroupNo"
          placeholder="请输入库位组编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="库位组名称" prop="locationGroupName">
        <el-input
          v-model="queryParams.locationGroupName"
          placeholder="请输入库位组名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="仓库编号" prop="lgort">
        <el-input
          v-model="queryParams.lgort"
          placeholder="请输入仓库编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:locationGroup:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:locationGroup:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:locationGroup:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:locationGroup:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" border :data="locationGroupList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
        <el-table-column
       label="序号"
      type="index"
      fixed
      width="50" />
      <!-- <el-table-column label="库位组ID" align="center" prop="locationGroupId" v-if="true"/> -->
      <el-table-column label="库位组编号" align="center" prop="locationGroupNo" />
      <el-table-column label="工厂" align="center" prop="werks" />
      <el-table-column label="库位组名称" align="center" prop="locationGroupName" />
      <el-table-column label="仓库编号" align="center" prop="lgort" />
      <el-table-column label="描述" align="center" prop="description" />
      <!-- <el-table-column label="状态" align="center" prop="state" /> -->
      <el-table-column label="审核状态" align="center" prop="auditState" />
      <el-table-column label="审核人ID" align="center" prop="auditUserId" />
      <el-table-column label="审核人姓名" align="center" prop="auditUserName" />
      <el-table-column label="审核日期时间" align="center" prop="auditDateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.auditDateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核意见" align="center" prop="auditOpinion" />
      <el-table-column label="最后更新人id" align="center" prop="lastUpdatedUserId" />
      <el-table-column label="最后更新人姓名" align="center" prop="lastUpdatedUserName" />
      <el-table-column label="最后更新时间" align="center" prop="lastUpdatedDateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdatedDateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:locationGroup:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:locationGroup:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- æ·»åŠ æˆ–修改库位组对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="库位组编号" prop="locationGroupNo">
          <el-input v-model="form.locationGroupNo" placeholder="请输入库位组编号" />
        </el-form-item>
        <el-form-item label="工厂" prop="werks">
          <!-- <el-input v-model="form.werks" placeholder="请输入工厂" /> -->
        </el-form-item>
        <el-form-item label="库位组名称" prop="locationGroupName">
          <el-input v-model="form.locationGroupName" placeholder="请输入库位组名称" />
        </el-form-item>
        <el-form-item label="仓库编号" prop="lgort">
          <el-input v-model="form.lgort" placeholder="请输入仓库编号" />
        </el-form-item>
        <el-form-item label="描述" prop="description">
          <el-input v-model="form.description" placeholder="请输入描述" />
        </el-form-item>
        <el-form-item label="状态" prop="state">
          <el-input v-model="form.state" placeholder="请输入状态" />
        </el-form-item>
        <!-- <el-form-item label="最后更新人id" prop="lastUpdatedUserId">
          <el-input v-model="form.lastUpdatedUserId" placeholder="请输入最后更新人id" />
        </el-form-item>
        <el-form-item label="最后更新人姓名" prop="lastUpdatedUserName">
          <el-input v-model="form.lastUpdatedUserName" placeholder="请输入最后更新人姓名" />
        </el-form-item>
        <el-form-item label="最后更新时间" prop="lastUpdatedDateTime">
          <el-date-picker clearable
            v-model="form.lastUpdatedDateTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择最后更新时间">
          </el-date-picker>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">ç¡® å®š</el-button>
        <el-button @click="cancel">取 æ¶ˆ</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listLocationGroup, getLocationGroup, delLocationGroup, addLocationGroup, updateLocationGroup } from "@/api/basicData/locationGroup";
export default {
  name: "LocationGroup",
  data() {
    return {
      // æŒ‰é’®loading
      buttonLoading: false,
      // é®ç½©å±‚
      loading: true,
      // é€‰ä¸­æ•°ç»„
      ids: [],
      // éžå•ä¸ªç¦ç”¨
      single: true,
      // éžå¤šä¸ªç¦ç”¨
      multiple: true,
      // æ˜¾ç¤ºæœç´¢æ¡ä»¶
      showSearch: true,
      // æ€»æ¡æ•°
      total: 0,
      // åº“位组表格数据
      locationGroupList: [],
      // å¼¹å‡ºå±‚标题
      title: "",
      // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚
      open: false,
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        locationGroupNo: undefined,
        locationGroupName: undefined,
        lgort: undefined,
      },
      // è¡¨å•å‚æ•°
      form: {},
      // è¡¨å•æ ¡éªŒ
      rules: {
        locationGroupId: [
          { required: true, message: "库位组ID不能为空", trigger: "blur" }
        ],
        locationGroupNo: [
          { required: true, message: "库位组编号不能为空", trigger: "blur" }
        ],
        werks: [
          { required: true, message: "工厂不能为空", trigger: "blur" }
        ],
        locationGroupName: [
          { required: true, message: "库位组名称不能为空", trigger: "blur" }
        ],
        lgort: [
          { required: true, message: "仓库编号不能为空", trigger: "blur" }
        ],
        description: [
          { required: true, message: "描述不能为空", trigger: "blur" }
        ],
        state: [
          { required: true, message: "状态不能为空", trigger: "blur" }
        ],
        displayOrder: [
          { required: true, message: "排序不能为空", trigger: "blur" }
        ],
        createdUserId: [
          { required: true, message: "创建人id不能为空", trigger: "blur" }
        ],
        createdUserName: [
          { required: true, message: "创建人姓名不能为空", trigger: "blur" }
        ],
        createdDateTime: [
          { required: true, message: "创建日期时间不能为空", trigger: "blur" }
        ],
        auditState: [
          { required: true, message: "审核状态不能为空", trigger: "blur" }
        ],
        auditUserId: [
          { required: true, message: "审核人ID不能为空", trigger: "blur" }
        ],
        auditUserName: [
          { required: true, message: "审核人姓名不能为空", trigger: "blur" }
        ],
        auditDateTime: [
          { required: true, message: "审核日期时间不能为空", trigger: "blur" }
        ],
        auditOpinion: [
          { required: true, message: "审核意见不能为空", trigger: "blur" }
        ],
        lastUpdatedUserId: [
          { required: true, message: "最后更新人id不能为空", trigger: "blur" }
        ],
        lastUpdatedUserName: [
          { required: true, message: "最后更新人姓名不能为空", trigger: "blur" }
        ],
        lastUpdatedDateTime: [
          { required: true, message: "最后更新时间不能为空", trigger: "blur" }
        ],
        isDeleted: [
          { required: true, message: "是否删除不能为空", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** æŸ¥è¯¢åº“位组列表 */
    getList() {
      this.loading = true;
      listLocationGroup(this.queryParams).then(response => {
        this.locationGroupList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // å–消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // è¡¨å•é‡ç½®
    reset() {
      this.form = {
        locationGroupId: undefined,
        locationGroupNo: undefined,
        werks: undefined,
        locationGroupName: undefined,
        lgort: undefined,
        description: undefined,
        state: undefined,
        displayOrder: undefined,
        createdUserId: undefined,
        createdUserName: undefined,
        createdDateTime: undefined,
        auditState: undefined,
        auditUserId: undefined,
        auditUserName: undefined,
        auditDateTime: undefined,
        auditOpinion: undefined,
        lastUpdatedUserId: undefined,
        lastUpdatedUserName: undefined,
        lastUpdatedDateTime: undefined,
        isDeleted: undefined
      };
      this.resetForm("form");
    },
    /** æœç´¢æŒ‰é’®æ“ä½œ */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** é‡ç½®æŒ‰é’®æ“ä½œ */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // å¤šé€‰æ¡†é€‰ä¸­æ•°æ®
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.locationGroupId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** æ–°å¢žæŒ‰é’®æ“ä½œ */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加库位组";
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const locationGroupId = row.locationGroupId || this.ids
      getLocationGroup(locationGroupId).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改库位组";
      });
    },
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.locationGroupId != null) {
            updateLocationGroup(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addLocationGroup(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    handleDelete(row) {
      const locationGroupIds = row.locationGroupId || this.ids;
      this.$modal.confirm('是否确认删除库位组编号为"' + locationGroupIds + '"的数据项?').then(() => {
        this.loading = true;
        return delLocationGroup(locationGroupIds);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** å¯¼å‡ºæŒ‰é’®æ“ä½œ */
    handleExport() {
      this.download('system/locationGroup/export', {
        ...this.queryParams
      }, `locationGroup_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
src/views/basicData/warehouse/addModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,247 @@
<template>
  <!-- æ·»åŠ æˆ–修改IQC检验项目对话框 -->
  <el-dialog
    :title="title"
    :visible.sync="open"
    width="750px"
    custom-class="madelClass"
    :destroyOnClose="true"
  >
    <div class="contbox">
      <el-form
        ref="form"
        v-if="open"
        :model="form"
        :rules="rules"
        :disabled="isCheck"
      >
        <el-form-item
          v-for="(item, index) in formItem"
          :key="index"
          :label="item.label"
          :prop="item.prop"
          label-width="120px"
          :class="item.component == 'inputNumber' ? 'itemFixed' : ''"
        >
          <template v-if="item.component == 'input'">
            <el-input
              v-model="form[item.prop]"
              :readonly="item.readonly"
              :placeholder="
                item.prop == 'checkItemNo' ? '自动生成' : '请输入' + item.label
              "
            />
          </template>
          <template v-if="item.component == 'inputNumber'">
            <el-input-number
              v-model="form[item.prop]"
              :label="'请输入' + item.label"
            ></el-input-number>
          </template>
          <template v-if="item.component == 'textarea'">
            <el-input
              type="textarea"
              :rows="2"
              :placeholder="'请输入' + item.label"
              v-model="form[item.prop]"
            >
            </el-input>
          </template>
          <template v-if="item.component == 'select'">
            <template v-if="item.prop == 'werks'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                v-if="item.prop == 'werks'"
                style="width: 100%"
              >
               <el-option
                  v-for="dict in werksList"
                  :key="dict.werks"
                  :label="dict.werksName"
                  :value="dict.werks"
                >
                </el-option>
              </el-select>
            </template>
             <template v-if="item.prop == 'type'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                v-if="item.prop == 'type'"
                style="width: 100%"
              >
               <el-option
                  v-for="dict in werksList"
                  :key="dict.werks"
                  :label="dict.werksName"
                  :value="dict.werks"
                >
                </el-option>
              </el-select>
            </template>
             <template v-if="item.prop == 'isUseLocation'">
              <el-select
                v-model="form[item.prop]"
                :placeholder="'请选择' + item.label"
                v-if="item.prop == 'isUseLocation'"
                style="width: 100%"
              >
               <el-option
                  v-for="dict in dict.type.isenable"
                  :key="dict.value"
                 :label="dict.label"
                  :value="dict.value"
                >
                </el-option>
              </el-select>
            </template>
          </template>
        </el-form-item>
      </el-form>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button
        v-if="!isCheck"
        :loading="buttonLoading"
        type="primary"
        @click="submitForm"
        >ç¡® å®š</el-button
      >
      <el-button @click="cancel">取 æ¶ˆ</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { formatData, formrRquired, formatDataItem } from "./info.data";
import {  getWarehouse, addWarehouse, updateWarehouse } from "@/api/basicData/warehouse";
import { listwerkshouse } from "@/api/basicData/location";
export default {
  name: "checkItemAdd",
  components: {},
  dicts: ["isenable"],
  data() {
    return {
      form: JSON.parse(JSON.stringify(formatData)),
      rules: formrRquired,
      open: false,
      title: "",
      buttonLoading: false,
      isCheck: false,
         werksList: [],
    };
  },
  computed: {
    formItem() {
      return formatDataItem;
    },
  },
  watch:{
    open(val){
      if(!val){
      this.$refs["form"].resetFields();
      }
    }
  },
  mounted() {
      listwerkshouse({
        pageNum: 1,
        pageSize: 99,
      }).then(res =>{
      console.log(res, '工厂');
      this.werksList = res.rows;
      })
  },
  methods: {
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.warehouseId != null) {
            updateWarehouse(this.form)
              .then((response) => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.$emit("getList");
              })
              .finally(() => {
                this.buttonLoading = false;
              });
          } else {
            addWarehouse(this.form)
              .then((response) => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.$emit("getList");
              })
              .finally(() => {
                this.buttonLoading = false;
              });
          }
        }
      });
    },
    // å–消按钮
    cancel() {
      this.reset();
    },
    reset() {
      this.$refs["form"].resetFields();
      this.open = false;
      this.isCheck = false;
    },
    elDialogShow(type, info = "") {
      this.open = true;
      if (type == 1) {
        this.title = "检测项目添加";
        this.isCheck = false;
      } else if (type == 2) {
        this.isCheck = false;
        this.getDetailse(info);
        this.title = "检测项目编辑";
      } else {
        this.title = "检测项目查看";
        this.isCheck = true;
        this.getDetailse(info);
      }
      this.$nextTick(()=>{
      })
    },
    getDetailse(id) {
      getWarehouse(id).then((res) => {
        if (res.code === 200) {
          this.form = res.data;
        }
      });
    },
  },
};
</script>
<style lang="less" scoped>
.contbox {
  max-height: 60vh !important;
  overflow: auto;
  box-sizing: border-box;
  padding: 0 20px;
}
.itemFixed {
  display: inline-block !important;
}
.itemFixed:first-child {
  display: block !important;
}
::v-deep .is-disabled .el-input__inner {
  color: #606266 !important;
}
// ::v-deep .el-input.is-disabled .el-input__inner
</style>
src/views/basicData/warehouse/index.vue
@@ -1,47 +1,13 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
        <el-form-item label="工厂" prop="werks">
        <el-input
          v-model.trim="queryParams.werks"
          placeholder="请输入工厂"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="名称" prop="warehouseName">
        <el-input
          v-model.trim="queryParams.warehouseName"
          placeholder="请输入名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="编号" prop="lgort">
        <el-input
          v-model.trim="queryParams.lgort"
          placeholder="请输入编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="状态" prop="state">
        <el-input
          v-model.trim="queryParams.state"
          placeholder="请输入状态"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
  <el-main class="contbox" ref="contBox">
    <div class="head" ref="headBox">
      <BaseSearch
        @getList="getList"
        :formItemList="searchFormSchema"
        @search="getList"
        @showSearchChange="getElHeight(28)"
      >
        <template #actionButton>
      <el-col :span="1.5">
        <el-button
          type="primary"
@@ -49,8 +15,9 @@
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:warehouse:add']"
        >新增</el-button>
              v-hasPermi="['iqc_checkItem_create']"
              >新增</el-button
            >
      </el-col>
      <el-col :span="1.5">
        <el-button
@@ -58,10 +25,10 @@
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:warehouse:edit']"
        >修改</el-button>
              v-hasPermi="['iqc_checkItem_edit']"
              >修改</el-button
            >
      </el-col>
      <el-col :span="1.5">
        <el-button
@@ -69,357 +36,192 @@
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:warehouse:remove']"
        >删除</el-button>
              v-hasPermi="['iqc_checkItem_delete']"
              >删除</el-button
            >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:warehouse:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" border :data="warehouseList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column
       label="序号"
      type="index"
      fixed
      width="50" />
      <!-- <el-table-column label="仓库ID" align="center" prop="warehouseId" v-if="true"/> -->
      <el-table-column label="仓库编号" align="center" prop="lgort" />
      <el-table-column label="名称" align="center" prop="warehouseName" />
      <el-table-column label="工厂" align="center" prop="werks" />
      <el-table-column label="类别" align="center" prop="type" />
      <el-table-column label="是否启用" align="center" prop="isUseLocation" >
        <template slot-scope="scope">
           <dict-tag :options="dict.type.isenable" :value="scope.row.isUseLocation"/>
        </template>
      </el-table-column>
      <!-- <el-table-column label="管理员ID" align="center" prop="userId" /> -->
        <el-table-column label="管理员名称" align="center" prop="userName" />
      <el-table-column label="管理员电话" align="center" prop="userPhone" />
      <el-table-column label="坐标X" align="center" prop="coordinateX" />
      <el-table-column label="坐标Y" align="center" prop="coordinateY" />
      <el-table-column label="描述" align="center" prop="description" />
      <!-- <el-table-column label="状态" align="center" prop="state" /> -->
      <el-table-column label="最后更新人id" align="center" prop="lastUpdatedUserId" />
      <el-table-column label="最后更新人姓名" align="center" prop="lastUpdatedUserName" />
      <el-table-column label="最后更新时间" align="center" prop="lastUpdatedDateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdatedDateTime, '{y}-{m}-{d}') }}</span>
      </BaseSearch>
    </div>
    <TableCom
      :column="tabiInfo.columns"
      :table-data="tabiInfo.tableData"
      :table-loading="tabiInfo.tableLoading"
      :isSelection="tabiInfo.isSelection"
      :height="elementHeight"
      rowKey="warehouseId"
      ref="tabel"
      @checkData="checkData"
      @checkLook="checkInfo"
    >
      <template slot="checkType" slot-scope="scope">
        <dict-tag
          :options="dict.type.check_type"
          :value="scope.row.checkType"
        />
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:warehouse:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:warehouse:remove']"
          >删除</el-button>
      <template slot="isAutoCheck" slot-scope="scope">
        <dict-tag
          :options="dict.type.is_auto_check"
          :value="scope.row.isAutoCheck"
        />
        </template>
      </el-table-column>
    </el-table>
      <template slot="isRequired" slot-scope="scope">
        <dict-tag
          :options="dict.type.is_required"
          :value="scope.row.isRequired"
        />
      </template>
      <template slot="isToSpc" slot-scope="scope">
        <dict-tag :options="dict.type.is_to_spc" :value="scope.row.isToSpc" />
      </template>
      <template slot="status" slot-scope="scope">
        <dict-tag :options="dict.type.status" :value="scope.row.status" />
      </template>
    </TableCom>
    <div class="pagination" ref="pagination">
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
        v-show="pageInfo.pageTotal > 0"
        :total="pageInfo.pageTotal"
        :page.sync="pageInfo.currentPage"
        :limit.sync="pageInfo.pageSize"
      @pagination="getList"
    />
    <!-- æ·»åŠ æˆ–修改仓库对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="仓库编号" prop="lgort">
          <el-input v-model.trim="form.lgort" placeholder="请输入仓库编号" />
        </el-form-item>
        <el-form-item label="名称" prop="warehouseName">
          <el-input v-model.trim="form.warehouseName" placeholder="请输入名称" />
        </el-form-item>
        <el-form-item label="工厂" prop="werks">
          <el-input v-model.trim="form.werks" placeholder="请输入工厂" />
        </el-form-item>
          <el-form-item label="类别" prop="type">
          <el-input v-model.trim="form.type" placeholder="请输入类别" />
        </el-form-item>
        <el-form-item label="是否启用" prop="isUseLocation">
          <!-- <el-input v-model.trim="form.isUseLocation" placeholder="请输入0,不启用
            1,启用" /> -->
                  <el-select v-model="form.isUseLocation" placeholder="是否启用" clearable>
            <el-option
              v-for="dict in dict.type.isenable"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="管理员名称" prop="userId">
          <el-input v-model.trim="form.userName" placeholder="请输入管理员名称" />
        </el-form-item>
        <el-form-item label="管理员电话" prop="userPhone">
          <el-input v-model.trim="form.userPhone" placeholder="请输入管理员电话" />
        </el-form-item>
        <el-form-item label="坐标X" prop="coordinateX">
          <el-input v-model.trim="form.coordinateX" placeholder="请输入坐标X" />
        </el-form-item>
        <el-form-item label="坐标Y" prop="coordinateY">
          <el-input v-model.trim="form.coordinateY" placeholder="请输入坐标Y" />
        </el-form-item>
        <el-form-item label="描述" prop="description">
          <el-input v-model.trim="form.description" placeholder="请输入描述" />
        </el-form-item>
        <!-- <el-form-item label="状态" prop="state">
          <el-input v-model.trim="form.state" placeholder="请输入状态" />
        </el-form-item> -->
        <!-- <el-form-item label="最后更新人id" prop="lastUpdatedUserId">
          <el-input v-model.trim="form.lastUpdatedUserId" placeholder="请输入最后更新人id" />
        </el-form-item>
        <el-form-item label="最后更新人姓名" prop="lastUpdatedUserName">
          <el-input v-model.trim="form.lastUpdatedUserName" placeholder="请输入最后更新人姓名" />
        </el-form-item>
        <el-form-item label="最后更新时间" prop="lastUpdatedDateTime">
          <el-date-picker clearable
            v-model="form.lastUpdatedDateTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择最后更新时间">
          </el-date-picker>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">ç¡® å®š</el-button>
        <el-button @click="cancel">取 æ¶ˆ</el-button>
      </div>
    </el-dialog>
  </div>
    <AddaddModal ref="addaddModal" @getList="getList" />
  </el-main>
</template>
<script>
import { listWarehouse, getWarehouse, delWarehouse, addWarehouse, updateWarehouse } from "@/api/basicData/warehouse";
import TableCom from "@/components/Table/index";
import BaseSearch from "@/components/Table/BaseSearch";
import { columns, searchFormSchema } from "./info.data";
import mixin from "@/components/Table/mixins/resize";
import { listWarehouse, delWarehouse } from "@/api/basicData/warehouse";
import AddaddModal from "./addModal";
export default {
  name: "Warehouse",
    dicts: ['isenable'],
  components: { TableCom, BaseSearch, AddaddModal },
  mixins: [mixin],
  dicts: ["check_type", "is_auto_check", "is_required", "is_to_spc", "status"],
  data() {
    return {
      // æŒ‰é’®loading
      buttonLoading: false,
      // é®ç½©å±‚
      loading: true,
      // é€‰ä¸­æ•°ç»„
      ids: [],
      // éžå•ä¸ªç¦ç”¨
      single: true,
      // éžå¤šä¸ªç¦ç”¨
      multiple: true,
      // æ˜¾ç¤ºæœç´¢æ¡ä»¶
      showSearch: true,
      // æ€»æ¡æ•°
      total: 0,
      // ä»“库表格数据
      warehouseList: [],
      // å¼¹å‡ºå±‚标题
      title: "",
      // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚
      open: false,
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        warehouseName: undefined,
        werks: undefined,
        type: undefined,
        state: undefined,
      searchFormSchema: searchFormSchema,
      tabiInfo: {
        columns: columns,
        tableData: [],
        tableLoading: false,
        isSelection: true,
        rowClassName: "rowClassName",
      },
      // è¡¨å•å‚æ•°
      form: {},
      // è¡¨å•æ ¡éªŒ
      rules: {
        warehouseId: [
          { required: true, message: "仓库ID不能为空", trigger: "blur" }
        ],
        lgort: [
          { required: true, message: "仓库编号不能为空", trigger: "blur" }
        ],
        warehouseName: [
          { required: true, message: "名称不能为空", trigger: "blur" }
        ],
        werks: [
          { required: true, message: "工厂不能为空", trigger: "blur" }
        ],
        type: [
          { required: true, message: "类别不能为空", trigger: "change" }
        ],
        // isUseLocation: [
        //   { required: true, message: "0,不启用
        //     1,启用不能为空", trigger: "blur" }
        // ],
        userId: [
          { required: true, message: "管理员ID不能为空", trigger: "blur" }
        ],
        userPhone: [
          { required: true, message: "管理员电话不能为空", trigger: "blur" }
        ],
        coordinateX: [
          { required: true, message: "坐标X不能为空", trigger: "blur" }
        ],
        coordinateY: [
          { required: true, message: "坐标Y不能为空", trigger: "blur" }
        ],
        description: [
          { required: true, message: "描述不能为空", trigger: "blur" }
        ],
        state: [
          { required: true, message: "状态不能为空", trigger: "blur" }
        ],
      }
      pageInfo: {
        pageSize: 10,
        pageTotal: 0,
        currentPage: 1,
      },
      visible: false,
      ids: [],
      open: false,
    };
  },
  created() {
  mounted() {
    this.getList();
  },
  methods: {
    /** æŸ¥è¯¢ä»“库列表 */
    getList() {
      this.loading = true;
      listWarehouse(this.queryParams).then(response => {
        this.warehouseList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // å–消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // è¡¨å•é‡ç½®
    reset() {
      this.form = {
        warehouseId: undefined,
        lgort: undefined,
        warehouseName: undefined,
        werks: undefined,
        type: undefined,
        isUseLocation: undefined,
        userId: undefined,
        userPhone: undefined,
        coordinateX: undefined,
        coordinateY: undefined,
        description: undefined,
        state: undefined,
        displayOrder: undefined,
        createdUserId: undefined,
        createdUserName: undefined,
        createdDateTime: undefined,
        lastUpdatedUserId: undefined,
        lastUpdatedUserName: undefined,
        lastUpdatedDateTime: undefined,
        isDeleted: undefined
    getList(info = {}) {
      this.ids = [];
      this.tabiInfo.tableLoading = true;
      let params = {
        pageSize: this.pageInfo.pageSize,
        pageNum: this.pageInfo.currentPage,
        bizType: 10,
        ...info,
      };
      this.resetForm("form");
    },
    /** æœç´¢æŒ‰é’®æ“ä½œ */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** é‡ç½®æŒ‰é’®æ“ä½œ */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // å¤šé€‰æ¡†é€‰ä¸­æ•°æ®
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.warehouseId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** æ–°å¢žæŒ‰é’®æ“ä½œ */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加仓库";
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const warehouseId = row.warehouseId || this.ids
      getWarehouse(warehouseId).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改仓库";
      listWarehouse(params).then((res) => {
        if (res.code == 200) {
          this.pageInfo.pageTotal = res.total;
          this.tabiInfo.tableData = res.rows;
          this.tabiInfo.tableLoading = false;
        }
      });
    },
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.warehouseId != null) {
            updateWarehouse(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
    checkData(data) {
      if (data.length) {
        this.ids = data.map((item) => {
          return item.warehouseId;
            });
          } else {
            addWarehouse(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
        this.ids = [];
          }
        }
      });
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    handleDelete(row) {
      const warehouseIds = row.warehouseId || this.ids;
      this.$modal.confirm('是否确认删除仓库编号为"' + warehouseIds + '"的数据项?').then(() => {
        this.loading = true;
    handleAdd() {
      this.$refs.addaddModal.elDialogShow(1);
    },
    checkInfo(info) {
      this.$refs.addaddModal.elDialogShow(3, info.warehouseId);
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate() {
      if (this.ids.length > 1) {
        this.$message({
          message: "只能操作单条数据!",
          type: "warning",
        });
        return;
      } else if (this.ids.length < 1) {
        this.$message({
          message: "请选择数据",
          type: "warning",
        });
        return;
      }
      this.$refs.addaddModal.elDialogShow(2, this.ids[0]);
    },
    handleDelete() {
      const warehouseIds = this.ids;
      if (warehouseIds.length) {
        this.$modal
          .confirm(
            '是否确认删除已选中的数据项?'
          )
          .then(() => {
            this.tabiInfo.tableLoading = true;
        return delWarehouse(warehouseIds);
      }).then(() => {
        this.loading = false;
          })
          .then(() => {
            this.tabiInfo.tableLoading = false;
            this.ids = [];
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
            this.$message({
              message: "删除成功",
              type: "success",
      });
          })
          .catch(() => {})
          .finally(() => {
            this.tabiInfo.tableLoading = false;
          });
      } else {
        this.$message({
          message: "请选择数据",
          type: "warning",
        });
      }
    },
    /** å¯¼å‡ºæŒ‰é’®æ“ä½œ */
    handleExport() {
      this.download('system/warehouse/export', {
        ...this.queryParams
      }, `warehouse_${new Date().getTime()}.xlsx`)
    }
  }
  },
};
</script>
<style lang="less" scoped>
.rowClassName {
  height: 50px;
}
.contbox {
  width: 100;
  height: 100%;
}
</style>
src/views/basicData/warehouse/info.data.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,263 @@
import * as vars from "@/variableSet/columns";
export const columns = [
    {
        label: '编号',
        align: 'left',
        prop: 'lgort',
        width: vars.checkItemNo,
        fixed: 'left',
        tooltip: true,
    },
    {
        label: '名称',
        align: 'left',
        prop: 'warehouseName',
        width: vars.checkItemName,
        fixed: 'left',
    },
    {
        label: '工厂',
        align: 'left',
        prop: 'werks',
        width: vars.checkItemName,
        fixed: 'left',
    },
    {
        label: '类型',
        align: 'left',
        prop: 'type',
        width: vars.checkItemName,
    },
    {
        label: '是否启用',
        prop: 'isUseLocation',
        width: vars.checkType,
        dataType: 'slot',
        slot: 'isUseLocation'
    },
    {
        label: '管理员名称',
        align: 'left',
        prop: 'userName',
        width: vars.checkStandard,
    },
    {
        label: '管理员电话',
        align: 'left',
        prop: 'userPhone',
        width: vars.standardVal,
    },
    {
        label: '坐标X',
        align: 'left',
        prop: 'coordinateX',
        width: vars.standardHigh,
    },
    {
        label: '坐标Y',
        align: 'left',
        prop: 'coordinateY',
        width: vars.standardLow,
    },
    {
        label: '描述',
        align: 'left',
        prop: 'description',
        width: vars.description,
        tooltip: true,
    },
    {
        label: '最后更新人姓名',
        align: 'left',
        prop: 'lastUpdatedUserName',
        width: vars.lastUpdatedUserName,
    },
    {
        label: '最后更新日期时间',
        align: 'left',
        prop: 'lastUpdatedDateTime',
        width: vars.lastUpdatedDateTime,
    },
    {
        dataType: 'option',
        label: '操作',
        width: '80',
        align: 'center',
        fixed: 'right',
        hasPermi: 'iqc_checkItem_check',
        operation: [
            {
                name: '查看',
                size: 'mini',
                plain: true,
                typeText: 4
            }
        ]
    }
];
export const searchFormSchema = [
    // {
    //     field: 'werks',
    //     label: '工厂:',
    //     labelWidth: 80,
    //     component: 'Select',
    //     componentProps: {
    //         placeholder: '请选择',
    //     },
    // },
    {
        field: 'warehouseName',
        label: '名称:',
        labelWidth: 80,
        component: 'Input',
        componentProps: {
            placeholder: '请输入',
        },
    },
    {
        field: 'lgort',
        label: '编号:',
        labelWidth: 80,
        component: 'Input',
        componentProps: {
            placeholder: '请输入',
        },
    },
    // {
    //     field: 'state',
    //     label: '状态:',
    //     labelWidth: 80,
    //     component: 'Select',
    //     componentProps: {
    //         options: [
    //             { label: '启用', value: '1' },
    //             { label: '禁用', value: '0' },
    //         ],
    //     },
    //     multiple: false,
    // },
];
export const formatData = {
    warehouseId: undefined,
    lgort: undefined,
    warehouseName: undefined,
    werks: undefined,
    type: undefined,
    isUseLocation: undefined,
    userId: undefined,
    userPhone: undefined,
    coordinateX: undefined,
    coordinateY: undefined,
    description: undefined,
    state: undefined,
    displayOrder: undefined,
    createdUserId: undefined,
    createdUserName: undefined,
    createdDateTime: undefined,
    lastUpdatedUserId: undefined,
    lastUpdatedUserName: undefined,
    lastUpdatedDateTime: undefined,
    isDeleted: undefined
};
export const formrRquired = {
    warehouseId: [
        { required: true, message: "仓库ID不能为空", trigger: "blur" }
      ],
      lgort: [
        { required: true, message: "仓库编号不能为空", trigger: "blur" }
      ],
      warehouseName: [
        { required: true, message: "名称不能为空", trigger: "blur" }
      ],
      werks: [
        { required: true, message: "工厂不能为空", trigger: "blur" }
      ],
      type: [
        { required: true, message: "类别不能为空", trigger: "change" }
      ],
      // isUseLocation: [
      //   { required: true, message: "0,不启用
      //     1,启用不能为空", trigger: "blur" }
      // ],
      userId: [
        { required: true, message: "管理员ID不能为空", trigger: "blur" }
      ],
      userPhone: [
        { required: true, message: "管理员电话不能为空", trigger: "blur" }
      ],
      coordinateX: [
        { required: true, message: "坐标X不能为空", trigger: "blur" }
      ],
      coordinateY: [
        { required: true, message: "坐标Y不能为空", trigger: "blur" }
      ],
    //   description: [
    //     { required: true, message: "描述不能为空", trigger: "blur" }
    //   ],
    //   state: [
    //     { required: true, message: "状态不能为空", trigger: "blur" }
    //   ],
}
export const formatDataItem = [
    {
        label: "仓库编号",
        prop: 'lgort',
        component: 'input',
        // readonly: true
    },
    {
        label: "名称",
        prop: 'warehouseName',
        component: 'input'
    },
    {
        label: "工厂",
        prop: 'werks',
        component: 'select',
    },
    {
        label: "类型",
        prop: 'type',
        component: 'select'
    },
    {
        label: "是否启用",
        prop: 'isUseLocation',
        component: 'select'
    },
    {
        label: "管理员名称",
        prop: 'userId',
        component: 'input'
    },
    {
        label: "管理员电话",
        prop: 'userPhone',
        component: 'input'
    },
    {
        label: "坐标X",
        prop: 'coordinateX',
        component: 'inputNumber'
    },
    {
        label: "坐标Y",
        prop: 'coordinateY',
        component: 'inputNumber'
    },
    {
        label: "描述",
        prop: 'description',
        component: 'textarea'
    },
]
src/views/basicData/warehouse/linshi.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,425 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
        <el-form-item label="工厂" prop="werks">
        <el-input
          v-model.trim="queryParams.werks"
          placeholder="请输入工厂"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="名称" prop="warehouseName">
        <el-input
          v-model.trim="queryParams.warehouseName"
          placeholder="请输入名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="编号" prop="lgort">
        <el-input
          v-model.trim="queryParams.lgort"
          placeholder="请输入编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="状态" prop="state">
        <el-input
          v-model.trim="queryParams.state"
          placeholder="请输入状态"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:warehouse:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:warehouse:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:warehouse:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:warehouse:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" border :data="warehouseList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column
       label="序号"
      type="index"
      fixed
      width="50" />
      <!-- <el-table-column label="仓库ID" align="center" prop="warehouseId" v-if="true"/> -->
      <el-table-column label="仓库编号" align="center" prop="lgort" />
      <el-table-column label="名称" align="center" prop="warehouseName" />
      <el-table-column label="工厂" align="center" prop="werks" />
      <el-table-column label="类型" align="center" prop="type" />
      <el-table-column label="是否启用" align="center" prop="isUseLocation" >
        <template slot-scope="scope">
           <dict-tag :options="dict.type.isenable" :value="scope.row.isUseLocation"/>
        </template>
      </el-table-column>
      <!-- <el-table-column label="管理员ID" align="center" prop="userId" /> -->
        <el-table-column label="管理员名称" align="center" prop="userName" />
      <el-table-column label="管理员电话" align="center" prop="userPhone" />
      <el-table-column label="坐标X" align="center" prop="coordinateX" />
      <el-table-column label="坐标Y" align="center" prop="coordinateY" />
      <el-table-column label="描述" align="center" prop="description" />
      <!-- <el-table-column label="状态" align="center" prop="state" /> -->
      <el-table-column label="最后更新人id" align="center" prop="lastUpdatedUserId" />
      <el-table-column label="最后更新人姓名" align="center" prop="lastUpdatedUserName" />
      <el-table-column label="最后更新时间" align="center" prop="lastUpdatedDateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdatedDateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:warehouse:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:warehouse:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- æ·»åŠ æˆ–修改仓库对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="仓库编号" prop="lgort">
          <el-input v-model.trim="form.lgort" placeholder="请输入仓库编号" />
        </el-form-item>
        <el-form-item label="名称" prop="warehouseName">
          <el-input v-model.trim="form.warehouseName" placeholder="请输入名称" />
        </el-form-item>
        <el-form-item label="工厂" prop="werks">
          <el-input v-model.trim="form.werks" placeholder="请输入工厂" />
        </el-form-item>
          <el-form-item label="类别" prop="type">
          <el-input v-model.trim="form.type" placeholder="请输入类别" />
        </el-form-item>
        <el-form-item label="是否启用" prop="isUseLocation">
          <!-- <el-input v-model.trim="form.isUseLocation" placeholder="请输入0,不启用
            1,启用" /> -->
                  <el-select v-model="form.isUseLocation" placeholder="是否启用" clearable>
            <el-option
              v-for="dict in dict.type.isenable"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="管理员名称" prop="userId">
          <el-input v-model.trim="form.userName" placeholder="请输入管理员名称" />
        </el-form-item>
        <el-form-item label="管理员电话" prop="userPhone">
          <el-input v-model.trim="form.userPhone" placeholder="请输入管理员电话" />
        </el-form-item>
        <el-form-item label="坐标X" prop="coordinateX">
          <el-input v-model.trim="form.coordinateX" placeholder="请输入坐标X" />
        </el-form-item>
        <el-form-item label="坐标Y" prop="coordinateY">
          <el-input v-model.trim="form.coordinateY" placeholder="请输入坐标Y" />
        </el-form-item>
        <el-form-item label="描述" prop="description">
          <el-input v-model.trim="form.description" placeholder="请输入描述" />
        </el-form-item>
        <!-- <el-form-item label="状态" prop="state">
          <el-input v-model.trim="form.state" placeholder="请输入状态" />
        </el-form-item> -->
        <!-- <el-form-item label="最后更新人id" prop="lastUpdatedUserId">
          <el-input v-model.trim="form.lastUpdatedUserId" placeholder="请输入最后更新人id" />
        </el-form-item>
        <el-form-item label="最后更新人姓名" prop="lastUpdatedUserName">
          <el-input v-model.trim="form.lastUpdatedUserName" placeholder="请输入最后更新人姓名" />
        </el-form-item>
        <el-form-item label="最后更新时间" prop="lastUpdatedDateTime">
          <el-date-picker clearable
            v-model="form.lastUpdatedDateTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择最后更新时间">
          </el-date-picker>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">ç¡® å®š</el-button>
        <el-button @click="cancel">取 æ¶ˆ</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listWarehouse, getWarehouse, delWarehouse, addWarehouse, updateWarehouse } from "@/api/basicData/warehouse";
export default {
  name: "Warehouse",
    dicts: ['isenable'],
  data() {
    return {
      // æŒ‰é’®loading
      buttonLoading: false,
      // é®ç½©å±‚
      loading: true,
      // é€‰ä¸­æ•°ç»„
      ids: [],
      // éžå•ä¸ªç¦ç”¨
      single: true,
      // éžå¤šä¸ªç¦ç”¨
      multiple: true,
      // æ˜¾ç¤ºæœç´¢æ¡ä»¶
      showSearch: true,
      // æ€»æ¡æ•°
      total: 0,
      // ä»“库表格数据
      warehouseList: [],
      // å¼¹å‡ºå±‚标题
      title: "",
      // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚
      open: false,
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        warehouseName: undefined,
        werks: undefined,
        type: undefined,
        state: undefined,
      },
      // è¡¨å•å‚æ•°
      form: {},
      // è¡¨å•æ ¡éªŒ
      rules: {
        warehouseId: [
          { required: true, message: "仓库ID不能为空", trigger: "blur" }
        ],
        lgort: [
          { required: true, message: "仓库编号不能为空", trigger: "blur" }
        ],
        warehouseName: [
          { required: true, message: "名称不能为空", trigger: "blur" }
        ],
        werks: [
          { required: true, message: "工厂不能为空", trigger: "blur" }
        ],
        type: [
          { required: true, message: "类别不能为空", trigger: "change" }
        ],
        // isUseLocation: [
        //   { required: true, message: "0,不启用
        //     1,启用不能为空", trigger: "blur" }
        // ],
        userId: [
          { required: true, message: "管理员ID不能为空", trigger: "blur" }
        ],
        userPhone: [
          { required: true, message: "管理员电话不能为空", trigger: "blur" }
        ],
        coordinateX: [
          { required: true, message: "坐标X不能为空", trigger: "blur" }
        ],
        coordinateY: [
          { required: true, message: "坐标Y不能为空", trigger: "blur" }
        ],
        description: [
          { required: true, message: "描述不能为空", trigger: "blur" }
        ],
        state: [
          { required: true, message: "状态不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** æŸ¥è¯¢ä»“库列表 */
    getList() {
      this.loading = true;
      listWarehouse(this.queryParams).then(response => {
        this.warehouseList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // å–消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // è¡¨å•é‡ç½®
    reset() {
      this.form = {
        warehouseId: undefined,
        lgort: undefined,
        warehouseName: undefined,
        werks: undefined,
        type: undefined,
        isUseLocation: undefined,
        userId: undefined,
        userPhone: undefined,
        coordinateX: undefined,
        coordinateY: undefined,
        description: undefined,
        state: undefined,
        displayOrder: undefined,
        createdUserId: undefined,
        createdUserName: undefined,
        createdDateTime: undefined,
        lastUpdatedUserId: undefined,
        lastUpdatedUserName: undefined,
        lastUpdatedDateTime: undefined,
        isDeleted: undefined
      };
      this.resetForm("form");
    },
    /** æœç´¢æŒ‰é’®æ“ä½œ */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** é‡ç½®æŒ‰é’®æ“ä½œ */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // å¤šé€‰æ¡†é€‰ä¸­æ•°æ®
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.warehouseId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** æ–°å¢žæŒ‰é’®æ“ä½œ */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加仓库";
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const warehouseId = row.warehouseId || this.ids
      getWarehouse(warehouseId).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改仓库";
      });
    },
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.warehouseId != null) {
            updateWarehouse(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addWarehouse(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    handleDelete(row) {
      const warehouseIds = row.warehouseId || this.ids;
      this.$modal.confirm('是否确认删除仓库编号为"' + warehouseIds + '"的数据项?').then(() => {
        this.loading = true;
        return delWarehouse(warehouseIds);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** å¯¼å‡ºæŒ‰é’®æ“ä½œ */
    handleExport() {
      this.download('system/warehouse/export', {
        ...this.queryParams
      }, `warehouse_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>