问题修复
This commit is contained in:
parent
7e37debfb1
commit
cb2f2588d2
|
|
@ -8,7 +8,7 @@
|
|||
v-show="showSearch"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="申请日期1">
|
||||
<el-form-item label="申请日期">
|
||||
<el-date-picker
|
||||
v-model="queryParams.time"
|
||||
type="daterange"
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@
|
|||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
v-if="scope.row.taskStatus != 33"
|
||||
@click="openLld(scope.row, 1)"
|
||||
>
|
||||
出库单
|
||||
|
|
@ -234,6 +235,7 @@
|
|||
<el-table-column align="center" label="序号" show-overflow-tooltip type="index" />
|
||||
<el-table-column align="center" label="机具名称" prop="typeName" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="规格型号" prop="typeModelName" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="设备编号" prop="maCode" show-overflow-tooltip v-if="leaseOutDetailParams.manageType==0"/>
|
||||
<el-table-column align="center" label="出库时间" prop="outTime" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="本次出库数量" prop="outNum" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="出库人" prop="userName" show-overflow-tooltip />
|
||||
|
|
@ -428,80 +430,72 @@
|
|||
<el-dialog :visible.sync="open" width="1138px" append-to-body @close="closePage">
|
||||
<div style="height: 500px; overflow-y: scroll; padding: 0 20px">
|
||||
<vue-easy-print tableShow ref="remarksPrintRef" class="print">
|
||||
<div class="title" style="text-align: center; font-weight: 600; font-size: 26px">
|
||||
重庆市送变电机具设备分公司工机具出库单
|
||||
</div>
|
||||
<div class="info" style="margin-top: 10px; display: flex; flex-wrap: wrap">
|
||||
<div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
|
||||
<span>领料单位:</span>{{ leaseOutData.unitName }}
|
||||
<div v-for="(item, index) in groupedLeaseOutDetailRecord" :key="index" class="print-page">
|
||||
<div class="title" style="text-align: center; font-weight: 600; font-size: 26px">
|
||||
重庆市送变电机具设备分公司工机具出库单
|
||||
</div>
|
||||
<div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
|
||||
<span>出库时间:</span>
|
||||
<!-- 添加精确到时分秒的日期选择器 -->
|
||||
<el-date-picker
|
||||
v-show="showSelect"
|
||||
v-model="leaseOutData.outTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 200px"
|
||||
placeholder="请选择出库时间"
|
||||
@change="changeTime"
|
||||
/>
|
||||
<span v-show="!showSelect" @click="showSelect = true" style="cursor: pointer">{{formattedOutTime
|
||||
}}</span>
|
||||
<div class="info" style="margin-top: 10px; display: flex; flex-wrap: wrap">
|
||||
<div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
|
||||
<span>领料单位:</span>{{ leaseOutData.unitName }}
|
||||
</div>
|
||||
<div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
|
||||
<span>出库时间:</span>
|
||||
<!-- 添加精确到时分秒的日期选择器 -->
|
||||
<el-date-picker
|
||||
v-show="showSelect"
|
||||
v-model="item.date"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 200px"
|
||||
placeholder="请选择出库时间"
|
||||
@change="(newValue) => changeTime(index, newValue)"
|
||||
:picker-options="{}"
|
||||
/>
|
||||
<span v-show="!showSelect" @click="showSelect = true" style="cursor: pointer">{{formattedOutTime(item.date)
|
||||
}}</span>
|
||||
<!-- <span>{{ date }}</span> -->
|
||||
</div>
|
||||
|
||||
<div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
|
||||
<span>工程名称:</span>{{ leaseOutData.proName }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
|
||||
<span>出库时间:</span>{{ leaseOutData.updateTime }}
|
||||
</div> -->
|
||||
<div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
|
||||
<span>工程名称:</span>{{ leaseOutData.proName }}
|
||||
</div>
|
||||
<!-- <div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
|
||||
<span>编号:</span>{{ leaseOutData.code }}
|
||||
</div> -->
|
||||
</div>
|
||||
<el-table :data="leaseOutDetailRecord" class="table" border style="margin-top: 20px; padding: 1px" :row-class-name="setRowClassName">
|
||||
<el-table-column label="序号" align="center" type="index" />
|
||||
<el-table-column
|
||||
type="expand"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-table v-if="scope.row && scope.row.maWholeVos" :data="scope.row.maWholeVos">
|
||||
<el-table-column align="center" label="机具名称" prop="typeName" />
|
||||
<el-table-column align="center" label="规格型号" prop="deviceType" />
|
||||
<el-table-column align="center" label="预领数量" prop="applyNum" />
|
||||
<el-table-column align="center" label="库存数量" prop="num" />
|
||||
</el-table>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型名称" align="center" prop="typeName" />
|
||||
<el-table-column label="规格型号" align="center" prop="typeModelName" />
|
||||
<el-table-column label="单位" align="center" prop="unitNames" />
|
||||
<el-table-column label="出库数量" align="center" prop="outNum" />
|
||||
<el-table-column label="状态" align="center" prop="status" >
|
||||
<template slot-scope="scope">
|
||||
<span>完好</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备编码" align="center" prop="maCode" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<!-- <el-table-column label="出库方式" align="center" prop="manageTypeName" /> -->
|
||||
</el-table>
|
||||
<el-table :data="item.group" class="table" border style="margin-top: 20px; padding: 1px" :row-class-name="setRowClassName">
|
||||
<el-table-column label="序号" align="center" type="index" />
|
||||
<el-table-column
|
||||
type="expand"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-table v-if="scope.row && scope.row.maWholeVos" :data="scope.row.maWholeVos">
|
||||
<el-table-column align="center" label="机具名称" prop="typeName" />
|
||||
<el-table-column align="center" label="规格型号" prop="deviceType" />
|
||||
<el-table-column align="center" label="预领数量" prop="applyNum" />
|
||||
<el-table-column align="center" label="库存数量" prop="num" />
|
||||
</el-table>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型名称" align="center" prop="typeName" />
|
||||
<el-table-column label="规格型号" align="center" prop="typeModelName" />
|
||||
<el-table-column label="单位" align="center" prop="unitNames" />
|
||||
<el-table-column label="出库数量" align="center" prop="outNum" />
|
||||
<el-table-column label="状态" align="center" prop="status" >
|
||||
<template slot-scope="scope">
|
||||
<span>完好</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备编码" align="center" prop="maCode" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
</el-table>
|
||||
|
||||
<div style="margin: 15px 0;text-align: center; font-size: 20px; font-weight: 800">机器类设备需维修人员检查后确定好坏</div>
|
||||
<div class="fillIn" style=" display: flex">
|
||||
<div class="item" style="width: 60%">
|
||||
<span>机具分公司发货人:</span>
|
||||
<div style="margin: 15px 0;text-align: center; font-size: 20px; font-weight: 800">机器类设备需维修人员检查后确定好坏</div>
|
||||
<div class="fillIn" style=" display: flex">
|
||||
<div class="item" style="width: 60%">
|
||||
<span>机具分公司发货人:</span>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span>分公司领用人:</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span>分公司领用人:</span>
|
||||
</div>
|
||||
<!-- <div class="item" style="width: 25%">
|
||||
<span>仓库:</span>
|
||||
</div>
|
||||
<div class="item" style="width: 25%">
|
||||
<span>操作人:</span>
|
||||
</div> -->
|
||||
</div>
|
||||
</vue-easy-print>
|
||||
</div>
|
||||
|
|
@ -627,6 +621,7 @@ export default {
|
|||
typeId: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
manageType: '',
|
||||
},
|
||||
leaseOutDetailsList: [],
|
||||
outTime: [],
|
||||
|
|
@ -667,6 +662,9 @@ export default {
|
|||
],
|
||||
},
|
||||
outTime:'',
|
||||
remarkLease:'',
|
||||
groupedLeaseOutDetailRecord: [],
|
||||
oldGroupedLeaseOutDetailRecord: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
@ -679,21 +677,42 @@ export default {
|
|||
this.GetProData()
|
||||
},
|
||||
computed: {
|
||||
formattedOutTime() {
|
||||
if (this.leaseOutData.outTime instanceof Date) {
|
||||
const year = this.leaseOutData.outTime.getFullYear();
|
||||
const month = String(this.leaseOutData.outTime.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(this.leaseOutData.outTime.getDate()).padStart(2, '0');
|
||||
const hours = String(this.leaseOutData.outTime.getHours()).padStart(2, '0');
|
||||
const minutes = String(this.leaseOutData.outTime.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(this.leaseOutData.outTime.getSeconds()).padStart(2, '0');
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
return this.leaseOutData.outTime;
|
||||
}
|
||||
// groupedLeaseOutDetailRecord() {
|
||||
// const groupedMap = {};
|
||||
// const recordList = this.leaseOutDetailRecord || [];
|
||||
// recordList.forEach(item => {
|
||||
// const date = item.createTime;
|
||||
// if (!groupedMap[date]) {
|
||||
// groupedMap[date] = [];
|
||||
// }
|
||||
// groupedMap[date].push(item);
|
||||
// });
|
||||
// // 将对象转换为数组
|
||||
// return Object.entries(groupedMap).map(([date, group]) => ({ date, group }));
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
|
||||
formattedOutTime(date) {
|
||||
if (typeof date === 'string') {
|
||||
// 直接将 ISO 8601 格式字符串转换为 Date 对象
|
||||
date = new Date(date);
|
||||
} else if (!(date instanceof Date)) {
|
||||
console.error('传入的日期既不是字符串也不是 Date 对象:', date);
|
||||
return '';
|
||||
}
|
||||
// 检查转换后的 date 是否为有效的 Date 对象
|
||||
if (isNaN(date.getTime())) {
|
||||
console.error('传入的日期格式无效:', date);
|
||||
return '';
|
||||
}
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
},
|
||||
generateUUID() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
const r = Math.random() * 16 | 0;
|
||||
|
|
@ -799,6 +818,7 @@ export default {
|
|||
this.isView = true
|
||||
this.dialogQuery.id = row.id
|
||||
this.leaseOutDetailParams.id = row.id
|
||||
this.leaseOutDetailParams.manageType = row.manageType
|
||||
this.resetDialogQuery()
|
||||
// this.getDialogList();
|
||||
},
|
||||
|
|
@ -826,6 +846,7 @@ export default {
|
|||
this.leaseType = row.leaseType
|
||||
this.resetDialogQuery()
|
||||
this.timeTemp = row.estimateLeaseTime
|
||||
this.remarkLease = row.remarkLease
|
||||
// this.getDialogList()
|
||||
},
|
||||
|
||||
|
|
@ -840,6 +861,7 @@ export default {
|
|||
// 提取年、月、日并格式化为 YYYY-MM-DD 格式
|
||||
const formattedDate = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
|
||||
this.codeOutForm.createTime = formattedDate;
|
||||
this.codeOutForm.remark = this.remarkLease
|
||||
this.outNum = row.outNum
|
||||
this.outQuery.typeId = row.typeId
|
||||
this.outObj = row
|
||||
|
|
@ -862,6 +884,7 @@ export default {
|
|||
// 提取年、月、日并格式化为 YYYY-MM-DD 格式
|
||||
const formattedDate = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
|
||||
this.numOutForm.createTime = formattedDate
|
||||
this.numOutForm.remark = this.remarkLease
|
||||
// console.log(row)
|
||||
let obj = {}
|
||||
this.$set(obj, 'taskId', row.taskId)
|
||||
|
|
@ -1045,6 +1068,7 @@ export default {
|
|||
this.leaseOutDetailParams.typeId = row.typeId
|
||||
this.leaseOutDetailParams.startTime = ''
|
||||
this.leaseOutDetailParams.endTime = ''
|
||||
this.leaseOutDetailParams.manageType = row.manageType
|
||||
this.outTime = []
|
||||
this.onHandleQuery().then(() => {
|
||||
this.outRecordVisible = true
|
||||
|
|
@ -1064,6 +1088,29 @@ export default {
|
|||
this.leaseOutData = res.data
|
||||
this.leaseOutData.outTime = res.data.outTime ? new Date(res.data.outTime) : ''
|
||||
this.outTime = this.leaseOutData.outTime
|
||||
|
||||
// 按年月日对 leaseOutDetailRecord 进行分组
|
||||
const groupedRecords = {};
|
||||
this.leaseOutDetailRecord.forEach(item => {
|
||||
// 假设 item.createTime 是日期字符串
|
||||
const createTime = new Date(item.createTime);
|
||||
const year = createTime.getFullYear();
|
||||
const month = String(createTime.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(createTime.getDate()).padStart(2, '0');
|
||||
const dateKey = `${year}-${month}-${day}`;
|
||||
|
||||
if (!groupedRecords[dateKey]) {
|
||||
groupedRecords[dateKey] = [];
|
||||
}
|
||||
groupedRecords[dateKey].push(item);
|
||||
});
|
||||
|
||||
// 将分组结果赋值给新的属性
|
||||
this.groupedLeaseOutDetailRecord = Object.entries(groupedRecords).map(([date, group]) => ({
|
||||
date: new Date(date + 'T08:00:00'),
|
||||
group
|
||||
}));
|
||||
this.oldGroupedLeaseOutDetailRecord = JSON.parse(JSON.stringify(this.groupedLeaseOutDetailRecord));
|
||||
},
|
||||
// 领料单 打印
|
||||
print() {
|
||||
|
|
@ -1161,27 +1208,31 @@ export default {
|
|||
},
|
||||
|
||||
|
||||
changeTime(newValue) {
|
||||
changeTime(index, newValue) {
|
||||
console.log("Vvvvvvvvv",this.oldGroupedLeaseOutDetailRecord[index].date)
|
||||
this.$confirm('确认要修改出库时间吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 确保 newValue 是字符串格式
|
||||
const updateTime = typeof newValue === 'string' ? newValue : newValue.toISOString().replace('T', ' ').slice(0, 19);
|
||||
// 调用接口更新出库时间
|
||||
updateOutTime({
|
||||
id: this.rowTemp.id, // 假设需要传递记录的 ID
|
||||
updateTime: newValue,
|
||||
taskId: this.rowTemp.taskId,
|
||||
preTime: this.outTime,
|
||||
preTime: this.formattedOutTime(this.oldGroupedLeaseOutDetailRecord[index].date),
|
||||
outTime:newValue,
|
||||
}).then((response) => {
|
||||
if (response.code === 200) { // 假设接口返回成功状态码为 200
|
||||
this.leaseOutData.outTime = newValue;
|
||||
this.$set(this.groupedLeaseOutDetailRecord[index], 'date', new Date(updateTime));
|
||||
this.showSelect = false;
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '出库时间修改成功'
|
||||
});
|
||||
this.oldGroupedLeaseOutDetailRecord[index].date = this.groupedLeaseOutDetailRecord[index].date
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
|
|
@ -1217,4 +1268,18 @@ export default {
|
|||
::v-deep .no-expand-row .el-table__expand-icon {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.print-page {
|
||||
// 确保每个出库单在打印时从新页面开始
|
||||
page-break-after: always;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
@media print {
|
||||
.print-page:last-child {
|
||||
// 最后一个出库单不添加分页
|
||||
page-break-after: avoid;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -657,6 +657,10 @@ export default {
|
|||
|
||||
//正则校验配件费用
|
||||
meneyIntegerValidator(rule, value, callback) {
|
||||
// 处理 null 值
|
||||
if (value === null) {
|
||||
value = '';
|
||||
}
|
||||
const reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
|
||||
if (value === '' || reg.test(value)) {
|
||||
callback()
|
||||
|
|
@ -681,6 +685,10 @@ export default {
|
|||
},
|
||||
|
||||
numberIntegerValidatorPart(rule, value, callback) {
|
||||
// 处理 null 值
|
||||
if (value === null) {
|
||||
value = '';
|
||||
}
|
||||
// 若值为空字符串,直接通过验证
|
||||
if (value === '') {
|
||||
callback();
|
||||
|
|
|
|||
|
|
@ -545,6 +545,9 @@ export default {
|
|||
}
|
||||
},
|
||||
numberIntegerValidatorPart(rule, value, callback) {
|
||||
if (value === null) {
|
||||
value = '';
|
||||
}
|
||||
// 若值为空字符串,直接通过验证
|
||||
if (value === '') {
|
||||
callback();
|
||||
|
|
|
|||
Loading…
Reference in New Issue