reportConfig.vue 12 KB

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