费控修改申请人 申请部门

main
jwg 7 months ago
parent de9a0367a7
commit 7d9fcbbc2c

@ -1,14 +1,29 @@
<!-- 底部 -->
<template>
<div class="sumbit-box" v-if="btnList.length">
<div class="item-box" v-for="(item,index) in btnList" :key="index" @click="handleSubmit(item.key)">
<div
class="item-box"
v-for="(item, index) in btnList"
:key="index"
@click="handleSubmit(item.key)"
>
<van-icon :name="item.icon" :color="item.color" size="25" />
<div class="box-tt">
<span :style="`color:${item.color}`"> {{ item.title }}</span>
</div>
</div>
<!-- 同意驳回弹窗 -->
<van-popup v-model="isShow" position="bottom" round safe-area-inset-bottom lock-scroll lazy-render get-container="#app" :close-on-click-overlay="false" @close="hanleCancel">
<van-popup
v-model="isShow"
position="bottom"
round
safe-area-inset-bottom
lock-scroll
lazy-render
get-container="#app"
:close-on-click-overlay="false"
@close="hanleCancel"
>
<div class="Re-select-header">
<div class="Re-select-header-cancel" @click="hanleCancel"></div>
<div class="Re-select-header-title">{{ title }}</div>
@ -16,8 +31,25 @@
</div>
<div class="box-1">
<div class="content-box">
<van-form ref="form" :show-error-message="false" validate-trigger="" :submit-on-enter="false">
<van-field v-model="form.reason" required name="reason" autosize rows="2" label="理由" :rules="[{ required: true, message: '请输入' }]" clear-trigger="always" input-align="right" placeholder="请输入" type="textarea" />
<van-form
ref="form"
:show-error-message="false"
validate-trigger=""
:submit-on-enter="false"
>
<van-field
v-model="form.reason"
required
name="reason"
autosize
rows="2"
label="理由"
:rules="[{ required: true, message: '请输入' }]"
clear-trigger="always"
input-align="right"
placeholder="请输入"
type="textarea"
/>
</van-form>
</div>
</div>
@ -26,8 +58,8 @@
</template>
<script>
import { approveTask, rejectTask } from "@/api/bpm/task";
import { set } from 'vue';
import { approveTask, rejectTask } from '@/api/bpm/task'
// import { set } from 'vue';
export default {
name: '',
props: {
@ -48,7 +80,7 @@ export default {
isShow: false,
key: null,
form: {
reason: null
reason: null,
},
}
},
@ -61,16 +93,15 @@ export default {
this.$refs.form && this.$refs.form.resetValidation()
})
}
}
},
deep: true
},
deep: true,
},
components: {},
computed: {},
methods: {
hanleCancel() {
this.isShow = false
@ -80,25 +111,29 @@ export default {
this.$refs.form.validate().then(() => {
let obj = {
id: this.accessId,
reason: this.form.reason
reason: this.form.reason,
}
this.$loading(true, 'loadingSb')
if (this.key == 2) {
approveTask(obj).then(() => {
approveTask(obj)
.then(() => {
this.$EventBus.$emit('handleResetLive', 'company-myTrips')
this.$EventBus.$emit('handleResetLive', 'company-myClaim')
history.back()
this.$loading(false, 'loadingSb')
}).catch(() => {
})
.catch(() => {
this.$loading(false, 'loadingSb')
})
} else {
rejectTask(obj).then(() => {
rejectTask(obj)
.then(() => {
this.$EventBus.$emit('handleResetLive', 'company-myTrips')
this.$EventBus.$emit('handleResetLive', 'company-myClaim')
history.back()
this.$loading(false, 'loadingSb')
}).catch(() => {
})
.catch(() => {
this.$loading(false, 'loadingSb')
})
}
@ -122,33 +157,38 @@ export default {
setTimeout(() => {
if (['edit', 'add'].includes(this.$route.query.type)) {
this.btnList = [
{ title: '暂存', icon: 'star-o', color: "#909399", key: 0 },
{ title: '提交', icon: 'edit', color: "#ff9900", key: 1 },
{ title: '返回', icon: 'revoke', color: "#909399", key: 6 },
{ title: '暂存', icon: 'star-o', color: '#909399', key: 0 },
{ title: '提交', icon: 'edit', color: '#ff9900', key: 1 },
{ title: '返回', icon: 'revoke', color: '#909399', key: 6 },
]
} else {
if (this.isAuthorised) {
this.btnList = [
{ title: '同意', icon: 'certificate', color: "#19be6b", key: 2 },
{ title: '驳回', icon: 'exchange', color: "#fa3534", key: 3 },
{ title: '返回', icon: 'revoke', color: "#909399", key: 6 },
{ title: '同意', icon: 'certificate', color: '#19be6b', key: 2 },
{ title: '驳回', icon: 'exchange', color: '#fa3534', key: 3 },
{ title: '返回', icon: 'revoke', color: '#909399', key: 6 },
]
} else {
if (this.listType === 'bidder' && this.isWin != 3 && !this.isAuthorised) {
if (
this.listType === 'bidder' &&
this.isWin != 3 &&
!this.isAuthorised
) {
this.btnList = [
{ title: '发起', icon: 'edit', color: "#ff9900", key: 1 },
{ title: '返回', icon: 'revoke', color: "#909399", key: 6 },
{ title: '发起', icon: 'edit', color: '#ff9900', key: 1 },
{ title: '返回', icon: 'revoke', color: '#909399', key: 6 },
]
} else {
this.btnList = [{ title: '返回', icon: 'revoke', color: "#909399", key: 6 }]
this.btnList = [
{ title: '返回', icon: 'revoke', color: '#909399', key: 6 },
]
}
}
}
}, 0)
},
},
}
}
</script>
<style lang='scss' scoped>
@import '../FollowPeoPle/index.scss';

@ -1,11 +1,25 @@
<template>
<van-popup v-model="isShow" position="bottom" round safe-area-inset-bottom lock-scroll lazy-render get-container="#app" :close-on-click-overlay="false" @close="hanleCancel">
<van-popup
v-model="isShow"
position="bottom"
round
safe-area-inset-bottom
lock-scroll
lazy-render
get-container="#app"
:close-on-click-overlay="false"
@close="hanleCancel"
>
<div class="Re-select-header">
<div class="Re-select-header-cancel" @click="hanleCancel"></div>
<div class="Re-select-header-title">发票关联</div>
<div class="Re-select-header-confirm" @click="handleConfirm"></div>
</div>
<van-tabs v-model="invoiceType" :swipe-threshold="4" @change="vanTabsChange">
<van-tabs
v-model="invoiceType"
:swipe-threshold="4"
@change="vanTabsChange"
>
<van-tab name="01" title="增值税发票" />
<van-tab name="02" title="火车票" />
<van-tab name="03" title="飞机行程票" />
@ -13,63 +27,127 @@
<van-tab name="05" title="出租车发票" />
</van-tabs>
<div class="box-1">
<RMList :moreLoading.sync="moreLoading" :refreshing.sync="refreshing" :finished.sync="finished" @onLoad="handleLoad" @onRefresh="handleRefresh" isMore :tableList="tableList">
<div class="new-item-box" v-for="(item,index) in tableList" :key="index">
<RMList
:moreLoading.sync="moreLoading"
:refreshing.sync="refreshing"
:finished.sync="finished"
@onLoad="handleLoad"
@onRefresh="handleRefresh"
isMore
:tableList="tableList"
>
<div
class="new-item-box"
v-for="(item, index) in tableList"
:key="index"
>
<div class="new-lf">
<van-checkbox v-model="item.checked" shape="square"></van-checkbox>
<!-- <van-image @click="handleShowImg(item)" width="2.5rem" height="2.5rem" src="https://img01.yzcdn.cn/vant/cat.jpeg" /> -->
</div>
<div class="new-cr" @click="handleSetCheck(index,item)" v-if="invoiceType == '01'">
<div
class="new-cr"
@click="handleSetCheck(index, item)"
v-if="invoiceType == '01'"
>
<div class="mt5">发票消费类型 {{ item.serviceType || '-' }}</div>
<div class="mt5">发票代码 {{ item.invoiceCode || '-' }}</div>
<div class="mt5">发票号码 {{ item.invoiceNum || '-' }}</div>
<div style="margin-top: 0.3rem;color:#333 ">开票日期 {{item.invoiceDate && dayjs(item.invoiceDate).format('YY/MM/DD HH:ss')}}</div>
<div style="margin-top: 0.3rem; color: #333">
开票日期
{{
item.invoiceDate &&
dayjs(item.invoiceDate).format('YY/MM/DD HH:ss')
}}
</div>
<div class="new-cr" @click="handleSetCheck(index,item)" v-if="invoiceType == '02'">
</div>
<div
class="new-cr"
@click="handleSetCheck(index, item)"
v-if="invoiceType == '02'"
>
<div class="mt5">车票号 {{ item.ticketNum || '-' }}</div>
<div class="mt5">始发站 {{ item.startingStation || '-' }}</div>
<div class="mt5">到达站 {{ item.destinationStation || '-' }}</div>
<div style="margin-top: 0.3rem;color:#333 ">出发日期 {{item.startingDate && dayjs(item.startingDate).format('YY/MM/DD HH:ss')}}</div>
<div style="margin-top: 0.3rem; color: #333">
出发日期
{{
item.startingDate &&
dayjs(item.startingDate).format('YY/MM/DD HH:ss')
}}
</div>
<div class="mt5">车次号 {{ item.trainNum || '-' }}</div>
</div>
<div class="new-cr" @click="handleSetCheck(index,item)" v-if="invoiceType == '03'">
<div
class="new-cr"
@click="handleSetCheck(index, item)"
v-if="invoiceType == '03'"
>
<div class="mt5">姓名 {{ item.name || '-' }}</div>
<div class="mt5">始发站 {{ item.startingStation || '-' }}</div>
<div class="mt5">目的站 {{ item.destinationStation || '-' }}</div>
<div class="mt5">航班号 {{ item.flight || '-' }}</div>
<div class="mt5">承运人 {{ item.carrier || '-' }}</div>
</div>
<div class="new-cr" @click="handleSetCheck(index,item)" v-if="invoiceType == '04'">
<div
class="new-cr"
@click="handleSetCheck(index, item)"
v-if="invoiceType == '04'"
>
<div class="mt5">服务商 {{ item.serviceProvider || '-' }}</div>
<div class="mt5">行程人手机号 {{ item.phone || '-' }}</div>
<div style="margin-top: 0.3rem;color:#333 " v-if="item.items && item.items.length > 0"> {{item.items[0].pickupDate && dayjs(item.items[0].pickupDate).format('YY/MM/DD HH:ss')}}</div>
<div class="mt5" v-if="item.items && item.items.length > 0"> {{item.items[0].startPlace || '-'}}</div>
<div class="mt5" v-if="item.items && item.items.length > 0"> {{item.items[0].destinationPlace || '-'}}</div>
<div class="mt5" v-if="item.items && item.items.length > 0"> {{item.items[0].city || '-'}}</div>
<div
style="margin-top: 0.3rem; color: #333"
v-if="item.items && item.items.length > 0"
>
上车日期
{{
item.items[0].pickupDate &&
dayjs(item.items[0].pickupDate).format('YY/MM/DD HH:ss')
}}
</div>
<div class="mt5" v-if="item.items && item.items.length > 0">
起点 {{ item.items[0].startPlace || '-' }}
</div>
<div class="mt5" v-if="item.items && item.items.length > 0">
终点 {{ item.items[0].destinationPlace || '-' }}
</div>
<div class="new-cr" @click="handleSetCheck(index,item)" v-if="invoiceType == '05'">
<div class="mt5" v-if="item.items && item.items.length > 0">
城市 {{ item.items[0].city || '-' }}
</div>
</div>
<div
class="new-cr"
@click="handleSetCheck(index, item)"
v-if="invoiceType == '05'"
>
<div class="mt5">发票代码 {{ item.invoiceCode || '-' }}</div>
<div class="mt5">发票号码 {{ item.invoiceNum || '-' }}</div>
<div class="mt5">车牌号 {{ item.taxiNum || '-' }}</div>
<div style="margin-top: 0.3rem;color:#333 ">日期 {{item.startingDate && dayjs(item.startingDate).format('YY/MM/DD HH:ss')}}</div>
<div style="margin-top: 0.3rem; color: #333">
日期
{{
item.startingDate &&
dayjs(item.startingDate).format('YY/MM/DD HH:ss')
}}
</div>
</div>
</div>
</RMList>
</div>
</van-popup>
</template>
<script>
import dayjs from 'dayjs';
import { ImagePreview } from 'vant';
import dayjs from 'dayjs'
import { ImagePreview } from 'vant'
import {
getInvoicePage01,
getInvoicePage02,
getInvoicePage03,
getInvoicePage04,
getInvoicePage05
} from "@/api/bs/invoice";
getInvoicePage05,
} from '@/api/bs/invoice'
export default {
props: {
temClaimNo: [Number, String], //
@ -78,7 +156,7 @@ export default {
isExist: Boolean, //
tripPartners: Array, //
list: Array, //
type: [Number, String]
type: [Number, String],
},
components: {
RePick: () => import('@/components/ReComponents/RePick'),
@ -117,7 +195,7 @@ export default {
pageNo: 1,
pageSize: 10,
temClaimNo: 0,
}
},
}
},
created() {
@ -129,15 +207,14 @@ export default {
watch: {
isOpen: {
handler(val) {
console.log('6....1111..', val);
console.log('6....1111..', val)
this.isShow = val
if (val) {
this.handleInitList()
}
},
deep: true,
immediate: true
immediate: true,
},
// list: {
// handler(val) {
@ -159,10 +236,14 @@ export default {
handleSetCheck(index) {
// this.tableList
let _this = this
this.$set(this.tableList[index], 'checked', !this.tableList[index].checked)
this.$set(
this.tableList[index],
'checked',
!this.tableList[index].checked
)
if (this.tableList[index].checked) {
if (!_this.invoiceIdsCopy.hasOwnProperty(_this.invoiceType)) {
_this.invoiceIdsCopy[_this.invoiceType] = [];
_this.invoiceIdsCopy[_this.invoiceType] = []
}
_this.invoiceIdsCopy[_this.invoiceType].push(this.tableList[index].id)
} else {
@ -172,19 +253,18 @@ export default {
console.log(_this.invoiceIdsCopy)
},
handleShowImg() {
ImagePreview(['https://img01.yzcdn.cn/vant/apple-1.jpg']);
ImagePreview(['https://img01.yzcdn.cn/vant/apple-1.jpg'])
},
dayjs,
handleNewDel(index) {
this.tableList.splice(index, 1)
},
handleInitList() {
},
handleInitList() {},
handleConfirm() {
// let arr = (this.tableList.filter(item => item.checked)).map(item => item.id) || []
this.$emit('onConfirm', this.invoiceIdsCopy)
console.log(this.invoiceIdsCopy, 'this.invoiceIdsCopy')
},
hanleCancel() {
@ -210,14 +290,24 @@ export default {
let _this = this
this.moreLoading = true
this.$loading(true, 'tableLoading')
const getInvoicePage = this.invoiceType == '01' ? getInvoicePage01 : this.invoiceType == '02' ? getInvoicePage02 : this.invoiceType == '03' ? getInvoicePage03 : this.invoiceType == '04' ? getInvoicePage04 : getInvoicePage05;
const getInvoicePage =
this.invoiceType == '01'
? getInvoicePage01
: this.invoiceType == '02'
? getInvoicePage02
: this.invoiceType == '03'
? getInvoicePage03
: this.invoiceType == '04'
? getInvoicePage04
: getInvoicePage05
if (_this.temClaimNo) {
_this.listQuery.temClaimNo = _this.temClaimNo
} else {
_this.listQuery.temClaimNo = 0
}
getInvoicePage(_this.listQuery).then(res => {
let resList = res.data && res.data.list || []
getInvoicePage(_this.listQuery)
.then((res) => {
let resList = (res.data && res.data.list) || []
if (['init', 'refresh'].includes(val)) {
this.tableList = resList
} else {
@ -226,19 +316,28 @@ export default {
if (resList.length < this.pageSize) {
this.finished = true
}
if (_this.invoiceIdsCopy && _this.invoiceIdsCopy.hasOwnProperty(_this.invoiceType)) {
_this.tableList.map(item => {
item.checked = (_this.invoiceIdsCopy[_this.invoiceType] || []).includes(item.id)
if (
_this.invoiceIdsCopy &&
Object.prototype.hasOwnProperty.call(
_this.invoiceIdsCopy,
_this.invoiceType
)
) {
_this.tableList.map((item) => {
item.checked = (
_this.invoiceIdsCopy[_this.invoiceType] || []
).includes(item.id)
})
}
}).finally(() => {
})
.finally(() => {
this.$nextTick(() => {
this.moreLoading = false
this.refreshing = false
this.$loading(false, 'tableLoading')
})
})
}
},
},
}
</script>

File diff suppressed because it is too large Load Diff

@ -1,87 +1,363 @@
<template>
<div class="common-list-contain">
<div class="common-form">
<van-form ref="form" :show-error-message="false" validate-trigger="" :submit-on-enter="false">
<van-form
ref="form"
:show-error-message="false"
validate-trigger=""
:submit-on-enter="false"
>
<div class="section"><span class="line"> </span> 基本信息</div>
<div class="trips-box">
<div class="item-box">
<van-field v-model="form.applyNo" disabled label="单号" v-if="disabled" clear-trigger="always" input-align="right" />
<van-field v-model="cn" disabled label="公司名称" clear-trigger="always" 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="请输入" />
<van-field v-model="form.projectName" :disabled="disabled" label="项目名称" clear-trigger="always" input-align="right" placeholder="请输入" />
<van-field v-model="form.amount" v-if="!CLSQ" type="input" :disabled="disabled" name="amount" autosize rows="2" :rules="[{ required: false, message: '预计费用格式错误',validator: VerifyFunc.validatorMoney, type:1 }]" label="预计费用" clear-trigger="always" input-align="right" placeholder="请输入" />
<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="请输入" type="textarea" />
<van-field v-model="form.remark" :disabled="disabled" name="reason" autosize rows="2" label="备注信息" clear-trigger="always" input-align="right" placeholder="请输入" type="textarea" />
<van-field
v-model="form.applyNo"
disabled
label="单号"
v-if="disabled"
clear-trigger="always"
input-align="right"
/>
<!-- <van-field
v-model="cn"
disabled
label="公司名称"
clear-trigger="always"
input-align="right"
/> -->
<van-field
v-model="form.companyName"
disabled
label="公司名称"
clear-trigger="always"
input-align="right"
/>
<!-- <van-field
v-model="userInfo.nickname"
disabled
label="申请人"
clear-trigger="always"
input-align="right"
maxlength="50"
placeholder="请输入"
/> -->
<van-field
v-model="form.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="请输入"
/> -->
<van-field
v-model="form.deptName"
disabled
label="申请部门"
clear-trigger="always"
input-align="right"
maxlength="50"
placeholder="请输入"
/>
<van-field
v-model="form.projectName"
:disabled="disabled"
label="项目名称"
clear-trigger="always"
input-align="right"
placeholder="请输入"
/>
<van-field
v-model="form.amount"
v-if="!CLSQ"
type="input"
:disabled="disabled"
name="amount"
autosize
rows="2"
:rules="[
{
required: false,
message: '预计费用格式错误',
validator: VerifyFunc.validatorMoney,
type: 1,
},
]"
label="预计费用"
clear-trigger="always"
input-align="right"
placeholder="请输入"
/>
<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="请输入"
type="textarea"
/>
<van-field
v-model="form.remark"
:disabled="disabled"
name="reason"
autosize
rows="2"
label="备注信息"
clear-trigger="always"
input-align="right"
placeholder="请输入"
type="textarea"
/>
</div>
</div>
<div class="section mt5"><span class="line"> </span>附件</div>
<div class="trips-box">
<div class="item-box">
<UploadFile :typeStr="typeStr" @onConfirm="handleUpload" :fileList="fileList" />
<UploadFile
:typeStr="typeStr"
@onConfirm="handleUpload"
:fileList="fileList"
/>
</div>
</div>
<div class="section mt5" v-if="CLSQ"> <span class="line"></span> 行程信息</div>
<div class="section mt5" v-if="CLSQ">
<span class="line"></span> 行程信息
</div>
<div class="trips-box" v-if="CLSQ">
<div class="item-box" v-for="(item,index) in form.expenseApplyTrips" :key="index">
<div
class="item-box"
v-for="(item, index) in form.expenseApplyTrips"
:key="index"
>
<div class="box-tp">
<div class="tp-lf">行程 &nbsp;{{ index + 1 }}</div>
<div class="tp-rt" v-if="!(form.expenseApplyTrips.length == 1)" @click="handleDel(index)">
<div
class="tp-rt"
v-if="!(form.expenseApplyTrips.length == 1)"
@click="handleDel(index)"
>
<van-icon name="delete-o" size="20" />
</div>
</div>
<div class="box-tt">
<RePick v-model="item.departureLocation" :disabled="disabled" label="出发地" :isCascaderAllLevelName="true" :name="`departureLocation_${index}`" :list="areaTree" isLastSelect isRequrie isCascader isShowSearch title="出发地" titleKey="name" isCell clearable />
<RePick v-model="item.destinationLocation" :disabled="disabled" label="目的地" :isCascaderAllLevelName="true" :name="`destinationLocation_${index}`" :list="areaTree" isLastSelect isRequrie isCascader isShowSearch title="destinationLocation" titleKey="name" isCell clearable />
<van-field :value="item.time" label="行程时间" :class="disabled ? 'actived-disabled':''" placeholder="请选择" required :rules="[{ required: true, message: '请选择' }]" @click="handleDateShow(index,item)" :right-icon="item.time ? '' :'arrow' " input-align="right" readonly autosize rows="1" type="textarea">
<RePick
v-model="item.departureLocation"
:disabled="disabled"
label="出发地"
:isCascaderAllLevelName="true"
:name="`departureLocation_${index}`"
:list="areaTree"
isLastSelect
isRequrie
isCascader
isShowSearch
title="出发地"
titleKey="name"
isCell
clearable
/>
<RePick
v-model="item.destinationLocation"
:disabled="disabled"
label="目的地"
:isCascaderAllLevelName="true"
:name="`destinationLocation_${index}`"
:list="areaTree"
isLastSelect
isRequrie
isCascader
isShowSearch
title="destinationLocation"
titleKey="name"
isCell
clearable
/>
<van-field
:value="item.time"
label="行程时间"
:class="disabled ? 'actived-disabled' : ''"
placeholder="请选择"
required
:rules="[{ required: true, message: '请选择' }]"
@click="handleDateShow(index, item)"
:right-icon="item.time ? '' : 'arrow'"
input-align="right"
readonly
autosize
rows="1"
type="textarea"
>
<template v-if="item.time && !disabled" #button>
<van-icon name="clear" color="#C8C9CC" size="16" @click.stop="handleClear(index,1)" />
<van-icon
name="clear"
color="#C8C9CC"
size="16"
@click.stop="handleClear(index, 1)"
/>
</template>
</van-field>
<van-field placeholder="请输入" :disabled="disabled" :rules="[{ required: true, message: '请输入' }]" v-model="item.tripDay" type="digit" :name="`tripDay_${index}`" label="出差天数" required clear-trigger="always" input-align="right">
<template #button>
</template>
<van-field
placeholder="请输入"
:disabled="disabled"
:rules="[{ required: true, message: '请输入' }]"
v-model="item.tripDay"
type="digit"
:name="`tripDay_${index}`"
label="出差天数"
required
clear-trigger="always"
input-align="right"
>
<template #button> </template>
</van-field>
<RePick v-model="item.tripType" :disabled="disabled" titleKey="label" idKey="value" label="出差类型" :name="`tripType_${index}`" :list="tripTypeList" isRequrie isCell clearable />
<RePick
v-model="item.tripType"
:disabled="disabled"
titleKey="label"
idKey="value"
label="出差类型"
:name="`tripType_${index}`"
:list="tripTypeList"
isRequrie
isCell
clearable
/>
<!-- <van-field right-icon="arrow" :class="item.tripPartners.length ? 'actived-disabled':''" placeholder="请选择" @click="handlePoShow(index)" :rules="[{ required: true, message: '请选择' }]" :name="`tripPartnersName_${index}`" v-model="item.tripPartnersName" disabled label="出差同行人" required clear-trigger="always" input-align="right" /> -->
<van-field :value="item.tripPartnersName" :class="disabled ? 'actived-disabled':''" label="出差同行人" placeholder="请选择" :rules="[{ required: false, message: '请选择' }]" @click="handlePoShow(index)" :right-icon="item.tripPartners.length ? '' :'arrow' " input-align="right" readonly autosize rows="1" type="textarea">
<van-field
:value="item.tripPartnersName"
:class="disabled ? 'actived-disabled' : ''"
label="出差同行人"
placeholder="请选择"
:rules="[{ required: false, message: '请选择' }]"
@click="handlePoShow(index)"
:right-icon="item.tripPartners.length ? '' : 'arrow'"
input-align="right"
readonly
autosize
rows="1"
type="textarea"
>
<template v-if="item.tripPartnersName && !disabled" #button>
<van-icon name="clear" color="#C8C9CC" size="16" @click.stop="handleClear(index,2)" />
<van-icon
name="clear"
color="#C8C9CC"
size="16"
@click.stop="handleClear(index, 2)"
/>
</template>
</van-field>
<van-field placeholder="请输入" :disabled="disabled" :rules="[{ required: false, message: '预计费用格式错误',validator: VerifyFunc.validatorMoney}]" v-model="item.amount" :name="`amount`" label="行程预计费用" clear-trigger="always" input-align="right">
<template #button>
</template>
<van-field
placeholder="请输入"
:disabled="disabled"
:rules="[
{
required: false,
message: '预计费用格式错误',
validator: VerifyFunc.validatorMoney,
},
]"
v-model="item.amount"
:name="`amount`"
label="行程预计费用"
clear-trigger="always"
input-align="right"
>
<template #button> </template>
</van-field>
<div class="po-box" v-if="['edit', 'add'].includes(typeStr)">
<van-button type="info" plain hairline round @click.stop="handleAddPeo(index)" native-type="button" icon="plus" size="small">添加同行人</van-button>
<van-button
type="info"
plain
hairline
round
@click.stop="handleAddPeo(index)"
native-type="button"
icon="plus"
size="small"
>添加同行人</van-button
>
</div>
<FollowPeoPle :disabled="disabled" :tripPartners="item.tripPartners" :allTripPartners="allTripPartners" :type="item.type" :isOpen="item.isOpen" @onConfirm="(arr)=>handleConfirmPo(arr,index)" @onCancel="handlePoCancel(index)" @onNewConfirm="(arr)=>handleNewConfirmPo(arr,index)" />
<FollowPeoPle
:disabled="disabled"
:tripPartners="item.tripPartners"
:allTripPartners="allTripPartners"
:type="item.type"
:isOpen="item.isOpen"
@onConfirm="(arr) => handleConfirmPo(arr, index)"
@onCancel="handlePoCancel(index)"
@onNewConfirm="(arr) => handleNewConfirmPo(arr, index)"
/>
</div>
</div>
<div class="add-box" v-if="['edit', 'add'].includes(typeStr)">
<van-button type="info" round @click.stop="handleAdd" native-type="button" icon="plus" size="small">添加行程</van-button>
<van-button
type="info"
round
@click.stop="handleAdd"
native-type="button"
icon="plus"
size="small"
>添加行程</van-button
>
</div>
</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" v-if="['show'].includes(typeStr)">
<span class="line"> </span>审批流程
</div>
<ApprovalProcess
v-if="['show'].includes(typeStr)"
:processInstanceId="form.processInstanceId"
@onSetId="handleSetAccessId"
/>
</van-form>
</div>
<BottomBtn ref="BottomBtn" :isAuthorised="isAuthorised" @onBtConfirm="handleBtConfirm" :accessId="accessId" />
<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" />
<van-calendar
ref="vanCalendar"
allow-same-day
:maxDate="maxDate"
v-model="dateShow"
:min-date="minDate"
:default-date="defaultDate"
type="range"
color="#0088FE"
@confirm="handleDateSelect"
/>
</div>
</template>
<script>
import dayjs from 'dayjs';
import { createExpenseApply, getExpenseApply, getMyExpenseApply } from '@/api/bs/expenseApply'
import { listData } from "@/api/system/dict/data";
import dayjs from 'dayjs'
import {
createExpenseApply,
getExpenseApply,
getMyExpenseApply,
} from '@/api/bs/expenseApply'
import { listData } from '@/api/system/dict/data'
import VerifyFunc from '@/utils/verify'
export default {
//import使
@ -98,8 +374,8 @@ export default {
computed: {
allTripPartners() {
let arr = []
this.form.expenseApplyTrips.forEach(v => {
v.tripPartners.forEach(z => {
this.form.expenseApplyTrips.forEach((v) => {
v.tripPartners.forEach((z) => {
arr.push(z)
})
})
@ -134,7 +410,7 @@ export default {
},
// 访DOM
mounted() {
console.log(this.userInfo, 'userInfo')
},
data() {
return {
@ -151,6 +427,19 @@ export default {
defaultDate: new Date(),
dateShow: false,
form: {
companyName: window.localStorage.getItem('cn'), //
nickname: JSON.parse(
window.localStorage.getItem('userInfo') || { dept: {} }
).nickname, //
userId: JSON.parse(
window.localStorage.getItem('userInfo') || { dept: {} }
).id, //id
deptName: JSON.parse(
window.localStorage.getItem('userInfo') || { dept: {} }
).dept.name, //
deptId: JSON.parse(
window.localStorage.getItem('userInfo') || { dept: {} }
).deptId,
applyNo: null,
projectName: null,
reason: null,
@ -167,14 +456,14 @@ export default {
tripDay: undefined,
tripType: null,
tripPartners: [], //
tripPartnersName: "",
tripPartnersName: '',
amount: undefined,
type: 0,
isOpen: false
}
]
isOpen: false,
},
};
],
},
}
},
// data
@ -197,7 +486,9 @@ export default {
return
}
this.$nextTick(() => {
this.$refs.form.validate().then(() => {
this.$refs.form
.validate()
.then(() => {
// /
let newForm = {
...this.form,
@ -205,15 +496,16 @@ export default {
status: key,
files: this.fileList,
expenseApplyTrips: (this.form.expenseApplyTrips || []).map(
item => {
(item) => {
return {
...item
...item,
}
}
)
),
}
this.$loading(true, 'form')
createExpenseApply(newForm).then((res) => {
console.log(res, 'h5网页如何使用企业微信登录')
this.$loading(false, 'form')
this.$sm(`${this.form.id ? '修改成功!' : '新增成功!'}`)
if (!this.form.id) {
@ -222,15 +514,18 @@ export default {
this.$EventBus.$emit('handleResetLive', 'company-myNewTrips')
}
history.back()
});
}).catch((err) => {
})
})
.catch((err) => {
this.$loading(false, 'form')
if (err && err.length > 0 && err[0].name) {
const fieldElement = this.$refs.form.$el.querySelector(`[name="${err[0].name}"]`);
const fieldHeight = fieldElement.offsetHeight;
const scrollHeight = fieldHeight + 50; // 50px
this.$refs.form.scrollToField(err[0].name, scrollHeight);
let amount = err.find(v => v.name === 'amount')
const fieldElement = this.$refs.form.$el.querySelector(
`[name="${err[0].name}"]`
)
const fieldHeight = fieldElement.offsetHeight
const scrollHeight = fieldHeight + 50 // 50px
this.$refs.form.scrollToField(err[0].name, scrollHeight)
let amount = err.find((v) => v.name === 'amount')
if (amount) {
this.$fm(`${amount.message}`)
return
@ -244,32 +539,39 @@ export default {
this.typeStr = type
if (id) {
this.$loading(true, 'loadingSb')
let api = listType === 'myNewTrips' ? getMyExpenseApply : getExpenseApply
api(id).then((res) => {
let api =
listType === 'myNewTrips' ? getMyExpenseApply : getExpenseApply
api(id)
.then((res) => {
this.form = {
...(res.data || {}),
expenseApplyTrips: (res.data.expenseApplyTrips || []).map(item => {
expenseApplyTrips: (res.data.expenseApplyTrips || []).map(
(item) => {
let nameArr = []
this.userList.forEach(element => {
this.userList.forEach((element) => {
if (item.tripPartners.includes(element.id)) {
nameArr.push(element.nickname)
}
});
})
return {
...item,
time: `${dayjs(item.startTime).format('YY/MM/DD')}~${dayjs(item.endTime).format('YY/MM/DD')}`,
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)
destinationLocation: Number(item.destinationLocation),
}
})
}
),
}
this.fileList = res.data.files || []
this.isAuthorised = res.data.isAuthorised
this.$nextTick(() => {
this.$refs.BottomBtn.handleFilterBtnList()
})
}).finally(() => {
})
.finally(() => {
this.$loading(false, 'loadingSb')
})
}
@ -279,26 +581,37 @@ export default {
},
handleNewConfirmPo(arr, index) {
let nameArr = []
this.userList.forEach(element => {
this.userList.forEach((element) => {
if (arr.includes(element.id)) {
nameArr.push(element.nickname)
}
});
})
this.$set(this.form.expenseApplyTrips[index], 'tripPartners', arr)
this.$set(this.form.expenseApplyTrips[index], 'tripPartnersName', nameArr.join('、'))
this.$set(
this.form.expenseApplyTrips[index],
'tripPartnersName',
nameArr.join('、')
)
this.$set(this.form.expenseApplyTrips[index], 'isOpen', false)
},
handleConfirmPo(arr, index) {
let nameArr = this.form.expenseApplyTrips[index].tripPartnersName && this.form.expenseApplyTrips[index].tripPartnersName.split('、') || []
let nameArr =
(this.form.expenseApplyTrips[index].tripPartnersName &&
this.form.expenseApplyTrips[index].tripPartnersName.split('、')) ||
[]
let newArr = this.form.expenseApplyTrips[index].tripPartners || []
this.userList.forEach(element => {
this.userList.forEach((element) => {
if (arr.includes(element.id)) {
nameArr.push(element.nickname)
newArr.push(element.id)
}
});
})
this.$set(this.form.expenseApplyTrips[index], 'tripPartners', newArr)
this.$set(this.form.expenseApplyTrips[index], 'tripPartnersName', nameArr.join('、'))
this.$set(
this.form.expenseApplyTrips[index],
'tripPartnersName',
nameArr.join('、')
)
this.$set(this.form.expenseApplyTrips[index], 'isOpen', false)
},
handlePoShow(index) {
@ -307,10 +620,8 @@ export default {
this.$set(this.form.expenseApplyTrips[index], 'type', 0)
this.$set(this.form.expenseApplyTrips[index], 'isOpen', true)
} else {
this.$fm('请先添加同行人!')
}
},
handlePoCancel(index) {
this.$set(this.form.expenseApplyTrips[index], 'isOpen', false)
@ -334,7 +645,7 @@ export default {
tripDay: undefined,
tripType: null,
tripPartners: [], //
tripPartnersName: "",
tripPartnersName: '',
amount: undefined,
isOpen: false,
type: 0,
@ -359,7 +670,10 @@ export default {
this.dateShow = true
this.index = index
if (startTime && endTime) {
this.defaultDate = [dayjs(startTime).toDate(), dayjs(endTime).toDate()]
this.defaultDate = [
dayjs(startTime).toDate(),
dayjs(endTime).toDate(),
]
}
})
},
@ -367,24 +681,44 @@ export default {
let trips = this.form.expenseApplyTrips
if (trips.length && list && list.length) {
//
let start1 = dayjs(list[0]);
let end1 = dayjs(list[1]);
let range1 = { start: start1, end: end1 };
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)
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.expenseApplyTrips[this.index], 'time', null)
return this.$fm(`行程时间范围与行程${i + 1}时间范围冲突!`)
}
}
}
this.$set(this.form.expenseApplyTrips[this.index], 'time', `${dayjs(list[0]).format('YY/MM/DD')}~${dayjs(list[1]).format('YY/MM/DD')}`)
this.$set(this.form.expenseApplyTrips[this.index], 'startTime', dayjs(list[0]).valueOf())
this.$set(this.form.expenseApplyTrips[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.expenseApplyTrips[this.index],
'time',
`${dayjs(list[0]).format('YY/MM/DD')}~${dayjs(list[1]).format(
'YY/MM/DD'
)}`
)
this.$set(
this.form.expenseApplyTrips[this.index],
'startTime',
dayjs(list[0]).valueOf()
)
this.$set(
this.form.expenseApplyTrips[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.expenseApplyTrips[this.index], 'tripDay', day)
this.dateShow = false
},

Loading…
Cancel
Save