针对企业中客户的质询需求所建立的信息录入功能,方便销售人员进行后续的客户需求 跟踪与联系,提高企业客户购买产品的几率。
对于系统录入每条营销机会记录,系统会分配对应的销售人员与对应的客户进行详细了 解,从而提高客户开发计划的成功几率。对应到营销机会管理模块功能上即:营销机会数据 的录入,分配,修改,删除与查询。
修改包名,生成的文件位于 saleChance 包下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfigurationPUBLIC "-//mybatis//DTD MyBatis Generator Configuration 1.0//EN"".dtd"><!-- 配置生成器 -->
<generatorConfiguration><context id="MysqlTables" targetRuntime="MyBatis3"><!-- 生成的Java文件的编码 --><property name="javaFileEncoding" value="UTF-8"/><!-- 增加Models ToStirng方法 --><plugin type=ator.plugins.ToStringPlugin"/><!-- 增加Models Serializable实现 --><plugin type=ator.plugins.SerializablePlugin"/><!-- 分页插件 --><!-- 在example类中增 page 属性,并在l的查询中加入page !=null 时的查询 --><!-- <plugin type=ator.plugins.MySQLPagerPlugin" /> --><!-- 在example类中增 offset和limit属性,并在l的查询中加入limit ${offset} , ${limit} 提供在offset和limit>0时的查询 --><!-- <plugin type=ator.plugins.MySQLPaginationPlugin"></plugin> --><!-- 是否去除自动生成的注释 true:是 : false:否 --><commentGenerator><property name="suppressAllComments" value="true"/></commentGenerator><!-- mysql数据库连接配置 --><!--JAVA数据类型和MYSQL的数据类型转换,要注意TINYINT类型,且存储长度为1的情况。TINYINT(1)只用来代表Boolean含义的字段,且0代表false,1代表true。想给1,给true即可会转换为1,但想给2怎么办?如果想要存储多个数值,则定义为TINYINT(N),N>1。例如TINYINT(2)解决办法一:修改字段 ALTER TABLE 表名 MODIFY LEVEL TINYINT(2) COMMENT '等级';(需要多次修改)解决办法二:在连接mysql的url后添加tinyInt1isBit=false,该属性默认为true(修改一次即可)--><jdbcConnection driverClass=sql.jdbc.Driver"connectionURL="jdbc:mysql://localhost:3306/db_crm?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false"userId="root" password="root"></jdbcConnection><!--是否忽略BigDecimals 非必填项自动生成Java对象的时候,会根据number类型的长度不同生成不同的数据类型number长度 Java类型1~4 Short5~9 Integer10~18 Long18+ BigDecimal--><javaTypeResolver><property name="forceBigDecimals" value="false"/></javaTypeResolver><!-- 以下内容,需要改动 --><!-- java类生成的位置 --><javaModelGenerator targetPackage="sales.pojo" targetProject="src/main/java"><!-- 在targetPackage的基础上,根据数据库的schema再生成一层package,最终生成的类放在这个package下,默认为false --><property name="enableSubPackages" value="true"/><!-- 从数据库返回的值去除前后空格 --><property name="trimStrings" value="true"/></javaModelGenerator><!-- *l配置文件生成的位置 --><sqlMapGenerator targetPackage="sales.mapper" targetProject="src/main/java"><!-- 是否让schema作为包后缀 --><property name="enableSubPackages" value="true"/></sqlMapGenerator><!-- java mapper接口生成的位置(interface) --><javaClientGenerator type="XMLMAPPER" targetPackage="sales.dao" targetProject="src/main/java"><!-- 是否让schema作为包后缀 --><property name="enableSubPackages" value="true"/></javaClientGenerator><!--指定数据库表tableName数据库表名domainObjectName生成的实体类名是否需要mapper配置文件加入sql的where条件查询,需要将enableCountByExample等设为true,会生成一个对应domainObjectName的Example类--><table tableName="t_sale_chance" domainObjectName="SaleChance"enableCountByExample="false" enableDeleteByExample="false"enableSelectByExample="false" enableUpdateByExample="false"><!-- 用于insert时,返回主键的编号 --><generatedKey column="id" sqlStatement="MySql" identity="true"/></table></context>
</generatorConfiguration>
package base;import org.springframework.dao.DataAccessException;import java.util.List;
import java.util.Map;/*** 公共持久层** @param <T>*/
public interface BaseDao<T> {/*** 添加记录** @param entity* @return* @throws DataAccessException*/Integer save(T entity) throws DataAccessException;/*** 批量添加记录** @param entities* @return* @throws DataAccessException*/Integer saveBatch(List<T> entities) throws DataAccessException;/*** 查询单条记录** @param id* @return* @throws DataAccessException*/T selectById(Integer id) throws DataAccessException;/*** 多条件查询** @param baseQuery* @return* @throws DataAccessException*/List<T> selectByParams(BaseQuery baseQuery) throws DataAccessException;/*** 更新单条记录** @param entity* @return* @throws DataAccessException*/Integer update(T entity) throws DataAccessException;/*** 批量更新记录** @param map* @return* @throws DataAccessException*/Integer updateBatch(Map map) throws DataAccessException;/*** 删除单条记录** @param id* @return* @throws DataAccessException*/Integer delete(Integer id) throws DataAccessException;/*** 批量删除记录** @param ids* @return* @throws DataAccessException*/Integer deleteBatch(Integer[] ids) throws DataAccessException;}
package base;import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import base.util.AssertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** 公共业务层** @param <T>*/
public abstract class BaseService<T> {@Autowiredprivate BaseDao<T> baseDao;/*** 添加记录** @param entity* @return* @throws DataAccessException*/public Integer save(T entity) throws DataAccessException {return baseDao.save(entity);}/*** 批量添加记录** @param entities* @return* @throws DataAccessException*/public Integer saveBatch(List<T> entities) throws DataAccessException {return baseDao.saveBatch(entities);}/*** 查询单条记录** @param id* @return* @throws DataAccessException*/public T selectById(Integer id) throws DataAccessException {return baseDao.selectById(id);}/*** 多条件查询** @param baseQuery* @return* @throws DataAccessException*/public PageInfo<T> selectByParams(BaseQuery baseQuery) throws DataAccessException {PageHelper.PageNum(), PageSize());List<T> entities = baseDao.selectByParams(baseQuery);return new PageInfo<T>(entities);}// 针对easyui前端框架封装的分页查询public Map<String, Object> selectForPage(BaseQuery baseQuery) throws DataAccessException {PageHelper.PageNum(), PageSize());List<T> entities = baseDao.selectByParams(baseQuery);PageInfo<T> pageInfo = new PageInfo<T>(entities);Map<String, Object> map = new HashMap<String, Object>();map.put("total", Total());map.put("rows", List());return map;}/*** 更新单条记录** @param entity* @return* @throws DataAccessException*/public Integer update(T entity) throws DataAccessException {return baseDao.update(entity);}/*** 批量更新记录** @param map* @return* @throws DataAccessException*/public Integer updateBatch(Map map) throws DataAccessException {return baseDao.updateBatch(map);}/*** 删除单条记录** @param id* @return* @throws DataAccessException*/public Integer delete(Integer id) throws DataAccessException {AssertUtil.isTrue(null == id || id <= 0 || null == selectById(id), "待删除记录不存在!");return baseDao.delete(id);}/*** 批量删除记录** @param ids* @return* @throws DataAccessException*/public Integer deleteBatch(Integer[] ids) throws DataAccessException {AssertUtil.isTrue(null == ids || ids.length == 0, "请选择待删除记录!");return baseDao.deleteBatch(ids);}}
package base;/*** 公共查询对象*/
public class BaseQuery {private Integer pageNum = 1;private Integer pageSize = 10;public Integer getPageNum() {return pageNum;}public void setPageNum(Integer pageNum) {this.pageNum = pageNum;}public Integer getPageSize() {return pageSize;}public void setPageSize(Integer pageSize) {this.pageSize = pageSize;}}
package sales.dao;import base.BaseDao;
import sales.pojo.SaleChance;/*** 营销机会管理mapper*/
public interface SaleChanceMapper extends BaseDao<SaleChance> {}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis//DTD Mapper 3.0//EN" ".dtd">
<mapper namespace="sales.dao.SaleChanceMapper"><resultMap id="BaseResultMap" type="sales.pojo.SaleChance"><id column="id" jdbcType="INTEGER" property="id"/><result column="chance_source" jdbcType="VARCHAR" property="chanceSource"/><result column="customer_name" jdbcType="VARCHAR" property="customerName"/><result column="cgjl" jdbcType="INTEGER" property="cgjl"/><result column="overview" jdbcType="VARCHAR" property="overview"/><result column="link_man" jdbcType="VARCHAR" property="linkMan"/><result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/><result column="description" jdbcType="VARCHAR" property="description"/><result column="create_man" jdbcType="VARCHAR" property="createMan"/><result column="assign_man" jdbcType="VARCHAR" property="assignMan"/><result column="assign_time" jdbcType="TIMESTAMP" property="assignTime"/><result column="state" jdbcType="INTEGER" property="state"/><result column="dev_result" jdbcType="INTEGER" property="devResult"/><result column="is_valid" jdbcType="INTEGER" property="isValid"/><result column="create_date" jdbcType="TIMESTAMP" property="createDate"/><result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/></resultMap><sql id="Base_Column_List">id, chance_source, customer_name, cgjl, overview, link_man, link_phone, description, create_man, assign_man, assign_time, state, dev_result, is_valid, create_date, update_date</sql><select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">select<include refid="Base_Column_List"/>from t_sale_chancewhere id = #{id,jdbcType=INTEGER}</select><delete id="delete" parameterType="java.lang.Integer">delete from t_sale_chancewhere id = #{id,jdbcType=INTEGER}</delete><insert id="save" parameterType="sales.pojo.SaleChance"><selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">SELECT LAST_INSERT_ID()</selectKey>insert into t_sale_chance<trim prefix="(" suffix=")" suffixOverrides=","><if test="chanceSource != null">chance_source,</if><if test="customerName != null">customer_name,</if><if test="cgjl != null">cgjl,</if><if test="overview != null">overview,</if><if test="linkMan != null">link_man,</if><if test="linkPhone != null">link_phone,</if><if test="description != null">description,</if><if test="createMan != null">create_man,</if><if test="assignMan != null">assign_man,</if><if test="assignTime != null">assign_time,</if><if test="state != null">state,</if><if test="devResult != null">dev_result,</if><if test="isValid != null">is_valid,</if><if test="createDate != null">create_date,</if><if test="updateDate != null">update_date,</if></trim><trim prefix="values (" suffix=")" suffixOverrides=","><if test="chanceSource != null">#{chanceSource,jdbcType=VARCHAR},</if><if test="customerName != null">#{customerName,jdbcType=VARCHAR},</if><if test="cgjl != null">#{cgjl,jdbcType=INTEGER},</if><if test="overview != null">#{overview,jdbcType=VARCHAR},</if><if test="linkMan != null">#{linkMan,jdbcType=VARCHAR},</if><if test="linkPhone != null">#{linkPhone,jdbcType=VARCHAR},</if><if test="description != null">#{description,jdbcType=VARCHAR},</if><if test="createMan != null">#{createMan,jdbcType=VARCHAR},</if><if test="assignMan != null">#{assignMan,jdbcType=VARCHAR},</if><if test="assignTime != null">#{assignTime,jdbcType=TIMESTAMP},</if><if test="state != null">#{state,jdbcType=INTEGER},</if><if test="devResult != null">#{devResult,jdbcType=INTEGER},</if><if test="isValid != null">#{isValid,jdbcType=INTEGER},</if><if test="createDate != null">#{createDate,jdbcType=TIMESTAMP},</if><if test="updateDate != null">#{updateDate,jdbcType=TIMESTAMP},</if></trim></insert><update id="update" parameterType="sales.pojo.SaleChance">update t_sale_chance<set><if test="chanceSource != null">chance_source = #{chanceSource,jdbcType=VARCHAR},</if><if test="customerName != null">customer_name = #{customerName,jdbcType=VARCHAR},</if><if test="cgjl != null">cgjl = #{cgjl,jdbcType=INTEGER},</if><if test="overview != null">overview = #{overview,jdbcType=VARCHAR},</if><if test="linkMan != null">link_man = #{linkMan,jdbcType=VARCHAR},</if><if test="linkPhone != null">link_phone = #{linkPhone,jdbcType=VARCHAR},</if><if test="description != null">description = #{description,jdbcType=VARCHAR},</if><if test="createMan != null">create_man = #{createMan,jdbcType=VARCHAR},</if><if test="assignMan != null">assign_man = #{assignMan,jdbcType=VARCHAR},</if><if test="assignTime != null">assign_time = #{assignTime,jdbcType=TIMESTAMP},</if><if test="state != null">state = #{state,jdbcType=INTEGER},</if><if test="devResult != null">dev_result = #{devResult,jdbcType=INTEGER},</if><if test="isValid != null">is_valid = #{isValid,jdbcType=INTEGER},</if><if test="createDate != null">create_date = #{createDate,jdbcType=TIMESTAMP},</if><if test="updateDate != null">update_date = #{updateDate,jdbcType=TIMESTAMP},</if></set>where id = #{id,jdbcType=INTEGER}</update><!--分页查询营销机会--><select id="selectByParams" parameterType="SaleChanceQuery" resultMap="BaseResultMap">select<include refid="Base_Column_List"/>from t_sale_chance<where>is_valid = 1<!-- 客户名称 --><if test="null !=customerName and ''!=customerName">and customer_name like concat ('%',#{customerName},'%')</if><if test="null!=state">and state=#{state}</if><if test="null!=devResult">and dev_result =#{devResult}</if><if test="null!=createDate and ''!=createDate">and create_date<= #{createDate}</if></where></select>
</mapper>
package sales.query;import base.BaseQuery;/*** 营销机会查询对象*/
public class SaleChanceQuery extends BaseQuery {private String customerName;private Integer state;private Integer devResult;// 使用字符串类型,否则报错无法转换类型,也可以使用格式化注解转换private String createDate;public String getCustomerName() {return customerName;}public void setCustomerName(String customerName) {this.customerName = customerName;}public Integer getState() {return state;}public void setState(Integer state) {this.state = state;}public Integer getDevResult() {return devResult;}public void setDevResult(Integer devResult) {this.devResult = devResult;}public String getCreateDate() {return createDate;}public void setCreateDate(String createDate) {ateDate = createDate;}
}
package sales.service;import base.BaseService;
import sales.pojo.SaleChance;/*** 营销机会管理service* Created by Administrator on 2019/8/29.*/
public abstract class SaleChanceService extends BaseService<SaleChance> {
}
package sales.service.impl;import sales.service.SaleChanceService;
import org.springframework.stereotype.Service;/*** 营销机会管理service实现* Created by Administrator on 2019/8/29.*/
@Service
public class SaleChanceServiceImpl extends SaleChanceService {}
package ller;import base.BaseController;
import sales.query.SaleChanceQuery;
import sales.service.SaleChanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import java.util.Map;/*** 营销机会Contoller* Created by Administrator on 2019/8/29.*/
@Controller
@RequestMapping("/saleChance")
public class SaleChanceController extends BaseController{@Autowiredprivate SaleChanceService saleChanceService;/*** 跳转页面* @return*/@RequestMapping("/index")public String index(){return "sale_chance";}/*** 分页查询营销机会* @param query* @return*/@RequestMapping("/selectSaleChanceByParams")@ResponseBodypublic Map<String,Object>selectSaleChanceByParams(SaleChanceQuery query,@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer rows){query.setPageNum(page);query.setPageSize(rows);return saleChanceService.selectForPage(query);}
}
index.ftl
<div title="营销管理" data-options="selected:true,iconCls:'icon-yxgl'"
style="padding: 10px"> <a href="javascript:openTab('营销机会管理','saleChance/index','icon-yxjhgl')"
class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-yxjhgl'"
style="width: 150px">营销机会管理</a>
<a href="javascript:openTab('客户开发计划','sale_chance/index?state=1','iconkhkfjh')" class="easyui-linkbutton" data-options="plain:true,iconCls:'iconkhkfjh'" style="width: 150px">客户开发计划</a>
</div>
sale_chance.ftl
<html>
<head>
<#include "common.ftl" ><script type="text/javascript" src="${ctx}/js/sale.chance.js"></script>
</head>
<body style="margin: 1px">
<table id="dg" class="easyui-datagrid"pagination="true" rownumbers="true"url="${ctx}/saleChance/selectSaleChanceByParams" fit="true" toolbar="#tb"><thead><tr><th field="cb" checkbox="true" align="center"></th><th field="id" width="50" align="center">编号</th><th field="chanceSource" width="200" align="center">机会来源</th><th field="customerName" width="50" align="center">客户名称</th><th field="cgjl" width="50" align="center">成功几率</th><th field="overview" width="200" align="center">概要</th><th field="linkMan" width="100" align="center">联系人</th><th field="linkPhone" width="100" align="center">联系电话</th><th field="description" width="200" align="center">机会描述</th><th field="createMan" width="100" align="center">创建人</th><th field="createDate" width="100" align="center">创建时间</th><th field="trueName" width="200" align="center">指派人</th><th field="assignTime" width="200" align="center">指派时间</th><th field="state" width="100" align="center" formatter="formatterState">分配状态</th><th field="devResult" width="200" align="center" formatter="formatterDevResult">客户开发状态</th></tr></thead>
</table>
<div id="tb"><a href="javascript:openAddSaleChacneDialog()" class="easyui-linkbutton" iconCls="icon-save" plain="true">添加</a><a href="javascript:openModifySaleChanceDialog()" class="easyui-linkbutton" iconCls="icon-edit" plain="true">更新</a><a href="javascript:deleteSaleChance()" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a><br/>客户名称:<input type="text" id="customerName"/>状态:<select class="easyui-combobox" name="state" id="state" panelHeight="auto"><option value="">全部</option><option value="0">未分配</option><option value="1">已分配</option></select>开发结果:<select class="easyui-combobox" id="devResult" panelHeight="auto"><option value="">全部</option><option value="0">未开发</option><option value="1">开发中</option><option value="2">开发成功</option><option value="3">开发失败</option></select>创建时间:<input id="time" type="text" class="easyui-datebox"></input><a href="javascript:querySaleChancesByParams()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
</div><div id="dlg" class="easyui-dialog" title="添加营销记录" closed="true"style="width: 500px;height:300px" buttons="#bt"><form id="fm" method="post"><table style="font-size: 12px;"><tr><td>机会来源:</td><td><input type="text" id="chanceSource" name="chanceSource"/></td></tr><tr><td>客户名称:</td><td><input type="text" id="customerName02" class="easyui-validatebox" name="customerName" required="required"/></td></tr><tr><td>成功几率:</td><td><input type="text" id="cgjl" name="cgjl"/></td></tr><tr><td>联系人:</td><td><input type="text" name="linkMan" id="linkMan" class="easyui-validatebox" required="required"/></td></tr><tr><td>联系电话:</td><td><input type="text" name="linkPhone" id="linkPhone" class="easyui-validatebox" required="required"/></td></tr><tr><td>描述信息:</td><td><input type="text" id="description" name="description"/></td></tr><tr><td>分配人:</td><td><input type="text" id="assignMan" name="assignMan"/><#--<input class="easyui-combobox" id="assignMan" name="assignMan"valueField="id" textField="trueName"url="${ctx}/system/queryCustomerManagers" panelHeight="auto"/>--></td></tr></table><input name="id" id="id" type="hidden"/></form>
</div>
<div id="bt"><a href="javascript:saveOrUpdateSaleChance()" class="easyui-linkbutton" plain="true" iconCls="icon-save">保存</a><a href="javascript:closeDlg()" class="easyui-linkbutton" plain="true" iconCls="icon-cancel">取消</a>
</div></body>
</html>
日期时间处理:时间显示为时间戳,我们需要将时间戳转换为正常时间。
实体类添加日期时间转换注解,或者前台模板修改。二选一
package sales.pojo;import com.fasterxml.jackson.annotation.JsonFormat;import java.io.Serializable;
import java.util.Date;public class SaleChance implements Serializable {private Integer id;private String chanceSource;private String customerName;private Integer cgjl;private String overview;private String linkMan;private String linkPhone;private String description;private String createMan;private String assignMan;@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")private Date assignTime;private Integer state;private Integer devResult;private Integer isValid;@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")private Date createDate;@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")private Date updateDate;private static final long serialVersionUID = 1L;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getChanceSource() {return chanceSource;}public void setChanceSource(String chanceSource) {this.chanceSource = chanceSource == null ? null : im();}public String getCustomerName() {return customerName;}public void setCustomerName(String customerName) {this.customerName = customerName == null ? null : im();}public Integer getCgjl() {return cgjl;}public void setCgjl(Integer cgjl) {jl = cgjl;}public String getOverview() {return overview;}public void setOverview(String overview) {this.overview = overview == null ? null : im();}public String getLinkMan() {return linkMan;}public void setLinkMan(String linkMan) {this.linkMan = linkMan == null ? null : im();}public String getLinkPhone() {return linkPhone;}public void setLinkPhone(String linkPhone) {this.linkPhone = linkPhone == null ? null : im();}public String getDescription() {return description;}public void setDescription(String description) {this.description = description == null ? null : im();}public String getCreateMan() {return createMan;}public void setCreateMan(String createMan) {ateMan = createMan == null ? null : im();}public String getAssignMan() {return assignMan;}public void setAssignMan(String assignMan) {this.assignMan = assignMan == null ? null : im();}public Date getAssignTime() {return assignTime;}public void setAssignTime(Date assignTime) {this.assignTime = assignTime;}public Integer getState() {return state;}public void setState(Integer state) {this.state = state;}public Integer getDevResult() {return devResult;}public void setDevResult(Integer devResult) {this.devResult = devResult;}public Integer getIsValid() {return isValid;}public void setIsValid(Integer isValid) {this.isValid = isValid;}public Date getCreateDate() {return createDate;}public void setCreateDate(Date createDate) {ateDate = createDate;}public Date getUpdateDate() {return updateDate;}public void setUpdateDate(Date updateDate) {this.updateDate = updateDate;}@Overridepublic String toString() {StringBuilder sb = new StringBuilder();sb.append(getClass().getSimpleName());sb.append(" [");sb.append("Hash = ").append(hashCode());sb.append(", id=").append(id);sb.append(", chanceSource=").append(chanceSource);sb.append(", customerName=").append(customerName);sb.append(", cgjl=").append(cgjl);sb.append(", overview=").append(overview);sb.append(", linkMan=").append(linkMan);sb.append(", linkPhone=").append(linkPhone);sb.append(", description=").append(description);sb.append(", createMan=").append(createMan);sb.append(", assignMan=").append(assignMan);sb.append(", assignTime=").append(assignTime);sb.append(", state=").append(state);sb.append(", devResult=").append(devResult);sb.append(", isValid=").append(isValid);sb.append(", createDate=").append(createDate);sb.append(", updateDate=").append(updateDate);sb.append("]");String();}
}
状态字段处理和列表行颜色处理
sale_chance.js
//格式化的处理(分配状态)
function formatterState(value,row,index){if(0==value){return"未分配";}if(1==value){return"已分配";}
}
//客户开发状态
function formatterDevResult(value,row,index){if(0==value){return"未开发";}if(1==value){return"开发中";}if(2==value){return"开发成功";}if(3==value){return"开发失败";}
}
//进入页面执行,根据开发状态返回不同的颜色
$(function () {$('#dg').datagrid({rowStyler: function (index, row) {// 获取开发状态字段的值var devResult = row.devResult;if (0 == devResult) {return "background-color:#5bc0de;"; // 蓝色} else if (1 == devResult) {return "background-color:#f0ad4e;"; // 黄色} else if (2 == devResult) {return "background-color:#5cb85c;"; // 绿色} else if (3 == devResult) {return "background-color:#d9534f;"; // 红色}}});
});
本文发布于:2024-01-28 02:23:13,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/17063797974099.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |