templateDownload.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <div>
  3. <el-button type="primary" size="mini" @click="openDialog">模板导出</el-button>
  4. <el-dialog
  5. title="选择目标模板"
  6. :visible.sync="open"
  7. >
  8. <el-form size="mini" label-width="120px" >
  9. <el-row :gutter="10">
  10. <el-col :span="1.5">
  11. <el-form-item label="年度">
  12. <el-input
  13. v-model="queryParams.year"
  14. clearable
  15. style="width: 200px"
  16. />
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="1.5">
  20. <el-form-item label="模板名称">
  21. <el-input
  22. v-model="queryParams.name"
  23. clearable
  24. style="width: 200px"
  25. />
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="1.5">
  29. <el-form-item>
  30. <el-button type="primary" icon="el-icon-search" plain @click="useSearch">搜索</el-button>
  31. <el-button icon="el-icon-refresh" plain @click="useReset">重置</el-button>
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. </el-form>
  36. <el-table
  37. :data="tableData"
  38. size="mini"
  39. @row-dblclick="useDoubleClick"
  40. height="450px"
  41. >
  42. <el-table-column show-overflow-tooltip label="年度" align="center" width="100" prop="year">
  43. <template slot-scope="scope">
  44. {{scope.row.year}}
  45. </template>
  46. </el-table-column>
  47. <el-table-column show-overflow-tooltip label="模板名称" align="center" width="200" prop="name"/>
  48. <el-table-column show-overflow-tooltip label="开始日期" align="center" width="150" prop="startTime" />
  49. <el-table-column show-overflow-tooltip label="结束日期" align="center" width="150" prop="deadlineTime" />
  50. <el-table-column show-overflow-tooltip label="周期" align="center" width="100" prop="cycle">
  51. <template slot-scope="scope">
  52. <dict-tag
  53. :options="dict.type.mk_periodic_unit"
  54. :value="scope.row.cycle"
  55. />
  56. </template>
  57. </el-table-column>
  58. <el-table-column show-overflow-tooltip label="创建人" align="center" width="150" prop="createByName" />
  59. <el-table-column show-overflow-tooltip label="创建时间" align="center" width="150" prop="createTime" />
  60. </el-table>
  61. <el-pagination
  62. background
  63. @size-change="useChangePageSize"
  64. @current-change="useCurrentChange"
  65. :current-page="queryParams.pageNum"
  66. :page-sizes="[10, 15, 20]"
  67. :page-size="100"
  68. layout="total, sizes, prev, pager, next, jumper"
  69. :total=total>
  70. </el-pagination>
  71. </el-dialog>
  72. </div>
  73. </template>
  74. <script>
  75. import { listTargetTemplate,download } from "@/api/business/spd/starget/targetTemplate";
  76. export default {
  77. name: 'templateList',
  78. dicts: ["mk_periodic_unit"],
  79. data() {
  80. return {
  81. //是否打开弹窗
  82. open:false,
  83. //搜索框参数
  84. queryParams:{
  85. year: null,
  86. name: null,
  87. pageNum: 1,
  88. pageSize: 10
  89. },
  90. //总条数
  91. total: 0,
  92. //列表数据
  93. tableData:[],
  94. };
  95. },
  96. watch: {},
  97. created() {
  98. },
  99. methods: {
  100. //打开弹窗
  101. openDialog(){
  102. this.open = true;
  103. this.getList();
  104. },
  105. //获取列表数据
  106. async getList() {
  107. try {
  108. this.loading = true;
  109. const { code, rows, total } = await listTargetTemplate(this.queryParams);
  110. if (code === 200) {
  111. this.tableData = rows;
  112. this.total = total;
  113. }
  114. } catch (err) {
  115. // catch
  116. console.error(err);
  117. } finally {
  118. // finally
  119. this.loading = false;
  120. }
  121. },
  122. //双击选择
  123. async useDoubleClick(row){
  124. try {
  125. await download(row.id);
  126. } catch (err) {
  127. console.error(err);
  128. } finally {
  129. this.open = false;
  130. }
  131. },
  132. //搜索
  133. useSearch(){
  134. this.getList(this.queryParams);
  135. },
  136. //重置
  137. useReset(){
  138. this.queryParams = {
  139. year: null,
  140. name: null,
  141. pageNum: 1,
  142. pageSize: 10
  143. }
  144. this.getList(this.queryParams);
  145. },
  146. //改变一页显示条数
  147. useChangePageSize(val){
  148. this.queryParams.pageSize = val
  149. this.getList(this.queryParams)
  150. },
  151. //翻页
  152. useCurrentChange(val){
  153. this.queryParams.pageNum = val
  154. this.getList(this.queryParams)
  155. },
  156. },
  157. created() {},
  158. mounted() {},
  159. destroyed() {},
  160. };
  161. </script>
  162. <style lang="scss" scoped>
  163. .el-pagination {
  164. margin-top: 10px;
  165. text-align: right;
  166. }
  167. </style>