Browse Source

离职确认功能

lizhenhao 2 years ago
parent
commit
b87dc26a1d

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

@@ -29,4 +29,11 @@ export default class DimissionService {
       params: {ids: ids}
     })
   }
+  updateStatus (id) {
+    return request({
+      url: '/changes/dimission/updateStatus',
+      method: 'get',
+      params: {id: id}
+    })
+  }
 }

+ 4 - 1
src/views/common/UpLoadComponent.vue

@@ -120,7 +120,6 @@
           this.maxValue = 300
         }
         this.auth = auth
-        console.log(this.loading)
         for await (let item of fileList) {
           await this.ossService.getTemporaryUrl(item.url).then((data) => {
             item.lsUrl = data.data
@@ -232,6 +231,10 @@
         return false
       },
       ifName (row) {
+        if (this.commonJS.isEmpty(row.name)) {
+          row.name = '---'
+          return false
+        }
         let suffix = row.name.substring(row.name.lastIndexOf('.') + 1)
         if (suffix === 'jpg' || suffix === 'png' || suffix === 'gif' || suffix === 'bmp' || suffix === 'jpeg') {
           return true

+ 37 - 7
src/views/modules/changes/dimission/DimissionForm.vue

@@ -6,7 +6,6 @@
       v-dialogDrag
       width="1000px"
       @close="close"
-      @keyup.enter.native="doSubmit"
       :visible.sync="visible">
       <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
                label-width="125px" @submit.native.prevent>
@@ -15,7 +14,7 @@
             <el-form-item label="姓名" prop="rosterId"
                           :rules="[{required: true, message: '姓名不能为空', trigger: 'blur'}]"
             >
-              <el-select v-model="inputForm.rosterId" style="width:100%" placeholder="请选择姓名">
+              <el-select :disabled="method === 'sure'" v-model="inputForm.rosterId" style="width:100%" placeholder="请选择姓名">
                 <el-option
                   v-for="item in supervisorList"
                   :key="item.id"
@@ -29,6 +28,7 @@
             <el-form-item label="申请日期" prop="requestDate"
                           :rules="[{required: true, message: '申请日期不能为空', trigger: 'blur'}]">
               <el-date-picker
+                :disabled="method === 'sure'"
                 placement="bottom-start"
                 style="width: 100%"
                 v-model="inputForm.requestDate"
@@ -116,9 +116,12 @@
           </el-col>
         </el-row>
       </el-form>
+      <!--        附件-->
+      <UpLoadComponent v-if="method === 'sure'" ref="uploadComponent"></UpLoadComponent>
       <span slot="footer" class="dialog-footer">
       <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
-      <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+      <el-button size="small" type="primary" v-if="method !== 'view' && method !== 'sure'" @click="doSubmit('1')" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+      <el-button size="small" type="primary" v-if="method === 'sure'" @click="doSubmit('2')" icon="el-icon-circle-check" v-noMoreClick>确认归档</el-button>
     </span>
     </el-dialog>
   </div>
@@ -127,6 +130,7 @@
 <script>
   import DimissionService from '@/api/changes/dimission/DimissionService'
   import RosterService from '@/api/roster/RosterService'
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
   export default {
     data () {
       return {
@@ -147,7 +151,8 @@
           status: '',
           payrollSettlementDate: '',
           requestDate: '',
-          reaTypeList: []
+          reaTypeList: [],
+          changesDimissionFilesDTOList: []
         },
         supervisorList: []
       }
@@ -159,6 +164,7 @@
       this.rosterService = new RosterService()
     },
     components: {
+      UpLoadComponent
     },
     methods: {
       init (method, id) {
@@ -177,7 +183,8 @@
           status: '',
           payrollSettlementDate: '',
           requestDate: '',
-          reaTypeList: []
+          reaTypeList: [],
+          changesDimissionFilesDTOList: []
         }
         this.inputForm.id = id
         if (method === 'add') {
@@ -186,27 +193,47 @@
           this.title = '修改'
         } else if (method === 'view') {
           this.title = '离职详情'
+        } else if (method === 'sure') {
+          this.title = '确认离职'
         }
         this.visible = true
         this.loading = false
         this.$nextTick(() => {
           this.$refs.inputForm.resetFields()
-          if (method === 'edit' || method === 'view') { // 修改或者查看
+          if (method === 'edit' || method === 'view' || method === 'sure') { // 修改或者查看
             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 (method === 'sure') {
+                this.$refs.uploadComponent.newUpload(method, this.inputForm.changesDimissionFilesDTOList, 'dimission')
+              }
               this.loading = false
             })
           }
+          if (method !== 'edit' && method !== 'view') {
+            if (method === 'sure') {
+              this.$refs.uploadComponent.newUpload(method, [], 'dimission')
+            }
+          }
         })
       },
       // 表单提交
-      doSubmit () {
+      doSubmit (status) {
         this.$refs['inputForm'].validate((valid) => {
           if (valid) {
             this.loading = true
+            if (this.method === 'sure') {
+              if (this.$refs.uploadComponent.checkProgress()) {
+                this.loading = false
+                return
+              }
+            }
             this.checkMoment()
+            if (this.method === 'sure') {
+              this.inputForm.changesDimissionFilesDTOList = this.$refs.uploadComponent.getDataList()
+            }
+            this.inputForm.status = status
             this.dimissionService.save(this.inputForm).then(({data}) => {
               this.close()
               this.$message.success(data)
@@ -219,6 +246,9 @@
         })
       },
       close () {
+        if (this.method === 'sure') {
+          this.$refs.uploadComponent.clearUpload()
+        }
         this.$refs.inputForm.resetFields()
         this.visible = false
       },

+ 52 - 4
src/views/modules/changes/dimission/DimissionList.vue

@@ -66,11 +66,33 @@
           </vxe-column>
           <vxe-column width="200" title="备注" field="remarks"></vxe-column>
 
-          <vxe-column title="操作" width="200px" fixed="right" align="center">
+          <vxe-column title="操作" width="50px" fixed="right" align="center">
             <template  slot-scope="scope">
-              <el-button v-if="hasPermission('changes:dimission:view')" type="text" icon="el-icon-view" size="small" @click="view(scope.row.id)">查看</el-button>
-              <el-button v-if="hasPermission('changes:dimission:edit')" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row.id)">修改</el-button>
-              <el-button v-if="hasPermission('changes:dimission:del')" type="text"  icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
+              <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>
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:del')&&scope.row.status === '1'" :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>
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&scope.row.status === '2'" :command="{method:'removeSure', id:scope.row.id}">
+                    取消确认
+                  </el-dropdown-item>
+                  <el-dropdown-item v-if="hasPermission('changes:dimission:edit')&&scope.row.status === '2'" :command="{method:'sure', id:scope.row.id}">
+                    发起工作交接审批
+                  </el-dropdown-item>
+                </el-dropdown-menu>
+              </el-dropdown>
             </template>
           </vxe-column>
         </vxe-table>
@@ -166,6 +188,10 @@
       view (id) {
         this.$refs.dimissionForm.init('view', id)
       },
+      // 确认离职
+      sure (id) {
+        this.$refs.dimissionForm.init('sure', id)
+      },
       // 删除
       del (id) {
         let ids = id || this.$refs.dimissionTable.getCheckboxRecords().map(item => {
@@ -198,6 +224,28 @@
           str = str.substr(0, str.length - 1)
         }
         return str
+      },
+      handleCommand (command) {
+        if (command.method === 'view') {
+          this.view(command.id)
+        } else if (command.method === 'edit') {
+          this.edit(command.id)
+        } else if (command.method === 'del') {
+          this.del(command.id)
+        } else if (command.method === 'sure') {
+          this.sure(command.id)
+        } else if (command.method === 'removeSure') {
+          this.removeSure(command.id)
+        }
+      },
+      async removeSure (id) {
+        this.loading = true
+        await this.dimissionService.updateStatus(id).then(() => {
+          this.refreshList()
+          this.loading = false
+        }).catch(() => {
+          this.loading = false
+        })
       }
     }
   }