From 2fe7ce75ab7b9c07c64ae3e7af65c3414059b2b5 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 07 Feb 2023 16:57:34 +0800
Subject: [PATCH] 登录方式更改

---
 src/views/security/security.vue |  782 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 394 insertions(+), 388 deletions(-)

diff --git a/src/views/security/security.vue b/src/views/security/security.vue
index 1f8bd5a..01c3cf3 100644
--- a/src/views/security/security.vue
+++ b/src/views/security/security.vue
@@ -1,410 +1,416 @@
 <template>
-  <basic-container>
-    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
-      :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
-      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
-      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
-      <template slot="menuLeft">
-        <el-button size="small" icon="el-icon-delete" plain v-if="permission.security_delete" @click="handleDelete">删 除
-        </el-button>
-      </template>
-      <template slot-scope="{type,size,row,index}" slot="menu">
-        <el-button icon="el-icon-coordinate" :size="size" :type="type" @click="handlePersonList(row)">活动人员</el-button>
-        <el-button icon="el-icon-data-line" :size="size" :type="type" @click="handleCarList(row)">活动车辆</el-button>
-      </template>
-    </avue-crud>
+    <basic-container>
+        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
+            :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave"
+            @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
+            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+            @refresh-change="refreshChange" @on-load="onLoad">
+            <template slot="menuLeft">
+                <el-button size="small" icon="el-icon-delete" plain v-if="permission.security_delete"
+                    @click="handleDelete">删 除
+                </el-button>
+            </template>
+            <template slot-scope="{type,size,row,index}" slot="menu">
+                <el-button icon="el-icon-coordinate" :size="size" :type="type"
+                    @click="handlePersonList(row)">活动人员</el-button>
+                <el-button icon="el-icon-data-line" :size="size" :type="type"
+                    @click="handleCarList(row)">活动车辆</el-button>
+            </template>
+        </avue-crud>
 
-    <el-drawer title="活动人员区域" :visible.sync="personBox" :append-to-body="true" size="50%" :destroy-on-close="true">
-      <securityManage ref="securityManage" :securityId="securityId"/>
-    </el-drawer>
+        <el-drawer title="活动人员区域" :visible.sync="personBox" :append-to-body="true" size="50%" :destroy-on-close="true">
+            <securityManage ref="securityManage" :securityId="securityId" />
+        </el-drawer>
 
-    <el-drawer title="活动车辆区域" :visible.sync="carBox" :append-to-body="true" size="50%" :destroy-on-close="true">
-      <securityManageCar ref="car" :securityId="securityId"/>
-    </el-drawer>
-  </basic-container>
+        <el-drawer title="活动车辆区域" :visible.sync="carBox" :append-to-body="true" size="50%" :destroy-on-close="true">
+            <securityManageCar ref="car" :securityId="securityId" />
+        </el-drawer>
+    </basic-container>
 </template>
 
 <script>
-import { getPage, getDetail, add, update, remove } from "@/api/security/security";
-import { getUserInfos } from "@/api/system/user";
+import { getPage, getDetail, add, update, remove } from "@/api/security/security"
+import { getUserInfos } from "@/api/system/user"
 // import AvueMap from 'avue-plugin-map';
