data中的对象恢复初始值:
Object.assign(this.sourceForm, this.$options.data().sourceForm)
表单重置:
this.$refs.sourceForm.resetFields();
请求参数(data,params):
data中的参数直接放到请求体中;params参数自动拼接到路径中,注意数组要转化为字符串类型
字符串替换
将所有的“/”替换成“-”
this.selectTime.startTime = date[0].replace(/\//g,'-')
ivew中table多选时单击某一行就选中
table中的选中某一行的方法:@on-row-click,点击某一行就选中 this.$refs.table.toggleSelect(index)
前端下载模板
使用正则表达式删除空行
this.programsetNames = this.form.textarea.replace(/(^\s*)|(\s*$)/g, '');
使用正则表达式将换行符替换为|
this.programsetNames = this.form.textarea.replace(/\n/g, '|');
数组去重
Array.from(new Set(arr));
导出sql语句(insert)找出最大id并且+1
(select newId from (select max(id) as newId from sys_menu) t) +1
eg:
INSERT INTO `sys_menu` (`id`, `name`, `parent_id`, `button_type`, `level`, `title`, `type`, `icon`, `sort_order`, `status`, `component`, `path`, `description`, `request_path`, `is_need_inventory_domain`, `is_need_distribution_domain`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ((select newId from (select max(id) as newId from sys_menu) t) +1, 'downloadManage', 371, '', 3, '下载任务', 0, '/', 5.00, 0, 'my/download-manage/index', '/download-manage', NULL, '/download-manage', 0, 0, 'admin', '2023-02-17 14:16:08', NULL, NULL);