hdy
2024-03-26 adb3b5b9edf8db637b82705f4512538de4b8137d
提交 | 用户 | 时间
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       open: false,
96       //自动生成物料编码标识
97       autoGenFlag: false,
98       // 表单参数
99       form: {},
100       // 查询参数
101       queryParams: {
102         pageNum: 1,
103         pageSize: 10,
104         equipmentCode: null,
105         equipmentName: null,
106         equipmentBrand: null,
107         equipmentSpec: null,
108         workshopId: null,
109         workshopCode: null,
110         workshopName: null,
111         status: null
112       }
113     };
114   },
115   created() {
116     this.getList();
117   },
118   methods: {
119     /** 查询物料编码列表 */
120     getList() {
121       this.loading = true;
122       listEquipmentArchives(this.queryParams).then(response => {
123           this.machineryList = response.rows;
124           this.total = response.total;
125           this.loading = false;
126         },
127       );
128     },
129     /** 搜索按钮操作 */
130     handleQuery() {
131       this.queryParams.pageNum = 1;
132       this.getList();
133     },
134     /** 重置按钮操作 */
135     resetQuery() {
136       this.resetForm("queryForm");
137       this.handleQuery();
138     },
139     // 多选框选中数据
140     handleSelectionChange(selection) {
c92f19 141       this.ids = selection.map(item => item.subjectId);
b5450a 142       this.selectedRows = selection;
H 143       this.single = selection.length != 1;
144       this.multiple = !selection.length;
145     },
146     //确定选中
147     confirmSelect(){
148       if(this.ids ==[] || this.ids.length==0){
149         this.$notify({
150           title:'提示',
151           type:'warning',
152           message: '请至少选择一条数据!'
153         });
154         return;
155       }
156       this.$emit('onSelected',this.selectedRows);
157       this.showFlag = false;
158     }
159   }
160 };
161 </script>