研发图纸文件管理系统-前端项目
he wei
2022-07-14 44c4b89904542a9cc5c637772d0412d5b64f49ec
UA 整理提交
5个文件已修改
1个文件已添加
176 ■■■■ 已修改文件
package.json 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/layout/FlexLayout.vue 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/user/apis.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/user/list.vue 73 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/axios-interceptors.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json
@@ -69,7 +69,12 @@
      "parser": "babel-eslint"
    },
    "rules": {
<<<<<<< Updated upstream
      "no-debugger":"off"
=======
      "no-unused-vars": "off",
      "vue/no-unused-components": "off"
>>>>>>> Stashed changes
    }
  },
  "browserslist": [
src/components/layout/FlexLayout.vue
New file
@@ -0,0 +1,79 @@
<template>
  <div
    class="flex-layout"
    :class="getRootClass"
    :style="getRootStyle"
    v-loading="loading"
    element-loading-text="拼命加载中"
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(0, 0, 0, 0.2)"
  >
    <div class="flex-layout-header">
      <slot name="header"></slot>
    </div>
    <div class="flex-layout-body" :class="{ 'no-bg': noBg }">
      <slot></slot>
    </div>
    <div class="flex-layout-footer">
      <slot name="footer"></slot>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    direction: {
      type: String,
      default: "",
    },
    height: {
      type: String,
      default: "100%",
    },
    noBg: {
      type: Boolean,
      default: false,
    },
    loading: {
      type: Boolean,
      default: false,
    },
  },
  computed: {
    getRootClass: function() {
      return {
        "direction-row": this.direction == "row" ? true : false,
      };
    },
    getRootStyle: function() {
      return {
        height: this.height,
      };
    },
  },
};
</script>
<style scoped>
.flex-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.flex-layout.direction-row {
  flex-direction: row;
}
.flex-layout.full-ht {
  height: 100%;
}
.flex-layout-body {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
}
.flex-layout-body.no-bg {
  background-color: #05227200;
}
</style>
src/pages/user/apis.js
@@ -4,9 +4,10 @@
 * 查询所有用户信息
 * @returns 
 */
export const getAllUser = () => {
export const getAllUser = (params) => {
  return axios({
    method: "GET",
    url: "docUser/getAllUser"
    url: "docUser/getAllUser",
    params
  })
}
src/pages/user/list.vue
@@ -2,7 +2,7 @@
  <a-card>
    <div>
      <a-space class="operator">
        <a-button @click="addNew" type="primary">新建</a-button>
        <!-- <a-button @click="addNew" type="primary">新建</a-button> -->
      </a-space>
      <advance-table
        :columns="columns"
@@ -15,45 +15,56 @@
        :format-conditions="true"
        @reset="onReset"
        :pagination="{
          current: page,
          current: pageCurr,
          pageSize: pageSize,
          total: total,
          showSizeChanger: true,
          showLessItems: true,
          showQuickJumper: true,
          pageSizeOptions: ['2', '4', '10'],
          showTotal: (total, range) =>
            `第 ${range[0]}-${range[1]} 条,总计 ${total} 条`,
          onChange: onPageChange,
          onShowSizeChange: onSizeChange,
        }"
      >
        <template slot="statusTitle">
          状态<a-icon style="margin: 0 4px" type="info-circle" />
        </template>
        <template slot="send" slot-scope="{ text }">
          {{ text ? "是" : "否" }}
        </template>
        <template slot="status" slot-scope="{ text }">
          {{ text | statusStr }}
        <template slot="operation" slot-scope="text">
          <span>
            <a @click="edit(text)">编辑</a>
            <a-divider type="vertical" />
            <a-popconfirm
              title="是否要删除此行?"
              @confirm="remove(text)"
            >
              <a>删除</a>
            </a-popconfirm>
          </span>
        </template>
      </advance-table>
    </div>
    <!-- 编辑用户 -->
    <a-modal :visible="editShow" title="编辑用户" @ok="handleOk">
      <user-info :info="userData"></user-info>
    </a-modal>
  </a-card>
</template>
<script>
import AdvanceTable from "@/components/table/advance/AdvanceTable";
import UserInfo from "./components/userInfo";
import { getAllUser } from "./apis";
export default {
  name: "",
  components: { AdvanceTable },
  components: { AdvanceTable, UserInfo },
  data() {
    return {
      editShow: false,
      loading: false,
      page: 1,
      pageCurr: 1,
      pageSize: 10,
      total: 0,
      userData: undefined,
      columns: [
        {
          title: "姓名",
@@ -71,10 +82,21 @@
        {
          title: "组别",
          dataIndex: ["depart", "departName"],
          key: 'departName'
        },
        {
          title: "权限",
          title: "角色",
          dataIndex: ["drole", "roleName"],
          key: 'roleName'
        },
        {
          title: "创建时间",
          dataIndex: 'creTime'
        },
        {
          title: "操作",
          key: "operation",
          scopedSlots: { customRender: "operation" },
        },
      ],
      dataSource: [],
@@ -83,14 +105,20 @@
  },
  created() {
    this.getGoodList();
    this.getColumns();
  },
  methods: {
    getGoodList() {
      this.loading = true;
      // const { page, pageSize, conditions } = this;
      getAllUser().then((res) => {
      const { pageCurr, pageSize, conditions } = this;
      getAllUser({ pageCurr, pageSize }).then((res) => {
        console.log(res);
        res = res.data;
        let data = [];
        this.loading = false;
        if (res.code && res.data) {
          data = res.data2.list;
        }
        this.dataSource = data;
      });
      //   ds.goodsList({ page, pageSize, ...conditions }).then((result) => {
      //     const { list, page, pageSize, total } = result.data.data;
@@ -100,11 +128,6 @@
      //     this.pageSize = pageSize;
      //     this.loading = false;
      //   });
    },
    getColumns() {
      // ds.goodsColumns().then((res) => {
      //   this.columns = res.data;
      // });
    },
    onSearch(conditions, searchOptions) {
      console.log(searchOptions);
@@ -130,6 +153,14 @@
      this.pageSize = pageSize;
      this.getGoodList();
    },
    handleOk() {
      this.editShow = false;
    },
    edit(obj) {
      console.log(obj);
      this.userData = obj.text;
      this.editShow = true;
    }
  },
};
</script>
src/utils/axios-interceptors.js
@@ -56,11 +56,11 @@
   * @returns {*}
   */
  onFulfilled(config, options) {
    const {message} = options
    const {url, xsrfCookieName} = config
    if (url.indexOf('login') === -1 && xsrfCookieName && !Cookie.get(xsrfCookieName)) {
      message.warning('认证 token 已过期,请重新登录')
    }
    // const {message} = options
    // const {url, xsrfCookieName} = config
    // if (url.indexOf('login') === -1 && xsrfCookieName && !Cookie.get(xsrfCookieName)) {
    //   message.warning('认证 token 已过期,请重新登录')
    // }
    return config
  },
  /**
src/utils/request.js
@@ -6,8 +6,8 @@
axios.defaults.timeout = 5000
axios.defaults.withCredentials= true
axios.defaults.xsrfHeaderName= xsrfHeaderName
axios.defaults.xsrfCookieName= xsrfHeaderName
// axios.defaults.xsrfHeaderName= xsrfHeaderName
// axios.defaults.xsrfCookieName= xsrfHeaderName
// 认证类型
const AUTH_TYPE = {