mvc新增,上架及下架
①展示書籍的下拉框
把數(shù)據展示到新增界面中
?
新增界面
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
? ? <title>書籍新增</title>
? ? <link rel="stylesheet" type="text/css"
? ? ? ? ? href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css">
? ? <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css">
? ? <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
? ? <script type="text/javascript"
? ? ? ? ? ? src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script>
? ? <script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body>
<div style="margin:20px 0;"></div>
<div class="easyui-panel" title="已下架書籍" style="width:100%;padding:30px 60px;">
? ? <form id="ff" action="${pageContext.request.contextPath}/book.action?methodName=add" method="post">
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="name" style="width:100%" data-options="label:'書名:',required:true">
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input id="cid" name="cid" value="" label="類別" >
? ? ? ? ? ? <%--<select class="easyui-combobox" name="cid" label="類別" style="width:100%">--%>
? ? ? ? ? ? ? ? <%--<option value="1">文藝</option>--%>
? ? ? ? ? ? ? ? <%--<option value="2">小說</option>--%>
? ? ? ? ? ? ? ? <%--<option value="3">青春</option>--%>
? ? ? ? ? ? <%--</select>--%>
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="author" style="width:100%" data-options="label:'作者:',required:true">
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="price" style="width:100%"
? ? ? ? ? ? ? ? ? ?data-options="label:'價格:',required:true">
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="publishing" style="width:100%"
? ? ? ? ? ? ? ? ? ?data-options="label:'出版社:',required:true">
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="description" style="width:100%;height:60px"
? ? ? ? ? ? ? ? ? ?data-options="label:'簡介:',required:true">
? ? ? ? </div>
? ? ? ? <%--默認未上架--%>
? ? ? ? <input type="hidden" name="state" value="1">
? ? ? ? <%--默認起始銷量為0--%>
? ? ? ? <input type="hidden" name="sales" value="0">
? ? </form>
? ? <div style="text-align:center;padding:5px 0">
? ? ? ? <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="submitForm()" style="width:80px">Submit</a>
? ? ? ? <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="clearForm()" style="width:80px">Clear</a>
? ? </div>
</div>
<script>
? ? $(function () {
? ? ?? ?$('#cid').combobox({ ? ?
? ? ?? ? ? ?url:'${pageContext.request.contextPath}/category.action?methodName=combobox', ? ?
? ? ?? ? ? ?valueField:'id', ? ?
? ? ?? ? ? ?textField:'name' ??
? ? ?? ?}); ?
? ? });
? ? function submitForm() {
? ? }
? ? function clearForm() {
? ? }
</script>
</body>
</html>
addBook.
CategoryDao
package com.hmf.dao;
import java.util.List;
import com.hmf.entity.Category;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;
public class CategoryDao extends BaseDao<Category> {
?? ?
?? ?public List<Category> list(Category category, PageBean pageBean) throws Exception {
?? ??? ?String sql = "select * from t_easyui_category";
?? ??? ?return super.executeQuery(sql, Category.class, pageBean);
?? ?}
}
?
CategoryAction
控制器
?$(function(){
?? ?$("#bookMenus").tree({
?? ??? ?url:$("#ctx").val()+"/permission.action?methodName=tree",
?? ??? ?onClick: function(node){
?? ??? ?var exists = $("#bookTabs").tabs('exists',node.text);
?? ??? ?if(exists){
?? ??? ??? ?$("#bookTabs").tabs('select',node.text);
?? ??? ??? ?}else{
?? ??? ??? ??? ?$('#bookTabs').tabs('add',{
?? ??? ??? ??? ??? ?title:node.text,
?? ??? ??? ??? ??? ?content:'<iframe width="100%" height="100%" src="'+$("#ctx").val()+node.attributes.self.url+'" />',
?? ??? ??? ??? ??? ?closable:true,
?? ??? ??? ??? ?});
?? ??? ??? ?}
?? ??? ?}
?? ?});
})
?x效果
?
②新增
book實體類
bookdao
package com.hmf.dao;
import java.util.Date;
import java.util.List;
import com.hmf.entity.Book;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;
import com.zking.util.StringUtils;
public class BookDao extends BaseDao<Book>{
?? ?public List<Book> list(Book book, PageBean pageBean) throws Exception {
?? ??? ?String sql = "select * from t_easyui_book where 1=1";
?? ??? ?String name = book.getName();
?? ??? ?if(StringUtils.isNotBlank(name)) {
?? ??? ??? ?sql += "and name like '%"+name+"%'";
?? ??? ?}
?? ??? ?return super.executeQuery(sql, Book.class, pageBean);
?? ?}
?? ?
?? ?public void edit(Book t) throws Exception {
?? ??? ?super.executeUpdate("update t_easyui_book set name=?,pinyin=?,cid=?,image=?,state=?,sales=? where id=?", t, new String[] {"name","pinyin","cid","image","state","sales","is"});
?? ?}
?? ?public void add(Book t) throws Exception {
????????//獲取拼音跟時間? 記得倒jar包和pinyinUtil
?? ??? ?t.setPinyin(com.zking.util.PinYinUtil.getAllPingYin(t.getName()));
?? ??? ?t.setDeployTime(new Date());
?? ??? ?super.executeUpdate("insert into t_easyui_book(name,pinyin,cid,author,price,image,publishing,description,state,deployTime,sales) values(?,?,?,?,?,?,?,?,?,?,?)", t, new String[] {"name","pinyin","cid","author","price","image","publishing","description","state","deployTime","sales"});
?? ?}
}
?
bookaction
package com.hmf.web;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hmf.dao.BookDao;
import com.hmf.entity.Book;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.PageBean;
import com.zking.util.R;
import com.zking.util.ResponseUtil;
public class BookAction extends ActionSupport implements ModelDriver<Book>{
?? ?
?? ?private Book book=new Book();
?? ?private BookDao bookDao=new BookDao();
?? ?
?? ?public Book getModel() {
?? ??? ?return book;
?? ?}
?? ?
?? ?public void list(HttpServletRequest req, HttpServletResponse resp) {
?? ??? ?PageBean pageBean=new PageBean();
?? ??? ?pageBean.setRequest(req);
?? ??? ?try {
?? ??? ??? ?List<Book> list = bookDao.list(book, pageBean);
?? ??? ??? ?ResponseUtil.writeJson(resp, new R().data("total", pageBean.getTotal()).data("rows", list));
?? ??? ?} catch (Exception e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ?}
?? ?}
?? ?
?? ?public void add(HttpServletRequest req, HttpServletResponse resp) {
?? ??? ?try {
?? ??? ??? ?bookDao.add(book);
?? ??? ??? ?ResponseUtil.writeJson(resp, 1);
?? ??? ?} catch (Exception e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ??? ?try {
?? ??? ??? ??? ?ResponseUtil.writeJson(resp, 0);
?? ??? ??? ?} catch (Exception e1) {
?? ??? ??? ??? ?e1.printStackTrace();
?? ??? ??? ?}
?? ??? ?}
?? ?}
?? ?
?? ?/**
?? ? * 如果上架書籍的狀態(tài)改為2
?? ? * 如果下架書籍的狀態(tài)改為3
?? ? * @param req
?? ? * @param resp
?? ? */
?? ?public void edit(HttpServletRequest req, HttpServletResponse resp) {
?? ??? ?try {
?? ??? ??? ?bookDao.edit(book);
?? ??? ??? ?ResponseUtil.writeJson(resp, 1);
?? ??? ?} catch (Exception e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ??? ?try {
?? ??? ??? ??? ?ResponseUtil.writeJson(resp, 0);
?? ??? ??? ?} catch (Exception e1) {
?? ??? ??? ??? ?e1.printStackTrace();
?? ??? ??? ?}
?? ??? ?}
?}
}
?
?addbook
?
數(shù)據庫添加成功?
結果
?③上架
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
添加這個的話數(shù)據時間就是你添加的時間
未上架書籍界面listBook01
?
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
? ? <title>未上架書籍</title>
? ? <link rel="stylesheet" type="text/css"
? ? ? ? ? href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css">
? ? <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css">
? ? <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
? ? <script type="text/javascript"
? ? ? ? ? ? src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script>
? ? <script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body>
<%--未上架書籍--%>
<table id="dg" style="style=" width:400px;height:200px;
"></table>
<div id="tb">
? ? <input class="easyui-textbox" id="name" name="name" style="width:20%;padding-left: 10px" data-options="label:'書名:',required:true">
? ? <a id="btn-search" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a>
</div>
<!-- 彈出框提交表單所用 -->
<div id="dd" class="easyui-dialog" title="編輯窗體" style="width:600px;height:450px;"
? ? ?data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,buttons:'#bb'">
? ? <form id="ff" action="${pageContext.request.contextPath}/book.action?methodName=edit" method="post">
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="name" style="width:100%" data-options="label:'書名:',required:true">
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input id="cid" name="cid" value="" label="類別" >
? ? ? ? ? ? <%--<select class="easyui-combobox" name="cid" label="類別" style="width:100%">--%>
? ? ? ? ? ? ? ? <%--<option value="1">文藝</option>--%>
? ? ? ? ? ? ? ? <%--<option value="2">小說</option>--%>
? ? ? ? ? ? ? ? <%--<option value="3">青春</option>--%>
? ? ? ? ? ? <%--</select>--%>
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="author" style="width:100%" data-options="label:'作者:',required:true">
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="price" style="width:100%"
? ? ? ? ? ? ? ? ? ?data-options="label:'價格:',required:true">
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="publishing" style="width:100%"
? ? ? ? ? ? ? ? ? ?data-options="label:'出版社:',required:true">
? ? ? ? </div>
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input class="easyui-textbox" name="description" style="width:100%;height:60px"
? ? ? ? ? ? ? ? ? ?data-options="label:'簡介:',required:true">
? ? ? ? </div>
? ? ? ? <%--默認未上架--%>
? ? ? ? <input type="hidden" name="state" value="">
? ? ? ? <%--默認起始銷量為0--%>
? ? ? ? <input type="hidden" name="sales" value="">
? ? ? ? <input type="hidden" name="id" value="">
? ? ? ? <input type="hidden" name="image" value="">
? ? </form>
? ? <div style="text-align:center;padding:5px 0">
? ? ? ? <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="submitForm()" style="width:80px">Submit</a>
? ? ? ? <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="clearForm()" style="width:80px">Clear</a>
? ? </div>
</div>
<!-- 圖片上傳 -->
<div id="dd2" class="easyui-dialog" title="書籍圖標上傳" style="width:600px;height:450px;"
? ? ?data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,buttons:'#bb'">
? ? <form id="ff2" action="" method="post" enctype="multipart/form-data">
? ? ? ? <div style="margin-bottom:20px">
? ? ? ? ? ? <input type="file" name="file">
? ? ? ? </div>
? ? </form>
? ? <div style="text-align:center;padding:5px 0">
? ? ? ? <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="submitForm2()" style="width:80px">Submit</a>
? ? ? ? <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="clearForm()" style="width:80px">Clear</a>
? ? </div>
</div>
</body>
<script>
? ? function shangjia() {
? ? ? ? $.messager.confirm('確認','您確認想要上架此書籍嗎?',function(r){
? ? ? ? ? ? if (r){
? ? ? ? ? ? ? ? var row = $('#dg').datagrid('getSelected');
? ? ? ? ? ? ? ? if (row){
? ? ? ? ? ? ? ? ? ? $.ajax({
? ? ? ? ? ? ? ? ? ? ? ? url:'${pageContext.request.contextPath}/book.action?methodName=editStatus&state=2&id=' + row.id,
? ? ? ? ? ? ? ? ? ? ? ? success:function (data) {
? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? })
? ? ? ? ? ? ? ? }?
? ? ? ? ? ? }
? ? ? ? });
? ? }
? ? //修改
? ? function edit() {
? ? ? ? $('#cid').combobox({
? ? ? ? ? ? url:'${pageContext.request.contextPath}/category.action?methodName=list',
? ? ? ? ? ? valueField:'id',
? ? ? ? ? ? textField:'name'
? ? ? ? });
? ? ? ? var row = $('#dg').datagrid('getSelected');
? ? ? ? if (row) {
? ? ? ? ? ? $('#ff').form('load', row);
? ? ? ? ? ? $('#dd').dialog('open');
? ? ? ? }
? ? }
? ? //提交編輯信息的表單
? ? function submitForm() {
? ? ? ? $('#ff').form('submit',{
? ? ? ? ? ? success: function (param) {
? ? ? ? ? ? ? ? $('#dd').dialog('close');
? ? ? ? ? ? ? ? $('#dg').datagrid('reload');
? ? ? ? ? ? ? ? $('#ff').form('clear');
? ? ? ? ? ? }
? ? ? ? });
? ? }
? ? function clearForm() {
? ? ? ? $('#ff').form('clear');
? ? }
? ? //圖片上傳
? ? function upload() {
? ? ? ? $('#dd2').dialog('open');
? ? }
? ? //圖片上傳表單提交
? ? function submitForm2() {
? ? ? ? var row = $('#dg').datagrid('getSelected');
? ? ? ? console.log(row);
? ? ? ? // if (row) {
? ? ? ? // ? ? $('#ff2').attr("action", $('#ff2').attr("action") + "&id=" + row.id);
? ? ? ? // }
? ? ? ? $('#ff2').form('submit', {
? ? ? ? ? ? url: '${pageContext.request.contextPath}/book.action?methodName=upload&id=' + row.id,
? ? ? ? ? ? success: function (param) {
? ? ? ? ? ? ? ? $('#dd2').dialog('close');
? ? ? ? ? ? ? ? $('#dg').datagrid('reload');
? ? ? ? ? ? ? ? $('#ff2').form('clear');
? ? ? ? ? ? }
? ? ? ? })
? ? }
? ? $(function () {
? ? ? ? $("#btn-search").click(function () {
? ? ? ? ? ? $('#dg').datagrid('load', {
? ? ? ? ? ? ? ? name: $("#name").val()
? ? ? ? ? ? });
? ? ? ? });
? ? ? ? $('#dg').datagrid({
? ? ? ? ? ? url: '${pageContext.request.contextPath}/book.action?methodName=list&&state=1',
? ? ? ? ? ? fit: true,
? ? ? ? ? ? fitColumns: true,
? ? ? ? ? ? pagination: true,
? ? ? ? ? ? singleSelect: true,
? ? ? ? ? ? toolbar:'#tb',
? ? ? ? ? ? columns: [[
? ? ? ? ? ? ? ? // {field:'id',title:'id',width:100},
? ? ? ? ? ? ? ? {field: 'id', title: '書籍名稱', hidden: true},
? ? ? ? ? ? ? ? {field: 'name', title: '書籍名稱', width: 50},
? ? ? ? ? ? ? ? {field: 'pinyin', title: '拼音', width: 50},
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? field: 'cid', title: '書籍類別', width: 50, formatter: function (value, row, index) {
? ? ? ? ? ? ? ? ? ? ? ? if (row.cid == 1) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? return "文藝";
? ? ? ? ? ? ? ? ? ? ? ? } else if (row.cid == 2) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? return "小說";
? ? ? ? ? ? ? ? ? ? ? ? } else if (row.cid == 3) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? return "青春";
? ? ? ? ? ? ? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? return value;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? {field: 'author', title: '作者', width: 50},
? ? ? ? ? ? ? ? // {field:'price',title:'價格',width:100},
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? field: 'image', title: '圖片路徑', width: 100, formatter: function (value, row, index) {
? ? ? ? ? ? ? ? ? ? ? ? return '<img style="width:80px;height: 60px;" src="' + row.image + '"></img>';
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? {field: 'publishing', title: '出版社', width: 50},
? ? ? ? ? ? ? ? // {field:'desc',title:'描述',width:100},
? ? ? ? ? ? ? ? // {field:'state',title:'書籍狀態(tài)',width:100},
? ? ? ? ? ? ? ? {field: 'sales', title: '銷量', width: 50},
? ? ? ? ? ? ? ? {field: 'deployTime', title: '上架時間', width: 50, align: 'right'},
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? field: 'xxxx', title: '操作', width: 100, formatter: function (value, row, index) {
? ? ? ? ? ? ? ? ? ? ? ? return '<a href="#" οnclick="upload()">圖片上傳</a> ' +
? ? ? ? ? ? ? ? ? ? ? ? ? ? '<a href="#" οnclick="shangjia()">上架</a> ' +
? ? ? ? ? ? ? ? ? ? ? ? ? ? '<a href="#" οnclick="edit();">修改</a>';
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ]]
? ? ? ? });
? ? })
</script>
</html>
?
bookdao
?
?bookaction
?結果
?上架成功
?
④下架
listBook02
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
? ? <title>已上架書籍</title>
? ? <link rel="stylesheet" type="text/css"
? ? ? ? ? href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css">
? ? <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css">
? ? <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
? ? <script type="text/javascript"
? ? ? ? ? ? src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script>
? ? <script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body>
<table id="dg" style="style=" width:400px;height:200px;
"></table>
<script>
? ? function xiajia() {
? ? ? ? $.messager.confirm('確認','您確認想要下架此書籍嗎?',function(r){
? ? ? ? ? ? if (r){
? ? ? ? ? ? ? ? var row = $('#dg').datagrid('getSelected');
? ? ? ? ? ? ? ? if (row){
? ? ? ? ? ? ? ? ? ? $.ajax({
? ? ? ? ? ? ? ? ? ? ? ? url:'${pageContext.request.contextPath}/book.action?methodName=editStatus&state=3&id=' + row.id,
? ? ? ? ? ? ? ? ? ? ? ? success:function (data) {
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? })
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? });
? ? }
? ? $(function () {
? ? ? ? $('#dg').datagrid({
? ? ? ? ? ? url: '${pageContext.request.contextPath}/book.action?methodName=list&&state=2',
? ? ? ? ? ? fit: true,
? ? ? ? ? ? fitColumns: true,
? ? ? ? ? ? pagination: true,
? ? ? ? ? ? singleSelect: true,
? ? ? ? ? ? columns: [[
? ? ? ? ? ? ? ? // {field:'id',title:'id',width:100},
? ? ? ? ? ? ? ? {field: 'id', title: '書籍名稱', hidden: true},
? ? ? ? ? ? ? ? {field: 'name', title: '書籍名稱', width: 50},
? ? ? ? ? ? ? ? {field: 'pinyin', title: '拼音', width: 50},
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? field: 'cid', title: '書籍類別', width: 50, formatter: function (value, row, index) {
? ? ? ? ? ? ? ? ? ? ? ? if (row.cid == 1) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? return "文藝";
? ? ? ? ? ? ? ? ? ? ? ? } else if (row.cid == 2) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? return "小說";
? ? ? ? ? ? ? ? ? ? ? ? } else if (row.cid == 3) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? return "青春";
? ? ? ? ? ? ? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? return value;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? {field: 'author', title: '作者', width: 50},
? ? ? ? ? ? ? ? // {field:'price',title:'價格',width:100},
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? field: 'image', title: '圖片路徑', width: 100, formatter: function (value, row, index) {
? ? ? ? ? ? ? ? ? ? ? ? return '<img style="width:80px;height: 60px;" src="' + row.image + '"></img>';
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? {field: 'publishing', title: '出版社', width: 50},
? ? ? ? ? ? ? ? // {field:'desc',title:'描述',width:100},
? ? ? ? ? ? ? ? // {field:'state',title:'書籍狀態(tài)',width:100},
? ? ? ? ? ? ? ? {field: 'sales', title: '銷量', width: 50},
? ? ? ? ? ? ? ? {field: 'deployTime', title: '上架時間', width: 50, align: 'right'},
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? field: 'xxxx', title: '操作', width: 100, formatter: function (value, row, index) {
? ? ? ? ? ? ? ? ? ? ? ? return ?'<a href="#" οnclick="xiajia();">下架</a>';
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ]]
? ? ? ? });
? ? })
</script>
</body>
</html>
運行結果
?下架成功
今天到這里了拜拜
總結
以上是生活随笔為你收集整理的mvc新增,上架及下架的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C# 将OFD转为PDF
- 下一篇: html怎么创建一个盒子,怎么新建一个实