123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510 |
- <template>
- <view>
- <scroll-view scroll-x class="bg-white nav ">
- <cu-custom bgColor="bg-blue" :isBack="false">
- <block slot="backText">我的任务</block>
- <block slot="content"></block>
- <block slot="right">
- <view class=" flex justify-center">
- <button class="margin-top-ssm cu-btn round line-blue text-white" v-if="manage" @tap="manage = false">
- <text>取消多选</text>
- </button>
- <button @click="addTask()" v-else class="cu-btn round line-blue text-white" style="height: 66rpx;padding: 0 20rpx;"><text class="cuIcon-add"></text>新建任务</button>
- </view>
- </block>
- </cu-custom>
- <view class="nav_b">
- <view style="height:90rpx ;"></view>
- <view class="nav_b_1">
- <view :class="index==TabCur?'nav_one':'nav_1'" v-for="(item,index) in menuList" :key="index" @tap="tabSelect" :data-id="index">
- {{item.name}}
- <text v-if='index==0'>({{taskList.length}})</text>
- <text v-if='index==1'>({{taskInitiateList.length}})</text>
- <view :class="index==TabCur?'nav_zwf':''"></view>
- </view>
- </view>
- <!-- <view class="cu-item flex-sub" :class="index==TabCur?'text-blue':'text-no'" v-for="(item,index) in menuList" :key="index"
- @tap="tabSelect" :data-id="index">
- {{item.name}}
- <text v-if='index==0'>({{taskList.length}})</text>
- <text v-if='index==1'>({{taskInitiateList.length}})</text>
- <view :class="index==TabCur?'bottom_solid':''"></view>
- </view> -->
- </view>
- <view v-if="TabCur==0" @longtap="manage = true" class="cu-list menu-avatar list_b">
- <view class="cu-item_1" v-for="(item,index) in taskList" :key="item.id" @click="navToTaskDetails(item,0)">
- <view class="cu-item_left">
- <image v-if="item.task_category=='2'" src="../../static/task/report.png"></image>
- <image v-else-if="item.task_category=='3'|| item.task_category=='1'" src="../../static/task/audit.png"></image>
- <image v-else src="../../static/task/diy.png"></image>
- </view>
- <view :class="manage?'cu-item_right_sm':'cu-item_right'">
- <view class="cu-item_name">{{item.name}}</view>
- <view class="cu-item_start">
- <view class="cu-item_text"> 发起人:{{item.userName}}</view>
- <view class="cu-item_text">
- {{ item.start_date | timeStamp }}
- </view>
- </view>
- </view>
- <checkbox-group @change="CheckboxChange" @tap.stop :data-index="index" class="padding-left-sm">
- <checkbox class="sc75 blue" v-show="manage" :class="item.checked?'checked':''" :checked="item.checked?true:false"></checkbox>
- </checkbox-group>
- </view>
- <view v-if="taskList.length==0" class="bg-white text-center">
- <view>
- <image class="menuImageNoTask" src="../../static/task/noTask.png"></image>
- </view>
- <view style="padding:28rpx 0 132rpx;font-size: 26rpx;color: #8A8A8A;">暂时没有待办任务~</view>
- </view>
- <view v-if="taskList.length!=0" style="padding: 60rpx 0 160rpx;text-align: center;font-size: 26rpx;color: #AEAEAE;">没有更多内容了~</view>
- </view>
- <view v-else @longtap="manage = true" class="cu-list menu-avatar list_b">
- <view class="cu-item_1" v-for="(item,index) in taskInitiateList" :key="item.id" @click="navToTaskDetails(item,1)">
- <view class="cu-item_left">
- <image v-if="item.task_category=='2'" src="../../static/task/report.png"></image>
- <image v-else-if="item.task_category=='3' || item.task_category=='1'" src="../../static/task/audit.png"></image>
- <image v-else src="../../static/task/diy.png"></image>
- </view>
- <view :class="manage?'cu-item_right_sm':'cu-item_right'">
- <view class="cu-item_name">{{item.name}}</view>
- <view class="cu-item_start">
- <view v-if="item.task_status==0" class="cu-item_text"> 任务进度: 未完成</view>
- <view v-if="item.task_status==1" class="cu-item_text"> 任务进度: 已完成</view>
- <view v-if="item.task_status==-1" class="cu-item_text"> 任务进度: 审核未通过</view>
- <view v-if="item.task_status==2" class="cu-item_text"> 任务进度: 已废除</view>
- <view class="cu-item_text">{{ item.start_date | timeStamp }}</view>
- </view>
- </view>
- <checkbox-group @change="CheckboxChange" @tap.stop :data-index="index" class="padding-left-sm">
- <checkbox class="sc75 blue" v-show="manage" :class="item.checked?'checked':''" :checked="item.checked?true:false"></checkbox>
- </checkbox-group>
- </view>
- <view v-if="taskInitiateList.length==0" class="bg-white text-center">
- <view>
- <image class="menuImageNoTask" src="../../static/task/noTask.png"></image>
- </view>
- <view style="padding:28rpx 0 132rpx;font-size: 26rpx;color: #8A8A8A;">暂时没有发起任务~</view>
- </view>
- <view v-if="taskInitiateList.length!=0" style="padding: 60rpx 0 160rpx;text-align: center;font-size: 26rpx;color: #AEAEAE;">没有更多内容了~</view>
- </view>
-
- </scroll-view>
-
- <view class="botm padding bg-white flex justify-between" v-if="manage">
- <view>
- <checkbox-group @change="allChange">
- <checkbox class="sc75 blue" :class="isAll?'checked':''" :checked="isAll?true:false" value="all"></checkbox>
- <text class="padding-left-sm">全选</text>
- </checkbox-group>
- </view>
- <view>
- <button class="cu-btn round margin-right-sm bg-red" @tap="batchRepeal">批量废除</button>
- <button class="cu-btn round margin-right-sm" @tap="batchHandle">批量审批</button>
- <!-- <button class="cu-btn round bg-blue" ></button> -->
- </view>
- </view>
-
- <!-- 引入底部导航栏 -->
- <tabBar v-if="show" :pagePath="'/pages/task/task'"></tabBar>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- menuList: [{
- name: '待办任务'
- }, {
- name: '我发起的'
- }],
- title: "待办任务",
- taskList: [],
- taskInitiateList: [],
- TabCur: 0,
- scrollLeft: 0,
- show:false,//用于待办任务的数据统计才显示组件
-
- manage:false,
- isAll:false,
- checkList:[],
- signType:{
- isOpenSign:0,//合同是否开启电签,0关闭,1开启
- isPfxFile:'',//是否有证书文件,1有
- isPhone:'',//绑定的手机号,没有则没绑定
- },
- }
- },
- onLoad() {
- },
- onShow() {
- this.findTask();
- this.findTaskMyMission();
- },
- methods: {
- navToTaskDetails(item, value) {
- var type;
- if (item.task_category == 2) {
- type = 2 //填报任务类型
- } else if (item.task_category == 3) {
- type = 3 //审核任务类型
- } else if (item.task_category == 1) {
- type = 1 //上报类型
- }else{
- type=4 //自定义
- }
- uni.navigateTo({
- url: "/pages/task/details/details?type=" + type + "&value=" + value + "&taskId=" + item.id+ "&contractid=" +item.contract_info_id
- })
- },
- tabSelect(e) {
- if(this.manage){
- this.$prompt.none("多选状态中,请勿切换");
- return;
- }
-
- this.TabCur = e.currentTarget.dataset.id;
- this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
- },
- navTo(index) {
- if (index == 0) { //待办任务
- this.showValue = true;
- this.title = "待办任务";
- } else if (index == 1) { //发起任务
- this.showValue = false;
- this.title = "我发起的";
- } else if (index == 2) { //新建任务
- }
- },
- /* 查询待办任务 */
- findTask() {
- var that = this;
- var userInfo = uni.getStorageSync("userInfo");
- var project = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
- that.http.request('/app/task/findTaskComing', {
- userId: userInfo.id,
- contractId: project.contractId,
- projectid: project.id
- }).then((result) => {
- that.taskList = result.datas;
- that.tabberData.taskNum = that.taskList.length;
- that.show=true;
- if (!that.taskList) {
- that.taskList = []
- }
- })
- },
- /* 查询我发起的任务 */
- findTaskMyMission() {
- var that = this;
- var userInfo = uni.getStorageSync("userInfo")
- var porject = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
- that.http.request('/app/task/findTaskMyMission', {
- userId: userInfo.id,
- contractId: porject.contractId,
- projectid: porject.id
- }).then((result) => {
- that.taskInitiateList = result.datas;
- if (!that.taskInitiateList) {
- that.taskInitiateList = []
- }
- })
- },
- addTask() {
- uni.navigateTo({
- url: "createTask/createTask"
- })
- },
-
- //全选
- allChange(e){
- let values = e.detail.value;
- if(values.length>0){
- this.isAll = true;
- }else{
- this.isAll = false;
- }
- let list = [];
- if(this.TabCur == 0){
- list = this.taskList;
- }else if(this.TabCur == 1){
- list = this.taskInitiateList;
- }
- list.forEach((item)=>{
- this.$set(item,'checked',this.isAll);
- })
- },
-
- //点击单选
- CheckboxChange(e){
- let values = e.detail.value;
- let list = [];
- if(this.TabCur == 0){
- list = this.taskList;
- }else if(this.TabCur == 1){
- list = this.taskInitiateList;
- }
- let item = list[e.currentTarget.dataset.index];
- // console.log(e)
- // console.log(item)
- if(values.length>0){
- this.$set(item,'checked',true);
- }else{
- this.$set(item,'checked',false);
- }
- },
-
- //批量处理
- batchHandle() {
- if (!this.checkBatch()) {
- return;
- }
- let formDataIds = [];
- let contractIdList = [];
- this.checkList.forEach((item)=>{
- formDataIds.push(item.id);
- contractIdList.push(item.contract_info_id);
- })
- uni.navigateTo({
- url:"/pages/task/approvalTasks/approvalTasks?formDataIds="+formDataIds.join(',')+"&contractIdList="+contractIdList.join(',')+"&task_flow="+this.checkList[0].task_flow
- })
- },
-
- checkBatch() {
- let list = [];
- if(this.TabCur == 0){
- list = this.taskList;
- }else if(this.TabCur == 1){
- list = this.taskInitiateList;
- }
- this.checkList = [];
- list.forEach((item)=>{
- if(item.checked){
- this.checkList.push(item);
- }
- })
- if (this.checkList.length < 1) {
- this.$prompt.none("请至少勾选一条任务");
- return false;
- };
- let type = this.checkList[0].type;
- let flow = this.checkList[0].task_flow;
- let isCustom = false;//是否自定义流程
- if (flow == 1) {
- isCustom = true;
- }
- let isAll = true;
- for (let i = 0; i < this.checkList.length; i++) {
-
- if (this.checkList[i].sign_status == 1) {
- this.$prompt.none("选择的第" + (i + 1) + "条任务电签中,请检查");
- isAll = false;
- break;
- }
-
- if (this.checkList[i].task_category == 2) {
- this.$prompt.none("选择的第" + (i + 1) + "条任务为填报任务,无法审批");
- isAll = false;
- break;
- }
-
- if (this.checkList[i].type != type) {
- this.$prompt.none("只能批量处理任务类型相同的任务!");
- isAll = false;
- break;
- } else if (this.checkList[i].task_status != 0) {
- this.$prompt.none("选择的第" + (i + 1) + "条任务状态不正确,请检查");
- isAll = false;
- break;
- }
-
- if (isCustom) {
- if (this.checkList[i].task_flow != 1) {
- this.$prompt.none("只能批量处理流程类型相同的任务!");
- isAll = false;
- break;
- }
- } else {
- if (this.checkList[i].task_flow == 1) {
- this.$prompt.none("只能批量处理流程类型相同的任务!");
- isAll = false;
- break;
- }
- }
- }
-
- if (isAll) {
- return true;
- } else {
- return false;
- }
- },
-
- //批量废除任务
- batchRepeal(){
- let { account } = uni.getStorageSync('userInfo')
- if (!this.checkBatchRepeal()) {
- return;
- }
- let ids = [];
- this.checkList.forEach((item)=>{
- ids.push(item.id);
- })
- this.http.request('/app/task/batchRepeal', {
- opUserName: account ? account : '',
- taskId:ids.join(','),
- processId:"",
- cs:0,
- }).then((result) => {
- this.$prompt.none("废除成功");
- this.manage = false;
- this.isAll = false;
- this.checkList = [];
- this.findTask();
- this.findTaskMyMission();
- })
- },
- checkBatchRepeal(){
- let list = [];
- if(this.TabCur == 0){
- list = this.taskList;
- }else if(this.TabCur == 1){
- list = this.taskInitiateList;
- }
- this.checkList = [];
- list.forEach((item)=>{
- if(item.checked){
- this.checkList.push(item);
- }
- })
- if (this.checkList.length < 1) {
- this.$prompt.none("请至少勾选一条任务");
- return false;
- };
-
- let isAll = true;
- for (let i = 0; i < this.checkList.length; i++) {
- if (this.checkList[i].task_status != 0) {
- this.$prompt.none("选择的第" + (i + 1) + "条任务状态已完成,无法废除");
- isAll = false;
- break;
- }
- }
-
- if (isAll) {
- return true;
- } else {
- return false;
- }
- }
- },
- filters: {
- timeStamp: function(value) {
- if (!value) return '';
- var now = new Date(value);
- var year = now.getFullYear();
- var month = now.getMonth() + 1;
- if (month < 10) {
- month = '0' + month
- }
- var date = now.getDate();
- if (date < 10) {
- date = '0' + date
- }
- return year + "-" + month + "-" + date
- },
- },
- onHide() {
- this.show=false
- }
- }
- </script>
- <style lang="scss">
- .nav_b{z-index: 5;background: #fff;position: fixed;left: 0;top:var(--status-bar-height);width: 750rpx; padding: 0 130rpx;}
- .nav_b_1{display: flex;align-items: center;justify-content: space-between;height: 100rpx;width: 490rpx;}
- .nav_one{font-size: 30rpx;color: #0A8CD5;font-weight: bold;position: relative;width: 170rpx;text-align: center;}
- .nav_1{font-size: 30rpx;color: #101010;font-weight: bold;width: 170rpx;text-align: center;}
- .nav_zwf{width: 170rpx;height: 4rpx;background-color: #0A8CD5;position: absolute;bottom: -24rpx;left: 0;border-radius: 20rpx;}
- .list_b{padding-top: 100rpx;}
- page {
- background-color: white;
- }
- .box {
- margin-top: -20rpx;
- }
- .box view.cu-bar {
- margin-top: 20upx;
- }
- .page {
- height: 100Vh;
- width: 100vw;
- }
- .page.show {
- overflow: hidden;
- }
- .menuImage {
- height: 90rpx;
- width: 90rpx;
- }
- .cu-list.grid>.cu-item uni-text {
- display: block;
- margin-top: 4px;
- color: black;
- font-size: 14px;
- line-height: 17px;
- }
- .margin-bottom-big {
- margin-bottom: 150rpx;
- }
- .text-blue {
- position: relative;
- font-size: 30rpx;
- color: #0A8CD5;
- }
- .text-no {
- font-size: 30rpx;
- color: #101010;
- }
- .bottom_solid {
- height: 4rpx;
- background-color: #0A8CD5;
- position: absolute;
- bottom: 0;
- left: 96rpx;
- right: 96rpx;
- }
- .cu-item_1{display: flex;align-items: center;padding: 22rpx 24rpx;border-bottom: 2rpx solid #E3e1e1;}
- .cu-item_left{margin-right: 10rpx;}
- .cu-item_left image{width: 100rpx;height: 100rpx;}
- .cu-item_right{width: 592rpx;}
- .cu-item_right_sm{width: 530rpx;}
- .cu-item_name{font-size: 30rpx;color: #101010;overflow: hidden;text-overflow: ellipsis; -o-text-overflow: ellipsis;white-space:nowrap;}
- .cu-item_start{display: flex;align-items: center;justify-content: space-between;padding-top: 8rpx;}
- .cu-item_text{color: #8A8A8A;font-size: 26rpx;}
- .menuImageNoTask{width:162rpx;height: 105rpx;margin-top: 60rpx;}
-
- .botm{
- position: fixed;
- left: 0;
- bottom: 100rpx;
- width: 100%;
- box-shadow: 2px 2px 10px;
- }
- .sc75{
- transform: scale(0.75, 0.75);
- }
- </style>
|