Commit 13c7f0dc by cwq0219

bug修复

1 parent a3e00a16
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
<template> <template>
<div> <div>
<el-popover popper-class="select-page" ref="popover" placement="bottom-start" trigger="click" v-model="popoverVisible" :disabled="targetItem.isDisabled" @show="onShowPopover" @hide="onHidePopover"> <el-popover popper-class="select-page" ref="popover" placement="bottom-start" trigger="click" v-model="popoverVisible" :disabled="targetItem.isDisabled" @show="onShowPopover" @hide="onHidePopover">
<el-input v-model="searchInput" :style="{ width: width - 32 + 'px', display: 'block' }" placeholder="输入搜索" @input="handleSearchInput"></el-input>
<el-radio-group class="select-tree" v-model="form[targetItem.name]" @change="handleChangeRadio"> <el-radio-group class="select-tree" v-model="form[targetItem.name]" @change="handleChangeRadio">
<el-radio class="page-radio" :style="`width: ${width - 32}px`" :title="item.merchantName" v-for="item in currList" :key="item.id" :label="item.id">{{ item.merchantName }}</el-radio> <el-radio class="page-radio" :style="`width: ${width - 32}px`" :title="item.merchantName" v-for="item in currList" :key="item.id" :label="item.id">{{ item.merchantName }}</el-radio>
</el-radio-group> </el-radio-group>
<div class="btns" v-show="page.total > 20"> <div class="btns" v-show="page.total > 5">
<el-button :size="size" :disabled="page.pageNum == 1" @click="handlePage(false)">上一页</el-button> <el-button :size="size" :disabled="page.pageNum == 1" @click="handlePage(false)">上一页</el-button>
<span>{{ page.pageNum }}/{{ page.totalPage }}</span> <span>{{ page.pageNum }}/{{ page.totalPage }}</span>
<el-button :size="size" :disabled="page.pageNum == page.totalPage" @click="handlePage(true)">下一页</el-button> <el-button :size="size" :disabled="page.pageNum == page.totalPage" @click="handlePage(true)">下一页</el-button>
</div> </div>
<!-- <el-tree ref="tree" class="select-tree" highlight-current default-expand-all node-key="id" :expand-on-click-node="isExpand" :style="`min-width: ${treeWidth}`" :data="treeData" :current-node-key="form[targetItem.name]" :props="defaultProps" :filter-node-method="handleFilterNode" @current-change="handleNodeClick"></el-tree> --> <el-input slot="reference" ref="input" v-model="form[targetItem.nameLabel]" :clearable="!targetItem.noClearable" :disabled="targetItem.isDisabled" :style="`width: ${width}px`" :class="{ rotate: popoverVisible }" suffix-icon="el-icon-arrow-down" :placeholder="'请选择' + targetItem.label" @clear="handleClear"></el-input>
<el-input slot="reference" ref="input" v-model="form[targetItem.nameLabel]" :clearable="!targetItem.noClearable" :disabled="targetItem.isDisabled" :style="`width: ${width}px`" :class="{ rotate: popoverVisible }" suffix-icon="el-icon-arrow-down" :placeholder="'请选择' + targetItem.label" @change="handleClear"></el-input>
</el-popover> </el-popover>
</div> </div>
</template> </template>
...@@ -23,13 +23,15 @@ export default { ...@@ -23,13 +23,15 @@ export default {
return { return {
size: 'small', size: 'small',
isExpand: false, isExpand: false,
searchInput: '',
timer: '',
// 树状菜单显示状态 // 树状菜单显示状态
popoverVisible: false, popoverVisible: false,
// treeWidth: 'auto',
currList: [], currList: [],
tempList: [],
allMerchantList: [], allMerchantList: [],
page: { page: {
pageSize: 20, pageSize: 5,
pageNum: 1, pageNum: 1,
total: 0, total: 0,
totalPage: 0 totalPage: 0
...@@ -57,35 +59,18 @@ export default { ...@@ -57,35 +59,18 @@ export default {
} }
}, },
// watch: {
// form(val) {
// if (this.form[this.targetItem.name]) {
// this.form[this.targetItem.nameLabel] = this.queryTree(this.treeData, this.form[this.targetItem.name])
// this.$nextTick().then(() => {
// this.$refs.tree.setCheckedKeys([this.form[this.targetItem.name]])
// })
// }
// }
// },
created() {
// 获取输入框宽度同步至树状菜单宽度
// this.$nextTick(() => {
// this.treeWidth = `${(this.width || this.$refs.input.$refs.input.clientWidth) - 24}px`
// })
},
mounted() { mounted() {
this.getAllMerchantList() this.getAllMerchantList()
}, },
methods: { methods: {
getCurrList() { getCurrList() {
this.currList = this.allMerchantList.slice((this.page.pageNum - 1) * this.page.pageSize, this.page.pageNum * this.page.pageSize) this.currList = this.tempList.slice((this.page.pageNum - 1) * this.page.pageSize, this.page.pageNum * this.page.pageSize)
}, },
getAllMerchantList() { getAllMerchantList() {
this.$apis.employee.getAllMerchantListApi({}).then(res => { this.$apis.employee.getAllMerchantListApi({}).then(res => {
this.allMerchantList = res this.allMerchantList = res
this.tempList = 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)
this.getCurrList() this.getCurrList()
...@@ -103,16 +88,29 @@ export default { ...@@ -103,16 +88,29 @@ export default {
// 显示时触发 // 显示时触发
onShowPopover() { onShowPopover() {
this.popoverVisible = true this.popoverVisible = true
// this.$refs.tree.filter(false)
}, },
// 隐藏时触发 // 隐藏时触发
onHidePopover() { onHidePopover() {
this.searchInput = ''
this.handleSearchInput(this.searchInput)
this.popoverVisible = false this.popoverVisible = false
}, },
handleClear(val) { handleClear(val) {
this.form[this.targetItem.name] = '' this.form[this.targetItem.name] = ''
this.form[this.targetItem.nameLabel] = '' this.form[this.targetItem.nameLabel] = ''
this.$emit('handleChange') this.$emit('handleChange')
},
handleSearchInput(val) {
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(() => {
this.tempList = val ? this.allMerchantList.filter(item => new RegExp(['', ...val, ''].join('.*')).test(item.merchantName)) : this.allMerchantList
this.page.total = this.tempList.length
this.page.pageNum = 1
this.page.totalPage = Math.ceil(this.tempList.length / this.page.pageSize)
this.getCurrList()
}, 600)
} }
} }
} }
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<div class="container"> <div class="container">
<p class="edit-sub-title p-rl-20">员工基本信息</p> <p class="edit-sub-title p-rl-20">员工基本信息</p>
<el-form label-width="140px" :inline="true"> <el-form label-width="140px" :inline="true">
<el-form-item style="margin-bottom: 0; width: 48%;" v-for="(item, index) in detailFormData" :key="index" :label="item.label + ':'"> <el-form-item class="basic-info" v-for="(item, index) in detailFormData" :key="index" :label="item.label + ':'">
<span class="txt-ellipsis" :title="info[item.name] || '无'">{{ info[item.name] || '无' }}</span> <span class="txt-ellipsis" style="display: inline-block; width: 100%;" :title="info[item.name] || '-'">{{ info[item.name] || '-' }}</span>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -154,5 +154,13 @@ export default { ...@@ -154,5 +154,13 @@ export default {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
word-wrap: break-word;
}
.config-employee .basic-info {
margin-bottom: 0;
width: 48%;
}
.config-employee .basic-info .el-form-item__content {
width: calc(100% - 140px);
} }
</style> </style>
...@@ -3,11 +3,6 @@ ...@@ -3,11 +3,6 @@
<div class="config-employee employee-list"> <div class="config-employee employee-list">
<div style="margin-bottom: 20px;"> <div style="margin-bottom: 20px;">
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">创建员工</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">创建员工</el-button>
<!-- <glsx-combi-form v-if="userInfo.accountLevel != 4" style="float: right;" ref="showSearch" labelWidth="90px" :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="topSearchFormData">
<template slot="merchantId" slot-scope="item">
<select-page :form="searchForm" width="200" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page>
</template>
</glsx-combi-form> -->
</div> </div>
<div class="container"> <div class="container">
<div> <div>
...@@ -46,7 +41,6 @@ ...@@ -46,7 +41,6 @@
<script> <script>
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
import glsxCombiForm from './glsx-combi-form' import glsxCombiForm from './glsx-combi-form'
// import glsxTable from '@/components/glsx-table'
import selectPage from './components/selectPage' import selectPage from './components/selectPage'
export default { export default {
name: 'index', name: 'index',
...@@ -69,18 +63,6 @@ export default { ...@@ -69,18 +63,6 @@ export default {
value: '' value: ''
} }
}, },
// topSearchFormData: [
// {
// label: '商户名称',
// name: 'merchantId',
// nameLabel: 'merchantName',
// optionList: [],
// optionId: 'id',
// optionLabel: 'merchantName',
// optionsName: 'allMerchantList',
// addHtml: 'merchantId'
// }
// ],
// 搜索 // 搜索
searchFormData: [ searchFormData: [
{ {
...@@ -152,12 +134,18 @@ export default { ...@@ -152,12 +134,18 @@ export default {
label: '员工企微号', label: '员工企微号',
prop: 'entmicroName', prop: 'entmicroName',
line: 2, line: 2,
minWidth: '100px' minWidth: '100px',
formatter: cellValue => {
return cellValue.entmicroName || '-'
}
}, },
{ {
label: '角色', label: '角色',
prop: 'roleName', prop: 'roleName',
line: 2 line: 2,
formatter: cellValue => {
return cellValue.roleName || '-'
}
}, },
{ {
label: '登录手机号', label: '登录手机号',
...@@ -310,8 +298,9 @@ export default { ...@@ -310,8 +298,9 @@ export default {
handleSwitchChange(val, row) { handleSwitchChange(val, row) {
if (!row.roleName) { if (!row.roleName) {
const h = this.$createElement
this.$message({ this.$message({
message: '您还未给该员工设置“角色”!设置角色:员工账户管理-修改-角色权限', message: h('p', null, [h('p', { style: 'text-align: center; line-height: 20px; color: #F56C6C;' }, '您还未给该员工设置“角色”! '), h('p', { style: 'text-align: center; line-height: 20px; color: #F56C6C;' }, '设置角色:员工账户管理-修改-角色权限')]),
type: 'error' type: 'error'
}) })
this.handleSearch() this.handleSearch()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!