Переглянути джерело

离职交接审批流程以及离职审批流程

lizhenhao 2 роки тому
батько
коміт
6de0485d60

+ 7 - 0
src/api/changes/dimission/DimissionHandoverService.js

@@ -29,4 +29,11 @@ export default class DimissionHandoverService {
       data: inputForm
     })
   }
+  updateStatusById (params) {
+    return request({
+      url: '/changes/dimission_handover/updateByCdId',
+      method: 'post',
+      data: params
+    })
+  }
 }

+ 7 - 0
src/api/changes/dimission/DimissionService.js

@@ -36,4 +36,11 @@ export default class DimissionService {
       params: {id: id}
     })
   }
+  updateVettingStatusById (params) {
+    return request({
+      url: '/changes/dimission/updateVettingStatusById',
+      method: 'post',
+      data: params
+    })
+  }
 }

+ 355 - 0
src/views/modules/changes/dimission/DimissionAuditForm.vue

@@ -0,0 +1,355 @@
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
+  <div>
+      <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="formReadOnly"
+               label-width="125px" @submit.native.prevent>
+        <el-row  :gutter="15">
+          <el-col :span="12">
+            <el-form-item label="姓名" prop="rosterId"
+                          :rules="[{required: true, message: '姓名不能为空', trigger: 'blur'},{required: true, message: '姓名不能为空', trigger: 'change'}]"
+            >
+              <!--              <el-select :disabled="method === 'sure'" v-model="inputForm.rosterId" style="width:100%" placeholder="请选择姓名">-->
+              <!--                <el-option-->
+              <!--                  v-for="item in supervisorList"-->
+              <!--                  :key="item.id"-->
+              <!--                  :label="item.name"-->
+              <!--                  :value="item.id">-->
+              <!--                </el-option>-->
+              <!--              </el-select>-->
+              <!--              <el-input style="width:100%" v-model="inputForm.rosterId" placeholder="请填写姓名"  disabled  >-->
+              <!--                <el-button slot="append" @click="openRoster" icon="el-icon-search"></el-button>-->
+              <!--              </el-input>-->
+              <RosterSelectForm :limit='1' :disabled="true" :readonly="true" :value="inputForm.rosterId" @getValue='(value) => {inputForm.rosterId=value}'></RosterSelectForm>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="申请日期" prop="requestDate"
+                          :rules="[{required: true, message: '申请日期不能为空', trigger: 'blur'}]">
+              <el-date-picker
+                :disabled="true"
+                placement="bottom-start"
+                style="width: 100%"
+                v-model="inputForm.requestDate"
+                type="date"
+                placeholder="选择申请日期">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="离职类型" prop="type"
+                          :rules="[{required: true, message: '离职类型不能为空', trigger: 'blur'}
+                 ]">
+              <el-radio v-for="item in $dictUtils.getDictList('dimission_type')" v-model="inputForm.type"
+                        :label="item.value" :value="item.value" :key="item.value" size="mini" style="margin-right: 0px" border>
+                {{item.label}}</el-radio>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="离职原因" prop="reaTypeList"
+                          :rules="[{required: true, message: '离职原因不能为空', trigger: 'blur'}
+                 ]">
+              <el-select v-model="inputForm.reaTypeList" multiple placeholder="请选择离职原因"  style="width:100%;">
+                <el-option
+                  v-for="item in $dictUtils.getDictList('dimission_reason')"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="24">
+            <el-form-item label="原因说明" prop="reasonDesc"
+                          :rules="[
+                 ]">
+              <el-input type="textarea" style="width:100%" maxlength="1000" v-model="inputForm.reasonDesc" placeholder="请填写原因说明"     ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="离职日期" prop="dimissionDate"
+                          :rules="[{required: true, message: '离职日期不能为空', trigger: 'blur'}
+                 ]">
+              <el-date-picker
+                placement="bottom-start"
+                style="width: 100%"
+                v-model="inputForm.dimissionDate"
+                type="date"
+                placeholder="选择离职日期">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="最后工作日期" prop="lastWorkDate"
+                          :rules="[{required: true, message: '最后工作日期不能为空', trigger: 'blur'}
+                 ]">
+              <el-date-picker
+                placement="bottom-start"
+                style="width: 100%"
+                v-model="inputForm.lastWorkDate"
+                type="date"
+                placeholder="选择最后工作日期">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="薪资结算日期" prop="payrollSettlementDate"
+                          :rules="[{required: true, message: '薪资结算日期不能为空', trigger: 'blur'}
+                 ]">
+              <el-date-picker
+                placement="bottom-start"
+                style="width: 100%"
+                v-model="inputForm.payrollSettlementDate"
+                type="date"
+                placeholder="选择薪资结算日期">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="备注" prop="remarks"
+                          :rules="[
+                 ]">
+              <el-input type="textarea" style="width:100%" maxlength="1000" v-model="inputForm.remarks" placeholder="请填写备注"     ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row v-if="method === 'sure'">
+          <el-divider content-position="left"><i class="el-icon-document"></i> 福利缴纳</el-divider>
+          <el-col :span="12">
+            <el-form-item label="社保最后缴纳月:" prop="socialSecurityLast"
+                          :rules="[]"
+            >
+              <el-date-picker
+                v-model="inputForm.socialSecurityLast"
+                type="month"
+                value-format="yyyy-MM"
+                placement="bottom-start"
+                placeholder="选择月">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="公积金后缴纳月:" prop="providentFundLast"
+                          :rules="[]"
+            >
+              <el-date-picker
+                v-model="inputForm.providentFundLast"
+                type="month"
+                value-format="yyyy-MM"
+                placement="bottom-start"
+                placeholder="选择月">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      <!--        附件-->
+      <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+        <el-row style="margin-top: 40px;margin-bottom: 20px">
+          <el-divider content-position="left"><i class="el-icon-document"></i> 审批流程</el-divider>
+          <el-col :span="24" style="margin-top: 10px">
+            <el-form-item label="选择审批人:" prop="handoverId"
+                          :rules="[{required: true, message: '审批人不能为空', trigger: 'blur'},{required: true, message: '审批人不能为空', trigger: 'change'}]"
+            >
+              <UserSelect :disabled="formReadOnly" :limit='1' :value="inputForm.handoverId" @getValue='(value) => {inputForm.handoverId = value}'></UserSelect>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+  </div>
+</template>
+
+<script>
+  import DimissionService from '@/api/changes/dimission/DimissionService'
+  import RosterService from '@/api/roster/RosterService'
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import UserSelect from '@/components/userSelect'
+  import RosterSelectForm from '@/views/common/RosterSelectForm'
+  export default {
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      }
+    },
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        inputForm: {
+          id: '',
+          remarks: '',
+          rosterId: '',
+          lastWorkDate: '',
+          dimissionDate: '',
+          reasonDesc: '',
+          type: '',
+          vettingStatus: '',
+          handoverStatus: '',
+          status: '',
+          payrollSettlementDate: '',
+          requestDate: '',
+          reaTypeList: [],
+          changesDimissionFilesDTOList: [],
+          handoverId: '',
+          socialSecurityLast: [],
+          providentFundLast: []
+        },
+        supervisorList: []
+      }
+    },
+    dimissionService: null,
+    rosterService: null,
+    created () {
+      this.dimissionService = new DimissionService()
+      this.rosterService = new RosterService()
+    },
+    watch: {
+      'businessId': {
+        handler (newVal) {
+          if (this.businessId) {
+            if (this.businessId !== 'false') {
+              this.rosterService = new RosterService()
+              this.init('audit', this.businessId)
+            }
+          } else {
+            this.$nextTick(() => {
+              this.$refs.inputForm.resetFields()
+            })
+          }
+        },
+        immediate: true,
+        deep: false
+      }
+    },
+    components: {
+      UpLoadComponent,
+      RosterSelectForm,
+      UserSelect
+    },
+    methods: {
+      init (method, id) {
+        this.method = method
+        this.queryAllSupervisor()
+        this.inputForm = {
+          id: '',
+          createBy: '',
+          remarks: '',
+          rosterId: '',
+          lastWorkDate: '',
+          dimissionDate: '',
+          reasonDesc: '',
+          type: '',
+          vettingStatus: '',
+          handoverStatus: '',
+          status: '',
+          payrollSettlementDate: '',
+          requestDate: '',
+          reaTypeList: [],
+          changesDimissionFilesDTOList: [],
+          handoverId: '',
+          socialSecurityLast: [],
+          providentFundLast: []
+        }
+        this.inputForm.id = id
+        if (method === 'audit') {
+          this.title = '离职审批'
+        }
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          this.$refs.inputForm.resetFields()
+          this.loading = true
+          this.dimissionService.queryById(this.inputForm.id).then(({data}) => {
+            this.inputForm = this.recover(this.inputForm, data)
+            this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+            if (this.formReadOnly === true) {
+              method = 'view'
+            }
+            this.$refs.uploadComponent.newUpload(method, this.inputForm.changesDimissionFilesDTOList, 'dimission')
+            this.loading = false
+          })
+        })
+      },
+      saveForm (callback) {
+        this.doSubmit('save', callback)
+      },
+      startForm (callback) {
+        this.doSubmit('start', callback)
+      },
+      agreeForm (callback) {
+        this.doSubmit('agree', callback)
+      },
+      // 表单提交
+      doSubmit (status, callback) {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            this.checkMoment()
+            this.inputForm.changesDimissionFilesDTOList = this.$refs.uploadComponent.getDataList()
+            if (status === 'save') {
+              // 暂存
+              this.inputForm.vettingStatus = '3'
+            } else if (status === 'start') {
+              // 送审  待审核
+              this.inputForm.vettingStatus = '4'
+            } else if (status === 'agree') {
+              // 审核同意
+              this.inputForm.vettingStatus = '6'
+            }
+            this.dimissionService.save(this.inputForm).then(({data}) => {
+              this.inputForm.assignee = this.inputForm.handoverId
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      updateStatusById (type) {
+        if (type === 'agree') {
+          // 同意
+          this.inputForm.vettingStatus = '6'
+        }
+        if (type === 'reject') {
+          // 驳回
+          this.inputForm.vettingStatus = '5'
+        }
+        if (type === 'reback') {
+          // 撤回   撤回即回到暂存
+          this.inputForm.vettingStatus = '3'
+        }
+        this.dimissionService.updateVettingStatusById(this.inputForm)
+      },
+      close () {
+        this.selectData = []
+        this.$refs.uploadComponent.clearUpload()
+        this.$refs.inputForm.resetFields()
+        this.visible = false
+      },
+      checkMoment () {
+        this.inputForm.lastWorkDate = this.moment(this.inputForm.lastWorkDate).format('YYYY-MM-DD HH:mm:ss')
+        this.inputForm.dimissionDate = this.moment(this.inputForm.dimissionDate).format('YYYY-MM-DD HH:mm:ss')
+        this.inputForm.payrollSettlementDate = this.moment(this.inputForm.payrollSettlementDate).format('YYYY-MM-DD HH:mm:ss')
+        this.inputForm.requestDate = this.moment(this.inputForm.requestDate).format('YYYY-MM-DD HH:mm:ss')
+      },
+      queryAllSupervisor () {
+        this.rosterService.list({
+          'current': '1',
+          'size': '-1'
+        }).then(({data}) => {
+          this.supervisorList = JSON.parse(JSON.stringify(data.records))
+        })
+      }
+    }
+  }
+</script>

+ 5 - 0
src/views/modules/changes/dimission/DimissionForm.vue

@@ -286,6 +286,11 @@
               this.inputForm.changesDimissionFilesDTOList = this.$refs.uploadComponent.getDataList()
             }
             this.inputForm.status = status
