linwei
2024-02-19 4ad3abe30fa55efbb0f7c27dbf43ebe74dabb273
src/views/work/process/maintenanceFundApply/handle.vue
@@ -1,44 +1,18 @@
<template>
  <basic-container>
    <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-row type="flex" class="row-bg" justify="end">
      <!-- <el-row type="flex" class="row-bg" justify="end">
        <el-form-item>
          <el-button type="primary" @click="handleAgree">同意</el-button>
          <el-button type="danger" @click="handleDisagree">驳回</el-button>
          <el-button @click="handleCancel">关闭</el-button>
        </el-form-item>
      </el-row>
      </el-row> -->
      <el-card shadow="hover">
        <div slot="header">
          <span>审批信息</span>
        </div>
        <avue-form :option="option" :value="form"></avue-form>
        <!-- <el-form-item label="申请人">
          <el-input :disabled="true" v-model="form.flow.assigneeName" />
        </el-form-item>
        <el-row>
          <el-col :span="12">
            <el-form-item label="开始时间">
              <el-input :disabled="true" v-model="form.startTime" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="结束时间">
              <el-input :disabled="true" v-model="form.endTime" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="请假理由">
          <el-input :disabled="true" type="textarea" v-model="form.reason" />
        </el-form-item>
        <el-form-item label="批复意见">
          <el-input type="textarea" v-model="form.comment" />
        </el-form-item> -->
        <avue-form :option="option" v-model="form"></avue-form>
      </el-card>
      <el-card shadow="hover">
        <div slot="header">
@@ -48,10 +22,13 @@
          <el-timeline>
            <el-timeline-item :key="flow.id" :timestamp="flow.createTime" v-for="flow in flowList" placement="top">
              <el-card shadow="hover">
                <p>{{flow.assigneeName}} 在 [{{flow.createTime}}] 开始处理 [{{flow.historyActivityName}}] 环节</p>
                <p v-if="flow.historyActivityDurationTime!==''">任务历时 [{{flow.historyActivityDurationTime}}]</p>
                <p v-if="flow.comment!==''">批复意见: [{{flow.comment}}]</p>
                <p v-if="flow.endTime!==''">结束时间: [{{flow.endTime}}]</p>
                <p>{{ flow.assigneeName }} 在 [{{ flow.createTime }}] 开始处理 [{{ flow.historyActivityName }}]
                  环节</p>
                <p v-if="flow.historyActivityDurationTime !== ''">任务历时 [{{ flow.historyActivityDurationTime
                                }}]
                </p>
                <p v-if="flow.comment !== ''">批复意见: [{{ flow.comment }}]</p>
                <p v-if="flow.endTime !== ''">结束时间: [{{ flow.endTime }}]</p>
              </el-card>
            </el-timeline-item>
          </el-timeline>
@@ -66,6 +43,21 @@
        </el-row>
      </el-card>
    </el-form>
    <!-- <div style="">
      <el-button type="primary" @click="handleAgree">同意</el-button>
      <el-button type="danger" @click="handleDisagree">驳回</el-button>
    </div> -->
    <div style="text-align: center;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 10px;">
      <el-button type="primary" @click="handleAgree">同意</el-button>
      <el-button type="danger" @click="handleDisagree">驳回</el-button>
    </div>
  </basic-container>
