editionSetting.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 新建 -->
  4. <div class="add">
  5. <a-button type="primary" icon="plus" class="addBtn" @click="openModal()" id="editionSetting-openModal">新增</a-button>
  6. </div>
  7. <!-- table列表 -->
  8. <s-table
  9. ref="table"
  10. size="default"
  11. :rowKey="(row)=> row.id"
  12. :columns="columns"
  13. :data="loadData"
  14. bordered
  15. >
  16. <!-- 操作 -->
  17. <span slot="action" slot-scope="text, record">
  18. <template>
  19. <a-icon v-if="currentDate < new Date(record.publicDate).getTime()" type="edit" id="editionSetting-handleEdit" style="font-size: 20px;color: #1890FF;padding: 0 10px;" @click="handleEdit(record)" />
  20. <span v-if="currentDate > new Date(record.publicDate).getTime()">--</span>
  21. </template>
  22. </span>
  23. <template slot="upgradeContent" slot-scope="text, record">
  24. <span :title="record.upgradeContent" style="display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">{{ record.upgradeContent }}</span>
  25. </template>
  26. <span slot="forceUpgrade" slot-scope="text">
  27. <template>
  28. <span v-if=" text == '1'">是</span>
  29. <span v-if=" text == '0'">否</span>
  30. </template>
  31. </span>
  32. </s-table>
  33. </a-card>
  34. </template>
  35. <script>
  36. import { STable } from '@/components'
  37. import { getEditionSettingList } from '@/api/editionSetting.js'
  38. export default {
  39. name: 'EditionSetting',
  40. components: { STable },
  41. data () {
  42. return {
  43. columns: [
  44. {
  45. title: '序号',
  46. dataIndex: 'no',
  47. width: 60,
  48. align: 'center'
  49. },
  50. {
  51. title: '创建时间',
  52. width: 100,
  53. dataIndex: 'createDate',
  54. align: 'center'
  55. },
  56. {
  57. title: '版本号',
  58. width: 100,
  59. dataIndex: 'version',
  60. align: 'center'
  61. },
  62. {
  63. title: '强制升级',
  64. width: 100,
  65. dataIndex: 'forceUpgrade',
  66. align: 'center',
  67. scopedSlots: { customRender: 'forceUpgrade' }
  68. },
  69. {
  70. title: '升级内容',
  71. width: 100,
  72. dataIndex: 'upgradeContent',
  73. align: 'center',
  74. ellipsis: true, // 内容超过宽度 自动出现省略号
  75. scopedSlots: { customRender: 'upgradeContent' }
  76. },
  77. {
  78. title: '下载地址',
  79. width: 100,
  80. dataIndex: 'downloadUrl',
  81. align: 'center',
  82. customRender: (text) => {
  83. return text || '--'
  84. }
  85. },
  86. {
  87. title: '更新时间',
  88. width: 100,
  89. dataIndex: 'publicDate',
  90. align: 'center'
  91. },
  92. {
  93. title: '操作',
  94. // dataIndex: 'action',
  95. width: 100,
  96. align: 'center',
  97. scopedSlots: { customRender: 'action' }
  98. }
  99. ],
  100. applyCode: 'atit',
  101. applyName: 'IT后台',
  102. currentDate: new Date().getTime(), // 当前时间
  103. // 获取列表数据
  104. loadData: parameter => {
  105. return getEditionSettingList(Object.assign(parameter))
  106. .then(res => {
  107. const no = (res.data.pageNo - 1) * res.data.pageSize
  108. for (let i = 0; i < res.data.list.length; i++) {
  109. const _item = res.data.list[i]
  110. _item.no = no + i + 1
  111. }
  112. return res.data
  113. })
  114. },
  115. id: ''
  116. }
  117. },
  118. methods: {
  119. // 新增
  120. openModal () {
  121. this.$router.push({ name: 'editionSetting_add' })
  122. },
  123. // 编辑
  124. handleEdit (row) {
  125. console.log(row)
  126. this.$router.push({ name: 'editionSetting_edit', query: { id: row.id } })
  127. }
  128. }
  129. }
  130. </script>
  131. <style scoped>
  132. .addBtn{
  133. margin-bottom: 20px;
  134. }
  135. </style>