Merge remote-tracking branch 'upstream/master' into dev_lcw

# Conflicts:
#	ruoyi-ui/src/views/index.vue
pull/445/head
hsdllcw 2025-05-13 09:53:20 +08:00
commit d58544aac6
95 changed files with 2420 additions and 2399 deletions

View File

@ -56,8 +56,8 @@ public class SysUser extends BaseEntity
/** 密码 */ /** 密码 */
private String password; private String password;
/** 号状态0正常 1停用 */ /** 号状态0正常 1停用 */
@Excel(name = "号状态", readConverterExp = "0=正常,1=停用") @Excel(name = "号状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
@ -311,6 +311,7 @@ public class SysUser extends BaseEntity
{ {
this.roleId = roleId; this.roleId = roleId;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -390,7 +390,7 @@ public class ExcelUtil<T>
if (String.class == fieldType) if (String.class == fieldType)
{ {
String s = Convert.toStr(val); String s = Convert.toStr(val);
if (StringUtils.endsWith(s, ".0")) if (s.matches("^\\d+\\.0$"))
{ {
val = StringUtils.substringBefore(s, ".0"); val = StringUtils.substringBefore(s, ".0");
} }

View File

@ -1,87 +0,0 @@
package com.ruoyi.gateway.filter;
import java.util.Collections;
import java.util.List;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.OrderedGatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
/**
* body
*
* @author ruoyi
*/
@Component
public class CacheRequestFilter extends AbstractGatewayFilterFactory<CacheRequestFilter.Config>
{
public CacheRequestFilter()
{
super(Config.class);
}
@Override
public String name()
{
return "CacheRequestFilter";
}
@Override
public GatewayFilter apply(Config config)
{
CacheRequestGatewayFilter cacheRequestGatewayFilter = new CacheRequestGatewayFilter();
Integer order = config.getOrder();
if (order == null)
{
return cacheRequestGatewayFilter;
}
return new OrderedGatewayFilter(cacheRequestGatewayFilter, order);
}
public static class CacheRequestGatewayFilter implements GatewayFilter
{
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain)
{
// GET DELETE 不过滤
HttpMethod method = exchange.getRequest().getMethod();
if (method == null || method == HttpMethod.GET || method == HttpMethod.DELETE)
{
return chain.filter(exchange);
}
return ServerWebExchangeUtils.cacheRequestBodyAndRequest(exchange, (serverHttpRequest) -> {
if (serverHttpRequest == exchange.getRequest())
{
return chain.filter(exchange);
}
return chain.filter(exchange.mutate().request(serverHttpRequest).build());
});
}
}
@Override
public List<String> shortcutFieldOrder()
{
return Collections.singletonList("order");
}
static class Config
{
private Integer order;
public Integer getOrder()
{
return order;
}
public void setOrder(Integer order)
{
this.order = order;
}
}
}

View File

@ -283,9 +283,9 @@
</template> </template>
<script> <script>
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"
export default { export default {
name: "${BusinessName}", name: "${BusinessName}",
@ -346,18 +346,18 @@ export default {
#end #end
#end #end
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询${functionName}列表 */ /** 查询${functionName}列表 */
getList() { getList() {
this.loading = true; this.loading = true
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
this.queryParams.params = {}; this.queryParams.params = {}
#break #break
#end #end
#end #end
@ -365,40 +365,40 @@ export default {
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]
this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]
} }
#end #end
#end #end
list${BusinessName}(this.queryParams).then(response => { list${BusinessName}(this.queryParams).then(response => {
this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}")
this.loading = false; this.loading = false
}); })
}, },
/** 转换${functionName}数据结构 */ /** 转换${functionName}数据结构 */
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children
} }
return { return {
id: node.${treeCode}, id: node.${treeCode},
label: node.${treeName}, label: node.${treeName},
children: node.children children: node.children
}; }
}, },
/** 查询${functionName}下拉树结构 */ /** 查询${functionName}下拉树结构 */
getTreeselect() { getTreeselect() {
list${BusinessName}().then(response => { list${BusinessName}().then(response => {
this.${businessName}Options = []; this.${businessName}Options = []
const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }; const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }
data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}")
this.${businessName}Options.push(data); this.${businessName}Options.push(data)
}); })
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// 表单重置 // 表单重置
reset() { reset() {
@ -410,61 +410,61 @@ export default {
$column.javaField: null#if($foreach.count != $columns.size()),#end $column.javaField: null#if($foreach.count != $columns.size()),#end
#end #end
#end #end
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
this.daterange${AttrName} = []; this.daterange${AttrName} = []
#end #end
#end #end
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd(row) { handleAdd(row) {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
if (row != null && row.${treeCode}) { if (row != null && row.${treeCode}) {
this.form.${treeParentCode} = row.${treeCode}; this.form.${treeParentCode} = row.${treeCode}
} else { } else {
this.form.${treeParentCode} = 0; this.form.${treeParentCode} = 0
} }
this.open = true; this.open = true
this.title = "添加${functionName}"; this.title = "添加${functionName}"
}, },
/** 展开/折叠操作 */ /** 展开/折叠操作 */
toggleExpandAll() { toggleExpandAll() {
this.refreshTable = false; this.refreshTable = false
this.isExpandAll = !this.isExpandAll; this.isExpandAll = !this.isExpandAll
this.$nextTick(() => { this.$nextTick(() => {
this.refreshTable = true; this.refreshTable = true
}); })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
if (row != null) { if (row != null) {
this.form.${treeParentCode} = row.${treeParentCode}; this.form.${treeParentCode} = row.${treeParentCode}
} }
get${BusinessName}(row.${pkColumn.javaField}).then(response => { get${BusinessName}(row.${pkColumn.javaField}).then(response => {
this.form = response.data; this.form = response.data
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
this.form.$column.javaField = this.form.${column.javaField}.split(","); this.form.$column.javaField = this.form.${column.javaField}.split(",")
#end #end
#end #end
this.open = true; this.open = true
this.title = "修改${functionName}"; this.title = "修改${functionName}"
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
@ -472,34 +472,34 @@ export default {
if (valid) { if (valid) {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
this.form.$column.javaField = this.form.${column.javaField}.join(","); this.form.$column.javaField = this.form.${column.javaField}.join(",")
#end #end
#end #end
if (this.form.${pkColumn.javaField} != null) { if (this.form.${pkColumn.javaField} != null) {
update${BusinessName}(this.form).then(response => { update${BusinessName}(this.form).then(response => {
this.#[[$modal]]#.msgSuccess("修改成功"); this.#[[$modal]]#.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
add${BusinessName}(this.form).then(response => { add${BusinessName}(this.form).then(response => {
this.#[[$modal]]#.msgSuccess("新增成功"); this.#[[$modal]]#.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() { this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
return del${BusinessName}(row.${pkColumn.javaField}); return del${BusinessName}(row.${pkColumn.javaField})
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.#[[$modal]]#.msgSuccess("删除成功"); this.#[[$modal]]#.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
} }
} }
}; }
</script> </script>

View File

@ -353,7 +353,7 @@
</template> </template>
<script> <script>
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
export default { export default {
name: "${BusinessName}", name: "${BusinessName}",
@ -423,18 +423,18 @@ export default {
#end #end
#end #end
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询${functionName}列表 */ /** 查询${functionName}列表 */
getList() { getList() {
this.loading = true; this.loading = true
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
this.queryParams.params = {}; this.queryParams.params = {}
#break #break
#end #end
#end #end
@ -442,21 +442,21 @@ export default {
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]
this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]
} }
#end #end
#end #end
list${BusinessName}(this.queryParams).then(response => { list${BusinessName}(this.queryParams).then(response => {
this.${businessName}List = response.rows; this.${businessName}List = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// 表单重置 // 表单重置
reset() { reset() {
@ -468,27 +468,27 @@ export default {
$column.javaField: null#if($foreach.count != $columns.size()),#end $column.javaField: null#if($foreach.count != $columns.size()),#end
#end #end
#end #end
}; }
#if($table.sub) #if($table.sub)
this.${subclassName}List = []; this.${subclassName}List = []
#end #end
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
this.daterange${AttrName} = []; this.daterange${AttrName} = []
#end #end
#end #end
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -498,27 +498,27 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加${functionName}"; this.title = "添加${functionName}"
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids
get${BusinessName}(${pkColumn.javaField}).then(response => { get${BusinessName}(${pkColumn.javaField}).then(response => {
this.form = response.data; this.form = response.data
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
this.form.$column.javaField = this.form.${column.javaField}.split(","); this.form.$column.javaField = this.form.${column.javaField}.split(",")
#end #end
#end #end
#if($table.sub) #if($table.sub)
this.${subclassName}List = response.data.${subclassName}List; this.${subclassName}List = response.data.${subclassName}List
#end #end
this.open = true; this.open = true
this.title = "修改${functionName}"; this.title = "修改${functionName}"
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
@ -526,64 +526,64 @@ export default {
if (valid) { if (valid) {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
this.form.$column.javaField = this.form.${column.javaField}.join(","); this.form.$column.javaField = this.form.${column.javaField}.join(",")
#end #end
#end #end
#if($table.sub) #if($table.sub)
this.form.${subclassName}List = this.${subclassName}List; this.form.${subclassName}List = this.${subclassName}List
#end #end
if (this.form.${pkColumn.javaField} != null) { if (this.form.${pkColumn.javaField} != null) {
update${BusinessName}(this.form).then(response => { update${BusinessName}(this.form).then(response => {
this.#[[$modal]]#.msgSuccess("修改成功"); this.#[[$modal]]#.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
add${BusinessName}(this.form).then(response => { add${BusinessName}(this.form).then(response => {
this.#[[$modal]]#.msgSuccess("新增成功"); this.#[[$modal]]#.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids; const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids
this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() { this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() {
return del${BusinessName}(${pkColumn.javaField}s); return del${BusinessName}(${pkColumn.javaField}s)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.#[[$modal]]#.msgSuccess("删除成功"); this.#[[$modal]]#.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
}, },
#if($table.sub) #if($table.sub)
/** ${subTable.functionName}序号 */ /** ${subTable.functionName}序号 */
row${subClassName}Index({ row, rowIndex }) { row${subClassName}Index({ row, rowIndex }) {
row.index = rowIndex + 1; row.index = rowIndex + 1
}, },
/** ${subTable.functionName}添加按钮操作 */ /** ${subTable.functionName}添加按钮操作 */
handleAdd${subClassName}() { handleAdd${subClassName}() {
let obj = {}; let obj = {}
#foreach($column in $subTable.columns) #foreach($column in $subTable.columns)
#if($column.pk || $column.javaField == ${subTableFkclassName}) #if($column.pk || $column.javaField == ${subTableFkclassName})
#elseif($column.list && "" != $javaField) #elseif($column.list && "" != $javaField)
obj.$column.javaField = ""; obj.$column.javaField = ""
#end #end
#end #end
this.${subclassName}List.push(obj); this.${subclassName}List.push(obj)
}, },
/** ${subTable.functionName}删除按钮操作 */ /** ${subTable.functionName}删除按钮操作 */
handleDelete${subClassName}() { handleDelete${subClassName}() {
if (this.checked${subClassName}.length == 0) { if (this.checked${subClassName}.length == 0) {
this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据"); this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据")
} else { } else {
const ${subclassName}List = this.${subclassName}List; const ${subclassName}List = this.${subclassName}List
const checked${subClassName} = this.checked${subClassName}; const checked${subClassName} = this.checked${subClassName}
this.${subclassName}List = ${subclassName}List.filter(function(item) { this.${subclassName}List = ${subclassName}List.filter(function(item) {
return checked${subClassName}.indexOf(item.index) == -1 return checked${subClassName}.indexOf(item.index) == -1
}); })
} }
}, },
/** 复选框选中数据 */ /** 复选框选中数据 */
@ -598,5 +598,5 @@ export default {
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
} }
} }
}; }
</script> </script>

View File

@ -271,26 +271,26 @@
</template> </template>
<script setup name="${BusinessName}"> <script setup name="${BusinessName}">
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance()
#if(${dicts} != '') #if(${dicts} != '')
#set($dictsNoSymbol=$dicts.replace("'", "")) #set($dictsNoSymbol=$dicts.replace("'", ""))
const { ${dictsNoSymbol} } = proxy.useDict(${dicts}); const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
#end #end
const ${businessName}List = ref([]); const ${businessName}List = ref([])
const ${businessName}Options = ref([]); const ${businessName}Options = ref([])
const open = ref(false); const open = ref(false)
const loading = ref(true); const loading = ref(true)
const showSearch = ref(true); const showSearch = ref(true)
const title = ref(""); const title = ref("")
const isExpandAll = ref(true); const isExpandAll = ref(true)
const refreshTable = ref(true); const refreshTable = ref(true)
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
const daterange${AttrName} = ref([]); const daterange${AttrName} = ref([])
#end #end
#end #end
@ -318,16 +318,16 @@ const data = reactive({
#end #end
#end #end
} }
}); })
const { queryParams, form, rules } = toRefs(data); const { queryParams, form, rules } = toRefs(data)
/** 查询${functionName}列表 */ /** 查询${functionName}列表 */
function getList() { function getList() {
loading.value = true; loading.value = true
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
queryParams.value.params = {}; queryParams.value.params = {}
#break #break
#end #end
#end #end
@ -335,31 +335,31 @@ function getList() {
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
if (null != daterange${AttrName} && '' != daterange${AttrName}) { if (null != daterange${AttrName} && '' != daterange${AttrName}) {
queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]
queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]
} }
#end #end
#end #end
list${BusinessName}(queryParams.value).then(response => { list${BusinessName}(queryParams.value).then(response => {
${businessName}List.value = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}"); ${businessName}List.value = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}")
loading.value = false; loading.value = false
}); })
} }
/** 查询${functionName}下拉树结构 */ /** 查询${functionName}下拉树结构 */
function getTreeselect() { function getTreeselect() {
list${BusinessName}().then(response => { list${BusinessName}().then(response => {
${businessName}Options.value = []; ${businessName}Options.value = []
const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }; const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }
data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}"); data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}")
${businessName}Options.value.push(data); ${businessName}Options.value.push(data)
}); })
} }
// 取消按钮 // 取消按钮
function cancel() { function cancel() {
open.value = false; open.value = false
reset(); reset()
} }
// 表单重置 // 表单重置
@ -372,13 +372,13 @@ function reset() {
$column.javaField: null#if($foreach.count != $columns.size()),#end $column.javaField: null#if($foreach.count != $columns.size()),#end
#end #end
#end #end
}; }
proxy.resetForm("${businessName}Ref"); proxy.resetForm("${businessName}Ref")
} }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
function handleQuery() { function handleQuery() {
getList(); getList()
} }
/** 重置按钮操作 */ /** 重置按钮操作 */
@ -386,52 +386,52 @@ function resetQuery() {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
daterange${AttrName}.value = []; daterange${AttrName}.value = []
#end #end
#end #end
proxy.resetForm("queryRef"); proxy.resetForm("queryRef")
handleQuery(); handleQuery()
} }
/** 新增按钮操作 */ /** 新增按钮操作 */
function handleAdd(row) { function handleAdd(row) {
reset(); reset()
getTreeselect(); getTreeselect()
if (row != null && row.${treeCode}) { if (row != null && row.${treeCode}) {
form.value.${treeParentCode} = row.${treeCode}; form.value.${treeParentCode} = row.${treeCode}
} else { } else {
form.value.${treeParentCode} = 0; form.value.${treeParentCode} = 0
} }
open.value = true; open.value = true
title.value = "添加${functionName}"; title.value = "添加${functionName}"
} }
/** 展开/折叠操作 */ /** 展开/折叠操作 */
function toggleExpandAll() { function toggleExpandAll() {
refreshTable.value = false; refreshTable.value = false
isExpandAll.value = !isExpandAll.value; isExpandAll.value = !isExpandAll.value
nextTick(() => { nextTick(() => {
refreshTable.value = true; refreshTable.value = true
}); })
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
async function handleUpdate(row) { async function handleUpdate(row) {
reset(); reset()
await getTreeselect(); await getTreeselect()
if (row != null) { if (row != null) {
form.value.${treeParentCode} = row.${treeParentCode}; form.value.${treeParentCode} = row.${treeParentCode}
} }
get${BusinessName}(row.${pkColumn.javaField}).then(response => { get${BusinessName}(row.${pkColumn.javaField}).then(response => {
form.value = response.data; form.value = response.data
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.split(","); form.value.$column.javaField = form.value.${column.javaField}.split(",")
#end #end
#end #end
open.value = true; open.value = true
title.value = "修改${functionName}"; title.value = "修改${functionName}"
}); })
} }
/** 提交按钮 */ /** 提交按钮 */
@ -440,35 +440,35 @@ function submitForm() {
if (valid) { if (valid) {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.join(","); form.value.$column.javaField = form.value.${column.javaField}.join(",")
#end #end
#end #end
if (form.value.${pkColumn.javaField} != null) { if (form.value.${pkColumn.javaField} != null) {
update${BusinessName}(form.value).then(response => { update${BusinessName}(form.value).then(response => {
proxy.#[[$modal]]#.msgSuccess("修改成功"); proxy.#[[$modal]]#.msgSuccess("修改成功")
open.value = false; open.value = false
getList(); getList()
}); })
} else { } else {
add${BusinessName}(form.value).then(response => { add${BusinessName}(form.value).then(response => {
proxy.#[[$modal]]#.msgSuccess("新增成功"); proxy.#[[$modal]]#.msgSuccess("新增成功")
open.value = false; open.value = false
getList(); getList()
}); })
} }
} }
}); })
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
function handleDelete(row) { function handleDelete(row) {
proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() { proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
return del${BusinessName}(row.${pkColumn.javaField}); return del${BusinessName}(row.${pkColumn.javaField})
}).then(() => { }).then(() => {
getList(); getList()
proxy.#[[$modal]]#.msgSuccess("删除成功"); proxy.#[[$modal]]#.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
} }
getList(); getList()
</script> </script>

View File

@ -343,33 +343,33 @@
</template> </template>
<script setup name="${BusinessName}"> <script setup name="${BusinessName}">
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance()
#if(${dicts} != '') #if(${dicts} != '')
#set($dictsNoSymbol=$dicts.replace("'", "")) #set($dictsNoSymbol=$dicts.replace("'", ""))
const { ${dictsNoSymbol} } = proxy.useDict(${dicts}); const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
#end #end
const ${businessName}List = ref([]); const ${businessName}List = ref([])
#if($table.sub) #if($table.sub)
const ${subclassName}List = ref([]); const ${subclassName}List = ref([])
#end #end
const open = ref(false); const open = ref(false)
const loading = ref(true); const loading = ref(true)
const showSearch = ref(true); const showSearch = ref(true)
const ids = ref([]); const ids = ref([])
#if($table.sub) #if($table.sub)
const checked${subClassName} = ref([]); const checked${subClassName} = ref([])
#end #end
const single = ref(true); const single = ref(true)
const multiple = ref(true); const multiple = ref(true)
const total = ref(0); const total = ref(0)
const title = ref(""); const title = ref("")
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
const daterange${AttrName} = ref([]); const daterange${AttrName} = ref([])
#end #end
#end #end
@ -399,16 +399,16 @@ const data = reactive({
#end #end
#end #end
} }
}); })
const { queryParams, form, rules } = toRefs(data); const { queryParams, form, rules } = toRefs(data)
/** 查询${functionName}列表 */ /** 查询${functionName}列表 */
function getList() { function getList() {
loading.value = true; loading.value = true
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
queryParams.value.params = {}; queryParams.value.params = {}
#break #break
#end #end
#end #end
@ -416,22 +416,22 @@ function getList() {
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
if (null != daterange${AttrName} && '' != daterange${AttrName}) { if (null != daterange${AttrName} && '' != daterange${AttrName}) {
queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]
queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]
} }
#end #end
#end #end
list${BusinessName}(queryParams.value).then(response => { list${BusinessName}(queryParams.value).then(response => {
${businessName}List.value = response.rows; ${businessName}List.value = response.rows
total.value = response.total; total.value = response.total
loading.value = false; loading.value = false
}); })
} }
// 取消按钮 // 取消按钮
function cancel() { function cancel() {
open.value = false; open.value = false
reset(); reset()
} }
// 表单重置 // 表单重置
@ -444,17 +444,17 @@ function reset() {
$column.javaField: null#if($foreach.count != $columns.size()),#end $column.javaField: null#if($foreach.count != $columns.size()),#end
#end #end
#end #end
}; }
#if($table.sub) #if($table.sub)
${subclassName}List.value = []; ${subclassName}List.value = []
#end #end
proxy.resetForm("${businessName}Ref"); proxy.resetForm("${businessName}Ref")
} }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
function handleQuery() { function handleQuery() {
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1
getList(); getList()
} }
/** 重置按钮操作 */ /** 重置按钮操作 */
@ -462,44 +462,44 @@ function resetQuery() {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
daterange${AttrName}.value = []; daterange${AttrName}.value = []
#end #end
#end #end
proxy.resetForm("queryRef"); proxy.resetForm("queryRef")
handleQuery(); handleQuery()
} }
// 多选框选中数据 // 多选框选中数据
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
ids.value = selection.map(item => item.${pkColumn.javaField}); ids.value = selection.map(item => item.${pkColumn.javaField})
single.value = selection.length != 1; single.value = selection.length != 1
multiple.value = !selection.length; multiple.value = !selection.length
} }
/** 新增按钮操作 */ /** 新增按钮操作 */
function handleAdd() { function handleAdd() {
reset(); reset()
open.value = true; open.value = true
title.value = "添加${functionName}"; title.value = "添加${functionName}"
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
function handleUpdate(row) { function handleUpdate(row) {
reset(); reset()
const _${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value const _${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value
get${BusinessName}(_${pkColumn.javaField}).then(response => { get${BusinessName}(_${pkColumn.javaField}).then(response => {
form.value = response.data; form.value = response.data
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.split(","); form.value.$column.javaField = form.value.${column.javaField}.split(",")
#end #end
#end #end
#if($table.sub) #if($table.sub)
${subclassName}List.value = response.data.${subclassName}List; ${subclassName}List.value = response.data.${subclassName}List
#end #end
open.value = true; open.value = true
title.value = "修改${functionName}"; title.value = "修改${functionName}"
}); })
} }
/** 提交按钮 */ /** 提交按钮 */
@ -508,68 +508,68 @@ function submitForm() {
if (valid) { if (valid) {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.join(","); form.value.$column.javaField = form.value.${column.javaField}.join(",")
#end #end
#end #end
#if($table.sub) #if($table.sub)
form.value.${subclassName}List = ${subclassName}List.value; form.value.${subclassName}List = ${subclassName}List.value
#end #end
if (form.value.${pkColumn.javaField} != null) { if (form.value.${pkColumn.javaField} != null) {
update${BusinessName}(form.value).then(response => { update${BusinessName}(form.value).then(response => {
proxy.#[[$modal]]#.msgSuccess("修改成功"); proxy.#[[$modal]]#.msgSuccess("修改成功")
open.value = false; open.value = false
getList(); getList()
}); })
} else { } else {
add${BusinessName}(form.value).then(response => { add${BusinessName}(form.value).then(response => {
proxy.#[[$modal]]#.msgSuccess("新增成功"); proxy.#[[$modal]]#.msgSuccess("新增成功")
open.value = false; open.value = false
getList(); getList()
}); })
} }
} }
}); })
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
function handleDelete(row) { function handleDelete(row) {
const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value; const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value
proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + _${pkColumn.javaField}s + '"的数据项?').then(function() { proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + _${pkColumn.javaField}s + '"的数据项?').then(function() {
return del${BusinessName}(_${pkColumn.javaField}s); return del${BusinessName}(_${pkColumn.javaField}s)
}).then(() => { }).then(() => {
getList(); getList()
proxy.#[[$modal]]#.msgSuccess("删除成功"); proxy.#[[$modal]]#.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
} }
#if($table.sub) #if($table.sub)
/** ${subTable.functionName}序号 */ /** ${subTable.functionName}序号 */
function row${subClassName}Index({ row, rowIndex }) { function row${subClassName}Index({ row, rowIndex }) {
row.index = rowIndex + 1; row.index = rowIndex + 1
} }
/** ${subTable.functionName}添加按钮操作 */ /** ${subTable.functionName}添加按钮操作 */
function handleAdd${subClassName}() { function handleAdd${subClassName}() {
let obj = {}; let obj = {}
#foreach($column in $subTable.columns) #foreach($column in $subTable.columns)
#if($column.pk || $column.javaField == ${subTableFkclassName}) #if($column.pk || $column.javaField == ${subTableFkclassName})
#elseif($column.list && "" != $javaField) #elseif($column.list && "" != $javaField)
obj.$column.javaField = ""; obj.$column.javaField = ""
#end #end
#end #end
${subclassName}List.value.push(obj); ${subclassName}List.value.push(obj)
} }
/** ${subTable.functionName}删除按钮操作 */ /** ${subTable.functionName}删除按钮操作 */
function handleDelete${subClassName}() { function handleDelete${subClassName}() {
if (checked${subClassName}.value.length == 0) { if (checked${subClassName}.value.length == 0) {
proxy.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据"); proxy.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据")
} else { } else {
const ${subclassName}s = ${subclassName}List.value; const ${subclassName}s = ${subclassName}List.value
const checked${subClassName}s = checked${subClassName}.value; const checked${subClassName}s = checked${subClassName}.value
${subclassName}List.value = ${subclassName}s.filter(function(item) { ${subclassName}List.value = ${subclassName}s.filter(function(item) {
return checked${subClassName}s.indexOf(item.index) == -1 return checked${subClassName}s.indexOf(item.index) == -1
}); })
} }
} }
@ -586,5 +586,5 @@ function handleExport() {
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
} }
getList(); getList()
</script> </script>

View File

@ -6,7 +6,7 @@
</template> </template>
<script> <script>
import ThemePicker from "@/components/ThemePicker"; import ThemePicker from "@/components/ThemePicker"
export default { export default {
name: "App", name: "App",
@ -19,7 +19,7 @@ export default {
} }
} }
} }
}; }
</script> </script>
<style scoped> <style scoped>
#app .theme-picker { #app .theme-picker {

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1746590936918" class="icon" viewBox="0 0 1194 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5378" xmlns:xlink="http://www.w3.org/1999/xlink" width="233.203125" height="200"><path d="M1151.9144 325.11999969V89.12a57.04000031 57.04000031 0 0 0-28.8-49.44 58.15999969 58.15999969 0 0 0-57.76000031 0 57.04000031 57.04000031 0 0 0-28.8 49.44v235.99999969c0.24 84.31999969-33.6 152.56000031-94.08 212.00000062-60.07999969 59.83999969-141.84 80.64-227.04 80.4H225.91440031L388.07439969 457.11999969a56.80000031 56.80000031 0 0 0 12.40000031-62.16 57.76000031 57.76000031 0 0 0-94.00000031-18.63999938L48.8744 631.20000031a56.88 56.88 0 0 0 0 80.79999938l264.96 262.56a58.08 58.08 0 0 0 96.55999969-25.59999938 56.80000031 56.80000031 0 0 0-14.95999969-55.2L232.07439969 731.67999969h483.44000062c116.56000031 0 226.15999969-32.08000031 308.64-113.76 82.15999969-80.80000031 128.23999969-178.15999969 127.83999938-292.87999969" p-id="5379"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1746760911144" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12537" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M395.21211 182.914448c0 62.669318 49.541323 113.472378 110.642936 113.472378 61.093427 0 110.652146-50.80306 110.65214601-113.472378 0-62.685691-49.559742-113.487727-110.65214601-113.487727C444.75241 69.426721 395.21211 120.22978 395.21211 182.914448zM395.21211 523.34693101c0 62.668295 49.541323 113.487727 110.642936 113.48772699 61.093427 0 110.652146-50.820456 110.652146-113.487727 0-62.669318-49.559742-113.472378-110.652146-113.472378C444.75241 409.874553 395.21211 460.67761301 395.21211 523.34693101zM395.21211 841.084529c0 62.686714 49.541323 113.488751 110.642936 113.488751 61.093427 0 110.652146-50.80203599 110.65214601-113.488751 0-62.669318-49.559742-113.471354-110.65214601-113.471354C444.75241 727.614198 395.21211 778.416234 395.21211 841.084529z" p-id="12538"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -25,7 +25,7 @@
z-index: 1001; z-index: 1001;
overflow: hidden; overflow: hidden;
-webkit-box-shadow: 2px 0 6px rgba(0,21,41,.35); -webkit-box-shadow: 2px 0 6px rgba(0,21,41,.35);
box-shadow: 2px 0 6px rgba(0,21,41,.35); box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
// reset element-ui css // reset element-ui css
.horizontal-collapse-transition { .horizontal-collapse-transition {

View File

@ -71,58 +71,58 @@ export default {
methods: { methods: {
// //
radioChange() { radioChange() {
('day rachange'); ('day rachange')
if (this.radioValue !== 2 && this.cron.week !== '?') { if (this.radioValue !== 2 && this.cron.week !== '?') {
this.$emit('update', 'week', '?', 'day') this.$emit('update', 'week', '?', 'day')
} }
switch (this.radioValue) { switch (this.radioValue) {
case 1: case 1:
this.$emit('update', 'day', '*'); this.$emit('update', 'day', '*')
break; break
case 2: case 2:
this.$emit('update', 'day', '?'); this.$emit('update', 'day', '?')
break; break
case 3: case 3:
this.$emit('update', 'day', this.cycleTotal); this.$emit('update', 'day', this.cycleTotal)
break; break
case 4: case 4:
this.$emit('update', 'day', this.averageTotal); this.$emit('update', 'day', this.averageTotal)
break; break
case 5: case 5:
this.$emit('update', 'day', this.workday + 'W'); this.$emit('update', 'day', this.workday + 'W')
break; break
case 6: case 6:
this.$emit('update', 'day', 'L'); this.$emit('update', 'day', 'L')
break; break
case 7: case 7:
this.$emit('update', 'day', this.checkboxString); this.$emit('update', 'day', this.checkboxString)
break; break
} }
('day rachange end'); ('day rachange end')
}, },
// //
cycleChange() { cycleChange() {
if (this.radioValue == '3') { if (this.radioValue == '3') {
this.$emit('update', 'day', this.cycleTotal); this.$emit('update', 'day', this.cycleTotal)
} }
}, },
// //
averageChange() { averageChange() {
if (this.radioValue == '4') { if (this.radioValue == '4') {
this.$emit('update', 'day', this.averageTotal); this.$emit('update', 'day', this.averageTotal)
} }
}, },
// //
workdayChange() { workdayChange() {
if (this.radioValue == '5') { if (this.radioValue == '5') {
this.$emit('update', 'day', this.workdayCheck + 'W'); this.$emit('update', 'day', this.workdayCheck + 'W')
} }
}, },
// checkbox // checkbox
checkboxChange() { checkboxChange() {
if (this.radioValue == '7') { if (this.radioValue == '7') {
this.$emit('update', 'day', this.checkboxString); this.$emit('update', 'day', this.checkboxString)
} }
} }
}, },
@ -138,23 +138,23 @@ export default {
cycleTotal: function () { cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 1, 30) const cycle01 = this.checkNum(this.cycle01, 1, 30)
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31) const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31)
return cycle01 + '-' + cycle02; return cycle01 + '-' + cycle02
}, },
// //
averageTotal: function () { averageTotal: function () {
const average01 = this.checkNum(this.average01, 1, 30) const average01 = this.checkNum(this.average01, 1, 30)
const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0) const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0)
return average01 + '/' + average02; return average01 + '/' + average02
}, },
// //
workdayCheck: function () { workdayCheck: function () {
const workday = this.checkNum(this.workday, 1, 31) const workday = this.checkNum(this.workday, 1, 31)
return workday; return workday
}, },
// checkbox // checkbox
checkboxString: function () { checkboxString: function () {
let str = this.checkboxList.join(); let str = this.checkboxList.join()
return str == '' ? '*' : str; return str == '' ? '*' : str
} }
} }
} }

