<wxs module="format" src="/utils/format.wxs"></wxs>
<view class="header_title">
    <view class="header_title_row">
        <van-row>
            <van-col span="4">
                <view class="header_img" bindtap="returnToPage">
                    <image src="/images/left.png"></image>
                </view>
            </van-col>
            <van-col span="16">
                <view class="header_name">发起审批申请</view>
            </van-col>
        </van-row>
    </view>
</view>
<view class="max_content">
    <van-steps steps="{{ stepList }}" active="{{ active }}" />
    <project-select init="{{initData}}" bindchange="onProjectSelect"></project-select>
    <view class="inspect_info">
        <view class="inspect_info_list">
            <view class="inspect_info_title" style="padding: 20rpx 0 10rpx;">使用单位</view>
            <view class="inspect_info_content">
                <voucher-select columns="{{deptList}}" placeholder="请选择使用单位" selectValue="{{useDeptId}}" bindchange="onSelectDept"></voucher-select>
            </view>
        </view>
        <view class="inspect_info_list">
            <view class="inspect_info_title" style="padding: 20rpx 0 10rpx;">使用时间</view>
            <view class="inspect_info_content">
                <voucher-date counts="5" placeholder="请选择使用时间" maxDate="{{maxDate}}" bindchange="onInputTime"></voucher-date>
            </view>
        </view>
        <view class="inspect_info_list">
            <view class="inspect_info_title" style="padding: 20rpx 0 10rpx;">申请原因</view>
            <view class="inspect_info_content">
                <textarea class="add_textarea" placeholder="请填写申请原因（500字内）" placeholder-style="color:#6777aa;" maxlength="500" bindinput="applyReasonblur" />
            </view>
        </view>
        <view class="inspect_info_list" style="width: 100%;">
            <view class="inspect_info_title" style="padding: 20rpx 0 10rpx;">申请图片
                <text style="font-size: small; color: antiquewhite;">[其它格式文件请截图上传或电脑端上传]</text>
            </view>
            <view class="inspect_info_content">
                <file-uploader bindimages="fileUpload" limit="{{limit}}"></file-uploader>
            </view>
        </view>
    </view>

    <view>
        <view class="inspect_info" wx:for="{{detailDataList}}" wx:key="index">
            <view class="module_title module_title_flex">
                <view class="text_active">申请明细 {{ format.indexNumFormat(index) }}</view>
                <view class="module_see_info_delete" wx:if="{{index != 0}}" bindtap="delApplyDetail" data-index="{{index}}">
                    <van-icon name="delete" /> 删除
                </view>
            </view>
            <view class="inspect_info_list">
                <input placeholder="请选择申请明细" placeholder-style="color:#6777aa;" class="inspect_input_fill_in" value="{{item.showDetailsName}}" data-index="{{index}}" bindtap="onShowPopup" disabled="disabled"/>
                <van-popup show="{{ item.showDetailsPopup }}" data-index="{{index}}" bind:close="onClosePopup" position="bottom" round="5">
                    <van-tree-select items="{{ dataList }}" main-active-index="{{ item.mainActiveIndex }}" active-id="{{ item.activeId }}" data-index="{{index}}" bind:click-nav="onClickNav" bind:click-item="onClickItem">
                    </van-tree-select>
                </van-popup>
            </view>
            <view class="inspect_info_list">
                <van-row>
                    <van-col span="12">
                        <input type="number" placeholder="填写申请数量" placeholder-style="color:#6777aa;" class="inspect_input_fill_in" data-index="{{index}}" bindinput="onInputNumber" />
                    </van-col>
                    <van-col span="12">
                        <voucher-select columns="{{item.assetsUnits}}" placeholder="选择单位名称" selectValue="{{item.useUnitIndex}}" data-index="{{index}}" bindchange="onSelectUnit"></voucher-select>
                    </van-col>
                </van-row>
            </view>
            <view class="inspect_info_list" wx:if="{{options.category=='wzl'}}">
                <input placeholder="请填写规格型号" placeholder-style="color:#6777aa;" class="inspect_input_fill_in" value="{{item.assetsVersion}}" bindinput="onInputVersion" data-index="{{index}}" maxlength="32" />
            </view>
            <view class="inspect_info_list">
                <textarea placeholder="请填写使用说明（500字内）" placeholder-style="color:#6777aa;" class="add_textarea" value="{{item.useReason}}" bindinput="onInputUseReason" data-index="{{index}}" maxlength="500" />
            </view>
        </view>
    </view>

    <view class="inspect_new_issues_max">
        <view class="inspect_new_issues" bindtap="newApplyDetail">
            <van-icon name="add-o" style="position: relative;top:5rpx;font-size: 30rpx;" /> 添加申请明细
        </view>
    </view>

    <view class="problem_submit_to">
        <view class="problem_submit_to_btn" bindtap="returnToPage">取消</view>
        <view class="problem_submit_to_btn problem_submit_to_save" bindtap="onSave">提交申请</view>
    </view>
</view>