中国算力平台算力登记系统2.0
yanzhaofeige
3 days ago 5cc82f45d73865489cc39e5ffbf521bf4279ec53
commit | author | age
1d2509 1 <template>
Y 2   <div class="app-container">
3     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
4       <el-form-item label="省份" prop="telNo">
5         <el-input
6           v-model="queryParams.telNo"
7           placeholder="请输入省份"
8           clearable
9           @keyup.enter.native="handleQuery"
10         />
11       </el-form-item>
12       <el-form-item label="投产年份" prop="productionYear">
13         <el-input
14           v-model="queryParams.productionYear"
15           placeholder="请输入投产年份"
16           clearable
17           @keyup.enter.native="handleQuery"
18         />
19       </el-form-item>
20       <el-form-item label="序号" prop="index">
21         <el-input
22           v-model="queryParams.index"
23           placeholder="请输入序号"
24           clearable
25           @keyup.enter.native="handleQuery"
26         />
27       </el-form-item>
28       <el-form-item>
29         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
30         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
31       </el-form-item>
32     </el-form>
33
34     <el-row :gutter="10" class="mb8">
35       <el-col :span="1.5">
36         <el-button
37           type="primary"
38           plain
39           icon="el-icon-plus"
40           size="mini"
41           @click="handleAdd"
42           v-hasPermi="['bis:idcNoIndex:add']"
43         >新增</el-button>
44       </el-col>
45       <el-col :span="1.5">
46         <el-button
47           type="success"
48           plain
49           icon="el-icon-edit"
50           size="mini"
51           :disabled="single"
52           @click="handleUpdate"
53           v-hasPermi="['bis:idcNoIndex:edit']"
54         >修改</el-button>
55       </el-col>
56       <el-col :span="1.5">
57         <el-button
58           type="danger"
59           plain
60           icon="el-icon-delete"
61           size="mini"
62           :disabled="multiple"
63           @click="handleDelete"
64           v-hasPermi="['bis:idcNoIndex:remove']"
65         >删除</el-button>
66       </el-col>
67       <el-col :span="1.5">
68         <el-button
69           type="warning"
70           plain
71           icon="el-icon-download"
72           size="mini"
73           @click="handleExport"
74           v-hasPermi="['bis:idcNoIndex:export']"
75         >导出</el-button>
76       </el-col>
77       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
78     </el-row>
79
80     <el-table v-loading="loading" :data="idcNoIndexList" @selection-change="handleSelectionChange">
81       <el-table-column type="selection" width="55" align="center" />
82       <el-table-column label="ID" align="center" prop="id" />
83       <el-table-column label="省份" align="center" prop="telNo" />
84       <el-table-column label="投产年份" align="center" prop="productionYear" />
85       <el-table-column label="序号" align="center" prop="index" />
86       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
87         <template slot-scope="scope">
88           <el-button
89             size="mini"
90             type="text"
91             icon="el-icon-edit"
92             @click="handleUpdate(scope.row)"
93             v-hasPermi="['bis:idcNoIndex:edit']"
94           >修改</el-button>
95           <el-button
96             size="mini"
97             type="text"
98             icon="el-icon-delete"
99             @click="handleDelete(scope.row)"
100             v-hasPermi="['bis:idcNoIndex:remove']"
101           >删除</el-button>
102         </template>
103       </el-table-column>
104     </el-table>
105     
106     <pagination
107       v-show="total>0"
108       :total="total"
109       :page.sync="queryParams.pageNum"
110       :limit.sync="queryParams.pageSize"
111       @pagination="getList"
112     />
113
114     <!-- 添加或修改IDC编号索引对话框 -->
115     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
116       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
117         <el-form-item label="省份" prop="telNo">
118           <el-input v-model="form.telNo" placeholder="请输入省份" />
119         </el-form-item>
120         <el-form-item label="投产年份" prop="productionYear">
121           <el-input v-model="form.productionYear" placeholder="请输入投产年份" />
122         </el-form-item>
123         <el-form-item label="序号" prop="index">
124           <el-input v-model="form.index" placeholder="请输入序号" />
125         </el-form-item>
126       </el-form>
127       <div slot="footer" class="dialog-footer">
128         <el-button type="primary" @click="submitForm">确 定</el-button>
129         <el-button @click="cancel">取 消</el-button>
130       </div>
131     </el-dialog>
132   </div>
133 </template>
134
135 <script>
136 import { listIdcNoIndex, getIdcNoIndex, delIdcNoIndex, addIdcNoIndex, updateIdcNoIndex } from "@/api/bis/idcNoIndex";
137
138 export default {
139   name: "IdcNoIndex",
140   data() {
141     return {
142       // 遮罩层
143       loading: true,
144       // 选中数组
145       ids: [],
146       // 非单个禁用
147       single: true,
148       // 非多个禁用
149       multiple: true,
150       // 显示搜索条件
151       showSearch: true,
152       // 总条数
153       total: 0,
154       // IDC编号索引表格数据
155       idcNoIndexList: [],
156       // 弹出层标题
157       title: "",
158       // 是否显示弹出层
159       open: false,
160       // 查询参数
161       queryParams: {
162         pageNum: 1,
163         pageSize: 10,
164         telNo: null,
165         productionYear: null,
166         index: null
167       },
168       // 表单参数
169       form: {},
170       // 表单校验
171       rules: {
172       }
173     };
174   },
175   created() {
176     this.getList();
177   },
178   methods: {
179     /** 查询IDC编号索引列表 */
180     getList() {
181       this.loading = true;
182       listIdcNoIndex(this.queryParams).then(response => {
183         this.idcNoIndexList = response.rows;
184         this.total = response.total;
185         this.loading = false;
186       });
187     },
188     // 取消按钮
189     cancel() {
190       this.open = false;
191       this.reset();
192     },
193     // 表单重置
194     reset() {
195       this.form = {
196         id: null,
197         telNo: null,
198         productionYear: null,
199         index: null
200       };
201       this.resetForm("form");
202     },
203     /** 搜索按钮操作 */
204     handleQuery() {
205       this.queryParams.pageNum = 1;
206       this.getList();
207     },
208     /** 重置按钮操作 */
209     resetQuery() {
210       this.resetForm("queryForm");
211       this.handleQuery();
212     },
213     // 多选框选中数据
214     handleSelectionChange(selection) {
215       this.ids = selection.map(item => item.id)
216       this.single = selection.length!==1
217       this.multiple = !selection.length
218     },
219     /** 新增按钮操作 */
220     handleAdd() {
221       this.reset();
222       this.open = true;
223       this.title = "添加IDC编号索引";
224     },
225     /** 修改按钮操作 */
226     handleUpdate(row) {
227       this.reset();
228       const id = row.id || this.ids
229       getIdcNoIndex(id).then(response => {
230         this.form = response.data;
231         this.open = true;
232         this.title = "修改IDC编号索引";
233       });
234     },
235     /** 提交按钮 */
236     submitForm() {
237       this.$refs["form"].validate(valid => {
238         if (valid) {
239           if (this.form.id != null) {
240             updateIdcNoIndex(this.form).then(response => {
241               this.$modal.msgSuccess("修改成功");
242               this.open = false;
243               this.getList();
244             });
245           } else {
246             addIdcNoIndex(this.form).then(response => {
247               this.$modal.msgSuccess("新增成功");
248               this.open = false;
249               this.getList();
250             });
251           }
252         }
253       });
254     },
255     /** 删除按钮操作 */
256     handleDelete(row) {
257       const ids = row.id || this.ids;
258       this.$modal.confirm('是否确认删除IDC编号索引编号为"' + ids + '"的数据项?').then(function() {
259         return delIdcNoIndex(ids);
260       }).then(() => {
261         this.getList();
262         this.$modal.msgSuccess("删除成功");
263       }).catch(() => {});
264     },
265     /** 导出按钮操作 */
266     handleExport() {
267       this.download('bis/idcNoIndex/export', {
268         ...this.queryParams
269       }, `idcNoIndex_${new Date().getTime()}.xlsx`)
270     }
271   }
272 };
273 </script>