Browse Source

工单处理移动端代码

user5 8 months ago
parent
commit
bf84f2a653

+ 7 - 0
api/garbageClearance/disposeRubbishService.js

@@ -43,4 +43,11 @@ export default {
 			method: "get",
 		});
 	},
+	getByProcInsId: function (procInsId) {
+		return request({
+			url: "/dispose/rubbish/getByProcInsId",
+			method: "get",
+			params: {procInsId: procInsId}
+		});
+	},
 };

+ 196 - 81
pages/edt/DisposeRubbishForm.vue

@@ -6,6 +6,8 @@
 
         <!-- First Section: 巡视工单 to 联系方式 -->
         <view class="form-section">
+            <!-- 遮罩层 -->
+            <view v-if="isProcessing" class="mask"></view>
             <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" v-if="!nodeFlag">
 
                 <u-form-item label="清运编号" prop="no">
@@ -103,7 +105,7 @@
                                     :disabled="true"
                                     placeholder="请选择巡视工单编号">
                             </u--input>
-                            <u-button type="primary" style="width: 20%" text="处理" @click="disposeWorkOver(inputForm.workOverNoList[index_workOver].id)"></u-button>
+                            <u-button type="primary" style="width: 20%" text="处理" @click="disposeWorkOver(inputForm.workOverNoList[index_workOver].id)" v-if="!weighFlag"></u-button>
                         </u-form-item>
                     </div>
                 </template>
@@ -120,7 +122,6 @@
                         :disabled="true"
                         :fileList="fileList1"
                         @afterRead="afterRead"
-                        @delete="deletePic"
                         name="1"
                         multiple
                         :maxCount="10"
@@ -136,7 +137,6 @@
                         :disabled="true"
                         :fileList="fileList2"
                         @afterRead="afterRead"
-                        @delete="deletePic"
                         name="2"
                         multiple
                         :maxCount="10"
@@ -152,7 +152,6 @@
                         :disabled="true"
                         :fileList="fileList3"
                         @afterRead="afterRead"
-                        @delete="deletePic"
                         name="3"
                         multiple
                         :maxCount="10"
@@ -161,8 +160,8 @@
         </view>
 
         <!-- Third Section: 备注 -->
-        <view class="form-section">
-            <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" v-if="!nodeFlag">
+        <view class="form-section" v-if="!nodeFlag">
+            <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" >
                 <u-form-item label="备注" borderBottom prop="remarks">
                     <u--textarea placeholder='请填写备注' :maxlength="500" v-model="inputForm.remarks"></u--textarea>
                 </u-form-item>
@@ -177,6 +176,62 @@
                 </view>-->
             </u--form>
         </view>
+        <!-- Third Section: 备注 -->
+        <view class="form-section" v-if="nodeFlag || weighFlag">
+            <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" >
+                <u-form-item label="备注" borderBottom prop="remarks">
+                    <u--textarea placeholder='请填写备注' :disabled="true" :maxlength="500" v-model="inputForm.remarks"></u--textarea>
+                </u-form-item>
+            </u--form>
+        </view>
+
+        <view class="form-section" v-if="weighFlag">
+            <span style="color: #4396fd;">现场信息登记</span>
+            <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm">
+
+                <u-form-item label="重量(t)" prop="weight" :required="true">
+                    <u--input
+                            v-model="inputForm.weight"
+                            @input="handleInput('weight', $event)"
+                            placeholder="重量"
+                            clearable
+                    ></u--input>
+                </u-form-item>
+
+                <u-form-item label="运输里程(km)" prop="transportMileage" :required="true">
+                    <u--input
+                            v-model="inputForm.transportMileage"
+                            @input="handleInput('transportMileage', $event)"
+                            placeholder="运输里程"
+                            clearable
+                    ></u--input>
+                </u-form-item>
+
+                <u-form-item label="补贴(元)" prop="subsidy" :required="true">
+                    <u--input
+                            v-model="inputForm.subsidy"
+                            @input="handleInput('subsidy', $event)"
+                            placeholder="补贴"
+                            clearable
+                    ></u--input>
+                </u-form-item>
+            </u--form>
+        </view>
+        <!-- Second Section: 上传图片 -->
+        <view class="form-section" v-if="weighFlag">
+            <text style="color: black">过磅现场照片</text>
+            <view class="u-page__upload-item" >
+                <text class="u-demo-block__title">照片上传</text>
+                <u-upload
+                        :fileList="fileList4"
+                        @afterRead="afterRead"
+                        @delete="deletePic"
+                        name="4"
+                        multiple
+                        :maxCount="10"
+                ></u-upload>
+            </view>
+        </view>
         <WorkOverChoose ref="workOverChoose" @input="selectWorkOverChange" title="报告项目选择"/>
     </view>
 </template>