+            if (status === '2') {
+              if (this.inputForm.vettingStatus === '1' || this.inputForm.vettingStatus === '3' || this.inputForm.vettingStatus === '5') {
+                this.inputForm.vettingStatus = '2'
+              }
+            }
             this.dimissionService.save(this.inputForm).then(({data}) => {
               this.close()
               this.$message.success(data)

+ 42 - 9
src/views/modules/changes/dimission/DimissionHandoverForm.vue

@@ -92,7 +92,7 @@
                     <el-form-item :prop="'handoverDTOList.'+scope.$index+'.rosterId'" :rules="[
                     {required: true, message: '人员姓名不能为空', trigger: 'blur'},{required: true, message: '人员姓名不能为空', trigger: 'change'}]">
 <!--                      <RosterSelectForm :limit='1' :value="inputForm.handoverDTOList[scope.$index].rosterId" @getValue='(value) => {$set(inputForm.handoverDTOList[scope.$index],"rosterId", value)}'></RosterSelectForm>-->
-                      <UserSelect :limit='1' :value="inputForm.handoverDTOList[scope.$index].rosterId" @getValue='(value) => {$set(inputForm.handoverDTOList[scope.$index],"rosterId", value)}'></UserSelect>
+                      <UserSelect :disabled="formReadOnly" :limit='1' :value="inputForm.handoverDTOList[scope.$index].rosterId" @getValue='(value) => {$set(inputForm.handoverDTOList[scope.$index],"rosterId", value)}'></UserSelect>
                     </el-form-item>
                   </template>
                 </el-table-column>
@@ -160,8 +160,7 @@
           cdId: '',
           handoverDTOList: []
         },
