systemNotify.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div>
  3. <!-- 搜索标题 -->
  4. <auth auths="news/add/system">
  5. <div @click="openTeaching('create')" class="newBand">新建</div>
  6. </auth>
  7. <!-- 搜索标题 -->
  8. <save-form :inline="true"
  9. class="searchForm"
  10. :saveKey="'contentAdvert'"
  11. @submit="search"
  12. :model="searchForm">
  13. <el-form-item prop="organIdList">
  14. <select-all class="multiple" clearable
  15. filterable
  16. collapse-tags
  17. multiple
  18. v-model.trim="searchForm.organIdList"
  19. placeholder="请选择分部">
  20. <el-option v-for="(item,index) in selects.branchs"
  21. :key="index"
  22. :label="item.name"
  23. :value="item.id"></el-option>
  24. </select-all>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button native-type="submit" type="danger">搜索</el-button>
  28. </el-form-item>
  29. </save-form>
  30. <!-- 列表 -->
  31. <div class="tableWrap">
  32. <el-table :data="tableList"
  33. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  34. <el-table-column align="center"
  35. prop="title"
  36. label="标题"></el-table-column>
  37. <el-table-column align="center"
  38. prop="remark"
  39. label="是否使用">
  40. <template slot-scope="scope">{{ scope.row.status == 1 ? '是' : '否' }}</template>
  41. </el-table-column>
  42. <el-table-column align="center"
  43. prop="order"
  44. label="排序"></el-table-column>
  45. <el-table-column align="center"
  46. label="外链地址">
  47. <template slot-scope="scope">
  48. <overflow-text :text="scope.row.linkUrl"></overflow-text>
  49. </template>
  50. </el-table-column>
  51. <el-table-column align="center"
  52. prop="remark"
  53. label="适用分部">
  54. <template slot-scope="scope">
  55. <overflow-text :text="scope.row.organNameList"></overflow-text>
  56. </template>
  57. </el-table-column>
  58. <el-table-column align="center"
  59. label="操作">
  60. <template slot-scope="scope">
  61. <div>
  62. <auth auths="news/update/system" style="margin-left: 10px">
  63. <el-button
  64. @click="openTeaching('update', scope.row)"
  65. type="text"
  66. >修改</el-button
  67. >
  68. </auth>
  69. <auth v-if="scope.row.status == 1" auths="news/update/systemStop" style="margin-left: 10px">
  70. <el-button
  71. @click="onStop(scope.row, 0)"
  72. type="text"
  73. >停用</el-button
  74. >
  75. </auth>
  76. <auth v-else auths="news/update/systemStart" style="margin-left: 10px">
  77. <el-button @click="onStop(scope.row, 1)" type="text"
  78. >启用</el-button
  79. >
  80. </auth>
  81. <auth auths="news/del/system" style="margin-left: 10px">
  82. <el-button @click="onDel(scope.row)" type="text"
  83. >删除</el-button
  84. >
  85. </auth>
  86. </div>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <pagination sync :total.sync="pageInfo.total"
  91. :page.sync="pageInfo.page"
  92. :limit.sync="pageInfo.limit"
  93. :page-sizes="pageInfo.page_size"
  94. @pagination="getList" />
  95. </div>
  96. <el-dialog
  97. :title="formTitle[formActionTitle]"
  98. :visible.sync="notifyStatus"
  99. width="800px"
  100. >
  101. <system-notify-model v-if="notifyStatus" :options="systemOptions" @submited="getList" @close="notifyStatus = false" />
  102. </el-dialog>
  103. </div>
  104. </template>
  105. <script>
  106. import { newsList, newsUpdate, newsDel } from "@/api/contentManager";
  107. import pagination from "@/components/Pagination/index";
  108. import systemNotifyModel from '../model/systemNotifyModel'
  109. export default {
  110. name: "training",
  111. components: {
  112. pagination,
  113. systemNotifyModel
  114. },
  115. data () {
  116. return {
  117. searchForm: {
  118. organIdList: []
  119. },
  120. tableList: [],
  121. teacherId: this.$route.query.teacherId,
  122. pageInfo: {
  123. // 分页规则
  124. limit: 10, // 限制显示条数
  125. page: 1, // 当前页
  126. total: 1, // 总条数
  127. page_size: [10, 20, 40, 50] // 选择限制显示条数
  128. },
  129. formActionTitle: "create",
  130. formTitle: {
  131. create: "新建系统通知",
  132. update: "修改系统通知"
  133. },
  134. notifyStatus: false,
  135. systemOptions: null,
  136. };
  137. },
  138. mounted () {
  139. this.$store.dispatch("setBranchs");
  140. this.getList();
  141. },
  142. methods: {
  143. search() {
  144. this.pageInfo.page = 1
  145. this.getList()
  146. },
  147. getList () {
  148. let params = {
  149. clientName: 'manage',
  150. organIdList: this.searchForm.organIdList ? this.searchForm.organIdList.join(',') : null,
  151. rows: this.pageInfo.limit,
  152. page: this.pageInfo.page,
  153. type: 9
  154. };
  155. newsList(params).then(res => {
  156. if (res.code == 200) {
  157. this.tableList = res.data.rows;
  158. this.pageInfo.total = res.data.total;
  159. }
  160. });
  161. },
  162. openTeaching (type, rows) {
  163. let params = {};
  164. if (type == "update") {
  165. params.id = rows.id;
  166. }
  167. this.formActionTitle = type
  168. params.type = 9;
  169. params.pageType = type;
  170. this.systemOptions = params
  171. this.notifyStatus = true
  172. },
  173. onDel (row) {
  174. // 删除
  175. this.$confirm("确定是否删除?", "提示", {
  176. confirmButtonText: "确定",
  177. cancelButtonText: "取消",
  178. type: "warning"
  179. })
  180. .then(() => {
  181. newsDel({ id: row.id }).then(res => {
  182. if (res.code == 200) {
  183. this.$message.success("删除成功");
  184. this.getList();
  185. } else {
  186. this.$message.error(res.msg);
  187. }
  188. });
  189. })
  190. .catch(() => { });
  191. },
  192. onStop (row, status) {
  193. // 停止
  194. // newsUpdate
  195. let tempStr = ["停用", "启用"];
  196. newsUpdate({
  197. id: row.id,
  198. status: status
  199. }).then(res => {
  200. if (res.code == 200) {
  201. this.$message.success(tempStr[status] + "成功");
  202. this.getList();
  203. } else {
  204. this.$message.error(res.msg);
  205. }
  206. });
  207. }
  208. }
  209. };
  210. </script>
  211. <style lang="scss" scoped>
  212. .bannerImg {
  213. height: 60px;
  214. }
  215. </style>