iconInfo-list.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <div>
  3. <el-breadcrumb separator=">">
  4. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  5. <el-breadcrumb-item>
  6. <a href="#">系统管理</a>
  7. </el-breadcrumb-item>
  8. <el-breadcrumb-item>
  9. <a href="/iconInfo">图标管理</a>
  10. </el-breadcrumb-item>
  11. </el-breadcrumb>
  12. <el-divider></el-divider>
  13. <!--
  14. 要resetFields起作用,必须配置:model和prop
  15. -->
  16. <el-form
  17. ref="queryForm"
  18. :model="queryModel"
  19. inline
  20. class="demo-form-inline"
  21. >
  22. <el-form-item label="图标名称" prop="iconName">
  23. <el-input
  24. type="text"
  25. size="mini"
  26. v-model="queryModel.iconName"
  27. ></el-input>
  28. </el-form-item>
  29. <el-form-item label="备注信息" prop="remark">
  30. <el-input
  31. type="text"
  32. size="mini"
  33. v-model="queryModel.remark"
  34. ></el-input>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button
  38. type="primary"
  39. size="mini"
  40. icon="ios-search"
  41. @click="changePage(1)"
  42. :loading="loading"
  43. >查询</el-button
  44. >&nbsp;
  45. <el-button
  46. type="info"
  47. size="mini"
  48. style="margin-left: 8px"
  49. @click="handleReset('queryForm')"
  50. >重置</el-button
  51. >&nbsp;
  52. </el-form-item>
  53. </el-form>
  54. <el-divider></el-divider>
  55. <el-row class="button-group">
  56. <el-button
  57. type="primary"
  58. size="small"
  59. plain
  60. icon="el-icon-circle-plus"
  61. @click="handleAdd"
  62. >新增</el-button
  63. >
  64. <el-button
  65. type="primary"
  66. size="small"
  67. plain
  68. icon="el-icon-circle-plus"
  69. :disabled="multipleSelection.length == 0"
  70. @click="handleBatchDelete"
  71. >删除选中项</el-button
  72. >
  73. </el-row>
  74. <el-table
  75. :data="tableData"
  76. style="min-height: 400px"
  77. v-loading="loading"
  78. stripe
  79. @sort-change="sortChange"
  80. @selection-change="handleSelectionChange"
  81. >
  82. <el-table-column type="selection" width="55"></el-table-column>
  83. <el-table-column
  84. prop="iconName"
  85. label="图标名称"
  86. width="180"
  87. ></el-table-column>
  88. <el-table-column
  89. prop="iconRoute"
  90. label="图标路由"
  91. width="180"
  92. ></el-table-column>
  93. <el-table-column
  94. prop="iconSubRoute"
  95. label="图标的子页面路由"
  96. width="180"
  97. ></el-table-column>
  98. <el-table-column
  99. prop="iconUrl"
  100. label="图标url"
  101. width="180"
  102. ></el-table-column>
  103. <el-table-column
  104. prop="iconParam"
  105. label="参数"
  106. width="180"
  107. ></el-table-column>
  108. <el-table-column
  109. prop="iconPic"
  110. label="图标图片"
  111. width="180"
  112. ></el-table-column>
  113. <el-table-column
  114. prop="iconCommonPic"
  115. label="通用功能展示的图片"
  116. width="180"
  117. ></el-table-column>
  118. <el-table-column
  119. prop="iconTypeName"
  120. label="图标类型"
  121. width="180"
  122. ></el-table-column>
  123. <el-table-column
  124. prop="remark"
  125. label="备注信息"
  126. width="180"
  127. ></el-table-column>
  128. <el-table-column
  129. prop="useEnableName"
  130. label="是否启用"
  131. width="180"
  132. ></el-table-column>
  133. <el-table-column label="操作" fixed="right" width="150">
  134. <template slot-scope="{ row }">
  135. <el-button size="mini" type="warning" @click="handleEdit(row)"
  136. >编辑</el-button
  137. >
  138. <el-button size="mini" type="danger" @click="handleDelete(row)"
  139. >删除</el-button
  140. >
  141. </template>
  142. </el-table-column>
  143. </el-table>
  144. <el-pagination
  145. :current-page.sync="pageIndex"
  146. :total="totalElements"
  147. :page-sizes="pageSizeList"
  148. @current-change="changePage"
  149. @size-change="pageSizeChange"
  150. layout="total, sizes, prev, pager, next, jumper"
  151. ></el-pagination>
  152. <iconInfo-detail
  153. v-if="showModal"
  154. :businessKey="businessKey"
  155. :title="modalTitle"
  156. @close="onDetailModalClose"
  157. ></iconInfo-detail>
  158. </div>
  159. </template>
  160. <script>
  161. import Constant from "@/constant";
  162. import IconInfoDetail from "./iconInfo-detail";
  163. import iconInfoApi from "@/api/base/iconInfo";
  164. import NProgress from "nprogress"; // progress bar
  165. import "nprogress/nprogress.css"; // progress bar style
  166. export default {
  167. name: "baseIconInfoList",
  168. data() {
  169. var self = this;
  170. return {
  171. queryModel: {
  172. id: "",
  173. iconName: "",
  174. iconRoute: "",
  175. iconSubRoute: "",
  176. iconUrl: "",
  177. iconParam: "",
  178. useEnable: "",
  179. iconPic: "",
  180. iconCommonPic: "",
  181. iconTypeId: "",
  182. delFlag: "",
  183. createBy: "",
  184. createTime: "",
  185. updateBy: "",
  186. updateTime: "",
  187. remark: "",
  188. },
  189. loading: false,
  190. tableData: [],
  191. pageIndex: 1,
  192. pageSize: 10,
  193. totalPages: 0,
  194. totalElements: 0,
  195. field: "",
  196. direction: "",
  197. pageSizeList: [10, 20, 30],
  198. multipleSelection: [],
  199. showModal: false,
  200. modalTitle: "",
  201. businessKey: "",
  202. };
  203. },
  204. methods: {
  205. changePage(pageIndex) {
  206. var self = this;
  207. self.loading = true;
  208. self.pageIndex = pageIndex;
  209. var formData = new FormData();
  210. formData.append("pageIndex", self.pageIndex);
  211. formData.append("pageSize", self.pageSize);
  212. formData.append("id", self.queryModel.id);
  213. formData.append("iconName", self.queryModel.iconName);
  214. formData.append("iconRoute", self.queryModel.iconRoute);
  215. formData.append("iconSubRoute", self.queryModel.iconSubRoute);
  216. formData.append("iconUrl", self.queryModel.iconUrl);
  217. formData.append("iconParam", self.queryModel.iconParam);
  218. formData.append("useEnable", self.queryModel.useEnable);
  219. formData.append("iconPic", self.queryModel.iconPic);
  220. formData.append("iconCommonPic", self.queryModel.iconCommonPic);
  221. formData.append("iconTypeId", self.queryModel.iconTypeId);
  222. formData.append("delFlag", self.queryModel.delFlag);
  223. formData.append("createBy", self.queryModel.createBy);
  224. formData.append("createTime", self.queryModel.createTime);
  225. formData.append("updateBy", self.queryModel.updateBy);
  226. formData.append("updateTime", self.queryModel.updateTime);
  227. formData.append("remark", self.queryModel.remark);
  228. if (this.field != null) {
  229. formData.append("field", this.field);
  230. }
  231. if (this.direction != null) {
  232. formData.append("direction", this.direction);
  233. }
  234. iconInfoApi
  235. .pageList(formData)
  236. .then(function (response) {
  237. self.loading = false;
  238. var jsonData = response.data.data;
  239. self.tableData = jsonData.data;
  240. self.totalPages = jsonData.totalPages;
  241. self.totalElements = jsonData.recordsTotal;
  242. })
  243. .catch((error) => {
  244. self.loading = false;
  245. // self.$message.error(error + "");
  246. });
  247. },
  248. pageSizeChange(pageSize) {
  249. this.pageSize = pageSize;
  250. this.$nextTick(() => {
  251. this.changePage(this.pageIndex);
  252. });
  253. },
  254. sortChange(data) {
  255. this.field = data.column.field;
  256. this.direction = data.order == "ascending" ? "asc" : "desc";
  257. this.changePage(this.pageIndex);
  258. },
  259. handleSelectionChange(val) {
  260. this.multipleSelection = val;
  261. },
  262. handleReset(name) {
  263. this.$refs[name].resetFields();
  264. },
  265. handleAdd() {
  266. this.modalTitle = "新增";
  267. this.businessKey = "";
  268. this.showModal = true;
  269. },
  270. handleEdit(record) {
  271. this.modalTitle = "编辑";
  272. this.businessKey = record.id;
  273. this.showModal = true;
  274. },
  275. handleDelete(record) {
  276. var self = this;
  277. self
  278. .$confirm("是否确认删除?", "提示", {
  279. confirmButtonText: "确定",
  280. cancelButtonText: "取消",
  281. type: "warning",
  282. })
  283. .then(() => {
  284. iconInfoApi.remove(record.id).then(function (response) {
  285. var jsonData = response.data;
  286. if (jsonData.result) {
  287. // var index = self.tableData.indexOf(record);
  288. // self.tableData.splice(index, 1);
  289. self.changePage(self.pageIndex);
  290. self.$message({
  291. type: "success",
  292. message: "删除成功!",
  293. });
  294. }
  295. });
  296. });
  297. },
  298. handleBatchDelete() {
  299. var self = this;
  300. var idList = this.multipleSelection.map((record) => {
  301. return record.id;
  302. });
  303. this.$confirm("是否确认删除选中项?", "提示", {
  304. confirmButtonText: "确定",
  305. cancelButtonText: "取消",
  306. type: "warning",
  307. }).then(() => {
  308. iconInfoApi.batchRemove(idList).then(function (response) {
  309. var jsonData = response.data;
  310. if (jsonData.result) {
  311. self.changePage(self.pageIndex);
  312. self.$message({
  313. type: "success",
  314. message: "删除成功!",
  315. });
  316. }
  317. });
  318. });
  319. },
  320. onDetailModalClose(refreshed) {
  321. //保存成功后回调
  322. this.showModal = false;
  323. if (refreshed) {
  324. this.changePage(this.pageIndex);
  325. }
  326. },
  327. },
  328. mounted: function () {
  329. this.changePage(1);
  330. },
  331. components: {
  332. "iconInfo-detail": IconInfoDetail,
  333. },
  334. };
  335. </script>
  336. <style lang="scss" scoped>
  337. .el-breadcrumb {
  338. margin: 10px;
  339. line-height: 20px;
  340. }
  341. .el-divider {
  342. margin: 5px 0;
  343. }
  344. .demo-form-inline {
  345. margin-left: 10px;
  346. text-align: left;
  347. }
  348. .button-group {
  349. margin-left: 10px;
  350. text-align: left;
  351. }
  352. </style>