Selaa lähdekoodia

领用-退回功能开发

lizhenhao 2 vuotta sitten
vanhempi
commit
fdd295b196

+ 63 - 0
src/api/materialManagement/CollectService.js

@@ -43,4 +43,67 @@ export default class CollectService {
       params: params
     })
   }
+  createReturnData (param) {
+    return request({
+      url: '/material/collect/createReturnData',
+      method: 'post',
+      data: param
+    })
+  }
+  saveReturn (param) {
+    return request({
+      url: '/material/collect/saveReturn',
+      method: 'post',
+      data: param
+    })
+  }
+  saveReturnAgree (param) {
+    return request({
+      url: '/material/collect/saveReturnAgree',
+      method: 'post',
+      data: param
+    })
+  }
+  updateStatusByIdReturn (param) {
+    return request({
+      url: '/material/collect/updateStatusByIdReturn',
+      method: 'post',
+      data: param
+    })
+  }
+  findByReturnId (id) {
+    return request({
+      url: '/material/collect/findByReturnId',
+      method: 'get',
+      params: {returnId: id}
+    })
+  }
+  returnRequest (param) {
+    return request({
+      url: '/material/collect/returnRequest',
+      method: 'post',
+      data: param
+    })
+  }
+  findHiById (id) {
+    return request({
+      url: '/material/collect/findHiById',
+      method: 'get',
+      params: {collectId: id}
+    })
+  }
+  findHiByHiId (id) {
+    return request({
+      url: '/material/collect/findHiByHiId',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  findLastHiByid (id) {
+    return request({
+      url: '/material/collect/findLastHiByid',
+      method: 'get',
+      params: {collectId: id}
+    })
+  }
 }

+ 62 - 8
src/views/modules/flowable/task/TaskForm.vue

@@ -3,15 +3,15 @@
   <h4 style="text-align:center">{{title}}</h4>
 
   <el-tabs type="border-card" v-model="taskSelectedTab" @tab-click="onTabChange">
-    <el-tab-pane label="表单信息" name="form-first">
+    <el-tab-pane :key="1" label="表单信息" name="form-first">
       <component id="printForm" :status="status" :formReadOnly="formReadOnly" v-if="formType === '2'" :class="formReadOnly?'readonly':''" ref="form" :businessId="businessId" :is="form" @callBackFunc="callBackFunc" @changeLoading="changeLoading"></component>
 
       <PreviewForm  id="printForm"   v-if="formType !== '2'"  :processDefinitionId="procDefId" :edit="true" :taskFormData="taskFormData" ref="form"/>
     </el-tab-pane>
-    <el-tab-pane label="流程信息" v-if="procInsId"  name="form-second">
+    <el-tab-pane :key="2" label="流程信息" v-if="procInsId"  name="form-second">
       <flow-time-line :historicTaskList="historicTaskList"/>
     </el-tab-pane>
-    <el-tab-pane label="流程图"  name="form-third">
+    <el-tab-pane :key="3" label="流程图"  name="form-third">
        <el-card class="box-card"  shadow="hover">
           <div slot="header" class="clearfix">
             <span>流程图</span>
@@ -20,14 +20,17 @@
           <flow-chart ref="chart2" v-if="!procInsId" :processDefId="procDefId" />
         </el-card>
     </el-tab-pane>
-    <el-tab-pane label="流转记录" v-if="procInsId" name="form-forth">
+    <el-tab-pane :key="4" label="流转记录" v-if="procInsId" name="form-forth">
           <flow-step :historicTaskList="historicTaskList"/>
      </el-tab-pane>
-    <el-tab-pane label="修改历史" v-if="commonJS.isNotEmpty(wareHouseId)" name="form-sixth">
+    <el-tab-pane :key="5" label="入库修改历史" v-if="commonJS.isNotEmpty(wareHouseId)" name="form-sixth">
       <vxe-table
+        ref="wareHouseTable"
         border="inner"
         size="mini"
+        :key="222"
         max-height="1000px"
+        class="vxe-table-element"
         :data="dataListHi">
         <vxe-column type="seq" width="60" title="序号"></vxe-column>
         <vxe-column min-width="120" align="center" title="修改类型" field="updateTradeType">
@@ -56,6 +59,31 @@
         </vxe-column>
       </vxe-table>
     </el-tab-pane>
+    <el-tab-pane :key="6" label="领用退回历史" v-if="returnId" name="form-seventh">
+      <vxe-table
+        ref="returnTable"
+        border="inner"
+        :key="111"
+        size="mini"
+        class="vxe-table-element"
+        max-height="1000px"
+        :data="dataListHiCollect">
+        <vxe-column type="seq" width="60" title="序号"></vxe-column>
+        <vxe-column min-width="160" align="center" title="退回物品" field="returnGoods">
+          <template v-slot="scope">
+            <span v-if="commonJS.isNotEmpty(scope.row.returnGoods)"> {{scope.row.returnGoods}} </span>
+            <span v-else> -- </span>
+          </template>
+        </vxe-column>
+        <vxe-column min-width="160" align="center" title="退回申请人" field="returnUserName"></vxe-column>
+        <vxe-column min-width="160" align="center" title="退回时间" field="createDate"></vxe-column>
+        <vxe-column title="操作" width="150px" fixed="right" align="center">
+          <template  slot-scope="scope">
+            <el-button type="text" size="small" @click="hiDetailCollect(scope.row)">退回详情</el-button>
+          </template>
+        </vxe-column>
+      </vxe-table>
+    </el-tab-pane>
   </el-tabs>
 
 
@@ -127,6 +155,7 @@
 <user-select-dialog title="选择委派用户" ref="delegateUserSelectDialog" :limit="1" @doSubmit="selectUsersToDelateTask"></user-select-dialog>
 <user-select-dialog title="选择加签用户" ref="addSignTaskUserSelectDialog" @doSubmit="selectUsersToAddSignTask"></user-select-dialog>
 <WareHouseHi ref="wareHouseHi"></WareHouseHi>
+<CollectReturnHi ref="collectReturnHi"></CollectReturnHi>
 </div>
 </template>
 
@@ -147,6 +176,8 @@
   import NoticeService from '@/api/flowable/NoticeService'
   import WareHouseService from '@/api/materialManagement/WareHouseService'
   import WareHouseHi from '@/views/modules/materialManagement/wareHouse/WareHouseHi'
+  import CollectService from '@/api/materialManagement/CollectService'
+  import CollectReturnHi from '@/views/modules/materialManagement/collect/CollectReturnHiForm'
   const _import = require('@/router/import-' + process.env.NODE_ENV)
   export default {
     taskDefExtensionService: null,
@@ -156,6 +187,7 @@
     processService: null,
     noticeService: null,
     wareHouseService: null,
+    collectService: null,
     created () {
       this.taskService = new TaskService()
       this.taskDefExtensionService = new TaskDefExtensionService()
@@ -164,6 +196,7 @@
       this.processService = new ProcessService()
       this.noticeService = new NoticeService()
       this.wareHouseService = new WareHouseService()
+      this.collectService = new CollectService()
     },
     activated () {
       this.init()
@@ -248,7 +281,8 @@
       FlowStep,
       FlowTimeLine,
       WorkContractForm2,
-      WareHouseHi
+      WareHouseHi,
+      CollectReturnHi
     },
     watch: {
       isAssign (val) {
@@ -294,6 +328,7 @@
         this.contractTitle = this.$route.query.contractTitle
         this.statusFlag = this.$route.query.statusFlag
         this.wareHouseId = this.$route.query.wareHouseId
+        this.returnId = this.$route.query.returnId
         if (this.commonJS.isEmpty(this.$route.query.isShow)) {
           this.isShow = 'true'
         } else {
@@ -536,6 +571,7 @@
       // Process_1673924346231 中审-报销审批
       // Process_1667894339167 会计-合同登记
       // Process_1678692643340 会计-项目报告归档-苏州分部
+      // Process_1683767097901 物资管理-领用退回申请
       // 驳回
       reject (vars) {
         if (this.procDefId.includes('Process_1667978088459') ||
@@ -570,7 +606,8 @@
           this.procDefId.includes('Process_1673600899831') ||
           this.procDefId.includes('Process_1673924346231') ||
           this.procDefId.includes('Process_1667894339167') ||
-          this.procDefId.includes('Process_1678692643340')
+          this.procDefId.includes('Process_1678692643340') ||
+          this.procDefId.includes('Process_1683767097901')
         ) {
           console.log('进入新版驳回')
           this.$confirm(`确定驳回流程吗?`, '提示', {
@@ -1049,12 +1086,27 @@
             })
           }
         }
+        if (event.name === 'form-seventh') {
+          if (this.commonJS.isNotEmpty(this.returnId)) {
+            this.collectService.findByReturnId(this.returnId).then(({data}) => {
+              this.collectService.findHiById(data.id).then(({data}) => {
+                this.dataListHiCollect = data
+              })
+            })
+          }
+        }
       },
       // 打开入库修改历史详情页
       hiDetail (row) {
         if (this.commonJS.isNotEmpty(row.id)) {
           this.$refs.wareHouseHi.init(row.id)
         }
+      },
+      // 打开领用退回历史详情页
+      hiDetailCollect (row) {
+        if (this.commonJS.isNotEmpty(row.id)) {
+          this.$refs.collectReturnHi.init(row.id)
+        }
       }
     },
     data () {
@@ -1094,7 +1146,9 @@
         cUser: false,
         loading: false,
         wareHouseId: '',
-        dataListHi: []
+        returnId: '',
+        dataListHi: [],
+        dataListHiCollect: []
       }
     }
   }

+ 55 - 3
src/views/modules/flowable/task/TaskFormDetail.vue

@@ -29,7 +29,7 @@
     <el-tab-pane label="流转记录" v-if="procInsId" name="form-forth">
           <flow-step :historicTaskList="historicTaskList"/>
      </el-tab-pane>
-    <el-tab-pane label="修改历史" v-if="wareHouseId" name="form-sixth">
+    <el-tab-pane label="入库修改历史" v-if="wareHouseId" name="form-sixth">
       <vxe-table
         border="inner"
         size="mini"
@@ -62,8 +62,36 @@
         </vxe-column>
       </vxe-table>
     </el-tab-pane>
+    <el-tab-pane label="领用退回历史" v-if="returnId" name="form-seventh">
+      <vxe-table
+        border="inner"
+        size="mini"
+        max-height="1000px"
+        :data="dataListHiCollect">
+        <vxe-column type="seq" width="60" title="序号"></vxe-column>
+        <vxe-column min-width="160" align="center" title="退回物品" field="returnGoods">
+          <template v-slot="scope">
+            <span v-if="commonJS.isNotEmpty(scope.row.returnGoods)"> {{scope.row.returnGoods}} </span>
+            <span v-else> -- </span>
+          </template>
+        </vxe-column>
+        <vxe-column min-width="160" align="center" title="退回申请人" field="returnUserName">
+          <template v-slot="scope">
+            <span>{{scope.row.returnUserName}} </span>
+          </template>
+        </vxe-column>
+        <vxe-column min-width="160" align="center" title="退回时间" field="createDate"></vxe-column>
+        <vxe-column title="操作" width="150px" fixed="right" align="center">
+          <template  slot-scope="scope">
+            <el-button type="text" size="small" @click="hiDetailCollect(scope.row)">退回详情</el-button>
+          </template>
+        </vxe-column>
+      </vxe-table>
+    </el-tab-pane>
   </el-tabs>
   <WareHouseHi ref="wareHouseHi"></WareHouseHi>
+  <CollectReturnHi ref="collectReturnHi"></CollectReturnHi>
+
 </div>
 </template>
 
@@ -78,6 +106,8 @@ import FormService from '@/api/flowable/FormService'
 import ProcessService from '@/api/flowable/ProcessService'
 import WareHouseService from '@/api/materialManagement/WareHouseService'
 import WareHouseHi from '@/views/modules/materialManagement/wareHouse/WareHouseHi'
+import CollectService from '@/api/materialManagement/CollectService'
+import CollectReturnHi from '@/views/modules/materialManagement/collect/CollectReturnHiForm'
   const _import = require('@/router/import-' + process.env.NODE_ENV)
   export default {
     taskDefExtensionService: null,
@@ -86,11 +116,13 @@ import WareHouseHi from '@/views/modules/materialManagement/wareHouse/WareHouseH
     flowCopyService: null,
     porcessService: null,
     wareHouseService: null,
+    collectService: null,
     beforeCreate () {
       this.taskService = new TaskService()
       this.formService = new FormService()
       this.porcessService = new ProcessService()
       this.wareHouseService = new WareHouseService()
+      this.collectService = new CollectService()
     },
     activated () {
       this.init()
@@ -127,7 +159,8 @@ import WareHouseHi from '@/views/modules/materialManagement/wareHouse/WareHouseH
       PreviewForm,
       FlowStep,
       FlowTimeLine,
-      WareHouseHi
+      WareHouseHi,
+      CollectReturnHi
       // FlowChart
     },
     watch: {
@@ -155,6 +188,8 @@ import WareHouseHi from '@/views/modules/materialManagement/wareHouse/WareHouseH
         this.businessId = this.$route.query.businessId
         this.procInsId = this.$route.query.procInsId
         this.wareHouseId = this.$route.query.wareHouseId
+        this.returnId = this.$route.query.returnId
+
         this.formReadOnly = true
         // this.$nextTick(() => {
         //   try {
@@ -180,12 +215,27 @@ import WareHouseHi from '@/views/modules/materialManagement/wareHouse/WareHouseH
             })
           }
         }
