From 0a4d6c99164619b78f439efd0f9673e07b67bf0d Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: Tue, 14 Sep 2021 21:31:59 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../newOaWorkflowUndo/newOaWorkflowUndo.html | 10 +-
.../newOaWorkflowUndo/newOaWorkflowUndo.js | 28 ++++--
.../newOaWorkflowFormEdit.html | 73 +++++++++++++-
.../newOaWorkflowFormEdit.js | 94 +++++++++++++------
4 files changed, 160 insertions(+), 45 deletions(-)
diff --git a/public/components/property/newOaWorkflowUndo/newOaWorkflowUndo.html b/public/components/property/newOaWorkflowUndo/newOaWorkflowUndo.html
index 97d01d790..96b554a4c 100644
--- a/public/components/property/newOaWorkflowUndo/newOaWorkflowUndo.html
+++ b/public/components/property/newOaWorkflowUndo/newOaWorkflowUndo.html
@@ -74,13 +74,17 @@
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/pages/property/newOaWorkflowFormEdit/newOaWorkflowFormEdit.js b/public/pages/property/newOaWorkflowFormEdit/newOaWorkflowFormEdit.js
index fe54f9f46..afae99db8 100644
--- a/public/pages/property/newOaWorkflowFormEdit/newOaWorkflowFormEdit.js
+++ b/public/pages/property/newOaWorkflowFormEdit/newOaWorkflowFormEdit.js
@@ -6,29 +6,30 @@
var DEFAULT_ROWS = 100;
vc.extends({
data: {
- newOaWorkflowFormInfo: {
+ newOaWorkflowFormEditInfo: {
formJson: {},
+ components: [],
conditions: {
},
flowId: '',
- id:'',
+ id: '',
}
},
_initMethod: function () {
- $that.newOaWorkflowFormInfo.flowId = vc.getParam('flowId');
- $that.newOaWorkflowFormInfo.id = vc.getParam('id');
- vc.component._listOaWorkflowForm(DEFAULT_PAGE, DEFAULT_ROWS);
+ $that.newOaWorkflowFormEditInfo.flowId = vc.getParam('flowId');
+ $that.newOaWorkflowFormEditInfo.id = vc.getParam('id');
+ vc.component._listOaWorkflowFormEdit(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function () {
-
+
},
methods: {
- _listOaWorkflowForm: function (_page, _rows) {
+ _listOaWorkflowFormEdit: function (_page, _rows) {
var param = {
params: {
page: 1,
row: 1,
- flowId: $that.newOaWorkflowFormInfo.flowId
+ flowId: $that.newOaWorkflowFormEditInfo.flowId
}
};
@@ -36,36 +37,64 @@
vc.http.apiGet('/oaWorkflow/queryOaWorkflowForm',
param,
function (json, res) {
- let _newOaWorkflowFormInfo = JSON.parse(json);
- $that.newOaWorkflowFormInfo.formJson = JSON.parse(_newOaWorkflowFormInfo.data[0].formJson);
- $that._initForm();
+ let _newOaWorkflowFormEditInfo = JSON.parse(json);
+ $that.newOaWorkflowFormEditInfo.formJson = JSON.parse(_newOaWorkflowFormEditInfo.data[0].formJson);
+ $that.newOaWorkflowFormEditInfo.components = $that.newOaWorkflowFormEditInfo.formJson.components;
+ $that._listOaWorkflowDetails();
+
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
- _initForm: function () {
- const container = document.querySelector('#form');
- 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);
- })
- })
+ _listOaWorkflowDetails: function () {
+ var param = {
+ params: {
+ page: 1,
+ row: 1,
+ id: $that.newOaWorkflowFormEditInfo.id,
+ flowId: $that.newOaWorkflowFormEditInfo.flowId
+ }
+ };
+
+ //发送get请求
+ vc.http.apiGet('/oaWorkflow/queryOaWorkflowFormData',
+ param,
+ function (json, res) {
+ var _newOaWorkflowDetailInfo = JSON.parse(json);
+ let _data = _newOaWorkflowDetailInfo.data[0];
+ $that.newOaWorkflowFormEditInfo.components.forEach(item => {
+ item.value = _data[item.key];
+ })
+ $that.$forceUpdate();
+ }, function (errInfo, error) {
+ console.log('请求失败处理');
+ }
+ );
},
- _submitFormData(_data, _err) {
- if (Object.keys(_err).length != 0) {
- return;
- }
- console.log('我要的数据', _data);
- _data.flowId = $that.newOaWorkflowFormInfo.flowId;
+ _submitFormData() {
+ //做数据校验
+ let _components = $that.newOaWorkflowFormEditInfo.components;
+ let _data = {
+ id: $that.newOaWorkflowFormEditInfo.id,
+ flowId: $that.newOaWorkflowFormEditInfo.flowId
+ };
+
+ _components.forEach(item => {
+ if (item.validate && item.validate.required == true && !item.value) {
+ vc.toast(item.label + "不能为空")
+ throw Error(item.label + "不能为空");
+ }
+ if (item.type != 'button' && item.type != 'text') {
+ _data[item.key] = item.value;
+ if (item.type == 'checkbox') {
+ _data[item.key] = item.value.length > 0 ? item.value[0] : '';
+ }
+ }
+ });
vc.http.apiPost(
- '/oaWorkflow/saveOaWorkflowFormData',
+ '/oaWorkflow/updateOaWorkflowFormData',
JSON.stringify(_data),
{
emulateJSON: true
@@ -75,7 +104,7 @@
if (_json.code == 0) {
//关闭model
vc.toast('提交成功');
- vc.emit('newOaWorkflow', 'switch', 'newOaWorkflowPool')
+ $that.closeEditInfo();
return;
}
vc.toast(_json.msg);
@@ -86,6 +115,9 @@
vc.toast(errInfo);
});
+ },
+ closeEditInfo: function () {
+ vc.goBack();
}
}
});