remove all semicolons

pull/409/head
RuoYi 5 months ago
parent 79c885decb
commit 7b6fdb3a89

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -42,7 +42,7 @@
</template>
<script>
import { getToken } from "@/utils/auth";
import { getToken } from "@/utils/auth"
export default {
name: "FileUpload",
@ -93,26 +93,26 @@ export default {
Authorization: "Bearer " + getToken(),
},
fileList: [],
};
}
},
watch: {
value: {
handler(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 => {
if (typeof item === "string") {
item = { name: item, url: item };
item = { name: item, url: item }
}
item.uid = item.uid || new Date().getTime() + temp++;
return item;
});
item.uid = item.uid || new Date().getTime() + temp++
return item
})
} else {
this.fileList = [];
return [];
this.fileList = []
return []
}
},
deep: true,
@ -122,7 +122,7 @@ export default {
computed: {
//
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
return this.isShowTip && (this.fileType || this.fileSize)
},
},
methods: {
@ -130,88 +130,88 @@ export default {
handleBeforeUpload(file) {
//
if (this.fileType) {
const fileName = file.name.split('.');
const fileExt = fileName[fileName.length - 1];
const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
const fileName = file.name.split('.')
const fileExt = fileName[fileName.length - 1]
const isTypeOk = this.fileType.indexOf(fileExt) >= 0
if (!isTypeOk) {
this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}格式文件!`);
return false;
this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}格式文件!`)
return false
}
}
//
if (file.name.includes(',')) {
this.$modal.msgError('文件名不正确,不能包含英文逗号!');
return false;
this.$modal.msgError('文件名不正确,不能包含英文逗号!')
return false
}
//
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {
this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`)
return false
}
}
this.$modal.loading("正在上传文件,请稍候...");
this.number++;
return true;
this.$modal.loading("正在上传文件,请稍候...")
this.number++
return true
},
//
handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`)
},
//
handleUploadError(err) {
this.$modal.msgError("上传文件失败,请重试");
this.$modal.closeLoading();
this.$modal.msgError("上传文件失败,请重试")
this.$modal.closeLoading()
},
//
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push({ name: res.data.url, url: res.data.url });
this.uploadedSuccessfully();
this.uploadList.push({ name: res.data.url, url: res.data.url })
this.uploadedSuccessfully()
} else {
this.number--;
this.$modal.closeLoading();
this.$modal.msgError(res.msg);
this.$refs.fileUpload.handleRemove(file);
this.uploadedSuccessfully();
this.number--
this.$modal.closeLoading()
this.$modal.msgError(res.msg)
this.$refs.fileUpload.handleRemove(file)
this.uploadedSuccessfully()
}
},
//
handleDelete(index) {
this.fileList.splice(index, 1);
this.$emit("input", this.listToString(this.fileList));
this.fileList.splice(index, 1)
this.$emit("input", this.listToString(this.fileList))
},
//
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = [];
this.number = 0;
this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading();
this.fileList = this.fileList.concat(this.uploadList)
this.uploadList = []
this.number = 0
this.$emit("input", this.listToString(this.fileList))
this.$modal.closeLoading()
}
},
//
getFileName(name) {
// url
if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1);
return name.slice(name.lastIndexOf("/") + 1)
} else {
return name;
return name
}
},
//
listToString(list, separator) {
let strs = "";
separator = separator || ",";
let strs = ""
separator = separator || ","
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>
<style scoped lang="scss">

@ -90,7 +90,7 @@ export default {
const query = val.query
if(isHttp(val.path)) {
// http(s)://
const pindex = path.indexOf("http");
const pindex = path.indexOf("http")
window.open(path.substr(pindex, path.length), "_blank")
} else {
if (query) {

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

@ -44,7 +44,7 @@
</template>
<script>
import { getToken } from "@/utils/auth";
import { getToken } from "@/utils/auth"
export default {
props: {
@ -91,24 +91,24 @@ export default {
Authorization: "Bearer " + getToken(),
},
fileList: []
};
}
},
watch: {
value: {
handler(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 => {
if (typeof item === "string") {
item = { name: item, url: item };
item = { name: item, url: item }
}
return item;
});
return item
})
} else {
this.fileList = [];
return [];
this.fileList = []
return []
}
},
deep: true,
@ -118,103 +118,103 @@ export default {
computed: {
//
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
return this.isShowTip && (this.fileType || this.fileSize)
},
},
methods: {
// loading
handleBeforeUpload(file) {
let isImg = false;
let isImg = false
if (this.fileType.length) {
let fileExtension = "";
let fileExtension = ""
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 => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
if (file.type.indexOf(type) > -1) return true
if (fileExtension && fileExtension.indexOf(type) > -1) return true
return false
})
} else {
isImg = file.type.indexOf("image") > -1;
isImg = file.type.indexOf("image") > -1
}
if (!isImg) {
this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}图片格式文件!`);
return false;
this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}图片格式文件!`)
return false
}
if (file.name.includes(',')) {
this.$modal.msgError('文件名不正确,不能包含英文逗号!');
return false;
this.$modal.msgError('文件名不正确,不能包含英文逗号!')
return false
}
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {
this.$modal.msgError(`上传头像图片大小不能超过 ${this.fileSize} MB!`);
return false;
this.$modal.msgError(`上传头像图片大小不能超过 ${this.fileSize} MB!`)
return false
}
}
this.$modal.loading("正在上传图片,请稍候...");
this.number++;
this.$modal.loading("正在上传图片,请稍候...")
this.number++
},
//
handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`)
},
//
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push({ name: res.data.url, url: res.data.url });
this.uploadedSuccessfully();
this.uploadList.push({ name: res.data.url, url: res.data.url })
this.uploadedSuccessfully()
} else {
this.number--;
this.$modal.closeLoading();
this.$modal.msgError(res.msg);
this.$refs.imageUpload.handleRemove(file);
this.uploadedSuccessfully();
this.number--
this.$modal.closeLoading()
this.$modal.msgError(res.msg)
this.$refs.imageUpload.handleRemove(file)
this.uploadedSuccessfully()
}
},
//
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) {
this.fileList.splice(findex, 1);
this.$emit("input", this.listToString(this.fileList));
this.fileList.splice(findex, 1)
this.$emit("input", this.listToString(this.fileList))
}
},
//
handleUploadError() {
this.$modal.msgError("上传图片失败,请重试");
this.$modal.closeLoading();
this.$modal.msgError("上传图片失败,请重试")
this.$modal.closeLoading()
},
//
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = [];
this.number = 0;
this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading();
this.fileList = this.fileList.concat(this.uploadList)
this.uploadList = []
this.number = 0
this.$emit("input", this.listToString(this.fileList))
this.$modal.closeLoading()
}
},
//
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
this.dialogImageUrl = file.url
this.dialogVisible = true
},
//
listToString(list, separator) {
let strs = "";
separator = separator || ",";
let strs = ""
separator = separator || ","
for (let i in list) {
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>
<style scoped lang="scss">
// .el-upload--picture-card

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

@ -47,7 +47,7 @@ export default {
title: "显示/隐藏",
//
open: false
};
}
},
props: {
/* 是否显示检索条件 */
@ -77,20 +77,20 @@ export default {
},
computed: {
style() {
const ret = {};
const ret = {}
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);
return this.columns.every((col) => col.visible)
},
set() {}
},
isIndeterminate() {
return this.columns.some((col) => col.visible) && !this.isChecked;
return this.columns.some((col) => col.visible) && !this.isChecked
}
},
created() {
@ -98,7 +98,7 @@ export default {
//
for (let item in this.columns) {
if (this.columns[item].visible === false) {
this.value.push(parseInt(item));
this.value.push(parseInt(item))
}
}
}
@ -106,34 +106,34 @@ export default {
methods: {
//
toggleSearch() {
this.$emit("update:showSearch", !this.showSearch);
this.$emit("update:showSearch", !this.showSearch)
},
//
refresh() {
this.$emit("queryTable");
this.$emit("queryTable")
},
//
dataChange(data) {
for (let item in this.columns) {
const key = this.columns[item].key;
this.columns[item].visible = !data.includes(key);
const key = this.columns[item].key
this.columns[item].visible = !data.includes(key)
}
},
// dialog
showColumn() {
this.open = true;
this.open = true
},
//
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;
const newValue = !this.isChecked
this.columns.forEach((col) => (col.visible = newValue))
}
},
};
}
</script>
<style lang="scss" scoped>
::v-deep .el-transfer__button {

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

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

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

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

@ -5,30 +5,30 @@
export default {
bind(el) {
const dragDom = el.querySelector('.el-dialog');
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;';
const dragDom = el.querySelector('.el-dialog')
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.addEventListener('mousedown',
function(e) {
// 鼠标按下,计算当前元素距离可视区的距离
const disX = e.clientX - el.offsetLeft;
const disY = e.clientY - el.offsetTop;
const disX = e.clientX - el.offsetLeft
const disY = e.clientY - el.offsetTop
// 当前宽度 高度
const curWidth = dragDom.offsetWidth;
const curHeight = dragDom.offsetHeight;
const curWidth = dragDom.offsetWidth
const curHeight = dragDom.offsetHeight
document.onmousemove = function(e) {
e.preventDefault(); // 移动时禁用默认事件
e.preventDefault() // 移动时禁用默认事件
// 通过事件委托,计算移动的距离
const xl = e.clientX - disX;
const xl = e.clientX - disX
const yl = e.clientY - disY
dragDom.style.width = `${curWidth + xl}px`;
dragDom.style.height = `${curHeight + yl}px`;
};
dragDom.style.width = `${curWidth + xl}px`
dragDom.style.height = `${curHeight + yl}px`
}
document.onmouseup = function(e) {
document.onmousemove = null;
document.onmouseup = null;
};
}, false);
dragDom.appendChild(lineEl);
document.onmousemove = null
document.onmouseup = null
}
}, false)
dragDom.appendChild(lineEl)
}
}

@ -5,26 +5,26 @@
export default {
bind(el) {
const dragDom = el.querySelector('.el-dialog');
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;';
const dragDom = el.querySelector('.el-dialog')
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.addEventListener('mousedown',
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) {
e.preventDefault(); // 移动时禁用默认事件
e.preventDefault() // 移动时禁用默认事件
// 通过事件委托,计算移动的距离
const l = e.clientX - disX;
dragDom.style.width = `${curWidth + l}px`;
};
const l = e.clientX - disX
dragDom.style.width = `${curWidth + l}px`
}
document.onmouseup = function (e) {
document.onmousemove = null;
document.onmouseup = null;
};
}, false);
dragDom.appendChild(lineEl);
document.onmousemove = null
document.onmouseup = null
}
}, false)
dragDom.appendChild(lineEl)
}
}

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

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

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

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

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

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

@ -95,16 +95,16 @@ export default {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/index';
location.href = '/index'
})
}).catch(() => {});
}).catch(() => {})
}
}
}

@ -82,7 +82,7 @@ export default {
return {
theme: this.$store.state.settings.theme,
sideTheme: this.$store.state.settings.sideTheme
};
}
},
computed: {
visible: {
@ -111,8 +111,8 @@ export default {
value: val
})
if (!val) {
this.$store.dispatch('app/toggleSideBarHide', false);
this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes);
this.$store.dispatch('app/toggleSideBarHide', false)
this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes)
}
}
},
@ -156,17 +156,17 @@ export default {
key: 'theme',
value: val
})
this.theme = val;
this.theme = val
},
handleTheme(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'sideTheme',
value: val
})
this.sideTheme = val;
this.sideTheme = val
},
saveSetting() {
this.$modal.loading("正在保存到本地,请稍候...");
this.$modal.loading("正在保存到本地,请稍候...")
this.$cache.local.set(
"layout-setting",
`{
@ -178,11 +178,11 @@ export default {
"sideTheme":"${this.sideTheme}",
"theme":"${this.theme}"
}`
);
)
setTimeout(this.$modal.closeLoading(), 1000)
},
resetSetting() {
this.$modal.loading("正在清除设置缓存并刷新,请稍候...");
this.$modal.loading("正在清除设置缓存并刷新,请稍候...")
this.$cache.local.remove("layout-setting")
setTimeout("window.location.reload()", 1000)
}

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

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

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

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

@ -51,7 +51,7 @@ export default {
}
},
variables() {
return variables;
return variables
}
},
methods: {

@ -16,11 +16,11 @@ import { download } from '@/utils/request'
import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
import { getDicts } from "@/api/system/dict/data"
import { getConfigKey } from "@/api/system/config"
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"
// 富文本组件

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

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

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

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

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

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

@ -14,6 +14,6 @@ const getters = {
permission_routes: state => state.permission.routes,
topbarRouters:state => state.permission.topbarRouters,
defaultRoutes:state => state.permission.defaultRoutes,
sidebarRouters:state => state.permission.sidebarRouters,
sidebarRouters:state => state.permission.sidebarRouters
}
export default getters

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

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

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

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

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

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

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

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

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

@ -909,15 +909,15 @@ export default {
data() {
return {
//
version: "3.6.5",
};
version: "3.6.5"
}
},
methods: {
goTarget(href) {
window.open(href, "_blank");
},
},
};
window.open(href, "_blank")
}
}
}
</script>
<style scoped lang="scss">

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -46,7 +46,7 @@
</template>
<script>
import { getAuthRole, updateAuthRole } from "@/api/system/user";
import { getAuthRole, updateAuthRole } from "@/api/system/user"
export default {
name: "AuthRole",
@ -64,60 +64,60 @@ export default {
roles: [],
//
form: {}
};
}
},
created() {
const userId = this.$route.params && this.$route.params.userId;
const userId = this.$route.params && this.$route.params.userId
if (userId) {
this.loading = true;
this.loading = true
getAuthRole(userId).then((response) => {
this.form = response.user;
this.roles = response.roles;
this.total = this.roles.length;
this.form = response.user
this.roles = response.roles
this.total = this.roles.length
this.$nextTick(() => {
this.roles.forEach((row) => {
if (row.flag) {
this.$refs.table.toggleRowSelection(row);
this.$refs.table.toggleRowSelection(row)
}
});
});
this.loading = false;
});
})
})
this.loading = false
})
}
},
methods: {
/** 单击选中行数据 */
clickRow(row) {
if (this.checkSelectable(row)) {
this.$refs.table.toggleRowSelection(row);
this.$refs.table.toggleRowSelection(row)
}
},
//
handleSelectionChange(selection) {
this.roleIds = selection.map((item) => item.roleId);
this.roleIds = selection.map((item) => item.roleId)
},
//
getRowKey(row) {
return row.roleId;
return row.roleId
},
//
checkSelectable(row) {
return row.status === "0" ? true : false;
return row.status === "0" ? true : false
},
/** 提交按钮 */
submitForm() {
const userId = this.form.userId;
const roleIds = this.roleIds.join(",");
const userId = this.form.userId
const roleIds = this.roleIds.join(",")
updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
this.$modal.msgSuccess("授权成功");
this.close();
});
this.$modal.msgSuccess("授权成功")
this.close()
})
},
/** 关闭按钮 */
close() {
const obj = { path: "/system/user" };
this.$tab.closeOpenPage(obj);
},
},
};
const obj = { path: "/system/user" }
this.$tab.closeOpenPage(obj)
}
}
}
</script>

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

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

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

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

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

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

@ -127,11 +127,11 @@
</template>
<script>
import { getGenTable, updateGenTable } from "@/api/tool/gen";
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
import { listMenu as getMenuTreeselect } from "@/api/system/menu";
import basicInfoForm from "./basicInfoForm";
import genInfoForm from "./genInfoForm";
import { getGenTable, updateGenTable } from "@/api/tool/gen"
import { optionselect as getDictOptionselect } from "@/api/system/dict/type"
import { listMenu as getMenuTreeselect } from "@/api/system/menu"
import basicInfoForm from "./basicInfoForm"
import genInfoForm from "./genInfoForm"
import Sortable from 'sortablejs'
export default {
@ -156,79 +156,79 @@ export default {
menus: [],
//
info: {}
};
}
},
created() {
const tableId = this.$route.params && this.$route.params.tableId;
const tableId = this.$route.params && this.$route.params.tableId
if (tableId) {
//
getGenTable(tableId).then(res => {
this.columns = res.data.rows;
this.info = res.data.info;
this.tables = res.data.tables;
});
this.columns = res.data.rows
this.info = res.data.info
this.tables = res.data.tables
})
/** 查询字典下拉列表 */
getDictOptionselect().then(response => {
this.dictOptions = response.data;
});
this.dictOptions = response.data
})
/** 查询菜单下拉列表 */
getMenuTreeselect().then(response => {
this.menus = this.handleTree(response.data, "menuId");
});
this.menus = this.handleTree(response.data, "menuId")
})
}
},
methods: {
/** 提交按钮 */
submitForm() {
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
const genForm = this.$refs.genInfo.$refs.genInfoForm;
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm
const genForm = this.$refs.genInfo.$refs.genInfoForm
Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => {
const validateResult = res.every(item => !!item);
const validateResult = res.every(item => !!item)
if (validateResult) {
const genTable = Object.assign({}, basicForm.model, genForm.model);
genTable.columns = this.columns;
const genTable = Object.assign({}, basicForm.model, genForm.model)
genTable.columns = this.columns
genTable.params = {
treeCode: genTable.treeCode,
treeName: genTable.treeName,
treeParentCode: genTable.treeParentCode,
parentMenuId: genTable.parentMenuId
};
}
updateGenTable(genTable).then(res => {
this.$modal.msgSuccess(res.msg);
this.$modal.msgSuccess(res.msg)
if (res.code === 200) {
this.close();
this.close()
}
});
})
} else {
this.$modal.msgError("表单校验未通过,请重新检查提交内容");
this.$modal.msgError("表单校验未通过,请重新检查提交内容")
}
});
})
},
getFormPromise(form) {
return new Promise(resolve => {
form.validate(res => {
resolve(res);
});
});
resolve(res)
})
})
},
/** 关闭按钮 */
close() {
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: this.$route.query.pageNum } };
this.$tab.closeOpenPage(obj);
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: this.$route.query.pageNum } }
this.$tab.closeOpenPage(obj)
}
},
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, {
handle: ".allowDrag",
onEnd: evt => {
const targetRow = this.columns.splice(evt.oldIndex, 1)[0];
this.columns.splice(evt.newIndex, 0, targetRow);
const targetRow = this.columns.splice(evt.oldIndex, 1)[0]
this.columns.splice(evt.newIndex, 0, targetRow)
for (let index in this.columns) {
this.columns[index].sort = parseInt(index) + 1;
this.columns[index].sort = parseInt(index) + 1
}
}
});
})
}
};
}
</script>

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

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

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

Loading…
Cancel
Save