Commit 10217e9e authored by hehongwei's avatar hehongwei

32类物料导出

parent c7d27cf4
...@@ -6,7 +6,6 @@ import java.util.List; ...@@ -6,7 +6,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.activiti.service.IProcessService; import com.ruoyi.activiti.service.IProcessService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -20,9 +19,6 @@ import com.ruoyi.activiti.service.IBizExampleDemoService; ...@@ -20,9 +19,6 @@ import com.ruoyi.activiti.service.IBizExampleDemoService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import static com.ruoyi.common.core.domain.AjaxResult.error;
import static com.ruoyi.common.core.domain.AjaxResult.success;
/** /**
* 示例DemoController * 示例DemoController
* *
......
...@@ -35,8 +35,6 @@ import java.io.ByteArrayInputStream; ...@@ -35,8 +35,6 @@ import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import static com.ruoyi.common.core.domain.AjaxResult.error;
import static com.ruoyi.common.core.domain.AjaxResult.success;
import static org.activiti.editor.constants.ModelDataJsonConstants.MODEL_DESCRIPTION; import static org.activiti.editor.constants.ModelDataJsonConstants.MODEL_DESCRIPTION;
import static org.activiti.editor.constants.ModelDataJsonConstants.MODEL_NAME; import static org.activiti.editor.constants.ModelDataJsonConstants.MODEL_NAME;
......
...@@ -28,7 +28,6 @@ public class ActSuppliesController extends BaseController ...@@ -28,7 +28,6 @@ public class ActSuppliesController extends BaseController
@Autowired @Autowired
private IActSuppliesService actSuppliesService; private IActSuppliesService actSuppliesService;
@PreAuthorize("@ss.hasPermi('Actsupplies:Actsupplies:options')") @PreAuthorize("@ss.hasPermi('Actsupplies:Actsupplies:options')")
@GetMapping("/options") @GetMapping("/options")
@ResponseBody @ResponseBody
......
...@@ -3,6 +3,7 @@ package com.ruoyi.system.controller; ...@@ -3,6 +3,7 @@ package com.ruoyi.system.controller;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.ActOperation1; import com.ruoyi.system.domain.ActOperation1;
import com.ruoyi.system.domain.ActSuppliesImportCleaningAcc;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -200,5 +201,16 @@ public class ActSuppliesHistorydataController extends BaseController ...@@ -200,5 +201,16 @@ public class ActSuppliesHistorydataController extends BaseController
return toAjax(1); return toAjax(1);
} }
/**
* 数据清洗 通用导入表数据
*/
@PreAuthorize("@ss.hasPermi('system:historydata:selectActsuppliesCleaningCopyAcc')")
@GetMapping("/selectActsuppliesCleaningCopyAcc/{id}")
public TableDataInfo selectActsuppliesCleaningCopyAcc(@PathVariable("id") Long id)
{
List<ActSuppliesImportCleaningAcc> actSuppliesImportCleaningAccs = actSuppliesHistorydataService.selectActSuppliesCleaningCopyAcc(id);
return getDataTable(actSuppliesImportCleaningAccs);
}
} }
...@@ -34,4 +34,6 @@ public interface ActSuppliesCleaningRuleMapper ...@@ -34,4 +34,6 @@ public interface ActSuppliesCleaningRuleMapper
void addInsertConvertAcc(ActSuppliesImportTable actSuppliesImportTable); void addInsertConvertAcc(ActSuppliesImportTable actSuppliesImportTable);
void addActSuppliesImportCleaningAcc(ActSuppliesImportCleaningAcc actSuppliesImportCleaningAcc); void addActSuppliesImportCleaningAcc(ActSuppliesImportCleaningAcc actSuppliesImportCleaningAcc);
List<ActSuppliesImportCleaningAcc> selectActSuppliesCleaningCopy(Long id);
} }
...@@ -97,4 +97,8 @@ public interface ActSuppliesHistorydataMapper ...@@ -97,4 +97,8 @@ public interface ActSuppliesHistorydataMapper
void updateActSuppliesHistorydataStatusByIdAcc(Long gethId); void updateActSuppliesHistorydataStatusByIdAcc(Long gethId);
List<ActSuppliesHistorydata> selectActSuppliesHistorydataAcc(Integer tylkStatus); List<ActSuppliesHistorydata> selectActSuppliesHistorydataAcc(Integer tylkStatus);
List<ActSuppliesHistorydata> selectActSuppliesHistorydataCopyList(ActSuppliesHistorydata actSuppliesHistorydata);
ActSuppliesHistorydata selectActSuppliesHistorydataCopyById(Long id);
} }
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.system.domain.ActOperation1; import com.ruoyi.system.domain.ActOperation1;
import com.ruoyi.system.domain.ActSuppliesHistorydata; import com.ruoyi.system.domain.ActSuppliesHistorydata;
import com.ruoyi.system.domain.ActSuppliesImportCleaningAcc;
/** /**
* 历史数据Service接口 * 历史数据Service接口
...@@ -90,4 +91,6 @@ public interface IActSuppliesHistorydataService ...@@ -90,4 +91,6 @@ public interface IActSuppliesHistorydataService
void addInsertActSuppliesHistorydataAcc(List<ActSuppliesHistorydata> actSuppliesHistorydata); void addInsertActSuppliesHistorydataAcc(List<ActSuppliesHistorydata> actSuppliesHistorydata);
List<ActSuppliesHistorydata> selectActSuppliesHistorydataAcc(Integer tylkStatus); List<ActSuppliesHistorydata> selectActSuppliesHistorydataAcc(Integer tylkStatus);
List<ActSuppliesImportCleaningAcc> selectActSuppliesCleaningCopyAcc(Long id);
} }
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -47,7 +48,9 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat ...@@ -47,7 +48,9 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
@Override @Override
public ActSuppliesHistorydata selectActSuppliesHistorydataById(Long id) public ActSuppliesHistorydata selectActSuppliesHistorydataById(Long id)
{ {
return actSuppliesHistorydataMapper.selectActSuppliesHistorydataById(id); //return actSuppliesHistorydataMapper.selectActSuppliesHistorydataById(id);
return actSuppliesHistorydataMapper.selectActSuppliesHistorydataCopyById(id);
} }
/** /**
...@@ -60,8 +63,10 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat ...@@ -60,8 +63,10 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
public List<ActSuppliesHistorydata> selectActSuppliesHistorydataList(ActSuppliesHistorydata actSuppliesHistorydata) public List<ActSuppliesHistorydata> selectActSuppliesHistorydataList(ActSuppliesHistorydata actSuppliesHistorydata)
{ {
SysUser user = SecurityUtils.getLoginUser().getUser(); SysUser user = SecurityUtils.getLoginUser().getUser();
actSuppliesHistorydata.setCreateBy(user.getUserName()); actSuppliesHistorydata.setCreateBy(user.getUserName());
return actSuppliesHistorydataMapper.selectActSuppliesHistorydataList(actSuppliesHistorydata); //return actSuppliesHistorydataMapper.selectActSuppliesHistorydataList(actSuppliesHistorydata);
return actSuppliesHistorydataMapper.selectActSuppliesHistorydataCopyList(actSuppliesHistorydata);
} }
/** /**
...@@ -719,7 +724,9 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat ...@@ -719,7 +724,9 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
actSuppliesImportCleaningAcc.setMoneyColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("MoneyColumn") - 1)].getV()); actSuppliesImportCleaningAcc.setMoneyColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("MoneyColumn") - 1)].getV());
BigDecimal moneyColumn1 = new BigDecimal(Double.parseDouble(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("MoneyColumn") - 1)].getV())); BigDecimal moneyColumn1 = new BigDecimal(Double.parseDouble(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("MoneyColumn") - 1)].getV()));
BigDecimal moneyColumn2 = new BigDecimal(Double.parseDouble(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("NumberColumn") - 1)].getV())); BigDecimal moneyColumn2 = new BigDecimal(Double.parseDouble(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("NumberColumn") - 1)].getV()));
actSuppliesImportCleaningAcc.setMoneyColumns(Double.toString(moneyColumn1.multiply(moneyColumn2).doubleValue())); DecimalFormat df = new DecimalFormat("#.00");
actSuppliesImportCleaningAcc.setMoneyColumns(df.format(Double.parseDouble(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("MoneyColumn") - 1)].getV())*Double.parseDouble(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("NumberColumn") - 1)].getV())));
Object dateColumn = parse.getJSONObject(0).get("DateColumn"); Object dateColumn = parse.getJSONObject(0).get("DateColumn");
if(parse.getJSONObject(0).get("DateColumn").hashCode()>0){ if(parse.getJSONObject(0).get("DateColumn").hashCode()>0){
actSuppliesImportCleaningAcc.setDateColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("DateColumn") - 1)].getV()); actSuppliesImportCleaningAcc.setDateColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("DateColumn") - 1)].getV());
...@@ -749,7 +756,6 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat ...@@ -749,7 +756,6 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
} }
//修改历史表中的数据状态(是否清洗) //修改历史表中的数据状态(是否清洗)
actSuppliesHistorydataMapper.updateActSuppliesHistorydataStatusByIdAcc(actOperation2s.get(i).gethId()); actSuppliesHistorydataMapper.updateActSuppliesHistorydataStatusByIdAcc(actOperation2s.get(i).gethId());
...@@ -801,4 +807,12 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat ...@@ -801,4 +807,12 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
} }
@Override
public List<ActSuppliesImportCleaningAcc> selectActSuppliesCleaningCopyAcc(Long id) {
return actSuppliesCleaningRuleMapper.selectActSuppliesCleaningCopy(id);
}
} }
...@@ -22,6 +22,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -22,6 +22,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
</resultMap> </resultMap>
<resultMap type="ActSuppliesImportCleaningAcc" id="ActSuppliesImportCleaningResultAcc">
<result property="id" column="id" />
<result property="hId" column="h_id" />
<result property="sskId" column="ssk_id" />
<result property="hdate" column="hdate" />
<result property="kmCode" column="km_code"/>
<result property="nameColumn" column="name_column"/>
<result property="codeColumn" column="code_column" />
<result property="departmentColumn" column="department_column" />
<result property="numberColumn" column="number_column" />
<result property="moneyColumn" column="money_column" />
<result property="moneyColumns" column="money_columns" />
<result property="dateColumn" column="date_column" />
<result property="sOfExpenses" column="source_of_expenses" />
<result property="categories" column="categories" />
</resultMap>
<select id="selectActSuppliesCleaningCopy" parameterType="Long" resultMap="ActSuppliesImportCleaningResultAcc">
SELECT ssk_id,hdate,department_column,categories,source_of_expenses,SUM(number_column) number_column,SUM(money_column) money_column,SUM(money_columns) money_columns FROM act_supplies_import_cleaning_copy1 WHERE hid = #{id} GROUP BY department_column,categories,hdate,ssk_id,source_of_expenses
</select>
<insert id="insertActSuppliesImportCleaning" parameterType="ActSuppliesImportCleaning" useGeneratedKeys="true" keyProperty="id"> <insert id="insertActSuppliesImportCleaning" parameterType="ActSuppliesImportCleaning" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_import_cleaning insert into act_supplies_import_cleaning
......
...@@ -46,6 +46,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -46,6 +46,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectActSuppliesHistorydataCopyList" parameterType="ActSuppliesHistorydata" resultMap="ActSuppliesHistorydataResult">
<!--<include refid="selectActSuppliesHistorydataVo"/>-->
SELECT t1.id, t1.template_id, t2.template_name, t1.import_uuid, t1.export_uuid, t1.history_name, t1.history_role, t1.identifying_code, t1.status, t1.create_by, t1.create_time, t1.clean_status
FROM act_supplies_historydata_copy1 t1
LEFT JOIN act_supplies_template t2 ON t1.template_id = t2.id
<where>
<if test="templateName != null and templateName != ''"> and t2.template_name like concat('%', #{templateName}, '%')</if>
<if test="historyName != null and historyName != ''"> and history_name like concat('%', #{historyName}, '%')</if>
<if test="identifyingCode != null "> and identifying_code = #{identifyingCode}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectActSuppliesHistorydataById" parameterType="Long" resultMap="ActSuppliesHistorydataResult"> <select id="selectActSuppliesHistorydataById" parameterType="Long" resultMap="ActSuppliesHistorydataResult">
SELECT t1.id, t1.template_id, t1.import_uuid, t1.export_uuid, t1.role_id, t1.history_name, t1.history_role,t2.history_content, t1.identifying_code, t1.status, t1.create_by, t1.create_time SELECT t1.id, t1.template_id, t1.import_uuid, t1.export_uuid, t1.role_id, t1.history_name, t1.history_role,t2.history_content, t1.identifying_code, t1.status, t1.create_by, t1.create_time
FROM act_supplies_historydata t1 FROM act_supplies_historydata t1
...@@ -55,6 +69,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -55,6 +69,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectActSuppliesHistorydataCopyById" parameterType="Long" resultMap="ActSuppliesHistorydataResult">
SELECT t1.id, t1.template_id, t1.import_uuid, t1.export_uuid, t1.history_name, t1.history_role,t2.history_content, t1.identifying_code, t1.status, t1.create_by, t1.create_time
FROM act_supplies_historydata_copy1 t1
LEFT JOIN act_supplies_historycontent_copy1 t2 ON t1.import_uuid = t2.hid
<where>
t1.id = #{id}
</where>
</select>
<insert id="insertActSuppliesHistorydata" parameterType="ActSuppliesHistorydata" useGeneratedKeys="true" keyProperty="id"> <insert id="insertActSuppliesHistorydata" parameterType="ActSuppliesHistorydata" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_historydata insert into act_supplies_historydata
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
......
...@@ -3,115 +3,122 @@ import LuckyExcel from "luckyexcel"; ...@@ -3,115 +3,122 @@ import LuckyExcel from "luckyexcel";
// 查询 历史数据列表 // 查询 历史数据列表
export function listHistorydata(query) { export function listHistorydata(query) {
return request({ return request({
url: '/system/historydata/list', url: '/system/historydata/list',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 查询 历史数据详细 // 查询 历史数据详细
export function getHistorydata(id) { export function getHistorydata(id) {
return request({ return request({
url: '/system/historydata/' + id, url: '/system/historydata/' + id,
method: 'get' method: 'get'
}) })
} }
// 新增 历史数据 // 新增 历史数据
export function addHistorydata(data) { export function addHistorydata(data) {
return request({ return request({
url: '/system/historydata', url: '/system/historydata',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 修改 历史数据 // 修改 历史数据
export function updateHistorydata(data) { export function updateHistorydata(data) {
return request({ return request({
url: '/system/historydata', url: '/system/historydata',
method: 'put', method: 'put',
data: data data: data
}) })
} }
// 删除 历史数据 // 删除 历史数据
export function delHistorydata(id) { export function delHistorydata(id) {
return request({ return request({
url: '/system/historydata/' + id, url: '/system/historydata/' + id,
method: 'delete' method: 'delete'
}) })
} }
// 导出 历史数据 // 导出 历史数据
export function exportHistorydata(query) { export function exportHistorydata(query) {
return request({ return request({
url: '/system/historydata/export', url: '/system/historydata/export',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 新增 历史数据 // 新增 历史数据
export function addInsert(data) { export function addInsert(data) {
return request({ return request({
url: '/system/historydata/addInsertAccount', url: '/system/historydata/addInsertAccount',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 数据清洗 历史数据 // 数据清洗 历史数据
export function addInsert1(data) { export function addInsert1(data) {
return request({ return request({
url: '/system/historydata/addInsert1', url: '/system/historydata/addInsert1',
method: 'post', method: 'post',
data: data data: data
}) })
} }
//清洗通用凭证单 //清洗通用凭证单
export function addInsertAccount1(data) { export function addInsertAccount1(data) {
return request({ return request({
url: '/system/historydata/addInsertAccount1', url: '/system/historydata/addInsertAccount1',
method: 'post', method: 'post',
data: data data: data
}) })
} }
//清洗通用凭证单 //清洗通用凭证单
export function addInsertAccount2(data) { export function addInsertAccount2(data) {
console.log(data,'我发送的数据') console.log(data, '我发送的数据')
return request({ return request({
url: '/system/historydata/addInsertAccount2', url: '/system/historydata/addInsertAccount2',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 数据清洗 历史数据 // 数据清洗 历史数据
export function addInsert2(data) { export function addInsert2(data) {
return request({ return request({
url: '/system/historydata/addInsert2', url: '/system/historydata/addInsert2',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 数据清洗 历史数据 // 数据清洗 历史数据
export function addInsertConvert1(data) { export function addInsertConvert1(data) {
return request({ return request({
url: '/system/historydata/addInsertConvert1', url: '/system/historydata/addInsertConvert1',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 数据清洗 历史数据 // 数据清洗 历史数据
export function addInsertConvert2(data) { export function addInsertConvert2(data) {
return request({ return request({
url: '/system/historydata/addInsertConvert2', url: '/system/historydata/addInsertConvert2',
method: 'post', method: 'post',
data: data data: data
}) })
}
//导出32类材料
export function selectExport(id) {
return request({
url: 'system/historydata/selectActsuppliesCleaningCopyAcc/'+id,
method: 'get'
})
} }
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="模板" prop="templateName"> <el-form-item label="模板" prop="templateName">
<el-input <el-input v-model="queryParams.templateName" placeholder="请输入模板" clearable size="small"
v-model="queryParams.templateName" @keyup.enter.native="handleQuery" />
placeholder="请输入模板" </el-form-item>
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="规则" prop="roleName"> <el-form-item label="规则" prop="roleName">
<el-input <el-input v-model="queryParams.roleName" placeholder="请输入规则" clearable size="small"
v-model="queryParams.roleName" @keyup.enter.native="handleQuery" />
placeholder="请输入规则" </el-form-item>
clearable <el-form-item label="标题" prop="historyName">
size="small" <el-input v-model="queryParams.historyName" placeholder="请输入标题" clearable size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery" />
/> </el-form-item>
</el-form-item> <el-form-item label="导入导出" prop="identifyingCode">
<el-form-item label="标题" prop="historyName"> <el-input v-model="queryParams.identifyingCode" placeholder="请输入导入导出标识" clearable size="small"
<el-input @keyup.enter.native="handleQuery" />
v-model="queryParams.historyName" </el-form-item>
placeholder="请输入标题" <el-form-item>
clearable <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
size="small" <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@keyup.enter.native="handleQuery" </el-form-item>
/> </el-form>
</el-form-item>
<el-form-item label="导入导出" prop="identifyingCode">
<el-input
v-model="queryParams.identifyingCode"
placeholder="请输入导入导出标识"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
type="warning" v-hasPermi="['system:historydata:export']">导出</el-button>
plain </el-col>
icon="el-icon-download" <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
size="mini" </el-row>
@click="handleExport" <el-table v-loading="loading" :data="historydataList" @selection-change="handleSelectionChange">
v-hasPermi="['system:historydata:export']" <el-table-column type="selection" width="55" align="center" />
>导出</el-button> <el-table-column label="序号" align="center" prop="id" />
</el-col> <el-table-column label="模板" align="center" prop="templateName" />
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <el-table-column label="规则" align="center" prop="roleName" />
</el-row> <el-table-column label="标题" align="center" prop="historyName" />
<el-table v-loading="loading" :data="historydataList" @selection-change="handleSelectionChange"> <el-table-column label="导入导出" align="center" prop="identifyingCode">
<el-table-column type="selection" width="55" align="center" /> <template slot-scope="scope">
<el-table-column label="序号" align="center" prop="id" /> <span v-if="scope.row.identifyingCode == 0">导入</span>
<el-table-column label="模板" align="center" prop="templateName" /> <span v-if="scope.row.identifyingCode == 1">导出</span>
<el-table-column label="规则" align="center" prop="roleName" /> </template>
<el-table-column label="标题" align="center" prop="historyName" /> </el-table-column>
<el-table-column label="导入导出" align="center" prop="identifyingCode"> <el-table-column label="操作时间" align="center" prop="createTime" />
<template slot-scope="scope"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<span v-if="scope.row.identifyingCode==0">导入</span> <template slot-scope="scope">
<span v-if="scope.row.identifyingCode==1">导出</span> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleDetails(scope.row)"
</template> v-hasPermi="['system:historydata']">详情</el-button>
</el-table-column> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
<el-table-column label="操作时间" align="center" prop="createTime" /> v-hasPermi="['system:historydata:remove']">删除</el-button>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleDetails(scope.row)"
v-hasPermi="['system:historydata']"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:historydata:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination <el-button v-if="scope.row.identifyingCode == 0 && scope.row.cleanStatus == 1" type="text"
v-show="total>0" icon="el-icon-upload2" size="mini" @click="exportSuccess(scope.row.id)">查看32类</el-button>
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div id="luckysheet" :style="{ position: positionValue, top: '0', left: '0', right: '0', bottom: '0' }"></div> </template>
</el-table-column>
</el-table>
</div> <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<div id="luckysheet" :style="{ position: positionValue, top: '0', left: '0', right: '0', bottom: '0' }"></div>
</div>
</template> </template>
<style> <style>
#luckysheet_info_detail_title { #luckysheet_info_detail_title {
display: none; display: none;
} }
#luckysheet_info_detail_update { #luckysheet_info_detail_update {
display: none; display: none;
} }
#luckysheet_info_detail_save { #luckysheet_info_detail_save {
display: none; display: none;
} }
.luckysheet-share-logo { .luckysheet-share-logo {
display: none; display: none;
} }
</style> </style>
<script> <script>
import { listHistorydata, getHistorydata, delHistorydata, addHistorydata, updateHistorydata, exportHistorydata } from "@/api/system/historydata"; import { listHistorydata, getHistorydata, delHistorydata, addHistorydata, updateHistorydata, exportHistorydata, selectExport } from "@/api/system/historydata";
import Editor from '@/components/Editor'; import Editor from '@/components/Editor';
import $ from 'jquery'; import { getSuppliesTemplate } from "@/api/ruoyi-myLuckyexcel/myluckyexcel";
import XLSX from 'xlsx'; import $ from 'jquery';
import LuckyExcel from 'luckyexcel'; import { exportExcel } from '../../../../public/exportExcel'
import { Loading } from 'element-ui'; import XLSX from 'xlsx';
export default { import LuckyExcel from 'luckyexcel';
name: "Historydata", import { Loading } from 'element-ui';
components: { export default {
Editor, name: "Historydata",
}, components: {
data() { Editor,
return { },
positionValue: 'static', data() {
return {
miningValue: [
{
name: '东欢坨矿',
id: '010102'
},
{
name: '范矿',
id: 2
},
{
name: '范各庄',
id: '011701'
},
{
name: '林西矿',
id: '011704'
},
{
name: '吕矿',
id: '011702'
},
{
name: '唐山矿',
id: '010101'
},
{
name: '单侯煤矿',
id: '011204'
},
{
name: '钱家营矿',
id: '010105'
},
],
positionValue: 'static',
newArray: '',
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 历史数据表格数据
historydataList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
importUuid: null,
templateId: null,
exportUuid: null,
roleId: null,
historyName: null,
historyContent: null,
identifyingCode: null,
status: null,
},
// 表单参数
form: {},
// 遮罩层 };
loading: true, },
// 选中数组 created() {
ids: [], this.getList();
// 非单个禁用 this.positionValue = "static";
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 历史数据表格数据
historydataList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
importUuid: null,
templateId: null,
exportUuid: null,
roleId: null,
historyName: null,
historyContent: null,
identifyingCode: null,
status: null,
},
// 表单参数
form: {},
}; },
}, mounted() {
created() { window.handleExportButtonClick = this.handleExportButtonClick
this.getList(); window.handleReturnButtonClick = this.handleReturnButtonClick;
this.positionValue = "static";
}, },
mounted() { methods: {
/** 查询 历史数据列表 */
getList() {
this.loading = true;
listHistorydata(this.queryParams).then(response => {
this.historydataList = response.rows;
this.total = response.total;
this.loading = false;
});
getSuppliesTemplate(10).then(response => {
const sysSupplies = response.rows;
this.newArray = JSON.parse(sysSupplies[0].templateContent);
})
window.handleReturnButtonClick = this.handleReturnButtonClick;
}, },
methods: {
/** 查询 历史数据列表 */ // 取消按钮
getList() { cancel() {
this.loading = true; this.open = false;
listHistorydata(this.queryParams).then(response => { this.reset();
this.historydataList = response.rows; },
this.total = response.total; // 表单重置
this.loading = false; reset() {
}); this.form = {
}, id: null,
// 取消按钮 importUuid: null,
cancel() { templateId: null,
this.open = false; exportUuid: null,
this.reset(); roleId: null,
}, historyName: null,
// 表单重置 historyContent: null,
reset() { identifyingCode: null,
this.form = { status: 0,
id: null, createBy: null,
importUuid: null, createTime: null
templateId: null, };
exportUuid: null, this.resetForm("form");
roleId: null, },
historyName: null, /** 搜索按钮操作 */
historyContent: null, handleQuery() {
identifyingCode: null, this.queryParams.pageNum = 1;
status: 0, this.getList();
createBy: null, },
createTime: null /** 重置按钮操作 */
}; resetQuery() {
this.resetForm("form"); this.resetForm("queryForm");
}, this.handleQuery();
/** 搜索按钮操作 */ },
handleQuery() { // 多选框选中数据
this.queryParams.pageNum = 1; handleSelectionChange(selection) {
this.getList(); this.ids = selection.map(item => item.id)
}, this.single = selection.length !== 1
/** 重置按钮操作 */ this.multiple = !selection.length
resetQuery() { },
this.resetForm("queryForm"); /** 新增按钮操作 */
this.handleQuery(); handleAdd() {
}, this.reset();
// 多选框选中数据 this.open = true;
handleSelectionChange(selection) { this.title = "添加 历史数据";
this.ids = selection.map(item => item.id) },
this.single = selection.length!==1 /** 修改按钮操作 */
this.multiple = !selection.length handleUpdate(row) {
}, this.reset();
/** 新增按钮操作 */ const id = row.id || this.ids
handleAdd() { getHistorydata(id).then(response => {
this.reset(); this.form = response.data;
this.open = true; this.open = true;
this.title = "添加 历史数据"; this.title = "修改 历史数据";
}, });
/** 修改按钮操作 */ },
handleUpdate(row) { /** 提交按钮 */
this.reset(); submitForm() {
const id = row.id || this.ids this.$refs["form"].validate(valid => {
getHistorydata(id).then(response => { if (valid) {
this.form = response.data; if (this.form.id != null) {
this.open = true; updateHistorydata(this.form).then(response => {
this.title = "修改 历史数据"; this.msgSuccess("修改成功");
}); this.open = false;
}, this.getList();
/** 提交按钮 */ });
submitForm() { } else {
this.$refs["form"].validate(valid => { addHistorydata(this.form).then(response => {
if (valid) { this.msgSuccess("新增成功");
if (this.form.id != null) { this.open = false;
updateHistorydata(this.form).then(response => { this.getList();
this.msgSuccess("修改成功"); });
this.open = false; }
this.getList(); }
}); });
} else { },
addHistorydata(this.form).then(response => { async handleDetails(row) {
this.msgSuccess("新增成功"); const id = row.id || this.ids;
this.open = false;
this.getList();
});
}
}
});
},
handleDetails(row) {
this.positionValue = 'absolute'; try {
luckysheet.destroy(); const response = await getHistorydata(id);
luckysheet.create({ this.form = response.data;
container: "luckysheet", // Luckysheet 的容器元素 ID this.open = true;
title: row.historyName, // Excel 文件名 this.title = "修改历史数据";
data: JSON.parse(row.historyContent), // Excel 数据
showtoolbar: false, //是否第二列显示工具栏
showinfobar: true, //是否显示顶部名称栏
showsheetbar: false, //是否显示底部表格名称区域
pointEdit: false, //是否是编辑器插入表格模式
pointEditUpdate: null, //编辑器表格更新函数
allowEdit: false,//作用:是否允许前台编辑
functionButton: '<button id="exportButton" class="btn btn-primary" style=" padding:3px 6px; font-size: 16px;width: 100px;height: 27px; margin-right: 85px;" onclick="handleReturnButtonClick()">返回</button>',
}); this.positionValue = 'absolute';
luckysheet.destroy();
luckysheet.create({
container: "luckysheet",
title: row.historyName,
data: JSON.parse(this.form.historyContent),
showtoolbar: false,
showinfobar: true,
showsheetbar: false,
pointEdit: false,
pointEditUpdate: null,
allowEdit: false,
functionButton: '<button id="exportButton" class="btn btn-primary" style=" padding:3px 6px; font-size: 16px;width: 100px;height: 27px; margin-right: 85px;" onclick="handleReturnButtonClick()">返回</button>',
});
} catch (error) {
console.error(error);
}
},
/**详情返回按钮 */
handleReturnButtonClick() {
this.positionValue = 'static';
luckysheet.destroy();
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除 历史数据编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return delHistorydata(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有 历史数据数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return exportHistorydata(queryParams);
}).then(response => {
this.download(response.msg);
})
},
//32类导出操作
handleExportButtonClick: debounce(function () {
let trueORfalse = true
let fileName = '32类汇总表'
exportExcel(luckysheet.getAllSheets(), fileName, trueORfalse);
}, 500),
exportSuccess(value) {
selectExport(value).then(response => {
if (response.rows.length == 0) {
this.$message({
message: '清洗未完成',
type: 'warning'
});
} else {
this.Export(response.rows)
}
})
},
Export(newobj) {
this.open = true;
this.positionValue = 'absolute';
luckysheet.destroy();
luckysheet.create({
container: "luckysheet", // Luckysheet 的容器元素 ID
title: '', // Excel 文件名
data: this.newArray, // Excel 数据
showinfobar: false, //是否显示顶部名称栏
lang: 'zh',
showtoolbar: false,
showinfobar: true,
showsheetbar: false,
pointEdit: false,
pointEditUpdate: null,
allowEdit: false,
functionButton: `
<button id="exportButton" class="btn btn-primary" style=" padding:3px 6px; font-size: 16px;width: 100px;height: 27px; margin-right: 120px;" onclick="handleExportButtonClick()">导出</button><button id="exportButton" class="btn btn-primary" style=" padding:3px 6px; font-size: 16px;width: 100px;height: 27px; margin-right: 85px;" onclick="handleReturnButtonClick()">返回</button>` ,
});
let head = this.newArray[0].celldata.filter(obj => obj.r > 2 && obj.c == 0)
//哈希对比
const headMap = head.reduce((map, item) => {
map[item.v.v] = item.r;
return map;
}, {});
newobj.forEach(obj => {
const columnValue = obj.categories;
if (headMap.hasOwnProperty(columnValue)) {
obj.r = headMap[columnValue];
}
});
//从小往大排
newobj.sort((a, b) => a.r - b.r);
let result = [];
newobj.forEach(function (obj) {
let index = result.findIndex(item => item.r === obj.r);
if (index === -1) {
result.push({ r: obj.r, sums: 1 });
} else {
result[index].sums++;
}
});
//四舍五入保留两位
newobj.forEach(obj => {
obj.numberColumn = Number(obj.numberColumn).toFixed(2);
obj.moneyColumn = Number(obj.moneyColumn).toFixed(2);
obj.moneyColumns = Number(obj.moneyColumns).toFixed(2)
});
let config = luckysheet.getConfig(0);
let insertedRows = 0; // 记录已插入的行数
for (let i = 0; i < result.length; i++) {
let rowNumber = result[i].r + insertedRows; // 加上已插入的行数
luckysheet.insertRow(rowNumber + 1, { number: result[i].sums });
insertedRows += result[i].sums; // 每插入一行,已插入的行数加上已插入的行数
let CSS = {
"rangeType": "range",
"borderType": "border-all",
"color": "#000",
"style": "1",
"range": [
{
"row": [0, rowNumber + 1 + result[i].sums],
"column": [0, 8]
}
]
}
for (let k = 0; k < newobj.length; k++) {
if (newobj[k].r == result[i].r) {
rowNumber++
//部门
luckysheet.setCellValue(rowNumber, 3, {
"ct": { //单元格值格式
"fa": "General", //格式名称为自动格式
"t": "n", //格式类型为数字类型
},
"v": newobj[k].departmentColumn, //内容的原始值
"m": newobj[k].departmentColumn, //内容的显示值
})
//数量
luckysheet.setCellValue(rowNumber, 5, {
"ct": { //单元格值格式
"fa": "General", //格式名称为自动格式
"t": "n", //格式类型为数字类型
},
"v": newobj[k].numberColumn, //内容的原始值
"m": newobj[k].numberColumn, //内容的显示值
})
//金额
luckysheet.setCellValue(rowNumber, 6, {
"ct": { //单元格值格式
"fa": "General", //格式名称为自动格式
"t": "n", //格式类型为数字类型
},
"v": newobj[k].moneyColumn, //内容的原始值
"m": newobj[k].moneyColumn, //内容的显示值
})
//总额
luckysheet.setCellValue(rowNumber, 7, {
"ct": { //单元格值格式
"fa": "General", //格式名称为自动格式
"t": "n", //格式类型为数字类型
},
"v": newobj[k].moneyColumns, //内容的原始值
"m": newobj[k].moneyColumns, //内容的显示值
})
//费用来源
luckysheet.setCellValue(rowNumber, 8, {
"ct": { //单元格值格式
"fa": "General", //格式名称为自动格式
"t": "n", //格式类型为数字类型
},
"v": newobj[k].sOfExpenses, //内容的原始值
"m": newobj[k].sOfExpenses, //内容的显示值
})
}
}
}, config.borderInfo.push(CSS);
/**详情返回按钮 */ }
handleReturnButtonClick() { luckysheet.setCellValue(1, 2, {
this.positionValue = 'static'; "ct": { //单元格值格式
luckysheet.destroy(); "fa": "General", //格式名称为自动格式
}, "t": "n", //格式类型为数字类型
/** 删除按钮操作 */ },
handleDelete(row) { "v": '日期:' + newobj[0].hdate, //内容的原始值
const ids = row.id || this.ids; "m": '日期:' + newobj[0].hdate, //内容的显示值
this.$confirm('是否确认删除 历史数据编号为"' + ids + '"的数据项?', "警告", { })
confirmButtonText: "确定", let name = this.miningValue.filter(obj => obj.id == newobj[0].sskId)[0].name
cancelButtonText: "取消", luckysheet.setCellValue(1, 5, {
type: "warning" "ct": { //单元格值格式
}).then(function() { "fa": "General", //格式名称为自动格式
return delHistorydata(ids); "t": "n", //格式类型为数字类型
}).then(() => { },
this.getList(); "v": '填报单位:' + name, //内容的原始值
this.msgSuccess("删除成功"); "m": '填报单位:' + name, //内容的显示值
}) })
}, luckysheet.setConfig(config)
/** 导出按钮操作 */ }
handleExport() { }
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有 历史数据数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportHistorydata(queryParams);
}).then(response => {
this.download(response.msg);
})
} }
} // debounce函数定义
}; function debounce(func, delay) {
let timer;
return function () {
const context = this;
const args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
func.apply(context, args);
}, delay);
};
}
</script> </script>
...@@ -357,6 +357,7 @@ export default { ...@@ -357,6 +357,7 @@ export default {
}, 500), // 设置延迟时间,单位为毫秒 }, 500), // 设置延迟时间,单位为毫秒
} }
// 配置项111 // 配置项111
}; };
// debounce函数定义 // debounce函数定义
function debounce(func, delay) { function debounce(func, delay) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment