|
@@ -0,0 +1,252 @@
|
|
|
|
+<template>
|
|
|
|
+ <el-dialog
|
|
|
|
+ :title="title"
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
+ v-dialogDrag
|
|
|
|
+ :visible.sync="visible">
|
|
|
|
+ <el-form size="small" :model="inputForm" ref="inputForm" @keyup.enter.native="doSubmit()"
|
|
|
|
+ label-width="120px" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="method==='view'" @submit.native.prevent>
|
|
|
|
+
|
|
|
|
+ <el-row :gutter="15">
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item prop="userId" :rules=" [{required: true, message: '人员不能为空', trigger: 'blur'}]" label="人员">
|
|
|
|
+ <SelectUserTree
|
|
|
|
+ ref="companyTree"
|
|
|
|
+ :props="{
|
|
|
|
+ value: 'id', // ID字段名
|
|
|
|
+ label: 'name', // 显示名称
|
|
|
|
+ children: 'children' // 子级字段名
|
|
|
|
+ }"
|
|
|
|
+ :url="`/sys/user/treeUserData?type=2`"
|
|
|
|
+ :value="inputForm.userId"
|
|
|
|
+ :clearable="true"
|
|
|
|
+ :accordion="true"
|
|
|
|
+ :disabled="method==='edit'"
|
|
|
|
+ @getValue="(value) => {inputForm.userId=value}"/>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="年份" prop="year" :rules="[{required: true, message: '年份不能为空', trigger: 'blur'}]">
|
|
|
|
+ <el-select v-model="inputForm.year" @change="selectYear(inputForm.year)" style="width:100%" placeholder="请选择">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="year in yearList"
|
|
|
|
+ :key="year.id"
|
|
|
|
+ :label="year.year"
|
|
|
|
+ :value="year.year">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="报销天数" prop="reimbursementDay" :rules="[{required: true, max: 10, message:'报销天数不能为空且只可为整数', trigger:'blur'}]">
|
|
|
|
+ <el-input v-model="inputForm.reimbursementDay" class="bg-grey" size="small" placeholder="报销天数" style="width: 100%;" @keyup.native="inputForm.reimbursementDay = checkInputs(inputForm.reimbursementDay)"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="报销金额" prop="reimbursementAmount":rules="[{max: 10,trigger:'blur'}]">
|
|
|
|
+ <el-input v-model="inputForm.reimbursementAmount" class="bg-grey" size="small" placeholder="报销金额" style="width: 100%;" :disabled="true">
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="日报销额度" prop="reimbursementQuotaDay":rules="[{max: 10,trigger:'blur'}]">
|
|
|
|
+ <el-input v-model="inputForm.reimbursementQuotaDay" class="bg-grey" size="small" placeholder="日报销额度" style="width: 100%;" :disabled="true">
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="年报销额度" prop="reimbursementQuota":rules="[{max: 10,trigger:'blur'}]">
|
|
|
|
+ <el-input v-model="inputForm.reimbursementQuota" class="bg-grey" size="small" placeholder="年报销额度" style="width: 100%;" :disabled="true">
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="剩余可报额度" prop="remainReimbursementAmount" :rules="[{max: 10, trigger:'blur'}]">
|
|
|
|
+ <el-input v-model="inputForm.remainReimbursementAmount" class="bg-grey" size="small" placeholder="剩余可报额度" style="width: 100%;" :disabled="true">
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="业务可报额度" prop="canReimbursementAmount" :rules="[{max: 10, trigger:'blur'}]">
|
|
|
|
+ <el-input v-model="inputForm.canReimbursementAmount" class="bg-grey" size="small" placeholder="业务可报额度" style="width: 100%;" :disabled="true">
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="业务剩余可报额度" prop="surplusReimbursementAmount" :rules="[{max: 10, trigger:'blur'}]">
|
|
|
|
+ <el-input v-model="inputForm.surplusReimbursementAmount" class="bg-grey" size="small" placeholder="业务剩余可报额度" style="width: 100%;" :disabled="true">
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button size="small" @click="visible = false" 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>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+ import SelectUserTree from './treeReimbursementBuinessUserSelect'
|
|
|
|
+ import ReimbursementBusiness from '@/api/reimbursementSys/reimbursementBusinessService'
|
|
|
|
+ export default {
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ visible: false,
|
|
|
|
+ loading: false,
|
|
|
|
+ title: '',
|
|
|
|
+ method: '',
|
|
|
|
+ yearList: [],
|
|
|
|
+ inputForm: {
|
|
|
|
+ id: '',
|
|
|
|
+ userId: '', // 人员id
|
|
|
|
+ year: '', // 年份
|
|
|
|
+ reimbursementQuota: '', // 年报销额度
|
|
|
|
+ reimbursementAmount: '', // 报销金额
|
|
|
|
+ reimbursementQuotaDay: '', // 日报销额度
|
|
|
|
+ canReimbursementAmount: '', // 业务可报销额度
|
|
|
|
+ surplusReimbursementAmount: '', // 业务剩余可报销额度
|
|
|
|
+ reimbursementDay: '' // 报销天数
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ ReimbursementBusiness: null,
|
|
|
|
+ created () {
|
|
|
|
+ this.reimbursementBusiness = new ReimbursementBusiness()
|
|
|
|
+ },
|
|
|
|
+ mounted () {
|
|
|
|
+ },
|
|
|
|
+ components: {
|
|
|
|
+ SelectUserTree
|
|
|
|
+ },
|
|
|
|
+ provide () {
|
|
|
|
+ return {
|
|
|
|
+ say: this.say
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ checkInputs: function (num) {
|
|
|
|
+ console.log(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 no-useless-escape
|
|
|
|
+ str = str.replace(/[^\d^]+/g, '') // 保留数字
|
|
|
|
+ // 获取日报销额度
|
|
|
|
+ let reimbursementQuotaDayNumber = this.inputForm.reimbursementQuotaDay
|
|
|
|
+ if (reimbursementQuotaDayNumber) {
|
|
|
|
+ this.inputForm.reimbursementAmount = (str * reimbursementQuotaDayNumber).toString()
|
|
|
|
+ }
|
|
|
|
+ return str
|
|
|
|
+ },
|
|
|
|
+ say (userId) {
|
|
|
|
+ // 根据用户id查询年份信息
|
|
|
|
+ this.reimbursementBusiness.yearList({userId: userId, current: 1, size: -1}).then(({data}) => {
|
|
|
|
+ this.yearList = data.records
|
|
|
|
+ if (this.yearList.length > 0) {
|
|
|
|
+ this.inputForm.year = this.yearList[0].year
|
|
|
|
+ this.inputForm.reimbursementQuotaDay = this.yearList[0].reimbursementQuotaDay
|
|
|
|
+ this.inputForm.reimbursementQuota = this.yearList[0].reimbursementQuota
|
|
|
|
+ this.inputForm.remainReimbursementAmount = this.yearList[0].remainReimbursementAmount
|
|
|
|
+
|
|
|
|
+ // 获取日报销额度
|
|
|
|
+ let reimbursementQuotaDayNumber = this.inputForm.reimbursementQuotaDay
|
|
|
|
+ let reimbursementDayNumber = this.inputForm.reimbursementDay
|
|
|
|
+ if (reimbursementQuotaDayNumber && reimbursementDayNumber) {
|
|
|
|
+ this.inputForm.reimbursementAmount = (reimbursementDayNumber * reimbursementQuotaDayNumber).toString()
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.inputForm.year = ''
|
|
|
|
+ this.inputForm.reimbursementQuotaDay = ''
|
|
|
|
+ this.inputForm.reimbursementQuota = ''
|
|
|
|
+ this.inputForm.remainReimbursementAmount = ''
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ selectYear (year) {
|
|
|
|
+ for (var yearKey in this.yearList) {
|
|
|
|
+ if (this.yearList[yearKey].year === year) {
|
|
|
|
+ this.inputForm.reimbursementQuotaDay = this.yearList[yearKey].reimbursementQuotaDay
|
|
|
|
+ this.inputForm.reimbursementQuota = this.yearList[yearKey].reimbursementQuota
|
|
|
|
+ this.inputForm.remainReimbursementAmount = this.yearList[yearKey].remainReimbursementAmount
|
|
|
|
+
|
|
|
|
+ // 获取日报销额度
|
|
|
|
+ let reimbursementQuotaDayNumber = this.inputForm.reimbursementQuotaDay
|
|
|
|
+ let reimbursementDayNumber = this.inputForm.reimbursementDay
|
|
|
|
+ if (reimbursementQuotaDayNumber && reimbursementDayNumber) {
|
|
|
|
+ this.inputForm.reimbursementAmount = (reimbursementDayNumber * reimbursementQuotaDayNumber).toString()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ init (method, obj) {
|
|
|
|
+ this.method = method
|
|
|
|
+ this.inputForm.businessCodeId = obj.businessCodeId
|
|
|
|
+ this.inputForm.businessCode = obj.businessCode
|
|
|
|
+ if (method === 'addBusinessInfo') {
|
|
|
|
+ this.title = `新建报销信息`
|
|
|
|
+ } else if (method === 'edit') {
|
|
|
|
+ this.title = '修改人员信息'
|
|
|
|
+ } else if (method === 'view') {
|
|
|
|
+ this.title = '查看人员信息'
|
|
|
|
+ }
|
|
|
|
+ this.visible = true
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.inputForm.id = obj.id
|
|
|
|
+ this.$refs['inputForm'].resetFields()
|
|
|
|
+ if (method === 'edit' || method === 'view') { // 修改或者查看
|
|
|
|
+ this.inputForm.id = obj
|
|
|
|
+ this.loading = true
|
|
|
|
+ this.reimbursementBusiness.queryById(this.inputForm.id).then(({data}) => {
|
|
|
|
+ this.inputForm = this.recover(this.inputForm, data)
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (method === 'addBusinessInfo') { // 修改或者查看
|
|
|
|
+ this.inputForm.businessCodeId = obj.businessCodeId
|
|
|
|
+ this.loading = true
|
|
|
|
+ this.reimbursementBusiness.getBusinessById(this.inputForm.businessCodeId).then(({data}) => {
|
|
|
|
+ this.inputForm = this.recover(this.inputForm, data)
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 表单提交
|
|
|
|
+ doSubmit () {
|
|
|
|
+ this.$refs['inputForm'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.loading = true
|
|
|
|
+ this.reimbursementBusiness.save(this.inputForm).then(({data}) => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ this.visible = false
|
|
|
|
+ this.$message.success(data)
|
|
|
|
+ this.$emit('refreshDataList')
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</script>
|