Commit e009be6e by cwq0219

员工

1 parent c22ae062
...@@ -71,4 +71,4 @@ const getDetailLogApi = params => { ...@@ -71,4 +71,4 @@ const getDetailLogApi = params => {
}) })
} }
export { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi, getDetailInfoApi, getDetailLogApi } export default { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi, getDetailInfoApi, getDetailLogApi }
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
</template> </template>
<script> <script>
import { getAllMerchantListApi } from '@/api/modules/employee'
export default { export default {
name: 'selectPage', name: 'selectPage',
data() { data() {
...@@ -85,7 +84,7 @@ export default { ...@@ -85,7 +84,7 @@ export default {
this.currList = this.allMerchantList.slice((this.page.pageNum - 1) * this.page.pageSize, this.page.pageNum * this.page.pageSize) this.currList = this.allMerchantList.slice((this.page.pageNum - 1) * this.page.pageSize, this.page.pageNum * this.page.pageSize)
}, },
getAllMerchantList() { getAllMerchantList() {
getAllMerchantListApi({}).then(res => { this.$apis.employee.getAllMerchantListApi({}).then(res => {
this.allMerchantList = res this.allMerchantList = res
this.page.total = res.length this.page.total = res.length
this.page.totalPage = Math.ceil(res.length / this.page.pageSize) this.page.totalPage = Math.ceil(res.length / this.page.pageSize)
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</template> </template>
<script> <script>
import { getDetailInfoApi } from '@/api/modules/employee' // import { getDetailInfoApi } from '@/api/modules/employee'
export default { export default {
name: 'info', name: 'info',
data() { data() {
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
methods: { methods: {
getInfo() { getInfo() {
getDetailInfoApi({ id: this.id }).then(res => { this.$apis.employee.getDetailInfoApi({ id: this.id }).then(res => {
console.log(res) console.log(res)
this.info = res this.info = res
}) })
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
</template> </template>
<script> <script>
import { getDetailLogApi } from '@/api/modules/employee' // import { getDetailLogApi } from '@/api/modules/employee'
export default { export default {
name: 'record', name: 'record',
data() { data() {
return { return {
searchForm: {}, searchForm: {},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
getListApi: getDetailLogApi, getListApi: this.$apis.employee.getDetailLogApi,
tableParams: { tableParams: {
listName: 'data', listName: 'data',
tableColumns: [ tableColumns: [
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</template> </template>
<template slot="visibleInferiorMer" slot-scope="item"> <template slot="visibleInferiorMer" slot-scope="item">
<el-input :style="{ width: item.width || '360px' }" placeholder="可见商户" v-model="filterText"></el-input> <el-input :style="{ width: item.width || '360px' }" placeholder="可见商户" v-model="filterText"></el-input>
<el-tree show-checkbox check-on-click-node check-strictly class="filter-tree" :data="baseData.merchantTree" :props="defaultProps" default-expand-all :filter-node-method="filterNode" ref="tree" @check="handleClickNode"></el-tree> <el-tree show-checkbox check-on-click-node check-strictly class="filter-tree" node-key="id" :data="baseData.merchantTree" :props="defaultProps" default-expand-all :filter-node-method="filterNode" ref="tree" @check="handleClickNode"></el-tree>
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
import selectPage from './components/selectPage' import selectPage from './components/selectPage'
import glsxCombiForm from './glsx-combi-form' import glsxCombiForm from './glsx-combi-form'
import { getAllMerchantListApi, getRoleListApi, getMerchantTreeApi } from '@/api/modules/employee' // import { getAllMerchantListApi, getRoleListApi, getMerchantTreeApi } from '@/api/modules/employee'
export default { export default {
name: 'editEmployee', name: 'editEmployee',
data() { data() {
...@@ -60,7 +60,8 @@ export default { ...@@ -60,7 +60,8 @@ export default {
password: '', password: '',
visibleInferiorMer: '', visibleInferiorMer: '',
roleId: '', roleId: '',
merhcnatImg: '' merhcnatImg: '',
fileName: ''
}, },
editRule: { editRule: {
merchantId: [{ required: true, message: '请选择所属商户', trigger: 'change' }], merchantId: [{ required: true, message: '请选择所属商户', trigger: 'change' }],
...@@ -126,11 +127,18 @@ export default { ...@@ -126,11 +127,18 @@ export default {
name: 'merhcnatImg', name: 'merhcnatImg',
type: 'upload', type: 'upload',
maxPhotoNum: 1, maxPhotoNum: 1,
wdithLt: 800, // wdithLt: 800,
heightLt: 640, // heightLt: 640,
noPixel: true,
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64}).then((res) => {
if (res) {
console.log(res)
// fileName
}
})
// uploadImg({ file: base64, fileType: 'image' }).then(res => { // uploadImg({ file: base64, fileType: 'image' }).then(res => {
// this.editForm[targetItem.name] = res // this.editForm[targetItem.name] = res
// this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name) // this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
...@@ -176,29 +184,49 @@ export default { ...@@ -176,29 +184,49 @@ export default {
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params this.routeInfo = this.$route.params
this.getAllMerchantList() this.getAllMerchantList()
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
}, },
methods: { methods: {
getAllMerchantList() { getAllMerchantList() {
getAllMerchantListApi({}).then(res => { this.$apis.employee.getAllMerchantListApi({}).then(res => {
this.baseData.allMerchantList = res this.baseData.allMerchantList = res
}) })
}, },
handleChangeMerchant(e) { getInfo() {
console.log(e) this.$apis.employee.getDetailInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm.roleId = '' this.editForm = res
this.editForm.visibleInferiorMer = '' this.editForm.roleId = res.roleIds[0]
if (res.merchantFileResponse) {
this.editForm.merhcnatImg = res.merchantFileResponse.fileUrl
this.editForm.fileName = res.merchantFileResponse.fileName
}
console.log(this.editForm)
this.handleChangeMerchant(this.editForm.merchantId, true)
})
},
handleChangeMerchant(e, editRecovery = false) {
// console.log(e)
if (!editRecovery) {
this.editForm.roleId = ''
this.editForm.visibleInferiorMer = ''
}
if (!e) { if (!e) {
this.baseData.merchantTree = [] this.baseData.merchantTree = []
this.baseData.roleList = [] this.baseData.roleList = []
this.getOptionsList('editFormData', false, 'roleId') this.getOptionsList('editFormData', false, 'roleId')
} }
this.getRoleList(e) this.getRoleList(e)
this.getMerchantTree(e) this.getMerchantTree(e, editRecovery)
},
setCheckedTree() {
var checkedList = this.editForm.visibleInferiorMer.split(',').map(item => +item)
this.$refs.tree.setCheckedKeys(checkedList)
}, },
getMerchantTree(value) { getMerchantTree(value, editRecovery) {
getMerchantTreeApi({ id: value }).then(res => { this.$apis.employee.getMerchantTreeApi({ id: value }).then(res => {
this.baseData.merchantTree = res this.baseData.merchantTree = res
editRecovery && this.setCheckedTree()
}) })
}, },
filterNode(value, data) { filterNode(value, data) {
...@@ -206,7 +234,7 @@ export default { ...@@ -206,7 +234,7 @@ export default {
return data.label.indexOf(value) !== -1 return data.label.indexOf(value) !== -1
}, },
getRoleList(value) { getRoleList(value) {
getRoleListApi({ id: value }).then(res => { this.$apis.employee.getRoleListApi({ id: value }).then(res => {
this.baseData.roleList = res this.baseData.roleList = res
this.getOptionsList('editFormData', false, 'roleId') this.getOptionsList('editFormData', false, 'roleId')
}) })
...@@ -247,7 +275,13 @@ export default { ...@@ -247,7 +275,13 @@ export default {
console.log(this.editForm) console.log(this.editForm)
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
this.editForm.roleIds = [this.editForm.roleId] var params = this.$common.utils.deepClone(this.editForm)
// merchantFileRequest
params.roleIds = [this.editForm.roleId]
params.merchantFileRequest = {
fileName: this.editForm.fileName,
fileUrl: this.editForm.merhcnatImg
}
console.log(this.editForm) console.log(this.editForm)
this.handleCancel() this.handleCancel()
} }
...@@ -272,7 +306,7 @@ export default { ...@@ -272,7 +306,7 @@ export default {
padding: 20px; padding: 20px;
} }
.config-employee .p-rl-20 { .config-employee .p-rl-20 {
padding: 0 20px; padding: 20px 20px 0;
} }
.config-employee .flex { .config-employee .flex {
display: flex; display: flex;
...@@ -330,4 +364,7 @@ export default { ...@@ -330,4 +364,7 @@ export default {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
/* .config-employee .el-checkbox:last-of-type {
margin-right: 8px !important;
} */
</style> </style>
...@@ -183,7 +183,7 @@ export default { ...@@ -183,7 +183,7 @@ export default {
image.onload = () => { image.onload = () => {
var imgWidth = image.width var imgWidth = image.width
var imgHeight = image.height var imgHeight = image.height
if (imgWidth > wdithLt || imgHeight > heightLt) { if (!targetItem.noPixel && ( imgWidth > wdithLt || imgHeight > heightLt)) {
this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素') this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素')
} else { } else {
targetItem.handleUpload(e, file, targetItem) targetItem.handleUpload(e, file, targetItem)
...@@ -207,9 +207,9 @@ export default { ...@@ -207,9 +207,9 @@ export default {
/* .glsx-combi-form { /* .glsx-combi-form {
min-width: 922px; min-width: 922px;
} */ } */
.glsx-combi-form .glsx-combi-form-block { /* .glsx-combi-form .glsx-combi-form-block {
padding: 16px 40px 0; padding: 16px 40px 0;
} } */
.glsx-combi-form .isBlock { .glsx-combi-form .isBlock {
display: block; display: block;
} }
...@@ -282,8 +282,8 @@ export default { ...@@ -282,8 +282,8 @@ export default {
color: #999999; color: #999999;
} }
.glsx-combi-form .img-w-h { .glsx-combi-form .img-w-h {
width: 88px; width: 80px;
height: 74px; height: 80px;
} }
.glsx-combi-form .activity-img { .glsx-combi-form .activity-img {
position: relative; position: relative;
...@@ -322,8 +322,8 @@ export default { ...@@ -322,8 +322,8 @@ export default {
display: none; display: none;
height: 100%; height: 100%;
position: absolute; position: absolute;
width: 88px; width: 80px;
height: 74px; height: 80px;
left: 0; left: 0;
top: 0; top: 0;
z-index: 2; z-index: 2;
......
<!-- 员工管理 --> <!-- 员工管理 -->
<template> <template>
<div class="config-employee"> <div class="config-employee employee-list">
<!-- <div class="container"> --> <!-- <div class="container"> -->
<div style="margin: 16px 0;"> <div style="margin: 16px 0;">
<el-button :size="size" type="primary" @click="handleEdit(1)">创建员工</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">创建员工</el-button>
</div> </div>
<!-- </div> --> <!-- </div> -->
<div class="container"> <div class="container">
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
<template slot="merchantId" slot-scope="item"> <template slot="merchantId" slot-scope="item">
<select-page :form="searchForm" width="200px" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page> <select-page :form="searchForm" width="200px" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page>
</template> </template>
<template slot="footer"> <span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button> <el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary">导出</el-button> <el-button :size="size" type="primary">导出</el-button>
</template> </span>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<script> <script>
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
import { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi } from '@/api/modules/employee' // import { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi } from '@/api/modules/employee'
import glsxCombiForm from './glsx-combi-form' import glsxCombiForm from './glsx-combi-form'
import selectPage from './components/selectPage' import selectPage from './components/selectPage'
export default { export default {
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
selectName: 'staffNameOrPhone', selectName: 'staffNameOrPhone',
isClear: true, isClear: true,
maxlength: 15, maxlength: 15,
inputWidth: '280px', inputWidth: '320px',
selectWidth: '100px', selectWidth: '100px',
selectOption: [ selectOption: [
{ {
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
} }
], ],
// 表格 // 表格
getListApi: getListApi, getListApi: this.$apis.employee.getListApi,
tableParams: { tableParams: {
listName: 'data', listName: 'data',
tableOption: true, tableOption: true,
...@@ -178,14 +178,14 @@ export default { ...@@ -178,14 +178,14 @@ export default {
methods: { methods: {
getAllMerchantList() { getAllMerchantList() {
getAllMerchantListApi({}).then(res => { this.$apis.employee.getAllMerchantListApi({}).then(res => {
this.baseData.allMerchantList = res this.baseData.allMerchantList = res
}) })
}, },
getBaseData() { getBaseData() {
// 1.product(产品) 2.account_type(账户类型) 3.(functional_attributes) 功能属性 4.(owned_customer_group)所属客户群 5.channel渠道 6.account_level(商户层级) // 1.product(产品) 2.account_type(账户类型) 3.(functional_attributes) 功能属性 4.(owned_customer_group)所属客户群 5.channel渠道 6.account_level(商户层级)
return new Promise(resolve => { return new Promise(resolve => {
Promise.all([getAllMerchantListApi({}), getAllDictApi({ dictType: 'staff_status' })]).then(([allMerchant, staffStatus]) => { Promise.all([this.$apis.employee.getAllMerchantListApi({}), this.$apis.employee.getAllDictApi({ dictType: 'staff_status' })]).then(([allMerchant, staffStatus]) => {
this.baseData.allMerchantList = allMerchant this.baseData.allMerchantList = allMerchant
this.baseData.staffStatusList = staffStatus this.baseData.staffStatusList = staffStatus
resolve() resolve()
...@@ -223,7 +223,7 @@ export default { ...@@ -223,7 +223,7 @@ export default {
this.baseData.roleList = [] this.baseData.roleList = []
this.getOptionsList('searchFormData', true, 'roleId') this.getOptionsList('searchFormData', true, 'roleId')
value && value &&
getRoleListApi({ id: value }).then(res => { this.$apis.employee.getRoleListApi({ id: value }).then(res => {
this.baseData.roleList = res this.baseData.roleList = res
this.getOptionsList('searchFormData', true, 'roleId') this.getOptionsList('searchFormData', true, 'roleId')
}) })
...@@ -284,6 +284,9 @@ export default { ...@@ -284,6 +284,9 @@ export default {
.config-employee { .config-employee {
margin-bottom: 0; margin-bottom: 0;
} }
.employee-list .footer-btns {
float: right;
}
.config-employee .container { .config-employee .container {
margin-top: 20px; margin-top: 20px;
background: #ffffff; background: #ffffff;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!