1897 lines
55 KiB
Vue
1897 lines
55 KiB
Vue
<template>
|
||
<view class="container">
|
||
<!-- <u-collapse :value="['trunk', 'basic']" :border="false">
|
||
<u-collapse-item title="异动车辆" ref="uploadCollapse" name="trunk"> -->
|
||
<view class="header">异动车辆</view>
|
||
<view class="item">
|
||
<view class="title plateNumber required">车牌号</view>
|
||
<u-picker
|
||
:show="showPlateNumberPicker"
|
||
:columns="[truckList]"
|
||
keyName="plateNumber"
|
||
:disabled="disabled || isPassAudit"
|
||
:immediateChange="true"
|
||
@confirm="confirmPlateNumber"
|
||
@cancel="cancelPlateNumber"
|
||
>
|
||
</u-picker>
|
||
<!-- 需求多辆车改单辆,多辆车不能在cancel这里写逻辑代码所以用的方法 -->
|
||
<u-input
|
||
border="surround"
|
||
:value="datas.plateNumber"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
@tap="searchPlatNumber"
|
||
>
|
||
</u-input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动驶出停车场</view>
|
||
<u-picker
|
||
:show="showTrunkParkPicker"
|
||
:columns="[parkingList]"
|
||
keyName="parkingName"
|
||
:immediateChange="true"
|
||
@confirm="confirmStartPark"
|
||
@cancel="cancelStartPark"
|
||
>
|
||
</u-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
:value="datas.startParkingName"
|
||
@tap="showrStartParkPicker"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动城市</view>
|
||
<u-picker
|
||
:show="showCityPicker"
|
||
:columns="[cityCode]"
|
||
keyName="dicName"
|
||
:disabled="disabled || isPassAudit"
|
||
:immediateChange="true"
|
||
@confirm="confirmCity"
|
||
@cancel="showCityPicker = false"
|
||
>
|
||
</u-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
:value="getCityName(datas.cityCode)"
|
||
@tap="!disabled && !isPassAudit && (showCityPicker = true)"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动开始里程</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled || isPassAudit"
|
||
v-model="datas.startMileage"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">Km</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
|
||
<view class="item" v-if="isPassAudit">
|
||
<view class="title required">异动结束里程</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled"
|
||
:value="datas.endMileage"
|
||
@change="mileageChange"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">Km</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item" v-if="isPassAudit">
|
||
<view class="title">异动里程</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="true"
|
||
:value="
|
||
!datas.numberMileage || datas.numberMileage < 0
|
||
? 0
|
||
: datas.numberMileage
|
||
"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">Km</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动开始氢量</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled || isPassAudit"
|
||
v-model="datas.startHydrogen"
|
||
fontSize="26"
|
||
type="digit"
|
||
:customStyle="{
|
||
paddingTop: '0',
|
||
paddingBottom: '0',
|
||
paddingRight: '0',
|
||
}"
|
||
>
|
||
<template slot="suffix">
|
||
<uni-section type="line">
|
||
<uni-data-select
|
||
v-model="datas.hydrogenUnit"
|
||
placeholder="请选择"
|
||
:localdata="range"
|
||
:disabled="disabled || isPassAudit"
|
||
></uni-data-select>
|
||
</uni-section>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item" v-if="isPassAudit">
|
||
<view class="title required">异动结束氢量</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled"
|
||
v-model="datas.endHydrogen"
|
||
fontSize="26"
|
||
type="digit"
|
||
:customStyle="{
|
||
paddingTop: '0',
|
||
paddingBottom: '0',
|
||
paddingRight: '0',
|
||
}"
|
||
>
|
||
<template slot="suffix">
|
||
<uni-section type="line">
|
||
<uni-data-select
|
||
v-model="datas.hydrogenUnit"
|
||
placeholder="请选择"
|
||
:localdata="range"
|
||
disabled
|
||
></uni-data-select>
|
||
</uni-section>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动开始电量</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled || isPassAudit"
|
||
v-model="datas.startElectricity"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">%</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item" v-if="isPassAudit">
|
||
<view class="title required">异动结束电量</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled"
|
||
v-model="datas.endElectricity"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">%</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<!-- <view v-for="(item, index) in datas.truckList" :key="index">
|
||
<view class="item">
|
||
<view class="title plateNumber required">车牌号</view>
|
||
<u-picker
|
||
:show="showPlateNumberPicker[index]"
|
||
:columns="[truckList]"
|
||
keyName="plateNumber"
|
||
:disabled="disabled || isPassAudit"
|
||
:immediateChange="true"
|
||
@confirm="confirmPlateNumber($event, index)"
|
||
@cancel="cancelPlateNumber(index)"
|
||
>
|
||
</u-picker>
|
||
<u-input
|
||
border="surround"
|
||
:value="item.plateNumber"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
@tap="searchPlatNumber(index)"
|
||
>
|
||
</u-input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">城市</view>
|
||
<u-picker
|
||
:show="showCityPicker"
|
||
:columns="[cityCode]"
|
||
keyName="dicName"
|
||
:disabled="disabled || isPassAudit"
|
||
:immediateChange="true"
|
||
@confirm="confirmCity"
|
||
@cancel="showCityPicker = false"
|
||
>
|
||
</u-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
:value="getCityName(datas.cityCode)"
|
||
@tap="!disabled && !isPassAudit && (showCityPicker = true)"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动驶出停车场</view>
|
||
<u-picker
|
||
:show="showTrunkParkPicker[index]"
|
||
:columns="[parkingList]"
|
||
keyName="parkingName"
|
||
:immediateChange="true"
|
||
@confirm="confirmStartPark($event, index)"
|
||
@cancel="cancelStartPark(index)"
|
||
>
|
||
</u-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
:value="item.startParkingName"
|
||
@tap="showrStartParkPicker(index)"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
|
||
<view class="item">
|
||
<view class="title required">异动开始里程</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled || isPassAudit"
|
||
:value="item.startMileage"
|
||
@change="forEachInputChange($event, index, 'startMileage')"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">Km</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
|
||
<view class="item" v-if="isPassAudit">
|
||
<view class="title">异动结束里程</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled"
|
||
:value="item.endMileage"
|
||
@change="mileageChange($event, index)"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">Km</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item" v-if="isPassAudit">
|
||
<view class="title">异动里程</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="true"
|
||
:value="
|
||
!item.numberMileage || item.numberMileage < 0
|
||
? 0
|
||
: item.numberMileage
|
||
"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">Km</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动开始氢量</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled || isPassAudit"
|
||
:value="item.startHydrogen"
|
||
@change="forEachInputChange($event, index, 'startHydrogen')"
|
||
fontSize="26"
|
||
type="digit"
|
||
:customStyle="{
|
||
paddingTop: '0',
|
||
paddingBottom: '0',
|
||
paddingRight: '0',
|
||
}"
|
||
>
|
||
<template slot="suffix">
|
||
<uni-section type="line">
|
||
<uni-data-select
|
||
v-model="datas.truckList[index].hydrogenUnit"
|
||
placeholder="请选择"
|
||
:localdata="range"
|
||
@change="(e) => changeUnit(e, index)"
|
||
:disabled="disabled || isPassAudit"
|
||
></uni-data-select>
|
||
</uni-section>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item" v-if="isPassAudit">
|
||
<view class="title required">异动结束氢量</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled"
|
||
:value="item.endHydrogen"
|
||
@change="forEachInputChange($event, index, 'endHydrogen')"
|
||
fontSize="26"
|
||
type="digit"
|
||
:customStyle="{
|
||
paddingTop: '0',
|
||
paddingBottom: '0',
|
||
paddingRight: '0',
|
||
}"
|
||
>
|
||
<template slot="suffix">
|
||
<uni-section type="line">
|
||
<uni-data-select
|
||
v-model="datas.truckList[index].hydrogenUnit"
|
||
placeholder="请选择"
|
||
:localdata="range"
|
||
disabled
|
||
></uni-data-select>
|
||
</uni-section>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动开始电量</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled || isPassAudit"
|
||
:value="item.startElectricity"
|
||
@change="forEachInputChange($event, index, 'startElectricity')"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">%</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item" v-if="isPassAudit">
|
||
<view class="title">异动结束电量</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled"
|
||
:value="item.endElectricity"
|
||
@change="forEachInputChange($event, index, 'endElectricity')"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">%</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item" v-if="!isPassAudit">
|
||
<view class="truckListBtns">
|
||
<button
|
||
:class="{ disabled: isRead }"
|
||
:disabled="isRead"
|
||
class="add"
|
||
@tap="addForm"
|
||
>
|
||
添加
|
||
</button>
|
||
<button
|
||
:class="{ disabled: isRead }"
|
||
:disabled="isRead"
|
||
class="del"
|
||
@tap="delForm(index)"
|
||
>
|
||
删除
|
||
</button>
|
||
</view>
|
||
</view>
|
||
</view> -->
|
||
<view class="header" style="margin-top: 15px">异动申请</view>
|
||
<view class="item">
|
||
<view class="title required">异动类型</view>
|
||
<u-picker
|
||
:show="showTransactionTypePicker"
|
||
:columns="[transactionTypeList]"
|
||
keyName="dicName"
|
||
:immediateChange="true"
|
||
@confirm="confirmTransactionType"
|
||
@cancel="showTransactionTypePicker = false"
|
||
>
|
||
</u-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
:value="datas.transactionTypeText"
|
||
@tap="!disabled && !isPassAudit && (showTransactionTypePicker = true)"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
<view class="item" v-if="datas.transactionType == 9">
|
||
<view class="title required">异动原因</view>
|
||
<u--textarea
|
||
border="surround"
|
||
:disabled="disabled || isPassAudit"
|
||
v-model="datas.transactionReason"
|
||
fontSize="26"
|
||
></u--textarea>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title">预计异动里程</view>
|
||
<u-input
|
||
border="surround"
|
||
:disabled="disabled || isPassAudit"
|
||
v-model="datas.planMoveMileage"
|
||
fontSize="26"
|
||
type="digit"
|
||
>
|
||
<template slot="suffix">
|
||
<text class="unit">Km</text>
|
||
</template>
|
||
</u-input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动开始时间</view>
|
||
<u-datetime-picker
|
||
placeholder="请选择日期"
|
||
:disabled="disabled || isPassAudit"
|
||
:show="showStartTimePicker"
|
||
mode="datetime"
|
||
@confirm="(e) => confirmStartTime(e)"
|
||
@cancel="showStartTimePicker = false"
|
||
></u-datetime-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
fontSize="26"
|
||
disabled
|
||
:value="formatDateTime(datas.transactionStartTime, 'minute')"
|
||
@tap="!disabled && !isPassAudit && (showStartTimePicker = true)"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">预计异动结束时间</view>
|
||
<u-datetime-picker
|
||
placeholder="请选择日期"
|
||
:disabled="disabled || isPassAudit"
|
||
:show="showPlanEndTimePicker"
|
||
mode="datetime"
|
||
@confirm="(e) => confirmPlanEndTime(e)"
|
||
@cancel="showPlanEndTimePicker = false"
|
||
></u-datetime-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
fontSize="26"
|
||
disabled
|
||
:value="formatDateTime(datas.planTransactionEndTime, 'minute')"
|
||
@tap="!disabled && !isPassAudit && (showPlanEndTimePicker = true)"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
<view class="item" v-if="isPassAudit">
|
||
<view class="title required">异动结束时间</view>
|
||
<u-datetime-picker
|
||
placeholder="请选择日期"
|
||
:disabled="disabled"
|
||
:show="showEndTimePicker"
|
||
mode="datetime"
|
||
@confirm="(e) => confirmEndTime(e)"
|
||
@cancel="showEndTimePicker = false"
|
||
></u-datetime-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled ? '#f5f7fa' : '#ffffff'"
|
||
fontSize="26"
|
||
disabled
|
||
:value="formatDateTime(datas.transactionEndTime, 'minute')"
|
||
@tap="!disabled && (showEndTimePicker = true)"
|
||
>
|
||
</u--input>
|
||
<!-- <u-icon name="close" size="26" @click="e=> clearEndTime(e,index)"></u-icon> -->
|
||
</view>
|
||
<view class="item">
|
||
<view class="title required">异动目的地</view>
|
||
<u-picker
|
||
:show="showParkOrFixPicker"
|
||
:columns="[addressTypeList]"
|
||
keyName="dicName"
|
||
:immediateChange="true"
|
||
@confirm="confirmIsParkOrFix"
|
||
@cancel="showParkOrFixPicker = false"
|
||
>
|
||
</u-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
:value="datas.addressTypeText"
|
||
@tap="!disabled && !isPassAudit && (showParkOrFixPicker = true)"
|
||
>
|
||
</u--input>
|
||
<view style="margin-top: 10rpx" v-if="datas.transactionAddressType == 1">
|
||
<u-picker
|
||
:show="showParkPicker"
|
||
:columns="[parkingList]"
|
||
keyName="parkingName"
|
||
:immediateChange="true"
|
||
@confirm="confirmPark"
|
||
@cancel="showParkPicker = false"
|
||
>
|
||
</u-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
:value="datas.transactionAddressText"
|
||
@tap="!disabled && !isPassAudit && (showParkPicker = true)"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
<view style="margin-top: 10rpx" v-if="datas.transactionAddressType == 2">
|
||
<u-picker
|
||
:show="showFixPicker"
|
||
:columns="[maintainSite]"
|
||
keyName="name"
|
||
:immediateChange="true"
|
||
@confirm="confirmFix"
|
||
@cancel="showFixPicker = false"
|
||
>
|
||
</u-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled || isPassAudit ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
:value="datas.transactionAddressText"
|
||
@tap="!disabled && !isPassAudit && (showFixPicker = true)"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
<view style="margin-top: 10rpx" v-if="datas.transactionAddressType == 3">
|
||
<u--input
|
||
:disabled="disabled || isPassAudit"
|
||
border="surround"
|
||
v-model="datas.transactionAddress"
|
||
fontSize="26"
|
||
></u--input>
|
||
</view>
|
||
</view>
|
||
<view v-if="isPassAudit" class="item">
|
||
<view class="title required">异动结束停车场</view>
|
||
<u-picker
|
||
:show="showEndParkPicker"
|
||
:columns="[parkingList]"
|
||
keyName="parkingName"
|
||
:immediateChange="true"
|
||
@confirm="confirmEndPark"
|
||
@cancel="showEndParkPicker = false"
|
||
>
|
||
</u-picker>
|
||
<u--input
|
||
border="surround"
|
||
:disabledColor="disabled ? '#f5f7fa' : '#ffffff'"
|
||
disabled
|
||
fontSize="26"
|
||
:value="datas.endParkingText"
|
||
@tap="!disabled && (showEndParkPicker = true)"
|
||
>
|
||
</u--input>
|
||
</view>
|
||
<view class="item">
|
||
<view class="title">备注</view>
|
||
<u--textarea
|
||
border="surround"
|
||
:disabled="disabled || isPassAudit"
|
||
v-model="datas.remark"
|
||
fontSize="26"
|
||
></u--textarea>
|
||
</view>
|
||
<view class="item" v-if="isAudit">
|
||
<view class="title">审批意见</view>
|
||
<u--textarea
|
||
border="surround"
|
||
:disabled="!isAudit"
|
||
v-model="datas.approvalOpinion"
|
||
fontSize="26"
|
||
></u--textarea>
|
||
</view>
|
||
|
||
<u-loading-page
|
||
bg-color="#ffffff"
|
||
color="#7ba746"
|
||
font-size="24"
|
||
:loading="loading"
|
||
:loading-text="loadingText"
|
||
></u-loading-page>
|
||
|
||
<view class="btns">
|
||
<button
|
||
v-if="!isAudit"
|
||
class="done"
|
||
:class="{ disabled: isRead }"
|
||
:disabled="isRead"
|
||
@tap="submitConfirm"
|
||
>
|
||
提交
|
||
</button>
|
||
<button
|
||
v-if="!isAudit"
|
||
class="done"
|
||
:class="{ disabled: isRead }"
|
||
:disabled="isRead"
|
||
@tap="saveConfirm"
|
||
>
|
||
保存
|
||
</button>
|
||
<button v-if="isAudit" class="done" @tap="passConfirm">通过</button>
|
||
<button v-if="isAudit" class="done" @tap="rejectConfirm">驳回</button>
|
||
<button class="cancel" @tap="navigateBack">取消</button>
|
||
</view>
|
||
|
||
<view style="width: 0px; height: 0px; overflow: hidden">
|
||
<canvas
|
||
:style="
|
||
'width: ' +
|
||
canvasWidth +
|
||
'px; height:' +
|
||
canvasHeight +
|
||
'px;left:8888px'
|
||
"
|
||
canvas-id="myCanvas"
|
||
></canvas>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
options: {
|
||
styleIsolation: "shared", // 解除样式隔离
|
||
},
|
||
|
||
data() {
|
||
return {
|
||
datas: {
|
||
transactionType: "", //异动类型
|
||
transactionTypeText: "", //异动类型文字
|
||
transactionAddressType: "", // 目的地类型
|
||
addressTypeText: "", // 目的地类型文字
|
||
transactionAddress: "", //目的地value
|
||
transactionAddressText: "", //
|
||
transactionParking: "", //异动结束停车场
|
||
endParkingText: "", //目的地停车场
|
||
transactionStartTime: null,
|
||
planTransactionEndTime: null,
|
||
transactionEndTime: null,
|
||
hydrogenUnit: "",
|
||
hydrogenUnitName: "",
|
||
startParkingName: "",
|
||
plateNumber: "",
|
||
address: "",
|
||
startParking: "",
|
||
startMileage: null,
|
||
startHydrogen: "",
|
||
startElectricity: "",
|
||
truckId: null,
|
||
// truckList: [
|
||
// {
|
||
// hydrogenUnit: "",
|
||
// hydrogenUnitName: "",
|
||
// startParkingName: "",
|
||
// plateNumber: "",
|
||
// address: "",
|
||
// startParking: "",
|
||
// startMileage: null,
|
||
// startHydrogen: "",
|
||
// startElectricity: "",
|
||
// truckId: null,
|
||
// },
|
||
// ],
|
||
},
|
||
showParkOrFixPicker: false,
|
||
showTransactionTypePicker: false, //异动类型 数据字典
|
||
showParkPicker: false,
|
||
showFixPicker: false,
|
||
address: "",
|
||
id: null,
|
||
brands: [], // 车辆品牌字典列表
|
||
truckType: [], // 车辆型号字典列表,
|
||
contractAuthorizerInformationList: [], // 授权人列表
|
||
truckList: [], // 车辆列表
|
||
cityCode: [], // 城市列表
|
||
showAuthorizerPicker: false,
|
||
showStartTimePicker: false, // 异动开始时间是否弹出
|
||
showPlanEndTimePicker: false, // 异动计划结束时间是否弹出
|
||
showEndTimePicker: false, // 异动结束时间是否弹出
|
||
showEndParkPicker: false, // 异动结束停车场是否弹出
|
||
showCityPicker: false, // 城市列表是否弹出
|
||
showApprovaUserlPicker: false, // 审批人列表是否弹出
|
||
platNumberDisabled: true,
|
||
//showPlateNumberPicker: [false],
|
||
//showTrunkParkPicker: [false],需求多辆车改单辆
|
||
showPlateNumberPicker: false,
|
||
showTrunkParkPicker: false,
|
||
//fileLists: [], // 包含所有车辆的fileList
|
||
users: [], // 角色列表
|
||
canvasWidth: 0,
|
||
canvasHeight: 0,
|
||
isRead: false, // 页面是否处于阅读模式
|
||
isAudit: false, // 是否处于审批模式
|
||
loading: false,
|
||
loadingText: "加载中...",
|
||
isAdd: false, // 是否处于新增场景
|
||
isPassAudit: false, // 是否已审批通过
|
||
parkingList: [],
|
||
maintainSite: [], // 维修站
|
||
addressTypeList: [], // 异动地点类型
|
||
transactionTypeList: [], // 异动类型
|
||
range: [
|
||
{ value: 1, text: "%" },
|
||
{ value: 2, text: "MPa" },
|
||
{ value: 3, text: "kg" },
|
||
], // 氢量单位
|
||
};
|
||
},
|
||
methods: {
|
||
async maintainSiteSelect() {
|
||
await this.$api.returnCar.getFixPageList().then((res) => {
|
||
console.log(res);
|
||
this.maintainSite = res;
|
||
});
|
||
},
|
||
async getTransactionTypeList() {
|
||
await this.$api.unusualActionApply.getTransactionType().then((res) => {
|
||
console.log(`getTransactionType:`, res);
|
||
this.transactionTypeList = res;
|
||
});
|
||
},
|
||
async getTransactionAddressType() {
|
||
await this.$api.unusualActionApply
|
||
.getTransactionAddressType()
|
||
.then((res) => {
|
||
console.log(`getTransactionAddressType:`, res);
|
||
this.addressTypeList = res;
|
||
});
|
||
},
|
||
async getParkList() {
|
||
await this.$api.returnCar
|
||
.getParkingPageList({
|
||
pageNo: 1,
|
||
pageSize: 999,
|
||
})
|
||
.then((res) => {
|
||
if (res) {
|
||
let datas = res?.data;
|
||
this.parkingList = datas.records || [];
|
||
}
|
||
});
|
||
},
|
||
async getData() {
|
||
// 没有id,说明是要新增,不请求接口
|
||
if (!this.id) {
|
||
// this.datas.truckList = [
|
||
// {
|
||
// hydrogenUnit: "",
|
||
// hydrogenUnitName: "",
|
||
// startParkingName: "",
|
||
// plateNumber: "",
|
||
// address: "",
|
||
// startParking: "",
|
||
// startMileage: null,
|
||
// startHydrogen: "",
|
||
// startElectricity: "",
|
||
// truckId: null,
|
||
// },
|
||
// ];
|
||
// this.fileLists[0] = [];
|
||
// this.truckList = await this.$api.truck.queryAuthListByPlateNumber();
|
||
// this.users = await this.$api.unusualActionApply.getRoleList();
|
||
// this.$nextTick(() => {
|
||
// this.$refs.uploadCollapse.init();
|
||
// });
|
||
return;
|
||
}
|
||
this.$api.unusualActionApply
|
||
.getTakeId({ id: this.id })
|
||
.then(async (res) => {
|
||
this.datas = res?.data;
|
||
|
||
if ([30, 50, 60].includes(this.datas.approvalStatus)) {
|
||
this.isPassAudit = true;
|
||
}
|
||
|
||
//回显下拉框选中项
|
||
this.datas.addressTypeText = this.addressTypeList.filter(
|
||
(item) => item.dicCode == this.datas.transactionAddressType
|
||
)[0]?.dicName; //目的地类型
|
||
if (this.datas.transactionAddressType === 1) {
|
||
this.datas.transactionAddressText = this.parkingList.filter(
|
||
(item) => item.id == this.datas.transactionAddress
|
||
)[0]?.parkingName; //停车场
|
||
} else if (this.datas.transactionAddressType === 2) {
|
||
this.datas.transactionAddressText =
|
||
this.maintainSite.find(
|
||
(item) => item.id == this.datas.transactionAddress
|
||
)?.name ?? ""; //维修站
|
||
}
|
||
//回显异动结束停车场
|
||
console.log(this.parkingList);
|
||
console.log(
|
||
this.parkingList.find(
|
||
(item) => item.id == this.datas.transactionParking
|
||
)
|
||
);
|
||
this.datas.endParkingText =
|
||
this.parkingList.find(
|
||
(item) => item.id == this.datas.transactionParking
|
||
)?.parkingName ?? ""; //目的地类型
|
||
|
||
// this.users = await this.$api.unusualActionApply.getRoleList();
|
||
|
||
// // 根据审批人id得到审批人姓名
|
||
// if (this.datas.approvalId && this.users.length) {
|
||
// const approvalUser = this.users.find(
|
||
// (user) => user.id === this.datas.approvalId
|
||
// );
|
||
// this.datas.approvalName = approvalUser?.name ?? null;
|
||
// }
|
||
//回显异动类型
|
||
this.datas.transactionTypeText = this.transactionTypeList.filter(
|
||
(item) => item.dicCode == this.datas.transactionType
|
||
)[0]?.dicName; //回显异动类型
|
||
//根据停车场ID获取停车场名称
|
||
const parkingSel = this.parkingList.find(
|
||
(item) => item.id === this.datas.startParking
|
||
);
|
||
this.datas.startParkingName = parkingSel?.parkingName ?? null;
|
||
|
||
//计算异动里程
|
||
this.$set(
|
||
this.datas,
|
||
"numberMileage",
|
||
Number(this.datas.endMileage) - Number(this.datas.startMileage) || 0
|
||
);
|
||
this.truckList = await this.$api.truck
|
||
.getAllTruckList()
|
||
.then((res) => {
|
||
return res?.data || [];
|
||
});
|
||
//回显车辆---单辆车信息
|
||
const truckId = this.datas.truckId;
|
||
const truck = this.truckList.find((x) => x.id == truckId);
|
||
console.log(truck);
|
||
this.datas.plateNumber = truck?.plateNumber ?? null;
|
||
// 根据车辆id得到车牌号
|
||
// for (let i = 0; i < this.datas.truckList.length; i++) {
|
||
// const truckId = this.datas.truckList[i].truckId;
|
||
// const truck = this.truckList.find((x) => x.id == truckId);
|
||
// this.datas.truckList[i].plateNumber = truck?.plateNumber ?? null;
|
||
|
||
// //根据停车场ID获取停车场名称
|
||
// const parkingSel = this.parkingList.find(
|
||
// (item) => item.id === this.datas.truckList[i].startParking
|
||
// );
|
||
// this.datas.truckList[i].startParkingName =
|
||
// parkingSel?.parkingName ?? null;
|
||
|
||
// //计算异动里程
|
||
// this.$set(
|
||
// this.datas.truckList[i],
|
||
// "numberMileage",
|
||
// Number(this.datas.truckList[i].endMileage) -
|
||
// Number(this.datas.truckList[i].startMileage) || 0
|
||
// );
|
||
// }
|
||
|
||
// this.$nextTick(() => {
|
||
// this.$refs.uploadCollapse.init();
|
||
// });
|
||
// 为每一个车辆信息初始化一个fileList
|
||
// for (let i = 0; i < this.datas.truckList.length; i++) {
|
||
// this.fileLists[i] = [];
|
||
// }
|
||
});
|
||
},
|
||
//多改单 2025.4.18最终确认用queryAuthListByPlateNumber
|
||
//2025.6.26 修改为getAllTruckList
|
||
queryAuthListByPlateNumber(plateNumber) {
|
||
this.$api.truck.getAllTruckList({ plateNumber }).then((res) => {
|
||
this.truckList = res?.data || [];
|
||
this.showPlateNumberPicker = true;
|
||
});
|
||
},
|
||
// queryAuthListByPlateNumber(plateNumber, index) {多改单
|
||
// this.$api.truck
|
||
// .queryAuthListByPlateNumber({ plateNumber })
|
||
// .then((res) => {
|
||
// this.truckList = res;
|
||
// this.showPlateNumberPicker[index] = true;
|
||
// });
|
||
// },
|
||
// getTruckList() {
|
||
// this.$api.truck.queryAuthListByPlateNumber().then((res) => {
|
||
// this.truckList = res;
|
||
// });
|
||
// },
|
||
// getRoleList() {
|
||
// this.$api.unusualActionApply.getRoleList().then((res) => {
|
||
// this.users = res;
|
||
// });
|
||
// },
|
||
goto(e) {
|
||
uni.navigateTo({ url: e.target.dataset.url });
|
||
},
|
||
navigateBack() {
|
||
uni.navigateBack();
|
||
},
|
||
formatDateTime(obj, type = "date") {
|
||
if (obj == null) {
|
||
return "";
|
||
}
|
||
const date = new Date(obj);
|
||
|
||
if (type === "date") {
|
||
let y = 1900 + date.getYear();
|
||
let m = "0" + (date.getMonth() + 1);
|
||
let d = "0" + date.getDate();
|
||
return (
|
||
y +
|
||
"-" +
|
||
m.substring(m.length - 2, m.length) +
|
||
"-" +
|
||
d.substring(d.length - 2, d.length)
|
||
);
|
||
} else if (type === "hour") {
|
||
const year = date.getFullYear();
|
||
const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始
|
||
const day = String(date.getDate()).padStart(2, "0");
|
||
const hour = String(date.getHours()).padStart(2, "0");
|
||
return `${year}-${month}-${day} ${hour}:00`;
|
||
} else if (type === "minute") {
|
||
const year = date.getFullYear();
|
||
const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始
|
||
const day = String(date.getDate()).padStart(2, "0");
|
||
const hour = String(date.getHours()).padStart(2, "0");
|
||
const minute = String(date.getMinutes()).padStart(2, "0");
|
||
return `${year}-${month}-${day} ${hour}:${minute}`;
|
||
} else {
|
||
throw new Error(
|
||
"Invalid type. Valid types are 'date', 'hour', and 'minute'."
|
||
);
|
||
}
|
||
},
|
||
getNowDateTime() {
|
||
let currentTime = new Date();
|
||
let year = currentTime.getFullYear();
|
||
let month = currentTime.getMonth() + 1;
|
||
let day = currentTime.getDate();
|
||
let hours = currentTime.getHours();
|
||
let minutes = currentTime.getMinutes();
|
||
month = month < 10 ? "0" + month : month;
|
||
day = day < 10 ? "0" + day : day;
|
||
hours = hours < 10 ? "0" + hours : hours;
|
||
minutes = minutes < 10 ? "0" + minutes : minutes;
|
||
|
||
return `${year}-${month}-${day} ${hours}:${minutes}`;
|
||
},
|
||
getDic() {
|
||
this.$api.standbyVehicle.getCityName().then((res) => {
|
||
this.cityCode = res;
|
||
});
|
||
},
|
||
getCityName(dicCode) {
|
||
return this.getDicValue(this.cityCode, dicCode);
|
||
},
|
||
getDicValue(dic, dicCode) {
|
||
if (dic.length == 0) {
|
||
return "";
|
||
}
|
||
|
||
return dic.find((x) => x.dicCode == dicCode)?.dicName ?? "";
|
||
},
|
||
|
||
confirmAuthorizer(e) {
|
||
this.showAuthorizerPicker = false;
|
||
this.datas.takeName = e.value[0].authorizer;
|
||
this.datas.takeIdNo = e.value[0].authorizerIdentityCard;
|
||
this.datas.takePhone = e.value[0].authorizerTelephone;
|
||
},
|
||
// 异动开始时间
|
||
confirmStartTime(e) {
|
||
this.datas.transactionStartTime = e.value;
|
||
this.showStartTimePicker = false;
|
||
},
|
||
// 预计异动结束时间
|
||
confirmPlanEndTime(e) {
|
||
this.datas.planTransactionEndTime = e.value;
|
||
this.showPlanEndTimePicker = false;
|
||
},
|
||
// 异动结束时间
|
||
confirmEndTime(e) {
|
||
this.datas.transactionEndTime = e.value;
|
||
this.showEndTimePicker = false;
|
||
},
|
||
// clearEndTime(e,index) {
|
||
// this.datas.truckList[index].endTime = null
|
||
// },
|
||
// 审批人
|
||
// confirmApprovalUser(e) {
|
||
// console.log(e);
|
||
// const selectedUser = e.value[0];
|
||
// this.datas.approvalName = selectedUser.name;
|
||
// this.datas.approvalId = selectedUser.id;
|
||
// this.showApprovaUserlPicker = false;
|
||
// },
|
||
// 城市列表
|
||
confirmCity(e) {
|
||
console.log(e);
|
||
this.datas.cityName = e.value[0].dicName;
|
||
this.datas.cityCode = e.value[0].dicCode;
|
||
this.showCityPicker = false;
|
||
},
|
||
|
||
// forEachInputChange(e, index, key) {
|
||
// console.log(e);
|
||
// this.datas.truckList[index][key] = e;
|
||
// },
|
||
mileageChange(e) {
|
||
console.log(e);
|
||
this.datas.endMileage = e;
|
||
this.$set(
|
||
this.datas,
|
||
"numberMileage",
|
||
Number(e) - Number(this.datas.startMileage) || 0
|
||
);
|
||
},
|
||
changeUnit(e, index) {
|
||
console.log(e);
|
||
this.datas.truckList[index].hydrogenUnit = e;
|
||
},
|
||
confirmTransactionType(e) {
|
||
this.datas.transactionType = e.value[0].dicCode;
|
||
this.datas.transactionTypeText = e.value[0].dicName;
|
||
this.showTransactionTypePicker = false;
|
||
},
|
||
confirmIsParkOrFix(e) {
|
||
this.datas.transactionAddressType = e.value[0].dicCode;
|
||
this.datas.addressTypeText = e.value[0].dicName;
|
||
this.datas.transactionAddress = "";
|
||
this.showParkOrFixPicker = false;
|
||
},
|
||
confirmEndPark(e) {
|
||
this.datas.transactionParking = e.value[0].id;
|
||
this.datas.endParkingText = e.value[0].parkingName;
|
||
this.showEndParkPicker = false;
|
||
},
|
||
confirmPark(e) {
|
||
this.datas.transactionAddress = e.value[0].id;
|
||
this.datas.transactionAddressText = e.value[0].parkingName;
|
||
this.showParkPicker = false;
|
||
},
|
||
confirmFix(e) {
|
||
this.datas.transactionAddress = e.value[0].id;
|
||
this.datas.transactionAddressText = e.value[0].name;
|
||
this.showFixPicker = false;
|
||
},
|
||
|
||
confirmStartPark(e) {
|
||
console.log("showTrunkParkPicker:\n", e.value[0]);
|
||
this.datas.startParking = e.value[0].id;
|
||
this.datas.startParkingName = e.value[0].parkingName;
|
||
const item = this.parkingList.find((item) => item.id === e.value[0].id);
|
||
if (item && item.unusualActionCity) {
|
||
this.datas.cityCode = item.unusualActionCity;
|
||
}
|
||
// this.$set(
|
||
// this.datas.truckList[index],
|
||
// "startParkingName",
|
||
// e.value[0].parkingName
|
||
// );
|
||
this.$set(this, "showTrunkParkPicker", false);
|
||
},
|
||
async confirmPlateNumber(e) {
|
||
console.log("truckInfo:\n", e.value[0]);
|
||
this.datas.truckId = e.value[0].id;
|
||
this.datas.plateNumber = e.value[0].plateNumber;
|
||
|
||
//先判断该车牌是否已经存在
|
||
const resp = await this.$api.unusualActionApply
|
||
.getExistResult({
|
||
id: e.value[0].id,
|
||
})
|
||
.then((res) => {
|
||
if (res) {
|
||
return res?.data;
|
||
}
|
||
});
|
||
console.log(resp);
|
||
if (resp) {
|
||
this.alert("该车辆已存在异动申请,请重新选择");
|
||
this.datas.truckId = "";
|
||
this.datas.plateNumber = "";
|
||
this.showPlateNumberPicker = false;
|
||
return;
|
||
}
|
||
//前端增加该车辆状态非在库,请确认是否选择modal
|
||
if (e.value[0].truckRentStatus && e.value[0].truckRentStatus !== 0) {
|
||
uni.showModal({
|
||
title: "异动提示",
|
||
content: "该车辆状态非在库,请确认是否选择",
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
//通过车牌号获取车辆信息
|
||
this.$api.unusualActionApply
|
||
.getUnusualInfoById({
|
||
id: e.value[0].id,
|
||
})
|
||
.then((res) => {
|
||
if (res) {
|
||
console.log(res.data);
|
||
Object.assign(this.datas, res.data);
|
||
console.log(this.datas);
|
||
const item = this.parkingList?.find(
|
||
(item) => item.id === res.data.startParking
|
||
);
|
||
//因为这个接口只有停车场ID没有NAME
|
||
if (!res.data.startParkingName && res.data.startParking) {
|
||
this.datas.startParkingName = item?.parkingName || "";
|
||
}
|
||
//需要带出异动城市
|
||
if (item && item.unusualActionCity) {
|
||
this.datas.cityCode = item.unusualActionCity;
|
||
}
|
||
}
|
||
});
|
||
} else if (res.cancel) {
|
||
this.datas.truckId = "";
|
||
this.datas.plateNumber = "";
|
||
this.showPlateNumberPicker = false;
|
||
return;
|
||
}
|
||
},
|
||
});
|
||
}
|
||
|
||
this.showPlateNumberPicker = false;
|
||
},
|
||
// confirmPlateNumber(e, index) {
|
||
// console.log("truckInfo:\n", e.value[0]);
|
||
// this.datas.truckList[index].truckId = e.value[0].id;
|
||
// this.datas.truckList[index].plateNumber = e.value[0].plateNumber;
|
||
// this.$api.unusualActionApply
|
||
// .getUnusualInfoById({
|
||
// id: e.value[0].id,
|
||
// })
|
||
// .then((res) => {
|
||
// if (res) {
|
||
// console.log(res.data);
|
||
// Object.assign(this.datas.truckList[index], res.data);
|
||
// console.log(this.datas.truckList[index]);
|
||
// if (!res.data.startParkingName && res.data.startParking) {
|
||
// console.log(this.datas.truckList[index].startParkingName);
|
||
// console.log(
|
||
// this.parkingList.filter(
|
||
// (item) => item.id == res.data.startParking
|
||
// )
|
||
// );
|
||
// this.datas.truckList[index].startParkingName =
|
||
// this.parkingList.filter(
|
||
// (item) => item.id == res.data.startParking
|
||
// )[0]?.parkingName;
|
||
// }
|
||
// }
|
||
// });
|
||
// this.showPlateNumberPicker[index] = false;
|
||
// },
|
||
cancelPlateNumber() {
|
||
this.$set(this, "showPlateNumberPicker", false);
|
||
},
|
||
cancelStartPark() {
|
||
this.$set(this, "showTrunkParkPicker", false);
|
||
},
|
||
showrStartParkPicker() {
|
||
console.log(`showrStartParkPicker`);
|
||
if (this.disabled || this.isPassAudit) {
|
||
return;
|
||
}
|
||
this.$set(this, "showTrunkParkPicker", true);
|
||
},
|
||
searchPlatNumber() {
|
||
if (this.disabled || this.isPassAudit) {
|
||
return;
|
||
}
|
||
console.log(`searchPlatNumber`);
|
||
uni.showModal({
|
||
title: "车牌号关键字",
|
||
confirmText: "搜索",
|
||
editable: true,
|
||
placeholderText: "请输入车牌号关键字用于检索",
|
||
success: (res) => {
|
||
res.confirm && this.queryAuthListByPlateNumber(res.content);
|
||
},
|
||
});
|
||
},
|
||
// 保存
|
||
save() {
|
||
this.datas.isSubmit = 0;
|
||
|
||
// 有id,调用编辑接口
|
||
if (this.id) {
|
||
this.$api.unusualActionApply.edit(this.datas).then((res) => {
|
||
if (res) {
|
||
uni.showToast({
|
||
title: "保存成功",
|
||
icon: "success",
|
||
duration: 1500,
|
||
success() {
|
||
setTimeout(() => {
|
||
uni.navigateBack();
|
||
}, 1500);
|
||
},
|
||
});
|
||
}
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 没有id,调用添加接口
|
||
this.$api.failure.add(this.datas).then((res) => {
|
||
if (res) {
|
||
uni.showToast({
|
||
title: "保存成功",
|
||
icon: "success",
|
||
duration: 1500,
|
||
success() {
|
||
setTimeout(() => {
|
||
uni.navigateBack();
|
||
}, 1500);
|
||
},
|
||
});
|
||
}
|
||
});
|
||
},
|
||
// addForm() {
|
||
// this.datas.truckList.push({
|
||
// hydrogenUnit: "",
|
||
// hydrogenUnitName: "",
|
||
// startParkingName: "",
|
||
// address: "",
|
||
// startParking: "",
|
||
// startMileage: null,
|
||
// startHydrogen: "",
|
||
// startElectricity: "",
|
||
// truckId: null,
|
||
// });
|
||
|
||
// this.showPlateNumberPicker.push(false);
|
||
// this.showTrunkParkPicker.push(false);
|
||
// this.$nextTick(() => {
|
||
// this.$refs.uploadCollapse.init();
|
||
// });
|
||
// },
|
||
// delForm(index) {
|
||
// if (this.datas.truckList.length <= 1) {
|
||
// this.alert(`至少保留一条数据`);
|
||
// return;
|
||
// }
|
||
|
||
// this.datas.truckList.splice(index, 1);
|
||
// this.showPlateNumberPicker.splice(index, 1);
|
||
// this.showStartTimePicker.splice(index, 1);
|
||
// this.showEndTimePicker.splice(index, 1);
|
||
// this.$nextTick(() => {
|
||
// this.$refs.uploadCollapse.init();
|
||
// });
|
||
// },
|
||
passConfirm() {
|
||
uni.showModal({
|
||
title: "提示",
|
||
content: "确认通过?",
|
||
success: (ress) => {
|
||
if (ress.confirm) {
|
||
this.datas.approvalStatus = 30;
|
||
this.$api.unusualActionApply
|
||
.auditTransaction(this.datas)
|
||
.then((res) => {
|
||
if (!res) {
|
||
return;
|
||
}
|
||
uni.showToast({
|
||
title: "通过成功",
|
||
icon: "success",
|
||
duration: 1500,
|
||
success() {
|
||
setTimeout(() => {
|
||
uni.navigateBack();
|
||
}, 1500);
|
||
},
|
||
});
|
||
});
|
||
}
|
||
},
|
||
});
|
||
},
|
||
rejectConfirm() {
|
||
uni.showModal({
|
||
title: "提示",
|
||
content: "确认驳回?",
|
||
success: (ress) => {
|
||
if (ress.confirm) {
|
||
this.datas.approvalStatus = 40;
|
||
this.$api.unusualActionApply
|
||
.auditTransaction(this.datas)
|
||
.then((res) => {
|
||
if (!res) {
|
||
return;
|
||
}
|
||
uni.showToast({
|
||
title: "驳回成功",
|
||
icon: "success",
|
||
duration: 1500,
|
||
success() {
|
||
setTimeout(() => {
|
||
uni.navigateBack();
|
||
}, 1500);
|
||
},
|
||
});
|
||
});
|
||
}
|
||
},
|
||
});
|
||
},
|
||
saveConfirm() {
|
||
this.submit(false);
|
||
},
|
||
submitConfirm() {
|
||
uni.showModal({
|
||
title: "提示",
|
||
content: "确认提交?",
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
this.submit();
|
||
}
|
||
},
|
||
});
|
||
},
|
||
submit(isSubmit = true) {
|
||
if (isSubmit && !this.check()) {
|
||
return;
|
||
}
|
||
// 没有id,调用添加接口
|
||
this.datas.isSubmit = isSubmit;
|
||
if (!this.id) {
|
||
this.$api.unusualActionApply.add(this.datas).then((res) => {
|
||
if (!res) {
|
||
return;
|
||
}
|
||
uni.showToast({
|
||
title: isSubmit ? "提交成功" : "保存成功",
|
||
icon: "success",
|
||
duration: 1500,
|
||
success() {
|
||
setTimeout(() => {
|
||
uni.navigateBack();
|
||
}, 1500);
|
||
},
|
||
});
|
||
});
|
||
|
||
return;
|
||
}
|
||
|
||
// 有id,且已经通过审批 已废弃用修改接口
|
||
// if (this.datas.approvalStatus == 30) {
|
||
// this.datas.submitType = 3;
|
||
// this.$api.unusualActionApply
|
||
// .approveAfterEdit(this.datas)
|
||
// .then((res) => {
|
||
// if (!res) {
|
||
// return;
|
||
// }
|
||
// uni.showToast({
|
||
// title: "提交成功",
|
||
// icon: "success",
|
||
// duration: 1500,
|
||
// success() {
|
||
// setTimeout(() => {
|
||
// uni.navigateBack();
|
||
// }, 1500);
|
||
// },
|
||
// });
|
||
// });
|
||
|
||
// return;
|
||
// }
|
||
|
||
// 有id,但还未通过审批
|
||
this.$api.unusualActionApply.edit(this.datas).then((res) => {
|
||
if (!res) {
|
||
return;
|
||
}
|
||
uni.showToast({
|
||
title: isSubmit ? "提交成功" : "保存成功",
|
||
icon: "success",
|
||
duration: 1500,
|
||
success() {
|
||
setTimeout(() => {
|
||
uni.navigateBack();
|
||
}, 1500);
|
||
},
|
||
});
|
||
});
|
||
},
|
||
// 在提交前检查,是否有必填字段未填写
|
||
check() {
|
||
console.log(`datas:\n`, this.datas);
|
||
// const truckSet = new Set();
|
||
// for (let i = 0; i < this.datas.truckList.length; i++) {
|
||
// const truck = this.datas.truckList[i];
|
||
// if (!truck.truckId) {
|
||
// this.alert("请填写车牌号");
|
||
// return false;
|
||
// }
|
||
|
||
// if (truckSet.has(truck.truckId)) {
|
||
// this.alert(`车牌号${truck.plateNumber}重复`);
|
||
// return false;
|
||
// }
|
||
|
||
// truckSet.add(truck.truckId);
|
||
|
||
// }
|
||
if (!this.datas.truckId) {
|
||
this.alert("请填写车牌号");
|
||
return false;
|
||
}
|
||
if (!this.datas.cityCode && this.datas.cityCode !== 0) {
|
||
this.alert("请选择异动城市");
|
||
return false;
|
||
}
|
||
if (this.datas.startParking === null || this.datas.startParking === "") {
|
||
this.alert("请选择异动驶出停车场");
|
||
return false;
|
||
}
|
||
if (this.isPassAudit) {
|
||
if (this.datas.endMileage === null || this.datas.endMileage === "") {
|
||
this.alert("请输入异动结束里程");
|
||
return false;
|
||
}
|
||
if (this.datas.endHydrogen === null || this.datas.endHydrogen === "") {
|
||
this.alert("请输入异动结束氢量");
|
||
return false;
|
||
}
|
||
if (
|
||
this.datas.endElectricity === null ||
|
||
this.datas.endElectricity === ""
|
||
) {
|
||
this.alert("请输入异动结束电量");
|
||
return false;
|
||
}
|
||
} else {
|
||
if (
|
||
this.datas.startMileage === null ||
|
||
this.datas.startMileage === ""
|
||
) {
|
||
this.alert("请输入异动开始里程");
|
||
return false;
|
||
}
|
||
if (
|
||
this.datas.startHydrogen === null ||
|
||
this.datas.startHydrogen === ""
|
||
) {
|
||
this.alert("请输入异动开始氢量");
|
||
return false;
|
||
}
|
||
if (!this.datas.hydrogenUnit) {
|
||
this.alert("请选择氢量单位");
|
||
return false;
|
||
}
|
||
if (
|
||
this.datas.startElectricity === null ||
|
||
this.datas.startElectricity === ""
|
||
) {
|
||
this.alert("请输入异动开始电量");
|
||
return false;
|
||
}
|
||
}
|
||
if (!this.datas.transactionReason && this.datas.transactionType == 9) {
|
||
this.alert("请填写异动原因");
|
||
return false;
|
||
}
|
||
if (!this.datas.transactionStartTime) {
|
||
this.alert("请填写异动开始时间");
|
||
return false;
|
||
}
|
||
if (!this.datas.planTransactionEndTime) {
|
||
this.alert("请填写预计异动结束时间");
|
||
return false;
|
||
}
|
||
if (!this.datas.transactionAddressType) {
|
||
this.alert("请选择异动目的地类型");
|
||
return false;
|
||
}
|
||
if (!this.datas.transactionAddress) {
|
||
this.alert("请填写异动目的地");
|
||
return false;
|
||
}
|
||
if (this.isPassAudit) {
|
||
if (!this.datas.transactionEndTime) {
|
||
this.alert("请填写异动结束时间");
|
||
return false;
|
||
}
|
||
if (!this.datas.transactionParking) {
|
||
this.alert("请填写异动结束停车场");
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
},
|
||
alert(msg) {
|
||
uni.showToast({
|
||
title: msg,
|
||
icon: "none",
|
||
duration: 1500,
|
||
});
|
||
},
|
||
},
|
||
computed: {
|
||
disabled() {
|
||
return this.isRead;
|
||
},
|
||
},
|
||
async onLoad(options) {
|
||
if (options.id) {
|
||
this.id = options.id;
|
||
} else {
|
||
this.isAdd = true;
|
||
}
|
||
if (options.isRead) {
|
||
this.isRead = Number(options.isRead);
|
||
}
|
||
if (options.isAudit) {
|
||
this.isRead = Number(options.isAudit);
|
||
this.isAudit = Number(options.isAudit);
|
||
}
|
||
this.getDic();
|
||
await this.getTransactionTypeList(); // 获取异动类型列表
|
||
await this.getTransactionAddressType(); // 获取目的地类型列表
|
||
await this.getParkList(); // 获取停车场列表
|
||
await this.maintainSiteSelect(); // 获取维修站点列表
|
||
this.getData();
|
||
},
|
||
onPullDownRefresh() {
|
||
uni.stopPullDownRefresh(); //刷新数据之后停止刷新效果
|
||
},
|
||
onShow() {
|
||
if (this.loadingText != "添加水印中...") {
|
||
this.loading = false;
|
||
}
|
||
},
|
||
onHide() {},
|
||
destroyed() {},
|
||
watch: {},
|
||
};
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
.container {
|
||
// background-color: #d7d7d7;
|
||
padding: 30rpx;
|
||
|
||
.truckListBtns {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
align-items: center;
|
||
button {
|
||
background-color: transparent;
|
||
font-size: 26rpx;
|
||
width: 100rpx;
|
||
height: 50rpx;
|
||
line-height: 50rpx;
|
||
margin-left: 30rpx;
|
||
margin-right: 0;
|
||
padding: 0;
|
||
|
||
&.add {
|
||
background-color: #7ba746;
|
||
color: white;
|
||
}
|
||
|
||
&.del {
|
||
background-color: white;
|
||
color: #7ba746;
|
||
border: 1rpx #7ba746 solid;
|
||
}
|
||
|
||
&.disabled {
|
||
opacity: 0.6;
|
||
}
|
||
}
|
||
}
|
||
|
||
.item {
|
||
margin-top: 30rpx;
|
||
.title {
|
||
font-size: 26rpx;
|
||
margin-bottom: 15rpx;
|
||
&.required::before {
|
||
content: "*";
|
||
color: red;
|
||
margin-right: 3rpx;
|
||
}
|
||
}
|
||
.tip {
|
||
font-size: 26rpx;
|
||
margin-bottom: 15rpx;
|
||
color: #aaaaaa;
|
||
position: relative;
|
||
}
|
||
.btn.checkList {
|
||
width: 200rpx;
|
||
height: 60rpx;
|
||
font-size: 26rpx;
|
||
line-height: 26rpx;
|
||
padding: 17rpx 0;
|
||
text-align: center;
|
||
background-color: #7ba746;
|
||
color: white;
|
||
margin-left: 0;
|
||
|
||
&.required::before {
|
||
content: "*";
|
||
color: red;
|
||
margin-right: 3rpx;
|
||
}
|
||
}
|
||
|
||
.unit {
|
||
font-size: 26rpx;
|
||
}
|
||
|
||
.btn {
|
||
width: 200rpx;
|
||
height: 80rpx;
|
||
margin-left: 0;
|
||
font-size: 26rpx;
|
||
line-height: 26rpx;
|
||
padding: 27rpx 0;
|
||
text-align: center;
|
||
color: white;
|
||
|
||
&.sign {
|
||
background-color: #7ba746;
|
||
}
|
||
|
||
&.genDocument {
|
||
background-color: #1e98d7;
|
||
}
|
||
|
||
&.disabled {
|
||
opacity: 0.6;
|
||
}
|
||
}
|
||
}
|
||
|
||
.btns {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-around;
|
||
margin-top: 20rpx;
|
||
|
||
button {
|
||
width: 200rpx;
|
||
height: 60rpx;
|
||
font-size: 26rpx;
|
||
line-height: 26rpx;
|
||
padding: 17rpx 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.cancel {
|
||
background-color: white;
|
||
color: #7ba746;
|
||
border: 1rpx #7ba746 solid;
|
||
}
|
||
|
||
.save {
|
||
background-color: #7ba746;
|
||
color: white;
|
||
}
|
||
|
||
.done {
|
||
background-color: #7ba746;
|
||
color: white;
|
||
}
|
||
|
||
.disabled {
|
||
opacity: 0.6;
|
||
}
|
||
}
|
||
}
|
||
|
||
/deep/ .u-textarea textarea {
|
||
min-height: 100rpx !important;
|
||
font-size: 26rpx !important;
|
||
white-space: pre-line !important;
|
||
}
|
||
|
||
/deep/ .u-border {
|
||
border-width: 1rpx !important;
|
||
border-color: gray !important;
|
||
border-style: solid;
|
||
}
|
||
|
||
/deep/ .u-collapse-item__content__text {
|
||
padding: unset !important;
|
||
color: unset !important;
|
||
font-size: unset !important;
|
||
}
|
||
|
||
/deep/ .u-cell__title-text {
|
||
font-size: unset !important;
|
||
line-height: unset !important;
|
||
color: unset !important;
|
||
}
|
||
|
||
/deep/ .u-cell__body {
|
||
padding: unset !important;
|
||
font-size: unset !important;
|
||
color: unset !important;
|
||
}
|
||
|
||
/deep/ .u-cell__right-icon-wrap text {
|
||
font-size: 32rpx !important;
|
||
}
|
||
|
||
/deep/ .u-cell--clickable {
|
||
background-color: unset !important;
|
||
}
|
||
|
||
/deep/ .u-collapse-item {
|
||
margin-bottom: 30rpx;
|
||
}
|
||
|
||
/deep/ .uni-select {
|
||
width: 120rpx !important;
|
||
}
|
||
|
||
/deep/ .u-upload__button text {
|
||
font-size: 48rpx !important;
|
||
}
|
||
|
||
/deep/ .u-upload__deletable {
|
||
height: 42rpx !important;
|
||
width: 42rpx !important;
|
||
}
|
||
|
||
/deep/ .u-upload__deletable text {
|
||
font-size: 32rpx !important;
|
||
line-height: 32rpx !important;
|
||
}
|
||
|
||
/deep/ picker-view {
|
||
height: 450rpx !important;
|
||
}
|
||
|
||
/deep/ .uni-select__input-text {
|
||
font-size: 26rpx !important;
|
||
text-align: center !important;
|
||
}
|
||
|
||
/deep/ .uni-select__selector-item text {
|
||
font-size: 26rpx !important;
|
||
}
|
||
|
||
/deep/ .uni-select {
|
||
padding-right: 18rpx !important;
|
||
border-width: 1rpx !important;
|
||
border-color: gray !important;
|
||
border-style: solid !important;
|
||
border-top-width: 0 !important;
|
||
border-right-width: 0 !important;
|
||
border-bottom-width: 0 !important;
|
||
}
|
||
|
||
// /deep/ picker-view picker-view-column:nth-of-type(5) {
|
||
// display: none;
|
||
// }
|
||
|
||
.changeCarBtn {
|
||
height: 76rpx;
|
||
font-size: 26rpx;
|
||
line-height: 76rpx;
|
||
border-width: 1rpx !important;
|
||
border-color: gray !important;
|
||
border-style: solid !important;
|
||
border-top-width: 0 !important;
|
||
border-right-width: 0 !important;
|
||
border-bottom-width: 0 !important;
|
||
}
|
||
|
||
/* 检查单样式开始 */
|
||
/deep/ .td_wrap {
|
||
height: auto !important;
|
||
}
|
||
|
||
/deep/ checkbox-group view.td {
|
||
width: 186rpx !important;
|
||
}
|
||
|
||
/deep/ checkbox-group view.td_wrap {
|
||
width: 186rpx !important;
|
||
}
|
||
|
||
/deep/ .no-bad-table-wrap .td.rowspan {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
/deep/ .div-table-head .thead .tr view {
|
||
width: 186rpx !important;
|
||
}
|
||
|
||
/deep/ no-bad-table {
|
||
overflow-x: hidden;
|
||
}
|
||
|
||
/deep/ .no-bad-table-wrap .thead .tr .td {
|
||
background-color: #7ba746;
|
||
color: white;
|
||
}
|
||
|
||
/deep/ .no-bad-table-wrap .thead .tr .td .td_wrap {
|
||
background-color: #7ba746;
|
||
color: white;
|
||
}
|
||
/* 检查单样式结束 */
|
||
|
||
/* loading 置于顶层 */
|
||
/deep/ .u-fade-enter-to.u-fade-enter-active {
|
||
z-index: 10074 !important;
|
||
}
|
||
|
||
/deep/ .selectMultiple .multipleBody .list .item {
|
||
font-size: 26rpx;
|
||
}
|
||
</style>
|