View File

@ -51,37 +51,43 @@ export default {
methods: { methods: {
// //
radioChange() { radioChange() {
if (this.cron.min === '*') {
this.$emit('update', 'min', '0', 'hour')
}
if (this.cron.second === '*') {
this.$emit('update', 'second', '0', 'hour')
}
switch (this.radioValue) { switch (this.radioValue) {
case 1: case 1:
this.$emit('update', 'hour', '*') this.$emit('update', 'hour', '*')
break; break
case 2: case 2:
this.$emit('update', 'hour', this.cycleTotal); this.$emit('update', 'hour', this.cycleTotal)
break; break
case 3: case 3:
this.$emit('update', 'hour', this.averageTotal); this.$emit('update', 'hour', this.averageTotal)
break; break
case 4: case 4:
this.$emit('update', 'hour', this.checkboxString); this.$emit('update', 'hour', this.checkboxString)
break; break
} }
}, },
// //
cycleChange() { cycleChange() {
if (this.radioValue == '2') { if (this.radioValue == '2') {
this.$emit('update', 'hour', this.cycleTotal); this.$emit('update', 'hour', this.cycleTotal)
} }
}, },
// //
averageChange() { averageChange() {
if (this.radioValue == '3') { if (this.radioValue == '3') {
this.$emit('update', 'hour', this.averageTotal); this.$emit('update', 'hour', this.averageTotal)
} }
}, },
// checkbox // checkbox
checkboxChange() { checkboxChange() {
if (this.radioValue == '4') { if (this.radioValue == '4') {
this.$emit('update', 'hour', this.checkboxString); this.$emit('update', 'hour', this.checkboxString)
} }
} }
}, },
@ -96,18 +102,18 @@ export default {
cycleTotal: function () { cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 0, 22) const cycle01 = this.checkNum(this.cycle01, 0, 22)
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23) const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23)
return cycle01 + '-' + cycle02; return cycle01 + '-' + cycle02
}, },
// //
averageTotal: function () { averageTotal: function () {
const average01 = this.checkNum(this.average01, 0, 22) const average01 = this.checkNum(this.average01, 0, 22)
const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0) const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0)
return average01 + '/' + average02; return average01 + '/' + average02
}, },
// checkbox // checkbox
checkboxString: function () { checkboxString: function () {
let str = this.checkboxList.join(); let str = this.checkboxList.join()
return str == '' ? '*' : str; return str == '' ? '*' : str
} }
} }
} }

View File

@ -113,14 +113,14 @@
</template> </template>
<script> <script>
import CrontabSecond from "./second.vue"; import CrontabSecond from "./second.vue"
import CrontabMin from "./min.vue"; import CrontabMin from "./min.vue"
import CrontabHour from "./hour.vue"; import CrontabHour from "./hour.vue"
import CrontabDay from "./day.vue"; import CrontabDay from "./day.vue"
import CrontabMonth from "./month.vue"; import CrontabMonth from "./month.vue"
import CrontabWeek from "./week.vue"; import CrontabWeek from "./week.vue"
import CrontabYear from "./year.vue"; import CrontabYear from "./year.vue"
import CrontabResult from "./result.vue"; import CrontabResult from "./result.vue"
export default { export default {
data() { data() {
@ -137,19 +137,19 @@ export default {
week: "?", week: "?",
year: "", year: "",
}, },
}; }
}, },
name: "vcrontab", name: "vcrontab",
props: ["expression", "hideComponent"], props: ["expression", "hideComponent"],
methods: { methods: {
shouldHide(key) { shouldHide(key) {
if (this.hideComponent && this.hideComponent.includes(key)) return false; if (this.hideComponent && this.hideComponent.includes(key)) return false
return true; return true
}, },
resolveExp() { resolveExp() {
// //
if (this.expression) { if (this.expression) {
let arr = this.expression.split(" "); let arr = this.expression.split(" ")
if (arr.length >= 6) { if (arr.length >= 6) {
//6 //6
let obj = { let obj = {
@ -160,160 +160,160 @@ export default {
month: arr[4], month: arr[4],
week: arr[5], week: arr[5],
year: arr[6] ? arr[6] : "", year: arr[6] ? arr[6] : "",
}; }
this.crontabValueObj = { this.crontabValueObj = {
...obj, ...obj,
}; }
for (let i in obj) { for (let i in obj) {
if (obj[i]) this.changeRadio(i, obj[i]); if (obj[i]) this.changeRadio(i, obj[i])
} }
} }
} else { } else {
// //
this.clearCron(); this.clearCron()
} }
}, },
// tab // tab
tabCheck(index) { tabCheck(index) {
this.tabActive = index; this.tabActive = index
}, },
// //
updateCrontabValue(name, value, from) { updateCrontabValue(name, value, from) {
"updateCrontabValue", name, value, from; "updateCrontabValue", name, value, from
this.crontabValueObj[name] = value; this.crontabValueObj[name] = value
if (from && from !== name) { if (from && from !== name) {
console.log(`来自组件 ${from} 改变了 ${name} ${value}`); console.log(`来自组件 ${from} 改变了 ${name} ${value}`)
this.changeRadio(name, value); this.changeRadio(name, value)
} }
}, },
// //
changeRadio(name, value) { changeRadio(name, value) {
let arr = ["second", "min", "hour", "month"], let arr = ["second", "min", "hour", "month"],
refName = "cron" + name, refName = "cron" + name,
insValue; insValue
if (!this.$refs[refName]) return; if (!this.$refs[refName]) return
if (arr.includes(name)) { if (arr.includes(name)) {
if (value === "*") { if (value === "*") {
insValue = 1; insValue = 1
} else if (value.indexOf("-") > -1) { } else if (value.indexOf("-") > -1) {
let indexArr = value.split("-"); let indexArr = value.split("-")
isNaN(indexArr[0]) isNaN(indexArr[0])
? (this.$refs[refName].cycle01 = 0) ? (this.$refs[refName].cycle01 = 0)
: (this.$refs[refName].cycle01 = indexArr[0]); : (this.$refs[refName].cycle01 = indexArr[0])
this.$refs[refName].cycle02 = indexArr[1]; this.$refs[refName].cycle02 = indexArr[1]
insValue = 2; insValue = 2
} else if (value.indexOf("/") > -1) { } else if (value.indexOf("/") > -1) {
let indexArr = value.split("/"); let indexArr = value.split("/")
isNaN(indexArr[0]) isNaN(indexArr[0])
? (this.$refs[refName].average01 = 0) ? (this.$refs[refName].average01 = 0)
: (this.$refs[refName].average01 = indexArr[0]); : (this.$refs[refName].average01 = indexArr[0])
this.$refs[refName].average02 = indexArr[1]; this.$refs[refName].average02 = indexArr[1]
insValue = 3; insValue = 3
} else { } else {
insValue = 4; insValue = 4
this.$refs[refName].checkboxList = value.split(","); this.$refs[refName].checkboxList = value.split(",")
} }
} else if (name == "day") { } else if (name == "day") {
if (value === "*") { if (value === "*") {
insValue = 1; insValue = 1
} else if (value == "?") { } else if (value == "?") {
insValue = 2; insValue = 2
} else if (value.indexOf("-") > -1) { } else if (value.indexOf("-") > -1) {
let indexArr = value.split("-"); let indexArr = value.split("-")
isNaN(indexArr[0]) isNaN(indexArr[0])
? (this.$refs[refName].cycle01 = 0) ? (this.$refs[refName].cycle01 = 0)
: (this.$refs[refName].cycle01 = indexArr[0]); : (this.$refs[refName].cycle01 = indexArr[0])
this.$refs[refName].cycle02 = indexArr[1]; this.$refs[refName].cycle02 = indexArr[1]
insValue = 3; insValue = 3
} else if (value.indexOf("/") > -1) { } else if (value.indexOf("/") > -1) {
let indexArr = value.split("/"); let indexArr = value.split("/")
isNaN(indexArr[0]) isNaN(indexArr[0])
? (this.$refs[refName].average01 = 0) ? (this.$refs[refName].average01 = 0)
: (this.$refs[refName].average01 = indexArr[0]); : (this.$refs[refName].average01 = indexArr[0])
this.$refs[refName].average02 = indexArr[1]; this.$refs[refName].average02 = indexArr[1]
insValue = 4; insValue = 4
} else if (value.indexOf("W") > -1) { } else if (value.indexOf("W") > -1) {
let indexArr = value.split("W"); let indexArr = value.split("W")
isNaN(indexArr[0]) isNaN(indexArr[0])
? (this.$refs[refName].workday = 0) ? (this.$refs[refName].workday = 0)
: (this.$refs[refName].workday = indexArr[0]); : (this.$refs[refName].workday = indexArr[0])
insValue = 5; insValue = 5
} else if (value === "L") { } else if (value === "L") {
insValue = 6; insValue = 6
} else { } else {
this.$refs[refName].checkboxList = value.split(","); this.$refs[refName].checkboxList = value.split(",")
insValue = 7; insValue = 7
} }
} else if (name == "week") { } else if (name == "week") {
if (value === "*") { if (value === "*") {
insValue = 1; insValue = 1
} else if (value == "?") { } else if (value == "?") {
insValue = 2; insValue = 2
} else if (value.indexOf("-") > -1) { } else if (value.indexOf("-") > -1) {
let indexArr = value.split("-"); let indexArr = value.split("-")
isNaN(indexArr[0]) isNaN(indexArr[0])
? (this.$refs[refName].cycle01 = 0) ? (this.$refs[refName].cycle01 = 0)
: (this.$refs[refName].cycle01 = indexArr[0]); : (this.$refs[refName].cycle01 = indexArr[0])
this.$refs[refName].cycle02 = indexArr[1]; this.$refs[refName].cycle02 = indexArr[1]
insValue = 3; insValue = 3
} else if (value.indexOf("#") > -1) { } else if (value.indexOf("#") > -1) {
let indexArr = value.split("#"); let indexArr = value.split("#")
isNaN(indexArr[0]) isNaN(indexArr[0])
? (this.$refs[refName].average01 = 1) ? (this.$refs[refName].average01 = 1)
: (this.$refs[refName].average01 = indexArr[0]); : (this.$refs[refName].average01 = indexArr[0])
this.$refs[refName].average02 = indexArr[1]; this.$refs[refName].average02 = indexArr[1]
insValue = 4; insValue = 4
} else if (value.indexOf("L") > -1) { } else if (value.indexOf("L") > -1) {
let indexArr = value.split("L"); let indexArr = value.split("L")
isNaN(indexArr[0]) isNaN(indexArr[0])
? (this.$refs[refName].weekday = 1) ? (this.$refs[refName].weekday = 1)
: (this.$refs[refName].weekday = indexArr[0]); : (this.$refs[refName].weekday = indexArr[0])
insValue = 5; insValue = 5
} else { } else {
this.$refs[refName].checkboxList = value.split(","); this.$refs[refName].checkboxList = value.split(",")
insValue = 6; insValue = 6
} }
} else if (name == "year") { } else if (name == "year") {
if (value == "") { if (value == "") {
insValue = 1; insValue = 1
} else if (value == "*") { } else if (value == "*") {
insValue = 2; insValue = 2
} else if (value.indexOf("-") > -1) { } else if (value.indexOf("-") > -1) {
insValue = 3; insValue = 3
} else if (value.indexOf("/") > -1) { } else if (value.indexOf("/") > -1) {
insValue = 4; insValue = 4
} else { } else {
this.$refs[refName].checkboxList = value.split(","); this.$refs[refName].checkboxList = value.split(",")
insValue = 5; insValue = 5
} }
} }
this.$refs[refName].radioValue = insValue; this.$refs[refName].radioValue = insValue
}, },
// -props // -props
checkNumber(value, minLimit, maxLimit) { checkNumber(value, minLimit, maxLimit) {
// //
value = Math.floor(value); value = Math.floor(value)
if (value < minLimit) { if (value < minLimit) {
value = minLimit; value = minLimit
} else if (value > maxLimit) { } else if (value > maxLimit) {
value = maxLimit; value = maxLimit
} }
return value; return value
}, },
// //
hidePopup() { hidePopup() {
this.$emit("hide"); this.$emit("hide")
}, },
// //
submitFill() { submitFill() {
this.$emit("fill", this.crontabValueString); this.$emit("fill", this.crontabValueString)
this.hidePopup(); this.hidePopup()
}, },
clearCron() { clearCron() {
// //
("准备还原"); ("准备还原")
this.crontabValueObj = { this.crontabValueObj = {
second: "*", second: "*",
min: "*", min: "*",
@ -322,15 +322,15 @@ export default {
month: "*", month: "*",
week: "?", week: "?",
year: "", year: "",
}; }
for (let j in this.crontabValueObj) { for (let j in this.crontabValueObj) {
this.changeRadio(j, this.crontabValueObj[j]); this.changeRadio(j, this.crontabValueObj[j])
} }
}, },
}, },
computed: { computed: {
crontabValueString: function() { crontabValueString: function() {
let obj = this.crontabValueObj; let obj = this.crontabValueObj
let str = let str =
obj.second + obj.second +
" " + " " +
@ -343,8 +343,8 @@ export default {
obj.month + obj.month +
" " + " " +
obj.week + obj.week +
(obj.year == "" ? "" : " " + obj.year); (obj.year == "" ? "" : " " + obj.year)
return str; return str
}, },
}, },
components: { components: {
@ -364,9 +364,9 @@ export default {
}, },
}, },
mounted: function() { mounted: function() {
this.resolveExp(); this.resolveExp()
}, },
}; }
</script> </script>
<style scoped> <style scoped>
.pop_btn { .pop_btn {

View File

@ -54,35 +54,35 @@ export default {
radioChange() { radioChange() {
switch (this.radioValue) { switch (this.radioValue) {
case 1: case 1:
this.$emit('update', 'min', '*', 'min'); this.$emit('update', 'min', '*', 'min')
break; break
case 2: case 2:
this.$emit('update', 'min', this.cycleTotal, 'min'); this.$emit('update', 'min', this.cycleTotal, 'min')
break; break
case 3: case 3:
this.$emit('update', 'min', this.averageTotal, 'min'); this.$emit('update', 'min', this.averageTotal, 'min')
break; break
case 4: case 4:
this.$emit('update', 'min', this.checkboxString, 'min'); this.$emit('update', 'min', this.checkboxString, 'min')
break; break
} }
}, },
// //
cycleChange() { cycleChange() {
if (this.radioValue == '2') { if (this.radioValue == '2') {
this.$emit('update', 'min', this.cycleTotal, 'min'); this.$emit('update', 'min', this.cycleTotal, 'min')
} }
}, },
// //
averageChange() { averageChange() {
if (this.radioValue == '3') { if (this.radioValue == '3') {
this.$emit('update', 'min', this.averageTotal, 'min'); this.$emit('update', 'min', this.averageTotal, 'min')
} }
}, },
// checkbox // checkbox
checkboxChange() { checkboxChange() {
if (this.radioValue == '4') { if (this.radioValue == '4') {
this.$emit('update', 'min', this.checkboxString, 'min'); this.$emit('update', 'min', this.checkboxString, 'min')
} }
}, },
@ -98,18 +98,18 @@ export default {
cycleTotal: function () { cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 0, 58) const cycle01 = this.checkNum(this.cycle01, 0, 58)
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59) const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
return cycle01 + '-' + cycle02; return cycle01 + '-' + cycle02
}, },
// //
averageTotal: function () { averageTotal: function () {
const average01 = this.checkNum(this.average01, 0, 58) const average01 = this.checkNum(this.average01, 0, 58)
const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0) const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
return average01 + '/' + average02; return average01 + '/' + average02
}, },
// checkbox // checkbox
checkboxString: function () { checkboxString: function () {
let str = this.checkboxList.join(); let str = this.checkboxList.join()
return str == '' ? '*' : str; return str == '' ? '*' : str
} }
} }
} }

View File

@ -53,35 +53,35 @@ export default {
radioChange() { radioChange() {
switch (this.radioValue) { switch (this.radioValue) {
case 1: case 1:
this.$emit('update', 'month', '*'); this.$emit('update', 'month', '*')
break; break
case 2: case 2:
this.$emit('update', 'month', this.cycleTotal); this.$emit('update', 'month', this.cycleTotal)
break; break
case 3: case 3:
this.$emit('update', 'month', this.averageTotal); this.$emit('update', 'month', this.averageTotal)
break; break
case 4: case 4:
this.$emit('update', 'month', this.checkboxString); this.$emit('update', 'month', this.checkboxString)
break; break
} }
}, },
// //
cycleChange() { cycleChange() {
if (this.radioValue == '2') { if (this.radioValue == '2') {
this.$emit('update', 'month', this.cycleTotal); this.$emit('update', 'month', this.cycleTotal)
} }
}, },
// //
averageChange() { averageChange() {
if (this.radioValue == '3') { if (this.radioValue == '3') {
this.$emit('update', 'month', this.averageTotal); this.$emit('update', 'month', this.averageTotal)
} }
}, },
// checkbox // checkbox
checkboxChange() { checkboxChange() {
if (this.radioValue == '4') { if (this.radioValue == '4') {
this.$emit('update', 'month', this.checkboxString); this.$emit('update', 'month', this.checkboxString)
} }
} }
}, },
@ -96,18 +96,18 @@ export default {
cycleTotal: function () { cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 1, 11) const cycle01 = this.checkNum(this.cycle01, 1, 11)
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12) const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12)
return cycle01 + '-' + cycle02; return cycle01 + '-' + cycle02
}, },
// //
averageTotal: function () { averageTotal: function () {
const average01 = this.checkNum(this.average01, 1, 11) const average01 = this.checkNum(this.average01, 1, 11)
const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0) const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0)
return average01 + '/' + average02; return average01 + '/' + average02
}, },
// checkbox // checkbox
checkboxString: function () { checkboxString: function () {
let str = this.checkboxList.join(); let str = this.checkboxList.join()
return str == '' ? '*' : str; return str == '' ? '*' : str
} }
} }
} }

View File

