819527061@qq.com
2023-12-01 c56e67c77e2a36c894346830c1ab1e6df36fe935
pages/home/home.vue
@@ -2,16 +2,12 @@
   <view class="home">
      <!-- 轮播图 -->
      <view class="home_swipe"><u-swiper :list="list3" indicator indicatorMode="line" circular></u-swiper></view>
      <!-- 图表 -->
      <combined-title title="煤仓库存明细"></combined-title>
      <view class="charts-box">
         <qiun-data-charts type="pie" :opts="opts" :chartData="chartData" v-if="uchartsData.length > 0" />
         <u-empty
                 mode="data"
                 icon="http://cdn.uviewui.com/uview/empty/data.png"
                     v-if="uchartsData.length == 0"
         >
         </u-empty>
         <u-empty mode="data" iconSize="200" textSize="25" width="350" height="350" icon="http://cdn.uviewui.com/uview/empty/data.png" v-if="uchartsData.length == 0"></u-empty>
      </view>
      <!-- 我的申请 -->
      <combined-title title="我的申请" detailsPath="/pages/my-application/my-application" v-if="shenqingMenu"></combined-title>
@@ -54,30 +50,34 @@
               <view class="bottom-container">
                  <!-- 按钮区域 -->
                  <view class="bottom-content__chulizhong bottom-content__item">
                     <view @click="withDrawClick(item.id)" v-if="item.status == 1">
                     <!-- <view @click="withDrawClick(item.procInstId)" v-if="item.status == 1">
                        <image src="@/static/home/cehui.png" mode=""></image>
                        <view>撤回</view>
                     </view>
                     <view @click="checkTheScheduleClick(item.procInstId)" v-if="item.status == 1">
                     </view> -->
                     <view @click="() => checkTheScheduleClick(item.procInstId)" v-if="item.status == 1">
                        <image src="@/static/home/jindu.png" mode=""></image>
                        <view>查看进度</view>
                     </view>
                     <view @click="theFormDataClick(item.tableId)" v-if="(item.status == 1 || item.status == 2) && (item.procDefId == 'WAY_BILL:4:87504')">
                     <view @click="() => shenqingDetail(item)" v-if="item.actType == 'Offsetting' || item.actType == 'XsWaybill'">
                        <image src="@/static/home/biaodan.png" mode=""></image>
                        <view>表单数据</view>
                        <view>申请详情</view>
                     </view>
                     <view @click="apply(item)" v-if="item.status == 3">
                     <!-- <view @click="apply(item)" v-if="item.status == 3">
                        <image src="@/static/home/history.png" mode=""></image>
                        <view>重新申请</view>
                     </view>
                     <view @click="editMyApplication(item)" v-if="item.status == 3 && item.procDefId == 'WAY_BILL:4:87504'">
                     </view> -->
                     <!-- <view @click="editMyApplication(item)" v-if="item.status == 1 && item.processName == '发运通知单'">
                        <image src="@/static/home/history.png" mode=""></image>
                        <view>编辑</view>
                     </view>
                     <view @click="approvalHistoryClick(item.procInstId)" v-if="item.status == 2 || item.status == 3">
                     </view> -->
                     <view @click="() => checkTheScheduleClick(item.procInstId)" v-if="item.status !== 1">
                        <image src="@/static/home/history.png" mode=""></image>
                        <view>审批历史</view>
                     </view>
                     <!-- <view @click="deleteWithDrawApplication(item.tableId)" v-if="item.status == 3">
                        <image src="@/static/home/delete.png" mode=""></image>
                        <view>删除</view>
                     </view> -->
                  </view>
                  <!-- 已结束小组按钮 -->
                  <!-- <view class="bottom-content__chulizhong bottom-content__item" v-if="item.status == 2">
@@ -96,12 +96,12 @@
      <combined-title title="我的待办" detailsPath="/pages/my-todo/my-todo"></combined-title>
      <view class="card-group">
         <combination-card class="card" v-for="(item, index) in daibanData" index="index">
            <template v-slot:top>
            <template slot="top">
               <view>
                  <text>{{ item.actBusiness.title }}</text>
               </view>
            </template>
            <template v-slot:center>
            <template slot="center">
               <view class="center-container">
                  <view class="center-content__one center-margin">
                     <view class="">
