index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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="isDelete">
  5. <el-input
  6. v-model="queryParams.isDelete"
  7. placeholder="请输入数据是否删除"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="创建人" prop="createdBy">
  13. <el-input
  14. v-model="queryParams.createdBy"
  15. placeholder="请输入创建人"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="创建时间" prop="createdTime">
  21. <el-date-picker clearable
  22. v-model="queryParams.createdTime"
  23. type="date"
  24. value-format="yyyy-MM-dd"
  25. placeholder="请选择创建时间">
  26. </el-date-picker>
  27. </el-form-item>
  28. <el-form-item label="更新人" prop="updatedBy">
  29. <el-input
  30. v-model="queryParams.updatedBy"
  31. placeholder="请输入更新人"
  32. clearable
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. <el-form-item label="更新时间" prop="updatedTime">
  37. <el-date-picker clearable
  38. v-model="queryParams.updatedTime"
  39. type="date"
  40. value-format="yyyy-MM-dd"
  41. placeholder="请选择更新时间">
  42. </el-date-picker>
  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:analyzeResult: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:analyzeResult: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:analyzeResult: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:analyzeResult: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="analyzeResultList" @selection-change="handleSelectionChange">
  95. <el-table-column type="selection" width="55" align="center" />
  96. <el-table-column label="唯一ID" align="center" prop="id" />
  97. <el-table-column label="数据是否删除" align="center" prop="isDelete" />
  98. <el-table-column label="创建人" align="center" prop="createdBy" />
  99. <el-table-column label="创建时间" align="center" prop="createdTime" width="180">
  100. <template slot-scope="scope">
  101. <span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="更新人" align="center" prop="updatedBy" />
  105. <el-table-column label="更新时间" align="center" prop="updatedTime" width="180">
  106. <template slot-scope="scope">
  107. <span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  111. <template slot-scope="scope">
  112. <el-button
  113. size="mini"
  114. type="text"
  115. icon="el-icon-edit"
  116. @click="handleUpdate(scope.row)"
  117. v-hasPermi="['manage:analyzeResult:edit']"
  118. >修改</el-button>
  119. <el-button
  120. size="mini"
  121. type="text"
  122. icon="el-icon-delete"
  123. @click="handleDelete(scope.row)"
  124. v-hasPermi="['manage:analyzeResult:remove']"
  125. >删除</el-button>
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. <pagination
  130. v-show="total>0"
  131. :total="total"
  132. :page.sync="queryParams.pageNum"
  133. :limit.sync="queryParams.pageSize"
  134. @pagination="getList"
  135. />
  136. <!-- 添加或修改数据解析结果对话框 -->
  137. <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
  138. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  139. <el-form-item label="数据是否删除" prop="isDelete">
  140. <el-input v-model="form.isDelete" placeholder="请输入数据是否删除" />
  141. </el-form-item>
  142. <el-form-item label="创建人" prop="createdBy">
  143. <el-input v-model="form.createdBy" placeholder="请输入创建人" />
  144. </el-form-item>
  145. <el-form-item label="创建时间" prop="createdTime">
  146. <el-date-picker clearable
  147. v-model="form.createdTime"
  148. type="date"
  149. value-format="yyyy-MM-dd"
  150. placeholder="请选择创建时间">
  151. </el-date-picker>
  152. </el-form-item>
  153. <el-form-item label="更新人" prop="updatedBy">
  154. <el-input v-model="form.updatedBy" placeholder="请输入更新人" />
  155. </el-form-item>
  156. <el-form-item label="更新时间" prop="updatedTime">
  157. <el-date-picker clearable
  158. v-model="form.updatedTime"
  159. type="date"
  160. value-format="yyyy-MM-dd"
  161. placeholder="请选择更新时间">
  162. </el-date-picker>
  163. </el-form-item>
  164. </el-form>
  165. <div slot="footer" class="dialog-footer">
  166. <el-button type="primary" @click="submitForm">确 定</el-button>
  167. <el-button @click="cancel">取 消</el-button>
  168. </div>
  169. </el-dialog>
  170. </div>
  171. </template>
  172. <script>
  173. import { listAnalyzeResult, getAnalyzeResult, delAnalyzeResult, addAnalyzeResult, updateAnalyzeResult } from "@/api/manage/analyzeResult";
  174. export default {
  175. name: "AnalyzeResult",
  176. data() {
  177. return {
  178. // 遮罩层
  179. loading: true,
  180. // 选中数组
  181. ids: [],
  182. // 非单个禁用
  183. single: true,
  184. // 非多个禁用
  185. multiple: true,
  186. // 显示搜索条件
  187. showSearch: true,
  188. // 总条数
  189. total: 0,
  190. // 数据解析结果表格数据
  191. analyzeResultList: [],
  192. // 弹出层标题
  193. title: "",
  194. // 是否显示弹出层
  195. open: false,
  196. // 查询参数
  197. queryParams: {
  198. pageNum: 1,
  199. pageSize: 10,
  200. isDelete: null,
  201. createdBy: null,
  202. createdTime: null,
  203. updatedBy: null,
  204. updatedTime: null
  205. },
  206. // 表单参数
  207. form: {},
  208. // 表单校验
  209. rules: {
  210. isDelete: [
  211. { required: true, message: "数据是否删除不能为空", trigger: "blur" }
  212. ],
  213. }
  214. };
  215. },
  216. created() {
  217. this.getList();
  218. },
  219. methods: {
  220. /** 查询数据解析结果列表 */
  221. getList() {
  222. this.loading = true;
  223. listAnalyzeResult(this.queryParams).then(response => {
  224. this.analyzeResultList = response.rows;
  225. this.total = response.total;
  226. this.loading = false;
  227. });
  228. },
  229. // 取消按钮
  230. cancel() {
  231. this.open = false;
  232. this.reset();
  233. },
  234. // 表单重置
  235. reset() {
  236. this.form = {
  237. id: null,
  238. isDelete: null,
  239. createdBy: null,
  240. createdTime: null,
  241. updatedBy: null,
  242. updatedTime: null
  243. };
  244. this.resetForm("form");
  245. },
  246. /** 搜索按钮操作 */
  247. handleQuery() {
  248. this.queryParams.pageNum = 1;
  249. this.getList();
  250. },
  251. /** 重置按钮操作 */
  252. resetQuery() {
  253. this.resetForm("queryForm");
  254. this.handleQuery();
  255. },
  256. // 多选框选中数据
  257. handleSelectionChange(selection) {
  258. this.ids = selection.map(item => item.id)
  259. this.single = selection.length!==1
  260. this.multiple = !selection.length
  261. },
  262. /** 新增按钮操作 */
  263. handleAdd() {
  264. this.reset();
  265. this.open = true;
  266. this.title = "添加数据解析结果";
  267. },
  268. /** 修改按钮操作 */
  269. handleUpdate(row) {
  270. this.reset();
  271. const id = row.id || this.ids
  272. getAnalyzeResult(id).then(response => {
  273. this.form = response.data;
  274. this.open = true;
  275. this.title = "修改数据解析结果";
  276. });
  277. },
  278. /** 提交按钮 */
  279. submitForm() {
  280. this.$refs["form"].validate(valid => {
  281. if (valid) {
  282. if (this.form.id != null) {
  283. updateAnalyzeResult(this.form).then(response => {
  284. this.$modal.msgSuccess("修改成功");
  285. this.open = false;
  286. this.getList();
  287. });
  288. } else {
  289. addAnalyzeResult(this.form).then(response => {
  290. this.$modal.msgSuccess("新增成功");
  291. this.open = false;
  292. this.getList();
  293. });
  294. }
  295. }
  296. });
  297. },
  298. /** 删除按钮操作 */
  299. handleDelete(row) {
  300. const ids = row.id || this.ids;
  301. this.$modal.confirm('是否确认删除数据解析结果编号为"' + ids + '"的数据项?').then(function() {
  302. return delAnalyzeResult(ids);
  303. }).then(() => {
  304. this.getList();
  305. this.$modal.msgSuccess("删除成功");
  306. }).catch(() => {});
  307. },
  308. /** 导出按钮操作 */
  309. handleExport() {
  310. this.download('manage/analyzeResult/export', {
  311. ...this.queryParams
  312. }, `analyzeResult_${new Date().getTime()}.xlsx`)
  313. }
  314. }
  315. };
  316. </script>