代码提交
This commit is contained in:
parent
82b511b50b
commit
8b6c4caa1d
|
|
@ -92,11 +92,12 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-card class="content-box">
|
<el-card class="content-box">
|
||||||
<el-row>
|
<!-- <el-row>
|
||||||
<el-col :span="24" style="text-align: right;">
|
<el-col :span="24" style="text-align: right;">
|
||||||
<el-button type="primary" icon="el-icon-refresh" size="mini" @click="onHandleBatchRetire">批量退役</el-button>
|
<el-button type="primary" icon="el-icon-refresh" size="mini" @click="onHandleBatchRetire">批量退役
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>-->
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<el-table :data="tableData" style="width: 100%" border stripe height="100%">
|
<el-table :data="tableData" style="width: 100%" border stripe height="100%">
|
||||||
<el-table-column align="center" show-overflow-tooltip type="index" label="序号" width="50"/>
|
<el-table-column align="center" show-overflow-tooltip type="index" label="序号" width="50"/>
|
||||||
|
|
@ -134,14 +135,14 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" show-overflow-tooltip prop="address" label="操作">
|
<!-- <el-table-column align="center" show-overflow-tooltip prop="address" label="操作">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="primary" size="mini" @click="onHandleRetire(scope.row)">退役</el-button>
|
<el-button type="primary" size="mini" @click="onHandleRetire(scope.row)">退役</el-button>
|
||||||
<!-- <el-button type="primary" size="mini" @click="onHandleRetireEquipment(scope.row)">
|
<!– <el-button type="primary" size="mini" @click="onHandleRetireEquipment(scope.row)">
|
||||||
退役装备
|
退役装备
|
||||||
</el-button> -->
|
</el-button> –>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>-->
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="pagination-wrapper">
|
<div class="pagination-wrapper">
|
||||||
|
|
@ -370,6 +371,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-table {
|
.dialog-table {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -318,6 +317,7 @@ export default {
|
||||||
proLocation: '', // 详细地址
|
proLocation: '', // 详细地址
|
||||||
useUnit: '', // 需求单位
|
useUnit: '', // 需求单位
|
||||||
useTime: null,
|
useTime: null,
|
||||||
|
leaseType: '0',
|
||||||
pageNum: 1, // 页码
|
pageNum: 1, // 页码
|
||||||
pageSize: 10 // 每页条数
|
pageSize: 10 // 每页条数
|
||||||
},
|
},
|
||||||
|
|
@ -337,7 +337,7 @@ export default {
|
||||||
proCounty: [{ required: true, message: '请选择项目所在区/县', trigger: 'change' }],
|
proCounty: [{ required: true, message: '请选择项目所在区/县', trigger: 'change' }],
|
||||||
proLocation: [{ required: true, message: '请输入详细地址', trigger: 'blur' }],
|
proLocation: [{ required: true, message: '请输入详细地址', trigger: 'blur' }],
|
||||||
useUnit: [{ required: true, message: '请输入需求单位', trigger: 'blur' }],
|
useUnit: [{ required: true, message: '请输入需求单位', trigger: 'blur' }],
|
||||||
useTimeRange: [{ required: true, message: '请选择使用到期日期', trigger: 'change' }],
|
useTimeRange: [{ required: true, message: '请选择使用到期日期', trigger: 'change' }]
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -403,8 +403,8 @@ export default {
|
||||||
'queryParams.useTimeRange'(newVal) {
|
'queryParams.useTimeRange'(newVal) {
|
||||||
if (newVal && newVal.length === 2 && this.tableList.length > 0) {
|
if (newVal && newVal.length === 2 && this.tableList.length > 0) {
|
||||||
this.tableList.forEach(item => {
|
this.tableList.forEach(item => {
|
||||||
item.useTimeRange = [...newVal]; // 同步主表单的日期范围
|
item.useTimeRange = [...newVal] // 同步主表单的日期范围
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -415,12 +415,12 @@ export default {
|
||||||
const [resProject, resVoltage] = await Promise.all([
|
const [resProject, resVoltage] = await Promise.all([
|
||||||
getUseProjectListAPI(),
|
getUseProjectListAPI(),
|
||||||
getVoltageListAPI()
|
getVoltageListAPI()
|
||||||
]);
|
])
|
||||||
this.useProjectList = resProject.data || []
|
this.useProjectList = resProject.data || []
|
||||||
this.voltageList = resVoltage.data || []
|
this.voltageList = resVoltage.data || []
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$message.error('获取项目或电压等级列表失败');
|
this.$message.error('获取项目或电压等级列表失败')
|
||||||
console.error(error);
|
console.error(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -461,14 +461,14 @@ export default {
|
||||||
async getList(emit = {}) {
|
async getList(emit = {}) {
|
||||||
// 如果从emit传入id,更新查询参数
|
// 如果从emit传入id,更新查询参数
|
||||||
if (emit.id) {
|
if (emit.id) {
|
||||||
this.queryParams.id = emit.id;
|
this.queryParams.id = emit.id
|
||||||
this.$route.query.id = this.queryParams.id;
|
this.$route.query.id = this.queryParams.id
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isLoading = true;
|
this.isLoading = true
|
||||||
try {
|
try {
|
||||||
const params = { ...this.queryParams };
|
const params = { ...this.queryParams }
|
||||||
const res = await getApplyDetailsApi(params); // 调用接口获取详情
|
const res = await getApplyDetailsApi(params) // 调用接口获取详情
|
||||||
|
|
||||||
// 初始化表格数据(重点处理日期)
|
// 初始化表格数据(重点处理日期)
|
||||||
this.tableList = (res.data.devDetailsList || []).map(item => ({
|
this.tableList = (res.data.devDetailsList || []).map(item => ({
|
||||||
|
|
@ -477,29 +477,29 @@ export default {
|
||||||
useTimeRange: item.useStartTime && item.useEndTime
|
useTimeRange: item.useStartTime && item.useEndTime
|
||||||
? [new Date(item.useStartTime), new Date(item.useEndTime)]
|
? [new Date(item.useStartTime), new Date(item.useEndTime)]
|
||||||
: [] // 无日期时设为空数组
|
: [] // 无日期时设为空数组
|
||||||
}));
|
}))
|
||||||
|
|
||||||
// 如果是编辑/查看模式,初始化主表单数据
|
// 如果是编辑/查看模式,初始化主表单数据
|
||||||
if (this.queryParams.id && res.data.devInfo) {
|
if (this.queryParams.id && res.data.devInfo) {
|
||||||
Object.assign(this.queryParams, res.data.devInfo);
|
Object.assign(this.queryParams, res.data.devInfo)
|
||||||
|
|
||||||
// 初始化主表单的全局日期范围(如果后端返回了全局日期)
|
// 初始化主表单的全局日期范围(如果后端返回了全局日期)
|
||||||
if (res.data.devInfo.useStartTime && res.data.devInfo.useEndTime) {
|
if (res.data.devInfo.useStartTime && res.data.devInfo.useEndTime) {
|
||||||
this.queryParams.useTimeRange = [
|
this.queryParams.useTimeRange = [
|
||||||
new Date(res.data.devInfo.useStartTime),
|
new Date(res.data.devInfo.useStartTime),
|
||||||
new Date(res.data.devInfo.useEndTime)
|
new Date(res.data.devInfo.useEndTime)
|
||||||
];
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.total = res.data.total || 0;
|
this.total = res.data.total || 0
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.tableList = [];
|
this.tableList = []
|
||||||
this.total = 0;
|
this.total = 0
|
||||||
this.$message.error('获取申请详情失败');
|
this.$message.error('获取申请详情失败')
|
||||||
console.error('getList error:', error);
|
console.error('getList error:', error)
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = false;
|
this.isLoading = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -517,20 +517,20 @@ export default {
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// 用户点击取消,不做操作
|
// 用户点击取消,不做操作
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 打开添加申请弹窗
|
// 打开添加申请弹窗
|
||||||
handleDialog() {
|
handleDialog() {
|
||||||
this.addQuery.pageNum = 1;
|
this.addQuery.pageNum = 1
|
||||||
this.resetAddQuery(); // 打开时重置查询条件和分页
|
this.resetAddQuery() // 打开时重置查询条件和分页
|
||||||
this.openAdd = true
|
this.openAdd = true
|
||||||
// 确保弹窗打开后表格能正确渲染
|
// 确保弹窗打开后表格能正确渲染
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.addTable) {
|
if (this.$refs.addTable) {
|
||||||
this.$refs.addTable.clearSelection();
|
this.$refs.addTable.clearSelection()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -539,70 +539,70 @@ export default {
|
||||||
*/
|
*/
|
||||||
getApplyList(pagination = {}) {
|
getApplyList(pagination = {}) {
|
||||||
// 合并分页参数,优先使用分页组件传递的参数
|
// 合并分页参数,优先使用分页组件传递的参数
|
||||||
const pageNum = pagination.pageNum || this.addQuery.pageNum;
|
const pageNum = pagination.pageNum || this.addQuery.pageNum
|
||||||
const pageSize = pagination.pageSize || this.addQuery.pageSize;
|
const pageSize = pagination.pageSize || this.addQuery.pageSize
|
||||||
|
|
||||||
// 更新组件内的分页状态
|
// 更新组件内的分页状态
|
||||||
this.addQuery.pageNum = pageNum;
|
this.addQuery.pageNum = pageNum
|
||||||
this.addQuery.pageSize = pageSize;
|
this.addQuery.pageSize = pageSize
|
||||||
|
|
||||||
// 构造完整的查询参数(包含devType)
|
// 构造完整的查询参数(包含devType)
|
||||||
const queryParams = {
|
const queryParams = {
|
||||||
...this.filterParams,
|
...this.filterParams,
|
||||||
pageNum,
|
pageNum,
|
||||||
pageSize
|
pageSize
|
||||||
};
|
}
|
||||||
|
|
||||||
this.isLoading = true;
|
this.isLoading = true
|
||||||
|
|
||||||
getApplyListApi(queryParams)
|
getApplyListApi(queryParams)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response && response.data) {
|
if (response && response.data) {
|
||||||
this.addList = response.data.rows || [];
|
this.addList = response.data.rows || []
|
||||||
this.addTotal = response.data.total || 0;
|
this.addTotal = response.data.total || 0
|
||||||
|
|
||||||
// 初始化申请数量
|
// 初始化申请数量
|
||||||
this.addList.forEach(item => {
|
this.addList.forEach(item => {
|
||||||
item.num = item.manageType === 0 ? 1 : 0;
|
item.num = item.manageType == '0' ? 1 : 0
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
this.addList = [];
|
this.addList = []
|
||||||
this.addTotal = 0;
|
this.addTotal = 0
|
||||||
this.$message.warning('获取数据格式异常');
|
this.$message.warning('获取数据格式异常')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.addList = [];
|
this.addList = []
|
||||||
this.addTotal = 0;
|
this.addTotal = 0
|
||||||
this.$message.error(`获取设备列表失败:${error.message || '未知错误'}`);
|
this.$message.error(`获取设备列表失败:${error.message || '未知错误'}`)
|
||||||
console.error('分页查询失败:', error);
|
console.error('分页查询失败:', error)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.isLoading = false;
|
this.isLoading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加申请查询(核心:处理devType筛选逻辑)
|
* 添加申请查询(核心:处理devType筛选逻辑)
|
||||||
*/
|
*/
|
||||||
handleAddQuery() {
|
handleAddQuery() {
|
||||||
this.addQuery.pageNum = 1; // 查询时重置页码为1
|
this.addQuery.pageNum = 1 // 查询时重置页码为1
|
||||||
|
|
||||||
const queryParams = { ...this.addQuery };
|
const queryParams = { ...this.addQuery }
|
||||||
|
|
||||||
// 1. 处理devType(直接使用选择的分类值:1=装备,2=工具)
|
// 1. 处理devType(直接使用选择的分类值:1=装备,2=工具)
|
||||||
const devType = queryParams.devType || '';
|
const devType = queryParams.devType || ''
|
||||||
|
|
||||||
// 2. 处理装备分类(仅当选择装备时生效)
|
// 2. 处理装备分类(仅当选择装备时生效)
|
||||||
let categoryEquipment = '';
|
let categoryEquipment = ''
|
||||||
if (devType === '1' && queryParams.categoryPath && Array.isArray(queryParams.categoryPath) && queryParams.categoryPath.length > 0) {
|
if (devType === '1' && queryParams.categoryPath && Array.isArray(queryParams.categoryPath) && queryParams.categoryPath.length > 0) {
|
||||||
categoryEquipment = String(queryParams.categoryPath[queryParams.categoryPath.length - 1]);
|
categoryEquipment = String(queryParams.categoryPath[queryParams.categoryPath.length - 1])
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 处理工具分类(仅当选择工具时生效)
|
// 3. 处理工具分类(仅当选择工具时生效)
|
||||||
let toolTypeId = '';
|
let toolTypeId = ''
|
||||||
if (devType === '2' && queryParams.toolCategoryPath && Array.isArray(queryParams.toolCategoryPath) && queryParams.toolCategoryPath.length > 0) {
|
if (devType === '2' && queryParams.toolCategoryPath && Array.isArray(queryParams.toolCategoryPath) && queryParams.toolCategoryPath.length > 0) {
|
||||||
toolTypeId = String(queryParams.toolCategoryPath[queryParams.toolCategoryPath.length - 1]);
|
toolTypeId = String(queryParams.toolCategoryPath[queryParams.toolCategoryPath.length - 1])
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存筛选条件(包含devType)
|
// 保存筛选条件(包含devType)
|
||||||
|
|
@ -614,13 +614,13 @@ export default {
|
||||||
toolTypeId,
|
toolTypeId,
|
||||||
devType, // 关键:将devType传递给后端筛选
|
devType, // 关键:将devType传递给后端筛选
|
||||||
manageType: queryParams.manageType // 关键:将manageType传递给后端筛选
|
manageType: queryParams.manageType // 关键:将manageType传递给后端筛选
|
||||||
};
|
}
|
||||||
|
|
||||||
// 调用分页查询方法
|
// 调用分页查询方法
|
||||||
this.getApplyList({
|
this.getApplyList({
|
||||||
pageNum: this.addQuery.pageNum,
|
pageNum: this.addQuery.pageNum,
|
||||||
pageSize: this.addQuery.pageSize
|
pageSize: this.addQuery.pageSize
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -636,7 +636,7 @@ export default {
|
||||||
toolCategoryPath: '',
|
toolCategoryPath: '',
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10
|
pageSize: 10
|
||||||
};
|
}
|
||||||
|
|
||||||
// 同步重置筛选参数
|
// 同步重置筛选参数
|
||||||
this.filterParams = {
|
this.filterParams = {
|
||||||
|
|
@ -646,10 +646,10 @@ export default {
|
||||||
categoryEquipment: '',
|
categoryEquipment: '',
|
||||||
toolTypeId: '',
|
toolTypeId: '',
|
||||||
devType: '' // 重置devType筛选
|
devType: '' // 重置devType筛选
|
||||||
};
|
}
|
||||||
|
|
||||||
// 重置后触发一次查询
|
// 重置后触发一次查询
|
||||||
this.getApplyList({ pageNum: 1, pageSize: this.addQuery.pageSize });
|
this.getApplyList({ pageNum: 1, pageSize: this.addQuery.pageSize })
|
||||||
},
|
},
|
||||||
|
|
||||||
// 返回上一页
|
// 返回上一页
|
||||||
|
|
@ -666,6 +666,7 @@ export default {
|
||||||
|
|
||||||
// 选择项变化(表格勾选时触发,保留devType)
|
// 选择项变化(表格勾选时触发,保留devType)
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
|
console.log(selection)
|
||||||
this.addTempList = []
|
this.addTempList = []
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map(item => item.id)
|
||||||
selection.forEach(item => {
|
selection.forEach(item => {
|
||||||
|
|
@ -679,7 +680,7 @@ export default {
|
||||||
manageType: item.manageType,
|
manageType: item.manageType,
|
||||||
devCode: item.devCode,
|
devCode: item.devCode,
|
||||||
storageNum: item.storageNum,
|
storageNum: item.storageNum,
|
||||||
num: item.manageType == 0 ? 1 : item.storageNum, // 编码设备默认1,数量设备取输入值
|
num: item.manageType === '0' ? '1' : item.storageNum, // 编码设备默认1,数量设备取输入值
|
||||||
useTime: this.queryParams.useTime ? new Date(this.queryParams.useTime) : null // 默认为主表单的使用日期
|
useTime: this.queryParams.useTime ? new Date(this.queryParams.useTime) : null // 默认为主表单的使用日期
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -711,7 +712,7 @@ export default {
|
||||||
})
|
})
|
||||||
row.num = row.storageNum // 超过库存时,自动设为最大库存
|
row.num = row.storageNum // 超过库存时,自动设为最大库存
|
||||||
} else if (row.num < 0) {
|
} else if (row.num < 0) {
|
||||||
row.num = 0; // 防止输入负数
|
row.num = 0 // 防止输入负数
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -723,7 +724,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
const itemsToAdd = this.addList.filter(item => this.ids.includes(item.id))
|
const itemsToAdd = this.addList.filter(item => this.ids.includes(item.id))
|
||||||
const invalidItem = itemsToAdd.find(item => item.manageType === 1 && (item.num === 0 || !item.num))
|
const invalidItem = itemsToAdd.find(item => item.manageType === '1' && (item.num == 0 || !item.num))
|
||||||
if (invalidItem) {
|
if (invalidItem) {
|
||||||
this.$message.error('请为数量管理的设备填写申请数量。')
|
this.$message.error('请为数量管理的设备填写申请数量。')
|
||||||
return
|
return
|
||||||
|
|
@ -752,54 +753,54 @@ export default {
|
||||||
// 提交
|
// 提交
|
||||||
async submit() {
|
async submit() {
|
||||||
this.$refs.queryForm.validate(async(valid) => {
|
this.$refs.queryForm.validate(async(valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return
|
||||||
|
|
||||||
this.$confirm('是否确定提交申请?', '提示', {
|
this.$confirm('是否确定提交申请?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(async() => {
|
}).then(async() => {
|
||||||
this.isLoading = true;
|
this.isLoading = true
|
||||||
try {
|
try {
|
||||||
// --- 修改开始:健壮的日期格式化函数 ---
|
// --- 修改开始:健壮的日期格式化函数 ---
|
||||||
const safeFormatDate = (dateInput) => {
|
const safeFormatDate = (dateInput) => {
|
||||||
// 1. 检查输入是否为 null 或 undefined
|
// 1. 检查输入是否为 null 或 undefined
|
||||||
if (!dateInput) {
|
if (!dateInput) {
|
||||||
console.warn('尝试格式化一个空的日期值');
|
console.warn('尝试格式化一个空的日期值')
|
||||||
return ''; // 或根据业务返回 '1970-01-01' 等默认值
|
return '' // 或根据业务返回 '1970-01-01' 等默认值
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 确保输入是一个 Date 对象
|
// 2. 确保输入是一个 Date 对象
|
||||||
let date;
|
let date
|
||||||
if (dateInput instanceof Date) {
|
if (dateInput instanceof Date) {
|
||||||
date = dateInput;
|
date = dateInput
|
||||||
} else {
|
} else {
|
||||||
// 如果是字符串,尝试将其转换为 Date 对象
|
// 如果是字符串,尝试将其转换为 Date 对象
|
||||||
date = new Date(dateInput);
|
date = new Date(dateInput)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 检查 Date 对象是否有效
|
// 3. 检查 Date 对象是否有效
|
||||||
if (isNaN(date.getTime())) {
|
if (isNaN(date.getTime())) {
|
||||||
console.error('无效的日期值:', dateInput);
|
console.error('无效的日期值:', dateInput)
|
||||||
return ''; // 或抛出错误
|
return '' // 或抛出错误
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 执行格式化
|
// 4. 执行格式化
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear()
|
||||||
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
const day = date.getDate().toString().padStart(2, '0');
|
const day = date.getDate().toString().padStart(2, '0')
|
||||||
return `${year}-${month}-${day}`;
|
return `${year}-${month}-${day}`
|
||||||
};
|
}
|
||||||
// --- 修改结束 ---
|
// --- 修改结束 ---
|
||||||
|
|
||||||
// 1. 处理主表单的日期范围
|
// 1. 处理主表单的日期范围
|
||||||
const devInfo = { ...this.queryParams };
|
const devInfo = { ...this.queryParams }
|
||||||
if (devInfo.useTimeRange && devInfo.useTimeRange.length === 2) {
|
if (devInfo.useTimeRange && devInfo.useTimeRange.length === 2) {
|
||||||
// 使用健壮的格式化函数
|
// 使用健壮的格式化函数
|
||||||
devInfo.useStartTime = safeFormatDate(devInfo.useTimeRange[0]);
|
devInfo.useStartTime = safeFormatDate(devInfo.useTimeRange[0])
|
||||||
devInfo.useEndTime = safeFormatDate(devInfo.useTimeRange[1]);
|
devInfo.useEndTime = safeFormatDate(devInfo.useTimeRange[1])
|
||||||
}
|
}
|
||||||
delete devInfo.useTimeRange;
|
delete devInfo.useTimeRange
|
||||||
|
|
||||||
// 2. 处理表格数据的日期
|
// 2. 处理表格数据的日期
|
||||||
const tempTableList = this.tableList.map(item => ({
|
const tempTableList = this.tableList.map(item => ({
|
||||||
|
|
@ -810,35 +811,35 @@ export default {
|
||||||
useEndTime: safeFormatDate(item.useTimeRange[1]),
|
useEndTime: safeFormatDate(item.useTimeRange[1]),
|
||||||
useTimeRange: undefined,
|
useTimeRange: undefined,
|
||||||
useTime: undefined
|
useTime: undefined
|
||||||
}));
|
}))
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
devInfo,
|
devInfo,
|
||||||
devDetailsList: tempTableList
|
devDetailsList: tempTableList
|
||||||
};
|
}
|
||||||
|
|
||||||
// ... 后续提交逻辑 ...
|
// ... 后续提交逻辑 ...
|
||||||
let res;
|
let res
|
||||||
if (!this.routerParams.id) {
|
if (!this.routerParams.id) {
|
||||||
res = await addApplyApi(params);
|
res = await addApplyApi(params)
|
||||||
} else {
|
} else {
|
||||||
res = await editApplyApi(params);
|
res = await editApplyApi(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$message.success(res.message || '操作成功!');
|
this.$message.success(res.message || '操作成功!')
|
||||||
this.$router.go(-1);
|
this.$router.go(-1)
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(res.message || '操作失败!');
|
this.$message.error(res.message || '操作失败!')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$message.error('提交申请异常,请稍后重试');
|
this.$message.error('提交申请异常,请稍后重试')
|
||||||
console.error('submit error:', error);
|
console.error('submit error:', error)
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = false;
|
this.isLoading = false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 处理分类树数据(适配六级分类)
|
// 处理分类树数据(适配六级分类)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue