rtuimport.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <!--
  2. * @Title:
  3. * @Description:
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <div>
  11. <el-row>
  12. <el-col :span="24">
  13. <basic-container>
  14. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page"
  15. :before-open="beforeOpen" ref="crud" v-model="form" :permission="permissionList"
  16. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  17. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
  18. @on-load="onLoad">
  19. <template slot-scope="{ row, index }" slot="menu">
  20. <el-button type="text" size="small" @click="openDetail(row)">导入详情
  21. </el-button>
  22. </template>
  23. </avue-crud>
  24. </basic-container>
  25. </el-col>
  26. </el-row>
  27. <el-dialog title="导入详情" :visible.sync="detailDialog" width="60%" height="60%" :close-on-click-modal="false"
  28. append-to-body v-if="detailDialog">
  29. <rtuimportdetail :id="id" ref="rtuimportdetail">
  30. </rtuimportdetail>
  31. </el-dialog>
  32. </div>
  33. </template>
  34. <script>
  35. import { getPage } from "@/api/data/rtuImport.js";
  36. import rtuimportdetail from "./rtuimportdetail.vue";
  37. export default {
  38. components: {
  39. rtuimportdetail
  40. },
  41. data() {
  42. return {
  43. detailDialog: false,
  44. loading: false,
  45. id: "",
  46. editForm: {},
  47. editDialog: false,
  48. form: {},
  49. selectionList: [],
  50. query: {},
  51. page: {
  52. pageSize: 10,
  53. currentPage: 1,
  54. total: 0,
  55. },
  56. option: {
  57. labelWidth: 120,
  58. viewLabelWidth: 100,
  59. searchlabelWidth: 100,
  60. height: "auto",
  61. calcHeight: 80,
  62. align: "center",
  63. headerAlign: "center",
  64. lazy: false,
  65. tip: false,
  66. simplePage: true,
  67. searchShow: true,
  68. searchMenuSpan: 6,
  69. tree: true,
  70. border: true,
  71. index: true,
  72. selection: false,
  73. viewBtn: false,
  74. viewTitle: "测站导入",
  75. editBtn: false,
  76. delBtn: false,
  77. addBtn: false,
  78. menu: true,
  79. menuWidth: 120,
  80. dialogType: "drawer",
  81. dialogClickModal: false,
  82. columnBtn: false,
  83. column: [
  84. {
  85. label: "导入结果",
  86. prop: "importStatus",
  87. span: 24,
  88. width: 120,
  89. html: true,
  90. formatter: (val) => {
  91. if (val.importStatus === 0) {
  92. return '<b style="color:blue">导入中</b>'
  93. } else if (val.importStatus === 1) {
  94. return '<b style="color:green">导入成功</b>'
  95. } else if (val.importStatus === 2) {
  96. return '<b style="color:red">导入失败</b>'
  97. } else {
  98. return '';
  99. }
  100. },
  101. },
  102. {
  103. label: "操作用户",
  104. prop: "createUserName",
  105. span: 24,
  106. width: 120,
  107. editDisplay: false,
  108. addDisplay: false,
  109. hide: true,
  110. },
  111. {
  112. label: "导入时间",
  113. prop: "importTime",
  114. span: 24,
  115. width: 160,
  116. },
  117. {
  118. label: "导入说明",
  119. prop: "remark",
  120. span: 24,
  121. overHidden: true,
  122. },
  123. {
  124. label: "导入操作类型",
  125. prop: "saveType",
  126. span: 24,
  127. width: 120,
  128. html: true,
  129. formatter: (val) => {
  130. if (val.saveType === 0) {
  131. return '<b style="color:blue">只新增</b>'
  132. } else if (val.saveType === 1) {
  133. return '<b style="color:red">只更新</b>'
  134. } else if (val.saveType === 2) {
  135. return '<b style="color:red">新增或更新</b>'
  136. } else {
  137. return '';
  138. }
  139. },
  140. },
  141. {
  142. label: "文件名称",
  143. prop: "fileName",
  144. span: 24,
  145. overHidden: true,
  146. },
  147. ],
  148. },
  149. data: [],
  150. };
  151. },
  152. computed: {
  153. // ...mapGetters(["userInfo", "permission"]),
  154. permissionList() {
  155. return {
  156. // addBtn: this.vaildData(this.permission.docCategory_add, false),
  157. // viewBtn: this.vaildData(this.permission.docCategory_view, false),
  158. // delBtn: this.vaildData(this.permission.docCategory_delete, false),
  159. // editBtn: this.vaildData(this.permission.docCategory_edit, false),
  160. };
  161. },
  162. ids() {
  163. let ids = [];
  164. this.selectionList.forEach((ele) => {
  165. ids.push(ele.id);
  166. });
  167. return ids.join(",");
  168. },
  169. },
  170. mounted() { },
  171. created() {
  172. },
  173. methods: {
  174. openDetail(row) {
  175. this.id = row.id;
  176. this.detailDialog = true;
  177. this.$nextTick(() => {
  178. this.$refs["rtuimportdetail"].init();
  179. });
  180. },
  181. searchReset() {
  182. this.query = {};
  183. this.onLoad(this.page);
  184. },
  185. searchChange(params, done) {
  186. this.query = params;
  187. this.page.currentPage = 1;
  188. this.onLoad(this.page, params);
  189. done();
  190. },
  191. selectionChange(list) {
  192. this.selectionList = list;
  193. },
  194. selectionClear() {
  195. this.selectionList = [];
  196. this.$refs.crud.toggleSelection();
  197. },
  198. currentChange(currentPage) {
  199. this.page.currentPage = currentPage;
  200. },
  201. sizeChange(pageSize) {
  202. this.page.pageSize = pageSize;
  203. },
  204. refreshChange() {
  205. this.onLoad(this.page, this.query);
  206. },
  207. onLoad(page, params = {}) {
  208. this.loading = true;
  209. getPage(
  210. page.currentPage,
  211. page.pageSize,
  212. Object.assign(params, this.query)
  213. ).then((res) => {
  214. const data = res.data.data;
  215. this.page.total = data.total;
  216. this.data = data.records;
  217. this.loading = false;
  218. this.selectionClear();
  219. });
  220. },
  221. },
  222. };
  223. </script>