From b4d6e0923d825f3a6cbb12c29b5a522d56362ff8 Mon Sep 17 00:00:00 2001 From: odc.xiaohui <xiaohui@Q1> Date: 星期六, 18 三月 2023 13:04:17 +0800 Subject: [PATCH] 用户管理导入导出 --- src/views/systemSetting/baseSetting/user/components/header/index.vue | 57 ++++++ src/api/system/user.js | 15 + src/views/systemSetting/platform/externalLinks.vue | 396 +++++++++++++++++++++++++++++++++++++++++++ src/views/layout/components/Header/index.vue | 12 + src/router/index.js | 6 src/api/system/portal/externalLinks.js | 25 ++ 6 files changed, 502 insertions(+), 9 deletions(-) diff --git a/src/api/system/portal/externalLinks.js b/src/api/system/portal/externalLinks.js new file mode 100644 index 0000000..33723f0 --- /dev/null +++ b/src/api/system/portal/externalLinks.js @@ -0,0 +1,25 @@ +import http from "@/http"; + +export function addexternalLinks(params) { + return http.post('/sccg/system/portal/externalLink/add', params); +} + +export function deletexternalLinks(params) { + return http.delete('/sccg/system/portal/externalLink/delete', params); +} + +export function exportTeamInfo(params) { + return http.downloadFile('/sccg/team_construction/export', params); +} + +export function importTeamInfo(data) { + return http.uploadFile('/sccg/team_construction/import', data); +} + +export function updateexternalLinks(params) { + return http.put('/sccg/system/portal/externalLink/update', params); +} + +export function searchexternalLinks(params) { + return http.get('/sccg/system/portal/externalLink/search', params); +} diff --git a/src/api/system/user.js b/src/api/system/user.js new file mode 100644 index 0000000..475cb9b --- /dev/null +++ b/src/api/system/user.js @@ -0,0 +1,15 @@ +import http from "@/http"; +import {exportTeamInfo, importTeamInfo} from "@/api/system/portal/teamConstruction"; + +export default { + getDepartmentList: () => { + return http.get('/sccg/sccg_region/getTree'); + }, + //瀵煎嚭 +} +export function exportUser(params) { + return http.downloadFile('/sccg/admin/export', params); +} +export function importUser(params) { + return http.uploadFile('/sccg/admin/import', params); +} diff --git a/src/router/index.js b/src/router/index.js index 7d0ab1a..2d7fc01 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -64,8 +64,8 @@ component: () => import('@/views/systemSetting/platform/cockpitManage') }, { - path: 'externalLinks', - name: '澶栭儴閾炬帴', + path: 'externalLinks', //澶栭儴閾炬帴 + name: 'externalLinks', component: () => import('@/views/systemSetting/platform/externalLinks') } ] @@ -372,7 +372,7 @@ }, { path: 'runReport', // 杩愯鎶ュ憡 - name: '杩愯鎶ュ憡', + name: 'runReport', component: () => import('@/views/intelligentPatrol/runReport'), }, // 杩濇硶缁熻 diff --git a/src/views/layout/components/Header/index.vue b/src/views/layout/components/Header/index.vue index 1068262..64d9514 100644 --- a/src/views/layout/components/Header/index.vue +++ b/src/views/layout/components/Header/index.vue @@ -159,6 +159,12 @@ url: '', id: '4f', }, + { + label: '澶栭儴閾炬帴', + checked: false, + url: '', + id: '5f', + }, ], flag: { user: false, @@ -314,6 +320,12 @@ if (data.id === '3f') { this.$router.push({ path: "/home/operate/casepool/pool" }) } + if (data.id === '4f') { + window.open('http://116.62.234.187:8120/#/Customer', '_blank'); + } + if (data.id === '5f') { + this.$router.push({ path: "/home/system/platform/externalLinks" }) + } } } }; diff --git a/src/views/systemSetting/baseSetting/user/components/header/index.vue b/src/views/systemSetting/baseSetting/user/components/header/index.vue index ccde5e8..4a6129a 100644 --- a/src/views/systemSetting/baseSetting/user/components/header/index.vue +++ b/src/views/systemSetting/baseSetting/user/components/header/index.vue @@ -6,6 +6,18 @@ <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="search"></el-input> <div class="findBtn"> <el-button class="find-Btn" type="primary" @click="setSearch">鏌ヨ</el-button> + <el-upload + class="department-margin-left10" + action="" + ref="uploadFile" + :http-request="importTable" + :show-file-list="false" + :auto-upload="true" + :limit="1" + > + <el-button type="primary">瀵煎叆</el-button> + </el-upload> + <el-button class="department-margin-left10" type="primary" @click="exportTable()">瀵煎嚭</el-button> </div> </div> <div class="addUser"> @@ -21,6 +33,9 @@ </template> <script> import createUser from "../createUser"; +import {exportTeamInfoDepartment, importTeamInfoDepartment} from "@/api/system/department"; +import {downloadFile} from "@/utils/helper"; +import {exportUser, importUser} from "@/api/system/user"; export default { components: { createUser, @@ -32,7 +47,44 @@ } }, methods: { - setSearch() { + // 瀵煎嚭 + exportTable() { + // const status = this.searchStatus === 2 ? null : this.searchStatus; + exportUser({ + // current: this.currentPage, + // size: this.pageSize, + // departName: this.searchDepartment, + // status, + }) + .then((res) => { + console.log(res) + downloadFile(res); + this.$message({ type: "success", message: "鎿嶄綔鎴愬姛" }); + }) + .catch((err) => { + this.$message({ type: "error", message: err }); + }); + }, + + // 瀵煎叆 + importTable(file) { + const formData = new FormData(); + formData.append("file", file.file); + console.log(formData) + console.log(file) + importUser(formData) + .then(() => { + this.$message({ type: "success", message: "鎿嶄綔鎴愬姛" }); + this.setSearch(); + this.$refs.uploadFile.clearFiles(); + }) + .catch((err) => { + this.$message({ type: "error", message: err }); + this.$refs.uploadFile.clearFiles(); + }); + }, + + setSearch() { this.$emit('getSearch', { text: this.search }) }, sendDialog(flag) { @@ -53,6 +105,9 @@ } </script> <style lang="scss" scoped> +.department-margin-left10{ + margin-left: 10px; +} header { // background-color: #09152f; //border: 1px solid #fff; diff --git a/src/views/systemSetting/platform/externalLinks.vue b/src/views/systemSetting/platform/externalLinks.vue index 3a25c55..4f6e6d0 100644 --- a/src/views/systemSetting/platform/externalLinks.vue +++ b/src/views/systemSetting/platform/externalLinks.vue @@ -1,13 +1,399 @@ <template> -<div>澶栭儴閾炬帴</div> + <div class="mainContent"> + <!-- <div class="aside"> + <department-aside /> + </div> --> + <div class="grid-content"> + <header> +<!-- <div class="headerContent">--> +<!-- <div class="search">--> +<!-- <span>绛涢�夋潯浠�:</span>--> +<!-- <el-input v-model="context" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>--> +<!-- <div class="findBtn">--> +<!-- <el-button type="primary" @click="getList()">鏌ヨ</el-button>--> +<!-- </div>--> +<!-- </div>--> +<!-- </div>--> + <div class="main-title"> + <el-button + class="el-icon-plus button-addition" + type="primary" + @click="handleAdd()" + >娣诲姞</el-button + > + </div> + </header> + <!-- 鏁版嵁灞曠ず --> + <el-table + border + stripe + ref="multipleTable" + :header-cell-style="{ + background: '#F5F5F5', + 'font-weight': '650', + 'line-height': '45px', + }" + :data="tableData" + style="width: 100%" + :row-class-name="tableRowClassName" + @selection-change="tableChange" + > + <el-table-column type="selection" min-width="5"> </el-table-column> + + <el-table-column prop="name" label="澶栭儴閾炬帴鍚嶇О" min-width="10"> + </el-table-column> + <el-table-column prop="url" label="url鍦板潃" min-width="8"> + </el-table-column> + <el-table-column prop="operation" label="鎿嶄綔" min-width="5"> + <template slot-scope="scope"> + <div class="operation"> + <span @click="handleEdit(scope.row)">缂栬緫</span> + <span class="line">|</span> + <span @click="handleDelete(scope.row)">鍒犻櫎</span> + </div> + </template> + </el-table-column> + </el-table> + + <el-dialog + :visible.sync="dialogUpdate" + width="45%" + v-if="dialogUpdate" + :title="linkTitle" + :before-close="handleClose" + > + <div> + <el-form :model="linkForm" :rules="linkRule" ref="linkForm" label-width="100px" class="demo-ruleForm"> + <el-form-item label="閾炬帴鍚嶇О" prop="name"> + <el-input v-model="linkForm.name"></el-input> + </el-form-item> + <el-form-item label="閾炬帴鍦板潃" prop="url"> + <el-input v-model="linkForm.url"></el-input> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="submitForm('linkForm')">鎻愪氦</el-button> + <el-button @click="resetForm('linkForm')">閲嶇疆</el-button> + </el-form-item> + </el-form> + </div> +<!-- <MyView :info="handheldGrid" @closeDialog="handleCallBack"></MyView>--> + </el-dialog> + + <!-- tools --> +<!-- <div class="tools">--> +<!-- <div class="funs"></div>--> +<!-- <div class="pagination">--> +<!-- <el-pagination--> +<!-- background--> +<!-- :current-page="currentPage"--> +<!-- layout="prev, pager, next"--> +<!-- :total="totalNum"--> +<!-- :page-size="pageSize"--> +<!-- @current-change="changeCurrentPage"--> +<!-- @prev-click="handlePrev"--> +<!-- @next-click="handleNext"--> +<!-- >--> +<!-- </el-pagination>--> +<!-- </div>--> +<!-- </div>--> + </div> + </div> </template> - <script> +import helper from "@/utils/mydate"; +import { createNamespacedHelpers } from "vuex"; +import departmentAside from "@/views/operate/fivepack/threepack/components/aside"; +import { + addexternalLinks, + deletexternalLinks, + searchexternalLinks, + updateexternalLinks +} from "@/api/system/portal/externalLinks"; +// import MyView from "../components/dialogForm.vue"; +const { mapActions } = createNamespacedHelpers("orgGrid"); export default { - name: "externalLinks" -} + components: { departmentAside }, + data() { + return { + linkTitle:'娣诲姞澶栭儴閾炬帴', + linkForm:{}, + tableData: [], + context: "", + dialogUpdate: false, + dialogView: false, + updateFlag: false, + userInfo: "", + totalNum: 0, + pageSize: 10, + currentPage: 1, + renderFlag: false, + flag: { + role: false, + password: false, + depart: false, + }, + all: false, + unsame: false, + myIdx: 0, + preMyIdx: 0, + tempList: [], + handheldGrid: {}, + linkRule: { + name: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }, + + ], + url: [ + { required: true, message: '璇疯緭鍏ラ摼鎺�', trigger: 'blur' }, + + ], + }, + + }; + }, + created() { + this.getList(); + }, + methods: { + ...mapActions(["getOrgGridList", "deleteOrgGrid"]), + submitForm(formName) { + this.$refs[formName].validate(async (valid) => { + if (valid) { + if (this.linkTitle == '娣诲姞澶栭儴閾炬帴') { + await addexternalLinks(this.linkForm).then(res => { + this.dialogUpdate = false + this.getList() + console.log(res) + }) + } else { + await updateexternalLinks(this.linkForm).then(res => { + this.dialogUpdate = false + this.getList() + console.log(res) + }) + } + + } else { + console.log('error submit!!'); + return false; + } + }); + }, + resetForm(formName) { + this.linkForm = { + name:'', + url:'' + } + this.$refs[formName].resetFields(); + }, + tableChange(list) { + this.tempList = []; + list.forEach((item) => { + this.tempList.push(item.id); + }); + this.all = list.length === this.tableData.length; + }, + changeTime({ createTime }) { + return helper(createTime); + }, + disSame(list) { + list.forEach((row) => { + this.$refs.multipleTable.toggleRowSelection(row); + }); + }, + handleCallBack({ flag }) { + this.dialogUpdate = false; + this.getList(); + }, + handleClose(done) { + if (this.updateFlag) { + this.$confirm("纭鍏抽棴锛�") + .then((_) => { + this.dialogUpdate = false; + this.updateFlag = false; + done(); + }) + .catch((_) => {}); + } else { + done(); + } + }, + // 褰撳墠椤垫敼鍙樿Е鍙戜簨浠� + changeCurrentPage(page) { + this.currentPage = page; + this.getList(); + }, + // 涓婁竴椤电偣鍑讳簨浠� + handlePrev(page) { + this.currentPage = page; + this.getList(); + }, + // 涓嬩竴椤电偣鍑讳簨浠� + handleNext(page) { + this.currentPage = page; + this.getList(); + }, + // 鑾峰彇鍒楄〃 + getList() { + const that = this; + const { currentPage, pageSize, context } = this; + searchexternalLinks({ + + }).then((res) => { + console.log(res) + // that.totalNum = res.total; + that.tableData =res; + this.renderFlag = true; + }); + }, + handleAdd() { + this.linkForm={ + name:'', + url:'' + } + this.linkTitle = '娣诲姞澶栭儴閾炬帴' + this.dialogUpdate = true; + }, + handleEdit(row) { + this.linkTitle = '淇敼澶栭儴閾炬帴' + this.linkForm = row; + this.dialogUpdate = true; + }, + handleDelete(row) { + this.$confirm("纭鍒犻櫎锛�").then((_) => { + deletexternalLinks({id:row.id}).then((res) => { + this.$message({ + type: "success", + message: "鍒犻櫎鎴愬姛锛�", + }); + this.getList(); + }); + }); + }, + // 璁剧疆琛ㄦ牸鏂戦┈绾� + tableRowClassName({ row, rowIndex }) { + if ((rowIndex + 1) % 2 === 0) { + return "warning-row"; + } else { + return "success-row"; + } + }, + }, +}; </script> +<style lang="scss" scoped> +.mainContent { + display: flex; + justify-content: flex-start; + flex-wrap: nowrap; -<style scoped> + .grid-content { + margin-left: 10px; + flex: 1; + .tools { + display: flex; + justify-content: space-between; + flex-wrap: nowrap; + .pagination { + margin-top: 55px; + } + + .el-pagination { + // &::v-deep li, + // &::v-deep .btn-prev, + // &::v-deep .btn-next { + // background-color: #071f39; + // color: #4b9bb7; + // } + + // &::v-deep .active { + // background-color: #409eff; + // color: #fff; + // } + } + } + } +} + +header { + // background-color: white; + display: flex; + .headerContent { + padding: 10px 0; + display: flex; + justify-content: space-between; + align-items: center; + + .search { + display: flex; + justify-content: flex-start; + line-height: 2; + + span { + flex: 1; + } + + .el-input { + flex: 2; + color: #1d3f57; + } + .el-select { + flex: 1; + } + .el-date-editor { + flex: 1; + } + } + + .findBtn { + line-height: 100px; + margin-left: 15px; + display: flex; + align-items: center; + margin-top: -2px; + + .el-button { + padding: 12px 25px; + //border-radius: 20px; + } + } + ::v-deep .el-form { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + + .el-form-item { + width: 30%; + } + + .el-form-item__label { + color: #4b9bb7; + } + } + } +} + +.operation { + display: flex; + color: var(--operation-color); + .line { + padding: 0 5px; + } + + span:hover { + cursor: pointer; + } +} + +.main-title { + line-height: 20px; + padding: 10px 20px; + margin-left: auto; + //border-radius: 20px; + .el-button { + padding: 12px 25px; + //border-radius: 20px; + } +} </style> -- Gitblit v1.8.0