@ -27,135 +27,135 @@ export default {
expressionChange() { expressionChange() {
// - // -
this.isShow = false; this.isShow = false
// [0123456] // [0123456]
let ruleArr = this.$options.propsData.ex.split(' '); let ruleArr = this.$options.propsData.ex.split(' ')
// //
let nums = 0; let nums = 0
// //
let resultArr = []; let resultArr = []
// [] // []
let nTime = new Date(); let nTime = new Date()
let nYear = nTime.getFullYear(); let nYear = nTime.getFullYear()
let nMonth = nTime.getMonth() + 1; let nMonth = nTime.getMonth() + 1
let nDay = nTime.getDate(); let nDay = nTime.getDate()
let nHour = nTime.getHours(); let nHour = nTime.getHours()
let nMin = nTime.getMinutes(); let nMin = nTime.getMinutes()
let nSecond = nTime.getSeconds(); let nSecond = nTime.getSeconds()
// 100 // 100
this.getSecondArr(ruleArr[0]); this.getSecondArr(ruleArr[0])
this.getMinArr(ruleArr[1]); this.getMinArr(ruleArr[1])
this.getHourArr(ruleArr[2]); this.getHourArr(ruleArr[2])
this.getDayArr(ruleArr[3]); this.getDayArr(ruleArr[3])
this.getMonthArr(ruleArr[4]); this.getMonthArr(ruleArr[4])
this.getWeekArr(ruleArr[5]); this.getWeekArr(ruleArr[5])
this.getYearArr(ruleArr[6], nYear); this.getYearArr(ruleArr[6], nYear)
// -便使 // -便使
let sDate = this.dateArr[0]; let sDate = this.dateArr[0]
let mDate = this.dateArr[1]; let mDate = this.dateArr[1]
let hDate = this.dateArr[2]; let hDate = this.dateArr[2]
let DDate = this.dateArr[3]; let DDate = this.dateArr[3]
let MDate = this.dateArr[4]; let MDate = this.dateArr[4]
let YDate = this.dateArr[5]; let YDate = this.dateArr[5]
// //
let sIdx = this.getIndex(sDate, nSecond); let sIdx = this.getIndex(sDate, nSecond)
let mIdx = this.getIndex(mDate, nMin); let mIdx = this.getIndex(mDate, nMin)
let hIdx = this.getIndex(hDate, nHour); let hIdx = this.getIndex(hDate, nHour)
let DIdx = this.getIndex(DDate, nDay); let DIdx = this.getIndex(DDate, nDay)
let MIdx = this.getIndex(MDate, nMonth); let MIdx = this.getIndex(MDate, nMonth)
let YIdx = this.getIndex(YDate, nYear); let YIdx = this.getIndex(YDate, nYear)
// () // ()
const resetSecond = function () { const resetSecond = function () {
sIdx = 0; sIdx = 0
nSecond = sDate[sIdx] nSecond = sDate[sIdx]
} }
const resetMin = function () { const resetMin = function () {
mIdx = 0; mIdx = 0
nMin = mDate[mIdx] nMin = mDate[mIdx]
resetSecond(); resetSecond()
} }
const resetHour = function () { const resetHour = function () {
hIdx = 0; hIdx = 0
nHour = hDate[hIdx] nHour = hDate[hIdx]
resetMin(); resetMin()
} }
const resetDay = function () { const resetDay = function () {
DIdx = 0; DIdx = 0
nDay = DDate[DIdx] nDay = DDate[DIdx]
resetHour(); resetHour()
} }
const resetMonth = function () { const resetMonth = function () {
MIdx = 0; MIdx = 0
nMonth = MDate[MIdx] nMonth = MDate[MIdx]
resetDay(); resetDay()
} }
// //
if (nYear !== YDate[YIdx]) { if (nYear !== YDate[YIdx]) {
resetMonth(); resetMonth()
} }
// //
if (nMonth !== MDate[MIdx]) { if (nMonth !== MDate[MIdx]) {
resetDay(); resetDay()
} }
// //
if (nDay !== DDate[DIdx]) { if (nDay !== DDate[DIdx]) {
resetHour(); resetHour()
} }
// //
if (nHour !== hDate[hIdx]) { if (nHour !== hDate[hIdx]) {
resetMin(); resetMin()
} }
// //
if (nMin !== mDate[mIdx]) { if (nMin !== mDate[mIdx]) {
resetSecond(); resetSecond()
} }
// //
goYear: for (let Yi = YIdx; Yi < YDate.length; Yi++) { goYear: for (let Yi = YIdx; Yi < YDate.length; Yi++) {
let YY = YDate[Yi]; let YY = YDate[Yi]
// //
if (nMonth > MDate[MDate.length - 1]) { if (nMonth > MDate[MDate.length - 1]) {
resetMonth(); resetMonth()
continue; continue
} }
// //
goMonth: for (let Mi = MIdx; Mi < MDate.length; Mi++) { goMonth: for (let Mi = MIdx; Mi < MDate.length; Mi++) {
// 便 // 便
let MM = MDate[Mi]; let MM = MDate[Mi];
MM = MM < 10 ? '0' + MM : MM; MM = MM < 10 ? '0' + MM : MM
// //
if (nDay > DDate[DDate.length - 1]) { if (nDay > DDate[DDate.length - 1]) {
resetDay(); resetDay()
if (Mi == MDate.length - 1) { if (Mi == MDate.length - 1) {
resetMonth(); resetMonth()
continue goYear; continue goYear
} }
continue; continue
} }
// //
goDay: for (let Di = DIdx; Di < DDate.length; Di++) { goDay: for (let Di = DIdx; Di < DDate.length; Di++) {
// 便 // 便
let DD = DDate[Di]; let DD = DDate[Di]
let thisDD = DD < 10 ? '0' + DD : DD; let thisDD = DD < 10 ? '0' + DD : DD
// //
if (nHour > hDate[hDate.length - 1]) { if (nHour > hDate[hDate.length - 1]) {
resetHour(); resetHour()
if (Di == DDate.length - 1) { if (Di == DDate.length - 1) {
resetDay(); resetDay()
if (Mi == MDate.length - 1) { if (Mi == MDate.length - 1) {
resetMonth(); resetMonth()
continue goYear; continue goYear
} }
continue goMonth; continue goMonth
} }
continue; continue
} }
// //
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true && this.dayRule !== 'workDay' && this.dayRule !== 'lastWeek' && this.dayRule !== 'lastDay') { if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true && this.dayRule !== 'workDay' && this.dayRule !== 'lastWeek' && this.dayRule !== 'lastDay') {
resetDay(); resetDay()
continue goMonth; continue goMonth
} }
// //
if (this.dayRule == 'lastDay') { if (this.dayRule == 'lastDay') {
@ -163,84 +163,83 @@ export default {
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
DD--; DD--
thisDD = DD < 10 ? '0' + DD : DD
thisDD = DD < 10 ? '0' + DD : DD;
} }
} }
} else if (this.dayRule == 'workDay') { } else if (this.dayRule == 'workDay') {
// 230 // 230
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
DD--; DD--
thisDD = DD < 10 ? '0' + DD : DD; thisDD = DD < 10 ? '0' + DD : DD
} }
} }
// X // X
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week')
// //
if (thisWeek == 1) { if (thisWeek == 1) {
// //
DD++; DD++
thisDD = DD < 10 ? '0' + DD : DD; thisDD = DD < 10 ? '0' + DD : DD
// //
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
DD -= 3; DD -= 3
} }
} else if (thisWeek == 7) { } else if (thisWeek == 7) {
// 61 // 61
if (this.dayRuleSup !== 1) { if (this.dayRuleSup !== 1) {
DD--; DD--
} else { } else {
DD += 2; DD += 2
} }
} }
} else if (this.dayRule == 'weekDay') { } else if (this.dayRule == 'weekDay') {
// //
// //
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week')
// dayRuleSup // dayRuleSup
if (this.dayRuleSup.indexOf(thisWeek) < 0) { if (this.dayRuleSup.indexOf(thisWeek) < 0) {
// //
if (Di == DDate.length - 1) { if (Di == DDate.length - 1) {
resetDay(); resetDay()
if (Mi == MDate.length - 1) { if (Mi == MDate.length - 1) {
resetMonth(); resetMonth()
continue goYear; continue goYear
} }
continue goMonth; continue goMonth
} }
continue; continue
} }
} else if (this.dayRule == 'assWeek') { } else if (this.dayRule == 'assWeek') {
// //
// 1 // 1
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week')
if (this.dayRuleSup[1] >= thisWeek) { if (this.dayRuleSup[1] >= thisWeek) {
DD = (this.dayRuleSup[0] - 1) * 7 + this.dayRuleSup[1] - thisWeek + 1; DD = (this.dayRuleSup[0] - 1) * 7 + this.dayRuleSup[1] - thisWeek + 1
} else { } else {
DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1; DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1
} }
} else if (this.dayRule == 'lastWeek') { } else if (this.dayRule == 'lastWeek') {
// //
// 230 // 230
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
DD--; DD--
thisDD = DD < 10 ? '0' + DD : DD; thisDD = DD < 10 ? '0' + DD : DD
} }
} }
// //
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week')
// //
if (this.dayRuleSup < thisWeek) { if (this.dayRuleSup < thisWeek) {
DD -= thisWeek - this.dayRuleSup; DD -= thisWeek - this.dayRuleSup
} else if (this.dayRuleSup > thisWeek) { } else if (this.dayRuleSup > thisWeek) {
DD -= 7 - (this.dayRuleSup - thisWeek) DD -= 7 - (this.dayRuleSup - thisWeek)
} }
} }
// 1005 // 1005
DD = DD < 10 ? '0' + DD : DD; DD = DD < 10 ? '0' + DD : DD
// //
goHour: for (let hi = hIdx; hi < hDate.length; hi++) { goHour: for (let hi = hIdx; hi < hDate.length; hi++) {
@ -248,76 +247,76 @@ export default {
// //
if (nMin > mDate[mDate.length - 1]) { if (nMin > mDate[mDate.length - 1]) {
resetMin(); resetMin()
if (hi == hDate.length - 1) { if (hi == hDate.length - 1) {
resetHour(); resetHour()
if (Di == DDate.length - 1) { if (Di == DDate.length - 1) {
resetDay(); resetDay()
if (Mi == MDate.length - 1) { if (Mi == MDate.length - 1) {
resetMonth(); resetMonth()
continue goYear; continue goYear
} }
continue goMonth; continue goMonth
} }
continue goDay; continue goDay
} }
continue; continue
} }
// "" // ""
goMin: for (let mi = mIdx; mi < mDate.length; mi++) { goMin: for (let mi = mIdx; mi < mDate.length; mi++) {
let mm = mDate[mi] < 10 ? '0' + mDate[mi] : mDate[mi]; let mm = mDate[mi] < 10 ? '0' + mDate[mi] : mDate[mi]
// //
if (nSecond > sDate[sDate.length - 1]) { if (nSecond > sDate[sDate.length - 1]) {
resetSecond(); resetSecond()
if (mi == mDate.length - 1) { if (mi == mDate.length - 1) {
resetMin(); resetMin()
if (hi == hDate.length - 1) { if (hi == hDate.length - 1) {
resetHour(); resetHour()
if (Di == DDate.length - 1) { if (Di == DDate.length - 1) {
resetDay(); resetDay()
if (Mi == MDate.length - 1) { if (Mi == MDate.length - 1) {
resetMonth(); resetMonth()
continue goYear; continue goYear
} }
continue goMonth; continue goMonth
} }
continue goDay; continue goDay
} }
continue goHour; continue goHour
} }
continue; continue
} }
// "" // ""
goSecond: for (let si = sIdx; si <= sDate.length - 1; si++) { goSecond: for (let si = sIdx; si <= sDate.length - 1; si++) {
let ss = sDate[si] < 10 ? '0' + sDate[si] : sDate[si]; let ss = sDate[si] < 10 ? '0' + sDate[si] : sDate[si]
// //
if (MM !== '00' && DD !== '00') { if (MM !== '00' && DD !== '00') {
resultArr.push(YY + '-' + MM + '-' + DD + ' ' + hh + ':' + mm + ':' + ss) resultArr.push(YY + '-' + MM + '-' + DD + ' ' + hh + ':' + mm + ':' + ss)
nums++; nums++
} }
// 退 // 退
if (nums == 5) break goYear; if (nums == 5) break goYear
// //
if (si == sDate.length - 1) { if (si == sDate.length - 1) {
resetSecond(); resetSecond()
if (mi == mDate.length - 1) { if (mi == mDate.length - 1) {
resetMin(); resetMin()
if (hi == hDate.length - 1) { if (hi == hDate.length - 1) {
resetHour(); resetHour()
if (Di == DDate.length - 1) { if (Di == DDate.length - 1) {
resetDay(); resetDay()
if (Mi == MDate.length - 1) { if (Mi == MDate.length - 1) {
resetMonth(); resetMonth()
continue goYear; continue goYear
} }
continue goMonth; continue goMonth
} }
continue goDay; continue goDay
} }
continue goHour; continue goHour
} }
continue goMin; continue goMin
} }
} //goSecond } //goSecond
} //goMin } //goMin
@ -327,33 +326,33 @@ export default {
} }
// 100 // 100
if (resultArr.length == 0) { if (resultArr.length == 0) {
this.resultList = ['没有达到条件的结果!']; this.resultList = ['没有达到条件的结果!']
} else { } else {
this.resultList = resultArr; this.resultList = resultArr
if (resultArr.length !== 5) { if (resultArr.length !== 5) {
this.resultList.push('最近100年内只有上面' + resultArr.length + '条结果!') this.resultList.push('最近100年内只有上面' + resultArr.length + '条结果!')
} }
} }
// - // -
this.isShow = true; this.isShow = true
}, },
// //
getIndex(arr, value) { getIndex(arr, value) {
if (value <= arr[0] || value > arr[arr.length - 1]) { if (value <= arr[0] || value > arr[arr.length - 1]) {
return 0; return 0
} else { } else {
for (let i = 0; i < arr.length - 1; i++) { for (let i = 0; i < arr.length - 1; i++) {
if (value > arr[i] && value <= arr[i + 1]) { if (value > arr[i] && value <= arr[i + 1]) {
return i + 1; return i + 1
} }
} }
} }
}, },
// "" // ""
getYearArr(rule, year) { getYearArr(rule, year) {
this.dateArr[5] = this.getOrderArr(year, year + 100); this.dateArr[5] = this.getOrderArr(year, year + 100)
if (rule !== undefined) { if (rule !== undefined) {
if (rule.indexOf('-') >= 0) { if (rule.indexOf('-') >= 0) {
this.dateArr[5] = this.getCycleArr(rule, year + 100, false) this.dateArr[5] = this.getCycleArr(rule, year + 100, false)
@ -366,7 +365,7 @@ export default {
}, },
// "" // ""
getMonthArr(rule) { getMonthArr(rule) {
this.dateArr[4] = this.getOrderArr(1, 12); this.dateArr[4] = this.getOrderArr(1, 12)
if (rule.indexOf('-') >= 0) { if (rule.indexOf('-') >= 0) {
this.dateArr[4] = this.getCycleArr(rule, 12, false) this.dateArr[4] = this.getCycleArr(rule, 12, false)
} else if (rule.indexOf('/') >= 0) { } else if (rule.indexOf('/') >= 0) {
@ -380,58 +379,58 @@ export default {
// //
if (this.dayRule == '' && this.dayRuleSup == '') { if (this.dayRule == '' && this.dayRuleSup == '') {
if (rule.indexOf('-') >= 0) { if (rule.indexOf('-') >= 0) {
this.dayRule = 'weekDay'; this.dayRule = 'weekDay'
this.dayRuleSup = this.getCycleArr(rule, 7, false) this.dayRuleSup = this.getCycleArr(rule, 7, false)
} else if (rule.indexOf('#') >= 0) { } else if (rule.indexOf('#') >= 0) {
this.dayRule = 'assWeek'; this.dayRule = 'assWeek'
let matchRule = rule.match(/[0-9]{1}/g); let matchRule = rule.match(/[0-9]{1}/g)
this.dayRuleSup = [Number(matchRule[1]), Number(matchRule[0])]; this.dayRuleSup = [Number(matchRule[1]), Number(matchRule[0])]
this.dateArr[3] = [1]; this.dateArr[3] = [1]
if (this.dayRuleSup[1] == 7) { if (this.dayRuleSup[1] == 7) {
this.dayRuleSup[1] = 0; this.dayRuleSup[1] = 0
} }
} else if (rule.indexOf('L') >= 0) { } else if (rule.indexOf('L') >= 0) {
this.dayRule = 'lastWeek'; this.dayRule = 'lastWeek'
this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0]); this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0])
this.dateArr[3] = [31]; this.dateArr[3] = [31]
if (this.dayRuleSup == 7) { if (this.dayRuleSup == 7) {
this.dayRuleSup = 0; this.dayRuleSup = 0
} }
} else if (rule !== '*' && rule !== '?') { } else if (rule !== '*' && rule !== '?') {
this.dayRule = 'weekDay'; this.dayRule = 'weekDay'
this.dayRuleSup = this.getAssignArr(rule) this.dayRuleSup = this.getAssignArr(rule)
} }
} }
}, },
// ""- // ""-
getDayArr(rule) { getDayArr(rule) {
this.dateArr[3] = this.getOrderArr(1, 31); this.dateArr[3] = this.getOrderArr(1, 31)
this.dayRule = ''; this.dayRule = ''
this.dayRuleSup = ''; this.dayRuleSup = ''
if (rule.indexOf('-') >= 0) { if (rule.indexOf('-') >= 0) {
this.dateArr[3] = this.getCycleArr(rule, 31, false) this.dateArr[3] = this.getCycleArr(rule, 31, false)
this.dayRuleSup = 'null'; this.dayRuleSup = 'null'
} else if (rule.indexOf('/') >= 0) { } else if (rule.indexOf('/') >= 0) {
this.dateArr[3] = this.getAverageArr(rule, 31) this.dateArr[3] = this.getAverageArr(rule, 31)
this.dayRuleSup = 'null'; this.dayRuleSup = 'null'
} else if (rule.indexOf('W') >= 0) { } else if (rule.indexOf('W') >= 0) {
this.dayRule = 'workDay'; this.dayRule = 'workDay'
this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0]); this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0])
this.dateArr[3] = [this.dayRuleSup]; this.dateArr[3] = [this.dayRuleSup]
} else if (rule.indexOf('L') >= 0) { } else if (rule.indexOf('L') >= 0) {
this.dayRule = 'lastDay'; this.dayRule = 'lastDay'
this.dayRuleSup = 'null'; this.dayRuleSup = 'null'
this.dateArr[3] = [31]; this.dateArr[3] = [31]
} else if (rule !== '*' && rule !== '?') { } else if (rule !== '*' && rule !== '?') {
this.dateArr[3] = this.getAssignArr(rule) this.dateArr[3] = this.getAssignArr(rule)
this.dayRuleSup = 'null'; this.dayRuleSup = 'null'
} else if (rule == '*') { } else if (rule == '*') {
this.dayRuleSup = 'null'; this.dayRuleSup = 'null'
} }
}, },
// "" // ""
getHourArr(rule) { getHourArr(rule) {
this.dateArr[2] = this.getOrderArr(0, 23); this.dateArr[2] = this.getOrderArr(0, 23)
if (rule.indexOf('-') >= 0) { if (rule.indexOf('-') >= 0) {
this.dateArr[2] = this.getCycleArr(rule, 24, true) this.dateArr[2] = this.getCycleArr(rule, 24, true)
} else if (rule.indexOf('/') >= 0) { } else if (rule.indexOf('/') >= 0) {
@ -442,7 +441,7 @@ export default {
}, },
// "" // ""
getMinArr(rule) { getMinArr(rule) {
this.dateArr[1] = this.getOrderArr(0, 59); this.dateArr[1] = this.getOrderArr(0, 59)
if (rule.indexOf('-') >= 0) { if (rule.indexOf('-') >= 0) {
this.dateArr[1] = this.getCycleArr(rule, 60, true) this.dateArr[1] = this.getCycleArr(rule, 60, true)
} else if (rule.indexOf('/') >= 0) { } else if (rule.indexOf('/') >= 0) {
@ -453,7 +452,7 @@ export default {
}, },
// "" // ""
getSecondArr(rule) { getSecondArr(rule) {
this.dateArr[0] = this.getOrderArr(0, 59); this.dateArr[0] = this.getOrderArr(0, 59)
if (rule.indexOf('-') >= 0) { if (rule.indexOf('-') >= 0) {
this.dateArr[0] = this.getCycleArr(rule, 60, true) this.dateArr[0] = this.getCycleArr(rule, 60, true)
} else if (rule.indexOf('/') >= 0) { } else if (rule.indexOf('/') >= 0) {
@ -464,86 +463,86 @@ export default {
}, },
// min-max // min-max
getOrderArr(min, max) { getOrderArr(min, max) {
let arr = []; let arr = []
for (let i = min; i <= max; i++) { for (let i = min; i <= max; i++) {
arr.push(i); arr.push(i)
} }
return arr; return arr
}, },
// //
getAssignArr(rule) { getAssignArr(rule) {
let arr = []; let arr = []
let assiginArr = rule.split(','); let assiginArr = rule.split(',')
for (let i = 0; i < assiginArr.length; i++) { for (let i = 0; i < assiginArr.length; i++) {
arr[i] = Number(assiginArr[i]) arr[i] = Number(assiginArr[i])
} }
arr.sort(this.compare) arr.sort(this.compare)
return arr; return arr
}, },
// //
getAverageArr(rule, limit) { getAverageArr(rule, limit) {
let arr = []; let arr = []
let agArr = rule.split('/'); let agArr = rule.split('/')
let min = Number(agArr[0]); let min = Number(agArr[0])
let step = Number(agArr[1]); let step = Number(agArr[1])
while (min <= limit) { while (min <= limit) {
arr.push(min); arr.push(min)
min += step; min += step
} }
return arr; return arr
}, },
// //
getCycleArr(rule, limit, status) { getCycleArr(rule, limit, status) {
// status--01 // status--01
let arr = []; let arr = []
let cycleArr = rule.split('-'); let cycleArr = rule.split('-')
let min = Number(cycleArr[0]); let min = Number(cycleArr[0])
let max = Number(cycleArr[1]); let max = Number(cycleArr[1])
if (min > max) { if (min > max) {
max += limit; max += limit
} }
for (let i = min; i <= max; i++) { for (let i = min; i <= max; i++) {
let add = 0; let add = 0
if (status == false && i % limit == 0) { if (status == false && i % limit == 0) {
add = limit; add = limit
} }
arr.push(Math.round(i % limit + add)) arr.push(Math.round(i % limit + add))
} }
arr.sort(this.compare) arr.sort(this.compare)
return arr; return arr
}, },
// Array.sort // Array.sort
compare(value1, value2) { compare(value1, value2) {
if (value2 - value1 > 0) { if (value2 - value1 > 0) {
return -1; return -1
} else { } else {
return 1; return 1
} }
}, },
// 2017-9-19 18:04:33 // 2017-9-19 18:04:33
formatDate(value, type) { formatDate(value, type) {
// //
let time = typeof value == 'number' ? new Date(value) : value; let time = typeof value == 'number' ? new Date(value) : value
let Y = time.getFullYear(); let Y = time.getFullYear()
let M = time.getMonth() + 1; let M = time.getMonth() + 1
let D = time.getDate(); let D = time.getDate()
let h = time.getHours(); let h = time.getHours()
let m = time.getMinutes(); let m = time.getMinutes()
let s = time.getSeconds(); let s = time.getSeconds()
let week = time.getDay(); let week = time.getDay()
// type // type
if (type == undefined) { if (type == undefined) {
return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s); return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s)
} else if (type == 'week') { } else if (type == 'week') {
// quartz 1 // quartz 1
return week + 1; return week + 1
} }
}, },
// //
checkDate(value) { checkDate(value) {
let time = new Date(value); let time = new Date(value)
let format = this.formatDate(time) let format = this.formatDate(time)
return value === format; return value === format
} }
}, },
watch: { watch: {
@ -552,7 +551,7 @@ export default {
props: ['ex'], props: ['ex'],
mounted: function () { mounted: function () {
// //
this.expressionChange(); this.expressionChange()
} }
} }

View File

@ -53,35 +53,35 @@ export default {
radioChange() { radioChange() {
switch (this.radioValue) { switch (this.radioValue) {
case 1: case 1:
this.$emit('update', 'second', '*', 'second'); this.$emit('update', 'second', '*', 'second')
break; break
case 2: case 2:
this.$emit('update', 'second', this.cycleTotal); this.$emit('update', 'second', this.cycleTotal)
break; break
case 3: case 3:
this.$emit('update', 'second', this.averageTotal); this.$emit('update', 'second', this.averageTotal)
break; break
case 4: case 4:
this.$emit('update', 'second', this.checkboxString); this.$emit('update', 'second', this.checkboxString)
break; break
} }
}, },
// //
cycleChange() { cycleChange() {
if (this.radioValue == '2') { if (this.radioValue == '2') {
this.$emit('update', 'second', this.cycleTotal); this.$emit('update', 'second', this.cycleTotal)
} }
}, },
// //
averageChange() { averageChange() {
if (this.radioValue == '3') { if (this.radioValue == '3') {
this.$emit('update', 'second', this.averageTotal); this.$emit('update', 'second', this.averageTotal)
} }
}, },
// checkbox // checkbox
checkboxChange() { checkboxChange() {
if (this.radioValue == '4') { if (this.radioValue == '4') {
this.$emit('update', 'second', this.checkboxString); this.$emit('update', 'second', this.checkboxString)
} }
} }
}, },
@ -99,18 +99,18 @@ export default {
cycleTotal: function () { cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 0, 58) const cycle01 = this.checkNum(this.cycle01, 0, 58)
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59) const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
return cycle01 + '-' + cycle02; return cycle01 + '-' + cycle02
}, },
// //
averageTotal: function () { averageTotal: function () {
const average01 = this.checkNum(this.average01, 0, 58) const average01 = this.checkNum(this.average01, 0, 58)
const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0) const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
return average01 + '/' + average02; return average01 + '/' + average02
}, },
// checkbox // checkbox
checkboxString: function () { checkboxString: function () {
let str = this.checkboxList.join(); let str = this.checkboxList.join()
return str == '' ? '*' : str; return str == '' ? '*' : str
} }
} }
} }

View File

@ -118,52 +118,52 @@ export default {
// //
radioChange() { radioChange() {
if (this.radioValue !== 2 && this.cron.day !== '?') { if (this.radioValue !== 2 && this.cron.day !== '?') {
this.$emit('update', 'day', '?', 'week'); this.$emit('update', 'day', '?', 'week')
} }
switch (this.radioValue) { switch (this.radioValue) {
case 1: case 1:
this.$emit('update', 'week', '*'); this.$emit('update', 'week', '*')
break; break
case 2: case 2:
this.$emit('update', 'week', '?'); this.$emit('update', 'week', '?')
break; break
case 3: case 3:
this.$emit('update', 'week', this.cycleTotal); this.$emit('update', 'week', this.cycleTotal)
break; break
case 4: case 4:
this.$emit('update', 'week', this.averageTotal); this.$emit('update', 'week', this.averageTotal)
break; break
case 5: case 5:
this.$emit('update', 'week', this.weekdayCheck + 'L'); this.$emit('update', 'week', this.weekdayCheck + 'L')
break; break
case 6: case 6:
this.$emit('update', 'week', this.checkboxString); this.$emit('update', 'week', this.checkboxString)
break; break
} }
}, },
// //
cycleChange() { cycleChange() {
if (this.radioValue == '3') { if (this.radioValue == '3') {
this.$emit('update', 'week', this.cycleTotal); this.$emit('update', 'week', this.cycleTotal)
} }
}, },
// //
averageChange() { averageChange() {
if (this.radioValue == '4') { if (this.radioValue == '4') {
this.$emit('update', 'week', this.averageTotal); this.$emit('update', 'week', this.averageTotal)
} }
}, },
// //
weekdayChange() { weekdayChange() {
if (this.radioValue == '5') { if (this.radioValue == '5') {
this.$emit('update', 'week', this.weekday + 'L'); this.$emit('update', 'week', this.weekday + 'L')
} }
}, },
// checkbox // checkbox
checkboxChange() { checkboxChange() {
if (this.radioValue == '6') { if (this.radioValue == '6') {
this.$emit('update', 'week', this.checkboxString); this.$emit('update', 'week', this.checkboxString)
} }
}, },
}, },
@ -179,23 +179,23 @@ export default {
cycleTotal: function () { cycleTotal: function () {
this.cycle01 = this.checkNum(this.cycle01, 1, 7) this.cycle01 = this.checkNum(this.cycle01, 1, 7)
this.cycle02 = this.checkNum(this.cycle02, 1, 7) this.cycle02 = this.checkNum(this.cycle02, 1, 7)
return this.cycle01 + '-' + this.cycle02; return this.cycle01 + '-' + this.cycle02
}, },
// //
averageTotal: function () { averageTotal: function () {
this.average01 = this.checkNum(this.average01, 1, 4) this.average01 = this.checkNum(this.average01, 1, 4)
this.average02 = this.checkNum(this.average02, 1, 7) this.average02 = this.checkNum(this.average02, 1, 7)
return this.average02 + '#' + this.average01; return this.average02 + '#' + this.average01
}, },
// //
weekdayCheck: function () { weekdayCheck: function () {
this.weekday = this.checkNum(this.weekday, 1, 7) this.weekday = this.checkNum(this.weekday, 1, 7)
return this.weekday; return this.weekday
}, },
// checkbox // checkbox
checkboxString: function () { checkboxString: function () {
let str = this.checkboxList.join(); let str = this.checkboxList.join()
return str == '' ? '*' : str; return str == '' ? '*' : str
} }
} }
} }

View File

@ -61,38 +61,38 @@ export default {
radioChange() { radioChange() {
switch (this.radioValue) { switch (this.radioValue) {
case 1: case 1:
this.$emit('update', 'year', ''); this.$emit('update', 'year', '')
break; break
case 2: case 2:
this.$emit('update', 'year', '*'); this.$emit('update', 'year', '*')
break; break
case 3: case 3:
this.$emit('update', 'year', this.cycleTotal); this.$emit('update', 'year', this.cycleTotal)
break; break
case 4: case 4:
this.$emit('update', 'year', this.averageTotal); this.$emit('update', 'year', this.averageTotal)
break; break
case 5: case 5:
this.$emit('update', 'year', this.checkboxString); this.$emit('update', 'year', this.checkboxString)
break; break
} }
}, },
// //
cycleChange() { cycleChange() {
if (this.radioValue == '3') { if (this.radioValue == '3') {
this.$emit('update', 'year', this.cycleTotal); this.$emit('update', 'year', this.cycleTotal)
} }
}, },
// //
averageChange() { averageChange() {
if (this.radioValue == '4') { if (this.radioValue == '4') {
this.$emit('update', 'year', this.averageTotal); this.$emit('update', 'year', this.averageTotal)
} }
}, },
// checkbox // checkbox
checkboxChange() { checkboxChange() {
if (this.radioValue == '5') { if (this.radioValue == '5') {
this.$emit('update', 'year', this.checkboxString); this.$emit('update', 'year', this.checkboxString)
} }
} }
}, },
@ -107,23 +107,23 @@ export default {
cycleTotal: function () { cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098) const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098)
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099) const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099)
return cycle01 + '-' + cycle02; return cycle01 + '-' + cycle02
}, },
// //
averageTotal: function () { averageTotal: function () {
const average01 = this.checkNum(this.average01, this.fullYear, 2098) const average01 = this.checkNum(this.average01, this.fullYear, 2098)
const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear) const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear)
return average01 + '/' + average02; return average01 + '/' + average02
}, },
// checkbox // checkbox
checkboxString: function () { checkboxString: function () {
let str = this.checkboxList.join(); let str = this.checkboxList.join()
return str; return str
} }
}, },
mounted: function () { mounted: function () {
// //
this.fullYear = Number(new Date().getFullYear()); this.fullYear = Number(new Date().getFullYear())
this.cycle01 = this.fullYear this.cycle01 = this.fullYear
this.average01 = this.fullYear this.average01 = this.fullYear
} }

View File

@ -74,13 +74,13 @@ export default {
}, },
filters: { filters: {
handleArray(array) { handleArray(array) {
if (array.length === 0) return ''; if (array.length === 0) return ''
return array.reduce((pre, cur) => { return array.reduce((pre, cur) => {
return pre + ' ' + cur; return pre + ' ' + cur
}) })
}, },
} }
}; }
</script> </script>
<style scoped> <style scoped>
.el-tag + .el-tag { .el-tag + .el-tag {

View File

@ -18,11 +18,12 @@
</template> </template>
<script> <script>
import Quill from "quill"; import axios from "axios"
import "quill/dist/quill.core.css"; import Quill from "quill"
import "quill/dist/quill.snow.css"; import "quill/dist/quill.core.css"
import "quill/dist/quill.bubble.css"; import "quill/dist/quill.snow.css"
import { getToken } from "@/utils/auth"; import "quill/dist/quill.bubble.css"
import { getToken } from "@/utils/auth"
export default { export default {
name: "Editor", name: "Editor",
@ -88,27 +89,27 @@ export default {
placeholder: "请输入内容", placeholder: "请输入内容",
readOnly: this.readOnly, readOnly: this.readOnly,
}, },
}; }
}, },
computed: { computed: {
styles() { styles() {
let style = {}; let style = {}
if (this.minHeight) { if (this.minHeight) {
style.minHeight = `${this.minHeight}px`; style.minHeight = `${this.minHeight}px`
} }
if (this.height) { if (this.height) {
style.height = `${this.height}px`; style.height = `${this.height}px`
} }
return style; return style
}, }
}, },
watch: { watch: {
value: { value: {
handler(val) { handler(val) {
if (val !== this.currentValue) { if (val !== this.currentValue) {
this.currentValue = val === null ? "" : val; this.currentValue = val === null ? "" : val
if (this.Quill) { if (this.Quill) {
this.Quill.clipboard.dangerouslyPasteHTML(this.currentValue); this.Quill.clipboard.dangerouslyPasteHTML(this.currentValue)
} }
} }
}, },
@ -116,84 +117,106 @@ export default {
}, },
}, },
mounted() { mounted() {
this.init(); this.init()
}, },
beforeDestroy() { beforeDestroy() {
this.Quill = null; this.Quill = null
}, },
methods: { methods: {
init() { init() {
const editor = this.$refs.editor; const editor = this.$refs.editor
this.Quill = new Quill(editor, this.options); this.Quill = new Quill(editor, this.options)
// //
if (this.type == 'url') { if (this.type == 'url') {
let toolbar = this.Quill.getModule("toolbar"); let toolbar = this.Quill.getModule("toolbar")
toolbar.addHandler("image", (value) => { toolbar.addHandler("image", (value) => {
if (value) { if (value) {
this.$refs.upload.$children[0].$refs.input.click(); this.$refs.upload.$children[0].$refs.input.click()
} else { } else {
this.quill.format("image", false); this.quill.format("image", false)
} }
}); })
this.Quill.root.addEventListener('paste', this.handlePasteCapture, true)
} }
this.Quill.clipboard.dangerouslyPasteHTML(this.currentValue); this.Quill.clipboard.dangerouslyPasteHTML(this.currentValue)
this.Quill.on("text-change", (delta, oldDelta, source) => { this.Quill.on("text-change", (delta, oldDelta, source) => {
const html = this.$refs.editor.children[0].innerHTML; const html = this.$refs.editor.children[0].innerHTML
const text = this.Quill.getText(); const text = this.Quill.getText()
const quill = this.Quill; const quill = this.Quill
this.currentValue = html; this.currentValue = html
this.$emit("input", html); this.$emit("input", html)
this.$emit("on-change", { html, text, quill }); this.$emit("on-change", { html, text, quill })
}); })
this.Quill.on("text-change", (delta, oldDelta, source) => { this.Quill.on("text-change", (delta, oldDelta, source) => {
this.$emit("on-text-change", delta, oldDelta, source); this.$emit("on-text-change", delta, oldDelta, source)
}); })
this.Quill.on("selection-change", (range, oldRange, source) => { this.Quill.on("selection-change", (range, oldRange, source) => {
this.$emit("on-selection-change", range, oldRange, source); this.$emit("on-selection-change", range, oldRange, source)
}); })
this.Quill.on("editor-change", (eventName, ...args) => { this.Quill.on("editor-change", (eventName, ...args) => {
this.$emit("on-editor-change", eventName, ...args); this.$emit("on-editor-change", eventName, ...args)
}); })
}, },
// //
handleBeforeUpload(file) { handleBeforeUpload(file) {
const type = ["image/jpeg", "image/jpg", "image/png", "image/svg"]; const type = ["image/jpeg", "image/jpg", "image/png", "image/svg"]
const isJPG = type.includes(file.type); const isJPG = type.includes(file.type)
// //
if (!isJPG) { if (!isJPG) {
this.$message.error(`图片格式错误!`); this.$message.error(`图片格式错误!`)
return false; return false
} }
// //
if (this.fileSize) { if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize; const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) { if (!isLt) {
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`); this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`)
return false; return false
} }
} }
return true; return true
}, },
handleUploadSuccess(res, file) { handleUploadSuccess(res, file) {
// //
if (res.code == 200) { if (res.code == 200) {
// //
let quill = this.Quill; let quill = this.Quill
// //
let length = quill.getSelection().index; let length = quill.getSelection().index
// res.url // res.url
quill.insertEmbed(length, "image", res.data.url); quill.insertEmbed(length, "image", res.data.url)
// //
quill.setSelection(length + 1); quill.setSelection(length + 1)
} else { } else {
this.$message.error("图片插入失败"); this.$message.error("图片插入失败")
} }
}, },
handleUploadError() { handleUploadError() {
this.$message.error("图片插入失败"); this.$message.error("图片插入失败")
}, },
}, //
}; handlePasteCapture(e) {
const clipboard = e.clipboardData || window.clipboardData
if (clipboard && clipboard.items) {
for (let i = 0; i < clipboard.items.length; i++) {
const item = clipboard.items[i]
if (item.type.indexOf('image') !== -1) {
e.preventDefault()
const file = item.getAsFile()
this.insertImage(file)
}
}
}
},
insertImage(file) {
const formData = new FormData()
formData.append("file", file)
axios.post(this.uploadUrl, formData, { headers: { "Content-Type": "multipart/form-data", Authorization: this.headers.Authorization } }).then(res => {
this.handleUploadSuccess(res.data)
})
}
}
}
</script> </script>
<style> <style>

View File

