Blame view

ant-design-vue-jeecg/src/views/system/modules/DeptRoleInfo.vue 5.92 KB
肖超群 authored
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
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <!-- 搜索区域 -->
      <a-form layout="inline">
        <a-row :gutter="10">
          <a-col :md="10" :sm="12">
            <a-form-item label="部门角色名称" style="margin-left:8px">
              <a-input placeholder="请输入部门角色" v-model="queryParam.roleName"></a-input>
            </a-form-item>
          </a-col>
          <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="6" :sm="24">
              <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 18px">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </a-col>
          </span>
        </a-row>
      </a-form>
    </div>
    <!-- 操作按钮区域 -->
    <div class="table-operator" :md="24" :sm="24">
      <a-button @click="handleAdd" type="primary" icon="plus">新建部门角色</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
肖超群 authored
27
28
29
30
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete"/>
            删除
          </a-menu-item>
肖超群 authored
31
        </a-menu>
肖超群 authored
32
33
34
        <a-button style="margin-left: 8px"> 批量操作
          <a-icon type="down"/>
        </a-button>
肖超群 authored
35
36
37
38
39
40
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">
41
        {{ selectedRowKeys.length }}</a> 项
肖超群 authored
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
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">
              更多 <a-icon type="down"/>
            </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handlePerssion(record)">授权</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
             </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <!-- 表单区域 -->
    <sys-depart-role-modal ref="modalForm" @ok="modalFormOk"/>
肖超群 authored
79
    <dept-role-auth-modal ref="modalDeptRole"/>
肖超群 authored
80
81
82
83
  </a-card>
</template>

<script>
肖超群 authored
84
85
86
87
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {getAction} from '@/api/manage'
import SysDepartRoleModal from './SysDepartRoleModal'
import DeptRoleAuthModal from './DeptRoleAuthModal'
肖超群 authored
88
肖超群 authored
89
90
91
92
93
94
95
96
97
98
99
100
101
102
export default {
  name: 'DeptRoleInfo',
  components: {DeptRoleAuthModal, SysDepartRoleModal},
  mixins: [JeecgListMixin],
  data() {
    return {
      description: '部门角色信息',
      currentDeptId: '',
      // 表头
      columns: [{
        title: '部门角色名称',
        align: "center",
        dataIndex: 'roleName'
      },
肖超群 authored
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
        {
          title: '部门角色编码',
          align: "center",
          dataIndex: 'roleCode'
        },
        {
          title: '部门',
          align: "center",
          dataIndex: 'departId_dictText'
        },
        {
          title: '备注',
          align: "center",
          dataIndex: 'description'
        },
        {
          title: '操作',
          dataIndex: 'action',
          scopedSlots: {customRender: 'action'},
          align: "center",
          width: 170
        }],
肖超群 authored
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
      url: {
        list: "/sys/sysDepartRole/list",
        delete: "/sys/sysDepartRole/delete",
        deleteBatch: "/sys/sysDepartRole/deleteBatch",
      }
    }
  },
  created() {
  },
  methods: {
    searchReset() {
      this.queryParam = {}
      this.loadData(1);
    },
    loadData(arg) {
      if (!this.url.list) {
        this.$message.error("请设置url.list属性!")
        return
      }
      //加载数据 若传入参数1则加载第一页的内容
      if (arg === 1) {
        this.ipagination.current = 1;
      }
      let params = this.getQueryParams();//查询条件
      params.deptId = this.currentDeptId;
      getAction(this.url.list, params).then((res) => {
        if (res.success && res.result) {
          this.dataSource = res.result.records;
          this.ipagination.total = res.result.total;
肖超群 authored
154
        }
肖超群 authored
155
156
157
158
159
160
161
162
163
164
165
166
167
168
      })
    },
    open(record) {
      this.currentDeptId = record.id;
      this.loadData(1);
    },
    clearList() {
      this.currentDeptId = '';
      this.dataSource = [];
    },
    hasSelectDept() {
      if (this.currentDeptId == '') {
        this.$message.error("请选择一个部门!")
        return false;
肖超群 authored
169
      }
肖超群 authored
170
      return true;
肖超群 authored
171
    },
肖超群 authored
172
173
174
175
176
    handleEdit: function (record) {
      this.$refs.modalForm.title = "编辑";
      this.$refs.modalForm.departDisabled = true;
      this.$refs.modalForm.disableSubmit = false;
      this.$refs.modalForm.edit(record, record.departId);
肖超群 authored
177
    },
肖超群 authored
178
179
180
181
    handleAdd: function () {
      if (this.currentDeptId == '') {
        this.$message.error("请选择一个部门!")
      } else {
肖超群 authored
182
        this.$refs.modalForm.departDisabled = true;
肖超群 authored
183
184
185
186
187
188
189
        this.$refs.modalForm.add(this.currentDeptId);
        this.$refs.modalForm.title = "新增";
      }
    },
    handlePerssion: function (record) {
      this.$refs.modalDeptRole.show(record.id, record.departId);
    },
肖超群 authored
190
  }
肖超群 authored
191
}
肖超群 authored
192
193
194
195
196
</script>

<style scoped>

</style>