This commit is contained in:
parent
809f413386
commit
ce1618bb85
|
|
@ -328,6 +328,8 @@ export default {
|
||||||
let start = new Date()
|
let start = new Date()
|
||||||
start.setMonth(start.getMonth() - 1)
|
start.setMonth(start.getMonth() - 1)
|
||||||
this.queryParams.time = [this.format(start), this.format(end)]
|
this.queryParams.time = [this.format(start), this.format(end)]
|
||||||
|
// 设置默认状态为第一个选项(未完成)
|
||||||
|
this.queryParams.taskStatus = '1'
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,18 @@
|
||||||
:popper-class="'type-select-dropdown'"
|
:popper-class="'type-select-dropdown'"
|
||||||
:popper-append-to-body="false"
|
:popper-append-to-body="false"
|
||||||
@visible-change="handleVisibleChange"
|
@visible-change="handleVisibleChange"
|
||||||
|
@focus="handleSelectFocus"
|
||||||
|
:loading="typeInitialLoading"
|
||||||
|
loading-text="加载中..."
|
||||||
>
|
>
|
||||||
|
<el-option
|
||||||
|
v-if="!typeDataLoaded && !typeInitialLoading"
|
||||||
|
key="loading-placeholder"
|
||||||
|
label="点击加载类型规格数据..."
|
||||||
|
value=""
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in filteredOptions"
|
v-for="item in filteredOptions"
|
||||||
:key="item.typeId"
|
:key="item.typeId"
|
||||||
|
|
@ -472,6 +483,12 @@ export default {
|
||||||
keepSelectOpen: false, // 控制下拉框是否保持打开
|
keepSelectOpen: false, // 控制下拉框是否保持打开
|
||||||
isSearching: false, // 添加搜索状态标记
|
isSearching: false, // 添加搜索状态标记
|
||||||
|
|
||||||
|
// 懒加载相关状态
|
||||||
|
typeDataLoaded: false, // 类型数据是否已加载
|
||||||
|
typeLoadingTimer: null, // 延迟加载定时器
|
||||||
|
typeInitialLoading: false, // 初始加载状态
|
||||||
|
hasInitialized: false, // 是否已初始化
|
||||||
|
|
||||||
//是否是分包商
|
//是否是分包商
|
||||||
isFileFbs:false,
|
isFileFbs:false,
|
||||||
urlTemp: '',
|
urlTemp: '',
|
||||||
|
|
@ -507,14 +524,14 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.projectInfoList();//单位工程下拉选
|
this.projectInfoList();//单位工程下拉选
|
||||||
this.equipmentType();//机具类型下拉选
|
// this.equipmentType();//机具类型下拉选 - 改为懒加载
|
||||||
this.getStandardConfigListFn() // 获取标准配置
|
this.getStandardConfigListFn() // 获取标准配置
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
console.log("isEdit", this.isEdit);
|
console.log("isEdit", this.isEdit);
|
||||||
this.taskId = this.editTaskId;
|
this.taskId = this.editTaskId;
|
||||||
this.id = this.editId;
|
this.id = this.editId;
|
||||||
this.getTaskInfo();
|
this.getTaskInfo();
|
||||||
this.equipmentType();
|
// this.equipmentType(); - 在getTaskInfo中按需加载
|
||||||
}
|
}
|
||||||
// this.projectInfoList();
|
// this.projectInfoList();
|
||||||
// this.equipmentType();
|
// this.equipmentType();
|
||||||
|
|
@ -597,20 +614,67 @@ export default {
|
||||||
// this.$set(item, 'supplierId', supplierId)
|
// this.$set(item, 'supplierId', supplierId)
|
||||||
// })
|
// })
|
||||||
// },
|
// },
|
||||||
/** 机具类型 */
|
/** 机具类型 - 懒加载版本 */
|
||||||
equipmentType() {
|
async equipmentType(forceLoad = false) {
|
||||||
equipmentTypeTree().then((response) => {
|
// 如果数据已加载且不是强制加载,直接返回
|
||||||
this.equipmentTypeList = response.data;
|
if (this.typeDataLoaded && !forceLoad) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.typeInitialLoading = true;
|
||||||
|
const response = await equipmentTypeTree();
|
||||||
|
|
||||||
|
// 使用 requestIdleCallback 在空闲时处理数据,避免阻塞主线程
|
||||||
|
if (window.requestIdleCallback) {
|
||||||
|
window.requestIdleCallback(() => {
|
||||||
|
this.processEquipmentTypeData(response.data);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 降级方案:使用 setTimeout
|
||||||
|
setTimeout(() => {
|
||||||
|
this.processEquipmentTypeData(response.data);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载机具类型数据失败:', error);
|
||||||
|
this.$message.error('加载机具类型数据失败');
|
||||||
|
} finally {
|
||||||
|
this.typeInitialLoading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理机具类型数据
|
||||||
|
processEquipmentTypeData(data) {
|
||||||
|
this.equipmentTypeList = data;
|
||||||
// 处理并扁平化所有类型数据
|
// 处理并扁平化所有类型数据
|
||||||
this.flattenTypeOptions = this.processTypeData(response.data);
|
this.flattenTypeOptions = this.processTypeData(data);
|
||||||
// 初始显示所有选项
|
// 初始显示所有选项
|
||||||
this.filteredOptions = [...this.flattenTypeOptions];
|
this.filteredOptions = [...this.flattenTypeOptions];
|
||||||
|
this.typeDataLoaded = true;
|
||||||
|
|
||||||
// 反显选中数据
|
// 反显选中数据
|
||||||
if (this.equipmentList.length > 0) {
|
if (this.equipmentList.length > 0) {
|
||||||
this.deviceType = this.equipmentList.map(item => item.typeId);
|
this.deviceType = this.equipmentList.map(item => item.typeId);
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
|
||||||
|
// 延迟加载类型数据
|
||||||
|
lazyLoadTypeData() {
|
||||||
|
// 清除之前的定时器
|
||||||
|
if (this.typeLoadingTimer) {
|
||||||
|
clearTimeout(this.typeLoadingTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果数据已加载,直接返回
|
||||||
|
if (this.typeDataLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置延迟加载
|
||||||
|
this.typeLoadingTimer = setTimeout(() => {
|
||||||
|
this.equipmentType();
|
||||||
|
}, 300); // 300ms 延迟
|
||||||
},
|
},
|
||||||
// 获取标准配置
|
// 获取标准配置
|
||||||
async getStandardConfigListFn() {
|
async getStandardConfigListFn() {
|
||||||
|
|
@ -688,6 +752,12 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保数据已加载
|
||||||
|
if (!this.typeDataLoaded) {
|
||||||
|
this.lazyLoadTypeData();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const lowercaseQuery = query.toLowerCase();
|
const lowercaseQuery = query.toLowerCase();
|
||||||
this.filteredOptions = this.flattenTypeOptions.filter(item =>
|
this.filteredOptions = this.flattenTypeOptions.filter(item =>
|
||||||
item.searchKey.includes(lowercaseQuery) ||
|
item.searchKey.includes(lowercaseQuery) ||
|
||||||
|
|
@ -698,6 +768,13 @@ export default {
|
||||||
handleTypeChange(val) {
|
handleTypeChange(val) {
|
||||||
if (!val || val.length === 0) return;
|
if (!val || val.length === 0) return;
|
||||||
|
|
||||||
|
// 确保数据已加载
|
||||||
|
if (!this.typeDataLoaded) {
|
||||||
|
this.$message.warning('类型数据正在加载中,请稍后再试');
|
||||||
|
this.tempDeviceType = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取新选中的项
|
// 获取新选中的项
|
||||||
const lastSelected = val[val.length - 1];
|
const lastSelected = val[val.length - 1];
|
||||||
const typeData = this.flattenTypeOptions.find(item => item.typeId === lastSelected);
|
const typeData = this.flattenTypeOptions.find(item => item.typeId === lastSelected);
|
||||||
|
|
@ -750,6 +827,11 @@ export default {
|
||||||
}
|
}
|
||||||
// this.loading = false;
|
// this.loading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 如果有设备列表,需要加载类型数据来正确显示
|
||||||
|
if (this.equipmentList.length > 0) {
|
||||||
|
await this.equipmentType(true); // 强制加载
|
||||||
|
}
|
||||||
// await this.projectInfoList();
|
// await this.projectInfoList();
|
||||||
},
|
},
|
||||||
checkNum(row) {
|
checkNum(row) {
|
||||||
|
|
@ -1144,7 +1226,7 @@ export default {
|
||||||
downloadFile({fileName: file.name, fileData: file.raw, fileType: 'application/vnd.ms-excel;charset=utf-8'})
|
downloadFile({fileName: file.name, fileData: file.raw, fileType: 'application/vnd.ms-excel;charset=utf-8'})
|
||||||
} else if (file.status === 'success') {
|
} else if (file.status === 'success') {
|
||||||
|
|
||||||
downloadFileData({fileName: file.name, fileUrl: file.url})
|
downloadFileData({ fileName: file.name,fileUrl:file.url })
|
||||||
// downloadFileData({ fileName: file.name,fileUrl:file.url })
|
// downloadFileData({ fileName: file.name,fileUrl:file.url })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1159,6 +1241,11 @@ export default {
|
||||||
|
|
||||||
// 处理下拉框可见性变化
|
// 处理下拉框可见性变化
|
||||||
handleVisibleChange(visible) {
|
handleVisibleChange(visible) {
|
||||||
|
if (visible) {
|
||||||
|
// 下拉框打开时触发懒加载
|
||||||
|
this.lazyLoadTypeData();
|
||||||
|
}
|
||||||
|
|
||||||
if (!visible && this.keepSelectOpen && !this.isSearching) {
|
if (!visible && this.keepSelectOpen && !this.isSearching) {
|
||||||
// 只有在非搜索状态下才重新打开下拉框
|
// 只有在非搜索状态下才重新打开下拉框
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|
@ -1190,6 +1277,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 处理下拉框获得焦点
|
||||||
|
handleSelectFocus() {
|
||||||
|
this.isSearching = false;
|
||||||
|
// 触发懒加载
|
||||||
|
this.lazyLoadTypeData();
|
||||||
|
},
|
||||||
|
|
||||||
// 高亮搜索处理
|
// 高亮搜索处理
|
||||||
handleHighlightSearch() {
|
handleHighlightSearch() {
|
||||||
this.isSearching = true;
|
this.isSearching = true;
|
||||||
|
|
@ -1201,6 +1295,12 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保数据已加载
|
||||||
|
if (!this.typeDataLoaded) {
|
||||||
|
this.lazyLoadTypeData();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 找到所有匹配项
|
// 找到所有匹配项
|
||||||
this.matchedOptions = this.filteredOptions.filter(item =>
|
this.matchedOptions = this.filteredOptions.filter(item =>
|
||||||
item.fullPath.toLowerCase().includes(this.searchKeyword.toLowerCase())
|
item.fullPath.toLowerCase().includes(this.searchKeyword.toLowerCase())
|
||||||
|
|
@ -1230,6 +1330,12 @@ export default {
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.keepSelectOpen = false;
|
this.keepSelectOpen = false;
|
||||||
this.isSearching = false;
|
this.isSearching = false;
|
||||||
|
|
||||||
|
// 清理定时器
|
||||||
|
if (this.typeLoadingTimer) {
|
||||||
|
clearTimeout(this.typeLoadingTimer);
|
||||||
|
this.typeLoadingTimer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -1281,22 +1387,18 @@ export default {
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .el-input-group__append {
|
::v-deep .el-select-dropdown__item.is-disabled {
|
||||||
padding: 0;
|
color: #409eff;
|
||||||
.el-button {
|
cursor: pointer;
|
||||||
padding: 0 10px;
|
font-style: italic;
|
||||||
border: none;
|
text-align: center;
|
||||||
height: 100%;
|
|
||||||
&:first-child {
|
|
||||||
border-right: 1px solid #dcdfe6;
|
|
||||||
}
|
|
||||||
&[disabled] {
|
|
||||||
color: #c0c4cc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.type-select-dropdown {
|
::v-deep .el-select .el-input.is-focus .el-input__inner {
|
||||||
|
border-color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .type-select-dropdown {
|
||||||
.el-select-dropdown__wrap {
|
.el-select-dropdown__wrap {
|
||||||
max-height: 400px !important;
|
max-height: 400px !important;
|
||||||
}
|
}
|
||||||
|
|
@ -1310,7 +1412,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.el-input-group__append {
|
::v-deep .el-input-group__append {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
.el-button {
|
.el-button {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
|
|
|
||||||
|
|
@ -528,10 +528,23 @@ export default {
|
||||||
start.setMonth(start.getMonth() - 1)
|
start.setMonth(start.getMonth() - 1)
|
||||||
this.queryParams.time = [this.format(start), this.format(end)]
|
this.queryParams.time = [this.format(start), this.format(end)]
|
||||||
// this.getStatusList();
|
// this.getStatusList();
|
||||||
this.getList()
|
// 不在这里直接调用getList,等字典数据加载完成后再调用
|
||||||
// this.getTypeList()
|
// this.getTypeList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 字典数据加载完成后的回调
|
||||||
|
onDictReady(dict) {
|
||||||
|
// 获取lease_task_status的所有选项
|
||||||
|
const validOptions = dict.type.lease_task_status || []
|
||||||
|
|
||||||
|
// 如果有有效选项,设置第一个为默认值
|
||||||
|
if (validOptions.length > 0) {
|
||||||
|
this.queryParams.taskStatus = validOptions[0].value
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行查询
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
// getTypeList() {
|
// getTypeList() {
|
||||||
// getTypeList({ level: '3' }).then((response) => {
|
// getTypeList({ level: '3' }).then((response) => {
|
||||||
// this.typesList = response.data
|
// this.typesList = response.data
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryOutView">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryOutView">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table :data="getListOutInfo" width="600px" height="450">
|
<el-table v-loading="loadingView" :data="getListOutInfo" width="600px" height="450">
|
||||||
<el-table-column label="类型名称" align="center" prop="maTypeName" :show-overflow-tooltip="true" />
|
<el-table-column label="类型名称" align="center" prop="maTypeName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="规格型号" align="center" prop="typeName" :show-overflow-tooltip="true" />
|
<el-table-column label="规格型号" align="center" prop="typeName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
|
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
|
||||||
|
|
@ -686,6 +686,7 @@ export default {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
loadingTwo: false,
|
loadingTwo: false,
|
||||||
|
loadingView: false, // 查看弹窗的加载状态
|
||||||
//查看的显示
|
//查看的显示
|
||||||
showOutView: false,
|
showOutView: false,
|
||||||
//出库的显示
|
//出库的显示
|
||||||
|
|
@ -783,9 +784,22 @@ export default {
|
||||||
let start = new Date()
|
let start = new Date()
|
||||||
start.setMonth(start.getMonth() - 1)
|
start.setMonth(start.getMonth() - 1)
|
||||||
this.queryParams.time = [this.format(start), this.format(end)]
|
this.queryParams.time = [this.format(start), this.format(end)]
|
||||||
this.getList()
|
// 不在这里直接调用getList,等字典数据加载完成后再调用
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 字典数据加载完成后的回调
|
||||||
|
onDictReady(dict) {
|
||||||
|
// 获取过滤后的状态选项(排除值为1和2的选项)
|
||||||
|
const validOptions = dict.type.lease_task_status.filter(item => item.value != 1 && item.value != 2)
|
||||||
|
|
||||||
|
// 如果有有效选项,设置第一个为默认值
|
||||||
|
if (validOptions.length > 0) {
|
||||||
|
this.queryParams.taskStatus = validOptions[0].value
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行查询
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
format(date) {
|
format(date) {
|
||||||
const y = date.getFullYear()
|
const y = date.getFullYear()
|
||||||
const m = String(date.getMonth() + 1).padStart(2, '0')
|
const m = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
|
@ -859,9 +873,12 @@ export default {
|
||||||
this.queryOutView.keyWord = ''
|
this.queryOutView.keyWord = ''
|
||||||
this.showOutView = true
|
this.showOutView = true
|
||||||
this.queryOutView.id = row.id
|
this.queryOutView.id = row.id
|
||||||
|
this.loadingView = true // 开启加载动画
|
||||||
outInfoList(id, { keyWord: this.queryOutView.keyWord, publishTask }).then(response => {
|
outInfoList(id, { keyWord: this.queryOutView.keyWord, publishTask }).then(response => {
|
||||||
this.getListOutInfo = response.data.leaseApplyDetailsList
|
this.getListOutInfo = response.data.leaseApplyDetailsList
|
||||||
// this.loading = false;
|
this.loadingView = false // 关闭加载动画
|
||||||
|
}).catch(() => {
|
||||||
|
this.loadingView = false // 请求失败时也要关闭加载动画
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//查看
|
//查看
|
||||||
|
|
@ -874,13 +891,15 @@ export default {
|
||||||
this.getListView()
|
this.getListView()
|
||||||
},
|
},
|
||||||
getListView() {
|
getListView() {
|
||||||
|
this.loadingView = true // 开启加载动画
|
||||||
outInfoList(this.queryOutView.id, {
|
outInfoList(this.queryOutView.id, {
|
||||||
keyWord: this.queryOutView.keyWord,
|
keyWord: this.queryOutView.keyWord,
|
||||||
publishTask: this.publishTask
|
publishTask: this.publishTask
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.getListOutInfo = response.data.leaseApplyDetailsList
|
this.getListOutInfo = response.data.leaseApplyDetailsList
|
||||||
// this.dialogTotal = response.
|
this.loadingView = false // 关闭加载动画
|
||||||
// this.loading = false;
|
}).catch(() => {
|
||||||
|
this.loadingView = false // 请求失败时也要关闭加载动画
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 出库查询列表 */
|
/** 出库查询列表 */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue