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()
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [this.format(start), this.format(end)]
//
this.queryParams.taskStatus = '1'
this.getList();
},
methods: {

View File

@ -22,12 +22,12 @@
/>
</div>
</template>
<script>
import PageHeaderApply from "@/components/pageHeaderApply";
import Home from "./component/homeApply.vue"; //
import AddTools from "./component/addToolsApply.vue"; //
import QueryTools from "./component/queryToolsApply.vue"; //
import QueryTools from "./component/queryToolsApply.vue"; //
export default {
name: "LeasePublish",
components: {
@ -85,4 +85,4 @@ export default {
},
},
};
</script>
</script>

View File

@ -121,7 +121,18 @@
:popper-class="'type-select-dropdown'"
:popper-append-to-body="false"
@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
v-for="item in filteredOptions"
:key="item.typeId"
@ -472,6 +483,12 @@ export default {
keepSelectOpen: false, //
isSearching: false, //
//
typeDataLoaded: false, //
typeLoadingTimer: null, //
typeInitialLoading: false, //
hasInitialized: false, //
//
isFileFbs:false,
urlTemp: '',
@ -507,14 +524,14 @@ export default {
},
mounted() {
this.projectInfoList();//
this.equipmentType();//
// this.equipmentType();// -
this.getStandardConfigListFn() //
if (this.isEdit) {
console.log("isEdit", this.isEdit);
this.taskId = this.editTaskId;
this.id = this.editId;
this.getTaskInfo();
this.equipmentType();
// this.equipmentType(); - getTaskInfo
}
// this.projectInfoList();
// this.equipmentType();
@ -597,20 +614,67 @@ export default {
// this.$set(item, 'supplierId', supplierId)
// })
// },
/** 机具类型 */
equipmentType() {
equipmentTypeTree().then((response) => {
this.equipmentTypeList = response.data;
//
this.flattenTypeOptions = this.processTypeData(response.data);
//
this.filteredOptions = [...this.flattenTypeOptions];
/** 机具类型 - 懒加载版本 */
async equipmentType(forceLoad = false) {
//
if (this.typeDataLoaded && !forceLoad) {
return;
}
//
if (this.equipmentList.length > 0) {
this.deviceType = this.equipmentList.map(item => item.typeId);
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(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() {
@ -688,6 +752,12 @@ export default {
return;
}
//
if (!this.typeDataLoaded) {
this.lazyLoadTypeData();
return;
}
const lowercaseQuery = query.toLowerCase();
this.filteredOptions = this.flattenTypeOptions.filter(item =>
item.searchKey.includes(lowercaseQuery) ||
@ -698,6 +768,13 @@ export default {
handleTypeChange(val) {
if (!val || val.length === 0) return;
//
if (!this.typeDataLoaded) {
this.$message.warning('类型数据正在加载中,请稍后再试');
this.tempDeviceType = [];
return;
}
//
const lastSelected = val[val.length - 1];
const typeData = this.flattenTypeOptions.find(item => item.typeId === lastSelected);
@ -750,6 +827,11 @@ export default {
}
// this.loading = false;
});
//
if (this.equipmentList.length > 0) {
await this.equipmentType(true); //
}
// await this.projectInfoList();
},
checkNum(row) {
@ -1144,7 +1226,7 @@ export default {
downloadFile({fileName: file.name, fileData: file.raw, fileType: 'application/vnd.ms-excel;charset=utf-8'})
} 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 })
}
},
@ -1159,6 +1241,11 @@ export default {
//
handleVisibleChange(visible) {
if (visible) {
//
this.lazyLoadTypeData();
}
if (!visible && this.keepSelectOpen && !this.isSearching) {
//
this.$nextTick(() => {
@ -1190,6 +1277,13 @@ export default {
}
},
//
handleSelectFocus() {
this.isSearching = false;
//
this.lazyLoadTypeData();
},
//
handleHighlightSearch() {
this.isSearching = true;
@ -1201,6 +1295,12 @@ export default {
return;
}
//
if (!this.typeDataLoaded) {
this.lazyLoadTypeData();
return;
}
//
this.matchedOptions = this.filteredOptions.filter(item =>
item.fullPath.toLowerCase().includes(this.searchKeyword.toLowerCase())
@ -1230,6 +1330,12 @@ export default {
beforeDestroy() {
this.keepSelectOpen = false;
this.isSearching = false;
//
if (this.typeLoadingTimer) {
clearTimeout(this.typeLoadingTimer);
this.typeLoadingTimer = null;
}
}
};
</script>
@ -1281,22 +1387,18 @@ export default {
color: #000;
}
::v-deep .el-input-group__append {
padding: 0;
.el-button {
padding: 0 10px;
border: none;
height: 100%;
&:first-child {
border-right: 1px solid #dcdfe6;
}
&[disabled] {
color: #c0c4cc;
}
}
::v-deep .el-select-dropdown__item.is-disabled {
color: #409eff;
cursor: pointer;
font-style: italic;
text-align: center;
}
.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 {
max-height: 400px !important;
}
@ -1310,7 +1412,7 @@ export default {
}
.el-input-group__append {
::v-deep .el-input-group__append {
padding: 0;
.el-button {
padding: 0 10px;

View File

@ -528,10 +528,23 @@ export default {
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [this.format(start), this.format(end)]
// this.getStatusList();
this.getList()
// getList
// this.getTypeList()
},
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({ level: '3' }).then((response) => {
// this.typesList = response.data

View File

@ -221,7 +221,7 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryOutView">重置</el-button>
</el-form-item>
</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="typeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
@ -686,6 +686,7 @@ export default {
//
loading: true,
loadingTwo: false,
loadingView: false, //
//
showOutView: false,
//
@ -783,9 +784,22 @@ export default {
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [this.format(start), this.format(end)]
this.getList()
// getList
},
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) {
const y = date.getFullYear()
const m = String(date.getMonth() + 1).padStart(2, '0')
@ -859,9 +873,12 @@ export default {
this.queryOutView.keyWord = ''
this.showOutView = true
this.queryOutView.id = row.id
this.loadingView = true //
outInfoList(id, { keyWord: this.queryOutView.keyWord, publishTask }).then(response => {
this.getListOutInfo = response.data.leaseApplyDetailsList
// this.loading = false;
this.loadingView = false //
}).catch(() => {
this.loadingView = false //
})
},
//
@ -874,13 +891,15 @@ export default {
this.getListView()
},
getListView() {
this.loadingView = true //
outInfoList(this.queryOutView.id, {
keyWord: this.queryOutView.keyWord,
publishTask: this.publishTask
}).then(response => {
this.getListOutInfo = response.data.leaseApplyDetailsList
// this.dialogTotal = response.
// this.loading = false;
this.loadingView = false //
}).catch(() => {
this.loadingView = false //
})
},
/** 出库查询列表 */