Commit 9424cada authored by 祁正's avatar 祁正

修改日常

parent 4918914b
......@@ -75,8 +75,8 @@
}]"
>
<el-select v-model="item.reimbursementType" placeholder="请输入项目名称" class="form-data-select" clearable>
<el-option label="餐饮费" value="shanghai" />
<el-option label="通行费" value="beijing" />
<el-option :label="t.dictLabel" :value="t.dictValue" v-for="t in reimburseTypeOptions"/>
</el-select>
</el-form-item>
<el-form-item
......@@ -129,9 +129,17 @@
import { detailCostManage,updateDailyReimbursement} from "@/api/costManage/cost.js";
import {useRoute, useRouter} from 'vue-router';
const { proxy } = getCurrentInstance()
import { getDicts } from "@/api/system/dict/data";
const router = useRouter();
//项目类型字典类表
const projectTypeOptions = reactive([])
//项目类型字典类表
const reimburseTypeOptions = reactive([])
const formRef = ref();
const ruleForm = ref({
projectId:'',
......@@ -165,6 +173,12 @@ function getDetail() {
detailCostManage(id).then(res => {
ruleForm.value = res.data
console.log("我是数据",ruleForm.value)
//报销类型需要转换
ruleForm.value.childList.forEach(item=>{
item.reimbursementType = String(item.reimbursementType)
})
//项目类型转换
ruleForm.value.projectType = projectTypeOptions.find(item=>item.dictValue === String(ruleForm.value.projectType)).dictLabel
})
// console.log("坤坤",Id.value)
// console.log("test",ruleForm.value.childList)
......@@ -190,7 +204,7 @@ const customValidator2 = (rule, value, callback)=>{
// 自定义规则验证-金额
const customValidator3 = (rule, value, callback)=>{
if (!ruleForm.value.childList[rule.index].money || ruleForm.value.childList[rule.index].money.trim() === '') {
if (!ruleForm.value.childList[rule.index].money) {
callback(new Error('请输入报销金额')); // 如果为空,返回错误
} else {
callback(); // 验证通过
......@@ -255,11 +269,14 @@ function deleteRow() {
const pickerOptions = ref({
disabledDate: (time) => {
const defaultDate = ruleForm.value.reimbursement;
const selectedMonth = new Date(defaultDate).getMonth();
// console.log("获得的月份",selectedMonth)// 月份从0开始
const selectedYear = new Date(defaultDate).getFullYear();
if (!defaultDate) return false;
const [year, month] = defaultDate.split('-');
const selectedYear = parseInt(year);
const selectedMonth = parseInt(month) - 1; // 月份从0开始
const checkYear = time.getFullYear();
const checkMonth = time.getMonth();
return time.getMonth() !== selectedMonth || time.getFullYear() !== selectedYear;
return checkYear!== selectedYear || checkMonth!== selectedMonth;
},
});
......@@ -287,6 +304,18 @@ onMounted(() => {
let time = getLastMonth()
console.log(time)
ruleForm.value.reimbursement = getLastMonth()
//项目类型字典
getDicts("project_type").then(response => {
Object.assign(projectTypeOptions, response.data);
console.log("项目类型字典",projectTypeOptions)
});
//报销类型字典
getDicts("cost_daily_type").then(response => {
Object.assign(reimburseTypeOptions, response.data);
console.log("报销类型字典",reimburseTypeOptions)
});
})
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment