systemNotify.vue 6.6 KB

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