cl
2024-07-04 5b544fc8d6029a71669b3992c5cfea9a044aaf3f
提交 | 用户 | 时间
0ca254 1 <template>
A 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="dvsubjectList" @selection-change="handleSelectionChange">
37           <el-table-column type="selection" width="55" align="center" />
38           <el-table-column label="项目名称" align="center" prop="itemsName">
39           </el-table-column>
40           <el-table-column label="项目编号" align="center" prop="itemsCode">
41           </el-table-column>
42           <el-table-column label="项目类型" align="center" prop="itemsType">
43             <template slot-scope="scope">
44               <dict-tag :options="dict.type.spotmaintenance" :value="scope.row.itemsType"/>
45             </template>
46           </el-table-column>
47           <el-table-column label="项目内容" align="center" prop="itemsContent">
48           </el-table-column>
49           <el-table-column label="标准" align="center" prop="standard">
50           </el-table-column>
51           <el-table-column label="创建人" align="center" prop="createUser">
52           </el-table-column>
53           <el-table-column label="创建时间" align="center" prop="createTime">
54           </el-table-column>
55           <el-table-column label="更新人" align="center" prop="updateUser">
56           </el-table-column>
57           <el-table-column label="更新时间" align="center" prop="updateTime">
58           </el-table-column>
59         </el-table>
60
61         <pagination
62           v-show="total>0"
63           :total="total"
64           :page.sync="queryParams.pageNum"
65           :limit.sync="queryParams.pageSize"
66           @pagination="getList"
67         />
68       </el-col>
69     </el-row>
70     <div slot="footer" class="dialog-footer">
71       <el-button type="primary" @click="confirmSelect">确 定</el-button>
72       <el-button @click="showFlag=false">取 消</el-button>
73     </div>
74   </el-dialog>
75 </template>
76
77 <script>
78
79 import { listInspectionItems, getInspectionItems, delInspectionItems, addInspectionItems, updateInspectionItems } from "@/api/main/em/inspectionItems/inspectionItems";
80
81
82 export default {
83   name: "DvsubjectSelect",
84   dicts: ['sys_yes_no','mes_machinery_status','spotmaintenance'],
85   components: {  },
86   data() {
87     return {
88       showFlag:false,
89       // 遮罩层
90       loading: true,
91       // 选中数组s
92       ids: [],
93       // 非单个禁用
94       single: true,
95       // 非多个禁用
96       multiple: true,
97       // 显示搜索条件
98       showSearch: true,
99       // 总条数
100       total: 0,
101       // 设备点检保养项目表格数据
102       dvsubjectList: [],
103       // 弹出层标题
104       title: "",
105       // 是否显示弹出层
106       open: false,
107       // 查询参数
108       queryParams: {
109         pageNum: 1,
110         pageSize: 10,
111         itemsCode: null,
112         itemsName: null,
113         itemsType: null,
114         standard: null,
115         itemsContent: null,
116       }
117     };
118   },
119   created() {
120     this.getList();
121   },
122   methods: {
123     /** 查询点检项目列表 */
124     getList() {
125       this.loading = true;
126       listInspectionItems(this.queryParams).then(response => {
127           this.dvsubjectList = response.rows;
128           this.total = response.total;
129           this.loading = false;
130
131         },
132       );
133     },
134     /** 搜索按钮操作 */
135     handleQuery() {
136       this.queryParams.pageNum = 1;
137       this.getList();
138     },
139     /** 重置按钮操作 */
140     resetQuery() {
141       this.resetForm("queryForm");
142       this.handleQuery();
143     },
144     // 多选框选中数据
145     handleSelectionChange(selection) {
146       this.ids = selection.map(item => item.machineryId);
147       this.selectedRows = selection;
148       this.single = selection.length != 1;
149       this.multiple = !selection.length;
150     },
151     //确定选中
152     confirmSelect(){
153       if(this.ids ==[] || this.ids.length==0){
154         this.$notify({
155           title:'提示',
156           type:'warning',
157           message: '请至少选择一条数据!'
158         });
159         return;
160       }
161       this.$emit('onSelected',this.selectedRows);
162       this.showFlag = false;
163     }
164   }
165 };
166 </script>