Преглед на файлове

财务-合同登记文件上传修改

wangqiang преди 2 години
родител
ревизия
b0417974e2

+ 99 - 71
src/views/modules/cw/workContract/ContractFileForm.vue

@@ -138,8 +138,8 @@
         </el-col>
 
         <el-col :span="12">
-          <el-form-item label="合同归档审批类型" prop="contractApprovalType"
-                        :rules="[{required: true, message: '合同归档审批类型不能为空', trigger: 'blur'}
+          <el-form-item label="合同归档审批类型" hidden prop="contractApprovalType"
+                        :rules="[
                  ]">
             <el-select v-model="inputForm.contractApprovalType" placeholder="请选择" style="width:100%;">
               <el-option
@@ -468,22 +468,25 @@
             if ((data1.data.filedType !== '0' & data1.data.filedType !== undefined) || data1.data.id === undefined) {
               // console.log('data1.22222')
               // console.log('data1.data.contractProperList', data1.data.contractProperList)
+              this.$refs.uploadFile.clearUpload()
               this.$refs.uploadFile.newUpload('view', data1.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
               this.contractFileService.findById(this.inputForm.id).then(data2 => {
                 this.inputForm.contractProperList = data2.data.contractProperList
                 this.inputForm.contractInfoList = data2.data.contractInfoList
-                // console.log('data2', data2)
+                console.log('data2', data2)
                 this.contractInfoService.findById(data2.data.contractInfoId).then(data3 => {
                   data3.data.contractProperList = this.inputForm.contractProperList
                   data3.data.contractInfoList = this.inputForm.contractInfoList
                   if (data3.data.filedType === '2' || data3.data.filedType === '5') {
-                    // this.$refs.uploadFile.newUpload('view', data3.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
+                    this.$refs.uploadFile.clearUpload()
+                    this.$refs.uploadFile.newUpload('view', data3.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
                     this.$refs.archiveFile.newUpload('view', data3.data.contractInfoList, 'cwWorkContract', null, null, null, null, false)
                   } else {
-                    // this.$refs.uploadFile.newUpload('view', data3.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
+                    this.$refs.uploadFile.clearUpload()
+                    this.$refs.uploadFile.newUpload('view', data3.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
                     this.$refs.archiveFile.newUpload(method, data3.data.contractInfoList, 'cwWorkContract', null, null, null, null, false)
                   }
-                  // console.log('data3', data3)
+                  console.log('data3', data3)
                   this.saveData(data3.data, method)
                   if (this.formReadOnly) {
                     method = 'view'
@@ -492,6 +495,7 @@
               })
             } else {
               // console.log('进来了22')
+              this.$refs.uploadFile.clearUpload()
               this.$refs.uploadFile.newUpload('view', data1.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
               this.saveData(data1.data, method)
               if (this.formReadOnly) {
@@ -551,70 +555,89 @@
       // 表单提交
       // 暂存
       async saveForm (callback) {
-        // 合同登记暂存
-        if (this.status === 'startAndHold' || this.status === 'startAndHoldFiled') {
-          this.loading = true
-          if (this.status === 'startAndHold') {
-            this.inputForm.status = '1'
+        if (this.$refs.archiveFile.checkProgress() || this.$refs.uploadFile.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          // 合同登记暂存
+          if (this.status === 'startAndHold' || this.status === 'startAndHoldFiled') {
+            this.loading = true
+            if (this.status === 'startAndHold') {
+              this.inputForm.status = '1'
+            }
+            if (this.status === 'startAndHoldFiled') {
+              this.inputForm.status = '5'
+            }
+            // await this.contractInfoService.save(this.inputForm)
           }
+          // 合同登记归档暂存
           if (this.status === 'startAndHoldFiled') {
-            this.inputForm.status = '5'
+            this.inputForm.filedType = '1'
+            this.inputForm.contractInfoId = this.businessId
+            this.inputForm.contractInfoList = this.$refs.archiveFile.getDataList()
+            // this.inputForm.contractInfoList = this.$refs.uploadFile.getDataList()
+            this.contractFileService.save(this.inputForm)
+            this.contractInfoService.updateInfo(this.inputForm)
           }
-          // await this.contractInfoService.save(this.inputForm)
-        }
-        // 合同登记归档暂存
-        if (this.status === 'startAndHoldFiled') {
-          this.inputForm.filedType = '1'
-          this.inputForm.contractInfoId = this.businessId
-          this.inputForm.contractInfoList = this.$refs.archiveFile.getDataList()
-          // this.inputForm.contractInfoList = this.$refs.uploadFile.getDataList()
-          this.contractFileService.save(this.inputForm)
-          this.contractInfoService.updateInfo(this.inputForm)
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+          this.businessId = ''
+          callback()
         }
-        this.$refs.inputForm.resetFields()
-        this.loading = false
-        this.businessId = ''
-        callback()
       },
       // 送审
       startForm (callback) {
-        // console.log('filedType', this.inputForm.id)
-        let id = this.inputForm.id
-        this.loading = true
-        this.inputForm.status = '5'
-        this.inputForm.filedType = '2'
-        this.inputForm.contractProperList = []
-        this.contractInfoService.updateInfo(this.inputForm)
-        // console.log('inputForm', this.inputForm)
-        this.inputForm.contractInfoId = id
-        this.inputForm.contractInfoList = this.$refs.archiveFile.getDataList()
-        // console.log('this.inputForm', this.inputForm)
-        // this.inputForm.contractProperList = this.$refs.uploadFile.getDataList()
-        this.contractFileService.save(this.inputForm).then(({data}) => {
-          // console.log('data', data)
-          callback(data.businessTable, data.businessId, this.inputForm)
-          this.$refs.inputForm.resetFields()
+        if (this.$refs.archiveFile.checkProgress() || this.$refs.uploadFile.checkProgress()) {
           this.loading = false
-        })
+          throw new Error()
+        } else {
+          // console.log('filedType', this.inputForm.id)
+          let id = this.inputForm.id
+          this.loading = true
+          this.inputForm.status = '5'
+          this.inputForm.filedType = '2'
+          this.inputForm.contractProperList = []
+          if (this.inputForm.actualContractAmount === '' || this.inputForm.actualContractAmount === undefined) {
+            this.loading = false
+            throw new Error('请填写合同实际金额')
+          }
+          this.contractInfoService.updateInfo(this.inputForm)
+          // console.log('inputForm', this.inputForm)
+          this.inputForm.contractInfoId = id
+          this.inputForm.contractInfoList = this.$refs.archiveFile.getDataList()
+          // console.log('this.inputForm', this.inputForm)
+          // this.inputForm.contractProperList = this.$refs.uploadFile.getDataList()
+          this.contractFileService.save(this.inputForm).then(({data}) => {
+            // console.log('data', data)
+            callback(data.businessTable, data.businessId, this.inputForm)
+            this.$refs.inputForm.resetFields()
+            this.loading = false
+          })
+        }
       },
       // 通过
       agreeForm (callback) {
-        let id = this.inputForm.id
-        this.loading = true
-        this.inputForm.status = '5'
-        this.inputForm.filedType = '5'
-        // this.inputForm.contractInfoList = this.$refs.archiveFile.getDataList()
-        this.inputForm.contractProperList = []
-        // console.log('this.inputForm.contractProperList', this.inputForm.contractProperList)
-        this.contractInfoService.updateInfo(this.inputForm)
-        this.inputForm.contractInfoId = id
-        // this.inputForm.contractInfoList = this.$refs.uploadFile.getDataList()
-        this.contractFileService.save(this.inputForm).then(({data}) => {
-          callback(data.businessTable, data.businessId, this.inputForm)
-          this.$refs.inputForm.resetFields()
+        if (this.$refs.archiveFile.checkProgress() || this.$refs.uploadFile.checkProgress()) {
           this.loading = false
-          this.businessId = ''
-        })
+          throw new Error()
+        } else {
+          let id = this.inputForm.id
+          this.loading = true
+          this.inputForm.status = '5'
+          this.inputForm.filedType = '5'
+          // this.inputForm.contractInfoList = this.$refs.archiveFile.getDataList()
+          this.inputForm.contractProperList = []
+          // console.log('this.inputForm.contractProperList', this.inputForm.contractProperList)
+          this.contractInfoService.updateInfo(this.inputForm)
+          this.inputForm.contractInfoId = id
+          // this.inputForm.contractInfoList = this.$refs.uploadFile.getDataList()
+          this.contractFileService.save(this.inputForm).then(({data}) => {
+            callback(data.businessTable, data.businessId, this.inputForm)
+            this.$refs.inputForm.resetFields()
+            this.loading = false
+            this.businessId = ''
+          })
+        }
       },
       close () {
         this.$refs.inputForm.resetFields()
@@ -727,19 +750,24 @@
         this.visable = false
       },
       updateStatusById (type) {
-        // console.log('type' + type)
-        if (type === 'agree') {
-          this.inputForm.filedType = '5'
-          this.contractFileService.updateStatusById(this.inputForm)
-        }
-        // 驳回
-        if (type === 'reject') {
-          this.inputForm.filedType = '4'
-          this.contractFileService.updateStatusById(this.inputForm)
-        }
-        if (type === 'reback') {
-          this.inputForm.filedType = '3'
-          this.contractFileService.updateStatusById(this.inputForm)
+        if (this.$refs.archiveFile.checkProgress() || this.$refs.uploadFile.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          // console.log('type' + type)
+          if (type === 'agree') {
+            this.inputForm.filedType = '5'
+            this.contractFileService.updateStatusById(this.inputForm)
+          }
+          // 驳回
+          if (type === 'reject') {
+            this.inputForm.filedType = '4'
+            this.contractFileService.updateStatusById(this.inputForm)
+          }
+          if (type === 'reback') {
+            this.inputForm.filedType = '3'
+            this.contractFileService.updateStatusById(this.inputForm)
+          }
         }
       },
       checkData () {

+ 39 - 22
src/views/modules/cw/workContract/ContractNameForm.vue

@@ -476,19 +476,30 @@
             this.$refs.archiveFile.clearUpload()
             this.$refs.uploadFile.clearUpload()
             this.inputForm.contractProperList = data1.data.contractProperList
-            // console.log('data1.id', data1.data.id)
-            // console.log('data1.data.filedType', data1.data.filedType)
+              // console.log('data1.id', data1.data.id)
+              // console.log('data1.data.filedType', data1.data.filedType)
             if ((data1.data.filedType !== '0' & data1.data.filedType !== undefined) || data1.data.id === undefined) {
-              // console.log('data1.22222')
+                // console.log('data1.22222')
+                // console.log('data1.data.contractProperList', data1.data.contractProperList)
+              this.$refs.uploadFile.clearUpload()
+              this.$refs.uploadFile.newUpload('view', data1.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
               this.contractFileService.findById(this.inputForm.id).then(data2 => {
                 this.inputForm.contractProperList = data2.data.contractProperList
                 this.inputForm.contractInfoList = data2.data.contractInfoList
-                // console.log('data2', data2)
+                console.log('data2', data2)
                 this.contractInfoService.findById(data2.data.contractInfoId).then(data3 => {
                   data3.data.contractProperList = this.inputForm.contractProperList
                   data3.data.contractInfoList = this.inputForm.contractInfoList
-                  this.$refs.uploadFile.newUpload('view', data3.data.contractInfoList, 'cwWorkContract', null, null, null, null, false)
-                  this.$refs.archiveFile.newUpload(method, data3.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
+                  if (data3.data.filedType === '2' || data3.data.filedType === '5') {
+                    this.$refs.uploadFile.clearUpload()
+                    this.$refs.uploadFile.newUpload(method, data3.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
+                    this.$refs.archiveFile.newUpload('view', data3.data.contractInfoList, 'cwWorkContract', null, null, null, null, false)
+                  } else {
+                    this.$refs.uploadFile.clearUpload()
+                    this.$refs.uploadFile.newUpload(method, data3.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
+                    this.$refs.archiveFile.newUpload(method, data3.data.contractInfoList, 'cwWorkContract', null, null, null, null, false)
+                  }
+                  console.log('data3', data3)
                   this.saveData(data3.data, method)
                   if (this.formReadOnly) {
                     method = 'view'
@@ -496,9 +507,9 @@
                 })
               })
             } else {
-              // console.log('进来了22')
-              this.$refs.uploadFile.newUpload(method, data1.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
-              this.$refs.archiveFile.newUpload('view', [], 'cwWorkContract', null, null, null, null, false)
+                // console.log('进来了22')
+              this.$refs.uploadFile.clearUpload()
+              this.$refs.uploadFile.newUpload('view', data1.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
               this.saveData(data1.data, method)
               if (this.formReadOnly) {
                 method = 'view'
@@ -511,19 +522,25 @@
       },
       // 表单提交  保存数据
       doSubmit (status, callback) {
-        if (status === 'save') {
-          this.loading = true
-          // this.inputForm.status = '2'
-          this.inputForm.contractProperList = this.$refs.uploadFile.getDataList()
-          this.contractInfoService.save(this.inputForm).then(({data}) => {
-            // callback(data.businessTable, data.businessId, this.inputForm)
-            // this.$refs.inputForm.resetFields()
-            this.loading = false
-            this.close()
-          }).catch(() => {
-            this.$refs.inputForm.resetFields()
-            this.loading = false
-          })
+        if (this.$refs.archiveFile.checkProgress() || this.$refs.uploadFile.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          if (status === 'save') {
+            this.loading = true
+            this.inputForm.status = '5'
+            this.inputForm.contractProperList = this.$refs.uploadFile.getDataList()
+            console.log('this.inputForm', this.inputForm)
+            this.contractInfoService.save(this.inputForm).then(({data}) => {
+              // callback(data.businessTable, data.businessId, this.inputForm)
+              // this.$refs.inputForm.resetFields()
+              this.loading = false
+              this.close()
+            }).catch(() => {
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            })
+          }
         }
       },
       tabHandleClick (event) {

+ 75 - 55
src/views/modules/cw/workContract/ContractRegistrationForm.vue

@@ -557,56 +557,71 @@
       // 表单提交
       // 暂存
       async saveForm (callback) {
-        this.loading = true
-        this.inputForm.status = '1'
-        this.inputForm.contractProperList = this.$refs.uploadComponent.getDataList()
-        console.log('this.inputForm', this.inputForm)
-        await this.contractInfoService.save(this.inputForm).then(({data}) => {
-          callback()
-          this.$refs.inputForm.resetFields()
-          this.loading = false
-        }).catch(() => {
-          this.$refs.inputForm.resetFields()
+        if (this.$refs.archiveFile.checkProgress() || this.$refs.uploadComponent.checkProgress()) {
           this.loading = false
-        })
+          throw new Error()
+        } else {
+          this.loading = true
+          this.inputForm.status = '1'
+          this.inputForm.contractProperList = this.$refs.uploadComponent.getDataList()
+          console.log('this.inputForm', this.inputForm)
+          await this.contractInfoService.save(this.inputForm).then(({data}) => {
+            callback()
+            this.$refs.inputForm.resetFields()
+            this.loading = false
+          }).catch(() => {
+            this.$refs.inputForm.resetFields()
+            this.loading = false
+          })
+        }
       },
       // 送审
       startForm (callback) {
-        this.$refs['inputForm'].validate(async (valid) => {
-          if (valid) {
-            this.loading = true
-            this.inputForm.status = '2'
-            this.inputForm.contractProperList = this.$refs.uploadComponent.getDataList()
-            // this.inputForm.fees = this.inputForm.contractFees.join(',')
-            await this.contractInfoService.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
-            })
-          }
-        })
+        if (this.$refs.archiveFile.checkProgress() || this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          this.$refs['inputForm'].validate(async (valid) => {
+            if (valid) {
+              this.loading = true
+              this.inputForm.status = '2'
+              this.inputForm.contractProperList = this.$refs.uploadComponent.getDataList()
+              // this.inputForm.fees = this.inputForm.contractFees.join(',')
+              await this.contractInfoService.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.$refs['inputForm'].validate(async (valid) => {
-          if (valid) {
-            this.loading = true
-            this.inputForm.status = '2'
-            this.inputForm.contractProperList = this.$refs.uploadComponent.getDataList()
-            // this.inputForm.fees = this.inputForm.contractFees.join(',')
-            await this.contractInfoService.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
-            })
-          }
-        })
+        if (this.$refs.archiveFile.checkProgress() || this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          this.$refs['inputForm'].validate(async (valid) => {
+            if (valid) {
+              this.loading = true
+              this.inputForm.status = '2'
+              this.inputForm.contractProperList = this.$refs.uploadComponent.getDataList()
+              // this.inputForm.fees = this.inputForm.contractFees.join(',')
+              await this.contractInfoService.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
+              })
+            }
+          })
+        }
       },
       close () {
         this.$refs.inputForm.resetFields()
@@ -722,18 +737,23 @@
         this.visable = false
       },
       updateStatusById (type) {
-        if (type === 'agree') {
-          this.inputForm.status = '5'
-          this.contractInfoService.updateStatusById(this.inputForm)
-        }
-        // 驳回
-        if (type === 'reject') {
-          this.inputForm.status = '4'
-          this.contractInfoService.updateStatusById(this.inputForm)
-        }
-        if (type === 'reback') {
-          this.inputForm.status = '3'
-          this.contractInfoService.updateStatusById(this.inputForm)
+        if (this.$refs.archiveFile.checkProgress() || this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          if (type === 'agree') {
+            this.inputForm.status = '5'
+            this.contractInfoService.updateStatusById(this.inputForm)
+          }
+          // 驳回
+          if (type === 'reject') {
+            this.inputForm.status = '4'
+            this.contractInfoService.updateStatusById(this.inputForm)
+          }
+          if (type === 'reback') {
+            this.inputForm.status = '3'
+            this.contractInfoService.updateStatusById(this.inputForm)
+          }
         }
       },
       checkData () {