Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

lizhenhao 2 anni fa
parent
commit
8e53348f19

+ 61 - 0
src/api/sys/ReimbursementService.js

@@ -0,0 +1,61 @@
+import request from '@/utils/httpRequest'
+
+export default class ReimbursementService {
+  list (param) {
+    return request({
+      url: '/reimbursement/info/list',
+      method: 'get',
+      params: param
+    })
+  }
+  save (param) {
+    return request({
+      url: '/reimbursement/info/save',
+      method: 'post',
+      data: param
+    })
+  }
+  findById (id) {
+    return request({
+      url: '/reimbursement/info/findById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  remove (id) {
+    return request({
+      url: '/reimbursement/info/remove',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  updateStatusById (param) {
+    return request({
+      url: '/reimbursement/info/updateStatusById',
+      method: 'post',
+      data: param
+    })
+  }
+  checkNumber (number) {
+    return request({
+      url: '/reimbursement/info/checkNumber',
+      method: 'get',
+      params: {number: number}
+    })
+  }
+  userTree (name) {
+    return request({
+      url: '/reimbursement/info/userTree',
+      method: 'get',
+      params: {name: name}
+    })
+  }
+  exportFile (params) {
+    return request({
+      url: '/reimbursement/info/exportFile',
+      method: 'get',
+      params: params,
+      responseType: 'blob'
+    })
+  }
+}

+ 129 - 0
src/views/modules/finance/invoice/ReimbursementTypePullForm.vue

@@ -0,0 +1,129 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="1100px"
+      height="500px"
+      @close="close"
+      @keyup.enter.native=""
+      :visible.sync="visible">
+      <div style="height: calc(100% - 80px);">
+        <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+          <!-- 搜索框-->
+          <el-form-item label="报销类型名称" prop="name">
+            <el-input size="small" v-model="searchForm.name" placeholder="请输入报销类型名称" clearable></el-input>
+          </el-form-item>
+
+          <el-form-item>
+            <el-button type="primary" @click="list()" size="small" icon="el-icon-search">查询</el-button>
+            <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
+          </el-form-item>
+        </el-form>
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="auto"
+          :loading="loading"
+          size="small"
+          ref="typeTable"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          :sort-config="{remote:true}"
+          :data="dataList"
+          :tree-config="{transform: true, rowField: 'id', parentField: 'parentId'}"
+          :checkbox-config="{}">
+          <vxe-column type="seq" width="40"></vxe-column>
+          <vxe-column type="checkbox" width="40" ></vxe-column>
+          <vxe-column title="报销内容名称" field="name" align="left" tree-node></vxe-column>
+          <vxe-column width="100" title="序号" field="sort"></vxe-column>
+        </vxe-table>
+      </div>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'" @click="getProgramForType" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import ReimbursementTypeService from '@/api/sys/ReimbursementTypeService'
+  export default {
+    data () {
+      return {
+        searchForm: {
+          name: ''
+        },
+        dataList: [],
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        title: '',
+        method: '',
+        visible: false,
+        loading: false
+      }
+    },
+    reimbursementTypeService: null,
+    created () {
+      this.reimbursementTypeService = new ReimbursementTypeService()
+    },
+    components: {
+    },
+    methods: {
+      init () {
+        this.visible = true
+        this.list()
+      },
+      // 表单提交
+      getProgramForType () {
+        let rows
+        if (this.commonJS.isEmpty(this.$refs.typeTable.getCheckboxRecords())) {
+          this.$message.error('请选择一条数据')
+          return
+        }
+        rows = this.$refs.typeTable.getCheckboxRecords()
+        if (rows[0].level !== '3') {
+          this.$message.error('请选择子集数据')
+          return
+        }
+        this.$emit('getProgramForType', rows)
+        this.close()
+      },
+      list () {
+        this.loading = true
+        this.reimbursementTypeService.list({...this.searchForm}).then(({data}) => {
+          this.dataList = data
+          this.loading = false
+        })
+      },
+      // 当前页
+      currentChangeHandle ({currentPage, pageSize}) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.list()
+      },
+      resetSearch () {
+        this.$refs.searchForm.resetFields()
+        this.list()
+      },
+      close () {
+        this.detail = ''
+        this.visible = false
+      }
+    }
+  }
+</script>
+<style>
+  .messageZindex {
+    z-index:9999 !important;
+  }
+</style>

+ 127 - 0
src/views/modules/finance/invoice/UserPullForm.vue

@@ -0,0 +1,127 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="1100px"
+      height="500px"
+      @close="close"
+      @keyup.enter.native=""
+      :visible.sync="visible">
+      <div style="height: calc(100% - 80px);">
+        <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+          <!-- 搜索框-->
+          <el-form-item label="用户名称" prop="name">
+            <el-input size="small" v-model="searchForm.name" placeholder="请输入用户名称" clearable></el-input>
+          </el-form-item>
+
+          <el-form-item>
+            <el-button type="primary" @click="list()" size="small" icon="el-icon-search">查询</el-button>
+            <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
+          </el-form-item>
+        </el-form>
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="auto"
+          :loading="loading"
+          size="small"
+          ref="userTable"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          :sort-config="{remote:true}"
+          :data="dataList"
+          :tree-config="{transform: true, rowField: 'id', parentField: 'parentId'}"
+          :checkbox-config="{}">
+          <vxe-column type="seq" width="40"></vxe-column>
+          <vxe-column type="checkbox" width="40" ></vxe-column>
+
+          <vxe-column title="姓名" field="name" align="left" tree-node></vxe-column>
+        </vxe-table>
+      </div>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'" @click="getProgramForUser()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import ReimbursementService from '@/api/sys/ReimbursementService'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        dataList: [],
+        searchForm: {
+          name: ''
+        }
+      }
+    },
+    reimbursementService: null,
+    created () {
+      this.reimbursementService = new ReimbursementService()
+    },
+    components: {
+    },
+    methods: {
+      init () {
+        this.visible = true
+        this.list()
+      },
+      // 表单提交
+      getProgramForUser () {
+        let rows
+        if (this.commonJS.isEmpty(this.$refs.userTable.getCheckboxRecords())) {
+          this.$message.error('请选择一条数据')
+          return
+        }
+        if (this.$refs.userTable.getCheckboxRecords().length > 1) {
+          this.$message.error('最多选择一条数据')
+          return
+        }
+        rows = this.$refs.userTable.getCheckboxRecords()
+        if (!rows[0].isUser) {
+          this.$message.error('请选择子集数据')
+          return
+        }
+        this.close()
+        this.$emit('getProgramForUser', rows)
+      },
+      list () {
+        this.loading = true
+        this.reimbursementService.userTree(this.searchForm.name).then(({data}) => {
+          this.dataList = data
+          this.loading = false
+        })
+      },
+      // 当前页
+      currentChangeHandle ({currentPage, pageSize}) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.list()
+      },
+      resetSearch () {
+        this.$refs.searchForm.resetFields()
+        this.list()
+      },
+      close () {
+        this.detail = ''
+        this.visible = false
+      }
+    }
+  }
+</script>
+<style>
+  .messageZindex {
+    z-index:9999 !important;
+  }
+</style>

