|
|
@@ -7,7 +7,7 @@
|
|
|
v-for="item in projectTypeList"
|
|
|
:key="item.dictCode || item.dictValue || item.value"
|
|
|
:label="item.dictLabel || item.label"
|
|
|
- :value="item.dictValue || item.value"
|
|
|
+ :value="item.sourceFrom || item.dictValue || item.value"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
@@ -166,6 +166,8 @@ export default {
|
|
|
total: 0,
|
|
|
// 项目表格数据
|
|
|
projectList: [],
|
|
|
+ // 所有项目数据(用于客户端筛选)
|
|
|
+ allProjectList: [],
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
|
@@ -213,18 +215,77 @@ export default {
|
|
|
/** 查询项目列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
- listProject(this.queryParams).then(response => {
|
|
|
- this.projectList = response.rows || [];
|
|
|
- this.total = response.total || 0;
|
|
|
+
|
|
|
+ // 如果已有完整数据且只是筛选sourceFrom或更改分页,则使用客户端筛选
|
|
|
+ if (this.allProjectList.length > 0) {
|
|
|
+ this.filterProjectListBySource();
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建请求参数,获取所有数据
|
|
|
+ const params = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1000,
|
|
|
+ projectPid: this.queryParams.projectPid,
|
|
|
+ projectName: this.queryParams.projectName,
|
|
|
+ appId: this.queryParams.appId,
|
|
|
+ // 不传sourceFrom,获取所有数据
|
|
|
+ };
|
|
|
+
|
|
|
+ listProject(params).then(response => {
|
|
|
+ // 存储所有数据
|
|
|
+ this.allProjectList = response.rows || [];
|
|
|
+
|
|
|
+ // 应用筛选和分页
|
|
|
+ this.filterProjectListBySource();
|
|
|
+
|
|
|
this.loading = false;
|
|
|
}).catch(() => {
|
|
|
this.loading = false;
|
|
|
+ this.allProjectList = [];
|
|
|
+ this.projectList = [];
|
|
|
+ this.total = 0;
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
+ /** 根据sourceFrom筛选项目列表 */
|
|
|
+ filterProjectListBySource() {
|
|
|
+ if (!this.queryParams.sourceFrom) {
|
|
|
+ // 直接使用所有数据,但要处理分页
|
|
|
+ this.applyPaginationToData(this.allProjectList);
|
|
|
+ this.total = this.allProjectList.length;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 在客户端根据sourceFrom筛选
|
|
|
+ const filteredData = this.allProjectList.filter(item => {
|
|
|
+ return item.sourceFrom === this.queryParams.sourceFrom;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 应用分页
|
|
|
+ this.applyPaginationToData(filteredData);
|
|
|
+ this.total = filteredData.length;
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 对数据应用分页 */
|
|
|
+ applyPaginationToData(data) {
|
|
|
+ const start = (this.queryParams.pageNum - 1) * this.queryParams.pageSize;
|
|
|
+ const end = start + this.queryParams.pageSize;
|
|
|
+ this.projectList = data.slice(start, end);
|
|
|
+ },
|
|
|
|
|
|
getProjectTypeList() {
|
|
|
getDicts('project_type').then(response => {
|
|
|
- this.projectTypeList = response.data || [];
|
|
|
+ this.projectTypeList = (response.data || []).map(item => {
|
|
|
+ // 为特定项目类型添加sourceFrom属性
|
|
|
+ if (item.dictLabel === "慧监理") {
|
|
|
+ return { ...item, sourceFrom: "a34851c530ee0d07d1154beb47bb93dd" };
|
|
|
+ } else if (item.dictLabel === "慧项管") {
|
|
|
+ return { ...item, sourceFrom: "f47ac10b58cc4372a5670e06f141669d" };
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ });
|
|
|
}).catch(() => {
|
|
|
this.projectTypeList = [];
|
|
|
});
|
|
|
@@ -252,11 +313,15 @@ export default {
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
this.queryParams.pageNum = 1;
|
|
|
+ // 搜索时清空缓存数据,确保重新加载
|
|
|
+ this.allProjectList = [];
|
|
|
this.getList();
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
this.resetForm("queryForm");
|
|
|
+ // 重置时清空所有数据缓存,确保重新加载
|
|
|
+ this.allProjectList = [];
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
// 多选框选中数据
|