|
|
|
@ -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">
|
|
|
|
|
<div class="section"> <span class="line"> </span> 基本信息</div>
|
|
|
|
|
<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="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"> 行程 {{index + 1}}</div>
|
|
|
|
|
<div class="tp-rt" v-if="!(form.expenseApplyTrips.length == 1)" @click="handleDel(index)">
|
|
|
|
|
<div class="tp-lf">行程 {{ index + 1 }}</div>
|
|
|
|
|
<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>
|
|
|
|
|
<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
|
|
|
|
|
>
|
|
|
|
|
</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>
|
|
|
|
|
<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
|
|
|
|
|
>
|
|
|
|
|
</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
|
|
|
|
|
},
|
|
|
|
|