@@ -120,23 +120,23 @@
                  </view>
               </view>
            </template>
            <template v-slot:bottom>
            <template slot="bottom">
               <view class="bottom-container">
                  <!-- 待办按钮 -->
                  <view class="bottom-content__item">
                     <!-- <view @click="theFormDataClick">
                <image src="@/static/home/jindu.png" mode=""></image>
                <view>申请详情</view>
              </view> -->
                     <view @click="adopClick(item)">
                     <view @click="() => daibanDetail(item)" v-if="item.actBusiness.actType == 'Offsetting' || item.actBusiness.actType == 'XsWaybill'">
                        <image src="@/static/home/jindu.png" mode=""></image>
                        <view>申请详情</view>
                     </view>
                     <view @click="() => adopClick(item)">
                        <image src="@/static/home/tongguo.png" mode=""></image>
                        <view>通过</view>
                     </view>
                     <view @click="rejectClick(item)">
                     <view @click="() => rejectClick(item)">
                        <image src="@/static/home/bohui.png" mode=""></image>
                        <view>驳回</view>
                     </view>
                     <view @click="approvalHistoryClick(item.procInstId)">
                     <view @click="() => checkTheScheduleClick(item.procInstId)">
                        <image src="@/static/home/history.png" mode=""></image>
                        <view>历史</view>
                     </view>
@@ -156,7 +156,7 @@
               </view>
            </template>
            <template v-slot:center>
               <view class="center-container">
               <view class="center-container" @click="() => shenqingDetail(item)">
                  <view class="center-content__one center-margin">
                     <view>
                        <text>任务名称:{{ item.name }}</text>
@@ -167,7 +167,7 @@
                  </view>
                  <view class="center-content__two center-margin">
                     <view>
                        <text>发起人:{{ item.actBusiness.createByName }}</text>
                        <text>发起人:{{ item.actBusiness.createByName || '' }}</text>
                     </view>
                     <view>
                        <text>审批操作:{{ item.deleteReason }}</text>
@@ -175,7 +175,7 @@
                  </view>
                  <view class="center-content__three center-margin">
                     <view class="">
                        <text>审批意见:{{ item.comment || '' }}</text>
                        <text>审批意见:{{ item.comment == 'undefined' ? '未填写' : item.comment || '未填写' }}</text>
                     </view>
                     <view class="">
                        <text>
@@ -198,11 +198,15 @@
               <view class="bottom-container">
                  <!-- 已办按钮 -->
                  <view class="bottom-content__item">
                     <view @click="theFormDataClick(item.tableId)" v-if="item.procDefId == 'WAY_BILL:4:87504'">
                     <view @click="() => shenqingDetail(item)" v-if="item.processName == '发运通知单'">
                        <image src="@/static/home/biaodan.png" mode=""></image>
                        <view>表单数据</view>
                     </view>
                     <view @click="approvalHistoryClick(item.procInstId)">
              <view @click="() => daibanDetail(item)"  v-if="item.actBusiness.actType == 'Offsetting' || item.actBusiness.actType == 'XsWaybill'">
                <image src="@/static/home/jindu.png" mode=""></image>
                <view>详情</view>
              </view>
                     <view @click="() => checkTheScheduleClick(item.procInstId)">
                        <image src="@/static/home/history.png" mode=""></image>
                        <view>审批历史</view>
                     </view>
@@ -218,7 +222,7 @@
      <!-- 日计划 -->
      <combined-title title="日发运计划" detailsPath="/pages/jihua/jihua" v-if="rijihuaMenu"></combined-title>
      <view class="card-group">
      <view class="card-group bottomChild">
         <combination-card class="card" :showTop="false" v-for="(item, index) in fyData.slice(0, 2)" :key="item.id" v-if="rijihuaMenu">
            <template v-slot:top></template>
            <template v-slot:center>
