request修改
This commit is contained in:
parent
f7a785e40f
commit
b3c99be0fa
|
|
@ -3,15 +3,20 @@ import http from "@/utils/request"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
employee: {
|
employee: {
|
||||||
list: async function(data){
|
list: {
|
||||||
return await http.get(
|
url: `${config.API_URL}/hrm/employee/`,
|
||||||
`${config.API_URL}/hrm/employee/`,
|
name: "获取企业员工",
|
||||||
data);
|
req: async function(data){
|
||||||
|
return await http.get(this.url, data);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
update: async function(id, data){
|
update: {
|
||||||
|
name: "更新员工信息",
|
||||||
|
req: async function(id, data){
|
||||||
return await http.put(
|
return await http.put(
|
||||||
`${config.API_URL}/hrm/employee/${id}/`,
|
`${config.API_URL}/hrm/employee/${id}/`,
|
||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -279,7 +279,7 @@ export default {
|
||||||
Object.assign(reqData, this.tableParams);
|
Object.assign(reqData, this.tableParams);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var res = await this.apiObj(reqData);
|
var res = await this.apiObj.req(reqData);
|
||||||
if (this.hidePagination) {
|
if (this.hidePagination) {
|
||||||
this.tableData = res;
|
this.tableData = res;
|
||||||
if (res.length == 0) {
|
if (res.length == 0) {
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,10 @@
|
||||||
<el-table-column type="selection" width="50"></el-table-column>
|
<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="#" type="index" width="50"></el-table-column>
|
||||||
<el-table-column label="姓名" prop="name" width="150"></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="photo" width="200">
|
||||||
<el-table-column label="手机号" prop="phone" width="80"></el-table-column>
|
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="手机号" prop="phone" width="120"></el-table-column>
|
||||||
<el-table-column label="部门" prop="belong_dept" width="180">
|
<el-table-column label="部门" prop="belong_dept" width="180">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.belong_dept_">{{scope.row.belong_dept_.name}}</span>
|
<span v-if="scope.row.belong_dept_">{{scope.row.belong_dept_.name}}</span>
|
||||||
|
|
@ -31,11 +33,11 @@
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
|
<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-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>
|
<template #reference>
|
||||||
<el-button text type="danger" size="small">删除</el-button>
|
<el-button text type="danger" size="small">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm> -->
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,14 @@
|
||||||
ref="dialogForm"
|
ref="dialogForm"
|
||||||
:model="form"
|
:model="form"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
|
:disabled="mode=='show'"
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
>
|
>
|
||||||
<sc-title title="详细信息"></sc-title>
|
<sc-title title="详细信息"></sc-title>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :md="8" :sm="12" :xs="24">
|
<el-col :md="8" :sm="12" :xs="24">
|
||||||
<el-form-item label="姓名">
|
<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-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="8" :sm="12" :xs="24">
|
<el-col :md="8" :sm="12" :xs="24">
|
||||||
|
|
@ -108,6 +109,7 @@ export default {
|
||||||
open(mode = "add") {
|
open(mode = "add") {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
|
console.log(this.mode)
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
//表单提交方法
|
//表单提交方法
|
||||||
|
|
@ -115,7 +117,7 @@ export default {
|
||||||
this.$refs.dialogForm.validate(async (valid) => {
|
this.$refs.dialogForm.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.isSaveing = true;
|
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.isSaveing = false;
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.$emit("success", this.form, this.mode);
|
this.$emit("success", this.form, this.mode);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue