@ -0,0 +1,29 @@
|
||||
package org.jeecg.common.util; |
||||
|
||||
import org.apache.commons.lang.StringUtils; |
||||
import org.springframework.web.util.HtmlUtils; |
||||
|
||||
/** |
||||
* HTML 工具类 |
||||
*/ |
||||
public class HTMLUtils { |
||||
|
||||
/** |
||||
* 获取HTML内的文本,不包含标签 |
||||
* |
||||
* @param html HTML 代码 |
||||
*/ |
||||
public static String getInnerText(String html) { |
||||
if (StringUtils.isNotBlank(html)) { |
||||
//去掉 html 的标签
|
||||
String content = html.replaceAll("</?[^>]+>", ""); |
||||
// 将多个空格合并成一个空格
|
||||
content = content.replaceAll("( )+", " "); |
||||
// 反向转义字符
|
||||
content = HtmlUtils.htmlUnescape(content); |
||||
return content.trim(); |
||||
} |
||||
return ""; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,63 @@
|
||||
package org.jeecg.modules.demo.test.controller; |
||||
|
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo; |
||||
import org.jeecg.modules.demo.test.service.IJeecgDemoService; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Description: 大屏预览入口 |
||||
* @Author: scott |
||||
* @Date:2019-12-12 |
||||
* @Version:V1.0 |
||||
*/ |
||||
@Slf4j |
||||
@Controller |
||||
@RequestMapping("/big/screen") |
||||
public class BigScreenController extends JeecgController<JeecgDemo, IJeecgDemoService> { |
||||
|
||||
/** |
||||
* @param modelAndView |
||||
* @return |
||||
*/ |
||||
@RequestMapping("/html") |
||||
public ModelAndView ftl(ModelAndView modelAndView) { |
||||
modelAndView.setViewName("demo3"); |
||||
List<String> userList = new ArrayList<String>(); |
||||
userList.add("admin"); |
||||
userList.add("user1"); |
||||
userList.add("user2"); |
||||
log.info("--------------test--------------"); |
||||
modelAndView.addObject("userList", userList); |
||||
return modelAndView; |
||||
} |
||||
|
||||
/** |
||||
* 生产销售监控模版 |
||||
* @param modelAndView |
||||
* @return |
||||
*/ |
||||
@RequestMapping("/index1") |
||||
public ModelAndView index1(ModelAndView modelAndView) { |
||||
modelAndView.setViewName("/bigscreen/template1/index"); |
||||
return modelAndView; |
||||
} |
||||
|
||||
/** |
||||
* 智慧物流监控模版 |
||||
* @param modelAndView |
||||
* @return |
||||
*/ |
||||
@RequestMapping("/index2") |
||||
public ModelAndView index2(ModelAndView modelAndView) { |
||||
modelAndView.setViewName("/bigscreen/template2/index"); |
||||
return modelAndView; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,64 @@
|
||||
package org.jeecg.modules.system.rule; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import org.jeecg.common.handler.IFillRuleHandler; |
||||
import org.jeecg.common.util.SpringContextUtils; |
||||
import org.jeecg.common.util.YouBianCodeUtil; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
import org.jeecg.modules.system.entity.SysCategory; |
||||
import org.jeecg.modules.system.mapper.SysCategoryMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author scott |
||||
* @Date 2019/12/9 11:32 |
||||
* @Description: 分类字典编码生成规则 |
||||
*/ |
||||
public class CategoryCodeRule implements IFillRuleHandler { |
||||
|
||||
public static final String ROOT_PID_VALUE = "0"; |
||||
|
||||
@Override |
||||
public Object execute(JSONObject params, JSONObject formData) { |
||||
|
||||
String categoryPid = ROOT_PID_VALUE; |
||||
String categoryCode = null; |
||||
|
||||
if (formData != null && formData.size() > 0) { |
||||
Object obj = formData.get("pid"); |
||||
if (oConvertUtils.isNotEmpty(obj)) categoryPid = obj.toString(); |
||||
} else { |
||||
if (params != null) { |
||||
Object obj = params.get("pid"); |
||||
if (oConvertUtils.isNotEmpty(obj)) categoryPid = obj.toString(); |
||||
} |
||||
} |
||||
|
||||
/* |
||||
* 分成三种情况 |
||||
* 1.数据库无数据 调用YouBianCodeUtil.getNextYouBianCode(null); |
||||
* 2.添加子节点,无兄弟元素 YouBianCodeUtil.getSubYouBianCode(parentCode,null); |
||||
* 3.添加子节点有兄弟元素 YouBianCodeUtil.getNextYouBianCode(lastCode); |
||||
* */ |
||||
//找同类 确定上一个最大的code值
|
||||
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>().eq(SysCategory::getPid, categoryPid).orderByDesc(SysCategory::getCode); |
||||
SysCategoryMapper baseMapper = (SysCategoryMapper) SpringContextUtils.getBean("sysCategoryMapper"); |
||||
List<SysCategory> list = baseMapper.selectList(query); |
||||
if (list == null || list.size() == 0) { |
||||
if (ROOT_PID_VALUE.equals(categoryPid)) { |
||||
//情况1
|
||||
categoryCode = YouBianCodeUtil.getNextYouBianCode(null); |
||||
} else { |
||||
//情况2
|
||||
SysCategory parent = (SysCategory) baseMapper.selectById(categoryPid); |
||||
categoryCode = YouBianCodeUtil.getSubYouBianCode(parent.getCode(), null); |
||||
} |
||||
} else { |
||||
//情况3
|
||||
categoryCode = YouBianCodeUtil.getNextYouBianCode(list.get(0).getCode()); |
||||
} |
||||
return categoryCode; |
||||
} |
||||
} |
@ -0,0 +1,94 @@
|
||||
package org.jeecg.modules.system.rule; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import io.netty.util.internal.StringUtil; |
||||
import org.jeecg.common.handler.IFillRuleHandler; |
||||
import org.jeecg.common.util.SpringContextUtils; |
||||
import org.jeecg.common.util.YouBianCodeUtil; |
||||
import org.jeecg.modules.system.entity.SysDepart; |
||||
import org.jeecg.modules.system.service.ISysDepartService; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author scott |
||||
* @Date 2019/12/9 11:33 |
||||
* @Description: 机构编码生成规则 |
||||
*/ |
||||
public class OrgCodeRule implements IFillRuleHandler { |
||||
|
||||
@Override |
||||
public Object execute(JSONObject params, JSONObject formData) { |
||||
ISysDepartService sysDepartService = (ISysDepartService) SpringContextUtils.getBean("sysDepartServiceImpl"); |
||||
|
||||
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>(); |
||||
LambdaQueryWrapper<SysDepart> query1 = new LambdaQueryWrapper<SysDepart>(); |
||||
// 创建一个List集合,存储查询返回的所有SysDepart对象
|
||||
List<SysDepart> departList = new ArrayList<>(); |
||||
String[] strArray = new String[2]; |
||||
//定义部门类型
|
||||
String orgType = ""; |
||||
// 定义新编码字符串
|
||||
String newOrgCode = ""; |
||||
// 定义旧编码字符串
|
||||
String oldOrgCode = ""; |
||||
|
||||
String parentId = null; |
||||
if (formData != null && formData.size() > 0) { |
||||
Object obj = formData.get("parentId"); |
||||
if (obj != null) parentId = obj.toString(); |
||||
} else { |
||||
if (params != null) { |
||||
Object obj = params.get("parentId"); |
||||
if (obj != null) parentId = obj.toString(); |
||||
} |
||||
} |
||||
|
||||
//如果是最高级,则查询出同级的org_code, 调用工具类生成编码并返回
|
||||
if (StringUtil.isNullOrEmpty(parentId)) { |
||||
// 线判断数据库中的表是否为空,空则直接返回初始编码
|
||||
query1.eq(SysDepart::getParentId, "").or().isNull(SysDepart::getParentId); |
||||
query1.orderByDesc(SysDepart::getOrgCode); |
||||
departList = sysDepartService.list(query1); |
||||
if (departList == null || departList.size() == 0) { |
||||
strArray[0] = YouBianCodeUtil.getNextYouBianCode(null); |
||||
strArray[1] = "1"; |
||||
return strArray; |
||||
} else { |
||||
SysDepart depart = departList.get(0); |
||||
oldOrgCode = depart.getOrgCode(); |
||||
orgType = depart.getOrgType(); |
||||
newOrgCode = YouBianCodeUtil.getNextYouBianCode(oldOrgCode); |
||||
} |
||||
} else {//反之则查询出所有同级的部门,获取结果后有两种情况,有同级和没有同级
|
||||
// 封装查询同级的条件
|
||||
query.eq(SysDepart::getParentId, parentId); |
||||
// 降序排序
|
||||
query.orderByDesc(SysDepart::getOrgCode); |
||||
// 查询出同级部门的集合
|
||||
List<SysDepart> parentList = sysDepartService.list(query); |
||||
// 查询出父级部门
|
||||
SysDepart depart = sysDepartService.getById(parentId); |
||||
// 获取父级部门的Code
|
||||
String parentCode = depart.getOrgCode(); |
||||
// 根据父级部门类型算出当前部门的类型
|
||||
orgType = String.valueOf(Integer.valueOf(depart.getOrgType()) + 1); |
||||
// 处理同级部门为null的情况
|
||||
if (parentList == null || parentList.size() == 0) { |
||||
// 直接生成当前的部门编码并返回
|
||||
newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, null); |
||||
} else { //处理有同级部门的情况
|
||||
// 获取同级部门的编码,利用工具类
|
||||
String subCode = parentList.get(0).getOrgCode(); |
||||
// 返回生成的当前部门编码
|
||||
newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, subCode); |
||||
} |
||||
} |
||||
// 返回最终封装了部门编码和部门类型的数组
|
||||
strArray[0] = newOrgCode; |
||||
strArray[1] = orgType; |
||||
return strArray; |
||||
} |
||||
} |
@ -0,0 +1,199 @@
|
||||
package ${bussiPackage}.${entityPackage}.controller; |
||||
|
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
import java.util.Arrays; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
<#list subTables as sub> |
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName}; |
||||
</#list> |
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName}; |
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service; |
||||
<#list subTables as sub> |
||||
import ${bussiPackage}.${entityPackage}.service.I${sub.entityName}Service; |
||||
</#list> |
||||
|
||||
|
||||
/** |
||||
* @Description: ${tableVo.ftlDescription} |
||||
* @Author: jeecg-boot |
||||
* @Date: ${.now?string["yyyy-MM-dd"]} |
||||
* @Version: V1.0 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/${entityPackage}/${entityName?uncap_first}") |
||||
@Slf4j |
||||
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service> { |
||||
|
||||
@Autowired |
||||
private I${entityName}Service ${entityName?uncap_first}Service; |
||||
<#list subTables as sub> |
||||
|
||||
@Autowired |
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service; |
||||
</#list> |
||||
|
||||
|
||||
/*---------------------------------主表处理-begin-------------------------------------*/ |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* @param ${entityName?uncap_first} |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(${entityName} ${entityName?uncap_first}, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap()); |
||||
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize); |
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper); |
||||
return Result.ok(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* @param ${entityName?uncap_first} |
||||
* @return |
||||
*/ |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody ${entityName} ${entityName?uncap_first}) { |
||||
${entityName?uncap_first}Service.save(${entityName?uncap_first}); |
||||
return Result.ok("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* @param ${entityName?uncap_first} |
||||
* @return |
||||
*/ |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody ${entityName} ${entityName?uncap_first}) { |
||||
${entityName?uncap_first}Service.updateById(${entityName?uncap_first}); |
||||
return Result.ok("编辑成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@DeleteMapping(value = "/delete") |
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
||||
${entityName?uncap_first}Service.delMain(id); |
||||
return Result.ok("删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除 |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
@DeleteMapping(value = "/deleteBatch") |
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(","))); |
||||
return Result.ok("批量删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 导出 |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) { |
||||
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}"); |
||||
} |
||||
|
||||
/** |
||||
* 导入 |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
||||
return super.importExcel(request, response, ${entityName}.class); |
||||
} |
||||
/*---------------------------------主表处理-end-------------------------------------*/ |
||||
|
||||
<#list subTables as sub> |
||||
|
||||
/*--------------------------------子表处理-${sub.ftlDescription}-begin----------------------------------------------*/ |
||||
/** |
||||
* 查询子表信息 会传入主表ID |
||||
* @return |
||||
*/ |
||||
@GetMapping(value = "/list${sub.entityName}ByMainId") |
||||
public Result<?> list${sub.entityName}ByMainId(${sub.entityName} ${sub.entityName?uncap_first}, |
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<${sub.entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${sub.entityName?uncap_first}, req.getParameterMap()); |
||||
Page<${sub.entityName}> page = new Page<${sub.entityName}>(pageNo, pageSize); |
||||
IPage<${sub.entityName}> pageList = ${sub.entityName?uncap_first}Service.page(page, queryWrapper); |
||||
return Result.ok(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* @param ${sub.entityName?uncap_first} |
||||
* @return |
||||
*/ |
||||
@PostMapping(value = "/add${sub.entityName}") |
||||
public Result<?> add${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) { |
||||
${sub.entityName?uncap_first}Service.save(${sub.entityName?uncap_first}); |
||||
return Result.ok("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* @param ${sub.entityName?uncap_first} |
||||
* @return |
||||
*/ |
||||
@PutMapping(value = "/edit${sub.entityName}") |
||||
public Result<?> edit${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) { |
||||
${sub.entityName?uncap_first}Service.updateById(${sub.entityName?uncap_first}); |
||||
return Result.ok("编辑成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@DeleteMapping(value = "/delete${sub.entityName}") |
||||
public Result<?> delete${sub.entityName}(@RequestParam(name="id",required=true) String id) { |
||||
${sub.entityName?uncap_first}Service.removeById(id); |
||||
return Result.ok("删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除 |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
@DeleteMapping(value = "/deleteBatch${sub.entityName}") |
||||
public Result<?> deleteBatch${sub.entityName}(@RequestParam(name="ids",required=true) String ids) { |
||||
this.${sub.entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(","))); |
||||
return Result.ok("批量删除成功!"); |
||||
} |
||||
|
||||
/*--------------------------------子表处理-${sub.ftlDescription}-end----------------------------------------------*/ |
||||
</#list> |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,75 @@
|
||||
package ${bussiPackage}.${entityPackage}.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
/** |
||||
* @Description: ${tableVo.ftlDescription} |
||||
* @Author: jeecg-boot |
||||
* @Date: ${.now?string["yyyy-MM-dd"]} |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("${tableName}") |
||||
public class ${entityName} implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
<#list originalColumns as po> |
||||
/**${po.filedComment}*/ |
||||
<#if po.fieldName == primaryKeyField> |
||||
@TableId(type = IdType.ID_WORKER_STR) |
||||
<#else> |
||||
<#if po.fieldDbType =='Date'> |
||||
<#if po.classType=='date'> |
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd") |
||||
<#else> |
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
</#if> |
||||
<#else> |
||||
@Excel(name = "${po.filedComment}", width = 15) |
||||
</#if> |
||||
</#if> |
||||
<#if po.fieldDbType=='Blob'> |
||||
private transient java.lang.String ${po.fieldName}String; |
||||
|
||||
private byte[] ${po.fieldName}; |
||||
|
||||
public byte[] get${po.fieldName?cap_first}(){ |
||||
if(${po.fieldName}String==null){ |
||||
return null; |
||||
} |
||||
try { |
||||
return ${po.fieldName}String.getBytes("UTF-8"); |
||||
} catch (UnsupportedEncodingException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public String get${po.fieldName?cap_first}String(){ |
||||
if(${po.fieldName}==null || ${po.fieldName}.length==0){ |
||||
return ""; |
||||
} |
||||
try { |
||||
return new String(${po.fieldName},"UTF-8"); |
||||
} catch (UnsupportedEncodingException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return ""; |
||||
} |
||||
<#else> |
||||
private ${po.fieldType} ${po.fieldName}; |
||||
</#if> |
||||
</#list> |
||||
} |
@ -0,0 +1,62 @@
|
||||
<#list subTables as subTab> |
||||
#segment#${subTab.entityName}.java |
||||
package ${bussiPackage}.${entityPackage}.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @Description: ${subTab.ftlDescription} |
||||
* @Author: jeecg-boot |
||||
* @Date: ${.now?string["yyyy-MM-dd"]} |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("${subTab.tableName}") |
||||
public class ${subTab.entityName} implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
<#list subTab.originalColumns as po> |
||||
/**${po.filedComment}*/ |
||||
<#if po.fieldName == primaryKeyField> |
||||
@TableId(type = IdType.ID_WORKER_STR) |
||||
<#else> |
||||
<#if po.fieldDbType =='Date'> |
||||
<#if po.classType=='date'> |
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd") |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd") |
||||
<#else> |
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
</#if> |
||||
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)> |
||||
@Excel(name = "${po.filedComment}", width = 15) |
||||
</#if> |
||||
</#if> |
||||
<#if po.classType =='list' || po.classType =='radio' || po.classType =='list_multi' || po.classType =='checkbox' || po.classType =='sel_search'> |
||||
<#if po.dictTable?default("")?trim?length gt 1> |
||||
@Dict(dicCode = "${po.dictField}",dicText = "${po.dictText}",dictTable = "${po.dictTable}") |
||||
<#elseif po.dictField?default("")?trim?length gt 1> |
||||
@Dict(dicCode = "${po.dictField}") |
||||
</#if> |
||||
</#if> |
||||
<#if po.classType =='cat_tree'> |
||||
@Dict(dicCode = "id",dicText = "name",dictTable = "sys_category") |
||||
</#if> |
||||
<#if po.classType =='sel_depart'> |
||||
@Dict(dicCode = "id",dicText = "depart_name",dictTable = "sys_depart") |
||||
</#if> |
||||
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName}; |
||||
</#list> |
||||
} |
||||
</#list> |
@ -0,0 +1,17 @@
|
||||
package ${bussiPackage}.${entityPackage}.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName}; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: ${tableVo.ftlDescription} |
||||
* @Author: jeecg-boot |
||||
* @Date: ${.now?string["yyyy-MM-dd"]} |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ${entityName}Mapper extends BaseMapper<${entityName}> { |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
<#list subTables as subTab> |
||||
#segment#${subTab.entityName}Mapper.java |
||||
package ${bussiPackage}.${entityPackage}.mapper; |
||||
|
||||
import java.util.List; |
||||
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName}; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
/** |
||||
* @Description: ${subTab.ftlDescription} |
||||
* @Author: jeecg-boot |
||||
* @Date: ${.now?string["yyyy-MM-dd"]} |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ${subTab.entityName}Mapper extends BaseMapper<${subTab.entityName}> { |
||||
|
||||
public boolean deleteByMainId(@Param("mainId") String mainId); |
||||
|
||||
public List<${subTab.entityName}> selectByMainId(@Param("mainId") String mainId); |
||||
|
||||
} |
||||
</#list> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,28 @@
|
||||
<#list subTables as subTab> |
||||
<#assign originalForeignKeys = subTab.originalForeignKeys> |
||||
#segment#${subTab.entityName}Mapper.xml |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper"> |
||||
|
||||
<delete id="deleteByMainId" parameterType="java.lang.String"> |
||||
DELETE |
||||
FROM ${subTab.tableName} |
||||
WHERE |
||||
<#list originalForeignKeys as key> |
||||
${key} = ${r'#'}{mainId} <#rt/> |
||||
</#list> |
||||
|
||||
</delete> |
||||
|
||||
<select id="selectByMainId" parameterType="java.lang.String" resultType="${bussiPackage}.${entityPackage}.entity.${subTab.entityName}"> |
||||
SELECT * |
||||
FROM ${subTab.tableName} |
||||
WHERE |
||||
<#list originalForeignKeys as key> |
||||
${key} = ${r'#'}{mainId} <#rt/> |
||||
</#list> |
||||
|
||||
</select> |
||||
</mapper> |
||||
</#list> |
@ -0,0 +1,32 @@
|
||||
package ${bussiPackage}.${entityPackage}.service; |
||||
|
||||
<#list subTables as sub> |
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName}; |
||||
</#list> |
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName}; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import java.io.Serializable; |
||||
import java.util.Collection; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Description: ${tableVo.ftlDescription} |
||||
* @Author: jeecg-boot |
||||
* @Date: ${.now?string["yyyy-MM-dd"]} |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface I${entityName}Service extends IService<${entityName}> { |
||||
|
||||
/** |
||||
* 删除一对多 |
||||
*/ |
||||
public void delMain (String id); |
||||
|
||||
/** |
||||
* 批量删除一对多 |
||||
*/ |
||||
public void delBatchMain (Collection<? extends Serializable> idList); |
||||
|
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
<#list subTables as subTab> |
||||
#segment#I${subTab.entityName}Service.java |
||||
package ${bussiPackage}.${entityPackage}.service; |
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName}; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Description: ${subTab.ftlDescription} |
||||
* @Author: jeecg-boot |
||||
* @Date: ${.now?string["yyyy-MM-dd"]} |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface I${subTab.entityName}Service extends IService<${subTab.entityName}> { |
||||
|
||||
public List<${subTab.entityName}> selectByMainId(String mainId); |
||||
} |
||||
</#list> |
@ -0,0 +1,56 @@
|
||||
package ${bussiPackage}.${entityPackage}.service.impl; |
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName}; |
||||
<#list subTables as sub> |
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName}; |
||||
</#list> |
||||
<#list subTables as sub> |
||||
import ${bussiPackage}.${entityPackage}.mapper.${sub.entityName}Mapper; |
||||
</#list> |
||||
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper; |
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service; |
||||
import org.springframework.stereotype.Service; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import java.io.Serializable; |
||||
import java.util.List; |
||||
import java.util.Collection; |
||||
|
||||
/** |
||||
* @Description: ${tableVo.ftlDescription} |
||||
* @Author: jeecg-boot |
||||
* @Date: ${.now?string["yyyy-MM-dd"]} |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service { |
||||
|
||||
@Autowired |
||||
private ${entityName}Mapper ${entityName?uncap_first}Mapper; |
||||
<#list subTables as sub> |
||||
@Autowired |
||||
private ${sub.entityName}Mapper ${sub.entityName?uncap_first}Mapper; |
||||
</#list> |
||||
|
||||
@Override |
||||
@Transactional |
||||
public void delMain(String id) { |
||||
<#list subTables as sub> |
||||
${sub.entityName?uncap_first}Mapper.deleteByMainId(id); |
||||
</#list> |
||||
${entityName?uncap_first}Mapper.deleteById(id); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional |
||||
public void delBatchMain(Collection<? extends Serializable> idList) { |
||||
for(Serializable id:idList) { |
||||
<#list subTables as sub> |
||||
${sub.entityName?uncap_first}Mapper.deleteByMainId(id.toString()); |
||||
</#list> |
||||
${entityName?uncap_first}Mapper.deleteById(id); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,30 @@
|
||||
<#list subTables as subTab> |
||||
#segment#${subTab.entityName}ServiceImpl.java |
||||
package ${bussiPackage}.${entityPackage}.service.impl; |
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName}; |
||||
import ${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper; |
||||
import ${bussiPackage}.${entityPackage}.service.I${subTab.entityName}Service; |
||||
import org.springframework.stereotype.Service; |
||||
import java.util.List; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
/** |
||||
* @Description: ${subTab.ftlDescription} |
||||
* @Author: jeecg-boot |
||||
* @Date: ${.now?string["yyyy-MM-dd"]} |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ${subTab.entityName}ServiceImpl extends ServiceImpl<${subTab.entityName}Mapper, ${subTab.entityName}> implements I${subTab.entityName}Service { |
||||
|
||||
@Autowired |
||||
private ${subTab.entityName}Mapper ${subTab.entityName?uncap_first}Mapper; |
||||
|
||||
@Override |
||||
public List<${subTab.entityName}> selectByMainId(String mainId) { |
||||
return ${subTab.entityName?uncap_first}Mapper.selectByMainId(mainId); |
||||
} |
||||
} |
||||
</#list> |
@ -0,0 +1,403 @@
|
||||
<template> |
||||
<a-card :bordered="false"> |
||||
<!-- 查询区域 --> |
||||
<div class="table-page-search-wrapper"> |
||||
<a-form layout="inline" @keyup.enter.native="searchQuery"> |
||||
<a-row :gutter="24"> |
||||
<#assign query_field_no=0> |
||||
<#assign query_field_select=false> |
||||
<#assign query_field_date=false> |
||||
<#assign list_need_dict=false> |
||||
<#assign list_need_category=false> |
||||
<#assign query_flag=false> |
||||
<#-- 开始循环 --> |
||||
<#list columns as po> |
||||
<#if po.isQuery=='Y'> |
||||
<#assign query_flag=true> |
||||
<#if query_field_no==2> |
||||
<template v-if="toggleSearchStatus"> |
||||
</#if> |
||||
<#if po.queryMode=='single'> |
||||
<#if query_field_no gt 1> </#if><a-col :md="6" :sm="8"> |
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}"> |
||||
<#if po.classType=='date'> |
||||
<#assign query_field_date=true> |
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date> |
||||
<#elseif po.classType=='datetime'> |
||||
<#assign query_field_date=true> |
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date> |
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'> |
||||
<#assign query_field_select=true> |
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- --> |
||||
<#if po.dictTable?default("")?trim?length gt 1> |
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/> |
||||
<#elseif po.dictField?default("")?trim?length gt 1> |
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/> |
||||
<#else> |
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input> |
||||
</#if> |
||||
<#else> |
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input> |
||||
</#if> |
||||
<#if query_field_no gt 1> </#if></a-form-item> |
||||
<#if query_field_no gt 1> </#if></a-col> |
||||
<#else> |
||||
<#if query_field_no gt 1> </#if><a-col :md="12" :sm="16"> |
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}"> |
||||
<#if po.classType=='date'> |
||||
<#assign query_field_date=true> |
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date> |
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span> |
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date> |
||||
<#elseif po.classType=='datetime'> |
||||
<#assign query_field_date=true> |
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date> |
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span> |
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date> |
||||
<#else> |
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input> |
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span> |
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input> |
||||
</#if> |
||||
<#if query_field_no gt 1> </#if></a-form-item> |
||||
<#if query_field_no gt 1> </#if></a-col> |
||||
</#if> |
||||
<#assign query_field_no=query_field_no+1> |
||||
</#if> |
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1> |
||||
<#assign list_need_dict=true> |
||||
</#if> |
||||
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0> |
||||
<#assign list_need_category=true> |
||||
<#assign list_need_dict=true> |
||||
</#if> |
||||
</#list> |
||||
<#-- 结束循环 --> |
||||
<#t> |
||||
<#if query_field_no gt 2> |
||||
</template> |
||||
</#if> |
||||
<#if query_flag> |
||||
<a-col :md="6" :sm="8"> |
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button> |
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> |
||||
<a @click="handleToggleSearch" style="margin-left: 8px"> |
||||
{{ toggleSearchStatus ? '收起' : '展开' }} |
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> |
||||
</a> |
||||
</span> |
||||
</a-col> |
||||
</#if> |
||||
|
||||
</a-row> |
||||
</a-form> |
||||
</div> |
||||
<!-- 查询区域-END --> |
||||
|
||||
<!-- 操作按钮区域 --> |
||||
<div class="table-operator"> |
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> |
||||
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button> |
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
||||
<a-button type="primary" icon="import">导入</a-button> |
||||
</a-upload> |
||||
</div> |
||||
|
||||
<!-- table区域-begin --> |
||||
<div> |
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 |
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> |
||||
</div> |
||||
|
||||
<a-table |
||||
ref="table" |
||||
size="middle" |
||||
bordered |
||||
rowKey="id" |
||||
:columns="columns" |
||||
:dataSource="dataSource" |
||||
:pagination="ipagination" |
||||
:loading="loading" |
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" |
||||
:customRow="clickThenSelect" |
||||
@change="handleTableChange"> |
||||
|
||||
<template slot="htmlSlot" slot-scope="text"> |
||||
<div v-html="text"></div> |
||||
</template> |
||||
<template slot="imgSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span> |
||||
<img v-else :src="getImgView(text)" height="25px" alt="图片不存在" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
||||
</template> |
||||
<template slot="fileSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span> |
||||
<a-button |
||||
v-else |
||||
:ghost="true" |
||||
type="primary" |
||||
icon="download" |
||||
size="small" |
||||
@click="uploadFile(text)"> |
||||
下载 |
||||
</a-button> |
||||
</template> |
||||
|
||||
<span slot="action" slot-scope="text, record"> |
||||
<a @click="handleEdit(record)">编辑</a> |
||||
|
||||
<a-divider type="vertical" /> |
||||
<a-dropdown> |
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</a-menu-item> |
||||
</a-menu> |
||||
</a-dropdown> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<a-tabs defaultActiveKey="1"> |
||||
<#assign sub_seq=1> |
||||
<#list subTables as sub> |
||||
<a-tab-pane tab="${sub.ftlDescription}" key="${sub_seq}" <#if sub_seq gt 1>forceRender</#if>> |
||||
<${sub.tableName?replace("_","-")}-list :mainId="selectedMainId" /> |
||||
</a-tab-pane> |
||||
<#assign sub_seq=sub_seq+1> |
||||
</#list> |
||||
</a-tabs> |
||||
|
||||
<${entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk"></${entityName?uncap_first}-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import ${entityName}Modal from './modules/${entityName}Modal' |
||||
import { getAction } from '@/api/manage' |
||||
<#list subTables as sub> |
||||
import ${sub.entityName}List from './${sub.entityName}List' |
||||
</#list> |
||||
<#if query_field_select> |
||||
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue' |
||||
</#if> |
||||
<#if query_field_date> |
||||
import JDate from '@/components/jeecg/JDate.vue' |
||||
</#if> |
||||
<#if list_need_dict> |
||||
import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
||||
</#if> |
||||
<#if list_need_category> |
||||
import { loadCategoryData } from '@/api/api' |
||||
</#if> |
||||
|
||||
export default { |
||||
name: "${entityName}List", |
||||
mixins:[JeecgListMixin], |
||||
components: { |
||||
<#if query_field_select> |
||||
JDictSelectTag, |
||||
</#if> |
||||
<#if query_field_date> |
||||
JDate, |
||||
</#if> |
||||
<#list subTables as sub> |
||||
${sub.entityName}List, |
||||
</#list> |
||||
${entityName}Modal |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '${tableVo.ftlDescription}管理页面', |
||||
// 表头 |
||||
columns: [ |
||||
<#assign showColNum=0> |
||||
<#list columns as po> |
||||
<#if po.isShowList =='Y'> |
||||
<#assign showColNum=showColNum+1> |
||||
{ |
||||
title:'${po.filedComment}', |
||||
align:"center", |
||||
<#if po.classType=='date'> |
||||
dataIndex: '${po.fieldName}', |
||||
customRender:function (text) { |
||||
return !text?"":(text.length>10?text.substr(0,10):text) |
||||
} |
||||
<#elseif po.fieldDbType=='Blob'> |
||||
dataIndex: '${po.fieldName}String' |
||||
<#elseif po.classType=='umeditor'> |
||||
dataIndex: '${po.fieldName}', |
||||
scopedSlots: {customRender: 'htmlSlot'} |
||||
<#elseif po.classType=='file'> |
||||
dataIndex: '${po.fieldName}', |
||||
scopedSlots: {customRender: 'fileSlot'} |
||||
<#elseif po.classType=='image'> |
||||
dataIndex: '${po.fieldName}', |
||||
scopedSlots: {customRender: 'imgSlot'} |
||||
<#elseif po.classType=='sel_search' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart'> |
||||
dataIndex: '${po.fieldName}', |
||||
customRender:(text)=>{ |
||||
if(!text){ |
||||
return '' |
||||
}else{ |
||||
return filterMultiDictText(this.dictOptions['${po.fieldName}'], text+"") |
||||
} |
||||
} |
||||
<#elseif po.classType=='cat_tree'> |
||||
<#if list_need_category> |
||||
dataIndex: '${po.fieldName}', |
||||
customRender:(text)=>{ |
||||
if(!text){ |
||||
return '' |
||||
}else{ |
||||
return filterMultiDictText(this.dictOptions['${po.fieldName}'], text+"") |
||||
} |
||||
} |
||||
<#else> |
||||
dataIndex: '${po.fieldName}', |
||||
customRender:(text,record)=>{ |
||||
if(!text){ |
||||
return '' |
||||
}else{ |
||||
return record['${po.dictText}'] |
||||
} |
||||
} |
||||
</#if> |
||||
<#else> |
||||
dataIndex: '${po.fieldName}' |
||||
</#if> |
||||
}, |
||||
</#if> |
||||
</#list> |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
scopedSlots: { customRender: 'action' }, |
||||
} |
||||
], |
||||
url: { |
||||
list: "/${entityPackage}/${entityName?uncap_first}/list", |
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete", |
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch", |
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls", |
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel", |
||||
}, |
||||
dictOptions:{ |
||||
<#list columns as po> |
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y')> |
||||
<#if po.classType='sel_depart' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'> |
||||
${po.fieldName}:[], |
||||
</#if> |
||||
</#if> |
||||
</#list> |
||||
}, |
||||
/* 分页参数 */ |
||||
ipagination:{ |
||||
current: 1, |
||||
pageSize: 5, |
||||
pageSizeOptions: ['5', '10', '50'], |
||||
showTotal: (total, range) => { |
||||
return range[0] + "-" + range[1] + " 共" + total + "条" |
||||
}, |
||||
showQuickJumper: true, |
||||
showSizeChanger: true, |
||||
total: 0 |
||||
}, |
||||
selectedMainId:'' |
||||
|
||||
} |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse> |
||||
} |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
<#list columns as po> |
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'> |
||||
<#if po.classType='sel_depart'> |
||||
initDictOptions('sys_depart,depart_name,id').then((res) => { |
||||
if (res.success) { |
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result) |
||||
} |
||||
}) |
||||
<#elseif po.classType=='cat_tree' && list_need_category==true> |
||||
loadCategoryData({code:"${po.dictField}"}).then((res) => { |
||||
if (res.success) { |
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result) |
||||
} |
||||
}) |
||||
<#elseif po.classType=='sel_search' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'> |
||||
<#assign list_field_dictCode=""> |
||||
<#if po.dictTable?default("")?trim?length gt 1> |
||||
<#assign list_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}"> |
||||
<#elseif po.dictField?default("")?trim?length gt 1> |
||||
<#assign list_field_dictCode="${po.dictField}"> |
||||
</#if> |
||||
initDictOptions('${list_field_dictCode}').then((res) => { |
||||
if (res.success) { |
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result) |
||||
} |
||||
}) |
||||
</#if> |
||||
</#if> |
||||
</#list> |
||||
}, |
||||
clickThenSelect(record) { |
||||
return { |
||||
on: { |
||||
click: () => { |
||||
this.onSelectChange(record.id.split(","), [record]); |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
onClearSelected() { |
||||
this.selectedRowKeys = []; |
||||
this.selectionRows = []; |
||||
this.selectedMainId='' |
||||
}, |
||||
onSelectChange(selectedRowKeys, selectionRows) { |
||||
this.selectedMainId=selectedRowKeys[0] |
||||
this.selectedRowKeys = selectedRowKeys; |
||||
this.selectionRows = selectionRows; |
||||
}, |
||||
loadData(arg) { |
||||
if(!this.url.list){ |
||||
this.$message.error("请设置url.list属性!") |
||||
return |
||||
} |
||||
//加载数据 若传入参数1则加载第一页的内容 |
||||
if (arg === 1) { |
||||
this.ipagination.current = 1; |
||||
} |
||||
this.onClearSelected() |
||||
var params = this.getQueryParams();//查询条件 |
||||
this.loading = true; |
||||
getAction(this.url.list, params).then((res) => { |
||||
if (res.success) { |
||||
this.dataSource = res.result.records; |
||||
this.ipagination.total = res.result.total; |
||||
} |
||||
if(res.code===510){ |
||||
this.$message.warning(res.message) |
||||
} |
||||
this.loading = false; |
||||
}) |
||||
} |
||||
|
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less' |
||||
</style> |
@ -0,0 +1,187 @@
|
||||
<#list subTables as sub> |
||||
#segment#${sub.entityName}List.vue |
||||
<template> |
||||
<a-card :bordered="false" :class="'cust-erp-sub-tab'"> |
||||
<!-- 操作按钮区域 --> |
||||
<div class="table-operator"> |
||||
<a-button v-if="mainId" @click="handleAdd" type="primary" icon="plus">新增</a-button> |
||||
<a-dropdown v-if="selectedRowKeys.length > 0"> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> |
||||
</a-menu> |
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> |
||||
</a-dropdown> |
||||
</div> |
||||
|
||||
<!-- table区域-begin --> |
||||
<div> |
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 |
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> |
||||
</div> |
||||
|
||||
<a-table |
||||
ref="table" |
||||
size="middle" |
||||
bordered |
||||
rowKey="id" |
||||
:columns="columns" |
||||
:dataSource="dataSource" |
||||
:pagination="ipagination" |
||||
:loading="loading" |
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
||||
@change="handleTableChange"> |
||||
|
||||
<template slot="htmlSlot" slot-scope="text"> |
||||
<div v-html="text"></div> |
||||
</template> |
||||
<template slot="imgSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span> |
||||
<img v-else :src="getImgView(text)" height="25px" alt="图片不存在" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
||||
</template> |
||||
<template slot="fileSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span> |
||||
<a-button |
||||
v-else |
||||
:ghost="true" |
||||
type="primary" |
||||
icon="download" |
||||
size="small" |
||||
@click="uploadFile(text)"> |
||||
下载 |
||||
</a-button> |
||||
</template> |
||||
|
||||
<span slot="action" slot-scope="text, record"> |
||||
<a @click="handleEdit(record)">编辑</a> |
||||
<a-divider type="vertical" /> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<${sub.entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></${sub.entityName?uncap_first}-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import ${sub.entityName}Modal from './modules/${sub.entityName}Modal' |
||||
|
||||
|
||||
|
||||
export default { |
||||
name: "${sub.entityName}List", |
||||
mixins:[JeecgListMixin], |
||||
components: { ${sub.entityName}Modal }, |
||||
props:{ |
||||
mainId:{ |
||||
type:String, |
||||
default:'', |
||||
required:false |
||||
} |
||||
}, |
||||
watch:{ |
||||
mainId:{ |
||||
immediate: true, |
||||
handler(val) { |
||||
if(!this.mainId){ |
||||
this.clearList() |
||||
}else{ |
||||
<#list sub.foreignKeys as key> |
||||
this.queryParam['${key?uncap_first}'] = val |
||||
</#list> |
||||
this.loadData(1); |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '${tableVo.ftlDescription}管理页面', |
||||
disableMixinCreated:true, |
||||
// 表头 |
||||
columns: [ |
||||
{ |
||||
title: '#', |
||||
dataIndex: '', |
||||
key:'rowIndex', |
||||
width:60, |
||||
align:"center", |
||||
customRender:function (t,r,index) { |
||||
return parseInt(index)+1; |
||||
} |
||||
}, |
||||
<#assign showColNum=0> |
||||
<#list sub.originalColumns as po> |
||||
<#if po.isShowList =='Y'> |
||||
<#assign showColNum=showColNum+1> |
||||
{ |
||||
title:'${po.filedComment}', |
||||
align:"center", |
||||
<#if po.classType=='date'> |
||||
dataIndex: '${po.fieldName}', |
||||
customRender:function (text) { |
||||
return !text?"":(text.length>10?text.substr(0,10):text) |
||||
} |
||||
<#elseif po.fieldDbType=='Blob'> |
||||
dataIndex: '${po.fieldName}String' |
||||
<#elseif po.classType=='umeditor'> |
||||
dataIndex: '${po.fieldName}', |
||||
scopedSlots: {customRender: 'htmlSlot'} |
||||
<#elseif po.classType=='file'> |
||||
dataIndex: '${po.fieldName}', |
||||
scopedSlots: {customRender: 'fileSlot'} |
||||
<#elseif po.classType=='image'> |
||||
dataIndex: '${po.fieldName}', |
||||
scopedSlots: {customRender: 'imgSlot'} |
||||
<#elseif po.classType =='list' || po.classType =='radio' || po.classType =='list_multi' || po.classType =='checkbox' || po.classType =='sel_search' || po.classType =='cat_tree' || po.classType =='sel_depart'> |
||||
dataIndex: '${po.fieldName}_dictText', |
||||
<#else> |
||||
dataIndex: '${po.fieldName}' |
||||
</#if> |
||||
}, |
||||
</#if> |
||||
</#list> |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
scopedSlots: { customRender: 'action' }, |
||||
} |
||||
], |
||||
url: { |
||||
list: "/${entityPackage}/${entityName?uncap_first}/list${sub.entityName}ByMainId", |
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete${sub.entityName}", |
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch${sub.entityName}" |
||||
}, |
||||
dictOptions:{ |
||||
<#list columns as po> |
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y')> |
||||
<#if po.classType='sel_depart' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'> |
||||
${po.fieldName}:[], |
||||
</#if> |
||||
</#if> |
||||
</#list> |
||||
}, |
||||
|
||||
} |
||||
}, |
||||
methods: { |
||||
clearList(){ |
||||
this.dataSource=[] |
||||
this.selectedRowKeys=[] |
||||
this.ipagination.current = 1 |
||||
}, |
||||
|
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less' |
||||
</style> |
||||
</#list> |
@ -0,0 +1,263 @@
|
||||
<template> |
||||
<a-modal |
||||
:title="title" |
||||
:width="width" |
||||
:visible="visible" |
||||
:confirmLoading="confirmLoading" |
||||
@ok="handleOk" |
||||
@cancel="handleCancel" |
||||
cancelText="关闭"> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<a-form :form="form"> |
||||
<#assign form_date = false> |
||||
<#assign form_select = false> |
||||
<#assign form_select_multi = false> |
||||
<#assign form_select_search = false> |
||||
<#assign form_popup = false> |
||||
<#assign form_sel_depart = false> |
||||
<#assign form_sel_user = false> |
||||
<#assign form_file = false> |
||||
<#assign form_editor = false> |
||||
<#assign form_cat_tree = false> |
||||
<#assign form_cat_back = ""> |
||||
|
||||
<#list columns as po> |
||||
<#if po.isShow =='Y'> |
||||
<#assign form_field_dictCode=""> |
||||
<#if po.dictTable?default("")?trim?length gt 1> |
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}"> |
||||
<#elseif po.dictField?default("")?trim?length gt 1> |
||||
<#assign form_field_dictCode="${po.dictField}"> |
||||
</#if> |
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
||||
<#if po.classType =='date'> |
||||
<#assign form_date=true> |
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" style="width: 100%"/> |
||||
<#elseif po.classType =='datetime'> |
||||
<#assign form_date=true> |
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/> |
||||
<#elseif po.classType =='popup'> |
||||
<#assign form_popup=true> |
||||
<j-popup |
||||
v-decorator="['${po.fieldName}']" |
||||
:trigger-change="true" |
||||
org-fields="${po.dictField}" |
||||
dest-fields="${po.dictText}" |
||||
code="${po.dictTable}" |
||||
@callback="popupCallback"/> |
||||
<#elseif po.classType =='sel_depart'> |
||||
<#assign form_sel_depart=true> |
||||
<j-select-depart v-decorator="['${po.fieldName}']" :trigger-change="true"/> |
||||
<#elseif po.classType =='sel_user'> |
||||
<#assign form_sel_user = true> |
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}']" :trigger-change="true"/> |
||||
<#elseif po.classType =='textarea'> |
||||
<a-textarea v-decorator="['${po.fieldName}']" rows="4" placeholder="请输入${po.filedComment}"/> |
||||
<#elseif po.classType=='list' || po.classType=='radio'> |
||||
<#assign form_select = true> |
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/> |
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'> |
||||
<#assign form_select_multi = true> |
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/> |
||||
<#elseif po.classType=='sel_search'> |
||||
<#assign form_select_search = true> |
||||
<j-search-select-tag v-decorator="['${po.fieldName}']" dict="${form_field_dictCode}" /> |
||||
<#elseif po.classType=='cat_tree'> |
||||
<#assign form_cat_tree = true> |
||||
<j-category-select v-decorator="['${po.fieldName}']" <#if po.dictField?default("")?trim?length gt 1>pcode="${po.dictField}"<#else>pcode="0"</#if> placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/> |
||||
<#if po.dictText?default("")?trim?length gt 1> |
||||
<#assign form_cat_back = "${po.dictText}"> |
||||
</#if> |
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'> |
||||
<a-input-number v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}" style="width: 100%"/> |
||||
<#elseif po.classType=='file' || po.classType=='image'> |
||||
<#assign form_file = true> |
||||
<j-upload v-decorator="['${po.fieldName}']" :trigger-change="true"></j-upload> |
||||
<#elseif po.classType=='umeditor'> |
||||
<#assign form_editor = true> |
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/> |
||||
<#elseif po.fieldDbType=='Blob'> |
||||
<a-input v-decorator="[ '${po.fieldName}String', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input> |
||||
<#else> |
||||
<a-input v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input> |
||||
</#if> |
||||
</a-form-item> |
||||
</#if> |
||||
</#list> |
||||
<#if form_cat_tree && form_cat_back?length gt 1> |
||||
<a-form-item v-show="false"> |
||||
<a-input v-decorator="[ '${form_cat_back}']"></a-input> |
||||
</a-form-item> |
||||
</#if> |
||||
|
||||
</a-form> |
||||
</a-spin> |
||||
</a-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { httpAction } from '@/api/manage' |
||||
import pick from 'lodash.pick' |
||||
<#if form_date> |
||||
import JDate from '@/components/jeecg/JDate' |
||||
</#if> |
||||
<#if form_file> |
||||
import JUpload from '@/components/jeecg/JUpload' |
||||
</#if> |
||||
<#if form_sel_depart> |
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart' |
||||
</#if> |
||||
<#if form_sel_user> |
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep' |
||||
</#if> |
||||
<#if form_select> |
||||
import JDictSelectTag from "@/components/dict/JDictSelectTag" |
||||
</#if> |
||||
<#if form_select_multi> |
||||
import JMultiSelectTag from "@/components/dict/JMultiSelectTag" |
||||
</#if> |
||||
<#if form_select_search> |
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag' |
||||
</#if> |
||||
<#if form_editor> |
||||
import JEditor from '@/components/jeecg/JEditor' |
||||
</#if> |
||||
<#if form_cat_tree> |
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect' |
||||
</#if> |
||||
|
||||
export default { |
||||
name: "${entityName}Modal", |
||||
components: { |
||||
<#if form_date> |
||||
JDate, |
||||
</#if> |
||||
<#if form_file> |
||||
JUpload, |
||||
</#if> |
||||
<#if form_sel_depart> |
||||
JSelectDepart, |
||||
</#if> |
||||
<#if form_sel_user> |
||||
JSelectUserByDep, |
||||
</#if> |
||||
<#if form_select> |
||||
JDictSelectTag, |
||||
</#if> |
||||
<#if form_select_multi> |
||||
JMultiSelectTag, |
||||
</#if> |
||||
<#if form_select_search> |
||||
JSearchSelectTag, |
||||
</#if> |
||||
<#if form_editor> |
||||
JEditor, |
||||
</#if> |
||||
<#if form_cat_tree> |
||||
JCategorySelect |
||||
</#if> |
||||
}, |
||||
data () { |
||||
return { |
||||
form: this.$form.createForm(this), |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
model: {}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
|
||||
confirmLoading: false, |
||||
validatorRules:{ |
||||
<#list columns as po> |
||||
<#if po.isShow =='Y'> |
||||
<#if po.fieldName !='id'> |
||||
<#if po.nullable =='N'> |
||||
${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]}, |
||||
<#else> |
||||
${po.fieldName}:{}, |
||||
</#if> |
||||
</#if> |
||||
</#if> |
||||
</#list> |
||||
}, |
||||
url: { |
||||
add: "/${entityPackage}/${entityName?uncap_first}/add", |
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit", |
||||
} |
||||
|
||||
} |
||||
}, |
||||
created () { |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.edit({}); |
||||
}, |
||||
edit (record) { |
||||
this.form.resetFields(); |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
this.$nextTick(() => { |
||||
this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>)) |
||||
}) |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
const that = this; |
||||
// 触发表单验证 |
||||
this.form.validateFields((err, values) => { |
||||
if (!err) { |
||||
that.confirmLoading = true; |
||||
let httpurl = ''; |
||||
let method = ''; |
||||
if(!this.model.id){ |
||||
httpurl+=this.url.add; |
||||
method = 'post'; |
||||
}else{ |
||||
httpurl+=this.url.edit; |
||||
method = 'put'; |
||||
} |
||||
let formData = Object.assign(this.model, values); |
||||
console.log("表单提交数据",formData) |
||||
httpAction(httpurl,formData,method).then((res)=>{ |
||||
if(res.success){ |
||||
that.$message.success(res.message); |
||||
that.$emit('ok'); |
||||
}else{ |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
that.close(); |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
}, |
||||
popupCallback(row){ |
||||
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>)) |
||||
}, |
||||
<#if form_cat_tree> |
||||
handleCategoryChange(value,backObj){ |
||||
this.form.setFieldsValue(backObj) |
||||
} |
||||
</#if> |
||||
|
||||
|
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,276 @@
|
||||
<#list subTables as sub> |
||||
#segment#${sub.entityName}Modal.vue |
||||
<template> |
||||
<a-modal |
||||
:title="title" |
||||
:width="width" |
||||
:visible="visible" |
||||
:confirmLoading="confirmLoading" |
||||
@ok="handleOk" |
||||
@cancel="handleCancel" |
||||
cancelText="关闭"> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<a-form :form="form"> |
||||
<#assign form_date = false> |
||||
<#assign form_select = false> |
||||
<#assign form_select_multi = false> |
||||
<#assign form_select_search = false> |
||||
<#assign form_popup = false> |
||||
<#assign form_sel_depart = false> |
||||
<#assign form_sel_user = false> |
||||
<#assign form_file = false> |
||||
<#assign form_editor = false> |
||||
<#assign form_cat_tree = false> |
||||
<#assign form_cat_back = ""> |
||||
|
||||
<#list sub.originalColumns as po> |
||||
<#if po.isShow =='Y'> |
||||
<#assign form_field_dictCode=""> |
||||
<#if po.dictTable?default("")?trim?length gt 1> |
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}"> |
||||
<#elseif po.dictField?default("")?trim?length gt 1> |
||||
<#assign form_field_dictCode="${po.dictField}"> |
||||
</#if> |
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
||||
<#if po.classType =='date'> |
||||
<#assign form_date=true> |
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" style="width: 100%"/> |
||||
<#elseif po.classType =='datetime'> |
||||
<#assign form_date=true> |
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/> |
||||
<#elseif po.classType =='popup'> |
||||
<#assign form_popup=true> |
||||
<j-popup |
||||
v-decorator="['${po.fieldName}']" |
||||
:trigger-change="true" |
||||
org-fields="${po.dictField}" |
||||
dest-fields="${po.dictText}" |
||||
code="${po.dictTable}" |
||||
@callback="popupCallback"/> |
||||
<#elseif po.classType =='sel_depart'> |
||||
<#assign form_sel_depart=true> |
||||
<j-select-depart v-decorator="['${po.fieldName}']" :trigger-change="true"/> |
||||
<#elseif po.classType =='sel_user'> |
||||
<#assign form_sel_user = true> |
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}']" :trigger-change="true"/> |
||||
<#elseif po.classType =='textarea'> |
||||
<a-textarea v-decorator="['${po.fieldName}']" rows="4" placeholder="请输入${po.filedComment}"/> |
||||
<#elseif po.classType=='list' || po.classType=='radio'> |
||||
<#assign form_select = true> |
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/> |
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'> |
||||
<#assign form_select_multi = true> |
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/> |
||||
<#elseif po.classType=='sel_search'> |
||||
<#assign form_select_search = true> |
||||
<j-search-select-tag v-decorator="['${po.fieldName}']" dict="${form_field_dictCode}" /> |
||||
<#elseif po.classType=='cat_tree'> |
||||
<#assign form_cat_tree = true> |
||||
<j-category-select v-decorator="['${po.fieldName}']" <#if po.dictField?default("")?trim?length gt 1>pcode="${po.dictField}"<#else>pcode="0"</#if> placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/> |
||||
<#if po.dictText?default("")?trim?length gt 1> |
||||
<#assign form_cat_back = "${po.dictText}"> |
||||
</#if> |
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'> |
||||
<a-input-number v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}" style="width: 100%"/> |
||||
<#elseif po.classType=='file' || po.classType=='image'> |
||||
<#assign form_file = true> |
||||
<j-upload v-decorator="['${po.fieldName}']" :trigger-change="true"></j-upload> |
||||
<#elseif po.classType=='umeditor'> |
||||
<#assign form_editor = true> |
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/> |
||||
<#elseif po.fieldDbType=='Blob'> |
||||
<a-input v-decorator="[ '${po.fieldName}String', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input> |
||||
<#else> |
||||
<a-input v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input> |
||||
</#if> |
||||
</a-form-item> |
||||
</#if> |
||||
</#list> |
||||
<#if form_cat_tree && form_cat_back?length gt 1> |
||||
<a-form-item v-show="false"> |
||||
<a-input v-decorator="[ '${form_cat_back}']"></a-input> |
||||
</a-form-item> |
||||
</#if> |
||||
|
||||
</a-form> |
||||
</a-spin> |
||||
</a-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { httpAction } from '@/api/manage' |
||||
import pick from 'lodash.pick' |
||||
<#if form_date> |
||||
import JDate from '@/components/jeecg/JDate' |
||||
</#if> |
||||
<#if form_file> |
||||
import JUpload from '@/components/jeecg/JUpload' |
||||
</#if> |
||||
<#if form_sel_depart> |
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart' |
||||
</#if> |
||||
<#if form_sel_user> |
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep' |
||||
</#if> |
||||
<#if form_select> |
||||
import JDictSelectTag from "@/components/dict/JDictSelectTag" |
||||
</#if> |
||||
<#if form_select_multi> |
||||
import JMultiSelectTag from "@/components/dict/JMultiSelectTag" |
||||
</#if> |
||||
<#if form_select_search> |
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag' |
||||
</#if> |
||||
<#if form_editor> |
||||
import JEditor from '@/components/jeecg/JEditor' |
||||
</#if> |
||||
<#if form_cat_tree> |
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect' |
||||
</#if> |
||||
|
||||
export default { |
||||
name: "${sub.entityName}Modal", |
||||
components: { |
||||
<#if form_date> |
||||
JDate, |
||||
</#if> |
||||
<#if form_file> |
||||
JUpload, |
||||
</#if> |
||||
<#if form_sel_depart> |
||||
JSelectDepart, |
||||
</#if> |
||||
<#if form_sel_user> |
||||
JSelectUserByDep, |
||||
</#if> |
||||
<#if form_select> |
||||
JDictSelectTag, |
||||
</#if> |
||||
<#if form_select_multi> |
||||
JMultiSelectTag, |
||||
</#if> |
||||
<#if form_select_search> |
||||
JSearchSelectTag, |
||||
</#if> |
||||
<#if form_editor> |
||||
JEditor, |
||||
</#if> |
||||
<#if form_cat_tree> |
||||
JCategorySelect |
||||
</#if> |
||||
}, |
||||
props:{ |
||||
mainId:{ |
||||
type:String, |
||||
required:false, |
||||
default:'' |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
form: this.$form.createForm(this), |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
model: {}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
|
||||
confirmLoading: false, |
||||
validatorRules:{ |
||||
<#list sub.originalColumns as po> |
||||
<#if po.isShow =='Y'> |
||||
<#if po.fieldName !='id'> |
||||
<#if po.nullable =='N'> |
||||
${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]}, |
||||
<#else> |
||||
${po.fieldName}:{}, |
||||
</#if> |
||||
</#if> |
||||
</#if> |
||||
</#list> |
||||
}, |
||||
url: { |
||||
add: "/${entityPackage}/${entityName?uncap_first}/add${sub.entityName}", |
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit${sub.entityName}", |
||||
} |
||||
|
||||
} |
||||
}, |
||||
created () { |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.edit({}); |
||||
}, |
||||
edit (record) { |
||||
this.form.resetFields(); |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
this.$nextTick(() => { |
||||
this.form.setFieldsValue(pick(this.model<#list sub.originalColumns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>)) |
||||
}) |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
const that = this; |
||||
// 触发表单验证 |
||||
this.form.validateFields((err, values) => { |
||||
if (!err) { |
||||
that.confirmLoading = true; |
||||
let httpurl = ''; |
||||
let method = ''; |
||||
if(!this.model.id){ |
||||
httpurl+=this.url.add; |
||||
method = 'post'; |
||||
}else{ |
||||
httpurl+=this.url.edit; |
||||
method = 'put'; |
||||
} |
||||
let formData = Object.assign(this.model, values); |
||||
<#list sub.foreignKeys as key> |
||||
formData['${key?uncap_first}'] = this.mainId |
||||
</#list> |
||||
console.log("表单提交数据",formData) |
||||
httpAction(httpurl,formData,method).then((res)=>{ |
||||
if(res.success){ |
||||
that.$message.success(res.message); |
||||
that.$emit('ok'); |
||||
}else{ |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
that.close(); |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
}, |
||||
popupCallback(row){ |
||||
this.form.setFieldsValue(pick(row<#list sub.originalColumns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>)) |
||||
}, |
||||
<#if form_cat_tree> |
||||
handleCategoryChange(value,backObj){ |
||||
this.form.setFieldsValue(backObj) |
||||
} |
||||
</#if> |
||||
|
||||
|
||||
} |
||||
} |
||||
</script> |
||||
</#list> |
@ -0,0 +1,55 @@
|
||||
validatorRules: { |
||||
<#list columns as po> |
||||
<#if po.isShow == 'Y'> |
||||
<#if po.fieldName != 'id'> |
||||
${po.fieldName}: {rules: [ |
||||
<#assign fieldValidType = po.fieldValidType!''> |
||||
<#-- 非空校验 --> |
||||
<#if po.nullable == 'N' || fieldValidType == '*'> |
||||
{required: true, message: '请输入${po.filedComment}!'}, |
||||
</#if> |
||||
<#-- 唯一校验 --> |
||||
<#if fieldValidType == 'only'> |
||||
{ validator: (rule, value, callback) => validateDuplicateValue('${tableName}', '${po.fieldDbName}', value, this.model.id, callback)}, |
||||
<#-- 6到16位数字 --> |
||||
<#elseif fieldValidType == 'n6-16'> |
||||
{pattern:/\d{6,18}/, message: '请输入6到16位数字!'}, |
||||
<#-- 6到16位任意字符 --> |
||||
<#elseif fieldValidType == '*6-16'> |
||||
{pattern:/^.{6,16}$/, message: '请输入6到16位任意字符!'}, |
||||
<#-- 6到18位字符串 --> |
||||
<#elseif fieldValidType == 's6-18'> |
||||
{pattern:/^.{6,18}$/, message: '请输入6到18位任意字符!'}, |
||||
<#-- 网址 --> |
||||
<#elseif fieldValidType == 'url'> |
||||
{pattern:/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/, message: '请输入正确的网址!'}, |
||||
<#-- 电子邮件 --> |
||||
<#elseif fieldValidType == 'e'> |
||||
{pattern:/^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'}, |
||||
<#-- 手机号码 --> |
||||
<#elseif fieldValidType == 'm'> |
||||
{pattern:/^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, |
||||
<#-- 邮政编码 --> |
||||
<#elseif fieldValidType == 'p'> |
||||
{pattern:/^[1-9]\d{5}$/, message: '请输入正确的邮政编码!'}, |
||||
<#-- 字母 --> |
||||
<#elseif fieldValidType == 's'> |
||||
{pattern:/^[A-Z|a-z]+$/, message: '请输入字母!'}, |
||||
<#-- 数字 --> |
||||
<#elseif fieldValidType == 'n'> |
||||
{pattern:/^-?\d+\.?\d*$/, message: '请输入数字!'}, |
||||
<#-- 整数 --> |
||||
<#elseif fieldValidType == 'z'> |
||||
{pattern:/^-?\d+$/, message: '请输入整数!'}, |
||||
<#-- 金额 --> |
||||
<#elseif fieldValidType == 'money'> |
||||
{pattern:/^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'}, |
||||
<#-- 无校验 --> |
||||
<#else> |
||||
<#t> |
||||
</#if> |
||||
]}, |
||||
</#if> |
||||
</#if> |
||||
</#list> |
||||
}, |
@ -0,0 +1,66 @@
|
||||
body,html{width:100%;height:100%;margin:0px;padding:0px;font-size:12px;color:#555;background-color:#000;font-family:'微软雅黑'} |
||||
#main{width:4352px;height:1536px;display:inline-block; background:url(../images/screenbg_design1.jpg) left top no-repeat} |
||||
|
||||
/*年月日文字*/ |
||||
#currentYear{width:213px;height:107px;position:absolute;left:430px;top:100px;color:#FFF;font-size:36px; font-family:'微软雅黑';text-align:center} |
||||
#currentMonth{width:213px;height:107px;position:absolute;left:1504px;top:75px;color:#FFF;font-size:36px; font-family:'微软雅黑';text-align:center} |
||||
#currentDay{width:213px;height:107px;position:absolute;left:2574px;top:100px;color:#FFF;font-size:36px; font-family:'微软雅黑';text-align:center} |
||||
|
||||
/*年的进度条*/ |
||||
#y_gauge1{width:250px;height:250px;position:absolute;left:60px;top:200px;} |
||||
#y_gauge2{width:250px;height:250px;position:absolute;left:290px;top:200px;} |
||||
#y_gauge3{width:250px;height:250px;position:absolute;left:530px;top:200px;} |
||||
#y_gauge4{width:250px;height:250px;position:absolute;left:770px;top:200px;} |
||||
|
||||
/*月的进度条*/ |
||||
#m_gauge1{width:250px;height:250px;position:absolute;left:1140px;top:130px;} |
||||
#m_gauge2{width:250px;height:250px;position:absolute;left:1370px;top:130px;} |
||||
#m_gauge3{width:250px;height:250px;position:absolute;left:1610px;top:130px;} |
||||
#m_gauge4{width:250px;height:250px;position:absolute;left:1850px;top:130px;} |
||||
|
||||
/*日的进度条*/ |
||||
#d_gauge1{width:250px;height:250px;position:absolute;left:2210px;top:200px;} |
||||
#d_gauge2{width:250px;height:250px;position:absolute;left:2440px;top:200px;} |
||||
#d_gauge3{width:250px;height:250px;position:absolute;left:2680px;top:200px;} |
||||
#d_gauge4{width:250px;height:250px;position:absolute;left:2920px;top:200px;} |
||||
|
||||
/*监控的仪表盘*/ |
||||
#gauge1{width:250px;height:250px;position:absolute;left:2200px;top:1050px;} |
||||
#gauge2{width:250px;height:250px;position:absolute;left:2550px;top:1050px;} |
||||
#gauge3{width:250px;height:250px;position:absolute;left:2910px;top:1050px;} |
||||
#gauge4{width:250px;height:250px;position:absolute;left:2380px;top:1190px;} |
||||
#gauge5{width:250px;height:250px;position:absolute;left:2730px;top:1190px;} |
||||
|
||||
/*仪表盘文字*/ |
||||
.gaugeTitle{width:250px;height:40px;position:absolute;left:0px;top:200px;color:#B7E1FF;font-size:24px;display:inline-block;text-align:center;font-family:Arial;} |
||||
|
||||
/*地图*/ |
||||
#map{width:1100px;height:800px;position:absolute;left:0px;top:620px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
|
||||
#plan{width:900px;height:420px;position:absolute;left:1170px;top:520px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
#quality{width:900px;height:420px;position:absolute;left:1170px;top:1030px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
|
||||
#orderTable{width:1000px;height:430px;position:absolute;left:2160px;top:930px;display:inline-block} |
||||
#orderTable table{width:100%;color:#666;font-size:24px} |
||||
#orderTable table td{text-align:center;} |
||||
#orderTable table .head{height:80px;font-size:24px;color:#FFF} |
||||
#orderTable table .row2{color:#000} |
||||
#orderTable table .row1{background-color:#CCC} |
||||
|
||||
#orderMessage{width:800px;position:absolute;left:33px;top:1420px;display:inline-block;color:#E1E1E1;font-size:24px} |
||||
|
||||
/*生产情况展示表*/ |
||||
#produce{width:1000px;height:380px;position:absolute;left:2190px;top:600px;display:inline-block;color:#B7E2FF;font-size:24px;} |
||||
#produce table{width:100%;font-size:24px;} |
||||
#produce table td{text-align:center;border:1px solid #069} |
||||
#produce table .row1{} |
||||
#produce table .row2{} |
||||
|
||||
/*视频*/ |
||||
#video{width:960px;height:540px;position:absolute;left:3280px;top:140px;display:inline-block;} |
||||
|
||||
/*监控视频*/ |
||||
#Monitor{width:960px;height:540px;position:absolute;left:3280px;top:940px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
|
||||
/*刷新时间*/ |
||||
#refresh{width:800px;position:absolute;left:3350px;top:40px;display:inline-block;color:#FFF;font-size:24px;} |
@ -0,0 +1,62 @@
|
||||
body,html{width:100%;height:100%;margin:0px;padding:0px;font-size:12px;color:#555;background-color:#000;font-family:'微软雅黑'} |
||||
#main{width:4352px;height:1536px;display:inline-block; background:url(../images/war_room_main.jpg) left top no-repeat} |
||||
|
||||
/*下钻按钮*/ |
||||
.contentButton{width:218px;height:100px;position:absolute;} |
||||
.contentButton a{width:218px;height:100px;display:inline-block; background:url(../images/content_comm.png) no-repeat top left} |
||||
.contentButton a:hover{width:218px;height:100px;display:inline-block; background:url(../images/content_down.png) no-repeat top left} |
||||
.contentButton .a1{width:218px;height:100px;display:inline-block; background:url(../images/content_comm1.png) no-repeat top left} |
||||
.contentButton .a1:hover{width:218px;height:100px;display:inline-block; background:url(../images/content_down1.png) no-repeat top left} |
||||
|
||||
/*弹出窗口*/ |
||||
#popWindow{width:2200px;height:1000px;display:inline-block;position:absolute;top:240px;left:1070px;background-color:#06274A;border:1px solid #09f} |
||||
|
||||
/*年的进度条*/ |
||||
#y_gauge1{width:250px;height:250px;position:absolute;left:60px;top:200px;} |
||||
#y_gauge2{width:250px;height:250px;position:absolute;left:290px;top:200px;} |
||||
#y_gauge3{width:250px;height:250px;position:absolute;left:530px;top:200px;} |
||||
#y_gauge4{width:250px;height:250px;position:absolute;left:770px;top:200px;} |
||||
|
||||
/*螺旋DNA*/ |
||||
#orderStatus{width:1000px;height:320px;position:absolute;left:80px;top:460px;} |
||||
|
||||
/*监控的仪表盘*/ |
||||
#gauge1{width:250px;height:250px;position:absolute;left:2200px;top:280px;} |
||||
#gauge2{width:250px;height:250px;position:absolute;left:2550px;top:280px;} |
||||
#gauge3{width:250px;height:250px;position:absolute;left:2910px;top:280px;} |
||||
#gauge4{width:250px;height:250px;position:absolute;left:2380px;top:550px;} |
||||
#gauge5{width:250px;height:250px;position:absolute;left:2730px;top:550px;} |
||||
|
||||
/*仪表盘文字*/ |
||||
.gaugeTitle{width:250px;height:40px;position:absolute;left:0px;top:200px;color:#B7E1FF;font-size:24px;display:inline-block;text-align:center;font-family:Arial;} |
||||
|
||||
/*地图*/ |
||||
#map{width:1100px;height:800px;position:absolute;left:1080px;top:170px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
|
||||
#productPie{width:1000px;height:680px;position:absolute;left:2210px;top:260px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
|
||||
/*业务进展图*/ |
||||
#businessProgress{width:1000px;height:640px;position:absolute;left:3330px;top:180px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
|
||||
/*计划完成情况*/ |
||||
#plan{width:1000px;height:400px;position:absolute;left:80px;top:1020px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
/*质量指标分析*/ |
||||
#quality{width:1000px;height:400px;position:absolute;left:1170px;top:1020px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
/*舆情文字云*/ |
||||
#wordCloud{width:900px;height:420px;position:absolute;left:3330px;top:1000px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
|
||||
/*投诉情况展示表*/ |
||||
#produce{width:900px;height:380px;position:absolute;left:2250px;top:1050px;display:inline-block;color:#B7E2FF;font-size:24px;} |
||||
#produce table{width:100%;font-size:24px;} |
||||
#produce table td{text-align:center;border:1px solid #069} |
||||
#produce table .row1{} |
||||
#produce table .row2{} |
||||
|
||||
/*视频*/ |
||||
#video{width:960px;height:540px;position:absolute;left:3280px;top:140px;display:inline-block;} |
||||
|
||||
/*监控视频*/ |
||||
#Monitor{width:960px;height:540px;position:absolute;left:3280px;top:940px;display:inline-block;color:#E1E1E1;font-size:24px;} |
||||
|
||||
/*刷新时间*/ |
||||
#refresh{width:800px;position:absolute;left:3350px;top:40px;display:inline-block;color:#FFF;font-size:24px;} |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 622 KiB |
After Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 244 KiB |
After Width: | Height: | Size: 247 KiB |
@ -0,0 +1,836 @@
|
||||
//计划完成表的当前所选
|
||||
var indexnum = 0; |
||||
var color=['#F35331','#2499F8','#3DF098','#33B734']; |
||||
var fontColor='#FFF'; |
||||
|
||||
//定义进度条组件和属性
|
||||
var y_gauge1 =null; |
||||
var y_gauge2 =null; |
||||
var y_gauge3 =null; |
||||
var y_gauge4 =null; |
||||
var m_gauge1 =null; |
||||
var m_gauge2 =null; |
||||
var m_gauge3 =null; |
||||
var m_gauge4 =null; |
||||
var d_gauge1 =null; |
||||
var d_gauge2 =null; |
||||
var d_gauge3 =null; |
||||
var d_gauge4 =null; |
||||
var option_Progress =null; |
||||
|
||||
//定义仪表盘组件和属性
|
||||
var gauge1 =null; |
||||
var gauge2 =null; |
||||
var gauge3 =null; |
||||
var gauge4 =null; |
||||
var gauge5 =null; |
||||
var option_gauge =null; |
||||
|
||||
//生产质量堆积图组件和属性
|
||||
var quality_chart = null; |
||||
var quality_option=null; |
||||
|
||||
//生产计划折线图组件和属性
|
||||
var plan_chart = null; |
||||
var plan_option=null; |
||||
|
||||
//环形图的风格定义
|
||||
var dataStyle = { |
||||
normal: { |
||||
label: {show:false}, |
||||
labelLine: {show:false} |
||||
} |
||||
}; |
||||
var placeHolderStyle = { |
||||
normal : { |
||||
color: 'rgba(0,0,0,0.1)', |
||||
label: {show:false}, |
||||
labelLine: {show:false} |
||||
}, |
||||
emphasis : { |
||||
color: 'rgba(0,0,0,0)' |
||||
} |
||||
}; |
||||
|
||||
//最大订单号
|
||||
var lastOrderNumber=1; |
||||
|
||||
$(document).ready(function () |
||||
{ |
||||
//环形进度条设置对象
|
||||
option_Progress={ |
||||
title : { |
||||
text: '目前进度', |
||||
subtext: '50%', |
||||
x: 'center', |
||||
y: 90, |
||||
itemGap: 10, |
||||
textStyle : { |
||||
color : '#B7E1FF', |
||||
fontWeight: 'normal', |
||||
fontFamily : '微软雅黑', |
||||
fontSize : 24 |
||||
}, |
||||
subtextStyle:{ |
||||
color: '#B7E1FF', |
||||
fontWeight: 'bolder', |
||||
fontSize:24, |
||||
fontFamily : '微软雅黑' |
||||
} |
||||
}, |
||||
series : [{ |
||||
type : 'pie', |
||||
center : ['50%', '50%'], |
||||
radius : [75,90], |
||||
x: '0%', |
||||
tooltip:{show:false}, |
||||
data : [{ |
||||
name:'达成率', |
||||
value:79, |
||||
itemStyle:{color :'rgba(0,153,255,0.8)'}, |
||||
hoverAnimation: false, |
||||
label : { |
||||
show : false, |
||||
position : 'center', |
||||
textStyle: { |
||||
fontFamily:'微软雅黑', |
||||
fontWeight: 'bolder', |
||||
color:'#B7E1FF', |
||||
fontSize:24 |
||||
} |
||||
}, |
||||
labelLine : { |
||||
show : false |
||||
} |
||||
}, |
||||
{ |
||||
name:'79%', |
||||
value:21, |
||||
itemStyle:{color: 'rgba(0,153,255,0.1)'}, |
||||
hoverAnimation: false, |
||||
label : { |
||||
show : false, |
||||
position : 'center', |
||||
padding:20, |
||||
textStyle: { |
||||
fontFamily:'微软雅黑', |
||||
fontSize: 24, |
||||
color:'#B7E1FF' |
||||
} |
||||
}, |
||||
labelLine : { |
||||
show : false |
||||
} |
||||
}] |
||||
}, |
||||
{ |
||||
type : 'pie', |
||||
center : ['50%', '50%'], |
||||
radius : [95,100], |
||||
x: '0%', |
||||
hoverAnimation: false, |
||||
data : [{ |
||||
value:100, |
||||
itemStyle:{color :'rgba(0,153,255,0.3)'}, |
||||
label : {show : false}, |
||||
labelLine : {show : false} |
||||
}] |
||||
}, |
||||
{ |
||||
type : 'pie', |
||||
center : ['50%', '50%'], |
||||
radius : [69,70], |
||||
x: '0%', |
||||
hoverAnimation: false, |
||||
data : [{ |
||||
value:100, |
||||
itemStyle:{color :'rgba(0,153,255,0.3)'}, |
||||
label : {show : false}, |
||||
labelLine : {show : false} |
||||
}] |
||||
}] |
||||
}; |
||||
|
||||
//年仪表盘
|
||||
y_gauge1 = echarts.init(document.getElementById('y_gauge1')); |
||||
y_gauge2 = echarts.init(document.getElementById('y_gauge2')); |
||||
y_gauge3 = echarts.init(document.getElementById('y_gauge3')); |
||||
y_gauge4 = echarts.init(document.getElementById('y_gauge4')); |
||||
|
||||
//月仪表盘
|
||||
m_gauge1 = echarts.init(document.getElementById('m_gauge1')); |
||||
m_gauge2 = echarts.init(document.getElementById('m_gauge2')); |
||||
m_gauge3 = echarts.init(document.getElementById('m_gauge3')); |
||||
m_gauge4 = echarts.init(document.getElementById('m_gauge4')); |
||||
|
||||
//日仪表盘
|
||||
d_gauge1 = echarts.init(document.getElementById('d_gauge1')); |
||||
d_gauge2 = echarts.init(document.getElementById('d_gauge2')); |
||||
d_gauge3 = echarts.init(document.getElementById('d_gauge3')); |
||||
d_gauge4 = echarts.init(document.getElementById('d_gauge4')); |
||||
|
||||
//监控仪表盘
|
||||
option_gauge = { |
||||
title: { |
||||
text: '', //标题文本内容
|
||||
}, |
||||
toolbox: { //可视化的工具箱
|
||||
show: false, |
||||
}, |
||||
tooltip: { //弹窗组件
|
||||
formatter: "{a} <br/>{b} : {c}%" |
||||
}, |
||||
series: [{ |
||||
type: 'gauge', |
||||
axisLine: {// 坐标轴线
|
||||
lineStyle: { // 属性lineStyle控制线条样式
|
||||
color: [ |
||||
[0.2, color[0]], |
||||
[0.8, color[1]], |
||||
[1, color[2]] |
||||
], |
||||
width: 18 |
||||
} |
||||
}, |
||||
splitLine: { // 分隔线
|
||||
show:true, |
||||
length: 18, |
||||
lineStyle: { |
||||
color: '#28292D', |
||||
width: 1 |
||||
} |
||||
}, |
||||
axisTick : { //刻度线样式(及短线样式)
|
||||
show:false, |
||||
lineStyle: { |
||||
color: 'auto', |
||||
width: 1 |
||||
}, |
||||
length : 20 |
||||
}, |
||||
axisLabel : { |
||||
color:'#FFF', |
||||
fontSize:14, |
||||
fontFamily:'Verdana, Geneva, sans-serif' |
||||
}, |
||||
title: { |
||||
textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
||||
fontWeight: 'bolder', |
||||
fontSize: 20, |
||||
color: '#FFF' |
||||
}, |
||||
offsetCenter: [0, '30%'] |
||||
}, |
||||
pointer: { |
||||
width: 5, |
||||
color: '#F00', |
||||
shadowColor: '#FF0', |
||||
shadowBlur: 10 |
||||
}, |
||||
detail: { |
||||
show:false, |
||||
formatter:'{value}%', |
||||
textStyle: |
||||
{ |
||||
fontFamily:'Arial', |
||||
color: '#000', |
||||
fontSize:'32px' |
||||
}, |
||||
offsetCenter: [0, '90%'] |
||||
}, |
||||
data: [{value: 45, name: '水'}] |
||||
}] |
||||
}; |
||||
|
||||
gauge1 = echarts.init(document.getElementById('gauge1')); |
||||
gauge2 = echarts.init(document.getElementById('gauge2')); |
||||
gauge3 = echarts.init(document.getElementById('gauge3')); |
||||
gauge4 = echarts.init(document.getElementById('gauge4')); |
||||
gauge5 = echarts.init(document.getElementById('gauge5')); |
||||
option_gauge.series[0].axisLine.lineStyle.color=[[0.2, color[0]],[0.8, color[1]],[1, color[2]]]; |
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="水"; |
||||
$('#vg1').html(option_gauge.series[0].data[0].value); |
||||
gauge1.setOption(option_gauge); |
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="电"; |
||||
$('#vg2').html(option_gauge.series[0].data[0].value); |
||||
gauge2.setOption(option_gauge); |
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="天然气"; |
||||
$('#vg3').html(option_gauge.series[0].data[0].value); |
||||
gauge3.setOption(option_gauge); |
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="压缩空气"; |
||||
$('#vg4').html(option_gauge.series[0].data[0].value); |
||||
gauge4.setOption(option_gauge); |
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="蒸汽"; |
||||
$('#vg5').html(option_gauge.series[0].data[0].value); |
||||
gauge5.setOption(option_gauge); |
||||
|
||||
//生产质量堆积图
|
||||
quality_chart = echarts.init(document.getElementById('quality')); |
||||
quality_option={ |
||||
title: { |
||||
show:false, |
||||
text: 'AUDIT', |
||||
left: 'center', |
||||
textStyle: { |
||||
color: '#F00', |
||||
fontSize:32 |
||||
} |
||||
}, |
||||
xAxis: { |
||||
data: ['1月10日','2月10日','3月10日','4月10日','5月10日','6月10日'], |
||||
axisLabel: { |
||||
textStyle: { |
||||
color: '#B7E1FF', |
||||
fontSize:24 |
||||
} |
||||
}, |
||||
axisLine:{ |
||||
lineStyle:{ |
||||
color:'#09F' |
||||
} |
||||
}, |
||||
axisTick:{ |
||||
lineStyle:{ |
||||
color:'#09F' |
||||
} |
||||
} |
||||
}, |
||||
yAxis: { |
||||
inverse: false, |
||||
splitArea: {show: false}, |
||||
axisLine: {show: false}, |
||||
axisTick: {show: false}, |
||||
axisLabel: { |
||||
textStyle: { |
||||
color: '#B7E1FF', |
||||
fontSize:24, |
||||
fontFamily:'Arial', |
||||
} |
||||
}, |
||||
splitLine :{ |
||||
lineStyle:{ |
||||
color:'#09F' |
||||
} |
||||
} |
||||
}, |
||||
grid: { |
||||
left: 100 |
||||
}, |
||||
tooltip: { |
||||
trigger: 'item', |
||||
textStyle: { |
||||
color: '#B7E1FF', |
||||
fontSize:24 |
||||
} |
||||
}, |
||||
legend:{ |
||||
show:false, |
||||
top: 'bottom', |
||||
textStyle: { |
||||
color: '#F00', |
||||
fontSize:24, |
||||
fontFamily:'微软雅黑' |
||||
}, |
||||
data:['AUDIT分数1','AUDIT分数'] |
||||
}, |
||||
series: [ |
||||
{ |
||||
name: 'AUDIT分数1', |
||||
type: 'bar', |
||||
stack: 'one', |
||||
itemStyle: |
||||
{ |
||||
normal: {color: color[1]} |
||||
}, |
||||
barWidth : 60, |
||||
data:[2200,2900,3680,2200,2900,3680] |
||||
}, |
||||
{ |
||||
name: 'AUDIT分数', |
||||
type: 'bar', |
||||
stack: 'one', |
||||
itemStyle: { |
||||
normal: { |
||||
color: '#F90', |
||||
label: { |
||||
show: true, |
||||
position: 'insideTop', |
||||
textStyle: { |
||||
color: '#000', |
||||
fontSize:24 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
barWidth : 50, |
||||
data: [1800,1100,320,1800,1100,320] |
||||
} |
||||
] |
||||
}; |
||||
quality_chart.setOption(quality_option); |
||||
|
||||
//生产计划折线图
|
||||
var plan_data1=[]; |
||||
var plan_data2=[]; |
||||
var plan_xAxis=[]; |
||||
for (var i = 1; i <= 7; i++) { |
||||
plan_xAxis.push("3月"+i+"日"); |
||||
plan_data1.push(Math.round(Math.random() * 100)); |
||||
plan_data2.push(Math.round(Math.random() * 100)); |
||||
} |
||||
plan_chart = echarts.init(document.getElementById('plan')); |
||||
plan_option={ |
||||
xAxis: { |
||||
data:plan_xAxis, |
||||
axisLabel: { |
||||
textStyle: { |
||||
color: '#B7E1FF', |
||||
fontSize:24 |
||||
} |
||||
}, |
||||
axisLine:{ |
||||
lineStyle:{ |
||||
color:'#09F' |
||||
} |
||||
}, |
||||
axisTick:{ |
||||
lineStyle:{ |
||||
color:'#09F' |
||||
} |
||||
} |
||||
}, |
||||
yAxis: { |
||||
inverse: false, |
||||
splitArea: {show: false}, |
||||
axisLine: {show: false}, |
||||
axisTick: {show: false}, |
||||
axisLabel: { |
||||
textStyle: { |
||||
color: '#B7E1FF', |
||||
fontSize:24, |
||||
fontFamily:'Arial', |
||||
} |
||||
}, |
||||
splitLine :{ |
||||
lineStyle:{ |
||||
color:'#09F' |
||||
} |
||||
} |
||||
}, |
||||
tooltip: { |
||||
trigger: 'axis', |
||||
textStyle: { |
||||
color: '#FFF', |
||||
fontSize:24 |
||||
} |
||||
}, |
||||
grid: { |
||||
left: 100 |
||||
}, |
||||
legend:{ |
||||
show:false, |
||||
top: 'bottom', |
||||
textStyle: { |
||||
color: '#F00', |
||||
fontSize:24 |
||||
}, |
||||
data:['计划完成数','实际完成数'] |
||||
}, |
||||
series: [ |
||||
{ |
||||
name: '计划完成数', |
||||
type: 'bar', |
||||
itemStyle: |
||||
{ |
||||
normal: {color: color[1]}, |
||||
emphasis: {color: color[2]} |
||||
}, |
||||
barWidth : 40, |
||||
data:plan_data1 |
||||
}, |
||||
{ |
||||
name: '实际完成数', |
||||
type: 'line', |
||||
itemStyle: { |
||||
normal: { |
||||
color: '#F90', |
||||
label: { |
||||
show: true, |
||||
position: 'top', |
||||
textStyle: { |
||||
color: '#CCC', |
||||
fontSize:24 |
||||
} |
||||
}, |
||||
lineStyle:{ |
||||
color:'#F90', |
||||
width:4 |
||||
} |
||||
}, |
||||
emphasis: { |
||||
color: '#FF0' |
||||
} |
||||
}, |
||||
symbolSize: 24, |
||||
data: plan_data2 |
||||
} |
||||
] |
||||
}; |
||||
plan_chart.setOption(plan_option); |
||||
|
||||
//轮番显示tips
|
||||
function clock(){ |
||||
showToolTip_highlight(plan_chart); |
||||
} |
||||
setInterval(clock, 5000); |
||||
|
||||
//地图开始
|
||||
var map_chart = echarts.init(document.getElementById('map')); |
||||
|
||||
var CCData = [ |
||||
[{name:'长春'}, {name:'上海',value:95}], |
||||
[{name:'长春'}, {name:'广州',value:90}], |
||||
[{name:'长春'}, {name:'大连',value:80}], |
||||
[{name:'长春'}, {name:'南宁',value:70}], |
||||
[{name:'长春'}, {name:'南昌',value:60}], |
||||
[{name:'长春'}, {name:'拉萨',value:50}], |
||||
[{name:'长春'}, {name:'长春',value:40}], |
||||
[{name:'长春'}, {name:'包头',value:30}], |
||||
[{name:'长春'}, {name:'重庆',value:20}], |
||||
[{name:'长春'}, {name:'北京',value:10}] |
||||
]; |
||||
|
||||
var series = []; |
||||
[['长春', CCData]].forEach(function (item, i) { |
||||
series.push({ |
||||
name: '一汽汽车销售', |
||||
type: 'lines', |
||||
zlevel: 1, |
||||
effect: { |
||||
show: true, |
||||
period: 6, |
||||
trailLength: 0.7, |
||||
color: '#FF0', |
||||
symbolSize: 3 |
||||
}, |
||||
lineStyle: { |
||||
normal: { |
||||
color: '#000', |
||||
width: 0, |
||||
curveness: 0.2 |
||||
} |
||||
}, |
||||
data: convertData(item[1]) |
||||
}, |
||||
{ |
||||
name: '一汽汽车销售', |
||||
type: 'lines', |
||||
zlevel: 2, |
||||
symbol: ['none', 'arrow'], |
||||
symbolSize: 10, |
||||
lineStyle: { |
||||
normal: { |
||||
color: '#FF0', |
||||
width: 1, |
||||
opacity: 0.6, |
||||
curveness: 0.2 |
||||
} |
||||
}, |
||||
data: convertData(item[1]) |
||||
}, |
||||
{ |
||||
name: '一汽汽车销售', |
||||
type: 'effectScatter', |
||||
coordinateSystem: 'geo', |
||||
zlevel: 2, |
||||
rippleEffect: { |
||||
brushType: 'stroke' |
||||
}, |
||||
label: { |
||||
normal: { |
||||
show: true, |
||||
position: 'right', |
||||
formatter: '{b}' |
||||
} |
||||
}, |
||||
symbolSize: function (val) { |
||||
return 15; |
||||
}, |
||||
itemStyle: { |
||||
normal: { |
||||
color: '#FFF', |
||||
label: { |
||||
show: true, |
||||
position: 'top', |
||||
textStyle: { |
||||
color: '#FFF', |
||||
fontSize:24 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
data: item[1].map(function (dataItem) { |
||||
return { |
||||
name: dataItem[1].name, |
||||
value: geoCoordMap[dataItem[1].name].concat([dataItem[1].value]) |
||||
}; |
||||
}) |
||||
}); |
||||
}); |
||||
|
||||
map_option = { |
||||
backgroundColor: '', |
||||
title : { |
||||
show:false, |
||||
text: '一汽汽车销售地域分布示意图', |
||||
subtext: '截至2018年05月04日', |
||||
left: 'center', |
||||
top:10, |
||||
textStyle : { |
||||
color: '#09F', |
||||
fontSize:32 |
||||
}, |
||||
subtextStyle:{ |
||||
color: '#09F', |
||||
fontSize:24 |
||||
} |
||||
}, |
||||
tooltip : { |
||||
trigger: 'item' |
||||
}, |
||||
legend: { |
||||
show:false, |
||||
orient: 'vertical', |
||||
top: 'bottom', |
||||
left: 'right', |
||||
data:['一汽汽车销售'], |
||||
textStyle: { |
||||
color: '#000' |
||||
}, |
||||
selectedMode: 'single' |
||||
}, |
||||
geo: { |
||||
map: 'china', |
||||
label: { |
||||
emphasis: { |
||||
show: false |
||||
} |
||||
}, |
||||
roam: true, |
||||
itemStyle: { |
||||
normal: { |
||||
areaColor: '#09F', |
||||
borderColor: '#09F', |
||||
opacity:0.5 |
||||
}, |
||||
emphasis: { |
||||
areaColor: '#09F', |
||||
borderColor: '#09F', |
||||
opacity:0.8 |
||||
} |
||||
} |
||||
}, |
||||
series: series |
||||
}; |
||||
|
||||
map_chart.setOption(map_option, true); |
||||
|
||||
resresh(); |
||||
|
||||
//开始定时刷新
|
||||
setInterval(resresh, 5*1000); |
||||
}); |
||||
|
||||
var convertData = function (data) { |
||||
var res = []; |
||||
for (var i = 0; i < data.length; i++) { |
||||
var dataItem = data[i]; |
||||
var fromCoord = geoCoordMap[dataItem[0].name]; |
||||
var toCoord = geoCoordMap[dataItem[1].name]; |
||||
if (fromCoord && toCoord) { |
||||
res.push({ |
||||
fromName: dataItem[0].name, |
||||
toName: dataItem[1].name, |
||||
coords: [fromCoord, toCoord] |
||||
}); |
||||
} |
||||
} |
||||
return res; |
||||
}; |
||||
|
||||
function showToolTip_highlight(mychart) |
||||
{ |
||||
var echartObj = mychart; |
||||
|
||||
// 高亮当前图形
|
||||
var highlight =setInterval(function() |
||||
{ |
||||
echartObj.dispatchAction({ |
||||
type: 'highlight', |
||||
seriesIndex: 0, |
||||
dataIndex: indexnum |
||||
}); |
||||
|
||||
echartObj.dispatchAction({ |
||||
type: 'showTip', |
||||
seriesIndex: 0, |
||||
dataIndex: indexnum |
||||
}); |
||||
clearInterval(highlight); |
||||
indexnum = indexnum + 1; |
||||
if(indexnum>=7) indexnum=0; |
||||
},1000); |
||||
} |
||||
|
||||
//定时刷新数据
|
||||
function resresh() |
||||
{ |
||||
var myDate = new Date(); |
||||
|
||||
// $('#refresh').html("<img src=\"images/wait.gif\" align=\"absmiddle\"><span>数据刷新中...</span>");
|
||||
|
||||
//年月日刷新
|
||||
$('#currentYear').html(myDate.getFullYear()+"年"); |
||||
$('#currentMonth').html(insertZero(myDate.getMonth()+1)+"月"); |
||||
$('#currentDay').html(insertZero(myDate.getDate())+"日"); |
||||
$('#currentDate').html(myDate.getFullYear()+"/"+insertZero(myDate.getMonth()+1)+"/"+insertZero(myDate.getDate())); |
||||
|
||||
option_gauge.series[0].axisLabel.show=true; |
||||
option_gauge.series[0].axisLine.lineStyle.color=[[0.2, color[0]],[0.8, color[1]],[1, color[2]]] |
||||
|
||||
var maxg=Math.round(Math.random()*500)+400; |
||||
var n1=Math.round(Math.random()*(maxg-100))+100; |
||||
var n2=Math.round(Math.random()*(n1-50))+50; |
||||
var n3=(n2/maxg*100).toFixed(2); |
||||
|
||||
//年进度条
|
||||
option_Progress.title.text ="计划生产"; |
||||
option_Progress.series[0].data[0].value = maxg; |
||||
option_Progress.title.subtext =maxg+"台"; |
||||
option_Progress.series[0].data[1].value =0; |
||||
y_gauge1.setOption(option_Progress); |
||||
|
||||
option_Progress.title.text ="已接订单"; |
||||
option_Progress.series[0].data[0].value = n1; |
||||
option_Progress.title.subtext =n1+"台"; |
||||
option_Progress.series[0].data[1].value =(maxg-n1); |
||||
y_gauge2.setOption(option_Progress); |
||||
|
||||
option_Progress.title.text ="已经完成"; |
||||
option_Progress.series[0].data[0].value = n2; |
||||
option_Progress.title.subtext =n2+"台"; |
||||
option_Progress.series[0].data[1].value =(maxg-n2); |
||||
y_gauge3.setOption(option_Progress); |
||||
|
||||
option_Progress.title.text ="计划完成率"; |
||||
option_Progress.series[0].data[0].value = n3; |
||||
option_Progress.title.subtext =n3+"%"; |
||||
option_Progress.series[0].data[1].value =(100-n3); |
||||
y_gauge4.setOption(option_Progress); |
||||
|
||||
//月进度条
|
||||
maxg=Math.round(Math.random()*maxg)+1; |
||||
n1=Math.round(Math.random()*maxg)+1; |
||||
n2=Math.round(Math.random()*n1); |
||||
n3=(n2/maxg*100).toFixed(2); |
||||
|
||||
option_Progress.title.text ="计划生产"; |
||||
option_Progress.series[0].data[0].value = maxg; |
||||
option_Progress.title.subtext =maxg+"台"; |
||||
option_Progress.series[0].data[1].value =0; |
||||
m_gauge1.setOption(option_Progress); |
||||
|
||||
option_Progress.title.text ="已接订单"; |
||||
option_Progress.series[0].data[0].value = n1; |
||||
option_Progress.title.subtext =n1+"台"; |
||||
option_Progress.series[0].data[1].value =(maxg-n1); |
||||
m_gauge2.setOption(option_Progress); |
||||
|
||||
option_Progress.title.text ="已经完成"; |
||||
option_Progress.series[0].data[0].value = n2; |
||||
option_Progress.title.subtext =n2+"台"; |
||||
option_Progress.series[0].data[1].value =(maxg-n2); |
||||
m_gauge3.setOption(option_Progress); |
||||
|
||||
option_Progress.title.text ="计划完成率"; |
||||
option_Progress.series[0].data[0].value = n3; |
||||
option_Progress.title.subtext =n3+"%"; |
||||
option_Progress.series[0].data[1].value =(100-n3); |
||||
m_gauge4.setOption(option_Progress); |
||||
|
||||
//日进度条
|
||||
maxg=Math.round(Math.random()*maxg)+1; |
||||
n1=Math.round(Math.random()*maxg)+1; |
||||
n2=Math.round(Math.random()*n1); |
||||
n3=(n2/maxg*100).toFixed(2); |
||||
|
||||
option_Progress.title.text ="计划生产"; |
||||
option_Progress.series[0].data[0].value = maxg; |
||||
option_Progress.title.subtext =maxg+"台"; |
||||
option_Progress.series[0].data[1].value =0; |
||||
d_gauge1.setOption(option_Progress); |
||||
|
||||
option_Progress.title.text ="已接订单"; |
||||
option_Progress.series[0].data[0].value = n1; |
||||
option_Progress.title.subtext =n1+"台"; |
||||
option_Progress.series[0].data[1].value =(maxg-n1); |
||||
d_gauge2.setOption(option_Progress); |
||||
|
||||
option_Progress.title.text ="已经完成"; |
||||
option_Progress.series[0].data[0].value = n2; |
||||
option_Progress.title.subtext =n2+"台"; |
||||
option_Progress.series[0].data[1].value =(maxg-n2); |
||||
d_gauge3.setOption(option_Progress); |
||||
|
||||
option_Progress.title.text ="计划完成率"; |
||||
option_Progress.series[0].data[0].value = n3; |
||||
option_Progress.title.subtext =n3+"%"; |
||||
option_Progress.series[0].data[1].value =(100-n3); |
||||
d_gauge4.setOption(option_Progress); |
||||
|
||||
//仪表盘刷新
|
||||
option_gauge.series[0].axisLine.lineStyle.color=[[0.2, color[0]],[0.8, color[1]],[1, color[0]]]; |
||||
|
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="水"; |
||||
$('#vg1').html(option_gauge.series[0].data[0].value); |
||||
gauge1.setOption(option_gauge); |
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="电"; |
||||
$('#vg2').html(option_gauge.series[0].data[0].value); |
||||
gauge2.setOption(option_gauge); |
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="天然气"; |
||||
$('#vg3').html(option_gauge.series[0].data[0].value); |
||||
gauge3.setOption(option_gauge); |
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="压缩空气"; |
||||
$('#vg4').html(option_gauge.series[0].data[0].value); |
||||
gauge4.setOption(option_gauge); |
||||
option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; |
||||
option_gauge.series[0].data[0].name ="蒸汽"; |
||||
$('#vg5').html(option_gauge.series[0].data[0].value); |
||||
gauge5.setOption(option_gauge); |
||||
|
||||
//显示最后更新时间
|
||||
$('#refresh').html("<span id=\"refreshTime\">最后刷新时间:"+myDate.toLocaleDateString()+" "+myDate.toLocaleTimeString()+"</span>"); |
||||
} |
||||
|
||||
//生成订单号
|
||||
function getOrderNumber(n) |
||||
{ |
||||
var no="000000"+n.toString(); |
||||
return no.substring(no.length-6); |
||||
} |
||||
|
||||
//前面补0
|
||||
function insertZero(n) |
||||
{ |
||||
var no="000000"+n.toString(); |
||||
return no.substring(no.length-2); |
||||
} |
@ -0,0 +1,116 @@
|
||||
var geoCoordMap = { |
||||
'上海': [121.4648,31.2891], |
||||
'东莞': [113.8953,22.901], |
||||
'东营': [118.7073,37.5513], |
||||
'中山': [113.4229,22.478], |
||||
'临汾': [111.4783,36.1615], |
||||
'临沂': [118.3118,35.2936], |
||||
'丹东': [124.541,40.4242], |
||||
'丽水': [119.5642,28.1854], |
||||
'乌鲁木齐': [87.9236,43.5883], |
||||
'佛山': [112.8955,23.1097], |
||||
'保定': [115.0488,39.0948], |
||||
'兰州': [103.5901,36.3043], |
||||
'包头': [110.3467,41.4899], |
||||
'北京': [116.4551,40.2539], |
||||
'北海': [109.314,21.6211], |
||||
'南京': [118.8062,31.9208], |
||||
'南宁': [108.479,23.1152], |
||||
'南昌': [116.0046,28.6633], |
||||
'南通': [121.1023,32.1625], |
||||
'厦门': [118.1689,24.6478], |
||||
'台州': [121.1353,28.6688], |
||||
'合肥': [117.29,32.0581], |
||||
'呼和浩特': [111.4124,40.4901], |
||||
'咸阳': [108.4131,34.8706], |
||||
'哈尔滨': [127.9688,45.368], |
||||
'唐山': [118.4766,39.6826], |
||||
'嘉兴': [120.9155,30.6354], |
||||
'大同': [113.7854,39.8035], |
||||
'大连': [122.2229,39.4409], |
||||
'天津': [117.4219,39.4189], |
||||
'太原': [112.3352,37.9413], |
||||
'威海': [121.9482,37.1393], |
||||
'宁波': [121.5967,29.6466], |
||||
'宝鸡': [107.1826,34.3433], |
||||
'宿迁': [118.5535,33.7775], |
||||
'常州': [119.4543,31.5582], |
||||
'广州': [113.5107,23.2196], |
||||
'廊坊': [116.521,39.0509], |
||||
'延安': [109.1052,36.4252], |
||||
'张家口': [115.1477,40.8527], |
||||
'徐州': [117.5208,34.3268], |
||||
'德州': [116.6858,37.2107], |
||||
'惠州': [114.6204,23.1647], |
||||
'成都': [103.9526,30.7617], |
||||
'扬州': [119.4653,32.8162], |
||||
'承德': [117.5757,41.4075], |
||||
'拉萨': [91.1865,30.1465], |
||||
'无锡': [120.3442,31.5527], |
||||
'日照': [119.2786,35.5023], |
||||
'昆明': [102.9199,25.4663], |
||||
'杭州': [119.5313,29.8773], |
||||
'枣庄': [117.323,34.8926], |
||||
'柳州': [109.3799,24.9774], |
||||
'株洲': [113.5327,27.0319], |
||||
'武汉': [114.3896,30.6628], |
||||
'汕头': [117.1692,23.3405], |
||||
'江门': [112.6318,22.1484], |
||||
'沈阳': [123.1238,42.1216], |
||||
'沧州': [116.8286,38.2104], |
||||
'河源': [114.917,23.9722], |
||||
'泉州': [118.3228,25.1147], |
||||
'泰安': [117.0264,36.0516], |
||||
'泰州': [120.0586,32.5525], |
||||
'济南': [117.1582,36.8701], |
||||
'济宁': [116.8286,35.3375], |
||||
'海口': [110.3893,19.8516], |
||||
'淄博': [118.0371,36.6064], |
||||
'淮安': [118.927,33.4039], |
||||
'深圳': [114.5435,22.5439], |
||||
'清远': [112.9175,24.3292], |
||||
'温州': [120.498,27.8119], |
||||
'渭南': [109.7864,35.0299], |
||||
'湖州': [119.8608,30.7782], |
||||
'湘潭': [112.5439,27.7075], |
||||
'滨州': [117.8174,37.4963], |
||||
'潍坊': [119.0918,36.524], |
||||
'烟台': [120.7397,37.5128], |
||||
'玉溪': [101.9312,23.8898], |
||||
'珠海': [113.7305,22.1155], |
||||
'盐城': [120.2234,33.5577], |
||||
'盘锦': [121.9482,41.0449], |
||||
'石家庄': [114.4995,38.1006], |
||||
'福州': [119.4543,25.9222], |
||||
'秦皇岛': [119.2126,40.0232], |
||||
'绍兴': [120.564,29.7565], |
||||
'聊城': [115.9167,36.4032], |
||||
'肇庆': [112.1265,23.5822], |
||||
'舟山': [122.2559,30.2234], |
||||
'苏州': [120.6519,31.3989], |
||||
'莱芜': [117.6526,36.2714], |
||||
'菏泽': [115.6201,35.2057], |
||||
'营口': [122.4316,40.4297], |
||||
'葫芦岛': [120.1575,40.578], |
||||
'衡水': [115.8838,37.7161], |
||||
'衢州': [118.6853,28.8666], |
||||
'西宁': [101.4038,36.8207], |
||||
'西安': [109.1162,34.2004], |
||||
'贵阳': [106.6992,26.7682], |
||||
'连云港': [119.1248,34.552], |
||||
'邢台': [114.8071,37.2821], |
||||
'邯郸': [114.4775,36.535], |
||||
'郑州': [113.4668,34.6234], |
||||
'鄂尔多斯': [108.9734,39.2487], |
||||
'重庆': [107.7539,30.1904], |
||||
'金华': [120.0037,29.1028], |
||||
'铜川': [109.0393,35.1947], |
||||
'银川': [106.3586,38.1775], |
||||
'镇江': [119.4763,31.9702], |
||||
'长春': [125.8154,44.2584], |
||||
'长沙': [113.0823,28.2568], |
||||
'长治': [112.8625,36.4746], |
||||
'阳泉': [113.4778,38.0951], |
||||
'青岛': [120.4651,36.3373], |
||||
'韶关': [113.7964,24.7028] |
||||
}; |
After Width: | Height: | Size: 375 B |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 262 B |
After Width: | Height: | Size: 1001 B |
After Width: | Height: | Size: 380 B |
After Width: | Height: | Size: 338 B |
After Width: | Height: | Size: 280 B |
After Width: | Height: | Size: 1015 B |
After Width: | Height: | Size: 709 B |
After Width: | Height: | Size: 159 KiB |
After Width: | Height: | Size: 183 B |
After Width: | Height: | Size: 932 B |
After Width: | Height: | Size: 273 B |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 251 B |
After Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 333 B |
After Width: | Height: | Size: 529 B |
After Width: | Height: | Size: 242 B |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 367 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 499 B |