Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/v4
This commit is contained in:
@@ -21,8 +21,10 @@ import com.budwk.app.flow.vo.ProcessTaskVO;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
@@ -138,6 +140,7 @@ public class FlowCommonController {
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("启动流程实例并自动完成")
|
||||
public Result startInstanceAndExecute(@Param("defineKey") String defineKey, @Param("bizData") String bizData, @Param("submitType") Integer submitType) {
|
||||
Dict args = Dict.create();
|
||||
@@ -155,6 +158,7 @@ public class FlowCommonController {
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("启动流程实例并自动完成")
|
||||
public Result startInstance(@Param("defineKey") String defineKey, @Param("bizData") String bizData, @Param("submitType") Integer submitType) {
|
||||
Dict args = Dict.create();
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
if (typeof Vue === 'undefined') {
|
||||
console.error('Vue is not defined. Please include Vue first.')
|
||||
}
|
||||
|
||||
const MARK = '__autoEnhance_validated__'
|
||||
|
||||
function autoEnhanceForm(formVm) {
|
||||
// 防止重复处理
|
||||
if (formVm[MARK]) return
|
||||
formVm[MARK] = true
|
||||
|
||||
const vnode = formVm.$vnode
|
||||
if (vnode && vnode.data && vnode.data.attrs && vnode.data.attrs['no-auto-enhance'] !== undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
const originalValidate = formVm.validate
|
||||
|
||||
formVm.validate = function(callback) {
|
||||
originalValidate(async (valid, fields) => {
|
||||
if (valid) {
|
||||
callback?.(valid, fields)
|
||||
} else {
|
||||
const firstField = Object.keys(fields)[0]
|
||||
const fieldErrors = fields[firstField]
|
||||
const errorMessage = fieldErrors[0].message
|
||||
|
||||
let finalMessage = errorMessage
|
||||
|
||||
const formItem = formVm.fields?.find(item => item.prop === firstField)
|
||||
|
||||
if (errorMessage === '必填' && formItem && formItem.label) {
|
||||
finalMessage = `${formItem.label} 必填`
|
||||
}
|
||||
|
||||
// 提示
|
||||
if (formVm.$message) {
|
||||
formVm.$message({
|
||||
message: finalMessage,
|
||||
type: 'error',
|
||||
})
|
||||
} else {
|
||||
alert(finalMessage)
|
||||
}
|
||||
|
||||
await formVm.$nextTick()
|
||||
|
||||
if (formItem && formItem.$el) {
|
||||
const inputEl =
|
||||
formItem.$el.querySelector('input') ||
|
||||
formItem.$el.querySelector('textarea') ||
|
||||
formItem.$el.querySelector('.el-input__inner') ||
|
||||
formItem.$el.querySelector('.el-textarea__inner')
|
||||
if (inputEl) {
|
||||
inputEl.focus()
|
||||
}
|
||||
}
|
||||
callback?.(valid, fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 拦截 Vue.component
|
||||
if (Vue.component) {
|
||||
const originalComponent = Vue.component
|
||||
Vue.component = function(name, def) {
|
||||
const res = originalComponent.apply(this, arguments)
|
||||
|
||||
if (name === 'el-form' && def) {
|
||||
const originalMounted = def.mounted
|
||||
def.mounted = function() {
|
||||
autoEnhanceForm(this)
|
||||
originalMounted?.call(this)
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
if (Vue.extend) {
|
||||
const originalExtend = Vue.extend
|
||||
Vue.extend = function() {
|
||||
const Ctor = originalExtend.apply(this, arguments)
|
||||
|
||||
if (Ctor.options?.name === 'ElForm') {
|
||||
const originalMounted = Ctor.options.mounted
|
||||
Ctor.options.mounted = function() {
|
||||
autoEnhanceForm(this)
|
||||
originalMounted?.call(this)
|
||||
}
|
||||
}
|
||||
|
||||
return Ctor
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,7 @@
|
||||
<script src="${base!}/assets/platform/js/mixin/initTableMixins.js"></script>
|
||||
<script src="${base!}/assets/platform/js/mixin/styleMixin.js"></script>
|
||||
<script src="${base!}/assets/platform/js/tool/businessTool.js"></script>
|
||||
<script src="${base!}/assets/platform/js/util/autoShowError.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
window._AMapSecurityConfig = {
|
||||
|
||||
Reference in New Issue
Block a user