index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <div class="content-container">
  3. <el-row class="tool-bar">
  4. <el-col :span="12" class="left">
  5. <div class="content-title">
  6. {{ title }}
  7. </div>
  8. </el-col>
  9. <el-col :span="12" class="right">
  10. <el-input v-model="conditions.keywords" class="search-input m-right-15" size="mini" placeholder="请输入内容">
  11. <el-button slot="append" icon="el-icon-search" size="mini" @click="getData()" />
  12. </el-input>
  13. <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">添加</el-button>
  14. </el-col>
  15. </el-row>
  16. <el-row class="content-body">
  17. <el-table v-loading="listLoading" class="page-table" border :data="dataList" height="calc(100vh - 220px)">
  18. <el-table-column type="index" label="序号" header-align="center" align="center" width="80" />
  19. <el-table-column prop="checklistTitle" label="名称" header-align="left" align="left" width="260">
  20. <template v-slot="{row}">
  21. <span><i class="el-icon-tickets" /> {{ row.checklistTitle }}</span>
  22. </template>
  23. </el-table-column>
  24. <el-table-column prop="checklistCatTitle" label="类别" header-align="center" align="center" width="200">
  25. <template v-slot="{row}">
  26. <span><el-tag effect="plain" color="rgb(38 69 90)">{{ row.checklistCatTitle }}</el-tag></span>
  27. </template>
  28. </el-table-column>
  29. <el-table-column prop="checklistDesc" label="说明" header-align="left" align="left">
  30. <template v-slot="{row}">
  31. <span>{{ row.checklistDesc }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column prop="issuedAt" label="变更人" header-align="center" align="center" width="200">
  35. <template v-slot="{row}">
  36. <i class="el-icon-user" />
  37. <span> {{ row.issuedAccountName }}</span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column prop="issuedAt" label="变更时间" header-align="center" align="center" width="200">
  41. <template v-slot="{row}">
  42. <i class="el-icon-time" />
  43. <span> {{ row.issuedAt | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="操作" header-align="center" align="center" width="180">
  47. <template v-slot="{row}">
  48. <el-button size="mini" icon="el-icon-view" type="primary" @click="handleDetails(row)">详情</el-button>
  49. <el-button v-if="row.isFixed !== 1" size="mini" icon="el-icon-delete" type="danger" @click="handleDelete(row)">删除</el-button>
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. <div class="pagination-wrap">
  54. <pagination v-show="total>0" :total="total" :page.sync="conditions.page" :limit.sync="conditions.limit" @pagination="getData" />
  55. </div>
  56. </el-row>
  57. <checklist ref="AddChecklist" title="新增" @formSuccess="AddChecklistSuccess" />
  58. <checklist-details ref="ChecklistDetails" title="详情" @formSuccess="getData" />
  59. </div>
  60. </template>
  61. <script>
  62. import Checklist from './components/Checklist'
  63. import ChecklistDetails from './components/Details'
  64. import { deleteChecklistById, getChecklistByPage } from '@/api/system/checklistApi'
  65. import { Pagination } from '@/components'
  66. export default {
  67. name: 'ChecklistIndex',
  68. components: {
  69. Pagination,
  70. Checklist,
  71. ChecklistDetails
  72. },
  73. data() {
  74. return {
  75. title: '清单管理',
  76. listLoading: false,
  77. total: 0,
  78. dataList: [],
  79. conditions: {
  80. page: 1,
  81. limit: 10,
  82. checklistTypeId: 3, // 同story ID
  83. keywords: ''
  84. }
  85. }
  86. },
  87. mounted() {
  88. this.getData()
  89. },
  90. methods: {
  91. // fetch data
  92. getData() {
  93. this.listLoading = true
  94. getChecklistByPage(this.conditions).then((resp) => {
  95. this.listLoading = false
  96. const { data, total } = resp
  97. this.dataList = data
  98. this.total = total
  99. }).catch((error) => {
  100. console.log(error)
  101. })
  102. },
  103. // 新增
  104. AddChecklistSuccess(data) {
  105. this.getData()
  106. this.handleDetails(data)
  107. },
  108. // 修改
  109. handleAdd() {
  110. this.$refs['AddChecklist'].showAddModel()
  111. },
  112. // 详情
  113. handleDetails(data) {
  114. const { checklistId } = data
  115. this.$refs['ChecklistDetails'].showModel(checklistId)
  116. },
  117. // Delete Handling
  118. handleDelete(data) {
  119. const { checklistId, checklistTitle } = data
  120. this.$confirm(`此操作将删除该数据${checklistTitle}, 是否继续?`, '提示', {
  121. confirmButtonText: '确定',
  122. cancelButtonText: '取消',
  123. type: 'warning'
  124. }).then(() => {
  125. deleteChecklistById(checklistId).then((resp) => {
  126. const { msg } = resp
  127. this.getData()
  128. this.$message.success(msg)
  129. }).catch((error) => {
  130. console.log(error)
  131. })
  132. }).catch(() => {
  133. this.$message({ type: 'info', message: '已取消删除' })
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss">
  140. </style>
  141. <style lang="scss" scoped>
  142. </style>