huangguoce 5 месяцев назад
Родитель
Сommit
0217de8bf7
2 измененных файлов с 265 добавлено и 0 удалено
  1. 19 0
      src/api/test/dd/dd.js
  2. 246 0
      src/views/dd/UserList.vue

+ 19 - 0
src/api/test/dd/dd.js

@@ -0,0 +1,19 @@
+import request from "@/utils/httpRequest";
+import { TEST_PATH as prefix } from "../../AppPath";
+
+export default {
+	list(params) {
+		return request({
+			url: prefix + "/test/addressBook/list",
+			method: "get",
+			params: params,
+		});
+	},
+	deptList(params) {
+		return request({
+			url: prefix + "/test/addressBook/deptList",
+			method: "get",
+			params: params,
+		});
+	},
+};

+ 246 - 0
src/views/dd/UserList.vue

@@ -0,0 +1,246 @@
+<template>
+    <div class="page">
+        <el-form :inline="true" class="query-form m-b-10" v-if="searchVisible" ref="searchForm" :model="searchForm"
+            @keyup.enter="refreshList()" @submit.prevent>
+            <!-- 搜索框-->
+            <el-form-item prop="fileName" label="部门名称:">
+                <el-input style="width: 200px;" v-model="searchForm.fileName" placeholder="请输入附件名称"
+                    clearable></el-input>
+            </el-form-item>
+            <el-form-item prop="userName" label="上传人:">
+                <el-input style="width: 200px;" v-model="searchForm.userName" placeholder="请输入上传人" clearable></el-input>
+            </el-form-item>
+            <el-form-item prop="userName" label="收藏分类:">
+                <el-select v-model="searchForm.classification" clearable placeholder="请选择收藏分类">
+                    <el-option v-for="(item, index) in dictList" :key="index" :label="item.label" :value="item.value" />
+                </el-select>
+            </el-form-item>
+            <el-form-item>
+                <el-button type="primary" @click="refreshList()" icon="search">查询</el-button>
+                <el-button type="default" @click="resetSearch()" icon="refresh-right">重置</el-button>
+            </el-form-item>
+        </el-form>
+
+        <div class="jp-table">
+            <vxe-toolbar ref="dataSetToolbar" :refresh="{ query: refreshList }" export print custom>
+                <template #buttons>
+                    <el-button v-if="hasPermission('attachment:add')" type="primary" icon="plus"
+                        @click="add()">上传附件</el-button>
+                </template>
+                <template #tools>
+                    <vxe-button type="text" :title="searchVisible ? '收起检索' : '展开检索'" icon="vxe-icon-search"
+                        class="tool-btn" @click="searchVisible = !searchVisible"></vxe-button>
+                </template>
+            </vxe-toolbar>
+            <el-tabs v-model="activeName" @tab-click="handleClick">
+                <el-tab-pane v-for="item in dataList" :key="item.deptId" :label="item.name"
+                    :name="item.deptId"></el-tab-pane>
+            </el-tabs>
+            <div class="jp-table-body">
+                <vxe-table border="inner" auto-resize resizable height="auto" :loading="loading" size="small"
+                    ref="dataSetTable" show-header-overflow show-overflow highlight-hover-row :menu-config="{}"
+                    :print-config="{}" :import-config="{}" :export-config="{}" @sort-change="sortChangeHandle"
+                    :sort-config="{ remote: true }" :data="userDataList" :checkbox-config="{}">
+                    <vxe-column type="seq" width="40"></vxe-column>
+                    <vxe-column field="name" title="姓名">
+                    </vxe-column>
+                    <vxe-column field="mobile" title="手机号">
+                    </vxe-column>
+                    <vxe-column field="admin" title="是否管理员">
+                    </vxe-column>
+                    <vxe-column fixed="right" align="center" width="320" title="操作">
+                        <template #default="scope">
+                            <el-button type="success" text @click="handleAdd(scope.row)">测试</el-button>
+                        </template>
+                    </vxe-column>
+                </vxe-table>
+                <vxe-pager background size="small" :current-page="tablePage.currentPage" :page-size="tablePage.pageSize"
+                    :total="tablePage.total" :page-sizes="[
+                        10,
+                        20,
+                        100,
+                        1000,
+                        { label: '全量数据', value: 1000000 },
+                    ]" :layouts="[
+                        'PrevPage',
+                        'JumpNumber',
+                        'NextPage',
+                        'FullJump',
+                        'Sizes',
+                        'Total',
+                    ]" @page-change="currentChangeHandle">
+                </vxe-pager>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+import ddService from "@/api/test/dd/dd.js"
+const getDataApi = (deptId) => {
+    return new Promise(resolve => {
+        ddService
+            .list({
+                deptId: deptId
+            }).then(res => {
+                resolve(res.result.list)
+            })
+    })
+}
+export default {
+    components: {
+
+    },
+    data() {
+        return {
+            cloumns: [{ type: 'seq', title: 'Sequence' },
+            { field: 'name', title: 'Name' },
+            { field: 'role', title: 'Role' },
+            { field: 'age', title: 'Age' },
+            { field: 'sex', title: 'Sex' }],
+            url: "",
+            showViewer: false,
+            activeName: "",
+            searchVisible: true,
+            searchForm: {
+                companyId: '',
+                officeId: '',
+                createById: '',
+            },
+            dataList: [],
+            userDataList: [],
+            tablePage: {
+                total: 0,
+                currentPage: 1,
+                pageSize: 10,
+                orders: [],
+            },
+            isImportCollapse: false,
+            dialogInterfaceVisible: false,
+            interfaceTable: [],
+            loading: false,
+            userInfo: {},
+            dictList: [],
+
+        };
+    },
+    activated() {
+        this.userInfo = this.$TOOL.data.get("USER_INFO");
+        this.searchForm.createById = this.userInfo.id
+        this.$nextTick(() => {
+            // 将表格和工具栏进行关联
+            const $table = this.$refs.dataSetTable;
+            const $toolbar = this.$refs.dataSetToolbar;
+            $table.connect($toolbar);
+        });
+        this.refreshList();
+    },
+    methods: {
+        handleAdd() {
+
+        },
+        handleClick(tab, event) {
+            console.log(tab.props.name);
+            this.getUserList(tab.props.name)
+        },
+        // 关闭查看器
+        closeViewer() {
+            this.url = ''
+            this.showViewer = false
+        },
+        onPreview(url) {
+            this.url = url
+            this.showViewer = true
+        },
+        // 获取数据列表
+        getUserList(deptId) {
+            this.loading = true;
+            ddService
+                .list({
+                    deptId: deptId
+                })
+                .then((data) => {
+                    this.userDataList = data.result.list;
+                    this.loading = false;
+                });
+        },
+        // 获取数据列表
+        refreshList() {
+            this.loading = true;
+            ddService
+                .deptList()
+                .then((data) => {
+                    this.activeName = data.result[0].deptId
+                    this.dataList = data.result;
+                    // this.tablePage.total = data.total;
+                    this.getUserList(data.result[0].deptId)
+                    this.loading = false;
+                    // 获取分类去重的数据
+                });
+        },
+        // 当前页
+        currentChangeHandle({ currentPage, pageSize }) {
+            this.tablePage.currentPage = currentPage;
+            this.tablePage.pageSize = pageSize;
+            this.refreshList();
+        },
+        // 排序
+        sortChangeHandle(column) {
+            this.tablePage.orders = [];
+            if (column.order != null) {
+                this.tablePage.orders.push({
+                    column: this.$utils.toLine(column.property),
+                    asc: column.order === "asc",
+                });
+            }
+            this.refreshList();
+        },
+        // 新增
+        add() {
+            this.$refs.workCollectAccessoryRef.init("add")
+        },
+        // 编辑
+        edit(id) {
+            console.log(id);
+            this.$refs.workCollectAccessoryRef.init("edit", id)
+        },
+        // 查看
+        view(id) {
+            id =
+                id ||
+                this.$refs.dataSetTable.getCheckboxRecords().map((item) => {
+                    return item.id;
+                })[0];
+            this.$router.push({
+                path: `/database/datamodel/DataSetForm`,
+                query: { method: "view", id: id, title: "数据模型配置" },
+            });
+        },
+        // 删除
+        del(id) {
+            this.$confirm(`确定删除所选项吗?`, "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+            }).then(() => {
+                this.loading = true;
+                ddService
+                    .del({
+                        attachmentId: id
+                    }).then(res => {
+                        this.$message.success(res);
+                        this.loading = false;
+                        this.refreshList();
+                    })
+
+
+            });
+        },
+
+        resetSearch() {
+            this.$refs.searchForm.resetFields();
+            this.refreshList();
+        },
+    },
+};
+</script>