Преглед изворни кода

feat(bpm): 添加事故事件报告审批组件

yusheng пре 1 недеља
родитељ
комит
7e411e223a

+ 12 - 0
src/api/bpm/components/accidentReport/index.js

@@ -0,0 +1,12 @@
+import request from '@/utils/request';
+
+
+// 详情
+export async function getById(id) {
+  const res = await request.get(`/ehs/accidentIncidents/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 269 - 0
src/views/bpm/handleTask/components/accidentReport/detailDialog.vue

@@ -0,0 +1,269 @@
+<template>
+  <el-form
+    ref="form"
+    :model="form"
+    :rules="rules"
+    label-width="130px"
+    class="el-form-box"
+  >
+    <!-- 事故事件信息 -->
+    <header-title title="事故事件信息"></header-title>
+    <el-row :gutter="20">
+      <el-col :span="8">
+        <el-form-item label="事故事件名称:" prop="acdntName">
+          <el-input v-model="form.acdntName" placeholder="请输入" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="8">
+        <el-form-item label="发生时间:" prop="occurrenceTime">
+          <el-date-picker
+            v-model="form.occurrenceTime"
+            type="datetime"
+            placeholder="请选择"
+            disabled
+            style="width: 100%"
+            value-format="yyyy-MM-dd HH:mm:ss"
+          ></el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col :span="8">
+        <el-form-item label="事故发生地点:" prop="acdntPlace">
+          <el-input v-model="form.acdntPlace" placeholder="请输入" disabled />
+        </el-form-item>
+      </el-col>
+    </el-row>
+
+    <el-row :gutter="20">
+      <el-col :span="24">
+        <el-form-item label="事故事件经过:" prop="acdntPass">
+          <el-input
+            v-model="form.acdntPass"
+            type="textarea"
+            :rows="3"
+            placeholder="请输入"
+            disabled
+          />
+        </el-form-item>
+      </el-col>
+    </el-row>
+
+    <el-row :gutter="20">
+      <el-col :span="8">
+        <el-form-item label="上报人:" prop="reportPersonName">
+          <el-input
+            v-model="form.reportPersonName"
+            placeholder="请选择"
+            disabled
+          >
+          </el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="8">
+        <el-form-item label="上报部门:" prop="reportDeptName">
+          <el-input
+            v-model="form.reportDeptName"
+            placeholder="自动带出"
+            disabled
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="8">
+        <el-form-item label="上报时间:" prop="reportTime">
+          <el-date-picker
+            v-model="form.reportTime"
+            type="datetime"
+            placeholder="请选择"
+            disabled
+            style="width: 100%"
+            value-format="yyyy-MM-dd HH:mm:ss"
+          ></el-date-picker>
+        </el-form-item>
+      </el-col>
+    </el-row>
+
+    <!-- 调查处理信息 -->
+    <header-title title="调查处理信息" style="margin-top: 10px"></header-title>
+    <el-row :gutter="20">
+      <el-col :span="8">
+        <el-form-item label="事故级别:" prop="acdntLevelId">
+          <el-input
+            v-model="form.acdntLevelName"
+            placeholder="自动带出"
+            disabled
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="8">
+        <el-form-item label="事故事件类型:" prop="acdntTypeId">
+          <el-input
+            v-model="form.acdntTypeName"
+            placeholder="自动带出"
+            disabled
+          />
+        </el-form-item>
+      </el-col>
+    </el-row>
+
+    <el-row :gutter="20">
+      <el-col :span="24">
+        <el-form-item label="事故原因:" prop="acdntCauselText">
+          <el-input
+            v-model="form.acdntCauselText"
+            type="textarea"
+            :rows="3"
+            placeholder="请输入"
+            disabled
+          />
+        </el-form-item>
+      </el-col>
+    </el-row>
+
+    <el-row :gutter="20">
+      <el-col :span="8">
+        <el-form-item label="事故责任人:" prop="dutyPersonName">
+          <el-input
+            v-model="form.dutyPersonName"
+            placeholder="请选择"
+            disabled
+            readonly
+          >
+          </el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="8">
+        <el-form-item label="责任单位:" prop="dutyUnitName">
+          <el-input
+            v-model="form.dutyUnitName"
+            placeholder="自动带出"
+            disabled
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="8">
+        <el-form-item label="间接经济损失:" prop="indirectEconomicLoss">
+          <el-input
+            v-model="form.indirectEconomicLoss"
+            disabled
+            placeholder="请输入"
+            style="width: 100%"
+          >
+            <template slot="append">万元</template>
+          </el-input>
+        </el-form-item>
+      </el-col>
+    </el-row>
+
+    <el-row :gutter="20">
+      <el-col :span="8">
+        <el-form-item label="直接经济损失:" prop="directEconomicLoss">
+          <el-input
+            v-model="form.directEconomicLoss"
+            disabled
+            placeholder="请输入"
+            style="width: 100%"
+          >
+            <template slot="append">万元</template>
+          </el-input>
+        </el-form-item>
+      </el-col>
+    </el-row>
+
+    <!-- 伤亡人员列表 -->
+    <header-title title="伤亡人员列表" style="margin-top: 10px"></header-title>
+
+    <el-table
+      :data="form.casualtyList"
+      border
+      style="width: 100%; margin-bottom: 20px"
+      max-height="300"
+    >
+      <el-table-column
+        type="index"
+        label="序号"
+        width="60"
+        align="center"
+      ></el-table-column>
+      <el-table-column label="姓名" min-width="140" align="center">
+        <template slot-scope="scope">
+          <el-input v-model="scope.row.injuredName" readonly />
+        </template>
+      </el-table-column>
+      <el-table-column label="所属单位" min-width="150" align="center">
+        <template slot-scope="scope">
+          <el-input v-model="scope.row.belongUnit" readonly />
+        </template>
+      </el-table-column>
+      <el-table-column label="受伤程度" min-width="140" align="center">
+        <template slot-scope="scope"> </template>
+      </el-table-column>
+      <el-table-column label="损失工作日" min-width="120" align="center">
+        <template slot-scope="scope">
+          <el-input-number
+            v-model="scope.row.lostWorkDays"
+            :disabled="isView"
+            :controls="false"
+            :min="0"
+            placeholder="请输入"
+            style="width: 100%"
+          />
+        </template>
+      </el-table-column>
+    </el-table>
+  </el-form>
+</template>
+
+<script>
+  import { getById } from '@/api/bpm/components/accidentReport/index.js';
+  const defForm = {
+    acdntName: '',
+    occurrenceTime: '',
+    acdntPlace: '',
+    acdntPass: '',
+    reportPersonName: '',
+    reportPersonUserId: '',
+    reportDeptName: '',
+    reportDeptId: '',
+    reportTime: '',
+    acdntLevelName: '',
+    acdntLevelId: '',
+    acdntTypeName: '',
+    acdntTypeId: '',
+    acdntCauselText: '',
+    dutyUnitId: '',
+    dutyUnitName: '',
+    dutyPersonName: '',
+    dutyPersonId: '',
+    indirectEconomicLoss: undefined,
+    directEconomicLoss: undefined,
+    casualtyList: []
+  };
+  export default {
+    data() {
+      return {
+        form: {
+          ...defForm
+        },
+        rules: {}
+      };
+    },
+    props: {
+      businessId: {
+        default: ''
+      }
+    },
+    created() {
+      this.init();
+    },
+
+    methods: {
+      // 打开弹窗
+      async init() {
+        this.form = await getById(this.businessId);
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  
+</style>

+ 134 - 0
src/views/bpm/handleTask/components/accidentReport/submit.vue

@@ -0,0 +1,134 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <el-form-item
+        label="审批建议"
+        style="margin-bottom: 20px"
+        :rules="{
+          required: true,
+          message: '请选择',
+          trigger: 'change'
+        }"
+      >
+        <el-input
+          type="textarea"
+          v-model="form.reason"
+          placeholder="请输入审批建议"
+        />
+      </el-form-item>
+    </el-form>
+    <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        v-click-once
+        @click="handleAudit(1)"
+        >通过
+      </el-button>
+
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        v-click-once
+        @click="handleAudit(0)"
+        >驳回
+      </el-button>
+      <el-dropdown
+        @command="(command) => handleCommand(command)"
+        style="margin-left: 30px"
+      >
+        <span class="el-dropdown-link">
+          更多<i class="el-icon-arrow-down el-icon--right"></i>
+        </span>
+        <el-dropdown-menu slot="dropdown">
+          <el-dropdown-item command="cancel">作废</el-dropdown-item>
+        </el-dropdown-menu>
+      </el-dropdown>
+    </div>
+  </el-col>
+</template>
+
+<script>
+  import { approveTaskWithVariables, rejectTask,cancelTask } from '@/api/bpm/task';
+
+  export default {
+    name: '',
+
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        visible: false,
+        form: {
+          reason: '同意'
+        },
+       
+      };
+    },
+    created() {},
+    methods: {
+      async handleAudit(status) {
+        await this._approveTaskWithVariables(status);
+      },
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm('是否确认作废?', {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
+          })
+            .then(() => {
+              cancelTask({
+                id: this.id,
+                taskId: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
+        }
+      },
+      async _approveTaskWithVariables(status) {
+        let variables = {
+          pass: !!status
+        };
+        let API = !!status ? approveTaskWithVariables : rejectTask;
+        API({
+          id: this.taskId,
+          reason: this.form.reason,
+          variables
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
+          }
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>