yangfeng
2023-08-28 6e84763437df97e194f8c833feca8bdcb90e7103
src/views/supplierManage/supplier/index.vue
@@ -13,28 +13,49 @@
        </div>
      </div>
      <template>
        <TableCommonView
          ref="tableListRef"
          :table-list="tableList"
          @selCommonClick="selCommonClick"
          @tableRowClick="tableRowClick"
        <el-table
          ref="tableSupplier"
          border
          :data="tableList.tableInfomation"
          tooltip-effect="dark"
          style="width: 100%"
          :lazy="tableList.lazy"
          highlight-current-row
          @row-click="tableRowClick"
          :header-cell-style="{ background: '#ECF4FF', color: '#666' }"
        >
          <template slot="tableButton">
            <el-table-column label="操作" width="120">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.status === 0"
                  @click="enableClick(scope.row, '启用')"
                  type="text"
                  size="small"
                  >启用</el-button
                >
                <el-button v-else @click="enableClick(scope.row, '停用')" type="text" size="small">停用</el-button>
                <el-button @click="modifyClick(scope.row)" type="text" size="small">修改</el-button>
              </template>
            </el-table-column>
          </template>
        </TableCommonView>
          <el-table-column type="index" label="序号" width="50"> </el-table-column>
          <el-table-column
            v-for="(item, i) in tableList.tableColumn"
            :key="i"
            :prop="item.prop"
            :label="item.label"
            :width="item.width"
            :min-width="item.min"
            show-overflow-tooltip
            :sortable="item.sortable"
          >
            <template slot-scope="scope">
              <div v-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div>
              <span
                v-else-if="item.isCommonClick && scope.row[item.prop]"
                class="sel-name"
                @click="selCommonClick(scope.row)"
                >{{ scope.row[item.prop] }}</span
              >
              <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="100">
            <template slot-scope="scope">
              <el-button v-if="scope.row.status === 0" @click="enableClick(scope.row, '启用')" type="text" size="small"
                >启用</el-button
              >
              <el-button v-else @click="enableClick(scope.row, '停用')" type="text" size="small">停用</el-button>
              <el-button @click="modifyClick(scope.row)" type="text" size="small">修改</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="btn-pager">
          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
        </div>
@@ -215,6 +236,9 @@
          } else {
            this.supplierId = 0
          }
          this.$nextTick(() => {
            this.$refs.tableSupplier.setCurrentRow(this.tableList.tableInfomation[0])
          })
          this.getProductList()
        }
      })
@@ -274,7 +298,6 @@
    },
    // 修改供应商
    modifyClick(row) {
      console.log(row)
      this.editConfig.visible = true
      this.editConfig.title = "修改"
      this.editConfig.infomation = { ...row }
@@ -289,12 +312,14 @@
    addNewProductClick() {
      this.newProductConfig.visible = true
      this.newProductConfig.title = "添加"
      this.newProductConfig.infomation = { supplierId: this.supplierId }
    },
    // 修改产品
    editClick(row) {
      console.log(row)
      this.newProductConfig.visible = true
      // this.newProductConfig.title = "修改"
      this.newProductConfig.title = "修改"
      this.newProductConfig.infomation = { ...row }
    },
    // 删除
    delClick(row) {
@@ -352,6 +377,10 @@
        margin-right: 20px;
      }
    }
    .sel-name {
      color: $color-primary;
      cursor: pointer;
    }
    .btn-pager {
      display: flex;
      .page {