|
@@ -136,6 +136,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</el-drawer> -->
|
|
</el-drawer> -->
|
|
|
<CompanyDrawer
|
|
<CompanyDrawer
|
|
|
|
|
+ ref="companyDrawerChild"
|
|
|
:table-com="tableCom"
|
|
:table-com="tableCom"
|
|
|
:companyAddTitle="companyAddTitle"
|
|
:companyAddTitle="companyAddTitle"
|
|
|
:comEdit="comEdit"
|
|
:comEdit="comEdit"
|
|
@@ -326,38 +327,6 @@
|
|
|
templateWorkshop: undefined,
|
|
templateWorkshop: undefined,
|
|
|
principal: '',
|
|
principal: '',
|
|
|
});
|
|
});
|
|
|
- // const rules = reactive<FormRules<RuleForm>>({
|
|
|
|
|
- // name: [
|
|
|
|
|
- // { required: true, message: '', trigger: 'blur' },
|
|
|
|
|
- // { min: 1, max: 100, message: 'Length should be 3 to 5', trigger: 'blur' },
|
|
|
|
|
- // ],
|
|
|
|
|
- // seniorScene: [
|
|
|
|
|
- // { required: true, message: '', trigger: 'blur' },
|
|
|
|
|
- // { min: 1, max: 100, message: 'Length should be 1 to 100', trigger: 'blur' },
|
|
|
|
|
- // ],
|
|
|
|
|
- // code: [
|
|
|
|
|
- // { required: true, message: '', trigger: 'blur' },
|
|
|
|
|
- // { min: 1, max: 100, message: 'Length should be 1 to 100', trigger: 'blur' },
|
|
|
|
|
- // ],
|
|
|
|
|
- // sceneCode: [
|
|
|
|
|
- // { required: true, message: '', trigger: 'blur' },
|
|
|
|
|
- // { min: 1, max: 100, message: 'Length should be 1 to 100', trigger: 'blur' },
|
|
|
|
|
- // ],
|
|
|
|
|
- // tagCom: [{ required: true, message: '', trigger: 'blur' }],
|
|
|
|
|
- // templateCom: [{ required: true, message: '', trigger: 'blur' }],
|
|
|
|
|
- // tagWorkshop: [
|
|
|
|
|
- // { required: true, message: '', trigger: 'blur' },
|
|
|
|
|
- // { min: 1, max: 100, message: 'Length should be 1 to 100', trigger: 'blur' },
|
|
|
|
|
- // ],
|
|
|
|
|
- // templateWorkshop: [
|
|
|
|
|
- // { required: true, message: '', trigger: 'blur' },
|
|
|
|
|
- // { min: 1, max: 100, message: 'Length should be 1 to 100', trigger: 'blur' },
|
|
|
|
|
- // ],
|
|
|
|
|
- // principal: [
|
|
|
|
|
- // { required: true, message: '', trigger: 'blur' },
|
|
|
|
|
- // { min: 1, max: 100, message: 'Length should be 1 to 100', trigger: 'blur' },
|
|
|
|
|
- // ],
|
|
|
|
|
- // });
|
|
|
|
|
|
|
|
|
|
//添加组件的添加功能
|
|
//添加组件的添加功能
|
|
|
const table = ref(false); //添加公司级的场景
|
|
const table = ref(false); //添加公司级的场景
|
|
@@ -384,54 +353,11 @@
|
|
|
const level = ref<number>();
|
|
const level = ref<number>();
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
|
|
+ console.log('Company Drawer Child Ref:', companyDrawerChild.value);
|
|
|
//添加父级,主要用于排序功能
|
|
//添加父级,主要用于排序功能
|
|
|
dataSourceWithParent(tableData.value, null);
|
|
dataSourceWithParent(tableData.value, null);
|
|
|
//获取tableData数据
|
|
//获取tableData数据
|
|
|
getSceneDetail();
|
|
getSceneDetail();
|
|
|
-
|
|
|
|
|
- // // 示例数据
|
|
|
|
|
- const data = [
|
|
|
|
|
- {
|
|
|
|
|
- id: 1,
|
|
|
|
|
- tag: 'hailou',
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- id: 1,
|
|
|
|
|
- tag: 'anlai',
|
|
|
|
|
- children: [
|
|
|
|
|
- { id: 1, tag: '33233', children: [] },
|
|
|
|
|
- { id: 2, tag: 'anlai110', children: [] },
|
|
|
|
|
- { id: 3, tag: 'anlai122', children: [] },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- { id: 2, tag: 'hailou110', children: [] },
|
|
|
|
|
- { id: 3, tag: 'hailou001', children: [] },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 2,
|
|
|
|
|
- tag: 'nihao',
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- id: 1,
|
|
|
|
|
- tag: 'anlai',
|
|
|
|
|
- children: [
|
|
|
|
|
- { id: 1, tag: 'vaigou', children: [] },
|
|
|
|
|
- { id: 2, tag: 'kegou', children: [] },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- { id: 2, tag: 'kengzi', children: [] },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- ];
|
|
|
|
|
-
|
|
|
|
|
- // 查找 { id: 1, tag: 'vaigou', children: [] } 的索引
|
|
|
|
|
- const result1 = findIndexByItem(data, { id: 1, tag: '33233', children: [] });
|
|
|
|
|
- console.log('Result 1:', result1); // 输出 [1, 0, 0]
|
|
|
|
|
-
|
|
|
|
|
- // 查找 { id: 2, tag: 'kengzi', children: [] } 的索引
|
|
|
|
|
- const result2 = findIndexByItem(data, { id: 2, tag: 'anlai110', children: [] });
|
|
|
|
|
- console.log('Result 2:', result2); // 输出 [1, 1, -1]
|
|
|
|
|
});
|
|
});
|
|
|
watch(
|
|
watch(
|
|
|
() => tableData.value,
|
|
() => tableData.value,
|
|
@@ -448,12 +374,19 @@
|
|
|
const handlePageNumChange = () => {};
|
|
const handlePageNumChange = () => {};
|
|
|
const handlePageSizeChange = () => {};
|
|
const handlePageSizeChange = () => {};
|
|
|
|
|
|
|
|
|
|
+ const companyDrawerChild = ref();
|
|
|
|
|
+
|
|
|
const companyAdd = () => {
|
|
const companyAdd = () => {
|
|
|
tableCom.value = true;
|
|
tableCom.value = true;
|
|
|
// emit;
|
|
// emit;
|
|
|
|
|
|
|
|
- resetDraw();
|
|
|
|
|
- console.log('ruleForm', ruleForm);
|
|
|
|
|
|
|
+ // const childComponent = refs.companyDrawerChild;
|
|
|
|
|
+ if (companyDrawerChild.value) {
|
|
|
|
|
+ companyDrawerChild.value.resetDrawCom(); // 这里假设resetDraw是子组件中用于重置的方法
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // resetDraw();
|
|
|
|
|
+ // console.log('ruleForm', ruleForm);
|
|
|
|
|
|
|
|
addEnable.value = ENABLED.TRUE;
|
|
addEnable.value = ENABLED.TRUE;
|
|
|
ruleForm.seniorScene = '顶级场景';
|
|
ruleForm.seniorScene = '顶级场景';
|
|
@@ -491,11 +424,6 @@
|
|
|
|
|
|
|
|
//添加公司场景的提交按钮
|
|
//添加公司场景的提交按钮
|
|
|
const addNewTypeCom = (ruleFormCom, selectItemsCom, addEnableCom) => {
|
|
const addNewTypeCom = (ruleFormCom, selectItemsCom, addEnableCom) => {
|
|
|
- //选出不为空字符串的数据
|
|
|
|
|
- selectItemsCom.value = selectItemsCom.value.filter((item) => {
|
|
|
|
|
- return item.tag && item.template;
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
//取出数据中所有的code数据
|
|
//取出数据中所有的code数据
|
|
|
const allCodes = flattenCodes(tableData.value);
|
|
const allCodes = flattenCodes(tableData.value);
|
|
|
|
|
|
|
@@ -517,17 +445,20 @@
|
|
|
type: 'error',
|
|
type: 'error',
|
|
|
})
|
|
})
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- ruleFormCom.code = '';
|
|
|
|
|
|
|
+ // ruleFormCom.code = '';
|
|
|
|
|
+ console.log('场景代码重复,请重新填写');
|
|
|
})
|
|
})
|
|
|
.catch(() => {
|
|
.catch(() => {
|
|
|
console.log('取消删除物件');
|
|
console.log('取消删除物件');
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- // tableData.value.push(newComData);
|
|
|
|
|
-
|
|
|
|
|
//提交数据并重置关闭el-draw
|
|
//提交数据并重置关闭el-draw
|
|
|
addCompany(newComData)
|
|
addCompany(newComData)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
|
|
+ //选出不为空字符串的数据
|
|
|
|
|
+ selectItemsCom.value = selectItemsCom.value.filter((item) => {
|
|
|
|
|
+ return item.tag && item.template;
|
|
|
|
|
+ });
|
|
|
//将selectItems加工成保存公司-模板的数据类型
|
|
//将selectItems加工成保存公司-模板的数据类型
|
|
|
const newModuleLabel = selectItemsCom.value.map((item) => {
|
|
const newModuleLabel = selectItemsCom.value.map((item) => {
|
|
|
return {
|
|
return {
|
|
@@ -593,7 +524,8 @@
|
|
|
type: 'error',
|
|
type: 'error',
|
|
|
})
|
|
})
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- ruleForm.sceneCode = '';
|
|
|
|
|
|
|
+ // ruleForm.sceneCode = '';
|
|
|
|
|
+ console.log('场景代码重复,请重新填写');
|
|
|
})
|
|
})
|
|
|
.catch(() => {
|
|
.catch(() => {
|
|
|
console.log('取消删除物件');
|
|
console.log('取消删除物件');
|