@ -5,6 +5,7 @@
:action="uploadFileUrl" :action="uploadFileUrl"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
:file-list="fileList" :file-list="fileList"
:data="data"
:limit="limit" :limit="limit"
:on-error="handleUploadError" :on-error="handleUploadError"
:on-exceed="handleExceed" :on-exceed="handleExceed"
@ -27,7 +28,7 @@
</el-upload> </el-upload>
<!-- 文件列表 --> <!-- 文件列表 -->
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul"> <transition-group ref="uploadFileList" class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList"> <li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
<el-link :href="file.url" :underline="false" target="_blank"> <el-link :href="file.url" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span> <span class="el-icon-document"> {{ getFileName(file.name) }} </span>
@ -41,13 +42,23 @@
</template> </template>
<script> <script>
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth"
import Sortable from 'sortablejs'
export default { export default {
name: "FileUpload", name: "FileUpload",
props: { props: {
// //
value: [String, Object, Array], value: [String, Object, Array],
//
action: {
type: String,
default: "/file/upload"
},
//
data: {
type: Object
},
// //
limit: { limit: {
type: Number, type: Number,
@ -72,37 +83,57 @@ export default {
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false
},
//
drag: {
type: Boolean,
default: true
} }
}, },
data() { data() {
return { return {
number: 0, number: 0,
uploadList: [], uploadList: [],
uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload", // uploadFileUrl: process.env.VUE_APP_BASE_API + this.action, //
headers: { headers: {
Authorization: "Bearer " + getToken(), Authorization: "Bearer " + getToken(),
}, },
fileList: [], fileList: []
}; }
},
mounted() {
if (this.drag && !this.disabled) {
this.$nextTick(() => {
const element = this.$refs.uploadFileList?.$el || this.$refs.uploadFileList
Sortable.create(element, {
ghostClass: 'file-upload-darg',
onEnd: (evt) => {
const movedItem = this.fileList.splice(evt.oldIndex, 1)[0]
this.fileList.splice(evt.newIndex, 0, movedItem)
this.$emit("input", this.listToString(this.fileList))
}
})
})
}
}, },
watch: { watch: {
value: { value: {
handler(val) { handler(val) {
if (val) { if (val) {
let temp = 1; let temp = 1
// //
const list = Array.isArray(val) ? val : this.value.split(','); const list = Array.isArray(val) ? val : this.value.split(',')
// //
this.fileList = list.map(item => { this.fileList = list.map(item => {
if (typeof item === "string") { if (typeof item === "string") {
item = { name: item, url: item }; item = { name: item, url: item }
} }
item.uid = item.uid || new Date().getTime() + temp++; item.uid = item.uid || new Date().getTime() + temp++
return item; return item
}); })
} else { } else {
this.fileList = []; this.fileList = []
return []; return []
} }
}, },
deep: true, deep: true,
@ -112,7 +143,7 @@ export default {
computed: { computed: {
// //
showTip() { showTip() {
return this.isShowTip && (this.fileType || this.fileSize); return this.isShowTip && (this.fileType || this.fileSize)
}, },
}, },
methods: { methods: {
@ -120,91 +151,95 @@ export default {
handleBeforeUpload(file) { handleBeforeUpload(file) {
// //
if (this.fileType) { if (this.fileType) {
const fileName = file.name.split('.'); const fileName = file.name.split('.')
const fileExt = fileName[fileName.length - 1]; const fileExt = fileName[fileName.length - 1]
const isTypeOk = this.fileType.indexOf(fileExt) >= 0; const isTypeOk = this.fileType.indexOf(fileExt) >= 0
if (!isTypeOk) { if (!isTypeOk) {
this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}格式文件!`); this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}格式文件!`)
return false; return false
} }
} }
// //
if (file.name.includes(',')) { if (file.name.includes(',')) {
this.$modal.msgError('文件名不正确,不能包含英文逗号!'); this.$modal.msgError('文件名不正确,不能包含英文逗号!')
return false; return false
} }
// //
if (this.fileSize) { if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize; const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) { if (!isLt) {
this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`); this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`)
return false; return false
} }
} }
this.$modal.loading("正在上传文件,请稍候..."); this.$modal.loading("正在上传文件,请稍候...")
this.number++; this.number++
return true; return true
}, },
// //
handleExceed() { handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`)
}, },
// //
handleUploadError(err) { handleUploadError(err) {
this.$modal.msgError("上传文件失败,请重试"); this.$modal.msgError("上传文件失败,请重试")
this.$modal.closeLoading() this.$modal.closeLoading()
}, },
// //
handleUploadSuccess(res, file) { handleUploadSuccess(res, file) {
if (res.code === 200) { if (res.code === 200) {
this.uploadList.push({ name: res.data.url, url: res.data.url }); this.uploadList.push({ name: res.data.url, url: res.data.url })
this.uploadedSuccessfully(); this.uploadedSuccessfully()
} else { } else {
this.number--; this.number--
this.$modal.closeLoading(); this.$modal.closeLoading()
this.$modal.msgError(res.msg); this.$modal.msgError(res.msg)
this.$refs.fileUpload.handleRemove(file); this.$refs.fileUpload.handleRemove(file)
this.uploadedSuccessfully(); this.uploadedSuccessfully()
} }
}, },
// //
handleDelete(index) { handleDelete(index) {
this.fileList.splice(index, 1); this.fileList.splice(index, 1)
this.$emit("input", this.listToString(this.fileList)); this.$emit("input", this.listToString(this.fileList))
}, },
// //
uploadedSuccessfully() { uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) { if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList); this.fileList = this.fileList.concat(this.uploadList)
this.uploadList = []; this.uploadList = []
this.number = 0; this.number = 0
this.$emit("input", this.listToString(this.fileList)); this.$emit("input", this.listToString(this.fileList))
this.$modal.closeLoading(); this.$modal.closeLoading()
} }
}, },
// //
getFileName(name) { getFileName(name) {
// url // url
if (name.lastIndexOf("/") > -1) { if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1); return name.slice(name.lastIndexOf("/") + 1)
} else { } else {
return name; return name
} }
}, },
// //
listToString(list, separator) { listToString(list, separator) {
let strs = ""; let strs = ""
separator = separator || ","; separator = separator || ","
for (let i in list) { for (let i in list) {
strs += list[i].url + separator; strs += list[i].url + separator
} }
return strs != '' ? strs.substr(0, strs.length - 1) : ''; return strs != '' ? strs.substr(0, strs.length - 1) : ''
} }
} }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.file-upload-darg {
opacity: 0.5;
background: #c8ebfb;
}
.upload-file-uploader { .upload-file-uploader {
margin-bottom: 5px; margin-bottom: 5px;
} }

View File

@ -1,25 +1,49 @@
<template> <template>
<div :class="{'show':show}" class="header-search"> <div class="header-search">
<svg-icon class-name="search-icon" icon-class="search" @click.stop="click" /> <svg-icon class-name="search-icon" icon-class="search" @click.stop="click" />
<el-select <el-dialog
ref="headerSearchSelect" :visible.sync="show"
v-model="search" width="600px"
:remote-method="querySearch" @close="close"
filterable :show-close="false"
default-first-option append-to-body
remote
placeholder="Search"
class="header-search-select"
@change="change"
> >
<el-option v-for="option in options" :key="option.item.path" :value="option.item" :label="option.item.title.join(' > ')" /> <el-input
</el-select> v-model="search"
ref="headerSearchSelectRef"
size="large"
@input="querySearch"
prefix-icon="el-icon-search"
placeholder="菜单搜索支持标题、URL模糊查询"
clearable
@keyup.enter.native="selectActiveResult"
@keydown.up.native="navigateResult('up')"
@keydown.down.native="navigateResult('down')"
>
</el-input>
<el-scrollbar wrap-class="right-scrollbar-wrapper">
<div class="result-wrap">
<div class="search-item" v-for="(item, index) in options" :key="item.path" :style="activeStyle(index)" @mouseenter="activeIndex = index" @mouseleave="activeIndex = -1">
<div class="left">
<svg-icon class="menu-icon" :icon-class="item.icon" />
</div>
<div class="search-info" @click="change(item)">
<div class="menu-title">
{{ item.title.join(" / ") }}
</div>
<div class="menu-path">
{{ item.path }}
</div>
</div>
<svg-icon icon-class="enter" v-show="index === activeIndex"/>
</div>
</div>
</el-scrollbar>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
// fuse is a lightweight fuzzy-search module
// make search results more in line with expectations
import Fuse from 'fuse.js/dist/fuse.min.js' import Fuse from 'fuse.js/dist/fuse.min.js'
import path from 'path' import path from 'path'
import { isHttp } from '@/utils/validate' import { isHttp } from '@/utils/validate'
@ -31,11 +55,15 @@ export default {
search: '', search: '',
options: [], options: [],
searchPool: [], searchPool: [],
activeIndex: -1,
show: false, show: false,
fuse: undefined fuse: undefined
} }
}, },
computed: { computed: {
theme() {
return this.$store.state.settings.theme
},
routes() { routes() {
return this.$store.getters.defaultRoutes return this.$store.getters.defaultRoutes
} }
@ -46,13 +74,6 @@ export default {
}, },
searchPool(list) { searchPool(list) {
this.initFuse(list) this.initFuse(list)
},
show(value) {
if (value) {
document.body.addEventListener('click', this.close)
} else {
document.body.removeEventListener('click', this.close)
}
} }
}, },
mounted() { mounted() {
@ -63,23 +84,26 @@ export default {
this.show = !this.show this.show = !this.show
if (this.show) { if (this.show) {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus() this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()
this.options = this.searchPool
} }
}, },
close() { close() {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur() this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur()
this.search = ''
this.options = [] this.options = []
this.show = false this.show = false
this.activeIndex = -1
}, },
change(val) { change(val) {
const path = val.path; const path = val.path
const query = val.query; const query = val.query
if(isHttp(val.path)) { if(isHttp(val.path)) {
// http(s):// // http(s)://
const pindex = path.indexOf("http"); const pindex = path.indexOf("http")
window.open(path.substr(pindex, path.length), "_blank"); window.open(path.substr(pindex, path.length), "_blank")
} else { } else {
if (query) { if (query) {
this.$router.push({ path: path, query: JSON.parse(query) }); this.$router.push({ path: path, query: JSON.parse(query) })
} else { } else {
this.$router.push(path) this.$router.push(path)
} }
@ -117,11 +141,13 @@ export default {
const data = { const data = {
path: !isHttp(router.path) ? path.resolve(basePath, router.path) : router.path, path: !isHttp(router.path) ? path.resolve(basePath, router.path) : router.path,
title: [...prefixTitle] title: [...prefixTitle],
icon: ''
} }
if (router.meta && router.meta.title) { if (router.meta && router.meta.title) {
data.title = [...data.title, router.meta.title] data.title = [...data.title, router.meta.title]
data.icon = router.meta.icon
if (router.redirect !== 'noRedirect') { if (router.redirect !== 'noRedirect') {
// only push the routes with title // only push the routes with title
@ -145,52 +171,94 @@ export default {
return res return res
}, },
querySearch(query) { querySearch(query) {
this.activeIndex = -1
if (query !== '') { if (query !== '') {
this.options = this.fuse.search(query) this.options = this.fuse.search(query).map((item) => item.item) ?? this.searchPool
} else { } else {
this.options = [] this.options = this.searchPool
}
},
activeStyle(index) {
if (index !== this.activeIndex) return {}
return {
"background-color": this.theme,
"color": "#fff"
}
},
navigateResult(direction) {
if (direction === "up") {
this.activeIndex = this.activeIndex <= 0 ? this.options.length - 1 : this.activeIndex - 1
} else if (direction === "down") {
this.activeIndex = this.activeIndex >= this.options.length - 1 ? 0 : this.activeIndex + 1
}
},
selectActiveResult() {
if (this.options.length > 0 && this.activeIndex >= 0) {
this.change(this.options[this.activeIndex])
} }
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang='scss' scoped>
.header-search { ::v-deep {
font-size: 0 !important; .el-dialog__header {
padding: 0 !important;
}
}
.header-search {
.search-icon { .search-icon {
cursor: pointer; cursor: pointer;
font-size: 18px; font-size: 18px;
vertical-align: middle; vertical-align: middle;
} }
}
.header-search-select { .result-wrap {
font-size: 18px; height: 280px;
transition: width 0.2s; margin: 6px 0;
width: 0;
overflow: hidden;
background: transparent;
border-radius: 0;
display: inline-block;
vertical-align: middle;
::v-deep .el-input__inner { .search-item {
border-radius: 0; display: flex;
border: 0; height: 48px;
padding-left: 0; align-items: center;
padding-right: 0; padding-right: 10px;
box-shadow: none !important;
border-bottom: 1px solid #d9d9d9; .left {
vertical-align: middle; width: 60px;
text-align: center;
.menu-icon {
width: 18px;
height: 18px;
}
}
.search-info {
padding-left: 5px;
margin-top: 10px;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
flex: 1;
.menu-title,
.menu-path {
height: 20px;
}
.menu-path {
color: #ccc;
font-size: 10px;
}
} }
} }
&.show { .search-item:hover {
.header-search-select { cursor: pointer;
width: 210px;
margin-left: 10px;
}
} }
} }
</style> </style>

View File

@ -31,30 +31,30 @@ export default {
computed: { computed: {
realSrc() { realSrc() {
if (!this.src) { if (!this.src) {
return; return
} }
let real_src = this.src.split(",")[0]; let real_src = this.src.split(",")[0]
return real_src; return real_src
}, },
realSrcList() { realSrcList() {
if (!this.src) { if (!this.src) {
return; return
} }
let real_src_list = this.src.split(","); let real_src_list = this.src.split(",")
let srcList = []; let srcList = []
real_src_list.forEach(item => { real_src_list.forEach(item => {
return srcList.push(item); return srcList.push(item)
}); })
return srcList; return srcList
}, },
realWidth() { realWidth() {
return typeof this.width == "string" ? this.width : `${this.width}px`; return typeof this.width == "string" ? this.width : `${this.width}px`
}, },
realHeight() { realHeight() {
return typeof this.height == "string" ? this.height : `${this.height}px`; return typeof this.height == "string" ? this.height : `${this.height}px`
} }
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -2,10 +2,12 @@
<div class="component-upload-image"> <div class="component-upload-image">
<el-upload <el-upload
multiple multiple
:disabled="disabled"
:action="uploadImgUrl" :action="uploadImgUrl"
list-type="picture-card" list-type="picture-card"
:on-success="handleUploadSuccess" :on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
:data="data"
:limit="limit" :limit="limit"
:on-error="handleUploadError" :on-error="handleUploadError"
:on-exceed="handleExceed" :on-exceed="handleExceed"
@ -21,7 +23,7 @@
</el-upload> </el-upload>
<!-- 上传提示 --> <!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip"> <div class="el-upload__tip" slot="tip" v-if="showTip && !disabled">
请上传 请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b> </template> <template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template> <template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
@ -43,30 +45,50 @@
</template> </template>
<script> <script>
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth"
import Sortable from 'sortablejs'
export default { export default {
props: { props: {
value: [String, Object, Array], value: [String, Object, Array],
//
action: {
type: String,
default: "/file/upload"
},
//
data: {
type: Object
},
// //
limit: { limit: {
type: Number, type: Number,
default: 5, default: 5
}, },
// (MB) // (MB)
fileSize: { fileSize: {
type: Number, type: Number,
default: 5, default: 5
}, },
// , ['png', 'jpg', 'jpeg'] // , ['png', 'jpg', 'jpeg']
fileType: { fileType: {
type: Array, type: Array,
default: () => ["png", "jpg", "jpeg"], default: () => ["png", "jpg", "jpeg"]
}, },
// //
isShowTip: { isShowTip: {
type: Boolean, type: Boolean,
default: true default: true
},
//
disabled: {
type: Boolean,
default: false
},
//
drag: {
type: Boolean,
default: true
} }
}, },
data() { data() {
@ -76,29 +98,43 @@ export default {
dialogImageUrl: "", dialogImageUrl: "",
dialogVisible: false, dialogVisible: false,
hideUpload: false, hideUpload: false,
uploadImgUrl: process.env.VUE_APP_BASE_API + "/file/upload", // uploadImgUrl: process.env.VUE_APP_BASE_API + this.action, //
headers: { headers: {
Authorization: "Bearer " + getToken(), Authorization: "Bearer " + getToken(),
}, },
fileList: [] fileList: []
}; }
},
mounted() {
if (this.drag && !this.disabled) {
this.$nextTick(() => {
const element = this.$refs.imageUpload?.$el?.querySelector('.el-upload-list')
Sortable.create(element, {
onEnd: (evt) => {
const movedItem = this.fileList.splice(evt.oldIndex, 1)[0]
this.fileList.splice(evt.newIndex, 0, movedItem)
this.$emit("input", this.listToString(this.fileList))
}
})
})
}
}, },
watch: { watch: {
value: { value: {
handler(val) { handler(val) {
if (val) { if (val) {
// //
const list = Array.isArray(val) ? val : this.value.split(','); const list = Array.isArray(val) ? val : this.value.split(',')
// //
this.fileList = list.map(item => { this.fileList = list.map(item => {
if (typeof item === "string") { if (typeof item === "string") {
item = { name: item, url: item }; item = { name: item, url: item }
} }
return item; return item
}); })
} else { } else {
this.fileList = []; this.fileList = []
return []; return []
} }
}, },
deep: true, deep: true,
@ -108,113 +144,118 @@ export default {
computed: { computed: {
// //
showTip() { showTip() {
return this.isShowTip && (this.fileType || this.fileSize); return this.isShowTip && (this.fileType || this.fileSize)
}, },
}, },
methods: { methods: {
// loading // loading
handleBeforeUpload(file) { handleBeforeUpload(file) {
let isImg = false; let isImg = false
if (this.fileType.length) { if (this.fileType.length) {
let fileExtension = ""; let fileExtension = ""
if (file.name.lastIndexOf(".") > -1) { if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1); fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1)
} }
isImg = this.fileType.some(type => { isImg = this.fileType.some(type => {
if (file.type.indexOf(type) > -1) return true; if (file.type.indexOf(type) > -1) return true
if (fileExtension && fileExtension.indexOf(type) > -1) return true; if (fileExtension && fileExtension.indexOf(type) > -1) return true
return false; return false
}); })
} else { } else {
isImg = file.type.indexOf("image") > -1; isImg = file.type.indexOf("image") > -1
} }
if (!isImg) { if (!isImg) {
this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}图片格式文件!`); this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}图片格式文件!`)
return false; return false
} }
if (file.name.includes(',')) { if (file.name.includes(',')) {
this.$modal.msgError('文件名不正确,不能包含英文逗号!'); this.$modal.msgError('文件名不正确,不能包含英文逗号!')
return false; return false
} }
if (this.fileSize) { if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize; const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) { if (!isLt) {
this.$modal.msgError(`上传头像图片大小不能超过 ${this.fileSize} MB!`); this.$modal.msgError(`上传头像图片大小不能超过 ${this.fileSize} MB!`)
return false; return false
} }
} }
this.$modal.loading("正在上传图片,请稍候..."); this.$modal.loading("正在上传图片,请稍候...")
this.number++; this.number++
}, },
// //
handleExceed() { handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`)
}, },
// //
handleUploadSuccess(res, file) { handleUploadSuccess(res, file) {
if (res.code === 200) { if (res.code === 200) {
this.uploadList.push({ name: res.data.url, url: res.data.url }); this.uploadList.push({ name: res.data.url, url: res.data.url })
this.uploadedSuccessfully(); this.uploadedSuccessfully()
} else { } else {
this.number--; this.number--
this.$modal.closeLoading(); this.$modal.closeLoading()
this.$modal.msgError(res.msg); this.$modal.msgError(res.msg)
this.$refs.imageUpload.handleRemove(file); this.$refs.imageUpload.handleRemove(file)
this.uploadedSuccessfully(); this.uploadedSuccessfully()
} }
}, },
// //
handleDelete(file) { handleDelete(file) {
const findex = this.fileList.map(f => f.name).indexOf(file.name); const findex = this.fileList.map(f => f.name).indexOf(file.name)
if (findex > -1) { if (findex > -1) {
this.fileList.splice(findex, 1); this.fileList.splice(findex, 1)
this.$emit("input", this.listToString(this.fileList)); this.$emit("input", this.listToString(this.fileList))
} }
}, },
// //
handleUploadError() { handleUploadError() {
this.$modal.msgError("上传图片失败,请重试"); this.$modal.msgError("上传图片失败,请重试")
this.$modal.closeLoading(); this.$modal.closeLoading()
}, },
// //
uploadedSuccessfully() { uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) { if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList); this.fileList = this.fileList.concat(this.uploadList)
this.uploadList = []; this.uploadList = []
this.number = 0; this.number = 0
this.$emit("input", this.listToString(this.fileList)); this.$emit("input", this.listToString(this.fileList))
this.$modal.closeLoading(); this.$modal.closeLoading()
} }
}, },
// //
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
this.dialogImageUrl = file.url; this.dialogImageUrl = file.url
this.dialogVisible = true; this.dialogVisible = true
}, },
// //
listToString(list, separator) { listToString(list, separator) {
let strs = ""; let strs = ""
separator = separator || ","; separator = separator || ","
for (let i in list) { for (let i in list) {
if (list[i].url) { if (list[i].url) {
strs += list[i].url.replace(this.baseUrl, "") + separator; strs += list[i].url.replace(this.baseUrl, "") + separator
} }
} }
return strs != '' ? strs.substr(0, strs.length - 1) : ''; return strs != '' ? strs.substr(0, strs.length - 1) : ''
} }
} }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
// .el-upload--picture-card // .el-upload--picture-card
::v-deep.hide .el-upload--picture-card { ::v-deep.hide .el-upload--picture-card {
display: none; display: none;
} }
::v-deep .el-upload-list--picture-card.is-disabled + .el-upload--picture-card {
display: none !important;
}
// //
::v-deep .el-list-enter-active, ::v-deep .el-list-enter-active,
::v-deep .el-list-leave-active { ::v-deep .el-list-leave-active {
transition: all 0s; transition: all 0s;
} }
::v-deep .el-list-enter, .el-list-leave-active { ::v-deep .el-list-enter, .el-list-leave-active {

View File

@ -63,7 +63,7 @@ export default {
}, },
data() { data() {
return { return {
}; }
}, },
computed: { computed: {
currentPage: { currentPage: {

View File

@ -1,106 +0,0 @@
<template>
<div ref="rightPanel" class="rightPanel-container">
<div class="rightPanel-background" />
<div class="rightPanel">
<div class="rightPanel-items">
<slot />
</div>
</div>
</div>
</template>
<script>
export default {
name: 'RightPanel',
props: {
clickNotClose: {
default: false,
type: Boolean
}
},
computed: {
show: {
get() {
return this.$store.state.settings.showSettings
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
})
}
}
},
watch: {
show(value) {
if (value && !this.clickNotClose) {
this.addEventClick()
}
}
},
mounted() {
this.addEventClick()
},
beforeDestroy() {
const elx = this.$refs.rightPanel
elx.remove()
},
methods: {
addEventClick() {
window.addEventListener('click', this.closeSidebar)
},
closeSidebar(evt) {
const parent = evt.target.closest('.el-drawer__body')
if (!parent) {
this.show = false
window.removeEventListener('click', this.closeSidebar)
}
}
}
}
</script>
<style lang="scss" scoped>
.rightPanel-background {
position: fixed;
top: 0;
left: 0;
opacity: 0;
transition: opacity .3s cubic-bezier(.7, .3, .1, 1);
background: rgba(0, 0, 0, .2);
z-index: -1;
}
.rightPanel {
width: 100%;
max-width: 260px;
height: 100vh;
position: fixed;
top: 0;
right: 0;
box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, .05);
transition: all .25s cubic-bezier(.7, .3, .1, 1);
transform: translate(100%);
background: #fff;
z-index: 40000;
}
.handle-button {
width: 48px;
height: 48px;
position: absolute;
left: -48px;
text-align: center;
font-size: 24px;
border-radius: 6px 0 0 6px !important;
z-index: 0;
pointer-events: auto;
cursor: pointer;
color: #fff;
line-height: 48px;
i {
font-size: 24px;
line-height: 48px;
}
}
</style>

View File

@ -12,9 +12,14 @@
<el-dropdown trigger="click" :hide-on-click="false" style="padding-left: 12px" v-if="showColumnsType == 'checkbox'"> <el-dropdown trigger="click" :hide-on-click="false" style="padding-left: 12px" v-if="showColumnsType == 'checkbox'">
<el-button size="mini" circle icon="el-icon-menu" /> <el-button size="mini" circle icon="el-icon-menu" />
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<!-- 全选/反选 按钮 -->
<el-dropdown-item>
<el-checkbox :indeterminate="isIndeterminate" v-model="isChecked" @change="toggleCheckAll"> </el-checkbox>
</el-dropdown-item>
<div class="check-line"></div>
<template v-for="item in columns"> <template v-for="item in columns">
<el-dropdown-item :key="item.key"> <el-dropdown-item :key="item.key">
<el-checkbox :checked="item.visible" @change="checkboxChange($event, item.label)" :label="item.label" /> <el-checkbox v-model="item.visible" @change="checkboxChange($event, item.label)" :label="item.label" />
</el-dropdown-item> </el-dropdown-item>
</template> </template>
</el-dropdown-menu> </el-dropdown-menu>
@ -41,42 +46,51 @@ export default {
// //
title: "显示/隐藏", title: "显示/隐藏",
// //
open: false, open: false
}; }
}, },
props: { props: {
/* 是否显示检索条件 */ /* 是否显示检索条件 */
showSearch: { showSearch: {
type: Boolean, type: Boolean,
default: true, default: true
}, },
/* 显隐列信息 */ /* 显隐列信息 */
columns: { columns: {
type: Array, type: Array
}, },
/* 是否显示检索图标 */ /* 是否显示检索图标 */
search: { search: {
type: Boolean, type: Boolean,
default: true, default: true
}, },
/* 显隐列类型transfer穿梭框、checkbox复选框 */ /* 显隐列类型transfer穿梭框、checkbox复选框 */
showColumnsType: { showColumnsType: {
type: String, type: String,
default: "checkbox", default: "checkbox"
}, },
/* 右外边距 */ /* 右外边距 */
gutter: { gutter: {
type: Number, type: Number,
default: 10, default: 10
}, },
}, },
computed: { computed: {
style() { style() {
const ret = {}; const ret = {}
if (this.gutter) { if (this.gutter) {
ret.marginRight = `${this.gutter / 2}px`; ret.marginRight = `${this.gutter / 2}px`
} }
return ret; return ret
},
isChecked: {
get() {
return this.columns.every((col) => col.visible)
},
set() {}
},
isIndeterminate() {
return this.columns.some((col) => col.visible) && !this.isChecked
} }
}, },
created() { created() {
@ -84,7 +98,7 @@ export default {
// //
for (let item in this.columns) { for (let item in this.columns) {
if (this.columns[item].visible === false) { if (this.columns[item].visible === false) {
this.value.push(parseInt(item)); this.value.push(parseInt(item))
} }
} }
} }
@ -92,29 +106,34 @@ export default {
methods: { methods: {
// //
toggleSearch() { toggleSearch() {
this.$emit("update:showSearch", !this.showSearch); this.$emit("update:showSearch", !this.showSearch)
}, },
// //
refresh() { refresh() {
this.$emit("queryTable"); this.$emit("queryTable")
}, },
// //
dataChange(data) { dataChange(data) {
for (let item in this.columns) { for (let item in this.columns) {
const key = this.columns[item].key; const key = this.columns[item].key
this.columns[item].visible = !data.includes(key); this.columns[item].visible = !data.includes(key)
} }
}, },
// dialog // dialog
showColumn() { showColumn() {
this.open = true; this.open = true
}, },
// //
checkboxChange(event, label) { checkboxChange(event, label) {
this.columns.filter(item => item.label == label)[0].visible = event; this.columns.filter(item => item.label == label)[0].visible = event
},
// /
toggleCheckAll() {
const newValue = !this.isChecked
this.columns.forEach((col) => (col.visible = newValue))
} }
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .el-transfer__button { ::v-deep .el-transfer__button {
@ -126,4 +145,10 @@ export default {
::v-deep .el-transfer__button:first-child { ::v-deep .el-transfer__button:first-child {
margin-bottom: 10px; margin-bottom: 10px;
} }
.check-line {
width: 90%;
height: 1px;
background-color: #ccc;
margin: 3px auto;
}
</style> </style>

View File

@ -51,6 +51,5 @@ export default {
}) })
} }
} }
} }
</script> </script>

View File

@ -32,11 +32,11 @@
</template> </template>
<script> <script>
import { constantRoutes } from "@/router"; import { constantRoutes } from "@/router"
import { isHttp } from "@/utils/validate"; import { isHttp } from "@/utils/validate"
// //
const hideList = ['/index', '/user/profile']; const hideList = ['/index', '/user/profile']
export default { export default {
data() { data() {
@ -45,67 +45,67 @@ export default {
visibleNumber: 5, visibleNumber: 5,
// index // index
currentIndex: undefined currentIndex: undefined
}; }
}, },
computed: { computed: {
theme() { theme() {
return this.$store.state.settings.theme; return this.$store.state.settings.theme
}, },
// //
topMenus() { topMenus() {
let topMenus = []; let topMenus = []
this.routers.map((menu) => { this.routers.map((menu) => {
if (menu.hidden !== true) { if (menu.hidden !== true) {
// //
if (menu.path === "/") { if (menu.path === '/' && menu.children) {
topMenus.push(menu.children[0]); topMenus.push(menu.children[0])
} else { } else {
topMenus.push(menu); topMenus.push(menu)
} }
} }
}); })
return topMenus; return topMenus
}, },
// //
routers() { routers() {
return this.$store.state.permission.topbarRouters; return this.$store.state.permission.topbarRouters
}, },
// //
childrenMenus() { childrenMenus() {
var childrenMenus = []; var childrenMenus = []
this.routers.map((router) => { this.routers.map((router) => {
for (var item in router.children) { for (var item in router.children) {
if (router.children[item].parentPath === undefined) { if (router.children[item].parentPath === undefined) {
if(router.path === "/") { if(router.path === "/") {
router.children[item].path = "/" + router.children[item].path; router.children[item].path = "/" + router.children[item].path
} else { } else {
if(!isHttp(router.children[item].path)) { if(!isHttp(router.children[item].path)) {
router.children[item].path = router.path + "/" + router.children[item].path; router.children[item].path = router.path + "/" + router.children[item].path
} }
} }
router.children[item].parentPath = router.path; router.children[item].parentPath = router.path
} }
childrenMenus.push(router.children[item]); childrenMenus.push(router.children[item])
} }
}); })
return constantRoutes.concat(childrenMenus); return constantRoutes.concat(childrenMenus)
}, },
// //
activeMenu() { activeMenu() {
const path = this.$route.path; const path = this.$route.path
let activePath = path; let activePath = path
if (path !== undefined && path.lastIndexOf("/") > 0 && hideList.indexOf(path) === -1) { if (path !== undefined && path.lastIndexOf("/") > 0 && hideList.indexOf(path) === -1) {
const tmpPath = path.substring(1, path.length); const tmpPath = path.substring(1, path.length)
if (!this.$route.meta.link) { if (!this.$route.meta.link) {
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/")); activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"))
this.$store.dispatch('app/toggleSideBarHide', false); this.$store.dispatch('app/toggleSideBarHide', false)
} }
} else if(!this.$route.children) { } else if(!this.$route.children) {
activePath = path; activePath = path
this.$store.dispatch('app/toggleSideBarHide', true); this.$store.dispatch('app/toggleSideBarHide', true)
} }
this.activeRoutes(activePath); this.activeRoutes(activePath)
return activePath; return activePath
}, },
}, },
beforeMount() { beforeMount() {
@ -115,55 +115,55 @@ export default {
window.removeEventListener('resize', this.setVisibleNumber) window.removeEventListener('resize', this.setVisibleNumber)
}, },
mounted() { mounted() {
this.setVisibleNumber(); this.setVisibleNumber()
}, },
methods: { methods: {
// //
setVisibleNumber() { setVisibleNumber() {
const width = document.body.getBoundingClientRect().width / 3; const width = document.body.getBoundingClientRect().width / 3
this.visibleNumber = parseInt(width / 85); this.visibleNumber = parseInt(width / 85)
}, },
// //
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
this.currentIndex = key; this.currentIndex = key
const route = this.routers.find(item => item.path === key); const route = this.routers.find(item => item.path === key)
if (isHttp(key)) { if (isHttp(key)) {
// http(s):// // http(s)://
window.open(key, "_blank"); window.open(key, "_blank")
} else if (!route || !route.children) { } else if (!route || !route.children) {
// //
const routeMenu = this.childrenMenus.find(item => item.path === key); const routeMenu = this.childrenMenus.find(item => item.path === key)
if (routeMenu && routeMenu.query) { if (routeMenu && routeMenu.query) {
let query = JSON.parse(routeMenu.query); let query = JSON.parse(routeMenu.query)
this.$router.push({ path: key, query: query }); this.$router.push({ path: key, query: query })
} else { } else {
this.$router.push({ path: key }); this.$router.push({ path: key })
} }
this.$store.dispatch('app/toggleSideBarHide', true); this.$store.dispatch('app/toggleSideBarHide', true)
} else { } else {
// //
this.activeRoutes(key); this.activeRoutes(key)
this.$store.dispatch('app/toggleSideBarHide', false); this.$store.dispatch('app/toggleSideBarHide', false)
} }
}, },
// //
activeRoutes(key) { activeRoutes(key) {
var routes = []; var routes = []
if (this.childrenMenus && this.childrenMenus.length > 0) { if (this.childrenMenus && this.childrenMenus.length > 0) {
this.childrenMenus.map((item) => { this.childrenMenus.map((item) => {
if (key == item.parentPath || (key == "index" && "" == item.path)) { if (key == item.parentPath || (key == "index" && "" == item.path)) {
routes.push(item); routes.push(item)
} }
}); })
} }
if(routes.length > 0) { if(routes.length > 0) {
this.$store.commit("SET_SIDEBAR_ROUTERS", routes); this.$store.commit("SET_SIDEBAR_ROUTERS", routes)
} else { } else {
this.$store.dispatch('app/toggleSideBarHide', true); this.$store.dispatch('app/toggleSideBarHide', true)
} }
} }
}, },
}; }
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -21,16 +21,16 @@ export default {
height: document.documentElement.clientHeight - 94.5 + "px;", height: document.documentElement.clientHeight - 94.5 + "px;",
loading: true, loading: true,
url: this.src url: this.src
}; }
}, },
mounted: function () { mounted: function () {
setTimeout(() => { setTimeout(() => {
this.loading = false; this.loading = false
}, 300); }, 300)
const that = this; const that = this
window.onresize = function temp() { window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 94.5 + "px;"; that.height = document.documentElement.clientHeight - 94.5 + "px;"
}; }
} }
}; }
</script> </script>

View File

