Commit 18042093 authored by lvzhuangzhuang's avatar lvzhuangzhuang

Merge remote-tracking branch 'origin/master'

parents b4062645 ac230c33
...@@ -20,7 +20,9 @@ ruoyi: ...@@ -20,7 +20,9 @@ ruoyi:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口,默认为8080 # 服务器的HTTP端口,默认为8080
port: 5001 # port: 5001
# port: 5001
port: 8080
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
......
package com.ruoyi.system.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.ActSuppliesConvertrole;
import com.ruoyi.system.service.IActSuppliesConvertroleService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 通用规则Controller
*
* @author ruoyi
* @date 2023-08-29
*/
@RestController
@RequestMapping("/ActSuppliesConvertrole/ActSuppliesConvertrole")
public class ActSuppliesConvertroleController extends BaseController
{
@Autowired
private IActSuppliesConvertroleService actSuppliesConvertService;
/**
* 查询通用规则列表
*/
@PreAuthorize("@ss.hasPermi('ActSuppliesConvertrole:ActSuppliesConvertrole:list')")
@GetMapping("/list")
public TableDataInfo list(ActSuppliesConvertrole actSuppliesConvertrole)
{
startPage();
List<ActSuppliesConvertrole> list = actSuppliesConvertService.selectActSuppliesConvertList(actSuppliesConvertrole);
return getDataTable(list);
}
/**
* 导出通用规则列表
*/
@PreAuthorize("@ss.hasPermi('ActSuppliesConvertrole:ActSuppliesConvertrole:export')")
@Log(title = "通用规则", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ActSuppliesConvertrole actSuppliesConvertrole)
{
List<ActSuppliesConvertrole> list = actSuppliesConvertService.selectActSuppliesConvertList(actSuppliesConvertrole);
ExcelUtil<ActSuppliesConvertrole> util = new ExcelUtil<ActSuppliesConvertrole>(ActSuppliesConvertrole.class);
return util.exportExcel(list, "通用规则数据");
}
/**
* 获取通用规则详细信息
*/
@PreAuthorize("@ss.hasPermi('ActSuppliesConvertrole:ActSuppliesConvertrole:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(actSuppliesConvertService.selectActSuppliesConvertById(id));
}
/**
* 新增通用规则
*/
@PreAuthorize("@ss.hasPermi('ActSuppliesConvertrole:ActSuppliesConvertrole:add')")
@Log(title = "通用规则", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ActSuppliesConvertrole actSuppliesConvertrole)
{
return toAjax(actSuppliesConvertService.insertActSuppliesConvert(actSuppliesConvertrole));
}
/**
* 修改通用规则
*/
@PreAuthorize("@ss.hasPermi('ActSuppliesConvertrole:ActSuppliesConvertrole:edit')")
@Log(title = "通用规则", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ActSuppliesConvertrole actSuppliesConvertrole)
{
return toAjax(actSuppliesConvertService.updateActSuppliesConvert(actSuppliesConvertrole));
}
/**
* 删除通用规则
*/
@PreAuthorize("@ss.hasPermi('ActSuppliesConvertrole:ActSuppliesConvertrole:remove')")
@Log(title = "通用规则", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(actSuppliesConvertService.deleteActSuppliesConvertByIds(ids));
}
}
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 通用规则对象 act_supplies_convert
*
* @author ruoyi
* @date 2023-08-29
*/
public class ActSuppliesConvertrole extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 模板id */
@Excel(name = "模板id")
private Long tempId;
/** 规则名称 */
@Excel(name = "规则名称")
private String name;
/** 规则内容 */
@Excel(name = "规则内容")
private String content;
/** 状态 */
@Excel(name = "状态")
private Long status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTempId(Long tempId)
{
this.tempId = tempId;
}
public Long getTempId()
{
return tempId;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("tempId", getTempId())
.append("name", getName())
.append("content", getContent())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.ActSuppliesConvertrole;
/**
* 通用规则Mapper接口
*
* @author ruoyi
* @date 2023-08-29
*/
public interface ActSuppliesConvertroleMapper
{
/**
* 查询通用规则
*
* @param id 通用规则ID
* @return 通用规则
*/
public ActSuppliesConvertrole selectActSuppliesConvertById(Long id);
/**
* 查询通用规则列表
*
* @param actSuppliesConvertrole 通用规则
* @return 通用规则集合
*/
public List<ActSuppliesConvertrole> selectActSuppliesConvertList(ActSuppliesConvertrole actSuppliesConvertrole);
/**
* 新增通用规则
*
* @param actSuppliesConvertrole 通用规则
* @return 结果
*/
public int insertActSuppliesConvert(ActSuppliesConvertrole actSuppliesConvertrole);
/**
* 修改通用规则
*
* @param actSuppliesConvertrole 通用规则
* @return 结果
*/
public int updateActSuppliesConvert(ActSuppliesConvertrole actSuppliesConvertrole);
/**
* 删除通用规则
*
* @param id 通用规则ID
* @return 结果
*/
public int deleteActSuppliesConvertById(Long id);
/**
* 批量删除通用规则
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteActSuppliesConvertByIds(Long[] ids);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.ActSuppliesConvertrole;
/**
* 通用规则Service接口
*
* @author ruoyi
* @date 2023-08-29
*/
public interface IActSuppliesConvertroleService
{
/**
* 查询通用规则
*
* @param id 通用规则ID
* @return 通用规则
*/
public ActSuppliesConvertrole selectActSuppliesConvertById(Long id);
/**
* 查询通用规则列表
*
* @param actSuppliesConvertrole 通用规则
* @return 通用规则集合
*/
public List<ActSuppliesConvertrole> selectActSuppliesConvertList(ActSuppliesConvertrole actSuppliesConvertrole);
/**
* 新增通用规则
*
* @param actSuppliesConvertrole 通用规则
* @return 结果
*/
public int insertActSuppliesConvert(ActSuppliesConvertrole actSuppliesConvertrole);
/**
* 修改通用规则
*
* @param actSuppliesConvertrole 通用规则
* @return 结果
*/
public int updateActSuppliesConvert(ActSuppliesConvertrole actSuppliesConvertrole);
/**
* 批量删除通用规则
*
* @param ids 需要删除的通用规则ID
* @return 结果
*/
public int deleteActSuppliesConvertByIds(Long[] ids);
/**
* 删除通用规则信息
*
* @param id 通用规则ID
* @return 结果
*/
public int deleteActSuppliesConvertById(Long id);
}
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ActSuppliesConvertroleMapper;
import com.ruoyi.system.domain.ActSuppliesConvertrole;
import com.ruoyi.system.service.IActSuppliesConvertroleService;
/**
* 通用规则Service业务层处理
*
* @author ruoyi
* @date 2023-08-29
*/
@Service
public class ActSuppliesConvertroleServiceImpl implements IActSuppliesConvertroleService
{
@Autowired
private ActSuppliesConvertroleMapper actSuppliesConvertMapper;
/**
* 查询通用规则
*
* @param id 通用规则ID
* @return 通用规则
*/
@Override
public ActSuppliesConvertrole selectActSuppliesConvertById(Long id)
{
return actSuppliesConvertMapper.selectActSuppliesConvertById(id);
}
/**
* 查询通用规则列表
*
* @param actSuppliesConvertrole 通用规则
* @return 通用规则
*/
@Override
public List<ActSuppliesConvertrole> selectActSuppliesConvertList(ActSuppliesConvertrole actSuppliesConvertrole)
{
return actSuppliesConvertMapper.selectActSuppliesConvertList(actSuppliesConvertrole);
}
/**
* 新增通用规则
*
* @param actSuppliesConvertrole 通用规则
* @return 结果
*/
@Override
public int insertActSuppliesConvert(ActSuppliesConvertrole actSuppliesConvertrole)
{
actSuppliesConvertrole.setCreateTime(DateUtils.getNowDate());
return actSuppliesConvertMapper.insertActSuppliesConvert(actSuppliesConvertrole);
}
/**
* 修改通用规则
*
* @param actSuppliesConvertrole 通用规则
* @return 结果
*/
@Override
public int updateActSuppliesConvert(ActSuppliesConvertrole actSuppliesConvertrole)
{
actSuppliesConvertrole.setUpdateTime(DateUtils.getNowDate());
return actSuppliesConvertMapper.updateActSuppliesConvert(actSuppliesConvertrole);
}
/**
* 批量删除通用规则
*
* @param ids 需要删除的通用规则ID
* @return 结果
*/
@Override
public int deleteActSuppliesConvertByIds(Long[] ids)
{
return actSuppliesConvertMapper.deleteActSuppliesConvertByIds(ids);
}
/**
* 删除通用规则信息
*
* @param id 通用规则ID
* @return 结果
*/
@Override
public int deleteActSuppliesConvertById(Long id)
{
return actSuppliesConvertMapper.deleteActSuppliesConvertById(id);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.ActSuppliesConvertroleMapper">
<resultMap type="ActSuppliesConvertrole" id="ActSuppliesConvertResult">
<result property="id" column="id" />
<result property="tempId" column="temp_id" />
<result property="name" column="name" />
<result property="content" column="content" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectActSuppliesConvertVo">
select id, temp_id, name, content, status, create_by, create_time, update_by, update_time from act_supplies_convert
</sql>
<select id="selectActSuppliesConvertList" parameterType="ActSuppliesConvertrole" resultMap="ActSuppliesConvertResult">
<include refid="selectActSuppliesConvertVo"/>
<where>
<if test="tempId != null "> and temp_id = #{tempId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectActSuppliesConvertById" parameterType="Long" resultMap="ActSuppliesConvertResult">
<include refid="selectActSuppliesConvertVo"/>
where id = #{id}
</select>
<insert id="insertActSuppliesConvert" parameterType="ActSuppliesConvertrole" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_convert
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tempId != null">temp_id,</if>
<if test="name != null">name,</if>
<if test="content != null">content,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tempId != null">#{tempId},</if>
<if test="name != null">#{name},</if>
<if test="content != null">#{content},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateActSuppliesConvert" parameterType="ActSuppliesConvertrole">
update act_supplies_convert
<trim prefix="SET" suffixOverrides=",">
<if test="tempId != null">temp_id = #{tempId},</if>
<if test="name != null">name = #{name},</if>
<if test="content != null">content = #{content},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteActSuppliesConvertById" parameterType="Long">
delete from act_supplies_convert where id = #{id}
</delete>
<delete id="deleteActSuppliesConvertByIds" parameterType="String">
delete from act_supplies_convert where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -125,7 +125,9 @@ var setStyleAndValue = function(cellArr, worksheet,contrast) { ...@@ -125,7 +125,9 @@ var setStyleAndValue = function(cellArr, worksheet,contrast) {
if(contrast){ if(contrast){
const column =worksheet.getColumn(1); const column =worksheet.getColumn(1);
const column2 =worksheet.getColumn(2);
column.hidden=true; column.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) {
......
import request from '@/utils/request'
// 查询通用规则列表
export function listConvert(query) {
return request({
url: '/ActSuppliesConvertrole/ActSuppliesConvertrole/list',
method: 'get',
params: query
})
}
// 查询通用规则详细
export function getConvert(id) {
return request({
url: '/ActSuppliesConvertrole/ActSuppliesConvertrole/' + id,
method: 'get'
})
}
// 新增通用规则
export function addConvert(data) {
return request({
url: '/ActSuppliesConvertrole/ActSuppliesConvertrole',
method: 'post',
data: data
})
}
// 修改通用规则
export function updateConvert(data) {
return request({
url: '/ActSuppliesConvertrole/ActSuppliesConvertrole',
method: 'put',
data: data
})
}
// 删除通用规则
export function delConvert(id) {
return request({
url: '/ActSuppliesConvertrole/ActSuppliesConvertrole/' + id,
method: 'delete'
})
}
// 导出通用规则
export function exportConvert(query) {
return request({
url: '/ActSuppliesConvertrole/ActSuppliesConvertrole/export',
method: 'get',
params: query
})
}
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="模板id" prop="tempId">
<el-input
v-model="queryParams.tempId"
placeholder="请输入模板id"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="规则名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入规则名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ActSuppliesConvert:convert:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['ActSuppliesConvert:convert:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['ActSuppliesConvert:convert:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['ActSuppliesConvert:convert:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="convertList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="模板id" align="center" prop="tempId" />
<el-table-column label="规则名称" align="center" prop="name" />
<el-table-column label="规则内容" align="center" prop="content" />
<el-table-column label="状态" align="center" prop="status" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ActSuppliesConvert:convert:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ActSuppliesConvert:convert:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改通用规则对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="模板id" prop="tempId">
<el-input v-model="form.tempId" placeholder="请输入模板id" />
</el-form-item>
<el-form-item label="规则名称" prop="name">
<el-input v-model="form.name" placeholder="请输入规则名称" />
</el-form-item>
<el-form-item label="规则内容">
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listConvert, getConvert, delConvert, addConvert, updateConvert, exportConvert } from "@/api/ActSuppliesConvert/convert";
import Editor from '@/components/Editor';
export default {
name: "Convert",
components: {
Editor,
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 通用规则表格数据
convertList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
tempId: null,
name: null,
content: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询通用规则列表 */
getList() {
this.loading = true;
listConvert(this.queryParams).then(response => {
this.convertList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
tempId: null,
name: null,
content: null,
status: 0,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加通用规则";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getConvert(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改通用规则";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateConvert(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addConvert(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除通用规则编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delConvert(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有通用规则数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportConvert(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>
...@@ -78,6 +78,7 @@ var tempId; ...@@ -78,6 +78,7 @@ var tempId;
var roleId; var roleId;
var uuid1; var uuid1;
var trueORfalse=false; var trueORfalse=false;
var modify=false;
export default { export default {
name: "Mymodule", name: "Mymodule",
data() { data() {
...@@ -132,6 +133,7 @@ export default { ...@@ -132,6 +133,7 @@ export default {
}else{ }else{
trueORfalse=false; trueORfalse=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); console.log(this.uuid);
...@@ -182,10 +184,9 @@ export default { ...@@ -182,10 +184,9 @@ export default {
break; break;
} }
} }
modify=false;
const sysSupplies = response.rows; const sysSupplies = response.rows;
this.luckysheetData = sysSupplies[0].templateContent; this.luckysheetData = sysSupplies[0].templateContent;
//将接收到的json存到json_data中
//const json_data = response.data;
let json_data = JSON.parse(sysSupplies[0].templateContent); let json_data = JSON.parse(sysSupplies[0].templateContent);
//luckysheet.destroy() //luckysheet.destroy()
luckysheet.create({ luckysheet.create({
...@@ -220,6 +221,7 @@ export default { ...@@ -220,6 +221,7 @@ export default {
this.selectedRule=''; this.selectedRule='';
this.luckyrule=[]; this.luckyrule=[];
trueORfalse=false; trueORfalse=false;
modify=false;
uuid1=''; uuid1='';
//刷新luckysheet表格 //刷新luckysheet表格
this.init(); this.init();
...@@ -286,6 +288,28 @@ export default { ...@@ -286,6 +288,28 @@ export default {
}, },
/** 导入事件*/ /** 导入事件*/
async handleFileChange(evt) { async handleFileChange(evt) {
if(modify){
this.$confirm('再次导入将会清空表内数据,是否继续操作?', '注意!!!', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
// 确认继续后刷新页面返回模板
getSuppliesTemplate(7).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;
}).then(async ()=>{
//将导入数据替换保存
let exx; let exx;
this.showMask = true; this.showMask = true;
const cons = new Promise((resolve, reject) => { const cons = new Promise((resolve, reject) => {
...@@ -294,12 +318,45 @@ export default { ...@@ -294,12 +318,45 @@ export default {
resolve(exx); resolve(exx);
}); });
}); });
try {
const exportJson = await cons;
await this.summary(exportJson);
//console.log('summary 执行完毕');
//this.submit(exportJson);
} catch (Error) {
this.$message({
message: Error.message,
type: "error"
});
console.log(Error.message);
console.log("这里是最外面的地方");
} finally {
// 导入完成后关闭遮罩层
this.showMask = false;
}
}).catch(() => {
// 处理错误逻辑,这里是一个空的错误处理函数
this.$message.error('查询失败,模板未找到,请联系管理员进行处理!');
});
}).catch(() => {
// 用户点击了取消按钮
//this.$message({type: 'info', message: '操作已取消'});
});
}else{
let exx;
this.showMask = true;
const cons = new Promise((resolve, reject) => {
LuckyExcel.transformExcelToLucky(evt, exportJson => {
exx = exportJson;
resolve(exx);
});
});
try { try {
const exportJson = await cons; const exportJson = await cons;
await this.summary(exportJson); await this.summary(exportJson);
//console.log('summary 执行完毕'); //console.log('summary 执行完毕');
this.submit(exportJson); //this.submit(exportJson);
} catch (Error) { } catch (Error) {
this.$message({ this.$message({
...@@ -309,8 +366,9 @@ export default { ...@@ -309,8 +366,9 @@ export default {
console.log("这里是最外面的地方"); console.log("这里是最外面的地方");
}finally { }finally {
// 导入完成后关闭遮罩层 // 导入完成后关闭遮罩层
this.showMask = false; this.showMask = false;}
} }
}, },
/** 物料转换汇总到页面*/ /** 物料转换汇总到页面*/
summary(exportJson){ summary(exportJson){
...@@ -900,6 +958,16 @@ export default { ...@@ -900,6 +958,16 @@ export default {
if (searchResult.length != 0 && key != null) { if (searchResult.length != 0 && key != null) {
rowws = searchResult[0].row; rowws = searchResult[0].row;
luckysheet.insertRow(rowws + 1); luckysheet.insertRow(rowws + 1);
let vll1=luckysheet.getCellValue(rowws,sysRulez[0].ct);
luckysheet.setCellValue(rowws+1, sysRulez[0].ct, {
"ct": {
"fa": "@",
"t": "n"
}
});
luckysheet.setCellValue(rowws + 1, sysRulez[0].ct, vll1);
let vll2=luckysheet.getCellValue(rowws,parseInt(sysRulez[0].ct)+1);
luckysheet.setCellValue(rowws + 1, parseInt(sysRulez[0].ct)+1, vll2);
//输出部门数量金额 //输出部门数量金额
luckysheet.setCellValue(rowws + 1, sysRulez[1].ct, depp); luckysheet.setCellValue(rowws + 1, sysRulez[1].ct, depp);
for (let i = 0; i < sysRules.length; i++) { for (let i = 0; i < sysRules.length; i++) {
...@@ -926,6 +994,7 @@ export default { ...@@ -926,6 +994,7 @@ export default {
bord.range[0].column = [0, parseInt(sysRules[sysRules.length - 1].ct)]; bord.range[0].column = [0, parseInt(sysRules[sysRules.length - 1].ct)];
config.borderInfo.push(bord); config.borderInfo.push(bord);
luckysheet.setConfig(config); luckysheet.setConfig(config);
modify=true;
} else{ } else{
warn++; warn++;
} }
......
...@@ -35,7 +35,9 @@ module.exports = { ...@@ -35,7 +35,9 @@ module.exports = {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
// target: `http://192.168.10.105:5001`, // target: `http://192.168.10.105:5001`,
target: `http://localhost:5001`, // target: `http://localhost:5001`,
target: `http://localhost:8080`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''
......
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