zhanghua
2023-02-10 a4904c4b4f2f47c3187ebf709b0eccabb49017cb
src/views/operate/baseSetting/violation/index.vue
@@ -1,8 +1,6 @@
<template>
    <div class="userList">
        <div class="headerTitle">
            运营管理》基础设置》违规事项设置
        </div>
    <div class="headerTitle">运营管理》基础设置》违规事项设置</div>
        <header>
            <div class="headerContent">
                <div class="search">
@@ -13,10 +11,17 @@
                    </div>
                </div>
                <div class="addUser">
                    <el-button class="addBtn" type="primary" @click="dialogCreate = true">新增违规类型</el-button>
                    <el-dialog :visible.sync="dialogCreate" title="新增违规类型" width="45%" v-if="dialogCreate"
                        :before-close="handleClose">
                        <createUser @changeDialog=changeDialog />
          <el-button class="addBtn" type="primary" @click="dialogCreate = true"
            >新增违规类型</el-button
          >
          <el-dialog
            :visible.sync="dialogCreate"
            title="新增违规类型"
            width="45%"
            v-if="dialogCreate"
            :before-close="handleClose"
          >
            <createUser @changeDialog="changeDialog" />
                    </el-dialog>
                </div>
            </div>
@@ -28,11 +33,17 @@
                    border
                    stripe
                    ref="multipleTable"
                    :header-cell-style="{'background':'#F5F5F5','font-weight':'650','line-height':'45px'}"
                    :data="tableData" style="width: 100%" :row-class-name="tableRowClassName"
                    @selection-change="tableChange">
                    <el-table-column type="selection" min-width="5">
                    </el-table-column>
          :header-cell-style="{
            background: '#F5F5F5',
            'font-weight': '650',
            'line-height': '45px',
          }"
          :data="tableData"
          style="width: 100%"
          :row-class-name="tableRowClassName"
          @selection-change="tableChange"
        >
          <el-table-column type="selection" min-width="5"> </el-table-column>
                    <el-table-column prop="number" label="违规事项编号" min-width="10">
                    </el-table-column>
                    <el-table-column prop="typeThird" label="所属类型" min-width="10">
@@ -54,10 +65,19 @@
                    </el-table-column>
                </el-table>
                <!-- 查看修改页面 -->
                <el-dialog :visible.sync="dialogUpdate" width="45%" :title="updateFlag ? '权限设置' :'查看角色信息'"
                    v-if="dialogUpdate" :before-close="handleClose2">
                    <updateUser :updateFlag="updateFlag" :userInfo=userInfo
                        :getUserList=" context ? getUserList : getUserList" @changeDialog="changeDialog" />
        <el-dialog
          :visible.sync="dialogUpdate"
          width="45%"
          :title="updateFlag ? '权限设置' : '查看角色信息'"
          v-if="dialogUpdate"
          :before-close="handleClose2"
        >
          <updateUser
            :updateFlag="updateFlag"
            :userInfo="userInfo"
            :getUserList="context ? getUserList : getUserList"
            @changeDialog="changeDialog"
          />
                </el-dialog>
                <!-- tools -->
                <div class="tools">
@@ -77,9 +97,16 @@
                        </div> -->
                    </div>
                    <div class="pagination">
                        <el-pagination background :current-page="currentPage" layout="prev, pager, next"
                            :total="totalNum" :page-size="pageSize" @current-change="changeCurrentPage"
                            @prev-click="handlePrev" @next-click="handleNext">
            <el-pagination
              background
              :current-page="currentPage"
              layout="prev, pager, next"
              :total="totalNum"
              :page-size="pageSize"
              @current-change="changeCurrentPage"
              @prev-click="handlePrev"
              @next-click="handleNext"
            >
                        </el-pagination>
                    </div>
                </div>
@@ -88,11 +115,12 @@
    </div>
