request修改

This commit is contained in:
曹前明 2022-06-17 11:07:15 +08:00
parent f7a785e40f
commit b3c99be0fa
4 changed files with 24 additions and 15 deletions

View File

@ -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);
}
}
},
}

View File

@ -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) {

View File

@ -18,8 +18,10 @@
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="姓名" prop="name" width="150"></el-table-column>
<el-table-column label="证件照" prop="photo" width="200"></el-table-column>
<el-table-column label="手机号" prop="phone" width="80"></el-table-column>
<el-table-column label="证件照" prop="photo" width="200">
</el-table-column>
<el-table-column label="手机号" prop="phone" width="120"></el-table-column>
<el-table-column label="部门" prop="belong_dept" width="180">
<template #default="scope">
<span v-if="scope.row.belong_dept_">{{scope.row.belong_dept_.name}}</span>
@ -31,11 +33,11 @@
<el-button-group>
<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
<el-button text type="warning" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<!-- <el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference>
<el-button text type="danger" size="small">删除</el-button>
</template>
</el-popconfirm>
</el-popconfirm> -->
</el-button-group>
</template>
</el-table-column>

View File

@ -12,13 +12,14 @@
ref="dialogForm"
:model="form"
:rules="rules"
:disabled="mode=='show'"
label-width="80px"
>
<sc-title title="详细信息"></sc-title>
<el-row>
<el-col :md="8" :sm="12" :xs="24">
<el-form-item label="姓名">
<el-input v-model="form.name" type="text" clearable></el-input>
<el-input v-model="form.name" type="text" clearable :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :md="8" :sm="12" :xs="24">
@ -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);