| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <!-- 用户编辑弹窗 -->
- <template>
- <ele-modal
- width="65vw"
- :visible.sync="show"
- :close-on-click-modal="false"
- custom-class="ele-dialog-form"
- append-to-body
- @close="cancel"
- :maxable="true"
- >
- <ele-split-layout
- width="210px"
- allow-collapse
- :right-style="{ overflow: 'hidden' }"
- >
- <div>
- <div class="ele-border-lighter sys-organization-list">
- <el-tree
- ref="tree"
- :data="data"
- highlight-current
- node-key="id"
- :props="{ label: 'name' }"
- :expand-on-click-node="false"
- :default-expand-all="true"
- @node-click="onNodeClick"
- /> </div
- >.
- </div>
- <template v-slot:content>
- <org-user-search @search="reload"> </org-user-search>
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- tool-class="ele-toolbar-form"
- :current.sync="current"
- highlight-current-row
- >
- </ele-pro-table>
- </template>
- </ele-split-layout>
- <template v-slot:footer>
- <el-button @click="cancel">取消</el-button>
- <el-button type="primary" @click="save"> 确认 </el-button>
- </template>
- </ele-modal>
- </template>
- <script>
- import { getUserPage } from '@/api/system/organization';
- import OrgUserSearch from '@/views/system/organization/components/org-user-search.vue';
- import { listOrganizations } from '@/api/system/organization';
- export default {
- components: {
- OrgUserSearch
- },
- data() {
- return {
- data: [],
- show: false,
- organizationId: '',
- isHasAccount: '',
- // 表格列配置
- columns: [
- {
- columnKey: 'index',
- type: 'index',
- label: '序号',
- width: 45,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'name',
- label: '姓名',
- sortable: 'custom',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'jobNumber',
- label: '工号',
- sortable: 'custom',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'loginName',
- label: '用户账号',
- sortable: 'custom',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'sex',
- label: '性别',
- sortable: 'custom',
- showOverflowTooltip: true,
- minWidth: 80,
- formatter: (_row, _column, cellValue) => {
- return cellValue == 1 ? '男' : cellValue == 2 ? '女' : '';
- }
- }
- ],
- current: {}
- };
- },
- created() {},
- methods: {
- /* 查询 */
- query() {
- listOrganizations()
- .then((list) => {
- let _list = list.filter((i) => i.name != '超级管理员');
- this.data = this.$util.toTreeData({
- data: _list,
- idField: 'id',
- parentIdField: 'parentId'
- });
- this.$nextTick(() => {
- this.onNodeClick(this.data[0]);
- });
- })
- .catch((e) => {
- // this.$message.error(e.message);
- });
- },
- async open(isHasAccount) {
- this.isHasAccount = isHasAccount;
- this.query();
- this.show = true;
- },
- /* 表格数据源 */
- async datasource({ page, limit, where, order }) {
- let data = await getUserPage({
- ...where,
- ...order,
- pageNum: page,
- size: limit,
- groupId: this.organizationId,
- hasAccount:this.isHasAccount||''
- });
- return data;
- },
- /* 保存编辑 */
- save() {
- let data = JSON.parse(JSON.stringify(this.current));
- this.$emit('success', data);
- this.show = false;
- },
- onNodeClick(val) {
- this.organizationId = val.id;
- this.reload();
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ pageNum: 1, where: where });
- },
- cancel() {
- this.show = false;
- }
- }
- };
- </script>
- <style scoped lang="scss">
- :deep(.ele-split-panel-wrap) {
- height: 50vh;
- overflow-y: auto;
- }
- :deep(.el-checkbox__input.is-disabled .el-checkbox__inner) {
- background-color: #f3f3f3;
- }
- </style>
|