-        tableKey: 0,
-        contentList: ['工作交接', '回收工作邮箱', '回收工作电话', '回收系统账号', '回收门禁等权限', '回收笔记本']
+        tableKey: 0
       }
     },
     watch: {
@@ -247,17 +246,36 @@
           })
         })
       },
-      // 表单提交
-      doSubmit () {
-        console.log(this.inputForm)
+      saveForm (callback) {
+        this.submit('save', callback)
+      },
+      startForm (callback) {
+        this.submit('start', callback)
+      },
+      agreeForm (callback) {
+        this.submit('agree', callback)
+      },
+      // 暂存/送审/同意
+      submit (handoverStatus, callback) {
+        console.log('handoverStatus', handoverStatus)
         this.$refs['inputForm'].validate((valid) => {
           if (valid) {
             this.loading = true
+            if (handoverStatus === 'save') {
+              // 暂存
+              this.inputForm.handoverStatus = '2'
+            } else if (handoverStatus === 'start') {
+              // 送审
+              this.inputForm.handoverStatus = '3'
+            } else if (handoverStatus === 'agree') {
+              // 审核同意
+              this.inputForm.handoverStatus = '4'
+            }
             this.inputForm.cdId = this.inputForm.id
             this.dimissionHandoverService.save(this.inputForm).then(({data}) => {
-              this.close()
-              this.$message.success(data)
-              this.$emit('refreshDataList')
+              this.inputForm.assignee = this.inputForm.handoverDTOList[0].rosterId
+              console.log('rosterId', this.inputForm.assignee)
+              callback(data.businessTable, data.businessId, this.inputForm)
               this.loading = false
             }).catch(() => {
               this.loading = false
@@ -265,6 +283,21 @@
           }
         })
       },
+      updateStatusById (type) {
+        if (type === 'agree') {
+          // 同意
+          this.inputForm.handoverStatus = '4'
+        }
+        if (type === 'reject') {
+          // 驳回
+          this.inputForm.handoverStatus = '5'
+        }
+        if (type === 'reback') {
+          // 撤回   撤回即回到暂存
+          this.inputForm.handoverStatus = '2'
+        }
+        this.dimissionHandoverService.updateStatusById(this.inputForm)
+      },
       close () {
         this.selectData = []
         this.$refs.inputForm.resetFields()

+ 184 - 34
src/views/modules/changes/dimission/DimissionList.vue

@@ -39,13 +39,27 @@
           :checkbox-config="{}">
           <vxe-column type="seq" width="40"></vxe-column>
           <vxe-column type="checkbox"  width="40px"></vxe-column>
-          <vxe-column width="200" title="姓名" field="rosterBaseDTO.name">
+          <vxe-column width="150" title="姓名" field="rosterBaseDTO.name">
             <template slot-scope="scope">
               <el-link  type="primary" :underline="false" v-if="hasPermission('changes:dimission:view')"  @click="view(scope.row.id)">{{!commonJS.isEmpty(scope.row.rosterBaseDTO.name)?scope.row.rosterBaseDTO.name:'--'}}</el-link>
               <span v-else>{{!commonJS.isEmpty(scope.row.rosterBaseDTO.name)?scope.row.rosterBaseDTO.name:'--'}}</span>
             </template>
           </vxe-column>
-
+          <vxe-column width="120" title="离职审批" field="vettingStatus">
+            <template slot-scope="scope">
+              {{$dictUtils.getDictLabel('vetting_status', scope.row.vettingStatus, '-')}}
+            </template>
+          </vxe-column>
+          <vxe-column width="120" title="离职交接" field="handoverStatus">
+            <template slot-scope="scope">
+              {{$dictUtils.getDictLabel('handover_status', scope.row.handoverStatus, '-')}}
+            </template>
+          </vxe-column>
+          <vxe-column width="120" title="离职状态" field="status">
+            <template slot-scope="scope">
+              {{$dictUtils.getDictLabel('dimission_status', scope.row.status, '-')}}
+            </template>
+          </vxe-column>
           <vxe-column width="200" title="工号" field="rosterBaseDTO.jobNo"></vxe-column>
           <vxe-column width="200" title="部门" field="soName"></vxe-column>
           <vxe-column width="200" title="职位" field="jpName"></vxe-column>
@@ -65,47 +79,76 @@
             </template>
           </vxe-column>
           <vxe-column width="200" title="备注" field="remarks"></vxe-column>
-          <vxe-column width="200" title="离职审批" field="vettingStatus">
-            <template slot-scope="scope">
-              {{$dictUtils.getDictLabel('vetting_status', scope.row.vettingStatus, '-')}}
-            </template>
-          </vxe-column>
-          <vxe-column width="200" title="离职交接" field="handoverStatus">
-            <template slot-scope="scope">
-              {{$dictUtils.getDictLabel('handover_status', scope.row.handoverStatus, '-')}}
-            </template>
-          </vxe-column>
-          <vxe-column width="200" title="离职状态" field="status">
-            <template slot-scope="scope">
-              {{$dictUtils.getDictLabel('dimission_status', scope.row.status, '-')}}
-            </template>
-          </vxe-column>
+
 
           <vxe-column title="操作" width="50px" fixed="right" align="center">
             <template  slot-scope="scope">
               <el-dropdown size="small"  @command="handleCommand">
                     <span class="el-dropdown-link">
-                      . . .
+                      更多
                     </span>
                 <el-dropdown-menu slot="dropdown">
                   <el-dropdown-item  v-if="hasPermission('changes:dimission:view')" :command="{method:'view', id:scope.row.id}">
                     查看
                   </el-dropdown-item>
-                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&scope.row.status === '1'" :command="{method:'edit', id:scope.row.id}">
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '1')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '3')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '5')
+                                          "
+                                    :command="{method:'edit', id:scope.row.id}">
                     修改
                   </el-dropdown-item>
-                  <el-dropdown-item v-if="hasPermission('changes:dimission:del')&&scope.row.status === '1'" :command="{method:'del', id:scope.row.id}">
-                    删除
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:del')&&
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '1')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '3')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '5')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '6')
+                                          "
+                                    :command="{method:'del', id:scope.row.id}">
+                    放弃离职
                   </el-dropdown-item>