@@ -249,8 +253,11 @@
      <!-- 撤回模态框 -->
      <view class="wodeshenqingMotai">
         <u-modal width="684rpx" :show="withDrawShow" title="撤回原因" :showCancelButton="true" @confirm="withDrawConfirm" @cancel="withDrawCancel">
            <view class="slot-content"><u--textarea v-model="withDrawData.reason" placeholder="请输入撤回原因"></u--textarea></view>
         <u-modal width="684rpx" :show="withDrawShow" title="提示" :showCancelButton="true" @confirm="withDrawConfirm" @cancel="withDrawCancel">
            <view class="slot-content">
               <!-- <u--textarea v-model="withDrawData.reason" placeholder="请输入撤回原因"></u--textarea> -->
               <text>确认撤回该申请吗?</text>
            </view>
         </u-modal>
      </view>
@@ -306,6 +313,20 @@
      <!-- 菜单栏 -->
      <!-- <popup-menu @menuShow="menushow" ref="menuRef"></popup-menu> -->
      <u-gap height="15" bgColor="#eeeeee"></u-gap>
      <view class="utils">
         <view class="utils-container">
            <view class="utils-container-body" @click="redirectLogin">
               <view class="top"><u-icon name="backspace" color="#FF4233" size="70"></u-icon></view>
               <view class="bottom-text"><text>退出</text></view>
            </view>
            <!-- <view class="utils-container-body" @click="huanBang">
               <view class="top"><u-icon name="lock-open" color="#1987FF" size="70"></u-icon></view>
               <view class="bottom-text"><text>换绑</text></view>
            </view> -->
         </view>
      </view>
      <u-gap height="60" bgColor="#eeeeee"></u-gap>
   </view>
