当前位置:网站首页>如何把树结构存储到数据库
如何把树结构存储到数据库
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();
},边栏推荐
- Class and__ proto__ Property, the class prototype chain has two inheritance routes
- 2022年危险化学品经营单位主要负责人考试模拟100题及模拟考试
- solr(一)solr的安装及权限控制
- Solve the problem that jupyter cannot connect to the kernel based on pycharm and Anaconda -- solution 1
- How the autorunner automated test tool creates a project -alltesting | Zezhong cloud test
- 问题 AC: 中国象棋中的跳马问题
- Customized thread communication (lock) of JUC
- RDKit教程
- 为什么芯片设计也需要「匠人精神」?
- 2022熔化焊接与热切割上岗证题目及模拟考试
猜你喜欢

时序预测 | MATLAB实现RBF径向基神经网络时间序列未来多步预测

2022 national question bank and mock examination for safety officer-b certificate

DHCP protocol instantiation analysis

2022安全员-A证考试题模拟考试题库模拟考试平台操作

Pytest test framework Basics

利用 MATLAB 和 DCRAW 处理数码相机 RAW 文件的完整流程

leetcode684. Redundant connection (medium)

Detailed explanation of the functions of list and dict data types

JDBC debugging error, ask for guidance

2022起重机司机(限桥式起重机)考试题模拟考试题库及模拟考试
随机推荐
[从零开始学习FPGA编程-17]:快速入门篇 - 操作步骤2-5- VerilogHDL硬件描述语言符号系统与程序框架(软件程序员和硬件工程师都能看懂)
Can I eat meat during weight loss? Will you get fat?
面试高频算法题---最长回文子串
pycharm和anaconda的基础上解决Jupyter连接不上Kernel(内核)的问题--解决方案1
【opencvsharp】opencvsharp_ samples. Core sample code Notes
(OJ assignment of Hunan University of science and Technology) problem g: pattern matching of strings
项目经理如何击退被工作汇报支配的恐惧感?
Text driven for creating and editing images (with source code)
Detailed explanation of the functions of list and dict data types
laravel 8 通过 任务调度 实现 数据库备份
2022安全员-A证考试题模拟考试题库模拟考试平台操作
Differences between list and set access elements
VLAN partition and routing between VLANs
什么是rs邮票纸?
Class and__ proto__ Property, the class prototype chain has two inheritance routes
笔记本连接外部键盘后,如何把笔记本自身的键盘禁用
Pytest test framework Basics
Go语言之Go 快速入门篇(一):第一个 Go 程序
Leetcode 1974. 使用特殊打字机键入单词的最少时间(可以,一次过)
Toolbar details of user interface - autorunner automated test tool