From f5641fd76ef90a66599e8ce121f3acfd97d779e8 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 16 Jul 2021 11:44:43 +0800
Subject: [PATCH] 样式

---
 src/views/security/security copy.vue |  559 ++++++++++++++++++++++++++++++-------------------------
 1 files changed, 304 insertions(+), 255 deletions(-)

diff --git a/src/views/security/security copy.vue b/src/views/security/security copy.vue
index 17551af..72f5444 100644
--- a/src/views/security/security copy.vue
+++ b/src/views/security/security copy.vue
@@ -1,24 +1,50 @@
 <template>
   <basic-container>
-    <avue-crud :option="option" :table-loading="loading" :data="data" :page="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">
+    <avue-crud
+      :option="option"
+      :table-loading="loading"
+      :data="data"
+      :page="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 type="danger" size="small" icon="el-icon-delete" plain v-if="permission.security_delete" @click="handleDelete">删
-          除
+        <el-button
+          type="danger"
+          size="small"
+          icon="el-icon-delete"
+          plain
+          v-if="permission.security_delete"
+          @click="handleDelete"
+          >删 除
         </el-button>
       </template>
 
       <template slot-scope="{ row }" slot="jtype">
-        <el-tag>{{
-          row.jtype == "0" ? "否" : row.jtype == "1" ? "是" : "无"
-          }}
+        <el-tag
+          >{{ row.jtype == "0" ? "否" : row.jtype == "1" ? "是" : "无" }}
         </el-tag>
       </template>
 
       <template slot-scope="{ type, size, row }" slot="menu">
-        <el-button icon="el-icon-location-outline" :size="size" :type="type" @click.stop="handleMap(row)">编辑电子围栏
+        <el-button
+          icon="el-icon-location-outline"
+          :size="size"
+          :type="type"
+          @click.stop="handleMap(row)"
+          >编辑电子围栏
         </el-button>
       </template>
     </avue-crud>
@@ -29,293 +55,316 @@
     </el-drawer> -->
     <el-drawer title="电子地图" append-to-body="true" :visible.sync="showMap">
       <iframe
-                id="securityMap"
-                ref="securityMap"
-                :src="baseUrl"
-                frameborder="0"
-                width="100%"
-                height="100%"
-                name="securityMap"
-              ></iframe>
+        id="securityMap"
+        ref="securityMap"
+        :src="baseUrl"
+        frameborder="0"
+        width="100%"
+        height="100%"
+        name="securityMap"
+      ></iframe>
     </el-drawer>
   </basic-container>
 </template>
 
 <script>