</template>
@@ -315,10 +336,20 @@
// import popupMenu from '@/components/common/popup-menu/popup-menu.vue';
import combinedTitle from '@/components/common/combined-title/combined-title.vue';
import combinationCard from '@/components/common/combination-card/combination-card.vue';
import { setAccessToken } from '@/utils/status.js';
import { setAccessToken, redirectLogin } from '@/utils/status.js';
import { logout } from '@/api/global.js';
export default {
   name: 'home',
   onLaunch() {
      let that = this;
      uni.addInterceptor('redirectTo', {
         //监听关闭本页面跳转
         success(e) {
            that.watchRouter();
         }
      });
   },
   computed: {
      rijihuaMenu() {
         return this.$store.state.rijihuaMenu;
@@ -358,8 +389,8 @@
         withDrawShow: false,
         fyData: [],
         withDrawData: {
            reason: '',
            id: '', // 撤回申请ID
            // reason: '',
            // id: '', // 撤回申请ID
            procInstId: ''
         },
         withDrawContent: '',
@@ -389,8 +420,14 @@
         // dataSeletText: '请选择状态',
         // 驳回请求
         rejectForm: {
            procInstIds: '',
            comment: ''
        id: "",
        procInstId: "",
        comment: "",
        type: 0,
        backTaskKey: "-1",
        sendMessage: true,
        sendSms: true,
        sendEmail: true,
         },
         modalType: 0,
         // 删除申请模态框
@@ -421,8 +458,8 @@
         haveTodoParams: {
            pageNumber: 1,
            pageSize: 2,
            sort: 'createTime',
            order: 'desc'
            // sort: 'createTime',
            // order: 'desc'
         }
      };
   },
@@ -432,27 +469,14 @@
   // },
   // 点击导航栏菜单后
   onNavigationBarButtonTap(e) {
      console.log('退出导航栏按钮事件',e);
      console.log('退出导航栏按钮事件', e);
      // this.$refs.menuRef.menuClick();
   },
   // 监听左上角的回退事件
   onUnload(event){ //多层级跳转之后,监听左上角返回事件,直接退回到index
      console.log('监听左上角',event);
      uni.request({
        url: `${BaseUrl}/auth/token/logout`,
        method: 'DELETE',
        header: {
          'TENANT-ID': 5,
          Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
          VERSION: 'zzl'
        }
      }).then(res=>{
         console.log('缓存清理成功');
      }).catch(err => {
        uni.showToast({
          title: '缓存清理失败!',
        })
      })
   onUnload(event) {
      //多层级跳转之后,监听左上角返回事件,直接退回到index
      console.log('监听左上角', event);
      this.logout();
   },
   onShow() {
      // 菜单注释(app待用)
@@ -467,6 +491,9 @@
      // popupMenu
   },
   methods: {
      watchRouter() {
         console.log('路由跳转');
      },
      init() {
         this.getUserInfo(); // 用户信息
         this.getProcessDataList(); // 申请列表
@@ -474,10 +501,41 @@
         this.doneList(); // 我的已办
         this.xscarshippingdayplan(); // 日计划
      },
    //代办详情
    daibanDetail(item) {
      console.log(item,'item=====------000000')
      if(item?.actBusiness?.actType == 'Offsetting') {  //收款 actType = ‘Offsetting’
        uni.navigateTo({
          url: `/pages/payment-form-data/payment-form-data?id=${item.tableId}`,
        })
      }else if(item?.actBusiness?.actType == 'XsWaybill') {
        uni.navigateTo({
          url: `/pages/new-application-form-data/new-application-form-data?id=${item.tableId}`
        })
      }
    },
    //代办详情
    shenqingDetail(item) {
      console.log(item,'item====待办===详情')
      if(item.actType == 'Offsetting') {  //收款 actType = ‘Offsetting’
        uni.navigateTo({
          url: `/pages/payment-form-data/payment-form-data?id=${item.tableId}`,
        })
      }else if(item.actType == 'XsWaybill') {
        uni.navigateTo({
          url: `/pages/new-application-form-data/new-application-form-data?id=${item.tableId}`
        })
      }
    },
      getUserInfo() {
         this.$reqGet('getUserInfo').then(res => {
        console.log(res,'res=====系统登录===')
            if (res.code == 0) {
               uni.setStorageSync('userInfo', res.data.sysUser);
          this.$store.commit('SET_PERMISSIONS',res.data.permissions)
               //uni.setStorageSync('permissions', res.data.permissions);
               this.userId = res.data.sysUser.userId;
               this.$nextTick(() => {
                  this.coalbunker();
@@ -486,7 +544,7 @@
         });
      },
      getServerData() {
         console.log('加载图表',this.uchartsData);
         console.log('加载图表', this.uchartsData);
         //模拟从服务器获取数据时的延时
         setTimeout(() => {
            //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
@@ -580,33 +638,27 @@
         this.menuShow = e;
      },
      // 撤回模态框
      withDrawClick(id) {
      withDrawClick(procInstId) {
         this.withDrawShow = true;
         this.withDrawData.id = id;
         this.withDrawData.procInstId = procInstId;
      },
      withDrawConfirm() {
         this.shenqingData.forEach(i => {
            if (i.id == this.withDrawData.id) {
               this.withDrawData.procInstId = i.procInstId;
         this.$reqPost('cancel', this.withDrawData).then(res => {
            this.withDrawShow = false;
            if (res.code == 0) {
               uni.showToast({
                  title: res.data,
                  duration: 2000
               });
            }
            // 刷新列表
            this.getProcessDataList();
            this.todoList();
            this.doneList();
         });
         if (this.withDrawData.reason.length >= 2) {
            this.$reqPost('withDraw', this.withDrawData, 'form').then(res => {
               this.withDrawShow = false;
               if (res.code == 0) {
                  uni.showToast({
                     title: res.data,
                     duration: 2000
                  });
               }
               this.getProcessDataList();
            });
         } else {
            uni.showToast({
               title: '请规范输入',
               duration: 2000
            });
         }
      },
      withDrawCancel() {
         this.withDrawShow = false;
      },
      // 通过
      adopClick(v) {
@@ -622,14 +674,15 @@
      // 通过模态框
      adoptModalConfirm() {
         this.adoptModalShow = false;
         this.adoptForm.comment = this.adoptModalContent;
         this.$reqPost('passAll', this.adoptForm, 'form').then(res => {
         this.adoptForm.comment = this.adoptModalContent || '';
         this.$reqPost('passAll', this.adoptForm).then(res => {
            if (res.code == 0) {
               this.$u.toast('操作成功!');
            } else {
               this.$u.toast('添加失败!!');
               this.$u.toast('通过失败!!');
            }
            this.todoList(); // 我的待办
            this.doneList();
         });
      },
      adoptModalCancel() {
@@ -637,28 +690,37 @@
      },
      // 驳回
      rejectClick(v) {
      console.log('驳回====',v)
         this.modalType = 1;
         this.rejectModalShow = true;
         this.rejectForm.procInstIds = v.procInstId;
         this.rejectForm.procInstId = v.procInstId;
      this.rejectForm.id = v.id;
      this.rejectForm.procDefId = v.procDefId;
      this.rejectForm.priority = v.priority;
      this.rejectForm.type = 1;
      },
      // 驳回模态框
      rejectModalConfirm() {
         this.rejectModalShow = false;
         this.$reqPost('backAll', this.rejectForm, 'form').then(res => {
         this.$reqPost('back', this.rejectForm).then(res => {
            if (res.code == 0) {
               this.$u.toast('操作成功!');
            } else {
               this.$u.toast('操作失败!!!');
            }
            this.todoList(); // 我的待办
            this.doneList();
         });
      },
      rejectModalCancel() {
         this.rejectModalShow = false;
      },
      withDrawCancel() {
         this.withDrawShow = false;
      // 删除申请
      deleteApplicationClick(id) {
         this.deleteApplicationModalShow = true;
         this.procInstId = id;
         console.log(id);
      },
      // 删除申请模态框
      deleteApplicationModalConfirm() {
@@ -683,88 +745,103 @@
         });
      },
      // 表单数据
      theFormDataClick(v) {
         uni.navigateTo({
            url: `/pages/the-form-data/the-form-data?index=${v}`
         });
      // theFormDataClick(item) {
    //   console.log(item,'申请还是-----item')
      //    // uni.navigateTo({
      //    //    url: `/pages/the-form-data/the-form-data?index=${v}`
      //    // });
    //
      // },
      // 删除撤回申请
      deleteWithDrawApplication(id) {
         this.deleteWithDrawApplicationGlobal(id)
            .then(res => {
               if (res.code == 0) {
                  // 刷新列表
                  this.getProcessDataList();
               }
            })
            .catch(err => {
               console.log('删除撤回申请异常');
            });
      },
      // 重新申请
      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();
                        this.getProcessDataList();
                     });
                  } else {
                     this.form.assignees = [];
                     this.showAssign = true;
                     this.error = '请进入"流程管理"为审批节点分配候选审批人员';
                  }
               }
            }
            console.log(this.form);
         });
      // 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();
      //                   this.getProcessDataList();
      //                });
      //             } else {
      //                this.form.assignees = [];
      //                this.showAssign = true;
      //                this.error = '请进入"流程管理"为审批节点分配候选审批人员';
      //             }
      //          }
      //       }
      //       console.log(this.form);
      //    });
         this.modalVisible = true;
      },
      //    this.modalVisible = true;
      // },
      // 修改
      editMyApplication(v) {
         console.log('修改申请');
@@ -778,11 +855,13 @@
            url: `/pages/approval-history/approval-history?index=${v}`
         });
      },
      // 删除申请
      deleteApplicationClick(id) {
         this.deleteApplicationModalShow = true;
         this.procInstId = id;
         console.log(id);
      redirectLogin() {
         redirectLogin();
      },
      huanBang() {
         uni.navigateTo({
            url: '/pages/register/register'
         });
      }
   }
};
@@ -793,7 +872,21 @@
   width: 100%;
   display: flex;
   flex-direction: column;
   padding-bottom: vww(20);
   // 横向菜单栏
   .utils {
      .utils-container {
         display: flex;
         // justify-content: space-between;
         justify-content: center;
         width: 66%;
         margin: 0 auto;
         .utils-container-body {
            display: flex;
            align-items: center;
         }
      }
   }
   .home_swipe {
      width: 100%;
@@ -818,10 +911,10 @@
   // echarts图表
   .charts-box {
      width: 91%;
      height: vww(330);
      height: vww(270);
      margin: 0 auto;
      .u-empty{
         height:100%;
      .u-empty {
         height: 100%;
      }
   }
@@ -839,6 +932,9 @@
            }
         }
      }
   }
   .bottomChild {
      margin-bottom: vww(20);
   }
   // 卡片中间
@@ -925,7 +1021,7 @@
      // width:100%;
      // height:vww(244);
      .slot-content {
      width:vww(330);
         width: vww(330);
         .rejectMesaage {
            display: flex;
            padding: vww(3);