no message

cyl/job_im_cus
jscyl13849007907 5 days ago
parent 7b7e1027b4
commit 7a3178066b

@ -258,31 +258,64 @@
<u-popup v-model="deptModal.isShow" mode="bottom" border-radius="16" height="980" :mask-close-able="true" @close="deptModal.isShow = false">
<div class="dept-picker-wrap">
<div class="g_fs_18 g_c_3 g_flex_row_center g_pt_16 g_pb_16">选择部门</div>
<div class="dept-columns-scroll" style="overflow-x: auto;width: 100vw;">
<div class="dept-columns g_flex_row_start">
<div class="dept-column" v-for="(column, colIndex) in deptColumns" :key="colIndex" :id="'dept-column-' + colIndex">
<div :style="{ paddingTop: (columnPaddingTops[colIndex] || 0) + 'px' }">
<div
class="g_flex_row_between g_pt_16 g_pb_16"
style="border-bottom: 1px solid #ddd;"
v-for="(dept, deptIndex) in column"
:key="dept.id"
:id="'dept-item-' + colIndex + '-' + deptIndex"
@click="handleDeptClick(dept, colIndex, deptIndex)"
>
<div class="g_ell_1 g_flex_1" :style="{ color: '#333', fontSize: '14px', flex: 1, marginRight: '8px',padding:'0 4px' }">
{{ dept.teamName }}
</div>
<div class="g_flex_column_center g_flex_none" style="margin-right: 4px;">
<i
class="iconfont icon-a-duigoubeifen2"
style="font-size: 24px"
:style="{
color: isDeptSelected(dept.id) ? '#6A81FF' : '#fff',
}"
></i>
<!-- 面包屑导航 -->
<div class="dept-breadcrumb g_flex_row_start g_pl_12 g_pr_12 g_pb_8" v-if="deptBreadcrumb.length > 0">
<div class="g_flex_row_start g_fs_14" style="flex-wrap: wrap;">
<div
class="g_flex_row_start"
v-for="(crumb, index) in deptBreadcrumb"
:key="index"
@click="navigateToDeptLevel(index)"
>
<div :style="{ color: index === deptBreadcrumb.length - 1 ? '#333' : '#6A81FF' }">{{ crumb.teamName }}</div>
<div class="g_c_9 g_ml_4 g_mr_4" v-if="index < deptBreadcrumb.length - 1">/</div>
</div>
</div>
</div>
<!-- 部门列表 -->
<scroll-view scroll-y="true" class="dept-list-scroll">
<div>
<div
class="dept-list-item"
v-for="(dept, deptIndex) in currentDeptList"
:key="dept.id"
>
<!-- 复选框区域点击选中 -->
<div class="dept-checkbox-area" @click="toggleDeptSelect(dept)">
<i
class="iconfont"
:class="isDeptSelected(dept.id) ? 'icon-check-circle-fill' : 'icon-yuanxingweixuanzhong'"
:style="{ fontSize: '20px', color: isDeptSelected(dept.id) ? '#6A81FF' : '#cccccc' }"
></i>
</div>
<!-- 内容区域点击进入子级 -->
<div class="dept-content-area" @click="enterDeptLevel(dept)">
<div class="dept-folder-icon g_flex_none">
<div class="g_flex_c dept-folder-bg">
<i class="iconfont icon-folder-fill"></i>
</div>
</div>
<div class="g_ell_1 dept-content-name">{{ dept.teamName }}</div>
<i class="iconfont icon-gengduo11 dept-content-arrow" v-if="dept.childs && dept.childs.length > 0"></i>
</div>
</div>
<div v-if="currentDeptList.length === 0" class="g_text_c g_c_9 g_pt_40 g_pb_40">
暂无数据
</div>
</div>
</scroll-view>
<!-- 已选部门 -->
<div class="dept-selected-wrap" v-if="selectedDeptIds.length > 0">
<div class="dept-selected-scroll">
<div class="g_flex_row_start" style="flex-wrap: wrap;">
<div
class="dept-selected-tag g_flex_row_center g_fs_13"
v-for="(id, sIndex) in selectedDeptIds"
:key="id"
@click="removeSelectedDept(sIndex)"
>
{{ selectedDeptNames[sIndex] }}
<i class="iconfont icon-qingchu1 g_ml_4" style="font-size: 12px"></i>
</div>
</div>
</div>
@ -377,12 +410,11 @@ export default {
deptModal: {
isShow: false,
},
deptColumns: [], // [[{id,teamName,childs}], [...]]
expandedDeptIds: [], // id
currentDeptList: [], //
deptBreadcrumb: [], //
selectedDeptIds: [], // id
selectedDeptNames: [], //
currentDeptItem: null, //
columnPaddingTops: {}, //
roleModal: {
isShow: false,
},
@ -827,54 +859,13 @@ export default {
this.selectedDeptIds = [];
this.selectedDeptNames = [];
}
//
this.expandedDeptIds = this.buildExpandedPath(this.deptList || [], item.deptIds || []);
this.columnPaddingTops = {};
this.deptColumns = this.buildCascadingColumns(this.deptList || []);
//
this.currentDeptList = [].concat(this.deptList || []);
this.deptBreadcrumb = [];
this.deptModal.isShow = true;
},
// id
buildExpandedPath(list, selectedIds) {
if (!list || list.length === 0 || !selectedIds || selectedIds.length === 0) return [];
for (let i = 0; i < list.length; i++) {
let item = list[i];
if (selectedIds.indexOf(item.id) > -1) {
//
return [item.id];
}
if (item.childs && item.childs.length > 0) {
let childPath = this.buildExpandedPath(item.childs, selectedIds);
if (childPath.length > 0) {
return [item.id].concat(childPath);
}
}
}
return [];
},
//
buildCascadingColumns(list) {
if (!list || list.length === 0) return [];
let columns = [list];
let currentList = list;
for (let i = 0; i < this.expandedDeptIds.length; i++) {
let expandedId = this.expandedDeptIds[i];
let found = currentList.find(item => item.id === expandedId);
if (found && found.childs && found.childs.length > 0) {
columns.push(found.childs);
currentList = found.childs;
} else {
break;
}
}
return columns;
},
//
isParentExpanded(dept, colIndex) {
return this.expandedDeptIds[colIndex] === dept.id;
},
// + /
handleDeptClick(dept, colIndex, deptIndex) {
//
// /
toggleDeptSelect(dept) {
let idx = this.selectedDeptIds.indexOf(dept.id);
if (idx > -1) {
this.selectedDeptIds.splice(idx, 1);
@ -883,55 +874,37 @@ export default {
this.selectedDeptIds.push(dept.id);
this.selectedDeptNames.push(dept.teamName);
}
// /
if (dept.childs && dept.childs.length > 0) {
if (this.expandedDeptIds[colIndex] === dept.id) {
//
this.expandedDeptIds = this.expandedDeptIds.slice(0, colIndex);
// padding-top
this.clearColumnPaddingTops(colIndex);
} else {
//
this.expandedDeptIds = this.expandedDeptIds.slice(0, colIndex);
this.expandedDeptIds.push(dept.id);
}
this.deptColumns = this.buildCascadingColumns(this.deptList || []);
// 使
this.$nextTick(() => {
this.alignColumnToParent(colIndex, deptIndex);
});
}
},
// padding-top
clearColumnPaddingTops(colIndex) {
let newPaddingTops = {};
Object.keys(this.columnPaddingTops).forEach(key => {
if (Number(key) <= colIndex) {
newPaddingTops[key] = this.columnPaddingTops[key];
}
});
this.columnPaddingTops = newPaddingTops;
//
enterDeptLevel(dept) {
if (!dept.childs || dept.childs.length === 0) return;
this.deptBreadcrumb.push(dept);
this.currentDeptList = [].concat(dept.childs);
},
// 使
alignColumnToParent(colIndex, deptIndex) {
let that = this;
let parentItemId = '#dept-item-' + colIndex + '-' + deptIndex;
let childColumnId = '#dept-column-' + (colIndex + 1);
let firstColumnId = '#dept-column-0';
uni.createSelectorQuery().in(that).select(parentItemId).boundingClientRect(function(parentRect) {
if (!parentRect) return;
uni.createSelectorQuery().in(that).select(firstColumnId).boundingClientRect(function(firstRect) {
if (!firstRect) return;
//
let offset = parentRect.top - firstRect.top;
if (offset > 0) {
// padding-top使
let newPaddingTops = Object.assign({}, that.columnPaddingTops);
newPaddingTops[colIndex + 1] = offset;
that.columnPaddingTops = newPaddingTops;
}
}).exec();
}).exec();
//
navigateToDeptLevel(index) {
//
if (index === this.deptBreadcrumb.length - 1) return;
//
this.deptBreadcrumb = this.deptBreadcrumb.slice(0, index + 1);
let targetDept = this.deptBreadcrumb[this.deptBreadcrumb.length - 1];
this.currentDeptList = [].concat(targetDept.childs || []);
},
//
backToParentDept() {
if (this.deptBreadcrumb.length === 0) return;
this.deptBreadcrumb.pop();
if (this.deptBreadcrumb.length === 0) {
this.currentDeptList = [].concat(this.deptList || []);
} else {
let parentDept = this.deptBreadcrumb[this.deptBreadcrumb.length - 1];
this.currentDeptList = [].concat(parentDept.childs || []);
}
},
//
removeSelectedDept(index) {
this.selectedDeptIds.splice(index, 1);
this.selectedDeptNames.splice(index, 1);
},
//
submitDept() {
@ -1071,6 +1044,85 @@ export default {
display: flex;
flex-direction: column;
}
.dept-breadcrumb {
width: 100%;
box-sizing: border-box;
border-bottom: 1px solid #f5f5f5;
}
.dept-list-scroll {
flex: 1;
width: 100%;
-webkit-overflow-scrolling: touch;
}
.dept-list-item {
display: flex;
flex-direction: row;
align-items: stretch;
height: 56px;
}
.dept-checkbox-area {
width: 56px;
height: 56px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.dept-content-area {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #f5f5f5;
padding-right: 12px;
min-width: 0;
}
.dept-folder-icon {
margin-right: 10px;
}
.dept-folder-bg {
width: 40px;
height: 40px;
background-color: rgba(2, 122, 255, 0.1);
color: #1890ff;
border-radius: 50%;
}
.dept-folder-bg .iconfont {
font-size: 20px;
}
.dept-content-name {
color: #333;
font-size: 15px;
flex: 1;
}
.dept-content-arrow {
font-size: 16px;
color: #cccccc;
margin-left: 8px;
flex-shrink: 0;
}
.dept-selected-wrap {
width: 100%;
box-sizing: border-box;
background-color: #fafafa;
border-top: 1px solid #f0f0f0;
padding: 12rpx 24rpx;
}
.dept-selected-scroll {
max-height: 160rpx;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.dept-selected-tag {
background-color: #f0f2ff;
color: #6A81FF;
padding: 6rpx 16rpx;
border-radius: 8rpx;
margin-right: 12rpx;
margin-bottom: 12rpx;
max-width: 100%;
box-sizing: border-box;
}
.dept-columns-scroll {
white-space: nowrap;
overflow-x: auto;
@ -1094,11 +1146,7 @@ export default {
min-width: 100%;
}
.dept-column {
width: 30vw;
min-width: 180px;
max-width: 30vw;
height: 100%;
border-right: 1px solid #ddd;
box-sizing: border-box;
flex-shrink: 0;
flex-grow: 0;

@ -1,8 +1,8 @@
@font-face {
font-family: 'iconfont'; /* Project id 4374774 */
src: url('//at.alicdn.com/t/c/font_4374774_9mzefrjg1b8.woff2?t=1782283319059') format('woff2'),
url('//at.alicdn.com/t/c/font_4374774_9mzefrjg1b8.woff?t=1782283319059') format('woff'),
url('//at.alicdn.com/t/c/font_4374774_9mzefrjg1b8.ttf?t=1782283319059') format('truetype');
src: url('//at.alicdn.com/t/c/font_4374774_lku5sprfdq.woff2?t=1782301009487') format('woff2'),
url('//at.alicdn.com/t/c/font_4374774_lku5sprfdq.woff?t=1782301009487') format('woff'),
url('//at.alicdn.com/t/c/font_4374774_lku5sprfdq.ttf?t=1782301009487') format('truetype');
}
.iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-check-circle-fill:before {
content: "\e84d";
}
.icon-folder:before {
content: "\e7d2";
}
@ -1259,5 +1263,4 @@
.icon-leftArrows:before {
content: "\100c6";
}
}
Loading…
Cancel
Save