@ -8,57 +8,57 @@ export default {
const value = binding.value const value = binding.value
if (value == false) return if (value == false) return
// 获取拖拽内容头部 // 获取拖拽内容头部
const dialogHeaderEl = el.querySelector('.el-dialog__header'); const dialogHeaderEl = el.querySelector('.el-dialog__header')
const dragDom = el.querySelector('.el-dialog'); const dragDom = el.querySelector('.el-dialog')
dialogHeaderEl.style.cursor = 'move'; dialogHeaderEl.style.cursor = 'move'
// 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null); // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null)
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null); const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null)
dragDom.style.position = 'absolute'; dragDom.style.position = 'absolute'
dragDom.style.marginTop = 0; dragDom.style.marginTop = 0
let width = dragDom.style.width; let width = dragDom.style.width
if (width.includes('%')) { if (width.includes('%')) {
width = +document.body.clientWidth * (+width.replace(/\%/g, '') / 100); width = +document.body.clientWidth * (+width.replace(/\%/g, '') / 100)
} else { } else {
width = +width.replace(/\px/g, ''); width = +width.replace(/\px/g, '')
} }
dragDom.style.left = `${(document.body.clientWidth - width) / 2}px`; dragDom.style.left = `${(document.body.clientWidth - width) / 2}px`
// 鼠标按下事件 // 鼠标按下事件
dialogHeaderEl.onmousedown = (e) => { dialogHeaderEl.onmousedown = (e) => {
// 鼠标按下,计算当前元素距离可视区的距离 (鼠标点击位置距离可视窗口的距离) // 鼠标按下,计算当前元素距离可视区的距离 (鼠标点击位置距离可视窗口的距离)
const disX = e.clientX - dialogHeaderEl.offsetLeft; const disX = e.clientX - dialogHeaderEl.offsetLeft
const disY = e.clientY - dialogHeaderEl.offsetTop; const disY = e.clientY - dialogHeaderEl.offsetTop
// 获取到的值带px 正则匹配替换 // 获取到的值带px 正则匹配替换
let styL, styT; let styL, styT
// 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
if (sty.left.includes('%')) { if (sty.left.includes('%')) {
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100); styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100)
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100); styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100)
} else { } else {
styL = +sty.left.replace(/\px/g, ''); styL = +sty.left.replace(/\px/g, '')
styT = +sty.top.replace(/\px/g, ''); styT = +sty.top.replace(/\px/g, '')
}; }
// 鼠标拖拽事件 // 鼠标拖拽事件
document.onmousemove = function (e) { document.onmousemove = function (e) {
// 通过事件委托,计算移动的距离 (开始拖拽至结束拖拽的距离) // 通过事件委托,计算移动的距离 (开始拖拽至结束拖拽的距离)
const l = e.clientX - disX; const l = e.clientX - disX
const t = e.clientY - disY; const t = e.clientY - disY
let finallyL = l + styL let finallyL = l + styL
let finallyT = t + styT let finallyT = t + styT
// 移动当前元素 // 移动当前元素
dragDom.style.left = `${finallyL}px`; dragDom.style.left = `${finallyL}px`
dragDom.style.top = `${finallyT}px`; dragDom.style.top = `${finallyT}px`
}; }
document.onmouseup = function (e) { document.onmouseup = function (e) {
document.onmousemove = null; document.onmousemove = null
document.onmouseup = null; document.onmouseup = null
}; }
} }
} }
}; }

View File

@ -5,30 +5,30 @@
export default { export default {
bind(el) { bind(el) {
const dragDom = el.querySelector('.el-dialog'); const dragDom = el.querySelector('.el-dialog')
const lineEl = document.createElement('div'); const lineEl = document.createElement('div')
lineEl.style = 'width: 6px; background: inherit; height: 10px; position: absolute; right: 0; bottom: 0; margin: auto; z-index: 1; cursor: nwse-resize;'; lineEl.style = 'width: 6px; background: inherit; height: 10px; position: absolute; right: 0; bottom: 0; margin: auto; z-index: 1; cursor: nwse-resize;'
lineEl.addEventListener('mousedown', lineEl.addEventListener('mousedown',
function(e) { function(e) {
// 鼠标按下,计算当前元素距离可视区的距离 // 鼠标按下,计算当前元素距离可视区的距离
const disX = e.clientX - el.offsetLeft; const disX = e.clientX - el.offsetLeft
const disY = e.clientY - el.offsetTop; const disY = e.clientY - el.offsetTop
// 当前宽度 高度 // 当前宽度 高度
const curWidth = dragDom.offsetWidth; const curWidth = dragDom.offsetWidth
const curHeight = dragDom.offsetHeight; const curHeight = dragDom.offsetHeight
document.onmousemove = function(e) { document.onmousemove = function(e) {
e.preventDefault(); // 移动时禁用默认事件 e.preventDefault() // 移动时禁用默认事件
// 通过事件委托,计算移动的距离 // 通过事件委托,计算移动的距离
const xl = e.clientX - disX; const xl = e.clientX - disX
const yl = e.clientY - disY const yl = e.clientY - disY
dragDom.style.width = `${curWidth + xl}px`; dragDom.style.width = `${curWidth + xl}px`
dragDom.style.height = `${curHeight + yl}px`; dragDom.style.height = `${curHeight + yl}px`
}; }
document.onmouseup = function(e) { document.onmouseup = function(e) {
document.onmousemove = null; document.onmousemove = null
document.onmouseup = null; document.onmouseup = null
}; }
}, false); }, false)
dragDom.appendChild(lineEl); dragDom.appendChild(lineEl)
} }
} }

View File

@ -5,26 +5,26 @@
export default { export default {
bind(el) { bind(el) {
const dragDom = el.querySelector('.el-dialog'); const dragDom = el.querySelector('.el-dialog')
const lineEl = document.createElement('div'); const lineEl = document.createElement('div')
lineEl.style = 'width: 5px; background: inherit; height: 80%; position: absolute; right: 0; top: 0; bottom: 0; margin: auto; z-index: 1; cursor: w-resize;'; lineEl.style = 'width: 5px; background: inherit; height: 80%; position: absolute; right: 0; top: 0; bottom: 0; margin: auto; z-index: 1; cursor: w-resize;'
lineEl.addEventListener('mousedown', lineEl.addEventListener('mousedown',
function (e) { function (e) {
// 鼠标按下,计算当前元素距离可视区的距离 // 鼠标按下,计算当前元素距离可视区的距离
const disX = e.clientX - el.offsetLeft; const disX = e.clientX - el.offsetLeft
// 当前宽度 // 当前宽度
const curWidth = dragDom.offsetWidth; const curWidth = dragDom.offsetWidth
document.onmousemove = function (e) { document.onmousemove = function (e) {
e.preventDefault(); // 移动时禁用默认事件 e.preventDefault() // 移动时禁用默认事件
// 通过事件委托,计算移动的距离 // 通过事件委托,计算移动的距离
const l = e.clientX - disX; const l = e.clientX - disX
dragDom.style.width = `${curWidth + l}px`; dragDom.style.width = `${curWidth + l}px`
}; }
document.onmouseup = function (e) { document.onmouseup = function (e) {
document.onmousemove = null; document.onmousemove = null
document.onmouseup = null; document.onmouseup = null
}; }
}, false); }, false)
dragDom.appendChild(lineEl); dragDom.appendChild(lineEl)
} }
} }

View File

@ -17,7 +17,7 @@ const install = function(Vue) {
if (window.Vue) { if (window.Vue) {
window['hasRole'] = hasRole window['hasRole'] = hasRole
window['hasPermi'] = hasPermi window['hasPermi'] = hasPermi
Vue.use(install); // eslint-disable-line Vue.use(install) // eslint-disable-line
} }
export default install export default install

View File

@ -8,47 +8,47 @@ export default {
bind(el, binding, vnode) { bind(el, binding, vnode) {
switch (binding.arg) { switch (binding.arg) {
case 'success': case 'success':
el._vClipBoard_success = binding.value; el._vClipBoard_success = binding.value
break; break
case 'error': case 'error':
el._vClipBoard_error = binding.value; el._vClipBoard_error = binding.value
break; break
default: { default: {
const clipboard = new Clipboard(el, { const clipboard = new Clipboard(el, {
text: () => binding.value, text: () => binding.value,
action: () => binding.arg === 'cut' ? 'cut' : 'copy' action: () => binding.arg === 'cut' ? 'cut' : 'copy'
}); })
clipboard.on('success', e => { clipboard.on('success', e => {
const callback = el._vClipBoard_success; const callback = el._vClipBoard_success
callback && callback(e); callback && callback(e)
}); })
clipboard.on('error', e => { clipboard.on('error', e => {
const callback = el._vClipBoard_error; const callback = el._vClipBoard_error
callback && callback(e); callback && callback(e)
}); })
el._vClipBoard = clipboard; el._vClipBoard = clipboard
} }
} }
}, },
update(el, binding) { update(el, binding) {
if (binding.arg === 'success') { if (binding.arg === 'success') {
el._vClipBoard_success = binding.value; el._vClipBoard_success = binding.value
} else if (binding.arg === 'error') { } else if (binding.arg === 'error') {
el._vClipBoard_error = binding.value; el._vClipBoard_error = binding.value
} else { } else {
el._vClipBoard.text = function () { return binding.value; }; el._vClipBoard.text = function () { return binding.value }
el._vClipBoard.action = () => binding.arg === 'cut' ? 'cut' : 'copy'; el._vClipBoard.action = () => binding.arg === 'cut' ? 'cut' : 'copy'
} }
}, },
unbind(el, binding) { unbind(el, binding) {
if (!el._vClipboard) return if (!el._vClipboard) return
if (binding.arg === 'success') { if (binding.arg === 'success') {
delete el._vClipBoard_success; delete el._vClipBoard_success
} else if (binding.arg === 'error') { } else if (binding.arg === 'error') {
delete el._vClipBoard_error; delete el._vClipBoard_error
} else { } else {
el._vClipBoard.destroy(); el._vClipBoard.destroy()
delete el._vClipBoard; delete el._vClipBoard
} }
} }
} }

View File

