|  | @@ -0,0 +1,198 @@
 | 
	
		
			
				|  |  | +<template>
 | 
	
		
			
				|  |  | +  <div>
 | 
	
		
			
				|  |  | +      <div class="my-title">{{ !id ? '新增': formDisable ? '详情' : '修改' }}</div>
 | 
	
		
			
				|  |  | +      <div style="margin-top: 20px"></div>
 | 
	
		
			
				|  |  | +      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" :disabled="formDisable" label-width="auto">
 | 
	
		
			
				|  |  | +        <!-- 工作流 -->
 | 
	
		
			
				|  |  | +        <div v-if="dataForm.workFlowBusinessExt && dataForm.workFlowBusinessExt.workFlowProcessStepList">
 | 
	
		
			
				|  |  | +					<el-steps :active="stepActive" align-center finish-status="success" style="margin-bottom: 20px">
 | 
	
		
			
				|  |  | +					<template v-for="(item, i) in dataForm.workFlowBusinessExt.workFlowProcessStepList">
 | 
	
		
			
				|  |  | +							<el-step :title="item.stepName" :description="item.assigneeName"></el-step>
 | 
	
		
			
				|  |  | +					</template>
 | 
	
		
			
				|  |  | +					</el-steps>
 | 
	
		
			
				|  |  | +					<el-collapse style="margin-bottom: 20px">
 | 
	
		
			
				|  |  | +					<el-collapse-item>
 | 
	
		
			
				|  |  | +							<template slot="title">
 | 
	
		
			
				|  |  | +							<span style="color: red">操作日志(展开查看更多):</span>
 | 
	
		
			
				|  |  | +							</template>
 | 
	
		
			
				|  |  | +							<template v-for="(item, i) in dataForm.workFlowBusinessExt.processLogList">
 | 
	
		
			
				|  |  | +							<div>{{++i}}:{{item.approverName}}  {{item.createTime}}  {{item.approvalValue}}</div>
 | 
	
		
			
				|  |  | +							</template>
 | 
	
		
			
				|  |  | +					</el-collapse-item>
 | 
	
		
			
				|  |  | +					</el-collapse>
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +        <el-row class="my-row">
 | 
	
		
			
				|  |  | +          <el-col :span="8">
 | 
	
		
			
				|  |  | +            <el-form-item label="编码" prop="code">
 | 
	
		
			
				|  |  | +              <el-input v-model="dataForm.code" :disabled="true" placeholder="系统自动生成"></el-input>
 | 
	
		
			
				|  |  | +            </el-form-item>
 | 
	
		
			
				|  |  | +          </el-col>
 | 
	
		
			
				|  |  | +          <el-col :span="8" style="padding-left: 10px">
 | 
	
		
			
				|  |  | +            <el-form-item label="发生日期" prop="happenTime">
 | 
	
		
			
				|  |  | +              <el-date-picker
 | 
	
		
			
				|  |  | +                v-model="dataForm.happenTime"
 | 
	
		
			
				|  |  | +                type="datetime"
 | 
	
		
			
				|  |  | +                value-format="yyyy-MM-dd HH:mm:ss">
 | 
	
		
			
				|  |  | +              </el-date-picker>
 | 
	
		
			
				|  |  | +            </el-form-item>
 | 
	
		
			
				|  |  | +          </el-col>
 | 
	
		
			
				|  |  | +          <el-col :span="8" style="padding-left: 10px">
 | 
	
		
			
				|  |  | +            <el-form-item label="报销金额" prop="submitExpenseAmount">
 | 
	
		
			
				|  |  | +              <el-input-number v-model="dataForm.submitExpenseAmount" :precision="2" :step="1" placeholder="0"></el-input-number>
 | 
	
		
			
				|  |  | +            </el-form-item>
 | 
	
		
			
				|  |  | +          </el-col>
 | 
	
		
			
				|  |  | +        </el-row>
 | 
	
		
			
				|  |  | +        <el-row class="my-row">
 | 
	
		
			
				|  |  | +          <el-col :span="15">
 | 
	
		
			
				|  |  | +            <el-form-item label="报销内容" prop="happenContent">
 | 
	
		
			
				|  |  | +              <el-input type="textarea" 
 | 
	
		
			
				|  |  | +                v-model="dataForm.happenContent"
 | 
	
		
			
				|  |  | +                :rows="4" 
 | 
	
		
			
				|  |  | +                maxlength="300"
 | 
	
		
			
				|  |  | +                show-word-limit
 | 
	
		
			
				|  |  | +                placeholder="报销内容">
 | 
	
		
			
				|  |  | +              </el-input>
 | 
	
		
			
				|  |  | +            </el-form-item>
 | 
	
		
			
				|  |  | +          </el-col>
 | 
	
		
			
				|  |  | +        </el-row>
 | 
	
		
			
				|  |  | +        <el-row class="my-row">
 | 
	
		
			
				|  |  | +          <el-col :span="15">
 | 
	
		
			
				|  |  | +            <el-form-item label="备注说明" prop="notes">
 | 
	
		
			
				|  |  | +              <el-input type="textarea" 
 | 
	
		
			
				|  |  | +                v-model="dataForm.notes" 
 | 
	
		
			
				|  |  | +                :rows="4" 
 | 
	
		
			
				|  |  | +                maxlength="300"
 | 
	
		
			
				|  |  | +                show-word-limit 
 | 
	
		
			
				|  |  | +                placeholder="备注说明"></el-input>
 | 
	
		
			
				|  |  | +            </el-form-item>
 | 
	
		
			
				|  |  | +          </el-col>
 | 
	
		
			
				|  |  | +        </el-row>
 | 
	
		
			
				|  |  | +        <el-row class="my-row">
 | 
	
		
			
				|  |  | +          <upload-component :title="'报销证明附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
 | 
	
		
			
				|  |  | +        </el-row>
 | 
	
		
			
				|  |  | +      </el-form>
 | 
	
		
			
				|  |  | +      <span slot="footer" class="dialog-footer">
 | 
	
		
			
				|  |  | +        <el-button @click="onChose">取消</el-button>
 | 
	
		
			
				|  |  | +        <el-button v-if="!formDisable" type="primary" @click="dataFormSubmit()">确定</el-button>
 | 
	
		
			
				|  |  | +      </span>
 | 
	
		
			
				|  |  | +  </div>
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script>
 | 
	
		
			
				|  |  | +  import { getExpenseDetail } from '@/api/finance'
 | 
	
		
			
				|  |  | +  import uploadComponent from '../common/upload-component'
 | 
	
		
			
				|  |  | +  export default {
 | 
	
		
			
				|  |  | +    name: 'expense-add-or-update',
 | 
	
		
			
				|  |  | +    components: {
 | 
	
		
			
				|  |  | +      uploadComponent
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    data () {
 | 
	
		
			
				|  |  | +      return {
 | 
	
		
			
				|  |  | +        visible: false,
 | 
	
		
			
				|  |  | +        formDisable: false,
 | 
	
		
			
				|  |  | +        dataList: [],
 | 
	
		
			
				|  |  | +        stepList: [],
 | 
	
		
			
				|  |  | +        logList: [],
 | 
	
		
			
				|  |  | +        fileList: [],
 | 
	
		
			
				|  |  | +        id: 0,
 | 
	
		
			
				|  |  | +        dataForm: {},
 | 
	
		
			
				|  |  | +        optionsType: [],
 | 
	
		
			
				|  |  | +        optionsApplier: [],
 | 
	
		
			
				|  |  | +        materialDetails: [],
 | 
	
		
			
				|  |  | +        addMaterialVisible: false,
 | 
	
		
			
				|  |  | +        totalAmount: 0,
 | 
	
		
			
				|  |  | +        dataRule: {
 | 
	
		
			
				|  |  | +          happenTime: [{ required: true, message: '发生日期不能为空', trigger: 'blur' }],
 | 
	
		
			
				|  |  | +          submitExpenseAmount: [{ required: true, message: '报销金额不能为空', trigger: 'blur' }],
 | 
	
		
			
				|  |  | +          happenContent: [{ required: true, message: '报销内容不能为空', trigger: 'blur' }]
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    computed: {
 | 
	
		
			
				|  |  | +      stepActive () {
 | 
	
		
			
				|  |  | +        if (!(this.dataForm.workFlowBusinessExt && this.dataForm.workFlowBusinessExt.workFlowProcessStepList)) {
 | 
	
		
			
				|  |  | +          return 0
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        let stepIndex = this.dataForm.workFlowBusinessExt.workFlowProcessStepList.findIndex(item => item.stepId === this.dataForm.workFlowBusinessExt.currentStepId)
 | 
	
		
			
				|  |  | +        return stepIndex !== -1 ? stepIndex : 0
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    methods: {
 | 
	
		
			
				|  |  | +      onChose () {
 | 
	
		
			
				|  |  | +        this.$emit('onChose')
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      async init (id, formDisable) {
 | 
	
		
			
				|  |  | +        this.visible = true
 | 
	
		
			
				|  |  | +        this.id = id || 0
 | 
	
		
			
				|  |  | +        this.formDisable = formDisable
 | 
	
		
			
				|  |  | +        if (!id) return
 | 
	
		
			
				|  |  | +        await getExpenseDetail(this.id).then(({data}) => {
 | 
	
		
			
				|  |  | +          if (data && data.code === '200') {
 | 
	
		
			
				|  |  | +            this.dataForm = data.data
 | 
	
		
			
				|  |  | +            // 文件列表
 | 
	
		
			
				|  |  | +            this.fileList = []
 | 
	
		
			
				|  |  | +            if (data.data.attachList) {
 | 
	
		
			
				|  |  | +              data.data.attachList.forEach((item) => {
 | 
	
		
			
				|  |  | +                this.fileList.push({
 | 
	
		
			
				|  |  | +                  name: item.fileName,
 | 
	
		
			
				|  |  | +                  url: item.url,
 | 
	
		
			
				|  |  | +                  id: item.url
 | 
	
		
			
				|  |  | +                })
 | 
	
		
			
				|  |  | +              })
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      validateField (type) {
 | 
	
		
			
				|  |  | +        this.$refs.dataForm.validateField(type)
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 表单提交
 | 
	
		
			
				|  |  | +      dataFormSubmit () {
 | 
	
		
			
				|  |  | +        this.$refs['dataForm'].validate((valid) => {
 | 
	
		
			
				|  |  | +          if (valid) {
 | 
	
		
			
				|  |  | +            // 添加附件
 | 
	
		
			
				|  |  | +            let fList = this.fileList
 | 
	
		
			
				|  |  | +            if (fList.length > 0) {
 | 
	
		
			
				|  |  | +              this.dataForm.attachList = []
 | 
	
		
			
				|  |  | +              for (let i = 0; i < fList.length; i++) {
 | 
	
		
			
				|  |  | +                this.dataForm.attachList.push({
 | 
	
		
			
				|  |  | +                  fileName: fList[i].name,
 | 
	
		
			
				|  |  | +                  url: fList[i].url
 | 
	
		
			
				|  |  | +                })
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +              this.$message.error('请上传文件')
 | 
	
		
			
				|  |  | +              return
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            this.$http({
 | 
	
		
			
				|  |  | +              url: !this.id ? this.$http.adornUrl(`/biz-service/finance/save`) : this.$http.adornUrl(`/biz-service/finance/update`),
 | 
	
		
			
				|  |  | +              method: 'post',
 | 
	
		
			
				|  |  | +              data: this.$http.adornData(this.dataForm)
 | 
	
		
			
				|  |  | +            }).then(({data}) => {
 | 
	
		
			
				|  |  | +              if (data && data.code === '200') {
 | 
	
		
			
				|  |  | +                this.$message({
 | 
	
		
			
				|  |  | +                  message: '操作成功',
 | 
	
		
			
				|  |  | +                  type: 'success',
 | 
	
		
			
				|  |  | +                  duration: 1500,
 | 
	
		
			
				|  |  | +                  onClose: () => {
 | 
	
		
			
				|  |  | +                    this.onChose()
 | 
	
		
			
				|  |  | +                    this.$emit('refreshDataList')
 | 
	
		
			
				|  |  | +                  }
 | 
	
		
			
				|  |  | +                })
 | 
	
		
			
				|  |  | +              } else {
 | 
	
		
			
				|  |  | +                this.$message.error(data.msg)
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      uploadSuccess (fileList) {
 | 
	
		
			
				|  |  | +        this.fileList = fileList
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<style scoped>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +</style>
 |