From b3c99be0fa33d6a08b8af15dc585a87618569c93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com>
Date: Fri, 17 Jun 2022 11:07:15 +0800
Subject: [PATCH] =?UTF-8?q?request=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/model/hrm.js | 21 +++++++++++++--------
src/components/scTable/index.vue | 2 +-
src/views/hrm/employee.vue | 10 ++++++----
src/views/hrm/ep_form.vue | 6 ++++--
4 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/src/api/model/hrm.js b/src/api/model/hrm.js
index d9908d55..6e2aef0f 100644
--- a/src/api/model/hrm.js
+++ b/src/api/model/hrm.js
@@ -3,15 +3,20 @@ import http from "@/utils/request"
export default {
employee: {
- list: async function(data){
- return await http.get(
- `${config.API_URL}/hrm/employee/`,
- data);
+ list: {
+ url: `${config.API_URL}/hrm/employee/`,
+ name: "获取企业员工",
+ req: async function(data){
+ return await http.get(this.url, data);
+ }
},
- update: async function(id, data){
- return await http.put(
- `${config.API_URL}/hrm/employee/${id}/`,
- data);
+ update: {
+ name: "更新员工信息",
+ req: async function(id, data){
+ return await http.put(
+ `${config.API_URL}/hrm/employee/${id}/`,
+ data);
+ }
}
},
}
\ No newline at end of file
diff --git a/src/components/scTable/index.vue b/src/components/scTable/index.vue
index 3fdaccfb..b413506a 100644
--- a/src/components/scTable/index.vue
+++ b/src/components/scTable/index.vue
@@ -279,7 +279,7 @@ export default {
Object.assign(reqData, this.tableParams);
try {
- var res = await this.apiObj(reqData);
+ var res = await this.apiObj.req(reqData);
if (this.hidePagination) {
this.tableData = res;
if (res.length == 0) {
diff --git a/src/views/hrm/employee.vue b/src/views/hrm/employee.vue
index 6de9b7a3..5d1263bd 100644
--- a/src/views/hrm/employee.vue
+++ b/src/views/hrm/employee.vue
@@ -18,8 +18,10 @@
-
-
+
+
+
+
{{scope.row.belong_dept_.name}}
@@ -31,11 +33,11 @@
查看
编辑
-
+
diff --git a/src/views/hrm/ep_form.vue b/src/views/hrm/ep_form.vue
index 3fa3d437..c6f36ddc 100644
--- a/src/views/hrm/ep_form.vue
+++ b/src/views/hrm/ep_form.vue
@@ -12,13 +12,14 @@
ref="dialogForm"
:model="form"
:rules="rules"
+ :disabled="mode=='show'"
label-width="80px"
>
-
+
@@ -108,6 +109,7 @@ export default {
open(mode = "add") {
this.mode = mode;
this.visible = true;
+ console.log(this.mode)
return this;
},
//表单提交方法
@@ -115,7 +117,7 @@ export default {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
- this.$API.hrm.employee.update(this.form.id, this.form).then(res=>{
+ this.$API.hrm.employee.update.req(this.form.id, this.form).then(res=>{
this.isSaveing = false;
this.visible = false;
this.$emit("success", this.form, this.mode);