yangfeng
2024-03-01 15c2636bb7cd4ae729c1cfd4c11f1324a9cd04f1
src/views/productManage/productRegisterForm/index.vue
@@ -3,25 +3,107 @@
    <div class="filter-card">
      <CommonSearch :show-add="false" :amount-view="false" placeholder="请输入关键词" @searchClick="onFilterSearch">
        <template slot="leftButton">
          <el-button size="small" type="primary" @click="addBtnClick">新建</el-button>
          <el-button size="small" type="primary" @click="addBtnClick">新增</el-button>
        </template>
      </CommonSearch>
    </div>
    <div class="body-card">
      <div class="list-view">
        <TableCommonView ref="tableListRef" v-loading="loading" :table-list="tableList" @selTableCol="selTableCol">
          <template slot="tableButton">
            <el-table-column label="操作" width="180">
              <template slot-scope="scope">
                <el-button @click="viewClick(scope.row)" type="text" size="small">查看</el-button>
                <el-button @click="editClick(scope.row)" type="text" size="small">编辑</el-button>
                <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button>
              </template>
            </el-table-column>
          </template>
        </TableCommonView>
      </div>
      <div class="btn-pager">
        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
      </div>
    </div>
  </div>
</template>
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
  name: "productRegisterForm",
  props: {},
  components: {},
  mixins: [],
  mixins: [pageMixin],
  computed: {},
  data() {
    return {}
    return {
      loading: false,
      tableList: {},
      tableColumn: [
        { label: "编号", prop: "name", min: 100, default: true },
        { label: "生产时间", prop: "member_name" },
        { label: "车组", prop: "client_level" },
        { label: "规格", prop: "next_visit_time", min: 90 },
        { label: "车间", prop: "detail_address", min: 200 },
        { label: "庄口", prop: "client_status" },
        { label: "回数", prop: "contact_name", isContactClick: true },
        { label: "车组总产量", prop: "contact_phone" }
      ],
      showCol: ["编号", "生产时间", "车组", "规格", "车间", "庄口", "回数", "车组总产量"]
    }
  },
  created() {},
  methods: {}
  created() {
    this.setTable()
  },
  methods: {
    setTable() {
      this.tableList = {
        selectIndex: true,
        tableInfomation: [],
        allcol: [],
        showcol: this.showCol,
        tableColumn: this.setColumnVisible(this.showCol)
      }
      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++) {
        const label = this.tableList.tableColumn[i].label
        const value = this.tableList.tableColumn[i].prop
        this.searchOptions.push({ value: value, label: label })
      }
    },
    setColumnVisible(showCol) {
      return this.tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn: showCol.includes(ele.label)
        }
      })
    },
    selTableCol(val) {
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
    // 搜索
    onFilterSearch(searchText) {
      console.log(searchText)
    },
    // 新增
    addBtnClick() {},
    // 查看
    viewClick(row) {
      console.log(row)
    },
    // 编辑
    editClick(row) {
      console.log(row)
    },
    // 删除
    delClick(row) {
      console.log(row)
    }
  }
}
</script>
@@ -37,5 +119,10 @@
    border-radius: 12px;
    background-color: #fff;
  }
  .body-card {
    margin: 0 30px;
    background-color: #fff;
    padding: 10px 15px;
  }
}
</style>