diff --git a/src/api/model/hrm.js b/src/api/model/hrm.js new file mode 100644 index 00000000..87d42b63 --- /dev/null +++ b/src/api/model/hrm.js @@ -0,0 +1,14 @@ +import config from "@/config" +import http from "@/utils/request" + +export default { + employee: { + list: { + url: `${config.API_URL}/hrm/employee/`, + name: "获取企业员工", + get: async function(){ + return await http.get(this.url); + } + } + }, +} \ No newline at end of file diff --git a/src/components/scTable/index.vue b/src/components/scTable/index.vue index 58ac83e6..7dfec866 100644 --- a/src/components/scTable/index.vue +++ b/src/components/scTable/index.vue @@ -185,21 +185,14 @@ var res = await this.apiObj.get(reqData); }catch(error){ this.loading = false; - this.emptyText = error.statusText; + this.emptyText = error.response.data.err_msg || error.statusText; return false; } try { var response = config.parseData(res); - }catch(error){ - this.loading = false; - this.emptyText = "数据格式错误"; - return false; - } - if(response.code != config.successCode){ - this.loading = false; - this.emptyText = response.msg; - }else{ - this.emptyText = "暂无数据"; + if (response.total == 0){ + this.emptyText = "暂无数据"; + } if(this.hidePagination){ this.tableData = response.data || []; }else{ @@ -208,6 +201,10 @@ this.total = response.total || 0; this.summary = response.summary || {}; this.loading = false; + }catch(error){ + this.loading = false; + this.emptyText = "数据格式错误"; + return false; } this.$refs.scTable.setScrollTop(0) this.$emit('dataChange', res, this.tableData) diff --git a/src/config/route.js b/src/config/route.js index 3e3e1117..38cefbe3 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -68,13 +68,13 @@ const routes = [ "children": [ { "name": "employee", - "path": "/employee", + "path": "/hrm/employee", "meta": { - "title": "人员列表", + "title": "企业员工", "icon": "el-icon-menu", "affix": true }, - "component": "hrm" + "component": "hrm/employee" }, ] }, diff --git a/src/config/table.js b/src/config/table.js index b9c58534..f20379de 100644 --- a/src/config/table.js +++ b/src/config/table.js @@ -9,17 +9,17 @@ export default { paginationLayout: "total, sizes, prev, pager, next, jumper", //表格分页布局,可设置"total, sizes, prev, pager, next, jumper" parseData: function (res) { //数据分析 return { - data: res.data, //分析无分页的数据字段结构 - rows: res.data.rows, //分析行数据字段结构 - total: res.data.total, //分析总数字段结构 - summary: res.data.summary, //分析合计行字段结构 - msg: res.message, //分析描述字段结构 - code: res.code //分析状态字段结构 + data: res, //分析无分页的数据字段结构 + rows: res.results, //分析行数据字段结构 + total: res.count, //分析总数字段结构 + summary: res.summary, //分析合计行字段结构 + // msg: res.err_msg, //分析描述字段结构 + // code: res.err_code //分析状态字段结构 } }, request: { //请求规定字段 page: 'page', //规定当前分页字段 - pageSize: 'pageSize', //规定一页条数字段 + pageSize: 'page_size', //规定一页条数字段 prop: 'prop', //规定排序字段名字段 order: 'order' //规定排序规格字段 }, diff --git a/src/views/hrm/employee.vue b/src/views/hrm/employee.vue new file mode 100644 index 00000000..f0a6d398 --- /dev/null +++ b/src/views/hrm/employee.vue @@ -0,0 +1,165 @@ + + \ No newline at end of file diff --git a/src/views/hrm/ep_form.vue b/src/views/hrm/ep_form.vue new file mode 100644 index 00000000..b397f245 --- /dev/null +++ b/src/views/hrm/ep_form.vue @@ -0,0 +1,188 @@ + + + + + diff --git a/src/views/hrm/index.vue b/src/views/hrm/index.vue deleted file mode 100644 index e69de29b..00000000