+ 23 - 0
src/views/modules/flowable/task/TaskForm.vue

@@ -361,6 +361,25 @@
           })
         })
       },
+      // 驳回至指定节点(节点是从0开始)
+      rejectToPointNum (num) {
+        this.$confirm(`确定驳回流程吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.taskService.backNodes(this.taskId).then(({data}) => {
+            let backNodes = data
+            if (backNodes.length > 0 && backNodes.length > num) {
+              let backTaskDefKey = backNodes[num].taskDefKey
+              this.back(backTaskDefKey)
+            }
+          })
+        })
+        if (this.formType === '2') {
+          this.$refs.form.updateStatusById('reject')
+        }
+      },
       // 撤回
       reback () {
         this.$confirm(`确定撤回流程吗?`, '提示', {
@@ -549,6 +568,10 @@
             this.agree()
             break
           case '_flow_reject': // 驳回
+            if (this.title.includes('报销申请')) {
+              this.rejectToPointNum(0)
+              break
+            }
             this.reject()
             break
           case '_flow_back': // 驳回到任意步骤

+ 316 - 0
src/views/modules/reimbursement/info/InfoForm.vue

@@ -0,0 +1,316 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="1200px"
+      @close="close"
+      @keyup.enter.native="doSubmit"
+      :visible.sync="visible">
+      <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+               label-width="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="userName">
+              <el-input v-model="inputForm.userName" :disabled="true"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="报销编号" prop="no">
+              <el-input v-model="inputForm.no" :disabled="true"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="所属部门" prop="department">
+              <el-input v-model="inputForm.department" :disabled="true"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="报销日期" prop="reimDate">
+              <el-date-picker
+                v-model="inputForm.reimDate"
+                type="date"
+                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="请输入简介"
+                        show-word-limit>
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-divider content-position="left"><i class="el-icon-document"></i>
+          报销详情
+          <el-button style="margin-left: 20px" type="primary" :disabled="method==='view'" size="mini" @click="insertEvent('detail')" plain>
+            新增
+          </el-button>
+        </el-divider>
+        <el-row  :gutter="15" >
+          <vxe-table
+            border
+            show-overflow
+            ref="detailTable"
+            class="vxe-table-element"
+            :data="inputForm.detailInfos"
+            style="margin-left: 5em"
+            @cell-click=""
+            @edit-closed=""
+            highlight-current-row
+            :edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true}"
+          >
+            <vxe-table-column field="userName" title="报销人" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.userName" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="deptName" title="报销部门" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.deptName" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="typeName" title="报销类型" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.typeName" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="projectName" title="报销项目" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.projectName" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="reportNumber" title="报告号" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.reportNumber" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="number" title="费用(元)" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.number" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="receiptNumber" title="收据张数" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.receiptNumber" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="days" title="出差天数" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.days" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="content" title="内容" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.content" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column title="操作" width="100">
+              <template v-slot="scope">
+                <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'detail')">删除</el-button>
+              </template>
+            </vxe-table-column>
+          </vxe-table>
+        </el-row>
+
+        <el-divider content-position="left"><i class="el-icon-document"></i>
+          专用发票信息
+          <el-button style="margin-left: 20px" type="primary" :disabled="method==='view'" size="mini" @click="insertEvent('amount')" plain>
+            新增
+          </el-button>
+        </el-divider>
+        <el-row  :gutter="15" >
+          <vxe-table
+            border
+            show-overflow
+            ref="amountTable"
+            class="vxe-table-element"
+            :data="inputForm.amountInfos"
+            style="margin-left: 5em"
+            @cell-click=""
+            @edit-closed=""
+            highlight-current-row
+            :edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true}"
+          >
+            <vxe-table-column field="code" title="发票代码" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.code" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="number" title="发票号" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.number" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="amount" title="金额" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.amount" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="taxAmount" title="税额" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.taxAmount" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column field="count" title="价税合计" :edit-render="{}">
+              <template v-slot:edit="scope">
+                <el-input v-model="scope.row.count" ></el-input>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column title="操作" width="100">
+              <template v-slot="scope">
+                <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'amount')">删除</el-button>
+              </template>
+            </vxe-table-column>
+          </vxe-table>
+        </el-row>
+
+        <!-- 附件 -->
+        <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import ReimbursementService from '@/api/sys/ReimbursementService'
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        inputForm: {
+          userName: '',
+          no: '',
+          department: '',
+          reimDate: '',
+          remarks: '',
+          detailInfos: [],
+          amountInfos: [],
+          files: [] // 附件信息
+        }
+      }
+    },
+    reimbursementService: null,
+    created () {
+      this.reimbursementService = new ReimbursementService()
+    },
+    components: {
+      UpLoadComponent
+    },
+    methods: {
+      init (method, id) {
+        this.method = method
+        this.inputForm = {
+          userName: '',
+          no: '',
+          department: '',
+          reimDate: '',
+          remarks: '',
+          detailInfos: [],
+          amountInfos: [],
+          files: [] // 附件信息
+        }
+        if (method === 'add') {
+          this.title = `新建报销类型`
+        } else if (method === 'edit') {
+          this.inputForm.id = id
+          this.title = '修改报销类型'
+        } else if (method === 'view') {
+          this.inputForm.id = id
+          this.title = '查看报销类型'
+        } else if (method === 'addChild') {
+          this.title = '添加下级结构'
+          this.inputForm.parentId = id
+        }
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          if (method === 'edit' || method === 'view') { // 修改或者查看
+            this.loading = true
+            this.$refs.inputForm.resetFields()
+            this.reimbursementService.findById(this.inputForm.id).then(({data}) => {
+              this.inputForm = this.recover(this.inputForm, data)
+              this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'reimbursement')
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 表单提交
+      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.files = this.$refs.uploadComponent.getDataList()
+            this.reimbursementTypeService.save(this.inputForm).then(({data}) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.$refs.inputForm.resetFields()
+        this.inputForm.detailInfos = []
+        this.inputForm.amountInfos = []
+        this.$refs.uploadComponent.clearUpload()
+        this.visible = false
+      },
+      // 删除
+      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) => {
+            this.inputForm.detailInfos.push(data)
+          })
+        }
+        if (type === 'amount') {
+          await this.$refs.amountTable.insert().then((data) => {
+            this.inputForm.amountInfos.push(data)
+          })
+        }
+      }
+    }
+  }
+</script>

+ 450 - 0
src/views/modules/reimbursement/info/InfoList.vue

@@ -0,0 +1,450 @@
+<template>
+  <div class="page">
+    <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+      <!-- 搜索框-->
+      <el-form-item label="报销项目" prop="project">
+        <el-input size="small" v-model="searchForm.project" placeholder="请输入报销项目" clearable>
+          <el-button icon="el-icon-search" slot="append" @click="openProgramPageForm"></el-button>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="报销时间" prop="dates">
+        <el-date-picker
+          style=""
+          placement="bottom-start"
+          format="yyyy-MM-dd HH:mm:ss"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          v-model="searchForm.dates"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="经办人" prop="handled">
+        <el-input size="small" v-model="searchForm.handled" placeholder="请输入经办人" clearable>
+          <el-button icon="el-icon-search" slot="append">
+            <SelectUserTree
+              ref="companyTree"
+              :props="{
+                  value: 'id',             // ID字段名
+                  label: 'name',         // 显示名称
+                  children: 'children'    // 子级字段名
+                }"
+              :url="`/sys/user/treeUserDataAllOffice?type=2`"
+              :value="searchForm.handled"
+              :clearable="true"
+              :accordion="true"
+              @getValue="(value, label) => {searchForm.handled=label}"/>
+          </el-button>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="报销人" prop="remiBy">
+        <el-input size="small" v-model="searchForm.remiBy" placeholder="请输入报销人" clearable>
+          <el-button icon="el-icon-search" slot="append">
+            <SelectUserTree
+              ref="companyTree"
+              :props="{
+                  value: 'id',             // ID字段名
+                  label: 'name',         // 显示名称
+                  children: 'children'    // 子级字段名
+                }"
+              :url="`/sys/user/treeUserDataAllOffice?type=2`"
+              :value="searchForm.remiBy"
+              :clearable="true"
+              :accordion="true"
+              @getValue="(value, label) => {searchForm.remiBy=label}"/>
+          </el-button>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="报销状态" prop="type">
+        <el-select v-model="searchForm.type" placeholder="请选择" style="width:100%;">
+          <el-option
+            v-for="item in $dictUtils.getDictList('status')"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="报销部门" prop="department">
+        <el-input size="small" v-model="searchForm.department" placeholder="请输入报销部门" clearable>
+          <el-button icon="el-icon-search" slot="append">
+            <SelectTree
+              ref="officeTree"
+              :props="{
+                    value: 'id',             // ID字段名
+                    label: 'name',         // 显示名称
+                    children: 'children'    // 子级字段名
+                  }"
+              :url="`/sys/office/treeData?type=2`"
+              :value="searchForm.department"
+              :clearable="true"
+              :accordion="true"
+              @getValue="(value,label) => {searchForm.department=label}"/>
+          </el-button>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="报销类别" prop="remiType">
+        <el-input size="small" v-model="searchForm.remiType" placeholder="请输入报销类别" clearable>
+          <el-button icon="el-icon-search" slot="append">
+            <SelectTree
+              ref="areaTree"
+              :props="{
+                      value: 'id',             // ID字段名
+                      label: 'name',         // 显示名称
+                      children: 'children'    // 子级字段名
+                    }"
+              url="/reimbursement/type/treeData?type=12"
+              :value="searchForm.remiType"
+              :clearable="true"
+              :accordion="true"
+              @getValue="(value, label) => {searchForm.remiType=label}"/>
+          </el-button>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="报销金额" prop="amounts">
+        <InputNumber :disabled="false" :precision="num" v-model="searchForm.amounts"></InputNumber>
+      </el-form-item>
+      <el-form-item label="报告号" prop="reportNumber">
+        <el-input size="small" v-model="searchForm.reportNumber" placeholder="请输入报告号" clearable></el-input>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary" @click="refreshList()" size="small" icon="el-icon-search">查询</el-button>
+        <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <div class="bg-white top" style="">
+      <vxe-toolbar :refresh="{query: refreshList}" custom>
+        <template #buttons>
+          <el-button v-if="hasPermission('reimbursement:info:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
+          <el-button v-if="hasPermission('reimbursement:info:del')" type="danger" size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.infoTable && $refs.infoTable.getCheckboxRecords().length === 0" plain>删除</el-button>
+          <el-button v-if="hasPermission('sys:project:exportFile')"  type="warning" plain @click="exportFile()" size="small">导出</el-button>
+        </template>
+      </vxe-toolbar>
+      <div style="height: calc(100% - 50px)">
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="auto"
+          :loading="loading"
+          size="small"
+          ref="infoTable"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          :sort-config="{remote:true}"
+          :data="dataList"
+          :checkbox-config="{}">
+          <vxe-column type="seq" width="40"></vxe-column>
+          <vxe-column type="checkbox" width="40" ></vxe-column>
+          <vxe-column width="200" title="报销编号" field="no" align="left">
+            <template slot-scope="scope">
+              <el-link  type="primary" :underline="false" v-if="hasPermission('reimbursement:info:view')" @click="view(scope.row.id)">{{scope.row.no}}</el-link>
+              <el-link  type="primary" :underline="false" v-else-if="hasPermission('reimbursement:info:view')" @click="view(scope.row.id)">{{scope.row.no}}</el-link>
+              <span v-else>{{scope.row.no}}</span>
+            </template>
+          </vxe-column>
+          <vxe-column width="200" title="报销类别" field="typeName"></vxe-column>
+          <vxe-column width="200" title="报销项目" field="projectName">
+            <template slot-scope="scope">
+              <el-link  type="primary" :underline="false" v-if="hasPermission('reimbursement:info:view')" @click="viewProject(scope.row.projectId)">{{scope.row.projectName}}</el-link>
+              <el-link  type="primary" :underline="false" v-else-if="hasPermission('reimbursement:info:view')" @click="viewProject(scope.row.projectId)">{{scope.row.projectName}}</el-link>
+              <span v-else>{{scope.row.projectName}}</span>
+            </template>
+          </vxe-column>
+          <vxe-column width="200" title="报告号" field="reportNumber"></vxe-column>
+          <vxe-column width="100" title="经办人" field="userName"></vxe-column>
+          <vxe-column width="100" title="报销人" field="name"></vxe-column>
+          <vxe-column width="200" title="报销部门" field="deptName"></vxe-column>
+          <vxe-column width="100" title="报销日期" field="reimDate"></vxe-column>
+          <vxe-column width="100" title="报销金额" field="number"></vxe-column>
+          <vxe-column width="100" title="状态" field="type">
+            <template slot-scope="scope">
+              <el-button type="text" @click="detail(scope.row)" :type="$dictUtils.getDictLabel('status_info', scope.row.type, '-')" effect="dark" size="mini">{{$dictUtils.getDictLabel("status", scope.row.type, '未开始')}} </el-button>
+            </template>
+          </vxe-column>
+
+          <vxe-column title="操作" width="230px" fixed="right" align="center">
+            <template  slot-scope="scope">
+              <el-button v-if="hasPermission('reimbursement:info:edit') && (scope.row.type === '1' || scope.row.type === '3' || scope.row.type === '4')" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row)">修改</el-button>
+              <el-button v-if="hasPermission('reimbursement:info:edit') && (scope.row.type === '2')" type="text" icon="el-icon-back" size="small" @click="reback(scope.row)">撤回</el-button>
+              <el-button v-if="hasPermission('reimbursement:info:del') && (scope.row.type === '1')" type="text" icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
+            </template>
+          </vxe-column>
+        </vxe-table>
+
+        <ProgramPageForm ref="programPageForm" @getProgram="getProgram"></ProgramPageForm>
+        <InfoForm ref="infoForm" @refreshDataList="refreshList"></InfoForm>
+        <ProjectForm ref="projectForm" @refreshDataList="refreshList"></ProjectForm>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  import ReimbursementService from '@/api/sys/ReimbursementService'
+  import InputNumber from '@/views/modules/sys/workContract/InputNumber.vue'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import ProgramPageForm from '@/views/modules/finance/invoice/ProgramPageForm'
+  import InfoForm from './InfoForm'
+  import TaskService from '@/api/flowable/TaskService'
+  import ProcessService from '@/api/flowable/ProcessService'
+  import pick from 'lodash.pick'
+  import ProjectForm from '@/views/modules/program/registered/ProjectForm'
+  export default {
+    data () {
+      return {
+        num: 0,
+        visable: false,
+        gridData: [],
+        searchForm: {
+          project: '',
+          dates: [],
+          handled: '',
+          remiBy: '',
+          type: [],
+          department: '',
+          remiType: '',
+          amounts: [],
+          reportNumber: ''
+        },
+        dataList: [],
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        loading: false
+      }
+    },
+    reimbursementService: null,
+    taskService: null,
+    processService: null,
+    created () {
+      this.reimbursementService = new ReimbursementService()
+      this.taskService = new TaskService()
+      this.processService = new ProcessService()
+    },
+    components: {
+      InputNumber,
+      SelectUserTree,
+      SelectTree,
+      ProgramPageForm,
+      InfoForm,
+      ProjectForm
+    },
+    mounted () {
+      this.refreshList()
+    },
+    activated () {
+      this.refreshList()
+    },
+    computed: {
+      userName () {
+        return JSON.parse(localStorage.getItem('user')).name
+      },
+      user () {
+        this.create = JSON.parse(localStorage.getItem('user')).id
+        console.log('createId', this.create)
+        return JSON.parse(localStorage.getItem('user'))
+      }
+    },
+    methods: {
+      // 新增
+      add () {
+        // 读取流程表单
+        let tabTitle = `发起流程【报销审批】`
+        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [报销审批]`
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
+          status: 'startAndHold'}).then((data) => {
+            this.$router.push({
+              path: '/flowable/task/TaskForm',
+              query: {
+                procDefId: this.processDefinitionId,
+                procDefKey: this.procDefKey,
+                status: 'startAndHold',
+                title: tabTitle,
+                formType: data.data.formType,
+                formUrl: data.data.formUrl,
+                formTitle: processTitle,
+                businessId: 'false',
+                isShow: false,
+                routePath: '/reimbursement/info/InfoList'
+              }
+            })
+          })
+      },
+      // 修改
+      edit (row) {
+        // 暂存修改
+        let status = ''
+        if (row.type === '1') {
+          status = 'startAndHold'
+        }
+        // 撤回或者驳回修改
+        if (row.type === '3' || row.type === '4') {
+          status = 'startAndClose'
+        }
+        // 读取流程表单
+        let tabTitle = `发起流程【报销申请】`
+        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [报销申请]`
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
+          businessId: row.id,
+          businessTable: 'reimbursement_info',
+          status: status
+        }).then((data) => {
+          this.$router.push({
+            path: '/flowable/task/TaskForm',
+            query: {
+              procDefId: this.processDefinitionId,
+              procDefKey: this.procDefKey,
+              status: status,
+              title: tabTitle,
+              formType: data.data.formType,
+              formUrl: data.data.formUrl,
+              formTitle: processTitle,
+              businessTable: 'reimbursement_info',
+              businessId: row.id,
+              isShow: false,
+              routePath: '/reimbursement/info/InfoList'
+            }
+          })
+        })
+      },
+      // 撤回
+      reback (row) {
+        this.$confirm(`确定撤回流程吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          taskId: row.procInsId,
+          type: 'warning'
+        }).then(() => {
+          this.taskService.backNodes(row.taskId).then(({data}) => {
+            let backNodes = data
+            if (backNodes.length > 0) {
+              let backTaskDefKey = backNodes[0].taskDefKey
+              this.taskService.back({
+                taskId: row.taskId,
+                backTaskDefKey: backTaskDefKey,
+                isShow: false,
+                ...this.auditForm
+              }).then(({data}) => {
+                row.type = '3'
+                console.log('type', row)
+                this.reimbursementService.updateStatusById(row)
+                this.$message.success('回退成功')
+                this.refreshList()
+              })
+            }
+          })
+        })
+      },
+      // 查看
+      view (id) {
+        this.$refs.infoForm.init('view', id)
+      },
+      // 查看报销项目
+      viewProject (id) {
+        this.$refs.projectForm.init('view', id)
+      },
+      // 获取数据列表
+      refreshList () {
+        this.loading = true
+        this.reimbursementService.list({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          ...this.searchForm
+        }).then(({data}) => {
+          this.dataList = data.records
+          this.tablePage.total = data.total
+          this.loading = false
+        })
+        this.processService.getByName('报销申请').then(({data}) => {
+          if (!this.commonJS.isEmpty(data.id)) {
+            this.processDefinitionId = data.id
+            this.procDefKey = data.key
+          }
+        })
+      },
+      // 删除
+      del (id) {
+        let ids = id || this.$refs.infoTable.getCheckboxRecords().map(item => {
+          return item.id
+        }).join(',')
+        this.$confirm(`确定删除所选项吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.reimbursementService.remove(ids).then(({data}) => {
+            this.$message.success(data)
+            this.refreshList()
+            this.loading = false
+          })
+        })
+      },
+      resetSearch () {
+        this.$refs.searchForm.resetFields()
+        this.refreshList()
+      },
+      // 流程详情
+      detail (row) {
+        if (!this.commonJS.isEmpty(row.type) && row.type !== '1') {
+          this.taskService.getTaskDef({
+            procInsId: row.procInsId,
+            procDefId: row.processDefinitionId
+          }).then(({data}) => {
+            this.$router.push({
+              path: '/flowable/task/TaskFormDetail',
+              query: {
+                readOnly: true,
+                title: '流程详情',
+                formTitle: '流程详情',
+                businessId: row.id,
+                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')}
+            })
+          })
+        }
+      },
+      openProgramPageForm (rowIndex) {
+        // 打开单选组件
+        this.$refs.programPageForm.init(null, false)
+      },
+      getProgram (rows) {
+        // rows[0].name // 项目名称、开票详情
+        // rows[0].contractName // 合同名称
+        // rows[0].no // 项目编号
+        // rows[0].clientName // 客户名称
+        // rows[0].client // 客户id
+        // rows[0].id // 项目id
+        // rows[0].location // 项目所在地
+        this.searchForm.project = rows[0].name
+      },
+      // 下载文档
+      exportFile () {
+        this.loading = true
+        this.reimbursementService.exportFile({
+          'itemType': '1',
+          ...this.searchForm
+        }).then((res) => {
+          // 将二进制流文件写入excel表,以下为重要步骤
+          this.$utils.downloadExcel(res.data, '报销申请列表信息')
+          this.loading = false
+        }).catch(function (err) {
+          this.loading = false
+          if (err.response) {
+            console.log(err.response)
+          }
+        })
+      }
+    }
+  }
+</script>

+ 574 - 0
src/views/modules/reimbursement/info/ReimbursementForm.vue

@@ -0,0 +1,574 @@
+<template>
+  <div>
+    <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+             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="userName">
+            <el-input v-model="inputForm.userName" :disabled="true"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="报销编号" prop="no">
+            <el-input v-model="inputForm.no" :disabled="true"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="所属部门" prop="department">
+            <el-input v-model="inputForm.department" :disabled="true"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="报销日期" prop="reimDate" :rules="[{required: true, message:'请选择报销日期', trigger:'blur'}]">
+            <el-date-picker
+              v-model="inputForm.reimDate"
+              type="date"
+              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="请输入简介"
+                      show-word-limit>
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-divider content-position="left"><i class="el-icon-document"></i>
+        报销详情
+        <el-button style="margin-left: 20px" type="primary" :disabled="method==='view'" size="mini" @click="insertEvent('detail')" plain>
+          新增
+        </el-button>
+      </el-divider>
+      <el-row  :gutter="15" >
+        <vxe-table
+          border
+          show-footer
+          show-overflow
+          :footer-method="footerMethod"
+          ref="detailTable"
+          class="vxe-table-element"
+          :data="inputForm.detailInfos"
+          style="margin-left: 5em"
+          @cell-click=""
+          @edit-closed=""
+          highlight-current-row
+          :edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true}"
+        >
+          <vxe-table-column field="userName" title="报销人" :edit-render="{}" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
+            <template v-slot:edit="scope">
+              <el-input v-model="scope.row.userName" @focus="userPullListForm(scope.$rowIndex)"></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="deptName" title="报销部门" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input :disabled='true' v-model="scope.row.deptName" ></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="typeName" title="报销类型" :edit-render="{}" :rules="[{required: true, message:'请选择报销类型', trigger:'blur'}]">
+            <template v-slot:edit="scope">
+              <el-input v-model="scope.row.typeName" @focus="typePullForm(scope.$rowIndex)"></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="projectName" title="报销项目" :edit-render="{}" :rules="[{required: true, message:'请选择报销项目', trigger:'blur'}]">
+            <template v-slot:edit="scope">
+              <el-input v-model="scope.row.projectName" @focus="openProgramPageForm(scope.$rowIndex)"></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="reportNumber" title="报告号" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input v-model="scope.row.reportNumber" ></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="number" title="费用(元)" :edit-render="{}" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
+            <template v-slot:edit="scope">
+              <el-input maxlength="15" v-model="scope.row.number" @keyup.native="scope.row.number = twoDecimalPlaces(scope.row.number)"></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="receiptNumber" title="收据张数" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input v-model="scope.row.receiptNumber" oninput ="value=value.replace(/\D|^0/g,'')" maxlength="10"></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="days" title="出差天数" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input v-model="scope.row.days" oninput ="value=value.replace(/\D|^0/g,'')" maxlength="10"></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="content" title="内容" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input v-model="scope.row.content" ></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column title="操作" width="100">
+            <template v-slot="scope">
+              <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'detail')">删除</el-button>
+            </template>
+          </vxe-table-column>
+        </vxe-table>
+      </el-row>
+
+      <el-divider content-position="left"><i class="el-icon-document"></i>
+        专用发票信息
+        <el-button style="margin-left: 20px" type="primary" :disabled="method==='view'" size="mini" @click="insertEvent('amount')" plain>
+          新增
+        </el-button>
+      </el-divider>
+      <el-row  :gutter="15" >
+        <vxe-table
+          border
+          show-overflow
+          ref="amountTable"
+          class="vxe-table-element"
+          :data="inputForm.amountInfos"
+          style="margin-left: 5em"
+          @cell-click=""
+          @edit-closed=""
+          highlight-current-row
+          :edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true}"
+        >
+          <vxe-table-column field="code" title="发票代码" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input oninput ="value=value.replace(/\D|^0/g,'')" maxlength="10" v-model="scope.row.code" ></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="number" title="发票号" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input oninput ="value=value.replace(/\D|^0/g,'')" maxlength="8" @change="isExict(scope.row)" v-model="scope.row.number" ></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="amount" title="金额" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input maxlength="15" v-model="scope.row.amount" @keyup.native="scope.row.amount = twoDecimalPlaces(scope.row.amount)" @change="countAmount(scope.row)"></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="taxAmount" title="税额" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input maxlength="15" v-model="scope.row.taxAmount" @keyup.native="scope.row.taxAmount = twoDecimalPlaces(scope.row.taxAmount)" @change="countAmount(scope.row)"></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column field="count" title="价税合计" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input disabled="true" v-model="scope.row.count" ></el-input>
+            </template>
+          </vxe-table-column>
+          <vxe-table-column title="操作" width="100">
+            <template v-slot="scope">
+              <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'amount')">删除</el-button>
+            </template>
+          </vxe-table-column>
+        </vxe-table>
+      </el-row>
+
+      <!-- 附件 -->
+      <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+      <ProgramPageForm ref="programPageForm" @getProgram="getProgram"></ProgramPageForm>
+      <ReimbursementTypePullForm ref="reimbursementTypePullForm" @getProgramForType="getProgramForType"></ReimbursementTypePullForm>
+      <UserPullForm ref="userPullForm" @getProgramForUser="getProgramForUser"></UserPullForm>
+    </el-form>
+  </div>
+</template>
+
+<script>
+  import ReimbursementService from '@/api/sys/ReimbursementService'
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import XEUtils from 'xe-utils'
+  import UserService from '@/api/sys/UserService'
+  import ProgramPageForm from '@/views/modules/finance/invoice/ProgramPageForm'
+  import ReimbursementTypePullForm from '@/views/modules/finance/invoice/ReimbursementTypePullForm'
+  import UserPullForm from '@/views/modules/finance/invoice/UserPullForm'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        indexRow: '',
+        inputForm: {
+          userId: '',
+          userName: '',
+          no: '',
+          department: '',
+          reimDate: '',
+          remarks: '',
+          detailInfos: [],
+          amountInfos: [],
+          files: [] // 附件信息
+        }
+      }
+    },
+    reimbursementService: null,
+    userService: null,
+    created () {
+      this.reimbursementService = new ReimbursementService()
+      this.inputForm.userId = this.userId
+      this.inputForm.userName = this.name
+      this.inputForm.reimDate = new Date()
+      this.inputForm.department = this.officeName
+      this.userService = new UserService()
+    },
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      }
+    },
+    components: {
+      UpLoadComponent,
+      SelectUserTree,
+      SelectTree,
+      ProgramPageForm,
+      ReimbursementTypePullForm,
+      UserPullForm
+    },
+    computed: {
+      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
+      }
+    },
+    watch: {
+      'businessId': {
+        handler (newVal) {
+          if (this.businessId && this.businessId !== 'false') {
+            this.init('edit', this.businessId)
+          } else {
+            this.init('clean', '')
+          }
+        },
+        immediate: true,
+        deep: false
+      }
+    },
+    methods: {
+      init (method, id) {
+        this.method = method
+        this.inputForm = {
+          userName: '',
+          no: '',
+          department: '',
+          reimDate: '',
+          remarks: '',
+          detailInfos: [],
+          amountInfos: [],
+          files: [] // 附件信息
+        }
+        if (method === 'add') {
+          this.title = `新建报销类型`
+        } else if (method === 'edit') {
+          this.inputForm.id = id
+          this.title = '修改报销类型'
+        }
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          if (method === 'edit' || method === 'view') { // 修改或者查看
+            this.loading = true
+            this.$refs.inputForm.resetFields()
+            this.reimbursementService.findById(this.inputForm.id).then(({data}) => {
+              this.inputForm = this.recover(this.inputForm, data)
+              this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'reimbursement')
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.loading = false
+            })
+          }
+          if (method !== 'edit' && method !== 'view') {
+            this.$refs.uploadComponent.newUpload(method, [], 'reimbursement')
+          }
+        })
+      },
+      // 表单提交
+      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.reimbursementService.save(this.inputForm).then(({data}) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.$refs.inputForm.resetFields()
+        this.inputForm.detailInfos = []
+        this.inputForm.amountInfos = []
+        this.$refs.uploadComponent.clearUpload()
+        this.visible = false
+      },
+      // 删除
+      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) => {
+            this.inputForm.detailInfos.push(data)
+          })
+        }
+        if (type === 'amount') {
+          await this.$refs.amountTable.insert().then((data) => {
+            this.inputForm.amountInfos.push(data)
+          })
+        }
+      },
+      // 暂存
+      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.type = '1'
+        this.reimbursementService.save(this.inputForm).then(({data}) => {
+          callback()
+          this.loading = false
+        }).catch(() => {
+          this.loading = false
+        })
+      },
+      // 送审
+      async startForm (callback) {
+        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].userName)) {
+                  this.$message.error('报销详情第' + k + '行请选择报销人')
+                  this.loading = false
+                  return
+                }
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].typeName)) {
+                  this.$message.error('报销详情第' + k + '行请选择报销类型')
+                  this.loading = false
+                  return
+                }
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].projectName)) {
+                  this.$message.error('报销详情第' + k + '行请选择报销项目')
+                  this.loading = false
+                  return
+                }
+                if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].number)) {
+                  this.$message.error('报销详情第' + k + '行请输入费用')
+                  this.loading = false
+                  return
+                }
+              }
+            }
+            if (this.commonJS.isEmpty(this.inputForm.amountInfos)) {
+              this.$message.error('至少填写一条专用发票信息')
+              this.loading = false
+              return
+            }
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            this.inputForm.type = '2'
+            this.reimbursementService.save(this.inputForm).then(({data}) => {
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            }).catch(() => {
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 通过
+      async agreeForm (callback) {
+        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()
+            await this.userService.is().then(({data}) => {
+              if (data) {
+                this.inputForm.type = '5'
+              }
+            })
+            this.reimbursementService.save(this.inputForm).then(({data}) => {
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 修改状态
+      updateStatusById (type) {
+        if (type === 'reject') {
+          this.inputForm.type = '4'
+          this.reimbursementService.updateStatusById(this.inputForm)
+        }
+      },
+      footerMethod ({ columns, data }) {
+        const footerData = [
+          columns.map((column, columnIndex) => {
+            if (columnIndex === 0) {
+              return '总报销费用'
+            }
+            if (['number'].includes(column.property)) {
+              // eslint-disable-next-line no-undef
+              return XEUtils.sum(data, column.property)
+            }
+            return null
+          })
+        ]
+        return footerData
+      },
+      twoDecimalPlaces (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
+      },
+      isExict (row) {
+        this.reimbursementService.checkNumber(row.number).then(({data}) => {
+          if (data) {
+            this.$message.error('该发票号已存在')
+            row.number = ''
+          }
+        })
+      },
+      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)
+      },
+      openProgramPageForm (rowIndex) {
+        this.indexRow = rowIndex
+        // 打开单选组件
+        this.$refs.programPageForm.init(null, false)
+      },
+      getProgram (rows) {
+        this.inputForm.detailInfos[this.indexRow].projectId = rows[0].id
+        this.inputForm.detailInfos[this.indexRow].projectName = rows[0].name
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      // 报销类型下拉弹窗
+      typePullForm (rowIndex) {
+        this.indexRow = rowIndex
+        this.$refs.reimbursementTypePullForm.init()
+      },
+      getProgramForType (rows) {
+        this.inputForm.detailInfos[this.indexRow].typeId = rows[0].id
+        this.inputForm.detailInfos[this.indexRow].typeName = rows[0].name
+        this.indexRow = ''
+        this.$forceUpdate()
+      },
+      // 报销人下拉弹窗
+      userPullListForm (rowIndex) {
+        this.indexRow = rowIndex
+        this.$refs.userPullForm.init()
+      },
+      getProgramForUser (rows) {
+        console.log('rows', rows)
+        this.inputForm.detailInfos[this.indexRow].userId = rows[0].id
+        this.inputForm.detailInfos[this.indexRow].userName = rows[0].name
+        this.inputForm.detailInfos[this.indexRow].deptId = rows[0].parentId
+        this.inputForm.detailInfos[this.indexRow].deptName = rows[0].officeName
+        this.indexRow = ''
+        this.$forceUpdate()
+      }
+    }
+  }
+</script>

+ 1 - 1
src/views/modules/reimbursement/type/TypeForm.vue

@@ -20,7 +20,7 @@
                       label: 'name',         // 显示名称
                       children: 'children'    // 子级字段名
                     }"
-                url="/reimbursement/type/treeData"
+                url="/reimbursement/type/treeData?type=3"
                 :value="inputForm.parentId"
                 :clearable="true"
                 :accordion="true"