hdy
2024-03-16 406ad2e52a8963f1748c399b0da9dfae8cd58b49
提交 | 用户 | 时间
b5450a 1 <template>
H 2   <el-dialog title="设备选择"
3              v-if="showFlag"
4              :visible.sync="showFlag"
5              :modal= false
6              width="80%"
7              center
8   >
9     <el-row :gutter="20">
10       <!--设备数据-->
11       <el-col :span="20" :xs="24">
12         <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
13           <el-form-item label="设备编码" prop="machineryCode">
14             <el-input
15               v-model="queryParams.equipmentCode"
16               placeholder="请输入设备编码"
17               clearable
18               style="width: 240px"
19               @keyup.enter.native="handleQuery"
20             />
21           </el-form-item>
22           <el-form-item label="设备名称" prop="machineryName">
23             <el-input
24               v-model="queryParams.equipmentName"
25               placeholder="请输入设备名称"
26               clearable
27               style="width: 240px"
28               @keyup.enter.native="handleQuery"
29             />
30           </el-form-item>
31           <el-form-item>
32             <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
33             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
34           </el-form-item>
35         </el-form>
36         <el-table v-loading="loading" :data="machineryList" @selection-change="handleSelectionChange">
37           <el-table-column type="selection" width="50" align="center" />
38           <el-table-column label="设备编码"  align="center"  prop="equipmentCode"/>
39           <el-table-column label="设备名称"  align="center"  prop="equipmentName"  />
40           <el-table-column label="品牌" align="center"  prop="equipmentBrand" />
41           <el-table-column label="规格型号" align="center"  prop="equipmentSpec" />
42           <el-table-column label="创建时间" align="center" prop="createTime" width="160">
43             <template slot-scope="scope">
44               <span>{{ parseTime(scope.row.createTime) }}</span>
45             </template>
46           </el-table-column>
47         </el-table>
48
49         <pagination
50           v-show="total>0"
51           :total="total"
52           :page.sync="queryParams.pageNum"
53           :limit.sync="queryParams.pageSize"
54           @pagination="getList"
55         />
56       </el-col>
57     </el-row>
58     <div slot="footer" class="dialog-footer">
59       <el-button type="primary" @click="confirmSelect">确 定</el-button>
60       <el-button @click="showFlag=false">取 消</el-button>
61     </div>
62   </el-dialog>
63 </template>
64
65 <script>
66
67 import { listEquipmentArchives, getEquipmentArchives, delEquipmentArchives, addEquipmentArchives, updateEquipmentArchives } from "@/api/main/em/equipmentArchives/equipmentArchives";
68
69
70 export default {
71   name: "MachinerySelect",
72   dicts: ['sys_yes_no','mes_machinery_status'],
73   components: {  },
74   data() {
75     return {
76       showFlag: false,
77       // 遮罩层
78       loading: true,
79       // 选中数组
80       ids: [],
81       selectedRows: [],
82       // 非单个禁用
83       single: true,
84       // 非多个禁用
85       multiple: true,
86       // 显示搜索条件
87       showSearch: true,
88       // 总条数
89       total: 0,
90       // 物料产品表格数据
91       machineryList: [],
92       // 弹出层标题
93       title: "",
94       // 设备类型树选项
95       machineryTypeOptions: [],
96       //车间选项
97       workshopOptions:[],
98       // 是否显示弹出层
99       open: false,
100       //自动生成物料编码标识
101       autoGenFlag: false,
102       // 表单参数
103       form: {},
104       defaultProps: {
105         children: "children",
106       },
107       // 查询参数
108       queryParams: {
109         pageNum: 1,
110         pageSize: 10,
111         equipmentCode: null,
112         equipmentName: null,
113         equipmentBrand: null,
114         equipmentSpec: null,
115         workshopId: null,
116         workshopCode: null,
117         workshopName: null,
118         status: null
119       }
120     };
121   },
122   created() {
123     this.getList();
124   },
125   methods: {
126     /** 查询物料编码列表 */
127     getList() {
128       this.loading = true;
129       listEquipmentArchives(this.queryParams).then(response => {
130           this.machineryList = response.rows;
131           this.total = response.total;
132           this.loading = false;
133         },
134       );
135     },
136     /** 搜索按钮操作 */
137     handleQuery() {
138       this.queryParams.pageNum = 1;
139       this.getList();
140     },
141     /** 重置按钮操作 */
142     resetQuery() {
143       this.resetForm("queryForm");
144       this.handleQuery();
145     },
146     // 多选框选中数据
147     handleSelectionChange(selection) {
148       this.ids = selection.map(item => item.machineryId);
149       this.selectedRows = selection;
150       this.single = selection.length != 1;
151       this.multiple = !selection.length;
152     },
153     //确定选中
154     confirmSelect(){
155       if(this.ids ==[] || this.ids.length==0){
156         this.$notify({
157           title:'提示',
158           type:'warning',
159           message: '请至少选择一条数据!'
160         });
161         return;
162       }
163       this.$emit('onSelected',this.selectedRows);
164       this.showFlag = false;
165     }
166   }
167 };
168 </script>