systemNotify.vue 6.3 KB

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