+        if (event.name === 'form-seventh') {
+          if (this.commonJS.isNotEmpty(this.returnId)) {
+            this.collectService.findByReturnId(this.returnId).then(({data}) => {
+              this.collectService.findHiById(data.id).then(({data}) => {
+                this.dataListHiCollect = data
+              })
+            })
+          }
+        }
       },
       // 打开入库修改历史详情页
       hiDetail (row) {
         if (this.commonJS.isNotEmpty(row.id)) {
           this.$refs.wareHouseHi.init(row.id)
         }
+      },
+      // 打开领用退回历史详情页
+      hiDetailCollect (row) {
+        if (this.commonJS.isNotEmpty(row.id)) {
+          this.$refs.collectReturnHi.init(row.id)
+        }
       }
     },
     data () {
@@ -207,7 +257,9 @@ import WareHouseHi from '@/views/modules/materialManagement/wareHouse/WareHouseH
         title: '',
         businessId: '',
         wareHouseId: '',
-        dataListHi: []
+        returnId: '',
+        dataListHi: [],
+        dataListHiCollect: []
       }
     }
   }

+ 1 - 0
src/views/modules/flowable/task/TodoList.vue

@@ -277,6 +277,7 @@
             path: '/flowable/task/TaskForm',
             query: {
               wareHouseId: row.processDefinitionName === '物资管理-入库修改' ? data.businessId : '',
+              returnId: row.processDefinitionName === '物资管理-领用退回申请' ? data.businessId : '',
               formTitle: `${row.vars.title}`,
               cUser: cUser,
               isShow: false,

+ 204 - 8
src/views/modules/materialManagement/collect/CollectList.vue

@@ -89,16 +89,15 @@
             </template>
           </vxe-column>
           <vxe-column min-width="160" align="center" title="领用物品名称" field="goodsName">
-<!--            <template slot-scope="scope">-->
-<!--              <el-link  type="primary" :underline="false" v-if="hasPermission('material:list')" @click="view(scope.row.id)">{{scope.row.goodsName}}</el-link>-->
-<!--              <el-link  type="primary" :underline="false" v-else-if="hasPermission('material:list')"  @click="view(scope.row.id,)">{{scope.row.goodsName}}</el-link>-->
-<!--              <span v-else>{{scope.row.goodsName}}</span>-->
-<!--            </template>-->
+            <template slot-scope="scope">
+              <span v-if="commonJS.isEmpty(scope.row.detailId)" style="color: #F56C6C">领用物品已全部退回</span>
+              <span v-else>{{scope.row.goodsName}}</span>
+            </template>
           </vxe-column>
           <vxe-column min-width="160" align="center" title="经办人" field="handledByName"></vxe-column>
           <vxe-column min-width="160" align="center" title="经办人部门" field="handledByOfficeName"></vxe-column>
           <vxe-column min-width="160" align="center" title="领用时间" field="collectDate"></vxe-column>
-          <vxe-column  min-width="150px"align="center" fixed="right" title="状态" field="status" >
+          <vxe-column  min-width="100px"align="center" fixed="right" title="状态" field="status" >
             <template slot-scope="scope">
               <el-button  type="text" @click="detail(scope.row)" effect="dark" size="mini"
                           :type="$dictUtils.getDictLabel('cw_status_flag', scope.row.status, '-')">
@@ -106,8 +105,16 @@
               </el-button>
             </template>
           </vxe-column>
+          <vxe-column  min-width="100px"align="center" fixed="right" title="退回状态" field="statusReturn" >
+            <template slot-scope="scope">
+              <el-button  type="text" @click="detailReturn(scope.row)" effect="dark" size="mini"
+                          :type="$dictUtils.getDictLabel('cw_status_flag', scope.row.statusReturn, '-')">
+                {{$dictUtils.getDictLabel("cw_status", scope.row.statusReturn, '未发起')}}
+              </el-button>
+            </template>
+          </vxe-column>
 
-          <vxe-column title="操作" width="150px" fixed="right" align="center">
+          <vxe-column title="操作" width="220px" fixed="right" align="center">
             <template  slot-scope="scope">
               <el-button v-if="hasPermission('material:edit')&&scope.row.createBy === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3')" type="text"  size="small" @click="push(scope.row)">修改</el-button>
               <el-button v-else-if="hasPermission('material:edit')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"  size="small" @click="edit(scope.row.id)">修改</el-button>
@@ -116,6 +123,18 @@
               <el-button v-else-if="hasPermission('material:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
               <el-button v-if="scope.row.status==='2' && checkIsAudit(scope.row)" type="text"  size="small" @click="examine(scope.row)">审核</el-button>
               <el-button v-if="hasPermission('material:edit')&&scope.row.status === '4'&&scope.row.createBy === $store.state.user.id" type="text"  size="small" @click="adjust(scope.row)">驳回调整</el-button>
+
+              <el-button v-if="hasPermission('material:edit')&&scope.row.status === '5'&&scope.row.createBy === $store.state.user.id && commonJS.isNotEmpty(scope.row.detailId) &&
+              (commonJS.isEmpty(scope.row.statusReturn) || scope.row.statusReturn === '0' || scope.row.statusReturn === '1' || scope.row.statusReturn === '3' || scope.row.statusReturn === '5')"
+                         type="text"  size="small" @click="returnPush(scope.row)">退回</el-button>
+              <el-button v-if="hasPermission('material:edit')&&scope.row.statusReturn === '2'&&scope.row.createBy === $store.state.user.id"
+                         type="text"  size="small" @click="rebackReturn(scope.row)">撤回</el-button>
+              <el-button v-if="hasPermission('material:edit')&&scope.row.statusReturn === '3'&&scope.row.createBy === $store.state.user.id"
+                         type="text"  size="small" @click="returnRequest(scope.row)">取消申请</el-button>
+              <el-button v-if="scope.row.statusReturn==='2' && checkIsAuditReturn(scope.row)"
+                         type="text"  size="small" @click="examineReturn(scope.row)">退回审核</el-button>
+              <el-button v-if="hasPermission('material:edit')&&scope.row.statusReturn === '4'&&scope.row.createBy === $store.state.user.id"
+                         type="text"  size="small" @click="adjustReturn(scope.row)">驳回调整</el-button>
             </template>
           </vxe-column>
         </vxe-table>
@@ -173,7 +192,9 @@
         processDefinitionAuditId: '',
         procDefAuditKey: '',
         isAdmin: false,
-        create: ''
+        create: '',
+        processDefinitionAuditIdReturn: '',
+        procDefAuditKeyReturn: ''
       }
     },
     workClientService: null,
