MrShi
2025-08-19 30e858fa504b268b9b436afca0a1259cf6e8c488
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<template>
  <TableLayout :permissions="['business:managers:query']">
    <!-- 搜索表单 -->
    <div slot="search-form">
      <el-form ref="searchForm" :model="searchForm" label-width="100px" inline>
        <el-form-item label="人员搜索 " prop="keyword">
          <el-input v-model="searchForm.keyword" placeholder="可输入姓名/手机号/部门" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <section>
          <el-button type="primary" @click="search">搜索</el-button>
          <el-button @click="reset">重置</el-button>
        </section>
      </el-form>
    </div>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:managers:create', 'business:managers:delete']">
        <li><el-button type="primary" @click="$refs.operaManagersWindow.open('新建事件通知人管理',{type:3})" icon="el-icon-plus" v-permissions="['business:managers:create']">新建</el-button></li>
        <li><el-button type="danger" @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:managers:delete']">删除</el-button></li>
      </ul>
      <el-table
          :height="tableHeightNew"
        v-loading="isWorking.search"
        :data="tableData.list"
        strip
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="memberName" label="人员姓名" min-width="100px"></el-table-column>
        <el-table-column prop="memberPhone" label="人员手机号" min-width="100px"></el-table-column>
        <el-table-column prop="memberQwId" label="企微ID" min-width="100px"></el-table-column>
        <el-table-column prop="memberEmail" label="人员邮箱" min-width="100px">
          <template slot-scope="{row}">
             <div v-if="row.memberEmail">{{row.memberEmail}}</div>
             <div v-else style="color: #dc362e;cursor: pointer"  title="暂未配置人员邮箱,请前往【人员管理】-【员工管理】菜单编辑该员工信息,设置邮箱信息">
                <el-button type="text" style="color: red"  title="暂未配置人员邮箱,请前往【人员管理】-【员工管理】菜单编辑该员工信息,设置邮箱信息" icon="el-icon-error" >未配置</el-button>
             </div>
          </template>
        </el-table-column>
        <el-table-column prop="companyName" label="所属部门" min-width="100px"></el-table-column>
        <el-table-column prop="isQw" label="企微通知" min-width="80px">
          <template slot-scope="{row}">
            <el-switch v-model="row.isQw"  :active-value="1" :inactive-value="0" @change="updateInfo(row)"/>
          </template>
        </el-table-column>
        <el-table-column prop="isEmail" label="邮件通知" min-width="80px">
          <template slot-scope="{row}">
            <el-switch v-model="row.isEmail" :active-value="1" :inactive-value="0" @change="updateEmailInfo(row)"/>
          </template>
        </el-table-column>
        <el-table-column prop="editorName" label="操作人" min-width="100px"></el-table-column>
        <el-table-column prop="editDate" label="更新时间" min-width="150px"></el-table-column>
        <el-table-column prop="remark" label="备注" min-width="100px"></el-table-column>
        <el-table-column
          v-if="containPermissions(['business:managers:update', 'business:managers:delete'])"
          label="操作"
          min-width="120"
          fixed="right" >
          <template slot-scope="{row}">
<!--  <el-button type="text" @click="$refs.operaManagersWindow.open('编辑责任人信息表', row)" icon="el-icon-edit" v-permissions="['business:managers:update']">编辑</el-button> -->
            <el-button type="text" style="color: red" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:managers:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
        :pagination="tableData.pagination"
      >
      </pagination>
    </template>
    <!-- 新建/修改 -->
    <OperaManagersWindow ref="operaManagersWindow" @success="handlePageChange"/>
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaManagersWindow from '@/components/business/OperaManagersWindow'
export default {
  name: 'Managers',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaManagersWindow },
  data () {
    return {
      // 搜索
      updating: false,
      searchForm: {
        keyword: '',
        type: 3
      }
    }
  },
  created () {
    this.config({
      module: '事件通知人管理',
      api: '/business/managers',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.search()
  },
  methods: {
    updateInfo (row) {
      const newValue = row.isQw
      row.isQw = !row.isQw
      // 开启
      this.api.updateById({ id: row.id, isQw: newValue }).then(() => {
        this.$tip.success('设置成功!')
        this.search()
      }).final(() => {
        this.updating = false
      })
    },
    updateEmailInfo (row) {
      const newValue = row.isEmail
      row.isEmail = !row.isEmail
      // 开启
      this.api.updateById({ id: row.id, isEmail: newValue }).then(() => {
        this.$tip.success('设置成功!')
        this.search()
      }).finally(() => {
        this.updating = false
      })
    }
  }
}
</script>