123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <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>
|