index.vue 8.8 KB

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