Commit d479a1a7 authored by hehongwei's avatar hehongwei

物资明细清洗修改

parent 41e1732d
...@@ -43,6 +43,12 @@ ...@@ -43,6 +43,12 @@
<version>1.5.21</version> <version>1.5.21</version>
</dependency> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.8</version>
</dependency>
<!-- swagger2-UI--> <!-- swagger2-UI-->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
......
...@@ -14,5 +14,9 @@ ...@@ -14,5 +14,9 @@
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -38,5 +38,18 @@ public class ActSuppliesCleaningRuleController extends BaseController ...@@ -38,5 +38,18 @@ public class ActSuppliesCleaningRuleController extends BaseController
} }
/**
* 获取所有历史数据
*/
@PreAuthorize("@ss.hasPermi('system:cleaningrule:queryAll')")
@GetMapping("/queryAllAcc/{tylkStatus}")
public AjaxResult selectActSuppliesHistorydataAcc(@PathVariable("tylkStatus") Integer tylkStatus)
{
List<ActSuppliesHistorydata> s = actSuppliesHistorydataService.selectActSuppliesHistorydataAcc(tylkStatus);
return AjaxResult.success(s);
}
} }
...@@ -104,7 +104,7 @@ public class ActSuppliesHistorydataController extends BaseController ...@@ -104,7 +104,7 @@ public class ActSuppliesHistorydataController extends BaseController
} }
/** /**
* 添加 历史数据 * 添加 通用or六矿历史数据
*/ */
@PreAuthorize("@ss.hasPermi('system:historydata:addInsert')") @PreAuthorize("@ss.hasPermi('system:historydata:addInsert')")
@PostMapping("/addInsert") @PostMapping("/addInsert")
...@@ -114,6 +114,18 @@ public class ActSuppliesHistorydataController extends BaseController ...@@ -114,6 +114,18 @@ public class ActSuppliesHistorydataController extends BaseController
return toAjax(1); return toAjax(1);
} }
/**
* 添加 通用凭证单历史数据
*/
@PreAuthorize("@ss.hasPermi('system:historydata:addInsertAccount')")
@PostMapping("/addInsertAccount")
public AjaxResult addInsertAccount(@RequestBody List<ActSuppliesHistorydata> actSuppliesHistorydata)
{
actSuppliesHistorydataService.addInsertActSuppliesHistorydataAcc(actSuppliesHistorydata);
return toAjax(1);
}
/** /**
* 数据清洗 六矿生成表数据 * 数据清洗 六矿生成表数据
*/ */
...@@ -139,7 +151,7 @@ public class ActSuppliesHistorydataController extends BaseController ...@@ -139,7 +151,7 @@ public class ActSuppliesHistorydataController extends BaseController
} }
/** /**
* 数据清洗 六矿生成表数据 * 数据清洗 凭证单六矿生成表数据
*/ */
@PreAuthorize("@ss.hasPermi('system:historydata:addInsertAccount1')") @PreAuthorize("@ss.hasPermi('system:historydata:addInsertAccount1')")
@PostMapping("/addInsertAccount1") @PostMapping("/addInsertAccount1")
...@@ -150,7 +162,7 @@ public class ActSuppliesHistorydataController extends BaseController ...@@ -150,7 +162,7 @@ public class ActSuppliesHistorydataController extends BaseController
} }
/** /**
* 数据清洗 六矿导入表数据 * 数据清洗 凭证单六矿导入表数据
*/ */
@PreAuthorize("@ss.hasPermi('system:historydata:addInsertAccount2')") @PreAuthorize("@ss.hasPermi('system:historydata:addInsertAccount2')")
@PostMapping("/addInsertAccount2") @PostMapping("/addInsertAccount2")
......
...@@ -6,13 +6,22 @@ public class ActDispensing { ...@@ -6,13 +6,22 @@ public class ActDispensing {
private String c; private String c;
//行 //行
private String r; private String r;
//金额
private String money;
//材料分类 //材料分类
private String material; private String material;
//项目分类 //项目分类
private String name; private String name;
//与凭证单对应关系
private int[] indexRow;
//项目细分 //项目细分
private String department; private String department;
private String accountdate;
private String accountuuid;
//会计编码 //会计编码
private String accountingCode; private String accountingCode;
...@@ -134,4 +143,36 @@ public class ActDispensing { ...@@ -134,4 +143,36 @@ public class ActDispensing {
public void setMining(String mining) { public void setMining(String mining) {
this.mining = mining; this.mining = mining;
} }
public String getMoney() {
return money;
}
public void setMoney(String money) {
this.money = money;
}
public String getAccountdate() {
return accountdate;
}
public void setAccountdate(String accountdate) {
this.accountdate = accountdate;
}
public String getAccountuuid() {
return accountuuid;
}
public void setAccountuuid(String accountuuid) {
this.accountuuid = accountuuid;
}
public int[] getIndexRow() {
return indexRow;
}
public void setIndexRow(int[] indexRow) {
this.indexRow = indexRow;
}
} }
...@@ -30,6 +30,10 @@ public class ActOperation1 extends BaseEntity { ...@@ -30,6 +30,10 @@ public class ActOperation1 extends BaseEntity {
/** 清洗规则 */ /** 清洗规则 */
private String historyRole; private String historyRole;
private String convenRole;
private String exportUuid;
public String getHistoryRole() { public String getHistoryRole() {
return historyRole; return historyRole;
} }
...@@ -98,4 +102,20 @@ public class ActOperation1 extends BaseEntity { ...@@ -98,4 +102,20 @@ public class ActOperation1 extends BaseEntity {
public void setRoleId(Integer roleId) { public void setRoleId(Integer roleId) {
this.roleId = roleId; this.roleId = roleId;
} }
public String getExportUuid() {
return exportUuid;
}
public void setExportUuid(String exportUuid) {
this.exportUuid = exportUuid;
}
public String getConvenRole() {
return convenRole;
}
public void setConvenRole(String convenRole) {
this.convenRole = convenRole;
}
} }
...@@ -36,6 +36,9 @@ public class ActSuppliesHistorydata extends BaseEntity ...@@ -36,6 +36,9 @@ public class ActSuppliesHistorydata extends BaseEntity
@Excel(name = "导入") @Excel(name = "导入")
private String importUuid; private String importUuid;
/** 通用凭证单编码*/
private String accountuuid;
/** 规则 */ /** 规则 */
@Excel(name = "规则") @Excel(name = "规则")
private Long roleId; private Long roleId;
...@@ -56,6 +59,9 @@ public class ActSuppliesHistorydata extends BaseEntity ...@@ -56,6 +59,9 @@ public class ActSuppliesHistorydata extends BaseEntity
@Excel(name = "清洗规则") @Excel(name = "清洗规则")
private String historyRole; private String historyRole;
private String convenRole;
/** 导入导出标识 */ /** 导入导出标识 */
@Excel(name = "导入导出标识") @Excel(name = "导入导出标识")
private Long identifyingCode; private Long identifyingCode;
...@@ -218,6 +224,22 @@ public class ActSuppliesHistorydata extends BaseEntity ...@@ -218,6 +224,22 @@ public class ActSuppliesHistorydata extends BaseEntity
this.historyRole = historyRole; this.historyRole = historyRole;
} }
public String getAccountuuid() {
return accountuuid;
}
public void setAccountuuid(String accountuuid) {
this.accountuuid = accountuuid;
}
public String getConvenRole() {
return convenRole;
}
public void setConvenRole(String convenRole) {
this.convenRole = convenRole;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
package com.ruoyi.system.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 导入表的清晰表 act_supplies_import_cleaning
*
* @author
* @date 2023-12-15
*/
public class ActSuppliesImportCleaningAcc extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 导入表的清洗ID */
@Excel(name = "导入表的清洗ID")
private String id;
/**所属规则*/
@Excel(name = "所属矿id",readConverterExp = "1、东欢坨矿 2、范矿 3、林西矿 4、吕矿 5、钱家营矿 6、唐山矿 7、宏丰 8、云飞 9、平安")
private String sskId;
/** 日期(年月)*/
private String hdate;
/** 历史表ID*/
private Long hId;
private String kmCode;
private String yyUuid;
/** 所在行*/
private String HeaderRow;
/** 物料名称*/
private String nameColumn;
/** 物料编码*/
private String codeColumn;
/** 部门*/
private String departmentColumn;
/** 数量*/
private String numberColumn;
/** 单价*/
private String moneyColumn;
/** 金额*/
private String moneyColumns;
/** 导入表内日期*/
private String dateColumn;
public String getKmCode() {
return kmCode;
}
public void setKmCode(String kmCode) {
this.kmCode = kmCode;
}
public String getYyUuid() {
return yyUuid;
}
public void setYyUuid(String yyUuid) {
this.yyUuid = yyUuid;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getHeaderRow() {
return HeaderRow;
}
public void setHeaderRow(String headerRow) {
HeaderRow = headerRow;
}
public String getSskId() {
return sskId;
}
public void setSskId(String sskId) {
this.sskId = sskId;
}
public Long gethId() {
return hId;
}
public void sethId(Long hId) {
this.hId = hId;
}
public String getHdate() {
return hdate;
}
public void setHdate(String hdate) {
this.hdate = hdate;
}
public String getMoneyColumns() {
return moneyColumns;
}
public void setMoneyColumns(String moneyColumns) {
this.moneyColumns = moneyColumns;
}
public String getNameColumn() {
return nameColumn;
}
public void setNameColumn(String nameColumn) {
this.nameColumn = nameColumn;
}
public String getCodeColumn() {
return codeColumn;
}
public void setCodeColumn(String codeColumn) {
this.codeColumn = codeColumn;
}
public String getDepartmentColumn() {
return departmentColumn;
}
public void setDepartmentColumn(String departmentColumn) {
this.departmentColumn = departmentColumn;
}
public String getNumberColumn() {
return numberColumn;
}
public void setNumberColumn(String numberColumn) {
this.numberColumn = numberColumn;
}
public String getMoneyColumn() {
return moneyColumn;
}
public void setMoneyColumn(String moneyColumn) {
this.moneyColumn = moneyColumn;
}
public String getDateColumn() {
return dateColumn;
}
public void setDateColumn(String dateColumn) {
this.dateColumn = dateColumn;
}
@Override
public String toString() {
return "ActSuppliesImportCleaning{" +
"id='" + id + '\'' +
", sskId='" + sskId + '\'' +
", hId='" + hId + '\'' +
", nameColumn='" + nameColumn + '\'' +
", codeColumn='" + codeColumn + '\'' +
", departmentColumn='" + departmentColumn + '\'' +
", numberColumn='" + numberColumn + '\'' +
", moneyColumn='" + moneyColumn + '\'' +
", dateColumn='" + dateColumn + '\'' +
'}';
}
}
...@@ -26,6 +26,10 @@ public class ActSuppliesImportTable extends BaseEntity ...@@ -26,6 +26,10 @@ public class ActSuppliesImportTable extends BaseEntity
@Excel(name = "所属矿区") @Excel(name = "所属矿区")
private String mining; private String mining;
private String kmCode;
private String exportUuid;
private String a1; private String a1;
private String a2; private String a2;
private String a3; private String a3;
...@@ -126,6 +130,14 @@ public class ActSuppliesImportTable extends BaseEntity ...@@ -126,6 +130,14 @@ public class ActSuppliesImportTable extends BaseEntity
this.mining = mining; this.mining = mining;
} }
public String getExportUuid() {
return exportUuid;
}
public void setExportUuid(String exportUuid) {
this.exportUuid = exportUuid;
}
public String getA1() { public String getA1() {
return a1; return a1;
} }
...@@ -630,6 +642,14 @@ public class ActSuppliesImportTable extends BaseEntity ...@@ -630,6 +642,14 @@ public class ActSuppliesImportTable extends BaseEntity
this.a63 = a63; this.a63 = a63;
} }
public String getKmCode() {
return kmCode;
}
public void setKmCode(String kmCode) {
this.kmCode = kmCode;
}
@Override @Override
public String toString() { public String toString() {
return "ActSuppliesImportTable{" + return "ActSuppliesImportTable{" +
......
...@@ -26,4 +26,6 @@ public interface ActSuppliesAccountMapper ...@@ -26,4 +26,6 @@ public interface ActSuppliesAccountMapper
public List<ActDispensing> selectActSuppliesAccpuntByCode(); public List<ActDispensing> selectActSuppliesAccpuntByCode();
void installSixMinTable(ActDispensing actDispensings);
} }
package com.ruoyi.system.mapper; package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.ActSuppliesHistorydata; import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.ActSuppliesImportCleaning;
import com.ruoyi.system.domain.ActSuppliesImportTable;
import com.ruoyi.system.domain.ActSuppliesSixMinesSummaryTable;
import java.util.List; import java.util.List;
...@@ -32,4 +29,7 @@ public interface ActSuppliesCleaningRuleMapper ...@@ -32,4 +29,7 @@ public interface ActSuppliesCleaningRuleMapper
void addInsertConvert2(ActSuppliesImportTable actSuppliesImportTable); void addInsertConvert2(ActSuppliesImportTable actSuppliesImportTable);
void addInsertConvertAcc(ActSuppliesImportTable actSuppliesImportTable);
void addActSuppliesImportCleaningAcc(ActSuppliesImportCleaningAcc actSuppliesImportCleaningAcc);
} }
...@@ -87,4 +87,12 @@ public interface ActSuppliesHistorydataMapper ...@@ -87,4 +87,12 @@ public interface ActSuppliesHistorydataMapper
* @return 结果 * @return 结果
*/ */
void insertActSuppliesHistorycontent(ActSuppliesHistorydata actSuppliesHistorydata); void insertActSuppliesHistorycontent(ActSuppliesHistorydata actSuppliesHistorydata);
void insertActSuppliesHistorydataAcc(ActSuppliesHistorydata actSuppliesHistorydata1);
void insertActSuppliesHistorycontentAcc(ActSuppliesHistorydata actSuppliesHistorydata1);
void updateActSuppliesHistorydataStatusByIdAcc(Long gethId);
List<ActSuppliesHistorydata> selectActSuppliesHistorydataAcc(Integer tylkStatus);
} }
...@@ -86,4 +86,8 @@ public interface IActSuppliesHistorydataService ...@@ -86,4 +86,8 @@ public interface IActSuppliesHistorydataService
void addInsertImportAccpunt(List<ActOperation1> actOperation2s); void addInsertImportAccpunt(List<ActOperation1> actOperation2s);
void addInsertImportssAccounts(List<ActOperation1> actOperation2s); void addInsertImportssAccounts(List<ActOperation1> actOperation2s);
void addInsertActSuppliesHistorydataAcc(List<ActSuppliesHistorydata> actSuppliesHistorydata);
List<ActSuppliesHistorydata> selectActSuppliesHistorydataAcc(Integer tylkStatus);
} }
...@@ -43,9 +43,9 @@ public class ActSuppliesAccountServiceImpl implements IActSuppliesAccountService ...@@ -43,9 +43,9 @@ public class ActSuppliesAccountServiceImpl implements IActSuppliesAccountService
actDispensing.get(i).setAccountingNameC(actDispensing.get(i).getAccountingNameC()+','+actDispensing.get(i).getAccountingIdC()); actDispensing.get(i).setAccountingNameC(actDispensing.get(i).getAccountingNameC()+','+actDispensing.get(i).getAccountingIdC());
actDispensings.add(actDispensing.get(i)); actDispensings.add(actDispensing.get(i));
} }
return actDispensings; return actDispensings;
} }
} }
...@@ -7,12 +7,14 @@ import java.util.*; ...@@ -7,12 +7,14 @@ import java.util.*;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.ActSuppliesCleaningRuleMapper; import com.ruoyi.system.mapper.ActSuppliesCleaningRuleMapper;
import com.sun.javafx.collections.MappingChange;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ActSuppliesHistorydataMapper; import com.ruoyi.system.mapper.ActSuppliesHistorydataMapper;
...@@ -610,10 +612,159 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat ...@@ -610,10 +612,159 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
} }
/**
* 凭证单导入表数据清洗
*
* @return 结果
*/
@Override @Override
@Transactional
public void addInsertImportssAccounts(List<ActOperation1> actOperation2s) { public void addInsertImportssAccounts(List<ActOperation1> actOperation2s) {
Thread thread = new Thread() {
public void run() {
//String[] attributes = {"A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "A16", "A17", "A18", "A19", "A20", "A21", "A22", "A23", "A24", "A25", "A26", "A27", "A28", "A29", "A30", "A31", "A32", "A33", "A34", "A35", "A36", "A37", "A38", "A39", "A40", "A41", "A42", "A43", "A44", "A45", "A46", "A47", "A48", "A49", "A50", "A51", "A52", "A53", "A54", "A55", "A56", "A57", "A58", "A59", "A60", "A61", "A62", "A63"};
String[] attributes = new String[200];
for(int i=1;i<=200;i++){
attributes[i-1]= 'A' + String.valueOf(i);
}
for (int i = 0; i < actOperation2s.size(); i++) {
Gson gson = new Gson();
JSONArray parse = (JSONArray) JSONArray.parse(actOperation2s.get(i).getConvenRole());
Map<Integer, String>[] mapArray = gson.fromJson(actOperation2s.get(i).getHistoryRole(), Map[].class);
//获取导入excel表数据存储到生成表实体类中
for (int x = (int)parse.getJSONObject(0).get("HeaderRow"); x < actOperation2s.get(i).getActOperation2().length; x++) {
//判断数据是否为空,为空结束循环
Map<String,String> mapcode = new HashMap<>();
for (Map<Integer, String> map : mapArray) {
mapcode.put(map.get("key"),map.get("value"));
}
String s1 = mapcode.get(String.valueOf(x));
if (actOperation2s.get(i).getActOperation2()[x]!=null){
ActSuppliesImportTable actSuppliesImportTable = new ActSuppliesImportTable();
ActSuppliesImportCleaningAcc actSuppliesImportCleaningAcc = new ActSuppliesImportCleaningAcc();
UUID uuid = UUID.randomUUID();
String s = StringUtils.remove(uuid.toString(), '-');
actSuppliesImportTable.setKmCode(s1);
actSuppliesImportTable.setId(s);
actSuppliesImportTable.sethId(actOperation2s.get(i).gethId());
actSuppliesImportTable.sethDate(actOperation2s.get(i).gethDate());
actSuppliesImportTable.setMining(actOperation2s.get(i).getMining());
actSuppliesImportTable.setExportUuid(actOperation2s.get(i).getExportUuid());
actSuppliesImportCleaningAcc.setKmCode(s1);
actSuppliesImportCleaningAcc.setId(s);
actSuppliesImportCleaningAcc.sethId(actOperation2s.get(i).gethId());
actSuppliesImportCleaningAcc.setHdate(actOperation2s.get(i).gethDate());
actSuppliesImportCleaningAcc.setSskId(actOperation2s.get(i).getMining());
actSuppliesImportCleaningAcc.setYyUuid(actOperation2s.get(i).getExportUuid());
//获取数组x行的真实非空长度
List<Object> actOperation2s1 = Arrays.asList(actOperation2s.get(i).getActOperation2()[x]);
long count = Arrays.stream(actOperation2s.get(i).getActOperation2()[x]).filter(Objects::nonNull).count();
//循环保存到实体类字段中
for (int y = 0; y < count; y++) {
if (actOperation2s.get(i).getActOperation2()[x][y]!=null) {
if (actOperation2s.get(i).getActOperation2()[x][y].getV() != null) {
try {
actSuppliesImportTable.getClass().getMethod("set" + attributes[y], String.class).invoke(actSuppliesImportTable, actOperation2s.get(i).getActOperation2()[x][y].getV());
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
//新增一条生成表数据
actSuppliesCleaningRuleMapper.addInsertConvertAcc(actSuppliesImportTable);
if (actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("CodeColumn") - 1)] != null) {
if (actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("CodeColumn") - 1)].getV() != null) {
//[{"HeaderRow": 1, "CodeColumn": 6, "DateColumn": 5, "NameColumn": 7, "MoneyColumn": 12, "NumberColumn": 11, "DepartmentColumn": 2}]
actSuppliesImportCleaningAcc.setNameColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("NameColumn") - 1)].getV());
actSuppliesImportCleaningAcc.setCodeColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("CodeColumn") - 1)].getV());
actSuppliesImportCleaningAcc.setDepartmentColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("DepartmentColumn") - 1)].getV());
actSuppliesImportCleaningAcc.setNumberColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("NumberColumn") - 1)].getV());
actSuppliesImportCleaningAcc.setMoneyColumn(actOperation2s.get(i).getActOperation2()[x][((int) parse.getJSONObject(0).get("MoneyColumn") - 1)].getV());
actSuppliesImportCleaningAcc.setMoneyColumns(Double.toString(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());
}
//actSuppliesImportCleaning.setDateColumn(actOperation2s.get(i).getActOperation2()[x][JSON.parseObject(actOperation2s.get(i).getHistoryRole()).getInteger("DateColumn")].getV());
//新增一条生成表数据
actSuppliesCleaningRuleMapper.addActSuppliesImportCleaningAcc(actSuppliesImportCleaningAcc);
}
}
}else {
break;
}
}
//修改历史表中的数据状态(是否清洗)
actSuppliesHistorydataMapper.updateActSuppliesHistorydataStatusByIdAcc(actOperation2s.get(i).gethId());
}
}
};
thread.start();
}
@Override
public void addInsertActSuppliesHistorydataAcc(List<ActSuppliesHistorydata> actSuppliesHistorydata) {
SysUser user = SecurityUtils.getLoginUser().getUser();
ActSuppliesHistorydata actSuppliesHistorydata1 = new ActSuppliesHistorydata();
for (int i = 0; i < actSuppliesHistorydata.size(); i++) {
UUID uuid = UUID.randomUUID();
String uuids = StringUtils.remove(uuid.toString(), '-');
if (actSuppliesHistorydata.get(i).getIdentifyingCode() == 0) {
actSuppliesHistorydata1 = actSuppliesHistorydata.get(i);
actSuppliesHistorydata1.setImportUuid(uuids);
actSuppliesHistorydata1.setStatus(0L);
actSuppliesHistorydata1.setIdentifyingCode(0L);
actSuppliesHistorydataMapper.insertActSuppliesHistorydataAcc(actSuppliesHistorydata1);
actSuppliesHistorydataMapper.insertActSuppliesHistorycontentAcc(actSuppliesHistorydata1);
} else {
actSuppliesHistorydata1 = actSuppliesHistorydata.get(i);
actSuppliesHistorydata1.setImportUuid(uuids);
actSuppliesHistorydata1.setStatus(0L);
actSuppliesHistorydata1.setIdentifyingCode(1L);
actSuppliesHistorydataMapper.insertActSuppliesHistorydataAcc(actSuppliesHistorydata1);
actSuppliesHistorydataMapper.insertActSuppliesHistorycontentAcc(actSuppliesHistorydata1);
}
}
}
@Override
public List<ActSuppliesHistorydata> selectActSuppliesHistorydataAcc(Integer tylkStatus) {
return actSuppliesHistorydataMapper.selectActSuppliesHistorydataAcc(tylkStatus);
} }
......
...@@ -105,18 +105,26 @@ public class ActSuppliesRoleDetailServiceImpl implements IActSuppliesRoleDetailS ...@@ -105,18 +105,26 @@ public class ActSuppliesRoleDetailServiceImpl implements IActSuppliesRoleDetailS
//re:导入表的行,ce:导入表的列,se:导入表的sheet;rt:模板表的行,ct:模板表的列,st:模板表的sheet;ys:运算符 //re:导入表的行,ce:导入表的列,se:导入表的sheet;rt:模板表的行,ct:模板表的列,st:模板表的sheet;ys:运算符
// String content1 = "[{\"se\":\"0\",\"re\":\""+actSuppliesRoleDetail.getDetailYH()+"\",\"ce\":\""+actSuppliesRoleDetail.getDetailYL()+"\",\"st\":\"0\",\"rt\":\""+actSuppliesRoleDetail.getDetailMH()+"\",\"ct\":\""+actSuppliesRoleDetail.getDetailML()+"\",\"ys\":\""+actSuppliesRoleDetail.getConvertStatus()+"\"}]" ; // String content1 = "[{\"se\":\"0\",\"re\":\""+actSuppliesRoleDetail.getDetailYH()+"\",\"ce\":\""+actSuppliesRoleDetail.getDetailYL()+"\",\"st\":\"0\",\"rt\":\""+actSuppliesRoleDetail.getDetailMH()+"\",\"ct\":\""+actSuppliesRoleDetail.getDetailML()+"\",\"ys\":\""+actSuppliesRoleDetail.getConvertStatus()+"\"}]" ;
List<String> filteredList = new ArrayList<>(); List<String> filteredList = new ArrayList<>();
String content2;
if(actSuppliesRoleDetail.getConvertStatus()==6){
content2="["+actSuppliesRoleDetail.getCleanIng()+"]";
}else {
for (int i =0 ;i<actSuppliesRoleDetail.getDetailMH().length; i++){
for (int i =0 ;i<actSuppliesRoleDetail.getDetailMH().length; i++){ filteredList.add("{\"se\":\"0\",\"re\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailYH()[i]))-1)+"\",\"ce\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailYL()[i]))-1)+"\",\"st\":\"0\",\"rt\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailMH()[i]))-1)+"\",\"ct\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailML()[i]))-1)+"\",\"ys\":\""+actSuppliesRoleDetail.getConvertStatus()+"\"}") ;
filteredList.add("{\"se\":\"0\",\"re\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailYH()[i]))-1)+"\",\"ce\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailYL()[i]))-1)+"\",\"st\":\"0\",\"rt\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailMH()[i]))-1)+"\",\"ct\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailML()[i]))-1)+"\",\"ys\":\""+actSuppliesRoleDetail.getConvertStatus()+"\"}") ; }
String content = String.join(",",filteredList);
content2 = "["+content+"]";
} }
String content = String.join(",",filteredList);
String content2 = "["+content+"]";
actSuppliesRoleDetail.setDetailContent(content2); actSuppliesRoleDetail.setDetailContent(content2);
SysUser user = SecurityUtils.getLoginUser().getUser(); SysUser user = SecurityUtils.getLoginUser().getUser();
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
</select> </select>
<select id="selectActClassificationById" parameterType="Long" resultMap="ActClassificationResult"> <select id="selectActClassificationById" parameterType="Long" resultMap="ActClassificationResult">
<include refid="selectActClassificationVo"/> select a.id, a.name,a.type,a.ssk_id, a.pid, a.status, a.create_by, a.update_by, b.name fname from act_classification a left join act_classification b on a.pid = b.id
where id = #{id} where a.id = #{id}
</select> </select>
<select id="savePid" parameterType="Long" resultMap="ActClassificationResult"> <select id="savePid" parameterType="Long" resultMap="ActClassificationResult">
......
...@@ -25,6 +25,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -25,6 +25,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from act_supplies_compare where blm = 1 from act_supplies_compare where blm = 1
</select> </select>
<insert id="installSixMinTable" parameterType="ActDispensing" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_sixminessummarytable
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="hId != null">h_id,</if>
<if test="projectId != null">project_id,</if>
<if test="projectName != null">project_name,</if>
<if test="departmentName != null">department_name,</if>
<if test="unit != null">unit,</if>
<if test="number != null">number,</if>
<if test="nuitPrice != null">nuit_price,</if>
<if test="money != null">money,</if>
<if test="costChannels != null">cost_channels,</if>
<if test="createBy != null">create_by,</if>
<if test="hDate != null">h_date,</if>
<if test="mining != null">ssk_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="accountdate != null">#{accountdate},</if>
<if test="projectId != null">#{projectId},</if>
<if test="projectName != null">#{projectName},</if>
<if test="departmentName != null">#{departmentName},</if>
<if test="unit != null">#{unit},</if>
<if test="number != null">#{number},</if>
<if test="nuitPrice != null">#{nuitPrice},</if>
<if test="money != null">#{money},</if>
<if test="accountuuid != null">#{accountuuid},</if>
<if test="mining != null">#{mining},</if>
</trim>
</insert>
......
...@@ -228,6 +228,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -228,6 +228,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
</insert> </insert>
<insert id="addActSuppliesImportCleaningAcc" parameterType="ActSuppliesImportCleaningAcc" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_import_cleaning_copy1
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="hId != null">hid,</if>
<if test="sskId != null">ssk_id,</if>
<if test="hdate != null">hdate,</if>
<if test="kmCode != null">km_code,</if>
<if test="yyUuid != null">yy_uuid,</if>
<if test="nameColumn != null">name_column,</if>
<if test="codeColumn != null">code_column,</if>
<if test="departmentColumn != null">department_column,</if>
<if test="numberColumn != null">number_column,</if>
<if test="moneyColumns != null">money_columns,</if>
<if test="moneyColumn != null">money_column,</if>
<if test="dateColumn != null">date_column,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="hId != null">#{hId},</if>
<if test="sskId != null">#{sskId},</if>
<if test="hdate != null">#{hdate},</if>
<if test="kmCode != null">#{kmCode},</if>
<if test="yyUuid != null">#{yyUuid},</if>
<if test="nameColumn != null">#{nameColumn},</if>
<if test="codeColumn != null">#{codeColumn},</if>
<if test="departmentColumn != null">#{departmentColumn},</if>
<if test="numberColumn != null">#{numberColumn},</if>
<if test="moneyColumns != null">#{moneyColumns},</if>
<if test="moneyColumn != null">#{moneyColumn},</if>
<if test="dateColumn != null">#{dateColumn},</if>
</trim>
</insert>
<insert id="addActSuppliesImportCleaning" parameterType="ActSuppliesImportCleaning" useGeneratedKeys="true" keyProperty="id"> <insert id="addActSuppliesImportCleaning" parameterType="ActSuppliesImportCleaning" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_import_cleaning insert into act_supplies_import_cleaning
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -559,6 +593,154 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -559,6 +593,154 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteActSuppliesImportTable" parameterType="Long"> <delete id="deleteActSuppliesImportTable" parameterType="Long">
delete from act_supplies_import_table where h_id = #{id} delete from act_supplies_import_table where h_id = #{id}
</delete> </delete>
<insert id="addInsertConvertAcc" parameterType="ActSuppliesImportTable" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_import_table_copy1
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="hId != null">h_id,</if>
<if test="hDate != null">h_date,</if>
<if test="mining != null">ssk_id,</if>
<if test="exportUuid != null">yy_uuid,</if>
<if test="kmCode != null">km_code,</if>
<if test="a1 != null">a1,</if>
<if test="a2 != null">a2,</if>
<if test="a3 != null">a3,</if>
<if test="a4 != null">a4,</if>
<if test="a5 != null">a5,</if>
<if test="a6 != null">a6,</if>
<if test="a7 != null">a7,</if>
<if test="a8 != null">a8,</if>
<if test="a9 != null">a9,</if>
<if test="a10 != null">a10,</if>
<if test="a11 != null">a11,</if>
<if test="a12 != null">a12,</if>
<if test="a13 != null">a13,</if>
<if test="a14 != null">a14,</if>
<if test="a15 != null">a15,</if>
<if test="a16 != null">a16,</if>
<if test="a17 != null">a17,</if>
<if test="a18 != null">a18,</if>
<if test="a19 != null">a19,</if>
<if test="a20 != null">a20,</if>
<if test="a21 != null">a21,</if>
<if test="a22 != null">a22,</if>
<if test="a23 != null">a23,</if>
<if test="a24 != null">a24,</if>
<if test="a25 != null">a25,</if>
<if test="a26 != null">a26,</if>
<if test="a27 != null">a27,</if>
<if test="a28 != null">a28,</if>
<if test="a29 != null">a29,</if>
<if test="a30 != null">a30,</if>
<if test="a31 != null">a31,</if>
<if test="a32 != null">a32,</if>
<if test="a33 != null">a33,</if>
<if test="a34 != null">a34,</if>
<if test="a35 != null">a35,</if>
<if test="a36 != null">a36,</if>
<if test="a37 != null">a37,</if>
<if test="a38 != null">a38,</if>
<if test="a39 != null">a39,</if>
<if test="a40 != null">a40,</if>
<if test="a41 != null">a41,</if>
<if test="a42 != null">a42,</if>
<if test="a43 != null">a43,</if>
<if test="a44 != null">a44,</if>
<if test="a45 != null">a45,</if>
<if test="a46 != null">a46,</if>
<if test="a47 != null">a47,</if>
<if test="a48 != null">a48,</if>
<if test="a49 != null">a49,</if>
<if test="a50 != null">a50,</if>
<if test="a51 != null">a51,</if>
<if test="a52 != null">a52,</if>
<if test="a53 != null">a53,</if>
<if test="a54 != null">a54,</if>
<if test="a55 != null">a55,</if>
<if test="a56 != null">a56,</if>
<if test="a57 != null">a57,</if>
<if test="a58 != null">a58,</if>
<if test="a59 != null">a59,</if>
<if test="a60 != null">a60,</if>
<if test="a61 != null">a61,</if>
<if test="a62 != null">a62,</if>
<if test="a63 != null">a63,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="hId != null">#{hId},</if>
<if test="hDate != null">#{hDate},</if>
<if test="mining != null">#{mining},</if>
<if test="exportUuid != null">#{exportUuid},</if>
<if test="kmCode != null">#{kmCode},</if>
<if test="a1 != null">#{a1},</if>
<if test="a2 != null">#{a2},</if>
<if test="a3 != null">#{a3},</if>
<if test="a4 != null">#{a4},</if>
<if test="a5 != null">#{a5},</if>
<if test="a6 != null">#{a6},</if>
<if test="a7 != null">#{a7},</if>
<if test="a8 != null">#{a8},</if>
<if test="a9 != null">#{a9},</if>
<if test="a10 != null">#{a10},</if>
<if test="a11 != null">#{a11},</if>
<if test="a12 != null">#{a12},</if>
<if test="a13 != null">#{a13},</if>
<if test="a14 != null">#{a14},</if>
<if test="a15 != null">#{a15},</if>
<if test="a16 != null">#{a16},</if>
<if test="a17 != null">#{a17},</if>
<if test="a18 != null">#{a18},</if>
<if test="a19 != null">#{a19},</if>
<if test="a20 != null">#{a20},</if>
<if test="a21 != null">#{a21},</if>
<if test="a22 != null">#{a22},</if>
<if test="a23 != null">#{a23},</if>
<if test="a24 != null">#{a24},</if>
<if test="a25 != null">#{a25},</if>
<if test="a26 != null">#{a26},</if>
<if test="a27 != null">#{a27},</if>
<if test="a28 != null">#{a28},</if>
<if test="a29 != null">#{a29},</if>
<if test="a30 != null">#{a30},</if>
<if test="a31 != null">#{a31},</if>
<if test="a32 != null">#{a32},</if>
<if test="a33 != null">#{a33},</if>
<if test="a34 != null">#{a34},</if>
<if test="a35 != null">#{a35},</if>
<if test="a36 != null">#{a36},</if>
<if test="a37 != null">#{a37},</if>
<if test="a38 != null">#{a38},</if>
<if test="a39 != null">#{a39},</if>
<if test="a40 != null">#{a40},</if>
<if test="a41 != null">#{a41},</if>
<if test="a42 != null">#{a42},</if>
<if test="a43 != null">#{a43},</if>
<if test="a44 != null">#{a44},</if>
<if test="a45 != null">#{a45},</if>
<if test="a46 != null">#{a46},</if>
<if test="a47 != null">#{a47},</if>
<if test="a48 != null">#{a48},</if>
<if test="a49 != null">#{a49},</if>
<if test="a50 != null">#{a50},</if>
<if test="a51 != null">#{a51},</if>
<if test="a52 != null">#{a52},</if>
<if test="a53 != null">#{a53},</if>
<if test="a54 != null">#{a54},</if>
<if test="a55 != null">#{a55},</if>
<if test="a56 != null">#{a56},</if>
<if test="a57 != null">#{a57},</if>
<if test="a58 != null">#{a58},</if>
<if test="a59 != null">#{a59},</if>
<if test="a60 != null">#{a60},</if>
<if test="a61 != null">#{a61},</if>
<if test="a62 != null">#{a62},</if>
<if test="a63 != null">#{a63},</if>
</trim>
</insert>
</mapper> </mapper>
...@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="roleId" column="role_id" /> <result property="roleId" column="role_id" />
<result property="historyName" column="history_name" /> <result property="historyName" column="history_name" />
<result property="historyRole" column="history_role" /> <result property="historyRole" column="history_role" />
<result property="convenRole" column="conven_role" />
<result property="historyContent" column="history_content" /> <result property="historyContent" column="history_content" />
<result property="identifyingCode" column="identifying_code" /> <result property="identifyingCode" column="identifying_code" />
<result property="cleanStatus" column="clean_status" /> <result property="cleanStatus" column="clean_status" />
...@@ -90,6 +91,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -90,6 +91,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
</insert> </insert>
<insert id="insertActSuppliesHistorydataAcc" parameterType="ActSuppliesHistorydata" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_historydata_copy1
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="importUuid != null">import_uuid,</if>
<if test="templateId != null">template_id,</if>
<if test="exportUuid != null">export_uuid,</if>
<if test="roleId != null">role_id,</if>
<if test="historyName != null">history_name,</if>
<if test="historyRole != null">history_role,</if>
<if test="convenRole != null">conven_role,</if>
<if test="identifyingCode != null">identifying_code,</if>
clean_status,
<if test="tylkStatus != null">tylk_status,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="date != null">date,</if>
<if test="mining != null">ssk_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="importUuid != null">#{importUuid},</if>
<if test="templateId != null">#{templateId},</if>
<if test="exportUuid != null">#{exportUuid},</if>
<if test="roleId != null">#{roleId},</if>
<if test="historyName != null">#{historyName},</if>
<if test="historyRole != null">#{historyRole},</if>
<if test="convenRole != null">#{convenRole},</if>
<if test="identifyingCode != null">#{identifyingCode},</if>
0,
<if test="tylkStatus != null">#{tylkStatus},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="date != null">#{date},</if>
<if test="mining != null">#{mining},</if>
</trim>
</insert>
<insert id="insertActSuppliesHistorycontent" parameterType="ActSuppliesHistorydata" useGeneratedKeys="true" keyProperty="id"> <insert id="insertActSuppliesHistorycontent" parameterType="ActSuppliesHistorydata" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_historycontent insert into act_supplies_historycontent
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -102,6 +141,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -102,6 +141,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
</insert> </insert>
<insert id="insertActSuppliesHistorycontentAcc" parameterType="ActSuppliesHistorydata" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_historycontent_copy1
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="importUuid != null">hid,</if>
<if test="historyContent != null">history_content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="importUuid != null">#{importUuid},</if>
<if test="historyContent != null">#{historyContent},</if>
</trim>
</insert>
<update id="updateActSuppliesHistorydata" parameterType="ActSuppliesHistorydata"> <update id="updateActSuppliesHistorydata" parameterType="ActSuppliesHistorydata">
update act_supplies_historydata update act_supplies_historydata
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
...@@ -183,6 +234,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -183,6 +234,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where t1.clean_status = 0 and t1.tylk_status =#{tylkStatus} where t1.clean_status = 0 and t1.tylk_status =#{tylkStatus}
</select> </select>
<select id="selectActSuppliesHistorydataAcc" parameterType="java.lang.Integer" resultMap="ActSuppliesHistorydataResult">
SELECT t1.id,t1.import_uuid, t1.template_id, t1.export_uuid, t1.role_id, t1.history_name, t1.history_role,t1.conven_role,t2.history_content, t1.identifying_code, t1.status, t1.create_by, t1.create_time,t1.date,t1.ssk_id
FROM act_supplies_historydata_copy1 t1
LEFT JOIN act_supplies_historycontent_copy1 t2 ON t1.import_uuid = t2.hid
where t1.clean_status = 0 and t1.tylk_status =#{tylkStatus}
</select>
<update id="updateActSuppliesHistorydataStatusById" parameterType="java.lang.Long"> <update id="updateActSuppliesHistorydataStatusById" parameterType="java.lang.Long">
update act_supplies_historydata update act_supplies_historydata
set clean_status = 1 set clean_status = 1
...@@ -190,6 +248,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -190,6 +248,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="gethId != null">and id = #{gethId}</if> <if test="gethId != null">and id = #{gethId}</if>
</where> </where>
</update> </update>
<update id="updateActSuppliesHistorydataStatusByIdAcc" parameterType="java.lang.Long">
update act_supplies_historydata_copy1
set clean_status = 1
<where>
<if test="gethId != null">and id = #{gethId}</if>
</where>
</update>
</mapper> </mapper>
...@@ -3,356 +3,365 @@ import Excel from 'exceljs'; ...@@ -3,356 +3,365 @@ import Excel from 'exceljs';
import FileSaver from 'file-saver'; import FileSaver from 'file-saver';
const exportExcel = function(luckysheet, value,contrast) { const exportExcel = function (luckysheet, value, contrast, id) {
// 参数为luckysheet.getluckysheetfile()获取的对象 // 函数体
// 1.创建工作簿,可以为工作簿添加属性 // 参数为luckysheet.getluckysheetfile()获取的对象
const workbook = new Excel.Workbook(); // 1.创建工作簿,可以为工作簿添加属性
// 2.创建表格,第二个参数可以配置创建什么样的工作表 const workbook = new Excel.Workbook();
if (Object.prototype.toString.call(luckysheet) === '[object Object]') { // 2.创建表格,第二个参数可以配置创建什么样的工作表
luckysheet = [luckysheet]; if (Object.prototype.toString.call(luckysheet) === '[object Object]') {
} luckysheet = [luckysheet];
luckysheet.forEach(function(table) { }
if (table.data.length === 0) { return true; } luckysheet.forEach(function (table) {
// ws.getCell('B2').fill = fills. if (table.data.length === 0) { return true; }
const worksheet = workbook.addWorksheet(table.name); // ws.getCell('B2').fill = fills.
const merge = (table.config && table.config.merge) || {}; const worksheet = workbook.addWorksheet(table.name);
const borderInfo = (table.config && table.config.borderInfo) || {}; const merge = (table.config && table.config.merge) || {};
// 3.设置单元格合并,设置单元格边框,设置单元格样式,设置值 const borderInfo = (table.config && table.config.borderInfo) || {};
setStyleAndValue(table.data, worksheet,contrast); // 3.设置单元格合并,设置单元格边框,设置单元格样式,设置值
setMerge(merge, worksheet); setStyleAndValue(table.data, worksheet, contrast);
setBorder(borderInfo, worksheet); setMerge(merge, worksheet);
return true; setBorder(borderInfo, worksheet);
}); if (id === 1248) {
// return worksheet.getRow(2).hidden = true;
// 4.写入 buffer worksheet.getRow(3).hidden = true;
const buffer = workbook.xlsx.writeBuffer().then(data => { worksheet.getRow(4).hidden = true;
// console.log('data', data) worksheet.getRow(5).hidden = true;
const blob = new Blob([data], { }
type: 'application/vnd.ms-excel;charset=utf-8' return true;
}); });
console.log('导出成功!');
FileSaver.saveAs(blob, `${value}.xlsx`); // return
}); // 4.写入 buffer
return buffer; const buffer = workbook.xlsx.writeBuffer().then(data => {
// console.log('data', data)
const blob = new Blob([data], {
type: 'application/vnd.ms-excel;charset=utf-8'
});
console.log('导出成功!');
FileSaver.saveAs(blob, `${value}.xlsx`);
});
return buffer;
}; };
var setMerge = function(luckyMerge = {}, worksheet) { var setMerge = function (luckyMerge = {}, worksheet) {
const mergearr = Object.values(luckyMerge); const mergearr = Object.values(luckyMerge);
mergearr.forEach(function(elem) { mergearr.forEach(function (elem) {
// elem格式:{r: 0, c: 0, rs: 1, cs: 2} // elem格式:{r: 0, c: 0, rs: 1, cs: 2}
// 按开始行,开始列,结束行,结束列合并(相当于 K10:M12) // 按开始行,开始列,结束行,结束列合并(相当于 K10:M12)
worksheet.mergeCells( worksheet.mergeCells(
elem.r + 1, elem.r + 1,
elem.c + 1, elem.c + 1,
elem.r + elem.rs, elem.r + elem.rs,
elem.c + elem.cs elem.c + elem.cs
); );
}); });
}; };
var setBorder = function(luckyBorderInfo, worksheet) { var setBorder = function (luckyBorderInfo, worksheet) {
if (!Array.isArray(luckyBorderInfo)) { return; } if (!Array.isArray(luckyBorderInfo)) { return; }
// console.log('luckyBorderInfo', luckyBorderInfo) // console.log('luckyBorderInfo', luckyBorderInfo)
luckyBorderInfo.forEach(function(elem) { luckyBorderInfo.forEach(function (elem) {
// 现在只兼容到borderType 为range的情况 // 现在只兼容到borderType 为range的情况
// console.log('ele', elem) // console.log('ele', elem)
if (elem.rangeType === 'range') { if (elem.rangeType === 'range') {
let border = borderConvert(elem.borderType, elem.style, elem.color); let border = borderConvert(elem.borderType, elem.style, elem.color);
let rang = elem.range[0]; let rang = elem.range[0];
// console.log('range', rang) // console.log('range', rang)
let row = rang.row; let row = rang.row;
let column = rang.column; let column = rang.column;
for (let i = row[0] + 1; i < row[1] + 2; i++) { for (let i = row[0] + 1; i < row[1] + 2; i++) {
for (let y = column[0] + 1; y < column[1] + 2; y++) { for (let y = column[0] + 1; y < column[1] + 2; y++) {
worksheet.getCell(i, y).border = border; worksheet.getCell(i, y).border = border;
}
}
} }
} if (elem.rangeType === 'cell') {
} // col_index: 2
if (elem.rangeType === 'cell') { // row_index: 1
// col_index: 2 // b: {
// row_index: 1 // color: '#d0d4e3'
// b: { // style: 1
// color: '#d0d4e3' // }
// style: 1 const { col_index, row_index } = elem.value;
// } const borderData = Object.assign({}, elem.value);
const { col_index, row_index } = elem.value; delete borderData.col_index;
const borderData = Object.assign({}, elem.value); delete borderData.row_index;
delete borderData.col_index; let border = addborderToCell(borderData, row_index, col_index);
delete borderData.row_index; // console.log('bordre', border, borderData)
let border = addborderToCell(borderData, row_index, col_index); worksheet.getCell(row_index + 1, col_index + 1).border = border;
// console.log('bordre', border, borderData) }
worksheet.getCell(row_index + 1, col_index + 1).border = border; // console.log(rang.column_focus + 1, rang.row_focus + 1)
} // worksheet.getCell(rang.row_focus + 1, rang.column_focus + 1).border = border
// console.log(rang.column_focus + 1, rang.row_focus + 1) });
// worksheet.getCell(rang.row_focus + 1, rang.column_focus + 1).border = border
});
}; };
var setStyleAndValue = function(cellArr, worksheet,contrast) { var setStyleAndValue = function (cellArr, worksheet, contrast) {
if (!Array.isArray(cellArr)) { return; } if (!Array.isArray(cellArr)) { return; }
cellArr.forEach(function(row, rowid) { cellArr.forEach(function (row, rowid) {
row.every(function(cell, columnid) { row.every(function (cell, columnid) {
if (!cell) { return true; } if (!cell) { return true; }
let fill = fillConvert(cell.bg); let fill = fillConvert(cell.bg);
let font = fontConvert( let font = fontConvert(
cell.ff, cell.ff,
cell.fc, cell.fc,
cell.bl, cell.bl,
cell.it, cell.it,
cell.fs, cell.fs,
cell.cl, cell.cl,
cell.ul, cell.ul,
cell.ps cell.ps
); );
let alignment = alignmentConvert(cell.vt, cell.ht, cell.tb, cell.tr); let alignment = alignmentConvert(cell.vt, cell.ht, cell.tb, cell.tr);
let value = ''; let value = '';
if (cell.f) { if (cell.f) {
value = { formula: cell.f, result: cell.v }; value = { formula: cell.f, result: cell.v };
} else if (!cell.v && cell.ct && cell.ct.s) { } else if (!cell.v && cell.ct && cell.ct.s) {
// xls转为xlsx之后,内部存在不同的格式,都会进到富文本里,即值不存在与cell.v,而是存在于cell.ct.s之后 // xls转为xlsx之后,内部存在不同的格式,都会进到富文本里,即值不存在与cell.v,而是存在于cell.ct.s之后
// value = cell.ct.s[0].v // value = cell.ct.s[0].v
cell.ct.s.forEach(arr => { cell.ct.s.forEach(arr => {
value += arr.v; value += arr.v;
}); });
} else { } else {
value = cell.v; value = cell.v;
} }
// style 填入到_value中可以实现填充色 // style 填入到_value中可以实现填充色
let letter = createCellPos(columnid); let letter = createCellPos(columnid);
let target = worksheet.getCell(letter + (rowid + 1)); let target = worksheet.getCell(letter + (rowid + 1));
if(contrast){ if (contrast) {
const column =worksheet.getColumn(1); const column = worksheet.getColumn(1);
const column2 =worksheet.getColumn(2); const column2 = worksheet.getColumn(2);
column.hidden=true; column.hidden = true;
column2.hidden=true; column2.hidden = true;
} }
// console.log('1233', letter + (rowid + 1)) // console.log('1233', letter + (rowid + 1))
for (const key in fill) { for (const key in fill) {
target.fill = fill; target.fill = fill;
break; break;
} }
target.font = font; target.font = font;
target.alignment = alignment; target.alignment = alignment;
target.value = value; target.value = value;
return true; return true;
});
}); });
});
}; };
var fillConvert = function(bg) { var fillConvert = function (bg) {
if (!bg) { if (!bg) {
return {}; return {};
} }
// const bgc = bg.replace('#', '') // const bgc = bg.replace('#', '')
let fill = { let fill = {
type: 'pattern', type: 'pattern',
pattern: 'solid', pattern: 'solid',
fgColor: { argb: bg.replace('#', '') } fgColor: { argb: bg.replace('#', '') }
}; };
return fill; return fill;
}; };
var fontConvert = function( var fontConvert = function (
ff = 0, ff = 0,
fc = '#000000', fc = '#000000',
bl = 0, bl = 0,
it = 0, it = 0,
fs = 10, fs = 10,
cl = 0, cl = 0,
ul = 0, ul = 0,
) { ) {
// luckysheet:ff(样式), fc(颜色), bl(粗体), it(斜体), fs(大小), cl(删除线), ul(下划线) // luckysheet:ff(样式), fc(颜色), bl(粗体), it(斜体), fs(大小), cl(删除线), ul(下划线)
const luckyToExcel = { const luckyToExcel = {
0: '微软雅黑', 0: '微软雅黑',
1: '宋体(Song)', 1: '宋体(Song)',
2: '黑体(ST Heiti)', 2: '黑体(ST Heiti)',
3: '楷体(ST Kaiti)', 3: '楷体(ST Kaiti)',
4: '仿宋(ST FangSong)', 4: '仿宋(ST FangSong)',
5: '新宋体(ST Song)', 5: '新宋体(ST Song)',
6: '华文新魏', 6: '华文新魏',
7: '华文行楷', 7: '华文行楷',
8: '华文隶书', 8: '华文隶书',
9: 'Arial', 9: 'Arial',
10: 'Times New Roman ', 10: 'Times New Roman ',
11: 'Tahoma ', 11: 'Tahoma ',
12: 'Verdana', 12: 'Verdana',
num2bl: function(num) { num2bl: function (num) {
return num === 0 ? false : true; return num === 0 ? false : true;
} }
}; };
// 出现Bug,导入的时候ff为luckyToExcel的val // 出现Bug,导入的时候ff为luckyToExcel的val
let font = { let font = {
name: typeof ff === 'number' ? luckyToExcel[ff] : ff, name: typeof ff === 'number' ? luckyToExcel[ff] : ff,
family: 1, family: 1,
size: fs, size: fs,
color: { argb: fc.replace('#', '') }, color: { argb: fc.replace('#', '') },
bold: luckyToExcel.num2bl(bl), bold: luckyToExcel.num2bl(bl),
italic: luckyToExcel.num2bl(it), italic: luckyToExcel.num2bl(it),
underline: luckyToExcel.num2bl(ul), underline: luckyToExcel.num2bl(ul),
strike: luckyToExcel.num2bl(cl), strike: luckyToExcel.num2bl(cl),
}; };
return font; return font;
}; };
var alignmentConvert = function( var alignmentConvert = function (
vt = 'default', vt = 'default',
ht = 'default', ht = 'default',
tb = 'default', tb = 'default',
tr = 'default', tr = 'default',
) { ) {
// luckysheet:vt(垂直), ht(水平), tb(换行), tr(旋转) // luckysheet:vt(垂直), ht(水平), tb(换行), tr(旋转)
const luckyToExcel = { const luckyToExcel = {
vertical: { vertical: {
0: 'middle', 0: 'middle',
1: 'top', 1: 'top',
2: 'bottom', 2: 'bottom',
default: 'top' default: 'top'
}, },
horizontal: { horizontal: {
0: 'center', 0: 'center',
1: 'left', 1: 'left',
2: 'right', 2: 'right',
default: 'left' default: 'left'
}, },
wrapText: { wrapText: {
0: false, 0: false,
1: false, 1: false,
2: true, 2: true,
default: false default: false
}, },
textRotation: { textRotation: {
0: 0, 0: 0,
1: 45, 1: 45,
2: -45, 2: -45,
3: 'vertical', 3: 'vertical',
4: 90, 4: 90,
5: -90, 5: -90,
default: 0 default: 0
} }
}; };
let alignment = { let alignment = {
vertical: luckyToExcel.vertical[vt], vertical: luckyToExcel.vertical[vt],
horizontal: luckyToExcel.horizontal[ht], horizontal: luckyToExcel.horizontal[ht],
wrapText: luckyToExcel.wrapText[tb], wrapText: luckyToExcel.wrapText[tb],
textRotation: luckyToExcel.textRotation[tr], textRotation: luckyToExcel.textRotation[tr],
}; };
return alignment; return alignment;
}; };
var borderConvert = function(borderType, style = 1, color = '#000') { var borderConvert = function (borderType, style = 1, color = '#000') {
// 对应luckysheet的config中borderinfo的的参数 // 对应luckysheet的config中borderinfo的的参数
if (!borderType) { if (!borderType) {
return {}; return {};
}
const luckyToExcel = {
type: {
'border-all': 'all',
'border-top': 'top',
'border-right': 'right',
'border-bottom': 'bottom',
'border-left': 'left'
},
style: {
0: 'none',
1: 'thin',
2: 'hair',
3: 'dotted',
4: 'dashDot', // 'Dashed',
5: 'dashDot',
6: 'dashDotDot',
7: 'double',
8: 'medium',
9: 'mediumDashed',
10: 'mediumDashDot',
11: 'mediumDashDotDot',
12: 'slantDashDot',
13: 'thick'
} }
}; const luckyToExcel = {
let template = { type: {
style: luckyToExcel.style[style], 'border-all': 'all',
color: { argb: color.replace('#', '') } 'border-top': 'top',
}; 'border-right': 'right',
let border = {}; 'border-bottom': 'bottom',
if (luckyToExcel.type[borderType] === 'all') { 'border-left': 'left'
border['top'] = template; },
border['right'] = template; style: {
border['bottom'] = template; 0: 'none',
border['left'] = template; 1: 'thin',
} else { 2: 'hair',
border[luckyToExcel.type[borderType]] = template; 3: 'dotted',
} 4: 'dashDot', // 'Dashed',
// console.log('border', border) 5: 'dashDot',
return border; 6: 'dashDotDot',
7: 'double',
8: 'medium',
9: 'mediumDashed',
10: 'mediumDashDot',
11: 'mediumDashDotDot',
12: 'slantDashDot',
13: 'thick'
}
};
let template = {
style: luckyToExcel.style[style],
color: { argb: color.replace('#', '') }
};
let border = {};
if (luckyToExcel.type[borderType] === 'all') {
border['top'] = template;
border['right'] = template;
border['bottom'] = template;
border['left'] = template;
} else {
border[luckyToExcel.type[borderType]] = template;
}
// console.log('border', border)
return border;
}; };
function addborderToCell(borders, row_index, col_index) { function addborderToCell(borders, row_index, col_index) {
let border = {}; let border = {};
const luckyExcel = { const luckyExcel = {
type: { type: {
l: 'left', l: 'left',
r: 'right', r: 'right',
b: 'bottom', b: 'bottom',
t: 'top' t: 'top'
}, },
style: { style: {
0: 'none', 0: 'none',
1: 'thin', 1: 'thin',
2: 'hair', 2: 'hair',
3: 'dotted', 3: 'dotted',
4: 'dashDot', // 'Dashed', 4: 'dashDot', // 'Dashed',
5: 'dashDot', 5: 'dashDot',
6: 'dashDotDot', 6: 'dashDotDot',
7: 'double', 7: 'double',
8: 'medium', 8: 'medium',
9: 'mediumDashed', 9: 'mediumDashed',
10: 'mediumDashDot', 10: 'mediumDashDot',
11: 'mediumDashDotDot', 11: 'mediumDashDotDot',
12: 'slantDashDot', 12: 'slantDashDot',
13: 'thick' 13: 'thick'
} }
}; };
// console.log('borders', borders) // console.log('borders', borders)
for (const bor in borders) { for (const bor in borders) {
// console.log(bor) // console.log(bor)
if (borders[bor].color.indexOf('rgb') === -1) { if (borders[bor].color.indexOf('rgb') === -1) {
border[luckyExcel.type[bor]] = { border[luckyExcel.type[bor]] = {
style: luckyExcel.style[borders[bor].style], style: luckyExcel.style[borders[bor].style],
color: { argb: borders[bor].color.replace('#', '') } color: { argb: borders[bor].color.replace('#', '') }
}; };
} else { } else {
border[luckyExcel.type[bor]] = { border[luckyExcel.type[bor]] = {
style: luckyExcel.style[borders[bor].style], style: luckyExcel.style[borders[bor].style],
color: { argb: borders[bor].color } color: { argb: borders[bor].color }
}; };
}
} }
}
return border; return border;
} }
function createCellPos(n) { function createCellPos(n) {
let ordA = 'A'.charCodeAt(0); let ordA = 'A'.charCodeAt(0);
let ordZ = 'Z'.charCodeAt(0); let ordZ = 'Z'.charCodeAt(0);
let len = ordZ - ordA + 1; let len = ordZ - ordA + 1;
let s = ''; let s = '';
while (n >= 0) { while (n >= 0) {
s = String.fromCharCode((n % len) + ordA) + s; s = String.fromCharCode((n % len) + ordA) + s;
n = Math.floor(n / len) - 1; n = Math.floor(n / len) - 1;
} }
return s; return s;
} }
export { export {
exportExcel exportExcel
}; };
...@@ -9,6 +9,14 @@ export function selectActSuppliesHistorydata(tylkStatus) { ...@@ -9,6 +9,14 @@ export function selectActSuppliesHistorydata(tylkStatus) {
}) })
} }
// 查询通用凭证单表数据
export function selectActSuppliesHistorydataAcc(tylkStatus) {
return request({
url: '/system/cleaningrule/queryAllAcc/'+tylkStatus,
method: 'get'
})
}
......
import request from '@/utils/request' import request from '@/utils/request'
import LuckyExcel from "luckyexcel"; import LuckyExcel from "luckyexcel";
//查询6矿物聊
export function materialListPZ() {
return request({
url: '/ActSuppliesDetails/ActSuppliesDetails/materialListPZ' ,
method: 'get'
})
}
//小物料转大物料 //小物料转大物料
export function materialConvert(data) { export function materialConvert(data) {
return request({ return request({
url: '/ActSuppliesConvert/ActSuppliesConvert/converSupplies', url: '/ActSuppliesConvert/ActSuppliesConvert/converSupplies',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 查询Excel模板列表 // 查询Excel模板列表
export function listSuppliesTemplate(query) { export function listSuppliesTemplate(query) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate/list', url: '/SuppliesTemplate/SuppliesTemplate/list',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 查询导入规则列表 // 查询导入规则列表
...@@ -34,21 +40,36 @@ export function getSuppliesrole(id) { ...@@ -34,21 +40,36 @@ export function getSuppliesrole(id) {
method: 'get' method: 'get'
}) })
} }
//按照矿的id去查部门分类
export function department(sskId){
return request({
url: `/ActClassification/ActClassification/SunDy/${sskId}`,
method: 'get'
})
}
//获取到会计科目编码
export function accountingcode(newData){
return request({
url: `/ActSuppliesAccount/ActSuppliesAccount/options`,
method: 'post',
data: newData
})
}
//展示excel模板 //展示excel模板
export function listSuppliesTemplateId(id) { export function listSuppliesTemplateId(id) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate/listId/' + id, url: '/SuppliesTemplate/SuppliesTemplate/listId/' + id,
method: 'get' method: 'get'
}) })
} }
// 查询Excel模板详细 // 查询Excel模板详细
export function getSuppliesTemplate(id) { export function getSuppliesTemplate(id) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate/' + id, url: '/SuppliesTemplate/SuppliesTemplate/' + id,
method: 'get' method: 'get'
}) })
} }
// 修改导入规则 // 修改导入规则
...@@ -62,23 +83,23 @@ export function updateSuppliesrole(id) { ...@@ -62,23 +83,23 @@ export function updateSuppliesrole(id) {
// 新增Excel模板 // 新增Excel模板
export function addSuppliesTemplate(data) { export function addSuppliesTemplate(data) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate', url: '/SuppliesTemplate/SuppliesTemplate',
headers:{ headers:{
repeatSubmit:false repeatSubmit:false
}, },
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 修改Excel模板 // 修改Excel模板
export function updateSuppliesTemplate(data) { export function updateSuppliesTemplate(data) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate', url: '/SuppliesTemplate/SuppliesTemplate',
method: 'put', method: 'put',
data: data data: data
}) })
} }
export function releaseTemplateStatus(id){ export function releaseTemplateStatus(id){
...@@ -104,123 +125,123 @@ export function CopyTemplate(id){ ...@@ -104,123 +125,123 @@ export function CopyTemplate(id){
// 删除Excel模板 // 删除Excel模板
export function delSuppliesTemplate(id) { export function delSuppliesTemplate(id) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate/' + id, url: '/SuppliesTemplate/SuppliesTemplate/' + id,
method: 'delete' method: 'delete'
}) })
} }
// 展示Excel模板 // 展示Excel模板
export function delSuppliesSave(id) { export function delSuppliesSave(id) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate/save/' + id, url: '/SuppliesTemplate/SuppliesTemplate/save/' + id,
method: 'get' method: 'get'
}) })
} }
//启用 //启用
export function toggleEnable(id) { export function toggleEnable(id) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate/enable/' +id, url: '/SuppliesTemplate/SuppliesTemplate/enable/' +id,
method: 'get', method: 'get',
}) })
} }
//禁用 //禁用
export function toggleDisable(id) { export function toggleDisable(id) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate/disable/' + id, url: '/SuppliesTemplate/SuppliesTemplate/disable/' + id,
method: 'get', method: 'get',
}) })
} }
export function findName(name) { export function findName(name) {
return request({ return request({
url: '/SuppliesTemplate/SuppliesTemplate/ifName/' + name, url: '/SuppliesTemplate/SuppliesTemplate/ifName/' + name,
method: 'get' method: 'get'
}) })
} }
// 模板转换页面查询规则对应用友物料名称 // 模板转换页面查询规则对应用友物料名称
export function getSuppliesName(name) { export function getSuppliesName(name) {
return request({ return request({
url: '/ActSuppliesConvert/ActSuppliesConvert/saveSuppliesname/' + name, url: '/ActSuppliesConvert/ActSuppliesConvert/saveSuppliesname/' + name,
method: 'get' method: 'get'
}) })
} }
// 模板转换页面查询Excel模板列表 // 模板转换页面查询Excel模板列表
export function templateList(query) { export function templateList(query) {
return request({ return request({
url: '/ActSuppliesConvert/ActSuppliesConvert/list', url: '/ActSuppliesConvert/ActSuppliesConvert/list',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 模板转换页面查询Excel模板内容列表 // 模板转换页面查询Excel模板内容列表
export function templateListid(id) { export function templateListid(id) {
return request({ return request({
url: '/ActSuppliesConvert/ActSuppliesConvert/listid/' + id, url: '/ActSuppliesConvert/ActSuppliesConvert/listid/' + id,
method: 'get' method: 'get'
}) })
} }
// 模板转换页面查询规则列表 // 模板转换页面查询规则列表
export function roleList(id) { export function roleList(id) {
return request({ return request({
url: '/ActSuppliesConvert/ActSuppliesConvert/rolelist/' + id, url: '/ActSuppliesConvert/ActSuppliesConvert/rolelist/' + id,
method: 'get' method: 'get'
}) })
} }
// 模板转换页面查询规则详情列表 // 模板转换页面查询规则详情列表
export function roleListid(id) { export function roleListid(id) {
return request({ return request({
url: '/ActSuppliesConvert/ActSuppliesConvert/rolelistid/' + id, url: '/ActSuppliesConvert/ActSuppliesConvert/rolelistid/' + id,
method: 'get' method: 'get'
}) })
} }
// 查询规则列表 // 查询规则列表
export function listRule(query) { export function listRule(query) {
return request({ return request({
url: '/system/ruleManagement/list', url: '/system/ruleManagement/list',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 查询规则详情详细 // 查询规则详情详细
export function getRule(id) { export function getRule(id) {
return request({ return request({
url: '/system/ruleManagement/' + id, url: '/system/ruleManagement/' + id,
method: 'get' method: 'get'
}) })
} }
// 新增规则详情 // 新增规则详情
export function addRuleManagement(data) { export function addRuleManagement(data) {
return request({ return request({
url: '/system/ruleManagement/add', url: '/system/ruleManagement/add',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 修改规则详情 // 修改规则详情
export function updateRuleManagement(data) { export function updateRuleManagement(data) {
return request({ return request({
url: '/system/ruleManagement/edit', url: '/system/ruleManagement/edit',
method: 'put', method: 'put',
data: data data: data
}) })
} }
// 删除规则详情 // 删除规则详情
export function delRuleManagement(id) { export function delRuleManagement(id) {
return request({ return request({
url: '/system/ruleManagement/' + id, url: '/system/ruleManagement/' + id,
method: 'delete' method: 'delete'
}) })
} }
//查询六矿物料 //查询六矿物料
...@@ -231,13 +252,7 @@ export function materialList() { ...@@ -231,13 +252,7 @@ export function materialList() {
}) })
} }
//查询六矿物料
export function materialListPZ() {
return request({
url: '/ActSuppliesDetails/ActSuppliesDetails/materialListPZ' ,
method: 'get'
})
}
// // 查询模板列表 // // 查询模板列表
......
...@@ -108,7 +108,6 @@ export function addInsertAccount1(data) { ...@@ -108,7 +108,6 @@ export function addInsertAccount1(data) {
}) })
} }
//清洗通用凭证单 //清洗通用凭证单
export function addInsertAccount2(data) { export function addInsertAccount2(data) {
return request({ return request({
url: '/system/historydata/addInsertAccount2', url: '/system/historydata/addInsertAccount2',
...@@ -116,3 +115,6 @@ export function addInsertAccount2(data) { ...@@ -116,3 +115,6 @@ export function addInsertAccount2(data) {
data: data data: data
}) })
} }
...@@ -10,7 +10,7 @@ const service = axios.create({ ...@@ -10,7 +10,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分 // axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API, baseURL: process.env.VUE_APP_BASE_API,
// 超时 // 超时
timeout: 100000 timeout: 1000000000
}) })
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<el-form ref="queryForm" size="small" :inline="true" label-width="68px"> <el-form ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="模板" prop="name"> <el-form-item label="模板" prop="name">
<el-select v-model="selectedOption" ref="mySelect" size="mini" @change="handleOptionChange" filterable <el-select v-model="selectedOption" ref="mySelect" size="mini" @change="handleOptionChange" filterable
placeholder="请选择您要查看的模板"> placeholder="请选择您要查看的模板">
<el-option v-for="item in depss" :key="item.id" :label="item.templateName" :value="item.id"> <el-option v-for="item in depss" :key="item.id" :label="item.templateName" :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-upload type="file" name="file" ref="upload" :before-upload="handleFileChange" action='' accept='.xlsx' <el-upload type="file" name="file" ref="upload" :before-upload="handleFileChange" action='' accept='.xlsx'
:limit="1" :file-list="fileList" :disabled="disableNextButton" :show-file-list=false> :limit="1" :file-list="fileList" :disabled="disableNextButton" :show-file-list=false>
<el-button plain size="mini" icon="el-icon-download" type="primary" :disabled="disableNextButton" <el-button plain size="mini" icon="el-icon-download" type="primary" :disabled="disableNextButton"
@click="rulesdate">导入</el-button> @click="rulesdate">导入</el-button>
</el-upload> </el-upload>
<el-button :plain="true" style="display: none;" @click="open4">错误</el-button> <el-button :plain="true" style="display: none;" @click="open4">错误</el-button>
...@@ -50,242 +50,215 @@ ...@@ -50,242 +50,215 @@
<script> <script>
import { selectActSuppliesHistorydata } from "@/api/Actsupplies/cleaning_rule"; import { selectActSuppliesHistorydata } from "@/api/Actsupplies/cleaning_rule";
import { getSuppliesTemplate, listSuppliesTemplate, roleList, materialConvert, materialListPZ, accountingcode, department, roleListid, materialList } from "@/api/ruoyi-myLuckyexcel/myluckyexcel"; import { getSuppliesTemplate, listSuppliesTemplate, roleList, materialConvert, materialListPZ, accountingcode, department, roleListid, materialList } from "@/api/ruoyi-myLuckyexcel/myluckyexcel";
import { addInsert,addInsertAccount1,addInsertAccount2 } from "@/api/system/historydata" import { addInsert, addInsert1, addInsert2, addInsertAccount1, addInsertAccount2 } from "@/api/system/historydata"
/*import luckysheet from 'luckysheet'*/ /*import luckysheet from 'luckysheet'*/
import LuckyExcel from 'luckyexcel' import LuckyExcel from 'luckyexcel'
//导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用! //导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!
/*import {materialList} from "@/api/ruoyi-myLuckyexcel/myluckyexcel";*/ /*import {materialList} from "@/api/ruoyi-myLuckyexcel/myluckyexcel";*/
import { exportExcel } from '../../../../public/exportExcel'; import { exportExcel } from '../../../../public/exportExcel';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { getInfo } from "@/api/login"; import { getInfo } from "@/api/login";
// import moment from 'moment'; import { listSuppliesexpense } from "../../../api/ActClassification/ActClassification";
import { listSuppliesexpense } from "../../../api/ActClassification/ActClassification"; var fileName = "新建XLSX工作表"; //定义表名
var fileName = "新建XLSX工作表"; //定义表名 var rule = [];
var rule = []; var tempId;
var tempId; var roleId;
var roleId; var uuid1;
var uuid1; var trueORfalse = false;
var trueORfalse = false; var modify = false;
var modify = false; export default {
export default { name: "Mymodule",
name: "Mymodule", data() {
data() { return {
return { value: '',
value: '', VoucherForm: '',
VoucherForm: '', miningValue: [
miningValue: [
{
name: '林西矿',
id: '011704'
},
{
name: '唐山矿',
id: '010101'
},
], {
userName: '', name: '林西矿',
//选择的矿区 id: '011704'
select: '', },
//转换完成成本材料的所有数据
middle: '',
//未导入成本材料表模板所有数据
jsondata: '',
//编码数据
codess: '',
showMask: false,
//选中的表的数据
selected: '',
uuid: '',
//弹出页面的表名
from_name: "",
//往后台穿的导入表的东西
ImportTables: {},
//往后台传生成表的数据
generate: {},
// 是否显示弹出层
dialogVisible: false,
selectedOption: '',
selectedRule: '',
luckysheetData: '',
fileList: [],
disableNextButton: true,
depss: [],
// 表单参数
from: {},
date: '',
mining: '',
froms: {
hId: "",
projectId: "",
projectName: "",
departmentName: "",
number: "",
nuitPrice: "",
money: "",
createBy: "",
hDate: null,
mining: ""
},
synthesis: '',
historyRole: [],
dfrom: {},
imp: {},
ssd: {},
// 查询参数
queryParams: {
status: 0
},
}; {
}, name: '唐山矿',
created() { id: '010101'
//刷新页面时进行的操作 },
this.getList();
},
mounted() {
this.init();
fileName = "新建XLSX工作表";
this.list()
},
computed: {
},
methods: {
//查询材料编码
list() {
materialListPZ().then(response => {
this.codess = response.rows
})
//查用户名称
getInfo().then(response => {
this.userName = response.user.nickName
})
getSuppliesTemplate(1248).then(response => {
const sysSupplies = response.rows;
this.luckysheetData = sysSupplies[0].templateContent;
this.VoucherForm = JSON.parse(sysSupplies[0].templateContent);
})
getSuppliesTemplate(1257).then(response => {
this.generate.historyName = response.rows[0].templateName + '(生成文件)';
const sysSupplies = response.rows;
this.luckysheetData = sysSupplies[0].templateContent;
//将接收到的json存到json_data中
//const json_data = response.data;
this.jsondata = JSON.parse(sysSupplies[0].templateContent);
})
],
userName: '',
//选择的矿区
select: '',
//转换完成成本材料的所有数据
middle: '',
//未导入成本材料表模板所有数据
jsondata: '',
//编码数据
codess: '',
showMask: false,
//选中的表的数据
selected: '',
uuid: '',
//弹出页面的表名
from_name: "",
//往后台穿的导入表的东西
ImportTables: {},
//往后台传生成表的数据
generate: {},
// 是否显示弹出层
dialogVisible: false,
selectedOption: '',
selectedRule: '',
luckysheetData: '',
fileList: [],
disableNextButton: true,
depss: [],
// 表单参数
from: {},
date: '',
mining: '',
froms: {
hId: "",
projectId: "",
projectName: "",
departmentName: "",
number: "",
nuitPrice: "",
money: "",
createBy: "",
hDate: null,
mining: ""
},
synthesis: '',
historyRole: [],
dfrom: {},
imp: {},
ssd: {},
// 查询参数
queryParams: {
status: 0
},
};
}, },
/** 判断是否选择时间*/ created() {
rulesdate() { //刷新页面时进行的操作
this.getList();
const minvalue = this.miningValue.find(obj => obj.id === this.mining)
if (this.date == '' || this.date == null) {
this.disableNextButton = true;
this.$message.error('请选择时间日期!');
} else if (this.mining == '' || this.mining == null) {
this.disableNextButton = true;
this.$message.error('请选择所属矿区!');
}
}, },
handledateChange(value) { mounted() {
// const newDate = moment(value, 'MM/DD/YYYY').format('YYYY-MM');
this.date = value this.init();
if (this.date == '' || this.date == null || this.date == undefined) { fileName = "新建XLSX工作表";
this.disableNextButton = true; this.list()
} else {
this.disableNextButton = false;
}
}, },
handleminingChange(value) { computed: {
this.select = value
department(value).then(response => {
})
if (this.date == '' || this.date == null || this.date == undefined) {
this.disableNextButton = true;
} else {
this.disableNextButton = false;
}
}, },
methods: {
//查询材料编码
list() {
materialListPZ().then(response => {
this.codess = response.rows
})
//查用户名称
getInfo().then(response => {
this.userName = response.user.nickName
})
getSuppliesTemplate(1248).then(response => {
const sysSupplies = response.rows;
this.luckysheetData = sysSupplies[0].templateContent;
let VoucherForm = JSON.parse(sysSupplies[0].templateContent);
this.VoucherForm = JSON.stringify(VoucherForm)
})
getSuppliesTemplate(1257).then(response => {
this.generate.historyName = response.rows[0].templateName + '(生成文件)';
const sysSupplies = response.rows;
this.luckysheetData = sysSupplies[0].templateContent;
//将接收到的json存到json_data中
//const json_data = response.data;
this.jsondata = JSON.parse(sysSupplies[0].templateContent);
})
/** 页面刷新时展示的数据*/
getList() {
listSuppliesTemplate(this.queryParams).then(response => {
this.depss = response.rows;
});
}, },
/** 下拉选和页面luckysheet绑定 */ /** 判断是否选择时间*/
handleOptionChange(value) { rulesdate() {
this.value = value
this.selectedRule = ''; const minvalue = this.miningValue.find(obj => obj.id === this.mining)
this.disableNextButton = this.selectedRule === ''; if (this.date == '' || this.date == null) {
//根据选中的下拉选项值获取相应的信息 this.disableNextButton = true;
getSuppliesTemplate(this.selectedOption).then(response => { this.$message.error('请选择时间日期!');
//如果为六矿汇总表,导出时隐藏前两列 } else if (this.mining == '' || this.mining == null) {
if (this.selectedOption === 7 || this.selectedOption === 10) { this.disableNextButton = true;
trueORfalse = true; this.$message.error('请选择所属矿区!');
}
},
handledateChange(value) {
const date = new Date(value);
// 获取年份和月份
const year = date.getFullYear(); // 获取年份
const month = (date.getMonth() + 1).toString().padStart(2, "0"); // 获取月份并补零处理
// 将年份和月份拼接成 "YYYY-MM" 的格式
const formattedDate = year + "-" + month;
this.date = formattedDate
if (this.date == '' || this.date == null || this.date == undefined) {
this.disableNextButton = true;
} else { } else {
trueORfalse = false; this.disableNextButton = false;
} }
modify = false; },
tempId = this.selectedOption; handleminingChange(value) {
uuid1 = this.uuid = uuidv4().substring(0, 8); this.select = value
department(value).then(response => {
const sysSupplies = response.rows; })
this.luckysheetData = sysSupplies[0].templateContent; if (this.date == '' || this.date == null || this.date == undefined) {
//将接收到的json存到json_data中 this.disableNextButton = true;
//const json_data = response.data; } else {
var json_data = JSON.parse(sysSupplies[0].templateContent); this.disableNextButton = false;
roleList(this.selectedOption).then(response => { }
}); },
let suffixArr = sysSupplies[0].templateName.split('.');
fileName = suffixArr[0]; /** 页面刷新时展示的数据*/
//luckysheet.destroy() getList() {
luckysheet.create({ listSuppliesTemplate(this.queryParams).then(response => {
container: "luckysheet", // Luckysheet 的容器元素 ID this.depss = response.rows;
title: fileName, // Excel 文件名
data: json_data, // Excel 数据
showinfobar: false, //是否显示顶部名称栏
lang: 'zh',
}); });
}).catch(() => {
// 处理错误逻辑,这里是一个空的错误处理函数
this.$message.error('查询失败,发生未知错误!');
});
},
open4() {
this.$message.error('找不到部门名称或者结算金额和材料编码列,请改为正确名称');
},
/** 规则下拉选 调佣后端的方法*/
handleRuleChange() {
if (this.selectedOption === '') {
this.selectedRule = '';
this.$message.warning("选择规则前请先选择模板!");
return; // 如果按钮被禁用,提前返回,避免执行下一步操作
}
this.disableNextButton = this.selectedRule === ''; },
roleListid(this.selectedRule).then(response => { /** 下拉选和页面luckysheet绑定 */
roleId = this.selectedRule; handleOptionChange(value) {
rule = response.rows; this.date = ''
}); this.mining = ''
if (tempId === 7 || tempId === 10) { this.value = value
getSuppliesTemplate(tempId).then(response => { this.selectedRule = '';
this.disableNextButton = this.selectedRule === '';
//根据选中的下拉选项值获取相应的信息
getSuppliesTemplate(this.selectedOption).then(response => {
//如果为六矿汇总表,导出时隐藏前两列
if (this.selectedOption === 7 || this.selectedOption === 10) {
trueORfalse = true;
} else {
trueORfalse = false;
}
modify = false;
tempId = this.selectedOption;
uuid1 = this.uuid = uuidv4().substring(0, 8); uuid1 = this.uuid = uuidv4().substring(0, 8);
// 通过遍历this.luckyrule找到对应的iem.roleName
modify = false;
const sysSupplies = response.rows; const sysSupplies = response.rows;
this.luckysheetData = sysSupplies[0].templateContent; this.luckysheetData = sysSupplies[0].templateContent;
let json_data = JSON.parse(sysSupplies[0].templateContent); //将接收到的json存到json_data中
//const json_data = response.data;
var json_data = JSON.parse(sysSupplies[0].templateContent);
roleList(this.selectedOption).then(response => {
});
let suffixArr = sysSupplies[0].templateName.split('.');
fileName = suffixArr[0];
//luckysheet.destroy() //luckysheet.destroy()
luckysheet.create({ luckysheet.create({
container: "luckysheet", // Luckysheet 的容器元素 ID container: "luckysheet", // Luckysheet 的容器元素 ID
...@@ -298,89 +271,33 @@ export default { ...@@ -298,89 +271,33 @@ export default {
// 处理错误逻辑,这里是一个空的错误处理函数 // 处理错误逻辑,这里是一个空的错误处理函数
this.$message.error('查询失败,发生未知错误!'); this.$message.error('查询失败,发生未知错误!');
}); });
} },
open4() {
this.$message.error('找不到部门名称或者结算金额和材料编码列,请改为正确名称');
}, },
/** 规则下拉选 调佣后端的方法*/
/** 重置按钮操作 */ handleRuleChange() {
resetQuery() { if (this.selectedOption === '') {
//刷新下拉选框内容 this.selectedRule = '';
fileName = "新建XLSX工作表"; this.$message.warning("选择规则前请先选择模板!");
this.selectedOption = ''; return; // 如果按钮被禁用,提前返回,避免执行下一步操作
this.disableNextButton = ''; }
this.selectedRule = '';
trueORfalse = false;
modify = false;
uuid1 = '';
//刷新luckysheet表格
this.init();
},
/** Luckyexcel文档 */
init() {
let options = {
container: 'luckysheet', //luckysheet为容器id
title: '',
lang: 'zh',
showinfobar: false,
data: [
{
"name": "sheet1", //工作表名称
"color": "", //工作表颜色
"index": 0, //工作表索引
"status": 1, //激活状态
"order": 0, //工作表的下标
"hide": 0,//是否隐藏
"row": 50, //行数
"column": 20, //列数
"defaultRowHeight": 19, //自定义行高
"defaultColWidth": 73, //自定义列宽
"celldata": [
], //初始化使用的单元格数据
"config": {
"merge": {
}, //合并单元格
"rowlen": {}, //表格行高
"columnlen": {}, //表格列宽
"rowhidden": {}, //隐藏行
"colhidden": {}, //隐藏列
"borderInfo": {
}, //边框
"authority": {}, //工作表保护
},
},
]
}
luckysheet.create(options);
},
async handleFileChange(evt) {
this.zhuan(evt)
if (modify) {
this.$confirm('再次导入将会清空表内数据,是否继续操作?', '注意!!!', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.disableNextButton = this.selectedRule === '';
roleListid(this.selectedRule).then(response => {
roleId = this.selectedRule;
rule = response.rows;
});
if (tempId === 7 || tempId === 10) {
getSuppliesTemplate(tempId).then(response => {
uuid1 = this.uuid = uuidv4().substring(0, 8);
// 通过遍历this.luckyrule找到对应的iem.roleName
// 确认继续后刷新页面返回模板 modify = false;
getSuppliesTemplate(7).then(response => {
const sysSupplies = response.rows; const sysSupplies = response.rows;
this.luckysheetData = sysSupplies[0].templateContent; this.luckysheetData = sysSupplies[0].templateContent;
let json_data = JSON.parse(sysSupplies[0].templateContent); let json_data = JSON.parse(sysSupplies[0].templateContent);
luckysheet.destroy() //luckysheet.destroy()
luckysheet.create({ luckysheet.create({
container: "luckysheet", // Luckysheet 的容器元素 ID container: "luckysheet", // Luckysheet 的容器元素 ID
title: fileName, // Excel 文件名 title: fileName, // Excel 文件名
...@@ -388,464 +305,512 @@ export default { ...@@ -388,464 +305,512 @@ export default {
showinfobar: false, //是否显示顶部名称栏 showinfobar: false, //是否显示顶部名称栏
lang: 'zh', lang: 'zh',
}); });
modify = false; }).catch(() => {
// 处理错误逻辑,这里是一个空的错误处理函数
this.$message.error('查询失败,发生未知错误!');
});
}
},
/** 重置按钮操作 */
resetQuery() {
//刷新下拉选框内容
fileName = "新建XLSX工作表";
this.selectedOption = '';
this.disableNextButton = '';
this.selectedRule = '';
trueORfalse = false;
modify = false;
uuid1 = '';
//刷新luckysheet表格
this.init();
},
/** Luckyexcel文档 */
init() {
let options = {
container: 'luckysheet', //luckysheet为容器id
title: '',
lang: 'zh',
showinfobar: false,
data: [
{
"name": "sheet1", //工作表名称
"color": "", //工作表颜色
"index": 0, //工作表索引
"status": 1, //激活状态
"order": 0, //工作表的下标
"hide": 0,//是否隐藏
"row": 50, //行数
"column": 20, //列数
"defaultRowHeight": 19, //自定义行高
"defaultColWidth": 73, //自定义列宽
"celldata": [
], //初始化使用的单元格数据
"config": {
"merge": {
}, //合并单元格
"rowlen": {}, //表格行高
"columnlen": {}, //表格列宽
"rowhidden": {}, //隐藏行
"colhidden": {}, //隐藏列
"borderInfo": {
}, //边框
"authority": {}, //工作表保护
},
},
]
}
luckysheet.create(options);
},
async handleFileChange(evt) {
if (modify) {
this.$confirm('再次导入将会清空表内数据,是否继续操作?', '注意!!!', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => { }).then(async () => {
// 确认继续后刷新页面返回模板
getSuppliesTemplate(this.selectedOption).then(response => {
const sysSupplies = response.rows;
this.luckysheetData = sysSupplies[0].templateContent;
let json_data = JSON.parse(sysSupplies[0].templateContent);
luckysheet.destroy()
luckysheet.create({
container: "luckysheet", // Luckysheet 的容器元素 ID
title: fileName, // Excel 文件名
data: json_data, // Excel 数据
showinfobar: false, //是否显示顶部名称栏
lang: 'zh',
});
modify = false;
this.zhuan(evt)
}).then(async () => {
this.showMask = true;
//将导入数据替换保存
LuckyExcel.transformExcelToLucky(evt, exportJson => {
this.zhuan(exportJson)
// this.summary(exportJson)
.then(async () => {
// this.submit(exportJson);
})
.catch(error => {
this.$message({
message: error.message,
type: "error"
});
}) }).catch(() => {
.finally(() => {
// 导入完成后关闭遮罩层
this.showMask = false;
});
}); });
}).catch(() => { }).catch(() => {
// 处理错误逻辑,这里是一个空的错误处理函数 // 用户点击了取消按钮
this.$message.error('查询失败,模板未找到,请联系管理员进行处理!'); this.$message({ type: 'info', message: '操作已取消' });
}); });
}).catch(() => { } else {
// 用户点击了取消按钮 this.zhuan(evt)
this.$message({ type: 'info', message: '操作已取消' }); this.showMask = true;
}); LuckyExcel(evt, exportJson => {
} else { //获取导入表格所有数据exportJson
this.showMask = true; this.zhuan(exportJson)
LuckyExcel(evt, exportJson => {
//获取导入表格所有数据exportJson
this.zhuan(exportJson)
// this.summary(exportJson) // this.summary(exportJson)
.then(async () => { .then(async () => {
// this.submit(exportJson); // this.submit(exportJson);
}) })
.catch(error => { .catch(error => {
this.$message({ this.$message({
message: error.message, message: error.message,
type: "error" type: "error"
}); });
}) })
.finally(() => { .finally(() => {
// 导入完成后关闭遮罩层 // 导入完成后关闭遮罩层
this.showMask = false; this.showMask = false;
}); });
}); });
} }
}, },
//转换方法 cc是导入表数据 //转换方法 cc是导入表数据
zhuan(file) { zhuan(file) {
let cc = ''; let cc = '';
const transformPromise = new Promise((resolve, reject) => { const transformPromise = new Promise((resolve, reject) => {
LuckyExcel.transformExcelToLucky(file, (lucksheetfile) => { LuckyExcel.transformExcelToLucky(file, (lucksheetfile) => {
resolve(lucksheetfile); resolve(lucksheetfile);
});
}); });
});
transformPromise.then((result) => { transformPromise.then((result) => {
let resultJSON = JSON.stringify(result.sheets) let resultJSON = JSON.stringify(result.sheets)
cc = result;
let codess = this.codess
let he = this.jsondata
cc = result; let classify = {
let codess = this.codess "基本生产-原煤": "一掘区,二掘区,综一区,综二区,巷修区,皮带区,开运区,准备区,钻探区,开拓区",
let he = this.jsondata "基本生产-洗煤": "洗煤厂",
let classify = { "制造费用-原煤": "机电科,机电设备中心,井运区,救护队,通风区,煤类管理科,物资管理科,通讯管理科,地质测量科,迁建管理科",
"基本生产-原煤": "一掘区,二掘区,综一区,综二区,巷修区,皮带区,开运区,准备区,钻探区,开拓区", "管理费用-": "经营管理部",
"基本生产-洗煤": "洗煤厂", "销售费用-": "煤类产品管理检测科",
"制造费用-原煤": "机电科,机电设备中心,井运区,救护队,通风区,煤类管理科,物资管理科,通讯管理科,地质测量科,迁建管理科", "其他业务成本-厂区服务": "后勤服务一科,后勤二科理部",
"管理费用-": "经营管理部", "其他应付款-": "金属厂"
"销售费用-": "煤类产品管理检测科", }
"其他业务成本-厂区服务": "后勤服务一科,后勤二科理部", let c = cc.sheets[0].celldata
"其他应付款-": "金属厂" //部门名称所在列
} let DepartmentColumns = c.flat().filter(obj => obj.v && obj.v.v === "部门名称")[0]?.c;
let c = cc.sheets[0].celldata //结算金额所在列
//部门名称所在列 let ExpenseColumn = c.flat().filter(obj => obj.v && obj.v.v === "结算金额")[0]?.c;
let DepartmentColumns = c.flat().filter(obj => obj.v && obj.v.v === "部门名称")[0]?.c; //材料编码
//结算金额所在列 let code = c.flat().filter(obj => obj.v && obj.v.v === "材料编码")[0]?.c
let ExpenseColumn = c.flat().filter(obj => obj.v && obj.v.v === "结算金额")[0]?.c;
//材料编码 if (code && ExpenseColumn && DepartmentColumns) {
let code = c.flat().filter(obj => obj.v && obj.v.v === "材料编码")[0]?.c let Colums = c.flat().filter(obj => obj.c && obj.c === DepartmentColumns)
let Column = c.flat().filter(obj => obj.c && obj.c === ExpenseColumn)
if (code && ExpenseColumn && DepartmentColumns) { let codecolumn = c.flat().filter(obj => obj.c && obj.c === code)
let Colums = c.flat().filter(obj => obj.c && obj.c === DepartmentColumns)
let Column = c.flat().filter(obj => obj.c && obj.c === ExpenseColumn) let aa = []
let codecolumn = c.flat().filter(obj => obj.c && obj.c === code) //把这三个数组push到aa里
aa.unshift(Column);
let aa = [] aa.unshift(codecolumn);
//把这三个数组push到aa里 aa.unshift(Colums);
aa.unshift(Column); //跟材料表的数据对比 如果编码一样 则把导入表的列数换成模板的列数
aa.unshift(codecolumn); for (let i = 0; i < codess.length; i++) {
aa.unshift(Colums); let codeLength = String(codess[i].code).length;
//跟材料表的数据对比 如果编码一样 则把导入表的列数换成模板的列数 let codeToCompare = String(codess[i].code).substring(0, codeLength);
for (let i = 0; i < codess.length; i++) { for (let ii = 0; ii < aa[1].length; ii++) {
let codeLength = String(codess[i].code).length; let columnIdString = String(aa[1][ii].v.v);
let codeToCompare = String(codess[i].code).substring(0, codeLength); let idToMatch = columnIdString.substring(0, codeLength);
for (let ii = 0; ii < aa[1].length; ii++) { if (idToMatch === codeToCompare) {
let columnIdString = String(aa[1][ii].v.v); aa[1][ii].ccc = codess[i].oneLevel * 1
let idToMatch = columnIdString.substring(0, codeLength); }
if (idToMatch === codeToCompare) {
aa[1][ii].ccc = codess[i].oneLevel * 1
} }
} }
}
//按照部门划分,去找到他所在科室分类 //按照部门划分,去找到他所在科室分类
aa = aa.map(subArr => { aa = aa.map(subArr => {
return subArr.map(obj => { return subArr.map(obj => {
let v = obj.v.v; let v = obj.v.v;
for (let key in classify) { for (let key in classify) {
if (classify[key].includes(v)) { if (classify[key].includes(v)) {
obj.v.m = key; obj.v.m = key;
obj.v.v = key; obj.v.v = key;
obj.v.name = key obj.v.name = key
obj.whether = true obj.whether = true
return obj; return obj;
} }
else { else {
obj.whether = false obj.whether = false
}
} }
} return obj;
return obj; });
}); });
}); for (let i = 0; i < aa[2].length; i++) {
for (let i = 0; i < aa[2].length; i++) { if ('name' in aa[0][i].v) {
if ('name' in aa[0][i].v) { aa[2][i].v.name = aa[0][i].v.name
aa[2][i].v.name = aa[0][i].v.name }
} }
} //直接luck表格初始化 替换数据
//直接luck表格初始化 替换数据
//找到所在的行数,按照 -的前后去找,前面是标题,后面是标题后的小分类,如选煤,洗煤等 //找到所在的行数,按照 -的前后去找,前面是标题,后面是标题后的小分类,如选煤,洗煤等
he[0].data = luckysheet.transToData(he[0]["celldata"]) he[0].data = luckysheet.transToData(he[0]["celldata"])
for (let i = 0; i < aa[0].length; i++) { for (let i = 0; i < aa[0].length; i++) {
if (aa[0][i].v.m !== undefined) { if (aa[0][i].v.m !== undefined) {
let index = aa[0][i].v.m.indexOf("-"); let index = aa[0][i].v.m.indexOf("-");
if (index !== -1) { if (index !== -1) {
let substrBeforeDash = aa[0][i].v.m.slice(0, index); let substrBeforeDash = aa[0][i].v.m.slice(0, index);
let DepartColumns = he[0]["celldata"].flat().filter(obj => { let DepartColumns = he[0]["celldata"].flat().filter(obj => {
if (obj.v && obj.v.v && typeof obj.v.v === 'string') { if (obj.v && obj.v.v && typeof obj.v.v === 'string') {
return obj.v.v.includes(aa[0][i].v.m.slice(0, index)); return obj.v.v.includes(aa[0][i].v.m.slice(0, index));
} }
return false; return false;
})[0]; })[0];
if (DepartColumns && DepartColumns.r) { if (DepartColumns && DepartColumns.r) {
let index = aa[0][i].v.m.indexOf("-") let index = aa[0][i].v.m.indexOf("-")
if (index !== -1) { if (index !== -1) {
let substrAfterDash = aa[0][i].v.m.slice(index + 1); // 获取 "-" 后半段的值 let substrAfterDash = aa[0][i].v.m.slice(index + 1); // 获取 "-" 后半段的值
switch (substrAfterDash) { switch (substrAfterDash) {
case '': case '':
aa[0][i].r = DepartColumns.r; aa[0][i].r = DepartColumns.r;
break; break;
case '原煤': case '原煤':
aa[0][i].r = DepartColumns.r + 1; aa[0][i].r = DepartColumns.r + 1;
break; break;
case '洗煤': case '洗煤':
aa[0][i].r = DepartColumns.r + 2; aa[0][i].r = DepartColumns.r + 2;
break; break;
case '选煤': case '选煤':
aa[0][i].r = DepartColumns.r + 3; aa[0][i].r = DepartColumns.r + 3;
break; break;
case '厂区服务': case '厂区服务':
aa[0][i].r = DepartColumns.r + 1; aa[0][i].r = DepartColumns.r + 1;
break; break;
default: default:
// 默认情况 // 默认情况
}
} }
} }
} }
} }
} }
} //把原来分类找不到的放到其他数据类型中,最后一列其他列中
//把原来分类找不到的放到其他数据类型中,最后一列其他列中 for (let i = 0; i < aa[1].length; i++) {
for (let i = 0; i < aa[1].length; i++) { if (aa[1][i].ccc && aa[0][i].r < 8) {
if (aa[1][i].ccc && aa[0][i].r < 8) { aa[1][i].c = aa[1][i].ccc
aa[1][i].c = aa[1][i].ccc delete aa[1][i].ccc;
delete aa[1][i].ccc; } else {
} else { aa[1][i].c = 10
aa[1][i].c = 10 }
} }
}
//金额列和行是原先导入表的行列 要替换掉模板表的行列 //金额列和行是原先导入表的行列 要替换掉模板表的行列
for (let i = 0; i < aa[0].length; i++) { for (let i = 0; i < aa[0].length; i++) {
if (aa[0][i].whether) { if (aa[0][i].whether) {
aa[2][i].r = aa[0][i].r aa[2][i].r = aa[0][i].r
aa[2][i].c = aa[1][i].c aa[2][i].c = aa[1][i].c
aa[2][i].v.v = Number(aa[2][i].v.v) aa[2][i].v.v = Number(aa[2][i].v.v)
} else { } else {
aa[2][i].r = '' aa[2][i].r = ''
aa[2][i].c = '' aa[2][i].c = ''
}
} }
} //同一个单元格的数据 金额相加。
//同一个单元格的数据 金额相加。
let seen = new Map();
let seen = new Map(); let duplicateData = [];
let duplicateData = []; for (let obj of aa[2]) {
for (let obj of aa[2]) { let key = obj.r + ',' + obj.c;
let key = obj.r + ',' + obj.c;
if (seen.has(key)) {
if (seen.has(key)) { let existingObj = seen.get(key);
let existingObj = seen.get(key); existingObj.v.v += obj.v.v;
existingObj.v.v += obj.v.v; existingObj.v.m = (parseInt(existingObj.v.m) + parseInt(obj.v.m)).toString();
existingObj.v.m = (parseInt(existingObj.v.m) + parseInt(obj.v.m)).toString(); } else {
} else { seen.set(key, obj);
seen.set(key, obj); }
} }
} for (let obj of seen.values()) {
for (let obj of seen.values()) { if (obj.v.v > 0 || parseInt(obj.v.m) > 0) {
if (obj.v.v > 0 || parseInt(obj.v.m) > 0) { duplicateData.push(obj);
duplicateData.push(obj); }
} }
} //金额所在列和行,去模板表中查找,如果行列一致则替换
for (let i = 0; i < duplicateData.length; i++) {
//金额所在列和行,去模板表中查找,如果行列一致则替换 // // 对比 c 和 r 是否与 he[0]["celldata"] 中相应对象相同
for (let i = 0; i < duplicateData.length; i++) { for (let ii = 0; ii < he[0]["celldata"].length; ii++) {
// // 对比 c 和 r 是否与 he[0]["celldata"] 中相应对象相同 if (duplicateData[i].r === he[0]["celldata"][ii].r && duplicateData[i].c === he[0]["celldata"][ii].c) {
for (let ii = 0; ii < he[0]["celldata"].length; ii++) { // 如果相同,则进行替换
if (duplicateData[i].r === he[0]["celldata"][ii].r && duplicateData[i].c === he[0]["celldata"][ii].c) { he[0]["celldata"][ii] = duplicateData[i];
// 如果相同,则进行替换 }
he[0]["celldata"][ii] = duplicateData[i];
} }
} }
} // celldata => data 生成表格所需二维数组
// celldata => data 生成表格所需二维数组 he[0].data = luckysheet.transToData(he[0]["celldata"])
he[0].data = luckysheet.transToData(he[0]["celldata"]) if (this.value === 1257) {
if (this.value === 1257) { luckysheet.create({
luckysheet.create({ container: "luckysheet", // Luckysheet 的容器元素 ID
container: "luckysheet", // Luckysheet 的容器元素 ID title: fileName, // Excel 文件名
title: fileName, // Excel 文件名 data: he, // Excel 数据
data: he, // Excel 数据 showinfobar: false, //是否显示顶部名称栏
showinfobar: false, //是否显示顶部名称栏 lang: 'zh',
lang: 'zh', });
}); modify = true
this.showMask = false;
}
//this.from 往后台村的数据
this.ImportTables.historyName = result.info.name + '(导入表名)'
this.ImportTables.identifyingCode = 0;
this.ImportTables.date = this.date
this.ImportTables.exportUuid = 1;
this.ImportTables.historyContent = resultJSON
this.ImportTables.mining = this.select
this.ImportTables.tylkStatus = 3
this.ImportTables.templateId = 1257
this.generate.templateId = 1257
this.generate.tylkStatus = 3
this.generate.historyContent = JSON.stringify(he)
this.generate.exportUuid = 1;
this.generate.identifyingCode = 1;
this.generate.date = this.date
this.generate.mining = this.select
let list = [this.ImportTables, this.generate]
addInsert(list).then(response => {
if (response.code == 200) {
this.$message({
message: '保存成功', type: 'success'
})
} }
}); //this.from 往后台村的数据
//往后台传科目编码相关的东西 this.ImportTables.historyName = result.info.name + '(导入表名)'
duplicateData.forEach(obj => { this.ImportTables.identifyingCode = 0;
he[0].celldata.forEach(cell => { this.ImportTables.date = this.date
if (obj.c === cell.c && cell.r === 3) { this.ImportTables.exportUuid = 1;
obj.v.material = cell.v.v; this.ImportTables.historyContent = resultJSON
this.ImportTables.mining = this.select
this.ImportTables.tylkStatus = 3
this.ImportTables.templateId = 1257
this.generate.templateId = 1257
this.generate.tylkStatus = 3
this.generate.historyContent = JSON.stringify(he)
this.generate.exportUuid = 1;
this.generate.identifyingCode = 1;
this.generate.date = this.date
this.generate.mining = this.select
let list = [this.ImportTables, this.generate]
addInsert(list).then(response => {
if (response.code == 200) {
this.$message({
message: '保存成功', type: 'success'
})
} }
}); });
}); //往后台传科目编码相关的东西
duplicateData.forEach(obj => {
this.middle = he he[0].celldata.forEach(cell => {
this.Vouchers(duplicateData) if (obj.c === cell.c && cell.r === 3) {
this.showMask = false; obj.v.material = cell.v.v;
}
});
});
this.middle = he
this.Vouchers(duplicateData)
} else {
this.open4()
this.showMask = false;
}
});
},
} else {
this.open4() //成本表往凭证但转
this.showMask = false; Vouchers(duplicateData) {
duplicateData.forEach(item => {
item.v.v = Number(item.v.v.toFixed(2));
item.v.m = parseFloat(item.v.m).toFixed(2);
});
let sum = [{
code: '2241005',
material: '其他材料',
v: 0
}, {
code: '1403002',
material: "火工品",
v: 0,
} }
];
}); for (let i = 0; i < duplicateData.length; i++) {
if (duplicateData[i].v.material === "火工品") {
sum[1].v += duplicateData[i].v.v;
} else {
}, sum[0].v += duplicateData[i].v.v;
}
}
//成本表往凭证但转 var VoucherForm = JSON.parse(this.VoucherForm)
Vouchers(duplicateData) { //表头所有数据
duplicateData.forEach(item => { let filteredData = VoucherForm[0].celldata.filter(obj => obj.r === 5);
item.v.v = Number(item.v.v.toFixed(2)); //我所需要的数据
item.v.m = parseFloat(item.v.m).toFixed(2); let need = [
}); filteredData.filter(obj => obj.v.v === "*手工码")[0].c,
let sum = [{ filteredData.filter(obj => obj.v.v === "*会计主体")[0].c,
code: '2241005', filteredData.filter(obj => obj.v.v === "*核算账簿")[0].c,
material: '其他材料', filteredData.filter(obj => obj.v.v === "*单据日期")[0].c,
v: 0 filteredData.filter(obj => obj.v.v === "*凭证类型")[0].c,
}, { filteredData.filter(obj => obj.v.v === "*制单人")[0].c,
code: '1403002', filteredData.filter(obj => obj.v.v === "*分录摘要")[0].c,
material: "火工品", filteredData.filter(obj => obj.v.v === "*币种")[0].c,
v: 0, filteredData.filter(obj => obj.v.v === "本币汇率类型")[0].c,
} filteredData.filter(obj => obj.v.v === "*本币汇率")[0].c,
]; filteredData.filter(obj => obj.v.v === "*业务日期")[0].c,
]
for (let i = 0; i < duplicateData.length; i++) { let loan = filteredData.filter(obj => obj.v.v === "原币贷方金额")[0].c
if (duplicateData[i].v.material === "火工品") { let loan1 = filteredData.filter(obj => obj.v.v === "本币贷方金额")[0].c
sum[1].v += duplicateData[i].v.v; let money = filteredData.filter(obj => obj.v.v === "原币借方金额")[0].c
let money1 = filteredData.filter(obj => obj.v.v === "本币借方金额")[0].c
let foundObjects = filteredData.filter(obj => obj.v.v === "物料基本分类");
let Classification;
let oldClassification;
if (foundObjects.length >= 2) {
oldClassification = foundObjects[0].c
Classification = foundObjects[1].c;
} else { } else {
sum[0].v += duplicateData[i].v.v; // 处理找不到两个满足条件的对象的情况
} }
} //往后台传部门之类的 回收到编码
var VoucherForm = this.VoucherForm duplicateData.forEach((obj) => {
//表头所有数据 obj.mining = this.select;
let filteredData = VoucherForm[0].celldata.filter(obj => obj.r === 5); });
//我所需要的数据 const newData = duplicateData.map(obj => {
let need = [ const [name, department] = obj.v.name.split("-");
filteredData.filter(obj => obj.v.v === "*手工码")[0].c, return {
filteredData.filter(obj => obj.v.v === "*会计主体")[0].c, r: obj.r,
filteredData.filter(obj => obj.v.v === "*核算账簿")[0].c, c: obj.c,
filteredData.filter(obj => obj.v.v === "*单据日期")[0].c, name,
filteredData.filter(obj => obj.v.v === "*凭证类型")[0].c, department,
filteredData.filter(obj => obj.v.v === "*制单人")[0].c, material: obj.v.material,
filteredData.filter(obj => obj.v.v === "*分录摘要")[0].c, mining: obj.mining
filteredData.filter(obj => obj.v.v === "*币种")[0].c, };
filteredData.filter(obj => obj.v.v === "本币汇率类型")[0].c, });
filteredData.filter(obj => obj.v.v === "*本币汇率")[0].c, //模板
filteredData.filter(obj => obj.v.v === "*业务日期")[0].c, let Fusion = {
] "r": '',
let loan = filteredData.filter(obj => obj.v.v === "原币贷方金额")[0].c "c": '',
let loan1 = filteredData.filter(obj => obj.v.v === "本币贷方金额")[0].c "v": {
let money = filteredData.filter(obj => obj.v.v === "原币借方金额")[0].c "ct": {
let money1 = filteredData.filter(obj => obj.v.v === "本币借方金额")[0].c "fa": "@",
let foundObjects = filteredData.filter(obj => obj.v.v === "物料基本分类"); "t": "s"
let Classification; },
let oldClassification; "fs": 8,
if (foundObjects.length >= 2) { "ff": "微软雅黑",
oldClassification=foundObjects[0].c "tb": 2,
Classification = foundObjects[1].c; "v": "",
} else { "qp": 1,
// 处理找不到两个满足条件的对象的情况 "m": ""
} }
//往后台传部门之类的 回收到编码 }
duplicateData.forEach((obj) => { const currentDate = new Date();
obj.mining = this.select;
}); // 获取年份、月份和日期
const newData = duplicateData.map(obj => { const year = currentDate.getFullYear(); // 获取当前的年份
const [name, department] = obj.v.name.split("-"); const month = currentDate.getMonth() + 1; // 获取当前的月份,记得要加 1
return { const day = currentDate.getDate(); // 获取当前的日期
r: obj.r,
c: obj.c, //将年份、月份和日期拼接成 YYYY-MM-DD 的格式
name, const formattedDate = `${year}-${month}-${day}`;
department, let isArray = []
material: obj.v.material, function generateUniqueShortUuid() {
mining: obj.mining return uuidv4().substring(0, 8);
};
});
//模板
let Fusion = {
"r": '',
"c": '',
"v": {
"ct": {
"fa": "@",
"t": "s"
},
"fs": 8,
"ff": "微软雅黑",
"tb": 2,
"v": "",
"qp": 1,
"m": ""
} }
}
// let date = moment().format('l');
// const newDate = moment(date, 'MM/DD/YYYY').format('YYYY-MM-DD');
let isArray = []
function generateUniqueShortUuid() {
return uuidv4().substring(0, 8);
}
let data1 = [ let data1 = [
generateUniqueShortUuid(), this.select, this.select, this.date, '', '熊亚维', '转本月材料分配', 'CNY', 'E001', '1.00000000', newDate, '1' generateUniqueShortUuid(), this.select, this.select, this.date, '', '熊亚维', '转本月材料分配', 'CNY', 'E001', '1.00000000', formattedDate, '1'
] ]
let filteredArr; let filteredArr;
accountingcode(newData).then(response => {
filteredArr = response.rows.map(obj =>
Object.entries(obj)
.filter(([key, value]) => value !== null)
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
);
for (let i = 0; i < sum.length; i++) {
for (let j = 0; j < filteredArr.length; j++) {
if (sum[i].code === filteredArr[j].accountingCode) {
sum[i].index = j;
break;
}
}
}
for (let i = 0; i < filteredArr.length; i++) {
let newRow1 = {
"r": 8 + i,
"c": money,
"v": {
"ct": Fusion.v.ct,
"bg": Fusion.v.bg,
"fs": Fusion.v.fs,
"ff": Fusion.v.ff,
"ht": Fusion.v.ht,
"vt": Fusion.v.vt,
"tb": Fusion.v.tb,
"v": duplicateData[i]?.v.v,
"qp": Fusion.v.qp,
"m": duplicateData[i]?.v.m
}
}; accountingcode(newData).then(response => {
let newRow2 = { filteredArr = response.rows.map(obj =>
"r": 8 + i, Object.entries(obj)
"c": money1, .filter(([key, value]) => value !== null)
"v": { .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
"ct": Fusion.v.ct, );
"bg": Fusion.v.bg, for (let i = 0; i < sum.length; i++) {
"fs": Fusion.v.fs, for (let j = 0; j < filteredArr.length; j++) {
"ff": Fusion.v.ff, if (sum[i].code === filteredArr[j].accountingCode) {
"ht": Fusion.v.ht, sum[i].index = j;
"vt": Fusion.v.vt, break;
"tb": Fusion.v.tb, }
"v": duplicateData[i]?.v.v,
"qp": Fusion.v.qp,
"m": duplicateData[i]?.v.m
} }
}
for (let i = 0; i < filteredArr.length; i++) {
let newRow1 = {
"r": 8 + i,
"c": money,
"v": {
"ct": Fusion.v.ct,
"bg": Fusion.v.bg,
"fs": Fusion.v.fs,
"ff": Fusion.v.ff,
"ht": Fusion.v.ht,
"vt": Fusion.v.vt,
"tb": Fusion.v.tb,
"v": duplicateData[i]?.v.v,
"qp": Fusion.v.qp,
"m": duplicateData[i]?.v.m
}
}; };
let newRow2 = {
for (let l = 0; l < need.length; l++) {
let needIndex = l % need.length;
let newRow3 = {
"r": 8 + i, "r": 8 + i,
"c": need[l], "c": money1,
"v": { "v": {
"ct": Fusion.v.ct, "ct": Fusion.v.ct,
"bg": Fusion.v.bg, "bg": Fusion.v.bg,
...@@ -854,26 +819,93 @@ export default { ...@@ -854,26 +819,93 @@ export default {
"ht": Fusion.v.ht, "ht": Fusion.v.ht,
"vt": Fusion.v.vt, "vt": Fusion.v.vt,
"tb": Fusion.v.tb, "tb": Fusion.v.tb,
"v": data1[l], "v": duplicateData[i]?.v.v,
"qp": Fusion.v.qp, "qp": Fusion.v.qp,
"m": Fusion.v.m "m": duplicateData[i]?.v.m
} }
}; };
isArray.push(newRow3); for (let l = 0; l < need.length; l++) {
let needIndex = l % need.length;
let newRow3 = {
"r": 8 + i,
"c": need[l],
"v": {
"ct": Fusion.v.ct,
"bg": Fusion.v.bg,
"fs": Fusion.v.fs,
"ff": Fusion.v.ff,
"ht": Fusion.v.ht,
"vt": Fusion.v.vt,
"tb": Fusion.v.tb,
"v": data1[l],
"qp": Fusion.v.qp,
"m": Fusion.v.m
}
};
isArray.push(newRow3);
}
isArray.push(newRow1, newRow2)
} }
isArray.push(newRow1, newRow2)
} const newRows = [];
for (let i = 0; i < filteredArr.length; i++) {
const codeValue = filteredArr[i]?.accountingCode;
if (codeValue) {
const newRow = {
"r": 8 + i,
"c": 12,
"v": {
"ct": Fusion.v.ct,
"bg": Fusion.v.bg,
"fs": Fusion.v.fs,
"ff": Fusion.v.ff,
"ht": Fusion.v.ht,
"vt": Fusion.v.vt,
"tb": Fusion.v.tb,
"v": codeValue,
"qp": Fusion.v.qp,
"m": Fusion.v.m
}
};
isArray.push(newRow);
}
}
const result = [];
filteredArr.forEach((obj, index) => {
Object.keys(obj).forEach(key => {
if (obj[key] && obj[key].includes(",")) {
const [prop, val] = obj[key].split(",");
const propName = prop.trim().replace('*', ''); // 去除属性名中的星号(*)
result.push({ [propName]: val.trim(), row: index });
}
});
});
const cleanedData = result.filter(entry => {
return Object.values(entry).every(value => value !== "null" && value !== null);
});
let name = []
for (let i = 0; i < cleanedData.length; i++) {
for (let key in cleanedData[i]) {
let columns = filteredData.filter(obj => obj.v.v === key)[0]?.c
if (columns && columns !== oldClassification) {
name.push(columns)
}
if (columns === oldClassification) {
name.push(Classification)
const newRows = []; }
for (let i = 0; i < filteredArr.length; i++) { }
const codeValue = filteredArr[i]?.accountingCode; }
if (codeValue) { for (let i = 0; i < name.length; i++) {
const newRow = { const newRow = {
"r": 8 + i, "r": 8 + cleanedData[i].row,
"c": 12, "c": name[i],
"v": { "v": {
"ct": Fusion.v.ct, "ct": Fusion.v.ct,
"bg": Fusion.v.bg, "bg": Fusion.v.bg,
...@@ -882,273 +914,232 @@ export default { ...@@ -882,273 +914,232 @@ export default {
"ht": Fusion.v.ht, "ht": Fusion.v.ht,
"vt": Fusion.v.vt, "vt": Fusion.v.vt,
"tb": Fusion.v.tb, "tb": Fusion.v.tb,
"v": codeValue, "v": Object.values(cleanedData[i])[0],
"qp": Fusion.v.qp, "qp": Fusion.v.qp,
"m": Fusion.v.m "m": Object.values(cleanedData[i])[0]
} }
}; };
isArray.push(newRow); isArray.push(newRow);
} }
} for (let i = 0; i < sum.length; i++) {
const result = []; const newRow = {
"r": 8 + sum[i].index,
filteredArr.forEach((obj, index) => { "c": loan,
Object.keys(obj).forEach(key => { "v": {
if (obj[key] && obj[key].includes(",")) { "ct": Fusion.v.ct,
const [prop, val] = obj[key].split(","); "bg": Fusion.v.bg,
const propName = prop.trim().replace('*', ''); // 去除属性名中的星号(*) "fs": Fusion.v.fs,
result.push({ [propName]: val.trim(), row: index }); "ff": Fusion.v.ff,
} "ht": Fusion.v.ht,
}); "vt": Fusion.v.vt,
}); "tb": Fusion.v.tb,
const cleanedData = result.filter(entry => { "v": sum[i].v,
return Object.values(entry).every(value => value !== "null" && value !== null); "qp": Fusion.v.qp,
}); "m": sum[i].v,
let name = [] }
for (let i = 0; i < cleanedData.length; i++) { };
for (let key in cleanedData[i]) { const newRow1 = {
let columns = filteredData.filter(obj => obj.v.v === key)[0]?.c "r": 8 + sum[i].index,
if (columns && columns !== oldClassification) { "c": loan1,
name.push(columns) "v": {
} "ct": Fusion.v.ct,
if (columns === oldClassification) { "bg": Fusion.v.bg,
name.push(Classification) "fs": Fusion.v.fs,
"ff": Fusion.v.ff,
"ht": Fusion.v.ht,
"vt": Fusion.v.vt,
"tb": Fusion.v.tb,
"v": sum[i].v,
"qp": Fusion.v.qp,
"m": sum[i].v,
}
};
isArray.push(newRow, newRow1);
}
VoucherForm[0].celldata.push(...isArray)
if (this.value === 1248) {
} luckysheet.create({
container: "luckysheet", // Luckysheet 的容器元素 ID
title: fileName, // Excel 文件名
data: VoucherForm, // Excel 数据
showinfobar: false, //是否显示顶部名称栏
lang: 'zh',
});
modify = true
this.showMask = false;
} }
} VoucherForm[0].celldata = []
for (let i = 0; i < name.length; i++) {
const newRow = {
"r": 8 + cleanedData[i].row,
"c": name[i],
"v": {
"ct": Fusion.v.ct,
"bg": Fusion.v.bg,
"fs": Fusion.v.fs,
"ff": Fusion.v.ff,
"ht": Fusion.v.ht,
"vt": Fusion.v.vt,
"tb": Fusion.v.tb,
"v": Object.values(cleanedData[i])[0],
"qp": Fusion.v.qp,
"m": Object.values(cleanedData[i])[0]
}
};
isArray.push(newRow);
}
for (let i = 0; i < sum.length; i++) {
const newRow = {
"r": 8 + sum[i].index,
"c": loan,
"v": {
"ct": Fusion.v.ct,
"bg": Fusion.v.bg,
"fs": Fusion.v.fs,
"ff": Fusion.v.ff,
"ht": Fusion.v.ht,
"vt": Fusion.v.vt,
"tb": Fusion.v.tb,
"v": sum[i].v,
"qp": Fusion.v.qp,
"m": sum[i].v,
}
};
const newRow1 = {
"r": 8 + sum[i].index,
"c": loan1,
"v": {
"ct": Fusion.v.ct,
"bg": Fusion.v.bg,
"fs": Fusion.v.fs,
"ff": Fusion.v.ff,
"ht": Fusion.v.ht,
"vt": Fusion.v.vt,
"tb": Fusion.v.tb,
"v": sum[i].v,
"qp": Fusion.v.qp,
"m": sum[i].v,
}
};
isArray.push(newRow, newRow1);
}
VoucherForm[0].celldata.push(...isArray)
if (this.value === 1248) {
luckysheet.create({ })
container: "luckysheet", // Luckysheet 的容器元素 ID
title: fileName, // Excel 文件名
data: VoucherForm, // Excel 数据
showinfobar: false, //是否显示顶部名称栏
lang: 'zh',
});
}
}) },
},
/** 保存导入文件和生成文件 */
submit(contents) {
const name = contents.info.name;
const obj = contents.sheets;
let list = [];
//导入文件内容转json
let str = JSON.stringify(obj)// 对象转化为字符串
let objsheet = luckysheet.getAllSheets() // 得到表的数据
//生成文件转json
let strsheet = JSON.stringify(objsheet)// 对象转化为字符串
this.from.templateId = this.dfrom.templateId = tempId;
this.from.importUuid = this.dfrom.importUuid = uuid1;
this.from.roleId = this.dfrom.roleId = roleId;
this.dfrom.historyName = name + '(导入文件)';
this.dfrom.historyContent = str;
this.dfrom.identifyingCode = 0;
this.dfrom.tylkStatus = 1;
this.dfrom.historyRole = this.historyRole;
let date = new Date(this.date);
let fullYear = date.getFullYear();
let month = ("0" + (date.getMonth() + 1)).slice(-2);
let datastr = fullYear + month;
this.dfrom.date = datastr
this.dfrom.mining = this.mining
this.dfrom.accountingcode
this.dfrom.indexRow
this.from.status = this.dfrom.status = 0;
list.push(this.dfrom);
this.from.historyName = fileName + '(生成文件)';
this.from.historyContent = strsheet;
this.from.identifyingCode = 1;
this.from.date = datastr;
this.from.tylkStatus = 1;
this.from.mining = this.mining
list.push(this.from);
addInsert(list).then(response => {
if (response.code == 200) {
this.$message({
message: '保存成功', type: 'success'
})
}
});
/** 保存导入文件和生成文件 */ },
submit(contents) { /** 导出设置 */
const name = contents.info.name; handleExport: debounce(function () {
const obj = contents.sheets; // 处理点击事件
let list = []; exportExcel(luckysheet.getAllSheets(), fileName, trueORfalse, this.value);
//导入文件内容转json
let str = JSON.stringify(obj)// 对象转化为字符串
let objsheet = luckysheet.getAllSheets() // 得到表的数据
//生成文件转json
let strsheet = JSON.stringify(objsheet)// 对象转化为字符串
this.from.templateId = this.dfrom.templateId = tempId;
this.from.importUuid = this.dfrom.importUuid = uuid1;
this.from.roleId = this.dfrom.roleId = roleId;
this.dfrom.historyName = name + '(导入文件)';
this.dfrom.historyContent = str;
this.dfrom.identifyingCode = 0;
this.dfrom.tylkStatus = 1;
this.dfrom.historyRole = this.historyRole;
let date = new Date(this.date);
let fullYear = date.getFullYear();
let month = ("0" + (date.getMonth() + 1)).slice(-2);
let datastr = fullYear + month;
this.dfrom.date = datastr
this.dfrom.mining = this.mining
this.from.status = this.dfrom.status = 0;
list.push(this.dfrom);
this.from.historyName = fileName + '(生成文件)';
this.from.historyContent = strsheet;
this.from.identifyingCode = 1;
this.from.date = datastr;
this.from.tylkStatus = 1;
this.from.mining = this.mining
list.push(this.from);
addInsert(list).then(response => {
if (response.code == 200) {
this.$message({
message: '保存成功', type: 'success'
})
}
});
}, // 清洗数据
/** 导出设置 */ selectActSuppliesHistorydata(3).then(response => {
handleExport: debounce(function () { var data = response.data;
// 处理点击事件 let list = [];
exportExcel(luckysheet.getAllSheets(), fileName, trueORfalse); let list1 = [];
// 清洗数据
selectActSuppliesHistorydata(3).then(response => {
var data = response.data;
let list = [];
let list1 = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (data[i].identifyingCode == 1) { if (data[i].identifyingCode == 1) {
let parse = JSON.parse(data[i].historyContent); let parse = JSON.parse(data[i].historyContent);
let transToCellData = window.luckysheet.transToData(parse[0].celldata); let transToCellData = window.luckysheet.transToData(parse[0].celldata);
this.imp.hId = data[i].id; this.imp.hId = data[i].id;
this.imp.createBy = data[i].createBy; this.imp.createBy = data[i].createBy;
this.imp.hDate = data[i].date; this.imp.hDate = data[i].date;
this.imp.mining = data[i].mining; this.imp.mining = data[i].mining;
this.imp.actOperation2 = transToCellData; this.imp.actOperation2 = transToCellData;
list.push(this.imp); list.push(this.imp);
} else { } else {
let parse = JSON.parse(data[i].historyContent); let parse = JSON.parse(data[i].historyContent);
let transToCellData = window.luckysheet.transToData(parse[0].celldata); let transToCellData = window.luckysheet.transToData(parse[0].celldata);
this.ssd.hId = data[i].id; this.ssd.hId = data[i].id;
this.ssd.createBy = data[i].createBy; this.ssd.createBy = data[i].createBy;
this.ssd.hDate = data[i].date; this.ssd.hDate = data[i].date;
this.ssd.mining = data[i].mining; this.ssd.mining = data[i].mining;
this.ssd.actOperation2 = transToCellData; this.ssd.actOperation2 = transToCellData;
list1.push(this.ssd); list1.push(this.ssd);
} }
} }
addInsertAccount1(list).then(response => { addInsertAccount1(list).then(response => {
}); });
addInsertAccount2(list1).then(response => { addInsertAccount2(list1).then(response => {
});
}); });
});
}, 500), // 设置延迟时间,单位为毫秒 }, 500), // 设置延迟时间,单位为毫秒
} }
// 配置项111 // 配置项111
}; };
// debounce函数定义 // debounce函数定义
function debounce(func, delay) { function debounce(func, delay) {
let timer; let timer;
return function () { return function () {
const context = this; const context = this;
const args = arguments; const args = arguments;
clearTimeout(timer); clearTimeout(timer);
timer = setTimeout(function () { timer = setTimeout(function () {
func.apply(context, args); func.apply(context, args);
}, delay); }, delay);
}; };
} }
function getKeyByValue(map, value) { function getKeyByValue(map, value) {
for (let [key, val] of map) { for (let [key, val] of map) {
if (val === value) { if (val === value) {
return key; return key;
} }
if (Array.isArray(val) && val.includes(value)) { if (Array.isArray(val) && val.includes(value)) {
return key; return key;
}
} }
} }
} function generateUUID() {
function generateUUID() { let array = new Uint32Array(4);
let array = new Uint32Array(4); window.crypto.getRandomValues(array);
window.crypto.getRandomValues(array); return array.join("-");
return array.join("-"); }
}
</script> </script>
<style> <style>
.mask { .mask {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
}
.loading-spinner {
/* 添加你的加载动画样式 */
width: 40px;
height: 40px;
border-radius: 50%;
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
} }
100% { .loading-spinner {
transform: rotate(360deg); /* 添加你的加载动画样式 */
width: 40px;
height: 40px;
border-radius: 50%;
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
} }
}
</style> </style>
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