@@ -264,6 +285,12 @@
             this.procDefAuditKey = data.key
           }
         })
+        this.processService.getByName('物资管理-领用退回申请').then(({data}) => {
+          if (!this.commonJS.isEmpty(data.id)) {
+            this.processDefinitionAuditIdReturn = data.id
+            this.procDefAuditKeyReturn = data.key
+          }
+        })
       },
       // 当前页
       currentChangeHandle ({ currentPage, pageSize }) {
@@ -469,6 +496,175 @@
           }
         }
         return false
+      },
+      // 发起领用-退回申请
+      async returnPush (row) {
+        if (this.commonJS.isEmpty(row.returnId)) {
+          this.loading = true
+          // 由于退回数据表中没有数据,需要生成一条默认数据
+          let resp = await this.collectService.createReturnData({id: row.id})
+          if (resp.data) {
+            this.loading = false
+            row.returnId = resp.data.returnId
+            this.returnPushTrue(row)
+          } else {
+            this.loading = false
+            this.$message.error('无法退回数据,联系管理员解决')
+          }
+        } else {
+          this.returnPushTrue(row)
+        }
+      },
+      returnPushTrue (row) {
+        // 读取流程表单
+        let title = `发起流程【领用-退回申请】`
+        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[领用-退回申请]`
+        let status = 'startAndHold'
+        if (row.statusReturn === '3') {
+          status = 'startAndClose'
+        } else if (row.statusReturn === '4') {
+          status = 'reapplyFlag'
+        }
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionAuditIdReturn,
+          businessId: row.returnId,
+          businessTable: 'material_management_collect_basics_return'}).then((data) => {
+            this.$router.push({
+              path: '/flowable/task/TaskForm',
+              query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+                procDefId: this.processDefinitionAuditIdReturn,
+                procDefKey: this.procDefAuditKeyReturn,
+                title: title,
+                formType: data.data.formType,
+                formUrl: data.data.formUrl,
+                formTitle: processTitle,
+                businessTable: 'material_management_collect_basics_return',
+                businessId: row.returnId,
+                isShow: 'false',
+                status: status,
+                routePath: '/materialManagement/collect/CollectList',
+                returnId: row.returnId
+              }
+            })
+          })
+      },
+      detailReturn (row) {
+        if (this.commonJS.isNotEmpty(row.statusReturn) && row.statusReturn !== '0' && row.statusReturn !== '1') {
+          // eslint-disable-next-line eqeqeq
+          this.taskService.getTaskDef({
+            procInsId: row.procInsIdReturn,
+            procDefId: this.processDefinitionAuditIdReturn
+          }).then(({data}) => {
+            this.$router.push({
+              path: '/flowable/task/TaskFormDetail',
+              query: {
+                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+                isShow: 'false',
+                readOnly: true,
+                title: '领用-退回申请' + '流程详情',
+                formTitle: '领用-退回申请' + '流程详情',
+                businessId: row.returnId,
+                status: 'reback',
+                returnId: row.returnId
+              }
+            })
+          })
+        }
+      },
+      // 撤回退回流程
+      rebackReturn (row) {
+        this.$confirm(`确定要撤回该申请吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.collectService.findById(row.id).then(({data}) => {
+            if (data.statusReturn !== '2') { // status的值不等于“审核中”,就弹出提示
+              this.$message.error('数据已发生改变或不存在,请刷新数据')
+              this.refreshList()
+            } else {
+              this.processService.revokeProcIns(row.procInsIdReturn).then(({data}) => {
+                let form = {status: '3', id: row.id}
+                this.collectService.updateStatusByIdReturn(form)
+                this.$message.success(data)
+                this.refreshList()
+              })
+            }
+          })
+        })
+      },
+      returnRequest (row) {
+        this.$confirm(`确定要取消该申请吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.collectService.findById(row.id).then(({data}) => {
+            if (data.statusReturn !== '3') { // status的值不等于“已撤回”,就弹出提示
+              this.$message.error('数据已发生改变或不存在,请刷新数据')
+              this.refreshList()
+            } else {
+              this.collectService.returnRequest({id: row.id}).then(({data}) => {
+                this.$message.success(data)
+                this.refreshList()
+              })
+            }
+          })
+        })
+      },
+      // 驳回后调整
+      adjustReturn (row) {
+        this.collectService.findById(row.id).then(({data}) => {
+          if (data.statusReturn !== '4') { // status的值不等于“驳回”,就弹出提示
+            this.$message.error('数据已发生改变或不存在,请刷新数据')
+            this.refreshList()
+          } else {
+            this.todoReturn(row)
+          }
+        })
+      },
+      // 审核
+      examineReturn (row) {
+        this.collectService.findById(row.id).then(({data}) => {
+          if (data.statusReturn !== '2') { // status的值不等于“审核中”,就弹出提示
+            this.$message.error('数据已发生改变或不存在,请刷新数据')
+            this.refreshList()
+          } else {
+            this.todoReturn(row)
+          }
+        })
+      },
+      // 审核或重新调整跳转
+      todoReturn (row) {
+        let cUser = false
+        this.taskService.getTaskDefInfo({
+          taskId: row.taskIdReturn
+        }).then(({data}) => {
+          this.$router.push({
+            path: '/flowable/task/TaskForm',
+            query: {
+              ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
+              isShow: false,
+              formReadOnly: true,
+              formTitle: `${data.taskName}`,
+              cUser: cUser,
+              title: `审批【${data.taskName || ''}】`,
+              routePath: '/materialManagement/collect/CollectList'   // 数据处理后需要跳转的页面路径
+            }
+          })
+        })
+      },
+      // 查询当前登录人是否是数据的审核人
+      checkIsAuditReturn (row) {
+        let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
+        if (this.commonJS.isNotEmpty(row.auditUserIdsReturn)) {
+          for (const userId of row.auditUserIdsReturn) {
+            if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时,返回true
+              return true
+            }
+          }
+        }
+        return false
       }
     }
   }

+ 837 - 0
src/views/modules/materialManagement/collect/CollectReturnForm.vue

@@ -0,0 +1,837 @@
+<template>
+  <div>
+    <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="status === 'audit' || status === 'taskFormDetail'"
+             label-width="100px" @submit.native.prevent>
+
+      <el-divider content-position="left"><i class="el-icon-document"></i> 基础信息</el-divider>
+      <el-row :gutter="26">
+        <el-col :span="12">
+          <el-form-item label="领用编号" prop="collectNo">
+            <el-input placeholder="自动生成" v-model="inputForm.collectNo" :disabled="true"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="经办人" prop="handledBy">
+            <el-input v-model="inputForm.handledBy" :disabled="true"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="经办人部门" prop="handledByOffice">
+            <SelectTree
+              :disabled="true"
+              ref="officeTree"
+              :props="{
+                  value: 'id',             // ID字段名
+                  label: 'name',         // 显示名称
+                  children: 'children'    // 子级字段名
+                }"
+
+              :url="`/sys/office/treeData?type=2`"
+              :value="inputForm.handledByOffice"
+              :accordion="true"
+              size="medium"
+              @getValue="(value) => {inputForm.handledByOffice=value}"/>
+<!--            <el-input v-model="inputForm.handledByOffice" :disabled="true"></el-input>-->
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="领用时间" prop="collectDate" :rules="[{required: true, message:'请选择领用时间', trigger:'blur'}]">
+            <el-date-picker
+              :disabled="true"
+              v-model="inputForm.collectDate"
+              type="date"
+              placement="bottom-start"
+              value-format="yyyy-MM-dd"
+              style="width: 100%"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="备注" prop="remarks">
+            <el-input v-model="inputForm.remarks"
+                      type="textarea"
+                      :rows="5"
+                      maxlength="500"
+                      placeholder="请填写备注信息"
+                      :disabled="true"
+                      show-word-limit>
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-divider content-position="left"><i class="el-icon-document"></i>
+        领用详情
+      </el-divider>
+      <el-row  :gutter="15" >
+        <vxe-table
+          border
+          show-footer
+          show-overflow
+          ref="detailTable"
+          class="vxe-table-element"
+          :data="inputForm.detailInfos"
+          style="margin-left: 5em"
+          :row-class-name="rowClassName"
+        >
+          <vxe-table-column field="recipientAgent" title="领用人" align="center">
+            <template scope="scope">
+              <span>{{scope.row.recipientAgent}}</span><span v-if="scope.row.isReturn === '1'">(已退回)</span>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="recipientOffice" title="领用人部门" align="center"></vxe-table-column>
+          <vxe-table-column field="collectType" title="领用类型" align="center"></vxe-table-column>
+          <vxe-table-column field="goodsName" title="物品名称" align="center"></vxe-table-column>
+          <vxe-table-column field="collectNumber" title="领用数量" align="center"></vxe-table-column>
+          <vxe-table-column v-if="status === 'audit'" field="surplusNumber" title="库存数量" align="center"></vxe-table-column>
+          <vxe-table-column field="company" title="单位" align="center"></vxe-table-column>
+          <vxe-table-column field="remarks" title="备注" align="center"></vxe-table-column>
+          <vxe-table-column title="操作" width="170" align="center">
+            <template v-slot="scope">
+              <el-button size="mini" type="primary" :disabled="false" @click="seeFileInfo(scope.$rowIndex)">附件</el-button>
+              <el-button size="mini" type="primary" v-if="scope.row.isReturn === '0' && status !== 'audit' && status !== 'taskFormDetail'" @click="returnCollect(scope.$rowIndex)">退回</el-button>
+              <el-button size="mini" type="primary" v-if="scope.row.isReturn === '1' && status !== 'audit' && status !== 'taskFormDetail'" @click="cancelReturn(scope.$rowIndex)">取消退回</el-button>
+            </template>
+          </vxe-table-column>
+        </vxe-table>
+      </el-row>
+      <el-row>
+        <el-col :span="24" style="margin-top: 20px">
+          <el-form-item label="退回原因" prop="returnCause" :rules="[{required: true, message: '退回原因不能为空', trigger: 'blur'}]">
+            <el-input v-model="inputForm.returnCause"
+                      type="textarea"
+                      :rows="5"
+                      maxlength="500"
+                      placeholder="请填写退回原因"
+                      show-word-limit>
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+    </el-form>
+    <PurchasePageForm  ref="purchasePageForm" @getProject="getContract"></PurchasePageForm>
+    <!-- 附件 -->
+    <MaterialManagementDialog ref="materialManagementDialog" @getUpload="getUpload"></MaterialManagementDialog>
+    <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+    <CwProgramPageForm ref="cwProgramPageForm" @getProgram="getProgram"></CwProgramPageForm>
+    <MaterialTypePullForm ref="materialTypePullForm" @getProgramForType="getProgramForType"></MaterialTypePullForm>
+    <UserPullForm ref="userPullForm" @getProgramForUser="getProgramForUser"></UserPullForm>
+  </div>
+</template>
+
+<script>
+  import UserSelect from '@/components/userSelect'
+  import MaterialManagementDialog from '../file/MaterialManagementDialog'
+  import CollectService from '@/api/materialManagement/CollectService'
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import UserService from '@/api/sys/UserService'
+  import CwProgramPageForm from '@/views/modules/cw/reimbursementApproval/info/CwProgramPageForm'
+  import MaterialTypePullForm from '../info/MaterialTypePullForm'
+  import UserPullForm from '@/views/modules/finance/invoice/UserPullForm'
+  import PurchasePageForm from './PurchasePageForm'
+  import CommonApi from '@/api/cw/common/CommonApi'
+  export default {
+    data () {
+      return {
+        validRules: {
+          recipientAgent: [
+            {required: true, message: '领用人不能为空'}
+          ],
+          recipientOffice: [
+            {required: true, message: '领用人部门不能为空'}
+          ],
+          collectType: [
+            {required: true, message: '领用类型不能为空'}
+          ],
+          goodsName: [
+            {required: true, message: '物品名称不能为空'}
+          ],
+          collectNumber: [
+            {required: true, message: '领用数量不能为空'}
+          ]
+        },
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        indexRow: '',
+        inputForm: {
+          fileInfoLost: [],
+          handledByOffice: '',
+          handledBy: '',
+          handledById: '',
+          collectNo: '', // 领用编号
+          userId: '',
+          collectDate: '',
+          remarks: '',
+          detailInfos: [],
+          // amountInfos: [],
+          files: [], // 附件信息
+          procInsId: '',
+          statusReturn: '',
+          procInsIdReturn: '',
+          processDefinitionIdReturn: '',
+          returnId: '',
+          returnCause: ''
+        },
+        keyWatch: ''
+      }
+    },
+    collectService: null,
+    userService: null,
+    commonApi: null,
+    created () {
+      this.collectService = new CollectService()
+      this.userService = new UserService()
+      this.commonApi = new CommonApi()
+    },
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      },
+      status: {
+        type: String,
+        default: ''
+      }
+    },
+    components: {
+      UserSelect,
+      MaterialManagementDialog,
+      UpLoadComponent,
+      SelectUserTree,
+      SelectTree,
+      CwProgramPageForm,
+      MaterialTypePullForm,
+      UserPullForm,
+      PurchasePageForm
+    },
+    computed: {
+      bus: {
+        get () {
+          return this.businessId
+        },
+        set (val) {
+          this.businessId = val
+        }
+      },
+      name () {
+        return JSON.parse(localStorage.getItem('user')).name
+      },
+      officeName () {
+        return JSON.parse(localStorage.getItem('user')).officeDTO.name
+      },
+      userId () {
+        return JSON.parse(localStorage.getItem('user')).id
+      },
+      recipientAgentId () {
+        return JSON.parse(localStorage.getItem('user')).id
+      },
+      collectTypeId () {
+        return ''
+      }
+    },
+    watch: {
+      'keyWatch': {
+        handler (newVal) {
+          if (this.commonJS.isNotEmpty(this.bus)) {
+            this.init('', this.bus)
+          } else {
+            this.$nextTick(() => {
+              this.$refs.inputForm.resetFields()
+            })
+          }
+        }
+      },
+      'loading': {
+        handler (newVal) {
+          this.$emit('changeLoading', newVal)
+          this.$refs.uploadComponent.changeLoading(newVal)
+        }
+      }
+    },
+    methods: {
+      getKeyWatch (keyWatch) {
+        this.keyWatch = keyWatch
+      },
+      init (method, id) {
+        this.method = method
+        this.inputForm = {
+          fileInfoLost: [],
+          handledByOffice: '',
+          handledBy: JSON.parse(localStorage.getItem('user')).name,
+          handledById: JSON.parse(localStorage.getItem('user')).id,
+          collectNo: '', // 领用编号
+          userId: JSON.parse(localStorage.getItem('user')).id,
+          collectDate: new Date(),
+          remarks: '',
+          detailInfos: [],
+          // amountInfos: [],
+          files: [], // 附件信息
+          procInsId: '',
+          statusReturn: '',
+          procInsIdReturn: '',
+          processDefinitionIdReturn: '',
+          returnId: '',
+          returnCause: ''
+        }
+        if (method === 'add') {
+          this.title = `新建领用类型`
+        } else if (method === 'edit') {
+          this.title = '修改领用类型'
+        }
+        this.inputForm.id = id
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
+            this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
+          }
+          if (this.status === 'audit' || this.status === 'taskFormDetail') {
+            method = 'view'
+          }
+          this.loading = true
+          this.$refs.inputForm.resetFields()
+          this.collectService.findByReturnId(this.inputForm.id).then(({data}) => {
+            if (this.inputForm.id !== 'false') {
+              this.inputForm = this.recover(this.inputForm, data)
+              if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
+                this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
+              }
+              if (this.commonJS.isNotEmpty(data.recipientAgentId)) {
+                this.recipientAgentId = data.recipientAgentId
+              }
+              if (this.commonJS.isNotEmpty(data.collectTypeId)) {
+                this.collectTypeId = data.collectTypeId
+              }
+              if (this.commonJS.isNotEmpty(this.inputForm.detailInfos)) {
+                let i = this.inputForm.detailInfos.length
+                for (let j = 0; j < i; j++) {
+                  if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradePrice)) {
+                    if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradeNumber)) {
+                      this.inputForm.detailInfos[j].priceSum = this.inputForm.detailInfos[j].tradePrice * this.inputForm.detailInfos[j].tradeNumber
+                    }
+                  }
+                }
+              }
+              this.$refs.uploadComponent.newUpload('view', this.inputForm.files, 'material_collect')
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.loading = false
+            } else {
+              if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
+                this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
+              }
+              if (this.commonJS.isEmpty(this.inputForm.handledBy)) {
+                this.inputForm.handledBy = JSON.parse(localStorage.getItem('user')).name
+              }
+              if (this.commonJS.isEmpty(this.inputForm.handledById)) {
+                this.inputForm.handledById = JSON.parse(localStorage.getItem('user')).id
+              }
+              if (this.commonJS.isEmpty(this.inputForm.collectDate)) {
+                this.inputForm.collectDate = new Date()
+              }
+              this.inputForm.detailInfos = []
+              this.loading = false
+            }
+          })
+        })
+      },
+      getUpload (p, index) {
+        p.then((list) => {
+          // list为返回数据
+          this.inputForm.detailInfos[index].fileInfoLost = list
+          this.inputForm.detailInfos[index].fileNumber = list.length
+          this.tableKeyClient = Math.random()
+        })
+      },
+      seeFileInfo (index) {
+        if (this.commonJS.isEmpty(this.inputForm.detailInfos[index].fileInfoLost)) {
+          this.inputForm.detailInfos[index].fileInfoLost = []
+        }
+        this.$refs.materialManagementDialog.newUpload('view', this.inputForm.detailInfos[index].fileInfoLost, null, null, null, null, null, false, index)
+      },
+      sss (index) {
+        if (this.commonJS.isEmpty(this.inputForm.detailInfos[index].fileInfoLost)) {
+          this.inputForm.detailInfos[index].fileInfoLost = []
+        }
+        this.$refs.materialManagementDialog.newUpload(null, this.inputForm.detailInfos[index].fileInfoLost, null, null, null, null, null, false, index)
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            this.inputForm.id = this.businessId
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            this.collectService.save(this.inputForm).then(({data}) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.inputForm.detailInfos = []
+        // this.inputForm.amountInfos = []
+        this.$refs.uploadComponent.clearUpload()
+
+        this.visible = false
+        this.$refs.inputForm.resetFields()
+      },
+      // 删除
+      removeEvent (row, rowIndex, type) {
+        if (type === 'detail') {
+          this.$refs.detailTable.remove(row)
+          this.inputForm.detailInfos.splice(rowIndex, 1)
+        }
+        if (type === 'amount') {
+          this.$refs.amountTable.remove(row)
+          // this.inputForm.amountInfos.splice(rowIndex, 1)
+        }
+      },
+      // 新增
+      async insertEvent (type) {
+        if (type === 'detail') {
+          await this.$refs.detailTable.insert().then((data) => {
+            data.recipientAgent = JSON.parse(localStorage.getItem('user')).name
+            data.recipientAgentId = this.recipientAgentId
+            data.recipientOffice = this.officeName
+            this.inputForm.detailInfos.push(data)
+          })
+        }
+        if (type === 'amount') {
+          await this.$refs.amountTable.insert().then((data) => {
+            // this.inputForm.amountInfos.push(data)
+          })
+        }
+      },
+      reapplyForm (callback) {
+        this.loading = true
+        this.collectService.findById(this.inputForm.id).then(({data}) => {
+          if (data.statusReturn !== '4') { // 审核状态不是“驳回”,就弹出提示
+            this.loading = false
+            this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+          } else {
+            this.startFormTrue(callback)
+          }
+        })
+      },
+      startForm (callback) {
+        this.loading = true
+        if (this.commonJS.isNotEmpty(this.inputForm.id)) {
+          this.collectService.findById(this.inputForm.id).then(({data}) => {
+            // 审核状态不是“未发起”或“暂存”或“撤回”,就弹出提示
+            if (this.commonJS.isNotEmpty(data.statusReturn) && data.statusReturn !== '0' && data.statusReturn !== '1' && data.statusReturn !== '3' && data.statusReturn !== '5') {
+              this.loading = false
+              this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+              throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            } else {
+              this.startFormTrue(callback)
+            }
+          })
+        } else {
+          this.startFormTrue(callback)
+        }
+      },
+      // 暂存
+      async saveForm (callback) {
+        this.loading = true
+        if (this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          return
+        }
+        if (this.commonJS.isEmpty(this.inputForm.files)) {
+          this.inputForm.files = []
+        }
+        this.inputForm.files = this.$refs.uploadComponent.getDataList()
+        this.inputForm.statusReturn = '1'
+        this.collectService.saveReturn(this.inputForm).then(({data}) => {
+          callback()
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+        }).catch(() => {
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+        })
+      },
+      // 送审
+      async startFormTrue (callback) {
+        this.loading = true
+        this.$refs['inputForm'].validate(async (valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            if (this.commonJS.isEmpty(this.inputForm.detailInfos)) {
+              this.$message.error('至少填写一条领用详情信息')
+              this.loading = false
+              return
+            } else {
+              let i = this.inputForm.detailInfos.length
+              for (let j = 0; j < i; j++) {
+                let k = j + 1
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].recipientAgent)) {
+                  this.$message.error('领用详情第' + k + '行请选择领用人')
+                  this.loading = false
+                  return
+                }
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].collectType)) {
+                  this.$message.error('领用详情第' + k + '行请选择领用类型')
+                  this.loading = false
+                  return
+                }
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].goodsName)) {
+                  this.$message.error('领用详情第' + k + '行请选择物品名称')
+                  this.loading = false
+                  return
+                }
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].collectNumber)) {
+                  this.$message.error('领用详情第' + k + '行请输入领用数量')
+                  this.loading = false
+                  return
+                }
+              }
+            }
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            this.inputForm.statusReturn = '2'
+            this.collectService.saveReturn(this.inputForm).then(({data}) => {
+              this.inputForm.id = data.businessId
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            }).catch(() => {
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            })
+          } else {
+            this.loading = false
+          }
+        })
+      },
+      // 通过
+      async agreeForm (callback) {
+        this.loading = true
+        this.$refs['inputForm'].validate(async (valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            // this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then(({data}) => {
+            //   if (this.commonJS.isNotEmpty(data)) {
+            //     if (data === '仓库管理员审核') {
+            //       this.inputForm.status = '5'
+            //     }
+            //   }
+            //   this.collectService.save(this.inputForm).then(({data}) => {
+            //     callback(data.businessTable, data.businessId, this.inputForm)
+            //     this.loading = false
+            //   }).catch(() => {
+            //     this.loading = false
+            //   })
+            // })
+            this.inputForm.statusReturn = '5'
+            this.collectService.saveReturnAgree(this.inputForm).then(({data}) => {
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          } else {
+            this.loading = false
+          }
+        })
+      },
+      // 修改状态
+      async updateStatusById (type, callback) {
+        this.loading = true
+        if (await this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          if (type === 'reject' || type === 'reback') {
+            this.collectService.findById(this.inputForm.id).then(({data}) => {
+              if (data.statusReturn !== '2') { // status的值不等于“审核中”,就弹出提示
+                this.loading = false
+                this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                throw new Error()
+              } else {
+                if (type === 'reject') {
+                  // 驳回
+                  this.inputForm.statusReturn = '4'
+                }
+                if (type === 'reback') {
+                  // 撤回
+                  this.inputForm.statusReturn = '3'
+                }
+                if (type === 'reject' || type === 'reback') {
+                  let param = {status: this.inputForm.statusReturn, id: this.inputForm.id}
+                  this.collectService.updateStatusByIdReturn(param).then(() => {
+                    this.loading = false
+                    callback()
+                  })
+                }
+              }
+            })
+          } else if (type === 'hold') {
+            this.collectService.findById(this.inputForm.id).then(({data}) => {
+              if (data.statusReturn !== '4') { // status的值不等于“驳回”就弹出提示
+                this.loading = false
+                this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                throw new Error()
+              } else {
+                // 终止
+                this.collectService.returnRequest({id: this.inputForm.id}).then(({data}) => {
+                  this.loading = false
+                  callback()
+                })
+                // 终止
+                // let param = {status: '0', id: this.inputForm.id}
+                // this.collectService.updateStatusByIdReturn(param).then(() => {
+                //   this.loading = false
+                //   callback()
+                // })
+              }
+            })
+          }
+        }
+      },
+      // updateStatusById (type) {
+      //   if (type === 'reject') {
+      //     this.inputForm.status = '4'
+      //     this.collectService.updateStatusById(this.inputForm)
+      //   }
+      // },
+      // footerMethod ({ columns, data }) {
+      //   const footerData = [
+      //     columns.map((column, columnIndex) => {
+      //       if (columnIndex === 0) {
+      //         return '商品总价'
+      //       }
+      //       if (['priceSum'].includes(column.property)) {
+      //         // eslint-disable-next-line no-undef
+      //         this.inputForm.tradeTotalPrice = XEUtils.sum(data, column.property)
+      //         return XEUtils.sum(data, column.property)
+      //       }
+      //       return null
+      //     })
+      //   ]
+      //   return footerData
+      // },
+      // twoDecimalPlaces (num, index) {
+      //   let str = num.toString()
+      //   var len1 = str.substr(0, 1)
+      //   var len2 = str.substr(1, 1)
+      //   // eslint-disable-next-line eqeqeq
+      //   if (str.length > 1 && len1 == 0 && len2 != '.') {
+      //     str = str.substr(1, 1)
+      //   }
+      //   // eslint-disable-next-line eqeqeq
+      //   if (len1 == '.') {
+      //     str = ''
+      //   }
+      //   // eslint-disable-next-line eqeqeq
+      //   if (str.indexOf('.') != -1) {
+      //     var str_ = str.substr(str.indexOf('.') + 1)
+      //     // eslint-disable-next-line eqeqeq
+      //     if (str_.indexOf('.') != -1) {
+      //       str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
+      //     }
+      //     if (str_.length > 2) {
+      //       this.$message.warning(`金额小数点后只能输入两位,请正确输入!`)
+      //       return (str = '')
+      //     }
+      //   }
+      //   // eslint-disable-next-line no-useless-escape
+      //   this.inputForm.detailInfos[index].priceSum = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
+      // },
+      twoDecimalPlaces2 (num) {
+        let str = num.toString()
+        var len1 = str.substr(0, 1)
+        var len2 = str.substr(1, 1)
+        // eslint-disable-next-line eqeqeq
+        if (str.length > 1 && len1 == 0 && len2 != '.') {
+          str = str.substr(1, 1)
+        }
+        // eslint-disable-next-line eqeqeq
+        if (len1 == '.') {
+          str = ''
+        }
+        // eslint-disable-next-line eqeqeq
+        if (str.indexOf('.') != -1) {
+          var str_ = str.substr(str.indexOf('.') + 1)
+          // eslint-disable-next-line eqeqeq
+          if (str_.indexOf('.') != -1) {
+            str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
+          }
+          if (str_.length > 2) {
+            this.$message.warning(`领用数量小数点后只能输入两位,请正确输入!`)
+            return (str = '')
+          }
+        }
+        // eslint-disable-next-line no-useless-escape
+        str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
+        return str
+      },
+      countAmount (row) {
+        let amount
+        let taxAmount
+        let count = 0
+        if (!this.commonJS.isEmpty(row.amount)) {
+          amount = parseFloat(row.amount)
+          count = count + amount
+        }
+        if (!this.commonJS.isEmpty(row.taxAmount)) {
+          taxAmount = parseFloat(row.taxAmount)
+          count = count + taxAmount
+        }
+        row.count = parseFloat(count).toFixed(2)
+      },
+      getProgram (rows) {
+        this.inputForm.detailInfos[this.indexRow].projectId = rows[0].id
+        this.inputForm.detailInfos[this.indexRow].projectName = rows[0].name
+        this.inputForm.detailInfos[this.indexRow].reportNumber = rows[0].reportNo
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      // 领用类型下拉弹窗
+      typePullForm (rowIndex) {
+        this.indexRow = rowIndex
+        this.$refs.materialTypePullForm.init()
+      },
+      getProgramForType (rows) {
+        this.inputForm.detailInfos[this.indexRow].collectTypeId = rows.id
+        this.inputForm.detailInfos[this.indexRow].collectType = rows.name
+        this.inputForm.detailInfos[this.indexRow].goodsName = ''
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      // 领用人下拉弹窗
+      userPullListForm (rowIndex) {
+        this.indexRow = rowIndex
+        this.$refs.userPullForm.init()
+      },
+      getProgramForUser (rows) {
+        this.inputForm.detailInfos[this.indexRow].recipientAgentId = rows[0].id
+        this.inputForm.detailInfos[this.indexRow].recipientAgent = rows[0].name
+        this.inputForm.detailInfos[this.indexRow].deptId = rows[0].parentId
+        this.inputForm.detailInfos[this.indexRow].recipientOffice = rows[0].officeName
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      getUserInfo (rows) {
+      },
+      openPurchasePageForm (rowIndex, row) {
+        if (this.commonJS.isEmpty(row.collectType)) {
+          this.$message.error('请选择领用类型')
+          return
+        }
+        this.indexRow = rowIndex
+        this.$refs.purchasePageForm.init(row.collectTypeId)
+      },
+      getContract (row) {
+        this.inputForm.detailInfos[this.indexRow].surplusNumber = row.tradeNumber
+        this.inputForm.detailInfos[this.indexRow].goodsName = row.tradeName
+        // 去除重复的领用详情
+        let i = this.inputForm.detailInfos.length
+        for (let j = 0; j < i; j++) {
+          for (let k = j + 1; k < i; k++) {
+            if (this.inputForm.detailInfos[j].collectTypeId === this.inputForm.detailInfos[k].collectTypeId) {
+              if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].goodsName) &&
+                this.commonJS.isNotEmpty(this.inputForm.detailInfos[k].goodsName) && this.inputForm.detailInfos[j].goodsName === this.inputForm.detailInfos[k].goodsName) {
+                // parseFloat(item.account).toFixed(2)
+                this.inputForm.detailInfos.splice(k, 1)
+                this.$message.warning(`同种领用类型的商品名称只能输入一条信息!`)
+              }
+            }
+          }
+        }
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      // 值改变事件
+      changeValue () {
+        let i = this.inputForm.detailInfos.length
+        for (let j = 0; j < i; j++) {
+          if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].surplusNumber)) {
+            this.$message.error('请选择领用物品名称')
+            return
+          }
+          if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].collectNumber)) {
+            if (parseFloat(this.inputForm.detailInfos[j].surplusNumber) < parseFloat(this.inputForm.detailInfos[j].collectNumber)) {
+              this.$message.error('领用数量不能大于剩余数量')
+              this.inputForm.detailInfos[j].collectNumber = ''
+              return
+            }
+          }
+        }
+      },
+      // 退回
+      returnCollect (index) {
+        this.inputForm.detailInfos[index].isReturn = '1'
+      },
+      // 取消退回
+      cancelReturn (index) {
+        this.inputForm.detailInfos[index].isReturn = '0'
+      },
+      // 列表行颜色
+      rowClassName ({ row, rowIndex }) {
+        if (row.isReturn === '1') { // 退回
+          return 'row-grey'
+        } else {
+          return ''
+        }
+      }
+    }
+  }
+</script>
+<style scoped>
+  .el-divider__text {
+    font-size: 16px;
+    font-weight: bold;
+  }
+  /deep/  .row-green {
+    /*background-color: #67c23ad1;*/
+    /*color: #fff;*/
+    font-weight: bold;
+  }
+  /deep/  .row-grey {
+    background-color: #b8b7b7;
+    color: #fff;
+  }
+  /deep/  .row-red {
+    background-color: #f56c6c66;
+    /*color: #fff;*/
+    font-weight: bold;
+  }
+</style>

+ 849 - 0
src/views/modules/materialManagement/collect/CollectReturnHiForm.vue

@@ -0,0 +1,849 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      append-to-body
+      width="1300px"
+      @close="close"
+      @keyup.enter.native=""
+      :visible.sync="visible">
+    <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="status === 'audit' || status === 'taskFormDetail'"
+             label-width="100px" @submit.native.prevent>
+
+      <el-divider content-position="left"><i class="el-icon-document"></i> 基础信息</el-divider>
+      <el-row :gutter="26">
+        <el-col :span="12">
+          <el-form-item label="领用编号" prop="collectNo">
+            <el-input placeholder="自动生成" v-model="inputForm.collectNo" :disabled="true"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="经办人" prop="handledBy">
+            <el-input v-model="inputForm.handledBy" :disabled="true"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="经办人部门" prop="handledByOffice">
+            <SelectTree
+              :disabled="true"
+              ref="officeTree"
+              :props="{
+                  value: 'id',             // ID字段名
+                  label: 'name',         // 显示名称
+                  children: 'children'    // 子级字段名
+                }"
+
+              :url="`/sys/office/treeData?type=2`"
+              :value="inputForm.handledByOffice"
+              :accordion="true"
+              size="medium"
+              @getValue="(value) => {inputForm.handledByOffice=value}"/>
+<!--            <el-input v-model="inputForm.handledByOffice" :disabled="true"></el-input>-->
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="领用时间" prop="collectDate" :rules="[{required: true, message:'请选择领用时间', trigger:'blur'}]">
+            <el-date-picker
+              :disabled="true"
+              v-model="inputForm.collectDate"
+              type="date"
+              placement="bottom-start"
+              value-format="yyyy-MM-dd"
+              style="width: 100%"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="备注" prop="remarks">
+            <el-input v-model="inputForm.remarks"
+                      type="textarea"
+                      :rows="5"
+                      maxlength="500"
+                      placeholder="请填写备注信息"
+                      :disabled="true"
+                      show-word-limit>
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-divider content-position="left"><i class="el-icon-document"></i>
+        领用详情
+      </el-divider>
+      <el-row  :gutter="15" >
+        <vxe-table
+          border
+          show-footer
+          show-overflow
+          ref="detailTable"
+          class="vxe-table-element"
+          :data="inputForm.detailInfos"
+          style="margin-left: 5em"
+          :row-class-name="rowClassName"
+        >
+          <vxe-table-column field="recipientAgent" title="领用人" align="center">
+            <template scope="scope">
+              <span>{{scope.row.recipientAgent}}</span><span v-if="scope.row.isReturn === '1'">(已退回)</span>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="recipientOffice" title="领用人部门" align="center"></vxe-table-column>
+          <vxe-table-column field="collectType" title="领用类型" align="center"></vxe-table-column>
+          <vxe-table-column field="goodsName" title="物品名称" align="center"></vxe-table-column>
+          <vxe-table-column field="collectNumber" title="领用数量" align="center"></vxe-table-column>
+          <vxe-table-column v-if="status === 'audit'" field="surplusNumber" title="库存数量" align="center"></vxe-table-column>
+          <vxe-table-column field="company" title="单位" align="center"></vxe-table-column>
+          <vxe-table-column field="remarks" title="备注" align="center"></vxe-table-column>
+          <vxe-table-column title="操作" width="170" align="center">
+            <template v-slot="scope">
+              <el-button size="mini" type="primary" :disabled="false" @click="seeFileInfo(scope.$rowIndex)">附件</el-button>
+<!--              <el-button size="mini" type="primary" v-if="scope.row.isReturn === '0' && status !== 'audit' && status !== 'taskFormDetail'" @click="returnCollect(scope.$rowIndex)">退回</el-button>-->
+<!--              <el-button size="mini" type="primary" v-if="scope.row.isReturn === '1' && status !== 'audit' && status !== 'taskFormDetail'" @click="cancelReturn(scope.$rowIndex)">取消退回</el-button>-->
+            </template>
+          </vxe-table-column>
+        </vxe-table>
+      </el-row>
+      <el-row>
+        <el-col :span="24" style="margin-top: 20px">
+          <el-form-item label="退回原因" prop="returnCause">
+            <el-input v-model="inputForm.returnCause"
+                      type="textarea"
+                      :rows="5"
+                      maxlength="500"
+                      placeholder="请填写退回原因"
+                      :disabled="true"
+                      show-word-limit>
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+    </el-form>
+    <PurchasePageForm  ref="purchasePageForm" @getProject="getContract"></PurchasePageForm>
+    <!-- 附件 -->
+    <MaterialManagementDialog ref="materialManagementDialog" @getUpload="getUpload"></MaterialManagementDialog>
+    <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+    <CwProgramPageForm ref="cwProgramPageForm" @getProgram="getProgram"></CwProgramPageForm>
+    <MaterialTypePullForm ref="materialTypePullForm" @getProgramForType="getProgramForType"></MaterialTypePullForm>
+    <UserPullForm ref="userPullForm" @getProgramForUser="getProgramForUser"></UserPullForm>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+    </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import UserSelect from '@/components/userSelect'
+  import MaterialManagementDialog from '../file/MaterialManagementDialog'
+  import CollectService from '@/api/materialManagement/CollectService'
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import UserService from '@/api/sys/UserService'
+  import CwProgramPageForm from '@/views/modules/cw/reimbursementApproval/info/CwProgramPageForm'
+  import MaterialTypePullForm from '../info/MaterialTypePullForm'
+  import UserPullForm from '@/views/modules/finance/invoice/UserPullForm'
+  import PurchasePageForm from './PurchasePageForm'
+  import CommonApi from '@/api/cw/common/CommonApi'
+  export default {
+    data () {
+      return {
+        validRules: {
+          recipientAgent: [
+            {required: true, message: '领用人不能为空'}
+          ],
+          recipientOffice: [
+            {required: true, message: '领用人部门不能为空'}
+          ],
+          collectType: [
+            {required: true, message: '领用类型不能为空'}
+          ],
+          goodsName: [
+            {required: true, message: '物品名称不能为空'}
+          ],
+          collectNumber: [
+            {required: true, message: '领用数量不能为空'}
+          ]
+        },
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        indexRow: '',
+        inputForm: {
+          fileInfoLost: [],
+          handledByOffice: '',
+          handledBy: '',
+          handledById: '',
+          collectNo: '', // 领用编号
+          userId: '',
+          collectDate: '',
+          remarks: '',
+          detailInfos: [],
+          // amountInfos: [],
+          files: [], // 附件信息
+          procInsId: '',
+          statusReturn: '',
+          procInsIdReturn: '',
+          processDefinitionIdReturn: '',
+          returnId: '',
+          returnCause: ''
+        },
+        keyWatch: ''
+      }
+    },
+    collectService: null,
+    userService: null,
+    commonApi: null,
+    created () {
+      this.collectService = new CollectService()
+      this.userService = new UserService()
+      this.commonApi = new CommonApi()
+    },
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      },
+      status: {
+        type: String,
+        default: ''
+      }
+    },
+    components: {
+      UserSelect,
+      MaterialManagementDialog,
+      UpLoadComponent,
+      SelectUserTree,
+      SelectTree,
+      CwProgramPageForm,
+      MaterialTypePullForm,
+      UserPullForm,
+      PurchasePageForm
+    },
+    computed: {
+      bus: {
+        get () {
+          return this.businessId
+        },
+        set (val) {
+          this.businessId = val
+        }
+      },
+      name () {
+        return JSON.parse(localStorage.getItem('user')).name
+      },
+      officeName () {
+        return JSON.parse(localStorage.getItem('user')).officeDTO.name
+      },
+      userId () {
+        return JSON.parse(localStorage.getItem('user')).id
+      },
+      recipientAgentId () {
+        return JSON.parse(localStorage.getItem('user')).id
+      },
+      collectTypeId () {
+        return ''
+      }
+    },
+    watch: {
+      'keyWatch': {
+        handler (newVal) {
+          if (this.commonJS.isNotEmpty(this.bus)) {
+            this.init('', this.bus)
+          } else {
+            this.$nextTick(() => {
+              this.$refs.inputForm.resetFields()
+            })
+          }
+        }
+      },
+      'loading': {
+        handler (newVal) {
+          this.$emit('changeLoading', newVal)
+          this.$refs.uploadComponent.changeLoading(newVal)
+        }
+      }
+    },
+    methods: {
+      getKeyWatch (keyWatch) {
+        this.keyWatch = keyWatch
+      },
+      init (id) {
+        let method = 'view'
+        this.method = method
+        this.inputForm = {
+          fileInfoLost: [],
+          handledByOffice: '',
+          handledBy: JSON.parse(localStorage.getItem('user')).name,
+          handledById: JSON.parse(localStorage.getItem('user')).id,
+          collectNo: '', // 领用编号
+          userId: JSON.parse(localStorage.getItem('user')).id,
+          collectDate: new Date(),
+          remarks: '',
+          detailInfos: [],
+          // amountInfos: [],
+          files: [], // 附件信息
+          procInsId: '',
+          statusReturn: '',
+          procInsIdReturn: '',
+          processDefinitionIdReturn: '',
+          returnId: '',
+          returnCause: ''
+        }
+        this.title = '领用退回历史详情'
+        this.inputForm.id = id
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
+            this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
+          }
+          if (this.status === 'audit' || this.status === 'taskFormDetail') {
+            method = 'view'
+          }
+          this.loading = true
+          this.$refs.inputForm.resetFields()
+          this.collectService.findHiByHiId(this.inputForm.id).then(({data}) => {
+            if (this.inputForm.id !== 'false') {
+              this.inputForm = this.recover(this.inputForm, data)
+              if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
+                this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
+              }
+              if (this.commonJS.isNotEmpty(data.recipientAgentId)) {
+                this.recipientAgentId = data.recipientAgentId
+              }
+              if (this.commonJS.isNotEmpty(data.collectTypeId)) {
+                this.collectTypeId = data.collectTypeId
+              }
+              if (this.commonJS.isNotEmpty(this.inputForm.detailInfos)) {
+                let i = this.inputForm.detailInfos.length
+                for (let j = 0; j < i; j++) {
+                  if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradePrice)) {
+                    if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradeNumber)) {
+                      this.inputForm.detailInfos[j].priceSum = this.inputForm.detailInfos[j].tradePrice * this.inputForm.detailInfos[j].tradeNumber
+                    }
+                  }
+                }
+              }
+              this.$refs.uploadComponent.newUpload('view', this.inputForm.files, 'material_collect')
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.loading = false
+            } else {
+              if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
+                this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
+              }
+              if (this.commonJS.isEmpty(this.inputForm.handledBy)) {
+                this.inputForm.handledBy = JSON.parse(localStorage.getItem('user')).name
+              }
+              if (this.commonJS.isEmpty(this.inputForm.handledById)) {
+                this.inputForm.handledById = JSON.parse(localStorage.getItem('user')).id
+              }
+              if (this.commonJS.isEmpty(this.inputForm.collectDate)) {
+                this.inputForm.collectDate = new Date()
+              }
+              this.inputForm.detailInfos = []
+              this.loading = false
+            }
+          })
+        })
+      },
+      getUpload (p, index) {
+        p.then((list) => {
+          // list为返回数据
+          this.inputForm.detailInfos[index].fileInfoLost = list
+          this.inputForm.detailInfos[index].fileNumber = list.length
+          this.tableKeyClient = Math.random()
+        })
+      },
+      seeFileInfo (index) {
+        if (this.commonJS.isEmpty(this.inputForm.detailInfos[index].fileInfoLost)) {
+          this.inputForm.detailInfos[index].fileInfoLost = []
+        }
+        this.$refs.materialManagementDialog.newUpload('view', this.inputForm.detailInfos[index].fileInfoLost, null, null, null, null, null, false, index)
+      },
+      sss (index) {
+        if (this.commonJS.isEmpty(this.inputForm.detailInfos[index].fileInfoLost)) {
+          this.inputForm.detailInfos[index].fileInfoLost = []
+        }
+        this.$refs.materialManagementDialog.newUpload(null, this.inputForm.detailInfos[index].fileInfoLost, null, null, null, null, null, false, index)
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            this.inputForm.id = this.businessId
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            this.collectService.save(this.inputForm).then(({data}) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.inputForm.detailInfos = []
+        // this.inputForm.amountInfos = []
+        this.$refs.uploadComponent.clearUpload()
+
+        this.visible = false
+        this.$refs.inputForm.resetFields()
+      },
+      // 删除
+      removeEvent (row, rowIndex, type) {
+        if (type === 'detail') {
+          this.$refs.detailTable.remove(row)
+          this.inputForm.detailInfos.splice(rowIndex, 1)
+        }
+        if (type === 'amount') {
+          this.$refs.amountTable.remove(row)
+          // this.inputForm.amountInfos.splice(rowIndex, 1)
+        }
+      },
+      // 新增
+      async insertEvent (type) {
+        if (type === 'detail') {
+          await this.$refs.detailTable.insert().then((data) => {
+            data.recipientAgent = JSON.parse(localStorage.getItem('user')).name
+            data.recipientAgentId = this.recipientAgentId
+            data.recipientOffice = this.officeName
+            this.inputForm.detailInfos.push(data)
+          })
+        }
+        if (type === 'amount') {
+          await this.$refs.amountTable.insert().then((data) => {
+            // this.inputForm.amountInfos.push(data)
+          })
+        }
+      },
+      reapplyForm (callback) {
+        this.loading = true
+        this.collectService.findById(this.inputForm.id).then(({data}) => {
+          if (data.statusReturn !== '4') { // 审核状态不是“驳回”,就弹出提示
+            this.loading = false
+            this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+          } else {
+            this.startFormTrue(callback)
+          }
+        })
+      },
+      startForm (callback) {
+        this.loading = true
+        if (this.commonJS.isNotEmpty(this.inputForm.id)) {
+          this.collectService.findById(this.inputForm.id).then(({data}) => {
+            // 审核状态不是“未发起”或“暂存”或“撤回”,就弹出提示
+            if (this.commonJS.isNotEmpty(data.statusReturn) && data.statusReturn !== '0' && data.statusReturn !== '1' && data.statusReturn !== '3') {
+              this.loading = false
+              this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+              throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            } else {
+              this.startFormTrue(callback)
+            }
+          })
+        } else {
+          this.startFormTrue(callback)
+        }
+      },
+      // 暂存
+      async saveForm (callback) {
+        this.loading = true
+        if (this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          return
+        }
+        if (this.commonJS.isEmpty(this.inputForm.files)) {
+          this.inputForm.files = []
+        }
+        this.inputForm.files = this.$refs.uploadComponent.getDataList()
+        this.inputForm.statusReturn = '1'
+        this.collectService.saveReturn(this.inputForm).then(({data}) => {
+          callback()
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+        }).catch(() => {
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+        })
+      },
+      // 送审
+      async startFormTrue (callback) {
+        this.loading = true
+        this.$refs['inputForm'].validate(async (valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            if (this.commonJS.isEmpty(this.inputForm.detailInfos)) {
+              this.$message.error('至少填写一条领用详情信息')
+              this.loading = false
+              return
+            } else {
+              let i = this.inputForm.detailInfos.length
+              for (let j = 0; j < i; j++) {
+                let k = j + 1
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].recipientAgent)) {
+                  this.$message.error('领用详情第' + k + '行请选择领用人')
+                  this.loading = false
+                  return
+                }
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].collectType)) {
+                  this.$message.error('领用详情第' + k + '行请选择领用类型')
+                  this.loading = false
+                  return
+                }
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].goodsName)) {
+                  this.$message.error('领用详情第' + k + '行请选择物品名称')
+                  this.loading = false
+                  return
+                }
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].collectNumber)) {
+                  this.$message.error('领用详情第' + k + '行请输入领用数量')
+                  this.loading = false
+                  return
+                }
+              }
+            }
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            this.inputForm.statusReturn = '2'
+            this.collectService.saveReturn(this.inputForm).then(({data}) => {
+              this.inputForm.id = data.businessId
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            }).catch(() => {
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            })
+          } else {
+            this.loading = false
+          }
+        })
+      },
+      // 通过
+      async agreeForm (callback) {
+        this.loading = true
+        this.$refs['inputForm'].validate(async (valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            // this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then(({data}) => {
+            //   if (this.commonJS.isNotEmpty(data)) {
+            //     if (data === '仓库管理员审核') {
+            //       this.inputForm.status = '5'
+            //     }
+            //   }
+            //   this.collectService.save(this.inputForm).then(({data}) => {
+            //     callback(data.businessTable, data.businessId, this.inputForm)
+            //     this.loading = false
+            //   }).catch(() => {
+            //     this.loading = false
+            //   })
+            // })
+            this.inputForm.statusReturn = '5'
+            this.collectService.saveReturnAgree(this.inputForm).then(({data}) => {
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          } else {
+            this.loading = false
+          }
+        })
+      },
+      // 修改状态
+      async updateStatusById (type, callback) {
+        this.loading = true
+        if (await this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          if (type === 'reject' || type === 'reback') {
+            this.collectService.findById(this.inputForm.id).then(({data}) => {
+              if (data.statusReturn !== '2') { // status的值不等于“审核中”,就弹出提示
+                this.loading = false
+                this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                throw new Error()
+              } else {
+                if (type === 'reject') {
+                  // 驳回
+                  this.inputForm.statusReturn = '4'
+                }
+                if (type === 'reback') {
+                  // 撤回
+                  this.inputForm.statusReturn = '3'
+                }
+                if (type === 'reject' || type === 'reback') {
+                  let param = {status: this.inputForm.statusReturn, id: this.inputForm.id}
+                  this.collectService.updateStatusByIdReturn(param).then(() => {
+                    this.loading = false
+                    callback()
+                  })
+                }
+              }
+            })
+          } else if (type === 'hold') {
+            this.collectService.findById(this.inputForm.id).then(({data}) => {
+              if (data.statusReturn !== '4') { // status的值不等于“驳回”就弹出提示
+                this.loading = false
+                this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                throw new Error()
+              } else {
+                // 终止
+                this.collectService.returnRequest({id: this.inputForm.id}).then(({data}) => {
+                  this.loading = false
+                  callback()
+                })
+                // 终止
+                // let param = {status: '0', id: this.inputForm.id}
+                // this.collectService.updateStatusByIdReturn(param).then(() => {
+                //   this.loading = false
+                //   callback()
+                // })
+              }
+            })
+          }
+        }
+      },
+      // updateStatusById (type) {
+      //   if (type === 'reject') {
+      //     this.inputForm.status = '4'
+      //     this.collectService.updateStatusById(this.inputForm)
+      //   }
+      // },
+      // footerMethod ({ columns, data }) {
+      //   const footerData = [
+      //     columns.map((column, columnIndex) => {
+      //       if (columnIndex === 0) {
+      //         return '商品总价'
+      //       }
+      //       if (['priceSum'].includes(column.property)) {
+      //         // eslint-disable-next-line no-undef
+      //         this.inputForm.tradeTotalPrice = XEUtils.sum(data, column.property)
+      //         return XEUtils.sum(data, column.property)
+      //       }
+      //       return null
+      //     })
+      //   ]
+      //   return footerData
+      // },
+      // twoDecimalPlaces (num, index) {
+      //   let str = num.toString()
+      //   var len1 = str.substr(0, 1)
+      //   var len2 = str.substr(1, 1)
+      //   // eslint-disable-next-line eqeqeq
+      //   if (str.length > 1 && len1 == 0 && len2 != '.') {
+      //     str = str.substr(1, 1)
+      //   }
+      //   // eslint-disable-next-line eqeqeq
+      //   if (len1 == '.') {
+      //     str = ''
+      //   }
+      //   // eslint-disable-next-line eqeqeq
+      //   if (str.indexOf('.') != -1) {
+      //     var str_ = str.substr(str.indexOf('.') + 1)
+      //     // eslint-disable-next-line eqeqeq
+      //     if (str_.indexOf('.') != -1) {
+      //       str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
+      //     }
+      //     if (str_.length > 2) {
+      //       this.$message.warning(`金额小数点后只能输入两位,请正确输入!`)
+      //       return (str = '')
+      //     }
+      //   }
+      //   // eslint-disable-next-line no-useless-escape
+      //   this.inputForm.detailInfos[index].priceSum = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
+      // },
+      twoDecimalPlaces2 (num) {
+        let str = num.toString()
+        var len1 = str.substr(0, 1)
+        var len2 = str.substr(1, 1)
+        // eslint-disable-next-line eqeqeq
+        if (str.length > 1 && len1 == 0 && len2 != '.') {
+          str = str.substr(1, 1)
+        }
+        // eslint-disable-next-line eqeqeq
+        if (len1 == '.') {
+          str = ''
+        }
+        // eslint-disable-next-line eqeqeq
+        if (str.indexOf('.') != -1) {
+          var str_ = str.substr(str.indexOf('.') + 1)
+          // eslint-disable-next-line eqeqeq
+          if (str_.indexOf('.') != -1) {
+            str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
+          }
+          if (str_.length > 2) {
+            this.$message.warning(`领用数量小数点后只能输入两位,请正确输入!`)
+            return (str = '')
+          }
+        }
+        // eslint-disable-next-line no-useless-escape
+        str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
+        return str
+      },
+      countAmount (row) {
+        let amount
+        let taxAmount
+        let count = 0
+        if (!this.commonJS.isEmpty(row.amount)) {
+          amount = parseFloat(row.amount)
+          count = count + amount
+        }
+        if (!this.commonJS.isEmpty(row.taxAmount)) {
+          taxAmount = parseFloat(row.taxAmount)
+          count = count + taxAmount
+        }
+        row.count = parseFloat(count).toFixed(2)
+      },
+      getProgram (rows) {
+        this.inputForm.detailInfos[this.indexRow].projectId = rows[0].id
+        this.inputForm.detailInfos[this.indexRow].projectName = rows[0].name
+        this.inputForm.detailInfos[this.indexRow].reportNumber = rows[0].reportNo
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      // 领用类型下拉弹窗
+      typePullForm (rowIndex) {
+        this.indexRow = rowIndex
+        this.$refs.materialTypePullForm.init()
+      },
+      getProgramForType (rows) {
+        this.inputForm.detailInfos[this.indexRow].collectTypeId = rows.id
+        this.inputForm.detailInfos[this.indexRow].collectType = rows.name
+        this.inputForm.detailInfos[this.indexRow].goodsName = ''
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      // 领用人下拉弹窗
+      userPullListForm (rowIndex) {
+        this.indexRow = rowIndex
+        this.$refs.userPullForm.init()
+      },
+      getProgramForUser (rows) {
+        this.inputForm.detailInfos[this.indexRow].recipientAgentId = rows[0].id
+        this.inputForm.detailInfos[this.indexRow].recipientAgent = rows[0].name
+        this.inputForm.detailInfos[this.indexRow].deptId = rows[0].parentId
+        this.inputForm.detailInfos[this.indexRow].recipientOffice = rows[0].officeName
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      getUserInfo (rows) {
+      },
+      openPurchasePageForm (rowIndex, row) {
+        if (this.commonJS.isEmpty(row.collectType)) {
+          this.$message.error('请选择领用类型')
+          return
+        }
+        this.indexRow = rowIndex
+        this.$refs.purchasePageForm.init(row.collectTypeId)
+      },
+      getContract (row) {
+        this.inputForm.detailInfos[this.indexRow].surplusNumber = row.tradeNumber
+        this.inputForm.detailInfos[this.indexRow].goodsName = row.tradeName
+        // 去除重复的领用详情
+        let i = this.inputForm.detailInfos.length
+        for (let j = 0; j < i; j++) {
+          console.log('进来了')
+          for (let k = j + 1; k < i; k++) {
+            if (this.inputForm.detailInfos[j].collectTypeId === this.inputForm.detailInfos[k].collectTypeId) {
+              if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].goodsName) &&
+                this.commonJS.isNotEmpty(this.inputForm.detailInfos[k].goodsName) && this.inputForm.detailInfos[j].goodsName === this.inputForm.detailInfos[k].goodsName) {
+                // parseFloat(item.account).toFixed(2)
+                this.inputForm.detailInfos.splice(k, 1)
+                this.$message.warning(`同种领用类型的商品名称只能输入一条信息!`)
+              }
+            }
+          }
+        }
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      // 值改变事件
+      changeValue () {
+        let i = this.inputForm.detailInfos.length
+        for (let j = 0; j < i; j++) {
+          if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].surplusNumber)) {
+            this.$message.error('请选择领用物品名称')
+            return
+          }
+          if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].collectNumber)) {
+            if (parseFloat(this.inputForm.detailInfos[j].surplusNumber) < parseFloat(this.inputForm.detailInfos[j].collectNumber)) {
+              this.$message.error('领用数量不能大于剩余数量')
+              this.inputForm.detailInfos[j].collectNumber = ''
+              return
+            }
+          }
+        }
+      },
+      // 退回
+      returnCollect (index) {
+        this.inputForm.detailInfos[index].isReturn = '1'
+      },
+      // 取消退回
+      cancelReturn (index) {
+        this.inputForm.detailInfos[index].isReturn = '0'
+      },
+      // 列表行颜色
+      rowClassName ({ row, rowIndex }) {
+        if (row.isReturn === '1') { // 退回
+          return 'row-grey'
+        } else {
+          return ''
+        }
+      }
+    }
+  }
+</script>
+<style scoped>
+  .el-divider__text {
+    font-size: 16px;
+    font-weight: bold;
+  }
+  /deep/  .row-green {
+    /*background-color: #67c23ad1;*/
+    /*color: #fff;*/
+    font-weight: bold;
+  }
+  /deep/  .row-grey {
+    background-color: #b8b7b7;
+    color: #fff;
+  }
+  /deep/  .row-red {
+    background-color: #f56c6c66;
+    /*color: #fff;*/
+    font-weight: bold;
+  }
+</style>

+ 4 - 1
src/views/modules/materialManagement/wareHouse/WareHouseAddForm.vue

@@ -395,7 +395,7 @@
           wareHouseName: '',
           wareHouseNumber: '', // 入库编号
           userId: JSON.parse(localStorage.getItem('user')).id,
-          wareHouseDate: new Date(),
+          wareHouseDate: '',
           remarks: '',
           detailInfos: [],
           wareHouse: [],
@@ -455,6 +455,9 @@
               this.loading = false
             })
           } else {
+            if (method === 'add') {
+              this.inputForm.wareHouseDate = new Date()
+            }
             this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'reimbursement')
           }
         })

+ 1 - 1
src/views/modules/materialManagement/wareHouse/WareHouseHi.vue

@@ -7,7 +7,7 @@
       append-to-body
       width="1300px"
       @close="close"
-      @keyup.enter.native="doSubmit"
+      @keyup.enter.native=""
       :visible.sync="visible">
     <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="true"
              label-width="100px" @submit.native.prevent>

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

@@ -537,6 +537,7 @@
             path: '/flowable/task/TaskForm',
             query: {
               wareHouseId: row.processDefinitionName === '物资管理-入库修改' ? data.businessId : '',
+              returnId: row.processDefinitionName === '物资管理-领用退回申请' ? data.businessId : '',
               isShow: false,
               formReadOnly: true,
               formTitle: `${row.vars.title}`,