课程实操管理-建表
parent
753ab73b9c
commit
713c8751b0
@ -0,0 +1,27 @@
|
||||
package com.ibeetl.jlw.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibeetl.jlw.entity.*;
|
||||
import com.ibeetl.jlw.web.query.HandsOnQuery;
|
||||
|
||||
import org.beetl.sql.mapper.annotation.SqlResource;
|
||||
import org.beetl.sql.mapper.BaseMapper;
|
||||
import org.beetl.sql.core.engine.PageQuery;
|
||||
import org.beetl.sql.mapper.annotation.Update;
|
||||
|
||||
/**
|
||||
* HandsOn Dao
|
||||
*/
|
||||
@SqlResource("jlw.handsOn")
|
||||
public interface HandsOnDao extends BaseMapper<HandsOn>{
|
||||
PageQuery<HandsOn> queryByCondition(PageQuery query);
|
||||
PageQuery<HandsOn> queryByConditionQuery(PageQuery query);
|
||||
@Update
|
||||
void deleteHandsOnByIds(String ids);
|
||||
@Update
|
||||
int updateGivenByIds(HandsOnQuery handsOnQuery);
|
||||
List<HandsOn> getByIds(String ids);
|
||||
List<HandsOn> getValuesByQuery(HandsOnQuery handsOnQuery);
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
package com.ibeetl.jlw.entity;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.ibeetl.admin.core.entity.BaseEntity;
|
||||
import org.beetl.sql.annotation.entity.*;
|
||||
|
||||
import com.ibeetl.admin.core.util.ValidateConfig;
|
||||
|
||||
import com.ibeetl.admin.core.annotation.Dict;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* 课程实操
|
||||
* gen by Spring Boot2 Admin 2022-09-22
|
||||
*/
|
||||
public class HandsOn extends BaseEntity{
|
||||
|
||||
//实操主键
|
||||
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
|
||||
// @SeqID(name = ORACLE_CORE_SEQ_NAME)
|
||||
@AssignID(value = "maskAutoID",param = "com.ibeetl.jlw.entity.HandsOn")
|
||||
|
||||
private Long handsOnId ;
|
||||
|
||||
//归属课程
|
||||
|
||||
private Long courseInfoId ;
|
||||
|
||||
//归属章节
|
||||
|
||||
private String courseChildNode ;
|
||||
|
||||
//实操名称
|
||||
|
||||
private String handsOnName ;
|
||||
|
||||
//实操介绍
|
||||
|
||||
private String handsOnRecommend ;
|
||||
|
||||
public HandsOn(){
|
||||
}
|
||||
|
||||
/**实操主键
|
||||
*@return
|
||||
*/
|
||||
public Long getHandsOnId(){
|
||||
return handsOnId;
|
||||
}
|
||||
/**实操主键
|
||||
*@param handsOnId
|
||||
*/
|
||||
public void setHandsOnId(Long handsOnId){
|
||||
this.handsOnId = handsOnId;
|
||||
}
|
||||
|
||||
/**归属课程
|
||||
*@return
|
||||
*/
|
||||
public Long getCourseInfoId(){
|
||||
return courseInfoId;
|
||||
}
|
||||
/**归属课程
|
||||
*@param courseInfoId
|
||||
*/
|
||||
public void setCourseInfoId(Long courseInfoId){
|
||||
this.courseInfoId = courseInfoId;
|
||||
}
|
||||
|
||||
/**归属章节
|
||||
*@return
|
||||
*/
|
||||
public String getCourseChildNode(){
|
||||
return courseChildNode;
|
||||
}
|
||||
/**归属章节
|
||||
*@param courseChildNode
|
||||
*/
|
||||
public void setCourseChildNode(String courseChildNode){
|
||||
this.courseChildNode = courseChildNode;
|
||||
}
|
||||
|
||||
/**实操名称
|
||||
*@return
|
||||
*/
|
||||
public String getHandsOnName(){
|
||||
return handsOnName;
|
||||
}
|
||||
/**实操名称
|
||||
*@param handsOnName
|
||||
*/
|
||||
public void setHandsOnName(String handsOnName){
|
||||
this.handsOnName = handsOnName;
|
||||
}
|
||||
|
||||
/**实操介绍
|
||||
*@return
|
||||
*/
|
||||
public String getHandsOnRecommend(){
|
||||
return handsOnRecommend;
|
||||
}
|
||||
/**实操介绍
|
||||
*@param handsOnRecommend
|
||||
*/
|
||||
public void setHandsOnRecommend(String handsOnRecommend){
|
||||
this.handsOnRecommend = handsOnRecommend;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
package com.ibeetl.jlw.service;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import cn.jlw.util.ToolUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ibeetl.admin.core.entity.CoreUser;
|
||||
import com.ibeetl.admin.core.util.TimeTool;
|
||||
import com.ibeetl.admin.core.web.JsonResult;
|
||||
import com.ibeetl.admin.core.web.JsonReturnCode;
|
||||
import com.ibeetl.jlw.dao.HandsOnDao;
|
||||
import com.ibeetl.jlw.entity.HandsOn;
|
||||
import com.ibeetl.jlw.web.query.HandsOnQuery;
|
||||
import com.ibeetl.jlw.entity.FileEntity;
|
||||
|
||||
import com.ibeetl.admin.core.service.CoreBaseService;
|
||||
import com.ibeetl.admin.core.util.PlatformException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.beetl.sql.core.engine.PageQuery;
|
||||
import org.beetl.sql.core.SqlId;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* HandsOn Service
|
||||
* 当分布式ID开启后请勿使用insert(*,true)
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class HandsOnService extends CoreBaseService<HandsOn>{
|
||||
|
||||
@Resource private HandsOnDao handsOnDao;
|
||||
|
||||
public PageQuery<HandsOn>queryByCondition(PageQuery query){
|
||||
PageQuery ret = handsOnDao.queryByCondition(query);
|
||||
queryListAfter(ret.getList());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public PageQuery<HandsOn>queryByConditionQuery(PageQuery query){
|
||||
PageQuery ret = handsOnDao.queryByConditionQuery(query);
|
||||
queryListAfter(ret.getList());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void deleteByList(List list){
|
||||
String ids = "";
|
||||
ToolUtils.deleteNullList(list);
|
||||
for(int i=0;null != list && i<list.size();i++){
|
||||
ids += list.get(i).toString()+(i==list.size()-1?"":",");
|
||||
}
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
handsOnDao.deleteHandsOnByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteHandsOn(String ids){
|
||||
try {
|
||||
handsOnDao.deleteHandsOnByIds(ids);
|
||||
} catch (Exception e) {
|
||||
throw new PlatformException("批量删除HandsOn失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
public String addAll(HandsOnQuery handsOnQuery){
|
||||
String msg = "";
|
||||
List<HandsOn> handsOnList = new ArrayList<>();
|
||||
try {
|
||||
handsOnList = JSON.parseArray(handsOnQuery.getHandsOnJsonStr(), HandsOn.class);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
handsOnList.add(JSONObject.parseObject(handsOnQuery.getHandsOnJsonStr(), HandsOn.class));
|
||||
} catch (Exception e1) {}
|
||||
}
|
||||
ToolUtils.deleteNullList(handsOnList);
|
||||
if(null != handsOnList && handsOnList.size()>0){
|
||||
for(int i=0;i<handsOnList.size();i++){
|
||||
HandsOn handsOn = handsOnList.get(i);
|
||||
}
|
||||
insertBatch(handsOnList);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public JsonResult add(HandsOnQuery handsOnQuery){
|
||||
String msg = "";
|
||||
HandsOn handsOn = handsOnQuery.pojo();
|
||||
handsOnDao.insert(handsOn);
|
||||
handsOnQuery.setHandsOnId(handsOn.getHandsOnId());
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setData(handsOn.getHandsOnId());//自增的ID丢进去
|
||||
jsonResult.setCode(JsonReturnCode.SUCCESS.getCode());
|
||||
jsonResult.setMsg(msg);
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
public String edit(HandsOnQuery handsOnQuery){
|
||||
String msg = "";
|
||||
HandsOn handsOn = handsOnQuery.pojo();
|
||||
handsOnDao.updateTemplateById(handsOn);
|
||||
return msg;
|
||||
}
|
||||
|
||||
public String updateGivenByIds(HandsOnQuery handsOnQuery){
|
||||
String msg = "";
|
||||
if(StringUtils.isNotBlank(handsOnQuery.get_given())){
|
||||
boolean flag = handsOnDao.updateGivenByIds(handsOnQuery) > 0;
|
||||
if(!flag){
|
||||
msg = "更新指定参数失败";
|
||||
}
|
||||
}else{
|
||||
msg = "指定参数为空";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public List<HandsOn> getValues (Object paras){
|
||||
return sqlManager.select(SqlId.of("jlw.handsOn.getHandsOnValues"), HandsOn.class, paras);
|
||||
}
|
||||
|
||||
public List<HandsOn> getValuesByQuery (HandsOnQuery handsOnQuery){
|
||||
return handsOnDao.getValuesByQuery(handsOnQuery);
|
||||
}
|
||||
|
||||
public HandsOn getInfo (Long handsOnId){
|
||||
HandsOnQuery handsOnQuery = new HandsOnQuery();
|
||||
handsOnQuery.setHandsOnId(handsOnId);
|
||||
List<HandsOn> list = handsOnDao.getValuesByQuery(handsOnQuery);
|
||||
if(null != list && list.size()>0){
|
||||
return list.get(0);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public HandsOn getInfo (HandsOnQuery handsOnQuery){
|
||||
List<HandsOn> list = handsOnDao.getValuesByQuery(handsOnQuery);
|
||||
if(null != list && list.size()>0){
|
||||
return list.get(0);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,217 @@
|
||||
package com.ibeetl.jlw.web;
|
||||
|
||||
import cn.jlw.Interceptor.RFile;
|
||||
import cn.jlw.Interceptor.SCoreUser;
|
||||
import cn.jlw.Interceptor.getFile;
|
||||
import cn.jlw.util.ToolUtils;
|
||||
import cn.jlw.validate.ValidateConfig;
|
||||
import com.ibeetl.admin.core.entity.CoreUser;
|
||||
import com.ibeetl.admin.core.file.FileService;
|
||||
import com.ibeetl.admin.core.util.ConvertUtil;
|
||||
import com.ibeetl.admin.core.util.PlatformException;
|
||||
import com.ibeetl.admin.core.util.TimeTool;
|
||||
import com.ibeetl.admin.core.web.JsonResult;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.beetl.sql.core.engine.PageQuery;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import com.ibeetl.admin.console.web.dto.DictExcelImportData;
|
||||
import com.ibeetl.admin.console.web.query.UserQuery;
|
||||
import com.ibeetl.admin.core.annotation.Function;
|
||||
import com.ibeetl.jlw.entity.*;
|
||||
import com.ibeetl.jlw.service.*;
|
||||
import com.ibeetl.jlw.web.query.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* HandsOn 课程实操 接口
|
||||
* 切记不要对非线程安全的静态变量进行写操作
|
||||
*/
|
||||
|
||||
@RestController
|
||||
public class HandsOnController{
|
||||
|
||||
private final Log log = LogFactory.getLog(this.getClass());
|
||||
private static final String MODEL = "/jlw/handsOn";
|
||||
private static final String API = "/api/handsOn";
|
||||
|
||||
|
||||
@Resource private HandsOnService handsOnService;
|
||||
|
||||
@Resource FileService fileService;
|
||||
|
||||
/* 前端接口 */
|
||||
|
||||
@PostMapping(API + "/getPageList.do")
|
||||
public JsonResult<PageQuery> getPageList(HandsOnQuery condition,@SCoreUser CoreUser coreUser){
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
PageQuery page = condition.getPageQuery();
|
||||
handsOnService.queryByConditionQuery(page);
|
||||
return JsonResult.success(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(API + "/getInfo.do")
|
||||
public JsonResult<HandsOn>getInfo(HandsOnQuery param,@SCoreUser CoreUser coreUser) {
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
HandsOn handsOn = handsOnService.getInfo(param);
|
||||
return JsonResult.success(handsOn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(API + "/getList.do")
|
||||
public JsonResult<List<HandsOn>>getList(HandsOnQuery param,@SCoreUser CoreUser coreUser) {
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
List<HandsOn>list = handsOnService.getValuesByQuery(param);
|
||||
return JsonResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 后台页面 */
|
||||
|
||||
@GetMapping(MODEL + "/index.do")
|
||||
@Function("handsOn.query")
|
||||
public ModelAndView index() {
|
||||
ModelAndView view = new ModelAndView("/jlw/handsOn/index.html") ;
|
||||
view.addObject("search", HandsOnQuery.class.getName());
|
||||
return view;
|
||||
}
|
||||
|
||||
@GetMapping(MODEL + "/edit.do")
|
||||
@Function("handsOn.edit")
|
||||
public ModelAndView edit(Long handsOnId) {
|
||||
ModelAndView view = new ModelAndView("/jlw/handsOn/edit.html");
|
||||
HandsOn handsOn = handsOnService.queryById(handsOnId);
|
||||
view.addObject("handsOn", handsOn);
|
||||
return view;
|
||||
}
|
||||
|
||||
@GetMapping(MODEL + "/add.do")
|
||||
@Function("handsOn.add")
|
||||
public ModelAndView add(Long handsOnId) {
|
||||
ModelAndView view = new ModelAndView("/jlw/handsOn/add.html");
|
||||
if(null != handsOnId){
|
||||
HandsOn handsOn = handsOnService.queryById(handsOnId);
|
||||
view.addObject("handsOn", handsOn);
|
||||
}else {
|
||||
view.addObject("handsOn", new HandsOn());
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
/* 后台接口 */
|
||||
|
||||
@PostMapping(MODEL + "/list.json")
|
||||
@Function("handsOn.query")
|
||||
public JsonResult<PageQuery> list(HandsOnQuery condition){
|
||||
PageQuery page = condition.getPageQuery();
|
||||
handsOnService.queryByCondition(page);
|
||||
return JsonResult.success(page);
|
||||
}
|
||||
|
||||
@PostMapping(MODEL + "/addAll.json")
|
||||
@Function("handsOn.add")
|
||||
public JsonResult addAll(HandsOnQuery handsOnQuery,@SCoreUser CoreUser coreUser){
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
String msg = handsOnService.addAll(handsOnQuery);
|
||||
if (StringUtils.isBlank(msg)) {
|
||||
return JsonResult.success();
|
||||
} else {
|
||||
return JsonResult.failMessage("新增失败,"+msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(MODEL + "/add.json")
|
||||
@Function("handsOn.add")
|
||||
public JsonResult add(@Validated(ValidateConfig.ADD.class) HandsOnQuery handsOnQuery, BindingResult result,@SCoreUser CoreUser coreUser){
|
||||
if(result.hasErrors()){
|
||||
return JsonResult.failMessage(result);
|
||||
}else{
|
||||
return handsOnService.add(handsOnQuery);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(MODEL + "/edit.json")
|
||||
@Function("handsOn.edit")
|
||||
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) HandsOnQuery handsOnQuery, BindingResult result) {
|
||||
if(result.hasErrors()){
|
||||
return JsonResult.failMessage(result);
|
||||
}else {
|
||||
String msg = handsOnService.edit(handsOnQuery);
|
||||
if (StringUtils.isBlank(msg)) {
|
||||
return JsonResult.success();
|
||||
} else {
|
||||
return JsonResult.failMessage("更新失败,"+msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(MODEL + "/view.json")
|
||||
@Function("handsOn.query")
|
||||
public JsonResult<HandsOn>queryInfo(Long handsOnId) {
|
||||
HandsOn handsOn = handsOnService.queryById( handsOnId);
|
||||
return JsonResult.success(handsOn);
|
||||
}
|
||||
|
||||
@GetMapping(MODEL + "/getValues.json")
|
||||
@Function("handsOn.query")
|
||||
public JsonResult<List<HandsOn>>getValues(HandsOnQuery param) {
|
||||
List<HandsOn>list = handsOnService.getValuesByQuery(param);
|
||||
return JsonResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(MODEL + "/delete.json")
|
||||
@Function("handsOn.delete")
|
||||
@ResponseBody
|
||||
public JsonResult delete(String ids) {
|
||||
handsOnService.deleteHandsOn(ids);
|
||||
return JsonResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
layui.define([ 'form', 'laydate', 'table','handsOnApi'], function(exports) {
|
||||
var form = layui.form;
|
||||
var handsOnApi = layui.handsOnApi;
|
||||
var index = layui.index;
|
||||
var view = {
|
||||
init:function(){
|
||||
Lib.initGenrealForm($("#addForm"),form);
|
||||
this.initSubmit();
|
||||
},
|
||||
initSubmit:function(){
|
||||
$("#addButton").click(function(){
|
||||
form.on('submit(form)', function(){
|
||||
var handsOnId = $("#addForm input[name='handsOnId']").val();
|
||||
if(!$.isEmpty(handsOnId)){
|
||||
handsOnApi.updateHandsOn($('#addForm'),function(){
|
||||
parent.window.dataReload();
|
||||
Common.info("更新成功");
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}else{
|
||||
handsOnApi.addHandsOn($('#addForm'),function(){
|
||||
parent.window.dataReload();
|
||||
Common.info("添加成功");
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$("#addButton-cancel").click(function(){
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
exports('add',view);
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
layui.define(['table', 'handsOnApi'], function(exports) {
|
||||
var handsOnApi = layui.handsOnApi;
|
||||
var table=layui.table;
|
||||
var view = {
|
||||
init:function(){
|
||||
},
|
||||
delBatch:function(){
|
||||
var data = Common.getMoreDataFromTable(table,"handsOnTable");
|
||||
if(data==null){
|
||||
return ;
|
||||
}
|
||||
Common.openConfirm("确认要删除这些HandsOn?",function(){
|
||||
var ids =Common.concatBatchId(data,"handsOnId");
|
||||
handsOnApi.del(ids,function(){
|
||||
Common.info("删除成功");
|
||||
dataReload();
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
exports('del',view);
|
||||
|
||||
});
|
@ -0,0 +1,28 @@
|
||||
layui.define([ 'form', 'laydate', 'table','handsOnApi'], function(exports) {
|
||||
var form = layui.form;
|
||||
var handsOnApi = layui.handsOnApi;
|
||||
var index = layui.index;
|
||||
var view = {
|
||||
init:function(){
|
||||
Lib.initGenrealForm($("#updateForm"),form);
|
||||
this.initSubmit();
|
||||
},
|
||||
initSubmit:function(){
|
||||
$("#updateButton").click(function(){
|
||||
form.on('submit(form)', function(){
|
||||
handsOnApi.updateHandsOn($('#updateForm'),function(){
|
||||
parent.window.dataReload();
|
||||
Common.info("更新成功");
|
||||
Lib.closeFrame();
|
||||
});
|
||||
});
|
||||
});
|
||||
$("#updateButton-cancel").click(function(){
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
exports('edit',view);
|
||||
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
/*访问后台的代码*/
|
||||
layui.define([], function(exports) {
|
||||
var api={
|
||||
updateHandsOn:function(form,callback){
|
||||
Lib.submitForm("/jlw/handsOn/edit.json",form,{},callback)
|
||||
},
|
||||
addHandsOn:function(form,callback){
|
||||
Lib.submitForm("/jlw/handsOn/add.json",form,{},callback)
|
||||
},
|
||||
del:function(ids,callback){
|
||||
Common.post("/jlw/handsOn/delete.json",{"ids":ids},function(){
|
||||
callback();
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
exports('handsOnApi',api);
|
||||
});
|
@ -0,0 +1,29 @@
|
||||
<!--#layout("/common/layout.html",{"jsBase":"/js/jlw/handsOn/"}){ -->
|
||||
<layui:searchForm formId="searchForm" searchList="" condition="${search}">
|
||||
</layui:searchForm>
|
||||
<table id="handsOnTable" lay-filter="handsOnTable"></table>
|
||||
<!--#} -->
|
||||
|
||||
<script type="text/html" id="toolbar_handsOn">
|
||||
<div class="layui-btn-container">
|
||||
<div class="layui-btn-group" >
|
||||
<!--# if(!isEmpty(search)) {-->
|
||||
<layui:accessButton function="handsOn.query" id="searchFormSearch" action="search"><i class="layui-icon"></i>搜索</layui:accessButton>
|
||||
<!--# }-->
|
||||
<layui:accessButton function="handsOn.add" action="add">添加</layui:accessButton>
|
||||
<layui:accessButton function="handsOn.edit" action="edit">修改</layui:accessButton>
|
||||
<layui:accessButton function="handsOn.del" action="del">删除</layui:accessButton>
|
||||
<!--# if(!isEmpty(search)) {-->
|
||||
<layui:accessButton function="handsOn.query" action="refresh"><i class="layui-icon"></i>刷新</layui:accessButton>
|
||||
<!--# }-->
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
|
||||
layui.use(['index'], function(){
|
||||
var index = layui.index;
|
||||
index.init();
|
||||
});
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue