1、js添加forAsync

Former-commit-id: 5ad7ddabd81328f3f87781f762c21236ce868073
master
wangbing 4 years ago
parent 4106552558
commit 2522a2c595

@ -71,7 +71,7 @@ public class DictManagerImpl implements DictManager {
response.addErrors(dictFindResponse.getErrors());
return response;
} else if (dictFindResponse.getTotalCount() > 0) {
response.addError(ErrorType.BUSINESS_ERROR, "字典名称重复");
response.addError(ErrorType.BUSINESS_ERROR, "[" + request.getDictName() + "]字典名称重复");
return response;
}
}

@ -118,13 +118,7 @@
UPDATE
<include refid="table"/>
SET
`LOG_ERR_TYPE` = ${r"#"}{request.logErrType,jdbcType=VARCHAR},
`LOG_TITLE` = ${r"#"}{request.logTitle,jdbcType=VARCHAR},
`LOG_NOTE` = ${r"#"}{request.logNote,jdbcType=VARCHAR},
`LOG_ERR_RESULT` = ${r"#"}{request.logErrResult,jdbcType=VARCHAR},
`LOG_ATTR1` = ${r"#"}{request.logAttr1,jdbcType=VARCHAR},
`LOG_ATTR2` = ${r"#"}{request.logAttr2,jdbcType=VARCHAR},
`LOG_ATTR3` = ${r"#"}{request.logAttr3,jdbcType=VARCHAR},
`ROW_VERSION` = `ROW_VERSION` + 1,
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
`LAST_UPDATE_TIME` = sysdate()

@ -118,13 +118,7 @@
UPDATE
<include refid="table"/>
SET
LOG_ERR_TYPE = ${r"#"}{request.logErrType,jdbcType=VARCHAR},
LOG_TITLE = ${r"#"}{request.logTitle,jdbcType=VARCHAR},
LOG_NOTE = ${r"#"}{request.logNote,jdbcType=VARCHAR},
LOG_ERR_RESULT = ${r"#"}{request.logErrResult,jdbcType=VARCHAR},
LOG_ATTR1 = ${r"#"}{request.logAttr1,jdbcType=VARCHAR},
LOG_ATTR2 = ${r"#"}{request.logAttr2,jdbcType=VARCHAR},
LOG_ATTR3 = ${r"#"}{request.logAttr3,jdbcType=VARCHAR},
"ROW_VERSION" = "ROW_VERSION" + 1,
"LAST_UPDATE_BY" = ${r"#"}{token.userId},
"LAST_UPDATE_TIME" = datetime('now','localtime')

