hdy
7 天以前 b9df2fc5c64a1d989991655a9e42e4d1f2ec4075
billion-ui/src/views/main/bs/routeInfo/ProductSelector.vue
@@ -1,11 +1,70 @@
<template>
  <el-dialog :title="title" :visible.sync="visible" @close="handleClose">
    <el-table :data="gridData" selection="single" ref="multipleTable" @selection-change="productSelectionChange">
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column property="date" label="日期" width="150"></el-table-column>
      <el-table-column property="name" label="姓名" width="200"></el-table-column>
      <el-table-column property="address" label="地址"></el-table-column>
  <el-dialog :title="title" :visible.sync="visible" width="1000px" @close="handleClose">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="物料编号" prop="materialCode">
        <el-input
          v-model="queryParams.materialCode"
          placeholder="请输入物料编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料名称" prop="materialName">
        <el-input
          v-model="queryParams.materialName"
          placeholder="请输入物料名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item style="float: right">
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      </el-form-item>
    </el-form>
    <el-table border ref="multipleTable" v-loading="loading" :data="materialInfoList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column :show-overflow-tooltip="true" label="物料编号" align="center" prop="materialCode" />
      <el-table-column :show-overflow-tooltip="true" label="物料名称" align="center" prop="materialName" />
      <el-table-column :show-overflow-tooltip="true" label="视图" align="center" prop="materialView" />
      <el-table-column label="种类" align="center" prop="typeZ">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.type_z" :value="scope.row.typeZ"/>
        </template>
      </el-table-column>
      <el-table-column label="类型" align="center" prop="typeL">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.type_l" :value="scope.row.typeL"/>
        </template>
      </el-table-column>
      <el-table-column label="单位" align="center" prop="unit">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.unit" :value="scope.row.unit"/>
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" label="版本" align="center" prop="version" />
      <el-table-column label="状态" align="center" prop="status">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" label="厂商" align="center" prop="supplier" />
      <el-table-column :show-overflow-tooltip="true" label="备注" align="center" prop="remark" />
      <el-table-column :show-overflow-tooltip="true" label="数据来源" align="center" prop="dataSource" />
      <el-table-column :show-overflow-tooltip="true" label="创建用户" align="center" prop="createBy" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" label="更改用户" align="center" prop="updateBy" />
      <el-table-column label="更改时间" align="center" prop="updateTime" width="180">
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <div slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取 消</el-button>
      <el-button type="primary" @click="confirmSelection">确 定</el-button>
@@ -14,8 +73,11 @@
</template>
<script>
import {listMaterialInfo} from "@/api/main/bs/materialInfo";
export default {
  name: "ProductSelector",
  dicts: ['sys_normal_disable', 'type_l', 'unit', 'type_z'],
  props: {
    visible: Boolean,
    title: {
@@ -26,14 +88,50 @@
  },
  data() {
    return {
      multipleSelection: []
      // 总条数
      total: 0,
      // 物料信息表格数据
      materialInfoList: [],
      // 遮罩层
      loading: true,
      showSearch: true,
      multipleSelection: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        materialCode: null,
        materialName: null,
        materialView: null,
        typeZ: null,
        typeL: null,
        unit: null,
        status: null,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询物料信息列表 */
    getList() {
      this.loading = true;
      listMaterialInfo(this.queryParams).then(response => {
        this.materialInfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    handleClose() {
      this.$emit('update:visible', false);
    },
    productSelectionChange(selection) {
    handleSelectionChange(selection) {
      if (selection.length > 1) {
        this.$refs.multipleTable.clearSelection();
        this.$refs.multipleTable.toggleRowSelection(selection[selection.length - 1], true);
@@ -46,6 +144,7 @@
      if (this.multipleSelection.length > 0) {
        this.$emit('select-product', this.multipleSelection[0]);
        this.handleClose();
        this.$refs.multipleTable.clearSelection();
      } else {
        this.$message({
          message: '警告哦,未选择任何行',