@@ -139,12 +140,13 @@
v-model="enterprise.queryParams.wr"
placeholder="请选择污染程度"
size="large"
+ clearable
>
@@ -165,6 +167,7 @@
borderBottom: '1px solid #EBEEF5',
backgroundColor: '#F5F7FA'
}"
+ size="large"
>
@@ -307,6 +310,7 @@ const formData = ref({
tags: [],
enterprises: [] as any
})
+const isReadonly = ref(true)
const router = useRouter()
const route = useRoute()
const tagView = useTagsViewStore()
@@ -334,7 +338,7 @@ const { query } = useRoute()
const formRef = ref() // 表单 Ref`
const tagList = ref([])
const queryFormRef = ref() // 搜索的表单
-const enterprise = ref({
+const enterprise:any = ref({
list: [] as any,
queryParams: reactive({
pageNo: 1,
@@ -393,9 +397,9 @@ const deleteHandle = (id: number) => {
if (targetIndex === -1) return;
// 删除元素(触发响应式更新)
- enterprise.value.list.splice(targetIndex, 1);
+ enterprise.value.list.splice(targetIndex, 1)
- enterprise_copy.value = cloneDeep(enterprise.value);
+ enterprise_copy.value = cloneDeep(enterprise.value)
enterprise.value.total = enterprise.value.list.length
@@ -404,7 +408,7 @@ const deleteHandle = (id: number) => {
const itemsOnCurrentPage = enterprise.value.list.slice(
(pageNo - 1) * pageSize,
pageNo * pageSize
- );
+ )
if (itemsOnCurrentPage.length === 0 && pageNo > 1) {
enterprise.value.queryParams.pageNo = pageNo - 1;
@@ -456,36 +460,32 @@ const handleQuery = () => {
// 动态过滤函数
const filterList = (list: EnterprisesVO[]) => {
+ console.log('isAllConditionsEmpty.value', isAllConditionsEmpty.value)
if (isAllConditionsEmpty.value) return enterprise_copy.value.list; // 直接返回完整列表
+
if (list.length > 0) {
const { enterprisesName, qy, hy, st, wr , userId } = enterprise.value.queryParams;
-
- return list.filter(item => {
- // 名称匹配(模糊查询)
- const nameMatch = enterprisesName ?
- item.enterprisesName?.toLowerCase().includes(enterprisesName.toLowerCase()) : true;
- // 类型精确匹配
- const typeMatch = qy ? item.region == qy : true;
- //地区精确匹配
- const hyMatch = hy ? item.tagList.includes(hy) : true
-
- const stMatch = st ? item.tagList.includes(st) : true
- const wrMatch = wr ? item.tagList.includes(wr) : true
-
- const userIdMatch = userId ? item.userId == userId : true
+ return list.filter(item => {
+ if (item.tagList) {
+ // 名称匹配(模糊查询)
+ const nameMatch = enterprisesName ?
+ item.enterprisesName?.toLowerCase().includes(enterprisesName.toLowerCase()) : true;
+ // 类型精确匹配
+ const typeMatch = qy ? item.region == qy : true;
+ //地区精确匹配
+ const hyMatch = hy ? item.tagList.includes(hy) : true
- // 注册号精确匹配
- // const regNumMatch = registrationNumber ?
- // item.registrationNumber === registrationNumber : true;
- // // ID精确匹配
- // const idMatch = id !== undefined ? item.id === id : true;
+ const stMatch = st ? item.tagList.includes(st) : true
- return nameMatch && typeMatch && hyMatch && stMatch && wrMatch && userIdMatch;
+ const wrMatch = wr ? item.tagList.includes(wr) : true
+ const userIdMatch = userId ? item.userId == userId : true
+ return nameMatch && typeMatch && hyMatch && stMatch && wrMatch && userIdMatch;
+ }
});
}
}
@@ -496,7 +496,22 @@ const insertEnterprise = () => {
}
/** 重置按钮操作 */
const resetQuery = () => {
- queryFormRef.value.resetFields()
+ // queryFormRef.value.resetFields()
+
+ enterprise.value.queryParams = {
+ pageNo: 1,
+ pageSize: 10,
+ enterprisesName: undefined,
+ qy: undefined,
+ hy: undefined,
+ st: undefined,
+ wr: undefined,
+ userId: undefined
+ }
+
+ enterprise.value = cloneDeep(enterprise_copy.value);
+
+
handleQuery()
}
@@ -617,16 +632,26 @@ async function init() {
formData.value.tags = res.taskTagIdes.map((t) => t.tagId)
enterprise.value.list = res.enterpriseIdes
enterprise.value.total = res.enterpriseIdes.length
+
+ //深拷贝一份
+ enterprise_copy.value = cloneDeep(enterprise.value);
+
}
}
const selectChild = (value: any) => {
const data = taskTagTopList.value.find(item=>item.id == value)
+ isReadonly.value = false
tagChildList.value = data.children
}
function getList(data) {
- enterprise.value.list.push(...data)
+
+const diff = data.filter(item => !enterprise.value.list.includes(item));
+
+// 2. 插入到旧数组前面(合并)
+enterprise.value.list = [...diff, ...enterprise.value.list];
+
//去重
enterprise.value.list = uniqueFunc(enterprise.value.list, 'id')
enterprise.value.total = enterprise.value.list.length
diff --git a/src/views/task/createEnterprise2.vue b/src/views/task/createEnterprise2.vue
index d1e5f5e..49c7cdf 100644
--- a/src/views/task/createEnterprise2.vue
+++ b/src/views/task/createEnterprise2.vue
@@ -35,7 +35,7 @@
-
+
-
+
-
+
-
+
- 确认选择
- 关闭窗口
+ 确认选择
+ 关闭窗口
@@ -241,6 +242,7 @@ const selectAll = (selection) => {
//确认选择
const confirmSelect = () => {
+ visible.value = false
emit('success', selectedEnterprises.value)
}
@@ -289,10 +291,12 @@ const handleQuery = () => {
enterprise.value.queryParams.pageNo = 1
getEnterPriseList()
}
+
+const queryFormRef = ref()
/** 重置按钮操作 */
const resetQuery = () => {
- // queryFormRef.value.resetFields()
- // handleQuery()
+ queryFormRef.value.resetFields()
+ getEnterPriseList()
}
//行业
diff --git a/src/views/task/index.vue b/src/views/task/index.vue
index 6621305..3d8dc58 100644
--- a/src/views/task/index.vue
+++ b/src/views/task/index.vue
@@ -84,7 +84,7 @@