index.vue 9.4 KB

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