odc.xiaohui
2023-03-18 b4d6e0923d825f3a6cbb12c29b5a522d56362ff8
用户管理导入导出
4个文件已修改
2个文件已添加
511 ■■■■■ 已修改文件
src/api/system/portal/externalLinks.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/system/user.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/layout/components/Header/index.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/baseSetting/user/components/header/index.vue 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/platform/externalLinks.vue 396 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/system/portal/externalLinks.js
New file
@@ -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);
}
src/api/system/user.js
New file
@@ -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);
}
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'),
      },
  // 违法统计
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" })
      }
    }
  }
};
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;
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>