付延余
2022-07-26 7c3218e12105b87cab21e9ced57c99c339ffac10
pages/my-application/my-application.vue
@@ -1,8 +1,7 @@
<template>
   <!-- 我的申请 -->
   <view class="my-application">
   <view class="my-application" >
      <!-- 搜索区域 -->
      <view class="searchBox">
         <view class="topRow">
            <view class="search">
@@ -21,17 +20,17 @@
         </view>
         <!-- 时间选择器 -->
         <view class="example-body"><uni-datetime-picker v-model="range" type="daterange" @maskClick="maskClick" /></view>
         <view class="searchBtn"><u-button type="primary" text="搜索" @click="searchClick"></u-button></view>
         <view class="searchBtn"><u-button type="primary" text="搜索" @click="searchClick"></u-button> <u-button type="primary" :plain="true" text="清空" @click="emptyButtonClick"></u-button></view>
      </view>
      <!-- 选择器 -->
      <u-picker @cancel="dataSelectCancel" @confirm="selectConfirm" :show="selectPickerShow" :columns="selectList"></u-picker>
      <!-- 我的申请卡片区域 -->
      <u-checkbox-group v-model="checkBoxValue" placement="column" @change="checkboxChange" style="margin-bottom:50px">
      <!-- <u-checkbox-group v-model="checkBoxValue" placement="column" @change="checkboxChange" style="margin-bottom:150px"> -->
         <combination-card v-for="(item, index) in shenqingData" index="index">
            <template v-slot:top>
               <u-checkbox size="35" :key="item.id" :name="item.id"></u-checkbox>
               <!-- <u-checkbox size="35" :key="item.id" :name="item.id"></u-checkbox> -->
               <view>
                  <text>{{ item.title }}</text>
               </view>
@@ -72,23 +71,23 @@
                        <image src="@/static/home/cehui.png" mode=""></image>
                        <view>撤回</view>
                     </view>
                     <view @click="checkTheScheduleClick" v-if="item.status == 1">
                     <view @click="checkTheScheduleClick(item.procInstId)" v-if="item.status == 1">
                        <image src="@/static/home/jindu.png" mode=""></image>
                        <view>查看进度</view>
                     </view>
                     <view @click="theFormDataClick" v-if="item.status == 1 || item.status == 2">
                     <view @click="theFormDataClick(item.tableId)" v-if="item.status == 1 || item.status == 2">
                        <image src="@/static/home/biaodan.png" mode=""></image>
                        <view>表单数据</view>
                     </view>
                     <view v-if="item.status == 3">
                        <image src="@/static/home/history.png" mode="" ></image>
                     <view v-if="item.status == 3" @click="apply(item)">
                        <image src="@/static/home/history.png" mode=""></image>
                        <view>重新申请</view>
                     </view>
                     <view v-if="item.status == 3">
                        <image src="@/static/home/history.png" mode="" ></image>
                     <view v-if="item.status == 3" @click="editMyApplication(item)">
                        <image src="@/static/home/history.png" mode=""></image>
                        <view>编辑</view>
                     </view>
                     <view @click="approvalHistoryClick" v-if="item.status == 2 || item.status == 3">
                     <view @click="approvalHistoryClick(item.procInstId)" v-if="item.status == 2 || item.status == 3">
                        <image src="@/static/home/history.png" mode=""></image>
                        <view>审批历史</view>
                     </view>
@@ -96,7 +95,7 @@
               </view>
            </template>
         </combination-card>
      </u-checkbox-group>
      <!-- </u-checkbox-group> -->
      <!-- 撤回模态框 -->
      <view class="wodeshenqingMotai">