-                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&scope.row.status === '1'" :command="{method:'sure', id:scope.row.id}">
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '1')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '3')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '5')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '6')
+                                          "
+                                    :command="{method:'sure', id:scope.row.id}">
                     确认离职
                   </el-dropdown-item>
-                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&scope.row.status === '2'" :command="{method:'removeSure', id:scope.row.id}">
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&
+                                              (scope.row.handoverStatus === '1'&&scope.row.status === '2')||
+                                              (scope.row.handoverStatus === '2'&&scope.row.status === '2')||
+                                              (scope.row.handoverStatus === '5'&&scope.row.status === '2')"
+                                    :command="{method:'removeSure', row:scope.row}">
                     取消确认
                   </el-dropdown-item>
-                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&scope.row.status === '2'" :command="{method:'handover', row:scope.row}">
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&
+                                              scope.row.status === '2'&&
+                                              scope.row.handoverStatus === '1'||scope.row.handoverStatus === '2'||scope.row.handoverStatus === '5'"
+                                    :command="{method:'handover', row:scope.row}">
                     发起工作交接审批
                   </el-dropdown-item>
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:view')&&
+                                              scope.row.status === '2'&&
+                                              scope.row.handoverStatus === '3'||scope.row.handoverStatus === '4'"
+                                    :command="{method:'handoverDetail', row:scope.row}">
+                    工作交接审批结果
+                  </el-dropdown-item>
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '1')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '3')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '5')"
+                                    :command="{method:'audit', row:scope.row}">
+                    发起离职审批
+                  </el-dropdown-item>
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:view')&&
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '4')||
+                                              (scope.row.status === '1'&&scope.row.vettingStatus === '6')"
+                                    :command="{method:'auditDetail', row:scope.row}">
+                    离职审批结果
+                  </el-dropdown-item>
                 </el-dropdown-menu>
               </el-dropdown>
             </template>
