目录
- 前端
- 1.记录 js如何获取当前时间(YY-MM-DD hh:mm:ss)
- 2.记录 http请求
- 3.记录(常用)
- 后端
- 1.记录
前端
1.记录 js如何获取当前时间(YY-MM-DD hh:mm:ss)
getCurrentTime() {const now = new Date();return `${now.getFullYear()}-${(now.getMonth() + 1).toString().padStart(2, "0")}-${now.getDate().toString().padStart(2, "0")} ${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}`;},
2.记录 http请求
// 添加请求
submit() {let data = {delKeys: null,detailData: null,mainData: this.fields,};let Url = "api/表名/Add";this.http.post(Url, data, true).then((result) => {if (result.status == true) {this.$Message.success("提交成功");this.reset();this.$emit("call-parent-method");} else {this.$Message.success("失败" + reslut.message);}});},
//删除请求let url = "api/表名/del";this.http.post(url, [rows[0].PRODUCT_DETAIL_LIST_ID], false).then((reslut) => {if (reslut.status === true) {//删除行//this.$refs.table1.delRow();this.$Message.error("删除成功");} else {this.$Message.error("失败" + reslut.message);}});
//获取请求let Url = "api/表名/GetPageData";this.http.post(Url, {}, true).then((result) => {if (result.status == true) {// this.$Message.success("成功");} else {this.$Message.error("失败" + result.message);}});
3.记录(常用)
// 1.grid的table单选
onInit() {this.single = true;
}
// 2.选择数据
this.editFormOptions.forEach(x => {x.forEach(item => {if (item.field == '选择的字段') {//给编辑表单设置[选择数据]操作,extra具体配置见volform组件apiitem.extra = {icon: "el-icon-zoom-out",text: "选择数据",style: "color:#2196F3;font-size: 12px;cursor: pointer;",click: item => {this.$refs.modelBody.openDemo("RD_PROJECT_ModelBody");}}}})})
// 3.grid添加按钮this.buttons.splice(2, 0, ...[{name: "查 看",icon: 'md-add',type: 'success',onClick: function () {let row = this.getSelectRows()if (row.length > 0) {this.$store.getters.data().hahaha = { obj: row[0].DEVELOPMENT_PROJECT_NO };$this.$refs.gridHeader.open2()}else {this.$Message.error('请选择一条数据');return}}}])
后端
1.记录
待补充