New file |
| | |
| | | package com.zy.crm.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.crm.manager.entity.CompanyPost; |
| | | import com.zy.crm.manager.service.CompanyPostService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.domain.KeyValueVo; |
| | | import com.zy.crm.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class CompanyPostController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CompanyPostService companyPostService; |
| | | |
| | | @RequestMapping(value = "/companyPost/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(companyPostService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyPost/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<CompanyPost> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(CompanyPost.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(companyPostService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyPost/add/auth") |
| | | @ManagerAuth(memo = "添加公告") |
| | | public R add(CompanyPost companyPost) { |
| | | companyPost.setCreateTime(new Date()); |
| | | companyPost.setUserId(getUserId()); |
| | | companyPostService.insert(companyPost); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyPost/update/auth") |
| | | @ManagerAuth(memo = "更新公告") |
| | | public R update(CompanyPost companyPost){ |
| | | if (Cools.isEmpty(companyPost) || null==companyPost.getId()){ |
| | | return R.error(); |
| | | } |
| | | companyPost.setUpdateTime(new Date()); |
| | | companyPost.setUpdateUserId(getUserId()); |
| | | companyPostService.updateById(companyPost); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyPost/delete/auth") |
| | | @ManagerAuth(memo = "删除公告") |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | companyPostService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyPost/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<CompanyPost> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("companyPost")); |
| | | convert(map, wrapper); |
| | | List<CompanyPost> list = companyPostService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyPostQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<CompanyPost> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<CompanyPost> page = companyPostService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (CompanyPost companyPost : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", companyPost.getId()); |
| | | map.put("value", companyPost.getId()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyPost/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<CompanyPost> wrapper = new EntityWrapper<CompanyPost>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != companyPostService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(CompanyPost.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/companyPost/all/get/kv") |
| | | @ManagerAuth |
| | | public R getDataKV(@RequestParam(required = false) String condition) { |
| | | List<KeyValueVo> vos = new ArrayList<>(); |
| | | Wrapper<CompanyPost> wrapper = new EntityWrapper<CompanyPost>().andNew().like("id", condition).orderBy("create_time", false); |
| | | companyPostService.selectPage(new Page<>(1, 30), wrapper).getRecords().forEach(item -> vos.add(new KeyValueVo(String.valueOf(item.getId()), item.getId()))); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.crm.manager.entity.CompanyTarget; |
| | | import com.zy.crm.manager.service.CompanyTargetService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.domain.KeyValueVo; |
| | | import com.zy.crm.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class CompanyTargetController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CompanyTargetService companyTargetService; |
| | | |
| | | @RequestMapping(value = "/companyTarget/current/auth") |
| | | @ManagerAuth |
| | | public R getCurrent() { |
| | | Date date = new Date(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy"); |
| | | String year = format.format(date); |
| | | return R.ok(companyTargetService.selectByYear(year)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyTarget/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(companyTargetService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyTarget/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<CompanyTarget> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(CompanyTarget.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(companyTargetService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyTarget/add/auth") |
| | | @ManagerAuth(memo = "添加年度目标") |
| | | public R add(CompanyTarget companyTarget) { |
| | | companyTarget.setCreateTime(new Date()); |
| | | companyTarget.setUserId(getUserId()); |
| | | companyTargetService.insert(companyTarget); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyTarget/update/auth") |
| | | @ManagerAuth(memo = "更新年度目标") |
| | | public R update(CompanyTarget companyTarget){ |
| | | if (Cools.isEmpty(companyTarget) || null==companyTarget.getId()){ |
| | | return R.error(); |
| | | } |
| | | companyTarget.setUpdateTime(new Date()); |
| | | companyTarget.setUpdateUserId(getUserId()); |
| | | companyTargetService.updateById(companyTarget); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyTarget/delete/auth") |
| | | @ManagerAuth(memo = "删除年度目标") |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | companyTargetService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyTarget/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<CompanyTarget> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("companyTarget")); |
| | | convert(map, wrapper); |
| | | List<CompanyTarget> list = companyTargetService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyTargetQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<CompanyTarget> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<CompanyTarget> page = companyTargetService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (CompanyTarget companyTarget : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", companyTarget.getId()); |
| | | map.put("value", companyTarget.getId()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyTarget/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<CompanyTarget> wrapper = new EntityWrapper<CompanyTarget>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != companyTargetService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(CompanyTarget.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/companyTarget/all/get/kv") |
| | | @ManagerAuth |
| | | public R getDataKV(@RequestParam(required = false) String condition) { |
| | | List<KeyValueVo> vos = new ArrayList<>(); |
| | | Wrapper<CompanyTarget> wrapper = new EntityWrapper<CompanyTarget>().andNew().like("id", condition).orderBy("create_time", false); |
| | | companyTargetService.selectPage(new Page<>(1, 30), wrapper).getRecords().forEach(item -> vos.add(new KeyValueVo(String.valueOf(item.getId()), item.getId()))); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.controller; |
| | | |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.R; |
| | | import com.zy.crm.common.web.BaseController; |
| | | import com.zy.crm.manager.entity.CompanyTarget; |
| | | import com.zy.crm.manager.entity.Order; |
| | | import com.zy.crm.manager.service.CompanyTargetService; |
| | | import com.zy.crm.manager.service.OrderService; |
| | | import com.zy.crm.manager.utils.WordUtils; |
| | | import com.zy.crm.system.entity.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | public class DashboardController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CompanyTargetService companyTargetService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | //获取团队数据 |
| | | @RequestMapping(value = "/dashboard/companyData/auth") |
| | | @ManagerAuth |
| | | public R getCompanyData() { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | |
| | | Date date = new Date(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy"); |
| | | String year = format.format(date); |
| | | CompanyTarget companyTarget = companyTargetService.selectByYear(year);//获取公司全年目标数据 |
| | | if (companyTarget == null) { |
| | | return R.error(); |
| | | } |
| | | map.put("yearTarget", companyTarget.getTarget$());//全年交易目标 |
| | | |
| | | //获取全年交易成功金额 |
| | | Double successMoney = orderService.selectMoneyByYearAndStatus(year, 1); |
| | | //获取全年未交易成功金额 |
| | | Double progressMoney = orderService.selectMoneyByYearAndStatus(year, 0); |
| | | //获取全年交易失败金额 |
| | | Double failedMoney = orderService.selectMoneyByYearAndStatus(year, 2); |
| | | //全年交易率 |
| | | double yearTransactionRate = (successMoney / (successMoney + progressMoney + failedMoney)) * 100; |
| | | map.put("successMoney", WordUtils.formatNumberForAccounting(successMoney));//全年交易成功金额 |
| | | map.put("progressMoney", WordUtils.formatNumberForAccounting(progressMoney));//全年未交易成功金额 |
| | | map.put("yearTransactionRate", String.format("%.2f", yearTransactionRate));//全年交易率 |
| | | return R.ok().add(map); |
| | | } |
| | | |
| | | //获取员工个人数据 |
| | | @RequestMapping(value = "/dashboard/personData/auth") |
| | | @ManagerAuth |
| | | public R getPersonData() { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | |
| | | Date date = new Date(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy"); |
| | | String year = format.format(date); |
| | | |
| | | User user = getUser(); |
| | | String yearTarget = "0.00";//获取个人全年目标数据 |
| | | if (user.getTarget() != null) { |
| | | yearTarget = WordUtils.formatNumberForAccounting(Double.parseDouble(user.getTarget()));; |
| | | } |
| | | map.put("yearTarget", yearTarget);//全年交易目标 |
| | | |
| | | //获取全年交易成功金额 |
| | | Double successMoney = orderService.selectMoneyByUserAndYearAndStatus(user.getId(), year, 1); |
| | | //获取全年未交易成功金额 |
| | | Double progressMoney = orderService.selectMoneyByUserAndYearAndStatus(user.getId(), year, 0); |
| | | //获取全年交易失败金额 |
| | | Double failedMoney = orderService.selectMoneyByUserAndYearAndStatus(user.getId(), year, 2); |
| | | //全年交易率 |
| | | double yearTransactionRate = (successMoney / (successMoney + progressMoney + failedMoney)) * 100; |
| | | map.put("successMoney", WordUtils.formatNumberForAccounting(successMoney));//全年交易成功金额 |
| | | map.put("progressMoney", WordUtils.formatNumberForAccounting(progressMoney));//全年未交易成功金额 |
| | | map.put("yearTransactionRate", String.format("%.2f", yearTransactionRate));//全年交易率 |
| | | return R.ok().add(map); |
| | | } |
| | | |
| | | //获取员工排行榜 |
| | | @RequestMapping(value = "/dashboard/staffRank/auth") |
| | | @ManagerAuth |
| | | public R getStaffRank() { |
| | | ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
| | | for (Order order : orderService.selectTopMoney()) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("username", order.getUserId$()); |
| | | map.put("money", WordUtils.formatNumberForAccounting(order.getMoney())); |
| | | list.add(map); |
| | | } |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | //获取当前年度12个月的交易成功数据 |
| | | @RequestMapping(value = "/dashboard/currentMonthData/auth") |
| | | @ManagerAuth |
| | | public R getCurrentMonthData() { |
| | | List<Double> list = orderService.selectCurrentYearMonthSuccess(); |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.entity; |
| | | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @TableName("man_company_post") |
| | | public class CompanyPost implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 公告标题 |
| | | */ |
| | | @ApiModelProperty(value= "公告标题") |
| | | private String title; |
| | | |
| | | /** |
| | | * 公告内容 |
| | | */ |
| | | @ApiModelProperty(value= "公告内容") |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("create_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("update_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("update_user_id") |
| | | private Long updateUserId; |
| | | |
| | | public CompanyPost() {} |
| | | |
| | | public CompanyPost(String title,String content,Date createTime,Long userId,Date updateTime,Long updateUserId) { |
| | | this.title = title; |
| | | this.content = content; |
| | | this.createTime = createTime; |
| | | this.userId = userId; |
| | | this.updateTime = updateTime; |
| | | this.updateUserId = updateUserId; |
| | | } |
| | | |
| | | // CompanyPost companyPost = new CompanyPost( |
| | | // null, // 公告标题 |
| | | // null, // 公告内容 |
| | | // null, // |
| | | // null, // |
| | | // null, // |
| | | // null // |
| | | // ); |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.entity; |
| | | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.zy.crm.manager.utils.WordUtils; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @TableName("man_company_target") |
| | | public class CompanyTarget implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 年度 |
| | | */ |
| | | @ApiModelProperty(value= "年度") |
| | | private String year; |
| | | |
| | | /** |
| | | * 目标交易额 |
| | | */ |
| | | @ApiModelProperty(value= "目标交易额") |
| | | private String target; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("create_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("update_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("update_user_id") |
| | | private Long updateUserId; |
| | | |
| | | public CompanyTarget() {} |
| | | |
| | | public CompanyTarget(String year,String target,Date createTime,Long userId,Date updateTime,Long updateUserId) { |
| | | this.year = year; |
| | | this.target = target; |
| | | this.createTime = createTime; |
| | | this.userId = userId; |
| | | this.updateTime = updateTime; |
| | | this.updateUserId = updateUserId; |
| | | } |
| | | |
| | | // CompanyTarget companyTarget = new CompanyTarget( |
| | | // null, // 年度 |
| | | // null, // 目标交易额 |
| | | // null, // |
| | | // null, // |
| | | // null, // |
| | | // null // |
| | | // ); |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | public String getTarget$() { |
| | | if (Cools.isEmpty(this.target)){ |
| | | return ""; |
| | | } |
| | | return WordUtils.formatNumberForAccounting(Double.parseDouble(this.target)); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.mapper; |
| | | |
| | | import com.zy.crm.manager.entity.CompanyPost; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface CompanyPostMapper extends BaseMapper<CompanyPost> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.mapper; |
| | | |
| | | import com.zy.crm.manager.entity.CompanyTarget; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface CompanyTargetMapper extends BaseMapper<CompanyTarget> { |
| | | |
| | | CompanyTarget selectByYear(String year); |
| | | |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | |
| | | |
| | | List<Order> listByPage(Page<Order> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId , @Param("condition") String condition); |
| | | |
| | | Double selectMoneyByYearAndStatus(String year, Integer status);//获取指定年份和订单状态总交易金额 |
| | | |
| | | Double selectMoneyByUserAndYearAndStatus(Long userId, String year, Integer status);//获取指定用户、年份和订单状态总交易金额 |
| | | |
| | | List<Order> selectTopMoney();//查询交易额前7名员工 |
| | | |
| | | List<HashMap<String, Object>> selectCurrentYearMonthSuccess();//获取当前年度12个月的交易成功金额数据 |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.service; |
| | | |
| | | import com.zy.crm.manager.entity.CompanyPost; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface CompanyPostService extends IService<CompanyPost> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.service; |
| | | |
| | | import com.zy.crm.manager.entity.CompanyTarget; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface CompanyTargetService extends IService<CompanyTarget> { |
| | | |
| | | CompanyTarget selectByYear(String year); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.crm.manager.entity.Order; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface OrderService extends IService<Order> { |
| | | |
| | | Order selectByUuid(Long hostId, String uuid); |
| | |
| | | |
| | | Page<Order> getPage(Page<Order> page, Long hostId, String deptId, Long userId, String condition); |
| | | |
| | | Double selectMoneyByYearAndStatus(String year, Integer status);//获取指定年份和订单状态总交易金额 |
| | | |
| | | Double selectMoneyByUserAndYearAndStatus(Long userId, String year, Integer status);//获取指定用户、年份和订单状态总交易金额 |
| | | |
| | | List<Order> selectTopMoney();//查询交易额前7名员工 |
| | | |
| | | List<Double> selectCurrentYearMonthSuccess();//获取当前年度12个月的交易成功金额数据 |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.service.impl; |
| | | |
| | | import com.zy.crm.manager.mapper.CompanyPostMapper; |
| | | import com.zy.crm.manager.entity.CompanyPost; |
| | | import com.zy.crm.manager.service.CompanyPostService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("companyPostService") |
| | | public class CompanyPostServiceImpl extends ServiceImpl<CompanyPostMapper, CompanyPost> implements CompanyPostService { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.service.impl; |
| | | |
| | | import com.zy.crm.manager.mapper.CompanyTargetMapper; |
| | | import com.zy.crm.manager.entity.CompanyTarget; |
| | | import com.zy.crm.manager.service.CompanyTargetService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("companyTargetService") |
| | | public class CompanyTargetServiceImpl extends ServiceImpl<CompanyTargetMapper, CompanyTarget> implements CompanyTargetService { |
| | | |
| | | @Override |
| | | public CompanyTarget selectByYear(String year) { |
| | | return this.baseMapper.selectByYear(year); |
| | | } |
| | | } |
| | |
| | | import com.zy.crm.manager.service.OrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | @Service("orderService") |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService { |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Double selectMoneyByYearAndStatus(String year, Integer status) { |
| | | Double data = this.baseMapper.selectMoneyByYearAndStatus(year, status); |
| | | if (data == null) { |
| | | return 0D; |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | @Override |
| | | public Double selectMoneyByUserAndYearAndStatus(Long userId, String year, Integer status) { |
| | | Double data = this.baseMapper.selectMoneyByUserAndYearAndStatus(userId, year, status); |
| | | if (data == null) { |
| | | return 0D; |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | @Override |
| | | public List<Order> selectTopMoney() { |
| | | return this.baseMapper.selectTopMoney(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Double> selectCurrentYearMonthSuccess() { |
| | | ArrayList<Double> list = new ArrayList<Double>(){{ |
| | | add(0D);add(0D);add(0D);add(0D); |
| | | add(0D);add(0D);add(0D);add(0D); |
| | | add(0D);add(0D);add(0D);add(0D); |
| | | }}; |
| | | for (HashMap<String, Object> map : this.baseMapper.selectCurrentYearMonthSuccess()) { |
| | | list.set(Integer.parseInt(map.get("mon").toString()) - 1, Double.parseDouble(map.get("money").toString())); |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | public static String formatNumberForAccounting(double number) { |
| | | if (number == 0) { |
| | | return "0.00"; |
| | | } |
| | | NumberFormat formatter = new DecimalFormat("#,###.00"); |
| | | return formatter.format(number); |
| | | } |
| | |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 个人全年目标 |
| | | */ |
| | | private String target; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getTarget() { |
| | | return target; |
| | | } |
| | | |
| | | public void setTarget(String target) { |
| | | this.target = target; |
| | | } |
| | | } |
New file |
| | |
| | | <?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="com.zy.crm.manager.mapper.CompanyPostMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.crm.manager.entity.CompanyPost"> |
| | | <id column="id" property="id" /> |
| | | <result column="title" property="title" /> |
| | | <result column="content" property="content" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="update_user_id" property="updateUserId" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?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="com.zy.crm.manager.mapper.CompanyTargetMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.crm.manager.entity.CompanyTarget"> |
| | | <id column="id" property="id" /> |
| | | <result column="year" property="year" /> |
| | | <result column="target" property="target" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="update_user_id" property="updateUserId" /> |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="selectByYear" resultMap="BaseResultMap"> |
| | | select * from man_company_target |
| | | where year = #{year} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | ORDER BY mo.create_time DESC |
| | | </select> |
| | | |
| | | <select id="selectMoneyByYearAndStatus" resultType="java.lang.Double"> |
| | | select sum(money) money from man_order |
| | | where year(create_time) = #{year} |
| | | and status = #{status} |
| | | </select> |
| | | |
| | | <select id="selectMoneyByUserAndYearAndStatus" resultType="java.lang.Double"> |
| | | select sum(money) money from man_order |
| | | where year(create_time) = #{year} |
| | | and status = #{status} |
| | | and user_id = #{userId} |
| | | </select> |
| | | |
| | | <select id="selectTopMoney" resultMap="BaseResultMap"> |
| | | select top 7 user_id,sum(money) money from man_order |
| | | where status = 1 |
| | | group by user_id |
| | | order by money desc |
| | | </select> |
| | | |
| | | <select id="selectCurrentYearMonthSuccess" resultType="java.util.HashMap"> |
| | | select month(create_time) mon,sum(money) money from man_order |
| | | where year(create_time) = year(GETDATE()) |
| | | and status = 1 |
| | | group by month(create_time) |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="sex" property="sex" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="status" property="status" /> |
| | | <result column="target" property="target" /> |
| | | |
| | | </resultMap> |
| | | |
New file |
| | |
| | | var pageCurr; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table', 'laydate', 'form', 'admin', 'tree', 'dropdown'], function () { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | var dropdown = layui.dropdown; |
| | | var tree = layui.tree; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#companyPost', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl + '/companyPost/list/auth', |
| | | page: true, |
| | | limit: 15, |
| | | limits: [15, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | height: 'full-120', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | // ,{field: 'id', align: 'center',title: '#ID'} |
| | | , {field: 'title', align: 'center', title: '标题'} |
| | | , {field: 'content', align: 'center', title: '内容'} |
| | | , {field: 'createTime$', align: 'center', title: '创建时间'} |
| | | , {field: 'updateTime$', align: 'center', title: '更新时间'} |
| | | |
| | | , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 400} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } |
| | | pageCurr = curr; |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | | table.on('sort(companyPost)', function (obj) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function () { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | searchData['orderByField'] = obj.field; |
| | | searchData['orderByType'] = obj.type; |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: 1} |
| | | }); |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(companyPost)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id).data; |
| | | switch (obj.event) { |
| | | case 'addData': |
| | | showEditModel(); |
| | | break; |
| | | case 'deleteData': |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | del(checkStatus.map(function (d) { |
| | | return d.id; |
| | | })); |
| | | break; |
| | | case 'exportData': |
| | | admin.confirm('确定导出Excel吗', {shadeClose: true}, function () { |
| | | var titles = []; |
| | | var fields = []; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function () { |
| | | exportData[this.name] = this.value; |
| | | }); |
| | | var param = { |
| | | 'companyPost': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl + "/companyPost/export/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll(); |
| | | if (res.code === 200) { |
| | | table.exportFile(titles, res.data, 'xls'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(companyPost)', function (obj) { |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | del([data.id]); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '800px', |
| | | title: (mData ? '修改' : '添加') + '公告', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(mData); |
| | | form.val('detail', mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + "/companyPost/" + (mData ? 'update' : 'add') + "/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200) { |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + "/companyPost/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {ids: ids}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200) { |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 搜索 |
| | | form.on('submit(search)', function (data) { |
| | | pageCurr = 1; |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 重置 |
| | | form.on('submit(reset)', function (data) { |
| | | pageCurr = 1; |
| | | clearFormVal($('#search-box')); |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 时间选择器 |
| | | function layDateRender(data) { |
| | | setTimeout(function () { |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | | , type: 'datetime' |
| | | , range: true |
| | | }); |
| | | layDate.render({ |
| | | elem: '#createTime\\$', |
| | | type: 'datetime', |
| | | value: data !== undefined ? data['createTime\\$'] : null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#updateTime\\$', |
| | | type: 'datetime', |
| | | value: data !== undefined ? data['updateTime\\$'] : null |
| | | }); |
| | | |
| | | }, 300); |
| | | } |
| | | |
| | | layDateRender(); |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#data-detail-close', function () { |
| | | parent.layer.closeAll(); |
| | | }); |
| | | |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: pageCurr} |
| | | }); |
| | | } |
New file |
| | |
| | | var pageCurr; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table', 'laydate', 'form', 'admin', 'tree', 'dropdown'], function () { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | var dropdown = layui.dropdown; |
| | | var tree = layui.tree; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#companyTarget', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl + '/companyTarget/list/auth', |
| | | page: true, |
| | | limit: 15, |
| | | limits: [15, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | height: 'full-120', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | // ,{field: 'id', align: 'center',title: '#ID'} |
| | | , {field: 'year', align: 'center', title: '年度'} |
| | | , {field: 'target', align: 'center', title: '目标'} |
| | | |
| | | , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 400} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } |
| | | pageCurr = curr; |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | | table.on('sort(companyTarget)', function (obj) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function () { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | searchData['orderByField'] = obj.field; |
| | | searchData['orderByType'] = obj.type; |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: 1} |
| | | }); |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(companyTarget)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id).data; |
| | | switch (obj.event) { |
| | | case 'addData': |
| | | showEditModel(); |
| | | break; |
| | | case 'deleteData': |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | del(checkStatus.map(function (d) { |
| | | return d.id; |
| | | })); |
| | | break; |
| | | case 'exportData': |
| | | admin.confirm('确定导出Excel吗', {shadeClose: true}, function () { |
| | | var titles = []; |
| | | var fields = []; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function () { |
| | | exportData[this.name] = this.value; |
| | | }); |
| | | var param = { |
| | | 'companyTarget': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl + "/companyTarget/export/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll(); |
| | | if (res.code === 200) { |
| | | table.exportFile(titles, res.data, 'xls'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(companyTarget)', function (obj) { |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | del([data.id]); |
| | | break; |
| | | case "generate": |
| | | //生成合同 |
| | | generate(data) |
| | | break |
| | | case "sales": |
| | | //合同明细 |
| | | sales(data); |
| | | break |
| | | case "upload": |
| | | //上传合同 |
| | | upload(data) |
| | | break |
| | | case "download": |
| | | //下载合同 |
| | | download(data) |
| | | break |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '800px', |
| | | title: (mData ? '修改' : '添加') + '合同', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(mData); |
| | | form.val('detail', mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + "/companyTarget/" + (mData ? 'update' : 'add') + "/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200) { |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 生成合同 */ |
| | | function generate(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: '生成合同', |
| | | content: $('#generateDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(mData); |
| | | form.val('detail', mData); |
| | | form.on('submit(generateSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + "/companyTarget/generate/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'GET', |
| | | xhrFields: { |
| | | responseType: "blob" // 设置响应类型为二进制数据 |
| | | }, |
| | | success: function (res) { |
| | | // 创建一个临时的下载链接 |
| | | const url = window.URL.createObjectURL(res); |
| | | // 创建一个隐藏的 <a> 元素并设置下载链接 |
| | | const a = document.createElement("a"); |
| | | a.style.display = "none"; |
| | | a.href = url; |
| | | a.download = data.field.name + ".docx"; // 指定下载的文件名 |
| | | document.body.appendChild(a); |
| | | |
| | | // 触发点击事件以开始下载 |
| | | a.click(); |
| | | |
| | | // 清理临时资源 |
| | | setTimeout(function () { |
| | | window.URL.revokeObjectURL(url); |
| | | document.body.removeChild(a); |
| | | }, 100); |
| | | |
| | | layer.close(loadIndex); |
| | | layer.close(dIndex); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 合同明细 */ |
| | | function sales(mData) { |
| | | layer.open({ |
| | | type: 2, |
| | | title: '合同明细', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: false, |
| | | content: '../companyTargetSales/companyTargetSales.html?companyTargetId=' + mData.id, |
| | | success: function (layero, index) { |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //上传合同 |
| | | function upload(data) { |
| | | if (data.filepath == '' || data.filepath == null) { |
| | | layer.confirm('是否上传合同?', function () { |
| | | $("#uploadQuote").click() |
| | | }); |
| | | } else { |
| | | layer.confirm('已上传合同,是否继续覆盖上传?', function () { |
| | | $("#uploadQuote").click() |
| | | }); |
| | | } |
| | | |
| | | $("#uploadQuote").on("change", (evt) => { |
| | | var files = evt.target.files; |
| | | if (files == null || files.length == 0) { |
| | | alert("No files wait for import"); |
| | | return; |
| | | } |
| | | |
| | | let name = files[0].name; |
| | | let suffixArr = name.split("."), suffix = suffixArr[suffixArr.length - 1]; |
| | | // if(suffix!="xlsx"){ |
| | | // alert("Currently only supports the import of xlsx files"); |
| | | // return; |
| | | // } |
| | | |
| | | let formData = new FormData($("#uploadFile")[0]); |
| | | formData.append("id", data.id); |
| | | $.ajax({ |
| | | url: baseUrl + "/companyTarget/upload/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: formData, |
| | | method: 'POST', |
| | | cache: false, |
| | | processData: false, |
| | | contentType: false, |
| | | success: function (res) { |
| | | if (res.code == 200) { |
| | | layer.msg('上传成功', {time: 1000}, () => { |
| | | parent.location.reload() |
| | | }) |
| | | } else { |
| | | layer.msg(res.msg, {time: 1000}, () => { |
| | | parent.location.reload() |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | //下载合同 |
| | | function download(data) { |
| | | $.ajax({ |
| | | url: baseUrl + "/companyTarget/download/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data, |
| | | method: 'GET', |
| | | xhrFields: { |
| | | responseType: "blob" // 设置响应类型为二进制数据 |
| | | }, |
| | | success: function (res) { |
| | | // 创建一个临时的下载链接 |
| | | const url = window.URL.createObjectURL(res); |
| | | // 创建一个隐藏的 <a> 元素并设置下载链接 |
| | | const a = document.createElement("a"); |
| | | a.style.display = "none"; |
| | | a.href = url; |
| | | |
| | | let list = data.filepath.split(".") |
| | | let suffix = "." + list[list.length - 1]//获取后缀名 |
| | | a.download = data.name + suffix; // 指定下载的文件名 |
| | | document.body.appendChild(a); |
| | | |
| | | // 触发点击事件以开始下载 |
| | | a.click(); |
| | | |
| | | // 清理临时资源 |
| | | setTimeout(function () { |
| | | window.URL.revokeObjectURL(url); |
| | | document.body.removeChild(a); |
| | | }, 100); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + "/companyTarget/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {ids: ids}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200) { |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 搜索 |
| | | form.on('submit(search)', function (data) { |
| | | pageCurr = 1; |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 重置 |
| | | form.on('submit(reset)', function (data) { |
| | | pageCurr = 1; |
| | | clearFormVal($('#search-box')); |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 时间选择器 |
| | | function layDateRender(data) { |
| | | setTimeout(function () { |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | | , type: 'datetime' |
| | | , range: true |
| | | }); |
| | | layDate.render({ |
| | | elem: '#createTime\\$', |
| | | type: 'datetime', |
| | | value: data !== undefined ? data['createTime\\$'] : null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#updateTime\\$', |
| | | type: 'datetime', |
| | | value: data !== undefined ? data['updateTime\\$'] : null |
| | | }); |
| | | |
| | | }, 300); |
| | | } |
| | | |
| | | layDateRender(); |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#data-detail-close', function () { |
| | | parent.layer.closeAll(); |
| | | }); |
| | | |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: pageCurr} |
| | | }); |
| | | } |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title></title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | </head> |
| | | <body> |
| | | |
| | | <div class="layui-fluid"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar" id="search-box"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width: 300px"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline">  |
| | | <button class="layui-btn icon-btn" lay-filter="search" lay-submit> |
| | | <i class="layui-icon"></i>搜索 |
| | | </button> |
| | | <button class="layui-btn icon-btn" lay-filter="reset" lay-submit> |
| | | <i class="layui-icon"></i>重置 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <table class="layui-hide" id="companyPost" lay-filter="companyPost"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right">导出</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a> |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/companyPost/companyPost.js" charset="utf-8"></script> |
| | | </body> |
| | | <!-- 表单弹窗 --> |
| | | <script type="text/html" id="editDialog"> |
| | | <div id="detail" lay-filter="detail" class="layui-form admin-form model-form"> |
| | | <input name="id" type="hidden"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">公告标题: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="title" placeholder="请输入公告标题"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">公告内容: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="content" placeholder="请输入公告内容"> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <hr class="layui-bg-gray"> |
| | | <div class="layui-form-item text-right"> |
| | | <button class="layui-btn" lay-filter="editSubmit" lay-submit="">保存</button> |
| | | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> |
| | | </div> |
| | | </div> |
| | | </script> |
| | | </html> |
| | | |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title></title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | </head> |
| | | <body> |
| | | |
| | | <div class="layui-fluid"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar" id="search-box"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width: 300px"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline">  |
| | | <button class="layui-btn icon-btn" lay-filter="search" lay-submit> |
| | | <i class="layui-icon"></i>搜索 |
| | | </button> |
| | | <button class="layui-btn icon-btn" lay-filter="reset" lay-submit> |
| | | <i class="layui-icon"></i>重置 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <table class="layui-hide" id="companyTarget" lay-filter="companyTarget"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right">导出</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a> |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/companyTarget/companyTarget.js" charset="utf-8"></script> |
| | | </body> |
| | | <!-- 表单弹窗 --> |
| | | <script type="text/html" id="editDialog"> |
| | | <div id="detail" lay-filter="detail" class="layui-form admin-form model-form"> |
| | | <input name="id" type="hidden"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">年度: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="year" placeholder="请输入年度"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">目标交易额: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="target" placeholder="请输入目标交易额"> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <hr class="layui-bg-gray"> |
| | | <div class="layui-form-item text-right"> |
| | | <button class="layui-btn" lay-filter="editSubmit" lay-submit="">保存</button> |
| | | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> |
| | | </div> |
| | | </div> |
| | | </script> |
| | | </html> |
| | | |
| | |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">个人全年目标</label> |
| | | <div class="layui-input-inline"> |
| | | <input name="target" class="layui-input" type="text" placeholder="请输入" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">联系方式</label> |
| | | <div class="layui-input-inline"> |
| | | <input name="mobile" class="layui-input" type="text" placeholder="请输入" autocomplete="off"> |
| | |
| | | <div class="layui-col-xs12 layui-col-md8"> |
| | | <div class="layui-card" style=""> |
| | | <div class="layui-card-header">活动实时交易情况</div> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-card-body" style="padding-bottom: 20px;"> |
| | | <div class="layui-row"> |
| | | <div>团队数据</div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">今日交易总额</div> |
| | | <div class="numberInfoSubTitle">全年目标</div> |
| | | <div class="numberInfoValue"> |
| | | 124,543,233<em class="numberInfoSuffix">元</em> |
| | | <span id="companyYearTarget">124,543,233</span><em class="numberInfoSuffix">元</em> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">销售目标完成率</div> |
| | | <div class="numberInfoValue">92%</div> |
| | | </div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">活动剩余时间</div> |
| | | <div class="numberInfoValue">00:57:10</div> |
| | | </div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">每秒交易总额</div> |
| | | <div class="numberInfoSubTitle">已完成交易</div> |
| | | <div class="numberInfoValue"> |
| | | 234<em class="numberInfoSuffix">元</em> |
| | | <span id="companySuccess">124,543,233</span><em class="numberInfoSuffix">元</em> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">未完成交易</div> |
| | | <div class="numberInfoValue"> |
| | | <span id="companyProgress">124,543,233</span><em class="numberInfoSuffix">元</em> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">交易率</div> |
| | | <div class="numberInfoValue"><span id="companyRate">92</span>%</div> |
| | | </div> |
| | | </div> |
| | | <div style="text-align: center;padding: 30px 0 10px 0;"> |
| | | <img src="https://gw.alipayobjects.com/zos/rmsportal/HBWnDEUXCnGnGrRfrpKa.png" |
| | | style="max-height: 437px; max-width: 100%;" alt="map"> |
| | | <div class="layui-row" style="margin-top: 50px;"> |
| | | <div>个人数据</div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">全年目标</div> |
| | | <div class="numberInfoValue"> |
| | | <span id="personYearTarget">124,543,233</span><em class="numberInfoSuffix">元</em> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">已完成交易</div> |
| | | <div class="numberInfoValue"> |
| | | <span id="personSuccess">124,543,233</span><em class="numberInfoSuffix">元</em> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">未完成交易</div> |
| | | <div class="numberInfoValue"> |
| | | <span id="personProgress">124,543,233</span><em class="numberInfoSuffix">元</em> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-xs12 layui-col-sm6 layui-col-lg3 text-center"> |
| | | <div class="numberInfoSubTitle">交易率</div> |
| | | <div class="numberInfoValue"><span id="personRate">92</span>%</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-col-xs12 layui-col-md4"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-header">活动情况</div> |
| | | <div class="layui-card-body" style="height: 240px;overflow: hidden;"> |
| | | <div id="hdqkyc" style="width: 100%;height: 260px;"></div> |
| | | <div class="layui-card" style="height: 299px;overflow: hidden;"> |
| | | <div class="layui-card-header">公司公告</div> |
| | | <div class="layui-card-body" id="companyPostId"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-header">业绩效率</div> |
| | | <div class="layui-card-body" style="height: 222px;overflow: hidden;"> |
| | | <div id="hjxl" style="width: 100%;height: 280px;margin-top: -20px;"></div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-col-xs12"> |
| | |
| | | <div class="layui-card-body"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="tabZZT"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">销售额</li> |
| | | <li>访问量</li> |
| | | <li class="layui-this">交易额</li> |
| | | <!-- <li>访问量</li>--> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | |
| | | </colgroup> |
| | | <thead> |
| | | <tr style="background: none;color: #333;"> |
| | | <th colspan="3">员工销售额排行</th> |
| | | <th colspan="3">员工交易额排行</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | <tr> |
| | | <td><span class="layui-badge layui-bg-cyan">1</span></td> |
| | | <td>aaa</td> |
| | | <td>323,234</td> |
| | | </tr> |
| | | <tr> |
| | | <td><span class="layui-badge layui-bg-cyan">2</span></td> |
| | | <td>bbb</td> |
| | | <td>323,234</td> |
| | | </tr> |
| | | <tr> |
| | | <td><span class="layui-badge layui-bg-cyan">3</span></td> |
| | | <td>ccc</td> |
| | | <td>323,234</td> |
| | | </tr> |
| | | <tr> |
| | | <td><span class="layui-badge layui-bg-gray">4</span></td> |
| | | <td>ddd</td> |
| | | <td>323,234</td> |
| | | </tr> |
| | | <tr> |
| | | <td><span class="layui-badge layui-bg-gray">5</span></td> |
| | | <td>eee</td> |
| | | <td>323,234</td> |
| | | </tr> |
| | | <tr> |
| | | <td><span class="layui-badge layui-bg-gray">6</span></td> |
| | | <td>fff</td> |
| | | <td>323,234</td> |
| | | </tr> |
| | | <tr> |
| | | <td><span class="layui-badge layui-bg-gray">7</span></td> |
| | | <td>ggg</td> |
| | | <td>323,234</td> |
| | | </tr> |
| | | <tbody id="staffRankId"> |
| | | |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/echarts/echarts.min.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/echarts/echartsTheme.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | |
| | | <script> |
| | | layui.use(['layer', 'element'], function () { |
| | |
| | | var layer = layui.layer; |
| | | var element = layui.element; |
| | | |
| | | // 渲染活动情况预测 |
| | | var myCharts = echarts.init(document.getElementById('hdqkyc'), myEchartsTheme); |
| | | var mData = [50, 100, 150, 80, 120, 150, 200, 250, 220, 250, 300, 350, 400, 380, 440, 450, 500, 550, 500]; |
| | | var option = { |
| | | title: { |
| | | text: '有望达到预期', |
| | | subtext: '目标评估', |
| | | textStyle: { |
| | | color: '#000' |
| | | } |
| | | }, |
| | | tooltip: { |
| | | trigger: "axis" |
| | | }, |
| | | xAxis: [{ |
| | | type: "category", |
| | | boundaryGap: !1, |
| | | data: ["06:00", "06:30", "07:00", "07:30", "08:00", "08:30", "09:00", "09:30", "10:00", "11:30", "12:00", "12:30", "13:00", "13:30", "14:00", "14:30", "15:00", "15:30", "16:00"] |
| | | }], |
| | | yAxis: [{ |
| | | type: "value" |
| | | }], |
| | | series: [{ |
| | | name: "金额", |
| | | type: "line", |
| | | smooth: !0, |
| | | itemStyle: { |
| | | normal: { |
| | | areaStyle: { |
| | | type: "default" |
| | | } |
| | | } |
| | | }, |
| | | data: mData |
| | | }] |
| | | }; |
| | | myCharts.setOption(option); |
| | | |
| | | // 动态改变图表1数据 |
| | | setInterval(function () { |
| | | for (var i = 0; i < mData.length; i++) { |
| | | mData[i] += (Math.random() * 50 - 25); |
| | | if (mData[i] < 0) { |
| | | mData[i] = 0; |
| | | } |
| | | } |
| | | myCharts.setOption({ |
| | | series: [{ |
| | | data: mData |
| | | }] |
| | | }); |
| | | }, 1000); |
| | | |
| | | // 渲染券核效率图表 |
| | | var myCharts2 = echarts.init(document.getElementById('hjxl'), myEchartsTheme); |
| | | var option2 = { |
| | | tooltip: { |
| | | formatter: "{a} <br/>{b} : {c}%" |
| | | }, |
| | | series: [ |
| | | { |
| | | name: '业绩效率', |
| | | type: 'gauge', |
| | | detail: {formatter: '{value}%'}, |
| | | data: [{value: 80, name: '命中率'}] |
| | | } |
| | | ] |
| | | }; |
| | | myCharts2.setOption(option2); |
| | | |
| | | // 渲染销售额图表 |
| | | var myCharts3 = echarts.init(document.getElementById('xse'), myEchartsTheme); |
| | | var option3 = { |
| | | title: { |
| | | text: '销售趋势', |
| | | textStyle: { |
| | | color: '#000', |
| | | fontSize: 14 |
| | | } |
| | | }, |
| | | tooltip: {}, |
| | | grid: { |
| | | left: '0', |
| | | right: '0', |
| | | bottom: '0', |
| | | containLabel: true |
| | | }, |
| | | xAxis: { |
| | | data: ['1月', '2月', '3月', '4月', '6月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'] |
| | | }, |
| | | yAxis: {}, |
| | | series: [{ |
| | | type: 'bar', |
| | | data: [726, 1013, 690, 892, 982, 570, 536, 546, 988, 1002, 206, 506], |
| | | barMaxWidth: 45 |
| | | }] |
| | | }; |
| | | myCharts3.setOption(option3); |
| | | |
| | | // 渲染访问量图表 |
| | | var myCharts4 = echarts.init(document.getElementById('fwl'), myEchartsTheme); |
| | | var option4 = { |
| | | title: { |
| | | text: '访问量趋势', |
| | | textStyle: { |
| | | color: '#000', |
| | | fontSize: 14 |
| | | } |
| | | }, |
| | | tooltip: {}, |
| | | grid: { |
| | | left: '0', |
| | | right: '0', |
| | | bottom: '0', |
| | | containLabel: true |
| | | }, |
| | | xAxis: { |
| | | data: ['1月', '2月', '3月', '4月', '6月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'] |
| | | }, |
| | | yAxis: {}, |
| | | series: [{ |
| | | type: 'bar', |
| | | data: [558, 856, 880, 1325, 982, 856, 655, 546, 988, 985, 568, 302], |
| | | barMaxWidth: 45 |
| | | }] |
| | | }; |
| | | myCharts4.setOption(option4); |
| | | |
| | | // 切换选项卡重新渲染 |
| | | element.on('tab(tabZZT)', function (data) { |
| | | if (data.index == 0) { |
| | | myCharts3.resize(); |
| | | } else { |
| | | myCharts4.resize(); |
| | | //获取团队数据 |
| | | $.ajax({ |
| | | url: baseUrl + "/dashboard/companyData/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {}, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | $("#companyYearTarget").text(res.data.yearTarget) |
| | | $("#companySuccess").text(res.data.successMoney) |
| | | $("#companyProgress").text(res.data.progressMoney) |
| | | $("#companyRate").text(res.data.yearTransactionRate) |
| | | } |
| | | }); |
| | | |
| | | //获取个人数据 |
| | | $.ajax({ |
| | | url: baseUrl + "/dashboard/personData/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {}, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | $("#personYearTarget").text(res.data.yearTarget) |
| | | $("#personSuccess").text(res.data.successMoney) |
| | | $("#personProgress").text(res.data.progressMoney) |
| | | $("#personRate").text(res.data.yearTransactionRate) |
| | | } |
| | | }); |
| | | |
| | | //获取员工交易额排行 |
| | | $.ajax({ |
| | | url: baseUrl + "/dashboard/staffRank/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {}, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | let data = res.data |
| | | for (var i = 0; i < data.length; i++) { |
| | | let div = "<tr>"; |
| | | if (i < 3) { |
| | | div += "<td><span class='layui-badge layui-bg-cyan'>" + (i+1) + "</span></td>" |
| | | }else { |
| | | div += "<td><span class='layui-badge layui-bg-gray'>" + (i+1) + "</span></td>" |
| | | } |
| | | |
| | | div += "<td>" + data[i].username + "</td>" |
| | | div += "<td>" + data[i].money + "</td>" |
| | | div += "</tr>" |
| | | |
| | | $("#staffRankId").append(div) |
| | | } |
| | | } |
| | | }); |
| | | |
| | | //获取公司公告 |
| | | $.ajax({ |
| | | url: baseUrl + "/companyPost/list/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {}, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | let data = res.data.records |
| | | for (var i = 0; i < data.length; i++) { |
| | | let div = "<div style='margin-top: 10px;'>"; |
| | | div += '<span class="layui-badge-dot layui-bg-green" style="margin-right: 10px;"></span>' |
| | | div += data[i].content |
| | | div += "</div>" |
| | | |
| | | $("#companyPostId").append(div) |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 渲染交易趋势图表 |
| | | var myCharts3 = echarts.init(document.getElementById('xse'), myEchartsTheme); |
| | | //获取获取当前年度12个月的交易成功数据 |
| | | $.ajax({ |
| | | url: baseUrl + "/dashboard/currentMonthData/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {}, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | let data = res.data |
| | | var option3 = { |
| | | title: { |
| | | text: '交易趋势', |
| | | textStyle: { |
| | | color: '#000', |
| | | fontSize: 14 |
| | | } |
| | | }, |
| | | tooltip: {}, |
| | | grid: { |
| | | left: '0', |
| | | right: '0', |
| | | bottom: '0', |
| | | containLabel: true |
| | | }, |
| | | xAxis: { |
| | | data: ['1月', '2月', '3月', '4月', '6月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'] |
| | | }, |
| | | yAxis: {}, |
| | | series: [{ |
| | | type: 'bar', |
| | | data: data, |
| | | barMaxWidth: 45 |
| | | }] |
| | | }; |
| | | myCharts3.setOption(option3); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // // 渲染访问量图表 |
| | | // var myCharts4 = echarts.init(document.getElementById('fwl'), myEchartsTheme); |
| | | // var option4 = { |
| | | // title: { |
| | | // text: '访问量趋势', |
| | | // textStyle: { |
| | | // color: '#000', |
| | | // fontSize: 14 |
| | | // } |
| | | // }, |
| | | // tooltip: {}, |
| | | // grid: { |
| | | // left: '0', |
| | | // right: '0', |
| | | // bottom: '0', |
| | | // containLabel: true |
| | | // }, |
| | | // xAxis: { |
| | | // data: ['1月', '2月', '3月', '4月', '6月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'] |
| | | // }, |
| | | // yAxis: {}, |
| | | // series: [{ |
| | | // type: 'bar', |
| | | // data: [558, 856, 880, 1325, 982, 856, 655, 546, 988, 985, 568, 302], |
| | | // barMaxWidth: 45 |
| | | // }] |
| | | // }; |
| | | // myCharts4.setOption(option4); |
| | | // |
| | | // // 切换选项卡重新渲染 |
| | | // element.on('tab(tabZZT)', function (data) { |
| | | // if (data.index == 0) { |
| | | // myCharts3.resize(); |
| | | // } else { |
| | | // myCharts4.resize(); |
| | | // } |
| | | // }); |
| | | |
| | | // 窗口大小改变事件 |
| | | window.onresize = function () { |
| | | myCharts.resize(); |
| | | myCharts2.resize(); |
| | | myCharts3.resize(); |
| | | myCharts4.resize(); |
| | | }; |
| | | |
| | | }); |