Parcourir la source

行为感知增加添加人员

tianyabing il y a 2 ans
Parent
commit
1760306797

+ 181 - 0
src/components/common/dialog/selectUserDialog.vue

@@ -0,0 +1,181 @@
+<script>
+import SecurityDeviceSelect from "@/components/security/common/securityDeviceSelect.vue";
+export default {
+  comments: {
+    SecurityDeviceSelect
+  },
+  props: {
+    callback: Function,
+    show: Boolean,
+  },
+  data() {
+    return {
+      companyData: [
+        {
+          title: '北京电信规划院',
+          key: '北京电信规划院'
+        }
+      ],
+      data: [
+        {
+          name: '李自成',
+          phone: '15602407624',
+          dept: '业务一部',
+        },
+        {
+          name: '张丰毅',
+          phone: '13084694502',
+          dept: '业务一部',
+        },
+        {
+          name: '李佳佳',
+          phone: '13002413640',
+          dept: '业务一部',
+        },
+        {
+          name: '王雪',
+          phone: '17574063735',
+          dept: '业务一部',
+        },
+        {
+          name: '吴义刚',
+          phone: '17135546914',
+          dept: '业务一部',
+        },
+        {
+          name: '王羽',
+          phone: '15970548072',
+          dept: '业务一部',
+        },
+        {
+          name: '李一水',
+          phone: '13485387535',
+          dept: '业务一部',
+        },{
+          name: '张果果',
+          phone: '15826958745',
+          dept: '业务一部',
+        },{
+          name: '王峰',
+          phone: '17658963247',
+          dept: '业务一部',
+        },{
+          name: '孙舒予',
+          phone: '13025698756',
+          dept: '业务一部',
+        },
+      ],
+      columns: [
+        {
+          title: "姓名",
+          dataIndex: "name",
+          key: "name",
+          scopedSlots: { customRender: 'name' },
+        },
+        {
+          title: "手机号",
+          dataIndex: "phone",
+          key: "phone",
+          scopedSlots: { customRender: 'phone' },
+        },
+        {
+          title: "部门",
+          dataIndex: "dept",
+          key: "dept",
+          scopedSlots: { customRender: 'dept' },
+        },
+      ],
+      selectedRowKeys: [],
+    }
+  },
+  emits: ["update:show"],
+  setup(props, context) {
+    const methods = {
+      updateShow(obj) {
+        context.emit("update:show", obj);
+        if (!obj) {
+          this.selectedRowKeys = []
+        }
+      },
+    };
+    return methods;
+  },
+  mounted() {
+    this.selectedRowKeys = []
+  },
+  created() {
+  },
+  methods: {
+    ok() {
+      if (this.selectedRowKeys.length>0) {
+        let data = [];
+        this.selectedRowKeys.forEach(i=>{
+          data.push(this.data[i])
+        });
+        this.callback(data);
+        this.updateShow(false);
+      } else {
+        this.$message.warning('请至少选择一项')
+      }
+    },
+    addUser(val) {
+      //console.log(val)
+    },
+    onSelectChange(keys) {
+      this.selectedRowKeys = keys
+    }
+  }
+}
+</script>
+
+
+<template>
+
+  <div class="selectUserDialog">
+    <a-modal
+        title="添加人员"
+        v-if="show"
+        :visible="show"
+        width="900px"
+        @cancel="updateShow(false)"
+        @ok="ok"
+    >
+      <a-row :gutter="[12,12]" style="height: 450px">
+        <a-col :span="6" style="height: 100%">
+          <div class="selectUserDialog-company" style="height: 100%">
+            <SecurityDeviceSelect :select-first="true" left-title="名单" :tree-data="companyData" :callback="addUser"></SecurityDeviceSelect>
+          </div>
+        </a-col>
+        <a-col :span="18" style="height: 100%;">
+          <div class="selectUserDialog-userList">
+            <a-table
+                :rowKey=" (record, index) => index"
+                :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+                :columns="columns"
+                :data-source="data"
+                :scroll="{y: 400}"
+                :pagination="false"
+            >
+
+            </a-table>
+          </div>
+        </a-col>
+      </a-row>
+    </a-modal>
+  </div>
+</template>
+
+<style lang="less">
+.selectUserDialog {
+  width: 100%;
+  height: 100%;
+  .selectUserDialog-company {
+
+  }
+  .selectUserDialog-userList {
+
+  }
+}
+</style>
+
+

