| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="报销日期" prop="createTime"> |
| | | <el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="value1" type="daterange" @blur="onpick" |
| | | range-separator="至" start-placeholder="报销开始日期" end-placeholder="报销结束日期" @keyup.enter.native="handleQuery"> |
| | | <el-form-item label="报销日期" prop="applyTime"> |
| | | <el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="value1" type="daterange" |
| | | @change="selecttime" range-separator="至" start-placeholder="报销开始日期" end-placeholder="报销结束日期" |
| | | @keyup.enter.native="handlQuery"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="审核状态" prop="recordstatus"> |
| | | <el-input v-model="queryParams.recordstatus" placeholder="请选择审核状态" clearable size="small" v-if="0" |
| | |
| | | <el-option v-for="dict in dict.type.sys_recordstatus" :key="dict.value" :label="dict.label" |
| | | :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="6"> |
| | | <el-form-item label="捐献者" prop="name"> |
| | | <el-input v-model="queryParams.donorname" placeholder="请输入捐献者姓名" clearable size="small" |
| | | @keyup.enter.native="handleQuery" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table :row-class-name="rowClassName" v-loading="loading" :data="reimbursementList" @selection-change="handleSelectionChange" > |
| | | <el-table :row-class-name="rowClassName" v-loading="loading" :data="reimbursementList" |
| | | @selection-change="handleSelectionChange"> |
| | | <!-- <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="报销人类别" width="120" align="center" prop="costtype"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_travelexpensebelong" :value="scope.row.costtype" /> |
| | | </template> |
| | | </el-table-column>--> |
| | | <el-table-column label="申请时间" width="150" align="center" prop="createTime"> |
| | | </el-table-column>--> |
| | | <el-table-column label="申请时间" width="120" align="center" prop="applyTime"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span> |
| | | <span>{{ parseTime(scope.row.applyTime, "{y}-{m}-{d}") }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="审核状态" align="center" prop="recordstatus" width="160"> |
| | | <el-table-column label="审核状态" align="center" prop="recordstatus" width="140"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_recordstatus" :value="scope.row.recordstatus" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="经办人" width="150" align="center" prop="username" /> |
| | | <el-table-column label="材料预审状态" width="140" align="center" prop="checkstatus"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_stage_type" :value="scope.row.checkstatus" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="经办人" width="100" align="center" prop="username" /> |
| | | <!-- |
| | | <el-table-column label="出差人" width="180" align="center" prop="travelers"> |
| | | </el-table-column>--> |
| | | <el-table-column label="报销金额" width="150" align="center" prop="amountrequested"> |
| | | <el-table-column label="报销金额" width="120" align="center" prop="amountrequested"> |
| | | </el-table-column> |
| | | <el-table-column label="所属组别" width="150" align="center" prop="deptmentname" /> |
| | | <el-table-column label="组长" width="150" align="center" prop="managername" /> |
| | | <el-table-column label="所属组别" width="120" align="center" prop="deptmentname" /> |
| | | <el-table-column label="组长" width="100" align="center" prop="managername" /> |
| | | <el-table-column label="出差事由" align="center" prop="reason" /> |
| | | <!-- <el-table-column label="联系电话" width="120" align="center" prop="phone"> |
| | | </el-table-column> |
| | |
| | | </el-table-column> |
| | | <el-table-column label="报销合计" align="center" prop="financechecher"/>--> |
| | | <!-- <el-table-column label="财务审核" width="120" align="center" prop="financechecher" /> --> |
| | | <el-table-column label="捐献者" width="150" align="center" prop="donorname" /> |
| | | <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width"> |
| | | <el-table-column label="捐献者" width="100" align="center" prop="donorname" /> |
| | | <el-table-column label="操作" align="center" fixed="right" width="300" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1" size="mini" type="text" |
| | | icon="el-icon-upload2" @click="handleup(scope.row)">上报</el-button> |
| | | <el-button v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1" size="mini" type="text" |
| | | icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button> |
| | | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleDetail(scope.row)">查看</el-button> |
| | | <el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)">查看</el-button> |
| | | <!-- v-hasPermi="['project:funddetail:edit']" --> |
| | | <el-button size="mini" type="text" icon="el-icon-download" @click="gettable(scope.row)"> |
| | | 下载 |
| | | </el-button> |
| | | <!-- v-hasPermi="['project:funddetail:edit']" --> |
| | | <el-button v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1" size="mini" type="text" |
| | | icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button> |
| | | @click="handleDelete(scope.row)"><span class="button-delete"><i |
| | | class="el-icon-delete"></i>删除</span></el-button> |
| | | <!-- v-hasPermi="['project:funddetail:remove']" --> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" align="center" width="120" label="功能" v-if="false"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" v-if="scope.row.uploadStates == 1">线下已报销</el-button> |
| | | <el-button size="mini" type="success" v-else-if="scope.row.uploadStates == 0" |
| | | @click="Dooffline('1', scope.row)">线下报销</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | @close="reset"> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
| | | <el-row><el-col :span="5"> |
| | | <el-form-item label="申请日期" prop="createTime"> |
| | | <el-date-picker style="width: 100%" v-model="form.createTime" type="date" value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="申请日期"> |
| | | <el-form-item label="申请日期" prop="applyTime"> |
| | | <el-date-picker style="width: 100%" v-model="form.applyTime" type="date" format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd" placeholder="申请日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | ); |
| | | } |
| | | } |
| | | }" clearable size="small" style="width: 100%" v-model="scope.row.starttime" type="date" |
| | | value-format="yyyy-MM-dd HH:mm:ss" placeholder="开始日期" @blur="getdays(scope.row)"> |
| | | }" clearable size="small" style="width: 100%" v-model="scope.row.starttime" type="date" format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd" placeholder="开始日期" @blur="getdays(scope.row)"> |
| | | </el-date-picker> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | ); |
| | | } |
| | | } |
| | | }" clearable size="small" style="width: 100%" v-model="scope.row.endtime" type="date" |
| | | value-format="yyyy-MM-dd HH:mm:ss" placeholder="结束日期" @blur="getdays(scope.row)"> |
| | | }" clearable size="small" style="width: 100%" v-model="scope.row.endtime" type="date" format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd" placeholder="结束日期" @blur="getdays(scope.row)"> |
| | | </el-date-picker> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="trafficexpense" label="交通费" align="center" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.trafficexpense" placeholder="交通费" @blur="val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | <el-input v-model="scope.row.trafficexpense" placeholder="交通费" @blur=" |
| | | val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- |
| | |
| | | --> |
| | | <el-table-column prop="hotelexpense" label="住宿费" align="center" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.hotelexpense" placeholder="住宿费" @blur="val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | <el-input v-model="scope.row.hotelexpense" placeholder="住宿费" @blur=" |
| | | val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column prop="foodexpenses" label="餐费报销" align="center" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.foodexpenses" placeholder="伙食费报销" @blur="val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | <el-input v-model="scope.row.foodexpenses" placeholder="伙食费报销" @blur=" |
| | | val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="foodallowance" label="伙食补助" align="center" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.foodallowance" placeholder="伙食费补助" @blur="val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | <el-input v-model="scope.row.foodallowance" placeholder="伙食费补助" @blur=" |
| | | val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="otherexpense" label="公杂费补助" align="center" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.otherexpense" placeholder="杂费" @blur="val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | <el-input v-model="scope.row.otherexpense" placeholder="杂费" @blur=" |
| | | val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column prop="otherfeeamount" label="其他费用" align="center" width="90"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.otherfeeamount" placeholder="其他费用" @blur="val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | <el-input v-model="scope.row.otherfeeamount" placeholder="其他费用" @blur=" |
| | | val => { |
| | | sumRowFee(scope.row); |
| | | } |
| | | " /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="departure" slot="" label="其他费用说明" align="center" width="120"> |
| | |
| | | </template> </el-table-column><el-table-column prop="paiddate" slot="" label="打款日期" fixed align="center" |
| | | width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.paiddate" type="date" |
| | | value-format="yyyy-MM-dd HH:mm:ss" placeholder="打款日期" :disabled="true"> |
| | | <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.paiddate" type="date" format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd" placeholder="打款日期" :disabled="true"> |
| | | </el-date-picker> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <!-- <file-upload ref="fileUpload" :fileType=fileType :limit="1" :on-success="handleUploadSuccess"></file-upload> --> |
| | | <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileList" multiple |
| | | :limit="20" :headers="headers" :on-success="(response, file, fileList) => |
| | | uploadSccess(response, file, fileList) |
| | | uploadSccess(response, file, fileList) |
| | | " :on-preview="downFile" :disabled="dialogType == 'detail'" :on-error="handleUploadError" |
| | | :on-exceed="handleExceed" :on-remove="remove" accept="image/*,.pdf"> |
| | | <el-button :disabled="dialogType == 'detail'" size="small" type="primary">上传</el-button> |
| | |
| | | </el-row> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm" v-if="dialogType == 'edit'">保 存</el-button> |
| | | <el-button type="primary" :loading="saveLoading" @click="submitForm" v-if="dialogType == 'edit'">保 存</el-button> |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | |
| | | import { getUser, getUserProfile } from "@/api/system/user"; |
| | | import { treeselect } from "@/api/system/dept"; |
| | | import { getSubsidy } from "@/api/project/travelcity"; |
| | | import { addorupdateFund } from "@/api/project/fund"; |
| | | import { listReportname, listUser } from "@/api/project/organization"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyAdd } from "@/utils/money"; |
| | | export default { |
| | | components: { |
| | | Treeselect, |
| | |
| | | "sys_recordstatus", |
| | | "sys_travelexpensebelong", |
| | | "sys_traffictype", |
| | | "sys_area_name" |
| | | "sys_area_name", |
| | | "sys_stage_type" |
| | | ], |
| | | data() { |
| | | return { |
| | |
| | | loading: true, |
| | | // 导出遮罩层 |
| | | exportLoading: false, |
| | | // 保存按钮 loading,防止重复提交 |
| | | saveLoading: false, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非单个禁用 |
| | |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | itemname: null, |
| | | itemtype: null, |
| | | costtype: null, |
| | | donorname: null, |
| | | starttime: null, |
| | | remark: null, |
| | | departure: null, |
| | | endtime: null, |
| | | destination: null, |
| | | uploadFlag: null, |
| | | uploadTime: null, |
| | | // orderByColumn: "createTime", |
| | | orderByColumn: "id", |
| | | isAsc: "desc" |
| | | }, |
| | | queryParams2: { |
| | |
| | | }, |
| | | |
| | | methods: { |
| | | |
| | | |
| | | handleUploadError() { }, |
| | | |
| | | remove(file) { |
| | |
| | | |
| | | handleExceed() { |
| | | this.$message.error(`上传文件数量不能超过 ${5} 个!`); |
| | | }, |
| | | Dooffline(a, value) { |
| | | value.uploadStates = 1; |
| | | value.notes = "线下已报销"; |
| | | addorupdateFund(value).then(res => { |
| | | if (res.code == 200) { |
| | | this.$modal.msgSuccess("记录成功"); |
| | | } else { |
| | | this.$modal.msgError(res.msg); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //文件上传成功回调 |
| | |
| | | this.$modal.msgSuccess(response.msg); |
| | | this.fileList.push({ name: response.fileName, url: response.fileName }); |
| | | } else { |
| | | console.log(response.msg);; |
| | | console.log(response.msg); |
| | | } |
| | | }, |
| | | |
| | |
| | | if (tempStr == "杭州") { |
| | | row.otherexpense = ""; |
| | | } else if ( |
| | | tempStr == "杭州-桐庐" || |
| | | tempStr == "杭州-建德" || |
| | | tempStr == "杭州-淳安" |
| | | tempStr.includes("桐庐") || |
| | | tempStr.includes("建德") || |
| | | tempStr.includes("淳安") |
| | | ) { |
| | | row.otherexpense = (parseInt(row.days) * 60).toString(); |
| | | } else { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | onpick(e) { |
| | | // console.log(e,this.value1) |
| | | }, |
| | | |
| | | |
| | | gettable(e) { |
| | | const id = e.id; |
| | | getdownload(e.id).then(res => { |
| | |
| | | var aEle = document.createElement("a"); |
| | | aEle.href = |
| | | curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"]; |
| | | aEle.click(); |
| | | console.log(aEle.href); |
| | | // 添加Authorization头部 |
| | | fetch(aEle.href, { |
| | | headers: this.headers |
| | | }) |
| | | .then(response => { |
| | | // 将文件下载链接作为blob对象进行下载 |
| | | return response.blob(); |
| | | }) |
| | | .then(blob => { |
| | | const url = window.URL.createObjectURL(new Blob([blob])); |
| | | console.log(url); |
| | | const link = document.createElement("a"); |
| | | link.href = url; |
| | | const name = fileUrl["downloadName"]; |
| | | link.setAttribute("download", name); // 替换file.pdf为实际的文件名 |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | link.parentNode.removeChild(link); |
| | | }); |
| | | }); |
| | | |
| | | // downloadconfirmationinfo(id).then((response) => { |
| | | // var fileUrl = response; |
| | | // //获取当前网址 |
| | | // var urlBase = process.env.VUE_APP_BASE_API; |
| | | // var curWWWPath = window.document.location.href; |
| | | // var pos = curWWWPath.indexOf(window.document.location.pathname); |
| | | // // 创建a标签 |
| | | // var aEle = document.createElement("a"); |
| | | // aEle.href = |
| | | // curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"]; |
| | | // aEle.click(); |
| | | // }); |
| | | }, |
| | | |
| | | /** 查询报销申请列表 */ |
| | |
| | | |
| | | //获取报销主信息 |
| | | const id = row.id || this.ids; |
| | | getReimbursement(id).then(response => { |
| | | this.form = response.data; |
| | | this.fileList = this.form.annexfiles |
| | | ? this.form.annexfiles |
| | | .split(",") |
| | | .map(item => ({ url: item, name: item })) |
| | | : []; |
| | | this.form.recordstatus = response.data.recordstatus + ""; |
| | | getReimbursement(id) |
| | | .then(async response => { |
| | | this.form = response.data; |
| | | this.fileList = this.form.annexfiles |
| | | ? this.form.annexfiles |
| | | .split(",") |
| | | .map(item => ({ url: item, name: item })) |
| | | : []; |
| | | this.form.recordstatus = response.data.recordstatus + ""; |
| | | |
| | | let ids = response.data.id; |
| | | //获取报销明细信息 |
| | | getReimbursementdetaillist(ids).then(res => { |
| | | this.rbDetails = res.data; |
| | | const ids = response.data.id; |
| | | this.queryParamsPayee.rbid = ids; |
| | | |
| | | //明细与打款信息互不依赖,并发获取,减少等待时间 |
| | | const [detailRes, payeeRes] = await Promise.all([ |
| | | getReimbursementdetaillist(ids), |
| | | listReimbursementpayee(this.queryParamsPayee) |
| | | ]); |
| | | |
| | | this.rbDetails = detailRes.data; |
| | | if (this.rbDetails.length == 0) { |
| | | this.addDetailRow(0); |
| | | } |
| | |
| | | |
| | | //实时合计金额 |
| | | //this.sumTotalFee(); |
| | | }); |
| | | |
| | | //获取报销打款信息 |
| | | this.queryParamsPayee.rbid = ids; |
| | | listReimbursementpayee(this.queryParamsPayee).then(res => { |
| | | this.rbPayees = res.rows; |
| | | this.rbPayees = payeeRes.rows; |
| | | if (this.rbPayees.length == 0) { |
| | | this.addPayeeRow(0); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | this.$modal.msgError("报销单信息加载失败,请重试!"); |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | /** 查看按钮操作 */ |
| | |
| | | this.open = true; |
| | | const id = row.id || this.ids; |
| | | |
| | | getReimbursement(id).then(response => { |
| | | this.form = response.data; |
| | | //附件 |
| | | this.fileList = this.form.annexfiles |
| | | ? this.form.annexfiles |
| | | .split(",") |
| | | .map(item => ({ url: item, name: item })) |
| | | : []; |
| | | getReimbursement(id) |
| | | .then(async response => { |
| | | this.form = response.data; |
| | | //附件 |
| | | this.fileList = this.form.annexfiles |
| | | ? this.form.annexfiles |
| | | .split(",") |
| | | .map(item => ({ url: item, name: item })) |
| | | : []; |
| | | |
| | | //审核状态 |
| | | this.form.recordstatus = response.data.recordstatus + ""; |
| | | //审核状态 |
| | | this.form.recordstatus = response.data.recordstatus + ""; |
| | | |
| | | let ids = response.data.id; |
| | | let listFundflowparams = { |
| | | fundid: row.id, |
| | | fundtype: 1 |
| | | }; |
| | | listFundflow(listFundflowparams).then(res => { |
| | | this.fundflowList = res.rows; |
| | | }); |
| | | const ids = response.data.id; |
| | | const listFundflowparams = { |
| | | fundid: row.id, |
| | | fundtype: 1 |
| | | }; |
| | | this.queryParamsPayee.rbid = ids; |
| | | |
| | | //报销明细 |
| | | getReimbursementdetaillist(ids).then(res => { |
| | | this.rbDetails = res.data; |
| | | /* |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | this.rbDetails[i].index = i; |
| | | this.rbDetails[i].searchAddress = { |
| | | sheng: this.rbDetails[i].travelprovincename, |
| | | shi: this.rbDetails[i].travelcityname, |
| | | qu: this.rbDetails[i].traveltownname, |
| | | }; |
| | | } |
| | | */ |
| | | }); |
| | | //资金流水、报销明细、打款信息互不依赖,并发获取 |
| | | const [fundflowRes, detailRes, payeeRes] = await Promise.all([ |
| | | listFundflow(listFundflowparams), |
| | | getReimbursementdetaillist(ids), |
| | | listReimbursementpayee(this.queryParamsPayee) |
| | | ]); |
| | | |
| | | if (this.rbDetails.length > 0) this.sumTotalFee(); |
| | | this.fundflowList = fundflowRes.rows; |
| | | this.rbDetails = detailRes.data; |
| | | |
| | | //付款信息 |
| | | this.queryParamsPayee.rbid = ids; |
| | | listReimbursementpayee(this.queryParamsPayee).then(res => { |
| | | this.rbPayees = res.rows; |
| | | //明细加载完成后再计算合计,修复原代码在明细返回前就 sumTotalFee 的竞态问题 |
| | | if (this.rbDetails.length > 0) this.sumTotalFee(); |
| | | |
| | | //付款信息 |
| | | this.rbPayees = payeeRes.rows; |
| | | if (this.rbPayees.length == 0) { |
| | | this.addPayeeRow(0); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | this.$modal.msgError("报销单信息加载失败,请重试!"); |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | /** 提交按钮 */ |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | //防止重复提交:保存中直接忽略再次点击 |
| | | if (this.saveLoading) return; |
| | | this.$refs["form"].validate(async valid => { |
| | | if (!valid) return; |
| | | /** |
| | | let indexErrTime = this.rbDetails.findIndex((item) => { |
| | | if (item.endtime && item.starttime) { |
| | |
| | | } |
| | | */ |
| | | |
| | | try { |
| | | this.saveLoading = true; |
| | | //附件文件处理 |
| | | let list = this.fileList; |
| | | if (list.length > 0) { |
| | |
| | | const rbDetails = [...this.rbDetails]; |
| | | const rbPayees = [...this.rbPayees]; |
| | | if (this.form.id != null) { |
| | | updateReimbursement(this.form) |
| | | .then(res => { |
| | | //保存明细 |
| | | for (let i = 0; i < rbDetails.length; i++) { |
| | | if (rbDetails[i].rbid != null) { |
| | | updateReimbursementdetail(rbDetails[i]); |
| | | } else { |
| | | //rbid关联主表Id |
| | | rbDetails[i].rbid = this.form.id; |
| | | addReimbursementdetail(rbDetails[i]); |
| | | } |
| | | } |
| | | //第1步:更新主表,成功后再处理子表 |
| | | await updateReimbursement(this.form); |
| | | |
| | | //保存账户 |
| | | for (let i = 0; i < rbPayees.length; i++) { |
| | | if (rbPayees[i].rbid != null) { |
| | | updateReimbursementpayee(rbPayees[i]); |
| | | } else { |
| | | //rbid关联主表Id |
| | | rbPayees[i].rbid = this.form.id; |
| | | addReimbursementpayee(rbPayees[i]); |
| | | } |
| | | //第2步:并发保存明细,等待全部完成,任一失败则走 catch 提示 |
| | | await Promise.all( |
| | | rbDetails.map(detail => { |
| | | if (detail.rbid != null) { |
| | | return updateReimbursementdetail(detail); |
| | | } |
| | | |
| | | this.$modal.msgSuccess("修改报销单保存成功!"); |
| | | this.open = false; |
| | | this.getList(); |
| | | //rbid关联主表Id |
| | | detail.rbid = this.form.id; |
| | | return addReimbursementdetail(detail); |
| | | }) |
| | | .catch(err => { |
| | | this.$modal.msgError("修改报销单保存失败!"); |
| | | }); |
| | | ); |
| | | |
| | | //第3步:并发保存账户 |
| | | await Promise.all( |
| | | rbPayees.map(payee => { |
| | | if (payee.rbid != null) { |
| | | return updateReimbursementpayee(payee); |
| | | } |
| | | //rbid关联主表Id |
| | | payee.rbid = this.form.id; |
| | | return addReimbursementpayee(payee); |
| | | }) |
| | | ); |
| | | |
| | | this.$modal.msgSuccess("修改报销单保存成功!"); |
| | | } else { |
| | | this.form.recordstatus = -1; |
| | | addReimbursement(this.form) |
| | | .then(response => { |
| | | //保存明细 |
| | | for (let i = 0; i < rbDetails.length; i++) { |
| | | //rbid关联主表Id |
| | | rbDetails[i].rbid = response.data; |
| | | addReimbursementdetail(rbDetails[i]); |
| | | } |
| | | //第1步:新增主表,返回主表Id |
| | | const response = await addReimbursement(this.form); |
| | | |
| | | //保存账号 |
| | | for (let i = 0; i < rbPayees.length; i++) { |
| | | //rbid关联主表Id |
| | | rbPayees[i].rbid = response.data; |
| | | addReimbursementpayee(rbPayees[i]); |
| | | } |
| | | |
| | | this.$modal.msgSuccess("新增报销单保存成功!"); |
| | | this.open = false; |
| | | this.getList(); |
| | | //第2步:并发保存明细 |
| | | await Promise.all( |
| | | rbDetails.map(detail => { |
| | | //rbid关联主表Id |
| | | detail.rbid = response.data; |
| | | return addReimbursementdetail(detail); |
| | | }) |
| | | .catch(err => { |
| | | this.$modal.msgError("新增报销单保存失败!"); |
| | | }); |
| | | ); |
| | | |
| | | //第3步:并发保存账号 |
| | | await Promise.all( |
| | | rbPayees.map(payee => { |
| | | //rbid关联主表Id |
| | | payee.rbid = response.data; |
| | | return addReimbursementpayee(payee); |
| | | }) |
| | | ); |
| | | |
| | | this.$modal.msgSuccess("新增报销单保存成功!"); |
| | | } |
| | | |
| | | //所有保存步骤全部成功后才关闭弹窗并刷新列表 |
| | | this.open = false; |
| | | this.getList(); |
| | | } catch (err) { |
| | | this.$modal.msgError("报销单保存失败,请重试!"); |
| | | } finally { |
| | | this.saveLoading = false; |
| | | } |
| | | } |
| | | }); |
| | | ); |
| | | }, |
| | | |
| | | /** 删除按钮操作 */ |
| | |
| | | return delReimbursement(ids); |
| | | }) |
| | | .then(() => { |
| | | delReimbursementdetail(ids); |
| | | //等待明细删除完成后再刷新列表,避免列表刷新时明细尚未删除 |
| | | return delReimbursementdetail(ids); |
| | | }) |
| | | .then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | }) |
| | |
| | | this.$download.name(response.msg); |
| | | this.exportLoading = false; |
| | | }) |
| | | .catch(() => { }); |
| | | .catch(() => { |
| | | //失败时也要复位 loading,否则按钮永久转圈 |
| | | this.exportLoading = false; |
| | | }); |
| | | }, |
| | | |
| | | //新增一行 |
| | |
| | | }, |
| | | |
| | | //计算一行合计 |
| | | //计算当前行报销内容费用合计 |
| | | //计算当前行报销内容费用合计(金额一律走精确运算) |
| | | sumRowFee(row) { |
| | | let totalFee = 0; |
| | | if (!isNaN(parseFloat(row.trafficexpense))) { |
| | | totalFee += parseFloat(row.trafficexpense); |
| | | } |
| | | if (!isNaN(parseFloat(row.cityfee))) { |
| | | totalFee += parseFloat(row.cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(row.hotelexpense))) { |
| | | totalFee += parseFloat(row.hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(row.otherexpense))) { |
| | | totalFee += parseFloat(row.otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(row.foodexpenses))) { |
| | | totalFee += parseFloat(row.foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(row.foodallowance))) { |
| | | totalFee += parseFloat(row.foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(row.otherfeeamount))) { |
| | | totalFee += parseFloat(row.otherfeeamount); |
| | | } |
| | | row.total = totalFee; |
| | | row.total = moneySum([ |
| | | row.trafficexpense, |
| | | row.cityfee, |
| | | row.hotelexpense, |
| | | row.otherexpense, |
| | | row.foodexpenses, |
| | | row.foodallowance, |
| | | row.otherfeeamount |
| | | ]); |
| | | |
| | | /* |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].trafficexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].trafficexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].cityfee))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].hotelexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodexpenses))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodallowance))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherfeeamount))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].otherfeeamount); |
| | | } |
| | | this.rbDetails[rowIndex].total = parseFloat(totalFee).toFixed(2); |
| | | this.$set(this.rbDetails, rowIndex, this.rbDetails[rowIndex]); |
| | | */ |
| | | //重新计算整个报销单的合计 |
| | | this.sumTotalFee(); |
| | | }, |
| | | |
| | | //计算费用合计 |
| | | sumTotalFee() { |
| | | let allSum = 0; |
| | | |
| | | //捐献者家属费用 |
| | | if (!isNaN(parseFloat(this.form.donoramount))) { |
| | | allSum += parseFloat(this.form.donoramount); |
| | | } |
| | | |
| | | //报销明细费用 |
| | | try { |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | /* |
| | | let totalFee = 0; |
| | | //计算当前报销内容费用合计 |
| | | if (!isNaN(parseFloat(this.rbDetails[i].total))) { |
| | | totalFee += parseFloat(this.rbDetails[i].total); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].cityfee))) { |
| | | totalFee += parseFloat(this.rbDetails[i].cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].hotelexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[i].hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].otherexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[i].otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].foodexpenses))) { |
| | | totalFee += parseFloat(this.rbDetails[i].foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].foodallowance))) { |
| | | totalFee += parseFloat(this.rbDetails[i].foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].otherfeeamount))) { |
| | | totalFee += parseFloat(this.rbDetails[i].otherfeeamount); |
| | | } |
| | | this.rbDetails[i].total = parseFloat(totalFee).toFixed(2); |
| | | this.$set(this.rbDetails, i, this.rbDetails[i]); |
| | | */ |
| | | |
| | | if (!isNaN(parseFloat(this.rbDetails[i].total))) { |
| | | allSum += parseFloat(this.rbDetails[i].total); |
| | | } |
| | | } |
| | | |
| | | this.form.amountrequested = allSum.toFixed(2); |
| | | this.form.amountrequested = moneyAdd( |
| | | moneySum(this.rbDetails, "total"), |
| | | this.form.donoramount |
| | | ).toFixed(2); |
| | | this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested); |
| | | } catch { } |
| | | }, |
| | |
| | | //明显提示审批退回记录 |
| | | rowClassName({ row, column, rowIndex, columnIndex }) { |
| | | //此判断为最后三行 |
| | | if (row.backflowlevel==199) { |
| | | return "addClassva"; |
| | | if (row.recordstatus == -1 && row.backflowlevel != null) { |
| | | return "error-row"; |
| | | } |
| | | }, |
| | | |
| | | return ""; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <!-- <style scoped> --> |
| | | <!-- 不可加scoped,会独立样式element访问不到 --> |
| | | <style> |
| | | <style lang="scss" scoped> |
| | | .addClassva { |
| | | /* background: #10aec2; */ |
| | | background:#10aec2!important; |
| | | background: #e8f4ff !important; |
| | | /* color:whitesmoke; */ |
| | | } |
| | | |
| | | .button-delete { |
| | | color: rgb(236, 69, 69); |
| | | } |
| | | |
| | | ::v-deep.el-table .error-row { |
| | | background: #fcebeb; |
| | | } |
| | | </style> |