Commit 10217e9e authored by hehongwei's avatar hehongwei

32类物料导出

parent c7d27cf4
......@@ -6,7 +6,6 @@ import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.activiti.service.IProcessService;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
......@@ -20,9 +19,6 @@ import com.ruoyi.activiti.service.IBizExampleDemoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
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
*
......
......@@ -35,8 +35,6 @@ import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
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_NAME;
......
......@@ -28,7 +28,6 @@ public class ActSuppliesController extends BaseController
@Autowired
private IActSuppliesService actSuppliesService;
@PreAuthorize("@ss.hasPermi('Actsupplies:Actsupplies:options')")
@GetMapping("/options")
@ResponseBody
......
......@@ -3,6 +3,7 @@ package com.ruoyi.system.controller;
import java.util.List;
import com.ruoyi.system.domain.ActOperation1;
import com.ruoyi.system.domain.ActSuppliesImportCleaningAcc;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -200,5 +201,16 @@ public class ActSuppliesHistorydataController extends BaseController
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
void addInsertConvertAcc(ActSuppliesImportTable actSuppliesImportTable);
void addActSuppliesImportCleaningAcc(ActSuppliesImportCleaningAcc actSuppliesImportCleaningAcc);
List<ActSuppliesImportCleaningAcc> selectActSuppliesCleaningCopy(Long id);
}
......@@ -97,4 +97,8 @@ public interface ActSuppliesHistorydataMapper
void updateActSuppliesHistorydataStatusByIdAcc(Long gethId);
List<ActSuppliesHistorydata> selectActSuppliesHistorydataAcc(Integer tylkStatus);
List<ActSuppliesHistorydata> selectActSuppliesHistorydataCopyList(ActSuppliesHistorydata actSuppliesHistorydata);
ActSuppliesHistorydata selectActSuppliesHistorydataCopyById(Long id);
}
......@@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.system.domain.ActOperation1;
import com.ruoyi.system.domain.ActSuppliesHistorydata;
import com.ruoyi.system.domain.ActSuppliesImportCleaningAcc;
/**
* 历史数据Service接口
......@@ -90,4 +91,6 @@ public interface IActSuppliesHistorydataService
void addInsertActSuppliesHistorydataAcc(List<ActSuppliesHistorydata> actSuppliesHistorydata);
List<ActSuppliesHistorydata> selectActSuppliesHistorydataAcc(Integer tylkStatus);
List<ActSuppliesImportCleaningAcc> selectActSuppliesCleaningCopyAcc(Long id);
}
package com.ruoyi.system.service.impl;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
import com.alibaba.fastjson.JSONArray;
......@@ -47,7 +48,9 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
@Override
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
public List<ActSuppliesHistorydata> selectActSuppliesHistorydataList(ActSuppliesHistorydata actSuppliesHistorydata)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
actSuppliesHistorydata.setCreateBy(user.getUserName());
return actSuppliesHistorydataMapper.selectActSuppliesHistorydataList(actSuppliesHistorydata);
actSuppliesHistorydata.setCreateBy(user.getUserName());
//return actSuppliesHistorydataMapper.selectActSuppliesHistorydataList(actSuppliesHistorydata);
return actSuppliesHistorydataMapper.selectActSuppliesHistorydataCopyList(actSuppliesHistorydata);
}
/**
......@@ -719,7 +724,9 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
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 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");
if(parse.getJSONObject(0).get("DateColumn").hashCode()>0){
actSuppliesImportCleaningAcc.setDateColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("DateColumn") - 1)].getV());
......@@ -749,7 +756,6 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
}
//修改历史表中的数据状态(是否清洗)
actSuppliesHistorydataMapper.updateActSuppliesHistorydataStatusByIdAcc(actOperation2s.get(i).gethId());
......@@ -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"
<result property="createTime" column="create_time" />
</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 into act_supplies_import_cleaning
......
......@@ -46,6 +46,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</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 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
......@@ -55,6 +69,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</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 into act_supplies_historydata
<trim prefix="(" suffix=")" suffixOverrides=",">
......
......@@ -3,115 +3,122 @@ import LuckyExcel from "luckyexcel";
// 查询 历史数据列表
export function listHistorydata(query) {
return request({
url: '/system/historydata/list',
method: 'get',
params: query
})
return request({
url: '/system/historydata/list',
method: 'get',
params: query
})
}
// 查询 历史数据详细
export function getHistorydata(id) {
return request({
url: '/system/historydata/' + id,
method: 'get'
})
return request({
url: '/system/historydata/' + id,
method: 'get'
})
}
// 新增 历史数据
export function addHistorydata(data) {
return request({
url: '/system/historydata',
method: 'post',
data: data
})
return request({
url: '/system/historydata',
method: 'post',
data: data
})
}
// 修改 历史数据
export function updateHistorydata(data) {
return request({
url: '/system/historydata',
method: 'put',
data: data
})
return request({
url: '/system/historydata',
method: 'put',
data: data
})
}
// 删除 历史数据
export function delHistorydata(id) {
return request({
url: '/system/historydata/' + id,
method: 'delete'
})
return request({
url: '/system/historydata/' + id,
method: 'delete'
})
}
// 导出 历史数据
export function exportHistorydata(query) {
return request({
url: '/system/historydata/export',
method: 'get',
params: query
})
return request({
url: '/system/historydata/export',
method: 'get',
params: query
})
}
// 新增 历史数据
export function addInsert(data) {
return request({
url: '/system/historydata/addInsertAccount',
method: 'post',
data: data
})
return request({
url: '/system/historydata/addInsertAccount',
method: 'post',
data: data
})
}
// 数据清洗 历史数据
export function addInsert1(data) {
return request({
url: '/system/historydata/addInsert1',
method: 'post',
data: data
})
return request({
url: '/system/historydata/addInsert1',
method: 'post',
data: data
})
}
//清洗通用凭证单
export function addInsertAccount1(data) {
return request({
url: '/system/historydata/addInsertAccount1',
method: 'post',
data: data
})
return request({
url: '/system/historydata/addInsertAccount1',
method: 'post',
data: data
})
}
//清洗通用凭证单
export function addInsertAccount2(data) {
console.log(data,'我发送的数据')
return request({
url: '/system/historydata/addInsertAccount2',
method: 'post',
data: data
})
console.log(data, '我发送的数据')
return request({
url: '/system/historydata/addInsertAccount2',
method: 'post',
data: data
})
}
// 数据清洗 历史数据
export function addInsert2(data) {
return request({
url: '/system/historydata/addInsert2',
method: 'post',
data: data
})
return request({
url: '/system/historydata/addInsert2',
method: 'post',
data: data
})
}
// 数据清洗 历史数据
export function addInsertConvert1(data) {
return request({
url: '/system/historydata/addInsertConvert1',
method: 'post',
data: data
})
return request({
url: '/system/historydata/addInsertConvert1',
method: 'post',
data: data
})
}
// 数据清洗 历史数据
export function addInsertConvert2(data) {
return request({
url: '/system/historydata/addInsertConvert2',
method: 'post',
data: data
})
return request({
url: '/system/historydata/addInsertConvert2',
method: 'post',
data: data
})
}
//导出32类材料
export function selectExport(id) {
return request({
url: 'system/historydata/selectActsuppliesCleaningCopyAcc/'+id,
method: 'get'
})
}
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="模板" prop="templateName">
<el-input
v-model="queryParams.templateName"
placeholder="请输入模板"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="模板" prop="templateName">
<el-input v-model="queryParams.templateName" placeholder="请输入模板" clearable size="small"
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="规则" prop="roleName">
<el-input
v-model="queryParams.roleName"
placeholder="请输入规则"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标题" prop="historyName">
<el-input
v-model="queryParams.historyName"
placeholder="请输入标题"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</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-form-item label="规则" prop="roleName">
<el-input v-model="queryParams.roleName" placeholder="请输入规则" clearable size="small"
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="标题" prop="historyName">
<el-input v-model="queryParams.historyName" placeholder="请输入标题" clearable size="small"
@keyup.enter.native="handleQuery" />
</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-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:historydata:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="historydataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="id" />
<el-table-column label="模板" align="center" prop="templateName" />
<el-table-column label="规则" align="center" prop="roleName" />
<el-table-column label="标题" align="center" prop="historyName" />
<el-table-column label="导入导出" align="center" prop="identifyingCode">
<template slot-scope="scope">
<span v-if="scope.row.identifyingCode==0">导入</span>
<span v-if="scope.row.identifyingCode==1">导出</span>
</template>
</el-table-column>
<el-table-column label="操作时间" align="center" prop="createTime" />
<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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['system:historydata:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="historydataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="id" />
<el-table-column label="模板" align="center" prop="templateName" />
<el-table-column label="规则" align="center" prop="roleName" />
<el-table-column label="标题" align="center" prop="historyName" />
<el-table-column label="导入导出" align="center" prop="identifyingCode">
<template slot-scope="scope">
<span v-if="scope.row.identifyingCode == 0">导入</span>
<span v-if="scope.row.identifyingCode == 1">导出</span>
</template>
</el-table-column>
<el-table-column label="操作时间" align="center" prop="createTime" />
<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>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-button v-if="scope.row.identifyingCode == 0 && scope.row.cleanStatus == 1" type="text"
icon="el-icon-upload2" size="mini" @click="exportSuccess(scope.row.id)">查看32类</el-button>
<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>
<style>
#luckysheet_info_detail_title {
display: none;
}
#luckysheet_info_detail_title {
display: none;
}
#luckysheet_info_detail_update {
display: none;
}
#luckysheet_info_detail_update {
display: none;
}
#luckysheet_info_detail_save {
display: none;
}
#luckysheet_info_detail_save {
display: none;
}
.luckysheet-share-logo {
display: none;
}
.luckysheet-share-logo {
display: none;
}
</style>
<script>
import { listHistorydata, getHistorydata, delHistorydata, addHistorydata, updateHistorydata, exportHistorydata } from "@/api/system/historydata";
import Editor from '@/components/Editor';
import $ from 'jquery';
import XLSX from 'xlsx';
import LuckyExcel from 'luckyexcel';
import { Loading } from 'element-ui';
export default {
name: "Historydata",
components: {
Editor,
},
data() {
return {
positionValue: 'static',
import { listHistorydata, getHistorydata, delHistorydata, addHistorydata, updateHistorydata, exportHistorydata, selectExport } from "@/api/system/historydata";
import Editor from '@/components/Editor';
import { getSuppliesTemplate } from "@/api/ruoyi-myLuckyexcel/myluckyexcel";
import $ from 'jquery';
import { exportExcel } from '../../../../public/exportExcel'
import XLSX from 'xlsx';
import LuckyExcel from 'luckyexcel';
import { Loading } from 'element-ui';
export default {
name: "Historydata",
components: {
Editor,
},
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,
// 选中数组
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: {},
};
},
created() {
this.getList();
this.positionValue = "static";
};
},
created() {
this.getList();
this.positionValue = "static";
},
mounted() {
window.handleExportButtonClick = this.handleExportButtonClick
window.handleReturnButtonClick = this.handleReturnButtonClick;
},
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() {
this.loading = true;
listHistorydata(this.queryParams).then(response => {
this.historydataList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
importUuid: null,
templateId: null,
exportUuid: null,
roleId: null,
historyName: null,
historyContent: null,
identifyingCode: null,
status: 0,
createBy: null,
createTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加 历史数据";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getHistorydata(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改 历史数据";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateHistorydata(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addHistorydata(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
handleDetails(row) {
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
importUuid: null,
templateId: null,
exportUuid: null,
roleId: null,
historyName: null,
historyContent: null,
identifyingCode: null,
status: 0,
createBy: null,
createTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加 历史数据";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getHistorydata(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改 历史数据";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateHistorydata(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addHistorydata(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
async handleDetails(row) {
const id = row.id || this.ids;
this.positionValue = 'absolute';
luckysheet.destroy();
luckysheet.create({
container: "luckysheet", // Luckysheet 的容器元素 ID
title: row.historyName, // Excel 文件名
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>',
try {
const response = await getHistorydata(id);
this.form = response.data;
this.open = true;
this.title = "修改历史数据";
});
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, //内容的显示值
})
}
}
},
/**详情返回按钮 */
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);
})
config.borderInfo.push(CSS);
}
luckysheet.setCellValue(1, 2, {
"ct": { //单元格值格式
"fa": "General", //格式名称为自动格式
"t": "n", //格式类型为数字类型
},
"v": '日期:' + newobj[0].hdate, //内容的原始值
"m": '日期:' + newobj[0].hdate, //内容的显示值
})
let name = this.miningValue.filter(obj => obj.id == newobj[0].sskId)[0].name
luckysheet.setCellValue(1, 5, {
"ct": { //单元格值格式
"fa": "General", //格式名称为自动格式
"t": "n", //格式类型为数字类型
},
"v": '填报单位:' + name, //内容的原始值
"m": '填报单位:' + name, //内容的显示值
})
luckysheet.setConfig(config)
}
}
}
}
};
// 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>
......@@ -357,6 +357,7 @@ export default {
}, 500), // 设置延迟时间,单位为毫秒
}
// 配置项111
};
// debounce函数定义
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