<template>
|
<view class="uni-project-event-task-user-set">
|
|
<view class="uni-panel-h2" style="padding: 2px 10px 2px 12px;">
|
<text class="uni-panel-text">执行人:</text>
|
<view class="uni-panel-user-item" style="margin: 0;">
|
<image :src="takeon.img" />
|
<text>{{takeon.name}}</text>
|
</view>
|
<text class="uni-panel-icon fs-add_circle blue-text" @click="clickExecuteUser"></text>
|
</view>
|
<view class="uni-panel-h2" style="padding: 2px 10px 2px 12px;">
|
<text class="uni-panel-text">审核人:</text>
|
<view class="uni-panel-user-item" style="margin: 0;" v-for="(item,index) in auditorSet" :key="item.login"
|
@longpress="longPressConfirmUser(item,index)">
|
<image :src="item.img" />
|
<text>{{item.name}}</text>
|
</view>
|
<text class="uni-panel-icon fs-add_circle blue-text" @click="clickConfirmUser"></text>
|
</view>
|
<button id='ok' type="primary" @tap="onOk" class="btn_ok">确定</button>
|
<button id='ok' type="default" @tap="onCancel" class="btn_cancel">取消</button>
|
</view>
|
</template>
|
|
<script>
|
import Session from "@/common/utils.js"
|
export default {
|
name: "pageProjectEventTaskUserSet",
|
data() {
|
return {
|
takeon: {
|
login: "",
|
name: ""
|
},
|
auditorSet: []
|
}
|
},
|
methods: {
|
setData(obj) {
|
let that = this;
|
let keys = [];
|
let val, data;
|
|
Object.keys(obj).forEach(function(key) {
|
keys = key.split(".");
|
val = obj[key];
|
data = that.$data;
|
keys.forEach(function(key2, index) {
|
if (index + 1 == keys.length) {
|
that.$set(data, key2, val);
|
} else {
|
if (!data[key2]) {
|
that.$set(data, key2, {});
|
}
|
}
|
data = data[key2];
|
});
|
});
|
},
|
onCancel() {
|
uni.navigateBack({
|
delta: 1
|
})
|
},
|
onOk() {
|
const eventChannel = this.getOpenerEventChannel();
|
eventChannel.emit('selTaskUserOk', this.takeon, this.auditorSet);
|
uni.navigateBack({
|
delta: 1
|
})
|
},
|
clickExecuteUser() {
|
const _this = this
|
uni.navigateTo({
|
url: "/pages/org/selpsn?multiselect=false&title=选择执行人",
|
events: {
|
selPsnOk: function(data) {
|
if (data.length > 0) {
|
_this.setData({
|
takeon: {
|
login: data[0].login,
|
name: data[0].name
|
}
|
})
|
}
|
}
|
}
|
})
|
},
|
clickConfirmUser() {
|
const _this = this
|
uni.navigateTo({
|
url: "/pages/org/selpsn?multiselect=false&title=选择审核人",
|
events: {
|
selPsnOk: function(data) {
|
if (data.length > 0) {
|
const list = _this.auditorSet
|
data.forEach((item) => {
|
|
let curIndex = list.findIndex((param, index, arr) => {
|
return param.login == item.login;
|
})
|
if (curIndex < 0) {
|
list.push(item)
|
}
|
})
|
_this.setData({
|
auditorSet: list
|
})
|
}
|
}
|
}
|
})
|
},
|
longPressConfirmUser(item, index) {
|
this.auditorSet.splice(index, 1)
|
},
|
userImgUrl(userID) {
|
return `${getApp().globalData.apiurl.org}/userphoto?login=${userID}`;
|
},
|
|
},
|
onLoad(option) {
|
// #ifdef MP-DINGTALK
|
|
my.setNavigationBar({
|
backgroundColor: "#007AFF",
|
frontColor: "#ffffff"
|
})
|
// #endif
|
this.takeon = {
|
login: option.takeon,
|
name: option.takeonName,
|
img: this.userImgUrl(option.takeon)
|
},
|
this.auditorSet = [{
|
login: option.auditor,
|
name: option.auditorName,
|
img: this.userImgUrl(option.auditor)
|
}]
|
},
|
|
}
|
</script>
|
|
<style lang="scss">
|
.uni-project-event-task-user-set {
|
display: flex;
|
width: 750rpx;
|
flex-direction: column !important;
|
|
.uni-panel-h2 {
|
display: flex;
|
background-color: #ffffff;
|
flex-direction: row !important;
|
align-items: center !important;
|
margin: 0px;
|
padding: 12px 10px 12px 12px;
|
font-size: 14px;
|
border-bottom: 1px solid #e8eaec;
|
}
|
|
.uni-panel-c {
|
background-color: #ffffff;
|
align-items: center !important;
|
padding: 4px 8px;
|
font-size: 14px;
|
}
|
|
.uni-panel-text {
|
flex: 1;
|
color: #000000;
|
font-weight: normal;
|
|
.uni-panel-icon {
|
padding: 0 6px;
|
font-size: 20px;
|
}
|
}
|
|
.uni-panel-h {
|
display: flex;
|
flex-direction: row !important;
|
align-items: center !important;
|
padding: 12px 10px 12px 12px;
|
font-size: 14px;
|
}
|
|
.uni-panel-icon {
|
padding: 4px 6px;
|
color: #999999;
|
font-weight: normal;
|
transition-duration: 0s;
|
font-size: 20px;
|
transition-property: transform;
|
}
|
|
.uni-panel-h2 .uni-panel-text {
|
flex: 1;
|
color: #000000;
|
font-weight: normal;
|
}
|
|
.uni-panel-h2 input {
|
flex: 5;
|
color: #000000;
|
font-weight: normal;
|
}
|
|
.uni-panel-icon-btn {
|
padding: 10px;
|
font-size: 18px;
|
border: 1px solid #aaa;
|
border-radius: 8px;
|
margin-left: 5px;
|
|
:active {
|
background-color: #e5eaee;
|
color: #007aff;
|
}
|
}
|
|
.uni-panel-user-item {
|
margin: 4px;
|
display: flex;
|
flex-direction: column;
|
height: 50px;
|
width: 50px;
|
}
|
|
.uni-panel-user-item image {
|
margin: 2px 8px;
|
height: 32px;
|
width: 32px;
|
border-radius: 16px;
|
}
|
|
.uni-panel-user-item text {
|
width: 50px;
|
height: 18px;
|
text-align: center;
|
font-size: 12px;
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: clip;
|
}
|
|
button.btn_ok {
|
width: 80%;
|
padding: 20rpx;
|
line-height: 1.5;
|
margin: auto;
|
margin-top: 50rpx;
|
}
|
button.btn_cancel {
|
margin: auto;
|
margin-top: 50rpx;
|
width: 80%;
|
padding: 20rpx;
|
line-height: 1.5;
|
border: 1px solid #dcdee2;
|
|
}
|
}
|
</style>
|