This commit is contained in:
syruan 2025-07-27 19:10:20 +08:00
parent 809f413386
commit ce1618bb85
5 changed files with 175 additions and 39 deletions

View File

@ -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: {

View File

@ -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;
this.flattenTypeOptions = this.processTypeData(response.data); }
//
this.filteredOptions = [...this.flattenTypeOptions];
// try {
if (this.equipmentList.length > 0) { this.typeInitialLoading = true;
this.deviceType = this.equipmentList.map(item => item.typeId); 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(data);
//
this.filteredOptions = [...this.flattenTypeOptions];
this.typeDataLoaded = true;
//
if (this.equipmentList.length > 0) {
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;

View File

@ -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

View File

@ -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) {
// 12
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 //
}) })
}, },
/** 出库查询列表 */ /** 出库查询列表 */