index.vue 5.1 KB

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