当前位置:网站首页>如何把树结构存储到数据库
如何把树结构存储到数据库
2022-06-11 16:34:00 【万众瞩目.】
一,我们的树结构都是一个一个的数组,我们要想插入数据库必须要切割
// 把树结构数据 插入数据库
SetTree(){
console.log(123123)
if (this.$refs.dept.getCheckedKeys().length>0){ //判断 >0 执行 --- 这个 dept 是你在这个 el-tree 定义的 ref
let arr = this.$refs.dept.getCheckedKeys(); //选中树结构 获取到数据
console.log(arr)
let Str = "";
for (let i = 0; i < arr.length; i++) {
Str += arr[i]+","; //把数据用逗号隔开 如:123,456,789,111,
console.log(Str)
}
Str = Str.substring(0,Str.length-1); //把最后的逗号切割掉 如:123,456,789,111
console.log(Str)
this.forContacts.dep_id = Str;
}
},
/**新增确定按钮*/
submitAdd() {
this.SetTree();
},边栏推荐
- 为什么芯片设计也需要「匠人精神」?
- 2022年R1快开门式压力容器操作考试题库及模拟考试
- MySQL quick start instance (no loss)
- If you want to learn ArrayList well, it is enough to read this article
- C starts an external EXE file and passes in parameters
- Regression prediction | realization of RBF RBF neural network with multiple inputs and single output by MATLAB
- unittest 如何知道每个测试用例的执行时间
- 学生网站模板棕色蛋糕甜品网站设计——棕色蛋糕甜品店(4页) 美食甜品网页制作期末大作业成品_生鲜水果网页设计期末作业
- Web page design example assignment -- Introduction to Henan cuisine (4 pages) web final assignment design web page_ Dessert and gourmet college students' web design homework finished product
- 信息收集常用工具及命令
猜你喜欢

Laravel listening mode

LeetCode——24. 两两交换链表中的节点(三指针)

Laravel 2020-01-01t00:00:00.000000z date conversion

2022安全员-C证特种作业证考试题库及答案

leetcode785. 判断二分图(中等)

为什么芯片设计也需要「匠人精神」?

Step 4 of installation in RF: an error is reported when installing the robotframework-selenium 2library

C语言各数据类型的内存映像

C# 启动一个外部exe文件,并传入参数

Interview high frequency algorithm question --- longest palindrome substring
随机推荐
从0到1了解Prometheus
2022 molten welding and thermal cutting work license and simulation examination
How to disable the notebook's own keyboard after the notebook is connected to an external keyboard
Go quick start of go language (I): the first go program
How can the project manager repel the fear of being dominated by work reports?
[learn FPGA programming from scratch -17]: quick start chapter - operation steps 2-5- VerilogHDL hardware description language symbol system and program framework (both software programmers and hardwa
Operation guide | how to select a collector on moonbeam and Moonriver
(湖南科技大学oj作业)问题 G: 串的模式匹配
Opencv相机标定之圆形标识点中心检测
Project workspace creation steps - Zezhong ar automated test tool
2022G1工业锅炉司炉考题及模拟考试
Leetcode 1974. 使用特殊打字机键入单词的最少时间(可以,一次过)
[ISITDTU 2019]EasyPHP
The micro service failed to connect to the cloud sentinel console and the link blank problem occurred after the connection was successful (resolved)
laravel 监听模式
solr(一)solr的安装及权限控制
多任务学习经典品读:MMoE模型篇
2022 R1 quick opening pressure vessel operation test question bank and simulation test
[sword finger offer] 21 Adjust array order so that odd numbers precede even numbers
Learn about Prometheus from 0 to 1