123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <template>
- <div>
- <!-- 搜索标题 -->
- <auth auths="news/add/system">
- <el-button
- @click="openTeaching('create')"
- type="primary"
- style="margin-bottom:20px"
- >
- 新建
- </el-button>
- </auth>
- <!-- 搜索标题 -->
- <save-form :inline="true"
- class="searchForm"
- :saveKey="'contentAdvert'"
- @submit="search"
- :model="searchForm">
- <el-form-item prop="organIdList">
- <select-all class="multiple" clearable
- filterable
- collapse-tags
- multiple
- v-model.trim="searchForm.organIdList"
- placeholder="请选择分部">
- <el-option v-for="(item,index) in selects.branchs"
- :key="index"
- :label="item.name"
- :value="item.id"></el-option>
- </select-all>
- </el-form-item>
- <el-form-item>
- <el-button native-type="submit" type="danger">搜索</el-button>
- </el-form-item>
- </save-form>
- <!-- 列表 -->
- <div class="tableWrap">
- <el-table :data="tableList"
- :header-cell-style="{background:'#EDEEF0',color:'#444'}">
- <el-table-column align="center"
- prop="title"
- label="标题"></el-table-column>
- <el-table-column align="center"
- prop="remark"
- label="是否使用">
- <template slot-scope="scope">{{ scope.row.status == 1 ? '是' : '否' }}</template>
- </el-table-column>
- <el-table-column align="center"
- prop="order"
- label="排序"></el-table-column>
- <el-table-column align="center"
- label="外链地址">
- <template slot-scope="scope">
- <overflow-text :text="scope.row.linkUrl"></overflow-text>
- </template>
- </el-table-column>
- <el-table-column align="center"
- prop="remark"
- label="适用分部">
- <template slot-scope="scope">
- <overflow-text :text="scope.row.organNameList"></overflow-text>
- </template>
- </el-table-column>
- <el-table-column align="center"
- label="操作">
- <template slot-scope="scope">
- <div>
- <auth auths="news/update/system" style="margin-left: 10px">
- <el-button
- @click="openTeaching('update', scope.row)"
- type="text"
- >修改</el-button
- >
- </auth>
- <auth v-if="scope.row.status == 1" auths="news/update/systemStop" style="margin-left: 10px">
- <el-button
- @click="onStop(scope.row, 0)"
- type="text"
- >停用</el-button
- >
- </auth>
- <auth v-else auths="news/update/systemStart" style="margin-left: 10px">
- <el-button @click="onStop(scope.row, 1)" type="text"
- >启用</el-button
- >
- </auth>
- <auth auths="news/del/system" style="margin-left: 10px">
- <el-button @click="onDel(scope.row)" type="text"
- >删除</el-button
- >
- </auth>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination sync :total.sync="pageInfo.total"
- :page.sync="pageInfo.page"
- :limit.sync="pageInfo.limit"
- :page-sizes="pageInfo.page_size"
- @pagination="getList" />
- </div>
- <el-dialog
- :title="formTitle[formActionTitle]"
- :visible.sync="notifyStatus"
- width="800px"
- >
- <system-notify-model v-if="notifyStatus" :options="systemOptions" @submited="getList" @close="notifyStatus = false" />
- </el-dialog>
- </div>
- </template>
- <script>
- import { newsList, newsUpdate, newsDel } from "@/api/contentManager";
- import pagination from "@/components/Pagination/index";
- import systemNotifyModel from '../model/systemNotifyModel'
- export default {
- name: "training",
- components: {
- pagination,
- systemNotifyModel
- },
- data () {
- return {
- searchForm: {
- organIdList: []
- },
- tableList: [],
- teacherId: this.$route.query.teacherId,
- pageInfo: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 1, // 总条数
- page_size: [10, 20, 40, 50] // 选择限制显示条数
- },
- formActionTitle: "create",
- formTitle: {
- create: "新建系统通知",
- update: "修改系统通知"
- },
- notifyStatus: false,
- systemOptions: null,
- };
- },
- mounted () {
- this.$store.dispatch("setBranchs");
- this.getList();
- },
- methods: {
- search() {
- this.pageInfo.page = 1
- this.getList()
- },
- getList () {
- let params = {
- clientName: 'manage',
- organIdList: this.searchForm.organIdList ? this.searchForm.organIdList.join(',') : null,
- rows: this.pageInfo.limit,
- page: this.pageInfo.page,
- type: 19
- };
- newsList(params).then(res => {
- if (res.code == 200) {
- this.tableList = res.data.rows;
- this.pageInfo.total = res.data.total;
- }
- });
- },
- openTeaching (type, rows) {
- let params = {};
- if (type == "update") {
- params.id = rows.id;
- }
- this.formActionTitle = type
- params.type = 19;
- params.pageType = type;
- this.systemOptions = params
- this.notifyStatus = true
- },
- onDel (row) {
- // 删除
- this.$confirm("确定是否删除?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- newsDel({ id: row.id }).then(res => {
- if (res.code == 200) {
- this.$message.success("删除成功");
- this.getList();
- } else {
- this.$message.error(res.msg);
- }
- });
- })
- .catch(() => { });
- },
- onStop (row, status) {
- // 停止
- // newsUpdate
- let tempStr = ["停用", "启用"];
- newsUpdate({
- id: row.id,
- status: status
- }).then(res => {
- if (res.code == 200) {
- this.$message.success(tempStr[status] + "成功");
- this.getList();
- } else {
- this.$message.error(res.msg);
- }
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .bannerImg {
- height: 60px;
- }
- </style>
|