yangfeng
2023-11-02 583f5b77640b5dbf7e593e89a0d660f4cacacbe9
src/views/productManage/product/index.vue
@@ -2,25 +2,14 @@
  <div class="product-manage">
    <div class="filter">
      <div class="filter-card">
<!--              <SearchCommonView-->
<!--                  ref="searchCommonView"-->
<!--                  :search-options="searchOptions"-->
<!--                  @searchClick="searchClick"-->
<!--                  @resetClick="resetClick"-->
<!--              />-->
        <CommonSearch
          :show-add="false"
          :show-download="false"
          :show-download="true"
          :amount-view="false"
          :show-action-btn="false"
          :placeholder="'请输入产品名称/供应商'"
          @searchClick="onFilterSearch"
        />
        <div class="add-view">
          <!--           <el-button type="primary" size="mini" @click="addBtnClick">新建</el-button>-->
        </div>
      </div>
    </div>
    <div class="body">
@@ -46,7 +35,6 @@
          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
        </div>
      </div>
    </div>
    <!-- 新建/编辑产品 -->
    <AddProduct v-if="editConfig.visible" :add-common-config="editConfig" />
@@ -69,7 +57,7 @@
  computed: {},
  data() {
    return {
      searchText:'',
      searchText: "",
      tableList: {},
      searchOptions: [],
      commonDetail: {
@@ -84,7 +72,7 @@
      },
      tableColumn: [
        { label: "产品编码", prop: "number", min: 190, isCommonClick: true },
        { label: "产品名称", prop: "name", min: 130 ,default:true},
        { label: "产品名称", prop: "name", min: 130, default: true },
        { label: "供应商", prop: "supplierName", min: 130 },
        { label: "产品类别", prop: "productType", min: 130 },
        { label: "规格", prop: "specifications", min: 130 },
@@ -94,7 +82,7 @@
        { label: "最低库存", prop: "minimumStock", min: 80 },
        { label: "最高库存", prop: "maximumStock", min: 80 }
      ],
      showCol: ['产品编码', '产品名称', '供应商', '产品类别', '规格', '价格', '最低库存', '最高库存']
      showCol: ["产品编码", "产品名称", "供应商", "产品类别", "规格", "价格", "最低库存", "最高库存"]
    }
  },
  created() {
@@ -102,11 +90,11 @@
    this.getData()
  },
  methods: {
    setColumnVisible(showCol){
      return  this.tableColumn.map(ele=>{
    setColumnVisible(showCol) {
      return this.tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn:showCol.includes(ele.label)
          isShowColumn: showCol.includes(ele.label)
        }
      })
    },
@@ -116,9 +104,9 @@
        selectIndex: true,
        showcol: this.showCol,
        allcol: [],
        tableColumn:this.setColumnVisible(this.showCol)
        tableColumn: this.setColumnVisible(this.showCol)
      }
      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
      this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
      this.searchOptions = []
      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
@@ -128,8 +116,8 @@
      }
    },
    selTableCol(val) {
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
    // 请求数据
    async getData() {
@@ -156,8 +144,8 @@
    //   this.getData(val.value, content)
    // },
    onFilterSearch(val){
      this.searchText = val ?? ''
    onFilterSearch(val) {
      this.searchText = val ?? ""
      this.pagerOptions.currPage = 1
      this.getData()
    },
@@ -208,15 +196,15 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.product-manage{
.product-manage {
  height: 100%;
  overflow: hidden;
  .filter{
  .filter {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 12px 20px 0 20px;
    &-card{
    &-card {
      height: 80px;
      display: flex;
      align-items: center;
@@ -227,7 +215,7 @@
      background-color: #fff;
    }
  }
  .body{
  .body {
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 12px;