index.vue 9.0 KB

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