reportConfig.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <div class="container">
  3. <div class="header">
  4. <el-form label-width="120px">
  5. <div style="display: flex; padding: 10px">
  6. <el-form-item label="报告模板名称:">
  7. <el-input
  8. ref="search"
  9. v-model="form.templateName"
  10. suffix-icon="el-icon-search"
  11. placeholder="请输入模板名称"
  12. ></el-input>
  13. </el-form-item>
  14. <el-form-item label="报告模板格式:">
  15. <el-select
  16. placeholder="请选择模板格式"
  17. v-model="form.templateFormat"
  18. >
  19. <el-option
  20. v-for="item in reportFormatOptions"
  21. :key="item.value"
  22. :label="item.label"
  23. :value="item.value"
  24. ></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="报告类型:">
  28. <el-select placeholder="请选择报告类型" v-model="form.reportType">
  29. <el-option
  30. v-for="item in reportTypeOptions"
  31. :key="item.value"
  32. :label="item.label"
  33. :value="item.value"
  34. ></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-button class="reset-btn">重置</el-button>
  38. <el-button class="search-btn">查询</el-button>
  39. </div>
  40. </el-form>
  41. </div>
  42. <div class="content">
  43. <div class="content-inner-top">
  44. <div class="info">模板列表</div>
  45. <el-button class="add-btn">添加模板</el-button>
  46. <el-button class="delete-btn">批量删除</el-button>
  47. </div>
  48. <el-table
  49. ref="multipleTable"
  50. :data="tableData"
  51. tooltip-effect="dark"
  52. :header-cell-style="{ textAlign: 'center' }"
  53. :cell-style="{ textAlign: 'center' }"
  54. style="width: 100%"
  55. @selection-change="handleSelectionChange"
  56. >
  57. <el-table-column type="selection" width="50"> </el-table-column>
  58. <el-table-column prop="templateName" label="模板名称">
  59. </el-table-column>
  60. <el-table-column prop="templateFormat" label="模板格式">
  61. </el-table-column>
  62. <el-table-column prop="reportType" label="报告类型"> </el-table-column>
  63. <el-table-column prop="createUser" label="创建用户"> </el-table-column>
  64. <el-table-column prop="createTime" label="创建时间"> </el-table-column>
  65. <el-table-column prop="alterTime" label="修改时间"> </el-table-column>
  66. <el-table-column prop="operation" label="操作">
  67. <template slot-scope="scope">
  68. <el-button
  69. v-show="scope.row.templateName == null ? false : true"
  70. size="mini"
  71. type="text"
  72. style="color: #2ea8e6"
  73. >点击下载</el-button
  74. >
  75. <el-button
  76. v-show="scope.row.templateName == null ? false : true"
  77. size="mini"
  78. type="text"
  79. style="color: #2ea8e6"
  80. >编辑</el-button
  81. >
  82. <el-button
  83. v-show="scope.row.templateName == null ? false : true"
  84. size="mini"
  85. type="text"
  86. style="color: #2ea8e6"
  87. >删除</el-button
  88. >
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. </div>
  93. <div class="bottom">
  94. <page :paginationData="paginationData"></page>
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. import checkbox from "@/components/Checkbox/index";
  100. import page from "@/components/pagination/index";
  101. import { addReportTemplate, getReportTemplateList } from "@/api/data/template";
  102. export default {
  103. components: { checkbox, page },
  104. data() {
  105. return {
  106. total: 0,
  107. input: "",
  108. show: true,
  109. form: {
  110. templateName: "",
  111. templateFormat: "",
  112. reportType: "",
  113. },
  114. reportFormatOptions: [
  115. {
  116. value: "",
  117. label: "全部",
  118. },
  119. {
  120. value: "Word",
  121. label: "Word",
  122. },
  123. {
  124. value: "Excel",
  125. label: "Excel",
  126. },
  127. {
  128. value: "PDF",
  129. label: "PDF",
  130. },
  131. ],
  132. reportTypeOptions: [
  133. {
  134. value: "",
  135. label: "全部",
  136. },
  137. {
  138. value: "年度报告",
  139. label: "年度报告",
  140. },
  141. {
  142. value: "季度报告",
  143. label: "季度报告",
  144. },
  145. {
  146. value: "月度报告",
  147. label: "月度报告",
  148. },
  149. ],
  150. tableData: [],
  151. // tableData: [
  152. // {
  153. // templateName: "模板1",
  154. // templateFormat: "txt",
  155. // createUser: "test",
  156. // createTime: "2023-01-01 00:00",
  157. // alterTime: "2023-01-01 00:00",
  158. // },
  159. // {
  160. // templateName: "模板1",
  161. // templateFormat: "txt",
  162. // createUser: "test",
  163. // createTime: "2023-01-01 00:00",
  164. // alterTime: "2023-01-01 00:00",
  165. // },
  166. // {
  167. // templateName: "模板1",
  168. // templateFormat: "txt",
  169. // createUser: "test",
  170. // createTime: "2023-01-01 00:00",
  171. // alterTime: "2023-01-01 00:00",
  172. // },
  173. // ],
  174. defaultProps: {
  175. children: "children",
  176. label: "label",
  177. },
  178. currentPageSize: 10,
  179. currentPage: 1,
  180. paginationData: {
  181. pageSize: 10,
  182. pagerCount: 5,
  183. currentPage: 1,
  184. pageSizes: [5, 10, 20, 30],
  185. total: 30,
  186. currentChange: (val) => {
  187. this.getTableData(val);
  188. },
  189. handleSizeChange: (val) => {
  190. this.handleSizeChange(val);
  191. },
  192. },
  193. multipleSelection: [],
  194. };
  195. },
  196. mounted() {
  197. this.initData();
  198. },
  199. watch: {
  200. filterText(val) {
  201. this.$refs.search.filter(val);
  202. },
  203. },
  204. methods: {
  205. initData() {
  206. this.getTableData(1);
  207. },
  208. filterNode(value, data) {
  209. if (!value) return true;
  210. return data.label.indexOf(value) !== -1;
  211. },
  212. getTableData(val) {
  213. this.tableData = [];
  214. getReportTemplateList(
  215. val,
  216. this.currentPageSize,
  217. 1,
  218. this.form.templateName,
  219. this.form.templateFormat,
  220. this.form.reportType
  221. ).then((res) => {
  222. if (res.data.code === 0 && res.data.data.length > 0) {
  223. this.tableData = res.data.data.map((v) => {
  224. return {
  225. id: v.id,
  226. templateName: v.name,
  227. templateFormat: v.format,
  228. reportType: v.report_type || "--",
  229. createUser: v.creator,
  230. createTime: v.create_time,
  231. alterTime: v.update_time,
  232. templateUrl: v.template_url,
  233. };
  234. });
  235. }
  236. });
  237. },
  238. handleSizeChange(val) {
  239. this.currentPageSize = val;
  240. this.getTableData(this.currentPage);
  241. },
  242. handleSelectionChange(val) {
  243. this.multipleSelection = val;
  244. },
  245. },
  246. };
  247. </script>
  248. <style lang="less" scoped>
  249. .container {
  250. position: absolute;
  251. left: 218px;
  252. top: 80px;
  253. right: 16px;
  254. bottom: 20px;
  255. line-height: 20px;
  256. background-color: rgba(255, 255, 255, 1);
  257. color: rgba(16, 16, 16, 1);
  258. font-size: 14px;
  259. text-align: center;
  260. overflow-y: auto;
  261. //box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.15);
  262. .header {
  263. margin: 2%;
  264. width: 96%;
  265. height: 60px;
  266. background-color: #fafafa;
  267. position: relative;
  268. border-radius: 4px;
  269. .reset-btn,
  270. .search-btn {
  271. height: 30px;
  272. width: 80px;
  273. position: absolute;
  274. color: #fff;
  275. display: flex;
  276. align-items: center;
  277. justify-content: center;
  278. top: 15px;
  279. }
  280. .reset-btn {
  281. background-color: #b3b3b3;
  282. right: 130px;
  283. }
  284. .search-btn {
  285. background-color: #2ea8e6;
  286. right: 25px;
  287. }
  288. .el-form-item {
  289. margin-bottom: 0 !important;
  290. margin-right: 60px !important;
  291. /deep/.el-form-item {
  292. margin-right: 50px;
  293. margin-bottom: 0;
  294. }
  295. /deep/.el-form-item__content {
  296. margin-left: 120px;
  297. }
  298. }
  299. }
  300. .content {
  301. width: 95%;
  302. position: absolute;
  303. margin-left: 2.5%;
  304. margin-right: 2.5%;
  305. margin-top: 30px;
  306. height: calc(80% - 110px);
  307. &-inner-top {
  308. width: 100%;
  309. height: 100px;
  310. position: absolute;
  311. .info {
  312. position: absolute;
  313. width: 150px;
  314. top: 0;
  315. left: 0;
  316. height: 60px;
  317. font-size: 25px;
  318. display: flex;
  319. align-items: center;
  320. font-weight: 550;
  321. color: #4d4d4d;
  322. }
  323. .add-btn,
  324. .delete-btn {
  325. padding: 3px;
  326. width: 80px;
  327. height: 30px;
  328. bottom: 15px;
  329. position: absolute;
  330. color: #fff;
  331. border-radius: 4px;
  332. }
  333. .add-btn {
  334. right: 100px;
  335. background-color: #2ea8e6;
  336. }
  337. .delete-btn {
  338. right: 10px;
  339. background-color: #b3b3b3;
  340. }
  341. }
  342. .el-table {
  343. position: absolute;
  344. top: 100px;
  345. width: 100%;
  346. height: calc(100% - 100px);
  347. border: 1px solid #f0f2f2;
  348. margin-top: 10px;
  349. font-size: 0.95rem;
  350. font-family: PingFang SC;
  351. font-weight: 500;
  352. color: #b2b2b2;
  353. background: rgba(255, 255, 255, 0.8);
  354. /deep/th {
  355. background: #f7fbff;
  356. }
  357. /deep/.el-checkbox {
  358. color: #b2b2b2;
  359. .el-checkbox__input.is-checked + .el-checkbox__label {
  360. color: #2ea8e6;
  361. }
  362. .el-checkbox__input.is-checked .el-checkbox__inner::after {
  363. width: 70%;
  364. height: 70%;
  365. background: #2ea8e6;
  366. border-radius: 0;
  367. transform: rotate(0deg) scaleY(1);
  368. position: static;
  369. // border: 1px solid #8DD9FF;
  370. }
  371. .el-checkbox__inner {
  372. border: 1px solid #8dd9ff;
  373. background: rgba(0, 170, 255, 0);
  374. display: flex;
  375. align-items: center;
  376. justify-content: center;
  377. position: static;
  378. &::after {
  379. transition: 0ms;
  380. }
  381. }
  382. .el-checkbox__label {
  383. padding-left: 0;
  384. font-size: 15px;
  385. position: absolute;
  386. top: 1px;
  387. left: 25px;
  388. }
  389. }
  390. }
  391. .el-select {
  392. width: 80px;
  393. margin-right: 20px;
  394. }
  395. }
  396. .bottom {
  397. position: absolute;
  398. left: 20px;
  399. right: 16px;
  400. bottom: 20px;
  401. height: 50px;
  402. line-height: 20px;
  403. background-color: rgba(255, 255, 255, 1);
  404. text-align: center;
  405. .checkbox {
  406. position: absolute;
  407. left: 29px;
  408. top: 15px;
  409. font-size: 14px;
  410. }
  411. .check-cancel {
  412. position: absolute;
  413. // line-height: 20px;
  414. font-size: 14px;
  415. text-align: center;
  416. left: 140px;
  417. top: 10px;
  418. }
  419. .bottom_button {
  420. position: absolute;
  421. left: 200px;
  422. margin-top: 15px;
  423. .delete {
  424. font-size: 14px;
  425. text-align: center;
  426. padding: 1px;
  427. }
  428. .disabled {
  429. font-size: 14px;
  430. text-align: center;
  431. padding: 1px;
  432. }
  433. .export {
  434. font-size: 14px;
  435. text-align: center;
  436. padding: 1px;
  437. }
  438. }
  439. }
  440. }
  441. </style>