-  import {getList} from "@/api/security/security";
-  import {getDetail,add,update,remove} from "@/api/system/user";
-  import {mapGetters} from "vuex";
-  export default {
-    data() {
-      return {
-        baseUrl:"/map/index.html?ISinit=1",
-        form: {},
-        query: {},
-        loading: true,
-        showMap: false,
-        page: {
-          pageSize: 10,
-          currentPage: 1,
-          total: 0
-        },
-        dialogVisible: false,
-        selectionList: [],
-        option: {
-          height: 'auto',
-          calcHeight: 54,
-          tip: false,
-          searchShow: true,
-          searchMenuSpan: 6,
-          menuWidth:300,
-          border: false,
-          stripe: true,
-          index: true,
-          viewBtn: true,
-          selection: true,
-          dialogClickModal: false,
-          column: [{
+import { getList } from "@/api/security/security";
+import { getDetail, add, update, remove } from "@/api/system/user";
+import { mapGetters } from "vuex";
+export default {
+  data() {
+    return {
+      baseUrl: "/map/index.html?ISinit=1",
+      form: {},
+      query: {},
+      loading: true,
+      showMap: false,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+      },
+      dialogVisible: false,
+      selectionList: [],
+      option: {
+        height: "auto",
+        calcHeight: 54,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        menuWidth: 300,
+        border: false,
+        //stripe:true,
+        index: true,
+        viewBtn: true,
+        selection: true,
+        dialogClickModal: false,
+        column: [
+          {
             label: "账号",
             prop: "account",
-            rules: [{
-              required: true,
-              message: "请输入账号",
-              trigger: "blur"
-            }]
+            rules: [
+              {
+                required: true,
+                message: "请输入账号",
+                trigger: "blur",
+              },
+            ],
           },
-            {
-              label: "人员编号",
-              prop: "code",
-              search: true,
-              rules: [{
+          {
+            label: "人员编号",
+            prop: "code",
+            search: true,
+            rules: [
+              {
                 required: true,
                 message: "请输入人员编号",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "人员姓名",
-              prop: "realName",
-              search: true,
-              rules: [{
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "人员姓名",
+            prop: "realName",
+            search: true,
+            rules: [
+              {
                 required: true,
                 message: "请输入名称",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "所属部门",
-              prop: "deptName"
-            },
-            {
-              label: "性别",
-              prop: "sex",
-              type: "select",
-              dicData: [{
-                label: "男",
-                value: 1
+                trigger: "blur",
               },
-                {
-                  label: "女",
-                  value: 2
-                },
-              ],
-            },
-            {
-              label: "联系电话",
-              prop: "phone",
-              rules: [{
+            ],
+          },
+          {
+            label: "所属部门",
+            prop: "deptName",
+          },
+          {
+            label: "性别",
+            prop: "sex",
+            type: "select",
+            dicData: [
+              {
+                label: "男",
+                value: 1,
+              },
+              {
+                label: "女",
+                value: 2,
+              },
+            ],
+          },
+          {
+            label: "联系电话",
+            prop: "phone",
+            rules: [
+              {
                 required: true,
                 message: "请输入联系电话",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "邮箱",
-              prop: "email",
-              rules: [{
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "邮箱",
+            prop: "email",
+            rules: [
+              {
                 required: false,
                 message: "请输入邮箱",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "生日",
-              prop: "birthday",
-              rules: [{
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "生日",
+            prop: "birthday",
+            rules: [
+              {
                 required: false,
                 message: "请选择",
-                trigger: "blur"
-              }]
-            }
-          ]
-        },
-        data: []
+                trigger: "blur",
+              },
+            ],
+          },
+        ],
+      },
+      data: [],
+    };
+  },
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.security_add, true),
+        viewBtn: this.vaildData(this.permission.security_view, false),
+        delBtn: this.vaildData(this.permission.security_delete, true),
+        editBtn: this.vaildData(this.permission.security_edit, true),
       };
     },
-    computed: {
-      ...mapGetters(["permission"]),
-      permissionList() {
-        return {
-          addBtn: this.vaildData(this.permission.security_add, true),
-          viewBtn: this.vaildData(this.permission.security_view, false),
-          delBtn: this.vaildData(this.permission.security_delete, true),
-          editBtn: this.vaildData(this.permission.security_edit, true)
-        };
-      },
-      ids() {
-        let ids = [];
-        this.selectionList.forEach(ele => {
-          ids.push(ele.id);
-        });
-        return ids.join(",");
-      }
+    ids() {
+      let ids = [];
+      this.selectionList.forEach((ele) => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
     },
-    methods: {
-      rowSave(row, done, loading) {
-        add(row).then(() => {
+  },
+  methods: {
+    rowSave(row, done, loading) {
+      add(row).then(
+        () => {
           this.onLoad(this.page);
           this.$message({
             type: "success",
-            message: "操作成功!"
+            message: "操作成功!",
           });
           done();
-        }, error => {
+        },
+        (error) => {
           loading();
           window.console.log(error);
-        });
-      },
-      rowUpdate(row, index, done, loading) {
-        update(row).then(() => {
+        }
+      );
+    },
+    rowUpdate(row, index, done, loading) {
+      update(row).then(
+        () => {
           this.onLoad(this.page);
           this.$message({
             type: "success",
-            message: "操作成功!"
+            message: "操作成功!",
           });
           done();
-        }, error => {
+        },
+        (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: "操作成功!"
-            });
-          });
-      },
-      //打开地图
-      handleMap(row) {
-        var that =this;
-        this.showMap=true;
-        if(row.jd=="" || row.jd=="0.0"){
-          var rwjd = "115.862321";
-          var rwwd = "28.591108";
-          that.baseUrl = `/map/index.html?ISinit=1&openid=SecurityMap&jd=${rwjd}&wd=${rwwd}&code=${row.code}&name=${row.realName}`;
-        }else{
-          that.baseUrl = `/map/index.html?ISinit=1&openid=SecurityMap&jd=${row.jd}&wd=${row.wd}&code=${row.code}&name=${row.realName}`;
         }
-        
-        this.$nextTick(() => {
-          this.$refs.securityMap.onload = () => {
-            if (window.frames[1].init) {
-              if(row.jd=="" || row.jd=="0.0"){
-                //如果处警员无位置信息,则赋值一个默认数据,否则地图无法加载
-                window.frames[1].init("SecurityMap", {
-                                x: rwjd,
-                                y: rwwd,
-                                code:row.code
-                            });
-              }else{
-                window.frames[1].init("SecurityMap", {
-                                x: row.jd,
-                                y: row.wd,
-                                code:row.code
-                            });
-              }
-              
+      );
+    },
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+        });
+    },
+    //打开地图
+    handleMap(row) {
+      var that = this;
+      this.showMap = true;
+      if (row.jd == "" || row.jd == "0.0") {
+        var rwjd = "115.862321";
+        var rwwd = "28.591108";
+        that.baseUrl = `/map/index.html?ISinit=1&openid=SecurityMap&jd=${rwjd}&wd=${rwwd}&code=${row.code}&name=${row.realName}`;
+      } else {
+        that.baseUrl = `/map/index.html?ISinit=1&openid=SecurityMap&jd=${row.jd}&wd=${row.wd}&code=${row.code}&name=${row.realName}`;
+      }
+
+      this.$nextTick(() => {
+        this.$refs.securityMap.onload = () => {
+          if (window.frames[1].init) {
+            if (row.jd == "" || row.jd == "0.0") {
+              //如果处警员无位置信息,则赋值一个默认数据,否则地图无法加载
+              window.frames[1].init("SecurityMap", {
+                x: rwjd,
+                y: rwwd,
+                code: row.code,
+              });
             } else {
-              console.log(`没有找到到window.frames[1].init`)
+              window.frames[1].init("SecurityMap", {
+                x: row.jd,
+                y: row.wd,
+                code: row.code,
+              });
             }
+          } else {
+            console.log(`没有找到到window.frames[1].init`);
           }
-        });
-      },
-      handleDelete() {
-        if (this.selectionList.length === 0) {
-          this.$message.warning("请选择至少一条数据");
-          return;
-        }
-        this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
+        };
+      });
+    },
+    handleDelete() {
+      if (this.selectionList.length === 0) {
+        this.$message.warning("请选择至少一条数据");
+        return;
+      }
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(this.ids);
         })
-          .then(() => {
-            return remove(this.ids);
-          })
-          .then(() => {
-            this.onLoad(this.page);
-            this.$message({
-              type: "success",
-              message: "操作成功!"
-            });
-            this.$refs.crud.toggleSelection();
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
           });
-      },
-      beforeOpen(done, type) {
-        if (["edit", "view"].includes(type)) {
-          getDetail(this.form.id).then(res => {
-            this.form = res.data.data;
-          });
-        }
-        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;
-        getList(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();
+          this.$refs.crud.toggleSelection();
+        });
+    },
+    beforeOpen(done, type) {
+      if (["edit", "view"].includes(type)) {
+        getDetail(this.form.id).then((res) => {
+          this.form = res.data.data;
         });
       }
-    }
-  };
+      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;
+      getList(
+        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();
+      });
+    },
+  },
+};
 </script>

--
Gitblit v1.9.3