Parcourir la source

feat:pda相关流程

maliang il y a 3 semaines
Parent
commit
09b41902ec

+ 3 - 3
jshERP-web/src/components/jeecgbiz/modal/JSelectMaterialModal.vue

@@ -252,13 +252,13 @@ export default {
               this.queryParam.q === this.dataSource[0].name ||
               this.queryParam.q === this.dataSource[0].mnemonic
             ) {
-              this.title = '选择商品【再次回车可以直接选中】'
+              // this.title = '选择商品【再次回车可以直接选中】'
               this.$nextTick(() => this.$refs.material.focus())
             } else {
-              this.title = '选择商品'
+              // this.title = '选择商品'
             }
           } else {
-            this.title = '选择商品'
+            // this.title = '选择商品'
           }
         }
         this.loading = false

+ 5 - 1
jshERP-web/src/views/bill/PurchaseInList.vue

@@ -119,6 +119,8 @@
                     <a-select placeholder="请选择单据状态" v-model="queryParam.status">
                       <a-select-option value="0">未审核</a-select-option>
                       <a-select-option value="9" v-if="!checkFlag">审核中</a-select-option>
+                      <a-select-option value="6">待复核</a-select-option>
+                      <a-select-option value="7">复核驳回</a-select-option>
                       <a-select-option value="8">审核不通过</a-select-option>
                       <a-select-option value="1">已审核</a-select-option>
                       <a-select-option value="3">部分入库</a-select-option>
@@ -220,6 +222,8 @@
               <a-tag v-if="status == '1'" color="green">已审核</a-tag>
               <a-tag v-if="status == '2'" color="cyan">完成入库</a-tag>
               <a-tag v-if="status == '3'" color="blue">部分入库</a-tag>
+              <a-tag v-if="status == '6'" color="purple">待复核</a-tag>
+              <a-tag v-if="status == '7'" color="purple">复核驳回</a-tag>
               <a-tag v-if="status == '8'" color="red">审核不通过</a-tag>
               <a-tag v-if="status == '9'" color="orange">审核中</a-tag>
             </template>
