|
|
|
@ -5,14 +5,19 @@
|
|
|
|
|
<div class="section"> <span class="line"> </span> 基本信息</div>
|
|
|
|
|
<div class="trips-box">
|
|
|
|
|
<div class="item-box">
|
|
|
|
|
<van-field v-model="form.claimNo" v-if="form.vendorReceiptNo" disabled label="单号" clear-trigger="always" input-align="right" />
|
|
|
|
|
<van-field v-model="form.vendorReceiptNo" v-if="form.vendorReceiptNo" disabled label="单号" clear-trigger="always" input-align="right" />
|
|
|
|
|
<van-field v-model="cn" disabled label="公司名称" clear-trigger="always" input-align="right" />
|
|
|
|
|
<van-field v-model="form.projectName" :disabled="disabled" label="项目名称" clear-trigger="always" placeholder="请输入" input-align="right" />
|
|
|
|
|
<van-field v-model="userInfo.nickname" disabled label="申请人" clear-trigger="always" input-align="right" maxlength="50" placeholder="请输入" />
|
|
|
|
|
<van-field v-model="userInfo.dept.name" disabled label="申请部门" clear-trigger="always" input-align="right" maxlength="50" placeholder="请输入" />
|
|
|
|
|
<RePick v-model="form.accountType" :disabled="disabled" label="账户类型" name="accountType" :list="accountList" title="账户类型" titleKey="label" idKey="value" isCell clearable />
|
|
|
|
|
<RePick v-model="form.currency" :disabled="disabled" label="收取币种" name="currency" :list="moneyList" title="收取币种" titleKey="label" idKey="value" isCell clearable />
|
|
|
|
|
<van-field v-model="form.amount" type="number" name="amount" placeholder="请输入" input-align="right" required :rules="[{ required: true, message: '格式错误',validator: VerifyFunc.validatorMoney }]" label="收款金额" />
|
|
|
|
|
<RePick v-model="form.vendorIds" :disabled="disabled" label="关联供应商" name="currency" :list="allGysList" title="关联供应商" isCell clearable />
|
|
|
|
|
<van-field v-model="form.amount" type="number" name="amount" :disabled="disabled" placeholder="请输入" input-align="right" required :rules="[{ required: true, message: '收款金额格式错误',validator: VerifyFunc.validatorMoney }]" label="收款金额" />
|
|
|
|
|
<van-field v-model="form.projectManager" :disabled="disabled" label="项目负责人" placeholder="请输入" clear-trigger="always" input-align="right" />
|
|
|
|
|
<RePick v-model="form.vendorIds" isRequrie :rules="[{ required: true, message: '请选择' }]" required :disabled="disabled" label="关联供应商" name="vendorIds" isShowSearch :list="allGysList" title="关联供应商" :isUseLimitPage="allGysList.length > 300" isCell clearable />
|
|
|
|
|
<RePick v-model="form.receiptBankIds" isRequrie :rules="[{ required: true, message: '请选择' }]" required :disabled="disabled" label="关收款账户" name="currency" isShowSearch :list="allBankList" title="关收款账户" :isUseLimitPage="allBankList.length > 300" isCell clearable />
|
|
|
|
|
<van-field v-model="form.reason" placeholder="请输入" :disabled="disabled" autosize rows="1" type="textarea" label="申请事由" clear-trigger="always" input-align="right" />
|
|
|
|
|
<van-field v-model="form.remark" placeholder="请输入" :disabled="disabled" autosize rows="1" type="textarea" label="备注信息" clear-trigger="always" input-align="right" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section mt5"> <span class="line"> </span>附件</div>
|
|
|
|
@ -23,46 +28,27 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section mt5" v-if="['show'].includes(typeStr)"> <span class="line"> </span>审批流程</div>
|
|
|
|
|
<ApprovalProcess v-if="['show'].includes(typeStr)" :processInstanceId="form.processInstanceId" @onSetId="handleSetAccessId" />
|
|
|
|
|
<!-- 申请单关联 -->
|
|
|
|
|
<div class="section mt5"> <span class="line"> </span>申请单关联</div>
|
|
|
|
|
<RePick v-model="form.expenseApplyIds" isShowSearch :disabled="disabled" inputAlign="left" multiple titleKey="title" idKey="id" label="申请单" :name="`expenseApplyIds`" :list="expenseApplyList" isCell clearable />
|
|
|
|
|
<div class="section mt5" v-if="form.budgetAmountInfo"> <span class="line"> </span>预算信息提示</div>
|
|
|
|
|
<div style="color:red;font-size:0.8rem;margin-top:0.5rem" v-if="form.budgetAmountInfo">
|
|
|
|
|
{{form.budgetAmountInfo}}
|
|
|
|
|
</div>
|
|
|
|
|
</van-form>
|
|
|
|
|
</div>
|
|
|
|
|
<BottomBtn ref="BottomBtn" :isAuthorised="isAuthorised" @onBtConfirm="handleBtConfirm" :accessId="accessId" />
|
|
|
|
|
<!--行程时间范围选择 -->
|
|
|
|
|
<van-calendar ref="vanCalendar" allow-same-day :maxDate="maxDate" v-model="dateShow" :min-date="minDate" :default-date="defaultDate" type="range" color="#0088FE" @confirm="handleDateSelect" />
|
|
|
|
|
<!-- 报销规则 -->
|
|
|
|
|
<Rules :dataObj="dialogObj" :typeStr="typeStr" @onCancel="isShow = false" :isOpen="isShow" @onConfirm="(arr)=>{isShow = false}" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
import { createExpenseClaim, findClaimRules, getExpenseClaim, getMyExpenseClaim } from "@/api/bs/expenseClaim";
|
|
|
|
|
import { getInvoicePage } from "@/api/bs/invoice";
|
|
|
|
|
import { listData } from "@/api/system/dict/data";
|
|
|
|
|
import { createVendorReceipt, getVendorReceipt, updateVendorReceipt } from "@/api/bs/vendorReceipt";
|
|
|
|
|
import VerifyFunc from '@/utils/verify'
|
|
|
|
|
import { getTreeIds, findAreaIdName } from '@/utils'
|
|
|
|
|
import { getExpenseApplyMyPage } from "@/api/bs/expenseApply";
|
|
|
|
|
import { Dialog } from 'vant'
|
|
|
|
|
import { getDictDatas, DICT_TYPE } from "@/utils/dict";
|
|
|
|
|
import { getVendorPage } from "@/api/bs/vendor";
|
|
|
|
|
import { getBankAccountInfoPage } from "@/api/bs/bankAccountInfo";
|
|
|
|
|
export default {
|
|
|
|
|
//import引入组件才能使用
|
|
|
|
|
props: {},
|
|
|
|
|
name: 'company-claim',
|
|
|
|
|
name: 'contract-receipts',
|
|
|
|
|
components: {
|
|
|
|
|
BottomBtn: () => import('@/components/BottomBtn'),
|
|
|
|
|
ApprovalProcess: () => import('@/components/ApprovalProcess'),
|
|
|
|
|
RePick: () => import('@/components/ReComponents/RePick'),
|
|
|
|
|
FollowPeoPle: () => import('@/components/FollowPeoPle'),
|
|
|
|
|
ConnectInvoice: () => import('@/components/ConnectInvoice'),
|
|
|
|
|
UploadFile: () => import('@/components/UploadFile'),
|
|
|
|
|
Rules: () => import('./components/Rules'),
|
|
|
|
|
},
|
|
|
|
|
// 生命周期,创建完成时(可以访问当前this实例)
|
|
|
|
|
created() {
|
|
|
|
@ -75,16 +61,11 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
form: {},
|
|
|
|
|
allBankList: [],
|
|
|
|
|
allGysList: [],
|
|
|
|
|
indexOne: 1,
|
|
|
|
|
indexTwo: 1,
|
|
|
|
|
claimType: '',
|
|
|
|
|
expenseApplyList: [],
|
|
|
|
|
isShow: false,
|
|
|
|
|
dialogObj: {},
|
|
|
|
|
isAuthorised: false,
|
|
|
|
|
accessId: null,
|
|
|
|
|
ieList: [], // 发票列表
|
|
|
|
|
VerifyFunc,
|
|
|
|
|
isAuthority: 0,
|
|
|
|
|
typeStr: null, // show: 查看 edit: 编辑: 其他新增
|
|
|
|
@ -95,59 +76,6 @@ export default {
|
|
|
|
|
{ title: '同意', icon: 'certificate', color: "#19be6b", key: 2 },
|
|
|
|
|
{ title: '驳回', icon: 'exchange', color: "#fa3534", key: 3 },
|
|
|
|
|
],
|
|
|
|
|
tripTypeList: [], // 出差类型
|
|
|
|
|
feeTypeList: [], // 费用类型
|
|
|
|
|
index: 0,
|
|
|
|
|
minDate: new Date('2000/01/01'),
|
|
|
|
|
maxDate: new Date('2030/01/01'),
|
|
|
|
|
defaultDate: new Date(),
|
|
|
|
|
dateShow: false,
|
|
|
|
|
form: {
|
|
|
|
|
applyNo: null,
|
|
|
|
|
projectName: null,
|
|
|
|
|
reason: null,
|
|
|
|
|
remark: null,
|
|
|
|
|
costDeptId: null,
|
|
|
|
|
expenseApplyIds: [],
|
|
|
|
|
expenseClaimTrips: [
|
|
|
|
|
{
|
|
|
|
|
time: '',
|
|
|
|
|
startTime: null,
|
|
|
|
|
endTime: null,
|
|
|
|
|
departureLocation: null,
|
|
|
|
|
destinationLocation: null,
|
|
|
|
|
tripDay: undefined,
|
|
|
|
|
tripType: null,
|
|
|
|
|
tripPartners: [], // 出差同行人
|
|
|
|
|
amount: undefined,
|
|
|
|
|
expenseClaimDetails: [
|
|
|
|
|
{
|
|
|
|
|
show: false,
|
|
|
|
|
invoiceName: '',
|
|
|
|
|
ieList: this.ieList,
|
|
|
|
|
invoiceIds: {},
|
|
|
|
|
feeType: null,
|
|
|
|
|
amount: undefined,
|
|
|
|
|
invoiceCount: undefined,
|
|
|
|
|
remark: null,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
// 日常申请的
|
|
|
|
|
expenseClaimDetails: [
|
|
|
|
|
{
|
|
|
|
|
show: false,
|
|
|
|
|
invoiceName: '',
|
|
|
|
|
ieList: this.ieList,
|
|
|
|
|
invoiceIds: {},
|
|
|
|
|
feeType: null,
|
|
|
|
|
amount: undefined,
|
|
|
|
|
invoiceCount: undefined,
|
|
|
|
|
remark: null,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
// 计算属性
|
|
|
|
@ -159,15 +87,6 @@ export default {
|
|
|
|
|
moneyList() {
|
|
|
|
|
return getDictDatas(DICT_TYPE.CURRENCY_TYPE) || []
|
|
|
|
|
},
|
|
|
|
|
allTripPartners() {
|
|
|
|
|
let arr = []
|
|
|
|
|
this.form.expenseClaimTrips.forEach(v => {
|
|
|
|
|
v.tripPartners.forEach(z => {
|
|
|
|
|
arr.push(z)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
return arr
|
|
|
|
|
},
|
|
|
|
|
areaTree() {
|
|
|
|
|
return this.$store.getters.areaTree
|
|
|
|
|
},
|
|
|
|
@ -185,96 +104,12 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
disabled() {
|
|
|
|
|
return ['show'].includes(this.$route.query.type)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
CLBX() {
|
|
|
|
|
return ['CLBX'].includes(this.$route.query.billType)
|
|
|
|
|
},
|
|
|
|
|
RCBX() {
|
|
|
|
|
return ['RCBX'].includes(this.$route.query.billType)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
// 监听data中的数据变化
|
|
|
|
|
watch: {},
|
|
|
|
|
// 方法集合
|
|
|
|
|
methods: {
|
|
|
|
|
handleCountAmount(list) {
|
|
|
|
|
// 判断是否有成功
|
|
|
|
|
let res = (list || []).filter(item => item.feeManageAmount)
|
|
|
|
|
if (res.length) {
|
|
|
|
|
let arr = list.map(item => item.feeManageAmount || 0)
|
|
|
|
|
return arr.reduce((total, num) => Number(total) + Number(num), 0);
|
|
|
|
|
} else {
|
|
|
|
|
return 999999999999999999
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
unique(arr) {
|
|
|
|
|
let newArr = [arr[0]]
|
|
|
|
|
|
|
|
|
|
for (let i = 1; i < arr.length; i++) {
|
|
|
|
|
|
|
|
|
|
if (arr[i] !== newArr[newArr.length - 1]) {
|
|
|
|
|
|
|
|
|
|
newArr.push(arr[i])
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return newArr
|
|
|
|
|
},
|
|
|
|
|
showRules(obj, index, nIndex) {
|
|
|
|
|
let msgObj = this.form.expenseClaimTrips[index] || {}
|
|
|
|
|
let msgObj2 = this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex] || {}
|
|
|
|
|
const { destinationLocation } = msgObj
|
|
|
|
|
const { feeType } = msgObj2
|
|
|
|
|
if (!destinationLocation || !feeType || !this.form.costDeptId) {
|
|
|
|
|
return this.$fm('请选择行程目的地,费用类型,费用归属部门!')
|
|
|
|
|
}
|
|
|
|
|
findClaimRules({
|
|
|
|
|
destinationLocation: Array.isArray(destinationLocation) ? destinationLocation[destinationLocation.length - 1] : destinationLocation,
|
|
|
|
|
feeType,
|
|
|
|
|
costDeptId: this.form.costDeptId
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.dialogObj = {
|
|
|
|
|
dept: getTreeIds(this.userDeptTree, this.form.costDeptId).join('-'),
|
|
|
|
|
area: getTreeIds(this.areaTree, Array.isArray(destinationLocation) ? destinationLocation[destinationLocation.length - 1] : destinationLocation).join('-'),
|
|
|
|
|
feetypeName: this.feeTypeList.find(item => item.value == feeType).label,
|
|
|
|
|
maxMoney: res.data === 0 || res.data ? res.data : '未设置'
|
|
|
|
|
}
|
|
|
|
|
this.isShow = true
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// showRules1(obj, index, nIndex) {
|
|
|
|
|
// let msgObj = this.form.expenseClaimTrips[index] || {}
|
|
|
|
|
// let msgObj2 = this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex] || {}
|
|
|
|
|
// const { destinationLocation } = msgObj
|
|
|
|
|
// const { feeType } = msgObj2
|
|
|
|
|
// if (!destinationLocation || !feeType || !this.form.costDeptId) {
|
|
|
|
|
// return this.$fm('请选择行程目的地,费用类型,费用归属部门!')
|
|
|
|
|
// }
|
|
|
|
|
// findClaimRules({
|
|
|
|
|
// destinationLocation: Array.isArray(destinationLocation) ? destinationLocation[destinationLocation.length - 1] : destinationLocation,
|
|
|
|
|
// feeType,
|
|
|
|
|
// costDeptId: this.form.costDeptId
|
|
|
|
|
// }).then((res) => {
|
|
|
|
|
// this.dialogObj = {
|
|
|
|
|
// dept: getTreeIds(this.userDeptTree, this.form.costDeptId).join('-'),
|
|
|
|
|
// area: getTreeIds(this.areaTree, Array.isArray(destinationLocation) ? destinationLocation[destinationLocation.length - 1] : destinationLocation).join('-'),
|
|
|
|
|
// feetypeName: this.feeTypeList.find(item => item.value == feeType).label,
|
|
|
|
|
// maxMoney: res.data === 0 || res.data ? res.data : '未设置'
|
|
|
|
|
// }
|
|
|
|
|
// this.isShow = true
|
|
|
|
|
// })
|
|
|
|
|
// },
|
|
|
|
|
handleClear(index, type) {
|
|
|
|
|
if (type === 1) {
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'time', null)
|
|
|
|
|
} else {
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'tripPartners', [])
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'tripPartnersName', null)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleShowRules() {
|
|
|
|
|
|
|
|
|
|
handleUpload(list) {
|
|
|
|
|
this.fileList = list
|
|
|
|
|
},
|
|
|
|
|
handleBtConfirm(key, ignoreFeeTip) {
|
|
|
|
|
if (key == 2 || key == 3) {
|
|
|
|
@ -286,68 +121,28 @@ export default {
|
|
|
|
|
let newForm = {
|
|
|
|
|
...this.form,
|
|
|
|
|
files: this.fileList,
|
|
|
|
|
billType: this.$route.query.billType,
|
|
|
|
|
ignoreFeeTip,
|
|
|
|
|
receiptBankIds: [this.form.receiptBankIds],
|
|
|
|
|
vendorIds: [this.form.vendorIds],
|
|
|
|
|
status: key
|
|
|
|
|
}
|
|
|
|
|
if (this.$route.query.billType === 'RCBX') {
|
|
|
|
|
delete newForm.expenseClaimTrips
|
|
|
|
|
} else {
|
|
|
|
|
delete newForm.expenseClaimDetails
|
|
|
|
|
}
|
|
|
|
|
if (ignoreFeeTip) {
|
|
|
|
|
this.$loading(true, 'form')
|
|
|
|
|
createExpenseClaim(newForm).then(() => {
|
|
|
|
|
let api = newForm.id ? updateVendorReceipt : createVendorReceipt
|
|
|
|
|
api(newForm).then(() => {
|
|
|
|
|
this.$loading(false, 'form')
|
|
|
|
|
this.$sm(`${this.form.id ? '修改成功!' : '新增成功!'}`)
|
|
|
|
|
// 清楚缓存
|
|
|
|
|
if (!newForm.id) {
|
|
|
|
|
this.$EventBus.$emit('handleResetLive', 'company-myClaim')
|
|
|
|
|
this.$EventBus.$emit('handleResetLive', 'company-myNewClaim')
|
|
|
|
|
this.$EventBus.$emit('handleResetLive', 'contract-corporateReceipts')
|
|
|
|
|
}
|
|
|
|
|
history.back()
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$loading(false, 'form')
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.$loading(false, 'form')
|
|
|
|
|
createExpenseClaim(newForm).then((response) => {
|
|
|
|
|
if (response.msg) {
|
|
|
|
|
if (!response.data) {
|
|
|
|
|
Dialog.confirm({
|
|
|
|
|
title: '提示',
|
|
|
|
|
message: `${response.msg} 您确认要提交吗?`,
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.handleBtConfirm(key, 1)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.$loading(false, 'form')
|
|
|
|
|
this.$sm(`${this.form.id ? '修改成功!' : '新增成功!'}`)
|
|
|
|
|
// 清楚缓存
|
|
|
|
|
if (!newForm.id) {
|
|
|
|
|
this.$EventBus.$emit('handleResetLive', 'company-myClaim')
|
|
|
|
|
this.$EventBus.$emit('handleResetLive', 'company-myNewClaim')
|
|
|
|
|
}
|
|
|
|
|
history.back()
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$loading(false, 'form')
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// createExpenseClaim(newForm).then(() => {
|
|
|
|
|
// this.$loading(false, 'form')
|
|
|
|
|
// this.$sm(`${this.form.id ? '修改成功!' : '新增成功!'}`)
|
|
|
|
|
// // 清楚缓存
|
|
|
|
|
// if (!newForm.id) {
|
|
|
|
|
// this.$EventBus.$emit('handleResetLive', 'company-myClaim')
|
|
|
|
|
// }
|
|
|
|
|
// history.back()
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
console.log('err..', err);
|
|
|
|
|
this.$loading(false, 'form')
|
|
|
|
|
if (err && err.length > 0 && err[0].name) {
|
|
|
|
|
this.$fm(err[0].message)
|
|
|
|
|
const fieldElement = this.$refs.form.$el.querySelector(`[name="${err[0].name}"]`);
|
|
|
|
|
const fieldHeight = fieldElement.offsetHeight;
|
|
|
|
|
const scrollHeight = fieldHeight + 50; // 假设添加了 50px 的额外高度
|
|
|
|
@ -359,154 +154,18 @@ export default {
|
|
|
|
|
handleSetAccessId(id) {
|
|
|
|
|
this.accessId = id
|
|
|
|
|
},
|
|
|
|
|
handleNitemAmount(e, index) {
|
|
|
|
|
this.VerifyFunc.validatorMoney(e.target.value, { required: true }).then((res) => {
|
|
|
|
|
if (!res) {
|
|
|
|
|
this.$fm('金额格式错误!')
|
|
|
|
|
} else {
|
|
|
|
|
let arr = this.form.expenseClaimTrips[index].expenseClaimDetails.map(item => item.amount)
|
|
|
|
|
let total = arr.reduce((pre, cur) => {
|
|
|
|
|
return parseFloat(pre) + parseFloat(cur)
|
|
|
|
|
}, 0)
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'amount', total.toFixed(2))
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleNitemAmount1(e, index) {
|
|
|
|
|
this.VerifyFunc.validatorMoney(e.target.value, { required: true }).then((res) => {
|
|
|
|
|
if (!res) {
|
|
|
|
|
this.$fm('金额格式错误!')
|
|
|
|
|
} else {
|
|
|
|
|
let arr = this.form.expenseClaimDetails.map(item => item.amount)
|
|
|
|
|
let total = arr.reduce((pre, cur) => {
|
|
|
|
|
return parseFloat(pre) + parseFloat(cur)
|
|
|
|
|
}, 0)
|
|
|
|
|
this.$set(this.form.expenseClaimDetails[index], 'amount', total.toFixed(2))
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleAcDel(index, nIndex) {
|
|
|
|
|
this.form.expenseClaimTrips[index].expenseClaimDetails.splice(nIndex, 1)
|
|
|
|
|
},
|
|
|
|
|
handleAcDel1(nIndex) {
|
|
|
|
|
this.form.expenseClaimDetails.splice(nIndex, 1)
|
|
|
|
|
},
|
|
|
|
|
handleFilterList(ids, type) {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
let arr = []
|
|
|
|
|
// if (!type) {
|
|
|
|
|
// this.form.expenseClaimTrips.forEach(item => {
|
|
|
|
|
// item.expenseClaimDetails.forEach(n => {
|
|
|
|
|
// n.invoiceIds.forEach(z => {
|
|
|
|
|
// arr.push(z)
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// } else {
|
|
|
|
|
// this.form.expenseClaimDetails.forEach(n => {
|
|
|
|
|
// n.invoiceIds.forEach(z => {
|
|
|
|
|
// arr.push(z)
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
let beforeIds = this.ieList.filter(item => !arr.includes(item.id)) || []
|
|
|
|
|
let noewIds = this.ieList.filter(item => ids.includes(item.id)) || []
|
|
|
|
|
resolve(beforeIds.concat(noewIds))
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleShowIe(type, index, nIndex) {
|
|
|
|
|
if (this.disabled) return
|
|
|
|
|
// this.indexOne = index
|
|
|
|
|
// this.indexTwo = nIndex
|
|
|
|
|
// this.claimType = type
|
|
|
|
|
// let obj = this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex]
|
|
|
|
|
// this.$set(this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'ieList', arr)
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'show', true)
|
|
|
|
|
console.log('form......', this.form);
|
|
|
|
|
// this.handleFilterList(obj.invoiceIds || {}).then((arr) => {
|
|
|
|
|
//
|
|
|
|
|
// })
|
|
|
|
|
},
|
|
|
|
|
handleShowIe1(nIndex) {
|
|
|
|
|
if (this.disabled) return
|
|
|
|
|
// let obj = this.form.expenseClaimDetails[nIndex]
|
|
|
|
|
|
|
|
|
|
// this.$set(this.form.expenseClaimDetails[nIndex], 'ieList', arr)
|
|
|
|
|
this.$set(this.form.expenseClaimDetails[nIndex], 'show', true)
|
|
|
|
|
// this.handleFilterList(obj.invoiceIds || {}, 1).then((arr) => {
|
|
|
|
|
//
|
|
|
|
|
// })
|
|
|
|
|
},
|
|
|
|
|
handleConfirmIe(arr, index, nIndex) {
|
|
|
|
|
// let nameArr = ((this.ieList.filter(item => arr.includes(item.id)) || []).map(item => item.invoiceCode)).join('、')
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'invoiceIds', arr)
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'show', false)
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'invoiceCount', this.totalCount(arr))
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'invoiceName', '已关联发票')
|
|
|
|
|
},
|
|
|
|
|
handleConfirmIe1(arr, nIndex) {
|
|
|
|
|
// let nameArr = ((this.ieList.filter(item => arr.includes(item.id)) || []).map(item => item.invoiceCode)).join('、')
|
|
|
|
|
this.$set(this.form.expenseClaimDetails[nIndex], 'invoiceIds', arr)
|
|
|
|
|
this.$set(this.form.expenseClaimDetails[nIndex], 'show', false)
|
|
|
|
|
this.$set(this.form.expenseClaimDetails[nIndex], 'invoiceCount', this.totalCount(arr))
|
|
|
|
|
this.$set(this.form.expenseClaimDetails[nIndex], 'invoiceName', '已关联发票')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
totalCount(obj) {
|
|
|
|
|
let count = 0;
|
|
|
|
|
|
|
|
|
|
for (let key in obj) {
|
|
|
|
|
if (Array.isArray(obj[key])) {
|
|
|
|
|
count += obj[key].length;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return count;
|
|
|
|
|
},
|
|
|
|
|
totalName(obj) {
|
|
|
|
|
let count = '';
|
|
|
|
|
for (let key in obj) {
|
|
|
|
|
if (Array.isArray(obj[key])) {
|
|
|
|
|
obj[key].forEach(function (item) {
|
|
|
|
|
count = !count ? item : count + `、${item}`
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return count;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleAddAccount(pIndex, index) {
|
|
|
|
|
this.form.expenseClaimTrips[pIndex].expenseClaimDetails.push({
|
|
|
|
|
invoiceIds: {},
|
|
|
|
|
feeType: null,
|
|
|
|
|
amount: undefined,
|
|
|
|
|
invoiceCount: undefined,
|
|
|
|
|
remark: null,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleAddAccount1() {
|
|
|
|
|
this.form.expenseClaimDetails.push({
|
|
|
|
|
invoiceIds: {},
|
|
|
|
|
feeType: null,
|
|
|
|
|
amount: undefined,
|
|
|
|
|
invoiceCount: undefined,
|
|
|
|
|
remark: null,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleInitForm() {
|
|
|
|
|
const { id, type, listType } = this.$route.query || {}
|
|
|
|
|
this.typeStr = type
|
|
|
|
|
this.typeStr = this.$route.query.type
|
|
|
|
|
// 注入缓存
|
|
|
|
|
this.$EventBus.$emit('handleAddLive', 'company-claim')
|
|
|
|
|
if (id) {
|
|
|
|
|
this.$EventBus.$emit('handleAddLive', 'contract-receipts')
|
|
|
|
|
if (this.$route.query.id) {
|
|
|
|
|
this.$loading(true, 'loadingSb')
|
|
|
|
|
let api = listType === 'myNewClaim' ? getMyExpenseClaim : getExpenseClaim
|
|
|
|
|
api(id).then((res) => {
|
|
|
|
|
|
|
|
|
|
let api = getVendorReceipt
|
|
|
|
|
api(this.$route.query.id).then((res) => {
|
|
|
|
|
this.form = {
|
|
|
|
|
...(res.data || {}),
|
|
|
|
|
receiptBankIds: Array.isArray(res.data.receiptBankIds) && res.data.receiptBankIds.length ? Number(res.data.receiptBankIds[0]) : null,
|
|
|
|
|
vendorIds: Array.isArray(res.data.vendorIds) && res.data.vendorIds.length ? Number(res.data.vendorIds[0]) : null
|
|
|
|
|
}
|
|
|
|
|
this.fileList = res.data.files || []
|
|
|
|
|
this.isAuthorised = res.data.isAuthorised
|
|
|
|
@ -520,7 +179,6 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleInitList() {
|
|
|
|
|
console.log('......');
|
|
|
|
|
this.$loading(true)
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
Promise.all([
|
|
|
|
@ -528,54 +186,25 @@ export default {
|
|
|
|
|
getBankAccountInfoPage({ pageNo: 1, pageSize: 999 })
|
|
|
|
|
]).then(responses => {
|
|
|
|
|
// 处理每个请求的结果
|
|
|
|
|
this.allGysList = responses[0].data.list || [];
|
|
|
|
|
this.allBankList = responses[1].data.list || [];
|
|
|
|
|
this.allGysList = (responses[0].data.list || []).map(item => {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id,
|
|
|
|
|
title: item.vendorName
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.allBankList = (responses[1].data.list || []).map(item => {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id,
|
|
|
|
|
title: `${item.bankName}-${item.bankAccount}`
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
resolve()
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
// 处理错误情况
|
|
|
|
|
console.error('Error:', error);
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleDateShow(index, obj) {
|
|
|
|
|
if (this.disabled) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const { startTime, endTime } = obj
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.vanCalendar && this.$refs.vanCalendar.reset()
|
|
|
|
|
this.dateShow = true
|
|
|
|
|
this.index = index
|
|
|
|
|
if (startTime && endTime) {
|
|
|
|
|
this.defaultDate = [dayjs(startTime).toDate(), dayjs(endTime).toDate()]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleDateSelect(list) {
|
|
|
|
|
let trips = this.form.expenseClaimTrips
|
|
|
|
|
if (trips.length && list && list.length) {
|
|
|
|
|
// 判断行程时间是否在已经有的时间范围内
|
|
|
|
|
let start1 = dayjs(list[0]);
|
|
|
|
|
let end1 = dayjs(list[1]);
|
|
|
|
|
let range1 = { start: start1, end: end1 };
|
|
|
|
|
for (let i = 0; i < trips.length; i++) {
|
|
|
|
|
let start2 = dayjs(trips[i].startTime);
|
|
|
|
|
let end2 = dayjs(trips[i].endTime);
|
|
|
|
|
let range2 = { start: start2, end: end2 };
|
|
|
|
|
if (this.index !== i && range1.start.isBefore(range2.end) && range2.start.isBefore(range1.end)
|
|
|
|
|
) {
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[this.index], 'time', null)
|
|
|
|
|
return this.$fm(`行程时间范围与行程${i + 1}时间范围冲突!`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[this.index], 'time', `${dayjs(list[0]).format('YY/MM/DD')}~${dayjs(list[1]).format('YY/MM/DD')}`)
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[this.index], 'startTime', dayjs(list[0]).valueOf())
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[this.index], 'endTime', dayjs(list[1]).valueOf())
|
|
|
|
|
let day = list && list.length && Number(dayjs(list[1]).diff(dayjs(list[0]), 'day')) + 1
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[this.index], 'tripDay', day)
|
|
|
|
|
this.dateShow = false
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|