index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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="modelName">
  5. <el-input
  6. v-model="queryParams.modelName"
  7. placeholder="请输入模块名称"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="文件名称" prop="name">
  13. <el-input
  14. v-model="queryParams.name"
  15. placeholder="请输入文件名称"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="错误信息" prop="error">
  21. <el-input
  22. v-model="queryParams.error"
  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:importExportLog: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:importExportLog: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:importExportLog: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:importExportLog:export']"
  74. >导出</el-button>
  75. </el-col>
  76. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  77. </el-row>
  78. <el-table v-loading="loading" :data="importExportLogList" @selection-change="handleSelectionChange">
  79. <el-table-column type="selection" width="55" align="center" />
  80. <el-table-column label="唯一ID" align="center" prop="id" />
  81. <el-table-column label="模块名称" align="center" prop="modelName" />
  82. <el-table-column label="文件名称" align="center" prop="name" />
  83. <el-table-column label="错误信息" align="center" prop="error" />
  84. <el-table-column label="状态" align="center" prop="status" />
  85. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  86. <template slot-scope="scope">
  87. <el-button
  88. size="mini"
  89. type="text"
  90. icon="el-icon-edit"
  91. @click="handleUpdate(scope.row)"
  92. v-hasPermi="['manage:importExportLog:edit']"
  93. >修改</el-button>
  94. <el-button
  95. size="mini"
  96. type="text"
  97. icon="el-icon-delete"
  98. @click="handleDelete(scope.row)"
  99. v-hasPermi="['manage:importExportLog:remove']"
  100. >删除</el-button>
  101. </template>
  102. </el-table-column>
  103. </el-table>
  104. <pagination
  105. v-show="total>0"
  106. :total="total"
  107. :page.sync="queryParams.pageNum"
  108. :limit.sync="queryParams.pageSize"
  109. @pagination="getList"
  110. />
  111. <!-- 添加或修改导入导出日志;对话框 -->
  112. <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
  113. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  114. <el-form-item label="模块名称" prop="modelName">
  115. <el-input v-model="form.modelName" placeholder="请输入模块名称" />
  116. </el-form-item>
  117. <el-form-item label="文件名称" prop="name">
  118. <el-input v-model="form.name" placeholder="请输入文件名称" />
  119. </el-form-item>
  120. <el-form-item label="错误信息" prop="error">
  121. <el-input v-model="form.error" placeholder="请输入错误信息" />
  122. </el-form-item>
  123. </el-form>
  124. <div slot="footer" class="dialog-footer">
  125. <el-button type="primary" @click="submitForm">确 定</el-button>
  126. <el-button @click="cancel">取 消</el-button>
  127. </div>
  128. </el-dialog>
  129. </div>
  130. </template>
  131. <script>
  132. import { listImportExportLog, getImportExportLog, delImportExportLog, addImportExportLog, updateImportExportLog } from "@/api/manage/importExportLog";
  133. export default {
  134. name: "ImportExportLog",
  135. data() {
  136. return {
  137. // 遮罩层
  138. loading: true,
  139. // 选中数组
  140. ids: [],
  141. // 非单个禁用
  142. single: true,
  143. // 非多个禁用
  144. multiple: true,
  145. // 显示搜索条件
  146. showSearch: true,
  147. // 总条数
  148. total: 0,
  149. // 导入导出日志;表格数据
  150. importExportLogList: [],
  151. // 弹出层标题
  152. title: "",
  153. // 是否显示弹出层
  154. open: false,
  155. // 查询参数
  156. queryParams: {
  157. pageNum: 1,
  158. pageSize: 10,
  159. modelName: null,
  160. name: null,
  161. error: null,
  162. status: null,
  163. },
  164. // 表单参数
  165. form: {},
  166. // 表单校验
  167. rules: {
  168. }
  169. };
  170. },
  171. created() {
  172. this.getList();
  173. },
  174. methods: {
  175. /** 查询导入导出日志;列表 */
  176. getList() {
  177. this.loading = true;
  178. listImportExportLog(this.queryParams).then(response => {
  179. this.importExportLogList = response.rows;
  180. this.total = response.total;
  181. this.loading = false;
  182. });
  183. },
  184. // 取消按钮
  185. cancel() {
  186. this.open = false;
  187. this.reset();
  188. },
  189. // 表单重置
  190. reset() {
  191. this.form = {
  192. id: null,
  193. modelName: null,
  194. name: null,
  195. error: null,
  196. status: null,
  197. };
  198. this.resetForm("form");
  199. },
  200. /** 搜索按钮操作 */
  201. handleQuery() {
  202. this.queryParams.pageNum = 1;
  203. this.getList();
  204. },
  205. /** 重置按钮操作 */
  206. resetQuery() {
  207. this.resetForm("queryForm");
  208. this.handleQuery();
  209. },
  210. // 多选框选中数据
  211. handleSelectionChange(selection) {
  212. this.ids = selection.map(item => item.id)
  213. this.single = selection.length!==1
  214. this.multiple = !selection.length
  215. },
  216. /** 新增按钮操作 */
  217. handleAdd() {
  218. this.reset();
  219. this.open = true;
  220. this.title = "添加导入导出日志;";
  221. },
  222. /** 修改按钮操作 */
  223. handleUpdate(row) {
  224. this.reset();
  225. const id = row.id || this.ids
  226. getImportExportLog(id).then(response => {
  227. this.form = response.data;
  228. this.open = true;
  229. this.title = "修改导入导出日志;";
  230. });
  231. },
  232. /** 提交按钮 */
  233. submitForm() {
  234. this.$refs["form"].validate(valid => {
  235. if (valid) {
  236. if (this.form.id != null) {
  237. updateImportExportLog(this.form).then(response => {
  238. this.$modal.msgSuccess("修改成功");
  239. this.open = false;
  240. this.getList();
  241. });
  242. } else {
  243. addImportExportLog(this.form).then(response => {
  244. this.$modal.msgSuccess("新增成功");
  245. this.open = false;
  246. this.getList();
  247. });
  248. }
  249. }
  250. });
  251. },
  252. /** 删除按钮操作 */
  253. handleDelete(row) {
  254. const ids = row.id || this.ids;
  255. this.$modal.confirm('是否确认删除导入导出日志;编号为"' + ids + '"的数据项?').then(function() {
  256. return delImportExportLog(ids);
  257. }).then(() => {
  258. this.getList();
  259. this.$modal.msgSuccess("删除成功");
  260. }).catch(() => {});
  261. },
  262. /** 导出按钮操作 */
  263. handleExport() {
  264. this.download('manage/importExportLog/export', {
  265. ...this.queryParams
  266. }, `importExportLog_${new Date().getTime()}.xlsx`)
  267. }
  268. }
  269. };
  270. </script>