@ -22,24 +22,6 @@ public class LogErrUpdateRequest extends BaseUpdateRequest {
@NotNull(message = "[id]主键不能为NULL")
private Long id;
/**
* .
*/
@Dict(name = "LOG_ERR_TYPE")
private String logErrType;
/**
* .
*/
@NotBlank(message = "[logTitle]日志标题不能为空")
@Length(min = 0, max = 50, message = "[logTitle]日志标题长度不合法(0-50)")
private String logTitle;
/**
* .
*/
private String logNote;
/**
* .
*/
@ -47,24 +29,6 @@ public class LogErrUpdateRequest extends BaseUpdateRequest {
@Dict(name = "LOG_ERR_RESULT")
private String logErrResult;
/**
* 1.
*/
@Length(min = 0, max = 50, message = "[logAttr1]属性1长度不合法(0-50)")
private String logAttr1;
/**
* 2.
*/
@Length(min = 0, max = 50, message = "[logAttr2]属性2长度不合法(0-50)")
private String logAttr2;
/**
* 3.
*/
@Length(min = 0, max = 50, message = "[logAttr3]属性3长度不合法(0-50)")
private String logAttr3;
public Long getId() {
return this.id;
}
@ -73,30 +37,6 @@ public class LogErrUpdateRequest extends BaseUpdateRequest {
this.id = id;
}
public String getLogErrType() {
return this.logErrType;
}
public void setLogErrType(String logErrType) {
this.logErrType = logErrType;
}
public String getLogTitle() {
return this.logTitle;
}
public void setLogTitle(String logTitle) {
this.logTitle = logTitle;
}
public String getLogNote() {
return this.logNote;
}
public void setLogNote(String logNote) {
this.logNote = logNote;
}
public String getLogErrResult() {
return this.logErrResult;
}
@ -104,28 +44,4 @@ public class LogErrUpdateRequest extends BaseUpdateRequest {
public void setLogErrResult(String logErrResult) {
this.logErrResult = logErrResult;
}
public String getLogAttr1() {
return this.logAttr1;
}
public void setLogAttr1(String logAttr1) {
this.logAttr1 = logAttr1;
}
public String getLogAttr2() {
return this.logAttr2;
}
public void setLogAttr2(String logAttr2) {
this.logAttr2 = logAttr2;
}
public String getLogAttr3() {
return this.logAttr3;
}
public void setLogAttr3(String logAttr3) {
this.logAttr3 = logAttr3;
}
}

File diff suppressed because one or more lines are too long

@ -22,9 +22,9 @@
<el-card class="box-card">
<el-row>
<el-col :span="12">
<el-button type="success" size="mini" icon="el-icon-check">解决</el-button>
<el-button type="success" size="mini" icon="el-icon-check" @click="onBitchSolve">解决</el-button>
<el-button type="warning" size="mini" icon="el-icon-minus">搁置</el-button>
<el-button type="warning" size="mini" icon="el-icon-minus" @click="onBitchShelve">搁置</el-button>
</el-col>
<el-col :span="12">
@ -104,7 +104,8 @@
label="操作">
<template slot-scope="scope">
<wb-dropdown :arg="scope.row">
<wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit"></wb-dropdown-item>
<wb-dropdown-item value="解决" icon="el-icon-edit" @click="onSolve"></wb-dropdown-item>
<wb-dropdown-item value="搁置" icon="el-icon-edit" @click="onShelve"></wb-dropdown-item>
<wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete"></wb-dropdown-item>
</wb-dropdown>
</template>
@ -122,43 +123,6 @@
:total="vm.totalCount">
</el-pagination>
</el-card>
<el-dialog
:custom-class="'dialog'"
:title="form.formTitle"
:close-on-click-modal="false"
:visible.sync="form.formShow">
<el-form class="form" :model="form" :inline="true" :rules="formRules" ref="form" label-position="right"
label-width="90px">
<el-form-item label="错误类型" prop="logErrType">
<el-input-dict v-model="form.logErrType" clearable size="mini" placeholder="请输入错误类型"
dict-name="LOG_ERR_TYPE"></el-input-dict>
</el-form-item>
<el-form-item label="错误标题" prop="logTitle">
<el-input v-model="form.logTitle" clearable size="mini" placeholder="请输入错误标题"></el-input>
</el-form-item>
<el-form-item label="错误内容" prop="logNote">
<el-input v-model="form.logNote" clearable size="mini" placeholder="请输入错误内容"></el-input>
</el-form-item>
<el-form-item label="处理结果" prop="logErrResult">
<el-input-dict v-model="form.logErrResult" clearable size="mini" placeholder="请输入处理结果"
dict-name="LOG_ERR_RESULT"></el-input-dict>
</el-form-item>
<el-form-item label="属性1" prop="logAttr1">
<el-input v-model="form.logAttr1" clearable size="mini" placeholder="请输入属性1"></el-input>
</el-form-item>
<el-form-item label="属性2" prop="logAttr2">
<el-input v-model="form.logAttr2" clearable size="mini" placeholder="请输入属性2"></el-input>
</el-form-item>
<el-form-item label="属性3" prop="logAttr3">
<el-input v-model="form.logAttr3" clearable size="mini" placeholder="请输入属性3"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="mini" @click="form.formShow = false">取 消</el-button>
<el-button size="mini" type="primary" @click="onSave">保存</el-button>
</span>
</el-dialog>
</div>
<script>
var app = new Vue({
@ -179,66 +143,78 @@
totalCount: 0,
sortKey: 'CREATE_TIME',
sortType: 'DESC'
},
form: {//待提交表单
formTitle: "",
formShow: false,
id: '',
logErrType: "",
logTitle: "",
logNote: "",
logErrResult: "",
logAttr1: "",
logAttr2: "",
logAttr3: "",
rowVersion: ""
},
formRules: {
logErrType: [],
logTitle: [
{required: true, message: '错误标题不能为空', trigger: 'blur'},
{min: 1, max: 50, message: '错误标题长度在 1 到 50 个字符', trigger: 'blur'}
],
logNote: [],
logErrResult: [
{required: true, message: '处理结果不能为空', trigger: 'blur'},
],
logAttr1: [
{min: 1, max: 50, message: '属性1长度在 1 到 50 个字符', trigger: 'blur'}
],
logAttr2: [
{min: 1, max: 50, message: '属性2长度在 1 到 50 个字符', trigger: 'blur'}
],
logAttr3: [
{min: 1, max: 50, message: '属性3长度在 1 到 50 个字符', trigger: 'blur'}
],
}
},
methods: {
onCreate: function () {
this.form.formTitle = "错误日志新增";
this.form.formShow = true;
this.form.id = "";
this.form.logErrType = "";
this.form.logTitle = "";
this.form.logNote = "";
this.form.logErrResult = "";
this.form.logAttr1 = "";
this.form.logAttr2 = "";
this.form.logAttr3 = "";
onSolve: function (item) {
new Ajax("system", "logErr").update({
id: item.id,
logErrResult: '1',
rowVersion: item.rowVersion
},function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("更新成功");
this.onFind();
}
}.bind(this))
},
onShelve: function (item) {
new Ajax("system", "logErr").update({
id: item.id,
logErrResult: '2',
rowVersion: item.rowVersion
},function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("更新成功");
this.onFind();
}
}.bind(this))
},
onEdit: function (item) {
this.form.formTitle = "错误日志编辑";
this.form.formShow = true;
this.form.id = item.id;
this.form.logErrType = item.logErrType;
this.form.logTitle = item.logTitle;
this.form.logNote = item.logNote;
this.form.logErrResult = item.logErrResult;
this.form.logAttr1 = item.logAttr1;
this.form.logAttr2 = item.logAttr2;
this.form.logAttr3 = item.logAttr3;
this.form.rowVersion = item.rowVersion;
onBitchSolve: function () {
if (this.select.length == 0) {
nav.w("至少选中一项");
} else {
this.select.forAsync(function (item, next) {
new Ajax("system", "logErr").update({
id: item.id,
logErrResult: '1',
rowVersion: item.rowVersion
}, function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
next();
}
}.bind(this))
}, function () {
this.onFind();
}.bind(this))
}
},
onBitchShelve: function () {
if (this.select.length == 0) {
nav.w("至少选中一项");
} else {
this.select.forAsync(function (item, next) {
new Ajax("system", "logErr").update({
id: item.id,
logErrResult: '2',
rowVersion: item.rowVersion
}, function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
next();
}
}.bind(this))
}, function () {
this.onFind();
}.bind(this))
}
},
onDelete: function (item) {
this.$confirm('将删除该项, 是否继续?', '提示', {

@ -99,13 +99,7 @@ public class LogErrTest {
//更新数据
LogErrUpdateRequest request = new LogErrUpdateRequest();
request.setId(createResponse.getId());
request.setLogErrType("code");
request.setLogTitle("日志标题");
request.setLogNote("content");
request.setLogErrResult("code");
request.setLogAttr1("属性1");
request.setLogAttr2("属性2");
request.setLogAttr3("属性3");
LogErrUpdateResponse response = logErrManager.update(request,token);

File diff suppressed because one or more lines are too long

@ -70,6 +70,23 @@ Array.prototype.exchange = function (val1, val2) {
this.splice(val1, 1, o2);
this.splice(val2, 1, o1);
};
/**
* 数组异步循环
* fun(item,next) 处理函数
* finish() 处理完成函数
*/
Array.prototype.forAsync = function (fun, finish) {
var this_ = this;
(function loop(index) {
if (index < this_.length) {
fun(this_[index], function () {
loop(++index)
})
} else if (typeof finish === 'function') {
finish();
}
})(0)
};
window.utils = {
/**
* 隐藏文件选择器

Loading…
Cancel
Save

Powered by TurnKey Linux.