 <!--  -->
 <template>
       <div class="record-form-box">
                <el-scrollbar>
                    <el-form ref="formRef" :model="otherInfo" label-position="top"  disabled>
                      <div class="hc-form-item">
                        <el-form-item label="申请时间：" prop="afDate">
                            <el-date-picker type="date" class="block" v-model="otherInfo.afDate" format="YYYY-MM-DD" value-format="YYYY-MM-DD"/>
                        </el-form-item>
                        <el-form-item label="关联项目：" >
                            <el-select block v-model="otherInfo.projectId">
                                <el-option v-for="items in projectData" :label="items.projectName" :value="items.projectId"/>
                            </el-select>
                        </el-form-item>
                      </div>
                 
                        <div class="hc-form-item">
                            <el-form-item label="申请人：" prop="afUserId">
                                <el-select block v-model="otherInfo.afUserId">
                                    <el-option v-for="item in userList" :label="item.name" :value="item.id"/>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="是否为项目提成申请：" prop="isProjectBonus">
                                <el-select block v-model="otherInfo.isProjectBonus" placeholder="">
                                    <el-option label="否" :value="0"/>
                                    <el-option label="是" :value="1"/>
                                </el-select>
                            </el-form-item>
                        </div>
                   
                        <el-form-item label="回款时间：" prop="collectionDate"  v-if="otherInfo.isProjectBonus === 1">
                            <el-input v-model="otherInfo.collectionDate" disabled/>
                        </el-form-item>
                        <el-form-item label="回款金额：" prop="collectionMoney"  v-if="otherInfo.isProjectBonus === 1">
                            <el-input v-model="otherInfo.collectionMoney" disabled>
                                <template #append>元</template>
                            </el-input>
                        </el-form-item>
                        <el-form-item label="申请比例：" prop="afProportion"  v-if="otherInfo.isProjectBonus === 1">
                            <el-input v-model="otherInfo.afProportion">
                                <template #append>%</template>
                            </el-input>
                        </el-form-item>
                        <el-form-item label="请款金额：" prop="afMoney"  v-if="otherInfo.isProjectBonus === 1">
                            <el-input v-model="otherInfo.afMoney" :disabled="otherInfo.isProjectBonus === 1" onkeyup="this.value=this.value.match(/\d+\.?\d{0,2}/)">
                                <template #append>元</template>
                            </el-input>
                        </el-form-item>
                        <el-form-item label="收款人：" prop="payeeUserName">
                            <el-input v-model="otherInfo.payeeUserName"/>
                        </el-form-item>
                        <el-form-item label="收款人开户行：" prop="payeeUserBankName">
                            <el-input v-model="otherInfo.payeeUserBankName"/>
                        </el-form-item>
                        <el-form-item label="收款账号：" prop="payeeUserBankId">
                            <el-input v-model="otherInfo.payeeUserBankId"/>
                        </el-form-item>
                        <el-form-item label="请款金额：" prop="afMoney"  >
                            <el-input v-model="otherInfo.afMoney"/>
                        </el-form-item>
                        <el-form-item label="请款用途：" prop="payeeUseInfo"  v-if="otherInfo.isProjectBonus !== 1">
                            <el-input type="textarea" v-model="otherInfo.payeeUseInfo" :autosize="{ minRows: 3, maxRows: 5 }"/>
                        </el-form-item>
                    
                        <el-form-item label="备注：">
                            <el-input type="textarea" v-model="otherInfo.remarks" :autosize="{ minRows: 3, maxRows: 5 }"/>
                        </el-form-item>
                    </el-form>
                </el-scrollbar>
            </div>
 </template>
 
 <script setup>
 import {ref, watch,onActivated} from  'vue'
 import {getProjectList,getuserList} from "~api/other";
 import {getArrValue} from "js-fast-way";
 import {useAppStore} from "~src/store";
const useAppState = useAppStore();
 onActivated(()=>{

 })
 //参数
 const props = defineProps({
   otherInfo: {
         type: Object,
         default: {}
     }
 })
 //监听
 watch(() => [
  props.otherInfo,
 ], ([otherInfo]) => {
    console.log(otherInfo,'otherInfo');
    getProjectData()
    getUserDict()
 
 })
 //获取项目数据
const projectData = ref([])
const getProjectData = async () => {
    const {error, code, data} = await getProjectList()
    //判断状态
    if (!error && code === 200) {
        projectData.value = getArrValue(data)
    } else {
        projectData.value = []
    }
}
//获取所有员工
const userList=ref([])
const getUserDict=async()=>{
    const {error, code, data} = await getuserList({tenantId:useAppState.tenantId})
    if (!error && code === 200) {
        userList.value = getArrValue(data)

    } else {
        userList.value = []

    }
}
 </script>
 <style lang='scss' scoped>
 </style>