1、js添加forAsync

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

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

@ -118,13 +118,7 @@
UPDATE UPDATE
<include refid="table"/> <include refid="table"/>
SET 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_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, `ROW_VERSION` = `ROW_VERSION` + 1,
`LAST_UPDATE_BY` = ${r"#"}{token.userId}, `LAST_UPDATE_BY` = ${r"#"}{token.userId},
`LAST_UPDATE_TIME` = sysdate() `LAST_UPDATE_TIME` = sysdate()

@ -118,13 +118,7 @@
UPDATE UPDATE
<include refid="table"/> <include refid="table"/>
SET 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_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, "ROW_VERSION" = "ROW_VERSION" + 1,
"LAST_UPDATE_BY" = ${r"#"}{token.userId}, "LAST_UPDATE_BY" = ${r"#"}{token.userId},
"LAST_UPDATE_TIME" = datetime('now','localtime') "LAST_UPDATE_TIME" = datetime('now','localtime')

@ -22,24 +22,6 @@ public class LogErrUpdateRequest extends BaseUpdateRequest {
@NotNull(message = "[id]主键不能为NULL") @NotNull(message = "[id]主键不能为NULL")
private Long id; 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") @Dict(name = "LOG_ERR_RESULT")
private String logErrResult; 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() { public Long getId() {
return this.id; return this.id;
} }
@ -73,30 +37,6 @@ public class LogErrUpdateRequest extends BaseUpdateRequest {
this.id = id; 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() { public String getLogErrResult() {
return this.logErrResult; return this.logErrResult;
} }
@ -104,28 +44,4 @@ public class LogErrUpdateRequest extends BaseUpdateRequest {
public void setLogErrResult(String logErrResult) { public void setLogErrResult(String logErrResult) {
this.logErrResult = 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-card class="box-card">
<el-row> <el-row>
<el-col :span="12"> <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>
<el-col :span="12"> <el-col :span="12">
@ -104,7 +104,8 @@
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<wb-dropdown :arg="scope.row"> <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-item value="删除" icon="el-icon-delete" @click="onDelete"></wb-dropdown-item>
</wb-dropdown> </wb-dropdown>
</template> </template>
@ -122,43 +123,6 @@
:total="vm.totalCount"> :total="vm.totalCount">
</el-pagination> </el-pagination>
</el-card> </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> </div>
<script> <script>
var app = new Vue({ var app = new Vue({
@ -179,66 +143,78 @@
totalCount: 0, totalCount: 0,
sortKey: 'CREATE_TIME', sortKey: 'CREATE_TIME',
sortType: 'DESC' sortType: 'DESC'
}
}, },
form: {//待提交表单 methods: {
formTitle: "", onSolve: function (item) {
formShow: false, new Ajax("system", "logErr").update({
id: '', id: item.id,
logErrType: "", logErrResult: '1',
logTitle: "", rowVersion: item.rowVersion
logNote: "", },function (response) {
logErrResult: "", if (response.errors.length > 0) {
logAttr1: "", nav.e(response.errors[0].message);
logAttr2: "", } else {
logAttr3: "", nav.s("更新成功");
rowVersion: "" this.onFind();
}
}.bind(this))
}, },
formRules: { onShelve: function (item) {
logErrType: [], new Ajax("system", "logErr").update({
logTitle: [ id: item.id,
{required: true, message: '错误标题不能为空', trigger: 'blur'}, logErrResult: '2',
{min: 1, max: 50, message: '错误标题长度在 1 到 50 个字符', trigger: 'blur'} rowVersion: item.rowVersion
], },function (response) {
logNote: [], if (response.errors.length > 0) {
logErrResult: [ nav.e(response.errors[0].message);
{required: true, message: '处理结果不能为空', trigger: 'blur'}, } else {
], nav.s("更新成功");
logAttr1: [ this.onFind();
{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'}
],
} }
}.bind(this))
}, },
methods: { onBitchSolve: function () {
onCreate: function () { if (this.select.length == 0) {
this.form.formTitle = "错误日志新增"; nav.w("至少选中一项");
this.form.formShow = true; } else {
this.form.id = ""; this.select.forAsync(function (item, next) {
this.form.logErrType = ""; new Ajax("system", "logErr").update({
this.form.logTitle = ""; id: item.id,
this.form.logNote = ""; logErrResult: '1',
this.form.logErrResult = ""; rowVersion: item.rowVersion
this.form.logAttr1 = ""; }, function (response) {
this.form.logAttr2 = ""; if (response.errors.length > 0) {
this.form.logAttr3 = ""; nav.e(response.errors[0].message);
} else {
next();
}
}.bind(this))
}, function () {
this.onFind();
}.bind(this))
}
}, },
onEdit: function (item) { onBitchShelve: function () {
this.form.formTitle = "错误日志编辑"; if (this.select.length == 0) {
this.form.formShow = true; nav.w("至少选中一项");
this.form.id = item.id; } else {
this.form.logErrType = item.logErrType; this.select.forAsync(function (item, next) {
this.form.logTitle = item.logTitle; new Ajax("system", "logErr").update({
this.form.logNote = item.logNote; id: item.id,
this.form.logErrResult = item.logErrResult; logErrResult: '2',
this.form.logAttr1 = item.logAttr1; rowVersion: item.rowVersion
this.form.logAttr2 = item.logAttr2; }, function (response) {
this.form.logAttr3 = item.logAttr3; if (response.errors.length > 0) {
this.form.rowVersion = item.rowVersion; nav.e(response.errors[0].message);
} else {
next();
}
}.bind(this))
}, function () {
this.onFind();
}.bind(this))
}
}, },
onDelete: function (item) { onDelete: function (item) {
this.$confirm('将删除该项, 是否继续?', '提示', { this.$confirm('将删除该项, 是否继续?', '提示', {

@ -99,13 +99,7 @@ public class LogErrTest {
//更新数据 //更新数据
LogErrUpdateRequest request = new LogErrUpdateRequest(); LogErrUpdateRequest request = new LogErrUpdateRequest();
request.setId(createResponse.getId()); request.setId(createResponse.getId());
request.setLogErrType("code");
request.setLogTitle("日志标题");
request.setLogNote("content");
request.setLogErrResult("code"); request.setLogErrResult("code");
request.setLogAttr1("属性1");
request.setLogAttr2("属性2");
request.setLogAttr3("属性3");
LogErrUpdateResponse response = logErrManager.update(request,token); 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(val1, 1, o2);
this.splice(val2, 1, o1); 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 = { window.utils = {
/** /**
* 隐藏文件选择器 * 隐藏文件选择器

Loading…
Cancel
Save

Powered by TurnKey Linux.