</template>
@@ -73,7 +65,7 @@
  import {
    historyFlowList,
    leaveDetail
  } from "@/api/work/process";
  } from "@/api/work/process"
  import {
    getList,
@@ -81,10 +73,11 @@
    update,
    add,
    getPropertyCapitalApply
  } from "@/api/property/propertyCapitalApply";
  } from "@/api/property/propertyCapitalApply"
  import {
    completeTask
  } from "@/api/work/work";
  } from "@/api/work/work"
  import website from '@/config/website'
  export default {
    data() {
@@ -101,7 +94,6 @@
          startTime: '',
          endTime: '',
          reason: '',
          comment: '',
        },
        option: {
          height: "auto",
@@ -192,7 +184,7 @@
              prop: "allocationWay",
              labelWidth: 140,
              value: '按建筑面积分摊',
              span: 14,
              span: 12,
              row: true,
              disabled: true
            },
@@ -297,33 +289,34 @@
                trigger: "blur",
              }, ],
            },
            // {
            //   label: '施工方案附件',
            //   prop: 'constructionSchemeUrls',
            //   type: 'upload',
            //   span: 24,
            //   hide: true,
            //   labelWidth: 140,
            //   multiple: true,
            //   // showFileList: true,
            //   propsHttp: {
            //     res: 'data',
            //     name: "originalName",
            //     url: "link"
            //   },
            //   action: '/api/blade-resource/oss/endpoint/put-file-attach',
            //   rules: [{
            //     required: true,
            //     message: "请上传施工方案",
            //     trigger: "blur",
            //   }, ],
            // }
            {
              label: '施工方案附件',
              prop: 'constructionSchemeUrls',
              type: 'upload',
              listType: 'picture-img',
              span: 24,
              hide: true,
              labelWidth: 140,
              multiple: true,
              // showFileList: true,
              propsHttp: {
                res: 'data',
                name: "originalName",
                url: "link"
              },
              action: '/api/blade-resource/oss/endpoint/put-file-attach',
              rules: [{
                required: true,
                message: "请上传施工方案",
                trigger: "blur",
              }, ],
            }
          ],
        }
      }
    },
    created() {
      this.init();
      this.init()
    },
    beforeRouteUpdate(to, from, next) {
      // 在当前路由改变,但是该组件被复用时调用
@@ -331,83 +324,96 @@
      // 由于会渲染同样的 Foo 组件,因此组件实例会被复用。而这个钩子就会在这个情况下被调用
      // 可以访问组件实例 `this`
      if (to.fullPath !== from.fullPath) {
        next();
        this.init();
        next()
        this.init()
      }
    },
    methods: {
      init() {
        this.taskId = this.$route.params.taskId;
        this.processInstanceId = this.$route.params.processInstanceId;
        this.businessId = this.$route.params.businessId;
        this.taskId = this.$route.params.taskId
        this.processInstanceId = this.$route.params.processInstanceId
        this.businessId = this.$route.params.businessId
        historyFlowList(this.processInstanceId).then(res => {
          const data = res.data;
          const data = res.data
          if (data.success) {
            this.flowList = data.data;
            this.flowList = data.data
          }
        })
        getPropertyCapitalApply(this.businessId).then(res => {
          const data = res.data;
          const data = res.data
          if (data.success) {
            this.form = data.data;
            data.data.constructionSchemeUrls = website.minioUrl + data.data.constructionSchemeUrls
            this.form = data.data
          }
        })
      },
      handleAgree() {
        this.form.comment = '同意'
        if (!this.form.comment) {
          this.$message.warning('请先填写批复意见');
          return;
          this.$message.warning('请先填写批复意见')
          return
        }
        const params = {
          taskId: this.taskId,
          processInstanceId: this.processInstanceId,
          flag: 'ok',
          comment: this.form.comment,
        };
        }
        completeTask(params).then(res => {
          const data = res.data;
          const data = res.data
          if (data.success) {
            this.$message.success(data.msg);
            this.$router.$avueRouter.closeTag();
            this.$message.success(data.msg)
            this.$router.$avueRouter.closeTag()
            this.$router.push({
              path: `/work/todo`
            });
            })
          } else {
            this.$message.error(data.msg || '提交失败');
            this.$message.error(data.msg || '提交失败')
          }
        })
      },
      handleDisagree() {
        this.form.comment = '不同意'
        if (!this.form.comment) {
          this.$message.warning('请先填写批复意见');
          return;
          this.$message.warning('请先填写批复意见')
          return
        }
        const params = {
          taskId: this.taskId,
          processInstanceId: this.processInstanceId,
          comment: this.form.comment,
        };
        }
        completeTask(params).then(res => {
          const data = res.data;
          const data = res.data
          if (data.success) {
            this.$message.success(data.msg);
            this.$router.$avueRouter.closeTag();
            this.$message.success(data.msg)
            this.$router.$avueRouter.closeTag()
            this.$router.push({
              path: `/work/todo`
            });
            })
          } else {
            this.$message.error(data.msg || '提交失败');
            this.$message.error(data.msg || '提交失败')
          }
        })
      },
      handleCancel() {
        this.$router.$avueRouter.closeTag();
        this.$router.$avueRouter.closeTag()
        this.$router.push({
          path: `/work/todo`
        });
        })
      }
    }
  }
</script>
</script>
<style scoped>
  .container {
    position: relative;
    /* 确保按钮相对于该元素定位 */
  }
  #myButton {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
  }
</style>