目录
- 前端
-
- 1.js如何获取当前时间(yy-MM-dd HH:MM:SS)
- 2.http请求
- 3.grid扩展js常用
- 后端
-
前端
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.$Message.error("删除成功");
} else {
this.$Message.error("失败" + reslut.message);
}
});
let Url = "api/表名/GetPageData";
this.http.post(Url, {}, true).then((result) => {
if (result.status == true) {
} else {
this.$Message.error("失败" + result.message);
}
});
3.grid扩展js常用
onInit() {
this.single = true;
this.maxBtnLength = 6;
this.editFormOptions.forEach(x => {
x.forEach(item => {
if (item.field == '选择的字段') {
item.extra = {
icon: "el-icon-zoom-out",
text: "选择数据",
style: "color:#2196F3;font-size: 12px;cursor: pointer;",
click: item => {
this.$refs.modelBody.openDemo("RD_PROJECT_ModelBody");
}
}
}
})
})
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.待补充