Commit 3eef0093 by 胡悦

提交

1 parent 49730702
...@@ -5,11 +5,38 @@ ...@@ -5,11 +5,38 @@
</div> </div>
<div class="container"> <div class="container">
<p class="edit-sub-title p-rl-20">员工基本信息</p> <p class="edit-sub-title p-rl-20">员工基本信息</p>
<glsx-combi-form class="p-tr-20" ref="editFormRef" labelWidth="160px" @handleImgDelete="handleImgDelete" :isBlock="isBlock" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form
class="p-tr-20"
ref="editFormRef"
labelWidth="160px"
@handleImgDelete="handleImgDelete"
:isBlock="isBlock"
:formRef="editChildRef"
:formObj="editForm"
:formData="editFormData"
:formRules="editRule"
>
<template slot="merchantId" slot-scope="item"> <template slot="merchantId" slot-scope="item">
<span class="txt-ellipsis" v-if="routeInfo.addOrEdit == 2 || (routeInfo.addOrEdit == 1 && userInfo.accountLevel == 4)" :title="editForm.merchantName">{{ editForm.merchantName}}</span> <span
<el-select v-else :style="{ width: item.scope.width }" v-model="editForm[item.scope.name]" :clearable="item.scope.isClear || false" :placeholder="'请选择' + item.scope.label" :filterable="!item.scope.noFilter" @change="handleChangeMerchant($event)"> class="txt-ellipsis"
<el-option v-for="subItem in baseData.allMerchantList" :key="subItem[item.scope.optionId]" :label="subItem[item.scope.optionLabel]" :value="subItem[item.scope.optionId]"></el-option> v-if="routeInfo.addOrEdit == 2 || (routeInfo.addOrEdit == 1 && userInfo.accountLevel == 4)"
:title="editForm.merchantName"
>{{ editForm.merchantName}}</span>
<el-select
v-else
:style="{ width: item.scope.width }"
v-model="editForm[item.scope.name]"
:clearable="item.scope.isClear || false"
:placeholder="'请选择' + item.scope.label"
:filterable="!item.scope.noFilter"
@change="handleChangeMerchant($event)"
>
<el-option
v-for="subItem in baseData.allMerchantList"
:key="subItem[item.scope.optionId]"
:label="subItem[item.scope.optionLabel]"
:value="subItem[item.scope.optionId]"
></el-option>
</el-select> </el-select>
<!-- <select-page v-else :form="editForm" width="360" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page> --> <!-- <select-page v-else :form="editForm" width="360" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page> -->
</template> </template>
...@@ -21,8 +48,26 @@ ...@@ -21,8 +48,26 @@
<el-button class="m-l-10 el-icon-refresh" type="primary" @click="handleRefresh">刷新</el-button> <el-button class="m-l-10 el-icon-refresh" type="primary" @click="handleRefresh">刷新</el-button>
</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
<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> :style="{ width: item.width || '360px' }"
placeholder="可见商户"
v-model="filterText"
></el-input>
<el-button class="m-l-10" type="primary" @click="checkAll">{{isCheckAll ? '全不选':'全选'}}</el-button>
<el-tree
v-show="baseData.merchantTree.length != 0"
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>
...@@ -199,8 +244,9 @@ export default { ...@@ -199,8 +244,9 @@ export default {
allMerchantList: [], allMerchantList: [],
merchantTree: [], merchantTree: [],
roleList: [] roleList: []
},
isCheckAll: false
} }
};
}, },
watch: { watch: {
...@@ -275,7 +321,7 @@ export default { ...@@ -275,7 +321,7 @@ export default {
return data.label.indexOf(value) !== -1 return data.label.indexOf(value) !== -1
}, },
getRoleList(value) { getRoleList(value) {
this.$apis.employee.getRoleListApi({ id: value, delFlag:0}).then(res => { this.$apis.employee.getRoleListApi({ id: value, delFlag: 0 }).then(res => {
this.baseData.roleList = res this.baseData.roleList = res
this.getOptionsList('editFormData', false, 'roleIds') this.getOptionsList('editFormData', false, 'roleIds')
}) })
...@@ -315,7 +361,7 @@ export default { ...@@ -315,7 +361,7 @@ export default {
}, },
handleJumpRole() { handleJumpRole() {
let path = document.location.pathname.split('/')[1] let path = document.location.pathname.split('/')[1]
this.$history.push('/' + path+ '/role/create') this.$history.push('/' + path + '/role/create')
}, },
handleRefresh() { handleRefresh() {
this.editForm.merchantId this.editForm.merchantId
...@@ -360,6 +406,29 @@ export default { ...@@ -360,6 +406,29 @@ export default {
this.$router.push({ this.$router.push({
path: '/employee/index' path: '/employee/index'
}) })
},
getAllId(data, arr = []) {
if (data) {
data.forEach(item => {
arr.push(item.id)
if (item.children && item.children.length != 0) {
item.children.forEach(i => {
arr.push(i.id)
this.getAllId(i.children, arr)
})
}
})
}
return arr
},
checkAll() {
if (this.isCheckAll) {
this.$refs.tree.setCheckedKeys([])
} else {
const allId = this.getAllId(this.baseData.merchantTree)
this.$refs.tree.setCheckedKeys(allId)
}
this.isCheckAll = !this.isCheckAll
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!