@@ -200,11 +255,15 @@
         data () {
             return {
                 disFlag: true,  // 启用动态获取处理单位则设置为false
+                isProcessing: false,  // 遮罩层
                 processingUnits: [],
+                taskName: '',   //当前节点处理人节点名称
                 fileList1: [],
                 fileList2: [],
                 fileList3: [],
+                fileList4: [],
                 nodeFlag: false,
+                weighFlag: false,  // 过磅管理员看到的信息
                 inputForm: {
                     programId: '',
                     programIds: [],
@@ -219,6 +278,9 @@
                     workOverNoList: [],
                     disposeType: '',
                     rubbishStation: '',
+                    weight: '',
+                    transportMileage: '',
+                    subsidy: '',
                 },
                 rules: {
                     'processingUnit': [
@@ -296,78 +358,83 @@
             },
         },
         methods: {
-            async init (id) {
-               this.nodeFlag = true
-                this.inputForm.id = id
+            handleInput(field, value) {
+                // Ensure value is a string and sanitize input
+                value = value.toString();
+
+                // Regular expression to match numbers with up to 2 decimal places and ensure positive value
+                const regex = /^(?!.*[a-zA-Z])\-?\d+(\.\d{0,2})?$/;
+
+                // Format the value based on regex
+                const match = value.match(regex);
+                console.log(match)
+                let formattedValue = (match && match[0]) || '';
+
+                // Ensure the value is positive
+                if (parseFloat(formattedValue) < 0) {
+                    formattedValue = '';
+                }
+
+                // Update input form based on the field
+                this.inputForm[field] = formattedValue;
+            },
+            async init(id) {
+                this.nodeFlag = true;
+                this.inputForm.id = id;
+
                 if (id) {
-                    await disposeRubbishService.queryById(id).then((data) => {
-                       /*if (this.status === 'testSee') {
-                           this.nodeFlag = true
-                       } else {
-                           this.taskService.getTaskNameByProcInsId(data.procInsId).then((data) => {
-                               if (this.isNotEmpty(data)) {
-                                   if (data === '发起人重新申请' || this.isEmpty(data)) {
-                                       this.nodeFlag = false
-                                   } else if (data === '发票管理员审核'){
-                                       this.nodeFlag = true
-                                       this.addFlag = true
-                                   }
-                               }else {
-                                   this.testFlag = true
-                                   this.addFlag = true
-                                   console.log('没有')
-                               }
-                           })
-                       }*/
-
-
-                        this.inputForm = this.recover(this.inputForm, data)
-
-                        if (data.fileList1) {
-                            this.fileList1 = []
-                            data.fileList1.forEach(
-                                (item) => {
-                                    const newItem = {
-                                        attachmentName: item.name,
-                                        fileSize: item.size,
-                                        url: item.temporaryUrl,
-                                        type: item.type,      // 如果不需要,可以不写
-                                    };
-                                    this.fileList1.push(newItem);
-                                }
-                            );
-                        }
-                        if (data.fileList2) {
-                            this.fileList2 = []
-                            data.fileList2.forEach(
-                                (item) => {
-                                    const newItem = {
-                                        attachmentName: item.name,
-                                        fileSize: item.size,
-                                        url: item.temporaryUrl,
-                                        type: item.type,      // 如果不需要,可以不写
-                                    };
-                                    this.fileList2.push(newItem);
-                                }
-                            );
-                        }
-                        if (data.fileList3) {
-                            this.fileList3 = []
-                            data.fileList3.forEach(
-                                (item) => {
-                                    const newItem = {
-                                        attachmentName: item.name,
-                                        fileSize: item.size,
-                                        url: item.temporaryUrl,
-                                        type: item.type,      // 如果不需要,可以不写
-                                    };
-                                    this.fileList3.push(newItem);
-                                }
-                            );
+                    // 使用 await 等待查询结果
+                    const data = await disposeRubbishService.queryById(id);
+                    console.log('查询当前信息', data);
+
+                    // 获取当前节点流程信息,并等待其执行完成
+                    const taskName = await taskService.getTaskNameByProcInsId(data.procInsId);
+                    this.taskName = taskName
+                    console.log('查询当前节点流程信息', taskName);
+
+                    // 根据任务名称处理逻辑
+                    if (this.isNotEmpty(taskName)) {
+                        if (taskName === '发起人重新申请' || this.isEmpty(taskName)) {
+                            this.nodeFlag = false;
+                        } else if (taskName === '过磅专员处理') {
+                            this.nodeFlag = true;
+                            this.weighFlag = true;
                         }
-                    })
+                    }
+
+                    // 恢复表单数据
+                    this.inputForm = this.recover(this.inputForm, data);
+
+                    // 处理文件列表
+                    if (data.fileList1) {
+                        this.fileList1 = data.fileList1.map(item => ({
+                            attachmentName: item.name,
+                            fileSize: item.size,
+                            url: item.temporaryUrl,
+                            type: item.type // 如果不需要,可以不写
+                        }));
+                    }
+
+                    if (data.fileList2) {
+                        this.fileList2 = data.fileList2.map(item => ({
+                            attachmentName: item.name,
+                            fileSize: item.size,
+                            url: item.temporaryUrl,
+                            type: item.type // 如果不需要,可以不写
+                        }));
+                    }
+
+                    if (data.fileList3) {
+                        this.fileList3 = data.fileList3.map(item => ({
+                            attachmentName: item.name,
+                            fileSize: item.size,
+                            url: item.temporaryUrl,
+                            type: item.type // 如果不需要,可以不写
+                        }));
+                    }
                 }
-            },
+            }
+            ,
             async selectWorkOverChange(rows, index) {
                 if (rows.length > 0) {
                     rows.forEach((item, rowIndex) => {
@@ -437,6 +504,7 @@
 
             // 显示  项目选择器
             disposeWorkOver(id) {
+                console.log(this.inputForm.status)
                 if(this.inputForm.status === '2'){
                     uni.navigateTo({
                         url: '/pages/edt/PatrolWorkOrderForm?id='+id
@@ -558,6 +626,7 @@
                 return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
             },
             saveForm(callback) {
+                this.isProcessing = true; // 显示遮罩层
 
                 return new Promise((resolve, reject) => {
                     // 表单规则验证
@@ -580,10 +649,22 @@
                     if(this.inputForm.programIds.length == 0){
                         errors.push("请选择巡视工单")
                     }
+                    if(this.weighFlag){
+                        if(!this.inputForm.weight){
+                            errors.push("请填写重量")
+                        }
+                        if(!this.inputForm.transportMileage){
+                            errors.push("请填写运输里程")
+                        }
+                        if(!this.inputForm.subsidy){
+                            errors.push("请填写补贴金额")
+                        }
+                    }
 
                     if (errors.length > 0) {
                         // 存在错误,显示提示信息
                         errors.forEach(error => {
+                            this.isProcessing = false; // 显示遮罩层
                             uni.showToast({
                                 title: error,
                                 icon: 'none',
@@ -595,14 +676,38 @@
                         // 所有验证通过,执行保存操作
                         this.$refs.inputForm.validate().then(() => {
                             uni.showLoading();
-                            this.inputForm.status = '2'
+                            if(this.weighFlag){
+                                this.inputForm.status = '5'
+                            }else{
+                                if(this.inputForm.disposeType === '1'){
+                                    this.inputForm.status = '2'
+                                }else if(this.inputForm.disposeType === '2'){
+                                    if(this.taskName){
+                                        this.inputForm.status = '5'
+                                    }else{
+                                        this.inputForm.status = '2'
+                                    }
+                                }else{
+                                    this.inputForm.status = '2'
+                                }
+                            }
+                            this.inputForm.fileList4 = this.fileList4
                             disposeRubbishService.save(this.inputForm).then(data => {
-                                callback(data.businessTable, data.businessId,this.inputForm.disposeType);
-                                uni.showToast({title:"提交成功", icon:"success"});
-                                // 返回上一页
-                                uni.navigateBack({
-                                    delta: 1
+                                console.log('提交成功拉')
+                                uni.showToast({
+                                    title: "提交成功",
+                                    icon: "success",
+                                    duration: 1000  // 提示持续时间为1秒(1000毫秒)
                                 });
+
+                                // 延迟1秒后再跳转到上一页
+                                setTimeout(() => {
+                                    this.isProcessing = false; // 显示遮罩层
+                                    callback(data.businessTable, data.businessId,this.inputForm.disposeType);
+                                    uni.navigateBack({
+                                        delta: 1
+                                    });
+                                }, 1000);
                                 resolve('Form saved successfully');
                             }).catch(error => {
                                 reject('Save operation failed');
@@ -707,4 +812,14 @@
     .cu-form-group .title {
         min-width: 100px;
     }
+    /* 遮罩层样式 */
+    .mask {
+        position: fixed;
+        top: 0;
+        left: 0;
+        width: 100%;
+        height: 100%;
+        background-color: rgba(0, 0, 0, 0.05); /* 半透明遮罩 */
+        z-index: 9999; /* 确保遮罩层在最顶层 */
+    }
 </style>

+ 349 - 0
pages/edt/DisposeRubbishFormDetail.vue

@@ -0,0 +1,349 @@
+<template>
+    <view>
+        <cu-custom :backUrl="'/pages/index/index?id=apps'" :isBack="true" bgColor="bg-gradual-blue">
+            <block slot="content">建筑垃圾清运处理</block>
+        </cu-custom>
+
+        <!-- First Section: 巡视工单 to 联系方式 -->
+        <view class="form-section">
+            <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm">
+
+                <u-form-item label="清运编号" prop="no">
+                    <u--input v-model="inputForm.no" :disabled="true" placeholder="工单编号" clearable></u--input>
+                </u-form-item>
+
+                <u-form-item label="所属单位" prop="processingUnitName" :required="true">
+                    <u--input v-model="inputForm.processingUnitName" :disabled="true" placeholder="所属单位" clearable></u--input>
+                </u-form-item>
+
+                <u-form-item label="清运专员" prop="clearUserName">
+                    <u--input v-model="inputForm.clearUserName" :disabled="true" placeholder="清运专员" clearable></u--input>
+                </u-form-item>
+
+                <u-form-item label="联系方式" prop="clearUserMobile">
+                    <u--input v-model="inputForm.clearUserMobile" :disabled="true" placeholder="联系方式" clearable></u--input>
+                </u-form-item>
+
+                <u-form-item label="处理方式" prop="disposeType" :required="true" >
+                    <jp-picker v-model="inputForm.disposeType" rangeKey="label" :disabled="true" rangeValue="value" :range="[
+                    { label: '转运调剂处理', value: '1' },
+                    { label: '自行处理', value: '2' },
+                ]" ></jp-picker>
+                </u-form-item>
+
+                <u-form-item label="垃圾站点" prop="rubbishStation">
+                    <u--input v-model="inputForm.rubbishStation" :disabled="true" placeholder="垃圾站点" clearable></u--input>
+                </u-form-item>
+
+
+                <template>
+                    <div>
+                        <u-form-item
+                                v-for="(item, index_workOver) in inputForm.workOverNoList"
+                                :key="index_workOver"
+                                :label="`巡视工单 ${index_workOver + 1}`"
+                                :required="true"
+                                :prop="'workOverNoList[' + index_workOver + '].no'"
+                        >
+                            <u--input
+                                    v-model="inputForm.workOverNoList[index_workOver].no"
+                                    :disabled="true"
+                                    placeholder="请选择巡视工单编号">
+                            </u--input>
+                            <u-button type="primary" style="width: 20%" text="详情" @click="disposeWorkOver(inputForm.workOverNoList[index_workOver].id)"></u-button>
+                        </u-form-item>
+                    </div>
+                </template>
+            </u--form>
+        </view>
+
+        <!-- Second Section: 上传图片 -->
+        <view class="form-section">
+            <text class="u-demo-block__title">清理前照片</text>
+            <view class="u-page__upload-item">
+                <u-upload
+                        :disabled="true"
+                        :fileList="fileList1"
+                        @afterRead="afterRead"
+                        name="1"
+                        multiple
+                        :maxCount="10"
+                ></u-upload>
+            </view>
+        </view>
+
+        <!-- Second Section: 上传图片 -->
+        <view class="form-section">
+            <text class="u-demo-block__title">清理中照片</text>
+            <view class="u-page__upload-item">
+                <u-upload
+                        :disabled="true"
+                        :fileList="fileList2"
+                        @afterRead="afterRead"
+                        name="2"
+                        multiple
+                        :maxCount="10"
+                ></u-upload>
+            </view>
+        </view>
+
+        <!-- Second Section: 上传图片 -->
+        <view class="form-section">
+            <text class="u-demo-block__title">清理后照片</text>
+            <view class="u-page__upload-item">
+                <u-upload
+                        :disabled="true"
+                        :fileList="fileList3"
+                        @afterRead="afterRead"
+                        name="3"
+                        multiple
+                        :maxCount="10"
+                ></u-upload>
+            </view>
+        </view>
+        <!-- Third Section: 备注 -->
+        <view class="form-section">
+            <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" >
+                <u-form-item label="备注" borderBottom prop="remarks">
+                    <u--textarea placeholder='请填写备注' :disabled="true" :maxlength="500" v-model="inputForm.remarks"></u--textarea>
+                </u-form-item>
+            </u--form>
+        </view>
+
+        <view class="form-section">
+            <span style="color: #4396fd;">现场信息登记</span>
+            <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm">
+
+                <u-form-item label="重量(t)" prop="weight" :required="true">
+                    <u--input
+                            :disabled="true"
+                            v-model="inputForm.weight"
+                            placeholder="重量"
+                            clearable
+                    ></u--input>
+                </u-form-item>
+
+                <u-form-item label="运输里程(km)" prop="transportMileage" :required="true">
+                    <u--input
+                            :disabled="true"
+                            v-model="inputForm.transportMileage"
+                            placeholder="运输里程"
+                            clearable
+                    ></u--input>
+                </u-form-item>
+
+                <u-form-item label="补贴(元)" prop="subsidy" :required="true">
+                    <u--input
+                            :disabled="true"
+                            v-model="inputForm.subsidy"
+                            placeholder="补贴"
+                            clearable
+                    ></u--input>
+                </u-form-item>
+            </u--form>
+        </view>
+        <!-- Second Section: 上传图片 -->
+        <view class="form-section">
+            <text style="color: black">过磅现场照片</text>
+            <view class="u-page__upload-item" >
+                <text class="u-demo-block__title">照片上传</text>
+                <u-upload
+                        :disabled="true"
+                        :fileList="fileList4"
+                        @afterRead="afterRead"
+                        name="4"
+                        multiple
+                        :maxCount="10"
+                ></u-upload>
+            </view>
+        </view>
+    </view>
+</template>
+
+<script>
+    import disposeRubbishService from '@/api/garbageClearance/disposeRubbishService'
+    import overService from '@/api/garbageClearance/overService'
+    import WorkOverChoose from './WorkOverChoose'
+    import taskService from "@/api/flowable/taskService"
+    import {mapState, mapMutations, mapActions} from 'vuex'
+    import * as $auth from "../../common/auth";
+    import { EventBus } from '@/store/eventBus.js';
+    export default {
+        components: {
+            WorkOverChoose,
+        },
+        computed: mapState({
+            userInfo: (state) => state.user.userInfo,
+            avatar: (state) => state.user.avatar
+        }),
+        data () {
+            return {
+                disFlag: true,  // 启用动态获取处理单位则设置为false
+                isProcessing: false,  // 遮罩层
+                processingUnits: [],
+                taskName: '',   //当前节点处理人节点名称
+                fileList1: [],
+                fileList2: [],
+                fileList3: [],
+                fileList4: [],
+                nodeFlag: false,
+                weighFlag: false,  // 过磅管理员看到的信息
+                inputForm: {
+                    programId: '',
+                    programIds: [],
+                    no: '',
+                    processingUnit: '',
+                    processingUnitName: '',
+                    clearUserId: '',
+                    clearUserName: '',
+                    clearUserMobile: '',
+                    remarks: '',
+                    status: '',
+                    workOverNoList: [],
+                    disposeType: '',
+                    rubbishStation: '',
+                    weight: '',
+                    transportMileage: '',
+                    subsidy: '',
+                },
+                rules: {
+                    'processingUnit': [
+                        {
+                            required: true,
+                            message: '处理单位不能为空',
+                            trigger: ['blur', 'change']
+                        }
+                    ],
+                }
+            }
+        },
+        // 页面加载时执行
+        async created() {
+        },
+        props: {
+            businessId: {
+                type: String,
+                default: ''
+            },
+            formReadOnly: {
+                type: Boolean,
+                default: false
+            },
+            status: {
+                type: String,
+                default: ''
+            }
+        },
+        watch: {
+            'businessId': {
+                handler (newVal) {
+                    if (this.businessId) {
+                        this.init(this.businessId)
+                    } else {
+                        this.$nextTick(() => {
+                            // this.$refs.inputForm.reset()
+                        })
+                    }
+                },
+                immediate: true,
+                deep: false
+            },
+        },
+        methods: {
+            async init(id) {
+                this.nodeFlag = true;
+                this.inputForm.id = id;
+
+                if (id) {
+                    // 使用 await 等待查询结果
+                    const data = await disposeRubbishService.queryById(id);
+                    console.log('查询当前信息', data);
+
+                    // 获取当前节点流程信息,并等待其执行完成
+                    const taskName = await taskService.getTaskNameByProcInsId(data.procInsId);
+                    this.taskName = taskName
+
+                    // 恢复表单数据
+                    this.inputForm = this.recover(this.inputForm, data);
+
+                    // 处理文件列表
+                    if (data.fileList1) {
+                        this.fileList1 = data.fileList1.map(item => ({
+                            attachmentName: item.name,
+                            fileSize: item.size,
+                            url: item.temporaryUrl,
+                            type: item.type // 如果不需要,可以不写
+                        }));
+                    }
+
+                    if (data.fileList2) {
+                        this.fileList2 = data.fileList2.map(item => ({
+                            attachmentName: item.name,
+                            fileSize: item.size,
+                            url: item.temporaryUrl,
+                            type: item.type // 如果不需要,可以不写
+                        }));
+                    }
+
+                    if (data.fileList3) {
+                        this.fileList3 = data.fileList3.map(item => ({
+                            attachmentName: item.name,
+                            fileSize: item.size,
+                            url: item.temporaryUrl,
+                            type: item.type // 如果不需要,可以不写
+                        }));
+                    }
+                    if (data.fileList4) {
+                        this.fileList4 = data.fileList4.map(item => ({
+                            attachmentName: item.name,
+                            fileSize: item.size,
+                            url: item.temporaryUrl,
+                            type: item.type // 如果不需要,可以不写
+                        }));
+                    }
+                }
+            },
+
+            // 显示  项目选择器
+            disposeWorkOver(id) {
+                uni.navigateTo({
+                    url: '/pages/edt/PatrolWorkOrderForm?id='+id + '&showFlag=true'
+                })
+
+            },
+        }
+    }
+</script>
+
+<style>
+    .form-section {
+        padding: 10px 15px;
+        margin-bottom: 10px;
+        background-color: #ffffff;
+        border-radius: 5px;
+        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
+    }
+
+    .u-page__upload-item {
+        margin-top: 10px;
+    }
+
+    .button-container {
+        margin-top: 20px;
+        text-align: center;
+    }
+
+    .cu-form-group .title {
+        min-width: 100px;
+    }
+    /* 遮罩层样式 */
+    .mask {
+        position: fixed;
+        top: 0;
+        left: 0;
+        width: 100%;
+        height: 100%;
+        background-color: rgba(0, 0, 0, 0.05); /* 半透明遮罩 */
+        z-index: 9999; /* 确保遮罩层在最顶层 */
+    }
+</style>

+ 64 - 13
pages/edt/PatrolWorkOrderForm.vue

@@ -84,7 +84,16 @@
         <!-- Second Section: 上传图片 -->
         <view class="form-section" v-if="nodeFlag">
             <text class="u-demo-block__title">清理中照片</text>
-            <view class="u-page__upload-item">
+            <view class="u-page__upload-item" v-if="showFlag">
+                <u-upload
+                        :disabled="true"
+                        :fileList="fileList2"
+                        name="2"
+                        multiple
+                        :maxCount="10"
+                ></u-upload>
+            </view>
+            <view class="u-page__upload-item" v-else>
                 <u-upload
                         :fileList="fileList2"
                         @afterRead="afterRead"
@@ -99,7 +108,16 @@
         <!-- Second Section: 上传图片 -->
         <view class="form-section" v-if="nodeFlag">
             <text class="u-demo-block__title">清理后照片</text>
-            <view class="u-page__upload-item">
+            <view class="u-page__upload-item" v-if="showFlag">
+                <u-upload
+                        :disabled="true"
+                        :fileList="fileList3"
+                        name="3"
+                        multiple
+                        :maxCount="10"
+                ></u-upload>
+            </view>
+            <view class="u-page__upload-item" v-else>
                 <u-upload
                         :fileList="fileList3"
                         @afterRead="afterRead"
@@ -126,13 +144,15 @@
                             @click="saveForm"
                     ></u-button>
                 </view>
+                <!-- 遮罩层 -->
+                <view v-if="isProcessing" class="mask"></view>
             </u--form>
             <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" v-if="nodeFlag">
                 <u-form-item label="备注" borderBottom prop="remarks">
                     <u--textarea placeholder='请填写备注' :maxlength="500" :disabled="true" v-model="inputForm.remarks"></u--textarea>
                 </u-form-item>
 
-                <view class="button-container">
+                <view class="button-container" v-if="!showFlag">
                     <u-button
                             text="确认"
                             size="large"
@@ -160,6 +180,8 @@
         data () {
             return {
                 disFlag: true,  // 启用动态获取处理单位则设置为false
+                showFlag: false,
+                isProcessing: false,  // 遮罩层
                 processingUnits: [],
                 fileList1: [],
                 fileList2: [],
@@ -242,7 +264,9 @@
         watch: {
         },
         onLoad(options) {
+            console.log('options',options)
             // 从 options 中获取 id 参数
+            this.showFlag = options.showFlag;
             this.id = options.id;
             // 这里可以调用初始化方法
             this.init(this.id);
@@ -362,6 +386,7 @@
                 return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
             },
             saveForm(callback) {
+                this.isProcessing = true; // 显示遮罩层
 
                 return new Promise((resolve, reject) => {
                     // 表单规则验证
@@ -399,12 +424,20 @@
 
                             overService.save(this.inputForm).then(data => {
 
-                                uni.showToast({title:"提交成功", icon:"success"});
-                                // 返回上一页
-                                uni.navigateBack({
-                                    delta: 1
+                                uni.showToast({
+                                    title: "提交成功",
+                                    icon: "success",
+                                    duration: 1000  // 提示持续时间为1秒(1000毫秒)
                                 });
-                                resolve('Form saved successfully');
+
+                                // 延迟1秒后再跳转到上一页
+                                setTimeout(() => {
+                                    this.isProcessing = false; // 显示遮罩层
+                                    resolve('Form saved successfully');
+                                    uni.navigateBack({
+                                        delta: 1
+                                    });
+                                }, 1000);
                             }).catch(error => {
                                 reject('Save operation failed');
                             });
@@ -449,12 +482,20 @@
 
                         overService.savePhoto(this.inputForm).then(data => {
                             EventBus.$emit('refreshPhoto');
-                            uni.showToast({title:"提交成功", icon:"success"});
-                            // 返回上一页
-                            uni.navigateBack({
-                                delta: 1
+                            uni.showToast({
+                                title: "提交成功",
+                                icon: "success",
+                                duration: 1000  // 提示持续时间为1秒(1000毫秒)
                             });
-                            resolve('Form saved successfully');
+
+                            // 延迟1秒后再跳转到上一页
+                            setTimeout(() => {
+                                this.isProcessing = false; // 显示遮罩层
+                                resolve('Form saved successfully');
+                                uni.navigateBack({
+                                    delta: 1
+                                });
+                            }, 1000);
                         }).catch(error => {
                             reject('Save operation failed');
                         });
@@ -557,4 +598,14 @@
     .cu-form-group .title {
         min-width: 100px;
     }
+    /* 遮罩层样式 */
+    .mask {
+        position: fixed;
+        top: 0;
+        left: 0;
+        width: 100%;
+        height: 100%;
+        background-color: rgba(0, 0, 0, 0.05); /* 半透明遮罩 */
+        z-index: 9999; /* 确保遮罩层在最顶层 */
+    }
 </style>

+ 13 - 4
pages/workbench/task/TaskForm.vue

@@ -356,8 +356,15 @@
 				    disposeType: disposeType
 				  }).then((data) => {
 					  uni.showToast({ title: "启动成功", icon: "success" });
-					  uni.navigateTo({
-						  url: '/pages/workbench/task/TodoList'
+					  /*uni.navigateTo({
+						  //url: '/pages/workbench/task/TodoList'
+						  //url: '/pages/workbench/workbench'
+						  url: '/pages/index/index'
+					  })*/
+					  uni.reLaunch({
+						  //url: '/pages/workbench/task/TodoList'
+						  //url: '/pages/workbench/workbench'
+						  url: '/pages/index/index'
 					  })
 					  this.cc(data)
 				  })
@@ -518,8 +525,10 @@
 						assignee: this.auditForm.assignee
 				  }).then((data) => {
 						uni.showToast({ title: "审批成功", icon: "success" });
-						uni.navigateTo({
-							url: '/pages/workbench/task/TodoList'
+						uni.reLaunch({
+							//url: '/pages/workbench/task/TodoList'
+							//url: '/pages/workbench/workbench'
+							url: '/pages/index/index'
 						})
 					  this.cc(data)
 				  })

+ 5 - 1
pages/workbench/task/TaskFormDetail.vue

@@ -56,6 +56,7 @@
 	import userSelect from '@/components/user-select/user-select.vue'
 	import PreviewForm from '../form/GenerateFlowableForm'
 	import TestActivitiLeaveForm from '@/pages/test/activiti/TestActivitiLeaveForm.vue'
+	import DisposeRubbishForm from '@/pages/edt/DisposeRubbishFormDetail.vue'
 	import taskService from "@/api/flowable/taskService"
 	import formService from "@/api/flowable/formService"
 	export default {
@@ -83,8 +84,10 @@
 				  uni.showToast({ title: '没有关联流程表单!', icon: "none" });
 				} else {
 					// uniapp 不支持动态组件,所以通过名称匹配决定调用的表单组件
-					if(this.formUrl.endsWith('TestActivitiLeaveForm')){ 
+					if(this.formUrl.endsWith('TestActivitiLeaveForm')) {
 						this.form = TestActivitiLeaveForm
+					}else if(this.formUrl.endsWith('DisposeRubbishForm')){
+						this.form = DisposeRubbishForm
 					}else{
 						uni.showToast({ title: '没有关联流程表单!', icon: "none" });
 					}
@@ -122,6 +125,7 @@
 		components:{
 		  userSelect,
 		  TestActivitiLeaveForm,
+		  DisposeRubbishForm,
 		  PreviewForm
 		},
 		data() {

+ 1 - 0
pages/workbench/task/TodoList.vue

@@ -70,6 +70,7 @@
 			}
 		},
 		onLoad() {
+			console.log('onLoad')
 			this.loadmore()
 		},
 		methods: {

+ 141 - 30
pages/workbench/workbench.vue

@@ -85,7 +85,7 @@
 		<!-- 可滚动内容区域 -->
 		<scroll-view scroll-y class="page">
 			<!-- 其他可滚动内容 -->
-			<u-swipe-action>
+			<u-swipe-action v-if="this.showType == 'task'">
 				<view v-for="(row, index) in dataList" :key="index">
 					<u-swipe-action-item @click="todo(row)" :key="row.id" :threshold="60" duration="500"
 										 :options="[{ text: '办理', style: { backgroundColor: '#3c9cff' } }]">
@@ -109,26 +109,69 @@
 											<u-tag-small text="进行中" plain shape="circle" type="error"></u-tag-small>
 										</div>
 										<div style="margin-right: 10px; float: left">
+											<!--<span class="cuIcon-deliver" style="color: #d95141;margin-right: 5px;"></span>
+											<span>12.5km</span>-->
+										</div>
+										<div style="margin-right: 10px;">
+											<!--<span class="cuIcon-deletefill" style="color: #38b64b;margin-right: 5px;"></span>
+											<span>2.2t</span>-->
+										</div>
+									</view>
+								</view>
+								<view slot="right-icon" class="action">
+									<u-tag text="处理" plain bgColor="#38b64b" color="white" plainFill shape="circle" type="success" @click="todo(row)"></u-tag>
+								</view>
+							</u-cell>
+						</u-cell-group>
+					</u-swipe-action-item>
+				</view>
+				<!-- 加载更多 -->
+				<u-loadmore :status="status" @loadmore="loadmore" :line="true" />
+			</u-swipe-action>
+			<u-swipe-action v-else>
+				<view v-for="(row, index) in dataList" :key="index">
+					<u-swipe-action-item @click="toDetail(row)" :key="row.id" :threshold="60" duration="500"
+										 :options="[{ text: '办理', style: { backgroundColor: '#3c9cff' } }]">
+						<u-cell-group>
+							<u-cell @click="toDetail(row)">
+								<view slot="title" class="content" style="line-height: 1.5;">
+									<view class="text-bold text-grey">
+										<view class="ellipsis-description" style="font-size: 16px">
+										  <span style="margin-right: 10px;">
+											<span class="cuIcon-timefill" style="color: #3c9cff;margin-right: 5px;"></span>
+											<span>{{row.vars.startDate}}</span>
+										  </span>
+											<span style="margin-right: 10px;">
+											<span class="cuIcon-locationfill" style="color: #f67e1f;margin-right: 5px;"></span>
+											<span>{{row.vars.title}}</span>
+										  </span>
+										</view>
+									</view>
+									<view class="text-grey text-sm" style="font-size: 16px">
+										<div style="margin-right: 20px; float: left">
+											<u-tag-small text="进行中" plain shape="circle" type="error"></u-tag-small>
+										</div>
+										<div style="margin-right: 10px; float: left">
 											<span class="cuIcon-deliver" style="color: #d95141;margin-right: 5px;"></span>
-											<span>12.5km</span>
+											<span>{{row.transportMileage}}km</span>
 										</div>
 										<div style="margin-right: 10px;">
 											<span class="cuIcon-deletefill" style="color: #38b64b;margin-right: 5px;"></span>
-											<span>2.2t</span>
+											<span>{{row.weight}}t</span>
 										</div>
 									</view>
 								</view>
 								<view slot="right-icon" class="action">
-									<u-tag text="处理" plain bgColor="#38b64b" color="white" plainFill shape="circle" type="success" @click="todo(row)"></u-tag>
+									<u-tag text="详情" plain bgColor="#38b64b" color="white" plainFill shape="circle" type="success" @click="toDetail(row)"></u-tag>
 								</view>
 							</u-cell>
 						</u-cell-group>
 					</u-swipe-action-item>
 				</view>
+				<!-- 加载更多 -->
+				<u-loadmore :status="status" @loadmore="haveDone" :line="true" />
 			</u-swipe-action>
 
-			<!-- 加载更多 -->
-			<u-loadmore :status="status" @loadmore="loadmore" :line="true" />
 			<u-back-top :scrollTop="0" mode="square"></u-back-top>
 		</scroll-view>
 
@@ -182,6 +225,7 @@
 	import notifyService from "@/api/notify/notifyService";
 	import userService from "@/api/sys/userService"
 	import { EventBus } from '@/store/eventBus.js';
+	import disposeRubbishService from '@/api/garbageClearance/disposeRubbishService'
 	export default {
 		components:{
 			userSelect
@@ -190,6 +234,7 @@
 
 			return {
 				tabIndex: 0,
+				showType: 'task',
 				status: 'loadmore',
 				searchForm: {
 					title: ''
@@ -245,6 +290,9 @@
 		onLoad() {
 			this.loadmore()
 		},
+		onShow() {
+			this.loadmore()
+		},
 		computed:{
 			...mapState({
 				username: (state) => state.user.username,
@@ -300,29 +348,6 @@
 			this.loadmore()
 			//获取当前人对应的负责流程的信息
 			this.fetchUserInfo(); // 模拟获取用户信息
-
-
-			/*let res = await actCategoryService.treeData()
-			let data = await processService.list({current: 1, size: -1})
-			this.processMap = new Map()
-			res.forEach((item)=>{
-				this.processMap.set(item.name, [])
-			})
-			let list = data.records
-			list.forEach((item)=>{
-				if(this.processMap.has(item.category)){
-					let list = this.processMap.get(item.category)
-					list.push(item)
-				}else{
-					this.processMap.set(item.category, [item])
-				}
-			})
-
-			for(let [key,value] of this.processMap){
-			    console.log(key,value);
-			}*/
-
-
 		},
 		created() {
 			if(!this.username) {
@@ -343,6 +368,11 @@
 			},
 			tabSelect(index) {
 				this.tabIndex = index;
+				if(1 === index){
+					this.haveDone()
+				}else {
+					this.loadmore()
+				}
 			},
 			openPatrolWorkOrderForm () {
 				uni.navigateTo({
@@ -379,6 +409,19 @@
 					})
 				})
 			},
+			// 跳转到详细页面
+			toDetail (row) {
+				taskService.getTaskDef({
+					taskDefKey: row.taskDefinitionKey,
+					procInsId: row.processInstanceId,
+					procDefId: row.processDefinitionId
+				}).then((data) => {
+					let query = {readOnly: true, taskId: row.executionId, title: `${row.name}【${row.name}】`, formTitle: `${row.name}`, ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')}
+					uni.navigateTo({
+						url: '/pages/workbench/task/TaskFormDetail?flow='+JSON.stringify(query)
+					})
+				})
+			},
 			// 输入监听
 			inputWord(e){
 				this.searchTimer && clearTimeout(this.searchTimer)
@@ -398,9 +441,15 @@
 				this.loadmore()
 			},
 			loadmore() {
-				if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
+
+				/*if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
 					this.status = 'nomore';
 					return;
+				}*/
+				if(this.showType === 'history'){
+					this.dataList = []
+					this.showType = 'task'
+					this.tablePage.currentPage = 0
 				}
 				this.tablePage.currentPage = ++ this.tablePage.currentPage;
 				//联网加载数据
@@ -419,6 +468,12 @@
 					} else {
 						this.status = 'loadmore'
 					}
+
+					if(this.showType === 'history'){
+						this.dataList = []
+						this.tablePage.currentPage = 0;
+						this.haveDone()
+					}
 				})
 
 				notifyService.getUnreadCountByIsSelf({
@@ -429,6 +484,62 @@
 				})
 
 			},
+			//已办数据
+			async haveDone() {
+
+				if(this.showType === 'task'){
+					this.dataList = [];
+					this.showType = 'history';
+					this.tablePage.currentPage = 0;
+				}
+				this.tablePage.currentPage++;
+				this.status = 'loading';
+
+				try {
+					// 获取历史数据
+					const data = await taskService.historicList({
+						current: this.tablePage.currentPage,
+						size: this.tablePage.pageSize,
+						orders: this.tablePage.orders,
+						...this.searchForm
+					});
+
+					// 使用 for...of 和 await 来处理异步操作
+					for (const value of data.records) {
+						if('垃圾处理流程' === value.processDefinitionName && '1' === value.vars.disposeType ){
+							if(!value.currentTask){
+								const rubbishStation = await disposeRubbishService.getByProcInsId(value.processInstanceId);
+								value.weight = rubbishStation.weight;
+								value.transportMileage = rubbishStation.transportMileage;
+								value.subsidy = rubbishStation.subsidy;
+							}
+						}
+					}
+
+					this.dataList = this.dataList.concat(data.records);
+					this.tablePage.pages = data.pages;
+					this.status = this.tablePage.pages <= this.tablePage.currentPage ? 'nomore' : 'loadmore';
+
+					if(this.showType === 'task'){
+						this.dataList = []
+						this.tablePage.currentPage = 0;
+						this.loadmore()
+					}
+				} catch (error) {
+					console.error('Error loading data:', error);
+				}
+
+				try {
+					// 获取未读通知数量
+					const unreadCount = await notifyService.getUnreadCountByIsSelf({
+						isSelf: true,
+						...this.searchForm
+					});
+					EventBus.$emit('dataFromMessage', unreadCount);
+				} catch (error) {
+					console.error('Error getting unread count:', error);
+				}
+			},
 			...mapActions(['refreshUserInfo']),
 			toApplyList (mail) {
 				uni.navigateTo({