Commit 2ad5c86b authored by lvzhuangzhuang's avatar lvzhuangzhuang

1

parent 010b5e84
package com.ruoyi.system.controller; package com.ruoyi.system.controller;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
...@@ -31,6 +30,8 @@ public class ActSuppliesCleaningRuleController extends BaseController ...@@ -31,6 +30,8 @@ public class ActSuppliesCleaningRuleController extends BaseController
@Autowired @Autowired
private IActSuppliesHistorydataService actSuppliesHistorydataService; private IActSuppliesHistorydataService actSuppliesHistorydataService;
/** /**
* 获取所有历史数据 * 获取所有历史数据
*/ */
...@@ -51,8 +52,7 @@ public class ActSuppliesCleaningRuleController extends BaseController ...@@ -51,8 +52,7 @@ public class ActSuppliesCleaningRuleController extends BaseController
public AjaxResult addActSuppliesSixMinesSummaryTable(@RequestBody ActSuppliesSixMinesSummaryTable actSuppliesSixMinesSummaryTable) public AjaxResult addActSuppliesSixMinesSummaryTable(@RequestBody ActSuppliesSixMinesSummaryTable actSuppliesSixMinesSummaryTable)
{ {
int i = actSuppliesCleaningRuleService.addActSuppliesSixMinesSummaryTable(actSuppliesSixMinesSummaryTable); int i = actSuppliesCleaningRuleService.addActSuppliesSixMinesSummaryTable(actSuppliesSixMinesSummaryTable);
int j = actSuppliesHistorydataService.updateActSuppliesHistorydataStatusById(actSuppliesSixMinesSummaryTable.gethId());
return toAjax(i); return toAjax(i);
} }
......
...@@ -72,4 +72,6 @@ public interface ActSuppliesHistorydataMapper ...@@ -72,4 +72,6 @@ public interface ActSuppliesHistorydataMapper
* @return 结果 * @return 结果
*/ */
List<ActSuppliesHistorydata> selectActSuppliesHistorydata(); List<ActSuppliesHistorydata> selectActSuppliesHistorydata();
int updateActSuppliesHistorydataStatusById(Long gethId);
} }
...@@ -66,4 +66,10 @@ public interface IActSuppliesHistorydataService ...@@ -66,4 +66,10 @@ public interface IActSuppliesHistorydataService
* @return 结果 * @return 结果
*/ */
List<ActSuppliesHistorydata> selectActSuppliesHistorydata(); List<ActSuppliesHistorydata> selectActSuppliesHistorydata();
/**
* 修改历史数据通过id
*
* @return 结果
*/
int updateActSuppliesHistorydataStatusById(Long gethId);
} }
...@@ -161,4 +161,9 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat ...@@ -161,4 +161,9 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
public List<ActSuppliesHistorydata> selectActSuppliesHistorydata() { public List<ActSuppliesHistorydata> selectActSuppliesHistorydata() {
return actSuppliesHistorydataMapper.selectActSuppliesHistorydata(); return actSuppliesHistorydataMapper.selectActSuppliesHistorydata();
} }
@Override
public int updateActSuppliesHistorydataStatusById(Long gethId) {
return actSuppliesHistorydataMapper.updateActSuppliesHistorydataStatusById(gethId);
}
} }
...@@ -143,6 +143,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -143,6 +143,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectActSuppliesHistorydataVo"/> <include refid="selectActSuppliesHistorydataVo"/>
where clean_status = 0 where clean_status = 0
</select> </select>
<update id="updateActSuppliesHistorydataStatusById" parameterType="java.lang.Long">
update act_supplies_historydata
set clean_status = 1
<where>
<if test="hId != null">and id = #{hId}</if>
</where>
</update>
</mapper> </mapper>
...@@ -32,7 +32,12 @@ export default { ...@@ -32,7 +32,12 @@ export default {
}, },
methods: { methods: {
/** 查询规则详情列表 */ /** 查询规则详情列表 */
getList() { getList() {
let timer = setTimeout(() => {
//需要定时执行的代码
getList();
}, 2000)
selectActSuppliesHistorydata().then(response => { selectActSuppliesHistorydata().then(response => {
var data = response.data; var data = response.data;
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<script> <script>
import {selectActSuppliesHistorydata ,addActSuppliesSixMinesSummaryTable} from "@/api/Actsupplies/cleaning_rule";
import { getSuppliesTemplate, listSuppliesTemplate,roleList,materialConvert,roleListid} from "@/api/ruoyi-myLuckyexcel/myluckyexcel"; import { getSuppliesTemplate, listSuppliesTemplate,roleList,materialConvert,roleListid} from "@/api/ruoyi-myLuckyexcel/myluckyexcel";
import {addInsert}from "@/api/system/historydata" import {addInsert}from "@/api/system/historydata"
/*import luckysheet from 'luckysheet'*/ /*import luckysheet from 'luckysheet'*/
...@@ -99,6 +99,17 @@ export default { ...@@ -99,6 +99,17 @@ export default {
depss:[], depss:[],
// 表单参数 // 表单参数
from: {}, from: {},
froms: {
hId : "",
projectId : "",
projectName : "",
departmentName : "",
number : "",
nuitPrice : "",
money : "",
createBy : ""
},
dfrom:{}, dfrom:{},
// 查询参数 // 查询参数
queryParams: { queryParams: {
...@@ -137,7 +148,7 @@ export default { ...@@ -137,7 +148,7 @@ export default {
modify=false; modify=false;
tempId= this.selectedOption; tempId= this.selectedOption;
uuid1=this.uuid=uuidv4().substring(0,8); uuid1=this.uuid=uuidv4().substring(0,8);
console.log(this.uuid);
const sysSupplies = response.rows; const sysSupplies = response.rows;
this.luckysheetData = sysSupplies[0].templateContent; this.luckysheetData = sysSupplies[0].templateContent;
//将接收到的json存到json_data中 //将接收到的json存到json_data中
...@@ -176,7 +187,7 @@ export default { ...@@ -176,7 +187,7 @@ export default {
if(tempId===7){ if(tempId===7){
getSuppliesTemplate(7).then(response => { getSuppliesTemplate(7).then(response => {
uuid1=this.uuid=uuidv4().substring(0,8); uuid1=this.uuid=uuidv4().substring(0,8);
//console.log(this.uuid);
// 通过遍历this.luckyrule找到对应的iem.roleName // 通过遍历this.luckyrule找到对应的iem.roleName
for (let i = 0; i < this.luckyrule.length; i++) { for (let i = 0; i < this.luckyrule.length; i++) {
if (this.luckyrule[i].id === this.selectedRule) { if (this.luckyrule[i].id === this.selectedRule) {
...@@ -206,13 +217,13 @@ export default { ...@@ -206,13 +217,13 @@ export default {
}, },
/** 回车事件和保存提交绑定 */ /** 回车事件和保存提交绑定 */
handleEnter(event) { /*handleEnter(event) {
if (event.keyCode === 13) { if (event.keyCode === 13) {
event.preventDefault(); // 阻止默认的回车事件 event.preventDefault(); // 阻止默认的回车事件
// 触发确定操作 // 触发确定操作
this.submit_from(); this.submit_from();
} }
}, },*/
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
//刷新下拉选框内容 //刷新下拉选框内容
...@@ -322,15 +333,14 @@ export default { ...@@ -322,15 +333,14 @@ export default {
try { try {
const exportJson = await cons; const exportJson = await cons;
await this.summary(exportJson); await this.summary(exportJson);
//console.log('summary 执行完毕');
//this.submit(exportJson); //this.submit(exportJson);
} catch (Error) { } catch (Error) {
this.$message({ this.$message({
message: Error.message, message: Error.message,
type: "error" type: "error"
}); });
console.log(Error.message);
console.log("这里是最外面的地方");
} finally { } finally {
// 导入完成后关闭遮罩层 // 导入完成后关闭遮罩层
this.showMask = false; this.showMask = false;
...@@ -356,15 +366,14 @@ export default { ...@@ -356,15 +366,14 @@ export default {
try { try {
const exportJson = await cons; const exportJson = await cons;
await this.summary(exportJson); await this.summary(exportJson);
//console.log('summary 执行完毕');
this.submit(exportJson); this.submit(exportJson);
} catch (Error) { } catch (Error) {
this.$message({ this.$message({
message: Error.message, message: Error.message,
type: "error"}); type: "error"});
console.log(Error.message);
console.log("这里是最外面的地方");
}finally { }finally {
// 导入完成后关闭遮罩层 // 导入完成后关闭遮罩层
this.showMask = false;} this.showMask = false;}
...@@ -405,7 +414,7 @@ export default { ...@@ -405,7 +414,7 @@ export default {
//value.push(data[sysRules[i].re][sysRules[i].ce].m); //value.push(data[sysRules[i].re][sysRules[i].ce].m);
value.push(sysRules[i].ce); value.push(sysRules[i].ce);
} }
//console.log("value的值为:"+value);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const asyncTasks = []; const asyncTasks = [];
switch (tempId) { switch (tempId) {
...@@ -429,16 +438,15 @@ export default { ...@@ -429,16 +438,15 @@ export default {
departments.push(null); departments.push(null);
} }
} }
console.log(departments);
console.log(departmentMap);
}catch(err){ }catch(err){
throw new Error("导入失败,导入文件与模板规则不匹"); throw new Error("导入失败,导入文件与模板规则不匹");
} }
for (let key of departmentMap.keys()) { for (let key of departmentMap.keys()) {
console.log(key);
let map = new Map(); let map = new Map();
let smallMat = []; let smallMat = [];
//console.log(departments);
try { try {
for (let i = parseFloat(sysRulez[0].re) + 1; i < data.length; i++) { for (let i = parseFloat(sysRulez[0].re) + 1; i < data.length; i++) {
...@@ -452,7 +460,7 @@ export default { ...@@ -452,7 +460,7 @@ export default {
}catch(err){ }catch(err){
throw new Error("导入失败,导入文件与模板规则不匹"); throw new Error("导入失败,导入文件与模板规则不匹");
} }
//console.log(smallMat);
asyncTasks.push( asyncTasks.push(
new Promise((innerResolve, innerReject) => { new Promise((innerResolve, innerReject) => {
const allNull = smallMat.every(item =>item===null); const allNull = smallMat.every(item =>item===null);
...@@ -462,7 +470,7 @@ export default { ...@@ -462,7 +470,7 @@ export default {
materialConvert(smallMat) materialConvert(smallMat)
.then(response => { .then(response => {
let array = response.rows; let array = response.rows;
//console.log(array);
//luckysheet.setCellValue(12, 1, {bg:"#FF0000"}) //luckysheet.setCellValue(12, 1, {bg:"#FF0000"})
for (let i = parseFloat(sysRulez[0].re) + 1; i < data.length; i++) { for (let i = parseFloat(sysRulez[0].re) + 1; i < data.length; i++) {
let values = []; let values = [];
...@@ -491,7 +499,7 @@ export default { ...@@ -491,7 +499,7 @@ export default {
} }
} }
//循环得到汇总结果 //循环得到汇总结果
console.log(map);
if (map.size === 0) { if (map.size === 0) {
throw new Error("导入失败,导入文件错误"); throw new Error("导入失败,导入文件错误");
} }
...@@ -528,7 +536,7 @@ export default { ...@@ -528,7 +536,7 @@ export default {
innerResolve(); // 标记当前异步任务完成 innerResolve(); // 标记当前异步任务完成
}).catch(Error => { }).catch(Error => {
console.log("这里是单个异步请求出错处");
//必须加,不能删除 //必须加,不能删除
innerReject(Error); // 异步请求出错 innerReject(Error); // 异步请求出错
}); });
...@@ -560,7 +568,6 @@ export default { ...@@ -560,7 +568,6 @@ export default {
throw new Error("导入失败,导入文件与模板规则不匹"); throw new Error("导入失败,导入文件与模板规则不匹");
} }
//console.log(smallMat);
asyncTasks.push( asyncTasks.push(
new Promise((innerResolve, innerReject) => { new Promise((innerResolve, innerReject) => {
const allNull = smallMat.every(item =>item===null); const allNull = smallMat.every(item =>item===null);
...@@ -574,7 +581,6 @@ export default { ...@@ -574,7 +581,6 @@ export default {
.then(response => { .then(response => {
let array = response.rows; let array = response.rows;
//console.log(array);
//luckysheet.setCellValue(12, 1, {bg:"#FF0000"}) //luckysheet.setCellValue(12, 1, {bg:"#FF0000"})
for (let i = parseFloat(sysRulez[0].re) + 1, k = 0; i < data.length; i++, k++) { for (let i = parseFloat(sysRulez[0].re) + 1, k = 0; i < data.length; i++, k++) {
let values = []; let values = [];
...@@ -603,7 +609,7 @@ export default { ...@@ -603,7 +609,7 @@ export default {
} }
//循环得到汇总结果 //循环得到汇总结果
console.log(map);
if (map.size === 0) { if (map.size === 0) {
throw new Error("导入失败,导入文件错误"); throw new Error("导入失败,导入文件错误");
} }
...@@ -616,7 +622,7 @@ export default { ...@@ -616,7 +622,7 @@ export default {
map.forEach((value, key) => { map.forEach((value, key) => {
const suffixArr = key.split('/'), mat = suffixArr[2], depp = suffixArr[1], const suffixArr = key.split('/'), mat = suffixArr[2], depp = suffixArr[1],
expp = suffixArr[0]; expp = suffixArr[0];
//console.log(expp);console.log(depp);console.log(mat);
let searchResult = luckysheet.find(expp); let searchResult = luckysheet.find(expp);
if (searchResult.length !== 0 ) { if (searchResult.length !== 0 ) {
rowws = searchResult[0].row; rowws = searchResult[0].row;
...@@ -676,7 +682,7 @@ export default { ...@@ -676,7 +682,7 @@ export default {
} }
}).catch(Error => { }).catch(Error => {
console.log("这里是单个异步请求出错处");
//必须加,不能删除 //必须加,不能删除
innerReject(Error); // 异步请求出错 innerReject(Error); // 异步请求出错
}); });
...@@ -707,7 +713,7 @@ export default { ...@@ -707,7 +713,7 @@ export default {
}catch(err){ }catch(err){
throw new Error("导入失败,导入文件与模板规则不匹"); throw new Error("导入失败,导入文件与模板规则不匹");
} }
//console.log(smallMat);
asyncTasks.push( asyncTasks.push(
new Promise((innerResolve, innerReject) => { new Promise((innerResolve, innerReject) => {
const allNull = smallMat.every(item =>item===null); const allNull = smallMat.every(item =>item===null);
...@@ -717,7 +723,7 @@ export default { ...@@ -717,7 +723,7 @@ export default {
materialConvert(smallMat) materialConvert(smallMat)
.then(response => { .then(response => {
let array = response.rows; let array = response.rows;
//console.log(array);
//luckysheet.setCellValue(12, 1, {bg:"#FF0000"}) //luckysheet.setCellValue(12, 1, {bg:"#FF0000"})
for (let i = parseInt(sysRulez[0].re) + 1; i < data.length; i++) { for (let i = parseInt(sysRulez[0].re) + 1; i < data.length; i++) {
let values = []; let values = [];
...@@ -756,7 +762,7 @@ export default { ...@@ -756,7 +762,7 @@ export default {
let row; let row;
let con; let con;
let warn=0; let warn=0;
//console.log(map);
map.forEach((value,key)=>{ map.forEach((value,key)=>{
let searchResult; let searchResult;
searchResult= luckysheet.find(key); searchResult= luckysheet.find(key);
...@@ -836,7 +842,7 @@ export default { ...@@ -836,7 +842,7 @@ export default {
if (map2.size === 0) { if (map2.size === 0) {
throw new Error("导入失败,导入文件错误"); throw new Error("导入失败,导入文件错误");
} }
//console.log(map2);
map2.forEach((value, key) => { map2.forEach((value, key) => {
let searchResult; let searchResult;
searchResult= luckysheet.find(key); searchResult= luckysheet.find(key);
...@@ -864,7 +870,7 @@ export default { ...@@ -864,7 +870,7 @@ export default {
resolve(response.rows); resolve(response.rows);
innerResolve(); // 标记当前异步任务完成 innerResolve(); // 标记当前异步任务完成
}).catch(Error => { }).catch(Error => {
console.log("这里是单个异步请求出错处");
//必须加,不能删除 //必须加,不能删除
innerReject(Error); // 异步请求出错 innerReject(Error); // 异步请求出错
}); });
...@@ -872,7 +878,7 @@ export default { ...@@ -872,7 +878,7 @@ export default {
} }
break; break;
case 7: { case 7: {
debugger
let map = new Map(); let map = new Map();
let smallMat = []; let smallMat = [];
let deps = []; let deps = [];
...@@ -898,7 +904,7 @@ export default { ...@@ -898,7 +904,7 @@ export default {
if (allNull ) { if (allNull ) {
throw new Error("导入失败,导入文件错误,所选文件与模板规则不匹"); throw new Error("导入失败,导入文件错误,所选文件与模板规则不匹");
} }
debugger
...@@ -940,8 +946,8 @@ export default { ...@@ -940,8 +946,8 @@ export default {
} }
//循环得到汇总结果 //循环得到汇总结果
debugger
console.log(map);
if (map.size === 0) { if (map.size === 0) {
throw new Error("导入失败,导入文件错误"); throw new Error("导入失败,导入文件错误");
} }
...@@ -964,7 +970,7 @@ export default { ...@@ -964,7 +970,7 @@ export default {
let warn=0; let warn=0;
map.forEach((value, key) => { map.forEach((value, key) => {
const suffixArr = key.split('/'), mat = suffixArr[0], depp = suffixArr[1]; const suffixArr = key.split('/'), mat = suffixArr[0], depp = suffixArr[1];
//console.log(mat);console.log(depp);
let searchResult = luckysheet.find(mat); let searchResult = luckysheet.find(mat);
if (searchResult.length != 0 && key != null) { if (searchResult.length != 0 && key != null) {
rowws = searchResult[0].row; rowws = searchResult[0].row;
...@@ -1013,7 +1019,7 @@ export default { ...@@ -1013,7 +1019,7 @@ export default {
warn++; warn++;
} }
}); });
debugger
if (warn === map.size) { if (warn === map.size) {
throw new Error("导入文件与所选模板规则不匹配"); throw new Error("导入文件与所选模板规则不匹配");
} else if (warn > 0) { } else if (warn > 0) {
...@@ -1027,7 +1033,7 @@ export default { ...@@ -1027,7 +1033,7 @@ export default {
let number = parseInt(find1[0].row)-1; let number = parseInt(find1[0].row)-1;
luckysheet.setCellValue(find1[0].row, sysRules[sysRules.length-1].ct, "=SUM(F2:F"+number+")")*/ luckysheet.setCellValue(find1[0].row, sysRules[sysRules.length-1].ct, "=SUM(F2:F"+number+")")*/
}).catch(Error => { }).catch(Error => {
console.log("这里是单个异步请求出错处");
//必须加,不能删除 //必须加,不能删除
innerReject(Error); // 异步请求出错 innerReject(Error); // 异步请求出错
}); });
...@@ -1089,7 +1095,7 @@ export default { ...@@ -1089,7 +1095,7 @@ export default {
} }
//循环得到汇总结果 //循环得到汇总结果
console.log(map);
if (map.size === 0) { if (map.size === 0) {
throw new Error("导入失败,导入文件错误"); throw new Error("导入失败,导入文件错误");
} }
...@@ -1123,7 +1129,7 @@ export default { ...@@ -1123,7 +1129,7 @@ export default {
resolve(response.rows); resolve(response.rows);
innerResolve(); // 标记当前异步任务完成 innerResolve(); // 标记当前异步任务完成
}).catch(Error => { }).catch(Error => {
console.log("这里是单个异步请求出错处");
//必须加,不能删除 //必须加,不能删除
innerReject(Error); // 异步请求出错 innerReject(Error); // 异步请求出错
}); });
...@@ -1138,14 +1144,14 @@ export default { ...@@ -1138,14 +1144,14 @@ export default {
resolve(); // 所有异步请求执行完成 resolve(); // 所有异步请求执行完成
}) })
.catch(Error => { .catch(Error => {
console.log("这里是所有的异步请求出错处");
reject(Error); // 异步请求出错 reject(Error); // 异步请求出错
}); });
}); });
}, },
/** 保存导入文件和生成文件 */ /** 保存导入文件和生成文件 */
submit(contents){ submit(contents){
console.log("还是执行了保存方法");
const name = contents.info.name; const name = contents.info.name;
const obj=contents.sheets; const obj=contents.sheets;
let list=[]; let list=[];
...@@ -1166,7 +1172,7 @@ export default { ...@@ -1166,7 +1172,7 @@ export default {
this.from.historyContent=strsheet; this.from.historyContent=strsheet;
this.from.identifyingCode=1; this.from.identifyingCode=1;
list.push(this.from); list.push(this.from);
console.log(list);
addInsert(list).then(response=>{ addInsert(list).then(response=>{
if(response.code==200){ if(response.code==200){
this.$message({ this.$message({
...@@ -1180,7 +1186,92 @@ export default { ...@@ -1180,7 +1186,92 @@ export default {
/** 导出设置 */ /** 导出设置 */
handleExport: debounce(function() { handleExport: debounce(function() {
// 处理点击事件 // 处理点击事件
exportExcel(luckysheet.getAllSheets(),fileName,trueORfalse) exportExcel(luckysheet.getAllSheets(),fileName,trueORfalse);
// 清洗数据
selectActSuppliesHistorydata().then(response => {
var data = response.data;
for (let i = 0; i < data.length; i++) {
if(data[i].identifyingCode == 1){
/*生成表*/
let jsonDataa = JSON.parse(data[i].historyContent);
for (let j = 0; j < jsonDataa.length; j++) {
let dataa=window.luckysheet.transToData(jsonDataa[j].celldata);
for (let k = 2; k < dataa.length; k++) {
let a0;
let a1;
let a3;
let a4;
let a5;
let a6;
if(dataa[k][0] != null){
a0= dataa[k][0].v;
if(a0 == undefined){
a0="";
}
}
if(dataa[k][1] != null){
a1= dataa[k][1].v;
if(a1 == undefined){
a1="";
}
}
if(dataa[k][3] != null){
a3= dataa[k][3].v;
if(a3 == undefined){
a3="";
}
}
if(dataa[k][4] != null){
a4= dataa[k][4].v;
if(a4 == undefined){
a4="";
}
}
if(dataa[k][5] != null){
a5= dataa[k][5].v;
if(a5 == undefined){
a5="";
}
}
if(dataa[k][6] != null){
a6= dataa[k][6].v;
if(a6 == undefined){
a6="";
}
}
if(data[i].id != null){
this.froms.hId = data[i].id;
this.froms.projectId =a0;
this.froms.projectName =a1;
this.froms.departmentName =a3;
this.froms.number =a4;
this.froms.nuitPrice =a5;
this.froms.money =a6;
this.froms.createBy = data[i].createBy;
addActSuppliesSixMinesSummaryTable(this.froms).then(response => {});
}
}
}
}else {
/*导入表*/
/*let jsonDatab = JSON.parse(data[i].historyContent);
for (let j = 0; j < jsonDatab.length; j++) {
let datab=window.luckysheet.transToData(jsonDatab[j].celldata);
}*/
}
}
});
}, 500), // 设置延迟时间,单位为毫秒 }, 500), // 设置延迟时间,单位为毫秒
} }
// 配置项111 // 配置项111
......
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