人民医院前端

index.vue 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="app-container usermanage">
  3. <div class="filter-container">
  4. <el-input v-model="keyword" placeholder="请输入标题或内容" class="filter-item" size="medium" clearable />
  5. <el-button type="primary" class="filter-item" @click="btn_search">搜索</el-button>
  6. <el-button v-if="isnotice == '0'" type="primary" class="filter-item" @click="btn_add()">发布公告</el-button>
  7. <el-button v-if="isnotice == '0'" type="danger" class="filter-item" @click="btn_del">批量删除</el-button>
  8. </div>
  9. <el-table v-loading="loading" :data="dataLists" border stripe @selection-change="changeSelects">
  10. <el-table-column type="selection" width="55" />
  11. <el-table-column prop="F_Title" label="公告标题" align="center">
  12. <template slot-scope="scope">
  13. <el-button type="text" size="small" @click="btn_detail(scope.row.F_NoticeId)">
  14. {{ scope.row.F_Title.length>20?scope.row.F_Title.substring(0,20)+'...':scope.row.F_Title }}
  15. </el-button>
  16. </template>
  17. </el-table-column>
  18. <el-table-column prop="F_CreateByName" label="发布人" align="center" min-width />
  19. <el-table-column prop="F_CreateOn" label="发布时间" align="center" min-width />
  20. <el-table-column prop="F_EndDate" label="有效期" align="center" min-width />
  21. <el-table-column prop="F_Frequency" label="点击量" align="center" min-width />
  22. <el-table-column v-if="isnotice == '0'" label="操作" align="center">
  23. <template slot-scope="scope">
  24. <el-button type="text" @click="btn_edit(scope.row.F_NoticeId)">编辑</el-button>
  25. <el-button type="text" @click="btn_top(scope.row.F_NoticeId)">置顶</el-button>
  26. <el-button type="text" @click="btn_delete(scope.row.F_NoticeId)">删除</el-button>
  27. </template>
  28. </el-table-column>
  29. </el-table>
  30. <pagination
  31. v-show="pageParams.total > 0"
  32. :total="pageParams.total"
  33. :pageindex.sync="pageParams.pageindex"
  34. :pagesize.sync="pageParams.pagesize"
  35. class="pagination"
  36. @pagination="getList" />
  37. </div>
  38. </template>
  39. <script>
  40. import {
  41. getGetList,
  42. getAddNotice,
  43. getSeeNotice,
  44. getDelNotice,
  45. getTopNotice
  46. } from '@/api/AnnounceManagement/announce'
  47. import Pagination from '@/components/context/Pagination' // 对el-pagination 二次封装
  48. import noticeAddOrEdit from './components/AddOrEdit.vue'
  49. import Detail from './components/detail.vue'
  50. export default {
  51. name: 'Notice',
  52. components: {
  53. Pagination
  54. },
  55. props: {
  56. },
  57. data() {
  58. return {
  59. loading: false,
  60. isnotice: '0',
  61. keyword: '',
  62. pageParams: {
  63. pageindex: 1, // 当前第几页
  64. pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
  65. total: 1 // 总共多少数据
  66. },
  67. multipleSelection: [], // 选中的数据
  68. selectArr: [],
  69. dataLists: [] // 列表数据
  70. }
  71. },
  72. watch: {
  73. // '$route'(to, from) {
  74. // console.log(from)
  75. // if (from.name == "Dashboard") {
  76. // this.isnotice = this.$route.params.isNotice
  77. // }else{
  78. // this.isnotice = '0'
  79. // }
  80. // }
  81. },
  82. activated() {
  83. this.isnotice = this.$route.params.isNotice || '0'
  84. },
  85. created() {
  86. this.getList()
  87. },
  88. methods: {
  89. // 复选框状态改变
  90. changeSelects(val) {
  91. this.multipleSelection = val
  92. this.selectArr = val.map(item => item.F_NoticeId)
  93. },
  94. getList() {
  95. const params = {
  96. page: this.pageParams.pageindex,
  97. pagesize: this.pageParams.pagesize,
  98. content: this.keyword
  99. }
  100. getGetList(params).then(res => {
  101. this.dataLists = res.rows
  102. this.pageParams.total = res.total
  103. })
  104. },
  105. btn_search() {
  106. this.getList()
  107. },
  108. // 添加
  109. btn_add() {
  110. this.$layer.iframe({
  111. content: {
  112. content: noticeAddOrEdit, // 传递的组件对象
  113. parent: this, // 当前的vue对象
  114. data: {
  115. } // props
  116. },
  117. area: ['70%', '72%'],
  118. title: '添加公告'
  119. })
  120. },
  121. btn_edit(id) {
  122. this.$layer.iframe({
  123. content: {
  124. content: noticeAddOrEdit, // 传递的组件对象
  125. parent: this, // 当前的vue对象
  126. data: {
  127. rowid: id.toString()
  128. } // props
  129. },
  130. area: ['70%', '72%'],
  131. title: '编辑公告'
  132. })
  133. },
  134. btn_detail(rowdata) {
  135. this.$layer.iframe({
  136. content: {
  137. content: Detail, // 传递的组件对象
  138. parent: this, // 当前的vue对象
  139. data: {
  140. rowdata: rowdata.toString()
  141. } // props
  142. },
  143. area: ['70%', '70%'],
  144. title: '公告详情'
  145. })
  146. },
  147. btn_top(rid) {
  148. this.$confirm('您确定要将此公告置顶吗?', '提示', {
  149. confirmButtonText: '确定',
  150. cancelButtonText: '取消',
  151. type: 'warning'
  152. })
  153. .then(() => {
  154. const params = {
  155. noticeid: rid
  156. }
  157. getTopNotice(params).then(res => {
  158. if (res.state == 'success') {
  159. this.$message.success('操作成功')
  160. this.getList()
  161. }
  162. })
  163. })
  164. .catch(() => {
  165. this.$message('已取消')
  166. })
  167. },
  168. btn_delete(rid) {
  169. this.ondel(rid)
  170. },
  171. btn_del() {
  172. if (this.multipleSelection.length <= 0) {
  173. this.$message.warning('没有可删除的选项')
  174. return
  175. }
  176. const rid = this.selectArr.toString()
  177. this.ondel(rid)
  178. },
  179. ondel(rid) {
  180. this.$confirm('您确定要将此公告删除吗?', '提示', {
  181. confirmButtonText: '确定',
  182. cancelButtonText: '取消',
  183. type: 'warning'
  184. })
  185. .then(() => {
  186. const params = {
  187. ids: rid
  188. }
  189. getDelNotice(params).then(res => {
  190. if (res.state == 'success') {
  191. this.$message.success('删除成功')
  192. this.getList()
  193. }
  194. })
  195. })
  196. .catch(() => {
  197. this.$message('已取消')
  198. })
  199. }
  200. }
  201. }
  202. </script>
  203. <style rel="stylesheet/scss" lang="scss" scoped>
  204. </style>