index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="filter-control">
  5. <span>培训医师姓名:</span>
  6. <el-input v-model="listQuery.doctorName" placeholder="培训医师姓名" @keyup.enter.native="handleFilter" />
  7. </div>
  8. <div class="filter-control">
  9. <span>审核状态:</span>
  10. <el-select v-model="listQuery.auditStatus" placeholder="审核状态" clearable @change="getList">
  11. <el-option label="全部" value="" />
  12. <el-option label="待审核" :value="2" />
  13. <el-option label="审核通过" :value="1" />
  14. <el-option label="审核未通过" :value="0" />
  15. </el-select>
  16. </div>
  17. <div class="filter-control">
  18. <span>上线状态:</span>
  19. <el-select v-model="listQuery.status" placeholder="上线状态" clearable @change="getList">
  20. <el-option label="全部" value="" />
  21. <el-option label="已上线" :value="1" />
  22. <el-option label="待上线" :value="2" />
  23. <el-option label="未上线" :value="0" />
  24. </el-select>
  25. </div>
  26. <div class="filter-control">
  27. <permission-button type="primary" @click="getList">查询</permission-button>
  28. <permission-button type="primary" @click="$_navigationTo('add?type=add')">添加</permission-button>
  29. </div>
  30. </div>
  31. <!-- 表格区域 -->
  32. <el-table
  33. :key="tableKey"
  34. v-loading="listLoading"
  35. :data="list"
  36. border
  37. fit
  38. highlight-current-row
  39. style="width: 100%;"
  40. header-row-class-name="tableHeader"
  41. >
  42. <el-table-column label="序号" :index="indexMethod" type="index" align="center" width="80" />
  43. <el-table-column label="培训医师姓名" align="center" prop="doctorName" />
  44. <el-table-column label="从业资格证编号" align="center" prop="certificateNo" />
  45. <el-table-column label="审核状态" width="220px" align="center">
  46. <template slot-scope="{ row }">
  47. <el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
  48. <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
  49. <!-- 未通过原因展示 -->
  50. <template v-if="row.auditStatus === 0">
  51. <!-- <span class="status danger">审核未通过&nbsp;</span> -->
  52. <el-popover placement="top-start" title="审核说明" width="400" trigger="hover" :content="row.invalidReason">
  53. <el-tag slot="reference" size="small" type="danger" class="reason">
  54. <span>审核未通过</span>
  55. <span class="el-icon-question status danger " />
  56. </el-tag>
  57. </el-popover>
  58. <!-- 未通过原因展示END -->
  59. </template>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="上线状态" width="140px" align="center">
  63. <template slot-scope="{ row }">
  64. <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
  65. <template v-if="row.auditStatus === 1">
  66. <template v-if="row.status === 0">
  67. <span style="margin-right:10px;" class="status danger">已下线</span>
  68. <permission-button type="primary" size="mini" @click="handleChangeStatus(row)">上线</permission-button>
  69. </template>
  70. <template v-else>
  71. <span style="margin-right:10px;" class="status success ">已上线</span>
  72. <permission-button type="info" size="mini" @click="handleChangeStatus(row)">下线</permission-button>
  73. </template>
  74. </template>
  75. <template v-else-if="row.auditStatus === 2">
  76. <!-- <el-tag type="warning">待上线</el-tag> -->
  77. <span style="margin-right:10px;" class="status warning">待上线</span>
  78. </template>
  79. <template v-else>
  80. <!-- <el-tag type="warning">待上线</el-tag> -->
  81. <span style="margin-right:10px;" class="status danger">已下线</span>
  82. </template>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="创建时间" class-name="status-col" width="300px" align="center">
  86. <template slot-scope="{ row }">
  87. <span>{{ row.createTime | formatTime }}</span>
  88. </template>
  89. </el-table-column>
  90. <!-- <el-table-column v-if="false" label="创建人" width="180px" align="center" prop="createBy" /> -->
  91. <el-table-column label="操作" align="center" width="240px" class-name="small-padding fixed-width">
  92. <template slot-scope="{ row }">
  93. <permission-button type="primary" size="mini" @click="$_navigationTo(`edit?type=edit&id=${row.doctorId}`)">
  94. 编辑
  95. </permission-button>
  96. <permission-button type="danger" size="mini" @click="handleRemoveDoctor(row)">
  97. 删除
  98. </permission-button>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <!-- 页码 -->
  103. <pagination
  104. v-show="total > 0"
  105. :total="total"
  106. :page.sync="listQuery.pageNum"
  107. :limit.sync="listQuery.pageSize"
  108. @pagination="getList"
  109. />
  110. </div>
  111. </template>
  112. <script>
  113. import PermissionButton from '@/views/components/PermissionButton'
  114. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  115. import { mapGetters } from 'vuex'
  116. import { formatDate } from '@/utils'
  117. import { fetchDoctorList, removeDoctor, doctorStatusChange } from '@/api/doctor'
  118. export default {
  119. components: { Pagination, PermissionButton },
  120. filters: {
  121. formatTime(time) {
  122. if (!time) {
  123. return ''
  124. }
  125. return formatDate(time, 'yyyy-MM-DD HH:mm:ss')
  126. }
  127. },
  128. data() {
  129. return {
  130. listLoading: false,
  131. tableKey: 0,
  132. total: 0,
  133. listQuery: {
  134. listType: 1,
  135. doctorName: '',
  136. auditStatus: '',
  137. status: '',
  138. pageNum: 1,
  139. pageSize: 10
  140. },
  141. list: []
  142. }
  143. },
  144. computed: {
  145. ...mapGetters(['authUserId'])
  146. },
  147. created() {
  148. this.getList()
  149. },
  150. methods: {
  151. // 获取列表
  152. getList() {
  153. this.listQuery.authUserId = this.authUserId
  154. fetchDoctorList(this.listQuery).then(res => {
  155. console.log(res)
  156. this.list = res.data.list
  157. this.total = res.data.total
  158. })
  159. },
  160. // 修改状态
  161. handleChangeStatus(row) {
  162. const status = row.status === 1 ? 0 : 1
  163. doctorStatusChange({ doctorId: row.doctorId, status }).then(res => {
  164. this.$message.success('状态修改成功')
  165. this.getList()
  166. })
  167. },
  168. // 删除
  169. async handleRemoveDoctor(row) {
  170. const text = await this.$confirm('确认删除该医师信息吗?删除后不可恢复', '提示', {
  171. confirmButtonText: '确定',
  172. cancelButtonText: '取消',
  173. type: 'warning'
  174. }).catch(() => {
  175. this.$message.info('已取消操作')
  176. })
  177. if (text !== 'confirm') return
  178. removeDoctor({ doctorId: row.doctorId }).then(res => {
  179. this.$message.success('删除成功')
  180. this.getList()
  181. })
  182. },
  183. // 表格索引
  184. indexMethod(index) {
  185. return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped></style>