@@ -358,7 +362,7 @@ export default {
         {
           title: '状态',
           dataIndex: 'status',
-          width: 80,
+          width: 100,
           align: 'center',
           scopedSlots: { customRender: 'customRenderStatus' },
         },

+ 5 - 1
jshERP-web/src/views/bill/PurchaseOrderList.vue

@@ -91,6 +91,8 @@
                       <a-select-option value="2">完成采购</a-select-option>
                       <a-select-option value="3">部分采购</a-select-option>
                       <a-select-option value="4">进行中</a-select-option>
+                      <a-select-option value="6">待复核</a-select-option>
+                      <a-select-option value="7">复核驳回</a-select-option>
                       <a-select-option value="8">审核不通过</a-select-option>
                       <a-select-option value="9" v-if="!checkFlag">审核中</a-select-option>
                     </a-select>
@@ -186,6 +188,8 @@
               <a-tag v-if="status == '2'" color="cyan">完成采购</a-tag>
               <a-tag v-if="status == '3'" color="blue">部分采购</a-tag>
               <a-tag v-if="status == '4'" color="purple">进行中</a-tag>
+              <a-tag v-if="status == '6'" color="purple">待复核</a-tag>
+              <a-tag v-if="status == '7'" color="red">复核驳回</a-tag>
               <a-tag v-if="status == '8'" color="red">审核不通过</a-tag>
               <a-tag v-if="status == '9'" color="orange">审核中</a-tag>
             </template>
@@ -313,7 +317,7 @@ export default {
         {
           title: '状态',
           dataIndex: 'status',
-          width: 80,
+          width: 100,
           align: 'center',
           scopedSlots: { customRender: 'customRenderStatus' },
         },

+ 5 - 1
jshERP-web/src/views/bill/SaleOrderList.vue

@@ -79,6 +79,8 @@
                     <a-select placeholder="请选择单据状态" v-model="queryParam.status">
                       <a-select-option value="0">未审核</a-select-option>
                       <a-select-option value="9" v-if="!checkFlag">审核中</a-select-option>
+                      <a-select-option value="6">待复核</a-select-option>
+                      <a-select-option value="7">复核驳回</a-select-option>
                       <a-select-option value="8">审核不通过</a-select-option>
                       <a-select-option value="1">已审核</a-select-option>
                       <a-select-option value="3">部分销售</a-select-option>
@@ -171,6 +173,8 @@
               <a-tag v-if="status == '2'" color="cyan">完成销售</a-tag>
               <a-tag v-if="status == '3'" color="blue">部分销售</a-tag>
               <a-tag v-if="status == '4'" color="blue">进行中</a-tag>
+              <a-tag v-if="status == '6'" color="purple">待复核</a-tag>
+              <a-tag v-if="status == '7'" color="purple">复核驳回</a-tag>
               <a-tag v-if="status == '8'" color="red">审核不通过</a-tag>
               <a-tag v-if="status == '9'" color="orange">审核中</a-tag>
             </template>
@@ -299,7 +303,7 @@ export default {
         {
           title: '状态',
           dataIndex: 'status',
-          width: 70,
+          width: 100,
           align: 'center',
           scopedSlots: { customRender: 'customRenderStatus' },
         },

+ 5 - 1
jshERP-web/src/views/bill/SaleOutList.vue

@@ -120,6 +120,8 @@
                     <a-select placeholder="请选择单据状态" v-model="queryParam.status">
                       <a-select-option value="0">未审核</a-select-option>
                       <a-select-option value="9" v-if="!checkFlag">审核中</a-select-option>
+                      <a-select-option value="6">待复核</a-select-option>
+                      <a-select-option value="7">复核驳回</a-select-option>
                       <a-select-option value="8">审核不通过</a-select-option>
                       <a-select-option value="1">已审核</a-select-option>
                       <a-select-option value="3">部分出库</a-select-option>
@@ -222,6 +224,8 @@
               <a-tag v-if="status == '2'" color="cyan">完成出库</a-tag>
               <a-tag v-if="status == '3'" color="blue">部分出库</a-tag>
               <a-tag v-if="status == '8'" color="red">审核不通过</a-tag>
+              <a-tag v-if="status == '6'" color="purple">待复核</a-tag>
+              <a-tag v-if="status == '7'" color="purple">复核驳回</a-tag>
               <a-tag v-if="status == '9'" color="orange">审核中</a-tag>
             </template>
           </a-table>
@@ -359,7 +363,7 @@ export default {
         {
           title: '状态',
           dataIndex: 'status',
-          width: 80,
+          width: 100,
           align: 'center',
           scopedSlots: { customRender: 'customRenderStatus' },
         },

+ 0 - 6
jshERP-web/src/views/bill/modules/PurchaseInModal.vue

@@ -590,12 +590,6 @@ export default {
           this.depositStatus = false
           this.model.deposit = 0
         }
-        this.model.debt = (
-          this.model.discountLastMoney +
-          (this.model.otherMoney||0)-
-          this.model.deposit -
-          this.model.changeAmount
-        ).toFixed(2)
         if (this.model.accountId == null) {
           this.model.accountId = 0
           this.manyAccountBtnStatus = true

+ 0 - 6
jshERP-web/src/views/bill/modules/SaleOutModal.vue

@@ -613,12 +613,6 @@ export default {
           this.depositStatus = false
           this.model.deposit = 0
         }
-        this.model.debt = (
-          this.model.discountLastMoney +
-          this.model.otherMoney -
-          this.model.deposit -
-          this.model.changeAmount
-        ).toFixed(2)
         if (this.model.accountId == null) {
           this.model.accountId = 0
           this.manyAccountBtnStatus = true

+ 2 - 2
jshERP-web/src/views/material/modules/MaterialModal.vue

@@ -20,7 +20,7 @@
       <a-form :form="form">
         <a-tabs default-active-key="1" size="small" v-model="activeKey">
           <a-tab-pane key="1" tab="基本信息" id="materialHeadModal" forceRender>
-            <a-row class="form-row" :gutter="24">
+            <a-row class="form-row" :gutter="24" type="flex">
               <a-col :xl="6" :lg="8" :md="12" :sm="24">
                 <a-form-item
                   :labelCol="labelCol"
@@ -205,7 +205,7 @@
                 </template>
               </a-table>
             </div>
-            <a-row class="form-row" :gutter="24">
+            <a-row class="form-row" :gutter="24" type="flex">
               <a-col :lg="24" :md="24" :sm="24">
                 <a-form-item :labelCol="labelCol" :wrapperCol="{ xs: { span: 24 }, sm: { span: 24 } }" label="">
                   <a-textarea :rows="1" placeholder="请输入备注" v-decorator="['remark']" style="margin-top: 8px" />

+ 1 - 1
jshERP-web/src/views/system/MsgList.vue

@@ -6,7 +6,7 @@
     :confirmLoading="confirmLoading"
     @cancel="handleCancel"
     cancelText="关闭"
-    style="top: 15%; height: 70%; overflow-y: hidden"
+    style="top: 10vh; height: 80vh; overflow-y: scroll"
   >
     <template slot="footer">
       <a-button key="back" @click="handleCancel"> 关闭 </a-button>

+ 5 - 1
jshERP-web/src/views/task/ApprovalList.vue

@@ -64,6 +64,8 @@
     <bill-detail ref="modalDetail" @ok="handleOk"></bill-detail>
     <!-- 盘点任务审批 -->
     <InventoryCheckModal ref="InventoryCheckModal" @ok="handleOk" />
+    <!-- pda维护商品 -->
+     <PdaFlowModal ref="PdaFlowModal" @ok="handleOk" />
   </a-row>
 </template>
 <script>
@@ -73,13 +75,15 @@ import { approvalMixin } from './mixin/approvalMixin'
 import { flowTypes } from './utils/flow'
 import BillDetail from '@/views/bill/dialog/BillDetail.vue'
 import InventoryCheckModal from '@/views/stock/modules/InventoryCheckModal'
+import PdaFlowModal from './modules/PdaFlowModal.vue'
 
 export default {
   name: 'ApprovalList',
   mixins: [JeecgListMixin,approvalMixin],
   components: {
     BillDetail,
-    InventoryCheckModal
+    InventoryCheckModal,
+    PdaFlowModal
   },
   data() {
     return {

+ 5 - 1
jshERP-web/src/views/task/HandledList.vue

@@ -86,6 +86,8 @@
     <bill-detail ref="modalDetail" @ok="modalFormOk" @close="modalFormClose"></bill-detail>
     <!-- 盘点任务审批 -->
     <InventoryCheckModal ref="InventoryCheckModal" @ok="modalFormOk" />
+    <!-- pda维护商品 -->
+    <PdaFlowModal ref="PdaFlowModal" @ok="modalFormOk" />
   </a-row>
 </template>
 <script>
@@ -97,13 +99,15 @@ import BillDetail from '@/views/bill/dialog/BillDetail.vue'
 import InventoryCheckModal from '@/views/stock/modules/InventoryCheckModal'
 import { cloneDeep } from 'lodash'
 import moment from 'moment'
+import PdaFlowModal from './modules/PdaFlowModal.vue'
 
 export default {
   name: 'HandledList',
   mixins: [JeecgListMixin,approvalMixin],
   components: {
     BillDetail,
-    InventoryCheckModal
+    InventoryCheckModal,
+    PdaFlowModal
   },
   data() {
     return {

+ 6 - 2
jshERP-web/src/views/task/InitiateList.vue

@@ -92,6 +92,8 @@
     <SaleOutModal ref="SaleOutModal" @ok="modalFormOk" />
     <!-- 盘点未通过重新编辑 -->
     <InventoryCheckModal ref="InventoryCheckModal" @ok="modalFormOk" />
+    <!-- pda维护商品 -->
+    <PdaFlowModal ref="PdaFlowModal" @ok="modalFormOk" />
   </a-row>
 </template>
 <script>
@@ -109,6 +111,7 @@ import PurchaseOrderModal from '@/views/bill/modules/PurchaseOrderModal'
 import SaleOrderModal from '@/views/bill/modules/SaleOrderModal'
 import SaleOutModal from '@/views/bill/modules/SaleOutModal'
 import InventoryCheckModal from '@/views/stock/modules/InventoryCheckModal'
+import PdaFlowModal from './modules/PdaFlowModal.vue'
 import {
   findBillDetailByNumber,
 } from '@/api/api'
@@ -123,7 +126,8 @@ export default {
     PurchaseOrderModal,
     SaleOrderModal,
     SaleOutModal,
-    InventoryCheckModal
+    InventoryCheckModal,
+    PdaFlowModal
   },
   data() {
     return {
@@ -223,7 +227,7 @@ export default {
           this.$refs.InventoryCheckModal.title = '编辑盘点任务'
           break;
         case 'pda维护商品':
-          this.$message.warning('待开发中...')
+          this.$message.warning('请重新去pda申请!')
           break;
       
         default:

+ 7 - 1
jshERP-web/src/views/task/mixin/approvalMixin.js

@@ -29,7 +29,13 @@ export const approvalMixin = {
           }
           break
         case 'pda维护商品':
-          this.$message.warning('待开发中...')
+          this.$refs.PdaFlowModal.lookDetail(record.number,record)
+          this.$refs.PdaFlowModal.approvalIsReadonly = approvalIsReadonly
+          if(approvalIsReadonly){
+            this.$refs.PdaFlowModal.title = record.type + '-审核详情'
+          }else{
+            this.$refs.PdaFlowModal.title = record.type + '-去审核'
+          }
           break
         default:
           break;

+ 60 - 8
jshERP-web/src/views/task/modules/FlowModal.vue

@@ -38,11 +38,11 @@
             <a-col :span="24 / 2">
               <a-form-model-item :label="`流程节点${index+1}`" :labelCol="labelCol" :wrapperCol="wrapperCol" :prop="`auditNodes[${index}].auditorType`" :rules="{
                 required: index===0,
-                message: '请选择',
                 trigger: 'change',
+                validator: (rule, value, callback) => validatorAuditorType(rule, value, callback, index)
               }">
                 <a-select v-model="item.auditorType" allowClear placeholder="请选择" style="width: 100%;" :disabled="isReadOnly" @change="changeAuditorType($event,index)">
-                  <a-select-option v-for="item in approvers" :key="item.value" :value="item.value">{{item.label}}</a-select-option>
+                  <a-select-option v-for="item in approvers" :disabled="item.disabled" :key="item.value" :value="item.value">{{item.label}}</a-select-option>
                 </a-select>
               </a-form-model-item>
             </a-col>
@@ -52,8 +52,8 @@
                 message: '请选择',
                 trigger: 'change',
               }:{}">
-                <a-select v-model="item.auditor" allowClear placeholder="请选择" :disabled="item.auditorType==2||item.auditorType==3||isReadOnly" style="width: 100%;">
-                  <a-select-option v-for="(item, index) in userList" :key="index" :value="item.id">
+                <a-select v-model="item.auditor" @change="changeAuditor($event,index)" allowClear placeholder="请选择" :disabled="item.auditorType==2||item.auditorType==3||isReadOnly" style="width: 100%;">
+                  <a-select-option v-for="(item, index) in _userList" :disabled="item.disabled" :key="index" :value="item.id">
                     {{ item.userName }}
                   </a-select-option>
                 </a-select>
@@ -73,7 +73,7 @@ import {
 import { postAction } from '@/api/manage'
 import { autoJumpNextInput } from '@/utils/util'
 import { mixinDevice } from '@/utils/mixin'
-import { flowTypes,approvers } from '../utils/flow'
+import { flowTypes } from '../utils/flow'
 export default {
   name: 'FlowModal',
   mixins: [mixinDevice],
@@ -110,7 +110,6 @@ export default {
       visible: false,
       
       flowTypes,
-      approvers,
       isReadOnly: false,
       labelCol: {
         xs: { span: 24 },
@@ -132,6 +131,37 @@ export default {
       }
     }
   },
+  computed: {
+    approvers(){
+      const auditNodeTypes = this.model.auditNodes.filter(item => (item.auditorType==2||item.auditorType==3)).map(item => item.auditorType)
+      return [
+        {
+          label: '部门最高领导审核',
+          value: 3,
+          disabled: auditNodeTypes.includes(3)
+        },
+        {
+          label: '上级部门最高领导审核',
+          value: 2,
+          disabled: auditNodeTypes.includes(2)
+        },
+        {
+          label: '指定用户',
+          value: 1,
+          disabled: false
+        },
+      ]
+    },
+    _userList(){
+      const auditorList = this.model.auditNodes.filter(item => (item.auditorType==1)).map(item => item.auditor)
+      return this.userList.map(item => {
+        return {
+          ...item,
+          disabled: auditorList.includes(item.id)
+        }
+      })
+    }
+  },
   created() {
     this.initUser()
   },
@@ -201,10 +231,32 @@ export default {
         this.resetModal()
       })
     },
-    changeAuditorType(v,index){
-      this.$refs.form.clearValidate([`auditNodes[${index}].auditor`])
+     changeAuditorType(v,index){
+      // this.$refs.form.clearValidate([`auditNodes[${index}].auditor`])
       this.model.auditNodes[index].auditor = undefined
       this.$forceUpdate()
+      this.$nextTick(() => {
+        this.$refs.form.validate()
+      })
+    },
+    changeAuditor(val,index){
+      this.$refs.form.clearValidate([`auditNodes[${index}].auditor`])
+      this.$forceUpdate()
+    },
+    validatorAuditorType(rule, value, callback, index){
+      if(index === 0){
+        if(!value){
+          return callback(new Error(`请选择流程节点1`))
+        }
+        callback()
+      }else{
+        const nextArr = this.model.auditNodes.slice(index)
+        const arr = nextArr.filter(item => item.auditorType)
+        if(arr.length>0&&!value){
+          return callback(new Error(`中间流程节点不能为空!`))
+        }
+        callback()
+      }
     },
     handleOk() {
       const that = this

+ 310 - 0
jshERP-web/src/views/task/modules/PdaFlowModal.vue

@@ -0,0 +1,310 @@
+<template>
+  <j-modal
+    :title="title"
+    width="100%"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    :keyboard="false"
+    :forceRender="true"
+    v-bind:prefixNo="prefixNo"
+    fullscreen
+    switchFullscreen
+    @cancel="handleCancel"
+    :id="prefixNo"
+    style="top: 20px; height: 95%"
+  >
+    <template slot="footer">
+      <a-button v-if="!approvalIsReadonly" :loading="confirmLoading" @click="submitApproval(2)">审核不通过</a-button>
+      <a-button type="primary" v-if="!approvalIsReadonly" :loading="confirmLoading" @click="submitApproval(1)">审核通过</a-button>
+      <a-button key="back" v-if="approvalIsReadonly" @click="handleCancel">取消</a-button>
+    </template>
+    <a-spin :spinning="confirmLoading">
+      <a-form-model :model="model" ref="form" :rules="rules" :labelCol="labelCol" :wrapperCol="wrapperCol">
+        <a-row class="form-row" :gutter="24" type="flex">
+          <a-col :xl="6" :lg="8" :md="12" :sm="24" >
+            <a-form-model-item label="货物条码" prop="number">
+              <a-input disabled placeholder="自动生成" v-model="model.number" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :xl="6" :lg="8" :md="12" :sm="24" >
+            <a-form-model-item label="货物名称" prop="name">
+              <a-input disabled placeholder="自动生成" v-model="model.name" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :xl="6" :lg="8" :md="12" :sm="24" >
+            <a-form-model-item label="规格" prop="standard" >
+              <a-input placeholder="请输入" disabled v-model="model.standard" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :xl="6" :lg="8" :md="12" :sm="24" >
+            <a-form-model-item label="库位" prop="position">
+              <a-input placeholder="请输入" disabled v-model="model.position" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :xl="6" :lg="8" :md="12" :sm="24" >
+            <a-form-model-item label="单位" prop="commodityUnit">
+              <a-select placeholder="请选择" :disabled="approvalIsReadonly&&nodeOrder==1" style="width: 150px" v-model="model.commodityUnit" :options="unitList"></a-select>
+            </a-form-model-item>
+          </a-col>
+          <a-col :xl="6" :lg="8" :md="12" :sm="24" >
+            <a-form-model-item label="类别" prop="categoryId">
+              <a-tree-select
+                v-model="model.categoryId"
+                :disabled="approvalIsReadonly&&nodeOrder==1"
+                style="width: 100%"
+                :dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }"
+                allow-clear
+                :treeData="categoryTree"
+                placeholder="请选择类别"
+              >
+              </a-tree-select>
+            </a-form-model-item>
+          </a-col>
+          <a-col :xl="6" :lg="8" :md="12" :sm="24" >
+            <a-form-model-item label="默认采购价" prop="defaultPurchaseDecimal">
+              <a-input placeholder="请输入" :disabled="approvalIsReadonly&&nodeOrder==1" v-model="model.defaultPurchaseDecimal" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :xl="6" :lg="8" :md="12" :sm="24" >
+            <a-form-model-item label="默认销售价" prop="defaultWholesaleDecimal">
+              <a-input placeholder="请输入" :disabled="approvalIsReadonly&&nodeOrder==1" v-model="model.defaultWholesaleDecimal" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :xl="6" :lg="8" :md="12" :sm="24">
+            <a-form-model-item
+              label="图片"
+            >
+              <img v-for="(url,i) in fileList" :key="i" :src="url" alt="" style="margin: 0 10px 10px 0;display: inline-block;width: 100px;height: 100px;"  />
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+        <!-- 审批历史 -->
+      <section v-if="approvalId">
+        <h4 class="block-title">审批历史</h4>
+        <a-table 
+          size="middle"
+          bordered
+          rowKey="id"
+          :pagination="false"
+          :loading="approval.loading"
+          :columns="approval.columns"
+          :rowClassName="rowClassName"
+          :dataSource="approval.dataSource"
+          :scroll="{ x: '100%' }"
+        ></a-table>
+        <a-textarea :rows="1" placeholder="审核备注" v-model="auditComment" v-if="!approvalIsReadonly" style="margin-top: 8px" />
+      </section>
+    </a-spin>
+  </j-modal>
+</template>
+
+<script>
+import {
+  queryMaterialCategoryTreeList,
+} from '@/api/api'
+import { getAction, postAction } from '@/api/manage'
+import { mapGetters } from 'vuex'
+
+export default {
+  name: 'PdaFlowModal',
+  data() {
+    return {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 9 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 15 },
+      },
+      visible: false,
+      categoryTree: [],
+      unitList: [],
+      confirmLoading: false,
+      prefixNo: 'PDAWHSP',
+      action: '',
+      title: '',
+      rules: {
+        categoryId: [{ required: true, message: '请选择类别!' }],
+        commodityUnit: [{ required: true, message: '请选择单位!' }],
+        defaultWholesaleDecimal: [{ required: true, message: '请输入默认销售价!' }],
+        defaultPurchaseDecimal: [{ required: true, message: '请输入默认采购价!' }],
+      },
+      model: {},
+      fileList:[],
+      // 审批历史
+      nodeOrder: null,
+      approvalId: null, //审批id
+      approvalIsReadonly: false,
+      approval:{
+        loading:false,
+        columns:[
+          { title: '审核时间', dataIndex: 'auditTime' },
+          { title: '审核环节', dataIndex: 'nodeOrder',customRender(text,record,index){
+            if(index===0){
+              return text
+            }
+            return `审批节点${text}`
+          } },
+          { title: '审批人', dataIndex: 'auditorName' },
+          { title: '审核动作', dataIndex: 'auditResult',customRender(text,record,index){
+            if(index===0){
+              return text
+            }
+            if(text==1){
+              return '审批通过'
+            }else if(text==2){
+              return '审批不通过'
+            }
+            return ''
+          } },
+          { title: '备注', dataIndex: 'auditComment' },
+        ],
+        dataSource:[]
+      },
+      auditComment: ''
+    }
+  },
+  computed: {
+    ...mapGetters(['username']),
+  },
+  methods: {
+    loadTreeData() {
+      let that = this
+      let params = {}
+      params.id = ''
+      queryMaterialCategoryTreeList(params).then((res) => {
+        if (res) {
+          that.categoryTree = []
+          for (let i = 0; i < res.length; i++) {
+            let temp = res[i]
+            that.categoryTree.push(temp)
+          }
+        }
+      })
+    },
+    loadUnitListData() {
+      let that = this
+      let params = {}
+      getAction('/unit/getAllList', params).then((res) => {
+        if (res) {
+          that.unitList = res.data.map(item => ({
+            title: item.name,
+            value: item.name,
+          }))
+        }
+      })
+    },
+    handleOpen(number){
+      this.visible = true
+      if(number){
+        this.getDetail(number)
+      }
+      this.loadTreeData()
+      this.loadUnitListData()
+    },
+    edit(number) {
+      this.action = 'edit'
+      this.handleOpen(number)
+    },
+    add(){
+      this.action = 'add'
+      this.$set(this.model,'taskStatus',0)
+      this.handleOpen()
+    },
+    lookDetail(number,approvalRow=null){
+      this.action = 'detail'
+      this.handleOpen(number)
+      //审批历史
+      if(approvalRow&&approvalRow.id){
+        this.approvalId = approvalRow.id
+        this.nodeOrder = approvalRow.nodeOrder
+        getAction('/audit/auditHistory',{id:approvalRow.id}).then(res => {
+          const list = res.data
+          list.unshift({
+            auditTime: approvalRow.submitTime,
+            nodeOrder: '开始',
+            auditorName: approvalRow.initiatorName,
+            auditResult: '提交审批',
+            auditComment: '',
+          })
+          this.approval.dataSource = list
+          console.log('approvalRow=====',approvalRow)
+        })
+      }
+    },
+    getDetail(number){
+      const url = '/materialInput/detail/' + number
+      getAction(url).then((res) => {
+        this.model = res.data
+        this.fileList = res.data.imgName?res.data.imgName.split(','):[]
+      })
+    },
+    close(){
+      this.visible = false
+      this.$refs.form.resetFields()
+      this.action = ''
+      this.model = {}
+      this.$emit('close')
+      // 审批
+      this.approvalId = null
+      this.auditComment = ''
+      this.approval.dataSource = []
+      this.approvalIsReadonly = false
+    },
+    handleCancel() {
+      this.close()
+    },
+    rowClassName(record,index){
+      if(this.username===record.auditorName){
+        return 'red-row'
+      }
+      return ''
+    },
+    toApproval(status){
+      const params = {
+        id: this.approvalId,
+        status,
+        auditComment: this.auditComment
+      }
+      this.confirmLoading = true
+      postAction('/audit/setStatus',params).then(res => {
+        console.log(res)
+        if(res.code===200){
+          this.$message.success(res.msg)
+          this.handleCancel()
+          this.$emit('ok')
+        }else{
+          this.$message.error(res.data.message)
+        }
+      }).finally(() => {
+        this.confirmLoading = false
+      })
+    },
+    // 提交审核
+    submitApproval(status){
+      if(this.nodeOrder==1&&status==1){
+        this.$refs.form.validate(async (flag, values) => {
+          if(flag){
+            const res = await postAction('/materialInput/update',{...this.model})
+            if(res.code===200){
+              this.toApproval(status)
+            }else{
+              this.$message.error(res.data||'操作失败')
+            }
+          }
+        })
+      }else{
+        this.toApproval(status)
+      }
+    }
+  },
+}
+</script>
+
+<style scoped>
+::v-deep .red-row{
+  color: #f5222d;
+}
+</style>