|
|
|
@ -10,11 +10,9 @@
|
|
|
|
|
<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 />
|
|
|
|
|
<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="收款金额" />
|
|
|
|
|
<van-field v-model="form.reason" :disabled="disabled" name="reason" autosize rows="2" label="项目负责人" required :rules="[{ required: true, message: '请输入' }]" clear-trigger="always" input-align="right" placeholder="请输入" />
|
|
|
|
|
<van-field v-model="form.remark" :disabled="disabled" name="remark" autosize rows="2" label="备注信息" clear-trigger="always" input-align="right" placeholder="请输入" type="textarea" />
|
|
|
|
|
<RePick v-model="form.costDeptId" :disabled="disabled" label="费用归属部门" :name="`costDeptId`" :list="userDeptTree" isRequrie isCascader isShowSearch title="费用归属部门" titleKey="name" isCell clearable />
|
|
|
|
|
<RePick v-model="form.vendorIds" :disabled="disabled" label="关联供应商" name="currency" :list="allGysList" title="关联供应商" isCell clearable />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section mt5"> <span class="line"> </span>附件</div>
|
|
|
|
@ -52,6 +50,7 @@ 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";
|
|
|
|
|
export default {
|
|
|
|
|
//import引入组件才能使用
|
|
|
|
|
props: {},
|
|
|
|
@ -76,6 +75,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
allGysList: [],
|
|
|
|
|
indexOne: 1,
|
|
|
|
|
indexTwo: 1,
|
|
|
|
|
claimType: '',
|
|
|
|
@ -507,38 +507,6 @@ export default {
|
|
|
|
|
|
|
|
|
|
this.form = {
|
|
|
|
|
...(res.data || {}),
|
|
|
|
|
expenseClaimTrips: (res.data.expenseClaimTrips || []).map(item => {
|
|
|
|
|
let nameArr = []
|
|
|
|
|
this.userList.forEach(element => {
|
|
|
|
|
if (item.tripPartners.includes(element.id)) {
|
|
|
|
|
nameArr.push(element.nickname)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return {
|
|
|
|
|
...item,
|
|
|
|
|
tripType: Number(item.tripType),
|
|
|
|
|
time: `${dayjs(item.startTime).format('YY/MM/DD')}~${dayjs(item.endTime).format('YY/MM/DD')}`,
|
|
|
|
|
tripPartnersName: nameArr.join('、'),
|
|
|
|
|
departureLocation: Number(item.departureLocation),
|
|
|
|
|
destinationLocation: Number(item.destinationLocation)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (Array.isArray(this.form.expenseClaimTrips)) {
|
|
|
|
|
this.form.expenseClaimTrips.forEach(n => {
|
|
|
|
|
n.expenseClaimDetails.forEach(z => {
|
|
|
|
|
// let nameArr = ((this.ieList.filter(item => (z.invoiceIds || []).includes(item.id)) || []).map(item => item.invoiceCode)).join('、')
|
|
|
|
|
this.$set(z, 'show', false)
|
|
|
|
|
// this.$set(z, 'invoiceName', nameArr)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (Array.isArray(this.form.expenseClaimDetails)) {
|
|
|
|
|
this.form.expenseClaimDetails.forEach(z => {
|
|
|
|
|
// let nameArr = ((this.ieList.filter(item => (z.invoiceIds || []).includes(item.id)) || []).map(item => item.invoiceCode)).join('、')
|
|
|
|
|
this.$set(z, 'show', false)
|
|
|
|
|
// this.$set(z, 'invoiceName', nameArr)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.fileList = res.data.files || []
|
|
|
|
|
this.isAuthorised = res.data.isAuthorised
|
|
|
|
@ -550,159 +518,24 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleUpload(list) {
|
|
|
|
|
this.fileList = list
|
|
|
|
|
},
|
|
|
|
|
handleNewConfirmPo(arr, index) {
|
|
|
|
|
let nameArr = []
|
|
|
|
|
this.userList.forEach(element => {
|
|
|
|
|
if (arr.includes(element.id)) {
|
|
|
|
|
nameArr.push(element.nickname)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'tripPartners', arr)
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'tripPartnersName', nameArr.join('、'))
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'isOpen', false)
|
|
|
|
|
},
|
|
|
|
|
handleConfirmPo(arr, index) {
|
|
|
|
|
let nameArr = this.form.expenseClaimTrips[index].tripPartnersName && this.form.expenseClaimTrips[index].tripPartnersName.split('、') || []
|
|
|
|
|
let newArr = this.form.expenseClaimTrips[index].tripPartners || []
|
|
|
|
|
this.userList.forEach(element => {
|
|
|
|
|
if (arr.includes(element.id)) {
|
|
|
|
|
nameArr.push(element.nickname)
|
|
|
|
|
newArr.push(element.id)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'tripPartners', newArr)
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'tripPartnersName', nameArr.join('、'))
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'isOpen', false)
|
|
|
|
|
},
|
|
|
|
|
handlePoShow(index) {
|
|
|
|
|
// if (this.disabled) return
|
|
|
|
|
if (this.form.expenseClaimTrips[index].tripPartners.length) {
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'type', 0)
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'isOpen', true)
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
this.$fm('请先添加同行人!')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
handlePoCancel(index) {
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'isOpen', false)
|
|
|
|
|
},
|
|
|
|
|
handleAddPeo(index) {
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'isOpen', true)
|
|
|
|
|
this.$set(this.form.expenseClaimTrips[index], 'type', 1)
|
|
|
|
|
},
|
|
|
|
|
handleDel(index) {
|
|
|
|
|
this.form.expenseClaimTrips.splice(index, 1)
|
|
|
|
|
},
|
|
|
|
|
handleAdd() {
|
|
|
|
|
this.form.expenseClaimTrips.push({
|
|
|
|
|
time: null,
|
|
|
|
|
startTime: null,
|
|
|
|
|
endTime: null,
|
|
|
|
|
departureLocation: null,
|
|
|
|
|
departureLocationName: '',
|
|
|
|
|
destinationLocation: null,
|
|
|
|
|
destinationLocationName: '',
|
|
|
|
|
tripDay: undefined,
|
|
|
|
|
tripType: null,
|
|
|
|
|
tripPartners: [], // 出差同行人
|
|
|
|
|
tripPartnersName: "",
|
|
|
|
|
amount: undefined,
|
|
|
|
|
isOpen: false,
|
|
|
|
|
type: 0,
|
|
|
|
|
expenseClaimDetails: [
|
|
|
|
|
{
|
|
|
|
|
invoiceIds: {},
|
|
|
|
|
feeType: null,
|
|
|
|
|
amount: undefined,
|
|
|
|
|
invoiceCount: undefined,
|
|
|
|
|
remark: null,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleInitList() {
|
|
|
|
|
console.log('......');
|
|
|
|
|
this.$loading(true)
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
listData({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: this.$store.getters.requestPageSize,
|
|
|
|
|
dictType: 'bs_trip_type',
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
// 出差类型
|
|
|
|
|
this.tripTypeList = res.data.list || []
|
|
|
|
|
console.log('tripTypeList..', this.tripTypeList);
|
|
|
|
|
})
|
|
|
|
|
listData({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: this.$store.getters.requestPageSize,
|
|
|
|
|
dictType: 'bs_fee_type',
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
// 出差类型
|
|
|
|
|
this.feeTypeList = res.data.list || []
|
|
|
|
|
})
|
|
|
|
|
getInvoicePage({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: this.$store.getters.requestPageSize,
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.ieList = res.data && res.data.list || []
|
|
|
|
|
getExpenseApplyMyPage({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 1000,
|
|
|
|
|
billType: 'CLSQ',
|
|
|
|
|
expenseFlag: 0,
|
|
|
|
|
ids: [],
|
|
|
|
|
sortingFieldStr: encodeURIComponent(JSON.stringify([{ field: 'id', order: "desc" }]))
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
|
|
|
|
|
let list = (res.data.list || []).map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
...item,
|
|
|
|
|
amount: (item.expenseApplyTrips || []).reduce((acc, cur) => {
|
|
|
|
|
return Number(acc) + Number(cur.amount)
|
|
|
|
|
}, 0),
|
|
|
|
|
tripDay: (item.expenseApplyTrips || []).reduce((acc, cur) => {
|
|
|
|
|
return Number(acc) + Number(cur.tripDay)
|
|
|
|
|
}, 0),
|
|
|
|
|
rodeArr: ((item.expenseApplyTrips || []).map(item => {
|
|
|
|
|
return [(findAreaIdName(this.areaTree, item.departureLocation) || {}).name, (findAreaIdName(this.areaTree, item.destinationLocation) || {}).name]
|
|
|
|
|
})),
|
|
|
|
|
time: Array.isArray(item.expenseApplyTrips) && item.expenseApplyTrips.length ? `${dayjs(item.expenseApplyTrips[0].startTime).format('YYYY/MM/DD')}~${dayjs(item.expenseApplyTrips[item.expenseApplyTrips.length - 1].endTime).format('YYYY/MM/DD')}` : '-'
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
list.forEach(element => {
|
|
|
|
|
let arr = []
|
|
|
|
|
element.rodeArr.forEach(v => {
|
|
|
|
|
v.forEach(n => {
|
|
|
|
|
arr.push(n && n)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
element.rodeArr = arr
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//去重
|
|
|
|
|
list.forEach(n => {
|
|
|
|
|
n.rode = this.unique(n.rodeArr).join('-')
|
|
|
|
|
})
|
|
|
|
|
this.expenseApplyList = (list || []).map((item, index) => {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id,
|
|
|
|
|
title: `序号:${index + 1} 编号:${item.applyNo}申请人:${item.nickname}行程路线:${item.rode}出差天数:${item.tripDay || 0}天`,
|
|
|
|
|
disabled: item.status != 2 ? true : false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
Promise.all([
|
|
|
|
|
getVendorPage({ pageNo: 1, pageSize: 999 }),
|
|
|
|
|
getBankAccountInfoPage({ pageNo: 1, pageSize: 999 })
|
|
|
|
|
]).then(responses => {
|
|
|
|
|
// 处理每个请求的结果
|
|
|
|
|
this.allGysList = responses[0].data.list || [];
|
|
|
|
|
this.allBankList = responses[1].data.list || [];
|
|
|
|
|
resolve()
|
|
|
|
|
this.$loading(false)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
// 处理错误情况
|
|
|
|
|
console.error('Error:', error);
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
handleDateShow(index, obj) {
|
|
|
|
|
if (this.disabled) {
|
|
|
|
|