-import { mapGetters } from "vuex";
+import { mapGetters } from "vuex"
 import securityManage from "@/views/securityManage/securityManage"
 import securityManageCar from "@/views/securityManageCar/securityManageCar"
 
 export default {
-  components: {
-    securityManage,
-    securityManageCar
-  },
-  data() {
-    return {
-      securityId:"",
-      carBox: false,
-      personBox: false,
-      form: {},
-      query: {},
-      loading: true,
-      page: {
-        pageSize: 10,
-        currentPage: 1,
-        total: 0
-      },
-      selectionList: [],
-      option: {
-        height: 'auto',
-        calcHeight: 30,
-        labelWidth: "100",
-        dialogWidth: 950,
-        tip: false,
-        searchShow: true,
-        searchMenuSpan: 6,
-        border: true,
-        index: true,
-        viewBtn: true,
-        selection: true,
-        excelBtn: true,
-        dialogClickModal: false,
-        menuWidth: 370,
-        column: [
-          {
-            label: "活动名称",
-            prop: "name",
-            search: true,
-            searchSpan: 4,
-            rules: [{
-              required: true,
-              message: "请输入活动名称",
-              trigger: "blur"
-            }],
-          },
-          {
-            label: "负责单位",
-            prop: "company",
-          },
-          {
-            label: "负责人",
-            prop: "person",
-            width: 80,
-            rules: [{
-              required: true,
-              message: "请输入负责人",
-              trigger: "blur"
-            }],
-          },
-          {
-            label: "联系方式",
-            prop: "contact",
-            width: 100,
-            rules: [{
-              required: true,
-              message: "请输入联系方式",
-              trigger: "blur"
-            }],
-          },
-          {
-            label: "活动地点",
-            prop: "place",
-            // addDisplay: false,
-            // editDisplay: false,
-            // viewDisplay: false,
-          },
-          {
-            label: "所属辖区",
-            prop: "deptId",
-            type: "tree",
-            dicUrl: "api/blade-system/dept/lazy-list",
-            props: {
-              label: 'deptName',
-              value: 'id',
-              children: 'children'
+    components: {
+        securityManage,
+        securityManageCar
+    },
+    data () {
+        return {
+            securityId: "",
+            carBox: false,
+            personBox: false,
+            form: {},
+            query: {},
+            loading: true,
+            page: {
+                pageSize: 10,
+                currentPage: 1,
+                total: 0
             },
-            search: true,
-            searchSpan: 4,
-            width: 110,
-            rules: [{
-              required: true,
-              message: "请选择所属辖区",
-              trigger: "blur"
-            }]
-          },
-          // {
-          //   label: "地址",
-          //   prop: "avueMap",
-          //   type: "map",
-          // },
-          {
-            label: "开始时间",
-            prop: "startTime",
-            type: "datetime",
-            defaultTime: '00:00:00',
-            format: "yyyy-MM-dd HH:mm",
-            valueFormat: "yyyy-MM-dd HH:mm:ss",
-            rules: [{
-              required: true,
-              message: "请输入开始时间",
-              trigger: "blur"
-            }],
-            width: 120,
-          },
-          {
-            label: "结束时间",
-            prop: "endTime",
-            type: "datetime",
-            defaultTime: '23:59:59',
-            format: "yyyy-MM-dd HH:mm",
-            valueFormat: "yyyy-MM-dd HH:mm",
-            rules: [{
-              required: true,
-              message: "请输入结束时间",
-              trigger: "blur"
-            }],
-            width: 120,
-          },
-          
-          {
-            label: "经度",
-            prop: "longitude",
-            span: 12,
-            hide: true,
-            rules: [{
-              required: true,
-              message: "请输入纬度",
-              trigger: "blur"
-            }],
-          },
-          {
-            label: "纬度",
-            prop: "latitude",
-            span: 12,
-            hide: true,
-            rules: [{
-              required: true,
-              message: "请输入纬度",
-              trigger: "blur"
-            }],
-          },
-          // {
-          //   label: "",
-          //   prop: "map",
-          //   labelWidth: 10,
-          //   searchSpan: 0,
-          //   // maxlength: 5,
-          //   hide: true,
-          //   span: 3,
-          //   // display:false,
-          //   component: "AvueMap",
-          // },
-          
-          {
-            label: "活动类型",
-            prop: "type",
-            type: "select",
-            dicUrl: "/api/blade-system/dict-biz/dictionary?code=securityType",
-            props: {
-              label: "dictValue",
-              value: "dictKey"
+            selectionList: [],
+            option: {
+                height: 'auto',
+                calcHeight: 30,
+                labelWidth: "100",
+                dialogWidth: 950,
+                tip: false,
+                searchShow: true,
+                searchMenuSpan: 6,
+                border: true,
+                index: true,
+                viewBtn: true,
+                selection: true,
+                excelBtn: true,
+                dialogClickModal: false,
+                menuWidth: 370,
+                column: [
+                    {
+                        label: "活动名称",
+                        prop: "name",
+                        search: true,
+                        searchSpan: 4,
+                        rules: [{
+                            required: true,
+                            message: "请输入活动名称",
+                            trigger: "blur"
+                        }],
+                    },
+                    {
+                        label: "负责单位",
+                        prop: "company",
+                    },
+                    {
+                        label: "负责人",
+                        prop: "person",
+                        width: 80,
+                        rules: [{
+                            required: true,
+                            message: "请输入负责人",
+                            trigger: "blur"
+                        }],
+                    },
+                    {
+                        label: "联系方式",
+                        prop: "contact",
+                        width: 100,
+                        rules: [{
+                            required: true,
+                            message: "请输入联系方式",
+                            trigger: "blur"
+                        }],
+                    },
+                    {
+                        label: "活动地点",
+                        prop: "place",
+                        // addDisplay: false,
+                        // editDisplay: false,
+                        // viewDisplay: false,
+                    },
+                    {
+                        label: "所属辖区",
+                        prop: "deptId",
+                        type: "tree",
+                        dicUrl: "api/blade-system/dept/lazy-list",
+                        props: {
+                            label: 'deptName',
+                            value: 'id',
+                            children: 'children'
+                        },
+                        search: true,
+                        searchSpan: 4,
+                        width: 110,
+                        rules: [{
+                            required: true,
+                            message: "请选择所属辖区",
+                            trigger: "blur"
+                        }]
+                    },
+                    // {
+                    //   label: "地址",
+                    //   prop: "avueMap",
+                    //   type: "map",
+                    // },
+                    {
+                        label: "开始时间",
+                        prop: "startTime",
+                        type: "datetime",
+                        defaultTime: '00:00:00',
+                        format: "yyyy-MM-dd HH:mm",
+                        valueFormat: "yyyy-MM-dd HH:mm:ss",
+                        rules: [{
+                            required: true,
+                            message: "请输入开始时间",
+                            trigger: "blur"
+                        }],
+                        width: 120,
+                    },
+                    {
+                        label: "结束时间",
+                        prop: "endTime",
+                        type: "datetime",
+                        defaultTime: '23:59:59',
+                        format: "yyyy-MM-dd HH:mm",
+                        valueFormat: "yyyy-MM-dd HH:mm",
+                        rules: [{
+                            required: true,
+                            message: "请输入结束时间",
+                            trigger: "blur"
+                        }],
+                        width: 120,
+                    },
+
+                    {
+                        label: "经度",
+                        prop: "longitude",
+                        span: 12,
+                        hide: true,
+                        rules: [{
+                            required: true,
+                            message: "请输入纬度",
+                            trigger: "blur"
+                        }],
+                    },
+                    {
+                        label: "纬度",
+                        prop: "latitude",
+                        span: 12,
+                        hide: true,
+                        rules: [{
+                            required: true,
+                            message: "请输入纬度",
+                            trigger: "blur"
+                        }],
+                    },
+                    // {
+                    //   label: "",
+                    //   prop: "map",
+                    //   labelWidth: 10,
+                    //   searchSpan: 0,
+                    //   // maxlength: 5,
+                    //   hide: true,
+                    //   span: 3,
+                    //   // display:false,
+                    //   component: "AvueMap",
+                    // },
+
+                    {
+                        label: "活动类型",
+                        prop: "type",
+                        type: "select",
+                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=securityType",
+                        props: {
+                            label: "dictValue",
+                            value: "dictKey"
+                        },
+                        rules: [{
+                            required: true,
+                            message: "请选择活动类型",
+                            trigger: "blur"
+                        }],
+                        width: 90,
+                    },
+                    {
+                        label: "人数",
+                        prop: "number",
+                        width: 60,
+                    },
+                    {
+                        label: "活动内容",
+                        prop: "content",
+                        type: "textarea",
+                        span: 24
+                    },
+                ]
             },
-            rules: [{
-              required: true,
-              message: "请选择活动类型",
-              trigger: "blur"
-            }],
-            width: 90,
-          },
-          {
-            label: "人数",
-            prop: "number",
-            width: 60,
-          },
-          {
-            label: "活动内容",
-            prop: "content",
-            type:"textarea",
-            span:24
-          },
-        ]
-      },
-      data: []
-    };
-  },
-  // watch: {
-  //   //latitude   longitude   formattedAddress
-  //   "form.avueMap":{
-  //     handler (newObj) {
-  //       if (newObj.length>0) {
-  //         this.form.place = newObj[2]
-  //         this.form.position = newObj[0]+","+newObj[1]
-  //       }
-  //     }
-  //   }
-  // },
-  computed: {
-    ...mapGetters(["userInfo", "permission"]),
-    permissionList() {
-      return {
-        addBtn: this.vaildData(this.permission.security_add, false),
-        viewBtn: this.vaildData(this.permission.security_view, false),
-        delBtn: this.vaildData(this.permission.security_delete, false),
-        editBtn: this.vaildData(this.permission.security_edit, false)
-      };
+            data: []
+        }
     },
-    ids() {
-      let ids = [];
-      this.selectionList.forEach(ele => {
-        ids.push(ele.id);
-      });
-      return ids.join(",");
-    }
-  },
-  created(){
-    const tokenLength = window.location.href.indexOf('=');
-    if(tokenLength>0){
-      //取“=”之后的token
-      let z = window.location.href.substring(tokenLength + 1)
-      this.$store.commit('SET_TOKEN', z);
-      this.$store.commit('DEL_ALL_TAG');
-      this.$store.commit('CLEAR_LOCK');
-      this.getUserInfo()
-    }
-  },
-  methods: {
-    getUserInfo(){
-      getUserInfos().then(res=>{
-         this.$store.commit('SET_USER_INFO', res.data.data);
-      })
+    // watch: {
+    //   //latitude   longitude   formattedAddress
+    //   "form.avueMap":{
+    //     handler (newObj) {
+    //       if (newObj.length>0) {
+    //         this.form.place = newObj[2]
+    //         this.form.position = newObj[0]+","+newObj[1]
+    //       }
+    //     }
+    //   }
+    // },
+    computed: {
+        ...mapGetters(["userInfo", "permission"]),
+        permissionList () {
+            return {
+                addBtn: this.vaildData(this.permission.security_add, false),
+                viewBtn: this.vaildData(this.permission.security_view, false),
+                delBtn: this.vaildData(this.permission.security_delete, false),
+                editBtn: this.vaildData(this.permission.security_edit, false)
+            }
+        },
+        ids () {
+            let ids = []
+            this.selectionList.forEach(ele => {
+                ids.push(ele.id)
+            })
+            return ids.join(",")
+        }
     },
-    rowSave(row, done, loading) {
-      row.position = row.longitude + " " + row.latitude;
-      add(row).then(() => {
-        this.onLoad(this.page);
-        this.$message({
-          type: "success",
-          message: "操作成功!"
-        });
-        done();
-      }, error => {
-        loading();
-        window.console.log(error);
-      });
+    created () {
+        const tokenLength = window.location.href.indexOf('=')
+        if (tokenLength > 0) {
+            //取“=”之后的token
+            this.getUserInfo()
+        }
     },
-    rowUpdate(row, index, done, loading) {
-      row.position = row.longitude + " " + row.latitude;
-      update(row).then(() => {
-        this.onLoad(this.page);
-        this.$message({
-          type: "success",
-          message: "操作成功!"
-        });
-        done();
-      }, error => {
-        loading();
-        console.log(error);
-      });
-    },
-    rowDel(row) {
-      this.$confirm("确定将选择数据删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-        .then(() => {
-          return remove(row.id);
-        })
-        .then(() => {
-          this.onLoad(this.page);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
-          });
-        });
-    },
-    handleDelete() {
-      if (this.selectionList.length === 0) {
-        this.$message.warning("请选择至少一条数据");
-        return;
-      }
-      this.$confirm("确定将选择数据删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-        .then(() => {
-          return remove(this.ids);
-        })
-        .then(() => {
-          this.onLoad(this.page);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
-          });
-          this.$refs.crud.toggleSelection();
-        });
-    },
-    beforeOpen(done, type) {
-      if (["edit", "view"].includes(type)) {
-        getDetail(this.form.id).then(res => {
-            var data = res.data.data;
-            this.form = data;
-            this.form['longitude'] = data.position.split(" ")[0]
-            this.form['latitude'] = data.position.split(" ")[1]
-        });
-      }
-      done();
-    },
-    searchReset() {
-      this.query = {};
-      this.onLoad(this.page);
-    },
-    searchChange(params, done) {
-      this.query = params;
-      this.page.currentPage = 1;
-      this.onLoad(this.page, params);
-      done();
-    },
-    selectionChange(list) {
-      this.selectionList = list;
-    },
-    selectionClear() {
-      this.selectionList = [];
-      this.$refs.crud.toggleSelection();
-    },
-    currentChange(currentPage) {
-      this.page.currentPage = currentPage;
-    },
-    sizeChange(pageSize) {
-      this.page.pageSize = pageSize;
-    },
-    refreshChange() {
-      this.onLoad(this.page, this.query);
-    },
-    onLoad(page, params = {}) {
-      this.loading = true;
+    methods: {
+        getUserInfo () {
+            getUserInfos().then(res => {
+                const data = res.data
+                this.$store.commit('SET_TOKEN', data.access_token)
+                this.$store.commit('SET_REFRESH_TOKEN', data.refresh_token)
+                this.$store.commit('SET_TENANT_ID', data.tenant_id)
+                this.$store.commit('SET_USER_INFO', data)
+                this.$store.commit('DEL_ALL_TAG')
+                this.$store.commit('CLEAR_LOCK')
+            })
+        },
+        rowSave (row, done, loading) {
+            row.position = row.longitude + " " + row.latitude
+            add(row).then(() => {
+                this.onLoad(this.page)
+                this.$message({
+                    type: "success",
+                    message: "操作成功!"
+                })
+                done()
+            }, error => {
+                loading()
+                window.console.log(error)
+            })
+        },
+        rowUpdate (row, index, done, loading) {
+            row.position = row.longitude + " " + row.latitude
+            update(row).then(() => {
+                this.onLoad(this.page)
+                this.$message({
+                    type: "success",
+                    message: "操作成功!"
+                })
+                done()
+            }, error => {
+                loading()
+                console.log(error)
+            })
+        },
+        rowDel (row) {
+            this.$confirm("确定将选择数据删除?", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning"
+            })
+                .then(() => {
+                    return remove(row.id)
+                })
+                .then(() => {
+                    this.onLoad(this.page)
+                    this.$message({
+                        type: "success",
+                        message: "操作成功!"
+                    })
+                })
+        },
+        handleDelete () {
+            if (this.selectionList.length === 0) {
+                this.$message.warning("请选择至少一条数据")
+                return
+            }
+            this.$confirm("确定将选择数据删除?", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning"
+            })
+                .then(() => {
+                    return remove(this.ids)
+                })
+                .then(() => {
+                    this.onLoad(this.page)
+                    this.$message({
+                        type: "success",
+                        message: "操作成功!"
+                    })
+                    this.$refs.crud.toggleSelection()
+                })
+        },
+        beforeOpen (done, type) {
+            if (["edit", "view"].includes(type)) {
+                getDetail(this.form.id).then(res => {
+                    var data = res.data.data
+                    this.form = data
+                    this.form['longitude'] = data.position.split(" ")[0]
+                    this.form['latitude'] = data.position.split(" ")[1]
+                })
+            }
+            done()
+        },
+        searchReset () {
+            this.query = {}
+            this.onLoad(this.page)
+        },
+        searchChange (params, done) {
+            this.query = params
+            this.page.currentPage = 1
+            this.onLoad(this.page, params)
+            done()
+        },
+        selectionChange (list) {
+            this.selectionList = list
+        },
+        selectionClear () {
+            this.selectionList = []
+            this.$refs.crud.toggleSelection()
+        },
+        currentChange (currentPage) {
+            this.page.currentPage = currentPage
+        },
+        sizeChange (pageSize) {
+            this.page.pageSize = pageSize
+        },
+        refreshChange () {
+            this.onLoad(this.page, this.query)
+        },
+        onLoad (page, params = {}) {
+            this.loading = true
 
-      if (this.userInfo.role_name != "admin" && this.userInfo.role_name != "administrator") {
-        params["jurisdiction"] = this.userInfo.dept_id;
-      }
+            if (this.userInfo.role_name != "admin" && this.userInfo.role_name != "administrator") {
+                params["jurisdiction"] = this.userInfo.dept_id
+            }
 
-      getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
-        const data = res.data.data;
-        this.page.total = data.total;
-        this.data = data.records;
-        this.loading = false;
-        this.selectionClear();
-      });
-    },
-    //活动人员区域点击按钮事件
-    handlePersonList(row) {
-      this.personBox = true;
-      this.securityId = row.id
-    },
-    //活动车辆区域点击按钮事件
-    handleCarList(row) {
-      this.carBox = true;
-      this.securityId = row.id
+            getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+                const data = res.data.data
+                this.page.total = data.total
+                this.data = data.records
+                this.loading = false
+                this.selectionClear()
+            })
+        },
+        //活动人员区域点击按钮事件
+        handlePersonList (row) {
+            this.personBox = true
+            this.securityId = row.id
+        },
+        //活动车辆区域点击按钮事件
+        handleCarList (row) {
+            this.carBox = true
+            this.securityId = row.id
+        }
     }
-  }
-};
+}
 </script>
 
 <style>

--
Gitblit v1.9.3