@@ -116,16 +115,20 @@
            @cancel="batchDeleteModalCancel"
         ></u-modal>
      </view>
      <view class="" style="height:50px;">
      </view>
      <!-- 底部全选 -->
      <view class="bottomTabbar">
         <view class="bottomTabbar_checkBox">
            <u-checkbox-group size="35" v-model="totalSelectValue" placement="column" @change="totalSelectChange">
          <view class="bottomTabbar_checkBox">
            <!-- <u-checkbox-group size="35" v-model="totalSelectValue" placement="column" @change="totalSelectChange">
               <u-checkbox labelSize="13px" label="全选" name="tatalSelect"></u-checkbox>
            </u-checkbox-group>
         </view>
            </u-checkbox-group> -->
         </view>
         <view class="bottomTabbar_button">
            <u-button :plain="true" type="primary" text="批量删除" @click="batchDeleteClick"></u-button>
            <!-- <u-button :plain="true" type="primary" text="批量删除" @click="batchDeleteClick"></u-button> -->
            <u-button type="primary" text="新增申请" @click="newApplicationClick"></u-button>
         </view>
      </view>
@@ -144,9 +147,9 @@
   data() {
      return {
         status: ['草稿', '处理中', '已结束', '已撤回'],
         statusColor: ['#bbbbbb', '#FF9900', '#007AFF', '#06BE00'],
         statusColor: ['#dd8b8c', '#FF9900', '#007AFF', '#06BE00'],
         result: ['未提交', '处理中', '通过', '驳回'],
         resultColor: ['#bbbbbb', '#FF9900', '#06BE00', '#be2b2d'],
         resultColor: ['#dd8b8c', '#FF9900', '#06BE00', '#be2b2d'],
         // 搜索区域
         selectText: '',
         // 选择器
@@ -163,6 +166,19 @@
            id: '', // 撤回申请ID
            procInstId: ''
         },
         // 重新申请
         form: {
            sendMessage: true,
            sendSms: true,
            sendEmail: true,
            procDefId: '',
            assignees: [],
            priority: '0'
         },
         assigneeList: [],
         showAssign: false,
         isGateway: false,
         isCustom: false,
         // 批量删除申请
         batchDeleteModalShow: false,
         // 复选框
@@ -198,6 +214,7 @@
      if (this.menuShow == true) {
         this.$refs.menuRef.menuClick();
      }
      this.myApplication.pageNumber = 1;
      this.init();
   },
   // 点击导航栏菜单后
@@ -234,6 +251,17 @@
         this.getMoreNews();
      }, 1000);
   },
   // 下拉加载
   onPullDownRefresh() {
      console.log('refresh');
      this.myApplication.pageNumber = 1;
      this.loadingType = 0;
      this.shenqingData = [];
      setTimeout(()=> {
         uni.stopPullDownRefresh();
      }, 1000);
      this.init();
   },
   methods: {
      init() {
         this.getMoreNews();
@@ -267,7 +295,12 @@
               return;
            }
            // this.myApplication.pageNumber++; // 每触底一次 page +1
            this.shenqingData = this.shenqingData.concat(response.data.records); //将数据拼接在一起
            if(this.myApplication.title||this.myApplication.status||this.myApplication.result||this.myApplication.startTime||this.myApplication.endTime){
               this.shenqingData = response.data.records
            } else{
               this.shenqingData = this.shenqingData.concat(response.data.records);
            }
             //将数据拼接在一起
            this.loadingType = 0; // 将loadingType归0重置
            uni.hideNavigationBarLoading(); // 关闭加载动画
         });
