mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-23 21:36:37 +08:00
优化代码
This commit is contained in:
parent
799ab1c9fb
commit
c36b14c1b5
@ -66,7 +66,7 @@
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.apiGet('/oaWorkflow/queryOaWorkflowFormData',
|
||||
vc.http.apiGet('/oaWorkflow/queryOaWorkflowUserHisTaskFormData',
|
||||
param,
|
||||
function (json, res) {
|
||||
var _newOaWorkflowFinishInfo = JSON.parse(json);
|
||||
|
||||
@ -45,11 +45,47 @@
|
||||
},
|
||||
_initForm: function () {
|
||||
const container = document.querySelector('#form');
|
||||
FormViewer.createForm({
|
||||
const form = FormViewer.createForm({
|
||||
container,
|
||||
schema: $that.newOaWorkflowFormInfo.formJson
|
||||
});
|
||||
console.log(form);
|
||||
form.then((_from) => {
|
||||
_from.on('submit', (event) => {
|
||||
$that._submitFormData(event.data, event.errors);
|
||||
})
|
||||
})
|
||||
},
|
||||
_submitFormData(_data, _err) {
|
||||
if (Object.keys(_err).length != 0) {
|
||||
return;
|
||||
}
|
||||
console.log('我要的数据', _data);
|
||||
_data.flowId = $that.newOaWorkflowFormInfo.flowId;
|
||||
|
||||
vc.http.apiPost(
|
||||
'/oaWorkflow/saveOaWorkflowFormData',
|
||||
JSON.stringify(_data),
|
||||
{
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
//关闭model
|
||||
vc.toast('提交成功');
|
||||
vc.emit('newOaWorkflow', 'switch', 'newOaWorkflowPool')
|
||||
return;
|
||||
}
|
||||
vc.toast(_json.msg);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
|
||||
vc.toast(errInfo);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.apiGet('/oaWorkflow/queryOaWorkflowFormData',
|
||||
vc.http.apiGet('/oaWorkflow/queryOaWorkflowUserTaskFormData',
|
||||
param,
|
||||
function (json, res) {
|
||||
var _newOaWorkflowUndoInfo = JSON.parse(json);
|
||||
|
||||
@ -1126,23 +1126,23 @@
|
||||
}
|
||||
|
||||
if (validate.required && (typeof value === 'undefined' || value === '')) {
|
||||
errors = [...errors, 'Field is required.'];
|
||||
errors = [...errors, '此项必填.'];
|
||||
}
|
||||
|
||||
if ('min' in validate && value && value < validate.min) {
|
||||
errors = [...errors, `Field must have minimum value of ${validate.min}.`];
|
||||
errors = [...errors, `此项值不得小于 ${validate.min}.`];
|
||||
}
|
||||
|
||||
if ('max' in validate && value && value > validate.max) {
|
||||
errors = [...errors, `Field must have maximum value of ${validate.max}.`];
|
||||
errors = [...errors, `此项值不得大于 ${validate.max}.`];
|
||||
}
|
||||
|
||||
if ('minLength' in validate && value && value.trim().length < validate.minLength) {
|
||||
errors = [...errors, `Field must have minimum length of ${validate.minLength}.`];
|
||||
errors = [...errors, `此项字数不得少于 ${validate.minLength}.`];
|
||||
}
|
||||
|
||||
if ('maxLength' in validate && value && value.trim().length > validate.maxLength) {
|
||||
errors = [...errors, `Field must have maximum length of ${validate.maxLength}.`];
|
||||
errors = [...errors, `此项字数不得大于 ${validate.maxLength}.`];
|
||||
}
|
||||
|
||||
return errors;
|
||||
|
||||
@ -17,6 +17,9 @@
|
||||
vc.on('newOaWorkflow', 'listNewOaWorkflow', function (_param) {
|
||||
vc.component._listNewOaWorkflows(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
});
|
||||
vc.on('newOaWorkflow','switch',function(_switchValue){
|
||||
$that.swatch(_switchValue);
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
swatch: function (_value) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user