@ -8,7 +8,7 @@ import store from '@/store'
export default { export default {
inserted(el, binding, vnode) { inserted(el, binding, vnode) {
const { value } = binding const { value } = binding
const all_permission = "*:*:*"; const all_permission = "*:*:*"
const permissions = store.getters && store.getters.permissions const permissions = store.getters && store.getters.permissions
if (value && value instanceof Array && value.length > 0) { if (value && value instanceof Array && value.length > 0) {

View File

@ -8,7 +8,7 @@ import store from '@/store'
export default { export default {
inserted(el, binding, vnode) { inserted(el, binding, vnode) {
const { value } = binding const { value } = binding
const super_admin = "admin"; const super_admin = "admin"
const roles = store.getters && store.getters.roles const roles = store.getters && store.getters.roles
if (value && value instanceof Array && value.length > 0) { if (value && value instanceof Array && value.length > 0) {

View File

@ -11,22 +11,22 @@
</template> </template>
<script> <script>
import InnerLink from "../InnerLink/index"; import InnerLink from "../InnerLink/index"
export default { export default {
components: { InnerLink }, components: { InnerLink },
computed: { computed: {
iframeViews() { iframeViews() {
return this.$store.state.tagsView.iframeViews; return this.$store.state.tagsView.iframeViews
} }
}, },
methods: { methods: {
iframeUrl(url, query) { iframeUrl(url, query) {
if (Object.keys(query).length > 0) { if (Object.keys(query).length > 0) {
let params = Object.keys(query).map((key) => key + "=" + query[key]).join("&"); let params = Object.keys(query).map((key) => key + "=" + query[key]).join("&")
return url + "?" + params; return url + "?" + params
} }
return url; return url
} }
} }
} }

View File

@ -24,24 +24,24 @@ export default {
return { return {
loading: false, loading: false,
height: document.documentElement.clientHeight - 94.5 + "px;" height: document.documentElement.clientHeight - 94.5 + "px;"
}; }
}, },
mounted() { mounted() {
var _this = this; var _this = this
const iframeId = ("#" + this.iframeId).replace(/\//g, "\\/"); const iframeId = ("#" + this.iframeId).replace(/\//g, "\\/")
const iframe = document.querySelector(iframeId); const iframe = document.querySelector(iframeId)
// iframeloading // iframeloading
if (iframe.attachEvent) { if (iframe.attachEvent) {
this.loading = true; this.loading = true
iframe.attachEvent("onload", function () { iframe.attachEvent("onload", function () {
_this.loading = false; _this.loading = false
}); })
} else { } else {
this.loading = true; this.loading = true
iframe.onload = function () { iframe.onload = function () {
_this.loading = false; _this.loading = false
}; }
} }
} }
}; }
</script> </script>

View File

@ -25,23 +25,24 @@
</template> </template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="hover">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img :src="avatar" class="user-avatar"> <img :src="avatar" class="user-avatar">
<i class="el-icon-caret-bottom" /> <span class="user-nickname"> {{ nickName }} </span>
</div> </div>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<router-link to="/user/profile"> <router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item> <el-dropdown-item>个人中心</el-dropdown-item>
</router-link> </router-link>
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout"> <el-dropdown-item divided @click.native="logout">
<span>退出登录</span> <span>退出登录</span>
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<div class="right-menu-item hover-effect setting" @click="setLayout" v-if="setting">
<svg-icon icon-class="more-up" />
</div>
</div> </div>
</div> </div>
</template> </template>
@ -58,6 +59,7 @@ import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc' import RuoYiDoc from '@/components/RuoYi/Doc'
export default { export default {
emits: ['setLayout'],
components: { components: {
Breadcrumb, Breadcrumb,
TopNav, TopNav,
@ -72,17 +74,12 @@ export default {
...mapGetters([ ...mapGetters([
'sidebar', 'sidebar',
'avatar', 'avatar',
'device' 'device',
'nickName'
]), ]),
setting: { setting: {
get() { get() {
return this.$store.state.settings.showSettings return this.$store.state.settings.showSettings
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
})
} }
}, },
topNav: { topNav: {
@ -95,16 +92,19 @@ export default {
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')
}, },
async logout() { setLayout(event) {
this.$emit('setLayout')
},
logout() {
this.$confirm('确定注销并退出系统吗?', '提示', { this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch('LogOut').then(() => {
location.href = '/index'; location.href = '/index'
}) })
}).catch(() => {}); }).catch(() => {})
} }
} }
} }
@ -173,17 +173,25 @@ export default {
} }
.avatar-container { .avatar-container {
margin-right: 30px; margin-right: 0px;
padding-right: 0px;
.avatar-wrapper { .avatar-wrapper {
margin-top: 5px; margin-top: 10px;
position: relative; position: relative;
.user-avatar { .user-avatar {
cursor: pointer; cursor: pointer;
width: 40px; width: 30px;
height: 40px; height: 30px;
border-radius: 10px; border-radius: 50%;
}
.user-nickname{
position: relative;
bottom: 10px;
font-size: 14px;
font-weight: bold;
} }
.el-icon-caret-bottom { .el-icon-caret-bottom {

View File

@ -1,5 +1,5 @@
<template> <template>
<el-drawer size="280px" :visible="visible" :with-header="false" :append-to-body="true" :show-close="false"> <el-drawer size="280px" :visible="showSettings" :with-header="false" :append-to-body="true" :before-close="closeSetting">
<div class="drawer-container"> <div class="drawer-container">
<div> <div>
<div class="setting-drawer-content"> <div class="setting-drawer-content">
@ -78,18 +78,15 @@ import ThemePicker from '@/components/ThemePicker'
export default { export default {
components: { ThemePicker }, components: { ThemePicker },
expose: ['openSetting'],
data() { data() {
return { return {
theme: this.$store.state.settings.theme, theme: this.$store.state.settings.theme,
sideTheme: this.$store.state.settings.sideTheme sideTheme: this.$store.state.settings.sideTheme,
}; showSettings: false
}
}, },
computed: { computed: {
visible: {
get() {
return this.$store.state.settings.showSettings
}
},
fixedHeader: { fixedHeader: {
get() { get() {
return this.$store.state.settings.fixedHeader return this.$store.state.settings.fixedHeader
@ -111,8 +108,8 @@ export default {
value: val value: val
}) })
if (!val) { if (!val) {
this.$store.dispatch('app/toggleSideBarHide', false); this.$store.dispatch('app/toggleSideBarHide', false)
this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes); this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes)
} }
} }
}, },
@ -156,17 +153,23 @@ export default {
key: 'theme', key: 'theme',
value: val value: val
}) })
this.theme = val; this.theme = val
}, },
handleTheme(val) { handleTheme(val) {
this.$store.dispatch('settings/changeSetting', { this.$store.dispatch('settings/changeSetting', {
key: 'sideTheme', key: 'sideTheme',
value: val value: val
}) })
this.sideTheme = val; this.sideTheme = val
},
openSetting() {
this.showSettings = true
},
closeSetting(){
this.showSettings = false
}, },
saveSetting() { saveSetting() {
this.$modal.loading("正在保存到本地,请稍候..."); this.$modal.loading("正在保存到本地,请稍候...")
this.$cache.local.set( this.$cache.local.set(
"layout-setting", "layout-setting",
`{ `{
@ -178,11 +181,11 @@ export default {
"sideTheme":"${this.sideTheme}", "sideTheme":"${this.sideTheme}",
"theme":"${this.theme}" "theme":"${this.theme}"
}` }`
); )
setTimeout(this.$modal.closeLoading(), 1000) setTimeout(this.$modal.closeLoading(), 1000)
}, },
resetSetting() { resetSetting() {
this.$modal.loading("正在清除设置缓存并刷新,请稍候..."); this.$modal.loading("正在清除设置缓存并刷新,请稍候...")
this.$cache.local.remove("layout-setting") this.$cache.local.remove("layout-setting")
setTimeout("window.location.reload()", 1000) setTimeout("window.location.reload()", 1000)
} }

View File

@ -27,7 +27,7 @@ export default {
}, },
computed: { computed: {
variables() { variables() {
return variables; return variables
}, },
sideTheme() { sideTheme() {
return this.$store.state.settings.sideTheme return this.$store.state.settings.sideTheme

View File

@ -57,7 +57,7 @@ export default {
methods: { methods: {
hasOneShowingChild(children = [], parent) { hasOneShowingChild(children = [], parent) {
if (!children) { if (!children) {
children = []; children = []
} }
const showingChildren = children.filter(item => { const showingChildren = children.filter(item => {
if (item.hidden) { if (item.hidden) {
@ -89,7 +89,7 @@ export default {
return this.basePath return this.basePath
} }
if (routeQuery) { if (routeQuery) {
let query = JSON.parse(routeQuery); let query = JSON.parse(routeQuery)
return { path: path.resolve(this.basePath, routePath), query: query } return { path: path.resolve(this.basePath, routePath), query: query }
} }
return path.resolve(this.basePath, routePath) return path.resolve(this.basePath, routePath)

View File

@ -24,10 +24,10 @@
</template> </template>
<script> <script>
import { mapGetters, mapState } from "vuex"; import { mapGetters, mapState } from "vuex"
import Logo from "./Logo"; import Logo from "./Logo"
import SidebarItem from "./SidebarItem"; import SidebarItem from "./SidebarItem"
import variables from "@/assets/styles/variables.scss"; import variables from "@/assets/styles/variables.scss"
export default { export default {
components: { SidebarItem, Logo }, components: { SidebarItem, Logo },
@ -35,23 +35,23 @@ export default {
...mapState(["settings"]), ...mapState(["settings"]),
...mapGetters(["sidebarRouters", "sidebar"]), ...mapGetters(["sidebarRouters", "sidebar"]),
activeMenu() { activeMenu() {
const route = this.$route; const route = this.$route
const { meta, path } = route; const { meta, path } = route
// if set path, the sidebar will highlight the path you set // if set path, the sidebar will highlight the path you set
if (meta.activeMenu) { if (meta.activeMenu) {
return meta.activeMenu; return meta.activeMenu
} }
return path; return path
}, },
showLogo() { showLogo() {
return this.$store.state.settings.sidebarLogo; return this.$store.state.settings.sidebarLogo
}, },
variables() { variables() {
return variables; return variables
}, },
isCollapse() { isCollapse() {
return !this.sidebar.opened; return !this.sidebar.opened
} }
} }
}; }
</script> </script>

View File

@ -51,7 +51,7 @@ export default {
return this.$store.state.permission.routes return this.$store.state.permission.routes
}, },
theme() { theme() {
return this.$store.state.settings.theme; return this.$store.state.settings.theme
} }
}, },
watch: { watch: {
@ -76,11 +76,11 @@ export default {
return route.path === this.$route.path return route.path === this.$route.path
}, },
activeStyle(tag) { activeStyle(tag) {
if (!this.isActive(tag)) return {}; if (!this.isActive(tag)) return {}
return { return {
"background-color": this.theme, "background-color": this.theme,
"border-color": this.theme "border-color": this.theme
}; }
}, },
isAffix(tag) { isAffix(tag) {
return tag.meta && tag.meta.affix return tag.meta && tag.meta.affix
@ -151,7 +151,7 @@ export default {
}) })
}, },
refreshSelectedTag(view) { refreshSelectedTag(view) {
this.$tab.refreshPage(view); this.$tab.refreshPage(view)
if (this.$route.meta.link) { if (this.$route.meta.link) {
this.$store.dispatch('tagsView/delIframeView', this.$route) this.$store.dispatch('tagsView/delIframeView', this.$route)
} }
@ -178,7 +178,7 @@ export default {
}) })
}, },
closeOthersTags() { closeOthersTags() {
this.$router.push(this.selectedTag.fullPath).catch(()=>{}); this.$router.push(this.selectedTag.fullPath).catch(()=>{})
this.$tab.closeOtherPage(this.selectedTag).then(() => { this.$tab.closeOtherPage(this.selectedTag).then(() => {
this.moveToCurrentTag() this.moveToCurrentTag()
}) })

View File

@ -4,19 +4,16 @@
<sidebar v-if="!sidebar.hide" class="sidebar-container"/> <sidebar v-if="!sidebar.hide" class="sidebar-container"/>
<div :class="{hasTagsView:needTagsView,sidebarHide:sidebar.hide}" class="main-container"> <div :class="{hasTagsView:needTagsView,sidebarHide:sidebar.hide}" class="main-container">
<div :class="{'fixed-header':fixedHeader}"> <div :class="{'fixed-header':fixedHeader}">
<navbar/> <navbar @setLayout="setLayout"/>
<tags-view v-if="needTagsView"/> <tags-view v-if="needTagsView"/>
</div> </div>
<app-main/> <app-main/>
<right-panel> <settings ref="settingRef"/>
<settings/>
</right-panel>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import RightPanel from '@/components/RightPanel'
import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components' import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components'
import ResizeMixin from './mixin/ResizeHandler' import ResizeMixin from './mixin/ResizeHandler'
import { mapState } from 'vuex' import { mapState } from 'vuex'
@ -27,7 +24,6 @@ export default {
components: { components: {
AppMain, AppMain,
Navbar, Navbar,
RightPanel,
Settings, Settings,
Sidebar, Sidebar,
TagsView TagsView
@ -51,12 +47,15 @@ export default {
} }
}, },
variables() { variables() {
return variables; return variables
} }
}, },
methods: { methods: {
handleClickOutside() { handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
},
setLayout() {
this.$refs.settingRef.openSetting()
} }
} }
} }

View File

@ -16,11 +16,11 @@ import { download } from '@/utils/request'
import './assets/icons' // icon import './assets/icons' // icon
import './permission' // permission control import './permission' // permission control
import { getDicts } from "@/api/system/dict/data"; import { getDicts } from "@/api/system/dict/data"
import { getConfigKey } from "@/api/system/config"; import { getConfigKey } from "@/api/system/config"
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"; import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"
// 分页组件 // 分页组件
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination"
// 自定义表格工具组件 // 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar" import RightToolbar from "@/components/RightToolbar"
// 富文本组件 // 富文本组件

View File

@ -1,7 +1,7 @@
import store from '@/store' import store from '@/store'
function authPermission(permission) { function authPermission(permission) {
const all_permission = "*:*:*"; const all_permission = "*:*:*"
const permissions = store.getters && store.getters.permissions const permissions = store.getters && store.getters.permissions
if (permission && permission.length > 0) { if (permission && permission.length > 0) {
return permissions.some(v => { return permissions.some(v => {
@ -13,7 +13,7 @@ function authPermission(permission) {
} }
function authRole(role) { function authRole(role) {
const super_admin = "admin"; const super_admin = "admin"
const roles = store.getters && store.getters.roles const roles = store.getters && store.getters.roles
if (role && role.length > 0) { if (role && role.length > 0) {
return roles.some(v => { return roles.some(v => {
@ -27,7 +27,7 @@ function authRole(role) {
export default { export default {
// 验证用户是否具备某权限 // 验证用户是否具备某权限
hasPermi(permission) { hasPermi(permission) {
return authPermission(permission); return authPermission(permission)
}, },
// 验证用户是否含有指定权限,只需包含其中一个 // 验证用户是否含有指定权限,只需包含其中一个
hasPermiOr(permissions) { hasPermiOr(permissions) {
@ -43,7 +43,7 @@ export default {
}, },
// 验证用户是否具备某角色 // 验证用户是否具备某角色
hasRole(role) { hasRole(role) {
return authRole(role); return authRole(role)
}, },
// 验证用户是否含有指定角色,只需包含其中一个 // 验证用户是否含有指定角色,只需包含其中一个
hasRoleOr(roles) { hasRoleOr(roles) {

View File

@ -29,7 +29,7 @@ const sessionCache = {
return null return null
}, },
remove (key) { remove (key) {
sessionStorage.removeItem(key); sessionStorage.removeItem(key)
} }
} }
const localCache = { const localCache = {
@ -63,7 +63,7 @@ const localCache = {
return null return null
}, },
remove (key) { remove (key) {
localStorage.removeItem(key); localStorage.removeItem(key)
} }
} }

View File

@ -3,10 +3,10 @@ import {Loading, Message} from 'element-ui'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode' import errorCode from '@/utils/errorCode'
import { blobValidate } from "@/utils/ruoyi"; import { blobValidate } from "@/utils/ruoyi"
const baseURL = process.env.VUE_APP_BASE_API const baseURL = process.env.VUE_APP_BASE_API
let downloadLoadingInstance; let downloadLoadingInstance
export default { export default {
zip(url, name) { zip(url, name) {
@ -18,28 +18,28 @@ export default {
responseType: 'blob', responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() } headers: { 'Authorization': 'Bearer ' + getToken() }
}).then((res) => { }).then((res) => {
const isBlob = blobValidate(res.data); const isBlob = blobValidate(res.data)
if (isBlob) { if (isBlob) {
const blob = new Blob([res.data], { type: 'application/zip' }) const blob = new Blob([res.data], { type: 'application/zip' })
this.saveAs(blob, name) this.saveAs(blob, name)
} else { } else {
this.printErrMsg(res.data); this.printErrMsg(res.data)
} }
downloadLoadingInstance.close(); downloadLoadingInstance.close()
}).catch((r) => { }).catch((r) => {
console.error(r) console.error(r)
Message.error('下载文件出现错误,请联系管理员!') Message.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close(); downloadLoadingInstance.close()
}) })
}, },
saveAs(text, name, opts) { saveAs(text, name, opts) {
saveAs(text, name, opts); saveAs(text, name, opts)
}, },
async printErrMsg(data) { async printErrMsg(data) {
const resText = await data.text(); const resText = await data.text()
const rspObj = JSON.parse(resText); const rspObj = JSON.parse(resText)
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
Message.error(errMsg); Message.error(errMsg)
} }
} }

View File

@ -1,6 +1,6 @@
import { Message, MessageBox, Notification, Loading } from 'element-ui' import { Message, MessageBox, Notification, Loading } from 'element-ui'
let loadingInstance; let loadingInstance
export default { export default {
// 消息提示 // 消息提示
@ -41,7 +41,7 @@ export default {
}, },
// 错误通知 // 错误通知
notifyError(content) { notifyError(content) {
Notification.error(content); Notification.error(content)
}, },
// 成功通知 // 成功通知
notifySuccess(content) { notifySuccess(content) {
@ -78,6 +78,6 @@ export default {
}, },
// 关闭遮罩层 // 关闭遮罩层
closeLoading() { closeLoading() {
loadingInstance.close(); loadingInstance.close()
} }
} }

View File

@ -1,18 +1,18 @@
import store from '@/store' import store from '@/store'
import router from '@/router'; import router from '@/router'
export default { export default {
// 刷新当前tab页签 // 刷新当前tab页签
refreshPage(obj) { refreshPage(obj) {
const { path, query, matched } = router.currentRoute; const { path, query, matched } = router.currentRoute
if (obj === undefined) { if (obj === undefined) {
matched.forEach((m) => { matched.forEach((m) => {
if (m.components && m.components.default && m.components.default.name) { if (m.components && m.components.default && m.components.default.name) {
if (!['Layout', 'ParentView'].includes(m.components.default.name)) { if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
obj = { name: m.components.default.name, path: path, query: query }; obj = { name: m.components.default.name, path: path, query: query }
} }
} }
}); })
} }
return store.dispatch('tagsView/delCachedView', obj).then(() => { return store.dispatch('tagsView/delCachedView', obj).then(() => {
const { path, query } = obj const { path, query } = obj
@ -24,9 +24,9 @@ export default {
}, },
// 关闭当前tab页签打开新页签 // 关闭当前tab页签打开新页签
closeOpenPage(obj) { closeOpenPage(obj) {
store.dispatch("tagsView/delView", router.currentRoute); store.dispatch("tagsView/delView", router.currentRoute)
if (obj !== undefined) { if (obj !== undefined) {
return router.push(obj); return router.push(obj)
} }
}, },
// 关闭指定tab页签 // 关闭指定tab页签
@ -37,35 +37,35 @@ export default {
if (latestView) { if (latestView) {
return router.push(latestView.fullPath) return router.push(latestView.fullPath)
} }
return router.push('/'); return router.push('/')
}); })
} }
return store.dispatch('tagsView/delView', obj); return store.dispatch('tagsView/delView', obj)
}, },
// 关闭所有tab页签 // 关闭所有tab页签
closeAllPage() { closeAllPage() {
return store.dispatch('tagsView/delAllViews'); return store.dispatch('tagsView/delAllViews')
}, },
// 关闭左侧tab页签 // 关闭左侧tab页签
closeLeftPage(obj) { closeLeftPage(obj) {
return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute); return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute)
}, },
// 关闭右侧tab页签 // 关闭右侧tab页签
closeRightPage(obj) { closeRightPage(obj) {
return store.dispatch('tagsView/delRightTags', obj || router.currentRoute); return store.dispatch('tagsView/delRightTags', obj || router.currentRoute)
}, },
// 关闭其他tab页签 // 关闭其他tab页签
closeOtherPage(obj) { closeOtherPage(obj) {
return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute); return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute)
}, },
// 添加tab页签 // 添加tab页签
openPage(title, url, params) { openPage(title, url, params) {
const obj = { path: url, meta: { title: title } } const obj = { path: url, meta: { title: title } }
store.dispatch('tagsView/addView', obj); store.dispatch('tagsView/addView', obj)
return router.push({ path: url, query: params }); return router.push({ path: url, query: params })
}, },
// 修改tab页签 // 修改tab页签
updatePage(obj) { updatePage(obj) {
return store.dispatch('tagsView/updateVisitedView', obj); return store.dispatch('tagsView/updateVisitedView', obj)
} }
} }

View File

@ -165,8 +165,8 @@ export const dynamicRoutes = [
] ]
// 防止连续点击多次路由报错 // 防止连续点击多次路由报错
let routerPush = Router.prototype.push; let routerPush = Router.prototype.push
let routerReplace = Router.prototype.replace; let routerReplace = Router.prototype.replace
// push // push
Router.prototype.push = function push(location) { Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(err => err) return routerPush.call(this, location).catch(err => err)

View File

@ -7,7 +7,7 @@ module.exports = {
/** /**
* 是否系统布局配置 * 是否系统布局配置
*/ */
showSettings: false, showSettings: true,
/** /**
* 是否显示顶部导航 * 是否显示顶部导航

View File

@ -7,13 +7,15 @@ const getters = {
cachedViews: state => state.tagsView.cachedViews, cachedViews: state => state.tagsView.cachedViews,
token: state => state.user.token, token: state => state.user.token,
avatar: state => state.user.avatar, avatar: state => state.user.avatar,
id: state => state.user.id,
name: state => state.user.name, name: state => state.user.name,
nickName: state => state.user.nickName,
introduction: state => state.user.introduction, introduction: state => state.user.introduction,
roles: state => state.user.roles, roles: state => state.user.roles,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
permission_routes: state => state.permission.routes, permission_routes: state => state.permission.routes,
topbarRouters:state => state.permission.topbarRouters, topbarRouters: state => state.permission.topbarRouters,
defaultRoutes:state => state.permission.defaultRoutes, defaultRoutes: state => state.permission.defaultRoutes,
sidebarRouters:state => state.permission.sidebarRouters, sidebarRouters: state => state.permission.sidebarRouters
} }
export default getters export default getters

View File

@ -13,7 +13,7 @@ const state = {
const mutations = { const mutations = {
TOGGLE_SIDEBAR: state => { TOGGLE_SIDEBAR: state => {
if (state.sidebar.hide) { if (state.sidebar.hide) {
return false; return false
} }
state.sidebar.opened = !state.sidebar.opened state.sidebar.opened = !state.sidebar.opened
state.sidebar.withoutAnimation = false state.sidebar.withoutAnimation = false

View File

@ -38,9 +38,9 @@ const permission = {
const rdata = JSON.parse(JSON.stringify(res.data)) const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata) const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true) const rewriteRoutes = filterAsyncRouter(rdata, false, true)
const asyncRoutes = filterDynamicRoutes(dynamicRoutes); const asyncRoutes = filterDynamicRoutes(dynamicRoutes)
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true }) rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
router.addRoutes(asyncRoutes); router.addRoutes(asyncRoutes)
commit('SET_ROUTES', rewriteRoutes) commit('SET_ROUTES', rewriteRoutes)
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes)) commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
commit('SET_DEFAULT_ROUTES', sidebarRoutes) commit('SET_DEFAULT_ROUTES', sidebarRoutes)

View File

@ -8,6 +8,7 @@ const user = {
token: getToken(), token: getToken(),
id: '', id: '',
name: '', name: '',
nickName: '',
avatar: '', avatar: '',
roles: [], roles: [],
permissions: [] permissions: []
@ -26,6 +27,9 @@ const user = {
SET_NAME: (state, name) => { SET_NAME: (state, name) => {
state.name = name state.name = name
}, },
SET_NICK_NAME: (state, nickName) =>{
state.nickName = nickName
},
SET_AVATAR: (state, avatar) => { SET_AVATAR: (state, avatar) => {
state.avatar = avatar state.avatar = avatar
}, },
@ -72,6 +76,7 @@ const user = {
} }
commit('SET_ID', user.userId) commit('SET_ID', user.userId)
commit('SET_NAME', user.userName) commit('SET_NAME', user.userName)
commit('SET_NICK_NAME', user.nickName)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
resolve(res) resolve(res)
}).catch(error => { }).catch(error => {

View File

@ -1,5 +1,5 @@
import Vue from 'vue' import Vue from 'vue'
import { mergeRecursive } from "@/utils/ruoyi"; import { mergeRecursive } from "@/utils/ruoyi"
import DictMeta from './DictMeta' import DictMeta from './DictMeta'
import DictData from './DictData' import DictData from './DictData'

View File

@ -1,4 +1,4 @@
import { mergeRecursive } from "@/utils/ruoyi"; import { mergeRecursive } from "@/utils/ruoyi"
import DictOptions from './DictOptions' import DictOptions from './DictOptions'
/** /**

View File

@ -1,4 +1,4 @@
import { mergeRecursive } from "@/utils/ruoyi"; import { mergeRecursive } from "@/utils/ruoyi"
import dictConverter from './DictConverter' import dictConverter from './DictConverter'
export const options = { export const options = {

View File

@ -4,7 +4,7 @@ import { parseTime } from './ruoyi'
* 表格时间格式化 * 表格时间格式化
*/ */
export function formatDate(cellValue) { export function formatDate(cellValue) {
if (cellValue == null || cellValue == "") return ""; if (cellValue == null || cellValue == "") return ""
var date = new Date(cellValue) var date = new Date(cellValue)
var year = date.getFullYear() var year = date.getFullYear()
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1

View File

@ -9,13 +9,13 @@ export function checkPermi(value) {
if (value && value instanceof Array && value.length > 0) { if (value && value instanceof Array && value.length > 0) {
const permissions = store.getters && store.getters.permissions const permissions = store.getters && store.getters.permissions
const permissionDatas = value const permissionDatas = value
const all_permission = "*:*:*"; const all_permission = "*:*:*"
const hasPermission = permissions.some(permission => { const hasPermission = permissions.some(permission => {
return all_permission === permission || permissionDatas.includes(permission) return all_permission === permission || permissionDatas.includes(permission)
}) })
return hasPermission; return hasPermission
} else { } else {
console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`) console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`)
@ -32,13 +32,13 @@ export function checkRole(value) {
if (value && value instanceof Array && value.length > 0) { if (value && value instanceof Array && value.length > 0) {
const roles = store.getters && store.getters.roles const roles = store.getters && store.getters.roles
const permissionRoles = value const permissionRoles = value
const super_admin = "admin"; const super_admin = "admin"
const hasRole = roles.some(role => { const hasRole = roles.some(role => {
return super_admin === role || permissionRoles.includes(role) return super_admin === role || permissionRoles.includes(role)
}) })
return hasRole; return hasRole
} else { } else {
console.error(`need roles! Like checkRole="['admin','editor']"`) console.error(`need roles! Like checkRole="['admin','editor']"`)

View File

@ -3,13 +3,13 @@ import { Notification, MessageBox, Message, Loading } from 'element-ui'
import store from '@/store' import store from '@/store'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode' import errorCode from '@/utils/errorCode'
import { tansParams, blobValidate } from "@/utils/ruoyi"; import { tansParams, blobValidate } from "@/utils/ruoyi"
import cache from '@/plugins/cache' import cache from '@/plugins/cache'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
let downloadLoadingInstance; let downloadLoadingInstance
// 是否显示重新登录 // 是否显示重新登录
export let isRelogin = { show: false }; export let isRelogin = { show: false }
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例 // 创建axios实例
@ -31,10 +31,10 @@ service.interceptors.request.use(config => {
} }
// get请求映射params参数 // get请求映射params参数
if (config.method === 'get' && config.params) { if (config.method === 'get' && config.params) {
let url = config.url + '?' + tansParams(config.params); let url = config.url + '?' + tansParams(config.params)
url = url.slice(0, -1); url = url.slice(0, -1)
config.params = {}; config.params = {}
config.url = url; config.url = url
} }
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = { const requestObj = {
@ -42,22 +42,22 @@ service.interceptors.request.use(config => {
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
time: new Date().getTime() time: new Date().getTime()
} }
const requestSize = Object.keys(JSON.stringify(requestObj)).length; // 请求数据大小 const requestSize = Object.keys(JSON.stringify(requestObj)).length // 请求数据大小
const limitSize = 5 * 1024 * 1024; // 限制存放数据5M const limitSize = 5 * 1024 * 1024 // 限制存放数据5M
if (requestSize >= limitSize) { if (requestSize >= limitSize) {
console.warn(`[${config.url}]: ` + '请求数据大小超出允许的5M限制无法进行防重复提交验证。') console.warn(`[${config.url}]: ` + '请求数据大小超出允许的5M限制无法进行防重复提交验证。')
return config; return config
} }
const sessionObj = cache.session.getJSON('sessionObj') const sessionObj = cache.session.getJSON('sessionObj')
if (sessionObj === undefined || sessionObj === null || sessionObj === '') { if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
cache.session.setJSON('sessionObj', requestObj) cache.session.setJSON('sessionObj', requestObj)
} else { } else {
const s_url = sessionObj.url; // 请求地址 const s_url = sessionObj.url // 请求地址
const s_data = sessionObj.data; // 请求数据 const s_data = sessionObj.data // 请求数据
const s_time = sessionObj.time; // 请求时间 const s_time = sessionObj.time // 请求时间
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交 const interval = 1000 // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请勿重复提交'; const message = '数据正在处理,请勿重复提交'
console.warn(`[${s_url}]: ` + message) console.warn(`[${s_url}]: ` + message)
return Promise.reject(new Error(message)) return Promise.reject(new Error(message))
} else { } else {
@ -74,7 +74,7 @@ service.interceptors.request.use(config => {
// 响应拦截器 // 响应拦截器
service.interceptors.response.use(res => { service.interceptors.response.use(res => {
// 未设置状态码则默认成功状态 // 未设置状态码则默认成功状态
const code = res.data.code || 200; const code = res.data.code || 200
// 获取错误信息 // 获取错误信息
const msg = errorCode[code] || res.data.msg || errorCode['default'] const msg = errorCode[code] || res.data.msg || errorCode['default']
// 二进制数据则直接返回 // 二进制数据则直接返回
@ -83,15 +83,15 @@ service.interceptors.response.use(res => {
} }
if (code === 401) { if (code === 401) {
if (!isRelogin.show) { if (!isRelogin.show) {
isRelogin.show = true; isRelogin.show = true
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false; isRelogin.show = false
store.dispatch('LogOut').then(() => { store.dispatch('LogOut').then(() => {
location.href = '/index'; location.href = '/index'
}) })
}).catch(() => { }).catch(() => {
isRelogin.show = false; isRelogin.show = false
}); })
} }
return Promise.reject('无效的会话,或者会话已过期,请重新登录。') return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) { } else if (code === 500) {
@ -109,13 +109,13 @@ service.interceptors.response.use(res => {
}, },
error => { error => {
console.log('err' + error) console.log('err' + error)
let { message } = error; let { message } = error
if (message == "Network Error") { if (message == "Network Error") {
message = "后端接口连接异常"; message = "后端接口连接异常"
} else if (message.includes("timeout")) { } else if (message.includes("timeout")) {
message = "系统接口请求超时"; message = "系统接口请求超时"
} else if (message.includes("Request failed with status code")) { } else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常"; message = "系统接口" + message.substr(message.length - 3) + "异常"
} }
Message({ message: message, type: 'error', duration: 5 * 1000 }) Message({ message: message, type: 'error', duration: 5 * 1000 })
return Promise.reject(error) return Promise.reject(error)
@ -131,21 +131,21 @@ export function download(url, params, filename, config) {
responseType: 'blob', responseType: 'blob',
...config ...config
}).then(async (data) => { }).then(async (data) => {
const isBlob = blobValidate(data); const isBlob = blobValidate(data)
if (isBlob) { if (isBlob) {
const blob = new Blob([data]) const blob = new Blob([data])
saveAs(blob, filename) saveAs(blob, filename)
} else { } else {
const resText = await data.text(); const resText = await data.text()
const rspObj = JSON.parse(resText); const rspObj = JSON.parse(resText)
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
Message.error(errMsg); Message.error(errMsg)
} }
downloadLoadingInstance.close(); downloadLoadingInstance.close()
}).catch((r) => { }).catch((r) => {
console.error(r) console.error(r)
Message.error('下载文件出现错误,请联系管理员!') Message.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close(); downloadLoadingInstance.close()
}) })
} }

View File

@ -16,7 +16,7 @@ export function parseTime(time, pattern) {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time) time = parseInt(time)
} else if (typeof time === 'string') { } else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), ''); time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '')
} }
if ((typeof time === 'number') && (time.toString().length === 10)) { if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000 time = time * 1000
@ -47,89 +47,89 @@ export function parseTime(time, pattern) {
// 表单重置 // 表单重置
export function resetForm(refName) { export function resetForm(refName) {
if (this.$refs[refName]) { if (this.$refs[refName]) {
this.$refs[refName].resetFields(); this.$refs[refName].resetFields()
} }
} }
// 添加日期范围 // 添加日期范围
export function addDateRange(params, dateRange, propName) { export function addDateRange(params, dateRange, propName) {
let search = params; let search = params
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}; search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}
dateRange = Array.isArray(dateRange) ? dateRange : []; dateRange = Array.isArray(dateRange) ? dateRange : []
if (typeof (propName) === 'undefined') { if (typeof (propName) === 'undefined') {
search.params['beginTime'] = dateRange[0]; search.params['beginTime'] = dateRange[0]
search.params['endTime'] = dateRange[1]; search.params['endTime'] = dateRange[1]
} else { } else {
search.params['begin' + propName] = dateRange[0]; search.params['begin' + propName] = dateRange[0]
search.params['end' + propName] = dateRange[1]; search.params['end' + propName] = dateRange[1]
} }
return search; return search
} }
// 回显数据字典 // 回显数据字典
export function selectDictLabel(datas, value) { export function selectDictLabel(datas, value) {
if (value === undefined) { if (value === undefined) {
return ""; return ""
} }
var actions = []; var actions = []
Object.keys(datas).some((key) => { Object.keys(datas).some((key) => {
if (datas[key].value == ('' + value)) { if (datas[key].value == ('' + value)) {
actions.push(datas[key].label); actions.push(datas[key].label)
return true; return true
} }
}) })
if (actions.length === 0) { if (actions.length === 0) {
actions.push(value); actions.push(value)
} }
return actions.join(''); return actions.join('')
} }
// 回显数据字典(字符串、数组) // 回显数据字典(字符串、数组)
export function selectDictLabels(datas, value, separator) { export function selectDictLabels(datas, value, separator) {
if (value === undefined || value.length ===0) { if (value === undefined || value.length ===0) {
return ""; return ""
} }
if (Array.isArray(value)) { if (Array.isArray(value)) {
value = value.join(","); value = value.join(",")
} }
var actions = []; var actions = []
var currentSeparator = undefined === separator ? "," : separator; var currentSeparator = undefined === separator ? "," : separator
var temp = value.split(currentSeparator); var temp = value.split(currentSeparator)
Object.keys(value.split(currentSeparator)).some((val) => { Object.keys(value.split(currentSeparator)).some((val) => {
var match = false; var match = false
Object.keys(datas).some((key) => { Object.keys(datas).some((key) => {
if (datas[key].value == ('' + temp[val])) { if (datas[key].value == ('' + temp[val])) {
actions.push(datas[key].label + currentSeparator); actions.push(datas[key].label + currentSeparator)
match = true; match = true
} }
}) })
if (!match) { if (!match) {
actions.push(temp[val] + currentSeparator); actions.push(temp[val] + currentSeparator)
} }
}) })
return actions.join('').substring(0, actions.join('').length - 1); return actions.join('').substring(0, actions.join('').length - 1)
} }
// 字符串格式化(%s ) // 字符串格式化(%s )
export function sprintf(str) { export function sprintf(str) {
var args = arguments, flag = true, i = 1; var args = arguments, flag = true, i = 1
str = str.replace(/%s/g, function () { str = str.replace(/%s/g, function () {
var arg = args[i++]; var arg = args[i++]
if (typeof arg === 'undefined') { if (typeof arg === 'undefined') {
flag = false; flag = false
return ''; return ''
} }
return arg; return arg
}); })
return flag ? str : ''; return flag ? str : ''
} }
// 转换字符串undefined,null等转化为"" // 转换字符串undefined,null等转化为""
export function parseStrEmpty(str) { export function parseStrEmpty(str) {
if (!str || str == "undefined" || str == "null") { if (!str || str == "undefined" || str == "null") {
return ""; return ""
} }
return str; return str
} }
// 数据合并 // 数据合并
@ -137,16 +137,16 @@ export function mergeRecursive(source, target) {
for (var p in target) { for (var p in target) {
try { try {
if (target[p].constructor == Object) { if (target[p].constructor == Object) {
source[p] = mergeRecursive(source[p], target[p]); source[p] = mergeRecursive(source[p], target[p])
} else { } else {
source[p] = target[p]; source[p] = target[p]
} }
} catch (e) { } catch (e) {
source[p] = target[p]; source[p] = target[p]
} }
} }
return source; return source
}; }
/** /**
* 构造树型结构数据 * 构造树型结构数据
@ -160,15 +160,15 @@ export function handleTree(data, id, parentId, children) {
id: id || 'id', id: id || 'id',
parentId: parentId || 'parentId', parentId: parentId || 'parentId',
childrenList: children || 'children' childrenList: children || 'children'
}; }
var childrenListMap = {}; var childrenListMap = {}
var tree = []; var tree = []
for (let d of data) { for (let d of data) {
let id = d[config.id]; let id = d[config.id]
childrenListMap[id] = d; childrenListMap[id] = d
if (!d[config.childrenList]) { if (!d[config.childrenList]) {
d[config.childrenList] = []; d[config.childrenList] = []
} }
} }
@ -176,12 +176,12 @@ export function handleTree(data, id, parentId, children) {
let parentId = d[config.parentId] let parentId = d[config.parentId]
let parentObj = childrenListMap[parentId] let parentObj = childrenListMap[parentId]
if (!parentObj) { if (!parentObj) {
tree.push(d); tree.push(d)
} else { } else {
parentObj[config.childrenList].push(d) parentObj[config.childrenList].push(d)
} }
} }
return tree; return tree
} }
/** /**
@ -191,19 +191,19 @@ export function handleTree(data, id, parentId, children) {
export function tansParams(params) { export function tansParams(params) {
let result = '' let result = ''
for (const propName of Object.keys(params)) { for (const propName of Object.keys(params)) {
const value = params[propName]; const value = params[propName]
var part = encodeURIComponent(propName) + "="; var part = encodeURIComponent(propName) + "="
if (value !== null && value !== "" && typeof (value) !== "undefined") { if (value !== null && value !== "" && typeof (value) !== "undefined") {
if (typeof value === 'object') { if (typeof value === 'object') {
for (const key of Object.keys(value)) { for (const key of Object.keys(value)) {
if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') { if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') {
let params = propName + '[' + key + ']'; let params = propName + '[' + key + ']'
var subPart = encodeURIComponent(params) + "="; var subPart = encodeURIComponent(params) + "="
result += subPart + encodeURIComponent(value[key]) + "&"; result += subPart + encodeURIComponent(value[key]) + "&"
} }
} }
} else { } else {
result += part + encodeURIComponent(value) + "&"; result += part + encodeURIComponent(value) + "&"
} }
} }
} }
@ -214,7 +214,7 @@ export function tansParams(params) {
export function getNormalPath(p) { export function getNormalPath(p) {
if (p.length === 0 || !p || p == 'undefined') { if (p.length === 0 || !p || p == 'undefined') {
return p return p
}; }
let res = p.replace('//', '/') let res = p.replace('//', '/')
if (res[res.length - 1] === '/') { if (res[res.length - 1] === '/') {
return res.slice(0, res.length - 1) return res.slice(0, res.length - 1)

View File

@ -1,13 +1,5 @@
<template> <template>
<div class="app-container home"> <div class="app-container home">
<el-row :gutter="20">
<el-col :sm="24" :lg="24">
<blockquote class="text-warning" style="font-size: 14px">
阿里云服务器折扣区<el-link href="http://aly.ruoyi.vip" type="primary" target="_blank">点我进入</el-link> &nbsp;&nbsp;&nbsp; 腾讯云服务器秒杀区<el-link href="http://txy.ruoyi.vip" type="primary" target="_blank">点我进入</el-link>
</blockquote>
<hr />
</el-col>
</el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :sm="24" :lg="12" style="padding-left: 20px"> <el-col :sm="24" :lg="12" style="padding-left: 20px">
<h2>若依后台管理框架</h2> <h2>若依后台管理框架</h2>
@ -922,10 +914,10 @@ export default {
}, },
methods: { methods: {
goTarget(href) { goTarget(href) {
window.open(href, "_blank"); window.open(href, "_blank")
}, }
}, }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -62,8 +62,8 @@
</template> </template>
<script> <script>
import { getCodeImg } from "@/api/login"; import { getCodeImg } from "@/api/login"
import Cookies from "js-cookie"; import Cookies from "js-cookie"
import { encrypt, decrypt } from '@/utils/jsencrypt' import { encrypt, decrypt } from '@/utils/jsencrypt'
export default { export default {
@ -94,66 +94,66 @@ export default {
// //
register: false, register: false,
redirect: undefined redirect: undefined
}; }
}, },
watch: { watch: {
$route: { $route: {
handler: function(route) { handler: function(route) {
this.redirect = route.query && route.query.redirect; this.redirect = route.query && route.query.redirect
}, },
immediate: true immediate: true
} }
}, },
created() { created() {
this.getCode(); this.getCode()
this.getCookie(); this.getCookie()
}, },
methods: { methods: {
getCode() { getCode() {
getCodeImg().then(res => { getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled; this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
if (this.captchaEnabled) { if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img; this.codeUrl = "data:image/gif;base64," + res.img
this.loginForm.uuid = res.uuid; this.loginForm.uuid = res.uuid
} }
}); })
}, },
getCookie() { getCookie() {
const username = Cookies.get("username"); const username = Cookies.get("username")
const password = Cookies.get("password"); const password = Cookies.get("password")
const rememberMe = Cookies.get('rememberMe') const rememberMe = Cookies.get('rememberMe')
this.loginForm = { this.loginForm = {
username: username === undefined ? this.loginForm.username : username, username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password), password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
}; }
}, },
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
this.loading = true; this.loading = true
if (this.loginForm.rememberMe) { if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 }); Cookies.set("username", this.loginForm.username, { expires: 30 })
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 }); Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 })
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 }); Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 })
} else { } else {
Cookies.remove("username"); Cookies.remove("username")
Cookies.remove("password"); Cookies.remove("password")
Cookies.remove('rememberMe'); Cookies.remove('rememberMe')
} }
this.$store.dispatch("Login", this.loginForm).then(() => { this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); this.$router.push({ path: this.redirect || "/" }).catch(()=>{})
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false
if (this.captchaEnabled) { if (this.captchaEnabled) {
this.getCode(); this.getCode()
} }
}); })
} }
}); })
} }
} }
}; }
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
@ -176,6 +176,7 @@ export default {
background: #ffffff; background: #ffffff;
width: 400px; width: 400px;
padding: 25px 25px 5px 25px; padding: 25px 25px 5px 25px;
z-index: 1;
.el-input { .el-input {
height: 38px; height: 38px;
input { input {

View File

@ -67,18 +67,18 @@
</template> </template>
<script> <script>
import { getCodeImg, register } from "@/api/login"; import { getCodeImg, register } from "@/api/login"
export default { export default {
name: "Register", name: "Register",
data() { data() {
const equalToPassword = (rule, value, callback) => { const equalToPassword = (rule, value, callback) => {
if (this.registerForm.password !== value) { if (this.registerForm.password !== value) {
callback(new Error("两次输入的密码不一致")); callback(new Error("两次输入的密码不一致"))
} else { } else {
callback(); callback()
} }
}; }
return { return {
title: process.env.VUE_APP_TITLE, title: process.env.VUE_APP_TITLE,
codeUrl: "", codeUrl: "",
@ -107,44 +107,44 @@ export default {
}, },
loading: false, loading: false,
captchaEnabled: true captchaEnabled: true
}; }
}, },
created() { created() {
this.getCode(); this.getCode()
}, },
methods: { methods: {
getCode() { getCode() {
getCodeImg().then(res => { getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled; this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
if (this.captchaEnabled) { if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img; this.codeUrl = "data:image/gif;base64," + res.img
this.registerForm.uuid = res.uuid; this.registerForm.uuid = res.uuid
} }
}); })
}, },
handleRegister() { handleRegister() {
this.$refs.registerForm.validate(valid => { this.$refs.registerForm.validate(valid => {
if (valid) { if (valid) {
this.loading = true; this.loading = true
register(this.registerForm).then(res => { register(this.registerForm).then(res => {
const username = this.registerForm.username; const username = this.registerForm.username
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', { this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
type: 'success' type: 'success'
}).then(() => { }).then(() => {
this.$router.push("/login"); this.$router.push("/login")
}).catch(() => {}); }).catch(() => {})
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false
if (this.captchaEnabled) { if (this.captchaEnabled) {
this.getCode(); this.getCode()
} }
}) })
} }
}); })
} }
} }
}; }
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">

View File

@ -181,7 +181,7 @@
</template> </template>
<script> <script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config"; import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config"
export default { export default {
name: "Config", name: "Config",
@ -230,26 +230,26 @@ export default {
{ required: true, message: "参数键值不能为空", trigger: "blur" } { required: true, message: "参数键值不能为空", trigger: "blur" }
] ]
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询参数列表 */ /** 查询参数列表 */
getList() { getList() {
this.loading = true; this.loading = true
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.configList = response.rows; this.configList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -260,25 +260,25 @@ export default {
configValue: undefined, configValue: undefined,
configType: "Y", configType: "Y",
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加参数"; this.title = "添加参数"
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -288,13 +288,13 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const configId = row.configId || this.ids const configId = row.configId || this.ids
getConfig(configId).then(response => { getConfig(configId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改参数"; this.title = "修改参数"
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
@ -302,29 +302,29 @@ export default {
if (valid) { if (valid) {
if (this.form.configId != undefined) { if (this.form.configId != undefined) {
updateConfig(this.form).then(response => { updateConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addConfig(this.form).then(response => { addConfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const configIds = row.configId || this.ids; const configIds = row.configId || this.ids
this.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function() {
return delConfig(configIds); return delConfig(configIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -335,9 +335,9 @@ export default {
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache() { handleRefreshCache() {
refreshCache().then(() => { refreshCache().then(() => {
this.$modal.msgSuccess("刷新成功"); this.$modal.msgSuccess("刷新成功")
}); })
} }
} }
}; }
</script> </script>

View File

@ -158,9 +158,9 @@
</template> </template>
<script> <script>
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"
export default { export default {
name: "Dept", name: "Dept",
@ -217,35 +217,35 @@ export default {
} }
] ]
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询部门列表 */ /** 查询部门列表 */
getList() { getList() {
this.loading = true; this.loading = true
listDept(this.queryParams).then(response => { listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "deptId"); this.deptList = this.handleTree(response.data, "deptId")
this.loading = false; this.loading = false
}); })
}, },
/** 转换部门数据结构 */ /** 转换部门数据结构 */
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children
} }
return { return {
id: node.deptId, id: node.deptId,
label: node.deptName, label: node.deptName,
children: node.children children: node.children
}; }
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -258,49 +258,53 @@ export default {
phone: undefined, phone: undefined,
email: undefined, email: undefined,
status: "0" status: "0"
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd(row) { handleAdd(row) {
this.reset(); this.reset()
if (row != undefined) { if (row != undefined) {
this.form.parentId = row.deptId; this.form.parentId = row.deptId
} }
this.open = true; this.open = true
this.title = "添加部门"; this.title = "添加部门"
listDept().then(response => { listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "deptId"); this.deptOptions = this.handleTree(response.data, "deptId")
}); })
}, },
/** 展开/折叠操作 */ /** 展开/折叠操作 */
toggleExpandAll() { toggleExpandAll() {
this.refreshTable = false; this.refreshTable = false
this.isExpandAll = !this.isExpandAll; this.isExpandAll = !this.isExpandAll
this.$nextTick(() => { this.$nextTick(() => {
this.refreshTable = true; this.refreshTable = true
}); })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
getDept(row.deptId).then(response => { getDept(row.deptId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改部门"; this.title = "修改部门"
}); listDeptExcludeChild(row.deptId).then(response => {
listDeptExcludeChild(row.deptId).then(response => { this.deptOptions = this.handleTree(response.data, "deptId")
this.deptOptions = this.handleTree(response.data, "deptId"); if (this.deptOptions.length == 0) {
}); const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] }
this.deptOptions.push(noResultsOptions)
}
})
})
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
@ -308,29 +312,29 @@ export default {
if (valid) { if (valid) {
if (this.form.deptId != undefined) { if (this.form.deptId != undefined) {
updateDept(this.form).then(response => { updateDept(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addDept(this.form).then(response => { addDept(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {
return delDept(row.deptId); return delDept(row.deptId)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
} }
} }
}; }
</script> </script>

View File

@ -190,8 +190,8 @@
</template> </template>
<script> <script>
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"; import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"
import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type"; import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type"
export default { export default {
name: "Data", name: "Data",
@ -269,41 +269,41 @@ export default {
{ required: true, message: "数据顺序不能为空", trigger: "blur" } { required: true, message: "数据顺序不能为空", trigger: "blur" }
] ]
} }
}; }
}, },
created() { created() {
const dictId = this.$route.params && this.$route.params.dictId; const dictId = this.$route.params && this.$route.params.dictId
this.getType(dictId); this.getType(dictId)
this.getTypeList(); this.getTypeList()
}, },
methods: { methods: {
/** 查询字典类型详细 */ /** 查询字典类型详细 */
getType(dictId) { getType(dictId) {
getType(dictId).then(response => { getType(dictId).then(response => {
this.queryParams.dictType = response.data.dictType; this.queryParams.dictType = response.data.dictType
this.defaultDictType = response.data.dictType; this.defaultDictType = response.data.dictType
this.getList(); this.getList()
}); })
}, },
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getTypeList() { getTypeList() {
getDictOptionselect().then(response => { getDictOptionselect().then(response => {
this.typeOptions = response.data; this.typeOptions = response.data
}); })
}, },
/** 查询字典数据列表 */ /** 查询字典数据列表 */
getList() { getList() {
this.loading = true; this.loading = true
listData(this.queryParams).then(response => { listData(this.queryParams).then(response => {
this.dataList = response.rows; this.dataList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -316,31 +316,31 @@ export default {
dictSort: 0, dictSort: 0,
status: "0", status: "0",
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 返回按钮操作 */ /** 返回按钮操作 */
handleClose() { handleClose() {
const obj = { path: "/system/dict" }; const obj = { path: "/system/dict" }
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj)
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm")
this.queryParams.dictType = this.defaultDictType; this.queryParams.dictType = this.defaultDictType
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加字典数据"; this.title = "添加字典数据"
this.form.dictType = this.queryParams.dictType; this.form.dictType = this.queryParams.dictType
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -350,13 +350,13 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const dictCode = row.dictCode || this.ids const dictCode = row.dictCode || this.ids
getData(dictCode).then(response => { getData(dictCode).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改字典数据"; this.title = "修改字典数据"
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
@ -364,32 +364,32 @@ export default {
if (valid) { if (valid) {
if (this.form.dictCode != undefined) { if (this.form.dictCode != undefined) {
updateData(this.form).then(response => { updateData(this.form).then(response => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType); this.$store.dispatch('dict/removeDict', this.queryParams.dictType)
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addData(this.form).then(response => { addData(this.form).then(response => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType); this.$store.dispatch('dict/removeDict', this.queryParams.dictType)
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const dictCodes = row.dictCode || this.ids; const dictCodes = row.dictCode || this.ids
this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() {
return delData(dictCodes); return delData(dictCodes)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
this.$store.dispatch('dict/removeDict', this.queryParams.dictType); this.$store.dispatch('dict/removeDict', this.queryParams.dictType)
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -398,5 +398,5 @@ export default {
}, `data_${new Date().getTime()}.xlsx`) }, `data_${new Date().getTime()}.xlsx`)
} }
} }
}; }
</script> </script>

View File

@ -188,7 +188,7 @@
</template> </template>
<script> <script>
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"; import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"
export default { export default {
name: "Dict", name: "Dict",
@ -234,26 +234,26 @@ export default {
{ required: true, message: "字典类型不能为空", trigger: "blur" } { required: true, message: "字典类型不能为空", trigger: "blur" }
] ]
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getList() { getList() {
this.loading = true; this.loading = true
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.typeList = response.rows; this.typeList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -263,25 +263,25 @@ export default {
dictType: undefined, dictType: undefined,
status: "0", status: "0",
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加字典类型"; this.title = "添加字典类型"
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -291,13 +291,13 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const dictId = row.dictId || this.ids const dictId = row.dictId || this.ids
getType(dictId).then(response => { getType(dictId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改字典类型"; this.title = "修改字典类型"
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
@ -305,29 +305,29 @@ export default {
if (valid) { if (valid) {
if (this.form.dictId != undefined) { if (this.form.dictId != undefined) {
updateType(this.form).then(response => { updateType(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addType(this.form).then(response => { addType(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const dictIds = row.dictId || this.ids; const dictIds = row.dictId || this.ids
this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
return delType(dictIds); return delType(dictIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -338,10 +338,10 @@ export default {
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache() { handleRefreshCache() {
refreshCache().then(() => { refreshCache().then(() => {
this.$modal.msgSuccess("刷新成功"); this.$modal.msgSuccess("刷新成功")
this.$store.dispatch('dict/cleanDict'); this.$store.dispatch('dict/cleanDict')
}); })
} }
} }
}; }
</script> </script>

View File

@ -127,7 +127,7 @@
</template> </template>
<script> <script>
import { list, delLogininfor, cleanLogininfor, unlockLogininfor } from "@/api/system/logininfor"; import { list, delLogininfor, cleanLogininfor, unlockLogininfor } from "@/api/system/logininfor"
export default { export default {
name: "Logininfor", name: "Logininfor",
@ -162,32 +162,32 @@ export default {
userName: undefined, userName: undefined,
status: undefined status: undefined
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询登录日志列表 */ /** 查询登录日志列表 */
getList() { getList() {
this.loading = true; this.loading = true
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.list = response.rows; this.list = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm("queryForm")
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
}, },
/** 多选框选中数据 */ /** 多选框选中数据 */
@ -195,41 +195,41 @@ export default {
this.ids = selection.map(item => item.infoId) this.ids = selection.map(item => item.infoId)
this.single = selection.length!=1 this.single = selection.length!=1
this.multiple = !selection.length this.multiple = !selection.length
this.selectName = selection.map(item => item.userName); this.selectName = selection.map(item => item.userName)
}, },
/** 排序触发事件 */ /** 排序触发事件 */
handleSortChange(column, prop, order) { handleSortChange(column, prop, order) {
this.queryParams.orderByColumn = column.prop; this.queryParams.orderByColumn = column.prop
this.queryParams.isAsc = column.order; this.queryParams.isAsc = column.order
this.getList(); this.getList()
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const infoIds = row.infoId || this.ids; const infoIds = row.infoId || this.ids
this.$modal.confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?').then(function() {
return delLogininfor(infoIds); return delLogininfor(infoIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 清空按钮操作 */ /** 清空按钮操作 */
handleClean() { handleClean() {
this.$modal.confirm('是否确认清空所有登录日志数据项?').then(function() { this.$modal.confirm('是否确认清空所有登录日志数据项?').then(function() {
return cleanLogininfor(); return cleanLogininfor()
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("清空成功"); this.$modal.msgSuccess("清空成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 解锁按钮操作 */ /** 解锁按钮操作 */
handleUnlock() { handleUnlock() {
const username = this.selectName; const username = this.selectName
this.$modal.confirm('是否确认解锁用户"' + username + '"数据项?').then(function() { this.$modal.confirm('是否确认解锁用户"' + username + '"数据项?').then(function() {
return unlockLogininfor(username); return unlockLogininfor(username)
}).then(() => { }).then(() => {
this.$modal.msgSuccess("用户" + username + "解锁成功"); this.$modal.msgSuccess("用户" + username + "解锁成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -238,6 +238,6 @@ export default {
}, `logininfor_${new Date().getTime()}.xlsx`) }, `logininfor_${new Date().getTime()}.xlsx`)
} }
} }
}; }
</script> </script>

View File

@ -299,10 +299,10 @@
</template> </template>
<script> <script>
import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu"; import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu"
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"
import IconSelect from "@/components/IconSelect"; import IconSelect from "@/components/IconSelect"
export default { export default {
name: "Menu", name: "Menu",
@ -345,48 +345,48 @@ export default {
{ required: true, message: "路由地址不能为空", trigger: "blur" } { required: true, message: "路由地址不能为空", trigger: "blur" }
] ]
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
// //
selected(name) { selected(name) {
this.form.icon = name; this.form.icon = name
}, },
/** 查询菜单列表 */ /** 查询菜单列表 */
getList() { getList() {
this.loading = true; this.loading = true
listMenu(this.queryParams).then(response => { listMenu(this.queryParams).then(response => {
this.menuList = this.handleTree(response.data, "menuId"); this.menuList = this.handleTree(response.data, "menuId")
this.loading = false; this.loading = false
}); })
}, },
/** 转换菜单数据结构 */ /** 转换菜单数据结构 */
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children
} }
return { return {
id: node.menuId, id: node.menuId,
label: node.menuName, label: node.menuName,
children: node.children children: node.children
}; }
}, },
/** 查询菜单下拉树结构 */ /** 查询菜单下拉树结构 */
getTreeselect() { getTreeselect() {
listMenu().then(response => { listMenu().then(response => {
this.menuOptions = []; this.menuOptions = []
const menu = { menuId: 0, menuName: '主类目', children: [] }; const menu = { menuId: 0, menuName: '主类目', children: [] }
menu.children = this.handleTree(response.data, "menuId"); menu.children = this.handleTree(response.data, "menuId")
this.menuOptions.push(menu); this.menuOptions.push(menu)
}); })
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -401,47 +401,47 @@ export default {
isCache: "0", isCache: "0",
visible: "0", visible: "0",
status: "0" status: "0"
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd(row) { handleAdd(row) {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
if (row != null && row.menuId) { if (row != null && row.menuId) {
this.form.parentId = row.menuId; this.form.parentId = row.menuId
} else { } else {
this.form.parentId = 0; this.form.parentId = 0
} }
this.open = true; this.open = true
this.title = "添加菜单"; this.title = "添加菜单"
}, },
/** 展开/折叠操作 */ /** 展开/折叠操作 */
toggleExpandAll() { toggleExpandAll() {
this.refreshTable = false; this.refreshTable = false
this.isExpandAll = !this.isExpandAll; this.isExpandAll = !this.isExpandAll
this.$nextTick(() => { this.$nextTick(() => {
this.refreshTable = true; this.refreshTable = true
}); })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
getMenu(row.menuId).then(response => { getMenu(row.menuId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改菜单"; this.title = "修改菜单"
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
@ -449,29 +449,29 @@ export default {
if (valid) { if (valid) {
if (this.form.menuId != undefined) { if (this.form.menuId != undefined) {
updateMenu(this.form).then(response => { updateMenu(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addMenu(this.form).then(response => { addMenu(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?').then(function() {
return delMenu(row.menuId); return delMenu(row.menuId)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
} }
} }
}; }
</script> </script>

View File

@ -170,7 +170,7 @@
</template> </template>
<script> <script>
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"; import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
export default { export default {
name: "Notice", name: "Notice",
@ -214,25 +214,25 @@ export default {
{ required: true, message: "公告类型不能为空", trigger: "change" } { required: true, message: "公告类型不能为空", trigger: "change" }
] ]
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询公告列表 */ /** 查询公告列表 */
getList() { getList() {
this.loading = true; this.loading = true
listNotice(this.queryParams).then(response => { listNotice(this.queryParams).then(response => {
this.noticeList = response.rows; this.noticeList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -242,18 +242,18 @@ export default {
noticeType: undefined, noticeType: undefined,
noticeContent: undefined, noticeContent: undefined,
status: "0" status: "0"
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -263,19 +263,19 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加公告"; this.title = "添加公告"
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const noticeId = row.noticeId || this.ids const noticeId = row.noticeId || this.ids
getNotice(noticeId).then(response => { getNotice(noticeId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改公告"; this.title = "修改公告"
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
@ -283,30 +283,30 @@ export default {
if (valid) { if (valid) {
if (this.form.noticeId != undefined) { if (this.form.noticeId != undefined) {
updateNotice(this.form).then(response => { updateNotice(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addNotice(this.form).then(response => { addNotice(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const noticeIds = row.noticeId || this.ids const noticeIds = row.noticeId || this.ids
this.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() {
return delNotice(noticeIds); return delNotice(noticeIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
} }
} }
}; }
</script> </script>

View File

@ -207,7 +207,7 @@
</template> </template>
<script> <script>
import { list, delOperlog, cleanOperlog } from "@/api/system/operlog"; import { list, delOperlog, cleanOperlog } from "@/api/system/operlog"
export default { export default {
name: "Operlog", name: "Operlog",
@ -244,36 +244,36 @@ export default {
businessType: undefined, businessType: undefined,
status: undefined status: undefined
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询登录日志 */ /** 查询登录日志 */
getList() { getList() {
this.loading = true; this.loading = true
list(this.addDateRange(this.queryParams, this.dateRange)).then( response => { list(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
this.list = response.rows; this.list = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
typeFormat(row, column) { typeFormat(row, column) {
return this.selectDictLabel(this.dict.type.sys_oper_type, row.businessType); return this.selectDictLabel(this.dict.type.sys_oper_type, row.businessType)
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm("queryForm")
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
}, },
/** 多选框选中数据 */ /** 多选框选中数据 */
@ -283,33 +283,33 @@ export default {
}, },
/** 排序触发事件 */ /** 排序触发事件 */
handleSortChange(column, prop, order) { handleSortChange(column, prop, order) {
this.queryParams.orderByColumn = column.prop; this.queryParams.orderByColumn = column.prop
this.queryParams.isAsc = column.order; this.queryParams.isAsc = column.order
this.getList(); this.getList()
}, },
/** 详细按钮操作 */ /** 详细按钮操作 */
handleView(row) { handleView(row) {
this.open = true; this.open = true
this.form = row; this.form = row
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const operIds = row.operId || this.ids; const operIds = row.operId || this.ids
this.$modal.confirm('是否确认删除日志编号为"' + operIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除日志编号为"' + operIds + '"的数据项?').then(function() {
return delOperlog(operIds); return delOperlog(operIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 清空按钮操作 */ /** 清空按钮操作 */
handleClean() { handleClean() {
this.$modal.confirm('是否确认清空所有操作日志数据项?').then(function() { this.$modal.confirm('是否确认清空所有操作日志数据项?').then(function() {
return cleanOperlog(); return cleanOperlog()
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("清空成功"); this.$modal.msgSuccess("清空成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -318,6 +318,6 @@ export default {
}, `operlog_${new Date().getTime()}.xlsx`) }, `operlog_${new Date().getTime()}.xlsx`)
} }
} }
}; }
</script> </script>

View File

@ -157,7 +157,7 @@
</template> </template>
<script> <script>
import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post"; import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post"
export default { export default {
name: "Post", name: "Post",
@ -204,25 +204,25 @@ export default {
{ required: true, message: "岗位顺序不能为空", trigger: "blur" } { required: true, message: "岗位顺序不能为空", trigger: "blur" }
] ]
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询岗位列表 */ /** 查询岗位列表 */
getList() { getList() {
this.loading = true; this.loading = true
listPost(this.queryParams).then(response => { listPost(this.queryParams).then(response => {
this.postList = response.rows; this.postList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -233,18 +233,18 @@ export default {
postSort: 0, postSort: 0,
status: "0", status: "0",
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -254,19 +254,19 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加岗位"; this.title = "添加岗位"
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const postId = row.postId || this.ids const postId = row.postId || this.ids
getPost(postId).then(response => { getPost(postId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改岗位"; this.title = "修改岗位"
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
@ -274,29 +274,29 @@ export default {
if (valid) { if (valid) {
if (this.form.postId != undefined) { if (this.form.postId != undefined) {
updatePost(this.form).then(response => { updatePost(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addPost(this.form).then(response => { addPost(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const postIds = row.postId || this.ids; const postIds = row.postId || this.ids
this.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?').then(function() {
return delPost(postIds); return delPost(postIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -305,5 +305,5 @@ export default {
}, `post_${new Date().getTime()}.xlsx`) }, `post_${new Date().getTime()}.xlsx`)
} }
} }
}; }
</script> </script>

View File

@ -100,8 +100,8 @@
</template> </template>
<script> <script>
import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role"; import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role"
import selectUser from "./selectUser"; import selectUser from "./selectUser"
export default { export default {
name: "AuthUser", name: "AuthUser",
@ -129,40 +129,40 @@ export default {
userName: undefined, userName: undefined,
phonenumber: undefined phonenumber: undefined
} }
}; }
}, },
created() { created() {
const roleId = this.$route.params && this.$route.params.roleId; const roleId = this.$route.params && this.$route.params.roleId
if (roleId) { if (roleId) {
this.queryParams.roleId = roleId; this.queryParams.roleId = roleId
this.getList(); this.getList()
} }
}, },
methods: { methods: {
/** 查询授权用户列表 */ /** 查询授权用户列表 */
getList() { getList() {
this.loading = true; this.loading = true
allocatedUserList(this.queryParams).then(response => { allocatedUserList(this.queryParams).then(response => {
this.userList = response.rows; this.userList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
handleClose() { handleClose() {
const obj = { path: "/system/role" }; const obj = { path: "/system/role" }
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj)
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -171,29 +171,29 @@ export default {
}, },
/** 打开授权用户表弹窗 */ /** 打开授权用户表弹窗 */
openSelectUser() { openSelectUser() {
this.$refs.select.show(); this.$refs.select.show()
}, },
/** 取消授权按钮操作 */ /** 取消授权按钮操作 */
cancelAuthUser(row) { cancelAuthUser(row) {
const roleId = this.queryParams.roleId; const roleId = this.queryParams.roleId
this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function() { this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function() {
return authUserCancel({ userId: row.userId, roleId: roleId }); return authUserCancel({ userId: row.userId, roleId: roleId })
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("取消授权成功"); this.$modal.msgSuccess("取消授权成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 批量取消授权按钮操作 */ /** 批量取消授权按钮操作 */
cancelAuthUserAll(row) { cancelAuthUserAll(row) {
const roleId = this.queryParams.roleId; const roleId = this.queryParams.roleId
const userIds = this.userIds.join(","); const userIds = this.userIds.join(",")
this.$modal.confirm('是否取消选中用户授权数据项?').then(function() { this.$modal.confirm('是否取消选中用户授权数据项?').then(function() {
return authUserCancelAll({ roleId: roleId, userIds: userIds }); return authUserCancelAll({ roleId: roleId, userIds: userIds })
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("取消授权成功"); this.$modal.msgSuccess("取消授权成功")
}).catch(() => {}); }).catch(() => {})
} }
} }
}; }
</script> </script>

View File

@ -252,8 +252,8 @@
</template> </template>
<script> <script>
import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role"; import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role"
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"; import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"
export default { export default {
name: "Role", name: "Role",
@ -339,85 +339,85 @@ export default {
{ required: true, message: "角色顺序不能为空", trigger: "blur" } { required: true, message: "角色顺序不能为空", trigger: "blur" }
] ]
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询角色列表 */ /** 查询角色列表 */
getList() { getList() {
this.loading = true; this.loading = true
listRole(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listRole(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.roleList = response.rows; this.roleList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
/** 查询菜单树结构 */ /** 查询菜单树结构 */
getMenuTreeselect() { getMenuTreeselect() {
menuTreeselect().then(response => { menuTreeselect().then(response => {
this.menuOptions = response.data; this.menuOptions = response.data
}); })
}, },
// //
getMenuAllCheckedKeys() { getMenuAllCheckedKeys() {
// //
let checkedKeys = this.$refs.menu.getCheckedKeys(); let checkedKeys = this.$refs.menu.getCheckedKeys()
// //
let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys(); let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys); checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return checkedKeys; return checkedKeys
}, },
// //
getDeptAllCheckedKeys() { getDeptAllCheckedKeys() {
// //
let checkedKeys = this.$refs.dept.getCheckedKeys(); let checkedKeys = this.$refs.dept.getCheckedKeys()
// //
let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys(); let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys); checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return checkedKeys; return checkedKeys
}, },
/** 根据角色ID查询菜单树结构 */ /** 根据角色ID查询菜单树结构 */
getRoleMenuTreeselect(roleId) { getRoleMenuTreeselect(roleId) {
return roleMenuTreeselect(roleId).then(response => { return roleMenuTreeselect(roleId).then(response => {
this.menuOptions = response.menus; this.menuOptions = response.menus
return response; return response
}); })
}, },
/** 根据角色ID查询部门树结构 */ /** 根据角色ID查询部门树结构 */
getDeptTree(roleId) { getDeptTree(roleId) {
return deptTreeSelect(roleId).then(response => { return deptTreeSelect(roleId).then(response => {
this.deptOptions = response.depts; this.deptOptions = response.depts
return response; return response
}); })
}, },
// //
handleStatusChange(row) { handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用"; let text = row.status === "0" ? "启用" : "停用"
this.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?').then(function() { this.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?').then(function() {
return changeRoleStatus(row.roleId, row.status); return changeRoleStatus(row.roleId, row.status)
}).then(() => { }).then(() => {
this.$modal.msgSuccess(text + "成功"); this.$modal.msgSuccess(text + "成功")
}).catch(function() { }).catch(function() {
row.status = row.status === "0" ? "1" : "0"; row.status = row.status === "0" ? "1" : "0"
}); })
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
cancelDataScope() { cancelDataScope() {
this.openDataScope = false; this.openDataScope = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
if (this.$refs.menu != undefined) { if (this.$refs.menu != undefined) {
this.$refs.menu.setCheckedKeys([]); this.$refs.menu.setCheckedKeys([])
} }
this.menuExpand = false, this.menuExpand = false,
this.menuNodeAll = false, this.menuNodeAll = false,
@ -434,19 +434,19 @@ export default {
menuCheckStrictly: true, menuCheckStrictly: true,
deptCheckStrictly: true, deptCheckStrictly: true,
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -458,141 +458,141 @@ export default {
handleCommand(command, row) { handleCommand(command, row) {
switch (command) { switch (command) {
case "handleDataScope": case "handleDataScope":
this.handleDataScope(row); this.handleDataScope(row)
break; break
case "handleAuthUser": case "handleAuthUser":
this.handleAuthUser(row); this.handleAuthUser(row)
break; break
default: default:
break; break
} }
}, },
// / // /
handleCheckedTreeExpand(value, type) { handleCheckedTreeExpand(value, type) {
if (type == 'menu') { if (type == 'menu') {
let treeList = this.menuOptions; let treeList = this.menuOptions
for (let i = 0; i < treeList.length; i++) { for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value; this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value
} }
} else if (type == 'dept') { } else if (type == 'dept') {
let treeList = this.deptOptions; let treeList = this.deptOptions
for (let i = 0; i < treeList.length; i++) { for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value; this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value
} }
} }
}, },
// / // /
handleCheckedTreeNodeAll(value, type) { handleCheckedTreeNodeAll(value, type) {
if (type == 'menu') { if (type == 'menu') {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []); this.$refs.menu.setCheckedNodes(value ? this.menuOptions: [])
} else if (type == 'dept') { } else if (type == 'dept') {
this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []); this.$refs.dept.setCheckedNodes(value ? this.deptOptions: [])
} }
}, },
// //
handleCheckedTreeConnect(value, type) { handleCheckedTreeConnect(value, type) {
if (type == 'menu') { if (type == 'menu') {
this.form.menuCheckStrictly = value ? true: false; this.form.menuCheckStrictly = value ? true: false
} else if (type == 'dept') { } else if (type == 'dept') {
this.form.deptCheckStrictly = value ? true: false; this.form.deptCheckStrictly = value ? true: false
} }
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.getMenuTreeselect(); this.getMenuTreeselect()
this.open = true; this.open = true
this.title = "添加角色"; this.title = "添加角色"
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const roleId = row.roleId || this.ids const roleId = row.roleId || this.ids
const roleMenu = this.getRoleMenuTreeselect(roleId); const roleMenu = this.getRoleMenuTreeselect(roleId)
getRole(roleId).then(response => { getRole(roleId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.$nextTick(() => { this.$nextTick(() => {
roleMenu.then(res => { roleMenu.then(res => {
let checkedKeys = res.checkedKeys let checkedKeys = res.checkedKeys
checkedKeys.forEach((v) => { checkedKeys.forEach((v) => {
this.$nextTick(()=>{ this.$nextTick(()=>{
this.$refs.menu.setChecked(v, true ,false); this.$refs.menu.setChecked(v, true ,false)
}) })
}) })
}); })
}); })
}); })
this.title = "修改角色"; this.title = "修改角色"
}, },
/** 选择角色权限范围触发 */ /** 选择角色权限范围触发 */
dataScopeSelectChange(value) { dataScopeSelectChange(value) {
if(value !== '2') { if(value !== '2') {
this.$refs.dept.setCheckedKeys([]); this.$refs.dept.setCheckedKeys([])
} }
}, },
/** 分配数据权限操作 */ /** 分配数据权限操作 */
handleDataScope(row) { handleDataScope(row) {
this.reset(); this.reset()
const deptTreeSelect = this.getDeptTree(row.roleId); const deptTreeSelect = this.getDeptTree(row.roleId)
getRole(row.roleId).then(response => { getRole(row.roleId).then(response => {
this.form = response.data; this.form = response.data
this.openDataScope = true; this.openDataScope = true
this.$nextTick(() => { this.$nextTick(() => {
deptTreeSelect.then(res => { deptTreeSelect.then(res => {
this.$refs.dept.setCheckedKeys(res.checkedKeys); this.$refs.dept.setCheckedKeys(res.checkedKeys)
}); })
}); })
}); })
this.title = "分配数据权限"; this.title = "分配数据权限"
}, },
/** 分配用户操作 */ /** 分配用户操作 */
handleAuthUser: function(row) { handleAuthUser: function(row) {
const roleId = row.roleId; const roleId = row.roleId
this.$router.push("/system/role-auth/user/" + roleId); this.$router.push("/system/role-auth/user/" + roleId)
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.roleId != undefined) { if (this.form.roleId != undefined) {
this.form.menuIds = this.getMenuAllCheckedKeys(); this.form.menuIds = this.getMenuAllCheckedKeys()
updateRole(this.form).then(response => { updateRole(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
this.form.menuIds = this.getMenuAllCheckedKeys(); this.form.menuIds = this.getMenuAllCheckedKeys()
addRole(this.form).then(response => { addRole(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 提交按钮(数据权限) */ /** 提交按钮(数据权限) */
submitDataScope: function() { submitDataScope: function() {
if (this.form.roleId != undefined) { if (this.form.roleId != undefined) {
this.form.deptIds = this.getDeptAllCheckedKeys(); this.form.deptIds = this.getDeptAllCheckedKeys()
dataScope(this.form).then(response => { dataScope(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.openDataScope = false; this.openDataScope = false
this.getList(); this.getList()
}); })
} }
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const roleIds = row.roleId || this.ids; const roleIds = row.roleId || this.ids
this.$modal.confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?').then(function() {
return delRole(roleIds); return delRole(roleIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -601,5 +601,5 @@ export default {
}, `role_${new Date().getTime()}.xlsx`) }, `role_${new Date().getTime()}.xlsx`)
} }
} }
}; }
</script> </script>

View File

@ -57,7 +57,7 @@
</template> </template>
<script> <script>
import { unallocatedUserList, authUserSelectAll } from "@/api/system/role"; import { unallocatedUserList, authUserSelectAll } from "@/api/system/role"
export default { export default {
dicts: ['sys_normal_disable'], dicts: ['sys_normal_disable'],
props: { props: {
@ -84,53 +84,53 @@ export default {
userName: undefined, userName: undefined,
phonenumber: undefined phonenumber: undefined
} }
}; }
}, },
methods: { methods: {
// //
show() { show() {
this.queryParams.roleId = this.roleId; this.queryParams.roleId = this.roleId
this.getList(); this.getList()
this.visible = true; this.visible = true
}, },
clickRow(row) { clickRow(row) {
this.$refs.table.toggleRowSelection(row); this.$refs.table.toggleRowSelection(row)
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.userIds = selection.map(item => item.userId); this.userIds = selection.map(item => item.userId)
}, },
// //
getList() { getList() {
unallocatedUserList(this.queryParams).then(res => { unallocatedUserList(this.queryParams).then(res => {
this.userList = res.rows; this.userList = res.rows
this.total = res.total; this.total = res.total
}); })
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
/** 选择授权用户操作 */ /** 选择授权用户操作 */
handleSelectUser() { handleSelectUser() {
const roleId = this.queryParams.roleId; const roleId = this.queryParams.roleId
const userIds = this.userIds.join(","); const userIds = this.userIds.join(",")
if (userIds == "") { if (userIds == "") {
this.$modal.msgError("请选择要分配的用户"); this.$modal.msgError("请选择要分配的用户")
return; return
} }
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => { authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
this.$modal.msgSuccess(res.msg); this.$modal.msgSuccess(res.msg)
this.visible = false; this.visible = false
this.$emit("ok"); this.$emit("ok")
}); })
} }
} }
}; }
</script> </script>

View File

@ -10,7 +10,7 @@
</el-col> </el-col>
<el-col :span="8" :offset="2"> <el-col :span="8" :offset="2">
<el-form-item label="登录账号" prop="userName"> <el-form-item label="登录账号" prop="userName">
<el-input v-model="form.userName" disabled /> <el-input v-model="form.userName" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -20,10 +20,10 @@
<el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="table" @selection-change="handleSelectionChange" :data="roles.slice((pageNum-1)*pageSize,pageNum*pageSize)"> <el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="table" @selection-change="handleSelectionChange" :data="roles.slice((pageNum-1)*pageSize,pageNum*pageSize)">
<el-table-column label="序号" type="index" align="center"> <el-table-column label="序号" type="index" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span> <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column> <el-table-column type="selection" :reserve-selection="true" :selectable="checkSelectable" width="55" />
<el-table-column label="角色编号" align="center" prop="roleId" /> <el-table-column label="角色编号" align="center" prop="roleId" />
<el-table-column label="角色名称" align="center" prop="roleName" /> <el-table-column label="角色名称" align="center" prop="roleName" />
<el-table-column label="权限字符" align="center" prop="roleKey" /> <el-table-column label="权限字符" align="center" prop="roleKey" />
@ -46,72 +46,78 @@
</template> </template>
<script> <script>
import { getAuthRole, updateAuthRole } from "@/api/system/user"; import { getAuthRole, updateAuthRole } from "@/api/system/user"
export default { export default {
name: "AuthRole", name: "AuthRole",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
total: 0, total: 0,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
// //
roleIds:[], roleIds: [],
// //
roles: [], roles: [],
// //
form: {} form: {}
}; }
}, },
created() { created() {
const userId = this.$route.params && this.$route.params.userId; const userId = this.$route.params && this.$route.params.userId
if (userId) { if (userId) {
this.loading = true; this.loading = true
getAuthRole(userId).then((response) => { getAuthRole(userId).then((response) => {
this.form = response.user; this.form = response.user
this.roles = response.roles; this.roles = response.roles
this.total = this.roles.length; this.total = this.roles.length
this.$nextTick(() => { this.$nextTick(() => {
this.roles.forEach((row) => { this.roles.forEach((row) => {
if (row.flag) { if (row.flag) {
this.$refs.table.toggleRowSelection(row); this.$refs.table.toggleRowSelection(row)
} }
}); })
}); })
this.loading = false; this.loading = false
}); })
} }
}, },
methods: { methods: {
/** 单击选中行数据 */ /** 单击选中行数据 */
clickRow(row) { clickRow(row) {
this.$refs.table.toggleRowSelection(row); if (this.checkSelectable(row)) {
this.$refs.table.toggleRowSelection(row)
}
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.roleIds = selection.map((item) => item.roleId); this.roleIds = selection.map((item) => item.roleId)
}, },
// //
getRowKey(row) { getRowKey(row) {
return row.roleId; return row.roleId
},
//
checkSelectable(row) {
return row.status === "0" ? true : false
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
const userId = this.form.userId; const userId = this.form.userId
const roleIds = this.roleIds.join(","); const roleIds = this.roleIds.join(",")
updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => { updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
this.$modal.msgSuccess("授权成功"); this.$modal.msgSuccess("授权成功")
this.close(); this.close()
}); })
}, },
/** 关闭按钮 */ /** 关闭按钮 */
close() { close() {
const obj = { path: "/system/user" }; const obj = { path: "/system/user" }
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj)
}, }
}, }
}; }
</script> </script>

View File

@ -201,12 +201,12 @@
</template> </template>
<script> <script>
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user"; import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user"
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth"
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"
import { Splitpanes, Pane } from "splitpanes"; import { Splitpanes, Pane } from "splitpanes"
import "splitpanes/dist/splitpanes.css"; import "splitpanes/dist/splitpanes.css"
export default { export default {
name: "User", name: "User",
@ -315,76 +315,76 @@ export default {
} }
] ]
} }
}; }
}, },
watch: { watch: {
// //
deptName(val) { deptName(val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val)
} }
}, },
created() { created() {
this.getList(); this.getList()
this.getDeptTree(); this.getDeptTree()
this.getConfigKey("sys.user.initPassword").then(response => { this.getConfigKey("sys.user.initPassword").then(response => {
this.initPassword = response.msg; this.initPassword = response.msg
}); })
}, },
methods: { methods: {
/** 查询用户列表 */ /** 查询用户列表 */
getList() { getList() {
this.loading = true; this.loading = true
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows; this.userList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
getDeptTree() { getDeptTree() {
deptTreeSelect().then(response => { deptTreeSelect().then(response => {
this.deptOptions = response.data; this.deptOptions = response.data
this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data))); this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
}); })
}, },
// //
filterDisabledDept(deptList) { filterDisabledDept(deptList) {
return deptList.filter(dept => { return deptList.filter(dept => {
if (dept.disabled) { if (dept.disabled) {
return false; return false
} }
if (dept.children && dept.children.length) { if (dept.children && dept.children.length) {
dept.children = this.filterDisabledDept(dept.children); dept.children = this.filterDisabledDept(dept.children)
} }
return true; return true
}); })
}, },
// //
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1
}, },
// //
handleNodeClick(data) { handleNodeClick(data) {
this.queryParams.deptId = data.id; this.queryParams.deptId = data.id
this.handleQuery(); this.handleQuery()
}, },
// //
handleStatusChange(row) { handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用"; let text = row.status === "0" ? "启用" : "停用"
this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() { this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
return changeUserStatus(row.userId, row.status); return changeUserStatus(row.userId, row.status)
}).then(() => { }).then(() => {
this.$modal.msgSuccess(text + "成功"); this.$modal.msgSuccess(text + "成功")
}).catch(function() { }).catch(function() {
row.status = row.status === "0" ? "1" : "0"; row.status = row.status === "0" ? "1" : "0"
}); })
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -401,66 +401,66 @@ export default {
remark: undefined, remark: undefined,
postIds: [], postIds: [],
roleIds: [] roleIds: []
}; }
this.resetForm("form"); this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm("queryForm")
this.queryParams.deptId = undefined; this.queryParams.deptId = undefined
this.$refs.tree.setCurrentKey(null); this.$refs.tree.setCurrentKey(null)
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.userId); this.ids = selection.map(item => item.userId)
this.single = selection.length != 1; this.single = selection.length != 1
this.multiple = !selection.length; this.multiple = !selection.length
}, },
// //
handleCommand(command, row) { handleCommand(command, row) {
switch (command) { switch (command) {
case "handleResetPwd": case "handleResetPwd":
this.handleResetPwd(row); this.handleResetPwd(row)
break; break
case "handleAuthRole": case "handleAuthRole":
this.handleAuthRole(row); this.handleAuthRole(row)
break; break
default: default:
break; break
} }
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
getUser().then(response => { getUser().then(response => {
this.postOptions = response.posts; this.postOptions = response.posts
this.roleOptions = response.roles; this.roleOptions = response.roles
this.open = true; this.open = true
this.title = "添加用户"; this.title = "添加用户"
this.form.password = this.initPassword; this.form.password = this.initPassword
}); })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const userId = row.userId || this.ids; const userId = row.userId || this.ids
getUser(userId).then(response => { getUser(userId).then(response => {
this.form = response.data; this.form = response.data
this.postOptions = response.posts; this.postOptions = response.posts
this.roleOptions = response.roles; this.roleOptions = response.roles
this.$set(this.form, "postIds", response.postIds); this.$set(this.form, "postIds", response.postIds)
this.$set(this.form, "roleIds", response.roleIds); this.$set(this.form, "roleIds", response.roleIds)
this.open = true; this.open = true
this.title = "修改用户"; this.title = "修改用户"
this.form.password = ""; this.form.password = ""
}); })
}, },
/** 重置密码按钮操作 */ /** 重置密码按钮操作 */
handleResetPwd(row) { handleResetPwd(row) {
@ -477,14 +477,14 @@ export default {
}, },
}).then(({ value }) => { }).then(({ value }) => {
resetUserPwd(row.userId, value).then(response => { resetUserPwd(row.userId, value).then(response => {
this.$modal.msgSuccess("修改成功,新密码是:" + value); this.$modal.msgSuccess("修改成功,新密码是:" + value)
}); })
}).catch(() => {}); }).catch(() => {})
}, },
/** 分配角色操作 */ /** 分配角色操作 */
handleAuthRole: function(row) { handleAuthRole: function(row) {
const userId = row.userId; const userId = row.userId
this.$router.push("/system/user-auth/role/" + userId); this.$router.push("/system/user-auth/role/" + userId)
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
@ -492,29 +492,29 @@ export default {
if (valid) { if (valid) {
if (this.form.userId != undefined) { if (this.form.userId != undefined) {
updateUser(this.form).then(response => { updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addUser(this.form).then(response => { addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功")
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const userIds = row.userId || this.ids; const userIds = row.userId || this.ids
this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() {
return delUser(userIds); return delUser(userIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -524,8 +524,8 @@ export default {
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
this.upload.title = "用户导入"; this.upload.title = "用户导入"
this.upload.open = true; this.upload.open = true
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate() { importTemplate() {
@ -534,20 +534,20 @@ export default {
}, },
// //
handleFileUploadProgress(event, file, fileList) { handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true; this.upload.isUploading = true
}, },
// //
handleFileSuccess(response, file, fileList) { handleFileSuccess(response, file, fileList) {
this.upload.open = false; this.upload.open = false
this.upload.isUploading = false; this.upload.isUploading = false
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles()
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true }); this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
this.getList(); this.getList()
}, },
// //
submitFileForm() { submitFileForm() {
this.$refs.upload.submit(); this.$refs.upload.submit()
} }
} }
}; }
</script> </script>

View File

@ -59,10 +59,10 @@
</template> </template>
<script> <script>
import userAvatar from "./userAvatar"; import userAvatar from "./userAvatar"
import userInfo from "./userInfo"; import userInfo from "./userInfo"
import resetPwd from "./resetPwd"; import resetPwd from "./resetPwd"
import { getUserProfile } from "@/api/system/user"; import { getUserProfile } from "@/api/system/user"
export default { export default {
name: "Profile", name: "Profile",
@ -73,19 +73,19 @@ export default {
roleGroup: {}, roleGroup: {},
postGroup: {}, postGroup: {},
activeTab: "userinfo" activeTab: "userinfo"
}; }
}, },
created() { created() {
this.getUser(); this.getUser()
}, },
methods: { methods: {
getUser() { getUser() {
getUserProfile().then(response => { getUserProfile().then(response => {
this.user = response.data; this.user = response.data
this.roleGroup = response.roleGroup; this.roleGroup = response.roleGroup
this.postGroup = response.postGroup; this.postGroup = response.postGroup
}); })
} }
} }
}; }
</script> </script>

View File

@ -17,17 +17,17 @@
</template> </template>
<script> <script>
import { updateUserPwd } from "@/api/system/user"; import { updateUserPwd } from "@/api/system/user"
export default { export default {
data() { data() {
const equalToPassword = (rule, value, callback) => { const equalToPassword = (rule, value, callback) => {
if (this.user.newPassword !== value) { if (this.user.newPassword !== value) {
callback(new Error("两次输入的密码不一致")); callback(new Error("两次输入的密码不一致"))
} else { } else {
callback(); callback()
} }
}; }
return { return {
user: { user: {
oldPassword: undefined, oldPassword: undefined,
@ -49,21 +49,21 @@ export default {
{ required: true, validator: equalToPassword, trigger: "blur" } { required: true, validator: equalToPassword, trigger: "blur" }
] ]
} }
}; }
}, },
methods: { methods: {
submit() { submit() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => { updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
}); })
} }
}); })
}, },
close() { close() {
this.$tab.closePage(); this.$tab.closePage()
} }
} }
}; }
</script> </script>

View File

@ -54,9 +54,9 @@
</template> </template>
<script> <script>
import store from "@/store"; import store from "@/store"
import { VueCropper } from "vue-cropper"; import { VueCropper } from "vue-cropper"
import { uploadAvatar } from "@/api/system/user"; import { uploadAvatar } from "@/api/system/user"
import { debounce } from '@/utils' import { debounce } from '@/utils'
export default { export default {
@ -80,16 +80,16 @@ export default {
}, },
previews: {}, previews: {},
resizeHandler: null resizeHandler: null
}; }
}, },
methods: { methods: {
// //
editCropper() { editCropper() {
this.open = true; this.open = true
}, },
// //
modalOpened() { modalOpened() {
this.visible = true; this.visible = true
if (!this.resizeHandler) { if (!this.resizeHandler) {
this.resizeHandler = debounce(() => { this.resizeHandler = debounce(() => {
this.refresh() this.refresh()
@ -99,63 +99,63 @@ export default {
}, },
// //
refresh() { refresh() {
this.$refs.cropper.refresh(); this.$refs.cropper.refresh()
}, },
// //
requestUpload() { requestUpload() {
}, },
// //
rotateLeft() { rotateLeft() {
this.$refs.cropper.rotateLeft(); this.$refs.cropper.rotateLeft()
}, },
// //
rotateRight() { rotateRight() {
this.$refs.cropper.rotateRight(); this.$refs.cropper.rotateRight()
}, },
// //
changeScale(num) { changeScale(num) {
num = num || 1; num = num || 1
this.$refs.cropper.changeScale(num); this.$refs.cropper.changeScale(num)
}, },
// //
beforeUpload(file) { beforeUpload(file) {
if (file.type.indexOf("image/") == -1) { if (file.type.indexOf("image/") == -1) {
this.$modal.msgError("文件格式错误,请上传图片类型,如JPGPNG后缀的文件。"); this.$modal.msgError("文件格式错误,请上传图片类型,如JPGPNG后缀的文件。")
} else { } else {
const reader = new FileReader(); const reader = new FileReader()
reader.readAsDataURL(file); reader.readAsDataURL(file)
reader.onload = () => { reader.onload = () => {
this.options.img = reader.result; this.options.img = reader.result
this.options.filename = file.name; this.options.filename = file.name
}; }
} }
}, },
// //
uploadImg() { uploadImg() {
this.$refs.cropper.getCropBlob(data => { this.$refs.cropper.getCropBlob(data => {
let formData = new FormData(); let formData = new FormData()
formData.append("avatarfile", data, this.options.filename); formData.append("avatarfile", data, this.options.filename)
uploadAvatar(formData).then(response => { uploadAvatar(formData).then(response => {
this.open = false; this.open = false
this.options.img = response.imgUrl; this.options.img = response.imgUrl
store.commit('SET_AVATAR', this.options.img); store.commit('SET_AVATAR', this.options.img)
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.visible = false; this.visible = false
}); })
}); })
}, },
// //
realTime(data) { realTime(data) {
this.previews = data; this.previews = data
}, },
// //
closeDialog() { closeDialog() {
this.options.img = store.getters.avatar this.options.img = store.getters.avatar
this.visible = false; this.visible = false
window.removeEventListener("resize", this.resizeHandler) window.removeEventListener("resize", this.resizeHandler)
} }
} }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.user-info-head { .user-info-head {

View File

@ -23,7 +23,7 @@
</template> </template>
<script> <script>
import { updateUserProfile } from "@/api/system/user"; import { updateUserProfile } from "@/api/system/user"
export default { export default {
props: { props: {
@ -56,13 +56,13 @@ export default {
} }
] ]
} }
}; }
}, },
watch: { watch: {
user: { user: {
handler(user) { handler(user) {
if (user) { if (user) {
this.form = { nickName: user.nickName, phonenumber: user.phonenumber, email: user.email, sex: user.sex }; this.form = { nickName: user.nickName, phonenumber: user.phonenumber, email: user.email, sex: user.sex }
} }
}, },
immediate: true immediate: true
@ -73,16 +73,16 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
updateUserProfile(this.form).then(response => { updateUserProfile(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功")
this.user.phonenumber = this.form.phonenumber; this.user.phonenumber = this.form.phonenumber
this.user.email = this.form.email; this.user.email = this.form.email
}); })
} }
}); })
}, },
close() { close() {
this.$tab.closePage(); this.$tab.closePage()
} }
} }
}; }
</script> </script>

View File

@ -54,7 +54,7 @@ export default {
{ required: true, message: "请输入作者", trigger: "blur" } { required: true, message: "请输入作者", trigger: "blur" }
] ]
} }
}; }
} }
}; }
</script> </script>

View File

@ -6,13 +6,8 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="字段信息" name="columnInfo"> <el-tab-pane label="字段信息" name="columnInfo">
<el-table ref="dragTable" :data="columns" row-key="columnId" :max-height="tableHeight"> <el-table ref="dragTable" :data="columns" row-key="columnId" :max-height="tableHeight">
<el-table-column label="序号" type="index" min-width="5%" class-name="allowDrag" /> <el-table-column label="序号" type="index" min-width="5%" class-name="allowDrag"/>
<el-table-column <el-table-column label="字段列名" prop="columnName" min-width="10%" :show-overflow-tooltip="true" class-name="allowDrag"/>
label="字段列名"
prop="columnName"
min-width="10%"
:show-overflow-tooltip="true"
/>
<el-table-column label="字段描述" min-width="10%"> <el-table-column label="字段描述" min-width="10%">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.columnComment"></el-input> <el-input v-model="scope.row.columnComment"></el-input>
@ -127,11 +122,11 @@
</template> </template>
<script> <script>
import { getGenTable, updateGenTable } from "@/api/tool/gen"; import { getGenTable, updateGenTable } from "@/api/tool/gen"
import { optionselect as getDictOptionselect } from "@/api/system/dict/type"; import { optionselect as getDictOptionselect } from "@/api/system/dict/type"
import { listMenu as getMenuTreeselect } from "@/api/system/menu"; import { listMenu as getMenuTreeselect } from "@/api/system/menu"
import basicInfoForm from "./basicInfoForm"; import basicInfoForm from "./basicInfoForm"
import genInfoForm from "./genInfoForm"; import genInfoForm from "./genInfoForm"
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
export default { export default {
@ -156,79 +151,79 @@ export default {
menus: [], menus: [],
// //
info: {} info: {}
}; }
}, },
created() { created() {
const tableId = this.$route.params && this.$route.params.tableId; const tableId = this.$route.params && this.$route.params.tableId
if (tableId) { if (tableId) {
// //
getGenTable(tableId).then(res => { getGenTable(tableId).then(res => {
this.columns = res.data.rows; this.columns = res.data.rows
this.info = res.data.info; this.info = res.data.info
this.tables = res.data.tables; this.tables = res.data.tables
}); })
/** 查询字典下拉列表 */ /** 查询字典下拉列表 */
getDictOptionselect().then(response => { getDictOptionselect().then(response => {
this.dictOptions = response.data; this.dictOptions = response.data
}); })
/** 查询菜单下拉列表 */ /** 查询菜单下拉列表 */
getMenuTreeselect().then(response => { getMenuTreeselect().then(response => {
this.menus = this.handleTree(response.data, "menuId"); this.menus = this.handleTree(response.data, "menuId")
}); })
} }
}, },
methods: { methods: {
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm; const basicForm = this.$refs.basicInfo.$refs.basicInfoForm
const genForm = this.$refs.genInfo.$refs.genInfoForm; const genForm = this.$refs.genInfo.$refs.genInfoForm
Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => { Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => {
const validateResult = res.every(item => !!item); const validateResult = res.every(item => !!item)
if (validateResult) { if (validateResult) {
const genTable = Object.assign({}, basicForm.model, genForm.model); const genTable = Object.assign({}, basicForm.model, genForm.model)
genTable.columns = this.columns; genTable.columns = this.columns
genTable.params = { genTable.params = {
treeCode: genTable.treeCode, treeCode: genTable.treeCode,
treeName: genTable.treeName, treeName: genTable.treeName,
treeParentCode: genTable.treeParentCode, treeParentCode: genTable.treeParentCode,
parentMenuId: genTable.parentMenuId parentMenuId: genTable.parentMenuId
}; }
updateGenTable(genTable).then(res => { updateGenTable(genTable).then(res => {
this.$modal.msgSuccess(res.msg); this.$modal.msgSuccess(res.msg)
if (res.code === 200) { if (res.code === 200) {
this.close(); this.close()
} }
}); })
} else { } else {
this.$modal.msgError("表单校验未通过,请重新检查提交内容"); this.$modal.msgError("表单校验未通过,请重新检查提交内容")
} }
}); })
}, },
getFormPromise(form) { getFormPromise(form) {
return new Promise(resolve => { return new Promise(resolve => {
form.validate(res => { form.validate(res => {
resolve(res); resolve(res)
}); })
}); })
}, },
/** 关闭按钮 */ /** 关闭按钮 */
close() { close() {
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: this.$route.query.pageNum } }; const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: this.$route.query.pageNum } }
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj)
} }
}, },
mounted() { mounted() {
const el = this.$refs.dragTable.$el.querySelectorAll(".el-table__body-wrapper > table > tbody")[0]; const el = this.$refs.dragTable.$el.querySelectorAll(".el-table__body-wrapper > table > tbody")[0]
const sortable = Sortable.create(el, { const sortable = Sortable.create(el, {
handle: ".allowDrag", handle: ".allowDrag",
onEnd: evt => { onEnd: evt => {
const targetRow = this.columns.splice(evt.oldIndex, 1)[0]; const targetRow = this.columns.splice(evt.oldIndex, 1)[0]
this.columns.splice(evt.newIndex, 0, targetRow); this.columns.splice(evt.newIndex, 0, targetRow)
for (let index in this.columns) { for (let index in this.columns) {
this.columns[index].sort = parseInt(index) + 1; this.columns[index].sort = parseInt(index) + 1
} }
} }
}); })
} }
}; }
</script> </script>

View File

@ -223,8 +223,8 @@
</template> </template>
<script> <script>
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"
export default { export default {
components: { Treeselect }, components: { Treeselect },
@ -240,7 +240,7 @@ export default {
menus: { menus: {
type: Array, type: Array,
default: [] default: []
}, }
}, },
data() { data() {
return { return {
@ -260,17 +260,17 @@ export default {
], ],
functionName: [ functionName: [
{ required: true, message: "请输入生成功能名", trigger: "blur" } { required: true, message: "请输入生成功能名", trigger: "blur" }
], ]
} }
}; }
}, },
watch: { watch: {
'info.subTableName': function(val) { 'info.subTableName': function(val) {
this.setSubTableColumns(val); this.setSubTableColumns(val)
}, },
'info.tplWebType': function(val) { 'info.tplWebType': function(val) {
if (val === '') { if (val === '') {
this.info.tplWebType = "element-ui"; this.info.tplWebType = "element-ui"
} }
} }
}, },
@ -278,35 +278,35 @@ export default {
/** 转换菜单数据结构 */ /** 转换菜单数据结构 */
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children
} }
return { return {
id: node.menuId, id: node.menuId,
label: node.menuName, label: node.menuName,
children: node.children children: node.children
}; }
}, },
/** 选择子表名触发 */ /** 选择子表名触发 */
subSelectChange(value) { subSelectChange(value) {
this.info.subTableFkName = ''; this.info.subTableFkName = ''
}, },
/** 选择生成模板触发 */ /** 选择生成模板触发 */
tplSelectChange(value) { tplSelectChange(value) {
if(value !== 'sub') { if(value !== 'sub') {
this.info.subTableName = ''; this.info.subTableName = ''
this.info.subTableFkName = ''; this.info.subTableFkName = ''
} }
}, },
/** 设置关联外键 */ /** 设置关联外键 */
setSubTableColumns(value) { setSubTableColumns(value) {
for (var item in this.tables) { for (var item in this.tables) {
const name = this.tables[item].tableName; const name = this.tables[item].tableName
if (value === name) { if (value === name) {
this.subColumns = this.tables[item].columns; this.subColumns = this.tables[item].columns
break; break
} }
} }
} }
} }
}; }
</script> </script>

View File

@ -47,7 +47,7 @@
</template> </template>
<script> <script>
import { listDbTable, importTable } from "@/api/tool/gen"; import { listDbTable, importTable } from "@/api/tool/gen"
export default { export default {
data() { data() {
return { return {
@ -66,55 +66,55 @@ export default {
tableName: undefined, tableName: undefined,
tableComment: undefined tableComment: undefined
} }
}; }
}, },
methods: { methods: {
// //
show() { show() {
this.getList(); this.getList()
this.visible = true; this.visible = true
}, },
clickRow(row) { clickRow(row) {
this.$refs.table.toggleRowSelection(row); this.$refs.table.toggleRowSelection(row)
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.tables = selection.map(item => item.tableName); this.tables = selection.map(item => item.tableName)
}, },
// //
getList() { getList() {
listDbTable(this.queryParams).then(res => { listDbTable(this.queryParams).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.dbTableList = res.rows; this.dbTableList = res.rows
this.total = res.total; this.total = res.total
} }
}); })
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm")
this.handleQuery(); this.handleQuery()
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImportTable() { handleImportTable() {
const tableNames = this.tables.join(","); const tableNames = this.tables.join(",")
if (tableNames == "") { if (tableNames == "") {
this.$modal.msgError("请选择要导入的表"); this.$modal.msgError("请选择要导入的表")
return; return
} }
importTable({ tables: tableNames }).then(res => { importTable({ tables: tableNames }).then(res => {
this.$modal.msgSuccess(res.msg); this.$modal.msgSuccess(res.msg)
if (res.code === 200) { if (res.code === 200) {
this.visible = false; this.visible = false
this.$emit("ok"); this.$emit("ok")
} }
}); })
} }
} }
}; }
</script> </script>

View File

@ -158,16 +158,16 @@
</template> </template>
<script> <script>
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen"; import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen"
import importTable from "./importTable"; import importTable from "./importTable"
import hljs from "highlight.js/lib/highlight"; import hljs from "highlight.js/lib/highlight"
import "highlight.js/styles/github-gist.css"; import "highlight.js/styles/github-gist.css"
hljs.registerLanguage("java", require("highlight.js/lib/languages/java")); hljs.registerLanguage("java", require("highlight.js/lib/languages/java"))
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml")); hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml"))
hljs.registerLanguage("html", require("highlight.js/lib/languages/xml")); hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"))
hljs.registerLanguage("vue", require("highlight.js/lib/languages/xml")); hljs.registerLanguage("vue", require("highlight.js/lib/languages/xml"))
hljs.registerLanguage("javascript", require("highlight.js/lib/languages/javascript")); hljs.registerLanguage("javascript", require("highlight.js/lib/languages/javascript"))
hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql")); hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql"))
export default { export default {
name: "Gen", name: "Gen",
@ -210,121 +210,121 @@ export default {
data: {}, data: {},
activeName: "domain.java" activeName: "domain.java"
} }
}; }
}, },
created() { created() {
this.queryParams.orderByColumn = this.defaultSort.prop; this.queryParams.orderByColumn = this.defaultSort.prop
this.queryParams.isAsc = this.defaultSort.order; this.queryParams.isAsc = this.defaultSort.order
this.getList(); this.getList()
}, },
activated() { activated() {
const time = this.$route.query.t; const time = this.$route.query.t
if (time != null && time != this.uniqueId) { if (time != null && time != this.uniqueId) {
this.uniqueId = time; this.uniqueId = time
this.queryParams.pageNum = Number(this.$route.query.pageNum); this.queryParams.pageNum = Number(this.$route.query.pageNum)
this.getList(); this.getList()
} }
}, },
methods: { methods: {
/** 查询表集合 */ /** 查询表集合 */
getList() { getList() {
this.loading = true; this.loading = true
listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.tableList = response.rows; this.tableList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 生成代码操作 */ /** 生成代码操作 */
handleGenTable(row) { handleGenTable(row) {
const tableNames = row.tableName || this.tableNames; const tableNames = row.tableName || this.tableNames
if (tableNames == "") { if (tableNames == "") {
this.$modal.msgError("请选择要生成的数据"); this.$modal.msgError("请选择要生成的数据")
return; return
} }
if(row.genType === "1") { if(row.genType === "1") {
genCode(row.tableName).then(response => { genCode(row.tableName).then(response => {
this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath); this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath)
}); })
} else { } else {
this.$download.zip("/code/gen/batchGenCode?tables=" + tableNames, "ruoyi.zip"); this.$download.zip("/code/gen/batchGenCode?tables=" + tableNames, "ruoyi.zip")
} }
}, },
/** 同步数据库操作 */ /** 同步数据库操作 */
handleSynchDb(row) { handleSynchDb(row) {
const tableName = row.tableName; const tableName = row.tableName
this.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function() { this.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function() {
return synchDb(tableName); return synchDb(tableName)
}).then(() => { }).then(() => {
this.$modal.msgSuccess("同步成功"); this.$modal.msgSuccess("同步成功")
}).catch(() => {}); }).catch(() => {})
}, },
/** 打开导入表弹窗 */ /** 打开导入表弹窗 */
openImportTable() { openImportTable() {
this.$refs.import.show(); this.$refs.import.show()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm("queryForm")
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
}, },
/** 预览按钮 */ /** 预览按钮 */
handlePreview(row) { handlePreview(row) {
previewTable(row.tableId).then(response => { previewTable(row.tableId).then(response => {
this.preview.data = response.data; this.preview.data = response.data
this.preview.open = true; this.preview.open = true
this.preview.activeName = "domain.java"; this.preview.activeName = "domain.java"
}); })
}, },
/** 高亮显示 */ /** 高亮显示 */
highlightedCode(code, key) { highlightedCode(code, key) {
const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm")); const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm"))
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length); var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length)
const result = hljs.highlight(language, code || "", true); const result = hljs.highlight(language, code || "", true)
return result.value || '&nbsp;'; return result.value || '&nbsp;'
}, },
/** 复制代码成功 */ /** 复制代码成功 */
clipboardSuccess() { clipboardSuccess() {
this.$modal.msgSuccess("复制成功"); this.$modal.msgSuccess("复制成功")
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.tableId); this.ids = selection.map(item => item.tableId)
this.tableNames = selection.map(item => item.tableName); this.tableNames = selection.map(item => item.tableName)
this.single = selection.length != 1; this.single = selection.length != 1
this.multiple = !selection.length; this.multiple = !selection.length
}, },
/** 排序触发事件 */ /** 排序触发事件 */
handleSortChange(column, prop, order) { handleSortChange(column, prop, order) {
this.queryParams.orderByColumn = column.prop; this.queryParams.orderByColumn = column.prop
this.queryParams.isAsc = column.order; this.queryParams.isAsc = column.order
this.getList(); this.getList()
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEditTable(row) { handleEditTable(row) {
const tableId = row.tableId || this.ids[0]; const tableId = row.tableId || this.ids[0]
const tableName = row.tableName || this.tableNames[0]; const tableName = row.tableName || this.tableNames[0]
const params = { pageNum: this.queryParams.pageNum }; const params = { pageNum: this.queryParams.pageNum }
this.$tab.openPage("修改[" + tableName + "]生成配置", '/tool/gen-edit/index/' + tableId, params); this.$tab.openPage("修改[" + tableName + "]生成配置", '/tool/gen-edit/index/' + tableId, params)
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const tableIds = row.tableId || this.ids; const tableIds = row.tableId || this.ids
this.$modal.confirm('是否确认删除表编号为"' + tableIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除表编号为"' + tableIds + '"的数据项?').then(function() {
return delTable(tableIds); return delTable(tableIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功")
}).catch(() => {}); }).catch(() => {})
} }
} }
}; }
</script> </script>

View File

@ -52,7 +52,7 @@ create table sys_user (
sex char(1) default '0' comment '用户性别0男 1女 2未知', sex char(1) default '0' comment '用户性别0男 1女 2未知',
avatar varchar(100) default '' comment '头像地址', avatar varchar(100) default '' comment '头像地址',
password varchar(100) default '' comment '密码', password varchar(100) default '' comment '密码',
status char(1) default '0' comment '号状态0正常 1停用', status char(1) default '0' comment '号状态0正常 1停用',
del_flag char(1) default '0' comment '删除标志0代表存在 2代表删除', del_flag char(1) default '0' comment '删除标志0代表存在 2代表删除',
login_ip varchar(128) default '' comment '最后登录IP', login_ip varchar(128) default '' comment '最后登录IP',
login_date datetime comment '最后登录时间', login_date datetime comment '最后登录时间',

View File

@ -34,7 +34,7 @@ CREATE TABLE `config_info` (
insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_modified, src_user, src_ip, app_name, tenant_id, c_desc, c_use, effect, type, c_schema, encrypted_data_key) values insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_modified, src_user, src_ip, app_name, tenant_id, c_desc, c_use, effect, type, c_schema, encrypted_data_key) values
(1,'application-dev.yml','DEFAULT_GROUP','spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n min-request-size: 8192\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n','9928f41dfb10386ad38b3254af5692e0','2020-05-20 12:00:00','2024-08-29 12:14:45','nacos','0:0:0:0:0:0:0:1','','','通用配置','null','null','yaml','',''), (1,'application-dev.yml','DEFAULT_GROUP','spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n min-request-size: 8192\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n','9928f41dfb10386ad38b3254af5692e0','2020-05-20 12:00:00','2024-08-29 12:14:45','nacos','0:0:0:0:0:0:0:1','','','通用配置','null','null','yaml','',''),
(2,'ruoyi-gateway-dev.yml','DEFAULT_GROUP','spring:\n redis:\n host: localhost\n port: 6379\n password: \n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestFilter\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /*/v3/api-docs\n - /csrf\n\n# springdoc配置\nspringdoc:\n webjars:\n # 访问前缀\n prefix:\n','4d329eb08a941a8dd9d26f542c6ac6c5','2020-05-14 14:17:55','2024-09-02 12:13:50','nacos','0:0:0:0:0:0:0:1','','','网关模块','null','null','yaml','',''), (2,'ruoyi-gateway-dev.yml','DEFAULT_GROUP','spring:\n redis:\n host: localhost\n port: 6379\n password: \n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestBody\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /*/v3/api-docs\n - /csrf\n\n# springdoc配置\nspringdoc:\n webjars:\n # 访问前缀\n prefix:\n','4d329eb08a941a8dd9d26f542c6ac6c5','2020-05-14 14:17:55','2024-09-02 12:13:50','nacos','0:0:0:0:0:0:0:1','','','网关模块','null','null','yaml','',''),
(3,'ruoyi-auth-dev.yml','DEFAULT_GROUP','spring:\n redis:\n host: localhost\n port: 6379\n password: \n','a03e7632a0a74520eeb4fbedd6d82d97','2020-11-20 00:00:00','2024-09-02 12:13:58','nacos','0:0:0:0:0:0:0:1','','','认证中心','null','null','yaml','',''), (3,'ruoyi-auth-dev.yml','DEFAULT_GROUP','spring:\n redis:\n host: localhost\n port: 6379\n password: \n','a03e7632a0a74520eeb4fbedd6d82d97','2020-11-20 00:00:00','2024-09-02 12:13:58','nacos','0:0:0:0:0:0:0:1','','','认证中心','null','null','yaml','',''),
(4,'ruoyi-monitor-dev.yml','DEFAULT_GROUP','# spring\nspring:\n security:\n user:\n name: ruoyi\n password: 123456\n boot:\n admin:\n ui:\n title: 若依服务状态监控\n','6f122fd2bfb8d45f858e7d6529a9cd44','2020-11-20 00:00:00','2024-08-29 12:15:11','nacos','0:0:0:0:0:0:0:1','','','监控中心','null','null','yaml','',''), (4,'ruoyi-monitor-dev.yml','DEFAULT_GROUP','# spring\nspring:\n security:\n user:\n name: ruoyi\n password: 123456\n boot:\n admin:\n ui:\n title: 若依服务状态监控\n','6f122fd2bfb8d45f858e7d6529a9cd44','2020-11-20 00:00:00','2024-08-29 12:15:11','nacos','0:0:0:0:0:0:0:1','','','监控中心','null','null','yaml','',''),
(5,'ruoyi-system-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password: \n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: ruoyi\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n connectTimeout: 30000\n socketTimeout: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: password\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.system\n # 配置mapper的扫描找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# springdoc配置\nspringdoc:\n gatewayUrl: http://localhost:8080/${spring.application.name}\n api-docs:\n # 是否开启接口文档\n enabled: true\n info:\n # 标题\n title: \'\'\n # 描述\n description: \'\'\n # 作者信息\n contact:\n name: RuoYi\n url: https://ruoyi.vip\n','786c7daf4543411fc65c3e48dfb15243','2020-11-20 00:00:00','2024-09-02 12:14:33','nacos','0:0:0:0:0:0:0:1','','','系统模块','null','null','yaml','',''), (5,'ruoyi-system-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password: \n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: ruoyi\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n connectTimeout: 30000\n socketTimeout: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: password\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.system\n # 配置mapper的扫描找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# springdoc配置\nspringdoc:\n gatewayUrl: http://localhost:8080/${spring.application.name}\n api-docs:\n # 是否开启接口文档\n enabled: true\n info:\n # 标题\n title: \'\'\n # 描述\n description: \'\'\n # 作者信息\n contact:\n name: RuoYi\n url: https://ruoyi.vip\n','786c7daf4543411fc65c3e48dfb15243','2020-11-20 00:00:00','2024-09-02 12:14:33','nacos','0:0:0:0:0:0:0:1','','','系统模块','null','null','yaml','',''),