fix: 🧩 修复bug
This commit is contained in:
@@ -188,6 +188,7 @@ const emits = defineEmits<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const handleRomoveTag = (item: any) => {
|
const handleRomoveTag = (item: any) => {
|
||||||
|
console.log(_searchResult.value, "=-_searchResult.value=");
|
||||||
emits("selectMultipleRemoveTag", { item, org_number: _searchResult.value.org_number });
|
emits("selectMultipleRemoveTag", { item, org_number: _searchResult.value.org_number });
|
||||||
};
|
};
|
||||||
const handleTagRemove1 = (item: any) => {
|
const handleTagRemove1 = (item: any) => {
|
||||||
@@ -205,8 +206,10 @@ const getCustomers = async (keywords: any, item: any) => {
|
|||||||
let options: any = [];
|
let options: any = [];
|
||||||
data.forEach((item: any) => {
|
data.forEach((item: any) => {
|
||||||
options.push({
|
options.push({
|
||||||
value: item.customer_number,
|
value: item.customer_number + "_" + item.use_org_number,
|
||||||
label: item.customer_name
|
label: item.customer_name + " " + `(${item.use_org_name})`,
|
||||||
|
id: item.use_org_number,
|
||||||
|
useOrgName: item.use_org_name
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
item.options = options;
|
item.options = options;
|
||||||
|
|||||||
@@ -228,8 +228,10 @@ const getCustomers = async (keywords: any, item: any) => {
|
|||||||
let options: any = [];
|
let options: any = [];
|
||||||
data.forEach((it: any) => {
|
data.forEach((it: any) => {
|
||||||
options.push({
|
options.push({
|
||||||
value: it.customer_number,
|
value: it.customer_number + "_" + it.use_org_number,
|
||||||
label: it.customer_name
|
label: it.customer_name + " " + `(${it.use_org_name})`,
|
||||||
|
id: it.use_org_number,
|
||||||
|
useOrgName: it.use_org_name
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
item.options = options;
|
item.options = options;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export const useTable = (
|
|||||||
};
|
};
|
||||||
//删除临时参数和空值参数
|
//删除临时参数和空值参数
|
||||||
const deleteParams = () => {
|
const deleteParams = () => {
|
||||||
const KEY = ["Time", "customer_number1"];
|
const KEY = ["Time", "customer_number1", "customer_numbers"];
|
||||||
for (let key in state.totalParam) {
|
for (let key in state.totalParam) {
|
||||||
if (KEY.includes(key) || !state.totalParam[key]) {
|
if (KEY.includes(key) || !state.totalParam[key]) {
|
||||||
delete state.totalParam[key];
|
delete state.totalParam[key];
|
||||||
|
|||||||
@@ -129,20 +129,36 @@ const getSubscribeDetails = async () => {
|
|||||||
setDetailsData(dataStore, data);
|
setDetailsData(dataStore, data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const filterBySecondArray = (firstArray: any, secondArray: any) => {
|
||||||
|
if (!firstArray || !secondArray) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!firstArray.length || !secondArray.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 创建一个Set用于快速查找
|
||||||
|
const filterSet = new Set(secondArray);
|
||||||
|
|
||||||
|
// 过滤出后缀在第二个数组中的元素(保留符合条件的)
|
||||||
|
return firstArray.filter((item: any) => {
|
||||||
|
// 分割字符串获取后缀部分
|
||||||
|
const suffix = item.split("_")[1];
|
||||||
|
// 检查后缀是否在过滤集合中,保留存在的元素
|
||||||
|
return filterSet.has(suffix);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
//本地多选远程搜索Tag删除回调(组织)
|
//本地多选远程搜索Tag删除回调(组织)
|
||||||
const handleSelectMultipleRemoveTag = async (params: any) => {
|
const handleSelectMultipleRemoveTag = async (params: any) => {
|
||||||
const { org_number } = params;
|
const { org_number } = params;
|
||||||
let customers: any = [];
|
|
||||||
// 筛选出 org_number 在 ids 中的数据
|
|
||||||
dataStore.formData[1].options = dataStore.formData[1].options.filter((item: any) => org_number.includes(item.org_number));
|
|
||||||
|
|
||||||
dataStore.formData[1].options.length &&
|
// 筛选出 org_number 数组包含的数据
|
||||||
dataStore.formData[1].options.forEach((item: any) => {
|
dataStore.formData[1].options = dataStore.formData[1].options.filter((item: any) => {
|
||||||
customers.push(item.value);
|
return org_number.includes(item.id);
|
||||||
});
|
});
|
||||||
console.log(customers, "=customers=");
|
|
||||||
dataStore.ruleForm.customer_number = customers;
|
dataStore.ruleForm.customer_number1 = filterBySecondArray(dataStore.ruleForm.customer_number1, org_number);
|
||||||
console.log(dataStore.ruleForm.customer_number, "=123==");
|
|
||||||
};
|
};
|
||||||
getSubscribeDetails();
|
getSubscribeDetails();
|
||||||
|
|
||||||
@@ -155,4 +171,25 @@ const handleButtonClickCallback = (item: any) => {
|
|||||||
handleCommit();
|
handleCommit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const getPrefixes = (arr: any) => {
|
||||||
|
// 遍历数组,返回每个元素下划线前面的部分
|
||||||
|
return arr.map((item: any) => {
|
||||||
|
// 分割字符串并返回下划线前面的部分(索引0)
|
||||||
|
return item.split("_")[0];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => dataStore.ruleForm.customer_number1,
|
||||||
|
(newVal: any) => {
|
||||||
|
if (Array.isArray(newVal) && newVal.length) {
|
||||||
|
dataStore.ruleForm.customer_number = getPrefixes(newVal);
|
||||||
|
} else {
|
||||||
|
dataStore.ruleForm.customer_number = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const FORM_DATA: any[] = [
|
|||||||
options: []
|
options: []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: "customer_number",
|
prop: "customer_number1",
|
||||||
placeholder: "请输入",
|
placeholder: "请输入",
|
||||||
type: "selectMultipleRemoteCustomersNames",
|
type: "selectMultipleRemoteCustomersNames",
|
||||||
label: "客户名称:",
|
label: "客户名称:",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const FORM_DATA: FormItem[] = [
|
|||||||
options: []
|
options: []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: "customer_number",
|
prop: "customer_numbers",
|
||||||
placeholder: "请输入客户名称",
|
placeholder: "请输入客户名称",
|
||||||
type: "selectMultipleRemote",
|
type: "selectMultipleRemote",
|
||||||
label: "客户名称: ",
|
label: "客户名称: ",
|
||||||
|
|||||||
@@ -110,21 +110,58 @@ const handleOpen = (row: any) => {
|
|||||||
query: { id: row.id, title: "编辑订阅" }
|
query: { id: row.id, title: "编辑订阅" }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const filterBySecondArray = (firstArray: any, secondArray: any) => {
|
||||||
|
if (!firstArray || !secondArray) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!firstArray.length || !secondArray.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 创建一个Set用于快速查找
|
||||||
|
const filterSet = new Set(secondArray);
|
||||||
|
|
||||||
|
// 过滤出后缀在第二个数组中的元素(保留符合条件的)
|
||||||
|
return firstArray.filter((item: any) => {
|
||||||
|
// 分割字符串获取后缀部分
|
||||||
|
const suffix = item.split("_")[1];
|
||||||
|
// 检查后缀是否在过滤集合中,保留存在的元素
|
||||||
|
return filterSet.has(suffix);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const getPrefixes = (arr: any) => {
|
||||||
|
// 遍历数组,返回每个元素下划线前面的部分
|
||||||
|
return arr.map((item: any) => {
|
||||||
|
// 分割字符串并返回下划线前面的部分(索引0)
|
||||||
|
return item.split("_")[0];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
//本地多选远程搜索Tag删除回调(组织)
|
//本地多选远程搜索Tag删除回调(组织)
|
||||||
const handleSelectMultipleRemoveTag = async (params: any) => {
|
const handleSelectMultipleRemoveTag = async (params: any) => {
|
||||||
const { org_number } = params;
|
const { org_number } = params;
|
||||||
let customers: any = [];
|
|
||||||
// 筛选出 org_number 在 ids 中的数据
|
// 筛选出 org_number 数组包含的数据
|
||||||
dataStore.formData[1].options = dataStore.formData[1].options.filter((item: any) => org_number.includes(item.org_number));
|
dataStore.formData[1].options = dataStore.formData[1].options.filter((item: any) => {
|
||||||
dataStore.formData[1].options.length &&
|
return org_number.includes(item.id);
|
||||||
dataStore.formData[1].options.forEach((item: any) => {
|
|
||||||
customers.push(item.value);
|
|
||||||
});
|
|
||||||
nextTick(() => {
|
|
||||||
dataStore.initParam.customer_number = customers;
|
|
||||||
});
|
});
|
||||||
|
let customer_numbers = filterBySecondArray(dataStore.initParam.customer_numbers, org_number);
|
||||||
|
dataStore.initParam.customer_numbers = customer_numbers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => dataStore.initParam.customer_numbers,
|
||||||
|
(newVal: any) => {
|
||||||
|
if (Array.isArray(newVal) && newVal.length) {
|
||||||
|
dataStore.initParam.customer_number = getPrefixes(newVal);
|
||||||
|
} else {
|
||||||
|
dataStore.initParam.customer_number = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scope lang="scss">
|
<style scope lang="scss">
|
||||||
|
|||||||
@@ -10,15 +10,19 @@ export const setDetailsData = (dataStore: any, data: any) => {
|
|||||||
if (data?.customers?.length) {
|
if (data?.customers?.length) {
|
||||||
data?.customers?.forEach((item: any) => {
|
data?.customers?.forEach((item: any) => {
|
||||||
//客户编码
|
//客户编码
|
||||||
dataStore.ruleForm.customers.push(item.customer_number);
|
dataStore.ruleForm.customers.push(item.customer_number + "_" + item.use_org_number);
|
||||||
//客户名称下拉框数据初始化
|
//客户名称下拉框数据初始化
|
||||||
customers_names.push({
|
customers_names.push({
|
||||||
value: item.customer_number,
|
value: item.customer_number + "_" + item.use_org_number,
|
||||||
label: item.customer_name,
|
label: item.customer_name + " " + `(${item.use_org_name})`,
|
||||||
org_number: "100"
|
id: item.use_org_number,
|
||||||
|
useOrgName: item.use_org_name
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
console.log(customers_names, "=customers_names=");
|
||||||
|
console.log(dataStore.ruleForm.customers, "=dataStore.ruleForm.customers=");
|
||||||
//客户名称值回填
|
//客户名称值回填
|
||||||
|
dataStore.ruleForm.customer_number1 = dataStore.ruleForm.customers;
|
||||||
dataStore.ruleForm.customer_number = dataStore.ruleForm.customers;
|
dataStore.ruleForm.customer_number = dataStore.ruleForm.customers;
|
||||||
//客户名称下拉框数据
|
//客户名称下拉框数据
|
||||||
dataStore.formData[1].options = customers_names;
|
dataStore.formData[1].options = customers_names;
|
||||||
|
|||||||
Reference in New Issue
Block a user