zhanghua
2023-01-09 9ccde974b85157aee21943ca8aa718f7093985bc
网格管理
4个文件已修改
4个文件已添加
1059 ■■■■■ 已修改文件
src/api/system/orgGrid.js 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/index.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/system/orgGrid/index.js 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/layout/components/Main/index.vue 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/operate/writManager/writTemplate/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/device/grid/components/components/dialogForm.vue 208 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/device/grid/components/components/map.vue 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/device/grid/components/main/index.vue 632 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/system/orgGrid.js
New file
@@ -0,0 +1,20 @@
import http from '@/http'
export default {
    // 获取列表
    getOrgGridList: (params) => {
        return http.get('/sccg/org_grid/query', params);
    },
    // 新增
    saveOrgGrid: (params) => {
        return http.post('/sccg/org_grid/add', params);
    },
    // 编辑
    updateOrgGrid: (params) => {
        return http.put('/sccg/org_grid/update', params);
    },
    // 删除
    deleteOrgGrid: (id) => {
        return http.delete('/sccg/org_grid/delete/' + id);
    },
};
src/store/index.js
@@ -4,6 +4,7 @@
import logs from "./logs"
import loudspeaker from './system/loudspeaker'
import handheldTerminal from './system/handheldTerminal'
import orgGrid from './system/orgGrid'
import shortMessage from './operate/managenment/shortMessage'
import statistics from './intelligentPatrol/statistics'
import writ from './operate/writ'
@@ -21,6 +22,7 @@
    loudspeaker,
    handheldTerminal,
    statistics,
    writ
    writ,
    orgGrid
  }
})
src/store/system/orgGrid/index.js
New file
@@ -0,0 +1,21 @@
import orgGridApi from "@/api/system/orgGrid";
export default {
    namespaced: true,
    state: {
        userInfo: {},
    },
    actions: {
        getOrgGridList(context, params) {
            return orgGridApi.getOrgGridList(params);
        },
        saveOrgGrid(context, params) {
            return orgGridApi.saveOrgGrid(params);
        },
        updateOrgGrid(context, params) {
            return orgGridApi.updateOrgGrid(params);
        },
        deleteOrgGrid(context, id) {
            return orgGridApi.deleteOrgGrid(id);
        },
    },
};
src/views/layout/components/Main/index.vue
@@ -54,221 +54,221 @@
              link: '/system/userSetting/department',
            },
            {
              id: 4,
              id: 5,
              label: '自定义菜单',
              link: '/system/platform/mySetting',
            },
            {
              id: 4,
              id: 6,
              label: 'logo管理',
              link: '/system/platform/portalSetting',
            },
            {
              id: 4,
              id: 7,
              label: '驾驶舱管理',
              link: '/system/platform/cockpitManage',
            },
            {
              id: 5,
              id: 8,
              label: '卡口设备管理',
              link: '/system/device/bayonet',
            },
            {
              id: 6,
              id: 9,
              label: '点位管理',
              link: '/system/device/point',
            },
            {
              id: 6,
              id: 10,
              label: '网格管理',
              link: '/system/device/grid',
            },
            {
              id: 6,
              id: 11,
              label: '音柱设备管理',
              link: '/system/device/loudspeaker',
            },
            {
              id: 6,
              id: 12,
              label: '手持设备管理',
              link: '/system/device/handheldTerminal',
            },
          ]
        },
        {
          id: 7,
          id: 13,
          title: '运营管理',
          children: [
            {
              id: 8,
              id: 14,
              label: '违规事项设置',
              link: '/operate/baseSetting/violation',
            },
            {
              id: 9,
              id: 15,
              label: '违建事项设置',
              link: '/operate/baseSetting/illegalBuild',
            },
            {
              id: 10,
              id: 16,
              label: '我的待办',
              link: '/operate/myWait',
            },
            {
              id: 11,
              id: 17,
              label: '案件查询',
              link: '/operate/viewEvent',
            },
            {
              id: 13,
              id: 18,
              label: '门前三包',
              link: '/operate/fivepack/threepackage',
            },
            {
              id: 14,
              id: 19,
              label: '店铺管理',
              link: '/operate/fivepack/shop',
            },
            {
              id: 15,
              id: 20,
              label: '车辆管理',
              link: '/operate/car/carIndex',
            },
            {
              id: 15,
              id: 21,
              label: '轨迹分析(执法车)',
              link: '/operate/car/lawTrajectory',
            },
            {
              id: 15,
              id: 22,
              label: '轨迹分析(渣土车)',
              link: '/operate/car/soilTrajectory',
            },
            {
              id: 16,
              id: 23,
              label: '图片管理',
              link: '/operate/images',
            },
            {
              id: 17,
              id: 24,
              label: '视频管理',
              link: '/operate/videoControl',
            },
            {
              id: 17,
              id: 25,
              label: '文书管理',
              link: '/operate/writManagement/writ',
            },
            {
              id: 17,
              id: 26,
              label: '文书模板管理',
              link: '/operate/writManagement/writTemplate',
            },
            {
              id: 18,
              id: 27,
              label: '消息管理',
              link: '/operate/message/messageIndex',
            }, {
              id: 18,
              id: 28,
              label: '栏目管理',
              link: '/operate/message/mycontrol',
            },
            {
              id: 19,
              id: 29,
              label: '短信管理',
              link: '/operate/sms/smsIndex',
            }, {
              id: 19,
              id: 30,
              label: '短信模板管理',
              link: '/operate/sms/smsTemplate',
            },
            {
              id: 20,
              id: 31,
              label: '日志管理',
              link: '/operate/log',
            },
          ]
        },
        {
          id: 21,
          id: 32,
          title: '事项处置管理',
          children: [
            {
              id: 24,
              id: 33,
              label: '案件池',
              link: '/operate/casepool/pool',
            }, {
              id: 24,
              id: 34,
              label: '已上报到市',
              link: '/operate/casepool/escalation',
            }, {
              id: 24,
              id: 35,
              label: '调度管理',
              link: '/operate/casepool/dispatch',
            }, {
              id: 24,
              id: 36,
              label: '在学习管理',
              link: '/operate/casepool/learn',
            }, {
              id: 24,
              id: 37,
              label: '暂不处理',
              link: '/operate/casepool/notDeal',
            },
          ]
        },
        {
          id: 23,
          id: 38,
          title: '审核管理',
          children: [
            {
              id: 24,
              id: 39,
              label: '审核管理',
              link: '/operate/management/myIndex',
            },
            {
              id: 25,
              id: 40,
              label: '短信审核管理',
              link: '/operate/management/managementMessage',
            },
          ]
        },
        {
          id: 23,
          id: 41,
          title: '视频巡查',
          children: [
            {
              id: 24,
              id: 42,
              label: '视频巡查',
              link: '/video',
            },
          ]
        },
        {
          id: 23,
          id: 43,
          title: '智能巡查',
          children: [
            {
              id: 24,
              id: 44,
              label: '预警研判',
              link: '/studyJudge',
            },
            {
              id: 25,
              id: 45,
              label: '违规检索',
              link: '/illegalSearch',
            },
            {
              id: 26,
              id: 46,
              label: '趋势分析',
              link: '/trendAnalysis',
            },
            {
              id: 27,
              id: 47,
              label: '违章统计',
              link: '/trendAnalysis',
            },
            {
              id: 28,
              id: 48,
              label: '违法统计',
              link: '/typeStatistics',
            },
src/views/operate/writManager/writTemplate/index.vue
@@ -129,7 +129,7 @@
      this.getWritTemplateList({
        currentPage,
        pageSize,
        state: context,
        name: context,
      }).then((res) => {
        this.list = res.records;
        this.totalNum = res.total;
src/views/systemSetting/device/grid/components/components/dialogForm.vue
New file
@@ -0,0 +1,208 @@
<template>
  <div class="create">
    <main>
      <div class="mainContent">
        <el-form
          ref="formRef"
          label-width="140px"
          :rules="createRules"
          autoComplete="on"
          :model="form"
          label-position="right"
        >
          <el-form-item class="optionItem" label="区域名称:" prop="name">
            <el-input
              v-model="form.name"
              placeholder="请填写区域名称"
            ></el-input>
          </el-form-item>
          <el-form-item class="optionItem" label="所属网格员:" prop="worker">
            <el-input
              v-model="form.worker"
              placeholder="请填写所属网格员"
            ></el-input>
          </el-form-item>
          <el-form-item class="optionItem" label="联系方式:" prop="contact">
            <el-input
              v-model="form.contact"
              placeholder="请填写联系方式"
            ></el-input>
          </el-form-item>
          <el-form-item class="optionItem" label="责任区域:" prop="area">
            <el-input
              v-model="form.area"
              placeholder="请填写责任区域"
            ></el-input>
          </el-form-item>
          <el-form-item class="optionItem" label="描述:" prop="description">
            <el-input type="textarea"
              v-model="form.description"
              placeholder="请填写描述"
              :rows="4"
            ></el-input>
          </el-form-item>
          <el-form-item class="optionItem" label="责任区域:" prop="region">
            <Map
              style="width: 400px; height: 300px"
              :region="form.region"
            ></Map>
          </el-form-item>
          <el-form-item>
            <div class="optionBtn">
              <el-button
                type="primary"
                class="btn submit"
                @click.native.prevent="handleUpdate"
                >确认
              </el-button>
            </div>
          </el-form-item>
        </el-form>
      </div>
    </main>
  </div>
</template>
  <script>
import Map from "./map.vue";
import { createNamespacedHelpers } from "vuex";
const { mapActions } = createNamespacedHelpers("orgGrid");
export default {
  components: { Map },
  data() {
    const checkName = (rule, value, callback) => {
      if (value) {
        callback();
      } else {
        callback(new Error("名称不能为空"));
      }
    };
    return {
      form: {
        name: "",
        worker: "",
        contact: "",
        area: "",
        description: "",
        region: "",
      },
      createRules: {
        name: [
          {
            required: true,
            trigger: "blur",
            validator: checkName,
          },
        ],
      },
      selectOrg: {
        orgsid: [],
      },
      mylabel: "",
      departList: [],
      defaultProps: {
        children: "children",
        label: "departName",
      },
    };
  },
  created() {
    // 初始化数据
    this.form = this.info;
  },
  watch: {
    info(newVal) {
      this.form = newVal; //对父组件传过来的值进行监听,如果改变也对子组件内部的值进行改变
    },
  },
  methods: {
    ...mapActions(["saveOrgGrid", "updateOrgGrid"]),
    // 修改执法车
    handleUpdate() {
      this.$refs.formRef.validate((valid) => {
        if (valid) {
          const { form } = this;
          if (form.id > 0) {
            this.updateOrgGrid(form).then((res) => {
              this.$message({
                type: "success",
                message: "修改成功",
              });
              this.$emit("closeDialog", { flag: false, index: 1 });
            });
          } else {
            this.saveOrgGrid(form).then((res) => {
              this.$message({
                type: "success",
                message: "保存成功",
              });
              this.$emit("closeDialog", { flag: false, index: 1 });
            });
          }
        } else {
          return false;
        }
      });
    },
  },
  props: ["info", "closeDialog"],
};
</script>
  <style lang="scss" scoped>
.create {
  border-radius: 1px;
  // background-color: #09152f;
  main {
    // border: 1px solid #fff;
    text-align: left;
    padding: 0 55px;
    // background-color: #09152f;
    padding-bottom: 50px;
    .mainContent {
      display: flex;
      justify-content: center;
      padding-top: 50px;
      .el-form-item__content {
        width: 400px;
        .el-select {
          width: 100%;
        }
      }
      .optionHandleSp {
        display: flex;
        .areaNumber,
        .moreNumber {
          flex: 1;
        }
        .telNumber {
          flex: 2;
        }
      }
      .optionBtn {
        display: flex;
        margin-top: 20px;
        .btn {
          padding: 12px 50px;
        }
      }
    }
  }
}
</style>
src/views/systemSetting/device/grid/components/components/map.vue
New file
@@ -0,0 +1,84 @@
<template>
  <div id="container"></div>
</template>
<script>
import AMapLoader from "@amap/amap-jsapi-loader";
export default {
  data() {
    return {
      map: null,
      _point: { x: "119.27179890", y: "28.59027084" },
      _zoom: 15,
    };
  },
  created() {
  },
  methods: {
    locationMap() {
      const that = this;
        that.map.setZoomAndCenter(that.zoom, [that.point.x, that.point.y]);
        if (that.mark) {
          // 创建一个 Marker 实例:
          var marker = new AMap.Marker({
            position: new AMap.LngLat(that._point.x, that._point.y), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
            title: that.mark.title,
          });
          // 将创建的点标记添加到已有的地图实例:
          that.map.add(marker);
          marker.on('click',function(e){
            console.log('666')
            that.$emit('fatherMethod')
            // that.$parent.fatherMethod();
          })
        }
    },
  },
  mounted() {
    const that = this;
    AMapLoader.load({
      key: "091ade377d4db40f68cc78cb9658ce8d", // 申请好的Web端开发者Key,首次调用 load 时必填
      version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
      plugins: [], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
    })
      .then((AMap) => {
        that.map = new AMap.Map("container");
        that.locationMap();
      })
      .catch((e) => {
        console.log(e);
      });
    // const that = this;
    // debugger
    // that.map.setZoomAndCenter(that._zoom, [that._point.x, that._point.y]);
    // if (that.mark) {
    //   // 创建一个 Marker 实例:
    //   var marker = new AMap.Marker({
    //     position: new AMap.LngLat(that._point.x, that._point.y), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
    //     title: that.mark.title,
    //   });
    //   // 将创建的点标记添加到已有的地图实例:
    //   that.map.add(marker);
    // }
  },
  watch: {
    point(newval, oldval) {
      this._point = newval;
      this.locationMap();
    },
    zoom(newval, oldval) {
      this._zoom = newval;
    },
  },
  props: ["point", "zoom", "mark"],
};
</script>
<style lang="scss" scoped>
#container {
  width: 100%;
  height: 100%;
}
</style>
src/views/systemSetting/device/grid/components/main/index.vue
@@ -1,351 +1,232 @@
<template>
    <div class="mainContent">
      <!-- <div class="aside">
        <department-aside />
      </div> -->
      <div class="grid-content">
        <!-- 数据展示 -->
        <el-table ref="multipleTable"
                  :header-cell-style="{'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 label="用户ID" min-width="6">
            <template slot-scope="scope">{{ scope.row.id }}</template>
          </el-table-column>
          <el-table-column prop="nickName" label="用户名称" min-width="10">
          </el-table-column>
          <el-table-column prop="username" label="所属姓名" min-width="8">
          </el-table-column>
          <el-table-column prop="mobile" label="联系方式" min-width="7">
          </el-table-column>
          <el-table-column prop="note" label="所属角色" min-width="8">
            <template slot-scope="scope">
              <span>{{filterRole(scope.row.roles)}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="jobTitle" label="所属职务" min-width="8">
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" min-width="10">
            <template slot-scope="scope">
              <span>{{changeTime(scope.row)}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="status" label="启用" min-width="5">
            <template slot-scope="scope">
              <!-- @change="handleChangeStatus(scope.row)" -->
              <el-switch class="switchStyle" v-model="scope.row.status"
                         active-color="#3fef9a" inactive-color="#000212" disabled>
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column prop="operation" label="操作" min-width="20">
          </el-table-column>
        </el-table>
        <!-- 查看页面 -->
        <el-dialog :visible.sync="dialogView" width="45%" v-if="dialogView"
                   title="查看用户信息">
          <MyView :userInfo=userInfo></MyView>
        </el-dialog>
        <!-- 修改页面 -->
        <el-dialog :visible.sync="dialogUpdate" width="45%" v-if="dialogUpdate"
                   :title="updateFlag ? flag.role ? '修改用户角色信息' : flag.depart ? '修改用户部门信息': '修改用户密码' :''"
                   :before-close="handleClose">
          <updateUser :updateFlag="updateFlag" :userInfo=userInfo :flag=flag @closeDialog="closeDialog"
                      :getUserList="getUserList" v-if="!flag.password" />
          <MyPwd v-else :userInfo=userInfo @closeDialog="closeDialog"></MyPwd>
        </el-dialog>
        <!-- tools -->
        <div class="tools">
          <div class="funs">
              <el-checkbox v-model="all" @change="selectAll()">全选</el-checkbox>
              <el-checkbox v-model="unsame" @change="disSame(tableData)">反选</el-checkbox>
              <el-select v-model="myIdx" placeholder="批量操作" @change="selectChange">
                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"
                           :disabled="item.disabled">
                </el-option>
              </el-select>
  <div class="mainContent">
    <!-- <div class="aside">
      <department-aside />
    </div> -->
    <div class="grid-content">
      <header>
        <div class="headerContent">
          <div class="search">
            <span>筛选条件:</span>
            <el-input v-model="context" placeholder="请输入内容"></el-input>
            <div class="findBtn">
              <el-button type="primary" @click="getList()">查询</el-button>
            </div>
          </div>
          <el-pagination class="pagination" background :current-page="currentPage" layout="prev, pager, next" :total="totalNum"
                         :page-size="pageSize" @current-change="changeCurrentPage" @prev-click="handlePrev"
                         @next-click="handleNext">
        </div>
        <div class="main-title">
          <el-button
            class="el-icon-plus button-addition"
            type="primary"
            @click="handleAdd()"
            >添加</el-button
          >
        </div>
      </header>
      <!-- 数据展示 -->
      <el-table
        ref="multipleTable"
        :header-cell-style="{ '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="name" label="区域名称" min-width="10">
        </el-table-column>
        <el-table-column prop="worker" label="所属网格员" min-width="8">
        </el-table-column>
        <el-table-column prop="contact" label="联系方式" min-width="7">
        </el-table-column>
        <el-table-column prop="area" label="责任区域" min-width="8">
        </el-table-column>
        <el-table-column prop="description" label="描述" min-width="20">
        </el-table-column>
        <el-table-column prop="operation" label="操作" min-width="5">
          <template slot-scope="scope">
            <div class="operation">
              <span @click="handleEdit(scope.row)">编辑</span>
              <span class="line">|</span>
              <span @click="handleDelete(scope.row)">删除</span>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <el-dialog
        :visible.sync="dialogUpdate"
        width="45%"
        v-if="dialogUpdate"
        title="网格信息"
        :before-close="handleClose"
      >
        <MyView :info="handheldGrid" @closeDialog="handleCallBack"></MyView>
      </el-dialog>
      <!-- tools -->
      <div class="tools">
        <div class="funs"></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>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import helper from '@/utils/mydate'
import helper from "@/utils/mydate";
import { createNamespacedHelpers } from "vuex";
import departmentAside from "@/views/operate/fivepack/threepack/components/aside";
import MyView from "../components/dialogForm.vue";
const { mapActions } = createNamespacedHelpers("orgGrid");
export default {
    components: { departmentAside },
    data() {
        return {
            tableData: [],
            search: "",
            dialogUpdate: false,
            dialogView:false,
            updateFlag: false,
            userInfo: '',
            totalNum: 0,
            pageSize: 10,
            currentPage: 1,
            renderFlag: false,
            flag: {
                role: false,
                password: false,
                depart: false,
            },
            all: false,
            unsame: false,
            myIdx: 0,
            preMyIdx: 0,
            options: [
                {
                    value: 0,
                    label: '批量操作',
                    disabled: true,
                },
                {
                    value: 1,
                    label: '批量启用',
                },
                {
                    value: 2,
                    label: '批量禁用',
                },
                {
                    value: 3,
                    label: '批量删除',
                }
            ],
            tempList: []
        }
  components: { departmentAside, MyView },
  data() {
    return {
      tableData: [],
      context: "",
      dialogUpdate: false,
      dialogView: false,
      updateFlag: false,
      userInfo: "",
      totalNum: 0,
      pageSize: 10,
      currentPage: 1,
      renderFlag: false,
      flag: {
        role: false,
        password: false,
        depart: false,
      },
      all: false,
      unsame: false,
      myIdx: 0,
      preMyIdx: 0,
      tempList: [],
      handheldGrid: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    ...mapActions(["getOrgGridList", "deleteOrgGrid"]),
    tableChange(list) {
      this.tempList = [];
      list.forEach((item) => {
        this.tempList.push(item.id);
      });
      this.all = list.length === this.tableData.length;
    },
    created() {
        this.getUserList();
    changeTime({ createTime }) {
      return helper(createTime);
    },
    methods: {
        async selectChange(list) {
            if (this.tempList.length !== 0) {
                this.preMyIdx = list;
                if (list === 3) {
                    await this.mulDelte(this.tempList);
                } else if (list === 2) {
                    await this.mulUpdateStatus(this.tempList, 0);
                } else {
                    await this.mulUpdateStatus(this.tempList, 1);
                }
                this.myIdx = 0;
            } else {
                this.myIdx = this.preMyIdx;
                this.$message({
                    type: 'warning',
                    message: '您还没选中任何数据',
                })
            }
        },
        tableChange(list) {
            this.tempList = [];
            list.forEach(item => {
                this.tempList.push(item.id);
            })
            this.all = list.length === this.tableData.length;
        },
        // 批量删除用户信息
        mulDelte(idArr) {
            this.$confirm("您确定要进行批量删除用户吗?")
                .then(_ => {
                    this.$axios({
                        method: 'post',
                        url: 'sccg/admin/deleteBatch?ids=' + idArr,
                    })
                        .then(res => {
                            if (res.code === 200) {
                                this.$message({
                                    type: 'success',
                                    message: '删除用户信息成功',
                                })
                                this.getUserList();
                            } else {
                                this.$message({
                                    type: 'error',
                                    message: res.message
                                })
                            }
                        })
                })
                .catch(err => {  })
        },
        // 批量修改账号
        mulUpdateStatus(idArr, flag) {
            this.$confirm(flag === 1 ? "您确定要进行批量启用用户吗?" : '您确定要进行批量禁用用户吗?')
                .then(_ => {
                    this.$axios({
                        method: 'post',
                        url: 'sccg/admin/updateStatusBatch?ids=' + idArr + '&status=' + flag,
                    })
                        .then(res => {
                            if (res.code === 200) {
                                this.$message({
                                    type: 'success',
                                    message: '更改用户状态成功',
                                })
                                this.getUserList();
                            } else {
                                this.$message({
                                    type: 'error',
                                    message: res.message
                                })
                            }
                        })
                })
                .catch(err => {  })
        },
        changeTime({ createTime }) {
            return helper(createTime);
        },
        selectAll() {
            this.$refs.multipleTable.toggleAllSelection();
        },
        disSame(list) {
            list.forEach(row => {
                this.$refs.multipleTable.toggleRowSelection(row)
            })
        },
        // 删除用户
        handleDelete({ id }) {
            this.$confirm('确认删除?').then(_ => {
                this.$axios({
                    method: 'post',
                    url: 'sccg/admin/delete/' + id,
                }).then(res => {
                    this.$message({
                        message: res.message,
                        type: 'success'
                    })
                    this.getUserList();
                })
            }).catch(_ => { })
        },
        closeDialog({ flag }) {
            this.dialogUpdate = flag;
            this.getUserList();
        },
        handleClose(done) {
            if (this.updateFlag) {
                this.$confirm('确认关闭?')
                    .then(_ => {
                        this.dialogUpdate = false;
                        this.updateFlag = false;
                        done();
                    })
                    .catch(_ => { });
            }else{
                done();
            }
        },
        // 当前页改变触发事件
        changeCurrentPage(page) {
            this.currentPage = page;
            this.getUserList();
        },
        // 上一页点击事件
        handlePrev(page) {
            this.currentPage = page;
            this.getUserList();
        },
        // 下一页点击事件
        handleNext(page) {
            this.currentPage = page;
            this.getUserList();
        },
        // 修改角色
        handleChangeRole(obj, mykey) {
            this.dialogUpdate = true;
            this.updateFlag = true;
            for (let key in this.flag) {
                if (key === mykey) {
                    this.flag[key] = true;
                } else {
                    this.flag[key] = false;
                }
            }
            this.userInfo = obj;
        },
        // 修改用户状态
        handleChangeStatus(obj) {
            let { id, status } = obj;
            status === true ? status = 1 : status = 0;
            this.$axios.post(`sccg/admin/updateStatus/` + id + '?status=' + status).then(res => {
            })
        },
        // 获取用户列表
        getUserList() {
            const that = this;
            const { currentPage, pageSize, search } = this;
            // 获取所有用户信息、用户查询(暂时支持电话号码)
            this.$axios.get(`sccg/admin/list?keyword=${search}&current=${currentPage}&pageSize=${pageSize}`).then(res => {
                if (res.code === 200) {
                    res.data.records.forEach(item => {
                        item.status === 1 ? item.status = true : item.status = false;
                    })
                    that.totalNum = res.data.total;
                    that.tableData = res.data.records;
                    this.renderFlag = true;
                }
            })
        },
        // 查看用户信息(不可修改)
        handleFind(rowData) {
            this.dialogView = true;
            this.userInfo = rowData;
        },
        // 设置表格斑马纹
        tableRowClassName({ row, rowIndex }) {
            if ((rowIndex + 1) % 2 === 0) {
                return 'warning-row';
            } else {
                return 'success-row';
            }
        },
        // 处理用户所属角色
        filterRole(arr){
            let str = '';
            if(arr.length === 0){
                return;
            }
            arr.forEach((item,index)=>{
                if(item!==null){
                    if(index<arr.length-1){
                        str+=item.name +',';
                    }else{
                        str+=item.name;
                    }
                }
            })
            return str;
        }
    disSame(list) {
      list.forEach((row) => {
        this.$refs.multipleTable.toggleRowSelection(row);
      });
    },
    props: ['refresh', 'keyword', 'resetFresh'],
    watch: {
        refresh: {
            handler(newValue, oldValue) {
                if (newValue) {
                    this.search = '';
                    if (this.keyword !== '') {
                        this.search = this.keyword;
                    }
                    this.currentPage = 1;
                    this.getUserList();
                    this.$emit('resetFresh', { flag: false })
                }
            },
            immediate: true
        }
    }
}
    handleCallBack({ flag }) {
      this.dialogUpdate = false;
      this.getList();
    },
    handleClose(done) {
      if (this.updateFlag) {
        this.$confirm("确认关闭?")
          .then((_) => {
            this.dialogUpdate = false;
            this.updateFlag = false;
            done();
          })
          .catch((_) => {});
      } else {
        done();
      }
    },
    // 当前页改变触发事件
    changeCurrentPage(page) {
      this.currentPage = page;
      this.getList();
    },
    // 上一页点击事件
    handlePrev(page) {
      this.currentPage = page;
      this.getList();
    },
    // 下一页点击事件
    handleNext(page) {
      this.currentPage = page;
      this.getList();
    },
    // 获取列表
    getList() {
      const that = this;
     const { currentPage, pageSize, context } = this;
      this.getOrgGridList({
        currentPage,
        pageSize,
        name: context,
      })
        .then((res) => {
          if (res.code === 200) {
            res.data.records.forEach((item) => {
              item.status === 1 ? (item.status = true) : (item.status = false);
            });
            that.totalNum = res.data.total;
            that.tableData = res.data.records;
            this.renderFlag = true;
          }
        });
    },
    handleAdd() {
      this.handheldGrid = {
        id: 0,
        name: "",
        worker: "",
        contact: "",
        area: "",
        description: "",
        region: "",
      };
      this.dialogUpdate = true;
    },
    handleEdit(row) {
      this.handheldGrid = row;
      this.dialogUpdate = true;
    },
    handleDelete(row) {
      this.$confirm("确认删除?").then((_) => {
        this.deleteOrgGrid(row.id).then((res) => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
          this.getList();
        });
      });
    },
    // 设置表格斑马纹
    tableRowClassName({ row, rowIndex }) {
      if ((rowIndex + 1) % 2 === 0) {
        return "warning-row";
      } else {
        return "success-row";
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.mainContent {
@@ -381,4 +262,85 @@
    }
  }
}
header {
  background-color: white;
  display: flex;
  .headerContent {
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .search {
      display: flex;
      justify-content: flex-start;
      line-height: 2;
      span {
        flex: 1;
      }
      .el-input {
        flex: 2;
        color: #1d3f57;
      }
      .el-select {
        flex: 1;
      }
      .el-date-editor {
        flex: 1;
      }
    }
    .findBtn {
      line-height: 100px;
      margin-left: 15px;
      display: flex;
      align-items: center;
      margin-top: -2px;
      .el-button {
        padding: 12px 25px;
        border-radius: 20px;
      }
    }
    ::v-deep .el-form {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      .el-form-item {
        width: 30%;
      }
      .el-form-item__label {
        color: #4b9bb7;
      }
    }
  }
}
.operation {
  display: flex;
  .line {
    padding: 0 5px;
  }
  span:hover {
    cursor: pointer;
  }
}
.main-title {
  line-height: 20px;
  padding: 10px 20px;
  margin-left: auto;
  border-radius: 20px;
  .el-button {
    padding: 12px 25px;
    border-radius: 20px;
  }
}
</style>