@@ -295,10 +328,16 @@
         console.log('maskClick事件:', e);
      },
      searchClick() {
         // if(this.myApplication.title || this.myApplication.status || this.myApplication.result ||  this.myApplication.startTime || this.myApplication.endTime){
         console.log('this.myApplication', this.myApplication);
         this.getProcessDataList();
         // }
         this.myApplication.pageNumber = 1;
         this.loadingType = 0;
         this.getMoreNews();
      },
      emptyButtonClick(){
         this.myApplication.title = '';
         this.selectText = '';
         this.range = [];
         this.init();
      },
      // 撤回模态框
      withDrawClick(id) {
@@ -311,19 +350,19 @@
               this.withDrawData.procInstId = i.procInstId;
            }
         });
         this.$reqPost('withDraw', this.withDrawData).then(res => {
         this.$reqPost('withDraw', this.withDrawData, 'form').then(res => {
            console.log('res', res);
            if (res.code == 0) {
               uni.showToast({
                  title: res.data,
                  duration: 2000
               });
               this.withDrawShow = false;
               // 初始化申请列表
               this.shenqingData = [];
               this.myApplication.pageNumber = 1;
               this.getMoreNews();
            }
            this.withDrawShow = false;
            // 初始化申请列表
            this.myApplication.pageNumber = 1;
            this.shenqingData = [];
            this.getMoreNews();
         });
         console.log(this.withDrawId);
@@ -338,6 +377,89 @@
      },
      withDrawCancel() {
         this.withDrawShow = false;
      },
      apply(v) {
         if (!v.procDefId || v.procDefId == 'null') {
            this.$u.toast('流程定义为空');
            return;
         }
         this.form.id = v.id;
         this.form.procDefId = v.procDefId;
         this.form.title = v.title;
         // 加载审批人
         // this.userLoading = true;
         uni.showLoading({
            title: '审批人加载中'
         });
         // getFirstNode(v.procDefId).then((res) => {
         this.$reqGet('getFirstNode', {}, v.procDefId).then(res => {
            // this.userLoading = false;
            console.log('审批人', res);
            uni.hideLoading();
            if (res.data) {
               this.error = '';
               if (res.data.type == 3 || res.data.type == 4) {
                  this.isGateway = true;
                  this.form.firstGateway = true;
                  this.showAssign = false;
                  this.isCustom = false;
                  return;
               }
               if (res.data.type == 5) {
                  this.isCustom = true;
                  this.isGateway = false;
                  this.form.firstGateway = false;
                  this.showAssign = false;
                  return;
               }
               if (res.data.type == 1) {
                  this.showAssign = true;
                  this.isGateway = false;
                  this.form.firstGateway = false;
                  this.isCustom = false;
                  if (res.data.users && res.data.users.length > 0) {
                     this.assigneeList = res.data.users;
                     // 默认勾选
                     let ids = [];
                     res.data.users.forEach(e => {
                        ids.push(e.userId);
                     });
                     this.form.assignees = ids;
                     this.showAssign = true;
                     // 获取表单内容,重新创建申请
                     this.$reqPost('apply',this.form,'form').then(res=>{
                        console.log('重新提交申请',res);
                        if(res.code == 0){
                           uni.showToast({
                              title:res.data,
                              icon:'success',
                              duration:2000
                           });
                        }
                        // 初始化申请列表
                        this.myApplication.pageNumber = 1;
                        this.shenqingData = [];
                        this.getMoreNews();
                     })
                  } else {
                     this.form.assignees = [];
                     this.showAssign = true;
                     this.error = '请进入"流程管理"为审批节点分配候选审批人员';
                  }
               }
            }
            console.log(this.form);
         });
         this.modalVisible = true;
      // }
      },
      // 修改申请
      editMyApplication(v){
         console.log('修改申请');
         uni.navigateTo({
            url: `/pages/edit-my-application/edit-my-application?index=${v.tableId}`
         });
      },
      // 批量删除模态框
      batchDeleteClick() {
@@ -369,21 +491,21 @@
         console.log('totalChange', n);
      },
      // 查看进度
      checkTheScheduleClick() {
      checkTheScheduleClick(v) {
         uni.navigateTo({
            url: '/pages/check-the-schedule/check-the-schedule'
            url: `/pages/check-the-schedule/check-the-schedule?index=${v}`
         });
      },
      // 表单数据
      theFormDataClick() {
      theFormDataClick(v) {
         uni.navigateTo({
            url: '/pages/the-form-data/the-form-data'
            url: `/pages/the-form-data/the-form-data?index=${v}`
         });
      },
      // 审批历史
      approvalHistoryClick() {
      approvalHistoryClick(v) {
         uni.navigateTo({
            url: '/pages/approval-history/approval-history'
            url: `/pages/approval-history/approval-history?index=${v}`
         });
      },
      // 新增申请