Commit e009be6e by cwq0219

员工

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