-
admin
2024-05-14 616f9896be815a60b5c4063116b7d138892dcfaf
提交 | 用户 | 时间
523903 1 <template>
2   <div class="app-container">
3     <el-card class="box-card">
4         <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
5           <el-form-item label="项目编号" prop="itemsCode">
6             <el-input
7               v-model="queryParams.itemsCode"
8               placeholder="请输入项目编号"
9               clearable
10               @keyup.enter.native="handleQuery"
11             />
12           </el-form-item>
13           <el-form-item label="项目名称" prop="itemsName">
14             <el-input
15               v-model="queryParams.itemsName"
16               placeholder="请输入项目名称"
17               clearable
18               @keyup.enter.native="handleQuery"
19             />
20           </el-form-item>
21 <!--          <el-form-item label="项目类型" prop="itemsType">-->
22 <!--            <el-select v-model="queryParams.itemsType" placeholder="请选择项目类型" clearable>-->
23 <!--              <el-option-->
24 <!--                v-for="dict in dict.type.${dictType}"-->
25 <!--                :key="dict.value"-->
26 <!--                :label="dict.label"-->
27 <!--                :value="dict.value"-->
28 <!--              />-->
29 <!--            </el-select>-->
30 <!--          </el-form-item>-->
31           <el-form-item label="标准" prop="standard">
32             <el-input
33               v-model="queryParams.standard"
34               placeholder="请输入标准"
35               clearable
36               @keyup.enter.native="handleQuery"
37             />
38           </el-form-item>
39           <el-form-item label="结果" prop="results">
40             <el-input
41               v-model="queryParams.results"
42               placeholder="请输入结果"
43               clearable
44               @keyup.enter.native="handleQuery"
45             />
46           </el-form-item>
47           <el-form-item style="float: right">
48             <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
49             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
50           </el-form-item>
51         </el-form>
52     </el-card>
53
54     <el-card style="margin-top: 10px" class="box-card">
55         <el-row :gutter="10" class="mb8">
56           <el-col :span="1.5">
57             <el-button
58               type="primary"
59               plain
60               icon="el-icon-plus"
61               size="mini"
62               @click="handleAdd"
63               v-hasPermi="['em:inspectionPlanItemsProject:add']"
64             >新增</el-button>
65           </el-col>
66           <el-col :span="1.5">
67             <el-button
68               type="success"
69               plain
70               icon="el-icon-edit"
71               size="mini"
72               :disabled="single"
73               @click="handleUpdate"
74               v-hasPermi="['em:inspectionPlanItemsProject:edit']"
75             >修改</el-button>
76           </el-col>
77           <el-col :span="1.5">
78             <el-button
79               type="danger"
80               plain
81               icon="el-icon-delete"
82               size="mini"
83               :disabled="multiple"
84               @click="handleDelete"
85               v-hasPermi="['em:inspectionPlanItemsProject:remove']"
86             >删除</el-button>
87           </el-col>
88           <el-col :span="1.5">
89             <el-button
90               type="warning"
91               plain
92               icon="el-icon-download"
93               size="mini"
94               @click="handleExport"
95               v-hasPermi="['em:inspectionPlanItemsProject:export']"
96             >导出</el-button>
97           </el-col>
98           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
99         </el-row>
100
101         <el-table border v-loading="loading" :data="inspectionPlanItemsProjectList" @selection-change="handleSelectionChange">
102           <el-table-column type="selection" width="55" align="center" />
103           <el-table-column label="ID" align="center" prop="id" />
104           <el-table-column label="项目编号" align="center" prop="itemsCode">
105           </el-table-column>
106           <el-table-column label="项目名称" align="center" prop="itemsName">
107           </el-table-column>
108           <el-table-column label="项目类型" align="center" prop="itemsType">
109           </el-table-column>
110           <el-table-column label="标准" align="center" prop="standard">
111           </el-table-column>
112           <el-table-column label="项目内容" align="center" prop="itemsContent">
113           </el-table-column>
114           <el-table-column label="创建人" align="center" prop="createUser">
115           </el-table-column>
116           <el-table-column label="创建时间" align="center" prop="createTime">
117           </el-table-column>
118           <el-table-column label="更新人" align="center" prop="updateUser">
119           </el-table-column>
120           <el-table-column label="更新时间" align="center" prop="updateTime">
121           </el-table-column>
122           <el-table-column label="结果" align="center" prop="results">
123           </el-table-column>
124           <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width">
125             <template slot-scope="scope">
126               <el-button
127                 size="mini"
128                 type="success"
129                 plain
130                 style="width: 72px"
131                 icon="el-icon-edit"
132                 @click="handleUpdate(scope.row)"
133                 v-hasPermi="['em:inspectionPlanItemsProject:edit']"
134               >修改</el-button>
135               <el-button
136                 size="mini"
137                 type="danger"
138                 plain
139                 style="width: 72px"
140                 icon="el-icon-delete"
141                 @click="handleDelete(scope.row)"
142                 v-hasPermi="['em:inspectionPlanItemsProject:remove']"
143               >删除</el-button>
144             </template>
145           </el-table-column>
146         </el-table>
147     </el-card>
148
149     <pagination
150       v-show="total>0"
151       :total="total"
152       :page.sync="queryParams.pageNum"
153       :limit.sync="queryParams.pageSize"
154       @pagination="getList"
155     />
156
157     <!-- 添加或修改点检任务-项目对话框 -->
158     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
159       <span slot="title">
160         <i class="el-icon-s-order"></i>
161         {{titleName}}
162       </span>
163       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
164         <el-form-item label="项目编号" prop="itemsCode">
165           <el-input v-model="form.itemsCode" placeholder="请输入项目编号" />
166         </el-form-item>
167         <el-form-item label="项目名称" prop="itemsName">
168           <el-input v-model="form.itemsName" placeholder="请输入项目名称" />
169         </el-form-item>
170 <!--        <el-form-item label="项目类型" prop="itemsType">-->
171 <!--          <el-select v-model="form.itemsType" placeholder="请选择项目类型">-->
172 <!--            <el-option-->
173 <!--              v-for="dict in dict.type.${dictType}"-->
174 <!--              :key="dict.value"-->
175 <!--              :label="dict.label"-->
176 <!--              :value="dict.value"-->
177 <!--            ></el-option>-->
178 <!--          </el-select>-->
179 <!--        </el-form-item>-->
180         <el-form-item label="标准" prop="standard">
181           <el-input v-model="form.standard" placeholder="请输入标准" />
182         </el-form-item>
183         <el-form-item label="项目内容">
184           <editor v-model="form.itemsContent" :min-height="192"/>
185         </el-form-item>
186         <el-form-item label="创建人" prop="createUser">
187           <el-input v-model="form.createUser" placeholder="请输入创建人" />
188         </el-form-item>
189         <el-form-item label="更新人" prop="updateUser">
190           <el-input v-model="form.updateUser" placeholder="请输入更新人" />
191         </el-form-item>
192         <el-form-item label="结果" prop="results">
193           <el-input v-model="form.results" placeholder="请输入结果" />
194         </el-form-item>
195       </el-form>
196       <div slot="footer" class="dialog-footer">
197         <el-button type="primary" @click="submitForm">确 定</el-button>
198         <el-button @click="cancel">取 消</el-button>
199       </div>
200     </el-dialog>
201   </div>
202 </template>
203
204 <script>
205 import { listInspectionPlanItemsProject, getInspectionPlanItemsProject, delInspectionPlanItemsProject, addInspectionPlanItemsProject, updateInspectionPlanItemsProject } from "@/api/main/em/inspectionPlanItemsProject/inspectionPlanItemsProject";
206
207 export default {
208   name: "InspectionPlanItemsProject",
209   data() {
210     return {
211       // 遮罩层
212       loading: true,
213       titleName: "",
214       // 选中数组
215       ids: [],
216       // 非单个禁用
217       single: true,
218       // 非多个禁用
219       multiple: true,
220       // 显示搜索条件
221       showSearch: true,
222       // 总条数
223       total: 0,
224       // 点检任务-项目表格数据
225       inspectionPlanItemsProjectList: [],
226       // 弹出层标题
227       title: "",
228       // 是否显示弹出层
229       open: false,
230       // 查询参数
231       queryParams: {
232         pageNum: 1,
233         pageSize: 10,
234         itemsCode: null,
235         itemsName: null,
236         itemsType: null,
237         standard: null,
238         results: null,
239       },
240       // 表单参数
241       form: {},
242       // 表单校验
243       rules: {
244         id: [
245           { required: true, message: "ID不能为空", trigger: "blur" }
246         ],
247       }
248     };
249   },
250   created() {
251     this.getList();
252   },
253   methods: {
254     /** 查询点检任务-项目列表 */
255     getList() {
256       this.loading = true;
257       listInspectionPlanItemsProject(this.queryParams).then(response => {
258         this.inspectionPlanItemsProjectList = response.rows;
259         this.total = response.total;
260         this.loading = false;
261       });
262     },
263     // 取消按钮
264     cancel() {
265       this.open = false;
266       this.reset();
267     },
268     // 表单重置
269     reset() {
270       this.form = {
271         id: null,
272         itemsCode: null,
273         itemsName: null,
274         itemsType: null,
275         standard: null,
276         itemsContent: null,
277         createUser: null,
278         createTime: null,
279         updateUser: null,
280         updateTime: null,
281         results: null,
282         spareField2: null,
283         planTaskId: null
284       };
285       this.resetForm("form");
286     },
287     /** 搜索按钮操作 */
288     handleQuery() {
289       this.queryParams.pageNum = 1;
290       this.getList();
291     },
292     /** 重置按钮操作 */
293     resetQuery() {
294       this.resetForm("queryForm");
295       this.handleQuery();
296     },
297     // 多选框选中数据
298     handleSelectionChange(selection) {
299       this.ids = selection.map(item => item.id)
300       this.single = selection.length!==1
301       this.multiple = !selection.length
302     },
303     /** 新增按钮操作 */
304     handleAdd() {
305       this.reset();
306       this.open = true;
307       this.titleName = "添加点检任务-项目";
308     },
309     /** 修改按钮操作 */
310     handleUpdate(row) {
311       this.reset();
312       const id = row.id || this.ids
313       getInspectionPlanItemsProject(id).then(response => {
314         this.form = response.data;
315         this.open = true;
316         this.titleName = "修改点检任务-项目";
317       });
318     },
319     /** 提交按钮 */
320     submitForm() {
321       this.$refs["form"].validate(valid => {
322         if (valid) {
323           if (this.form.id != null) {
324             updateInspectionPlanItemsProject(this.form).then(response => {
325               this.$modal.msgSuccess("修改成功");
326               this.open = false;
327               this.getList();
328             });
329           } else {
330             addInspectionPlanItemsProject(this.form).then(response => {
331               this.$modal.msgSuccess("新增成功");
332               this.open = false;
333               this.getList();
334             });
335           }
336         }
337       });
338     },
339     /** 删除按钮操作 */
340     handleDelete(row) {
341       const ids = row.id || this.ids;
342       this.$modal.confirm('是否确认删除点检任务-项目编号为"' + ids + '"的数据项?').then(function() {
343         return delInspectionPlanItemsProject(ids);
344       }).then(() => {
345         this.getList();
346         this.$modal.msgSuccess("删除成功");
347       }).catch(() => {});
348     },
349     /** 导出按钮操作 */
350     handleExport() {
351       this.download('em/inspectionPlanItemsProject/export', {
352         ...this.queryParams
353       }, `inspectionPlanItemsProject_${new Date().getTime()}.xlsx`)
354     }
355   }
356 };
357 </script>