</template>
<script>
import updateUser from "./updateUser"
import createUser from "./createUser"
import updateUser from "./updateUser";
import createUser from "./createUser";
export default {
    components: {
        updateUser, createUser
    updateUser,
    createUser,
    },
    data() {
        return {
@@ -101,7 +129,7 @@
            dialogCreate: false,
            dialogUpdate: false,
            updateFlag: false,
            userInfo: '',
      userInfo: "",
            totalNum: null,
            pageSize: 10,
            currentPage: 1,
@@ -111,24 +139,24 @@
            options: [
                {
                    value: 0,
                    label: '批量操作',
          label: "批量操作",
                    disabled: true,
                },
                {
                    value: 1,
                    label: '批量启用',
          label: "批量启用",
                },
                {
                    value: 2,
                    label: '批量禁用',
          label: "批量禁用",
                },
                {
                    value: 3,
                    label: '批量删除',
                }
          label: "批量删除",
        },
            ],
            tempList: []
        }
      tempList: [],
    };
    },
    created() {
        this.getUserList();
@@ -137,31 +165,31 @@
        // 批量删除
        mulDelete(idArr) {
            this.$axios({
                method: 'delete',
                url: 'sccg/violations/batch_delete?ids=' + idArr,
            }).then(res => {
        method: "delete",
        url: "sccg/violations/batch_delete?ids=" + idArr,
      }).then((res) => {
                this.getUserList();
                this.$message({
                    message: res.message,
                    type: res.code === 200 ? 'success' : 'warning'
                })
            })
          type: res.code === 200 ? "success" : "warning",
        });
      });
        },
        // 执行下拉框操作
        selectChange(val) {
            let ids = [];
            this.tempList.forEach(item => {
      this.tempList.forEach((item) => {
                ids.push(item.number);
            })
      });
            if (ids.length !== 0) {
                if (val === 3) {
                    this.mulDelete(ids);
                }
            } else {
                this.$message({
                    type: 'warning',
                    message: '您还没选中任何数据',
                })
          type: "warning",
          message: "您还没选中任何数据",
        });
            }
        },
        // 监听表格选中状态
@@ -170,7 +198,7 @@
            if (list.length === this.tableData.length) {
                this.all = true;
            } else {
                this.all = false
        this.all = false;
            }
        },
        // 全选
@@ -179,51 +207,49 @@
        },
        // 反选
        disSame(list) {
            list.forEach(row => {
                this.$refs.multipleTable.toggleRowSelection(row)
            })
      list.forEach((row) => {
        this.$refs.multipleTable.toggleRowSelection(row);
      });
        },
        // 删除单条数据
        handleDelete({ number }) {
            this.$confirm('确认删除?')
                .then(_ => {
      this.$confirm("确认删除?")
        .then((_) => {
                    this.$axios({
                        method: 'delete',
            method: "delete",
                        url: `sccg/violations/delete?id=${number}`,
                    })
                        .then(res => {
          }).then((res) => {
                            this.$message({
                                type: res.code === 200 ? 'success' : 'warning',
                                message: res.message
                            })
              type: res.code === 200 ? "success" : "warning",
              message: res.message,
            });
                            this.getUserList();
          });
                        })
                })
                .catch(_ => {  });
        .catch((_) => {});
        },
        // 获取用户列表
        getUserList() {
            const { currentPage, pageSize, context } = this;
            // 获取所有用户信息
            this.$axios({
                method: 'get',
        method: "get",
                url: `sccg/violations/query?current=${currentPage}&size=${pageSize}&keyWord=${context}`,
            })
                .then(res => {
      }).then((res) => {
                    this.tableData = res.data.records;
                    this.totalNum = res.data.total;
                })
      });
        },
        // 设置表格斑马纹
        tableRowClassName({ row, rowIndex }) {
            if ((rowIndex + 1) % 2 == 0) {
                return 'warning-row';
        return "warning-row";
            } else {
                return 'success-row';
        return "success-row";
            }
            return '';
      return "";
        },
        // 查看用户信息(不可修改)
        handleFind(rowData) {
@@ -253,34 +279,34 @@
        },
        handleClose2(done) {
            if (this.updateFlag) {
                this.$confirm('确认关闭?')
                    .then(_ => {
        this.$confirm("确认关闭?")
          .then((_) => {
                        this.dialogCreate = false;
                        this.dialogUpdate = false;
                        done();
                    })
                    .catch(_ => { });
          .catch((_) => {});
            } else {
                done();
            }
        },
        handleClose(done) {
            this.$confirm('确认关闭?')
                .then(_ => {
      this.$confirm("确认关闭?")
        .then((_) => {
                    this.dialogCreate = false;
                    this.dialogUpdate = false;
                    done();
                })
                .catch(_ => { });
        }
    }
}
        .catch((_) => {});
    },
  },
};
</script>
<style lang="scss" scoped>
.userList {
    text-align: left;
    padding: 10px 20px;
  color: #4b9bb7;
  //   color: #4b9bb7;
  border: 1px solid #ccc;
    .headerTitle {
        line-height: 40px;
@@ -308,7 +334,6 @@
                    flex: 2;
                    color: #1d3f57;
                }
            }
            .findBtn {
@@ -382,7 +407,6 @@
                        color: #4b9bb7;
                    }
                }
            }
            .pagination {
@@ -392,7 +416,6 @@
                justify-content: center;
                .el-pagination {
                    // &::v-deep li,
                    // &::v-deep .btn-prev,
                    // &::v-deep .btn-next {