+ 4 - 0
src/components/common/query.vue

@@ -106,6 +106,7 @@ export default {
     reset: Function,
     search: Function,
     floorOptions: Array,
+    companyOptions: Array,
   },
   emits: ["update:queryData"],
   setup(props, context) {
@@ -236,6 +237,9 @@ export default {
     if (this.floorOptions) {
       this.floorData = this.floorOptions;
     }
+    if (this.companyOptions) {
+      this.companyData = this.companyOptions;
+    }
     if (this.queryData) {
       this.formData = JSON.parse(JSON.stringify(this.queryData));
       if (this.queryData.floorId == "0") {

+ 258 - 220
src/components/scene/access/sceneAccessAction.vue

@@ -26,9 +26,9 @@
               </template>
             </Query>
           </div>
-          <div style="padding: 0 4px 8px" v-show="false">
+          <div style="padding: 0 4px 8px" v-show="tableTitle&&tableTitle!=''">
             <span style="font-size: 16px;line-height: 30px;display: inline-block;color: #6b6b6b">{{ tableTitle }}-人员列表</span>
-            <a-button type="primary" size="small" style="font-size: 13px;float: right;width:120px;">添加人员</a-button>
+            <a-button @click="showAddUserVisible" type="primary" size="small" style="font-size: 13px;float: right;width:120px;">添加人员</a-button>
           </div>
           <a-table :columns="tableColumns" :data-source="tableData" :pagination="true"
                    :scroll="{ y: tableContainerHeight }" bordered>
@@ -38,7 +38,7 @@
                   title="确定要删除吗?"
                   ok-text="是"
                   cancel-text="否"
-                  @click="del(record)"
+                  @confirm="del(record)"
               >
                 <a-button type="link" > 删除 </a-button>
               </a-popconfirm>
@@ -72,21 +72,26 @@
     >
       <a-input v-model="personListName" placeholder="请输入名单名称" />
     </a-modal>
+
+    <SelectUserDialog :show.sync="showAddUser" :callback="addUser" ></SelectUserDialog>
   </div>
 </template>
 
 <script>
 import Query from "@/components/common/query.vue";
 import SceneSecurityPersonSelect from "@/components/scene/access/xingweiganzhi/SceneSecurityPersonSelect.vue";
+import SelectUserDialog from "@/components/common/dialog/selectUserDialog.vue";
 
 export default {
   components: {
     Query,
     SceneSecurityPersonSelect,
+    SelectUserDialog,
   },
   data() {
     return {
       tableTitle: '',
+      showAddUser: false,
       treeData: [
         {
           title: '重点名单',
@@ -167,222 +172,225 @@ export default {
       ],
       tableData:[],
       currItem: {},
-      originalData: [
-        {
-          key: '1',
-          visitor: "潘夏彤",
-          visitor_phone: "13038678756",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B3",
-          interviewee: "胡八一", interviewee_phone: "15643567892",
-          directionStatus: "进",
-        },
-        {
-          key: '2',
-          visitor: "庞慧",
-          visitor_phone: "13038678756",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入1F",
-          interviewee: "胡八一",
-          interviewee_phone: "15643567892",
-          directionStatus: "进",
-        },
-        {
-          key: '3',
-          visitor: "李天泽",
-          visitor_phone: "13038678756",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "张永军", interviewee_phone: "15643563892",
-          directionStatus: "进",
-        },
-        {
-          key: '4',
-          visitor: "张雪",
-          visitor_phone: "1589453012",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "胡八一", interviewee_phone: "15643567892",directionStatus: "进",
-        },
-        {
-          key: '5',
-          visitor: "王峰",
-          visitor_phone: "15638295684",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "胡八一", interviewee_phone: "15643563892",directionStatus: "进",
-        },
-        {
-          key: '6',
-          visitor: "张玉",
-          visitor_phone: "17856982569",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "胡八一", interviewee_phone: "15643563892",directionStatus: "进",
-        },
-        {
-          key: '7',
-          visitor: "李天泽",
-          visitor_phone: "13032678754",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "交流",
-          direction: "进入B2",
-          interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
-        },
-        {
-          key: '8',
-          visitor: "李天泽",
-          visitor_phone: "13032678754",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "交流",
-          direction: "进入B2",
-          interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
-        },
-        {
-          key: '9',
-          visitor: "李天泽",
-          visitor_phone: "13032678754",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "交流",
-          direction: "进入B2",
-          interviewee: "胡八一", interviewee_phone: "15943563892",directionStatus: "进",
-        },
-        {
-          key: '10',
-          visitor: "李天泽",
-          visitor_phone: "12232678754",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "交流",
-          direction: "进入B2",
-          interviewee: "胡八一", interviewee_phone: "15943563892",directionStatus: "进",
-        },
-        {
-          key: '11',
-          visitor: "李天泽",
-          visitor_phone: "12232678754",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "交流",
-          direction: "出去B2",
-          interviewee: "胡八一", interviewee_phone: "15943563892",directionStatus: "出",
-        },
-        {
-          key: '12',
-          visitor: "李天泽",
-          visitor_phone: "12232678759",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "交流",
-          direction: "出去B2",
-          interviewee: "刘一鸣", interviewee_phone: "15943463892",directionStatus: "出",
-        },
-        {
-          key: '13',
-          visitor: "李天泽",
-          visitor_phone: "15513548219",
-          department: "北京电信规划院",
-          time: "2023-03-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
-        },
-        {
-          key: '14',
-          visitor: "李天泽",
-          visitor_phone: "15513548214",
-          department: "北京电信规划院",
-          time: "2023-03-20 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
-        },
-        {
-          key: '15',
-          visitor: "李天泽",
-          visitor_phone: "15511548219",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
-        },
-        {
-          key: '16',
-          visitor: "李天泽",
-          visitor_phone: "15513548219",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
-        },
-        {
-          key: '17',
-          visitor: "李天泽",
-          visitor_phone: "15513548219",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "刘一鸣", interviewee_phone: "13943563892",directionStatus: "进",
-        },
-        {
-          key: '18',
-          visitor: "李天泽",
-          visitor_phone: "15513548219",
-          department: "北京电信规划院",
-          time: "2023-03-10 12:00:00",
-          reason: "开会",
-          direction: "出去B1",
-          interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "出",
-        },
-        {
-          key: '19',
-          visitor: "李天泽",
-          visitor_phone: "15513548219",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "出去B2",
-          interviewee: "钱多多", interviewee_phone: "15942563898",directionStatus: "出",
-        },
-        {
-          key: '20',
-          visitor: "李天泽",
-          visitor_phone: "15913548219",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "钱多多", interviewee_phone: "15942563898",directionStatus: "进",
-        },
-        {
-          key: '21',
-          visitor: "李天泽",
-          visitor_phone: "15913548219",
-          department: "北京电信规划院",
-          time: "2022-08-26 12:00:00",
-          reason: "开会",
-          direction: "进入B2",
-          interviewee: "钱多多", interviewee_phone: "15942563898",directionStatus: "进",
-        },
-      ]
+      originalData: [],
+      groupData: {
+        '重点名单': [
+          {
+            key: '1',
+            visitor: "潘夏彤",
+            visitor_phone: "13038678756",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B3",
+            interviewee: "胡八一", interviewee_phone: "15643567892",
+            directionStatus: "进",
+          },
+          {
+            key: '2',
+            visitor: "庞慧",
+            visitor_phone: "13038678756",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入1F",
+            interviewee: "胡八一",
+            interviewee_phone: "15643567892",
+            directionStatus: "进",
+          },
+          {
+            key: '3',
+            visitor: "李天泽",
+            visitor_phone: "13038678756",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "张永军", interviewee_phone: "15643563892",
+            directionStatus: "进",
+          },
+          {
+            key: '4',
+            visitor: "张雪",
+            visitor_phone: "1589453012",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "胡八一", interviewee_phone: "15643567892",directionStatus: "进",
+          },
+          {
+            key: '5',
+            visitor: "王峰",
+            visitor_phone: "15638295684",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "胡八一", interviewee_phone: "15643563892",directionStatus: "进",
+          },
+          {
+            key: '6',
+            visitor: "张玉",
+            visitor_phone: "17856982569",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "胡八一", interviewee_phone: "15643563892",directionStatus: "进",
+          },
+          {
+            key: '7',
+            visitor: "李天泽",
+            visitor_phone: "13032678754",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "交流",
+            direction: "进入B2",
+            interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
+          },
+          {
+            key: '8',
+            visitor: "李天泽",
+            visitor_phone: "13032678754",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "交流",
+            direction: "进入B2",
+            interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
+          },
+          {
+            key: '9',
+            visitor: "李天泽",
+            visitor_phone: "13032678754",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "交流",
+            direction: "进入B2",
+            interviewee: "胡八一", interviewee_phone: "15943563892",directionStatus: "进",
+          },
+          {
+            key: '10',
+            visitor: "李天泽",
+            visitor_phone: "12232678754",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "交流",
+            direction: "进入B2",
+            interviewee: "胡八一", interviewee_phone: "15943563892",directionStatus: "进",
+          },
+          {
+            key: '11',
+            visitor: "李天泽",
+            visitor_phone: "12232678754",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "交流",
+            direction: "出去B2",
+            interviewee: "胡八一", interviewee_phone: "15943563892",directionStatus: "出",
+          },
+          {
+            key: '12',
+            visitor: "李天泽",
+            visitor_phone: "12232678759",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "交流",
+            direction: "出去B2",
+            interviewee: "刘一鸣", interviewee_phone: "15943463892",directionStatus: "出",
+          },
+          {
+            key: '13',
+            visitor: "李天泽",
+            visitor_phone: "15513548219",
+            department: "北京电信规划院",
+            time: "2023-03-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
+          },
+          {
+            key: '14',
+            visitor: "李天泽",
+            visitor_phone: "15513548214",
+            department: "北京电信规划院",
+            time: "2023-03-20 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
+          },
+          {
+            key: '15',
+            visitor: "李天泽",
+            visitor_phone: "15511548219",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
+          },
+          {
+            key: '16',
+            visitor: "李天泽",
+            visitor_phone: "15513548219",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "进",
+          },
+          {
+            key: '17',
+            visitor: "李天泽",
+            visitor_phone: "15513548219",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "刘一鸣", interviewee_phone: "13943563892",directionStatus: "进",
+          },
+          {
+            key: '18',
+            visitor: "李天泽",
+            visitor_phone: "15513548219",
+            department: "北京电信规划院",
+            time: "2023-03-10 12:00:00",
+            reason: "开会",
+            direction: "出去B1",
+            interviewee: "刘一鸣", interviewee_phone: "15943563892",directionStatus: "出",
+          },
+          {
+            key: '19',
+            visitor: "李天泽",
+            visitor_phone: "15513548219",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "出去B2",
+            interviewee: "钱多多", interviewee_phone: "15942563898",directionStatus: "出",
+          },
+          {
+            key: '20',
+            visitor: "李天泽",
+            visitor_phone: "15913548219",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "钱多多", interviewee_phone: "15942563898",directionStatus: "进",
+          },
+          {
+            key: '21',
+            visitor: "李天泽",
+            visitor_phone: "15913548219",
+            department: "北京电信规划院",
+            time: "2022-08-26 12:00:00",
+            reason: "开会",
+            direction: "进入B2",
+            interviewee: "钱多多", interviewee_phone: "15942563898",directionStatus: "进",
+          },
+        ],
+      },
     }
   },
   mounted() {
@@ -391,7 +399,7 @@ export default {
   methods: {
     treeSelect(val) {
       this.tableTitle = val;
-      console.log(this.tableTitle)
+      this.initData();
     },
     initData(){
       this.objectiveOptions.forEach((v) => {
@@ -400,13 +408,43 @@ export default {
       this.companyOptions.forEach((v) => {
         this.companyMap.set(v.value, v.label);
       });
+      if (this.groupData[this.tableTitle]) {
+        this.originalData = JSON.parse(JSON.stringify(this.groupData[this.tableTitle]))
+      } else {
+        this.originalData = [];
+      }
       this.tableData = this.originalData;
     },
     showPeopleBehaviour(record) {
       this.showBehaviour = true;
       this.currItem = record
     },
+    showAddUserVisible() {
+      this.showAddUser = true;
+    },
+    addUser(data) {
+      let names = []
+      this.originalData.forEach(item=>{
+        names.push(item.visitor)
+      })
+      console.log(names)
+      if (data) {
+        data.forEach(item=>{
+          let index = names.indexOf(item.name);
+          if (index<0) {
+            this.originalData.push({
+              key: 'new'+new Date(),
+              visitor: item.name,
+              visitor_phone: item.phone,
+              department: "北京电信规划院",
+            });
+          }
+        })
+      }
+      this.groupData[this.tableTitle] = this.originalData
+    },
     del(item) {
+      console.log(item)
       let index = this.tableData.indexOf(item);
       if (index>-1) {
         this.tableData.splice(index, 1)

+ 2 - 2
src/components/scene/access/sceneAccessBehaviour.vue

@@ -14,7 +14,7 @@
           <template #label>
             <span class="descriptions-item-label">姓名</span>
           </template>
-          {{ item.name }}
+          {{ item.name?item.name:item.visitor?item.visitor:'李峰' }}
         </a-descriptions-item>
         <a-descriptions-item >
           <template #label>
@@ -95,7 +95,7 @@
 export default {
   props: {
     item: Object
-  }
+  },
 }
 </script>
 

+ 7 - 1
src/components/security/common/securityDeviceSelect.vue

@@ -6,7 +6,7 @@
       <a-tree style="height: 100%;overflow-y: auto"
               :expanded-keys="expandedKeys"
               :auto-expand-parent="true"
-              :selected-keys="['1-0']"
+              :selected-keys="selectKeys"
               :tree-data="treeData"
               :show-icon="true"
               @expand="onExpand"
@@ -39,12 +39,14 @@ export default {
   props: {
     treeData: Array,
     callback: Function,
+    selectFirst: Boolean,
     leftTitle: String
   },
   data() {
     return {
       title: '设备点位',
       expandedKeys: ['1'],
+      selectKeys: [],
       oriData: [],
       searchValue: '',
     }
@@ -56,6 +58,9 @@ export default {
     this.generateList(this.treeData)
   },
   mounted() {
+    if (this.selectFirst && this.treeData.length>0) {
+      this.selectKeys = [this.treeData[0].key];
+    }
     if (this.leftTitle && this.leftTitle!='') {
       this.title = this.leftTitle
     }
@@ -69,6 +74,7 @@ export default {
       this.autoExpandParent = false;
     },
     onSelect(val) {
+      this.selectKeys = [val]
       if (val.length>0) {
         this.callback(val[0])
       }