@@ -134,6 +177,9 @@
   import DimissionForm from './DimissionForm'
   import DimissionHandoverFormDialog from './DimissionHandoverFormDialog'
   import TaskService from '@/api/flowable/TaskService'
+  import ProcessService from '@/api/flowable/ProcessService'
+  import DimissionHandoverService from '@/api/changes/dimission/DimissionHandoverService'
+  import pick from 'lodash.pick'
   export default {
     data () {
       return {
@@ -149,14 +195,22 @@
           pageSize: 10,
           orders: []
         },
-        loading: false
+        loading: false,
+        processDefinitionId: '',
+        procDefKey: '',
+        processDefinitionAuditId: '',
+        procDefAuditKey: ''
       }
     },
     dimissionService: null,
     taskService: null,
+    processService: null,
+    dimissionHandoverService: null,
     created () {
       this.dimissionService = new DimissionService()
       this.taskService = new TaskService()
+      this.processService = new ProcessService()
+      this.dimissionHandoverService = new DimissionHandoverService()
     },
     computed: {
       userName () {
@@ -184,6 +238,18 @@
           this.tablePage.total = data.total
           this.loading = false
         })
+        this.processService.getByName('离职归档交接审批').then(({data}) => {
+          if (!this.commonJS.isEmpty(data.id)) {
+            this.processDefinitionId = data.id
+            this.procDefKey = data.key
+          }
+        })
+        this.processService.getByName('离职审批').then(({data}) => {
+          if (!this.commonJS.isEmpty(data.id)) {
+            this.processDefinitionAuditId = data.id
+            this.procDefAuditKey = data.key
+          }
+        })
       },
       // 当前页
       currentChangeHandle ({ currentPage, pageSize }) {
@@ -224,24 +290,96 @@
         // 读取流程表单
         let title = `发起流程【离职归档交接审批】`
         let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [离职归档交接审批]`
-        this.taskService.getTaskDef({ procDefId: 'Process_1663572940585:6:ea3bdc78-37f5-11ed-84f6-f266559b56cb',
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
+          businessId: row.id,
+          businessTable: 'changes_dimission'}).then((data) => {
+            this.$router.push({
+              path: '/flowable/task/TaskForm',
+              query: {
+                procDefId: this.processDefinitionId,
+                procDefKey: this.procDefKey,
+                title: title,
+                formType: data.data.formType,
+                formUrl: data.data.formUrl,
+                formTitle: processTitle,
+                businessTable: 'changes_dimission',
+                businessId: row.id,
+                isShow: 'false',
+                status: 'startAndHold',
+                routePath: '/changes/dimission/DimissionList'
+              }
+            })
+          })
+      },
+      // 查看交接审批流程结果
+      handoverDetail (row) {
+        // eslint-disable-next-line eqeqeq
+        if (!this.commonJS.isEmpty(row.status)) {
+          this.taskService.getTaskDef({
+            procInsId: row.procInsId,
+            procDefId: this.processDefinitionId
+          }).then(({data}) => {
+            this.$router.push({
+              path: '/flowable/task/TaskFormDetail',
+              query: {
+                isShow: 'false',
+                readOnly: true,
+                title: '离职归档交接审批' + '流程详情',
+                formTitle: '离职归档交接审批' + '流程详情',
+                businessId: row.id,
+                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')
+              }
+            })
+          })
+        }
+      },
+      // 发起离职审批
+      audit (row) {
+        // 读取流程表单
+        let title = `发起流程【离职审批】`
+        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [离职审批]`
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionAuditId,
           businessId: row.id,
-          businessTable: 'dimission_handover_info'}).then((data) => {
+          businessTable: 'changes_dimission'}).then((data) => {
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
-                procDefId: 'Process_1663572940585:6:ea3bdc78-37f5-11ed-84f6-f266559b56cb',
-                procDefKey: 'Process_1663572940585',
+                procDefId: this.processDefinitionAuditId,
+                procDefKey: this.procDefAuditKey,
                 title: title,
                 formType: data.data.formType,
                 formUrl: data.data.formUrl,
                 formTitle: processTitle,
-                businessTable: 'dimission_handover_info',
+                businessTable: 'changes_dimission',
+                businessId: row.id,
+                isShow: 'false',
+                status: 'startAndHold',
+                routePath: '/changes/dimission/DimissionList'
+              }
+            })
+          })
+      },
+      // 查看离职审批流程结果
+      auditDetail (row) {
+        // eslint-disable-next-line eqeqeq
+        if (!this.commonJS.isEmpty(row.vettingStatus)) {
+          this.taskService.getTaskDef({
+            procInsId: row.procInsId,
+            procDefId: this.processDefinitionAuditId
+          }).then(({data}) => {
+            this.$router.push({
+              path: '/flowable/task/TaskFormDetail',
+              query: {
+                isShow: 'false',
+                readOnly: true,
+                title: '离职审批' + '流程详情',
+                formTitle: '离职审批' + '流程详情',
                 businessId: row.id,
-                routePath: '@views/modules/changes/dimission/DimissionHandoverForm'
+                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')
               }
             })
           })
+        }
       },
       // 删除
       del (id) {
@@ -286,14 +424,26 @@
         } else if (command.method === 'sure') {
           this.sure(command.id)
         } else if (command.method === 'removeSure') {
-          this.removeSure(command.id)
+          this.removeSure(command.row)
         } else if (command.method === 'handover') {
           this.handover(command.row)
+        } else if (command.method === 'handoverDetail') {
+          this.handoverDetail(command.row)
+        } else if (command.method === 'audit') {
+          this.audit(command.row)
+        } else if (command.method === 'auditDetail') {
+          this.auditDetail(command.row)
         }
       },
