<template>
|
<view class="uni-task-container"> <!-- :style="{height:safeAreaHeight+ 'px'}" -->
|
<!-- #ifdef MP-DINGTALK-->
|
<uni-nav-bar dark :fixed="true" shadow background-color="#007AFF" color="#fff" status-bar
|
:left-icon="apptype == 'HangChaTesting' ? '' : 'list'" right-icon="search" right-text="" left-text=""
|
:leftWidth="apptype == 'HangChaTesting' ? '0' : '24px'" rightWidth="24px" :title="navigationBarTitle"
|
@clickLeft="clickBarLeft" @clickRight="clickBarRight" @clickTitle="clickBarTitle">
|
<view class="uni-navbar-container-inner">
|
<text class="uni-nav-bar-text">{{navigationBarTitle }}</text>
|
</view>
|
<template v-slot:right>
|
<view v-if="!isTaskKanban" :style="{'color':isSearchMenuOpen?'#88ddff':'#fff'}"
|
class="uni-panel-bar-icon fu-list" size="22" />
|
|
</template>
|
</uni-nav-bar>
|
<!-- #endif-->
|
<!-- #ifdef MP-WEIXIN || MP-LARK -->
|
<uni-nav-bar :fixed="true" status-bar :left-icon="apptype == 'HangChaTesting' ? '' : 'list'" right-icon="search"
|
right-text="" left-text="" :leftWidth="apptype == 'HangChaTesting' ? '0' : '24px'" rightWidth="24px"
|
:title="navigationBarTitle" @clickLeft="clickBarLeft" @clickRight="clickBarRight"
|
@clickTitle="clickBarTitle">
|
<view class="uni-navbar-container-inner">
|
<text class="uni-nav-bar-text">{{navigationBarTitle }}</text>
|
</view>
|
<template v-slot:right>
|
<view>
|
<view v-if="!isTaskKanban" :style="{'color':isSearchMenuOpen?'#00aaff':'#333'}"
|
class="uni-panel-bar-icon fu-list" size="22" />
|
</view>
|
</template>
|
</uni-nav-bar>
|
<!-- #endif-->
|
<view class="uni-panel" :style="{'height':containerHeight + 'px;padding: 5px 0'}">
|
<taskLanban v-if="isTaskKanban" ref="refKanban" :listHeight="containerHeight"></taskLanban>
|
<taskList v-else ref="refTaskList" :title="taskListParam.title" :taskSql="taskListParam.sql"
|
:taskOrder="taskListParam.order" :taskType="taskListParam.type" :taskStatus="taskListParam.status">
|
</taskList>
|
</view>
|
<view class="uni-panel-button-add fs-CirclPlus" v-if="apptype != 'HangChaTesting'" @click="clickAddTask"
|
@touchstart='btnTouchStart' @touchmove='btnTouchMove'
|
:style="{transform:`translate(${btninfo.x}px,${btninfo.y}px) scale(1)`}"></view>
|
<view>
|
<!-- 普通弹窗 -->
|
<uni-popup ref="refPopupLeft" background-color="#fff">
|
<view class="popup-content"
|
:style="{'height':containerHeight + 'px;padding: 2px 4px 12px;margin-top:'+navigationBarHeight + 'px;'}">
|
<taskMenu style="display: flex;" :branchUsers="myBranchUsers" :auditTaskCount="auditTaskCnt"
|
@selTaskFactor="clickTaskFactor" @selTaskKanban="clickTaskKanban"></taskMenu>
|
</view>
|
</uni-popup>
|
<uni-popup ref="refPopupRight" background-color="#fff" @change="changeRightMenu">
|
<view class="popup-content2"
|
:style="{height:`${containerHeight}px`,padding:'2px 4px 12px','margin-top':`${navigationBarHeight}px`}">
|
<taskSearchMenu style="height:100%" :isOpen="isSearchMenuOpen" :taskSearchKey="taskSearchInfo.key"
|
:taskProjKey="taskSearchInfo.keyProj" :taskType="taskListParam.type"
|
:taskSort="taskSearchInfo.sort" :taskStatus="taskSearchInfo.status"
|
:taskQuadrant="taskSearchInfo.quadrant" @selTaskFactor="clickTaskSearch"></taskSearchMenu>
|
</view>
|
</uni-popup>
|
</view>
|
<view class="clearfix"></view>
|
</view>
|
</template>
|
|
<script>
|
import taskLanban from "./infos/kanban.vue"
|
import taskList from "./infos/list.vue"
|
import taskMenu from './infos/menu.vue'
|
import taskSearchMenu from './infos/menu-search.vue'
|
import TaskInit from "@/common/extend.js"
|
import Session from "@/common/utils.js"
|
import {
|
showModal,
|
showToast
|
} from "@/common/Page.js"
|
import {
|
getSubordinate,
|
} from "@/api/org.js"
|
export default {
|
components: {
|
taskList,
|
taskLanban,
|
taskMenu,
|
taskSearchMenu,
|
},
|
name: "pageTask",
|
data() {
|
return {
|
//safeAreaHeight:getApp().globalData.safeAreaHeight,
|
apptype: getApp().globalData.apptype,
|
isTaskKanban: false,
|
navigationBarHeight: 0,
|
containerHeight: 0,
|
navigationBarTitle: "看板",
|
taskListParam: {
|
title: "",
|
sql: "",
|
order: "",
|
type: "我的任务",
|
status: ["待完成"],
|
user: {}
|
},
|
|
myBranchUsers: [],
|
auditTaskCnt: 0,
|
btninfo: {
|
lx: 0,
|
ly: 0,
|
x: 0,
|
y: 0
|
},
|
isSearchMenuOpen: false,
|
taskSearchInfo: {},
|
};
|
},
|
methods: {
|
setData: function(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];
|
});
|
});
|
},
|
async clickBarLeft() {
|
if (this.apptype == 'HangChaTesting') {
|
return
|
}
|
this.$refs.refPopupRight.close()
|
this.$refs.refPopupLeft.open("left")
|
},
|
clickBarRight() {
|
// console.log("clickBarRight", this.taskSearchInfo)
|
//this.taskSearchInfo = Session.getValue('task_search')
|
|
this.$refs.refPopupLeft.close()
|
|
this.$refs.refPopupRight.open("right")
|
},
|
clickBarTitle() {
|
|
if (this.$refs.refPopupLeft.showPopup)
|
this.$refs.refPopupLeft.close()
|
if (this.$refs.refPopupRight.showPopup)
|
this.$refs.refPopupRight.close()
|
},
|
clickTaskKanban() {
|
|
var _this = this
|
_this.$refs.refPopupLeft.close()
|
if (_this.isTaskKanban) {
|
this.$refs.refKanban.initList()
|
} else {
|
_this.setData({
|
isTaskKanban: true,
|
navigationBarTitle: "看板"
|
})
|
}
|
let default_pageinfo = Session.getValue("page_task")
|
if (!default_pageinfo) {
|
default_pageinfo = {}
|
var pages = getCurrentPages()
|
default_pageinfo.pagePath = pages[0].route
|
}
|
default_pageinfo.isKanban = true
|
default_pageinfo.taskType = "",
|
Session.setValue("page_task", default_pageinfo)
|
},
|
clickTaskFactor(item) {
|
|
this.$refs.refPopupLeft.close()
|
let default_pageinfo = Session.getValue("page_task")
|
if (!default_pageinfo) {
|
default_pageinfo = {}
|
var pages = getCurrentPages()
|
default_pageinfo.pagePath = pages[0].route
|
|
}
|
default_pageinfo.isKanban = false
|
default_pageinfo.taskType = item.type,
|
Session.setValue("page_task", default_pageinfo)
|
const user = {
|
id: item.userId || "",
|
name: item.userName || "",
|
}
|
const {
|
sql,
|
order,
|
title
|
} = this.getTaskQuerySql(item.type, item.status, [], -1, "", "", user)
|
this.setData({
|
isTaskKanban: false,
|
taskListParam: {
|
title,
|
sql,
|
order,
|
type: item.type,
|
status: item.status,
|
user: user
|
},
|
navigationBarTitle: title
|
})
|
if (this.taskSearchInfo) {
|
let searchInfo = this.taskSearchInfo
|
searchInfo.status = item.status
|
searchInfo.quadrant = []
|
searchInfo.key = ""
|
searchInfo.keyProj = ""
|
searchInfo.sort = -1
|
|
this.setData({
|
taskSearchInfo: searchInfo
|
})
|
}
|
},
|
getTaskQuerySql(type, status, quadrants, sort, keyConent, keyProj, user) {
|
let sqlStatus = ""
|
let sqlUser = ""
|
let order = ""
|
let sql = ""
|
let title = ""
|
let titleStatus = ""
|
|
const app = getApp()
|
const token = app.globalData.userdata.user_login;
|
if (type != "需要我审核的") {
|
order = " CN_T_CREATE desc";
|
if (Array.isArray(status)) {
|
if (status.length > 0) {
|
let sqlStatusTemp = ""
|
for (let i = 0; i < status.length; i++) {
|
|
titleStatus = status[i]
|
let sqlTemp = ""
|
if (status[i] == "未读") {
|
sqlTemp = "CN_S_STATE ='未读'"
|
} else if (status[i] == "待完成" || status[i] == "未完成") {
|
sqlTemp = "(CN_S_STATE ='未读' OR CN_S_STATE = '已读' OR CN_S_STATE = '执行')"
|
} else if (status[i] == "已提交" || status[i] == "提交") {
|
sqlTemp = "CN_S_STATE ='提交'"
|
} else if (status[i] == "已完成" || status[i] == "完成") {
|
sqlTemp = "CN_S_STATE ='完成'"
|
} else if (status[i] == "已超期" || status[i] == "延期") {
|
sqlTemp =
|
" ((CN_S_STATE ='未读' OR CN_S_STATE = '已读' OR CN_S_STATE = '执行') AND CN_N_GAP_DAY>0)"
|
} else if (status[i] == "已退回" || status[i] == "退回") {
|
sqlTemp = "CN_S_STATE ='退回'"
|
} else if (status[i] == "全部") {
|
sqlStatusTemp = ""
|
titleStatus = ""
|
break;
|
} else {
|
sqlTemp = "CN_S_STATE ='" + status[i] + "'"
|
}
|
if (sqlTemp != "") {
|
if (sqlStatusTemp != "") {
|
sqlStatusTemp += " OR "
|
}
|
sqlStatusTemp += sqlTemp
|
}
|
}
|
if (sqlStatusTemp != "")
|
sqlStatus = `CN_N_TASK_TYPE <> 3 AND CN_N_STATE < 100 AND (${sqlStatusTemp})`;
|
}
|
}
|
if (sqlStatus == "")
|
sqlStatus = `CN_N_TASK_TYPE <> 3 AND CN_N_STATE < 100`;
|
} else {
|
order = "CN_T_SUBMIT Desc";
|
}
|
let sqlQuadrant = ""
|
if (Array.isArray(quadrants)) {
|
if (quadrants.length > 0) {
|
let sqlQuadrantTemp = ""
|
for (let i = 0; i < quadrants.length; i++) {
|
|
let nQuadrant = quadrants[i]
|
let sqlTemp = `CN_N_QUADRANT ='${nQuadrant}'`;
|
if (sqlQuadrantTemp != "") {
|
sqlQuadrantTemp += " OR "
|
}
|
sqlQuadrantTemp += sqlTemp
|
}
|
sqlQuadrant = `(${sqlQuadrantTemp})`;
|
}
|
}
|
if (sort == 0) {
|
order = "CN_N_QUADRANT Desc";
|
} else if (sort == 1) {
|
order = "CN_T_PLAN_START Asc";
|
} else if (sort == 2) {
|
order = "CN_T_PLAN_START Desc";
|
} else if (sort == 3) {
|
order = "CN_D_PLAN_DUE Desc";
|
} else if (sort == 4) {
|
order = "CN_T_CREATE Asc";
|
} else if (sort == 5) {
|
order = "CN_T_CREATE Desc";
|
} else if (sort == 6) {
|
order = "CN_T_SUBMIT Asc";
|
} else if (sort == 7) {
|
order = "CN_T_SUBMIT Desc";
|
}
|
title = type + (titleStatus ? `(${titleStatus})` : "");
|
if (type == "我创建的") {
|
sqlUser = "CN_S_CREATOR_ID='" + token + "'";
|
} else if (type == "我负责的") {
|
sqlUser = "CN_S_PIC ='" + token + "' ";
|
} else if (type == "我相关的") {
|
sqlUser = " CN_S_REL_PERSONS LIKE '%%\"id\": \"" + token + "\"%%' ";
|
} else if (type == "需要我审核的") {
|
title = "需我审核的任务";
|
sql = " pt.CN_S_EXEC_STATUS <> '完成' and pt.CN_S_EXECUTOR_ID='" + token +
|
"' and t.CN_S_STATE='提交' and t.CN_N_STATE < '100'"; //"CN_S_STATE = '提交' And CN_S_CHECKER = '" + state.token + "'";
|
sqlStatus = ""
|
if (keyConent != "")
|
sql += " AND task.CN_S_NAME LIKE '%%" + keyConent + "%%' ";
|
if (sqlQuadrant != "")
|
sql += " AND " + sqlQuadrant
|
if (keyProj != "")
|
sql += " AND CN_S_PRJ_NAME LIKE '%%" + keyProj + "%%' ";
|
return {
|
sql,
|
order: `t.${order}`,
|
title
|
}
|
|
} else if (type == "下属任务") {
|
title = user.name + '的任务';
|
sqlUser = " CN_S_TAKEON_ID ='" + user.id + "' ";
|
|
} else {
|
title = type + (titleStatus ? `(${titleStatus})` : "");
|
sqlUser = " CN_S_TAKEON_ID ='" + token + "' ";
|
}
|
|
sql = sqlUser
|
|
if (sqlStatus != "")
|
sql = sqlStatus + " AND " + sqlUser
|
if (keyConent != "")
|
sql += " AND CN_S_NAME LIKE '%%" + keyConent + "%%' ";
|
if (sqlQuadrant != "")
|
sql += " AND " + sqlQuadrant
|
if (keyProj != "")
|
sql += " AND CN_S_PRJ_NAME LIKE '%%" + keyProj + "%%' ";
|
return {
|
sql,
|
order,
|
title
|
}
|
|
|
},
|
|
clickTaskSearch(item) {
|
|
this.$refs.refPopupRight.close()
|
|
this.taskSearchInfo = item
|
//console.log("tasks clickTaskSearch",this.taskSearchInfo )
|
const {
|
sql,
|
order,
|
title
|
} = this.getTaskQuerySql(this.taskListParam.type, item.status, item.quadrant, item.sort, item.key, item
|
.keyProj, this.taskListParam.user)
|
const param = {
|
title,
|
sql,
|
order,
|
type: this.taskListParam.type,
|
status: item.status,
|
user: this.taskListParam.user
|
}
|
this.setData({
|
isTaskKanban: false,
|
taskListParam: param,
|
navigationBarTitle: title
|
})
|
},
|
btnTouchStart(e) {
|
this.btninfo.lx = e.touches[0].clientX;
|
this.btninfo.ly = e.touches[0].clientY;
|
},
|
btnTouchMove(e) {
|
this.btninfo.x += (e.touches[0].clientX - this.btninfo.lx)
|
this.btninfo.y += (e.touches[0].clientY - this.btninfo.ly)
|
this.btninfo.lx = e.touches[0].clientX;
|
this.btninfo.ly = e.touches[0].clientY;
|
Session.setValue('task_btninfo', this.btninfo)
|
},
|
clickAddTask() {
|
uni.navigateTo({
|
url: '/pages/task/create'
|
})
|
},
|
changeRightMenu(evt) {
|
// console.log("changeRightMenu", evt)
|
this.isSearchMenuOpen = evt.show
|
},
|
showError(ex) {
|
let tip = typeof ex === 'string' ? ex : (ex.message || ex.err_msg || ex.errMsg || ex.err_info || "")
|
showModal(tip, "提示", false)
|
},
|
},
|
onTabItemTap(item) {
|
let default_pageinfo = {}
|
default_pageinfo.pagePath = item.pagePath
|
Session.setDefaultPageInfo(default_pageinfo)
|
|
getSubordinate().then((res) => {
|
this.myBranchUsers = res ? res.user_list : []
|
})
|
|
},
|
onPullDownRefresh() {
|
if (this.taskListParam.sql) {
|
if (this.$refs.refTaskList)
|
this.$refs.refTaskList.onRefresh()
|
}
|
uni.stopPullDownRefresh()
|
},
|
onLoad() {
|
const res = uni.getSystemInfoSync();
|
// #ifdef MP-DINGTALK || MP-WEIXIN
|
this.navigationBarHeight = res.statusBarHeight + res.titleBarHeight
|
if (res.platform == "devtools")
|
this.containerHeight = res.windowHeight
|
else
|
this.containerHeight = res.windowHeight - this.navigationBarHeight
|
// #endif
|
// #ifndef (MP-DINGTALK || MP-WEIXIN)
|
this.containerHeight = res.windowHeight - 50 - res.statusBarHeight;
|
if (res.windowHeight == res.screenHeight)
|
this.containerHeight -= 50;
|
this.navigationBarHeight = res.statusBarHeight + 50
|
// #endif
|
this.containerHeight -= 10
|
let btninfo = Session.getValue('task_btninfo')
|
if (btninfo) {
|
|
if (btninfo.x > 10) {
|
btninfo.x = 10
|
}
|
if (btninfo.x > 40) {
|
btninfo.x = 40
|
}
|
this.btninfo = btninfo
|
}
|
let default_pageinfo = Session.getValue("page_task")
|
let typeTask = "我的任务"
|
let tmpStatus = ['待完成']
|
default_pageinfo = {}
|
var pages = getCurrentPages()
|
default_pageinfo.pagePath = pages[0].route
|
Session.setDefaultPageInfo(default_pageinfo)
|
const {
|
sql,
|
order,
|
title
|
} = this.getTaskQuerySql(typeTask, tmpStatus, [], -1, "", "", {
|
id: "",
|
name: ""
|
})
|
this.setData({
|
isTaskKanban: false,
|
taskListParam: {
|
title,
|
sql,
|
order,
|
type: typeTask,
|
status: tmpStatus,
|
user: {
|
id: "",
|
name: "",
|
}
|
},
|
navigationBarTitle: title
|
})
|
},
|
setup() {},
|
}
|
</script>
|
|
<style lang="scss">
|
page {
|
background-color: #f3f6f7;
|
}
|
|
.uni-task-container {
|
height: 100vh;
|
width: 750rpx;
|
font-size: 14px;
|
|
|
.uni-navbar-container-inner {
|
display: flex;
|
flex: 1;
|
flex-direction: row;
|
align-items: center;
|
font-size: 16px;
|
overflow: hidden;
|
|
/* #ifdef MP-DINGTALK */
|
font-weight: 600;
|
color: #fff;
|
/* #endif */
|
/* #ifdef MP-WEIXIN || MP-LARK */
|
justify-content: center;
|
color: #333;
|
/* #endif */
|
}
|
|
.uni-nav-bar-text {
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
}
|
|
.uni-panel {
|
background-color: #e8ebec;
|
}
|
|
.uni-panel-body {
|
height: 100%;
|
}
|
|
.clearfix {
|
content: " ";
|
box-sizing: border-box;
|
}
|
|
.uni-panel-task-condition {
|
display: flex;
|
flex-direction: row !important;
|
align-items: center !important;
|
padding: 8px 10px 8px 12px;
|
font-size: 14px;
|
}
|
|
.uni-panel-text {
|
flex: 1;
|
color: #000000;
|
font-weight: normal;
|
}
|
|
.uni-panel-bar-icon {
|
font-weight: normal;
|
font-size: 20px;
|
color: #505050;
|
cursor: pointer;
|
}
|
|
.uni-panel-down-arrow {
|
margin-left: 8px;
|
margin-top: 5px;
|
border: 7px solid #ffffff;
|
border-color: transparent;
|
border-top-color: #000000
|
}
|
|
.popup-content {
|
display: flex;
|
justify-content: center;
|
flex-direction: column;
|
background-color: transparent;
|
}
|
|
.popup-content2 {
|
display: flex;
|
flex-direction: column;
|
background-color: transparent;
|
}
|
|
.uni-panel-radius2 {
|
display: flex;
|
margin: 0px 8px 0px 2px;
|
width: 16px;
|
height: 16px;
|
border-radius: 5px;
|
background-color: #000;
|
}
|
|
.uni-panel-button-add {
|
font-size: 40px;
|
border-radius: 50%;
|
position: fixed;
|
z-index: 15;
|
bottom: 40px;
|
right: 10px;
|
color: #00aaff;
|
background: #fff;
|
box-shadow: 0 1px 5px 2px rgb(0 0 0 / 30%);
|
}
|
|
.uni-navbar__header {
|
/* #ifdef MP-WEIXIN || MP-DINGTALK */
|
padding-right: 112px !important;
|
/* #endif */
|
/* #ifdef MP-LARK */
|
padding-right: 75px !important;
|
/* #endif */
|
}
|
}
|
</style>
|