费控修改申请人 申请部门

main
jwg 7 months ago
parent de9a0367a7
commit 7d9fcbbc2c

@ -1,14 +1,29 @@
<!-- 底部 --> <!-- 底部 -->
<template> <template>
<div class="sumbit-box" v-if="btnList.length"> <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" /> <van-icon :name="item.icon" :color="item.color" size="25" />
<div class="box-tt"> <div class="box-tt">
<span :style="`color:${item.color}`"> {{ item.title }}</span> <span :style="`color:${item.color}`"> {{ item.title }}</span>
</div> </div>
</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">
<div class="Re-select-header-cancel" @click="hanleCancel"></div> <div class="Re-select-header-cancel" @click="hanleCancel"></div>
<div class="Re-select-header-title">{{ title }}</div> <div class="Re-select-header-title">{{ title }}</div>
@ -16,8 +31,25 @@
</div> </div>
<div class="box-1"> <div class="box-1">
<div class="content-box"> <div class="content-box">
<van-form ref="form" :show-error-message="false" validate-trigger="" :submit-on-enter="false"> <van-form
<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" /> 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> </van-form>
</div> </div>
</div> </div>
@ -26,8 +58,8 @@
</template> </template>
<script> <script>
import { approveTask, rejectTask } from "@/api/bpm/task"; import { approveTask, rejectTask } from '@/api/bpm/task'
import { set } from 'vue'; // import { set } from 'vue';
export default { export default {
name: '', name: '',
props: { props: {
@ -48,7 +80,7 @@ export default {
isShow: false, isShow: false,
key: null, key: null,
form: { form: {
reason: null reason: null,
}, },
} }
}, },
@ -61,16 +93,15 @@ export default {
this.$refs.form && this.$refs.form.resetValidation() this.$refs.form && this.$refs.form.resetValidation()
}) })
} }
}
}, },
deep: true },
deep: true,
}, },
components: {}, components: {},
computed: {}, computed: {},
methods: { methods: {
hanleCancel() { hanleCancel() {
this.isShow = false this.isShow = false
@ -80,25 +111,29 @@ export default {
this.$refs.form.validate().then(() => { this.$refs.form.validate().then(() => {
let obj = { let obj = {
id: this.accessId, id: this.accessId,
reason: this.form.reason reason: this.form.reason,
} }
this.$loading(true, 'loadingSb') this.$loading(true, 'loadingSb')
if (this.key == 2) { if (this.key == 2) {
approveTask(obj).then(() => { approveTask(obj)
.then(() => {
this.$EventBus.$emit('handleResetLive', 'company-myTrips') this.$EventBus.$emit('handleResetLive', 'company-myTrips')
this.$EventBus.$emit('handleResetLive', 'company-myClaim') this.$EventBus.$emit('handleResetLive', 'company-myClaim')
history.back() history.back()
this.$loading(false, 'loadingSb') this.$loading(false, 'loadingSb')
}).catch(() => { })
.catch(() => {
this.$loading(false, 'loadingSb') this.$loading(false, 'loadingSb')
}) })
} else { } else {
rejectTask(obj).then(() => { rejectTask(obj)
.then(() => {
this.$EventBus.$emit('handleResetLive', 'company-myTrips') this.$EventBus.$emit('handleResetLive', 'company-myTrips')
this.$EventBus.$emit('handleResetLive', 'company-myClaim') this.$EventBus.$emit('handleResetLive', 'company-myClaim')
history.back() history.back()
this.$loading(false, 'loadingSb') this.$loading(false, 'loadingSb')
}).catch(() => { })
.catch(() => {
this.$loading(false, 'loadingSb') this.$loading(false, 'loadingSb')
}) })
} }
@ -122,33 +157,38 @@ export default {
setTimeout(() => { setTimeout(() => {
if (['edit', 'add'].includes(this.$route.query.type)) { if (['edit', 'add'].includes(this.$route.query.type)) {
this.btnList = [ this.btnList = [
{ title: '暂存', icon: 'star-o', color: "#909399", key: 0 }, { title: '暂存', icon: 'star-o', color: '#909399', key: 0 },
{ title: '提交', icon: 'edit', color: "#ff9900", key: 1 }, { title: '提交', icon: 'edit', color: '#ff9900', key: 1 },
{ title: '返回', icon: 'revoke', color: "#909399", key: 6 }, { title: '返回', icon: 'revoke', color: '#909399', key: 6 },
] ]
} else { } else {
if (this.isAuthorised) { if (this.isAuthorised) {
this.btnList = [ this.btnList = [
{ title: '同意', icon: 'certificate', color: "#19be6b", key: 2 }, { title: '同意', icon: 'certificate', color: '#19be6b', key: 2 },
{ title: '驳回', icon: 'exchange', color: "#fa3534", key: 3 }, { title: '驳回', icon: 'exchange', color: '#fa3534', key: 3 },
{ title: '返回', icon: 'revoke', color: "#909399", key: 6 }, { title: '返回', icon: 'revoke', color: '#909399', key: 6 },
] ]
} else { } else {
if (this.listType === 'bidder' && this.isWin != 3 && !this.isAuthorised) { if (
this.listType === 'bidder' &&
this.isWin != 3 &&
!this.isAuthorised
) {
this.btnList = [ this.btnList = [
{ title: '发起', icon: 'edit', color: "#ff9900", key: 1 }, { title: '发起', icon: 'edit', color: '#ff9900', key: 1 },
{ title: '返回', icon: 'revoke', color: "#909399", key: 6 }, { title: '返回', icon: 'revoke', color: '#909399', key: 6 },
] ]
} else { } else {
this.btnList = [{ title: '返回', icon: 'revoke', color: "#909399", key: 6 }] this.btnList = [
{ title: '返回', icon: 'revoke', color: '#909399', key: 6 },
]
} }
} }
} }
}, 0) }, 0)
}, },
},
} }
}
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
@import '../FollowPeoPle/index.scss'; @import '../FollowPeoPle/index.scss';

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

File diff suppressed because it is too large Load Diff

@ -1,87 +1,363 @@
<template> <template>
<div class="common-list-contain"> <div class="common-list-contain">
<div class="common-form"> <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="section"><span class="line"> </span> 基本信息</div>
<div class="trips-box"> <div class="trips-box">
<div class="item-box"> <div class="item-box">
<van-field v-model="form.applyNo" disabled label="单号" v-if="disabled" clear-trigger="always" input-align="right" /> <van-field
<van-field v-model="cn" disabled label="公司名称" clear-trigger="always" input-align="right" /> v-model="form.applyNo"
<van-field v-model="userInfo.nickname" disabled label="申请人" clear-trigger="always" input-align="right" maxlength="50" placeholder="请输入" /> disabled
<van-field v-model="userInfo.dept.name" disabled label="申请部门" clear-trigger="always" input-align="right" maxlength="50" placeholder="请输入" /> label="单号"
<van-field v-model="form.projectName" :disabled="disabled" label="项目名称" clear-trigger="always" input-align="right" placeholder="请输入" /> v-if="disabled"
<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="请输入" /> clear-trigger="always"
<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" /> input-align="right"
<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="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> </div>
<div class="section mt5"><span class="line"> </span>附件</div> <div class="section mt5"><span class="line"> </span>附件</div>
<div class="trips-box"> <div class="trips-box">
<div class="item-box"> <div class="item-box">
<UploadFile :typeStr="typeStr" @onConfirm="handleUpload" :fileList="fileList" /> <UploadFile
:typeStr="typeStr"
@onConfirm="handleUpload"
:fileList="fileList"
/>
</div> </div>
</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="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="box-tp">
<div class="tp-lf">行程 &nbsp;{{ index + 1 }}</div> <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" /> <van-icon name="delete-o" size="20" />
</div> </div>
</div> </div>
<div class="box-tt"> <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
<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 /> v-model="item.departureLocation"
<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"> :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> <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> </template>
</van-field> </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"> <van-field
<template #button> placeholder="请输入"
:disabled="disabled"
</template> :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> </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 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> <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> </template>
</van-field> </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"> <van-field
<template #button> placeholder="请输入"
:disabled="disabled"
</template> :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> </van-field>
<div class="po-box" v-if="['edit', 'add'].includes(typeStr)"> <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> </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> </div>
<div class="add-box" v-if="['edit', 'add'].includes(typeStr)"> <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> </div>
<div class="section mt5" v-if="['show'].includes(typeStr)"> <span class="line"> </span>审批流程</div> <div class="section mt5" v-if="['show'].includes(typeStr)">
<ApprovalProcess v-if="['show'].includes(typeStr)" :processInstanceId="form.processInstanceId" @onSetId="handleSetAccessId" /> <span class="line"> </span>审批流程
</div>
<ApprovalProcess
v-if="['show'].includes(typeStr)"
:processInstanceId="form.processInstanceId"
@onSetId="handleSetAccessId"
/>
</van-form> </van-form>
</div> </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> </div>
</template> </template>
<script> <script>
import dayjs from 'dayjs'; import dayjs from 'dayjs'
import { createExpenseApply, getExpenseApply, getMyExpenseApply } from '@/api/bs/expenseApply' import {
import { listData } from "@/api/system/dict/data"; createExpenseApply,
getExpenseApply,
getMyExpenseApply,
} from '@/api/bs/expenseApply'
import { listData } from '@/api/system/dict/data'
import VerifyFunc from '@/utils/verify' import VerifyFunc from '@/utils/verify'
export default { export default {
//import使 //import使
@ -98,8 +374,8 @@ export default {
computed: { computed: {
allTripPartners() { allTripPartners() {
let arr = [] let arr = []
this.form.expenseApplyTrips.forEach(v => { this.form.expenseApplyTrips.forEach((v) => {
v.tripPartners.forEach(z => { v.tripPartners.forEach((z) => {
arr.push(z) arr.push(z)
}) })
}) })
@ -134,7 +410,7 @@ export default {
}, },
// 访DOM // 访DOM
mounted() { mounted() {
console.log(this.userInfo, 'userInfo')
}, },
data() { data() {
return { return {
@ -151,6 +427,19 @@ export default {
defaultDate: new Date(), defaultDate: new Date(),
dateShow: false, dateShow: false,
form: { 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, applyNo: null,
projectName: null, projectName: null,
reason: null, reason: null,
@ -167,14 +456,14 @@ export default {
tripDay: undefined, tripDay: undefined,
tripType: null, tripType: null,
tripPartners: [], // tripPartners: [], //
tripPartnersName: "", tripPartnersName: '',
amount: undefined, amount: undefined,
type: 0, type: 0,
isOpen: false isOpen: false,
}
]
}, },
}; ],
},
}
}, },
// data // data
@ -197,7 +486,9 @@ export default {
return return
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.form.validate().then(() => { this.$refs.form
.validate()
.then(() => {
// / // /
let newForm = { let newForm = {
...this.form, ...this.form,
@ -205,15 +496,16 @@ export default {
status: key, status: key,
files: this.fileList, files: this.fileList,
expenseApplyTrips: (this.form.expenseApplyTrips || []).map( expenseApplyTrips: (this.form.expenseApplyTrips || []).map(
item => { (item) => {
return { return {
...item ...item,
} }
} }
) ),
} }
this.$loading(true, 'form') this.$loading(true, 'form')
createExpenseApply(newForm).then((res) => { createExpenseApply(newForm).then((res) => {
console.log(res, 'h5网页如何使用企业微信登录')
this.$loading(false, 'form') this.$loading(false, 'form')
this.$sm(`${this.form.id ? '修改成功!' : '新增成功!'}`) this.$sm(`${this.form.id ? '修改成功!' : '新增成功!'}`)
if (!this.form.id) { if (!this.form.id) {
@ -222,15 +514,18 @@ export default {
this.$EventBus.$emit('handleResetLive', 'company-myNewTrips') this.$EventBus.$emit('handleResetLive', 'company-myNewTrips')
} }
history.back() history.back()
}); })
}).catch((err) => { })
.catch((err) => {
this.$loading(false, 'form') this.$loading(false, 'form')
if (err && err.length > 0 && err[0].name) { if (err && err.length > 0 && err[0].name) {
const fieldElement = this.$refs.form.$el.querySelector(`[name="${err[0].name}"]`); const fieldElement = this.$refs.form.$el.querySelector(
const fieldHeight = fieldElement.offsetHeight; `[name="${err[0].name}"]`
const scrollHeight = fieldHeight + 50; // 50px )
this.$refs.form.scrollToField(err[0].name, scrollHeight); const fieldHeight = fieldElement.offsetHeight
let amount = err.find(v => v.name === 'amount') const scrollHeight = fieldHeight + 50 // 50px
this.$refs.form.scrollToField(err[0].name, scrollHeight)
let amount = err.find((v) => v.name === 'amount')
if (amount) { if (amount) {
this.$fm(`${amount.message}`) this.$fm(`${amount.message}`)
return return
@ -244,32 +539,39 @@ export default {
this.typeStr = type this.typeStr = type
if (id) { if (id) {
this.$loading(true, 'loadingSb') this.$loading(true, 'loadingSb')
let api = listType === 'myNewTrips' ? getMyExpenseApply : getExpenseApply let api =
api(id).then((res) => { listType === 'myNewTrips' ? getMyExpenseApply : getExpenseApply
api(id)
.then((res) => {
this.form = { this.form = {
...(res.data || {}), ...(res.data || {}),
expenseApplyTrips: (res.data.expenseApplyTrips || []).map(item => { expenseApplyTrips: (res.data.expenseApplyTrips || []).map(
(item) => {
let nameArr = [] let nameArr = []
this.userList.forEach(element => { this.userList.forEach((element) => {
if (item.tripPartners.includes(element.id)) { if (item.tripPartners.includes(element.id)) {
nameArr.push(element.nickname) nameArr.push(element.nickname)
} }
}); })
return { return {
...item, ...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('、'), tripPartnersName: nameArr.join('、'),
departureLocation: Number(item.departureLocation), departureLocation: Number(item.departureLocation),
destinationLocation: Number(item.destinationLocation) destinationLocation: Number(item.destinationLocation),
} }
}) }
),
} }
this.fileList = res.data.files || [] this.fileList = res.data.files || []
this.isAuthorised = res.data.isAuthorised this.isAuthorised = res.data.isAuthorised
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.BottomBtn.handleFilterBtnList() this.$refs.BottomBtn.handleFilterBtnList()
}) })
}).finally(() => { })
.finally(() => {
this.$loading(false, 'loadingSb') this.$loading(false, 'loadingSb')
}) })
} }
@ -279,26 +581,37 @@ export default {
}, },
handleNewConfirmPo(arr, index) { handleNewConfirmPo(arr, index) {
let nameArr = [] let nameArr = []
this.userList.forEach(element => { this.userList.forEach((element) => {
if (arr.includes(element.id)) { if (arr.includes(element.id)) {
nameArr.push(element.nickname) nameArr.push(element.nickname)
} }
}); })
this.$set(this.form.expenseApplyTrips[index], 'tripPartners', arr) 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) this.$set(this.form.expenseApplyTrips[index], 'isOpen', false)
}, },
handleConfirmPo(arr, index) { 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 || [] let newArr = this.form.expenseApplyTrips[index].tripPartners || []
this.userList.forEach(element => { this.userList.forEach((element) => {
if (arr.includes(element.id)) { if (arr.includes(element.id)) {
nameArr.push(element.nickname) nameArr.push(element.nickname)
newArr.push(element.id) newArr.push(element.id)
} }
}); })
this.$set(this.form.expenseApplyTrips[index], 'tripPartners', newArr) 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) this.$set(this.form.expenseApplyTrips[index], 'isOpen', false)
}, },
handlePoShow(index) { handlePoShow(index) {
@ -307,10 +620,8 @@ export default {
this.$set(this.form.expenseApplyTrips[index], 'type', 0) this.$set(this.form.expenseApplyTrips[index], 'type', 0)
this.$set(this.form.expenseApplyTrips[index], 'isOpen', true) this.$set(this.form.expenseApplyTrips[index], 'isOpen', true)
} else { } else {
this.$fm('请先添加同行人!') this.$fm('请先添加同行人!')
} }
}, },
handlePoCancel(index) { handlePoCancel(index) {
this.$set(this.form.expenseApplyTrips[index], 'isOpen', false) this.$set(this.form.expenseApplyTrips[index], 'isOpen', false)
@ -334,7 +645,7 @@ export default {
tripDay: undefined, tripDay: undefined,
tripType: null, tripType: null,
tripPartners: [], // tripPartners: [], //
tripPartnersName: "", tripPartnersName: '',
amount: undefined, amount: undefined,
isOpen: false, isOpen: false,
type: 0, type: 0,
@ -359,7 +670,10 @@ export default {
this.dateShow = true this.dateShow = true
this.index = index this.index = index
if (startTime && endTime) { 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 let trips = this.form.expenseApplyTrips
if (trips.length && list && list.length) { if (trips.length && list && list.length) {
// //
let start1 = dayjs(list[0]); let start1 = dayjs(list[0])
let end1 = dayjs(list[1]); let end1 = dayjs(list[1])
let range1 = { start: start1, end: end1 }; let range1 = { start: start1, end: end1 }
for (let i = 0; i < trips.length; i++) { for (let i = 0; i < trips.length; i++) {
let start2 = dayjs(trips[i].startTime); let start2 = dayjs(trips[i].startTime)
let end2 = dayjs(trips[i].endTime); let end2 = dayjs(trips[i].endTime)
let range2 = { start: start2, end: end2 }; let range2 = { start: start2, end: end2 }
if (this.index !== i && range1.start.isBefore(range2.end) && range2.start.isBefore(range1.end) if (
this.index !== i &&
range1.start.isBefore(range2.end) &&
range2.start.isBefore(range1.end)
) { ) {
this.$set(this.form.expenseApplyTrips[this.index], 'time', null) this.$set(this.form.expenseApplyTrips[this.index], 'time', null)
return this.$fm(`行程时间范围与行程${i + 1}时间范围冲突!`) 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.$set(this.form.expenseApplyTrips[this.index], 'startTime', dayjs(list[0]).valueOf()) this.form.expenseApplyTrips[this.index],
this.$set(this.form.expenseApplyTrips[this.index], 'endTime', dayjs(list[1]).valueOf()) 'time',
let day = list && list.length && Number(dayjs(list[1]).diff(dayjs(list[0]), 'day')) + 1 `${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.$set(this.form.expenseApplyTrips[this.index], 'tripDay', day)
this.dateShow = false this.dateShow = false
}, },

Loading…
Cancel
Save