Commit 87300f81 authored by guoyou's avatar guoyou

员工录入

parent 85bfe6b2
module.exports = { module.exports = {
NODE_ENV: '"development"', NODE_ENV: '"development"',
BASE_API:'"https://xxtest.upyuns.com"',//'"https://dev.dfangche.com"',//'"https://xxfcmgmt.upyuns.com"(正)',//http://10.1.37.192:9527(何), //https://xxtest.upyuns.com(测),10.1.37.246:9527(韩), 10.1.37.244(李斌)10.1.37.248:8765(小威) BASE_API:'"http://10.1.37.192:9527"',//'"https://xxtest.upyuns.com"',//'"https://dev.dfangche.com"',//'"https://xxfcmgmt.upyuns.com"(正)',//http://10.1.37.192:9527(何), //https://xxtest.upyuns.com(测),10.1.37.246:9527(韩), 10.1.37.244(李斌)10.1.37.248:8765(小威)
APP_ORIGIN: '"https://wallstreetcn.com"' APP_ORIGIN: '"https://wallstreetcn.com"'
} }
...@@ -117,6 +117,14 @@ export function addEditor(obj) { ...@@ -117,6 +117,14 @@ export function addEditor(obj) {
}); });
} }
// 编辑员工
export function editorUpd(obj) {
return fetch({
url: '/api/admin/postion/admin/upd',
method: 'post',
data: obj
});
}
//删除员工 //删除员工
export function deleteStaffs(id) { export function deleteStaffs(id) {
return fetch({ return fetch({
......
...@@ -31,28 +31,29 @@ ...@@ -31,28 +31,29 @@
<el-col :span="4"> <el-col :span="4">
<el-form-item label="分公司"> <el-form-item label="分公司">
<el-select class="filter-item" v-model="listQuery.status" placeholder="请选分公司"> <el-autocomplete
class="inline-input"
v-model="listQuery.companyName"
:fetch-suggestions="querySearch"
placeholder="请选择分公司"
@select="handleSelectPark"
clearable
></el-autocomplete>
<!-- <el-select class="filter-item" v-model="listQuery.status" placeholder="请选分公司">
<el-option :key="undefined" label="全部" :value="undefined"></el-option> <el-option :key="undefined" label="全部" :value="undefined"></el-option>
<el-option <el-option
v-for="(item,index) in statusList " v-for="(item,index) in companyList "
:key="index" :key="index"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> ></el-option>
</el-select> </el-select>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button> <el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button>
<el-button <el-button class="filter-item" type="primary" v-waves icon="delete" @click="cleaningQuery">清除搜索条件</el-button>
class="filter-item"
type="primary"
v-waves
icon="delete"
@click="cleaningQuery"
>清除搜索条件</el-button>
<el-button class="filter-item" type="primary" v-waves @click="addStaff">新增员工</el-button> <el-button class="filter-item" type="primary" v-waves @click="addStaff">新增员工</el-button>
<el-button class="filter-item" type="primary" v-waves @click="toLoad">批量导入员工</el-button> <el-button class="filter-item" type="primary" v-waves @click="toLoad">批量导入员工</el-button>
...@@ -107,12 +108,7 @@ ...@@ -107,12 +108,7 @@
></el-pagination> ></el-pagination>
<!-- 新增编辑员工 --> <!-- 新增编辑员工 -->
<el-dialog <el-dialog :title="staffTitle" :visible.sync="bulkUploadMember" class="member" @close="closeAdd">
:title="staffTitle"
:visible.sync="bulkUploadMember"
class="member"
@close="closeAdd"
>
<el-form :model="staffTitleFrom" ref="userMembership" :rules="rules" label-width="100px"> <el-form :model="staffTitleFrom" ref="userMembership" :rules="rules" label-width="100px">
<el-form-item label="员工姓名"> <el-form-item label="员工姓名">
<el-input v-model.number="staffTitleFrom.name" placeholder="请输入姓名"></el-input> <el-input v-model.number="staffTitleFrom.name" placeholder="请输入姓名"></el-input>
...@@ -136,6 +132,34 @@ ...@@ -136,6 +132,34 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="员工职位">
<el-select
class="filter-item"
v-model="staffTitleFrom.jobId"
placeholder="请选择员工身份"
style="width:100%"
>
<el-option :key="undefined" label="全部" :value="undefined"></el-option>
<el-option
v-for="(item,index) in jobsList "
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="分公司">
<el-autocomplete
class="inline-input"
v-model="staffTitleFrom.companyName"
:fetch-suggestions="querySearch"
placeholder="请选择分公司"
style="width:100%"
@select="handleSelectParks"
></el-autocomplete>
</el-form-item>
<div style="text-align:center"> <div style="text-align:center">
<el-button type="primary" @click="confirm">确 定</el-button> <el-button type="primary" @click="confirm">确 定</el-button>
<el-button type="primary" @click="bulkUploadMember = false">取消</el-button> <el-button type="primary" @click="bulkUploadMember = false">取消</el-button>
...@@ -148,10 +172,7 @@ ...@@ -148,10 +172,7 @@
<el-form :model="fileForm"> <el-form :model="fileForm">
<el-form-item label="上传文件" label-width="80px"> <el-form-item label="上传文件" label-width="80px">
<el-button type="primary" icon="el-icon-download"> <el-button type="primary" icon="el-icon-download">
<a <a class="el-icon-download" href="https://mgmt.dfangche.com/axshare/userposition.xlsx">下载模板</a>
class="el-icon-download"
href="https://mgmt.dfangche.com/axshare/userposition.xlsx"
>下载模板</a>
</el-button> </el-button>
<el-upload <el-upload
...@@ -174,12 +195,7 @@ ...@@ -174,12 +195,7 @@
</el-button> </el-button>
<div slot="tip" class="el-upload__tip">只能上传xlsx(Excel2007以上版本)文件,且不超过10M</div> <div slot="tip" class="el-upload__tip">只能上传xlsx(Excel2007以上版本)文件,且不超过10M</div>
</el-upload> </el-upload>
<el-button <el-button size="small" class="filter-item" type="primary" @click="cancelNotDeleteForm">取消</el-button>
size="small"
class="filter-item"
type="primary"
@click="cancelNotDeleteForm"
>取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-dialog> </el-dialog>
...@@ -210,48 +226,56 @@ import { ...@@ -210,48 +226,56 @@ import {
staffList, staffList,
postions, postions,
addEditor, addEditor,
deleteStaffs deleteStaffs,
} from "src/api/admin/userManagement/index"; jobs,editorUpd
import { getToken } from "src/utils/auth"; } from 'src/api/admin/userManagement/index'
import { mapGetters } from "vuex"; import { getToken } from 'src/utils/auth'
import { staffImport } from "src/api/admin/UserMember/index"; import { mapGetters } from 'vuex'
import { staffImport } from 'src/api/admin/UserMember/index'
import { getAll } from 'api/base_info/branch_company'
export default { export default {
created() { created() {
this.getList(); this.getList()
this.postionsFn(); this.postionsFn()
this.getAllFn()
this.jobsFn()
}, },
computed: { computed: {
...mapGetters(["elements"]), ...mapGetters(['elements']),
/** /**
* 获取token * 获取token
*/ */
getHeaderWithToken() { getHeaderWithToken() {
return { Authorization: getToken() }; return { Authorization: getToken() }
} }
}, },
data() { data() {
return { return {
activeId: "", jobsList: [],
activeId: '',
uploadListHiut: { uploadListHiut: {
uploadList: [], uploadList: [],
success: "", success: '',
error: "" error: ''
}, },
companyList: [],
uploadHiut: false, uploadHiut: false,
fileList: [], fileList: [],
BASE_API: process.env.BASE_API, BASE_API: process.env.BASE_API,
limitNum: 1, limitNum: 1,
fileForm: { fileForm: {
file: "" file: ''
}, },
tolead: false, tolead: false,
listQuery: { listQuery: {
name: "", name: '',
phone: "", phone: '',
status: null, status: null,
page: 1, page: 1,
limit: 10 limit: 10,
companyId: '',
companyName: ''
}, },
total: null, total: null,
tableKey: 0, tableKey: 0,
...@@ -259,48 +283,87 @@ export default { ...@@ -259,48 +283,87 @@ export default {
listLoading: true, listLoading: true,
statusList: [ statusList: [
{ {
label: "未核销", label: '未核销',
value: "0" value: '0'
}, },
{ {
label: "已核销", label: '已核销',
value: "1" value: '1'
} }
], ],
postionsList: [], postionsList: [],
staffTitle: "新增员工", staffTitle: '新增员工',
bulkUploadMember: false, bulkUploadMember: false,
staffTitleFrom: { staffTitleFrom: {
phone: "", phone: '',
name: "", name: '',
positionId: "" positionId: '',
jobId: '',
companyId: '',
companyName: ''
}, },
rules: {} rules: {}
}; }
}, },
methods: { methods: {
handleSelectPark(item) {
this.listQuery.companyId = item.id
},
handleSelectParks(item) {
this.staffTitleFrom.companyId = item.id
this.staffTitleFrom.companyName = item.name
},
createFilter(queryString) {
return restaurant => {
return restaurant.name.indexOf(queryString.toLowerCase()) != -1
}
},
querySearch(queryString, cb) {
let selectArry = []
this.companyList.map(function(item) {
item.value = item.name
selectArry.push(item)
})
this.selectArry = selectArry
var results = queryString
? selectArry.filter(this.createFilter(queryString))
: selectArry
// 调用 callback 返回建议列表的数据
cb(results)
},
//分公司
getAllFn() {
getAll().then(data => {
if (data.status == 200) {
this.companyList = data.data
}
})
},
//新增,编辑员工弹窗关闭 //新增,编辑员工弹窗关闭
closeAdd() { closeAdd() {
this.staffTitleFrom = { this.staffTitleFrom = {
phone: "", phone: '',
name: "", name: '',
positionId: "" positionId: '',
}; jobId: '',
companyId: '',
companyName: ''
}
}, },
upLoad(file) { upLoad(file) {
var form = new FormData(); var form = new FormData()
// 文件对象 // 文件对象
form.append("file", file.file); form.append('file', file.file)
staffImport(form).then(res => { staffImport(form).then(res => {
console.log(res); console.log(res)
this.uploadHiut = true; this.uploadHiut = true
(this.uploadListHiut = { ;(this.uploadListHiut = {
uploadList: res.data.data, uploadList: res.data.data,
success: res.data.success, success: res.data.success,
error: res.data.error error: res.data.error
}), }),
this.getList(); this.getList()
}); })
}, },
//excel上传 //excel上传
handleRemove(file, fileList) { handleRemove(file, fileList) {
...@@ -310,22 +373,22 @@ export default { ...@@ -310,22 +373,22 @@ export default {
//console.log(file); //console.log(file);
}, },
beforeRemove(file, fileList) { beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}?`); return this.$confirm(`确定移除 ${file.name}?`)
}, },
// 文件超出个数限制时的钩子 // 文件超出个数限制时的钩子
exceedFile(files, fileList) { exceedFile(files, fileList) {
this.$notify.warning({ this.$notify.warning({
title: "警告", title: '警告',
message: `只能选择 ${ message: `只能选择 ${
this.limitNum this.limitNum
} 个文件,当前共选择了 ${files.length + fileList.length} 个` } 个文件,当前共选择了 ${files.length + fileList.length} 个`
}); })
}, },
// 文件状态改变时的钩子 // 文件状态改变时的钩子
fileChange(file, fileList) { fileChange(file, fileList) {
//console.log("change"); //console.log("change");
//console.log(file); //console.log(file);
this.fileForm.file = file.raw; this.fileForm.file = file.raw
//console.log(this.fileForm.file); //console.log(this.fileForm.file);
// console.log(fileList); // console.log(fileList);
}, },
...@@ -333,134 +396,138 @@ export default { ...@@ -333,134 +396,138 @@ export default {
beforeUploadFile(file) { beforeUploadFile(file) {
//console.log("before upload"); //console.log("before upload");
//console.log(file); //console.log(file);
let extension = file.name.substring(file.name.lastIndexOf(".") + 1); let extension = file.name.substring(file.name.lastIndexOf('.') + 1)
let size = file.size / 1024 / 1024; let size = file.size / 1024 / 1024
if (extension !== "xlsx") { if (extension !== 'xlsx') {
this.$notify.warning({ this.$notify.warning({
title: "警告", title: '警告',
message: `只能上传Excel 2007以上版本(即后缀是.xlsx)的文件` message: `只能上传Excel 2007以上版本(即后缀是.xlsx)的文件`
}); })
} }
if (size > 10) { if (size > 10) {
this.$notify.warning({ this.$notify.warning({
title: "警告", title: '警告',
message: `文件大小不得超过10M` message: `文件大小不得超过10M`
}); })
} }
}, },
cancelNotDeleteForm() { cancelNotDeleteForm() {
this.tolead = false; this.tolead = false
this.$refs.uploadExcel.clearFiles(); this.$refs.uploadExcel.clearFiles()
}, },
//员工列表 //员工列表
getList() { getList() {
staffList(this.listQuery).then(data => { staffList(this.listQuery).then(data => {
this.listLoading = true; this.listLoading = true
if (data.status == 200) { if (data.status == 200) {
console.log(data); console.log(data)
this.list = data.data.data; this.list = data.data.data
this.total = data.data.totalCount; this.total = data.data.totalCount
this.listLoading = false; this.listLoading = false
} }
}); })
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.listQuery.limit = val; this.listQuery.limit = val
this.getList(); this.getList()
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.listQuery.page = val; this.listQuery.page = val
this.getList(); this.getList()
}, },
//搜索 //搜索
handleFilter() { handleFilter() {
this.getList(); this.getList()
}, },
//清空搜索条件 //清空搜索条件
cleaningQuery() { cleaningQuery() {
this.listQuery.page = 1; this.listQuery.page = 1
this.listQuery.limit = 10; this.listQuery.limit = 10
this.listQuery.name = ""; this.listQuery.name = ''
this.listQuery.phone = ""; this.listQuery.phone = ''
this.listQuery.status = ""; this.listQuery.status = ''
this.getList(); this.listQuery.companyId = ''
this.listQuery.companyName = ''
this.getList()
}, },
//新增员工 //新增员工
addStaff() { addStaff() {
this.staffTitle == "新增员工" this.staffTitle = '新增员工'
this.bulkUploadMember = true; this.bulkUploadMember = true
}, },
//批量导入员工 //批量导入员工
toLoad() { toLoad() {
this.tolead = true; this.tolead = true
}, },
//编辑员工 //编辑员工
editorStaff(row) { editorStaff(row) {
this.activeId = row.id; this.activeId = row.id
this.staffTitle = "编辑员工"; this.staffTitle = '编辑员工'
this.bulkUploadMember = true; this.bulkUploadMember = true
this.staffTitleFrom = { this.staffTitleFrom = {
phone: row.phone, phone: row.phone,
name: row.name, name: row.name,
positionId: row.positionId positionId: row.positionId,
}; companyId:row.companyId,
companyName:row.companyName,
}
}, },
//删除员工 //删除员工
deleteStaff(row) { deleteStaff(row) {
this.$confirm("确定删除吗?", "提示", { this.$confirm('确定删除吗?', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
deleteStaffs(row.id).then(data => { deleteStaffs(row.id).then(data => {
if (data.status == 200) { if (data.status == 200) {
this.$notify({ this.$notify({
title: "成功", title: '成功',
message: "删除成功", message: '删除成功',
type: "success", type: 'success',
duration: 2000 duration: 2000
}); })
this.getList(); this.getList()
} else { } else {
this.$notify({ this.$notify({
title: "失败", title: '失败',
message: "删除失败", message: '删除失败',
type: "failed", type: 'failed',
duration: 2000 duration: 2000
}); })
} }
}); })
}); })
}, },
//确定 //确定
confirm(formName) { confirm(formName) {
if (this.staffTitle == "新增员工") { if (this.staffTitle == '新增员工') {
addEditor(this.staffTitleFrom).then(data => { addEditor(this.staffTitleFrom).then(data => {
if (data.status == 200) { if (data.status == 200) {
this.$notify({ this.$notify({
title: "成功", title: '成功',
message: "新增成功", message: '新增成功',
type: "success", type: 'success',
duration: 2000 duration: 2000
}); })
this.bulkUploadMember = false; this.bulkUploadMember = false
this.getList(); this.getList()
} }
}); })
} else { } else {
this.staffTitleFrom.id = this.activeId; this.staffTitleFrom.id = this.activeId
addEditor(this.staffTitleFrom).then(data => { editorUpd(this.staffTitleFrom).then(data => {
if (data.status == 200) { if (data.status == 200) {
this.$notify({ this.$notify({
title: "成功", title: '成功',
message: "编辑成功", message: '编辑成功',
type: "success", type: 'success',
duration: 2000 duration: 2000
}); })
this.bulkUploadMember = false; this.bulkUploadMember = false
this.getList(); this.getList()
} }
}); })
} }
}, },
//身份列表 //身份列表
...@@ -468,23 +535,23 @@ export default { ...@@ -468,23 +535,23 @@ export default {
postions().then(data => { postions().then(data => {
//console.log(data); //console.log(data);
if (data.status == 200) { if (data.status == 200) {
this.postionsList = data.data; this.postionsList = data.data
} }
}); })
}, },
jobsFn() { jobsFn() {
jobs().then(data => { jobs().then(data => {
//console.log(data); //console.log(data);
if (data.status == 200) { if (data.status == 200) {
this.jobsList = data.data; this.jobsList = data.data
} }
}); })
}, },
resetForm(formName) { resetForm(formName) {
this.$refs[formName].resetFields(); this.$refs[formName].resetFields()
} }
} }
}; }
</script> </script>
<style> <style>
.member .el-dialog--small { .member .el-dialog--small {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment