Просмотр исходного кода

代码提交:
0923合同管理-合同登记借用

sunruiqi 2 лет назад
Родитель
Сommit
32fb5814d6

+ 60 - 0
src/api/sys/WorkContractBorrowService.js

@@ -0,0 +1,60 @@
+import request from '@/utils/httpRequest'
+
+export default class WorkContractService {
+  save (param) {
+    return request({
+      url: '/workContract/workContractBorrow/save',
+      method: 'post',
+      data: param
+    })
+  }
+  updateStatusById (param) {
+    return request({
+      url: '/workContract/workContractBorrow/updateStatusById',
+      method: 'post',
+      data: param
+    })
+  }
+  updateStatusByContractInfoId (param) {
+    return request({
+      url: '/workContract/workContractBorrow/updateStatusByContractInfoId',
+      method: 'post',
+      data: param
+    })
+  }
+  findById (id) {
+    return request({
+      url: '/workContract/workContractBorrow/findById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  findByContractInfoId (id) {
+    return request({
+      url: '/workContract/workContractBorrow/findByContractInfoId',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  updateMessageStatusById (param) {
+    return request({
+      url: '/workContract/workContractBorrow/updateMessageStatusById',
+      method: 'post',
+      data: param
+    })
+  }
+  deleteById (id) {
+    return request({
+      url: '/workContract/workContractBorrow/deleteById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  findMessageList (id) {
+    return request({
+      url: '/workContract/workContractBorrow/findMessageList',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+}

+ 2 - 2
src/views/modules/flowable/task/TaskForm.vue

@@ -167,6 +167,8 @@
         this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
       } else if (this.status === 'startAndHoldFiled') {  // 送审、暂存、关闭
         this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_save', name: '暂存', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
+      } else if (this.status === 'startAndCloseBorrow') {
+        this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
       } else if (this.status === 'reback') {
         this.buttons = [{code: '_flow_reback', name: '撤回', isHide: '0'}]
       } else if (this.procDefKey && this.taskDefKey) {
@@ -313,7 +315,6 @@
         if (this.formType === '2' && this.formUrl !== '/sys/workContract/WorkContractFileForm') {
           this.commit(vars) // 同意
           this.$refs.form.updateStatusById('agree')
-          this.businessId = 'false'
         }
         if (this.formType === '2' && this.formUrl === '/sys/workContract/WorkContractFileForm') {
           console.log('1111', this.status)
@@ -321,7 +322,6 @@
             if (item !== 'false') {
               this.commit(vars) // 同意
               this.$refs.form.updateStatusById('agree')
-              this.businessId = 'false'
             }
           })
         }

+ 220 - 0
src/views/modules/sys/workContract/WorkContractBorrowForm.vue

@@ -0,0 +1,220 @@
+<template>
+<div>
+  <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+           label-width="150px">
+    <el-row  :gutter="0">
+      <el-col :span="12">
+        <el-form-item label="合同名称" prop="name">
+          <el-input :disabled="true" v-model="inputForm.name"></el-input>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="12">
+        <el-form-item label="合同编号" prop="no">
+          <el-input :disabled="true" v-model="inputForm.no"></el-input>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="12">
+        <el-form-item label="客户名称" prop="clientName">
+          <el-input :disabled="true" v-model="inputForm.clientName"></el-input>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="12">
+        <el-form-item label="借用人" prop="borrowName">
+          <el-input :disabled="true" v-model="inputForm.borrowName"></el-input>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="12">
+        <el-form-item label="借用日期" prop="borrowData">
+          <el-date-picker
+            :disabled="this.inputForm.borrowType !== '1'"
+            v-model="inputForm.borrowData"
+            type="date"
+            placeholder="选择日期">
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="12">
+        <el-form-item label="大概归还日期" prop="borrowRetData" :rules="[
+                  {required: true, message:'请填写大概归还日期', trigger:'blur'}
+               ]">
+          <el-date-picker
+            :disabled="this.inputForm.borrowType === '2'"
+            v-model="inputForm.borrowRetData"
+            type="date"
+            placeholder="选择日期">
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+
+    </el-row>
+
+    <el-form-item label="备注" prop="remarks">
+      <el-input v-model="inputForm.remarks"
+                :disabled="this.inputForm.borrowType === '2'"
+                type="textarea"
+                :rows="5"
+                maxlength="500"
+                placeholder="请输入备注"
+                show-word-limit>
+      </el-input>
+    </el-form-item>
+
+  </el-form>
+</div>
+</template>
+
+<script>
+  import WorkContractService from '@/api/sys/WorkContractService'
+  import WorkContractBorrowService from '@/api/sys/WorkContractBorrowService'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        inputForm: {
+          id: '',
+          name: '',
+          no: '',
+          clientName: '',
+          borrowName: '',
+          borrowData: '',
+          borrowRetData: '',
+          remarks: '',
+          borrowType: '',
+          type: ''
+        }
+      }
+    },
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      }
+    },
+    components: {
+    },
+    workContractBorrowService: null,
+    workContractService: null,
+    created () {
+      this.workContractBorrowService = new WorkContractBorrowService()
+      this.workContractService = new WorkContractService()
+    },
+    watch: {
+      'businessId': {
+        handler (newVal) {
+          if (this.businessId) {
+            this.init(this.businessId)
+          } else {
+            this.$nextTick(() => {
+              this.$refs.inputForm.resetFields()
+            })
+          }
+        },
+        immediate: true,
+        deep: false
+      }
+    },
+    computed: {
+      userName () {
+        return JSON.parse(localStorage.getItem('user')).name
+      }
+    },
+    methods: {
+      init (id) {
+        if (id) {
+          this.loading = true
+          this.inputForm.id = id
+          this.$nextTick(() => {
+            console.log('id', id)
+            this.$refs.inputForm.resetFields()
+            this.workContractBorrowService.findById(this.inputForm.id).then(({data}) => {
+              if (this.commonJS.isEmpty(data.id)) {
+                this.workContractService.findById(this.inputForm.id).then(({data}) => {
+                  this.inputForm = this.recover(this.inputForm, data)
+                  this.inputForm.borrowName = this.userName
+                  this.inputForm.borrowData = new Date()
+                  this.loading = false
+                })
+              } else {
+                this.inputForm = this.recover(this.inputForm, data)
+                this.inputForm.borrowName = this.userName
+                this.inputForm.borrowData = new Date()
+                this.loading = false
+              }
+            })
+          })
+        }
+      },
+      // 表单提交
+      startForm (callback) {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            let id = this.inputForm.id
+            this.loading = true
+            this.inputForm.contractInfoId = id
+            this.inputForm.borrowType = '2'
+            console.log('dosubmit', this.inputForm)
+            this.workContractBorrowService.save(this.inputForm).then(({data}) => {
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            }).catch(() => {
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 同意
+      agreeForm (callback) {
+        this.inputForm.borrowType = '5'
+        this.workContractBorrowService.updateMessageStatusById(this.inputForm).then(({data}) => {
+          callback(data.businessTable, data.businessId, this.inputForm)
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+        }).catch(() => {
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+        })
+      },
+      // 关闭
+      close () {
+        this.$refs.inputForm.resetFields()
+        this.visible = false
+        this.businessId = ''
+      },
+      // 更改状态
+      updateStatusById (type) {
+        console.log('updateStatusById', this.inputForm)
+        if (type === 'agree') {
+          this.inputForm.borrowType = '6'
+          this.workContractBorrowService.updateStatusById(this.inputForm)
+        }
+        if (type === 'reject') {
+          this.inputForm.borrowType = '1'
+          this.workContractBorrowService.updateStatusById(this.inputForm).then(() => {
+            this.inputForm.borrowType = '4'
+            this.workContractBorrowService.updateMessageStatusById(this.inputForm)
+          })
+        }
+        if (type === 'reback') {
+          this.inputForm.borrowType = '1'
+          this.workContractBorrowService.updateStatusById(this.inputForm)
+        }
+      }
+    }
+  }
+</script>
+
+

+ 79 - 0
src/views/modules/sys/workContract/WorkContractBorrowMessageForm.vue

@@ -0,0 +1,79 @@
+<template>
+  <el-dialog
+    :title="title"
+    :close-on-click-modal="false"
+    v-dialogDrag
+    width="1200px"
+    @close="close()"
+    :visible.sync="visible">
+  <div class="page">
+      <el-form size="small" :inline="true" @submit.native.prevent>
+        <div style="height: calc(100% - 80px);">
+            <vxe-table
+                border="inner"
+                auto-resize
+                resizable
+                height="500px"
+                :loading="loading"
+                size="small"
+                ref="workClientTable"
+                show-header-overflow
+                show-overflow
+                highlight-hover-row
+                :menu-config="{}"
+                :print-config="{}"
+                :sort-config="{remote:true}"
+                :data="dataList"
+                :checkbox-config="{}">
+
+                <vxe-column width="300px" title="合同名称" field="name"></vxe-column>
+                <vxe-column width="100px" title="借用人" field="borrowName" ></vxe-column>
+                <vxe-column width="100px" title="借用状态" field="borrowType" >
+                  <template slot-scope="scope">
+                    {{ $dictUtils.getDictLabel("borrow_type", scope.row.borrowType, '-') }}
+                  </template>
+                </vxe-column>
+                <vxe-column width="200px" title="借用时间" field="borrowData" ></vxe-column>
+                <vxe-column width="200px" title="大概归还时间" field="borrowRetData" ></vxe-column>
+                <vxe-column width="200px" title="大概归还时间" field="retureDate"></vxe-column>
+
+            </vxe-table>
+        </div>
+      </el-form>
+  </div>
+  </el-dialog>
+</template>
+
+<script>
+  import WorkContractBorrowService from '@/api/sys/WorkContractBorrowService'
+  export default {
+    data () {
+      return {
+        title: '',
+        visible: false,
+        loading: false,
+        dataList: []
+      }
+    },
+    workContractBorrowService: null,
+    created () {
+      this.workContractBorrowService = new WorkContractBorrowService()
+    },
+    methods: {
+      // 获取数据列表
+      findList (id) {
+        this.loading = true
+        this.visible = true
+        this.title = '合同借用详情'
+        this.workContractBorrowService.findMessageList(id).then(({data}) => {
+          this.dataList = data
+          this.loading = false
+        })
+      },
+      close () {
+        this.visible = false
+        this.dataList = []
+      }
+    }
+  }
+</script>

+ 95 - 7
src/views/modules/sys/workContract/WorkContractList.vue

@@ -128,15 +128,14 @@
                 </vxe-column>
                 <vxe-column width="100px"  title="归档状态" field="filedType" >
                   <template slot-scope="scope">
-<!--                    {{ $dictUtils.getDictLabel("filed_type", scope.row.filedType, '-') }}-->
                     <el-button  type="text" @click="detailFiled(scope.row)" :type="$dictUtils.getDictLabel('filed_type', scope.row.filedType, '-')"   effect="dark" size="mini">{{$dictUtils.getDictLabel("filed_type", scope.row.filedType, '-')}} </el-button>
                   </template>
                 </vxe-column>
-<!--                <vxe-column width="100px"  title="借用状态" field="borrowType" >-->
-<!--                  <template slot-scope="scope">-->
-<!--                    {{ $dictUtils.getDictLabel("borrow_type", scope.row.borrowType, '-') }}-->
-<!--                  </template>-->
-<!--                </vxe-column>-->
+                <vxe-column width="100px"  title="借用状态" field="borrowType" >
+                  <template slot-scope="scope">
+                    <el-button  type="text" @click="detailBorrow(scope.row)" :type="$dictUtils.getDictLabel('borrow_type', scope.row.borrowType, '-')"   effect="dark" size="mini">{{$dictUtils.getDictLabel("borrow_type", scope.row.borrowType, '-')}} </el-button>
+                  </template>
+                </vxe-column>
 
                 <vxe-column title="操作" width="200px" fixed="right" align="center">
                     <template  slot-scope="scope">
@@ -147,6 +146,9 @@
                       <el-button v-if="hasPermission('sys:workContract:back') && scope.row.status === '2'" type="text"  icon="el-icon-back" size="small" @click="reback(scope.row)">撤回</el-button>
                       <el-button v-if="hasPermission('sys:workContract:filed') && scope.row.status === '5' && scope.row.createId === create && (scope.row.filedType === '1' || scope.row.filedType === '2' || scope.row.filedType === '4' || scope.row.filedType === '5' || scope.row.filedType === undefined)" type="text"  icon="el-icon-s-order" size="small" @click="filed(scope.row.id)">归档</el-button>
                       <el-button v-if="hasPermission('sys:workContract:back') && scope.row.status === '5' && scope.row.filedType === '3'" type="text"  icon="el-icon-back" size="small" @click="rebackFiled(scope.row)">撤回</el-button>
+                      <el-button v-if="hasPermission('sys:workContract:borrow') && scope.row.status === '5' && scope.row.filedType === '6' && (scope.row.borrowType === undefined || scope.row.borrowType === '1')" type="text"  icon="el-icon-s-order" size="small" @click="borrow(scope.row.id)">借用</el-button>
+                      <el-button v-if="hasPermission('sys:workContract:back') && scope.row.status === '5' && scope.row.filedType === '6' && scope.row.borrowType === '2'" type="text"  icon="el-icon-back" size="small" @click="rebackBorrow(scope.row)">撤回</el-button>
+                      <el-button v-if="hasPermission('sys:workContract:reture') && scope.row.status === '5' && scope.row.filedType === '6' && scope.row.borrowType === '6'" type="text"  icon="el-icon-back" size="small" @click="retureBorrow(scope.row)">归还合同</el-button>
                     </template>
                 </vxe-column>
             </vxe-table>
@@ -165,6 +167,7 @@
         <!-- 弹窗, 新增 / 修改 -->
     <WorkContractForm2 ref="workContractForm2" @refreshDataList="refreshList"></WorkContractForm2>
     <WorkClientForm ref="workClientForm" @refreshDataList="refreshList"></WorkClientForm>
+    <WorkContractBorrowMessageForm ref="workContractBorrowMessageForm" @refreshDataList="refreshList"></WorkContractBorrowMessageForm>
   </div>
 </template>
 
@@ -172,8 +175,10 @@
   import InputNumber from './InputNumber.vue'
   import WorkContractForm2 from './WorkContractForm2'
   import WorkClientForm from '../workClient/WorkClientForm'
+  import WorkContractBorrowMessageForm from './WorkContractBorrowMessageForm'
   import WorkContractService from '@/api/sys/WorkContractService'
   import WorkContractFileService from '@/api/sys/WorkContractFileService'
+  import WorkContractBorrowService from '@/api/sys/WorkContractBorrowService'
   import SelectUserTree from '@/views/modules/utils/treeUserSelect'
   import TaskService from '@/api/flowable/TaskService'
   import ProcessService from '@/api/flowable/ProcessService'
@@ -211,12 +216,14 @@
     },
     workContractService: null,
     workContractFileService: null,
+    workContractBorrowService: null,
     taskService: null,
     processService: null,
     userService: null,
     created () {
       this.workContractService = new WorkContractService()
       this.workContractFileService = new WorkContractFileService()
+      this.workContractBorrowService = new WorkContractBorrowService()
       this.taskService = new TaskService()
       this.processService = new ProcessService()
       this.userService = new UserService()
@@ -225,6 +232,7 @@
       InputNumber,
       WorkContractForm2,
       WorkClientForm,
+      WorkContractBorrowMessageForm,
       SelectUserTree
     },
     activated () {
@@ -490,6 +498,20 @@
           row.filedType = '4'
           this.workContractFileService.updateStatusById(row)
         }
+        if (type === 'rebackBorrow') {
+          row.borrowType = '1'
+          this.workContractBorrowService.updateStatusByContractInfoId(row).then(() => {
+            this.workContractBorrowService.deleteById(row.id)
+          })
+        }
+        if (type === 'retureBorrow') {
+          row.borrowType = '1'
+          this.workContractBorrowService.updateStatusByContractInfoId(row).then(() => {
+            row.type = 'reture'
+            row.borrowType = '6'
+            this.workContractBorrowService.updateMessageStatusById(row)
+          })
+        }
       },
       is () {
         this.userService.is().then(({data}) => {
@@ -528,7 +550,7 @@
           }
         })
       },
-      // 详情
+      // 归档详情
       detailFiled (row) {
         this.workContractFileService.findByContractInfoId(row.id).then(({data}) => {
           if (!this.commonJS.isEmpty(data.id)) {
@@ -549,6 +571,72 @@
             })
           }
         })
+      },
+      // 借用
+      borrow (id) {
+        this.processService.getByName('合同登记借用').then(({data}) => {
+          if (!this.commonJS.isEmpty(data.id)) {
+            console.log('data', data)
+            // 读取流程表单
+            let tabTitle = `发起流程【合同登记借用】`
+            let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记借用]`
+            this.taskService.getTaskDef({ procDefId: data.id,
+              businessId: id,
+              businessTable: 'work_contract_borrow',
+              status: 'startAndCloseBorrow'}).then((reture) => {
+                this.$router.push({
+                  path: '/flowable/task/TaskForm',
+                  query: {
+                    procDefId: data.id,
+                    procDefKey: data.key,
+                    status: 'startAndCloseBorrow',
+                    title: tabTitle,
+                    formType: reture.data.formType,
+                    formUrl: reture.data.formUrl,
+                    formTitle: processTitle,
+                    businessTable: 'work_contract_borrow',
+                    businessId: id,
+                    isShow: false,
+                    routePath: '/sys/workContract/WorkContractList'
+                  }
+                })
+              })
+          }
+        })
+      },
+      // 借用详情
+      detailBorrow (row) {
+        this.$refs.workContractBorrowMessageForm.findList(row.id)
+      },
+      // 借用撤回
+      rebackBorrow (row) {
+        this.$confirm(`确定撤回流程吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          taskId: row.taskBorrowId,
+          type: 'warning'
+        }).then(() => {
+          console.log('datas', row.taskBorrowId)
+          this.taskService.backNodes(row.taskBorrowId).then(({data}) => {
+            let backNodes = data
+            if (backNodes.length > 0) {
+              let backTaskDefKey = backNodes[0].taskDefKey
+              this.taskService.back({
+                taskId: row.taskBorrowId,
+                backTaskDefKey: backTaskDefKey,
+                isShow: false,
+                ...this.auditForm
+              }).then(({data}) => {
+                this.updateStatusById(row, 'rebackBorrow')
+                this.$message.success('回退成功')
+              })
+            }
+          })
+        })
+      },
+      // 归还合同
+      retureBorrow (row) {
+        this.updateStatusById(row, 'retureBorrow')
       }
     }
   }