-      async removeSure (id) {
+      async removeSure (row) {
         this.loading = true
-        await this.dimissionService.updateStatus(id).then(() => {
+        if (row.vettingStatus !== '6' && row.vettingStatus !== '4') {
+          let obj = {id: row.id, vettingStatus: '1'}
+          await this.dimissionService.updateVettingStatusById(obj)
+        }
+        let object = {id: row.id, handoverStatus: '1'}
+        await this.dimissionHandoverService.updateStatusById(object)
+        await this.dimissionService.updateStatus(row.id).then(() => {
           this.refreshList()
           this.loading = false
         }).catch(() => {

+ 35 - 56
src/views/modules/flowable/task/TaskForm.vue

@@ -212,7 +212,6 @@
         this.printObj.popTitle = this.title
         this.businessId = this.$route.query.businessId
         this.procInsId = this.$route.query.procInsId
-        this.routePath = this.$route.query.routePath
         this.formReadOnly = this.$route.query.formReadOnly !== undefined && this.$route.query.formReadOnly !== 'false' && this.$route.query.formReadOnly !== false
         this.isCC = false
         this.isAssign = false
@@ -243,12 +242,12 @@
       },
       // 暂存草稿
       async save () {
-        if (this.formType === '2' && this.status === 'startAndHold') { // 外置表单
-          this.$refs.form.saveForm1().then(() => {
+        if (this.formType === '2') { // 外置表单
+          this.$refs.form.saveForm(() => {
             this.$message.success('操作成功')
             this.businessId = 'false'
             this.$store.dispatch('tagsView/delView', {fullPath: this.$route.fullPath})
-            this.$router.push('../../../sys/workContract/WorkContractList')
+            this.$router.push(this.$route.query.routePath)
             this.$refs.form.close()
           })
         }
@@ -256,47 +255,30 @@
       // 启动流程
       start (vars) {
         if (this.formType === '2') { // 外置表单
-          if (this.status === 'startAndHold' || this.status === 'startAndClose') {
-            this.$refs.form.saveForm((businessTable, businessId, inputForm) => {
-              vars = {...vars, ...inputForm}
-              this.taskService.start({
-                procDefId: this.procDefId,
-                procDefKey: this.procDefKey,
-                businessTable: businessTable,
-                businessId: businessId,
-                ...vars,
-                title: this.title,
-                assignee: this.auditForm.assignee
-              }).then(({data}) => {
-                this.$message.success('启动成功')
-                this.$store.dispatch('tagsView/delView', {fullPath: this.$route.fullPath})
-                this.$router.push('../../../sys/workContract/WorkContractList')
-                this.cc(data)
-                this.$refs.form.close()
-              })
-            })
-          } else {
-            this.$refs.form.saveForm((businessTable, businessId, inputForm) => {
-              vars = {...vars, ...inputForm}
-              this.taskService.start({
-                procDefKey: this.procDefKey,
-                businessTable: businessTable,
-                businessId: businessId,
-                ...vars,
-                title: this.title,
-                assignee: this.auditForm.assignee
-              }).then(({data}) => {
-                this.$message.success('启动成功')
-                this.$store.dispatch('tagsView/delView', {fullPath: this.$route.fullPath})
-                if (!this.commonJS.isEmpty(this.routePath)) {
-                  this.$router.push(this.routePath)
-                } else {
-                  this.$router.push('/flowable/task/TodoList')
-                }
-                this.cc(data)
-              })
+          this.$refs.form.startForm((businessTable, businessId, inputForm) => {
+            vars = {...vars, ...inputForm}
+            let assignee = this.auditForm.assignee
+            if (!this.commonJS.isEmpty(inputForm.assignee)) {
+              assignee = inputForm.assignee
+            }
+            this.taskService.start({
+              procDefKey: this.procDefKey,
+              businessTable: businessTable,
+              businessId: businessId,
+              ...vars,
+              title: this.title,
+              assignee: assignee
+            }).then(({data}) => {
+              this.$message.success('启动成功')
+              this.$store.dispatch('tagsView/delView', {fullPath: this.$route.fullPath})
+              if (!this.commonJS.isEmpty(this.$route.query.routePath)) {
+                this.$router.push(this.$route.query.routePath)
+              } else {
+                this.$router.push('/flowable/task/TodoList')
+              }
+              this.cc(data)
             })
-          }
+          })
         } else { // 动态表单
           this.$refs.form.submitStartFormData({
             processDefinitionId: this.procDefId,
@@ -313,7 +295,7 @@
       // 同意
       agree (vars) {
         this.commit(vars) // 同意
-        if (this.formType === '2' && this.formUrl === '/sys/workContract/WorkContractForm') {
+        if (this.formType === '2') {
           this.$refs.form.updateStatusById('agree')
         }
       },
@@ -332,7 +314,7 @@
             }
           })
         })
-        if (this.formType === '2' && this.formUrl === '/sys/workContract/WorkContractForm') {
+        if (this.formType === '2') {
           this.$refs.form.updateStatusById('reject')
         }
       },
@@ -348,7 +330,7 @@
             this.businessId = 'false'
             this.$refs.form.updateStatusById('reback')
             this.$store.dispatch('tagsView/delView', {fullPath: this.$route.fullPath})
-            this.$router.push('../../../sys/workContract/WorkContractList')
+            this.$router.push(this.$route.query.routePath)
             if (backNodes.length > 0) {
               let backTaskDefKey = backNodes[0].taskDefKey
               this.back(backTaskDefKey)
@@ -436,19 +418,17 @@
       },
       // 关闭
       close () {
-        if (this.status === 'startAndHold' || this.status === 'startAndClose') {
-          this.businessId = 'false'
-          this.$store.dispatch('tagsView/delView', {fullPath: this.$route.fullPath})
-          this.$router.push('../../../sys/workContract/WorkContractList')
-          this.$refs.form.close()
-        }
+        this.businessId = 'false'
+        this.$store.dispatch('tagsView/delView', {fullPath: this.$route.fullPath})
+        this.$router.push(this.$route.query.routePath)
+        this.$refs.form.close()
       },
       // 自定义按钮提交
       commit (vars) {
         var num = this.$route.query.num
         console.log(num)
         if (this.formType === '2') { // 外置表单
-          this.$refs.form.saveForm((businessTable, businessId, inputForm) => {
+          this.$refs.form.agreeForm((businessTable, businessId, inputForm) => {
             vars = {...vars, ...inputForm}
             this.taskService.audit({
               taskId: this.taskId,
@@ -586,8 +566,7 @@
           status: '',
           userIds: null,
           assignee: null
-        },
-        routePath: ''
+        }
       }
     }
   }

+ 2 - 1
src/views/modules/sys/dashboard/workBench/Pending.vue

@@ -374,10 +374,11 @@
           this.$router.push({
             path: '/flowable/task/TaskForm',
             query: {
+              formReadOnly: true,
               formTitle: `${row.vars.title}`,
               num: 2,
               title: `审批【${row.task.name || ''}】`,
-              ...pick(data, 'formType', 'formReadOnly', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')
+              ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')
             }
           })
         })