hdy
2 天以前 1c50cb5546715fa21496fbdf2bdacb7ae8836b8a
提交 | 用户 | 时间
dea0a3 1 <template>
d6049c 2   <el-dialog :title="title" :visible.sync="visible" width="1000px" @close="handleClose">
A 3     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
4       <el-form-item label="物料编号" prop="materialCode">
5         <el-input
6           v-model="queryParams.materialCode"
7           placeholder="请输入物料编号"
8           clearable
9           @keyup.enter.native="handleQuery"
10         />
11       </el-form-item>
12       <el-form-item label="物料名称" prop="materialName">
13         <el-input
14           v-model="queryParams.materialName"
15           placeholder="请输入物料名称"
16           clearable
17           @keyup.enter.native="handleQuery"
18         />
19       </el-form-item>
20       <el-form-item style="float: right">
21         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
22       </el-form-item>
23     </el-form>
24     <el-table border ref="multipleTable" v-loading="loading" :data="materialInfoList" @selection-change="handleSelectionChange">
25       <el-table-column type="selection" width="55" align="center" />
26       <el-table-column :show-overflow-tooltip="true" label="物料编号" align="center" prop="materialCode" />
27       <el-table-column :show-overflow-tooltip="true" label="物料名称" align="center" prop="materialName" />
28       <el-table-column :show-overflow-tooltip="true" label="视图" align="center" prop="materialView" />
29       <el-table-column label="种类" align="center" prop="typeZ">
30         <template slot-scope="scope">
31           <dict-tag :options="dict.type.type_z" :value="scope.row.typeZ"/>
32         </template>
33       </el-table-column>
34       <el-table-column label="类型" align="center" prop="typeL">
35         <template slot-scope="scope">
36           <dict-tag :options="dict.type.type_l" :value="scope.row.typeL"/>
37         </template>
38       </el-table-column>
39       <el-table-column label="单位" align="center" prop="unit">
40         <template slot-scope="scope">
41           <dict-tag :options="dict.type.unit" :value="scope.row.unit"/>
42         </template>
43       </el-table-column>
44       <el-table-column :show-overflow-tooltip="true" label="版本" align="center" prop="version" />
45       <el-table-column label="状态" align="center" prop="status">
46         <template slot-scope="scope">
47           <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
48         </template>
49       </el-table-column>
50       <el-table-column :show-overflow-tooltip="true" label="厂商" align="center" prop="supplier" />
51       <el-table-column :show-overflow-tooltip="true" label="备注" align="center" prop="remark" />
52       <el-table-column :show-overflow-tooltip="true" label="数据来源" align="center" prop="dataSource" />
53       <el-table-column :show-overflow-tooltip="true" label="创建用户" align="center" prop="createBy" />
54       <el-table-column label="创建时间" align="center" prop="createTime" width="180">
55       </el-table-column>
56       <el-table-column :show-overflow-tooltip="true" label="更改用户" align="center" prop="updateBy" />
57       <el-table-column label="更改时间" align="center" prop="updateTime" width="180">
58       </el-table-column>
dea0a3 59     </el-table>
d6049c 60
A 61     <pagination
62       v-show="total>0"
63       :total="total"
64       :page.sync="queryParams.pageNum"
65       :limit.sync="queryParams.pageSize"
66       @pagination="getList"
67     />
dea0a3 68     <div slot="footer" class="dialog-footer">
A 69       <el-button @click="handleClose">取 消</el-button>
70       <el-button type="primary" @click="confirmSelection">确 定</el-button>
71     </div>
72   </el-dialog>
73 </template>
74
75 <script>
d6049c 76 import {listMaterialInfo} from "@/api/main/bs/materialInfo";
A 77
dea0a3 78 export default {
A 79   name: "ProductSelector",
d6049c 80   dicts: ['sys_normal_disable', 'type_l', 'unit', 'type_z'],
dea0a3 81   props: {
A 82     visible: Boolean,
83     title: {
84       type: String,
85       default: "物料信息"
86     },
87     gridData: Array
88   },
89   data() {
90     return {
d6049c 91       // 总条数
A 92       total: 0,
93       // 物料信息表格数据
94       materialInfoList: [],
95       // 遮罩层
96       loading: true,
97       showSearch: true,
98       multipleSelection: [],
99       // 查询参数
100       queryParams: {
101         pageNum: 1,
102         pageSize: 10,
103         materialCode: null,
104         materialName: null,
105         materialView: null,
106         typeZ: null,
107         typeL: null,
108         unit: null,
109         status: null,
110       },
dea0a3 111     };
A 112   },
d6049c 113   created() {
A 114     this.getList();
115   },
dea0a3 116   methods: {
d6049c 117     /** 查询物料信息列表 */
A 118     getList() {
119       this.loading = true;
120       listMaterialInfo(this.queryParams).then(response => {
121         this.materialInfoList = response.rows;
122         this.total = response.total;
123         this.loading = false;
124       });
125     },
126     /** 搜索按钮操作 */
127     handleQuery() {
128       this.queryParams.pageNum = 1;
129       this.getList();
130     },
dea0a3 131     handleClose() {
A 132       this.$emit('update:visible', false);
133     },
d6049c 134     handleSelectionChange(selection) {
dea0a3 135       if (selection.length > 1) {
A 136         this.$refs.multipleTable.clearSelection();
137         this.$refs.multipleTable.toggleRowSelection(selection[selection.length - 1], true);
138         this.multipleSelection = [selection[selection.length - 1]];
139       } else {
140         this.multipleSelection = selection;
141       }
142     },
143     confirmSelection() {
144       if (this.multipleSelection.length > 0) {
145         this.$emit('select-product', this.multipleSelection[0]);
146         this.handleClose();
d6049c 147         this.$refs.multipleTable.clearSelection();
dea0a3 148       } else {
A 149         this.$message({
150           message: '警告哦,未选择任何行',
151           type: 'warning'
152         });
153       }
154     }
155   }
156 };
157 </script>